mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-05-09 05:35:30 +02:00
[GH-ISSUE #422] [Feature]: Add Auto-Print GCODE Injections #264
Labels
No labels
A1
automated
automated
bug
bug
Closed due to inactivity
contrib
dependencies
dependencies
duplicate
enhancement
feedback
hold
invalid
Notes
P1S
pull-request
security
security
ThumbsUp
user-report
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/bambuddy#264
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @piatho-1 on GitHub (Feb 17, 2026).
Original GitHub issue: https://github.com/maziggy/bambuddy/issues/422
Originally assigned to: @maziggy on GitHub.
Problem or Use Case
There are various 3rd party solutions on the market that allow to automate printing by adding certain G-Code that 1) allow the print bed to be loosen
2) cool down
2) allow the print head to act as a pushed
3) blocks zones of the print bed that have to stay clear.
Providers known are: Farmloop, Swapmod, AutoClear, Printflow 3d
Proposed Solution
When uploading a file or when assigning to a queue, i would propose to add a setting to activate/deactivate autoprint. If activated, some further settings shall become available. Eg Auto-Restart: yes/no, Cooldown yes/no, Type of print automatization.
Based on the settings some templates shall be shown to the user in a Code editor UI. Users shall be allowed to edit
Finally, GCODE of the file shall be updated with the additional G-CODE
Alternatives Considered
No response
Feature Category
File Manager
Priority
Would improve my workflow
Mockups or Examples
See https://simplyprint.io/features/autoprint for some inspiration
Contribution
Checklist
@maziggy commented on GitHub (Feb 20, 2026):
Before we commit to building this, I'd like to gauge community interest. If you'd find this feature useful, please give this issue a thumbs up (👍) reaction so we can prioritize accordingly.
@maziggy commented on GitHub (Mar 16, 2026):
From my point of view, the GCODE injections should be done on the queue and not the printers page. It's dealing with automated printing and not with manual prints.
What's about:
Does that makes sense?
@piatho commented on GitHub (Mar 19, 2026):
I lost a bit focus here, but i do agree that this feature makes sense on the queue since it helps automating the process of auto-starting new prints if previous prints are completed.
If we add the feature to the print queue it should allow the following
Bonus:
@maziggy commented on GitHub (Mar 19, 2026):
Got it.
@maziggy commented on GitHub (Apr 5, 2026):
Available/Fixed in branch dev and available with the next release or daily build.
Docs -> https://wiki.bambuddy.cool/features/print-queue/?h=g+code#auto-print-g-code-injection
Unfortunately I'm currently not able to test. May I ask you please to give it a try and let me know if it's working for you?
@pleite commented on GitHub (Apr 5, 2026):
I can test and let you know in a couple of days.
There is a caveat, most injection code should not be at the start and end of the original gcode, there is a specific location after print initialization that would make sense and in the end of print it's quite dependent on the code intention.
As most systems allow the code to be injected by the slicer, validation of the code presence would also be required.
I couldn't read on the docs what happens to make the next print be started without manual intervention, what is the expectation of the feature?
On queuing, the injection usually needs to be at all plates, for example the start code may load a plate if not yet loaded, can't start only on second print. For the choice of plates allowing to select quantities of each would also make sense, being able to reorder or cancel later.
I'm not a fan of the injection here, as the tool has no slicer, but rather have the proper machine code on the gcode file.
In order to solve remotely problems that may rise when cancelling prints, executing the start or end code on demand would be beneficial. As such, having the code snippets as part of a library and choosing those and allowing separate execution would be very helpful. For example allowing a Z screw movement pattern to lube
@maziggy commented on GitHub (Apr 15, 2026):
Still waiting for feedback from you guys.
@pleite commented on GitHub (Apr 15, 2026):
It's not easy testing and checking the output.
The end code works for my Swapmod. Combined with the not asking to clear the plate. The start code on my case is not working correctly as it's placed before the printer startup.
Technically your code is correct.
@maziggy commented on GitHub (Apr 16, 2026):
What's the correct position?
@maziggy commented on GitHub (Apr 19, 2026):
?
@maziggy commented on GitHub (Apr 22, 2026):
@piatho-1 ?
@piatho commented on GitHub (Apr 22, 2026):
I am currently not using autoprint on my farm since my current print models do not reliable loosen from the plate. I thus cannot test at the moment
@DevScarabyte commented on GitHub (Apr 27, 2026):
I have been playing around and doing some testing with my gcode that sets the ending height based off the z layer of the print. In the slicer it sets this value once exporting the sliced file. When using the injected gcode it does not seem to use the max_layer_z or max_print_height values.
Using this snippet at the end code to see how its handled then printed a 30mm and 60mm tall cube. Both ended up at Z1 at the top. Setting a printer end code for the same printer that could be printing different heights can cause issues with the print either being directly at the bottom or top for cooling the plate or pushing the top glass+AMS up due to it being to high up. The sweeping to push the print off the bed can also cause damage as the print will be at Z1 instead of whatever Z you set it for.
max_layer_z can be found in the header section of the gcode file being edited could be used to modify the injected gcode before committing to the 3mf. Example of mine included at the bottom.
Prusa has a list of some that can be used.
@DevScarabyte commented on GitHub (Apr 27, 2026):
In my gcode after slicing this is the line directly after the printer start code.
; MACHINE_START_GCODE_ENDWould probably inject the code right before this as this starts the filament gcode then printing gcode from what I can tell.
@maziggy commented on GitHub (Apr 27, 2026):
You were right — it was being prepended to the whole plate_X.gcode, so it ran before the printer's own bed heat / homing / nozzle prime. It now anchors at ; MACHINE_START_GCODE_END (exactly the line @DevScarabyte called out), so the snippet lands where a slicer-side custom-start-gcode would. Older files without that marker keep the prepend behaviour as a fallback with a warning log.
This was the safety-relevant one — G1 Z{max_layer_z} was being sent verbatim, the firmware parsed it as Z1, and the head crashed into tall prints. Snippets now go through a placeholder pass that reads the values from the 3MF's ; HEADER_BLOCK_START..END block before injection. Supported placeholders:
Unknown placeholders are left in the snippet verbatim with a warning log — a typo never silently expands to an empty string.
Wiki page updated with the placeholder list and a safety callout for {max_layer_z}: https://wiki.bambuddy.cool/features/print-queue/#placeholders
Available/Fixed in branch dev and available with the next release or daily build. Please let me know if it works for you now.
@DevScarabyte commented on GitHub (Apr 29, 2026):
Tested the end code and it worked perfectly. Don't currently have anything for the custom start code to test.
@maziggy commented on GitHub (Apr 29, 2026):
If you find Bambuddy useful, please consider giving it a ⭐ on GitHub — it helps others discover the project!