Hello Rafal,
Thanks for your reaction. Unfortunately I could not get around to the debugging until now, but it does not seem to work. The program selects the bars and nodes, but the window does not show anything.
I found the following in the locals window. The property Me.Robapp.Visible = -1, could that have something to do with it?
I have the following code:
Sub showSelectedLineInRobot()
Dim CurrentRow As Long
CurrentRow = Selection.row
Set RobApp = New RobotApplication
Dim RSelection As RobotSelection
Dim RSelection2 As RobotSelection
'sets the connection node number
Set RSelection = RobApp.Project.Structure.Selections.Create(I_OT_NODE)
Dim NodeCol As RobotNodeCollection
Dim n1 As RobotNode
If (Cells(CurrentRow, 2) <> "") Then
RSelection.FromText Cells(CurrentRow, 2)
Set NodeCol = RobApp.Project.Structure.Nodes.GetMany(RSelection)
Else
MsgBox ("No nodes in selection cell B" & Str(CurrentRow))
Set NodeCol = Nothing
Exit Sub
End If
If (NodeCol.Count <> 1) Then
MsgBox ("No Valid Node number in cell B" & Str(CurrentRow) & ", please enter a single existing node number.")
Exit Sub
Set NodeCol = Nothing
Else
Set n1 = NodeCol.Get(1)
End If
'set Brace member number
Set RSelection = RobApp.Project.Structure.Selections.Create(I_OT_BAR)
Dim BarCol As RobotBarCollection
Dim Cbar As RobotBar
If (Cells(CurrentRow, 3) <> "") Then
RSelection.FromText Cells(CurrentRow, 3)
Set BarCol = RobApp.Project.Structure.Bars.GetMany(RSelection)
Else
MsgBox ("No bars in selection cell C" & Str(CurrentRow))
Set BarCol = Nothing
Exit Sub
End If
If (BarCol.Count <> 1) Then
MsgBox ("No Valid Bar number in cell C" & Str(CurrentRow) & ", please enter a single existing bar number.")
Set BarCol = Nothing
Exit Sub
Else
Set Cbar = BarCol.Get(1)
End If
'set Chord member number(s) May be 1 or 2 members
Dim BarCol2 As RobotBarCollection
Set RSelection2 = RobApp.Project.Structure.Selections.Create(I_OT_BAR)
If (Cells(CurrentRow, 4) <> "") Then
RSelection2.FromText Cells(CurrentRow, 4)
Set BarCol2 = RobApp.Project.Structure.Bars.GetMany(RSelection2)
Else
MsgBox ("No bars in selection cell D" + Str(CurrentRow))
Set BarCol2 = Nothing
Exit Sub
End If
If (BarCol2.Count <> 1 And BarCol2.Count <> 2) Then
MsgBox ("No Valid Bar number in cell D" & Str(CurrentRow) & ", please enter 1 or 2 existing bar numbers.")
Set BarCol = Nothing
Exit Sub
Else
RSelection2.Add RSelection
End If
Dim Rv As RobotView
Set Rv = RobApp.Project.ViewMngr.GetView(1)
Dim RVP As RobotViewDisplayParams
Set RVP = Rv.ParamsDisplay
RVP.Set I_VDA_STRUCTURE_ONLY_FOR_SELECTED_OBJECTS, True
RVP.Set I_VDA_STRUCTURE_NODE_NUMBERS, True
RVP.Set I_VDA_STRUCTURE_BAR_NUMBERS, True
RobApp.Project.ViewMngr.Refresh
End Sub
Thanks in advance for any help,
Best Regards,
Rick Boender