Get sum of line lengths up to a certain points

Hi guys,

I’m here again and I need some tips of how this could be solved.
I created a script which collects all pipe fittings in connected network and measure a distance between each of the fitting. It works just super fine.

But it’s not what I really need.
In one of the screenshots above you see some pipes and fittings connected to a network. Some fittings are tagged (100, 101, 102, 103).

What I really need is the distances between:
Node 100 to 101;
Node 101 to 102;
Node 102 to 103.

Note that distance between two nodes shouldn’t be the shortest path, but must go through each point (pipe fitting) that are in between.
For example: distance between node 100 to 101 should be the sum of the lines 100-1, 1-2, 2-3, 3-4, 4-5, 5-6, 6-7, 7-8, 8-9, 9-10, 10-11, 11-12, 12-101.

I guess I need to include some formulas with IF function, but I don;t really know where to start.
Something like: IF pipe fitting has a parameter value (in our case 100, 101, 102, 103), calculate length between points and sum.

It’s important to mention that tagged pipe fittings could be random ones. So this script should sum the lengths between only tagged fittings.
Eg.

1 Like

@zalgirietis.minde

hi,

there was a similar issue

I managed to do it by creating a polycurve and splitting it with Curve.SplitByPoints node.

1 Like