Exit Full View
Up

/Printer/PinHeaderCover.foocad

PinHeaderCover
FooCAD Source Code
import static uk.co.nickthecoder.foocad.layout.v1.Layout2d.*
import static uk.co.nickthecoder.foocad.layout.v1.Layout3d.*

/**
 * Covers header pins (primarily for the Raspberry Pi, but can be used elsewhere.
 * 
 */
class PinHeaderCover : Model {

    val spacing = 2.54
    val height = 6.0
    val thickness = 0.8
    val baseThickness = 0.0
    val slack = 0.2    

    val across = 20
    val down = 2

    override fun build() : Shape3d {
        val pins = Cube( 1, 1, height )
            .repeatX( across, spacing)
            .repeatY( down, spacing)
            .centerXY()
            .previewOnly()

        val base = Square( across * spacing + slack, down * spacing + slack )
            .center()
    
        val sides = (base - base.offset(-thickness)).extrude( height )

        return if (baseThickness > 0) {
            pins + sides + base.extrude( baseThickness ) 
        } else {
            pins + sides
        }

    }
}