Hi, I am aligning geometries along frames for a sunglasses class project, but they flip inside out. I am still learning components and I don’t really understand planes. I am absolutely stumped
PlanesForum.gh (1.5 MB)
Hi, I am aligning geometries along frames for a sunglasses class project, but they flip inside out. I am still learning components and I don’t really understand planes. I am absolutely stumped
PlanesForum.gh (1.5 MB)
That’s fine, but:
Same reaction after opening your file and not knowing what to look for after 5 seconds, so I closed it ![]()
Only upload the problematic area with internalized data or at the very least provide a screenshot of the part/area of the script you need help with.
My bad, I assumed that would be clear with the yellow color coding
It is all internalized, here are the screenshots and I labeled which part of my script these correspond to
PlanesForum.gh (1.5 MB)
The issue is that the Perp Frames component does not always produce planes aligned as expected, because it often lacks sufficient reference information to determine a consistent orientation.
Since you have two reference surfaces — “Lens front surface” and “Lens back srf” — you can use them to guide the alignment. For planes whose origins do not lie on these surfaces, you can project their origins onto the appropriate surface.
From each plane origin to its projected point, you can construct a vector. This vector can then be compared with the plane’s x-axis using the dot product to determine whether the plane is correctly oriented:
Based on this, you can identify which planes need to be flipped.
A plane in 3D space is defined by an origin point and two orthogonal axes (x and y). From these, a normal (z-axis) can be computed using the cross product. This structure allows the plane to serve as a reference for constructing and orienting geometry.
PlanesForum-rev.gh (1.5 MB)
Wow that dot product totally fixed my lens planes. What would you do for the SUBD frames? I think the frames are flipping okay but the dispatch is destroying my data structure for lofting the geometries to the right plane?
PlanesForum-rev2.gh (1.5 MB)
It’s essentially the same issue as above — the curves and their corresponding frames are not consistently oriented from one to the next. Since there isn’t any reliable reference geometry to align them against, I used a slightly different approach here.
The idea is to move each plane’s origin a small distance along its local X-axis, then test whether that shifted point lies inside the corresponding curve. If the point falls outside, the plane should be flipped.
I also made a small adjustment here:
In your version, each curve generates the same number of frames, which works fine.
However, I think it’s a bit more elegant to relate the number of frames to the curve length — shorter curves get fewer frames, longer ones get more.
An even more refined approach would be to distribute frames based on curvature, but that’s significantly more involved.
With these changes, everything should now be consistently oriented for your lofting strategy.
That said, there are still some geometric limitations, for example:
In this case, the curvature is simply too high relative to the profile size. This isn’t something that can be fixed by adding more frames — it’s more of a design constraint. I’ll leave it to you to decide how to address it.
Sorry, totally forgot to post the revised file.
Here it is:
PlanesForum-rev3.gh (1.5 MB)
Thank you so much for explaining this! I edited my model to include a sag curve and was ready to print it, but as you saw, my lofted geometries were screwed up lol. I’m rebuilding my entire model and I think I will try your second post method of again moving points on the x axis to see whether they fall inside a brep and order them. I’m excited to see these realized!
420SplitBrep.gh (655.0 KB)
Also thank you for fixing the equal frames, I’m sure that saved my computer from an explosion lol.