Creation of curves "In" a drafting view


Evening all,

Anyone got a starting point for creating detail lines in drafting views using geometry, curves taken from Dynamo or Revit?

Slightly odd asking about creation of 2d, but I’ve got a number of curved facades and the need is for unfolded elevations… Any thoughts, (except “…why are you drawing it flat in the first place?”) welcomed.




Hi Rory,

It seems there is nothing in dynamo out of the box nor in the package manager, so I drafted something quick. Look for the DetailLine.ByCurveAndView in the package manager:



It’s quite rudimentary - only taking a flattened list of curves and a single view, so if you need something more than this, you’ll have to build on top of it.

Good luck!



Thanks, this is working wonderfully. I’ll post my definition (which is the use case) when deadlines have passed.

Thanks again,



Dimitar, this is good, but I am afraid that it will fail a ton when dealing with anything other than Lines and Arcs. As far as I can tell ToDSType() doesn’t process NurbsCurves properly. It also, can’t do things like Ellipse or Circle. I started writing those methods last week. Here’s a work in progress for now. I am sad to say that Nurbs Curves in Revit are like dark magic and fail almost every time…I have had issues with closed nurbs curves as well as regular ones and opted to go with hermite spline (which is an interpolated spline through points) for most of the nurbs. You can see that they fail if curve degree is different than 3 as well. The list goes on…anyways here’s what i have so far:

#Copyright© 2015, Konrad Sobon


import clr
import sys
from Autodesk.DesignScript.Geometry import *

Import DocumentManager and TransactionManager

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

Import RevitAPI

import Autodesk
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

pyt_path = r’C:\Program Files (x86)\IronPython 2.7\Lib’

from Autodesk.DesignScript.Geometry import *

from System import Array
from System.Collections.Generic import *
import math

#The inputs to this node will be stored as a list in the IN variable.
dataEnteringNode = IN
dsObjects = IN[0]
_lineStyle = UnwrapElement(IN[1][0])

def toRvtPoint(point):
unitsFactor = 3.28084 #Revit works in Feet while Dynamo in Meters
x = point.X * unitsFactor
y = point.Y * unitsFactor
z = point.Z * unitsFactor
return XYZ(x,y,z)

def toRvtType(dsObject):
if type(dsObject) == NurbsCurve:
points = []
subCurves = dsObject.DivideEqually(16)
for i in subCurves:
points.insert(len(points), subCurves[(len(subCurves)-1)].EndPoint)
controlPoints = ListXYZ
for i in points:
tangents = Autodesk.Revit.DB.HermiteSplineTangents()
endTangent = toRvtPoint(dsObject.TangentAtParameter(1))
startTangent = toRvtPoint(dsObject.TangentAtParameter(0))
tangents.EndTangent = endTangent.Normalize()
tangents.StartTangent = startTangent.Normalize()
return Autodesk.Revit.DB.HermiteSpline.Create(controlPoints, False, tangents)
elif type(dsObject) == Arc:
#convert DS Arc to Revit Arc
startPt = toRvtPoint(dsObject.StartPoint)
endPt = toRvtPoint(dsObject.EndPoint)
midPt = toRvtPoint(dsObject.PointAtParameter(0.5))
return Autodesk.Revit.DB.Arc.Create(startPt, endPt, midPt)
elif type(dsObject) == Line:
#convert DS Line to Revit Line
startPt = toRvtPoint(dsObject.StartPoint)
endPt = toRvtPoint(dsObject.EndPoint)
return Autodesk.Revit.DB.Line.CreateBound(startPt, endPt)
elif type(dsObject) == Circle:
#convert DS Circle to Revit Arc (for arcs with 2pi range will be automatically converted to circle)
center = toRvtPoint(dsObject.CenterPoint)
radius = dsObject.Radius * 3.28084 #converted to FT from M
startAngle = 0
endAngle = 2 * math.pi
xAxis = XYZ(1,0,0) #has to be normalized
yAxis = XYZ(0,1,0) #has to be normalized
return Autodesk.Revit.DB.Arc.Create(center, radius, startAngle, endAngle, xAxis, yAxis)
return dsObject.ToRevitType()

def makeRvtDetailLines(crv, _lineStyle):
detailLine = doc.Create.NewDetailCurve(doc.ActiveView, crv)
if detailLine != None:
detailLine.LineStyle = _lineStyle
return detailLine

def makeRvtDetailLines2(crv, _lineStyle):
detailLine = doc.Create.NewDetailCurve(doc.ActiveView, crv)
bipName = BuiltInParameter.BUILDING_CURVE_GSTYLE
lineStyle = detailLine.get_Parameter(bipName)
return detailLine

def processListArg(_func, _list, _arg):
return map( lambda x: processListArg(_func, x, _arg) if type(x)==list else _func(x, _arg), _list )

def process_list(_func, _list):
return map( lambda x: process_list(_func, x) if type(x)==list else _func(x), _list )

#“Start” the transaction

rvtElements = process_list(toRvtType, dsObjects)
rvtElements = processListArg(makeRvtDetailLines, rvtElements, _lineStyle)

“End” the transaction


#Assign your output to the OUT variable
OUT = rvtElements

pyRevit Script - LineStyle Change

Great work Konrad. That looks like a very extensive approach. Could you notify us, once you’ve added it to the package, so that I can depreciate my package?


Sure I will let you know. Its pretty extensive because ToRevitType() just doesn’t cover all of the bases. That’s about the only reason i did what i did.