[OpenSCAD] Curved groove gets wrong depth

arnholm at arnholm.org arnholm at arnholm.org
Wed Oct 5 06:56:39 EDT 2016


On 2016-10-05 11:16, Bananapeel wrote:
> I'm trying to make a groove in a bend, but I can't get it to have an 
> even
> depth. It gets shallower in the middle. Any ideas?

I did not study your code in all detail, it seemed complex to me.
Below you have another approach that creates something almost similar to 
your code (the parameter values may be off). In this version the groove 
depth is constant in the "bend".


$fn=100;

module rounded_square(width=10,height=10,radius=1)
{
     hull() {
         for(iy=[-1:2:1]) {
            for(ix=[-1:2:1]) {
               
translate([ix*(width-radius),iy*(height-radius)])circle(radius);
            }
         }
     }
}

module box(dx=10,dy=10,dz=10,th=1,inner_r=3)
{
     linear_extrude(dz,convexity=10)
     difference() {
        rounded_square(dx+th,dy+th,inner_r+th);
        rounded_square(dx,dy,inner_r);
     }
}

width         = 200;
height        = width/2;
thickness     =  3;
inner_radius  = 10;
d             = 1.5;

difference()
{
    box(dx=width,dy=height,dz=135,th=thickness,inner_r=inner_radius);

    union() {
        translate([0,0,thickness])
        linear_extrude(thickness,convexity=10)
        rounded_square(width+d,height+d,radius=inner_radius+d);
        translate([-250,0,0])cube([500,500,500],center=true);
    }
}

Carsten Arnholm




More information about the Discuss mailing list