EDIT: Maybe this may not be of much use, but I’d like to give an update. I’ve actually created a new script which tends to many problems of the previous script. For example, flipping the direction of the seam. The curves have to have the same amount of control points for this to work.
loft cross sections seam adjustment 031219.gh (10.9 KB)
This is a script I wrote, where I “fix” the Loft command, which doesn’t always function as one would expect. In before, I have to warn you that this script is made with a very specific scenario in mind. It may need adjustments to suit your needs.
So, I was having trouble using the Sweep1 command. I find it very unintuitive. I have a set of cross sections with the same amount of control points that I need to “connect” in order to create the desirable 3D object. The “bridges” had to be straight lines. Instead, Rhino would create curves instead of straight lines. So, I then tried using the Loft command.
The thing is, the Loft command works. It really does; but you have to create the lines in a way the program will understand what you want to create. I won’t get very technical (mostly because I’m not that knowledgeable), but when you loft cross sections (with the same number of control points), I believe there is something like an order in which the vertices of each curve are “listed”. This means that the loft command will connect the first vertex of one curve with the first vertex of the next curve and so on.
This creates one problem commonly found among users. The “Loft Twist” effect, where the listing of the vertices are misaligned (to our perception, that is; maybe you’d want to create a bolt, I guess the twist effect would work for that case).
A way to avoid the Loft Twist effect, I can think of two common solutions:
- Copy one cross section to create its next one. Move the vertices to the desired spots. (The vertices lists remain aligned).
- Create each curve from scratch, but design them in the same fashion. Have a rule for the starting point and the ending point. Let’s say the sections are rectangles (like in my example). Supposing you were using the Sweep1 command, you could place all the starting points on the hypothetical rail and place the last point on the “height direction”. This keeps the vertices lists aligned.
What if you have created the sections, but the lists are misaligned?.. You’d have to play around with flipping normals or just redraw the curves in a orderly fashion. Which is a real pain, considering you already have the curves. So, I came up with a solution for my case, which I’d like to share with you. I’m no grasshopper genius, so I think there may be much more optimized solutions. And maybe a lot of you have already dealt with this matter.
Curve, Merge, Explode, Join Curves, List Length, Panel, Gene Pool, Evaluate Curve, Seam, Point, Loft, Loft Options
I also use: Flatten, Reparameterize
First, I link each curve to a separate component. I can them merge them in any order I like, so that I can control the flow of the loft. I then want to align the lists. So, I need to change the starting point of each curve individually. So, I have to specify in which parameter this event happens. I never really understood how parameters work, so I reparameterize each curve to work with values between 0 and 1. But simply reparameterizing a rectangle doesn’t help much, because a parameter of 0.25 doesn’t correspond to the next to first control point necessarily. It has something to do with the length of the curve.
So, I explode each curve, reparameterize each segment and rejoin them to recreate the original curve. But this way, a parameter of [0, 3]ΕΝ gives a control point. Don’t ask why.
Using a Gene Tool rather than a Number Slider, I adjust each curve’s starting point. I use an Evaluate Curve component to feed a Point component to actually visualize the starting points. I feed the Seam component with the Joined Curves flattened and with the Gene Pool. Tip: The Gene Pool’s gene count should match the List Length value.
I then simply use the curves of the seam component to make the loft. You may need to use Loft Options. In my case, Type: 3 makes the segments straight.
That’s it! Hope it may be of use. I’d appreciate some feedback. Thank you all.
loft cross sections seam adjustment.gh (14.4 KB)