discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Helix with circular cross-section

AM
Adrian Mariano
Thu, Jun 26, 2025 10:20 AM

The installation instructions on the github page explain how to set your
library path.

On Thu, Jun 26, 2025 at 1:49 AM gene heskett via Discuss <
discuss@lists.openscad.org> wrote:

On 6/25/25 21:07, Adrian Mariano via Discuss wrote:

The example I posted does not require a recent copy of BOSL2, so your
issues may depend on installation issues, but you didn't post the error
messages so that makes a more detailed diagnosis impossible. You should

be

able to include BOSL2 without needing the full path if you have your
library path set up correctly.

Apparently I don't.  And its not well covered in the cheat sheet.

If you want the most recent BOSL2 it can be found at:

https://github.com/BelfrySCAD/BOSL2

Thank you.

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

The installation instructions on the github page explain how to set your library path. On Thu, Jun 26, 2025 at 1:49 AM gene heskett via Discuss < discuss@lists.openscad.org> wrote: > On 6/25/25 21:07, Adrian Mariano via Discuss wrote: > > The example I posted does not require a recent copy of BOSL2, so your > > issues may depend on installation issues, but you didn't post the error > > messages so that makes a more detailed diagnosis impossible. You should > be > > able to include BOSL2 without needing the full path if you have your > > library path set up correctly. > Apparently I don't. And its not well covered in the cheat sheet. > > If you want the most recent BOSL2 it can be found at: > > > > https://github.com/BelfrySCAD/BOSL2 > > Thank you. > > 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 >
GH
gene heskett
Thu, Jun 26, 2025 1:38 PM

On 6/26/25 06:20, Adrian Mariano via Discuss wrote:

The installation instructions on the github page explain how to set your
library path.

Got it there,  looks ok.

On Thu, Jun 26, 2025 at 1:49 AM gene heskett via Discuss <
discuss@lists.openscad.org> wrote:

On 6/25/25 21:07, Adrian Mariano via Discuss wrote:

The example I posted does not require a recent copy of BOSL2, so your
issues may depend on installation issues, but you didn't post the error
messages so that makes a more detailed diagnosis impossible. You should

be

able to include BOSL2 without needing the full path if you have your
library path set up correctly.

Apparently I don't.  And its not well covered in the cheat sheet.

If you want the most recent BOSL2 it can be found at:

https://github.com/BelfrySCAD/BOSL2

Thank you.

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

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 6/26/25 06:20, Adrian Mariano via Discuss wrote: > The installation instructions on the github page explain how to set your > library path. Got it there,  looks ok. > > On Thu, Jun 26, 2025 at 1:49 AM gene heskett via Discuss < > discuss@lists.openscad.org> wrote: > >> On 6/25/25 21:07, Adrian Mariano via Discuss wrote: >>> The example I posted does not require a recent copy of BOSL2, so your >>> issues may depend on installation issues, but you didn't post the error >>> messages so that makes a more detailed diagnosis impossible. You should >> be >>> able to include BOSL2 without needing the full path if you have your >>> library path set up correctly. >> Apparently I don't. And its not well covered in the cheat sheet. >>> If you want the most recent BOSL2 it can be found at: >>> >>> https://github.com/BelfrySCAD/BOSL2 >> Thank you. >> >> 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 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
L
larry
Thu, Jun 26, 2025 2:11 PM

On Thu, 2025-06-26 at 09:38 -0400, gene heskett via Discuss wrote:

On 6/26/25 06:20, Adrian Mariano via Discuss wrote:

The installation instructions on the github page explain how to set your
library path.

Got it there,  looks ok.

include <BOSL2/std.scad>
include <BOSL2/threading.scad>
$fn= $preview ? 60 : 180;

module test() {
difference() {
cylinder(h=50, d=16, $fn=150);
up(1.5) cylinder(h=32.5, d=12);

up(30) threaded_rod(d=12, l=47, pitch=2,

internal=false,bevel=0.5);
}
}

test();

On Thu, Jun 26, 2025 at 1:49 AM gene heskett via Discuss <
discuss@lists.openscad.org> wrote:

On 6/25/25 21:07, Adrian Mariano via Discuss wrote:

The example I posted does not require a recent copy of BOSL2, so your
issues may depend on installation issues, but you didn't post the error
messages so that makes a more detailed diagnosis impossible. You should

be

able to include BOSL2 without needing the full path if you have your
library path set up correctly.

Apparently I don't.  And its not well covered in the cheat sheet.

If you want the most recent BOSL2 it can be found at:

https://github.com/BelfrySCAD/BOSL2

Thank you.

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

Cheers, Gene Heskett, CET.

On Thu, 2025-06-26 at 09:38 -0400, gene heskett via Discuss wrote: > On 6/26/25 06:20, Adrian Mariano via Discuss wrote: > > The installation instructions on the github page explain how to set your > > library path. > Got it there,  looks ok. > include <BOSL2/std.scad> include <BOSL2/threading.scad> $fn= $preview ? 60 : 180; module test() { difference() { cylinder(h=50, d=16, $fn=150); up(1.5) cylinder(h=32.5, d=12); # up(30) threaded_rod(d=12, l=47, pitch=2, internal=false,bevel=0.5); } } test(); > > On Thu, Jun 26, 2025 at 1:49 AM gene heskett via Discuss < > > discuss@lists.openscad.org> wrote: > > > > > On 6/25/25 21:07, Adrian Mariano via Discuss wrote: > > > > The example I posted does not require a recent copy of BOSL2, so your > > > > issues may depend on installation issues, but you didn't post the error > > > > messages so that makes a more detailed diagnosis impossible. You should > > > be > > > > able to include BOSL2 without needing the full path if you have your > > > > library path set up correctly. > > > Apparently I don't. And its not well covered in the cheat sheet. > > > > If you want the most recent BOSL2 it can be found at: > > > > > > > > https://github.com/BelfrySCAD/BOSL2 > > > Thank you. > > > > > > 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 > > Cheers, Gene Heskett, CET.
RS
Robbie Sandberg
Thu, Jun 26, 2025 4:07 PM

I tried subtracting half the rod’s length from the length of the tube, just on the off-chance that the rod is centered. However, as I said, this produced a rim at the top and the thread began about 2 millimetres down from the top. No idea why.

So I’ve added 2 millimetres to the translation and now it works.

Of course I can remember to always ad 2 millimetres in future, but I would prefer to understand how exactly threaded_rod works. Can someone suggest a decent documentation?

BTW: The anchor parameter produced the following error message:
Assertion '(found != [])' failed: "Unknown anchor: bottom"

Cheers! Robbie

From: Adrian Mariano via Discuss discuss@lists.openscad.org
Sent: Wednesday, June 25, 2025 10:39 PM
To: OpenSCAD general discussion Mailing-list discuss@lists.openscad.org
Cc: Adrian Mariano avm4@cornell.edu
Subject: [OpenSCAD] Re: threaded_rod in BOSL2

As the subject says, it's a BOSL2 question, which is where threaded_rod is to be found.

The cylinder() module by default places the cylinder with its bottom on the XY plane.  You can use center=true to make it center. The BOSL2 commands by default center objects, so the threaded rod will be centered.  It may work better to combine this with cyl() which automatically centers for consistent behavior.  Note that you probably want internal=true if you're making a threaded hole.  Your model has a 50 unit tall cylinder, so its top is at z=50.  The top of the threaded rod, which has height 16, is at z=8.  Since you are beveling you will not want to follow Gene's advice to make it oversized.  You have a  but your threaded rod is only 16 units tall.  So you need to raise it by 50-8 units.  So like this:

difference() {
cylinder(h=50, d=16, $fn=150);
translate([0,0,1.5])
cylinder(h=32.5, d=12);
up(50-8)
threaded_rod(d=12, l=16, pitch=2, internal=true, bevel2=0.5, bevel1=0);
}

I took the bevel off the bottom because that works better.  Note that internal=true causes the bevels to reverse.  And you may want to go up by slightly more to ensure no issues with coplanar faces, but in this case I think it only matters in preview, which doesn't affect you.  By slightly more I mean 0.01 units.

The easier way to address this is with attachments.  That looks like this:

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

diff()
cyl(h=50,d=16, $fn=150){
up(1.5)attach(BOT,BOT,inside=true) cyl(h=32.5,d=12);
attach(TOP,TOP,inside=true)
threaded_rod(d=12, l=16, pitch=2, internal=true, bevel2=0.5, bevel1=0);
}

You can also in general explicitly anchor BOSL2 objects so you know where they are, e.g. with anchor=BOTTOM to put the bottom at the origin, or anchor=CENTER to center it at the origin.

On Wed, Jun 25, 2025 at 2:15 PM gene heskett via Discuss <discuss@lists.openscad.orgmailto:discuss@lists.openscad.org> wrote:
On 6/25/25 13:04, Robbie Sandberg via Discuss wrote:

Hi!
Can someone tell me the z-position of a threaded_rod in BOSL2 when it’s not translated?
I’m using it in a difference function to cut a thread out of a tube.

difference() {
cylinder(h=50, d=16, $fn=150);
translate([0,0,1.5])
cylinder(h=32.5, d=12);
translate([0,0,34])
threaded_rod(d=12, l=16, pitch=2, internal=false, bevel=0.5);
}

That should bring the top of the rod to the top of the tube, but it doesn’t. Instead the tube is closed at the top.
I also tried adding half the rod’s length to the translation, in case it’s originally centered. That produces an open tube, but with a rim at the top.

I should mention that I’m blind and can’t use the preview.
Any advice is welcome.

That is a limitation I don't have, but what I do in such a case is make
the threaded rod I'm using for a difference, enough longer that both
ends project beyond the length of the item its being differenced out of.
Unfortunately I don't see the code for "threaded_rod()" so I can't test
it  Can that be posted?l

Cheers! Robbie


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.orgmailto: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.orgmailto:discuss-leave@lists.openscad.org

I tried subtracting half the rod’s length from the length of the tube, just on the off-chance that the rod is centered. However, as I said, this produced a rim at the top and the thread began about 2 millimetres down from the top. No idea why. So I’ve added 2 millimetres to the translation and now it works. Of course I can remember to always ad 2 millimetres in future, but I would prefer to understand how exactly threaded_rod works. Can someone suggest a decent documentation? BTW: The anchor parameter produced the following error message: Assertion '(found != [])' failed: "Unknown anchor: bottom" Cheers! Robbie From: Adrian Mariano via Discuss <discuss@lists.openscad.org> Sent: Wednesday, June 25, 2025 10:39 PM To: OpenSCAD general discussion Mailing-list <discuss@lists.openscad.org> Cc: Adrian Mariano <avm4@cornell.edu> Subject: [OpenSCAD] Re: threaded_rod in BOSL2 As the subject says, it's a BOSL2 question, which is where threaded_rod is to be found. The cylinder() module by default places the cylinder with its bottom on the XY plane. You can use center=true to make it center. The BOSL2 commands by default center objects, so the threaded rod will be centered. It may work better to combine this with cyl() which automatically centers for consistent behavior. Note that you probably want internal=true if you're making a threaded hole. Your model has a 50 unit tall cylinder, so its top is at z=50. The top of the threaded rod, which has height 16, is at z=8. Since you are beveling you will not want to follow Gene's advice to make it oversized. You have a but your threaded rod is only 16 units tall. So you need to raise it by 50-8 units. So like this: difference() { cylinder(h=50, d=16, $fn=150); translate([0,0,1.5]) cylinder(h=32.5, d=12); up(50-8) threaded_rod(d=12, l=16, pitch=2, internal=true, bevel2=0.5, bevel1=0); } I took the bevel off the bottom because that works better. Note that internal=true causes the bevels to reverse. And you may want to go up by slightly more to ensure no issues with coplanar faces, but in this case I think it only matters in preview, which doesn't affect you. By slightly more I mean 0.01 units. The easier way to address this is with attachments. That looks like this: include<BOSL2/std.scad> include<BOSL2/threading.scad> diff() cyl(h=50,d=16, $fn=150){ up(1.5)attach(BOT,BOT,inside=true) cyl(h=32.5,d=12); attach(TOP,TOP,inside=true) threaded_rod(d=12, l=16, pitch=2, internal=true, bevel2=0.5, bevel1=0); } You can also in general explicitly anchor BOSL2 objects so you know where they are, e.g. with anchor=BOTTOM to put the bottom at the origin, or anchor=CENTER to center it at the origin. On Wed, Jun 25, 2025 at 2:15 PM gene heskett via Discuss <discuss@lists.openscad.org<mailto:discuss@lists.openscad.org>> wrote: On 6/25/25 13:04, Robbie Sandberg via Discuss wrote: > Hi! > Can someone tell me the z-position of a threaded_rod in BOSL2 when it’s not translated? > I’m using it in a difference function to cut a thread out of a tube. > > difference() { > cylinder(h=50, d=16, $fn=150); > translate([0,0,1.5]) > cylinder(h=32.5, d=12); > translate([0,0,34]) > threaded_rod(d=12, l=16, pitch=2, internal=false, bevel=0.5); > } > > That should bring the top of the rod to the top of the tube, but it doesn’t. Instead the tube is closed at the top. > I also tried adding half the rod’s length to the translation, in case it’s originally centered. That produces an open tube, but with a rim at the top. > > I should mention that I’m blind and can’t use the preview. > Any advice is welcome. That is a limitation I don't have, but what I do in such a case is make the threaded rod I'm using for a difference, enough longer that both ends project beyond the length of the item its being differenced out of. Unfortunately I don't see the code for "threaded_rod()" so I can't test it Can that be posted?l > > Cheers! Robbie > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org<mailto: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<mailto:discuss-leave@lists.openscad.org>
JB
Jordan Brown
Thu, Jun 26, 2025 4:43 PM

One very simple trick for installing and maintaining BOSL2 is to use git.

Use "git clone" to create a BOSL2 repository in your OpenSCAD library
directory, cloned from https://github.com/BelfrySCAD/BOSL2.git .

Use "git pull" to update it.

In Windows, but the same principle applies everywhere:

C:\Users\Jordan\OneDrive\Documents\OpenSCAD\libraries>git clone https://github.com/BelfrySCAD/BOSL2.git
Cloning into 'BOSL2'...
remote: Enumerating objects: 17897, done.
remote: Counting objects: 100% (395/395), done.
remote: Compressing objects: 100% (124/124), done.
remote: Total 17897 (delta 316), reused 302 (delta 271), pack-reused 17502 (fromReceiving objects: 100% (17897/17897), 25.26 MiB | 9.93 MiB/s, done.

Resolving deltas: 100% (11991/11991), done.

Voilà, a BOSL2 install in the right place for standard "include
<BOSL2/std.scad>" references to find it.  Here I put it in my personal
library directory, but the same principle would apply to putting it into
the system-wide library directory.

Update is similar.  Here I've reverted to my previous BOSL2 installation
so that there's something to update.  I've elided long and uninteresting
lists of files updated.

C:\Users\Jordan\OneDrive\Documents\OpenSCAD\libraries>cd BOSL2

C:\Users\Jordan\OneDrive\Documents\OpenSCAD\libraries\BOSL2>git pull
remote: Enumerating objects: 471, done.
remote: Counting objects: 100% (116/116), done.
remote: Compressing objects: 100% (77/77), done.
remote: Total 471 (delta 62), reused 69 (delta 39), pack-reused 355 (from 2)ReceReceiving objects: 100% (471/471), 4.42 MiB | 6.12 MiB/s, done.

Resolving deltas: 100% (252/252), completed with 2 local objects.
From https://github.com/revarbat/BOSL2
   acd46acd..b6eaf4c6  master       -> origin/master
   fe39bfc2..f2f6ec78  revarbat_dev -> origin/revarbat_dev
Updating acd46acd..b6eaf4c6
Fast-forward
 .github/workflows/gen_docs.yml               |    2 +-
 .github/workflows/gen_tutorials.yml          |    2 +-
 .github/workflows/main.yml                   |    4 +-
 README.md                                    |    9 +-
 attachments.scad                             |  422 +++--
[...]
 vnf.scad                                     |   78 +-
 40 files changed, 4253 insertions(+), 2827 deletions(-)
 create mode 100644 examples/worldmap_360x180.scad
[...]
 delete mode 100644 tutorials/Attachments.md

You do have to get a working git installation, but that seems to be a
solved problem.

One very simple trick for installing and maintaining BOSL2 is to use git. Use "git clone" to create a BOSL2 repository in your OpenSCAD library directory, cloned from https://github.com/BelfrySCAD/BOSL2.git . Use "git pull" to update it. In Windows, but the same principle applies everywhere: C:\Users\Jordan\OneDrive\Documents\OpenSCAD\libraries>git clone https://github.com/BelfrySCAD/BOSL2.git Cloning into 'BOSL2'... remote: Enumerating objects: 17897, done. remote: Counting objects: 100% (395/395), done. remote: Compressing objects: 100% (124/124), done. remote: Total 17897 (delta 316), reused 302 (delta 271), pack-reused 17502 (fromReceiving objects: 100% (17897/17897), 25.26 MiB | 9.93 MiB/s, done. Resolving deltas: 100% (11991/11991), done. Voilà, a BOSL2 install in the right place for standard "include <BOSL2/std.scad>" references to find it.  Here I put it in my personal library directory, but the same principle would apply to putting it into the system-wide library directory. Update is similar.  Here I've reverted to my previous BOSL2 installation so that there's something to update.  I've elided long and uninteresting lists of files updated. C:\Users\Jordan\OneDrive\Documents\OpenSCAD\libraries>cd BOSL2 C:\Users\Jordan\OneDrive\Documents\OpenSCAD\libraries\BOSL2>git pull remote: Enumerating objects: 471, done. remote: Counting objects: 100% (116/116), done. remote: Compressing objects: 100% (77/77), done. remote: Total 471 (delta 62), reused 69 (delta 39), pack-reused 355 (from 2)ReceReceiving objects: 100% (471/471), 4.42 MiB | 6.12 MiB/s, done. Resolving deltas: 100% (252/252), completed with 2 local objects. From https://github.com/revarbat/BOSL2 acd46acd..b6eaf4c6 master -> origin/master fe39bfc2..f2f6ec78 revarbat_dev -> origin/revarbat_dev Updating acd46acd..b6eaf4c6 Fast-forward .github/workflows/gen_docs.yml | 2 +- .github/workflows/gen_tutorials.yml | 2 +- .github/workflows/main.yml | 4 +- README.md | 9 +- attachments.scad | 422 +++-- [...] vnf.scad | 78 +- 40 files changed, 4253 insertions(+), 2827 deletions(-) create mode 100644 examples/worldmap_360x180.scad [...] delete mode 100644 tutorials/Attachments.md You do have to get a working git installation, but that seems to be a solved problem.
JB
Jordan Brown
Thu, Jun 26, 2025 4:48 PM

On 6/26/2025 9:07 AM, Robbie Sandberg via Discuss wrote:

BTW: The anchor parameter produced the following error message:

Assertion '(found != [])' failed: "Unknown anchor: bottom"

Built-in anchor names like "bottom" are symbolic constants, not
strings.  Thus you need BOTTOM in all capitals with no quotes, not
"bottom" in lower case with quotes.

Here's a trivial example using cuboid to keep the complexity down; the
same principle applies to all BOSL2 objects:

include <BOSL2/std.scad>

cuboid(10, anchor=BOTTOM);
On 6/26/2025 9:07 AM, Robbie Sandberg via Discuss wrote: > > BTW: The anchor parameter produced the following error message: > > Assertion '(found != [])' failed: "Unknown anchor: bottom" > Built-in anchor names like "bottom" are symbolic constants, not strings.  Thus you need BOTTOM in all capitals with no quotes, not "bottom" in lower case with quotes. Here's a trivial example using cuboid to keep the complexity down; the same principle applies to all BOSL2 objects: include <BOSL2/std.scad> cuboid(10, anchor=BOTTOM);
AM
Adrian Mariano
Thu, Jun 26, 2025 8:30 PM

Robbie,

The documentation for threaded_rod is here:

https://github.com/BelfrySCAD/BOSL2/wiki/threading.scad#module-threaded_rod

You have specified a beveled threaded rod.  A beveled threaded rod has a
bevel on the end, which means the ends taper inward.  If you subtract that
from an object you will get a rim at the top as you have observed.  You
need to set internal=true for internal threads like you're making.  This
will flip the bevel direction so it goes outward, which gives the right
result when you subtract the threaded rod from the object.  As in my
previous post, you will get a better result if you set bevel1=0 because of
how it works with your model, because the bottom of the threaded rod is not
the other face of an object.

As Jordan noted, the anchor constants (all constants in BOSL2) are in all
caps, and there are no quotes.  So the anchors are things like BOTTOM (all
caps, no quotes), or TOP, or BOTTOM+RIGHT.    The documentation for BOSL2
is quite extensive, though it relies heavily on visual examples so I'm not
sure how accessible you will find it.

On Thu, Jun 26, 2025 at 12:08 PM Robbie Sandberg via Discuss <
discuss@lists.openscad.org> wrote:

I tried subtracting half the rod’s length from the length of the tube,
just on the off-chance that the rod is centered. However, as I said, this
produced a rim at the top and the thread began about 2 millimetres down
from the top. No idea why.

So I’ve added 2 millimetres to the translation and now it works.

Of course I can remember to always ad 2 millimetres in future, but I would
prefer to understand how exactly threaded_rod works. Can someone suggest a
decent documentation?

BTW: The anchor parameter produced the following error message:

Assertion '(found != [])' failed: "Unknown anchor: bottom"

Cheers! Robbie

From: Adrian Mariano via Discuss discuss@lists.openscad.org
Sent: Wednesday, June 25, 2025 10:39 PM
To: OpenSCAD general discussion Mailing-list <discuss@lists.openscad.org

Cc: Adrian Mariano avm4@cornell.edu
Subject: [OpenSCAD] Re: threaded_rod in BOSL2

As the subject says, it's a BOSL2 question, which is where threaded_rod is
to be found.

The cylinder() module by default places the cylinder with its bottom on
the XY plane.  You can use center=true to make it center. The BOSL2
commands by default center objects, so the threaded rod will be centered.
It may work better to combine this with cyl() which automatically centers
for consistent behavior.  Note that you probably want internal=true if
you're making a threaded hole.  Your model has a 50 unit tall cylinder, so
its top is at z=50.  The top of the threaded rod, which has height 16, is
at z=8.  Since you are beveling you will not want to follow Gene's advice
to make it oversized.  You have a  but your threaded rod is only 16 units
tall.  So you need to raise it by 50-8 units.  So like this:

difference() {
cylinder(h=50, d=16, $fn=150);
translate([0,0,1.5])
cylinder(h=32.5, d=12);
up(50-8)
threaded_rod(d=12, l=16, pitch=2, internal=true, bevel2=0.5, bevel1=0);
}

I took the bevel off the bottom because that works better.  Note that
internal=true causes the bevels to reverse.  And you may want to go up by
slightly more to ensure no issues with coplanar faces, but in this case I
think it only matters in preview, which doesn't affect you.  By slightly
more I mean 0.01 units.

The easier way to address this is with attachments.  That looks like this:

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

diff()
cyl(h=50,d=16, $fn=150){
up(1.5)attach(BOT,BOT,inside=true) cyl(h=32.5,d=12);
attach(TOP,TOP,inside=true)
threaded_rod(d=12, l=16, pitch=2, internal=true, bevel2=0.5,
bevel1=0);
}

You can also in general explicitly anchor BOSL2 objects so you know where
they are, e.g. with anchor=BOTTOM to put the bottom at the origin, or
anchor=CENTER to center it at the origin.

On Wed, Jun 25, 2025 at 2:15 PM gene heskett via Discuss <
discuss@lists.openscad.org> wrote:

On 6/25/25 13:04, Robbie Sandberg via Discuss wrote:

Hi!
Can someone tell me the z-position of a threaded_rod in BOSL2 when it’s

not translated?

I’m using it in a difference function to cut a thread out of a tube.

difference() {
cylinder(h=50, d=16, $fn=150);
translate([0,0,1.5])
cylinder(h=32.5, d=12);
translate([0,0,34])
threaded_rod(d=12, l=16, pitch=2, internal=false, bevel=0.5);
}

That should bring the top of the rod to the top of the tube, but it

doesn’t. Instead the tube is closed at the top.

I also tried adding half the rod’s length to the translation, in case

it’s originally centered. That produces an open tube, but with a rim at the
top.

I should mention that I’m blind and can’t use the preview.
Any advice is welcome.

That is a limitation I don't have, but what I do in such a case is make
the threaded rod I'm using for a difference, enough longer that both
ends project beyond the length of the item its being differenced out of.
Unfortunately I don't see the code for "threaded_rod()" so I can't test
it  Can that be posted?l

Cheers! Robbie


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

Robbie, The documentation for threaded_rod is here: https://github.com/BelfrySCAD/BOSL2/wiki/threading.scad#module-threaded_rod You have specified a beveled threaded rod. A beveled threaded rod has a bevel on the end, which means the ends taper inward. If you subtract that from an object you will get a rim at the top as you have observed. You need to set internal=true for internal threads like you're making. This will flip the bevel direction so it goes outward, which gives the right result when you subtract the threaded rod from the object. As in my previous post, you will get a better result if you set bevel1=0 because of how it works with your model, because the bottom of the threaded rod is not the other face of an object. As Jordan noted, the anchor constants (all constants in BOSL2) are in all caps, and there are no quotes. So the anchors are things like BOTTOM (all caps, no quotes), or TOP, or BOTTOM+RIGHT. The documentation for BOSL2 is quite extensive, though it relies heavily on visual examples so I'm not sure how accessible you will find it. On Thu, Jun 26, 2025 at 12:08 PM Robbie Sandberg via Discuss < discuss@lists.openscad.org> wrote: > I tried subtracting half the rod’s length from the length of the tube, > just on the off-chance that the rod is centered. However, as I said, this > produced a rim at the top and the thread began about 2 millimetres down > from the top. No idea why. > > > > So I’ve added 2 millimetres to the translation and now it works. > > > > Of course I can remember to always ad 2 millimetres in future, but I would > prefer to understand how exactly threaded_rod works. Can someone suggest a > decent documentation? > > > > BTW: The anchor parameter produced the following error message: > > Assertion '(found != [])' failed: "Unknown anchor: bottom" > > > > > > Cheers! Robbie > > > > *From:* Adrian Mariano via Discuss <discuss@lists.openscad.org> > *Sent:* Wednesday, June 25, 2025 10:39 PM > *To:* OpenSCAD general discussion Mailing-list <discuss@lists.openscad.org > > > *Cc:* Adrian Mariano <avm4@cornell.edu> > *Subject:* [OpenSCAD] Re: threaded_rod in BOSL2 > > > > As the subject says, it's a BOSL2 question, which is where threaded_rod is > to be found. > > > > The cylinder() module by default places the cylinder with its bottom on > the XY plane. You can use center=true to make it center. The BOSL2 > commands by default center objects, so the threaded rod will be centered. > It may work better to combine this with cyl() which automatically centers > for consistent behavior. Note that you probably want internal=true if > you're making a threaded hole. Your model has a 50 unit tall cylinder, so > its top is at z=50. The top of the threaded rod, which has height 16, is > at z=8. Since you are beveling you will not want to follow Gene's advice > to make it oversized. You have a but your threaded rod is only 16 units > tall. So you need to raise it by 50-8 units. So like this: > > > > difference() { > cylinder(h=50, d=16, $fn=150); > translate([0,0,1.5]) > cylinder(h=32.5, d=12); > up(50-8) > threaded_rod(d=12, l=16, pitch=2, internal=true, bevel2=0.5, bevel1=0); > } > > > > I took the bevel off the bottom because that works better. Note that > internal=true causes the bevels to reverse. And you may want to go up by > slightly more to ensure no issues with coplanar faces, but in this case I > think it only matters in preview, which doesn't affect you. By slightly > more I mean 0.01 units. > > > > The easier way to address this is with attachments. That looks like this: > > > > include<BOSL2/std.scad> > include<BOSL2/threading.scad> > > diff() > cyl(h=50,d=16, $fn=150){ > up(1.5)attach(BOT,BOT,inside=true) cyl(h=32.5,d=12); > attach(TOP,TOP,inside=true) > threaded_rod(d=12, l=16, pitch=2, internal=true, bevel2=0.5, > bevel1=0); > } > > > > You can also in general explicitly anchor BOSL2 objects so you know where > they are, e.g. with anchor=BOTTOM to put the bottom at the origin, or > anchor=CENTER to center it at the origin. > > > > > > On Wed, Jun 25, 2025 at 2:15 PM gene heskett via Discuss < > discuss@lists.openscad.org> wrote: > > On 6/25/25 13:04, Robbie Sandberg via Discuss wrote: > > Hi! > > Can someone tell me the z-position of a threaded_rod in BOSL2 when it’s > not translated? > > I’m using it in a difference function to cut a thread out of a tube. > > > > difference() { > > cylinder(h=50, d=16, $fn=150); > > translate([0,0,1.5]) > > cylinder(h=32.5, d=12); > > translate([0,0,34]) > > threaded_rod(d=12, l=16, pitch=2, internal=false, bevel=0.5); > > } > > > > That should bring the top of the rod to the top of the tube, but it > doesn’t. Instead the tube is closed at the top. > > I also tried adding half the rod’s length to the translation, in case > it’s originally centered. That produces an open tube, but with a rim at the > top. > > > > I should mention that I’m blind and can’t use the preview. > > Any advice is welcome. > That is a limitation I don't have, but what I do in such a case is make > the threaded rod I'm using for a difference, enough longer that both > ends project beyond the length of the item its being differenced out of. > Unfortunately I don't see the code for "threaded_rod()" so I can't test > it Can that be posted?l > > > > Cheers! Robbie > > _______________________________________________ > > 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 >