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.
See the Adding Attachments topic to learn about managing attachments for a System/Assembly.
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.
In addition, the right-click context menu for any container in the Model Browser also has an Apply Attachment Candidates option.
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.