Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

ETABs API & Python - Spandrel Forces - ETABs v18

Status
Not open for further replies.

sticksandtriangles

Structural
Apr 7, 2015
468
0
16
US
I am diving in to try to understand how to leverage the ETABs API to retrieve analysis results (rather than outputting excel type files and importing that data into python).

I am struggling to understand how to retrieve spandrel results from the model.
My current code:

Python:
import os
import sys
import comtypes.client

ProgramPath = r"C:\Program Files\Computers and Structures\ETABS 18\ETABS.exe"

ModelPath = r"C:\Users\me\Desktop\ETABs Models\my_model.EDB"
helper = comtypes.client.CreateObject('ETABSv1.Helper')
helper = helper.QueryInterface(comtypes.gen.ETABSv1.cHelper)
#create API helper object
myETABSObject = helper.CreateObject(ProgramPath)

#start ETABS application
myETABSObject.ApplicationStart()
#create SapModel object
SapModel = myETABSObject.SapModel
#initialize model
ret = SapModel.InitializeNewModel()

#open an existing file
ret = SapModel.File.OpenFile(ModelPath)
#run model (this will create the analysis model)
ret = SapModel.Analyze.RunAnalysis()

[u][b]#spandrelresults=SapModel.AnalysisResults.SpandrelForce()[/b][/u]
[u][b]spandrelresults=SapModel.AnalysisResults.SpandrelForce(1,"Level 1","S1", "Dead","Left")[/b][/u]



#values = SapModel.DatabaseTables.GetAllTables

This code opens the ETABs model I path to and the analysis is run, but I have played around with the bolded and underlined line part of code and have yet to get any results from the model. Documentation for this in python seems to be a little lacking. I am not sure what inputs to the spandrelforce function are required to achieve output. Ideally I would like to pull results (V2,M3) for all load cases (dead, live, etc.) for all spandrels in my model.

Thanks for your thoughts



S&T
 
Replies continue below

Recommended for you

Not sure if it's different in python, but in C# you have to initialize and pass in the forces by reference. So the pseudo code would be

//define all these arrays for P, V2, etc.... then
ret = SapModel.AnalysisResults.SpandrelForce(1,"Level 1","S1", "Dead","Left", ref P, ref V2, ref V3, ref T, ref M2, ref M3)

The outputs are populated in those variables passed into the function.

In python example, it looks like they put all the variables in the input and output:

[NumberResults, Obj, Elm, ACase, StepType, StepNum, U1, U2, U3, R1, R2, R3, ret] = SapModel.Results.JointDispl(PointName1, ObjectElm, NumberResults, Obj, Elm, ACase, StepType, StepNum, U1, U2, U3, R1, R2, R3)

So maybe try
[P, V2, V3, T, M2, M3, ret] = SapModel.AnalysisResults.SpandrelForce(1,"Level 1","S1", "Dead","Left", P, V2, V3, T, M2, M3)
 
Status
Not open for further replies.
Back
Top