i’ve got a lot of bounding box to sort by thickness,
i have 3 thickness 3, 2 and 1, i want to orient it with the thickness on Z axis, then the longuer dimension on Y axis, and The last dimension on X axis…
i tried a lot of solution,
i append a list with the 3 dimensions, an another list with the vector
then i search for the 3,2 or 1 thickness
so i find the thickness index,
so the thickness vector too,
but it,s for finding the orientation of the longer dimension,
I need to create a 3 axes reference on my bounding box, but i don’t find the way to do it…
Hmm, not sure I understand exactly what you need…
One way to think of a bounding box is that it is a collection of 8 corner points. They are always in the same order.
A vector from pt0 to pt1 is the box’s “X” direction, it’s magnitude is the “X” length
A vector from pt0 to pt3 is the box’s “Y” direction, it’s magnitude is the “Y” width
A vector from pt0 to pt4 is the box’s “Z” direction, it’s magnitude is the “Z” height
So it seems you would like to get the plane of each box which is formed by the longest axis direction (choice between between X and Y) and the box’s Z axis, then create a rotation transformation between that plane and the world YZ plane and transform the box…
rs.PlaneFromPoints(pt0, pt1 or pt3 - whichever is the longest distance from pt0, pt4) might help for the getting the ‘from’ plane
In fact the thickness is not between the same corner…
Sometimes the thickness, is between pt0 and pt4 but it can be between pt0 and pt1 or it can be between pt0 and pt3… This point is easy to find…
Once we’ve got this I search the longest of the 2 dimensions rest… Easy!!!
But for exemple:
Pt0->Pt4 is the thickness so the z axe
if distance(pt0, pt1)>distance (pt0,pt3)
Then pt0->pt1 is the y axe
And pt0->pt3 is the X axe??? The -x axe???
I think I have to test bounding box around my part with different oriention plane to test the good solution… To find 3 references points for using orientobject…
So when you are talking about thickness, you want to find the shortest axis dimension? In the end it’s really basically the same thing, find the shortest axis of the three and assume that will be the Z axis, compare the other two axes to find the longest, use that as the X axis, create a plane using the X axis (longest) and the Y axis (middle length) and then transform your stuff from that plane to the world YZ plane…
Either that or I have completely missed the point.
That it’s, but the thickness is not the shortest, the material we used for this exist only with 3 thinness.
I need to orient them next to each other on the X axe.
I’ll search tomorrow, and I’ll find!!!