https://github.com/markroland/sand-table-pattern-maker
A tool for creating G-code commands to draw patterns
https://github.com/markroland/sand-table-pattern-maker
drawing-machine gcode sand-table sisyphus-tables
Last synced: 4 months ago
JSON representation
A tool for creating G-code commands to draw patterns
- Host: GitHub
- URL: https://github.com/markroland/sand-table-pattern-maker
- Owner: markroland
- Created: 2019-03-22T16:31:46.000Z (almost 7 years ago)
- Default Branch: main
- Last Pushed: 2025-09-16T21:21:04.000Z (4 months ago)
- Last Synced: 2025-09-16T23:55:27.102Z (4 months ago)
- Topics: drawing-machine, gcode, sand-table, sisyphus-tables
- Language: JavaScript
- Homepage: https://markroland.github.io/sand-table-pattern-maker/
- Size: 839 KB
- Stars: 38
- Watchers: 5
- Forks: 10
- Open Issues: 4
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Sand Table Pattern Maker

[Launch Pattern Maker](https://markroland.github.io/sand-table-pattern-maker/)
This is part of my [Sand Table Build](https://markroland.com/portfolio/sand-table)
Built with [p5.js](https://p5js.org)
## Installation
```
npm install
npm run dev
```
## Run using NPM
```
node sand-pattern.mjs --pattern=circle > circle.json
```
Or using the `bin` command:
```
sand-pattern --pattern=circle > circle.json
```
## Controls
- Press "o" to toggle an overlay of the pattern settings in the canvas
- Press "c" to toggle the live coordinates and plotter mechanism view
- Press "d" to download a heightmap PNG of the pattern.
- Press "p" to play/pause playback of pattern.
## How to Build a New Pattern
```
node ./scripts/create-new.js NewPatternName
```
Pattern classes are made up of at least 4 methods:
- **constructor** - The class constructor defines a few aspect of the class including:
- `this.key` - Used for identifying the class's properties in the main sketch file
- `this.name` - Used for referencing the pattern in the UI.
- `this.config` - This is an object that defines the pattern's input configuration options.
- `this.path` - Initializes the pattern's output path coordinates
- **draw** - This class is called by the main sketch to draw the pattern. It reads and
updates the UI input values and sends the input to the class's `calc` method.
- **calc** - This is where the algorithm for the pattern is implemented. Using the selected
inputs, the method returns the coordinates for the complete path.
Once you've completed your design, submit a Pull Request and if it works, I'll merge it in. Thanks in advance!
## Optimize a THR track
When creating tracks, it may be that there are far too many points than necessary - the sand table
may not be able to render the track with the precision specified. Since each instruction is processed
this may lead to an unnecessarily slow drawing time. In order to prevent this I have created a THR
optimization script that uses the drawing devices table and ball size to simplify the path to avoid
unnecessary drawing steps.
```
node ./scripts/optimize-thr.mjs {path_to_thr_file}
```
## Patterns
- XY Coordinates
- Circle
- Cross
- Cycloid ([Epicycloid](https://en.wikipedia.org/wiki/Epicycloid), [Hypocycloid](https://en.wikipedia.org/wiki/Hypocycloid), [Hypotrochoid](https://en.wikipedia.org/wiki/Hypotrochoid))
- Curvature
- Diameters
- Free Draw
- Easter Eggs ([Reference](https://math.stackexchange.com/questions/3375853/parametric-equations-for-a-true-egg-shape))
- Farris Curve ([Reference](http://www.sineofthetimes.org/the-art-of-parametric-equations-2/))
- Fermat's Spiral ([Reference](https://en.wikipedia.org/wiki/Fermat%27s_spiral))
- Fibonacci
- Fibonacci Lollipops
- Frames (Border Patterns)
- G-Code
- Gravity
- Heart ([Reference](http://mathworld.wolfram.com/HeartCurve.html))
- Space Filling Curves \[[1](https://p5js.org/examples/simulate-l-systems.html)\] \[[2](https://en.wikipedia.org/wiki/Space-filling_curve)\] \[[3](https://fedimser.github.io/l-systems.html)\]
- Lissajous Curve ([Lissajous Curves](https://en.wikipedia.org/wiki/Lissajous_curve))
- Parametric ([Butterfly Curve](https://en.wikipedia.org/wiki/Butterfly_curve_(transcendental)))
- Rectangle
- Rhodonea (Rose) Curve ([Rose Curve](https://en.wikipedia.org/wiki/Rose_(mathematics)))
- Shape Morph
- Shape Spin
- Spiral
- Spiral (Logarithmic) ([Reference](https://en.wikipedia.org/wiki/Logarithmic_spiral))
- Spokes
- Star
- Superellipse \[[1](https://en.wikipedia.org/wiki/Superellipse)\] \[[2](https://mathworld.wolfram.com/Superellipse.html)\] \[[3](https://thecodingtrain.com/CodingChallenges/019-superellipse.html)\]
- Text
- Theta Rho Coordinates
- Wiggly Spiral
- Zig Zag
## License
[](https://creativecommons.org/licenses/by-nc-sa/4.0/)
This work is licensed under a [Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](https://creativecommons.org/licenses/by-nc-sa/4.0/) License.
This work makes use of [p5.js](https://p5js.org), which carries a [GNU Lesser General Public License](https://p5js.org/copyright.html).