discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

What's wrong with this code?

M
Michele
Sat, Jan 3, 2015 6:07 PM

This code:

outerD = 60 ;      // Outside diamater
wearFactor = 0.07 ; // Reduce by this much to compensate for stretch
outerD = outerD - (outerD * wearFactor) ;

generates these errors:

Compiling design (CSG Tree generation)...
WARNING: Ignoring unknown variable 'wearFactor'.
WARNING: Ignoring unknown variable 'outerD'.
WARNING: Ignoring unknown variable 'outerD'.

But for the life of me I don't see what I'm doing wrong.  Help!

(Without the second and third lines above, the object renders just fine).

Version 2014.12.25 (git 73163f2) 32 bit Win XP

--
View this message in context: http://forum.openscad.org/What-s-wrong-with-this-code-tp10895.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

This code: outerD = 60 ; // Outside diamater wearFactor = 0.07 ; // Reduce by this much to compensate for stretch outerD = outerD - (outerD * wearFactor) ; generates these errors: Compiling design (CSG Tree generation)... WARNING: Ignoring unknown variable 'wearFactor'. WARNING: Ignoring unknown variable 'outerD'. WARNING: Ignoring unknown variable 'outerD'. But for the life of me I don't see what I'm doing wrong. Help! (Without the second and third lines above, the object renders just fine). Version 2014.12.25 (git 73163f2) 32 bit Win XP -- View this message in context: http://forum.openscad.org/What-s-wrong-with-this-code-tp10895.html Sent from the OpenSCAD mailing list archive at Nabble.com.
NH
nop head
Sat, Jan 3, 2015 6:16 PM

You can't use the same name to represent two values in OpenScad, because
they are constants not variables.

This works and also makes sense mathematically and is easier to understand:

targetOuterD = 60 ; // Outside diamater

wearFactor = 0.07 ; // Reduce by this much to compensate for stretch

outerD = targetOuterD - (targetOuterD * wearFactor) ;

On 3 January 2015 at 18:07, Michele denber@mindspring.com wrote:

This code:

outerD = 60 ;      // Outside diamater
wearFactor = 0.07 ; // Reduce by this much to compensate for stretch
outerD = outerD - (outerD * wearFactor) ;

generates these errors:

Compiling design (CSG Tree generation)...
WARNING: Ignoring unknown variable 'wearFactor'.
WARNING: Ignoring unknown variable 'outerD'.
WARNING: Ignoring unknown variable 'outerD'.

But for the life of me I don't see what I'm doing wrong.  Help!

(Without the second and third lines above, the object renders just fine).

Version 2014.12.25 (git 73163f2) 32 bit Win XP

--
View this message in context:
http://forum.openscad.org/What-s-wrong-with-this-code-tp10895.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

You can't use the same name to represent two values in OpenScad, because they are constants not variables. This works and also makes sense mathematically and is easier to understand: targetOuterD = 60 ; // Outside diamater wearFactor = 0.07 ; // Reduce by this much to compensate for stretch outerD = targetOuterD - (targetOuterD * wearFactor) ; On 3 January 2015 at 18:07, Michele <denber@mindspring.com> wrote: > This code: > > outerD = 60 ; // Outside diamater > wearFactor = 0.07 ; // Reduce by this much to compensate for stretch > outerD = outerD - (outerD * wearFactor) ; > > generates these errors: > > Compiling design (CSG Tree generation)... > WARNING: Ignoring unknown variable 'wearFactor'. > WARNING: Ignoring unknown variable 'outerD'. > WARNING: Ignoring unknown variable 'outerD'. > > But for the life of me I don't see what I'm doing wrong. Help! > > (Without the second and third lines above, the object renders just fine). > > Version 2014.12.25 (git 73163f2) 32 bit Win XP > > > > > -- > View this message in context: > http://forum.openscad.org/What-s-wrong-with-this-code-tp10895.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
T
tdeagan
Sat, Jan 3, 2015 6:19 PM

https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Variables
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Variables

works because outerD is only defined once.  In your code the compiler is
ignoring the original declaration and only paying attention to the second
one.

That's what I believe is happening.  The gurus will undoubtedly be able to
give a better understanding.

--
View this message in context: http://forum.openscad.org/What-s-wrong-with-this-code-tp10895p10897.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Variables <https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Variables> works because outerD is only defined once. In your code the compiler is ignoring the original declaration and only paying attention to the second one. That's what I _believe_ is happening. The gurus will undoubtedly be able to give a better understanding. -- View this message in context: http://forum.openscad.org/What-s-wrong-with-this-code-tp10895p10897.html Sent from the OpenSCAD mailing list archive at Nabble.com.
M
Michele
Sat, Jan 3, 2015 6:28 PM

/"You can't use the same name to represent two values in OpenScad, because
they are constants not variables."/

Holy moly, I never knew that.  Thanks!  That works fine now.

--
View this message in context: http://forum.openscad.org/What-s-wrong-with-this-code-tp10895p10898.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

/"You can't use the same name to represent two values in OpenScad, because they are constants not variables."/ Holy moly, I never knew that. Thanks! That works fine now. -- View this message in context: http://forum.openscad.org/What-s-wrong-with-this-code-tp10895p10898.html Sent from the OpenSCAD mailing list archive at Nabble.com.
M
Michele
Sat, Jan 3, 2015 6:32 PM

/"Variables are set at compile-time, not run-time"/

OK, well since this seems to be my day for dumb questions - how did you get
my code fragment to come out in a fixed pitch font?  I don't see any font
buttons in this editor window.

--
View this message in context: http://forum.openscad.org/What-s-wrong-with-this-code-tp10895p10899.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

/"Variables are set at compile-time, not run-time"/ OK, well since this seems to be my day for dumb questions - how did you get my code fragment to come out in a fixed pitch font? I don't see any font buttons in this editor window. -- View this message in context: http://forum.openscad.org/What-s-wrong-with-this-code-tp10895p10899.html Sent from the OpenSCAD mailing list archive at Nabble.com.
T
tdeagan
Sat, Jan 3, 2015 6:38 PM

Michele wrote

OK, well since this seems to be my day for dumb questions - how did you
get my code fragment to come out in a fixed pitch font?  I don't see any
font buttons in this editor window.

Hidden under the More button in the web page forum there is a menu item for
Raw Text.  It will put  tags around whatever you've selected.  Not sure how
to do it on the email side of things

--
View this message in context: http://forum.openscad.org/What-s-wrong-with-this-code-tp10895p10900.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Michele wrote > OK, well since this seems to be my day for dumb questions - how did you > get my code fragment to come out in a fixed pitch font? I don't see any > font buttons in this editor window. Hidden under the More button in the web page forum there is a menu item for Raw Text. It will put tags around whatever you've selected. Not sure how to do it on the email side of things -- View this message in context: http://forum.openscad.org/What-s-wrong-with-this-code-tp10895p10900.html Sent from the OpenSCAD mailing list archive at Nabble.com.
NH
nop head
Sat, Jan 3, 2015 6:42 PM

I am using gmail so it is just the font selection drop down under
formatting options: Fixed Width.

On 3 January 2015 at 18:38, tdeagan tim@deagan.net wrote:

Michele wrote

OK, well since this seems to be my day for dumb questions - how did you
get my code fragment to come out in a fixed pitch font?  I don't see any
font buttons in this editor window.

Hidden under the More button in the web page forum there is a menu item for
Raw Text.  It will put  tags around whatever you've selected.  Not sure how
to do it on the email side of things

--
View this message in context:
http://forum.openscad.org/What-s-wrong-with-this-code-tp10895p10900.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

I am using gmail so it is just the font selection drop down under formatting options: Fixed Width. On 3 January 2015 at 18:38, tdeagan <tim@deagan.net> wrote: > Michele wrote > > OK, well since this seems to be my day for dumb questions - how did you > > get my code fragment to come out in a fixed pitch font? I don't see any > > font buttons in this editor window. > > Hidden under the More button in the web page forum there is a menu item for > Raw Text. It will put tags around whatever you've selected. Not sure how > to do it on the email side of things > > > > -- > View this message in context: > http://forum.openscad.org/What-s-wrong-with-this-code-tp10895p10900.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
M
Michele
Sat, Jan 3, 2015 7:31 PM

Huh - well whadaya know about that?  So "raw text" means "fixed pitch".  I
guess you really do learn something new every day.  Or in my case  :-)
Thanks.

--
View this message in context: http://forum.openscad.org/What-s-wrong-with-this-code-tp10895p10902.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Huh - well whadaya know about that? So "raw text" means "fixed pitch". I guess you really do learn something new every day. Or in my case :-) Thanks. -- View this message in context: http://forum.openscad.org/What-s-wrong-with-this-code-tp10895p10902.html Sent from the OpenSCAD mailing list archive at Nabble.com.
M
MichaelAtOz
Sat, Jan 3, 2015 9:40 PM

Note that using raw has had the enclosed code not appear in the emails sent
to the mailing list on at least two occasions in the past. Not sure what
causes it, so I tend not to use it. YMMV


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. This work is published globally via the internet. :) 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/

View this message in context: http://forum.openscad.org/What-s-wrong-with-this-code-tp10895p10903.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Note that using raw has had the enclosed code not appear in the emails sent to the mailing list on at least two occasions in the past. Not sure what causes it, so I tend not to use it. YMMV ----- 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. This work is published globally via the internet. :) 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/ -- View this message in context: http://forum.openscad.org/What-s-wrong-with-this-code-tp10895p10903.html Sent from the OpenSCAD mailing list archive at Nabble.com.
MK
Marius Kintel
Sat, Jan 3, 2015 9:59 PM

On Jan 3, 2015, at 16:40 PM, MichaelAtOz oz.at.michael@gmail.com wrote:

Note that using raw has had the enclosed code not appear in the emails sent
to the mailing list on at least two occasions in the past. Not sure what
causes it, so I tend not to use it. YMMV

That’s correct. Such formatting does indeed not make it through to the mailing list.
I’m accepting assistance If anyone wants to help out figuring this out :)

-Marius

On Jan 3, 2015, at 16:40 PM, MichaelAtOz <oz.at.michael@gmail.com> wrote: > Note that using raw has had the enclosed code not appear in the emails sent > to the mailing list on at least two occasions in the past. Not sure what > causes it, so I tend not to use it. YMMV > That’s correct. Such formatting does indeed not make it through to the mailing list. I’m accepting assistance If anyone wants to help out figuring this out :) -Marius