Create new List with condition

Hi Everyone!
I want to create a new list from the original list with one condition, New lists are create up of lists with false conditions…
Thanks in advance!

@lebinhx3c2012 you can use list filterbyboolmask to get new list.

Hope this helps.

3 Likes

Thanks for your answer, but I want creates a new list added by lits[ 1] and list [2]

@lebinhx3c2012 something like this ?

if possible can you please share the drawing and explain in detail what you are looking for.

1 Like

Ohm No, It is a premium list.
you can see my file share.
CreateSurveySurface.dwg (1.8 MB)
41. Create Surface from file NTD.dyn (107.9 KB)

Hi @shahid.shaikh_C3D
its new list is create up of list [1…9] and list [10…15] …

A CSV file is missing for the above script to run, anyway what i understood if i am correct is you want to create a new list from [1…9] and [10…15] based on true value (i.e. if it contains pole omit it).

Based on that see if this helps

I think you just need to filter those lists.

If not, you’re going to need to show us your expected list output. It’s hard to understand exactly what you’re after.

2 Likes

Hi @shahid.shaikh_C3D , Thanks for your answer.
But do you know how to create a new list from the false Lists is between two true list.

Hi @Nick_Boyts , Thanks for your answer.
I want to create a new list from the False Lists is between the two True lists.

Hi @mzjensen ,
Can you help me in this problem?
Thank you in advance.

This is much easier with python, but it can be done with nodes only. You just have to get the indices and shift them to create a sequence between true values.

7 Likes

Wow amazing work there @Nick_Boyts; did you just find a list of lists between lists? lol crazy

1 Like

wow, that’s what I want…
Thank you very much

@Nick_Boyts thanks for this answer …learnt something new.

Pardon my ignorance but i am falling to understand the use of shiftIndices Node. so if you can elaborate little for my better understanding that would be great.

Also when i am testing it for some cases i am not getting the expected result.

The indices at the end should be 2, 3 and 5,6 but as last true value is at Indice 4 all other false values after that is not taken in to consideration.

The indices (AllIndicesOf) represent where a true condition is found. I’m using those indices to create a list of sequences from one index to the next. ShiftIndices moves the indices one position “back” so that the two lists represent the starting true index and the ending true index for each grouping. I then add and subtract (1) from those indices to get the start and end position of just the false values (Code Block).

In the original scenario, the list began and ended with true conditions so I could skip a few steps. For full coverage of false values (and to get your final grouping) you would want to confirm there is always a 0 at the beginning of the starting index list (AllIndicesOf) as well as confirming an index representing the list length at the end of the ending index list (ShiftIndices). This will ensure that you get groupings that don’t have a true value at the first or last position of the list.

In your scenario specifically, you also have adjacent true values. This causes some problems as the sequence values end up flipping and you get a list of true values only. That’s why I originally mentioned that this is much easier in python - you have way more control there.

3 Likes

Amazinng;)

Thanks alot, got it clear now. Dont have much idea about python but this can be a great starting point i feel.

looks like this was being worked on in multiple places, if anyone wants to see a python code solution: List Create - #15 by c.poupin

4 Likes