Exit Full View
Up

/Nalin/ShowerCurtainHook.foocad

ShowerCurtainHook
FooCAD Source Code
/*
A hook for Nalin's parents' shower curtain.
Note, you can BUY similar items for hanging Christmas decorations.
But they aren't the same size and are typically green :-(

Only needed 1 piece. Printed with PLA, but PETG is probably better???
*/
class ShowerCurtainHook : Model {

    @Custom
    var length = 30

    @Custom
    var thickness = 2
    
    @Custom
    var depth = 2

    override fun build() : Shape3d {
        val path = SVGParser().parseFile( "ShowerCurtainHook.svg" ).shapes["path"].toOrigin().firstPath
        val scale = (length - thickness) / (path.extent.second.x)
        val scaled = path.scale( Vector2(scale, scale) )
        val shape = scaled.thickness( thickness ) +
            Circle( thickness / 2 ).sides(20).translate(scaled.points[0]) +
            Circle( thickness / 2 ).sides(20).translate(scaled.points[ scaled.points.size() - 1 ] )

        // Was having bed adhesion issues, so addded extra bits, which are easier to remove than a full brim.
        val brim = Circle( 5 ).translate(scaled.points[0]).translate(1,1) +
            Square( 15, 6 ).translate(1, -6) +
            Square( 5, 8 ).leftTo( shape.right -1 )

        return shape.extrude(depth) +
            brim.extrude(0.2).color("White").opacity(0.1)
    }
}