Select an 'in place family' that has an 'import symbol' within it?


#1

Is there a way, via Dynamo, to select an ‘in place family’ that has an ‘import symbol’ within it?


#2

I guess no possible node in Dynamo yet for this task, but I tried a bit with Python but couldn’t succeed. Error as follows:

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed. 
Traceback (most recent call last):
  File "<string>", line 17, in <module>
Exception: This family is in-place and is not supported for editing.
Parameter name: loadedFamily

#3

Above is an old post which hints something similar to this problem but only for loadable families.


#4

Thanks Nirbhay!

Weird there’s no existing node for this.


#5

Seems like you can look at all the geometry in the in place family and parse the graphic styles of the geometry. If you do that, then you can search the list to see if any of the geometry matches a know autoCAD layer name.

Here is a start (on a single selected in-place element) based off of some of Thomas’ python code from BIMorph package:
(Note, I am providing this sample as is and cannot guarantee that it will work for all scenarios. It is merely a starting point…)

and the python code:

# based on previous code by Thomas Mahon @Thomas__Mahon info@bimorph.co.uk package: bimorphNodes

import clr

# clr.AddReference loads and imports .net assembly(dll) as python module and import all of its classes
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

# import Transaction methods and Document helpers
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager

# access to the active document and active ui document
doc = DocumentManager.Instance.CurrentDBDocument

#Preparing input from dynamo to revit
element = UnwrapElement(IN[0])
layerNameToSearch = IN[1]
list = []
#iterate through the geometry of the family
geomEnum = element.get_Geometry(Options()).GetEnumerator()
while geomEnum.MoveNext(): 
	instGeom = geomEnum.Current.GetInstanceGeometry()
	instGeomEnum = instGeom.GetEnumerator()
	while instGeomEnum.MoveNext():
		e = instGeomEnum.Current
		try:
			graphicStyleId = e.GraphicsStyleId
			eleGraphicStyle = doc.GetElement(graphicStyleId)
			list.append(eleGraphicStyle.GraphicsStyleCategory.Name)
		except:
			list.append([])
	
OUT = list,list.Contains(layerNameToSearch)

#6

Thanks @john_pierson! Me and my tiny brain will investigate further. :slight_smile:


#7

@Ryan_Schultz2 Assuming that the ‘import symbol’ is a 3D object, you could try this …