Main Content

Import a CAD Assembly Model

Before You Begin

You import a CAD model intoSimscape™ Multibody™software using thesmimportfunction. 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 yourSimscape Multibodyinstallation. 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:

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

    C:\Programs\MATLAB\
  • modelFolderis the name of the folder that contains the example file sets—four_bar,robot, orstewart_platform.

Import a Model

You import a model intoSimscape Multibodysoftware using thesmimportfunction in its default mode. Consider the example file sets in yourSimscape Multibodyinstallation. To recreate the CAD assembly model described by the files asSimscape Multibodyblock diagrams, enter:

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

函数生成一个新的Simscape Multibodyblock diagram and a supporting data file. The block diagram recreates the original CAD assembly model usingSimscape Multibodyblocks. 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 Multibodysoftware replaces unsupported CAD constraints with rigid connections that may appear as direct frame connection lines,Rigid Transformblocks, orWeld Jointblocks.

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 theSimscape Multibodylibrary.

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.