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?
If you’re using the Orchid package you should post this on the project’s github. The author isn’t accurate here and as such support here is somewhat restricted.
archilab has a “ByElementId” Node which allows you to collect elements by their revit IDs.
There is also an out-of-the-box node now for exporting families.
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.
# 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:
# 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 to generate a list of all family names sorted by category in a list view, but Data-Shapes could do this for Dynamo comfortably.