Get Offset values method?

Moderators: TomKerekes, dynomotion

Post Reply
SamMarrocco
Posts: 85
Joined: Fri Apr 27, 2018 12:44 pm

Get Offset values method?

Post by SamMarrocco » Fri Dec 18, 2020 1:29 pm

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?

User avatar
TomKerekes
Posts: 2527
Joined: Mon Dec 04, 2017 1:49 am

Re: Get Offset values method?

Post by TomKerekes » Fri Dec 18, 2020 5:38 pm

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);

Regards,

Tom Kerekes
Dynomotion, Inc.

SamMarrocco
Posts: 85
Joined: Fri Apr 27, 2018 12:44 pm

Re: Get Offset values method?

Post by SamMarrocco » Fri Dec 18, 2020 6:11 pm

Thanks Tom, I'll try that.

Post Reply