# Get FamilyInstance in FamilyDocument from project

**URL:** <https://forum.dynamobim.com/t/get-familyinstance-in-familydocument-from-project/102694>\
**Category:** Revit\
**Tags:** python, dynamo, familyinstance\
**Created:** [July 11, 2024, 11:48am UTC](https://forum.dynamobim.com/t/get-familyinstance-in-familydocument-from-project/102694 "2024-07-11T11:48:29Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![gitcadKGD](https://avatars.discourse-cdn.com/v4/letter/g/c89c15/32.png) [@gitcadKGD](https://forum.dynamobim.com/u/gitcadKGD)\
**Post date:** [July 11, 2024, 11:48am UTC](https://forum.dynamobim.com/t/get-familyinstance-in-familydocument-from-project/102694/1 "2024-07-11T11:48:29Z")

</div>

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.

 ![Capture d’écran 2024-07-11 134350](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/4/d4b7fade4f68a1ffa90916a4e11e3973a60881ca.png)

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [July 11, 2024, 8:43pm UTC](https://forum.dynamobim.com/t/get-familyinstance-in-familydocument-from-project/102694/2 "2024-07-11T20:43:01Z")

</div>

> [@gitcadKGD](#):
>
> I have a project where I would like to get the FamilyInstances in a FamilyDocument.

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?

---

<div class="post-metadata">

**Author:** ![ewilliamsUQGPB](https://avatars.discourse-cdn.com/v4/letter/e/ebca7d/32.png) [@ewilliamsUQGPB](https://forum.dynamobim.com/u/ewilliamsUQGPB)\
**Post date:** [July 12, 2024, 2:25am UTC](https://forum.dynamobim.com/t/get-familyinstance-in-familydocument-from-project/102694/3 "2024-07-12T02:25:58Z")

</div>

As Nick said, there are no family instances inside a family document. But there are elements you can collect.

---

<div class="post-metadata">

**Author:** ![gitcadKGD](https://avatars.discourse-cdn.com/v4/letter/g/c89c15/32.png) [@gitcadKGD](https://forum.dynamobim.com/u/gitcadKGD)\
**Post date:** [July 12, 2024, 7:24am UTC](https://forum.dynamobim.com/t/get-familyinstance-in-familydocument-from-project/102694/4 "2024-07-12T07:24:51Z")

</div>

Sorry about that.

Here are some screenshots so it will be easier to understand what I’m looking for :

 ![Capture d’écran 2024-07-12 083937](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/7/87b1fbfe8b616ba261c912e9e9e3eeb84f59a7e2.png)

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.

```auto
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 :

 ![Capture d’écran 2024-07-12 091323](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/9/69605b307086fd1b9d2949d74d651779d52ff5c3.png)

In the previous post, the _FamilyInstance.ByFamilyType_ node shows empty lists, but it should show the instances, right ?

---

<div class="post-metadata">

**Author:** ![sjafarali75](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@sjafarali75](https://forum.dynamobim.com/u/sjafarali75)\
**Post date:** [July 12, 2024, 7:40am UTC](https://forum.dynamobim.com/t/get-familyinstance-in-familydocument-from-project/102694/5 "2024-07-12T07:40:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![gitcadKGD](https://avatars.discourse-cdn.com/v4/letter/g/c89c15/32.png) [@gitcadKGD](https://forum.dynamobim.com/u/gitcadKGD)\
**Post date:** [July 12, 2024, 9:29am UTC](https://forum.dynamobim.com/t/get-familyinstance-in-familydocument-from-project/102694/6 "2024-07-12T09:29:26Z")

</div>

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

 ![Capture d'écran 2024-07-12 112827](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/3/93f8207af141cce8f1e549b48d91d122df14911d.png)

---

<div class="post-metadata">

**Author:** ![sjafarali75](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@sjafarali75](https://forum.dynamobim.com/u/sjafarali75)\
**Post date:** [July 12, 2024, 9:52am UTC](https://forum.dynamobim.com/t/get-familyinstance-in-familydocument-from-project/102694/7 "2024-07-12T09:52:40Z")

</div>

i have edited previous comment please check .

---

<div class="post-metadata">

**Author:** ![sjafarali75](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@sjafarali75](https://forum.dynamobim.com/u/sjafarali75)\
**Post date:** [July 12, 2024, 10:26am UTC](https://forum.dynamobim.com/t/get-familyinstance-in-familydocument-from-project/102694/8 "2024-07-12T10:26:19Z")

</div>

“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.”

---

<div class="post-metadata">

**Author:** ![gitcadKGD](https://avatars.discourse-cdn.com/v4/letter/g/c89c15/32.png) [@gitcadKGD](https://forum.dynamobim.com/u/gitcadKGD)\
**Post date:** [July 12, 2024, 1:33pm UTC](https://forum.dynamobim.com/t/get-familyinstance-in-familydocument-from-project/102694/9 "2024-07-12T13:33:24Z")

</div>

Actually, I finally managed to get these FamilyInstances (without the shared option in the nested families).

 ![Capture d’écran 2024-07-12 153118](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/8/38274670d9fe4c847891f1c5e59b6898dd80fc9b.png)

Here is the code :

```auto
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](https://forum.dynamobim.com/t/revit-2022-dynamo-2-10-package-not-showing-up-and-icons-missing/62933/7?) for familyDocument.

Thanks for your help.
