import static uk.co.nickthecoder.foocad.layout.v1.Layout2d.* import static uk.co.nickthecoder.foocad.layout.v1.Layout3d.* class FanAdaptor : Model { var hoseD = 100.0 var fanD = 85 var screwDist = 82 var thickness = 1.2 override fun build() : Shape3d { val cylinder = ExtrusionBuilder().apply { crossSection( Circle( hoseD/2 ) ) forward( 4 ) crossSection() forward(4) crossSection(-1) forward(4) crossSection() forward(4) crossSection(1) forward(4) crossSection() crossSection(-thickness) forward(-4) crossSection() forward(-4) crossSection(-1) forward(-4) crossSection() forward(-4) crossSection(1) forward(-4) crossSection() }.buildClosed() val holes = Circle( 2.5 ).translateX(screwDist).also().translateY(screwDist).also().center() val plate = ( Circle( hoseD/2 ) + Square( screwDist+10 ).roundAllCorners(3).center() - Circle( fanD/2 ) - holes ).extrude(thickness) return cylinder+plate } }