Skip to main content

Stacked Walls with Dynamo

Struggling trying to list stacked walls and their members with Revit?
The answer is Dynamo and Python. Copy and paste this code into a Python node in Dynamo and you'll get as output the list of Stacked walls instances and all the related members.

####################################################################
#Copyright 2017©
#Twitter: @CesareCaoduro
#Email: cesare.caoduro@gmail.com
####################################################################
#Declaration section
import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

import os

clr.AddReference('RevitAPIUI')
from  Autodesk.Revit.UI import *

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

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

#Active document
doc = DocumentManager.Instance.CurrentDBDocument
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.Creation import *
####################################################################
#Start a transaction on the active document
TransactionManager.Instance.EnsureInTransaction(doc)


#Insert here you code#
input = IN[0]
col = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_StackedWalls).WhereElementIsNotElementType()

lstStackedWallsMembers = []
lstStackedWalls = []
for c in col:
lst = []
ids = c.GetStackedWallMemberIds()
for id in ids:
lst.append(doc.GetElement(id).ToDSType(True))
lstStackedWallsMembers.append(lst)
lstStackedWalls.append(c.ToDSType(True))

#Dispose the active transaction
TransactionManager.Instance.TransactionTaskDone()
####################################################################
OUT = lstStackedWalls, lstStackedWallsMembers

Comments

Post a comment

Popular posts from this blog

Dynamo, Revit, Excel, UI...what a wonderful day!

Introduction Today I'll show you two examples of how to use Dynamo to export existing Revit schedules and how to compose a custom schedule on the fly, to be exported to Excel.
Both of them with a very nice graphical user interface thanks to Data-Shapes (https://data-shapes.net/) package.
Export Schedules Let's start from the easier. The idea behind this script is to export a list of existing schedules to an Excel file, creating for each schedule a separate tab. To be able to complete this script you'll need two packages: Data-Shapes for the graphical interfacesBimorphNodes to extract schedules data The script is very easy and you have to focus only on how to create an interface Then you can use your input to feed the next nodes. Finished! So just push the run button (or use Dynamo Player is you are in Revit 2017.1 or 2017.2) and enjoy the interface.

Export parameters to Excel In the second script I'll focus on something more interesting. Many times we need to just extr…

Tunnel modeling with Dynamo

Introduction Last week I had a nice conversation with one of my Italian friends. The focus of the conversation was how to model a tunnel in Revit starting from an Excel list of points coming out from Civil 3D.
So the answer was: Dynamo of course!

First input, the section of the tunnel with his diameter; I can't share the details but lets say that we have:

Theoretical excavation profile: 200 mm Precast segment thickness: 500 mm Whit this two elements and the excel of the theoretical cent alignment, we can do everything! Revit profile family The first family we're going to create is a simple circle profile with a diameter parameter. This family will be as a mass category to be able to nest it later in an adaptive component family for the tunnel.  Just save this family...easy!
Tunnel model Now we can create a new family as generic adaptive component and load the profile just created. It's important that the family is able to host rebars for future structural modeling. Whit th…

Multi-pipe support configurator with Dynamo

As always everything is coming from my childhood…ops no, that's another story.
As always everything starts on a white recycled paper just in front of my keyboard; a simple idea becomes immediately a sketch with Revit parameters.


I tried many times different kind of plugins for automatic supports placement, but no one of these is able to create a multi-pipes supports (if I'm wrong, please let me know the name of the plugin). The idea for this script in Dynamo, is to create a support for a bounce of pipes going parallel for a while, and create a group that is possible to copy along the path. I'll not focus on the creation of the families that you need for the support but just to explain the main idea, I have 3 different pieces (steel bar, u-bolt and threaded rod) that I'll compose together to create the final support. The first challenge is to align the pipes to the same BOP (bottom of pipe) because they have to stand on the steel bar and locked with the u-bolt.  The bas…