Grasshopper

algorithmic modeling for Rhino

culling, shifting, and other list manipulations on super branches...

ok, clearly I don't know how to describe the various levels of branch hierarchy. What I'm looking to do is operate on a list{A} of lists{#;B} and treat all A's the same way - so that I might shift the branches in each A's list of B's, or remove its ends etc

so that if I want to remove the last B in every A
{0;1},{0;2},{0;3},{0;4},{0;5},{0;6}
{1;1},{1;2},{1;3},{1;4}
{2;1},{2;2},{2;3},{2;4},{2;5}

would become

{0;1},{0;2},{0;3},{0;4},{0;5}
{1;1},{1;2},{1;3}
{2;1},{2;2},{2;3},{2;4}

I guess the question is do I need to figure out the cull pattern- each B may have different lengths...

Views: 1503

Replies to This Discussion

I discovered that there are several ways to deal with datatrees, or several combintaions of components that might achieve same results. In your case, you could try split component and for index you set the lenght of the list (a list of integers) minus one (maybe some grafting needed). Another way, maybe a proper one, would be to cull last indexes (also list lenght) and sure therese some basic tree operations involved (grafting or path mapping)

If its not clear enough I'll do a fast definition for you...

PeP
sure Pep. I could use the help. Don't forget that each B arm has different number of branches on it
try the definition attached, what I do is flatten a part of the list, cull the last indexes and later you can rebuild the list structure... there might be much better solutions, but I have no time now.
Attachments:
unless I'm missing something you seem to be culling the last item in ever list, not the last branch in every list of branches.

can anyone help on this?
Super branches... nice term.

Peps suggestion didn't work? I'll see if I can drum something up.

I have an idea, but it's not pretty.
thanks taz...i am drowning in lists of lists of...

perhaps a file might be in order to give you a sense of what I'm trying to do...let me know if you need more concrete examples. I should also say that the stregy i took so far was to try and get the strings of the last branch in each list of brancges and I did this by remapping the tree so that eavh "super branch" occupies a single branch, and all its children branches would be its "n" items. That way I could get the "count" or length of each list. but from there...I'm stumped...they are not formatted to be used as path names
This is using every trick I know so there must be a better way (David???)

Scripting would make this simpler, but I'd be interested if anyone can clean this up.

Attachments:
thanks TAZ! It's messy, but Im desperate. one thing - I've always been slightly confused about the replace paths component - for the example - can you tell me if there are any hidden expression in there?
No, the only tricky thing about [Replace] is the format of the input data...

D (data stream) - the tree.

S (search mask) - this can only be a string with index separators (in this case a semicolon). Using curly brackets (like directly connecting a [Param Viewer]) will not produce the correct results.

A list of double type values (0.0, 1.0, 2.0 etc) will also not work (doubles must be converted to integers or strings).

Using a list of * (wildcard) values corresponding to the total number of branches would also work (see help comments).

R (replacement path) - this can be a string or path name (you can attach the [Param Viewer] directly).

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