Ejemplo n.º 1
0
        private void RenderParts(PnPProcDoc D, bool after, Graphics G, BoardSide side, float S)
        {
            var B = D.B;

            if (after)
            {
                B = D.BPost;
            }
            int curpart = 0;

            foreach (var p in B.DeviceTree)
            {
                foreach (var pp in p.Value.Values)
                {
                    var curcol = Helpers.RefractionNormalledMaxBrightnessAndSat(curpart / p.Value.Values.Count());
                    curpart++;
                    foreach (var rf in pp.RefDes)
                    {
                        if (rf.Side == side)
                        {
                            BOM.RenderPackage(G, rf.x, rf.y, rf.angle, pp.PackageName, rf.Side);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
 internal void AddDoc(PnPProcDoc d)
 {
     Docs.Add(d);
     DocLoaded = false;
     d.StartLoad();
     ActiveDoc = d;
     TheBOMList.UpdateList();
 }
Ejemplo n.º 3
0
        private void ProcessButton_Click(object sender, EventArgs e)
        {
            var d = new PnPProcDoc()
            {
                stock     = stockbox.Text,
                pnp       = pnpbox.Text,
                bom       = bombox.Text,
                gerberzip = gerberzipbox.Text,
                loaded    = false
            };

            pnp.AddDoc(d);
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            CultureInfo ci = new CultureInfo("nl-NL");

            Thread.CurrentThread.CurrentCulture   = ci;
            Thread.CurrentThread.CurrentUICulture = ci;

            if (args.Count() > 0)
            {
                AttachConsole(ATTACH_PARENT_PROCESS);
                Argument            NextArgument = Argument.None;
                PnPProcDoc.FlipMode Mode         = PnPProcDoc.FlipMode.NoFlip;
                PnPProcDoc          d            = new PnPProcDoc();
                foreach (var a in args)
                {
                    switch (NextArgument)
                    {
                    case Argument.ZipFile: d.gerberzip = a; NextArgument = Argument.None; break;

                    case Argument.FlipMode: d.FlipBoard = PnPProcDoc.DecodeFlip(a); NextArgument = Argument.None; break;

                    case Argument.PnpFile: d.pnp = a; NextArgument = Argument.None; break;

                    case Argument.BomFile: d.bom = a; NextArgument = Argument.None; break;

                    case Argument.Stock: d.stock = a; NextArgument = Argument.None; break;

                    case Argument.None:
                        switch (a)
                        {
                        case "-zip": NextArgument = Argument.ZipFile; break;

                        case "-bom": NextArgument = Argument.BomFile; break;

                        case "-pnp": NextArgument = Argument.PnpFile; break;

                        case "-mode": NextArgument = Argument.FlipMode; break;

                        case "-stock": NextArgument = Argument.Stock; break;

                        case "-help":
                        case "/?":
                        case "-?":
                        case "--help":
                        case "--?":
                            Console.WriteLine("PnP_Processor <-stock stockfile> <-zip zipfile> <-pnp pnpfile> <-bom bomfile> <-mode none|diagonal|horizontal>");
                            break;
                        }
                        break;
                    }
                }
                int LastIDX = 0;

                d.StartLoad();
                while (d.loaded == false)
                {
                    while (LastIDX < d.Log.Count())
                    {
                        Console.WriteLine(d.Log[LastIDX]);
                        LastIDX++;
                    }

                    System.Threading.Thread.Sleep(4);
                }
                Console.WriteLine("done loading and processing!");
                System.Windows.Forms.SendKeys.SendWait("{ENTER}");
                Application.Exit();
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new PnPMain(args));
        }
Ejemplo n.º 5
0
        private void Render(PnPProcDoc D, Graphics G, bool after)
        {
            G.TranslateTransform(G.ClipBounds.Width / 2, G.ClipBounds.Height / 2);

            TheBox.Reset();
            //   TheBox.FitPoint(0, 0);
            TheBox.AddBox(D.Box);
            if (idx > -1)
            {
                var rd = pnp.selectedrefdes[idx % pnp.selectedrefdes.Count()];
                BOMEntry.RefDesc refd = D.B.GetRefDes(rd);
                if (refd != null)
                {
                    TheBox.Reset();
                    TheBox.FitPoint(refd.x - 10, refd.y - 10);
                    TheBox.FitPoint(refd.x + 10, refd.y + 10);
                }
            }

            float S = (float)Math.Min(pictureBox1.Width / (TheBox.Width()), pictureBox1.Height / (TheBox.Height()));

            bool TopView = false;

            if (PostDisplay)
            {
                TopView = D.FlipBoard ? false : true;
            }

            var C = TheBox.Center();

            G.ScaleTransform(S * 0.8f, -S * 0.8f);
            G.TranslateTransform((float)-C.X, (float)-C.Y);

            RenderLayerSets(G, S, BoardSide.Both, BoardLayer.Outline, Color.Gray, true);

            if (pnp.bottomsilkvisible)
            {
                RenderLayerSets(G, S, BoardSide.Bottom, BoardLayer.Silk, Color.White, true);
            }
            if (pnp.topsilkvisible)
            {
                RenderLayerSets(G, S, BoardSide.Top, BoardLayer.Silk, Color.DarkGray, true);
            }

            var B = D.B;

            if (after)
            {
                B = D.BPost;
            }
            int curpart = 0;

            foreach (var p in B.DeviceTree)
            {
                foreach (var pp in p.Value.Values)
                {
                    var curcol = Helpers.RefractionNormalledMaxBrightnessAndSat(curpart / p.Value.Values.Count());
                    curpart++;
                    foreach (var rf in pp.RefDes)
                    {
                        DrawMarker(curcol, G, rf, true, S, false, pnp.selectedrefdes.Contains(rf.NameOnBoard));
                    }
                }
            }
        }
Ejemplo n.º 6
0
        private void Render(PnPProcDoc D, Graphics G, bool after)
        {
            TheBox.Reset();
            TheBox.FitPoint(0, 0);
            if (after)
            {
                TheBox.AddBox(D.FixSet.BoundingBox);
            }
            else
            {
                TheBox.AddBox(D.Box);
            }

            //TheBox.FitPoint(-250, -250);
            //TheBox.FitPoint(250, 250);
            if (idx > -1)
            {
                var rd = pnp.selectedrefdes[idx % pnp.selectedrefdes.Count()];
                BOMEntry.RefDesc refd = D.B.GetRefDes(rd);
                if (after)
                {
                    refd = D.BPost.GetRefDes(rd);
                }
                if (refd != null)
                {
                    TheBox.Reset();
                    TheBox.FitPoint(refd.x - zoomfac, refd.y - zoomfac);
                    TheBox.FitPoint(refd.x + zoomfac, refd.y + zoomfac);
                }
            }
            var P = pictureBox1;

            var Bb = TheBox;

            float S = Helpers.SetupMatrixForExtends(G, P, Bb, 2);

            MarkPoint(G, Color.Blue, "zero", 0, 0, S);
            MarkPoint(G, Color.Green, "zero", (float)D.FixOffset.X, (float)D.FixOffset.Y, S);


            RenderParts(D, after, G, BoardSide.Bottom, S);
            RenderLayerSets(after, G, S, BoardSide.Both, BoardLayer.Outline, Color.FromArgb(210, 4, 20, 4), false);
            RenderLayerSets(after, G, S, BoardSide.Both, BoardLayer.Outline, Color.Gray, true);

            if (pnp.bottomsilkvisible)
            {
                RenderLayerSets(after, G, S, BoardSide.Bottom, BoardLayer.Silk, Color.FromArgb(160, 160, 160), false);;
                RenderLayerSets(after, G, S, BoardSide.Bottom, BoardLayer.SolderMask, Color.FromArgb(100, 100, 10), false);
            }
            if (pnp.topsilkvisible)
            {
                RenderLayerSets(after, G, S, BoardSide.Top, BoardLayer.Silk, Color.FromArgb(160, 160, 160), false);
                RenderLayerSets(after, G, S, BoardSide.Top, BoardLayer.SolderMask, Color.FromArgb(100, 100, 10), false);
            }



            RenderParts(D, after, G, BoardSide.Top, S);

            var B = D.B;

            if (after)
            {
                B = D.BPost;
            }
            int           curpart  = 0;
            List <string> AllNames = new List <string>();

            foreach (var p in B.DeviceTree)
            {
                foreach (var pp in p.Value.Values)
                {
                    AllNames.Add(pp.Combined());
                }
            }
            AllNames.Sort();
            Font F = new Font("Arial", 3);

            foreach (var p in B.DeviceTree)
            {
                foreach (var pp in p.Value.Values)
                {
                    int idx    = AllNames.IndexOf(pp.Combined());
                    var curcol = Helpers.RefractionNormalledMaxBrightnessAndSat(idx / (float)AllNames.Count());
                    foreach (var rf in pp.RefDes)
                    {
                        bool active = pnp.selectedrefdes.Contains(rf.NameOnBoard);
                        DrawMarker(curcol, G, rf, true, S, false, active);
                        if (active)
                        {
                            DrawText(G, rf.NameOnBoard, new PointF((float)rf.x, (float)rf.y), new RectangleF(0, 0, 50, 20));
                        }
                    }
                }
            }
        }