_originals.scad is just:
module _cube(size=[1,1,1], center=false)
cube(size,center);
Admin - PM me if you need anything, or if I've done something stupid...
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.
Sent from: http://forum.openscad.org/
You could write up a whole library... :
module cube(size=[1,1,1],center=undef,centre=false) {
if(undef==center) {
_cube(size,centre);
} else {
_cube(size,center);
}
}
--
Sent from: http://forum.openscad.org/
On Wed, Mar 07, 2018 at 06:30:43PM +0000, Gadgetmind wrote:
On 07/03/18 18:13, Frank van der Hulst wrote:
Are we talking about colo(u)r now?
That one is fixable in user space and I have done so. I keep
musing on getting my colour () module to also address "grey".
Center, sadly, isn't fixed as easily and it's a shame that (say)
cylinder can cope with many combinations or r, d, r1, r2, d1, d2 but
not centre as well as centre.
When using a computer language, you have to use the syntax and
spelling of that computer language. Openscad absolutely does not
tolerate a missing semicolon.
When I write a C program, I might want to call the main program
"HoofdProgramma (int argc, char **argv)", but the spelling in C
dictates that main is spelled "main" (and not Main or HoofdProgramma).
Now for some of you it may look as if some words are just normal
words, but they are not. To get a cylindrical object you use the
keyword "cylinder". To center said object you use "center". That's
the keyword used in the openscad language.
Roger.
--
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2600998 **
** Delftechpark 26 2628 XH Delft, The Netherlands. KVK: 27239233 **
-- BitWizard writes Linux device drivers for any device you may have! --
The plan was simple, like my brother-in-law Phil. But unlike
Phil, this plan just might work.
[chris@xps-void ctest]$ cat foo.c
#include <stdio.h>
void foo(void) {
printf("foo\n");
}
[chris@xps-void ctest]$ gcc -Dfoo=main foo.c -o foo
[chris@xps-void ctest]$ ./foo
foo
On 08/03/18 08:03, Rogier Wolff wrote:
On Wed, Mar 07, 2018 at 06:30:43PM +0000, Gadgetmind wrote:
On 07/03/18 18:13, Frank van der Hulst wrote:
Are we talking about colo(u)r now?
That one is fixable in user space and I have done so. I keep
musing on getting my colour () module to also address "grey".
Center, sadly, isn't fixed as easily and it's a shame that (say)
cylinder can cope with many combinations or r, d, r1, r2, d1, d2 but
not centre as well as centre.
When using a computer language, you have to use the syntax and
spelling of that computer language. Openscad absolutely does not
tolerate a missing semicolon.
When I write a C program, I might want to call the main program
"HoofdProgramma (int argc, char **argv)", but the spelling in C
dictates that main is spelled "main" (and not Main or HoofdProgramma).
Now for some of you it may look as if some words are just normal
words, but they are not. To get a cylindrical object you use the
keyword "cylinder". To center said object you use "center". That's
the keyword used in the openscad language.
Roger.
On 2018-03-08 11:43, Chris Camacho wrote:
[chris@xps-void ctest]$ cat foo.c
#include <stdio.h>
void foo(void) {
printf("foo\n");
}
[chris@xps-void ctest]$ gcc -Dfoo=main foo.c -o foo
[chris@xps-void ctest]$ ./foo
foo
This is a text replacement trick using the preprocessor, not the
language. The compiler (gcc) sees main, not foo.
Carsten Arnholm
how its implemented is irrelevant, in the source code the entry point is foo
similarly if I can do
cube([10,20,30],centre=true);
in the source code centre is centre
I don't really care how its done as long as it doesn't slow things down
and it remains compatible....
On 08/03/18 12:18, arnholm@arnholm.org wrote:
On 2018-03-08 11:43, Chris Camacho wrote:
[chris@xps-void ctest]$ cat foo.c
#include <stdio.h>
void foo(void) {
printf("foo\n");
}
[chris@xps-void ctest]$ gcc -Dfoo=main foo.c -o foo
[chris@xps-void ctest]$ ./foo
foo
This is a text replacement trick using the preprocessor, not the
language. The compiler (gcc) sees main, not foo.
Carsten Arnholm
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
To add a different viewpoint on the conversation, let me tell you how
Autodesk solved in in the command line of AutoCAD. The very first versions
only understood (US) english. The they added multi-language support. Ouch.
All the scripts suddenly stopped working if anything else than US english
was selected as the user interface language. They solved it by prefixing all
existing commands with an underscore. So all the scripts had to be reworked.
So instead of (command "line" pt1 pt2), you had to use (command "_line" pt1
pt2) in lisp, and just "_line" in command line replay scripts (which are
hardly used, but possible).
In short, adding localization (Oxford spelling) will call for "unlocalized"
commands to be used in library code and, frankly, all production code. The
whole Autodesk story learned me that having a defined language is better
than having a language that tries to outsmart the programmer. Consider:
cube([1,1,1], center=true);
and
cube([1,1,1], centre=true); // spelling error!
In which the last case was a mistake, not a language preference. The last
form is not an error and defines a variable to be used within the "cube"
module (that this is a built-in module won't make a difference, I hope). In
fact, I think this is how the precision variables work ($fn, etc).
I would like a firm correction from the compiler, and not some guesswork by
the compiler about what I mean. Compilers talk to the programmer. Let's not
silence them in the name of spelling.
--
Sent from: http://forum.openscad.org/