[Python] Error while trying to create API Helper object for ETABS using Python

Discussão em 'Python' iniciado por Stack, Setembro 11, 2024.

  1. Stack

    Stack Membro Participativo

    So I'm working on a python code to connect to ETABS API and extract and write information from/to the model.

    The issue I'm having is that the code wont run because it gives the following error:

    Error creating ETABS helper object: [WinError -2147221005] Invalid class string

    Here's an extract from the code I'm working with:

    import os
    import sys
    import comtypes.client

    AttachToInstance = False

    SpecifyPathETABS = True

    SpecifyPathSAP2000 = True

    ETABSProgramPath = R'C:\Program Files\Computers and Structures\ETABS 22\ETABS.exe'

    SAP2000ProgramPath = R'C:\Program Files\Computers and Structures\SAP2000 22\SAP2000.exe'

    #set it to the desired path of your model folder
    APIPath = R'~path to model location~'

    #full path to the ETABS model
    ModelPath = APIPath + os.sep + 'model.EDB'

    #create API helper object for ETABS
    try:
    helper = comtypes.client.CreateObject('ETABSv1.Helper')
    helper = helper.QueryInterface(comtypes.gen.ETABSv1.cHelper)
    except (OSError, comtypes.COMError) as e:
    print(f"Error creating ETABS helper object: {e}")
    sys.exit(-1)


    I've tried loading ETABSv1.dll into registry using regsvr32, but got an error.. guess it's not the correct file to load to registry.

    Don't know what else to try to fix this.

    Continue reading...

Compartilhe esta Página