Skip to content

Instantly share code, notes, and snippets.

@tuefekci
Last active January 18, 2026 00:02
Show Gist options
  • Select an option

  • Save tuefekci/3ca7da764da5ce9ee6458ba33de02ade to your computer and use it in GitHub Desktop.

Select an option

Save tuefekci/3ca7da764da5ce9ee6458ba33de02ade to your computer and use it in GitHub Desktop.
Ikea Godvin Leg Riser 3D Print JSCAD https://openjscad.xyz
const { cuboid } = require('@jscad/modeling').primitives
const { subtract } = require('@jscad/modeling').booleans
const { translate } = require('@jscad/modeling').transforms
const main = (params) => {
const {
legWidth,
legDepth,
wallThickness,
baseThickness, // exact lift of the leg
lipHeight, // height of hollow ring around leg
tolerance,
flareExtra, // how much wider the flared base is
flareHeight // height of the flare
} = params
// --- Flared base ---
const flare = cuboid({
size: [
legWidth + wallThickness * 2 + flareExtra,
legDepth + wallThickness * 2 + flareExtra,
flareHeight
]
})
// Flare sits on the floor
const flareOnFloor = translate([0, 0, flareHeight / 2], flare)
// --- Base block (solid) ---
const basePre = cuboid({
size: [legWidth + wallThickness * 2, legDepth + wallThickness * 2, baseThickness]
})
// Base sits on top of flare
const base = translate([0, 0, baseThickness / 2 ], basePre)
// --- Ring/lip around leg ---
const outerRing = cuboid({
size: [legWidth + wallThickness * 2, legDepth + wallThickness * 2, lipHeight]
})
const innerCavity = cuboid({
size: [legWidth + tolerance, legDepth + tolerance, lipHeight]
})
const ring = subtract(outerRing, innerCavity)
// Ring sits on top of base
const ringOnBase = translate([0, 0, baseThickness + lipHeight / 2], ring)
// --- Return everything stacked ---
return [flareOnFloor, base, ringOnBase]
}
module.exports = { main }
module.exports.getParameterDefinitions = () => [
{ name: 'legWidth', type: 'float', initial: 50, caption: 'Leg width (mm)' },
{ name: 'legDepth', type: 'float', initial: 30, caption: 'Leg depth (mm)' },
{ name: 'wallThickness', type: 'float', initial: 4, caption: 'Wall thickness (mm)' },
{ name: 'baseThickness', type: 'float', initial: 50, caption: 'Height of solid base / lift (mm)' },
{ name: 'lipHeight', type: 'float', initial: 30, caption: 'Height of hollow ring around leg (mm)' },
{ name: 'tolerance', type: 'float', initial: 2, caption: 'Tolerance around leg (mm)' },
{ name: 'flareExtra', type: 'float', initial: 20, caption: 'Extra width/depth of flared base (mm)' },
{ name: 'flareHeight', type: 'float', initial: 5, caption: 'Height of flared base (mm)' }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment