discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

constructive-lib funnel?

NH
nop head
Fri, Sep 22, 2023 6:58 PM

Not really because someone could put in a library and break client code.

On Fri, 22 Sept 2023, 19:55 pproj@posteo.de, pproj@posteo.de wrote:

OK, i see.
Thanks nophead.
i still think that the "Option Explicit" like mechanism should resolve
the Problem
On 22.09.23 20:46, nop head wrote:

The reason is because the original implementation of openscad had a
limitation that only allowed module to return a single child. That was
found to be a limitation when using children() as the only way to pass
multiple children was by enclosing them in braces. You couldn't use a for
loop or an object made by a user module. Also a big performance hit

doing a

top level implicit union for output formats that support multiple

objects.

The only way to fix it is not backwards compatible.

On Fri, 22 Sept 2023, 18:49 pproj@posteo.de, pproj@posteo.de wrote:

Thanks Nophead,
i meant why, in the sense of what are the reasons for it.

perhaps we could have something like "option explicit" for javascript,
so if one includes it in the code, the code will not compile until you
turn the Lazy unions off.
Resulting in an Error Message, telling what to do.
so everybody could ensure compatibility, but experimental features can
still be enabled

On 22.09.23 18:53, nop head wrote:

Because without lazy unions most operations do an implicit union and

return

a single child. Lazy unions stop that so in some places you would need

to

add an explicit union to preserve the semantics. That is why it is

disabled

by default. I personally never enable it.

On Fri, 22 Sept 2023, 17:47 pproj@posteo.de, pproj@posteo.de wrote:

ehmm... it is indeed a strong semantic change then. do you know why?

On 22.09.23 18:34, nop head wrote:

Because without lazy union a for does an implicit union, so you get

an

intersection with one child that is a NOP. When lazy union is on each
iteration of the loop will be intersected with all the others. There

is

intersection_for to do the same thing without lazy unions.

On Fri, 22 Sept 2023 at 17:16, pproj@posteo.de pproj@posteo.de

wrote:

So Ken has figured out the cause for extrusion problems was "lazy

unions",

i was able to fix it by removing a single child intersection() which

was

not needed any more and doing nothing anyway, from the code below,
Anybody any idea, why a single child intersection() causes problems

with

lazy unions?

[...]

         doChamferBox(lx=lx,ly=ly,lz=lz)
              cube([lx,ly,lz],center=true);

[.....]

module doChamferBox(lx,ly,lz,chamferInfo=chamferInfo(),childFn=$fn)
{
[.....]

     for( i = [chamferInfo[0] , chamferInfo[1]] )

{
r=i[1];
rSide=i[2];
fnCorner=i[3];
up( (lz==undef )?0:((lz/2-abs(r))i[0]))
mirror([0,0,i[0]>0?0:1])
linear_extrude(height=abs(r)
,slices=1
,scale=[(lx+2
r)/lx,(ly+2*r)/ly])
resize([lx,ly])
offset(r = abs( rSide ), $fn = fnCorner)
square([lx,ly],center=true,$fn=childFn);
}

//this inteesection() seems is a non functional leftover and was

causing

the problem with lazy unions

   intersection()
     {
           for(i=[chamferInfo[0],chamferInfo[1]])
           {
                 r=i[1];
                 rSide=i[2];
                   fnCorner=i[3];

               mirror([0,0,i[0]>0?0:1])
                   down(chamferInfo[1]==undef?lz/2:0.02)
                    linear_extrude(
                    height=(chamferInfo[1]==undef?lz:lz/2)
                             -abs(r)+.05
               ,slices=1)
                          resize([lx,ly])
                              offset(r=abs(rSide),$fn=fnCorner)
                      square([lx,ly],center=true,$fn=childFn);
           }
   }

else  children();
}


On 22.09.23 00:52, Ken wrote:

include<constructive-compiled.scad>
$fa = 2;
$fs = 0.5;

chamfer(-4,-2) tube(d=20, h=12, wall=3);

it works as expected- I get a nicely chamfered tube. If I

change

it

to

chamfer(-2,-2,-2) g(turnXY(45), X(60)) box(20);

or

chamfer(-1,-2,-3) X(-40)box(10,x=35,h=15);

On 22.09.23 17:07, pproj@posteo.de wrote:

HEllo Ken, thanks for figuring out cause,

there are various ways:

include <../../devlibs/constructive/constructive-all.scad>

$fn=60;
assemble()
{
add()
tube(d=20,d2=10,h=10,wall=3);

 //chamfering has a side effect when using d2, so it will look

like

this

add(X(25),chamfer(-2,-2))
tube(d=20,d2=10,h=10,wall=3);

//i would use the bentStrip()with a 2d primitive Bodylike circle,

instead

add(X(50),reflectZ())
rotate_extrude()
X(6)bentStrip([Y(10),turnXY(-45),Y(10)])
circle(d=2);
}

i would need to add this example to the tutorial or the

Constructive's

Gallery

beside this you could always use regular cylinder([]) instead of

tube,

it just will not react on alignments, but it will on translations

like

X(10)

On 22.09.23 01:28, Ken wrote:

Is there a way of constructing a funnel using the
constructive-compiled library? I searched the tutorials but didn't
find anything, and have experimented with the syntax of a

chamfered

tube with no success. Normally I would just difference two cones,

but

it would be interesting to do it using theconstructive-compiled
library..


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Not really because someone could put in a library and break client code. On Fri, 22 Sept 2023, 19:55 pproj@posteo.de, <pproj@posteo.de> wrote: > OK, i see. > Thanks nophead. > i still think that the "Option Explicit" like mechanism should resolve > the Problem > On 22.09.23 20:46, nop head wrote: > > The reason is because the original implementation of openscad had a > > limitation that only allowed module to return a single child. That was > > found to be a limitation when using children() as the only way to pass > > multiple children was by enclosing them in braces. You couldn't use a for > > loop or an object made by a user module. Also a big performance hit > doing a > > top level implicit union for output formats that support multiple > objects. > > The only way to fix it is not backwards compatible. > > > > On Fri, 22 Sept 2023, 18:49 pproj@posteo.de, <pproj@posteo.de> wrote: > > > >> Thanks Nophead, > >> i meant why, in the sense of what are the reasons for it. > >> > >> perhaps we could have something like "option explicit" for javascript, > >> so if one includes it in the code, the code will not compile until you > >> turn the Lazy unions off. > >> Resulting in an Error Message, telling what to do. > >> so everybody could ensure compatibility, but experimental features can > >> still be enabled > >> > >> On 22.09.23 18:53, nop head wrote: > >>> Because without lazy unions most operations do an implicit union and > >> return > >>> a single child. Lazy unions stop that so in some places you would need > to > >>> add an explicit union to preserve the semantics. That is why it is > >> disabled > >>> by default. I personally never enable it. > >>> > >>> On Fri, 22 Sept 2023, 17:47 pproj@posteo.de, <pproj@posteo.de> wrote: > >>> > >>>> ehmm... it is indeed a strong semantic change then. do you know why? > >>>> > >>>> On 22.09.23 18:34, nop head wrote: > >>>>> Because without lazy union a for does an implicit union, so you get > an > >>>>> intersection with one child that is a NOP. When lazy union is on each > >>>>> iteration of the loop will be intersected with all the others. There > is > >>>>> intersection_for to do the same thing without lazy unions. > >>>>> > >>>>> On Fri, 22 Sept 2023 at 17:16, pproj@posteo.de <pproj@posteo.de> > >> wrote: > >>>>>> So Ken has figured out the cause for extrusion problems was "lazy > >>>> unions", > >>>>>> i was able to fix it by removing a single child intersection() which > >> was > >>>>>> not needed any more and doing nothing anyway, from the code below, > >>>>>> Anybody any idea, why a single child intersection() causes problems > >> with > >>>>>> lazy unions? > >>>>>> > >>>>>> > >>>>>> [...] > >>>>>> > >>>>>> doChamferBox(lx=lx,ly=ly,lz=lz) > >>>>>> cube([lx,ly,lz],center=true); > >>>>>> > >>>>>> [.....] > >>>>>> > >>>>>> module doChamferBox(lx,ly,lz,chamferInfo=chamferInfo(),childFn=$fn) > >>>>>> { > >>>>>> [.....] > >>>>>> > >>>>>> for( i = [chamferInfo[0] , chamferInfo[1]] ) > >>>>>> { > >>>>>> r=i[1]; > >>>>>> rSide=i[2]; > >>>>>> fnCorner=i[3]; > >>>>>> up( (lz==undef )?0:((lz/2-abs(r))*i[0])) > >>>>>> mirror([0,0,i[0]>0?0:1]) > >>>>>> linear_extrude(height=abs(r) > >>>>>> ,slices=1 > >>>>>> ,scale=[(lx+2*r)/lx,(ly+2*r)/ly]) > >>>>>> resize([lx,ly]) > >>>>>> offset(r = abs( rSide ), $fn = fnCorner) > >>>>>> square([lx,ly],center=true,$fn=childFn); > >>>>>> } > >>>>>> > >>>>>> //this inteesection() seems is a non functional leftover and was > >> causing > >>>>>> the problem with lazy unions > >>>>>> > >>>>>> intersection() > >>>>>> { > >>>>>> for(i=[chamferInfo[0],chamferInfo[1]]) > >>>>>> { > >>>>>> r=i[1]; > >>>>>> rSide=i[2]; > >>>>>> fnCorner=i[3]; > >>>>>> > >>>>>> mirror([0,0,i[0]>0?0:1]) > >>>>>> down(chamferInfo[1]==undef?lz/2:0.02) > >>>>>> linear_extrude( > >>>>>> height=(chamferInfo[1]==undef?lz:lz/2) > >>>>>> -abs(r)+.05 > >>>>>> ,slices=1) > >>>>>> resize([lx,ly]) > >>>>>> offset(r=abs(rSide),$fn=fnCorner) > >>>>>> square([lx,ly],center=true,$fn=childFn); > >>>>>> } > >>>>>> } > >>>>>> else children(); > >>>>>> } > >>>>>> > >>>>>> ------------------------------------------- > >>>>>> > >>>>>> > >>>>>> On 22.09.23 00:52, Ken wrote: > >>>>>> > > >>>>>> > include<constructive-compiled.scad> > >>>>>> > $fa = 2; > >>>>>> > $fs = 0.5; > >>>>>> > > >>>>>> > chamfer(-4,-2) tube(d=20, h=12, wall=3); > >>>>>> > > >>>>>> > it works as expected- I get a nicely chamfered tube. If I > change > >> it > >>>> to > >>>>>> > > >>>>>> > chamfer(-2,-2,-2) g(turnXY(45), X(60)) box(20); > >>>>>> > > >>>>>> > or > >>>>>> > > >>>>>> > chamfer(-1,-2,-3) X(-40)box(10,x=35,h=15); > >>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>>> On 22.09.23 17:07, pproj@posteo.de wrote: > >>>>>>> HEllo Ken, thanks for figuring out cause, > >>>>>>> > >>>>>>> there are various ways: > >>>>>>> > >>>>>>> include <../../devlibs/constructive/constructive-all.scad> > >>>>>>> > >>>>>>> $fn=60; > >>>>>>> assemble() > >>>>>>> { > >>>>>>> add() > >>>>>>> tube(d=20,d2=10,h=10,wall=3); > >>>>>>> > >>>>>>> //chamfering has a side effect when using d2, so it will look > like > >>>> this > >>>>>>> add(X(25),chamfer(-2,-2)) > >>>>>>> tube(d=20,d2=10,h=10,wall=3); > >>>>>>> > >>>>>>> //i would use the bentStrip()with a 2d primitive Bodylike circle, > >>>> instead > >>>>>>> add(X(50),reflectZ()) > >>>>>>> rotate_extrude() > >>>>>>> X(6)bentStrip([Y(10),turnXY(-45),Y(10)]) > >>>>>>> circle(d=2); > >>>>>>> } > >>>>>>> > >>>>>>> i would need to add this example to the tutorial or the > >> Constructive's > >>>>>>> Gallery > >>>>>>> > >>>>>>> beside this you could always use regular cylinder([]) instead of > >> tube, > >>>>>>> it just will not react on alignments, but it will on translations > >> like > >>>>>>> X(10) > >>>>>>> > >>>>>>> > >>>>>>> On 22.09.23 01:28, Ken wrote: > >>>>>>>> Is there a way of constructing a funnel using the > >>>>>>>> constructive-compiled library? I searched the tutorials but didn't > >>>>>>>> find anything, and have experimented with the syntax of a > chamfered > >>>>>>>> tube with no success. Normally I would just difference two cones, > >> but > >>>>>>>> it would be interesting to do it using theconstructive-compiled > >>>>>>>> library.. > >>>>>>>> > >>>>>>>> > >>>>>>>> _______________________________________________ > >>>>>>>> OpenSCAD mailing list > >>>>>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org > >>>>>>> _______________________________________________ > >>>>>>> OpenSCAD mailing list > >>>>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org > >>>>>> _______________________________________________ > >>>>>> OpenSCAD mailing list > >>>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org > >>>>>> > >>>>> _______________________________________________ > >>>>> OpenSCAD mailing list > >>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org > >>>> _______________________________________________ > >>>> OpenSCAD mailing list > >>>> To unsubscribe send an email to discuss-leave@lists.openscad.org > >>>> > >>> _______________________________________________ > >>> OpenSCAD mailing list > >>> To unsubscribe send an email to discuss-leave@lists.openscad.org > >> _______________________________________________ > >> OpenSCAD mailing list > >> To unsubscribe send an email to discuss-leave@lists.openscad.org > >> > > > > _______________________________________________ > > OpenSCAD mailing list > > To unsubscribe send an email to discuss-leave@lists.openscad.org > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
P
pproj@posteo.de
Fri, Sep 22, 2023 7:00 PM

Or a keyword prefixing the "Module" like "async" in other languages
specifying that this module it is not unioning,
but i believe this is much more work to implement, than one a simple
assert with "Option Explicit" /lazyOff

On 22.09.23 20:55, pproj@posteo.de wrote:

OK, i see.
Thanks nophead.
i still think that the "Option Explicit" like mechanism should resolve
the Problem
On 22.09.23 20:46, nop head wrote:

The reason is because the original implementation of openscad had a
limitation that only allowed module to return a single child. That was
found to be a limitation when using children() as the only way to pass
multiple children was by enclosing them in braces. You couldn't use a
for
loop or an object made by a user module. Also a big performance hit
doing a
top level implicit union for output formats that support multiple
objects.
The only way to fix it is not backwards compatible.

On Fri, 22 Sept 2023, 18:49 pproj@posteo.de, pproj@posteo.de wrote:

Thanks Nophead,
i meant why, in the sense of what are the reasons for it.

perhaps we could have something like "option explicit" for javascript,
so if one includes it in the code, the code will not compile until you
turn the Lazy unions off.
Resulting in an Error Message, telling what to do.
so everybody could ensure compatibility, but experimental features can
still be enabled

On 22.09.23 18:53, nop head wrote:

Because without lazy unions most operations do an implicit union and

return

a single child. Lazy unions stop that so in some places you would
need to
add an explicit union to preserve the semantics. That is why it is

disabled

by default. I personally never enable it.

On Fri, 22 Sept 2023, 17:47 pproj@posteo.de, pproj@posteo.de wrote:

ehmm... it is indeed a strong semantic change then. do you know why?

On 22.09.23 18:34, nop head wrote:

Because without lazy union a for does an implicit union, so you
get an
intersection with one child that is a NOP. When lazy union is on
each
iteration of the loop will be intersected with all the others.
There is
intersection_for to do the same thing without lazy unions.

On Fri, 22 Sept 2023 at 17:16, pproj@posteo.de pproj@posteo.de

wrote:

So Ken has figured out the cause for extrusion problems was "lazy

unions",

i was able to fix it by removing a single child intersection()
which

was

not needed any more and doing nothing anyway, from the code below,
Anybody any idea, why a single child intersection() causes problems

with

lazy unions?

[...]

            doChamferBox(lx=lx,ly=ly,lz=lz)
                 cube([lx,ly,lz],center=true);

[.....]

module doChamferBox(lx,ly,lz,chamferInfo=chamferInfo(),childFn=$fn)
{
[.....]

        for( i = [chamferInfo[0] , chamferInfo[1]] )
{
        r=i[1];
          rSide=i[2];
          fnCorner=i[3];
          up( (lz==undef )?0:((lz/2-abs(r))i[0]))
          mirror([0,0,i[0]>0?0:1])
              linear_extrude(height=abs(r)
                ,slices=1
                ,scale=[(lx+2
r)/lx,(ly+2*r)/ly])
          resize([lx,ly])
              offset(r = abs( rSide ), $fn = fnCorner)
           square([lx,ly],center=true,$fn=childFn);
}

//this inteesection() seems is a non functional leftover and was

causing

the problem with lazy unions

      intersection()
        {
              for(i=[chamferInfo[0],chamferInfo[1]])
              {
                    r=i[1];
                    rSide=i[2];
                      fnCorner=i[3];

                  mirror([0,0,i[0]>0?0:1])
down(chamferInfo[1]==undef?lz/2:0.02)
                       linear_extrude(
height=(chamferInfo[1]==undef?lz:lz/2)
                                -abs(r)+.05
                  ,slices=1)
                             resize([lx,ly])
offset(r=abs(rSide),$fn=fnCorner)
square([lx,ly],center=true,$fn=childFn);
              }
      }
else  children();
}


On 22.09.23 00:52, Ken wrote:
    >
    > include<constructive-compiled.scad>
    > $fa = 2;
    > $fs = 0.5;
    >
    >    chamfer(-4,-2) tube(d=20, h=12, wall=3);
    >
    > it works as expected- I get a nicely chamfered tube. If I
change

it

to

    >
    >   chamfer(-2,-2,-2) g(turnXY(45), X(60)) box(20);
    >
    > or
    >
    >   chamfer(-1,-2,-3) X(-40)box(10,x=35,h=15);

On 22.09.23 17:07, pproj@posteo.de wrote:

HEllo Ken, thanks for figuring out cause,

there are various ways:

include <../../devlibs/constructive/constructive-all.scad>

$fn=60;
assemble()
{
add()
       tube(d=20,d2=10,h=10,wall=3);

    //chamfering has a side effect when using d2, so it will
look like

this

add(X(25),chamfer(-2,-2))
       tube(d=20,d2=10,h=10,wall=3);

//i would use the bentStrip()with a 2d primitive Bodylike circle,

instead

add(X(50),reflectZ())
       rotate_extrude()
           X(6)bentStrip([Y(10),turnXY(-45),Y(10)])
               circle(d=2);
}

i would need to add this example to the tutorial or the

Constructive's

Gallery

beside this you could always use regular cylinder([]) instead of

tube,

it just will not react on alignments, but it will on translations

like

X(10)

On 22.09.23 01:28, Ken wrote:

Is there a way of constructing a funnel using the
constructive-compiled library? I searched the tutorials but
didn't
find anything, and have experimented with the syntax of a
chamfered
tube with no success. Normally I would just difference two cones,

but

it would be interesting to do it using theconstructive-compiled
library..


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Or a keyword prefixing the "Module" like "async" in other languages specifying that this module it is not unioning, but i believe this is much more work to implement, than one a simple assert with "Option Explicit" /lazyOff On 22.09.23 20:55, pproj@posteo.de wrote: > OK, i see. > Thanks nophead. > i still think that the "Option Explicit" like mechanism should resolve > the Problem > On 22.09.23 20:46, nop head wrote: >> The reason is because the original implementation of openscad had a >> limitation that only allowed module to return a single child. That was >> found to be a limitation when using children() as the only way to pass >> multiple children was by enclosing them in braces. You couldn't use a >> for >> loop or an object made by a user module. Also a big performance hit >> doing a >> top level implicit union for output formats that support multiple >> objects. >> The only way to fix it is not backwards compatible. >> >> On Fri, 22 Sept 2023, 18:49 pproj@posteo.de, <pproj@posteo.de> wrote: >> >>> Thanks Nophead, >>> i meant why, in the sense of what are the reasons for it. >>> >>> perhaps we could have something like "option explicit" for javascript, >>> so if one includes it in the code, the code will not compile until you >>> turn the Lazy unions off. >>> Resulting in an Error Message, telling what to do. >>> so everybody could ensure compatibility, but experimental features can >>> still be enabled >>> >>> On 22.09.23 18:53, nop head wrote: >>>> Because without lazy unions most operations do an implicit union and >>> return >>>> a single child. Lazy unions stop that so in some places you would >>>> need to >>>> add an explicit union to preserve the semantics. That is why it is >>> disabled >>>> by default. I personally never enable it. >>>> >>>> On Fri, 22 Sept 2023, 17:47 pproj@posteo.de, <pproj@posteo.de> wrote: >>>> >>>>> ehmm... it is indeed a strong semantic change then. do you know why? >>>>> >>>>> On 22.09.23 18:34, nop head wrote: >>>>>> Because without lazy union a for does an implicit union, so you >>>>>> get an >>>>>> intersection with one child that is a NOP. When lazy union is on >>>>>> each >>>>>> iteration of the loop will be intersected with all the others. >>>>>> There is >>>>>> intersection_for to do the same thing without lazy unions. >>>>>> >>>>>> On Fri, 22 Sept 2023 at 17:16, pproj@posteo.de <pproj@posteo.de> >>> wrote: >>>>>>> So Ken has figured out the cause for extrusion problems was "lazy >>>>> unions", >>>>>>> i was able to fix it by removing a single child intersection() >>>>>>> which >>> was >>>>>>> not needed any more and doing nothing anyway, from the code below, >>>>>>> Anybody any idea, why a single child intersection() causes problems >>> with >>>>>>> lazy unions? >>>>>>> >>>>>>> >>>>>>> [...] >>>>>>> >>>>>>>             doChamferBox(lx=lx,ly=ly,lz=lz) >>>>>>>                  cube([lx,ly,lz],center=true); >>>>>>> >>>>>>> [.....] >>>>>>> >>>>>>> module doChamferBox(lx,ly,lz,chamferInfo=chamferInfo(),childFn=$fn) >>>>>>> { >>>>>>> [.....] >>>>>>> >>>>>>>         for( i = [chamferInfo[0] , chamferInfo[1]] ) >>>>>>> { >>>>>>>         r=i[1]; >>>>>>>           rSide=i[2]; >>>>>>>           fnCorner=i[3]; >>>>>>>           up( (lz==undef )?0:((lz/2-abs(r))*i[0])) >>>>>>>           mirror([0,0,i[0]>0?0:1]) >>>>>>>               linear_extrude(height=abs(r) >>>>>>>                 ,slices=1 >>>>>>>                 ,scale=[(lx+2*r)/lx,(ly+2*r)/ly]) >>>>>>>           resize([lx,ly]) >>>>>>>               offset(r = abs( rSide ), $fn = fnCorner) >>>>>>>            square([lx,ly],center=true,$fn=childFn); >>>>>>> } >>>>>>> >>>>>>> //this inteesection() seems is a non functional leftover and was >>> causing >>>>>>> the problem with lazy unions >>>>>>> >>>>>>>       intersection() >>>>>>>         { >>>>>>>               for(i=[chamferInfo[0],chamferInfo[1]]) >>>>>>>               { >>>>>>>                     r=i[1]; >>>>>>>                     rSide=i[2]; >>>>>>>                       fnCorner=i[3]; >>>>>>> >>>>>>>                   mirror([0,0,i[0]>0?0:1]) >>>>>>> down(chamferInfo[1]==undef?lz/2:0.02) >>>>>>>                        linear_extrude( >>>>>>> height=(chamferInfo[1]==undef?lz:lz/2) >>>>>>>                                 -abs(r)+.05 >>>>>>>                   ,slices=1) >>>>>>>                              resize([lx,ly]) >>>>>>> offset(r=abs(rSide),$fn=fnCorner) >>>>>>> square([lx,ly],center=true,$fn=childFn); >>>>>>>               } >>>>>>>       } >>>>>>> else  children(); >>>>>>> } >>>>>>> >>>>>>> ------------------------------------------- >>>>>>> >>>>>>> >>>>>>> On 22.09.23 00:52, Ken wrote: >>>>>>>     > >>>>>>>     > include<constructive-compiled.scad> >>>>>>>     > $fa = 2; >>>>>>>     > $fs = 0.5; >>>>>>>     > >>>>>>>     >    chamfer(-4,-2) tube(d=20, h=12, wall=3); >>>>>>>     > >>>>>>>     > it works as expected- I get a nicely chamfered tube. If I >>>>>>> change >>> it >>>>> to >>>>>>>     > >>>>>>>     >   chamfer(-2,-2,-2) g(turnXY(45), X(60)) box(20); >>>>>>>     > >>>>>>>     > or >>>>>>>     > >>>>>>>     >   chamfer(-1,-2,-3) X(-40)box(10,x=35,h=15); >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> On 22.09.23 17:07, pproj@posteo.de wrote: >>>>>>>> HEllo Ken, thanks for figuring out cause, >>>>>>>> >>>>>>>> there are various ways: >>>>>>>> >>>>>>>> include <../../devlibs/constructive/constructive-all.scad> >>>>>>>> >>>>>>>> $fn=60; >>>>>>>> assemble() >>>>>>>> { >>>>>>>> add() >>>>>>>>        tube(d=20,d2=10,h=10,wall=3); >>>>>>>> >>>>>>>>     //chamfering has a side effect when using d2, so it will >>>>>>>> look like >>>>> this >>>>>>>> add(X(25),chamfer(-2,-2)) >>>>>>>>        tube(d=20,d2=10,h=10,wall=3); >>>>>>>> >>>>>>>> //i would use the bentStrip()with a 2d primitive Bodylike circle, >>>>> instead >>>>>>>> add(X(50),reflectZ()) >>>>>>>>        rotate_extrude() >>>>>>>>            X(6)bentStrip([Y(10),turnXY(-45),Y(10)]) >>>>>>>>                circle(d=2); >>>>>>>> } >>>>>>>> >>>>>>>> i would need to add this example to the tutorial or the >>> Constructive's >>>>>>>> Gallery >>>>>>>> >>>>>>>> beside this you could always use regular cylinder([]) instead of >>> tube, >>>>>>>> it just will not react on alignments, but it will on translations >>> like >>>>>>>> X(10) >>>>>>>> >>>>>>>> >>>>>>>> On 22.09.23 01:28, Ken wrote: >>>>>>>>> Is there a way of constructing a funnel using the >>>>>>>>> constructive-compiled library? I searched the tutorials but >>>>>>>>> didn't >>>>>>>>> find anything, and have experimented with the syntax of a >>>>>>>>> chamfered >>>>>>>>> tube with no success. Normally I would just difference two cones, >>> but >>>>>>>>> it would be interesting to do it using theconstructive-compiled >>>>>>>>> library.. >>>>>>>>> >>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> OpenSCAD mailing list >>>>>>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>>>>>> _______________________________________________ >>>>>>>> OpenSCAD mailing list >>>>>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>>>>> _______________________________________________ >>>>>>> OpenSCAD mailing list >>>>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>>>>> >>>>>> _______________________________________________ >>>>>> OpenSCAD mailing list >>>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>>> _______________________________________________ >>>>> OpenSCAD mailing list >>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>>> >>>> _______________________________________________ >>>> OpenSCAD mailing list >>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org > >
DP
David Phillip Oster
Fri, Sep 22, 2023 7:08 PM

This the same issue I wrote to this discussion list Sept 19, under the
title:
Dev build has different semantics than the 2021.1 release

Specifically, I was using some else’s library and the change broke my code.

On Fri, Sep 22, 2023 at 12:06 PM nop head nop.head@gmail.com wrote:

Not really because someone could put in a library and break client code.

On Fri, 22 Sept 2023, 19:55 pproj@posteo.de, pproj@posteo.de wrote:

OK, i see.
Thanks nophead.
i still think that the "Option Explicit" like mechanism should resolve
the Problem
On 22.09.23 20:46, nop head wrote:

The reason is because the original implementation of openscad had a
limitation that only allowed module to return a single child. That was
found to be a limitation when using children() as the only way to pass
multiple children was by enclosing them in braces. You couldn't use a

for

loop or an object made by a user module. Also a big performance hit

doing a

top level implicit union for output formats that support multiple

objects.

The only way to fix it is not backwards compatible.

On Fri, 22 Sept 2023, 18:49 pproj@posteo.de, pproj@posteo.de wrote:

Thanks Nophead,
i meant why, in the sense of what are the reasons for it.

perhaps we could have something like "option explicit" for javascript,
so if one includes it in the code, the code will not compile until you
turn the Lazy unions off.
Resulting in an Error Message, telling what to do.
so everybody could ensure compatibility, but experimental features can
still be enabled

On 22.09.23 18:53, nop head wrote:

Because without lazy unions most operations do an implicit union and

return

a single child. Lazy unions stop that so in some places you would

need to

add an explicit union to preserve the semantics. That is why it is

disabled

by default. I personally never enable it.

On Fri, 22 Sept 2023, 17:47 pproj@posteo.de, pproj@posteo.de wrote:

ehmm... it is indeed a strong semantic change then. do you know why?

On 22.09.23 18:34, nop head wrote:

Because without lazy union a for does an implicit union, so you get

an

intersection with one child that is a NOP. When lazy union is on

each

iteration of the loop will be intersected with all the others.

There is

intersection_for to do the same thing without lazy unions.

On Fri, 22 Sept 2023 at 17:16, pproj@posteo.de pproj@posteo.de

wrote:

So Ken has figured out the cause for extrusion problems was "lazy

unions",

i was able to fix it by removing a single child intersection()

which

was

not needed any more and doing nothing anyway, from the code below,
Anybody any idea, why a single child intersection() causes problems

with

lazy unions?

[...]

         doChamferBox(lx=lx,ly=ly,lz=lz)
              cube([lx,ly,lz],center=true);

[.....]

module doChamferBox(lx,ly,lz,chamferInfo=chamferInfo(),childFn=$fn)
{
[.....]

     for( i = [chamferInfo[0] , chamferInfo[1]] )

{
r=i[1];
rSide=i[2];
fnCorner=i[3];
up( (lz==undef )?0:((lz/2-abs(r))i[0]))
mirror([0,0,i[0]>0?0:1])
linear_extrude(height=abs(r)
,slices=1
,scale=[(lx+2
r)/lx,(ly+2*r)/ly])
resize([lx,ly])
offset(r = abs( rSide ), $fn = fnCorner)
square([lx,ly],center=true,$fn=childFn);
}

//this inteesection() seems is a non functional leftover and was

causing

the problem with lazy unions

   intersection()
     {
           for(i=[chamferInfo[0],chamferInfo[1]])
           {
                 r=i[1];
                 rSide=i[2];
                   fnCorner=i[3];

               mirror([0,0,i[0]>0?0:1])
                   down(chamferInfo[1]==undef?lz/2:0.02)
                    linear_extrude(
                    height=(chamferInfo[1]==undef?lz:lz/2)
                             -abs(r)+.05
               ,slices=1)
                          resize([lx,ly])
                              offset(r=abs(rSide),$fn=fnCorner)
                      square([lx,ly],center=true,$fn=childFn);
           }
   }

else  children();
}


On 22.09.23 00:52, Ken wrote:

include<constructive-compiled.scad>
$fa = 2;
$fs = 0.5;

chamfer(-4,-2) tube(d=20, h=12, wall=3);

it works as expected- I get a nicely chamfered tube. If I

change

it

to

chamfer(-2,-2,-2) g(turnXY(45), X(60)) box(20);

or

chamfer(-1,-2,-3) X(-40)box(10,x=35,h=15);

On 22.09.23 17:07, pproj@posteo.de wrote:

HEllo Ken, thanks for figuring out cause,

there are various ways:

include <../../devlibs/constructive/constructive-all.scad>

$fn=60;
assemble()
{
add()
tube(d=20,d2=10,h=10,wall=3);

 //chamfering has a side effect when using d2, so it will look

like

this

add(X(25),chamfer(-2,-2))
tube(d=20,d2=10,h=10,wall=3);

//i would use the bentStrip()with a 2d primitive Bodylike circle,

instead

add(X(50),reflectZ())
rotate_extrude()
X(6)bentStrip([Y(10),turnXY(-45),Y(10)])
circle(d=2);
}

i would need to add this example to the tutorial or the

Constructive's

Gallery

beside this you could always use regular cylinder([]) instead of

tube,

it just will not react on alignments, but it will on translations

like

X(10)

On 22.09.23 01:28, Ken wrote:

Is there a way of constructing a funnel using the
constructive-compiled library? I searched the tutorials but

didn't

find anything, and have experimented with the syntax of a

chamfered

tube with no success. Normally I would just difference two cones,

but

it would be interesting to do it using theconstructive-compiled
library..


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

This the same issue I wrote to this discussion list Sept 19, under the title: Dev build has different semantics than the 2021.1 release Specifically, I was using some else’s library and the change broke my code. On Fri, Sep 22, 2023 at 12:06 PM nop head <nop.head@gmail.com> wrote: > Not really because someone could put in a library and break client code. > > On Fri, 22 Sept 2023, 19:55 pproj@posteo.de, <pproj@posteo.de> wrote: > >> OK, i see. >> Thanks nophead. >> i still think that the "Option Explicit" like mechanism should resolve >> the Problem >> On 22.09.23 20:46, nop head wrote: >> > The reason is because the original implementation of openscad had a >> > limitation that only allowed module to return a single child. That was >> > found to be a limitation when using children() as the only way to pass >> > multiple children was by enclosing them in braces. You couldn't use a >> for >> > loop or an object made by a user module. Also a big performance hit >> doing a >> > top level implicit union for output formats that support multiple >> objects. >> > The only way to fix it is not backwards compatible. >> > >> > On Fri, 22 Sept 2023, 18:49 pproj@posteo.de, <pproj@posteo.de> wrote: >> > >> >> Thanks Nophead, >> >> i meant why, in the sense of what are the reasons for it. >> >> >> >> perhaps we could have something like "option explicit" for javascript, >> >> so if one includes it in the code, the code will not compile until you >> >> turn the Lazy unions off. >> >> Resulting in an Error Message, telling what to do. >> >> so everybody could ensure compatibility, but experimental features can >> >> still be enabled >> >> >> >> On 22.09.23 18:53, nop head wrote: >> >>> Because without lazy unions most operations do an implicit union and >> >> return >> >>> a single child. Lazy unions stop that so in some places you would >> need to >> >>> add an explicit union to preserve the semantics. That is why it is >> >> disabled >> >>> by default. I personally never enable it. >> >>> >> >>> On Fri, 22 Sept 2023, 17:47 pproj@posteo.de, <pproj@posteo.de> wrote: >> >>> >> >>>> ehmm... it is indeed a strong semantic change then. do you know why? >> >>>> >> >>>> On 22.09.23 18:34, nop head wrote: >> >>>>> Because without lazy union a for does an implicit union, so you get >> an >> >>>>> intersection with one child that is a NOP. When lazy union is on >> each >> >>>>> iteration of the loop will be intersected with all the others. >> There is >> >>>>> intersection_for to do the same thing without lazy unions. >> >>>>> >> >>>>> On Fri, 22 Sept 2023 at 17:16, pproj@posteo.de <pproj@posteo.de> >> >> wrote: >> >>>>>> So Ken has figured out the cause for extrusion problems was "lazy >> >>>> unions", >> >>>>>> i was able to fix it by removing a single child intersection() >> which >> >> was >> >>>>>> not needed any more and doing nothing anyway, from the code below, >> >>>>>> Anybody any idea, why a single child intersection() causes problems >> >> with >> >>>>>> lazy unions? >> >>>>>> >> >>>>>> >> >>>>>> [...] >> >>>>>> >> >>>>>> doChamferBox(lx=lx,ly=ly,lz=lz) >> >>>>>> cube([lx,ly,lz],center=true); >> >>>>>> >> >>>>>> [.....] >> >>>>>> >> >>>>>> module doChamferBox(lx,ly,lz,chamferInfo=chamferInfo(),childFn=$fn) >> >>>>>> { >> >>>>>> [.....] >> >>>>>> >> >>>>>> for( i = [chamferInfo[0] , chamferInfo[1]] ) >> >>>>>> { >> >>>>>> r=i[1]; >> >>>>>> rSide=i[2]; >> >>>>>> fnCorner=i[3]; >> >>>>>> up( (lz==undef )?0:((lz/2-abs(r))*i[0])) >> >>>>>> mirror([0,0,i[0]>0?0:1]) >> >>>>>> linear_extrude(height=abs(r) >> >>>>>> ,slices=1 >> >>>>>> ,scale=[(lx+2*r)/lx,(ly+2*r)/ly]) >> >>>>>> resize([lx,ly]) >> >>>>>> offset(r = abs( rSide ), $fn = fnCorner) >> >>>>>> square([lx,ly],center=true,$fn=childFn); >> >>>>>> } >> >>>>>> >> >>>>>> //this inteesection() seems is a non functional leftover and was >> >> causing >> >>>>>> the problem with lazy unions >> >>>>>> >> >>>>>> intersection() >> >>>>>> { >> >>>>>> for(i=[chamferInfo[0],chamferInfo[1]]) >> >>>>>> { >> >>>>>> r=i[1]; >> >>>>>> rSide=i[2]; >> >>>>>> fnCorner=i[3]; >> >>>>>> >> >>>>>> mirror([0,0,i[0]>0?0:1]) >> >>>>>> down(chamferInfo[1]==undef?lz/2:0.02) >> >>>>>> linear_extrude( >> >>>>>> height=(chamferInfo[1]==undef?lz:lz/2) >> >>>>>> -abs(r)+.05 >> >>>>>> ,slices=1) >> >>>>>> resize([lx,ly]) >> >>>>>> offset(r=abs(rSide),$fn=fnCorner) >> >>>>>> square([lx,ly],center=true,$fn=childFn); >> >>>>>> } >> >>>>>> } >> >>>>>> else children(); >> >>>>>> } >> >>>>>> >> >>>>>> ------------------------------------------- >> >>>>>> >> >>>>>> >> >>>>>> On 22.09.23 00:52, Ken wrote: >> >>>>>> > >> >>>>>> > include<constructive-compiled.scad> >> >>>>>> > $fa = 2; >> >>>>>> > $fs = 0.5; >> >>>>>> > >> >>>>>> > chamfer(-4,-2) tube(d=20, h=12, wall=3); >> >>>>>> > >> >>>>>> > it works as expected- I get a nicely chamfered tube. If I >> change >> >> it >> >>>> to >> >>>>>> > >> >>>>>> > chamfer(-2,-2,-2) g(turnXY(45), X(60)) box(20); >> >>>>>> > >> >>>>>> > or >> >>>>>> > >> >>>>>> > chamfer(-1,-2,-3) X(-40)box(10,x=35,h=15); >> >>>>>> >> >>>>>> >> >>>>>> >> >>>>>> >> >>>>>> On 22.09.23 17:07, pproj@posteo.de wrote: >> >>>>>>> HEllo Ken, thanks for figuring out cause, >> >>>>>>> >> >>>>>>> there are various ways: >> >>>>>>> >> >>>>>>> include <../../devlibs/constructive/constructive-all.scad> >> >>>>>>> >> >>>>>>> $fn=60; >> >>>>>>> assemble() >> >>>>>>> { >> >>>>>>> add() >> >>>>>>> tube(d=20,d2=10,h=10,wall=3); >> >>>>>>> >> >>>>>>> //chamfering has a side effect when using d2, so it will look >> like >> >>>> this >> >>>>>>> add(X(25),chamfer(-2,-2)) >> >>>>>>> tube(d=20,d2=10,h=10,wall=3); >> >>>>>>> >> >>>>>>> //i would use the bentStrip()with a 2d primitive Bodylike circle, >> >>>> instead >> >>>>>>> add(X(50),reflectZ()) >> >>>>>>> rotate_extrude() >> >>>>>>> X(6)bentStrip([Y(10),turnXY(-45),Y(10)]) >> >>>>>>> circle(d=2); >> >>>>>>> } >> >>>>>>> >> >>>>>>> i would need to add this example to the tutorial or the >> >> Constructive's >> >>>>>>> Gallery >> >>>>>>> >> >>>>>>> beside this you could always use regular cylinder([]) instead of >> >> tube, >> >>>>>>> it just will not react on alignments, but it will on translations >> >> like >> >>>>>>> X(10) >> >>>>>>> >> >>>>>>> >> >>>>>>> On 22.09.23 01:28, Ken wrote: >> >>>>>>>> Is there a way of constructing a funnel using the >> >>>>>>>> constructive-compiled library? I searched the tutorials but >> didn't >> >>>>>>>> find anything, and have experimented with the syntax of a >> chamfered >> >>>>>>>> tube with no success. Normally I would just difference two cones, >> >> but >> >>>>>>>> it would be interesting to do it using theconstructive-compiled >> >>>>>>>> library.. >> >>>>>>>> >> >>>>>>>> >> >>>>>>>> _______________________________________________ >> >>>>>>>> OpenSCAD mailing list >> >>>>>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >> >>>>>>> _______________________________________________ >> >>>>>>> OpenSCAD mailing list >> >>>>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >> >>>>>> _______________________________________________ >> >>>>>> OpenSCAD mailing list >> >>>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >> >>>>>> >> >>>>> _______________________________________________ >> >>>>> OpenSCAD mailing list >> >>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >> >>>> _______________________________________________ >> >>>> OpenSCAD mailing list >> >>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >> >>>> >> >>> _______________________________________________ >> >>> OpenSCAD mailing list >> >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >> >> _______________________________________________ >> >> OpenSCAD mailing list >> >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> >> >> > >> > _______________________________________________ >> > OpenSCAD mailing list >> > To unsubscribe send an email to discuss-leave@lists.openscad.org >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
P
pproj@posteo.de
Fri, Sep 22, 2023 8:29 PM

i do not think so, at all.

just to make it clear, what i mean with "option explicit":
 "use strict"  in .js code  turns the .js interpreter into Strict mode,
it will complain i.e. if variables are used without declarations.
"use strict" in the .scad library's code would throw an error message if
the Lazy Unions Option or other compatibility breaking options are on.

it tells the user exactly what to do, and if your code is based on lazy
unions, you will see it is broken after turning lazy unions off.

so there is no problem. it gives clear guidance, what to do to make it work.

On 22.09.23 20:58, nop head wrote:

Not really because someone could put in a library and break client code.

On Fri, 22 Sept 2023, 19:55 pproj@posteo.de, pproj@posteo.de wrote:

OK, i see.
Thanks nophead.
i still think that the "Option Explicit" like mechanism should resolve
the Problem
On 22.09.23 20:46, nop head wrote:

The reason is because the original implementation of openscad had a
limitation that only allowed module to return a single child. That was
found to be a limitation when using children() as the only way to pass
multiple children was by enclosing them in braces. You couldn't use a for
loop or an object made by a user module. Also a big performance hit

doing a

top level implicit union for output formats that support multiple

objects.

The only way to fix it is not backwards compatible.

On Fri, 22 Sept 2023, 18:49 pproj@posteo.de, pproj@posteo.de wrote:

Thanks Nophead,
i meant why, in the sense of what are the reasons for it.

perhaps we could have something like "option explicit" for javascript,
so if one includes it in the code, the code will not compile until you
turn the Lazy unions off.
Resulting in an Error Message, telling what to do.
so everybody could ensure compatibility, but experimental features can
still be enabled

On 22.09.23 18:53, nop head wrote:

Because without lazy unions most operations do an implicit union and

return

a single child. Lazy unions stop that so in some places you would need

to

add an explicit union to preserve the semantics. That is why it is

disabled

by default. I personally never enable it.

On Fri, 22 Sept 2023, 17:47 pproj@posteo.de, pproj@posteo.de wrote:

ehmm... it is indeed a strong semantic change then. do you know why?

On 22.09.23 18:34, nop head wrote:

Because without lazy union a for does an implicit union, so you get

an

intersection with one child that is a NOP. When lazy union is on each
iteration of the loop will be intersected with all the others. There

is

intersection_for to do the same thing without lazy unions.

On Fri, 22 Sept 2023 at 17:16, pproj@posteo.de pproj@posteo.de

wrote:

So Ken has figured out the cause for extrusion problems was "lazy

unions",

i was able to fix it by removing a single child intersection() which

was

not needed any more and doing nothing anyway, from the code below,
Anybody any idea, why a single child intersection() causes problems

with

lazy unions?

[...]

          doChamferBox(lx=lx,ly=ly,lz=lz)
               cube([lx,ly,lz],center=true);

[.....]

module doChamferBox(lx,ly,lz,chamferInfo=chamferInfo(),childFn=$fn)
{
[.....]

      for( i = [chamferInfo[0] , chamferInfo[1]] )

{
r=i[1];
rSide=i[2];
fnCorner=i[3];
up( (lz==undef )?0:((lz/2-abs(r))i[0]))
mirror([0,0,i[0]>0?0:1])
linear_extrude(height=abs(r)
,slices=1
,scale=[(lx+2
r)/lx,(ly+2*r)/ly])
resize([lx,ly])
offset(r = abs( rSide ), $fn = fnCorner)
square([lx,ly],center=true,$fn=childFn);
}

//this inteesection() seems is a non functional leftover and was

causing

the problem with lazy unions

    intersection()
      {
            for(i=[chamferInfo[0],chamferInfo[1]])
            {
                  r=i[1];
                  rSide=i[2];
                    fnCorner=i[3];

                mirror([0,0,i[0]>0?0:1])
                    down(chamferInfo[1]==undef?lz/2:0.02)
                     linear_extrude(
                     height=(chamferInfo[1]==undef?lz:lz/2)
                              -abs(r)+.05
                ,slices=1)
                           resize([lx,ly])
                               offset(r=abs(rSide),$fn=fnCorner)
                       square([lx,ly],center=true,$fn=childFn);
            }
    }

else  children();
}


On 22.09.23 00:52, Ken wrote:

include<constructive-compiled.scad>
$fa = 2;
$fs = 0.5;

chamfer(-4,-2) tube(d=20, h=12, wall=3);

it works as expected- I get a nicely chamfered tube. If I

change

it

to

chamfer(-2,-2,-2) g(turnXY(45), X(60)) box(20);

or

chamfer(-1,-2,-3) X(-40)box(10,x=35,h=15);

On 22.09.23 17:07, pproj@posteo.de wrote:

HEllo Ken, thanks for figuring out cause,

there are various ways:

include <../../devlibs/constructive/constructive-all.scad>

$fn=60;
assemble()
{
add()
tube(d=20,d2=10,h=10,wall=3);

  //chamfering has a side effect when using d2, so it will look

like

this

add(X(25),chamfer(-2,-2))
tube(d=20,d2=10,h=10,wall=3);

//i would use the bentStrip()with a 2d primitive Bodylike circle,

instead

add(X(50),reflectZ())
rotate_extrude()
X(6)bentStrip([Y(10),turnXY(-45),Y(10)])
circle(d=2);
}

i would need to add this example to the tutorial or the

Constructive's

Gallery

beside this you could always use regular cylinder([]) instead of

tube,

it just will not react on alignments, but it will on translations

like

X(10)

On 22.09.23 01:28, Ken wrote:

Is there a way of constructing a funnel using the
constructive-compiled library? I searched the tutorials but didn't
find anything, and have experimented with the syntax of a

chamfered

tube with no success. Normally I would just difference two cones,

but

it would be interesting to do it using theconstructive-compiled
library..


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

i do not think so, at all. just to make it clear, what i mean with "option explicit":  "use strict"  in .js code  turns the .js interpreter into Strict mode, it will complain i.e. if variables are used without declarations. "use strict" in the .scad library's code would throw an error message if the Lazy Unions Option or other compatibility breaking options are on. it tells the user exactly what to do, and if your code is based on lazy unions, you will see it is broken after turning lazy unions off. so there is no problem. it gives clear guidance, what to do to make it work. On 22.09.23 20:58, nop head wrote: > Not really because someone could put in a library and break client code. > > On Fri, 22 Sept 2023, 19:55 pproj@posteo.de, <pproj@posteo.de> wrote: > >> OK, i see. >> Thanks nophead. >> i still think that the "Option Explicit" like mechanism should resolve >> the Problem >> On 22.09.23 20:46, nop head wrote: >>> The reason is because the original implementation of openscad had a >>> limitation that only allowed module to return a single child. That was >>> found to be a limitation when using children() as the only way to pass >>> multiple children was by enclosing them in braces. You couldn't use a for >>> loop or an object made by a user module. Also a big performance hit >> doing a >>> top level implicit union for output formats that support multiple >> objects. >>> The only way to fix it is not backwards compatible. >>> >>> On Fri, 22 Sept 2023, 18:49 pproj@posteo.de, <pproj@posteo.de> wrote: >>> >>>> Thanks Nophead, >>>> i meant why, in the sense of what are the reasons for it. >>>> >>>> perhaps we could have something like "option explicit" for javascript, >>>> so if one includes it in the code, the code will not compile until you >>>> turn the Lazy unions off. >>>> Resulting in an Error Message, telling what to do. >>>> so everybody could ensure compatibility, but experimental features can >>>> still be enabled >>>> >>>> On 22.09.23 18:53, nop head wrote: >>>>> Because without lazy unions most operations do an implicit union and >>>> return >>>>> a single child. Lazy unions stop that so in some places you would need >> to >>>>> add an explicit union to preserve the semantics. That is why it is >>>> disabled >>>>> by default. I personally never enable it. >>>>> >>>>> On Fri, 22 Sept 2023, 17:47 pproj@posteo.de, <pproj@posteo.de> wrote: >>>>> >>>>>> ehmm... it is indeed a strong semantic change then. do you know why? >>>>>> >>>>>> On 22.09.23 18:34, nop head wrote: >>>>>>> Because without lazy union a for does an implicit union, so you get >> an >>>>>>> intersection with one child that is a NOP. When lazy union is on each >>>>>>> iteration of the loop will be intersected with all the others. There >> is >>>>>>> intersection_for to do the same thing without lazy unions. >>>>>>> >>>>>>> On Fri, 22 Sept 2023 at 17:16, pproj@posteo.de <pproj@posteo.de> >>>> wrote: >>>>>>>> So Ken has figured out the cause for extrusion problems was "lazy >>>>>> unions", >>>>>>>> i was able to fix it by removing a single child intersection() which >>>> was >>>>>>>> not needed any more and doing nothing anyway, from the code below, >>>>>>>> Anybody any idea, why a single child intersection() causes problems >>>> with >>>>>>>> lazy unions? >>>>>>>> >>>>>>>> >>>>>>>> [...] >>>>>>>> >>>>>>>> doChamferBox(lx=lx,ly=ly,lz=lz) >>>>>>>> cube([lx,ly,lz],center=true); >>>>>>>> >>>>>>>> [.....] >>>>>>>> >>>>>>>> module doChamferBox(lx,ly,lz,chamferInfo=chamferInfo(),childFn=$fn) >>>>>>>> { >>>>>>>> [.....] >>>>>>>> >>>>>>>> for( i = [chamferInfo[0] , chamferInfo[1]] ) >>>>>>>> { >>>>>>>> r=i[1]; >>>>>>>> rSide=i[2]; >>>>>>>> fnCorner=i[3]; >>>>>>>> up( (lz==undef )?0:((lz/2-abs(r))*i[0])) >>>>>>>> mirror([0,0,i[0]>0?0:1]) >>>>>>>> linear_extrude(height=abs(r) >>>>>>>> ,slices=1 >>>>>>>> ,scale=[(lx+2*r)/lx,(ly+2*r)/ly]) >>>>>>>> resize([lx,ly]) >>>>>>>> offset(r = abs( rSide ), $fn = fnCorner) >>>>>>>> square([lx,ly],center=true,$fn=childFn); >>>>>>>> } >>>>>>>> >>>>>>>> //this inteesection() seems is a non functional leftover and was >>>> causing >>>>>>>> the problem with lazy unions >>>>>>>> >>>>>>>> intersection() >>>>>>>> { >>>>>>>> for(i=[chamferInfo[0],chamferInfo[1]]) >>>>>>>> { >>>>>>>> r=i[1]; >>>>>>>> rSide=i[2]; >>>>>>>> fnCorner=i[3]; >>>>>>>> >>>>>>>> mirror([0,0,i[0]>0?0:1]) >>>>>>>> down(chamferInfo[1]==undef?lz/2:0.02) >>>>>>>> linear_extrude( >>>>>>>> height=(chamferInfo[1]==undef?lz:lz/2) >>>>>>>> -abs(r)+.05 >>>>>>>> ,slices=1) >>>>>>>> resize([lx,ly]) >>>>>>>> offset(r=abs(rSide),$fn=fnCorner) >>>>>>>> square([lx,ly],center=true,$fn=childFn); >>>>>>>> } >>>>>>>> } >>>>>>>> else children(); >>>>>>>> } >>>>>>>> >>>>>>>> ------------------------------------------- >>>>>>>> >>>>>>>> >>>>>>>> On 22.09.23 00:52, Ken wrote: >>>>>>>> > >>>>>>>> > include<constructive-compiled.scad> >>>>>>>> > $fa = 2; >>>>>>>> > $fs = 0.5; >>>>>>>> > >>>>>>>> > chamfer(-4,-2) tube(d=20, h=12, wall=3); >>>>>>>> > >>>>>>>> > it works as expected- I get a nicely chamfered tube. If I >> change >>>> it >>>>>> to >>>>>>>> > >>>>>>>> > chamfer(-2,-2,-2) g(turnXY(45), X(60)) box(20); >>>>>>>> > >>>>>>>> > or >>>>>>>> > >>>>>>>> > chamfer(-1,-2,-3) X(-40)box(10,x=35,h=15); >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On 22.09.23 17:07, pproj@posteo.de wrote: >>>>>>>>> HEllo Ken, thanks for figuring out cause, >>>>>>>>> >>>>>>>>> there are various ways: >>>>>>>>> >>>>>>>>> include <../../devlibs/constructive/constructive-all.scad> >>>>>>>>> >>>>>>>>> $fn=60; >>>>>>>>> assemble() >>>>>>>>> { >>>>>>>>> add() >>>>>>>>> tube(d=20,d2=10,h=10,wall=3); >>>>>>>>> >>>>>>>>> //chamfering has a side effect when using d2, so it will look >> like >>>>>> this >>>>>>>>> add(X(25),chamfer(-2,-2)) >>>>>>>>> tube(d=20,d2=10,h=10,wall=3); >>>>>>>>> >>>>>>>>> //i would use the bentStrip()with a 2d primitive Bodylike circle, >>>>>> instead >>>>>>>>> add(X(50),reflectZ()) >>>>>>>>> rotate_extrude() >>>>>>>>> X(6)bentStrip([Y(10),turnXY(-45),Y(10)]) >>>>>>>>> circle(d=2); >>>>>>>>> } >>>>>>>>> >>>>>>>>> i would need to add this example to the tutorial or the >>>> Constructive's >>>>>>>>> Gallery >>>>>>>>> >>>>>>>>> beside this you could always use regular cylinder([]) instead of >>>> tube, >>>>>>>>> it just will not react on alignments, but it will on translations >>>> like >>>>>>>>> X(10) >>>>>>>>> >>>>>>>>> >>>>>>>>> On 22.09.23 01:28, Ken wrote: >>>>>>>>>> Is there a way of constructing a funnel using the >>>>>>>>>> constructive-compiled library? I searched the tutorials but didn't >>>>>>>>>> find anything, and have experimented with the syntax of a >> chamfered >>>>>>>>>> tube with no success. Normally I would just difference two cones, >>>> but >>>>>>>>>> it would be interesting to do it using theconstructive-compiled >>>>>>>>>> library.. >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> _______________________________________________ >>>>>>>>>> OpenSCAD mailing list >>>>>>>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>>>>>>> _______________________________________________ >>>>>>>>> OpenSCAD mailing list >>>>>>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>>>>>> _______________________________________________ >>>>>>>> OpenSCAD mailing list >>>>>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>>>>>> >>>>>>> _______________________________________________ >>>>>>> OpenSCAD mailing list >>>>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>>>> _______________________________________________ >>>>>> OpenSCAD mailing list >>>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>>>> >>>>> _______________________________________________ >>>>> OpenSCAD mailing list >>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>> _______________________________________________ >>>> OpenSCAD mailing list >>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
K
Ken
Fri, Sep 22, 2023 10:10 PM

Thanks Peter- looks like I was close, but I was trying d1 & d2 instead
of d &d2. Close, but no cigar!

It simplified down to just these few lines to do the job-

include<constructive-compiled.scad>

$fa = 2;
$fs = 0.5;

//Flange
Z(-1.5)tube(d=85, h=3, wall=10.5);
 //Funnel
Z(15)tube(d=70,d2=16,h=30,wall=3);
//Tube
Z(95)tube(d=16, h=130, wall=1.5);

Thanks for all your work- I'm going to enjoy using this library.

On 2023-09-23 01:07, pproj@posteo.de wrote:

HEllo Ken, thanks for figuring out cause,

there are various ways:

include <../../devlibs/constructive/constructive-all.scad>

$fn=60;
assemble()
{
add()
    tube(d=20,d2=10,h=10,wall=3);

 //chamfering has a side effect when using d2, so it will look like this
add(X(25),chamfer(-2,-2))
    tube(d=20,d2=10,h=10,wall=3);

//i would use the bentStrip()with a 2d primitive Bodylike circle, instead
add(X(50),reflectZ())
    rotate_extrude()
        X(6)bentStrip([Y(10),turnXY(-45),Y(10)])
            circle(d=2);
}

i would need to add this example to the tutorial or the Constructive's
Gallery

beside this you could always use regular cylinder([]) instead of tube,
it just will not react on alignments, but it will on translations like
X(10)

On 22.09.23 01:28, Ken wrote:

Is there a way of constructing a funnel using the
constructive-compiled library? I searched the tutorials but didn't
find anything, and have experimented with the syntax of a chamfered
tube with no success. Normally I would just difference two cones, but
it would be interesting to do it using theconstructive-compiled
library..


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email todiscuss-leave@lists.openscad.org

--
Cheers, Ken
bats059@gmail.com
https://vk7krj.com
https://vk7krj.com/running.html

A baby can be defined as an ego with a noise at one end and a smell at the other.
Your job as parents is to teach them to control all three.
My job as a grandad is to tell you how you are doing it all wrong!

Thanks Peter- looks like I was close, but I was trying d1 & d2 instead of d &d2. Close, but no cigar! It simplified down to just these few lines to do the job- include<constructive-compiled.scad> $fa = 2; $fs = 0.5; //Flange Z(-1.5)tube(d=85, h=3, wall=10.5);  //Funnel Z(15)tube(d=70,d2=16,h=30,wall=3); //Tube Z(95)tube(d=16, h=130, wall=1.5); Thanks for all your work- I'm going to enjoy using this library. On 2023-09-23 01:07, pproj@posteo.de wrote: > HEllo Ken, thanks for figuring out cause, > > there are various ways: > > include <../../devlibs/constructive/constructive-all.scad> > > $fn=60; > assemble() > { > add() >     tube(d=20,d2=10,h=10,wall=3); > >  //chamfering has a side effect when using d2, so it will look like this > add(X(25),chamfer(-2,-2)) >     tube(d=20,d2=10,h=10,wall=3); > > //i would use the bentStrip()with a 2d primitive Bodylike circle, instead > add(X(50),reflectZ()) >     rotate_extrude() >         X(6)bentStrip([Y(10),turnXY(-45),Y(10)]) >             circle(d=2); > } > > i would need to add this example to the tutorial or the Constructive's > Gallery > > beside this you could always use regular cylinder([]) instead of tube, > it just will not react on alignments, but it will on translations like > X(10) > > > On 22.09.23 01:28, Ken wrote: >> Is there a way of constructing a funnel using the >> constructive-compiled library? I searched the tutorials but didn't >> find anything, and have experimented with the syntax of a chamfered >> tube with no success. Normally I would just difference two cones, but >> it would be interesting to do it using theconstructive-compiled >> library.. >> >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org -- Cheers, Ken bats059@gmail.com https://vk7krj.com https://vk7krj.com/running.html ---------------------------------------- A baby can be defined as an ego with a noise at one end and a smell at the other. Your job as parents is to teach them to control all three. My job as a grandad is to tell you how you are doing it all wrong!
P
pproj@posteo.de
Fri, Sep 22, 2023 10:57 PM

Hello Ken,
 great that we have resolved the issue with Lazy U.,
you might also consider stack() for this. it will calculate the Z()'s 
for you.
just be careful not put in any intermediate semicolons, while you are
stacking objects. (it has compilation speed penaltly compared to your
code. but is better reflecting the design intent in the code i think)

include<constructive-compiled.scad>

$fa = 2;

$fs = 0.5;

TOUP()
    stack()
        tube(d=85, h=3, wall=10.5)        //Flange
        tube(d=70,d2=16,h=30,wall=3)   //Funnel
        tube(d=16, h=130, wall=1.5);     //Tube
//that is it

//alternatively: the beauty of the bentstrip extrusion, is that it can
Provide a wide variety of forms:
X(70)
    rotate_extrude()
        X(9)bentStrip([X(-3),Y(20),
                              turnXY(-45),Y(10),
                              turnXY(-30),Y(15),
                              turnXY(60),Y(15),
                              turnXY(-30),Y(20),X(8),Y(10)])
            circle(d=2);

Hello Ken,  great that we have resolved the issue with Lazy U., you might also consider stack() for this. it will calculate the Z()'s  for you. just be careful not put in any intermediate semicolons, while you are stacking objects. (it has compilation speed penaltly compared to your code. but is better reflecting the design intent in the code i think) include<constructive-compiled.scad> $fa = 2; $fs = 0.5; TOUP()     stack()         tube(d=85, h=3, wall=10.5)        //Flange         tube(d=70,d2=16,h=30,wall=3)   //Funnel         tube(d=16, h=130, wall=1.5);     //Tube //that is it //alternatively: the beauty of the bentstrip extrusion, is that it can Provide a wide variety of forms: X(70)     rotate_extrude()         X(9)bentStrip([X(-3),Y(20),                               turnXY(-45),Y(10),                               turnXY(-30),Y(15),                               turnXY(60),Y(15),                               turnXY(-30),Y(20),X(8),Y(10)])             circle(d=2);
P
pproj@posteo.de
Sat, Sep 23, 2023 7:54 AM

one more side note on using bentStrip(),

to avoid openscad compiler getting very very slow, we need to avoid the
steps in which the circle()used to cleate a strip is only rotated, but
not moved (i mean translated by that).

to do so we need to combine every turn step with the following movement
step using asterisk, so  this combined operations will be done in a
single step.

here is what i mean:

include<constructive-compiled.scad>

rotate_extrude()
        X(9)bentStrip([X(-3),Y(20),
                              turnXY(-45),Y(10),
                              turnXY(-30),Y(15),
                              turnXY(60),Y(15),
                              turnXY(-30),Y(20),X(8),Y(10)])
            circle(d=2);

// needs to become: (it does just the same, but compiles much faster)

    rotate_extrude()

        X(9)bentStrip([X(-3),Y(20),
                              turnXY(-45)*Y(10),
                              turnXY(-30)Y(15),
                              turnXY(60)
(15),
                              turnXY(-30)*Y(20),X(8),Y(10)])

            circle(d=2);

//as a rule of thumb, in the command List for bentStrip: if a command is
a turn put an asterisk after it, if it is a movement, like X() or Y()
put a comma. ony the last command does not need neither.

Peter

one more side note on using bentStrip(), to avoid openscad compiler getting very very slow, we need to avoid the steps in which the circle()used to cleate a strip is only rotated, but not moved (i mean translated by that). to do so we need to combine every turn step with the following movement step using asterisk, so  this combined operations will be done in a single step. here is what i mean: include<constructive-compiled.scad> > rotate_extrude() >         X(9)bentStrip([X(-3),Y(20), >                               turnXY(-45),Y(10), >                               turnXY(-30),Y(15), >                               turnXY(60),Y(15), >                               turnXY(-30),Y(20),X(8),Y(10)]) >             circle(d=2); // needs to become: (it does just the same, but compiles much faster)     rotate_extrude()         X(9)bentStrip([X(-3),Y(20),                               turnXY(-45)*Y(10),                               turnXY(-30)*Y(15),                               turnXY(60)*(15),                               turnXY(-30)*Y(20),X(8),Y(10)])             circle(d=2); //as a rule of thumb, in the command List for bentStrip: if a command is a turn put an asterisk after it, if it is a movement, like X() or Y() put a comma. ony the last command does not need neither. Peter