Deleting parts of list

Hi,
I am stuck at certain point after searching forums for solution.
So i have list from which i want to isolate items without ‘>’ and ‘)’ and delete them.
After filter, my list still shows everything.

Marin

Hi @m.stojanovic25HQS .

You should use the node String.Contains, the == node is used to find exact matches.
Also, using cross-level lacing you can check multiple values at once, if you search the forum on that I’m sure you can find out how.

2 Likes

so I use the get all indices and remove item at index method to handle these odd filter conditions. If you set your lacing right, you can do it with one node and a list. It returns a list of indices, and then you remove those indices from your list.

Thanks for the info. I am still struggling with the Lacing, but this will suffice for now.
I can’t find how to delete strings from Project File or convert them to Element (them I know how to delete).

create a dictionary with key as the element names and value the elements list, so after you filter what you want to delete from the name list, request to the dictionary to get the values at key (list name to delete) so you get list elements to delete and you delete

@m.stojanovic25HQS change the input in the list.filterbyboolmask in the elements.
Right now you only filter the strings not the elements

1 Like

Good evening,
I tried a solution via python (I’m a great beginner on this aspect) don’t forget to apply your mask on your elements

Hoping not to have created more ambiguity.
python script:

# Charger les bibliothèques DesignScript et Standard Python
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

# Les entrées effectuées dans ce noeud sont stockées sous forme de liste dans les variables IN.
recup=IN[0]
mask=[]

# Placer votre code au-dessous de cette ligne
for i in recup:
	if ">" in i or ")" in i:
		mask.append(False)
	else:
		mask.append(True)
# Affectez la sortie à la variable OUT.
OUT = mask

Cordially
christian.stan


I got it. Just used list of elements instead of strings.
Here is screen shot in case anyone needs it.

Thanks all.