Load Family - But Allow For Type Catalog

Hello Everyone,

I am working with this one script to load in custom families (Specifically Structural members) and was wondering how I would go about editing the script to allow / account for Family Catalogs? Right now, it only pushes the default one loaded into the family. Any ideas?

Sincerely,
Kevin

Load Families from Folder to Project.dyn (13.8 KB)

Nice work on getting this far. What you wanna achieve can be done easily. As long as you know your family type names, and file path of the family you wanna load in, you can use the LoadFamilySymbol() method

So how would you suggest modifying the following code for Structural Wide Flange Members?

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

#input assigned the IN variable
paths = IN[0]

#wrap input inside a list (if not a list)
if not isinstance(paths, list): paths = [paths]

#ensure loaded families can overwrite existing families.
class FamilyOption(IFamilyLoadOptions):
def OnFamilyFound(self, familyInUse, overwriteParameterValues):
overwriteParameterValues = False
return False

def OnSharedFamilyFound(self, sharedFamily, familyInUse, source, overwriteParameterValues):
source = FamilySource.Family
overwriteParameterValues = True
return True

#core data processing
for path in paths:
try:
famDoc = app.OpenDocumentFile(path)
famDoc.LoadFamily(doc, FamilyOption())
famDoc.Close(False)
except:
pass

#output assigned the OUT variable
OUT = paths
";
1 Like

Did anyone figure this out?

1 Like

I figured out a way to do this but its not ideal and I’m having trouble getting it to work on multiple families (in sequence) in one graph.
See the Aussie BIM Guru’s video for how to open the family, create new family types, then load the family back in.