Dual extruder printing and Kisslicer - my hints

Discussions about firmware/slicing software, tweaks and settings
Post Reply
frankjoke
Posts: 150
Joined: Sat Dec 28, 2013 6:07 pm

Dual extruder printing and Kisslicer - my hints

Post by frankjoke »

Dear all,

In some other posts I described already some of my 'startup experiences' with Felix 3.0 Dual.

I am at a stage now which actually works very well and I wanted to share some tricks I started to use.

First: I use Inkjet transparent paper for the bed, no Kapton or anything else. Things stick much better than anywhere else and I can use one sheet it for 20-30 prints, a set from http://www.amazon.de/gp/product/B0002S4CRM cost 23€ for 25 peaces so I have a long way to go. I print PLA with 60 degrees on first 2 layes...

Second, I generated two multiple printers in Kisslicer, one for single extruder and another one for dual extruder. In this way I can separate some things like the different G-code sections where I heat up bed and one or both extruders in start up code.

I changed the select extruder and deselect extruder codes which went originally to x/y/z home and destroyed objects which were in the way later in print :(

Select extruder:

Code: Select all

T<EXT+0>
M109 S<TEMP>
Deselect Extruder:

Code: Select all

M104 S<TEMP>
G92 E0 ; Reset Extruder
And I created a Python script wich acts as a postprocessor.
With it I can write layer number on printer, add G-Code commands on certain layers (I reduce bed temperature to 50 degrees on 3rd layer)
and it moves the head over prime pillar (which I enable for the dual head) before it changes head (instead of moving to home).

You just add in the Firware tab on the Printer settings the PostProcess code:
X:\Your\Path\Count.py "<FILE>" "-L2 M140 S50"

In this case -L2 M140 S50 mean to reduce bed to 50 degrees on layer 2, multiple such layer statements can be added.

Let me know if all of that helped some of you. Postprocessor can be used also for single head of course :)

The code of the Python is:

Code: Select all

#!/usr/bin/env python

"""
Gcode to add 'layer/of layers %' message to KISSlicer.

Please add to Kisslicer Printer/Firmware/Post-Process the following:
/full/path/to/Count.py "<FILE>" ["-L[-]x g-code"]*

"""

import math
import os
import re
import sys
import time


def rewrite(infile, outfile, args):
    verbose = '--verbose' in args
    # verbose = True
    l = 0
    al = []
    lc = []
    for a in args:
        match = re.match(r'^-L([\d-]+)(\s+)(.+)',a.rstrip())
        if match:
            al.append([int(match.group(1)),match.group(3)])
    if verbose:
        print(al)
    nl = 0
    ml = 0
    islc = False
    for line in infile:
        l = l +1
        match = re.match(r'^; BEGIN_LAYER_OBJECT',line.rstrip())
        if match:
            nl += 1
        if islc:
            match = re.match(r'^G1 X',line.rstrip())
            if match:
                lc.append(line.rstrip()+"; Count.py move")
                if verbose:
                    print("Tool change %d: %s" % (len(lc),line.rstrip()))
                islc = False
        else:
            match = re.match(r'^; \*\*\* Changing Extruders from',line.rstrip())
            if match:
                islc = True
                if verbose:
                    print("Line %d layer %d: %s" % (l,nl,line.rstrip()))
        
    infile.seek(0)
    ml = nl
    nl = 0
    nc = len(lc)
    c = 0
    if verbose:
        print("Max Layer=%d, Tool changes=%d" % (ml,nc))

    for line in infile:
        outfile.write(line)
        match = re.match(r'^; BEGIN_LAYER_OBJECT',line.rstrip())
        if match:
            mline = "M117 L %d/%d %2.1f     ;" %(nl,ml,(100.0*nl)/ml)
            outfile.write(mline+'\n')
            for l in al:
                if (l[0]<0 and ml+l[0]==nl) or (l[0]>=0 and l[0]==nl):
                    outfile.write(l[1]+'\n')
                    if verbose:
                        print("Layer %d write: %s" % (nl,l[1]))
            nl += 1
        match = re.match(r'^; \*\*\* Changing Extruders from',line.rstrip())
        if match and nc>0:
             outfile.write(lc[c]+'\n')
             c=c+1
                 
    mline = "M117 L%d/%d 100%% Done" %(nl,ml)
    outfile.write(mline)
	
    if verbose:
        print(line)
        time.sleep(3)

    outfile.write("\n; Count.py END")

if __name__ == '__main__':
    if len(sys.argv) < 2:
        sys.exit('usage: Count.py <filename> [--verbose]')
    infilename = sys.argv[1]
    outfilename = '%s.count%s' % os.path.splitext(infilename)
    with open(infilename) as infile:
        with open(outfilename, 'w') as outfile:
            rewrite(infile, outfile, sys.argv)
            #test rewrite(infile, outfile, ["--verbose","-L-1 ;Last Layer","-L0 ;First Layer"])
By the way. for single extruder I do not print the Prime Pillar, just a Skirt Raft 5mm out.
I added to startup gode which Extrudes some 20mm in a position aside before it starts printing. My startup code:

Code: Select all

M140 S<BED>
; Absolute E
M82
T0M109 S<TEMP> T0
; Go to dump area and flush extruder
G1 Z10 X50 F3000         ; move 10 mm up and 50 mm to side
G92 E0            ; reset extruder
G1 E20 F200       ; flush extruder
G1 E18 F900         ; retract extruder 2mm
G92 E0            ; reset extruder
G1 Z15 F3000       ; move up to 15 mm - remove flushed filament by tweezers
; Go back to start position
G28 X0 Y0 E0
M107             ; stop fan for first layer usually
I printed now several prints without any problems in this configuration.

Thanks also to share your experience and tricks.

Post Reply