OmagCUT 2.2d5 :

- sistemazioni per Polishing
- dopo la scelta nuova licenza il programma si riavvia automaticamente.
This commit is contained in:
Dario Sassi
2020-05-04 06:10:37 +00:00
parent 758290bd76
commit 174e6fd47c
6 changed files with 161 additions and 94 deletions
+96 -46
View File
@@ -9,9 +9,14 @@ Public Class SetUpPage
' Riferimento alla MainWindow
Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)
' Riferimento alla macchina corrente
Private m_CurrMachine As CurrentMachine = m_MainWindow.m_CurrentMachine
Private m_ToolTreeList As New ObservableCollection(Of CathegoryItem)
Private m_DrillbitsList As CathegoryItem
Private m_MillsList As CathegoryItem
Private m_CupsList As CathegoryItem
Private m_PolishingsList As CathegoryItem
Private m_SetUpToolsList As New CathegoryItem(String.Empty, 0)
Private Sub SetUpPage_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
@@ -21,10 +26,10 @@ Public Class SetUpPage
' Assegno la lista utensili come sorgente dell'albero
ToolTree.ItemsSource = m_ToolTreeList
If m_MainWindow.m_CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.TOOLCHANGER Then
If m_CurrMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.TOOLCHANGER Then
'' Cambio utensile macchina
' Modifico numero colonne della griglia in base al numero di porta utensili disponibili sulla macchina
Dim ColNum As Integer = CInt(Math.Ceiling(m_MainWindow.m_CurrentMachine.ToolChangerNbr / 5.0))
Dim ColNum As Integer = CInt( Math.Ceiling( m_CurrMachine.ToolChangerNbr / 5.0))
If ColNum > 12 Then
EgtOutLog("TC warning : too many tools (max 12 * 5)")
ColNum = 12
@@ -38,15 +43,15 @@ Public Class SetUpPage
TlChGrid.ColumnDefinitions.RemoveAt(Index * 2 - 2)
Next
' Modifico il numero di elementi presenti sull'ultima colonna
For Index = ColNum * 5 To m_MainWindow.m_CurrentMachine.ToolChangerNbr + 1 Step -1
For Index = ColNum * 5 To m_CurrMachine.ToolChangerNbr + 1 Step -1
TlChGrid.Children.Remove(GetTlChPosFromIndex(Index))
TlChGrid.Children.Remove(GetTxBxFromIndex(Index))
Next
' Assegno lunghezza alla scrollviewer
TlChGrid.Width = m_MainWindow.ActualWidth / 15 * 1.6 * ColNum * 2
' Carico i nomi dei portautensili
For Index = 1 To m_MainWindow.m_CurrentMachine.ToolChangerNbr
GetTlChPosFromIndex(Index).PositionNameTxBl.Text = m_MainWindow.m_CurrentMachine.ToolChangerName(Index - 1)
For Index = 1 To m_CurrMachine.ToolChangerNbr
GetTlChPosFromIndex(Index).PositionNameTxBl.Text = m_CurrMachine.ToolChangerName(Index - 1)
Next
Else
SetUpPageGrid.Children.Remove(TlChScVw)
@@ -54,7 +59,7 @@ Public Class SetUpPage
'' Cambio utensile manuale
' Modifico numero colonne della griglia in base al numero di porta utensili disponibili sulla macchina
Dim ManColNum As Integer = CInt(Math.Ceiling(m_MainWindow.m_CurrentMachine.ManualToolChangerNbr / 5.0))
Dim ManColNum As Integer = CInt( Math.Ceiling( m_CurrMachine.ManualToolChangerNbr / 5.0))
If ManColNum > 12 Then
EgtOutLog("ManTC warning : too many tools (max 12 * 5)")
ManColNum = 12
@@ -68,24 +73,24 @@ Public Class SetUpPage
ManTlChGrid.ColumnDefinitions.RemoveAt(Index * 2 - 2)
Next
' Modifico il numero di elementi presenti sull'ultima colonna
For Index = ManColNum * 5 To m_MainWindow.m_CurrentMachine.ManualToolChangerNbr + 1 Step -1
For Index = ManColNum * 5 To m_CurrMachine.ManualToolChangerNbr + 1 Step -1
ManTlChGrid.Children.Remove(GetManTlChPosFromIndex(Index))
ManTlChGrid.Children.Remove(GetManTxBxFromIndex(Index))
Next
' Assegno lunghezza alla scrollviewer
ManTlChGrid.Width = m_MainWindow.ActualWidth / 15 * 1.6 * ManColNum * 2
' Carico i nomi dei portautensili
For Index = 1 To m_MainWindow.m_CurrentMachine.ManualToolChangerNbr
GetManTlChPosFromIndex(Index).PositionNameTxBl.Text = m_MainWindow.m_CurrentMachine.ManualToolChangerName(Index - 1)
For Index = 1 To m_CurrMachine.ManualToolChangerNbr
GetManTlChPosFromIndex(Index).PositionNameTxBl.Text = m_CurrMachine.ManualToolChangerName(Index - 1)
Next
' Se portautensili della macchina presente
If m_MainWindow.m_CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.TOOLCHANGER Then
If m_CurrMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.TOOLCHANGER Then
' Apro quello
TlChScVw.Visibility = Windows.Visibility.Visible
ToolChangerBtn.IsChecked = True
' Lascio bottoni di scelta solo se ci sono anche utensili manuali
If m_MainWindow.m_CurrentMachine.ManualToolChangerNbr = 0 Then
If m_CurrMachine.ManualToolChangerNbr = 0 Then
ToolChangerBtn.Visibility = Windows.Visibility.Hidden
ManualToolChangerBtn.Visibility = Windows.Visibility.Hidden
End If
@@ -101,13 +106,15 @@ Public Class SetUpPage
Private Sub SetUpPage_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
' Inizializzo le famiglie di utensili nell'albero
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
InitializeToolFamily(K_DRILLBIT, MCH_TF.DRILLBIT, EgtMsg(MSG_TOOLSDBPAGEUC + 32), m_DrillbitsList)
InitializeToolFamily(K_MILL, MCH_TF.MILL, EgtMsg(MSG_TOOLSDBPAGEUC + 33), m_MillsList)
InitializeToolGroup( m_CurrMachine.bDrill, MCH_TY.DRILL_STD, EgtMsg( 90752), m_DrillbitsList)
InitializeToolGroup( m_CurrMachine.bMill, MCH_TY.MILL_STD, EgtMsg( 90753), m_MillsList)
InitializeToolGroup( m_CurrMachine.bCupWheel, MCH_TY.MILL_NOTIP, EgtMsg( 90754), m_CupsList)
InitializeToolGroup( m_CurrMachine.bPolishingWheel, MCH_TY.MILL_POLISHING, EgtMsg( 90756), m_PolishingsList)
' Posiziono utensili già posizionati sul portautensili
For Each ToolPosition In m_MainWindow.m_CurrentMachine.ToolChanger
For Each ToolPosition In m_CurrMachine.ToolChanger
If ToolPosition.sTool <> String.Empty Then
If Not IsNothing(m_DrillbitsList) Then
If Not IsNothing( m_DrillbitsList) Then
For Each Item In m_DrillbitsList.Items
If Item.Name = ToolPosition.sTool Then
m_SetUpToolsList.Items.Add(Item)
@@ -116,7 +123,7 @@ Public Class SetUpPage
End If
Next
End If
If Not IsNothing(m_MillsList) Then
If Not IsNothing( m_MillsList) Then
For Each Item In m_MillsList.Items
If Item.Name = ToolPosition.sTool Then
m_SetUpToolsList.Items.Add(Item)
@@ -125,15 +132,33 @@ Public Class SetUpPage
End If
Next
End If
If Not IsNothing( m_CupsList) Then
For Each Item In m_CupsList.Items
If Item.Name = ToolPosition.sTool Then
m_SetUpToolsList.Items.Add(Item)
m_CupsList.Items.Remove(Item)
Exit For
End If
Next
End If
If Not IsNothing( m_PolishingsList) Then
For Each Item In m_PolishingsList.Items
If Item.Name = ToolPosition.sTool Then
m_SetUpToolsList.Items.Add(Item)
m_PolishingsList.Items.Remove(Item)
Exit For
End If
Next
End If
GetTlChPosFromIndex(ToolPosition.nPosition).Tool.IsChecked = True
GetTxBxFromIndex(ToolPosition.nPosition).Text = ToolPosition.sTool
End If
Next
' Posiziono utensili già posizionati sul portautensili manuale
For Each ToolPosition In m_MainWindow.m_CurrentMachine.ManualToolChanger
For Each ToolPosition In m_CurrMachine.ManualToolChanger
If ToolPosition.sTool <> String.Empty Then
If Not IsNothing(m_DrillbitsList) Then
If Not IsNothing( m_DrillbitsList) Then
For Each Item In m_DrillbitsList.Items
If Item.Name = ToolPosition.sTool Then
m_SetUpToolsList.Items.Add(Item)
@@ -142,7 +167,7 @@ Public Class SetUpPage
End If
Next
End If
If Not IsNothing(m_MillsList) Then
If Not IsNothing( m_MillsList) Then
For Each Item In m_MillsList.Items
If Item.Name = ToolPosition.sTool Then
m_SetUpToolsList.Items.Add(Item)
@@ -151,6 +176,24 @@ Public Class SetUpPage
End If
Next
End If
If Not IsNothing( m_CupsList) Then
For Each Item In m_CupsList.Items
If Item.Name = ToolPosition.sTool Then
m_SetUpToolsList.Items.Add(Item)
m_CupsList.Items.Remove(Item)
Exit For
End If
Next
End If
If Not IsNothing( m_PolishingsList) Then
For Each Item In m_PolishingsList.Items
If Item.Name = ToolPosition.sTool Then
m_SetUpToolsList.Items.Add(Item)
m_PolishingsList.Items.Remove(Item)
Exit For
End If
Next
End If
GetManTlChPosFromIndex(ToolPosition.nPosition).Tool.IsChecked = True
GetManTxBxFromIndex(ToolPosition.nPosition).Text = ToolPosition.sTool
End If
@@ -667,19 +710,18 @@ Public Class SetUpPage
End Function
' Funzione che carica gli utensili del Db nell'albero
Friend Sub InitializeToolFamily(sFIniConst As String, nFType As Integer, sFName As String, ByRef ToolCathegory As CathegoryItem)
If GetPrivateProfileInt(S_TOOLS, sFIniConst, 0, m_MainWindow.GetMachIniFile()) = 1 Then
ToolCathegory = New CathegoryItem(sFName, nFType)
Dim nType As Integer = 0
Dim ToolName As String = String.Empty
If EgtTdbGetFirstTool(nFType, ToolName, nType) Then
ToolCathegory.Items.Add(New CustomItem(ToolName, nType))
While EgtTdbGetNextTool(nFType, ToolName, nType)
ToolCathegory.Items.Add(New CustomItem(ToolName, nType))
End While
End If
m_ToolTreeList.Add(ToolCathegory)
End If
Friend Sub InitializeToolGroup( bEnabled As Boolean, nTType As Integer, sFName As String, ByRef ToolCathegory As CathegoryItem)
If Not bEnabled Then Return
' Inserisco categoria ed eventuali elementi
ToolCathegory = New CathegoryItem( sFName, nTType)
Dim nType As Integer = 0
Dim ToolName As String = String.Empty
Dim bFound As Boolean = EgtTdbGetFirstTool( nTType, ToolName, nType)
While bFound
If nType = nTType Then ToolCathegory.Items.Add( New CustomItem( ToolName, nType))
bFound = EgtTdbGetNextTool( nTType, ToolName, nType)
End While
m_ToolTreeList.Add(ToolCathegory)
End Sub
' Funzione che attrezza l'utensile quando viene clickato il portautensile
@@ -729,10 +771,14 @@ Public Class SetUpPage
' Funzione che rimuove l'utensile selezionato dall'albero
Private Sub RemoveToolFromList()
If m_DrillbitsList.Items.Contains(ToolTree.SelectedItem) Then
m_DrillbitsList.Items.Remove(ToolTree.SelectedItem)
ElseIf m_MillsList.Items.Contains(ToolTree.SelectedItem) Then
m_MillsList.Items.Remove(ToolTree.SelectedItem)
If Not IsNothing( m_DrillbitsList) AndAlso m_DrillbitsList.Items.Contains( ToolTree.SelectedItem) Then
m_DrillbitsList.Items.Remove( ToolTree.SelectedItem)
ElseIf Not IsNothing( m_MillsList) AndAlso m_MillsList.Items.Contains( ToolTree.SelectedItem) Then
m_MillsList.Items.Remove( ToolTree.SelectedItem)
ElseIf Not IsNothing( m_CupsList) AndAlso m_CupsList.Items.Contains( ToolTree.SelectedItem) Then
m_CupsList.Items.Remove( ToolTree.SelectedItem)
ElseIf Not IsNothing( m_PolishingsList) AndAlso m_PolishingsList.Items.Contains( ToolTree.SelectedItem) Then
m_PolishingsList.Items.Remove( ToolTree.SelectedItem)
End If
End Sub
@@ -740,10 +786,14 @@ Public Class SetUpPage
Private Sub RestoreToolInList(sToolName As String)
For Each Tool In m_SetUpToolsList.Items
If Tool.Name = sToolName Then
If Tool.nType = 256 Then
If Tool.nType = MCH_TY.DRILL_STD Then
m_DrillbitsList.Items.Add(Tool)
ElseIf Tool.nType = 1024 Then
ElseIf Tool.nType = MCH_TY.MILL_STD Then
m_MillsList.Items.Add(Tool)
ElseIf Tool.nType = MCH_TY.MILL_NOTIP Then
m_CupsList.Items.Add(Tool)
ElseIf Tool.nType = MCH_TY.MILL_POLISHING Then
m_PolishingsList.Items.Add(Tool)
End If
m_SetUpToolsList.Items.Remove(Tool)
Return
@@ -1023,12 +1073,12 @@ Public Class SetUpPage
' Funzione che salva lo stato dei portautensili
Private Sub SaveToolChangerStatus()
' Salvo attrezzaggio automatico
For Index As Integer = 1 To m_MainWindow.m_CurrentMachine.ToolChangerNbr
m_MainWindow.m_CurrentMachine.ToolPos(Index - 1) = GetTxBxFromIndex(Index).Text
For Index As Integer = 1 To m_CurrMachine.ToolChangerNbr
m_CurrMachine.ToolPos(Index - 1) = GetTxBxFromIndex(Index).Text
Next
' Salvo attrezzaggio manuale
For Index As Integer = 1 To m_MainWindow.m_CurrentMachine.ManualToolChangerNbr
m_MainWindow.m_CurrentMachine.ManualToolPos(Index - 1) = GetManTxBxFromIndex(Index).Text
For Index As Integer = 1 To m_CurrMachine.ManualToolChangerNbr
m_CurrMachine.ManualToolPos(Index - 1) = GetManTxBxFromIndex(Index).Text
Next
' Salvo DB utensili
EgtTdbSave()
@@ -1069,7 +1119,7 @@ Public Class SetUpPage
EgtTdbGetCurrToolParam(MCH_TP.TCPOS, ToolPositionName)
If String.IsNullOrEmpty(ToolPositionName) Then Return
' Cerco il portautensile nella lista degli automatici per vederne lo stato
For Each TlChPos In m_MainWindow.m_CurrentMachine.ToolChanger
For Each TlChPos In m_CurrMachine.ToolChanger
If TlChPos.sName = ToolPositionName Then
' Se la posizione è libera
If GetTxBxFromIndex(TlChPos.nPosition).Text = String.Empty Then
@@ -1081,13 +1131,13 @@ Public Class SetUpPage
RemoveToolFromList()
Else
' Altrimenti segnalo che la posizione è già occupata
Dim InfoMsgBox As New EgtMsgBox(m_MainWindow, "IMPOSSIBILE ESEGUIRE IL COMANDO", "Portautensile predefinito già occupato", EgtMsgBox.Buttons.OK, EgtMsgBox.Icons.ESCLAMATION)
Dim InfoMsgBox As New EgtMsgBox(m_MainWindow, "", EgtMsg( 90759), EgtMsgBox.Buttons.OK, EgtMsgBox.Icons.ESCLAMATION)
End If
Return
End If
Next
' Cerco il portautensile nella lista dei manuali per vederne lo stato
For Each ManTlChPos In m_MainWindow.m_CurrentMachine.ManualToolChanger
For Each ManTlChPos In m_CurrMachine.ManualToolChanger
If ManTlChPos.sName = ToolPositionName Then
' Se la posizione è libera
If GetManTxBxFromIndex(ManTlChPos.nPosition).Text = String.Empty Then
@@ -1099,7 +1149,7 @@ Public Class SetUpPage
RemoveToolFromList()
Else
' Altrimenti segnalo che la posizione è già occupata
Dim InfoMsgBox As New EgtMsgBox(m_MainWindow, "IMPOSSIBILE ESEGUIRE IL COMANDO", "Portautensile predefinito già occupato", EgtMsgBox.Buttons.OK, EgtMsgBox.Icons.ESCLAMATION)
Dim InfoMsgBox As New EgtMsgBox(m_MainWindow, "", EgtMsg( 90759), EgtMsgBox.Buttons.OK, EgtMsgBox.Icons.ESCLAMATION)
End If
Return
End If