// LetterBlock.scad - Basic usage of text() and linear_extrude()
FAARegistration = "FA3FC9PKMX";
// Module instantiation
scale([.5,.5,.5]) LetterBlock(FAARegistration);
// Module definition.
// size=30 defines an optional parameter with a default value.
module LetterBlock(letter, size=30) {
difference() {
translate([0,0,size/4]) roundedcube([size*8,size,size/4], center=true, radius=2, apply_to="zmax");
translate([-4,0,8]) {
// convexity is needed for correct preview
// since characters can be highly concave
linear_extrude(height=20, convexity=8)
text(letter,
size=size*22/30,
font="Bitstream Vera Sans",
halign="center",
valign="center");
}
translate([100,0,12]) scale([0.27,0.27,1])surface(file="BFEFootprint50x63.png", invert=true, center=true);
}
}
echo(version=version());
// Written by Marius Kintel <marius@kintel.net>
//
// To the extent possible under law, the author(s) have dedicated all
// copyright and related and neighboring rights to this software to the
// public domain worldwide. This software is distributed without any
// warranty.
//
// You should have received a copy of the CC0 Public Domain
// Dedication along with this software.
// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
// Higher definition curves
$fs = 0.01;
module roundedcube(size = [1, 1, 1], center = false, radius = 0.5, apply_to = "all") {
// If single value, convert to [x, y, z] vector
size = (size[0] == undef) ? [size, size, size] : size;
translate_min = radius;
translate_xmax = size[0] - radius;
translate_ymax = size[1] - radius;
translate_zmax = size[2] - radius;
diameter = radius * 2;
module build_point(type = "sphere", rotate = [0, 0, 0]) {
if (type == "sphere") {
sphere(r = radius);
} else if (type == "cylinder") {
rotate(a = rotate)
cylinder(h = diameter, r = radius, center = true);
}
}
obj_translate = (center == false) ?
[0, 0, 0] : [
-(size[0] / 2),
-(size[1] / 2),
-(size[2] / 2)
];
translate(v = obj_translate) {
hull() {
for (translate_x = [translate_min, translate_xmax]) {
x_at = (translate_x == translate_min) ? "min" : "max";
for (translate_y = [translate_min, translate_ymax]) {
y_at = (translate_y == translate_min) ? "min" : "max";
for (translate_z = [translate_min, translate_zmax]) {
z_at = (translate_z == translate_min) ? "min" : "max";
translate(v = [translate_x, translate_y, translate_z])
if (
(apply_to == "all") ||
(apply_to == "xmin" && x_at == "min") || (apply_to == "xmax" && x_at == "max") ||
(apply_to == "ymin" && y_at == "min") || (apply_to == "ymax" && y_at == "max") ||
(apply_to == "zmin" && z_at == "min") || (apply_to == "zmax" && z_at == "max")
) {
build_point("sphere");
} else {
rotate =
(apply_to == "xmin" || apply_to == "xmax" || apply_to == "x") ? [0, 90, 0] : (
(apply_to == "ymin" || apply_to == "ymax" || apply_to == "y") ? [90, 90, 0] :
[0, 0, 0]
);
build_point("cylinder", rotate);
}
}
}
}
}
}
}