# How to assign a category with a code block

**URL:** <https://forum.dynamobim.com/t/how-to-assign-a-category-with-a-code-block/25242>\
**Category:** Uncategorized\
**Created:** [August 27, 2018, 8:08pm UTC](https://forum.dynamobim.com/t/how-to-assign-a-category-with-a-code-block/25242 "2018-08-27T20:08:20Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZJRODGERS](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/zjrodgers/32/99929_2.png) [@ZJRODGERS](https://forum.dynamobim.com/u/ZJRODGERS)\
**Post date:** [August 27, 2018, 8:08pm UTC](https://forum.dynamobim.com/t/how-to-assign-a-category-with-a-code-block/25242/1 "2018-08-27T20:08:20Z")

</div>

Hey guys, my problem is that dynamo player keeps switching my drop downs from the one that is saved the one that says “Curtain Systems - hidden lines” should be “Doors” i would like to know if i can get categories through the code block so dynamo cant change them!

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/2/1220f2742f6923218fe5fbc2cbacf9f90a203be8.png)

---

<div class="post-metadata">

**Author:** ![interactiverendering](https://avatars.discourse-cdn.com/v4/letter/i/db5fbb/32.png) [@interactiverendering](https://forum.dynamobim.com/u/interactiverendering)\
**Post date:** [August 27, 2018, 9:31pm UTC](https://forum.dynamobim.com/t/how-to-assign-a-category-with-a-code-block/25242/2 "2018-08-27T21:31:19Z")

</div>

Try this  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/9/c95350fccbd0ff08ae3308d250725b3c181be231.png)

---

<div class="post-metadata">

**Author:** ![ZJRODGERS](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/zjrodgers/32/99929_2.png) [@ZJRODGERS](https://forum.dynamobim.com/u/ZJRODGERS)\
**Post date:** [August 27, 2018, 9:42pm UTC](https://forum.dynamobim.com/t/how-to-assign-a-category-with-a-code-block/25242/3 "2018-08-27T21:42:11Z")

</div>

I did and it still gave me an error. Just left my desk ill have to send u the error tomorrow

---

<div class="post-metadata">

**Author:** ![ZJRODGERS](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/zjrodgers/32/99929_2.png) [@ZJRODGERS](https://forum.dynamobim.com/u/ZJRODGERS)\
**Post date:** [August 28, 2018, 12:54pm UTC](https://forum.dynamobim.com/t/how-to-assign-a-category-with-a-code-block/25242/4 "2018-08-28T12:54:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kulkul](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kulkul/32/49801_2.png) [@Kulkul](https://forum.dynamobim.com/u/Kulkul)\
**Post date:** [August 28, 2018, 1:38pm UTC](https://forum.dynamobim.com/t/how-to-assign-a-category-with-a-code-block/25242/5 "2018-08-28T13:38:24Z")

</div>

Try using **Revit.Category.ByName(“Doors”)**

---

<div class="post-metadata">

**Author:** ![ZJRODGERS](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/zjrodgers/32/99929_2.png) [@ZJRODGERS](https://forum.dynamobim.com/u/ZJRODGERS)\
**Post date:** [August 28, 2018, 1:40pm UTC](https://forum.dynamobim.com/t/how-to-assign-a-category-with-a-code-block/25242/6 "2018-08-28T13:40:56Z")

</div>

that didnt seem to work either

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/b/4b8d3cfc766f1d16139291ef8aceec7e848bd404.png)

---

<div class="post-metadata">

**Author:** ![ZJRODGERS](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/zjrodgers/32/99929_2.png) [@ZJRODGERS](https://forum.dynamobim.com/u/ZJRODGERS)\
**Post date:** [August 28, 2018, 1:42pm UTC](https://forum.dynamobim.com/t/how-to-assign-a-category-with-a-code-block/25242/7 "2018-08-28T13:42:24Z")

</div>

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/9/991f6968869c8582b9ec4a83c3988298e504030f.png)

---

<div class="post-metadata">

**Author:** ![Kulkul](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kulkul/32/49801_2.png) [@Kulkul](https://forum.dynamobim.com/u/Kulkul)\
**Post date:** [August 28, 2018, 1:43pm UTC](https://forum.dynamobim.com/t/how-to-assign-a-category-with-a-code-block/25242/8 "2018-08-28T13:43:20Z")

</div>

Use **"Revit.Elements.Category.ByName(“Doors”)** if you still have errors then use OOTB node this has same result as codeblock.

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