This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Export and Re-Export a Pendulum Assembly

About Model Update

    Note:   The CAD assembly files of this case study require Pro/ENGINEER®.

The following example shows how to update a previously generated Simscape™ Multibody™ model with a new XML file exported after changes have been made to the original CAD assembly. The example starts with a double pendulum assembly.

CAD Assembly Files

Look for the following seven CAD files of this case study in the Simscape Multibody Link examples folder.

File NameCAD File Type
Parts (main assembly)
Parts (subassembly)

Translate CAD Assembly

Open the dpen assembly file and export it into an XML file.

Export the assembly through the Simscape Multibody Link menu of the CAD platform's menu bar. The result is an XML file called dpen.xml.

Import CAD Assembly and Generate Simscape Multibody Model

To import the XML file and generate the Simscape Multibody model, you can either use the import dialog box or work with the full command at the MATLAB® command line.

Open the dialog box by entering mech_import at the command line.

The alternative is to use the full command with specified import options:


This model results from the import step. The blocks are created at the top level.

With visualization enabled, you see this Simscape Multibody model with custom bodies defined by geometry files exported when the XML file was exported.

Import Physical Modeling XML File

If you want to import the assembly into a model subsystem, rather than at the top level of a model, use the SubsystemToImportInto option of the mech_import command. (You can also use the parallel options in the import dialog box.) For example, you can import the assembly into a subsystem named Plant.


Modify Pendulum Assembly and Update Simscape Multibody Model

You can change part properties in the original assembly and reimport the assembly, with those changes, to update the model. You can also make direct changes by hand to the original generated model and preserve those changes even as you update it with assembly changes.

In this example, you now cut out material from the links to make them lighter. You also connect joint and body sensors in the Simscape Multibody model to implement a controller. Now you want to update the Simscape Multibody model with changes from the assembly without undoing the additions you made by hand.

Export Modified CAD Assembly

Change the double pendulum assembly and generate a new XML file from it.

  1. Open the pend part file and unsuppress the Extrude2 feature to enable the hole in the parts. Do this by right-clicking Extrude2 in the tree view and selecting Resume.

    Save the part file.

  2. Open and re-export the dpen assembly file to obtain the new XML file, which is assumed to be named dpen_with_holes.xml.

Modification to Imported Simscape Multibody Model

In this example, you have separately made the following changes, by hand, to the original generated model, now renamed dpen_withsensors. These changes include insertion of a Joint Sensor, a Body Sensor, and two Scope blocks.

These are the properties of the PEND body before the update-import. PEND-1 has the same mass properties.

Preparation for Model Update

Before proceeding to the update-import from the updated CAD assembly, designate the manually added Simscape Multibody blocks that you want to retain and keep connected to the originally imported blocks. Right-click the sensor blocks and select the Retain connectivity to imported blocks option under the Simscape Multibody submenu. This option is selected by default.

Simscape Multibody Model Update

Now update-import in such a way as to modify the PEND and PEND-1 body mass properties, without changing the manually added blocks and connections. You can either use the import dialog box or the command line with fully specified options to update the existing model. This example uses the dialog box, opened by entering mech_import at the command line.

The dialog box is configured so that dpen_with_holes.xml is the file imported to update the modified dpen_withsensors model. Because the dialog box is set to update an existing model, the Update and Backup options in the Advanced Options tab are now enabled.

Alternatively, if you want to use the command with fully specified options, enter:


The updated model looks like the following. The sensors and Scopes are retained.

However, the PEND body properties are now different, because of the new holes in the parts. The PEND-1 mass properties are changed in the same way.

The updated bodies, displayed in Simscape Multibody visualization, appear differently as well, as determined by the new geometry files exported from the updated assembly at the same time the new XML file was created.

Add New Body to Create a Triple Pendulum

The changes to an assembly that you can re-export are not limited to changes in existing parts (bodies). You can add or remove parts, re-export, then update-import an older version of the generated model with the changes.

In this example, in addition to the holes in the parts you previously made, you change the original assembly further by adding a new part (link) between the two original pendulum links, making the assembly a triple pendulum. This addition changes the topology of the assembly (the assembly's connectivity), beyond the property changes to the individual links.

Modify and Update CAD Assembly

To see such a changed assembly, open the tpen assembly file. The tpen assembly is a copy of the dpen assembly with a link inserted. Export a new XML file, which is named tpen.xml.

Updating the Existing Generated Model

Update the existing dpen_withsensors model with the changes to the assembly. These are the required options in the import dialog box.

The Advanced Options tab shows important options selected for this example.

Advanced OptionEffect of Option
Arrange all updated blocksSelecting this option causes the importer to rearrange all the imported and updated blocks.
If cleared, the importer does not alter the layout of the existing blocks, whether updated or not, and places the newly imported blocks around the bounding box for the already existing blocks. In many cases, this means you have to rearrange the newly imported blocks by hand.
Respect individual block update settingsSelecting this option preserves the associativity information specified on each block.
Backup modeUsing this pull-down menu allows you to choose how the model is backed up during update. the backup options.
By default, the backup copy of the model is created in the same folder as the model being updated.

The equivalent command line import command is:


The block diagram shows that the part MID_PART inserted between the two links PEND and PEND-1. The sensors are retained. The properties of PEND and PEND-1 have been updated (to incorporate the holes that are now present). Because the Arrange all updated blocks option was selected, the blocks PEND and PEND-1 were moved to accommodate the block MID_PART and the joints Revolute2 and Revolute3.

Disabling Automatic Block Arrangement

The following block diagram shows the updated model that results when the Arrange all updated blocks option is cleared. The importer places the newly imported blocks around the bounding box of the existing blocks. The layout of the existing blocks is unchanged.

Update Imported Model While Retaining Manual Joint Replacements

In circumstances where a set of assembly constraints imposes ambiguous restrictions on the motions of two parts, the Simscape Multibody Link exporter cannot resolve the constraint set into a moving joint. In such cases, it exports a Weld joint. If so, it is up to you to manually replace the Weld joint with the appropriate moving joint in the generated model. Even in situations where the exporter creates a moving joint, it might not reflect the degrees of freedom that you want, and you might want replace it with another. When you have replaced such joints in an imported model, and you want to update the model with changes from the CAD assembly, you generally want to retain the replacements you made manually.

  1. Create a dpen_jointrep model in the following way.

    Open the dpen_withsensors model and replace the Revolute joint between the two link bodies by a Planar joint that has some compliance in the plane perpendicular to the original revolute axis. Rename the Planar joint to Revolute with Compliance.

  2. To update this model with changes to the link body properties, but to still retain the new Planar joint, right-click the Revolute with Compliance block and select the Retain connectivity to imported blocks option. It is selected by default.

  3. Update this model with the new XML file that has changes to the properties of the links.


The updated model retains the Revolute with Compliance joint.

Selectively Update Imported Model

You can update certain bodies while not updating other bodies with changes. Prevent a particular body from being updated during reimport by:

  1. Right-clicking the body and selecting the Retain without updating properties option under the Simscape Multibody submenu.

  2. Selecting the Respect individual block update settings option in the import dialog box.

    If you use the full command instead, you need to set the EnableIndvlBlkUpdCtrl option to true.

Clearing the Respect individual block update settings check box causes the importer to update all blocks, disregarding the update settings on the individual blocks.

Was this topic helpful?