Exemple #1
0
        public void DrawPaths( Job job, Graphics dc )
        {
            Pos pos = new Pos();

            foreach ( Path path in job.paths )
            {
                if (path.type == Path.Type.Move)
                {
                    DrawPath(job, dc, path);
                }
            }
        }
Exemple #2
0
        public void DrawRaw( Job job, Graphics dc )
        {
            Pos pos = new Pos();

            foreach( Command com in job.commands )
            {
                if( com.type == 'G' )
                {
                    // Move
                    if( com.code == 0 )
                    {
                        Pos posDest = new Pos();
                        posDest.X = com.pos.X;
                        posDest.Y = com.pos.Y;
                        if( K40Controller.Properties.Settings.Default.drawMoves )
                        {
                            DrawLine( dc, penMove, pos, posDest );
                        }
                        pos = posDest;
                    }

                    // Move cut line
                    if( com.code == 1 )
                    {
                        Pos posDest = new Pos();
                        posDest.X = com.pos.X;
                        posDest.Y = com.pos.Y;
                        if( K40Controller.Properties.Settings.Default.drawCuts )
                        {
                            DrawLine( dc, penCut, pos, posDest );
                        }
                        pos = posDest;
                    }

                    // Move cut arc CW
                    if( com.code == 2 )
                    {
                        Pos posDest = new Pos();
                        posDest.X = com.pos.X;
                        posDest.Y = com.pos.Y;
                        if( K40Controller.Properties.Settings.Default.drawCuts )
                        {
                            DrawLine( dc, penCut, pos, posDest );
                        }
                        pos = posDest;
                    }

                    // Move cut arc CCW
                    if( com.code == 3 )
                    {
                        Pos posDest = new Pos();
                        posDest.X = com.pos.X;
                        posDest.Y = com.pos.Y;
                        if( K40Controller.Properties.Settings.Default.drawCuts )
                        {
                            DrawLine( dc, penCut, posDest, pos );
                        }
                        pos = posDest;
                    }
                }
            }
        }
Exemple #3
0
        private void DrawLine( Graphics dc, Pen pen, Pos pos1, Pos pos2 )
        {
            Point pt1 = new Point();
            Point pt2 = new Point();
            pt1.X = (int)( pos1.X * Settings.Scale );
            pt1.Y = (int)( pos1.Y * Settings.Scale );
            pt2.X = (int)( pos2.X * Settings.Scale );
            pt2.Y = (int)( pos2.Y * Settings.Scale );

            dc.DrawLine( pen, pt1, pt2 );
        }
Exemple #4
0
 private void DrawLArc( Graphics dc, Pen pen, Pos pos1, Pos pos2, double I, double J )
 {
     Point pt1 = new Point();
     Point pt2 = new Point();
     pt1.X = (int)( pos1.X * Settings.Scale );
     pt1.Y = (int)( pos1.Y * Settings.Scale );
     pt2.X = (int)( pos2.X * Settings.Scale );
     pt2.Y = (int)( pos2.Y * Settings.Scale );
     Rectangle rect = new Rectangle();
     rect.X = pt1.X;
     rect.Y = pt1.Y;
     rect.Width = pt2.X - pt1.X;
     rect.Height = pt2.Y - pt1.Y;
     dc.DrawArc( pen, rect, (float)I, (float)J );
 }