Get path points

Eduard Bartrons

Get path points

Hi everyone,

I am trying to program a macro that extracts point coordinates of the trajectory followed by the tip of a robot mounted device. I know how to get Tag coordinates (from which trajectories are formed), but don't know how to get some coordinates of the path followed by the robot's end.

I would really appreciate if somebody could give me a hand,



Quanwen Du

RE: Get path points
(in response to Eduard Bartrons)

Hello Eduard,

The document V5Automation.chm includes some descriptions which will help you to understand.

Here is a sample I created which output the trajectory into a excel file:

Sub CATMain()

'get the Product doc
 Dim myProductDocument As ProductDocument
 set myProductDocument = CATIA.ActiveDocument

'select robot product 
 Dim mySelection As Selection
 set mySelection = myProductDocument.Selection
 Dim status As String
 Dim filter(0)
 filter(0) = "Product"

 status = mySelection.SelectElement2(filter, "Select the robot from the PPR tree to work on.", False)

 Dim robot as Product

 If status = "Cancel" Then
    MsgBox("Selection Canceled")
    Exit Sub
 End If

 set robot = mySelection.Item(1).value

 'retrieval of the trace manager
 Dim objDevice As TCPTraceManager
 set objDevice = robot.GetTechnologicalObject("TCPTraceManager")
 'activate the trace

 'Get the last path
 Dim NbPath As Long
 NbPath = objDevice.GetNbPath
 If NbPath>0 Then
      ' retrieval of the last trace
      Dim RobotTCPTrace As TCPTrace
      Set RobotTCPTrace = objDevice.GetPath(NbPath)
      'Export the trace points
   msgbox("No trajectory in current session!")
 End If

End Sub

Hope it help.