chiark / gitweb /
scaffold-clamp: wip straphook
[reprap-play.git] / pin-hinge.scad
1 // -*- C -*-
2
3 include <utils.scad>
4
5 $hinge_pin_dia = 0.795 + 0.75;
6 $hinge_main_dia = 4.0;
7 $hinge_inter_gap = 0.50;
8 $hinge_prong_minwidth = 3.0;
9 $hinge_noncrit_gap = 1.0;
10
11 $fa = 3;
12 $fs = 0.05;
13
14 module HingePinPlan(){
15   circle(r= $hinge_pin_dia/2);
16 }
17
18 module HingeProngPlan(behind){
19   hull(){
20     circle(r= $hinge_main_dia/2);
21     polygon([[0,0],
22              [-$hinge_main_dia/2, -behind],
23              [+$hinge_main_dia/2, -behind]]);
24   }
25 }
26
27 module HingeGapPlan() {
28   circle(r = $hinge_main_dia/2 + $hinge_inter_gap);
29 }
30
31 module PlanDemo(){
32   HingeProngPlan(5);
33   %HingeGapPlan();
34   translate([0,0,1]) color("red") HingePinPlan();
35 }
36
37 module HingePinUnitCell(l) {
38   eff_l = l + $hinge_inter_gap;
39   pairs = floor(eff_l / (2*($hinge_prong_minwidth + $hinge_inter_gap)));
40   stride = eff_l / pairs;
41   $hinge__prong_width = stride/2 - $hinge_inter_gap;
42   for (i=[0:pairs-1]) {
43     translate(stride * i * [1,0,0])
44       children(0);
45   }
46 }
47
48 module HingePositive(l, behind){
49   HingePinUnitCell(l){
50     linextr_x_yz(0, $hinge__prong_width)
51       HingeProngPlan(behind);
52   }
53 }
54
55 module HingeNegative(l){
56   linextr_x_yz(-0.1, l+0.1)
57     HingePinPlan();
58   HingePinUnitCell(l){
59     linextr_x_yz($hinge__prong_width,
60                  $hinge__prong_width*2 + 2*$hinge_inter_gap)
61       HingeGapPlan();
62   }
63 }
64
65 test_l = 30;
66 test_wb = 12;
67 test_h = 12;
68
69 test_face_gap = 0.75;
70
71 module Demo(){
72   difference(){
73     HingePositive(test_l, test_h/2);
74     %HingeNegative(test_l);
75   }
76 }
77
78 module TestBody(){
79   linextr_x_yz(0, test_l){
80     offset(delta = -test_face_gap/2)
81       polygon([[0,0],
82                [-test_wb/2, -test_h],
83                [+test_wb/2, -test_h]]);
84   }
85 }
86
87 module Test(){
88   difference(){
89     union(){
90       TestBody();
91       HingePositive(test_l, test_h/2);
92     }
93     HingeNegative(test_l);
94   }
95 }
96
97 //PlanDemo();
98 //Demo();
99 //TestBody();
100 Test();