discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Use of anonymous blocks in the wild??

TP
Torsten Paul
Wed, Mar 6, 2019 11:57 PM

...or add a semicolon ;-)

hull();
{
cube(10);
cylinder(d=5, h=20);
}

...or add a semicolon ;-) hull(); { cube(10); cylinder(d=5, h=20); }
HL
Hans L
Thu, Mar 7, 2019 12:29 AM

Should also be the same effect as using the group module.
(I'm not sure  group is really documented, but if you ever look at csg
output, you can see that children of control structures end up in a group
after evaluation, for example)

//hull()
group()
{
cube(10);
cylinder(d=5, h=20);
}

On Wed, Mar 6, 2019 at 5:54 PM MichaelAtOz oz.at.michael@gmail.com wrote:

You can do:

module n() children();  // noop - do nothing to the children, just pass
them
back

//hull()
n()
{
cube(10);
cylinder(d=5, h=20);
}


Admin - email* me if you need anything, or if I've done something stupid...

  • click on my MichaelAtOz label, there is a link to email me.

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.

The TPP is no simple “trade agreement.”  Fight it!
http://www.ourfairdeal.org/  time is running out!

Sent from: http://forum.openscad.org/


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

Should also be the same effect as using the group module. (I'm not sure group is really documented, but if you ever look at csg output, you can see that children of control structures end up in a group after evaluation, for example) //hull() group() { cube(10); cylinder(d=5, h=20); } On Wed, Mar 6, 2019 at 5:54 PM MichaelAtOz <oz.at.michael@gmail.com> wrote: > You can do: > > module n() children(); // noop - do nothing to the children, just pass > them > back > > //hull() > n() > { > cube(10); > cylinder(d=5, h=20); > } > > > > ----- > Admin - email* me if you need anything, or if I've done something stupid... > > * click on my MichaelAtOz label, there is a link to email me. > > 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. > > The TPP is no simple “trade agreement.” Fight it! > http://www.ourfairdeal.org/ time is running out! > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
S
shadowwynd
Thu, Mar 7, 2019 1:55 AM

The thought of deliberately adding a semicolon to disable code - something
that has accidentally tripped me up countless times - is truly horrifying.

--
Sent from: http://forum.openscad.org/

The thought of deliberately adding a semicolon to disable code - something that has accidentally tripped me up countless times - is truly horrifying. -- Sent from: http://forum.openscad.org/
HJ
Hugo Jackson
Fri, Mar 22, 2019 4:29 AM

Anonymous blocks are useful for grouping children. e.g.

module union_diff() {
difference() {
union()
children(0);
children(1);
}
}

union_diff() {
{ // first the union
_circle(3);
back(2)
_circle(4);}
{ // then the diff
_rect(2);
}
}

On Mar 6, 2019, at 5:55 PM, shadowwynd shadowwynd@gmail.com wrote:

The thought of deliberately adding a semicolon to disable code - something
that has accidentally tripped me up countless times - is truly horrifying.

--
Sent from: http://forum.openscad.org/


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

Anonymous blocks are useful for grouping children. e.g. module union_diff() { difference() { union() children(0); children(1); } } union_diff() { { // first the union _circle(3); back(2) _circle(4);} { // then the diff _rect(2); } } > On Mar 6, 2019, at 5:55 PM, shadowwynd <shadowwynd@gmail.com> wrote: > > The thought of deliberately adding a semicolon to disable code - something > that has accidentally tripped me up countless times - is truly horrifying. > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
HJ
Hugo Jackson
Fri, Mar 22, 2019 4:32 AM

<sigh> I must be on drugs.
Forget that… it doesn’t work. I thought it worked… but obviously my brain is not working.

On Mar 21, 2019, at 9:29 PM, Hugo Jackson hugo@apres.net wrote:

Anonymous blocks are useful for grouping children. e.g.

module union_diff() {
difference() {
union()
children(0);
children(1);
}
}

union_diff() {
{ // first the union
_circle(3);
back(2)
_circle(4);}
{ // then the diff
_rect(2);
}
}

On Mar 6, 2019, at 5:55 PM, shadowwynd shadowwynd@gmail.com wrote:

The thought of deliberately adding a semicolon to disable code - something
that has accidentally tripped me up countless times - is truly horrifying.

--
Sent from: http://forum.openscad.org/


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

<sigh> I must be on drugs. Forget that… it doesn’t work. I thought it worked… but obviously my brain is not working. > On Mar 21, 2019, at 9:29 PM, Hugo Jackson <hugo@apres.net> wrote: > > Anonymous blocks are useful for grouping children. e.g. > > module union_diff() { > difference() { > union() > children(0); > children(1); > } > } > > union_diff() { > { // first the union > _circle(3); > back(2) > _circle(4);} > { // then the diff > _rect(2); > } > } > > > > > >> On Mar 6, 2019, at 5:55 PM, shadowwynd <shadowwynd@gmail.com> wrote: >> >> The thought of deliberately adding a semicolon to disable code - something >> that has accidentally tripped me up countless times - is truly horrifying. >> >> >> >> -- >> Sent from: http://forum.openscad.org/ >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
G
grit
Fri, Mar 22, 2019 7:02 PM

Same here , I use it for translating object every now and then for debugging,
but I don't expect the braces to express a new scope in that case.

/Henrik

--
Sent from: http://forum.openscad.org/

Same here , I use it for translating object every now and then for debugging, but I don't expect the braces to express a new scope in that case. /Henrik -- Sent from: http://forum.openscad.org/