Hi,
according to this post: Get the element of the selected edge
I try to return the edge element I can keep working with on Dynamo.
I want the edge in order to use “Edge.AdjacentFaces” node.
if I use “edge.ToDSType()” I get an error the Edge element has no attribute “ToDSType”/
if I return “edge” I got a “Revit.DB” element I can’t keep using on Dyanmo.
import clr
clr.AddReference("RevitAPIUI")
from Autodesk.Revit.UI import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
sel1 = uidoc.Selection
ot1 = Selection.ObjectType.Edge
refs = sel1.PickObjects(ot1, "Select the desired edges and press Finish")
edges = []
for i in xrange(len(refs)):
el1 = doc.GetElement(refs[i].ElementId)
edge = el1.GetGeometryObjectFromReference(refs[i])
edges.append(edge.GetFace(0).ToProtoType())
edges.append(edge.GetFace(1).ToProtoType())
OUT = edges,el1,edge.AsCurve().GetEndPoint(0).ToPoint(),edge
I solve the issue by returning the faces from the script but I still want to expand my knowledge about return edge element.