I was wanting to use the projection function conditionally in a module but I
get an error, is there a way to do this? This is the code I have that gets
an error
module draw_circle(param1, param2, param3, flat="no") {
if (flat == "yes") {
projection()
}
draw shape code goes here
}
If I take out the if statement like so it does what I want
module draw_circle(param1, param2, param3, flat="no") {
projection()
draw shape code goes here
}
--
Sent from: http://forum.openscad.org/
This works:
module draw_circle(param1, param2, param3, flat=false) {
module draw_shape() {
sphere(param1);
}
if (flat) {
projection()
draw_shape();
}
else
draw_shape();
}
On 2 May 2018 at 18:19, fractorr fractorr@gmail.com wrote:
I was wanting to use the projection function conditionally in a module but
I
get an error, is there a way to do this? This is the code I have that gets
an error
module draw_circle(param1, param2, param3, flat="no") {
if (flat == "yes") {
projection()
}
draw shape code goes here
}
If I take out the if statement like so it does what I want
module draw_circle(param1, param2, param3, flat="no") {
projection()
draw shape code goes here
}
--
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Great, thanks. That will require a little re-orgranization of my code
but it will be worth it to have the ability to do.
On 5/2/18, nop head nop.head@gmail.com wrote:
This works:
module draw_circle(param1, param2, param3, flat=false) {
module draw_shape() {
sphere(param1);
}
if (flat) {
projection()
draw_shape();
}
else
draw_shape();
}
On 2 May 2018 at 18:19, fractorr fractorr@gmail.com wrote:
I was wanting to use the projection function conditionally in a module
but
I
get an error, is there a way to do this? This is the code I have that
gets
an error
module draw_circle(param1, param2, param3, flat="no") {
if (flat == "yes") {
projection()
}
draw shape code goes here
}
If I take out the if statement like so it does what I want
module draw_circle(param1, param2, param3, flat="no") {
projection()
draw shape code goes here
}
--
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
--
Trevor Orr
FractOrr Computer Services
fractorr.com
541-490-5697
Or something like this should work:
module conditional_project(flat) {
if (flat == "yes") {
projection() children();
} else {
children();
}
}
module draw_circle(param1, param2, param3, flat="no") {
conditional_project(flat) {
draw shape code goes here
}
}
But I would use a boolean rather than a string for "flat".