algorithmic modeling for Rhino
Hi All,
Tags:
Hi Joseph,
Thank you for your response.
Attached are two images and my script that better explain what I am trying to do.
The end goal is to divide each of the 3 curves with lengths 60, 108 and 168 (shown in the image) into lengths that are some combination of the numbers 24,36,48 and 60.
I have also generated a randomized list of the number set 24,36,48 and 60 from which to select these combinations. The issues I'm currently having are:
1. The number of random values that the random component is currently selecting from the list is based on each curve length divided by 24. My logic was that dividing each curve length with the smallest number in the set of 24,36, 48 and 60 would give the minimum amount of numbers I have to select randomly. However because the set also has 36,48 and 60, The script very quickly overshoots the curve length. So I am not sure what logic to use to set how many random numbers from the list I should pick for each curve.
2. I need to make this recursive because, currently the seed value for the random selection will remain the same and so I will get the same combination for every length.
The 3 curves shown are just an example. I have 100's of curves that I need to do this to.
My script is attached as well. Hope this helps clarify my query.
Thanks,
Tandon
Posting your code will drastically improve your chances of getting help!
I'm not sure I'll be spending any time digging into this but without looking at your code (yet), I'll say this much:
So you want to generate random numbers until their sum ('Mass Addition') plus 5 is equal to or greater than the curve length (5, 9 or 14). The last number in the series is then not random but just the difference between the two.
For example, for curve length = 5 (x12=60), there are only three possible numbers that can be used as the first in the sequence: 2, 3 or 5. If it's 5, you're done. If it's 2, the second number is 3 (5-2), if it's 3, the second number is 2 (5 - 3). You can't use '4' at all because the remainder, 1 (x12=12) isn't one of your solution options.
There is no point in generating the last number randomly, eh?
P.S. You didn't use 'Internalize data' for the 'Curve (Crv)' param in your GH file.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2023 Created by Scott Davidson. Powered by