# Get Wall Layer Thicknesses From Python?

**URL:** <https://forum.dynamobim.com/t/get-wall-layer-thicknesses-from-python/40122>\
**Category:** Uncategorized\
**Tags:** python\
**Created:** [August 30, 2019, 12:56pm UTC](https://forum.dynamobim.com/t/get-wall-layer-thicknesses-from-python/40122 "2019-08-30T12:56:35Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericabbott](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ericabbott/32/68658_2.png) [@ericabbott](https://forum.dynamobim.com/u/ericabbott)\
**Post date:** [August 30, 2019, 12:56pm UTC](https://forum.dynamobim.com/t/get-wall-layer-thicknesses-from-python/40122/1 "2019-08-30T12:56:35Z")

</div>

I’m trying to use wall api methods to get the wall layer thicknesses (specifically the core).

Here is my script but it is returning null.

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

I don’t understand where I am going wrong, using Revit Lookup and API Docs this should work.

Another curious thing is that Wall.WallType in Python does not return the WallType object like the Wall Types node does.

Any help would be appreciated. Thank you in advance!

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [August 30, 2019, 1:56pm UTC](https://forum.dynamobim.com/t/get-wall-layer-thicknesses-from-python/40122/2 "2019-08-30T13:56:05Z")

</div>

Try looking at the code in the ‘GetCompoundLayerStructure’ node in Clockwork.

---

<div class="post-metadata">

**Author:** ![cgartland](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/cgartland/32/45378_2.png) [@cgartland](https://forum.dynamobim.com/u/cgartland)\
**Post date:** [August 30, 2019, 2:16pm UTC](https://forum.dynamobim.com/t/get-wall-layer-thicknesses-from-python/40122/3 "2019-08-30T14:16:09Z")

</div>

I replicated your code and was able to get both the WallType and the width of its core layer. I am using Dynamo 2.0.3 on Revit 2019.2.

EDIT: See maciek’s comment below regarding the OUT variable. The code is operating properly but the OUT variable is not properly named

---

<div class="post-metadata">

**Author:** ![maciek.glowka](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/maciek.glowka/32/70695_2.png) [@maciek.glowka](https://forum.dynamobim.com/u/maciek.glowka)\
**Post date:** [August 30, 2019, 2:17pm UTC](https://forum.dynamobim.com/t/get-wall-layer-thicknesses-from-python/40122/4 "2019-08-30T14:17:12Z")

</div>

Hi,

your OUT should be in capital letters. Secondly if your wall has multiple core layers try this:

```
import clr

#The inputs to this node will be stored as a list in the IN variables.
walls = UnwrapElement(IN[0])

output=[]

for w in walls:
	#output.append(w.WallType.GetCompoundStructure())
	cs = w.WallType.GetCompoundStructure()
	i0 = cs.GetFirstCoreLayerIndex()
	i1 = cs.GetLastCoreLayerIndex()
	d = 0
	for idx in range(i0,i1+1):
		d+=cs.GetLayerWidth(idx)
	output.append(d)
		
OUT = output
```

---

<div class="post-metadata">

**Author:** ![ericabbott](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ericabbott/32/68658_2.png) [@ericabbott](https://forum.dynamobim.com/u/ericabbott)\
**Post date:** [August 30, 2019, 2:46pm UTC](https://forum.dynamobim.com/t/get-wall-layer-thicknesses-from-python/40122/5 "2019-08-30T14:46:35Z")

</div>

Changing the out variable to capital letters solved this issue. I am now seeing the return values. Thank you for your help!

---

<div class="post-metadata">

**Author:** ![lavinia.l](https://avatars.discourse-cdn.com/v4/letter/l/71e660/32.png) [@lavinia.l](https://forum.dynamobim.com/u/lavinia.l)\
**Post date:** [March 16, 2021, 3:23pm UTC](https://forum.dynamobim.com/t/get-wall-layer-thicknesses-from-python/40122/6 "2021-03-16T15:23:13Z")

</div>

Hello @ericabbott ,  
sorry that after such a long time, I open the topic again. But I need help with exactly that.  
I tried to output the wall thicknesses with the help of your code, but I also get null, although I wrote OUT in capital letters.

Do you have any tips? I would be very happy.

---

<div class="post-metadata">

**Author:** ![Weston.Rodberry](https://avatars.discourse-cdn.com/v4/letter/w/b5a626/32.png) [@Weston.Rodberry](https://forum.dynamobim.com/u/Weston.Rodberry)\
**Post date:** [October 25, 2022, 12:45am UTC](https://forum.dynamobim.com/t/get-wall-layer-thicknesses-from-python/40122/7 "2022-10-25T00:45:13Z")

</div>

I’m getting an error when using your code from here. The error says:  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/8/28e024c63cbb08220c58ef71c109d6f42fabe963.png)

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/6/d62c2c8519f910b3ad8d81a36cac2467ee571140.png)

---

<div class="post-metadata">

**Author:** ![theshysnail](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/theshysnail/32/146653_2.png) [@theshysnail](https://forum.dynamobim.com/u/theshysnail)\
**Post date:** [October 25, 2022, 1:16am UTC](https://forum.dynamobim.com/t/get-wall-layer-thicknesses-from-python/40122/8 "2022-10-25T01:16:33Z")

</div>

Hi, you need to make sure the input walls are in list format. Post the preview of the input to this Python node.

---

<div class="post-metadata">

**Author:** ![Revit\_Noob](https://avatars.discourse-cdn.com/v4/letter/r/a587f6/32.png) [@Revit\_Noob](https://forum.dynamobim.com/u/Revit_Noob)\
**Post date:** [October 25, 2022, 2:06am UTC](https://forum.dynamobim.com/t/get-wall-layer-thicknesses-from-python/40122/9 "2022-10-25T02:06:29Z")

</div>

can someone help me edit the code so it displays the unit in millimeter?  
I know i can use the Convert Between Units node but it will be better if its already included in the script so I don’t need to use additional node.

Currently it is displaying in Feet. Thank you!

---

<div class="post-metadata">

**Author:** ![Weston.Rodberry](https://avatars.discourse-cdn.com/v4/letter/w/b5a626/32.png) [@Weston.Rodberry](https://forum.dynamobim.com/u/Weston.Rodberry)\
**Post date:** [October 25, 2022, 2:20am UTC](https://forum.dynamobim.com/t/get-wall-layer-thicknesses-from-python/40122/10 "2022-10-25T02:20:28Z")

</div>

> [@maciek.glowka](#):
>
> ```auto
> import clr
> 
> #The inputs to this node will be stored as a list in the IN variables.
> walls = UnwrapElement(IN[0])
> 
> output=[]
> 
> for w in walls:
> #output.append(w.WallType.GetCompoundStructure())
> cs = w.WallType.GetCompoundStructure()
> i0 = cs.GetFirstCoreLayerIndex()
> i1 = cs.GetLastCoreLayerIndex()
> d = 0
> for idx in range(i0,i1+1):
> d+=cs.GetLayerWidth(idx)
> output.append(d)
> 		
> OUT = output
> 
> ```

This is my list of walls:  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/a/ca6a7b00a7c96cc78cb63456b3971b5b69deb9ad.png)

---

<div class="post-metadata">

**Author:** ![Weston.Rodberry](https://avatars.discourse-cdn.com/v4/letter/w/b5a626/32.png) [@Weston.Rodberry](https://forum.dynamobim.com/u/Weston.Rodberry)\
**Post date:** [October 25, 2022, 2:24am UTC](https://forum.dynamobim.com/t/get-wall-layer-thicknesses-from-python/40122/11 "2022-10-25T02:24:12Z")

</div>

Here is the whole context:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/b/4b79277cf983315099f0c6f47ea9d0f584d0f983.png)

---

<div class="post-metadata">

**Author:** ![theshysnail](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/theshysnail/32/146653_2.png) [@theshysnail](https://forum.dynamobim.com/u/theshysnail)\
**Post date:** [October 25, 2022, 2:37am UTC](https://forum.dynamobim.com/t/get-wall-layer-thicknesses-from-python/40122/12 "2022-10-25T02:37:31Z")

</div>

It may be possible that one or more walls do not have any core layers or the wall list may have a null value.

---

<div class="post-metadata">

**Author:** ![theshysnail](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/theshysnail/32/146653_2.png) [@theshysnail](https://forum.dynamobim.com/u/theshysnail)\
**Post date:** [October 25, 2022, 2:39am UTC](https://forum.dynamobim.com/t/get-wall-layer-thicknesses-from-python/40122/13 "2022-10-25T02:39:32Z")

</div>

You can maybe do this with the code.  
`d+= (cs.GetLayerWidth(idx)) * 304.8`

---

<div class="post-metadata">

**Author:** ![theshysnail](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/theshysnail/32/146653_2.png) [@theshysnail](https://forum.dynamobim.com/u/theshysnail)\
**Post date:** [October 25, 2022, 2:44am UTC](https://forum.dynamobim.com/t/get-wall-layer-thicknesses-from-python/40122/14 "2022-10-25T02:44:43Z")

</div>

You probably need to get rid of Curtain Walls.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/0/9092cc2646394eda92710006b85302b37d11d73c.jpeg)

---

<div class="post-metadata">

**Author:** ![Revit\_Noob](https://avatars.discourse-cdn.com/v4/letter/r/a587f6/32.png) [@Revit\_Noob](https://forum.dynamobim.com/u/Revit_Noob)\
**Post date:** [October 25, 2022, 2:47am UTC](https://forum.dynamobim.com/t/get-wall-layer-thicknesses-from-python/40122/15 "2022-10-25T02:47:16Z")

</div>

> [@theshysnail](#):
>
> - 304.8

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![Weston.Rodberry](https://avatars.discourse-cdn.com/v4/letter/w/b5a626/32.png) [@Weston.Rodberry](https://forum.dynamobim.com/u/Weston.Rodberry)\
**Post date:** [October 25, 2022, 1:15pm UTC](https://forum.dynamobim.com/t/get-wall-layer-thicknesses-from-python/40122/16 "2022-10-25T13:15:24Z")

</div>

> [@theshysnail](#):
>
> - 304.8

That was it! BUT I was expecting it to give me 10 lists of materials and their individual thicknesses. ☹

---

<div class="post-metadata">

**Author:** ![theshysnail](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/theshysnail/32/146653_2.png) [@theshysnail](https://forum.dynamobim.com/u/theshysnail)\
**Post date:** [October 26, 2022, 1:38am UTC](https://forum.dynamobim.com/t/get-wall-layer-thicknesses-from-python/40122/17 "2022-10-26T01:38:08Z")

</div>

This gets all compound layers of the walls, not just the core layers.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/3/0348e8164d378504c6df1a09e0eaa66308d2e3e1.png)
