I’m working on a graph and at the same time trying to improve my python skills.
So I’m attempting to take some of the OOTB Revit nodes and convert them to code in a Python Node.
So what I have so far is a list of elements. For my example they are just Detail Lines.
I’m inputting that list into a Python node and then looping through the list attempting to extract the curve of the element.
So my code:
# Load the Python Standard and DesignScript Libraries
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import RevitNodes
clr.AddReference("RevitNodes")
import Revit
# Import Revit elements
from Revit.Elements import *
# Import DocumentManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
import System
# The inputs to this node will be stored as a list in the IN variables.
inCurves = list(UnwrapElement(IN[0]))
test = []
for x in inCurves:
temp = Revit.Elements.CurveElement(x)
test.append(temp)
OUT = test
Using the OOTB node I end up with the curve of the Detail Lines, but using the code I get an error. Not sure why, but also not sure if my code is right.
Error:
TypeError: Cannot create instances of CurveElement because it is abstract