RobotStudio event

[RobotStudio SDK] Freehand mode programatically

HM
HM
edited May 2013 in Developer Tools
Hi,

I´m trying to write a function that simulate the Freehand controls of the interface. Here is a code snnipet that try to do this:

void Freehand(string objectName)
{
Station station = Project.ActiveProject as Station;

foreach (Window w in UIEnvironment.Windows)
{
if((w is DocumentWindow) && (w.Control is GraphicControl))
{
GraphicControl gc = w.Control as GraphicControl;
if(gc != null)
{
gc.Picker.FreehandMode = FreehandMode.Move;
gc.Picker.FreehandReference = FreehandReference.FreehandReference.Local;

GraphicComponent s = null;
if (station.GraphicComponents.TryGetGraphicComponent(objectName, out s))
{
ProjectSelection ps = station.Selection;
ps.Clear();
ps.Add(s);
}
}
}
}
}

But, despite it selects the correct object, the reference coordinate system to move it doesn´t appear.

Any idea will be welcome.
HM
Post edited by Niklas Skoglund on