Tag Archives: Slic3r

3D Printing: Conic Slicing for Rotating Tilted Nozzle (RTN) / 4 Axis

State: early draft, mostly simulations with a few tests with 3-axis printer only

Conic sliced overhang model with two overhangs, printing with Rotating Tilted Nozzle (RTN) 90° overhang structure without support structure

Updates:

  • 2021/09/28: added reference to paper by ZHAW describing slicing procedure
  • 2021/03/22: slicer4rtn released, see dedicated page Slicer4RTN
  • 2021/03/16: removing details on slicer4rtn as a new dedicated page is in the working (coming soon)
  • 2021/03/08: slicer4rtn 0.2.3 reached (still unreleased), better prints, documenting various settings in more details
  • 2021/03/05: added proper ZHAW reference in the introduction and a few notes
  • 2021/02/27: removed some redundant illustrations and remade some of them, outside-cone vs inside-cone mode & printing
  • 2021/02/26: added inside-cone printing example for inner overhang mode, also early information of slicer4rtn; more animations to observe details of produced G-code, using now also OpenSCAD to simulate G-code and actual nozzle position
  • 2021/02/24: better tests with 20mm cube and overhang structure, included two short G-code simulations as videos, added 20mm sphere and 3D Benchy and discover first issues with volume decomposition and overhang recognition
  • 2021/02/23: first write up, pseudo code and first attempt to conic slice 20mm cube

As I progress I will update this blog-post.

Introduction

The main idea is to utilize existing 3D printing slicers but create conic slices for the Rotating Tilted Nozzle (RTN) 4 Axis Printer. ZHAW published in their announcement in 2021/01 something about utilizing existing slicers, but the details remained concealed and later published as a paper but I did not want to wait and pondered on the problem, and came up with a solution. In its current state it’s purely theoretical and untested for now (2021/02) barely tested yet.

Michael Wüthrich confirmed my solution is comparable with their solution. ZHAW planned their paper to be published sometime 2021. So, the main credit goes to ZHAW and the researchers (Prof. Dr. Wilfried Elspass, Dr. Christian Jaeger, Michael Wüthrich, Maurus Gubser, Philip Bos and Simon Holdener) there, I was just impatient and tried to find a solution with the information available.

I also adapted some of the notions Wüthrich introduced in the Novel 4-Axis 3D Printing Process to Print Overhangs Without Support Material paper, e.g. “outside-cone” and “inside-cone” printing as featured in an earlier blog-post already.

Non-Planar Conic Slices

The 4-axis Rotating Tilted Nozzle (RTN) physical setup implies its slices are of non-planar conic shape, allowing to print overhangs without support structure, such as:

Conic slices of an overhang model

I also like to master the conic slices properly as they promise to become a subset of 5 axis printhead (PAX) features too – so it’s worth the effort even if the RTN itself might be too limited in its application with its fixed tilt – we will see.

Theory

In a nutshell the steps are following:

  1. sub-divide faces of the model (fine-grained)
  2. map model to inverse conic space
  3. send to slicer
  4. remap G-code to conic space
  5. adding Zrot to G-code

Conic Space Mapping

(x1,y1,z1,rot) = conicSpaceMapping(cx,cy,x,y,z,dir);

whereas

  • cx, cy are the conic axis coordinates
  • x, y, z are the input coordinates
  • x1, y1, z1 are the output coordinates
  • rot the rotation angle x,y vs cx,cy
  • dir is either direct (default) or inverse
function conicSpaceMapping(cx,cy,x,y,z,dir='direct') {
   dx = x-cx; 
   dy = y-cy;
   d = sqrt(dx*dx + dy*dy);
   rot = atan2(dy,dx);
   return (x,y,dir=="direct" ? z-d : z+d,rot);
}

Pseudo-Code

The entire procedure goes like this:

m = loadModel("cube.stl");
m = subDivide(m,5);
for(p of m.vertices) {
    m.vertices[i] = conicSpaceMapping(cx,cy,p.x,p.y,p.z,'inverse');
    i++;
}

gcode = sliceModel(m);

foreach(line of gcode) {
   (code,x,y,z,e) = extractCoordsExtrusion(line);
   (x1,y1,z1,zrot) = conicSpaceMapping(cx,cy,x,y,z,'direct');
   outputGcode(code,x1,y1,z1,e,zrot);
}

Note: the pseuco-code is incomplete as extrusion E is not yet taken care of, as soon I found a definitive solution I will write it up.

Examples

I implemented the pseudo-code with some more details like taking care of G-code E extrusion as well and fine-step linear extrusion – here some early tests using OpenSCAD as STL & G-code viewer and Slic3r as actual slicer:

20mm Cube Conic Sliced

Snapshots of progress of conic sliced 20mm cube:

20mm cube conic sliced G-code
20mm cube conic sliced with rotating tilted nozzle simulation

Overhang Conic Sliced

Snapshots of progress of conic sliced Overhang:

Conic sliced overhang model
Conic sliced overhang model including rotating tilted nozzle simulation

Gallery of Conic Sliced Models

Detailed snapshots of overhang nr 3

Detailed snapshots of model nr 6 (table-like)

Some more models with their in-between states, using Cura as model and G-code viewer:

Issues to Resolve

  • test actual G-code in real life
  • find good pre-processing face sub-division strategy
    • in its current form the algorithm requires fine-grained sub-divided faces otherwise inaccurate G-code is created which cannot be recovered
  • slice more complex parts
  • document all details
  • release source code to public

Close-Ups

Some close-ups of conic sliced models:

Outside- vs Inside-Cone Printing

As pointed out in the previous blog-post, the RTN has two main modes of operation, outside-cone and inside-cone printing to cover outside overhangs and inside overhangs – the slicer must recognize those and switch operation mode. Further, these two modes cannot easily be mixed, and need to be segmented or separated, hence speaking of volume segmentation.

This poses significant grow of complexity from just planar slicing, the 4-axis RTN provides features to print 90° overhangs without support structure, but only when the part can be properly analysed and segmented so that those operational mode can be applied.

The difference between inside- and outside-cone printing is to change the order of conic mapping for the model and post slicing:

outside-cone mode

  1. map model inverse conic
  2. slice model
  3. map G-code direct conic

inside-cone mode

  1. map model direct conic
  2. slice model
  3. map G-code inverse conic, Zrot + 180°

Slicer4RTN

The pseudo-code turned into an actual application I named slicer4rtn and is a command-line tool, slicing STL into G-code:

% slicer4rtn --subdivide=5 --recenter cube.stl
== Slicer4RTN 0.4.1 ==
processing 'cube.stl':
   1/5 read stl
      1/5 subdivide (44 vertices)
      2/5 subdivide (188 vertices)
      3/5 subdivide (764 vertices)
      4/5 subdivide (3068 vertices)
      5/5 subdivide (12284 vertices)
   2/5 map vertices
   3/5 write temporary stl
   4/5 slice (slic3r) stl
=> Processing triangulated mesh
=> Generating perimeters
=> Preparing infill
=> Infilling layers
=> Exporting G-code to ./temp-603919.gcode
Done. Process took 0 minutes and 1.362 seconds
Filament required: 710.9mm (5.0cm3)
   5/5 remap gcode to 'cube.gcode' (16214 lines)
== took 3 secs total, done.

I gonna released Slicer4RTN eventually 2021/03/22, in its early version the model currently can only be sliced for outside-cone or inside-cone printing, so the volume decomposition or segmentation needs to be done separately. For now it helps me to verify some of the 4-axis and 5-axis printer designs I work on.

Ashtar K RTN printing conic sliced 20mm cube (close up, animation)
Ashtar K RTN printing conic sliced overhang model without support structure (close up, animation)
Ashtar K RTN printing conic sliced overhang model nr 6 (table-like) without support structure (close up, animation)

Test Prints

As soon I built the RTN printhead on one of my printers I will post photos of the first prints. For now (2021/03) I only printed conic sliced pieces on a 3-axis 3D printer.

References

See Also

With conic sliced G-code there are many first layers . . .

That’s it.

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.

Preview

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.

Download

https://github.com/Spiritdude/Print3r

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.

Introduction

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

Printers

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

Install

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:

3380:raw:600:/dev/ttyUSB0:115200 8DATABITS NONE 1STOPBIT -XONXOFF LOCAL -RTSCTS

Start ser2net on each printer:

% ser2net -c client.cfg

Host

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

Install

First make sure you have socat installed:

% sudo apt install socat

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

% socat -d -d pty,raw,echo=0,b115200 tcp:192.168.0.16:3380
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 192.168.0.16:3380
...

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:192.168.0.16:3380

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:

3d-printer-networking

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.

Update:

  • 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)

example

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

Example

% 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#:

20181005_170351

Result:

20180927_152946

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

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

cube-example

Download

Github.com: Spiritdude/Print3r