Dynamo script does not work on every project

We have a dynamo script that deletes demolished components and converts all new to existing. When I run the script in projects we have created, it works fine. We also work on Revit files from outside sources. The script will not work on those files. I have the checked the names of the phases and they match.
Does anyone have a suggestion of what I should do?
Thank you!

It’s almost impossible to give you a suggestion without being able to see the graph in action. Use some good old fashioned troubleshooting. Turn on all the node previews and follow the data until you come to the nulls, empty lists, or whatever is causing your graph to fail. That will tell you where the issue is stemming from.

1 Like

Hi Nick,
I tried to upload the dynamo file, but I’m unable to do so due to being a new user. I have a snapshot of one of the strings in the script. This is repeated for each element category. Does this help?

It helps a little bit, but without the node previews we still can’t see what the data looks like. We would need to see the graph after it’s failed.

I ran a test and received the below image.

Perfect. So you can see now that the Phase(s) does not match New Construction. This might be due to the fact that you’re comparing an element (the phase) to a string (the phase name). Try getting the phase name from the wall phases and comparing that to your “New Construction” string.

I’m not sure I follow. I have a snapshot of a wall selected and the phases read the same as the script.

The name is the same. But you’re not comparing the name. You’re comparing the element (phase) to the name (string). Phases are elements with element IDs just like walls and floors and other categories. You need to compare the name of the phase. Put the Element.Name node after GetParameterValueByName to see what I mean.

Like this?

Yup. It looks like you have an error somewhere in there but you can see the (visible) Phases are all Existing. You’ll want to connect the Element.Name node to your == node, replacing the current x input.

You will still need to figure out what’s causing an error in the Element.Name node though. What does the warning say?

It says Warning: Asked to Convert Non-Convertable types.

It worked!!! It converted the new to existing but I have another error on the last node.

I just realized you’re using Element Types instead of Categories. Use Categories and All Elements of Category instead. You also might check to make sure you aren’t getting any curtain wall elements that are dependent on other walls. Those would be read-only. However, I believe the final node will still correctly set all the phases for the rest of the elements if you don’t mind the warning.

1 Like

Thank you very much! It’s working! It is coming up with a few warnings but they don’t seem to affect the end result.

Thanks again!