When I import a stl object it arrived like this (front view):

enter image description here

I have to manually rotate it until I have the two lower points of my object at the same level on the Z axis(that's what the black line is supposed to show). Here is the result after the first rotation, in the front view: enter image description here

The same rotation seen in the right view: enter image description here

Then I rotate it in the right view until the two extemum points of the object are at the same level on the Z axis:

enter image description here

Finally, I translate the object on the Z axis until every vertex of the object are above the XY plan : enter image description here

My question : How to do that with a python script ?

I thought about the least square method to correctly rotate the object but I don't know if it is the easiest way !

update That's what I obtain with the Bounding box :

enter image description here

update here's what I get with the convex hull : front view: enter image description here right view: enter image description here

  • 1
    $\begingroup$ Simplest way would be to use the dimensions of the object's bounding box. See this answer: blender.stackexchange.com/questions/5371/… $\endgroup$
    – p2or
    Mar 24, 2015 at 13:17
  • $\begingroup$ I just try and it didn't work ! The box created doesn't contain all the object (some parts of the object are out of the box) furthermore the object have no rotation (0°,0°,0°), so the box is not inclined. $\endgroup$
    – reflyon
    Mar 24, 2015 at 13:41
  • $\begingroup$ Could you share your code with us? $\endgroup$
    – p2or
    Mar 24, 2015 at 13:42
  • $\begingroup$ @poor the bounding box will not have the right orientation, blender doesn't have minimum BBOX ,best choice would be the convex hull $\endgroup$
    – Chebhou
    Mar 24, 2015 at 13:44
  • $\begingroup$ I didn't use a python script to create the box. Is it possible to send a printscreen in a comment ? $\endgroup$
    – reflyon
    Mar 24, 2015 at 13:45


You must log in to answer this question.

Browse other questions tagged .