Apps About

PrusaSlicer: Custom First Layer Extrusion Multiplier

Having the ability to run a higher extrusion multiplier on the first layer can be handy for getting a better finish. I print a lot of PETG on the textured plate and a higher multiplier helps ensure the first layer flows out nice and doesn’t leave any tiny holes or outlines between lines.

This isn’t something PrusaSlicer supports out of the box but you can add support for it via the new custom parameters feature that were added in PrusaSlicer 2.9.3 and a bit of G-code.

Setting Up The Filament Profile Custom Parameter

Filament profiles have a new Custom parameters option available in the Custom G-code section that accepts JSON and we’re gonna define a new firstLayerExtrusion parameter.

Example:

{
  "first_layer_extrusion_multiplier": 1.02
}

The value will work similar to the default extrusion multiplier where 1.02 would translate to 102%.

Adding the Custom G-Code

Over in Printers -> Custom G-Code we’ll add some custom code in the Start G-code, and Before layer change G-code sections.

Scroll down to the bottom of Start G-Code and add the following:

{if !is_nil(custom_parameter_filament_first_layer_extrusion_multiplier[current_extruder]) }
;
; Custom First Layer Extrusion Multiplier
;
M221 S{(100 * custom_parameter_filament_first_layer_extrusion_multiplier[current_extruder])}
{endif}

This new snippet of code will first check if the filament profile has a custom parameter for firstLayerExtrusionMultiplier set, and if so it’ll run M221 which sets the extrude factor override percentage.

(We have to do this in the start g code because the before layer change g code doesn’t run until after finishing the first layer.)

Next up, over in Before layer change G-code add the following to the end:

{if (!is_nil(custom_parameter_filament_first_layer_extrusion_multiplier[current_extruder]) and layer_num == 1) }
;
; Restore Extrusion Multiplier
;
M221 S{100 * extrusion_multiplier[current_extruder]}
{endif}

This bit will check if the filament profile being used has a firstLayerExtrusionMultiplier set, and also if the printer has just finished the first layer and if so, it’ll reset the extrude factor override back to the regular extrusion multiplier of the profile.

That’s it! Next time you slice an object using your filament profile it’ll have the new custom first layer extrusion multiplier all set up.

Testing If It Works

Ensure your filament profile has a custom first layer extrusion multiplier.

Slice an object and save off the file so you can open it in the G-Code Viewer. Within the G-Code viewer navigate to the very beginning of the first layer and look for a “Custom First Layer Extrusion Multiplier” comment.

Beneath the comment there should be an M221 command with a S value that matches your custom parameter * 100. For my profile I had a first layer multiplier of 1.02 set so 102 is expected.

Now jump to the end of the first layer and look for a “Restore Extrusion Multiplier” comment.

It should have a similar M221 command with a S values that matches the extrusion multiplier of the filament profile * 100. In my case I had it set to 1.0 so I got M221 S100