mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-21 05:52:16 +02:00
add floor_stand_symbol
This commit is contained in:
144
examples/floor_stand/floor_stand.scad
Normal file
144
examples/floor_stand/floor_stand.scad
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
module floor_stand(width, height, thickness, joint_spacing, line_spacing) {
|
||||||
|
half_w = width / 2;
|
||||||
|
half_h = height / 2;
|
||||||
|
half_th = thickness / 2;
|
||||||
|
half_sc = joint_spacing / 2;
|
||||||
|
|
||||||
|
$fn = 24;
|
||||||
|
|
||||||
|
points = [
|
||||||
|
[half_w, -half_h], [width / 2.25, half_h],
|
||||||
|
[-width / 2.25, half_h], [-half_w, -half_h]
|
||||||
|
];
|
||||||
|
|
||||||
|
module board_base() {
|
||||||
|
difference() {
|
||||||
|
polygon(points);
|
||||||
|
translate([0, -half_h, 0])
|
||||||
|
scale([0.6, 0.1])
|
||||||
|
polygon(points);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module joint_top() {
|
||||||
|
linear_extrude(thickness / 4 + half_sc, scale = 0.1)
|
||||||
|
circle(thickness / 4 + half_sc);
|
||||||
|
}
|
||||||
|
|
||||||
|
module stick() {
|
||||||
|
linear_extrude(thickness * 0.75)
|
||||||
|
square([width / 12, half_w], center = true);
|
||||||
|
}
|
||||||
|
|
||||||
|
module slot_df() {
|
||||||
|
translate([0, -half_h - thickness, -half_th])
|
||||||
|
stick();
|
||||||
|
}
|
||||||
|
|
||||||
|
module border() {
|
||||||
|
translate([0, 0, half_th])
|
||||||
|
color("black") linear_extrude(half_th / 2)
|
||||||
|
hollow_out(shell_thickness = font_size / 4)
|
||||||
|
offset(half_w / 10)
|
||||||
|
scale([0.75, 0.675])
|
||||||
|
polygon(points);
|
||||||
|
}
|
||||||
|
|
||||||
|
module board1() {
|
||||||
|
difference() {
|
||||||
|
union() {
|
||||||
|
linear_extrude(thickness, center = true)
|
||||||
|
difference() {
|
||||||
|
translate([0, -half_h, 0])
|
||||||
|
board_base();
|
||||||
|
square([width / 1.5, height / 3], center = true);
|
||||||
|
}
|
||||||
|
rotate([0, 90, 0])
|
||||||
|
linear_extrude(width / 2.25 * 2, center = true)
|
||||||
|
circle(thickness / 2);
|
||||||
|
}
|
||||||
|
rotate([0, 90, 0])
|
||||||
|
linear_extrude(width / 1.5, center = true)
|
||||||
|
circle(thickness, $fn = 24);
|
||||||
|
|
||||||
|
// joint
|
||||||
|
translate([half_w / 1.5 , 0, 0])
|
||||||
|
rotate([0, 90, 0])
|
||||||
|
joint_top();
|
||||||
|
|
||||||
|
translate([-half_w / 1.5 , 0, 0])
|
||||||
|
rotate([0, -90, 0])
|
||||||
|
joint_top();
|
||||||
|
|
||||||
|
slot_df();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module board2() {
|
||||||
|
difference() {
|
||||||
|
union() {
|
||||||
|
linear_extrude(thickness, center = true)
|
||||||
|
union() {
|
||||||
|
difference() {
|
||||||
|
translate([0, -half_h, 0])
|
||||||
|
board_base();
|
||||||
|
square([width, height / 3], center = true);
|
||||||
|
}
|
||||||
|
translate([0, -height / 12 - joint_spacing / 4, 0])
|
||||||
|
difference() {
|
||||||
|
square([width / 1.5 - joint_spacing, height / 6 + joint_spacing / 2], center = true);
|
||||||
|
square([width / 1.5 - thickness * 2, height / 6], center = true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rotate([0, 90, 0])
|
||||||
|
linear_extrude(width / 1.5 - joint_spacing, center = true)
|
||||||
|
circle(half_th, $fn = 24);
|
||||||
|
|
||||||
|
// joint
|
||||||
|
translate([half_w / 1.5 - half_sc, 0, 0])
|
||||||
|
rotate([0, 90, 0])
|
||||||
|
joint_top();
|
||||||
|
|
||||||
|
translate([-half_w / 1.5 + half_sc, 0, 0])
|
||||||
|
rotate([0, -90, 0])
|
||||||
|
joint_top();
|
||||||
|
}
|
||||||
|
|
||||||
|
slot_df();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module ground_df() {
|
||||||
|
translate([0, 0, -height - half_th])
|
||||||
|
linear_extrude(thickness)
|
||||||
|
square(width, center = true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// stick
|
||||||
|
translate([width, 0, 0])
|
||||||
|
stick();
|
||||||
|
|
||||||
|
translate([0, 0, thickness / 2])
|
||||||
|
rotate([-80, 0, 0])
|
||||||
|
difference() {
|
||||||
|
rotate([80, 0, 0]) union() {
|
||||||
|
color("yellow") board1();
|
||||||
|
translate([0, -height / 1.8, 0]) border();
|
||||||
|
}
|
||||||
|
ground_df();
|
||||||
|
}
|
||||||
|
|
||||||
|
translate([0, 0, thickness / 2])
|
||||||
|
rotate([80, 0, 0])
|
||||||
|
difference() {
|
||||||
|
rotate([-80, 0, 0]) rotate(180) union() {
|
||||||
|
color("yellow") board2();
|
||||||
|
translate([0, -height / 1.8, 0]) border();
|
||||||
|
}
|
||||||
|
ground_df();
|
||||||
|
}
|
||||||
|
|
||||||
|
children();
|
||||||
|
rotate(180)
|
||||||
|
children();
|
||||||
|
}
|
74
examples/floor_stand/floor_stand_symbol.scad
Normal file
74
examples/floor_stand/floor_stand_symbol.scad
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
include <util/sub_str.scad>;
|
||||||
|
include <util/split_str.scad>;
|
||||||
|
include <multi_line_text.scad>;
|
||||||
|
include <shape_taiwan.scad>;
|
||||||
|
include <hollow_out.scad>;
|
||||||
|
include <floor_stand.scad>;
|
||||||
|
|
||||||
|
text = " Taiwan";
|
||||||
|
font = "Arial Black";
|
||||||
|
font_size = 5;
|
||||||
|
line_spacing = 7;
|
||||||
|
|
||||||
|
stand_width = 40;
|
||||||
|
stand_height = 80;
|
||||||
|
stand_thickness = 4;
|
||||||
|
joint_spacing = 1;
|
||||||
|
|
||||||
|
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]) {
|
||||||
|
color("black") linear_extrude(half_th / 2)
|
||||||
|
union() {
|
||||||
|
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"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(symbol_source == "DEFAULT") {
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
else if(symbol_source == "UNICODE") {
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
symbol_png_size = 100;
|
||||||
|
symbol_png_scale = 0.25;
|
||||||
|
|
||||||
|
color("black") translate([0, half_h / 5, half_th / 4])
|
||||||
|
scale([symbol_png_scale, symbol_png_scale, 1])
|
||||||
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
floor_stand(stand_width, stand_height, stand_thickness, joint_spacing, line_spacing) content(text, font, font_size, symbol_png, symbol_unicode, symbol_font, symbol_font_size, stand_height, stand_thickness, line_spacing);;
|
Reference in New Issue
Block a user