Robot API - set display flags of current view

Robot API - set display flags of current view

LionelDallenne
Contributor Contributor
663 Views
3 Replies
Message 1 of 4

Robot API - set display flags of current view

LionelDallenne
Contributor
Contributor

Hi,

 

is it possible to set the display flags "Section - shape" and "Sections - legend by colors" (see screenshots below) of the current view automatically to true using APIs? 

 

LionelDallenne_0-1627050848653.png

 

 

LionelDallenne_1-1627050938581.png

 

Many thanks,

 

 

 

0 Likes
Accepted solutions (1)
664 Views
3 Replies
Replies (3)
Message 2 of 4

LionelDallenne
Contributor
Contributor

And related to the same topic, would it be possible to, again through APIs, highlight both load values and symbols for  a selected load case (10 in this example)

 

LionelDallenne_0-1627054973388.png

 

Thanks again

0 Likes
Message 3 of 4

Stephane.kapetanovic
Mentor
Mentor
Accepted solution

hi @LionelDallenne 

Public ViewMngr As IRobotViewMngr

Sub Show_SectionsColor_LoadsCase10_on_ActiveView()
  Dim Robapp As IRobotApplication: Set Robapp = New RobotApplication
  If Robapp.Visible <> -1 Then ' Open Robot and a project
    Set Robapp = Nothing: Exit Sub
  End If
  
  Set ViewMngr = Robapp.Project.ViewMngr
  Dim ActiveView As RobotView: Set ActiveView = ViewMngr.GetView(ActiveViewNumber)

  'Possible to Limit/Add display attributes in the list below
  DisplayAttributes = Array(I_VDA_LOADS_VALUES, I_VDA_LOADS_SYMBOLS_CONCENTRATED, I_VDA_LOADS_SYMBOLS_LINEAR, _
                            I_VDA_SECTIONS_COLORS, I_VDA_SECTIONS_SHAPE)
  Dim ParamsDisplay As RobotViewDisplayParams: Set ParamsDisplay = ActiveView.ParamsDisplay
  For Each attr In DisplayAttributes: ParamsDisplay.Set attr, True: Next 
  ActiveView.Selection.Get(IRobotObjectType.I_OT_CASE).FromText "10"
  
  Set Robapp = Nothing
End Sub

Function ActiveViewNumber()
   For i = 1 To ViewMngr.ViewCount
     If ViewMngr.GetView(i).Window.IsActive <> 0 Then
       ActiveViewNumber = i: Exit Function
     End If
   Next i
   ActiveViewNumber = 1
End Function

Best regards

Stéphane Kapetanovic

Did you find this post helpful? If it gave you one or more solutions,
don't forget to accept the solution and leave a < like !
EESignature
Message 4 of 4

LionelDallenne
Contributor
Contributor

Thanks @Stephane.kapetanovic ,

 

I'll have a closer look at it in the next days. Thanks already.

0 Likes