Selectively Show and Hide Model Components
Visualization filtering is a Multibody 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 Multibody Explorer, the Simscape Multibody visualization utility you must first update the example model. In the Modeling tab, click Update Model (Ctrl + D). Note the Model Tree pane on the left side of Multibody Explorer. You access the visualization filtering menu by right-clicking a node on this pane.
Hide Half-Cylinder Subsystem
In the Model Tree pane, expand the Housing and Cylinders Assembly node. Right-click the
Half Cylinder A node and select Hide This
.
Multibody 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 Model Tree pane. The figure shows
the resulting model visualization.
Show Solid in Hidden Subsystem
In the Model Tree 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 Model Tree pane. The figure shows the resulting model
visualization.
Show Only Piston Subsystem
In the Model Tree pane, collapse the Housing and Cylinders Assembly node. Then,
right-click the Piston Crank Assembly node and select Show Only
This
. Multibody Explorer shows the selected node and hides
the remainder of the model. In the Model Tree 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 Model Tree pane, right-click any node and select Show
Everything
. All hidden components become visible. The
corresponding nodes are no longer grayed out in the Model Tree pane. The
figure shows the resulting model visualization.