pyRevit Hacker Basics
🎯LearnRevitAPI Course
✨WPF for pyRevit Course
💻Code Samples
🎁BIM Pure Mini-Course
Here is a simple example on how to create a new WallType.
Duplicate a random WallType
Change its name
Create 2 simple Material Layers
Update Material Structure
Same steps as you do manually if you think about it.
# Duplicate Existing WallType random_wall_type = FilteredElementCollector(doc).OfClass(WallType).FirstElement() new_name = "EF Super-Duper Concrete Wall 3000" new_wall_type = random_wall_type.Duplicate(new_name) # Specify Layer Properties layer_func = MaterialFunctionAssignment.Structure width_ft = UnitUtils.ConvertToInternalUnits(10, UnitTypeId.Centimeters) # 10cm-> feet random_mat = FilteredElementCollector(doc).OfClass(Material).FirstElement() # Create layers (I make same one as example) layer_a = CompoundStructureLayer(width_ft , layer_func, random_mat.Id) layer_b = CompoundStructureLayer(width_ft , layer_func, random_mat.Id) layers = [layer_a, layer_b] # Create+Set Material Compound Structure for Wall Type structure = CompoundStructure.CreateSimpleCompoundStructure(layers) new_wall_type.SetCompoundStructure(structure)
⌨️ Happy Coding!Erik Frits
/
all-courses
Modular
Links