Close
0%
0%

KerfScript: a language for laser-cut designs

Write parametric laser designs in code, then export layered SVG or DXF with kerf compensation, joinery and sheet layout.

Similar projects worth following
0 followers
Hey! I'm a co-founder of MyLaserTools, a site with free laser design generators. As we built them, we received feedback from people who wanted to contribute parametric designs of their own. We needed a way to write those designs so they could be shared, adjusted and rendered by the site. That is where KerfScript began.

KerfScript uses OpenSCAD-style syntax for flat parts. A .kerf file can put geometry on cut, score and engrave layers, compensate for beam width, make finger joints and slots from material thickness, and lay named parts out on sheets. It exports SVG and DXF.

Now the interpreter is public, with a playground, a CLI, documentation and example models. The files we've been creating work well. Our hope is that the notation becomes useful beyond MyLaserTools: makers can contribute generators and other tool builders can read or produce .kerf files.

What a .kerf file describes

KerfScript uses syntax familiar to people who have used OpenSCAD, with features for flat parts and laser workflows. A source file can:

  • Place geometry on cut, score and engrave layers.
  • Use material thickness and beam width to size slots, finger joints and other features.
  • Define parameters such as dimensions, labels and quantities.
  • Lay parts out on sheets and export SVG or DXF.

A small example

This box uses the bundled library. The dimensions can be changed without redrawing six separate panels:

use <kerf/box>

width = 120;       // [40:5:400]
depth = 80;        // [40:5:400]
height = 50;       // [20:5:300]
$thickness = 3;
$kerf = 0.15;

box([width, depth, height], lid = true);

Open the box in the browser playground to change its parameters and see the result. KerfScript also has a command line interface:

npx @mylasertools/kerfscript render box.kerf -o box.svg

  • KerfScript went live today

    Julia M • 2 hours ago • 0 comments

    KerfScript went live today. The code is public, and the playground is ready to try. 

    From here, I want KerfScript to find a life beyond MyLaserTools. I hope to write a post for Hacker News about why we built it and what people can do with it. I also want to create a place on MyLaserTools where people can use the playground to make parametric designs for themselves and share designs that others can customize.

    My hope is that .kerf becomes a useful notation for makers and for other people building design tools. If you try it, I'd like to hear what works, what gets in your way, and what you would want to build with it.

    As for today I will play around and create more models, because this is very fun!

View project log

Enjoy this project?

Share

Discussions

Does this project spark your interest?

Become a member to follow this project and never miss any updates