Get Geometry of a family which has detail item

replace GetSymbolGeometry() method to GetInstanceGeometry()

1 Like


check that your family is clearly visible in the active view when launching the script

1 Like

Its working Poupin thanks a lot :+1:

a small update to process a list of input elements instead of a single element

import clr
from Autodesk.DesignScript.Geometry import *

import Autodesk
from Autodesk.Revit.DB import *

import Revit

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

def getgeometryDS(geo):
	surfaces = []
	edges = []
	lines = []
	if isinstance(geo, Solid):
		for face in geo.Faces:
		for edge in geo.Edges:
	if isinstance(geo, Line):	
	return surfaces, edges, lines		

elemlist = UnwrapElement(IN[0])
#get the actual view with the Detail Element is Visible
view = doc.ActiveView

if not hasattr(elemlist, "__iter__"):
	elemlist = [elemlist]

geofam = []

op = Options()
op.View = view
for elem in elemlist:
	geoms = elem.get_Geometry(op)
	for geoinst in geoms:
		if isinstance(geoinst, GeometryInstance):
			geosymbs = geoinst.GetInstanceGeometry()
			for geoelem in geosymbs:
				surfaces, edges, lines = getgeometryDS(geoelem)
				#check if geoelem is a valid Solid
				if all([ x.Count != 0 for x in [surfaces, edges]]):
					geofam.append([surfaces, edges, lines])
		if isinstance(geoinst, Solid):	
			surfaces, edges, lines	= getgeometryDS(geoinst)
			#check if geoinst is a valid Solid
			if all([ x.Count != 0 for x in [surfaces, edges]]):
				geofam.append([surfaces, edges, lines])

outsurface = [ x[0] for x in geofam]
outedges = [ x[1] for x in geofam]
outdetailLines = [ x[2] for x in geofam]
OUT = outsurface, outedges, outdetailLines 


hello @Alban_de_Chasteigner is possible to get the goemetry of the family types stored in the project file without the need of placing element instances of those family types? many thanks


Yes it is possible :

hello @Alban_de_Chasteigner , I supposed that the Element.Geometry node shows you the geometry but it is not true majority of times. For example I got a revit file with a library of many different revit families of model categories as generic models, site, equipment, furniture and I got more 900 family types and only 16 had a result of geometry, then I would like to know how to interrogate the families to get exactly the geometry embedded wether if it is solid, surface, mesh, lines, regions, symbols, points, inserted cad files, faces, whatever…if you think -I can open anew thread for this topic.

For example have a look to that family and see how it goes:

BIMINONE_Large-14WheelsFlatbedTrailer.rfa (3.5 MB)
This is what I get:

Hi @RubenVivancos
It is known the Element.Geometry node have a lot of issues, especially read complex geometry, there are some workarounds like Grasshopper.

any sample to follow? Speckle for Dynamo working for this?