Not the standard approach to a Bearing this model begins with 2D Representations of each race component and uses rotate_extrude to build up the 3D Body.
Sometimes, if we know the shape is going to be uniform around an axis, it may be easier to create the shape in 2 dimensions. When the shape is complete we can use rotate_extrude to build up the 3d model. This is the approach used in many full feature CAD system. This sample is made as an example of the approach.
We can use the 2d system where it seems appropriate and, after they are extruded into 3d, add the 3d components.
Here is all the code to create this model, you can copy and paste this code directly into you OpenSCAD editor.
rotate_extrude($fn=50){
difference() {
translate([10, 0, 0]){
square([10, 9], center=true);
}
translate([15, 0, 0]){
circle(r=5);
}
}
difference() {
translate([20, 0, 0]){
square([10, 9], center=true);
}
translate([15, 0, 0]){
circle(r=5);
}
}
}
for (i = [1 : abs(1) : 10]) {
rotate([0, 0, (i * 36)]){
translate([15, 0, 0]){
{
$fn=50; //set sides to 50
sphere(r=4.5);
}
}
I went to parametrize and simplify this, here’s what I got (also after fixing a few typos in the original recipe):
“`
pi = 3.141592653;
$fn = 60;
rball = 4.5; // ball radius
sball = 0.5; // ball spacing
height = 2*rball; // full height
rinner = 15; // inner (axle) radius
router = 30; // outer radius
rdiff = router-rinner;
rcentr = (router+rinner)/2;
rotate_extrude(){
difference() {
translate([rcentr, 0, 0])
square([rdiff, height], center=true);
translate([rcentr, 0, 0]){
circle(r = rball+sball);
}
}
}
nballs = floor(pi * rcentr/(rball+sball));
echo(rcentr, rball, nballs);
for (i = [1 : nballs]) {
rotate([0, 0, (i * 360/nballs)])
translate([rcentr, 0, 0])
sphere(r = rball);
}
“`
Thanks for the initial code 😉
Oh :/ what’s the canonical way to include code in comments in this place? Apologies for the lost formatting!