Hello, I’ve been trying to research and learn how to use the random number function to assign the panels i have a number between 0-4 so that i can group them by the number and offset these randomly assigned panels by 6 inches so that they are not all on the same plane but i am having trouble executing this. Can anyone help and explain how/ why you do it however you do so that i can learn better from it! Thank you! i reduced the number of panels in the sliders just so it makes it easier to run but im attaching a second screenshot of how it is supposed to look without being reduced.
submitted it before adding the rest my b9.19 arc bark facade.gh (41.4 KB) 9.19 arc bark facade.3dm (149.4 KB)
this is an older picture before i fixed it so the panels are on the outside of the arcs on all parts but you get the idea.
You can use a Sift Pattern for this. Note that it will include Nulls, so use the Clean Tree component after this if you need to remove them (for some applications it is useful to keep them).
Here is an example just with some squares:
Use the Round component with the floor output, just to make sure each panel gets a fair chance of being selected.
I see what you were saying about it including nulls. all of the points were grouped together on the bottom string of the sift pattern. I’m not familiar with the clean tree component and couldn’t find much information on how to use it/ have much luck when i tried it out. Could you please explain it to me if you don’t mind?
Sure, in its simplest form, stick the list of things you want cleaning in the T parameter at the bottom and you’ll get out a revised a list of things without nulls.
Btw, not that anyone is bothered but it’s my favourite component (I’m kind of sad) because the main input is at the bottom and not the top.
Should i make one for each list? Thank you for being so helpful!
Yep. There’s only 4 groups so it shouldn’t be overly troublesome. Maybe there’s a different way but off the top of my head sift and clean is the way to go.
You can also weave them into a tree with 4 branches, but that seems overly complicated for the task here.
I may have messed up before doing the sift pattern, On the bottom string of the sift pattern all 183 values are in that. After using the clean tree on all the null lists in the others they too inherited all 183 values so it must not have split them or I would be expecting four lists that containing 25% of the values. At least i believe this is how it would be done.
Cleaning is a per-parameter option in grasshopper 2.0, so you won’t need an additional component at all anymore in the future.
Sounds good @DavidRutten, I do feel bad for the Clean Tree component though, left unwanted and discarded!
@trevoro.design if you did want them as separate lists, you can just entwine the sift results and clean that (with one component instead of 4). Entirely up to you and what you’re comfortable with.
I don’t quite understand your reason for wanting to group them by random number? Do you want each group to have a different offset (thickness)? What does “not all on the same plane” mean?
9.19 arc bark facade_2020Sep19a.gh (45.8 KB)
You had offset surfaces connected to the ‘N’ input of Random which makes no sense to me?
Yes that was what i was attempting to do i see i didn’t explain it well and plane is a misleading word when talking about grasshopper… My reasoning for random number was so that each of the four groups that each have their own offset thickness would be randomly assigned to the panels. About your second comment i believe it might not make sense because of the way I’ve been trouble shooting through the problems one after another, maybe the methodology isn’t the best way to do it. I’m still learning more efficient ways to do things, should this part of the code be connected at an earlier point?
Using a domain of ‘0 To 4’ gives you five groups, not four… It’s an integer slider so you can easily change it, though I have defined a maximum of five colors/branches.
9.19 arc bark facade_2020Sep19b.gh (46.2 KB)
I was actually as confused as @Joseph_Oster about your intentions. Now you say there are 4 numbers @trevoro.design, I guess you need something like this. Sorry Joseph, you might have a better way than me but just getting closure in my own head!:
(might need some lofts in there!)
Not if you floor the number though.
I checked ‘Integer Numbers’ on the Random component (right-click option). And used a domain and Range for thickness.
By the way @trevoro.design, you are using only two curves from the Rhino file so you could internalize them in the GH file and not need the Rhino file.
Interesting, never knew that was there! Well, yes then it would give 5 groups if you did that
ok sweet ill take a look into how to do that thanks for tips as well as all the help, thank u too @johnharding i appreciate how helpful this forum is.
Here is another way where you can have as many groups as you want. Sift is replaced by the white group (using MIndex, no need for Clean Tree) and the fixed list of colors is replaced by the yellow group (random ‘color by branch’).
9.19 arc bark facade_2020Sep19c.gh (52.7 KB)
Base curves are internalized, no need for Rhino file.
I tried to get the ‘groups’ slider to match the actual number of groups instead of being off-by-one but the Range component blocked my way.