Grasshopper

algorithmic modeling for Rhino

What's the most efficient way to divide a curve by length from the midpoint out? And to make it even more fun, how would I do the same but with the segments centered?

Context: I'd like to write a definition to create panelized railings (think glass railings) along a curve. Panels are best manufactured at equal lengths, so I'd array a 1m panel, then have whatever is left over be a unique panel. There are many conditions that I might want to try:

1. Standard size from start, left-over size at end.

2. Standard size from end, left-over size at start.

3. Edge of standard size from midpoint, equal left-over size at start and end.

4. Center of standard size from midpoint, equal left-over size at start and end.

I'd like to switch between these 4 cases along with adjusting the length of the standard size panel to find the best solution.

So I could also ask if anybody knows of a preexisting solution that's already out there, too.

Any help would be greatly appreciated.

Views: 17269

Replies to This Discussion

Hey, this my help.

I tried to throw something together.  One scenario actually wont work without additional conditions.  You can only have the remainder in the center if there is an equal number of whole segments.  Otherwise, the remainder would have to be off center on one side or the other, or the remainder would have to be divided by 2 and put on either side of the center segment.

Either way, this is a sloppy example of how to divide a line so that the segments are centered, and pick from the offset left or right option.

Attachments:

To divide a curve so that you end up with straight segments of the same length you need to use the 'divide distance' component rather than 'divide length'. This will be good enough for the first two cases.

For the last two, it's a bit more complicated if you want the start and end panels to be the exact same length. I did this using the Kangaroo plugin, I don't think there's a direct geometrical way to solve this.

Attachments:

I think the best way to achieve #3 would be to [Shatter] the curve at the midpoint and [Flip] the first section so each one has its starting point at the middle.

Hello, I saw that this discussion shows a problem I am aslo having..I have a small question, I have a curve of 7m and I want to divide it by lenght of 2m, so I will have 3 segments of 2m and one segment of 1m which is gona be at the end of the the curve, in case I want to make this segment of 1m to be dispached in the 2 sides of the curve in order to have a segments of 0.5m , 2m, 2m, 2m, 0.5m and not 1m, 2m, 2m, 2m.. is ther a way to do so?

Thank you in advance

The problem with this approach is that the first and last segments won't necessarily have the same length.

It won't meet the criteria of "...equal left-over size at start and end."

Very true. In my example it was as much as 5mm difference

Would it actually matter? (Thinking out loud here)

I assume that when you build this you would start at one end of the curve and erect each panel until the other end.

What you're after is the custom size for your two end panels which would be the average of the results above. The fact that the middle point was out by 2.5 mm is neither here nor there.

With this method the difference between the first and last panel could be much larger, depending on the shape of your curve.

My example is neither the perfect solution because it also uses the curve length for something, in this case to figure out the number of segments needed. There is a possibility that you might need more.

Btw, I just realized I connected to the CurvePull force some polylines I generated rather than the referenced curves. It will stay closer to the original shape if you use the referenced curves.

In the case it was a line I think it works, I tried this with changing the distance between different divisions.. and it looks like working..

But I have another question if I wana join the end point of each segment in a crossed way like shown in the image.. the line with 2 points is giving me all possible lines between up and down

Attachments:

Like this?

If you are going to use straight lines, sure, you can also use the divide length component in this case since it's a lot faster.

yes that's what i was looking for.. thank u Vicente

Actually it worked with me, but I would like to understand how it works.. can u give me a small explainantion please?

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service