From fe92f330745cfad86a76fcdf8bc6aa7641f10fb6 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 2 Jul 2018 09:12:04 +0000 Subject: [PATCH] OmagCUT : - in CSV con linea di produzione aggiunto bottone per pezzi rovinati. --- CSVFile.vb | 9 +++++++++ CSVPage.xaml | 20 ++++++++++++++----- CSVPage.xaml.vb | 37 +++++++++++++++++++++++++---------- ConstGen.vb | 3 +++ MainWindow.xaml.vb | 14 ++++++++----- OmagCUT.vbproj | 9 +++++++++ Resources/CsvNew.png | Bin 0 -> 400 bytes Resources/CsvOpen.png | Bin 0 -> 976 bytes Resources/CsvRuinedParts.png | Bin 0 -> 1766 bytes 9 files changed, 72 insertions(+), 20 deletions(-) create mode 100644 Resources/CsvNew.png create mode 100644 Resources/CsvOpen.png create mode 100644 Resources/CsvRuinedParts.png diff --git a/CSVFile.vb b/CSVFile.vb index 3cbff71..225e6a4 100644 --- a/CSVFile.vb +++ b/CSVFile.vb @@ -201,4 +201,13 @@ Friend Module CSVFile Return True End Function + Friend Function RemoveWrongParts(ByRef CsvPartList As List(Of CsvPart)) As Boolean + For i As Integer = CsvPartList.Count() - 1 To 0 Step -1 + If Not CsvPartList(i).m_bIsRect Or CsvPartList(i).m_dDimX < EPS_SMALL Or CsvPartList(i).m_dDimY < EPS_SMALL Then + CsvPartList.RemoveAt(i) + End If + Next + Return True + End Function + End Module diff --git a/CSVPage.xaml b/CSVPage.xaml index 67d5b9b..8d76cb2 100644 --- a/CSVPage.xaml +++ b/CSVPage.xaml @@ -208,13 +208,23 @@ - - + + + - + + diff --git a/CSVPage.xaml.vb b/CSVPage.xaml.vb index 8155156..4110a4d 100644 --- a/CSVPage.xaml.vb +++ b/CSVPage.xaml.vb @@ -29,17 +29,16 @@ Public Class CSVPage ' Assegno la lista dei pezzi Csv come sorgente del treeview PartsTreeView.ItemsSource = m_ItemsList ' Messaggi - NewBtn.Content = EgtMsg(MSG_CSVPAGEUC + 3) ' Nuovo - OpenBtn.Content = EgtMsg(MSG_CSVPAGEUC + 1) ' Apri InsertBtn.Content = EgtMsg(MSG_CSVPAGEUC + 2) ' Inserisci RemoveBtn.Content = EgtMsg(MSG_CSVPAGEUC + 4) ' Rimuovi - ' Se versione semplificata - If m_MainWindow.GetKeyOption(MainWindow.KEY_OPT.AUTO_NESTING) Then - m_bFull = (GetPrivateProfileInt(S_CSV, K_FULL, 1, m_MainWindow.GetIniFile()) <> 0) - Else - m_bFull = False - End If + ' Determino se versione semplificata + m_bFull = m_MainWindow.GetKeyOption(MainWindow.KEY_OPT.AUTO_NESTING) And + (GetPrivateProfileInt(S_CSV, K_FULL, 1, m_MainWindow.GetIniFile()) <> 0) RemoveBtn.Visibility = If(m_bFull, Windows.Visibility.Visible, Windows.Visibility.Hidden) + ' Determino se gestione pezzi rovinati attiva + If Not m_MainWindow.m_CurrentMachine.bProdLine Or Not m_MainWindow.m_CurrentMachine.nSaveProduced = 0 Then + RuinedPartsBtn.IsEnabled = False + End If ' Leggo lista pezzi corrente Dim sCsvFile As String = String.Empty GetPrivateProfileString(S_CSV, K_CSVLASTFILE, "", sCsvFile, m_MainWindow.GetIniFile()) @@ -148,6 +147,18 @@ Public Class CSVPage ShowTreeView() End Sub + Private Sub RuinedPartsBtn_Click(sender As Object, e As RoutedEventArgs) Handles RuinedPartsBtn.Click + ' Salvo lista dei pezzi attuale + SaveCsvPartList() + ' Apertura file + Dim sPath = m_MainWindow.GetRuinedPartsDir() & "\" & CURR_RUINED_EPL + LoadCsvPartList(sPath) + ' Salvo path di carico del file CSV + m_CurrProjPage.SetLoadPath(sPath) + ' Visualizzazione lista + ShowTreeView() + End Sub + Private Function LoadCsvFile(sCsvPath As String) As Boolean ' Pulisco path e lista dei pezzi Csv m_sCsvPath = String.Empty @@ -157,6 +168,8 @@ Public Class CSVPage m_CurrProjPage.SetErrorMessage(EgtMsg(91206)) 'Errore nella lettura del file CSV Return False End If + ' Elimino pezzi nulli + RemoveWrongParts(m_CsvPartList) ' Aggiorno If m_bFull Then ' Salvo come epl @@ -351,6 +364,8 @@ Public Class CSVPage ' Inserisco nel gruppo un nuovo componente per ogni pezzo da inserire For i As Integer = 1 To InsPartList.Count() Dim CurrPart As CsvPart = InsPartList(i - 1) + ' Se non รจ un rettangolo, vado oltre + If Not CurrPart.m_bIsRect Then Continue For ' Definizione variabili Dim dDimX = CurrPart.m_dDimX Dim dDimY = CurrPart.m_dDimY @@ -363,10 +378,10 @@ Public Class CSVPage EgtLuaSetGlobNumVar("CMP.V2", dDimY) EgtLuaSetGlobStringVar("CMP.INFO", CurrPart.m_sName) ' Esecuzione componente - If Not EgtLuaExecLine("CMP_Draw(false)") Then Return False + If Not EgtLuaExecLine("CMP_Draw(false)") Then Continue For ' Recupero Id del nuovo componente Dim nId As Integer = EgtGetLastPart() - If nId = GDB_ID.NULL Then Return False + If nId = GDB_ID.NULL Then Continue For CurrPart.m_nId = nId ' Muovo la regione in Z per evitare problemi in visualizzazione Dim nRegId = EgtGetFirstNameInGroup(nId, NAME_REGION) @@ -526,6 +541,8 @@ Public Class CSVPage m_CsvPartList.Clear() ' Lettura del file ReadCsvPartList(sFile, m_sCsvPath, m_CsvPartList) + ' Elimino pezzi nulli + RemoveWrongParts(m_CsvPartList) End Sub Friend Sub UpdateCsvPartList() diff --git a/ConstGen.vb b/ConstGen.vb index 6b050fd..659dd9c 100644 --- a/ConstGen.vb +++ b/ConstGen.vb @@ -58,6 +58,9 @@ Module ConstGen ' Sottodirettorio di default per pezzi prodotti da CSV Public Const PRODUCEDPARTS_DFL_DIR As String = "ProducedParts" + ' File dei pezzi rovinati + Public Const CURR_RUINED_EPL As String = "RuinedParts.epl" + ' Delta Z sovratavola per evitare problemi di visualizzazione texture Public Const DELTAZ_ADDTAB As Double = 0.1 ' Nome gruppo dei sottopezzi diff --git a/MainWindow.xaml.vb b/MainWindow.xaml.vb index 88767a1..51fa0ce 100644 --- a/MainWindow.xaml.vb +++ b/MainWindow.xaml.vb @@ -161,6 +161,14 @@ Class MainWindow Return m_sDataRoot & "\" & TRFAUTO_DIR End Function + Public Function GetRuinedPartsDir() As String + Dim sRuPartsDir As String = String.Empty + If GetPrivateProfileString(S_CSV, K_RUINEDPARTSDIR, "", sRuPartsDir, m_sIniFile) = 0 Then + sRuPartsDir = m_sDataRoot & "\" & RUINEDPARTS_DFL_DIR + End If + Return sRuPartsDir + End Function + Public Function GetCopyTemplateDir() As String Return m_sCopyTemplateDir End Function @@ -1093,10 +1101,7 @@ Class MainWindow End If ' Se gestione pezzi rovinati con un unico file If bSingleFile Then - Dim sRuPartsDir As String = String.Empty - If GetPrivateProfileString(S_CSV, K_RUINEDPARTSDIR, "", sRuPartsDir, m_sIniFile) = 0 Then - sRuPartsDir = m_sDataRoot & "\" & RUINEDPARTS_DFL_DIR - End If + Dim sRuPartsDir As String = GetRuinedPartsDir() Dim sDestEplFile = sRuPartsDir & "\" & CURR_PROJ_EPL ' Eseguo spostamento file Try @@ -1105,7 +1110,6 @@ Class MainWindow EgtOutLog("Error moving or erasing " & sSouEplFile) End Try ' Path del file generale dei rovinati - Const CURR_RUINED_EPL As String = "RuinedParts.epl" Dim sRuinedFile As String = sRuPartsDir & "\" & CURR_RUINED_EPL ' Path della lista caricata per edit Dim sCurrCsvFile As String = String.Empty diff --git a/OmagCUT.vbproj b/OmagCUT.vbproj index fb0cbcb..fd5628f 100644 --- a/OmagCUT.vbproj +++ b/OmagCUT.vbproj @@ -692,6 +692,15 @@ + + + + + + + + + IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\OmagCUT\OmagCUTR32.exe diff --git a/Resources/CsvNew.png b/Resources/CsvNew.png new file mode 100644 index 0000000000000000000000000000000000000000..b5d499acd8e83cf480cda973281a75bde8b03c35 GIT binary patch literal 400 zcmeAS@N?(olHy`uVBq!ia0vp^jv&mz1|<8wpL7LMjKx9jP7LeL$-D$|SkfJRfhsok zbN@+X1@buyJR*x382Ao@Fyrz36)8YL$r9IylHmNblJdl&REC1Y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