Get handles for robot positions in Python

To get a handle and manipulate robot positions, get a handle for a vcPositionFrame object.

You can do this by:

  1. Get a handle for the vcMotionStatement or vcPositionStatement for the robot position. In most cases, you will need to access vcExecutor.Program.MainRoutine or get a handle for another routine in program, and then use the Scope of routine to get handle for statement.
  2. Any statement with positions would inherit vcPositionStatement, so use its Positions property to get a list of positions, which are vcPositionFrame objects.

Hi zesty
I am trying to get handles, can you tell what am I doing wrong ?

To put you in context, I am importing cad i visual component for machining, so the python code generate automatically. I do modification in it (python API, I believe)

When I print mtx.P.X and mtx.P.Y, I get the right values, but the Robot does not move there.


Here is simple example of using just targets. Of course, if you are using motion statement there is example in Python API for vcPythonProcess handler about that. In my example, I am using Comment statement and a Python Process Handler with Robot Executor to execute that statement.

If you need to add approach and retract movements before PTP, for example, this is one way to do that. If you want to auto-generate positions based on geometry then I would use different approach than Python Process Handler, e.g. generate the positions before statement execution.

Hi zest
first thanks for your return, well appreciated !

I try your simple example and it works in python process handle like you said it helps on retract and approach.

In my case as I am imported a cad so it auto-generate positions using the geometry.
I want to modify some of these positions using python. But don’t know where to get access to the code generating these positions and how to change it.


There are several approaches. One approach is to store the positional data in a schema property list, which is a layout item. The frames and such can be attached to a node, e.g. the workpiece. Python Process Handler has access to layout items via getApplication(), etc.

Here is a quick example just using corners via triangle sets from imported CAD file.

vcTriangleSet does have way to detect points using cuboid method call, but in your case consider using vcTriangleSet.Topology property to then use vcTopology object to get things done and dusted if it is an option available.

1 Like

Great !! thanks

I am trying this snippet step by step, when it’s done I will show you the result

Until there, here is my email :, I want to exchange on something.

Best regards !!!