HELP PROBLEMS WITH virtual length parameters CHECK OF TEES AND CROSSES

I am developing a routine to check and fill the virtual length parameters of the parts so named here in Brazil, it is checked at tee joints, crosspieces, all pipe fittings that have two or more outlets, during this week I am trying to solve a problem with my routine as shown in the image below for bi lateral output we have a xxx and for direct output a yyy value, until then routine works on all hydrants, but on hydrant “H6” value that should be xxx leaves yyy, this for TÊ BSP connections and in the same it happens in the H8 when I check the crosshead was supposed to be xxx and the value obtained is yyy.

000_TESTE .dyn (213.9 KB)