How to create a polycurve from irregularly shaped floors?

I’m having trouble creating polycurves out of these floors that have modified point levels compared to a regular one. Is there a way to get these boundaries as a closed curve?


I am afraid that the element sketch might be always flat, regardless to modified elevations of it’s points (it is so in Revit).
You can try the code below. Rather than using sketch it extracts edges from top faces of the floor and tries to remove duplicates/internal edges. Seems to work. As a result you can get a 3D polycurve with elevated points.

import clr

#The inputs to this node will be stored as a list in the IN variables.
floors = UnwrapElement(IN[0])

from Autodesk.Revit.DB import *

import RevitServices
from RevitServices.Persistence import DocumentManager

import Revit

doc = DocumentManager.Instance.CurrentDBDocument

output = []

for f in floors:
	curve_list = []
	top_face_refs = HostObjectUtils.GetTopFaces(f)
	top_faces = []
	temp_edges = []
	#get all edges
	for face_ref in top_face_refs:
		face = doc.GetElement(face_ref).GetGeometryObjectFromReference(face_ref)
		if not face is None:
			edge_arrays = face.EdgeLoops
			for edges in edge_arrays:
				for e in edges:
	#remove internal edges
	for e in temp_edges:
		f0 = e.GetFace(0)
		f1 = e.GetFace(1)
		valid = False
		if f0 is None:
			valid = True
			if not f0 in top_faces:
				valid = True
		if f1 is None:
			valid = True
			if not f1 in top_faces:
				valid = True
		if valid:
			c = e.AsCurve()

#Assign your output to the OUT variable.
OUT = output

it works perfectly. Thanks a lot! This is just what I needed.

1 Like