Documentation

Representing Solid Geometry

Geometry in a Model

Geometry is a key attribute of solids and of the bodies they comprise. It features in the solid visualizations provided by Solid blocks as visual aides during modeling. It features also in the multibody visualizations displayed in Mechanics Explorer following model assembly and during simulation. This is one purpose of solid geometry: to enable visualization for an entire modeling workflow, from the conception of a single solid to the simulation of a complete multibody model.

Geometry of a Body Element

Solid geometry serves a second, less visible, purpose: to simplify the specification of inertia in the Solid block. The bulk of solid inertia parameters are readily computed if both geometry and mass, or, alternatively, mass density, are known. The Solid block provides an inertia parameterization, Calculate from Geometry, that performs these calculations for you. You specify the solid geometry and a measure of its mass; the block carries out the required numerical integrations to obtain the remaining inertia parameters—the moments of inertia, products of inertia, and center of mass.

Geometry in Body Elements Blocks

Solid geometry differs in a practical way from frames and inertia. The latter are attributes that you can model in isolation using blocks such as Rigid Transform and Inertia. There is no equivalent, dedicated block for solid geometry. The Graphic and Spline blocks represent geometries—and provide a visualization means for those geometries—but neither is an adequate replacement for an actual solid geometry.

The Graphic block merely adds a marker to a frame, typically as a means of highlighting that frame. The Spline block adds a plane or space curve largely intended for use with the Point on Curve Constraint block. If you want to visualize solids and bodies, or benefit from the automatic inertia calculations that solid geometry enables, you must use the Solid block.

Try It: Specify a Simple Cylinder Shape

Use the Solid block to model a body with a simple preset shape—a cylinder with a radius of 5 cm and a length of 20 cm. Visualize the solid in the visualization pane of the Solid block. Ignore the relative placement of the solid in the (incomplete) model.

  1. Add a Solid block to a new Simulink model and open the block dialog box. Note the Geometry parameters section, which by default specifies a Brick shape 1 m in side.

  2. From the Geometry > Shape dropdown list, select Cylinder. The Geometry parameters section updates to show the required Cylinder properties—Radius and Length.

  3. In the Radius parameter line, enter a value of 5 and select units of cm. You can select your units from the dropdown list or enter them manually.

  4. In the Length parameter line, enter a value of 20 and again select units of cm. Note the warning in the visualization pane urging you to update the solid visualization.

  5. In the visualization toolstrip, click the Update Visualization button. The visualization pane refreshes with the new solid geometry but, due to its small dimensions, it is barely visible. Click the Fit to View button to optimize the zoom level. Ensure that the solid geometry is as expected.

  6. Expand the Inertia parameters section and take note of the Type parameter setting. The automatic calculation of inertia properties from geometry is by default enabled. To complete the model of your solid, you need only ensure that its mass or mass density is set to the correct value. Click OK to accept the current solid settings.

Positioning and Orienting a Solid in a Model

If a Solid block is unconnected, the relative placement of that solid is undefined. To resolve the solid pose—its position and orientation—in a model, you must connect the reference frame port (B) or, if you prefer, a custom frame port, belonging to the Solid block. For example, connecting the R port to the W port of a World Frame block would align the solid so that its reference frame is coincident with the world frame. The figure shows such a connection

Specifying spatial relationships such as this is key to modeling in the Simscape Multibody environment. You can rotate and translate two frames with respect to one another by applying operations called rigid transforms between those frames. To learn more about frames and transforms, see Working with Frames.

For ease of modeling, the Solid block provides a frame creation interface. You can use this interface to append and align new frames to select geometry features, such as vertices, edges, faces, and volumes. To learn how to create frames using this interface, see Creating Custom Solid Frames

.

Preset Solid Shapes

The Solid block provides a sizeable array of preset shapes—those with simple parameterizations featuring readily accessible parameters, such as Radius and Length, as inputs. Preset shapes make it possible to quickly model spherical, cylindrical, and prismatic solids, among others. For greater versatility, the preset shapes include General Extrusion and Revolution—shapes whose cross-sections, be they along or about an axis, you can modify. To learn more about these shapes, see Modeling Extrusions and Revolutions.

Try It: Specify a Simple Revolution Shape

Use the Solid block to model a solid of revolution—a cone with a height of 5 ft and a base radius also of 5 ft. Visualize the solid in the visualization pane of the Solid block. Ignore the relative placement of the solid in the (still incomplete) model.

  1. Add a Solid block to a Simulink model. You can reuse the Solid block from the previous solid geometry example.

  2. From the Geometry > Shape dropdown list, select Revolution. The Geometry parameters section updates to show the required Revolution parameters: Cross-Section and Length.

  3. In the Cross-Section parameter line, enter the coordinate matrix [0 0; 5 0; 0 5] and select units of ft. Each matrix row provides an [x z] coordinate pair, specified in that order, for a cross-section point.

  4. Click the Update Visualization button and the Fit to View button. Ensure that the solid geometry is as expected. Click OK to accept the new solid geometry and close the block dialog box.

Specifying the Solid Cross-Sections

The Solid block generates the Revolution shape by sweeping the specified xz cross-section about the z-axis. To consistently generate a valid shape without errors, the Solid block enforces a few rules. Foremost among these is the requirement that, as you proceed from one point in the coordinate matrix to the next, the solid region lie to your left and the empty (or hollow) region to your right. The same rule applies to General Extrusion shapes, with one distinction: the cross-section coordinates are (x, y) pairs and the cross-section lies in the xy plane. To learn more about Revolution and General Extrusion cross-sections, see Modeling Extrusions and Revolutions.

Imported Solid Shapes

Rather than specify a solid shape, you can import one from an external geometry file. This option, available from the Geometry > Shape dropdown list of the Solid block (as From File), provides your best route for modeling complex or intricate solid geometries. You must obtain the desired geometry in a supported format—currently STEP (also referred to as STP) or STL.

The STEP format is recommended as it leads to what are generally smaller files than equivalent STL geometries. STEP is also the only of the two formats that allows for automatic inertia calculation from geometry. You must explicitly specify the moments of inertia, products of inertia, and center of mass of the solid when importing an STL geometry.

Note that very large files may load slowly and delay the usually fast model update step (Simulation > Update Diagram). The size of a STEP or STL file depends to an extent on the application used to generate the file. You can, in some cases, reduce size by using a different application to export your solid geometry.

Try It: Import a STEP Geometry File

Use the Solid block to import a detailed bevel gear geometry. The gear geometry was created in CAD software and subsequently exported in STEP format. Visualize the solid in the visualization pane of the Solid block and ignore the relative placement of the solid in the model.

  1. Add a Solid block to a Simulink model. You can reuse the Solid block from the previous solid geometry example.

  2. From the Geometry > Shape dropdown list, select From File. The Geometry parameters section updates to show the required file import properties—File Type, File Name, and, for STL files only, Units.

  3. From the File Type dropdown list, select STEP. This is the recommended geometry file type. STEP files are generally smaller than their STL counterparts and enable the automatic calculation from geometry.

  4. In the File Name parameter field, enter bevel_c.step. This file name corresponds to an example STEP geometry that is by default on your MATLAB path. If you experience any issues, you can enter the file path:

    matlabroot/toolbox/physmod/sm/docexamples/bevel_gear/bevel_c.step
    where matlabroot is the root folder of your MATLAB installation. If you are unsure of the location of your root folder, at the MATLAB command prompt, enter matlabroot.

  5. Click the Update Visualization button and then the Fit to View button. Ensure that the solid geometry is as expected. Click OK to accept the new solid geometry and close the block dialog box.

Obtaining the Solid Geometry Files

You can obtain a STEP or STL geometry file from a CAD model. Most CAD applications enable you to export your part geometries in these (among other) formats. If you are adept at using a CAD application, or have the support of someone who is, you can create a detailed solid geometry in CAD, export it in a STEP or STL file, and import the final geometry file into a Solid block.

If you lack a license to a professional CAD application, open-source software such as FreeCAD may provide a suitable alternative. Onshape, a professional, full-cloud CAD application, provides free subscription plans. This tool has the advantage of allowing you to import complete multibody assemblies into the Simscape Multibody environment using the smexportonshape function. For more information, see Onshape Import.

Compound Solid Shapes

If you cannot obtain a STEP or STL file with the desired solid geometry, you can still approximate that geometry—by combining simpler preset shapes into a larger, compound, shape. You must use multiple Solid blocks—one for each preset solid shape. Often, you must also use Rigid Transform blocks, to specify the spatial relationships that exist between the solid reference frames. The figure shows a solid geometry that you can model as a compound shape—a binary link with a hole section (labeled A), a main section (B), and a peg section(C).

For an example showing how to model this compound body, see Try It: Create a Compound Geometry.

Related Topics

Was this topic helpful?