Created
October 27, 2024 14:57
-
-
Save maruel/4e82f06eadabccf1283502135725405f to your computer and use it in GitHub Desktop.
parametric-bearing-pillow-block
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://zoo.dev/docs/kcl-samples/a-parametric-bearing-pillow-block | |
// rewritten as a function. | |
// MARUEL: Currently not working as I don't know how to boolean merge two extrudes. | |
// A Parametric Bearing Pillow Block | |
// A bearing pillow block, also known as a plummer block or pillow block bearing, is a pedestal used to provide support for a rotating shaft with the help of compatible bearings and various accessories. Housing a bearing, the pillow block provides a secure and stable foundation that allows the shaft to rotate smoothly within its machinery setup. These components are essential in a wide range of mechanical systems and machinery, playing a key role in reducing friction and supporting radial and axial loads. | |
fn bearingPillowBlock = (length, width, height, cbDepth, cbDia, holeDia, padding, bearingDia) => { | |
// (Needs to be updated). Sketch the block and extrude up to where the counterbore diameter starts. | |
block = startSketchOn('XY') | |
|> startProfileAt([-width / 2, -length / 2], %) | |
|> lineTo([width / 2, -length / 2], %) | |
|> lineTo([width / 2, length / 2], %) | |
|> lineTo([-width / 2, length / 2], %) | |
|> close(%) | |
|> hole(circle({ | |
center: [ | |
-(width / 2 - (padding / 2)), | |
-(length / 2 - (padding / 2)) | |
], | |
radius: holeDia / 2 | |
}, %), %) | |
|> hole(circle({ | |
center: [ | |
-(width / 2 - (padding / 2)), | |
length / 2 - (padding / 2) | |
], | |
radius: holeDia / 2 | |
}, %), %) | |
|> hole(circle({ | |
center: [ | |
width / 2 - (padding / 2), | |
length / 2 - (padding / 2) | |
], | |
radius: holeDia / 2 | |
}, %), %) | |
|> hole(circle({ | |
center: [ | |
width / 2 - (padding / 2), | |
-(length / 2 - (padding / 2)) | |
], | |
radius: holeDia / 2 | |
}, %), %) | |
|> hole(circle({ | |
center: [0, 0], | |
radius: bearingDia / 2 | |
}, %), %) | |
|> extrude(height - cbDepth, %) | |
// Create a second sketch that creates the counterbore diameters and extrude the rest of the way to get the total height. Note: You cannot use startSketchOn(block, 'end'). The extrude lives outside the bounds, and the engine will not execute. This is a known issue. | |
secondHalf = startSketchOn({ | |
plane: { | |
origin: { x: 0, y: 0, z: height - cbDepth }, | |
xAxis: { x: 1, y: 0, z: 0 }, | |
yAxis: { x: 0, y: 1, z: 0 }, | |
zAxis: { x: 0, y: 0, z: 1 } | |
} | |
}) | |
|> startProfileAt([-width / 2, -length / 2], %) | |
|> lineTo([width / 2, -length / 2], %) | |
|> lineTo([width / 2, length / 2], %) | |
|> lineTo([-width / 2, length / 2], %) | |
|> close(%) | |
|> hole(circle({ | |
center: [ | |
-(width / 2 - (padding / 2)), | |
-(length / 2 - (padding / 2)) | |
], | |
radius: cbDia / 2 | |
}, %), %) | |
|> hole(circle({ | |
center: [ | |
-(width / 2 - (padding / 2)), | |
length / 2 - (padding / 2) | |
], | |
radius: cbDia / 2 | |
}, %), %) | |
|> hole(circle({ | |
center: [ | |
width / 2 - (padding / 2), | |
length / 2 - (padding / 2) | |
], | |
radius: cbDia / 2 | |
}, %), %) | |
|> hole(circle({ | |
center: [ | |
width / 2 - (padding / 2), | |
-(length / 2 - (padding / 2)) | |
], | |
radius: cbDia / 2 | |
}, %), %) | |
|> hole(circle({ | |
center: [0, 0], | |
radius: bearingDia / 2 | |
}, %), %) | |
|> extrude(cbDepth, %) | |
// MARUEL: How to merge the two blocks? | |
return block | secondHalf | |
} | |
// Define constants such as length, width, height, counter-bore depth and diameter, bearing diameter, hole location padding, and more | |
length = 6 | |
width = 4 | |
height = 1 | |
cbDepth = .25 | |
cbDia = .7 | |
holeDia = .375 | |
padding = 1.5 | |
bearingDia = 3 | |
bearingPillowBlock(length, width, height, cbDepth, cbDia, holeDia, padding, bearingDia) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment