# Facing problems with face class methods

**URL:** <https://forum.dynamobim.com/t/facing-problems-with-face-class-methods/91103>\
**Category:** Dynamo Player\
**Tags:** python, dynamo\
**Created:** [June 23, 2023, 9:25pm UTC](https://forum.dynamobim.com/t/facing-problems-with-face-class-methods/91103 "2023-06-23T21:25:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DynUser](https://avatars.discourse-cdn.com/v4/letter/d/3d9bf3/32.png) [@DynUser](https://forum.dynamobim.com/u/DynUser)\
**Post date:** [June 23, 2023, 9:25pm UTC](https://forum.dynamobim.com/t/facing-problems-with-face-class-methods/91103/1 "2023-06-23T21:25:55Z")

</div>

Dear Autodesk Community,

I am currently facing a problem in my python script that makes me despair a bit. I already solved the problem in Dynamo. No Issues here, but I am trying to speed up my dynamo script by transfering some processes into python. The script is supposed to give the middle points of the two smallest faces of a boundingbox. However it doesn’t work. Error message says "AttributeError: ‘Face’ object has no attribute ‘Evaluate’ ". I have already tried a few things, but nothing seems to work out, and I am bit helpless at the moment. Maybe someone can find my mistake?

I would appreciate any help. Thank you in advance 🙏

 ![2023-06-23T23_24_32](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/4/7402f406999e8329eea1d6c0a9efd4425344ed6e.png)

++++++++++++++++++++++++++++++++++++++++++++++

```plaintext

clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
from Autodesk.DesignScript.Geometry.Core import *

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

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

#defining functions
def getBBoxFaces(bboxes):
	solidList = []
	faceList = []
	for bbox in bboxes:
		solidList.append(bbox.ToCuboid())
	for solid in solidList:
		facesPerSolid = solid.Faces
		faceList.append(facesPerSolid)
	return faceList
	
def get2smallestFaces(faces):
	smallestFacesPerSolid = []
	for facesPerSolid in faces:
		smallestFaces = sorted(facesPerSolid, key=lambda face: Face.Area)[:2]
		smallestFacesPerSolid.append(smallestFaces)
	return smallestFacesPerSolid

def getMiddlePoints(faces):
	uv = UV(0.5,0.5)
	midPoints = []
	for face in faces:
		midPoint = face.Evaluate(uv)
		midPoints.append(midPoint)
	return midPoints

def getMiddlePointsOfBBox(bboxes):
	middlePoints = []
	faceList = getBBoxFaces(bboxes)
	smallestFacesList = get2smallestFaces(faceList)
	for smallFace in smallestFacesList:
		middlePoints.append(getMiddlePoints(smallFace))
	return middlePoints

# Start Transaction
doc = DocumentManager.Instance.CurrentDBDocument
TransactionManager.Instance.EnsureInTransaction(doc)

#Unwrap element
bboxes = UnwrapElement(IN[0])

#get Middle Points Of bbox
middlePoints = getMiddlePointsOfBBox(bboxes)

# End Transaction
TransactionManager.Instance.TransactionTaskDone()

OUT = middlePoints
```

---

<div class="post-metadata">

**Author:** ![DynUser](https://avatars.discourse-cdn.com/v4/letter/d/3d9bf3/32.png) [@DynUser](https://forum.dynamobim.com/u/DynUser)\
**Post date:** [June 23, 2023, 9:27pm UTC](https://forum.dynamobim.com/t/facing-problems-with-face-class-methods/91103/2 "2023-06-23T21:27:37Z")

</div>

P.S. these boxes are square brackets, so an empty list

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [June 24, 2023, 7:20am UTC](https://forum.dynamobim.com/t/facing-problems-with-face-class-methods/91103/3 "2023-06-24T07:20:03Z")

</div>

@DynUser ,

i was not able to solve it but i think you have to use Surfaces instead of faces …

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/c/ac208d2566ae3751a4b5b3a6a178f5985d6716d8.png)

KR

Andreas

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [June 25, 2023, 4:08pm UTC](https://forum.dynamobim.com/t/facing-problems-with-face-class-methods/91103/4 "2023-06-25T16:08:30Z")

</div>

Hello, you looked with object type if these faces were revit faces (and not dynamo face)  
your wrong attribute message may be coming from this aspect.  
Cordially  
christian.stan
