private void allResultBtn_Click(object sender, EventArgs e) { AllResultsForm dlg = new AllResultsForm(m_nestResult.GetNestResultCount()); if (dlg.ShowDialog() == DialogResult.OK) { int iSelectedResultIndex = dlg.GetSelectedResultIndex(); m_sheetList = m_nestResult.GetNestResultByIndex(iSelectedResultIndex); DisplayNestResult(); } }
public QrCodeForm(ListView shtListView, SheetListEx m_sheetList, NestParamEx nestParam) { this.shtListView = shtListView; m_nestParam = nestParam; this.m_sheetList = m_sheetList; InitializeComponent(); cbShadowBmp.Visible = isDebug; Paneltext.Visible = isDebug; panelQr.Visible = isDebug; panelQrCode.Visible = isDebug; this.Size = new Size(450, 670); }
// calc the utilization of the material. static public double CalcMatUtil(SheetListEx sheetList, NestParamEx nestParam) { double dUtilization = .0; // calculate the utilization of material. double dMatArea = .0, dNestedArea = .0; for (int i = 0; i < sheetList.Size(); i++) { SheetEx sheet = sheetList.GetSheetByIndex(i); int iSheetCount = sheet.GetCount(); dMatArea += sheet.GetMat().GetArea() * iSheetCount; // go through each part placement object in the sheet. PartPmtListEx partPmtList = sheet.GetPartPmtList(); for (int j = 0; j < partPmtList.Size(); j++) { PartPmtEx partPmt = partPmtList.GetPartPmtByIndex(j); PartEx part = partPmt.GetPart(); // the area of the part. double dPartArea = NestFacadeEx.GetPartArea(part, nestParam.GetConTol()); // part count in the part placement object. int iPartCount = 1; if (partPmt.IsGrid()) { iPartCount = partPmt.GetRowCount() * partPmt.GetColCount(); } dNestedArea += iSheetCount * iPartCount * dPartArea; } } // figure out the utilization. if (dMatArea == 0 || dNestedArea == 0) { dUtilization = .0; } else { dUtilization = (dNestedArea / dMatArea) * 100; } return(dUtilization); }
public void Run() { while (true) { Thread.Sleep(500); // get the nesting result. if (m_nestProcessor.BetterResultExist()) { SheetListEx sheetList = m_nestProcessor.GetNestResult(); m_nestResult.AddNestResult(sheetList); // write the log. m_nestProcessor.WriteLog("the watcher thread got a result from the kernel."); } // if the nesting is stopped and no more better result, quit the watcher. if (m_nestProcessor.IsStopped() && !m_nestProcessor.BetterResultExist()) { // write the log. m_nestProcessor.WriteLog("the watcher thread quited."); m_nestResult.TaskFinished(true); break; } // whether the time is out. int iElapsedTime = (System.Environment.TickCount - m_iStartTickCount) / 1000; m_nestResult.SetElapsedTime(iElapsedTime); if (iElapsedTime > m_iNestingTime) { // stop the nesting. m_nestProcessor.StopNest(); // write the log. m_nestProcessor.WriteLog("the watcher thread sent the stop command to the kernel."); } } }
private void checkTimer_Tick(object sender, EventArgs e) { // update the elapsed time. costTimeTextBox.Text = m_nestResult.GetElapsedTime().ToString(); // whether we displayed all results and kill the timer. bool bFinished = false; if (m_nestResult.TaskFinished() && m_iRetRstNum == m_nestResult.GetNestResultCount()) { bFinished = true; } if (bFinished) { statusTextBox.Text = "Stopped"; checkTimer.Enabled = false; // stop the timer. stopBtn.Enabled = false; // disable the "stop" button. allResultBtn.Enabled = true; // disable the "all result" button. // 停止进度条动画。 nestProgressBar.Hide(); } else { if (m_iRetRstNum < m_nestResult.GetNestResultCount()) { // get the next result. m_iRetRstNum++; m_sheetList = m_nestResult.GetNestResultByIndex(m_iRetRstNum - 1); // display the nest result. { countTextBox.Text = m_iRetRstNum.ToString(); DisplayNestResult(); } } } }
public void AddNestResult(SheetListEx nestResult) { m_mutex.WaitOne(); m_nestResults.Add(nestResult); m_mutex.ReleaseMutex(); }