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
Sun, Mar 20, 2016 10:13 PM

You can use a "for" loop. Its iteration variable will change its value and
can be used as function argument.

This would be your code for 30 iterations. Btw there are better ways to
express this (e.g. hull())!

module test() {
cube([200,10,10]);
}

for (i=[1:30])
translate([0,0,(i-1)/10])
{
difference()
{
test();
translate([i,-100,-1]) cube([300,200,200]);
translate([-301-i,-100,-1]) cube([300,200,200]);
}
}

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

You can use a "for" loop. Its iteration variable will change its value and can be used as function argument. This would be your code for 30 iterations. Btw there are better ways to express this (e.g. hull())! > module test() { > cube([200,10,10]); > } > > for (i=[1:30]) > translate([0,0,(i-1)/10]) > { > difference() > { > test(); > translate([i,-100,-1]) cube([300,200,200]); > translate([-301-i,-100,-1]) cube([300,200,200]); > } > } -- View this message in context: http://forum.openscad.org/incrementing-variables-in-order-to-slice-an-object-and-modulate-it-tp16600p16606.html Sent from the OpenSCAD mailing list archive at Nabble.com.