reclosedev / pyautocad

AutoCAD Automation for Python ⛺
http://pypi.python.org/pypi/pyautocad/
BSD 2-Clause "Simplified" License
485 stars 141 forks source link

(-2147352567, '예외가 발생했습니다.', ('키를 찾을 수 없습니다.', 'AutoCAD.Application', 'C:\\Program Files\\Autodesk\\AutoCAD 2020\\HELP\\OLE_ERR.CHM', -2145386476, None)) #50

Open greenaway0824 opened 8 months ago

greenaway0824 commented 8 months ago

I can't run an example file with the following error messages.

COMError Traceback (most recent call last) Cell In[7], line 27 25 p2=APoint(p2x[j],p2y[j]+z) 26 line1=acad.model.AddLine(p1,p2) ---> 27 line1.layer='Beam_LSection' 28 if j >= 8: 29 line1.layer='Text'

File ~\anaconda3\lib\site-packages\comtypes\client\lazybind.py:218, in Dispatch.setattr(self, name, value) 216 descr = put or putref 217 if descr.cParams == 1: --> 218 self._comobj._invoke(descr.memid, descr.invkind, 0, value) 219 return 220 raise AttributeError(name)

File ~\anaconda3\lib\site-packages\comtypes\automation.py:728, in IDispatch._invoke(self, memid, invkind, lcid, *args) 725 dp.rgdispidNamedArgs = pointer(DISPID(DISPID_PROPERTYPUT)) 726 dp.rgvarg = array --> 728 self.__com_Invoke(memid, riid_null, lcid, invkind, 729 dp, var, None, argerr) 730 return var._get_value(dynamic=True)

COMError: (-2147352567, '예외가 발생했습니다.', ('키를 찾을 수 없습니다.', 'AutoCAD.Application', 'C:\Program Files\Autodesk\AutoCAD 2020\HELP\OLE_ERR.CHM', -2145386476, None))

CEXT-Dan commented 8 months ago

Key not found, does the layer Beam_LSection exist in the drawing?

greenaway0824 commented 8 months ago

I don't know. I was just trying to run an example.

CEXT-Dan commented 8 months ago

then change to ine1.layer = "0" #zero

see if it works, all drawings have a zero layer

Also, if your using AutoCAD 2021 or later, you can try this library. Its being maintained https://github.com/CEXT-Dan/PyRx

greenaway0824 commented 8 months ago

then change to ine1.layer = "0" #zero

see if it works, all drawings have a zero layer

Also, if your using AutoCAD 2021 or later, you can try this library. Its being maintained https://github.com/CEXT-Dan/PyRx

It doesn't work perfectly but works partially and I think I can start from there. Thanks so much. Is there any manuals or examples I can refer to?

CEXT-Dan commented 8 months ago

Just the autocad activex documentation. Check out theswamp.org forums for cad programming

greenaway0824 commented 8 months ago

Just the autocad activex documentation. Check out theswamp.org forums for cad programming

Thanks a lot.