@jscad/cli : JSCAD Command Line Interface (CLI)
This is the Command Line Interface (CLI) application for creating designs using Node.js.
Table of Contents
Install the CLI for General Use
The CLI can be installed for general use using NPM.
npm install -g @jscad/cli
Once installed, the CLI can be invoked using
jscad -v jscad
Install the CLI as Part of a Project
If a general installation is not possible or desired, then installation as part of a project is possible.
cd myproject npm install -D @jscad/cli
This will add the CLI package as a development dependency. The CLI can be invoked using
npx jscad -v npx jscad
These two commands will show the version of the CLI, and a general help message.
Using the CLI
Simply invoke 'jscad' using various options. Here are some examples.
jscad mydesign.js # -- convert mydesign.js to mydesign.stl as default
jscad mydesign.js -o test.stl # -- convert mydesign.js to test.stl
jscad frog.stl -o test.js # -- convert frog.stl to test.js
jscad mydesign.js -of amf # -- convert mydesign.js into mydesign.amf
The '-o' option can be used to control where the output will be placed. While, the '-of' option can be used to control the format of the output.
You can also provide the parameters to a design by passing -- to the CLI.
jscad mydesign.js --name "Just Me" --title "Geek" -o output.stl
Also, design projects (directories) can be used as the input to the CLI.
jscad myproject/ -o ./test.stl # -- convert the project mydesign to test.stl
Note: The CLI will search for the design entry point just like NPM.
- if there is a package.json file in the project, then try to load the 'main' property
- if not, then try to load from 'index.js'
Using the CLI with the JSCAD Examples
The easiest way to use the examples is to create a new NPM project.
mkdir newproject cd newproject npm init
Then add both the examples and the CLI to the project.
npm install @jscad/examples npm install @jscad/cli
And finally, make the examples local to the project.
ln -s node_modules/@jscad/examples ./examples
The examples are just single file designs, or multiple file projects.
npx jscad examples/core/booleans/basicBooleans.js -o ./test.stl npx jscad examples/module-design/ -of dxf
The various JSCAD packages and all source code are part of the JSCAD Organization, and maintained by a group of volunteers. We welcome and encourage anyone to pitch in but please take a moment to read the following guidelines.
We only accept bug reports and pull requests on GitHub.
If you have a change or new feature in mind, please start a conversation with the Core Developers and start contributing changes.
Small Note: If editing this README, please conform to the standard-readme specification.
See for more details
Thank you to all our backers! 🙏 [Become a backer]
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]
The MIT License (MIT) (unless specified otherwise)