NH
nop head
Fri, Dec 7, 2018 10:30 PM
I use Python to script the command line. Then it works on any OS as well.
On Fri, 7 Dec 2018 at 22:25, Parkinbot rudolf@digitaldocument.de wrote:
I use Python to script the command line. Then it works on any OS as well.
On Fri, 7 Dec 2018 at 22:25, Parkinbot <rudolf@digitaldocument.de> wrote:
> Most of them shouldn't be read-only. As a Windows user for example I find
> it
> too inconvenient to write shell scripts, thus I hardly ever use cmdline
> syntax for OpenSCAD. So I would love a possiblity to set cmdline args from
> within OpenSCAD.
>
> As for the new prefix, my keyboard tells me there are not many characters
> left without OpenSCAD semantics.
> @ ~ § € ' ^ ² ³ ° µ
>
> Maybe also $$ can be used, which is currently not allowed.
>
>
>
>
>
>
> --
> Sent from: http://forum.openscad.org/
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss@lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
R
runsun
Sat, Dec 8, 2018 12:04 AM
Sure str() and echo() don't work the same. Only echo() has that hack.
What my point is that echo() can catch the argument name. It means
OpenSCAD already can do that, so it should not be totally new to let user
functions (or module) do that as well :
function f(len,width)=
echo( $arguments )
len_width;
a= f(5);
==> [ ["len",5], ["width", undef] ]
MichaelAtOz wrote
That is not some magical property, it was a hack to echo() AFAIK, for
example echo(str(a=1)); doesn't do the same.
$ Runsun Pan, PhD $ libs: scadx , doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), editor of choice: CudaText ( OpenSCAD lexer ); $ Tips ; $ Snippets
--
Sent from: http://forum.openscad.org/
Sure str() and echo() don't work the same. Only echo() has that hack.
What my point is that echo() can catch the argument name. It means
OpenSCAD already can do that, so it should not be totally new to let user
functions (or module) do that as well :
function f(len,width)=
echo( $arguments )
len_width;
a= f(5);
==> [ ["len",5], ["width", undef] ]
MichaelAtOz wrote
> That is not some magical property, it was a hack to echo() AFAIK, for
> example echo(str(a=1)); doesn't do the same.
-----
$ Runsun Pan, PhD $ libs: scadx , doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), editor of choice: CudaText ( OpenSCAD lexer ); $ Tips ; $ Snippets
--
Sent from: http://forum.openscad.org/
M
MichaelAtOz
Sat, Dec 8, 2018 1:03 AM
function f(len,width)=
echo( $arguments )
len_width;
a= f(5);
==> [ ["len",5], ["width", undef] ]
so just for debugging shortcut instead of
function f(len,width)=
echo( len=len, width=width)
len_width;
?
Admin - email* me if you need anything, or if I've done something stupid...
- click on my MichaelAtOz label, there is a link to email me.
Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.
The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
Sent from: http://forum.openscad.org/
runsun wrote
> function f(len,width)=
> echo( $arguments )
> len_width;
>
> a= f(5);
> ==> [ ["len",5], ["width", undef] ]
so just for debugging shortcut instead of
function f(len,width)=
echo( len=len, width=width)
len_width;
?
-----
Admin - email* me if you need anything, or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.
Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.
The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
--
Sent from: http://forum.openscad.org/
M
MichaelAtOz
Sat, Dec 8, 2018 1:07 AM
function f(len,width)=
[ ["len",len], ["width",width] ];
??
Admin - email* me if you need anything, or if I've done something stupid...
- click on my MichaelAtOz label, there is a link to email me.
Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.
The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
Sent from: http://forum.openscad.org/
function f(len,width)=
[ ["len",len], ["width",width] ];
??
-----
Admin - email* me if you need anything, or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.
Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.
The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
--
Sent from: http://forum.openscad.org/
P
Parkinbot
Sat, Dec 8, 2018 11:58 AM
MichaelAtOz,
in OpenSCAD you can call functions and modules with an unlimited number of
arguments - e.g. you don't get an error with misspelled paraemeter names,
which can be nasty problem when it comes to tracking an error.
However, the good news (with respect to $arguments) is: Those arguments that
are not defined in the prototype are currently ignored. The bad news is:
they are not accessible at all. So you can't implement functions and modules
with a variable number of arguments unless you pack them into a list, parse
this list and solve the naming problem.
myfunc(1,2,3,a=4,b=5,c=6);
module myfunc() echo("works but no args declared");
So the new $arguments variable would allow for:
module myfunc() echo("works withargs ", $arguments);
and give access to any provided parameters and its names which can also be
"$argument_x" if anonymous, as is the case in the call
myfunc(1,2,3,a=4,b=5,c=6);
But let me mention that OpenSCAD already provides an even wierder mechanism.
You don't have to declare parameters at all. Why not just use them and trust
on the caller?
myfunc(1,2,3,a=4,b=5,c=6);
module myfunc() echo("works even no args were declared: ", a, b, c);
--
Sent from: http://forum.openscad.org/
MichaelAtOz,
in OpenSCAD you can call functions and modules with an unlimited number of
arguments - e.g. you don't get an error with misspelled paraemeter names,
which can be nasty problem when it comes to tracking an error.
However, the good news (with respect to $arguments) is: Those arguments that
are not defined in the prototype are currently ignored. The bad news is:
they are not accessible at all. So you can't implement functions and modules
with a variable number of arguments unless you pack them into a list, parse
this list and solve the naming problem.
myfunc(1,2,3,a=4,b=5,c=6);
module myfunc() echo("works but no args declared");
So the new $arguments variable would allow for:
module myfunc() echo("works withargs ", $arguments);
and give access to any provided parameters and its names which can also be
"$argument_x" if anonymous, as is the case in the call
myfunc(1,2,3,a=4,b=5,c=6);
But let me mention that OpenSCAD already provides an even wierder mechanism.
You don't have to declare parameters at all. Why not just use them and trust
on the caller?
myfunc(1,2,3,a=4,b=5,c=6);
module myfunc() echo("works even no args were declared: ", a, b, c);
--
Sent from: http://forum.openscad.org/
R
runsun
Sat, Dec 8, 2018 6:36 PM
Sorry there's a typo in my post. I was meant to say
function f(len,width)=
echo( $arguments )
len+width; // not len_width;
It's to return len+width.
The "[ ["len",5], ["width", undef] ]" is to be displayed in the console due
to echo( $arguments )
MichaelAtOz wrote
function f(len,width)=
echo( $arguments )
len_width;
a= f(5);
==> [ ["len",5], ["width", undef] ]
so just for debugging shortcut instead of
function f(len,width)=
echo( len=len, width=width)
len_width;
?
Admin - email* me if you need anything, or if I've done something
stupid...
- click on my MichaelAtOz label, there is a link to email me.
Unless specifically shown otherwise above, my contribution is in the
Public Domain; to the extent possible under law, I have waived all
copyright and related or neighbouring rights to this work. Obviously
inclusion of works of previous authors is not included in the above.
The TPP is no simple “trade agreement.” Fight it!
http://www.ourfairdeal.org/ time is running out!
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
$ Runsun Pan, PhD $ libs: scadx , doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), editor of choice: CudaText ( OpenSCAD lexer ); $ Tips ; $ Snippets
--
Sent from: http://forum.openscad.org/
Sorry there's a typo in my post. I was meant to say
function f(len,width)=
echo( $arguments )
len+width; // not len_width;
It's to return len+width.
The "[ ["len",5], ["width", undef] ]" is to be displayed in the console due
to echo( $arguments )
MichaelAtOz wrote
> runsun wrote
>> function f(len,width)=
>> echo( $arguments )
>> len_width;
>>
>> a= f(5);
>> ==> [ ["len",5], ["width", undef] ]
>
> so just for debugging shortcut instead of
>
> function f(len,width)=
> echo( len=len, width=width)
> len_width;
>
> ?
>
>
>
> -----
> Admin - email* me if you need anything, or if I've done something
> stupid...
>
> * click on my MichaelAtOz label, there is a link to email me.
>
> Unless specifically shown otherwise above, my contribution is in the
> Public Domain; to the extent possible under law, I have waived all
> copyright and related or neighbouring rights to this work. Obviously
> inclusion of works of previous authors is not included in the above.
>
> The TPP is no simple “trade agreement.” Fight it!
> http://www.ourfairdeal.org/ time is running out!
> --
> Sent from: http://forum.openscad.org/
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss@.openscad
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-----
$ Runsun Pan, PhD $ libs: scadx , doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), editor of choice: CudaText ( OpenSCAD lexer ); $ Tips ; $ Snippets
--
Sent from: http://forum.openscad.org/
HJ
Hugo Jackson
Sat, Dec 8, 2018 7:26 PM
I like some of the suggestions for adding some new system special variables… so I just thought I’d put forward my own.
$system … returns the system time in seconds a la unix.
I’m sure you’re all a lot more organized than I am in making your creations… but for my part I’m often looking at a desktop (literal… not virtual) of a whole bunch of test pieces I’ve printed and unable to tell which one is which.
I’ve taken to embedding some text in my models with a ‘build number’ but naturally I keep on forgetting to update the variable I use to set the build number. <sigh>
If there were a system special variable like $systime then I could easily massage that into a unique string variable to be included in my designs so that in the prototyping stage I’d be able to differentiate between all the test pieces I’d printed off.
Just my two cents.
I like some of the suggestions for adding some new system special variables… so I just thought I’d put forward my own.
$system … returns the system time in seconds a la unix.
I’m sure you’re all a lot more organized than I am in making your creations… but for my part I’m often looking at a desktop (literal… not virtual) of a whole bunch of test pieces I’ve printed and unable to tell which one is which.
I’ve taken to embedding some text in my models with a ‘build number’ but naturally I keep on forgetting to update the variable I use to set the build number. <sigh>
If there were a system special variable like $systime then I could easily massage that into a unique string variable to be included in my designs so that in the prototyping stage I’d be able to differentiate between all the test pieces I’d printed off.
Just my two cents.
M
MichaelAtOz
Sat, Dec 8, 2018 9:55 PM
If there were a system special variable like $systime then I could easily
massage that into a unique string variable to be included in my designs so
that in the prototyping stage I’d be able to differentiate between all the
test pieces I’d printed off.
It is possible ATM with some fiddling.
You need a process somewhere, which just puts "$anyvariable=<whatever you
want>;" into a somename.scad file, repeatedly or on demand, for your case
every minute (say, to reduce potential file conflicts*).
Then "include <somename.scad>", and you have somewhat dynamic external
variables.
*I'm presuming, pretty firmly, that files are not locked on reading by
OpenSCAD; depending on the process used to update, there is a potential tiny
time when a file may be deleted just before the new one is created. And
OpenSCAD caches, but checks for updated files, so some experimentation is
required before using this for flight control purposes.
Admin - email* me if you need anything, or if I've done something stupid...
- click on my MichaelAtOz label, there is a link to email me.
Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.
The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
Sent from: http://forum.openscad.org/
boxcarmib wrote
> If there were a system special variable like $systime then I could easily
> massage that into a unique string variable to be included in my designs so
> that in the prototyping stage I’d be able to differentiate between all the
> test pieces I’d printed off.
It is possible ATM with some fiddling.
You need a process somewhere, which just puts "$anyvariable=<whatever you
want>;" into a somename.scad file, repeatedly or on demand, for your case
every minute (say, to reduce potential file conflicts*).
Then "include <somename.scad>", and you have somewhat dynamic external
variables.
*I'm presuming, pretty firmly, that files are not locked on reading by
OpenSCAD; depending on the process used to update, there is a potential tiny
time when a file may be deleted just before the new one is created. And
OpenSCAD caches, but checks for updated files, so some experimentation is
required before using this for flight control purposes.
-----
Admin - email* me if you need anything, or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.
Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.
The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
--
Sent from: http://forum.openscad.org/
M
MichaelAtOz
Sat, Dec 8, 2018 10:13 PM
Note for GitHub users https://github.com/openscad/openscad/issues/380, I'll
add a pointer back to this discussion.
Admin - email* me if you need anything, or if I've done something stupid...
- click on my MichaelAtOz label, there is a link to email me.
Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.
The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
Sent from: http://forum.openscad.org/
Note for GitHub users https://github.com/openscad/openscad/issues/380, I'll
add a pointer back to this discussion.
-----
Admin - email* me if you need anything, or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.
Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.
The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
--
Sent from: http://forum.openscad.org/
HJ
Hugo Jackson
Sat, Dec 8, 2018 10:17 PM
Thanks for this. Sorry… I should have done a more comprehensive search of existing topics before throwing my hat in the ring.
Thanks for this. Sorry… I should have done a more comprehensive search of existing topics before throwing my hat in the ring.
> On Dec 8, 2018, at 2:13 PM, MichaelAtOz <oz.at.michael@gmail.com> wrote:
>
> Note for GitHub users https://github.com/openscad/openscad/issues/380, I'll
> add a pointer back to this discussion.
>
>
>
> -----
> Admin - email* me if you need anything, or if I've done something stupid...
>
> * click on my MichaelAtOz label, there is a link to email me.
>
> Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.
>
> The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
> --
> Sent from: http://forum.openscad.org/
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss@lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org