I also think this is a good idea.
To test it I have quickly rewritten my g-code wheels program see attached file. It currently works only for paths cut in XY plane using XY movements. I cannot check this but the axis path plot look ok.

My setup is a rotary system so I need to convert all cartesian XYZ movements into polar R theta depth movements where rotation is around the Z axis. Instead of move emitting g1 X?? Y?? Z?? I need to emit g1 x?? C?? Z?? . I am not sure how to do this. I havent looked yet in detail at the source code . I would appreciate any help / suggestions you have for creating a polar version of the goto and move functions.

Thanks

Alan
/********************************************************/
/* Code to produce wheels paths                         */
/* Using GCMC Compiler                                  */
/* Author: Alan Battersby                               */
/* Version: 1.0                                         */
/********************************************************/

/********************************************************/
/* Each wheel is a vector of three components           */
/* Radius - The radius of the wheel                     */
/* Speed  - The speed of the wheel                      */
/* Phase  - The phase of the wheel                      */

function Radius(wheel)
{
        return wheel[0];
}

function Speed(wheel)
{
        return wheel[1];
}

function Phase(wheel)
{
        return wheel[2];
}

function CreateWheel(r,s,p)
{
        local w;
        w = [r,s,p];
        return w;
}

/* Wheels are held in global vector list called wheels  */

function CalcPoint (wheels,angle, cdepth)
{
        local a,at, posn,r,s,p;
        
        posn= [0,0,cdepth];
        a = to_rad(angle);
        
        foreach (wheels; w)
        {
                r = Radius(w);
                s = Speed(w);
                p = to_rad(Phase(w));
                at = s * a + p;
                posn[0] += r * cos(at);
                posn[1] += r * sin(at); 
        }

        return posn;
}

function CutPath (wheels, start,inc,end, cdepth , scale)
{
        local angle, point;
        angle = start;
        /* move to first point at safe height */
        while (angle <= end)
        {
                
                if (angle == start)
                {
                  /* we should be at safe height */
                  /* so move to cutting depth    */
                        point = CalcPoint(wheels,angle,safeheight);
                        point = ScaleBy(scale,point);
                        goto(point);
                        goto([-,-,cdepth]);
                }
                else
                {
                        point = CalcPoint(wheels,angle,cdepth);
                        point = ScaleBy(scale,point);
                        move(point);
                }
                angle += inc;
        }
}
/******************* Library ****************************/
function GoAtSafeHeight(x,y)
{
        goto([-,-,safeheight]);
        goto([x,y,safeheight]);
}

function ScaleBy(sv, v)
{
        return [sv[0] * v[0], sv[1] * v[1], sv[2] * v[2]];
}
/******************* main program ***********************/
safeheight = 1mm;
cuttingdepth = -1mm;
svec = [5,5,1];
wheels = {};
wheels[0] = CreateWheel(10,1,0);
wheels[1] = CreateWheel(5,7,0);
wheels[2] = CreateWheel(3.333,-17,90);
feedrate(60);
GoAtSafeHeight(0,0);
CutPath(wheels,0,0.01,360,cuttingdepth, svec);
GoAtSafeHeight(0,0);


------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to