Conversion of Architectural Walls to Structural Walls

Hi everyone, I am trying to modify the layer thickness of walls in Revit using Dynamo. Specifically, I want to set the thickness of all non-structural layers to 0 and retain only the structural layer as it is. However, I’ve encountered some challenges ,This is what I did already , but It is not working , I need help, thank you so much !


Task 1.rvt (5.4 MB)
task 1-Scenario 2.dyn (18.8 KB)

Hi @101532664 not sure if it could help but you can get/set your compound layers, here with clockwork

1 Like

Thank you Sovitek! , I will try to use it now , I hope it will help

yeah try it…genius loci have some great nodes for compound structures as well…probably it fit you better

1 Like



After I run the dynamo file, nothing changed in the wall assembly ? it supposes to make the thikness = 0, right ?

dont think all can be 0, guess with that it has to be membrane exc…but you could delete the layer…but not really what the goal is…maybe play with parting…not sure

1 Like

The only way to set a wall layer to 0 is to make it a membrane layer. Then it will automatically be 0 thickness. So just change the function.

1 Like

this is exactly what I did, but nothing is changing Revit !! this is screenshot , and this is the python script :

Import necessary libraries

import clr
clr.AddReference(‘RevitAPI’)
clr.AddReference(‘RevitAPIUI’)
clr.AddReference(‘RevitServices’)

from Autodesk.Revit.DB import Transaction, MaterialFunctionAssignment, WallType
from RevitServices.Persistence import DocumentManager

Get the active Revit document

doc = DocumentManager.Instance.CurrentDBDocument

Inputs from Dynamo

wall_types = IN[0] # List of wall types from Dynamo

Start a transaction to modify Revit elements

transaction = Transaction(doc, “Update Wall Type Layers”)
transaction.Start()

try:
for wall_type in wall_types:
# Ensure the element is a WallType
if isinstance(wall_type, WallType):
# Duplicate the wall type to create a new one
new_wall_type = wall_type.Duplicate(wall_type.Name + “_Modified”)

        # Get the compound structure of the duplicated wall type
        compound_structure = new_wall_type.GetCompoundStructure()

        # Check if the compound structure exists
        if compound_structure is not None:
            # Iterate through each layer in the compound structure
            for i in range(compound_structure.LayerCount):
                layer = compound_structure.GetLayer(i)

                # If the layer is not structural
                if layer.Function != MaterialFunctionAssignment.Structure:
                    # Change function to Membrane
                    compound_structure.SetLayerFunction(i, MaterialFunctionAssignment.Membrane)
                    # Set thickness to 0
                    compound_structure.SetLayerWidth(i, 0.0)

            # Apply the modified compound structure back to the new wall type
            new_wall_type.SetCompoundStructure(compound_structure)

# Commit the transaction
transaction.Commit()
OUT = "Wall type layers updated successfully. Check the duplicated types."

except Exception as e:
# Roll back the transaction if there is an error
transaction.RollBack()
OUT = "Error: " + str(e)

task 1-Scenario 4.dyn (13.1 KB)

@101532664 so I tweaked your script just a bit, it worked on my machine. Essentially, you want to unwrap the element types first (line 14). Then a bit different way of enumerating the layers (line 33, 34).

# Import necessary libraries
import clr
clr.AddReference('RevitAPI')
clr.AddReference('RevitAPIUI')
clr.AddReference('RevitServices')

from Autodesk.Revit.DB import Transaction, MaterialFunctionAssignment, WallType
from RevitServices.Persistence import DocumentManager

# Get the active Revit document
doc = DocumentManager.Instance.CurrentDBDocument

# Inputs from Dynamo
wall_types = UnwrapElement(IN[0])  # List of wall types from Dynamo

# Start a transaction to modify Revit elements
transaction = Transaction(doc, "Update Wall Type Layers")
transaction.Start()

try:
    for wall_type in wall_types:
        # Ensure the element is a WallType
        if isinstance(wall_type, WallType):
            # Duplicate the wall type to create a new one
            new_wall_type = wall_type.Duplicate(wall_type.get_Name() + "_Modified")
        
            # Get the compound structure of the duplicated wall type
            compound_structure = new_wall_type.GetCompoundStructure()
        
            # Check if the compound structure exists
            if compound_structure is not None:
                # Iterate through each layer in the compound structure
                layers = compound_structure.GetLayers()
                for i, layer in enumerate(layers):      
                    # If the layer is not structural
                    if layer.Function != MaterialFunctionAssignment.Structure:
                        # Change function to Membrane
                        compound_structure.SetLayerFunction(i, MaterialFunctionAssignment.Membrane)
                        # Set thickness to 0
                        compound_structure.SetLayerWidth(i, 0.0)
                       
        
                # Apply the modified compound structure back to the new wall type
                new_wall_type.SetCompoundStructure(compound_structure)

    # Commit the transaction
    transaction.Commit()
    OUT = debug #"Wall type layers updated successfully. Check the duplicated types."

except Exception as e:
    # Roll back the transaction if there is an error
    transaction.RollBack()
    OUT = "Error: " + str(e)

1 Like

Thank you so much!!, it works perfectly now

:wink:

Hello again, I’m facing two issues:

  1. The structural layer edge of the duplicated wall misaligns with the original, causing an offset.
  2. The existing walls don’t automatically switch to the duplicated wall type. I have to select the walls and switch them manually.

I will appreciate if someone help me with this, thank you!
task 1- Final.dyn (15.4 KB)
task 1- Final.rvt (5.6 MB)