remove unused 3d view templates

Image by google search

I think everyone who’s been using Dynamo for a while now, knows that 3d view templates are a no go. They have been since day 1 of Dynamo. Why? It’s rather perplexing to know that someone, somewhere, decided that no one will need to ever use 3d view templates in Dynamo, and that person excluded it from the ability to be “wrapped”. If it cannot be wrapped, it cannot be passed out of custom components, hence it’s been in Dynamo’s purgatory for quite a few years. Here’s the actual code that causes this issue:

Shameless plug. I did once make an attempt at fixing this issue, but my code wasn’t good enough for the Revit/Dynamo team, and I was shut down. Here’s the PR I submitted: It was originally approved, only to be removed later. I think I created some issues in the process. Ooops!

Anyways, I got an email from Gabriel the other day, asking if it was possible to isolate and delete all unused 3d view templates. The answer is, yes. It is! The trick is to do it in Python, and do it all in one go, so that we don’t try to pass 3d view template objects around on canvas. Again, that would not be possible. So, the actual solution is this:

This get’s the trick done. Code is pretty simple. We get all 3d view templates first, then check if they are being used by any view, and if they are not, we delete them.

That’s it!

As usual you can download the actual Dynamo file from Patreon. Thank you for supporting me.

Support archi-lab on Patreon!

Leave a Comment