Grasshopper

algorithmic modeling for Rhino

I have a list list that contains values of points in space that correspond to to other referenced objects. They are all flat on the X,Y plane with a Z value of 0. By moving them vertical they control the corresponding grasshopper component by the distance moved.

This yields me a list of 0.0s and values (if a point has been moved) I need to split the list in two parts with >= 0 being the the characteristic that splits the list. I have tried with gate and split list. I have also tried so VB code, but with no luck.

If x <=0 then
A=x
Else
B=x
End If

Gives me, two lists which are the same length as the original with in place of values that Were filtered by the IF statement. I need the return to be of just the values.

In other words if I have a list length of ten, nine of which are 0.0 and one that is 2.0, I need a list of nine and a list of one.

I can not use the split list by integer function because the values that needs to be split out of the list of 0.0s is not always in the same position in the list.

Any help would be greatly appreciated.

Views: 4083

Replies to This Discussion

Not sure about the syntax in VB, but I guess that what you need is another if so it only adds the object i question to the right output array.

If x <=0 then
A=x
Else if x > 0 then
B=x
End If
Try this:

Decompose your points to find the Z co-ordinate and plug this into an Equals Component to generate a True/False List. Then Cull the original List with this Pattern and do the same but through a Not gate to get the other part of the list.
Like this:

This worked beautifully with one small change.
I dropped the NOT GATE, and connected directly from the EQUALS '>=' output to the input on bottom cull.

Thank you, you have made my day. ;)
Hi Danny, will the not gate have any particular differences to right clicking on the Cull Component and inverting it?
When I tried the example he provided above, I had to use the invert button to get the result I wanted with the NOT connected. Then I realized I did not need the NOT at all, by connecting directly to the >= output.
Hi Theunis, I don't think there is any difference, apart from visually. At first glance you can see which is which. much in the same way you don't need to have the panel with the 0 but it helps to see what the definition is doing with out hovering over some inputs.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service