RobotStudio event

API: RsIrc5Controller

Options
Hi again!

Is there any possibility to create an RsIrc5Controller with the API?
I can access the active Irc5Controllers via station.Irc5Controllers, but I can't find any possibility to add a new Controller to a new station.
This is what I do to create a new station:
[code]
Station station = new Station();
Project.ActiveProject = station;

GraphicControl gc = new GraphicControl();
DocumentWindow dw = new DocumentWindow("dw", gc, "myView");
gc.RootObject = station;

GraphicComponentLibrary gcl = GraphicComponentLibrary.Load(@C:....,true);
station.GraphicComponents.Add(gcl.RootComponent.CopyInstance ());
dw.Visible = true;

UIEnviroment.Windows.Add(dw);
[/code]

This snippet creates a new station with a (geometry of a)  robot in it.
Now I need to know how to attach a new Controller to the station.
It would be very nice if someone could help me.

Best regards, Matthias

Comments

  • apox
    Options
    Perhaps you should have a look at "ABB.Internal.RobotStudio.API.ControllerHelper" :

                 RsIrc5Controller controller = ABB.Internal.RobotStudio.API.ControllerHelper.CreateIrc5Cont roller();
                 RsTask task = ABB.Internal.RobotStudio.API.ControllerHelper.CreateTask();

                 ABB.Internal.RobotStudio.API.ControllerHelper.AddIrc5Control lerToStation(station, controller);
                 ABB.Internal.RobotStudio.API.ControllerHelper.AddTaskToContr oller(controller, task);
                 ABB.Internal.RobotStudio.API.ControllerHelper.AddTaskToStati on(station, task);


  • It's called "Internal" for a reason. E.g. it's undocumented, and not guaranteed to work in future versions. Just so you know image


    Johannes Weiman2007-12-10 10:20:42
    Johannes Weiman
    Software Engineer
    ABB Robotics
  • Thanks for the hint apox.
    This is what I did:
    [code]
    Station station = new Station();
    Project.ActiveProject = station;

    GraphicControl gc = new GraphicControl();
    DocumentWindow dw = new DocumentWindow("dw", gc, "myView");
    gc.RootObject = station;

    GraphicComponentLibrary gcl = GraphicComponentLibrary.Load(@C:....,true);
    station.GraphicComponents.Add(gcl.RootComponent.CopyInstance ());
    dw.Visible = true;

    UIEnviroment.Windows.Add(dw);

    RsIrc5Controller ctrl = ABB.Internal.Robotstudio.API.ControllerHelper.CreateIrc5Cont roller();
    RsTask task = ABB.Internal.Robotstudio.API.ControllerHelper.CreateTask();
    ABB.Internal.Robotstudio.API.ControllerHelper.AddIrc5Control lerToStation(station, ctrl);

    ABB.Internal.Robotstudio.API.ControllerHelper.AddTaskToContr oller(ctrl, task);
    ABB.Internal.Robotstudio.API.ControllerHelper.AddTaskToStati on(station, task);

    station.ActiveTask = task;

    [/code]

    There are no errors so far, but the controller doesn't appear in the bottom right hand corner in RobotStudio.

    When I try to restart the Controller with ABB.Internal.Robotstudio.API.ControllerHelper.Restart(ctrl, ABB.Internal.Robotstudio.API.ControllerRestartMode.Cold);
    Robotstudio crashes.

    I can't figure out why this doesn't work.
    Any suggestions?

    Best Regards, Matthias