Modified Floor Top Surface

Hi @interactiverendering
Something like this should work :

But I get the feeling that dynamo is going to have a hard time getting the geometry of this floor… I came up with a bit of code as a workaround to a similar issue in the past. It could be improved but here it is :

image

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import Surface as DSSurf
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
import sys
pyt_path = r'C:\\Program Files (x86)\\IronPython 2.7\\Lib'
sys.path.append(pyt_path)
import collections

def tolist(input):
	if isinstance(input,list):
		return UnwrapElement(input)
	else:
		return [UnwrapElement(input)]

def flatten(l):
    for el in l:
        if isinstance(el, collections.Iterable) and not isinstance(el, basestring):
            for sub in flatten(el):
                yield sub
        else:
            yield el

def tostring(x):
	return x.ToString()
def getgeomlist(x,opt):
	return list(x.get_Geometry(opt))
def getlength(c):
	return c.Length

def getfaces(x,opt):
	#getting geometryelements as list
	geomelems = getgeomlist(x,opt)
	#getting nested instance geometry for all geometry instances
	while any('GeometryInstance' in g for g in map(tostring,geomelems)):
		for index,i in enumerate(geomelems):
			if 'GeometryInstance' in i.ToString():
				geomelems[index] = i.GetInstanceGeometry()
			else:
				continue
	geomelems = list(flatten(geomelems))
	#getting all faces, keeping meshes
	faces = []
	for i in geomelems:
		if 'Solid' in i.ToString():
			faces.append(list(i.Faces))
		elif 'Mesh' in i.ToString():
			faces.append(i)
		else:
			continue
	faces = list(flatten(faces))
	return faces

geomoptions = Options()
fcs = []
elems = tolist(IN[0])
for e in elems:
	faces = getfaces(e,geomoptions)
	tlist = []
	for f in faces:
		try:
			tlist.append(f.ToProtoType(True))
		except:
			edges = list(f.GetEdgesAsCurveLoops())[0]
			dsedges = [e.ToProtoType(True) for e in edges]
			crosssections = sorted(dsedges,key = getlength)[-2:]
			loft = DSSurf.ByLoft(crosssections)
			tlist.append(loft)
	fcs.append(tlist)

OUT = fcs
2 Likes