# Get Spec Type mit Codeblock or Python

**URL:** <https://forum.dynamobim.com/t/get-spec-type-mit-codeblock-or-python/108380>\
**Category:** Revit\
**Tags:** python\
**Created:** [February 27, 2025, 12:29pm UTC](https://forum.dynamobim.com/t/get-spec-type-mit-codeblock-or-python/108380 "2025-02-27T12:29:35Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![CarlosCMB](https://avatars.discourse-cdn.com/v4/letter/c/7bcc69/32.png) [@CarlosCMB](https://forum.dynamobim.com/u/CarlosCMB)\
**Post date:** [February 27, 2025, 12:29pm UTC](https://forum.dynamobim.com/t/get-spec-type-mit-codeblock-or-python/108380/1 "2025-02-27T12:29:35Z")

</div>

How can I get the SpecTypes with code. Right now I just make a list with the node Spec Types but I would like to have it with code. These dropdowns are always problematic and I like only to use them for user input. Any ideas?

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

---

<div class="post-metadata">

**Author:** ![BimAmbit](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/bimambit/32/192629_2.png) [@BimAmbit](https://forum.dynamobim.com/u/BimAmbit)\
**Post date:** [February 27, 2025, 12:49pm UTC](https://forum.dynamobim.com/t/get-spec-type-mit-codeblock-or-python/108380/2 "2025-02-27T12:49:27Z")

</div>

```auto
list(map(lambda t_id: LabelUtils.GetLabelForSpec(t_id), SpecUtils.GetAllSpecs()))

```

---

<div class="post-metadata">

**Author:** ![CarlosCMB](https://avatars.discourse-cdn.com/v4/letter/c/7bcc69/32.png) [@CarlosCMB](https://forum.dynamobim.com/u/CarlosCMB)\
**Post date:** [February 27, 2025, 3:05pm UTC](https://forum.dynamobim.com/t/get-spec-type-mit-codeblock-or-python/108380/3 "2025-02-27T15:05:52Z")

</div>

Thanks,but what I am looking for is the Spec Types to use in the node Parameter.SharedParameter. this code gives me just the Names of the Spec Types as String

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

---

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [February 27, 2025, 3:38pm UTC](https://forum.dynamobim.com/t/get-spec-type-mit-codeblock-or-python/108380/4 "2025-02-27T15:38:39Z")

</div>

Hi,

Here are some examples

> [@String to Spec Type](https://forum.dynamobim.com/t/string-to-spec-type/95456/3):
>
> Hi, here is a solution with Python the input is a flat list of the Name of Parameter Type (Spec Type) : in English or in Revit Current language Python code (compatible to all engines) import clr import sys import System clr.AddReference("RevitAPI") import Autodesk from Autodesk.Revit.DB import \* clr.AddReference("RevitServices") import RevitServices from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager doc = DocumentMana…

> [@Shared Parameters - Create and add to Family in Python](https://forum.dynamobim.com/t/shared-parameters-create-and-add-to-family-in-python/88081/14):
>
> Hi, here is a fix, (tested with Revit 2021, 2022, 2023) #Inspired by an archilab node, by Konrad Sobon #Modifications by Alban de Chasteigner 2020 # test fix by Cyril Poupin for Revit 2022+ #twitter : @geniusloci\_bim #geniusloci.bim@gmail.com #https://github.com/albandechasteigner/GeniusLociForDynamo import clr clr.AddReference("RevitAPI") import Autodesk from Autodesk.Revit.DB import \* clr.AddReference("RevitServices") import RevitServices from RevitServices.Pe…

> [@Dynamo 2.13 Get all Spec Types](https://forum.dynamobim.com/t/dynamo-2-13-get-all-spec-types/77477/2):
>
> Hi, here an example import clr import sys #import Revit API clr.AddReference('RevitAPI') import Autodesk from Autodesk.Revit.DB import \* prop\_infos = clr.GetClrType(SpecTypeId).GetProperties() dict\_forgeTypeId = {p.Name : p.GetGetMethod().Invoke(None, None) for p in prop\_infos} OUT = dict\_forgeTypeId there may be a simpler method without going through .Net reflection

---

<div class="post-metadata">

**Author:** ![BimAmbit](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/bimambit/32/192629_2.png) [@BimAmbit](https://forum.dynamobim.com/u/BimAmbit)\
**Post date:** [February 27, 2025, 4:25pm UTC](https://forum.dynamobim.com/t/get-spec-type-mit-codeblock-or-python/108380/5 "2025-02-27T16:25:07Z")

</div>

The farthest I have found is ForgeTypeId. These SpecType objects, are they dynamo wrappers? I don’t see any in the documentation. static class SpecTypeId has a bunch of properties but they’re all ForgeTypeId. @c.poupin

---

<div class="post-metadata">

**Author:** ![aaron\_rumple](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@aaron\_rumple](https://forum.dynamobim.com/u/aaron_rumple)\
**Post date:** [February 27, 2025, 6:01pm UTC](https://forum.dynamobim.com/t/get-spec-type-mit-codeblock-or-python/108380/6 "2025-02-27T18:01:06Z")

</div>

> [@BimAmbit](#):
>
> documentation. static class SpecTypeId has a bunch of properties but they’re all ForgeTypeId.

That’s correct. SpecTypeId is a ForgeTypeId. Just a particular flavor of ForgeTypeId. These flavors include:

- DisciplineTypeId
- GroupTypeId
- ParameterTypeId
- SpecTypeId
- SymbolTypeId

The dynamo Spec Types is just giving you the same as the Revit api SpectTypeId.. If you run that node into a ForgeType.TypeId node - you’ll see the string associated with the ForgeTypeId.

---

<div class="post-metadata">

**Author:** ![aaron\_rumple](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@aaron\_rumple](https://forum.dynamobim.com/u/aaron_rumple)\
**Post date:** [February 27, 2025, 7:06pm UTC](https://forum.dynamobim.com/t/get-spec-type-mit-codeblock-or-python/108380/7 "2025-02-27T19:06:47Z")

</div>

> [@CarlosCMB](#):
>
> Thanks,but what I am looking for is the Spec Types to use in the node

I think this is what you’re looking for…

```auto
import Autodesk
import clr
clr.AddReference("RevitNodes")
from Revit.Elements import SpecType

spec = Autodesk.Revit.DB.SpecTypeId.Area.TypeId
spectype = SpecType.ByTypeId(Autodesk.Revit.DB.SpecTypeId.Area.TypeId)

OUT = spectype

```

 ![img](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/0/601d51c8b48780746d1d6fbf1b0d8ec23680ed6b.png)

---

<div class="post-metadata">

**Author:** ![CarlosCMB](https://avatars.discourse-cdn.com/v4/letter/c/7bcc69/32.png) [@CarlosCMB](https://forum.dynamobim.com/u/CarlosCMB)\
**Post date:** [February 28, 2025, 11:11am UTC](https://forum.dynamobim.com/t/get-spec-type-mit-codeblock-or-python/108380/8 "2025-02-28T11:11:28Z")

</div>

Hey Aaron, thanks for your answer. I get this error message with your code. do you you know why it could be?

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

---

<div class="post-metadata">

**Author:** ![CarlosCMB](https://avatars.discourse-cdn.com/v4/letter/c/7bcc69/32.png) [@CarlosCMB](https://forum.dynamobim.com/u/CarlosCMB)\
**Post date:** [February 28, 2025, 11:38am UTC](https://forum.dynamobim.com/t/get-spec-type-mit-codeblock-or-python/108380/9 "2025-02-28T11:38:21Z")

</div>

I used this code instead an it works

```auto
import clr

clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import SpecTypeId

clr.AddReference("RevitNodes")
from Revit.Elements import SpecType

spectype = SpecType.ByTypeId(SpecTypeId.Area.TypeId)

OUT = spectype

```

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

---

<div class="post-metadata">

**Author:** ![CarlosCMB](https://avatars.discourse-cdn.com/v4/letter/c/7bcc69/32.png) [@CarlosCMB](https://forum.dynamobim.com/u/CarlosCMB)\
**Post date:** [February 28, 2025, 11:59am UTC](https://forum.dynamobim.com/t/get-spec-type-mit-codeblock-or-python/108380/10 "2025-02-28T11:59:07Z")

</div>

I’m running now into another problem. Some SpecTypes are not available in the Class SpecTypeId. Any thoughts?

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