Im using python v2.6 to do some automation using the win32com module. Most of the COM works just fine, but I am having problems with any methods that require numerical VARIANTS as arguments (string based VARIANTS work as expected). I believe my issue is related to data types on python's end (with its array's specifically), although I am not entirely sure. I am currently trying to pass a 3-d array using 8-byte doubles, but the methods keep throwing exceptions. This is a rough example invocation...
(acadID).ActiveDocument.ModelSpace.AddPoint( [1.0, 1.0, 0.0] )
Here is the error python returns, although Im not sure if this is actually from python's win32com module or COM itself:
(-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147024809), None)
Can anybody relate to similiar problems from VB(A) / C++?
:r better yet, a python guru who knows what I am doing wrong
Thanks for any help.
Edited by: cpetzol2 on Feb 15, 2010 10:18 PM Edited by: cpetzol2 on Feb 15, 2010 10:23 PM
It can be done (only? in python 2.6). The issue was with the interface generated by win32com assigning the wrong type to the VARIANT.
You have to find the generated .py file in your path, and edit the variant type by hand. Sad part is that many functions have this error (hundreds), so you will probably only want to edit them as needed (unless you know how to hack win32com or you are great with regular expressions).
Afterwards (could take a while), all will be well in the world.
Hi. I`m absolutely new in programming, now I`m trying to use python 2.6 for my needs. And in future a want to use python for programming in AutoCAD. But I don`t know how to use python and ACAD together.
Please, can you give me advise what I have to read to understand this.
Best regards, Gontar Anton.