-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathvacuum-hose-adapter-openscad.scad
1632 lines (1534 loc) · 63.5 KB
/
vacuum-hose-adapter-openscad.scad
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
// Hose connector
// version 2024-04-30
// repo https://github.com/ostat/vacuum-hose-adapter-openscad
//
// I give permision to use this script as you want, you are also free to sell models generated using this script. When sharing or selling models generated please provide attribution, with a link to the repo.
//
// I don't approve of you hosting or uploading this script it to any site or 3d modeling site.
use <modules/ub.scad>
include <modules/constants.scad>
include <modules/modules_utility.scad>
include <modules/modules_pipe.scad>
include <modules/connector_object.scad>
include <modules/connector_common.scad>
include <modules/connector_hose.scad>
include <modules/connector_flange.scad>
include <modules/connector_magnetic.scad>
include <modules/connector_nozzle.scad>
include <modules/connector_camlock.scad>
include <modules/connector_centec.scad>
include <modules/connector_dyson.scad>
include <modules/connector_dw735.scad>
include <modules/connector_osvac.scad>
include <modules/connector_makita.scad>
include <modules/connector_common_post.scad>
//TODO Ideas
//All pre and post trasition length. so a flat section before and after the taper.abs
/* [Hidden] */
DefaultEnd1Color = "LightPink";
DefaultEnd2Color = "SkyBlue";
DefaultEnd3Color = "MediumPurple";
DefaultTransitionColor = "LightGreen";
DefaultExtensionColor = "MediumSeaGreen";
/* [Connector 1] */
//Wall thickness
End1_Wall_Thickness = 2; //0.01
//The style of the end
End1_Style="flange"; // [mag: Magnetic Flange, flange: Flange, hose: Hose connector, dyson: Dyson connector, camlock: CAMLOCK connetor, dw735: Dewalt DW735x, centec_female: Cen-Tec quick female connect, centec_male: Cen-Tec quick male connect, osvacm32:osVAC M32, osvacm:osVAC Male, osvacf32:osVAC F32,osvacf:osVAC Female, makita_male: Makita Quick connect Male connector]
// Is the measurement the adapter's outside or inside diameter?
End1_Measurement = "inner"; //[inner, outer]
// End 1 diameter of the adapter (mm, inch)
End1_Diameter = [50,0]; //0.01
//Length of the start connector, including the flange (mm, inch).
End1_Length = [15,0]; //0.1
//Rotation around the z axis. Userfull for non symeterical connectors.
End1_Rotation= 0;
//Taper of the start connector, use negative to taper other direction.
End1_Taper = 0; //0.1
/* [Connector 1 - Hose connector] */
//Thickness of hose stop
End1_StopThickness = 0; //1
//Length of hose stop
End1_StopLength = 0; //1
//Should the stop be tapered both sides. Might easier to print.
End1_Stop_Symmetrical = false;
//Number of barbs
End1_Barbs_Count = 0;
//Thickness of the barbs, default is half wall thickness
End1_Barbs_Thickness = 0; //0.1
//Should the barbes be tapered both sides. Might be easier to print.
End1_Barbs_Symmetrical = false;
//End Cap Inner Diameter.
End1_Hose_EndCap_Diameter = 0; //0.1
//Thickness of endcap.
End1_Hose_EndCap_Thickness = 0; //0.1
//End cap grid size for holes
End1_Hose_EndCap_GridSize = 0; //0.1
//Thickness of the walls in the end cap
End1_Hose_EndCap_GridWallThickness = 0; //0.1
/* [Connector 1 - Flange] */
//Width of Flange added to the connector diamater
End1_Flange_Width = 20;
//Thickness of the flange
End1_Flange_Thickness = 5;
//Position of the screws added to the connector diamater, 0 = middle of flange
End1_Flange_Screw_Position= 0;
//Minium amount of the material around the magnet holes(mm), 0 = End1_Flange_Width / 4
End1_Flange_Screw_Border = 5; //0.1
//Number of Screw holes flange
End1_Flange_Screw_Count = 4;
//The diameter of the screws (mm)
End1_Flange_Screw_Diameter = 5; //0.1
/* [Connector 1 - Magnetic Connector] */
//Number of magnets in the connector
End1_Magnets_Count = 8;
//The diameter of the magnets (mm)
End1_Magnet_Diameter = 10.5; //0.1
//The thickness of the magnets (mm)
End1_Magnet_Thickness = 2.5; //0.1
//Minium amount of the material around the magnets (mm)
End1_Magnet_Border = 2; //0.1
//Raises the magent so it is fully enclosed (mm)
End1_Magnet_ZOffset = 0; //0.1
// Thickness of the magnet flange (mm)
End1_Magnet_Flange_Thickness = 6; //0.1
// Include a flange alignment ring
End1_Ring = "no"; //[no: No alignment ring, protruding: protruding ring, recessed: Recessed ring]
// Magnetic ring Twist lock bolt size (draft setting)
End1_Magnet_Twist_Lock_Size = "0"; //["0":none,"3":M3,"3cnc":M3 with CNC Kitchen insert,"4":M4,"4cnc":M4 with CNC Kitchen insert,"5":M5,"5cnc":M5 with CNC Kitchen insert]
/* [Connector 1 - Extension] */
//Length of the extnetion
End1_Extension_Length = 0;
//Size of the grid in the extnetion. 0: diameter/6
End1_Extension_GridSize = 0; //0.1
//Size of the grid walls in the extnetion. 0: no grid, -1: uses wall thickness
End1_Extension_GridWallThickness = 0; //0.1
End1_Extension_Text = "";
End1_Extension_Text_Size = 0;
/* [Transition] */
// tapered for hose connections, flat for attaching to a device
Transition_Style = "bend+taper"; //[flat, taper+bend: Taper then bend, bend+taper: Bend then taper, organicbend: Tapered bend, hull: Hull for multiple end count, none: no transition]
//Length of the transition between the two ends
Transition_Length = 10; //1
// Radius of transition bend (mm)
Transition_Bend_Radius = 0; //1
//Angle of bend through the transition section.
Transition_Angle = 0; //1
// offset for the connector, not supported on taperedbend.
Transition_Offset = [0,0]; // 0.1
/* [Transition Multiple connector settings] */
// Dupliacte the second connector. Adjust angle and bend radius to make it work.
Transition_End2_Count = 1; //[1, 2, 3, 4, 5, 6]
// MulitConnector, connector in hull length.
Transition_HullLength = 0; // 0.1
// MulitConnector, add center connector.
Transition_HullCenter = "disabled"; //[disabled,end1,end2,end3]
Transition_HullCenterLength = 0;
// MulitConnector, connector in hull offset.
Transition_HullyOffset = 0; // 0.1
// MulitConnector, center connector height. default is 2*lengthInHull
Transition_HullCenterHeight = 0;
/* [Transition Support For Angled Pipes] */
// Include a flate section on the transition to assist with printing
Transition_Base_Type="none"; // [none, oval, rectangle]
//Support Base Additional Thickness;
Transition_Base_Thickness=0;
//Support Base Width, Default is half diameter
Transition_Base_Width=0;
// Support Base Length Default is 2/3 diameter
Transition_Base_Length=0;
// Support Base Angle position, default half of Bend Radius;
Transition_Base_Angle=0;
/* [Connector 2] */
//Wall thickness
End2_Wall_Thickness = 2; //0.01
End2_Style="nozzle"; // [mag: Magnetic Flange, flange: Flange, hose: Hose connector, nozzle: Nozzle attachement, dyson: Dyson connector, camlock: CAMLOCK connetor, dw735: Dewalt DW735x, centec_female: Cen-Tec quick female connect, centec_male: Cen-Tec quick male connect, osvacm32:osVAC M32, osvacm:osVAC Male, osvacf32:osVAC F32,osvacf:osVAC Female, makita_male: Makita Quick connect Male connector, none: None]
// Is the measurement the adapter's outside or inside diameter?
End2_Measurement = "outer"; //[inner, outer]
// End 2 diameter of the adapter (mm, inch)
End2_Diameter = [40,0]; //0.01
//Length of the start connector, including the flange (mm, inch).
End2_Length = [40 ,0]; //0.1
//Rotation around the z axis. Userfull for non symeterical connectors.
End2_Rotation= 0;
//Taper of the start connector, use negative to taper other direction.
End2_Taper = 0; //0.1
/*[Connector 2 - Hose connector] */
//Thickness of hose stop
End2_StopThickness = 0; //1
//Length of hose stop
End2_StopLength = 0; //1
//Should the stop be tapered both sides. Might easier to print.
End2_Stop_Symmetrical = false;
//Number of barbs
End2_Barbs_Count = 0;
//Thickness of the barbs, default is half wall thickness
End2_Barbs_Thickness = 0; //0.1
//Should the barbes be tapered both sides. Might be easier to print.
End2_Barbs_Symmetrical = false;
//Thickness of endcap, 0 means disabled
End2_Hose_EndCap_Thickness = 0; //0.1
//End Cap Inner Diameter.
End2_Hose_EndCap_Diameter = 0; //0.1
//End cap grid size for holes
End2_Hose_EndCap_GridSize = 0; //0.1
//Thickness of the walls in the end cap
End2_Hose_EndCap_GridWallThickness = 0; //0.1
/* [Connector 2 - Flange] */
//Width of Flange added to the connector diamater
End2_Flange_Width = 20;
//Thickness of the flange
End2_Flange_Thickness = 5;
//Position of the screws added to the connector diamater, 0 = middle of flange
End2_Flange_Screw_Position= 0;
//Minium amount of the material around the magnets (mm), 0 = End1_Flange_Width / 4
End2_Flange_Screw_Border = 5; //0.1
//Number of Screw holes flange
End2_Flange_Screw_Count = 4;
//The diameter of the screws (mm)
End2_Flange_Screw_Diameter = 5; //0.1
/* [Connector 2 - Magnetic Flange] */
//Number of magnets in the flange
End2_Magnets_Count = 6; //1
//The diameter of the magnets
End2_Magnet_Diameter = 12; //0.1
//The thickness of the magnets
End2_Magnet_Thickness = 3; //0.1
//Size of the material around the magnets
End2_Magnet_Border = 2; //0.1
//Raises the magent so it is fully enclosed (mm)
End2_Magnet_ZOffset = 0; //0.1
//Inner diameter of the Magnet flange
End2_Magnet_Flange_Thickness = 10; //0.1
//Include a flange alignment ring
End2_Ring = "no"; //[no: No alignment ring, protruding: Protruding ring, recessed: Recessed ring]
//Magnetic ring twist lock bolt size (draft setting)
End2_Magnet_Twist_Lock_Size = "0"; //["0":none,"3":M3,"3cnc":M3 with CNC Kitchen insert,"4":M4,"4cnc":M4 with CNC Kitchen insert,"5":M5,"5cnc":M5 with CNC Kitchen insert]
/* [Connector 2 - Nozzle] */
// Is the measurement the adapter's outside or inside diameter?
End2_Nozzle_Shape = "square"; //[square, circle]
End2_Nozzle_Size = [10,5,10]; //0.1
End2_Nozzle_Tip_Wall_Thickness = 0; //0.1
End2_Nozzle_Radius = 0; //0.1
End2_Nozzle_Offset = [0,0]; //0.1
End2_Nozzle_Chamfer_Percentage = 0; //0.1
End2_Nozzle_Chamfer_Angle = 0; //0.1
/* [Connector 2 - Extension] */
//Length of the extnetion
End2_Extension_Length = 0;
//Size of the grid in the extnetion. 0: diameter/6
End2_Extension_GridSize = 0; //0.1
//Size of the grid walls in the extnetion. 0: no grid, -1: uses wall thickness
End2_Extension_GridWallThickness = 0; //0.1
End2_Extension_Text = "";
End2_Extension_Text_Size = 0;
/* [Connector 3] */
//Wall thickness
End3_Wall_Thickness = 2; //0.01
End3_Style="nozzle"; // [mag: Magnetic Flange, flange: Flange, hose: Hose connector, nozzle: Nozzle attachement, dyson: Dyson connector, camlock: CAMLOCK connetor, dw735: Dewalt DW735x, centec_female: Cen-Tec quick female connect, centec_male: Cen-Tec quick male connect, osvacm32:osVAC M32, osvacm:osVAC Male, osvacf32:osVAC F32,osvacf:osVAC Female, makita_male: Makita Quick connect Male connector, none: None]
// Is the measurement the adapter's outside or inside diameter?
End3_Measurement = "outer"; //[inner, outer]
// End 3 diameter of the adapter (mm, inch)
End3_Diameter = [40,0]; //0.01
//Length of the start connector, including the flange (mm, inch).
End3_Length = [40 ,0]; //0.1
//Rotation around the z axis. Userfull for non symeterical connectors.
End3_Rotation= 0;
//Taper of the start connector, use negative to taper other direction.
End3_Taper = 0; //0.1
/*[Connector 3 - Hose connector] */
//Thickness of hose stop
End3_StopThickness = 0; //1
//Length of hose stop
End3_StopLength = 0; //1
//Should the stop be tapered both sides. Might easier to print.
End3_Stop_Symmetrical = false;
//Number of barbs
End3_Barbs_Count = 0;
//Thickness of the barbs, default is half wall thickness
End3_Barbs_Thickness = 0; //0.1
//Should the barbes be tapered both sides. Might be easier to print.
End3_Barbs_Symmetrical = false;
//Thickness of endcap, 0 means disabled
End3_Hose_EndCap_Thickness = 0; //0.1
//End Cap Inner Diameter.
End3_Hose_EndCap_Diameter = 0; //0.1
//End cap grid size for holes
End3_Hose_EndCap_GridSize = 0; //0.1
//Thickness of the walls in the end cap
End3_Hose_EndCap_GridWallThickness = 0; //0.1
/* [Connector 3 - Flange] */
//Width of Flange added to the connector diamater
End3_Flange_Width = 20;
//Thickness of the flange
End3_Flange_Thickness = 5;
//Position of the screws added to the connector diamater, 0 = middle of flange
End3_Flange_Screw_Position= 0;
//Minium amount of the material around the magnets (mm), 0 = End1_Flange_Width / 4
End3_Flange_Screw_Border = 5; //0.1
//Number of Screw holes flange
End3_Flange_Screw_Count = 4;
//The diameter of the screws (mm)
End3_Flange_Screw_Diameter = 5; //0.1
/* [Connector 3 - Magnetic Flange] */
//Number of magnets in the flange
End3_Magnets_Count = 6; //1
//The diameter of the magnets
End3_Magnet_Diameter = 12; //0.1
//The thickness of the magnets
End3_Magnet_Thickness = 3; //0.1
//Size of the material around the magnets
End3_Magnet_Border = 2; //0.1
//Raises the magent so it is fully enclosed (mm)
End3_Magnet_ZOffset = 0; //0.1
// Inner diameter of the Magnet flange
End3_Magnet_Flange_Thickness = 10; //0.1
// Include a flange alignment ring
End3_Ring = "no"; //[no: No alignment ring, protruding: Protruding ring, recessed: Recessed ring]
// Magnetic ring twist lock bolt size (draft setting)
End3_Magnet_Twist_Lock_Size = "0"; //["0":none,"3":M3,"3cnc":M3 with CNC Kitchen insert,"4":M4,"4cnc":M4 with CNC Kitchen insert,"5":M5,"5cnc":M5 with CNC Kitchen insert]
/* [Connector 3 - Nozzle] */
// Is the measurement the adapter's outside or inside diameter?
End3_Nozzle_Shape = "square"; //[square, circle]
End3_Nozzle_Size = [10,5,10]; //0.1
End3_Nozzle_Tip_Wall_Thickness = 0; //0.1
End3_Nozzle_Radius = 0; //0.1
End3_Nozzle_Offset = [0,0]; //0.1
End3_Nozzle_Chamfer_Percentage = 0; //0.1
End3_Nozzle_Chamfer_Angle = 0; //0.1
/* [Connector 3 - Extension] */
//Length of the extnetion
End3_Extension_Length = 0;
//Size of the grid in the extnetion. 0: diameter/6
End3_Extension_GridSize = 0; //0.1
//Size of the grid walls in the extnetion. 0: no grid, -1: uses wall thickness
End3_Extension_GridWallThickness = 0; //0.1
End3_Extension_Text = "";
End3_Extension_Text_Size = 0;
/* [Alignment Ring] */
//draw just the alignment ring
Draw_Alignment_Ring = "no"; //[end1: Draw end 1, end2: Draw end 2, no: Don't draw]
//Alignment depth in to flange (mm)
Alignment_Depth = 2; //0.1
//Alignment upper width at widest part (mm)
Alignment_Upper_Width = 3; //0.1
//Alignment lower width at narrowest part (mm)
Alignment_Lower_Width = 0.5; //0.1
//Alignment side clearance, to give nice fit (mm).
Alignment_Side_Clearance = 0.25; //0.01
//Alignment Depth Clearance, to prevent hitting bottom (mm).
Alignment_Depth_Clearance = .75; //0.01
/* [other] */
//Slice model inhalf to be able to easy see inside
Enable_Debug_Slice = false;
//Will only show if debug is also enabled
Enable_Calipers_Slice = false;
Enable_Help = false;
End1_Color = [DefaultEnd1Color,1]; //0.1
End2_Color = [DefaultEnd2Color,1]; //0.1
End3_Color = [DefaultEnd3Color,1]; //0.1
Transition_Color = [DefaultTransitionColor,1]; //The color, then the alpha value
Extension_Color = [DefaultExtensionColor,1]; //The color, then the alpha value
/* [Hidden] */
//Detail
$fn=120;
module end_of_customizer_opts() {}
function getColor(colorSetting, defaultColor) =
assert(is_list(colorSetting), str("colorSetting must be a list colorSetting=", colorSetting, " defaultColor", defaultColor))
assert(len(colorSetting) == 2, "colorSetting be length 2")
let(
c = colorSetting[0] == "" ? defaultColor : colorSetting[0],
a = is_num(colorSetting[1]) && colorSetting[1] >=0 && colorSetting[1] <=1 ? colorSetting[1] : 1) [c,a];
HoseAdapter();//execution point
module adapterAlignmentRing(
centerDiameter = 0,
alignmentDepth = 0,
alignmentUpperWidth = 0,
alignmentLowerWidth = 0,
alignmentSideClearance = 0,
alignmentDepthClearance = 0,
magnetBorder = 0,
debug = false,
showCaliper=false,
help){
difference(){
AlignmentRing(
centerDiameter = centerDiameter,
alignmentDepth = alignmentDepth,
alignmentUpperWidth = alignmentUpperWidth,
alignmentLowerWidth = alignmentLowerWidth,
alignmentSideClearance = alignmentSideClearance,
alignmentDepthClearance = alignmentDepthClearance,
magnetBorder = magnetBorder);
if($preview&&debug){
cubeSziex = centerDiameter+max(alignmentUpperWidth, alignmentLowerWidth);
cubeSziey = centerDiameter/2+max(alignmentUpperWidth, alignmentLowerWidth);
cubeSziez = alignmentDepth*2;
translate([-cubeSziex/2, -cubeSziey, -cubeSziez/2])
cube([cubeSziex,cubeSziey,cubeSziez]);
}
}
if($preview&&showCaliper){
color("Gold")
union(){
rotate([90,0,0])
Caliper(messpunkt = false, help=0, size = 5,h = 0.1,
//center=false,
l=centerDiameter+max(alignmentUpperWidth, alignmentLowerWidth),
end=0, in=1,
translate= [0,10,0],
txt2 = "centerDiameter");
translate([(centerDiameter)/2,0,0])
rotate([90,90,0])
Caliper(messpunkt = false, help=0, size = 5,h = 0.1,
l=(alignmentDepth-alignmentDepthClearance)*2,
end=0, in=4,
cx= 0,
translate= [0,5,0],
txt2 = "alignmentDepth");
}
}
HelpTxt("adapterAlignmentRing",[
"centerDiameter", centerDiameter,
"magnetBorder", magnetBorder,
"alignmentDepth", alignmentDepth,
"alignmentUpperWidth", alignmentUpperWidth,
"alignmentLowerWidth", alignmentLowerWidth,
"alignmentSideClearance", alignmentSideClearance,
"alignmentDepthClearance", alignmentDepthClearance,
"debug", debug]
,help);
}
module adapter(
con =[],
connectorPos = 1,
transitionAngle = 0,
debug = false,
showCaliper=false,
help
){
assert(is_list(con), "con must be a list")
assert(is_num(con[iLength]), str("length must be a number :", con[iLength]));
assert(is_num(con[iStopLength]), "stopLength must be a number");
assert(is_list(con[iAdapterColor]), "adapterColor must be a list")
assert(len(con[iAdapterColor]) == 2, "adapterColor be length 2")
//Create the start connector
if(con[iLength] > 0)
{
difference()
{
color(con[iAdapterColor][0], con[iAdapterColor][1])
rotate([0,0,con[iRotation]])
union(){
if(con[iStyle] == "mag")
{
translate([0, 0, con[iLength]+con[iStopLength]])
mirror ([0,0,1])
MagneticConnector(
innerStartDiameter = con[iInnerStartDiameter],
innerEndDiameter = con[iInnerEndDiameter],
length = con[iLength],
wallThickness = con[iWallThickness],
magnetDiameter = con[iMagnetDiameter],
magnetThickness = con[iMagnetThickness],
magnetBorder = con[iMagnetBorder],
magnetZOffset = con[iMagnetZOffset],
flangeThickness = con[iMagnetFlangeThickness],
magnetCount = con[iMagnetCount],
alignmentRing = con[iAlignmentRing],
alignmentDepth = con[iAlignmentDepth],
alignmentUpperWidth = con[iAlignmentUpperWidth],
alignmentLowerWidth = con[iAlignmentLowerWidth],
alignmentSideClearance = con[iAlignmentSideClearance],
alignmentDepthClearance = con[iAlignmentDepthClearance],
twistLockSize = con[iMagnetTwistLockSize],
$fn = $fn);
}
else if(con[iStyle] == "flange")
{
translate([0, 0, con[iLength]+con[iStopLength]])
mirror ([0,0,1])
FlangeConnector(
innerStartDiameter = con[iInnerStartDiameter],
innerEndDiameter = con[iInnerEndDiameter],
length = con[iLength],
wallThickness = con[iWallThickness],
flangeThickness = con[iFlangeThickness],
flangeWidth = con[iFlangeWidth],
screwPosition = con[iFlangeScrewPosition],
screwBorder = con[iFlangeScrewBorder],
screwCount = con[iFlangeScrewCount],
screwDiameter = con[iFlangeScrewDiameter],
help = help,
$fn = $fn);
}
else if(con[iStyle] == "hose")
{
translate([0, 0, con[iLength]+con[iStopLength]])
mirror ([0,0,1])
HoseConnector(
innerStartDiameter = con[iInnerStartDiameter],
innerEndDiameter = con[iInnerEndDiameter],
connectorMeasurement = con[iMeasurement],
length = con[iLength],
wallThickness = con[iWallThickness],
stopLength = con[iStopLength],
stopWidth = con[iStopThickness],
stopSymmetrical = con[iStopSymmetrical],
barbsCount = con[iBarbsCount],
barbsThickness = con[iBarbsThickness],
barbsSymmetrical = con[iBarbsSymmetrical],
endCapDiameter = con[iEndCapDiameter],
endCapThickness = con[iEndCapThickness],
endCapGridSize = con[iEndCapGridSize],
endCapGridWallThickness = con[iEndCapGridWallThickness],
help = help,
$fn = $fn);
}
else if(con[iStyle] == "dyson")
{
translate([0, 0, con[iLength]+con[iStopLength]])
mirror ([0,0,1])
DysonConnector(
innerEndDiameter = con[iInnerEndDiameter],
length = con[iLength],
wallThickness = con[iWallThickness],
IncludeOrientationClip = true,
$fn = $fn);
}
else if(con[iStyle] == "camlock")
{
translate([0, 0, con[iLength]+con[iStopLength]])
mirror ([0,0,1])
CamlockConnector(
innerEndDiameter = con[iInnerEndDiameter],
length = con[iLength],
wallThickness = con[iWallThickness],
$fn = $fn);
}
else if(con[iStyle] == "dw735")
{
translate([0, 0, con[iLength]+con[iStopLength]])
mirror ([0,0,1])
Dw735Connector(
innerEndDiameter = con[iInnerEndDiameter],
length = con[iLength],
wallThickness = con[iWallThickness],
connectorCount = transitionAngle > 0 ? 6 : 1,
$fn = $fn);
}
else if(con[iStyle] == "centec_female")
{
translate([0, 0, con[iLength]+con[iStopLength]])
mirror ([0,0,1])
CenTecFemaleConnector($fn = $fn);
}
else if(con[iStyle] == "centec_male")
{
translate([0, 0, con[iLength]+con[iStopLength]])
mirror ([0,0,1])
CenTecMaleConnector($fn = $fn);
}
else if(con[iStyle] == "makita_male")
{
translate([0, 0, con[iLength]+con[iStopLength]])
mirror ([0,0,1])
MakitaMaleConnector(
help = help,
$fn = $fn);
}
else if(con[iStyle] == "osvacm" || con[iStyle] == "osvacm32")
{
translate([0, 0, con[iLength]+con[iStopLength]])
mirror ([0,0,1])
osVacMaleConnector(
innerDiameter = con[iInnerEndDiameter],
length = con[iLength],
help = help,
$fn = $fn);
}
else if(con[iStyle] == "osvacf" || con[iStyle] == "osvacf32")
{
translate([0, 0, con[iLength]+con[iStopLength]])
mirror ([0,0,1])
osVacFemaleConnector(
innerDiameter = con[iInnerEndDiameter],
length = con[iLength],
help = help,
$fn = $fn);
}
else if(con[iStyle] == "nozzle")
{
Nozzle(
innerStartDiameter = con[iInnerStartDiameter],
length = con[iLength],
wallThickness = con[iWallThickness],
nozzleShape = con[iNozzleShape],
nozzleSize = con[iNozzleSize],
nozzleTipWallThickness = con[iNozzleTipWallThickness],
nozzleRadius = con[iNozzleRadius],
nozzleOffset = con[iNozzleOffset],
nozzleChamferPercentage = con[iNozzleChamferPercentage],
nozzleChamferAngle = con[iNozzleChamferAngle],
help = help,
$fn = $fn);
} else if(con[iStyle] == "none"){ }
else {
assert(false, str("style not supported style: ", con[iStyle]));
}
}
if($preview&&debug&&con[iStyle]!="none"){
cubeSziex = max(con[iInnerStartDiameter],con[iInnerEndDiameter])*2;
cubeSziey = max(con[iInnerStartDiameter],con[iInnerEndDiameter])*1.5;
cubeSziez = con[iLength]+con[iStopLength]+fudgeFactor*4
+(con[iStyle] == "nozzle"? con[iNozzleSize].z+fudgeFactor : 0)
+(con[iStyle] == "mag"? con[iAlignmentDepth]: 0);
translate([-cubeSziex/2, -cubeSziey, -fudgeFactor*2])
cube([cubeSziex,cubeSziey,cubeSziez]);
}
}
}
if($preview&&showCaliper&&con[iStyle]!="none"){
color("Gold")
translate([0, 0, con[iLength]+con[iStopLength]])
mirror ([0,0,1])
mirror (connectorPos == 1 ? [0,0,0] : [1,0,0])
union(){
endStyle = con[iMeasurement] == "inner" ? 3 : 4;
addwidth = con[iMeasurement] == "outer" ? con[iWallThickness]*2 : 0;
translate(con[iStyle] == "nozzle" ? [0,0,con[iLength]] :[0,0,con[iLength]/2])
rotate([90,0,0])
Caliper(messpunkt = false, help=0, size = 7,h = 0.1,
l=con[iInnerDiameter] + addwidth,
end=endStyle,
in=connectorPos == 1 ? 1 : 0,
txt2 = str("con", con[iConnector], " ", con[iMeasurement]));
if(con[iInnerDiameter] != con[iInnerStartDiameter]){
translate([0,0,0])
rotate([90,0,0])
Caliper(messpunkt = false, help=0, size = 5,h = 0.1,
l=con[iInnerStartDiameter] + addwidth,
end=endStyle,
in=connectorPos == 1 ? 1 : 0,
txt2 = str("con", con[iConnector], " start ", con[iMeasurement]));
}
if(con[iInnerDiameter] != con[iInnerEndDiameter]){
translate([0,0,con[iLength]])
rotate([90,0,0])
Caliper(messpunkt = false, help=0, size = 5,h = 0.1,
l=con[iInnerEndDiameter] + addwidth,
end=3,
in=connectorPos == 1 ? 1 : 0,
txt2 = str("con", con[iConnector], " end ", con[iMeasurement]));
}
barWidth = con[iWallThickness]*8;
position = con[iInnerDiameter]/2 + con[iWallThickness]*2;
translate([(connectorPos == 1 ? position : -position), 0, con[iLength]/2])
rotate([90,0,0])
Caliper(messpunkt = false, help=0, h = 0.1,
center=true,
l=con[iLength],
cx= 0,
end=0,
size = 8,
in=connectorPos == 1 ? 2 : 3,
translate= connectorPos == 1 ? [15,0,0] : [-15,0,0],
txt2 = str("con", con[iConnector], " length"));
if(con[iStyle] == "nozzle")
{
translate([(connectorPos == 1 ? position : -position), 0,-con[iNozzleSize].z/2])
rotate([90,0,0])
Caliper(messpunkt = false, help=0, h = 0.1,
l=con[iNozzleSize].z,
cx= 0,
end=0,
size = 8,
in=connectorPos == 1 ? 2 : 3,
translate= connectorPos == 1 ? [15,0,0] : [-15,0,0],
txt2 = str("nozzle ", con[iConnector], " length"));
}
}
}
HelpTxt("adapter",[
"con", con,
"transitionAngle", transitionAngle,
"debug", debug]
,help);
}
module transitionExtension(
connector,
innerDiameter = 0,
wallThickness = 0,
length = 0 ,
gridSize = 0,
gridWallThickness = 0,
transitionColor = ["LightGreen",1],
debug = false,
showCaliper=false,
txt="",
txtSize=0,
includeHook = 0,
help){
assert(is_list(transitionColor), "transitionColor must be a list");
assert(len(transitionColor) == 2, "transitionColor be length 2");
assert(is_num(connector) && (connector ==1 || connector ==2), "connector must be 1 or 2");
assert(is_num(innerDiameter), "innerDiameter must be a number");
assert(is_num(wallThickness), "wallThickness must be a number");
assert(is_num(length), "length must be a number");
assert(is_num(gridSize), "gridSize must be a number");
assert(is_num(gridWallThickness), "gridWallThickness must be a number");
//gridWallThickness, -1 use wall thickness
gridWallThickness = gridWallThickness < 0
? min(wallThickness, length)
: min(gridWallThickness, length);
//gridWallThickness == 0 will disable grid
gridSize = gridWallThickness <= 0
? 0
: gridSize <=0
? innerDiameter/6 - gridWallThickness
: gridSize;
if(length > 0)
{
difference(){
color(transitionColor[0], transitionColor[1])
union(){
HoseConnector(
innerStartDiameter = innerDiameter,
innerEndDiameter = innerDiameter,
connectorMeasurement = "inner",
length,
endCapThickness = gridWallThickness,
wallThickness = wallThickness,
endCapGridSize = gridSize,
endCapGridWallThickness = gridWallThickness,
help);
if(includeHook == 1){
hootLength = min(15, length);
hookSize = wallThickness*2;
intersection(){
difference(){
Stopper(
diameter = (innerDiameter+wallThickness),
outer = (innerDiameter+wallThickness*2)+hookSize*2,
totalLength = hootLength,
taper1 = 0.25,
taper2 = 0.25,
wallThickness = wallThickness/2,
stopThickness = hookSize);
translate([0,0,wallThickness])
Stopper(
diameter = (innerDiameter-wallThickness),
outer = (innerDiameter+wallThickness),
totalLength = hootLength-wallThickness*2,
taper1 = 0.3,
taper2 = 0.3,
wallThickness = wallThickness/2,
stopThickness = hookSize);
}
cubeSize = [innerDiameter+hookSize,5,hootLength];
translate([-cubeSize.x,-cubeSize.y/2,0])
cube([innerDiameter+hookSize,cubeSize.y,cubeSize.z]);
}
/*
difference(){
cylinder(h=length, d=(innerDiameter+wallThickness*2)+hookSize);
translate([0,0,-fudgeFactor])
cylinder(h=length+fudgeFactor*2, d=(innerDiameter+wallThickness));
}*/
}
}
if($preview&&debug){
cubeSize = [innerDiameter*2,innerDiameter*1.5, length+fudgeFactor*4];
translate([-cubeSize.x/2, (connector == 1 ? -cubeSize.y : 0), -fudgeFactor*2])
cube(cubeSize);
}
if(is_string(txt) && len(txt) > 0){
textExtrude = min(wallThickness,1);
border = length * .2; //border above and below the text
translate([0,0,border])
RoundText(
textvalue = txt,
font = "Liberation:style=Bold",
fontSize = txtSize > 0 ? txtSize : length-border*2,
radius = innerDiameter/2+wallThickness - textExtrude/2,
textExtrude = textExtrude,
forceRound = true,
center = true,
$fn=64);
}
}
if($preview&&showCaliper){
/*render on left side
color("Gold")
translate(connector == 1 ? [0, 0, length] : [0, 0, length] )
mirror(connector == 1 ? [0,0,1] : [0,0,1])
rotate(connector == 1 ? [0,0,180] : [0,0,0])
union(){
barWidth = wallThickness*8;
position = innerDiameter/2 + wallThickness*2;
translate([(connector == 1 ? position : -position), 0, length/2])
rotate([90,0,0])
Caliper(messpunkt = false, help=0, h = 0.1,
center=true,
l=length,
cx= -1,
end=0,
size = 8,
in=connector == 1 ? 3 : 2,
translate= connector == 1 ? [15,0,0] : [-15,0,0],
txt2 = str("Extension ", connector, " length"));
}
}
*/
color("Aquamarine")
translate(connector == 1 ? [0, 0, 0] : [0, 0, 0] )
mirror(connector == 1 ? [0,0,0] : [0,0,0])
rotate(connector == 1 ? [0,0,0] : [0,0,180])
union(){
barWidth = wallThickness*8;
position = innerDiameter/2 + wallThickness*2;
translate([(connector == 1 ? position : -position), 0, length/2])
rotate([90,0,0])
Caliper(messpunkt = false, help=0, h = 0.1,
center=true,
l=length,
cx=0,
end=0,
size=6,
in=connector == 1 ? 2 : 3,
translate= connector == 1 ? [15,0,0] : [-15,0,0],
txt2 = str("Extension ", connector, " length"));
}
}
}
HelpTxt("transitionExtension",[
"innerDiameter", innerDiameter,
"wallThickness", wallThickness,
"length", length,
"gridSize", gridSize,
"gridWallThickness", gridWallThickness,
"transitionColor", transitionColor,
"debug", debug,
"showCaliper", showCaliper]
,help);
}
module transition(
style,
length,
connector1InnerEndDiameter,
connector2InnerStartDiameter,
connector3InnerStartDiameter,
connector1WallThickness,
connector2WallThickness,
connector3WallThickness,
thickness,
bendRadius,
angle,
baseType,
baseThickness,
baseWidth,
baseLength,
baseAngle,
connector2Count,
lengthInHull,
hullLength,
hullCenterLength,
edgeOffset,
hullCenter,
centerHeight,
Offset,
debug = false,
transitionColor = ["LightGreen",1],
showCaliper = false,
help
){
assert(is_list(transitionColor), "adapterColor must be a list")
assert(len(transitionColor) == 2, "adapterColor be length 2")
difference()
{
union()
{
if(style == "flat")
{
transDiameter = min(connector1InnerEndDiameter, connector2InnerStartDiameter);
transThickness = abs(connector1InnerEndDiameter - connector2InnerStartDiameter)/2 + max(connector1WallThickness,connector2WallThickness);
color(transitionColor[0], transitionColor[1])
StraightPipe(
diameter = transDiameter,
length = length,
wallThickness = transThickness);
}
if(style == "organicbend")
{
//Bent pipe that tapers through the bend.
color(transitionColor[0], transitionColor[1])
TaperedBentPipe(
bendRadius = bendRadius,
end1InnerPipeDiameter = connector1InnerEndDiameter,
end2InnerPipeDiameter = connector2InnerStartDiameter,
end1WallThickness = connector1WallThickness,
end2WallThickness = connector2WallThickness,
pipeAngle = angle,
baseType = baseType,
baseThickness = baseThickness,
baseWidth = baseWidth,
baseLength = baseLength,
baseAngle = baseAngle,
end2Count = connector2Count);
}
else if(style == "hull")
{
color(transitionColor[0], transitionColor[1])
BentPipeHull(
inner1PipeRadius = connector1InnerEndDiameter/2,
inner2PipeRadius = connector2InnerStartDiameter/2,
inner3PipeRadius = connector3InnerStartDiameter/2,
end1WallThickness = connector1WallThickness,
end2WallThickness = connector2WallThickness,
end3WallThickness = connector3WallThickness,
pipeAngle = angle,
end2Count = connector2Count,
lengthInHull = lengthInHull,
lengthOutHull = hullLength,
lengthOutHullCenter = hullCenterLength,
edgeOffset = edgeOffset,
addCenter = hullCenter,
centerHeight= centerHeight
);
}
else if(style == "bend+taper")
{
//Tapered transition
//the bent pipe section, diameter matches connector 1.
if(angle > 0)
{
color(transitionColor[0], transitionColor[1])
BentPipe(
bendRadius = bendRadius,
innerPipeDiameter = connector1InnerEndDiameter,
wallThickness = connector1WallThickness,
pipeAngle = angle,
baseType = baseType,
baseThickness = baseThickness,
baseWidth = baseWidth,
baseLength = baseLength,
baseAngle = baseAngle,
end2Count = connector2Count);
}
//Tapered section position to the end of the bent pipe
for (rotation = [0:connector2Count-1])
{
//color("SpringGreen")
color(transitionColor[0], transitionColor[1])
rotate([0, 0, rotation*(360/connector2Count)])
translate([-bendRadius, 0, 0])
rotate([0, -angle, 0])
translate([bendRadius, 0, 0])
Pipe(
diameter1 = connector1InnerEndDiameter,
diameter2 = connector2InnerStartDiameter,
length = length,
wallThickness1 = connector1WallThickness,
wallThickness2 = connector2WallThickness,
Offset = Offset);
}
}
else if(style == "taper+bend")
{
//Tapered section position to the end of the bent pipe
//color("SpringGreen")
color(transitionColor[0], transitionColor[1])
Pipe(
diameter1 = connector1InnerEndDiameter,