Search code examples
openscad

Is there a way to stretch an object using OpenScad


I have created a little clip that has a ring shape, but I now would like to be able to stretch it into a more elliptical shape. As if you were to squash a rubber ring between 2 fingers.
Is there an easy way to do that with OpenSad?

Here is what I have so far:

difference()
{
    difference()
    {
        cylinder(r = 9.8/2, h = 1.7);
        translate([0,0,-0.1]) cylinder(r = 7/2, h = 1.9);
    }
    translate([2,2,-0.1]) rotate([0,0,90]) cube([4,4,3]);
}

It gives the following clip:
enter image description here

Also, if you can suggest a better way to create the opening, please let me know. I am not sure subtracting a cube from the ring is the best way to do it.


Solution

  • use scale([x-factor, y-factor, z-factor]), e.g.

    scale([2, 1, 1]) difference()
    ....
    

    see Documentation.

    Your way of opening is ok.