Hi everyone! I am searching for a way to add parameters in the “Thickness” at the wall layer tab. I looked on the web and on the forum here, but I couldn’t find something related to this. Anyone suggestions?
try this:
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry 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
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
doc = DocumentManager.Instance.CurrentDBDocument
ele = UnwrapElement(IN[0])
TransactionManager.Instance.EnsureInTransaction(doc)
e_type = ele.WallType
cs = e_type.GetCompoundStructure()
for i, l in enumerate(cs.GetLayers()):
if l.Function == MaterialFunctionAssignment.Structure:
cs.SetLayerWidth(i, 10/304.8)
e_type.SetCompoundStructure(cs)
TransactionManager.Instance.TransactionTaskDone()
OUT = 1
1 Like
oh hey @newshunhk ! Thanks for the answer! The code you posted works good!
I just need to understand it better (since I am new to python and Revit API). My goal is to read values about different wall thicknesses from excel, and assign them to the wall layers in revit.
1 Like