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
Love spell casting - Black Magic Islam Nice information i like it
ReplyDeleteIMPRESSED WITH SUCH A GOOD CONTENT!!
ReplyDeleteVERY INTERESTING
GREAT WORK
Bim consulting
Tula's International is one of the leading Co-Ed boarding schools. Admission Open for classes 5th to 12th. Best School in Dehradun with hostel facility. CBSE Affiliated school with Friendly Secured Campus since 2013.
ReplyDeleteTula's International School Best Boarding school in India with hostel facility