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.