Curve from line

how to create a curve from line by python.

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

OUT = Autodesk.DesignScript.Geometry.Curve.Offset(IN[0],0)
1 Like

Thank you very much.:+1::+1:

I want use multipul line for curve. single line to curve work is fine, but multiple line is not working.

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

a = IN[0]

if isinstance(a, list):
	a = a
else: a = [a]

e = []

for i in a:
	e.append(Autodesk.DesignScript.Geometry.Curve.Offset(i,0))
	
OUT = e
5 Likes

Thank you so much :+1::+1::+1:

Hello I tried this python script as I want to convert a list of lines and sublists into a curve list, but this works only with flatten list of lines. I think it is easy solution if you have an answer would be great. Thanks.

Although I tried to offset curve with no offset, as the python code, it sounds silly solution, but is this an appropriate way to get the list of lines transformed into curves list?
image

Hi @RubenVivancos the python made by @fluffyhugger is for @L2 list level, you have modify the python or create a custom node for work with different level list.
Cheers

is possible to get lines from curves? opposite operation

Curve.PointAtParameter(c,0) = StartPoint
Curve.PointAtParameter(c,1) = EndPoint

line = Line.ByStartAndEndPoint(StartPoint,EndPoint)

@fluffyhugger that script seems to be returning Lines when fed a flattened list of Lines.

same here… the offset trick doesn’t work anymore in Dynamo 2.12.
some methods in the Revit API only accept Curves not Lines (FamilyCreate.NewModelCurve in my case)

2 Likes

I face the same issue