Get Wall Layer Thicknesses From Python?

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.

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!

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

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

1 Like

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
1 Like

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

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.

I’m getting an error when using your code from here. The error says:
image

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

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!

This is my list of walls:
image

Here is the whole context:

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

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

1 Like

You probably need to get rid of Curtain Walls.

Thanks a lot!

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

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