Rewriting gcodepreview with Python

(essentially thinking out loud here)

Working on adding support for dovetail and keyhole tools, which has been slow going, and also bogged down a bit by:

so experimenting a bit and playing around with the idea of using METAPOST to make SVG instead.

This is reasonably straight-forward:

  • install TeX, ensuring that it gets added to the filepath

  • make a .mp file like to:

    outputtemplate := “%j.svg”;
    outputformat := “svg”;
    input mpcolornames;
    beginfig(1);
    draw fullcircle scaled 72bp withcolor Blue;
    endfig;
    bye

  • call it using:

    import subprocess
    subprocess.run(“mpost test.mp”, shell=True)

which results in:

test

and best of all, imports as expected:

but of course, raises the question — is it worth introducing a second tool?