I know the idea behind each of them, but how do they interact? Suppose I
specify all three of them and then draw a cylinder of radius r, how does
OpenSCAD decide how many sides to make it with?
In other words, it is almost always impossible to have exactly $fn sides,
$fs long and covering $fa degrees each... How is this conflict solved?
$fn, $fa, $fs are special variables reported in the manual page
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Other_Language_Features#.24fa.2C_.24fs_and_.24fn
where an algorithm shows how a final value is chosen.
2016-07-18 11:48 GMT-03:00 Lucas Vinicius Hartmann <lucas.hartmann@gmail.com
:
I know the idea behind each of them, but how do they interact? Suppose I
specify all three of them and then draw a cylinder of radius r, how does
OpenSCAD decide how many sides to make it with?
In other words, it is almost always impossible to have exactly $fn sides,
$fs long and covering $fa degrees each... How is this conflict solved?
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
In english that code reads:
If $fn is defined then $fn fragments.
otherwise the least number of fragments to satisfy EITHER $fn OR $fa.
That's what I wanted, thanks. :-)
--
Lucas Vinicius Hartmann
Dizem que se você rodar o CD do Windows ao contrário ele mostra uma
mensagem demoníaca... Mas isso nem é o pior, se você rodar ele normal ele
instala o Windows!
2016-07-18 12:38 GMT-03:00 Ronaldo Persiano rcmpersiano@gmail.com:
$fn, $fa, $fs are special variables reported in the manual page
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Other_Language_Features#.24fa.2C_.24fs_and_.24fn
where an algorithm shows how a final value is chosen.
2016-07-18 11:48 GMT-03:00 Lucas Vinicius Hartmann <
lucas.hartmann@gmail.com>:
I know the idea behind each of them, but how do they interact? Suppose I
specify all three of them and then draw a cylinder of radius r, how does
OpenSCAD decide how many sides to make it with?
In other words, it is almost always impossible to have exactly $fn sides,
$fs long and covering $fa degrees each... How is this conflict solved?
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
(int)
ceil( // round it up.
fmax(
fmin( // Use the min of the following two
segments
360.0 / fa // 360/angle= number of segments
, r2M_PI / fs) // 2pi*r = circumference/fs= number of segments
, 5) // this means 5 is the minimum if above is
<5
)
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.
View this message in context: http://forum.openscad.org/fn-fa-and-fs-tp17932p17936.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Other words, given that both conditions yield more than 5 fragments:
Fragments will never be less than $fa degrees, no matter how large the
circle.
Fragments will never be shorter that $fs, no matter how small the circle.
I guess if would be interesting if that function could be exposed to the
openscad language, so we would be able to override it should we feel the
need to.
Em 18 de jul de 2016 19:46, "MichaelAtOz" oz.at.michael@gmail.com
escreveu:
(int)
ceil( // round it up.
fmax(
fmin( // Use the min of the following two
segments
360.0 / fa // 360/angle= number of segments
, r2M_PI / fs) // 2pi*r = circumference/fs= number of
segments
, 5) // this means 5 is the minimum if above
is
<5
)
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.
View this message in context:
http://forum.openscad.org/fn-fa-and-fs-tp17932p17936.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
lhartmann wrote
I guess if would be interesting if that function could be exposed to the
openscad language, so we would be able to override it should we feel the
need to.
You just set $fn to however you want to calculate it. You can read $fa $fs
variables (& $fn) just like normal variables.
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.
View this message in context: http://forum.openscad.org/fn-fa-and-fs-tp17932p17946.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
That works, but you have to do it for every single circle because you can
not read radius.
Or I can create new modules, mycircle, mycylinder, mysphere, and do the
math any way I want. Yeah, this will work.
Thanks.
Em 20 de jul de 2016 02:16, "MichaelAtOz" oz.at.michael@gmail.com
escreveu:
lhartmann wrote
I guess if would be interesting if that function could be exposed to the
openscad language, so we would be able to override it should we feel the
need to.
You just set $fn to however you want to calculate it. You can read $fa $fs
variables (& $fn) just like normal variables.
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.
View this message in context:
http://forum.openscad.org/fn-fa-and-fs-tp17932p17946.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