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

                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)

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

Our Sidebar

You can put any information here you'd like.

  • Latest Comments
  • retug on Diaphragm Slicer New and Improved -

    Hi Trenno, I just uploaded a new .dll file to github that has metric units included. Give it a whirl, let me know if you have any trouble on the install. I think it should be as easy as downloading the .dll file and adding the file path to the 

  • Trenno on Diaphragm Slicer New and Improved -

    How's the Metric version coming along? Keen to check it the tool. 

    Could you set it up so that the model is run within the initial steps of routine of the plugin? 

  • retug on Project Management with Deltek -

    Hi Tushar, I've used Seaborn as well, it's a good package. 

    I use Matplotlib for quick and dirty plotting, you just can't beat the amount of documentation and examples you can find out there for it.