Ejemplo n.º 1
0
 private void deleteToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     if (listView2.SelectedItems.Count > 0)
     {
         var f = listView2.SelectedItems[0].Tag as NFP;
         sheets.Remove(f);
         UpdateList();
         context.ReorderSheets();
     }
 }
        protected override Result RunCommand(RhinoDoc doc, RunMode mode)
        {
            //  var cnt = GetCountFromDialog();
            Random r = new Random();

            for (int i = 0; i < 5; i++)
            {
                var xx  = r.Next(2000) + 100;
                var yy  = r.Next(2000);
                var ww  = r.Next(60) + 10;
                var hh  = r.Next(60) + 5;
                NFP pl  = new NFP();
                int src = 0;
                if (polygons.Any())
                {
                    src = polygons.Max(z => z.source.Value) + 1;
                }
                polygons.Add(pl);
                pl.source = src;
                pl.x      = xx;
                pl.y      = yy;
                pl.Points = new SvgPoint[] { };
                pl.AddPoint(new SvgPoint(0, 0));
                pl.AddPoint(new SvgPoint(ww, 0));
                pl.AddPoint(new SvgPoint(ww, hh));
                pl.AddPoint(new SvgPoint(0, hh));
            }
            // UpdateList();


            List <Sheet> sh    = new List <Sheet>();
            var          srcAA = context.GetNextSheetSource();

            sh.Add(NewSheet(3000, 2000));
            foreach (var item in sh)
            {
                item.source = srcAA;
                context.Sheets.Add(item);
            }


            if (sheets.Count == 0 || polygons.Count == 0)
            {
                MessageBox.Show("There are no sheets or parts", MessageBoxButtons.OK);
                return(Result.Success);;
            }
            stop = false;
            //  progressBar1.Value = 0;
            //  tabControl1.SelectedTab = tabPage4;
            context.ReorderSheets();
            RunDeepnest();

            return(Result.Success);
        }