Using OpenSTAAD to create a model outside STAAD
Issue #: SP-5593 Date Posted: 6/20/2003
Description: How do I use OpenSTAAD to create a model outside STAAD (like in Excel), run the file and then extract the results back in Excel?
Solution: It is possible to create a STAAD file outside of the STAAD modeling environment without having to write macros that simply regurgitate STAAD syntax commands like JOINT COORDINATES or MEMBER INCIDENCES. OpenSTAAD 2.0 and higher allows you to control the STAAD processor indirectly through commands like AddNode, AddBeam, AssignBeamProperty, etc. What you need to do, however, is have STAAD.Pro open (running in the background) and a new file open. With Excel (or any VBA-enabled application), create a macro like this:
Sub Examp1() Set objOpenSTAAD1 = GetObject(, "StaadPro.OpenSTAAD")
objOpenSTAAD1.Geometry.AddNode 10, 20, 10 objOpenSTAAD1.Geometry.AddNode 30, 50, 20 objOpenSTAAD1.Geometry.AddBeam 1, 2 Set objOpenSTAAD1 = Nothing End Sub
After creating the macro, you can either run it inside Excel or within the new embedded STAAD.Pro VBA editor. Either way, you will see the model being created in STAAD.Pro. To run the analysis on the model, simply save the model and run it inside STAAD.Pro. There is currently no exposed function to run the STAAD engine separately. You can then use the other OpenSTAAD library (Results Object) to extract all the data into Excel. For the latter, you do not need to have STAAD open.