Merged the bitmap module in http://github.com/tbuser/openscad-bitmap as a subdir
This commit is contained in:
commit
4268065e0b
17
bitmap/README
Normal file
17
bitmap/README
Normal file
|
@ -0,0 +1,17 @@
|
|||
This is an OpenSCAD module that let's you easily (well kinda) create 3D text. I've emulated the Atari 8-Bit fonts A-Z, a-z, 0-9, and most punctuation. You can create them a letter at a time or pass an array of characters. (OpenSCAD doesn't have any real string manipulation)
|
||||
|
||||
It also has a bitmap module that you can use to define your own fonts. It's pretty simple, you pass it an array of numbers, then tell it how many bits per row and it creates cubes (of configurable width and height) in a grid and combines them into a single shape. The number in the array sets the pixel height modifier. So if you set height to 5 and the array value is 2, then the height of that pixel will be 10mm.
|
||||
|
||||
Be careful when defining your own bitmaps in that you can't have two bits only connected diagonally. Otherwise OpenSCAD will say it's not manifold. For instance you can't have:
|
||||
|
||||
0 0 0
|
||||
0 1 0
|
||||
0 0 1
|
||||
|
||||
But you can have:
|
||||
|
||||
0 0 0
|
||||
0 1 1
|
||||
0 0 1
|
||||
|
||||
For more info see: http://www.thingiverse.com/thing:2054
|
24
bitmap/alphabet_block.scad
Normal file
24
bitmap/alphabet_block.scad
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
Parametric Alphabet Block
|
||||
Tony Buser <tbuser@gmail.com>
|
||||
http://tonybuser.com
|
||||
http://creativecommons.org/licenses/by/3.0/
|
||||
*/
|
||||
|
||||
<bitmap.scad>
|
||||
|
||||
// change to any letter
|
||||
letter = "A";
|
||||
|
||||
union() {
|
||||
difference() {
|
||||
cube(size = 20);
|
||||
translate(v = [2, 2, 17]) {
|
||||
cube(size = [16, 16, 5]);
|
||||
}
|
||||
}
|
||||
|
||||
translate(v = [10, 10, 15]) {
|
||||
8bit_char(letter, 2, 5);
|
||||
}
|
||||
}
|
1067
bitmap/bitmap.scad
Normal file
1067
bitmap/bitmap.scad
Normal file
File diff suppressed because it is too large
Load diff
31
bitmap/height_map.scad
Normal file
31
bitmap/height_map.scad
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
Height Map Example
|
||||
Tony Buser <tbuser@gmail.com>
|
||||
http://tonybuser.com
|
||||
http://creativecommons.org/licenses/by/3.0/
|
||||
|
||||
Can also dynamically run this by passing an array on the command line:
|
||||
|
||||
/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD -m make -D bitmap=[2,2,2,0,1,3,2,2,2] -D row_size=3 -s height_map.stl height_map.scad
|
||||
*/
|
||||
|
||||
<bitmap.scad>
|
||||
|
||||
block_size = 5;
|
||||
height = 5;
|
||||
|
||||
row_size = 10; // 10x10 pixels
|
||||
bitmap = [
|
||||
1,1,0,0,1,1,0,0,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
0,1,2,2,1,1,2,2,1,0,
|
||||
0,1,2,1,1,1,1,2,1,0,
|
||||
1,1,1,1,3,3,1,1,1,1,
|
||||
1,1,1,1,3,3,1,1,1,1,
|
||||
0,1,2,1,1,1,1,2,1,0,
|
||||
0,1,2,2,1,1,2,2,1,0,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,0,0,1,1,0,0,1,1
|
||||
];
|
||||
|
||||
bitmap(bitmap, block_size, height, row_size);
|
29
bitmap/name_tag.scad
Normal file
29
bitmap/name_tag.scad
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
Parametric Name Tag
|
||||
Tony Buser <tbuser@gmail.com>
|
||||
http://tonybuser.com
|
||||
http://creativecommons.org/licenses/by/3.0/
|
||||
*/
|
||||
|
||||
<bitmap.scad>
|
||||
|
||||
// change chars array and char_count
|
||||
// OpenSCAD has no string or length methods :(
|
||||
chars = ["M","a","k","e","r","B","o","t"];
|
||||
char_count = 8;
|
||||
|
||||
// block size 1 will result in 8mm per letter
|
||||
block_size = 1;
|
||||
// height is the Z height of each letter
|
||||
height = 3;
|
||||
|
||||
union() {
|
||||
translate(v = [0,-block_size*8*char_count/2+block_size*8/2,3]) {
|
||||
8bit_str(chars, char_count, block_size, height);
|
||||
}
|
||||
translate(v = [0,0,3/2]) {
|
||||
color([0,0,1,1]) {
|
||||
cube(size = [block_size * 8, block_size * 8 * char_count, 3], center = true);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue