diff --git a/Application.xaml.vb b/Application.xaml.vb
index f88df09..150da68 100644
--- a/Application.xaml.vb
+++ b/Application.xaml.vb
@@ -165,7 +165,8 @@ Class Application
Friend Const SELECTEDOPERATION As String = "SelectedOperation"
' MachiningGroupPanel
- Friend Const LOADMACHGROUP As String = "LoadMachGroup"
+ Friend Const INITIALIZEMACHGROUPS As String = "InitializeMachGroups"
+ Friend Const MACHGROUPSRESULT As String = "MachGroupsResult"
' MachiningOptionPanel
' MachiningTreeViewExpander
diff --git a/Constants/ConstIni.vb b/Constants/ConstIni.vb
index 01ebd56..8d7b7fe 100644
--- a/Constants/ConstIni.vb
+++ b/Constants/ConstIni.vb
@@ -106,6 +106,10 @@ Module ConstIni
Public Const K_SELGEOMMORTISING As String = "SelGeomMortising"
Public Const K_SELGEOMSAWROUGHING As String = "SelGeomSawRoughing"
Public Const K_SELGEOMSAWFINISHING As String = "SelGeomSawFinishing"
+ Public Const K_MACHININGGROUP As String = "MachiningGroup"
+
+ Public Const S_TABLE As String = "Table"
+ Public Const K_TABLESDIR As String = "TablesDir"
Public Const S_SIMUL As String = "Simul"
Public Const K_SLIDERX As String = "SliderX"
diff --git a/Constants/ConstMachIni.vb b/Constants/ConstMachIni.vb
index dd7be0e..7122c78 100644
--- a/Constants/ConstMachIni.vb
+++ b/Constants/ConstMachIni.vb
@@ -35,4 +35,7 @@
Public Const K_MANUALPOS As String = "ManualPos"
Public Const K_MANUALNAME As String = "ManualName"
+ Public Const S_DISPOSITION As String = "Disposition"
+ Public Const K_INITSCRIPT As String = "InitScript"
+
End Module
diff --git a/Constants/ConstMsg.vb b/Constants/ConstMsg.vb
index d495e5c..5e1f541 100644
--- a/Constants/ConstMsg.vb
+++ b/Constants/ConstMsg.vb
@@ -10,6 +10,8 @@
Public Const MSG_GRIDVIEWPANEL As Integer = MSG_EGTCAM5 + 250
Public Const MSG_SIMULATION As Integer = MSG_EGTCAM5 + 300
Public Const MSG_OPERATION As Integer = MSG_EGTCAM5 + 400
+ Public Const MSG_DISPOSITION As Integer = MSG_EGTCAM5 + 430
+ Public Const MSG_DISPOSITIONERRORS As Integer = MSG_EGTCAM5 + 460
Public Const MSG_TOOLSDBPAGE As Integer = MSG_EGTCAM5 + 1000
Public Const MSG_TOOLSERRORS As Integer = MSG_EGTCAM5 + 1100
Public Const MSG_MACHININGSDBPAGE As Integer = MSG_EGTCAM5 + 1200
diff --git a/EgtCAM5.vbproj b/EgtCAM5.vbproj
index 1589104..769b330 100644
--- a/EgtCAM5.vbproj
+++ b/EgtCAM5.vbproj
@@ -131,6 +131,10 @@
+
+ MTableDbView.xaml
+
+ OptionsView.xaml
@@ -241,6 +245,10 @@
DesignerMSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+ DesignerMSBuild:Compile
diff --git a/IniFile.vb b/IniFile.vb
index 5e5d58b..931bffd 100644
--- a/IniFile.vb
+++ b/IniFile.vb
@@ -27,6 +27,7 @@ Module IniFile
Friend m_sIniFile As String
Friend m_sTempDir As String
Friend m_sMachinesRoot As String
+ Friend m_sTablesRoot As String
Friend m_ProjectMode As ProjectModeOpt
Friend m_bMmUnits As Boolean
@@ -54,10 +55,13 @@ Module IniFile
Friend m_sMachineName As String
Friend m_sCurrMachIniFilePath As String
Friend m_sCurrMachToolsDirPath As String
+ Friend m_sCurrMachScriptsDirPath As String
' Variabile che contiene la path della cartella che contiene i ToolMaker
Friend m_sToolMakersDir As String = String.Empty
' Variabile che contiene il contesto della scena presente nel database utensili
Friend m_ToolsDbSceneContext As Integer = 0
+ ' Variabile che dice se sono abilitati i gruppi di lavorazione
+ Friend m_bMachiningGroup As Boolean
Public Function GetPrivateProfileInt(IpAppName As String, IpKeyName As String, nDefault As Integer) As Integer
Return EgtUILib.GetPrivateProfileInt(IpAppName, IpKeyName, nDefault, m_sIniFile)
diff --git a/MTableDb/MTableDbView.xaml b/MTableDb/MTableDbView.xaml
new file mode 100644
index 0000000..187c6aa
--- /dev/null
+++ b/MTableDb/MTableDbView.xaml
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MTableDb/MTableDbView.xaml.vb b/MTableDb/MTableDbView.xaml.vb
new file mode 100644
index 0000000..8f37f4d
--- /dev/null
+++ b/MTableDb/MTableDbView.xaml.vb
@@ -0,0 +1,3 @@
+Public Class MTableDbView
+
+End Class
diff --git a/MTableDb/MTableDbViewModel.vb b/MTableDb/MTableDbViewModel.vb
new file mode 100644
index 0000000..b6da7db
--- /dev/null
+++ b/MTableDb/MTableDbViewModel.vb
@@ -0,0 +1,52 @@
+Imports System.Collections.ObjectModel
+Imports System.IO
+Imports EgtUILib
+
+Namespace EgtCAM5
+
+ Public Class MTableDbViewModel
+ Inherits TabViewModel
+
+ Private m_TablesList As New ObservableCollection(Of String)
+ Public Property TablesList As ObservableCollection(Of String)
+ Get
+ Return m_TablesList
+ End Get
+ Set(value As ObservableCollection(Of String))
+ m_TablesList = value
+ End Set
+ End Property
+
+ Private m_Title As String
+ Public ReadOnly Property Title As String
+ Get
+ Return EgtMsg(MSG_MAINWINDOW + 20)
+ End Get
+ End Property
+
+ Sub New()
+ SearchTables()
+ End Sub
+
+ Private Sub SearchTables()
+ '' Leggo dal file ini il direttorio per le Table
+ 'If GetPrivateProfileString(S_TABLE, K_TABLESDIR, "", m_sTablesRoot) = 0 _
+ ' Or not My.Computer.FileSystem.DirectoryExists(m_sTablesRoot) Then
+ ' ' Se non lo trovo mando messaggio di errore e chiudo la finestra
+ ' MessageBox.Show("ERROR IN LOADING TABLES", "Tables dir not found.")
+ 'End If
+ ' se trovo la cartella carico la lista di tabelle
+
+
+ Dim TempArray As String() = Directory.GetDirectories(IniFile.m_sMachinesRoot)
+ If TempArray.Count = 0 Then
+ 'esci
+ End If
+ For Each Table In My.Computer.FileSystem.GetFiles("c:\EgtData\Doors\MTables\")
+ m_TablesList.Add(Path.GetFileNameWithoutExtension(Table))
+ Next
+ End Sub
+
+ End Class
+
+End Namespace
\ No newline at end of file
diff --git a/ProjectPage/DbPanel/DbPanelView.xaml b/ProjectPage/DbPanel/DbPanelView.xaml
index ff630b4..47eabea 100644
--- a/ProjectPage/DbPanel/DbPanelView.xaml
+++ b/ProjectPage/DbPanel/DbPanelView.xaml
@@ -7,6 +7,8 @@
Style="{StaticResource GridViewPanelButton}" Width="55" Content="ToolDb"/>
+
diff --git a/ProjectPage/DbPanel/DbPanelViewModel.vb b/ProjectPage/DbPanel/DbPanelViewModel.vb
index 92fbb4c..e7af093 100644
--- a/ProjectPage/DbPanel/DbPanelViewModel.vb
+++ b/ProjectPage/DbPanel/DbPanelViewModel.vb
@@ -10,6 +10,7 @@ Namespace EgtCAM5
' Definizione comandi
Private m_cmdToolDb As ICommand
Private m_cmdMachDb As ICommand
+ Private m_cmdMTableDb As ICommand
#End Region 'FIELDS & PROPERTIES
@@ -85,8 +86,35 @@ Namespace EgtCAM5
#End Region ' MachDbCommand
-#End Region ' COMMANDS
+#Region "MachDbCommand"
+ '''
+ ''' Returns a command that do Exec.
+ '''
+ Public ReadOnly Property MTableDbCommand As ICommand
+ Get
+ If m_cmdMTableDb Is Nothing Then
+ m_cmdMTableDb = New RelayCommand(AddressOf MTableDb)
+ End If
+ Return m_cmdMTableDb
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Sub MTableDb(ByVal param As Object)
+ Dim MTableDbWindow As New MTableDbView
+ MTableDbWindow.Height = 614
+ MTableDbWindow.Width = 1024
+ MTableDbWindow.DataContext = New MTableDbViewModel
+ MTableDbWindow.Owner = Application.Current.MainWindow
+ MTableDbWindow.ShowDialog()
+ End Sub
+
+#End Region ' MachDbCommand
+
+#End Region ' COMMANDS
End Class
diff --git a/ProjectPage/MachGroupPanel/MachGroupPanelView.xaml b/ProjectPage/MachGroupPanel/MachGroupPanelView.xaml
index 15d171c..a8a3153 100644
--- a/ProjectPage/MachGroupPanel/MachGroupPanelView.xaml
+++ b/ProjectPage/MachGroupPanel/MachGroupPanelView.xaml
@@ -14,12 +14,12 @@
+ Command="{Binding DataContext.SetCurrMachGroupCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" CommandParameter="{Binding}"/>
+ Margin="0,0,5,0" Command="{Binding AddMachGroupCommand}" IsEnabled="False"/>
diff --git a/ProjectPage/MachGroupPanel/MachGroupPanelViewModel.vb b/ProjectPage/MachGroupPanel/MachGroupPanelViewModel.vb
index e9971a8..9963ed7 100644
--- a/ProjectPage/MachGroupPanel/MachGroupPanelViewModel.vb
+++ b/ProjectPage/MachGroupPanel/MachGroupPanelViewModel.vb
@@ -6,6 +6,8 @@ Namespace EgtCAM5
Public Class MachGroupPanelViewModel
Inherits ViewModelBase
+#Region "FIELDS & PROPERTIES"
+
Private m_MachGroupList As New ObservableCollection(Of String)
Public Property MachGroupList As ObservableCollection(Of String)
Get
@@ -18,7 +20,48 @@ Namespace EgtCAM5
End Set
End Property
+ ' Definizione comandi
+ Private m_cmdSetCurrMachGroup As ICommand
+ 'Private m_cmdAddMachGroup As ICommand
+
+#End Region ' FIELDS & PROPERTIES
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ Application.Msn.Register(Application.INITIALIZEMACHGROUPS, Sub()
+ InitializeMachGroups()
+ End Sub)
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "METHODS"
+
+ Private Sub InitializeMachGroups()
+ Dim bOk As Boolean
+ Dim nId = EgtGetFirstMachGroup()
+ If nId <> GDB_ID.NULL Then
+ bOk = EgtSetCurrMachGroup(nId)
+ Else
+ bOk = (EgtAddMachGroup("Mach01") <> GDB_ID.NULL)
+ Dim sInitScriptPath As String = String.Empty
+ GetPrivateProfileString(S_DISPOSITION, K_INITSCRIPT, "", sInitScriptPath)
+ If bOk And Not String.IsNullOrEmpty(sInitScriptPath) Then
+ sInitScriptPath = IniFile.m_sCurrMachScriptsDirPath & "\" & sInitScriptPath
+ If Not EgtLuaExecFile(sInitScriptPath) Then
+ EgtOutLog("Error executing disposition init script " & sInitScriptPath)
+ MessageBox.Show(EgtMsg(MSG_DISPOSITIONERRORS + 1), EgtMsg(MSG_DISPOSITIONERRORS + 2) & " " & sInitScriptPath, MessageBoxButton.OK, MessageBoxImage.Exclamation)
+ End If
+ End If
+ End If
+ LoadMachGroups()
+ Application.Msn.NotifyColleagues(Application.MACHGROUPSRESULT, bOk)
+ End Sub
+
Private Sub LoadMachGroups()
+ ' Pulisco la lista
+ MachGroupList.Clear()
' Carico i gruppi di lavorazione nella lista
Dim nId = EgtGetFirstMachGroup()
While nId <> GDB_ID.NULL
@@ -29,12 +72,34 @@ Namespace EgtCAM5
End While
End Sub
- Sub New()
- Application.Msn.Register(Application.LOADMACHGROUP, Sub()
- LoadMachGroups()
- End Sub)
+#End Region
+
+#Region "COMMANDS"
+
+#Region "SetCurrMachGroupCommand"
+
+ '''
+ ''' Returns a command that set the selected MachGroup as the Current one.
+ '''
+ Public ReadOnly Property SetCurrMachGroupCommand As ICommand
+ Get
+ If m_cmdSetCurrMachGroup Is Nothing Then
+ m_cmdSetCurrMachGroup = New RelayCommand(AddressOf SetCurrMachGroup)
+ End If
+ Return m_cmdSetCurrMachGroup
+ End Get
+ End Property
+
+ Public Sub SetCurrMachGroup(ByVal param As Object)
+ EgtSetCurrMachGroup(EgtGetMachGroupId(DirectCast(param, String)))
+ EgtDraw()
+ Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST, -1)
End Sub
+#End Region ' SetCurrMachGroupCommand
+
+#End Region ' COMMANDS
+
End Class
End Namespace
\ No newline at end of file
diff --git a/ProjectPage/ProjectView.xaml.vb b/ProjectPage/ProjectView.xaml.vb
index ff3aeac..e888ad0 100644
--- a/ProjectPage/ProjectView.xaml.vb
+++ b/ProjectPage/ProjectView.xaml.vb
@@ -12,6 +12,8 @@ Public Class ProjectView
ViewPanel.IsFloating = False
InstrumentPanel.IsFloating = False
GridPanel.IsFloating = False
+ DbPanel.IsFloating = False
+ ExecutePanel.IsFloating = False
DoorsPanel.IsFloating = False
DrawPanel.IsFloating = False
OptionPanel.IsFloating = False
@@ -59,7 +61,7 @@ Public Class ProjectView
DoorsPanel.Visibility = Visibility.Collapsed
DrawPanel.Visibility = Visibility.Collapsed
OptionPanel.Visibility = Visibility.Visible
- MachGroupPanel.Visibility = Visibility.Visible
+ MachGroupPanel.Visibility = If(IniFile.m_bMachiningGroup, Visibility.Visible, Visibility.Collapsed)
End Sub)
End Sub
diff --git a/ProjectPage/ProjectViewModel.vb b/ProjectPage/ProjectViewModel.vb
index d1f7e41..338674e 100644
--- a/ProjectPage/ProjectViewModel.vb
+++ b/ProjectPage/ProjectViewModel.vb
@@ -225,6 +225,8 @@ Namespace EgtCAM5
' visualizzazione avanzata dei triangoli costituenti le superfici
Dim bShowTriaAdv As Boolean = (GetPrivateProfileInt(S_SCENE, K_SHOWTRIAADV, 1) <> 0)
EgtSetShowTriaAdv(bShowTriaAdv)
+ ' lettura da ini della variabile che abilita i gruppi di lavorazione
+ IniFile.m_bMachiningGroup = (GetPrivateProfileInt(S_MACH, K_MACHININGGROUP, 1) <> 0)
Application.Msn.NotifyColleagues(Application.DRAWMODE_ISCHECKED)
' ObjTree non selezionato
Application.Msn.NotifyColleagues(Application.UPDATEOBJTREEOLDID, GDB_ID.NULL)
diff --git a/StatusBar/StatusBarViewModel.vb b/StatusBar/StatusBarViewModel.vb
index c3aef49..df40a4f 100644
--- a/StatusBar/StatusBarViewModel.vb
+++ b/StatusBar/StatusBarViewModel.vb
@@ -143,6 +143,7 @@ Namespace EgtCAM5
m_SelectedMachine = value
IniFile.m_sCurrMachIniFilePath = m_SelectedMachine.MachineDirPath & "\" & m_SelectedMachine.Name & ".ini"
IniFile.m_sCurrMachToolsDirPath = m_SelectedMachine.MachineDirPath & "\Tools"
+ IniFile.m_sCurrMachScriptsDirPath = m_SelectedMachine.MachineDirPath & "\Scripts"
OnPropertyChanged("SelectedMachine")
End If
End If
diff --git a/TopCommandBar/TopCommandBarViewModel.vb b/TopCommandBar/TopCommandBarViewModel.vb
index b19a945..3abb81d 100644
--- a/TopCommandBar/TopCommandBarViewModel.vb
+++ b/TopCommandBar/TopCommandBarViewModel.vb
@@ -99,24 +99,7 @@ Namespace EgtCAM5
If value <> m_MachiningIsChecked Then
m_MachiningIsChecked = value
If value Then
- Application.Msn.NotifyColleagues(Application.LOADMACHGROUP)
- Dim bOk As Boolean
- Dim nId = EgtGetFirstMachGroup()
- If nId <> GDB_ID.NULL Then
- bOk = EgtSetCurrMachGroup(nId)
- Else
- bOk = (EgtAddMachGroup("Mach01") <> GDB_ID.NULL)
- End If
- If bOk Then
- Application.Msn.NotifyColleagues(Application.UPDATECURRENTMACHINE)
- Application.Msn.NotifyColleagues(Application.MACHININGMODE_ISCHECKED)
- EgtZoom(ZM.ALL)
- Else
- m_MachiningIsChecked = False
- ' Error loading or creating Machining Group - Error
- MessageBox.Show(EgtMsg(10008), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error)
- End If
- IniFile.m_ProjectMode = ProjectModeOpt.MACHINING
+ Application.Msn.NotifyColleagues(Application.INITIALIZEMACHGROUPS)
Else
' Deevidenzio l'ultima operazione evidenziata
Application.Msn.NotifyColleagues(Application.REMOVEMARKFROMLASTOPERATION)
@@ -138,6 +121,18 @@ Namespace EgtCAM5
MachiningIsChecked = True
OnPropertyChanged("MachiningIsChecked")
End Sub)
+ Application.Msn.Register(Application.MACHGROUPSRESULT, Sub(bOk As Boolean)
+ If bOk Then
+ Application.Msn.NotifyColleagues(Application.UPDATECURRENTMACHINE)
+ Application.Msn.NotifyColleagues(Application.MACHININGMODE_ISCHECKED)
+ EgtZoom(ZM.ALL)
+ IniFile.m_ProjectMode = ProjectModeOpt.MACHINING
+ Else
+ m_MachiningIsChecked = False
+ ' Error loading or creating Machining Group - Error
+ MessageBox.Show(EgtMsg(10008), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error)
+ End If
+ End Sub)
End Sub
#End Region