module round_edges_box(x,y,z,r) {
hull() {
translate([r,r,0])
cylinder(h=z,r=r);
translate([x-r,r,0])
cylinder(h=z,r=r);
translate([x-r,y-r,0])
cylinder(h=z,r=r);
translate([r,y-r,0])
cylinder(h=z,r=r);
} // End of hull
} // End of module round_edges_box
Hint: indent your lines to reflect the structure of the program. It
will make your program more readable to others and, when you come back
to it later and have forgotten the details, more readable to you.
There are several patterns that work pretty well; just be more or less
consistent. Here's the basic rules that I use.
The first rule is that anything inside braces should be indented from
the stuff outside the braces, like so:
module round_edges_box(x,y,z,r) {
hull() {
translate([r,r,0])
cylinder(h=z,r=r);
translate([x-r,r,0])
cylinder(h=z,r=r);
translate([x-r,y-r,0])
cylinder(h=z,r=r);
translate([r,y-r,0])
cylinder(h=z,r=r);
} // End of hull
} // End of module round_edges_box
The second rule is that continuation lines, lines that are "attached" to
the previous line, are indented:
module round_edges_box(x,y,z,r) {
hull() {
translate([r,r,0])
cylinder(h=z,r=r);
translate([x-r,r,0])
cylinder(h=z,r=r);
translate([x-r,y-r,0])
cylinder(h=z,r=r);
translate([r,y-r,0])
cylinder(h=z,r=r);
} // End of hull
} // End of module round_edges_box
Thanks, that does look a lot better and I'll follow it.
--
Sent from: http://forum.openscad.org/