initial commit
[clinton/prusa3.git] / functions.scad
CommitLineData
d3618a65
NZ
1// PRUSA Mendel
2// Functions used in many files
3// GNU GPL v3
4// Josef Průša
5// josefprusa@me.com
6// prusadjs.cz
7// http://www.reprap.org/wiki/Prusa_Mendel
8// http://github.com/prusajr/PrusaMendel
9
10
11module nut(d,h,horizontal=true){
12cornerdiameter = (d / 2) / cos (180 / 6);
13cylinder(h = h, r = cornerdiameter, $fn = 6);
14if(horizontal){
15for(i = [1:6]){
16 rotate([0,0,60*i]) translate([-cornerdiameter-0.2,0,0]) rotate([0,0,-45]) cube(size = [2,2,h]);
17}}
18}
19
20// Based on nophead research
21module polyhole(d,h) {
22 n = max(round(2 * d),3);
23 rotate([0,0,180])
24 cylinder(h = h, r = (d / 2) / cos (180 / n), $fn = n);
25}
26
27
28
29
30module roundcorner(diameter){
31 difference(){
32 cube(size = [diameter,diameter,99], center = false);
33 translate(v = [diameter, diameter, 0]) cylinder(h = 100, r=diameter, center=true);
34 }
35}