Discussion:
[OpenSCAD] Show fonts
Thomas Leonard Gertz
2018-12-03 17:57:25 UTC
Permalink
Is there a easy way to show all fonts, how they looks and name?



-----
Thomas Leonard Gertz
Kerteminde, Danmark
--
Sent from: http://forum.openscad.org/
Torsten Paul
2018-12-03 18:14:00 UTC
Permalink
Post by Thomas Leonard Gertz
Is there a easy way to show all fonts, how they looks and name?
Yes and no, the list is available via Help->Font List and
you can drag&drop the name selection string from that list
into the editor.

There's no preview yet, but there's a feature request to
add this: https://github.com/openscad/openscad/issues/1395

ciao,
Torsten.
runsun
2018-12-03 19:23:21 UTC
Permalink
would it be easier to have a builtin name like *$fontnames* containing all
font names, so it is easy for users to come up with examples themselves ?



-----

$ 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/
Parkinbot
2018-12-07 11:38:16 UTC
Permalink
wouldn't a feature like this violate the iron law that OpenSCAD doesn't allow
for queries?

As soon as this law softens I would immediately propose variables like:
- $imports - reflect all imports as list_of(list_of(verts,faces))
- $cmdline - reflect and set all command line arguments
- $filename - reflect and set the actual filename for exports
- $uselibs - reflect and set used libs and their order
- $includelibs - reflect and set included libs
- $functions - reflect and set resolutionpaths of functions
- $modules - reflect resolutionpaths of modules
- $constants reflect resolutionpaths of constants
- $backgroundimage set image as background in viewport
- $echo2clipboard - stream text into clipboard
...
- $code - reflect and set(!) the actual code

and so on.



--
Sent from: http://forum.openscad.org/
Parkinbot
2018-12-07 15:37:06 UTC
Permalink
I forgot an important one:
$animation - read and set(!) animation parameters



--
Sent from: http://forum.openscad.org/
runsun
2018-12-07 20:57:47 UTC
Permalink
I don't know about iron laws of OpenSCAD, but, for those queries you
mentioned, I want them all lol ...

Also add these:

$this => the name of func/mod in the current scope (but, I believe this is
incorporated into your $functions/$modules)
$arguments => the name and value of arguments inside a func/mod.

To me, this 2nd one seems to be already a feature in OpenSCAD, as shown in
echo():

echo(abc=123);

The OpenSCAD is able to catch and present the argument name, "abc". Why not
release this feature to user functions ?



-----

$ 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/
nop head
2018-12-07 21:40:29 UTC
Permalink
LOL, it took a long argument to get $preview past the iron gates. Good luck
with this list.

As $ bestows dynamic scope there should really be another prefix for built
in variables that don't need to be dynamic. Probably one that isn't allowed
for user variables so there can be no clash when introducing a new one.
Post by runsun
I don't know about iron laws of OpenSCAD, but, for those queries you
mentioned, I want them all lol ...
$this => the name of func/mod in the current scope (but, I believe this is
incorporated into your $functions/$modules)
$arguments => the name and value of arguments inside a func/mod.
To me, this 2nd one seems to be already a feature in OpenSCAD, as shown in
echo(abc=123);
The OpenSCAD is able to catch and present the argument name, "abc". Why not
release this feature to user functions ?
-----
$ 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/
_______________________________________________
OpenSCAD mailing list
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Marius Kintel
2018-12-07 21:42:38 UTC
Permalink
As $ bestows dynamic scope there should really be another prefix for built in variables that don't need to be dynamic. Probably one that isn't allowed for user variables so there can be no clash when introducing a new one.
Yes, that would make it a lot easier to manage these special, read-only queries

-Marius
Parkinbot
2018-12-07 22:25:08 UTC
Permalink
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/
nop head
2018-12-07 22:30:36 UTC
Permalink
I use Python to script the command line. Then it works on any OS as well.
Post by Parkinbot
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
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
MichaelAtOz
2018-12-07 22:25:53 UTC
Permalink
Post by runsun
I don't know about iron laws of OpenSCAD, but, for those queries you
mentioned, I want them all lol ...
$this => the name of func/mod in the current scope (but, I believe this is
incorporated into your $functions/$modules)
$arguments => the name and value of arguments inside a func/mod.
To me, this 2nd one seems to be already a feature in OpenSCAD, as shown in
echo(abc=123);
The OpenSCAD is able to catch and present the argument name, "abc". Why not
release this feature to user functions ?
-----
$ 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/
_______________________________________________
OpenSCAD mailing list
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
That is not some majical property, it was a hack to echo() AFAIK, for
example echo(str(a=1)); doesn't do the same.



-----
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
2018-12-08 00:04:05 UTC
Permalink
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] ]
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/
MichaelAtOz
2018-12-08 01:03:58 UTC
Permalink
Post by runsun
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/
MichaelAtOz
2018-12-08 01:07:17 UTC
Permalink
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/
Parkinbot
2018-12-08 11:58:55 UTC
Permalink
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/
runsun
2018-12-08 18:36:06 UTC
Permalink
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 )
Post by MichaelAtOz
Post by runsun
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
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/
Hugo Jackson
2018-12-08 19:26:08 UTC
Permalink
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.
MichaelAtOz
2018-12-08 21:55:52 UTC
Permalink
Post by Hugo Jackson
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/
MichaelAtOz
2018-12-08 22:13:44 UTC
Permalink
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/

Loading...