PrusaSlicer post processing script - prime tower generation/temp and PCF managment

Discussion in 'Getting Started' started by mkudzia, Apr 14, 2020.

  1. mkudzia

    mkudzia Active Member

    Joined:
    Dec 26, 2019
    Messages:
    35
    Likes Received:
    18
    Hello,

    Finished working on my Prusa Slicer post processing script for the tool changing systems running on Duet / RepRap 3


    The script includes the following enhancements:
    • Robust prime tower generation
    • Smart Active/Idle tool-head temperature management
    • PCF speed management
    • Validation/stripping of the GCode (i.e. Merlin M900, mapping of the fan ranges etc.)

    [​IMG]

    The documentation and repo can be found here:
    https://github.com/mkudzia84/toolchanger-pspp

    Synposis:

    PRIME TOWER GENERATION
    The wipe tower functionality in PrusaSlicer is build and optimized for a single extruder/multi-material setup. As such it works reasonably well with MMU2s or Palette 2 - but not in an IDEX or multi-tool setup.
    For a multi-tool setup the prime tower:
    • allows to equalize nozzle pressure upon tool activation
    • doesn't require excesive material extrusion
    • allows for usage of tool-heads of different nozzle diameters
    • maintains structural integrity thru-out the print
    • doesn't create additional tool change operations
    In order to achieve this, the script uses tube structure to generate the prime tower; Each tool-head is assigned it's own set of shells within the tube - this is done to ensure that, upon priming, material of same properties is depositor upon each other, increasing the strength of the prime tower In case the tool is not active in that particular layer, the first active tool within that layer is used to fill in the empty shells - this prevents additional tool changes (just for prime tower generation) Each shell band width is determined based on the tools nozzle diameter
    EXPERIMENTAL - Support of variable layer heights/prime tower layer optimisation Even with fixed layer heights, PrusaSlicer offsets support/interface layers vs. the model layers (by between 0.03-0.05mm) To handle this and the variable layer heights, the script optimises the prime tower structure by combining the subsequent layer tool change priming moves onto a single prime tower layer. This is done to maximize the prime tower layer height but still keep it within the limits of max layer height for all the tools active in the layer

    SMART ACTIVE/IDLE TOOL-HEAD TEMPERATURE MANAGEMENT
    After generating the prime tower GCode, the post processing script analyzes the result GCode to estimate the run-time of each operation - this is done to determine time periods when each tool is idle between deactivation and activations.
    In the script, the user can specify the standby idle temperature delta. Based on the temperature delta, and configured cooling down and heating up temperature rate estimates - the scripts determines if, within each period of idleness, the idle tool will be able to cool down by temperature delta degrees and then heat-up back to the active temperature before being activated. If that is the case, it injects GCode to change standby temperatures within the idle period. This is done to prevent extensive oozing while the tool is idle
    The script also inserts GCode to set the temperature of the tool to zero at the last deactivation in the file.

    PART COOLING FAN MANAGEMENT
    The script inserts M106 instructions to disable and enable fans upon tool changes - and set appropriate speed settings based on the Cooling settings of filament assigned to specific tool in PrusaSlicer
     
    Paul Arden, Nibbels and Spoon Unit like this.
  2. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,546
    Likes Received:
    481
    Do you have any completed prints to share to show the outcome?

    I also post-process GCODE for multi-tool prints in order to move to the next print location properly after a tool change. Left unchanged, the nozzle will return to the location of tool change command and not move to the position of the start of the next extrusion. Did you also incorporate this into your script?
     
    Nibbels likes this.
  3. mkudzia

    mkudzia Active Member

    Joined:
    Dec 26, 2019
    Messages:
    35
    Likes Received:
    18
    Yes, whole baby if Benchies and doing my first production functional parts.

    My post process script does whole prime tower printing and Injection code adds a command to move back to the last known G1 position Just before prime tower inejcrion, that in reality means last know position before tool change
     
  4. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,546
    Likes Received:
    481
  5. mkudzia

    mkudzia Active Member

    Joined:
    Dec 26, 2019
    Messages:
    35
    Likes Received:
    18
    The most recent finished print (with the PrusaSlicer + post process script)

    Simple in design - but a lot of curviture; Windscreen Stub (for dry fit test) for my 1.6m RC Bell 206.
    Printed in PETG with supports printed in PLA with 0.0 distance - as breakaway supports, supports pealed off nicely :)

    This was printed at 0.2 layer height so very rough but doesn't matter

    Prime tower generated by the script on the right
    Also the formula used to inejct the Idle toolhead cooldown/heatup worked perfectly fine; there was no waiting and minimum idling at max temp.

    Now printing the slug in HIPS with solid infil for vac former.

    [​IMG]

    [​IMG]
     
    blarbles and Spoon Unit like this.
  6. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,546
    Likes Received:
    481
    Love this picture. So much of interest to talk about. Left/right lighting. Dribble tubes for the parked nozzles. Large tray to capture prime/purge material. Mount for microscope?. And then the print. Is this PETG as a support material? Had to look up what a '1.6m RC Bell 206' was and quickly ran away checking for my wallet :)
     
  7. blarbles

    blarbles Well-Known Member

    Joined:
    Aug 10, 2019
    Messages:
    100
    Likes Received:
    64
    I too would also like to know about your microscope setup and if you have STL models for the parked nozzle filament catchers.
     
  8. mkudzia

    mkudzia Active Member

    Joined:
    Dec 26, 2019
    Messages:
    35
    Likes Received:
    18
    Thanks,

    Will put those STLs in my repo/thingiverse soon

    And - print is PETG with PLA as supports - PETG + PLA with 0.0 distance between supports works perfect - they don't adhere particulary well to each other so you can litterally peel the interface layer off .
     
  9. Krayn

    Krayn Well-Known Member

    Joined:
    Aug 11, 2019
    Messages:
    49
    Likes Received:
    13
    This is really interesting stuff, this is something I wanted to tackle at some point and I just haven't had the time to really look into it. I might have to look at your code for inspiration on my own post processing script.
    I'm not sure yet how much work you are doing behind the scenes with PCF management, but for the most part I find prusaslicer does a good job of handling fan speeds except during tool swaps. As you probably realized Prusaslicer throws in the NEXT tool's fan speed before the actual tool swap, probably because this is how it should work with single extruder multiplexed setups like their MMU. Swapping the M106 commands to be right after the toolswap and using M106 S0 in tfree and M106 R2 in Tpost scripts has worked well otherwise.

    I'm really curious how you managed to get your PETG to stick to your PLA at 0.0 interface distance. I have to throw a little bit of a negative offset (squish them a bit more) or the PETG just won't stick to the PLA reliably. It is a dream once you get it working though. Cheap material and snap off supports.

    Thanks for sharing your scripts.
     
  10. Nibbels

    Nibbels Well-Known Member

    Joined:
    Dec 12, 2019
    Messages:
    165
    Likes Received:
    32
    @mkudzia

    The process changes you show here sound superb.
    I will definitly try to print with that within the next days or weeks.

    Sadly I stopped working with Slic3r (@my old printers) about 2 years go.
    But I just found this config here to start working on:
    Thread:"Anyone have a known good slic3r configuration I could peek at?"

    Did you too share or upload your updated recent PrusaSlicer settings?
    (Of course your documentation is probably ok to add the postprocessing scripts to any config.)
    I found nothing on your github yet, so I will then probably start with the settings @Amr kindly shared. I will have to change them in any case because of other toolheads and no T3.

    Greetings
     
  11. mkudzia

    mkudzia Active Member

    Joined:
    Dec 26, 2019
    Messages:
    35
    Likes Received:
    18
  12. Nibbels

    Nibbels Well-Known Member

    Joined:
    Dec 12, 2019
    Messages:
    165
    Likes Received:
    32
    Thank you :)
    I did look into the script today. I cant think about how much work this has been so far. Thanks!

    For all that might follow my path:

    1) Dont put the script into
    C:\Program Files\Prusa3D ... Keep it in a folder which is not protected by special permissions in Windows 10. Like your favorite git folder within your local user.
    Screenshot_2.jpg


    2) If you get this error:
    Screenshot_5.jpg
    Which is caused by the 0=auto in in all the extruders I have:
    Screenshot_1.jpg
    Is this error necessary? Wont the script be able to run with the "auto" setting 0?

    3) Another step:
    Screenshot_3.jpg
    Shortly prior this message I see this:
    Screenshot_4.jpg
    (It is proven that foolproof software is beaten by better fools)
    In case you see this please check if you forgot to insert one or more markers if you get the same error:
    upload_2020-5-7_0-8-8.png


    4) Done!!
    upload_2020-5-7_0-10-28.png
    A Laptop Stand Sveta - G 11_0.15mm_T0-PET_T1-PET_T2-PET_4h5m31s.gcode was generated.


    5) So lets load the generated gcode within Simplify3D or another gcode generator:
    upload_2020-5-7_0-12-46.png
    upload_2020-5-7_0-24-31.png
    Thats better:
    upload_2020-5-7_0-20-44.png


    6) There is still one question left:
    upload_2020-5-7_0-19-50.png
    I have to look into this tomorrow. Maybe I understand this on my own.

    :) Greetings
     
    garethky and Spoon Unit like this.
  13. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,546
    Likes Received:
    481
    Somehow, the like button just wasn't enough.
     
  14. Sylvain

    Sylvain Active Member

    Joined:
    Nov 18, 2019
    Messages:
    32
    Likes Received:
    3
    Sorry for my question. What does PCF mean ?

    Thanks
     
  15. Nibbels

    Nibbels Well-Known Member

    Joined:
    Dec 12, 2019
    Messages:
    165
    Likes Received:
    32
    In this context: Part Cooling Fan
     
  16. mkudzia

    mkudzia Active Member

    Joined:
    Dec 26, 2019
    Messages:
    35
    Likes Received:
    18
    Ok had a look!

    Right! - yeah might need to add more error handling - but annoying thing is bloody PrusaSlicer just bombs out if the script exists with error code - rather then leaving Console output or something - so if you would do proper error handling with exiting with error code:
    - PrusaSlicer will suprsess it
    If you do error handling in order for it to be visible - you have to make PrusaSlicer think it finishes happily - *sigh*

    Will add note about layer-heights 0 - auto not being supported - or ad a handler where it works out them by itself if it is set to auto

    That warning is just a warning - it's down to parsing the GCode and running a 'simulation' accumulating the state in order to get some runtime estimates for temperature managment code. Will clean it up :)

    Now I'm focusing on doing support of non-firmware retraction support.
    Meantime did quite a lot of prints with that so quiet happy! (plus put a flexible bed on top of the glass bed with PEI covering - so much easier to print stuff - now I know the first layer will stick and won't be a russian roulette...)
     
    Nibbels likes this.
  17. Sylvain

    Sylvain Active Member

    Joined:
    Nov 18, 2019
    Messages:
    32
    Likes Received:
    3
    Could you share more pictures of you new prtins ? Especcially with dual print : master and support filament ?

    Thanks !
     
  18. Sylvain

    Sylvain Active Member

    Joined:
    Nov 18, 2019
    Messages:
    32
    Likes Received:
    3
    I tried your post processing solution.

    Please see attached picture. I don't understand why I get these ireegularities on tower ? Thanks !
    tower.png
     
  19. Nibbels

    Nibbels Well-Known Member

    Joined:
    Dec 12, 2019
    Messages:
    165
    Likes Received:
    32
    Screenshot_8.jpg Screenshot_7.jpg
    I saw this. Might this be connected with the one warning I got?

    In general I dont think that this tiny fault would make a big difference at all.
     
  20. Sylvain

    Sylvain Active Member

    Joined:
    Nov 18, 2019
    Messages:
    32
    Likes Received:
    3
    I presume you use S3D to preview Gcode ? When I try, I can't get Toohead coloration even if I select "Active Toolhead". All print, master and support, with the same color...

    No problem with IdeaMaker or Cura, I get two colors.

    What am I doing wrong with S3D ?

    Best regards
     

Share This Page