Main Content

Import a CAD Assembly Model

Before You Begin

You import a CAD model into Simscape™ Multibody™ software using the smimport function. The function parses an XML multibody description file and automatically generates the corresponding model. Geometry files accompanying the multibody description file format provide the body geometries for visualization purposes. You can import models of assemblies but not parts.

Example Files

You can try the CAD import workflow using the examples in your Simscape Multibody installation. The examples include a four-bar linkage, a robotic arm, and a Stewart platform. Each example comprises an XML multibody description file and a set of part geometry files. The files are in folders with path

matlabroot\toolbox\physmod\sm\smdemos\import\modelFolder,
where:

  • matlabroot is the root folder of your MATLAB® application, for example:

    C:\Programs\MATLAB\
  • modelFolder is the name of the folder that contains the example file sets—four_bar, robot, or stewart_platform.

Import a Model

You import a model into Simscape Multibody software using the smimport function in its default mode. Consider the example file sets in your Simscape Multibody installation. To recreate the CAD assembly model described by the files as Simscape Multibody block diagrams, enter:

smimport(multibodyDescriptionFile);
where multibodyDescriptionFile is the XML multibody description file name for the example model you want to import, specified as a string. Use sm_robot for the robotic arm model and stewart_platform for the Stewart platform model. For example, to import the robotic arm model, enter:
smimport('sm_robot');

The function generates a new Simscape Multibody block diagram and a supporting data file. The block diagram recreates the original CAD assembly model using Simscape Multibody blocks. The data file provides the numerical values of the block parameters used in the model.

After Model Import

Check the imported model for unexpected rigid connections between bodies. Simscape Multibody software replaces unsupported CAD constraints with rigid connections that may appear as direct frame connection lines, Rigid Transform blocks, or Weld Joint blocks.

A warning message in the MATLAB command window identifies the bodies and connection frames affected by the unsupported constraints. Replace the artificial rigid connections between the bodies with suitable Joint, Constraint, or Gear blocks from the Simscape Multibody library.

Update the block diagram to rule out model assembly errors. Run simulation to ensure the model dynamics are as expected. If you update the source CAD assembly model, you can generate an updated data file directly from a new multibody description file.