Message 1 of 3
Unknown exception for TransformBy method
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to use the TransformBy method for a solid object using Python in AutoCAD. But the code throws an unknown exception. I also tried to use aDouble data structure but no luck. The code is as below:
''
import time
from pyautocad import Autocad, APoint, aDouble
acad = Autocad()
loft_3D = acad.model.AddBox(APoint(0, 0, 0), 4, 6, 2)
line = acad.model.AddLine(APoint(0, 0, 0), APoint(100, 500, 0))
p0 = APoint(0,0,0)
px = APoint(100,0,0)
py = APoint(0,100,0)
MiUCS = acad.doc.UserCoordinateSystems.Add(p0, px, py, "UCS_NEW_1")
VarMatrix = MiUCS.GetUCSMatrix()
print(VarMatrix)
VarMatrix_1=((0.7071, -0.7071, 0.0, 5.0), (0.7071, 0.7071, 0.0, -2.07), (0.0, 0.0, 1.0, 0.0), (0.0, 0.0, 0.0, 1.0))
time.sleep(5)
loft_3D.TransformBy(VarMatrix_1)
Error:
Traceback (most recent call last):
File "D:\Tanmay\Knowledgebase\Civil\Automation\pyautocad\Test\test4.py", line 34, in <module>
loft_3D.TransformBy(VarMatrix_1) # Here the error occurs
File "C:\Users\91998\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\comtypes\client\lazybind.py", line 182, in caller
return self._comobj._invoke(descr.memid, descr.invkind, 0, *args)
File "C:\Users\91998\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\comtypes\automation.py", line 728, in _invoke
self.__com_Invoke(memid, riid_null, lcid, invkind,
_ctypes.COMError: (-2147352567, 'Exception occurred.', (None, None, None, 0, None))
File "D:\Tanmay\Knowledgebase\Civil\Automation\pyautocad\Test\test4.py", line 34, in <module>
loft_3D.TransformBy(VarMatrix_1) # Here the error occurs
File "C:\Users\91998\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\comtypes\client\lazybind.py", line 182, in caller
return self._comobj._invoke(descr.memid, descr.invkind, 0, *args)
File "C:\Users\91998\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\comtypes\automation.py", line 728, in _invoke
self.__com_Invoke(memid, riid_null, lcid, invkind,
_ctypes.COMError: (-2147352567, 'Exception occurred.', (None, None, None, 0, None))