NewFamilyInstance Method (Face, XYZ, XYZ, FamilySymbol)

Hi Everyone , i’ve been trying for a week and stuck , error it gives is No matches given arguments for NewFamilyInstances- Class ; what i understand is that the input Face that i have given is treated as list and not face

Following is my code :
import clr
clr.AddReference(‘RevitAPI’)
clr.AddReference(‘RevitServices’)

from Autodesk.Revit.DB import XYZ, FamilySymbol, Face, Transaction
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

Unwrap Dynamo inputs

face = UnwrapElement(IN[0]) # Face or list of faces
location = IN[1] # XYZ location
reference_direction= IN[2] # XYZ reference direction
symbol = IN[3] # FamilySymbol

Get the current document

doc = DocumentManager.Instance.CurrentDBDocument

Start a transaction to create a new family instance

TransactionManager.Instance.EnsureInTransaction(doc)

Create the new family instance

new_family_instance = doc.Create.NewFamilyInstance(face, location, reference_direction, symbol)

TransactionManager.Instance.TransactionTaskDone()

Output the created family instance

OUT = new_family_instance

Please help , Learned many new things while searching solution for this already

Always make sure you’re posting code as preformatted text (</> in the toolbar) so it maintains indents and formatting.

Your assumption is correct and confirmed by the error. If the method requires a single face as an argument then a list is invalid. You need to check to see if the input you provided is a single item or a list and then handle that structure accordingly.

There are a bunch of custom nodes that use python to do this. You might be able to find one and use it as an example. There may also be references to something similar in other posts if you try searching.