### if problem

GH
gene heskett
Fri, Feb 9, 2024 11:59 PM

Greetings all;

I can't make this work:
in module making the sub call
translate([.25,0,-15])color("pink")yunion_screws(0);
in module yunion_screws:
module yunion_screws(n)
{
ysep=16; //xsep= spacing on sides
xsep=14.5; //ysep=spacing between sides
slen=20; //length of screws
if(n==0)sdia=1.85; // dia of screw for base part
if(n==1)sdia=2.4; // dia of same screw for linear carrier s/b just
barely a slip fit

Its desired to make the head hole big enough to strip the trash out of
the hole, while the part it screws to is self threading, its a 2mm
special screw for plastic. Obviusly I'm doing sth wrong but what

Thank you for any insight.

## 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
Greetings all; I can't make this work: in module making the sub call translate([.25,0,-15])color("pink")yunion_screws(0); in module yunion_screws: module yunion_screws(n) { ysep=16; //xsep= spacing on sides xsep=14.5; //ysep=spacing between sides slen=20; //length of screws if(n==0)sdia=1.85; // dia of screw for base part if(n==1)sdia=2.4; // dia of same screw for linear carrier s/b just barely a slip fit Its desired to make the head hole big enough to strip the trash out of the hole, while the part it screws to is self threading, its a 2mm special screw for plastic. Obviusly I'm doing sth wrong but what Thank you for any insight. 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
JG
Jonathan Gilbert
Sat, Feb 10, 2024 12:02 AM

incomplete.

In any case, with the bits you HAVE pasted, it may be that you're looking
for, assuming 'n' will only ever be 0 or 1:

sdia = (n==0) ? 1.85 : 2.4;

On Fri, Feb 9, 2024 at 3:59 PM gene heskett via Discuss <

Greetings all;

I can't make this work:
in module making the sub call
translate([.25,0,-15])color("pink")yunion_screws(0);
in module yunion_screws:
module yunion_screws(n)
{
ysep=16; //xsep= spacing on sides
xsep=14.5; //ysep=spacing between sides
slen=20; //length of screws
if(n==0)sdia=1.85; // dia of screw for base part
if(n==1)sdia=2.4; // dia of same screw for linear carrier s/b just
barely a slip fit

Its desired to make the head hole big enough to strip the trash out of
the hole, while the part it screws to is self threading, its a 2mm
special screw for plastic. Obviusly I'm doing sth wrong but what

Thank you for any insight.

## 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

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

I think your paste got truncated; your yunion_screws() module looks incomplete. In any case, with the bits you HAVE pasted, it may be that you're looking for, assuming 'n' will only ever be 0 or 1: sdia = (n==0) ? 1.85 : 2.4; On Fri, Feb 9, 2024 at 3:59 PM gene heskett via Discuss < discuss@lists.openscad.org> wrote: > Greetings all; > > I can't make this work: > in module making the sub call > translate([.25,0,-15])color("pink")yunion_screws(0); > in module yunion_screws: > module yunion_screws(n) > { > ysep=16; //xsep= spacing on sides > xsep=14.5; //ysep=spacing between sides > slen=20; //length of screws > if(n==0)sdia=1.85; // dia of screw for base part > if(n==1)sdia=2.4; // dia of same screw for linear carrier s/b just > barely a slip fit > > Its desired to make the head hole big enough to strip the trash out of > the hole, while the part it screws to is self threading, its a 2mm > special screw for plastic. Obviusly I'm doing sth wrong but what > > Thank you for any insight. > > 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 > -- - Jon Gilbert jong@jong.org / jgilbertsjc@gmail.com
GH
gene heskett
Sat, Feb 10, 2024 12:56 AM

On 2/9/24 19:04, Jonathan Gilbert via Discuss wrote:

incomplete.

In any case, with the bits you HAVE pasted, it may be that you're
looking for, assuming 'n' will only ever be 0 or 1:

sdia = (n==0) ? 1.85 : 2.4;

So my dirct approach is bass ackwards, and this works as advertised.
ing
Thank you Jonathan Gilbert, the printer will be warm up shortly.

On Fri, Feb 9, 2024 at 3:59 PM gene heskett via Discuss

`````` Greetings all;

I can't make this work:
in module making the sub call
translate([.25,0,-15])color("pink")yunion_screws(0);
in module yunion_screws:
module yunion_screws(n)
{
ysep=16; //xsep= spacing on sides
xsep=14.5; //ysep=spacing between sides
slen=20; //length of screws
if(n==0)sdia=1.85; // dia of screw for base part
if(n==1)sdia=2.4; // dia of same screw for linear carrier s/b
just
barely a slip fit

Its desired to make the head hole big enough to strip the trash out of
the hole, while the part it screws to is self threading, its a 2mm
special screw for plastic. Obviusly I'm doing sth wrong but what

Thank you for any insight.

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
_______________________________________________
To unsubscribe send an email to discuss-leave@lists.openscad.org
``````

--

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
RW
Rogier Wolff
Mon, Feb 12, 2024 9:40 AM

On Fri, Feb 09, 2024 at 07:56:26PM -0500, gene heskett via Discuss wrote:

``````       if(n==0)sdia=1.85; // dia of screw for base part
if(n==1)sdia=2.4; // dia of same screw for linear carrier s/b
``````

On 2/9/24 19:04, Jonathan Gilbert via Discuss wrote:

sdia = (n==0) ? 1.85 : 2.4;

So my dirct approach is bass ackwards, and this works as advertised.

Thank you Jonathan Gilbert, the printer will be warm up shortly.

Just giving a working snippet doesn't help in the long run if you
don't explain why it doesn't work.

The scope of the variable "sdia" ...
if(n==0) {
sdia=1.85;
...
}

... is exaclty the body of the "if" statement. A new sdia variable is
created.  If there might be an sdia variable available outside of the
if, then that variable is not affected in any way by the assingment,
and that variable is no longer available inside the if statement.

Your shortening of the body of the if, leaving out the braces and not
putting anything else in the body of the if... makes that creation
and destruction of the new sdia variable a no-op.

``````Roger.
``````

On Fri, Feb 9, 2024 at 3:59 PM gene heskett via Discuss

`````` Greetings all;

I can't make this work:
in module making the sub call
translate([.25,0,-15])color("pink")yunion_screws(0);
in module yunion_screws:
module yunion_screws(n)
{
ysep=16; //xsep= spacing on sides
xsep=14.5; //ysep=spacing between sides
just
barely a slip fit

Its desired to make the head hole big enough to strip the trash out of
the hole, while the part it screws to is self threading, its a 2mm
special screw for plastic. Obviusly I'm doing sth wrong but what

Thank you for any insight.

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
_______________________________________________
To unsubscribe send an email to discuss-leave@lists.openscad.org
``````

--

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

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

--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 **
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **

GH
gene heskett
Mon, Feb 12, 2024 1:24 PM

On 2/12/24 04:40, Rogier Wolff wrote:

On Fri, Feb 09, 2024 at 07:56:26PM -0500, gene heskett via Discuss wrote:

``````        if(n==0)sdia=1.85; // dia of screw for base part
if(n==1)sdia=2.4; // dia of same screw for linear carrier s/b
``````

On 2/9/24 19:04, Jonathan Gilbert via Discuss wrote:

sdia = (n==0) ? 1.85 : 2.4;

So my dirct approach is bass ackwards, and this works as advertised.

Thank you Jonathan Gilbert, the printer will be warm up shortly.

Just giving a working snippet doesn't help in the long run if you
don't explain why it doesn't work.

The scope of the variable "sdia" ...
if(n==0) {
sdia=1.85;
...
}

1. It was not previously known in the program

2. Its part of an almost 1300 LOC file, covering most of the mods being
made to a bigger printer I'm building out of an \$1100 tronxy, that came
with a busted marlin, and never succesfully printed anything. tronxy's
support is a vast wasteland, so I'm using the frame as raw materiel to
build a real printer. Fur instance, its a corexy, but two weeks ago I
found all the flying weight parts were 90% solid steel with the X
transport bar alone weighing about a pound. obvioudly a candidate to be
replaced with a CF tube weighing about an ounce and two linear bearings
weighing maybe 4 ounces each, one above the cf tube and another below to
get real torsional rigidity. Moving an all printed hotend carriage
carrying an orbiter v2, a few grams of prox switch for bed leveling and
a triangle labs e3v6 clone with a 70 watt coaxial heater and another
gram of a kusba acceleration sensor to calibrate the input shaper.

And pestering triangle labs and qidi tech for a carbide nozzle so I can
use cf based petg. Even better than industrial diamond as the diamond
starts going away from ablation at around 250C. Carbide just grins and
keeps on cutting titanium at 700C. Triangle Labs isn't answering the
mail, and qidi tech says they are working on it. Later this spring has
been mentioned.

... is exaclty the body of the "if" statement. A new sdia variable is
created.  If there might be an sdia variable available outside of the
if, then that variable is not affected in any way by the assingment,
and that variable is no longer available inside the if statement.

Understood.

Your shortening of the body of the if, leaving out the braces and not
putting anything else in the body of the if... makes that creation
and destruction of the new sdia variable a no-op.

``````Roger.
``````

Thank you. Take care Roger.

## 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 2/12/24 04:40, Rogier Wolff wrote: > On Fri, Feb 09, 2024 at 07:56:26PM -0500, gene heskett via Discuss wrote: > >>>      if(n==0)sdia=1.85; // dia of screw for base part >>>      if(n==1)sdia=2.4; // dia of same screw for linear carrier s/b > >> On 2/9/24 19:04, Jonathan Gilbert via Discuss wrote: >>> sdia = (n==0) ? 1.85 : 2.4; > >> So my dirct approach is bass ackwards, and this works as advertised. > >> Thank you Jonathan Gilbert, the printer will be warm up shortly. > > Just giving a working snippet doesn't help in the long run if you > don't explain why it doesn't work. > > The scope of the variable "sdia" ... > if(n==0) { > sdia=1.85; > ... > } > 1. It was not previously known in the program 2. Its part of an almost 1300 LOC file, covering most of the mods being made to a bigger printer I'm building out of an \$1100 tronxy, that came with a busted marlin, and never succesfully printed anything. tronxy's support is a vast wasteland, so I'm using the frame as raw materiel to build a real printer. Fur instance, its a corexy, but two weeks ago I found all the flying weight parts were 90% solid steel with the X transport bar alone weighing about a pound. obvioudly a candidate to be replaced with a CF tube weighing about an ounce and two linear bearings weighing maybe 4 ounces each, one above the cf tube and another below to get real torsional rigidity. Moving an all printed hotend carriage carrying an orbiter v2, a few grams of prox switch for bed leveling and a triangle labs e3v6 clone with a 70 watt coaxial heater and another gram of a kusba acceleration sensor to calibrate the input shaper. And pestering triangle labs and qidi tech for a carbide nozzle so I can use cf based petg. Even better than industrial diamond as the diamond starts going away from ablation at around 250C. Carbide just grins and keeps on cutting titanium at 700C. Triangle Labs isn't answering the mail, and qidi tech says they are working on it. Later this spring has been mentioned. > ... is exaclty the body of the "if" statement. A new sdia variable is > created. If there might be an sdia variable available outside of the > if, then that variable is not affected in any way by the assingment, > and that variable is no longer available inside the if statement. > Understood. > Your shortening of the body of the if, leaving out the braces and not > putting anything else in the body of the if... makes that creation > and destruction of the new sdia variable a no-op. > > Roger. Thank you. Take care Roger. 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