# List line to curve

**URL:** <https://forum.dynamobim.com/t/list-line-to-curve/76624>\
**Category:** Uncategorized\
**Created:** [May 17, 2022, 7:20am UTC](https://forum.dynamobim.com/t/list-line-to-curve/76624 "2022-05-17T07:20:42Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![hojukys](https://avatars.discourse-cdn.com/v4/letter/h/e0b2c6/32.png) [@hojukys](https://forum.dynamobim.com/u/hojukys)\
**Post date:** [May 17, 2022, 7:20am UTC](https://forum.dynamobim.com/t/list-line-to-curve/76624/1 "2022-05-17T07:20:42Z")

</div>

I want to convert the list line to polycurve. but the input is list so I can’t convert the line to polycurve.  
So, finally I want to change all line element to polycurve.  
How can I change…?

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

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [May 17, 2022, 7:37am UTC](https://forum.dynamobim.com/t/list-line-to-curve/76624/2 "2022-05-17T07:37:20Z")

</div>

@hojukys , hi

your list is merged by differend linetypes. Try _sortByFunction_ access your lines via _ItemAtIndex_ than you can make out of Lines → polycurves!

KR

Andreas

 ![2022-05-17_10h16_04](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/9/d965a580aae6afaf4460861f15411a90146443f0.png)

---

<div class="post-metadata">

**Author:** ![hojukys](https://avatars.discourse-cdn.com/v4/letter/h/e0b2c6/32.png) [@hojukys](https://forum.dynamobim.com/u/hojukys)\
**Post date:** [May 17, 2022, 9:17am UTC](https://forum.dynamobim.com/t/list-line-to-curve/76624/3 "2022-05-17T09:17:52Z")

</div>

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/c/8c159ae7e447bcec9ceec8bc0477ef2f76f61947.png)  
Yeah but I want to deconstruct the polycurves to points so, I want to mark on floor plan.  
But your way only returns only one point and segment.  
I tried making the node(List.GroupByFunction)

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [May 17, 2022, 12:07pm UTC](https://forum.dynamobim.com/t/list-line-to-curve/76624/4 "2022-05-17T12:07:13Z")

</div>

@hojukys

Can you use either Roombounderies? what is your final aim?

KR

Andreas

---

<div class="post-metadata">

**Author:** ![hojukys](https://avatars.discourse-cdn.com/v4/letter/h/e0b2c6/32.png) [@hojukys](https://forum.dynamobim.com/u/hojukys)\
**Post date:** [May 17, 2022, 1:13pm UTC](https://forum.dynamobim.com/t/list-line-to-curve/76624/5 "2022-05-17T13:13:12Z")

</div>

Yeah. I can use either Roombounderies. My final aim is to deconstruct polycurves to points and then select 4points in Revit to make retangle surfaces to divide each zone (like space planning).  
Is it possible…?

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [May 17, 2022, 3:45pm UTC](https://forum.dynamobim.com/t/list-line-to-curve/76624/6 "2022-05-17T15:45:47Z")

</div>

@hojukys

```auto
import sys
import clr
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion) 

rooms = []
for i in IN[0]:
	rooms.append(UnwrapElement(i))

curves = []

opt = SpatialElementBoundaryOptions()

for room in rooms:
	if room.Area > 0: # Make sure it has positive Area, i.e is placed
		rvBoundary = room.GetBoundarySegments(opt) # Get room boundary
		dsBoundary = [] # A Dynamo list to hold the boundary per room, remember it can be complex, with holes		
		for rvLoop in rvBoundary: # For each loop in the room boundary
		
			dsLoop = [] # A list to hold each room's loop
			
			for rvPiece in rvLoop:	# Retrieve each segment of the loop
				dsPiece = Revit.GeometryConversion.RevitToProtoCurve.ToProtoType(rvPiece.GetCurve(),True) # Read the segment as Curve and convert to Dynamo geometry
				dsLoop.append(dsPiece) # Add the piece to the Dynamo Loop
			dsBoundary.append(dsLoop) # Add the Dynamo Loop to the Dynamo Boundary
		curves.append(dsBoundary) # Add the Dynamo Boundary per room to the Curves list

OUT = curves

```

so i copy/pasted some stuff it works in my example

 ![CreateRoomBounderies_2022-05-17_05-43-11](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/7/7787dda787accfa6cbd1de1a1553a44c9c7f2f24.png)  
 ![1](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/2/22306c3c45394b520dc6b5fad6e1b30995733088.png)

---

<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:** [May 17, 2022, 10:05pm UTC](https://forum.dynamobim.com/t/list-line-to-curve/76624/7 "2022-05-17T22:05:29Z")

</div>

If you’re actually doing space planning, I personally prefer using a surface for the totality of the room, and subdividing it into ‘cells’ via isocurves. Found it to be a bit more consistent for irregular room shapes which never come up at first, but break everything the first time they do.

---

<div class="post-metadata">

**Author:** ![hojukys](https://avatars.discourse-cdn.com/v4/letter/h/e0b2c6/32.png) [@hojukys](https://forum.dynamobim.com/u/hojukys)\
**Post date:** [May 19, 2022, 5:28am UTC](https://forum.dynamobim.com/t/list-line-to-curve/76624/8 "2022-05-19T05:28:38Z")

</div>

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/8/f8b3ecc3c9644c78566c130ab3bb1cafac865e45.png)  
In the nodes ‘PolyCurve.ByJoinedCurves’, my input is all ‘Line’ and it is linked with curves, but why the error is occured?

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [May 19, 2022, 6:35am UTC](https://forum.dynamobim.com/t/list-line-to-curve/76624/9 "2022-05-19T06:35:05Z")

</div>

@hojukys , hi

by the way you should indexing by _Integer_  
Can you show the warning

KR

Andreas

---

<div class="post-metadata">

**Author:** ![hojukys](https://avatars.discourse-cdn.com/v4/letter/h/e0b2c6/32.png) [@hojukys](https://forum.dynamobim.com/u/hojukys)\
**Post date:** [May 20, 2022, 7:02am UTC](https://forum.dynamobim.com/t/list-line-to-curve/76624/10 "2022-05-20T07:02:53Z")

</div>

[https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/1/010a1a4778bef180243d6ea032f138aa4a87bfe2.mp4](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/1/010a1a4778bef180243d6ea032f138aa4a87bfe2.mp4)
  
A error is not exact…

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [May 20, 2022, 7:04am UTC](https://forum.dynamobim.com/t/list-line-to-curve/76624/11 "2022-05-20T07:04:11Z")

</div>

hahaha that looks funny i think it means something like “…unexpected” @hojukys
