Code cleaning + add ears to the bottle clip! #22

Open
ajabep wants to merge 23 commits from ajabep/scad:trunk into trunk
Showing only changes of commit 7c49687f9c - Show all commits

Add a new ear style

Ajabep 2026-01-15 18:26:36 +01:00

View file

@ -30,10 +30,10 @@ LOGO_FILE = ""; // empty string is catear model
FONT = ""; // empty string is for Orbitron font FONT = ""; // empty string is for Orbitron font
// Format of the bottle clip you want to create. // Format of the bottle clip you want to create.
FORMAT = 3; // [0=Club Mate 50cL, 1=Long Neck as 25cL Club Mate or Fritz-kola, 2=Euroform 2, 3=Steinie bottles] FORMAT = 0; // [0=Club Mate 50cL, 1=Long Neck as 25cL Club Mate or Fritz-kola, 2=Euroform 2, 3=Steinie bottles]
// Style of the ears to add... or not add. This parameter can add a LOT of calculation time. // Style of the ears to add... or not add. This parameter can add a LOT of calculation time.
EARS_STYLE = 0; // [0=No ears, 1=Just arcs, 2=Filled ears with the same thickness, 3=Filled ears with the a thinner thickness inside] EARS_STYLE = 0; // [0=No ears, 1=Just arcs, 2=Filled ears with the same thickness, 3=Filled ears with the a thinner thickness inside, 4=Filled ears with the same thickness but shifted]
/* [Render] */ /* [Render] */
// Whether to render the clip, the body. // Whether to render the clip, the body.
@ -460,10 +460,11 @@ module ears(ht, ru, rl, clip_width, space_between_ears = 15, ear_tilt = 15, ear_
} }
module ear_with_style(style = 1, depth, thickness, side_len=30, bend_factor=0.5, stretch_factor=1.2, chamfer=1, chamfer_shape="curve", details=true) { module ear_with_style(style = 1, depth, thickness, side_len=30, bend_factor=0.5, stretch_factor=1.2, chamfer=1, chamfer_shape="curve", details=true) {
if (style == 1 || style == 2 || style == 3) { if (style == 1 || style == 2 || style == 3 || style == 4) {
// Style 1: Just arcs // Style 1: Just arcs
// Style 2: Filled ears with the same thickness // Style 2: Filled ears with the same thickness
// Style 3: Filled ears with the a thinner thickness inside // Style 3: Filled ears with the a thinner thickness inside
// Style 4: Filled ears with the same thickness but shifted
ear( ear(
depth=depth, depth=depth,
@ -478,9 +479,10 @@ module ear_with_style(style = 1, depth, thickness, side_len=30, bend_factor=0.5,
} }
if (style == 2 || style == 3) { if (style == 2 || style == 3 || style == 4) {
// Style 2: Filled ears with the same thickness // Style 2: Filled ears with the same thickness
// Style 3: Filled ears with the a thinner thickness inside // Style 3: Filled ears with the a thinner thickness inside
// Style 4: Filled ears with the same thickness but shifted
thickness_steps = thickness*0.5; thickness_steps = thickness*0.5;
depth_steps = (depth-thickness)/((side_len / thickness_steps)); depth_steps = (depth-thickness)/((side_len / thickness_steps));