discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

problem passing arguments

GH
gene heskett
Thu, Aug 4, 2022 2:22 AM

Greetings;

OpenSCAD https://www.openscad.org/version 2022.06.26.ai11958

I have several calls in this project that pass size arguments to a module.

For example:
line401:nut_mount_rocker(-.1,0,1);// two size trims, and optional nut
pocket controller
however:
line294:module nut_mount_rocker(l,w,sp)// V2
        {
        echo(296,l,w.sp);

returns:ECHO: 296, -0.1, undef yet later in this module: if (sp>0)// take out
nut pocket if sp>0 {
translate([0,0,14.95])cube([51.6,60.5,30],center=true);//nut pocket }
And it works. but the 0 in the call is called undef. but its being
undef'd is not an error? this module is called from within another
module like this: nut_mount_rocker(.8,2,0);// pocket for nut if non-zero
in third sargument, and it works! So the third argument is ok, why is
the zero not ok?

And that same echo then says:
ECHO: 296, 0.8, undef

So at least its consistent, but the parts don't fit right.
with 3 arguments, the first and third work, why not the 2nd one?

In this case, the 2nd is either 2 for correction, or zero for no correction, but it arrives at the module as undef in any
event, the parts it is making for the next 7 hours will be the wrong
size. I may as well abort the build. As PETG w 20% CF isn't cheap...
Thank you.

Take care & stay well everybody.

Cheers, Gene Heskett.

"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.

Greetings; OpenSCAD <https://www.openscad.org/>version 2022.06.26.ai11958 I have several calls in this project that pass size arguments to a module. For example: line401:nut_mount_rocker(-.1,0,1);// two size trims, and optional nut pocket controller however: line294:module nut_mount_rocker(l,w,sp)// V2         {         echo(296,l,w.sp); returns:ECHO: 296, -0.1, undef yet later in this module: if (sp>0)// take out nut pocket if sp>0 { translate([0,0,14.95])cube([51.6,60.5,30],center=true);//nut pocket } And it works. but the 0 in the call is called undef. but its being undef'd is not an error? this module is called from within another module like this: nut_mount_rocker(.8,2,0);// pocket for nut if non-zero in third sargument, and it works! So the third argument is ok, why is the zero not ok? And that same echo then says: ECHO: 296, 0.8, undef So at least its consistent, but the parts don't fit right. with 3 arguments, the first and third work, why not the 2nd one? In this case, the 2nd is either 2 for correction, or zero for no correction, but it arrives at the module as undef in any event, the parts it is making for the next 7 hours will be the wrong size. I may as well abort the build. As PETG w 20% CF isn't cheap... Thank you. Take care & stay well everybody. Cheers, Gene Heskett. -- "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 Genes Web page<http://geneslinuxbox.net:6309/>
JB
Jordan Brown
Thu, Aug 4, 2022 2:26 AM

On 8/3/2022 7:22 PM, gene heskett wrote:

Greetings;

OpenSCAD https://www.openscad.org/version 2022.06.26.ai11958

I have several calls in this project that pass size arguments to a module.

For example:
line401:nut_mount_rocker(-.1,0,1);// two size trims, and optional nut
pocket controller
however:
line294:module nut_mount_rocker(l,w,sp)// V2
        {
        echo(296,l,w.sp);

You have "w.sp" with a period rather than "w,sp" with a comma.

It seems like a bug that trying to specify a sub-element of something
that is not an array, range, or object does not yield an error.

On 8/3/2022 7:22 PM, gene heskett wrote: > Greetings; > > OpenSCAD <https://www.openscad.org/>version 2022.06.26.ai11958 > > I have several calls in this project that pass size arguments to a module. > > For example: > line401:nut_mount_rocker(-.1,0,1);// two size trims, and optional nut > pocket controller > however: > line294:module nut_mount_rocker(l,w,sp)// V2 >         { >         echo(296,l,w.sp); You have "w.sp" with a period rather than "w,sp" with a comma. It seems like a bug that trying to specify a sub-element of something that is not an array, range, or object does not yield an error.
GH
gene heskett
Thu, Aug 4, 2022 2:56 AM

On 8/3/22 22:29, Jordan Brown wrote:

On 8/3/2022 7:22 PM, gene heskett wrote:

Greetings;

OpenSCAD https://www.openscad.org/version 2022.06.26.ai11958

I have several calls in this project that pass size arguments to a module.

For example:
line401:nut_mount_rocker(-.1,0,1);// two size trims, and optional nut
pocket controller
however:
line294:module nut_mount_rocker(l,w,sp)// V2
        {
        echo(296,l,w.sp);

You have "w.sp" with a period rather than "w,sp" with a comma.

Damn, I'm going blind. Thanks. Sorry for the noise everybody.

It seems like a bug that trying to specify a sub-element of something
that is not an array, range, or object does not yield an error.

Cheers, Gene Heskett.

"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.

On 8/3/22 22:29, Jordan Brown wrote: > On 8/3/2022 7:22 PM, gene heskett wrote: >> Greetings; >> >> OpenSCAD <https://www.openscad.org/>version 2022.06.26.ai11958 >> >> I have several calls in this project that pass size arguments to a module. >> >> For example: >> line401:nut_mount_rocker(-.1,0,1);// two size trims, and optional nut >> pocket controller >> however: >> line294:module nut_mount_rocker(l,w,sp)// V2 >>         { >>         echo(296,l,w.sp); > You have "w.sp" with a period rather than "w,sp" with a comma. Damn, I'm going blind. Thanks. Sorry for the noise everybody. > > It seems like a bug that trying to specify a sub-element of something > that is not an array, range, or object does not yield an error. > Cheers, Gene Heskett. -- "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 Genes Web page <http://geneslinuxbox.net:6309/>