Page 1 of 1

Get Offset values method?

Posted: Fri Dec 18, 2020 1:29 pm
by SamMarrocco
Is there a dotnet method for returning the current position that is equivalent to the values in the DROs when the KMotionCNC's Machine Coord checkbox is unchecked?

Re: Get Offset values method?

Posted: Fri Dec 18, 2020 5:38 pm
by TomKerekes
Hi Sam,

Machine coordinates can be converted to GCode coordinates like this:

Code: Select all

                    // Get Absolute Machine Coordinates and convert to GCode Coordinates
                    double x=0, y=0, z=0, a=0, b=0, c=0;
                    KM.CoordMotion.UpdateCurrentPositionsABS(ref x, ref y, ref z, ref a, ref b, ref c, false);
                    double xg = KM.CoordMotion.Interpreter.ConvertAbsToUserUnitsX(x);
                    double yg = KM.CoordMotion.Interpreter.ConvertAbsToUserUnitsY(y);
                    double zg = KM.CoordMotion.Interpreter.ConvertAbsToUserUnitsZ(z);
                    double ag = KM.CoordMotion.Interpreter.ConvertAbsToUserUnitsA(a);
                    double bg = KM.CoordMotion.Interpreter.ConvertAbsToUserUnitsB(b);
                    double cg = KM.CoordMotion.Interpreter.ConvertAbsToUserUnitsC(b);


Re: Get Offset values method?

Posted: Fri Dec 18, 2020 6:11 pm
by SamMarrocco
Thanks Tom, I'll try that.