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

Cura 4.1, does not execute extruder end gcode at end of print #5861

Open
wookie666 opened this issue Jun 6, 2019 · 25 comments
Open

Cura 4.1, does not execute extruder end gcode at end of print #5861

wookie666 opened this issue Jun 6, 2019 · 25 comments
Labels
Status: Deferred We don't have time to work on this for now but intend to in the future. Type: Bug The code does not produce the intended behavior.

Comments

@wookie666
Copy link

Application Version
4.1
Platform
windows

Printer
custom fdm
Actual Results
extruder end gcode not placed at end of print
Expected results
end of print should be classified as end of extrder, and gcode should be implemented

Additional Information
This is my start and end gcode for head 1
image
This is my start and end gcode for head 2
image

I use a custom corexy printer with toolchange.
When i start a print, it needs to pickup whichever tool it is using, which works correctly.

When i end a print, it needs to put the tool away, but the extruder end gcode is not being implemented at the end of a print. I cannot use gcode end script, as i cant tell which tool is currently in the head, to know which tool can be put away.
In s3d, i could use placeholders like, if currenttool=0 or currenttool=1. but cura cant do this.

Basically. the extruder end gcode needs to be implemented at the end of a print as well as tool change to another tool

If i do a dual head print, the toolchange codes work fine, it will undock tool 0, print, dock tool 0, undock tool 1, print, dock tool 1, back to tool 0 etc. but just at the end, it will not dock whichever tool is in the head.
When i start a new print, i need it to pickup the new tool, which works fine, but the problem is, if it didn't dock tool 0 at the end of a print, if i start a new print with tool 1, it will try to pickup tool 1 with tool 0 still in the head.

@wookie666 wookie666 added the Type: Bug The code does not produce the intended behavior. label Jun 6, 2019
@rburema
Copy link
Member

rburema commented Jun 6, 2019

Hi @wookie666 ,

In s3d, i could use placeholders like, if currenttool=0 or currenttool=1. but cura cant do this.

You can do things like T{extruder_nr} (or more specific things like T{top_bottom_extruder_nr}) though, which will evaluate to T0, T1, etc.

@wookie666
Copy link
Author

wookie666 commented Jun 6, 2019 via email

@rburema
Copy link
Member

rburema commented Jun 6, 2019

Ah, I see the problem now, you'd need different paths for different tools.

I'll discuss this with the others.

@wookie666
Copy link
Author

wookie666 commented Jun 6, 2019 via email

@Block137
Copy link

Block137 commented Jun 6, 2019

I'm also looking forward to this
Also this person at #4909

@Ghostkeeper
Copy link
Collaborator

One step further, you could also use {machine_extruder_start_pos_x} and {machine_extruder_start_pos_y} to move to the correct location in the end g-code.

@Ghostkeeper
Copy link
Collaborator

We've discussed this in the team but decided that it's too much work for too little gain. The printers where this is necessary are rare, and we can't develop GUI elements for all minutiae without overloading users. Maybe we'll think of a solution some day, but we'll defer this for later work.

@Ghostkeeper Ghostkeeper added the Status: Deferred We don't have time to work on this for now but intend to in the future. label Jun 7, 2019
@wookie666
Copy link
Author

wookie666 commented Jun 7, 2019 via email

@Ghostkeeper
Copy link
Collaborator

You can't put a simple toggle to include the tool end gcode at the end of a print or not because it will overload users?

No, I said it's too much work for too little gain and that the printers where this is necessary are rare.

I said that developing GUI elements for all minutiae [of printer configuration] would overload users. I understand that you think that your minutia is important, so if you'd like to do some of the work towards a solution, we'd love to see it. Otherwise you'll have to resort to modifying the configuration files manually in order to perform your if statements.

Note that the front-end doesn't currently know which extruder the print ends with. If you're going to implement this, it'll need a change in CuraEngine as well to send that over.

@Block137
Copy link

Is there a reason why "Extruder End G-code" is not executed at the end?

I see no harm executing it at the end of every print, even on single extruder machines (they can be left blank).

IMO No need to make any GUI or user options, just always execute it.

@wookie666
Copy link
Author

wookie666 commented Jun 10, 2019 via email

@Ghostkeeper
Copy link
Collaborator

Ghostkeeper commented Jun 10, 2019

Some printers need to do something with the extruder just before switching away from it that doesn't necessarily need to happen at the end of a print. Stuff like parking a print head, moving to a switching bay, wiping off the nozzle on a brush, etc.

If we were to force the extruder end g-code to happen always at the end of a print, it breaks the behaviour for those printers. We figured that if it's really necessary you could always put some g-code at the end g-code field or even just {machine_extruder_end_code,0}\n{machine_extruder_end_code,1}.

@wookie666
Copy link
Author

wookie666 commented Jun 10, 2019 via email

@Ghostkeeper
Copy link
Collaborator

If it doesn't hurt to happen at the end, you might as well paste the end g-code for all extruders in your printer's global end g-code (through the bracket syntax as above, or just copy-pasting the actual g-code). For some printers it does hurt.

@wookie666
Copy link
Author

wookie666 commented Jun 11, 2019 via email

@rburema
Copy link
Member

rburema commented Jun 11, 2019

What @Ghostkeeper meant is then just park each extruder at the end, so even when you only use the first extruder, also park the seconde one (in addition to the first), even if you don't use it. You can do that by adding in the overall end code {machine_extruder_end_code,0}\n{machine_extruder_end_code,1} (or more if you have more extruders). This is also something you could add to the configuration.

If adding (an) extra extruder move(s) at the end doesn't hurt other people (as you say), then why would it suddenly hurt in your case?

Sorry, I know it must be very frustrating on your end, but please consider this:
Yes it's small, but you're not the only one asking for a change to that menu. And it would eventually look like a parody of itself. Yes it's small, but we literally have at least 1000 small(er) things that we could do that people are at least as passionate about. And every one (or nearly so) of those changes has to go through review, component test, QA and sometimes system testing. Because it will break something else (and maybe that something is someone elses printer...)

@Ghostkeeper
Copy link
Collaborator

I do think I've understood what you're asking. You're just asking a whole slew of different things. Here are some requests that I can gather from this thread and their answers:

end of print should be classified as end of extrder, and gcode should be implemented

No, it should not be put the extruder end g-code at the end of the print. That is the current expected behaviour.

Can I use if statements?

Yes, but only when writing the .def.json file. Not from the interface.

How would I write a statement if t0 then run this code and if T1 then run this code.

You currently can't, because the front-end doesn't know what extruder the print is going to end with. So even if you are writing the .def.json files with if statements, there is nothing your if statement can check on.

Maybe even just a tickbox to be able to run the active tools end script at the end of a print. That way it can be turned on or off. It will solve the problem

That is a valid feature request, but we've deferred this because the use case is rare. We may implement it some day if we find that the priority increases. Or we may accept changes by someone else if that reduces the workload on the developers.

Is there a reason why "Extruder End G-code" is not executed at the end?

Yes. Some printers break when an extruder end g-code is executed at the end of the print, for the same reason as when your printer breaks when all extruder end g-codes are executed.

@wookie666
Copy link
Author

wookie666 commented Jun 11, 2019 via email

@wookie666
Copy link
Author

wookie666 commented Jun 11, 2019 via email

@Ghostkeeper
Copy link
Collaborator

Basically, you'r saying that its too difficult to add a damn tick box, which would solve every issue

Adding a checkbox is not a problem. Adding a checkbox that has a certain functionality is, because it's work that we don't have time for and don't give high priority because of the limited use case. If you think it is simple, be my guest and show us what simple solution you can come up with. We're normally not against merging that sort of feature into the mainline Cura.

@Block137
Copy link

Block137 commented Jun 11, 2019

I'm also using Smoothie, I made an executable python program which scan every .gcode files in the folder and add docking sequence accordingly.
I'll try to make it easy to understand and share it if you want.

To devs: E3D tool changer will start shipping within 2 months (according to E3D website). This printer has 4 tools. Expect a wave of requests similar to this one in the near future.

https://e3d-online.com/blog/2019/04/18/toolchanger-the-update-youve-all-been-waiting-for/

TLDR: We’ve reached design lock, production parts have been ordered and we aim to start shipping the first batch of machines in late July.

@golfromeo-fr
Copy link

golfromeo-fr commented Sep 24, 2019

it is not because some do crap things that you should keep doing the same mistake again and again.
Please fix this issue because you are leaving the gcode in an inconsistant state. You put "begin" and then no "end"

@golfromeo-fr
Copy link

golfromeo-fr commented Sep 27, 2019

putting the following line in "END G-code" seems to work fine.
{machine_extruder_end_code, extruder_nr}

where can (I/we) document this? where is the place to put this useful code please?

if I filter the final part of the gcode to show the load/unload of tools, the last tool is unloaded as expected

Line 48811: ;BEGIN LOAD FILAMENT T0
Line 48819: ;*** BEGIN LOAD FILAMENT T0
Line 50462: ;BEGIN UNLOAD FILAMENT T0
Line 50477: ;*** BEGIN UNLOAD FILAMENT T0
Line 50480: ;BEGIN LOAD FILAMENT T1
Line 50488: ;*** BEGIN LOAD FILAMENT T1
Line 866861: ;BEGIN UNLOAD FILAMENT T1
Line 866876: ;*** BEGIN UNLOAD FILAMENT T1

@The--Captain
Copy link

Sad to see this is still a thing.

Devs defending broken code is even more unfortunate. golfromeo-fr is correct. To execute the begin code and not the end code leaves the gcode in an inconsistent state.

Did Ultimaker manufacture a printer that expects this broken behavior, that they are so unwilling to fix the code to work properly?

I appreciate there is a workaround, but it frankly should be the default.

@luckybooger215
Copy link

luckybooger215 commented Feb 19, 2023

Anyone find a better way of doing this yet? I have an infinite color changer that of course works much differently than your tool changer does but it has the same issue where the end of extruder Gcode is not executed after the end of the print. This ends up with the last color of the print being still fed into the extruder which when a new print in a different color is started it feeds the filament into the already full tube. Everything Wookie said is right about it should be just a "Apply End of Currently Operated Extruder Gcode to end of print Gcode", as it is in the long run the easiest solution that can apply to the most printers. You cannot apply the end Gcode of all extruders as it will end up in the feeding system of filament pulling the different colors except the one you were just using way too far back which will mess up the next print. I don't understand what Ghostkeeper was saying to Golfromeo-fr in their thread Golf mentioned above because he comes an inch away from stating the solution to his own problem. All you need is for the Gcode that Applies to the extruder to be in the end of extruder Gcode and the Gcode that applies to chamber, bed, cooling, etc to be in the global end of Gcode. This would make having a checkbox for it almost unnecessary as there would be no reason to disable it as long as it is only the current extruder that applies to the end of the print. This also aligns completely with what golf said that you should not have a beginning code for your extruder ever without an end for the same extruder, most people get away with it because single material is all they have but the point of this message is to illustrate that now is the time to adapt to printers with potentially infinite colors.

Edit: Just discovered and enabled G60 and G61 to remember position so global end Gcode works just fine. Good thing Gcode has that, otherwise cura would've just brought my hope for automated color printing to a halt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Deferred We don't have time to work on this for now but intend to in the future. Type: Bug The code does not produce the intended behavior.
Projects
None yet
Development

No branches or pull requests

7 participants