Controlling Imported Categories visibility w/ Dynamo

Image by Archi-lab

I have previously written about controlling – or at least being able to obtain their state – visibility settings of Categories. In this write up I will be showing how we can show/hide Imported Categories. I have added a few new nodes to Archi-lab.net package so if you want to follow this write up, make sure to grab the latest version of the package.

These are the settings that I am talking about:

Here’s a pretty straight forward way to hide them in a view:

Let’s talk about what is happening here. First let me explain to you, what “imported categories” are. Under the hood, in the API, these objects are defined under something called Category. Yes, it is the same Category that we normally use to select things like Walls, Doors, Floors etc. Revit basically creates a new Category in its database, whenever we link or import a new DWG file. It also names it after the name of the file that was imported, which is a clue to how to access them. That’s literally how the above node was written. Here’s the code for it:

One exception to this, is the “Imports in Families” which even though it appears under the same tab, we can access it a little differently. You can get it via Graphics Style Category. Here’s a code for that:

Once we have these Categories available to us, we can turn them ON/OFF for any given view.

I know that these methods are not the most straight forward. For someone looking at these from the outside, it would appear a little weird, that an imported or linked DWG file is not just that – a linked file object – but instead it is a Category. Revit is Revit, and I kind of stopped questioning it’s means and methods a while ago. I am guessing this decision was made to keep the imported files and their visibility compatible with the standard Categories like OST_Walls, so that they didn’t have to design a new API methods to turn them on/off. From that point of view, the point of view of a software developer, working on the API for Revit, it probably made sense to do it this way. I am not going to argue with that.

Anyways, thanks for reading. Again, sample downloads files will be available for my Patreons on my Patreon page. For everyone else, just follow the images above, and you should be able to re-create them.

Cheers!

-K

Support archi-lab on Patreon!

Leave a Comment