This works:
// Cut along y axis
module cut_shape_y(keep = "left"){
if(keep == "left"){
intersection(){ children(); left_xy_plane(); }
}else if(keep == "right"){
intersection(){ children(); right_xy_plane(); }
}else if (keep == "both"){
intersection(){ children(); left_xy_plane(); }
intersection(){ children(); right_xy_plane(); }
}
}
xy_plane modules are simply large squares that define the planes to enable
various cutting operations and such.
However, the following does not work, and issues no warnings or errors. It
simply draws the plane, the intersection never occurs because (I think) the
submodule doesn't receive the children of the main module.
// Cut along y axis
module cut_shape_y(keep = "left"){
module left(){
intersection(){
children();
left_xy_plane();
}
}
module right(){
intersection(){
children();
right_xy_plane();
}
}
if(keep == "left"){ left();}
else if(keep == "right"){ right();}
else if (keep == "both"){ left(); right();}
}
Even calling left() children(); doesn't work instead of just left(); as in
the code above.
This is a scoping issue. Either it should throw a warning specifying that
submodules cannot access module's children, or better yet, it should work.
--
View this message in context: http://forum.openscad.org/children-not-being-passed-to-submodules-tp18722.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
On 10/15/2016 11:10 PM, a.human wrote:
Even calling left() children(); doesn't work instead of
just left(); as in the code above.
Are you sure you did not do:
left(); /* <- extra semicolon */ children(); ?
What I've tested worked fine, if it's still not working
for you, I'd suggest to post a fully working example
instead of just a snippet.
ciao,
Torsten.
Oops! Embarrassed :)
You are right, I did left(); children(); instead of left() children();
Thanks much,Have a great day,A human
On 10/15/2016 11:10 PM, a.human wrote:
Even calling left() children(); doesn't work instead of
just left(); as in the code above.
Are you sure you did not do:
left(); /* <- extra semicolon */ children(); ?
What I've tested worked fine, if it's still not working
for you, I'd suggest to post a fully working example
instead of just a snippet.
ciao,
Torsten.
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-- Torsten >
If you reply to this email, your message will be added to the discussion below:> > http://forum.openscad.org/children-not-being-passed-to-submodules-tp18722p18723.html> > > To unsubscribe from children not being passed to submodules, > click here> .
NAML>
--
View this message in context: http://forum.openscad.org/children-not-being-passed-to-submodules-tp18722p18724.html
Sent from the OpenSCAD mailing list archive at Nabble.com.