1
$\begingroup$

How can I set the origin to the end of a mesh before adding it?

For the moment I'm struggling with the overhead of calculating the center of each object's appropriate axis in order to get it properly located e.g. [{'coordinates': [100/2, 0, 0]}]. It would be much more understandable if I could just set the origin to e.g. Axis "X" and leave the coordinates as is.

import bpy
input_mwe = [{'coordinates': [0, 0, 0], 'scale': [100, 18, 18]}]

def create():
    for room in input_mwe:
        bpy.ops.mesh.primitive_cube_add(size=1, location=room["coordinates"], scale=room["scale"])

create()

pic

What I want: enter image description here

A somehow similar problem is discussed here

$\endgroup$
2
  • 1
    $\begingroup$ I think it can't. You may consider changing the origin of the object after adding it. or use bmesh to create object $\endgroup$
    – X Y
    Commented Jun 26, 2022 at 11:25
  • 1
    $\begingroup$ Yeah bmesh would probably be the way to do it. Don't use object.primitive_cube_add operator and just do like `bpy.data.objects.new() and then add the actual vertices via bmesh. $\endgroup$
    – Jakemoyo
    Commented Jun 27, 2022 at 2:17

0

You must log in to answer this question.

Browse other questions tagged .