Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Morph circle to oval in openscad

I am trying to create a fan duct in openscad, flattening the duct from circular to oval. Is there a way to do this in openscad? If not, is there any other programmatic way to generate this type of 3d model?

Thanks Dennis

like image 668
Dennis Avatar asked Oct 22 '13 20:10

Dennis


Video Answer


1 Answers

Assuming by 'oval' you mean elipse, then the following creates a solid tapering from a circle to an ellipse:

    Delta=0.01;

    module connector (height,radius,eccentricity) {
        hull() {
          linear_extrude(height=Delta)
             circle(r=radius);
          translate([0,0,height - Delta])   
             linear_extrude(height=Delta) 
                scale([1,eccentricity]) 
                   circle(r=radius);
        }
      }

      connector(20,6,0.6);

You could make the tube by subtracting a smaller version:

module tube(height, radius, eccentricity=1, thickness) {
     difference() {
       connector(height,radius,eccentricity);
       translate([0,0,-(Delta+thickness)]) 
         connector(height + 2* (Delta +thickness) ,radius-thickness, eccentricity);
     }
   }
   tube(20,8,0.6,2);

but the wall thickness will not be uniform. To make a uniform wall, use minkowski to add the wall:

module tube(height, radius, eccentricity=1, thickness) {
    difference() {
      minkowski() {
        connector(height,radius,eccentricity);
        cylinder(height=height,r=thickness);
      }
    translate([0,0,-(Delta+thickness)]) 
        connector(height + 2* (Delta +thickness) ,radius, eccentricity);
    }
  }

tube(20,8,0.6,2);
like image 83
Chris Wallace Avatar answered Sep 27 '22 20:09

Chris Wallace