How to position the origin of an object next to edges of another object with python First I import a cone next to a box:



The cone has a good position in the X axis but not in the Y and Z axis.

So I translate it to this position :



Ideally, I want about 1 mm between the edges of the box and the center of the cone. I was wondering how can I translate the cone to that position (which is linked to the box) with a python script ?
If both objects origins are at their centers ; set their names in the script and run it :

import bpy

cone = bpy.data.objects['Cone']
box = bpy.data.objects['Cube']

edge = box.dimensions[2]/2 + box.location[2]
cone.location[2] = edge-0.1  #assuming 1BU-&gt;1cm