Skip to content

fix magnet hole crush ribs: correct wave center radius and add param - #285

Open
cbrinker wants to merge 1 commit into
ostat:mainfrom
cbrinker:fix-magnet-crush-ribs
Open

fix magnet hole crush ribs: correct wave center radius and add param#285
cbrinker wants to merge 1 commit into
ostat:mainfrom
cbrinker:fix-magnet-crush-ribs

Conversation

@cbrinker

Copy link
Copy Markdown

The original implementation from #252 passed r=magnetDiameter/2 to cylinder_wavy, treating the intended hole radius as the wave CENTER. This caused the hole to oscillate ±crushDepth around the magnet diameter: at the wave peaks the hole was larger than the magnet (no grip), making the ribs ineffective.

Instead we should use the passed magnet hole radius as the wave MAXIMUM, so the hole peaks exactly at the magnet diameter and the ribs press inward from there.

Fix: use r = magnetDiameter/2 - magnetCrushDepth as the wave center, so the maximum radius equals magnetDiameter/2. The chamferedCylinder radius remains at magnetDiameter/2 - magnetCrushDepth*2 (the wave inner radius), keeping it inside the wavy shape while its entry flare guides the magnet in.

Additional changes:

  • Add magnetCrushRibCount param (controls wave frequency; default 8) and wire it through CupBaseSettings and gridfinity_basic_cup.scad
  • Change default crush depth and chamfer from non-zero to 0 (feature off by default; existing users see no change unless they opt in)
  • Set Customizer step to 0.01 for crush depth and chamfer so values like 0.15 are directly enterable in the UI

…unt param

The original implementation passed r=magnetDiameter/2 to cylinder_wavy,
treating the intended hole radius as the wave CENTER. This caused the hole
to oscillate ±crushDepth around the magnet diameter: at the wave peaks the
hole was larger than the magnet (no grip), making the ribs ineffective.

Instead we should use the passed magnet hole radius as the wave MAXIMUM,
so the hole peaks exactly at the magnet diameter and the ribs press
inward from there.

Fix: use r = magnetDiameter/2 - magnetCrushDepth as the wave center, so
the maximum radius equals magnetDiameter/2. The chamferedCylinder radius
remains at magnetDiameter/2 - magnetCrushDepth*2 (the wave inner radius),
keeping it inside the wavy shape while its entry flare guides the magnet in.

Additional changes:
- Add magnetCrushRibCount param (controls wave frequency; default 8) and
  wire it through CupBaseSettings and gridfinity_basic_cup.scad
- Change default crush depth and chamfer from non-zero to 0 (feature off
  by default; existing users see no change unless they opt in)
- Set Customizer step to 0.01 for crush depth and chamfer so values like
  0.15 are directly enterable in the UI
@cbrinker

Copy link
Copy Markdown
Author

Here's a picture of a test cup I just made with the new algorithm. Pressing magnets into the crush ribs works great!
IMG_1399

@ostat

ostat commented May 17, 2026

Copy link
Copy Markdown
Owner

Thanks for the PR.

I think I implemented it so that the magnet diameter was in the centre of the wave amplitude. Half of the amplitude comes in to the magnet diameter, half crates a gap around the magnet. I thought this would be good as it would allow a little variance for the magnet.
Did you find this didn't work very well?

@cbrinker

cbrinker commented May 17, 2026

Copy link
Copy Markdown
Author

Correct, I tried a few test prints with your original implementation and they didn't work.

I also tried a few test prints with https://github.com/kennetek/gridfinity-rebuilt-openscad/blob/910e22d8607fd7f5f51ad5e5cbc5287a76810bfd/src/core/gridfinity-rebuilt-holes.scad#L254 and my magnets fit in just fine.

So, after investigating it a bit, I saw that your algo took the magnet dia and effectively grow and shrunk it across 8 cycles... whereas the other repo was only shrinking the hole dia down with crushable ribs.

So, this PR is just making your algo match the one found in the other repo.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants