Pipe Type Property Union

Hello everyone,
I am trying to get the union family set for ducts and pipes in routing preferences for revit 2022. I managed to get the one for duct types but the same method fails for pipe types. You can see that python recognises that PipeTye has a attribute called “Union” but it is set to none eventhough I made sure that it is set in revit. Any advices?

@tarek.mallak It is working perfectly from my side, can you share your script?

Hi @tarek.mallak

try using RoutingPreferenceManager

import clr
import sys
import System
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS

#import Revit API
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB
from Autodesk.Revit.DB.Plumbing import *

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

pipe = UnwrapElement(IN[0])
manager = pipe.PipeType.RoutingPreferenceManager
ruleUnion = manager.GetRule(RoutingPreferenceRuleGroupType.Unions , 0)
unionType1 = doc.GetElement(ruleUnion.MEPPartId)

OUT = unionType1

Works perfectly! Thanks a lot!

1 Like