Grabing the name of a selected object

How do you grab the name of an object in a selection.

ex. I have a selection of 10 spheres. (sphere01, sphere02, sphere03.....)

It doesn't matter which object I grab the name from, it just has to be in the current selection.

I ultimately want to rename the current object with its base text remaining so its new name would be "sphere02-collection"

Thanks
JokerMartini

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Graph's picture

for o in selection do o.name

for o in selection do o.name += "-collection"
?

Raphael Steves

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.