Export Robot Assembly from SolidWorks Software

In this example, you export a SolidWorks™ CAD assembly that represents a robot arm. The export procedure generates one XML file and a set of STL files that you can import into SimMechanics™ to generate a new second-generation model.

The example begins with a procedure to export the CAD assembly. Information on the robot CAD files and CAD Export follows the export procedure. To import the robot assembly into a SimMechanics Second Generation model, see Import Robot Arm Model.

The following figure shows the robot CAD assembly you export in this example.

Example Requirements

To successfully complete this example, you must meet the following requirements:

  • Have the latest version of SimMechanics Link installed on your machine.

  • Have completed the linking procedure for your SolidWorks installation. The linking procedure adds a SimMechanics Link add-in to the SolidWorks installation.

  • Have access to the robot example files that accompany the SimMechanics Link installation. See Export Robot Assembly from SolidWorks Software.

Open Robot Assembly

Before you can export the robot assembly, you must load the assembly into SolidWorks.

  1. Open SolidWorks on your machine.

  2. Select File > Open

  3. Navigate to the file directory that contains the robot CAD files.

      Note:   The directory that contains the robot CAD files for the SolidWorks platform is

      <MATLAB Root>\toolbox\physmod\smlink\smlinkdemos\...

  4. Select file robot.SLDASM.

  5. Click Open.

The CAD platform opens the robot assembly.

Export CAD Assembly

Once you successfully open the robot CAD assembly in your SolidWorks installation, you can export the assembly in second-generation format:

  1. On the SolidWorks tool bar, select SimMechanics Link > Export and click SimMechanics Second Generation....

  2. In the File name: field of the Save As dialog box, enter sm_robot and select a directory to export the files.

  3. Click Save.

      Note:   Large CAD assemblies require more time to complete the export process. Allow up to a few minutes for the export process to complete.

Verify CAD Export Files

Confirm the following files exist in the specified export directory:

  • XML file — provides structure of model and parameters of parts.

  • STL files — provides surface geometry of parts.

About the Example CAD Files

The CAD assembly files are present in your SimMechanics Link installation. You can access the files in the following directory:

<MATLAB Root>\matlab\toolbox\physmod\smlink\smlinkdemos\...
Substitute <MATLAB Root> with the root directory of your MATLAB® installation.

    Note:   If you are not sure what your MATLAB root directory is, at the MATLAB command line enter matlabroot. MATLAB returns the root directory for your installation.

The \robot directory contains a set of CAD files that define each CAD part and CAD assembly. Part file names contain the file extension .SLDPRT. Assembly file names contain the extension .SLDASM. A drawing file with extension .SLDDRW contains robot arm dimensions.

The robot assembly contains nine parts and two assemblies: robot.SLDASM and grip.SLDASM. File robot.SLDASM models the robot root assembly. File grip.SLDASM models the robot grip subassembly.

The following table lists all files the example requires.

File NameType

About CAD Export

The CAD export procedure generates one SimMechanics Import XML file and a set of STL files. The XML file contains the structure of the assembly and the parameters that define each part. The STL files define the 3-D geometry of each part. Once the export procedure is complete, you can import the SimMechanics Import XML file into SimMechanics. SimMechanics uses the file to automatically generate a new SimMechanics Second Generation model.

Export in First- and Second-Generation Formats

You can export a CAD assembly in first- or second-generation formats. Export in first-generation format generates a Physical Modeling XML file. Export in second-generation format generates a SimMechanics Import XML file.

When you import the CAD assembly, you must use the appropriate command for the format selected. If you export a model in first-generation format, you must use the mech_import command. If you export a model in second-generation format, you must use the smimport command.

Was this topic helpful?