Skip to content

markroland/sand-table-pattern-maker

Repository files navigation

Sand Table Pattern Maker

Sand Table

Launch Pattern Maker

This is part of my Sand Table Build

Built with p5.js

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

License

Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)

This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) License.

This work makes use of p5.js, which carries a GNU Lesser General Public License.

About

A tool for creating G-code commands to draw patterns

Topics

Resources

Stars

Watchers

Forks