Reading a MEPSystemTypes.Name attribute

Hi,
I trying to build a dynamo script to create new Pipe and duct systems in Revit. I’m using Python to duplicate an existing system in Revit, which works fine. The problem is when the system type name is already used. I tried to check the name of the new system against existing one, but it seems that I cannot read the “.Name” property. Any idea?

Another way to put it is, how can I associate a specific system type (based on its name) to a variable in Python in order to modify that system type?

Thank you for your help!

Maybe try builtInParam?
if el.get_Parameter(BuiltInParameter.RBS_PIPING_SYSTEM_NAME_PARAM).AsString() == NewName
Sth like this should work

Thank you for the suggestion but it doesn’t work. I get the following error:

AttributeError: “type” object has no attribute “RBS_PIPING_SYSTEM_NAME_PARAM”

Are you sure this parameter exists?
RBS_PIPING_SYSTEM_NAME_PARAM

I could not find it in the API documentation. The closest to it is:
RBS_PIPING_SYSTEM_TYPE_PARAM
http://www.revitapidocs.com/2017/?query=piping%20param&filter=0&#searchModal

I tried with a random param name (bla) and the error I get is that the param does not exist. When trying with RBS_PIPING_SYSTEM_TYPE_PARAM, it says attribute error, which to me, I’m not using it right.

Now I did more testing and I found a way (and a really easy one) to make my code work. If I don’t unwrap my input, I can access the name propoerty of the Dynamo object. I’ve also use Dynamo to feed the list of MEPSystemType to my python node so I don’t have to create a filtered collection. It works really well. Here is the code for reference:

import clr
clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import *

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

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

doc = DocumentManager.Instance.CurrentDBDocument

AllMEPSystems=IN[0]
SourceSystem=UnwrapElement(IN[1])
NewName = IN[2]
Abb=IN[3]

result=list()

TransactionManager.Instance.EnsureInTransaction(doc)
try:
NewSystem=SourceSystem.Duplicate(NewName)
except:
for el in AllMEPSystems:
result.append(el.Name)
if el.Name==NewName:
NewSystem=el
#endif
#end for
#end except

UnwrapElement(NewSystem).Abbreviation=Abb

TransactionManager.Instance.TransactionTaskDone()

OUT=result

Thank you for your help!