Grasshopper

algorithmic modeling for Rhino

Hi all,

I have 50 points in a flattened list. I also have a 50-entry list of letters: "BSPSBTTRRBSPSA...BSTTP". I want to dispatch these points to 6 different lists based on the value (A,B,P,R,S, or T) of matching index in the text list.

1) I have input lists of numbers before using the Number component and "Set[ting] mulltiple numbers...", but what tool would I use to input a list of letters?

2) Can I use Dispatch based on an arbitrary list like this?

3) I could make 6 different Cull Patterns: "if (item) = A, true, false", "if (item) = B, true, false"... but that seems so clunky and won't scale if I add new letters into my list.

How can I make a key and use it to split my list of points?

Thanks,

Richman

Views: 3829

Replies to This Discussion

Attachments:

try this as well

Attachments:

Thanks for the help everybody! David, your script requires rewriting the list of unicode values when the number of letters changes... but that's trivially easy to do. Thanks! Peter, your script is a bit over my head, but I am using it to try and deconstruct some of the principles of advanced Grasshopper use. Thanks to you too!

Best to all,

Richman

Get the trad update that does all the work "automatically": no switch/case required etc etc. Some "minor"(?) issues "addressed"(?) as well.

best

Attachments:

David and Peter,

I have hit another stumbling block. I want to expand my script to include another dimension, i.e. to do exactly what David's script does, but at multiple Z-heights of my choosing.

Let's say I have five heights. The tree of points would then be 5 branches, with 50 items each... and I want to dispatch each branch based on the same 50-item list as before.

1) The Tree Statistics component only reads the number of branches, and cannot be pointed one layer in to read the number of items. How can I "dive one level deeper" so that in each branch, the items' indices are replaced by unicode values?

2) Is there a flipmatrix'd way to think about this: can I first dispatch the first height's points into groups as David's script already does, then move all points to five different heights, and still be able to select (five heights of) each branch-group as the Visualize portion of David's script?

Thanks again for any insight,

Richman

You mean that you want to sort the points AFTER they are collected according the ...ADSFSGS... "filtering" procedure?

If so, get this V3 attached (update of the update of the update). Added 2 more options: (a) bool enableSort and (b) int order (the last option there ... is "summative", so to speak):

Other than that:

" ... so that in each branch, the items' indices are replaced by unicode values?"

You mean that the indices should really replaced by uni values? (impossible for more than obvious reasons). Or maybe you mean getting a DataTree where uni info is present for clarification purposes? (that's very easy).

 

Attachments:

1) Tree statistics reads the number of unique branches. If you graft before you stat, as David did, you get a unique path for each element. That is 50 unique paths for your first request, 5*50 = 250 unique paths for your 5 different heights. They will need to be replaced with two-level paths according to height and letter index. That's 5*6 = 30 unique paths to 30 sub-lists. Each item has its item index within the list. The combined path+index address will be unique for all items. you will also get a unique address for each item if you just flatten the hole thing and use the item index...

2) check the attached definition

Attachments:

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