mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-01-17 06:08:31 +01:00
add emotion_ball
This commit is contained in:
parent
d3cdf8884d
commit
1acc8f9716
107
examples/emotion_ball.scad
Normal file
107
examples/emotion_ball.scad
Normal file
@ -0,0 +1,107 @@
|
||||
use <arc.scad>;
|
||||
use <pie.scad>;
|
||||
use <polyline2d.scad>;
|
||||
|
||||
ball_radius = 15;
|
||||
thickness = 2.5;
|
||||
magnet_radius = 3;
|
||||
|
||||
emoticon(ball_radius, magnet_radius, thickness)
|
||||
grinning_face_with_smiling_eyes(ball_radius);
|
||||
|
||||
translate([ball_radius * 2.5, 0, 0])
|
||||
emoticon(ball_radius, magnet_radius, thickness)
|
||||
grinning_squinting_face(ball_radius);
|
||||
|
||||
translate([ball_radius * 5, 0, 0])
|
||||
emoticon(ball_radius, magnet_radius, thickness)
|
||||
persevering_face(ball_radius);
|
||||
|
||||
translate([ball_radius * 7.5, 0, 0])
|
||||
emoticon(ball_radius, magnet_radius, thickness)
|
||||
smirking_face(ball_radius);
|
||||
|
||||
module emoticon(ball_radius, magnet_radius, thickness) {
|
||||
$fn = 64;
|
||||
difference() {
|
||||
sphere(ball_radius);
|
||||
sphere(ball_radius - thickness);
|
||||
|
||||
translate([0, 0, -ball_radius * 1.5])
|
||||
linear_extrude(ball_radius)
|
||||
circle(magnet_radius);
|
||||
|
||||
translate([0, 0, ball_radius])
|
||||
mirror([0, 0, 1])
|
||||
linear_extrude(ball_radius * 1.1, scale = 0.5)
|
||||
children();
|
||||
}
|
||||
}
|
||||
|
||||
// design your emoticon in a cirle with a radius of `ball_radius`.
|
||||
|
||||
module grinning_face_with_smiling_eyes(ball_radius) {
|
||||
translate([ball_radius / 2.25, ball_radius / 8, 0])
|
||||
arc(ball_radius / 4, 180, width = ball_radius / 10);
|
||||
|
||||
translate([-ball_radius / 2.25, ball_radius / 8, 0])
|
||||
arc(ball_radius / 4, 180, width = ball_radius / 10);
|
||||
|
||||
scale([1, 0.8, 1])
|
||||
translate([0, -ball_radius / 3, 0])
|
||||
pie(radius = ball_radius / 1.5, angle = [180, 360]);
|
||||
}
|
||||
|
||||
module grinning_squinting_face(ball_radius) {
|
||||
r = ball_radius * 0.4;
|
||||
a = 25;
|
||||
|
||||
translate([ball_radius / 4, ball_radius / 4, 0])
|
||||
polyline2d([[r * cos(a), r * sin(a)], [0, 0], [r * cos(a), r * -sin(a)]], width = ball_radius / 10);
|
||||
|
||||
translate([-ball_radius / 4, ball_radius / 4, 0])
|
||||
polyline2d([[-r * cos(a), r * sin(a)], [0, 0], [-r * cos(a), r * -sin(a)]], width = ball_radius / 10);
|
||||
|
||||
scale([1, 0.8, 1])
|
||||
translate([0, -ball_radius / 3, 0])
|
||||
pie(radius = ball_radius / 1.5, angle = [180, 360]);
|
||||
}
|
||||
|
||||
module persevering_face(ball_radius) {
|
||||
r = ball_radius * 0.4;
|
||||
a = 25;
|
||||
|
||||
translate([ball_radius / 4, ball_radius / 4, 0])
|
||||
polyline2d([[r * cos(a), r * sin(a)], [0, 0], [r * cos(a), r * -sin(a)]], width = ball_radius / 10);
|
||||
|
||||
translate([-ball_radius / 4, ball_radius / 4, 0])
|
||||
polyline2d([[-r * cos(a), r * sin(a)], [0, 0], [-r * cos(a), r * -sin(a)]], width = ball_radius / 10);
|
||||
|
||||
scale([1.4, 0.8, 1])
|
||||
translate([0, -ball_radius / 1.75, 0])
|
||||
arc(ball_radius / 4, 180, width = ball_radius / 10);
|
||||
}
|
||||
|
||||
module smirking_face(ball_radius) {
|
||||
r = ball_radius * 0.4;
|
||||
a = 25;
|
||||
|
||||
translate([ball_radius / 2.5, ball_radius / 25, 0]) {
|
||||
//scale([1, 0.9, 1])
|
||||
arc(ball_radius / 3, [35, 150], width = ball_radius / 10);
|
||||
translate([ball_radius / 6, ball_radius / 5.5 ,0])
|
||||
circle(ball_radius / 8);
|
||||
}
|
||||
|
||||
translate([-ball_radius / 2, ball_radius / 25, 0]) {
|
||||
//scale([1, 0.9, 1])
|
||||
arc(ball_radius / 3, [35, 150], width = ball_radius / 10);
|
||||
translate([ball_radius / 6, ball_radius / 5.5 ,0])
|
||||
circle(ball_radius / 8);
|
||||
}
|
||||
|
||||
scale([1.3, 1, 1])
|
||||
translate([-ball_radius / 15, -ball_radius / 6, 0])
|
||||
arc(ball_radius / 3, [235, 350], width = ball_radius / 10);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user