Error when trying to export Name parameter for PipingSystemType

Hello everyone,
I am having errors with an script that should export to Excel the name of all the Piping System Types in a Project without elements, but where the Piping System Types were defined in the Revit Template.

The script that I am using is

import clr
clr.AddReference('RevitAPI')
import Autodesk.Revit.DB as DB
import xlsxwriter

doc = __revit__.ActiveUIDocument.Document

# Get all PipingSystemType elements
piping_system_types = DB.FilteredElementCollector(doc).OfCategory(DB.BuiltInCategory.OST_PipingSystem).ToElements()

# Create Excel workbook and worksheet
workbook = xlsxwriter.Workbook('PipingSystemTypes.xlsx')
worksheet = workbook.add_worksheet()

# Write headers
worksheet.write('A1', 'Piping System Type Name')

# Write PipingSystemType names to Excel
row = 1
for piping_system_type in piping_system_types:
    print (piping_system_type.Id)
    worksheet.write(row, 0, piping_system_type.Name)
    row += 1

workbook.close()

And it gives an error for piping_system_type.Name that says AttributeError: Name

When I explore the Id number in the Revit LookUp, I see that the attribute Name is declared twice, and I do not know how to access the one I need.

What I am doing wrong?

It is a common pattern and something that is wrong for some of the attributes in the Revit API

This shoudl do the trick

DB.Element.Name.GetValue(piping_system_type)

for reference

Thank you @Jean-Marc ,
knowing the pattern allowed me to find out also how to get the LineColor values from the PipingSystemType objects.

Have a nice weekend!

1 Like