Skip to content

Commit d727299

Browse files
authored
Merge pull request #85 from fe60/master
2 parents ac27f3e + 7385c69 commit d727299

File tree

1 file changed

+44
-2
lines changed

1 file changed

+44
-2
lines changed

threading.scad

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ use <math.scad>
5959
// thread_depth = Depth of the threads. Default=pitch/2
6060
// thread_angle = The pressure angle profile angle of the threads. Default = 14.5 degree ACME profile.
6161
// left_handed = If true, create left-handed threads. Default = false
62-
// bevel = if true, bevel the thread ends. Default: true
62+
// bevel = if true, bevel the thread ends. Default: false
63+
// bevel1 = if true, bevel the axis-negative end of the thread. Default: false
64+
// bevel2 = if true, bevel the axis-positive end of the thread. Default: false
6365
// starts = The number of lead starts. Default = 1
6466
// internal = If true, make this a mask for making internal threads.
6567
// slop = printer slop calibration to allow for tight fitting of parts. Default: `PRINTER_SLOP`
@@ -85,6 +87,8 @@ module trapezoidal_threaded_rod(
8587
thread_depth=undef,
8688
left_handed=false,
8789
bevel=false,
90+
bevel1=false,
91+
bevel2=false,
8892
starts=1,
8993
profile=undef,
9094
internal=false,
@@ -232,7 +236,11 @@ module trapezoidal_threaded_rod(
232236
difference() {
233237
polyhedron(points=poly_points, faces=poly_faces, convexity=threads*starts*2);
234238
zspread(l+4*pitch*starts) cube([d+1, d+1, 4*pitch*starts], center=true);
235-
if (bevel) cylinder_mask(d=d, l=l+0.01, chamfer=depth);
239+
if (bevel || bevel1 || bevel2) {
240+
depth1 = (bevel || bevel1) ? depth : 0;
241+
depth2 = (bevel || bevel2) ? depth : 0;
242+
cylinder_mask(d=d, l=l+0.01, chamfer1=depth1, chamfer2=depth2);
243+
}
236244
}
237245
}
238246
}
@@ -321,6 +329,8 @@ module trapezoidal_threaded_nut(
321329
// pitch = Length between threads.
322330
// left_handed = if true, create left-handed threads. Default = false
323331
// bevel = if true, bevel the thread ends. Default: false
332+
// bevel1 = if true, bevel the axis-negative end of the thread. Default: false
333+
// bevel2 = if true, bevel the axis-positive end of the thread. Default: false
324334
// internal = If true, make this a mask for making internal threads.
325335
// slop = printer slop calibration to allow for tight fitting of parts. Default: `PRINTER_SLOP`
326336
// orient = Orientation of the rod. Use the `ORIENT_` constants from `constants.scad`. Default: `ORIENT_Z`.
@@ -335,6 +345,8 @@ module threaded_rod(
335345
d=10, l=100, pitch=2,
336346
left_handed=false,
337347
bevel=false,
348+
bevel1=false,
349+
bevel2=false,
338350
internal=false,
339351
slop=undef,
340352
orient=ORIENT_Z,
@@ -363,6 +375,8 @@ module threaded_rod(
363375
profile=profile,
364376
left_handed=left_handed,
365377
bevel=bevel,
378+
bevel1=bevel1,
379+
bevel2=bevel2,
366380
internal=internal,
367381
slop=slop,
368382
orient=orient,
@@ -426,6 +440,8 @@ module threaded_nut(
426440
// pitch = Length between threads.
427441
// left_handed = if true, create left-handed threads. Default = false
428442
// bevel = if true, bevel the thread ends. Default: false
443+
// bevel1 = if true, bevel the axis-negative end of the thread. Default: false
444+
// bevel2 = if true, bevel the axis-positive end of the thread. Default: false
429445
// internal = If true, this is a mask for making internal threads.
430446
// slop = printer slop calibration to allow for tight fitting of parts. default=0.2
431447
// orient = Orientation of the rod. Use the `ORIENT_` constants from `constants.scad`. Default: `ORIENT_Z`.
@@ -440,6 +456,8 @@ module buttress_threaded_rod(
440456
d=10, l=100, pitch=2,
441457
left_handed=false,
442458
bevel=false,
459+
bevel1=false,
460+
bevel2=false,
443461
internal=false,
444462
slop=undef,
445463
orient=ORIENT_Z,
@@ -460,6 +478,8 @@ module buttress_threaded_rod(
460478
profile=profile,
461479
left_handed=left_handed,
462480
bevel=bevel,
481+
bevel1=bevel1,
482+
bevel2=bevel2,
463483
internal=internal,
464484
orient=orient,
465485
slop=slop,
@@ -536,6 +556,8 @@ module metric_trapezoidal_threaded_rod(
536556
left_handed=false,
537557
starts=1,
538558
bevel=false,
559+
bevel1=false,
560+
bevel2=false,
539561
orient=ORIENT_Z,
540562
align=V_CENTER
541563
) {
@@ -546,6 +568,8 @@ module metric_trapezoidal_threaded_rod(
546568
left_handed=left_handed,
547569
starts=starts,
548570
bevel=bevel,
571+
bevel1=bevel1,
572+
bevel2=bevel2,
549573
orient=orient,
550574
align=align
551575
);
@@ -608,6 +632,8 @@ module metric_trapezoidal_threaded_nut(
608632
// starts = The number of lead starts. Default = 1
609633
// left_handed = if true, create left-handed threads. Default = false
610634
// bevel = if true, bevel the thread ends. Default: false
635+
// bevel1 = if true, bevel the axis-negative end of the thread. Default: false
636+
// bevel2 = if true, bevel the axis-positive end of the thread. Default: false
611637
// orient = Orientation of the rod. Use the `ORIENT_` constants from `constants.scad`. Default: `ORIENT_Z`.
612638
// align = Alignment of the rod. Use the `V_` constants from `constants.scad`. Default: `V_CENTER`.
613639
// Example(2D):
@@ -623,6 +649,8 @@ module acme_threaded_rod(
623649
starts=1,
624650
left_handed=false,
625651
bevel=false,
652+
bevel1=false,
653+
bevel2=false,
626654
orient=ORIENT_Z,
627655
align=V_CENTER
628656
) {
@@ -633,6 +661,8 @@ module acme_threaded_rod(
633661
starts=starts,
634662
left_handed=left_handed,
635663
bevel=bevel,
664+
bevel1=bevel1,
665+
bevel2=bevel2,
636666
orient=orient,
637667
align=align
638668
);
@@ -696,6 +726,8 @@ module acme_threaded_nut(
696726
// pitch = Length between threads.
697727
// left_handed = if true, create left-handed threads. Default = false
698728
// bevel = if true, bevel the thread ends. Default: false
729+
// bevel1 = if true, bevel the axis-negative end of the thread. Default: false
730+
// bevel2 = if true, bevel the axis-positive end of the thread. Default: false
699731
// starts = The number of lead starts. Default = 1
700732
// orient = Orientation of the rod. Use the `ORIENT_` constants from `constants.scad`. Default: `ORIENT_Z`.
701733
// align = Alignment of the rod. Use the `V_` constants from `constants.scad`. Default: `V_CENTER`.
@@ -708,6 +740,8 @@ module square_threaded_rod(
708740
d=10, l=100, pitch=2,
709741
left_handed=false,
710742
bevel=false,
743+
bevel1=false,
744+
bevel2=false,
711745
starts=1,
712746
orient=ORIENT_Z,
713747
align=V_CENTER
@@ -717,6 +751,8 @@ module square_threaded_rod(
717751
thread_angle=0,
718752
left_handed=left_handed,
719753
bevel=bevel,
754+
bevel1=bevel1,
755+
bevel2=bevel2,
720756
starts=starts,
721757
orient=orient,
722758
align=align
@@ -736,6 +772,8 @@ module square_threaded_rod(
736772
// pitch = Length between threads.
737773
// left_handed = if true, create left-handed threads. Default = false
738774
// bevel = if true, bevel the thread ends. Default: false
775+
// bevel1 = if true, bevel the axis-negative end of the thread. Default: false
776+
// bevel2 = if true, bevel the axis-positive end of the thread. Default: false
739777
// starts = The number of lead starts. Default = 1
740778
// slop = printer slop calibration to allow for tight fitting of parts. default=0.2
741779
// orient = Orientation of the nut. Use the `ORIENT_` constants from `constants.scad`. Default: `ORIENT_Z`.
@@ -747,6 +785,8 @@ module square_threaded_nut(
747785
pitch=3.175,
748786
left_handed=false,
749787
bevel=false,
788+
bevel1=false,
789+
bevel2=false,
750790
starts=1,
751791
slop=undef,
752792
orient=ORIENT_Z,
@@ -757,6 +797,8 @@ module square_threaded_nut(
757797
thread_angle=0,
758798
left_handed=left_handed,
759799
bevel=bevel,
800+
bevel1=bevel1,
801+
bevel2=bevel2,
760802
starts=starts,
761803
slop=slop,
762804
orient=orient,

0 commit comments

Comments
 (0)