Hi, here is my newer version for this kind of job...
Regards, M.R.
IDEA Network Topology-new-reza-all-lengths.dwg
lengths_along_pipe_trees-Djikstra.lsp
length_along_pipe_trees-Djikstra.lsp
lengths_along_pipe_trees.lsp
length_along_pipe_trees.lsp
I modified mine to toggle groups but also indicates the status at the command line with either <Group on> or <Group off>. Was the default 25 years ago, not sure why they changed it.
https://www.cadtutor.net/forum/topic/550-contribute-a-tip-become-famous/page/17/#comment-567790