Looking for help to define the tool of a robot by using "addStatement" in Python script

Hello,
i need to define the tool of a robot, when a position will be added into path, like:

cmd = getCommand()
app = cmd.Application
robot = app.findComponent(“robot”)

robotExecutor = robot.findBehaviour(“Executor”)
robotProgram = robotExecutor.Program
mainRoutine = robotProgram.MainRoutine
mainRoutine.clear()

position_matrix = R_aim.PositionMatrix position_matrix.translateRel(r_x,r_y,r_z)
position_matrix.rotateRelX(r_a)
position_matrix.rotateRelY(r_b)
position_matrix.rotateRelZ(r_c)
statement = mainRoutine.addStatement(VC_STATEMENT_LINMOTION)

but i don’t know how to code to set the tool.

Please excuse my bad English.

vcMotionStatement has Tool property that you can set.
Example:
statement.Tool = robotExecutor.Controller.Tools[0]

1 Like

Thank you so much for your help, big problem for me solved!

1 Like