hi all,
I'm trying to programically set fixture offsets in C++ before G code execution.
In the KMotionCNC it is done by issuing pure g text command line aka "G54" which invovles createing/saving it to separate file and invoking "Interpret".
Is there any way to do the same by altering variable directly?
Tried this function based on KMotionCNC code but it does not work:
void CMotion::SetFixture(int fixtureNo, int X, int A)
{
setup_pointer ps = Interpreter->p_setup;
double *Vars = ps->parameters;
int Fix = fixtureNo - 1; // G54 is fixture "1", so it is 1 based
Vars[5221 + Fix * 20 + 0/*X axis*/] = (double)X *0.01 ;
Vars[5221 + Fix * 20 + 3/*A axis*/] = (double)A *0.01;
if (Interpreter->ReadAndSyncCurPositions(&ps->current_x, &ps->current_y, &ps->current_z,
&ps->AA_current, &ps->BB_current, &ps->CC_current)) return;
Fix = ps->origin_index - 1;
Vars[5221 + Fix * 20 + 0] += ps->current_x;
Vars[5221 + Fix * 20 + 3] += ps->AA_current;
// make sure Settings are in sync with any modified Vars
Interpreter->p_setup->origin_index = -1; // set invalid so it updates
Interpreter->ChangeFixtureNumber(fixtureNo);
}
any ideas what is missing here?
the above func used in this seq:
...
SetFixture(1, 50000, 3000); //G54 is fixture "1"
Interpreter->Interpret(BoardType, InFile, 0, -1, true, StatusCallback, CompleteCallback);
....
then executing G code:
G0 X800 A60
machine still moves to absolute pos ("800","60"). Tried to add G54 on top but no chagne
(there is another strange behaviour of G0 - posting it on separate thread)