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?
list(map(lambda t_id: LabelUtils.GetLabelForSpec(t_id), SpecUtils.GetAllSpecs()))
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
Hi,
Here are some examples
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
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.
I think this is what you’re looking for…
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
Hey Aaron, thanks for your answer. I get this error message with your code. do you you know why it could be?
I used this code instead an it works
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