Recursive Module Not Rendering

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

Recursive Module Not Rendering

Max Bond
Hi,

I was wondering if I could get some guidance. I'm writing a model with a recursive module, and I want to operate on the children with some transformations. However, whenever I try to operate on the children, they fail to render.

Here is a simplified test case:

module test(d=5) {
    if(d>0) {
        test(d-1)
        union() {
            circle();
            children();
        }
    }
}

test();

Commenting out the union causes the circles to render. While the union does nothing here, the same goes for things like rotate that I rather need.

I'm using 2019.05.

Thanks,
Max

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Recursive Module Not Rendering

nophead
I think you need else children(); after the if or the result will be nothing.

On Tue, 10 Dec 2019 at 18:40, Max Bond <[hidden email]> wrote:
Hi,

I was wondering if I could get some guidance. I'm writing a model with a recursive module, and I want to operate on the children with some transformations. However, whenever I try to operate on the children, they fail to render.

Here is a simplified test case:

module test(d=5) {
    if(d>0) {
        test(d-1)
        union() {
            circle();
            children();
        }
    }
}

test();

Commenting out the union causes the circles to render. While the union does nothing here, the same goes for things like rotate that I rather need.

I'm using 2019.05.

Thanks,
Max
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Recursive Module Not Rendering

Max Bond
D'oh! You're right.

Thanks!

On Tue, Dec 10, 2019 at 11:49 AM nop head <[hidden email]> wrote:
I think you need else children(); after the if or the result will be nothing.

On Tue, 10 Dec 2019 at 18:40, Max Bond <[hidden email]> wrote:
Hi,

I was wondering if I could get some guidance. I'm writing a model with a recursive module, and I want to operate on the children with some transformations. However, whenever I try to operate on the children, they fail to render.

Here is a simplified test case:

module test(d=5) {
    if(d>0) {
        test(d-1)
        union() {
            circle();
            children();
        }
    }
}

test();

Commenting out the union causes the circles to render. While the union does nothing here, the same goes for things like rotate that I rather need.

I'm using 2019.05.

Thanks,
Max
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Recursive Module Not Rendering

acwest
In reply to this post by nophead
Not sure why that is necessary, particularly since children() is empty...

On Tue, Dec 10, 2019 at 1:49 PM nop head <[hidden email]> wrote:

>
> I think you need else children(); after the if or the result will be nothing.
>
> On Tue, 10 Dec 2019 at 18:40, Max Bond <[hidden email]> wrote:
>>
>> Hi,
>>
>> I was wondering if I could get some guidance. I'm writing a model with a recursive module, and I want to operate on the children with some transformations. However, whenever I try to operate on the children, they fail to render.
>>
>> Here is a simplified test case:
>>
>> module test(d=5) {
>>     if(d>0) {
>>         test(d-1)
>>         union() {
>>             circle();
>>             children();
>>         }
>>     }
>> }
>>
>> test();
>>
>> Commenting out the union causes the circles to render. While the union does nothing here, the same goes for things like rotate that I rather need.
>>
>> I'm using 2019.05.
>>
>> Thanks,
>> Max
>> _______________________________________________
>> OpenSCAD mailing list
>> [hidden email]
>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Recursive Module Not Rendering

acwest
never mind, I missed the obvious...

On Tue, Dec 10, 2019 at 1:56 PM A. Craig West <[hidden email]> wrote:

>
> Not sure why that is necessary, particularly since children() is empty...
>
> On Tue, Dec 10, 2019 at 1:49 PM nop head <[hidden email]> wrote:
> >
> > I think you need else children(); after the if or the result will be nothing.
> >
> > On Tue, 10 Dec 2019 at 18:40, Max Bond <[hidden email]> wrote:
> >>
> >> Hi,
> >>
> >> I was wondering if I could get some guidance. I'm writing a model with a recursive module, and I want to operate on the children with some transformations. However, whenever I try to operate on the children, they fail to render.
> >>
> >> Here is a simplified test case:
> >>
> >> module test(d=5) {
> >>     if(d>0) {
> >>         test(d-1)
> >>         union() {
> >>             circle();
> >>             children();
> >>         }
> >>     }
> >> }
> >>
> >> test();
> >>
> >> Commenting out the union causes the circles to render. While the union does nothing here, the same goes for things like rotate that I rather need.
> >>
> >> I'm using 2019.05.
> >>
> >> Thanks,
> >> Max
> >> _______________________________________________
> >> OpenSCAD mailing list
> >> [hidden email]
> >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
> >
> > _______________________________________________
> > OpenSCAD mailing list
> > [hidden email]
> > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Recursive Module Not Rendering

Max Bond
You and I both :)

On Tue, Dec 10, 2019 at 11:58 AM A. Craig West <[hidden email]> wrote:
never mind, I missed the obvious...

On Tue, Dec 10, 2019 at 1:56 PM A. Craig West <[hidden email]> wrote:
>
> Not sure why that is necessary, particularly since children() is empty...
>
> On Tue, Dec 10, 2019 at 1:49 PM nop head <[hidden email]> wrote:
> >
> > I think you need else children(); after the if or the result will be nothing.
> >
> > On Tue, 10 Dec 2019 at 18:40, Max Bond <[hidden email]> wrote:
> >>
> >> Hi,
> >>
> >> I was wondering if I could get some guidance. I'm writing a model with a recursive module, and I want to operate on the children with some transformations. However, whenever I try to operate on the children, they fail to render.
> >>
> >> Here is a simplified test case:
> >>
> >> module test(d=5) {
> >>     if(d>0) {
> >>         test(d-1)
> >>         union() {
> >>             circle();
> >>             children();
> >>         }
> >>     }
> >> }
> >>
> >> test();
> >>
> >> Commenting out the union causes the circles to render. While the union does nothing here, the same goes for things like rotate that I rather need.
> >>
> >> I'm using 2019.05.
> >>
> >> Thanks,
> >> Max
> >> _______________________________________________
> >> OpenSCAD mailing list
> >> [hidden email]
> >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
> >
> > _______________________________________________
> > OpenSCAD mailing list
> > [hidden email]
> > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org