# 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 ?

• is the origin of the box at its center ? – Chebhou Mar 23 '15 at 14:53
• When I import the cone, both origins of the box and the cone are at the same position (0,0,0). – reflyon Mar 23 '15 at 15:01
• i mean at their geometry center – Chebhou Mar 23 '15 at 15:02
• No, they are not, but after playing a bit with your script I obtain what I want, thanks ! – reflyon Mar 23 '15 at 15:48

import bpy