ospgrillage icon indicating copy to clipboard operation
ospgrillage copied to clipboard

Obtaining load command in openseespy when pyfile= True

Open harsshh14 opened this issue 11 months ago • 2 comments

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 avatar Feb 18 '25 06:02 harsshh14

@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

justinngan92 avatar May 02 '25 12:05 justinngan92

@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:

  1. Set pyfile = True when calling create_osp_model(pyfile=True). This will generate the model file as {filename}.py.

  2. 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()
  1. When you call example_bridge.analyze(), a .py file containing the corresponding load() commands will be generated, thanks to the pyfile = True flag.

  2. 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!

justinngan92 avatar May 30 '25 05:05 justinngan92