Skip to content

Instantly share code, notes, and snippets.

@Yardboy
Last active April 11, 2023 16:50
Show Gist options
  • Save Yardboy/511027972af259a44eb4f1e867eb67d6 to your computer and use it in GitHub Desktop.
Save Yardboy/511027972af259a44eb4f1e867eb67d6 to your computer and use it in GitHub Desktop.
Create a custom post processing filament change script to workaround Creality latest Sonic Pad firmware

Intro

Creality's latest Sonic Pad update, v1.0.6.46.25, includes an internal M600 macro for a filament change, which will conflict with any custom M600 macro the user has included in their config. As such, the user is forced to remove their own M600 macro, if they have one, due to the conflict. Because the Creality macro is not accessible to the user, it cannot be tweaked. And, to make matters worse, it has a bug related to max extrusion distance, so you cannot successfully print a model with a filament change with this update installed.

The below workaround shows you how to go back to using your own M600 macro by renaming it, and how to create a modified Cura Filament Change post processing script to insert this new macro instead of M600.

UPDATE SONIC PAD CONFIGURATION

In your Sonic Pad printer.cfg, add your own M600 macro back in, but name it CUSTOM_FILAMENT_CHANGE:

gcode_macro CUSTOM_FILAMENT_CHANGE]

At this point, you can take any previously sliced file with one or more M600 calls in it and just search-and-replace M600 with CUSTOM_FILAMENT_CHANGE and everything will work as before the update.

If you want to make it so that Cura will post-processing will use the new macro going forward, continue on.

CREATE CUSTOM FILAMENT CHANGE POST-PROCESSING SCRIPT

Note: I'm on Windows 11 and Cura 5.1.1. Adjust file locations to suit your platform and version, should work just the same.

  1. Navigate to C:\Program Files\Ultimaker Cura 5.1.1\share\cura\plugins\PostProcessingPlugin\scripts.

  2. Create a copy of the FilamentChange.py file somewhere you can edit it and name it CustomFilamentChange.py.

  3. In a text editor, make these changes to CustomFilamentChange.py:

Line 12:
  class FilamentChange(Script):
Change it to:
  class CustomFilamentChange(Script):
Line 21:
  "name": "Filament Change",
Change it to:
  "name": "Custom Filament Change",
Line 22:
  "name": "FilamentChange",
Change it to:
  "name": "CustomFilamentChange",
Line 145:
  color_change = "M600"
Change it to
  color_change = "CUSTOM_FILAMENT_CHANGE"
Line 166:
  color_change = color_change + " ; Generated by FilamentChange plugin\n"
Change it to
  color_change = color_change + " ; Generated by CustomFilamentChange plugin\n"

Note: I'm pretty sure that only the line 145 change is mandatory for this change, but the others serve to clearly delineate this script from the original.

  1. Move CustomFilamentChange.py back into C:\Program Files\Ultimaker Cura 5.1.1\share\cura\plugins\PostProcessingPlugin\scripts.

  2. Quit and restart Cura

USE NEW POST-PROCESSING SCRIPT IN CURA

In the Cura Post Processing Plugin, when adding a script there will now be a Custom Filament Change option. Use that instead of the regular Filament Change one.

Now go slice and print your filament-change model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment