# How to use a random number function to offset random panels by a few inches

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.

1 Like

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.

1 Like

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.

I wanted to fix this off-by-one problem on the group count and got carried away.

@trevoro.design, here are some details to note in this model.

• The ‘arc guides’ (orange group) are done differently, but get the same result.
• The ‘arch beams’ (gray group) now use Sweep1 instead of Loft. The single rectangular section is now placed inside the base curves and arcs so these beams no longer intersect the lofted surface and panels. Its X and Y dimensions can be set independently.
• When there is only one group, ‘offset’ (cyan group) uses a Combine component to substitute the average of the the two domain values because Range produces no output.
• The green group uses a pShift (“smart” PShift) cluster.
• I re-wrote and clustered the “Color Branches” code as ColorB. You could change that if you want gradient values that are all the same shade, such as gray scale.

Hope this isn’t too much to absorb?

This version replaces the ColorB cluster (in the green group) with ColorG that uses an internal Gradient component. Edit the cluster to change the gradient preset or modify the colors.