- Analyze
- AnalyzeEx
- AnalyzeModel
- CloseSTAADFile
- CreateNamedView
- GetAnalysisStatus
- GetApplicationVersion
- GetBaseUnit
- GetCONNECTEDProjectInfo
- GetErrorMessage
- GetFullJobInfo
- GetInputUnitForForce
- GetInputUnitForLength
- GetMainWindowHandle
- GetProcessHandle
- GetProcessId
- GetShortJobInfo
- GetSTAADFile
- GetSTAADFileFolder
- IsAnalyzing
- IsPhysicalModel
- ModifyNamedView
- NewSTAADFile
- OpenSTAADFile
- Quit
- RemoveNamedView
- SaveModel
- SaveNamedView
- SetCONNECTEDProjectInfo
- SetFullJobInfo
- SetInputUnitForForce
- SetInputUnitForLength
- SetInputUnits
- SetShortJobInfo
- SetSilentMode
- UpdateStructure
Analyze #
This function analyzes the currently opened .STD file. This method is equivalent to running analysis from user interface.
VBA Syntax
Dim objOpenSTAAD As Object
'Get the application object
Set objOpenSTAAD = GetObject( , "StaadPro.OpenSTAAD")
'Run Analysis
objOpenSTAAD.Analyze
AnalyzeEx #
This extended method analyzes the currently opened .STD file. This method is equivalent to running analysis from user interface. However, it has additional three arguments to specify whether to run the analysis in silent or hidden mode. The third parameter specifies whether the method should wait for the analysis to finish or return immediately. This method may be used in conjunction with SetSilentMode(), if one wants to suppress all dialog boxes displayed from the application during running of analysis.
Parameters
[in] | varSilent | Integer value to enable silent mode. [1 = Enable, 0 otherwise]. Enabling silent mode will suppress all dialog boxes in the engine which requires user input. The analysis dialog box however will be displayed and close automatically on completion. |
[in] | varHidden | Integer value to enable hidden mode. [1 = Enable, 0 = Disable]. Enabling hidden mode will suppress the display of analysis dialog. The analysis dialog box will not be displayed. |
[in] | varWait | Integer value to specify whether to wait for the analysis process to finish or return immediately. [1 to wait , 0 otherwise] |
Return values
-1 | Analysis Terminated |
0 | General Error |
1 | Analysis is in progress |
2 | Analysis completed without errors or warnings |
3 | Analysis completed with warnings but without errors |
4 | Analysis completed with errors |
5 | Analysis has not been performed |
VBA Syntax
Sub Main
Dim objOpenStaad As Object
Dim stdFile As String
Dim RetVal as long
' Get the running instantce of STAAD.Pro
Set objOpenStaad = GetObject(,"StaadPro.OpenSTAAD")
' Check if file is opened or not
objOpenStaad.GetSTAADFile stdFile, "TRUE"
If stdFile="" Then
MsgBox"Bad"
Set objOpenStaad = Nothing
Exit Sub
End If
' Set silent mode for the main application
objOpenStaad.SetSilentMode 1
' run analysis in silent mode and wait for it to finish
RetVal = objOpenStaad.AnalyzeEx(1, 0, 1)
' Check if results are available or not
If objOpenStaad.Output.AreResultsAvailable <> 0 Then
MsgBox "Results Available"
End If
MsgBox"Macro Ending"
Set objOpenStaad = Nothing
End Sub
AnalyzeModel #
Analyze the model currently opened in staad.pro.
Parameters
- [in] varEngine: Put -1 for launching STAAD.Pro engine.
VBA Syntax
'Analyze the currently loaded model
objOpenStaad.AnalyzeModel (-1)
C# Syntax
//Analyze the currently loaded model
long RetVal = m_OStd.AnalyzeModel (-1);
CloseSTAADFile #
This function closes the currently open .STD file.
VBA Syntax
Dim objOpenSTAAD As Object
'Get the application object
Set objOpenSTAAD = GetObject( , "StaadPro.OpenSTAAD")
'Close current STAAD file
objOpenSTAAD.CloseSTAADFile
CreateNamedView #
This function creates a view with the specified name.
Parameters:
- [in] strName: A string variable that will hold the name of the view to be created.
- [in] nFlag: A long variable that holds the flag value based on which the view will be created.
- [in] nError: A long variable that will hold the error number if the view cannot be created.
VBA Syntax:
Dim objOpenSTAAD As Object
Dim strName As String
Dim nFlag As Long
Dim nError As Long
'Get the application object
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
'Create Named View
objOpenSTAAD.CreateNamedView strName, nFlag, nError
GetAnalysisStatus #
This function gets the analysis status for any STD model.
Parameters:
- [in] szModelNameWithPath: Name of the model for which analysis status is required.
- [out] NoOfWarnings: Number of warnings produced by the STAAD engine while analyzing.
- [out] NoOfErrors: Number of errors produced by the STAAD engine while analyzing.
- [out] CPUTime: Time required by the STAAD engine to analyze the model in seconds.
Return Values:
- -2: Invalid model path
- -1: Analysis terminated
- 0: General error
- 1: Analysis is in progress
- 2: Analysis completed without errors or warnings
- 3: Analysis completed with warnings but without errors
- 4: Analysis completed with errors
- 5: Analysis has not been performed
VBA Syntax:
Dim NoOfWarnings As Long
Dim NoOfErrors As Long
Dim CPUTime As Double
Dim RetVal As Long
Dim szModelNameWithPath As String
szModelNameWithPath = "C:\path\to\your\file.STD"
RetVal = objOpenStaad.GetAnalysisStatus(szModelNameWithPath, NoOfWarnings, NoOfErrors, CPUTime)
GetApplicationVersion #
Returns the application version number as text and in individual parts.
Parameters:
- [out] MajorA: An integer value representing the version number.
- [out] MajorB: An integer value representing the update number.
- [out] Minor: An integer value representing the revision number.
- [out] Build: An integer value representing the build number.
Return Value:
- The current application version as text.
VBA Syntax:
Dim objOpenSTAAD As Object
Dim major As Long
Dim update As Long
Dim revision As Long
Dim build As Long
Dim version As String
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
version = objOpenStaad.GetApplicationVersion(major, update, revision, build)
GetBaseUnit #
This function returns the base unit for the currently open .STD
file.
Return Values:
- 1: Value will return 1 for the English system of units (e.g., inches, kilopounds).
- 2: Value will return 2 for the Metric system of units (e.g., meters, kilonewtons).
VBA Syntax:
Dim objOpenSTAAD As Object
Dim nReturn As Long
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
nReturn = objOpenSTAAD.GetBaseUnit()
GetCONNECTEDProjectInfo #
This function retrieves the CONNECTED Project ID and name.
Parameters:
- [out] szProjID: ID of the CONNECTED Project.
- [out] szName: Name of the CONNECTED Project.
Return Values:
- 1: True
- 0: False
VBA Syntax:
Dim objOpenSTAAD As Object
Dim szProjID As String
Dim szName As String
Dim RetVal As Variant
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
RetVal = objOpenSTAAD.GetCONNECTEDProjectInfo(szProjID, szName)
GetErrorMessage #
This function returns error messages thrown by OpenSTAAD (e.g., for license unavailability or required named view).
Return Value:
- errmsg: Error message thrown by OpenSTAAD.
VBA Syntax:
Dim objOpenSTAAD As Object
Dim errmsg As String
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
errmsg = objOpenSTAAD.GetErrorMessage()
GetFullJobInfo #
This function retrieves the full job information of the currently open .STD
file.
Parameters:
- [in] jobName: Job Name for the current
.STD
file. - [in] jobClient: Job Client for the current
.STD
file. - [in] enggName: Engineer’s Name for the current
.STD
file. - [in] eDate: Engineer Date for the current
.STD
file. - [in] jobNumber: Job Number for the current
.STD
file. - [in] revision: Job Revision for the current
.STD
file. - [in] part: Job Part Name for the current
.STD
file. - [in] reference: Job Reference for the current
.STD
file. - [in] checkerName: Checker Name for the current
.STD
file. - [in] cDate: Checker Date for the current
.STD
file. - [in] approverName: Approver Name for the current
.STD
file. - [in] aDate: Approved Date for the current
.STD
file. - [in] comments: Job Comments for the current
.STD
file.
VBA Syntax:
Dim objOpenSTAAD As Object
Dim jobName As String
Dim jobClient As String
Dim enggName As String
Dim eDate As String
Dim jobNumber As String
Dim revision As String
Dim part As String
Dim reference As String
Dim checkerName As String
Dim chDate As String
Dim approverName As String
Dim aDate As String
Dim comments As String
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
objOpenSTAAD.GetFullJobInfo jobName, jobClient, enggName, eDate, jobNumber, revision, part, reference, checkerName, chDate, approverName, aDate, comments
GetInputUnitForForce #
This function retrieves the input unit of force of the currently open .STD
file.
Parameters:
- [in] strUnit: A string variable that holds the input unit for force (internally converted to an integer from 0 to 7).
Unit Values:
- 0: Kilopound
- 1: Pound
- 2: Kilogram
- 3: Metric Ton
- 4: Newton
- 5: Kilonewton
- 6: Meganewton
- 7: Decanewton
VBA Syntax:
Dim objOpenSTAAD As Object
Dim strUnit As String
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
objOpenSTAAD.GetInputUnitForForce strUnit
GetInputUnitForLength #
This function retrieves the input unit of length for the currently open .STD
file.
Parameters:
- [in] strUnit: A string variable that holds the input unit for length (internally converted to an integer from 0 to 7).
Unit Values:
- 0: Inch
- 1: Feet
- 2: Feet
- 3: Centimeter
- 4: Meter
- 5: Millimeter
- 6: Decimeter
- 7: Kilometer
VBA Syntax:
Dim objOpenSTAAD As Object
Dim strUnit As String
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
objOpenSTAAD.GetInputUnitForLength strUnit
GetMainWindowHandle #
This function retrieves the main STAAD.Pro window handle.
VBA Syntax:
Dim objOpenSTAAD As Object
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
'Get Main Window Handle
objOpenSTAAD.GetMainWindowHandle
GetProcessHandle #
This function retrieves the current STAAD.Pro process handle.
VBA Syntax:
Dim objOpenSTAAD As Object
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
'Get Process Handle
objOpenSTAAD.GetProcessHandle
GetProcessId #
This function retrieves the current STAAD.Pro process ID.
VBA Syntax:
Dim objOpenSTAAD As Object
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
'Get Process ID
objOpenSTAAD.GetProcessId
GetShortJobInfo #
This function retrieves the short job information of the currently open .STD
file.
Parameters:
- [in] jobName: A string variable that holds the Job Name for the current
.STD
file. - [in] jobClient: A string variable that holds the Job Client for the current
.STD
file. - [in] enggName: A string variable that holds the Engineer’s Name for the current
.STD
file.
VBA Syntax:
Dim objOpenSTAAD As Object
Dim jobName As String
Dim jobClient As String
Dim enggName As String
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
'Get Job Info
objOpenSTAAD.GetShortJobInfo jobName, jobClient, enggName
GetSTAADFile #
This function retrieves the name of the current .STD
file.
Parameters:
- [in] fileName: A string variable that will hold the name of the currently open
.STD
file (without the path name). - [in] bFullPath: A Boolean variable which, if true, writes the entire path name of the
.STD
file in the variablefileName
.
VBA Syntax:
Dim objOpenSTAAD As Object
Dim fileName As String
Dim bFullPath As Boolean
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
bFullPath = True
'Retrieve the entire path
objOpenSTAAD.GetSTAADFile fileName, bFullPath
GetSTAADFileFolder #
This function retrieves only the path of the current .STD
file, without the filename.
Parameters:
- [in] fileFolder: A string variable that holds the path name of the folder where the currently open
.STD
file resides.
VBA Syntax:
Dim objOpenSTAAD As Object
Dim fileFolder As String
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
'Get the file folder
objOpenSTAAD.GetSTAADFileFolder fileFolder
IsAnalyzing #
This function returns a value to specify whether the analysis is running or not.
Return Values:
- 1: If analysis is still running.
- 0: If analysis is not running.
VBA Syntax:
Dim objOpenSTAAD As Object
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
'Check if analysis is running
If objOpenSTAAD.IsAnalyzing <> 0 Then
MsgBox "Analysis is running"
End If
IsPhysicalModel #
This function checks if the loaded model is a physical model.
Return Values:
- 1: True (model is a physical model).
- 0: False (model is not a physical model).
VBA Syntax:
Dim objOpenSTAAD As Object
Dim retVal As Variant
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
'Check if the model is a physical model
retVal = objOpenSTAAD.IsPhysicalModel()
ModifyNamedView #
This function saves the current view with the specified name.
Parameters:
- [in] strName: A string variable that will hold the name of the view to be modified.
- [in] nEntities: A long variable that holds the number of entities.
- [in] EntityArray: A long variable that holds the entity number.
- [in] nArrayQualifier: An integer variable that holds the entity qualifier value (0 – Node, 1 – Beam, 2 – Plate, 3 – Solid, 4 – Surface).
- [in] nModifyFlag: A long variable that holds the flag value depending upon which the view will be modified.
- [in] nError: A long variable that holds the error number if the view cannot be modified.
VBA Syntax:
Dim objOpenSTAAD As Object
Dim strName As String
Dim nEntities As Integer
Dim EntityArray As Long
Dim nArrayQualifier As Long
Dim nModifyFlag As Long
Dim nError As Long
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
'Modify Named View
objOpenSTAAD.ModifyNamedView strName, nEntities, EntityArray, nArrayQualifier, nModifyFlag, nError
NewSTAADFile #
This function creates a .STD
file with specified length and force units.
Parameters:
- [in] bstrFileName: A string variable that holds the name of the
.STD
file to be created. - [in] nLenUnitInput: An integer variable representing the input unit for length (0 to 7).
- [in] nForceUnitInput: An integer variable representing the input unit for force (0 to 7).
Length Unit Values:
- 0: Inch
- 1: Feet
- 2: Feet
- 3: Centimeter
- 4: Meter
- 5: Millimeter
- 6: Decimeter
- 7: Kilometer
Force Unit Values:
- 0: Kilopound
- 1: Pound
- 2: Kilogram
- 3: Metric Ton
- 4: Newton
- 5: Kilonewton
- 6: Meganewton
- 7: Decanewton
VBA Syntax:
Dim objOpenSTAAD As Object
Dim bstrFileName As String
Dim nLenUnitInput As Integer
Dim nForceUnitInput As Integer
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
'Create New File
objOpenSTAAD.NewSTAADFile bstrFileName, nLenUnitInput, nForceUnitInput
OpenSTAADFile #
This function opens the specified .STD
file.
Parameters:
- [in] bstrFileName: A string variable that holds the name of the
.STD
file to be opened.
VBA Syntax:
Dim objOpenSTAAD As Object
Dim bstrFileName As String
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
'Open the file
objOpenSTAAD.OpenSTAADFile bstrFileName
Quit #
This function closes the STAAD.Pro application environment.
VBA Syntax:
Dim objOpenSTAAD As Object
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
'Quit Application environment
objOpenSTAAD.Quit
RemoveNamedView #
This function removes the current view with the specified name.
Parameters:
- [in] strName: A string variable that holds the name of the view to be removed.
- [in] nError: A long variable that holds the error number if the view cannot be removed.
VBA Syntax:
Dim objOpenSTAAD As Object
Dim strName As String
Dim nError As Long
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
'Remove Named View
objOpenSTAAD.RemoveNamedView strName, nError
SaveModel #
This function saves the current structure with optional silent mode.
Parameters:
- [in] varSilent: Integer value to enable silent mode (1 to enable, 0 to disable).
VBA Syntax:
Dim objOpenSTAAD As Object
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
'Save structure silently
objOpenSTAAD.SaveModel 1
SaveNamedView #
This function saves the current view with the specified name.
Parameters:
- [in] strName: A string variable that holds the name of the view to be saved.
- [in] nError: A long variable that holds the error number if the view cannot be saved.
VBA Syntax:
Dim objOpenSTAAD As Object
Dim strName As String
Dim nError As Long
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
'Save Named View
objOpenSTAAD.SaveNamedView strName, nError
SetCONNECTEDProjectInfo #
This function sets the CONNECTED Project ID and name.
Parameters:
- [in] szProjID: ID of the CONNECTED Project.
- [in] szName: Name of the CONNECTED Project.
Return Values:
- 1: True
- 0: False
VBA Syntax:
Dim objOpenSTAAD As Object
Dim szProjID As String
Dim szName As String
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
'Set Connected Project Info
objOpenSTAAD.SetCONNECTEDProjectInfo szProjID, szName
SetFullJobInfo #
This function sets the full job information of the currently open .STD
file.
Parameters:
- [in] jobName: Job Name for the current
.STD
file. - [in] jobClient: Job Client for the current
.STD
file. - [in] enggName: Engineer’s Name for the current
.STD
file. - [in] eDate: Engineer Date for the current
.STD
file. - [in] jobNumber: Job Number for the current
.STD
file. - [in] revision: Job Revision for the current
.STD
file. - [in] part: Job Part Name for the current
.STD
file. - [in] reference: Job Reference for the current
.STD
file. - [in] checkerName: Checker Name for the current
.STD
file. - [in] cDate: Checker Date for the current
.STD
file. - [in] approverName: Approver Name for the current
.STD
file. - [in] aDate: Approved Date for the current
.STD
file. - [in] comments: Job Comments for the current
.STD
file.
VBA Syntax:
Dim objOpenSTAAD As Object
Dim jobName As String
Dim jobClient As String
Dim enggName As String
Dim eDate As String
Dim jobNumber As String
Dim revision As String
Dim part As String
Dim reference As String
Dim checkerName As String
Dim chDate As String
Dim approverName As String
Dim aDate As String
Dim comments As String
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
'Set Job Info
objOpenSTAAD.SetFullJobInfo jobName, jobClient, enggName, eDate, jobNumber, revision, part, reference, checkerName, chDate, approverName, aDate, comments
SetInputUnitForForce #
This function sets the input unit of force for the currently open .STD
file.
Parameters:
- [in] iUnit: An integer variable representing the input unit for force (0 to 7).
VBA Syntax:
Dim objOpenSTAAD As Object
Dim iUnit As Integer
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
'Set Force Unit
objOpenSTAAD.SetInputUnitForForce iUnit
SetInputUnitForLength #
This function sets the input unit of length for the currently open .STD
file.
Parameters:
- [in] iUnit: An integer variable representing the input unit for length (0 to 7).
VBA Syntax:
Dim objOpenSTAAD As Object
Dim iUnit As Integer
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
'Set Length Unit
objOpenSTAAD.SetInputUnitForLength iUnit
SetInputUnits #
This function sets the input units for both length and force of the currently open .STD
file.
Parameters:
- [in] lUnit: An integer variable for length unit (0 to 7).
- [in] fUnit: An integer variable for force unit (0 to 7).
VBA Syntax:
Dim objOpenSTAAD As Object
Dim lUnit As Integer
Dim fUnit As Integer
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
'Set Input Units
objOpenSTAAD.SetInputUnits lUnit, fUnit
SetShortJobInfo #
This function sets the short job information of the currently open .STD
file.
Parameters:
- [in] jobName: Job Name for the current
.STD
file. - [in] jobClient: Job Client for the current
.STD
file. - [in] enggName: Engineer’s Name for the current
.STD
file.
VBA Syntax:
Dim objOpenSTAAD As Object
Dim jobName As String
Dim jobClient As String
Dim enggName As String
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
'Set Job Info
objOpenSTAAD.SetShortJobInfo jobName, jobClient, enggName
SetSilentMode #
This function sets the silent mode of the application. Calling this method with 1 will suppress the display of warning message boxes during analysis and saving the file.
Parameters:
- [in] varFlag: An integer value (1 to set silent mode on, 0 to set it off).
Return Values:
- The existing value of the silent mode.
VBA Syntax:
Dim objOpenSTAAD As Object
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
'Set silent mode ON
objOpenSTAAD.SetSilentMode 1
'Run analysis engine silently
objOpenSTAAD.AnalyzeEx 1, 0
UpdateStructure #
This function updates the current structure.
VBA Syntax:
Dim objOpenSTAAD As Object
Set objOpenSTAAD = GetObject("StaadPro.OpenSTAAD")
'Update structure
objOpenSTAAD.UpdateStructure