import static uk.co.nickthecoder.foocad.layout.v1.Layout2d.* import static uk.co.nickthecoder.foocad.layout.v1.Layout3d.* class ShelfBracketSpacer : Model { @Custom( about="The space between the shelf and the bracket" ) var space = 4.0//1.0 @Custom( about="margin and height of the inner part" ) var inset = Vector2( 2.0, 1.2 ) fun profile() = Square( 252, 27 ).roundAllCorners(2).centerY() override fun build() : Shape3d { val profile : Shape2d = profile() val hole = Circle( 4 ) val holes = hole.translateX( 22 ) + hole.translateX( 150 ) + hole.translateX( 215 ) val gaps = Square( (profile.size.x - 40) / 4 - 10, profile.size.y- inset.x * 2 - 2 * 2 ).center() .tileX( 4, 10 ).rightTo(profile.right - 20) val base = profile - gaps - holes val inner = profile.offset( - inset.x ) val innerRing = inner - inner.offset( -2 ) return (base).extrude( space ) + innerRing.translateX( inset.x ).extrude( space + inset.y ).color("Orange") } }