newbie: passing array to AutoCad through COM

H vd Horst hvdh at imagus.nl
Fri Mar 11 18:00:00 EST 2005


I know this is an old topic and addressed before.I Googled and found 
some old messages about this and other programs as well, but never read 
about an actual solution.

I'm new to Python and haven't done much programming in a long time.
I want to use it to generate objects in drawings and analyze them from 
outside of VBA AutoLisp.
Sending and retrieving strings and integers does work.

I can also get arrays from the program ie.
>>>point = Doc.Utility.GetPoint()
returns 
(453.81901618016582, 422.54691828835212, 0.0)

But when I send an array wether Tuple or List I get an error.
>>> point = Doc.ModelSpace.AddPoint((0,0,0))

returns
Traceback (most recent call last):  File "<interactive input>", line 1, 
in ?  File "C:\Python24\lib\site-packages\win32com\gen_py\1EFD8E85-7F3B-
48E6-9341-3C8B2F60136Bx0x1x1\IAcadModelSpace.py", line 267, in AddPoint    
ret = self._oleobj_.InvokeTypes(1562, LCID, 1, (9, 0), ((12, 1),),Point)
com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, 
-2147024809), None)

I tried the same thing in IntelliCad and no problems there thanks to a 
slightly different object model. You have to declare a point Object you 
use as input for a -cartesian- coordinate.

AutoCad just regards every input as a variant as far as I can see

What am I doing wrong? Still working on understanding the mechanisms
Is there a -simple/easy- way to pass those coordinates to Acad?

thanks, Hans



More information about the Python-list mailing list