algorithmic modeling for Rhino
What im wondering is;
Let's say that i have a circle, and i want to divide it in segments of even numbers.
Ex: A circle of 8 sections
Now, what i want to do, is to part the circle, so that the sections have 2 different lengths.
Ex: 0, 2, 4 and 6 gets one length, while section 1, 3, 5 and 7 gets another
Anyone here that has a good solution for this?
Sincerely,
Brage
Tags:
Thanks Alex!
This works really great!
But since I'm still a bit new to GH and how it works, would you mind explaining how the GH-file works from the beginning until the "Shatter" component? (The part with the circle isn't important though)
Especially the the "X variable" and the box with the "if" rule puzzles me a bit :)
Great thanks,
Brage
Hello Brage,
we have a circle with variable radius. then we have a slider, working with even numbers only driving the division of the circle. Since the curve is reparametrized, the t values are between 0-1, hence the range component has a 0-1 domain. So the division component finds t value for an even division of the curve, according to the division slider. Dispatch component dispatches the even (for now) t values coming out the range component, with a true false pattern. The first list of values is subtracted a value coming of the other slider, in order to output t values for the smaller segments. If you subtract 0, then you have even segments. These t values are weaved, with a 0 1 pattern (same as dispatch), with the unchanged t values. The slider for the small segments is passed through the evaluation component. The expression makes sure that if the value of the slider is larger than the t(y input from the division output) value needed for even division, then use the y value. If it smaller, then use the sliders value. That way you will not provide larger subtraction than needed, which would result in evaluation t's running around the circle.
hope that helps.
best
alex
Thanks again Alex! :)
Makes a bit more sense to me now ^^
cheers,
Brage
Really nice Matt! thanks for sharing. I tried dashed line but got lazy finding out the expression needed to generate the points
actually, real lengths could be used in the previously posted definition, if one curve length component is added and then feeding the output to domain input in range, a input in division, after disabling reparameterize option in C input of the shatter component.
best
alex
Good to know, I started by making your code.. missed the link and followed the picture (doh) then trying to hack it, before I worked out how I could do it as posted.
Cheers
Matt
your solution shows how powerful expressions are, sometimes bypassing many components.!
There are some clever, problem-specific solutions here, but I can't help noticing that this question is basically the same as the one in the 'Maths + Divide Curve' thread.
So I plugged in this sequence: 2,4,2,4,2,4,2,4
And low and behold, discovered an off-by-one error in the previous code! An unnecessary 'Shift' that resulted in one fewer segments than expected. Don't know how I missed this...
There is no extra code here to highlight and dimension the segments. Using a sequence of numbers to drive the split is quite powerful, allowing many different combinations of segment lengths.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by