How to match object's bounds to UV bounds?

So let me (try to) explain…
I want to write a script that will read the object’s UVs (simple object like a plane), and update the object’s size to match the aspect ration of its UVs.

Let’s say you create a Plane, and try to match its size to the correct aspect ratio for the graphic you want to UVMap onto it, it’s hard to eye-ball it. The best way is to create a plane that matches the aspect ratio of your texture sheet, UVMap it 1 to 1, add segments then select and detach the area of the texture sheet you need.

But let’s pretend we’re not doing that…how would I match the object’s vertices to the UVMap verts, is it even possible?

Thanks,
Stephane

with a simple plane that is square, it is fairly easy, just get the bounding box of the UVs in UV space and find the length/width ratio.
then apply this ratio to the plane’s scale on the X, Y, or Z axis.
You’ll have to map the U or V axis in UV space to an axis in the world, you can use an edge on the UV shell border to establish this relationship.

[QUOTE=rgkovach123;24823]with a simple plane that is square, it is fairly easy, just get the bounding box of the UVs in UV space and find the length/width ratio.
then apply this ratio to the plane’s scale on the X, Y, or Z axis.
You’ll have to map the U or V axis in UV space to an axis in the world, you can use an edge on the UV shell border to establish this relationship.[/QUOTE]

Yes it would only be for simple planes with only 1 face.

I’m a little confused about your last line: “You’ll have to map the U or V axis in UV space to an axis in the world…”
What do you mean exactly? Would you mind explaining what this will do, or why it is needed?

Thanks!
Stephane

since your object exists in 3d space and UVs are in 2d space, you need to establish which axis you will be scaling your object. if you know your objects always face the +z axis, then it helps, just need to determine if you need to scale up on axis, or scale down on the other. depends on which dimension should remains stable.