# Code Block expression help

**URL:** <https://forum.dynamobim.com/t/code-block-expression-help/45861>\
**Category:** Revit\
**Created:** [January 22, 2020, 7:03pm UTC](https://forum.dynamobim.com/t/code-block-expression-help/45861 "2020-01-22T19:03:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Sommer](https://avatars.discourse-cdn.com/v4/letter/p/9e8a1a/32.png) [@Paul\_Sommer](https://forum.dynamobim.com/u/Paul_Sommer)\
**Post date:** [January 22, 2020, 7:03pm UTC](https://forum.dynamobim.com/t/code-block-expression-help/45861/1 "2020-01-22T19:03:41Z")

</div>

Hello,

I found this code block expression for Categories.  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/4/742186f27c64ef3cc69308e9a9b7f54a1e27e00a.png)

Is there one for view types. “Revit.ViewType.ByName”?? I tried to Google it with no luck.  
I would like a code block expression wherein I can bunch multiple view types. ex. Drafting Views. Sections Views etc.

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [January 22, 2020, 8:44pm UTC](https://forum.dynamobim.com/t/code-block-expression-help/45861/2 "2020-01-22T20:44:22Z")

</div>

There is not. You would have to filter a list of all view types.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/0/50482be768d3e266257f646b00e2778a69c674d8.png)

---

<div class="post-metadata">

**Author:** ![Ren\_Rainville](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ren_rainville/32/13298_2.png) [@Ren\_Rainville](https://forum.dynamobim.com/u/Ren_Rainville)\
**Post date:** [January 22, 2020, 10:03pm UTC](https://forum.dynamobim.com/t/code-block-expression-help/45861/3 "2020-01-22T22:03:26Z")

</div>

for API specific questions make sure to bookmark [API Docs](https://apidocs.co/) it is for more than Revit as well.

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [January 23, 2020, 6:41am UTC](https://forum.dynamobim.com/t/code-block-expression-help/45861/4 "2020-01-23T06:41:23Z")

</div>

Was saving some of this for a potential rainy day AU course, but if it helps you can look this over.

Using OOTB nodes it’s not as simple, but it is certainly doable:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/8/18fac2228ca5a5aebf23c4b50a8fca2cfd075065.png)

Note the element queries methods can be found here: [DynamoRevit/ElementQueries.cs at Revit2017 · DynamoDS/DynamoRevit · GitHub](https://github.com/DynamoDS/DynamoRevit/blob/Revit2017/src/Libraries/RevitNodes/Elements/InternalUtilities/ElementQueries.cs). They consist of the following:  
ElementQueries.OfFamilyType(famtype);  
ElementQueries.OfElementType(elemtype);  
ElementQueries.OfCategory(categ);  
ElementQueries.AtLevel(lvl);  
Some other useful OOTB Design Script tools are gets FamilyTypes, Families, and Categories by name.  
FamilyType.ByName(“60" x 30"”);  
Family.ByName(“Desk”);  
Category.ByName(“Furniture”);

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/c/6cc7921570b62029c246d8963319ff8f5d5339f7.png)

And lastly, if you have a package which uses zero touch nodes you can call those functions and methods in the same way as you do the OOTB nodes. This means that we can call upon the power of the larger Dynamo community to expand the feature set of Design Script beyond that which comes with the initial install. Thanks to @Konrad_K_Sobon’s execellant [Archi-lab](https://forum.dynamobim.com/t/revit-2022-dynamo-2-10-package-not-showing-up-and-icons-missing/62933/7?) package we can leverage this little number:  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/3/f35767e65ce8e553005cb78ae3ca9f17e8884873.png)

However note that this will require an extra line of documentation and confirmation that the function is in the noted package (hence the comment on the first line of the node).

---

<div class="post-metadata">

**Author:** ![Paul\_Sommer](https://avatars.discourse-cdn.com/v4/letter/p/9e8a1a/32.png) [@Paul\_Sommer](https://forum.dynamobim.com/u/Paul_Sommer)\
**Post date:** [January 27, 2020, 12:45pm UTC](https://forum.dynamobim.com/t/code-block-expression-help/45861/5 "2020-01-27T12:45:02Z")

</div>

Thank you guys. This has been a big help!
