1 / 1
Random X Purge Line — image 1

Random X Purge Line

Order a print of this model

We calculate the final price from your selected file. You review and accept it before payment.

Estimated printing price per file

€0.33 – €0.40 net (excluding VAT)

For file: RanomXPurge.bgcode

This is an estimate for one file. You’ll confirm the exact price before ordering.

File and estimate settings

File used for this estimate

Average indicative estimate: €0.36 excluding VAT (range midpoint).

Weight reported by the author
6 g
Print time reported by the author
17.4 min
Source material
PLA
Estimate material
PLA
Estimate printer
Bambu Lab P1S - 0.4 nozzle
Estimate process
0.20mm Standard

Indicative estimate for the selected file only, based on the author’s weight and print time. File variants are not added together. The final price is calculated after file analysis.

Saved on this device.

Creates a random X variable that is then used to place the start of the purge line

Rating
0 / 5
Likes
0
Downloads
1
Makes
0
Views
62
Reviews
0

Updated at source:

Model information

License
Creative Commons — Public Domain

I made this using settings for my MK4S. I don't know if it will work for anything else. YMMV.


Copy and Paste this code to your start G-Code in the Printers tab of PrusaSlicer.  Make sure to copy and paste a backup of your original code into Notepad just in case.


{local rnd_x = random(20, 80)*0.1}

{local purge_x = random(0, (print_bed_max[0] - 51) 10) 0.1}

M17 ; enable steppers

M862.1 P[nozzle_diameter] A{(filament_abrasive[0] ? 1 : 0)} F{(nozzle_high_flow[0] ? 1 : 0)} ; nozzle check

M862.3 P "[printer_model]" ; printer model check

M862.5 P2 ; g-code level check

M862.6 P"Input shaper" ; FW feature check

M115 U6.1.3+7898

M555 X{(min(print_bed_max[0], first_layer_print_min[0] + 32) - 32)} Y{(max(0, first_layer_print_min[1]) - 4)} W{((min(print_bed_max[0], max(first_layer_print_min[0] + 32, first_layer_print_max[0])))) - ((min(print_bed_max[0], first_layer_print_min[0] + 32) - 32))} H{((first_layer_print_max[1])) - ((max(0, first_layer_print_min[1]) - 4))}

G90 ; use absolute coordinates

M83 ; extruder relative mode

M140 S[first_layer_bed_temperature] ; set bed temp

M104 T0 S{((filament_notes[0]=~/.*HT_MBL10.*/) ? (first_layer_temperature[0] - 10) : (filament_type[0] == "PC" or filament_type[0] == "PA") ? (first_layer_temperature[0] - 25) : (filament_type[0] == "FLEX") ? 210 : (filament_type[0]=~/.*PET.*/) ? 175 : 170)} ; set extruder temp for bed leveling

M109 T0 R{((filament_notes[0]=~/.*HT_MBL10.*/) ? (first_layer_temperature[0] - 10) : (filament_type[0] == "PC" or filament_type[0] == "PA") ? (first_layer_temperature[0] - 25) : (filament_type[0] == "FLEX") ? 210 : (filament_type[0]=~/.*PET.*/) ? 175 : 170)} ; wait for temp

M84 E ; turn off E motor

G28 ; home all without mesh bed level

G1 X{rnd_x} Y-4 Z5 F4800; (Original G1 X42 Y-4 Z5 F4800)

M302 S160 ; lower cold extrusion limit to 160C

{if filament_type[initial_tool]=="FLEX"}

G1 E-4 F2400 ; retraction

{else}

G1 E-2 F2400 ; retraction

{endif}

M84 E ; turn off E motor

G29 P9 X10 Y-4 W32 H4

{if first_layer_bed_temperature[initial_tool]<=60}M106 S100{endif}

G0 Z40 F10000

M190 S[first_layer_bed_temperature] ; wait for bed temp

M107

;

; MBL

;

M84 E ; turn off E motor

G29 P1 ; invalidate mbl & probe print area

G29 P1 X0 Y0 W50 H20 C ; probe near purge place

G29 P3.2 ; interpolate mbl probes

G29 P3.13 ; extrapolate mbl outside probe area

G29 A ; activate mbl

; prepare for purge

M104 S{first_layer_temperature[0]}

G0 X{purge_x} Y-4 Z15 F4800 ; move away and ready for the purge

M109 S{first_layer_temperature[0]}

G92 E0

M569 S0 E ; set spreadcycle mode for extruder

;

; Extrude purge line

;

G92 E0 ; reset extruder position

G1 E{(filament_type[0] == "FLEX" ? 4 : 2)} F2400 ; deretraction after the initial one before nozzle cleaning

G0 E7 X{purge_x + 15} Z0.2 F500 ; purge

G0 X{purge_x + 25} E4 F500 ; purge

G0 X{purge_x + 35} E4 F650 ; purge

G0 X{purge_x + 45} E4 F800 ; purge

G0 X{purge_x + 48} Z0.05 F8000 ; wipe, move close to the bed

G0 X{purge_x + 51} Z0.2 F8000 ; wipe, move quickly away from the bed

G92 E0

M221 S100 ; set flow to 100%