[OpenSCAD] DXF for cut and engrave

Doug Moen doug at moens.org
Sat Oct 26 17:14:28 EDT 2019

@Parkinbot wrote:
> It can't be done within the 2D subsystem, as zero area objects are
> extinguished. Therefore it needs adding a 1D subsystem with new primitives
> like line() and polyline() and only the union() operator allowed collecting
> them into a list. 1D objects should be allowed to coexist with 2D objects
> within the xy-plane. Export into SVG or DXF is straight forward. 

I want to mention an alternative approach that is slightly more general.

In Curv, I can represent zero area objects in the 2D system. They aren't treated specially, there is no "1D subsystem". Objects like this are only extinguished during file export. I can make a circular path (the outline of a circle, rather than a solid circle) using
    shell (0) circle(10)
Normally you would pass a positive value to `shell`, but this also happens to work.

Suppose you union a solid circle with some line segments embedded within the circle, to model some engraved lines on a circular lasercut object. That won't work, the line segments are absorbed into the circle by the union operation. That's the mathematically expected outcome. To make this work, you need the line segments to exist in a different layer from the circle.

Even though unioning engraved lines with a solid figure produces unhelpful results, differencing is still useful. For example, you could generate a lattice of line segments, then subtract a circular disc from the middle of the lattice to produce an artistic effect. This is an example of a set operation between lines and solid figures that produces a useful result, which might not be possible with the "1D subsystem" approach.

The lasercutter software I've used makes a distinction between engraving along a path, vs filling in a closed figure while engraving. To preview that visually in OpenSCAD, you would need to support solid 2D figures within the engraving layer.

Therefore, my suggestion is that for laser cutting, it would be useful to have a cutting layer and an engraving layer. Within the engraving layer, it is meaningful to have both zero-area paths, and solid (filled in) figures. An operation for converting a solid 2D figure to a path is useful.

A few years ago I proposed a general syntax for named layers in OpenSCAD. The `part("layername")` module is used to specify which layer a shape belongs to. Lasercutting might be a use case for this proposal. https://github.com/openscad/openscad/issues/1608

Doug Moen.

More information about the Discuss mailing list