How do get the value of the pipe type name?

Hi
If I use two nodes “PipeTypes” and “getName”, then the values of the pipe type names are output. However, when I try to transfer the code to one node, I get nothing. I need to get the values of pipeline type names in one node. What am I doing wrong?

P.s. I’m trying to use the getName function from the Clockwork Element node.Name+.

import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Plumbing import *

clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

def GetName(item):
	if hasattr(item, "Name"): return item.Name
	else: return None
	
pipetypes = FilteredElementCollector(doc).OfClass(PipeType).ToElements()  

if isinstance(pipetypes, list): 
	OUT = [GetName(x) for x in pipetypes]
else: OUT = GetName(pipetypes)

@Kungur ,

what do you need more ?

import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

clr.AddReference('System')
from System.Collections.Generic import List

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

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

#Preparing input from dynamo to revit
elements = UnwrapElement(IN[0])

output = []

for i in elements:
	output.append(i.Name)

OUT = output

or just codeblock


KR
Andreas

1 Like

Thank you, Andreas!
I need to get only one Python script node, , in which I will get the names of pipe types. I need only Python solution, without standard nodes Dynamo.

1 Like

Why?

you will have error if you use pipe.Name
you can use:
name = Element.Name.GetValue(pipe)

3 Likes

Thank you very much! It is working.

typesnames = []
pipetypes = FilteredElementCollector(doc).OfClass(PipeType).ToElements() 

for p in pipetypes:
	name = Element.Name.GetValue(p)
	typesnames.append(name)

OUT=typesnames
1 Like