slicer start macro for temp tuned heightmaps



  • I had been playing around with some macros by @Kolbi. After much tweaking I adapted the approach and thought I might share it with the board:

    I created a start macro that will create custom heightmaps based on the slicer specified bed temp and attempt to load a heightmap if one already exists. Separating the heightmap logic from the DWC filament config has really simplified my slicer start code as well as my filament configuration files.

    The resulting heightmaps are stored with the temp as the leading value in the filename so they are grouped together in the system directory and easy to delete or see what I have available:

    70.0C_heightmap.csv
    80.0C_heightmap.csv
    

    Slicer Start Script (simplify3D):

    ; Simplify3D Start G-Code
    
    ; Set nozzle and bed to the specific temperatures declared within this slicer
    M140 S[bed0_temperature]                         ; set bed temp
    M104 S[extruder0_temperature]                 ; set extruder temp
    
    ; Home Bedlevel and primeline
    M98 P"0:/sys/primeLine.g"                          ; primeline macro
    
    • The slicer start code warms the system to a desired bed and extruder temp
    • The primeline.g script is called
    • the script looks for a heightmap for that given temp
    • If a heightmap is found then it prints with it, if not, then it creates one

    Just that simple.

    /sys/primeline.g

    ; 0:/sys/primeline.g
    ; Home axes, wait for temps, create heightmap, and wipe a primeline
     
    ; Determine if we need to Home first or not
    if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed
        G28		                                               ; Home all axes
    
    G90                                                        ; Absolute Positioning.
    G1 Z50 F1000                                               ; [BLTouch] Last chance to check nozzle cleanliness.
    
    G29 S1 [P{"0:/sys/" ^ heat.heaters[0].active ^ "C_heightmap.csv"}] ; Load bed mesh for the slicer set bed temp.
    if result > 1                                             ; If the file doesn't exist, perform mesh and save.
       M291 P{"Creating a height map for the bed temp of " ^ heat.heaters[0].active ^ "C."} T10
       M116                                                   ; Wait for temps
       G29                                                    ; Perform mesh now.
       G29 S3 [P{"0:/sys/" ^ heat.heaters[0].active ^ "C_heightmap.csv"}] ; Save heightmap.csv based on commanded temp
    
    M400                                                       ; Finish all moves, clear the buffer.
    M83                                                        ; Extruder relative mode.
    M116                                                       ; Wait for temps
    
    ; Charge! tune
    M98 P/macros/Tunes/Charge!.g	
    
    G1 Z3.0 F3000                                             ; move z up little to prevent scratching of surface
    G1 X0.1 Y20 Z0.3 F5000.0                                  ; move to start-line position
    
    M117 "Printing Wipe Line"
    G1 X0.1 Y200.0 Z0.3 F1500.0 E15                           ; draw 1st line
    G1 X0.4 Y200.0 Z0.3 F5000.0                               ; move to side a little
    G1 X0.4 Y20 Z0.3 F1500.0 E30                              ; draw 2nd line
    
    G92 E0                                                    ; reset extruder
    G1 Z3.0 F1500                                             ; move z up little to prevent scratching of surface
    M400                                                      ; finish all moves
    
    M117 "Printing"
    


  • Hi,

    Why do you want to put the temps in the slicer generated code?

    I have my temps (and other settings such as loading the heightmap) in the filament config macro.

    That allows me to use the same slicer code for different filaments.

    Thanks.

    Frederick



  • @fcwilt It really depends one which interface you find to be easier to use. Lots of ways to do this but this is a really easy to use method. When slicing I can tweak temp settings in one spot in the slicer either permanently or temporarily and hit send to printer and print.



  • @mitch, nice implementation!

    @fcwilt, for my use I find it easiest to set the 'general' filament type temp in the dwc environment and then use the slicer to fine tune the temp based on the exact filament. And of course, running the primeline afterwards.

    Cheers,
    Kolbi



  • @Kolbi This is exactly what I am doing as well. The DWC just has the general filament type which makes it easier for unloading or loading filament.

    The height map is created based on the slicer specified temp. This ensures that if I have a specific PETG that is slightly temp tweaked in the slicer I don't need to mess with a DWC filament change. It just takes care of itself at print time with a new heightmap.


Log in to reply