The code in the link you refered needs to be modified to match the changes happened in Revit 2016 API
Please find here the updated code
import clr
import math
clr.AddReference('RevitAPI')
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.DB import *
doc = __revit__.ActiveUIDocument.Document
app = __revit__.Application
t = Transaction(doc, 'Create Line')
t.Start()
#Create a sketch plane
origin = XYZ.Zero
normal = XYZ.BasisZ
plane = Plane(normal, origin)
skplane = SketchPlane.Create(doc, plane)
#Create line vertices
lnStart = XYZ(0,0,0)
lnEnd = XYZ(20,20,0)
#create NewLine()
line = Line.CreateBound(lnStart, lnEnd)
#create NewModelCurve()
crv = doc.Create.NewModelCurve(line, skplane)
t.Commit()
__window__.Close()
If this code satisifies your needs don't forget to mark this reply as an answer.
¯\_(ツ)_/¯
Let it work like a charm.
Mustafa Salaheldin
Digital Integration Manager, DuPod
Facebook |
Twitter |
LinkedIn