Get lines and arcs of doors

python
#1

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 :slight_smile:
Kind regards,
Jannis

0 Likes

#2

Hmmm… Good question :slight_smile:

Get element geometry doesn’t work, it only gives a solid.

I don’t believe there is a node for this…

There is a Class for SymbolicCurve
http://www.revitapidocs.com/2018/c6c3bde4-4aa9-1b08-cd71-2fad0613d276.htm

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 :slight_smile:

Apologies,

Mark

0 Likes

#3

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 did find this but couldn’t get it to work for me: https://thebuildingcoder.typepad.com/blog/2011/08/retrieving-lines-within-a-family-instance.html

1 Like

#4

Sorry Kenny, or maybe @Kulkul is around? :smiley:

1 Like

#5

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?

0 Likes

Detail lines from door family
#6

Model lines get returned, but not symbolic…

1 Like

#7

Hi @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 


EDIT : Added the Geometry.Transform

5 Likes

#8

Awesome Alban,

Do you have a link to find out more about the IsInstance?

My example door had a masking region rather than lines to show the door panel and I would like a list of things which I can search for…!

Hope that makes sense,

Mark

0 Likes

#9

Here is a link with the isinstance() function :
https://www.programiz.com/python-programming/methods/built-in/isinstance

if you delete the check ( isinstance), you get the list of all the symbol geometries.

Surprisingly, the masking region appears as a solid and can’t be convert in Dynamo geometry.

1 Like

#10

I got a bounding box from it, but it’s quite big…!

image

image

:smiley:

0 Likes

#11

Wow, this works just perfect. Thank you so much :slight_smile: That´s really exactly what I needed.

0 Likes

#12

Hi Jannis,

I made a custom node : FamilyInstance Symbolic Lines with a better script in the Genius Loci package.
It will be more convenient :slightly_smiling_face:

FamilyInstance%20Symbolic%20Lines

3 Likes

#13

Thanks again Alban, this is just working perfectly :slight_smile:

0 Likes