https://github.com/jgphilpott/polyslice
An FDM slicer designed specifically for three.js
https://github.com/jgphilpott/polyslice
fdm fdm-3d-printing gcode gcode-generation slice slicer slicing
Last synced: 4 days ago
JSON representation
An FDM slicer designed specifically for three.js
- Host: GitHub
- URL: https://github.com/jgphilpott/polyslice
- Owner: jgphilpott
- License: mit
- Created: 2022-09-29T15:52:35.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-24T07:31:49.000Z (over 1 year ago)
- Last Synced: 2024-10-25T03:33:04.057Z (over 1 year ago)
- Topics: fdm, fdm-3d-printing, gcode, gcode-generation, slice, slicer, slicing
- Language: JavaScript
- Homepage: https://jgphilpott.github.io/polyslice/serial/browser/sender.html
- Size: 455 KB
- Stars: 18
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Polyslice
An AI powered [slicer](https://en.wikipedia.org/wiki/Slicer_(3D_printing)) designed specifically for the [three.js](https://github.com/mrdoob/three.js) ecosystem and inspired by the discussion on [this issue](https://github.com/mrdoob/three.js/issues/17981). The idea is to be able to go straight from a three.js mesh to a machine usable [G-code](https://en.wikipedia.org/wiki/G-code), thus eliminating the need for intermediary file formats and 3rd party slicing software.
[Polyslice](https://jgphilpott.github.io/polyslice) is designed to streamline and automate the 3D printing workflow. Whether you're designing models in three.js or loading existing STL, OBJ, or other 3D files, Polyslice can process them and generate machine ready G-code. With built-in support for popular printers/filaments and the ability to send G-code directly to your 3D printer via [Web Serial API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Serial_API) or [serialport](https://www.npmjs.com/package/serialport), the entire design-to-print workflow becomes seamless and programmable. It can work in both a web browser or Node.js environment, this makes 3D printing more accessible and eliminates the friction of using multiple tools.
Click the image below to watch the demo video on YouTube:
## Installation
### Node
```bash
npm install @jgphilpott/polyslice
```
### Browser
```html
```
## Quick Start
Here is a simple example to get you started:
```javascript
// Require THREE, Polyslice, Printer and Filament (omit for browser)
const THREE = require("three");
const { Polyslice, Printer, Filament } = require("@jgphilpott/polyslice");
// Create the printer and filament objects
const printer = new Printer("Ender3");
const filament = new Filament("GenericPLA");
// Create the slicer instance with the printer, filament and other configs
const slicer = new Polyslice({
printer: printer,
filament: filament,
infillPattern: "triangles",
infillDensity: 30,
testStrip: true,
verbose: true
});
// Create a 1cm cube (10mm x 10mm x 10mm)
const geometry = new THREE.BoxGeometry(10, 10, 10);
const material = new THREE.MeshBasicMaterial({ color: 0x00ff00 });
const cube = new THREE.Mesh(geometry, material);
// Slice the cube and generate the G-code
const gcode = slicer.slice(cube);
```
**To run this example locally follow these steps:**
1) Clone the Polyslice repo: `git clone git@github.com:jgphilpott/polyslice.git`
2) Navigate into the repo directory: `cd polyslice`
3) Install the node modules: `npm install`
4) Compile the code: `npm run compile`
5) Run the example script: `node examples/scripts/quick-start.js`
## Features
Polyslice provides a comprehensive set of features for the 3D printing workflow:
| Feature | Description | Documentation |
|---------|-------------|---------------|
| ๐ **Direct three.js integration** | Work directly with three.js meshes and scenes | [Examples](docs/examples/EXAMPLES.md) |
| ๐ **File format support** | STL, OBJ, 3MF, AMF, PLY, GLTF/GLB, Collada | [Loaders](docs/loaders/LOADERS.md) |
| ๐ **G-code generation** | Full set of G-code commands with configurable precision | [G-code](docs/slicer/gcode/GCODE.md) |
| โ๏ธ **Printer profiles** | 44 pre-configured printer profiles | [Printer Config](docs/config/PRINTER.md) |
| ๐งต **Filament profiles** | 35 pre-configured filament profiles | [Filament Config](docs/config/FILAMENT.md) |
| ๐ฒ **Infill patterns** | Grid, triangles and hexagons patterns (more coming) | [Infill](docs/slicer/infill/INFILL.md) |
| ๐งฑ **Wall generation** | Configurable wall thickness | [Walls](docs/slicer/walls/WALLS.md) |
| ๐จ **Skin layers** | Top/bottom solid layers with exposure detection | [Skin](docs/slicer/skin/SKIN.md) |
| ๐๏ธ **Support structures** | Automatic support generation | [Support](docs/slicer/support/SUPPORT.md) |
| ๐ **Build plate adhesion** | Skirt, brim, and raft support for first-layer stability | [Adhesion](docs/slicer/adhesion/ADHESION.md) |
| ๐ **Serial streaming** | Send G-code directly to printers | [Exporters](docs/exporters/EXPORTERS.md) |
| ๐ **Precision control** | Optimize file size with configurable precision (20-30% reduction) | [G-code](docs/slicer/gcode/GCODE.md) |
| ๐ **Universal** | Works in Node.js and browsers | [API](docs/api/API.md) |
## Documentation
For detailed documentation, see the [docs folder](docs/README.md):
- [API Reference](docs/api/API.md) - Complete API documentation
- [Examples](docs/examples/EXAMPLES.md) - Practical usage examples
- [Development Guide](docs/development/DEVELOPMENT.md) - Contributing and development
- [Tools](docs/tools/TOOLS.md) - G-code visualizer and sender
## Contributing
Contributions are welcome! Please feel free to [Open an Issue](https://github.com/jgphilpott/polyslice/issues) or submit a [Pull Request](https://github.com/jgphilpott/polyslice/pulls).
## License
MIT **ยฉ** [Jacob Philpott](https://github.com/jgphilpott)