reclosedev / pyautocad

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

cannot find cad #14

Open unmht001 opened 7 years ago

unmht001 commented 7 years ago

i installed 2 versions of autocad cad2017 and cad2014 mechanical , i used code like this:

from pyautocad import Autocad a=Autocad() a.prompt("hello")

cad2014 mechanical was opened , why not cad2017? how to run this in cad2017?

unmht001 commented 7 years ago

i read api.py , i found this:

-----------------

def init(self, create_if_not_exists=False, visible=True): ....

--------------------

and this :

----------------

def app(self): .... self._app = comtypes.client.GetActiveObject('AutoCAD.Application', dynamic=True)

-------------------

i think , if init() and app() could know the version of autocad , will be better. like this .

self._app = comtypes.client.GetActiveObject('AutoCAD.Application.21', dynamic=True)

and it worked.

vaish1234567 commented 6 years ago

What is .21 in this self._app = comtypes.client.GetActiveObject('AutoCAD.Application.21', dynamic=True)?