Question regarding Custom G-Codes in the Slicer
 
Notifications
Clear all

Question regarding Custom G-Codes in the Slicer  

  RSS
Durahl
(@durahl)
Trusted Member
Question regarding Custom G-Codes in the Slicer

Greetings!

I've recently started to dabble a little more in my printers config files as well as the slicers more advanced settings and with that I've come across some questions - Mainly how custom G-Codes in the Print / Filament / Printer section of PrusaSlicer ( or as of recently SuperSlicer ) are being handled.

Having built a Voron 2.4 a few days ago I obviously had to widen my knowledge about printer config files ( pretty much nonexistent prior to that Voron 2.4 purchase and while using my trusty i3 MK3S MMU2S ) wherein I came across the various settings of that 3D Printer such as the acceleration settings which also can be found in the Slicer Print and Printer settings.

How exactly is the hierarchy of them to be understood as in which one takes precedence?

Say the Printer's Config File says it has max_velocity: 300 and max_accel: 10'000 but the Slicers Print Tab tells it to go with 500 / 20'000 will the printer hit those 500 / 20'000 or will it stick to the 300 / 10'000? And how do the Slicers Printer Tab Feed and Acceleration settings play a role in this? Just for Time estimation?

Same for a Custom G-Code setting I found in the Slicers Filament Tab that would change the pressure_advance setting with there already being one in the Printer's Config File - Will the Custom Filament G-Code temporarily overwrite the Hardware one? 🤔

Thanks in Advance! 😁

Posted : 02/09/2021 3:00 pm
bobstro
(@bobstro)
Illustrious Member
Last setting wins
Posted by: @durahl

[...] Say the Printer's Config File says it has max_velocity: 300 and max_accel: 10'000 but the Slicers Print Tab tells it to go with 500 / 20'000 will the printer hit those 500 / 20'000 or will it stick to the 300 / 10'000?

The settings under Printer Settings->Machine limits are meant to reflect your printer's actual capabilities. It's common to simply mirror your firmware defaults if they're good, or set reasonable limits here if you can't, for example, save firmware settings (e.g., no M500 support). There is a setting at the top of that screen to emit these settings to gcode. If enabled, M20x firmware commands matching these settings will be inserted near the top of the sliced gcode.

The settings under Print Settings->Speed give you more granular control of the speed and acceleration values calculated by the slicer during the print. These will be inserted as inline gcode M20x commands throughout the print.

You can also manually insert M20x commands (e.g., at layer changes).

With any of the M20x gcode commands, the last sent is the one the printer uses and they're persistent until reset or power cycled. There's not really a hierarchy as a flow of defaults:

  1. Settings embedded at the top of the print set in machine limits set defaults. If you don't set any other values, these are used throughout the print.
  2. Settings you specify under speeds override the defaults. The slicer sets and resets these as different features are printed (e.g., on transition from perimeter to infill). These are usually more restrictive than defaults if you're trying to improve print quality.
  3. Anything you insert manually in gcode is not seen (AFAIK) by the slicer. These will be overwritten once the slicer-generated code contains another adjustment.

Best practice -- at least as I see it -- is:

  1. Set good hardware limits for the printer in machine limts. Use those returned by M503 as a starting point. The more accurate these are, the more accurate your print time estimates will be. If you tune your firmware settings, might as well tune these as well.
  2. Set overrides under speed settings to improve print quality for specific features. Lower acceleration on perimters can help reduce ringing, for example.
  3. Avoid inserting overrides for M20x settings manually in gcode.

And how do the Slicers Printer Tab Feed and Acceleration settings play a role in this? Just for Time estimation?

For the Machine limits, they do issue actual settings if you turn on that option. Otherwise, yes they do tie into time estimation.

Same for a Custom G-Code setting I found in the Slicers Filament Tab that would change the pressure_advance setting with there already being one in the Printer's Config File - Will the Custom Filament G-Code temporarily overwrite the Hardware one? 🤔

Linear Advance is different. It's not one of the M20x hardware settings (speeds, acceleration, jerk). It is used by the printer firmware (and must be supported in the firmware) but doesn't change those basic hardware settings. It adjusts flow over the span of an extruded segment. To answer your question: It's completely independent in terms of settings. At least on Marlin, you can set a default value equivalent to an M900 Kxx gcode command, but it's often set to 0 (LA disabled). If you're not using Linear Advance, there are probably equivalent settings that work in equivalent ways.

 

My notes and disclaimers on 3D printing and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan...
Posted : 02/09/2021 3:30 pm
Durahl
(@durahl)
Trusted Member
Topic starter answered:
Hmm...

Not sure how I feel about Slicer Settings being able of overwriting a Machine set limit 🤔

So ideally:

  • I'd want to only have the Slicer Printer Tab know the Machine Limits but not committing them to code for the purpose of a good estimate.
  • Change any Slicer Print Tab Acceleration settings to 0 ( as in not overwriting the Printer Settings File ) except for highly specific ones like an External Perimeter.

Thanks for taking the time!

Posted : 02/09/2021 5:36 pm
bobstro
(@bobstro)
Illustrious Member
Nothing is overwritten, don't change any values you don't intend to
Posted by: @durahl

Not sure how I feel about Slicer Settings being able of overwriting a Machine set limit 🤔

Well... then don't do it! With a quality printer, the firmware settings are probably reasonable. Unfortunately, many cheap printers come with ridiculous firmware defaults that I think it's an important capability. I've seen firmware compiled without changing any of the Marlin source defaults. I'm sure those $160 printers are nice, but I doubt they're getting 9000mm/s acceleration. These are the same companies that disable thermal runaway safety checks "to reduce support tickets".

So ideally:

  • I'd want to only have the Slicer Printer Tab know the Machine Limits but not committing them to code for the purpose of a good estimate.

Then don't emit those values to gcode. You do want to enter them in for time estimation purposes. You can just copy over the values you get back from M503.

  • Change any Slicer Print Tab Acceleration settings to 0 ( as in not overwriting the Printer Settings File ) except for highly specific ones like an External Perimeter.

You usually want to use more restrictive numbers in print settings for print finish. If you only want to use your firmware settings, zero out the corresponding settings in the print settings speed panel.

Nothing generated in PrusaSlicer overwrites your firmware values. They are just adjusted temporarily. Reset the printer and your firmware settings are restored. Don't overwrite them in the first place and those are your defaults.

My notes and disclaimers on 3D printing and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan...
Posted : 02/09/2021 6:32 pm
Share: