/Electronics/SevenSegmentDisplay.foocad

A home-made 7 segment display.
Drill holes for LED pins (using as many LEDs as you want). Note, you can solder the LEDs, with very minimal melting of plastic!
Cover with acetate sheets of the same colour as your LEDs.
Try to use LEDs with a large angle of light (not highly directional), and consider bending the LEDs over so that they light up sidewards rather the straight outwards.
Print Notes
Either swap from white to black filament for the last couple of layers, or just colour the front black with a permanent marker.
Do not use transparent or semi-transparent filament, or light will leak from segment to the next.
import static uk.co.nickthecoder.foocad.layout.v1.Layout2d.*
import static uk.co.nickthecoder.foocad.layout.v1.Layout3d.*
class SevenSegmentDisplay : AbstractModel() {
// The number of digits
@Custom
var digits = 1
@Custom
var includeDecimalPoint = false
// Width of a digit (not including margins etc).
@Custom
var width = 25.0
@Custom
var height = 40.0
// Total thickness.
// Must be larger than your LED's head height plus the 'back' thickness.
@Custom
var thickness = 8.0
// Thickness of the back of the digits
// (where the led's legs stick through
// Use a value of 0 if you don't want a back (for example, if the
// LEDs are mounted on a circuit board, and this print is placed on top.
@Custom
var back=0.9
// The space around the digits
var marginX = 2.0
// The space around the digits
var marginY = 3.0
// The gap between digits.
// If printing a single digit, this has no effect.
var spacing = 1.0
fun digitShape() : Shape2d {
val name = if (includeDecimalPoint) "italic-dot" else "italic"
return SVGParser().parseFile( "sevenSegmentDisplay.svg" )
.shapes[name]
.toOrigin()
.convexity( 10 )
}
fun digit() : Shape3d {
val shape = digitShape()
val actualX = (width - marginX*2 - spacing * (digits-1)) / digits
val actualY = height - marginY*2
val scaled = shape.scale( actualX / shape.size.x, actualY / shape.size.y )
val solid = Cube( width, height, thickness )
val digitHoles = scaled
.extrude( thickness + back + 1 )
.tileX(digits,spacing)
.translate( marginX, marginY, back )
// I Used this to check the size, to make sure a 3mm LED would fit.
val debugLED = Cylinder(6,3/2).sides(10).color("Green")
.translate(3.9,9,0)
return solid - digitHoles // + debugLED
}
override fun build() : Shape3d {
return digit()
}
}

