discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

My BOSL2 install

GH
gene heskett
Thu, Jun 26, 2025 1:32 PM

I have now unpacked yesterdays BOSL2-master.zip and removed the older
versions from /home/gene/.local/share/OpenSCAD/libraries,

then copied the unpacked BOSL2-master.zip's contents to the above
libraries path as BOSL2, so all files there are now dated today.

Then I re-arranged the file from the original post, and wrapped it as a
"module test();"

So it now looks like this:

module test(); {     include
</home/gene/.local/share/OpenSCAD/libraries/BOSL2/std.scad>     include
</home/gene/.local/share/OpenSCAD/libraries/BOSL2/threading.scad>    
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); } test();

But I am still getting this error for an F5:

Parsing design (AST generation)...

Saved backup file:
/home/gene/.local/share/OpenSCAD/backups/unsaved-backup-aoYvNDoJ.scad

ERROR: Parser error: syntax error in file
.local/share/OpenSCAD/libraries/BOSL2/color.scad, line 14

Execution aborted

With the editor marking the > in red at the end of line 3.

So obviously I am doing something wrong yet, but what? That is (I think)
a valid full path to the libraries.

Problems like this have plagued every attempt I have made to use BOSL2
for the years I've been trying to use bookworm (up to date a/o this past
Sunday) as my daily driver. This install is busted, and its probably
been reinstalled 30+ times because the original installer thought I was
blind and installed orca and brltty with every install and by the time I
had gotten rid of orca and brltty, it was not rebootable without a full
reinstall bdecause it waited forever for orca to come online. I have
finally managed to put a muffler on orca, but for the last 2 years have
been plagued by a 30 second system lockup anytime something asks to run
a gui-fied file selector. Or other similar operations. I cannot use the
best photo manager as it won't wait for that timeout, shotwell does wait
then handles my photo work nicely, so I'm not totally crippled. gimp
waits, runs fine after the wait. And folks on the debian list where I've
been a legendary pain in the a$$ about this haven't a clue what might be
wrong. If trixie doesn't fix it, I'm off to xubuntu, after nearlly 20
years on debian because LinuxCNC is built to run on debian, and I carve
both metal and wood with it on 4 CNC'd machines here, but then I'll have
to figure out how to run this stuff on ubuntu.

LinuxCNC has to have at a minimum of a preempt-rt kernel.

Not your problem, IRQ latency's under 50 u-secs, even on the rpi4b that
runs my 11x54 sheldon lathe, just background requirements here.

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
I have now unpacked yesterdays BOSL2-master.zip and removed the older versions from /home/gene/.local/share/OpenSCAD/libraries, then copied the unpacked BOSL2-master.zip's contents to the above libraries path as BOSL2, so all files there are now dated today. Then I re-arranged the file from the original post, and wrapped it as a "module test();" So it now looks like this: module test(); {     include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/std.scad>     include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/threading.scad>     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); } test(); But I am still getting this error for an F5: Parsing design (AST generation)... Saved backup file: /home/gene/.local/share/OpenSCAD/backups/unsaved-backup-aoYvNDoJ.scad ERROR: Parser error: syntax error in file .local/share/OpenSCAD/libraries/BOSL2/color.scad, line 14 Execution aborted With the editor marking the > in red at the end of line 3. So obviously I am doing something wrong yet, but what? That is (I think) a valid full path to the libraries. Problems like this have plagued every attempt I have made to use BOSL2 for the years I've been trying to use bookworm (up to date a/o this past Sunday) as my daily driver. This install is busted, and its probably been reinstalled 30+ times because the original installer thought I was blind and installed orca and brltty with every install and by the time I had gotten rid of orca and brltty, it was not rebootable without a full reinstall bdecause it waited forever for orca to come online. I have finally managed to put a muffler on orca, but for the last 2 years have been plagued by a 30 second system lockup anytime something asks to run a gui-fied file selector. Or other similar operations. I cannot use the best photo manager as it won't wait for that timeout, shotwell does wait then handles my photo work nicely, so I'm not totally crippled. gimp waits, runs fine after the wait. And folks on the debian list where I've been a legendary pain in the a$$ about this haven't a clue what might be wrong. If trixie doesn't fix it, I'm off to xubuntu, after nearlly 20 years on debian because LinuxCNC is built to run on debian, and I carve both metal and wood with it on 4 CNC'd machines here, but then I'll have to figure out how to run this stuff on ubuntu. LinuxCNC has to have at a minimum of a preempt-rt kernel. Not your problem, IRQ latency's under 50 u-secs, even on the rpi4b that runs my 11x54 sheldon lathe, just background requirements here. 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
LM
Leonard Martin Struttmann
Thu, Jun 26, 2025 3:03 PM

Gene,

Try moving the include statements above (outside) of the module definition.

Len

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

I have now unpacked yesterdays BOSL2-master.zip and removed the older
versions from /home/gene/.local/share/OpenSCAD/libraries,

then copied the unpacked BOSL2-master.zip's contents to the above
libraries path as BOSL2, so all files there are now dated today.

Then I re-arranged the file from the original post, and wrapped it as a
"module test();"

So it now looks like this:

module test(); {    include
</home/gene/.local/share/OpenSCAD/libraries/BOSL2/std.scad>    include
</home/gene/.local/share/OpenSCAD/libraries/BOSL2/threading.scad>
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); } test();

But I am still getting this error for an F5:

Parsing design (AST generation)...

Saved backup file:
/home/gene/.local/share/OpenSCAD/backups/unsaved-backup-aoYvNDoJ.scad

ERROR: Parser error: syntax error in file
.local/share/OpenSCAD/libraries/BOSL2/color.scad, line 14

Execution aborted

With the editor marking the > in red at the end of line 3.

So obviously I am doing something wrong yet, but what? That is (I think)
a valid full path to the libraries.

Problems like this have plagued every attempt I have made to use BOSL2
for the years I've been trying to use bookworm (up to date a/o this past
Sunday) as my daily driver. This install is busted, and its probably
been reinstalled 30+ times because the original installer thought I was
blind and installed orca and brltty with every install and by the time I
had gotten rid of orca and brltty, it was not rebootable without a full
reinstall bdecause it waited forever for orca to come online. I have
finally managed to put a muffler on orca, but for the last 2 years have
been plagued by a 30 second system lockup anytime something asks to run
a gui-fied file selector. Or other similar operations. I cannot use the
best photo manager as it won't wait for that timeout, shotwell does wait
then handles my photo work nicely, so I'm not totally crippled. gimp
waits, runs fine after the wait. And folks on the debian list where I've
been a legendary pain in the a$$ about this haven't a clue what might be
wrong. If trixie doesn't fix it, I'm off to xubuntu, after nearlly 20
years on debian because LinuxCNC is built to run on debian, and I carve
both metal and wood with it on 4 CNC'd machines here, but then I'll have
to figure out how to run this stuff on ubuntu.

LinuxCNC has to have at a minimum of a preempt-rt kernel.

Not your problem, IRQ latency's under 50 u-secs, even on the rpi4b that
runs my 11x54 sheldon lathe, just background requirements here.

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

Gene, Try moving the include statements above (outside) of the module definition. Len On Thu, Jun 26, 2025 at 8:32 AM gene heskett via Discuss < discuss@lists.openscad.org> wrote: > I have now unpacked yesterdays BOSL2-master.zip and removed the older > versions from /home/gene/.local/share/OpenSCAD/libraries, > > then copied the unpacked BOSL2-master.zip's contents to the above > libraries path as BOSL2, so all files there are now dated today. > > Then I re-arranged the file from the original post, and wrapped it as a > "module test();" > > So it now looks like this: > > module test(); { include > </home/gene/.local/share/OpenSCAD/libraries/BOSL2/std.scad> include > </home/gene/.local/share/OpenSCAD/libraries/BOSL2/threading.scad> > 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); } test(); > > But I am still getting this error for an F5: > > Parsing design (AST generation)... > > Saved backup file: > /home/gene/.local/share/OpenSCAD/backups/unsaved-backup-aoYvNDoJ.scad > > ERROR: Parser error: syntax error in file > .local/share/OpenSCAD/libraries/BOSL2/color.scad, line 14 > > Execution aborted > > With the editor marking the > in red at the end of line 3. > > So obviously I am doing something wrong yet, but what? That is (I think) > a valid full path to the libraries. > > Problems like this have plagued every attempt I have made to use BOSL2 > for the years I've been trying to use bookworm (up to date a/o this past > Sunday) as my daily driver. This install is busted, and its probably > been reinstalled 30+ times because the original installer thought I was > blind and installed orca and brltty with every install and by the time I > had gotten rid of orca and brltty, it was not rebootable without a full > reinstall bdecause it waited forever for orca to come online. I have > finally managed to put a muffler on orca, but for the last 2 years have > been plagued by a 30 second system lockup anytime something asks to run > a gui-fied file selector. Or other similar operations. I cannot use the > best photo manager as it won't wait for that timeout, shotwell does wait > then handles my photo work nicely, so I'm not totally crippled. gimp > waits, runs fine after the wait. And folks on the debian list where I've > been a legendary pain in the a$$ about this haven't a clue what might be > wrong. If trixie doesn't fix it, I'm off to xubuntu, after nearlly 20 > years on debian because LinuxCNC is built to run on debian, and I carve > both metal and wood with it on 4 CNC'd machines here, but then I'll have > to figure out how to run this stuff on ubuntu. > > LinuxCNC has to have at a minimum of a preempt-rt kernel. > > Not your problem, IRQ latency's under 50 u-secs, even on the rpi4b that > runs my 11x54 sheldon lathe, just background requirements here. > > 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 3:48 PM

On 6/26/25 09:32, gene heskett via Discuss wrote:

I have now unpacked yesterdays BOSL2-master.zip and removed the older
versions from /home/gene/.local/share/OpenSCAD/libraries,

then copied the unpacked BOSL2-master.zip's contents to the above
libraries path as BOSL2, so all files there are now dated today.

Then I re-arranged the file from the original post, and wrapped it as
a "module test();"

So it now looks like this:

module test(); {     include
</home/gene/.local/share/OpenSCAD/libraries/BOSL2/std.scad>    
include
</home/gene/.local/share/OpenSCAD/libraries/BOSL2/threading.scad>    
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); } test();

And the formatting has been totally removed.  WTF?????

But I am still getting this error for an F5:

Parsing design (AST generation)...

Saved backup file:
/home/gene/.local/share/OpenSCAD/backups/unsaved-backup-aoYvNDoJ.scad

ERROR: Parser error: syntax error in file
.local/share/OpenSCAD/libraries/BOSL2/color.scad, line 14

Execution aborted

With the editor marking the > in red at the end of line 3.

So obviously I am doing something wrong yet, but what? That is (I
think) a valid full path to the libraries.

Problems like this have plagued every attempt I have made to use BOSL2
for the years I've been trying to use bookworm (up to date a/o this
past Sunday) as my daily driver. This install is busted, and its
probably been reinstalled 30+ times because the original installer
thought I was blind and installed orca and brltty with every install
and by the time I had gotten rid of orca and brltty, it was not
rebootable without a full reinstall bdecause it waited forever for
orca to come online. I have finally managed to put a muffler on orca,
but for the last 2 years have been plagued by a 30 second system
lockup anytime something asks to run a gui-fied file selector. Or
other similar operations. I cannot use the best photo manager as it
won't wait for that timeout, shotwell does wait then handles my photo
work nicely, so I'm not totally crippled. gimp waits, runs fine after
the wait. And folks on the debian list where I've been a legendary
pain in the a$$ about this haven't a clue what might be wrong. If
trixie doesn't fix it, I'm off to xubuntu, after nearlly 20 years on
debian because LinuxCNC is built to run on debian, and I carve both
metal and wood with it on 4 CNC'd machines here, but then I'll have to
figure out how to run this stuff on ubuntu.

LinuxCNC has to have at a minimum of a preempt-rt kernel.

Not your problem, IRQ latency's under 50 u-secs, even on the rpi4b
that runs my 11x54 sheldon lathe, just background requirements here.

Thank you.

Cheers, Gene Heskett, CET.

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 09:32, gene heskett via Discuss wrote: > I have now unpacked yesterdays BOSL2-master.zip and removed the older > versions from /home/gene/.local/share/OpenSCAD/libraries, > > then copied the unpacked BOSL2-master.zip's contents to the above > libraries path as BOSL2, so all files there are now dated today. > > Then I re-arranged the file from the original post, and wrapped it as > a "module test();" > > So it now looks like this: > > module test(); {     include > </home/gene/.local/share/OpenSCAD/libraries/BOSL2/std.scad>     > include > </home/gene/.local/share/OpenSCAD/libraries/BOSL2/threading.scad>     > 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); } test(); And the formatting has been totally removed.  WTF????? > But I am still getting this error for an F5: > > Parsing design (AST generation)... > > Saved backup file: > /home/gene/.local/share/OpenSCAD/backups/unsaved-backup-aoYvNDoJ.scad > > ERROR: Parser error: syntax error in file > .local/share/OpenSCAD/libraries/BOSL2/color.scad, line 14 > > Execution aborted > > With the editor marking the > in red at the end of line 3. > > So obviously I am doing something wrong yet, but what? That is (I > think) a valid full path to the libraries. > > Problems like this have plagued every attempt I have made to use BOSL2 > for the years I've been trying to use bookworm (up to date a/o this > past Sunday) as my daily driver. This install is busted, and its > probably been reinstalled 30+ times because the original installer > thought I was blind and installed orca and brltty with every install > and by the time I had gotten rid of orca and brltty, it was not > rebootable without a full reinstall bdecause it waited forever for > orca to come online. I have finally managed to put a muffler on orca, > but for the last 2 years have been plagued by a 30 second system > lockup anytime something asks to run a gui-fied file selector. Or > other similar operations. I cannot use the best photo manager as it > won't wait for that timeout, shotwell does wait then handles my photo > work nicely, so I'm not totally crippled. gimp waits, runs fine after > the wait. And folks on the debian list where I've been a legendary > pain in the a$$ about this haven't a clue what might be wrong. If > trixie doesn't fix it, I'm off to xubuntu, after nearlly 20 years on > debian because LinuxCNC is built to run on debian, and I carve both > metal and wood with it on 4 CNC'd machines here, but then I'll have to > figure out how to run this stuff on ubuntu. > > LinuxCNC has to have at a minimum of a preempt-rt kernel. > > Not your problem, IRQ latency's under 50 u-secs, even on the rpi4b > that runs my 11x54 sheldon lathe, just background requirements here. > > Thank you. > > Cheers, Gene Heskett, CET. 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
GH
gene heskett
Thu, Jun 26, 2025 4:37 PM

On 6/26/25 11:04, Leonard Martin Struttmann via Discuss wrote:

Gene,

Try moving the include statements above (outside) of the module definition.

Len

That worked, thank you. Is this a required rule?

But I had to modify both the z offset, and the length of the
threaded_rod by quite a bit to get it to project from the cylinder at
both ends, so that line now looks like this:

    #translate([0,0,25])threaded_rod(d=12, l=51, pitch=2,
internal=false, bevel=0.5);

And I don't believe I see any bevel.

Threading is limited to the top by the 2nd cylinder and a bit of Z
tweaking made it clean to the bottom of the hole.

I see now that the line above this one clears the bore below the threads
so the added length of threaded_rod is not needed. The correct Z
translation would work as the OP seems to have a good understanding of
but using exactly the same for both subtractions was part of he error.

So my version with the stretched rod looks like this:

include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/std.scad>
include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/threading.scad>
module test();
{
    difference()
    {
        cylinder(h=50, d=16, $fn=150);
        translate([0,0,0])cylinder(h=32.5, d=12);
        translate([0,0,25])threaded_rod(d=12, l=55, pitch=2,
internal=false, bevel=0.5);
    }
}
test();

I hope this helps, it sure has me.

[...]

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 11:04, Leonard Martin Struttmann via Discuss wrote: > Gene, > > Try moving the include statements above (outside) of the module definition. > > Len That worked, thank you. Is this a required rule? But I had to modify both the z offset, and the length of the threaded_rod by quite a bit to get it to project from the cylinder at both ends, so that line now looks like this:     #translate([0,0,25])threaded_rod(d=12, l=51, pitch=2, internal=false, bevel=0.5); And I don't believe I see any bevel. Threading is limited to the top by the 2nd cylinder and a bit of Z tweaking made it clean to the bottom of the hole. I see now that the line above this one clears the bore below the threads so the added length of threaded_rod is not needed. The correct Z translation would work as the OP seems to have a good understanding of but using exactly the same for both subtractions was part of he error. So my version with the stretched rod looks like this: include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/std.scad> include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/threading.scad> module test(); {     difference()     {         cylinder(h=50, d=16, $fn=150);         translate([0,0,0])cylinder(h=32.5, d=12);         translate([0,0,25])threaded_rod(d=12, l=55, pitch=2, internal=false, bevel=0.5);     } } test(); I hope this helps, it sure has me. [...] >> 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
LM
Leonard Martin Struttmann
Thu, Jun 26, 2025 4:58 PM

That worked, thank you. Is this a required rule?

In this case, yes.  The OpenSCAD docs say "use <filename> is allowed only
at the top level of a file."

...and BOLS2 color.scad contains a use statement:

color.scad:use <builtins.scad>

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

On 6/26/25 11:04, Leonard Martin Struttmann via Discuss wrote:

Gene,

Try moving the include statements above (outside) of the module

definition.

Len

That worked, thank you. Is this a required rule?

But I had to modify both the z offset, and the length of the
threaded_rod by quite a bit to get it to project from the cylinder at
both ends, so that line now looks like this:

  #translate([0,0,25])threaded_rod(d=12, l=51, pitch=2,

internal=false, bevel=0.5);

And I don't believe I see any bevel.

Threading is limited to the top by the 2nd cylinder and a bit of Z
tweaking made it clean to the bottom of the hole.

I see now that the line above this one clears the bore below the threads
so the added length of threaded_rod is not needed. The correct Z
translation would work as the OP seems to have a good understanding of
but using exactly the same for both subtractions was part of he error.

So my version with the stretched rod looks like this:

include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/std.scad>
include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/threading.scad>
module test();
{
difference()
{
cylinder(h=50, d=16, $fn=150);
translate([0,0,0])cylinder(h=32.5, d=12);
translate([0,0,25])threaded_rod(d=12, l=55, pitch=2,
internal=false, bevel=0.5);
}
}
test();

I hope this helps, it sure has me.

[...]

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

*That worked, thank you. Is this a required rule?* In this case, yes. The OpenSCAD docs say "use <*filename*> is allowed only at the top level of a file." ...and BOLS2 color.scad contains a use statement: color.scad:use <builtins.scad> On Thu, Jun 26, 2025 at 11:38 AM gene heskett via Discuss < discuss@lists.openscad.org> wrote: > On 6/26/25 11:04, Leonard Martin Struttmann via Discuss wrote: > > Gene, > > > > Try moving the include statements above (outside) of the module > definition. > > > > Len > > That worked, thank you. Is this a required rule? > > But I had to modify both the z offset, and the length of the > threaded_rod by quite a bit to get it to project from the cylinder at > both ends, so that line now looks like this: > > #translate([0,0,25])threaded_rod(d=12, l=51, pitch=2, > internal=false, bevel=0.5); > > And I don't believe I see any bevel. > > Threading is limited to the top by the 2nd cylinder and a bit of Z > tweaking made it clean to the bottom of the hole. > > I see now that the line above this one clears the bore below the threads > so the added length of threaded_rod is not needed. The correct Z > translation would work as the OP seems to have a good understanding of > but using exactly the same for both subtractions was part of he error. > > So my version with the stretched rod looks like this: > > include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/std.scad> > include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/threading.scad> > module test(); > { > difference() > { > cylinder(h=50, d=16, $fn=150); > translate([0,0,0])cylinder(h=32.5, d=12); > translate([0,0,25])threaded_rod(d=12, l=55, pitch=2, > internal=false, bevel=0.5); > } > } > test(); > > I hope this helps, it sure has me. > > [...] > > >> 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 >
JB
Jordan Brown
Thu, Jun 26, 2025 5:10 PM

On 6/26/2025 9:37 AM, gene heskett via Discuss wrote:

On 6/26/25 11:04, Leonard Martin Struttmann via Discuss wrote:

Try moving the include statements above (outside) of the module
definition.

That worked, thank you. Is this a required rule?

Mostly, yes.

The include directive copies the specified file into your program,
almost exactly as if you replaced the include with the text of the
file.  (There's a little bit of magic to allow overriding variables in
the same scope.)

Usually, you want a library to be at the top level.  Some constructs may
require it - in this case, a "use" that BOSL2 uses internally.

That's not the only problem.

Here's your original text.  I've reformatted it for readability, but
changed only the whitespace, not anything that actually changes the
semantics.

module test();
{
    include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/std.scad>
    include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/threading.scad>
    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);
}
test();

Reformatting like this makes a couple of things more obvious.

First is the semicolon after "module test()".  That makes the module be
empty.  The stuff in braces is some non-module stuff that's in what the
manual calls an "anonymous scope" which mostly isn't a scope at all.  An
anonymous scope mostly isn't a scope at all, but it's enough to make
"use" fail.

Second is that the difference() has only one child, so is kind of
boring.  I think it wants an open brace immediately after "difference()"
and a close brace after the call to threaded_rod().

So, going back to your original question, yes, libraries usually want
"include" or "use" at the top level.

There may be special cases where "include" might be useful at other points.

For instance, if you have a file that has a bunch of numbers separated
by commas, you could put it in an OpenSCAD array like so:

array = [
include <datafile.txt>
];

(Note:  this will not process general CSV.  The file must be valid
OpenSCAD syntax, which means commas between the elements, quotes around
strings, and so on.)

But these special cases are very much the exception.

For super extra fun, try this program.  Hint:  don't use "include" as a
variable name.

include = 2;
something = 5;
if (include < 3 && something > 4) {
    echo("surprise!");
}
On 6/26/2025 9:37 AM, gene heskett via Discuss wrote: > On 6/26/25 11:04, Leonard Martin Struttmann via Discuss wrote: >> Try moving the include statements above (outside) of the module >> definition. > That worked, thank you. Is this a required rule? Mostly, yes. The include directive copies the specified file into your program, almost exactly as if you replaced the include with the text of the file.  (There's a little bit of magic to allow overriding variables in the same scope.) Usually, you want a library to be at the top level.  Some constructs may require it - in this case, a "use" that BOSL2 uses internally. That's not the only problem. Here's your original text.  I've reformatted it for readability, but changed only the whitespace, not anything that actually changes the semantics. module test(); { include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/std.scad> include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/threading.scad> 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); } test(); Reformatting like this makes a couple of things more obvious. First is the semicolon after "module test()".  That makes the module be empty.  The stuff in braces is some non-module stuff that's in what the manual calls an "anonymous scope" which mostly isn't a scope at all.  An anonymous scope mostly isn't a scope at all, but it's enough to make "use" fail. Second is that the difference() has only one child, so is kind of boring.  I think it wants an open brace immediately after "difference()" and a close brace after the call to threaded_rod(). So, going back to your original question, yes, libraries usually want "include" or "use" at the top level. There may be special cases where "include" might be useful at other points. For instance, if you have a file that has a bunch of numbers separated by commas, you could put it in an OpenSCAD array like so: array = [ include <datafile.txt> ]; (Note:  this will *not* process general CSV.  The file must be valid OpenSCAD syntax, which means commas between the elements, quotes around strings, and so on.) But these special cases are very much the exception. For super extra fun, try this program.  Hint:  don't use "include" as a variable name. include = 2; something = 5; if (include < 3 && something > 4) { echo("surprise!"); }
HW
Harvey white
Thu, Jun 26, 2025 7:02 PM

The include provides definitions.  By putting the include inside the
functions that were included, the call to the functions doesn't know
where to find what to call.  Putting the include outside provides the
definitions of where to find the stuff you call.  All programming
languages (IIRC) need this kind of order.  Define it first, then call it.

Compilers hate surprises.

Harvey

On 6/26/2025 12:37 PM, gene heskett via Discuss wrote:

On 6/26/25 11:04, Leonard Martin Struttmann via Discuss wrote:

Gene,

Try moving the include statements above (outside) of the module
definition.

Len

That worked, thank you. Is this a required rule?

But I had to modify both the z offset, and the length of the
threaded_rod by quite a bit to get it to project from the cylinder at
both ends, so that line now looks like this:

    #translate([0,0,25])threaded_rod(d=12, l=51, pitch=2,
internal=false, bevel=0.5);

And I don't believe I see any bevel.

Threading is limited to the top by the 2nd cylinder and a bit of Z
tweaking made it clean to the bottom of the hole.

I see now that the line above this one clears the bore below the
threads so the added length of threaded_rod is not needed. The correct
Z translation would work as the OP seems to have a good understanding
of but using exactly the same for both subtractions was part of he error.

So my version with the stretched rod looks like this:

include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/std.scad>
include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/threading.scad>
module test();
{
    difference()
    {
        cylinder(h=50, d=16, $fn=150);
        translate([0,0,0])cylinder(h=32.5, d=12);
        translate([0,0,25])threaded_rod(d=12, l=55, pitch=2,
internal=false, bevel=0.5);
    }
}
test();

I hope this helps, it sure has me.

[...]

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

Cheers, Gene Heskett, CET.

The include provides definitions.  By putting the include *inside* the functions that were included, the call to the functions doesn't know where to find what to call.  Putting the include *outside* provides the definitions of where to find the stuff you call.  All programming languages (IIRC) need this kind of order.  Define it first, then call it. Compilers hate surprises. Harvey On 6/26/2025 12:37 PM, gene heskett via Discuss wrote: > On 6/26/25 11:04, Leonard Martin Struttmann via Discuss wrote: >> Gene, >> >> Try moving the include statements above (outside) of the module >> definition. >> >> Len > > That worked, thank you. Is this a required rule? > > But I had to modify both the z offset, and the length of the > threaded_rod by quite a bit to get it to project from the cylinder at > both ends, so that line now looks like this: > >     #translate([0,0,25])threaded_rod(d=12, l=51, pitch=2, > internal=false, bevel=0.5); > > And I don't believe I see any bevel. > > Threading is limited to the top by the 2nd cylinder and a bit of Z > tweaking made it clean to the bottom of the hole. > > I see now that the line above this one clears the bore below the > threads so the added length of threaded_rod is not needed. The correct > Z translation would work as the OP seems to have a good understanding > of but using exactly the same for both subtractions was part of he error. > > So my version with the stretched rod looks like this: > > include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/std.scad> > include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/threading.scad> > module test(); > { >     difference() >     { >         cylinder(h=50, d=16, $fn=150); >         translate([0,0,0])cylinder(h=32.5, d=12); >         translate([0,0,25])threaded_rod(d=12, l=55, pitch=2, > internal=false, bevel=0.5); >     } > } > test(); > > I hope this helps, it sure has me. > > [...] > >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> > Cheers, Gene Heskett, CET.
L
larry
Thu, Jun 26, 2025 8:01 PM

On Thu, 2025-06-26 at 12:37 -0400, gene heskett via Discuss wrote:

On 6/26/25 11:04, Leonard Martin Struttmann via Discuss wrote:

Gene,

Try moving the include statements above (outside) of the module definition.

Len

That worked, thank you. Is this a required rule?

But I had to modify both the z offset, and the length of the
threaded_rod by quite a bit to get it to project from the cylinder at
both ends, so that line now looks like this:

    #translate([0,0,25])threaded_rod(d=12, l=51, pitch=2,
internal=false, bevel=0.5);

And I don't believe I see any bevel.

It's there, but it's a small bevel. Try changing it to 1.5 and put a
'#' at the beginning of that line. Of course, since the bevel is not
inside the cylinder, it will now be seen anywhere in the final render.

Threading is limited to the top by the 2nd cylinder and a bit of Z
tweaking made it clean to the bottom of the hole.

I see now that the line above this one clears the bore below the threads
so the added length of threaded_rod is not needed. The correct Z
translation would work as the OP seems to have a good understanding of
but using exactly the same for both subtractions was part of he error.

Right, but the cylinder which clears the bore needs to be smaller than
the bottom end of the threaded rod in order for the bevel to be in the
final render.

So my version with the stretched rod looks like this:

include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/std.scad>
include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/threading.scad>
module test();
{
    difference()
    {
        cylinder(h=50, d=16, $fn=150);
        translate([0,0,0])cylinder(h=32.5, d=12);
        translate([0,0,25])threaded_rod(d=12, l=55, pitch=2,
internal=false, bevel=0.5);
    }
}
test();

I hope this helps, it sure has me.

[...]

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

Cheers, Gene Heskett, CET.

On Thu, 2025-06-26 at 12:37 -0400, gene heskett via Discuss wrote: > On 6/26/25 11:04, Leonard Martin Struttmann via Discuss wrote: > > Gene, > > > > Try moving the include statements above (outside) of the module definition. > > > > Len > > That worked, thank you. Is this a required rule? > > But I had to modify both the z offset, and the length of the > threaded_rod by quite a bit to get it to project from the cylinder at > both ends, so that line now looks like this: > >     #translate([0,0,25])threaded_rod(d=12, l=51, pitch=2, > internal=false, bevel=0.5); > > And I don't believe I see any bevel. It's there, but it's a small bevel. Try changing it to 1.5 and put a '#' at the beginning of that line. Of course, since the bevel is not inside the cylinder, it will now be seen anywhere in the final render. > Threading is limited to the top by the 2nd cylinder and a bit of Z > tweaking made it clean to the bottom of the hole. > > I see now that the line above this one clears the bore below the threads > so the added length of threaded_rod is not needed. The correct Z > translation would work as the OP seems to have a good understanding of > but using exactly the same for both subtractions was part of he error. Right, but the cylinder which clears the bore needs to be smaller than the bottom end of the threaded rod in order for the bevel to be in the final render. > So my version with the stretched rod looks like this: > > include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/std.scad> > include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/threading.scad> > module test(); > { >     difference() >     { >         cylinder(h=50, d=16, $fn=150); >         translate([0,0,0])cylinder(h=32.5, d=12); >         translate([0,0,25])threaded_rod(d=12, l=55, pitch=2, > internal=false, bevel=0.5); >     } > } > test(); > > I hope this helps, it sure has me. > > [...] > > > > OpenSCAD mailing list > > > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > > Cheers, Gene Heskett, CET.
AM
Adrian Mariano
Thu, Jun 26, 2025 8:26 PM

Because interior=false, the bevel is the wrong direction.  If you take a
rod and bevel the ends and then subtract that you're going to get a hole
with a little lip at the top.  You need to set inside=true, which reverses
the bevels.  Or you need to set a negative bevel so that it flares outward
so that it bevels the hole.

You can always try making the bevel really big, like how about 4.  You
wouldn't want such a big bevel, but you'll be able to see it!  A bevel on
a threaded rod can be subtle.

Really the threads will come out better if you use the interior argument
correctly.  In fact, I think with interior=false they won't work unless you
run the threads all the way off the end.

[image: image.png]

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

threaded_rod(d=12, pitch=2, internal=true, l=25, bevel=2);
right(20)threaded_rod(d=12, pitch=2, internal=false, l=25, bevel=2);

On Thu, Jun 26, 2025 at 4:02 PM larry via Discuss <
discuss@lists.openscad.org> wrote:

On Thu, 2025-06-26 at 12:37 -0400, gene heskett via Discuss wrote:

On 6/26/25 11:04, Leonard Martin Struttmann via Discuss wrote:

Gene,

Try moving the include statements above (outside) of the module

definition.

Len

That worked, thank you. Is this a required rule?

But I had to modify both the z offset, and the length of the
threaded_rod by quite a bit to get it to project from the cylinder at
both ends, so that line now looks like this:

  #translate([0,0,25])threaded_rod(d=12, l=51, pitch=2,

internal=false, bevel=0.5);

And I don't believe I see any bevel.

It's there, but it's a small bevel. Try changing it to 1.5 and put a
'#' at the beginning of that line. Of course, since the bevel is not
inside the cylinder, it will now be seen anywhere in the final render.

Threading is limited to the top by the 2nd cylinder and a bit of Z
tweaking made it clean to the bottom of the hole.

I see now that the line above this one clears the bore below the threads
so the added length of threaded_rod is not needed. The correct Z
translation would work as the OP seems to have a good understanding of
but using exactly the same for both subtractions was part of he error.

Right, but the cylinder which clears the bore needs to be smaller than
the bottom end of the threaded rod in order for the bevel to be in the
final render.

So my version with the stretched rod looks like this:

include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/std.scad>
include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/threading.scad>
module test();
{
difference()
{
cylinder(h=50, d=16, $fn=150);
translate([0,0,0])cylinder(h=32.5, d=12);
translate([0,0,25])threaded_rod(d=12, l=55, pitch=2,
internal=false, bevel=0.5);
}
}
test();

I hope this helps, it sure has me.

[...]

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

Cheers, Gene Heskett, CET.


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

Because interior=false, the bevel is the wrong direction. If you take a rod and bevel the ends and then subtract that you're going to get a hole with a little lip at the top. You need to set inside=true, which reverses the bevels. Or you need to set a negative bevel so that it flares outward so that it bevels the hole. You can always try making the bevel really big, like how about 4. You wouldn't want such a big bevel, but you'll be able to see it! A bevel on a threaded rod can be subtle. Really the threads will come out better if you use the interior argument correctly. In fact, I think with interior=false they won't work unless you run the threads all the way off the end. [image: image.png] include<BOSL2/std.scad> include<BOSL2/threading.scad> threaded_rod(d=12, pitch=2, internal=true, l=25, bevel=2); right(20)threaded_rod(d=12, pitch=2, internal=false, l=25, bevel=2); On Thu, Jun 26, 2025 at 4:02 PM larry via Discuss < discuss@lists.openscad.org> wrote: > On Thu, 2025-06-26 at 12:37 -0400, gene heskett via Discuss wrote: > > On 6/26/25 11:04, Leonard Martin Struttmann via Discuss wrote: > > > Gene, > > > > > > Try moving the include statements above (outside) of the module > definition. > > > > > > Len > > > > That worked, thank you. Is this a required rule? > > > > But I had to modify both the z offset, and the length of the > > threaded_rod by quite a bit to get it to project from the cylinder at > > both ends, so that line now looks like this: > > > > #translate([0,0,25])threaded_rod(d=12, l=51, pitch=2, > > internal=false, bevel=0.5); > > > > And I don't believe I see any bevel. > > It's there, but it's a small bevel. Try changing it to 1.5 and put a > '#' at the beginning of that line. Of course, since the bevel is not > inside the cylinder, it will now be seen anywhere in the final render. > > > > > Threading is limited to the top by the 2nd cylinder and a bit of Z > > tweaking made it clean to the bottom of the hole. > > > > I see now that the line above this one clears the bore below the threads > > so the added length of threaded_rod is not needed. The correct Z > > translation would work as the OP seems to have a good understanding of > > but using exactly the same for both subtractions was part of he error. > > Right, but the cylinder which clears the bore needs to be smaller than > the bottom end of the threaded rod in order for the bevel to be in the > final render. > > > So my version with the stretched rod looks like this: > > > > include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/std.scad> > > include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/threading.scad> > > module test(); > > { > > difference() > > { > > cylinder(h=50, d=16, $fn=150); > > translate([0,0,0])cylinder(h=32.5, d=12); > > translate([0,0,25])threaded_rod(d=12, l=55, pitch=2, > > internal=false, bevel=0.5); > > } > > } > > test(); > > > > I hope this helps, it sure has me. > > > > [...] > > > > > > OpenSCAD mailing list > > > > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > > > > Cheers, Gene Heskett, CET. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
L
larry
Thu, Jun 26, 2025 8:32 PM

On Thu, 2025-06-26 at 12:37 -0400, gene heskett via Discuss wrote:

So my version with the stretched rod looks like this:
include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/std.scad>
include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/threading.scad>
module test();
{
    difference()
    {
        cylinder(h=50, d=16, $fn=150);
        translate([0,0,0])cylinder(h=32.5, d=12);
        translate([0,0,25])threaded_rod(d=12, l=55, pitch=2,
internal=false, bevel=0.5);
    }
}
test();

Some comments:

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

// no semicolon after test()
module test() {
difference() {
cylinder(h=50, d=16, $fn=150);
// d=10 to allow for bevel
cylinder(h=32.5, d=10);
up(25+32.5) threaded_rod(d=12, l=50, pitch=2, internal=false,
bevel=1);

// uncomment the following line to see what's happening internally.
// cube(60);
}
}

test();

On Thu, 2025-06-26 at 12:37 -0400, gene heskett via Discuss wrote: > > So my version with the stretched rod looks like this: > include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/std.scad> > include </home/gene/.local/share/OpenSCAD/libraries/BOSL2/threading.scad> > module test(); > { >     difference() >     { >         cylinder(h=50, d=16, $fn=150); >         translate([0,0,0])cylinder(h=32.5, d=12); >         translate([0,0,25])threaded_rod(d=12, l=55, pitch=2, > internal=false, bevel=0.5); >     } > } > test(); Some comments: include <BOSL2/std.scad> include <BOSL2/threading.scad> $fn= $preview ? 60 : 180; // automatic preview/render for $fn // no semicolon after test() module test() { difference() { cylinder(h=50, d=16, $fn=150); // d=10 to allow for bevel cylinder(h=32.5, d=10); up(25+32.5) threaded_rod(d=12, l=50, pitch=2, internal=false, bevel=1); // uncomment the following line to see what's happening internally. // cube(60); } } test();