removing controlled parameters from view templates

image by archi-lab

It’s been a while since I wrote a post on Dynamo workflows, but it has also been a while since I have been using Dynamo for anything. I kind of like to prototype things in Dynamo these days, but not so much rely on it for anything that I want to distribute to a wider user base. This particular workflow was kind of a side effect of something else that I was working on. Originally I was asked to add Graphics Scales to all Viewports (views on sheets). Of course John Pierson has already covered that, and was kind enough to share with me. What I ran into while implementing that though, was the fact that when I added Shared Parameters to the View, all of my View Templates had these two/three parameters checked. My view templates by default took control of these new Shared Parameters. Now, that’s not exactly what I wanted, because my goal was to write custom values to these parameters, so they cannot actually be controlled. That’s how this workflow came about, I needed to un-check them for all View Templates before I could use John’s workflow. Here’s how:

As you can see above it’s pretty straight forward. We collect all Parameter objects. The Element Type for this is called SharedParameterElement. As the name implies, it will work only for Shared Parameters that were added to the project, so don’t expect it to work for system parameters. Once we have the parameters, we isolate ones that we are interested, and get their IDs. Now, using Archi-lab own’s View.GetByType and View Types nodes, we can collect all of the View Templates in the project. Now we do a little Python magic to remove the isolated parameters from view templates. Here’s the code:

IMPORTANT! 

Please remember that messing around with View Templates in Revit will cause views to regenerate. Why does it matter? Well, we are overriding ALL of the view templates here, so most likely we are going to regenerate all or most of the views. The best way to handle that is to CLOSE ALL WORKSETS before using this workflow. Everything will regenerate much faster with worksets closed. Now, to minimize the amount of regeneration, I am checking whether given view template actually has that parameter under control, so that we don’t necessarily touch view templates that don’t need to be updated, but then again, on large projects, and first time you administer this workflow, it will have to regenerate a lot of views.

Enjoy!

UPDATE 09/11/2017:

So apparently you can skip this entire ordeal, if you add the Shared Parameters to the Shared Parameters file, and then set them to be “hidden”. Thanks to John again for sharing: Set Parameter to hidden. 

Support archi-lab on Patreon!

6 Comments

  1. Azubike Ononye says:

    Hey Konrad – Thanks for this. Based on this statement, “I kind of like to prototype things in Dynamo these days, but not so much rely on it for anything that I want to distribute to a wider user base.” What do you do for distribution? Make .exe files?

    Thanks

  2. danselkaz says:

    Hi ! Thank you for this explanations. Where can we find the two nodes “Type View” and “View.Getbytype” ? Is there an issue of versionning for the archi-lab package ?

    Thanks

  3. Jan says:

    Hey Konrad, thanks as always for sharing. I tried the trick with setting a Shared Parameter to invisible in the text file but somehow when I loaded into the project Views it got included in all the View Templates just like a non-hidden Shared Parameter. Curious if you ever got beyond the ‘apparently’ yourself with this.

Reply to Konrad K Sobon Cancel Reply