discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

3d printing bolts at an angle with modeled support

TA
Todd Allen
Sat, Aug 10, 2024 2:35 AM

It is easiest to print bolts vertically standing on their heads but tensile
strength is then maximally impacted by layer adhesion.  Printing at a
significant angle from vertical can achieve much better tensile strength
but requires support or cutting the bolt to create a flat surface to lay on
the print bed to print horizontally.  There are many cases where cutting
the bolt is not a good option and for those cases I've found it fussy to
generate support in a slicer that contacts the bolt precisely as I want to
allow for clean easy support removal.

Here's an OpenSCAD script for creating bolts to be printed at an angle with
integrated support that I've found helpful for rapidly knocking out a
variety of fasteners with good tensile strength that take trivial clean up
effort to be ready for use.  It uses BOSL2/screws.scad to create bolts.
It's quite basic with little polish and can require tweaking of a few
parameters to get best results but still I've found it very useful and
think others might too.  The technique I used to generate the support could
readily be adapted to a wide range of other objects.

If anyone knows of better approaches to printing bolts or generating
support I would love to hear about it.

include <BOSL2/std.scad>
include <BOSL2/screws.scad>

$fn= $preview ? 12 : 256;
eps = 0.001;

// set trimscale sufficiently large to shave enough of the threads to
eliminate or minimize producing isolated blobs when sliced that don't print
well
// set ulength=0 for no chamfer to threaded shaft
// use x0_fudge to adjust where print_bolt() support starts on x axis
// use z_fudge to adjust z height of print_bolt()
module setenv_bolt(name, head="hex", drive="none",
ulength=undef, nut_threads=2.5, nut_diameter=0,
tolerance="6g", trimscale=1.0, slop=0.06,
zrot, x0_fudge=0, z_fudge=0,
support_thickness, support_gap = 0.15, support_ears_d, support_ears_z =
0.2)
{
spec = screw_info(name);
$name = name;
$head = head;
$drive = drive;
$p = struct_val(spec, "pitch");
$l = struct_val(spec, "length");
$d = struct_val(spec, "diameter");
$nh = $pnut_threads+1.5;
$nd = nut_diameter ? nut_diameter : $d
1.2+4.0;

$nut_spec = struct_set(spec, [
    "length", $nh+2*eps,
    "thread_len", $nh+2*eps
    ]);

$tolerance = tolerance;
$trimscale = trimscale;
$ul = is_undef(ulength) ? $p*0.5 : ulength; // should also add in

amount tolerance spec undersizes threaded minor radius
$tl = $l - $ul;
$bolt_spec = struct_set(screw_info(name, head=head, drive=drive), [
"thread_len", $tl
]);
echo($bolt_spec = $bolt_spec);

$hs = struct_val($bolt_spec, "head_size", $d);
$hh = struct_val($bolt_spec, "head_height", 0);

$slop = slop;   // $slop is parameter of BOSL2 screw_hole()

// align hex head to rest on a flat when rotated about Y axis for

printing as headsize is across flats
// may want default angles for drive types too
auto_zrot = ($head=="hex") ? 90 : 60;
$bolt_zrot = is_undef(zrot) ? auto_zrot : zrot;

$x0_fudge = x0_fudge;
$z_fudge = z_fudge;
$support_thickness = is_undef(support_thickness) ? 0.9+0.1*$d:

support_thickness;
$support_gap = support_gap;
$support_ears_d = is_undef(support_ears_d) ? 3+$d : support_ears_d;
$support_ears_z = support_ears_z;

children();

}

module bolt() {
zrot($bolt_zrot) screw(spec=$bolt_spec, tolerance=$tolerance,
orient=DOWN, anchor=TOP);
}

module shank_chamfer_mask(od, c) {
difference() {
zcyl(h=c, d=od+10eps, anchor=TOP);
up(eps) zcyl(h=c+2
eps, d=od-2*c, chamfer1=-c, anchor=TOP);
}
}

// bolt tweaked for printing with threads trimmed and end of unthreaded
shank chamfered
module printable_bolt(angle=0, z_shift=0) {
up(z_shift) yrot(angle) intersection() {
if ($ul>0) difference() {
bolt();
up($hh+$l-$tl+eps) shank_chamfer_mask($d, $p0.5);
}
else bolt();
union() {
// head
zcyl(l=$hh+$l-$tl, d=$hs+3, anchor=BOT);
// trimmed shaft
up($hh+$l-$tl-eps)
cuboid([$d-$p
$trimscale,$d,$tl+eps],anchor=BOT);
}
}
}

module print_bolt(angle=60) {
bolt_length = $hh + $l;
support_x0 = $x0_fudge + cos(angle) * $hh;
support_x1 = sin(angle) * bolt_length + cos(angle)$d0.50.40;
support_z = cos(angle) * bolt_length - sin(angle)
$d0.4;
z_shift = (angle<=90) ? $z_fudge+sin(angle)
$hs0.5 :
$z_fudge+max(sin(angle)
$hs0.5, sin(angle)$hs0.5-cos(angle$hh),
-cos(angle)bolt_length+sin(angle)$d0.4);
matrix_from_projection = frame_map(x=RIGHT, y=UP);
matrix_to_projection = matrix_inverse(matrix_from_projection);
union() {
// support for the bolt
multmatrix(matrix_from_projection) linear_extrude(height =
$support_thickness, center=true)
difference() {
polygon([[support_x0,0], [support_x1,0],
[support_x1,support_z+z_shift], [support_x0,z_shift]]);
offset(r=$support_gap) projection(cut=true)
multmatrix(matrix_to_projection) printable_bolt(angle, z_shift);
}
// mouse ears for the support
for(x=[$support_ears_d
0.5,support_x1-$support_ears_d*0.5+0.25])
right(x) zcyl(h=$support_ears_z, d=$support_ears_d, anchor=BOT);
// the bolt
printable_bolt(angle, z_shift);
}
}

module nut() {
difference() {
zcyl(h=$nh, d=$nd, chamfer=$nh0.075, $fn=6, circum=true,
anchor=BOTTOM);
down (eps) screw_hole($nut_spec, thread=true, counterbore=false,
bevel=true, anchor=BOTTOM); // , l=$nh+2
eps
}
}

// use trimscale=0.0 in setenv_bolt() for untrimmed thread
module inspect_bolt() {
linear_extrude(height = 1)
projection(cut=true) xrot(-90) {
printable_bolt();
up($hh + $l - $nh) nut();
}
}

// EXAMPLES
/*
setenv_bolt("M5,6", "hex", trimscale=0.9)
print_bolt();

setenv_bolt("M4x0.8,8", head="button", drive="hex", ulength=0,
trimscale=1.05, z_fudge=-0.75, x0_fudge=0.5)
print_bolt(angle=53.4);

setenv_bolt("M5,6", "hex", trimscale=0.9)
nut();
//  inspect_bolt();
//  printable_bolt();
*/

It is easiest to print bolts vertically standing on their heads but tensile strength is then maximally impacted by layer adhesion. Printing at a significant angle from vertical can achieve much better tensile strength but requires support or cutting the bolt to create a flat surface to lay on the print bed to print horizontally. There are many cases where cutting the bolt is not a good option and for those cases I've found it fussy to generate support in a slicer that contacts the bolt precisely as I want to allow for clean easy support removal. Here's an OpenSCAD script for creating bolts to be printed at an angle with integrated support that I've found helpful for rapidly knocking out a variety of fasteners with good tensile strength that take trivial clean up effort to be ready for use. It uses BOSL2/screws.scad to create bolts. It's quite basic with little polish and can require tweaking of a few parameters to get best results but still I've found it very useful and think others might too. The technique I used to generate the support could readily be adapted to a wide range of other objects. If anyone knows of better approaches to printing bolts or generating support I would love to hear about it. include <BOSL2/std.scad> include <BOSL2/screws.scad> $fn= $preview ? 12 : 256; eps = 0.001; // set trimscale sufficiently large to shave enough of the threads to eliminate or minimize producing isolated blobs when sliced that don't print well // set ulength=0 for no chamfer to threaded shaft // use x0_fudge to adjust where print_bolt() support starts on x axis // use z_fudge to adjust z height of print_bolt() module setenv_bolt(name, head="hex", drive="none", ulength=undef, nut_threads=2.5, nut_diameter=0, tolerance="6g", trimscale=1.0, slop=0.06, zrot, x0_fudge=0, z_fudge=0, support_thickness, support_gap = 0.15, support_ears_d, support_ears_z = 0.2) { spec = screw_info(name); $name = name; $head = head; $drive = drive; $p = struct_val(spec, "pitch"); $l = struct_val(spec, "length"); $d = struct_val(spec, "diameter"); $nh = $p*nut_threads+1.5; $nd = nut_diameter ? nut_diameter : $d*1.2+4.0; $nut_spec = struct_set(spec, [ "length", $nh+2*eps, "thread_len", $nh+2*eps ]); $tolerance = tolerance; $trimscale = trimscale; $ul = is_undef(ulength) ? $p*0.5 : ulength; // should also add in amount tolerance spec undersizes threaded minor radius $tl = $l - $ul; $bolt_spec = struct_set(screw_info(name, head=head, drive=drive), [ "thread_len", $tl ]); echo($bolt_spec = $bolt_spec); $hs = struct_val($bolt_spec, "head_size", $d); $hh = struct_val($bolt_spec, "head_height", 0); $slop = slop; // $slop is parameter of BOSL2 screw_hole() // align hex head to rest on a flat when rotated about Y axis for printing as headsize is across flats // may want default angles for drive types too auto_zrot = ($head=="hex") ? 90 : 60; $bolt_zrot = is_undef(zrot) ? auto_zrot : zrot; $x0_fudge = x0_fudge; $z_fudge = z_fudge; $support_thickness = is_undef(support_thickness) ? 0.9+0.1*$d: support_thickness; $support_gap = support_gap; $support_ears_d = is_undef(support_ears_d) ? 3+$d : support_ears_d; $support_ears_z = support_ears_z; children(); } module bolt() { zrot($bolt_zrot) screw(spec=$bolt_spec, tolerance=$tolerance, orient=DOWN, anchor=TOP); } module shank_chamfer_mask(od, c) { difference() { zcyl(h=c, d=od+10*eps, anchor=TOP); up(eps) zcyl(h=c+2*eps, d=od-2*c, chamfer1=-c, anchor=TOP); } } // bolt tweaked for printing with threads trimmed and end of unthreaded shank chamfered module printable_bolt(angle=0, z_shift=0) { up(z_shift) yrot(angle) intersection() { if ($ul>0) difference() { bolt(); up($hh+$l-$tl+eps) shank_chamfer_mask($d, $p*0.5); } else bolt(); union() { // head zcyl(l=$hh+$l-$tl, d=$hs+3, anchor=BOT); // trimmed shaft up($hh+$l-$tl-eps) cuboid([$d-$p*$trimscale,$d,$tl+eps],anchor=BOT); } } } module print_bolt(angle=60) { bolt_length = $hh + $l; support_x0 = $x0_fudge + cos(angle) * $hh; support_x1 = sin(angle) * bolt_length + cos(angle)*$d*0.5*0.40; support_z = cos(angle) * bolt_length - sin(angle)*$d*0.4; z_shift = (angle<=90) ? $z_fudge+sin(angle)*$hs*0.5 : $z_fudge+max(sin(angle)*$hs*0.5, sin(angle)*$hs*0.5-cos(angle*$hh), -cos(angle)*bolt_length+sin(angle)*$d*0.4); matrix_from_projection = frame_map(x=RIGHT, y=UP); matrix_to_projection = matrix_inverse(matrix_from_projection); union() { // support for the bolt multmatrix(matrix_from_projection) linear_extrude(height = $support_thickness, center=true) difference() { polygon([[support_x0,0], [support_x1,0], [support_x1,support_z+z_shift], [support_x0,z_shift]]); offset(r=$support_gap) projection(cut=true) multmatrix(matrix_to_projection) printable_bolt(angle, z_shift); } // mouse ears for the support for(x=[$support_ears_d*0.5,support_x1-$support_ears_d*0.5+0.25]) right(x) zcyl(h=$support_ears_z, d=$support_ears_d, anchor=BOT); // the bolt printable_bolt(angle, z_shift); } } module nut() { difference() { zcyl(h=$nh, d=$nd, chamfer=$nh*0.075, $fn=6, circum=true, anchor=BOTTOM); down (eps) screw_hole($nut_spec, thread=true, counterbore=false, bevel=true, anchor=BOTTOM); // , l=$nh+2*eps } } // use trimscale=0.0 in setenv_bolt() for untrimmed thread module inspect_bolt() { linear_extrude(height = 1) projection(cut=true) xrot(-90) { printable_bolt(); up($hh + $l - $nh) nut(); } } // EXAMPLES /* setenv_bolt("M5,6", "hex", trimscale=0.9) print_bolt(); setenv_bolt("M4x0.8,8", head="button", drive="hex", ulength=0, trimscale=1.05, z_fudge=-0.75, x0_fudge=0.5) print_bolt(angle=53.4); setenv_bolt("M5,6", "hex", trimscale=0.9) nut(); // inspect_bolt(); // printable_bolt(); */
AM
Adrian Mariano
Sat, Aug 10, 2024 2:57 AM

Another approach is to cut off a bit of the bolt so it has a flat side and
can be printed without support lying on that side.

On Fri, Aug 9, 2024 at 10:36 PM Todd Allen via Discuss <
discuss@lists.openscad.org> wrote:

It is easiest to print bolts vertically standing on their heads but
tensile strength is then maximally impacted by layer adhesion.  Printing at
a significant angle from vertical can achieve much better tensile strength
but requires support or cutting the bolt to create a flat surface to lay on
the print bed to print horizontally.  There are many cases where cutting
the bolt is not a good option and for those cases I've found it fussy to
generate support in a slicer that contacts the bolt precisely as I want to
allow for clean easy support removal.

Here's an OpenSCAD script for creating bolts to be printed at an angle
with integrated support that I've found helpful for rapidly knocking out a
variety of fasteners with good tensile strength that take trivial clean up
effort to be ready for use.  It uses BOSL2/screws.scad to create bolts.
It's quite basic with little polish and can require tweaking of a few
parameters to get best results but still I've found it very useful and
think others might too.  The technique I used to generate the support could
readily be adapted to a wide range of other objects.

If anyone knows of better approaches to printing bolts or generating
support I would love to hear about it.

include <BOSL2/std.scad>
include <BOSL2/screws.scad>

$fn= $preview ? 12 : 256;
eps = 0.001;

// set trimscale sufficiently large to shave enough of the threads to
eliminate or minimize producing isolated blobs when sliced that don't print
well
// set ulength=0 for no chamfer to threaded shaft
// use x0_fudge to adjust where print_bolt() support starts on x axis
// use z_fudge to adjust z height of print_bolt()
module setenv_bolt(name, head="hex", drive="none",
ulength=undef, nut_threads=2.5, nut_diameter=0,
tolerance="6g", trimscale=1.0, slop=0.06,
zrot, x0_fudge=0, z_fudge=0,
support_thickness, support_gap = 0.15, support_ears_d, support_ears_z
= 0.2)
{
spec = screw_info(name);
$name = name;
$head = head;
$drive = drive;
$p = struct_val(spec, "pitch");
$l = struct_val(spec, "length");
$d = struct_val(spec, "diameter");
$nh = $pnut_threads+1.5;
$nd = nut_diameter ? nut_diameter : $d
1.2+4.0;

 $nut_spec = struct_set(spec, [
     "length", $nh+2*eps,
     "thread_len", $nh+2*eps
     ]);

 $tolerance = tolerance;
 $trimscale = trimscale;
 $ul = is_undef(ulength) ? $p*0.5 : ulength; // should also add in

amount tolerance spec undersizes threaded minor radius
$tl = $l - $ul;
$bolt_spec = struct_set(screw_info(name, head=head, drive=drive), [
"thread_len", $tl
]);
echo($bolt_spec = $bolt_spec);

 $hs = struct_val($bolt_spec, "head_size", $d);
 $hh = struct_val($bolt_spec, "head_height", 0);

 $slop = slop;   // $slop is parameter of BOSL2 screw_hole()

 // align hex head to rest on a flat when rotated about Y axis for

printing as headsize is across flats
// may want default angles for drive types too
auto_zrot = ($head=="hex") ? 90 : 60;
$bolt_zrot = is_undef(zrot) ? auto_zrot : zrot;

 $x0_fudge = x0_fudge;
 $z_fudge = z_fudge;
 $support_thickness = is_undef(support_thickness) ? 0.9+0.1*$d:

support_thickness;
$support_gap = support_gap;
$support_ears_d = is_undef(support_ears_d) ? 3+$d : support_ears_d;
$support_ears_z = support_ears_z;

 children();

}

module bolt() {
zrot($bolt_zrot) screw(spec=$bolt_spec, tolerance=$tolerance,
orient=DOWN, anchor=TOP);
}

module shank_chamfer_mask(od, c) {
difference() {
zcyl(h=c, d=od+10eps, anchor=TOP);
up(eps) zcyl(h=c+2
eps, d=od-2*c, chamfer1=-c, anchor=TOP);
}
}

// bolt tweaked for printing with threads trimmed and end of unthreaded
shank chamfered
module printable_bolt(angle=0, z_shift=0) {
up(z_shift) yrot(angle) intersection() {
if ($ul>0) difference() {
bolt();
up($hh+$l-$tl+eps) shank_chamfer_mask($d, $p0.5);
}
else bolt();
union() {
// head
zcyl(l=$hh+$l-$tl, d=$hs+3, anchor=BOT);
// trimmed shaft
up($hh+$l-$tl-eps)
cuboid([$d-$p
$trimscale,$d,$tl+eps],anchor=BOT);
}
}
}

module print_bolt(angle=60) {
bolt_length = $hh + $l;
support_x0 = $x0_fudge + cos(angle) * $hh;
support_x1 = sin(angle) * bolt_length + cos(angle)$d0.50.40;
support_z = cos(angle) * bolt_length - sin(angle)
$d0.4;
z_shift = (angle<=90) ? $z_fudge+sin(angle)
$hs0.5 :
$z_fudge+max(sin(angle)
$hs0.5, sin(angle)$hs0.5-cos(angle$hh),
-cos(angle)bolt_length+sin(angle)$d0.4);
matrix_from_projection = frame_map(x=RIGHT, y=UP);
matrix_to_projection = matrix_inverse(matrix_from_projection);
union() {
// support for the bolt
multmatrix(matrix_from_projection) linear_extrude(height =
$support_thickness, center=true)
difference() {
polygon([[support_x0,0], [support_x1,0],
[support_x1,support_z+z_shift], [support_x0,z_shift]]);
offset(r=$support_gap) projection(cut=true)
multmatrix(matrix_to_projection) printable_bolt(angle, z_shift);
}
// mouse ears for the support
for(x=[$support_ears_d
0.5,support_x1-$support_ears_d*0.5+0.25])
right(x) zcyl(h=$support_ears_z, d=$support_ears_d, anchor=BOT);
// the bolt
printable_bolt(angle, z_shift);
}
}

module nut() {
difference() {
zcyl(h=$nh, d=$nd, chamfer=$nh0.075, $fn=6, circum=true,
anchor=BOTTOM);
down (eps) screw_hole($nut_spec, thread=true, counterbore=false,
bevel=true, anchor=BOTTOM); // , l=$nh+2
eps
}
}

// use trimscale=0.0 in setenv_bolt() for untrimmed thread
module inspect_bolt() {
linear_extrude(height = 1)
projection(cut=true) xrot(-90) {
printable_bolt();
up($hh + $l - $nh) nut();
}
}

// EXAMPLES
/*
setenv_bolt("M5,6", "hex", trimscale=0.9)
print_bolt();

setenv_bolt("M4x0.8,8", head="button", drive="hex", ulength=0,
trimscale=1.05, z_fudge=-0.75, x0_fudge=0.5)
print_bolt(angle=53.4);

setenv_bolt("M5,6", "hex", trimscale=0.9)
nut();
//  inspect_bolt();
//  printable_bolt();
*/


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Another approach is to cut off a bit of the bolt so it has a flat side and can be printed without support lying on that side. On Fri, Aug 9, 2024 at 10:36 PM Todd Allen via Discuss < discuss@lists.openscad.org> wrote: > It is easiest to print bolts vertically standing on their heads but > tensile strength is then maximally impacted by layer adhesion. Printing at > a significant angle from vertical can achieve much better tensile strength > but requires support or cutting the bolt to create a flat surface to lay on > the print bed to print horizontally. There are many cases where cutting > the bolt is not a good option and for those cases I've found it fussy to > generate support in a slicer that contacts the bolt precisely as I want to > allow for clean easy support removal. > > Here's an OpenSCAD script for creating bolts to be printed at an angle > with integrated support that I've found helpful for rapidly knocking out a > variety of fasteners with good tensile strength that take trivial clean up > effort to be ready for use. It uses BOSL2/screws.scad to create bolts. > It's quite basic with little polish and can require tweaking of a few > parameters to get best results but still I've found it very useful and > think others might too. The technique I used to generate the support could > readily be adapted to a wide range of other objects. > > If anyone knows of better approaches to printing bolts or generating > support I would love to hear about it. > > include <BOSL2/std.scad> > include <BOSL2/screws.scad> > > $fn= $preview ? 12 : 256; > eps = 0.001; > > // set trimscale sufficiently large to shave enough of the threads to > eliminate or minimize producing isolated blobs when sliced that don't print > well > // set ulength=0 for no chamfer to threaded shaft > // use x0_fudge to adjust where print_bolt() support starts on x axis > // use z_fudge to adjust z height of print_bolt() > module setenv_bolt(name, head="hex", drive="none", > ulength=undef, nut_threads=2.5, nut_diameter=0, > tolerance="6g", trimscale=1.0, slop=0.06, > zrot, x0_fudge=0, z_fudge=0, > support_thickness, support_gap = 0.15, support_ears_d, support_ears_z > = 0.2) > { > spec = screw_info(name); > $name = name; > $head = head; > $drive = drive; > $p = struct_val(spec, "pitch"); > $l = struct_val(spec, "length"); > $d = struct_val(spec, "diameter"); > $nh = $p*nut_threads+1.5; > $nd = nut_diameter ? nut_diameter : $d*1.2+4.0; > > $nut_spec = struct_set(spec, [ > "length", $nh+2*eps, > "thread_len", $nh+2*eps > ]); > > $tolerance = tolerance; > $trimscale = trimscale; > $ul = is_undef(ulength) ? $p*0.5 : ulength; // should also add in > amount tolerance spec undersizes threaded minor radius > $tl = $l - $ul; > $bolt_spec = struct_set(screw_info(name, head=head, drive=drive), [ > "thread_len", $tl > ]); > echo($bolt_spec = $bolt_spec); > > $hs = struct_val($bolt_spec, "head_size", $d); > $hh = struct_val($bolt_spec, "head_height", 0); > > $slop = slop; // $slop is parameter of BOSL2 screw_hole() > > // align hex head to rest on a flat when rotated about Y axis for > printing as headsize is across flats > // may want default angles for drive types too > auto_zrot = ($head=="hex") ? 90 : 60; > $bolt_zrot = is_undef(zrot) ? auto_zrot : zrot; > > $x0_fudge = x0_fudge; > $z_fudge = z_fudge; > $support_thickness = is_undef(support_thickness) ? 0.9+0.1*$d: > support_thickness; > $support_gap = support_gap; > $support_ears_d = is_undef(support_ears_d) ? 3+$d : support_ears_d; > $support_ears_z = support_ears_z; > > children(); > } > > module bolt() { > zrot($bolt_zrot) screw(spec=$bolt_spec, tolerance=$tolerance, > orient=DOWN, anchor=TOP); > } > > module shank_chamfer_mask(od, c) { > difference() { > zcyl(h=c, d=od+10*eps, anchor=TOP); > up(eps) zcyl(h=c+2*eps, d=od-2*c, chamfer1=-c, anchor=TOP); > } > } > > // bolt tweaked for printing with threads trimmed and end of unthreaded > shank chamfered > module printable_bolt(angle=0, z_shift=0) { > up(z_shift) yrot(angle) intersection() { > if ($ul>0) difference() { > bolt(); > up($hh+$l-$tl+eps) shank_chamfer_mask($d, $p*0.5); > } > else bolt(); > union() { > // head > zcyl(l=$hh+$l-$tl, d=$hs+3, anchor=BOT); > // trimmed shaft > up($hh+$l-$tl-eps) > cuboid([$d-$p*$trimscale,$d,$tl+eps],anchor=BOT); > } > } > } > > module print_bolt(angle=60) { > bolt_length = $hh + $l; > support_x0 = $x0_fudge + cos(angle) * $hh; > support_x1 = sin(angle) * bolt_length + cos(angle)*$d*0.5*0.40; > support_z = cos(angle) * bolt_length - sin(angle)*$d*0.4; > z_shift = (angle<=90) ? $z_fudge+sin(angle)*$hs*0.5 : > $z_fudge+max(sin(angle)*$hs*0.5, sin(angle)*$hs*0.5-cos(angle*$hh), > -cos(angle)*bolt_length+sin(angle)*$d*0.4); > matrix_from_projection = frame_map(x=RIGHT, y=UP); > matrix_to_projection = matrix_inverse(matrix_from_projection); > union() { > // support for the bolt > multmatrix(matrix_from_projection) linear_extrude(height = > $support_thickness, center=true) > difference() { > polygon([[support_x0,0], [support_x1,0], > [support_x1,support_z+z_shift], [support_x0,z_shift]]); > offset(r=$support_gap) projection(cut=true) > multmatrix(matrix_to_projection) printable_bolt(angle, z_shift); > } > // mouse ears for the support > for(x=[$support_ears_d*0.5,support_x1-$support_ears_d*0.5+0.25]) > right(x) zcyl(h=$support_ears_z, d=$support_ears_d, anchor=BOT); > // the bolt > printable_bolt(angle, z_shift); > } > } > > module nut() { > difference() { > zcyl(h=$nh, d=$nd, chamfer=$nh*0.075, $fn=6, circum=true, > anchor=BOTTOM); > down (eps) screw_hole($nut_spec, thread=true, counterbore=false, > bevel=true, anchor=BOTTOM); // , l=$nh+2*eps > } > } > > // use trimscale=0.0 in setenv_bolt() for untrimmed thread > module inspect_bolt() { > linear_extrude(height = 1) > projection(cut=true) xrot(-90) { > printable_bolt(); > up($hh + $l - $nh) nut(); > } > } > > // EXAMPLES > /* > setenv_bolt("M5,6", "hex", trimscale=0.9) > print_bolt(); > > setenv_bolt("M4x0.8,8", head="button", drive="hex", ulength=0, > trimscale=1.05, z_fudge=-0.75, x0_fudge=0.5) > print_bolt(angle=53.4); > > setenv_bolt("M5,6", "hex", trimscale=0.9) > nut(); > // inspect_bolt(); > // printable_bolt(); > */ > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
TA
Todd Allen
Sat, Aug 10, 2024 4:29 AM

Yes, I was referring to that when I said "or cutting the bolt to create a
flat surface to lay on the print bed to print horizontally.  There are many
cases where cutting the bolt is not a good option"

It sort of works for a hex head but does not work for socket or button
heads.  My script makes it fairly easy to horizontally print (at 90 degrees
from vertical) a bolt with a full untrimmed head and minimal support under
the shaft.  I've been printing shorter bolts at lesser angles from vertical
to get better threads and find 60 degrees is often a good compromise
between thread quality and tensile strength.

On Fri, Aug 9, 2024 at 9:58 PM Adrian Mariano via Discuss <
discuss@lists.openscad.org> wrote:

Another approach is to cut off a bit of the bolt so it has a flat side and
can be printed without support lying on that side.

On Fri, Aug 9, 2024 at 10:36 PM Todd Allen via Discuss <
discuss@lists.openscad.org> wrote:

It is easiest to print bolts vertically standing on their heads but
tensile strength is then maximally impacted by layer adhesion.  Printing at
a significant angle from vertical can achieve much better tensile strength
but requires support or cutting the bolt to create a flat surface to lay on
the print bed to print horizontally.  There are many cases where cutting
the bolt is not a good option and for those cases I've found it fussy to
generate support in a slicer that contacts the bolt precisely as I want to
allow for clean easy support removal.

Here's an OpenSCAD script for creating bolts to be printed at an angle
with integrated support that I've found helpful for rapidly knocking out a
variety of fasteners with good tensile strength that take trivial clean up
effort to be ready for use.  It uses BOSL2/screws.scad to create bolts.
It's quite basic with little polish and can require tweaking of a few
parameters to get best results but still I've found it very useful and
think others might too.  The technique I used to generate the support could
readily be adapted to a wide range of other objects.

If anyone knows of better approaches to printing bolts or generating
support I would love to hear about it.

include <BOSL2/std.scad>
include <BOSL2/screws.scad>

$fn= $preview ? 12 : 256;
eps = 0.001;

// set trimscale sufficiently large to shave enough of the threads to
eliminate or minimize producing isolated blobs when sliced that don't print
well
// set ulength=0 for no chamfer to threaded shaft
// use x0_fudge to adjust where print_bolt() support starts on x axis
// use z_fudge to adjust z height of print_bolt()
module setenv_bolt(name, head="hex", drive="none",
ulength=undef, nut_threads=2.5, nut_diameter=0,
tolerance="6g", trimscale=1.0, slop=0.06,
zrot, x0_fudge=0, z_fudge=0,
support_thickness, support_gap = 0.15, support_ears_d, support_ears_z
= 0.2)
{
spec = screw_info(name);
$name = name;
$head = head;
$drive = drive;
$p = struct_val(spec, "pitch");
$l = struct_val(spec, "length");
$d = struct_val(spec, "diameter");
$nh = $pnut_threads+1.5;
$nd = nut_diameter ? nut_diameter : $d
1.2+4.0;

 $nut_spec = struct_set(spec, [
     "length", $nh+2*eps,
     "thread_len", $nh+2*eps
     ]);

 $tolerance = tolerance;
 $trimscale = trimscale;
 $ul = is_undef(ulength) ? $p*0.5 : ulength; // should also add in

amount tolerance spec undersizes threaded minor radius
$tl = $l - $ul;
$bolt_spec = struct_set(screw_info(name, head=head, drive=drive), [
"thread_len", $tl
]);
echo($bolt_spec = $bolt_spec);

 $hs = struct_val($bolt_spec, "head_size", $d);
 $hh = struct_val($bolt_spec, "head_height", 0);

 $slop = slop;   // $slop is parameter of BOSL2 screw_hole()

 // align hex head to rest on a flat when rotated about Y axis for

printing as headsize is across flats
// may want default angles for drive types too
auto_zrot = ($head=="hex") ? 90 : 60;
$bolt_zrot = is_undef(zrot) ? auto_zrot : zrot;

 $x0_fudge = x0_fudge;
 $z_fudge = z_fudge;
 $support_thickness = is_undef(support_thickness) ? 0.9+0.1*$d:

support_thickness;
$support_gap = support_gap;
$support_ears_d = is_undef(support_ears_d) ? 3+$d : support_ears_d;
$support_ears_z = support_ears_z;

 children();

}

module bolt() {
zrot($bolt_zrot) screw(spec=$bolt_spec, tolerance=$tolerance,
orient=DOWN, anchor=TOP);
}

module shank_chamfer_mask(od, c) {
difference() {
zcyl(h=c, d=od+10eps, anchor=TOP);
up(eps) zcyl(h=c+2
eps, d=od-2*c, chamfer1=-c, anchor=TOP);
}
}

// bolt tweaked for printing with threads trimmed and end of unthreaded
shank chamfered
module printable_bolt(angle=0, z_shift=0) {
up(z_shift) yrot(angle) intersection() {
if ($ul>0) difference() {
bolt();
up($hh+$l-$tl+eps) shank_chamfer_mask($d, $p0.5);
}
else bolt();
union() {
// head
zcyl(l=$hh+$l-$tl, d=$hs+3, anchor=BOT);
// trimmed shaft
up($hh+$l-$tl-eps)
cuboid([$d-$p
$trimscale,$d,$tl+eps],anchor=BOT);
}
}
}

module print_bolt(angle=60) {
bolt_length = $hh + $l;
support_x0 = $x0_fudge + cos(angle) * $hh;
support_x1 = sin(angle) * bolt_length + cos(angle)$d0.50.40;
support_z = cos(angle) * bolt_length - sin(angle)
$d0.4;
z_shift = (angle<=90) ? $z_fudge+sin(angle)
$hs0.5 :
$z_fudge+max(sin(angle)
$hs0.5, sin(angle)$hs0.5-cos(angle$hh),
-cos(angle)bolt_length+sin(angle)$d0.4);
matrix_from_projection = frame_map(x=RIGHT, y=UP);
matrix_to_projection = matrix_inverse(matrix_from_projection);
union() {
// support for the bolt
multmatrix(matrix_from_projection) linear_extrude(height =
$support_thickness, center=true)
difference() {
polygon([[support_x0,0], [support_x1,0],
[support_x1,support_z+z_shift], [support_x0,z_shift]]);
offset(r=$support_gap) projection(cut=true)
multmatrix(matrix_to_projection) printable_bolt(angle, z_shift);
}
// mouse ears for the support
for(x=[$support_ears_d
0.5,support_x1-$support_ears_d*0.5+0.25])
right(x) zcyl(h=$support_ears_z, d=$support_ears_d, anchor=BOT);
// the bolt
printable_bolt(angle, z_shift);
}
}

module nut() {
difference() {
zcyl(h=$nh, d=$nd, chamfer=$nh0.075, $fn=6, circum=true,
anchor=BOTTOM);
down (eps) screw_hole($nut_spec, thread=true, counterbore=false,
bevel=true, anchor=BOTTOM); // , l=$nh+2
eps
}
}

// use trimscale=0.0 in setenv_bolt() for untrimmed thread
module inspect_bolt() {
linear_extrude(height = 1)
projection(cut=true) xrot(-90) {
printable_bolt();
up($hh + $l - $nh) nut();
}
}

// EXAMPLES
/*
setenv_bolt("M5,6", "hex", trimscale=0.9)
print_bolt();

setenv_bolt("M4x0.8,8", head="button", drive="hex", ulength=0,
trimscale=1.05, z_fudge=-0.75, x0_fudge=0.5)
print_bolt(angle=53.4);

setenv_bolt("M5,6", "hex", trimscale=0.9)
nut();
//  inspect_bolt();
//  printable_bolt();
*/


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Yes, I was referring to that when I said "or cutting the bolt to create a flat surface to lay on the print bed to print horizontally. There are many cases where cutting the bolt is not a good option" It sort of works for a hex head but does not work for socket or button heads. My script makes it fairly easy to horizontally print (at 90 degrees from vertical) a bolt with a full untrimmed head and minimal support under the shaft. I've been printing shorter bolts at lesser angles from vertical to get better threads and find 60 degrees is often a good compromise between thread quality and tensile strength. On Fri, Aug 9, 2024 at 9:58 PM Adrian Mariano via Discuss < discuss@lists.openscad.org> wrote: > Another approach is to cut off a bit of the bolt so it has a flat side and > can be printed without support lying on that side. > > On Fri, Aug 9, 2024 at 10:36 PM Todd Allen via Discuss < > discuss@lists.openscad.org> wrote: > >> It is easiest to print bolts vertically standing on their heads but >> tensile strength is then maximally impacted by layer adhesion. Printing at >> a significant angle from vertical can achieve much better tensile strength >> but requires support or cutting the bolt to create a flat surface to lay on >> the print bed to print horizontally. There are many cases where cutting >> the bolt is not a good option and for those cases I've found it fussy to >> generate support in a slicer that contacts the bolt precisely as I want to >> allow for clean easy support removal. >> >> Here's an OpenSCAD script for creating bolts to be printed at an angle >> with integrated support that I've found helpful for rapidly knocking out a >> variety of fasteners with good tensile strength that take trivial clean up >> effort to be ready for use. It uses BOSL2/screws.scad to create bolts. >> It's quite basic with little polish and can require tweaking of a few >> parameters to get best results but still I've found it very useful and >> think others might too. The technique I used to generate the support could >> readily be adapted to a wide range of other objects. >> >> If anyone knows of better approaches to printing bolts or generating >> support I would love to hear about it. >> >> include <BOSL2/std.scad> >> include <BOSL2/screws.scad> >> >> $fn= $preview ? 12 : 256; >> eps = 0.001; >> >> // set trimscale sufficiently large to shave enough of the threads to >> eliminate or minimize producing isolated blobs when sliced that don't print >> well >> // set ulength=0 for no chamfer to threaded shaft >> // use x0_fudge to adjust where print_bolt() support starts on x axis >> // use z_fudge to adjust z height of print_bolt() >> module setenv_bolt(name, head="hex", drive="none", >> ulength=undef, nut_threads=2.5, nut_diameter=0, >> tolerance="6g", trimscale=1.0, slop=0.06, >> zrot, x0_fudge=0, z_fudge=0, >> support_thickness, support_gap = 0.15, support_ears_d, support_ears_z >> = 0.2) >> { >> spec = screw_info(name); >> $name = name; >> $head = head; >> $drive = drive; >> $p = struct_val(spec, "pitch"); >> $l = struct_val(spec, "length"); >> $d = struct_val(spec, "diameter"); >> $nh = $p*nut_threads+1.5; >> $nd = nut_diameter ? nut_diameter : $d*1.2+4.0; >> >> $nut_spec = struct_set(spec, [ >> "length", $nh+2*eps, >> "thread_len", $nh+2*eps >> ]); >> >> $tolerance = tolerance; >> $trimscale = trimscale; >> $ul = is_undef(ulength) ? $p*0.5 : ulength; // should also add in >> amount tolerance spec undersizes threaded minor radius >> $tl = $l - $ul; >> $bolt_spec = struct_set(screw_info(name, head=head, drive=drive), [ >> "thread_len", $tl >> ]); >> echo($bolt_spec = $bolt_spec); >> >> $hs = struct_val($bolt_spec, "head_size", $d); >> $hh = struct_val($bolt_spec, "head_height", 0); >> >> $slop = slop; // $slop is parameter of BOSL2 screw_hole() >> >> // align hex head to rest on a flat when rotated about Y axis for >> printing as headsize is across flats >> // may want default angles for drive types too >> auto_zrot = ($head=="hex") ? 90 : 60; >> $bolt_zrot = is_undef(zrot) ? auto_zrot : zrot; >> >> $x0_fudge = x0_fudge; >> $z_fudge = z_fudge; >> $support_thickness = is_undef(support_thickness) ? 0.9+0.1*$d: >> support_thickness; >> $support_gap = support_gap; >> $support_ears_d = is_undef(support_ears_d) ? 3+$d : support_ears_d; >> $support_ears_z = support_ears_z; >> >> children(); >> } >> >> module bolt() { >> zrot($bolt_zrot) screw(spec=$bolt_spec, tolerance=$tolerance, >> orient=DOWN, anchor=TOP); >> } >> >> module shank_chamfer_mask(od, c) { >> difference() { >> zcyl(h=c, d=od+10*eps, anchor=TOP); >> up(eps) zcyl(h=c+2*eps, d=od-2*c, chamfer1=-c, anchor=TOP); >> } >> } >> >> // bolt tweaked for printing with threads trimmed and end of unthreaded >> shank chamfered >> module printable_bolt(angle=0, z_shift=0) { >> up(z_shift) yrot(angle) intersection() { >> if ($ul>0) difference() { >> bolt(); >> up($hh+$l-$tl+eps) shank_chamfer_mask($d, $p*0.5); >> } >> else bolt(); >> union() { >> // head >> zcyl(l=$hh+$l-$tl, d=$hs+3, anchor=BOT); >> // trimmed shaft >> up($hh+$l-$tl-eps) >> cuboid([$d-$p*$trimscale,$d,$tl+eps],anchor=BOT); >> } >> } >> } >> >> module print_bolt(angle=60) { >> bolt_length = $hh + $l; >> support_x0 = $x0_fudge + cos(angle) * $hh; >> support_x1 = sin(angle) * bolt_length + cos(angle)*$d*0.5*0.40; >> support_z = cos(angle) * bolt_length - sin(angle)*$d*0.4; >> z_shift = (angle<=90) ? $z_fudge+sin(angle)*$hs*0.5 : >> $z_fudge+max(sin(angle)*$hs*0.5, sin(angle)*$hs*0.5-cos(angle*$hh), >> -cos(angle)*bolt_length+sin(angle)*$d*0.4); >> matrix_from_projection = frame_map(x=RIGHT, y=UP); >> matrix_to_projection = matrix_inverse(matrix_from_projection); >> union() { >> // support for the bolt >> multmatrix(matrix_from_projection) linear_extrude(height = >> $support_thickness, center=true) >> difference() { >> polygon([[support_x0,0], [support_x1,0], >> [support_x1,support_z+z_shift], [support_x0,z_shift]]); >> offset(r=$support_gap) projection(cut=true) >> multmatrix(matrix_to_projection) printable_bolt(angle, z_shift); >> } >> // mouse ears for the support >> for(x=[$support_ears_d*0.5,support_x1-$support_ears_d*0.5+0.25]) >> right(x) zcyl(h=$support_ears_z, d=$support_ears_d, anchor=BOT); >> // the bolt >> printable_bolt(angle, z_shift); >> } >> } >> >> module nut() { >> difference() { >> zcyl(h=$nh, d=$nd, chamfer=$nh*0.075, $fn=6, circum=true, >> anchor=BOTTOM); >> down (eps) screw_hole($nut_spec, thread=true, counterbore=false, >> bevel=true, anchor=BOTTOM); // , l=$nh+2*eps >> } >> } >> >> // use trimscale=0.0 in setenv_bolt() for untrimmed thread >> module inspect_bolt() { >> linear_extrude(height = 1) >> projection(cut=true) xrot(-90) { >> printable_bolt(); >> up($hh + $l - $nh) nut(); >> } >> } >> >> // EXAMPLES >> /* >> setenv_bolt("M5,6", "hex", trimscale=0.9) >> print_bolt(); >> >> setenv_bolt("M4x0.8,8", head="button", drive="hex", ulength=0, >> trimscale=1.05, z_fudge=-0.75, x0_fudge=0.5) >> print_bolt(angle=53.4); >> >> setenv_bolt("M5,6", "hex", trimscale=0.9) >> nut(); >> // inspect_bolt(); >> // printable_bolt(); >> */ >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
GH
gene heskett
Sat, Aug 10, 2024 7:24 AM

On 8/9/24 22:35, Todd Allen via Discuss wrote:

It is easiest to print bolts vertically standing on their heads but
tensile strength is then maximally impacted by layer adhesion.  Printing
at a significant angle from vertical can achieve much better tensile
strength but requires support or cutting the bolt to create a flat
surface to lay on the print bed to print horizontally.  There are many
cases where cutting the bolt is not a good option and for those cases
I've found it fussy to generate support in a slicer that contacts the
bolt precisely as I want to allow for clean easy support removal.

Here's an OpenSCAD script for creating bolts to be printed at an angle
with integrated support that I've found helpful for rapidly knocking out
a variety of fasteners with good tensile strength that take trivial
clean up effort to be ready for use.  It uses BOSL2/screws.scad to
create bolts.  It's quite basic with little polish and can require
tweaking of a few parameters to get best results but still I've found it
very useful and think others might too.  The technique I used to
generate the support could readily be adapted to a wide range of other
objects.

If anyone knows of better approaches to printing bolts or generating
support I would love to hear about it.

include <BOSL2/std.scad>
include <BOSL2/screws.scad>

$fn= $preview ? 12 : 256;
eps = 0.001;

// set trimscale sufficiently large to shave enough of the threads to
eliminate or minimize producing isolated blobs when sliced that don't
print well
// set ulength=0 for no chamfer to threaded shaft
// use x0_fudge to adjust where print_bolt() support starts on x axis
// use z_fudge to adjust z height of print_bolt()
module setenv_bolt(name, head="hex", drive="none",
    ulength=undef, nut_threads=2.5, nut_diameter=0,
    tolerance="6g", trimscale=1.0, slop=0.06,
    zrot, x0_fudge=0, z_fudge=0,
    support_thickness, support_gap = 0.15, support_ears_d,
support_ears_z = 0.2)
{
    spec = screw_info(name);
    $name = name;
    $head = head;
    $drive = drive;
    $p = struct_val(spec, "pitch");
    $l = struct_val(spec, "length");
    $d = struct_val(spec, "diameter");
    $nh = $pnut_threads+1.5;
    $nd = nut_diameter ? nut_diameter : $d
1.2+4.0;

    $nut_spec = struct_set(spec, [
        "length", $nh+2eps,
        "thread_len", $nh+2
eps
        ]);

    $tolerance = tolerance;
    $trimscale = trimscale;
    $ul = is_undef(ulength) ? $p*0.5 : ulength; // should also add in
amount tolerance spec undersizes threaded minor radius
    $tl = $l - $ul;
    $bolt_spec = struct_set(screw_info(name, head=head, drive=drive), [
        "thread_len", $tl
        ]);
    echo($bolt_spec = $bolt_spec);

    $hs = struct_val($bolt_spec, "head_size", $d);
    $hh = struct_val($bolt_spec, "head_height", 0);

    $slop = slop;   // $slop is parameter of BOSL2 screw_hole()

    // align hex head to rest on a flat when rotated about Y axis for
printing as headsize is across flats
    // may want default angles for drive types too
    auto_zrot = ($head=="hex") ? 90 : 60;
    $bolt_zrot = is_undef(zrot) ? auto_zrot : zrot;

    $x0_fudge = x0_fudge;
    $z_fudge = z_fudge;
    $support_thickness = is_undef(support_thickness) ? 0.9+0.1*$d:
support_thickness;
    $support_gap = support_gap;
    $support_ears_d = is_undef(support_ears_d) ? 3+$d : support_ears_d;
    $support_ears_z = support_ears_z;

    children();
}

module bolt() {
    zrot($bolt_zrot) screw(spec=$bolt_spec, tolerance=$tolerance,
orient=DOWN, anchor=TOP);
}

module shank_chamfer_mask(od, c) {
    difference() {
        zcyl(h=c, d=od+10eps, anchor=TOP);
        up(eps) zcyl(h=c+2
eps, d=od-2*c, chamfer1=-c, anchor=TOP);
        }
}

// bolt tweaked for printing with threads trimmed and end of unthreaded
shank chamfered
module printable_bolt(angle=0, z_shift=0) {
    up(z_shift) yrot(angle) intersection() {
        if ($ul>0) difference() {
            bolt();
            up($hh+$l-$tl+eps) shank_chamfer_mask($d, $p0.5);
            }
        else bolt();
        union() {
            // head
            zcyl(l=$hh+$l-$tl, d=$hs+3, anchor=BOT);
            // trimmed shaft
            up($hh+$l-$tl-eps)
cuboid([$d-$p
$trimscale,$d,$tl+eps],anchor=BOT);
            }
        }
}

module print_bolt(angle=60) {
    bolt_length = $hh + $l;
    support_x0 = $x0_fudge + cos(angle) * $hh;
    support_x1 = sin(angle) * bolt_length + cos(angle)$d0.50.40;
    support_z = cos(angle) * bolt_length - sin(angle)
$d0.4;
    z_shift = (angle<=90) ? $z_fudge+sin(angle)
$hs0.5 :
$z_fudge+max(sin(angle)
$hs0.5, sin(angle)$hs0.5-cos(angle$hh),
-cos(angle)bolt_length+sin(angle)$d*0.4);
    matrix_from_projection = frame_map(x=RIGHT, y=UP);
    matrix_to_projection = matrix_inverse(matrix_from_projection);
    union() {
        // support for the bolt
        multmatrix(matrix_from_projection) linear_extrude(height =
$support_thickness, center=true)
        difference() {
            polygon([[support_x0,0], [support_x1,0],
[support_x1,support_z+z_shift], [support_x0,z_shift]]);
            offset(r=$support_gap) projection(cut=true)
multmatrix(matrix_to_projection) printable_bolt(angle, z_shift);
            }
        // mouse ears for the support

for(x=[$support_ears_d0.5,support_x1-$support_ears_d0.5+0.25])
right(x) zcyl(h=$support_ears_z, d=$support_ears_d, anchor=BOT);
        // the bolt
        printable_bolt(angle, z_shift);
        }
}

module nut() {
    difference() {
        zcyl(h=$nh, d=$nd, chamfer=$nh0.075, $fn=6, circum=true,
anchor=BOTTOM);
        down (eps) screw_hole($nut_spec, thread=true,
counterbore=false, bevel=true, anchor=BOTTOM); // , l=$nh+2
eps
    }
}

// use trimscale=0.0 in setenv_bolt() for untrimmed thread
module inspect_bolt() {
    linear_extrude(height = 1)
    projection(cut=true) xrot(-90) {
        printable_bolt();
        up($hh + $l - $nh) nut();
        }
}

// EXAMPLES
/*
setenv_bolt("M5,6", "hex", trimscale=0.9)
    print_bolt();

setenv_bolt("M4x0.8,8", head="button", drive="hex", ulength=0,
trimscale=1.05, z_fudge=-0.75, x0_fudge=0.5)
    print_bolt(angle=53.4);

setenv_bolt("M5,6", "hex", trimscale=0.9)
    nut();
//  inspect_bolt();
//  printable_bolt();
*/

This s/b just the ticket for bigger bolts, say 12mm and up.

I normally put the bolthole at whatever angle is needed, using the
cylinder primative, with $fn at 5 to 7, and sized so the result is self
threading at 60% to 70% engagement. In PETG, the bolr will be self
threading and have plenty of self locking to never jiggle out. Much
simpler to mount a fan at the right angle for max cooling or ??.  Most
of the bolts I use are in the 2.5 to 5mm range, threads too fine to ever
consider printing them. Use PETG's flexibility to advantage. Probably
not a good idea in pla, too brittle. Works even in PC for me. PC needs
bed temps in 120+ range and nozzles close to 300C though, temps well
beyond consuner printers.  Like the gpl, if it breaks, I get to keep all
the pieces. ;o)> And then make a stronger part in OpenSCAD.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Cheers, Gene Heskett, CET.

"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.

  • Louis D. Brandeis
On 8/9/24 22:35, Todd Allen via Discuss wrote: > It is easiest to print bolts vertically standing on their heads but > tensile strength is then maximally impacted by layer adhesion.  Printing > at a significant angle from vertical can achieve much better tensile > strength but requires support or cutting the bolt to create a flat > surface to lay on the print bed to print horizontally.  There are many > cases where cutting the bolt is not a good option and for those cases > I've found it fussy to generate support in a slicer that contacts the > bolt precisely as I want to allow for clean easy support removal. > > Here's an OpenSCAD script for creating bolts to be printed at an angle > with integrated support that I've found helpful for rapidly knocking out > a variety of fasteners with good tensile strength that take trivial > clean up effort to be ready for use.  It uses BOSL2/screws.scad to > create bolts.  It's quite basic with little polish and can require > tweaking of a few parameters to get best results but still I've found it > very useful and think others might too.  The technique I used to > generate the support could readily be adapted to a wide range of other > objects. > > If anyone knows of better approaches to printing bolts or generating > support I would love to hear about it. > > include <BOSL2/std.scad> > include <BOSL2/screws.scad> > > $fn= $preview ? 12 : 256; > eps = 0.001; > > // set trimscale sufficiently large to shave enough of the threads to > eliminate or minimize producing isolated blobs when sliced that don't > print well > // set ulength=0 for no chamfer to threaded shaft > // use x0_fudge to adjust where print_bolt() support starts on x axis > // use z_fudge to adjust z height of print_bolt() > module setenv_bolt(name, head="hex", drive="none", >     ulength=undef, nut_threads=2.5, nut_diameter=0, >     tolerance="6g", trimscale=1.0, slop=0.06, >     zrot, x0_fudge=0, z_fudge=0, >     support_thickness, support_gap = 0.15, support_ears_d, > support_ears_z = 0.2) > { >     spec = screw_info(name); >     $name = name; >     $head = head; >     $drive = drive; >     $p = struct_val(spec, "pitch"); >     $l = struct_val(spec, "length"); >     $d = struct_val(spec, "diameter"); >     $nh = $p*nut_threads+1.5; >     $nd = nut_diameter ? nut_diameter : $d*1.2+4.0; > >     $nut_spec = struct_set(spec, [ >         "length", $nh+2*eps, >         "thread_len", $nh+2*eps >         ]); > >     $tolerance = tolerance; >     $trimscale = trimscale; >     $ul = is_undef(ulength) ? $p*0.5 : ulength; // should also add in > amount tolerance spec undersizes threaded minor radius >     $tl = $l - $ul; >     $bolt_spec = struct_set(screw_info(name, head=head, drive=drive), [ >         "thread_len", $tl >         ]); >     echo($bolt_spec = $bolt_spec); > >     $hs = struct_val($bolt_spec, "head_size", $d); >     $hh = struct_val($bolt_spec, "head_height", 0); > >     $slop = slop;   // $slop is parameter of BOSL2 screw_hole() > >     // align hex head to rest on a flat when rotated about Y axis for > printing as headsize is across flats >     // may want default angles for drive types too >     auto_zrot = ($head=="hex") ? 90 : 60; >     $bolt_zrot = is_undef(zrot) ? auto_zrot : zrot; > >     $x0_fudge = x0_fudge; >     $z_fudge = z_fudge; >     $support_thickness = is_undef(support_thickness) ? 0.9+0.1*$d: > support_thickness; >     $support_gap = support_gap; >     $support_ears_d = is_undef(support_ears_d) ? 3+$d : support_ears_d; >     $support_ears_z = support_ears_z; > >     children(); > } > > module bolt() { >     zrot($bolt_zrot) screw(spec=$bolt_spec, tolerance=$tolerance, > orient=DOWN, anchor=TOP); > } > > module shank_chamfer_mask(od, c) { >     difference() { >         zcyl(h=c, d=od+10*eps, anchor=TOP); >         up(eps) zcyl(h=c+2*eps, d=od-2*c, chamfer1=-c, anchor=TOP); >         } > } > > // bolt tweaked for printing with threads trimmed and end of unthreaded > shank chamfered > module printable_bolt(angle=0, z_shift=0) { >     up(z_shift) yrot(angle) intersection() { >         if ($ul>0) difference() { >             bolt(); >             up($hh+$l-$tl+eps) shank_chamfer_mask($d, $p*0.5); >             } >         else bolt(); >         union() { >             // head >             zcyl(l=$hh+$l-$tl, d=$hs+3, anchor=BOT); >             // trimmed shaft >             up($hh+$l-$tl-eps) > cuboid([$d-$p*$trimscale,$d,$tl+eps],anchor=BOT); >             } >         } > } > > module print_bolt(angle=60) { >     bolt_length = $hh + $l; >     support_x0 = $x0_fudge + cos(angle) * $hh; >     support_x1 = sin(angle) * bolt_length + cos(angle)*$d*0.5*0.40; >     support_z = cos(angle) * bolt_length - sin(angle)*$d*0.4; >     z_shift = (angle<=90) ? $z_fudge+sin(angle)*$hs*0.5 : > $z_fudge+max(sin(angle)*$hs*0.5, sin(angle)*$hs*0.5-cos(angle*$hh), > -cos(angle)*bolt_length+sin(angle)*$d*0.4); >     matrix_from_projection = frame_map(x=RIGHT, y=UP); >     matrix_to_projection = matrix_inverse(matrix_from_projection); >     union() { >         // support for the bolt >         multmatrix(matrix_from_projection) linear_extrude(height = > $support_thickness, center=true) >         difference() { >             polygon([[support_x0,0], [support_x1,0], > [support_x1,support_z+z_shift], [support_x0,z_shift]]); >             offset(r=$support_gap) projection(cut=true) > multmatrix(matrix_to_projection) printable_bolt(angle, z_shift); >             } >         // mouse ears for the support > > for(x=[$support_ears_d*0.5,support_x1-$support_ears_d*0.5+0.25]) > right(x) zcyl(h=$support_ears_z, d=$support_ears_d, anchor=BOT); >         // the bolt >         printable_bolt(angle, z_shift); >         } > } > > module nut() { >     difference() { >         zcyl(h=$nh, d=$nd, chamfer=$nh*0.075, $fn=6, circum=true, > anchor=BOTTOM); >         down (eps) screw_hole($nut_spec, thread=true, > counterbore=false, bevel=true, anchor=BOTTOM); // , l=$nh+2*eps >     } > } > > // use trimscale=0.0 in setenv_bolt() for untrimmed thread > module inspect_bolt() { >     linear_extrude(height = 1) >     projection(cut=true) xrot(-90) { >         printable_bolt(); >         up($hh + $l - $nh) nut(); >         } > } > > // EXAMPLES > /* > setenv_bolt("M5,6", "hex", trimscale=0.9) >     print_bolt(); > > setenv_bolt("M4x0.8,8", head="button", drive="hex", ulength=0, > trimscale=1.05, z_fudge=-0.75, x0_fudge=0.5) >     print_bolt(angle=53.4); > > setenv_bolt("M5,6", "hex", trimscale=0.9) >     nut(); > //  inspect_bolt(); > //  printable_bolt(); > */ > This s/b just the ticket for bigger bolts, say 12mm and up. I normally put the bolthole at whatever angle is needed, using the cylinder primative, with $fn at 5 to 7, and sized so the result is self threading at 60% to 70% engagement. In PETG, the bolr will be self threading and have plenty of self locking to never jiggle out. Much simpler to mount a fan at the right angle for max cooling or ??. Most of the bolts I use are in the 2.5 to 5mm range, threads too fine to ever consider printing them. Use PETG's flexibility to advantage. Probably not a good idea in pla, too brittle. Works even in PC for me. PC needs bed temps in 120+ range and nozzles close to 300C though, temps well beyond consuner printers. Like the gpl, if it breaks, I get to keep all the pieces. ;o)> And then make a stronger part in OpenSCAD. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org Cheers, Gene Heskett, CET. -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author, 1940) If we desire respect for the law, we must first make the law respectable. - Louis D. Brandeis
MP
Marcus Poller
Sat, Aug 10, 2024 2:50 PM

Todd Allen via Discuss wrote:

It is easiest to print bolts vertically standing on their heads but tensile
strength is then maximally impacted by layer adhesion.

After printing many bolts I have come to the conclusion that I safe more time buying them than printing them.
Those are standard components, you can have them in any head-shape, thread-size, and color.
If I print a bolt

  • I have to use a thread cutting tool to free the print object of slicer artifacts and oozing
  • I am at risk that the bolt layers will separate in operation (it breaks or peals apart)
  • it takes a lot more time than reaching for my toolbox of bolts

I have personally settled to own a collection of many differnt lengths of M3-bolts [1], soldering in thread [2], default and safety (plastic ring inlay) nuts [3] and screw glue [4].

It is way easier than printing 10 bolts and then figuring out while 3 of them cannot be fastened with a nut.

My OpenSCAD-preview contains bolts. I need to be sure bolts do not overlap and I can access their head with a tool for fasting. But I have come to the personal conclusion that I should stop printing bolts.

Just my two cents,
Marcus

[1] https://www.hornbach.de/p/linsenkopfschraube-m-kreuzschlitz-din-7985-m3x12-mm-edelstahl-a2-100-stueck/6836149/
I even own m3x45 for 3d printed toys with long axles
[2] https://www.amazon.de/ruthex-Gewindeeinsatz-St%C3%BCck-Gewindebuchsen-Kunststoffteile/dp/B08BCRZZS3?ref_=ast_sto_dp&th=1
[3] https://www.hornbach.de/p/sechskant-sicherungsmutter-selbstsichernd-reyher-din-985-m3-galv-verzinkt-100-stueck/10316758/
[4] https://www.hornbach.de/p/loctite-schraubensicherung-243-mittelfest-normal-5-ml/7663487/
Anything that has to sustain vibrations, like childrens toys, needs to be either secured or glued.

Todd Allen via Discuss wrote: > It is easiest to print bolts vertically standing on their heads but tensile > strength is then maximally impacted by layer adhesion. After printing many bolts I have come to the conclusion that I safe more time buying them than printing them. Those are standard components, you can have them in any head-shape, thread-size, and color. If I print a bolt * I have to use a thread cutting tool to free the print object of slicer artifacts and oozing * I am at risk that the bolt layers will separate in operation (it breaks or peals apart) * it takes a lot more time than reaching for my toolbox of bolts I have personally settled to own a collection of many differnt lengths of M3-bolts [1], soldering in thread [2], default and safety (plastic ring inlay) nuts [3] and screw glue [4]. It is way easier than printing 10 bolts and then figuring out while 3 of them cannot be fastened with a nut. My OpenSCAD-preview contains bolts. I need to be sure bolts do not overlap and I can access their head with a tool for fasting. But I have come to the personal conclusion that I should stop printing bolts. Just my two cents, Marcus [1] https://www.hornbach.de/p/linsenkopfschraube-m-kreuzschlitz-din-7985-m3x12-mm-edelstahl-a2-100-stueck/6836149/ I even own m3x45 for 3d printed toys with long axles [2] https://www.amazon.de/ruthex-Gewindeeinsatz-St%C3%BCck-Gewindebuchsen-Kunststoffteile/dp/B08BCRZZS3?ref_=ast_sto_dp&th=1 [3] https://www.hornbach.de/p/sechskant-sicherungsmutter-selbstsichernd-reyher-din-985-m3-galv-verzinkt-100-stueck/10316758/ [4] https://www.hornbach.de/p/loctite-schraubensicherung-243-mittelfest-normal-5-ml/7663487/ Anything that has to sustain vibrations, like childrens toys, needs to be either secured or glued.
TA
Todd Allen
Sat, Aug 10, 2024 2:53 PM

"I normally put the bolthole at whatever angle is needed, using the
cylinder primative, with $fn at 5 to 7, and sized so the result is self
threading at 60% to 70% engagement. In PETG, the bolr will be self
threading and have plenty of self locking to never jiggle out."

That's exactly the sort of discussion I was hoping for.  To hear new things
I probably would have never thought to try.  The reason I used
BOSL2/screws.scad instead of the more flexible BOSL2/threading.scad in the
script I posted is the ease of producing fasteners with stock threads
compatible with taps and dies specifically for the case of printing bolt
holes horizontally where the threads at the top are poorly formed and need
to be chased with a tap.  But I expect your solution can handle many
situations and save the extra time and fuss of the way I've done it.

"Most of the bolts I use are in the 2.5 to 5mm range, threads too fine to
ever
consider printing them."

I used to think that too when I only printed fasteners vertically or
horizontally.  Horizontally one is limited to about 6 mm by the crappiness
of the threads formed and vertically one hits about the same limit not by
the threads but by the minor diameter and the difficulty of printing it
with adequate precision and strength as precision requires smaller
extrusion width and greater cooling while strength requires the opposite.
But when printing at angles of 50 to 70 degrees from vertical I find it
much easier to get good results at smaller sizes which is why I did
examples at 4 and 5 mm.

On Sat, Aug 10, 2024 at 2:25 AM gene heskett via Discuss <
discuss@lists.openscad.org> wrote:

On 8/9/24 22:35, Todd Allen via Discuss wrote:

It is easiest to print bolts vertically standing on their heads but
tensile strength is then maximally impacted by layer adhesion.  Printing
at a significant angle from vertical can achieve much better tensile
strength but requires support or cutting the bolt to create a flat
surface to lay on the print bed to print horizontally.  There are many
cases where cutting the bolt is not a good option and for those cases
I've found it fussy to generate support in a slicer that contacts the
bolt precisely as I want to allow for clean easy support removal.

Here's an OpenSCAD script for creating bolts to be printed at an angle
with integrated support that I've found helpful for rapidly knocking out
a variety of fasteners with good tensile strength that take trivial
clean up effort to be ready for use.  It uses BOSL2/screws.scad to
create bolts.  It's quite basic with little polish and can require
tweaking of a few parameters to get best results but still I've found it
very useful and think others might too.  The technique I used to
generate the support could readily be adapted to a wide range of other
objects.

If anyone knows of better approaches to printing bolts or generating
support I would love to hear about it.

include <BOSL2/std.scad>
include <BOSL2/screws.scad>

$fn= $preview ? 12 : 256;
eps = 0.001;

// set trimscale sufficiently large to shave enough of the threads to
eliminate or minimize producing isolated blobs when sliced that don't
print well
// set ulength=0 for no chamfer to threaded shaft
// use x0_fudge to adjust where print_bolt() support starts on x axis
// use z_fudge to adjust z height of print_bolt()
module setenv_bolt(name, head="hex", drive="none",
ulength=undef, nut_threads=2.5, nut_diameter=0,
tolerance="6g", trimscale=1.0, slop=0.06,
zrot, x0_fudge=0, z_fudge=0,
support_thickness, support_gap = 0.15, support_ears_d,
support_ears_z = 0.2)
{
spec = screw_info(name);
$name = name;
$head = head;
$drive = drive;
$p = struct_val(spec, "pitch");
$l = struct_val(spec, "length");
$d = struct_val(spec, "diameter");
$nh = $pnut_threads+1.5;
$nd = nut_diameter ? nut_diameter : $d
1.2+4.0;

  $nut_spec = struct_set(spec, [
      "length", $nh+2*eps,
      "thread_len", $nh+2*eps
      ]);

  $tolerance = tolerance;
  $trimscale = trimscale;
  $ul = is_undef(ulength) ? $p*0.5 : ulength; // should also add in

amount tolerance spec undersizes threaded minor radius
$tl = $l - $ul;
$bolt_spec = struct_set(screw_info(name, head=head, drive=drive), [
"thread_len", $tl
]);
echo($bolt_spec = $bolt_spec);

  $hs = struct_val($bolt_spec, "head_size", $d);
  $hh = struct_val($bolt_spec, "head_height", 0);

  $slop = slop;   // $slop is parameter of BOSL2 screw_hole()

  // align hex head to rest on a flat when rotated about Y axis for

printing as headsize is across flats
// may want default angles for drive types too
auto_zrot = ($head=="hex") ? 90 : 60;
$bolt_zrot = is_undef(zrot) ? auto_zrot : zrot;

  $x0_fudge = x0_fudge;
  $z_fudge = z_fudge;
  $support_thickness = is_undef(support_thickness) ? 0.9+0.1*$d:

support_thickness;
$support_gap = support_gap;
$support_ears_d = is_undef(support_ears_d) ? 3+$d : support_ears_d;
$support_ears_z = support_ears_z;

  children();

}

module bolt() {
zrot($bolt_zrot) screw(spec=$bolt_spec, tolerance=$tolerance,
orient=DOWN, anchor=TOP);
}

module shank_chamfer_mask(od, c) {
difference() {
zcyl(h=c, d=od+10eps, anchor=TOP);
up(eps) zcyl(h=c+2
eps, d=od-2*c, chamfer1=-c, anchor=TOP);
}
}

// bolt tweaked for printing with threads trimmed and end of unthreaded
shank chamfered
module printable_bolt(angle=0, z_shift=0) {
up(z_shift) yrot(angle) intersection() {
if ($ul>0) difference() {
bolt();
up($hh+$l-$tl+eps) shank_chamfer_mask($d, $p0.5);
}
else bolt();
union() {
// head
zcyl(l=$hh+$l-$tl, d=$hs+3, anchor=BOT);
// trimmed shaft
up($hh+$l-$tl-eps)
cuboid([$d-$p
$trimscale,$d,$tl+eps],anchor=BOT);
}
}
}

module print_bolt(angle=60) {
bolt_length = $hh + $l;
support_x0 = $x0_fudge + cos(angle) * $hh;
support_x1 = sin(angle) * bolt_length + cos(angle)$d0.50.40;
support_z = cos(angle) * bolt_length - sin(angle)
$d0.4;
z_shift = (angle<=90) ? $z_fudge+sin(angle)
$hs0.5 :
$z_fudge+max(sin(angle)
$hs0.5, sin(angle)$hs0.5-cos(angle$hh),
-cos(angle)bolt_length+sin(angle)$d*0.4);
matrix_from_projection = frame_map(x=RIGHT, y=UP);
matrix_to_projection = matrix_inverse(matrix_from_projection);
union() {
// support for the bolt
multmatrix(matrix_from_projection) linear_extrude(height =
$support_thickness, center=true)
difference() {
polygon([[support_x0,0], [support_x1,0],
[support_x1,support_z+z_shift], [support_x0,z_shift]]);
offset(r=$support_gap) projection(cut=true)
multmatrix(matrix_to_projection) printable_bolt(angle, z_shift);
}
// mouse ears for the support

for(x=[$support_ears_d0.5,support_x1-$support_ears_d0.5+0.25])
right(x) zcyl(h=$support_ears_z, d=$support_ears_d, anchor=BOT);
// the bolt
printable_bolt(angle, z_shift);
}
}

module nut() {
difference() {
zcyl(h=$nh, d=$nd, chamfer=$nh0.075, $fn=6, circum=true,
anchor=BOTTOM);
down (eps) screw_hole($nut_spec, thread=true,
counterbore=false, bevel=true, anchor=BOTTOM); // , l=$nh+2
eps
}
}

// use trimscale=0.0 in setenv_bolt() for untrimmed thread
module inspect_bolt() {
linear_extrude(height = 1)
projection(cut=true) xrot(-90) {
printable_bolt();
up($hh + $l - $nh) nut();
}
}

// EXAMPLES
/*
setenv_bolt("M5,6", "hex", trimscale=0.9)
print_bolt();

setenv_bolt("M4x0.8,8", head="button", drive="hex", ulength=0,
trimscale=1.05, z_fudge=-0.75, x0_fudge=0.5)
print_bolt(angle=53.4);

setenv_bolt("M5,6", "hex", trimscale=0.9)
nut();
//  inspect_bolt();
//  printable_bolt();
*/

This s/b just the ticket for bigger bolts, say 12mm and up.

I normally put the bolthole at whatever angle is needed, using the
cylinder primative, with $fn at 5 to 7, and sized so the result is self
threading at 60% to 70% engagement. In PETG, the bolr will be self
threading and have plenty of self locking to never jiggle out. Much
simpler to mount a fan at the right angle for max cooling or ??.  Most
of the bolts I use are in the 2.5 to 5mm range, threads too fine to ever
consider printing them. Use PETG's flexibility to advantage. Probably
not a good idea in pla, too brittle. Works even in PC for me. PC needs
bed temps in 120+ range and nozzles close to 300C though, temps well
beyond consuner printers.  Like the gpl, if it breaks, I get to keep all
the pieces. ;o)> And then make a stronger part in OpenSCAD.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Cheers, Gene Heskett, CET.

"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.

  • Louis D. Brandeis

OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

"I normally put the bolthole at whatever angle is needed, using the cylinder primative, with $fn at 5 to 7, and sized so the result is self threading at 60% to 70% engagement. In PETG, the bolr will be self threading and have plenty of self locking to never jiggle out." That's exactly the sort of discussion I was hoping for. To hear new things I probably would have never thought to try. The reason I used BOSL2/screws.scad instead of the more flexible BOSL2/threading.scad in the script I posted is the ease of producing fasteners with stock threads compatible with taps and dies specifically for the case of printing bolt holes horizontally where the threads at the top are poorly formed and need to be chased with a tap. But I expect your solution can handle many situations and save the extra time and fuss of the way I've done it. "Most of the bolts I use are in the 2.5 to 5mm range, threads too fine to ever consider printing them." I used to think that too when I only printed fasteners vertically or horizontally. Horizontally one is limited to about 6 mm by the crappiness of the threads formed and vertically one hits about the same limit not by the threads but by the minor diameter and the difficulty of printing it with adequate precision and strength as precision requires smaller extrusion width and greater cooling while strength requires the opposite. But when printing at angles of 50 to 70 degrees from vertical I find it much easier to get good results at smaller sizes which is why I did examples at 4 and 5 mm. On Sat, Aug 10, 2024 at 2:25 AM gene heskett via Discuss < discuss@lists.openscad.org> wrote: > On 8/9/24 22:35, Todd Allen via Discuss wrote: > > It is easiest to print bolts vertically standing on their heads but > > tensile strength is then maximally impacted by layer adhesion. Printing > > at a significant angle from vertical can achieve much better tensile > > strength but requires support or cutting the bolt to create a flat > > surface to lay on the print bed to print horizontally. There are many > > cases where cutting the bolt is not a good option and for those cases > > I've found it fussy to generate support in a slicer that contacts the > > bolt precisely as I want to allow for clean easy support removal. > > > > Here's an OpenSCAD script for creating bolts to be printed at an angle > > with integrated support that I've found helpful for rapidly knocking out > > a variety of fasteners with good tensile strength that take trivial > > clean up effort to be ready for use. It uses BOSL2/screws.scad to > > create bolts. It's quite basic with little polish and can require > > tweaking of a few parameters to get best results but still I've found it > > very useful and think others might too. The technique I used to > > generate the support could readily be adapted to a wide range of other > > objects. > > > > If anyone knows of better approaches to printing bolts or generating > > support I would love to hear about it. > > > > include <BOSL2/std.scad> > > include <BOSL2/screws.scad> > > > > $fn= $preview ? 12 : 256; > > eps = 0.001; > > > > // set trimscale sufficiently large to shave enough of the threads to > > eliminate or minimize producing isolated blobs when sliced that don't > > print well > > // set ulength=0 for no chamfer to threaded shaft > > // use x0_fudge to adjust where print_bolt() support starts on x axis > > // use z_fudge to adjust z height of print_bolt() > > module setenv_bolt(name, head="hex", drive="none", > > ulength=undef, nut_threads=2.5, nut_diameter=0, > > tolerance="6g", trimscale=1.0, slop=0.06, > > zrot, x0_fudge=0, z_fudge=0, > > support_thickness, support_gap = 0.15, support_ears_d, > > support_ears_z = 0.2) > > { > > spec = screw_info(name); > > $name = name; > > $head = head; > > $drive = drive; > > $p = struct_val(spec, "pitch"); > > $l = struct_val(spec, "length"); > > $d = struct_val(spec, "diameter"); > > $nh = $p*nut_threads+1.5; > > $nd = nut_diameter ? nut_diameter : $d*1.2+4.0; > > > > $nut_spec = struct_set(spec, [ > > "length", $nh+2*eps, > > "thread_len", $nh+2*eps > > ]); > > > > $tolerance = tolerance; > > $trimscale = trimscale; > > $ul = is_undef(ulength) ? $p*0.5 : ulength; // should also add in > > amount tolerance spec undersizes threaded minor radius > > $tl = $l - $ul; > > $bolt_spec = struct_set(screw_info(name, head=head, drive=drive), [ > > "thread_len", $tl > > ]); > > echo($bolt_spec = $bolt_spec); > > > > $hs = struct_val($bolt_spec, "head_size", $d); > > $hh = struct_val($bolt_spec, "head_height", 0); > > > > $slop = slop; // $slop is parameter of BOSL2 screw_hole() > > > > // align hex head to rest on a flat when rotated about Y axis for > > printing as headsize is across flats > > // may want default angles for drive types too > > auto_zrot = ($head=="hex") ? 90 : 60; > > $bolt_zrot = is_undef(zrot) ? auto_zrot : zrot; > > > > $x0_fudge = x0_fudge; > > $z_fudge = z_fudge; > > $support_thickness = is_undef(support_thickness) ? 0.9+0.1*$d: > > support_thickness; > > $support_gap = support_gap; > > $support_ears_d = is_undef(support_ears_d) ? 3+$d : support_ears_d; > > $support_ears_z = support_ears_z; > > > > children(); > > } > > > > module bolt() { > > zrot($bolt_zrot) screw(spec=$bolt_spec, tolerance=$tolerance, > > orient=DOWN, anchor=TOP); > > } > > > > module shank_chamfer_mask(od, c) { > > difference() { > > zcyl(h=c, d=od+10*eps, anchor=TOP); > > up(eps) zcyl(h=c+2*eps, d=od-2*c, chamfer1=-c, anchor=TOP); > > } > > } > > > > // bolt tweaked for printing with threads trimmed and end of unthreaded > > shank chamfered > > module printable_bolt(angle=0, z_shift=0) { > > up(z_shift) yrot(angle) intersection() { > > if ($ul>0) difference() { > > bolt(); > > up($hh+$l-$tl+eps) shank_chamfer_mask($d, $p*0.5); > > } > > else bolt(); > > union() { > > // head > > zcyl(l=$hh+$l-$tl, d=$hs+3, anchor=BOT); > > // trimmed shaft > > up($hh+$l-$tl-eps) > > cuboid([$d-$p*$trimscale,$d,$tl+eps],anchor=BOT); > > } > > } > > } > > > > module print_bolt(angle=60) { > > bolt_length = $hh + $l; > > support_x0 = $x0_fudge + cos(angle) * $hh; > > support_x1 = sin(angle) * bolt_length + cos(angle)*$d*0.5*0.40; > > support_z = cos(angle) * bolt_length - sin(angle)*$d*0.4; > > z_shift = (angle<=90) ? $z_fudge+sin(angle)*$hs*0.5 : > > $z_fudge+max(sin(angle)*$hs*0.5, sin(angle)*$hs*0.5-cos(angle*$hh), > > -cos(angle)*bolt_length+sin(angle)*$d*0.4); > > matrix_from_projection = frame_map(x=RIGHT, y=UP); > > matrix_to_projection = matrix_inverse(matrix_from_projection); > > union() { > > // support for the bolt > > multmatrix(matrix_from_projection) linear_extrude(height = > > $support_thickness, center=true) > > difference() { > > polygon([[support_x0,0], [support_x1,0], > > [support_x1,support_z+z_shift], [support_x0,z_shift]]); > > offset(r=$support_gap) projection(cut=true) > > multmatrix(matrix_to_projection) printable_bolt(angle, z_shift); > > } > > // mouse ears for the support > > > > for(x=[$support_ears_d*0.5,support_x1-$support_ears_d*0.5+0.25]) > > right(x) zcyl(h=$support_ears_z, d=$support_ears_d, anchor=BOT); > > // the bolt > > printable_bolt(angle, z_shift); > > } > > } > > > > module nut() { > > difference() { > > zcyl(h=$nh, d=$nd, chamfer=$nh*0.075, $fn=6, circum=true, > > anchor=BOTTOM); > > down (eps) screw_hole($nut_spec, thread=true, > > counterbore=false, bevel=true, anchor=BOTTOM); // , l=$nh+2*eps > > } > > } > > > > // use trimscale=0.0 in setenv_bolt() for untrimmed thread > > module inspect_bolt() { > > linear_extrude(height = 1) > > projection(cut=true) xrot(-90) { > > printable_bolt(); > > up($hh + $l - $nh) nut(); > > } > > } > > > > // EXAMPLES > > /* > > setenv_bolt("M5,6", "hex", trimscale=0.9) > > print_bolt(); > > > > setenv_bolt("M4x0.8,8", head="button", drive="hex", ulength=0, > > trimscale=1.05, z_fudge=-0.75, x0_fudge=0.5) > > print_bolt(angle=53.4); > > > > setenv_bolt("M5,6", "hex", trimscale=0.9) > > nut(); > > // inspect_bolt(); > > // printable_bolt(); > > */ > > > This s/b just the ticket for bigger bolts, say 12mm and up. > > I normally put the bolthole at whatever angle is needed, using the > cylinder primative, with $fn at 5 to 7, and sized so the result is self > threading at 60% to 70% engagement. In PETG, the bolr will be self > threading and have plenty of self locking to never jiggle out. Much > simpler to mount a fan at the right angle for max cooling or ??. Most > of the bolts I use are in the 2.5 to 5mm range, threads too fine to ever > consider printing them. Use PETG's flexibility to advantage. Probably > not a good idea in pla, too brittle. Works even in PC for me. PC needs > bed temps in 120+ range and nozzles close to 300C though, temps well > beyond consuner printers. Like the gpl, if it breaks, I get to keep all > the pieces. ;o)> And then make a stronger part in OpenSCAD. > > > _______________________________________________ > > OpenSCAD mailing list > > To unsubscribe send an email to discuss-leave@lists.openscad.org > > Cheers, Gene Heskett, CET. > -- > "There are four boxes to be used in defense of liberty: > soap, ballot, jury, and ammo. Please use in that order." > -Ed Howdershelt (Author, 1940) > If we desire respect for the law, we must first make the law respectable. > - Louis D. Brandeis > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
AM
Adrian Mariano
Sat, Aug 10, 2024 3:37 PM

Sorry about overlooking your reference to flat sided bolts.

I agree with Marcus that when standard hardware exists---use it.  It's
strong and ultimately easier to grab from a box than printing a fussy
model.  The use cases for printing threads are when you want something
unusual and strength requirements are modest.  I printed a mount to hold a
phone for example that had a threaded shaft to clamp the phone in place.
It worked well.  The screw was big, and very fast---probably not something
you could buy.  You don't need tremendous strength for this application.
Note that this device also mounted to a tripod mount and accomplished this
by means of added metal hardware, not printed threads.  Another use case
for printed threads is if you want to make a circular box with a screw-top
lid, or print lids for glass or plastic jars.  These threads are fairly big
and the strength requirements are generally low.

Printing lets you do things that are unsual. I read about "diamond" threads
where you superimpose left handed and right handed threads on a single
bolt.  Then left handed and right handed nuts can both travel on the bolt.
I don't know if it's good for anything, but it's an interesting thing to
fiddle with and as such, doesn't need to be strong---works fine printed
vertically.  See Example 7 here:
https://github.com/BelfrySCAD/BOSL2/wiki/threading.scad#module-threaded_rod

I think there's a better case for printing threaded holes.  There is no
narrow shaft to shear in half.  I think threaded holes can work OK even at
fairly small sizes.  If I recall correctly I tested sizes down to #6, which
is 3.5mm.  (My hardware is almost all imperial rather than metric.)  I have
done a bunch of printing of 1/4-20 (~6mm) size threads and they seem fine.
Another option is to print a hole and add threads with a tap.  And then
there's the approach Gene suggests of basically letting the screw be its
own tap.  The BOSL2 screw_hole() module supports all of these options  The
"tap" tolerance makes a hole the right size for tapping.  The "self tap"
tolerance makes an undersized hole sized for self-tapping with a screw.  I
tested it between #2 (2mm) and 1/2 inch (13mm).

But if you're trying to hang an elephant on the screw you should use a nut
trap.

On Sat, Aug 10, 2024 at 10:54 AM Todd Allen via Discuss <
discuss@lists.openscad.org> wrote:

"I normally put the bolthole at whatever angle is needed, using the
cylinder primative, with $fn at 5 to 7, and sized so the result is self
threading at 60% to 70% engagement. In PETG, the bolr will be self
threading and have plenty of self locking to never jiggle out."

That's exactly the sort of discussion I was hoping for.  To hear new
things I probably would have never thought to try.  The reason I used
BOSL2/screws.scad instead of the more flexible BOSL2/threading.scad in the
script I posted is the ease of producing fasteners with stock threads
compatible with taps and dies specifically for the case of printing bolt
holes horizontally where the threads at the top are poorly formed and need
to be chased with a tap.  But I expect your solution can handle many
situations and save the extra time and fuss of the way I've done it.

"Most of the bolts I use are in the 2.5 to 5mm range, threads too fine to
ever
consider printing them."

I used to think that too when I only printed fasteners vertically or
horizontally.  Horizontally one is limited to about 6 mm by the crappiness
of the threads formed and vertically one hits about the same limit not by
the threads but by the minor diameter and the difficulty of printing it
with adequate precision and strength as precision requires smaller
extrusion width and greater cooling while strength requires the opposite.
But when printing at angles of 50 to 70 degrees from vertical I find it
much easier to get good results at smaller sizes which is why I did
examples at 4 and 5 mm.

On Sat, Aug 10, 2024 at 2:25 AM gene heskett via Discuss <
discuss@lists.openscad.org> wrote:

On 8/9/24 22:35, Todd Allen via Discuss wrote:

It is easiest to print bolts vertically standing on their heads but
tensile strength is then maximally impacted by layer adhesion.

Printing

at a significant angle from vertical can achieve much better tensile
strength but requires support or cutting the bolt to create a flat
surface to lay on the print bed to print horizontally.  There are many
cases where cutting the bolt is not a good option and for those cases
I've found it fussy to generate support in a slicer that contacts the
bolt precisely as I want to allow for clean easy support removal.

Here's an OpenSCAD script for creating bolts to be printed at an angle
with integrated support that I've found helpful for rapidly knocking

out

a variety of fasteners with good tensile strength that take trivial
clean up effort to be ready for use.  It uses BOSL2/screws.scad to
create bolts.  It's quite basic with little polish and can require
tweaking of a few parameters to get best results but still I've found

it

very useful and think others might too.  The technique I used to
generate the support could readily be adapted to a wide range of other
objects.

If anyone knows of better approaches to printing bolts or generating
support I would love to hear about it.

include <BOSL2/std.scad>
include <BOSL2/screws.scad>

$fn= $preview ? 12 : 256;
eps = 0.001;

// set trimscale sufficiently large to shave enough of the threads to
eliminate or minimize producing isolated blobs when sliced that don't
print well
// set ulength=0 for no chamfer to threaded shaft
// use x0_fudge to adjust where print_bolt() support starts on x axis
// use z_fudge to adjust z height of print_bolt()
module setenv_bolt(name, head="hex", drive="none",
ulength=undef, nut_threads=2.5, nut_diameter=0,
tolerance="6g", trimscale=1.0, slop=0.06,
zrot, x0_fudge=0, z_fudge=0,
support_thickness, support_gap = 0.15, support_ears_d,
support_ears_z = 0.2)
{
spec = screw_info(name);
$name = name;
$head = head;
$drive = drive;
$p = struct_val(spec, "pitch");
$l = struct_val(spec, "length");
$d = struct_val(spec, "diameter");
$nh = $pnut_threads+1.5;
$nd = nut_diameter ? nut_diameter : $d
1.2+4.0;

  $nut_spec = struct_set(spec, [
      "length", $nh+2*eps,
      "thread_len", $nh+2*eps
      ]);

  $tolerance = tolerance;
  $trimscale = trimscale;
  $ul = is_undef(ulength) ? $p*0.5 : ulength; // should also add in

amount tolerance spec undersizes threaded minor radius
$tl = $l - $ul;
$bolt_spec = struct_set(screw_info(name, head=head, drive=drive), [
"thread_len", $tl
]);
echo($bolt_spec = $bolt_spec);

  $hs = struct_val($bolt_spec, "head_size", $d);
  $hh = struct_val($bolt_spec, "head_height", 0);

  $slop = slop;   // $slop is parameter of BOSL2 screw_hole()

  // align hex head to rest on a flat when rotated about Y axis for

printing as headsize is across flats
// may want default angles for drive types too
auto_zrot = ($head=="hex") ? 90 : 60;
$bolt_zrot = is_undef(zrot) ? auto_zrot : zrot;

  $x0_fudge = x0_fudge;
  $z_fudge = z_fudge;
  $support_thickness = is_undef(support_thickness) ? 0.9+0.1*$d:

support_thickness;
$support_gap = support_gap;
$support_ears_d = is_undef(support_ears_d) ? 3+$d : support_ears_d;
$support_ears_z = support_ears_z;

  children();

}

module bolt() {
zrot($bolt_zrot) screw(spec=$bolt_spec, tolerance=$tolerance,
orient=DOWN, anchor=TOP);
}

module shank_chamfer_mask(od, c) {
difference() {
zcyl(h=c, d=od+10eps, anchor=TOP);
up(eps) zcyl(h=c+2
eps, d=od-2*c, chamfer1=-c, anchor=TOP);
}
}

// bolt tweaked for printing with threads trimmed and end of unthreaded
shank chamfered
module printable_bolt(angle=0, z_shift=0) {
up(z_shift) yrot(angle) intersection() {
if ($ul>0) difference() {
bolt();
up($hh+$l-$tl+eps) shank_chamfer_mask($d, $p0.5);
}
else bolt();
union() {
// head
zcyl(l=$hh+$l-$tl, d=$hs+3, anchor=BOT);
// trimmed shaft
up($hh+$l-$tl-eps)
cuboid([$d-$p
$trimscale,$d,$tl+eps],anchor=BOT);
}
}
}

module print_bolt(angle=60) {
bolt_length = $hh + $l;
support_x0 = $x0_fudge + cos(angle) * $hh;
support_x1 = sin(angle) * bolt_length + cos(angle)$d0.50.40;
support_z = cos(angle) * bolt_length - sin(angle)
$d0.4;
z_shift = (angle<=90) ? $z_fudge+sin(angle)
$hs0.5 :
$z_fudge+max(sin(angle)
$hs0.5, sin(angle)$hs0.5-cos(angle$hh),
-cos(angle)bolt_length+sin(angle)$d*0.4);
matrix_from_projection = frame_map(x=RIGHT, y=UP);
matrix_to_projection = matrix_inverse(matrix_from_projection);
union() {
// support for the bolt
multmatrix(matrix_from_projection) linear_extrude(height =
$support_thickness, center=true)
difference() {
polygon([[support_x0,0], [support_x1,0],
[support_x1,support_z+z_shift], [support_x0,z_shift]]);
offset(r=$support_gap) projection(cut=true)
multmatrix(matrix_to_projection) printable_bolt(angle, z_shift);
}
// mouse ears for the support

for(x=[$support_ears_d0.5,support_x1-$support_ears_d0.5+0.25])
right(x) zcyl(h=$support_ears_z, d=$support_ears_d, anchor=BOT);
// the bolt
printable_bolt(angle, z_shift);
}
}

module nut() {
difference() {
zcyl(h=$nh, d=$nd, chamfer=$nh0.075, $fn=6, circum=true,
anchor=BOTTOM);
down (eps) screw_hole($nut_spec, thread=true,
counterbore=false, bevel=true, anchor=BOTTOM); // , l=$nh+2
eps
}
}

// use trimscale=0.0 in setenv_bolt() for untrimmed thread
module inspect_bolt() {
linear_extrude(height = 1)
projection(cut=true) xrot(-90) {
printable_bolt();
up($hh + $l - $nh) nut();
}
}

// EXAMPLES
/*
setenv_bolt("M5,6", "hex", trimscale=0.9)
print_bolt();

setenv_bolt("M4x0.8,8", head="button", drive="hex", ulength=0,
trimscale=1.05, z_fudge=-0.75, x0_fudge=0.5)
print_bolt(angle=53.4);

setenv_bolt("M5,6", "hex", trimscale=0.9)
nut();
//  inspect_bolt();
//  printable_bolt();
*/

This s/b just the ticket for bigger bolts, say 12mm and up.

I normally put the bolthole at whatever angle is needed, using the
cylinder primative, with $fn at 5 to 7, and sized so the result is self
threading at 60% to 70% engagement. In PETG, the bolr will be self
threading and have plenty of self locking to never jiggle out. Much
simpler to mount a fan at the right angle for max cooling or ??.  Most
of the bolts I use are in the 2.5 to 5mm range, threads too fine to ever
consider printing them. Use PETG's flexibility to advantage. Probably
not a good idea in pla, too brittle. Works even in PC for me. PC needs
bed temps in 120+ range and nozzles close to 300C though, temps well
beyond consuner printers.  Like the gpl, if it breaks, I get to keep all
the pieces. ;o)> And then make a stronger part in OpenSCAD.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Cheers, Gene Heskett, CET.

"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.

  • Louis D. Brandeis

OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Sorry about overlooking your reference to flat sided bolts. I agree with Marcus that when standard hardware exists---use it. It's strong and ultimately easier to grab from a box than printing a fussy model. The use cases for printing threads are when you want something unusual and strength requirements are modest. I printed a mount to hold a phone for example that had a threaded shaft to clamp the phone in place. It worked well. The screw was big, and very fast---probably not something you could buy. You don't need tremendous strength for this application. Note that this device also mounted to a tripod mount and accomplished this by means of added metal hardware, not printed threads. Another use case for printed threads is if you want to make a circular box with a screw-top lid, or print lids for glass or plastic jars. These threads are fairly big and the strength requirements are generally low. Printing lets you do things that are unsual. I read about "diamond" threads where you superimpose left handed and right handed threads on a single bolt. Then left handed and right handed nuts can both travel on the bolt. I don't know if it's good for anything, but it's an interesting thing to fiddle with and as such, doesn't need to be strong---works fine printed vertically. See Example 7 here: https://github.com/BelfrySCAD/BOSL2/wiki/threading.scad#module-threaded_rod I think there's a better case for printing threaded holes. There is no narrow shaft to shear in half. I think threaded holes can work OK even at fairly small sizes. If I recall correctly I tested sizes down to #6, which is 3.5mm. (My hardware is almost all imperial rather than metric.) I have done a bunch of printing of 1/4-20 (~6mm) size threads and they seem fine. Another option is to print a hole and add threads with a tap. And then there's the approach Gene suggests of basically letting the screw be its own tap. The BOSL2 screw_hole() module supports all of these options The "tap" tolerance makes a hole the right size for tapping. The "self tap" tolerance makes an undersized hole sized for self-tapping with a screw. I tested it between #2 (2mm) and 1/2 inch (13mm). But if you're trying to hang an elephant on the screw you should use a nut trap. On Sat, Aug 10, 2024 at 10:54 AM Todd Allen via Discuss < discuss@lists.openscad.org> wrote: > "I normally put the bolthole at whatever angle is needed, using the > cylinder primative, with $fn at 5 to 7, and sized so the result is self > threading at 60% to 70% engagement. In PETG, the bolr will be self > threading and have plenty of self locking to never jiggle out." > > That's exactly the sort of discussion I was hoping for. To hear new > things I probably would have never thought to try. The reason I used > BOSL2/screws.scad instead of the more flexible BOSL2/threading.scad in the > script I posted is the ease of producing fasteners with stock threads > compatible with taps and dies specifically for the case of printing bolt > holes horizontally where the threads at the top are poorly formed and need > to be chased with a tap. But I expect your solution can handle many > situations and save the extra time and fuss of the way I've done it. > > "Most of the bolts I use are in the 2.5 to 5mm range, threads too fine to > ever > consider printing them." > > I used to think that too when I only printed fasteners vertically or > horizontally. Horizontally one is limited to about 6 mm by the crappiness > of the threads formed and vertically one hits about the same limit not by > the threads but by the minor diameter and the difficulty of printing it > with adequate precision and strength as precision requires smaller > extrusion width and greater cooling while strength requires the opposite. > But when printing at angles of 50 to 70 degrees from vertical I find it > much easier to get good results at smaller sizes which is why I did > examples at 4 and 5 mm. > > On Sat, Aug 10, 2024 at 2:25 AM gene heskett via Discuss < > discuss@lists.openscad.org> wrote: > >> On 8/9/24 22:35, Todd Allen via Discuss wrote: >> > It is easiest to print bolts vertically standing on their heads but >> > tensile strength is then maximally impacted by layer adhesion. >> Printing >> > at a significant angle from vertical can achieve much better tensile >> > strength but requires support or cutting the bolt to create a flat >> > surface to lay on the print bed to print horizontally. There are many >> > cases where cutting the bolt is not a good option and for those cases >> > I've found it fussy to generate support in a slicer that contacts the >> > bolt precisely as I want to allow for clean easy support removal. >> > >> > Here's an OpenSCAD script for creating bolts to be printed at an angle >> > with integrated support that I've found helpful for rapidly knocking >> out >> > a variety of fasteners with good tensile strength that take trivial >> > clean up effort to be ready for use. It uses BOSL2/screws.scad to >> > create bolts. It's quite basic with little polish and can require >> > tweaking of a few parameters to get best results but still I've found >> it >> > very useful and think others might too. The technique I used to >> > generate the support could readily be adapted to a wide range of other >> > objects. >> > >> > If anyone knows of better approaches to printing bolts or generating >> > support I would love to hear about it. >> > >> > include <BOSL2/std.scad> >> > include <BOSL2/screws.scad> >> > >> > $fn= $preview ? 12 : 256; >> > eps = 0.001; >> > >> > // set trimscale sufficiently large to shave enough of the threads to >> > eliminate or minimize producing isolated blobs when sliced that don't >> > print well >> > // set ulength=0 for no chamfer to threaded shaft >> > // use x0_fudge to adjust where print_bolt() support starts on x axis >> > // use z_fudge to adjust z height of print_bolt() >> > module setenv_bolt(name, head="hex", drive="none", >> > ulength=undef, nut_threads=2.5, nut_diameter=0, >> > tolerance="6g", trimscale=1.0, slop=0.06, >> > zrot, x0_fudge=0, z_fudge=0, >> > support_thickness, support_gap = 0.15, support_ears_d, >> > support_ears_z = 0.2) >> > { >> > spec = screw_info(name); >> > $name = name; >> > $head = head; >> > $drive = drive; >> > $p = struct_val(spec, "pitch"); >> > $l = struct_val(spec, "length"); >> > $d = struct_val(spec, "diameter"); >> > $nh = $p*nut_threads+1.5; >> > $nd = nut_diameter ? nut_diameter : $d*1.2+4.0; >> > >> > $nut_spec = struct_set(spec, [ >> > "length", $nh+2*eps, >> > "thread_len", $nh+2*eps >> > ]); >> > >> > $tolerance = tolerance; >> > $trimscale = trimscale; >> > $ul = is_undef(ulength) ? $p*0.5 : ulength; // should also add in >> > amount tolerance spec undersizes threaded minor radius >> > $tl = $l - $ul; >> > $bolt_spec = struct_set(screw_info(name, head=head, drive=drive), [ >> > "thread_len", $tl >> > ]); >> > echo($bolt_spec = $bolt_spec); >> > >> > $hs = struct_val($bolt_spec, "head_size", $d); >> > $hh = struct_val($bolt_spec, "head_height", 0); >> > >> > $slop = slop; // $slop is parameter of BOSL2 screw_hole() >> > >> > // align hex head to rest on a flat when rotated about Y axis for >> > printing as headsize is across flats >> > // may want default angles for drive types too >> > auto_zrot = ($head=="hex") ? 90 : 60; >> > $bolt_zrot = is_undef(zrot) ? auto_zrot : zrot; >> > >> > $x0_fudge = x0_fudge; >> > $z_fudge = z_fudge; >> > $support_thickness = is_undef(support_thickness) ? 0.9+0.1*$d: >> > support_thickness; >> > $support_gap = support_gap; >> > $support_ears_d = is_undef(support_ears_d) ? 3+$d : support_ears_d; >> > $support_ears_z = support_ears_z; >> > >> > children(); >> > } >> > >> > module bolt() { >> > zrot($bolt_zrot) screw(spec=$bolt_spec, tolerance=$tolerance, >> > orient=DOWN, anchor=TOP); >> > } >> > >> > module shank_chamfer_mask(od, c) { >> > difference() { >> > zcyl(h=c, d=od+10*eps, anchor=TOP); >> > up(eps) zcyl(h=c+2*eps, d=od-2*c, chamfer1=-c, anchor=TOP); >> > } >> > } >> > >> > // bolt tweaked for printing with threads trimmed and end of unthreaded >> > shank chamfered >> > module printable_bolt(angle=0, z_shift=0) { >> > up(z_shift) yrot(angle) intersection() { >> > if ($ul>0) difference() { >> > bolt(); >> > up($hh+$l-$tl+eps) shank_chamfer_mask($d, $p*0.5); >> > } >> > else bolt(); >> > union() { >> > // head >> > zcyl(l=$hh+$l-$tl, d=$hs+3, anchor=BOT); >> > // trimmed shaft >> > up($hh+$l-$tl-eps) >> > cuboid([$d-$p*$trimscale,$d,$tl+eps],anchor=BOT); >> > } >> > } >> > } >> > >> > module print_bolt(angle=60) { >> > bolt_length = $hh + $l; >> > support_x0 = $x0_fudge + cos(angle) * $hh; >> > support_x1 = sin(angle) * bolt_length + cos(angle)*$d*0.5*0.40; >> > support_z = cos(angle) * bolt_length - sin(angle)*$d*0.4; >> > z_shift = (angle<=90) ? $z_fudge+sin(angle)*$hs*0.5 : >> > $z_fudge+max(sin(angle)*$hs*0.5, sin(angle)*$hs*0.5-cos(angle*$hh), >> > -cos(angle)*bolt_length+sin(angle)*$d*0.4); >> > matrix_from_projection = frame_map(x=RIGHT, y=UP); >> > matrix_to_projection = matrix_inverse(matrix_from_projection); >> > union() { >> > // support for the bolt >> > multmatrix(matrix_from_projection) linear_extrude(height = >> > $support_thickness, center=true) >> > difference() { >> > polygon([[support_x0,0], [support_x1,0], >> > [support_x1,support_z+z_shift], [support_x0,z_shift]]); >> > offset(r=$support_gap) projection(cut=true) >> > multmatrix(matrix_to_projection) printable_bolt(angle, z_shift); >> > } >> > // mouse ears for the support >> > >> > for(x=[$support_ears_d*0.5,support_x1-$support_ears_d*0.5+0.25]) >> > right(x) zcyl(h=$support_ears_z, d=$support_ears_d, anchor=BOT); >> > // the bolt >> > printable_bolt(angle, z_shift); >> > } >> > } >> > >> > module nut() { >> > difference() { >> > zcyl(h=$nh, d=$nd, chamfer=$nh*0.075, $fn=6, circum=true, >> > anchor=BOTTOM); >> > down (eps) screw_hole($nut_spec, thread=true, >> > counterbore=false, bevel=true, anchor=BOTTOM); // , l=$nh+2*eps >> > } >> > } >> > >> > // use trimscale=0.0 in setenv_bolt() for untrimmed thread >> > module inspect_bolt() { >> > linear_extrude(height = 1) >> > projection(cut=true) xrot(-90) { >> > printable_bolt(); >> > up($hh + $l - $nh) nut(); >> > } >> > } >> > >> > // EXAMPLES >> > /* >> > setenv_bolt("M5,6", "hex", trimscale=0.9) >> > print_bolt(); >> > >> > setenv_bolt("M4x0.8,8", head="button", drive="hex", ulength=0, >> > trimscale=1.05, z_fudge=-0.75, x0_fudge=0.5) >> > print_bolt(angle=53.4); >> > >> > setenv_bolt("M5,6", "hex", trimscale=0.9) >> > nut(); >> > // inspect_bolt(); >> > // printable_bolt(); >> > */ >> > >> This s/b just the ticket for bigger bolts, say 12mm and up. >> >> I normally put the bolthole at whatever angle is needed, using the >> cylinder primative, with $fn at 5 to 7, and sized so the result is self >> threading at 60% to 70% engagement. In PETG, the bolr will be self >> threading and have plenty of self locking to never jiggle out. Much >> simpler to mount a fan at the right angle for max cooling or ??. Most >> of the bolts I use are in the 2.5 to 5mm range, threads too fine to ever >> consider printing them. Use PETG's flexibility to advantage. Probably >> not a good idea in pla, too brittle. Works even in PC for me. PC needs >> bed temps in 120+ range and nozzles close to 300C though, temps well >> beyond consuner printers. Like the gpl, if it breaks, I get to keep all >> the pieces. ;o)> And then make a stronger part in OpenSCAD. >> >> > _______________________________________________ >> > OpenSCAD mailing list >> > To unsubscribe send an email to discuss-leave@lists.openscad.org >> >> Cheers, Gene Heskett, CET. >> -- >> "There are four boxes to be used in defense of liberty: >> soap, ballot, jury, and ammo. Please use in that order." >> -Ed Howdershelt (Author, 1940) >> If we desire respect for the law, we must first make the law respectable. >> - Louis D. Brandeis >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
GB
Glenn Butcher
Sat, Aug 10, 2024 4:16 PM

Thanks for saying it...

The few places I need threading in the models I'm printing, I tap the hole.

I bought the thread kit for the Sherline lathe, but now I wish I'd have
bought the dividing stuff to make gears.  I will cut threads on some
custom screws I need to make for locomotive valve gear, but I'll do that
with a die.

Reminds me, need to ping MicroMark on my 0-90 die backorder...

On 8/10/2024 8:50 AM, Marcus Poller via Discuss wrote:

Todd Allen via Discuss wrote:

It is easiest to print bolts vertically standing on their heads but tensile
strength is then maximally impacted by layer adhesion.

After printing many bolts I have come to the conclusion that I safe more time buying them than printing them.
Those are standard components, you can have them in any head-shape, thread-size, and color.
If I print a bolt

  • I have to use a thread cutting tool to free the print object of slicer artifacts and oozing
  • I am at risk that the bolt layers will separate in operation (it breaks or peals apart)
  • it takes a lot more time than reaching for my toolbox of bolts

I have personally settled to own a collection of many differnt lengths of M3-bolts [1], soldering in thread [2], default and safety (plastic ring inlay) nuts [3] and screw glue [4].

It is way easier than printing 10 bolts and then figuring out while 3 of them cannot be fastened with a nut.

My OpenSCAD-preview contains bolts. I need to be sure bolts do not overlap and I can access their head with a tool for fasting. But I have come to the personal conclusion that I should stop printing bolts.

Just my two cents,
Marcus

[1] https://www.hornbach.de/p/linsenkopfschraube-m-kreuzschlitz-din-7985-m3x12-mm-edelstahl-a2-100-stueck/6836149/
I even own m3x45 for 3d printed toys with long axles
[2] https://www.amazon.de/ruthex-Gewindeeinsatz-St%C3%BCck-Gewindebuchsen-Kunststoffteile/dp/B08BCRZZS3?ref_=ast_sto_dp&th=1
[3] https://www.hornbach.de/p/sechskant-sicherungsmutter-selbstsichernd-reyher-din-985-m3-galv-verzinkt-100-stueck/10316758/
[4] https://www.hornbach.de/p/loctite-schraubensicherung-243-mittelfest-normal-5-ml/7663487/
Anything that has to sustain vibrations, like childrens toys, needs to be either secured or glued.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Thanks for saying it... The few places I need threading in the models I'm printing, I tap the hole. I bought the thread kit for the Sherline lathe, but now I wish I'd have bought the dividing stuff to make gears.  I will cut threads on some custom screws I need to make for locomotive valve gear, but I'll do that with a die. Reminds me, need to ping MicroMark on my 0-90 die backorder... On 8/10/2024 8:50 AM, Marcus Poller via Discuss wrote: > Todd Allen via Discuss wrote: >> It is easiest to print bolts vertically standing on their heads but tensile >> strength is then maximally impacted by layer adhesion. > > After printing many bolts I have come to the conclusion that I safe more time buying them than printing them. > Those are standard components, you can have them in any head-shape, thread-size, and color. > If I print a bolt > > * I have to use a thread cutting tool to free the print object of slicer artifacts and oozing > * I am at risk that the bolt layers will separate in operation (it breaks or peals apart) > * it takes a lot more time than reaching for my toolbox of bolts > > I have personally settled to own a collection of many differnt lengths of M3-bolts [1], soldering in thread [2], default and safety (plastic ring inlay) nuts [3] and screw glue [4]. > > It is way easier than printing 10 bolts and then figuring out while 3 of them cannot be fastened with a nut. > > My OpenSCAD-preview contains bolts. I need to be sure bolts do not overlap and I can access their head with a tool for fasting. But I have come to the personal conclusion that I should stop printing bolts. > > Just my two cents, > Marcus > > [1] https://www.hornbach.de/p/linsenkopfschraube-m-kreuzschlitz-din-7985-m3x12-mm-edelstahl-a2-100-stueck/6836149/ > I even own m3x45 for 3d printed toys with long axles > [2] https://www.amazon.de/ruthex-Gewindeeinsatz-St%C3%BCck-Gewindebuchsen-Kunststoffteile/dp/B08BCRZZS3?ref_=ast_sto_dp&th=1 > [3] https://www.hornbach.de/p/sechskant-sicherungsmutter-selbstsichernd-reyher-din-985-m3-galv-verzinkt-100-stueck/10316758/ > [4] https://www.hornbach.de/p/loctite-schraubensicherung-243-mittelfest-normal-5-ml/7663487/ > Anything that has to sustain vibrations, like childrens toys, needs to be either secured or glued. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
TA
Todd Allen
Sat, Aug 10, 2024 4:20 PM

But I have come to the personal conclusion that I should stop printing

bolts.

I've got fairly assortment boxes of threaded inserts in a variety of
lengths and diameters from M2 to M5 and assortments of small bolts, set
screws and screws with a variety of heads and diameters mostly M5 and
smaller.  But as sizes increase my parts on hand are increasingly limited
due to the cost of acquiring stock and the cost in space and time of
keeping stock stored, sorted and readily accessible.  In my smaller sizes I
also have gaps in my collection where I used all of the items of a
particular type and size in an assortment and have yet to bother replacing
them.  Printing may be more fuss than searching for and using a part I
might have on hand but it can be easier than using parts which aren't
exactly what one wants and faster than shopping to get the right part.  I
also like being able to make custom parts such as the thumbwheel bolts and
nuts seen here on the 3d printed adjustable monitor arm, the printed
adjustable desk height riser,  the very short fat bolt used to secure the
counter weights on the base and the one hidden from view securing the
underside of the C clamp at the base of the monitor arm:
[image: bed_desk_1024.jpg]

On Sat, Aug 10, 2024 at 9:50 AM Marcus Poller h-openscad.org@crystaldown.de
wrote:

Todd Allen via Discuss wrote:

It is easiest to print bolts vertically standing on their heads but

tensile

strength is then maximally impacted by layer adhesion.

After printing many bolts I have come to the conclusion that I safe more
time buying them than printing them.
Those are standard components, you can have them in any head-shape,
thread-size, and color.
If I print a bolt

  • I have to use a thread cutting tool to free the print object of slicer
    artifacts and oozing
  • I am at risk that the bolt layers will separate in operation (it breaks
    or peals apart)
  • it takes a lot more time than reaching for my toolbox of bolts

I have personally settled to own a collection of many differnt lengths of
M3-bolts [1], soldering in thread [2], default and safety (plastic ring
inlay) nuts [3] and screw glue [4].

It is way easier than printing 10 bolts and then figuring out while 3 of
them cannot be fastened with a nut.

My OpenSCAD-preview contains bolts. I need to be sure bolts do not overlap
and I can access their head with a tool for fasting. But I have come to the
personal conclusion that I should stop printing bolts.

Just my two cents,
Marcus

[1]
https://www.hornbach.de/p/linsenkopfschraube-m-kreuzschlitz-din-7985-m3x12-mm-edelstahl-a2-100-stueck/6836149/
I even own m3x45 for 3d printed toys with long axles
[2]
https://www.amazon.de/ruthex-Gewindeeinsatz-St%C3%BCck-Gewindebuchsen-Kunststoffteile/dp/B08BCRZZS3?ref_=ast_sto_dp&th=1
[3]
https://www.hornbach.de/p/sechskant-sicherungsmutter-selbstsichernd-reyher-din-985-m3-galv-verzinkt-100-stueck/10316758/
[4]
https://www.hornbach.de/p/loctite-schraubensicherung-243-mittelfest-normal-5-ml/7663487/
Anything that has to sustain vibrations, like childrens toys, needs to be
either secured or glued.

>But I have come to the personal conclusion that I should stop printing bolts. I've got fairly assortment boxes of threaded inserts in a variety of lengths and diameters from M2 to M5 and assortments of small bolts, set screws and screws with a variety of heads and diameters mostly M5 and smaller. But as sizes increase my parts on hand are increasingly limited due to the cost of acquiring stock and the cost in space and time of keeping stock stored, sorted and readily accessible. In my smaller sizes I also have gaps in my collection where I used all of the items of a particular type and size in an assortment and have yet to bother replacing them. Printing may be more fuss than searching for and using a part I might have on hand but it can be easier than using parts which aren't exactly what one wants and faster than shopping to get the right part. I also like being able to make custom parts such as the thumbwheel bolts and nuts seen here on the 3d printed adjustable monitor arm, the printed adjustable desk height riser, the very short fat bolt used to secure the counter weights on the base and the one hidden from view securing the underside of the C clamp at the base of the monitor arm: [image: bed_desk_1024.jpg] On Sat, Aug 10, 2024 at 9:50 AM Marcus Poller <h-openscad.org@crystaldown.de> wrote: > Todd Allen via Discuss wrote: > > It is easiest to print bolts vertically standing on their heads but > tensile > > strength is then maximally impacted by layer adhesion. > > > After printing many bolts I have come to the conclusion that I safe more > time buying them than printing them. > Those are standard components, you can have them in any head-shape, > thread-size, and color. > If I print a bolt > > * I have to use a thread cutting tool to free the print object of slicer > artifacts and oozing > * I am at risk that the bolt layers will separate in operation (it breaks > or peals apart) > * it takes a lot more time than reaching for my toolbox of bolts > > I have personally settled to own a collection of many differnt lengths of > M3-bolts [1], soldering in thread [2], default and safety (plastic ring > inlay) nuts [3] and screw glue [4]. > > It is way easier than printing 10 bolts and then figuring out while 3 of > them cannot be fastened with a nut. > > My OpenSCAD-preview contains bolts. I need to be sure bolts do not overlap > and I can access their head with a tool for fasting. But I have come to the > personal conclusion that I should stop printing bolts. > > Just my two cents, > Marcus > > [1] > https://www.hornbach.de/p/linsenkopfschraube-m-kreuzschlitz-din-7985-m3x12-mm-edelstahl-a2-100-stueck/6836149/ > I even own m3x45 for 3d printed toys with long axles > [2] > https://www.amazon.de/ruthex-Gewindeeinsatz-St%C3%BCck-Gewindebuchsen-Kunststoffteile/dp/B08BCRZZS3?ref_=ast_sto_dp&th=1 > [3] > https://www.hornbach.de/p/sechskant-sicherungsmutter-selbstsichernd-reyher-din-985-m3-galv-verzinkt-100-stueck/10316758/ > [4] > https://www.hornbach.de/p/loctite-schraubensicherung-243-mittelfest-normal-5-ml/7663487/ > Anything that has to sustain vibrations, like childrens toys, needs to be > either secured or glued. >
JB
Jon Bondy
Sat, Aug 10, 2024 4:33 PM

I often trap a hex head bolt in a 3D printed thumbwheel.

On 8/10/2024 12:20 PM, Todd Allen via Discuss wrote:

But I have come to the personal conclusion that I should stop

printing bolts.

I've got fairly assortment boxes of threaded inserts in a variety of
lengths and diameters from M2 to M5 and assortments of small bolts,
set screws and screws with a variety of heads and diameters mostly M5
and smaller.  But as sizes increase my parts on hand are increasingly
limited due to the cost of acquiring stock and the cost in space and
time of keeping stock stored, sorted and readily accessible.  In my
smaller sizes I also have gaps in my collection where I used all of
the items of a particular type and size in an assortment and have yet
to bother replacing them.  Printing may be more fuss than searching
for and using a part I might have on hand but it can be easier than
using parts which aren't exactly what one wants and faster than
shopping to get the right part.  I also like being able to make custom
parts such as the thumbwheel bolts and nuts seen here on the 3d
printed adjustable monitor arm, the printed  adjustable desk height
riser,  the very short fat bolt used to secure the counter weights on
the base and the one hidden from view securing the underside of the C
clamp at the base of the monitor arm:
bed_desk_1024.jpg

On Sat, Aug 10, 2024 at 9:50 AM Marcus Poller
h-openscad.org@crystaldown.de wrote:

 Todd Allen via Discuss wrote:

It is easiest to print bolts vertically standing on their heads

 but tensile

strength is then maximally impacted by layer adhesion.

 After printing many bolts I have come to the conclusion that I
 safe more time buying them than printing them.
 Those are standard components, you can have them in any
 head-shape, thread-size, and color.
 If I print a bolt

  * I have to use a thread cutting tool to free the print object of
 slicer artifacts and oozing
  * I am at risk that the bolt layers will separate in operation
 (it breaks or peals apart)
  * it takes a lot more time than reaching for my toolbox of bolts

 I have personally settled to own a collection of many differnt
 lengths of M3-bolts [1], soldering in thread [2], default and
 safety (plastic ring inlay) nuts [3] and screw glue [4].

 It is way easier than printing 10 bolts and then figuring out
 while 3 of them cannot be fastened with a nut.

 My OpenSCAD-preview contains bolts. I need to be sure bolts do not
 overlap and I can access their head with a tool for fasting. But I
 have come to the personal conclusion that I should stop printing
 bolts.

 Just my two cents,
 Marcus

 [1]
 https://www.hornbach.de/p/linsenkopfschraube-m-kreuzschlitz-din-7985-m3x12-mm-edelstahl-a2-100-stueck/6836149/
 I even own m3x45 for 3d printed toys with long axles
 [2]
 https://www.amazon.de/ruthex-Gewindeeinsatz-St%C3%BCck-Gewindebuchsen-Kunststoffteile/dp/B08BCRZZS3?ref_=ast_sto_dp&th=1
 <https://www.amazon.de/ruthex-Gewindeeinsatz-St%C3%BCck-Gewindebuchsen-Kunststoffteile/dp/B08BCRZZS3?ref_=ast_sto_dp&th=1>
 [3]
 https://www.hornbach.de/p/sechskant-sicherungsmutter-selbstsichernd-reyher-din-985-m3-galv-verzinkt-100-stueck/10316758/
 [4]
 https://www.hornbach.de/p/loctite-schraubensicherung-243-mittelfest-normal-5-ml/7663487/
 Anything that has to sustain vibrations, like childrens toys,
 needs to be either secured or glued.

OpenSCAD mailing list
To unsubscribe send an email todiscuss-leave@lists.openscad.org

--
This email has been checked for viruses by AVG antivirus software.
www.avg.com

I often trap a hex head bolt in a 3D printed thumbwheel. On 8/10/2024 12:20 PM, Todd Allen via Discuss wrote: > >But I have come to the personal conclusion that I should stop > printing bolts. > > I've got fairly assortment boxes of threaded inserts in a variety of > lengths and diameters from M2 to M5 and assortments of small bolts, > set screws and screws with a variety of heads and diameters mostly M5 > and smaller.  But as sizes increase my parts on hand are increasingly > limited due to the cost of acquiring stock and the cost in space and > time of keeping stock stored, sorted and readily accessible.  In my > smaller sizes I also have gaps in my collection where I used all of > the items of a particular type and size in an assortment and have yet > to bother replacing them.  Printing may be more fuss than searching > for and using a part I might have on hand but it can be easier than > using parts which aren't exactly what one wants and faster than > shopping to get the right part.  I also like being able to make custom > parts such as the thumbwheel bolts and nuts seen here on the 3d > printed adjustable monitor arm, the printed  adjustable desk height > riser,  the very short fat bolt used to secure the counter weights on > the base and the one hidden from view securing the underside of the C > clamp at the base of the monitor arm: > bed_desk_1024.jpg > > On Sat, Aug 10, 2024 at 9:50 AM Marcus Poller > <h-openscad.org@crystaldown.de> wrote: > > Todd Allen via Discuss wrote: > > It is easiest to print bolts vertically standing on their heads > but tensile > > strength is then maximally impacted by layer adhesion. > > > After printing many bolts I have come to the conclusion that I > safe more time buying them than printing them. > Those are standard components, you can have them in any > head-shape, thread-size, and color. > If I print a bolt > >  * I have to use a thread cutting tool to free the print object of > slicer artifacts and oozing >  * I am at risk that the bolt layers will separate in operation > (it breaks or peals apart) >  * it takes a lot more time than reaching for my toolbox of bolts > > I have personally settled to own a collection of many differnt > lengths of M3-bolts [1], soldering in thread [2], default and > safety (plastic ring inlay) nuts [3] and screw glue [4]. > > It is way easier than printing 10 bolts and then figuring out > while 3 of them cannot be fastened with a nut. > > My OpenSCAD-preview contains bolts. I need to be sure bolts do not > overlap and I can access their head with a tool for fasting. But I > have come to the personal conclusion that I should stop printing > bolts. > > Just my two cents, > Marcus > > [1] > https://www.hornbach.de/p/linsenkopfschraube-m-kreuzschlitz-din-7985-m3x12-mm-edelstahl-a2-100-stueck/6836149/ > I even own m3x45 for 3d printed toys with long axles > [2] > https://www.amazon.de/ruthex-Gewindeeinsatz-St%C3%BCck-Gewindebuchsen-Kunststoffteile/dp/B08BCRZZS3?ref_=ast_sto_dp&th=1 > <https://www.amazon.de/ruthex-Gewindeeinsatz-St%C3%BCck-Gewindebuchsen-Kunststoffteile/dp/B08BCRZZS3?ref_=ast_sto_dp&th=1> > [3] > https://www.hornbach.de/p/sechskant-sicherungsmutter-selbstsichernd-reyher-din-985-m3-galv-verzinkt-100-stueck/10316758/ > [4] > https://www.hornbach.de/p/loctite-schraubensicherung-243-mittelfest-normal-5-ml/7663487/ > Anything that has to sustain vibrations, like childrens toys, > needs to be either secured or glued. > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org -- This email has been checked for viruses by AVG antivirus software. www.avg.com