| Contents | Index |
| On this page… |
|---|
About Generated SimMechanics Models Based on CAD |
Note For complete information on exporting Physical Modeling XML, see the SimMechanics Link User's Guide. |
A computer-aided design (CAD) assembly can contain enough part and constraint information that you can generate a SimMechanics model consisting of Body and Joint blocks representing the assembly. Once you have exported a CAD assembly into a Physical Modeling XML file, you can generate a SimMechanics block diagram model from this file. A new generated model consists of a single SimMechanics machine, corresponding to an assembly with a single root.
This section shows you how to import the XML file into a SimMechanics model using the command mech_import, which constructs the model.
This section assumes that you have the SimMechanics product installed locally or remotely, and that you have:
The XML file representing a CAD assembly
Optionally, STL body geometry files associated with the CAD parts
To generate the SimMechanics model, you do not need the CAD platform or assembly from which the XML file was exported. You also do not need the SimMechanics Link utility.
You generate the CAD-based SimMechanics model using the mech_import command or dialog.
To start the model generation from a hypothetical XML file called cad_assembly.xml, enter
mech_import('cad_assembly.xml')at the command line. A progress bar appears and is updated as the model is imported.

A Simulink model window opens. The model is populated by Bodies and Joints corresponding to the assembly parts and constraints saved in cad_assembly.xml. The name of the generated model is the name of the original assembly file, regardless of the name chosen for the XML file.
You can also select a Physical Modeling XML file and generate a model from it through the Import Physical Modeling XML dialog. Open it by entering mech_import at the command line with no arguments. See the mech_import command reference for complete information about the import dialog. After completing your settings, click OK to start the import.

You have several options for changing the default import behavior of mech_import and the Import Physical Modeling XML dialog box. For more information, see Nondefault Features in Generated Models in the following section, Working with Generated Models.
You can specify the name of the generated model in the mech_import command or the import dialog. The default is to accept the assembly name specified in the XML file.
For example, an XML file called cad_assembly.xml could internally specify the assembly name as CAD_Assembly. Generating a model from this XML file leads to a model name of CAD_Assembly. But suppose you want to name it assembly1 instead. Either:
Enter at the command line
mech_import('cad_assembly.xml','ModelToImportInto','assembly1')This starts the import of cad_assembly.xml and creates a model file called assembly1.mdl from it.
In the dialog's Import tab, select the Specify model to import into check box. In the Model name field, enter assembly1 and click OK.
The Advanced Options dialog tab displays model layout and block appearance controls in the Layout area. With these, you can make your generated model easier to view and understand. You can:
Control how the importer names Joint blocks.
Control the amount of space the importer creates between blocks.
Control the direction in which the importer automatically adds blocks to the model.

You can alternatively use the equivalent options in the mech_import function.
By default, the importer generates the model starting at the top level of model hierarchy. It creates subsystems below that level if needed to translate subassemblies.
You can instead import the entire XML file into a subsystem, so that the top level of model hierarchy is consists of just this subsystem. Subassemblies are then translated into sub-subsystems below that level. If you import into a subsystem, you must specify names for both the model and subsystem.
For example, you can import cad_assembly.xml into a subsystem called assembly, residing in a new model called model_assembly. Either
Enter at the command line
mech_import('cad_assembly.xml', ...
'ModelToImportInto','model_assembly', ...
'SubsystemToImportInto','assembly')This starts the import of cad_assembly.xml into the subsystem.
In the dialog's Import tab,
Select the Specify model to import into check box. In the Model name field, enter model_assembly.
Select the Specify subsystem to import into check box. In the Subsystem name field, enter assembly and click OK.
The Advanced Options dialog tab displays model simplification controls in the Model simplification area. With these, you can isolate moving bodies and their DoFs from the rest of the model. You can:
Group Bodies rigidly connected by Welds into their own subsystems, each at the appropriate subsystem level.
Import non-Weld Joints at the highest level possible, depending on whether you are importing a model or a subsystem, as well as group rigidly welded Bodies into their own subsystems. The importer promotes moving Joints in the model hierarchy regardless of where the corresponding degrees of freedom occur in the original assembly.

You can alternatively use the equivalent options in the mech_import function.
![]() | Introducing Mechanical Import | Working with Generated Models | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |