Line.ByStartPointDirectionLength (Revit API)

Hello,

We all recognize this node:
image

My question to you is if any of you know if there is an equivalent function in the Revit API.
Or possibly how to achieve the same result but in a different way.

I have searched but can not find a method that replaces the ByStartPointDirectionLength node.

Best regards,
Mikael

You could create the line with that node, then convert the line that is created into a revit line?

An example

import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

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

def lineDB_ByStartPointDirectionLength(pta, vector, length):
	vector = vector.Normalize() * length
	return DB.Line.CreateBound(pta, pta + vector)
	
startPoint = XYZ(1,1,1)
vector = XYZ(1,3,0)
length = 3
line = lineDB_ByStartPointDirectionLength(startPoint,  vector, length)	

OUT = line, line.ToProtoType()
2 Likes

Thank you @c.poupin !

That was the solution I was looking for :slight_smile:

Best regards,
Mikael Zeylon