How to know if an element is a system element / loadable family / model in place element?
Are there any rules that allow to know that without having to select all the elements of type or similar?
Thanks
How to know if an element is a system element / loadable family / model in place element?
Are there any rules that allow to know that without having to select all the elements of type or similar?
Thanks
Non-system families have an IsInPlace
property that you can check. System families don’t have the typical family element that you’d expect as the “family” properties are specific to the system/category. For system elements you can just assume that “no family” means it’s a system element.
it seems complicated as I need to get elements and later the families of the elements, what I see that system families do not have “Family”, I am looking some straight forward way to retrieve the information, that process seems like 3 steps
I tried something like that by now:
That’s just the way it is. You could use Python to get that information much quicker, or even filter elements by type that way.
any example of Python to try?
Here is the IsInPlace
property. You would just have to attempt to get the family element for each instance. No family means it’s a system element and IsInPlace
will tell you whether it’s in place or loaded.
@ruben.romero this could be a start for you!
"""
FILTERED ELEMENT COLLECTOR
"""
__author__ = 'Sol Amour - amoursol@gmail.com'
__twitter__ = '@solamour'
__version__ = '1.0.0'
# Importing Reference Modules
import clr # CLR ( Common Language Runtime Module )
clr.AddReference("RevitServices") # Adding the RevitServices.dll special Dynamo
# module to deal with Revit
import RevitServices # Importing RevitServices
from RevitServices.Persistence import DocumentManager # From RevitServices import
# the Document Manager
clr.AddReference("RevitAPI") # Adding the RevitAPI.dll module to access the Revit
# API
import Autodesk # Here we import the Autodesk namespace
# From the Autodesk namespace - derived down to the Revit Database, we import only
# the Filtered Element Collector and BuiltInCategory classes
from Autodesk.Revit.DB import FilteredElementCollector, FamilyInstance, Family
# Here we give the Revit Document a nickname of 'doc' which allows us to simply
# call 'doc' later without having to type the long namespace name
doc = DocumentManager.Instance.CurrentDBDocument
familyInstanceCollector = FilteredElementCollector(doc).OfClass(FamilyInstance).WhereElementIsNotElementType().ToElements()
systemFamilies = FilteredElementCollector(doc).WhereElementIsElementType().ToElements()
inPlaceFamilies = []
# Collect all InPlace families
for instance in familyInstanceCollector:
symbol = instance.Symbol.Family
if symbol.IsInPlace:
inPlaceFamilies.append(instance)
loadableFamilies = [family for family in familyInstanceCollector if family not in inPlaceFamilies]
# Create a dictionary to output
output = {'inPlaceFamilies' : inPlaceFamilies, 'loadableFamilies' : loadableFamilies, 'systemFamilies' : systemFamilies}
# To get our results back inside of Dynamo, we need to append a list to the OUT port
OUT = output
It’s not perfect, but is a start :
would be ideal for the answer, to feed the python node with a list of elements or families and get as output if those are system, loadable or model/mass in-place instead of getting the elements grouped by a dictionary, because the elements list may come from different documents, not always the current document to do the collector. basically the transpose or opposite output that this sample.
Thank you @solamour it has inspired me.
Sorry for the comments, in my office they work in Spanish.
def instancias_diccionario_por_tipo():
"""
Uso:
Diccionario con todas las instancias del modelo organizadas por las
siguientes claves: Instancias modeladas in-situ; Instancias de
familias cargables; Instancias de familias de sistema.
Las claves son: inSitu, cargable, sistema.
Entradas:
Sin argumentos
Salida:
Diccionario <Dict()>
"""
# Se trabaja en una vista 3D
vista = doc.ActiveView
if vista.GetType().ToString() == 'Autodesk.Revit.DB.View3D':
# Se colectan todas las instancias
# Primero se filtran las familyInstance
# En las familyInstance tenemos familias cargables y modeladas in-situ
# No hay familias de sistema
instancias = FilteredElementCollector(doc, doc.ActiveView.Id).\
WhereElementIsNotElementType().ToElements()
# Se consulta si esta modeladas in situ
inSitu = [ins for ins in instancias
if str(ins.GetType()) == 'Autodesk.Revit.DB.FamilyInstance'
and ins.Symbol.Family.IsInPlace == True] # FamilyInstance
# Se consulta si son cargables
cargables = [ins for ins in instancias
if str(ins.GetType()) == 'Autodesk.Revit.DB.FamilyInstance'
and ins not in inSitu] # FamilyInstance
# El resto son de sistema
sistema = [ins for ins in instancias
if str(ins.GetType()) != 'Autodesk.Revit.DB.FamilyInstance']
# Se crea un diccionario de salida
return {'inSitu' : inSitu,
'cargable' : cargables,
'sistema' : sistema}
else:
return 'Ejecutar con una vista 3D activa.'
Hi,
I am new to Dynamo, and I would like to get all the System Family Type instancies in our document.
We use your code, and it works for everything except the system family type instancies.
Do you have any idea?
In the result picture, we can see a lot of things, while I only have like 3 walls on my revit file.