Placing Detail Items in a Detail Item Family

I have been able to get Dynamo to load Families into a Detail Item (I am running Dynamo in the Detail Item Family).
What I am struggling with is placing families in the view (in this case the Ref. Level floor plan view).

the out of the box node FamilyInstance.ByPoint works, but doesnt make them visible in the view (something to do with them not being 3d geometry based on my research).

Nodes from other packages (like Clockwork and Springs) have nodes that can place families into views by a point but those also seem to fail, even if i hand them only a single view, point, and family type.

Any Ideas on how to get this to run?

I ended up taking the Clockwork Node (FamilyInstance.ByPointInView) pulling it out of the custom node and running it in the main graph with a few edits made with the help of ChatGPT.
not sure if thats bad form, I apologize if it is.

It mostly works, at least it does if i give it a single item or flat list but not if i give it any more than that like a nested list
Here is what I ended up with:



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

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

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

doc = DocumentManager.Instance.CurrentDBDocument

# Process inputs
if isinstance(IN[0], list):
	points = UnwrapElement(IN[0])
else:
	points = [UnwrapElement(IN[0])]

if isinstance(IN[1], list):
	famtypes = UnwrapElement(IN[1])
else:
	famtypes = [UnwrapElement(IN[1])]

lvl = UnwrapElement(IN[2])

elementlist = []
TransactionManager.Instance.EnsureInTransaction(doc)

for point, famtype in zip(points, famtypes):
	# make sure familysymbol is active
	if not famtype.IsActive:
		famtype.Activate()
		doc.Regenerate()

	if doc.IsFamilyDocument:
		newobj = doc.FamilyCreate.NewFamilyInstance(point.ToXyz(),famtype,lvl)
	else:
		newobj = doc.Create.NewFamilyInstance(point.ToXyz(),famtype,lvl)
	elementlist.append(newobj.ToDSType(False))

TransactionManager.Instance.TransactionTaskDone()
OUT = elementlist
1 Like

@Peter.vansteeJS2FV ,

what did you get as a error message?

to correct your syntex:

import clr

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

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

clr.AddReference('System')
from System.Collections.Generic import List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

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

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument


# Process inputs
if isinstance(IN[0], list):
	points = UnwrapElement(IN[0])
else:
	points = [UnwrapElement(IN[0])]

if isinstance(IN[1], list):
	famtypes = UnwrapElement(IN[1])
else:
	famtypes = [UnwrapElement(IN[1])]

lvl = UnwrapElement(IN[2])

elementlist = []

TransactionManager.Instance.EnsureInTransaction(doc)

for point, famtype in zip(points, famtypes):
	if not famtype.IsActive:
		famtype.Activate()
		doc.Regenerate()

	if doc.IsFamilyDocument:
		newobj = doc.FamilyCreate.NewFamilyInstance(point.ToXyz(),famtype,lvl)
	else:
		newobj = doc.Create.NewFamilyInstance(point.ToXyz(),famtype,lvl)
		elementlist.append(newobj.ToDSType(False))

TransactionManager.Instance.TransactionTaskDone()

OUT = elementlist

This is the error I’m getting.

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 35, in
AttributeError: ‘List[object]’ object has no attribute ‘IsActive’

I get the same error with the corrected code that you provided.

@Peter.vansteeJS2FV ,

than it is not interating correctly…

it has to do like

outlist = []

for f in famtypes:
    outlist.append(f.IsActive)

after entirely too much research and trial/error I have something that works
thank you for the help!

import clr

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

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

clr.AddReference('System')
from System.Collections.Generic import List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

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

doc = DocumentManager.Instance.CurrentDBDocument
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

elementlist = []

TransactionManager.Instance.EnsureInTransaction(doc)

view = UnwrapElement(IN[2])

def NewFamily(point, famtype, view):
	if doc.IsFamilyDocument:
		newobj = doc.FamilyCreate.NewFamilyInstance(point.ToXyz(), famtype, view)
	else:
		newobj = doc.Create.NewFamilyInstance(point.ToXyz(), famtype, view)
	return newobj.ToDSType(False)

# Process inputs
if isinstance(IN[1], list) == False:
	famtype = UnwrapElement(IN[1])
	if famtype.IsActive == False:
		famtype.Activate()
		doc.Regenerate()
	point = UnwrapElement(IN[0])
	elementlist.append(NewFamily(point, famtype, view))
else:
	for i in range(len(IN[0])):
		if isinstance(IN[0][i], list) == False:
			point = UnwrapElement(IN[0][i])
			famtype = UnwrapElement(IN[1][i])
			if famtype.IsActive == False:
				famtype.Activate()
				doc.Regenerate()
			elementlist.append(NewFamily(point, famtype, view))
		else:
			elementlist.insert(i,[])
			for j in range(len(IN[1][i])):
				point = UnwrapElement(IN[0][i][j])
				famtype = UnwrapElement(IN[1][i][j])
				if famtype.IsActive == False:
					famtype.Activate()
					doc.Regenerate()
				elementlist[i].append(NewFamily(point, famtype, view))

TransactionManager.Instance.TransactionTaskDone()

OUT = elementlist