pyautocad icon indicating copy to clipboard operation
pyautocad copied to clipboard

facing COM error

Open jaivishnuks opened this issue 5 years ago • 1 comments

Hi i tried a small code as shown below `from pyautocad import Autocad, APoint

acad = Autocad(create_if_not_exists=True) acad.prompt("Hello, Autocad from Python\n") print(acad.doc.Name)

for obj in acad.iter_objects(): print(obj.ObjectName)`

I am getting an error. COMError: (-2147417851, 'The server threw an exception.', (None, None, None, 0, None))

I am using python 3.7.7 , win10 64 bit and autocad mechanical 2019 with vba enabler engine installed.

jaivishnuks avatar May 04 '20 13:05 jaivishnuks

I encounter the same question, and I solved it by different way. for obj in acad.iter_objects(): print(obj.ObjectName)`

This reason may be we have installed more than one version of AutoCAD, so I changed :

for obj in self.acad.model: print(obj.ObjectName)

ninuo avatar Jun 17 '20 08:06 ninuo