Skip to content

Removal of Filament Diameter Check#7250

Open
gear2nd-droid wants to merge 2 commits into
Klipper3d:masterfrom
gear2nd-droid:remove_filament_diameter_check
Open

Removal of Filament Diameter Check#7250
gear2nd-droid wants to merge 2 commits into
Klipper3d:masterfrom
gear2nd-droid:remove_filament_diameter_check

Conversation

@gear2nd-droid

@gear2nd-droid gear2nd-droid commented Apr 11, 2026

Copy link
Copy Markdown

Recently, nozzles thicker(2.0mm etc) than the standard filament diameter (1.75 mm) have become available and are being used. The diameter check causes issues where the printer cannot print when a thicker nozzle is installed.
https://shop.kaika-tecdia.com/blog/2021/12/24/134114

Signed-off-by: Noriaki Tambo gear2nd.droid@gmail.com

Recently, nozzles thicker than the standard filament diameter (1.75 mm) have become available and are being used. The diameter check causes issues where the printer cannot print when a thicker nozzle is installed.
@github-actions

Copy link
Copy Markdown

Thank you for your contribution to Klipper. Unfortunately, a reviewer has not assigned themselves to this GitHub Pull Request. All Pull Requests are reviewed before merging, and a reviewer will need to volunteer. Further information is available at: https://www.klipper3d.org/CONTRIBUTING.html

There are some steps that you can take now:

  1. Perform a self-review of your Pull Request by following the steps at: https://www.klipper3d.org/CONTRIBUTING.html#what-to-expect-in-a-review
    If you have completed a self-review, be sure to state the results of that self-review explicitly in the Pull Request comments. A reviewer is more likely to participate if the bulk of a review has already been completed.
  2. Consider opening a topic on the Klipper Discourse server to discuss this work. The Discourse server is a good place to discuss development ideas and to engage users interested in testing. Reviewers are more likely to prioritize Pull Requests with an active community of users.
  3. Consider helping out reviewers by reviewing other Klipper Pull Requests. Taking the time to perform a careful and detailed review of others work is appreciated. Regular contributors are more likely to prioritize the contributions of other regular contributors.

Unfortunately, if a reviewer does not assign themselves to this GitHub Pull Request then it will be automatically closed. If this happens, then it is a good idea to move further discussion to the Klipper Discourse server. Reviewers can reach out on that forum to let you know if they are interested and when they are available.

Best regards,
~ Your friendly GitIssueBot

PS: I'm just an automated script, not a human being.

@dewi-ny-je dewi-ny-je left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change makes sense given modern nozzles, surely better than hacking the filament diameter in the config to make them work.

Main issue — unguarded division by zero / negative area

With no constraint, filament_diameter can now be 0 or negative. Look at what consumes it immediately after:

self.filament_area = math.pi * (filament_diameter * .5)**2   # → 0.0 if diameter is 0
def_max_extrude_ratio = def_max_cross_section / self.filament_area   # ZeroDivisionError
...
self.max_extrude_ratio = max_cross_section / self.filament_area      # ZeroDivisionError
  • filament_diameter = 0filament_area = 0ZeroDivisionError at startup with an opaque traceback instead of a clean config error.
  • A negative value → squared away into a positive area silently, masking a typo.

The old minval=self.nozzle_diameter implicitly guaranteed a positive diameter (since nozzle_diameter is already above=0.). Removing it drops that protection too.

Recommended change

Keep a lower bound that prevents the degenerate cases but allows nozzle > filament:

filament_diameter = config.getfloat('filament_diameter', above=0.)

This preserves the author's intent (no longer tied to nozzle diameter) while keeping Klipper's usual "clean config error, not a Python traceback" behavior.

Secondary observations

  • Lost typo protection. The original check also caught the common mistake of swapping the nozzle_diameter and filament_diameter values. That safety net is gone. Acceptable given the goal, but worth a one-line note; above=0. at least catches the worst cases.
  • No documentation update. If docs/Config_Reference.md (or config examples) documents this constraint, it should be updated to match.
  • Commit/PR hygiene. Single focused commit, clear title — good. Klipper requires a Signed-off-by line per its contribution guidelines; confirm that's present.

@gear2nd-droid

Copy link
Copy Markdown
Author

Thank you for your review. I agree with your point, so I’ve made the correction.

@gear2nd-droid gear2nd-droid requested a review from dewi-ny-je June 19, 2026 11:58
@dewi-ny-je

Copy link
Copy Markdown

Thank you for your review. I agree with your point, so I’ve made the correction

Have you added the Signed-off line with real name and email?

@gear2nd-droid

Copy link
Copy Markdown
Author

Is this necessary? Where and how do I add it?

@dewi-ny-je

Copy link
Copy Markdown

Is this necessary? Where and how do I add it?

I think that editing the first post of this discussion is enough.

Someone proposed relaxing the requirement "real name" so if it's a problem for you you can wait.

@gear2nd-droid

gear2nd-droid commented Jun 21, 2026

Copy link
Copy Markdown
Author

I've added my name to the first comment. Thank you for your cooperation.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants