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
[Persistent("Attachment")]
public sealed class Attachment : ProjectObject
Properties
View SourceAttachmentChild
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 = $"X: {att.Offset.t.x} Y: {att.Offset.t.y} Z: {att.Offset.t.z} " +
$"RX: {att.Offset.EulerZYX.x} RY: {att.Offset.EulerZYX.y} 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();
}</code></pre>
View Source
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 = $"X: {att.Offset.t.x} Y: {att.Offset.t.y} Z: {att.Offset.t.z} " +
$"RX: {att.Offset.EulerZYX.x} RY: {att.Offset.EulerZYX.y} 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();
}</code></pre>
View Source
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
[Obsolete("Don't use")]
public Transform Transform { get; }
Property Value
| Type | Description |
|---|---|
| Transform |
Methods
View SourceAfterLoad(PimDocument)
Declaration
protected override void AfterLoad(PimDocument doc)
Parameters
| Type | Name | Description |
|---|---|---|
| PimDocument | doc |
Overrides
View SourceToString()
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |