getSelectedBodies

Overview

This utility is used to get the selected bodies to perform some operations.

Syntax

BodyNames=simlab.getSelectedBodies()

User Case

Below are some of the use case where getSelectedBodies will be useful to make the script generic.

  • To surface mesh the selected bodies from huge CAD bodies

  • To create a body group with selected bodies

  • To perform any body based operations using selected bodies

Why we need this utility?

This utility is mostly used in semi automation process, where the bodies selected by a user can be identified by script and proceed further.The identified bodies can be given as input for further process like Create Group, Surface Mesh., that available in script.The body selection can be done while playing the script in interactive mode or use pauseprocess function to pause the script execution, select the required bodies and continue the script execution.

Utility Input/output

Hint

This function will get the body names as list, so convert it as a string by adding "str" and remove the () using ".strip" and also replace the single quotes to double quotes by using ".replace".

Example

After execution of this function, the variable will have.,BodyName = ('Cover', 'Carrier')This will return the body names as list, convert it as string like below.,BodyNames=str(BodyNames).strip('()').replace("'",'"')and this will returnBodyName = '"Cover", "Carrier"' now this variable is ready to use inside any function.

Sample