Show / Hide Table of Contents

Creating New Station

This example provides information on creating a new station if no station exists.

Use this procedure to create a new station :

  1. Initialize the API.

    RobotStudioAPI.Initialize();
    
  2. Check if station exists.

  3. Create new station object.

  4. Set active task to default task.

  5. Set active project to station.

Note

Depending on the needs of the application/unit test certain subsystems ('services') must be initialized.

ApiServices.Geometry = new RobotStudio.Services.Geometry.GeometryService();

ApiServices.Graphics = new RobotStudio.Services.Graphics.GfxService(CreateDX);

ApiServices.Simulator = new RobotStudio.Services.Simulation.SimulatorService();

ApiServices.Controller = new RobotStudio.Services.Controller.ControllerService();

ApiServices.Modeling = new RobotStudio.Services.Modeling.ModelingService();

ApiServices.Conveyor = new RobotStudio.Services.Conveyors.ConveyorService();

ApiServices.RapidSync = new RobotStudio.Services.RapidSync.RapidSyncService();

Solution

  1. Check if station exists.

    // Set the active project as our station.
    Station station = Station.ActiveStation;
    
  2. Create new station object.

    // ...create a new one.
    station = new Station();
    
  3. Set active task to default task.

    station.ActiveTask = station.DefaultTask;
    
  4. Set active project to station.

    Project.ActiveProject = station;
    

Example

This example provides information on creating a new station object.

private Station NewStation()
{
    // Set the active project as our station.
    Station station = Station.ActiveStation;
    // If there is no active project...
    if (station == null)
    {
        // ...create a new one.
        station = new Station();
        station.ActiveTask = station.DefaultTask;
        Project.ActiveProject = station;
    }

    // Return a station for us to use.
    return station;
}

Required Namespaces

ABB.Robotics.RobotStudio.Environment

ABB.Robotics.RobotStudio.Stations

Project

ActiveProject

ActiveTask

DefaultTask

See Also

  • Setting/Resetting Virtual Signals
  • Detecting Collisions
In this article
Back to top Copyright © 2025 ABB