aligator / GoSlice

This is an experimental slicer for 3d printing written in Go also usable as modular slicing lib.
Apache License 2.0
99 stars 16 forks source link
3d 3dprint fdm gcode gcode-generation go golang slicer stl

test

sliced Gopher logo

GoSlice

This is a very experimental slicer for 3d printing. It is currently in a very early stage, but it can already slice models:

Supported features:

sliced Gopher logo

For users

Use CLI

Provides a basic command line interface. Just run with --help and see the description bellow.

Arch Linux / Manjaro: AUR

yay -S goslice

All others:

Download the latest release matching your platform from here:
https://github.com/aligator/GoSlice/releases

Unpack the executable and run it in the commandline.
Linux / Mac:

./goslice /path/to/stl/file.stl

Windows:

goslice.exe /path/to/stl/file.stl

If you need the usage of all possible flags, run it with the --help flag:

./goslice --help

Note that some flags exist as --initial-... also which applies to the first layer only. The non-initial apply to all other layers, but not the first one.

Use WebAssembly CLI + GCode viewer

I created an experimental WebAssembly version. Just go to aligator.dev and type

goslice https://cdn.thingiverse.com/assets/7d/fc/6e/33/fe/3DBenchy.stl

It accepts any stl file as link. After slicing it opens a gcode viewer and provides a download link for the gcode in the terminal.
Note that the webassebly version is much slower than native.

Use Web UI (by tobychui)

tobychui created a web frontend for GoSlice:
SlicerA (also compatible with ArOZ)

For developers

Compile

Just running GoSlice:

go run ./cmd/goslice /path/to/stl/file.stl

To get help for all possible flags take a look at /data/option.go or just run:

go run ./cmd/goslice --help

Distribute

Ideally you should have make installed:

make

The resulting binary will be in the .target folder.

If you do not have make, you can still run the build command manually, but it is not recommended:

go build -ldflags "-X=main.Version=$(git describe --tags) -X=main.Build=$(git rev-parse --short HEAD)" -o .target ./cmd/goslice

How does it work

see here

Use as lib

You want to

-> Then you can do it with GoSlice!

To do this you can copy the goslice/slicer.go/NewGoSlice function and just pass to GoSlice what you want.
You can add new logic by implementing one of the various handler interfaces used by it.
If you need even more control, you can even copy and modify the whole goslice/slicer.go file which allows you to control how the steps are called after each other.
You can find an example here where I used that to make GoSlice runnable as Webassembly.

Handler Interfaces:
Here some brief explanation of the interfaces. For more detailed information just look into the code...
(And take a look at the docs where I explained some aspects a bit deeper.)

Contribution

You are welcome to help.
Just look for open issues and pick one, create new issues or create new pull requests.

For debugging of the GCode I suggest you to use Cura to open the resulting GCode. Cura can open it without any problem and I try to add the markings into the GCode which Cura understands (e.g. mark what is infill, perimeter, etc.).

Credits