discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

BOSL2/screws.scad screw_hole(): Does the $slop argument have any effect.

LM
Leonard Martin Struttmann
Thu, Oct 13, 2022 5:44 PM

I am attempting to use the [$slop=] argument in screw_hole(), but it
doesn't seem to have any effect.  Can someone else verify that I am using
this correctly?

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

#screw_hole( spa, head="button", length=20 );

vs.

#screw_hole( spa, head="button", length=20, $slop=0.5 );

I am attempting to use the [$slop=] argument in screw_hole(), but it doesn't seem to have any effect. Can someone else verify that I am using this correctly? include <BOSL2/std.scad> include <BOSL2/screws.scad> #screw_hole( spa, head="button", length=20 ); vs. #screw_hole( spa, head="button", length=20, $slop=0.5 );
AM
Adrian Mariano
Thu, Oct 13, 2022 9:21 PM

It's a bug in the handling of $slop.  I have a fix in my dev version.

On Thu, Oct 13, 2022 at 1:48 PM Leonard Martin Struttmann <
lenstruttmann@gmail.com> wrote:

I am attempting to use the [$slop=] argument in screw_hole(), but it
doesn't seem to have any effect.  Can someone else verify that I am using
this correctly?

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

#screw_hole( spa, head="button", length=20 );

vs.

#screw_hole( spa, head="button", length=20, $slop=0.5 );


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

It's a bug in the handling of $slop. I have a fix in my dev version. On Thu, Oct 13, 2022 at 1:48 PM Leonard Martin Struttmann < lenstruttmann@gmail.com> wrote: > I am attempting to use the [$slop=] argument in screw_hole(), but it > doesn't seem to have any effect. Can someone else verify that I am using > this correctly? > > include <BOSL2/std.scad> > include <BOSL2/screws.scad> > > #screw_hole( spa, head="button", length=20 ); > > vs. > > #screw_hole( spa, head="button", length=20, $slop=0.5 ); > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
KT
Kevin Toppenberg
Thu, Oct 13, 2022 11:19 PM

Is $slop built into OpenSCAD? I can't find it on the cheatsheet page (
http://openscad.org/cheatsheet/). If not, then is having a variable name
starting with $ allowed for users to define?  I had always thought they
were special variables, like $fn, $fs etc.

Thanks
Kevin

On Thu, Oct 13, 2022 at 5:22 PM Adrian Mariano avm4@cornell.edu wrote:

It's a bug in the handling of $slop.  I have a fix in my dev version.

On Thu, Oct 13, 2022 at 1:48 PM Leonard Martin Struttmann <
lenstruttmann@gmail.com> wrote:

I am attempting to use the [$slop=] argument in screw_hole(), but it
doesn't seem to have any effect.  Can someone else verify that I am using
this correctly?

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

#screw_hole( spa, head="button", length=20 );

vs.

#screw_hole( spa, head="button", length=20, $slop=0.5 );


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

Is $slop built into OpenSCAD? I can't find it on the cheatsheet page ( http://openscad.org/cheatsheet/). If not, then is having a variable name starting with $ allowed for users to define? I had always thought they were special variables, like $fn, $fs etc. Thanks Kevin On Thu, Oct 13, 2022 at 5:22 PM Adrian Mariano <avm4@cornell.edu> wrote: > It's a bug in the handling of $slop. I have a fix in my dev version. > > On Thu, Oct 13, 2022 at 1:48 PM Leonard Martin Struttmann < > lenstruttmann@gmail.com> wrote: > >> I am attempting to use the [$slop=] argument in screw_hole(), but it >> doesn't seem to have any effect. Can someone else verify that I am using >> this correctly? >> >> include <BOSL2/std.scad> >> include <BOSL2/screws.scad> >> >> #screw_hole( spa, head="button", length=20 ); >> >> vs. >> >> #screw_hole( spa, head="button", length=20, $slop=0.5 ); >> >> _______________________________________________ >> 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 >
AM
Adrian Mariano
Thu, Oct 13, 2022 11:31 PM

No, $slop is not built-in to OpenSCAD.  The $ does not mean the variable is
an OpenSCAD built-in.  It means that its value gets inherited by its
children.

On Thu, Oct 13, 2022 at 7:25 PM Kevin Toppenberg kdtop3@gmail.com wrote:

Is $slop built into OpenSCAD? I can't find it on the cheatsheet page (
http://openscad.org/cheatsheet/). If not, then is having a variable name
starting with $ allowed for users to define?  I had always thought they
were special variables, like $fn, $fs etc.

Thanks
Kevin

On Thu, Oct 13, 2022 at 5:22 PM Adrian Mariano avm4@cornell.edu wrote:

It's a bug in the handling of $slop.  I have a fix in my dev version.

On Thu, Oct 13, 2022 at 1:48 PM Leonard Martin Struttmann <
lenstruttmann@gmail.com> wrote:

I am attempting to use the [$slop=] argument in screw_hole(), but it
doesn't seem to have any effect.  Can someone else verify that I am using
this correctly?

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

#screw_hole( spa, head="button", length=20 );

vs.

#screw_hole( spa, head="button", length=20, $slop=0.5 );


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


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

No, $slop is not built-in to OpenSCAD. The $ does not mean the variable is an OpenSCAD built-in. It means that its value gets inherited by its children. On Thu, Oct 13, 2022 at 7:25 PM Kevin Toppenberg <kdtop3@gmail.com> wrote: > Is $slop built into OpenSCAD? I can't find it on the cheatsheet page ( > http://openscad.org/cheatsheet/). If not, then is having a variable name > starting with $ allowed for users to define? I had always thought they > were special variables, like $fn, $fs etc. > > Thanks > Kevin > > On Thu, Oct 13, 2022 at 5:22 PM Adrian Mariano <avm4@cornell.edu> wrote: > >> It's a bug in the handling of $slop. I have a fix in my dev version. >> >> On Thu, Oct 13, 2022 at 1:48 PM Leonard Martin Struttmann < >> lenstruttmann@gmail.com> wrote: >> >>> I am attempting to use the [$slop=] argument in screw_hole(), but it >>> doesn't seem to have any effect. Can someone else verify that I am using >>> this correctly? >>> >>> include <BOSL2/std.scad> >>> include <BOSL2/screws.scad> >>> >>> #screw_hole( spa, head="button", length=20 ); >>> >>> vs. >>> >>> #screw_hole( spa, head="button", length=20, $slop=0.5 ); >>> >>> _______________________________________________ >>> 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 >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
LM
Leonard Martin Struttmann
Thu, Oct 13, 2022 11:47 PM

Special variables[edit
https://en.wikibooks.org/w/index.php?title=OpenSCAD_User_Manual/Other_Language_Features&veaction=edit&section=1
| edit source
https://en.wikibooks.org/w/index.php?title=OpenSCAD_User_Manual/Other_Language_Features&action=edit&section=1
]

Special variables provide an alternate means of passing arguments to
modules and functions. All user, or OpenSCAD, defined variables starting
with a '$' are special variables, similar to special variables in lisp.
Modules and function see all outside variables in addition to those passed
as arguments or defined internally.

Currently valid special variable names can only be composed of $ followed
by simple characters and underscores [a-zA-Z0-9_] and do not allow
high-ascii or unicode characters.

The value for a regular variable is assigned at compile time and is thus
static for all calls.

Special variables pass along their value from within the scope (see scope
of variables)
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language#Scope_of_variables
from
which the module or function is called. This means that special variables
can potentially have a different value each time a module or function is
called.

regular  = "regular global";
$special = "special global";
module show() echo("        in show    ", regular,"  ", $special );

echo ("        outside    ", regular,"  ", $special );
// ECHO: "        outside    ", "regular global", "  ",
"special global"

for ( regular = [0:1] ){ echo("in regular loop    ", regular,"  ",
$special ); show();}
// ECHO: "in regular loop    ", 0, "  ", "special global"
// ECHO: "        in show    ", "regular global", "  ",
"special global"
// ECHO: "in regular loop    ", 1, "  ", "special global"
// ECHO: "        in show    ", "regular global", "  ",
"special global"

for ( $special = [5:6] ){ echo("in special loop    ", regular,"  ",
$special ); show();}
// ECHO: "in special loop    ", "regular global", "  ", 5
// ECHO: "        in show    ", "regular global", "  ", 5
// ECHO: "in special loop    ", "regular global", "  ", 6
// ECHO: "        in show    ", "regular global", "  ", 6

show();
// ECHO: "        in show    ", "regular global", "  ",
"special global"

This is useful when multiple arguments need to be passed thru several
layers of module calls.

On Thu, Oct 13, 2022 at 6:31 PM Adrian Mariano avm4@cornell.edu wrote:

No, $slop is not built-in to OpenSCAD.  The $ does not mean the variable
is an OpenSCAD built-in.  It means that its value gets inherited by its
children.

On Thu, Oct 13, 2022 at 7:25 PM Kevin Toppenberg kdtop3@gmail.com wrote:

Is $slop built into OpenSCAD? I can't find it on the cheatsheet page (
http://openscad.org/cheatsheet/). If not, then is having a variable name
starting with $ allowed for users to define?  I had always thought they
were special variables, like $fn, $fs etc.

Thanks
Kevin

On Thu, Oct 13, 2022 at 5:22 PM Adrian Mariano avm4@cornell.edu wrote:

It's a bug in the handling of $slop.  I have a fix in my dev version.

On Thu, Oct 13, 2022 at 1:48 PM Leonard Martin Struttmann <
lenstruttmann@gmail.com> wrote:

I am attempting to use the [$slop=] argument in screw_hole(), but it
doesn't seem to have any effect.  Can someone else verify that I am using
this correctly?

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

#screw_hole( spa, head="button", length=20 );

vs.

#screw_hole( spa, head="button", length=20, $slop=0.5 );


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


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

Special variables[edit <https://en.wikibooks.org/w/index.php?title=OpenSCAD_User_Manual/Other_Language_Features&veaction=edit&section=1> | edit source <https://en.wikibooks.org/w/index.php?title=OpenSCAD_User_Manual/Other_Language_Features&action=edit&section=1> ] Special variables provide an alternate means of passing arguments to modules and functions. All user, or OpenSCAD, defined variables starting with a '$' are special variables, similar to special variables in lisp. Modules and function see all outside variables in addition to those passed as arguments or defined internally. Currently valid special variable names can only be composed of $ followed by simple characters and underscores [a-zA-Z0-9_] and do not allow high-ascii or unicode characters. The value for a regular variable is assigned at compile time and is thus static for all calls. Special variables pass along their value from within the scope (see scope of variables) <https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language#Scope_of_variables> from which the module or function is called. This means that special variables can potentially have a different value each time a module or function is called. regular = "regular global"; $special = "special global"; module show() echo(" in show ", regular," ", $special ); echo (" outside ", regular," ", $special ); // ECHO: " outside ", "regular global", " ", "special global" for ( regular = [0:1] ){ echo("in regular loop ", regular," ", $special ); show();} // ECHO: "in regular loop ", 0, " ", "special global" // ECHO: " in show ", "regular global", " ", "special global" // ECHO: "in regular loop ", 1, " ", "special global" // ECHO: " in show ", "regular global", " ", "special global" for ( $special = [5:6] ){ echo("in special loop ", regular," ", $special ); show();} // ECHO: "in special loop ", "regular global", " ", 5 // ECHO: " in show ", "regular global", " ", 5 // ECHO: "in special loop ", "regular global", " ", 6 // ECHO: " in show ", "regular global", " ", 6 show(); // ECHO: " in show ", "regular global", " ", "special global" This is useful when multiple arguments need to be passed thru several layers of module calls. On Thu, Oct 13, 2022 at 6:31 PM Adrian Mariano <avm4@cornell.edu> wrote: > No, $slop is not built-in to OpenSCAD. The $ does not mean the variable > is an OpenSCAD built-in. It means that its value gets inherited by its > children. > > > > On Thu, Oct 13, 2022 at 7:25 PM Kevin Toppenberg <kdtop3@gmail.com> wrote: > >> Is $slop built into OpenSCAD? I can't find it on the cheatsheet page ( >> http://openscad.org/cheatsheet/). If not, then is having a variable name >> starting with $ allowed for users to define? I had always thought they >> were special variables, like $fn, $fs etc. >> >> Thanks >> Kevin >> >> On Thu, Oct 13, 2022 at 5:22 PM Adrian Mariano <avm4@cornell.edu> wrote: >> >>> It's a bug in the handling of $slop. I have a fix in my dev version. >>> >>> On Thu, Oct 13, 2022 at 1:48 PM Leonard Martin Struttmann < >>> lenstruttmann@gmail.com> wrote: >>> >>>> I am attempting to use the [$slop=] argument in screw_hole(), but it >>>> doesn't seem to have any effect. Can someone else verify that I am using >>>> this correctly? >>>> >>>> include <BOSL2/std.scad> >>>> include <BOSL2/screws.scad> >>>> >>>> #screw_hole( spa, head="button", length=20 ); >>>> >>>> vs. >>>> >>>> #screw_hole( spa, head="button", length=20, $slop=0.5 ); >>>> >>>> _______________________________________________ >>>> 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 >>> >> _______________________________________________ >> 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 >