예제 #1
0
        private void createGridView()
        {
            drawingProperties tmp = new drawingProperties();
            PointF            ul  = getGraphicCoordinateFromPictureBox(new Point(0, 0));
            PointF            lr  = getGraphicCoordinateFromPictureBox(new Point(pictureBox1.Width, pictureBox1.Height));

            tmp.setX((float)Math.Round(ul.X), (float)Math.Round(lr.X));
            tmp.setY((float)Math.Round(ul.Y), (float)Math.Round(lr.Y));
            VisuGCode.createRuler(ruler, tmp);
            createGrid(grid, tmp, (float)nUDRaster.Value);
        }
예제 #2
0
        private void ControlJogPathCreator_Load(object sender, EventArgs e)
        {
            //            Logger.Trace("++++++ ControlJogPathCreator START ++++++");
            this.Icon           = Properties.Resources.Icon;
            penjogPath.StartCap = LineCap.Round;
            penjogPath.EndCap   = LineCap.Triangle;
            drawingSize.setX(-10, 100);
            drawingSize.setY(-10, 100);
            jogPath.StartFigure();
            jogPath.AddLine(10, 10, 10, 30);
            jogPath.AddLine(10, 30, 30, 30);
            jogPath.AddLine(30, 30, 30, 10);
            jogPath.AddLine(30, 10, 10, 10);
            lastSet = new PointF(10, 10);

            VisuGCode.createRuler(ruler, drawingSize);
            createGrid(grid, drawingSize, (float)nUDRaster.Value);
        }
예제 #3
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            OpenFileDialog sfd = new OpenFileDialog();

            sfd.InitialDirectory = Application.StartupPath + datapath.jogpath;
            sfd.Filter           = "Jog paths (*.xml)|*.xml";
            if (sfd.ShowDialog() == DialogResult.OK)
            {
                XmlReader reader = XmlReader.Create(sfd.FileName);
                float     x1 = -1, y1 = -1, x2 = -1, y2 = -1;

                jogPath.Reset();
                rubberBand.Reset();
                actualLine.Reset();
                startIcon.Reset();

                while (reader.Read())
                {
                    if (!reader.IsStartElement())
                    {
                        continue;
                    }

                    switch (reader.Name)
                    {
                    case "view":
                        nUDRaster.Value = decimal.Parse(reader["raster"].Replace(',', '.'), NumberFormatInfo.InvariantInfo);
                        break;

                    case "path":
                        jogPath.StartFigure();
                        break;

                    case "pos":
                        x1 = float.Parse(reader["X"].Replace(',', '.'), NumberFormatInfo.InvariantInfo);
                        y1 = float.Parse(reader["Y"].Replace(',', '.'), NumberFormatInfo.InvariantInfo);
                        if ((x2 >= 0) || (y2 >= 0))
                        {
                            jogPath.AddLine(x2, y2, x1, y1);
                        }
                        else
                        {
                            startIcon.AddEllipse(x1 - 0.5F, y1 - 0.5F, 1, 1);
                        }
                        x2 = x1; y2 = y1;
                        break;
                    }
                }
                reader.Close();
                lastSet = new PointF(x1, y1);

                RectangleF dim  = jogPath.GetBounds();
                float      maxX = dim.Left + dim.Width + 10;
                float      maxY = dim.Top + dim.Height + 10;
                float      a    = Math.Max(maxX, maxY);
                drawingSize.setX(-10, a);
                drawingSize.setY(-10, a);
                VisuGCode.createRuler(ruler, drawingSize);
                createGrid(grid, drawingSize, (float)nUDRaster.Value);

                pBoxTransform.Reset();
                zoomFactor = 1;

                pictureBox1.Invalidate();
            }
        }