
This post was updated on .
Hi everyone,
I'm new and 3D design and I'm designing simple objects. Now I'm trying to round top and side "faces" of a figure, while leaving bottom side plain. From the OpenSCAD cheat sheet I've seen that minkowski() function can do so, by using as rounding pattern the union of a sphere and a cylinder. The corresponding code is below. Note that the minkowski() function is commented because I get a memory overflow error. By the way, I'm running OpenSCAD version 2015.032 under Windows 7 on a PC with 12GB of RAM.
x_max_boton=80;
x_min_boton=45.5;
y_max_boton=14.6;
y_min_boton=12.6;
z1_boton=15;
z2_boton=16.2;
z3_boton=16;
r_boton=1;
borde_separacion_ext=2;
r_redondeo=0.25;
r_redondeo_top=50;
module Base_Boton(x, y, z)
{
resize([x, y, z]) cylinder($fn = 1000, $fa = 12, $fs = 2, h=z, r=x/2);
}
module Planta_Boton(x_max, x_min, y_max, y_min, z, r)
{
hull()
{
translate([(x_min/2r), y_min/2r, 0]) cylinder($fn = 1000, $fa = 12, $fs = 2, h=z, r=r);
translate([(x_min/2r), (y_min/2r), 0]) cylinder($fn = 1000, $fa = 12, $fs = 2, h=z, r=r);
translate([(x_min/2r), y_min/2r, 0]) cylinder($fn = 1000, $fa = 12, $fs = 2, h=z, r=r);
translate([(x_min/2r), (y_min/2r), 0]) cylinder($fn = 1000, $fa = 12, $fs = 2, h=z, r=r);
intersection()
{
Base_Boton(x_max, y_max, z);
translate([0, 0, z/2]) cube([x_min2*r1+0.05, y_max+2, 2*z], true);
}
}
}
module Planta_Hueco_Boton(x_max, x_min, x_new, y_max, y_min, y_new, z, z_new, r_boton)
{
resize([x_new, y_new, z_new]) Planta_Boton(x_max, x_min, y_max, y_min, z, r_boton);
}
module Bloque_Boton(x_max_boton, x_min_boton, y_max_boton, y_min_boton, z1_boton, z2_boton, z3_boton, r_boton, borde_separacion_ext, r_redondeo)
{
z_boton=1;
// minkowski()
// {
// Coloring in red is just to highlight the rounding object
color([1, 0, 0, 1]) union()
{
translate([(x_min_boton2*r_redondeo)/2, 0, z1_boton+r_redondeo]) sphere($fn = 1000, $fa = 12, $fs = 2, r=r_redondeo);
translate([(x_min_boton2*r_redondeo)/2, 0, z1_boton]) cylinder($fn = 1000, $fa = 12, $fs = 2, h=r_redondeo, r=r_redondeo);
}
intersection()
{
translate([0(x_min_boton+4)/2, y_max_boton/6, (r_redondeo_topz2_boton)]) rotate([0, 90, 0]) cylinder($fn = 1000, $fa = 12, $fs = 2, h=x_min_boton+4, r=r_redondeo_top);
translate([0, 0, z1_boton]) Planta_Hueco_Boton(x_max_boton, x_min_boton, x_min_boton2*r_redondeo, y_max_boton, y_min_boton, y_max_boton2*r_redondeo, z_boton, 2*z_boton, r_boton);
}
// }
}
Bloque_Boton(x_max_boton, x_min_boton, y_max_boton, y_min_boton, z1_boton, z2_boton, z3_boton, r_boton, borde_separacion_ext, r_redondeo);
Surprised, I've tried simplifying the original figure (note the "/* */" comments). However, I've got a memory overflow again, and thus I've commented (with "//") the minkowski() function()).
module Bloque_Boton2(x_max_boton, x_min_boton, y_max_boton, y_min_boton, z1_boton, z2_boton, z3_boton, r_boton, borde_separacion_ext, r_redondeo)
{
z_boton=1;
// minkowski()
// {
// Coloring in red is just to highlight the rounding object
color([1, 0, 0, 1]) union()
{
translate([(x_min_boton2*r_redondeo)/2, 0, z1_boton+r_redondeo3]) sphere($fn = 1000, $fa = 12, $fs = 2, r=r_redondeo);
translate([(x_min_boton2*r_redondeo)/2, 0, z1_boton3]) cylinder($fn = 1000, $fa = 12, $fs = 2, h=r_redondeo, r=r_redondeo);
}
/* intersection()
{
translate([0(x_min_boton+4)/2, y_max_boton/6, (r_redondeo_topz2_boton)]) rotate([0, 90, 0]) cylinder($fn = 1000, $fa = 12, $fs = 2, h=x_min_boton+4, r=r_redondeo_top);*/
translate([0, 0, z1_boton3]) Planta_Hueco_Boton(x_max_boton, x_min_boton, x_min_boton2*r_redondeo, y_max_boton, y_min_boton, y_max_boton2*r_redondeo, z_boton, 2*r_redondeo, r_boton);
/* }*/
// }
}
Bloque_Boton2(x_max_boton, x_min_boton, y_max_boton, y_min_boton, z1_boton, z2_boton, z3_boton, r_boton, borde_separacion_ext, r_redondeo);
Well, I think that the original object is quite simple, so I've tried to round it using only the sphere and the cylinder separately. This is the version for the sphere. The result: memory overflow again (and the minkowski() function commented).
module Bloque_Boton3(x_max_boton, x_min_boton, y_max_boton, y_min_boton, z1_boton, z2_boton, z3_boton, r_boton, borde_separacion_ext, r_redondeo)
{
z_boton=1;
// minkowski()
// {
// Coloring in red is just to highlight the rounding object
color([1, 0, 0, 1]) translate([(x_min_boton2*r_redondeo)/2, 0, z1_boton+r_redondeo6]) sphere($fn = 1000, $fa = 12, $fs = 2, r=r_redondeo);
/* intersection()
{
translate([0(x_min_boton+4)/2, y_max_boton/6, (r_redondeo_topz2_boton)]) rotate([0, 90, 0]) cylinder($fn = 1000, $fa = 12, $fs = 2, h=x_min_boton+4, r=r_redondeo_top);*/
translate([0, 0, z1_boton6]) Planta_Hueco_Boton(x_max_boton, x_min_boton, x_min_boton2*r_redondeo, y_max_boton, y_min_boton, y_max_boton2*r_redondeo, z_boton, 2*r_redondeo, r_boton);
/* }*/
// }
}
Bloque_Boton3(x_max_boton, x_min_boton, y_max_boton, y_min_boton, z1_boton, z2_boton, z3_boton, r_boton, borde_separacion_ext, r_redondeo);
Finally, using only the cylinder I got the figure rounded. This is the corresponding code. Note that I've translated the rounded figure to put it down the other versions if running all the versions together.
module Bloque_Boton4(x_max_boton, x_min_boton, y_max_boton, y_min_boton, z1_boton, z2_boton, z3_boton, r_boton, borde_separacion_ext, r_redondeo)
{
z_boton=1;
// The green color is just to distinguish the succesfully rounded figure from the original figures and rounding shapes
color([0, 1, 0, 1]) translate([(x_min_boton2*r_redondeo)/2, 0, 7]) minkowski()
{
// Coloring in red is just to highlight the rounding object
color([1, 0, 0, 1]) translate([(x_min_boton2*r_redondeo)/2, 0, z1_boton9]) cylinder($fn = 1000, $fa = 12, $fs = 2, h=2*r_redondeo, r=r_redondeo);
/* intersection()
{
translate([0(x_min_boton+4)/2, y_max_boton/6, (r_redondeo_topz2_boton)]) rotate([0, 90, 0]) cylinder($fn = 1000, $fa = 12, $fs = 2, h=x_min_boton+4, r=r_redondeo_top);*/
translate([0, 0, z1_boton9]) Planta_Hueco_Boton(x_max_boton, x_min_boton, x_min_boton2*r_redondeo, y_max_boton, y_min_boton, y_max_boton2*r_redondeo, z_boton, 2*r_redondeo, r_boton);
/* }*/
}
}
Bloque_Boton4(x_max_boton, x_min_boton, y_max_boton, y_min_boton, z1_boton, z2_boton, z3_boton, r_boton, borde_separacion_ext, r_redondeo);
Can anyone tell me if it is actually a bug, or a problem in my design?
Thanks a lot in advance, and sorry for the length of the post.
jcbaraza
