Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

ETABS API (python)-Assigning Frame Problem

Status
Not open for further replies.

HandyPrayogo

Civil/Environmental
Joined
May 20, 2022
Messages
4
Location
TW
Hi, I have been experimenting with optimizing truss using metaheuristic algorithm using python.
I have been able to open ETABS, assign all frame member with the available option using and index, running the model, and extracting the result.
However, I encountered some unintended result. When I tried to assign for example:
Python:
# the combination of frame that will be assign to each member (0-15)
x=np.array([3, 2, 3, 2, 1, 6, 2, 1, 2, 6, 1, 3, 2, 1, 5, 6, 1, 3, 1, 5, 1, 15])
The ETABS will result in all member using the option index 15 (the last one).
wrong_output_dawzme.png


I suspect, it might be because I use:
Python:
sapModel.DesignSteel.SetDesignSection(framename,section_type,False,0)
it assign all member instead of targeted member, the function syntax is shown here:
syntax_hoa4aw.png

I'm not sure about the last input to the function, since the CSI API does not provide python example.

I attached my model with a simple python code to show my problem. I would be very grateful if somebody could help me fix this problem
Thank you.
 
The last option is optional if you check the VB syntax. Generally I apply only to the object, this would be the frame name.

Python:
SapModel.DesignSteel.SetDesignSection(framename,section_type,False,0); #for object or
SapModel.DesignSteel.SetDesignSection(framename,section_type,False); #for object
SapModel.DesignSteel.SetDesignSection(groupname,section_type,False,1); #for group
SapModel.DesignSteel.SetDesignSection(anyname,section_type,False,2); #for selected objects
 
I have used 0 and every beam still changes as seen from my code.
Maybe I'm supposed to use enumeration of somekind (?)
Anyway it does not change the outcome using int (0,1,2).
 
I have made some new observation.
If I used SetDesignSection(framename,section_type,False,0) in succession (e.g. in a loop)
it always changed all the framename that have been changed before.
so if I change beam 82,83,84. This three beam will follow the frame that 84 used.
I don't know why does this happen.
If I run the model in between the SetDesignSection, it does not happen.

I would be grateful if there is another way to circumvent this problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top