Exit Full View
Up

/House/CurtainHooks.foocad

CurtainHooks
FooCAD Source Code
import static uk.co.nickthecoder.foocad.chamferedextrude.v1.ChamferedExtrude.*
/*
    You can buy these quite easily, but I wanted some RIGHT AWAY,
    and I could only find them on-line.

    The "glide" has been oriented so that the weakness of layer lines are as small as possible
    However, the hoop part is connected to the neck by very little plastic. And the hoop itself
    looks really weak!
    The mass produced parts fail quite often (which is why I *needed* to print more), and so far
    my 3D printed version seems weirdly stronger (I haven't seen a failure yet).

    Unlike the mass produced parts, I can slot my glides in and out easily without taking the
    rail apart. (I needed to shave the mass produced parts to do the same Grr).

    FYI, the mass produced parts always fail at the thin part of the neck.
    My parts are weakest at the hoop.

Print Notes

    The glide requires support material.
    Use the "tile" extension to print many copies at a time.
*/

class CurtainHooks : Model {
    
    var hookThickness = 3.0
    var hookChamfer = 0.4

    var gliderTabThickness = 2.0

    @Piece
    fun hook() : Shape3d {
        return SVGParser().parseFile( "CurtainHooks.svg" )
            .shapes["hook"]
            .center()
            .chamferedExtrude( hookThickness, hookChamfer )
            .color( "Yellow" )
    }

    @Piece
    fun glide() : Shape3d {
        val doc = SVGParser().parseFile( "CurtainHooks.svg" )
        println( "Names = ${doc.shapes.keySet()}" )
        val main2d = (
            doc.shapes["glideHead"] +
            doc.shapes["glideNeck"] +
            doc.shapes["glideTail"]
        )
        val profile = doc.shapes["glideProfile"].toOrigin()
            .extrude( main2d.size.y )
        val main = main2d.toOrigin().extrude(profile.size.z)
            .rotateX(90).frontTo(0)

        val tab = doc.shapes["glideTab"].translate(-main2d.corner)
            .extrude( gliderTabThickness )
            .rotateX(90).frontTo(0)
        val pin = Cylinder.hole( profile.size.y, tab.size.z/2, 10 )
            .rotateX(-90)
            .translateX( tab.left + tab.size.x / 2 )
            .translateZ( tab.bottom + tab.size.z / 2 )

        return ((main / profile) + tab + pin).color("Orange")
    }

    override fun build() : Shape3d {
        return hook().rotateZ(90).toOrigin() + glide().translateY(12)
    }
}