//cnc.psm created by Vlad Veselov

ColorLightGray = Parameter("Color", 0x00808080, COLOR);

Pi = 3.14159265359;

A = /* 1;*/Parameter("A", 1, LINEAR); // амплитуда

F = /* 1;*/Parameter("F", 1, LINEAR); // частота

dF = /* 0;*/Parameter("dF", 0, LINEAR); // фаза

iMin = 0;

iMax = 100;

x0 = -Pi;

dx = 2*Pi;

sin_step = Polyline(GetMyPoint(i-1, x0, dx, iMax, iMin, A, dF, Pi, F), GetMyPoint(i, x0, dx, iMax, iMin, A, dF, Pi, F));

g = MCopy(sin_step, i, iMin, i < iMax);

xMin = GetX(iMin, x0, dx, iMax, iMin)

yMin = -A;

xMax = GetX(iMax, x0, dx, iMax, iMin)

yMax = +A;

Output(g);

// Base

Base3D = SetProperties(Thickness(Rectangle(10,10,0,0), -1), "PenColor" = ColorLightGray);

// Tool

RB = 1/5;

RS = 1.5;

dH = 0.1;

x1 = GetX(i, x0, dx, iMax, iMin);

y1 = GetY(x1, A, dF, Pi, F);

//Tool = Move(Cone(-RS, RB, 0), x1, y1, dH);

pathA = MCopy(Point(x1,y1), i, iMin, i < iMax);

Path = ArrayToPolyline(pathA);

profile = Polyline(Point(0, -RS), Point(-RB,0),

Point(RB,0),Point(0, -RS));

Tool = Sweep(profile, Path,180);

Res = BooleanSubtract(Base3D, Tool);

Output(Res);

//Res1 = MCopy(Res, i, iMin, i < iMax);

//Output(Res1);

/////////////////////////////////

GetX(i, x0, dx, iMax, iMin)

{

x = x0 + dx * i/(iMax - iMin);

Output = {x};

}

GetY(x, A, dF, Pi, F)

{

y = A*sin(dF + 360/(2*Pi)*x*F);

Output = {y};

}

GetMyPoint(i, x0, dx, iMax, iMin, A, dF, Pi, F)

{

x = GetX(i, x0, dx, iMax, iMin);

y = GetY(x, A, dF, Pi, F);

p = Point(x, y);

Output = {p};

}

Vlad