I have written a little openscad to create a gear that I wish to cut on my CNC machine.
Code: Select all
$fn=75;
GearRatio = 4;
PinionTeeth = 8;
ToothWidth=3.1;
ToothHeight=3;
ToothSlope=0.6;
eps = 0.01;
module Tooth() {
polygon([[0,0],[0,3],[1.5,3],[3.1,2.4],[3.1,0.6],[1.5,0],[0,0]]);
}
module BoltHoles() {
for (BoltHole=[0:120:360]) {
rotate([0,0,BoltHole])
translate([0,12,0.1])
circle(d=3.5);
}
}
module BaseCircle() {
difference() {
circle(d=52);
circle(d=18);
BoltHoles();
}
}
module Base() {
angle=(360 / (GearRatio * PinionTeeth));
union() {
BaseCircle();
for (Step=[0:angle:360]) {
rotate([0, 0, Step])
translate([25.9,-1.55,0])
Tooth();
}
}
}
difference() {
linear_extrude(6) Base();
for (BoltHole=[0:120:360]) {
rotate([0,0,BoltHole])
translate([0,12,3.1])
cylinder(h=3,d=5.5);
}
}
Bringing this into freecad I would expect the polygon’s around the circle to become one with the circle for it is enclosed by a union().
It does not and the polygons get cut individually. Please tell me how I can fix this?