Floor Height Above Level not returning Parameter Value (when called with BiP)

Hello,

I am trying to find what a floors offset is from its host level.

Given this is an instance item, my first issue is that I cant only call instances- it is also calling types of all floors in the project. So my first question is now can I only all active instances.

For the sake of this example, I only recorded floors after index 10, as I knew these were the instances.

My second challenge, and this is part of a bigger project, I have just itemized this down, is that I can not seem to call the height about host level through the built in parameter:

BuiltInParameter.FLOOR_HEIGHTABOVELEVEL_PARAM

It doesn’t return a value. I know I must be doing something wrong here- but I cant put my finger on it. As part of my bigger project- I am making a new floor and then directly once I have made it, I want to be able to check the offset its sitting at for checks and balances.

Thankyou, Sam

> # Enable Python support and load DesignScript library
> 
> import clr
> 
> clr.AddReference('ProtoGeometry')
> 
> from Autodesk.DesignScript.Geometry import *
> 
> # Import Revit API
> 
> clr.AddReference('RevitAPI')
> 
> from Autodesk.Revit.DB import *
> 
> from Autodesk.Revit.DB import FilteredElementCollector, Family
> 
> # Import Manager Classes
> 
> clr.AddReference('RevitServices')
> 
> from RevitServices.Persistence import DocumentManager
> 
> # This gives us access to the document we are currently working in
> 
> from RevitServices.Transactions import TransactionManager
> 
> # Allows us to start transactions to make changes to documnet
> 
> # Import DStype methods ((the revit dynamo nodes)
> 
> clr.AddReference('RevitNodes')
> 
> import Revit
> 
> clr.ImportExtensions(Revit.Elements)
> 
> clr.ImportExtensions(Revit.GeometryConversion)
> 
> # The inputs to this node will be stored as a list in the IN variables.
> 
> dataEnteringNode = IN
> 
> # Place your code below this line
> 
> test = []
> 
> # Assign  documnet (the one currently opened)
> 
> doc = DocumentManager.Instance.CurrentDBDocument
> 
> collector = FilteredElementCollector(doc)
> 
> # All genetric
> 
> # Set up Floors
> 
> floor_filter = ElementCategoryFilter(BuiltInCategory.OST_Floors)
> 
> #collected_floors= collector.WherePasses(floor_filter).ToElements()
> 
> collected_floors = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Floors).ToElements()
> 
> for index, i in enumerate(collected_floors):
> 
>     if index > 10: 
> 
>         param = i.get_Parameter(BuiltInParameter.FLOOR_HEIGHTABOVELEVEL_PARAM)
> 
>         string = param.AsString()
> 
>     #word = offset.AsString()
> 
>         test.append(string)
> 
> # Assign your output to the OUT variable.
> 
> OUT = test

That parameter doesn’t have a value for AsString(). Use AsValueString() instead.
You also want to include WhereElementIsNotElementType() before ToElements() in your collector.

2 Likes

Thanks Nick!

To confirm, you use:

To.Elements (on its own) when you want instance and type

WhereElementIsNotElementType() before ToElements() (for just instance)

WhereElementIsElementType() before ToElements() (for just type)

Thankyou for the advice about value string- should I have known this as it returns a numerical value rather than simply a string?

That’s pretty much it.
I believe that’s correct; AsValueString is for parameter types that use a numerical value internally.