Replacement of families with the same name

Hello everyone, I am an architect, and I am starting to use Dynamo. I work in a company where we create a model in Revit with many families within the same project. When we group all the project areas together, the file size reaches 900 MB, and it becomes unworkable. I have managed to drastically reduce the file size by reducing the level of detail and removing unnecessary curves. However, there are 600 families, and each project area uses different families.

I want to generate a script in Dynamo 2022 that allows me to:

1- Select the folder where all the families with reduced file size are stored (the families with reduced file size maintain the same name as the original families).

2- Once the folder is selected, I need to reload only the families that exist in the currently opened model.

I would greatly appreciate your help with this issue. I prefer to use standard nodes if possible.

Best regards.

@macrot.mq ,

that can be a starting point (document.LoadFamily → ClockWork)

here the code from Clockwork, is not so difficult to make costumnode!

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

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
fampaths = IN[0]
famnames = IN[1]
elementlist = []
booleans = []

TransactionManager.Instance.EnsureInTransaction(doc)
for fampath in fampaths:
	try: 
		doc.LoadFamily(fampath)
		booleans.append(True)
	except: booleans.append(False)
TransactionManager.Instance.TransactionTaskDone()

collector = FilteredElementCollector(doc)
collector.OfClass(Family)
for item in collector.ToElements():
	if item.Name in famnames:
		typelist = list()
		for famtypeid in item.GetFamilySymbolIds():
			typelist.append(doc.GetElement(famtypeid).ToDSType(True))
		elementlist.append(typelist)
OUT = (elementlist,booleans)

KR

Andreas

Can you show what you have?
If you can’t post cause you seem to be new here
Consider using Wetransfer as a workaround
Be smart