Hi everyone,
I would like to get the arcs and lines of the set doors in my viewport to produce custom fillings for these.
I know that this could be handled by setting these fillings up in the door families, but I would like to get this as an additive process.
Does anyone know how to extract these from a door element? I get it to unwrap with “door = UnwrapElement(IN[0])”, but I don´t know how to extract the lines and arcs now.
Thanks for helping me on this one
Kind regards,
Jannis
We can get Geometry and GeometryCurve from there, but I’m not sure how to drill down from a Family Type in the API to get it, @kennyb6 is a master at this kind of thing
Lol thanks for the shout out but I am not that good with this stuff and even less so when it comes to families. I can get the individual solids within a family but can’t find the symbolic lines from a plan view. Hopefully someone much more experienced with families and their docs like @erfajo can help out.
I think that element geometry sometimes works, depending on how the doors are built (not here to debate merit of one method or the other, just to talk Dynamo). Any chance you could upload a file with a door illustrating how your library is built @Jannis?
Yes it is possible.
You will have to translate the geometry from the internal origin of the project to the position of the instance.
Thanks for the link @kennyb6 !
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 *
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
items = UnwrapElement(IN[0])
if not hasattr(items, '__iter__'):
items = [items]
lineList,arcList=[],[]
opt = Options()
opt.IncludeNonVisibleObjects = False
opt.View = doc.ActiveView
for item in items:
geoEle=item.get_Geometry(opt)
for geoInstance in geoEle:
allLines,allArcs=[],[]
for symbIns in geoInstance.SymbolGeometry:
if isinstance(symbIns, Line):
lines = symbIns
allLines.append(lines.ToProtoType())
if isinstance(symbIns, Arc):
arcs = symbIns
allArcs.append(arcs.ToProtoType())
lineList.append(allLines)
arcList.append(allArcs)
OUT=lineList,arcList
I corrected the cutom node on Github.
(Right click and Save As on the Raw button.)
Replace the old node in C:\Users\%USERNAME%\AppData\Roaming\Dynamo\Dynamo Revit\2.13\packages\Genius Loci\dyf