コード例 #1
0
 private void loadHeightMap(object sender, EventArgs e)
 {
     if (_heightmap_form.mapIsLoaded)
     {
         VisuGCode.drawHeightMap(_heightmap_form.Map);
         VisuGCode.createMarkerPath();
         VisuGCode.calcDrawingArea();
         pictureBox1.BackgroundImage = null;
         pictureBox1.Invalidate();
         isHeightMapApplied          = false;
         _heightmap_form.mapIsLoaded = false;
     }
 }
コード例 #2
0
 // handle event from create Height Map form
 private void getGCodeScanHeightMap(object sender, EventArgs e)
 {
     if (!isStreaming && _serial_form.serialPortOpen)
     {
         if (_heightmap_form.scanStarted)
         {
             string[] commands = _heightmap_form.getCode.ToString().Split('\r');
             _serial_form.isHeightProbing = true;
             foreach (string cmd in commands)            // fill up send queue
             {
                 if (machineStatus == grblState.alarm)
                 {
                     break;
                 }
                 sendCommand(cmd);
             }
             VisuGCode.drawHeightMap(_heightmap_form.Map);
             VisuGCode.createMarkerPath();
             VisuGCode.calcDrawingArea();
             pictureBox1.BackgroundImage = null;
             pictureBox1.Invalidate();
             if (_diyControlPad != null)
             {
                 _diyControlPad.isHeightProbing = true;
             }
             Properties.Settings.Default.counterUseHeightMap += 1;
         }
         else
         {
             _serial_form.stopStreaming();
             if (_diyControlPad != null)
             {
                 _diyControlPad.isHeightProbing = false;
             }
         }
         isHeightMapApplied = false;
     }
 }
コード例 #3
0
        /************************************************************
        * handle status report and position event from serial form
        * processStatus()
        ************************************************************/
        private void OnRaisePosEvent(object sender, PosEventArgs e)
        {
            //  if (logPosEvent)  Logger.Trace("OnRaisePosEvent  {0}  connect {1}  status {2}", e.Status.ToString(), _serial_form.serialPortOpen, e.Status.ToString());
            machineStatus        = e.Status;
            machineStatusMessage = e.StatMsg;
            machineParserState   = e.parserState;

/***** Restore saved position after reset and set initial feed rate: *****/
            if (flagResetOffset || (e.Status == grblState.reset))
            {
                processReset();
            }

/***** process grblState {idle, run, hold, home, alarm, check, door} *****/
            processStatus(e.Raw);

/***** check and submit override values, set labels, checkbox *****/
            processStatusMessage(e.StatMsg);

/***** set DRO digital-read-out labels with machine and work coordinates *****/
            if (!simuEnabled)
            {
                updateDRO();
            }

/***** parser state Spinde/Coolant on/off, on other Forms: FeedRate, SpindleSpeed, G54-Coord *****/
            processParserState(e.parserState);

/***** update 2D view *****/
            if (grbl.posChanged)
            {
                VisuGCode.createMarkerPath();
                VisuGCode.updatePathPositions();
                checkMachineLimit();
                pictureBox1.Invalidate();
                if (Properties.Settings.Default.flowCheckRegistryChange && !isStreaming)
                {
                    gui.writePositionToRegistry();
                }
                grbl.posChanged = false;
            }
            if (grbl.wcoChanged)
            {
                checkMachineLimit();
                grbl.wcoChanged = false;
            }
            if (((isStreaming || isStreamingRequestStop)) && Properties.Settings.Default.guiProgressShow)
            {
                VisuGCode.ProcessedPath.processedPathDraw(grbl.posWork);
            }


            if (_diyControlPad != null)
            {
                if (oldRaw != e.Raw)
                {
                    _diyControlPad.sendFeedback(e.Raw);     //hand over original grbl text
                    oldRaw = e.Raw;
                }
            }
        }