|On this page…|
During CAD export, SimMechanics™ Link generates an XML file that maps CAD entities onto equivalent SimMechanics entities. The following table indicates the correspondence between the two types of entities.
|CAD Entity||SimMechanics First Generation Equivalent|
|Reference coordinate system||Unconnected coordinate system ports|
|Assembly Reference||Fundamental Root: Root Ground — Weld – Root Part|
|Subassembly Reference||Root Part|
|Fixed Part||Root Body – Weld – Body|
Every CAD assembly has a single assembly origin and one or more assembly references that do not move with respect to the origin. The positions and orientations of all parts refer directly or indirectly to this origin.
A root body is a zero-mass, zero-inertia body used in the generated SimMechanics model to represent one or more assembly references. A root body is always welded to ground, so that its zero mass and zero inertia do not affect the model's dynamics. A root body is necessary to represent a fixed anchor for part constraints in the original assembly. This body can carry multiple coordinate systems for this purpose, while the single Ground block in the generated model can carry only one.
CAD translation maps the CAD assembly origin to the World coordinate system origin.
You can isolate a collection of CAD components (parts and their constraints) into a subassembly. CAD translation converts subassemblies into SimMechanics subsystems.
The main assembly is like the trunk of a tree, and its subassemblies are like the branches of the tree. Subassemblies can have subassemblies, and so on. This tree is the assembly's hierarchy. Each CAD subassembly has its own subassembly origin and references. A fixed part of a CAD subassembly is a part that is welded to a subassembly reference. It cannot move relative to the subassembly origin.
For an example of subassembly hierarchy, see Export CAD Robot Arm.
The CAD assembly's parts need to have masses and inertia tensors. When you generate the SimMechanics model, this mass property information is used to specify the properties of the SimMechanics Body block corresponding to each assembly part.
The constraints in your CAD assembly restrict how the assembly's parts can move with respect to each other. Without any constraints, a pair of CAD parts can move with six unrestricted degrees of freedom (DoFs) relative to one another. Constraints between pairs of parts reduce the six to fewer DoFs. SimMechanics joints express DoFs between bodies because SimMechanics bodies by themselves carry no DoFs. CAD constraints and SimMechanics joints are complements of one another.
Each joint is connected to two bodies, each at a body coordinate system (CS). The constraint geometry determines the joints into which CAD export translates the constraints and controls the position and orientation of the body CSs. Each of these body CSs has an origin and axis triad fixed relative to its body. CAD translation creates body CSs on the bodies, as necessary, for connecting joints.
Your CAD assembly can contain reference coordinate systems inserted on parts or elsewhere in the assembly. In general, these coordinate systems are not associated with constraints.
Export of such reference coordinate systems is optional. If these coordinate systems are translated into a SimMechanics model, they appear as coordinate systems on Body blocks, but not associated with Joint connections. When the model is initially imported, the reference coordinate systems are unconnected.
You need to specify enough information in your CAD assembly for the SimMechanics importer to construct a valid model from the XML file.
When you export from your CAD platform, you must export a complete assembly into XML, not just a part. If you have only one part, you must embed it in an assembly.
Use subassemblies to organize your assembly hierarchically. This simplifies your subsequent SimMechanics model by grouping blocks into corresponding subsystems. Follow these guidelines to ensure that your CAD assembly translates into a functioning SimMechanics model:
You must have at least one fixed part inside each subassembly. For more about fixed parts, see Subassemblies and Hierarchies.
Put as many welded components as you can inside rigid subassemblies or combine welded components into a single equivalent part.
If your assembly has a group of parts that do not move relative to one another, model them as a single part, eliminating unnecessary Body and Joint blocks from the generated SimMechanics model.
Your CAD platform might compute masses and inertia values from the mass density and geometry of the assembly parts. Otherwise, you must specify the mass and inertia tensor with respect to the part's center of gravity. The SimMechanics Link utility computes the center of gravity of each part automatically.
See Export a CAD Rigid Body for an example.
Depending on your CAD platform and SimMechanics Link interface, you might be able to insert reference coordinate systems on assembly parts or elsewhere in your assembly. If you choose to export these coordinate systems, translation creates corresponding unattached Body coordinate systems in the generated SimMechanics model. You control the selective export of these reference coordinate systems by giving names with a distinctive prefix to these coordinate systems.
You can use reference coordinate systems in several ways.
Prepare a CAD assembly for manual addition or replacement of Joints after import. These manually added Joints are independent of Joints automatically generated from assembly constraints.
Some CAD constraints are not supported for export. When you translate an assembly into a model, constraints that fail to translate into moving Joint blocks appear as rigid Welds. To represent your assembly correctly requires manual replacement of these Welds with moving Joints.
Prepare a CAD assembly for manual addition of Constraints, Drivers, Actuators, and Sensors after import. To attach these blocks to Bodies, you need additional Body coordinate systems, apart from the Body coordinate systems automatically generated to connect Joints representing assembly constraints.
You might find it easier to prepare for manually adding Joints, Constraints, Drivers, Actuators, and Sensors by setting up reference coordinate systems before export and attaching these Body coordinate systems to manually added blocks after import.
You must specify the constraint geometry in the CAD assembly consistently and in enough detail to reconstruct the assembly's DoFs as joints. The relationship between constraints in CAD and SimMechanics joints is not, in general, a simple mapping. Some SimMechanics joints have only one DoF, while others represent more than one DoF. CAD translation often combines multiple DoFs into one joint. Constraint specification details depend on the specific CAD platform.
For an example of configuring constraints, see Export CAD Robot Arm.
Keep constraints simple and few enough to avoid creating unnecessary joints in your SimMechanics model.
For example, consider three parts, P1, P2, and P3, in an assembly. Suppose P1 and P2 are constrained so that there is no movement possible between them. When you attach P3, you could put one constraint between P3 and P1 and the other between P3 and P2. This leads to a redundant joint in the SimMechanics model, making it harder to understand and troubleshoot than if you created only one constraint. In this example, it is better to create a constraint just between P3 and P2, since P2 cannot move with respect to P1 anyway.