Hello,
This code is working fine (all variables are defined at some point but I
don't paste all the code):
step_start_points = [ for (a=[0:len(ext_avec_bordure)-1]) [ for (b = [ 0 : 1
])
points_interieur[a][b]
+ diff_points[a][b] * (asin(i/(extrude_steps) * 2 - 1) / 180. + 0.5)] ];
step_end_points = [ for (a=[0:len(ext_avec_bordure)-1]) [ for (b = [ 0 : 1
])
points_interieur[a][b]
+ diff_points[a][b] * (asin((i+1)/(extrude_steps) * 2 - 1) / 180. + 0.5)]
];
However, if I modify it like this...
ext_type = 1;
if (ext_type == 1) {
step_start_points = [ for (a=[0:len(ext_avec_bordure)-1]) [ for (b = [
0 : 1 ])
points_interieur[a][b]
+ diff_points[a][b] * (asin(i/(extrude_steps) * 2 - 1) / 180. + 0.5)] ];
step_end_points = [ for (a=[0:len(ext_avec_bordure)-1]) [ for (b = [ 0 : 1
])
points_interieur[a][b]
+ diff_points[a][b] * (asin((i+1)/(extrude_steps) * 2 - 1) / 180. + 0.5)]
];
}
...I have two error messages:
WARNING: Ignoring unknown variable 'step_start_points', in file extrusion
profil dax + relief V13.scad, line 76.
WARNING: Ignoring unknown variable 'step_end_points', in file extrusion
profil dax + relief V13.scad, line 76.
What's wrong?
--
Sent from: http://forum.openscad.org/
When you define a variable in a block it goes out of scope at the end of
the block. I.e. at the closing brace. Presumably something at line 76 tries
to use it.
On Mon, 6 Jul 2020 at 10:14, amundsen roald.baudoux@brutele.be wrote:
Hello,
This code is working fine (all variables are defined at some point but I
don't paste all the code):
step_start_points = [ for (a=[0:len(ext_avec_bordure)-1]) [ for (b = [ 0 :
1
])
points_interieur[a][b]
+ diff_points[a][b] * (asin(i/(extrude_steps) * 2 - 1) / 180. +
0.5)] ];
step_end_points = [ for (a=[0:len(ext_avec_bordure)-1]) [ for (b = [ 0 : 1
])
points_interieur[a][b]
+ diff_points[a][b] * (asin((i+1)/(extrude_steps) * 2 - 1) / 180.
However, if I modify it like this...
ext_type = 1;
if (ext_type == 1) {
step_start_points = [ for (a=[0:len(ext_avec_bordure)-1]) [ for (b =
[
0 : 1 ])
points_interieur[a][b]
+ diff_points[a][b] * (asin(i/(extrude_steps) * 2 - 1) / 180. +
0.5)] ];
step_end_points = [ for (a=[0:len(ext_avec_bordure)-1]) [ for (b = [ 0 : 1
])
points_interieur[a][b]
+ diff_points[a][b] * (asin((i+1)/(extrude_steps) * 2 - 1) / 180.
...I have two error messages:
WARNING: Ignoring unknown variable 'step_start_points', in file extrusion
profil dax + relief V13.scad, line 76.
WARNING: Ignoring unknown variable 'step_end_points', in file extrusion
profil dax + relief V13.scad, line 76.
What's wrong?
--
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
On Mon, Jul 06, 2020 at 10:16:56AM +0100, nop head wrote:
When you define a variable in a block it goes out of scope at the end of
the block. I.e. at the closing brace. Presumably something at line 76 tries
to use it.
On Mon, 6 Jul 2020 at 10:14, amundsen roald.baudoux@brutele.be wrote:
Hello,
This code is working fine (all variables are defined at some point but I
don't paste all the code):
ext_type = 1;
if (ext_type == 1) {
Basically what you want is to assign a (different) value when ext_type
== 1.
Due to the reason nop-head explained above, what you're trying isn't
working.
You need to do:
step_end_points = ext_type == 1) ? /* something / : / ... somethingelse */ ;
Roger.
--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 **
** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 **
The plan was simple, like my brother-in-law Phil. But unlike
Phil, this plan just might work.