Rename all mechanical bodies, including in all components, according to each component’s name

Giorgos Kountourgiotis
Giorgos Kountourgiotis Member, Employee Posts: 1
First Anniversary Ansys Employee
✭✭✭

A workaround to rename all bodies, including all parts/components in the Ansys Mechanical tree, can be achieved with a simple script. By running the following script, we can rename all bodies from ‘Initial Body Name’ to ‘Initial Body Name/Component’s Name’:

parts=DataModel.GetObjectsByType(DataModelObjectCategory.Part)
for part in parts:
part_name=part.Name
bodies=part.Children
for body in bodies:
body.Name=part_name+'/'+body.Name