discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: [OpenSCAD] incrementing variables in order to slice an object and "modulate" it

P
Parkinbot
Mon, Mar 21, 2016 12:22 AM

rav0r wrote

Thanks! At the last translation, there was a plus instead of the minus.

I do not have a clue how I could use hull inbetween the segments.. I tried
using hull and it makes no difference in this example.

I don't see the "plus" in your code you mean the sequence {300, 299, 298,
...} ?

Not your example, but I think that is what you are more or less heading at:

elliptic_ring();

module elliptic_ring(r1 = 10, r2 = 5, r = 2, slices = 100, h = 0, w = 360)
{
$fn=30;
dz = h/slices;
dwx = atan(h/(r1+r2)/PI);
for (i = [0:slices-1])
hull()
{
translate([r1*cos((i+1)w/slices), r2sin((i+1)*w/slices), (i+1)*dz])
rotate([90+dwx, 0, (i+1)*w/slices])
cylinder(r = r, h = .01);

	translate([r1*cos((i)*w/slices), r2*sin((i)*w/slices), i*dz])
   rotate([90+dwx, 0, i*w/slices])
	cylinder(r = r, h = .01); 
}

}

--
View this message in context: http://forum.openscad.org/incrementing-variables-in-order-to-slice-an-object-and-modulate-it-tp16600p16610.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

rav0r wrote > Thanks! At the last translation, there was a plus instead of the minus. > > I do not have a clue how I could use hull inbetween the segments.. I tried > using hull and it makes no difference in this example. I don't see the "plus" in your code you mean the sequence {300, 299, 298, ...} ? Not your example, but I think that is what you are more or less heading at: > elliptic_ring(); > > module elliptic_ring(r1 = 10, r2 = 5, r = 2, slices = 100, h = 0, w = 360) > { > $fn=30; > dz = h/slices; > dwx = atan(h/(r1+r2)/PI); > for (i = [0:slices-1]) > hull() > { > translate([r1*cos((i+1)*w/slices), r2*sin((i+1)*w/slices), (i+1)*dz]) > rotate([90+dwx, 0, (i+1)*w/slices]) > cylinder(r = r, h = .01); > > translate([r1*cos((i)*w/slices), r2*sin((i)*w/slices), i*dz]) > rotate([90+dwx, 0, i*w/slices]) > cylinder(r = r, h = .01); > } > } -- View this message in context: http://forum.openscad.org/incrementing-variables-in-order-to-slice-an-object-and-modulate-it-tp16600p16610.html Sent from the OpenSCAD mailing list archive at Nabble.com.