Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Instant Slic3r

You're reading from   Instant Slic3r Unravel the mysteries behind taking a virtual model and turning it into a physical object

Arrow left icon
Product type Paperback
Published in Sep 2013
Publisher Packt
ISBN-13 9781783284979
Length 68 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Author (1):
Arrow left icon
David Moore David Moore
Author Profile Icon David Moore
David Moore
Arrow right icon
View More author details
Toc

Running Slic3r from the command line (Become an expert)


Some of us like our GUIs, but some of us yearn for the control and options that only the command line can give. The creators of Slic3r are our kind of people. They've built in command line usage into Slic3r from the early stages of the project.

So far we have created prints from the graphical interface. Slic3r can also be controlled and tweaked from the command line, which gives the user more power and control over the printing process.

Getting ready

So now that we know about the command line, how do we get to it?

  • Windows:

    1. Open a command window and navigate to the directory where we uncompressed Slic3r.

    2. At the command prompt type slic3r-console.exe.

  • Mac:

    1. Open a terminal window and navigate to the directory where Slic3r is installed.

    2. At the prompt type slic3r.pl -help.

  • Linux:

    1. Open a terminal window and navigate to the directory where Slic3r is installed.

    2. At the prompt type slic3r.pl -help.

We'll now see the list of Slic3r commands that are available to us. If you'd like to look at the list, they are listed in the How it works... section of this recipe.

Note

One caveat for these instructions: As of the time of this writing, the Windows version of slic3r-console has a bug in it. We can substitute slic3r.exe to slice from the command line, but it will not have any console output.

How to do it...

Because Slic3r command line options are normally built in one line, we'll be splitting out the options into separate steps. At the end, we'll put it all together to run.

Note

The Windows command is different from the Mac and Linux version. We'll be demonstrating the Linux and Mac command, just substitute slicer-console in for slicer.pl.

  1. Load in our current configuration using the following command:

    slicer.pl --load <config filename>
    
  2. Add in our options. In this case, changing the size of our object to twice the size:

    --scale 2
    
  3. Finally, we give Slic3r the name of our model:

    <modelFilename.stl>
    

Slic3r will take the file, scale it up 200 percent as it slices it, and then output our file to modelFilename.gcode.

Note

This method could be used to automate our printing process, batch slice a variety of files, and even process one file for a multitude of printer configurations.

How it works...

So now that we've looked at some things we can do with the command-line options, the ideas for what else we can do are starting to come to mind. The command-line options can be called from the programs we write, or set up to run later using the scheduling in Windows or cron on Linux and Mac. We can also set up web pages or mobile apps to call Slic3r.

The following is a list of what we see when we list out the help for Slic3r. There are wealth of options available to us. Look through it, and ideas for how to use Slic3r from the command line will continue to flow:

Slic3r 0.9.10b is a STL-to-GCODE translator for RepRap 3D printers written by Alessandro Ranellucci <aar@cpan.org> - http://slic3r.org/
Usage: slic3r.pl [ OPTIONS ] file.stl

This first section of the help is the general options, allowing us to check the version, to load and save configuration files, and even specify the number of processor threads that Slic3r can use. The following table lists them out:

--help

Outputs this usage screen and exits

--version

Outputs the version of Slic3r and exits

--save <file>

Saves the configuration to the specified file

--load <file>

Load the configuration from the specified file. It can be used more than once to load options from multiple files.

-o, --output <file>

File to output G-code to (by default, the file will be saved into the same directory as the input file using the --output-filename- format to generate the filename)

-j, --threads <num>

Number of threads to use (1+, default: 2)

The output options are exactly what it says, the different settings we can use for output. This includes post processing, svg export, and merging multiple files into a single print.

Output option:

--output-filename-format

The output filename format; all config options enclosed in brackets will be replaced by their values, as well as [input_filename_base] and [input_filename] (default: [input_filename_base].gcode)

--post-process

Generated G-code will be processed with the supplied script; call this more than once to process through multiple scripts.

--export-svg

Export a SVG file containing slices instead of G-code.

-m, --merge

If multiple files are supplied, they will be composed into a single print rather than processed individually.

Here is where we can tell Slic3r about our printer: the physical sizes, and what type of G-code that Slic3r should expect.

Printer options

--nozzle-diameter

Diameter of nozzle in mm (default: 0.5)

--print-center

Coordinates in mm of the point to center the print around (default: 100,100)

--z-offset

Additional height in mm to add to vertical coordinates (+/-, default: 0)

--gcode-flavor

The type of G-code to generate (reprap/teacup/makerbot/sailfish/mach3/no-extrusion, default: recprap)

--use-relative-e-distances

Enable this to get relative E values

--gcode-arcs

Use G2/G3 commands for native arcs (experimental, not supported by all firmware)

--g0

Use G0 commands for retraction (experimental, not supported by all firmware)

--gcode-comments

Make G-code verbose by adding comments (default: no)

--vibration-limit

Limit the frequency of moves on X and Y axes (Hz, set zero to disable; default: 0)

Filament options gives us finer control over how Slic3r will handle our plastic that we are printing with. We can change the first layer's temperature compared to the later layers, what the bed temperature should be, and what diameter filament we are using.

Filament option

--filament-diameter

Diameter in mm of your raw filament (default: 3)

--extrusion-multiplier

Change this to alter the amount of plastic extruded. There should be very little need to change this value, which is only useful to compensate for filament packing (default: 1)

--temperature

Extrusion temperature in degree Celsius; set 0 to disable (default: 200)

--first-layer-temperature

Extrusion temperature for the first layer in degree Celsius; set 0 to disable (default: same as --temperature)

--bed-temperature

Heated bed temperature in degree Celsius; set 0 to disable (default: 0)

--first-layer-bed-temperature

Heated bed temperature for the first layer, in degree Celsius, set 0 to disable (default: same as --bed-temperature)

Speed options is where we can make our prints run faster, but if we aren't careful we will sacrifice quality. Some areas, such as gap filling, we may want to run faster, so there is less chance of sagging.

Speed options

--travel-speed

Speed of non-print moves in mm/s (default: 130)

--perimeter-speed

Speed of print moves for perimeters in mm/s (default: 30)

--small-perimeter-speed

Speed of print moves for small perimeters in mm/s or % over perimeter speed (default: 30)

--external-perimeter-speed

Speed of print moves for the external perimeter in mm/s or % over perimeter speed (default: 70)

--infill-speed

Speed of print moves in mm/s (default: 60)

--solid-infill-speed

Speed of print moves for solid surfaces in mm/s or % over infill speed (default: 60)

--top-solid-infill-speed

Speed of print moves for top surfaces in mm/s or % over solid infill speed (default: 50)

--support-material-speed

Speed of support material print moves in mm/s (default: 60)

--bridge-speed

Speed of bridge print moves in mm/s (default: 60)

--gap-fill-speed

Speed of gap fill print moves in mm/s (default: 20)

--first-layer-speed

Speed of print moves for bottom layer, expressed either as an absolute value or as a percentage over normal speeds (default: 30%)

Depending on the physical stability of our printer, adding in acceleration with these options can help speed up and improve the quality of our print.

Acceleration options

--perimeter-acceleration

Overrides firmware's default acceleration for perimeters. (mm/s^2, set zero to disable; default: 0)

--infill-acceleration

Overrides firmware's default acceleration for infill. (mm/s^2, set zero to disable; default: 0)

--default-acceleration

Acceleration will be reset to this value after the specific settings have been applied. (mm/s^2, set zero to disable; default: 130)

Accuracy options is a little misleading. While adjusting layer height does usually yield smoother prints, adding in infill can also make the print sturdier.

Accuracy options

--layer-height

Layer height in mm (default: 0.4)

--first-layer-height

Layer height for first layer (mm or %, default: 0.35)

--infill-every-layers

Infill every N layers (default: 1)

--solid-infill-every-layers

Force a solid layer every N layers (default: 0)

Print options is also confusing at first, because it sounds like a catch-all category. These are the actual settings for the object to be printed: if it should have a solid top or bottom, how dense the fill material will be, and also allow us to use custom G-code for the start and end of the print.

Print options

--perimeters

Number of perimeters/horizontal skins (range: 0+, default: 3)

--top-solid-layers

Number of solid layers to be done for top surfaces (range: 0+, default: 3)

--bottom-solid-layers

Number of solid layers to be done for bottom surfaces (range: 0+, default: 3)

--solid-layers

Shortcut for setting the preceding two options at once

--fill-density

Infill density (range: 0-1, default: 0.4)

--fill-angle

Infill angle in degrees (range: 0-90, default: 45)

--fill-pattern

Pattern to use to fill non-solid layers (default: honeycomb)

--solid-fill-pattern

Pattern to use to fill solid layers (default: rectilinear)

--start-gcode

Load the initial G-code from the supplied file. This will overwrite the default command (home all axes [G28]).

--end-gcode

Load the final G-code from the supplied file. This will overwrite the default commands (turn off temperature [M104 S0], home X axis [G28 X], disable motors [M84]).

--layer-gcode

Load layer-change G-code from the supplied file (default: nothing).

--toolchange-gcode

Load tool-change G-code from the supplied file (default: nothing).

--extra-perimeters

Add more perimeters when needed (default: yes)

--randomize-start

Randomize the starting point across layers (default: yes)

--only-retract-when-crossing-perimeters

Disable retraction when travelling between infill paths inside the same island (default: no)

--solid-infill-below-area

Force solid infill when a region has a smaller area than the current threshold (mm^2, default: 70)

When we use support material, the following are the settings we would want to adjust. These tell Slic3r to use a support material or not, and where.

Support material options

--support-material

Generate support material for overhangs

--support-material-threshold

Overhang threshold angle (range: 0-90, set 0 for automatic detection, default: 0)

--support-material-pattern

Pattern to use for support material (default: rectilinear)

--support-material-spacing

Spacing between pattern lines (mm, default: 2.5)

--support-material-angle

Support material angle in degrees (range: 0-90, default: 0)

Since the extruder is making the plastic filament more liquid, we will sometimes need the extruder to run backward, pulling the plastic back in so we don't get blobbing and dripping.

Retraction option

--retract-length

Length of retraction in mm when pausing extrusion (default: 1)

--retract-speed

Speed for retraction in mm/s (default: 30)

--retract-restart-extra

Additional amount of filament in mm to push after compensating retraction (default: 0)

--retract-before-travel

Only retract-before-travel moves of this length in mm (default: 2)

--retract-lift

Lift Z by the given distance in mm when retracting (default: 0)

If we are using multiple extruders, we definitely want to retract the plastic of the extruder that just finished so that it doesn't drip or dribble over the new plastic from the other extruder.

Retraction options for multi-extruder setups

--retract-length-toolchange

Length of retraction in mm when disabling tool (default: 1)

--retract-restart-extra-toolchange

Additional amount of filament in mm to push after switching tool (default: 0)

Having the print sag, pop off the build platform and having gaps between layers can all be related to improper cooling. Slic3r gives us good controls over the cooling of the print with the following settings:

Cooling options

--cooling

Enable fan and cooling control

--min-fan-speed

Minimum fan speed (default: 35%)

--max-fan-speed

Maximum fan speed (default: 100%)

--bridge-fan-speed

Fan speed to use when bridging (default: 100%)

--fan-below-layer-time

Enable fan if layer print time is below this approximate number of seconds (default: 60)

--slowdown-below-layer-time

Slow down if layer print time is below this approximate number of seconds (default: 30)

--min-print-speed

Minimum print speed (mm/s, default: 10)

--disable-fan-first-layers

Disable fan for the first N layers (default: 1)

--fan-always-on

Keep fan always on at min fan speed, even for layers that don't need cooling

If we need to pre-extrude some plastic before printing the object, or have Slic3r add a brim to help the model stick to the platform, the following are the settings we will use.

Skirt options

--skirts

Number of skirts to draw (0+, default: 1)

--skirt-distance

Distance in mm between the innermost skirt and the object (default: 6)

--skirt-height

Height of skirts to draw (expressed in layers, 0+, default: 1)

--min-skirt-length

Generate no less than the number of loops required to consume this length of filament on the first layer, for each extruder (mm, 0+, default: 0)

--brim-width

Width of the brim that will get added to each object to help adhesion (mm, default: 0)

We can change the size and position of the object we want to print, without going back to edit the model. Using the two duplicate settings, we can even print several copies of the same object at the same time.

Transform options

--scale

Factor for scaling input object (default: 1)

--rotate

Rotation angle in degrees (0-360, default: 0)

--duplicate

Number of items with auto-arrange (1+, default: 1)

--bed-size

Bed size, only used for auto-arrange (mm, default: 200,200)

--duplicate-grid

Number of items with grid arrangement (default: 1,1)

--duplicate-distance

Distance in mm between copies (default: 6)

Sometimes we want to finish a whole object in a print file before moving on to the next one in the file. We need to be careful about where the extruder head goes so that it doesn't hit any of the objects. Also, having one of the parts done while the others print can sometimes be just what we need.

Sequential printing options

--complete-objects

When printing multiple objects and/or copies, complete each one before starting the next one; watch out for extruder collisions (default: no)

--extruder-clearance-radius

Radius in mm above which the extruder won't collide with anything (default: 20)

--extruder-clearance-height

Maximum vertical extruder depth; that is, the vertical distance from the extruder tip and carriage bottom (default: 20)

If we want to add in some comments to the output file, such as the date it was printed, what printer settings were used, even notes to ourselves on why we used the settings we did, we can put those in using the following option:

Miscellaneous options

--notes

Notes to be added as comments to the output file

The following are fairly advanced options, dealing with how wide the Slic3r will make the extrusion layer, if it should have a different first layer, and even have a different width between the perimeter and infill:

Flow options (advanced)

--extrusion-width

Set the extrusion width manually; it accepts either an absolute value in mm (such as 0.65) or a percentage over layer height (such as 200%)

--first-layer-extrusion-width

Set a different extrusion width for the first layer

--perimeter-extrusion-width

Set a different extrusion width for perimeters

--infill-extrusion-width

Set a different extrusion width for infill

--support-material-extrusion-width

Set a different extrusion width for support material

--bridge-flow-ratio

Multiplier for extrusion when bridging (> 0, default: 1)

Previously, we had some multi-extruder options with the retraction settings. These settings round out the other settings that we need to use with more than one extruder.

Multiple extruder options

--extruder-offset

Offset of each extruder, if firmware doesn't handle the displacement (can be specified multiple times, default: 0x0)

--perimeter-extruder

Extruder to use for perimeters (1+, default: 1)

--infill-extruder

Extruder to use for infill (1+, default: 1)

--support-material-extruder

Extruder to use for support material (1+, default: 1)

There's more...

There are many things that we can do with access to the command line. Every system that it runs on is capable of running a timed process, or a batch process.

So let's think about a few things we could do by using the command line. We could make a process that accepts models from the Web and automatically slices them and start a print remotely. We could even set up a webcam to watch the print in progress.

Taking that one step further, we could have other people upload their models. A Slic3r script could then calculate the amount of plastic needed and charge them for the print. They could watch the print on the webcam and see the results even before we put it in the mail to deliver.

That's just one idea of what we could do with access to the command line. Just like having your own 3D printer at your disposal, the sky is the limit for what we can do with Slic3r.

You have been reading a chapter from
Instant Slic3r
Published in: Sep 2013
Publisher: Packt
ISBN-13: 9781783284979
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image