Class AttachmentCollection
A Collection of Attchment objects.
Inheritance
AttachmentCollection
Assembly: ABB.Robotics.RobotStudio.Stations.dll
Syntax
public class AttachmentCollection : ICollection, IEnumerable<Attachment>, IEnumerable
Examples
Get Attchment Collection.
Project.UndoContext.BeginUndoStep("Attachments Properties");
try
{
// Instance active station.
#region AttachmentsPropertiesStep1
Station stn = Station.ActiveStation;
#endregion
// Enumerates the attachments in the station and outputs their info using the logger.
Logger.AddMessage(new LogMessage("The station contains the following attachments:"));
#region AttachmentsPropertiesStep2
foreach (Attachment att in stn.Attachments)
#endregion
{
// Get the attachments transform values.
#region AttachmentsPropertiesStep3
string transStr = "";
transStr += "X: " + att.Offset.t.x;
transStr += " Y: " + att.Offset.t.y;
transStr += " Z: " + att.Offset.t.z;
transStr += " RX: " + att.Offset.EulerZYX.x;
transStr += " RY: " + att.Offset.EulerZYX.y;
transStr += " RZ: " + att.Offset.EulerZYX.z;
#endregion
// Output the AttachmentParent, the AttachmentChild and the transform.
#region AttachmentsPropertiesStep4
Logger.AddMessage(new LogMessage("Child: " + att.AttachmentChild.Name +
" is attached to Parent: " + att.AttachmentParent.Name +
" and has transform: '" + transStr + "'"));
#endregion
}
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
Properties
Count
Declaration
public virtual int Count { get; }
Property Value
IsSynchronized
Declaration
public virtual bool IsSynchronized { get; }
Property Value
Item[Int32]
Declaration
public Attachment this[int index] { get; }
Parameters
Type |
Name |
Description |
Int32 |
index |
|
Property Value
Parent
Declaration
public ProjectObject Parent { get; }
Property Value
SyncRoot
Declaration
public virtual object SyncRoot { get; }
Property Value
Methods
Add(Attachment)
Used when moving Attachments from one station to another.
If you want to add an attachment within a station use Attach method on the GraphicComponentGroup , Flange, Part or ToolDataInfo class instead.
Declaration
public void Add(Attachment attachment)
Parameters
Examples
Move Attachment.
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();
}
Contains(Attachment)
Declaration
public bool Contains(Attachment obj)
Parameters
Returns
CopyTo(Attachment[], Int32)
Declaration
public void CopyTo(Attachment[] array, int index)
Parameters
CopyTo(Array, Int32)
Declaration
public virtual void CopyTo(Array array, int index)
Parameters
GetEnumerator()
Declaration
public virtual IEnumerator GetEnumerator()
Returns
Remove(Attachment)
Used when moving Attachments from one station to another.
If you want to remove an attachment within a station use Detach method on the GraphicComponentGroup, Flange, Part or ToolDataInfo class instead.
Declaration
public void Remove(Attachment attachment)
Parameters
Examples
Move Attachment.
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();
}
ToArray()
Declaration
public Attachment[] ToArray()
Returns