Hi All,
Here I’m facing an issue with the python script. Requesting your hearty support.
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
Can you Post the error you are encountering in the output node?
1 Like
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.
Hi,
if it concerns the dimensions of Structural Columns it is necessary to access the parameters of type
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)
1 Like