Family Type Parameter deletes family

I ran into a weird behavior that I would like to get some feedback on.

I am currently trying to use dynamo to set a Family Type parameter to switch out door panels in a door. See the attached script image.

Let’s say I have 3 doors all set to Door Panel “2P-G”. If I change all three doors to a new panel type “F” so that no doors use Door Panel “2P-G” any more using the dynamo script, Door Panel 2P-G gets deleted.

Does anyone have any idea why Dynamo would delete the family if there is no instances of it left when setting a family type parameter?!

Possibly related to this:

Yeah, seems like the same thing.

It doesn’t seem to do it when running the script from Dynamo Player, though.

Interesting. Are you running in Automatic from Dynamo? Might be that Player runs the function then closes and doesn’t give the graph time to reevaluate and notice the empty or missing elements.

It deletes the families in Automatic and Manual mode. It is peculiar it is working in Dynamo Player though.

After looking at your image you seem to be inputting the element type rather than the element. I’m not sure if that’s actually what you want to do. Can you connect the Element.Type to a Watch node and create another Watch node for the element input you’re using as well?