You are on page 1of 2

OS.

Instantiating the OpenSTAAD Library for Use


The first thing necessary to access STAAD project data from within another applica on is to instan ate, or create an instance of OpenSTAAD within the other applica on. In Visual Basic for Applica ons (VBA), this may be done by crea ng an object variable and then
assigning to it the OpenSTAAD object. The VBA GetObject func on may be used for this.

The object which controls the STAAD.Pro environment is referred to as StaadPro.OpenSTAAD. This object must be created in order to get access to any of the internal graphical func ons within STAAD.Pro (including the crea ng of menu items and dialog boxes) as well as
access to STAAD’s viewing, geometry modeling, results grid, and post-processing func ons. The following VBA func on can be used to instan ate or create this object:

Copy to clipboard
Set MyObject = GetObject("filepath", "ojbectclass")

Where:

Se ng Descrip on
MyObject the Object name declared in a previous Dim statement.

filepath the op onal string providing the full file path and name of the file containing objects to retrieve. In the case of OpenSTAAD, this can be omi ed, along with the trailing comma.

objectclass the string represen ng the class of the object. In the case of OpenSTAAD, this is always Staadpro.OpenSTAAD.

Thus:
Copy to clipboard
Set objName = GetObject("StaadPro.OpenSTAAD")

At the conclusion of your OpenSTAAD applica on, the OpenSTAAD object(s) should be terminated, to unlock the handles within the applica on to the OpenSTAAD func ons, and to free system resources.

Example

Sub How2Begin()
'Create a variable to hold your OpenSTAAD object(s).

Dim objOpenSTAAD As Object


'Launch OpenSTAAD Object
Set objOpenSTAAD = GetObject(, "StaadPro.OpenSTAAD")

'At the end of your application, remember to terminate the OpenSTAAD objects.

Set objOpenSTAAD = Nothing Copy to clipboard


End Sub

You might also like