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’
I have viewed this post but it didn’t help me: https://forum.dynamobim.com/t/placing-a-new-family-on-a-face-in-python/13335
Please see attached image for the code I have used:
Thanks for the help in advance!
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.
Hi @cgartland @Figleggedtom
If you’re looking to convert Surface into Face here is OOTB method. I will soon post python as well:
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”. :?
The method needs Revit Faces, whereas you are feeding Dynamo Faces.
You can get Revit faces from Dynamo faces like this:
from Autodesk.DesignScript.Geometry import *
#Import the Revit API
from Autodesk.Revit.DB import *
#Import DocumentManager and TransactionManager
from RevitServices.Persistence import DocumentManager
#Import ToDSType(bool) extensions method
#Reference the active Document and application
doc = DocumentManager.Instance.CurrentDBDocument
faces = IN
output = 
for i in faces:
elemRef = i.Tags.LookupTag('RevitFaceReference')
elem = doc.GetElement(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:
Try to add this to your code:
opt = Options()
opt.ComputeReferences = True
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.
I completely forgot about this. I’ll se if i can dig it out and get it finished
Perhaps this helps? The python inside is great!
I had to make a face based family, I’m not sure this one will work?
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