// -*- C -*- include wall_th = 2; hook_th = 4; hook_hole = 4; plug_l_d = [[ 27.78, 10.62 + 0.50 ], [ 40.88, 8.56 + 0.50 ], ]; plug_stem = [ 2.72 + 0.50, 5.20 + 0.50 ]; palmrest_from_plug_z = 3.98; laptop_th = 16.31 + 0.75; tongue_len = 50; // calculated hook_th_plug_holder = plug_l_d[0][1]/2 + wall_th * sin(22.5); hook_tongue_h = hook_hole + wall_th*2; plug_hook_z_laptop_base = palmrest_from_plug_z - laptop_th; plug_hook_z_min = palmrest_from_plug_z - hook_tongue_h; plug_hook_x_min = -plug_l_d[len(plug_l_d)-1][0] - wall_th; module PlugMainPlan() { for (l_d = plug_l_d) { l = l_d[0]; d = l_d[1]; rectfromto([ -l, -d/2 ], [ 0, +d/2 ]); } } module PlugHolderPlan() { intersection(){ hull() offset(r= wall_th) PlugMainPlan(); rectfromto([-100,-100], [-0.1,+100]); } } module PlugHookHookPlan(){ polygon([ [ plug_hook_x_min, 0 ], [ plug_hook_x_min + -plug_hook_z_min, plug_hook_z_min ], [ tongue_len, plug_hook_z_min ], [ tongue_len, plug_hook_z_laptop_base ], [ 0, plug_hook_z_laptop_base ], [ 0, 0 ], ]); } module RotateIntersect(n=6){ intersection_for (r = [0:n-1]) { rotate([r/n * 360,0,0]) linextr(-100,100) children(0); } } module PlugHolder(){ difference(){ union(){ RotateIntersect(8) PlugHolderPlan(); linextr_y_xz(-hook_th_plug_holder, +hook_th_plug_holder) PlugHookHookPlan(); } RotateIntersect(6) PlugMainPlan(); linextr(-plug_stem[1]/2, 100) rectfromto([ -100, -plug_stem[0]/2 ], [ +100, +plug_stem[0]/2 ]); } } module DemoPlan() { translate([0,0,-5]) color("grey") PlugHolderPlan(); PlugMainPlan(); } //DemoPlan(); PlugHookHookPlan(); //render() PlugHolder();