Get pipes with certain direction

how can I get pipes with a certain direction of flow? Is this possible?

Can you please refer to what you have tried so far and/or to related posts such as this one?

1 Like

this my code :

import clr
from Autodesk.DesignScript.Geometry import *
# Import RevitAPI
import Autodesk
from Autodesk.Revit.DB import *
# библиотека динамо для работы с ревитом
import RevitServices
# Использование библиотеки DSCoreNodes (основные ноды расположенные на вкладке библиотеки слева в разделе Core)
clr.AddReference("DSCoreNodes") # DSCoreNodes.dll лежит здесь C:\Program Files\Dynamo\Dynamo Core\1.3
import DSCore
from DSCore import *

import itertools

#Назначьте вывод переменной OUT.

#filter pipes
list_ps=[i for i in IN[0] if i.GetCategory.Name=="Трубы"] 
#filter pipes fittings
list_fs=[i for i in IN[0] if i.GetCategory.Name=="Соединительные детали трубопроводов"]     

#get intersectioon fittings with pipes
for k in list_fs:
	for j in list_ps:
		if k.BoundingBox.Intersects(j.BoundingBox)==True:
			sublist= [k, j]        
lst=sorted(list_z, key=lambda x: x[0] )

#Sort pipes from fittings
ps = dict()
for x in lst:
    p = x[0]
    if p in ps:
        ps[p] = [x[1]]
result = sorted([v for k,v in ps.items()], key = lambda x: x[0])
# elbow and tee lists
#for i in result:
#    if i.Count==2:
#        list_elbow.append(i)
#    else:
#        list_tee.append(i)

OUT = result


and this simple pipes

1 Like

im just get pipes which is connected to individual tee (later ill use many branches of pipes but now its just simle example)

and im want to get in different lists the pipes in green frame and red frame

may be use the degrees between pipes: 0 degress or 90 degress for example…
and better : if we now flow direction (how vectors orientation for example) then we can filter pipes with similar direction

and main : im want to do this in python (or used minimum count of code blocks)

This thread could interest you too:

@til.shviger It would help if you could upload a small Revit file with few pipes.

1 Like

this rvt file

1 Like

@Vikram_Subbaiah , are you haven’t found a solution for my question ?

1 Like

@til.shviger I can foresee inadequacies in the example below, but hopefully it will help direct you
pipeDirection.dyn (9.3 KB)

1 Like

thank you!
Can you explain me how works the node Vector.Normalized? why we are use it?

1 Like

Vector.Normalized gives us the corresponding unit vectors and enables comparison
The origin of all normalized vectors is the origin and magnitude is 1.

1 Like