Correzione Import/Export per utensili e lavorazioni
This commit is contained in:
@@ -671,8 +671,6 @@ Public Class FlatteningCut
|
||||
End If
|
||||
UpdateSimulOkBtn()
|
||||
|
||||
|
||||
|
||||
Return m_bCutOk
|
||||
End Function
|
||||
|
||||
|
||||
@@ -5,6 +5,13 @@ Public Class ImportExportMachiningWindowWD
|
||||
|
||||
Private WithEvents m_ImportExportMachiningWindowVM As ImportExportMachiningWindowVM
|
||||
|
||||
Private m_OkResult As Boolean = False
|
||||
Public ReadOnly Property OkResult As Boolean
|
||||
Get
|
||||
Return m_OkResult
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Sub New(Owner As Window, ImportExportToolWindowVM As ImportExportMachiningWindowVM)
|
||||
Me.Owner = Owner
|
||||
' This call is required by the designer.
|
||||
@@ -13,4 +20,14 @@ Public Class ImportExportMachiningWindowWD
|
||||
' Assegno al riferimento locale al VM il VM preso dal DataContext
|
||||
m_ImportExportMachiningWindowVM = ImportExportToolWindowVM
|
||||
End Sub
|
||||
Private Sub OkCloseDialogWD() Handles OkBtn.Click
|
||||
m_OkResult = True
|
||||
Me.Close()
|
||||
End Sub
|
||||
|
||||
Private Sub CancelCloseDialogWD() Handles ExitBtn.Click
|
||||
m_OkResult = False
|
||||
Me.Close()
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
@@ -5,6 +5,13 @@ Public Class ImportExportToolWD
|
||||
|
||||
Private WithEvents m_ImportExportToolWindowVM As ImportExportToolWindowVM
|
||||
|
||||
Private m_OkResult As Boolean = False
|
||||
Public ReadOnly Property OkResult As Boolean
|
||||
Get
|
||||
Return m_OkResult
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Sub New(Owner As Window, ImportExportToolWindowVM As ImportExportToolWindowVM)
|
||||
Me.Owner = Owner
|
||||
' This call is required by the designer.
|
||||
@@ -17,4 +24,15 @@ Public Class ImportExportToolWD
|
||||
'Private Sub CloseWindow(bDialogResult As Boolean) Handles m_ImportExportToolWindowVM.m_CloseWindow
|
||||
' Me.DialogResult = bDialogResult
|
||||
'End Sub
|
||||
|
||||
Private Sub OkCloseDialogWD() Handles OkBtn.Click
|
||||
m_OkResult = True
|
||||
Me.Close()
|
||||
End Sub
|
||||
|
||||
Private Sub CancelCloseDialogWD() Handles ExitBtn.Click
|
||||
m_OkResult = False
|
||||
Me.Close()
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -939,8 +939,8 @@
|
||||
<Button Name="NewBtn" Grid.Column="0" Style="{DynamicResource OmagCut_YellowGradientYellowTextButton}"/>
|
||||
<Button Name="SaveBtn" Grid.Column="1" Style="{DynamicResource OmagCut_YellowGradientYellowTextButton}"/>
|
||||
<Button Name="RemoveBtn" Grid.Column="2" Style="{DynamicResource OmagCut_YellowGradientYellowTextButton}" Padding="0"/>
|
||||
<Button Name="ExportBtn" Grid.Column="1" Style="{DynamicResource OmagCut_YellowGradientYellowTextButton}"/>
|
||||
<Button Name="ImportBtn" Grid.Column="2" Style="{DynamicResource OmagCut_YellowGradientYellowTextButton}" Padding="0"/>
|
||||
<Button Name="ExportBtn" Grid.Column="4" Style="{DynamicResource OmagCut_YellowGradientYellowTextButton}"/>
|
||||
<Button Name="ImportBtn" Grid.Column="5" Style="{DynamicResource OmagCut_YellowGradientYellowTextButton}" Padding="0"/>
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
|
||||
@@ -3,6 +3,7 @@ Imports System.ComponentModel
|
||||
Imports OmagCUT.TreeViewItem
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class MachiningDbPageUC
|
||||
|
||||
@@ -78,6 +79,8 @@ Public Class MachiningDbPageUC
|
||||
NewBtn.Content = EgtMsg(MSG_MACHINEPAGEUC + 16)
|
||||
SaveBtn.Content = EgtMsg(MSG_MACHINEPAGEUC + 17)
|
||||
RemoveBtn.Content = EgtMsg(MSG_MACHINEPAGEUC + 18)
|
||||
ExportBtn.Content = "Export"
|
||||
ImportBtn.Content = "Import"
|
||||
|
||||
NameTxBl.Text = EgtMsg(MSG_MACHININGSDBPAGEUC + 1)
|
||||
DepthTxBl.Text = EgtMsg(MSG_MACHININGSDBPAGEUC + 2)
|
||||
@@ -321,6 +324,193 @@ Public Class MachiningDbPageUC
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub ExportBtn_Click(Sender As Object, e As RoutedEventArgs) Handles ExportBtn.Click
|
||||
' contesto corrente
|
||||
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
|
||||
|
||||
' creo lista lavorazioni per esportazione
|
||||
Dim MachiningToExportList As New ObservableCollection(Of ImpExpMachiningFamily)
|
||||
Dim Family As CathegoryItem
|
||||
Dim Machining As CustomItem
|
||||
For Each Family In MachiningsList
|
||||
Dim ImpExpMachiningFamily As New ImpExpMachiningFamily(Family.Name, Family.nTType)
|
||||
For Each Machining In Family.Items
|
||||
ImpExpMachiningFamily.MachiningList.Add(New ImpExpMachiningItem(Machining.Name, False))
|
||||
Next
|
||||
MachiningToExportList.Add(ImpExpMachiningFamily)
|
||||
Next
|
||||
Dim ExportWndVM As New ImportExportMachiningWindowVM(MachiningToExportList)
|
||||
Dim ExportWnd As New ImportExportMachiningWindowWD(Application.Current.MainWindow, ExportWndVM)
|
||||
|
||||
ExportWnd.ShowDialog()
|
||||
End Sub
|
||||
|
||||
Private Sub ImoportBtn_Click() Handles ImportBtn.Click
|
||||
' contesto corrente
|
||||
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
|
||||
' apro dialogo di scelta file
|
||||
Dim ImportFileDlg As New Microsoft.Win32.OpenFileDialog() With {
|
||||
.Title = EgtMsg(31161) & " " & EgtMsg(31163),
|
||||
.DefaultExt = ".data",
|
||||
.Filter = "Machinings (.data)|*.data",
|
||||
.CheckFileExists = True,
|
||||
.ValidateNames = True
|
||||
}
|
||||
If ImportFileDlg.ShowDialog() <> True Then Return
|
||||
Dim ImportFilePath As String = ImportFileDlg.FileName
|
||||
' recupero liste utensili da importare
|
||||
Dim ImportFileMachiningNameList As String() = Nothing
|
||||
Dim ImportFileMachiningFamilyList As Integer() = Nothing
|
||||
If Not EgtMdbToBeImported(ImportFilePath, ImportFileMachiningNameList, ImportFileMachiningFamilyList) Then Return
|
||||
' li inserisco in lista per finestra di scelta
|
||||
Dim MachinigToImportList As New ObservableCollection(Of ImpExpMachiningFamily)
|
||||
' creo famiglie di utensili in base a quelle trovate in lista importata
|
||||
For MachiningIndex As Integer = 0 To ImportFileMachiningNameList.Count - 1
|
||||
Dim MachiningName As String = ImportFileMachiningNameList(MachiningIndex)
|
||||
Dim MachiningFamily As Integer = ImportFileMachiningFamilyList(MachiningIndex)
|
||||
MachiningFamily = MachiningFamily And
|
||||
(MCH_MY.DRILLING Or
|
||||
MCH_MY.SAWING Or
|
||||
MCH_MY.MILLING Or
|
||||
MCH_MY.POCKETING Or
|
||||
MCH_MY.MORTISING Or
|
||||
MCH_MY.SAWROUGHING Or
|
||||
MCH_MY.SAWFINISHING Or
|
||||
MCH_MY.GENMACHINING Or
|
||||
MCH_MY.CHISELING Or
|
||||
MCH_MY.SURFROUGHING Or
|
||||
MCH_MY.SURFFINISHING Or
|
||||
MCH_MY.WATERJETTING)
|
||||
Dim bFounded As Boolean = False
|
||||
Dim MachinigToImportFamily As ImpExpMachiningFamily
|
||||
For Each MachinigToImportFamily In MachinigToImportList
|
||||
If (MachiningFamily = MachinigToImportFamily.FamilyType) Then
|
||||
MachinigToImportFamily.MachiningList.Add(New ImpExpMachiningItem(MachiningName, AlreadyExist(MachiningName)))
|
||||
bFounded = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
If Not bFounded Then
|
||||
Dim NewFamily As New ImpExpMachiningFamily(GetMachiningFamilyName(MachiningFamily), MachiningFamily)
|
||||
NewFamily.MachiningList.Add(New ImpExpMachiningItem(MachiningName, AlreadyExist(MachiningName)))
|
||||
MachinigToImportList.Add(NewFamily)
|
||||
End If
|
||||
Next
|
||||
Dim ImportWndVM As New ImportExportMachiningWindowVM(MachinigToImportList, ImportFilePath, ImportFileMachiningNameList)
|
||||
Dim ImportWnd As New ImportExportMachiningWindowWD(Application.Current.MainWindow, ImportWndVM)
|
||||
|
||||
ImportWnd.ShowDialog()
|
||||
' Aggiungo all'albero visualizzato gli utensili appena importati
|
||||
If ImportWnd.OkResult Then
|
||||
LoadImportedMachineMachinings(ImportWndVM.vsImported)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Function AlreadyExist(MachiningName As String) As Boolean
|
||||
Dim MachiningFamily As CathegoryItem
|
||||
For Each MachiningFamily In MachiningsList
|
||||
Dim MachiningItem As CustomItem
|
||||
For Each MachiningItem In MachiningFamily.Items
|
||||
If MachiningName = MachiningItem.Name Then
|
||||
Return True
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Private Function GetMachiningFamilyName(NewMachinigFamily As Integer) As String
|
||||
Dim MachiningFamily As CathegoryItem
|
||||
For Each MachiningFamily In MachiningsList
|
||||
If NewMachinigFamily = MachiningFamily.nTType Then
|
||||
Return MachiningFamily.Name
|
||||
End If
|
||||
Next
|
||||
Return ""
|
||||
End Function
|
||||
|
||||
Private Sub LoadImportedMachineMachinings(vsImportedMachinings As String())
|
||||
' Leggo tutte le lavorazioni presenti nella Macchina (quindi anche quelli appena importati).
|
||||
Dim ActiveMachiningsFamilies() As MachiningsType = MyReadMachiningFamilies(m_MainWindow.m_CurrentMachine.sMachIniFile)
|
||||
Dim MachiningsFamilyIndex As Integer = 0
|
||||
Dim MachiningsFamilyItem As MachiningsType
|
||||
For Each MachiningsFamilyItem In ActiveMachiningsFamilies
|
||||
Dim FamilyTreeView As New CathegoryItem(MachiningsFamilyItem.Name, MachiningsFamilyItem.Id)
|
||||
Dim MachiningFamilyItem = MachiningsList.FirstOrDefault(Function(MachiningFamily) MachiningsFamilyItem.Id = MachiningFamily.nTType)
|
||||
If IsNothing(MachiningFamilyItem) Then
|
||||
MachiningsList.Insert(MachiningsFamilyIndex, FamilyTreeView)
|
||||
End If
|
||||
Dim nType As Integer = 0
|
||||
Dim MachiningName As String = String.Empty
|
||||
Dim MachiningIndex As Integer = 0
|
||||
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
|
||||
Dim bFound As Boolean = EgtMdbGetFirstMachining(MachiningsFamilyItem.Id, MachiningName)
|
||||
While bFound
|
||||
Dim MachiningItem = MachiningsList(MachiningsFamilyIndex).Items.FirstOrDefault(Function(Machining) Machining.Name = MachiningName)
|
||||
Dim bInList As Boolean = vsImportedMachinings.Contains(MachiningName)
|
||||
If bInList Then
|
||||
' Se una lavorazione è presente nella MachiningsList visualizzata ma nel contempo è nell'array vsImported
|
||||
' vuol dire che è stata sovrascritta perciò la rimuovo
|
||||
MachiningsList(MachiningsFamilyIndex).Items.Remove(MachiningsList(MachiningsFamilyIndex).Items.FirstOrDefault(Function(Machining) Machining.Name = MachiningName))
|
||||
End If
|
||||
If bInList OrElse IsNothing(MachiningItem) Then
|
||||
' recupero tuuid
|
||||
EgtMdbSetCurrMachining(MachiningName)
|
||||
Dim sCurrMachTUUID As String = String.Empty
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sCurrMachTUUID)
|
||||
' aggiungo la lavorazione importata
|
||||
MachiningsList(MachiningsFamilyIndex).Items.Insert(MachiningIndex, New CustomItem(MachiningName, MachiningsFamilyItem.Id, ToolDbUtility.IsToolInDb(sCurrMachTUUID)))
|
||||
' eventualmente evidezio l'ultimo elemento inserito (ERRORE: non espando l'albero)
|
||||
'MachiningsList(MachiningsFamilyIndex).Items(MachiningIndex).IsSelected = True
|
||||
End If
|
||||
MachiningIndex += 1
|
||||
bFound = EgtMdbGetNextMachining(MachiningsFamilyItem.Id, MachiningName)
|
||||
End While
|
||||
MachiningsFamilyIndex += 1
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Public Function MyReadMachiningFamilies(sMachineIniPath As String) As MachiningsType()
|
||||
Dim ActiveMachiningsFamiliesList As New List(Of MachiningsType)
|
||||
' Se il materiale lavorato è Marmo l'ordine di lettura e inserimento di Foratura e Taglio di lama nelle famiglie di lavorazioni attive è invertito
|
||||
|
||||
If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_SAWING, 0, sMachineIniPath) <> 0 Then
|
||||
ActiveMachiningsFamiliesList.Add(New MachiningsType With {.Id = MCH_MY.SAWING, .Name = EgtMsg(31200 + 2)})
|
||||
End If
|
||||
If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_DRILLING, 0, sMachineIniPath) <> 0 Then
|
||||
ActiveMachiningsFamiliesList.Add(New MachiningsType With {.Id = MCH_MY.DRILLING, .Name = EgtMsg(31200 + 1)})
|
||||
End If
|
||||
|
||||
If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_MILLING, 0, sMachineIniPath) <> 0 Then
|
||||
ActiveMachiningsFamiliesList.Add(New MachiningsType With {.Id = MCH_MY.MILLING, .Name = EgtMsg(31200 + 3)})
|
||||
End If
|
||||
If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_POCKETING, 0, sMachineIniPath) <> 0 Then
|
||||
ActiveMachiningsFamiliesList.Add(New MachiningsType With {.Id = MCH_MY.POCKETING, .Name = EgtMsg(31200 + 4)})
|
||||
End If
|
||||
If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_MORTISING, 0, sMachineIniPath) <> 0 Then
|
||||
ActiveMachiningsFamiliesList.Add(New MachiningsType With {.Id = MCH_MY.MORTISING, .Name = EgtMsg(31200 + 5)})
|
||||
End If
|
||||
If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_SAWROUGHING, 0, sMachineIniPath) <> 0 Then
|
||||
ActiveMachiningsFamiliesList.Add(New MachiningsType With {.Id = MCH_MY.SAWROUGHING, .Name = EgtMsg(31200 + 6)})
|
||||
End If
|
||||
If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_SAWFINISHING, 0, sMachineIniPath) <> 0 Then
|
||||
ActiveMachiningsFamiliesList.Add(New MachiningsType With {.Id = MCH_MY.SAWFINISHING, .Name = EgtMsg(31200 + 7)})
|
||||
End If
|
||||
If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_GENMACHINING, 0, sMachineIniPath) <> 0 Then
|
||||
ActiveMachiningsFamiliesList.Add(New MachiningsType With {.Id = MCH_MY.GENMACHINING, .Name = EgtMsg(31200 + 8)})
|
||||
End If
|
||||
If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_CHISELING, 0, sMachineIniPath) <> 0 Then
|
||||
ActiveMachiningsFamiliesList.Add(New MachiningsType With {.Id = MCH_MY.CHISELING, .Name = EgtMsg(31200 + 9)})
|
||||
End If
|
||||
If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_SURFFINISHING, 0, sMachineIniPath) <> 0 Then
|
||||
ActiveMachiningsFamiliesList.Add(New MachiningsType With {.Id = MCH_MY.SURFFINISHING, .Name = EgtMsg(31211)})
|
||||
End If
|
||||
If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_WATERJETTING, 0, sMachineIniPath) <> 0 Then
|
||||
ActiveMachiningsFamiliesList.Add(New MachiningsType With {.Id = MCH_MY.WATERJETTING, .Name = EgtMsg(31210)})
|
||||
End If
|
||||
Return ActiveMachiningsFamiliesList.ToArray
|
||||
End Function
|
||||
|
||||
Private Sub InitializeMachiningFamily(bEnabled As Boolean, nFType As Integer, sFName As String)
|
||||
If Not bEnabled Then Return
|
||||
' Inserisco categoria ed eventuali elementi
|
||||
|
||||
@@ -434,17 +434,16 @@
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="10*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="9*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Button Name="NewBtn" Grid.Column="0" Style="{DynamicResource OmagCut_YellowGradientYellowTextButton}"/>
|
||||
<Button Name="SaveBtn" Grid.Column="1" Style="{DynamicResource OmagCut_YellowGradientYellowTextButton}"/>
|
||||
<Button Name="RemoveBtn" Grid.Column="2" Style="{DynamicResource OmagCut_YellowGradientYellowTextButton}" Padding="0"/>
|
||||
<Button Name="ExportBtn" Grid.Column="3" Style="{DynamicResource OmagCut_YellowGradientYellowTextButton}" Padding="0"/>
|
||||
<Button Name="ImportBtn" Grid.Column="4" Style="{DynamicResource OmagCut_YellowGradientYellowTextButton}" Padding="0"/>
|
||||
<Button Name="ExportBtn" Grid.Column="4" Style="{DynamicResource OmagCut_YellowGradientYellowTextButton}" Padding="0"/>
|
||||
<Button Name="ImportBtn" Grid.Column="5" Style="{DynamicResource OmagCut_YellowGradientYellowTextButton}" Padding="0"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
@@ -177,8 +177,8 @@ Public Class ToolsDbPageUC
|
||||
End If
|
||||
' Verifico se macchina con nuovo SawbladeMaker
|
||||
Dim sSawBladeMaker As String = ""
|
||||
GetPrivateProfileString( S_TOOLS, K_SAWBLADEMAKER, "", sSawBladeMaker, m_MainWindow.GetIniFile())
|
||||
m_bNewSawbladeMaker = String.Compare( sSawBladeMaker, "MakeStoneSawBlade.lua", True)
|
||||
GetPrivateProfileString(S_TOOLS, K_SAWBLADEMAKER, "", sSawBladeMaker, m_MainWindow.GetIniFile())
|
||||
m_bNewSawbladeMaker = String.Compare(sSawBladeMaker, "MakeStoneSawBlade.lua", True)
|
||||
m_bFirst = False
|
||||
Else
|
||||
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
|
||||
@@ -528,7 +528,7 @@ Public Class ToolsDbPageUC
|
||||
' recupero liste utensili da importare
|
||||
Dim ImportFileToolNameList As String() = Nothing
|
||||
Dim ImportFileToolFamilyList As Integer() = Nothing
|
||||
EgtTdbToBeImported(ImportFilePath, ImportFileToolNameList, ImportFileToolFamilyList)
|
||||
If Not EgtTdbToBeImported(ImportFilePath, ImportFileToolNameList, ImportFileToolFamilyList) Then Return
|
||||
' li inserisco in lista per finestra di scelta
|
||||
Dim ToolToImportList As New ObservableCollection(Of ImpExpToolFamily)
|
||||
' creo famiglie di utensili in base a quelle trovate in lista importata
|
||||
@@ -561,8 +561,9 @@ Public Class ToolsDbPageUC
|
||||
Dim ImportWndVM As New ImportExportToolWindowVM(ToolToImportList, ImportFilePath, ImportFileToolNameList)
|
||||
Dim ImportWnd As New ImportExportToolWD(Application.Current.MainWindow, ImportWndVM)
|
||||
|
||||
If ImportWnd.ShowDialog() Then
|
||||
ImportWnd.ShowDialog()
|
||||
' Aggiungo all'albero visualizzato gli utensili appena importati
|
||||
If ImportWnd.OkResult Then
|
||||
LoadImportedMachineTools(ImportWndVM.vsImported)
|
||||
End If
|
||||
End Sub
|
||||
@@ -592,31 +593,38 @@ Public Class ToolsDbPageUC
|
||||
|
||||
Private Sub LoadImportedMachineTools(vsImportedTools As String())
|
||||
' Leggo tutti gli utensili presenti nella Macchina (quindi anche quelli appena importati).
|
||||
Dim ActiveToolsFamilies() As ToolsFamily = MachineUtility.ReadToolFamilies(m_CurrMachine.sMachIniFile)
|
||||
Dim ActiveToolsFamilies() As ToolsFamily = MyReadToolFamilies(m_CurrMachine.sMachIniFile)
|
||||
Dim ToolsFamilyIndex As Integer = 0
|
||||
Dim ToolsFamilyItem As ToolsFamily
|
||||
For Each ToolsFamilyItem In ActiveToolsFamilies
|
||||
' dalla lista che ho ricavato dalla libreria recupero gli utensili associati
|
||||
Dim FamilyTreeView As New CathegoryItem(ToolsFamilyItem.Name, ToolsFamilyItem.Id)
|
||||
Dim ToolFamilyItem = ToolsList.FirstOrDefault(Function(ToolFamily) ToolsFamilyItem.Id = FamilyTreeView.nTType)
|
||||
Dim ToolFamilyItem = ToolsList.FirstOrDefault(Function(ToolFamily) ToolFamily.nTType = ToolsFamilyItem.Id)
|
||||
If IsNothing(ToolFamilyItem) Then
|
||||
ToolsList.Insert(ToolsFamilyIndex, FamilyTreeView)
|
||||
Else
|
||||
' ricerco l'indice nella lista Tools
|
||||
|
||||
End If
|
||||
Dim nType As Integer = 0
|
||||
Dim ToolName As String = String.Empty
|
||||
Dim ToolIndex As Integer = 0
|
||||
EgtSetCurrentContext(ToolScene.GetCtx())
|
||||
'EgtSetCurrentContext(ToolScene.GetCtx())
|
||||
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
|
||||
If EgtTdbGetFirstTool(ToolsFamilyItem.Id, ToolName, nType) Then
|
||||
Dim ToolItem = ToolsList(ToolsFamilyIndex).Items.FirstOrDefault(Function(Tool) Tool.Name = ToolName)
|
||||
If IsNothing(ToolItem) Then
|
||||
' Se leggo un utensile non presente nella ToolsList visualizzata lo aggiungo ad essa.
|
||||
Dim NewToolName As New CustomItem(ToolName, nType)
|
||||
ToolsList(ToolsFamilyIndex).Items.Insert(ToolIndex, NewToolName)
|
||||
'NewToolName.IsSelected = True
|
||||
ElseIf vsImportedTools.Contains(ToolName) Then
|
||||
' Se un utensile è presente nella ToolsList visualizzata ma nel contempo è nell'array vsImported
|
||||
' vuol dire che è stato sovrascritto perciò lo rimuovo e lo riaggiungo alla ToolsList.
|
||||
ToolsList(ToolsFamilyIndex).Items.Remove(ToolsList(ToolsFamilyIndex).Items.FirstOrDefault(Function(Tool) Tool.Name = ToolName))
|
||||
Dim NewToolName As New CustomItem(ToolName, nType)
|
||||
ToolsList(ToolsFamilyIndex).Items.Insert(ToolIndex, NewToolName)
|
||||
'NewToolName.IsSelected = True
|
||||
End If
|
||||
ToolIndex += 1
|
||||
While EgtTdbGetNextTool(ToolsFamilyItem.Id, ToolName, nType)
|
||||
@@ -625,20 +633,60 @@ Public Class ToolsDbPageUC
|
||||
' Se leggo un utensile non presente nella ToolsList visualizzata lo aggiungo ad essa.
|
||||
Dim NewToolName As New CustomItem(ToolName, nType)
|
||||
ToolsList(ToolsFamilyIndex).Items.Insert(ToolIndex, NewToolName)
|
||||
'NewToolName.IsSelected = True
|
||||
ElseIf vsImportedTools.Contains(ToolName) Then
|
||||
' Se un utensile è presente nella ToolsList visualizzata ma nel contempo è nell'array vsImported
|
||||
' vuol dire che è stato sovrascritto perciò lo rimuovo e lo riaggiungo alla ToolsList.
|
||||
ToolsList(ToolsFamilyIndex).Items.Remove(ToolsList(ToolsFamilyIndex).Items.FirstOrDefault(Function(Tool) Tool.Name = ToolName))
|
||||
Dim NewToolName As New CustomItem(ToolName, nType)
|
||||
ToolsList(ToolsFamilyIndex).Items.Insert(ToolIndex, NewToolName)
|
||||
'NewToolName.IsSelected = True
|
||||
End If
|
||||
ToolIndex += 1
|
||||
End While
|
||||
End If
|
||||
ToolsFamilyIndex += 1
|
||||
Next
|
||||
|
||||
End Sub
|
||||
|
||||
Public Function MyReadToolFamilies(sMachineIniPath As String) As ToolsFamily()
|
||||
Dim ActiveToolsFamiliesList As New List(Of ToolsFamily)
|
||||
|
||||
' Se il materiale lavorato è Marmo l'ordine di lettura e inserimento di Punta e Lama nelle famiglie di utensili attivi è invertito
|
||||
If EgtUILib.GetPrivateProfileInt(S_TOOLS, K_SAWBLADE, 0, sMachineIniPath) <> 0 Then
|
||||
ActiveToolsFamiliesList.Add(New ToolsFamily(MCH_TF.SAWBLADE, EgtMsg(31000 + 2)))
|
||||
End If
|
||||
If EgtUILib.GetPrivateProfileInt(S_TOOLS, K_DRILLBIT, 0, sMachineIniPath) <> 0 Then
|
||||
ActiveToolsFamiliesList.Add(New ToolsFamily(MCH_TF.DRILLBIT, EgtMsg(31000 + 1)))
|
||||
End If
|
||||
|
||||
|
||||
If EgtUILib.GetPrivateProfileInt(S_TOOLS, K_MILL, 0, sMachineIniPath) <> 0 Then
|
||||
ActiveToolsFamiliesList.Add(New ToolsFamily(MCH_TF.MILL, EgtMsg(31000 + 3)))
|
||||
End If
|
||||
If EgtUILib.GetPrivateProfileInt(S_TOOLS, "CupWheel", 0, sMachineIniPath) <> 0 Then
|
||||
ActiveToolsFamiliesList.Add(New ToolsFamily(MCH_TF.MILL, EgtMsg(90754)))
|
||||
End If
|
||||
If EgtUILib.GetPrivateProfileInt(S_TOOLS, "PolishingWheel", 0, sMachineIniPath) <> 0 Then
|
||||
ActiveToolsFamiliesList.Add(New ToolsFamily(MCH_TF.MILL, EgtMsg(90756)))
|
||||
End If
|
||||
|
||||
If EgtUILib.GetPrivateProfileInt(S_TOOLS, K_MORTISE, 0, sMachineIniPath) <> 0 Then
|
||||
ActiveToolsFamiliesList.Add(New ToolsFamily(MCH_TF.MORTISE, EgtMsg(31000 + 4)))
|
||||
End If
|
||||
If EgtUILib.GetPrivateProfileInt(S_TOOLS, K_CHISEL, 0, sMachineIniPath) <> 0 Then
|
||||
ActiveToolsFamiliesList.Add(New ToolsFamily(MCH_TF.CHISEL, EgtMsg(31000 + 9)))
|
||||
End If
|
||||
If EgtUILib.GetPrivateProfileInt(S_TOOLS, K_COMPO, 0, sMachineIniPath) <> 0 Then
|
||||
ActiveToolsFamiliesList.Add(New ToolsFamily(MCH_TF.COMPO, EgtMsg(31000 + 5)))
|
||||
End If
|
||||
If EgtUILib.GetPrivateProfileInt(S_TOOLS, K_WATERJET, 0, sMachineIniPath) <> 0 Then
|
||||
ActiveToolsFamiliesList.Add(New ToolsFamily(MCH_TF.WATERJET, EgtMsg(31010)))
|
||||
End If
|
||||
Return ActiveToolsFamiliesList.ToArray
|
||||
End Function
|
||||
|
||||
Friend Sub InitializeToolGroup(bEnabled As Boolean, nTType As Integer, sFName As String)
|
||||
If Not bEnabled Then Return
|
||||
' Inserisco categoria ed eventuali elementi
|
||||
@@ -1035,7 +1083,7 @@ Public Class ToolsDbPageUC
|
||||
Dim dCore, dTh As Double
|
||||
If EgtTdbGetCurrToolParam(MCH_TP.CORE, dCore) AndAlso
|
||||
EgtTdbGetCurrToolParam(MCH_TP.THICK, dTh) Then
|
||||
Dim dL As Double = Math.Max( dVal, 0.0) + ((dCore + dTh) / 2)
|
||||
Dim dL As Double = Math.Max(dVal, 0.0) + ((dCore + dTh) / 2)
|
||||
EgtTdbSetCurrToolParam(MCH_TP.TOTLEN, dL + 1)
|
||||
Return EgtTdbSetCurrToolParam(MCH_TP.LEN, dL)
|
||||
Else
|
||||
@@ -1122,7 +1170,7 @@ Public Class ToolsDbPageUC
|
||||
Dim dToolCore As Double
|
||||
EgtTdbGetCurrToolParam(MCH_TP.CORE, dToolCore)
|
||||
If dToolCore < EPS_SMALL Then
|
||||
dToolCore = If( dToolLen >= dToolThick, dToolThick - 1, 2 * dToolLen - dToolThick)
|
||||
dToolCore = If(dToolLen >= dToolThick, dToolThick - 1, 2 * dToolLen - dToolThick)
|
||||
EgtTdbSetCurrToolParam(MCH_TP.CORE, dToolCore)
|
||||
EgtOutLog("ToolCore too small ->" & DoubleToString(dToolCore, 1))
|
||||
End If
|
||||
|
||||
@@ -50,6 +50,7 @@ Namespace TreeViewItem
|
||||
Private m_sPictureString As String
|
||||
Private m_nTType As Integer
|
||||
Private m_Items As ObservableCollection(Of CustomItem)
|
||||
Friend m_IsValidTool As Boolean
|
||||
|
||||
Public ReadOnly Property PictureString As String
|
||||
Get
|
||||
@@ -86,12 +87,13 @@ Namespace TreeViewItem
|
||||
'Private m_sTitle As String
|
||||
Private m_nType As Integer
|
||||
|
||||
'Private m_sName As String
|
||||
'Public Property Name As String
|
||||
' Get
|
||||
' Return m_sTitle
|
||||
' Return m_sName
|
||||
' End Get
|
||||
' Set(value As String)
|
||||
' m_sTitle = value
|
||||
' m_sName = value
|
||||
' End Set
|
||||
'End Property
|
||||
|
||||
@@ -101,11 +103,31 @@ Namespace TreeViewItem
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Friend m_IsValidTool As Boolean = True
|
||||
|
||||
Public Property IsValidTool As Boolean
|
||||
Get
|
||||
Return m_IsValidTool
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If value <> m_IsValidTool Then
|
||||
m_IsValidTool = value
|
||||
NotifyPropertyChanged("ToolColor")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Sub New(Title As String, nType As Integer)
|
||||
Me.Name = Title
|
||||
m_nType = nType
|
||||
End Sub
|
||||
|
||||
Sub New(sName As String, nType As Integer, bIsValidTool As Boolean)
|
||||
MyBase.Name = sName
|
||||
m_nType = nType
|
||||
m_IsValidTool = bIsValidTool
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Public Class PartCathegoryItem
|
||||
|
||||
Reference in New Issue
Block a user