Hi everyone,
I have a project where I would like to get the FamilyInstances in a FamilyDocument.
I was able to get the FamilyTypes and Families but not the FamilyInstances (the nodes show empty lists).
Is there a way to get these ?
Thanks in advance.
This is a little confusing. You mention a project but that you’re in a FamilyDocument. Instances only exist in a project, not a family.
You haven’t shown any of the python code so we don’t know what you’re trying to do. Are you wanting to get the instances in the project? How are you attempting to retrieve them?
As Nick said, there are no family instances inside a family document. But there are elements you can collect.
Sorry about that.
Here are some screenshots so it will be easier to understand what I’m looking for :
With my previous screenshot, I was able to access to this familyDocument with the first Python Script node.
Then, with the second Python Script node, in the familyDocument, I’ve got the familyTypes.
import clr
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from System.Collections.Generic import *
import System
document = UnwrapElement (IN[1])
familyInstance = UnwrapElement(IN[0])
if familyInstance.Symbol is not None:
family = familyInstance.Symbol.Family
familyDoc = document.EditFamily(family)
if familyDoc is not None and familyDoc.IsFamilyDocument == True:
collector = FilteredElementCollector(document)
collection = collector.OfClass(FamilySymbol).ToElements()
OUT = collection
But what I’m reaching, it’s the FamilyInstance in the FamilyDocument :
In the previous post, the FamilyInstance.ByFamilyType node shows empty lists, but it should show the instances, right ?
are you looking to get nested families from a family instance?
you can use Archilab node ‘Elements.SubComponents.’ This node enables you to retrieve the nested elements hosted within a specific family instance. Make sure the ‘shared’ option is checked.
Exactly.
However, they’re not shared (I’d like to avoid this option).
This is the result with the OOTB node (same issue on both nodes) :
i have edited previous comment please check .
“Dynamo can only do what Revit can do.
For example, we can’t select nested families in the project without sharing the family. That’s why we need to check the ‘shared’ option in the family when loading a nested family into the main family.”
Actually, I finally managed to get these FamilyInstances (without the shared option in the nested families).
Here is the code :
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
import System
import sys
doc = IN[0]
category = IN[1]
filter = ElementCategoryFilter(System.Enum.ToObject(BuiltInCategory, category.Id))
result = FilteredElementCollector(doc).WherePasses(filter).WhereElementIsNotElementType().ToElements()
OUT = result
I didn’t think it was possible to use the Get All Elements From Linked Model node from archi-lab for familyDocument.
Thanks for your help.
1 Like