Hi Everyone!
I’m trying to get the stairs path line on Dynamo. But, I can’t use the “ToProtoType()” attribute on Revit.DB.Line
Can someone help me?
Hi Everyone!
I’m trying to get the stairs path line on Dynamo. But, I can’t use the “ToProtoType()” attribute on Revit.DB.Line
Can someone help me?
Has resolved in topic.
How convert the line to a curve - Revit - Dynamo (dynamobim.com)
Hello,
an instance of CurveLoop is a IEnumerable<Curve>
so, you need to iterate on it to convert curves are inside this collection
import clr
import sys
import System
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS
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.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
elem = UnwrapElement(IN[0])
elemsStair = [doc.GetElement(x) for x in elem.GetStairsRuns()]
stairPathCurvLoop = elemsStair[0].GetStairsPath()
OUT = [x.ToProtoType() for x in stairPathCurvLoop]
i’m trying to understand this.
stairPathCurvLoop is Type CurveLoop
the line:
OUT = [x.ToProtoType() for x in stairPathCurvLoop]
iterates through the CurveLoop and converts each Revit.DB geometry to Dynamo. When i use this on my example, i still get the error ‘’’ ‘Line’ has no attribute ‘ToProtoType’ ‘’’
# Dynamo
import clr
import sys
clr.AddReference('RevitAPI')
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.UI import *
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI.Selection import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
view = UnwrapElement(IN[0]) # An element - should be an elevation
#Get CropRegionShapeManager from elevation
csm = view.GetCropRegionShapeManager()
#Get Crop Region shape
crshape = csm.GetCropShape()
#Assign your output to the OUT variable.
OUT = [c.ToProtoType() for c in crshape[0]]
Hi, you need to import the ‘GeometryConversion’ tools.
Read this