Union

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Union

nophead
Does union actually do anything?

I sometimes forget it and just put things overlapping each other and it doesn't seem to matter.
Reply | Threaded
Open this post in threaded view
|

Re: Union

Brad Pitcher
I've wondered the same thing. As far as I can tell the only benefit is giving you the ability to apply transforms to groups of objects.

On Fri, Jan 20, 2012 at 11:58 AM, nop head <[hidden email]> wrote:
Does union actually do anything?

I sometimes forget it and just put things overlapping each other and it doesn't seem to matter.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad


Reply | Threaded
Open this post in threaded view
|

Re: Union

nophead
But so does enclosing them in braces. And then there is group(), which seems to be undocumented but I found it useful to pass multiple objects as a child when braces did not work.

On 20 January 2012 20:02, Brad Pitcher <[hidden email]> wrote:
I've wondered the same thing. As far as I can tell the only benefit is giving you the ability to apply transforms to groups of objects.

On Fri, Jan 20, 2012 at 11:58 AM, nop head <[hidden email]> wrote:
Does union actually do anything?

I sometimes forget it and just put things overlapping each other and it doesn't seem to matter.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad


Reply | Threaded
Open this post in threaded view
|

Re: Union

M.Rule
braces should be interpreted as implicit union, I think ( except for diff, where it should be interpreted as implicit union over all but the first object? ) ??

On Fri, Jan 20, 2012 at 3:21 PM, nop head <[hidden email]> wrote:
But so does enclosing them in braces. And then there is group(), which seems to be undocumented but I found it useful to pass multiple objects as a child when braces did not work.

On 20 January 2012 20:02, Brad Pitcher <[hidden email]> wrote:
I've wondered the same thing. As far as I can tell the only benefit is giving you the ability to apply transforms to groups of objects.

On Fri, Jan 20, 2012 at 11:58 AM, nop head <[hidden email]> wrote:
Does union actually do anything?

I sometimes forget it and just put things overlapping each other and it doesn't seem to matter.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad


Reply | Threaded
Open this post in threaded view
|

Re: Union

Whosawhatsis
I use union to merge several objects before subtracting from the unioned object with difference or intersection, though I think the objects enclosed in any module are implicitly unioned after the module's own operations are applied. The whole scene is understandably contained in an implicit union to prevent the final mesh from being non-manifold due to intersection.

On Friday, January 20, 2012 at 12:35 PM, M.Rule wrote:
braces should be interpreted as implicit union, I think ( except for diff, where it should be interpreted as implicit union over all but the first object? ) ??

On Fri, Jan 20, 2012 at 3:21 PM, nop head <[hidden email]> wrote:
But so does enclosing them in braces. And then there is group(), which seems to be undocumented but I found it useful to pass multiple objects as a child when braces did not work.

On 20 January 2012 20:02, Brad Pitcher <[hidden email]> wrote:
I've wondered the same thing. As far as I can tell the only benefit is giving you the ability to apply transforms to groups of objects.

On Fri, Jan 20, 2012 at 11:58 AM, nop head <[hidden email]> wrote:
Does union actually do anything?

I sometimes forget it and just put things overlapping each other and it doesn't seem to matter.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad


_______________________________________________
OpenSCAD mailing list

Reply | Threaded
Open this post in threaded view
|

Re: Union

Giles Bathgate-2
union(), group(), a list of objects, and a list of objects in
parenthesis are currently all identical. group() may be implemented
differently in the future.

e.g.

--------------------------------------

{
cube(10);
cube(10);
}

--------------------------------------

cube(10);
cube(10);

--------------------------------------

union() {
  cube(10);
  cube(10);
}

--------------------------------------

group() {
  cube(10);
  cube(10);
}

Reply | Threaded
Open this post in threaded view
|

Re: Union

nophead
Not quite true when you use child() in a module and follow it by a more than one objects in braces. It only takes the first one as the child but if you add group() it works.

On 20 January 2012 22:47, Giles Bathgate <[hidden email]> wrote:
union(), group(), a list of objects, and a list of objects in
parenthesis are currently all identical. group() may be implemented
differently in the future.

e.g.

--------------------------------------

{
cube(10);
cube(10);
}

--------------------------------------

cube(10);
cube(10);

--------------------------------------

union() {
 cube(10);
 cube(10);
}

--------------------------------------

group() {
 cube(10);
 cube(10);
}
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad

Reply | Threaded
Open this post in threaded view
|

Re: Union

kintel
Administrator
In reply to this post by nophead
Hi,

Some design advice:
1) If you want to union objects, try to use an explicit union(), as that makes the intentions of your code clear, and it's forwards compatible
2) Don't use group(). It's undocumented for a reason. Groups are _usually_ unioned, but don't be dependent on that being the case in the future.

My future ideas involve less implicit unioning, e.g. let for() loops pass lists of objects to it's parent and let it decide what to do with the result.
This is inspired by Giles/RapCad, where some of this is already implemented in a more general fashion.

 -Marius


Reply | Threaded
Open this post in threaded view
|

Re: Union

nophead
How does one avoid group when passing multiple objects to child? I would have expected braces to work but they don't. Does one use union? but that would seem odd when they separate objects.

I have also used group after difference() where I want to subtract one thing (a screw hole) from two objects (the two things screwed together). Again it makes little sense to union them as they don't overlap.

On 21 January 2012 10:00, Marius Kintel <[hidden email]> wrote:
Hi,

Some design advice:
1) If you want to union objects, try to use an explicit union(), as that makes the intentions of your code clear, and it's forwards compatible
2) Don't use group(). It's undocumented for a reason. Groups are _usually_ unioned, but don't be dependent on that being the case in the future.

My future ideas involve less implicit unioning, e.g. let for() loops pass lists of objects to it's parent and let it decide what to do with the result.
This is inspired by Giles/RapCad, where some of this is already implemented in a more general fashion.

 -Marius

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad