algorithmic modeling for Rhino
Hi guys,
I am looking for a way to wright a VB script which can unify two lists (similarly to the set union component in GH) with taking into account a Boolean condition .. Meaning that if the Boolean condition is true than set union -- else keep the original list as it is.
Btw it there a way to de this with GH components only ?
Thanks..
Tags:
Sure, this can be done with native components.
In vb, assuming ListA, ListB and BooleanList have the same size, something like this:
Dim outList as new list(of datatype)
For i as int32 = 0 to ListA.Count - 1
If BooleanList(i) then
If Not outList.Contains(ListA(i)) then outList.add(ListA(i))
Else
outList.add(ListA(i))
End if
Next
For i as int32 = 0 to ListB.Count - 1
If BooleanList(i) then
If Not outList.Contains(ListB(i)) then outList.add(ListB(i))
Else
outList.add(ListB(i))
End if
Next
A = outList
I have not checked this code, so it can contain some error.
Thank you Daniel, I will have a look at the script .. I appreciate your help
How could it be done with native GH components ? the SUnion component does not contain a Boolean condition or a pattern ..
Well, maybe someone smarter than me can do it, I got tired of trying. It may not be possible, now I'm not sure, but it's simple from code, so...
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
© 2024 Created by Scott Davidson. Powered by