# Separate polysurface

**URL:** <https://forum.dynamobim.com/t/separate-polysurface/98667>\
**Category:** Geometry\
**Tags:** dynamo\
**Created:** [March 1, 2024, 4:59pm UTC](https://forum.dynamobim.com/t/separate-polysurface/98667 "2024-03-01T16:59:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Drbohlav](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/drbohlav/32/113004_2.png) [@Drbohlav](https://forum.dynamobim.com/u/Drbohlav)\
**Post date:** [March 1, 2024, 4:59pm UTC](https://forum.dynamobim.com/t/separate-polysurface/98667/1 "2024-03-01T16:59:16Z")

</div>

Hi, could you help me to separate polysurface please? I’ve found only node for solids separation.  
Thank you

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/b/1b67cc2cd710974e3cbc0f7bf82fb1d6eaef5ec6.png)

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [March 1, 2024, 5:45pm UTC](https://forum.dynamobim.com/t/separate-polysurface/98667/2 "2024-03-01T17:45:37Z")

</div>

Hi the Polysurface.Surfaces node returns you what list structure  
edit:  
taking the returned surfaces  
and extruding them by a small value  
(this will give you x solids)  
you unify them  
the centroid of this object is outside the polysurface  
you have a point to create a boundingbox and test the surfaces inside it  
a little convoluted I grant you that  
edit 2:  
I did a little digging:  
If the gap between the 2 polysurfaces is large enough to be able to create a section of the boundingbox it could work  
(the cut remains amateurism in this case since I am therefore watching cheating)

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/b/8b3360ce2b26f74fec1b33aca71e046a3a5b24da.png)  
 ![reponse 01 mars 2024_2024-03-01_08-44-32](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/3/c350752c5b5c0fcabed91e63caf9157c05dfefc5.png)

Wait for a more enlightened solution than mine  
Have a good evening  
Sincerely  
christian.stan

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [March 1, 2024, 11:17pm UTC](https://forum.dynamobim.com/t/separate-polysurface/98667/3 "2024-03-01T23:17:32Z")

</div>

🤔

Might be better to analyze the faces directly instead of solids or hoping for bounding boxes… might also be a means via mesh toolkit now that I think about it.

---

<div class="post-metadata">

**Author:** ![emrullah.yildiz](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/emrullah.yildiz/32/177572_2.png) [@emrullah.yildiz](https://forum.dynamobim.com/u/emrullah.yildiz)\
**Post date:** [March 2, 2024, 6:41am UTC](https://forum.dynamobim.com/t/separate-polysurface/98667/4 "2024-03-02T06:41:58Z")

</div>

Did you try Geometry.Split?

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [March 2, 2024, 10:06am UTC](https://forum.dynamobim.com/t/separate-polysurface/98667/5 "2024-03-02T10:06:23Z")

</div>

Hello, look at the node side

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/d/ad67ff1e9702299282115649c59a0b4069a377cd.png)

Sincerely  
christian.stan

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [March 4, 2024, 4:24pm UTC](https://forum.dynamobim.com/t/separate-polysurface/98667/6 "2024-03-04T16:24:39Z")

</div>

> [@Drbohlav](#):
>
> I’ve found only node for solids separation.  
> Thank you

I couldn’t think up a clean solution which doesn’t use C#, Python, or a custom design script definition.

The first on that list isn’t something readily distributed, and the last will usually lead to more questions than answers. So here’s some Python for you (you’ll have to build the means of iterating over a list of PolySurfaces (though you might just convert them to a single PolySurface first):

```auto
import sys,clr #import the sys and CLR modules
clr.AddReference('ProtoGeometry') #add the Dynamo geometry library to the CLR
from Autodesk.DesignScript.Geometry import * #import all of the Dynamo geometry library

polySurface = IN[0] #the polysurface to separate

faces = [i for i in polySurface.Faces] #pull the topology of the PolySurface

polysurfaces = [] #the resulting list of PolySurfaces

while faces: #while there are faces in the list
    toGroup = [faces.pop(0)] #pull the first face out and put it in the toGroup list
    grouped = [] #a list to hold the groups of faces
    
    while toGroup: #whiel there are items to group
        face = toGroup.pop(0) #pull the face out of the to group list
        grouped.append(face) #append the face to the grouped list
        edges = face.Edges #get the edges of the face
        adjFaces = [i for edge in edges for i in edge.AdjacentFaces] #get the adjacent faces for the edges
        
        for f in adjFaces: #for every face in the adjacent faces list
            if (f not in grouped) and (f not in toGroup): #if the face is not in the grouped list or in the toGroup list
                faces.remove(f) #remove the face from the faces list
                toGroup.append(f) #append the face to the toGroup list
    surfs = [f.SurfaceGeometry() for f in grouped] #convert the faces to surfaces
    polysurfaces.append(PolySurface.ByJoinedSurfaces(surfs)) #generate a polysurface and append to the list of polysurfaces

OUT = polysurfaces #return the list of PolySurfaces to the Dynamo environment

```
