List line to curve

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…?

@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

3 Likes


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)

@hojukys

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

KR

Andreas

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…?

@hojukys

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


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.

1 Like


In the nodes ‘PolyCurve.ByJoinedCurves’, my input is all ‘Line’ and it is linked with curves, but why the error is occured?

@hojukys , hi

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

KR

Andreas


A error is not exact…

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

1 Like