Modified Floor Top Surface

Hi all,

I was trying to get the surface of the modified floor points but still no success. as a start please see attached images of what im trying to do.

Thank you.


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

Thanks Mostafa, the second one works, just not sure if i can hide those lines as shown

No problem :slight_smile: What is your end goal?

My end goal is to get floor surface and if possible join them as one and show only the outside boundary (if not possible at least to get the boundary curves)

Oh so you just want the sketch of the floor ! There’s a node in spring nodes for that:


You can then make it a polycurve and use surface.bypatch to get the surface . But it’ll be flat . The top surface of the modified floor is tessellated and there’s not much you can do about that…

I tried that already but it’s not getting the boundary of top surface(modified floor points height) just the sketch whic is flat

Just as a workaround proposal, selecting the faces directly on the model with Springs.SelectFaces+ would not fit your needs?

1 Like

I see. This should work :
-get the geometry of top faces as shown previously
-join the surfaces with polysurface.byjoinedsurfaces
-get the perimeter curves of the polysurface

Great! Thank you very much Mostafa :slight_smile:

could work also i’ll try this as an option for now…Many Thanks :slight_smile: