algorithmic modeling for Rhino
Hello,
i want to generate sequence of numbers as following
X/30 (1st and last divided length of curve)
X/10 (repeated 6 times and alternate)
X/15 (repeated 5 times and alternate)
X/10
X/15
X/10
X/15
X/10
X/15
X/10
X/15
X/10
X/30
X = length of a curve. When added these will add upto length of curve too.
Then divide curve with these numbers.
Can can any-1 help out with generating number sequence to begin with?
Regards,
AB
Tags:
I think there might be a subtle error in your description of the problem...?
When I look at your sequence, I see it this way: 1,3,2,3,2,3,2,3,2,3,2,3,2,1 (1/30, 3/30ths, 2/30ths, etc.)
But those add up to 32, not 30. I didn't see anything about the pattern that inspired me to generate the sequence parameterically, so I moved on to dividing the curve.
This works with any sequence of numbers as inputs - integers or floating points.
Hello Joseph,
Very kind of you to reply :-). Probably i did not describe my problem properly.
X = total length of original curve. Say for instance X = 1200mm
X/30 = 40mm is repeated 2 times i.e. at the start & end
X/10 = 120mm is repeated 6 times (but alternates with X/15)
X/15 = 80mm is repeated 5 times (alternates with X/10)
So if you add (2x40) + (6x120) + (5x80) = 1200mm this should hold true for any integer.
The way i have tried to resolve is
weave repeat data X/10 6 times, X/10 5 times and weave the data. then insert X/30 as item 0. Then shatter the curve.
However, i was wondering if there was a formula and more straightforward way to handle it :-D
OK, silly me. I included an extra "2" in my sequence. Change the panel to this:
1,3,2,3,2,3,2,3,2,3,2,3,1
At first, I did the same thing you did using 'Repeat Data', but I didn't see the point of going to the trouble since it wasn't easily adaptable to other patterns. Hence my choice of the panel with a sequence of numbers that represent ratios of the line segments to each other.
As usual, Pieter's solution (below) is incredibly elegant and to the point!
N.B.: the parameter on the curve domain is not the same as (or directly comparable to) the distance along the curve. You'll need the EvaluateLength component to find the correct parameters.
Do a search for curve parameter length and you'll find dozens of discussions, some of which with a clear explanation.
Haha - you're joking, right?
It stands for 'nota bene', which is Latin for 'note well'.
So I didn't call you a newbie, grasshopper. ;)
Joseph & Pieter thanks for your inputs.
This is a wonderful community and very helpful members.
Pieter, i have used repeat data > weave > insert > shatter
but your definitions is 1 step less and relatively more refined.
Thanks for that.
AB
I tried applying this solution in another thread (How to divide a circle in segments of 2 different lengths) and 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...
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