Add 2 styles for ears
This commit is contained in:
parent
9bebad59c3
commit
37c2e71138
2 changed files with 65 additions and 11 deletions
|
|
@ -32,8 +32,8 @@ 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 = 3; // [0=Club Mate 50cL, 1=Long Neck as 25cL Club Mate or Fritz-kola, 2=Euroform 2, 3=Steinie bottles]
|
||||||
|
|
||||||
// Append ears to the bottle clip
|
// Style of the ears to add... or not add. This parameter can add a LOT of calculation time.
|
||||||
HAS_EARS = true;
|
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]
|
||||||
|
|
||||||
/* [Render] */
|
/* [Render] */
|
||||||
// Whether to render the clip, the body.
|
// Whether to render the clip, the body.
|
||||||
|
|
@ -72,10 +72,10 @@ scale([0.2, 0.2, 0.2]) {
|
||||||
font=FONT,
|
font=FONT,
|
||||||
logo=LOGO_FILE,
|
logo=LOGO_FILE,
|
||||||
format=FORMAT,
|
format=FORMAT,
|
||||||
has_ears=HAS_EARS);
|
ears_style=EARS_STYLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
module render_bottle_clip(name="", font="", logo="", format=0, has_ears=true) {
|
module render_bottle_clip(name="", font="", logo="", format=0, ears_style=1) {
|
||||||
name = name == "" ? "c3cat" : name ;
|
name = name == "" ? "c3cat" : name ;
|
||||||
font = font == "" ? "write/orbitron.dxf" : font ;
|
font = font == "" ? "write/orbitron.dxf" : font ;
|
||||||
|
|
||||||
|
|
@ -105,13 +105,13 @@ module render_bottle_clip(name="", font="", logo="", format=0, has_ears=true) {
|
||||||
width=width);
|
width=width);
|
||||||
|
|
||||||
// Render ears if requested
|
// Render ears if requested
|
||||||
if (has_ears) {
|
if (ears_style > 0) {
|
||||||
ears(ht=ht, ru=ru, rl=rl, clip_width=width, ears_style=ears_style);
|
ears(ht=ht, ru=ru, rl=rl, clip_width=width, ears_style=ears_style);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render ears if requested
|
// Render ears if requested
|
||||||
if (has_ears && RENDER_COLOR_EARS) {
|
if (ears_style > 0 && RENDER_COLOR_EARS) {
|
||||||
ears(ht=ht, ru=ru, rl=rl, clip_width=width, ears_style=ears_style);
|
ears(ht=ht, ru=ru, rl=rl, clip_width=width, ears_style=ears_style);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -262,7 +262,7 @@ module outer_cutoff(rl, e, ru, ht, width) {
|
||||||
* ear_details: whether to chamfer also the partial arcs
|
* ear_details: whether to chamfer also the partial arcs
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
module ears(ht, ru, rl, clip_width, space_between_ears = 15, ear_tilt = 15, ear_depth=2, ear_thickness=.6, ear_side_len=6, ear_bend_factor=0.5, ear_stretch_factor=1.2, ear_chamfer=1, ear_chamfer_shape="curve", ear_details=true) {
|
module ears(ht, ru, rl, clip_width, space_between_ears = 15, ear_tilt = 15, ear_depth=2, ear_thickness=.6, ear_side_len=6, ear_bend_factor=0.5, ear_stretch_factor=1.2, ear_chamfer=1, ear_chamfer_shape="curve", ear_details=true, ears_style=1) {
|
||||||
|
|
||||||
// This is the radius on which the ears has to be to be centered on the clip.
|
// This is the radius on which the ears has to be to be centered on the clip.
|
||||||
radius = ru+(clip_width/2);
|
radius = ru+(clip_width/2);
|
||||||
|
|
@ -430,7 +430,8 @@ module ears(ht, ru, rl, clip_width, space_between_ears = 15, ear_tilt = 15, ear_
|
||||||
translate([0, space_between_ears/2, 0])
|
translate([0, space_between_ears/2, 0])
|
||||||
rotate(ears_angle, [1, 0, 0])
|
rotate(ears_angle, [1, 0, 0])
|
||||||
rotate(-ear_tilt, [0, 1, 0])
|
rotate(-ear_tilt, [0, 1, 0])
|
||||||
ear(
|
ear_with_style(
|
||||||
|
style=ears_style,
|
||||||
depth=ear_depth,
|
depth=ear_depth,
|
||||||
thickness=ear_thickness,
|
thickness=ear_thickness,
|
||||||
side_len=ear_side_len,
|
side_len=ear_side_len,
|
||||||
|
|
@ -444,7 +445,8 @@ module ears(ht, ru, rl, clip_width, space_between_ears = 15, ear_tilt = 15, ear_
|
||||||
translate([0, space_between_ears/2, 0])
|
translate([0, space_between_ears/2, 0])
|
||||||
rotate(ears_angle, [1, 0, 0])
|
rotate(ears_angle, [1, 0, 0])
|
||||||
rotate(-ear_tilt, [0, 1, 0])
|
rotate(-ear_tilt, [0, 1, 0])
|
||||||
ear(
|
ear_with_style(
|
||||||
|
style=ears_style,
|
||||||
depth=ear_depth,
|
depth=ear_depth,
|
||||||
thickness=ear_thickness,
|
thickness=ear_thickness,
|
||||||
side_len=ear_side_len,
|
side_len=ear_side_len,
|
||||||
|
|
@ -457,6 +459,58 @@ 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) {
|
||||||
|
if (style == 1 || style == 2 || style == 3) {
|
||||||
|
// Style 1: Just arcs
|
||||||
|
// Style 2: Filled ears with the same thickness
|
||||||
|
// Style 3: Filled ears with the a thinner thickness inside
|
||||||
|
|
||||||
|
ear(
|
||||||
|
depth=depth,
|
||||||
|
thickness=thickness,
|
||||||
|
side_len=side_len,
|
||||||
|
bend_factor=bend_factor,
|
||||||
|
stretch_factor=stretch_factor,
|
||||||
|
chamfer=chamfer,
|
||||||
|
chamfer_shape=chamfer_shape,
|
||||||
|
details=details
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (style == 2 || style == 3) {
|
||||||
|
// Style 2: Filled ears with the same thickness
|
||||||
|
// Style 3: Filled ears with the a thinner thickness inside
|
||||||
|
|
||||||
|
thickness_steps = thickness*0.5;
|
||||||
|
depth_steps = (depth-thickness)/((side_len / thickness_steps));
|
||||||
|
|
||||||
|
for (round_side_len = [side_len-thickness_steps:-thickness_steps:0]) {
|
||||||
|
// round_side_len = side_len - (thickness_steps * x)
|
||||||
|
// (thickness_steps * x) + round_side_len = side_len
|
||||||
|
// (thickness_steps * x) = side_len - round_side_len
|
||||||
|
// x = (side_len - round_side_len) / thickness_steps
|
||||||
|
x = (side_len - round_side_len) / thickness_steps;
|
||||||
|
round_shift = depth_steps * x;
|
||||||
|
current_depth = depth - (style == 3 ? round_shift : 0);
|
||||||
|
translation = style == 2 ? 0 : round_shift / 2;
|
||||||
|
|
||||||
|
translate([0, 0, translation])
|
||||||
|
color("green")
|
||||||
|
ear(
|
||||||
|
depth=current_depth,
|
||||||
|
thickness=thickness,
|
||||||
|
side_len=round_side_len,
|
||||||
|
bend_factor=bend_factor,
|
||||||
|
stretch_factor=stretch_factor,
|
||||||
|
chamfer=chamfer,
|
||||||
|
chamfer_shape=chamfer_shape,
|
||||||
|
details=true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Module that creates an ear shape.
|
* Module that creates an ear shape.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ set -u
|
||||||
|
|
||||||
VERSION=2.2
|
VERSION=2.2
|
||||||
LOGO_FILE='""'
|
LOGO_FILE='""'
|
||||||
TINY_EARS=true
|
|
||||||
FN=90
|
FN=90
|
||||||
|
EARS_STYLE=1
|
||||||
|
|
||||||
NAME="\"$1\""
|
NAME="\"$1\""
|
||||||
|
|
||||||
|
|
@ -53,7 +53,7 @@ render() {
|
||||||
echo rendering "$1" "$2"
|
echo rendering "$1" "$2"
|
||||||
openscad \
|
openscad \
|
||||||
-D "\$fn=${FN}" \
|
-D "\$fn=${FN}" \
|
||||||
-D "HAS_EARS=${TINY_EARS}" \
|
-D "EARS_STYLE=${EARS_STYLE}" \
|
||||||
-D "LOGO_FILE=${LOGO_FILE}" \
|
-D "LOGO_FILE=${LOGO_FILE}" \
|
||||||
-D "NAME=${NAME}" \
|
-D "NAME=${NAME}" \
|
||||||
-D "RENDER_COLOR_CLIP=${CLIP}" \
|
-D "RENDER_COLOR_CLIP=${CLIP}" \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue