Class Attachment
You can attach an object (child) to another object (parent). Attachments can be created on part level and on mechanism level. When an object has been attached to a parent, moving the parent also moves the child. One of the most common attachments is to attach a tool to a robot
Inherited Members
Namespace: ABB.Robotics.RobotStudio.Stations
Assembly: ABB.Robotics.RobotStudio.Stations.dll
Syntax
sistent("Attachment")]
public sealed class Attachment : ProjectObject
Properties
AttachmentChild
Gets the ProjectObject that is the child of this Attachment.
Declaration
public ProjectObject AttachmentChild { get; }
Property Value
Type | Description |
---|---|
ProjectObject |
Examples
Get AttachmentChild.
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();
}
AttachmentParent
Gets the ProjectObject that is the parent of this Attachment.
Declaration
public ProjectObject AttachmentParent { get; }
Property Value
Type | Description |
---|---|
ProjectObject |
Examples
Get AttachmentParent.
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();
}
Offset
Gets or sets the Offset of the Attachment, e.g the relative transform from parent to child.
Declaration
public Matrix4 Offset { get; set; }
Property Value
Type | Description |
---|---|
Matrix4 |
Transform
Declaration
olete("Don't use")]
public Transform Transform { get; }
Property Value
Type | Description |
---|---|
Transform |
Methods
AfterLoad(PimDocument)
Declaration
protected override void AfterLoad(PimDocument doc)
Parameters
Type | Name | Description |
---|---|---|
RobotStudio.API.Persistence.PimDocument | doc |
Overrides
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |