RobotStudio event

VC# sample code request

Hi,

From Visual C#, not VSTA, how can I get to the selection modes in order to set a particular level when a certain event happens. i.e. Clicking in a text window will set the selection level to 'part' or 'surface', etc.

Thanks

Comments

  • PerSvensson
    PerSvensson ✭✭✭

    Hi
    You could do something like this

    public static void SetSelectionMode(SelectionModes mode)

    {

    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.SelectionMode = mode;

    }

    }

    }


     

    and then just call it with the selectionmode you want for example

    SetSelectionMode(SelectionModes.Curve);

    You need to add some namespaces as well at least

    using ABB.Robotics.RobotStudio.Stations.Forms;
    using ABB.Robotics.RobotStudio.Environment;

    Per Svensson
    Robotics and Vision Specialist
    Consat Engineering
  • THanks