# API: RsIrc5Controller

**URL:** <https://tech-community.robotics.abb.com/t/api-rsirc5controller/1568>\
**Category:** RobotStudio\
**Created:** [December 5, 2007, 1:19am UTC](https://tech-community.robotics.abb.com/t/api-rsirc5controller/1568 "2007-12-05T01:19:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/system/32/6_2.png) [@system](https://tech-community.robotics.abb.com/u/system)\
**Post date:** [December 5, 2007, 1:19am UTC](https://tech-community.robotics.abb.com/t/api-rsirc5controller/1568/1 "2007-12-05T01:19:05Z")

</div>

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:

```auto
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);
```

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

---

<div class="post-metadata">

**Author:** ![apox](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/apox/32/2392_2.png) [@apox](https://tech-community.robotics.abb.com/u/apox)\
**Post date:** [December 7, 2007, 11:35am UTC](https://tech-community.robotics.abb.com/t/api-rsirc5controller/1568/2 "2007-12-07T11:35:44Z")

</div>

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);

---

<div class="post-metadata">

**Author:** ![Johannes\_Weiman\_old\_account](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/johannes_weiman_old_account/32/3345_2.png) [@Johannes\_Weiman\_old\_account](https://tech-community.robotics.abb.com/u/Johannes_Weiman_old_account)\
**Post date:** [December 10, 2007, 10:20am UTC](https://tech-community.robotics.abb.com/t/api-rsirc5controller/1568/3 "2007-12-10T10:20:25Z")

</div>

It’s called “Internal” for a reason. E.g. it’s undocumented, and not guaranteed to work in future versions. Just so you know 😉

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/system/32/6_2.png) [@system](https://tech-community.robotics.abb.com/u/system)\
**Post date:** [December 11, 2007, 11:23pm UTC](https://tech-community.robotics.abb.com/t/api-rsirc5controller/1568/4 "2007-12-11T23:23:05Z")

</div>

Thanks for the hint apox.  
This is what I did:

```auto
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;

```

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
