mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-13 10:14:41 +02:00
refactor
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
use <box_extrude.scad>;
|
||||||
|
|
||||||
model_type = "Both"; // [Both, Lid, Container]
|
model_type = "Both"; // [Both, Lid, Container]
|
||||||
t = "XD";
|
t = "XD";
|
||||||
font_size = 30;
|
font_size = 30;
|
||||||
@@ -8,7 +10,6 @@ lid_height = 10;
|
|||||||
thickness = 1;
|
thickness = 1;
|
||||||
spacing = 0.6;
|
spacing = 0.6;
|
||||||
|
|
||||||
|
|
||||||
module minkowski_text(t, size, font, r_round_edge) {
|
module minkowski_text(t, size, font, r_round_edge) {
|
||||||
$fn = 24;
|
$fn = 24;
|
||||||
minkowski() {
|
minkowski() {
|
||||||
@@ -18,34 +19,20 @@ module minkowski_text(t, size, font, r_round_edge) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module text_container(t, font_size, font_name, r_round_edge, container_height, thickness) {
|
module text_container(t, font_size, font_name, r_round_edge, container_height, thickness) {
|
||||||
difference() {
|
box_extrude(height = container_height, shell_thickness = thickness)
|
||||||
linear_extrude(container_height)
|
minkowski_text(t, font_size, font_name, r_round_edge);
|
||||||
minkowski_text(t, font_size, font_name, r_round_edge);
|
|
||||||
|
|
||||||
translate([0, 0, thickness])
|
|
||||||
linear_extrude(container_height - thickness)
|
|
||||||
offset(r = -thickness)
|
|
||||||
minkowski_text(t, font_size, font_name, r_round_edge);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module text_lid(t, font_size, font_name, r_round_edge, container_height, lid_height, thickness, spacing) {
|
module text_lid(t, font_size, font_name, r_round_edge, lid_height, thickness, spacing) {
|
||||||
translate([0, 0, lid_height - thickness])
|
translate([0, 0, lid_height])
|
||||||
linear_extrude(thickness)
|
mirror([0, 0, 1])
|
||||||
|
box_extrude(height = lid_height, shell_thickness = thickness)
|
||||||
|
mirror([0, 0, 1])
|
||||||
offset(r = spacing + thickness)
|
offset(r = spacing + thickness)
|
||||||
minkowski_text(t, font_size, font_name, r_round_edge);
|
minkowski_text(t, font_size, font_name, r_round_edge);
|
||||||
|
|
||||||
linear_extrude(lid_height)
|
|
||||||
difference() {
|
|
||||||
offset(r = spacing + thickness)
|
|
||||||
minkowski_text(t, font_size, font_name, r_round_edge);
|
|
||||||
offset(r = spacing)
|
|
||||||
minkowski_text(t, font_size, font_name, r_round_edge);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module text_box(model_type, t, font_size, font_name, r_round_edge, container_height, lid_height, thickness, spacing) {
|
module text_box(model_type, t, font_size, font_name, r_round_edge, container_height, lid_height, thickness, spacing) {
|
||||||
|
|
||||||
if(model_type == "Both" || model_type == "Container") {
|
if(model_type == "Both" || model_type == "Container") {
|
||||||
text_container(t, font_size, font_name, r_round_edge, container_height, thickness);
|
text_container(t, font_size, font_name, r_round_edge, container_height, thickness);
|
||||||
}
|
}
|
||||||
@@ -54,7 +41,7 @@ module text_box(model_type, t, font_size, font_name, r_round_edge, container_hei
|
|||||||
offset_y = (font_size + r_round_edge) * 2;
|
offset_y = (font_size + r_round_edge) * 2;
|
||||||
|
|
||||||
translate([0, offset_y, 0])
|
translate([0, offset_y, 0])
|
||||||
text_lid(t, font_size, font_name, r_round_edge, container_height, lid_height, thickness, spacing);
|
text_lid(t, font_size, font_name, r_round_edge, lid_height, thickness, spacing);
|
||||||
|
|
||||||
translate([0, offset_y, lid_height])
|
translate([0, offset_y, lid_height])
|
||||||
linear_extrude(thickness)
|
linear_extrude(thickness)
|
||||||
@@ -62,4 +49,4 @@ module text_box(model_type, t, font_size, font_name, r_round_edge, container_hei
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
text_box(model_type, t, font_size, font_name, r_round_edge, container_height, lid_height, thickness, spacing );
|
text_box(model_type, t, font_size, font_name, r_round_edge, container_height, lid_height, thickness, spacing);
|
Reference in New Issue
Block a user