How to see parameters of model categories

HI everyone i create this post to find a solution for a problem that i have in a dynamo script but also to see if someone can answer this question: is there a web page, or maybe a plug-in in revit or even a ribbon in revit that can show to me all the parameteres in revit of a model categories; i’ve spent the last hour trying to find a forum page that answer this question but i didn’t found anything useful.
this is the script.

So in this first image i was tryng to set a project parameter were i can see the level of all the object that i have created in the revit file. to do that i have decided to create this script to Select automatically all the model object by the model categories. But the error was that this model category created automatically by Revit (Zone riscaldamento, ventilazione e aria condizionata->Heating, ventilation and air conditioning zones) didn’t have the parameters “Level”


to resolve this error i eliminated this categories (i know it,s not a proper choice and if you know other way i accept some help)

And here is where i started thinking, there is a way to see all the parameters of all the model categories that are in revit even if i didn’t model them so i can modify this script and eliminate all the categories that don’t have the level parameter so i don’t have anymore the error like in the first image.

Thank you have a good day

Can you show what these nodes have as output?
image

I would like to see the outputs, but with the elements selected as in your first image.

that can show to me all the parameteres in revit of a model categories

Something like this?

PS
You don’t need Watch Nodes to show / see outputs of nodes. Simply click to pin
image

PPS
I am no MEP engineer but it should work. Maybe something else is wrong in your model?

The first image is part of the thing that im tryng to achive, with the node that you used “Built in Parameter.In Document”, in wich package can i find this node? i found a similar node with the packege of Synthesize shown below


this gave me an error, and actually i need to figure out how i can use this; so it’s better the node that you used.
The final goal that i’m tryng to achive it’s like to have a list of all the model categories presents in revit(That i have) with the respective parameters, to see wich categories have the Parameter “level” and the ones that don’t. Now i’m serching also in the Revit API for some answer; because i found strange the fact that there isn’t an Autodesk page were i can see all the parameters of the model categories that are built in revit. if you know maybe some posts about this topic i would appreciate your help; if its possible can u share the package for the “Built in node” - Thanks for your time

Are you trying to get levels specifically? Or or parameters as well?

in this case specifically levels because i need them to create a PBS

Categories don’t really have a level (AFAIK) but get a ‘Level’ on placement.
Also a Level can be; Level, Work Plane, Base Constraint. Depending on the Element and / or Category.

image

image

image

All these Parameter represent a Level.

yeah as BVS is indicating, MEP elements for levels don’t follow a “Norm” persee when it comes to collecting thier level.

You can use something like this to collect the levels of lots of different types of MEP elements.
(Noting that this isn’t the most efficient way to do this but is fairly readable for someone not familiar with Python)

import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

clr.AddReference('System')
from System.Collections.Generic import List

clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

def get_level_element(e, param):
    try:
        level_id = e.get_Parameter(param).AsElementId()
        return doc.GetElement(level_id)
    except:
        return None

# Assign Document
doc = DocumentManager.Instance.CurrentDBDocument
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

# Preparing input
if isinstance(IN[0], list):
    elements = UnwrapElement(IN[0])
else:
    elements = [UnwrapElement(IN[0])]

output = []

# Transaction
TransactionManager.Instance.EnsureInTransaction(doc)

for e in elements:
    elem = []

    # Levels
    level_element = get_level_element(e, BuiltInParameter.LEVEL_PARAM)
    if not level_element:
        level_element = get_level_element(e, BuiltInParameter.RBS_START_LEVEL_PARAM)
    if not level_element:
        level_element = get_level_element(e, BuiltInParameter.FAMILY_BASE_LEVEL_PARAM)
    if not level_element:
        level_element = get_level_element(e, BuiltInParameter.FAMILY_LEVEL_PARAM)
    if not level_element:
        try:
            level_element = e.get_Parameter(BuiltInParameter.SCHEDULE_LEVEL_PARAM).AsElementId()
            level_element = doc.GetElement(level_element)
        except:
            level_element = None

    # Output
    elem.append(level_element)
    output.append(elem)

TransactionManager.Instance.TransactionTaskDone()

# Flatten the output list
OUT = [item for sublist in output for item in sublist]

The kicker is that with differing version of revit the parameter you are looking for actually differs, so to start you can use RevitLookUp

Start by selecting an element and snooping the current selection

Next is a little bit more but stick with me, once you have the element snooped you can scroll down till you’ll find “Parameters” click it (In the example below i clicked it twice to bring up 2 windows since the element i selected ectually had 2 different level parameters associated with it.

after clicking the parameters, i searched for “level” in both windows and it is the “Definition name” that you are looking for.

Once you have your deffinition, you can continue to add more if not statements to the python code above until you cover all the varaible types of parameters you are looking for.

You can continue to add statements as this.

The big kicker here is if your element looks like this and you need to report its level, then you need to correct this before any of the above will work. You can, inshort find the nearest level by comparing the elevation of the element to the elevation of levels in your project (This would vary depending on element type ie: sanitary pipes ref wants to be the level above the element, where lights want to be the level below the element. (at least in my world)
image

If you want to take this approach then there is a node in the genius loci package that is great at grabbing the element elevation to compare to.

I hope this helps you solve your issue.

Good Luck!

1 Like

thank you for helping me i think that the python script will help me a lot for what i’m achieveing; but i think we can do the same workflow of the python script with a node called “get parameter by value” and writing the parameter “level”; with this node i can also create a list of the work plane and base constraint; i’ve found it this morning and maybe it can also help both fo you. Btw i will try both methods and when i have some news i will continue this topic.

Have a great day!

Lookout for those pesky MEP elements referenced to the wrong level :wink:

This can be also true for not MEP Elements. My example came from a Wall, Floor and (Work Plane Based) Generic Family.

Here a non Python solution :point_down:.


"Name=" can also be "Level("

2 Likes