Ultimaker / Cura

3D printer / slicing GUI built on top of the Uranium framework
GNU Lesser General Public License v3.0
6.2k stars 2.08k forks source link

ChangeAtoZ not adjusting retraction distances with relative extrusion enabled. #11487

Open 64bittuning opened 2 years ago

64bittuning commented 2 years ago

Application Version

4.13.1

Platform

Windows 10

Printer

Tronxy XY-2 Pro

Reproduction steps

Loaded Retraction Tower model from "Part for calibration" plugin. Enabled 4x "ChangeAtoZ" scripts to alter retraction to 0.2, 0.4, 0.6, and 0.8mm at 40, 80, 120, and 160mm respectively. Sliced and printed file. Noticed retractions and stringing looked terrible. Inspected the gcode file and found that no retractions were commanded at all. Verified retraction was enabled. initial value was set to 0.0. Assumed this was the cause, resliced the file with 0.1mm. Saved and inspected gcode again. retraction (linear) remains at 0.1mm throughout entire print. Never changes. Modified "ChangeAtoZ" setting for layer 120 to add retraction speed change. Inspected file and found

;LAYER:120 ;[CAZD: ;RETRACTFEEDRATE 2700.0 ;RETRACTLENGTH 0.6 ;:CAZD] G1 F2700.0 E-0.1;[CAZO:G1 F3900 E-0.1:CAZO]

Actual results

Modified "ChangeAtoZ" setting for layer 120 to add retraction speed change. Inspected file and found

;LAYER:120 ;[CAZD: ;RETRACTFEEDRATE 2700.0 ;RETRACTLENGTH 0.6 ;:CAZD] G1 F2700.0 E-0.1;[CAZO:G1 F3900 E-0.1:CAZO]

It seems as though "ChangeAtoZ" is not changing retraction distances.

Expected results

Layers 40, 80, 120, and 160 and all subsequent lines should have changed to 0.2, 0.4. 0.6. 0.8mm retraction values.

Layer 40 is file line 5839 Layer 80 = 9682 layer 120 = 13525 layer 160 = 1736 single wall calibration cylinder for retraction bug test.txt individual line search results for retraction showing no change from one tenth.txt 9

Checklist of files to include

Additional information & file uploads

0 to 8tenths retraction test PETG.gcode.txt 0 to 8tenths retraction test PETG.zip

fvrmr commented 2 years ago

Hi @64bittuning thank you for your report. The Change At Z processing script is in experimental. I checked 4.7.1 (this was introduced in 4.7) with your project file and there I get the same gcode results. Did you noticed this before?

64bittuning commented 2 years ago

@fvrmr I was running either 4.12 or 4.12.1, I do not recall which. (backstory) I was having a significant jamming issue with my small machine, and loaded up the retraction tower. I did two different tests. 1-5mm and 0.2 to 1mm (its a direct drive machine). The test printed appropriately and I found my best retraction to be 0.2mm with PLA. I had never done a retraction test in this manner before, so I went and did the same test on my large machine. 1-5mm and found acceptable results at 3mm, then ran it again with 3.0-3.8mm. The machine looked to produce the best results at 3.2mm

Being that the test ran properly on two machines prior to this, I would it odd that the failure would present now. This makes me curious to find out if the fault is caused by the Tronxy profiles which I recently updated. I'm going to uninstall my Cura today and do some tests. I will report back with my findings.

64bittuning commented 2 years ago

@fvrmr It looks like the issue is specifically with choosing to run with "Relative Extrusion" selected. I have reset my install back to a base 4.13.1 and deleted all custom profiles, so its as absolutely box stock as possible. I loaded two cylindrical shapes and placed them 20mm apart on the X axis, and set them to a single wall (for code simplicity). Attached you will find the two gcode files. In the standard file, you can search "CAZO" and find each line where the changes were made and you can see where they increase in 50 layer increments. 50 = 1mm, 100 = 2mm, 150 = 3mm and so fourth.

image

image TXY2PRO_flag sleeve.gcode.txt TXY2PRO_flag sleeve_relative.gcode.txt

Ghostkeeper commented 2 years ago

It looks like the Change At Z script doesn't handle relative extrusion at all. Not with the retractions, nor with the flow rate adjustments. It was probably never implemented to handle that.

fvrmr commented 2 years ago

We have discussed this with the team and decided to defer this issue. It is not a priority for us to fix this. I hope you understand.

64bittuning commented 2 years ago

We have discussed this with the team and decided to defer this issue. It is not a priority for us to fix this. I hope you understand.

I fully understand. It's not an overwhelmingly large issue, especially after I identified the exact criteria for the failure. If you don't mind, I'd suggest changing line 301 of changeatz.py to

"description": "Indicates you would like to modify retraction properties. Does not currently work with Relative Extrusion.",

This should serve an an interim solution until such a time as you (the devs) decide to address the issue.

image

msticninja commented 2 years ago

Would sure love to see this fixed. I had to go back to Simplify3D for all of my prints due to this issue.

novamxd commented 2 years ago

Hey folks,

I'm the one who did the revamp of the plugin at 5.2.0. So I actually designed it to work with Relative Extrusions and Firmware retractions. The downside of Relative Extrusions, though, is that it needs to know what the starting retract length was set when the GCODE was synthesized as it needs to make relative adjustments to all follow up commands. It detects this in the GCODE for you except when it's zero, apparently; I suppose I could update the settings to ask for it explicitly.

That being said, if you want to do something like this with Relative Extrusions using the auto detection, do the following:

  1. Set the retract length in your print settings to anything over zero
  2. Use ChangeAtZ to set the retract length to 0 at layer 0
  3. Use the other ChangeAtZ as needed
  4. ???
  5. Profit!
novamxd commented 2 years ago

By the way, this it is the command it looks for when trying to autodetect the retract length. As you can see here, it's missing in the GCODE with a retract length of 0 but present when I set the retract length to 0.6.

image

tstone52 commented 2 years ago

I was about to open an issue for this. I am having this same problem in Cura 5.1.0. I need to be able to use both relative extrusion AND a post process retraction change, but I cannot due to this bug. I have found that 4.5mm retract works well for me, except I prefer a lower retraction on Layer 0 only. I seem to get better bed adhesion with lower retraction, especially on models with small bed-contact-areas. I guess when the retraction is lower there is less "pull" on the filament that has been laid down on the bed. Therefore I want the first layer retract to be low (I suppose it could even be 0) and every other layer to be 4.5mm.

tstone52 commented 2 years ago

Hey folks,

I'm the one who did the revamp of the plugin at 5.2.0. So I actually designed it to work with Relative Extrusions and Firmware retractions. The downside of Relative Extrusions, though, is that it needs to know what the starting retract length was set when the GCODE was synthesized as it needs to make relative adjustments to all follow up commands. It detects this in the GCODE for you except when it's zero, apparently; I suppose I could update the settings to ask for it explicitly.

That being said, if you want to do something like this with Relative Extrusions using the auto detection, do the following:

  1. Set the retract length in your print settings to anything over zero
  2. Use ChangeAtZ to set the retract length to 0 at layer 0
  3. Use the other ChangeAtZ as needed
  4. ???
  5. Profit!

I tried this and it did not work for me on Cura 5.1.0. I downloaded Cura 5.2.0 and it still did not work. I have relative extrusion enabled. As you said, I have put a non-zero number as my normal retraction value. I then used ChangeAtZ to change the retraction distance to 0mm for layer 0, and another ChangeAtZ to change the retraction distance to 4.5mm for layer 1+subsequent layers. Neither of these two ChangeAtZ retraction changes are applied to the gcode.

Am I missing something? You mentioned firmware retraction. I am not using firmware retraction. Do I need to use firmware retraction for the method you described to work? And what is the auto detection you mentioned? Is that something that needs to be enabled?

novamxd commented 2 years ago

Hey @tstone52 ,

Sorry for the late reply. If you're still having this issue, can you post a screenshot of your ChangeAtZ settings and include your GCODE? I can take a look and see if there's anything that stands out.

You mentioned firmware retraction. I am not using firmware retraction. Do I need to use firmware retraction for the method you described to work?

No you don't need to, but firmware retraction is more reliable for detection because it uses a specific GCODE command and thus the code doesn't need to do some wizardry to attempt to detect it for you. But not all 3D printers support firmware retraction and AFAIK it's not enabled by default. Looking at the printer settings for Cura 5.2, I actually don't even see the option to enable firmware retractions anymore, so I should probably remove that from the plugin.

novamxd commented 2 years ago

Ah. The firmware retraction option is part of the Printer Settings Plugin

tstone52 commented 2 years ago

Hey @tstone52 ,

Sorry for the late reply. If you're still having this issue, can you post a screenshot of your ChangeAtZ settings and include your GCODE? I can take a look and see if there's anything that stands out.

You mentioned firmware retraction. I am not using firmware retraction. Do I need to use firmware retraction for the method you described to work?

No you don't need to, but firmware retraction is more reliable for detection because it uses a specific GCODE command and thus the code doesn't need to do some wizardry to attempt to detect it for you. But not all 3D printers support firmware retraction and AFAIK it's not enabled by default. Looking at the printer settings for Cura 5.2, I actually don't even see the option to enable firmware retractions anymore, so I should probably remove that from the plugin.

Sure thing. I appreciate the reply. Here are a few screenshots and the gcode (as a txt file).

Untitled1 Untitled2 Untitled3

AI3M_190C_FlexSnake_RetChangeLayer0_RelExtrudeOn.txt