Change floor thickness

Hi, I was trying to change floor thicknesses using Dynamo/Python scripts with thickness values from excel. I tried two ways as below:

  1. Through Element.SetParameterByName. But it turned out the node cannot modify the thickness which is read-only.
  2. Through Python scripts suggested by this post Parameter is Read Only. But it showed that Floor object has no attribute Thickness. If I changed IronPython2 to CPython3, there was no error but there is no change to the floors.

How to change floor thickness then? Because I want to change them by groups of elements (e.g., level by level), I need to process it automatically. Thank you!

Revit model: sample model.rvt - Google Drive
Dynamo:
change design.dyn (19.8 KB)
Excel (thickness values):
test.xlsx (14.2 KB)

@Howie ,

for python… you have some basic gabs… in a for loop you need to collect elements… and snoop out Revit API

thats the output from the current node:

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

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

def SetCompoundLayerWidth(famtype, index, width):
	try:
		cs = famtype.GetCompoundStructure()
		cs.SetLayerWidth(index,width)
		famtype.SetCompoundStructure(cs)
		return True
	except: return False

doc = DocumentManager.Instance.CurrentDBDocument
famtypes = UnwrapElement(IN[0])
indices = IN[1]
widths = IN[2]

TransactionManager.Instance.EnsureInTransaction(doc)
if isinstance(IN[0], list):
	if isinstance(IN[2], list):
		if isinstance(IN[1], list): OUT = [SetCompoundLayerWidth(x,y,z) for x,y,z in zip(famtypes, indices, widths)]
		else: OUT = [SetCompoundLayerWidth(x,indices,y) for x,y in zip(famtypes, widths)]
	else:
		if isinstance(IN[1], list): OUT = [SetCompoundLayerWidth(x,y,widths) for x,y in zip(famtypes, indices)]
		else: OUT = [SetCompoundLayerWidth(x,indices,widths) for x in famtypes]
else:
	if isinstance(IN[2], list):
		if isinstance(IN[1], list): OUT = [SetCompoundLayerWidth(famtypes,x,y) for x,y in zip(indices, widths)]
		else: OUT = [SetCompoundLayerWidth(famtypes,indices,x) for x in widths]
	else:
		if isinstance(IN[1], list): OUT = [SetCompoundLayerWidth(famtypes,x,widths) for x in indices]
		else: OUT = SetCompoundLayerWidth(famtypes,indices,widths)
TransactionManager.Instance.TransactionTaskDone()
4 Likes

Instead of editing the slab, it’s likely best to edit the compound layer structure. The API class for that is here: CompoundStructure Class (revitapidocs.com).

I believe that the Clockwork package has some great nodes for this as well.

2 Likes

Thank you very much @Draxl_Andreas @jacob.small.

@Draxl_Andreas The graph nodes failed with False results. The python codes worked but it would change the thicknesses of all the elements using that type even through I only selected some (e.g., elements at a level). Is there a way to change only the input elements?