Method to place family by point?

I’m trying to modify a python script which will batch load and place a family into a series of families.

What is the python method to “place family by point?”

Here is what I have so far: (line 46 is where I need help)

import clr
clr.AddReference('RevitAPI')
clr.AddReference('RevitServices')

from Autodesk.Revit.DB import Document, FamilySource, IFamilyLoadOptions
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

# The inputs to this node will be stored as a list in the IN variables.
paths = IN[0] 
docpaths = IN[1]

# wrap input inside a list (if not a list) 
if not isinstance(paths, list): 
	paths = [paths] 
if not isinstance(docpaths, list): 
	docpaths = [docpaths]

# ensure loaded families can overwrite existing familiies
class FamilyOption(IFamilyLoadOptions): 
	def OnFamilyFound(self, familylnUse, overwriteParameterValues): 
		overwriteParameterValues = True 

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

# core processing
documents = [] 
families = [] 
for docpath in docpaths: 
	doc=app.OpenDocumentFile(docpath) 
	documents.append(doc) 
for path in paths: 
	family_doc = app.OpenDocumentFile(path) 
	families.append(family_doc) 
	
for document in documents: 
	map(lambda family: family.LoadFamily(document, FamilyOption()), families)
	
	# HELP HERE - I have no idea what this line should be
	map(lambda family: family.PlaceFamily())
	
map(lambda family: family.Close(False), families)
map(lambda document: document.Close(True), documents)

# Assign your output to the OUT variable.
OUT = [paths, docpaths]

I’m sure this is a simple answer for those who already know but I searched the revit api docs and didn’t see any obvious way to do what I want. Is it somewhere in the FamilyInstanceCreationData Constructor?

I am not sure about placing a family within a family but would the normal route of NewFamilyInstance from the Creation docs work? You are also missing the variable of the mapping for map(lambda family: family.PlaceFamily())

Maybe @erfajo has some time and can help?

1 Like

If you pointed me towards a “Place family in Document” node I could probably figure out the rest. In all my searching I couldn’t find a node like that.

Hi @Bren

If you didn’t already know, Orchid isn’t downloaded from package manage but from here with it’s own installer…

Hope that helps,

Mark

I must be missing something because I can’t find a node (even in Orchid) that performs the "Place family at X,Y,Z in Document” function.

What should I be searching for?

I’m still struggling to understand how to place a family in a background document. I think I’m getting errors because the “FamilyInstance.ByCoordinates” node is trying to place the family into the current document instead of the background document.

Is there a way to use this node to place a family in a background document? Or maybe there is a way to open each family, place a family, close it, and open the next?

fam-load-nodes.dyn (33.1 KB)