Copy floor level to slab edge

Hello,

i’m working on a project that contains a lot of floors connected with slab edges, i noticed that slab edges in Revit don’t have a parameter for “Height Offset From Level” so i tried to export this parameter from floor to Excel sheet then try to write them again to a project parameter “Level_SlabEdge” i created to slab edges.

it works but it seems that it depends on creating slab edges sequentially so it always get wrong level.

i need something that can automatically pick level from parent floor to slab edge.

thanks in advance

:confused:

Thanks for your response,

sorry i can’t share my current project due to privacy ,it’s easy to create 10 floors for example with slab edges connected to them then test.

my question is how to get slab edge reference level? as it didn’t have this parameter.

appreciate this too much,

Excuse me i’m not expert in using python or programming.
if you can show me or send link to clarify how to get dependent elements it will be great.

thank you

Hi @mohamed.azzam,

Here’s something to get you started:

Python:

import clr

#Import the Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

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

#Reference the active Document and application
doc = DocumentManager.Instance.CurrentDBDocument

#---###Start scripting here:###---#
floors = UnwrapElement(IN[0])
output = []
#Transaction start:
#TransactionManager.Instance.EnsureInTransaction(doc)
count = 0
for i in floors:
	p = i.get_Parameter(BuiltInParameter.LEVEL_PARAM).AsValueString()
	ele_cat_filter = ElementCategoryFilter(BuiltInCategory.OST_EdgeSlab)
	slab_edges = i.GetDependentElements(ele_cat_filter)
	#output.append(p)
	slab_edge_lst = []
	TransactionManager.Instance.EnsureInTransaction(doc)
	for j in slab_edges:
		elems = doc.GetElement(j)
		slabedge_parameter = elems.LookupParameter('Level_SlabEdge')
		slabedge_parameter.Set(p)
		count +=1
	TransactionManager.Instance.TransactionTaskDone()
output.append('{} slab edges had a parameter value set'.format(count))
#Transaction end:

OUT = output

Good luck :slight_smile:

1 Like

Wow !!
Many thanks and appreciations
it works very well :grin:
i made a little change in your code to get “Height Offset From Level” instead of “Reference Level Name”

(BuiltInParameter.FLOOR_HEIGHTABOVELEVEL_PARAM) instead of (BuiltInParameter.LEVEL_PARAM)

Thanks Martin and have a good day.

1 Like

No probs Mohamed, glad to help.

The code is all yours to do as you please :slight_smile:

Have a great day :slight_smile:

1 Like