# Export selected family as .rfa from a revit project to a folder

**URL:** <https://forum.dynamobim.com/t/export-selected-family-as-rfa-from-a-revit-project-to-a-folder/97053>\
**Category:** Uncategorized\
**Created:** [January 11, 2024, 12:39pm UTC](https://forum.dynamobim.com/t/export-selected-family-as-rfa-from-a-revit-project-to-a-folder/97053 "2024-01-11T12:39:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![alienau2016](https://avatars.discourse-cdn.com/v4/letter/a/ccd318/32.png) [@alienau2016](https://forum.dynamobim.com/u/alienau2016)\
**Post date:** [January 11, 2024, 12:39pm UTC](https://forum.dynamobim.com/t/export-selected-family-as-rfa-from-a-revit-project-to-a-folder/97053/1 "2024-01-11T12:39:43Z")

</div>

![05-Listing et Rechargement des familles dans REVIT_2023-12-04_11-32-07](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/1/11c8c4d0d7a3cc6c33a56cf7765875e2c79af196.png)

 ![Capture](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/e/5e6c44662c4c24122228685db3fa707510b0b5a6.png)  
Hello, what is the Dynamo node that allows me to obtain the family with the ID based on its name, so that I can then import it into an external folder?

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [January 11, 2024, 12:47pm UTC](https://forum.dynamobim.com/t/export-selected-family-as-rfa-from-a-revit-project-to-a-folder/97053/2 "2024-01-11T12:47:06Z")

</div>

If you’re using the [Orchid package](https://github.com/erfajo/OrchidForDynamo) you should post this on the project’s github. The author isn’t accurate here and as such support here is somewhat restricted.

---

<div class="post-metadata">

**Author:** ![m.owens](https://avatars.discourse-cdn.com/v4/letter/m/bbe5ce/32.png) [@m.owens](https://forum.dynamobim.com/u/m.owens)\
**Post date:** [January 11, 2024, 9:43pm UTC](https://forum.dynamobim.com/t/export-selected-family-as-rfa-from-a-revit-project-to-a-folder/97053/3 "2024-01-11T21:43:38Z")

</div>

archilab has a “ByElementId” Node which allows you to collect elements by their revit IDs.

![grafik](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/e/febd731aae095ca7aee1cc23842488ed3a28fe06.png)

There is also an out-of-the-box node now for exporting families.

![grafik](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/6/1685e5e4c7700c0f064059a6fb11c0f9de107c02.png)

---

<div class="post-metadata">

**Author:** ![GavinNicholls](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/gavinnicholls/32/190442_2.png) [@GavinNicholls](https://forum.dynamobim.com/u/GavinNicholls)\
**Post date:** [January 12, 2024, 2:54am UTC](https://forum.dynamobim.com/t/export-selected-family-as-rfa-from-a-revit-project-to-a-folder/97053/4 "2024-01-12T02:54:46Z")

</div>

Happy to share my Python code I use in some of my tools I’ve developed at work given it’s been built in so many places/firms.

```auto
# Function to close family document
def famUtils_close(family_doc, option_save = True):
	# Try to close the document
	try:
		family_doc.Close(option_save)
		return 1
	# If we can't, return 0 for tallying
	except:
		return 0

# Options for saving document
options = DB.SaveAsOptions()
options.OverwriteExistingFile = True

# Typical loop to open, save, close families
for f, p in zip(families, filepaths):
	famDoc = doc.EditFamily(f)
	famDoc.SaveAs(path, options)
	famUtils_close(family_doc, False)

```

You’ll still need to get the family document(s) and build up the desired path(s), but that’s the core how you can save out families from a project.

You can get families by name using an approach like below:

```auto
# Get family documents
families_all = DB.FilteredElementCollector(doc).OfClass(DB.Family).ToElements()
families_names = [f.Name for f in families_all]

# Put your names in here
targetNames = []

# Get the families by name
families_get = []

for t in targetNames:
	if t in families_names:
		ind = families_names.index(t)
		families_get.append(families_all[ind])
	else:
		pass
		# Or you can append None and process it later

```

In my case I use [pyRevit](https://discourse.pyrevitlabs.io/) to generate a list of all family names sorted by category in a list view, but Data-Shapes could do this for Dynamo comfortably.
