Make you a puzzle in Elm

I had some fun generating jigsaw puzzles in Elm, and cutting out the result with a Lasercutter at a local maker space.

I wrote about it here: https://www.juricho.me/posts/puzzle-generator/

The post turned out to be a bit long and code heavy, I’m still learning how to do exposition that is easy to follow and shows the right level of detail. I hope the pictures and the Ellies make up for it!

I made sure to put the whole thing into a clean code repo that you could step through, so you can also just read that: https://github.com/2mol/jigsaw-tutorial

13 Likes

Very cool! Have you considered generating G-code for the laser cutter directly?

I didn’t consider that! The machine I used is connected to a computer, literally configured as a printer. All you do is open an svg in adobe illustrator, and configure some stuff like cutting speed etc.

But @ianmackenzie mentioned that he was working on a package for doing exactly that: https://twitter.com/ianemackenzie/status/1202237766224031746 :slight_smile:

2 Likes

Nice! I suspect that generating your own G-code will help with things like glitchy corners and finding optimal paths.

I’ve found generating G-code to be not too bad (for CNC machines, which are 3D and so a little tougher). One piece of advice: look at a lot of existing G-code that you know works on your machine, making sure that whatever you generate looks pretty similar. These devices have lots of hidden invariants!

Oh, so G-codes are machine-specific? That sounds pretty tricky!

Yeah, G-code definitely varies from machine to machine. As I recall that’s especially true for M-codes which are for specialized behavior like “turn on coolant pump” but even basic stuff like G02/G03 arcs aren’t totally standard - some machines will treat the IJ values passed as absolute coordinates of the arc center, and others will treat those as coordinates relative to the arc start point. So if you generate some G-code and it’s giving you huge arcs, that’s probably what’s going on.

1 Like

This isn’t particularly Elm related, but I’ve found it very helpful to write a simulator for a given machine, especially when 18k RPM drill bits and $50k vacuum tables are involved.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.