Skip to content

About

Adds a configurable first-layer-only extrusion multiplier using custom parameters and G-code.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PrusaSlicer First Layer Flow

Small PrusaSlicer helper to apply extra flow on layer 1 only, then restore normal flow.

Quick Start (Recommended)

  1. In Printer Settings -> Custom G-code -> Start G-code, append contents of gcode/start.gcode.
  2. In Printer Settings -> Custom G-code -> Before layer change G-code, append contents of gcode/before-layer-change.gcode.
  3. In your active filament profile (Filament Settings -> Custom G-code -> Custom parameters), add:
{
  "first_layer_extrusion_multiplier": 1.02
}
  1. Slice and verify your output G-code contains:
  • ; FIRST_LAYER_FLOW_APPLY near start, followed by M221 S...
  • ; FIRST_LAYER_FLOW_RESET after first layer, followed by baseline M221 S...

Validate with Script

python3 scripts/validate-gcode.py /path/to/output.gcode --expect-first-layer 102 --expect-reset 100

For one-layer prints:

python3 scripts/validate-gcode.py /path/to/output.gcode --expect-first-layer 102 --expect-reset 100 --allow-missing-reset

Exit codes

code meaning
0 verified — the markers are present and the values are the expected ones
1 wrong — the markers are present and a value is not what was expected
2 could not tell — no FIRST_LAYER_FLOW_APPLY marker, so the feature never ran and nothing was validated
4 could not read the file named on the command line

2 is not a finding about the print. It means the custom G-code did not run at all, so the remedy is to check the printer profile's Custom G-code and re-slice — not to change a flow value. It exists because the validator used to report this case as 0: with the markers absent it fell back to "the first M221 in the file" and "the second", and M221 appears routinely in ordinary G-code, so an uninstalled feature could match by coincidence and pass.

Regression tests: ./scripts/test-validate-gcode.sh.

Behavior Contract

  • Custom parameter key: first_layer_extrusion_multiplier
  • Start logic: Parameter exists -> M221 S{custom * 100} Parameter missing -> M221 S{extrusion_multiplier * 100}
  • Before-layer-change logic: At layer_num == 1 -> restore baseline M221 S{extrusion_multiplier * 100}

Safe Patch Workflow (Optional)

If you prefer patching an exported config instead of manual copy/paste:

  1. In PrusaSlicer: File -> Export -> Export Config
  2. Run:
python3 scripts/patch-config.py --input /path/to/exported.ini --output /path/to/exported.patched.ini
  1. Import the patched file.

Advanced Artifacts (Optional)

Most users can ignore this section.

  • presets/vendor/FirstLayerFlow.ini + presets/vendor/FirstLayerFlow.idx Vendor-bundle style packaging with a generic Marlin baseline (250x210).
  • presets/simple/first-layer-flow-config.ini Minimal patch asset (start_gcode + before_layer_gcode only). Depending on import flow, direct import may replace active config state.

Compatibility and Scope

  • PrusaSlicer: >= 2.9.3
  • Uses official custom parameter placeholders introduced in 2.9.3
  • Assumes firmware supports M221 (Marlin/Klipper style)
  • v1 support target: single-extruder profiles

Troubleshooting

  • No apply marker in G-code: start snippet is not active on the current printer profile.
  • Apply value stays baseline: custom parameter JSON missing/invalid in the active filament profile.
  • Reset missing on multi-layer print: before-layer-change snippet missing/overridden.

Upstream References

About

Adds a configurable first-layer-only extrusion multiplier using custom parameters and G-code.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages