Main Content

component

Class: simscape.multibody.RigidBody
Namespace: simscape.multibody

Extract component object from RigidBody object

Since R2022a

Description

C = component(rb,path) extracts a component object, C, from the simscape.multibody.RigidBody object, rb. The path argument is the path of the component object in the rbobject and can have more than one elements. In other words, the component method can extract an object from any hierarchical level of the rb object.

The extracted object is a copy of the original component object. Therefore, any subsequent changes for the extracted copy do not affect the original object.

Input Arguments

expand all

Rigid body, specified as a simscape.multibody.RigidBody object. The rb object represents the rigid body from which you add the component object.

Path of the component object, specified as a string scalar or character vector. The length of the path depends on the hierarchical level of the component object. If the object is at the top level, the path has one element. If the component object is in a subbody, the path has two elements, and the path elements are separated by forward slashes. The first element is the name of the subbody, and the last element is the name of desired component object.

Example: "subrb/sphere"

Output Arguments

expand all

Copy of the component object, returned as a simscape.multibody.Solid or simscape.multibody.RigidBody object. Modifying the extracted component object does not affect the original component object inside the RigidBody object.

Attributes

Accesspublic

To learn about attributes of methods, see Method Attributes.

Version History

Introduced in R2022a