Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FamilyItemFactory has no attribute NewSketchPlane (Revit 2016)

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Anonymous
908 Views, 1 Reply

FamilyItemFactory has no attribute NewSketchPlane (Revit 2016)

Hi. I am trying to create Line in Revit 2016 using RevitPytonShell like in this tutorial:

http://wiki.theprovingground.org/revit-api-py-curves (Drawing a Line section)

But when I execute code I get error message "...FamilyItemFactory has no attribute NewSketchPlane..."

What is the problem here?

1 REPLY 1
Message 2 of 2
Mustafa.Salaheldin
in reply to: Anonymous

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


EESignature




Digital Integration Manager, DuPod

Facebook | Twitter | LinkedIn

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report