Error when getting Python to attach to ETABS
Error when getting Python to attach to ETABS
(OP)
Hi, I'm using the following code:
I'm getting an attribute error:
Does anyone know how to fix this?
I'm using Pycharm, ETABS v18.
import sys
import comtypes.client
try:
myETABSObject = comtypes.client.GetActiveObject("CSI.ETABS.API.ETABSObject")
except (OSError, comtypes.COMError):
print("No running instance of the program found or failed to attach.")
sys.exit(-1)
SapModel = myETABSObject.SapModel
import comtypes.client
try:
myETABSObject = comtypes.client.GetActiveObject("CSI.ETABS.API.ETABSObject")
except (OSError, comtypes.COMError):
print("No running instance of the program found or failed to attach.")
sys.exit(-1)
SapModel = myETABSObject.SapModel
I'm getting an attribute error:
AttributeError: module 'comtypes.gen.CSiAPIv1' has no attribute 'cOAPI'
Does anyone know how to fix this?
I'm using Pycharm, ETABS v18.
RE: Error when getting Python to attach to ETABS
https://www.eng-tips.com/viewthread.cfm?qid=455667
S&T
RE: Error when getting Python to attach to ETABS
RE: Error when getting Python to attach to ETABS
What comtypes version are you using. When I first started using the etabs API with python early in 2019 I was using comtypes version 1.1.2, that was giving me some trouble and I had to change a little bit of the __init__.py file to get it working, I remember it being something like a try block with no exception catch. However, many of my colleagues started using my scritps and they where using comtypes 1.1.7 (still current release). Now, I think there are still some bugs with this version of comtypes, I still get errors when trying to get modal output. Will try and did into it a bit further. But what version of comtypes are you using.
RE: Error when getting Python to attach to ETABS
RE: Error when getting Python to attach to ETABS
How are the scripts going, I see by some of your other posts that you are looking to write a few custom functions to automate your workflow?
RE: Error when getting Python to attach to ETABS
First code I'm going to write it to take raw coordinate data from Revit (using a dynamo script) and then develop a python code that will build a model with the geometric data in ETABS. I think it will be a good project to develop an understanding of the API. Then I'm not sure which direction I will go, I feel like understanding ETABS API will open a lot of doors for automation!