# Extracting closed Polycurves from given Surface

**URL:** <https://forum.dynamobim.com/t/extracting-closed-polycurves-from-given-surface/24086>\
**Category:** Geometry\
**Created:** [July 24, 2018, 1:18pm UTC](https://forum.dynamobim.com/t/extracting-closed-polycurves-from-given-surface/24086 "2018-07-24T13:18:41Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Mohammad\_Nawar](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mohammad_nawar/32/45287_2.png) [@Mohammad\_Nawar](https://forum.dynamobim.com/u/Mohammad_Nawar)\
**Post date:** [July 24, 2018, 1:40pm UTC](https://forum.dynamobim.com/t/extracting-closed-polycurves-from-given-surface/24086/2 "2018-07-24T13:40:35Z")

</div>

Yes you can use group curves then by joined curves as below.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/d/ed0784d1b25217383884ce7968adfe057f68a131.jpg)

You can find this node in archi-lab\_grimshaw package.

and below the script from the node if you couldn’t find the package.

```
#Copyright(c) 2015, Konrad Sobon
# @arch_laboratory, http://archi-lab.net

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

#The inputs to this node will be stored as a list in the IN variable.
dataEnteringNode = IN

inputCurves = IN[0]

#join/group curves function
def groupCurves(Line_List): 
	ignore_distance = 0.1 # Assume points this close or closer to each other are touching 
	Grouped_Lines = [] 
	Queue = set() 
	while Line_List: 
		Shape = [] 
		Queue.add(Line_List.pop()) # Move a line from the Line_List to our queue 
		while Queue: 
			Current_Line = Queue.pop() 
			Shape.append(Current_Line) 
			for Potential_Match in Line_List: 
				Points = (Potential_Match.StartPoint, Potential_Match.EndPoint)
				for P1 in Points: 
					for P2 in (Current_Line.StartPoint, Current_Line.EndPoint): 
						distance = P1.DistanceTo(P2) 
						if distance <= ignore_distance: 
							Queue.add(Potential_Match) 
			Line_List = [item for item in Line_List if item not in Queue]
		Grouped_Lines.append(Shape) 
	return Grouped_Lines

OUT = groupCurves(inputCurves)
```

---

_[View the full topic](https://forum.dynamobim.com/t/extracting-closed-polycurves-from-given-surface/24086)._
