Window Height/Width (for a window numbering program)

I have a little problem - I want to call every windows height and width via python (2-2, 2-3). However, I only get every windows height - the width is always 0,000m. Why is this BuiltInParameter empty?

I can call every windows width, if i transform them with elements.type into a family.element (I get a FamilySymbol Object) - but then I can not set a value to this type. - A way to transform a FamilySymbol Object back to an element would also help.

Here is my Python-Code:

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

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

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

doc = DocumentManager.Instance.CurrentDBDocument

windows = []

for w in IN[0]:
	windows.append(UnwrapElement(w))


# get the window height
height = []

for w in windows:
	sill_height = w.get_Parameter(BuiltInParameter.WINDOW_HEIGHT)
	if sill_height != None:
 		height.append(sill_height.AsValueString() )

# get every window width
width = []

for w in windows:
	sill_height = w.get_Parameter(BuiltInParameter.WINDOW_WIDTH)
	if sill_height != None:
 		width.append(sill_height.AsValueString() )

OUT = height, width



https://www.revitapidocs.com/2020.1/14272fe6-5fc3-f053-b4c6-2f44d05786f2.htm

Well, I did solve it. Just a little bit more complicated.

That little programm sorts every window after its different sizes - the most common window gets F1 - second most common F2 and so on.

No-Window-Objects (like a rigol) that belong to the window category, get sorted out.

It works for my window library, I can not say if it does for others.

Fenster_Nummer.dyn (42.0 KB)

1 Like

Fenster_Nummer_mit_Material.dyn (62.2 KB)

If needed, this is the completed program (The explanation is now in german - However the explanation in the python code is still in english.