Add inner sleeve knurling option
This commit is contained in:
parent
6a10fa96ee
commit
38e29eb868
@ -12,11 +12,43 @@ function getParameterDefinitions () {
|
||||
{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_diameter', type: 'float', initial: 10, min: 1, max: 40, step: 1, caption: 'Bushing diameter'},
|
||||
{name: 'taper', type: 'checkbox', checked: true, caption: 'Taper Edges?'}
|
||||
{name: 'taper', type: 'checkbox', checked: true, caption: 'Taper Edges?'},
|
||||
{name: 'knurling', type: 'checkbox', checked: false, caption: 'Add knurling?'}
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
function knurling(p) {
|
||||
const knurls = [];
|
||||
|
||||
const bushing_radius = p.bushing_diameter / 2;
|
||||
const thread_radius = bushing_radius * 0.72
|
||||
const twist_angle = 45;
|
||||
const overlap = 2;
|
||||
const twist = twist_angle * p.bushing_height / thread_radius;
|
||||
const threads = 360 / twist_angle * overlap;
|
||||
const triangle = polygon([
|
||||
[thread_radius, thread_radius],
|
||||
[0, thread_radius],
|
||||
[0, 0],
|
||||
[thread_radius, 0]
|
||||
]);
|
||||
|
||||
for (let i=0; i < threads; ++i) {
|
||||
knurls.push(
|
||||
linear_extrude({height: p.bushing_height, twist, slices: 30}, triangle)
|
||||
.rotateZ(360 / threads * i)
|
||||
.translate([0, 0, -p.bushing_height/2])
|
||||
);
|
||||
knurls.push(
|
||||
linear_extrude({height: p.bushing_height, twist: -twist, slices: 30}, triangle)
|
||||
.rotateZ(360 / threads * i)
|
||||
.translate([0, 0, -p.bushing_height/2])
|
||||
);
|
||||
}
|
||||
return union(...knurls);
|
||||
}
|
||||
|
||||
function donut(p) {
|
||||
const inner_radius = (p.bushing_height - p.host_hole_height) / 2;
|
||||
const outer_radius = p.overhang + p.host_hole_diameter/2 - inner_radius;
|
||||
@ -54,7 +86,11 @@ function host_hole(p) {
|
||||
}
|
||||
|
||||
function bushing_sleeve(p) {
|
||||
return cylinder({r: p.bushing_diameter/2, h: p.bushing_height, center: true});
|
||||
const sleeve = cylinder({r: p.bushing_diameter/2, h: p.bushing_height, center: true});
|
||||
if (p.knurling) {
|
||||
return union(sleeve, knurling(p));
|
||||
}
|
||||
return sleeve;
|
||||
}
|
||||
|
||||
function main(p) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user