Absolute newbie - looking for advice on how to apply a chamfer

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Absolute newbie - looking for advice on how to apply a chamfer

SUggy62
Hi All,

I'm trying to design a display for some Poker Chips. Due to the
manufacturing tolerances of the chips and of my printer, some chips fit
snugly and some are loose.

To get round this I'd like a chamfer on the edge where the chip is inserted
to make it easier to insert the chip into a tight recess, but am clueless as
to how to achieve this

My current code is ;

$fn=64;

ChipBase=44;
x=3 ;
y=3;

module Chip() {
difference() {
cube([ChipBase,ChipBase,5]);
translate ([ChipBase/2,ChipBase/2,1.7])cylinder (r=20.30,h=4);
translate([ChipBase/2, ChipBase/2, -0.5]) cylinder (r=10, h=3);  
}
}


for(i = [0:ChipBase:(x*ChipBase)-1]){
    for(j = [0:ChipBase:(y*ChipBase)-1]){
        translate([i,j,0]) Chip();    
    }
}

Hope this makes sense and any suggestions gratefully received




--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Absolute newbie - looking for advice on how to apply a chamfer

adrianv
I personally would do it using the BOSL2 library, which provides chamfered
cylinders.  Or you could write your own chamfered cylinder if you want to
work more.  

https://github.com/revarbat/BOSL2/wiki


include<BOSL2/std.scad>
$fn=64;

ChipBase=44;
x=3 ;
y=3;

module Chip() {
difference() {
cube([ChipBase,ChipBase,5]);
//translate ([ChipBase/2,ChipBase/2,1.7])

translate([ChipBase/2,ChipBase/2,1.7])cyl(r=20.30,h=4,chamfer2=-2,anchor=BOTTOM);
translate([ChipBase/2, ChipBase/2, -0.5]) cylinder (r=10, h=3);
}
}


for(i = [0:ChipBase:(x*ChipBase)-1]){
    for(j = [0:ChipBase:(y*ChipBase)-1]){
        translate([i,j,0]) Chip();
    }
}



SUggy62 wrote

> Hi All,
>
> I'm trying to design a display for some Poker Chips. Due to the
> manufacturing tolerances of the chips and of my printer, some chips fit
> snugly and some are loose.
>
> To get round this I'd like a chamfer on the edge where the chip is
> inserted
> to make it easier to insert the chip into a tight recess, but am clueless
> as
> to how to achieve this
>
> My current code is ;
>
> $fn=64;
>
> ChipBase=44;
> x=3 ;
> y=3;
>
> module Chip() {
> difference() {
> cube([ChipBase,ChipBase,5]);
> translate ([ChipBase/2,ChipBase/2,1.7])cylinder (r=20.30,h=4);
> translate([ChipBase/2, ChipBase/2, -0.5]) cylinder (r=10, h=3);  
> }
> }
>
>
> for(i = [0:ChipBase:(x*ChipBase)-1]){
>     for(j = [0:ChipBase:(y*ChipBase)-1]){
>         translate([i,j,0]) Chip();    
>     }
> }
>
> Hope this makes sense and any suggestions gratefully received
>
>
>
>
> --
> Sent from: http://forum.openscad.org/
>
> _______________________________________________
> OpenSCAD mailing list

> Discuss@.openscad

> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org





--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Absolute newbie - looking for advice on how to apply a chamfer

lar3ry
In reply to this post by SUggy62
Being reluctant to dig out and learn chamfers in BOSL2, I just did a bit of a
brute force thing,

$fn=64;

ChipBase=44;
x=3 ;
y=3;

module Chip() {
        difference() {
                cube([ChipBase,ChipBase,5]);
                translate ([ChipBase/2,ChipBase/2,1.7])
                        cylinder (r=20.30,h=4);
                translate([ChipBase/2, ChipBase/2, -0.5])
                        cylinder (r=10, h=3);  
                translate ([22,22,1.5])
                        chamfer();
        }
}

module chamfer() {
        rotate_extrude(convexity = 10)
                translate([20,4, 0])
                        circle(r = 2,$fn=3);
}

for(i = [0:ChipBase:(x*ChipBase)-1]){
    for(j = [0:ChipBase:(y*ChipBase)-1]){
        translate([i,j,0]) Chip();    
    }
}





--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Absolute newbie - looking for advice on how to apply a chamfer

JordanBrown
On 2/7/2020 8:50 PM, lar3ry wrote:
Being reluctant to dig out and learn chamfers in BOSL2, I just did a bit of a
brute force thing,


Yep, though I thought in terms of a cone rather than a rotate_extrude of a triangle.

Also I couldn't resist factoring the translate-to-center out.  Nor could I resist extracting all of the variables out.  Note that we don't need separate variables for the thickness of the negative cylinders, because they only have to reach above the base; the thickness of the base (+2 for the through hole) is plenty.
$fn=64;

ChipBase=44;
x=3;
y=3;
thickness = 5;      // Base thickness
thickness2 = 1.7;   // thickness inside chip hole
chip_r = 20.3;      // Outer hole
hole_r = 10;        // Inner hole
cham_h = 1;         // Height of the chamfer
cham_r = 1;         // Radius (in addition to the hole) of the chamfer

module Chip() {
    difference() {
        cube([ChipBase, ChipBase, thickness]);
        translate([ChipBase/2, ChipBase/2, 0]) {
            translate ([0, 0, thickness2])
                cylinder (r=chip_r,h=thickness);
            // -1 and +2 are to avoid Z-fighting.
            translate([0, 0, -1])
                cylinder (r=hole_r, h=thickness+2);   
            translate ([0, 0, thickness])
                chamfer();
        }
    }
}

// z=0 is at the top of the hole, so we generate a chamfer down from that.
// Note that this module controls all of the geometry of the chamfer.
module chamfer() {
    translate([0,0,-cham_h]) {
        // cham_h*2 gets us out of Z-fighting.  cham_r*2 keeps the
        // angles the same.
        cylinder(h=cham_h*2, r1=chip_r, r2=chip_r + cham_r*2);
    }
}

for(i = [0:ChipBase:(x*ChipBase)-1]){
    for(j = [0:ChipBase:(y*ChipBase)-1]){
        translate([i,j,0]) Chip();    
    }
}


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Absolute newbie - looking for advice on how to apply a chamfer

SUggy62
In reply to this post by SUggy62
Fantastic, That's been really helpful and informative.

I'm going to have a play with all three methods

TY



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
tp3
Reply | Threaded
Open this post in threaded view
|

Re: Absolute newbie - looking for advice on how to apply a chamfer

tp3
In reply to this post by JordanBrown
On 08.02.20 06:20, Jordan Brown wrote:
>             // -1 and +2 are to avoid Z-fighting.
>             translate([0, 0, -1])
>                 cylinder (r=hole_r, h=thickness+2);

I usually don't bother with the adjustments by making the
cylinder big enough:

  cylinder(r = hole_r, h = thickness * 3, center = true);

ciao,
  Torsten.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-- Torsten
Reply | Threaded
Open this post in threaded view
|

Re: Absolute newbie - looking for advice on how to apply a chamfer

RevarBat
In reply to this post by lar3ry
Chamfers in BOSL2 are actually fairly convenient in this case.  A cyl() with a negative chamfer2= value makes an external top chamfer mask.

include <BOSL2/std.scad>

$fn=64;
x=3;
y=3;
ChipBase=44;
thickness = 5;      // Base thickness
thickness2 = 1.7;   // thickness inside chip hole
chip_r = 20.3;      // Outer hole
hole_r = 10;        // Inner hole
cham_h = 1;         // Height of the chamfer

grid2d(spacing=ChipBase, cols=x, rows=y) {
        difference() {
                cube([ChipBase+0.01,ChipBase+0.01,thickness], anchor=BOT);
                up(thickness2) cyl(r=chip_r, h=thickness-thickness2+0.01, chamfer2=-cham_h, anchor=BOT);
                cyl(r=hole_r, h=thickness*3);
        }
}


> On Feb 7, 2020, at 8:50 PM, lar3ry <[hidden email]> wrote:
>
> Being reluctant to dig out and learn chamfers in BOSL2, I just did a bit of a
> brute force thing,
>
> $fn=64;
>
> ChipBase=44;
> x=3 ;
> y=3;
>
> module Chip() {
> difference() {
> cube([ChipBase,ChipBase,5]);
> translate ([ChipBase/2,ChipBase/2,1.7])
> cylinder (r=20.30,h=4);
> translate([ChipBase/2, ChipBase/2, -0.5])
> cylinder (r=10, h=3);  
> translate ([22,22,1.5])
> chamfer();
> }
> }
>
> module chamfer() {
> rotate_extrude(convexity = 10)
> translate([20,4, 0])
> circle(r = 2,$fn=3);
> }
>
> for(i = [0:ChipBase:(x*ChipBase)-1]){
>    for(j = [0:ChipBase:(y*ChipBase)-1]){
>        translate([i,j,0]) Chip();    
>    }
> }
>
>
>
>
>
> --
> Sent from: http://forum.openscad.org/
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Absolute newbie - looking for advice on how to apply a chamfer

lar3ry
RevarBat wrote

> Chamfers in BOSL2 are actually fairly convenient in this case.  A cyl()
> with a negative chamfer2= value makes an external top chamfer mask.
>
> include &lt;BOSL2/std.scad&gt;
>
> $fn=64;
> x=3;
> y=3;
> ChipBase=44;
> thickness = 5;      // Base thickness
> thickness2 = 1.7;   // thickness inside chip hole
> chip_r = 20.3;      // Outer hole
> hole_r = 10;        // Inner hole
> cham_h = 1;         // Height of the chamfer
>
> grid2d(spacing=ChipBase, cols=x, rows=y) {
> difference() {
> cube([ChipBase+0.01,ChipBase+0.01,thickness], anchor=BOT);
> up(thickness2) cyl(r=chip_r, h=thickness-thickness2+0.01,
> chamfer2=-cham_h, anchor=BOT);
> cyl(r=hole_r, h=thickness*3);
> }
> }

Tried that, and got:

ERROR: Assertion 'false' failed: "Bad arguments." in file
../Users/Admin/Documents/OpenSCAD/libraries/BOSL2/vectors.scad, line 120
TRACE: called by 'vector_angle', in file
../Users/Admin/Documents/OpenSCAD/libraries/BOSL2/coords.scad, line 151.
TRACE: called by 'rotate_points3d', in file
../Users/Admin/Documents/OpenSCAD/libraries/BOSL2/attachments.scad, line
156.
TRACE: called by 'find_anchor', in file
../Users/Admin/Documents/OpenSCAD/libraries/BOSL2/attachments.scad, line
253.
TRACE: called by 'orient_and_anchor', in file
../Users/Admin/Documents/OpenSCAD/libraries/BOSL2/transforms.scad, line
1053.
TRACE: called by 'if', in file
../Users/Admin/Documents/OpenSCAD/libraries/BOSL2/transforms.scad, line
1052.
TRACE: called by 'if', in file
../Users/Admin/Documents/OpenSCAD/libraries/BOSL2/transforms.scad, line
1033.
TRACE: called by 'grid2d', in file OpenSCAD, line 13.



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Absolute newbie - looking for advice on how to apply a chamfer

RevarBat
It's possible that you have an old version of BOSL2.  It's still alpha code, and I've been actively reworking it for months now. I suppose I shouldn't really be referencing it yet, but it's already so much nicer than BOSL1 that I just don't use BOSL1 anymore.

- Revar


> On Feb 8, 2020, at 9:15 PM, lar3ry <[hidden email]> wrote:
>
> RevarBat wrote
>> Chamfers in BOSL2 are actually fairly convenient in this case.  A cyl()
>> with a negative chamfer2= value makes an external top chamfer mask.
>>
>> include &lt;BOSL2/std.scad&gt;
>>
>> $fn=64;
>> x=3;
>> y=3;
>> ChipBase=44;
>> thickness = 5;      // Base thickness
>> thickness2 = 1.7;   // thickness inside chip hole
>> chip_r = 20.3;      // Outer hole
>> hole_r = 10;        // Inner hole
>> cham_h = 1;         // Height of the chamfer
>>
>> grid2d(spacing=ChipBase, cols=x, rows=y) {
>> difference() {
>> cube([ChipBase+0.01,ChipBase+0.01,thickness], anchor=BOT);
>> up(thickness2) cyl(r=chip_r, h=thickness-thickness2+0.01,
>> chamfer2=-cham_h, anchor=BOT);
>> cyl(r=hole_r, h=thickness*3);
>> }
>> }
>
> Tried that, and got:
>
> ERROR: Assertion 'false' failed: "Bad arguments." in file
> ../Users/Admin/Documents/OpenSCAD/libraries/BOSL2/vectors.scad, line 120
> TRACE: called by 'vector_angle', in file
> ../Users/Admin/Documents/OpenSCAD/libraries/BOSL2/coords.scad, line 151.
> TRACE: called by 'rotate_points3d', in file
> ../Users/Admin/Documents/OpenSCAD/libraries/BOSL2/attachments.scad, line
> 156.
> TRACE: called by 'find_anchor', in file
> ../Users/Admin/Documents/OpenSCAD/libraries/BOSL2/attachments.scad, line
> 253.
> TRACE: called by 'orient_and_anchor', in file
> ../Users/Admin/Documents/OpenSCAD/libraries/BOSL2/transforms.scad, line
> 1053.
> TRACE: called by 'if', in file
> ../Users/Admin/Documents/OpenSCAD/libraries/BOSL2/transforms.scad, line
> 1052.
> TRACE: called by 'if', in file
> ../Users/Admin/Documents/OpenSCAD/libraries/BOSL2/transforms.scad, line
> 1033.
> TRACE: called by 'grid2d', in file OpenSCAD, line 13.
>
>
>
> --
> Sent from: http://forum.openscad.org/
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org