Welcome! Log In Create A New Profile

Advanced

How do you make an ellipse with a rounded base?

Posted by dc42 
How do you make an ellipse with a rounded base?
February 06, 2015 04:12PM
I have taken on the task of making a stage prop for a forthcoming stage show. The prop is a hand-held vanity mirror, so what I basically want to print is a very short elliptic cylinder but with a rounded base and top. I know how to create an elliptic cylinder in OpenScad, but how can I get the rounded base and top?



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: How do you make an ellipse with a rounded base?
February 07, 2015 02:14AM
Is it somthing like this you are looking for?


// elliptic cylinder with rounded top
module elrdcyl(
   w, // width of cylinder
   d, // depth of cylinder
   h1,// straight height of cylinder
   h2 // height of rounded top
   ) {
   intersection(){
     union(){
       scale([w/2,d/2,1])cylinder(r=1,h=h1,$fn=36);  // cylinder
       translate([0,0,h1])scale([w/2,d/2,h2])sphere(r=1,$fn=36);  // top
     }
     scale([w/2,d/2,1])cylinder(r=1,h=h1+h2,$fn=36); // only needed if h2>h1 
   }
}

elrdcyl(50,25,10,20);

Edited 1 time(s). Last edit at 02/07/2015 02:20AM by enif.
Re: How do you make an ellipse with a rounded base?
February 07, 2015 02:27AM
Sorry, I misread your post thinking that you only wanted one rounded side. Having rounded base and top is even simpler...



// elliptic cylinder with rounded base *and* top
module elrdcyl2(
   w, // width of cylinder
   d, // depth of cylinder
   h1,// straight height of cylinder
   h2 // height of rounded base and top
   ) {
       hull()
         for(z=[0,h1])
            translate([0,0,z])scale([w/2,d/2,h2])sphere(r=1,$fn=36);  // top
}

elrdcyl2(50,25,10,20);


Re: How do you make an ellipse with a rounded base?
February 07, 2015 04:01AM
Thanks, but what I need is for the base and the top to be flat over most of the area but for the edges to be rounded. Like an elliptical toroid united with an elliptical cylinder. Is there a way to generate a toroid in OpenScad?

I could take your suggestion and truncate the top and bottom by subtracting cubes, but then the edges would still be sharper than I want even if not right angled. OTOH I guess I will have to compromise anyway to avoid excessive overhang.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: How do you make an ellipse with a rounded base?
February 07, 2015 04:41AM
I solved it with a bit of googling:

initialRadius = 50;
height = 10;
rounding = 2;

module roundedCylinder(cRadius, cHeight, cRounding) {
	translate ([0, 0, cRounding])
		rotate_extrude (convexity = 10, $fn = 256)
			translate ([cRadius - cRounding, 0, 0])
				circle (r = cRounding);
	translate ([0, 0, cHeight - cRounding])
		rotate_extrude (convexity = 10, $fn = 256)
			translate ([cRadius - cRounding, 0, 0])
				circle (r = cRounding);
	cylinder(r=cRadius - cRounding, h = cHeight, $fn=256);
	translate([0, 0, cRounding])
		cylinder(r=cRadius, h = cHeight - 2 * cRounding, $fn=256);
}

scale([0.7,1,1])
	roundedCylinder(initialRadius, height, rounding);

enif, thanks for your suggestions, they got me thinking along the right lines.

Edited 2 time(s). Last edit at 02/07/2015 04:42AM by dc42.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Sorry, only registered users may post in this forum.

Click here to login