Selectively Show and Hide Model Components
Visualization filtering is a Mechanics Explorer feature that enables you to selectively show and hide solids, bodies, and multibody subsystems. This tutorial shows you how to use this feature to control the visualization of a Simscape™ Multibody™ model, for example, to observe a model component that might otherwise remain obstructed during simulation. For more information, see Selective Model Visualization.
Open Example Model
In this tutorial, you filter the visualization of the Simscape
Multibody radial engine featured example. To open this model, at the
MATLAB® command prompt, enter
openExample("sm/TranslationalInterfaceExample")
.
The model contains two top-level subsystems—the housing subsystem, named Housing_and_Cylinders_Assembly, and the piston subsystem, named Piston_Crank_Assembly. The housing subsystem contains five half cylinders. The piston subsystem contains five pistons that travel inside the half cylinders.
Update Example Model
To open Mechanics Explorer, the Simscape Multibody visualization utility you must first update the example model. In the Modeling tab, click Update Model (Ctrl + D). Note the tree-view pane on the left side of Mechanics Explorer. You access the visualization filtering menu by right-clicking a node on this pane.
Hide Half-Cylinder Subsystem
In the tree-view pane, expand the Housing_and_Cylinders_Assembly node. Right-click the
Half_Cylinder_A node and select Hide This
.
Mechanics Explorer hides the half-cylinder subsystem and the solids it
contains, corresponding to the nodes Fins and Half_Annular_Cylinder. The
hidden-node names are grayed out in the tree-view pane. The figure shows the
resulting model visualization.
Show Solid in Hidden Subsystem
In the tree-view pane, expand the Half_Cylinder_A node. Then, right-click the
Half_Annular_Cylinder node and select Show This
.
The half-cylinder solid is now visible, but the remainder of its parent of
its parent subsystem—in this case, just the Fins solid—remains
hidden. The newly visible half-cylinder node name is no longer grayed out in
the tree-view pane. The figure shows the resulting model
visualization.
Show Only Piston Subsystem
In the tree-view pane, collapse the Housing_and_Cylinders_Assembly node. Then,
right-click the Piston_Crank_Assembly node and select Show Only
This
. Mechanics Explorer shows the selected node and hides
the remainder of the model. In the tree-view pane, the name of the selected
node is the only that is not grayed out. The figure shows the resulting
model visualization.
Show Everything
In the tree-view pane, right-click any node and select Show
Everything
. All hidden components become visible. The
corresponding nodes are no longer grayed out in the tree-view pane. The
figure shows the resulting model visualization.