Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to modify start and end g-code #741

Open
anghelos opened this issue Mar 5, 2024 · 7 comments
Open

Ability to modify start and end g-code #741

anghelos opened this issue Mar 5, 2024 · 7 comments

Comments

@anghelos
Copy link

anghelos commented Mar 5, 2024

Describe the solution you'd like
It would be very useful to be able to modify the start and end g-code that Makelangelo software generates.

While we can add user g-code to the plotter settings, this is just added to the existing code; we can't modify what Makelangelo adds after.

For example, I'd like my plotter to first do a G28, then go to a specific point before asking to insert the pen. With the current state of things, even if I add all that in the start g-code, it will do a G28 all over again right after.

@i-make-robots
Copy link
Contributor

Saving a bunch of extra gcode lines to app Preferences isn't hard. Putting them in the right spot for every user sounds like a challenge.

How do you envision the interface? Please describe how you get to the editor that lets you make this change. Why is it better to do it in the app than, say, a text editor after exporting to gcode?

Do you know of an app that already handles this well? Got a screenshot or video example? We can copy what they do.

@anghelos
Copy link
Author

anghelos commented Mar 6, 2024

How do you envision the interface? Please describe how you get to the editor that lets you make this change.

I think the easiest would be to keep the existing custom G-code interface, but to have it pre-filled with the default g-code (and have this be the only start and end g-code). A "Restore default g-code" button might also be useful.

Why is it better to do it in the app than, say, a text editor after exporting to gcode?

Modifying the g-code in a text editor isn't very user-friendly. I manage a school's makerspace, and would like the experience to be plug-and-play for students, with the polargraph already pre-configured for them.

Do you know of an app that already handles this well? Got a screenshot or video example? We can copy what they do.

PrusaSlicer uses a similar approach to the one I mentioned above. The interesting thing they do is that they have some predefined variables, and allow some if statements, among other things, but that's outside of the scope of this issue. Here's a screenshot with a non-modified printer:
image

Edit: Just to give a better example, in your case, the Custom G-code window would look like this in a non-modified polargraph preset:

image

@i-make-robots
Copy link
Contributor

i-make-robots commented Mar 6, 2024

src/main/java/com/marginallyclever/makelangelo/makeart/io/SaveGCode.java#208

The only line that could easily be added to custom gcode is the home command. The color changes are considered steps in the path walked by the turtle.

out.write(MarlinPlotterPanel.getPenUpString(settings) + "\n");
out.write(MarlinPlotterPanel.getToolChangeString(m.getColor().hashCode()) + "\n");

Maybe a new custom could be added between pen up and change color? Good chance it would break some of the unit tests.

@anghelos
Copy link
Author

anghelos commented Mar 6, 2024

The color changes are considered steps in the path walked by the turtle.

Yes, I realized that after I replied yesterday. I also though that going to 0.0 was part of the start sequence, but I'm realizing now that it was my drawing that started from the center.

Honestly, the G28 after the custom G-code is the main thing that I'd like to change. And I'm realizing now that I can probably get around that by using XY_AFTER_HOMING in the Marlin firmware instead. Soooo... very low priority on this one? :)

@i-make-robots
Copy link
Contributor

Well... I'm AFK from march 7-18. If someone does it before me? Cool.

@i-make-robots
Copy link
Contributor

Also thank you for submitting such a great feature request with details and everything.

@i-make-robots
Copy link
Contributor

7.57.1 committed just now lets you adjust the home gcode. leave it blank to do nothing.
Settings > Plotter settings > Custom GCode > Home Gcode is where you'll find the value.

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

No branches or pull requests

2 participants