Академический Документы
Профессиональный Документы
Культура Документы
1 of 2
http://communities.bentley.com/communities/other_communities/openstaad...
OpenSTAAD
This is where you can find and contribute to discussions, ideas, and other
information about OpenSTAAD.
So you know about OpenSTAAD, that great, but how to get started with your first macro? Here is
some simple guidance on getting the basic framework in place so that you can make use of the
functions/subroutines in the OpenSTAAD objects:1)
2)
3)
4)
5)
7)
The base OpenSTAAD object includes methods for accessing Geometry, Window, Output etc subrou&nes/func&ons.
Which can be accessed thus:oSTD.Geometry.GetNodeCount()
However, whilst the property Geometry is displayed when the period bu:on is clicked aAer oSTD, the list of func&ons in
Geometry is not listed aAer clicking the period bu:on aAer selec&ng Geometry.
8) The alterna&ve to see all the subrou&nes/func&ons in all these property groups, create separate objects
using the base OpenSTAAD object e.g.:'Geometry;
Dim ostdGeometry As OpenSTAADUI.OSGeometryUI
Set ostdGeometry = oSTD.Geometry
9) Good prac&ce is to clean up the open objects before leaving e.g. :Set oSTD = Nothing
Set ostdGeometry =Nothing
10) Therefore the basic star&ng point for a macro would be (copy-paste this as your star&ng point):-
7/31/2011 11:25 PM
2 of 2
http://communities.bentley.com/communities/other_communities/openstaad...
Sub Main()
'Create an instance of OpenSTAAD le
Dim oSTD As OpenSTAAD
Set oSTD = GetObject(,"StaadPro.OpenSTAAD")
Create objects to access func&ons in Geometry, Window, etc
'Geometry;
Dim ostdGeometry As OpenSTAADUI.OSGeometryUI
Set ostdGeometry = oSTD.Geometry
'Window;
Dim ostdWindow As OpenSTAADUI.StaadProWindow
Set ostdWindow = oSTD.Window
'View;
Dim ostdView As OpenSTAADUI.OSViewUI
Set ostdView = oSTD.View
'Output;
Dim ostdOut As OpenSTAADUI.OSOutputUI
Set ostdOut = oSTD.Output
'Property;
Dim ostdProperty As OpenSTAADUI.OSPropertyUI
Set ostdProperty = oSTD.Property
'Load;
Dim ostdLoad As OpenSTAADUI.OSLoadUI
Set ostdLoad = oSTD.Load
'Table;
Dim oStdTable As OpenSTAADUI.OSTableUI
Set oStdTable = oSTD.Table
'Support;
Dim oStdSupport As OpenSTAADUI.OSSupportUI
Set oStdSupport = oSTD.Support
'Command;
Dim oStdCommand As OpenSTAADUI.OSCommandsUI
Set oStdCommand = oSTD.Command
'Design;
Dim oStdDesign As OpenSTAADUI.OSDesignUI
Set oStdDesign = oSTD.Design
Write your macro here
.. and clear up before closing and leaving the macro
Set oSTD = Nothing
Set ostdGeometry = Nothing
Set ostdWindow = Nothing
Set ostdView = Nothing
Set ostdOut = Nothing
Set ostdProperty = Nothing
Set ostdLoad = Nothing
Set oStdTable = Nothing
Set oStdSupport = Nothing
Set oStdCommand = Nothing
Set oStdDesign = Nothing
End Sub
Good luck
Carlos
7/31/2011 11:25 PM