include WoodenBlock.foocad class Dice : WoodenBlock() { fun dieText( str : String ) : Shape3d { val text = Text( str.toUpperCase(), size * 0.3 ) .hAlign(CENTER) .vAlign(MIDDLE) .offset( 0.2 ) val outsides = listOf() for ( path in text.paths ) { if (!path.isHole()) { outsides.add(path) //println( "Added" ) } } val shape = Polygon( outsides ) //return ExtrusionBuilder.drum(two.offset(-embossDepth*0.9), two, embossDepth+0.01) return ExtrusionBuilder.extrude(shape, embossDepth+0.01) } fun die( a : String, b : String, c : String, d : String, e : String, f : String ) : Shape3d { val style = TextStyle( DEFAULT_FONT, size * 0.3 ).hAlign(CENTER).vAlign(MIDDLE) val t = embossDepth val ta = dieText(a).rotateX(90).translate(size*0.5,t,size *0.5) val tb = dieText(b).translate(size*0.5, size*0.5, size-gap-t) val tc = dieText(c).rotateX(180).translate(size*0.5,size*0.5,t) val td = dieText(d).rotateX(-90).translate(size*0.5,size-t-gap,size*0.5) val te = dieText(e).rotateY(-90).translate(t,size*0.5, size*0.5) val tf = dieText(f).rotateY(90).translate(size-t-gap,size*0.5,size*0.5) return piece( "aa", "Silver", "" ) - ta - tb - tc - td - te - tf } override fun build() : Shape3d { return die( "tap\ndie", "dip\ntie", "rad\ntea", "tie\npin", "pie\nlad", "pay\nten" ) } }