# Modified Floor Top Surface

**URL:** <https://forum.dynamobim.com/t/modified-floor-top-surface/16196>\
**Category:** Geometry\
**Created:** [November 3, 2017, 9:04am UTC](https://forum.dynamobim.com/t/modified-floor-top-surface/16196 "2017-11-03T09:04:12Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![interactiverendering](https://avatars.discourse-cdn.com/v4/letter/i/db5fbb/32.png) [@interactiverendering](https://forum.dynamobim.com/u/interactiverendering)\
**Post date:** [November 3, 2017, 9:04am UTC](https://forum.dynamobim.com/t/modified-floor-top-surface/16196/1 "2017-11-03T09:04:12Z")

</div>

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.

 ![Capture](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/c/ec5d9693537ac5eefac1673761ce7cc4aee1b4bc.png)  
 ![Capture1](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/9/d993a1722c001b2ffe3533bb88ee74e8656d99cf.PNG)

---

<div class="post-metadata">

**Author:** ![Mostafa\_El\_Ayoubi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mostafa_el_ayoubi/32/7815_2.png) [@Mostafa\_El\_Ayoubi](https://forum.dynamobim.com/u/Mostafa_El_Ayoubi)\
**Post date:** [November 3, 2017, 4:28pm UTC](https://forum.dynamobim.com/t/modified-floor-top-surface/16196/2 "2017-11-03T16:28:26Z")

</div>

Hi @interactiverendering  
Something like this should work :

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/0/90b29b18d68ea74aecdf91beabd8f65872984d23.png)

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](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/a/ca17b13e3fb67e4e327516fed4a452e11dac93ef.png)

```
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
```

---

<div class="post-metadata">

**Author:** ![interactiverendering](https://avatars.discourse-cdn.com/v4/letter/i/db5fbb/32.png) [@interactiverendering](https://forum.dynamobim.com/u/interactiverendering)\
**Post date:** [November 3, 2017, 7:36pm UTC](https://forum.dynamobim.com/t/modified-floor-top-surface/16196/3 "2017-11-03T19:36:06Z")

</div>

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

 ![Capture11](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/b/0b18a06fb710c2a9bfe252e0d488caa1ca784afd.PNG)

---

<div class="post-metadata">

**Author:** ![Mostafa\_El\_Ayoubi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mostafa_el_ayoubi/32/7815_2.png) [@Mostafa\_El\_Ayoubi](https://forum.dynamobim.com/u/Mostafa_El_Ayoubi)\
**Post date:** [November 3, 2017, 8:30pm UTC](https://forum.dynamobim.com/t/modified-floor-top-surface/16196/4 "2017-11-03T20:30:37Z")

</div>

No problem 🙂 What is your end goal?

---

<div class="post-metadata">

**Author:** ![interactiverendering](https://avatars.discourse-cdn.com/v4/letter/i/db5fbb/32.png) [@interactiverendering](https://forum.dynamobim.com/u/interactiverendering)\
**Post date:** [November 3, 2017, 8:45pm UTC](https://forum.dynamobim.com/t/modified-floor-top-surface/16196/5 "2017-11-03T20:45:16Z")

</div>

![B0029E29-B402-4709-84B6-98B5382D1E8D](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/e/2eed12955843760f2c41d98136bce228f872154f.jpeg)

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)

---

<div class="post-metadata">

**Author:** ![Mostafa\_El\_Ayoubi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mostafa_el_ayoubi/32/7815_2.png) [@Mostafa\_El\_Ayoubi](https://forum.dynamobim.com/u/Mostafa_El_Ayoubi)\
**Post date:** [November 3, 2017, 9:00pm UTC](https://forum.dynamobim.com/t/modified-floor-top-surface/16196/6 "2017-11-03T21:00:47Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/f/7f7df44739e036c51efecab4d1c352e0692809aa.png)  
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…

---

<div class="post-metadata">

**Author:** ![interactiverendering](https://avatars.discourse-cdn.com/v4/letter/i/db5fbb/32.png) [@interactiverendering](https://forum.dynamobim.com/u/interactiverendering)\
**Post date:** [November 3, 2017, 9:06pm UTC](https://forum.dynamobim.com/t/modified-floor-top-surface/16196/7 "2017-11-03T21:06:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Yna\_Db](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/yna_db/32/30641_2.png) [@Yna\_Db](https://forum.dynamobim.com/u/Yna_Db)\
**Post date:** [November 3, 2017, 9:08pm UTC](https://forum.dynamobim.com/t/modified-floor-top-surface/16196/8 "2017-11-03T21:08:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mostafa\_El\_Ayoubi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mostafa_el_ayoubi/32/7815_2.png) [@Mostafa\_El\_Ayoubi](https://forum.dynamobim.com/u/Mostafa_El_Ayoubi)\
**Post date:** [November 3, 2017, 9:21pm UTC](https://forum.dynamobim.com/t/modified-floor-top-surface/16196/9 "2017-11-03T21:21:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![interactiverendering](https://avatars.discourse-cdn.com/v4/letter/i/db5fbb/32.png) [@interactiverendering](https://forum.dynamobim.com/u/interactiverendering)\
**Post date:** [November 3, 2017, 9:31pm UTC](https://forum.dynamobim.com/t/modified-floor-top-surface/16196/10 "2017-11-03T21:31:47Z")

</div>

Great! Thank you very much Mostafa 🙂

---

<div class="post-metadata">

**Author:** ![interactiverendering](https://avatars.discourse-cdn.com/v4/letter/i/db5fbb/32.png) [@interactiverendering](https://forum.dynamobim.com/u/interactiverendering)\
**Post date:** [November 3, 2017, 9:33pm UTC](https://forum.dynamobim.com/t/modified-floor-top-surface/16196/11 "2017-11-03T21:33:06Z")

</div>

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