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

Update PurgeLinesAndUnload.py #20316

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

GregValiant
Copy link
Collaborator

@GregValiant GregValiant commented Feb 26, 2025

This change adds a setting for "minimum Z height" for the "nail down the string" moves.
There was an error in the "Prime Blob" code that didn't properly account for the retraction and there was no corresponding prime. This commit fixes both of those.

Description

Added a user setting for "move_to_start_min_z" so the user has an option of keeping the nozzle from actually touching down on the bed. The description for "move to start" was updated.

This fixes... OR This improves... -->
Added flexibility

Type of change

  • [ X] New feature (non-breaking change which adds functionality)
  • [X ] Bug fix

Test Configuration: Win 10 Pro and various Cura versions

Checklist:

  • [ X] My code follows the style guidelines of this project as described in UltiMaker Meta and Cura QML best practices
  • [ X] I have read the Contribution guide
  • [ X] I have commented my code, particularly in hard-to-understand areas
  • [ X] I have uploaded any files required to test this change

@github-actions github-actions bot added the PR: Community Contribution 👑 Community Contribution PR's label Feb 26, 2025
Copy link
Contributor

github-actions bot commented Feb 26, 2025

Test Results

0 tests   - 23 701   0 ✅  - 23 699   0s ⏱️ -46s
0 suites  -      1   0 💤  -      2 
0 files    -      1   0 ❌ ±     0 

Results for commit 77e6a1b. ± Comparison against base commit b67769b.

♻️ This comment has been updated with latest results.

This change adds a setting for "minimum Z height" for the "nail down the string" moves.

Update PurgeLinesAndUnload.py

Bug fix.  The prime blob code didn't account for the retraction at the end.  This adds an 'unretract' to compensate.
@GregValiant
Copy link
Collaborator Author

@HellAholic, @wawanbreton - this commit encompasses the addition of a setting for the "minimum Z height" for 'nailing down the string' as well as the bug fix for the Prime Blob code.

Since the added lines are identical, it can be replaced with a helper function
@GregValiant
Copy link
Collaborator Author

@HellAholic you put the bug back in.
G1 F{retract_speed} E{retract_distance}
doesn't work because the printer is in absolute extrusion mode. If the prime blob is 20mm then the retraction will be back to the "retract_distance" location. For a direct drive that might be back to E=1 which would be a retraction of 19mm. That leaves a dry start on the purge lines.
G1 F300 E20 ; Blob
G1 F2100 E1.0 ; Retract
That's why I changed it to
G1 F{retract_speed} E{self.prime_blob_amount - retract_distance}
I could have switched to relative and then back but I went for less lines to add.
G1 F300 E20 ; Blob
G1 F2100 E19.0 ; Retract

You have to fix it because today is my birthday!!

@HellAholic
Copy link
Contributor

HellAholic commented Mar 1, 2025

The code you added was:

purge_str += f"G1 F{self.retract_speed} E{self.retract_dist} ; Unretract\n"
purge_str += "G92 E0 ; Reset extruder\n"

This exact code is repeated 8 times, code change I added uses a helper function to put the exact same code in the same place but allows to change the gcode pattern in one place and apply it to all 8 cases.
It does not change the output result at all so I'm confused by your comment here.

The code for

blob_string += f"G1 F{self.retract_speed} E{self.prime_blob_distance - self.retract_dist} ; Retract\n"

is still in the same place, that is not changed.

@GregValiant
Copy link
Collaborator Author

Sorry, that's my bad.
It does work as expected and avoids the overly long retraction so I'll retract my statement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Community Contribution 👑 Community Contribution PR's
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants