Tag Archives: Print3r


Print3r or print3r (pronounced print-three-r) is a command line tool (CLI) which supports:

  • multiple different slicers (Cura, Slic3r, PrusaSlicer) with same unified settings
  • multiple 3D formats more than what each slicer supports:
    • STL, OBJ, OFF, AMF, 3MF, 3MJ and also
    • OpenSCAD (.scad), OpenJSCAD (.jscad), ScriptCAD (.sccad)
  • networked/cloud printing built-in with multiple 3D-printers


% print3r [<options>] <command> <file1> ...


  • print: print the part (and perform necessary conversions to achieve print)
  • slice: just slice the part to gcode with slic3r, slic3r-pe, cura, cura-legacy or prusa
  • preview: preview print as gcode
  • render: render image of print
  • gcode: send Gcode from command-line
  • gconsole: start Gcode console to interactively send commands
  • client: enable remote printing (start client mode)

Print (Convert & Slice & Print)

% print3r print cube.scad
% print3r print cube.stl
% print3r print cube.gcode
% print3r --scad print "cube(20)"

Slice (Without Printing)

Just slice the part to Gcode:

% print3r --output=cube.gcode slice cube.scad
% print3r --output=cube.gcode slice cube.stl

Preview (Without Printing)

Preview the resulting Gcode:

% print3r preview cube.scad
% print3r preview cube.stl
% print3r preview cube.gcode
% print3r --scad preview "cube(20)"


Render the Gcode into an image:

% print3r --output=test.png render cube.scad
% print3r --output=test.png --scad render "cube(20)"
% print3r --output=test.png render cube.stl
% print3r --output=test.png render cube.gcode

Cloud Printing (Server/Client)

Create a printhub by starting print3r in client-mode:

% print3r --device=/dev/ttyUSB0 client &
% print3r --device=/dev/ttyUSB1 client &

On the another host you can address the printhub(s):

% print3r --device=tcp: print benchy.stl
% print3r --device=tcp: print calibrationCube.stl

Usage Overview

Print3r (print3r) 0.2.0 USAGE: [<options>] <cmd> <file1> [<...>]

      --verbose or -v or -vv  increase verbosity
      --quiet or -q           no output except fatal errors
      --baudrate=<n>          set baudrate, default: 115200
      --device=<d>            set device, default: /dev/ttyUSB0
      --slicer=<slicer>       set slicer, default: slic3r
                                 slic3r, slic3r-pe, cura-legacy, cura, prusa
      --printer=<name>        config of printer, default: default
      --version               display version and exit
      --output=<file>         define output file for 'slice' and 'render' command
      --scad                  consider all arguments as actual OpenSCAD code (not files)
      --scadlib=<files>       define OpenSCAD files separated by "," or ":"
      part preprocessing:
         --random-placement   place print randomly on the bed
         --auto-center        place print in the center
         --multiply-part=<n>  multiply part(s)
         --scale=<x>,<y>,<z>     scale part x,y,z (absolute if 'mm' is appended)
         --scale=<f>             scale part f,f,f
         --rotate=<x>,<y>,<z>    rotate x,y,z
         --translate=<x>,<y>,<z> translate x,y,z
         --mirror=<x>,<y>,<z>    mirror x,y,z (0=keep, 1=mirror)
      --<key>=<value>         include any valid slicer option (e.g. slic3r --help)

      print <file> [...]      print (convert & slice & print) part(s) (.scad, .stl, .obj, .gcode)
      slice <file> [...]      slice file(s) to gcode (.scad, .stl, .amf, .obj, .3mf)
      preview <file> [...]    slice & preview (.scad, .stl, .obj, .gcode)
      render <file> [...]     render an image (use '--output=sample.png' or so)
      gcode <code1> [...]     send gcode lines
      gconsole                start gcode console
      client                  map USB connected printer to network (per device)

      export PRINT3R "printer=my_printer" --OR-- setenv PRINT3R "printer=my_printer"
      print3r slice cube.stl
      print3r --layer-height=0.2 --output=test.gcode slice cube.stl
      print3r --printer=ender3 --device=/dev/ttyUSB1 print test.gcode
      print3r --printer=corexy --device=/dev/ttyUSB2 --layer-height=0.3 --fill-density=0 print cube.stl
      print3r --printer=ender3 --device=tcp: --layer-height=0.25 print cube.stl
      print3r print cube.scad
      print3r --scad print "cube(20)"
      print3r gcode 'G28 X Y' 'G1 X60' 'G28 Z'
      print3r gconsole
      == Print3r: Gcode Console (gconsole) - use CTRL-C or 'exit' or 'quit' to exit
         for valid Gcode see https://reprap.org/wiki/G-code
         conf: device /dev/ttyUSB0, connected
      > M115


Following slicers are supported via --slicer=<slicer>:

  • slic3r: Slic3r
  • slic3r-pe: Slic3r Prusa Edition
  • cura-legacy: CuraEngine 15.04 with old profiles
  • cura: CuraEngine 3.x or later
  • prusa: PrusaSlicer

/usr/share/print3r/slicer/<slicer>/base.ini contains the base settings for a particular slicer.


print command converts, slices and sends the resulting Gcode to the USB port of your choice.

% print3r print cube.scad
% print3r --scad print 'cube(20)'
% print3r print cube.stl pyramid.obj
% print3r print cube.gcode

Part Preprocessing

All part-preprocessing operations can be used in combination of printslicepreview and render command:


  • --random-placement place print randomly on the bed to evenly use the entire bed
  • --auto-center place print in the center (default)
% print3r print cube.scad
% print3r --auto-center print cube.scad
% print3r --random-placement print cube.stl

Multiply Part

--multiply-part=<n> multiply part(s)

% print3r --multiply-part=2 print cube.stl
% print3r --multiply-part=2 print cube.stl dodecahedron.stl
% print3r --multiply-part=2 preview cube.scad pyramid.stl

each part is multiplied, --multiply-part=1 is redundant.


  • --scale=<x>,<y>,<z> scale part x,y,z (absolute if ‘mm’ is appended)
  • --scale=<f> scale part f,f,f

whereas each value can be:

  • <float> = multiplier, special case 0 = scale proportionally
  • <float>% = multiplier in percent
  • <float>mm = force to x mm absolute length and scale all axis set to 0 proportionally
% print3r --scale=2 preview cube.scad
% print3r --scale=200% print cube.stl
% print3r --scale=2,1,0.5 print cube.stl
% print3r --scale=20mm,0,0 print box.stl
% print3r --scale=20mm,2,1 print box.stl
% print3r --scale=300mm,30%,1 print box.stl


--rotate=<x>,<y>,<z> rotate x,y,z where is each angle 0 .. 360 deg

% print3r --rotate=90,0,0 preview toy.scad
% print3r --rotate=90,0,0 print toy.stl


--translate=<x>,<y>,<z> translate x,y,z whereas each value in [mm], disables --auto-center and --random-placement.

% print3r --translate=-40,20,0 print cube.stl


--mirror=<x>,<y>,<z> mirror x,y,z (0=keep, 1=mirror), the same can be achieved with --scale= by using -1 (mirror) and 1 (keep):

% print3r --mirror=1,0,0 print toy.stl
% print3r --mirror=0,1,0 print mount.stl
% print3r --scale=1,-1,1 print mount.stl 


slice command converts and slices the model to Gcode file, best set --output=file.gcode to define the filename.

% print3r slice cube.scad
% print3r slice cube.stl
% print3r --output=cube.gcode cube.scad
% print3r --slicer=cura --output=cube.gcode cube.scad
% print3r --slicer=slic3r-pe --output=cube2.gcode cube.scad


preview command converts, slices and display the resulting Gcode with yagv Gcode viewer.

% print3r preview cube.scad
% print3r --slicer=cura preview cube.scad
% print3r --slicer=cura --printer=prusa-i3 preview cube.scad
% print3r --slicer=slic3r-pe --printer=ashtar-k-1 preview cube.stl pyramid.stl


render command converts, slices and renders the resulting Gcode into a PNG image, best set --output=test.png to define the filename.

% print3r render cube.scad
% print3r --slicer=cura render 3DBenchy.stl
% print3r --slicer=cura --printer=prusa-i3 render cube.scad
% print3r --slicer=slic3r-pe --printer=ashtar-k-1 --output=set.png render cube.stl pyramid.stl


gcode command allows to send Gcode in the command line directly:

% print3r gcode 'G28 X Y'
% print3r gcode 'G28 Z'

Gcode Console (gconsole)

gconsole command launches an interactive console to send Gcode and custom commands to USB connected printer:

== Print3r: Gcode Console (gconsole) - use CTRL-C or 'exit' or 'quit' to exit
   for valid Gcode see https://reprap.org/wiki/G-code
conf: device /dev/ttyUSB0, connected


  • any valid Gcode line
  • in gconsole/commands reside a few gcode script which simplify handling:
    • homehomexhomeyhomezhxhyhz: homing all or individual axis
    • left <n>right <n> move left or right (X-axis) relatively
    • up <n>down <n> move up or down (Z-axis) relatively
    • forward <n>back <n> move forward or back (Y-axis) relatively
    • x <n>y <n>z <n> move each axis absolutely
    • nozzle <temp> set nozzle temperature
    • bed <temp> set bed temperature
    • off turn everything off (motors, nozzle, bed)
> homex
send <G28 X>
X:0.00 Y:0.00 Z:5.00 E:0.00 Count X:0 Y:0 Z:16000
> right 10
send <G91>
X:0.00 Y:0.00 Z:5.00 E:0.00 Count X:0 Y:0 Z:16000
send <G1 X10>
> _

Download & Install

Visit https://github.com/Spiritdude/Print3r or choose the latest release.

More Information & Details

3D Printing: Print3r 0.2.x: Networked Printing

A brief post of my local network for 3d printing with several 3d printers, using print3r CLI (Command Line Interface) tool.


Physical Setup

20190302_164919Orange Pi Zero (single board ARM-based computer) named printhub running Armbian (Debian-like).

  • Ethernet Port connecting to Ethernet/Wifi Hub with its own subnet (192.168.4.x)
  • External USB 4x Hub connecting 3d printers via USB:
    • Ashtar K 1 (Prusa i3-like, 400 x 300 build plate, 330mm height), 0.5mm nozzle (/dev/ttyUSB2)
    • Ashtar K 2 (300 x 300 build plate, 330mm height), 0.4mm nozzle (/dev/ttyUSB1)
    • Ashtar C 1 (CoreXY, 400 x 400 build plate, 380mm height), 0.4mm nozzle (/dev/ttyUSB0)
    • CTC DIY I3 Pro (Y3228), 0.4mm nozzle (/dev/ttyUSB3)

The workstation from which I print from (design and slice) is also connected via Ethernet. The printed violet PLA case I published a while ago on Thingiverse: Orange Pi Zero Case.


On printhub (Orange Pi Zero) starting all the network clients processes:

% print3r /dev/ttyUSB0 client &
% print3r /dev/ttyUSB1 client &
% print3r /dev/ttyUSB2 client &
% print3r /dev/ttyUSB3 client &


On my workstation (a laptop), referencing printer profiles and devices:

% print3r --device=tcp:printhub:0 --printer=ashtar-c-1 print cube.stl
% print3r --device=tcp:printhub:1 --printer=ashtar-k-2 print cube.stl
% print3r --device=tcp:printhub:2 --printer=ashtar-k-1 print cube.stl
% print3r --device=tcp:printhub:3 --printer=y3228 print cube.stl

See Print3r Wiki: Remote Printing for more details.

The CTC I3 Pro B Y3228 low cost printer still runs Marlin 1.0 and 250,000 baudrate which won’t work with ser2net which print3r uses internally to print in network environment, so it needs to be flashed first with newer firmware, so it can be networked as well with common baudrate like 230,400. I upgraded the ~1 year old “CTC DIY I3 Pro B” 3d printer to Marlin 1.1.8 finally, first burning a bootloader with an Arduino Uno, and then properly configured Marlin, and now runs with 115,000 baudrate as well, so it can be networked as well.

Otherwise I stopped using Cura GUI or Slic3r GUI completely, and solely use print3r to first preview the Gcode, sliced with CuraEngine or Slic3r, and then print the parts, and because it runs on the command line, all the previous calls in the terminal are stored as history therefore I can scroll back (cursor-up/down) and repeat a job with slightly changed settings by editing the command line – something which GUI doesn’t offer, unless you save a printjob as .3mf and reload it and click around and change settings and save again as .3mf etc.

Command Inline OpenSCAD

Further, I often code OpenSCAD code directly with print3r for simple parts, e.g. caps for M6 threaded rods, something like:


% print3r --device=tcp:printhub:0 --printer=ashtar-c-1 --random-placement --scad print 

and if the print came out well, I add --multiply-part=3 or so.

Download & Install Print3r



That’s it for now.


3D Printing: Print3r 0.1.6 Release

Following major changes of 0.0.9 to 0.1.6 regarding Print3r (command line tool for 3d printing):

Multiple Slicers Support

Now print3r natively supports 4 different Open Source slicers:

  • Slic3r (slic3r)
  • Slic3r PE (Prusa Edition) (slic3r-pe)
  • CuraEngine Legacy (15.04) (cura-legacy)
  • CuraEngine (3.5.x) (cura)

which can be set with --slicer=<slicer> on the command line.

Slicer Independent Settings

Starting with 0.1.0 print3r provides a slicer-independent layer with a growing list of settings:

  • temperature
  • nozzle-diameter
  • filament-diameter
  • bed-temperature
  • etc.

Full list of settings you find at Print3r Github Wiki.

Slicer Specific Settings

Yet, if you must, you can still use slicer-specific settings to fine-tune settings according your print needs and printer capabilities.

Macros (other Profiles)

For often used settings like print quality, or filament settings, you can gather those settings and reference them in the command line like:

% print3r @filament/prusament @thin @hollow cube.scad

Quality Presets:

  • @coarse
  • @medium
  • @fine

Infill/Wall/Perimeter Presets:

  • @heavy
  • @light
  • @feather

OpenSCAD Integration

print3r already supported to print or slice .scad files,

% print3r print cube.scad

and now since 0.1.6 also following command line code integration is possible:

% print3r --scad print "cube(20)"
% print3r --scadlib=washer.scad --scad print "washer(5)"
% print3r --scadlib=parts.scad --scad "c_2020()" "edge_idler()"

Arbitrary Baudrate

Since 0.1.0 also arbitrary baudrate like 250000 (default of Marlin) is supported (Linux only, other platforms not yet), aside the common 115200.


As external Gcode viewer for preview command yagv is used, a very basic viewer – at a later time it might be replaced.

% print3r preview cube.scad

which converts, slices and preview the Gcode.

Extensive Documentation

Since the functionality of print3r is growing steadily, the requirement for proper documenation demanded its own Print3r Wiki where you find up-to-date information.



3D Printing: Networked Printing with Print3r

Note: The information is outdated as print3r natively supports networked printing, see 3D Printing: Print3r 2.x: Networked Printing (2019/02/27), but this information is still useful bridging USB to TCP in general.


The moment you deal with more than one single 3d printer, but multiples – you want to access those with a single host: creating a cloud 3d printing facility.

After a few minutes researching the net for USB to network bridge, I realized the overhead to print via network is possible without Octoprint or some other solution, but simple ser2net and socat alone, thanks to this Github Issue by Marco E explaining his steps, so I reiterate his solution with some changes:

  • create USB to network bridge with ser2net per printer
  • create network to virtual serial per printer with socat on the host


Each printer you like to network has to have:

  • Linux OS (like Debian, Ubuntu or alike), e.g. Raspberry Pi or OrangePi or any kind of lowcost ARM-based board
  • USB connectivity where the 3d printer is wired
  • Wi-Fi (wireless) or Ethernet (wired) connectivity


As next install ser2net serial to tcp bridge per printer:

% sudo apt install ser2net

Create a file named client.cfg, you may have to change the baudrate and/or the USB device:


Start ser2net on each printer:

% ser2net -c client.cfg


As next prepare the host, where all the printers will be controlled from:

  • UNIX OS like Linux (Debian, Ubuntu, *BSD, macOS should work too)
  • Wi-Fi (wireless) or Ethernet (wired) connectivity
  • Print3r


First make sure you have socat installed:

% sudo apt install socat

For each printer you are creating network back to (virtual) serial port – replace with the IP of your printer(s):

% socat -d -d pty,raw,echo=0,b115200 tcp:
2018/10/07 10:08:16 socat[31821] N PTY is /dev/pts/29
2018/10/07 10:08:16 socat[31821] N opening connection to AF=2

The first line reports the new virtual serial port, e.g. /dev/pts/29  or enforce a link of the new device:

% socat pty,raw,echo=0,b115200,link=/tmp/my-printer tcp:

you can reference /dev/pts/... or the link you defined with Print3r then:

% print3r --device=/tmp/my-printer --scale=2 --random-placement --fill-density=0 --perimeters=1 print xyzHollowCalibrationCube.scad
== Print3r 0.0.8 == https://github.com/Spiritdude/Print3r
print3r: conf: device /tmp/my-printer, bed 380x300mm, nozzle/d 0.5mm, layer/h 0.4mm, filament/d 1.75mm
print3r: scad to stl: done.
print3r: slice part to gcode: position 272,118, filament usage 2.38m, done.
print3r: print: 0h 03m elapsed, eta 0h 16m, 18.9% complete, z=0.60mm, layer #2, filament 0.42m

So you end up with something like this:


So, that’s it, with ser2net on the printers, and socat on the host you have a rather simple and straight-forward cloud 3d printing facility.

I likely will extend Print3r to support networked printing with a simple all-in-one setup. Implemented since Version 2.0.0, see 3D Printing: Print3r 2.x: Networked Printing.


  • 2018/11/01: there is a slight drawback using ser2net: only takes common baudrates, but doesn’t support 250,000 which is the default baudrate for Marlin, 115,200 does work though. So, in case you plan to use ser2net reflash the firmware to use 115200 as baudrate.

3D Printing: Print3r (CLI)


Command Line Interface (CLI)

Although 3d parts need to be seen and visually so much is communicated, but Cura’s user interface feels conceptually skewed (“Prepare” vs “Monitor” tab) – and with the time I thought I want an ordinary command line interface to print parts quickly, easily multiply and random placement so the bed surface is more evenly used and not just the center – I have grown tired to move parts on the virtual bed.

So, I wrote print3r, a command line interface which utilizes Slic3r as backend. Its main features (Version 0.0.6):

  • command line interface, no GUI
  • UNIX platform (Linux, *BSD, macOS should work too)
  • print .scad (OpenSCAD), .stl, .obj, .amf and .3mf directly
    • it converts and slices depending on file format as needed
    • takes Slic3r command line arguments
    • multiply part
    • random placement
    • scale, rotate, translate or mirror (.scad or .stl only for now)
  • slice .stl, .obj, .amf and .3mf to .gcode
  • print gcode files
  • send gcode lines direct from command line arguments
  • send interactively gcode commands from the console
  • render .scad, .stl and .gcode to PNG for documentation purposes


% print3r --printer=ashtar-k-30x30.ini --fill-density=0 --random-placement print Parts/cube.scad
== Print3r 0.0.3 == https://github.com/Spiritdude/Print3r
print3r: conf: device /dev/ttyUSB0, bed 300x300mm, nozzle/d 0.5mm, layer/h 0.4mm, filament/d 1.75mm
print3r: scad to stl: done.
print3r: slice parts to gcode: filament usage 79.67cm, done.
print3r: print: printing 0h 09m elapsed, eta 0h 00m, 100% complete (38494 of 38494), z=19.80mm, layer #50, filament 79.67cm

More information on the printer display: progress [%], eta and layer#:




and if you replace ‘print‘ with ‘render‘, like

print3r [...] --output=sample.png render Parts/cube.scad



Github.com: Spiritdude/Print3r