Grasshopper

generative modeling for Rhino

# perform boolean conjuction(and get) in every group

Hi,everyone.I have a set of data and I want to perform boolean conjuction(and get) in every group.Who can help me?Thanks

Views: 237

Attachments:

### Replies to This Discussion

You can rely on the fact that booleans convert to integers and vice versa - if the sum (mass addition) of each branch is equal to its list length, then all values in that branch are true. Is that what you were trying to do?

There are both true and false in some branch,so the  the sum (mass addition) of each branch is not clear.

I'm not sure I understand what you're trying to do. I assumed you meant logical conjunction within every branch, i.e. if all the values in the branch are true, return true for that branch. Can you give a more detailed example of how you want this to work?

Hi,Andrew.I have loaded a file in which you can see my purpose.I want to tag figure in every plane .If there are point on the plane then it should tag 0 otherwise tag 1.Maybe you have better method to solve this problem.

I don't think the image you attached worked properly, could you upload it again?

So why doesn't Andrews suggestion work? You need to perform Mass Addition on your lists of True/False values, you'll then get a result of:

• 0 when all three values are False
• 1 when a single True value exists
• 2 when two True values exist
• 3 when all values are True

This will give you the single number you're looking for. If you want to make sure that all values are TRUE, then there's a small trick you can use, you can INVERT the booleans, then perform mass addition. When the result of the mass addition is 0, all your original values were TRUE. This means you won't have to also measure the list length and compare against it.

--

David Rutten

david@mcneel.com

I just want to tag 1 or 0 on every plane.If there are point on the plane then it should tag 0 otherwise tag 1.I don not know how to perform boolean conjuction(and get) in every branch and just get 1 or 0.

--

David Rutten

david@mcneel.com

Attachments:

Thank you ,David.I have solved the problem.