module slice(r = 10, deg = 30) {
fn=$fn!=0?$fn :round(deg/10); degn=(deg%360);
step=degn/fn; start=min(degn ,0); end=max(degn,0);
polygon(
concat(
[[0,0]],
[for(i=[start:step:end+step])
[cos(min(end,i))*r,sin(min(end,i))*r]] ));}
slice(10, 130);
--
Sent from: http://forum.openscad.org/
On 09/16/2018 05:38 PM, TLC123 wrote:
polygon(
concat(
[[0,0]],
[for(i=[start:step:end+step])
[cos(min(end,i))*r,sin(min(end,i))*r]] ));} >
The concat() is not needed anymore with the latest list comprehension
updates. It's possible to combine multiple generator expressions
or just simple values, e.g.:
polygon([
[0,0],
for(i=[start:step:end+step]) [cos(min(end,i))*r,sin(min(end,i))*r]
]);
ciao,
Torsten.
Oh thanks. That really makes things more elegant.
module slice(r = 10, deg = 30) {
fn=$fn!=0?$fn :round(deg/10); degn=(deg%360);
step=degn/fn; start=min(degn ,0); end=max(degn,0);
polygon(r*[[0,0], for(i=[start:step:end]) [cos(i),
sin(i)]]); }
slice(10, 130);
--
Sent from: http://forum.openscad.org/