Skip to content

script to remove coextensive segments #9

Description

@sbma44

Thanks very much for publishing your work, and in particular for the hiddenwire algorithm. I've been wanting something like this for my DIY plotter but had abandoned the effort after a few dead-ends based on other projects.

Your work generates great output, but the SVGs contain many segments that are collinear. My plotter is not smart enough to avoid drawing these lines multiple times, which, depending on the pen I use, creates an unwanted variation in line thickness.

I've taken a pass at a script to remove these duplicative segments. It is not thoroughly tested but shows good results with the STL I've been playing around with. I will probably put a few more STLs from here through it this evening.

I'm afraid that I haven't written C in quite a while, so this is in Python, which is why I'll offer it as a gist rather than a pull request:

https://gist.github.com/sbma44/dc34e5005d9827aa7b1c8c11e68b0c6b

You will find the STL as well as the before & after SVG. The before SVG has randomly-assigned colors for the line segments to make it a little easier to spot overlap.

You'll also note a stray line segment in both the before & after. I'm afraid I haven't been able to find where that's coming from (it's easy enough for me to delete in inkscape before rendering gcode). You might have a better hunch than me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions