Grasshopper

algorithmic modeling for Rhino

Retrieve Branch Path according to Number of contained Items

Hi everybody,

I wish to extract branch paths depending on how many items AND depending on the value of the item(s) they contain.

I've got a data tree with each branch representing a single line and containing the parameter t of line intersections. The number of items/entries range from Null to Two. The value of items could be 0.0, 1.0 or a floating point within the range of 0.0 and 1.0

What I need is a list of all (original) branch paths, that contain

(A) two items

(B) items inequal to 0 and 1

_______________________________________

Basically, my actual problem ends here, but with respect to this problem, I started to wonder, if the number of items, a branch contains, is a parameter, that could be extracted and processed in further operations. Can you tell me something about that?

Finally, I need to mention that I am a beginner with GH, which is why I hope, there could be a solution build with GH components only.

Anyways, thanks a very lot,

Christian

Views: 3177

Attachments:

Replies to This Discussion

Thank you, Pieter!

The (obviously) missleading expression "superior logic" was referring to the Mass Addition component only. I was just wondering, why Mass Addition handles those boolean values in this manner (like an OR-gate)

"False+False = 0

True + False = True + True = 1"

?

Anyways, thanks for spending your time on my request.

(To my knowledge, Constance is the english term for Konstanz and since the "official" language of this forum is English, I have been choosing this spelling. If my place was München I probably would have been writing Munich, that's all...)

You're welcome Christian. And yes - coming to think of it - I used the MassAddition as a Gate OR.
I figured it would be more consize to do it this way. (I like consize: my screen is only 23" ...)

To elaborate a bit (using some random values for the True values):

False + False = False (0 + 0 = 0)
True + False = True ( 1 + 0 = 1, or 1.23 + 0 = 1.23 which is not 0, so it converts to True)
True + True = True (12.97 + 4.78 = 17.75, which again is not 0, so it converts to True)

Note: A pitfall may be when there's negative values in there that cancel out/add up to 0...

(Aha, I thought you were talking French there ~:p
I never understood why names are translated...  
An example: I doubt a Dutch guy called "Willem" will repond to being called "Guillaume".)

Hello Christian, Pieter!

Mass addition doesn't do what you say it does. If you connect a panel on the output of [equality] component, you will see that you don't have any branch with 2 "True" values. (This is to be expected, since you were checking if a number is 0 or 1, so you can't have 2 "True" results)

So what [Mass Addition] does is:

False+False=0 (0+0=0) and

True+False=1 (1+0=1)

which actually makes sense...

cheers,

Nikos

edit

Pieter, we were replying at the same time. I think the confusion is based on where this conversion is made. It is not made in the [Mass Addition] output (1.23+0 will always return 1.23) but rather on the [Cull Pattern] input which will convert any number to 0 or 1 (because it expects a boolean as input)

Ah yes Nikos, you're right. Christian, it's the boolean type input from the cull pattern that does the auto conversion, not the MassAddition component.
Some things have become too self evident to me, sorry about the confusion.

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service