Grasshopper

generative modeling for Rhino

Hello again,

So I have a list of vectors that were created by using the "vector b/w 2 pts" component. Some values are null because there is no distance between the two points. In order to have the Vector list comply with an equal numbered list of Points, I need to replace the null items in the Vector list with a Zero value. Is this possible or is there another way around this? Thanks for the help

Ben

Views: 320

Reply to This

Replies to This Discussion

Not sure if this is the most efficient way but it does achieve the desired effect.
1) Identify the Null Items [Logic>List>Null Item]
2) Create a SERIES numbering 0 to n, where n is the list length
3) Dispatch both lists equally using the boolean pattern from the Null Items
4) Generate the right number of ZEROs to replace the NULLs
5) MERGE each dispatched list together so that the ZEROs are tagged on the end (similar with the indices)
6) Sort the Indices List and Synchronously sort the original Merged list
7) Simplify tree (same as original structure)


A Similar approach can be taken to find a specific value and then replace eg find 0 and replace with 0.1


NB the graft tree component is redundant since I flattened the inputs to the Merge component.
Thanks a million. Worked great

Hi Danny,

Is there a way to do this with a branched list?

Struggling to adapt it or come up with a simple alternative...

Many thanks,

Arthur

Hi Arthur,

This is how I would approach replacing Nulls now. The key change is that since 2009!!! the List Replace Component has come along.

Danny

Thanks a lot Danny, very helpful as always!

Hello from Tel Aviv :) 

RSS

Translate

Search Grasshopper

Members

Photos

  • Add Photos
  • View All

© 2012   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service