Skip to content

pedrolamas/klipper-preprocessor

Repository files navigation

Klipper Preprocessor script for Cura

Project Maintenance License

Follow pedrolamas on Twitter Follow pedrolamas on Mastodon

Klipper Preprocessor is a Cura Post Processing Script to improve the output G-Code for Klipper usage.

Currently it allows the following improvements:

  • Add SET_PRINT_STATS_INFO so that Klipper can know what is the exact total layer count, and the current layer number in real-time.
  • Add TIMELAPSE_TAKE_FRAME so that Klipper together with moonraker-timelapse can take snapshots on each layer change to make timelapse videos.
  • Run preprocess_cancellation tool to add object cancellation data to the resulting G-Code, enabling Klipper to cancel any specific single object while printing.
  • Run klipper_estimator to add a more accurate time estimation to the resulting G-Code.

Klipper Preprocessor script for Cura

Initial setup

  1. Open Cura
  2. Open the "Help" menu and click "Show Configuration Folder"
  3. On the file list, open the "scripts" folder
  4. Download KlipperPreprocessor.py to the "scripts" folder
  5. Close the file list
  6. Close Cura
  7. (optional) Download preprocess_cancellation to a folder of your choice
  8. (optional) Download klipper_estimator to a folder of your choice
  9. Open Cura
  10. Open the "Extensions" menu, then "Post Processing", and click on "Modify G-Code"
  11. Click on "Add a script" and select "Klipper Preprocessor"
  12. Set options acording to your needs (hover any option to view the description)
  13. Click "Close" when ready

Recommended Cura settings for Klipper

Klipper documentation includes some generic slicer recommended settings that must be followed.

Below are some other settings that will improve your Cura slicing results while using Klipper.

Disable Jerk

Klipper does not support Jerk and instead relies on square_corner_velocity.

Is is recommended to untick the "Enable Jerk Control" option in the "Speed" section in Cura.

Adding extra metadata for Moonraker

Moonraker actively reads metadata from all sliced files, but there is some missing data in Cura sliced files.

To make sure you get all possible metadata on these files, add this to the top of your "Start G-code" in Cura, before any other instructions:

;Nozzle diameter = {machine_nozzle_size}
;Filament type = {material_type}
;Filament name = {material_name}
;Filament weight = {filament_weight}
; M190 S{material_bed_temperature_layer_0}
; M109 S{material_print_temperature_layer_0}

These lines are marked as comments, so they have no impact on the g-code, but Moonraker will still be able to find and use those values.

Improving Cura print time estimations

The default printer (machine) profiles in Cura have fixed values for max-acceleration and max-speed, so when we set values above those defaults while slicing a file, Cura will ignore when estimating the printing time and use the default ones instead, so the estimation will be off.

To fix this, follow these steps:

  1. Open Cura
  2. Click on the "Marketplace" button on the top right of the window
  3. On the Plugins list, select the "Printer Settings"
  4. Click "Install"
  5. Restart Cura
  6. On the "Print settings" flyout, there should now be a new section called "Printer Settings" (you might need to ensure they are visible by clicking the "hamburger" menu on the top right and selecting "All")
  7. Expand that section and change the "Maximum Speed..." and "Maximum Acceleration..." fields to match the values you are using in your Klipper configuration

FAQ

Why am I seeing "Unknown Command M205" while printing?

That will be because you have jerk enabled in Cura. You can safely disable jerk to fix it.

What is the "NOMESH" object that shows on my prints?

Cura 5.3.0 was released with a known bug that causes the identification of a "NOMESH" object.

This bug was fixed in Cura 5.3.1, so all you need to do is update to a more recent version.

I get some strange artifacts on the outer walls of my prints

Cura 5.3.0 was released with a known bug that causes some print quality issues.

This bug was fixed in Cura 5.4.0, so all you need to do is update to a more recent version.

Support my work

A lot of time and effort goes into the development of this and other open-source projects.

If you find this project valuable, please consider supporting my work by making a donation.

Donate on Paypal Buy me a coffee Support me on Patreon Sponsor me on GitHub

Thank you for your generosity and support! 🙏

Credits and Acknowledgements

License

MIT