예제 #1
0
        private void menuCtxDelete_Click(object sender, RoutedEventArgs e)
        {
            object item = listImportedFile.SelectedItem;

            if (item != null)
            {
                string name = string.Empty;
                if (item is CadFile)
                {
                    name = ((CadFile)item).FileName;
                }
                else if (item is GerberFile)
                {
                    name = ((GerberFile)item).FileName;
                }
                var r = MessageBox.Show(string.Format("Are you want to delete {0} file?", name), "Question", MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
                if (r == MessageBoxResult.Yes)
                {
                    if (item is CadFile)
                    {
                        CadFile cad = ((CadFile)item);
                        mModel.Cad.Remove(cad);
                        ShowAllLayerImb(ActionMode.Draw_Cad);
                    }
                    else if (item is GerberFile)
                    {
                        GerberFile gerber = ((GerberFile)item);
                        mModel.Gerber.Dispose();
                        mModel.Gerber = null;
                        ShowAllLayerImb(ActionMode.Render);
                    }
                    UpdateListImportedFile();
                }
            }
        }
예제 #2
0
        public void Convert()
        {
            GerberFile input = new GerberFile(InputPath);

            using (FileStream fs = new FileStream(OutputPath, FileMode.Create, FileAccess.ReadWrite))
                using (StreamWriter sw = new StreamWriter(fs))
                {
                    Cutter cutter = new Cutter(sw);
                    //cutter.PreStartDistance = 0.2;
                    cutter.PostEndDistance = 0.175;
                    cutter.MoveHeight      = 3;
                    cutter.CutterDiameter  = 1;

                    List <ISegment> segments = new List <ISegment>();

                    segments = input.GetSegments();

                    segments = segments.OrderBy(s => s.Heading).ToList();
                    foreach (LineSegment segment in segments)
                    {
                        cutter.Render(segment);
                        Canvas.LineSegment(segment, Scale);
                    }
                }
        }
예제 #3
0
        public void Display()
        {
            if (Canvas != null)
            {
                Canvas.Children.Clear();
                Canvas.CenterCrosshair();

                GerberFile      input    = new GerberFile(InputPath);
                List <ISegment> segments = new List <ISegment>();

                segments = input.GetSegments();

                segments = segments.OrderBy(s => s.Heading).ToList();
                foreach (LineSegment segment in segments)
                {
                    Canvas.LineSegment(segment, Scale);
                }
            }
        }
예제 #4
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            GerberFile gerber = mGerbers[cbGerber.SelectedIndex];
            CadFile    cad    = mCads[cbCad.SelectedIndex];;

            System.Drawing.Point cGerber = gerber.GetCenterPadsSelected();
            System.Drawing.Point cCad    = cad.GetCenterSelected();
            if (cGerber != new System.Drawing.Point() && cCad != new System.Drawing.Point())
            {
                int subx = cGerber.X - cCad.X;
                int suby = cGerber.Y - cCad.Y;
                cad.X += subx;
                cad.Y += suby;
                mGerberToolsWindow.ShowAllLayerImb(ActionMode.Draw_Cad);
            }
            else
            {
                MessageBox.Show(string.Format("Please select item on the layers selected..."), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
예제 #5
0
        static void Main(string[] args)
        {
            string     path  = Path.Combine(Path.GetDirectoryName(new Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).LocalPath), "test.gcode");
            GerberFile input = new GerberFile("C:\\Users\\Master\\Documents\\TestSMT.ger");

            using (FileStream fs = new FileStream(path, FileMode.Create, FileAccess.ReadWrite))
                using (StreamWriter sw = new StreamWriter(fs)){
                    Cutter cutter = new Cutter(sw);
                    //cutter.PreStartDistance = 0.2;
                    cutter.PostEndDistance = 0.175;
                    cutter.MoveHeight      = 3;
                    cutter.CutterDiameter  = 1;

                    List <ISegment> segments = new List <ISegment>();

                    segments = input.GetSegments();

                    segments = segments.OrderBy(s => s.Heading).ToList();
                    foreach (LineSegment segment in segments)
                    {
                        cutter.Render(segment);
                    }
                }
        }