Search Results for

    Show / Hide Table of Contents

    Deleting RsProcessDefinition

    This example provides information on deleting an RsProcessDefinition from RobotStudio. An active station is needed for this example.

    Pass a process definition name as a parameter. To check the result of the Add-In, ensure that the process defintion has been deleted from RobotStudio template manager.

    Solution

    1. Get the active station.

      // Get active station             
      Station station = Station.ActiveStation;
      
    2. Try to get the RsProcessDefinition from the RsProcessDefinitionCollection of the active task based on the definition name.

      // Try to get the process definition from the active task  
      if (station.ActiveTask.ProcessDefinitions.TryGetProcessDefinition(processDefinitionName, out RsProcessDefinition definition))
      
    3. Remove the RsProcessDefinition object from the RsProcessDefinitionCollection of the active task.

      // Remove the process definition if found
      station.ActiveTask.ProcessDefinitions.Remove(definition);
      

    Example

    This example provides information on deleting an RsProcessDefinition from RobotStudio.

    private static void DeleteProcessDefinition(string processDefinitionName)
    {
        Project.UndoContext.BeginUndoStep("DeleteProcessDefinition");
        try
        {
            // Get active station             
            Station station = Station.ActiveStation;
    
            // Try to get the process definition from the active task  
            if (station.ActiveTask.ProcessDefinitions.TryGetProcessDefinition(processDefinitionName, out RsProcessDefinition definition))
            {
                // Remove the process definition if found
                station.ActiveTask.ProcessDefinitions.Remove(definition);
            }
        }
        catch
        {
            Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
            throw;
        }
        finally
        {
            Project.UndoContext.EndUndoStep();
        }
    }
    

    Required Namespaces

    ABB.Robotics.RobotStudio

    ABB.Robotics.RobotStudio.Stations

    See Also

    • Importing ProcessDefinition
    • Getting Process and Instruction Templates
    In this article
    Back to top Copyright © 2026 ABB Robotics