I am trying to place revit familes with the method NewFamilyInstance Method (Face, XYZ, XYZ, FamilySymbol) but I get an error: ‘Expected Face, got Surface’
Would you be able to also show how your inputs are being generated before they get to the Python script? It looks like you may be running into the same issue shown in the post you linked. In that post, the “Select Face” node is a bit misleading as it returns a Surface instead of a Face. The Face class has a GetSurface() method, but it looks like there isn’t a way to get a Face from a Surface.
I have updated the script and converted the surfaces to faces with the Topology.Faces node as you suggested but I still get an error. This time It’s: “Expected Face, got Face”. :?
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
#Import the Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
#Import DocumentManager and TransactionManager
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
#Import ToDSType(bool) extensions method
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
#Reference the active Document and application
doc = DocumentManager.Instance.CurrentDBDocument
faces = IN[0]
output = []
for i in faces:
elemRef = i.Tags.LookupTag('RevitFaceReference')
elem = doc.GetElement(elemRef)
output.append(elem.GetGeometryObjectFromReference(elemRef))
#Assign your output to the OUT variable.
OUT = output
Hi. Thanks for the reply. I have tried to convert the faces to Revit faces with the code you have provided but when I feed the Revit face to the code I get this error message now:
Long time no see .
I’m afraid it won’t be og any help to create the Options() object and compute references in this case, because unlike the get_Geometry() method, the GetGeometryObjectFromReference() does not take the Options() object as a parameter.
I was working on a script that would compare the dynamo faces with Revit faces by comparing their Evaluate() to UV(0.5,0.5), but I didn’t have time to finish it. I’ll upload my result when I get back from my vacation, if no one have solved this
Ah, I haven’t noticed that one.
Just read the API once again and I now see what you mean.
Looking forward to see your solution to @Figleggedtom. I hope I can learn something too.
Sorry for the late reply. Yeah Dimitars nodes are great resources, and also confusing sometimes .
I actually got my solution working, but thanks for the heads up. I’ll see if I get time to look into it