@mitchallen/maze2openscad
v0.2.3
Published
Code generate a maze as an OpenSCAD include file
Downloads
3
Readme
@mitchallen/maze2openscad
Code generate a maze as an OpenSCAD include file
Generate an include file to be used in OpenSCAD to display a randomly generated maze. The maze can then be exported for 3D printing.
OpenSCAD works on both Windows and Mac.
Installation
You must use npm 2.7.0 or higher because of the scoped package name.
$ npm init
$ npm install @mitchallen/maze2openscad --save
Usage
If you don't have a copy of OpenSCAD you can download it for free from here: http://www.openscad.org
Create a new test folder and change to it
Execute the following at the command line:
$ npm init $ npm install @mitchallen/maze2openscad --save
Browse to: https://github.com/mitchallen/maze2openscad/
Find the file maze.scad in the root of the project and make a local copy of it.
Edit the include path at the top of the file and change it to:
include <maze-data.scad>
Create a file called index.js
Add the following content to index.js and save it:
var mazeFactory = require("@mitchallen/maze2openscad"); var mazeGenerator = mazeFactory.Square({ x: 5, y: 6 }); mazeGenerator.generate(); mazeGenerator.printBoard(); mazeGenerator.writeDataFile('maze-data.scad');
At the command line type:
node index.js
Start OpenSCAD and open maze.scad
You should see a generated maze
Leave OpenSCAD running and run node index.js to see a new maze appear in OpenSCAD
Examples
You can find examples, such as the one above in the the examples folder on the repo.
Customization
You can customize the maze.scad file that you copied from github. Just remember that any customization to the code generated file will be overwritten unless you move it elsewhere.
Testing
To test, go to the root folder and type (sans $):
$ npm test
Repo(s)
Contributing
In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.
Version History
Version 0.2.3
- Circle method takes additional parameters
Version 0.2.2
- added Circle method
- updated examples to use Square
Version 0.2.1
- The create method is deprecated in favor of Square
- Bumped version number because breaking backward compatability
Version 0.1.3
- updated to latest maze generator to allow square, circle, hexagon and triangle
Version 0.1.2
- uses latest maze generator to allow masked mazes
Version 0.1.1
- updated examples to use published module
Version 0.1.0
- initial release