RobotStudio event

Viewing Targets to visible Paths only?

Options

Hello,

Is it possible to view targets to visible paths only.  I am working with six robots on one part and when I select to view targets I get all targets for the entire station visible.  Is there a way of changing that?

Thank you,

Bob

Comments

  • John Wiberg
    Options

    Unfortunately, no. If you change the visibility of the 'Targets' node all targets will remain invisible.

    But again here is two usuful macros:

    This will turn all targets in the station invisible:

    Sub AllTargetsInvisible()
        Dim tgtT As Target
        For Each tgtT In ActiveStation.Targets
            tgtT.Visible = False
        Next
        ActiveStation.Refresh
    End Sub

    And this one will let you select a path for which we will make all of it's targets visible:

    Sub TargetsInPathVisible()
        'Get user input
        Dim strPath As String
        strPath = InputBox("Write in the name of a Path:", "Make all targets in selected path visible", "Path")
        'See if the user selected path exists
        Dim pthP As Path
        Dim pthSelected As Path
        Dim blFound As Boolean
        blFound = False
        For Each pthP In ActiveStation.Paths
            If pthP.Name = strPath Then
                Set pthSelected = ActiveStation.Paths(strPath)
                blFound = True
            End If
        Next
        If blFound = True Then
            'Searches through the path for targets
            Dim tgtT As Target
            Dim piX As PathInstruction
            Dim trfTarget As TargetRef
            For Each piX In pthSelected.PathInstructions
                If TypeOf piX Is TargetRef Then
                    Set trfTarget = piX
                    trfTarget.Target.Visible = True
                        If trfTarget.MotionType = rsMotionTypeCircular Then
                            trfTarget.ViaTarget.Visible = True
                        End If
                End If
            Next
        Else
            'If the path wasn't in the station
            MsgBox "The path: " & strPath & " was not found in the station.", vbCritical, "Try again"
        End If
        ActiveStation.Refresh
    End Sub

    By combining these two I hope that you'll be fine.

    image