Unifying Bbox orientation

I have a reoccurring task, where I need to orient parts from one plane to another consistently for fabrication. Usually these wooden parts, so parallelly flat on at least two sides. The part outline shapes can be anything.

Because the part outline shape can be anything, defining a grain-directioned bounding box method varies from case to case. Most often it is aligned with the longest side, and I can easily find the side that will drive the orientation for fabrication.

So, finding the “minimal” bounding box is not the challenge here, but the inconsistent plane orientation of the box. So basically, I can have 6 different orientation for the same box, and only 1 would perfectly suit my needs. The starting point needs to be the bbox, because the method for its generation can be pretty much anything - so the bbox itself is a good and consistend starting point on all kinds of geometries.

So my question is, as the bbox as the starting point, how would you go about in unifying the bbox directionality?
Unification in this context means that, eg. box points A-D produce the part “bottom srf”, the exploded sides are always in the “same” order (what ever that means in varying orientations).

Here’s a simple test with a couple of different geometries, to show the different orientations of the otherwise correct bboxes.

Simplified bbox generation for meshes and breps.

Unified Bbox orientation.3dm (274.6 KB)
Unified Bbox orientation.gh (21.9 KB)

This would be a good end result.

Hi @Toni_Osterlund ,

How about this?

Graph Space:

Model Space:

20230913_Unified Bbox orientation_Response_01a.gh (74.1 KB)

Hi @michaelvollrath
Thank you! I like the approach…

The Fit line to get the “Dominant Center Line” and the per face directionalities is a clever method. It gives a lot of info on the part.

Sort by Z works here to some degree, but I could expand on the sorting method to take the part dimensions into account.

I managed to get a bit more consistent results with this:
Getting 2 of the smallest longest faces, and against Z Dot product find the one pointing downwards.
This gives me consistent orientation and I can create a plane where the Z is lengthwise.


20230913_Unified Bbox orientation_Response_01b.gh (79.0 KB)

1 Like

I managed to optimise the solution a bit (50%) by reducing geometry methods. The Deconstruct brep takes almost all computing time. This whole thing could easily be written as a small piece of code…


20230913_Unified Bbox orientation_Response_01c.gh (81.0 KB)

1 Like

Still added a small modification to get a bit more consistent results on vertically oriented parts.

kuva
20230913_Unified Bbox orientation_Response_01d.gh (146.5 KB)

1 Like