import static uk.co.nickthecoder.foocad.arrange.v1.Arrange.* import static uk.co.nickthecoder.foocad.extras.v1.Extras.* import static uk.co.nickthecoder.foocad.chamferedextrude.v1.ChamferedExtrude.* class BottleCage : Model { var sectionSize = Vector2( 108, 49 ) var sectionR = 6 var thickness = 2.0 var clipWidth = 10 var bottleD = 70 var liningThickness = 1.2 var chamfer = 1 var baseHeight = 20 val baseHole = 10 val sides = 60 fun clip() : Shape3d { var profile = Square( sectionSize ).centerY().roundAllCorners( sectionR ) val ring = profile.offset( thickness ) - profile val clip = ring.extrude( clipWidth ).leftTo( 0 ) val fastner = ( Square(10,10).center().roundCorner(3,2).roundCorner(0,2).extrude( clipWidth ) - Cylinder( 10, 2.3 ).rotateX(90).translateZ(clipWidth/2) - Cylinder( 10, 2 ).rotateX(-90).translateZ(clipWidth/2) ).rightTo(0) val gap = Cube( 50, 1, 50 ).center() return (clip + fastner - gap).color("Orange") } @Piece fun singelScrewClip() : Shape3d { val clip : Shape3d = clip() val extra = Square( clip.size.z, 15 ).center().extrude(5) val hole = Cylinder( 20, 2 ) val screwMount = (extra remove hole).rotateY(90).translateZ(clipWidth/2).leftTo(clip.right-thickness) return clip and screwMount } // My screws are a little too long, so I want a thicker than average washer ;-) @Piece fun washer() : Shape3d { return (Circle( 5 ).sides(12) - Circle( 3 ).sides(12)).extrude(2) } override fun build() : Shape3d { return arrangeX( singelScrewClip(), washer() ) } }