vcSelectionManager doesn't update Robot

Hy,

I’ve written a pythonscript where I select a Lin- or PTP-Motionstatement over the vcSelectionManger.setSelection(statement). → Works well, the selection is done! :slight_smile:

The problem is that the robot doesn’t update it’s position like I would select the statement in the UI.

Please could anyone tell me how to update the robot so it behaves like an UI-selection of an statement?

Thx & Regards
Feature

from vcScript import *
from vcHelpers.Robot2 import *

app = getApplication()
sm = app.SelectionManager
comp = getComponent() 
robot = getRobot(comp)
 
statement = robot.Executor.Program.MainRoutine.Statements[0]
sm.setSelection(statement)
motionTarget = robot.Controller.createTarget()
motionTarget.Target = statement.Positions[0].PositionInReference       
robot.Controller.moveImmediate(motionTarget)

I think you also need to handle vcMotionTarget’s base, tool, … etc.

Hy,

thx for your answer. :slight_smile:

Unfortunately I think you are rigth, in this form the robot do some other things… :wink:

My target is that the robot behaves with the code like I select an statement in the userinterface (programTab…).

Regards
Feature

If you want to do UI things then just use the .NET API instead.

Hy,

jes normally I would, but in this case it would bei great If someone would know the netCommand for pythonApi which updates everything that the magic happens… :smiley:

Thx & Regards
Feature

Hy,

now I testet the same thin over .NET API (ISelectionManager.SetSelection(statement, false)) and get the same result… → The robot don’t update its position like an userAction/userSelection does! :frowning:

What is the thing I have to do?

Thx & Regards
Feature