Documentation Center

  • Trial Software
  • Product Updates

SimMechanics Import XML File

The SimMechanics™ XML import file specifies the hierarchical structure of a CAD assembly and the physical parameters that describe each CAD part. SimMechanics imports the file to automatically generate an equivalent SimMechanics model with little or no additional work on your part.

Each block in a model that you import has a unique name and a complete set of parameters. The SimMechanics Import XML file provides the name and parameters of a block based on the original CAD assembly. Once you have imported a model, you can modify the name and parameters of a block to fit your needs. You can also add and remove blocks from the model, or replace one block with another.

    Note:   The following sections describe the structure and parameters of the SimMechanics Import XML file using a robot arm CAD assembly as an example. The actual structure and parameters of your SimMechanics Import XML file can differ from that shown here.

Organization of SimMechanics XML Import File

CAD assemblies are hierarchical systems: a CAD root assembly contains other CAD subassemblies, each made of CAD parts. The SimMechanics XML import file mirrors the hierarchical structure of a CAD assembly. The file organizes CAD assembly information in the order Root Assembly→Assemblies→Parts.

The following figure shows the SimMechanics XML import file for a CAD assembly with name robot. Content in sections RootAssembly, Assemblies, and Parts is removed for clarity.

Root Assembly

The section RootAssembly of the SimMechanics XML import file organizes information into two separate subsections:

  • InstanceTree

  • Constraints

InstanceTree

Each part contains one body-fixed reference frame that represents a unique set of position and orientation coordinates.InstanceTree defines a reference frame for each assembly found in the root assembly. One frame provides an ultimate reference frame with origin coordinates (0,0,0). Rigid transformations translate and rotate the previous frame in InstanceTree to obtain the reference frame for another CAD assembly.

Instance sections contain the rigid transformation that defines the reference frame for a CAD part. The following figure shows an instance section in the SimMechanics XML import file for a root assembly with name robot.

The InstanceTree section defines the hierarchical organization of the CAD assembly. The section organizes CAD assemblies and parts according to their place in the root assembly hierarchy. The following figure displays a SimMechanics XML import file for a CAD root assembly with name Robot. The root assembly contains five assemblies:

  • base-1

  • upperarm-1

  • forearm-1

  • wrist-1

  • grip-1

All assemblies contain a single part, except assembly Grip. The assembly Grip is a multibody system that connects multiple parts with joints. Grip contains seven distinct parts:

  • metacarples-1

  • firstfingerlink-1

  • firstfingerlinkL-1

  • secondfingerlink-1

  • secondfingerlink-2

  • fingertips-1

  • fingertips-2

Instance content is removed for clarity.

Constraints

CAD constraints define how two CAD parts can move relative to each other. One CAD constraint connects two CAD parts. Each CAD constraint specifies the mechanical degrees of freedom present between two CAD parts. Two CAD parts can translate along, and rotate about, up to three mutually orthogonal axes.

During CAD import, SimMechanics translates the CAD constraints into SimMechanics joints. Most CAD constraints have a SimMechanics equivalent, but the equivalence may not be a one-to-one-correspondence. A single SimMechanics joint may require a combination of multiple CAD constraints providing the same degrees of freedom.

    Note:   Not all CAD constraints have a SimMechanics equivalent. CAD gear constraints are one example. You cannot translate a CAD gear constraint into SimMechanics Second Generation models.

The Constraints section specifies the position, orientation, and type of joint that connects each pair of CAD assemblies. Two constraints specify one joint. The following figure shows the constraints section of the SimMechanics XML import file for a joint between two CAD parts with names upperarm-1 and forearm-1. In the figure, two constraints define a revolute joint that connects the two CAD parts: Concentric and Coincident. Each constraint specifies the position and orientation of the revolute joint relative to the reference frame for each CAD part.

Organization of Assemblies

The Assemblies section provides the same information present in RootAssembly, but with a local non-inertial reference frame acting as the ultimate reference frame. An InstanceTree section assigns a local reference frame to each part in an assembly. Each local reference frame appears in a separate Instance subsection. In the Instance subsection, a rigid transformation rotates and translates a parent frame to obtain the new local reference frame.

A Constraints section specifies the kinematic constraints between two parts. The set of constraints between two parts define the kinematic degrees of freedom between them, and are equivalent to SimMechanics joints. During CAD import, SimMechanics interprets each set of CAD constraints, and replaces them with the appropriate set of joints.

Organization of Parts

Part Names

Each part receives a unique name. By default, part names originate from the part file names. You can change a part name in SimMechanics, after CAD import, or in the SimMechanics XML import file, before CAD import. The following figure displays the part name section of the SimMechanics XML import file. Colored Boxes highlight part and source file identification information.

    Note:   SimMechanics represents a CAD part as a single rigid body subsystem. A rigid body subsystem inherits its name from the corresponding CAD part.

Physical Units

The SimMechanics XML input file defines the physical units used to resolve the values of inertial parameters. Units originate from the exported CAD assembly file. You can update the physical units in SimMechanics, after CAD import, or in the SimMechanics XML import file, before CAD import. The following figure highlights the physical units used to resolve the inertial properties of CAD part with name Wrist.

Solid Parameters

Solid parameters include inertia and graphic properties. Inertia governs the dynamic response of the solid to an applied force or torque. The SimMechanics XML import file specifies the following inertial parameters:

  • Mass

  • Center of mass

  • Moments and products of inertia

The following figure displays the solid parameters section of the SimMechanics XML import file for a CAD part with name Wrist. A box encloses the inertial properties of the CAD part.

Graphic properties govern the visual representation of the solid in Mechanics Explorer. Properties include color and shininess. The following table describes the graphic properties present in the SimMechanics XML import file.

Graphic PropertyTypeDescription
Ambient ColorRGBA vectorColor of light that hits the solid surface
Diffuse ColorRGBA vectorColor of the solid surface in pure white light
Specular ColorRGBA vectorColor of specular reflection from the solid surface
Emissive ColorRGBA vectorColor of solid self-illumination
ShininessScalarIntensity of specular highlights from the solid surface

The following figure highlights the graphic properties section of the SimMechanics XML import file.

Geometry File References

A set of STL files specifies the 3-D geometry of the solid surface for each CAD part. STL files specify only geometry, without reference to other graphic properties, like color. The SimMechanics XML import file specifies a single STL geometry file for each part in the CAD assembly. The following figure highlights the geometry file reference in the SimMechanics XML input file for a part with name Wrist.

See Also

Related Examples

More About

Was this topic helpful?