discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: Morphing irregular shape while extruding?

SL
Steve Lelievre
Thu, Jan 19, 2023 4:49 PM

Terry,

If you go with your second option of using the plywood plate with a
cut-out, then this code should help. You would add a straight cylinder
at the top  to form your push-in attachment, and a lugs with screw holes
at the bottom for fixing the plywood.

Cheers,

Steve

module funnel(h, d, x, y) {
   // Makes a solid shape that is a rectangle at one end and a circle
at the other.
   // Could easily be adapted for shaping any regular polygon to any
other regular polygon.
   // h: transition height, d: diameter of circular end, x: x-dimension
(length) of rectangular end, y: y-dimension (width) of rectangular end.
   hull() {
      resize([d, d, h]) cylinder(h = 1, d1 = 0, d2 = 1, $fn =
60);           // inverted cone
      resize([x, y, h]) rotate(45) cylinder(h = 1, d1 = 1, d2 = 0, $fn
= 4); // cone with 4 sides: pyramid
   }
}

// Example with additional use of multmatrix to shear the funnel shape
so that the top is off-centre.
height = 20; diameter = 15; length = 40; width = 30;  wall = 2; xOffset
= 10; yOffset = 7;
shear = [[1, 0, xOffset / height], [0, 1, yOffset / height]];
difference() {
   multmatrix(shear) funnel(height, diameter + wall, length + wall,
width + wall);
   multmatrix(shear) funnel(height, diameter, length, width);
}

On 2023-01-19 8:06 a.m., fred via Discuss wrote:


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

Terry, If you go with your second option of using the plywood plate with a cut-out, then this code should help. You would add a straight cylinder at the top  to form your push-in attachment, and a lugs with screw holes at the bottom for fixing the plywood. Cheers, Steve module funnel(h, d, x, y) {    // Makes a solid shape that is a rectangle at one end and a circle at the other.    // Could easily be adapted for shaping any regular polygon to any other regular polygon.    // h: transition height, d: diameter of circular end, x: x-dimension (length) of rectangular end, y: y-dimension (width) of rectangular end.    hull() {       resize([d, d, h]) cylinder(h = 1, d1 = 0, d2 = 1, $fn = 60);           // inverted cone       resize([x, y, h]) rotate(45) cylinder(h = 1, d1 = 1, d2 = 0, $fn = 4); // cone with 4 sides: pyramid    } } // Example with additional use of multmatrix to shear the funnel shape so that the top is off-centre. height = 20; diameter = 15; length = 40; width = 30;  wall = 2; xOffset = 10; yOffset = 7; shear = [[1, 0, xOffset / height], [0, 1, yOffset / height]]; difference() {    multmatrix(shear) funnel(height, diameter + wall, length + wall, width + wall);    multmatrix(shear) funnel(height, diameter, length, width); } On 2023-01-19 8:06 a.m., fred via Discuss wrote: > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
T
Terry
Thu, Jan 19, 2023 5:13 PM

Thanks Steve, that would be handy because I expect I do have some
aluminium or plastic tubing that would be the right diameter for my
hose - but my hole cutters are unlikely to match it.

Did it preview OK for you? I took the first section and pasted it into a
new file, but then had various problems with EOLs. With those fixed(I
think) the following gave me: WARNING: No top level geometry to render.

module funnel(h, d, x, y) {
// Makes a solid shape that is a rectangle at one end and a circle at
the other.
// Could easily be adapted for shaping any regular polygon to any other
regular polygon.
// h: transition height, d: diameter of circular end, x: x-dimension
//(length) of rectangular end, y: y-dimension (width) of rectangular
end.
hull() {
resize([d, d, h]) cylinder(h = 1, d1 = 0, d2 = 1, $fn = 60);          
// inverted cone
resize([x, y, h]) rotate(45) cylinder(h = 1, d1 = 1, d2 = 0, $fn = 4);
// cone with 4 sides: pyramid
}
}


On Thu, 19 Jan 2023 08:49:28 -0800, you wrote:

Terry,

If you go with your second option of using the plywood plate with a
cut-out, then this code should help. You would add a straight cylinder
at the top  to form your push-in attachment, and a lugs with screw holes
at the bottom for fixing the plywood.

Cheers,

Steve

module funnel(h, d, x, y) {
   // Makes a solid shape that is a rectangle at one end and a circle
at the other.
   // Could easily be adapted for shaping any regular polygon to any
other regular polygon.
   // h: transition height, d: diameter of circular end, x: x-dimension
(length) of rectangular end, y: y-dimension (width) of rectangular end.
   hull() {
      resize([d, d, h]) cylinder(h = 1, d1 = 0, d2 = 1, $fn =
60);           // inverted cone
      resize([x, y, h]) rotate(45) cylinder(h = 1, d1 = 1, d2 = 0, $fn
= 4); // cone with 4 sides: pyramid
   }
}

// Example with additional use of multmatrix to shear the funnel shape
so that the top is off-centre.
height = 20; diameter = 15; length = 40; width = 30;  wall = 2; xOffset
= 10; yOffset = 7;
shear = [[1, 0, xOffset / height], [0, 1, yOffset / height]];
difference() {
   multmatrix(shear) funnel(height, diameter + wall, length + wall,
width + wall);
   multmatrix(shear) funnel(height, diameter, length, width);
}

On 2023-01-19 8:06 a.m., fred via Discuss wrote:


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

Thanks Steve, that would be handy because I expect I do have some aluminium or plastic tubing that would be the right diameter for my hose - but my hole cutters are unlikely to match it. Did it preview OK for you? I took the first section and pasted it into a new file, but then had various problems with EOLs. With those fixed(I think) the following gave me: WARNING: No top level geometry to render. module funnel(h, d, x, y) { // Makes a solid shape that is a rectangle at one end and a circle at the other. // Could easily be adapted for shaping any regular polygon to any other regular polygon. // h: transition height, d: diameter of circular end, x: x-dimension //(length) of rectangular end, y: y-dimension (width) of rectangular end. hull() { resize([d, d, h]) cylinder(h = 1, d1 = 0, d2 = 1, $fn = 60);           // inverted cone resize([x, y, h]) rotate(45) cylinder(h = 1, d1 = 1, d2 = 0, $fn = 4); // cone with 4 sides: pyramid } } -------------------- On Thu, 19 Jan 2023 08:49:28 -0800, you wrote: >Terry, > >If you go with your second option of using the plywood plate with a >cut-out, then this code should help. You would add a straight cylinder >at the top  to form your push-in attachment, and a lugs with screw holes >at the bottom for fixing the plywood. > >Cheers, > >Steve > >module funnel(h, d, x, y) { >    // Makes a solid shape that is a rectangle at one end and a circle >at the other. >    // Could easily be adapted for shaping any regular polygon to any >other regular polygon. >    // h: transition height, d: diameter of circular end, x: x-dimension >(length) of rectangular end, y: y-dimension (width) of rectangular end. >    hull() { >       resize([d, d, h]) cylinder(h = 1, d1 = 0, d2 = 1, $fn = >60);           // inverted cone >       resize([x, y, h]) rotate(45) cylinder(h = 1, d1 = 1, d2 = 0, $fn >= 4); // cone with 4 sides: pyramid >    } >} > >// Example with additional use of multmatrix to shear the funnel shape >so that the top is off-centre. >height = 20; diameter = 15; length = 40; width = 30;  wall = 2; xOffset >= 10; yOffset = 7; >shear = [[1, 0, xOffset / height], [0, 1, yOffset / height]]; >difference() { >    multmatrix(shear) funnel(height, diameter + wall, length + wall, >width + wall); >    multmatrix(shear) funnel(height, diameter, length, width); >} > > > > >On 2023-01-19 8:06 a.m., fred via Discuss wrote: >> _______________________________________________ >> 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
SL
Steve Lelievre
Thu, Jan 19, 2023 5:54 PM

Terry,

The EOL issue  is probably from the source code being messed up when I
pasted it into an email. The lack of geometry to render is because the
first block is a module that gets called from the second part. You need
to include all the sample code to see any output.

In my first message, I forgot to point out that the example funnel
dimensions are the inner dimensions of the two ends of the funnel. You
may need to compensate for that if you're making a shape that goes over
a fitting rather than into it.

Steve

On 2023-01-19 9:13 a.m., Terry wrote:

Thanks Steve, that would be handy because I expect I do have some
aluminium or plastic tubing that would be the right diameter for my
hose - but my hole cutters are unlikely to match it.

Did it preview OK for you? I took the first section and pasted it into a
new file, but then had various problems with EOLs. With those fixed(I
think) the following gave me: WARNING: No top level geometry to render.

module funnel(h, d, x, y) {
// Makes a solid shape that is a rectangle at one end and a circle at
the other.
// Could easily be adapted for shaping any regular polygon to any other
regular polygon.
// h: transition height, d: diameter of circular end, x: x-dimension
//(length) of rectangular end, y: y-dimension (width) of rectangular
end.
hull() {
resize([d, d, h]) cylinder(h = 1, d1 = 0, d2 = 1, $fn = 60);
// inverted cone
resize([x, y, h]) rotate(45) cylinder(h = 1, d1 = 1, d2 = 0, $fn = 4);
// cone with 4 sides: pyramid
}
}


On Thu, 19 Jan 2023 08:49:28 -0800, you wrote:

Terry,

If you go with your second option of using the plywood plate with a
cut-out, then this code should help. You would add a straight cylinder
at the top  to form your push-in attachment, and a lugs with screw holes
at the bottom for fixing the plywood.

Cheers,

Steve

module funnel(h, d, x, y) {
   // Makes a solid shape that is a rectangle at one end and a circle
at the other.
   // Could easily be adapted for shaping any regular polygon to any
other regular polygon.
   // h: transition height, d: diameter of circular end, x: x-dimension
(length) of rectangular end, y: y-dimension (width) of rectangular end.
   hull() {
      resize([d, d, h]) cylinder(h = 1, d1 = 0, d2 = 1, $fn =
60);           // inverted cone
      resize([x, y, h]) rotate(45) cylinder(h = 1, d1 = 1, d2 = 0, $fn
= 4); // cone with 4 sides: pyramid
   }
}

// Example with additional use of multmatrix to shear the funnel shape
so that the top is off-centre.
height = 20; diameter = 15; length = 40; width = 30;  wall = 2; xOffset
= 10; yOffset = 7;
shear = [[1, 0, xOffset / height], [0, 1, yOffset / height]];
difference() {
   multmatrix(shear) funnel(height, diameter + wall, length + wall,
width + wall);
   multmatrix(shear) funnel(height, diameter, length, width);
}

On 2023-01-19 8:06 a.m., fred via Discuss wrote:


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

Terry, The EOL issue  is probably from the source code being messed up when I pasted it into an email. The lack of geometry to render is because the first block is a module that gets called from the second part. You need to include all the sample code to see any output. In my first message, I forgot to point out that the example funnel dimensions are the inner dimensions of the two ends of the funnel. You may need to compensate for that if you're making a shape that goes over a fitting rather than into it. Steve On 2023-01-19 9:13 a.m., Terry wrote: > Thanks Steve, that would be handy because I expect I do have some > aluminium or plastic tubing that would be the right diameter for my > hose - but my hole cutters are unlikely to match it. > > Did it preview OK for you? I took the first section and pasted it into a > new file, but then had various problems with EOLs. With those fixed(I > think) the following gave me: WARNING: No top level geometry to render. > > module funnel(h, d, x, y) { > // Makes a solid shape that is a rectangle at one end and a circle at > the other. > // Could easily be adapted for shaping any regular polygon to any other > regular polygon. > // h: transition height, d: diameter of circular end, x: x-dimension > //(length) of rectangular end, y: y-dimension (width) of rectangular > end. > hull() { > resize([d, d, h]) cylinder(h = 1, d1 = 0, d2 = 1, $fn = 60); > // inverted cone > resize([x, y, h]) rotate(45) cylinder(h = 1, d1 = 1, d2 = 0, $fn = 4); > // cone with 4 sides: pyramid > } > } > > -------------------- > > > On Thu, 19 Jan 2023 08:49:28 -0800, you wrote: > >> Terry, >> >> If you go with your second option of using the plywood plate with a >> cut-out, then this code should help. You would add a straight cylinder >> at the top  to form your push-in attachment, and a lugs with screw holes >> at the bottom for fixing the plywood. >> >> Cheers, >> >> Steve >> >> module funnel(h, d, x, y) { >>    // Makes a solid shape that is a rectangle at one end and a circle >> at the other. >>    // Could easily be adapted for shaping any regular polygon to any >> other regular polygon. >>    // h: transition height, d: diameter of circular end, x: x-dimension >> (length) of rectangular end, y: y-dimension (width) of rectangular end. >>    hull() { >>       resize([d, d, h]) cylinder(h = 1, d1 = 0, d2 = 1, $fn = >> 60);           // inverted cone >>       resize([x, y, h]) rotate(45) cylinder(h = 1, d1 = 1, d2 = 0, $fn >> = 4); // cone with 4 sides: pyramid >>    } >> } >> >> // Example with additional use of multmatrix to shear the funnel shape >> so that the top is off-centre. >> height = 20; diameter = 15; length = 40; width = 30;  wall = 2; xOffset >> = 10; yOffset = 7; >> shear = [[1, 0, xOffset / height], [0, 1, yOffset / height]]; >> difference() { >>    multmatrix(shear) funnel(height, diameter + wall, length + wall, >> width + wall); >>    multmatrix(shear) funnel(height, diameter, length, width); >> } >> >> >> >> >> On 2023-01-19 8:06 a.m., fred via Discuss wrote: >>> _______________________________________________ >>> 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
T
Terry
Thu, Jan 19, 2023 6:56 PM

Careless of me! Looks good now, thanks.


On Thu, 19 Jan 2023 09:54:39 -0800, you wrote:

Terry,

The EOL issue  is probably from the source code being messed up when I
pasted it into an email. The lack of geometry to render is because the
first block is a module that gets called from the second part. You need
to include all the sample code to see any output.

In my first message, I forgot to point out that the example funnel
dimensions are the inner dimensions of the two ends of the funnel. You
may need to compensate for that if you're making a shape that goes over
a fitting rather than into it.

Steve

On 2023-01-19 9:13 a.m., Terry wrote:

Thanks Steve, that would be handy because I expect I do have some
aluminium or plastic tubing that would be the right diameter for my
hose - but my hole cutters are unlikely to match it.

Did it preview OK for you? I took the first section and pasted it into a
new file, but then had various problems with EOLs. With those fixed(I
think) the following gave me: WARNING: No top level geometry to render.

module funnel(h, d, x, y) {
// Makes a solid shape that is a rectangle at one end and a circle at
the other.
// Could easily be adapted for shaping any regular polygon to any other
regular polygon.
// h: transition height, d: diameter of circular end, x: x-dimension
//(length) of rectangular end, y: y-dimension (width) of rectangular
end.
hull() {
resize([d, d, h]) cylinder(h = 1, d1 = 0, d2 = 1, $fn = 60);
// inverted cone
resize([x, y, h]) rotate(45) cylinder(h = 1, d1 = 1, d2 = 0, $fn = 4);
// cone with 4 sides: pyramid
}
}


On Thu, 19 Jan 2023 08:49:28 -0800, you wrote:

Terry,

If you go with your second option of using the plywood plate with a
cut-out, then this code should help. You would add a straight cylinder
at the top  to form your push-in attachment, and a lugs with screw holes
at the bottom for fixing the plywood.

Cheers,

Steve

module funnel(h, d, x, y) {
   // Makes a solid shape that is a rectangle at one end and a circle
at the other.
   // Could easily be adapted for shaping any regular polygon to any
other regular polygon.
   // h: transition height, d: diameter of circular end, x: x-dimension
(length) of rectangular end, y: y-dimension (width) of rectangular end.
   hull() {
      resize([d, d, h]) cylinder(h = 1, d1 = 0, d2 = 1, $fn =
60);           // inverted cone
      resize([x, y, h]) rotate(45) cylinder(h = 1, d1 = 1, d2 = 0, $fn
= 4); // cone with 4 sides: pyramid
   }
}

// Example with additional use of multmatrix to shear the funnel shape
so that the top is off-centre.
height = 20; diameter = 15; length = 40; width = 30;  wall = 2; xOffset
= 10; yOffset = 7;
shear = [[1, 0, xOffset / height], [0, 1, yOffset / height]];
difference() {
   multmatrix(shear) funnel(height, diameter + wall, length + wall,
width + wall);
   multmatrix(shear) funnel(height, diameter, length, width);
}

On 2023-01-19 8:06 a.m., fred via Discuss wrote:


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

Careless of me! Looks good now, thanks. -------------------- On Thu, 19 Jan 2023 09:54:39 -0800, you wrote: >Terry, > >The EOL issue  is probably from the source code being messed up when I >pasted it into an email. The lack of geometry to render is because the >first block is a module that gets called from the second part. You need >to include all the sample code to see any output. > >In my first message, I forgot to point out that the example funnel >dimensions are the inner dimensions of the two ends of the funnel. You >may need to compensate for that if you're making a shape that goes over >a fitting rather than into it. > >Steve > >On 2023-01-19 9:13 a.m., Terry wrote: >> Thanks Steve, that would be handy because I expect I do have some >> aluminium or plastic tubing that would be the right diameter for my >> hose - but my hole cutters are unlikely to match it. >> >> Did it preview OK for you? I took the first section and pasted it into a >> new file, but then had various problems with EOLs. With those fixed(I >> think) the following gave me: WARNING: No top level geometry to render. >> >> module funnel(h, d, x, y) { >> // Makes a solid shape that is a rectangle at one end and a circle at >> the other. >> // Could easily be adapted for shaping any regular polygon to any other >> regular polygon. >> // h: transition height, d: diameter of circular end, x: x-dimension >> //(length) of rectangular end, y: y-dimension (width) of rectangular >> end. >> hull() { >> resize([d, d, h]) cylinder(h = 1, d1 = 0, d2 = 1, $fn = 60); >> // inverted cone >> resize([x, y, h]) rotate(45) cylinder(h = 1, d1 = 1, d2 = 0, $fn = 4); >> // cone with 4 sides: pyramid >> } >> } >> >> -------------------- >> >> >> On Thu, 19 Jan 2023 08:49:28 -0800, you wrote: >> >>> Terry, >>> >>> If you go with your second option of using the plywood plate with a >>> cut-out, then this code should help. You would add a straight cylinder >>> at the top  to form your push-in attachment, and a lugs with screw holes >>> at the bottom for fixing the plywood. >>> >>> Cheers, >>> >>> Steve >>> >>> module funnel(h, d, x, y) { >>>    // Makes a solid shape that is a rectangle at one end and a circle >>> at the other. >>>    // Could easily be adapted for shaping any regular polygon to any >>> other regular polygon. >>>    // h: transition height, d: diameter of circular end, x: x-dimension >>> (length) of rectangular end, y: y-dimension (width) of rectangular end. >>>    hull() { >>>       resize([d, d, h]) cylinder(h = 1, d1 = 0, d2 = 1, $fn = >>> 60);           // inverted cone >>>       resize([x, y, h]) rotate(45) cylinder(h = 1, d1 = 1, d2 = 0, $fn >>> = 4); // cone with 4 sides: pyramid >>>    } >>> } >>> >>> // Example with additional use of multmatrix to shear the funnel shape >>> so that the top is off-centre. >>> height = 20; diameter = 15; length = 40; width = 30;  wall = 2; xOffset >>> = 10; yOffset = 7; >>> shear = [[1, 0, xOffset / height], [0, 1, yOffset / height]]; >>> difference() { >>>    multmatrix(shear) funnel(height, diameter + wall, length + wall, >>> width + wall); >>>    multmatrix(shear) funnel(height, diameter, length, width); >>> } >>> >>> >>> >>> >>> On 2023-01-19 8:06 a.m., fred via Discuss wrote: >>>> _______________________________________________ >>>> 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