discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Create - formula (or module) - difficult

Jan Öhman
Sun, Mar 27, 2022 3:20 PM

Hi!
This script works.

radius = 10;angles = [0, 90];
points = [    for(a = [angles[0]:1:angles[1]]) [radius * cos(a), radius * sin(a)]];polygon(concat([[0, 0]], points));-....--....--....--....--....--....--....--....--....--....--....--....--....--....-

I was trying to create a function() to do the same thing. (but failed)

radius = 10;start = 0;stop =90;
points = test;polygon(concat([[0, 0]], points));
function test(radius = 10, start=0, stop=90){    angles = [start,  stop];    for(a = [angles[0]:1:angles[1]])         [radius * cos(a), radius * sin(a)]];}

Hi! This script works. radius = 10;angles = [0, 90]; points = [    for(a = [angles[0]:1:angles[1]]) [radius * cos(a), radius * sin(a)]];polygon(concat([[0, 0]], points));-.._..--.._..--.._..--.._..--.._..--.._..--.._..--.._..--.._..--.._..--.._..--.._..--.._..--.._..- I was trying to create a function() to do the same thing. (but failed) radius = 10;start = 0;stop =90; points = test;polygon(concat([[0, 0]], points)); function test(radius = 10, start=0, stop=90){    angles = [start,  stop];    for(a = [angles[0]:1:angles[1]])         [radius * cos(a), radius * sin(a)]];}