Changing the vertex numbering before using LOFT

I want to merge panels and rectangles through loft. Some merge well and some merge with distortion. This happens because the rectangles are rotated. Since the position of their vertices changes, accordingly loft tries to join vertices with the same sequence number, by default. The numbering of the vertices of each panel is counterclockwise starting from 0 and up to 3. Rectangles have the same numbering. I use the Nearest Points component to make the nearest vertices have the same sequence number 0, 1, 2 or 3 respectively. Provided that the orientation of the panels remains unchanged, and rotation occurs only for rectangles. But for some reason the nearest points are not found correctly, respectively indexed incorrectly and the order can take the following form 0-1-3-2, which does not allow you to create a rectangle (while keeping the new vertex indexes).
I attached the file.
lines_sorted_mrtn.gh (222.2 KB)

Instead of sorting points you can use Loft Options to align the seams of the curves you’re lofting.

Right-click on the Options input of the Loft component.

In the dialog box, check the option Align sections
loft2

As another option, you can use the Loft Options component with its Adjust input set to True

Here’s one of your objects with Adjust set to false (the default when you drop a Loft component on the canvas)

-Kevin

1 Like

Yeah, what @kev.r said about Loft options ‘Align sections’. These things can be fixed “manually” by adjust seams and flipping section curves if you must, but ‘Align sections’ usually does the trick.

lines_sorted_mrtn_2023Sep30a2

As for lofting all at once, some grafting and data tree matching is still required.


lines_sorted_mrtn_2023Sep30a.gh (225.9 KB)

I did not dig deep into your code but noticed that it was laboring at something… I removed unnecessary components near the end, does that help? Seems to me that it did.

P.S. “Pro tip” - Until you are sure your code works as intended, use WAY LESS geometry! There are 1,116 lofts in this result, which can be very slow or worse, freeze GH if/when you do the wrong thing with grafting. Start small, increase the piece count later.

3 Likes

@kev.r Thanks for your feedback, that works pretty fine!

@Joseph_Oster , I really appreciate your participation. I didn’t expect such an attentive and responsive community here. Fortunately, it turned out to be just that)
You are right, the two Deconstruct Brep did burden the miscalculation, your solution is more elegant and is calculated by the system more easily.

Data trees must make sense :exclamation:

Text panels are excellent for examining them before they are connected to downstream components. That’s why I use Merge first, to see what downstream components will “see” when multiple wires are connected to them. Good GH code is not as simple as wiring components willy-nilly. Flatten is very rarely a good idea.

3 Likes

@Joseph_Oster yes, I use panels, not enough experience yet to always organize the data structure correctly.

An alternative to the implicit ‘Align sections’ feature of Loft options, the yellow group below explicitly aligns the seam of the small rectangle to its Discontinuity point (corner) that is closest to the start point of the bottom square. I didn’t bother with Flip Curve in this case, using one of each pair as a guide to flip the other, because they all appear to have the same direction.


lines_sorted_mrtn_2023Oct1a.gh (231.4 KB)

Compared to the ‘Align sections’ feature of Loft options: (below - see the difference?)

@Joseph_Oster Yes, of course, in this case we get rid of the extra lines and connect directly the vertices of the rectangles. It works much better for my project, thank you.