I am making a mess of code trying to make a 'tunnel' or 'pipe' to connect a rectangular computer housing to a circular cooling fan.

my preferred way to transform a square into a circle is $(hull), like so

x=10;

y=20;

d=20;

lenght=15;

minimal_height_for_3d=0.01;

$fn=100;

hull(){

cube([x,y,minimal_height_for_3d], center=true);

translate([0,0,lenght]) cylinder(d=d,h=minimal_height_for_3d);

}

> I am making a mess of code trying to make a 'tunnel' or 'pipe' to connect a rectangular computer housing to a circular cooling fan.
my preferred way to transform a square into a circle is $(hull), like so
x=10;
y=20;
d=20;
lenght=15;
minimal_height_for_3d=0.01;
$fn=100;
hull(){
cube([x,y,minimal_height_for_3d], center=true);
translate([0,0,lenght]) cylinder(d=d,h=minimal_height_for_3d);
}