class ShedDoorKnob : Model { val stemD = 24 val axelD = 14 val stemL = 12 val holeZ = 8 fun profile() : Shape2d { return PolygonBuilder().apply { moveTo(0,0) lineTo(15,0) lineTo(25,5) lineTo(25,20) lineTo(0,10) }.build() } override fun build() : Shape3d { val stem = (Circle( stemD/2 ) - Circle( axelD/2 )) .extrude( stemL ) - Cylinder( 30, 2 ).rotateY(90).translateZ(holeZ) val profile = Circle( 20 ).sides(6).roundAllCorners(3) val knob = ExtrusionBuilder().apply { crossSection( profile ) forward( 5 ) // Chamfer front crossSection( 5 ) forward( 13 ) // Main crossSection() forward(2) // Chamfer back crossSection(-2) crossSection( -5 ) // Merge with the stem forward(5) crossSection( Circle( stemD/2 ) ) crossSection( Circle( axelD/2 ) ) forward(-20) crossSection() }.build() return knob + stem.mirrorZ().bottomTo( knob.top ) } }