I have a list of boolean values that I want to use as a means to weave 2 lists together. I’m uncertain how the list combination nodes work and would appreciate any help or direction.
The pattern looks like something below, with the 2 preceding lists.
I thought of changing the pattern to numbers 0=False and 1=True, but I can’t find a way to weave the lists using that combination.
Try Combine by Pattern from archi-lab package.
Thanks Konrad, I tried the Combine by Pattern node. However, it is only giving me 21 values in the output, when there should be 111 values
If it’s just two lists and a boolean pattern, it might be easier to do this with some of the default nodes:
I would do what Dimitar is suggesting. Combine by pattern works on two lists of exactly equal length. That means that the input Boolean pattern has to be 110 items but so does list 1 and list 2 .
With this kind of input (lists with different lengths), it would actually have to be something (more or less) recursive. Basically (if I understand you correctly) you want to cycle through the whole list of booleans and for each item either take the first item in the list of lines or the list of arcs (and then go into the next iteration with that first item dropped from its respective list). You could do that with a Python script:
booleans = IN
lines = IN
arcs = IN
elementlist = list()
for boolean in booleans:
if boolean == True:
OUT = elementlist
I haven’t tried this, so it might be buggy…
EDIT: I just love the way this forum swallows all the indents when pasting a script here.
@Dimitar, I tried your method in some samples and it works fine, although when I apply it to my lists of Lines and Arcs to combine, it causes any of the Arc values to become Null. Could this be a program issue?
@Andreas, I’m not too familiar with Python Script, however when I copy and paste the script in and try running it with:
- INT = Boolean Pattern
- INT=True Values (Lines)
- INT=False Values (Arcs)
It does not seem to work, below is how the Script looks like in the node.
Appreciate all the assistance!
Thanks Konrad for clearing that up. It works now!
Appreciate all the help everyone
Sorry, I was under the impression that the lists were of the same length.
No problem Dimitar, appreciate the help regardless, I think I should of explained my issue more. But since there has been a few ways to tackle this, at least I know for the future how to solve it!