Hi, guys I ran into the issue with HostObjectUtils.GetSideFaces, it’s works well if element is not linked as you can see in picture below
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
doc = DocumentManager.Instance.CurrentDBDocument
surfaces = []
walls = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls).WhereElementIsNotElementType().ToElements()
for wall in walls:
side_face = HostObjectUtils.GetSideFaces(wall, ShellLayerType.Exterior)[0]
surface = wall.GetGeometryObjectFromReference(side_face).ToProtoType()[0]
surfaces.append(surface)
OUT = surfaces
But when I tried to feed linked wall elements the error is raising. Do you have any suggestions or where I can learn how to avoid that error? Thank you all in advance
That’s snippet of code below to obtain walls from link
import clr
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
import System
import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)
doc = DocumentManager.Instance.CurrentDBDocument
links = FilteredElementCollector(doc).OfClass(RevitLinkInstance)
link_docs = [link.GetLinkDocument() for link in links]
category = IN[0]
error_reports = []
result = []
for link_doc in link_docs:
try:
errorReport = None
result += FilteredElementCollector(link_doc).OfClass(Wall)
except:
import traceback
error_report = traceback.format_exc()
error_reports.append(error_report)
if len(error_reports) == 0:
OUT = result
else:
OUT = error_reports
And after code pretty much the same with the exception of input for walls
walls = IN[0]
surfaces = []
for wall in walls:
side_face = HostObjectUtils.GetSideFaces(wall, ShellLayerType.Exterior)[0]
surface = wall.GetGeometryObjectFromReference(side_face).ToProtoType()[0]
surfaces.append(surface)
OUT = surfaces