Not working "Family.load" for multiple nested families

Hi dynamo community, @c.poupin, @jacob.small

While running the script, the parameter values are successfully updated in the family document. However, when attempting to reload the families in Revit by using “Family.load” node, it shows an error as shown in the blown-up image below



Blownup Image

Please review our attached images and sample dynamo files and Revit files and give us any suggestions so that it will be very helpful to our project.
Demo (Nested).dyn (44.0 KB)

Demo project1.rvt (2.0 MB)

Also, we have tried in python script but it’s not working please check our python script node as shown in below and provide any suggestion so that it will be very helpful to our project.

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

#Inputs is stored in the IN variable
elements = IN[0]

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

def OnSharedFamilyFound(self, sharedFamily, familyInUse, source, overwriteParameterValues) :
	return True

#Core data processing
TransactionManager.Instance.EnsureInTransaction(doc)
try:
for fam in elements :
	fam.LoadFamily(doc, FamilyOption())
except:
pass
TransactionManager.Instance.TransactionTaskDone()

#Nothing assign to the OUT variable
OUT = 'Families is updatet/reloaded'

Hi,

  • for the Family.Load node

try to flat the list before

  • for the Python code

Cpython3/PythonNet2 do not work well with interfaces, use IronPython instead (with this specifc syntax) or build a Zero Touch Node (C#)

Hi poupin,

Thank you for the response., Already we have used the flatten list for the family.load node, still its showing error as shown in below screenshot in dynamo script.


For sample files please use above attached files only

For python script:
I’m just a beginner in Python scripting. Could you please check and update my Python script as shown below? It would be very helpful for my project.
import clr
import sys
import System
from System.Collections.Generic import List

------------- Import RevitAPI -----------------------------------------###

clr.AddReference(“RevitAPI”)
clr.AddReference(“RevitAPIUI”)
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

------------- Import DocumentManager y TransactionManager -------------###

clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *

------------- Here all Definitions --------------------------------------###

tolist() function to ensure that the element is iterable

------------- Current document and User Interface. ----------------------###

doc = DocumentManager.Instance.CurrentDBDocument

##class for Load ##
class FamilyOption(IFamilyLoadOptions) :
def OnFamilyFound(self, familyInUse, overwriteParameterValues):
overwriteParameterValues.Value = True
return True

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

preparing input

familydoc = IN[0]

TransactionManager.Instance.ForceCloseTransaction()

for famDoc in familydoc:

# load to Project and close
famDoc.LoadFamily(doc, FamilyOption())
familyDoc.Close(False)

Hi @fayazmohd144 I guess that node expect an autodek.revit.db.document…maybe

I think that is one of the Orchid nodes, which means it might expect an Orchid document. Best to head over to the Orchid Package GitHub repository for support if so.

1 Like

yeah guess you are right :wink: :wink: i dont know these nodes, i thought it was genius loci…

Hi Jacob

Thank you for the response, but this node is worked on normal family’s but it is not working in nesting family’s, please check above attached files and do needful my requirement. it will be very helpful for my project

Which means it’s a problem with the Orchid node, which means we can’t help without rebuilding the entire graph to not use the Orchid node or perhaps the package at all as it doesn’t play well with others. It’s not as simple as ‘change this one thing’ when we can’t edit the one thing. The Orchid Package author can, so that’s why I redirected you to that GitHub.

1 Like

Hi jacob
Thank you for the response, we got the solution for your suggestion.