Attachments

While assembling a model with different sub-assemblies, it is often necessary to connect or refer entities in one container to entities in another container. To retain modularity of the container entity so that they can be reused in a different context, it is recommended that you define connections to external entities by declaring them as attachments.

A physical analogy to attachments are ports (or plug-in points) on an electronic device. These ports are local or internal to the device and act as media to connect an external device.

Example

The image below shows a Cylinder 1 system in a four cylinder engine model. The Crankshaft and Engine Case bodies are external to the Cylinder 1 system. To define joints or forces between any of these bodies and bodies inside the Cylinder 1 system: attachments with variable names b_crankshaft and b_enginecase are declared as attachments to the system, and these two bodies are referred to as the variable entity.



Figure 1.

See the Adding Attachments topic to learn about managing attachments for a System/Assembly.

Note: The entity panel for the entity in the container shows a referred attachment entity with blue shading, as shown below:


Figure 2.

In the MDL, the attachment is defined by the *Attachment() statement in the container entity definition block.

Attachment Tag and Attachment Candidates

An attachment for a container entity can carry an attachment tag that can help resolve attachments automatically. The attachment tag works in conjunction with the attachment candidate tag that is defined on an entity in a different container. MotionView finds entities that have the same string in the attachment candidate as that of the attachment tag and lists them as Recommended Entities in the Model Tree while resolving the attachment.

Shown below is the Cylinder 1 assembly which seeks a crank pin attachment point. This attachment (variable p_cp_att) has a “CrankPin” attachment tag. The crank pin point in the crank shaft assembly has a attachment candidate tag that has the value “CrankPin”.

Upon clicking the Point collector for this attachment, the Model Tree that is automatically displayed in the Select a Point dialog will have a Recommended Entities folder which lists the crank pin point in the crankshaft assembly.



Figure 3.

In addition, the right-click context menu for any container in the Project Browser also has an Apply Attachment Candidates option.



Figure 4.

This option resolves all attachments for a container automatically, by finding entities with attachment candidates that have the same string as that of attachment tag on attachments. If there is more than one entity as candidate for an attachment, a dialog is displayed which allows you to resolve it manually.

Define Attachment Candidates

An entity is declared as an attachment candidate by using the Attachment Candidates button in the Entity panel.

  1. Select the entity to be declared as the attachment candidate.
  2. From the entity panel, click .
    The Attachment Candidates dialog is displayed.


    Figure 5.
  3. Click Add.
    A tag entry is included in the dialog.
  4. Click on the Tag field (indicated by <PleaseEnterTag>) and input a string.


    Figure 6.
  5. Select an option from the Location drop-down menu.
    For single entity types, single is the only option that is available. For pair entities, the tag can be applied for the pair, or left, or right.
  6. Click Closeto create the attachment candidate.
    Note: In MDL, the attachment candidate is created by *AttachmentCandidate statement. The tag value is set using the *SetAttachmentCandidateTag statement.