Skip to content

Commit

Permalink
char_count can be determined using len(), so no need to pass it as an…
Browse files Browse the repository at this point in the history
… argument
  • Loading branch information
Karel Vervaeke committed Aug 4, 2013
1 parent 1533d78 commit da49a8e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions bitmap/name_tag.scad
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ use <bitmap.scad>

/*
chars = chars array
char_count = number of characters (OpenSCAD has no string or length methods)
block_size = letter size (block size 1 will result in 8mm per letter)
height = the Z height of each letter in mm
key_ring_hole = (boolean) Append a hole to a keyring, necklace etc. ?
*/
module name_tag(chars = ["R", "E", "P", "R", "A", "P"], char_count = 6,
module name_tag(chars = ["R", "E", "P", "R", "A", "P"],
block_size = 2, height = 3, key_ring_hole = true) {
char_count = len(chars);
union() {
translate(v = [0,-block_size*8*char_count/2+block_size*8/2,3]) {
8bit_str(chars, char_count, block_size, height);
Expand Down
12 changes: 6 additions & 6 deletions bitmap/test_name_tag.scad
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
include <../bitmap/name_tag.scad>;

translate([0,0,0])
name_tag(["n","a","m","e","_","t","a","g"], 8);
name_tag("name_tag");

translate([20,0,0]) // 0 + 16/2 + 16/2 + 4
name_tag(["N","A","M","E","_","T","A","G"], 8);
name_tag("NAME_TAG");

translate([52,0,0]) // 20 + 16/2 + 40/2 + 4
name_tag(chars=["n","a","m","e","_","t","a","g"], char_count=8, block_size=5);
name_tag("name_tag", block_size=5);

translate([96,0,0]) // 52 + 40/2 + 40/2 + 4
name_tag(chars=["N","A","M","E","_","T","A","G"], char_count=8, block_size=5);
name_tag("NAME_TAG", block_size=5);

translate([130,0,0]) // 92 + 40/2 + 16/2 + 4
name_tag(["n","a","m","e","_","t","a","g"], char_count=8, height=30);
name_tag("name_tag", height=30);

translate([150,0,0]) // 130 + 16/2 + 16/2 + 4
name_tag(["N","A","M","E","_","T","A","G"], char_count=8, height=30);
name_tag("NAME_TAG", height=30);

0 comments on commit da49a8e

Please sign in to comment.