Products & Services Solutions Academia Support User Community Company

Learn more about SimMechanics Link   

Translating CAD Constraints into Joints

Modeling CAD and SimMechanics Degrees of Freedom

In Translating a CAD Part into a Body preceding, you create and export an assembly composed of a single part. CAD translation converts the part into a body, with a mass, an inertia tensor, and Body coordinate systems (CSs). Because there are no other parts in that CAD assembly, the SimMechanics body is welded to ground and has no degrees of freedom (DoFs). This lack of DoFs is not realistic for most assemblies.

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.

In different assemblies, the two cubes are constrained with different constraint combinations to create different relative DoFs between the cubes. You can typically represent a set of DoFs with a large number of different constraint combinations. Each constraint combination here, in general, is not the unique way to create the corresponding set of DoFs. These assembly examples include:

Locating the Constraint Assembly Files

Locate the CAD assembly files for this study in the SimMechanics Link demos folder. The assemblies have the generic name <assembly-name>.ASSEMBLYFILETYPE. The cube part is in magic_cube.PARTFILETYPE.

Assembly NameAssembly Configuration
sixDOFTwo cubes with no constraints
prismatic1Two cubes with planar and cylindrical constraints
prismatic2Two cubes with planar constraints
revoluteTwo cubes with planar and cylindrical constraints
inplaneTwo cubes with planar constraints
spherical_spherical_
massless_connector
Two cubes with a distance constraint

Generating the Two-Part Models: Common Steps

The steps for exporting a two-part assembly and generating SimMechanics models based on it are essentially the same for all the examples of this study.

Viewing and Exporting an Assembly

To see a two-part assembly and export it into Physical Modeling XML:

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

    In the CAD hierarchy, note any constraints imposed on the parts. These constraints define the relative DoFs between the parts.

  2. Using the SimMechanics Link interface to your CAD platform, export this CAD assembly into Physical Modeling XML. The XML file is saved in your current working CAD folder.

Generating a Model

You can generate a SimMechanics model based on this assembly.

  1. Move or copy the XML file to a working MATLAB folder. Then open MATLAB in that folder.

  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. The blocks are arranged in the common structure described in About the Common Block Structure of the Two-Part Models: following. A set of Joints represents the DoFs between the two cubes.

About the Common Block Structure of the Two-Part Models:

All the models that you generate in this study 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:

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

Restricting Degrees of Freedom with Constraints

CAD platforms normally assume that two parts with no constraints between them have the complete six relative DoFs possessed by any rigid body relative to another body. You restrict the DoFs between parts by connecting them with constraints in the CAD assembly. Constraints restrict relative body motion and reduce the number of relative DoFs between body pairs. There is always one assembly part welded to ground.

Modeling a 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).

Exporting the Assembly

To see and export this assembly:

  1. Open the assembly sixDOF.ASSEMBLYFILETYPE.

    In the CAD hierarchy, the constraints (Mates) node has no entries. Therefore, relative to one another, the cubes are unconstrained in their motion and have six relative DoFs.

  2. Export this CAD assembly into sixDOF.xml.

Generating the Model

To generate a model based on this 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.

Modeling a 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 accomplish this; you can experiment with other constraints to find more. In the translated SimMechanics models, this single DoF is a prismatic joint.

Prismatic as a Planar Constraint and a Cylindrical Constraint

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

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

  2. Locate and expand the constraints (Mates) node. There are two constraints on the two cubes.

    • Highlight the first constraint, Concentric1. The constraint geometry is highlighted in the assembly. This constraint allows the two cubes only 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 second constraint, Coincident2. The constraint geometry is highlighted in the assembly. This constraint allows the two cubes to slide along the y-z plane, with the two sides marked "SimMechanics" sharing a common plane, representing two translational DoFs. 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.

These two constraints mean that 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.

Planar and Cylindrical Constraints on Two Cubes

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 the CAD hierarchy.

  2. Locate and expand the constraints (Mates) node. There are two constraints on the two cubes.

    • Highlight the first constraint, Coincident2. The constraint geometry is highlighted in the assembly. This constraint allows the two cubes to slide along the y-z plane, with the two sides marked "SimMechanics" sharing a common plane, representing two translational DoFs. 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 constraint, Coincident3. The constraint geometry is highlighted 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. It 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.

These two constraints mean that 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

Exporting the Assemblies and Generating SimMechanics 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 SimMechanics 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.

Modeling a 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 SimMechanics model, this single DoF is a revolute joint.

Viewing the Assembly

To see an assembly with one rotational DoF:

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

  2. Locate and expand the constraints (Mates) node. There are two constraints on the two cubes.

    • Highlight the first constraint, Concentric1. The constraint geometry is highlighted 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 second constraint, Coincident1. The constraint geometry is highlighted in the assembly. This constraint allows the two cubes to slide along the x-y plane, with the parallel sides sharing a common plane. It 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.

These two constraints mean that 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.

Exporting the Assembly and Generating the Model

To generate a model based on this assembly:

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

  2. At the MATLAB command line, generate a SimMechanics 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.

Modeling an Inplane Joint

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

Viewing the Assembly

To see an assembly with two translational DoFs:

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

  2. Locate and expand the constraints (Mates) node. There are two constraints on the two cubes.

    • Highlight the first constraint, Coincident2. The constraint geometry is highlighted in the assembly. This constraint allows the two cubes to slide along the y-z plane, with the two sides marked "SimMechanics" sharing a common 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 constraint, Parallel1. The constraint geometry is highlighted 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.

These two constraints mean that the two cubes can only slide in the y-z plane, leaving the whole assembly with only two translational DoFs.

Exporting the Assembly and Generating the Model

To generate a model based on this assembly:

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

  2. At the MATLAB command line, generate a SimMechanics 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.

Modeling a 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 SimMechanics model, a spherical-spherical massless connector represents these six DoFs.

Viewing the 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 the CAD hierarchy.

  2. Locate and expand the constraints (Mates) node. There is one constraint on the two cubes.

    Highlight constraint Distance1. The two spherical pivot points are highlighted as small red or green squares, one on each cube. These points are the endpoints of the rigid massless connector. The cubes can move such that the distance between these two points (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

Exporting the Assembly and Generating the Model

To generate a model based on this assembly:

  1. Export the assembly as

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

  3. At the MATLAB command line, generate a SimMechanics model using mech_import.

The assembly is translated into a block diagram of eight blocks, arranged in the common structure described in About the Common Block Structure of the Two-Part Models: preceding.

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.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS