How to get perimeter curves from roofs?

Hello,

this is my code so far…

import sys
import clr
import System
from System.Collections.Generic import List
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB
from Autodesk.Revit.DB.Structure import *


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

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

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

collector = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Roofs)
all_roofs = collector.WhereElementIsNotElementType().ToElements()

lst_Geo = []
opt = Options()

for i in all_roofs:
    geoset = i.get_Geometry(opt)
    for geo in geoset:
        if isinstance(geo, DB.Solid):
            lst_Geo.append(geo)
        elif isinstance(geo, DB.GeometryInstance):
            for geoi in geo.GetInstanceGeometry():
                if isinstance(geoi, DB.Solid):
                    lst_Geo.append(geoi)

edges = [g.Edges for g in lst_Geo]

edge = [e for e in edges]


OUT = edges, edge

it worked pretty well, but it is listing any edge how can i get the perimeter edges?

here is a costum node hardcoded from Rhythm @john_pierson

have i to access the path for getting the edges (perimeter)

KR

Andreas

Have a look to the custom node package clockwork Element.Location it gets the sketch lines but edges perimeter is not necessarily the length of sketch lines

3 Likes

Hi Andreas…how about collect element sketch from spring it will give the footprint

3 Likes

This is one of those geometry tasks which is easier in Dynamo than Revit API.

  1. Get the element’s solids.
  2. Get the faces from the solids.
  3. Get the ‘top’ faces by filter out any face in #2 where the Z axis of the associated surface’s normal isn’t greater than 0.
  4. Get the ‘side’ faces by filtering out any face in #2 where the Z axis of the associated surface’s normal isn’t 0.
  5. Pull the edges from the top and side faces, and flatten the lists so you have the edges which make up the perimeter of the top faces in one flat list, and the edges which make up the perimeter of the side faces in another.
  6. Use a List.SetIntersection on the two lists to get the edges which are present in both lists. Those are the top perimeter edges.
3 Likes