OmagCUT :

- in CSV con linea di produzione aggiunto bottone per pezzi rovinati.
This commit is contained in:
Dario Sassi
2018-07-02 09:12:04 +00:00
parent 70686d122a
commit fe92f33074
9 changed files with 72 additions and 20 deletions
+9
View File
@@ -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
+15 -5
View File
@@ -208,13 +208,23 @@
<Grid Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.5*"/>
<ColumnDefinition Width="1.5*"/>
<ColumnDefinition Width="1.*"/>
<ColumnDefinition Width="1.*"/>
<ColumnDefinition Width="1.*"/>
</Grid.ColumnDefinitions>
<Button Name="NewBtn" Grid.Column="0" Style="{StaticResource OmagCut_YellowTextButton}" />
<Button Name="OpenBtn" Grid.Column="1" Style="{StaticResource OmagCut_YellowTextButton}" />
<Button Name="NewBtn" Grid.Column="0"
Style="{StaticResource OmagCut_YellowIconButton}">
<Image Source="Resources/CsvNew.png" Width="65" Height="65" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Button>
<Button Name="OpenBtn" Grid.Column="1"
Style="{StaticResource OmagCut_YellowIconButton}">
<Image Source="Resources/CsvOpen.png" Width="65" Height="65" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Button>
<Button Name="RuinedPartsBtn" Grid.Column="2"
Style="{StaticResource OmagCut_YellowIconButton}">
<Image Source="Resources/CsvRuinedParts.png" Width="65" Height="65" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Button>
</Grid>
</Grid>
+27 -10
View File
@@ -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()
+3
View File
@@ -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
+9 -5
View File
@@ -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
+9
View File
@@ -692,6 +692,15 @@
<ItemGroup>
<Resource Include="Resources\BottomRight.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\CsvNew.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\CsvOpen.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\CsvRuinedParts.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<PropertyGroup>
<PostBuildEvent>IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\OmagCUT\OmagCUTR32.exe
Binary file not shown.

After

Width:  |  Height:  |  Size: 400 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 976 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB