Contenido principal

componentPaths

R2026b

Class: simscape.multibody.Multibody
Namespace: simscape.multibody

Return paths of component objects in Multibody object

Since R2022a

Description

paths = componentPaths(mb) returns the paths of the component objects in the entire hierarchy of the simscape.multibody.Multibody object, mb.

paths = componentPaths(mb,ComponentType=type) returns the paths of only the component objects that match the specified component type.

example

Input Arguments

expand all

Multibody system, specified as a simscape.multibody.Multibody object.

Component type used to filter results, specified as a string. The value can be the short class name without the simscape.multibody. prefix or the fully qualified class name (for example, "simscape.multibody.RevoluteJoint") of any class that inherits from simscape.multibody.Component. The filter is hierarchical. Specifying a base class returns components of that class and all its subclasses.

Common values:

ValueMatches
"Component"All components
"Joint"All joint types such as RevoluteJoint and PrismaticJoint
"RigidBody"Rigid body components
"RigidTransform"Rigid transform components
"Multibody"Sub-multibody components
"UniformSolid"Uniform solid components
"GeneralSolid"General solid components

You can also specify a specific joint class name such as "RevoluteJoint" or "PrismaticJoint" to match only that joint type.

Output Arguments

expand all

Paths of the component objects in the entire hierarchy of the Multibody object, returned as a string array.

Attributes

Accesspublic

To learn about attributes of methods, see Method Attributes.

Examples

expand all

This example shows how to use the ComponentType name-value argument to return only the paths of joint components.

Create a Multibody object and add a revolute joint, a rigid body, and a rigid transform.

mb = simscape.multibody.Multibody;
addComponent(mb, "rj", simscape.multibody.RevoluteJoint);
addComponent(mb, "rb", simscape.multibody.RigidBody);
addComponent(mb, "rt", simscape.multibody.RigidTransform);

Return only the paths of joint components.

paths = componentPaths(mb, ComponentType="Joint")
paths = "rj"

Alternatives

You can use the ComponentNames property of the simscape.multibody.Multibody object to return the names of component objects at the top level of the Multibody object. The returned value is a string array.

Version History

Introduced in R2022a