# [OpenSCAD] DXF for cut and engrave

Wed Oct 30 17:44:15 EDT 2019

Brilliant idea, except perhaps the other way up. Produce a 3D STL and
process it to 2D plus grayscale by removing all the vertices and edges that
are at 0 and converting the remaining to 2D SVG paths with a colour value
derived from the Z coordinate.

On Wed, 30 Oct 2019 at 13:36, Parkinbot <rudolf at digitaldocument.de> wrote:

> Troberg wrote
> > The problem is that as soon as they have a width, the laser will cut
> > twice.
>
> A somewhat odd but viable solution to "implement" zero-width lines that
> comes into my mind, would be to create and output a 3D model and feed just
> the lines that are on the [x,y,0] plane into the laser cutter. In an STL
> output you would then find and sort/connect all vertices and edges that
> have
> their Z coordinate set to 0 into pathes.
>
> The implementation of the line() primitive would then be, e.g.:
>
>
> a = [1,1, 0];
> b = [0,12, 0];
>
> line(a, b, 0.01, 3);
>
> module line(p, q, width=0.1, height=1)
> {
>   v = q-p;
>   normal = [-v[1], v[0], 0];
>   un = normal/norm(normal)*width/2;
>   n = [un[0], un[1], height];
>   n1 = [-un[0], -un[1], height];
>   points=[p, p+n, p+n1, q, q+n, q+n1];
>   faces=[[0,1,2], [3,5,4], [0, 3, 4, 1], [0, 2, 5, 3],  [2, 1, 4, 5]];
>   polyhedron(points,faces);
> }
>
>
> A multiline() implementation of this is straightforward. Going a step
> further, one could interpret laser intensity via the height parameter.
>
>
>
>
> --