Skip to Main Content
Need Support? Let’s guide you to the right answer or agent.
Status Already exists
Workspace STAAD.Pro
Created by Guest
Created on Jan 18, 2024

Distinct OpenSTAAD objects for each instance of Staad

At present only one OpenSTAAD object can be retrieved which acts globally for the Staad application which limits the efficient use of Staad. With the ever increasing system resources, having distinct OpenSTAAD objects for each instance of Staad will help in interacting programmatically with multiple models simultaneously.

  • Admin
    Carlos Aguera
    Reply
    |
    Feb 5, 2024

    Thank you for posting this idea. However, it is possible to access the data from multiple instances of STAAD.Pro. The only thing you need to do is change the way the set command is defined to also include the full name and path of the relevant STAAD.Pro model. For example if you had three models open from the samples folder and wanted to report the number of nodes in each you could use the following:-

    Option Explicit

    Sub Main
    Dim objOpenStaad1 As Object
    Dim objOpenStaad2 As Object
    Dim objOpenStaad3 As Object
    Dim stdFile1 As String
    Dim stdFile2 As String
    Dim stdFile3 As String

    Set objOpenStaad1 = GetObject ("C:\Users\Public\Documents\STAAD.Pro 2023\Samples\Sample Models\UK\UK-1 Plane Frame with Steel Design.STD")
    Set objOpenStaad2 = GetObject("C:\Users\Public\Documents\STAAD.Pro 2023\Samples\Sample Models\UK\UK-2 Area Load Generation on Floor Structure.STD")
    Set objOpenStaad3 = GetObject("C:\Users\Public\Documents\STAAD.Pro 2023\Samples\Sample Models\UK\UK-3 Soil Springs for Portal Frame.STD")


    'Set objOpenStaad = GetObject(,"StaadPro.OpenSTAAD")
    objOpenStaad1.GetSTAADFile stdFile1, "TRUE"
    objOpenStaad2.GetSTAADFile stdFile2, "TRUE"
    objOpenStaad3.GetSTAADFile stdFile3, "TRUE"

    MsgBox "Nodes in model 1" & Str(Val(objOpenStaad1.Geometry.GetNodeCount()))
    MsgBox "Nodes in model 2" & Str(Val(objOpenStaad2.Geometry.GetNodeCount()))
    MsgBox "Nodes in model 3" & Str(Val(objOpenStaad3.Geometry.GetNodeCount()))


    MsgBox"Macro Ending"

    Set objOpenStaad1 = Nothing
    Set objOpenStaad2 = Nothing
    Set objOpenStaad3 = Nothing
    End Sub

    1 reply