algorithmic modeling for Rhino
Hello friends, first question here:
I've got a linear array of boxes, and I have used a function (with the help of a thread on here) that tells me if the total number of objects in the array is odd (outputs a boolean true or false). Now I would like to, if this boolean is "true", cull the last item of the array.
Any suggestions?
Tags:
Hi,
you can try this solution:
Or you use "Cull Index" component from Sets/Sequence
Hope this helps,
Raul
Would you happen to know how to add a conditional statement to that, so that it only culls if the number of items in the list is odd?
Actually it would seem that this takes each odd number and makes it even by subtracting one. What I'm trying to do is: if there is an odd number of items in the list, cull the last item. I know how to cull the last item of a list, but I don't know how to only cull the last item if there is an overall odd number of items. Thanks for your help and a clever solution!
No. I am showing you the list length not the number.
The list (if odd in length) is being reduced by loosing the last item. Focus on only the highlighted part.
You have already concluded if the list contains odd or even items this is what goes into S (but as a negative)
I figured it out! You test the number of items in the array for being odd, and that will give you a true or false. Then you take a Dispatch component (didn't know that one) and input the boolean into the dispatch pattern, and input the array list into the list. Then you connect the "a" terminal of the dispatch into a cull component to cull the last item. Boom shaka-laka. Thanks for the help!
Oh...I see what you mean. Thanks a bunch, Danny.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by