FlowCad is the fast, free, and precise web app for 3D design and printing. Build professional parametric models with ease-no programming required, but it's there if you need it.
const PARAMS = {
radius: 5,
height: 10,
dim: 'disabled',
wall: 0.4,
wallInside: true,
bottomClosed: true,
segments: 30,
}
let { dim, wall, wallInside, radius } = PARAMS
let innerRadius = radius - wall
if (!wallInside) {
radius += wall
innerRadius += wall
}
// 1. Create the outer hull
const outer = Manifold.cylinder(PARAMS.height, radius, radius, PARAMS.segments)
let result: Manifold
// 2. The inner hole should be shorter if we want a bottom wall
// Height = total height MINUS the wall thickness
//let innerHeight2 = PARAMS.bottomClosed ? PARAMS.height : PARAMS.height + 2 // +2 to ensure clean cut if through
let inner = Manifold.cylinder(PARAMS.height, innerRadius, innerRadius, PARAMS.segments)
if (PARAMS.bottomClosed) {
// If centered, we translate to "lift" it off the bottom.
// If the cylinder starts at 0, we translate by 'wall'.
// To be safe for both cases, let's align them.
inner = inner.translate([0, 0, wall])
}
if (wall < PARAMS.radius) {
result = outer.subtract(inner)
} else {
result = outer
}
return { result, PARAMS }