void KmxController::OnCompleteCallback(int status, int line_no, int sequence_number,const char *err) { //This is a non blocking call from other thread to be enqueued in poll thread char buf[256]; bool blocking = false; interpreting = false; currentLine = line_no; if (performPostHaltCommand) { performPostHaltCommand=false; InvokeAction(ACTION_HALT,FALSE); // Do Special Action } int id = CreateCompleteCallbackData(status, line_no, sequence_number, err, blocking, buf, 256); if(strlen(err)>0){ OnErrorMessageCallback(err); } mq->EnqueueCallback(id, buf, blocking); }
int CGCodeInterpreter::DoResumeSafe() { double SafeZ,SafeZMachine,Machinex,Machiney,Machinez,Machinea,Machineb,Machinec; if (!m_Resume) return 0; m_Resume=false; // read the current positions if (CoordMotion->ReadCurAbsPosition(&CoordMotion->current_x,&CoordMotion->current_y,&CoordMotion->current_z, &CoordMotion->current_a,&CoordMotion->current_b,&CoordMotion->current_c,true)) return 1; if (CoordMotion->ReadCurAbsPosition(&Machinex,&Machiney,&Machinez,&Machinea,&Machineb,&Machinec,true)) return 1; SafeZ = UserUnitsToInches(m_ResumeSafeZ); // compute the safe z height as an absolute position // in user units if (m_ResumeSafeRelAbs) { // absolute height, convert value to Inches SafeZMachine = UserUnitsToInches(m_ResumeSafeZ+_setup.axis_offset_z+_setup.origin_offset_z+_setup.tool_length_offset); } else { // relative move, convert value to inches SafeZMachine = Machinez + UserUnitsToInches(m_ResumeSafeZ); } SetupTracker.ClearHistory(); SetupTracker.InsertState(&_setup); // save the interpreter state (including current sequence number) if (m_ResumeMoveToSafeZ) { // keep everything where it is, except move z Machinez = SafeZMachine; if (CoordMotion->StraightTraverse(Machinex,Machiney,Machinez,Machinea,Machineb,Machinec,false,_setup.sequence_number+1)) return 2; } if (m_ResumeTraverseXY) { // keep everything where it is, except move xy (and abc) Machinex = UserUnitsToInchesX(m_ResumeTraverseSafeX+_setup.axis_offset_x+_setup.origin_offset_x+_setup.tool_xoffset); Machiney = UserUnitsToInches(m_ResumeTraverseSafeY+_setup.axis_offset_y+_setup.origin_offset_y+_setup.tool_yoffset); Machinea = CoordMotion->m_StoppedMachinea; Machineb = CoordMotion->m_StoppedMachineb; Machinec = CoordMotion->m_StoppedMachinec; if (CoordMotion->StraightTraverse(Machinex,Machiney,Machinez,Machinea,Machineb,Machinec,false,_setup.sequence_number+1)) return 2; } if (m_ResumeSafeStartSpindle) { if (m_ResumeSafeSpindleCWCCW==0) { InvokeAction(3); // do the defined action for M Code } else { InvokeAction(4); // do the defined action for M Code } } if (m_ResumeDoSafeFeedZ) { Machinez = GC->UserUnitsToInches(m_ResumeFeedSafeZ+_setup.axis_offset_z+_setup.origin_offset_z+_setup.tool_length_offset); if (CoordMotion->StraightFeed(UserUnitsToInches(m_ResumeZFeedRate)/60.0,Machinex,Machiney,Machinez,Machinea,Machineb,Machinec,_setup.sequence_number+1,0)) return 2; } if (m_ResumeRestoreFeedRate) { p_setup->feed_rate = m_ResumeResumeFeedRate; SetFeedRate(m_ResumeResumeFeedRate); } if (CoordMotion->FlushSegments()) {CoordMotion->SetAbort(); return 1;} if (CoordMotion->WaitForSegmentsFinished(TRUE)) {CoordMotion->SetAbort(); return 1;} return 0; }
void __fastcall TframDCSView::Button1Click(TObject *Sender) { InvokeAction(ca_Refresh); }
void __fastcall TframDB::btnAddClick(TObject *Sender) { InvokeAction(ca_CreateSub); }
void __fastcall TframTag::btnSaveClick(TObject *Sender) { InvokeAction(ca_Save); }