the "write" library and the 19.05 release

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

the "write" library and the 19.05 release

jon_bondy
I have been using statements like this for years without a problem

write(txt, t = 2, h = sy/12, rotate = 270, center=true);

The new release says that "t"," h", "rotate", and "center" are not
specified as a parameter.  I guess that means "specified as a parameter
in the definition of the module that is being called".

The comments in the "write" library include the following:

// These control the default values for write() writesphere() writecube()
// if the parameters are not included in the call. Feel free to set your own
// defaults.

//default settings
     center=false;
     h = 4;             //mm letter height
     t = 1;             //mm letter thickness
     space =1;             //extra space between characters in
(character widths)
     rotate=0;            // text rotation (clockwise)
     font = "Letters.dxf";    //default for aditional fonts

So, that library clearly understand the concepts of "h", "t", etc.  On
the other hand, the definition of write() is simply

module write(word){

I am confused.  Were there parameters like "rotate" in some version of
the "write" library?  Are there still, but the syntax has changed so
that I am clueless?  Has anyone else encountered these warnings before? 
Should I be using some other library instead?  The number of warnings is
large enough that I would entirely miss a new warning should it appear
at some point.

Thanks!

Jon


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: the "write" library and the 19.05 release

MichaelAtOz
Administrator
Unfortunately 'write()' uses a unique 'feature' of how parameters are
implemented, whether it is technically kosher is a debate to be had.

When you call any module, and parameters in the call are instantiated as
local variables.


module a() { echo(i=i,j=j); }

a(i=1,j=2);

Compiling design (CSG Tree generation)...
WARNING: variable i not specified as parameter, in file
openscad-2019.06.17.ci2847, line 3
WARNING: variable j not specified as parameter, in file
openscad-2019.06.17.ci2847, line 3
ECHO: i = 1, j = 2

So you want to add t/h/rotate/center as positional parameters to the write()
module definition with those defaults.

There is also a edit/preference/advanced option to turn off that check.



-----
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
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
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!
Reply | Threaded
Open this post in threaded view
|

Re: the "write" library and the 19.05 release

MichaelAtOz
Administrator
MichaelAtOz wrote
> So you want to add t/h/rotate/center as positional parameters

Oops, of course I meant default named parameters, t=1, etc...



-----
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
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
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!
Reply | Threaded
Open this post in threaded view
|

Re: the "write" library and the 19.05 release

MichaelAtOz
Administrator
and you could use the top level variables to define the local defaults

module write(word, h=h, t=t, rotate=rotate, center=center, space=space,
font=font) {...}



-----
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
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
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!
Reply | Threaded
Open this post in threaded view
|

Re: the "write" library and the 19.05 release

jon_bondy
In reply to this post by MichaelAtOz
MichaelAtOz said "There is also a edit/preference/advanced option to turn off
that check. "

It would be helpful if I could turn this on and off on a per
source-code-file basis.  That is, for files where I know there are spurious
warnings, I would like to turn the warnings off; but for the rest of my
code, I would like to leave them enabled.

Is there a way to control this in the source code for a particular 3D
design?



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: the "write" library and the 19.05 release

nophead
I don't think so. I think the best thing to do now the release is out is to update all your source code to remove the warnings and get other people to update their libraries.

On Tue, 25 Jun 2019 at 14:12, jon_bondy <[hidden email]> wrote:
MichaelAtOz said "There is also a edit/preference/advanced option to turn off
that check. "

It would be helpful if I could turn this on and off on a per
source-code-file basis.  That is, for files where I know there are spurious
warnings, I would like to turn the warnings off; but for the rest of my
code, I would like to leave them enabled.

Is there a way to control this in the source code for a particular 3D
design?



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: the "write" library and the 19.05 release

jon_bondy

Thanks!

I think that my suggestion that IDE settings be configurable within the source code of a particular SCAD file is a reasonable request, even if it does not get implemented in the near future.

I honestly have no idea how to alter the "write" library to eliminate the error messages; I doubt that I have the option of changing just  my source code to fix things, since the write() routine has a single "word" parameter in the library source code

Jon

On 6/25/2019 9:55 AM, nop head wrote:
I don't think so. I think the best thing to do now the release is out is to update all your source code to remove the warnings and get other people to update their libraries.

On Tue, 25 Jun 2019 at 14:12, jon_bondy <[hidden email]> wrote:
MichaelAtOz said "There is also a edit/preference/advanced option to turn off
that check. "

It would be helpful if I could turn this on and off on a per
source-code-file basis.  That is, for files where I know there are spurious
warnings, I would like to turn the warnings off; but for the rest of my
code, I would like to leave them enabled.

Is there a way to control this in the source code for a particular 3D
design?



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: the "write" library and the 19.05 release

lostapathy
Correct - the write library is what really needs updated, not so much your code.

I'm not a fan of letting code say "trust me, hide all the warnings".  Over time, the amount of hidden warnings will grow until you end up with code that is truly broken, and often much harder to fix than if somebody had stayed on top of it.


On 6/25/19 2:26 PM, jon wrote:

Thanks!

I think that my suggestion that IDE settings be configurable within the source code of a particular SCAD file is a reasonable request, even if it does not get implemented in the near future.

I honestly have no idea how to alter the "write" library to eliminate the error messages; I doubt that I have the option of changing just  my source code to fix things, since the write() routine has a single "word" parameter in the library source code

Jon

On 6/25/2019 9:55 AM, nop head wrote:
I don't think so. I think the best thing to do now the release is out is to update all your source code to remove the warnings and get other people to update their libraries.

On Tue, 25 Jun 2019 at 14:12, jon_bondy <[hidden email]> wrote:
MichaelAtOz said "There is also a edit/preference/advanced option to turn off
that check. "

It would be helpful if I could turn this on and off on a per
source-code-file basis.  That is, for files where I know there are spurious
warnings, I would like to turn the warnings off; but for the rest of my
code, I would like to leave them enabled.

Is there a way to control this in the source code for a particular 3D
design?



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: the "write" library and the 19.05 release

jon_bondy

I agree that disabling warnings is a bad idea.  But for this one particular SCAD file (which happens to be the most important SCAD file I have ever written), I either need to rewrite it (argh) or disable the warnings.  Thus my desire to only disable them for this one file.

Jon

On 6/25/2019 3:43 PM, Joe Francis wrote:
Correct - the write library is what really needs updated, not so much your code.

I'm not a fan of letting code say "trust me, hide all the warnings".  Over time, the amount of hidden warnings will grow until you end up with code that is truly broken, and often much harder to fix than if somebody had stayed on top of it.


On 6/25/19 2:26 PM, jon wrote:

Thanks!

I think that my suggestion that IDE settings be configurable within the source code of a particular SCAD file is a reasonable request, even if it does not get implemented in the near future.

I honestly have no idea how to alter the "write" library to eliminate the error messages; I doubt that I have the option of changing just  my source code to fix things, since the write() routine has a single "word" parameter in the library source code

Jon

On 6/25/2019 9:55 AM, nop head wrote:
I don't think so. I think the best thing to do now the release is out is to update all your source code to remove the warnings and get other people to update their libraries.

On Tue, 25 Jun 2019 at 14:12, jon_bondy <[hidden email]> wrote:
MichaelAtOz said "There is also a edit/preference/advanced option to turn off
that check. "

It would be helpful if I could turn this on and off on a per
source-code-file basis.  That is, for files where I know there are spurious
warnings, I would like to turn the warnings off; but for the rest of my
code, I would like to leave them enabled.

Is there a way to control this in the source code for a particular 3D
design?



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: the "write" library and the 19.05 release

nophead
Yes write needs rewriting. This is why I never use other people's libraries. I had to fix hundreds of warnings in my own library but that was easy.

On Tue, 25 Jun 2019, 20:52 jon, <[hidden email]> wrote:

I agree that disabling warnings is a bad idea.  But for this one particular SCAD file (which happens to be the most important SCAD file I have ever written), I either need to rewrite it (argh) or disable the warnings.  Thus my desire to only disable them for this one file.

Jon

On 6/25/2019 3:43 PM, Joe Francis wrote:
Correct - the write library is what really needs updated, not so much your code.

I'm not a fan of letting code say "trust me, hide all the warnings".  Over time, the amount of hidden warnings will grow until you end up with code that is truly broken, and often much harder to fix than if somebody had stayed on top of it.


On 6/25/19 2:26 PM, jon wrote:

Thanks!

I think that my suggestion that IDE settings be configurable within the source code of a particular SCAD file is a reasonable request, even if it does not get implemented in the near future.

I honestly have no idea how to alter the "write" library to eliminate the error messages; I doubt that I have the option of changing just  my source code to fix things, since the write() routine has a single "word" parameter in the library source code

Jon

On 6/25/2019 9:55 AM, nop head wrote:
I don't think so. I think the best thing to do now the release is out is to update all your source code to remove the warnings and get other people to update their libraries.

On Tue, 25 Jun 2019 at 14:12, jon_bondy <[hidden email]> wrote:
MichaelAtOz said "There is also a edit/preference/advanced option to turn off
that check. "

It would be helpful if I could turn this on and off on a per
source-code-file basis.  That is, for files where I know there are spurious
warnings, I would like to turn the warnings off; but for the rest of my
code, I would like to leave them enabled.

Is there a way to control this in the source code for a particular 3D
design?



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
tp3
Reply | Threaded
Open this post in threaded view
|

Re: the "write" library and the 19.05 release

tp3
Maybe also have a look at the "text_on_OpenSCAD" library which
is a rewrite of the "Write" library using text() - so normal
fonts can be used instead of just a couple of DXF fonts.

https://github.com/brodykenrick/text_on_OpenSCAD

It also seems to produce a couple of warnings, but there's
a bug tracker and some activity of small changes.

ciao,
  Torsten.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-- Torsten
Reply | Threaded
Open this post in threaded view
|

Re: the "write" library and the 19.05 release

MichaelAtOz
Administrator
In reply to this post by jon_bondy
jon_bondy wrote
> I honestly have no idea how to alter the "write" library to eliminate
> the error messages

In write.scad change

module write(word){

to

module write(word, h=h, t=t, rotate=rotate, center=center, space=space,
font=font) {

save. Fixed.

I haven't looked in detail at other modules like writecylinder() and their
use case, if you use those extra parameters you may have to add
", h=h, t=t, rotate=rotate, center=center, space=space, font=font"
onto the end of the parameters in those other module definitions.



-----
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
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
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!