import static uk.co.nickthecoder.foocad.arrange.v1.Arrange.* import static uk.co.nickthecoder.foocad.layout.Layout2d.* import static uk.co.nickthecoder.foocad.layout.Layout3d.* /** I downloaded some stl files, and rather than manually slice and upload them to my printer, I chose to wrap them in a foocad script, so that I can use my FooCAD application to upload them. This is really weird, as I am parsing an stl file, and then generating a scad file from it, and then using that to produce a near exact copy of the original stl file, which is then sliced and uploaded. Ghost_emoji is WAY too big, so I added "smallGhost", "mediumGhost" and "thinGhost" Hanging_Bat is a nice idea, but its a bit "blocky" Maybe I should use the basic outline, and use foocad to round the edges! */ class Decorations : Model { @Piece fun wobbleStand() : Shape3d { val hole = Circle.hole(24/2) val small = hole.offset(1) val large = small.offset(8) val height = 20 val floor = (Circle( 21 ) - Circle( 13 )).extrude( 0.4 ) return ExtrusionBuilder().apply { forward( 3 ) crossSection( hole ) forward(-3) crossSection() crossSection(small) forward(height) crossSection(large) crossSection(large.offset(-1)) forward(-height+4+2) crossSection(small.offset(-1)) forward(-2) crossSection(small.offset(-3)) }.build().mirrorZ().toOriginZ() - Cylinder( 100, 10 ) + floor } @Piece fun hat() : Shape3d { val brim = Circle(15).hull( Circle(17).translateY(5) ) val main = brim.offset(-4) val inside = main.offset(-1) return ExtrusionBuilder().apply { turnX(-4) forward( 17 ) crossSection( inside.offset(-1) ) forward( -17 ) turnX(4) crossSection() crossSection( brim ) forward(1) crossSection() crossSection( main ) turnX(-4) forward(20) crossSection( main.offset(-1) ) crossSection( main.offset(-2) ) forward(-0.75) crossSection() }.build() } override fun build() : Shape3d { return arrangeX( 10, wobbleStand(), hat() ) } }