Is it possible to know if a family in a project is shared?

Hi all,

I need to select families that are shared families. Is it possible to do that with dynamo or python?

Input - a list with a number of families
Output - boolean with the ones that are shared families.

Thank you!

1 Like

Hello
a solution with GetSubComponentIds() method
EDIT : oups! Corrected code

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

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

flatten = lambda l: [item for sublist in l for item in sublist]
toList = lambda x : x if hasattr(x, "__iter__") else [ x ]

elems = toList(UnwrapElement(IN[0]))
lstSharedId = flatten([e.GetSubComponentIds() for e in elems ])
outBoolCheck = []
	
for e in elems:
	if e.Id in lstSharedId:
		outBoolCheck.append(True)
	else:
		outBoolCheck.append(False)		
OUT = outBoolCheck
2 Likes

Try the following code to get only the families out that have shared parameter ticked

#Created By Brendan Cassidy

import clr

# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

output=[]

#May need to change IN[0] to UnwrapElement(IN[0])

for a in IN[0]:
	for b in a.Family.Parameters:
		if b.Name == "Shared":
			if b.Value == 1:
				output.append(a)

OUT = output
2 Likes

Thanks both for your help!!