bmsleight / lasercut

Module for openscad, allowing 3d models to be created from 2d lasercut parts
BSD 2-Clause "Simplified" License
320 stars 55 forks source link

Is there any way to set the kerf width ? #3

Closed rogerclarkmelbourne closed 6 years ago

rogerclarkmelbourne commented 8 years ago

Hi can't see any way to set the kerf width.

At the moment when I try to cut a box, it doesn't snap together because the kerf width the fingers do not fit tightly against each other

bmsleight commented 8 years ago

I cheat and adjust the thickness, but considering the other issue raised - I need to look at this.

Thanks for the report - I'll dig out the code and have a look.

rogerclarkmelbourne commented 8 years ago

I've had a go at applying kerf to the fingers() module, and I think its working OK, but I need to see if there is a tidier way to do it.

Basically what I did was make the fingers kerf/2 wider and moved them my kerf/4

Something like this

                translate([i-kerf/4,0,0]) 
                {
                    cube([ (range_max-range_min)/(fingers*2) + kerf/2, thickness*2, thickness]);
                    if(bumps == true)
                    {
                        translate([(range_max-range_min)/(fingers*2), thickness*1.5, 0]) cylinder(h=thickness, r=thickness/10);
                    }
                }

But the first cube does not need to be moved, but it needs to be only kerf/4 wider

I had an issue with testing for the first finger, i.e

   if (i==range_min) 
   {
   }

didn't seem to work,

So I ended up splitting the code, so that it adds the first cube / finger, using separate code, and then goes into the for() loop to do the remaining fingers.

in hindsight, I suspect that perhaps the reason that if (i== range_min) did not work for me is perhaps a precision issue with floating point numbers

and perhaps

   if (i<range_min + ((range_max-range_min)/fingers))

May work

But I'm not an OpenSCAD expert, and I know it used to have some wierd things about dynamic vars not working in "if" statements

rogerclarkmelbourne commented 8 years ago

I've forked your repo and applied my fix for this issue

See

https://github.com/rogerclarkmelbourne/lasercut/commits/master

bmsleight commented 6 years ago

Grabbed the fork. Thanks again.

rogerclarkmelbourne commented 6 years ago

No worries