1
$\begingroup$

I am trying to split and object with a plane to determine the center of the object that is left after splitting. For the demonstration of this problem I placed Cube at (0,0,0) and added a plane to split it with. The I added a boolean difference modifier to the Cube and applied it. After that I expected that the location of the leftover object would have changed but it has stayed (0,0,0). Is there any way to make the object update its location? Ideally using bpy. I am using Blender 3.6.2.

I added an images to clear up my problem. In the first picture is the cube before adding modifier. In the second after adding. In the console you can see the location before and after adding and applying the modifier.

Thank you!

Before: Before

After: After with console

$\endgroup$
4
  • $\begingroup$ did u try bpy.ops.object.origin_set(..) ? $\endgroup$
    – Chris
    Commented Mar 8 at 15:43
  • $\begingroup$ if I do bpy.ops.object.origin_set() it centres the leftover part to the real (0,0,0) (the center of the scene coordinate system) $\endgroup$
    – jestrabikr
    Commented Mar 8 at 15:51
  • $\begingroup$ Have you tried to Apply Transformation to the object? $\endgroup$ Commented Mar 8 at 15:57
  • $\begingroup$ An object is just a vehicle (coordinate system) for its geometry. You wouldn't expect it to move when its cargo is modified.. Do you want, say, the center of gravity of the remaining mesh?... bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY', center='MEDIAN') $\endgroup$
    – Robin Betts
    Commented Mar 9 at 9:17

1 Answer 1

1
$\begingroup$

I don't know what you did, but i did what you described, and then i got a new location:

enter image description here

so of course

bpy.ops.object.origin_set(type = "ORIGIN_GEOMETRY")

works.

Please provide your blend file, if yours doesn't work. The boolean can be applied already.

$\endgroup$
1
  • 1
    $\begingroup$ Thank you. The type="ORIGIN_GEOMETRY" worked. I was using GEOMETRY_ORIGIN. $\endgroup$
    – jestrabikr
    Commented Mar 8 at 16:50

You must log in to answer this question.

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