Documentation

This is machine translation

Translated by
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.

Translate CAD Constraints into Simscape Multibody Joints

This study presents a set of complete CAD assemblies with both parts and constraints and possessing DoFs. Each example assembly consists of two instances of the same part file, representing two identical cubes. The study shows how to find the required files, presents the essential steps for generating models from them, and describes the structure common to all the generated models. It ends with specific assembly cases that include two cubes:

• With no constraints, so that the cubes have the full six degrees of freedom relative to one another

• Constrained in two different ways so as to produce the same result, a single prismatic (translational) DoF between them

• Constrained so as to allow only a single revolute (rotational) DoF between them

• Constrained so as to allow two prismatic (translational) DoFs between them

• Constrained so as to allow relative spherical joint motion, with the two cubes separated by a constant nonzero distance

In different assemblies, the two cubes are constrained with different constraint combinations to create different relative DoFs between the cubes. In most cases, you can represent one set of DoFs with a large number of different combinations of constraints.

Access the Example Files

Look for the CAD assembly files of this study in the smlink/smlinkdemos directory. The assemblies have the generic name, `<assembly-name>.``ASSEMBLYFILETYPE`. The cube part is in `magic_cube`.`PARTFILETYPE`.

Assembly NameAssembly Configuration
`sixDOF`Two cubes with no constraints
`prismatic1`Two cubes with planar and cylindrical constraints
`prismatic2`Two cubes with planar constraints
`revolute`Two cubes with planar and cylindrical constraints
`inplane`Two cubes with planar constraints
`spherical_spherical_massless_connector`Two cubes with a distance constraint

Translation of Two-Part Models

The procedure for exporting a two-part assembly and generating Simscape™ Multibody™ models based on it is essentially the same for all the examples of this study.

Export Assembly

To see a two-part assembly and export it as an XML multibody description file:

1. Open the assembly, `<assembly-name>.``ASSEMBLYFILETYPE`. The two parts are `magic_cube-1` and `magic_cube-2`.

Locate any constraints imposed on the parts. These constraints define the relative DoFs between the parts.

2. Using the Simscape Multibody Link interface to your CAD platform, export the CAD assembly as an XML multibody description file. The XML file is saved in your current working CAD folder.

Import Model

You can import the XML multibody description file into Simscape Multibody software. Simscape Multibody interprets the file and generates a corresponding Simscape Multibody model. The new model is based on XML file structure and parameters. The CAD Import procedure requires access to Simscape Multibody.

1. Move or copy the XML file to a working MATLAB® folder. In this folder, open MATLAB.

2. At the command line, enter `mech_import('<assembly_name>')` to automatically generate a model, `<assembly_name>.mdl`, based on `<assembly_name>.xml`.

3. Open the subsystem. A set of Joints represents the DoFs between the two cubes.

Block Structure of Two-Part Models

In this study, all the models that you generate each have eight blocks. From the example CAD assemblies, the models have a common structure because each assembly has a fundamental root and two moving parts:

• The assembly fundamental root. As in any generated CAD-based model, the four-block combination Machine Environment – Root Ground – Root Weld – Root Part represents the assembly fundamental root. The Root Part is a nonmoving, zero-mass/zero-inertia body.

• The moving bodies. The bodies representing the assembly parts are `magic_cube-1` and `magic_cube-2`.

• The joints. In all the models, the first cube is connected by a Weld to Root Part and cannot move. The second cube is connected to RootPart by a Joint that represents the appropriate degrees of freedom (DoFs).

Depending on the DoFs in a particular assembly, CAD translation configures the Joint to represent different DoFs with combinations of prismatic, revolute, and spherical primitives. The second cube can move with respect to the first cube through the DoFs represented by the Joint.

Some of the blocks in the generated models are redundant. You can manually edit and simplify the models without changing their physical properties.

CAD Constraints Restrict Degrees of Freedom

CAD platforms treat unconstrained parts as free rigid bodies with six mechanical degrees of freedom. To reduce the degrees of freedom of a CAD part, and therefore the ways that part can move, you must constrain that part. Applying a CAD constraint between two parts reduces the ways the two parts can move with respect to each other. In a two-part CAD assembly, one part is static relative to ground.

Translate Assembly with Six-DoF Joint

The simplest assembly with two parts has no constraints between the parts. The parts can move with respect to one another with all six degrees of freedom (DoFs).

Export Assembly

To see and export the assembly:

1. Open the assembly, `sixDOF`.`ASSEMBLYFILETYPE`.

The cube parts have no constraints. Therefore, relative to one another, the cubes are unconstrained in their motion and have six relative DoFs.

2. Export this CAD assembly into the file, `sixDOF.xml`.

Import Model

To generate a model based on the assembly:

1. At the MATLAB command line, enter `mech_import('sixDOF')` to generate a model, `sixDOF.mdl`.

2. Inspect the model. There are eight blocks.

The Six-DoF Joint represents the six DoFs between the two cubes with one spherical and three prismatic primitives.

Translate Assembly with Prismatic Joint

In the following two assemblies, the two cubes are constrained to have only a single translational degree of freedom (DoF) between them. These assemblies illustrate two ways to express one translational degree of freedom. You can experiment with other constraints to find more. In the translated Simscape Multibody models, this single DoF is a prismatic joint.

Prismatic as a Cylindrical Constraint and a Planar Constraint

To see the first way of constraining the DoFs to produce a prismatic joint:

1. Open the assembly file, `prismatic1`.`ASSEMBLYFILETYPE`, and examine its CAD hierarchy.

2. Locate the two constraints on the two cubes.

• Highlight the cylindrical constraint in the assembly. This constraint allows the two cubes to only slide along and rotate about the z-axis running through the center of the parallel and concentric upper holes of each cube.

• Highlight the planar constraint in the assembly. This constraint allows the two cubes to slide along the y-z plane. The constraint also allows the two cubes to rotate about the x-axis. The cubes are not allowed to rotate about any other axis, or to translate perpendicular to the y-z plane.

With these two constraints, the two cubes can only slide along the z-axis common to the two upper concentric holes. The second constraint prevents rotation about this axis, leaving the whole assembly with only one translational DoF.

Cylindrical and Planar Constraints on Two Cubes (SolidWorks)

Prismatic as Two Orthogonal Planar Constraints

To see the second way of constraining the DoFs to produce a prismatic joint:

1. Open the assembly file, `prismatic2`.`ASSEMBLYFILETYPE`, and examine its CAD hierarchy.

2. Locate the two constraints on the two cubes.

• Highlight the first planar constraint in the assembly. This constraint allows the two cubes to slide along the y-z plane. It also allows the two cubes to rotate about the x-axis. The cubes are not allowed to rotate about any other axis, or to translate perpendicular to the y-z plane.

• Highlight the second planar constraint in the assembly. This constraint allows the two cubes to slide along the x-z plane, with the two sides marked "The MathWorks" sharing a common plane, representing two translational DoFs. The constraint also allows the two cubes to rotate about the y-axis. The cubes are not allowed to rotate about any other axis, or to translate perpendicular to the x-z plane.

With these two constraints, the two cubes can only slide along the z-axis common to the two planes y-z and x-z, leaving the whole assembly with only one translational DoF.

Two Planar Constraints on Two Cubes (SolidWorks)

Export Assemblies and Import Models

To create models from the assemblies:

1. Export the two assemblies into the XML files, `prismatic1.xml` and `prismatic2.xml`.

2. Copy or move them to a MATLAB working folder. At the MATLAB command line, generate Simscape Multibody models using `mech_import`.

In both models, the assemblies are translated into block diagrams of eight blocks each. The Prismatic Joint represents the single translational DoF between the two cubes with one prismatic primitive along the z-axis.

Translate Assembly with Revolute Joint

In the following assembly, the two cubes are constrained to have only a single rotational degree of freedom (DoF) between them. In the translated Simscape Multibody model, this single DoF is a revolute joint.

Open CAD Assembly

To see an assembly with one rotational DoF:

1. Open the assembly file, `revolute`.`ASSEMBLYFILETYPE`, and examine its CAD hierarchy.

2. Locate the two constraints on the two cubes.

• Highlight the cylindrical constraint in the assembly. This constraint allows the two cubes to slide along and rotate about the z-axis running through the center of the parallel and concentric upper holes of each cube.

• Highlight the planar constraint in the assembly. This constraint allows the two cubes to slide along the x-y plane, with the parallel sides sharing a common plane. The constraint also allows the two cubes to rotate about the z-axis. The cubes are not allowed to rotate about any other axis, or to translate perpendicular to the x-y plane.

With these two constraints, the two cubes can only rotate about the z-axis orthogonal to the x-y plane, leaving the whole assembly with only one rotational DoF.

Export Assembly and Import Model

To generate a model based on the assembly:

1. Export the assembly as the file, `revolute.xml`. Copy or move it to a MATLAB working folder.

2. At the MATLAB command line, generate a Simscape Multibody model using `mech_import`.

The assembly is translated into a block diagram of eight blocks. The Revolute Joint represents the single rotational DoF between the two cubes with one revolute primitive about the z-axis.

Translate Assembly with Rectangular Joint

In the following assembly, the two cubes are constrained to have only two translational degrees of freedom (DoFs) between them. In the translated Simscape Multibody model, these two DoFs are two prismatic joints.

Open CAD Assembly

To see an assembly with two translational DoFs:

1. Open the assembly file, `inplane`.`ASSEMBLYFILETYPE`, and examine its CAD hierarchy.

2. Locate the two constraints on the two cubes.

• Highlight the first planar constraint in the assembly. This constraint allows the two cubes to slide along the y-z plane. The constraint also allows the two cubes to rotate about the x-axis. The cubes are not allowed to rotate about any other axis, or to translate perpendicular to the y-z plane.

• Highlight the second planar constraint in the assembly. This constraint allows the two cubes to slide parallel to the x-z plane, with the two sides marked "The MathWorks'' parallel but not necessarily in the same plane. It also allows the two cubes to translate perpendicular to the x-z plane and to rotate about the y-axis. The cubes are not allowed to rotate about any other axis.

With these two constraint, the two cubes can only slide in the y-z plane, leaving the whole assembly with only two translational DoFs.

Export Assembly and Import Model

To generate a model based on the assembly:

1. Export the assembly as the file, `inplane.xml`. Copy or move it to a MATLAB working folder.

2. At the MATLAB command line, generate a Simscape Multibody model using `mech_import`.

The assembly is translated into a block diagram of eight blocks. The In-Plane Joint represents the two translational DoFs between the two cubes with two prismatic primitives, along the y-axis and the z-axis.

Translate Assembly with Spherical-Spherical Massless Connector

In the following assembly, the two cubes are constrained to have six rotational degrees of freedom (DoFs) between them, represented by two spherical primitives. The spherical primitives pivot independently about two pivot points at a fixed relative distance. In the translated Simscape Multibody model, a spherical-spherical massless connector represents these six DoFs.

Open CAD Assembly

To see an assembly with three rotational DoFs separated from three other rotational DoFs:

1. Open the assembly file,

` spherical_spherical_massless_connector.ASSEMBLYFILETYPE`

and examine its CAD hierarchy.

2. Locate the one constraint on the two cubes.

Highlight this distance-offset constraint. The two spherical pivot points occur one on each cube and mark the endpoints of the rigid massless connector. The cubes can move so that the distance between these two endpoints (the length of the massless connector) does not change. The constraint allows the two cubes to pivot independently about their connector endpoints.

Distance Constraint on Two Cubes (SolidWorks)

Export Assembly and Import Model

To generate a model based on the assembly:

1. Export the assembly as a file,

` spherical_spherical_massless_connector.xml`
2. Copy or move it to a MATLAB working folder.

3. At the MATLAB command line, generate a Simscape Multibody model using `mech_import`.

The Spherical-Spherical massless connector Joint block represents the two spherical primitives, each with three rotational DoFs, independently pivoting at each end of the massless, rigid connector connecting the two cubes.

Was this topic helpful?

Get trial now