/*
* Copyright (c) 2022 - 2023 Thomas Buck (thomas@xythobuz.de)
* Philipp Schönberger (mail@phschoen.de)
*
* 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.
*
* See .
*/
include ;
include ;
include ;
bearing_holder();
bearing_holder_mount();
//NOTE: [0,0,0] should be the "top" contact point of the bearings
module bearing_holder()
{
difference()
{
if(bearing_type=="static") {
bearing_holder_static();
}
if(bearing_type=="dynamic_m6_vcn320") {
bearing_holder_m6_vcn320();
}
if(bearing_type=="dynamic_3d_vcn410") {
bearing_holder_d3_vcn410();
}
// cut of the flange
translate([0,bearing_mount_flange, 0])// move in by flange
translate([0,-bearing_mount_dia/2, 0])// move to edge of cylinder
translate([-bearing_mount_dia,-bearing_mount_dia, -bearing_h*2])// center on on half
cube([bearing_mount_dia *2, bearing_mount_dia, bearing_h *3]);
}
}
module bearing_holder_static()
{
// glider ball itself
%translate([0, 0, -bearing_static_dia/2])
color([0.3,0.3,0.3,0.2])
sphere(d = bearing_static_dia, $fn = $fn);
difference()
{
// holder itself
color("magenta")
hull()
{
// hold static ball itself
translate([0, 0, -bearing_static_dia -bearing_static_dia*0.35])
cylinder(d1 = bearing_mount_dia, d2=bearing_static_dia+1, h = bearing_static_dia);
// bottom surface
translate([0, 0, -bearing_h])
cylinder(d = bearing_mount_dia, h = $e);
}
// cut the bearing on the side
// #translate([-bearing_mount_dia / 2 - 1, bearing_mount_dia / 2 - bearing_holder_sider_cut, -1])
// cube([bearing_mount_dia + 2, bearing_mount_dia / 2 + 1, bearing_h + 2]);
// tiny hole through the complete holder to seperate the ball from the holder if needed
color([0.9,0.5,0.5])// lightred
translate([0, 0, -bearing_h-$e])
cylinder(d = bearing_thread_hole, h = bearing_h+$e*2);
// sphere cut of the holder itself
color("gray")
translate([0, 0, - bearing_static_dia / 2])
sphere(d = bearing_static_dia, $fn = $fn);
// cut in order to see through from the side
if (cut_bearing_holder)
translate([-bearing_mount_dia,-bearing_mount_dia, -bearing_h*2])
cube([bearing_mount_dia *2, bearing_mount_dia, bearing_h *3]);
}
}
module bearing_holder_m6_vcn320()
{
l=bearing_h*0.7;
d=3.18;
l2=bearing_h-d*0.6;
difference()
{
union()
{
// main holder part for the m6 screw
translate([0,0,-bearing_h])
cylinder(d=bearing_mount_dia,h=l);
// ball bearing itself
%union()
{
// ball itself
color("red")
translate([0,0,-d/2])
sphere(d = d, $fn = $fn);
// metal champer for the ball
color("silver")
translate([0,0,-1 + d*0.2 -d/2])
cylinder(d2 = 3.5,d1 = 6,h=1);
// m6 rod
translate([0,0,-bearing_h+l2/2-$e])
threaded_rod(d=6, l=l2+$e, pitch=1.0);
}
}
// cut of the rod itself
translate([0,0,-bearing_h+l2/2-$e])
threaded_rod(d=6.1, l=l2, pitch=1.0);
if (cut_bearing_holder)
translate([-bearing_mount_dia,-bearing_mount_dia, -bearing_h*2])
cube([bearing_mount_dia *2, bearing_mount_dia, bearing_h *3]);
}
}
module bearing_holder_d3_vcn410()
{
S=0.6;
D1=3.6;
d=2;
L= 4;
D=3;
// bearing itself
% color([1,1,1,0.0])
{
translate([0,0,-d/2])
sphere(d=d);
translate([0,0,-S-1])
cylinder(d=D1,h=1);
translate([0,0,-L-S])
cylinder(d=D,h=L);
}
difference()
{
union()
{
translate([0,0,-bearing_h])
cylinder(d=bearing_mount_dia,h=bearing_h-L);
translate([0,0,-L-S+1/2])
cylinder(d1=bearing_mount_dia,d2=D+1,h=L-1);
}
// tiny hole through the complete holder to seperate the ball from the holder if needed
color([0.9,0.5,0.5])// lightred
translate([0, 0, -bearing_h-$e])
cylinder(d = bearing_thread_hole, h = bearing_h+$e*2);
// cut for the bearing itself
translate([0,0,-S-1])
cylinder(d=D1+$c,h=1);
translate([0,0,-L-S])
cylinder(d=D+$c,h=L);
}
}
module bearing_holder_mount()
{
translate([0, 0, -1-bearing_h])
{
difference()
{
cylinder(d=bearing_mount_dia+wall,h=bearing_h*0.75);
translate([0, 0, 1])
cylinder(d=bearing_mount_dia+$c*2,h=bearing_h+$e);
}
// add the flange
intersection()
{
cylinder(d=bearing_mount_dia+wall,h=bearing_h*0.75);
// cut of the flange
translate([0,bearing_mount_flange-$c, 0])// move in by flange
translate([0,-bearing_mount_dia/2, 0])// move to edge of cylinder
translate([-bearing_mount_dia,-bearing_mount_dia, -bearing_h*2])// center on on half
cube([bearing_mount_dia *2, bearing_mount_dia, bearing_h *3]);
}
}
}