class Sachin : Model { @Custom( about="The width of the stokes" ) var width = 3 // The height of the stencil will be height + margin * 2 @Custom( about="The height of the words (used to scale the svg appropriately)") var height = 40 @Custom( about="Thickness of the stencil" ) var thickness = 1.8 @Custom( about="Width and height of the joining parts, which prevent the middle of letters being detatched" ) var joinSize = Vector2(3, thickness-0.4) @Custom( about="The margin around the words, forming the rectangular stencil" ) var margin = 20 @Custom( about="Radius of the stencil's corners" ) var radius = 10 override fun build() : Shape3d { var doc = SVGParser().parseFile("sachin.svg") val group = doc.shapes["lines"] as Union2d var vertical = doc.shapes["vertical"] var horizontal = doc.shapes["horizontal"] var lines : Shape2d = Union2d() for shape in group.dependencies2d { println( "Shape $shape" ) for path in shape.paths { lines += path.thickness( width ) } } val scale = height / lines.size.y val name = lines.scale( scale ) val background = name.boundingSquare().offset( margin ).roundAllCorners(radius) val main = (background - name).extrude(thickness) val joinVertical = vertical.paths[0].thickness(joinSize.x).translateX(-width/2-joinSize.x/2) .scale( scale ) .extrude( joinSize.y ).color("Red") val joinHorizontal = horizontal.paths[0].thickness(joinSize.x) .scale( scale ) .extrude( joinSize.y ).color("Red") return (main + joinVertical + joinHorizontal).centerXY() } }