# Change Wall Thickness : Revit API Python Scripting

**URL:** <https://forum.dynamobim.com/t/change-wall-thickness-revit-api-python-scripting/56922>\
**Category:** Developers\
**Created:** [November 4, 2020, 5:04pm UTC](https://forum.dynamobim.com/t/change-wall-thickness-revit-api-python-scripting/56922 "2020-11-04T17:04:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![harilalmn](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/harilalmn/32/116193_2.png) [@harilalmn](https://forum.dynamobim.com/u/harilalmn)\
**Post date:** [November 4, 2020, 5:04pm UTC](https://forum.dynamobim.com/t/change-wall-thickness-revit-api-python-scripting/56922/1 "2020-11-04T17:04:55Z")

</div>

Dear all,  
I have to write a python script that changes the core layer thickness of a newly created walltype by duplicating an existing walltype. I have tried so many times and failed. If someone could help me, it would be great. I have tried the solutions in related posts here, without any luck. Please check what I am doing wrong.

This is my import statements;

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

```

Here is the portion of the code which should change the wall thickness;

```
t = Transaction(doc, "change_wall_thickness")
t.Start()
cs = wall_type.GetCompoundStructure()
i = cs.GetFirstCoreLayerIndex()
thickness_to_set = 0.754593
cs.SetLayerWidth(i, thickness_to_set)
t.Commit()

```

I tried this too;

```
t = Transaction(doc, "change_wall_thickness")
t.Start()
cs = wall_type.GetCompoundStructure()
layers = cs.GetLayers()
layers[0].Width = 0.754593
t.Commit()

```

Still no luck…  
I am using Interactive Python Shell to run this, not Dynamo’s Python script node.

---

<div class="post-metadata">

**Author:** ![AmolShah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/amolshah/32/103244_2.png) [@AmolShah](https://forum.dynamobim.com/u/AmolShah)\
**Post date:** [November 4, 2020, 6:04pm UTC](https://forum.dynamobim.com/t/change-wall-thickness-revit-api-python-scripting/56922/2 "2020-11-04T18:04:25Z")

</div>

@harilalmn Taking reference from @Dimitar_Venkov’s code:  
It seems like you are missing the last line to SetCompoundStructure

```
cs = wall_type.GetCompoundStructure()
i = cs.GetFirstCoreLayerIndex()
cs.SetLayerWidth(i,thickness_to_set)
wall_type.SetCompoundStructure(cs)
```

---

<div class="post-metadata">

**Author:** ![harilalmn](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/harilalmn/32/116193_2.png) [@harilalmn](https://forum.dynamobim.com/u/harilalmn)\
**Post date:** [November 4, 2020, 6:23pm UTC](https://forum.dynamobim.com/t/change-wall-thickness-revit-api-python-scripting/56922/3 "2020-11-04T18:23:14Z")

</div>

Thanks a lot my friend…! That worked…!
