I’m trying to use the API to produce images of swept volumes for each robot.
I’m having trouble associating robots with their swept volumes – I’ve tried looking for swept volumes referencing the related robot (i.e. the parent/container of the swept volume) and for a robot referenced by a swept volume (i.e. the child/decendant/attribute of the robot), but can’t find the relevant link.
The relation is between the swept volume and the robotic operation or robotic program, not directly to the robot.
Take the Robot from the swept volume
TxSweptVolume class has a property HoldingObject that will return you either a robotic program or robotic operation.
It will return you an object that implement ITxSweptVolumeHoldingObject interface.
You can check if it is a ITxRoboticProgram and then use the Robot property to get the robot.
Check if it is a compound robotic operation ITxRoboticOrderedCompoundOperation, and again use the Robot property to get the robot.
Swept volume from a robot.
From TxRobot you can take:
the SimulatingOperations properties, to get the operations for that robot, then the operation should implement the ITxSweptVolumeHoldingObject and you can get the swept volumes for that operation using the SweptVolumes property.
the RoboticPrograms property, to get its programs, TxRoboticProgram imnplements ITxSweptVolumeHoldingObject, use the SweptVolumes property to get the list of swept volumes.
Note: As the connection is between swept volume and robotic operation/program, if the robot of the operation was changed you may not get the correct mapping.
You can use different events to observe those changes – SweptVolumeAdded, SweptVolumeRemoved, SimulatingOperationRemoved, SimulatingOperationAdded and more.