Set Analytical Floor Alignment


Anyone knows how I can set the Analytical floor Alignment “z Projection” to “Top of Element” or “Bottom of Element” through Dynamo? I get an error when typing a string.

If it is a dropdown option you have to use a number. most likely a pattern like this

Option 1 - 0
Option 2 - 1
Option 3 - 2
Option 4 - 4
Option 5 - 8

You can figure it out by using Element.getParameterValueByName

@Ahejnfelt You might find this useful…

I have tried using numbers instead, but when I use “Element.GetParameterValueByName” it returns a string:

Yes that is strange, it looks like it’s expectiing a ElementId as input, here is a screenshot from Revit Lookup:

I’m not sure how to get the ElementId of the top surface of your floor, but if you feed it a level it will work:

I took another look at this, but had to turn to python to make it work:

(Edit: Python is updated, center and bottom had swapped places)

import clr

from Autodesk.Revit.DB.Structure import *

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

#Functions for list handling
def ProcessList(_func, _list):
    return map( lambda x: ProcessList(_func, x) if type(x)==list else _func(x), _list )

#Preparing input from dynamo to revit
if isinstance(IN[0], list):
	analyticalFloor = ProcessList(UnwrapElement, IN[0])
	analyticalFloor = []

#Create a dictionary for getting the correct enum
prjOptEnum = { 
"Top of Element" : SurfaceElementProjectionZ.TopOrInterior, 
"Bottom of Element" : SurfaceElementProjectionZ.BottomOrExterior,
"Center of Element" : SurfaceElementProjectionZ.CenterOfElement,
#Look uo the the enum
projOption = prjOptEnum[IN[1]]

#Define function for API method:
def setProjection(aFloor,pOption = projOption):

#Change projection method in a transaction



OUT = analyticalFloor
1 Like

Hi Einar

Thanks a lot for the help!!