Scaling _actual geometry_ of an object

I’ve written some export scripts [blend2java.sf.net] but what I want to do, is scale the geometry of the object so it will fit in a 1x1x1 box. (So all my exported models will be a consistent size)

I can do this two ways; scale the geometry, and then export; or have the script calculate the figures correctly from within. (The latter is the more elegant solution, because it leaves the model unchanged)

For the first solution; the object would need to be scaled in edit mode (because that effects the geometry) wheras scaling not in edit mode doesn’t impact the stored geometry (that is accessed by the scripts)
Is there a simple way of doing this.

The latter could parse the coordinates, collecting the highest and lowest xyz values. Find the biggest gap between the three, then divide one by that number, before multiplying every xyz value by that result.

That’s how I was thinking of doing it, but if there’s a simpler way, let me know

J.

No, there is not.

Your solution is correct.

Stefano