RevitFaceReference returns null values

I want to make a script that dimensions my floors in a sectionview.
I found a script that does close to what I want:

This script takes a set of faces to dimension and a line to refer to the position of the dimension.

Now I have made in python a script that finds the floors in the active view, then I extract the top and bottom faces from the floors.
So I can create a dimension between the floors and the floor thicknesses.

I get an error because when I try to get the RevitFaceReference is only shows null values.
I use this to get RevitFaceReference, I need this to make a dimension.
for face in faces:
ref = face.Tags.LookupTag(“RevitFaceReference”)

But when I use the dynamo nodes to extract faces the script works


Does not work

I think the problem lies in my script where I extract the faces from the floors

My script to extract the faces from floors

import clr
import sys
sys.path.append('C:\Program Files (x86)\IronPython 2.7\Lib')
import System
from System import Array
from System.Collections.Generic import *
from Autodesk.DesignScript.Geometry import *
import Revit
import RevitServices
from RevitServices.Persistence import DocumentManager 
from RevitServices.Transactions import TransactionManager 


import Autodesk 
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB import Options
from Autodesk.Revit.UI import *

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication 
app = uiapp.Application 
uidoc = uiapp.ActiveUIDocument

#Maakt list als het geen list is
def fun_make_list(input):
	input_list = input if isinstance(input, list) else [input]
	return input_list
#Krijg parameter waarde
def fun_getparameter(element, parametername):
        param = element.LookupParameter(parametername)
	if param.StorageType == StorageType.String:
		return param.AsString()
		return param.AsValueString()
#Set parameters
def fun_setparameter(element, parametername, value):

#Flatten list
def fun_flattenlist(flist):
        return [val for sublist in flist for val in sublist]

floors = FilteredElementCollector(doc, doc.ActiveView.Id).OfCategory(BuiltInCategory.OST_Floors).WhereElementIsNotElementType().ToElements()

breedplaat = [x for x in floors if "breedplaat" in fun_getparameter(x, "Type")]
breedplaat = UnwrapElement(breedplaat)
option = Autodesk.Revit.DB.Options()
option.ComputeReferences = True
solid = [x.get_Geometry(option) for x in breedplaat]
solid = fun_flattenlist(solid)
geo = [i.Convert() for i in solid]

polysurface = [PolySurface.BySolid(i) for i in geo]
surface = [PolySurface.Surfaces(i) for i in polysurface]

faces = []
for i in surface:
	faces_sub = []
	for j in i:
		opp = j.Area
	max_value = max(faces_sub)
	max_2_values = sorted( [x for x in faces_sub], reverse=True )[:2]
	for k in i:
		if k.Area == max_2_values[0] or k.Area == max_2_values[1]:
#Start transaction			

#End transaction	

OUT = faces

I think there is such a method, so please refer to it.

Floor_Dimension_Test.dyn (28.5 KB)
Floor_Dimension_Test.rvt (1.3 MB)


Thanks for the script it works!
Espacialy for this piece of code where you get the top and bottom faces of the floor.
And I also think my script did not work because I had not set this value for the the option:
options.IncludeNonVisibleObjects = True

def referece(element):
	options = Options()
	options.IncludeNonVisibleObjects = True
	options.ComputeReferences = True
	geometry = element.get_Geometry(options)

	ref = []
	for geometryObject in geometry:
		for face in geometryObject.Faces:
			#Floor Top & Bottom Face
			if face.FaceNormal.Z == 1 or face.FaceNormal.Z == -1:
	return ref

I didn’t know about the FaceNormal property, if I understand it correctly 1 is always the top and -1 the bottom.
Where can I find which sides is which? I could not find it at the Revit API docs:

But I found out that when I have a floor that is joined in each other I get the following error:
I will look further to find out what exactly creates the error.
AttributeError: ‘CylindricalFace’ object has no attribute ‘FaceNormal’

Have a nice day!