Alright, so give me a day and a crash course in Python and we’ll see what we can do.
The revised platonic version of the python script that can get edges and respective references for a group or single object is below:
#Alban de Chasteigner 2019
#twitter : @geniusloci_bim
#geniusloci.bim@gmail.com
#Edited By: Daniel Masten 2022
import clr
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
from Revit.Elements import *
items = UnwrapElement(IN[0]) if isinstance(IN[0],list) else [UnwrapElement(IN[0])]
allEdges,allReferences=[],[]
opt = Options()
opt.ComputeReferences = True
#opt.IncludeNonVisibleObjects = True
#opt.View = doc.ActiveView
for item in items:
for obj in item.get_Geometry(opt):
if isinstance(obj, Solid):
elmtEdges,elmtReferences=[],[]
for edges in obj.Edges:
elmtEdges.append(edges.AsCurve().ToProtoType())
elmtReferences.append(edges.Reference)
allEdges.append(elmtEdges)
allReferences.append(elmtReferences)
if isinstance(IN[0], list): OUT = allEdges,allReferences
else: OUT = allEdges[0],allReferences[0]
Here is the custom node:
EdgeReferences.dyf (9.7 KB)
For the editors of Dynamo OOTB nodes I have two recommendations:
- The node ‘ElementCurveReference.ByCurve’ needs to be modified so that it can accept edge curves that are in fact derived from revit faces. If the node ‘ElementFaceReference.BySurface’ can get a face reference from a surface, then curve references should be able to be extracted from that same surface’s edges too.
- It may be helpful to extract edge curves from an element directly, and it would make sense to do it with the 'Element.Curves node:
If faces can be extracted from an element, lets be able to get those edges too.
Thanks.
