Hey! This thing is still a Work in Progress. Files, instructions, and other stuff might change!

# Round to square connector

## by kitwallace, published Feb 14, 2013

Round to square connector Feb 14, 2013

## Description

This provides a connector between a square-ended tube and a round-ended tube. It is an application of the superellipse http://en.wikipedia.org/wiki/Superellipse. The script makes use of the fact that the superellipse family of curves encompassed both a square and a circle, so smooth morphing between the two can be achieved parametrically. The derivation of the script is discussed in my blog http://kitwallace.posterous.com/piet-hein-and-the-superegg

view all
units are undefined in OpenSCAD and in STL and are determined by the sofware which translates to gcode - however I always think in terms of mm.for your connector I think this would be simpler:
eps=0.1;module connector(h,d,w1,w2) {
hull(){
cylinder(r=d/2,h=eps);
translate([0,0,h-eps]) cube([w1,w2,eps],center=true);
}
}module connector_tube(h,d,w1,w2,t) {
difference () {
connector (h,d,w1,w2);
translate([0,0,-eps])
connector(h + 2 * eps,d-t,w1-t,w2-t);
}
};connector_tube(30,20,15,20,2);
This is almost exactly what I need (which is actually a rectangle to round tube connector). Thanks. Quick question from a first time user: are the units in mm ?
for a hollow duct, scale the above down a bit (only x and y) and then do the difference and you have a hollow duct. circle to square.

view more

view all

## Give a Shout Out

If you print this Thing and display it in public proudly give attribution by printing and displaying this tag.

## Instructions

• Generation time is long for higher numbers of layers
• Not yet proved by printing

#### Size

This is almost exactly what I need (which is actually a rectangle to round tube connector). Thanks. Quick question from a first time user: are the units in mm ?
kitwallace - in reply to peetucket
units are undefined in OpenSCAD and in STL and are determined by the sofware which translates to gcode - however I always think in terms of mm.for your connector I think this would be simpler:
eps=0.1;module connector(h,d,w1,w2) {
hull(){
cylinder(r=d/2,h=eps);
translate([0,0,h-eps]) cube([w1,w2,eps],center=true);
}
}module connector_tube(h,d,w1,w2,t) {
difference () {
connector (h,d,w1,w2);
translate([0,0,-eps])
connector(h + 2 * eps,d-t,w1-t,w2-t);
}
};connector_tube(30,20,15,20,2);
This new version seems to works much better!
Ok, next step: square/rectangle-to-circle/ellipse connector! That would be great if we could choose the exact shape of input and output, but I don't know if the maths can allow that...
kitwallace - in reply to fma
Thanks - problem is that the square section becomes a lozenge rather than a rectangle when eccentricity ne 1 - however I could go rectangle -square - ellipse but not sure it will look nice with the additional transition - working on it..
Well, this seemed like a good idea at the time, but thinking about it a bit more, a better way to achieve the same effect would be to use hull() between a square and a circle, both extruded a tad (TAD = 0.01;) Faster and more generic.
fma - in reply to kitwallace
Could you give an example? I don't understand how it works...
misan - in reply to fma
hull(){

cylinder(r=10,h=1);

translate([0,0,30]) cube([20,20,1],center=true);

}
misan - in reply to misan
for a hollow duct, scale the above down a bit (only x and y) and then do the difference and you have a hollow duct. circle to square.
kitwallace - in reply to kitwallace
Well maybe this approach has merit after all , now the thickness issue has been improved.
Excellent! But I think that 'square_side' should be devided by 2...
kitwallace - in reply to fma
You are so right - actually it was a sin upsidedown which came to the same thing.
fma - in reply to kitwallace
The script also says that the round diameter and square side are internal ones, but they are in fact external ones.
kitwallace - in reply to fma
Thanks again - I've now redone the approach to thicknessing which I hope is more satisfactory.
Top