Difficulties in creating a box around an object with a python script

Hi,

I would like to create a box around an object with a python script. So I write the script which is in this topic :

However here’s what I get with my object :

http://www.cjoint.com/data/0Btlrmnl05T.htm

I was expecting something more like this :

http://www.cjoint.com/data/0BtojhmBpuM.htm

I don’t know how to modify the script to get what I want

Have you guys any ideas ?

you have to do some analysis to find the minimum bouning box. Lots of different clever ways to do it (google around a bit), I have a brute force method somewhere. Ill try and dig it up.

I’m sorry I haven’t been able to find that old script. I will attempt to rewrite it over the next few weeks.

You will probably have to do a bit of math to get the minimum bounding box. Search for “minimum bounding box” and “rotating calipers”. This is the type of algorithm that you will need to run.

download the zip fiel and install the addon from zip. Right now it’s a single file, but if I get more clever in the future, I may write some fancier stuff.

Useage:

  1. Select object you want to fit a bounding box to.
  2. Use Spacebar Menu to call “Min Bounding Box”
  3. Select the proper variables
  4. Wait a few seconds, it’s brute force and the two variables are multiplied in terms of iterations. SO 100 and 100 will be 10000 iterations over all the verts in the convex hull of the object. So, start with small numbers or decimate your object.

-Patrick