import static uk.co.nickthecoder.foocad.changefilament.v1.ChangeFilament.* /* NOTE, Poppy tested this label, and it only lasted a year - the outline fell off, and then one of the telephone number's digits also fell off. So consider using DogLabel2 instead, which is more robust (hopefully!). I recommend printing in 3 colours. */ class DogLabel : Model, PostProcessor { @Custom( about="Your phone number", lines=2) var front = "PHONE\nNUMBER" @Custom( about="Your pet's name" ) var back = "NAME" // The thickness, NOT including the "outdent" var thickness = 1.4 // Depth of the writing on the bottom var indent = 0.8 // Height of the writing on the top var outdent = 0.6 override fun build() : Shape3d { val frontText = Text( front, 7 ).hAlign(CENTER).center() .extrude( outdent+0.2) .bottomTo(thickness-0.2) .color( "Green" ) val backText = Text( back, BOLD, 9 ).hAlign(CENTER) .offset(0.2) // Make it bolder .mirrorX().center() .extrude( indent + 0.01 ).translateZ(-0.1) val width = Math.max( frontText.size.x, backText.size.x ) val height = Math.max( frontText.size.y, backText.size.y ) val hoop = (Circle( 10 ).translateY(-2) - Circle( 5 )) .translateY( height - 10 ) val main = Square(width + 5, height + 2).center().roundAllCorners(5) val both = hoop + main val outline = (both - both.offset(-0.8)) .extrude(outdent+0.2) .bottomTo(thickness-0.2) .color("Green") //return both.extrude(thickness) - backText + frontText + outline return both.extrude(thickness) -backText + frontText + outline } // This is the main focus of this example! Also not that the class must implement PostProcessor. override fun postProcess(gcode: GCode) { gcode.pauseAtHeight( indent, "Change Filament : Middle" ) gcode.pauseAtHeight( thickness, "Change Filament : Top" ) } }