Convert some dead-end streets in network to polylines

Dear community,

i have a certain problem that i am stuck on for few days.
Let’s say i have a given network of streets. No islands.


I want to filter out dead-end street lines at marked locations and join them in polylines. Every given dead-end street should be converted to single polyline.

My approach was:

  1. Build a network from input lines.
    (They were polylines originally, but exploded them to line segments.)

  2. Find the indexes of given street-end nodes.
    (Note: Not all network ends are dead-ends. Dead-ends are predefined.)

  3. Look for next node in network. Check if the node valence is less than 3. Continue searching until ’valence >= 3’ condition is met.

  4. Append nodes from above in proper branches in correct order. Make a polyline.
    Or find corresponding network line of these nodes. Branch them per initial dead-end points. Join them.

Since i dont speak any language, my only options were Anemone and Hoopsnake. Have tried SpaceSyntax components as well. Unfortunately i was constantly hitting the wall, with no decent results.

For any advice or solution (scripted or not) i would be very, very thankfull.

NetWork.gh (11.2 KB)

That’s easy via code (but I’m not in the practice right now). Keep in mind that a C# based solution would be a black box for you.

General strategy: do graph’s VV connectivity (since you claim that (1) there’s no islands, (2) you don’t have a Graph Tree to resolve, (3) you are sure that your Graph is OK … you can safely use Sandbox) and for each node with valence 1 (and marked as a dead-end start [or end]) recursively search for an adjacent one that has valence >= 3.

If on the other hand you want to mark the nodes interactively … that requires some lines of code more (storing volatile data in a parameter and prior the next search input these etc etc).

So the only thing that matters (in real-life) in this case is the way that you mark the desired valence 1 nodes.

I have marked them in above attached definition. As you mentioned with Sandbox and ClosestPoint pairing. Initial nodes are always of valence 1. I have indexes of nodes but cannot implement recursiveness succesfully. :frowning:

image

Let it be a black box. But not for ever. Eventually i will learn scripting. :slight_smile:

Hurry: time flies and not even The Lord can reverse things (BTW: with regard the language > the long way home is the short way home).

Graphs_DeadEnds_V1.3dm (131.8 KB) Graphs_DeadEnds_V1.gh (128.3 KB)

NOTE: This DOES NOT check your Graph for things that it should check (life sucks) … meaning that bananas MAY be the menu of the day.

3 Likes

Thank youu, Peter. This is doing exactly what i want.
You are magnificent!!

Added a safety net in case that you identify non valence 1 start nodes.

Graphs_DeadEnds_V1A.gh (127.3 KB)

Update: Added TextDots

Graphs_DeadEnds_V1B.gh (133.6 KB)

2 Likes