discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

painted myself into a corner

GH
gene heskett
Sun, Nov 13, 2022 10:41 PM

Greetings all;

I am in the process of replacing a hot end, along with all the junk
electronics of a bigger tronxu-400-pro printer.

Presently printing the adapter plate that bolts to the carriage via the
usual pair of bolts thru the top of the hot end.

One of crealities new Spider hot ends with 4 teeny 2.5mm tapped
boltholes surrounding the bowden tube entry will be mounted
to the bottom face of this "shelf" after unscrewing that fitting. An
orbiter v1.5 extruder will be screwed to the top so a short piece of
capricorn is trapped between them. Std so far...

The problem is that the fan houses on these BBLB printers don't control
the air from the fans at all well, depending on brute force and SWAG's
to get the needed cooling, so I want to put a short duct on the back of
the circular fan, perhaps 20mm long, that funnels the fans air down to a
22x27mm rectangle centered on the heat break, not exactly axially
aligned by 3 or so mm's.

We can taper a cylinder, but how the heck do we go from a 39mm circle
entrance to a 22x27mm rectangle exit? With walls about a mm thick since
this is flying weight?

I can envision writing a sine/cos to build a circle of polygon points
for the round end, and doing an equal number of ploygon points that
describe the rectangle but how do I connect them to get the needed
smooth funnel?

Many thanks for any hints.

Cheers, Gene Heskett.

"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.

Greetings all; I am in the process of replacing a hot end, along with all the junk electronics of a bigger tronxu-400-pro printer. Presently printing the adapter plate that bolts to the carriage via the usual pair of bolts thru the top of the hot end. One of crealities new Spider hot ends with 4 teeny 2.5mm tapped boltholes surrounding the bowden tube entry will be mounted to the bottom face of this "shelf" after unscrewing that fitting. An orbiter v1.5 extruder will be screwed to the top so a short piece of capricorn is trapped between them. Std so far... The problem is that the fan houses on these BBLB printers don't control the air from the fans at all well, depending on brute force and SWAG's to get the needed cooling, so I want to put a short duct on the back of the circular fan, perhaps 20mm long, that funnels the fans air down to a 22x27mm rectangle centered on the heat break, not exactly axially aligned by 3 or so mm's. We can taper a cylinder, but how the heck do we go from a 39mm circle entrance to a 22x27mm rectangle exit? With walls about a mm thick since this is flying weight? I can envision writing a sine/cos to build a circle of polygon points for the round end, and doing an equal number of ploygon points that describe the rectangle but how do I connect them to get the needed smooth funnel? Many thanks for any hints. Cheers, Gene Heskett. -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author, 1940) If we desire respect for the law, we must first make the law respectable. - Louis D. Brandeis Genes Web page <http://geneslinuxbox.net:6309/>
J
jon
Sun, Nov 13, 2022 10:47 PM

Gene:

Do examples 11 and 12 help at all?

https://github.com/revarbat/BOSL2/wiki/skin.scad

Jon

On 11/13/2022 5:41 PM, gene heskett wrote:

Greetings all;

I am in the process of replacing a hot end, along with all the junk
electronics of a bigger tronxu-400-pro printer.

Presently printing the adapter plate that bolts to the carriage via
the usual pair of bolts thru the top of the hot end.

One of crealities new Spider hot ends with 4 teeny 2.5mm tapped
boltholes surrounding the bowden tube entry will be mounted
to the bottom face of this "shelf" after unscrewing that fitting. An
orbiter v1.5 extruder will be screwed to the top so a short piece of
capricorn is trapped between them. Std so far...

The problem is that the fan houses on these BBLB printers don't control
the air from the fans at all well, depending on brute force and SWAG's
to get the needed cooling, so I want to put a short duct on the back
of the circular fan, perhaps 20mm long, that funnels the fans air down
to a 22x27mm rectangle centered on the heat break, not exactly axially
aligned by 3 or so mm's.

We can taper a cylinder, but how the heck do we go from a 39mm circle
entrance to a 22x27mm rectangle exit? With walls about a mm thick
since this is flying weight?

I can envision writing a sine/cos to build a circle of polygon points
for the round end, and doing an equal number of ploygon points that
describe the rectangle but how do I connect them to get the needed
smooth funnel?

Many thanks for any hints.

Cheers, Gene Heskett.

Gene: Do examples 11 and 12 help at all? https://github.com/revarbat/BOSL2/wiki/skin.scad Jon On 11/13/2022 5:41 PM, gene heskett wrote: > Greetings all; > > I am in the process of replacing a hot end, along with all the junk > electronics of a bigger tronxu-400-pro printer. > > Presently printing the adapter plate that bolts to the carriage via > the usual pair of bolts thru the top of the hot end. > > One of crealities new Spider hot ends with 4 teeny 2.5mm tapped > boltholes surrounding the bowden tube entry will be mounted > to the bottom face of this "shelf" after unscrewing that fitting. An > orbiter v1.5 extruder will be screwed to the top so a short piece of > capricorn is trapped between them. Std so far... > > The problem is that the fan houses on these BBLB printers don't control > the air from the fans at all well, depending on brute force and SWAG's > to get the needed cooling, so I want to put a short duct on the back > of the circular fan, perhaps 20mm long, that funnels the fans air down > to a 22x27mm rectangle centered on the heat break, not exactly axially > aligned by 3 or so mm's. > > We can taper a cylinder, but how the heck do we go from a 39mm circle > entrance to a 22x27mm rectangle exit? With walls about a mm thick > since this is flying weight? > > I can envision writing a sine/cos to build a circle of polygon points > for the round end, and doing an equal number of ploygon points that > describe the rectangle but how do I connect them to get the needed > smooth funnel? > > Many thanks for any hints. > > Cheers, Gene Heskett.
SL
Steve Lelievre
Sun, Nov 13, 2022 11:00 PM

I'm not entirely clear what shape you're aiming for; is it something
like this? (once adjusted for your exact dimensions)

Steve

difference() {
   hull(){
      translate([0,0,20 - 1]) cylinder(h = 1, d = 39 + 2, center=true);
      cube([22 + 1, 27 + 1, 1], center=true);
   }
   hull(){
      translate([0,0, 20 - 1]) cylinder(h = 1, d = 39, center=true);
      cube([22, 27, 1], center=true);
   }
}

On 2022-11-13 2:41 p.m., gene heskett wrote:

We can taper a cylinder, but how the heck do we go from a 39mm circle
entrance to a 22x27mm rectangle exit?

I'm not entirely clear what shape you're aiming for; is it something like this? (once adjusted for your exact dimensions) Steve difference() {    hull(){       translate([0,0,20 - 1]) cylinder(h = 1, d = 39 + 2, center=true);       cube([22 + 1, 27 + 1, 1], center=true);    }    hull(){       translate([0,0, 20 - 1]) cylinder(h = 1, d = 39, center=true);       cube([22, 27, 1], center=true);    } } On 2022-11-13 2:41 p.m., gene heskett wrote: > > We can taper a cylinder, but how the heck do we go from a 39mm circle > entrance to a 22x27mm rectangle exit?
GH
gene heskett
Mon, Nov 14, 2022 12:37 AM

On 11/13/22 17:47, jon wrote:

Gene:

Do examples 11 and 12 help at all?

https://github.com/revarbat/BOSL2/wiki/skin.scad

Jon

That looks like the general idea. I'll have to see if I can bend it to
do the job. I've not had occasion until now to look at BOSL2 so this
will hopefully be a learning experience. If I can get my ancient wet ram
to understand it.

Thank you very much, Jon.

Take care and stay well.

[...]

Cheers, Gene Heskett.

"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.

On 11/13/22 17:47, jon wrote: > Gene: > > Do examples 11 and 12 help at all? > > https://github.com/revarbat/BOSL2/wiki/skin.scad > > Jon That looks like the general idea. I'll have to see if I can bend it to do the job. I've not had occasion until now to look at BOSL2 so this will hopefully be a learning experience. If I can get my ancient wet ram to understand it. Thank you very much, Jon. Take care and stay well. [...] Cheers, Gene Heskett. -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author, 1940) If we desire respect for the law, we must first make the law respectable. - Louis D. Brandeis Genes Web page <http://geneslinuxbox.net:6309/>
GH
gene heskett
Mon, Nov 14, 2022 12:59 AM

On 11/13/22 17:47, jon wrote:

Gene:

Do examples 11 and 12 help at all?

https://github.com/revarbat/BOSL2/wiki/skin.scad

Jon

I re-arranged example 11 into this, my style of coding:

module funnel()
{
include <BOSL2/std.scad>
xrot(90)down(1.5)
difference()
{
skin([square([2,.2],center=true),
circle($fn=64,r=0.5)], z=[0,3],
slices=40,sampling="length",method="reindex");
skin([square([1.9,.1],center=true),
circle($fn=64,r=0.45)], z=[-.01,3.01],
slices=40,sampling="length",method="reindex");
}
}
funnel();

But got this in the error window:

ERROR: Parser error: syntax error in file
.local/share/OpenSCAD/libraries/BOSL2/shapes3d.scad, line 15
Execution aborted

Line 15 of that file says use <builtins.scad>

And both files exist in the BOSL2 subdir of the library path.

Being green at BOSL2, I need a Translation.

Thanks, take care now.

Cheers, Gene Heskett.

"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.

On 11/13/22 17:47, jon wrote: > Gene: > > Do examples 11 and 12 help at all? > > https://github.com/revarbat/BOSL2/wiki/skin.scad > > Jon I re-arranged example 11 into this, my style of coding: module funnel() { include <BOSL2/std.scad> xrot(90)down(1.5) difference() { skin([square([2,.2],center=true), circle($fn=64,r=0.5)], z=[0,3], slices=40,sampling="length",method="reindex"); skin([square([1.9,.1],center=true), circle($fn=64,r=0.45)], z=[-.01,3.01], slices=40,sampling="length",method="reindex"); } } funnel(); But got this in the error window: ERROR: Parser error: syntax error in file .local/share/OpenSCAD/libraries/BOSL2/shapes3d.scad, line 15 Execution aborted Line 15 of that file says use <builtins.scad> And both files exist in the BOSL2 subdir of the library path. Being green at BOSL2, I need a Translation. Thanks, take care now. Cheers, Gene Heskett. -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author, 1940) If we desire respect for the law, we must first make the law respectable. - Louis D. Brandeis Genes Web page <http://geneslinuxbox.net:6309/>
AM
Adrian Mariano
Mon, Nov 14, 2022 1:14 AM

You can't include BOSL2 inside another module.  That's likely to get you
in trouble with almost any included library.  Move the include to the top
level of your program and it will work.

On Sun, Nov 13, 2022 at 7:59 PM gene heskett gheskett@shentel.net wrote:

On 11/13/22 17:47, jon wrote:

Gene:

Do examples 11 and 12 help at all?

https://github.com/revarbat/BOSL2/wiki/skin.scad

Jon

I re-arranged example 11 into this, my style of coding:

module funnel()
{
include <BOSL2/std.scad>
xrot(90)down(1.5)
difference()
{
skin([square([2,.2],center=true),
circle($fn=64,r=0.5)], z=[0,3],
slices=40,sampling="length",method="reindex");
skin([square([1.9,.1],center=true),
circle($fn=64,r=0.45)], z=[-.01,3.01],
slices=40,sampling="length",method="reindex");
}
}
funnel();

But got this in the error window:

ERROR: Parser error: syntax error in file
.local/share/OpenSCAD/libraries/BOSL2/shapes3d.scad, line 15
Execution aborted

Line 15 of that file says use <builtins.scad>

And both files exist in the BOSL2 subdir of the library path.

Being green at BOSL2, I need a Translation.

Thanks, take care now.

Cheers, Gene Heskett.

"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.


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

You can't include BOSL2 inside another module. That's likely to get you in trouble with almost any included library. Move the include to the top level of your program and it will work. On Sun, Nov 13, 2022 at 7:59 PM gene heskett <gheskett@shentel.net> wrote: > On 11/13/22 17:47, jon wrote: > > Gene: > > > > Do examples 11 and 12 help at all? > > > > https://github.com/revarbat/BOSL2/wiki/skin.scad > > > > Jon > > I re-arranged example 11 into this, my style of coding: > > module funnel() > { > include <BOSL2/std.scad> > xrot(90)down(1.5) > difference() > { > skin([square([2,.2],center=true), > circle($fn=64,r=0.5)], z=[0,3], > slices=40,sampling="length",method="reindex"); > skin([square([1.9,.1],center=true), > circle($fn=64,r=0.45)], z=[-.01,3.01], > slices=40,sampling="length",method="reindex"); > } > } > funnel(); > > But got this in the error window: > > ERROR: Parser error: syntax error in file > .local/share/OpenSCAD/libraries/BOSL2/shapes3d.scad, line 15 > Execution aborted > > Line 15 of that file says use <builtins.scad> > > And both files exist in the BOSL2 subdir of the library path. > > Being green at BOSL2, I need a Translation. > > Thanks, take care now. > > Cheers, Gene Heskett. > -- > "There are four boxes to be used in defense of liberty: > soap, ballot, jury, and ammo. Please use in that order." > -Ed Howdershelt (Author, 1940) > If we desire respect for the law, we must first make the law respectable. > - Louis D. Brandeis > Genes Web page <http://geneslinuxbox.net:6309/> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
GH
gene heskett
Mon, Nov 14, 2022 1:35 AM

On 11/13/22 18:01, Steve Lelievre wrote:

I'm not entirely clear what shape you're aiming for; is it something
like this? (once adjusted for your exact dimensions)

Steve

That's quite close, I can put mounting ears on it easy enough, but how
do I put an offset into the rectangular end? 3, maybe 4mm up for
instance?  To get the bottom of it away from the hot block. Another
possibility is to add about 4mm of wings on each side and let it
straddle the hot end frame to locate it. Maybe with a wing on top to fit
between the top fin and the frame too. Possibilities are many but all
depend on being able to warp the output end up a mm or 3.

Yup, a translate in front of the cube works. I think I've got it.

Thank you Steve.  Take care and stay well.

difference() {
   hull(){
      translate([0,0,20 - 1]) cylinder(h = 1, d = 39 + 2, center=true);
      cube([22 + 1, 27 + 1, 1], center=true);
   }
   hull(){
      translate([0,0, 20 - 1]) cylinder(h = 1, d = 39, center=true);
      cube([22, 27, 1], center=true);
   }
}

On 2022-11-13 2:41 p.m., gene heskett wrote:

We can taper a cylinder, but how the heck do we go from a 39mm circle
entrance to a 22x27mm rectangle exit?


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

Cheers, Gene Heskett.

"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.

On 11/13/22 18:01, Steve Lelievre wrote: > I'm not entirely clear what shape you're aiming for; is it something > like this? (once adjusted for your exact dimensions) > > Steve > > That's quite close, I can put mounting ears on it easy enough, but how do I put an offset into the rectangular end? 3, maybe 4mm up for instance? To get the bottom of it away from the hot block. Another possibility is to add about 4mm of wings on each side and let it straddle the hot end frame to locate it. Maybe with a wing on top to fit between the top fin and the frame too. Possibilities are many but all depend on being able to warp the output end up a mm or 3. Yup, a translate in front of the cube works. I think I've got it. Thank you Steve. Take care and stay well. > difference() { >    hull(){ >       translate([0,0,20 - 1]) cylinder(h = 1, d = 39 + 2, center=true); >       cube([22 + 1, 27 + 1, 1], center=true); >    } >    hull(){ >       translate([0,0, 20 - 1]) cylinder(h = 1, d = 39, center=true); >       cube([22, 27, 1], center=true); >    } > } > > > On 2022-11-13 2:41 p.m., gene heskett wrote: >> >> We can taper a cylinder, but how the heck do we go from a 39mm circle >> entrance to a 22x27mm rectangle exit? > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org Cheers, Gene Heskett. -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author, 1940) If we desire respect for the law, we must first make the law respectable. - Louis D. Brandeis Genes Web page <http://geneslinuxbox.net:6309/>
GH
gene heskett
Mon, Nov 14, 2022 1:41 AM

On 11/13/22 20:15, Adrian Mariano wrote:

You can't include BOSL2 inside another module.  That's likely to get you
in trouble with almost any included library.  Move the include to the top
level of your program and it will work.

Ahh, a limitation I hadn't learned yet.  Thank you Jon.
Steves idea with the hull can be made to work, all I need now is some
location ears or wings. Play time tomorrow when the printer is free.
Right now its making the last mod to the first of 2 pieces.

Cheers, Gene Heskett.

"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.

On 11/13/22 20:15, Adrian Mariano wrote: > You can't include BOSL2 inside another module. That's likely to get you > in trouble with almost any included library. Move the include to the top > level of your program and it will work. Ahh, a limitation I hadn't learned yet. Thank you Jon. Steves idea with the hull can be made to work, all I need now is some location ears or wings. Play time tomorrow when the printer is free. Right now its making the last mod to the first of 2 pieces. Cheers, Gene Heskett. -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author, 1940) If we desire respect for the law, we must first make the law respectable. - Louis D. Brandeis Genes Web page <http://geneslinuxbox.net:6309/>
GH
gene heskett
Mon, Nov 21, 2022 4:07 PM

On 11/13/22 18:01, Steve Lelievre wrote:

I'm not entirely clear what shape you're aiming for; is it something
like this? (once adjusted for your exact dimensions)

Steve

difference() {
   hull(){
      translate([0,0,20 - 1]) cylinder(h = 1, d = 39 + 2, center=true);
      cube([22 + 1, 27 + 1, 1], center=true);
   }
   hull(){
      translate([0,0, 20 - 1]) cylinder(h = 1, d = 39, center=true);
      cube([22, 27, 1], center=true);
   }
}

I bent, folded, stapled and otherwise mutilated this, got into a couple
days of it not rendering via F6, but I think I have it. test build on
the printer now. I added a more or less square flange to the input
circle, perforated that with some peg holes that match the holes in the
fan, and offset the output rectangle, and added another difference cube,
so it should now fit on the pegs sticking out of the front panel that
locate the fan, this sits on top of the fan and if the last difference
cube is correctly placed, it will be trapped until the heat from the hot
block a mm away, destroys it. Its the fans job to cool it enough that
doesn't happen.

Looks like the attached .png now.

Also a sorta bottom view, where each color is a different part on the
printer.

Thank you very much, Steve, it was, and is now, exactly what I had in mind.

Take care & stay well.

Cheers, Gene Heskett.

"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.

On 11/13/22 18:01, Steve Lelievre wrote: > I'm not entirely clear what shape you're aiming for; is it something > like this? (once adjusted for your exact dimensions) > > Steve > > > > difference() { >    hull(){ >       translate([0,0,20 - 1]) cylinder(h = 1, d = 39 + 2, center=true); >       cube([22 + 1, 27 + 1, 1], center=true); >    } >    hull(){ >       translate([0,0, 20 - 1]) cylinder(h = 1, d = 39, center=true); >       cube([22, 27, 1], center=true); >    } > } > I bent, folded, stapled and otherwise mutilated this, got into a couple days of it not rendering via F6, but I think I have it. test build on the printer now. I added a more or less square flange to the input circle, perforated that with some peg holes that match the holes in the fan, and offset the output rectangle, and added another difference cube, so it should now fit on the pegs sticking out of the front panel that locate the fan, this sits on top of the fan and if the last difference cube is correctly placed, it will be trapped until the heat from the hot block a mm away, destroys it. Its the fans job to cool it enough that doesn't happen. Looks like the attached .png now. Also a sorta bottom view, where each color is a different part on the printer. Thank you very much, Steve, it was, and is now, exactly what I had in mind. Take care & stay well. Cheers, Gene Heskett. -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author, 1940) If we desire respect for the law, we must first make the law respectable. - Louis D. Brandeis Genes Web page <http://geneslinuxbox.net:6309/>
SL
Steve Lelievre
Sun, Dec 11, 2022 10:33 PM

FYI,

I know that this thread is old now so interest will have waned and the
OP's requirement has been solved ... but I just realized that there is a
better way than I suggested in my original post from weeks ago, for
morphing a tube from having a rectangular end to a circular end (which
is what the OP wanted to do for a fan housing.)

The transition can be achieved, both exactly and code-efficiently, by
hulling a cone and an inverted pyramid. I implemented this solution as
the very small module called morph contained in the code pasted after my
signature (feel free to copy/adapt). To convert the morphed shape to a
hollow tube you either use Minkowski or make slightly oversize version
of the same shape, then subtract the original shape to leave only walls
(see the notes in my code.)

More generally, if you want to morph any polygon to any other polygon,
such as a pentagon to octagon as shown here, you just hull together a
cone and an inverted cone, setting the number of sides required for each
cone by supplying $fn parameters.

Cheers,

Steve

$fn = 60;

module morph(h, d, x, y) {
   // Morphs a rectangle to a circle. By Steve Lelievre, 2022.
   // h: transition height.
   // d: diameter of circular lower end.
   // x: x dimension (length) of rectangular upper end.
   // y: y dimension (width) of rectangular upper end.
   hull() {
      resize([d, d, h]) cylinder(h = 1, r1 = 0, r2 = 1);  // cone
      resize([x, y, h]) rotate(45) cylinder(h = 1, r1 = 1, r2 = 0, $fn
= 4); // inverted pyramid
   }
}

// Example usage
translate([-15, 0, 0]) morph(30, 25, 15, 12);

// Code snippet to demonstrate how the morph works
translate([-45, 0, 0]) union() {
   color("red", 0.3) resize([25, 25, 30]) cylinder(h = 1, r1 = 0, r2 =
1);  // cone
   color("green", 0.3) resize([15, 12, 30]) rotate(45) cylinder(h = 1,
r1 = 1, r2 = 0, $fn = 4); // inverted pyramid
   color("silver", 0.3) morph(30, 25, 15, 12);
}

// Extending the idea to make a tubular connector:

// Option A. Using Minkowski ensures wall thickness is exactly as
specified when measured in cross section.
// Corners of the rectangular end are rounded accordingly. THe corner
radius is the wall thickness.

module tubeA(h, d, x, y, w) {
   // Creates an open tube by Minkowski addition of a sphere to an
internal shape,
   // followed by trimming back to height and then subtraction of the
internal shape to hollow out the tube.
   // w: wall thickness. This is the thickness in cross section (what
would usually be considered the 'true' value).
   // The other parameters are those used in the morph module.

   sizeLimit = max(d / 2 + w, sqrt((x + w)^2 + (y + d)^2)); // maximum
radius needed for trimming cylinder
   difference() {
      intersection() {
         minkowski() {
            morph(h, d, x, y);
            sphere(r = w);
         }
         cylinder(h = h, r = sizeLimit);
      }
      morph(h, d, x, y);
   }
}

translate([15, 0, 0]) tubeA(30, 25, 15, 12, 1);

// Option B. Subtract inner shape from geometrically similar but
slightly larger outer shape.
// Gives square corners to rectangular end.
// !!! However, in some cases, the wall's cross section will be thinner
than this value !!!

module tubeB(h, d, x, y, w) {
   // w: wall thickness in horizontal section.
   // The other parameters are those used in the morph module.

   difference() {
      morph(h, d + 2 * w, x + 2 * w, y + 2 * w);
      morph(h, d, x, y);
   }
}

translate([45, 0, 0]) tubeB(30, 25, 15, 12, 1);

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

On 2022-11-13 3:00 p.m., Steve Lelievre wrote:

I'm not entirely clear what shape you're aiming for; is it something
like this? (once adjusted for your exact dimensions)

Steve

FYI, I know that this thread is old now so interest will have waned and the OP's requirement has been solved ... but I just realized that there is a better way than I suggested in my original post from weeks ago, for morphing a tube from having a rectangular end to a circular end (which is what the OP wanted to do for a fan housing.) The transition can be achieved, both exactly and code-efficiently, by hulling a cone and an inverted pyramid. I implemented this solution as the very small module called morph contained in the code pasted after my signature (feel free to copy/adapt). To convert the morphed shape to a hollow tube you either use Minkowski or make slightly oversize version of the same shape, then subtract the original shape to leave only walls (see the notes in my code.) More generally, if you want to morph any polygon to any other polygon, such as a pentagon to octagon as shown here, you just hull together a cone and an inverted cone, setting the number of sides required for each cone by supplying $fn parameters. Cheers, Steve >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> $fn = 60; module morph(h, d, x, y) {    // Morphs a rectangle to a circle. By Steve Lelievre, 2022.    // h: transition height.    // d: diameter of circular lower end.    // x: x dimension (length) of rectangular upper end.    // y: y dimension (width) of rectangular upper end.    hull() {       resize([d, d, h]) cylinder(h = 1, r1 = 0, r2 = 1);  // cone       resize([x, y, h]) rotate(45) cylinder(h = 1, r1 = 1, r2 = 0, $fn = 4); // inverted pyramid    } } // Example usage translate([-15, 0, 0]) morph(30, 25, 15, 12); // Code snippet to demonstrate how the morph works translate([-45, 0, 0]) union() {    color("red", 0.3) resize([25, 25, 30]) cylinder(h = 1, r1 = 0, r2 = 1);  // cone    color("green", 0.3) resize([15, 12, 30]) rotate(45) cylinder(h = 1, r1 = 1, r2 = 0, $fn = 4); // inverted pyramid    color("silver", 0.3) morph(30, 25, 15, 12); } // Extending the idea to make a tubular connector: // Option A. Using Minkowski ensures wall thickness is exactly as specified when measured in cross section. // Corners of the rectangular end are rounded accordingly. THe corner radius is the wall thickness. module tubeA(h, d, x, y, w) {    // Creates an open tube by Minkowski addition of a sphere to an internal shape,    // followed by trimming back to height and then subtraction of the internal shape to hollow out the tube.    // w: wall thickness. This is the thickness in cross section (what would usually be considered the 'true' value).    // The other parameters are those used in the morph module.    sizeLimit = max(d / 2 + w, sqrt((x + w)^2 + (y + d)^2)); // maximum radius needed for trimming cylinder    difference() {       intersection() {          minkowski() {             morph(h, d, x, y);             sphere(r = w);          }          cylinder(h = h, r = sizeLimit);       }       morph(h, d, x, y);    } } translate([15, 0, 0]) tubeA(30, 25, 15, 12, 1); // Option B. Subtract inner shape from geometrically similar but slightly larger outer shape. // Gives square corners to rectangular end. // !!! However, in some cases, the wall's cross section will be thinner than this value !!! module tubeB(h, d, x, y, w) {    // w: wall thickness in horizontal section.    // The other parameters are those used in the morph module.    difference() {       morph(h, d + 2 * w, x + 2 * w, y + 2 * w);       morph(h, d, x, y);    } } translate([45, 0, 0]) tubeB(30, 25, 15, 12, 1); <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< On 2022-11-13 3:00 p.m., Steve Lelievre wrote: > > I'm not entirely clear what shape you're aiming for; is it something > like this? (once adjusted for your exact dimensions) > > Steve > > > >