Open vaish1234567 opened 6 years ago
Hi, I also have this problem, Do you solve it?
I solved this error by understanding how com types work
When we create an Autocad object using
acad = Autocad()
pyautocad
creates an object using comtypes by calling comtypes.client.GetActiveObject('AutoCAD.Application', dynamic=True)
'AutoCAD.Application' is a comtype registered in the windows registry
You should find it under
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoCAD.Application
however in the our case when the exception Invalid class string means that the path doesnt exist
So to fix this you may clone AutoCAD.Application registry from another path
HKEY_CURRENT_USER\SOFTWARE\Classes\AutoCAD.Application
Cloning all keys under the AutoCAD.Application from HKEY_CURRENT_USER to HKEY_LOCAL_MACHINE fixed it in my machine
I copied the keys by creating new keys manually in the target location
Just copied one registry key : AutoCAD.Application
AutoCAD.Application:{
CLSID {8B4929F8-076F-4AEC-AFEE-8928747B7AE3}
CurVer AutoCAD.Application.24
}
Using Autocad 2020 and python 2.7
I tried the following : from pyautocad import Autocad, APoint acad = Autocad(create_if_not_exists=True) acad.prompt("Hello, Autocad from Python\n")
The following is the error i m getting :