Show / Hide Table of Contents

Move Attachments Example

This example shows how to move all the attachments from one station to another.

Example

Project.UndoContext.BeginUndoStep("MoveAttachments");
try
{
    // Instance active station.
    Station stn = Station.ActiveStation;

    // Create a new station.
    Station stn2 = new Station();

    // Move all the attachments from Station1 to Station2.
    foreach (Attachment att in stn.Attachments.ToArray())
    {
        stn.Attachments.Remove(att);
        stn2.Attachments.Add(att);
    }
}
catch
{
    Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
    throw;
}
finally
{
    Project.UndoContext.EndUndoStep();
}

See Also

  • Station
  • Attachment
  • RobotStudio Community
In this article
Back to top Copyright © 2025 ABB