# Python code for getting the dimension is not working

**URL:** https://forum.dynamobim.com/t/python-code-for-getting-the-dimension-is-not-working/101583
**Category:** Revit
**Tags:** python, dynamo
**Created:** [June 4, 2024, 5:01am UTC](https://forum.dynamobim.com/t/python-code-for-getting-the-dimension-is-not-working/101583 "2024-06-04T05:01:08Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![sanjana.singh](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@sanjana.singh](https://forum.dynamobim.com/u/sanjana.singh)
#### Post date: [June 4, 2024, 5:01am UTC](https://forum.dynamobim.com/t/python-code-for-getting-the-dimension-is-not-working/101583/1 "2024-06-04T05:01:08Z")

</div>

Hi All,  
Here I’m facing an issue with the python script. Requesting your hearty support.

```auto
import clr
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import Document, Wall, Parameter, \
    FilteredElementCollector, BuiltInCategory, UnitUtils, UnitTypeId

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

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

# Get the current Revit document

doc = DocumentManager.Instance.CurrentDBDocument

# Get the Structural Columns category

category = BuiltInCategory.OST_StructuralColumns

# Create a filter to collect only structural columns

filter = FilteredElementCollector(doc).OfCategory(category).WhereElementIsNotElementType()

# Initialize an empty list to store the column lengths

dimension_values = []
g = []

# Iterate through the filtered columns

for column in filter:
    # Get all parameters of the column
    parameters = column.Parameters

    #g.append(parameters)

    # Iterate through the parameters
    for param in parameters:
        
        # Filter for parameters of type "Dimension"
        if param.StorageType == Autodesk.Revit.DB.StorageType.Double:
            # Get the parameter value
            value = param.AsValueString()
            g.append(param.Definition.Name)
 

            # Add the value to the dimension_values list
            dimension_values.append(value)

 

# Set the dimension parameter values as the output of the script
OUT = dimension_values,g
#OUT = (dimension_values, g)

```

Regards,  
Sanjana

---

<div class="post-metadata">

### Author: ![SailishCephas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sailishcephas/32/175567_2.png) [@SailishCephas](https://forum.dynamobim.com/u/SailishCephas)
#### Post date: [June 4, 2024, 5:27am UTC](https://forum.dynamobim.com/t/python-code-for-getting-the-dimension-is-not-working/101583/2 "2024-06-04T05:27:56Z")

</div>

Can you Post the error you are encountering in the output node?

---

<div class="post-metadata">

### Author: ![emrullah.yildiz](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/emrullah.yildiz/32/177572_2.png) [@emrullah.yildiz](https://forum.dynamobim.com/u/emrullah.yildiz)
#### Post date: [June 4, 2024, 11:46am UTC](https://forum.dynamobim.com/t/python-code-for-getting-the-dimension-is-not-working/101583/3 "2024-06-04T11:46:23Z")

</div>

A screenshot from Dynamo environment would be more helpful for us to understand the issue. Please, make sure that input data are visible for the python script.

---

<div class="post-metadata">

### Author: ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)
#### Post date: [June 4, 2024, 12:47pm UTC](https://forum.dynamobim.com/t/python-code-for-getting-the-dimension-is-not-working/101583/4 "2024-06-04T12:47:53Z")

</div>

Hi,

if it concerns the dimensions of Structural Columns it is necessary to access the parameters of type

```auto
import clr
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import Document, Wall, Parameter, \
    FilteredElementCollector, BuiltInCategory, UnitUtils, UnitTypeId, GroupTypeId

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

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

# Get the current Revit document

doc = DocumentManager.Instance.CurrentDBDocument

# Get the Structural Columns category

category = BuiltInCategory.OST_StructuralColumns

# Create a filter to collect only structural columns

structuralColumns = FilteredElementCollector(doc).OfCategory(category).WhereElementIsNotElementType()

# Initialize an empty list to store the column lengths

dimension_values = []
g = []

# Iterate through the filtered columns

for column in structuralColumns:
    # Get all parameters of the column
    columnType = doc.GetElement(column.GetTypeId())
    parameters = column.Parameters
    parametersType = columnType.Parameters

    #g.append(parameters)

    # Iterate through the parameters
    for param in parametersType:
        
        # Filter for parameters of type "Dimension"
        if param.StorageType == Autodesk.Revit.DB.StorageType.Double and param.Definition.GetGroupTypeId() == GroupTypeId.Geometry :
            # Get the parameter value
            value = param.AsValueString()
            g.append(param.Definition.Name)
 
            # Add the value to the dimension_values list
            dimension_values.append(value)

 

# Set the dimension parameter values as the output of the script
OUT = dimension_values,g
#OUT = (dimension_values, g)

```
