Filter nulls and equivalent list

I’ve created a the attached script to input the containing room and sequence number in the Mark parameter. Dynamo runs OK with no errors and lists out the rooms correctly.

When run in an empty file all works perfectly but when creating rooms and running in an existing file or a file which previously had linked model data with room info, this no longer functions correctly. Is there a way to purge erroneous and un-used rooms from within the dynamo script?

Items outside any room should be returned with ‘-’.

Many thanks.

Hello,
Update:

The only way I can get this to work appears to be to draw a catch-all room where rogue elements can be captured.

Is there a more elegant way to eliminate elements not contained within a room?

Thanks

Please post the sample files at least so we can help :slight_smile:
if I got you correctly … you’re trying to input the room number as a mark parameter in the families inside these rooms ?

Hi Mohammadz,
Please see attached file. Essentially I’m trying to populate the mark parameter with it’s room number and a sequence number. Any items outside of any room need to be marked also (xx) but not numbered.

Updated screenshot also attached.

This is my first crack at Dynamo so any help would be greatly received.

Thanks.Room_Item_Mark.dyn (17.7 KB)

I think the nulls are causing the issue here. Problem is I can’t seem to filter them out of the room list without adjusting the list order.

Is there a way to filter the nulls in one list and use that to map and filter items in an equivalent list?

Updated .dyn attached. Any thoughts on this would be great.

Thanks.Room_Item_Mark_Not_Enclosed.dyn (23.3 KB)

hello @StrangeQuark … The script is pretty good actually it only needed some list management.

There are two ways to overcome this issue… either you clean the lists before the list.GroupByKey or after that…you can do this to fix it before the grouping … set difference between your furniture lists to clean the nulls

Room_Item_Mark_Not_Enclosed1.dyn (26.1 KB)

OR you can fix it after the grouping by cleaning the nulls and filtering with the list.isEmpty node

Room_Item_Mark_Not_Enclosed.dyn (23.9 KB)

i hope it’s clear enough :slight_smile:

Hi Mohammadz,
This is my first graph so thank you for your patience.

That’s a great help. I just couldn’t figure out how to get the order correct. I had tried both methods of list management, before and after group by key but was missing the vital functions you used!

I did manage to make this work but have probably over complicated it?

Needed to add a couple of filters to remove unwanted items collected in category.

It’s a beast but runs ok.

Thank you again for this, it’s great to get an understanding of the different ways this can be done. Learning slowly…:slight_smile:

1st_Floor_Tag_All.dyn (29.9 KB)

Just gone back to check where I went wrong before…

Do you know why ‘set difference’ and ‘remove from list’ nodes both give the right item count but remove from list seem to reorder the elements? Seem this was the cause of most of my issues initially so just trying to get my head round what the difference is (in function)

Many thanks.

Glad i can help man!

well i tested that just now and yes you are correct… remove list from list seems to reorder the list.
i tried to figure out the pattern but its a simple math python script… so i really can’t tell whats going wrong.

what i’ve noticed that both nodes work the same when the list contains no element IDs … but when they do, it starts reordering…

@john_pierson might have the answer

Interesting! I will have a look at that, Thanks for the heads up

1 Like

OK great. I thought I was misunderstanding how boolean and list subtraction operated. Assumption was the order would remain in numerical ascending of the element?

I have no idea about python script but am interested in hearing thoughts about the reordering.

Thanks again for taking the time to explain this.

1 Like