List all walls currently in use
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Since I am still trying to Learn python, I used Chat GPT to ry and generate code to lsit all walls currently in use in the model.
This is what Chat GPT came up with:
# Import necessary modules
from Autodesk.Revit.DB import FilteredElementCollector, BuiltInCategory
from pyrevit import revit, DB
# Initialize the Revit document
doc = revit.doc
# Define the BuiltInCategory for Walls
walls_category = BuiltInCategory.OST_Walls
# Create a FilteredElementCollector to get all wall elements in the document
wall_collector = FilteredElementCollector(doc).OfCategory(walls_category)
# Create a list to store the in-use walls
in_use_walls = []
# Iterate through each wall and check if it's in use
for wall in wall_collector:
if not wall.IsDemolished(doc.ActiveView) and not wall.IsHidden(doc.ActiveView):
in_use_walls.append(wall)
# Print the names of in-use walls
for wall in in_use_walls:
print(wall.Name)
# You can also access other properties of the walls if needed
# For example, wall parameters like height, thickness, etc.
when I use the PythonShell to test it, it gives me an error saying there is no module 'pyrevit'. I do have pyRevit installed.
Hope someone can help with this. Thanks!
If you find my post interesting, feel free to give a Kudo.
If it solves your problem, please click Accept to enhance the Forum.
If it solves your problem, please click Accept to enhance the Forum.
Link copied