You could supply cube(0) if you want an empty object and wrap it in
module called empty() for readability.
I notice now there is an empty() node in the csg products tree.
echo() doesn't seem to add an empty group now, so if (false) could do the
same.
if(false) has always added an empty group() before but that now seems to
get changed into an empty() node, which has changed the behaviour of
intersection. I don't know how often that will break existing code and the
workaround is messy.
On Fri, 2 Oct 2020 at 15:55, Jordan Brown jordan@maileater.net wrote:
On 10/2/2020 6:17 AM, nop head wrote:
I think cube(0) and a non-overlapping intersection or any other csg
operation that results in an empty object is different from a false
if, which is no object at all.
"if" always generates a group() in the CSG tree.
I think every module invocation generates something in the CSG tree. Note
that even echo() generates an empty group().
I don't know whether anybody uses it, but making a failing if generate
nothing could affect child-based patterns:
module foo() {
children(1);
}
foo() {
if (false) sphere();
cube();
}
now generates a cube, but would be an error.
I'd say we definitely could not have empty objects disappear from the
CSG tree in general, because then you couldn't supply a placeholder object
in a sequence of children.
You could supply cube(0) if you want an empty object and wrap it in
module called empty() for readability.
I notice now there is an empty() node in the csg products tree.
echo() doesn't seem to add an empty group now, so if (false) could do the
same.
if(false) has always added an empty group() before but that now seems to
get changed into an empty() node, which has changed the behaviour of
intersection. I don't know how often that will break existing code and the
workaround is messy.
On Fri, 2 Oct 2020 at 15:55, Jordan Brown <jordan@maileater.net> wrote:
> On 10/2/2020 6:17 AM, nop head wrote:
>
> I think cube(0) and a non-overlapping intersection or any other csg
> operation that results in an empty object is different from a false
> if, which is no object at all.
>
>
> "if" always generates a group() in the CSG tree.
>
> I think every module invocation generates something in the CSG tree. Note
> that even echo() generates an empty group().
>
> I don't know whether anybody uses it, but making a failing if generate
> nothing could affect child-based patterns:
>
> module foo() {
> children(1);
> }
>
> foo() {
> if (false) sphere();
> cube();
> }
>
> now generates a cube, but would be an error.
>
> I'd say we definitely *could not* have empty objects disappear from the
> CSG tree in general, because then you couldn't supply a placeholder object
> in a sequence of children.
>
>