Obtaining load command in openseespy when pyfile= True
Dear Ospgrillage Team,
I am working on modeling a simply supported composite bridge using Ospgrillage. The results I obtained are closely aligned with commercially available software, and I appreciate the platform's ease of use.
I have tried to obtain the Python file created using the create_osp_model command. However, we obtain only the properties of members and nodes in the python file. I wanted to know if there is any way to obtain the Python file containing the openseespy code for the applied loads as well.
@harsshh14
Thank you for bringing this to our attention.. ospgrillage have this feature but after reviewing its implementation, we've confirmed that while this feature exists, it's not currently functioning as intended.
We will address this alongside the other issues (e.g. #120 ). In the meantime please let us know if you have developed a workaround for this.
Justin
@harsshh14
Apologies for the delay, and thank you for your patience!
I’ve reviewed the code, and everything is working as intended. Here’s how you can generate the Python file with the OpenSeesPy commands for the applied load:
-
Set
pyfile = Truewhen callingcreate_osp_model(pyfile=True). This will generate the model file as{filename}.py. -
Add your load case and analysis code as usual. For example, to apply a line load named "Barrier":
Barrier = og.create_load(
name="Barrier curb load",
point1=barrierpoint_1,
point2=barrierpoint_2,
)
ULS_DL = og.create_load_case(name="Barrier")
ULS_DL.add_load(Barrier) # ch
example_bridge.add_load_case(ULS_DL)
example_bridge.analyze()
-
When you call
example_bridge.analyze(), a.pyfile containing the correspondingload()commands will be generated, thanks to thepyfile = Trueflag. -
The output file will be named
{load_case_name}{filename}.py.
Let me know if anything is unclear or if you have suggestions for improving the workflow. Happy to help further!