-
Notifications
You must be signed in to change notification settings - Fork 1
/
kcomp.py
1530 lines (1307 loc) · 46.9 KB
/
kcomp.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# ----------------------------------------------------------------------------
# -- Component Constants
# -- comps library
# -- Constants about different components, materials, parts and 3D printer
# -- settings
# ----------------------------------------------------------------------------
# -- (c) Felipe Machado
# -- Area of Electronics. Rey Juan Carlos University (urjc.es)
# -- October-2016
# ----------------------------------------------------------------------------
# --- LGPL Licence
# ----------------------------------------------------------------------------
# ---------------------- Tolerance in mm
TOL = 0.4
STOL = TOL / 2.0 # smaller tolerance
# height of the layer to print. To make some supports, ie: bolt's head
LAYER3D_H = 0.3
# ---------------------- linear Bearings
#external diameter of the bearing
LMUU_D = { 6: 12., 8: 15., 10: 19.0, 12: 21.0, 20: 42. };
#Length of the bearing
LMUU_L = { 6: 19., 8: 24., 10: 29.0, 12: 30.0, 20: 32. };
#diamenter of the bearing
LMEUU_D = { 8: 16., 10: 19.0, 12: 22.0, 20: 32. };
#Length of the bearing
LMEUU_L = { 8: 25., 10: 29.0, 12: 32.0, 20: 45. };
# Large version:
LMELUU_L = { 12: 57.0 }; #the length of the bearing
LMELUU_D = { 8: 16., 10: 19.0, 12: 22.0 }; #diamenter of the bearing
LM6UU = {
'Di' : 6, # interior diameter
'De' : LMUU_D[6], # exterior diameter
'L' : LMUU_L[6] # length
}
LM8UU = {
'Di' : 8, # interior diameter
'De' : LMUU_D[8], # exterior diameter
'L' : LMUU_L[8] # length
}
LM10UU = {
'Di' : 10, # interior diameter
'De' : LMUU_D[10], # exterior diameter
'L' : LMUU_L[10] # length
}
LM12UU = {
'Di' : 12, # interior diameter
'De' : LMUU_D[12], # exterior diameter
'L' : LMUU_L[12] # length
}
LM20UU = {
'Di' : 20, # interior diameter
'De' : LMUU_D[20], # exterior diameter
'L' : LMUU_L[20] # length
}
LME8UU = {
'Di' : 8, # interior diameter
'De' : LMEUU_D[8], # exterior diameter
'L' : LMEUU_L[8] # length
}
LME10UU = {
'Di' : 10, # interior diameter
'De' : LMEUU_D[10], # exterior diameter
'L' : LMEUU_L[10] # length
}
LME12UU = {
'Di' : 12, # interior diameter
'De' : LMEUU_D[12], # exterior diameter
'L' : LMEUU_L[12] # length
}
LME20UU = {
'Di' : 20, # interior diameter
'De' : LMEUU_D[20], # exterior diameter
'L' : LMEUU_L[20] # length
}
LME12LUU = {
'Di' : 12, # interior diameter
'De' : LMELUU_D[12], # exterior diameter
'L' : LMELUU_L[12] # length
}
LMUU = {
6 : LM6UU,
8 : LM8UU,
10 : LM10UU, # same as LMEUU
12 : LM12UU,
20 : LM12UU
}
LMEUU = {
8 : LME8UU,
10 : LME10UU,
12 : LME12UU,
20 : LME20UU
}
LMELUU = {
12 : LME12LUU
}
# E3D V6 extrusor dimensions
"""
___________
| | outup
-----------
| |
| | in
___________
| | outbot
-----------
"""
E3DV6_IN_DIAM = 12.0
E3DV6_IN_H = 6.0
E3DV6_OUT_DIAM = 16.0
E3DV6_OUTUP_H = 3.7
E3DV6_OUTBOT_H = 3.0
# separation of the extruders.
# with the fan, the extruder are about 30mm wide. So 15mm from the center.
# giving 10mm separation, results in 40mm separation
# and total length of 70mm
extrud_sep = 40.0
# DIN-912 bolt dimmensions
# head: the index is the M, i.e: M3, M4, ..., the value is the diameter of the head of the bolt
D912_HEAD_D = {2: 3.8, 2.5:4.5,
3: 5.5, 4: 7.0, 5: 8.5,
6:10.0, 8:13.0, 10:18.0}
# length: the index is the M, i.e: M3, M4, ..., the value is the length of the head of the bolt
# well, it is the same as the M, never mind...
D912_HEAD_L = {2: 2., 2.5: 2.5,
3: 3.0, 4: 4.0, 5: 5.0,
6: 6.0, 8:8.0, 10:10.0}
# 2 x apotheme of the hex socket
D912_2AP = {2: 1.5, 2.5: 2.,
3: 2.5, 4: 3., 5: 4.,
6: 5., 8: 6., 10: 8.}
# max threaded part of the shank, if shank length is smaller, it will be
# all threated
D912_THREAD = {2: 16., 2.5: 17.,
3: 18., 4: 20., 5: 22.,
6: 24., 8: 28., 10: 32.}
M3_HEAD_R = D912_HEAD_D[3] / 2.0
M3_HEAD_L = D912_HEAD_L[3]
M3_HEAD_L_TOL = D912_HEAD_L[3] + TOL
M3_HEAD_R_TOL = M3_HEAD_R + TOL/2.0 # smaller TOL, because it's small
M3_SHANK_R_TOL = 3 / 2.0 + TOL/2.0
M3_2AP = D912_2AP[3] # 2xapotheme of the hex socket
# typical length of DIN912 bolts
D912_M2_5_L = [6, 8, 10, 12, 14, 16, 20]
D912_M3_L = [6, 8, 10, 12, 14, 16, 20,
25, 30, 35, 40]
D912_M4_L = [6, 8, 10, 12, 14, 16, 20,
25, 30, 35, 40, 45, 50, 55,
60, 65, 70, 100]
D912_M5_L = [6, 8, 10, 12, 14, 16, 18, 20, 22,
25, 30, 35, 40, 45, 50, 55,
60, 65, 70, 80, 90,
100, 110, 120, 130 ]
D912_M6_L = [6, 8, 10, 12, 14, 16, 20, 22,
25, 30, 35, 40, 45, 50, 55,
60, 65, 70, 80, 90,
100, 110, 120, 150 ]
D912_M8_L = [ 12, 14, 16, 20, 22,
25, 30, 35, 40, 45, 50, 55,
60, 65, 70, 75, 80, 90,
100, 110, 120, 130, 140, 150, 160, 170, 200 ]
D912_L = { 2.5: D912_M2_5_L,
3: D912_M3_L,
4: D912_M4_L,
5: D912_M5_L,
6: D912_M6_L,
8: D912_M8_L
}
M4_HEAD_R = D912_HEAD_D[4] / 2.0
M4_HEAD_L = D912_HEAD_L[4]
M4_HEAD_L_TOL = D912_HEAD_L[4] + TOL
M4_HEAD_R_TOL = M4_HEAD_R + TOL/2.0 # smaller TOL, because it's small
M4_SHANK_R_TOL = 4 / 2.0 + TOL/2.0
M4_2AP = D912_2AP[4] # 2xapotheme of the hex socket
M6_HEAD_R = D912_HEAD_D[6] / 2.0
M6_HEAD_L = D912_HEAD_L[6]
M6_HEAD_L_TOL = D912_HEAD_L[6] + TOL
M6_HEAD_R_TOL = M6_HEAD_R + TOL/2.0 # smaller TOL, because it's small
M6_SHANK_R_TOL = 6 / 2.0 + TOL/2.0
M6_2AP = D912_2AP[6] # 2 x apotheme of the hex socket
D912_M2_5 = {
'd': 2.5, # diameter of the shank
'shank_r_tol' : 2.5 / 2. + TOL/2.,
'head_r' : D912_HEAD_D[2.5]/2.,
'head_r_tol' : D912_HEAD_D[2.5]/2. + TOL/2.,
'head_l' : D912_HEAD_L[2.5],
'head_l_tol' : D912_HEAD_L[2.5]+TOL,
'thread' : D912_THREAD[2.5],
'shank_l_list' : D912_L[2.5], # list of possible shank lengths
'ap2' : D912_2AP[2.5], # s: 2 x apotheme of the socket
}
D912_M3 = {
'd': 3., # diameter of the shank
'shank_r_tol' : 3 / 2. + TOL/2.,
'head_r' : M3_HEAD_R,
'head_r_tol' : M3_HEAD_R_TOL,
'head_l' : M3_HEAD_L,
'head_l_tol' : M3_HEAD_L_TOL,
'thread' : D912_THREAD[3],
'shank_l_list' : D912_L[3], # list of possible shank lengths
'ap2' : M3_2AP, # s: 2 x apotheme of the socket
}
D912_M4 = {
'd': 4., # diameter of the shank
'shank_r_tol' : 4 / 2. + TOL/2.,
'head_r' : M4_HEAD_R,
'head_r_tol' : M4_HEAD_R_TOL,
'head_l' : M4_HEAD_L,
'head_l_tol' : M4_HEAD_L_TOL,
'thread' : D912_THREAD[4],
'shank_l_list' : D912_L[4], # list of possible shank lengths
'ap2' : M4_2AP, # s: 2 x apotheme of the socket
}
D912_M5 = {
'd': 5., # diameter of the shank
'shank_r_tol' : 5 / 2. + TOL/2.,
'head_r' : D912_HEAD_D[5]/2.,
'head_r_tol' : D912_HEAD_D[5]/2. + TOL/2.,
'head_l' : D912_HEAD_L[5],
'head_l_tol' : D912_HEAD_L[5] + TOL,
'thread' : D912_THREAD[5],
'shank_l_list' : D912_L[5], # list of possible shank lengths
'ap2' : D912_2AP[5], # s: 2 x apotheme of the socket
}
D912_M6 = {
'd': 6., # diameter of the shank
'shank_r_tol' : 6 / 2. + 1.5*TOL/2., # mult 1.5 to have more tol
'head_r' : M6_HEAD_R,
'head_r_tol' : M6_HEAD_R_TOL,
'head_l' : M6_HEAD_L,
'head_l_tol' : M6_HEAD_L_TOL,
'thread' : D912_THREAD[6],
'shank_l_list' : D912_L[6], # list of possible shank lengths
'ap2' : M6_2AP, # s: 2 x apotheme of the socket
}
D912 = { 2.5: D912_M2_5,
3: D912_M3,
4: D912_M4,
5: D912_M5,
6: D912_M6 }
# Nut DIN934 dimensions
"""
___ _
/ \ | s_max: double the apothem
\___/ |_
r is the circumradius, usually called e_min
"""
# the circumdiameter, min value
NUT_D934_D = {
2: 4.32,
2.5: 5.45,
3: 6.01,
4: 7.66,
5: 8.79,
6: 11.05}
# double the apotheme, max value
NUT_D934_2A = {
2: 4.,
2.5: 5.,
3: 5.5,
4: 7.0,
5: 8.0,
6: 10.0}
# the heigth, max value
NUT_D934_L = {
2: 1.6,
2.5: 2.,
3: 2.4,
4: 3.2,
5: 4.0,
6: 5.0}
M3_NUT_R = NUT_D934_D[3] / 2.0
M3_NUT_L = NUT_D934_L[3] + TOL
# 1.5 TOL because diameter values are minimum, so they may be larger
M3_NUT_R_TOL = M3_NUT_R + 1.5*TOL
# constant related to inserted nuts. For example, to make a leadscrew
# The nut height multiplier to have enough space to introduce it
NUT_HOLE_MULT_H = 1.8
M3NUT_HOLE_H = NUT_HOLE_MULT_H * M3_NUT_L
#M3_2APOT_TOL = NUT_D934_2A[3] + TOL
# Apotheme is: R * cos(30) = 0.866
APOT_R = 0.866
M3_2APOT_TOL = 2* M3_NUT_R_TOL * APOT_R
M4_NUT_R = NUT_D934_D[4] / 2.0
M4_NUT_L = NUT_D934_L[4] + TOL
# 1.5 TOL because diameter values are minimum, so they may be larger
M4_NUT_R_TOL = M4_NUT_R + 1.5*TOL
D934_M2 = {
'in_d': 2., # inner diameter of the shank
'circ_d' : NUT_D934_D[2], #circumdiameter, min value
'circ_r' : NUT_D934_D[2]/2., #circumradius, min value
'circ_r_tol' : NUT_D934_D[2]/2. + 1.5*TOL , #circumradius + tol
'a2' : NUT_D934_2A[2], #double of apotheme, max value
'l' : NUT_D934_L[2], # height, max value
'l_tol' : NUT_D934_L[2] + TOL #height with tolerance
}
D934_M2_5 = {
'in_d': 2.5, # inner diameter of the shank
'circ_d' : NUT_D934_D[2.5], #circumdiameter, min value
'circ_r' : NUT_D934_D[2.5]/2., #circumradius, min value
'circ_r_tol' : NUT_D934_D[2.5]/2. + 1.5*TOL , #circumradius + tol
'a2' : NUT_D934_2A[2.5], #double of apotheme, max value
'l' : NUT_D934_L[2.5], # height, max value
'l_tol' : NUT_D934_L[2.5] + TOL #height with tolerance
}
D934_M3 = {
'in_d': 3., # inner diameter of the shank
'circ_d' : NUT_D934_D[3], #circumdiameter, min value
'circ_r' : NUT_D934_D[3]/2, #circumradius, min value
'circ_r_tol' : NUT_D934_D[3]/2 + 1.5*TOL , #circumradius + tol
'a2' : NUT_D934_2A[3], #double of apotheme, max value
'l' : NUT_D934_L[3], # height, max value
'l_tol' : NUT_D934_L[3] + TOL #height with tolerance
}
D934_M4 = {
'in_d': 4., # inner diameter of the shank
'circ_d' : NUT_D934_D[4], #circumdiameter, min value
'circ_r' : NUT_D934_D[4]/2, #circumradius, min value
'circ_r_tol' : NUT_D934_D[4]/2 + 1.5*TOL , #circumradius + tol
'a2' : NUT_D934_2A[4], #double of apotheme, max value
'l' : NUT_D934_L[4], # height, max value
'l_tol' : NUT_D934_L[4] + TOL #height with tolerance
}
D934_M5 = {
'in_d': 5., # inner diameter of the shank
'circ_d' : NUT_D934_D[5], #circumdiameter, min value
'circ_r' : NUT_D934_D[5]/2, #circumradius, min value
'circ_r_tol' : NUT_D934_D[5]/2 + 1.5*TOL , #circumradius + tol
'a2' : NUT_D934_2A[5], #double of apotheme, max value
'l' : NUT_D934_L[5], # height, max value
'l_tol' : NUT_D934_L[5] + TOL #height with tolerance
}
D934_M6 = {
'in_d': 6., # inner diameter of the shank
'circ_d' : NUT_D934_D[6], #circumdiameter, min value
'circ_r' : NUT_D934_D[6]/2, #circumradius, min value
'circ_r_tol' : NUT_D934_D[6]/2 + 1.5*TOL , #circumradius + tol
'a2' : NUT_D934_2A[6], #double of apotheme, max value
'l' : NUT_D934_L[6], # height, max value
'l_tol' : NUT_D934_L[6] + TOL #height with tolerance
}
D934 = {
2.5: D934_M2_5,
3: D934_M3,
4: D934_M4,
5: D934_M5,
6: D934_M6 }
# tightening bolt with added tolerances:
# Bolt's head radius
#tbolt_head_r = (tol * d912_head_d[sk_12['tbolt']])/2
# Bolt's head lenght
#tbolt_head_l = tol * d912_head_l[sk_12['tbolt']]
# Mounting bolt radius with added tolerance
#mbolt_r = tol * sk_12['mbolt']/2
# ------------- DIN 125 Washers (small) -----------------------
# The Index reffers to the Metric (M3,...
# Inner Diameter (of the hole). Minimum diameter.
WASH_D125_DI = {
2: 2.2,
2.5: 2.7,
3: 3.2,
4: 4.3,
5: 5.3,
6: 6.4,
7: 7.4,
8: 8.4,
10: 10.5 }
# Outer diameter (maximum size)
WASH_D125_DO = {
2: 5.0,
2.5: 6.0,
3: 7.0,
4: 9.0,
5: 10.0,
6: 12.0,
7: 14.0,
8: 16.0,
10: 20.0 }
# Thickness (Height) of the washer. there is tolerance
WASH_D125_T = {
2: 0.3, #0.25 to 0.35
2.5: 0.5, #0.45 to 0.55
3: 0.5, #0.45 to 0.55
4: 0.8, #0.7 to 0.8
5: 1.0,
6: 1.6,
7: 1.6,
8: 1.6,
10: 2.0 }
D125 = {} # empty dictionary
for (k_di, di), (k_do, do), (k_t, t) in zip(WASH_D125_DI.items(),
WASH_D125_DO.items(),
WASH_D125_T.items()):
# creation of a 2 dimension dictionary
# for example:
# D125[4]['do']
# will give the outer diameter of the M4 DIN125 washer
# k_di, k_do, k_t should have the same value in each iteration
# these 2 sentences are equivalent
#D125[k_di] = dict([('di',di),('do',do), ('t',t)])
D125[k_di] = dict(di=di, do=do, t=t)
if not ((k_di == k_do) and (k_di == k_t)):
logger.error('Keys are not ordered')
# ------------- DIN 9021 Washers (wide) -----------------------
# The Index reffers to the Metric (M3,...
# Inner Diameter of the hole. Minimum diameter.
WASH_D9021_DI = {
3: 3.2,
4: 4.3,
5: 5.3,
6: 6.4,
7: 7.4,
8: 8.4,
10: 10.5 }
# Outer diameter (maximum size)
WASH_D9021_DO = {
3: 9.0,
4: 12.0,
5: 15.0,
6: 18.0,
7: 22.0,
8: 24.0,
10: 30.0 }
# Height of the washer (thickness)
WASH_D9021_T = {
3: 0.8,
4: 1.0,
5: 1.2,
6: 1.6,
7: 2.0,
8: 2.0,
10: 2.5 }
D9021 = {} # empty dictionary
for (k_di, di), (k_do, do), (k_t, t) in zip(WASH_D9021_DI.items(),
WASH_D9021_DO.items(),
WASH_D9021_T.items()):
# creation of a 2 dimension dictionary
# for example:
# D9021[4]['do']
# will give the outer diameter of the M4 DIN9021 washer
# k_di, k_do, k_t should have the same value in each iteration
# these 2 sentences are equivalent
#D9021[k_di] = dict([('di',di),('do',do), ('t',t)])
D9021[k_di] = dict(di=di, do=do, t=t)
if not ((k_di == k_do) and (k_di == k_t)):
logger.error('Keys are not ordered')
# ------------- UNC Unified Coarse Thread
# USA and Canada Standard Threads from Unified Thread Standard UTS
# starts on #0 to #12 and then 1/4, 5/16, ... to 7/8, 1
# First number is related to the diameter, the other to the pitch
# for exampple #4-40 is 2.8448mm major diam. 40 tpi pitch
# https://en.wikipedia.org/wiki/Unified_Thread_Standard
# Major diameter in mm of a UNC thread
UNC_D = {
'0' : 1.5240, # #0
'1' : 1.8542, # #1
'2' : 2.1844,
'3' : 2.5146,
'4' : 2.8448,
'5' : 3.1750,
'6' : 3.5052,
'8' : 4.1656
} # it continues to #12 and then 1/4, ...
# ------------- Ball Bearings -----------------------
# Inner diameter
BEAR_DI = {
603: 3.0,
673: 3.0,
624: 4.0,
608: 8.0
}
# Outer diameter
BEAR_DO = {
603: 9.0,
673: 6.0,
624: 13.0,
608: 22.0
}
# Thickness (Height)
BEAR_T = {
603: 5.0,
673: 2.5,
624: 5.0,
608: 7.0
}
BEARING = {} # empty dictionary
for (k_ndi, di), (k_ndo, do), (k_nt, t) in zip(BEAR_DI.items(),
BEAR_DO.items(),
BEAR_T.items()):
# creation of a 2 dimension dictionary
# for example:
# BEARING[603]['do']
# will give the outer diameter of the 603 bearing
# the keys: k_ndi, k_ndo, k_nt should have the same value in each iteration
# these 2 sentences are equivalent
#BEARING[k_ndi] = dict([('di',di),('do',do), ('t',t)])
BEARING[k_ndi] = dict(di=di, do=do, t=t)
if not ((k_ndi == k_ndo) and (k_ndi == k_nt)):
logger.error('Keys are not ordered')
# to acces more easily to the dimensions of objects that are just
# a hollow cylinder, such as washers and bearings
# Arguments:
# part: 'bearing' or 'washer'
# size: metric size for the washers, and model (608, 624) for bearings
# kind: 'regular' or 'large' for washers
class HollowCyl(object):
def __init__ (self, part, size, kind = 'regular'):
self.part = part
self.size = size
self.kind = kind
if part == 'washer':
if kind == 'large': # DIN 9021
self.model = 'DIN9021'
self.d_in = WASH_D9021_DI[size] # inner diameter
self.d_out = WASH_D9021_DO[size] # outer diameter
self.thick = WASH_D9021_T[size] # thickness
elif kind == 'regular': # DIN 125
self.model = 'DIN125'
self.d_in = WASH_D125_DI[size]
self.d_out = WASH_D125_DO[size]
self.thick = WASH_D125_T[size]
else:
logger.error('Unkowon kind: HollowCyl')
elif part == 'bearing':
self.model = size
self.d_in = BEAR_DI[size]
self.d_out = BEAR_DO[size]
self.thick = BEAR_T[size]
self.r_in = self.d_in/2. # inner radius
self.r_out = self.d_out/2. # outer radius
# ----------------------------- Idler pulley components --------
# this may be an error, it is not a name list, is a objects list
# this is a name list from botton to top that shows the component
# order to make an idler pulley out of washers and bearings
"""
idler pulley with the one for the bolt
with dots goes the bolt head, not in the group
.....
_:_____:_ bolt head
___|_________|___ regular washer
|_________________| large washer
|_________| regular washer
| | bearing
|_________|
___|_________|___ regular washer
|_________________| large washer
"""
#idlepull_name_list = [
idpull4_nlist = [
HollowCyl (part = 'washer', size = 6, kind= 'large'), #bottom
HollowCyl (part = 'washer', size = 4, kind= 'regular'),
HollowCyl (part = 'bearing', size = 624), # 624ZZ
HollowCyl (part = 'washer', size = 4, kind= 'regular'),
HollowCyl (part = 'washer', size = 6, kind= 'large'),
HollowCyl (part = 'washer', size = 4, kind= 'large') #top for the bolt
]
idpull3_nlist = [
HollowCyl (part = 'washer', size = 4, kind= 'large'),
HollowCyl (part = 'washer', size = 3, kind= 'regular'),
HollowCyl (part = 'bearing', size = 603), # 603ZZ
HollowCyl (part = 'washer', size = 3, kind= 'regular'),
HollowCyl (part = 'washer', size = 4, kind= 'large'),
HollowCyl (part = 'washer', size = 3, kind= 'large') #top for the bolt
]
# idler pulley list will be different depending on the size of the bolt that
# holds them
idpull_dict = { 3: idpull3_nlist, 4: idpull4_nlist }
"""
idler pulley without the washer for the bolt because it is between a holder,
The holder is in dots, not in the group
.......
..........:.....:........ bolt head
: Holder for the pulley group
....._________________...:
|_________________| large washer
|_________| regular washer
| | bearing
|_________|
___|_________|___ regular washer
....|_________________|.. large washer
:
.........................: Holder for the pulley group
:.....: nut
:.: bolt shank
So it is symmetrical from bottom to top
"""
idpull4min_list = [
HollowCyl (part = 'washer', size = 6, kind= 'large'), #bottom
HollowCyl (part = 'washer', size = 4, kind= 'regular'),
HollowCyl (part = 'bearing', size = 624), # 624ZZ
HollowCyl (part = 'washer', size = 4, kind= 'regular'),
HollowCyl (part = 'washer', size = 6, kind= 'large'),
HollowCyl (part = 'washer', size = 4, kind= 'large') #top for the bolt
]
idpull3min_list = [
HollowCyl (part = 'washer', size = 4, kind= 'large'), #bottom
HollowCyl (part = 'washer', size = 3, kind= 'regular'),
HollowCyl (part = 'bearing', size = 603), # 603ZZ
HollowCyl (part = 'washer', size = 3, kind= 'regular'),
HollowCyl (part = 'washer', size = 4, kind= 'large') # top
]
idpullmin_dict = { 3: idpull3min_list, 4: idpull4min_list }
# from an idlepull_name_list, returns the maximum diameter of its bearings
# check that it is the same as getmaxbeardiam in partgroup.py
def get_idlepull_maxbear_d (idlepull_list):
d_maxbear = 0
for ind, elem in enumerate(idlepull_list):
if elem.part == 'bearing':
if d_maxbear < elem.d_out :
d_maxbear = elem.d_out
return d_maxbear
# ------------------------- Linear bearing housing
# Similar to SC10UU, but without many the details, just the main dimensions
#
# bolt_d
# : :
# _______________ ..... ________________
# |: : ___ : :| : |.:.:........:.:.|
# |: : / \ : :| H + | : : : : |
# |----|-----|----|---- : | : : : : |
# |: : \___/ : :| + axis_h : |.:.:........:.:.|
# |:_:_________:_:|...: :....|_:_:________:_:_|
# : : : : : : : :
# : :...........: : : :..........: :
# : bolt_sep_w : : bolt_sep_l :
# :...... W ......: :......L.........:
#
#
# _____________
# | 0 : : 0 |
# | : : |
# | : : |
# | : : |
# | : : |
# |_0_:_____:_0_|
#
SC8UU = {
'L' : 30.,
'W' : 34.,
'H' : 22.,
'axis_h' : 11.,
'bolt_sep_l' : 18.,
'bolt_sep_w' : 24.,
'bolt_d' : 4., # M4
'lbear' : LM8UU #dictionary with linear bearging dim.
}
SC10UU = {
'L' : 35.,
'W' : 40.,
'H' : 26.,
'axis_h' : 13.,
'bolt_sep_l' : 21.,
'bolt_sep_w' : 28.,
'bolt_d' : 5., # M5
'lbear' : LM10UU #dictionary with linear bearging dim.
}
SC12UU = {
'L' : 40., # they say 36, but it is too small
'W' : 42.,
'H' : 28.,
'axis_h' : 15.,
'bolt_sep_l' : 26.,
'bolt_sep_w' : 30.5,
'bolt_d' : 5., # M5
'lbear' : LM12UU #dictionary with linear bearging dim.
}
SCE20UU = {
'L' : 53.,
'W' : 54.,
'H' : 41.,
'axis_h' : 21.,
'bolt_sep_l' : 40.,
'bolt_sep_w' : 40.,
'bolt_d' : 6., # M6
'lbear' : LME20UU #dictionary with linear bearging dim.
}
# modified version to print
SC8UU_Pr = {
'L' : 30.,
'W' : 34.,
'H' : 22.,
'axis_h' : 11.,
'bolt_sep_l' : 18.,
'bolt_sep_w' : 24.,
'bolt_d' : 3., # M3: changed from M4 to M3
'lbear' : LME8UU #dictionary with linear bearging dim.
}
SC10UU_Pr = {
'L' : 35.,
'W' : 40.,
'H' : 26.,
'axis_h' : 13.,
'bolt_sep_l' : 21.,
'bolt_sep_w' : 28.,
'bolt_d' : 3., # M3: changed from M5 to M3
'lbear' : LME10UU #dictionary with linear bearging dim.
}
SC12UU_Pr = {
'L' : 36.,
'W' : 42.,
'H' : 28.,
'axis_h' : 15.,
'bolt_sep_l' : 26.,
'bolt_sep_w' : 30.5,
'bolt_d' : 3., # M3: changed from M5 to M3
'lbear' : LME12UU #dictionary with linear bearging dim.
}
SCE20UU_Pr30 = { # to print with 30x30 profiles sep_l = 60
'L' : 74.,
'W' : 54.,
'H' : 41.,
'axis_h' : 21.,
'bolt_sep_l' : 60.,
'bolt_sep_w' : 40.,
'bolt_d' : 6., # M6
'lbear' : LME20UU #dictionary with linear bearging dim.
}
SCE20UU_Pr30b = { # to print with 30x30 profiles sep_l = 30
'L' : 53.,
'W' : 54.,
'H' : 41.,
'axis_h' : 21.,
'bolt_sep_l' : 30.,
'bolt_sep_w' : 40.,
'bolt_d' : 6., # M6
'lbear' : LME20UU #dictionary with linear bearging dim.
}
SCUU = {
8: SC8UU,
10: SC10UU,
12: SC12UU
}
SCUU_Pr = {
8: SC8UU_Pr,
10: SC10UU_Pr,
12: SC12UU_Pr
}
SCEUU_Pr = {
20: SCE20UU_Pr30
}
# ----------------------------- NEMA motor dimensions --------
# width of the motor (both dimensions: it is a square) in mm
NEMA_W = {
8: 20.2,
11: 28.2,
14: 35.2,
17: 42.3,
23: 56.4,
34: 86.0,
42: 110.0 }
# Separation of the holes for the bolts
NEMA_BOLT_SEP = {
8: 16.0,
11: 23.0,
14: 26.0,
17: 31.0,
23: 47.1,
34: 69.6,
42: 89.0 }
# Diameter of the shaft
NEMA_SHAFT_D = {
8: 4.0,
11: 5.0,
14: 5.0,
17: 5.0,
23: 6.35,
34: 14.0,
42: 19.0 }
# Bolt diameter
NEMA_BOLT_D = {
8: 2.0, # M2
11: 2.5, # M2.5
14: 3.0, # M3
17: 3.0, # M3
23: 5.5,
34: 5.5,
42: 8.5 }
# _______ .....................................
# | ___ | :
# | / d.\.|................. :
# | \___/ | __ : + H
# __| |__ /| ... + h :
# |_____________|/ ...+L......:....................:
# : :
# :......W......:
#
# ....I....
# :_______: _______________________________
# | ___ | :
# | / \ | __________ :
# | \___/ | : + H
# ___| |___ ...... + h :
# |_:___________:_|.....+g ____:____________________:
# : :
# :......B....: S: diameter of the 2 thruholes
# ----------------------------- shaft holder SK dimensions --------
# there are different brands, and are not all the same,
# Also valid for dold SH
# A is not necessary, it is just the half of W
# b is not necessary, it is just (W-B)/2
# mbolt: is the metric of the mounting bolt
# tbolt: is the metric of the tightening bolt
SK6 = { 'd':6.0, 'H':32.8, 'W':42.0, 'L':14.0, 'B':32.0, 'S':5.5,
'h':20.0,
#'A':21.0,
#'b': 5.0,
'g':6.0,
'I':18.0,
'mbolt': 5,
'tbolt': 4}
SK8 = { 'd':8.0, 'H':32.8, 'W':42.0, 'L':14.0, 'B':32.0, 'S':5.5,
'h':20.0,
#'A':21.0,
#'b': 5.0,
'g':6.0,
'I':18.0,
'mbolt': 5,
'tbolt': 4}
# to make with the same height of a pillow block
# H: just 6.8 less
PILLOW_SK8 = { 'd':8.0, 'H':26., 'W':42.0, 'L':14.0, 'B':32.0, 'S':5.5,
'h':15.0,
#'A':21.0,
#'b': 5.0,
'g':6.0,
'I':18.0,
'mbolt': 5,
'tbolt': 4}
SK10 = { 'd':10.0, 'H':32.8, 'W':42.0, 'L':14.0, 'B':32.0, 'S':5.5,
'h':20.0,
#'A':21.0,
#'b': 5.0,
'g': 6.0,
'I': 18.0,
'mbolt': 5,
'tbolt': 4}
SK12 = { 'd':12.0, 'H':36, 'W':71.0, 'L':14.0, 'B':32.0, 'S':5.5,
'h':23.0,
#'A':21.0,
#'b': 5.0,
'g': 6.0,
'I': 20.0,
'mbolt': 5,
'tbolt': 4}
# add tolerances L= 12 + 4 (bearing). Just approximate, the shape is not the
# same
PILLOW_SK12 = { 'd':12.3, 'H':26., 'W':42.0, 'L':16.0, 'B':56.0, 'S':7.,
'h':18.0,
#'A':21.0,