(API) ROBOT / VBA: Activate or select load case

(API) ROBOT / VBA: Activate or select load case

daniel_dcn
Explorer Explorer
1,288 Views
2 Replies
Message 1 of 3

(API) ROBOT / VBA: Activate or select load case

daniel_dcn
Explorer
Explorer

I'm creating a tool that inserts the load train into the model. First it creates the load case, then adds a set of nodal loads around some given node.

 

How can I present the results by selecting the new load case in the list?

 

Load train created with VBA. Case #15 is not being selected automatically.Load train created with VBA. Case #15 is not being selected automatically.

 

Thank you

0 Likes
Accepted solutions (1)
1,289 Views
2 Replies
Replies (2)
Message 2 of 3

Stephane.kapetanovic
Mentor
Mentor
Accepted solution

hi @daniel_dcn 

Sub Select_Load_Case15()
  Dim RobApp As IRobotApplication
  Dim ViewMngr As IRobotViewMngr
  Dim ActiveView As RobotView
  Dim CaseSel As RobotSelection
  
  Set RobApp = New RobotApplication
  Set ViewMngr = RobApp.Project.ViewMngr

  For i = 1 To ViewMngr.ViewCount
    If ViewMngr.GetView(i).Window.IsActive = -1 Then ActiveViewNumber = i: Exit For
  Next i
  Set ActiveView = ViewMngr.GetView(ActiveViewNumber)
  
  Set CaseSel = ActiveView.Selection.Get(I_OT_CASE)
      CaseSel.FromText "15"
  ViewMngr.Refresh
  
  Set RobApp = Nothing
End Sub

Best regards

Stéphane Kapetanovic

Did you find this post helpful? If it gave you one or more solutions,
don't forget to click the Accept Solution button and leave a < like !
EESignature
Message 3 of 3

daniel_dcn
Explorer
Explorer

Thank you @Stephane.kapetanovic!

0 Likes