Duplicating Datablocks

I’ll try and make this the least confusing as I can…

I can’t for the life of me figure out how to grab the object data name of an object.

For instance, an object is selected:

for o in Object.GetSelected():
  c = o.getData()
  print c

Which prints:

[Curve "Curve.004"]

How can I get “Curve.004” out of that list so I can assign it to a variable so that I can use it later? Say for grabbing the data or linking another object to that data.

Sorry if that doesn’t make much sense. If it doesn’t let me know and I’ll try and clarify more.


you can’t get that name at the moment because you are printing the object object’s data :slight_smile: what you want is something like :

objs = []
for obj in Blender.Object.GetSelected():
      name = data.getName()


You can replace “name = data.getName()” like this :

objs = []
for obj in Blender.Object.GetSelected():

Thanks guys, exactly what I was looking for!

Edit: Ack…I meant to delete this one…now editing is the only available option.

So…edited, I guess.

Alright, I’ve hit a speed bump.

Is it possible to take the datablock information from one object and apply it to another but with a different name? Here’s the result I’m hoping for:

  1. Get datablock info from an object, i.e. curve
  2. Create a new curve and link it to the datablock info from step 1, only with a different name. So, it’ll start out with the same properties as the object from step 1, but can then be edited independently. A SHIFT+D effect.

Is this even possible?

yep, use Object.link()


Is there a way to then make the datablock a single user after linking?