Products & Services Solutions Academia Support User Community Company

Learn more about SimMechanics Link   

Translating Machines from External to Physical Modeling Representations with the API

About Mapping API Objects from CAD Format to Physical Modeling XML

A complete CAD assembly contains information both relevant and not relevant for exporting a Physical Modeling XML file to represent your assembly.

Data Required from a CAD Assembly to Create a SimMechanics Model

You obtain the selected assembly data through the CAD platform application programming interface (API) in the form of an object or a data structure. The data required from an assembly to construct a SimMechanics model include:

Mapping of Selected Mechanical Data to SimMechanics Model Components

Data Selected from CAD Assembly or Other External Machine Definition Mapped to......Required SimMechanics Model Component
Assembly and parts originGround and World coordinate system
Assembly and subassembly hierarchyModel and subsystem hierarchy
Part masses and inertia tensors, colors, and body geometry file namesBodies, including their mass properties, geometries, and colors
Constraint restrictions on relative positions and motions of partsJoints between pairs of Bodies
Body coordinate systems connected to Joints

Using the Exporter Functions to Complete the Mapping of CAD Assembly to Physical Modeling XML

Refer to the table, Mapping of Selected Mechanical Data to SimMechanics Model Components preceding. Using your CAD exporter module, you transform the selected data listed in the first column of the table into the form required in the second column with the SimMechanics Link API functions and data types. You collect the selected data into an intermediate SimMechanics Link API object. With the SimMechanics Link API, you then write the intermediate API representation to a Physical Modeling XML file.

See Designing Custom Exporter Modules following for detailed information on these API functions and data types.

Body Geometry Files Exported Directly from CAD API

For each moving Body in the model, the final SimMechanics model requires a separate body geometry file in STL format. You export these body geometry files directly from the CAD API, with file names matching the body geometry file names specified in the exported XML file. You specify these file names in the SimMechanics Link API object.

Selecting CAD Assembly Data for Export

Tracing the Assembly Hierarchy: Nodes and Components

The assembly data that you need to retrieve through the CAD API starts with the assembly-subassembly hierarchy, with nodes. Each node in the hierarchical tree is an assembly component (a part or a subassembly).

For an individual component, the next component immediately up in the hierarchy is its parent. All dependent components connected below in the hierarchy are its children. The top parent in the assembly hierarchy is the whole assembly itself.

Identifying and Extracting Component Information

For each component, determine:

Constructing Intermediate API Representations

Before you can export the CAD assembly, you must construct a selective intermediate CAD representation, a collection of objects that capture the required CAD data.

Objects Required for Intermediate Representations

Putting Objects Together into Intermediate Representations

To construct a full CAD representation:

  1. Represent the entire assembly with a CAD model object.

  2. Represent child parts and subassemblies with additional CAD model objects.

    If a subassembly is flexible (its parts can move with respect to each other), the subassembly is a parent to child parts, represented by their own CAD model objects.

  3. Add child CAD model reference objects to their parent CAD model objects, including parent-to-child transforms.

    You might need to repeat steps 1 through 3 recursively until you have mapped the entire CAD assembly hierarchy.

  4. Represent constraints between components with constraint objects. These are also children to parent assembly and subassembly objects.

  5. Form a single translator object from all these objects, referenced by one another in a hierarchy that parallels the original assembly hierarchy.

CAD Assembly and Intermediate API Representation: Parallel Hierarchies

Converting Selective API Representations into Physical Modeling XML

The final translator object is the last intermediate form of the CAD assembly translation. From this translator object, you create the Physical Modeling XML file representing the assembly.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2010- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS