Skip to content

Animate the assembly without the levitator #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions assets/images/README-assemble
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

assemble.mp4 was produced with 30 frames per second and 400 frames using:
ffmpeg -r:v 30 -start_number 0 -i "frame%05d.png" -preset veryslow -pix_fmt yuv420p -crf 28 -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" -an assemble.mp4
Binary file added assets/images/assemble.mp4
Binary file not shown.
1 change: 1 addition & 0 deletions scad/body.scad
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ module switch_body(length, width, travel, taper=1.1, wall_thickness=1.4, sheath_
}
}
// Visualize the magnet too
if ($t == 0) // but not if we're animating assembly.
translate([
// -stem_diameter/4-top_magnet_diameter/1.75,
// -stem_diameter/4-top_magnet_diameter/1.75,
Expand Down
22 changes: 21 additions & 1 deletion scad/void_switch.scad
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,21 @@ CHERRY_CROSS_LENGTH = 4; // Length of the - and the | in the +
// Try to calculate the strength of the switch in grams and output that to the console
display_magnet_strength(BODY_MAGNET_DIAMETER, BODY_MAGNET_HEIGHT, MAGNET_VOID, strength=MAGNET_STRENGTH);

segments = 14;

function anim(segment) =
let (min = segment / segments,
max = (segment + 1) / segments )
$t < min? 0: ($t >= max? 1.0: ($t - min) / (max - min)) ;

// These variables are used below for placement of things:
sheath_height = STEM_DIAMETER+SHEATH_WALL_THICKNESS*2;
sheath_width = STEM_DIAMETER+SHEATH_WALL_THICKNESS*2;
// Render the selected items
for (item=RENDER) {
if (item=="body") {
translate([0,0,10 * anim(1)])
rotate([180 * anim(2), 0, 0])
switch_body(
BODY_LENGTH, BODY_WIDTH, TOTAL_TRAVEL,
taper=BODY_TAPER,
Expand Down Expand Up @@ -294,6 +303,12 @@ for (item=RENDER) {
bridge_thickness=BRIDGE_THICKNESS,
sheath_snug_magnet=SHEATH_HOLDS_MAGNET);
} else if (item=="sheath") {
translate([0,0,10 * anim(3)])
translate([0,0,10 * anim(4)])
translate([-0.25 * anim(6),-4.75 * anim(6),-10 * anim(6)])
translate([0,0,-14.5 * anim(7)])
rotate([-90 * anim(4), 0, 45 * anim(5)])
translate([-BODY_LENGTH*1.00/sqrt(2) * anim(5),-BODY_LENGTH*1.00/sqrt(2) * anim(5),0])
translate([BODY_LENGTH/1.05,0,0]) // Move it over to the side (but keep it tight so we can print more at a time!)
rotate([0,0,0]) // Line it up
sheath_cherry_cross(SHEATH_LENGTH, STEM_DIAMETER, TOTAL_TRAVEL, COVER_THICKNESS,
Expand Down Expand Up @@ -343,6 +358,11 @@ for (item=RENDER) {
bottom_clip_width=SHEATH_BOTTOM_CLIP_WIDTH,
snug_magnet=SHEATH_HOLDS_MAGNET);
} else if (item=="stem") {
translate([BODY_LENGTH/1.25 * anim(8),TOTAL_TRAVEL/1.15 * anim(8),-10 * anim(8)])
translate([0,0,22.5 * anim(11)])
translate([-2.25 * anim(10),3.5 * anim(10),0])
rotate([0,0,45 * anim(10)])
rotate([-90 * anim(9),0,0])
translate([-BODY_LENGTH/1.25,-TOTAL_TRAVEL/1.15,0]) // STEM
rotate([0,0,0]) // Line it up so we can bring it closer
stem_cherry_cross(TOTAL_TRAVEL, STEM_DIAMETER, SHEATH_LENGTH, WALL_THICKNESS, COVER_THICKNESS,
Expand Down Expand Up @@ -490,4 +510,4 @@ for (item=RENDER) {
/* CHANGELOG:
1.0:
* Initial release.
*/
*/