Robot Structural Analysis Forum
Welcome to Autodesk’s Robot Structural Analysis Forums. Share your knowledge, ask questions, and explore popular Robot Structural Analysis topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

(API) New Window

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
chjpcoi
413 Views, 3 Replies

(API) New Window

Hello everyone

I create a new view and want to select some elements from the original view to the new view. But I have the problem that other unselected elements of the parent view are also selected (screenshot Pic1), code below:

RobotStructure struc = rbApp.Project.Structure;
RobotSelection rselection = struc.Selections.Get(IRobotObjectType.I_OT_OBJECT);

rselection.FromText(dicStories[item]);
IRobotView3 viewRobot = (IRobotView3)rbApp.Project.ViewMngr.CreateView(IRobotViewType.I_VT_STANDARD);
viewRobot.Selection.Set(IRobotObjectType.I_OT_OBJECT, rselection);
viewRobot.Visible = 1;
viewRobot.Redraw(0);
viewRobot.Projection = IRobotViewProjection.I_VP_XY;

Can you help me? 

Thanks for your help.

Pic 1Pic 1

3 REPLIES 3
Message 2 of 4
chjpcoi
in reply to: chjpcoi

Hi @Rafal.Gaweda 

Can you help me? please!

Message 3 of 4

hi @chjpcoi 

Public ViewMngr As IRobotViewMngr

Sub create_view_from_selection()
    Dim Robapp As IRobotApplication
    Set Robapp = New RobotApplication
    
    Set ViewMngr = Robapp.Project.ViewMngr
    
    Dim ActiveView As RobotView
    Set ActiveView = ViewMngr.GetView(ActiveViewNumber)
    
    Dim CurrentType As IRobotViewType
    CurrentType = ActiveView.Type
    
    Dim View As IRobotView3
    Set View = ViewMngr.CreateView(CurrentType)
        View.Projection = ActiveView.Projection
        ' Possible to Add more parameters as view setting or display
    
    Dim RSel As RobotSelection
    Dim TypeSel As IRobotObjectType
    Tb_Type = Array(IRobotObjectType.I_OT_NODE, _
                    IRobotObjectType.I_OT_BAR, _
                    IRobotObjectType.I_OT_GEOMETRY, _
                    IRobotObjectType.I_OT_OBJECT, _
                    IRobotObjectType.I_OT_PANEL, _
                    IRobotObjectType.I_OT_FINITE_ELEMENT)
    ' Possible to limit or Add more selection type
    
    For i = LBound(Tb_Type) To UBound(Tb_Type)
      TypeSel = Tb_Type(i)
      Set RSel = Robapp.Project.Structure.Selections.Get(TypeSel)
      View.Selection.Set TypeSel, RSel
    Next i
    
    View.Visible = True
    View.Redraw (0)
    Robapp.Project.ViewMngr.Refresh
    View.Window.Activate

    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
End Function

See also

https://forums.autodesk.com/t5/robot-structural-analysis-forum/view-with-isolated-elements-via-ros-a...

 

 

Message 4 of 4

Hi @Stephane.kapetanovic 

Thank for your help. 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report