Reputation: 552
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]);
}
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.
Upvotes: 1
Views: 1541
Reputation: 1197
This is only a slight improvement:
$fn=80;
scale([1,2,1])
difference()
{
cylinder(r = 9.8/2, h = 1.7);
translate([0,0,-1]) cylinder(r = 7/2, h = 1.7+2);
translate([-2,2,-1]) cube([4,4,1.7+2]);
}
You can difference any number of objects from the first one, so the nested difference is not needed. I also changed the cube rotation for just translating the cube to the proper location.
If you want parallel sides to the opening, the cube works fine as the way to make the opening. If you want the sides to fully touch when the object if pinched and closed, then a polygon of some kind would be needed.
I also changed the objects to subtract to be on Z=-1 and changed their height to be "desired height + 2". I like this syntax since it is easier to replace the "desired height" with a variable if you want.
Upvotes: 2
Reputation: 4286
use scale([x-factor, y-factor, z-factor])
, e.g.
scale([2, 1, 1]) difference()
....
see Documentation.
Your way of opening is ok.
Upvotes: 3