This blog is finally starting to pay off, people are emailing with programming questions and problems. Making programming a little more accessible has always been the goal with the site. Programming can be intimidating to get started!

Foad Kondori emailed me awhile back trying to make a SAP2000 plugin to access frame reactions in SAP2000. I had never written a plugin for SAP2000, but I had written some python code awhile back to access ETABs frame force reactions in Python. I was able to send him my code and he was able to do the rest of the magic to translate the python code to C#. 

The code he wrote is really cool and I appreciate that he allowed me to share this code on github and the blog. Sample shown below retrieving selected frame object type and name

There was one small bug he had in his program and I was able to trouble shoot the culprit, moving the data source out of the for loop did the trick.

His example also provided me some insight on better ways to manage if the SAP/ETABs model has run. 

 bool isModelRunning = _SapModel.GetModelIsLocked();
            if (isModelRunning)
            {

                //get Frame Force

else
            {
                DialogResult result_2 = MessageBox.Show("the model is not run, Do you want Run the model ?"
, "Run Analysis", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                if (result_2 == DialogResult.Yes)
                {
                    _SapModel.Analyze.RunAnalysis();
                }
            }
        }

These are things I need to implement in the section cutter tool to prevent time consuming re-runs.

Also, I need to dig in and understand why the section cutter ETABs plugin does not work in SAP2000. The APIs between the two program look very similar, but the section cutter plugin does not work in SAP 2000. Foad's example will be a good place to start when trying to troubleshoot.

To CSI, can we improve the SAP OAPi documentation? It only appears to be written for VBA, maybe it could be updated to match that of ETABs, with samples provided for multiple languages?

Feel free to reach out anytime if you are running into programming trouble, I'll try to help if I have the time.

C Sharp SAP2000

Congrats on your great blog! Not many people are writing about the SAP2000 API! Probably because it really sucks!

There's a nice Python wrapper for it here with pretty good documentation, it's a work in progress but is shaping up well (not my project btw). https://github.com/rpakishore/ak_sap

I use it for stuff like adjusting load cases or pulling analysis results.

Thanks James, appreciate you taking a look at the blog.

The stuff you have been making is really cool too, always happy to see more people making coding more approachable for the practicing structural engineer.

The package you linked for SAP2000 looks good, I will have to check it out.

Our Sidebar

You can put any information here you'd like.

  • Latest Comments
  • retug on Transfer Diaphragm Design -

    Hi Muhamad,

    Feel free to shoot me an email if you want to discuss anything diaphragm design related.

    You can also drop your insights in the comments too, similar to what e95kwon has done. I now transfer diaphragm design matching his and NCSEA's recommendations.

  • Muhamad on Transfer Diaphragm Design -

    Hi guys, interesting topic. I have a good knowledge on diaphragm design. would you be interest to have a meeting to discuss things further? 

  • marcello on RAM API - Cracked -

    Austin

    I’m glad you found the class helpful on learning how to access the RAM API using dynamo.

    Marcello