-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Print from layer #1197
Print from layer #1197
Conversation
Implement resuming a print from a user selected layer. There is no requirement that the print has been paused or started in the current pronterface session. The command is accessed through menu Advanced -> Print from layer. The layer selection is done with the slider in the standalone 3D view window, which is opened on double click in the embeded 3D viewer. The printer is initialized by filtering some commands in the skipped lines. The last (top) visible layer in the stanalone 3D viewer will be printed, so you have to slide to the lower layer to compare visually the printed object with the 3D visualization and then slide up to select the to be printed layer. The Z value in the 3D viewer status should be the same as the first sent gcode commands. The layer numbering in this commit does not coincide with the gcode comments, fixed in the next commit. The starting commands are shown for confirmation. The code is not tested on real printer, just with ./testtools/mock-printer.
The layer numbers shown in the standalone 3D view now match the numbering in Slic3r 1.3.0, Cura_SteamEngine 4.6.1 gcode comments. Gcode comments start with layer 0 and the first command in the layer is G1 Z... The printrun parser layer 0 starts at line 0 with whatever content. Layer numbering may be consistent or not depending on slicer, retraction, Z hop, etc.
@VanessaE can you try this out and see if it works for you? |
I started a print, then after a while, I killed it by unplugging USB (this seemed like the best way and the most likely use-case for this feature i.e. a connection failure). Naturally, Pronterface didn't like that, but it didn't blow up. 😁 I reconnected, jogged the nozzle off the print, then went to Advanced -> Print From Layer. The program popped up a mini 3D view asking me to select a layer to resume from. I clicked around and adjusted the view until it was set for where I killed the print, then closed the dialog with the window manager's I was then left in the usual Pronterface display with the printer still idle -- that is to say, the mini 3D view dialog seemed to do nothing useful... yet. I then tried to go back in there to double-check things, but this time, instead of showing me the mini 3D view, the program popped up a confirmation dialog asking me if the new start commands are correct. If I click OK on that confirmation dialog, it begins printing. If I click Cancel, it simply closes that dialog (though I wasn't expecting anything else). The print did resume from the proper point. There was a slight artifact at the resume point, but nothing that anyone would complain about, and most likely the result of the nozzle running over a small blob that was left on the print from when I initially stopped it. My impressions:
Here's the file I was testing with: BookCover_WithSeam.stl.zip And here's the g-code, generated by Slic3r (SuperSlicer): BookCover_WithSeam.gcode.zip Notes: I I am using Debian 11.0, desktop environment is XFCE 4.16. |
I have to say, this is the best test report I've ever seen. Thanks @VanessaE this is gold! |
@VanessaE , thank you for your time.
When I coded the "Print from layer" disconnect was not the main scenario. For disconnect the other menu entry "Recover" should be used. I don't know whether it works.
You do not have to close it. The standalone view is an old feature and is opened with double click.
The standalone 3D view utility is to provide the slider. I understand that guiding the user with wizard like experience may be a good thing, but I did not want to change too much the current state without having it first discussed, b/c this risks that the PR is rejected. Because there are less assumptions, the user is having the lead.
Stand alone viewer is not dedicated to "Print from layer". Probably this is like GIMP - you have many tools, but it is up to you how you use them.
Yes, it is not obvious, you have to double click the embedded view - old feature.
I had one assumption though, and it is that the resume is just skipping some lines from the original file. The assumption is if G28 is needed in the resume, then it is needed in the file, thus delegating responsibility to the file creator. I think 'Resuming is skipping' is a good contract. Short and clear, who reads contracts anyway. The other ideas are probably good too, it's hard for me to evaluate how much they will be used - this PR did not get much attention for 2 months. Not much compared with the exactly 8 years from issue to PR :) |
I wasn't aware that feature existed at all. I didn't even notice the menu item until this print-from-layer feature came up (I rarely use the menu at all).
Fair enough, but the user isn't asking for the standalone view, they're asking for the print-from-layer feature, and if I'm being a little blunt, they aren't going to care what the dialog they're presented with was originally used for, let alone how else it can be called-forth. Maybe you could make the "Print from layer" menu item always show the standalone view (and never the confirm dialog), and add the "Okay" button only if that's how the dialog was summoned (omitting it otherwise). I mean, the user still needs to be presented with the confirm dialog at some point, so that they can actually start the print, and the most obvious way to get it would be an "Okay" button in the standalone view. Besides all of that, most people don't have the screen space to leave random dialogs open without either burying or minimizing them -- I assume most makers control their printer via a laptop or a common PC with only a single, moderately-sized monitor.
I'm suggesting that Pronterface is erroneously omitting them. The g-code file I provided has both commands, but neither was present in the g-code shown in the confirm dialog. If the printer's motors have powered down due to idle timeout (default 2 minutes on Marlin, iirc), then when the time comes to resume, the motors' positions can't be guaranteed, so the printer will have to home X/Y before resuming the print. If it has to home, there's good chance that bed leveling will get turned off. That's firmware-dependent of course, but I know for sure that at least a full X/Y/Z home turns off bed leveling on my printers (I've never checked if X/Y-only homing does so also). Or, consider the situation where, for whatever reason, the user has paused the print, turned the printer off, and pushed the nozzle off to one side by hand (to get it away from the print), with intent to continue the print later. On power-up, the printer will have no idea where it is, and bed leveling will definitely be turned off at that point. So, if the file contains a If the file doesn't have it, you can assume the user has some weird setup 😁 that they home manually prior to printing, and/or that won't lose position between sessions. |
I see you insist on a wizard like, stateful experience. I do not like wizards, they are too linear, constraining and require additional coding 😁 . Let's first make the feature usable by experts, and then by newbies if ever.
After rethinking several times I would agree that adding a button to 3d viewer (if invoked from "Print from layer") is a good trade off between effort and utility. Indeed, the layer is the most critical parameter of the feature, so it makes sense that 3D viewer is the central control that starts the print. The button should not read "Okay", but "Print from layer". But I consider this lower prio, UI enhancement.
Ok, today I tested it. What should the sequence be? G0 <layer_z>; G28 O L X Y ? @kliment I would like to see your thoughts also about the UI and commands. |
"Wizard-like"? definitely not. I hate wizards, they make too many assumptions that don't always work out (or which I end up having to override later anyways). (I have no love for warlocks, sorcerers, or magicians either 😛). My suggestion is linear, sure, but what other logical way is there to go here? Starting with a print that's stopped, the user selects "print from layer", sets a start position in the standalone view, clicks "Okay" (twice), and off it goes printing.
I would suggest raising the Z position by a few millimeters before homing X/Y. If you don't raise, then the nozzle may scrape across the print. My printer's firmware automatically does this (for the purpose of avoiding the Z probe potentially hitting something), but others might not.
I just checked, and for me at least, In any case, the firmware produces no console output regarding what axes were homed or skipped, and I think those extra flags would be too firmware-dependent to rely on.
No idea there. The firmware clearly shows this on the printer's LCD (by alternating between a bogus coordinate and "?"), but I don't know if there's any generic way to get that info from the printer. I checked You could send
Offhand I would say On my particular firmware build,
That reminds me, I forgot until just now to mention this: you also need to find and re-use the last fan control ( |
I have not visited github for nearly 6 month. And i am impressed! My problem with the printer where no disconnects, but:
|
@andreaskielkopf , |
Implements #383
Not tested on real printer. Please post feedback
See individual comments
@andreaskielkopf , @kliment ?