center new mesh object

Hi all,
Is there a python method to get the Center New function on a mesh ?

maybe you look for this?
the location of your object is the ‘center’
it is read/write …
e.g. select an object
go to the console and type
bpy.context.active_object.location #to see the center coordinates
bpy.context.active_object.location =[1,1,1] #e.g to set the center to 1,1,1

(means if you know you object change or look for its location)

No. I’m talking about the function performed by the Center New button.

I dont see it anywhere so I’ll try to write it. Something like:

minX = min(co.x);
maxX = max(co.x);

dispX = maxX-minX

for all verts
co.x = co.x - dispX

I’m assuming you mean this operator?

bpy.ops.object.origin_set(type='GEOMETRY_ORIGIN')

Every tool in blender has an Operator (bpy.ops) for it. You can find these operators by going to “Help > Operator Cheat Sheet” or by hovering over a tool. =)

Thanks. I suppose thats the motivation I need to go to 2.5.

That big Warning Unstable sticker on 2.5 doesn’t scare me a bit :wink:

If a script does not work anymore because of an API-change, very often you can find out the reason yourself and probably you can adjust it yourself.

Otherwise: ask e.g. here :smiley: