renaming duplicate

On 07/02/2018 at 04:32, xxxxxxxx wrote:

i have created an object 'Sphere' in my document.
Then i have created another one and Cinema puts the name "Sphere.1". Thats ok.

But then i ve been tempted to see if cinema4d allows to rename this second sphere with simply "Sphere" and to my surprise it lets you!

That puzzles me a bit, because now i have two geometry spheres both with same name!

if i do:

mylist = doc.GetObjects()
for o in mylist:
   print o.GetName()

it gives be back as result


Iif i cannot differentiate both objects by name, then how?

On 08/02/2018 at 00:29, xxxxxxxx wrote:

When inserting new objects the flag "checknames" may help you:

BaseDocument.InsertObject( op [, parent=None , pred=None , checknames=False ])
_ checknames ( bool ) – Check for duplicate names and append .1, .2 etc.

_When checking for a unique ID of any BaseList2D, you might want to get the container of the object, via obj.GetData(), then do a container.GetUUid() to check for unique ID's. But i'm not 100% sure, if that's the right and most convinient way to do... others?


On 08/02/2018 at 03:15, xxxxxxxx wrote:

Thanks lasse that is what i was looking for!

On 09/02/2018 at 05:21, xxxxxxxx wrote:


I'm glad you already found a solution.

Just a few additions from our side:

As already mentioned in your other thread (custom metadata node), Cinema 4D doesn't care about the names of objects. And the user is always (almost) free to change the names of entities, so I'm not sure these are really good for reference.

Instead you may want to take a look into GetGUID(). These GUIDs do have their limitations, but in your case might well be an option. Take a look at the thread "Why are GUIDs not globally unique?" for an interesting discussion of the limitations (be aware, though, GeMarker is not available in Python).

Another option may be the approach discussed in the above mentioned metadata thread. Of course you can store whatever identifier you would want or need in the custom BaseContainer mentioned there.