# Get Wall Face by python

**URL:** https://forum.dynamobim.com/t/get-wall-face-by-python/38781
**Category:** DesignScript
**Created:** [July 26, 2019, 7:33pm UTC](https://forum.dynamobim.com/t/get-wall-face-by-python/38781 "2019-07-26T19:33:24Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![thiru2jack](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/thiru2jack/32/112308_2.png) [@thiru2jack](https://forum.dynamobim.com/u/thiru2jack)
#### Post date: [July 26, 2019, 7:33pm UTC](https://forum.dynamobim.com/t/get-wall-face-by-python/38781/1 "2019-07-26T19:33:24Z")

</div>

Hiii, everyone…  
Actually i would like create paint node by room but which requires wall faces so I’m try find the wall faces in packages but its not available and again so I’m try find GetRevitGeometry from RevitAPIdocs but don’t know which one is correct??  
Anyone can help me how to get revit geometry or how to get wall faces.

````
```
public void Paint(
	ElementId elementId,
	Face face,
	ElementId materialId
)
```
````

---

<div class="post-metadata">

### Author: ![habdirad](https://avatars.discourse-cdn.com/v4/letter/h/ecd19e/32.png) [@habdirad](https://forum.dynamobim.com/u/habdirad)
#### Post date: [July 27, 2019, 2:49am UTC](https://forum.dynamobim.com/t/get-wall-face-by-python/38781/2 "2019-07-27T02:49:53Z")

</div>

If you are using Revit API, you can apply the .Geometry property (or attribute as called in Python - works on most elements):  
[https://www.revitapidocs.com/2015/d8a55a5b-2a69-d5ab-3e1f-6cf1ee43c8ec.htm](https://www.revitapidocs.com/2015/d8a55a5b-2a69-d5ab-3e1f-6cf1ee43c8ec.htm)

---

<div class="post-metadata">

### Author: ![thiru2jack](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/thiru2jack/32/112308_2.png) [@thiru2jack](https://forum.dynamobim.com/u/thiru2jack)
#### Post date: [July 27, 2019, 3:34pm UTC](https://forum.dynamobim.com/t/get-wall-face-by-python/38781/3 "2019-07-27T15:34:52Z")

</div>

@habdirad Thanks for your reply… i found new Issue in Paint Method  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/f/7f532039029939d1b293c6980ee44c1b2febbdec.png)

```
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
TransactionManager.Instance.EnsureInTransaction(doc)

#Outputs
Faces = []
Geometry = []
Painter = []
#inputs
walls = IN[0]
Mat = IN[1]
#Wall Faces
for wall in walls:
	Geo = wall.Geometry()
	Geometry.append(Geo)
	for f in Geo:
		face = f.Faces
		Faces.append(face)
#Painting
	for Paint in Faces:
		Painter = Paint(wall.Id,Paint,Mat.Id)
		Painted.append(Painter)
OUT = Painted
```

---

<div class="post-metadata">

### Author: ![habdirad](https://avatars.discourse-cdn.com/v4/letter/h/ecd19e/32.png) [@habdirad](https://forum.dynamobim.com/u/habdirad)
#### Post date: [July 27, 2019, 4:32pm UTC](https://forum.dynamobim.com/t/get-wall-face-by-python/38781/4 "2019-07-27T16:32:28Z")

</div>

Okay let’s go with the code attached [code.txt](https://forum.dynamobim.com/uploads/short-url/aGUfLviI0Vhfa0ZAP7Gi8rLIOba.txt) (934 Bytes) . Some important changes:

- Unwrap elements to make them available to API operations
- Paint is a method of Revit document
- In the last post, I said Geometry was a method and it is actually a property so I fixed that
- there is no guarantee that the paint method could paint all faces, so I added a try except structure
- for the list of faces, I used extend, instead of append, so we end up with a flattened list of faces vs a list of nested lists of faces
- also please avoid naming your python objects/variables with capital letter, you could mistakenly override API classes and functions

---

<div class="post-metadata">

### Author: ![thiru2jack](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/thiru2jack/32/112308_2.png) [@thiru2jack](https://forum.dynamobim.com/u/thiru2jack)
#### Post date: [July 27, 2019, 6:10pm UTC](https://forum.dynamobim.com/t/get-wall-face-by-python/38781/5 "2019-07-27T18:10:21Z")

</div>

Very thanks @habdirad spend time to solve and explain briefly… i will correct my mistakes here after.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/f/1fd1846101db2f33e083049d3007c2a949e52392.png)
