Get parameter value (Thickness) from a Revit Element using Python

Hi!

I just stated using Dynamo and Python. I created this python script to only extract the thickness information out of my chosen element (foundation) but when i run it, i get an error that floor object has no attribute Thickness.

Annotation 2022-11-13 150527

This is my python script:

import sys

import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *

clr.AddReference(“RevitNodes”)
import Revit
clr.ImportExtensions(Revit.Elements)

clr.ImportExtensions(Revit.GeometryConversion)

dataEnteringNode = IN

elem = UnwrapElement(IN[0])

OUT = elem.Thickness

Hi @iZ7HWE ,

Any specific reason you are using Python for this?
There is an OOTB node called Element.GetParameterValueByName which does exactly what you want.

1 Like

Hi @iZ7HWE welcome to the forum!

The best thing to do is install Revit Lookup.
Select the element in Revit and open the addin.
After that you can check the parameter Thickness, i guess it is a builtin parameter.

Than you need to use the code :
elem.get_Parameter(BuiltinParameter.###).
In the addin you can also see what you need to use after the dot, .AsInteger () for example.

Good luck :slight_smile:

4 Likes

try:

OUT = elem.LookupParameter(“Thickness”). AsInteger()

3 Likes

Thanks so much for your fast answer. It really helped me to fix my problem.

1 Like

I also tried with LookupParameter too and it worked. Thank you

1 Like

Glad to hear!