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 0000000..b5d499a Binary files /dev/null and b/Resources/CsvNew.png differ diff --git a/Resources/CsvOpen.png b/Resources/CsvOpen.png new file mode 100644 index 0000000..4b6f0ef Binary files /dev/null and b/Resources/CsvOpen.png differ diff --git a/Resources/CsvRuinedParts.png b/Resources/CsvRuinedParts.png new file mode 100644 index 0000000..b55a9b8 Binary files /dev/null and b/Resources/CsvRuinedParts.png differ