|On this page…|
SimMechanics™ software features an importer that lets you automatically generate SimMechanics models from an XML file in Physical Modeling format. This externally defined XML file specifies mechanical information — bodies, degrees of freedom, and geometry — in a form that the SimMechanics importer can use to construct a model representing that system.
The standard way to obtain such a Physical Modeling XML is to generate it by exporting a computer-aided aided (CAD) assembly. CAD tools allow you to model mechanical systems geometrically as collections of parts, or assemblies. You use Simulink® and SimMechanics block diagrams to represent control systems composed of mechanical devices and simulate their dynamics. The block diagram approach does not include full geometric information, nor do CAD assemblies typically incorporate controllers or allow you to perform dynamic simulations. With CAD translation, you can combine the power of CAD and SimMechanics software.
The SimMechanics Link utility is the necessary intermediary that lets you convert CAD assemblies into SimMechanics models. The intermediate step between CAD assembly and SimMechanics model is exporting an XML file in Physical Modeling format from the assembly. The export also automatically creates STL files containing body geometry information that you need for visualizing the bodies in the model.
The SimMechanics importer then converts this XML file into a mechanical model, which references the STL files to visualize the bodies.
Complete Translation of CAD Assembly Into a Visualizable Model
The full CAD translation is composed of two distinct steps, with different requirements.
The first step is the export of the CAD assembly, which creates the Physical Modeling XML file and one or more STL file(s).
The second step is the import of the Physical Modeling XML file and generation of the SimMechanics model.
To export a CAD assembly into XML, you must first
Install your CAD platform or software application.
Install the SimMechanics Link utility and link it to your CAD platform. The SimMechanics Link utility requires MATLAB® only.
Setting Up SimMechanics Link Software. To install and register SimMechanics Link, see Install and Register SimMechanics Link Software
To import a Physical Modeling XML file and generate a model, you must have installed Simulink and the Simscape™ and SimMechanics products.
Converting a CAD assembly to a SimMechanics model requires two major steps, exporting the CAD assembly into XML, then importing the XML to create a SimMechanics model.
You export the assembly from the CAD platform into a Physical Modeling XML file that you can later use with the SimMechanics importer. See the SimMechanics Link documentation.
Exporting a CAD Assembly into a Physical Modeling XML File
When you export the CAD assembly into Physical Modeling XML, the SimMechanics Link exporter also automatically creates an STL body geometry file for each body represented as a CAD assembly part. You then need these STL files for SimMechanics visualization, once you create your SimMechanics model.
To complete the CAD translation, you convert the Physical Modeling XML file into a SimMechanics model. See Generating New Models from Physical Modeling XML in this chapter.
Importing a Physical Modeling XML File into a Model
Once you have imported the Physical Modeling XML to create a SimMechanics model, you can visualize the bodies in the model. The generated SimMechanics model automatically references the necessary STL body geometry files, one for each body, to visualize the bodies with their original CAD assembly shapes.