wccppp,<br><br>I too am working on this same issue as we speak.&nbsp; It is my goal to automate AutoCAD using Python.&nbsp; I've had success using C# (.net) for Automation but I haven't given up with Python yet.&nbsp; I have done searches here and there on various search engines and haven't come up with any complete answers on passing 3 doubles as an array of Variants.&nbsp; This as you see doesn't happen automatically as it should and Mark has mentioned that idispatch invoke() manually is the way to correctly pass them.&nbsp; I have yet to master invoke and all the params.&nbsp; What I need is a working example of Invoke and its parameters.&nbsp; It seems AutoCAD object model is easy to decifer and the passing and retrieval of a Variant(s) in Python are my only stepping stones to complete a successful automation.&nbsp; I am continually monitoring this mailing list and in my research I will pass on any information that I uncover.
<br><br>Drkick16<br><br><br><div><span class="gmail_quote">On 12/11/05, <b class="gmail_sendername"><a href="mailto:python-win32-request@python.org">python-win32-request@python.org</a></b> &lt;<a href="mailto:python-win32-request@python.org">
python-win32-request@python.org</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Send Python-win32 mailing list submissions to
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="mailto:python-win32@python.org">python-win32@python.org</a><br><br>To subscribe or unsubscribe via the World Wide Web, visit<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://mail.python.org/mailman/listinfo/python-win32">http://mail.python.org/mailman/listinfo/python-win32
</a><br>or, via email, send a message with subject or body 'help' to<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="mailto:python-win32-request@python.org">python-win32-request@python.org</a><br><br>You can reach the person managing the list at<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="mailto:python-win32-owner@python.org">python-win32-owner@python.org</a><br><br>When replying, please edit your Subject line so it is more specific<br>than &quot;Re: Contents of Python-win32 digest...&quot;
<br><br><br>Today's Topics:<br><br>&nbsp;&nbsp; 1. question about COM again: variable type? (wccppp)<br><br><br>----------------------------------------------------------------------<br><br>Message: 1<br>Date: Sat, 10 Dec 2005 23:30:46 -1000
<br>From: wccppp &lt;<a href="mailto:wccppp@gmail.com">wccppp@gmail.com</a>&gt;<br>Subject: [python-win32] question about COM again: variable type?<br>To: <a href="mailto:python-win32@python.org">python-win32@python.org</a>
<br>Message-ID:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;<a href="mailto:87bd46aa0512110130u70570e7fy4be4b95f5163b1df@mail.gmail.com">87bd46aa0512110130u70570e7fy4be4b95f5163b1df@mail.gmail.com</a>&gt;<br>Content-Type: text/plain; charset=&quot;iso-8859-1&quot;
<br><br>Hello,<br><br>I'm having problem implementing a &quot;AddPoint&quot; method in AutoCAD.&nbsp;&nbsp;From the<br>search I've done,&nbsp;&nbsp;seems the problem is variable type: I supplied a list as<br>the x,y,z coordinates of a point, why seems what is expected is a Variant
<br>(three-element array of doubles).<br><br>The python code I tested with is:<br><br>[code]<br><br>import win32com.client<br><br>acad = win32com.client.Dispatch(&quot;AutoCAD.Application&quot;)<br>acad.WindowState = 3<br>
acad.Visible = 1<br><br>doc = acad.ActiveDocument<br>ms = doc.ModelSpace<br>print str(ms.ObjectName)<br>try:<br>&nbsp;&nbsp;&nbsp;&nbsp;ms.AddPoint([0.0, 0.0, 0.0])&nbsp;&nbsp; # this line gives the problem<br>finally:<br>&nbsp;&nbsp;&nbsp;&nbsp;print &quot;\nTest finished.&quot;
<br><br>[/code]<br><br>This is the error I got:<br><br>Traceback (most recent call last):<br>&nbsp;&nbsp;File &quot;&lt;string&gt;&quot;, line 65, in run_nodebug<br>&nbsp;&nbsp;File &quot;C:\Programming\Python\Codes\acad_add_point.py&quot;, line 11, in ?
<br>&nbsp;&nbsp;&nbsp;&nbsp;ms.AddPoint([0.0, 0.0, 0.0])<br>&nbsp;&nbsp;File &quot;C:\Python24\lib\site-packages\win32com\gen_py\1EFD8E85-<br>7F3B-48E6-9341-3C8B2F60136Bx0x1x1.py&quot;, line 12688, in AddPoint<br>&nbsp;&nbsp;&nbsp;&nbsp;ret = self._oleobj_.InvokeTypes(1562, LCID, 1, (9, 0), ((12, 1),),Point
<br>pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None,<br>None, 0, -2147024809), None)<br><br><br>python code for AddPoint method from makepy:<br><br># Result is of type IAcadPoint<br>def AddPoint(self, Point=defaultNamedNotOptArg):
<br>&nbsp;&nbsp;&nbsp;&nbsp;&quot;&quot;&quot;Creates a Point object at a given location&quot;&quot;&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;ret = self._oleobj_.InvokeTypes(1562, LCID, 1, (9, 0), ((12, 1),),Point)<br>&nbsp;&nbsp;&nbsp;&nbsp;if ret is not None:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ret = Dispatch(ret, 'AddPoint',
<br>'{35AF3AB5-755E-4AC9-8BAF-31B532870751}', UnicodeToString=0)<br>&nbsp;&nbsp;&nbsp;&nbsp;return ret<br><br><br>And finally, below is the VBA doucumentation provided with AutoCAD.<br><br>Signature<br><br>RetVal = object.AddPoint(Point)<br>
<br>Object<br><br>ModelSpace Collection, PaperSpace Collection, Block<br>The object or objects this method applies to.<br><br>Point<br><br>Variant (three-element array of doubles); input-only<br>The coordinates of the point to be created.
<br><br>RetVal<br><br>Point object<br>The newly created Point object.<br><br>Example:<br><br>Sub Example_AddPoint()<br>&nbsp;&nbsp;&nbsp;&nbsp;' This example creates a point in model space.<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim pointObj As AcadPoint<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim location(0 To 2) As Double
<br><br>&nbsp;&nbsp;&nbsp;&nbsp;' Define the location of the point<br>&nbsp;&nbsp;&nbsp;&nbsp;location(0) = 5#: location(1) = 5#: location(2) = 0#<br><br>&nbsp;&nbsp;&nbsp;&nbsp;' Create the point<br>&nbsp;&nbsp;&nbsp;&nbsp;Set pointObj = ThisDrawing.ModelSpace.AddPoint(location)<br>&nbsp;&nbsp;&nbsp;&nbsp;ZoomAll<br><br>
End Sub<br><br>Sorry for the long post.&nbsp;&nbsp;I've actually spent more than 2 or 3 hours<br>searching the web for an answer.&nbsp;&nbsp;And I did see lots of discussions related<br>to this sort of issue: safearray, variant array, etc..&nbsp;&nbsp;But I didn't see a
<br>definite answer.&nbsp;&nbsp;More than likely it is because I'm a beginner in Python<br>and could not make sense out of those discussion.&nbsp;&nbsp;Can someone elaborate a<br>little bit on this?<br><br>Thanks a lot for just reading my long message.
<br><br>--<br><br>Regards,<br>- wcc<br>-------------- next part --------------<br>An HTML attachment was scrubbed...<br>URL: <a href="http://mail.python.org/pipermail/python-win32/attachments/20051210/f1dca702/attachment-0001.htm">
http://mail.python.org/pipermail/python-win32/attachments/20051210/f1dca702/attachment-0001.htm</a><br><br>------------------------------<br><br>_______________________________________________<br>Python-win32 mailing list
<br><a href="mailto:Python-win32@python.org">Python-win32@python.org</a><br><a href="http://mail.python.org/mailman/listinfo/python-win32">http://mail.python.org/mailman/listinfo/python-win32</a><br><br><br>End of Python-win32 Digest, Vol 33, Issue 14
<br>********************************************<br></blockquote></div><br><br clear="all"><br>-- <br>drkick16