0
$\begingroup$

I have many objects with misaligned origin and different Z scale. My origin of each object is located on Z = 0m coordinate. Is there way how to move origin to the center of the object while keeping Z location on 0m?

There is no vertex or polygon in the middle.

Adding new picture for better explanatory, hope it help

enter image description here

thanks

$\endgroup$
3
  • $\begingroup$ Do they have a different Z scale as you wrote or a different Z location? And do you want the origin in the center (X, Y and Z) of the geometry or just move the geometry on the Z? $\endgroup$ Feb 8 at 10:16
  • $\begingroup$ i don't understand the question. even the picture doesn't clearly illustrate the problem. voting to close as this is not clear. $\endgroup$ Feb 8 at 14:11
  • $\begingroup$ Last question: origin XY-centered to the complete object or the bottom faces? $\endgroup$ Feb 8 at 15:35

4 Answers 4

2
$\begingroup$

I don't know python so am not sure if you could write code to go through all your objects and do the following, but: This is your original position enter image description here

Go into Edit mode then Shift-S > Cursor to Selected to move the cursor to the centre of the object enter image description here

Back in Object mode, bring up the N panel and on the View tab, set the 3D Cursor Z Location to 0 (zero). enter image description here

Then Object > Set Origin > Origin to 3D Cursor should give the result you want: enter image description here

$\endgroup$
9
  • $\begingroup$ problem is that mine object is not centroid $\endgroup$
    – barberik
    Feb 8 at 17:13
  • 1
    $\begingroup$ That's why we needed more details in the question! $\endgroup$
    – John Eason
    Feb 8 at 17:28
  • $\begingroup$ I have add new image to the question. $\endgroup$
    – barberik
    Feb 8 at 17:46
  • $\begingroup$ What do you mean by 'my object is not centroid'? If you mean that it's not a cube, my solution should work on any object because it snaps the cursor to the centre of the geometry of the object. $\endgroup$
    – John Eason
    Feb 8 at 17:51
  • $\begingroup$ center of my object is not on the center of the axis, that's why i don't know where to send cursor $\endgroup$
    – barberik
    Feb 8 at 18:02
0
$\begingroup$

To have the origin at the center of a mesh's geometry while keeping the origin in its location, you can right-click on the selected object(s) in Object Mode to bring up the Object Context Menu and choose Set Origin > Geometry to Origin.

Before:

before setting the origin

After:

after geometry to origin

$\endgroup$
9
  • $\begingroup$ Thanks for answer, my problem is id like to keep one axis not moved. I have add images into question. $\endgroup$
    – barberik
    Feb 8 at 10:31
  • $\begingroup$ In that case, just choose 'Set Origin to Geometry'. That will move the origin without touching the location of the object. $\endgroup$
    – John Eason
    Feb 8 at 11:45
  • $\begingroup$ But it will change the local Z of the origin, which they do not want $\endgroup$
    – Gorgious
    Feb 8 at 11:59
  • $\begingroup$ Ah ok. How about setting the 3D cursor to the centre of the object (Shift-S > Cursor to Selected), setting the 3d Cursor Z location to zero in the N panel and then Object >Set Origin to 3D cursor? $\endgroup$
    – John Eason
    Feb 8 at 12:30
  • 1
    $\begingroup$ I think we still need more details on exactly what the OP is trying to achieve before suggesting anything further, but yes, you would have to switch in and out of Edit mode for my suggestion which would be very time consuming for lots of objects. $\endgroup$
    – John Eason
    Feb 8 at 13:59
0
$\begingroup$

Fast and easy:

In sidebar/tool/affect only, enable both "origins" and "locations".

Plop a cursor down on the bottom of your mesh. Set pivot point to cursor. Set orientation to local.

Scale to 0 in Z axis. (Or whatever axis you want.)

enter image description here

Shown before and after. Don't forget to change your "affect only" options back before you start doing other stuff. Or, keep it on and repeat the operation for more objects; it's just a mouse click to plop a cursor and a single scale operation for each.

$\endgroup$
2
  • $\begingroup$ hi, i don't understand what should do "Set orientation to local. Scale to 0 in Z axis. " And also how to keep cursor in the middle of the XY object. If I stich cursor to the bottom polygon it stick wherever I click $\endgroup$
    – barberik
    Feb 10 at 9:28
  • $\begingroup$ @barberik Orientation and pivot point are choices made in the top middle of your 3D viewport. To scale a selection to 0 in Z, type 's z 0' but not spaces and hit enter. And it doesn't matter where the cursor is in relationship to the local XY of the object, because you're only scaling to 0 in Z: you are keeping the existing origin of the object, but placing it on the bottom margin of your object, as determined by your placement of cursor. $\endgroup$
    – Nathan
    Feb 10 at 15:50
0
$\begingroup$

Since I have lot of objects I made some python shortcut based on John's answer

import bpy

bpy.ops.object.editmode_toggle()
bpy.ops.mesh.select_all(action='SELECT')


for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        ctx = bpy.context.copy()
        ctx['area'] = area
        ctx['region'] = area.regions[-1]
        bpy.ops.view3d.view_selected(ctx)
        bpy.ops.view3d.snap_cursor_to_selected(ctx)

bpy.context.scene.cursor.location[2] = 0
bpy.ops.object.editmode_toggle()
bpy.ops.object.origin_set(type='ORIGIN_CURSOR', center='MEDIAN')

bpy.context.object.location[0] = 0
bpy.context.object.location[1] = 0

edit: This process put origin to the center of object based on geometry weight not into bounding box center. enter image description here

$\endgroup$
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .