How to fix dirty polylines?

In another thread, I ended up with “dirty polylines” that double back on themselves with overlapping segments. I tried various ways to find the pair of points (in a cloud of segment end points) most distant from each other and stumbled on Discontinuity for that job, though am not quite sure why it works?

Here I’ve created a test using 77 random lines. I divide each line and Jitter the points to create visually identical “dirty polylines(verified by comparing their lengths, not shown). The pink points are the “real end points” of the lines while the rest of the points come from Discontinuity, proving that the method doesn’t work here as it did in the other model. (20.5 KB)

Two questions:

  1. Why the difference?
  2. More importantly, how to fix the dirty polylines? (without using the original “clean lines”)
    Of the eight discontinuity points for each line (why 8?), which pair are furthest apart, suitable for recreating “clean lines”?

P.S. I guess the answer to the first question is that this test doesn’t replicate the conditions in the other model, which is more likely two segments of different lengths with a shared start or end point. I could just be grateful that the other model works and forget about it, I guess… but I’m curious?

1 Like

Here’s one way: (16.4 KB)
needs this component:
Topologizer.gha (19 KB)

1 Like

Interesting, thanks. Eight years old? I imagine it can cover many sins…

No sign of a Rhino 6 version but assume you wouldn’t mention it if it isn’t compatible?

1 Like

It should work in any version of Rhino.

It does. The “Download and Install” feature fails so I used the copy you posted, thanks again.


The sandboxtopology.gha file from Food4Rhino is 59 KB compared to Topologizer.gha at 19 KB so I guess there are more features in it? I didn’t install it to find out as I am reluctant to install any plugins for several reasons… But in the spirit of trust, let go and let it flow, I tried Topologizer.

This model has two sets of SOURCE geometry, ‘Sphere Lines’ and ‘Random Grid(from the other thread). And two METHODS, ‘Topologizer’ and ‘By Hand(from the other thread). Two Value List components (blue groups) allow any combination of SOURCE and METHOD. (55.5 KB)

Surprisingly, the ‘By Hand’ method seems to work with ‘Sphere Lines’, despite Dispatch ‘B’ having no output. Otherwise, the results are very similar.

Using ‘Random Grid’:

  1. Topologizer’ treats all four edges of the perimeter as a single curve whereas ‘By Hand’ sees them as four segments.
  2. Evaluate Curve indicates that ‘t’ values are different between the two methods as the moving point is at a slightly different location for a given ‘t’ value and slows down and speeds up using ‘Topologizer’.

I’m uncomfortable with the mysterious black box nature of plugins but concede this works well.

Try with fit line

Fit Line works well with the ‘Sphere Lines’ because their discontinuity points are distinctly linear.
The ‘Random Grid’ is more problematic because the rectangular curves must be broken up and sifted into horizontal and vertical segments before joining each type separately (both outputs of Dispatch in the yellow “dirty polylines” group). At that point, there is no difference between Fit Line and what I am doing because Discontinuity returns only two points.

I am not sure if i understand the problem, for grid you can also use fit line.

Thanks anyway but I don’t recreate code from images, especially icons. And as I explained in my previous post, I tried using Fit Line and didn’t find it useful for the random grid of rectangles.

You don’t need to tell me that

?? Had you posted the GH file instead of just the image, I would have looked at it.