
This document explains the basic procedure for exporting computer-aided design (CAD) assemblies from the SolidWorks CAD platform into a form you can use with SimMechanics and Simulink�.
Computer-aided design is an integral part of engineering design in many industries. CAD tools allow engineers to model their products in 3-D space. Although this approach is excellent for geometric modeling, incorporating controllers into this environment is difficult. Simulink with SimMechanics uses a block-diagram schematic approach for modeling control systems around mechanical devices. The SolidWorks-to-SimMechanics translator bridges the gap between geometric modeling and block diagram modeling and combines the power of Simulink and SimMechanics with CAD.
For details about installing the SolidWorks-to-SimMechanics translator, see the README file that accompanies it at http://www.mathworks.com/products/simmechanics.
After you have installed the translator add-in, it is automatically linked to SolidWorks. You can also manually link and unlink it.
To link the translator add-in, go to the Tools menu in SolidWorks, select Add-Ins, then the check box for SimMechanics.
When you click OK, SimMechanics appears in the SolidWorks menu bar.
In SolidWorks, an unconstrained part has six degrees of freedom (DoFs). You reduce these DoFs by inserting mates (constraints) between bodies.
In SimMechanics, a body has no DoFs until you connect joints to it. Each joint is a combination of these joint primitives:
The translator maps the SolidWorks mates (constraints) between parts to SimMechanics joint primitives between bodies. In general, the mapping of mates to joints is not one-to-one. When you generate a SimMechanics model from a CAD assembly, the primitives are combined into the appropriate Joints.
The SolidWorks mates supported for this translator are:
| Angle | Parallel |
| Coincident | Perpendicular |
| Concentric | Tangent |
| Distance |
The SolidWorks mate entities supported for this translator are:
| Entity | Description |
| Circle/Arc | Circular edge/arc sketch segment |
| Cone | Conical face |
| Cylinder | Cylindrical face |
| Line | Linear edge/sketch segment/reference axis |
| Plane | Reference plane or planar face |
| Point | Vertex/sketch point/reference point |
The SimMechanics primitives and primitive combinations supported for this translator are:
| Primitive Combination | Description |
| P | Prismatic |
| PP | Planar: P and P are perpendicular |
| PPP | |
| PPPR | |
| S | |
| R-S | Revolute-spherical massless connector |
| R | |
| PR | Cylindrical: P and R are parallel |
| PPR | In-plane: R is perpendicular to PP |
| PPPS | Six-DoF |
| R-R | Revolute-revolute massless connector |
| S-S | Spherical-spherical massless connector |
The SolidWorks-to-SimMechanics translator uses certain settings that can be accessed from the SimMechanics menu in your SolidWorks menu bar, by selecting Settings. Save and close the SimMechanics dialog by clicking the green check mark at the top. Close the SimMechanics dialog without saving your settings by clicking the red X.
The SimMechanics dialog contains three active areas:
In SolidWorks, assemblies can have subassemblies, and these in turn can have sub-subassemblies, and so on. When you select a subassembly in the SolidWorks feature tree,
Right-click the subassembly and select the Component menu, then Properties. An option appears that allows you to make the component Flexible or Rigid.
Select Rigid (the default) if you are not interested in the kinematics of the parts within the subassembly. The subassembly is treated as a single rigid part and is constrained to move as a single body.
Select Flexible if you are interested in the kinematics of the parts within the subassembly. Its children (parts and mates within the subassembly) are treated as dynamically active and can move relative to one another according to their mates.
If you select Component properties (the default) in the SimMechanics dialog, then the translator respects the internal SolidWorks settings, that is, Rigid or Flexible, accordingly as each subassembly is configured.
If you choose Flexible settings in the
SimMechanics dialog, however, then the
translator assumes that all subassemblies are flexible regardless of the
SolidWorks setting. Selecting this option does not change the CAD subassembly
settings in the CAD assembly file.
The Relative roundoff tolerance specifies the smallest significant relative numerical difference.
To export a valid assembly, be sure all the assembly's parts are fully resolved first, with all model data loaded into memory. No part should be lightweight. Refer to the SolidWorks documentation for additional details.
After you enter the settings you want, save them by clicking the green check mark at the top of the SimMechanics window. Then go to the File menu, select Save As, then SimMechanics (*.xml), and click OK. If no CAD translation errors occur, a dialog appears to indicate that the translation is complete and the name and location of the XML file.
The exported XML file can be given to another user able to import it into SimMechanics. Its default name is <filename>.xml, where <filename> is the name of the original CAD assembly.
If CAD translation errors do occur, an error dialog appears listing the CAD mates that could not be properly translated into joints. The errors are also written to a separate error log file. The XML file is still exported, and models that you generate from this file are valid. But these models do not represent the CAD assembly you started with. The error dialog also indicates the name and location of the exported XML file and the error log file.
See these sections for supported mates and joints and for model generation instructions.
In MATLAB, enter the following at the command line to create a SimMechanics model from the exported Physical Modeling XML file. The .xml extension is optional.
>> import_physmod('<filename>.xml')
See the SimMechanics CAD Translator Guide (PDF) for more information about generating SimMechanics models from Physical Modeling XML files.
There are specific requirements and best practices that you should follow to create an optimal and functioning SimMechanics model from your CAD assembly. Consult the SimMechanics CAD Translator Guide (PDF) that accompanies the CAD-to-SimMechanics translator.
CAD assembly example files are located, relative to your SolidWorks installation, in examples/.
� 2003-2006 The MathWorks, Inc. - Patents - Trademarks