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, 1, 1, 0 ],
- [ 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0 ],
- [ 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1 ],
- [ 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1 ],
- [ 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0 ],
- [ 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1 ],
- [ 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1 ],
- [ 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0 ] ];
- qr_module_size = 1.8;
- qr_height = 0.2;
- mark_border = 3;
- mark_size = (21 * qr_module_size) + (2 * mark_border);
- mark_height = 1.6;
- mark_text_line_height = 14;
- title = "Hradecká";
- title_font_size = 5.6;
- cena_text = "40 Kč";
- cena_font_size = 5;
- cena_spacing = 0.9;
- mark_bottom_line_height = 5;
- subtitle = "Leženka";
- bottom_font_size = 4.2;
- bottom_spacing = 0.95;
- bottom = "poukaz na nocleh";
- vodoznak_height = 0.6;
- main();
- module main()
- {
- //marka
- difference()
- {
- union()
- {
- //marka
- translate([ 0, 0 ])
- {
- color("#FF8844") linear_extrude(mark_height) make_round(ro = 5) square([ mark_size, mark_size + mark_text_line_height + mark_bottom_line_height ]);
- }
- //Poutko
- translate([ mark_size / 2, mark_size + mark_bottom_line_height + mark_text_line_height, 0 ])
- {
- color("#FF8844") linear_extrude(mark_height) circle(5, $fn = 128);
- }
- }
- //vodoznak charity
- translate([ mark_border + 1, mark_border, 0.4 ])
- {
- linear_extrude(height = vodoznak_height)
- {
- color("#FF0000")
- scale(1.0)
- import("logo-charita.svg");
- }
- }
- //díra v poutku
- translate([ mark_size / 2, mark_size + mark_bottom_line_height + mark_text_line_height, -0.1 ])
- {
- color("#FF0000") linear_extrude(mark_height + 1) circle(2.8, $fn = 128);
- }
- }
- //Nadpis a podnadpis a cena
- translate([ mark_border, mark_size + mark_text_line_height - mark_border, mark_height ])
- {
- //Nadpis
- color("#000000") linear_extrude(qr_height) text(title, size = title_font_size, font = "impact");
- //Podnadpis
- translate([ 0, (title_font_size + mark_border / 2) * -1, 0 ])
- {
- color("#000000") linear_extrude(qr_height) text(subtitle, size = title_font_size, font = "impact");
- }
- //Cena
- rotate(90){
- translate([ (title_font_size+2) *-1, (mark_size - cena_font_size - (mark_border/2)) *-1, 0 ])
- {
- color("#000000") linear_extrude(qr_height) text(cena_text, size = cena_font_size, spacing=cena_spacing, font = "impact");
- }}
- }
- //Dolní text
- translate([ mark_border - 0.5, mark_border - 1, mark_height ])
- {
- color("#000000") linear_extrude(qr_height) text(bottom, size = bottom_font_size, font = "impact", spacing = bottom_spacing);
- }
- //QR Kod
- translate([ mark_border, mark_border + mark_bottom_line_height, mark_height ])
- {
- color("#000000") qr_render(qr_data);
- }
- }
- // QR code rendering method
- module qr_render(data, module_size = qr_module_size, height = qr_height)
- {
- maxmod = len(data) - 1;
- union()
- {
- for (r = [0:maxmod])
- {
- for (c = [0:maxmod])
- {
- if (data[r][c] == 1)
- {
- xo = c * module_size;
- yo = (maxmod - r) * module_size;
- translate([ xo, yo, 0 ]) cube([ module_size, module_size, height ]);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement