FooCAD Source Codeimport static uk.co.nickthecoder.foocad.changefilament.v1.ChangeFilament.*
import static uk.co.nickthecoder.foocad.layout.Layout2d.*
import static uk.co.nickthecoder.foocad.layout.Layout3d.*
class PlantLabel : Model {
var piece = ""
var thickness = 0.8
var fontSize = 9
var length = 60
var changeColor = true
override fun build() : Shape3d {
// Give the new colour time to blend in by making more layers than normal
var textHeight = 0.4
val text = Text( piece ?: "", fontSize ).centerY()
.translateX(5)
.extrude( thickness + textHeight )
.color( "Blue" )
val width = text.size.y-2
val outline = PolygonBuilder().apply {
radius(5)
moveTo(0,0)
lineTo(0,width)
lineTo(length,width)
radius(1)
lineTo(length+ width*1.5,width/2)
radius(5)
lineTo(length,0)
}.build().centerY()
val one = outline.extrude(thickness) + text
return one
}
// The white labels will look like "regular" ones if we print them
// in white, so I will print them black, with white writing.
// All the others can be a single colour.
/*
override fun postProcess(gcode: GCode) {
if ( changeColor ) {
pauseAtHeight( gcode, thickness, "Change Filament" )
}
}
*/
}