diff --git a/EgtCAM5.vbproj b/EgtCAM5.vbproj
index e7deeac..7be9d65 100644
--- a/EgtCAM5.vbproj
+++ b/EgtCAM5.vbproj
@@ -191,6 +191,7 @@
SpecialPanelV.xaml
+
@@ -336,12 +337,7 @@
-
- ToolsDbV.xaml
-
-
- TopCommandBarV.xaml
@@ -525,10 +521,6 @@
DesignerMSBuild:Compile
-
- Designer
- MSBuild:Compile
- DesignerMSBuild:Compile
diff --git a/MachinePanel/MachinePanelVM.vb b/MachinePanel/MachinePanelVM.vb
index bfaeb27..2ebd013 100644
--- a/MachinePanel/MachinePanelVM.vb
+++ b/MachinePanel/MachinePanelVM.vb
@@ -128,12 +128,23 @@ Public Class MachinePanelVM
MessageBox.Show(EgtMsg(MSG_TOOLSERRORS + 30), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
- Dim ToolDbWindow As New ToolsDbV
- ToolDbWindow.Height = 640
- ToolDbWindow.Width = 1024
- ToolDbWindow.DataContext = New ToolsDbVM
- ToolDbWindow.Owner = Application.Current.MainWindow
- ToolDbWindow.ShowDialog()
+ 'Dim ToolDbWindow As New ToolsDbV
+ 'ToolDbWindow.Height = 640
+ 'ToolDbWindow.Width = 1024
+ 'ToolDbWindow.DataContext = New ToolsDbVM
+ 'ToolDbWindow.Owner = Application.Current.MainWindow
+ 'ToolDbWindow.ShowDialog()
+
+ Dim sMachineDir As String = IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName
+ Dim ToolDbWindowVM As New MyToolDbWindowVM(sMachineDir, IniFile.m_sCurrMachIniFilePath, IniFile.m_ProjectSceneContext, "Wood")
+ Dim ToolDbWindowV As New EgtWPFLib5.ToolDbWindowV(Application.Current.MainWindow, ToolDbWindowVM)
+ If ToolDbWindowVM.MatType <> 0 Then
+ ToolDbWindowV.Height = 674
+ ToolDbWindowV.Width = 1024
+ ToolDbWindowV.Owner = Application.Current.MainWindow
+ ToolDbWindowV.ShowDialog()
+ End If
+
End Sub
#End Region ' ToolDbCommand
diff --git a/MachiningDbWindow/MyMachiningDbV.xaml b/MachiningDbWindow/MyMachiningDbV.xaml
index d84eb69..1607487 100644
--- a/MachiningDbWindow/MyMachiningDbV.xaml
+++ b/MachiningDbWindow/MyMachiningDbV.xaml
@@ -19,8 +19,8 @@
-
-
+
+ 012
diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb
index 1a5c2dd..393f2b7 100644
--- a/My Project/AssemblyInfo.vb
+++ b/My Project/AssemblyInfo.vb
@@ -70,5 +70,5 @@ Imports System.Windows
' by using the '*' as shown below:
'
-
-
+
+
diff --git a/ToolsDbWindow/MyToolDbWindowVM.vb b/ToolsDbWindow/MyToolDbWindowVM.vb
new file mode 100644
index 0000000..8792cda
--- /dev/null
+++ b/ToolsDbWindow/MyToolDbWindowVM.vb
@@ -0,0 +1,108 @@
+Imports System.Windows.Forms.Integration
+Imports System.Collections.ObjectModel
+Imports System.Reflection
+Imports System.IO
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Class MyToolDbWindowVM
+ Inherits ToolDbWindowVM
+
+ Private Const SETUP_FILEEXTENSION As String = ".stu"
+
+#Region "CONSTRUCTOR"
+
+ Sub New(sMachineDirPath As String, sMachineIniPath As String, ProjectSceneContext As Integer, Optional sMatType As String = "Wood")
+ MyBase.New(sMachineDirPath, sMachineIniPath, ProjectSceneContext, sMatType)
+ End Sub
+
+#End Region ' Constructor
+
+#Region "METHODS"
+
+ ' Funzione che aggiorna setup default con tool che hanno parametro Active
+ Public Overrides Function UpdateDefSetup() As Boolean
+ InitSetupFile()
+ ' Creo Setup
+ Dim DefSetup As New SetUpVM
+ ' inizializzo ambiente setup
+ DefSetup.InitSetUp()
+ ' resetto lista utensili e posizioni
+ DefSetup.ToolsList.Clear()
+ DefSetup.ClearAllPos()
+ DefSetup.LoadMachineTools()
+ ' ciclo sugli utensili del db
+ For Each ToolFamily In ToolsList
+ For Each Tool In ToolFamily.Items
+ Dim ToolItem As EgtWPFLib5.ToolTreeViewItem = DirectCast(Tool, EgtWPFLib5.ToolTreeViewItem)
+ ' verifico se Active
+ If ToolItem.Active Then
+ For Each TF In DefSetup.ToolsList
+ For TIndex = TF.Items.Count - 1 To 0 Step -1
+ Dim T As ToolItem = DirectCast(TF.Items(TIndex), ToolItem)
+ If ToolItem.Name = T.Name Then
+ DefSetup.ToolDoubleClick(T)
+ End If
+ Next
+ Next
+ End If
+ Next
+ Next
+ Dim DefSetupPath As String = IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName & "\SetUp"
+ Dim DefSetupName As String = String.Empty
+ EgtUILib.GetPrivateProfileString(S_SETUP, K_DEFAULT, "", DefSetupName, IniFile.m_sCurrMachIniFilePath)
+ DefSetupPath += "\" & DefSetupName & SETUP_FILEEXTENSION
+ If Not DefSetup.Save(DefSetupPath) Then EgtOutLog("Impossible to save default setup.")
+ Return True
+ End Function
+
+ ' Inizializzo file Setup
+ Private Sub InitSetupFile()
+ ' verifico che il file di configurazione attrezzaggio (lua) della macchina esista
+ If Not File.Exists(IniFile.m_sCurrMachScriptsDirPath & "\" & SETUP_LUA) Then
+ EgtOutLog("SetUp error: SetUp configuration file doesn't exist ")
+ MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 7), EgtMsg(MSG_SETUPERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
+ Return
+ End If
+ ' carico Lua che contiene le funzioni per ottenere le posizioni valide dell'utensile selezionato,
+ ' e testa e uscita dell'utensile attrezzato
+ EgtLuaExecFile(IniFile.m_sCurrMachScriptsDirPath & "\" & SETUP_LUA)
+ ' verifico che le teste riportate in configurazione esistano
+ Dim Index As Integer = 1
+ Dim nErr As Integer = 0
+ While nErr = 0
+ Dim sHead As String = String.Empty
+ nErr = 999
+ EgtLuaSetGlobIntVar("STU.INDEX", Index)
+ EgtLuaCallFunction("STU.GetTcPosHeadGroupFromPos")
+ ' Leggo variabili
+ EgtLuaGetGlobStringVar("STU.HEAD", sHead)
+ EgtLuaGetGlobIntVar("STU.ERR", nErr)
+ If nErr = 0 Then
+ If EgtGetHeadExitCount(sHead) = 0 Then
+ MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 8), EgtMsg(MSG_SETUPERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
+ Return
+ End If
+ End If
+ Index += 1
+ End While
+ ' Verifico esistenza direttorio per attrezzaggi
+ Dim sDir As String = IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName & "\SetUp"
+ If Not Directory.Exists(sDir) Then
+ Try
+ Directory.CreateDirectory(sDir)
+ Catch ex As Exception
+ EgtOutLog("Error in SetupDir creation " & ex.ToString())
+ Return
+ End Try
+ End If
+
+ End Sub
+
+ Public Overrides Sub OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String) 'Handles m_ToolScene.OnCursorPos
+ Application.Msn.NotifyColleagues(Application.NOTIFYCURRPOS, sCursorPos)
+ End Sub
+
+#End Region ' Methods
+
+End Class
diff --git a/ToolsDbWindow/ToolTreeView.vb b/ToolsDbWindow/ToolTreeView.vb
deleted file mode 100644
index d28941d..0000000
--- a/ToolsDbWindow/ToolTreeView.vb
+++ /dev/null
@@ -1,2079 +0,0 @@
-Imports System.ComponentModel
-Imports System.IO
-Imports System.Collections.ObjectModel
-Imports System.Text.RegularExpressions
-Imports EgtUILib
-
-Public Class FamilyToolTreeViewItem
- Inherits InheritableTreeViewItem
-
- ' Actions
- Friend Shared m_delIsEnabledBtns As Action(Of Boolean, Boolean, Boolean)
-
- Public Overrides Property IsSelected As Boolean
- Get
- Return m_IsSelected
- End Get
- Set(value As Boolean)
- If (value <> m_IsSelected) Then
- m_IsSelected = value
- If value Then
- ' The function that I want to call When Parent item is selected in the tree
- If EgtSetCurrentContext(IniFile.m_ToolsDbSceneContext)
- EgtNewFile()
- EgtSetView(VT.TOP, False)
- EgtZoom(ZM.ALL)
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- End If
- If value Then
- m_delIsEnabledBtns(True, False, False)
- End If
- End If
- NotifyPropertyChanged("IsSelected")
- End If
- End Set
- End Property
-
- Private m_ToolType As MCH_TF
- '''
- ''' Property that determines the tool type of the family
- '''
- Public Property ToolType As MCH_TF
- Get
- Return m_ToolType
- End Get
- Set(value As MCH_TF)
- m_ToolType = value
- End Set
- End Property
-
- ' Proprietà che permette di nascondere tutti i parametri utensile grazie al binding ed al converter
- Public ReadOnly Property Type As Integer
- Get
- Return MCH_TY.NONE
- End Get
- End Property
-
- Sub New(Name As String, ToolFamily As MCH_TF)
- MyBase.New(Name)
- Me.PictureString = "/Resources/TreeView/Folder.png"
- Me.m_ToolType = ToolFamily
- End Sub
-
-End Class
-
-Public Class ToolTreeViewItem
- Inherits InheritableTreeViewItem
-
- ' Actions
- Friend Shared m_delRemoveTool As Action(Of ToolTreeViewItem)
- Friend Shared m_delErrorOnTool As Action(Of Boolean)
- Friend Shared m_delIsEnabledBtns As Action(Of Boolean, Boolean, Boolean)
- Friend Shared m_delGetSelectedTool As Func(Of ToolTreeViewItem)
-
-#Region "Tool Property"
-
- ' Variabile che indica quando non lanciare l'update del disegno utensile
- ' (utile per evitare di rifare il disegno più volte quando vengono caricati i parametri alla selezione di un utensile)
- Private m_SuspendToolDrawUpdate As Boolean = False
-
- ' Variabile che indica se l'utensile è appena stato creato
- Dim m_NewTool As Boolean = False
- Public Property NewTool As Boolean
- Get
- Return m_NewTool
- End Get
- Set(value As Boolean)
- m_NewTool = value
- End Set
- End Property
-
- '''
- ''' Property that determines if the Tool is selected or not
- '''
- Public Overrides Property IsSelected As Boolean
- Get
- Return m_IsSelected
- End Get
- Set(value As Boolean)
- If (value <> m_IsSelected) Then
- m_IsSelected = value
- If value Then
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbSetCurrTool(Me.Name)
- ReadToolParam()
- IsModifiedReset()
- NotifyPropertyChanged("Type")
- m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
- Else
- WriteToolParam()
- If EgtTdbIsCurrToolModified() Or m_IsModifiedName Or Me.NewTool Then
- Select Case MsgBox(EgtMsg(MSG_TOOLSERRORS), MsgBoxStyle.YesNo, EgtMsg(MSG_TOOLSERRORS + 1))
- Case MsgBoxResult.Yes
- m_NewTool = False
- m_Name = m_Name.Trim()
- WriteToolName()
- EgtTdbSaveCurrTool()
- Case MsgBoxResult.No
- If m_NewTool Then
- m_delRemoveTool(Me)
- ElseIf m_IsModifiedName Then
- Dim DbName As String = String.Empty
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.NAME, DbName)
- NamePar = DbName
- End If
- End Select
- End If
- End If
- ' ricarico utensile per avere valore Active e ricaricarlo
- EgtTdbSetCurrTool(Me.Name)
- NotifyPropertyChanged("Active")
- NotifyPropertyChanged("IsSelected")
- End If
- End Set
- End Property
-
- Private m_IsModifiedCorr As Boolean = False
- Private m_Corr As String
- '''
- ''' Property that read and write to the tool's database the Corrector
- '''
- Public Property Corr As String
- Get
- Return m_Corr
- End Get
- Set(value As String)
- If value <> m_Corr Then
- m_Corr = value
- Dim DbCorr As Integer = 0
- Dim nValue As Integer = 0
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.CORR, DbCorr)
- Int32.TryParse(value, nValue)
- m_IsModifiedCorr = If(nValue <> DbCorr, True, False)
- m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
- NotifyPropertyChanged("Corr")
- End If
- End Set
- End Property
-
- Friend m_ExitList As New ObservableCollection(Of String)
- Public ReadOnly Property ExitList As ObservableCollection(Of String)
- Get
- Return m_ExitList
- End Get
- End Property
-
- Private m_IsModifiedSelectedExit As Boolean = False
- Private m_SelectedExit As String
- '''
- ''' Property that read and write to the tool's database the Exit
- '''
- Public Property SelectedExit As String
- Get
- Return m_SelectedExit
- End Get
- Set(value As String)
- If value <> m_SelectedExit Then
- m_SelectedExit = value
- Dim DbExit As Integer = 0
- Dim nValue As Integer = 0
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.EXIT_, DbExit)
- Int32.TryParse(value, nValue)
- m_IsModifiedSelectedExit = If(nValue <> DbExit, True, False)
- ' se modificato disattivo l'utensile
- If m_IsModifiedSelectedExit Then EgtTdbSetCurrToolParam(MCH_TP.ACTIVE, False)
- If Not GetValidationError("SelectedExit") Then
- m_delErrorOnTool(True)
- m_delIsEnabledBtns(False, False, True)
- Else
- m_delErrorOnTool(Not IsValid)
- m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
- End If
- If Not m_SuspendToolDrawUpdate Then
- UpdateSceneToolDraw()
- End If
- NotifyPropertyChanged("SelectedExit")
- End If
- End Set
- End Property
-
- Private m_Type As Integer
- '''
- ''' Property that read and write to the tool's database the Type
- '''
- Public Property Type As Integer
- Get
- Return m_Type
- End Get
- Set(value As Integer)
- If value <> m_Type Then
- m_Type = value
- End If
- End Set
- End Property
-
- Private m_IsModifiedCoolant As Boolean = False
- Private m_Coolant As String
- '''
- ''' Property that read and write to the tool's database the Coolant
- '''
- Public Property Coolant As String
- Get
- Return m_Coolant
- End Get
- Set(value As String)
- If value <> m_Coolant Then
- m_Coolant = value
- Dim DbCoolant As Integer = 0
- Dim nValue As Integer = 0
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.COOLANT, DbCoolant)
- Int32.TryParse(value, nValue)
- m_IsModifiedCoolant = If(nValue <> DbCoolant, True, False)
- m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
- NotifyPropertyChanged("Coolant")
- End If
- End Set
- End Property
-
- Private m_IsModifiedCornRad As Boolean = False
- Private m_CornRad As String
- '''
- ''' Property that read and write to the tool's database the Corner Radius
- '''
- Public Property CornRad As String
- Get
- Return m_CornRad
- End Get
- Set(value As String)
- If value <> m_CornRad Then
- m_CornRad = value
- Dim DbCornRad As Double = 0
- Dim dValue As Double = 0
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.CORNRAD, DbCornRad)
- StringToLen(value, dValue)
- m_IsModifiedCornRad = Math.Abs(dValue - DbCornRad) > 10 * EPS_SMALL
- If Not GetValidationError("CornRad") Then
- m_delErrorOnTool(True)
- m_delIsEnabledBtns(False, False, True)
- Else
- m_delErrorOnTool(Not IsValid)
- m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
- End If
- If Not m_SuspendToolDrawUpdate Then
- UpdateSceneToolDraw()
- End If
- NotifyPropertyChanged("CornRad")
- End If
- End Set
- End Property
-
- Private m_IsModifiedDiam As Boolean = False
- Private m_Diam As String
- '''
- ''' Property that read and write to the tool's database the Diameter
- '''
- Public Property Diam As String
- Get
- Return m_Diam
- End Get
- Set(value As String)
- If value <> m_Diam Then
- m_Diam = value
- Dim DbDiam As Double = 0
- Dim dValue As Double = 0
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.DIAM, DbDiam)
- StringToLen(value, dValue)
- m_IsModifiedDiam = Math.Abs(dValue - DbDiam) > 10 * EPS_SMALL
- If Not GetValidationError("Diam") Then
- m_delErrorOnTool(True)
- m_delIsEnabledBtns(False, False, True)
- Else
- m_delErrorOnTool(Not IsValid)
- m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
- End If
- If Not m_SuspendToolDrawUpdate Then
- UpdateSceneToolDraw()
- End If
- NotifyPropertyChanged("Diam")
- End If
- End Set
- End Property
-
- Private m_IsModifiedTotDiam As Boolean = False
- Private m_TotDiam As String
- '''
- ''' Property that read and write to the tool's database the Total Diameter
- '''
- Public Property TotDiam As String
- Get
- Return m_TotDiam
- End Get
- Set(value As String)
- If value <> m_TotDiam Then
- m_TotDiam = value
- Dim DbTotDiam As Double = 0
- Dim dValue As Double = 0
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.TOTDIAM, DbTotDiam)
- StringToLen(value, dValue)
- m_IsModifiedTotDiam = Math.Abs(dValue - DbTotDiam) > 5 * EPS_SMALL
- If Not m_SuspendToolDrawUpdate Then
- UpdateSceneToolDraw()
- End If
- If Not GetValidationError("Diam") Or Not GetValidationError("TotDiam") Then
- m_delErrorOnTool(True)
- m_delIsEnabledBtns(False, False, True)
- Else
- m_delErrorOnTool(Not IsValid)
- m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
- End If
- NotifyPropertyChanged("TotDiam")
- End If
- End Set
- End Property
-
- Private m_IsModifiedFeed As Boolean = False
- Private m_Feed As String
- '''
- ''' Property that read and write to the tool's database the Feed
- '''
- Public Property Feed As String
- Get
- Return m_Feed
- End Get
- Set(value As String)
- If value <> m_Feed Then
- m_Feed = value
- Dim DbFeed As Double = 0
- Dim dValue As Double = 0
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.FEED, DbFeed)
- StringToLen(value, dValue)
- m_IsModifiedFeed = Math.Abs(dValue - DbFeed) > 5 * EPS_SMALL
- m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
- NotifyPropertyChanged("Feed")
- End If
- End Set
- End Property
-
- Private m_IsModifiedEndFeed As Boolean = False
- Private m_EndFeed As String
- '''
- ''' Property that read and write to the tool's database the End Feed
- '''
- Public Property EndFeed As String
- Get
- Return m_EndFeed
- End Get
- Set(value As String)
- If value <> m_EndFeed Then
- m_EndFeed = value
- Dim DbEndFeed As Double = 0
- Dim dValue As Double = 0
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.ENDFEED, DbEndFeed)
- StringToLen(value, dValue)
- m_IsModifiedEndFeed = Math.Abs(dValue - DbEndFeed) > 5 * EPS_SMALL
- m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
- NotifyPropertyChanged("EndFeed")
- End If
- End Set
- End Property
-
- Private m_IsModifiedStartFeed As Boolean = False
- Private m_StartFeed As String
- '''
- ''' Property that read and write to the tool's database the Start Feed
- '''
- Public Property StartFeed As String
- Get
- Return m_StartFeed
- End Get
- Set(value As String)
- If value <> m_StartFeed Then
- m_StartFeed = value
- Dim DbStartFeed As Double = 0
- Dim dValue As Double = 0
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.STARTFEED, DbStartFeed)
- StringToLen(value, dValue)
- m_IsModifiedStartFeed = Math.Abs(dValue - DbStartFeed) > 5 * EPS_SMALL
- m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
- NotifyPropertyChanged("StartFeed")
- End If
- End Set
- End Property
-
- Private m_IsModifiedTipFeed As Boolean = False
- Private m_TipFeed As String
- '''
- ''' Property that read and write to the tool's database the Tip Feed
- '''
- Public Property TipFeed As String
- Get
- Return m_TipFeed
- End Get
- Set(value As String)
- If value <> m_TipFeed Then
- m_TipFeed = value
- Dim DbTipFeed As Double = 0
- Dim dValue As Double = 0
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.TIPFEED, DbTipFeed)
- StringToLen(value, dValue)
- m_IsModifiedTipFeed = Math.Abs(dValue - DbTipFeed) > 5 * EPS_SMALL
- m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
- NotifyPropertyChanged("TipFeed")
- ' Se fresa e 0 non può lavorare di testa
- If (Type And MCH_TF.MILL) <> 0 Then
- If dValue > EPS_SMALL Then
- Type = MCH_TY.MILL_STD
- Else
- Type = MCH_TY.MILL_NOTIP
- End If
- End If
- End If
- End Set
- End Property
-
- Private m_IsModifiedLen As Boolean = False
- Private m_Len As String
- '''
- ''' Property that read and write to the tool's database the Len
- '''
- Public Property Len As String
- Get
- Return m_Len
- End Get
- Set(value As String)
- If value <> m_Len Then
- m_Len = value
- Dim DbLen As Double = 0
- Dim dValue As Double = 0
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.LEN, DbLen)
- StringToLen(value, dValue)
- m_IsModifiedLen = Math.Abs(dValue - DbLen) > 5 * EPS_SMALL
- If Not m_SuspendToolDrawUpdate Then
- UpdateSceneToolDraw()
- End If
- If Not GetValidationError("Len") Or Not GetValidationError("MaxMat") Then
- m_delErrorOnTool(True)
- m_delIsEnabledBtns(False, False, True)
- Else
- m_delErrorOnTool(Not IsValid)
- m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
- End If
- NotifyPropertyChanged("Len")
- ' Se lama
- If (Type And MCH_TF.SAWBLADE) <> 0 Then
- Dim CurrTotLen As Double = 0
- If Not IsNothing(TotLen) Then
- StringToLen(TotLen, CurrTotLen)
- ' se len e totlen coincidono tipo piatto
- If (CurrTotLen - dValue) > 10 * EPS_SMALL Then
- Type = MCH_TY.SAW_STD
- Else
- Type = MCH_TY.SAW_FLAT
- End If
- End If
- End If
- End If
- End Set
- End Property
-
- Private m_IsModifiedTotLen As Boolean = False
- Private m_TotLen As String
- '''
- ''' Property that read and write to the tool's database the Total Len
- '''
- Public Property TotLen As String
- Get
- Return m_TotLen
- End Get
- Set(value As String)
- If value <> m_TotLen Then
- m_TotLen = value
- Dim DbTotLen As Double = 0
- Dim dValue As Double = 0
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.TOTLEN, DbTotLen)
- StringToLen(value, dValue)
- m_IsModifiedTotLen = Math.Abs(dValue - DbTotLen) > 5 * EPS_SMALL
- If Not m_SuspendToolDrawUpdate Then
- UpdateSceneToolDraw()
- End If
- If Not GetValidationError("TotLen") Or Not GetValidationError("Len") Then
- m_delErrorOnTool(True)
- m_delIsEnabledBtns(False, False, True)
- Else
- m_delErrorOnTool(Not IsValid)
- m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
- End If
- NotifyPropertyChanged("TotLen")
- ' Se lama e len e totlen coincidono tipo piatto
- If (Type And MCH_TF.SAWBLADE) <> 0 Then
- If Not IsNothing(Len) Then
- Dim CurrLen As Double = 0
- StringToLen(Len, CurrLen)
- If (dValue - CurrLen) > 10 * EPS_SMALL Then
- Type = MCH_TY.SAW_STD
- Else
- Type = MCH_TY.SAW_FLAT
- End If
- End If
- End If
- End If
- End Set
- End Property
-
- Private m_IsModifiedMaxMat As Boolean = False
- Private m_MaxMat As String
- '''
- ''' Property that read and write to the tool's database the Max Material
- '''
- Public Property MaxMat As String
- Get
- Return m_MaxMat
- End Get
- Set(value As String)
- If value <> m_MaxMat Then
- m_MaxMat = value
- Dim DbMaxMat As Double = 0
- Dim dValue As Double = 0
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.MAXMAT, DbMaxMat)
- StringToLen(value, dValue)
- m_IsModifiedMaxMat = Math.Abs(dValue - DbMaxMat) > 5 * EPS_SMALL
- If Not m_SuspendToolDrawUpdate Then
- UpdateSceneToolDraw()
- End If
- If Not GetValidationError("MaxMat") Then
- m_delErrorOnTool(True)
- m_delIsEnabledBtns(False, False, True)
- Else
- m_delErrorOnTool(Not IsValid)
- m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
- End If
- NotifyPropertyChanged("MaxMat")
- End If
- End Set
- End Property
-
- Private m_IsModifiedLonOffset As Boolean = False
- Private m_LonOffset As String
- '''
- ''' Property that read and write to the tool's database the Lon Offset
- '''
- Public Property LonOffset As String
- Get
- Return m_LonOffset
- End Get
- Set(value As String)
- If value <> m_LonOffset Then
- m_LonOffset = value
- Dim DbLonOffset As Double = 0
- Dim dValue As Double = 0
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.LONOFFSET, DbLonOffset)
- StringToLen(value, dValue)
- m_IsModifiedLonOffset = Math.Abs(dValue - DbLonOffset) > 5 * EPS_SMALL
- m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
- NotifyPropertyChanged("LonOffset")
- End If
- End Set
- End Property
-
- Private m_IsModifiedRadOffset As Boolean = False
- Private m_RadOffset As String
- '''
- ''' Property that read and write to the tool's database the Rad Offset
- '''
- Public Property RadOffset As String
- Get
- Return m_RadOffset
- End Get
- Set(value As String)
- If value <> m_RadOffset Then
- m_RadOffset = value
- Dim DbRadOffset As Double = 0
- Dim dValue As Double = 0
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.RADOFFSET, DbRadOffset)
- StringToLen(value, dValue)
- m_IsModifiedRadOffset = Math.Abs(dValue - DbRadOffset) > 5 * EPS_SMALL
- m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
- NotifyPropertyChanged("RadOffset")
- End If
- End Set
- End Property
-
- Private m_IsModifiedSpeed As Boolean = False
- Private m_Speed As String
- '''
- ''' Property that read and write to the tool's database the Speed
- '''
- Public Property Speed As String
- Get
- Return m_Speed
- End Get
- Set(value As String)
- If value <> m_Speed Then
- m_Speed = value
- Dim DbSpeed As Double = 0
- Dim dValue As Double = 0
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.SPEED, DbSpeed)
- StringToDouble(value, dValue)
- m_IsModifiedSpeed = Math.Abs(dValue - DbSpeed) > 10 * EPS_ANG_SMALL
- If Not GetValidationError("Speed") Then
- m_delErrorOnTool(True)
- m_delIsEnabledBtns(False, False, True)
- Else
- m_delErrorOnTool(Not IsValid)
- m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
- End If
- NotifyPropertyChanged("Speed")
- End If
- End Set
- End Property
-
- Private m_IsModifiedSideAng As Boolean = False
- Private m_SideAng As String
- '''
- ''' Property that read and write to the tool's database the Side Angle
- '''
- Public Property SideAng As String
- Get
- Return m_SideAng
- End Get
- Set(value As String)
- If value <> m_SideAng Then
- m_SideAng = value
- Dim DbSideAng As Double = 0
- Dim dValue As Double = 0
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.SIDEANG, DbSideAng)
- StringToDouble(value, dValue)
- m_IsModifiedSideAng = Math.Abs(dValue - DbSideAng) > 10 * EPS_ANG_SMALL
- m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
- If Not m_SuspendToolDrawUpdate Then
- UpdateSceneToolDraw()
- End If
- NotifyPropertyChanged("SideAng")
- End If
- End Set
- End Property
-
- Private m_IsModifiedMaxSpeed As Boolean = False
- Private m_MaxSpeed As String
- '''
- ''' Property that read and write to the tool's database the Max Speed
- '''
- Public Property MaxSpeed As String
- Get
- Return m_MaxSpeed
- End Get
- Set(value As String)
- If value <> m_MaxSpeed Then
- m_MaxSpeed = value
- Dim DbMaxSpeed As Double = 0
- Dim dValue As Double = 0
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.MAXSPEED, DbMaxSpeed)
- StringToLen(value, dValue)
- m_IsModifiedMaxSpeed = Math.Abs(dValue - DbMaxSpeed) > 10 * EPS_ANG_SMALL
- If Not GetValidationError("Speed") Then
- m_delErrorOnTool(True)
- m_delIsEnabledBtns(False, False, True)
- Else
- m_delErrorOnTool(Not IsValid)
- m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
- End If
- NotifyPropertyChanged("MaxSpeed")
- End If
- End Set
- End Property
-
- Private m_IsModifiedThick As Boolean = False
- Private m_Thick As String
- '''
- ''' Property that read and write to the tool's database the Thick
- '''
- Public Property Thick As String
- Get
- Return m_Thick
- End Get
- Set(value As String)
- If value <> m_Thick Then
- m_Thick = value
- Dim DbThick As Double = 0
- Dim dValue As Double = 0
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.THICK, DbThick)
- StringToLen(value, dValue)
- m_IsModifiedThick = Math.Abs(dValue - DbThick) > 5 * EPS_SMALL
- If Not m_SuspendToolDrawUpdate Then
- UpdateSceneToolDraw()
- End If
- If Not GetValidationError("Thick") Or Not GetValidationError("CornRad") Then
- m_delErrorOnTool(True)
- m_delIsEnabledBtns(False, False, True)
- Else
- m_delErrorOnTool(Not IsValid)
- m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
- End If
- NotifyPropertyChanged("Thick")
- End If
- End Set
- End Property
-
- Private m_IsModifiedMaxAbsorption As Boolean = False
- Private m_MaxAbsorption As String
- '''
- ''' Property that read and write to the tool's database the Max Absorption
- '''
- Public Property MaxAbsorption As String
- Get
- Return m_MaxAbsorption
- End Get
- Set(value As String)
- If value <> m_MaxAbsorption Then
- m_MaxAbsorption = value
- Dim DbMaxAbsorption As Double = 0
- Dim dValue As Double = 0
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.MAXABSORPTION, DbMaxAbsorption)
- StringToLen(value, dValue)
- m_IsModifiedMaxAbsorption = Math.Abs(dValue - DbMaxAbsorption) > 5 * EPS_SMALL
- m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
- NotifyPropertyChanged("MaxAbsorption")
- End If
- End Set
- End Property
-
- Private m_IsModifiedMinFeed As Boolean = False
- Private m_MinFeed As String
- '''
- ''' Property that read and write to the tool's database the Min Feed
- '''
- Public Property MinFeed As String
- Get
- Return m_MinFeed
- End Get
- Set(value As String)
- If value <> m_MinFeed Then
- m_MinFeed = value
- Dim DbMinFeed As Double = 0
- Dim dValue As Double = 0
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.MINFEED, DbMinFeed)
- StringToLen(value, dValue)
- m_IsModifiedMinFeed = Math.Abs(dValue - DbMinFeed) > 5 * EPS_SMALL
- m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
- NotifyPropertyChanged("MinFeed")
- End If
- End Set
- End Property
-
- Private m_IsModifiedDraw As Boolean = False
- Friend m_Draw As String
- '''
- ''' Property that read and write to the tool's database the Draw
- '''
- Public Property Draw As String
- Get
- Return m_Draw
- End Get
- Set(value As String)
- If value = String.Empty Or value <> m_Draw Then
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- m_Draw = value
- Dim DbDraw As String = String.Empty
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.DRAW, DbDraw)
- m_IsModifiedDraw = (value <> DbDraw)
- NotifyPropertyChanged("Draw")
- End If
- End Set
- End Property
-
- Friend Shared m_HeadList As New List(Of HeadItem)
- Public ReadOnly Property HeadList As List(Of HeadItem)
- Get
- Return m_HeadList
- End Get
- End Property
-
- Private m_IsModifiedSelectedHead As Boolean = False
- Private m_SelectedHead As HeadItem
- '''
- ''' Property that read and write to the tool's database the Head
- '''
- Public Property SelectedHead As HeadItem
- Get
- Return m_SelectedHead
- End Get
- Set(value As HeadItem)
- If value IsNot m_SelectedHead Then
- m_SelectedHead = value
- Dim DbHead As String = String.Empty
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.HEAD, DbHead)
- m_IsModifiedSelectedHead = If(value.HName <> DbHead, True, False)
- ' se modificato disattivo l'utensile
- If m_IsModifiedSelectedHead Then EgtTdbSetCurrToolParam(MCH_TP.ACTIVE, False)
- If Not m_SuspendToolDrawUpdate Then
- UpdateSceneToolDraw()
- End If
- If Not GetValidationError("SelectedHead") Then
- m_delErrorOnTool(True)
- m_delIsEnabledBtns(False, False, True)
- Else
- m_delErrorOnTool(Not IsValid)
- m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
- End If
- NotifyPropertyChanged("SelectedHead")
- ' verifico se le uscite sono cambiate
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- Dim nExitNum As Integer = EgtGetHeadExitCount(m_SelectedHead.HName)
- ' ricalcolo la lista uscite
- If nExitNum > m_ExitList.Count Then
- For ExitIndex = m_ExitList.Count To nExitNum - 1
- m_ExitList.Add((ExitIndex + 1).ToString)
- Next
- ElseIf nExitNum < m_ExitList.Count Then
- For Index = m_ExitList.Count - 1 To nExitNum Step -1
- m_ExitList.RemoveAt(Index)
- Next
- End If
- ' verifico se l'uscita selezionata è nella lista
- If Not m_ExitList.Contains(m_SelectedExit) AndAlso m_ExitList.Count > 0 Then
- SelectedExit = m_ExitList(0)
- End If
- ' ricalcolo la lista di posizioni valide
- Dim nErr As Integer = 0
- Dim bIsValid As Boolean = False
- Dim TcPosIndex As Integer = 0
- For OrigTcPosIndex = 0 To m_OrigTcPosList.Count - 1
- Dim CurrTcPos As String = m_OrigTcPosList(OrigTcPosIndex)
- bIsValid = False
- EgtLuaSetGlobStringVar("STU.TCPOS", CurrTcPos)
- EgtLuaSetGlobStringVar("STU.HEAD", m_SelectedHead.HName)
- If Not EgtLuaCallFunction("STU.IsValidTcPosFromHead") Then nErr = 999
- ' Leggo variabili
- EgtLuaGetGlobBoolVar("STU.ISVALID", bIsValid)
- If Not EgtLuaGetGlobIntVar("STU.ERR", nErr) Then nErr = 999
- If nErr = 0 AndAlso bIsValid Then
- If m_TcPosList.Count - 1 >= TcPosIndex AndAlso m_TcPosList(TcPosIndex) = CurrTcPos Then
- TcPosIndex += 1
- Else
- m_TcPosList.Insert(TcPosIndex, CurrTcPos)
- TcPosIndex += 1
- End If
- Else
- If m_TcPosList.Count - 1 >= TcPosIndex AndAlso m_TcPosList(TcPosIndex) = CurrTcPos Then
- m_TcPosList.RemoveAt(TcPosIndex)
- End If
- End If
- Next
- NotifyPropertyChanged("ExitList")
- NotifyPropertyChanged("TcPosList")
- End If
- End Set
- End Property
-
- ' Variabile che indica se c'è un errore nel nome dell'utensile (ad esempio nome già utilizzato)
- Dim nErrorToolName As Integer = 0
- Friend m_IsModifiedName As Boolean = False
- '''
- ''' Property that read and write to the tool's database the Name
- '''
- Public Property NamePar As String
- Get
- Return m_Name
- End Get
- Set(value As String)
- If value = String.Empty Or value <> m_Name Then
- nErrorToolName = 0
- m_Name = value
- ' Verifico se il nome è diverso da quello nel database e imposto l'apposito flag
- Dim DbName As String = String.Empty
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.NAME, DbName)
- m_IsModifiedName = If(value <> DbName, True, False)
- ' Verifico che il nuovo nome sia valido
- Dim sTempName As String = value
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetToolNewName(sTempName)
- If m_IsModifiedName And Not value = sTempName Then
- nErrorToolName = 1
- End If
- If Not GetValidationError("NamePar") Then
- m_delErrorOnTool(True)
- m_delIsEnabledBtns(False, False, True)
- Else
- m_delErrorOnTool(Not IsValid)
- m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
- End If
- NotifyPropertyChanged("NamePar")
- End If
- End Set
- End Property
-
- Private m_IsModifiedUserNotes As Boolean = False
- Private m_UserNotes As String
- '''
- ''' Property that read and write to the tool's database the User Notes
- '''
- Public Property UserNotes As String
- Get
- Return m_UserNotes
- End Get
- Set(value As String)
- If value = String.Empty Or value <> m_UserNotes Then
- m_UserNotes = value
- Dim DbUserNotes As String = String.Empty
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.USERNOTES, DbUserNotes)
- m_IsModifiedUserNotes = If(value <> DbUserNotes, True, False)
- m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
- NotifyPropertyChanged("UserNotes")
- End If
- End Set
- End Property
-
- Friend Shared m_OrigTcPosList As New List(Of String)
- Public ReadOnly Property OrigTcPosList As List(Of String)
- Get
- Return m_OrigTcPosList
- End Get
- End Property
-
- Friend m_TcPosList As New ObservableCollection(Of String)
- Public ReadOnly Property TcPosList As ObservableCollection(Of String)
- Get
- Return m_TcPosList
- End Get
- End Property
-
- Private m_IsModifiedSelectedTcPos As Boolean = False
- Private m_SelectedTcPos As String
- '''
- ''' Property that read and write to the tool's database the Tc Pos
- '''
- Public Property SelectedTcPos As String
- Get
- Return m_SelectedTcPos
- End Get
- Set(value As String)
- If value = String.Empty Or value <> m_SelectedTcPos Then
- m_SelectedTcPos = value
- Dim DbTcPos As String = String.Empty
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.TCPOS, DbTcPos)
- m_IsModifiedSelectedTcPos = If(value <> DbTcPos, True, False)
- ' se modificato disattivo l'utensile
- If m_IsModifiedSelectedTcPos Then
- Dim z = EgtTdbSetCurrToolParam(MCH_TP.ACTIVE, False)
- NotifyPropertyChanged("Active")
- End If
- m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
- NotifyPropertyChanged("SelectedTcPos")
- End If
- End Set
- End Property
-
- Private m_Uuid As String
- '''
- ''' Property that read and write to the tool's database the Uuid
- '''
- Public ReadOnly Property Uuid As String
- Get
- Return m_Uuid
- End Get
- End Property
-
- Public Property Active As Boolean
- Get
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- ' salvo utensile corrente precedente
- Dim PreviousCurrentTool As String = String.Empty
- EgtTdbGetCurrToolParam(MCH_TP.NAME, PreviousCurrentTool)
- Dim bChangeTool As Boolean = PreviousCurrentTool <> Me.Name
- If bChangeTool Then EgtTdbSetCurrTool(Me.Name)
- Dim bActive As Boolean = False
- EgtTdbGetCurrToolParam(MCH_TP.ACTIVE, bActive)
- ' ripristino utensile corrente
- If bChangeTool Then EgtTdbSetCurrTool(PreviousCurrentTool)
- Return bActive
- End Get
- Set(value As Boolean)
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- ' verifico se l'utensile selezionato è modificato
- Dim SelTool As ToolTreeViewItem = m_delGetSelectedTool()
- If Not IsNothing(SelTool) AndAlso SelTool.IsModified Then
- ' chiedo di salvare
- If MessageBox.Show(String.Format(EgtMsg(6144), SelTool.Name), EgtMsg(6143), MessageBoxButton.YesNo, MessageBoxImage.Question) <> MessageBoxResult.Yes Then
- Return
- Else
- SelTool.WriteToolParam()
- SelTool.m_Name = SelTool.m_Name.Trim()
- SelTool.WriteToolName()
- EgtTdbSaveCurrTool()
- SelTool.NewTool = False
- SelTool.IsModifiedReset()
- m_delIsEnabledBtns(SelTool.IsValid And Not SelTool.IsModified, SelTool.IsValid, True)
- End If
- End If
- ' salvo utensile corrente precedente
- Dim PreviousCurrentTool As String = String.Empty
- EgtTdbGetCurrToolParam(MCH_TP.NAME, PreviousCurrentTool)
- ' se attivato, verifico che non sia in conflitto con altri utensili
- If value Then
- ' verifico se c'è un utensile con la stessa posizione
- If Not VerifyAllPositions() Then
- MessageBox.Show(EgtMsg(6145), EgtMsg(6126), MessageBoxButton.OK, MessageBoxImage.Exclamation)
- ' ripristino utensile corrente
- EgtTdbSetCurrTool(PreviousCurrentTool)
- Return
- End If
- End If
- ' lo scrivo nel Db
- EgtTdbSetCurrTool(Me.Name)
- EgtTdbSetCurrToolParam(MCH_TP.ACTIVE, value)
- EgtTdbSaveCurrTool()
- NotifyPropertyChanged("Active")
- ' ripristino utensile corrente
- EgtTdbSetCurrTool(PreviousCurrentTool)
- End Set
- End Property
-#End Region ' Tool Property
-
- ' Definizione comandi
- Private m_cmdOpenDrawFile As ICommand
- Private m_cmdAutoDraw As ICommand
-
-#Region "Constructors"
-
- Sub New(Name As String)
- MyBase.New(Name)
- End Sub
-
-#End Region ' Constructors
-
-#Region "METHODS"
-
- Friend Sub ReadToolParam()
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- ' sospendo l'aggiornamento del disegno per evitare di rifarlo al cambio di ogni parametro inerente
- m_SuspendToolDrawUpdate = True
- Dim nValue As Integer = 0
- Dim dValue As Double = 0
- Dim sValue As String = String.Empty
- EgtTdbGetCurrToolParam(MCH_TP.CORR, nValue)
- m_Corr = nValue.ToString()
- NotifyPropertyChanged("Corr")
- m_IsModifiedCorr = False
- EgtTdbGetCurrToolParam(MCH_TP.TYPE, nValue)
- m_Type = nValue
- NotifyPropertyChanged("Type")
- EgtTdbGetCurrToolParam(MCH_TP.COOLANT, nValue)
- m_Coolant = nValue.ToString()
- NotifyPropertyChanged("Coolant")
- m_IsModifiedCoolant = False
- EgtTdbGetCurrToolParam(MCH_TP.CORNRAD, dValue)
- m_CornRad = LenToString(dValue, 4)
- NotifyPropertyChanged("CornRad")
- m_IsModifiedCornRad = False
- EgtTdbGetCurrToolParam(MCH_TP.DIAM, dValue)
- m_Diam = LenToString(dValue, 4)
- m_IsModifiedDiam = False
- EgtTdbGetCurrToolParam(MCH_TP.TOTDIAM, dValue)
- m_TotDiam = LenToString(dValue, 4)
- m_IsModifiedTotDiam = False
- ValidateProperty("TotDiam")
- ValidateProperty("Diam")
- EgtTdbGetCurrToolParam(MCH_TP.FEED, dValue)
- m_Feed = LenToString(dValue, 4)
- NotifyPropertyChanged("Feed")
- m_IsModifiedFeed = False
- EgtTdbGetCurrToolParam(MCH_TP.ENDFEED, dValue)
- m_EndFeed = LenToString(dValue, 4)
- NotifyPropertyChanged("EndFeed")
- m_IsModifiedEndFeed = False
- EgtTdbGetCurrToolParam(MCH_TP.STARTFEED, dValue)
- m_StartFeed = LenToString(dValue, 4)
- NotifyPropertyChanged("StartFeed")
- m_IsModifiedStartFeed = False
- EgtTdbGetCurrToolParam(MCH_TP.TIPFEED, dValue)
- m_TipFeed = LenToString(dValue, 4)
- NotifyPropertyChanged("TipFeed")
- m_IsModifiedTipFeed = False
- EgtTdbGetCurrToolParam(MCH_TP.LEN, dValue)
- m_Len = LenToString(dValue, 4)
- m_IsModifiedLen = False
- EgtTdbGetCurrToolParam(MCH_TP.TOTLEN, dValue)
- m_TotLen = LenToString(dValue, 4)
- m_IsModifiedTotLen = False
- EgtTdbGetCurrToolParam(MCH_TP.MAXMAT, dValue)
- m_MaxMat = LenToString(dValue, 4)
- m_IsModifiedMaxMat = False
- ValidateProperty("TotLen")
- ValidateProperty("Len")
- ValidateProperty("MaxMat")
- EgtTdbGetCurrToolParam(MCH_TP.LONOFFSET, dValue)
- m_LonOffset = LenToString(dValue, 4)
- NotifyPropertyChanged("LonOffset")
- m_IsModifiedLonOffset = False
- EgtTdbGetCurrToolParam(MCH_TP.RADOFFSET, dValue)
- m_RadOffset = LenToString(dValue, 4)
- NotifyPropertyChanged("RadOffset")
- m_IsModifiedRadOffset = False
- EgtTdbGetCurrToolParam(MCH_TP.SPEED, dValue)
- m_Speed = DoubleToString(dValue, 4)
- m_IsModifiedSpeed = False
- EgtTdbGetCurrToolParam(MCH_TP.MAXSPEED, dValue)
- m_MaxSpeed = DoubleToString(dValue, 4)
- m_IsModifiedMaxSpeed = False
- ValidateProperty("Speed")
- NotifyPropertyChanged("MaxSpeed")
- EgtTdbGetCurrToolParam(MCH_TP.SIDEANG, dValue)
- m_SideAng = DoubleToString(dValue, 4)
- NotifyPropertyChanged("SideAng")
- m_IsModifiedSideAng = False
- EgtTdbGetCurrToolParam(MCH_TP.THICK, dValue)
- m_Thick = LenToString(dValue, 4)
- m_IsModifiedThick = False
- ValidateProperty("Thick")
- EgtTdbGetCurrToolParam(MCH_TP.MAXABSORPTION, dValue)
- m_MaxAbsorption = DoubleToString(dValue, 4)
- NotifyPropertyChanged("MaxAbsorption")
- m_IsModifiedMaxAbsorption = False
- EgtTdbGetCurrToolParam(MCH_TP.MINFEED, dValue)
- m_MinFeed = LenToString(dValue, 4)
- NotifyPropertyChanged("MinFeed")
- m_IsModifiedMinFeed = False
- EgtTdbGetCurrToolParam(MCH_TP.DRAW, sValue)
- m_Draw = sValue
- m_IsModifiedDraw = False
- ValidateProperty("Draw")
- ' leggo l'uscita prima della testa (senza validarla)
- EgtTdbGetCurrToolParam(MCH_TP.EXIT_, nValue)
- m_SelectedExit = nValue.ToString()
- m_IsModifiedSelectedExit = False
- ' leggo la testa e valido l'uscita
- EgtTdbGetCurrToolParam(MCH_TP.HEAD, sValue)
- For HeadIndex = 0 To m_HeadList.Count - 1
- If sValue = m_HeadList(HeadIndex).HName Then
- SelectedHead = m_HeadList(HeadIndex)
- Exit For
- End If
- Next
- ValidateProperty("SelectedHead")
- ValidateProperty("SelectedExit")
- EgtTdbGetCurrToolParam(MCH_TP.USERNOTES, sValue)
- m_UserNotes = sValue
- NotifyPropertyChanged("UserNotes")
- m_IsModifiedUserNotes = False
- EgtTdbGetCurrToolParam(MCH_TP.TCPOS, sValue)
- If m_TcPosList.Contains(sValue) Then
- m_SelectedTcPos = sValue
- m_IsModifiedSelectedTcPos = False
- Else
- m_SelectedTcPos = Nothing
- EgtTdbSetCurrToolParam(MCH_TP.TCPOS, String.Empty)
- End If
- NotifyPropertyChanged("SelectedTcPos")
- EgtTdbGetCurrToolParam(MCH_TP.UUID, sValue)
- m_Uuid = sValue
- ' Ora che tutti i parametri sono aggiornati, aggiorno il disegno
- m_SuspendToolDrawUpdate = False
- UpdateSceneToolDraw()
- End Sub
-
- Friend Sub ReadToolName()
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.NAME, NamePar)
- End Sub
-
- Friend Sub WriteToolParam()
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- Dim nValue As Integer = 0
- Dim dValue As Double = 0
- Int32.TryParse(Corr, nValue)
- EgtTdbSetCurrToolParam(MCH_TP.CORR, nValue)
- Int32.TryParse(SelectedExit, nValue)
- EgtTdbSetCurrToolParam(MCH_TP.EXIT_, nValue)
- EgtTdbSetCurrToolParam(MCH_TP.TYPE, Type)
- Int32.TryParse(Coolant, nValue)
- EgtTdbSetCurrToolParam(MCH_TP.COOLANT, nValue)
- StringToLen(CornRad, dValue)
- EgtTdbSetCurrToolParam(MCH_TP.CORNRAD, dValue)
- StringToLen(Diam, dValue)
- EgtTdbSetCurrToolParam(MCH_TP.DIAM, dValue)
- StringToLen(TotDiam, dValue)
- EgtTdbSetCurrToolParam(MCH_TP.TOTDIAM, dValue)
- StringToLen(Feed, dValue)
- EgtTdbSetCurrToolParam(MCH_TP.FEED, dValue)
- StringToLen(EndFeed, dValue)
- EgtTdbSetCurrToolParam(MCH_TP.ENDFEED, dValue)
- StringToLen(StartFeed, dValue)
- EgtTdbSetCurrToolParam(MCH_TP.STARTFEED, dValue)
- StringToLen(TipFeed, dValue)
- EgtTdbSetCurrToolParam(MCH_TP.TIPFEED, dValue)
- StringToLen(Len, dValue)
- EgtTdbSetCurrToolParam(MCH_TP.LEN, dValue)
- StringToLen(TotLen, dValue)
- EgtTdbSetCurrToolParam(MCH_TP.TOTLEN, dValue)
- StringToLen(MaxMat, dValue)
- EgtTdbSetCurrToolParam(MCH_TP.MAXMAT, dValue)
- StringToLen(LonOffset, dValue)
- EgtTdbSetCurrToolParam(MCH_TP.LONOFFSET, dValue)
- StringToLen(RadOffset, dValue)
- EgtTdbSetCurrToolParam(MCH_TP.RADOFFSET, dValue)
- StringToDouble(Speed, dValue)
- EgtTdbSetCurrToolParam(MCH_TP.SPEED, dValue)
- StringToDouble(SideAng, dValue)
- EgtTdbSetCurrToolParam(MCH_TP.SIDEANG, dValue)
- StringToDouble(MaxSpeed, dValue)
- EgtTdbSetCurrToolParam(MCH_TP.MAXSPEED, dValue)
- StringToLen(Thick, dValue)
- EgtTdbSetCurrToolParam(MCH_TP.THICK, dValue)
- StringToDouble(MaxAbsorption, dValue)
- EgtTdbSetCurrToolParam(MCH_TP.MAXABSORPTION, dValue)
- StringToLen(MinFeed, dValue)
- EgtTdbSetCurrToolParam(MCH_TP.MINFEED, dValue)
- EgtTdbSetCurrToolParam(MCH_TP.DRAW, Draw)
- EgtTdbSetCurrToolParam(MCH_TP.HEAD, SelectedHead.HName)
- EgtTdbSetCurrToolParam(MCH_TP.USERNOTES, UserNotes)
- If String.IsNullOrEmpty(SelectedTcPos) Then m_SelectedTcPos = String.Empty
- EgtTdbSetCurrToolParam(MCH_TP.TCPOS, m_SelectedTcPos)
- End Sub
-
- Public Sub WriteToolName()
- EgtTdbSetCurrToolParam(MCH_TP.NAME, NamePar)
- End Sub
-
- ' funzione che verifica se c'è attivo un utensile sulla stessa posizione
- Private Function VerifyAllPositions() As Boolean
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- ' carico posizione, testa e uscita dell'utensile che si attiva
- EgtTdbSetCurrTool(Me.Name)
- Dim sCheckedTcPos As String = String.Empty
- EgtTdbGetCurrToolParam(MCH_TP.TCPOS, sCheckedTcPos)
- Dim sCheckedHead As String = String.Empty
- EgtTdbGetCurrToolParam(MCH_TP.HEAD, sCheckedHead)
- Dim nCheckedExit As Integer = 0
- EgtTdbGetCurrToolParam(MCH_TP.EXIT_, nCheckedExit)
- ' verifico su tutti gli utensili disponibili
- Dim ActiveToolsFamilies() As ToolsFamily = MachineModel.ReadActiveToolsFamilies()
- For Each ToolsFamily In ActiveToolsFamilies
- Dim nType As Integer = 0
- Dim ToolName As String = String.Empty
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- If EgtTdbGetFirstTool(ToolsFamily.FamilyId, ToolName, nType) Then
- If ToolName <> Me.Name Then
- EgtTdbSetCurrTool(ToolName)
- If Not VerifyPosition(sCheckedTcPos, sCheckedHead, nCheckedExit) Then Return False
- End If
- While EgtTdbGetNextTool(ToolsFamily.FamilyId, ToolName, nType)
- If ToolName <> Me.Name Then
- EgtTdbSetCurrTool(ToolName)
- If Not VerifyPosition(sCheckedTcPos, sCheckedHead, nCheckedExit) Then Return False
- End If
- End While
- End If
- Next
- Return True
- End Function
-
- Private Function VerifyPosition(sCheckedTcPos As String, sCheckedHead As String, nCheckedExit As Integer) As Boolean
- ' verifico se attivo
- Dim DbActive As Boolean = False
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- If Not EgtTdbGetCurrToolParam(MCH_TP.ACTIVE, DbActive) Then DbActive = False
- ' se non è attivo non lo considero e restituisco vero
- If Not DbActive Then Return True
- ' recupero posizione
- Dim DbTcPos As String = String.Empty
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.TCPOS, DbTcPos)
- ' se la posizione è uguale controllo la testa
- If sCheckedTcPos = DbTcPos Then
- Dim DbHead As String = String.Empty
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.HEAD, DbHead)
- ' se la testa è uguale, controllo l'uscita
- If sCheckedHead = DbHead Then
- Dim DbExit As Integer = 0
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.EXIT_, DbExit)
- ' se l'uscita è uguale la posizione è già occupata
- If nCheckedExit = DbExit Then Return False
- Else
- ' se la testa è diversa vuol dire che la posizione è già occupata
- Return False
- End If
- End If
- Return True
- End Function
-
-#End Region ' Methods
-
-#Region "ToolSceneUpdate"
-
- ' Variabili che segnalano errori nel disegno dell'utensile
- Dim m_nDrawingError As Integer = 0
-
- Private Sub UpdateSceneToolDraw()
- ' Azzero errori
- m_nDrawingError = 0
- ' Se nome disegno vuoto, assegno quello dell'automatico
- If String.IsNullOrEmpty(m_Draw) Then m_Draw = m_Uuid & ".nge"
- ' Creo il disegno dell'utensile
- CreateToolDraw()
- EgtSetCurrentContext(IniFile.m_ToolsDbSceneContext)
- If m_nDrawingError <> 0 Then
- If IsUUID(Path.GetFileNameWithoutExtension(m_Draw)) Then
- EgtNewFile()
- End If
- End If
- EgtSetView(VT.TOP, False)
- EgtZoom(ZM.ALL)
- NotifyPropertyChanged("Draw")
- If Not GetValidationError("Draw") Then
- m_delErrorOnTool(True)
- m_delIsEnabledBtns(False, False, True)
- Else
- m_delErrorOnTool(Not IsValid)
- m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
- End If
- End Sub
-
- Private Function CreateToolDraw() As Boolean
- ' Calcolo parametri per disegno
- Dim sHeadName As String = If(Not IsNothing(SelectedHead), SelectedHead.HName, "")
- Dim nExit As Integer = 0 : If Not IsNothing(SelectedExit) Then StringToInt(SelectedExit, nExit)
- Dim nType As Integer = Type
- Dim dTotLen As Double = 0 : StringToLen(TotLen, dTotLen)
- Dim dLen As Double = 0 : StringToLen(Len, dLen)
- Dim dTotDiam As Double = 0 : StringToLen(TotDiam, dTotDiam)
- Dim dDiam As Double = 0 : StringToLen(Diam, dDiam)
- Dim dThick As Double = 0 : StringToLen(Thick, dThick)
- Dim dMaxMat As Double = 0 : StringToLen(MaxMat, dMaxMat)
- Dim dSideAng As Double = 0 : StringToDouble(SideAng, dSideAng)
- Dim dCornRad As Double = 0 : StringToLen(CornRad, dCornRad)
- Dim sDraw As String = Draw
-
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- ' Salvo parametri originali dell'utensile corrente
- Dim sHeadNameOri As String = "" : EgtTdbGetCurrToolParam(MCH_TP.HEAD, sHeadNameOri)
- Dim nExitOri As Integer = 0 : EgtTdbGetCurrToolParam(MCH_TP.EXIT_, nExitOri)
- Dim nTypeOri As Integer = 0 : EgtTdbGetCurrToolParam(MCH_TP.TYPE, nTypeOri)
- Dim dTotLenOri As Double = 0 : EgtTdbGetCurrToolParam(MCH_TP.TOTLEN, dTotLenOri)
- Dim dLenOri As Double = 0 : EgtTdbGetCurrToolParam(MCH_TP.LEN, dLenOri)
- Dim dTotDiamOri As Double = 0 : EgtTdbGetCurrToolParam(MCH_TP.TOTDIAM, dTotDiamOri)
- Dim dDiamOri As Double = 0 : EgtTdbGetCurrToolParam(MCH_TP.DIAM, dDiamOri)
- Dim dThickOri As Double = 0 : EgtTdbGetCurrToolParam(MCH_TP.THICK, dThickOri)
- Dim dMaxMatOri As Double = 0 : EgtTdbGetCurrToolParam(MCH_TP.MAXMAT, dMaxMatOri)
- Dim dSideAngOri As Double = 0 : EgtTdbGetCurrToolParam(MCH_TP.SIDEANG, dSideAngOri)
- Dim dCornRadOri As Double = 0 : EgtTdbGetCurrToolParam(MCH_TP.CORNRAD, dCornRadOri)
- Dim sDrawOri As String = "" : EgtTdbGetCurrToolParam(MCH_TP.DRAW, sDrawOri)
- ' Imposto parametri correnti all'utensile corrente
- EgtTdbSetCurrToolParam(MCH_TP.HEAD, sHeadName)
- EgtTdbSetCurrToolParam(MCH_TP.EXIT_, nExit)
- EgtTdbSetCurrToolParam(MCH_TP.TYPE, nType)
- EgtTdbSetCurrToolParam(MCH_TP.TOTLEN, dTotLen)
- EgtTdbSetCurrToolParam(MCH_TP.LEN, dLen)
- EgtTdbSetCurrToolParam(MCH_TP.TOTDIAM, dTotDiam)
- EgtTdbSetCurrToolParam(MCH_TP.DIAM, dDiam)
- EgtTdbSetCurrToolParam(MCH_TP.THICK, dThick)
- EgtTdbSetCurrToolParam(MCH_TP.MAXMAT, dMaxMat)
- EgtTdbSetCurrToolParam(MCH_TP.SIDEANG, dSideAng)
- EgtTdbSetCurrToolParam(MCH_TP.CORNRAD, dCornRad)
- EgtTdbSetCurrToolParam(MCH_TP.DRAW, sDraw)
-
- ' Creo il disegno
- m_nDrawingError = EgtTdbCurrToolDraw(IniFile.m_ProjectSceneContext, IniFile.m_ToolsDbSceneContext)
-
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- ' Ripristino i valori originali dell'utensile corrente
- EgtTdbSetCurrToolParam(MCH_TP.HEAD, sHeadNameOri)
- EgtTdbSetCurrToolParam(MCH_TP.EXIT_, nExitOri)
- EgtTdbSetCurrToolParam(MCH_TP.TYPE, nTypeOri)
- EgtTdbSetCurrToolParam(MCH_TP.TOTLEN, dTotLenOri)
- EgtTdbSetCurrToolParam(MCH_TP.LEN, dLenOri)
- EgtTdbSetCurrToolParam(MCH_TP.TOTDIAM, dTotDiamOri)
- EgtTdbSetCurrToolParam(MCH_TP.DIAM, dDiamOri)
- EgtTdbSetCurrToolParam(MCH_TP.THICK, dThickOri)
- EgtTdbSetCurrToolParam(MCH_TP.MAXMAT, dMaxMatOri)
- EgtTdbSetCurrToolParam(MCH_TP.SIDEANG, dSideAngOri)
- EgtTdbSetCurrToolParam(MCH_TP.CORNRAD, dCornRadOri)
- EgtTdbSetCurrToolParam(MCH_TP.DRAW, sDrawOri)
-
- Return (m_nDrawingError = 0)
- End Function
-
-#End Region ' ToolSceneUpdate
-
-#Region "Validation"
-
- Private m_NameError As String
- Public ReadOnly Property NameErrorMsg As String
- Get
- Return m_NameError
- End Get
- End Property
-
- Private m_SpeedError As String
- Public ReadOnly Property SpeedErrorMsg As String
- Get
- Return m_SpeedError
- End Get
- End Property
-
- Private m_TotDiamError As String
- Public ReadOnly Property TotDiamErrorMsg As String
- Get
- Return m_TotDiamError
- End Get
- End Property
-
- Private m_DiamError As String
- Public ReadOnly Property DiamErrorMsg As String
- Get
- Return m_DiamError
- End Get
- End Property
-
- Private m_CornRadError As String
- Public ReadOnly Property CornRadErrorMsg As String
- Get
- Return m_CornRadError
- End Get
- End Property
-
- Private m_TotLenError As String
- Public ReadOnly Property TotLenErrorMsg As String
- Get
- Return m_TotLenError
- End Get
- End Property
-
- Private m_LenError As String
- Public ReadOnly Property LenErrorMsg As String
- Get
- Return m_LenError
- End Get
- End Property
-
- Private m_MaxMatError As String
- Public ReadOnly Property MaxMatErrorMsg As String
- Get
- Return m_MaxMatError
- End Get
- End Property
-
- Private m_ThickError As String
- Public ReadOnly Property ThickErrorMsg As String
- Get
- Return m_ThickError
- End Get
- End Property
-
- Private m_DrawError As String
- Public ReadOnly Property DrawErrorMsg As String
- Get
- Return m_DrawError
- End Get
- End Property
-
- Private m_SelectedHeadError As String
- Public ReadOnly Property SelectedHeadErrorMsg As String
- Get
- Return m_SelectedHeadError
- End Get
- End Property
-
- Private m_SelectedExitError As String
- Public ReadOnly Property SelectedExitErrorMsg As String
- Get
- Return m_SelectedExitError
- End Get
- End Property
-
- ' Funzione che verifica se una proprietà è valida e attiva/disattiva di conseguenza lista e bottoni
- Private Sub ValidateProperty(propertyName As String)
- If Not GetValidationError(propertyName) Then
- m_delErrorOnTool(True)
- m_delIsEnabledBtns(False, False, True)
- Else
- m_delErrorOnTool(Not IsValid)
- m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
- End If
- NotifyPropertyChanged(propertyName)
- End Sub
-
- Private Function GetValidationError(propertyName As String) As Boolean
- Dim bOk As Boolean = True
- Select Case propertyName
- Case "NamePar"
- bOk = Me.ValidateName()
- Case "Speed"
- bOk = Me.ValidateSpeed()
- Case "TotDiam"
- bOk = Me.ValidateTotDiam()
- Case "CornRad"
- bOk = Me.ValidateCornRad()
- Case "Diam"
- bOk = Me.ValidateDiam()
- Case "TotLen"
- bOk = Me.ValidateTotLen()
- Case "Len"
- bOk = Me.ValidateLen()
- Case "MaxMat"
- bOk = Me.ValidateMaxMat()
- Case "Thick"
- bOk = Me.ValidateThick()
- Case "Draw"
- bOk = Me.ValidateDraw()
- Case "SelectedHead"
- bOk = Me.ValidateSelectedHead()
- Case "SelectedExit"
- bOk = Me.ValidateSelectedExit()
- End Select
- Return bOk
- End Function
-
- Private Function GetErrorString(propertyName As String) As String
- Select Case propertyName
- Case "NamePar"
- Return m_NameError
- Case "Speed"
- Return m_SpeedError
- Case "TotDiam"
- Return m_TotDiamError
- Case "CornRad"
- Return m_CornRadError
- Case "Diam"
- Return m_DiamError
- Case "TotLen"
- Return m_TotLenError
- Case "Len"
- Return m_LenError
- Case "MaxMat"
- Return m_MaxMatError
- Case "Thick"
- Return m_ThickError
- Case "Draw"
- Return m_DrawError
- Case "SelectedHead"
- Return m_SelectedHeadError
- Case "SelectedExit"
- Return m_SelectedExitError
- End Select
- Return String.Empty
- End Function
-
- '''
- ''' Returns true if this object has no validation errors.
- '''
- Public ReadOnly Property IsValid() As Boolean
- Get
- For Each [property] As String In ValidatedProperties
- If Not String.IsNullOrEmpty(GetErrorString([property])) Then
- Return False
- End If
- Next [property]
- Return True
- End Get
- End Property
-
- Public ReadOnly Property IsModified() As Boolean
- Get
- Return m_IsModifiedCorr OrElse m_IsModifiedSelectedExit OrElse m_IsModifiedCornRad OrElse
- m_IsModifiedDiam OrElse m_IsModifiedTotDiam OrElse m_IsModifiedFeed OrElse
- m_IsModifiedEndFeed OrElse m_IsModifiedStartFeed OrElse m_IsModifiedTipFeed OrElse
- m_IsModifiedLen OrElse m_IsModifiedTotLen OrElse m_IsModifiedMaxMat OrElse
- m_IsModifiedLonOffset OrElse m_IsModifiedRadOffset OrElse m_IsModifiedSpeed OrElse
- m_IsModifiedSideAng OrElse m_IsModifiedMaxSpeed OrElse m_IsModifiedThick OrElse
- m_IsModifiedMaxAbsorption OrElse m_IsModifiedMinFeed OrElse m_IsModifiedDraw OrElse
- m_IsModifiedSelectedHead OrElse m_IsModifiedName OrElse m_IsModifiedUserNotes OrElse
- m_IsModifiedSelectedTcPos
- End Get
- End Property
-
- Public Sub IsModifiedReset()
- m_IsModifiedCorr = False
- m_IsModifiedSelectedExit = False
- m_IsModifiedCornRad = False
- m_IsModifiedDiam = False
- m_IsModifiedTotDiam = False
- m_IsModifiedFeed = False
- m_IsModifiedEndFeed = False
- m_IsModifiedStartFeed = False
- m_IsModifiedTipFeed = False
- m_IsModifiedLen = False
- m_IsModifiedTotLen = False
- m_IsModifiedMaxMat = False
- m_IsModifiedLonOffset = False
- m_IsModifiedRadOffset = False
- m_IsModifiedSpeed = False
- m_IsModifiedSideAng = False
- m_IsModifiedMaxSpeed = False
- m_IsModifiedThick = False
- m_IsModifiedMaxAbsorption = False
- m_IsModifiedMinFeed = False
- m_IsModifiedDraw = False
- m_IsModifiedSelectedHead = False
- m_IsModifiedName = False
- m_IsModifiedUserNotes = False
- m_IsModifiedSelectedTcPos = False
- End Sub
-
- Private Shared ReadOnly ValidatedProperties() As String = {"Draw", "TotDiam", "CornRad", "Diam", "TotLen", "Len", "MaxMat", "Thick", "Speed", "NamePar", "SelectedHead", "SelectedExit"}
-
- Private Function ValidateName() As Boolean
- m_NameError = String.Empty
- Select Case nErrorToolName
- Case 1
- m_NameError = EgtMsg(MSG_MACHININGSERRORS + 2)
- Case 2
- m_NameError = EgtMsg(MSG_MACHININGSERRORS + 3)
- End Select
- NotifyPropertyChanged("NameErrorMsg")
- If String.IsNullOrEmpty(m_NameError) Then
- Return True
- Else
- Return False
- End If
- End Function
-
- Private Function ValidateSpeed() As Boolean
- m_SpeedError = String.Empty
- If Not IsNothing(m_Speed) And Not IsNothing(m_MaxSpeed) Then
- Dim dSpeed As Double = 0
- StringToDouble(m_Speed, dSpeed)
- Dim dMaxSpeed As Double = 0
- StringToDouble(m_MaxSpeed, dMaxSpeed)
- If Math.Abs(dSpeed) > dMaxSpeed + EPS_ZERO Then
- m_SpeedError = EgtMsg(MSG_TOOLSERRORS + 11)
- End If
- End If
- NotifyPropertyChanged("SpeedErrorMsg")
- If String.IsNullOrEmpty(m_SpeedError) Then
- Return True
- Else
- Return False
- End If
- End Function
-
- Private Function ValidateTotDiam() As Boolean
- m_TotDiamError = String.Empty
- If Not IsNothing(m_TotDiam) Then
- Dim dTotDiam As Double = 0
- StringToLen(m_TotDiam, dTotDiam)
- If dTotDiam < EPS_SMALL Then
- m_TotDiamError = EgtMsg(MSG_TOOLSERRORS + 20)
- End If
- End If
- NotifyPropertyChanged("TotDiamErrorMsg")
- If String.IsNullOrEmpty(m_TotDiamError) Then
- Return True
- Else
- Return False
- End If
- End Function
-
- Private Function ValidateCornRad() As Boolean
- m_CornRadError = String.Empty
- If Not IsNothing(m_CornRad) And Not IsNothing(m_Thick) Then
- Dim dCornRad As Double = 0
- StringToLen(m_CornRad, dCornRad)
- Dim dThick As Double = 0
- StringToLen(m_Thick, dThick)
- If (m_Type = MCH_TY.SAW_FLAT Or m_Type = MCH_TY.SAW_STD) And dCornRad > 0.5 * dThick Then
- m_CornRadError = EgtMsg(MSG_TOOLSERRORS + 42)
- End If
- End If
- NotifyPropertyChanged("CornRadErrorMsg")
- Return String.IsNullOrEmpty(m_CornRadError)
- End Function
-
- Private Function ValidateDiam() As Boolean
- m_DiamError = String.Empty
- If Not IsNothing(m_Diam) Then
- Dim dDiam As Double = 0
- StringToLen(m_Diam, dDiam)
- If dDiam < -EPS_SMALL Then
- m_DiamError = EgtMsg(MSG_TOOLSERRORS + 9)
- End If
- If Not IsNothing(m_TotDiam) Then
- Dim dTotDiam As Double = 0
- StringToLen(m_TotDiam, dTotDiam)
- If dDiam > dTotDiam + EPS_SMALL Then
- m_DiamError = EgtMsg(MSG_TOOLSERRORS + 18)
- End If
- End If
- End If
- NotifyPropertyChanged("DiamErrorMsg")
- If String.IsNullOrEmpty(m_DiamError) Then
- Return True
- Else
- Return False
- End If
- End Function
-
- Private Function ValidateTotLen() As Boolean
- m_TotLenError = String.Empty
- If Not IsNothing(m_TotLen) Then
- Dim dTotLen As Double = 0
- StringToLen(m_TotLen, dTotLen)
- If dTotLen < EPS_SMALL Then
- m_TotLenError = EgtMsg(MSG_TOOLSERRORS + 15)
- End If
- End If
- NotifyPropertyChanged("TotLenErrorMsg")
- If String.IsNullOrEmpty(m_TotLenError) Then
- Return True
- Else
- Return False
- End If
- End Function
-
- Private Function ValidateLen() As Boolean
- m_LenError = String.Empty
- If Not IsNothing(m_Len) Then
- Dim dLen As Double = 0
- StringToLen(m_Len, dLen)
- If dLen < EPS_SMALL Then
- m_LenError = EgtMsg(MSG_TOOLSERRORS + 10)
- End If
- If Not IsNothing(m_TotLen) Then
- Dim dTotLen As Double = 0
- StringToLen(m_TotLen, dTotLen)
- If dLen > dTotLen + EPS_SMALL Then
- m_LenError = EgtMsg(MSG_TOOLSERRORS + 13)
- End If
- End If
- End If
- NotifyPropertyChanged("LenErrorMsg")
- If String.IsNullOrEmpty(m_LenError) Then
- Return True
- Else
- Return False
- End If
- End Function
-
- Private Function ValidateMaxMat() As Boolean
- m_MaxMatError = String.Empty
- If Not IsNothing( m_MaxMat) Then
- Dim dMaxMat As Double = 0
- StringToLen(m_MaxMat, dMaxMat)
- ' Non ammesso valore negativo
- If dMaxMat < EPS_SMALL Then
- m_MaxMatError = EgtMsg(MSG_TOOLSERRORS + 6)
- End If
- ' Per lame
- If ( Type And MCH_TF.SAWBLADE) <> 0 Then
- If Not IsNothing(m_Diam) Then
- Dim dDiam As Double = 0
- StringToLen(m_Diam, dDiam)
- If dMaxMat > ( 0.35 * dDiam) + EPS_SMALL Then
- m_MaxMatError = EgtMsg(MSG_TOOLSERRORS + 17)
- End If
- End If
- ' Per getto d'acqua
- ElseIf ( Type And MCH_TF.WATERJET) <> 0 Then
- ' Non devo fare controlli
- ' Per tutti gli altri
- Else
- If Not IsNothing(m_Len) Then
- Dim dLen As Double = 0
- StringToLen(m_Len, dLen)
- If dMaxMat > dLen + EPS_SMALL Then
- m_MaxMatError = EgtMsg(MSG_TOOLSERRORS + 7)
- End If
- End If
- End If
- End If
- NotifyPropertyChanged( "MaxMatErrorMsg")
- Return String.IsNullOrEmpty( m_MaxMatError)
- End Function
-
- Private Function ValidateThick() As Boolean
- m_ThickError = String.Empty
- If Not IsNothing(m_Thick) Then
- Dim dThick As Double = 0
- StringToLen(m_Thick, dThick)
- If (m_Type = MCH_TY.SAW_FLAT Or m_Type = MCH_TY.SAW_STD Or m_Type = MCH_TY.MORTISE_STD) And dThick < EPS_SMALL Then
- m_ThickError = EgtMsg(MSG_TOOLSERRORS + 8)
- End If
- End If
- NotifyPropertyChanged("ThickErrorMsg")
- If String.IsNullOrEmpty(m_ThickError) Then
- Return True
- Else
- Return False
- End If
- End Function
-
- Private Function ValidateDraw() As Boolean
- m_DrawError = String.Empty
- If m_nDrawingError = 12 Then
- m_DrawError = EgtMsg(MSG_TOOLSERRORS + 21) ' Lunghezza troppo piccola con il portautensile
- ElseIf m_nDrawingError = 13 Then
- m_DrawError = EgtMsg(MSG_TOOLSERRORS + 31) ' Lo Spessore deve essere differente da 0
- ElseIf m_nDrawingError = 14 Then
- m_DrawError = EgtMsg(MSG_TOOLSERRORS + 32) ' L'Angolo di Lato deve essere minore di 90°
- ElseIf m_nDrawingError = 15 Then
- m_DrawError = EgtMsg(MSG_TOOLSERRORS + 33) ' L'Angolo di Lato deve essere maggiore di -90°
- ElseIf m_nDrawingError = 16 Then
- m_DrawError = EgtMsg(MSG_TOOLSERRORS + 35) ' Raggio Corner ha un valore troppo grande
- ElseIf m_nDrawingError = 17 Then
- m_DrawError = EgtMsg(MSG_TOOLSERRORS + 36) ' Lo Spessore ha un valore troppo piccolo rispetto al Raggio Corne
- ElseIf m_nDrawingError = 18 Then
- m_DrawError = EgtMsg(MSG_TOOLSERRORS + 37) ' Il diametro risultante supera il Diametro Totale
- ElseIf m_nDrawingError = 19 Then
- m_DrawError = EgtMsg(MSG_TOOLSERRORS + 38) ' Il diametro risultante è minore di 0
- ElseIf m_nDrawingError = 20 Then
- m_DrawError = EgtMsg(MSG_TOOLSERRORS + 39) ' Il diametro stelo risultante è minore o uguale a 0
- ElseIf m_nDrawingError = 21 Then
- m_DrawError = EgtMsg(MSG_TOOLSERRORS + 40) ' Il Massimo Materiale deve essere più grande del Raggio Corner
- ElseIf m_nDrawingError = 22 Then
- m_DrawError = EgtMsg(MSG_TOOLSERRORS + 34) ' La Lunghezza Totale deve essere maggiore di Lunghezza + Spessore
- ElseIf m_nDrawingError = 997 Then
- m_DrawError = EgtMsg(MSG_TOOLSERRORS + 3) ' Il file non esiste o non è Nge
- ElseIf m_nDrawingError = 998 Then
- m_DrawError = EgtMsg(MSG_TOOLSERRORS + 4) ' Non esiste il ToolMaker per questo tipo di utensile
- ElseIf m_nDrawingError <> 0 Then
- m_DrawError = EgtMsg(MSG_TOOLSERRORS + 5) ' Impossibile creare l'utensile con questi parametri
- End If
- NotifyPropertyChanged("DrawErrorMsg")
- Return String.IsNullOrEmpty(m_DrawError)
- End Function
-
- Private Function ValidateSelectedHead() As Boolean
- m_SelectedHeadError = String.Empty
- If IsNothing(m_SelectedHead) Then
- m_SelectedHeadError = EgtMsg(MSG_TOOLSERRORS + 27)
- Else
- If Not IsNothing(m_HeadList) Then
- If Not m_HeadList.Contains(m_SelectedHead) Then
- m_SelectedHeadError = EgtMsg(MSG_TOOLSERRORS + 27)
- End If
- End If
- End If
- NotifyPropertyChanged("SelectedHeadErrorMsg")
- If String.IsNullOrEmpty(m_SelectedHeadError) Then
- Return True
- Else
- Return False
- End If
- End Function
-
- Private Function ValidateSelectedExit() As Boolean
- m_SelectedExitError = String.Empty
- If IsNothing(m_SelectedExit) Then
- m_SelectedExitError = EgtMsg(MSG_TOOLSERRORS + 28)
- Else
- If Not IsNothing(m_ExitList) Then
- If Not m_ExitList.Contains(m_SelectedExit) Then
- m_SelectedExitError = EgtMsg(MSG_TOOLSERRORS + 28)
- End If
- End If
- End If
- NotifyPropertyChanged("SelectedExitErrorMsg")
- If String.IsNullOrEmpty(m_SelectedExitError) Then
- Return True
- Else
- Return False
- End If
- End Function
-
-#End Region ' Validation
-
-#Region "COMMANDS"
-
-#Region "OpenDrawFileCommand"
-
- '''
- ''' Returns a command that create a new tool.
- '''
- Public ReadOnly Property OpenDrawFileCommand As ICommand
- Get
- If m_cmdOpenDrawFile Is Nothing Then
- m_cmdOpenDrawFile = New Command(AddressOf OpenDrawFile)
- End If
- Return m_cmdOpenDrawFile
- End Get
- End Property
-
- '''
- ''' Creata the new tool. This method is invoked by the NewCommand.
- '''
- Public Sub OpenDrawFile(ByVal param As Object)
- Dim OpenFileDialog As New EgtWPFLib5.EgtOpenFileDialog
- OpenFileDialog.Title = "Open draw file"
- OpenFileDialog.Filter = "*.nge"
- OpenFileDialog.FileNameFilter = AddressOf FilterFileName
- OpenFileDialog.Directory = IniFile.m_sCurrMachToolsDirPath
- OpenFileDialog.FileName = m_Draw
- If OpenFileDialog.EgtShowDialog <> True Then
- Return
- End If
- Draw = Path.GetFileName(OpenFileDialog.FileName)
- UpdateSceneToolDraw()
- End Sub
-
- Private Function FilterFileName(sPath As String) As Boolean
- Dim FileName As String = Path.GetFileNameWithoutExtension(sPath)
- If Not IsUUID(FileName) Then
- Return True
- End If
- Return False
- End Function
-
-#End Region ' OpenDrawFileCommand
-
-#Region "AutoDrawCommand"
-
- '''
- ''' Returns a command that create a new tool.
- '''
- Public ReadOnly Property AutoDrawCommand As ICommand
- Get
- If m_cmdAutoDraw Is Nothing Then
- m_cmdAutoDraw = New Command(AddressOf AutoDraw)
- End If
- Return m_cmdAutoDraw
- End Get
- End Property
-
- '''
- ''' Creata the new tool. This method is invoked by the NewCommand.
- '''
- Public Sub AutoDraw(ByVal param As Object)
- Draw = m_Uuid & ".nge"
- UpdateSceneToolDraw()
- End Sub
-
-#End Region ' AutoDrawCommand
-
-#End Region ' Commands
-
-End Class
-
-Public Class HeadItem
-
- Private m_HName As String
- Public ReadOnly Property HName As String
- Get
- Return m_HName
- End Get
- End Property
-
- Private m_HText As String
- Public ReadOnly Property HText As String
- Get
- Return m_HText
- End Get
- End Property
-
- Sub New(sHName As String, sHText As String)
- m_HName = sHName
- m_HText = sHText
- End Sub
-
-End Class
-
-'''
-''' Class that represent a Converter that use tool type and param type, to set the visibility state of the param type.
-'''
-Public Class ToolParamVisibilityConverter
- Implements IValueConverter
-
- Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
- Select Case CInt(value)
- Case MCH_TY.NONE
- Return Visibility.Hidden
- Case MCH_TY.DRILL_STD
- Return TMDbParamVisibility.Drill_Std(CInt(parameter))
- Case MCH_TY.DRILL_LONG
- Return TMDbParamVisibility.Drill_Long(CInt(parameter))
- Case MCH_TY.SAW_STD
- Return TMDbParamVisibility.Saw_Std(CInt(parameter))
- Case MCH_TY.SAW_FLAT
- Return TMDbParamVisibility.Saw_Flat(CInt(parameter))
- Case MCH_TY.MILL_STD
- Return TMDbParamVisibility.Mill_Std(CInt(parameter))
- Case MCH_TY.MILL_NOTIP
- Return TMDbParamVisibility.Mill_NoTip(CInt(parameter))
- Case MCH_TY.MORTISE_STD
- Return TMDbParamVisibility.Mortise_Std(CInt(parameter))
- Case MCH_TY.CHISEL_STD
- Return TMDbParamVisibility.Chisel_Std(CInt(parameter))
- Case MCH_TY.COMPO
- Return TMDbParamVisibility.Compo(CInt(parameter))
- Case MCH_TY.WATERJET
- Return TMDbParamVisibility.WaterJet(CInt(parameter))
- Case Else
- Return Visibility.Hidden
- End Select
- End Function
-
- Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
- Throw New NotImplementedException
- End Function
-
-End Class
-
-'''
-''' Class that represent a Converter that convert UUID to ***** in Draw param
-'''
-Public Class ToolDrawUUIDConverter
- Implements IValueConverter
-
- Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
- If Not IsNothing(value) Then
- If IsUUID(Path.GetFileNameWithoutExtension(value.ToString)) Then
- Return ToolDrawUUIDName
- Else
- Return value.ToString
- End If
- Else
- Return Nothing
- End If
- End Function
-
- Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
- Return value.ToString
- End Function
-End Class
-
-'''
-''' Class that represent a Converter that use the selected item of ToolsTreeView, to set the visibility state of the error message.
-'''
-Public Class ErrorVisibilityConverter
- Implements IValueConverter
-
- Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
- If String.IsNullOrEmpty(CStr(value)) Then
- Return Visibility.Collapsed
- Else
- Return Visibility.Visible
- End If
- End Function
-
- Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
- Throw New NotImplementedException
- End Function
-
-End Class
diff --git a/ToolsDbWindow/ToolsDbV.xaml b/ToolsDbWindow/ToolsDbV.xaml
deleted file mode 100644
index 6b0a10a..0000000
--- a/ToolsDbWindow/ToolsDbV.xaml
+++ /dev/null
@@ -1,924 +0,0 @@
-
-
-
-
-
-
-
-
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ToolsDbWindow/ToolsDbV.xaml.vb b/ToolsDbWindow/ToolsDbV.xaml.vb
deleted file mode 100644
index 179981d..0000000
--- a/ToolsDbWindow/ToolsDbV.xaml.vb
+++ /dev/null
@@ -1,12 +0,0 @@
-Imports EgtUILib
-
-Public Class ToolsDbV
-
- Private Sub ToolsDbView_Closed(sender As Object, e As System.EventArgs) Handles Me.Closed
- ' Imposto contesto generale
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- ' Cancello contesto di visualizzazione utensile
- EgtDeleteContext(IniFile.m_ToolsDbSceneContext)
- IniFile.m_ToolsDbSceneContext = 0
- End Sub
-End Class
diff --git a/ToolsDbWindow/ToolsDbVM.vb b/ToolsDbWindow/ToolsDbVM.vb
deleted file mode 100644
index 8a0257d..0000000
--- a/ToolsDbWindow/ToolsDbVM.vb
+++ /dev/null
@@ -1,746 +0,0 @@
-Imports System.Windows.Forms.Integration
-Imports System.Collections.ObjectModel
-Imports System.Reflection
-Imports System.IO
-Imports EgtUILib
-Imports EgtWPFLib5
-
-Public Class ToolsDbVM
- Inherits TabViewModel
-
- Private Const SETUP_FILEEXTENSION As String = ".stu"
-
- Friend Shared m_bActive As Boolean = False
-
- Private m_Title As String
- Public ReadOnly Property Title As String
- Get
- Return EgtMsg(MSG_MAINWINDOW + 3)
- End Get
- End Property
-
- ' Lista degli utensili
- Private m_ToolsList As New ObservableCollection(Of FamilyToolTreeViewItem)
- Public Property ToolsList As ObservableCollection(Of FamilyToolTreeViewItem)
- Get
- Return m_ToolsList
- End Get
- Set(value As ObservableCollection(Of FamilyToolTreeViewItem))
- m_ToolsList = value
- End Set
- End Property
-
- Private m_IsEnabledNewBtn As Boolean
- Public ReadOnly Property IsEnabledNewBtn As Boolean
- Get
- Return m_IsEnabledNewBtn
- End Get
- End Property
-
- Private m_IsEnabledSaveBtn As Boolean
- Public ReadOnly Property IsEnabledSaveBtn As Boolean
- Get
- Return m_IsEnabledSaveBtn
- End Get
- End Property
-
- Private m_IsEnabledRemoveBtn As Boolean
- Public ReadOnly Property IsEnabledRemoveBtn As Boolean
- Get
- Return m_IsEnabledRemoveBtn
- End Get
- End Property
-
- 'PROJECT PAGE'S SCENE FIELDS AND PROPERTIES
- ' Reference to the ProjectScene
- Private WithEvents m_ToolScene As New Scene
- ' Reference to the ProjectSceneHost
- Private SceneHost As WindowsFormsHost
- ' Property used to bind the scene to the WindowsFormsHost in XAML
- Private m_bfirst As Boolean = True
- Public ReadOnly Property ToolSceneHost As WindowsFormsHost
- Get
- If m_bfirst Then
- SceneHost = New WindowsFormsHost() With {.Child = m_ToolScene}
- m_ToolScene.SetViewBackground(New Color3d(154, 168, 184), New Color3d(116, 126, 138))
- If Not m_ToolScene.Init() Then
- EgtOutLog("Error in Tool scene creation")
- End If
- IniFile.m_ToolsDbSceneContext = m_ToolScene.GetCtx()
- ' inibisco selezione diretta da Scene
- m_ToolScene.SetStatusNull()
- m_bfirst = False
- End If
- Return SceneHost
- End Get
- End Property
-
- ' visibilità parametro Active
- Private m_Active_Visibility As Boolean
- Public ReadOnly Property Active_Visibility As Visibility
- Get
- Return If(m_Active_Visibility, Visibility.Visible, Visibility.Collapsed)
- End Get
- End Property
-
- Private Sub OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String) Handles m_ToolScene.OnCursorPos
- Application.Msn.NotifyColleagues(Application.NOTIFYCURRPOS, sCursorPos)
- End Sub
-
-
- ' Definizione comandi
- Private m_cmdNew As ICommand
- Private m_cmdSave As ICommand
- Private m_cmdRemove As ICommand
- Private m_cmdReloadTool As ICommand
- Private m_cmdCloseToolsDb As ICommand
-
-#Region "MESSAGES"
-
- 'Definizione dei messaggi della pagina
- Public ReadOnly Property CorrTxBl As String
- Get
- Return EgtMsg(MSG_TOOLSDBPAGE + 51)
- End Get
- End Property
-
- Public ReadOnly Property ExitParTxBl As String
- Get
- Return EgtMsg(MSG_TOOLSDBPAGE + 52)
- End Get
- End Property
-
- Public ReadOnly Property TypeTxBl As String
- Get
- Return EgtMsg(MSG_TOOLSDBPAGE + 53)
- End Get
- End Property
-
- Public ReadOnly Property CoolantTxBl As String
- Get
- Return EgtMsg(MSG_TOOLSDBPAGE + 54)
- End Get
- End Property
-
- Public ReadOnly Property CornRadTxBl As String
- Get
- Return EgtMsg(MSG_TOOLSDBPAGE + 55)
- End Get
- End Property
-
- Public ReadOnly Property DiamTxBl As String
- Get
- Return EgtMsg(MSG_TOOLSDBPAGE + 56)
- End Get
- End Property
-
- Public ReadOnly Property TotDiamTxBl As String
- Get
- Return EgtMsg(MSG_TOOLSDBPAGE + 57)
- End Get
- End Property
-
- Public ReadOnly Property FeedTxBl As String
- Get
- Return EgtMsg(MSG_TOOLSDBPAGE + 58)
- End Get
- End Property
-
- Public ReadOnly Property EndFeedTxBl As String
- Get
- Return EgtMsg(MSG_TOOLSDBPAGE + 59)
- End Get
- End Property
-
- Public ReadOnly Property StartFeedTxBl As String
- Get
- Return EgtMsg(MSG_TOOLSDBPAGE + 60)
- End Get
- End Property
-
- Public ReadOnly Property TipFeedTxBl As String
- Get
- Return EgtMsg(MSG_TOOLSDBPAGE + 61)
- End Get
- End Property
-
- Public ReadOnly Property LenTxBl As String
- Get
- Return EgtMsg(MSG_TOOLSDBPAGE + 62)
- End Get
- End Property
-
- Public ReadOnly Property TotLenTxBl As String
- Get
- Return EgtMsg(MSG_TOOLSDBPAGE + 63)
- End Get
- End Property
-
- Public ReadOnly Property MaxMatTxBl As String
- Get
- Return EgtMsg(MSG_TOOLSDBPAGE + 64)
- End Get
- End Property
-
- Public ReadOnly Property LonOffsetTxBl As String
- Get
- Return EgtMsg(MSG_TOOLSDBPAGE + 65)
- End Get
- End Property
-
- Public ReadOnly Property RadOffsetTxBl As String
- Get
- Return EgtMsg(MSG_TOOLSDBPAGE + 66)
- End Get
- End Property
-
- Public ReadOnly Property SpeedTxBl As String
- Get
- Return EgtMsg(MSG_TOOLSDBPAGE + 67)
- End Get
- End Property
-
- Public ReadOnly Property SideAngTxBl As String
- Get
- Return EgtMsg(MSG_TOOLSDBPAGE + 68)
- End Get
- End Property
-
- Public ReadOnly Property MaxSpeedTxBl As String
- Get
- Return EgtMsg(MSG_TOOLSDBPAGE + 69)
- End Get
- End Property
-
- Public ReadOnly Property ThickTxBl As String
- Get
- Return EgtMsg(MSG_TOOLSDBPAGE + 70)
- End Get
- End Property
-
- Public ReadOnly Property MaxAbsorptionTxBl As String
- Get
- Return EgtMsg(MSG_TOOLSDBPAGE + 71)
- End Get
- End Property
-
- Public ReadOnly Property MinFeedTxBl As String
- Get
- Return EgtMsg(MSG_TOOLSDBPAGE + 72)
- End Get
- End Property
-
- Public ReadOnly Property DrawTxBl As String
- Get
- Return EgtMsg(MSG_TOOLSDBPAGE + 73)
- End Get
- End Property
-
- Public ReadOnly Property HeadTxBl As String
- Get
- Return EgtMsg(MSG_TOOLSDBPAGE + 74)
- End Get
- End Property
-
- Public ReadOnly Property NameParTxBl As String
- Get
- Return EgtMsg(MSG_TOOLSDBPAGE + 75)
- End Get
- End Property
-
- Public ReadOnly Property UserNotesTxBl As String
- Get
- Return EgtMsg(MSG_TOOLSDBPAGE + 76)
- End Get
- End Property
-
- Public ReadOnly Property TcPosTxBl As String
- Get
- Return EgtMsg(MSG_TOOLSDBPAGE + 77)
- End Get
- End Property
-
-#End Region
-
-#Region "CONSTRUCTOR"
-
- Sub New()
-
- m_bActive = True
-
- ' Passo all'item della lista il delegato alla funzuione che permette di cancellare una lavorazione
- ToolTreeViewItem.m_delRemoveTool = AddressOf RemoveTool
- ' Passo all'item della lista il delegato alla funzuione che permette di disattivare la lista delle lavorazioni
- ToolTreeViewItem.m_delErrorOnTool = AddressOf ErrorOnTool
- ' Passo all'item della lista il delegato alla funzuione che permette di disattivare la lista delle lavorazioni
- ToolTreeViewItem.m_delIsEnabledBtns = AddressOf IsEnabledBtns
- FamilyToolTreeViewItem.m_delIsEnabledBtns = AddressOf IsEnabledBtns
- ' Passo all'item della lista il delegato alla funzuione che restituisce l'utensile selezionato
- ToolTreeViewItem.m_delGetSelectedTool = AddressOf GetSelectedTool
-
- LoadSelectedMachineTools()
-
- ' carico lista teste
- ToolTreeViewItem.m_HeadList.Clear()
- Dim sHeads As String = String.Empty
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- If EgtGetAllHeadsNames(sHeads) Then
- Dim sHeadList() As String = sHeads.Split(","c)
- For HeadIndex = 0 To sHeadList.Count - 1
- Dim sHText As String = String.Empty
- EgtUILib.GetPrivateProfileString(S_HEADS, sHeadList(HeadIndex), "", sHText, IniFile.m_sCurrMachIniFilePath)
- Dim sHTextMsg As String = String.Empty
- If IsNumeric(sHText) Then
- sHTextMsg = EgtMsg(CInt(sHText))
- If sHTextMsg = ("Msg" & CInt(sHText)) Then
- sHTextMsg = sHText
- End If
- Else
- sHTextMsg = sHText
- End If
- sHTextMsg &= " (" & sHeadList(HeadIndex) & ")"
- ToolTreeViewItem.m_HeadList.Add(New HeadItem(sHeadList(HeadIndex), sHTextMsg))
- Next
- Else
- MessageBox.Show("Impossible loading Head list from machine!", "Error", MessageBoxButton.OK, MessageBoxImage.Error)
- EgtOutLog("Error: Impossible loading Head list from machine!")
- End If
- ' se carico Lua che contiene le funzioni di attrezzaggio
- ToolTreeViewItem.m_OrigTcPosList.Clear()
- If EgtLuaExecFile(IniFile.m_sCurrMachScriptsDirPath & "\" & SETUP_LUA) Then
- ' creo lista di tutti i TcPos
- Dim nPosIndex As Integer = 1
- Dim sTcPos As String = String.Empty
- Dim nErr As Integer = 0
- While nErr = 0
- EgtLuaSetGlobIntVar("STU.INDEX", nPosIndex)
- If Not EgtLuaCallFunction("STU.GetTcPosFromPos") Then Exit While
- ' Leggo variabili
- EgtLuaGetGlobStringVar("STU.TCPOS", sTcPos)
- If Not EgtLuaGetGlobIntVar("STU.ERR", nErr) Then nErr = 999
- If nErr = 0 Then
- ToolTreeViewItem.m_OrigTcPosList.Add(sTcPos)
- End If
- nPosIndex += 1
- End While
- ' altrimenti
- Else
- MessageBox.Show(EgtMsg(MSG_TOOLSERRORS + 25), EgtMsg(MSG_TOOLSERRORS + 26), MessageBoxButton.OK, MessageBoxImage.Error)
- EgtOutLog("Error: SetUp configuration file not found!")
- End If
-
- ' leggo da ini se parametro Active è attivo
- m_Active_Visibility = (EgtUILib.GetPrivateProfileInt(S_TOOLS, K_ACTIVE, 0, IniFile.m_sCurrMachIniFilePath) <> 0)
- End Sub
-
-#End Region ' Constructor
-
-#Region "METHODS"
-
- Private Sub IsEnabledBtns(bIsEnabledNewBtn As Boolean, bIsEnabledSaveBtn As Boolean, bIsEnabledDeleteBtn As Boolean)
- m_IsEnabledNewBtn = bIsEnabledNewBtn
- m_IsEnabledSaveBtn = bIsEnabledSaveBtn
- m_IsEnabledRemoveBtn = bIsEnabledDeleteBtn
- OnPropertyChanged("IsEnabledNewBtn")
- OnPropertyChanged("IsEnabledSaveBtn")
- OnPropertyChanged("IsEnabledRemoveBtn")
- End Sub
-
- ' Quando chiamato, disattiva tutti gli item dell'albero o li riattiva a seconda che ci sia o meno un errore
- Private Sub ErrorOnTool(bIsEnabled As Boolean)
- For Each FamilyToolItem In ToolsList
- FamilyToolItem.IsEnabled = Not bIsEnabled
- Next
- End Sub
-
- '''
- ''' Method that search tools for the currently selected Machine and add it to the ToolsList.
- '''
- Private Sub LoadSelectedMachineTools()
- Dim ActiveToolsFamilies() As ToolsFamily = MachineModel.ReadActiveToolsFamilies()
- For Each ToolsFamily In ActiveToolsFamilies
- Dim FamilyTreeView As New FamilyToolTreeViewItem(ToolsFamily.FamilyName, ToolsFamily.FamilyId)
- ToolsList.Add(FamilyTreeView)
- Dim nType As Integer = 0
- Dim ToolName As String = String.Empty
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- If EgtTdbGetFirstTool(ToolsFamily.FamilyId, ToolName, nType) Then
- FamilyTreeView.Items.Add(New ToolTreeViewItem(ToolName))
- While EgtTdbGetNextTool(ToolsFamily.FamilyId, ToolName, nType)
- FamilyTreeView.Items.Add(New ToolTreeViewItem(ToolName))
- End While
- End If
- Next
- ' Se esiste almeno una famiglia di utensili, la seleziono
- If ToolsList.Count > 0 Then
- ToolsList(0).IsSelected = True
- ToolsList(0).NotifyPropertyChanged("IsSelected")
- End If
-
- End Sub
-
- Private Function GetSelectedTool() As ToolTreeViewItem
- For Each ToolFamily In m_ToolsList
- For Each Tool In ToolFamily.Items
- If Tool.m_IsSelected Then
- Return DirectCast(Tool, ToolTreeViewItem)
- End If
- Next
- Next
- Return Nothing
- End Function
-
- ' Funzione che aggiorna setup default con tool che hanno parametro Active
- Private Function UpdateDefSetup() As Boolean
- InitSetupFile()
- ' Creo Setup
- Dim DefSetup As New SetUpVM
- ' inizializzo ambiente setup
- DefSetup.InitSetUp()
- ' resetto lista utensili e posizioni
- DefSetup.ToolsList.Clear()
- DefSetup.ClearAllPos()
- DefSetup.LoadMachineTools()
- ' ciclo sugli utensili del db
- For Each ToolFamily In m_ToolsList
- For Each Tool In ToolFamily.Items
- Dim ToolItem As ToolTreeViewItem = DirectCast(Tool, ToolTreeViewItem)
- ' verifico se Active
- If ToolItem.Active Then
- For Each TF In DefSetup.ToolsList
- For TIndex = TF.Items.Count - 1 To 0 Step -1
- Dim T As ToolItem = DirectCast(TF.Items(TIndex), ToolItem)
- If ToolItem.Name = T.Name Then
- DefSetup.ToolDoubleClick(T)
- End If
- Next
- Next
- End If
- Next
- Next
- Dim DefSetupPath As String = IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName & "\SetUp"
- Dim DefSetupName As String = String.Empty
- EgtUILib.GetPrivateProfileString(S_SETUP, K_DEFAULT, "", DefSetupName, IniFile.m_sCurrMachIniFilePath)
- DefSetupPath += "\" & DefSetupName & SETUP_FILEEXTENSION
- If Not DefSetup.Save(DefSetupPath) Then EgtOutLog("Impossible to save default setup.")
- Return True
- End Function
-
- ' Inizializzo file Setup
- Private Sub InitSetupFile()
- ' verifico che il file di configurazione attrezzaggio (lua) della macchina esista
- If Not File.Exists(IniFile.m_sCurrMachScriptsDirPath & "\" & SETUP_LUA) Then
- EgtOutLog("SetUp error: SetUp configuration file doesn't exist ")
- MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 7), EgtMsg(MSG_SETUPERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
- Return
- End If
- ' carico Lua che contiene le funzioni per ottenere le posizioni valide dell'utensile selezionato,
- ' e testa e uscita dell'utensile attrezzato
- EgtLuaExecFile(IniFile.m_sCurrMachScriptsDirPath & "\" & SETUP_LUA)
- ' verifico che le teste riportate in configurazione esistano
- Dim Index As Integer = 1
- Dim nErr As Integer = 0
- While nErr = 0
- Dim sHead As String = String.Empty
- nErr = 999
- EgtLuaSetGlobIntVar("STU.INDEX", Index)
- EgtLuaCallFunction("STU.GetTcPosHeadGroupFromPos")
- ' Leggo variabili
- EgtLuaGetGlobStringVar("STU.HEAD", sHead)
- EgtLuaGetGlobIntVar("STU.ERR", nErr)
- If nErr = 0 Then
- If EgtGetHeadExitCount(sHead) = 0 Then
- MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 8), EgtMsg(MSG_SETUPERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
- Return
- End If
- End If
- Index += 1
- End While
- ' Verifico esistenza direttorio per attrezzaggi
- Dim sDir As String = IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName & "\SetUp"
- If Not Directory.Exists(sDir) Then
- Try
- Directory.CreateDirectory(sDir)
- Catch ex As Exception
- EgtOutLog("Error in SetupDir creation " & ex.ToString())
- Return
- End Try
- End If
-
- End Sub
-
-#End Region ' Methods
-
-#Region "COMMANDS"
-
-#Region "NewCommand"
-
- '''
- ''' Returns a command that create a new tool.
- '''
- Public ReadOnly Property NewCommand As ICommand
- Get
- If m_cmdNew Is Nothing Then
- m_cmdNew = New RelayCommand(AddressOf NewPar)
- End If
- Return m_cmdNew
- End Get
- End Property
-
- '''
- ''' Creata the new tool. This method is invoked by the NewCommand.
- '''
- Public Sub NewPar(ByVal param As Object)
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- ' Verifico se sia selezionata una famiglia
- Dim NewToolItem As ToolTreeViewItem
- If TypeOf param Is FamilyToolTreeViewItem Then
- Dim ToolFamily As FamilyToolTreeViewItem = DirectCast(param, FamilyToolTreeViewItem)
- Dim NewName As String = ToolFamily.Name
- EgtTdbGetToolNewName(NewName)
- If EgtTdbAddTool(NewName, ToolFamily.ToolType) Then
- NewToolItem = New ToolTreeViewItem(NewName)
- ToolFamily.Items.Add(NewToolItem)
- EgtTdbSaveCurrTool()
- NewToolItem.NewTool = True
- If Not ToolFamily.IsExpanded Then ToolFamily.IsExpanded = True
- NewToolItem.IsSelected = True
- NewToolItem.NotifyPropertyChanged("IsSelected")
- End If
- ' Verifico se sia selezionato un utensile
- ElseIf TypeOf param Is ToolTreeViewItem Then
- Dim ToolCopied As ToolTreeViewItem = DirectCast(param, ToolTreeViewItem)
- Dim NewName As String = ToolCopied.Name
- EgtTdbGetToolNewName(NewName)
- If EgtTdbCopyTool(ToolCopied.Name, NewName) Then
- ' Elimino disegno che non deve essere copiato
- EgtTdbSetCurrToolParam(MCH_TP.DRAW, String.Empty)
- Dim CurrType As Integer
- EgtTdbGetCurrToolParam(MCH_TP.TYPE, CurrType)
- For Each ToolFamily In ToolsList
- If (ToolFamily.ToolType And CurrType) <> 0 Then
- NewToolItem = New ToolTreeViewItem(NewName)
- ToolFamily.Items.Add(NewToolItem)
- EgtTdbSaveCurrTool()
- NewToolItem.NewTool = True
- ' Reimposto l'utensile vecchio nel Db per deselezionarlo e fare le verifiche correttamente
- EgtTdbSetCurrTool(ToolCopied.Name)
- ToolCopied.IsSelected = False
- ToolCopied.NotifyPropertyChanged("IsSelected")
- NewToolItem.IsSelected = True
- Exit For
- End If
- Next
- End If
- End If
-
- End Sub
-
-#End Region ' NewCommand
-
-#Region "SaveCommand"
-
- '''
- ''' Returns a command that save the current selected tool.
- '''
- Public ReadOnly Property SaveCommand() As ICommand
- Get
- If m_cmdSave Is Nothing Then
- m_cmdSave = New RelayCommand(AddressOf Save)
- End If
- Return m_cmdSave
- End Get
- End Property
-
- '''
- ''' Saves the current tool. This method is invoked by the SaveCommand.
- '''
- Public Sub Save(ByVal param As Object)
- Dim CurrTool As ToolTreeViewItem = DirectCast(param, ToolTreeViewItem)
- CurrTool.WriteToolParam()
- CurrTool.m_Name = CurrTool.m_Name.Trim()
- CurrTool.WriteToolName()
- EgtTdbSaveCurrTool()
- CurrTool.NewTool = False
- CurrTool.IsModifiedReset()
- IsEnabledBtns(CurrTool.IsValid And Not CurrTool.IsModified, CurrTool.IsValid, True)
- End Sub
-
-#End Region ' SaveCommand
-
-#Region "RemoveCommand"
-
- '''
- ''' Returns a command that remove the current selected tool.
- '''
- Public ReadOnly Property RemoveCommand() As ICommand
- Get
- If m_cmdRemove Is Nothing Then
- m_cmdRemove = New RelayCommand(AddressOf Remove)
- End If
- Return m_cmdRemove
- End Get
- End Property
-
- '''
- ''' Remove the current selected tools from Db and TreeView. This method is invoked by the RemoveCommand.
- '''
- Public Sub Remove(ByVal param As Object)
- Dim ToolToRemove As ToolTreeViewItem = DirectCast(param, ToolTreeViewItem)
- ' Chiedo conferma cancellazione lavorazione
- If MessageBox.Show(EgtMsg(MSG_TOOLSERRORS + 22) & " " & ToolToRemove.Name & EgtMsg(MSG_TOOLSERRORS + 23), EgtMsg(MSG_TOOLSERRORS + 24), MessageBoxButton.YesNo, MessageBoxImage.Question) <> MessageBoxResult.Yes Then
- Return
- End If
- RemoveTool(ToolToRemove)
- End Sub
-
- Private Sub RemoveTool(ToolToRemove As ToolTreeViewItem)
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- ' Cancello disegno dell'utensile
- EraseToolDraw()
- ' Salvo il tipo di utensile per poterlo cancellare
- Dim ToolType As Integer = ToolToRemove.Type
- ' Cancello l'utensile
- Dim CurrToolOriginalName As String = String.Empty
- EgtTdbGetToolFromUUID(ToolToRemove.Uuid, CurrToolOriginalName)
- EgtTdbRemoveTool(CurrToolOriginalName)
- ' Rimuovo il nome dell'albero
- For Each ToolFamily In ToolsList
- If (ToolFamily.ToolType And ToolType) <> 0 Then
- ToolFamily.Items.Remove(ToolToRemove)
- End If
- Next
- ErrorOnTool(False)
- End Sub
-
- Private Function EraseToolDraw() As Boolean
- ' nome e direttorio del file da cancellare
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- Dim sDrawName As String = String.Empty
- EgtTdbGetCurrToolParam(MCH_TP.DRAW, sDrawName)
- Dim sPath As String = String.Empty
- EgtTdbGetToolDir(sPath)
- sPath = sPath & "\" & sDrawName
- ' se automatico ed esiste lo cancello
- Try
- If IsUUID(Path.GetFileNameWithoutExtension(sPath)) And
- My.Computer.FileSystem.FileExists(sPath) Then
- My.Computer.FileSystem.DeleteFile(sPath)
- End If
- Return True
- Catch ex As Exception
- Return False
- End Try
- End Function
-
-
-#End Region ' RemoveCommand
-
-#Region "ReloadToolCommand"
-
- '''
- ''' Returns a command that reload the current selected tool.
- '''
- Public ReadOnly Property ReloadToolCommand() As ICommand
- Get
- If m_cmdReloadTool Is Nothing Then
- m_cmdReloadTool = New RelayCommand(AddressOf ReloadTool)
- End If
- Return m_cmdReloadTool
- End Get
- End Property
-
- '''
- ''' Reload the current selected tools. This method is invoked by the RemoveCommand.
- '''
- Public Sub ReloadTool(ByVal param As Object)
- If TypeOf param Is FamilyToolTreeViewItem Then
- Return
- ' Verifico se sia selezionato un utensile
- ElseIf TypeOf param Is ToolTreeViewItem Then
- Dim ToolToReload As ToolTreeViewItem = DirectCast(param, ToolTreeViewItem)
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- ToolToReload.ReadToolParam()
- ToolToReload.ReadToolName()
- ToolToReload.IsModifiedReset()
- End If
- End Sub
-
-#End Region ' ReloadToolCommand
-
-#Region "CloseToolDbCommand"
-
- '''
- ''' Returns a command that remove the current selected machining.
- '''
- Public ReadOnly Property CloseToolsDbCommand() As ICommand
- Get
- If m_cmdCloseToolsDb Is Nothing Then
- m_cmdCloseToolsDb = New RelayCommand(AddressOf CloseToolsDb)
- End If
- Return m_cmdCloseToolsDb
- End Get
- End Property
-
- '''
- ''' Manage the MachiningDb closing. This method is invoked by the CloseMachiningDbCommand.
- '''
- Public Sub CloseToolsDb(param As Object)
- m_bActive = False
- ' Imposto contesto di progetto
- EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- ' Se selezionata una lavorazione, verifico salvataggio
- If TypeOf param Is ToolTreeViewItem Then
- Dim CurrTool As ToolTreeViewItem = DirectCast(param, ToolTreeViewItem)
- If CurrTool.IsValid Then
- CurrTool.WriteToolParam()
- If EgtTdbIsCurrToolModified() Or CurrTool.m_IsModifiedName Or CurrTool.NewTool Then
- Select Case MsgBox(EgtMsg(MSG_TOOLSERRORS), MsgBoxStyle.YesNo, EgtMsg(MSG_TOOLSERRORS + 1))
- Case MsgBoxResult.Yes
- CurrTool.NewTool = False
- CurrTool.m_Name = CurrTool.m_Name.Trim()
- CurrTool.WriteToolName()
- EgtTdbSaveCurrTool()
- Case MsgBoxResult.No
- If CurrTool.NewTool Then
- RemoveTool(CurrTool)
- ElseIf CurrTool.m_IsModifiedName Then
- Dim DbName As String = String.Empty
- EgtTdbGetCurrToolParam(MCH_TP.NAME, DbName)
- CurrTool.NamePar = DbName
- End If
- End Select
- End If
- Else
- MessageBox.Show(EgtMsg(MSG_TOOLSERRORS + 29), EgtMsg(MSG_TOOLSERRORS + 26))
- Return
- End If
- End If
- ' Salvataggio DB utensili
- EgtTdbSave()
- ' Reset lua
- EgtLuaResetGlobVar("STU")
- ' Se c'è il parametro Active sugli utensili
- If m_Active_Visibility Then
- ' aggiorno setup di default
- UpdateDefSetup()
- End If
- ' Chiusura finestra
- ToolTreeViewItem.m_delRemoveTool = Nothing
- ToolTreeViewItem.m_delErrorOnTool = Nothing
- ToolTreeViewItem.m_delIsEnabledBtns = Nothing
- FamilyToolTreeViewItem.m_delIsEnabledBtns = Nothing
- For Each Window In Application.Current.Windows
- If TypeOf Window Is ToolsDbV Then
- Dim ToolsDbWindow As ToolsDbV = DirectCast(Window, ToolsDbV)
- ToolsDbWindow.DataContext = Nothing
- ToolsDbWindow.Close()
- End If
- Next
- End Sub
-
-#End Region ' CloseToolsDbCommand
-
-#End Region ' Commands
-
-End Class
\ No newline at end of file