How to get the host pipe from a pipe fitting

Hi all,

I need to get the element id of the pipes which are connected to a particular fitting. Is there any way to get this by using dynamo?

mepover

Hi @Akhilthanku

this just one of any way:

for all pipes and fittings IN ACTIVEVIEW you can get list of pipes and connect to them fittings
for example

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

clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
doc=DocumentManager.Instance.CurrentDBDocument
collector=FilteredElementCollector(doc,doc.ActiveView.Id)
ps=collector.OfCategory(BuiltInCategory.OST_PipeCurves).WhereElementIsNotElementType().ToElements()

collector=FilteredElementCollector(doc,doc.ActiveView.Id)
ft=collector.OfCategory(BuiltInCategory.OST_PipeFitting).WhereElementIsNotElementType().ToElements()

ft_=[]
for i in ft:
	try: 
		i.MEPModel.ConnectorManager.Connectors	
		ft_.append(i)
	except: pass

ps_ft_connect=[ [i,j] for i in ps for j in ft_ for x in i.ConnectorManager.Connectors for y in j.MEPModel.ConnectorManager.Connectors  if x.IsConnectedTo(y)==True  ]


dict= dict()
for x in ps_ft_connect:
    i = x[0]
    if i in dict:
        dict[i].append(x[1])
    else:
        dict[i] = [x[1]]
result = sorted([[k,v] for k,v in dict.items()], key = lambda x: x[0])

for x in result:
    for y in x[1]:
        x.append(y)
    x.remove(x[1])

OUT = result

You are may check to correctly work this script that:

image

And
for all pipes and fittings you can get list of fittings and connect to them pipes
then just change this string:

ps_ft_connect=[ [i,j] for i in ps for j in ft_ for x in i.ConnectorManager.Connectors for y in j.MEPModel.ConnectorManager.Connectors  if x.IsConnectedTo(y)==True  ]

to this:

ps_ft_connect=[ [j,i] for i in ps for j in ft_ for x in i.ConnectorManager.Connectors for y in j.MEPModel.ConnectorManager.Connectors  if x.IsConnectedTo(y)==True  ]

Hi @Akhilthanku Try using the MEPOver node:

Or try this one from MEPover:
image

3 Likes

the easiest way was under the nose :ok_hand: :grin:

ya thanks everyone. I used MEPover

hello,

Anyone knows a way i could possibly host pipes to a surface?