Skip to content

Optimize rendered SVG #1

@nickcoutsos

Description

@nickcoutsos

laser cut acrylic is expensive, and printing two copies is twice the price of printing one copy. So if you could bring both halves into one svg file and minimise wasted space, this would be a lot cheaper to print an entire keyboard.

The SVG shown in the repo can certainly be used as a cutting template as-is, but it hasn't been optimized. I mainly wanted to illustrate the output of this codebase: 2D geometry.

Optimization is an interesting problem, and not entirely straightforward. I see two types of optimization:

  1. Reducing the amount of material used
  2. Reducing the amount of cutting required

The first kind of speaks for itself. I think the keyboard I built in 2018 cost somewhere shy of 100 CAD to cut, and now that we're entering year three of a pandemic I don't know if acrylic is getting any cheaper. The fewer parts we have to cut, the better. The more optimally we pack those parts, the more we can get out of a single sheet of acrylic. There are complications to this: the service I went to charged for a minimum sized sheet that was already more than I needed for... probably two full keyboards. But different services will have different constraints, and some may even let you supply your own material.

The second one kind of builds on the "cut less stuff if you can" idea and throws in curveballs like making edges of different pieces touch wherever possible so that they share cut lines. This one I can't actually do before rendering the SVG or else OpenSCAD would combine them into one larger path.

Another aspect is customization. I pre-rendered the cutting template for a 6x5 dactyl with the 1.5u + 1u outer column because it was easier to get a cheap set of Ergodox keycaps, but I know that's not for everyone. I don't even use a number row these days.

All this to say, some of the optimization will have to happen on the end user's side. I'm not against implementing some that I can, though I'll be relying heavily on third party libraries (I'm looking at SVGnest so far but that solves problem one, not problem 2).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions