1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 22:28:16 +01:00
dotSCAD/examples/floor_stand/floor_stand_symbol.scad

77 lines
2.4 KiB
OpenSCAD
Raw Normal View History

2022-06-06 13:11:46 +08:00
use <util/split_str.scad>
use <multi_line_text.scad>
use <shape_taiwan.scad>
use <floor_stand.scad>
2019-09-11 09:40:26 +08:00
text = " Taiwan";
font = "Arial Black";
font_size = 5;
line_spacing = 7;
stand_width = 40;
stand_height = 80;
stand_thickness = 4;
2019-09-19 09:58:58 +08:00
stand_spacing = 0.5;
2019-09-11 09:40:26 +08:00
symbol_source = "DEFAULT"; // [DEFAULT, PNG, UNICODE]
/* [FOR PNG SYMBOL] */
symbol_png = ""; // [image_surface:100x100]
/* [FOR UNICODE SYMBOL] */
symbol_unicode = "X";
symbol_font = "Webdings";
symbol_font_size = 20;
module content(text, font, font_size, symbol_png, symbol_unicode, symbol_font, symbol_font_size, height, thickness, line_spacing) {
half_h = height / 2;
half_th = thickness / 2;
translate([0, -height / 1.8, thickness]) {
2019-09-26 08:24:48 +08:00
color("black")
linear_extrude(half_th / 2)
2022-04-04 14:36:41 +08:00
translate([0, -half_h / 3, 0])
multi_line_text(
split_str(text, " "),
font = font,
size = font_size,
line_spacing = line_spacing,
valign = "center",
halign = "center"
);
2019-09-11 09:40:26 +08:00
if(symbol_source == "DEFAULT") {
2019-09-26 08:24:48 +08:00
color("green")
translate([0, half_h / 5, 0])
scale([0.6, 0.6, 1])
linear_extrude(half_th / 2)
polygon(shape_taiwan(half_h * 1.5));
2019-09-11 09:40:26 +08:00
}
else if(symbol_source == "UNICODE") {
2019-09-26 08:24:48 +08:00
color("black")
linear_extrude(half_th / 2)
translate([0, half_h / 5, 0])
text(symbol_unicode, font = symbol_font, size = symbol_font_size, valign = "center", halign = "center");
2019-09-11 09:40:26 +08:00
}
else {
symbol_png_size = 100;
symbol_png_scale = 0.25;
2019-09-26 08:24:48 +08:00
color("black")
translate([0, half_h / 5, half_th / 4])
scale([symbol_png_scale, symbol_png_scale, 1])
2022-04-04 14:36:41 +08:00
difference() {
cube([symbol_png_size * 0.99, symbol_png_size * 0.99, stand_thickness / 4], center = true);
translate([0, 0, -50])
scale([1, 1, 100])
surface(symbol_png, center = true);
}
2019-09-11 09:40:26 +08:00
}
}
}
2019-09-19 09:58:58 +08:00
floor_stand(stand_width, stand_height, stand_thickness, stand_spacing)
2019-09-11 09:44:02 +08:00
content(text, font, font_size, symbol_png, symbol_unicode, symbol_font, symbol_font_size, stand_height, stand_thickness, line_spacing);