Make taper work for taller bushings
This commit is contained in:
parent
9a1da123dd
commit
6a10fa96ee
@ -1,7 +1,7 @@
|
|||||||
/// title : Basic Sleeved Rubber Bushing
|
/// title : Basic Sleeved Rubber Bushing
|
||||||
// author : Tim Farrell
|
// author : Tim Farrell
|
||||||
// license : MIT License
|
// license : MIT License
|
||||||
// revision : 2
|
// revision : 3
|
||||||
// tags : Rubber
|
// tags : Rubber
|
||||||
// file : bushing.jscad
|
// file : bushing.jscad
|
||||||
|
|
||||||
@ -11,26 +11,36 @@ function getParameterDefinitions () {
|
|||||||
{name: 'host_hole_diameter', type: 'float', initial: 13, min: 1, max: 40, step: 1, caption: 'Host hole diameter'},
|
{name: 'host_hole_diameter', type: 'float', initial: 13, min: 1, max: 40, step: 1, caption: 'Host hole diameter'},
|
||||||
{name: 'host_hole_height', type: 'float', initial: 0.8, caption: 'Host hole height'},
|
{name: 'host_hole_height', type: 'float', initial: 0.8, caption: 'Host hole height'},
|
||||||
{name: 'bushing_height', type: 'float', initial: 4, min: 1, max: 40, step: 1, caption: 'Bushing height'},
|
{name: 'bushing_height', type: 'float', initial: 4, min: 1, max: 40, step: 1, caption: 'Bushing height'},
|
||||||
{name: 'bushing_diameter', type: 'float', initial: 10, min: 1, max: 40, step: 1, caption: 'Bushing diameter'}
|
{name: 'bushing_diameter', type: 'float', initial: 10, min: 1, max: 40, step: 1, caption: 'Bushing diameter'},
|
||||||
|
{name: 'taper', type: 'checkbox', checked: true, caption: 'Taper Edges?'}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function donut(p) {
|
function donut(p) {
|
||||||
const outer_radius = p.overhang + p.host_hole_diameter/2 - p.bushing_height/2;
|
const inner_radius = (p.bushing_height - p.host_hole_height) / 2;
|
||||||
const inner_radius = p.bushing_height/2;
|
const outer_radius = p.overhang + p.host_hole_diameter/2 - inner_radius;
|
||||||
return torus({ ri: inner_radius, ro: outer_radius });
|
const z_offset = p.bushing_height/2 - (p.bushing_height/2 - p.host_hole_height/2);
|
||||||
|
return union(
|
||||||
|
torus({ ri: inner_radius, ro: outer_radius }).translate([0, 0, z_offset]),
|
||||||
|
torus({ ri: inner_radius, ro: outer_radius }).translate([0, 0, -z_offset])
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function bushing_main(p) {
|
function bushing_main(p) {
|
||||||
return union(
|
const outer_radius = p.overhang + p.host_hole_diameter/2;
|
||||||
cylinder({
|
const main_cylinder = cylinder({
|
||||||
r: p.overhang + p.host_hole_diameter/2 - p.bushing_height/2,
|
r: outer_radius - (p.taper ? (p.bushing_height - p.host_hole_height) / 2 : 0),
|
||||||
h: p.bushing_height,
|
h: p.bushing_height,
|
||||||
center: true
|
center: true
|
||||||
}),
|
});
|
||||||
donut(p)
|
if (p.taper) {
|
||||||
);
|
return union(
|
||||||
|
main_cylinder,
|
||||||
|
donut(p)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return main_cylinder;
|
||||||
}
|
}
|
||||||
|
|
||||||
function host_hole(p) {
|
function host_hole(p) {
|
||||||
@ -52,5 +62,5 @@ function main(p) {
|
|||||||
bushing_main(p),
|
bushing_main(p),
|
||||||
host_hole(p),
|
host_hole(p),
|
||||||
bushing_sleeve(p)
|
bushing_sleeve(p)
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user