first commit
This commit is contained in:
168
openSCAD/MX-106_bracket.scad
Normal file
168
openSCAD/MX-106_bracket.scad
Normal file
@@ -0,0 +1,168 @@
|
||||
// quick-and-dirty sketch of a bracket to connect the Dynamixel MX-106 servo motor with the main beam of the AX18A robot arm.
|
||||
|
||||
difference() {
|
||||
union() {
|
||||
translate([0,0,14.5+10]) roundCornersCube(114, 29.0, 5.0, 2);
|
||||
//horn slab
|
||||
translate([46/2+3+2.5,0,20-15]) rotate([0, 90, 0]) roundCornersCube(40.0, 29.0, 5.0, 2);
|
||||
//back-end slab
|
||||
translate([-46/2-5.5, 0, 20-15]) rotate([0, 90, 0]) roundCornersCube(40, 29.0, 5.0, 2);
|
||||
//reinforcement
|
||||
translate([46/2+3+2.5,0,14.5+7.5]) rotate([0,45,0]) cube(size = [7, 29.0, 7], center = true);
|
||||
translate([-46/2-5.5,0,14.5+7.5]) rotate([0,45,0]) cube(size = [7, 29.0, 7], center = true);
|
||||
}
|
||||
MX106();
|
||||
//mounting holes
|
||||
translate([-19.0, 7.75, 14.5+10]) cylinder(d=3.3, h=20, center=true,$fn=200);
|
||||
translate([19.0, 7.75, 14.5+10]) cylinder(d=3.3, h=20, center=true,$fn=200);
|
||||
translate([-19.0, -7.75, 14.5+10]) cylinder(d=3.3, h=20, center=true,$fn=200);
|
||||
translate([19.0, -7.75, 14.5+10]) cylinder(d=3.3, h=20, center=true,$fn=200);
|
||||
translate([-19.0-30, 7.75, 14.5+10]) cylinder(d=3.3, h=20, center=true,$fn=200);
|
||||
translate([19.0+30, 7.75, 14.5+10]) cylinder(d=3.3, h=20, center=true,$fn=200);
|
||||
translate([-19.0-30, -7.75, 14.5+10]) cylinder(d=3.3, h=20, center=true,$fn=200);
|
||||
translate([19.0+30, -7.75, 14.5+10]) cylinder(d=3.3, h=20, center=true,$fn=200);
|
||||
translate([-19.0, 7.75, 14.5]) cylinder(d=6.6, h=20, center=true,$fn=6);
|
||||
translate([19.0, 7.75, 14.5]) cylinder(d=6.6, h=20, center=true,$fn=6);
|
||||
translate([-19.0, -7.75, 14.5]) cylinder(d=6.6, h=20, center=true,$fn=6);
|
||||
translate([19.0, -7.75, 14.5]) cylinder(d=6.6, h=20, center=true,$fn=6);
|
||||
translate([-19.0-30, 7.75, 14.5]) cylinder(d=6.6, h=20, center=true,$fn=6);
|
||||
translate([19.0+30, 7.75, 14.5]) cylinder(d=6.6, h=20, center=true,$fn=6);
|
||||
translate([-19.0-30, -7.75, 14.5]) cylinder(d=6.6, h=20, center=true,$fn=6);
|
||||
translate([19.0+30, -7.75, 14.5]) cylinder(d=6.6, h=20, center=true,$fn=6);
|
||||
}
|
||||
|
||||
|
||||
// MX-106 body
|
||||
module MX106() {
|
||||
difference(){
|
||||
union(){
|
||||
//axis
|
||||
rotate([0,90,0]) cylinder(d=8.0, h=46+3.2, center=true,$fn=200);
|
||||
//housing
|
||||
translate([0,0,(-45.0+29.75)]) rotate([0,90,0]) roundCornersCube(59.5, 29.0, 46.0, 2);
|
||||
//slabs
|
||||
translate([0,0,(-45.0+29.75-2.8)]) rotate([0,90,0]) difference() {
|
||||
cube(size = [65.1, 40.2, 34.0], center = true);
|
||||
translate([-(65.1/2), (40.2/2), 0]) rotate([0,0,45]) cube(size = [5.5, 5.5, 40], center = true);
|
||||
translate([-(65.1/2), -(40.2/2), 0]) rotate([0,0,45]) cube(size = [5.5, 5.5, 40], center = true);
|
||||
translate([(65.1/2), (40.2/2), 0]) rotate([0,0,45]) cube(size = [5.5, 5.5, 40], center = true);
|
||||
translate([(65.1/2), -(40.2/2), 0]) rotate([0,0,45]) cube(size = [5.5, 5.5, 40], center = true);
|
||||
}
|
||||
//servo horn
|
||||
translate([46/2+3-1.25,0,0]) rotate([0,90,0]) cylinder(d=28.0, h=2.5, center=true,$fn=200);
|
||||
translate([46/2+3+1,0,0]) rotate([0,90,0]) cylinder(d=10.0, h=2, center=true,$fn=200);
|
||||
|
||||
//extension
|
||||
translate([-(46/2+3.5), 0, 0]) rotate([0,90,0]) cylinder(d=8.1, h=8, center=true,$fn=200);
|
||||
translate([-(46/2+7+0.75), 0, 0]) rotate([0,90,0]) cylinder(d=10.1, h=1.5, center=true,$fn=200);
|
||||
|
||||
//servo horn holes, negative
|
||||
translate([46/2+3+1.2, 0, 0]) rotate([0, 90, 0]) cylinder(d=10.1, h=20, center=true,$fn=200);
|
||||
translate([46/2+3-1.2, 22/2, 0]) rotate([0, 90, 0]) cylinder(d=2.8, h=20, center=true,$fn=200);
|
||||
translate([46/2+3-1.2, -22/2, 0]) rotate([0, 90, 0]) cylinder(d=2.8, h=20, center=true,$fn=200);
|
||||
translate([46/2+3-1.2, 0, 22/2]) rotate([0, 90, 0]) cylinder(d=2.8, h=20, center=true,$fn=200);
|
||||
translate([46/2+3-1.2, 0, -22/2]) rotate([0, 90, 0]) cylinder(d=2.8, h=20, center=true,$fn=200);
|
||||
translate([46/2+3-1.2, sqrt(pow(22/2,2)/2), sqrt(pow(22/2,2)/2)]) rotate([0, 90, 0]) cylinder(d=2.8, h=20, center=true,$fn=300);
|
||||
translate([46/2+3-1.2, -sqrt(pow(22/2,2)/2), sqrt(pow(22/2,2)/2)]) rotate([0, 90, 0]) cylinder(d=2.8, h=20, center=true,$fn=300);
|
||||
translate([46/2+3-1.2, sqrt(pow(22/2,2)/2), -sqrt(pow(22/2,2)/2)]) rotate([0, 90, 0]) cylinder(d=2.8, h=20, center=true,$fn=300);
|
||||
translate([46/2+3-1.2, -sqrt(pow(22/2,2)/2), -sqrt(pow(22/2,2)/2)]) rotate([0, 90, 0]) cylinder(d=2.8, h=20, center=true,$fn=300);
|
||||
|
||||
// nut countersinks in servo horn
|
||||
translate([46/2+3+5, 22/2, 0]) rotate([0, 90, 0]) cylinder(d=5, h=6, center=true,$fn=200);
|
||||
translate([46/2+3+5, -22/2, 0]) rotate([0, 90, 0]) cylinder(d=5, h=6, center=true,$fn=200);
|
||||
translate([46/2+3+5, 0, 22/2]) rotate([0, 90, 0]) cylinder(d=5, h=6, center=true,$fn=200);
|
||||
translate([46/2+3+5, 0, -22/2]) rotate([0, 90, 0]) cylinder(d=5, h=6, center=true,$fn=200);
|
||||
translate([46/2+3+5, sqrt(pow(22/2,2)/2), sqrt(pow(22/2,2)/2)]) rotate([0, 90, 0]) cylinder(d=5, h=6, center=true,$fn=200);
|
||||
translate([46/2+3+5, -sqrt(pow(22/2,2)/2), sqrt(pow(22/2,2)/2)]) rotate([0, 90, 0]) cylinder(d=5, h=6, center=true,$fn=200);
|
||||
translate([46/2+3+5, sqrt(pow(22/2,2)/2), -sqrt(pow(22/2,2)/2)]) rotate([0, 90, 0]) cylinder(d=5, h=6, center=true,$fn=200);
|
||||
translate([46/2+3+5, -sqrt(pow(22/2,2)/2), -sqrt(pow(22/2,2)/2)]) rotate([0, 90, 0]) cylinder(d=5, h=6, center=true,$fn=200);
|
||||
|
||||
}
|
||||
//servo horn holes
|
||||
//translate([46/2+3+1.2, 0, 0]) rotate([0, 90, 0]) cylinder(d=2.4, h=2.8, center=true,$fn=300);
|
||||
//translate([46/2+3-1.2, 22/2, 0]) rotate([0, 90, 0]) cylinder(d=2.4, h=2.8, center=true,$fn=300);
|
||||
//translate([46/2+3-1.2, -22/2, 0]) rotate([0, 90, 0]) cylinder(d=2.4, h=2.8, center=true,$fn=300);
|
||||
//translate([46/2+3-1.2, 0, 22/2]) rotate([0, 90, 0]) cylinder(d=2.4, h=2.8, center=true,$fn=300);
|
||||
//translate([46/2+3-1.2, 0, -22/2]) rotate([0, 90, 0]) cylinder(d=2.4, h=2.8, center=true,$fn=300);
|
||||
//translate([46/2+3-1.2, sqrt(pow(22/2,2)/2), sqrt(pow(22/2,2)/2)]) rotate([0, 90, 0]) cylinder(d=2.4, h=2.8, center=true,$fn=300);
|
||||
//translate([46/2+3-1.2, -sqrt(pow(22/2,2)/2), sqrt(pow(22/2,2)/2)]) rotate([0, 90, 0]) cylinder(d=2.4, h=2.8, center=true,$fn=300);
|
||||
//translate([46/2+3-1.2, sqrt(pow(22/2,2)/2), -sqrt(pow(22/2,2)/2)]) rotate([0, 90, 0]) cylinder(d=2.4, h=2.8, center=true,$fn=300);
|
||||
//translate([46/2+3-1.2, -sqrt(pow(22/2,2)/2), -sqrt(pow(22/2,2)/2)]) rotate([0, 90, 0]) cylinder(d=2.4, h=2.8, center=true,$fn=300);
|
||||
|
||||
//mounting holes housing
|
||||
translate([0, (34.6/2), 4.0]) rotate([0,90,0]) cylinder(d=2.5, h=50, center=true,$fn=200);
|
||||
translate([0, -(34.6/2), 4.0]) rotate([0,90,0]) cylinder(d=2.5, h=50, center=true,$fn=200);
|
||||
translate([0, (34.6/2), -18.0]) rotate([0,90,0]) cylinder(d=2.5, h=50, center=true,$fn=200);
|
||||
translate([0, -(34.6/2), -18.0]) rotate([0,90,0]) cylinder(d=2.5, h=50, center=true,$fn=200);
|
||||
translate([0, (34.6/2), -40.0]) rotate([0,90,0]) cylinder(d=2.5, h=50, center=true,$fn=200);
|
||||
translate([0, -(34.6/2), -40.0]) rotate([0,90,0]) cylinder(d=2.5, h=50, center=true,$fn=200);
|
||||
translate([0, (22.0/2), -47.8]) rotate([0,90,0]) cylinder(d=2.5, h=50, center=true,$fn=200);
|
||||
translate([0, -(22.0/2), -47.8]) rotate([0,90,0]) cylinder(d=2.5, h=50, center=true,$fn=200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
http://codeviewer.org/view/code:1b36
|
||||
Copyright (C) 2011 Sergio Vilches
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
Contact: s.vilches.e@gmail.com
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
Round Corners Cube (Extruded)
|
||||
roundCornersCube(x,y,z,r) Where:
|
||||
- x = Xdir width
|
||||
- y = Ydir width
|
||||
- z = Height of the cube
|
||||
- r = Rounding radious
|
||||
|
||||
Example: roundCornerCube(10,10,2,1);
|
||||
*Some times it's needed to use F6 to see good results!
|
||||
-----------------------------------------------------------
|
||||
*/
|
||||
// Test it!
|
||||
//roundCornersCube(10,5,2,1);
|
||||
|
||||
|
||||
module createMeniscus(h,radius) // This module creates the shape that needs to be substracted from a cube to make its corners rounded.
|
||||
difference(){ //This shape is basicly the difference between a quarter of cylinder and a cube
|
||||
translate([radius/2+0.1,radius/2+0.1,0]){
|
||||
cube([radius+0.2,radius+0.1,h+0.2],center=true); // All that 0.x numbers are to avoid "ghost boundaries" when substracting
|
||||
}
|
||||
|
||||
cylinder(h=h+0.2,r=radius,$fn = 25,center=true);
|
||||
}
|
||||
|
||||
|
||||
module roundCornersCube(x,y,z,r) // Now we just substract the shape we have created in the four corners
|
||||
difference(){
|
||||
cube([x,y,z], center=true);
|
||||
|
||||
translate([x/2-r,y/2-r]){ // We move to the first corner (x,y)
|
||||
rotate(0){
|
||||
createMeniscus(z,r); // And substract the meniscus
|
||||
}
|
||||
}
|
||||
translate([-x/2+r,y/2-r]){ // To the second corner (-x,y)
|
||||
rotate(90){
|
||||
createMeniscus(z,r); // But this time we have to rotate the meniscus 90 deg
|
||||
}
|
||||
}
|
||||
translate([-x/2+r,-y/2+r]){ // ...
|
||||
rotate(180){
|
||||
createMeniscus(z,r);
|
||||
}
|
||||
}
|
||||
translate([x/2-r,-y/2+r]){
|
||||
rotate(270){
|
||||
createMeniscus(z,r);
|
||||
}
|
||||
}
|
||||
}
|
157
openSCAD/MX-106_stand.scad
Normal file
157
openSCAD/MX-106_stand.scad
Normal file
@@ -0,0 +1,157 @@
|
||||
// quick-and-dirty sketch of a new stand between the turn-table and the Dynamixel MX-106 servo motor as replacement for the AX-18A servo pair in the shoulder joint of the AX18A robot arm. The center of motor shaft is elevated 100mm above the turn-table.
|
||||
|
||||
difference() {
|
||||
union() {
|
||||
rotate([0,0,45]) cylinder(87,44,32,$fn=4);
|
||||
//disc
|
||||
translate([0,0,1]) cylinder(d=113, h=2.0, center=true,$fn=300);
|
||||
}
|
||||
//stand
|
||||
translate([0,0,34]) cube(size = [28, 28, 60], center = true);
|
||||
translate([0,0,24]) rotate([90,0,0]) cylinder(d=40, h=80.0, center=true,$fn=200);
|
||||
translate([0,0,24]) rotate([0,90,0]) cylinder(d=40, h=80.0, center=true,$fn=200);
|
||||
// connector openings
|
||||
translate([7,0,72]) cube(size = [18, 60, 17], center = true);
|
||||
//motor, make visible by placing a '#' at the beginning of the next line.
|
||||
translate([0,0,100]) MX106();
|
||||
//holes bottom plate
|
||||
translate([8,0,0]) cylinder(d=2.3, h=10.0, center=true,$fn=200);
|
||||
translate([-8,0,0]) cylinder(d=2.3, h=10.0, center=true,$fn=200);
|
||||
translate([0,8,0]) cylinder(d=2.3, h=10.0, center=true,$fn=200);
|
||||
translate([0,-8,0]) cylinder(d=2.3, h=10.0, center=true,$fn=200);
|
||||
translate([8,0,2.9]) cylinder(d=6, h=2.3, center=true,$fn=200);
|
||||
translate([-8,0,2.9]) cylinder(d=6, h=2.3, center=true,$fn=200);
|
||||
translate([0,8,2.9]) cylinder(d=6, h=2.3, center=true,$fn=200);
|
||||
translate([0,-8,2.9]) cylinder(d=6, h=2.3, center=true,$fn=200);
|
||||
//flat edge for screw heads motor
|
||||
translate([(34/2+10+2.5),0,100-14.5]) rotate([0,90,0]) roundCornersCube(59.5+12, 29.2+12, 20, 2);
|
||||
translate([-(34/2+10+2.5),0,100-14.5]) rotate([0,90,0]) roundCornersCube(59.5+12, 29.2+12, 20, 2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// MX-106 body
|
||||
module MX106() {
|
||||
difference(){
|
||||
union(){
|
||||
//axis
|
||||
rotate([0,90,0]) cylinder(d=8.0, h=46+3.2, center=true,$fn=200);
|
||||
//housing (motor width +0.2)
|
||||
translate([0,0,(-45.0+29.75)]) rotate([0,90,0]) roundCornersCube(59.5, 29.0+0.2, 46.0, 2);
|
||||
//slabs (motor thickness +0.2)
|
||||
translate([0,0,(-45.0+29.75-2.8)]) rotate([0,90,0]) difference() {
|
||||
cube(size = [65.1, 40.2+0.2, 34+0.2], center = true);
|
||||
translate([-(65.1/2), ((40.2+0.2)/2), 0]) rotate([0,0,45]) cube(size = [5.5, 5.5, 40], center = true);
|
||||
translate([-(65.1/2), -((40.2+0.2)/2), 0]) rotate([0,0,45]) cube(size = [5.5, 5.5, 40], center = true);
|
||||
translate([(65.1/2), ((40.2+0.2)/2), 0]) rotate([0,0,45]) cube(size = [5.5, 5.5, 40], center = true);
|
||||
translate([(65.1/2), -((40.2+0.2)/2), 0]) rotate([0,0,45]) cube(size = [5.5, 5.5, 40], center = true);
|
||||
}
|
||||
//servo horn
|
||||
translate([46/2+3-1.25,0,0]) rotate([0,90,0]) cylinder(d=28.0, h=2.5, center=true,$fn=200);
|
||||
translate([46/2+3+1,0,0]) rotate([0,90,0]) cylinder(d=10.0, h=2, center=true,$fn=200);
|
||||
|
||||
//extension
|
||||
translate([-(46/2+3.5), 0, 0]) rotate([0,90,0]) cylinder(d=8.1, h=7, center=true,$fn=200);
|
||||
translate([-(46/2+7-0.75), 0, 0]) rotate([0,90,0]) cylinder(d=10.1, h=1.5, center=true,$fn=200);
|
||||
|
||||
//mounting holes housing, negative
|
||||
translate([0, (34.6/2), 4.0]) rotate([0,90,0]) cylinder(d=2.8, h=60, center=true,$fn=200);
|
||||
translate([0, -(34.6/2), 4.0]) rotate([0,90,0]) cylinder(d=2.8, h=60, center=true,$fn=200);
|
||||
translate([0, (34.6/2), -18.0]) rotate([0,90,0]) cylinder(d=2.8, h=60, center=true,$fn=200);
|
||||
translate([0, -(34.6/2), -18.0]) rotate([0,90,0]) cylinder(d=2.8, h=60, center=true,$fn=200);
|
||||
translate([0, (34.6/2), -40.0]) rotate([0,90,0]) cylinder(d=2.8, h=60, center=true,$fn=200);
|
||||
translate([0, -(34.6/2), -40.0]) rotate([0,90,0]) cylinder(d=2.8, h=60, center=true,$fn=200);
|
||||
translate([0, (22.0/2), -47.8]) rotate([0,90,0]) cylinder(d=2.8, h=60, center=true,$fn=200);
|
||||
translate([0, -(22.0/2), -47.8]) rotate([0,90,0]) cylinder(d=2.8, h=60, center=true,$fn=200);
|
||||
}
|
||||
//servo horn holes
|
||||
translate([46/2+3+1.2, 0, 0]) rotate([0, 90, 0]) cylinder(d=2.4, h=2.8, center=true,$fn=200);
|
||||
translate([46/2+3-1.2, 22/2, 0]) rotate([0, 90, 0]) cylinder(d=2.4, h=2.8, center=true,$fn=200);
|
||||
translate([46/2+3-1.2, -22/2, 0]) rotate([0, 90, 0]) cylinder(d=2.4, h=2.8, center=true,$fn=200);
|
||||
translate([46/2+3-1.2, 0, 22/2]) rotate([0, 90, 0]) cylinder(d=2.4, h=2.8, center=true,$fn=200);
|
||||
translate([46/2+3-1.2, 0, -22/2]) rotate([0, 90, 0]) cylinder(d=2.4, h=2.8, center=true,$fn=200);
|
||||
translate([46/2+3-1.2, sqrt(pow(22/2,2)/2), sqrt(pow(22/2,2)/2)]) rotate([0, 90, 0]) cylinder(d=2.4, h=2.8, center=true,$fn=200);
|
||||
translate([46/2+3-1.2, -sqrt(pow(22/2,2)/2), sqrt(pow(22/2,2)/2)]) rotate([0, 90, 0]) cylinder(d=2.4, h=2.8, center=true,$fn=200);
|
||||
translate([46/2+3-1.2, sqrt(pow(22/2,2)/2), -sqrt(pow(22/2,2)/2)]) rotate([0, 90, 0]) cylinder(d=2.4, h=2.8, center=true,$fn=200);
|
||||
translate([46/2+3-1.2, -sqrt(pow(22/2,2)/2), -sqrt(pow(22/2,2)/2)]) rotate([0, 90, 0]) cylinder(d=2.4, h=2.8, center=true,$fn=200);
|
||||
|
||||
//mounting holes housing
|
||||
//translate([0, (34.6/2), 4.0]) rotate([0,90,0]) cylinder(d=2.7, h=50, center=true,$fn=200);
|
||||
//translate([0, -(34.6/2), 4.0]) rotate([0,90,0]) cylinder(d=2.7, h=50, center=true,$fn=200);
|
||||
//translate([0, (34.6/2), -18.0]) rotate([0,90,0]) cylinder(d=2.7, h=50, center=true,$fn=200);
|
||||
//translate([0, -(34.6/2), -18.0]) rotate([0,90,0]) cylinder(d=2.7, h=50, center=true,$fn=200);
|
||||
//translate([0, (34.6/2), -40.0]) rotate([0,90,0]) cylinder(d=2.7, h=50, center=true,$fn=200);
|
||||
//translate([0, -(34.6/2), -40.0]) rotate([0,90,0]) cylinder(d=2.7, h=50, center=true,$fn=200);
|
||||
//translate([0, (22.0/2), -47.8]) rotate([0,90,0]) cylinder(d=2.7, h=50, center=true,$fn=200);
|
||||
//translate([0, -(22.0/2), -47.8]) rotate([0,90,0]) cylinder(d=2.7, h=50, center=true,$fn=200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
http://codeviewer.org/view/code:1b36
|
||||
Copyright (C) 2011 Sergio Vilches
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
Contact: s.vilches.e@gmail.com
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
Round Corners Cube (Extruded)
|
||||
roundCornersCube(x,y,z,r) Where:
|
||||
- x = Xdir width
|
||||
- y = Ydir width
|
||||
- z = Height of the cube
|
||||
- r = Rounding radious
|
||||
|
||||
Example: roundCornerCube(10,10,2,1);
|
||||
*Some times it's needed to use F6 to see good results!
|
||||
-----------------------------------------------------------
|
||||
*/
|
||||
// Test it!
|
||||
//roundCornersCube(10,5,2,1);
|
||||
|
||||
|
||||
module createMeniscus(h,radius) // This module creates the shape that needs to be substracted from a cube to make its corners rounded.
|
||||
difference(){ //This shape is basicly the difference between a quarter of cylinder and a cube
|
||||
translate([radius/2+0.1,radius/2+0.1,0]){
|
||||
cube([radius+0.2,radius+0.1,h+0.2],center=true); // All that 0.x numbers are to avoid "ghost boundaries" when substracting
|
||||
}
|
||||
|
||||
cylinder(h=h+0.2,r=radius,$fn = 25,center=true);
|
||||
}
|
||||
|
||||
|
||||
module roundCornersCube(x,y,z,r) // Now we just substract the shape we have created in the four corners
|
||||
difference(){
|
||||
cube([x,y,z], center=true);
|
||||
|
||||
translate([x/2-r,y/2-r]){ // We move to the first corner (x,y)
|
||||
rotate(0){
|
||||
createMeniscus(z,r); // And substract the meniscus
|
||||
}
|
||||
}
|
||||
translate([-x/2+r,y/2-r]){ // To the second corner (-x,y)
|
||||
rotate(90){
|
||||
createMeniscus(z,r); // But this time we have to rotate the meniscus 90 deg
|
||||
}
|
||||
}
|
||||
translate([-x/2+r,-y/2+r]){ // ...
|
||||
rotate(180){
|
||||
createMeniscus(z,r);
|
||||
}
|
||||
}
|
||||
translate([x/2-r,-y/2+r]){
|
||||
rotate(270){
|
||||
createMeniscus(z,r);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user