Issue Connecting to AutoCAD LT 2024: Seeking Assistance with Python Code

65 Views Asked by At

Hello StackOverflow community, I am currently facing a challenge with connecting or opening AutoCAD LT 2024 using a Python script. Below is the relevant code snippet that I am using for this purpose:

try:
    app = comtypes.client.GetActiveObject("AutoCAD.Application")
    logging.info('AutoCAD Already Open..!!!')
except:
    app = comtypes.client.CreateObject("AutoCAD.Application")
    logging.info('AutoCAD Opening..!!!')

Unfortunately, I am encountering the following error: pywintypes.com_error: (-2147221164, 'Class not registered', None, None)

I suspect there might be an issue with the registration of the AutoCAD class. I would greatly appreciate any insights, suggestions, or updates to the code that could help resolve this issue. If you have encountered a similar problem or have expertise in working with AutoCAD LT 2024 and Python, your guidance would be invaluable.

Thank you in advance for your time and assistance!

i am checking with comtypes.client or pywin32 library

0

There are 0 best solutions below