Remove any rows from the list that contain the value 0

Hello,

I have a question about list manipulation in Civil3D Dynamo.

As shown in the attached image, I have a list that contains the value 0.
I would like to create a new list by removing the entries that contain 0. Is there a good way to do this?

My preference for this is the ReplaceByCondition node with nulls, then clean list. You can also filter by boolean mask with list levels but its more syntactically complex to me.

If you are filtering other lists in parallel then booleanmask is a better approach.

1 Like

Here is a small piece of Python logic to try if you like.

To return lists which contain 0

lists = IN[0]

OUT = []
forlistin lists:
if0in list:
OUT.append(list)

To return lists which dont contain 0

lists = IN[0]

OUT = []
forlistin lists:
if0not inlist:
OUT.append(list)

1 Like