DEV Community

Cover image for Maker.js for CNC and Laser Cutters
Bitontree
Bitontree

Posted on

Maker.js for CNC and Laser Cutters

Summary

By using Maker.js you can draw using geometry and drafting. Initially designated for CNC and laser cutters, Maker.js can also help you programmatically draw shapes for any purpose. It runs on both Node.js and web browsers.

Core Features of Maker.js

Paths — The primitive elements of a drawing are lines, arcs, and circles.

Models — Groups of paths to compose a shape.

Layers — Organization of models, such as by color or tool type.

Chains — A series of lines and arcs that connect end-to-end continuously.

In Node.js or React you can install Maker.js by using this code.

Image description

In Paths, you can draw a line, circle, or arc by using these codes which require us to pass some default parameters. For example, when drawing a line, there's a start-point and end-point; for drawing a circle, there must be a radius or a diameter and an origin of the circle. Similarly, while drawing an arc, there is a start-point and end-point of an arc, radius. The arc is clockwise and the large arc is anti-clockwise.

Let's see the code for that.

For drawing a line,

Image description

For drawing a circle,

Image description

For drawing an arc,

Image description

For more reference:https://maker.js.org/docs/basic-drawing/#content

We can also draw a dashed circle by using this code…

Read more of this blog here…

Top comments (0)