Skip to content

Instantly share code, notes, and snippets.

@ryankurte
Created January 18, 2016 05:51
Show Gist options
  • Save ryankurte/c5cac98b2863eebc80e2 to your computer and use it in GitHub Desktop.
Save ryankurte/c5cac98b2863eebc80e2 to your computer and use it in GitHub Desktop.
3d printed barcode
barcode_width = 113;
barcode_height = 30;
barcode_depth = 2;
module_width = 1;
buffer = 4;
barcode = [
0, 0, 0, 0, 0, 0, 0, 0, 0, //quiet
1, 0, 1, //porch
0, 0, 1, 0, 0, 1, 1, //2 left_odd
0, 0, 1, 0, 0, 1, 1, //2 left_odd
0, 1, 1, 1, 0, 0, 1, //5 left_even
0, 0, 1, 1, 1, 0, 1, //4 left_even
0, 1, 1, 1, 1, 0, 1, //3 left_odd
0, 0, 0, 1, 0, 0, 1, //8 left_even
0, 1, 0, 1, 0, //center
1, 0, 1, 1, 1, 0, 0, //4 right
1, 1, 0, 0, 1, 1, 0, //1 right
1, 0, 0, 1, 1, 1, 0, //5 right
1, 0, 1, 1, 1, 0, 0, //4 right
1, 1, 0, 0, 1, 1, 0, //1 right
1, 1, 1, 0, 1, 0, 0, //9 right
1, 0, 1, //trailer
0, 0, 0, 0, 0, 0, 0, 0, 0 //quiet
];
offset = buffer;
difference() {
cube([barcode_height + buffer * 2, barcode_width * module_width + buffer * 2, barcode_depth]);
union() {
for (v = [0:barcode_width]) {
if(barcode[v] == 0) {
translate([buffer, buffer + module_width * v, 0]) {
cube([barcode_height, module_width, barcode_depth]);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment