reclosedev / pyautocad

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

need help,run the samlpe ,error: #15

Open glados17 opened 7 years ago

glados17 commented 7 years ago

Hello, Autocad from Python

Drawing1.dwg

COMError Traceback (most recent call last)

in () 15 16 dp = APoint(10, 0) ---> 17 for text in acad.iter_objects('Text'): 18 print('text: %s at: %s' % (text.TextString, text.InsertionPoint)) 19 text.InsertionPoint = APoint(text.InsertionPoint) + dp D:\pythonp\anaconda2\lib\site-packages\pyautocad\api.pyc in iter_objects(self, object_name_or_list, block, limit, dont_cast) 126 continue 127 if not dont_cast: --> 128 item = self.best_interface(item) 129 yield item 130 D:\pythonp\anaconda2\lib\site-packages\pyautocad\api.pyc in best_interface(self, obj) 154 def best_interface(self, obj): 155 """ Retrieve best interface for object """ --> 156 return comtypes.client.GetBestInterface(obj) 157 158 def prompt(self, text): D:\pythonp\anaconda2\lib\site-packages\comtypes\client\__init__.pyc in GetBestInterface(punk) 124 # Could the above code, as an optimization, check that QI works, 125 # *before* generating the wrapper module? --> 126 result = punk.QueryInterface(interface) 127 logger.debug("Final result is %s", result) 128 return result D:\pythonp\anaconda2\lib\site-packages\comtypes\client\lazybind.pyc in QueryInterface(self, *args) 140 def QueryInterface(self, *args): 141 "QueryInterface is forwarded to the real com object." --> 142 return self._comobj.QueryInterface(*args) 143 144 def __cmp__(self, other): D:\pythonp\anaconda2\lib\site-packages\comtypes\__init__.pyc in QueryInterface(self, interface, iid) 1156 if iid is None: 1157 iid = interface._iid_ -> 1158 self.__com_QueryInterface(byref(iid), byref(p)) 1159 clsid = self.__dict__.get('__clsid') 1160 if clsid is not None: COMError: (-2147467262, '\xb2\xbb\xd6\xa7\xb3\xd6\xb4\xcb\xbd\xd3\xbf\xda', (None, None, None, 0, None))