diff --git a/Constants/ConstIni.vb b/Constants/ConstIni.vb
index 4a96747..1a6a89a 100644
--- a/Constants/ConstIni.vb
+++ b/Constants/ConstIni.vb
@@ -121,6 +121,7 @@ Module ConstIni
Public Const S_OPTIONS As String = "Options"
Public Const K_NEWMACHININGISLASTONE As String = "NewMachiningIsLastOne"
+ Public Const K_USEDISPOSITIONSCRIPT As String = "UseDispositionScript"
Public Const S_MRUFILES As String = "MruFiles"
Public Const S_MRUSCRIPTS As String = "MruScripts"
diff --git a/Constants/ConstMachIni.vb b/Constants/ConstMachIni.vb
index e4ee801..81da674 100644
--- a/Constants/ConstMachIni.vb
+++ b/Constants/ConstMachIni.vb
@@ -41,4 +41,6 @@
Public Const S_FIXTURES As String = "Fixtures"
+ Public Const S_SETUP As String = "SetUp"
+
End Module
diff --git a/Constants/ConstMsg.vb b/Constants/ConstMsg.vb
index 9810634..c66dc4f 100644
--- a/Constants/ConstMsg.vb
+++ b/Constants/ConstMsg.vb
@@ -16,6 +16,7 @@
Public Const MSG_MACHININGSDBPAGE As Integer = MSG_EGTCAM5 + 1200
Public Const MSG_MACHININGSERRORS As Integer = MSG_EGTCAM5 + 1350
Public Const MSG_MACHININGOPTIONPAGE As Integer = MSG_EGTCAM5 + 1400
+ Public Const MSG_SETUP As Integer = MSG_EGTCAM5 + 1450
Public Const MSG_OPTIONPAGE As Integer = MSG_EGTCAM5 + 1500
Public Const MSG_DOORS As Integer = MSG_EGTCAM5 + 3000
Public Const MSG_DOORSERRORS As Integer = MSG_EGTCAM5 + 3100
diff --git a/EgtCAM5.vbproj b/EgtCAM5.vbproj
index 1e6916a..102fe1b 100644
--- a/EgtCAM5.vbproj
+++ b/EgtCAM5.vbproj
@@ -12,6 +12,21 @@
v4.0CustomClient
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ trueOn
@@ -259,6 +274,10 @@
ShowPanelView.xaml
+
+ SetUpView.xaml
+
+
@@ -416,6 +435,10 @@
DesignerMSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+ DesignerMSBuild:Compile
@@ -615,6 +638,28 @@
+
+
+ False
+ Microsoft .NET Framework 4 Client Profile %28x86 and x64%29
+ true
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ false
+
+
+ False
+ Windows Installer 4.5
+ true
+
+ IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\EgtCAM5\EgtCAM5R32.exe
diff --git a/IniFile.vb b/IniFile.vb
index e68c5dd..6200eb0 100644
--- a/IniFile.vb
+++ b/IniFile.vb
@@ -152,6 +152,20 @@ Public Module IniFile
Return False
End Function
+ Public Function GetPrivateProfileSetUpPosition(
+ ByVal lpAppName As String,
+ ByVal lpKeyName As String, ByRef sTcPos As String, ByRef sHead As String) As Boolean
+ Dim sVal As String = String.Empty
+ EgtUILib.GetPrivateProfileString(lpAppName, lpKeyName, "", sVal, m_sCurrMachIniFilePath)
+ Dim sItems() As String = sVal.Split(";".ToCharArray)
+ If sItems.Count() = 2 Then
+ sTcPos = sItems(0)
+ sHead = sItems(1)
+ Return True
+ End If
+ Return False
+ End Function
+
Public Function WritePrivateProfileString(IpAppName As String, IpKeyName As String, ByRef IpString As String) As Boolean
Return EgtUILib.WritePrivateProfileString(IpAppName, IpKeyName, IpString, m_sIniFile)
End Function
diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb
index 712491d..cc1be6d 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/OptionsWindow/OptionModule.vb b/OptionsWindow/OptionModule.vb
index ed66d5a..7f9c708 100644
--- a/OptionsWindow/OptionModule.vb
+++ b/OptionsWindow/OptionModule.vb
@@ -1,6 +1,6 @@
Imports System.Collections.ObjectModel
-Public Module OptionModule
+Friend Module OptionModule
' Parametri che contengono lista delle lingue disponibili e lingua selezionata
Friend m_LanguageList As New ObservableCollection(Of Language)
@@ -18,6 +18,8 @@ Public Module OptionModule
' Variabile che indica se quando viene creata una nuova operazione di lavorazione deve essere aggiunta in fondo
' alla fase o subito dopo la lavorazione selezionata
Friend m_bNewMachiningIsLastOne As Boolean
+ ' Variabile che indica se usare lo script per calcolare automaticamente la disposizione quando si passa in lavorazione
+ Friend m_bUseDispositionScript As Boolean
' inizializzazione lettura variabili ad inizio programma
Friend Sub InitOptionModule()
@@ -39,37 +41,39 @@ Public Module OptionModule
m_SelGeomSawFinishing = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt))
' Inizializzo variabile che indica posizione nuova operazione di lavorazione
m_bNewMachiningIsLastOne = If(GetPrivateProfileInt(S_OPTIONS, K_NEWMACHININGISLASTONE, 0) <> 0, True, False)
+ ' Inizializzo variabile che indica se usare script di disposizione
+ m_bUseDispositionScript = If(GetPrivateProfileInt(S_OPTIONS, K_USEDISPOSITIONSCRIPT, 0) <> 0, True, False)
End Sub
- ' Classe che identifica una lingua del programma con nome e path del file dei messaggi
- Public Class Language
-
- Private m_sName As String
- Private m_sFilePath As String
-
- Public Property Name As String
- Get
- Return m_sName
- End Get
- Set(value As String)
- m_sName = value
- End Set
- End Property
-
- Public Property FilePath As String
- Get
- Return m_sFilePath
- End Get
- Set(value As String)
- m_sFilePath = value
- End Set
- End Property
-
- Sub New(sName As String, sFilePath As String)
- Me.Name = sName
- Me.FilePath = sFilePath
- End Sub
-
- End Class
-
End Module
+
+' Classe che identifica una lingua del programma con nome e path del file dei messaggi
+Public Class Language
+
+ Private m_sName As String
+ Private m_sFilePath As String
+
+ Public Property Name As String
+ Get
+ Return m_sName
+ End Get
+ Set(value As String)
+ m_sName = value
+ End Set
+ End Property
+
+ Public Property FilePath As String
+ Get
+ Return m_sFilePath
+ End Get
+ Set(value As String)
+ m_sFilePath = value
+ End Set
+ End Property
+
+ Sub New(sName As String, sFilePath As String)
+ Me.Name = sName
+ Me.FilePath = sFilePath
+ End Sub
+
+End Class
diff --git a/OptionsWindow/OptionsView.xaml b/OptionsWindow/OptionsView.xaml
index e18a0ab..a610801 100644
--- a/OptionsWindow/OptionsView.xaml
+++ b/OptionsWindow/OptionsView.xaml
@@ -80,12 +80,17 @@
-
+
+
+
+
diff --git a/OptionsWindow/OptionsViewModel.vb b/OptionsWindow/OptionsViewModel.vb
index eadcf83..826adcf 100644
--- a/OptionsWindow/OptionsViewModel.vb
+++ b/OptionsWindow/OptionsViewModel.vb
@@ -71,16 +71,14 @@ Namespace EgtCAM5
End Set
End Property
- Public ReadOnly Property NewMachiningPosMsg As String
+ Public Property UseDispositionScript As Boolean
Get
- Return EgtMsg(MSG_OPTIONPAGE + 7)
- End Get
- End Property
-
- Public ReadOnly Property Title As String
- Get
- Return EgtMsg(MSG_MAINWINDOW + 5)
+ Return m_bUseDispositionScript
End Get
+ Set(value As Boolean)
+ m_bUseDispositionScript = value
+ WritePrivateProfileString(S_OPTIONS, K_USEDISPOSITIONSCRIPT, If(value, 1, 0).ToString)
+ End Set
End Property
' Definizione comandi
@@ -88,6 +86,12 @@ Namespace EgtCAM5
#Region "Messages"
+ Public ReadOnly Property Title As String
+ Get
+ Return EgtMsg(MSG_MAINWINDOW + 5)
+ End Get
+ End Property
+
Public ReadOnly Property CurrentLanguageMsg As String
Get
Return EgtMsg(MSG_OPTIONPAGE + 1)
@@ -119,6 +123,18 @@ Namespace EgtCAM5
End Get
End Property
+ Public ReadOnly Property NewMachiningPosMsg As String
+ Get
+ Return EgtMsg(MSG_OPTIONPAGE + 7)
+ End Get
+ End Property
+
+ Public ReadOnly Property UseDispositionScriptMsg As String
+ Get
+ Return EgtMsg(MSG_OPTIONPAGE + 8)
+ End Get
+ End Property
+
#End Region
#Region "COMMANDS"
diff --git a/ProjectPage/MachGroupPanel/MachGroupPanelViewModel.vb b/ProjectPage/MachGroupPanel/MachGroupPanelViewModel.vb
index d417114..fb81699 100644
--- a/ProjectPage/MachGroupPanel/MachGroupPanelViewModel.vb
+++ b/ProjectPage/MachGroupPanel/MachGroupPanelViewModel.vb
@@ -82,7 +82,7 @@ Namespace EgtCAM5
Dim bOk As Boolean = (EgtAddMachGroup(sNewMachName) <> GDB_ID.NULL)
Dim sInitScriptPath As String = String.Empty
EgtUILib.GetPrivateProfileString(S_DISPOSITION, K_INITSCRIPT, "", sInitScriptPath, IniFile.m_sCurrMachIniFilePath)
- If bOk And Not String.IsNullOrEmpty(sInitScriptPath) Then
+ If bOk AndAlso OptionModule.m_bUseDispositionScript And Not String.IsNullOrEmpty(sInitScriptPath) Then
sInitScriptPath = IniFile.m_sCurrMachScriptsDirPath & "\" & sInitScriptPath
If Not EgtLuaExecFile(sInitScriptPath) Then
EgtOutLog("Error executing disposition init script " & sInitScriptPath)
diff --git a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderView.xaml b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderView.xaml
index 28be07e..74a7058 100644
--- a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderView.xaml
+++ b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderView.xaml
@@ -15,9 +15,9 @@
-
+
-
+
diff --git a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderViewModel.vb b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderViewModel.vb
index 65c8f6c..0520c12 100644
--- a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderViewModel.vb
+++ b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderViewModel.vb
@@ -252,6 +252,16 @@ Namespace EgtCAM5
End Get
End Property
+ Private m_RawPartOptions As RawPartOptionView
+ Public ReadOnly Property RawPartOptions As ContentControl
+ Get
+ If IsNothing(m_RawPartOptions) Then
+ m_RawPartOptions = New RawPartOptionView
+ m_RawPartOptions.DataContext = New RawPartOptionViewModel
+ End If
+ Return m_RawPartOptions
+ End Get
+ End Property
#Region "Messages"
@@ -271,7 +281,7 @@ Namespace EgtCAM5
Public ReadOnly Property OkMsg As String
Get
- Return "Ok"
+ Return EgtMsg(MSG_DISPOSITION + 1)
End Get
End Property
diff --git a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionUtility.vb b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionUtility.vb
index d86763f..d773b57 100644
--- a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionUtility.vb
+++ b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionUtility.vb
@@ -544,4 +544,42 @@ Public NotInheritable Class DispositionUtility
End While
End Sub
+ ' Costante che identifica l'informazione contenente il Frame3d originale del pezzo
+ Private Const ORIG_FRAME As String = "ORIGFRAME"
+
+ ' Funzione che visualizza i pezzi disponibili e li sposta sotto il grezzo
+ Friend Shared Sub ShowPartUnderTable()
+ ' ciclo sui pezzi
+ Dim nPartId As Integer = EgtGetFirstPart()
+ While nPartId <> GDB_ID.NULL
+ ' mi faccio dare il riferimento del pezzo prima si spostarlo
+ Dim frOrigPart As New Frame3d
+ EgtGetGroupGlobFrame(nPartId, frOrigPart)
+ ' salvo il riferimento originale
+ EgtSetInfo(nPartId, ORIG_FRAME, frOrigPart)
+ ' Attivo la visualizzazione del pezzo mettendolo in modalità standard
+ EgtSetStatus(nPartId, GDB_ST.ON_)
+ ' prendo il pezzo successivo
+ nPartId = EgtGetNextPart(nPartId)
+ End While
+ EgtDraw()
+ End Sub
+
+ ' Funzione che rimette a posto i pezzi
+ Friend Shared Sub HidePartUnderTable()
+ ' ciclo sui pezzi
+ Dim nPartId As Integer = EgtGetFirstPart()
+ While nPartId <> GDB_ID.NULL
+ ' recupero il riferimento originale
+ Dim frOrigPart As New Frame3d
+ EgtGetInfo(nPartId, ORIG_FRAME, frOrigPart)
+ ' lo ripristino
+ EgtChangeGroupFrame(nPartId, frOrigPart)
+ ' Attivo la visualizzazione del pezzo mettendolo in modalità standard
+ EgtSetStatus(nPartId, GDB_ST.OFF)
+ ' prendo il pezzo successivo
+ nPartId = EgtGetNextPart(nPartId)
+ End While
+ End Sub
+
End Class
diff --git a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/FixtureParameters/FixtureParametersViewModel.vb b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/FixtureParameters/FixtureParametersViewModel.vb
index 30e282b..ecc2f20 100644
--- a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/FixtureParameters/FixtureParametersViewModel.vb
+++ b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/FixtureParameters/FixtureParametersViewModel.vb
@@ -38,7 +38,7 @@ Namespace EgtCAM5
Public ReadOnly Property OkMsg As String
Get
- Return "Ok"
+ Return EgtMsg(MSG_DISPOSITION + 1)
End Get
End Property
diff --git a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionView.xaml b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionView.xaml
index 434eade..287d86e 100644
--- a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionView.xaml
+++ b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionView.xaml
@@ -5,7 +5,36 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionViewModel.vb b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionViewModel.vb
index 0273703..317af74 100644
--- a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionViewModel.vb
+++ b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionViewModel.vb
@@ -41,6 +41,89 @@ Namespace EgtCAM5
End Set
End Property
+ Private m_bRawPartParamVisibility As Visibility
+ Public ReadOnly Property RawPartParamVisibility As Visibility
+ Get
+ Return m_bRawPartParamVisibility
+ End Get
+ End Property
+
+#Region "Messages"
+
+ Public ReadOnly Property NewMsg As String
+ Get
+ Return EgtMsg(MSG_DISPOSITION + 3)
+ End Get
+ End Property
+ Public ReadOnly Property RemoveMsg As String
+ Get
+ Return EgtMsg(MSG_DISPOSITION + 4)
+ End Get
+ End Property
+ Public ReadOnly Property LenghtMsg As String
+ Get
+ Return EgtMsg(MSG_DISPOSITION + 5)
+ End Get
+ End Property
+ Public ReadOnly Property WidthMsg As String
+ Get
+ Return EgtMsg(MSG_DISPOSITION + 6)
+ End Get
+ End Property
+ Public ReadOnly Property HeightMsg As String
+ Get
+ Return EgtMsg(MSG_DISPOSITION + 7)
+ End Get
+ End Property
+ Public ReadOnly Property PositionMsg As String
+ Get
+ Return EgtMsg(MSG_DISPOSITION + 8)
+ End Get
+ End Property
+
+#End Region ' Messages
+
+ ' Definizione comandi
+ Private m_cmdNewRawPart As ICommand
+ Private m_cmdRemoveRawPart As ICommand
+
+ Sub New()
+ If EgtGetFirstSelectedObj() <> GDB_ID.NULL Then
+ m_bRawPartParamVisibility = Visibility.Visible
+ Else
+ m_bRawPartParamVisibility = Visibility.Collapsed
+ End If
+ End Sub
+
+#Region "COMMANDS"
+
+#Region "NewRawPartCommand"
+
+ '''
+ ''' Returns a command that do Done.
+ '''
+ Public ReadOnly Property NewRawPartCommand As ICommand
+ Get
+ If m_cmdNewRawPart Is Nothing Then
+ m_cmdNewRawPart = New RelayCommand(AddressOf NewRawPart)
+ End If
+ Return m_cmdNewRawPart
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Point. This method is invoked by the DoneCommand.
+ '''
+ Public Sub NewRawPart()
+ DispositionUtility.ShowPartUnderTable()
+ m_bRawPartParamVisibility = Visibility.Visible
+ OnPropertyChanged("RawPartParamVisibility")
+ End Sub
+
+#End Region ' NewRawPartCommand
+
+#End Region ' Commands
+
End Class
End Namespace
\ No newline at end of file
diff --git a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderView.xaml b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderView.xaml
index bec40af..773944e 100644
--- a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderView.xaml
+++ b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderView.xaml
@@ -65,10 +65,12 @@
+
+
diff --git a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderViewModel.vb b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderViewModel.vb
index 937b56e..d05b0a6 100644
--- a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderViewModel.vb
+++ b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderViewModel.vb
@@ -345,6 +345,12 @@ Namespace EgtCAM5
End Get
End Property
+ Public ReadOnly Property SetUpMsg As String
+ Get
+ Return EgtMsg(MSG_SETUP + 1)
+ End Get
+ End Property
+
#End Region ' Messages
' Definizione comandi
@@ -355,6 +361,7 @@ Namespace EgtCAM5
Private m_cmdMoveUp As ICommand
Private m_cmdMoveDown As ICommand
Private m_cmdUpdate As ICommand
+ Private m_cmdSetUp As ICommand
Sub New()
Me.ListIsExpanded = True
@@ -689,6 +696,34 @@ Namespace EgtCAM5
#End Region ' UpdateCommand
+#Region "SetUpCommand"
+
+ '''
+ ''' Returns a command that do Point.
+ '''
+ Public ReadOnly Property SetUpCommand As ICommand
+ Get
+ If m_cmdSetUp Is Nothing Then
+ m_cmdSetUp = New RelayCommand(AddressOf SetUp)
+ End If
+ Return m_cmdSetUp
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Point. This method is invoked by the PointCommand.
+ '''
+ Public Sub SetUp()
+ Dim SetUpWindow As New SetUpView
+ SetUpWindow.Height = 614
+ SetUpWindow.Width = 1024
+ SetUpWindow.DataContext = New SetUpViewModel
+ SetUpWindow.Owner = Application.Current.MainWindow
+ SetUpWindow.ShowDialog()
+ End Sub
+
+#End Region ' SetUpCommand
+
#End Region ' Commands
#Region "METHODS"
diff --git a/SetUpWindow/SetUpView.xaml b/SetUpWindow/SetUpView.xaml
new file mode 100644
index 0000000..d61dceb
--- /dev/null
+++ b/SetUpWindow/SetUpView.xaml
@@ -0,0 +1,141 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/SetUpWindow/SetUpView.xaml.vb b/SetUpWindow/SetUpView.xaml.vb
new file mode 100644
index 0000000..40899d1
--- /dev/null
+++ b/SetUpWindow/SetUpView.xaml.vb
@@ -0,0 +1,3 @@
+Public Class SetUpView
+
+End Class
diff --git a/SetUpWindow/SetUpViewModel.vb b/SetUpWindow/SetUpViewModel.vb
new file mode 100644
index 0000000..03e7aa2
--- /dev/null
+++ b/SetUpWindow/SetUpViewModel.vb
@@ -0,0 +1,742 @@
+Imports System.Collections.ObjectModel
+Imports System.ComponentModel
+Imports System.IO
+Imports EgtUILib
+
+Namespace EgtCAM5
+
+ Public Class SetUpViewModel
+
+ Private m_Title As String
+ Public ReadOnly Property Title As String
+ Get
+ Return EgtMsg(MSG_SETUP + 1)
+ End Get
+ End Property
+
+ ' Lista degli utensili
+ Private m_ToolsList As New ObservableCollection(Of FamilyToolItem)
+ Public Property ToolsList As ObservableCollection(Of FamilyToolItem)
+ Get
+ Return m_ToolsList
+ End Get
+ Set(value As ObservableCollection(Of FamilyToolItem))
+ m_ToolsList = value
+ End Set
+ End Property
+
+ ' Lista delle posizioni
+ Private m_PositionList As New ObservableCollection(Of Position)
+ Public Property PositionList As ObservableCollection(Of Position)
+ Get
+ Return m_PositionList
+ End Get
+ Set(value As ObservableCollection(Of Position))
+ m_PositionList = value
+ End Set
+ End Property
+
+ ' Definizione comandi
+ Private m_cmdApply As ICommand
+ Private m_cmdArchive As ICommand
+ Private m_cmdRetrieves As ICommand
+
+ Sub New()
+ ExitToolAssociation.sh_ToolsList = m_ToolsList
+ LoadMachineTools()
+ LoadMachinePositions()
+ End Sub
+
+ '''
+ ''' Method that search tools for the currently selected Machine and add it to the ToolsList.
+ '''
+ Private Sub LoadMachineTools()
+ ' Creo lista utensili utilizzati dal gruppo di lavorazione corrente
+ Dim UsedToolList As New List(Of String)
+ Dim Machining As Integer = EgtGetFirstOperation()
+ While Machining <> GDB_ID.NULL
+ If EgtGetOperationType(Machining) >= MCH_OY.SAWING Then
+ EgtSetCurrMachining(Machining)
+ Dim Tuuid As String = String.Empty
+ EgtGetMachiningParam(MCH_MP.TUUID, Tuuid)
+ UsedToolList.Add(Tuuid)
+ End If
+ Machining = EgtGetNextOperation(Machining)
+ End While
+ ' Creo lista utensili per grafica
+ Dim ActiveToolsFamilies() As ToolsFamily = ReadActiveToolsFamilies()
+ For Index = 0 To ActiveToolsFamilies.Count - 1
+ Dim FamilyToolItem As New FamilyToolItem(ActiveToolsFamilies(Index).FamilyName, ActiveToolsFamilies(Index).FamilyId)
+ m_ToolsList.Add(FamilyToolItem)
+ Dim nType As Integer = 0
+ Dim ToolName As String = String.Empty
+ Dim nValue As Integer = 0
+ Dim sValue As String = String.Empty
+ Dim ExitPar As String = String.Empty
+ Dim Head As String = String.Empty
+ Dim TcPos As String = String.Empty
+ Dim Uuid As String = String.Empty
+ Dim IsInCurrMachGroup As Boolean = False
+ If EgtTdbGetFirstTool(ActiveToolsFamilies(Index).FamilyId, ToolName, nType) Then
+ EgtTdbSetCurrTool(ToolName)
+ EgtTdbGetCurrToolParam(MCH_TP.EXIT_, nValue)
+ ExitPar = nValue.ToString()
+ EgtTdbGetCurrToolParam(MCH_TP.HEAD, sValue)
+ Head = sValue
+ EgtTdbGetCurrToolParam(MCH_TP.TCPOS, sValue)
+ TcPos = sValue
+ EgtTdbGetCurrToolParam(MCH_TP.UUID, sValue)
+ Uuid = sValue
+ IsInCurrMachGroup = If(UsedToolList.Contains(Uuid), True, False)
+ FamilyToolItem.Items.Add(New ToolItem(ToolName, ExitPar, nType, Head, TcPos, Uuid, IsInCurrMachGroup))
+ While EgtTdbGetNextTool(ActiveToolsFamilies(Index).FamilyId, ToolName, nType)
+ EgtTdbSetCurrTool(ToolName)
+ EgtTdbGetCurrToolParam(MCH_TP.EXIT_, nValue)
+ ExitPar = nValue.ToString()
+ EgtTdbGetCurrToolParam(MCH_TP.HEAD, sValue)
+ Head = sValue
+ EgtTdbGetCurrToolParam(MCH_TP.TCPOS, sValue)
+ TcPos = sValue
+ EgtTdbGetCurrToolParam(MCH_TP.UUID, sValue)
+ Uuid = sValue
+ IsInCurrMachGroup = If(UsedToolList.Contains(Uuid), True, False)
+ FamilyToolItem.Items.Add(New ToolItem(ToolName, ExitPar, nType, Head, TcPos, Uuid, IsInCurrMachGroup))
+ 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
+
+ '''
+ ''' Method that search the machines in the correct folder and add to the MachinesList those valid.
+ '''
+ Private Function ReadActiveToolsFamilies() As ToolsFamily()
+ Dim ActiveToolsFamiliesList As New List(Of ToolsFamily)
+ If EgtUILib.GetPrivateProfileInt(S_TOOLS, K_DRILLBIT, 0, m_sCurrMachIniFilePath) <> 0 Then
+ ActiveToolsFamiliesList.Add(New ToolsFamily With {.FamilyId = MCH_TF.DRILLBIT, .FamilyName = EgtMsg(MSG_TOOLSDBPAGE + 1)})
+ End If
+ If EgtUILib.GetPrivateProfileInt(S_TOOLS, K_SAWBLADE, 0, m_sCurrMachIniFilePath) <> 0 Then
+ ActiveToolsFamiliesList.Add(New ToolsFamily With {.FamilyId = MCH_TF.SAWBLADE, .FamilyName = EgtMsg(MSG_TOOLSDBPAGE + 2)})
+ End If
+ If EgtUILib.GetPrivateProfileInt(S_TOOLS, K_MILL, 0, m_sCurrMachIniFilePath) <> 0 Then
+ ActiveToolsFamiliesList.Add(New ToolsFamily With {.FamilyId = MCH_TF.MILL, .FamilyName = EgtMsg(MSG_TOOLSDBPAGE + 3)})
+ End If
+ If EgtUILib.GetPrivateProfileInt(S_TOOLS, K_MORTISE, 0, m_sCurrMachIniFilePath) <> 0 Then
+ ActiveToolsFamiliesList.Add(New ToolsFamily With {.FamilyId = MCH_TF.MORTISE, .FamilyName = EgtMsg(MSG_TOOLSDBPAGE + 4)})
+ End If
+ If EgtUILib.GetPrivateProfileInt(S_TOOLS, K_COMPO, 0, m_sCurrMachIniFilePath) <> 0 Then
+ ActiveToolsFamiliesList.Add(New ToolsFamily With {.FamilyId = MCH_TF.COMPO, .FamilyName = EgtMsg(MSG_TOOLSDBPAGE + 5)})
+ End If
+ Return ActiveToolsFamiliesList.ToArray
+ End Function
+
+ Private Sub LoadMachinePositions()
+ ' recupero il gruppo del setup
+ Dim nSetUpGroup As Integer = EgtGetCurrSetup()
+ ' leggo l'attrezzaggio del progetto
+ Dim sPosition As String = String.Empty
+ Dim IniIndex As Integer = 1
+ ' recupero stringa di ogni posizione
+ While EgtGetInfo(nSetUpGroup, K_POS & IniIndex, sPosition)
+ ReadPositionString(IniIndex, sPosition)
+ IniIndex += 1
+ End While
+ ' altrimenti
+ If Not m_PositionList.Count > 0 Then
+ ' ne genero uno nuovo dalla configurazione nel file ini della macchina
+ Dim sTcPos As String = String.Empty
+ Dim sHead As String = String.Empty
+ Dim sExitList As New List(Of String)
+ Dim Index = 1
+ While GetPrivateProfileSetUpPosition(S_SETUP, K_POS & Index, sTcPos, sHead)
+ PositionList.Add(New Position(sTcPos, sHead, EgtGetHeadExitCount(sHead)))
+ Index += 1
+ End While
+ End If
+
+ End Sub
+
+ ' Funzione che dati l'indice della posizione e la sua stringa di attrezzaggio, carica l'attrezzaggio descritto
+ Private Sub ReadPositionString(nIndex As Integer, sPosition As String)
+ Dim sTcPos As String = String.Empty
+ Dim sHead As String = String.Empty
+ Dim sExitList As New List(Of String)
+ Dim sToolList As New List(Of String)
+ ' la spezzo sui ;
+ Dim sItems() As String = sPosition.Split(";".ToCharArray)
+ ' se c'è almeno un elemento sono sicuro che ci sia la T
+ If sItems.Count() >= 1 Then
+ sTcPos = sItems(0)
+ ' se ci sono almeno due elementi sono sicuro che ci sia la H
+ If sItems.Count >= 2 Then
+ sHead = sItems(1)
+ PositionList.Add(New Position(sTcPos, sHead, EgtGetHeadExitCount(sHead)))
+ ' se ci sono almeno tre elementi sono sicuro che ci sia almeno un'uscita attrezzata
+ If sItems.Count >= 3 Then
+ ' separo le uscite divise dalla ,
+ Dim sExitToolAssList() As String = sItems(2).Split(",".ToCharArray)
+ sExitList.Clear()
+ sToolList.Clear()
+ ' creo le liste di uscite e utensili attrezzati ricavati
+ For AssIndex = 0 To sExitToolAssList.Count() - 1
+ Dim sExitToolAssItem() As String = sExitToolAssList(AssIndex).Split("/".ToCharArray)
+ If sExitToolAssItem.Count > 1 Then
+ sExitList.Add(sExitToolAssItem(0))
+ sToolList.Add(sExitToolAssItem(1))
+ End If
+ Next
+ ' analizzo la lista di utensili attrezzati
+ For ToolIndex = 0 To sToolList.Count - 1
+ If Not String.IsNullOrEmpty(sToolList(ToolIndex)) Then
+ Dim TempTool As ToolItem = Nothing
+ Dim bFound As Boolean = False
+ ' cerco l'utensile attrezzato nella lista utensili
+ For FamilyListIndex = 0 To m_ToolsList.Count - 1
+ For ToolListIndex = 0 To m_ToolsList(FamilyListIndex).Items.Count - 1
+ If m_ToolsList(FamilyListIndex).Items(ToolListIndex).Name = sToolList(ToolIndex) Then
+ ' lo salvo in una variabile temporanea e lo tolgo dalla lista
+ TempTool = DirectCast(m_ToolsList(FamilyListIndex).Items(ToolListIndex), ToolItem)
+ m_ToolsList(FamilyListIndex).Items.Remove(m_ToolsList(FamilyListIndex).Items(ToolListIndex))
+ bFound = True
+ Exit For
+ End If
+ Next
+ If bFound Then Exit For
+ Next
+ ' cerco la relativa uscita
+ For ExitIndex = 0 To m_PositionList(nIndex - 1).ExitToolAssociationList.Count - 1
+ If m_PositionList(nIndex - 1).ExitToolAssociationList(ExitIndex).ExitPar = sExitList(ToolIndex) Then
+ ' vi metto l'utensile e segno l'uscita come occupata
+ m_PositionList(nIndex - 1).ExitToolAssociationList(ExitIndex).Tool = TempTool
+ m_PositionList(nIndex - 1).ExitToolAssociationList(ExitIndex).IsOccupied = True
+ End If
+ Next
+ End If
+ Next
+ End If
+ ' non è presente la H, quindi la recupero dal modello delle posizioni nel file MachIni
+ Else
+ GetPrivateProfileSetUpPosition(S_SETUP, K_POS & nIndex, sTcPos, sHead)
+ EgtGetHeadExitCount(sHead)
+ PositionList.Add(New Position(sTcPos, sHead, EgtGetHeadExitCount(sHead)))
+ End If
+ End If
+
+ End Sub
+
+#Region "COMMANDS"
+
+#Region "ApplyCommand"
+
+ '''
+ ''' Returns a command that do Exec.
+ '''
+ Public ReadOnly Property ApplyCommand As ICommand
+ Get
+ If m_cmdApply Is Nothing Then
+ m_cmdApply = New Command(AddressOf Apply)
+ End If
+ Return m_cmdApply
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Sub Apply(param As Object)
+ Dim nSetUpGroup As Integer = EgtGetCurrSetup()
+ For Index = 0 To m_PositionList.Count - 1
+ Dim sPosition As String = String.Empty
+ sPosition = m_PositionList(Index).TcPos
+ Dim sExitToolAssociation As String = String.Empty
+ For AssIndex = 0 To m_PositionList(Index).ExitToolAssociationList.Count - 1
+ sExitToolAssociation &= If(m_PositionList(Index).ExitToolAssociationList(AssIndex).IsOccupied, m_PositionList(Index).ExitToolAssociationList(AssIndex).ExitPar & "/" & m_PositionList(Index).ExitToolAssociationList(AssIndex).Tool.Name & ",", String.Empty)
+ Next
+ sExitToolAssociation = sExitToolAssociation.Trim(","c)
+ If Not String.IsNullOrEmpty(sExitToolAssociation) Then
+ sPosition &= ";" & m_PositionList(Index).Head & ";" & sExitToolAssociation
+ End If
+ EgtSetInfo(nSetUpGroup, K_POS & Index + 1, sPosition)
+ Next
+ End Sub
+
+#End Region ' ApplyCommand
+
+#Region "ArchiveCommand"
+
+ '''
+ ''' Returns a command that do Exec.
+ '''
+ Public ReadOnly Property ArchiveCommand As ICommand
+ Get
+ If m_cmdArchive Is Nothing Then
+ m_cmdArchive = New Command(AddressOf Archive)
+ End If
+ Return m_cmdArchive
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Sub Archive(param As Object)
+ ' Direttorio per attrezzaggi
+ Dim sDir As String = IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName & "\SetUp"
+ Dim sPath As String = String.Empty
+ ' Apertura dialogo di salvataggio
+ Dim SaveFileDialogView As New EgtWPFLib5.EgtSaveFileDialog
+ SaveFileDialogView.Title = EgtMsg(MSG_SETUP + 5)
+ SaveFileDialogView.Extension = ".stu"
+ SaveFileDialogView.Directory = sDir
+ SaveFileDialogView.FileName = String.Empty
+ If Not SaveFileDialogView.ShowDialog Then
+ Return
+ End If
+ sPath = SaveFileDialogView.FileName
+
+ File.WriteAllLines(sPath, {"; Commento per evitare BOM con UTF-8"}, Text.Encoding.UTF8)
+
+ For Index = 0 To m_PositionList.Count - 1
+ Dim sPosition As String = String.Empty
+ sPosition = m_PositionList(Index).TcPos
+ Dim sExitToolAssociation As String = String.Empty
+ For AssIndex = 0 To m_PositionList(Index).ExitToolAssociationList.Count - 1
+ sExitToolAssociation &= If(m_PositionList(Index).ExitToolAssociationList(AssIndex).IsOccupied, m_PositionList(Index).ExitToolAssociationList(AssIndex).ExitPar & "/" & m_PositionList(Index).ExitToolAssociationList(AssIndex).Tool.Name & ",", String.Empty)
+ Next
+ sExitToolAssociation = sExitToolAssociation.Trim(","c)
+ If Not String.IsNullOrEmpty(sExitToolAssociation) Then
+ sPosition &= ";" & m_PositionList(Index).Head & ";" & sExitToolAssociation
+ End If
+ EgtUILib.WritePrivateProfileString(S_GENERAL, K_POS & Index + 1, sPosition, sPath)
+ Next
+
+ End Sub
+
+#End Region ' ArchiveCommand
+
+#Region "RetrievesCommand"
+
+ '''
+ ''' Returns a command that do Exec.
+ '''
+ Public ReadOnly Property RetrievesCommand As ICommand
+ Get
+ If m_cmdRetrieves Is Nothing Then
+ m_cmdRetrieves = New Command(AddressOf Retrieves)
+ End If
+ Return m_cmdRetrieves
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Sub Retrieves(param As Object)
+ ' Direttorio per attrezzaggi
+ Dim sDir As String = IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName & "\SetUp"
+ Dim sPath As String = String.Empty
+ ' Apertura dialogo di salvataggio
+ Dim OpenFileDialogView As New EgtWPFLib5.EgtOpenFileDialog
+ OpenFileDialogView.Title = EgtMsg(MSG_SETUP + 5)
+ OpenFileDialogView.Filter = "*.stu"
+ OpenFileDialogView.Directory = sDir
+ OpenFileDialogView.FileName = String.Empty
+ If Not OpenFileDialogView.ShowDialog Then
+ Return
+ End If
+ sPath = OpenFileDialogView.FileName
+
+ ' resetto lista utensili e posizioni
+ m_ToolsList.Clear()
+ m_PositionList.Clear()
+ 'ricarico lista utensili
+ LoadMachineTools()
+ ' leggo l'attrezzaggio dal file scelto
+ Dim sPosition As String = String.Empty
+ Dim IniIndex As Integer = 1
+ ' recupero stringa di ogni posizione
+ While EgtUILib.GetPrivateProfileString(S_GENERAL, K_POS & IniIndex, String.Empty, sPosition, sPath) > 0
+ ReadPositionString(IniIndex, sPosition)
+ IniIndex += 1
+ End While
+
+ End Sub
+
+#End Region ' RetrievesCommand
+
+#End Region ' Commands
+
+ End Class
+
+End Namespace
+
+Public Class Position
+
+ Private m_TcPos As String
+ Public Property TcPos As String
+ Get
+ Return m_TcPos
+ End Get
+ Set(value As String)
+ m_TcPos = value
+ End Set
+ End Property
+
+ Private m_Head As String
+ '''
+ ''' Property that read and write to the tool's database the Head
+ '''
+ Friend Property Head As String
+ Get
+ Return m_Head
+ End Get
+ Set(value As String)
+ If value = String.Empty Or value <> m_Head Then
+ m_Head = value
+ End If
+ End Set
+ End Property
+
+ ' Lista delle uscite con relativi utensili associati
+ Private m_ExitToolAssociationList As New ObservableCollection(Of ExitToolAssociation)
+ Public Property ExitToolAssociationList As ObservableCollection(Of ExitToolAssociation)
+ Get
+ Return m_ExitToolAssociationList
+ End Get
+ Set(value As ObservableCollection(Of ExitToolAssociation))
+ m_ExitToolAssociationList = value
+ End Set
+ End Property
+
+ Sub New(TcPos As String, Head As String, ExitNum As Integer)
+ Me.TcPos = TcPos
+ Me.Head = Head
+ For ExitIndex = 1 To ExitNum
+ ExitToolAssociationList.Add(New ExitToolAssociation(ExitIndex.ToString))
+ Next
+ End Sub
+
+End Class
+
+Public Class ExitToolAssociation
+ Implements INotifyPropertyChanged
+
+ Friend Shared sh_ToolsList As ObservableCollection(Of FamilyToolItem)
+
+ Private m_IsOccupied As Boolean
+ '''
+ ''' Property that read and write to the tool's database the Exit
+ '''
+ Public Property IsOccupied As Boolean
+ Get
+ Return m_IsOccupied
+ End Get
+ Set(value As Boolean)
+ If value <> m_IsOccupied Then
+ m_IsOccupied = value
+ NotifyPropertyChanged("IsOccupied")
+ End If
+ End Set
+ End Property
+
+ Private m_Exit As String
+ '''
+ ''' Property that read and write to the tool's database the Exit
+ '''
+ Public Property ExitPar As String
+ Get
+ Return m_Exit
+ End Get
+ Set(value As String)
+ If value <> m_Exit Then
+ m_Exit = value
+ End If
+ End Set
+ End Property
+
+ Private m_Tool As ToolItem
+ '''
+ ''' Property that read and write to the tool's database the Uuid
+ '''
+ Public Property Tool As ToolItem
+ Get
+ Return m_Tool
+ End Get
+ Set(value As ToolItem)
+ m_Tool = value
+ NotifyPropertyChanged("Tool")
+ End Set
+ End Property
+
+ ' Definizione comandi
+ Private m_cmdSetUpTool As ICommand
+ Private m_cmdRemoveSetUpTool As ICommand
+
+#Region "CONSTRUCTORS"
+
+ Sub New(ExitPar As String)
+ Me.ExitPar = ExitPar
+ End Sub
+
+#End Region ' Constructors
+
+#Region "COMMANDS"
+
+#Region "SetUpToolCommand"
+
+ '''
+ ''' Returns a command that do Exec.
+ '''
+ Public ReadOnly Property SetUpToolCommand As ICommand
+ Get
+ If m_cmdSetUpTool Is Nothing Then
+ m_cmdSetUpTool = New Command(AddressOf SetUpTool)
+ End If
+ Return m_cmdSetUpTool
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Sub SetUpTool(param As Object)
+ ' se quello selezionato nella lista non è un utensile esco
+ If Not TypeOf param Is ToolItem Then
+ IsOccupied = False
+ Return
+ End If
+ Dim SelTool As ToolItem = DirectCast(param, ToolItem)
+ ' lo aggiungo alla posizione di attrezzaggio
+ Tool = SelTool
+ IsOccupied = True
+ ' e lo tolgo dalla lista
+ For Index = 0 To sh_ToolsList.Count - 1
+ If (SelTool.Type And sh_ToolsList(Index).Type) > 0 Then
+ sh_ToolsList(Index).Items.Remove(SelTool)
+ Exit For
+ End If
+ Next
+ End Sub
+
+#End Region ' SetUpToolCommand
+
+#Region "RemoveSetUpToolCommand"
+
+ '''
+ ''' Returns a command that do Exec.
+ '''
+ Public ReadOnly Property RemoveSetUpToolCommand As ICommand
+ Get
+ If m_cmdRemoveSetUpTool Is Nothing Then
+ m_cmdRemoveSetUpTool = New Command(AddressOf RemoveSetUpTool)
+ End If
+ Return m_cmdRemoveSetUpTool
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Sub RemoveSetUpTool(param As Object)
+ ' lo rimetto nella lista utensili
+ For Index = 0 To sh_ToolsList.Count - 1
+ If (Tool.Type And sh_ToolsList(Index).Type) > 0 Then
+ sh_ToolsList(Index).Items.Add(Tool)
+ Exit For
+ End If
+ Next
+ ' e lo tolgo dalla posizione di attrezzaggio
+ Tool = Nothing
+ IsOccupied = False
+ End Sub
+
+#End Region ' RemoveSetUpToolCommand
+
+#End Region ' Commands
+
+ Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
+
+ Public Sub NotifyPropertyChanged(propName As String)
+ RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
+ End Sub
+
+End Class
+
+Public Class FamilyToolItem
+ Inherits InheritableTreeViewItem
+
+ Public Overrides Property IsSelected As Boolean
+ Get
+ Return m_IsSelected
+ End Get
+ Set(value As Boolean)
+ If (value <> m_IsSelected) Then
+ m_IsSelected = value
+ End If
+ End Set
+ End Property
+
+ Public ReadOnly Property FamilyColor As SolidColorBrush
+ Get
+ If m_HaveToolsInCurrMachGroup Then
+ Return Brushes.Red
+ Else
+ Return Brushes.Transparent
+ End If
+ End Get
+ End Property
+
+ Private m_HaveToolsInCurrMachGroup As Boolean
+
+ Private m_Type As MCH_TF
+ '''
+ ''' Property that determines the tool type of the family
+ '''
+ Public ReadOnly Property Type As MCH_TF
+ Get
+ Return m_Type
+ End Get
+ End Property
+
+ Sub New(Name As String, Type As MCH_TF)
+ MyBase.New(Name)
+ Me.PictureString = "/Resources/TreeView/Folder.png"
+ m_Type = Type
+ ' Aggiungo il gestore d'evento di modifica lista degli item per poter mettere e togliere il pallino che indica se ci sono utensili da attrezzare
+ AddHandler Items.CollectionChanged, AddressOf ManageObservableCollection
+ End Sub
+
+ Private Sub ManageObservableCollection(sender As Object, e As System.Collections.Specialized.NotifyCollectionChangedEventArgs)
+ m_HaveToolsInCurrMachGroup = False
+ For Index = 0 To Items.Count - 1
+ Dim ToolItem As ToolItem = DirectCast(Items(Index), ToolItem)
+ If ToolItem.m_IsInCurrMachGroup Then
+ m_HaveToolsInCurrMachGroup = True
+ End If
+ Next
+ NotifyPropertyChanged("FamilyColor")
+ End Sub
+
+End Class
+
+Public Class ToolItem
+ Inherits InheritableTreeViewItem
+
+ Public Overrides Property IsSelected As Boolean
+ Get
+ Return m_IsSelected
+ End Get
+ Set(value As Boolean)
+ If (value <> m_IsSelected) Then
+ m_IsSelected = value
+ End If
+ End Set
+ End Property
+
+ Public ReadOnly Property ToolColor As SolidColorBrush
+ Get
+ If m_IsInCurrMachGroup Then
+ Return Brushes.Red
+ Else
+ Return Brushes.Transparent
+ End If
+ End Get
+ End Property
+
+ Friend m_IsInCurrMachGroup As Boolean
+ '''
+ ''' Property that read and write to the tool's database the Exit
+ '''
+ Public Property IsInCurrMachGroup As Boolean
+ Get
+ Return m_IsInCurrMachGroup
+ End Get
+ Set(value As Boolean)
+ If value <> m_IsInCurrMachGroup Then
+ m_IsInCurrMachGroup = value
+ 'NotifyPropertyChanged("IsInCurrMachGroup")
+ End If
+ End Set
+ End Property
+
+ Private m_Exit As String
+ '''
+ ''' Property that read and write to the tool's database the Exit
+ '''
+ Friend Property ExitPar As String
+ Get
+ Return m_Exit
+ End Get
+ Set(value As String)
+ If value <> m_Exit Then
+ m_Exit = value
+ End If
+ End Set
+ End Property
+
+ Private m_Type As MCH_TY
+ '''
+ ''' Property that determines the tool type of the family
+ '''
+ Public ReadOnly Property Type As MCH_TY
+ Get
+ Return m_Type
+ End Get
+ End Property
+
+ Private m_Head As String
+ '''
+ ''' Property that read and write to the tool's database the Head
+ '''
+ Friend Property Head As String
+ Get
+ Return m_Head
+ End Get
+ Set(value As String)
+ If value = String.Empty Or value <> m_Head Then
+ m_Head = value
+ End If
+ End Set
+ End Property
+
+ Private m_TcPos As String
+ '''
+ ''' Property that read and write to the tool's database the Tc Pos
+ '''
+ Friend Property TcPos As String
+ Get
+ Return m_TcPos
+ End Get
+ Set(value As String)
+ If value = String.Empty Or value <> m_TcPos Then
+ m_TcPos = value
+ End If
+ End Set
+ End Property
+
+ Private m_Uuid As String
+ '''
+ ''' Property that read and write to the tool's database the Uuid
+ '''
+ Friend ReadOnly Property Uuid As String
+ Get
+ Return m_Uuid
+ End Get
+ End Property
+
+ Sub New(Name As String, ExitPar As String, Type As Integer, Head As String, TcPos As String, Uuid As String, IsInCurrMachGroup As Boolean)
+ MyBase.New(Name)
+ m_Exit = ExitPar
+ m_Type = DirectCast(Type, MCH_TY)
+ m_Head = Head
+ m_TcPos = TcPos
+ m_Uuid = Uuid
+ m_IsInCurrMachGroup = IsInCurrMachGroup
+ End Sub
+
+End Class
diff --git a/StatusBar/StatusBarViewModel.vb b/StatusBar/StatusBarViewModel.vb
index ce1670b..fb97db2 100644
--- a/StatusBar/StatusBarViewModel.vb
+++ b/StatusBar/StatusBarViewModel.vb
@@ -147,6 +147,7 @@ Namespace EgtCAM5
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
If EgtSetCurrMachine(value.Name) Then
m_SelectedMachine = value
+ IniFile.m_sMachineName = m_SelectedMachine.Name
IniFile.m_sCurrMachIniFilePath = m_SelectedMachine.MachineDirPath & "\" & m_SelectedMachine.Name & ".ini"
IniFile.m_sCurrMachToolsDirPath = m_SelectedMachine.MachineDirPath & "\Tools"
IniFile.m_sCurrMachScriptsDirPath = m_SelectedMachine.MachineDirPath & "\Scripts"
diff --git a/ToolsDbWindow/ToolTreeView.vb b/ToolsDbWindow/ToolTreeView.vb
index 140739c..6d20b93 100644
--- a/ToolsDbWindow/ToolTreeView.vb
+++ b/ToolsDbWindow/ToolTreeView.vb
@@ -817,7 +817,7 @@ Public Class ToolTreeViewItem
If value = String.Empty Or value <> m_TcPos Then
Dim DbTcPos As String = String.Empty
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
- EgtTdbGetCurrToolParam(MCH_TP.USERNOTES, DbTcPos)
+ EgtTdbGetCurrToolParam(MCH_TP.TCPOS, DbTcPos)
m_IsModifiedTcPos = If(value <> DbTcPos, True, False)
m_TcPos = value
NotifyPropertyChanged("TcPos")
diff --git a/Utility.vb b/Utility.vb
index 1aa8d44..9ffe21f 100644
--- a/Utility.vb
+++ b/Utility.vb
@@ -89,6 +89,16 @@ Public Module Utility
End Structure
+ '''
+ ''' Structure that represent a tool's family, containing family type and family name
+ '''
+ Structure ToolsFamily
+
+ Friend FamilyId As MCH_TF
+ Friend FamilyName As String
+
+ End Structure
+
#Region "Positioning test"
Public Class WinPos