I am using Room Boundaries node by archilab to get the room bounding elements such as Wall, columns.
But this node is giving some duplicated elements (walls).
I can eliminate duplicates but I don’t want to eliminate them when there is a rectangular column with multiple sides inside the room boundary.
Please suggest how to remove those wall duplicates.
One of the wall is an exterior one (not shared with any other room) which is duplicated.
I can’t use List.Unique items, because there are rooms with rectangular columns in it. Those columns have different sides bounding the room and I want them to be counted maybe twice, thrice depending upon its position.
If anyone would like to have a look at the python code.
# Copyright(c) 2015, Konrad K Sobon
# @arch_laboratory, http://archi-lab.net
# This node was an update to Wall.Boundaries node
# that can be found in Clockwork package. Thanks
# to Andreas Dieckmann for making the original one.
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)
def Unwrap(item):
return UnwrapElement(item)
def ProcessList(_func, _list):
return map( lambda x: ProcessList(_func, x) if type(x)==list else _func(x), _list )
def GetRoomBoundary(doc, item, options):
eList = []
cList = []
try:
for i in item.GetBoundarySegments(options):
for j in i:
eList.append(doc.GetElement(j.ElementId))
cList.append(j.Curve.ToProtoType())
except:
calculator = SpatialElementGeometryCalculator(doc)
try:
results = calculator.CalculateSpatialElementGeometry(item)
for face in results.GetGeometry().Faces:
for bface in results.GetBoundaryFaceInfo(face):
eList.append(doc.GetElement(bface.SpatialBoundaryElement.HostElementId))
except:
pass
return [eList, cList]
if isinstance(IN[0], list):
items = ProcessList(Unwrap, IN[0])
else:
items = [Unwrap(IN[0])]
options = SpatialElementBoundaryOptions()
boundloc = AreaVolumeSettings.GetAreaVolumeSettings(doc).GetSpatialElementBoundaryLocation(SpatialElementType.Room)
options.SpatialElementBoundaryLocation = boundloc
elementList = []
curveList = []
try:
errorReport = None
if isinstance(items, list):
for item in items:
elementList.append(GetRoomBoundary(doc, item, options)[0])
curveList.append(GetRoomBoundary(doc, item, options)[1])
else:
elementList = GetRoomBoundary(doc, items, options)[0]
curveList = GetRoomBoundary(doc, items, options)[1]
except:
# if error accurs anywhere in the process catch it
import traceback
errorReport = traceback.format_exc()
#Assign your output to the OUT variable
if errorReport == None:
OUT = [elementList, curveList]
else:
OUT = errorReport
@theshysnail, what’s the final purpose of getting columns this way? Do you need bounding curves of columns?
Walls and all others are repeating, just use Room.FinishBoudary and you’ll see, N elements and N curves in room.
P.S. Do you have latest version of Archilab? _curve list must contains corresponding curves of elements. Or you can use Room.Boundaries from ClockWork package.