Products & Services Solutions Academia Support User Community Company

Learn more about SimMechanics Link   

Designing Custom Exporter Modules

Requirements for Custom Exporter Modules

A custom exporter module works with intermediate representations of CAD assembly data. For an overview of the types of CAD assembly and SimMechanics Link data and their relationship, see Translating Machines from External to Physical Modeling Representations with the API preceding.

A custom exporter module:

Custom Exporter Module Communicates with APIs (Detail)

Using the SimMechanics Link API Functions

The SimMechanics Link API is a library of API functions that you call to construct a unified, selective representation of an assembly and write it as an XML file. Programming Custom Exporter Modules with the SimMechanics Link API following describes how to create, compile, and execute custom exporter modules in C/C++ with the SimMechanics Link API function library.

Implementing Translation with CAD and SimMechanics Link APIs

Extracting Selective CAD Assembly Data

To extract the selected assembly data required for export, consult your CAD platform API documentation and determine which functions of the CAD platform API you need to accomplish this.

Constructing the Intermediate API Representation

To construct the intermediate representation of an assembly, use the following functions from the SimMechanics Link API, in the order shown. The API also contains other functions you might need in special cases. For more information, consult the SimMechanics Link Reference.

StepTo...Use SimMechanics Link API Function......and SimMechanics Link API Objects
1.Set length and mass units for CAD assembly. The defaults are meters (m) and kilograms (kg), respectively.pmit_set_units
2.a. Create CAD model object to contain data for CAD assemblypmit_create_cadmodelPmitCadModelH
b. Create API representation translator objectpmit_create_cad2smPmitCad2SMH
3.Set translational, rotational, and numerical tolerances for CAD assemblypmit_set_tolerancesPmitCad2SMH
4.a. Create object to contain data for CAD subassemblies and partspmit_create_cadmodelPmitCadModelH
b. Create reference to CAD model objectpmit_create_cadmodelrefPmitCadModelH, PmitCadModelRefH
c. Add reference within existing CAD model object to child model object by adding transformpmit_add_refincadmodelPmitCadModelH, PmitCadModelRefH
5.a. Create object to contain data for CAD assembly component (part or rigid subassembly)pmit_create_assemcompPmitAssemCompH
b. Add reference within existing CAD model object to child assembly component objectpmit_add_refincompPmitAssemCompH, PmitCadModelRefH
6.a. Create object to contain data for constraint between CAD components (parts or rigid subassemblies)pmit_create_constrainPmitAssemCompH, PmitConstrainH,
PmitConstrainType, PmitGeomType
b. Add constraint object to CAD model objectpmit_add_constrainPmitCadModelH, PmitConstrainH

Exporting the Intermediate API Representation into Physical Modeling XML

To export the selective representation of your assembly into a Physical Modeling XML file, use the following functions from the SimMechanics Link API, in the order shown.

StepTo...Use SimMechanics Link API Function......and SimMechanics Link API Objects
1.Enable translation of CAD assembly data into SimMechanics modelpmit_create_cad2smPmitCad2SMH
2.Write Physical Modeling XML file from selective CAD representation of assemblypmit_write_xmlPmitCad2SMH

  


Related Products & Applications

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

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