diff --git a/EgtCAM5.vbproj b/EgtCAM5.vbproj
index 321c8ed..a487643 100644
--- a/EgtCAM5.vbproj
+++ b/EgtCAM5.vbproj
@@ -159,7 +159,7 @@
EstimationsExpanderV.xaml
-
+
StoneMillingParameterExpanderV.xaml
@@ -215,6 +215,7 @@
OperationsListExpanderV.xaml
+
MachineBox.xaml
@@ -379,7 +380,6 @@
SimulationExpanderV.xaml
-
ProjectV.xaml
diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb
index 1363a5c..f46b238 100644
--- a/My Project/AssemblyInfo.vb
+++ b/My Project/AssemblyInfo.vb
@@ -70,6 +70,6 @@ Imports System.Windows
' by using the '*' as shown below:
'
-
-
+
+
diff --git a/OptionPanel/MachiningOptionPanel/EstimationsExpander/EstimationsExpanderVM.vb b/OptionPanel/MachiningOptionPanel/EstimationsExpander/EstimationsExpander.vb
similarity index 68%
rename from OptionPanel/MachiningOptionPanel/EstimationsExpander/EstimationsExpanderVM.vb
rename to OptionPanel/MachiningOptionPanel/EstimationsExpander/EstimationsExpander.vb
index 8fd1a22..832c5be 100644
--- a/OptionPanel/MachiningOptionPanel/EstimationsExpander/EstimationsExpanderVM.vb
+++ b/OptionPanel/MachiningOptionPanel/EstimationsExpander/EstimationsExpander.vb
@@ -1,9 +1,10 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtUILib
+Imports EgtWPFLib5
Public Class EstimationsExpanderVM
- Inherits ViewModelBase
+ Inherits EstimationsVM
#Region "FIELDS & PROPERTIES"
@@ -28,90 +29,11 @@ Public Class EstimationsExpanderVM
End Get
Set(value As Boolean)
m_Estimation_IsEnabled = value
- OnPropertyChanged("Estimation_IsEnabled")
+ NotifyPropertyChanged("Estimation_IsEnabled")
End Set
End Property
- Public ReadOnly Property TotalTime As String
- Get
- Dim nTotalTime As Integer = 0
- EgtGetInfo(EgtGetCurrMachGroup(), "Ttot", nTotalTime)
- Dim sTotalTime As New TimeSpan(0, 0, nTotalTime)
- Return sTotalTime.ToString("hh\:mm\:ss")
- End Get
- End Property
-
- Public ReadOnly Property TotalLength As String
- Get
- Dim dTotalLength As Double = 0
- EgtGetInfo(EgtGetCurrMachGroup(), "Ltot", dTotalLength)
- Dim sTotalLength As String = ""
- If EgtUiUnitsAreMM() Then
- sTotalLength = DoubleToString(dTotalLength / 1000, 1) & " m"
- Else
- sTotalLength = DoubleToString(dTotalLength / (ONEINCH * 12), 1) & " ft"
- End If
- Return sTotalLength
- End Get
- End Property
-
- ' Definizione comandi
- Private m_cmdDetails As ICommand
-
-#Region "Messages"
-
- Public ReadOnly Property SimulationMsg As String
- Get
- Return EgtMsg(MSG_SIMULATION + 7) 'Simulazione
- End Get
- End Property
-
- Public ReadOnly Property EstimationMsg As String
- Get
- Return EgtMsg(MSG_SIMULATION + 40) 'Stime
- End Get
- End Property
-
- Public ReadOnly Property TotalTimeMsg As String
- Get
- Return EgtMsg(MSG_SIMULATION + 41) 'Tempo totale
- End Get
- End Property
-
- Public ReadOnly Property TotalLengthMsg As String
- Get
- Return EgtMsg(MSG_SIMULATION + 42) 'Lunghezza totale
- End Get
- End Property
- Public ReadOnly Property DetailsMsg As String
- Get
- Return EgtMsg(MSG_SIMULATION + 43) 'Dettagli
- End Get
- End Property
-
-#End Region
-
-#Region "ToolTip"
-
- Public ReadOnly Property OneStepToolTip As String
- Get
- Return EgtMsg(MSG_SIMULATION + 8)
- End Get
- End Property
- Public ReadOnly Property PlayPauseToolTip As String
- Get
- Return EgtMsg(MSG_SIMULATION + 9)
- End Get
- End Property
- Public ReadOnly Property StopHomeToolTip As String
- Get
- Return EgtMsg(MSG_SIMULATION + 10)
- End Get
- End Property
-
-#End Region
-
-#End Region
+#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
@@ -119,28 +41,13 @@ Public Class EstimationsExpanderVM
SetRefEstimationsExpanderVM(Me)
End Sub
-#End Region
+#End Region ' CONSTRUCTOR
#Region "COMMANDS"
#Region "Details"
- '''
- ''' Returns a command that create a new tool.
- '''
- Public ReadOnly Property Details_Command As ICommand
- Get
- If m_cmdDetails Is Nothing Then
- m_cmdDetails = New RelayCommand(AddressOf Details)
- End If
- Return m_cmdDetails
- End Get
- End Property
-
- '''
- ''' Creata the new tool. This method is invoked by the NewCommand.
- '''
- Public Sub Details(ByVal param As Object)
+ Public Overrides Sub Details(ByVal param As Object)
' Determino il nome del file contenente le stime
Dim sEstFile As String = ""
Dim sInfo As String = ""
@@ -158,7 +65,7 @@ Public Class EstimationsExpanderVM
#End Region ' Details
-#End Region
+#End Region ' COMMANDS
#Region "METHODS"
@@ -170,13 +77,13 @@ Public Class EstimationsExpanderVM
' Abilito la selezione di tutti i tipi di geometria
Map.refProjectVM.SceneSelMode = SceneSelModeOpt.PARTCURVESANDSURFACES
CalcEstimation()
- OnPropertyChanged("TotalTime")
- OnPropertyChanged("TotalLength")
+ NotifyPropertyChanged("Time")
+ NotifyPropertyChanged("CutLen")
m_Estimation_IsExpanded = True
Map.refOperationParametersExpanderVM.OperParamsViewIsEnabled = False
Map.refOperationsListExpanderVM.EstimationExpander_Get_IsExpanded(True)
- OnPropertyChanged("Estimation_IsExpanded")
+ NotifyPropertyChanged("Estimation_IsExpanded")
Map.refMachiningOptionPanelVM.OnPropertyChanged("GenerateIsEnabled")
' disattivo database utensili, lavorazioni e setup se vado in stima
Map.refMachinePanelVM.ToolMachSetUpIsEnabled(False, False, False)
@@ -187,13 +94,14 @@ Public Class EstimationsExpanderVM
m_Estimation_IsExpanded = False
Map.refOperationParametersExpanderVM.OperParamsViewIsEnabled = True
Map.refOperationsListExpanderVM.EstimationExpander_Get_IsExpanded(False)
- OnPropertyChanged("Estimation_IsExpanded")
+ NotifyPropertyChanged("Estimation_IsExpanded")
Map.refMachiningOptionPanelVM.OnPropertyChanged("GenerateIsEnabled")
' disattivo database utensili, lavorazioni e setup se vado in stima
Map.refMachinePanelVM.ToolMachSetUpIsEnabled(True, True, True)
Return True
End Function
+
Private Function UpdateAllMachinings() As Boolean
' Eseguo ricalcolo
Dim bModified As Boolean = EgtGetModified()
@@ -211,7 +119,7 @@ Public Class EstimationsExpanderVM
Return bOk
End Function
- Private Function GetEstimationFileName(bAskSave As Boolean, ByRef sEstFile As String, ByRef sInfo As String) As Boolean
+ Public Overrides Function GetEstimationFileName(bAskSave As Boolean, ByRef sEstFile As String, ByRef sInfo As String) As Boolean
Dim bOk As Boolean = True
' Recupero e verifico la path del progetto corrente
Dim sCurrFilePath As String = String.Empty
@@ -295,6 +203,6 @@ Public Class EstimationsExpanderVM
Return bOk
End Function
-#End Region
+#End Region ' METHODS
-End Class
\ No newline at end of file
+End Class
diff --git a/OptionPanel/MachiningOptionPanel/EstimationsExpander/EstimationsExpanderV.xaml b/OptionPanel/MachiningOptionPanel/EstimationsExpander/EstimationsExpanderV.xaml
index 79b2f56..4d8c339 100644
--- a/OptionPanel/MachiningOptionPanel/EstimationsExpander/EstimationsExpanderV.xaml
+++ b/OptionPanel/MachiningOptionPanel/EstimationsExpander/EstimationsExpanderV.xaml
@@ -15,8 +15,8 @@
-
-
+
@@ -24,8 +24,8 @@
-
-
+
diff --git a/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderVM.vb b/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderVM.vb
index 0dcaeb4..c12baa3 100644
--- a/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderVM.vb
+++ b/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderVM.vb
@@ -1,54 +1,17 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtUILib
+Imports EgtWPFLib5
Public Class SimulationExpanderVM
- Inherits ViewModelBase
+ Inherits SimulationVM
#Region "FIELDS & PROPERTIES"
- 'EGT PROPERTIES
- ' Stato di visualizzazione della macchina
- Private m_nMachLook As Integer = MCH_LOOK.ALL
- ' Utensile corrente
- Private m_sCurrTool As String = String.Empty
- Private m_nStatus As MCH_SIM_ST = MCH_SIM_ST.UI_STOP
- Private Property SimulationStatus As MCH_SIM_ST
- Get
- Return m_nStatus
- End Get
- Set(value As MCH_SIM_ST)
- m_nStatus = value
- If IniFile.m_nUserLevel >= 5 AndAlso (value = MCH_SIM_ST.UI_PAUSE OrElse value = MCH_SIM_ST.UI_STOP) Then
- For Index = 0 To m_MachineAxisList.Count - 1
- m_MachineAxisList(Index).IsReadOnlyAxesValue = False
- Next
- Else
- For Index = 0 To m_MachineAxisList.Count - 1
- m_MachineAxisList(Index).IsReadOnlyAxesValue = True
- Next
- End If
- EgtSimSetUiStatus(m_nStatus)
- End Set
- End Property
-
- ' Stato bottone Play
- Private m_bShowPlay As Boolean = True
- ' Coefficiente per valore Slider
- Private m_SliderX As Double = 1
-
- ' Flag di esecuzione in corso
- Private m_bSimExecuting As Boolean = False
- Public ReadOnly Property bSimExecuting As Boolean
- Get
- Return m_bSimExecuting
- End Get
- End Property
-
'GRAPHICAL PROPERTIES
Private m_Simulation_IsExpanded As Boolean
- Public Property Simulation_IsExpanded As Boolean
+ Public Overridable Property Simulation_IsExpanded As Boolean
Get
Return m_Simulation_IsExpanded
End Get
@@ -66,107 +29,11 @@ Public Class SimulationExpanderVM
End Get
Set(value As Boolean)
m_Simulation_IsEnabled = value
- OnPropertyChanged("Simulation_IsEnabled")
+ NotifyPropertyChanged("Simulation_IsEnabled")
End Set
End Property
- ' lista degli assi
- Private m_MachineAxisList As New ObservableCollection(Of MachineAxis)
- Public ReadOnly Property MachineAxisList As ObservableCollection(Of MachineAxis)
- Get
- Return m_MachineAxisList
- End Get
- End Property
-
- Private m_GCode As String
- Public Property GCode As String
- Get
- Return m_GCode
- End Get
- Set(value As String)
- If value <> m_GCode Then
- m_GCode = value
- OnPropertyChanged("GCode")
- End If
- End Set
- End Property
-
- Private m_FValue As String
- Public Property FValue As String
- Get
- Return m_FValue
- End Get
- Set(value As String)
- If value <> m_FValue Then
- m_FValue = value
- OnPropertyChanged("FValue")
- End If
- End Set
- End Property
-
- Private m_TName As String
- Public Property TName As String
- Get
- Return m_TName
- End Get
- Set(value As String)
- If value <> m_TName Then
- m_TName = value
- OnPropertyChanged("TName")
- End If
- End Set
- End Property
-
- Private m_SValue As String
- Public Property SValue As String
- Get
- Return m_SValue
- End Get
- Set(value As String)
- If value <> m_SValue Then
- m_SValue = value
- OnPropertyChanged("SValue")
- End If
- End Set
- End Property
-
- Private m_OpeName As String
- Public Property OpeName As String
- Get
- Return m_OpeName
- End Get
- Set(value As String)
- If value <> m_OpeName Then
- m_OpeName = value
- OnPropertyChanged("OpeName")
- End If
- End Set
- End Property
-
- Private m_PlayPauseImage As String
- Public ReadOnly Property PlayPauseImage As String
- Get
- If m_bShowPlay Then
- Return "/Resources/OptionPanel/MachiningOptionPanel/SimulationExpander/Play.png"
- Else
- Return "/Resources/OptionPanel/MachiningOptionPanel/SimulationExpander/Pause.png"
- End If
- End Get
- End Property
-
- Private m_StatusMsg As String
- Public Property StatusMsg As String
- Get
- Return m_StatusMsg
- End Get
- Set(value As String)
- m_StatusMsg = value
- OnPropertyChanged("StatusMsg")
- End Set
- End Property
-
- Private m_SliderValue As Double
- Public Property SliderValue As Double
+ Public Overrides Property SliderValue As Double
Get
Return m_SliderValue
End Get
@@ -174,97 +41,13 @@ Public Class SimulationExpanderVM
value = Math.Max(1, Math.Min(value, 100))
If Math.Abs(value - m_SliderValue) > 1 Then
m_SliderValue = value
- OnPropertyChanged("SliderValue")
+ NotifyPropertyChanged("SliderValue")
End If
- EgtSimSetStep(value * m_SliderX)
+ EgtSimSetStep(value * GetSliderX())
End Set
End Property
- Private m_VMillActive As Boolean = False
- Public Property VMillActive As Boolean
- Get
- Return m_VMillActive
- End Get
- Set(value As Boolean)
- m_VMillActive = value
- OnPropertyChanged("VMillActive")
- If m_VMillActive Then
- EgtSetInfo(EgtGetCurrMachGroup(), KEY_MCHGRP_VM, m_VMillActive)
- Else
- EgtRemoveInfo(EgtGetCurrMachGroup(), KEY_MCHGRP_VM)
- End If
- Application.Msn.NotifyColleagues(Application.EMITTITLE)
- End Set
- End Property
- Public Sub SetVMillActive(value As Boolean)
- m_VMillActive = value
- OnPropertyChanged("VMillActive")
- End Sub
-
- Private m_VMill_Visibility As Visibility = Visibility.Collapsed
- Public Property VMill_Visibility As Visibility
- Get
- Return m_VMill_Visibility
- End Get
- Set(value As Visibility)
- m_VMill_Visibility = value
- OnPropertyChanged("VMill_Visibility")
- End Set
- End Property
-
- Private m_VMill_IsEnabled As Boolean = False
- Public Property VMill_IsEnabled As Boolean
- Get
- Return m_VMill_IsEnabled
- End Get
- Set(value As Boolean)
- m_VMill_IsEnabled = value
- OnPropertyChanged("VMill_IsEnabled")
- End Set
- End Property
-
- ' Definizione comandi
- Private m_cmdStep As ICommand
- Private m_cmdPlayPause As ICommand
- Private m_cmdStop As ICommand
-
-#Region "Messages"
-
- Public ReadOnly Property SimulationMsg As String
- Get
- Return EgtMsg(MSG_SIMULATION + 7) 'Simulazione
- End Get
- End Property
-
- Public ReadOnly Property VMillMsg As String
- Get
- Return EgtMsg(MSG_SIMULATION + 16) 'Virtual Milling
- End Get
- End Property
-
-#End Region
-
-#Region "ToolTip"
-
- Public ReadOnly Property OneStepToolTip As String
- Get
- Return EgtMsg(MSG_SIMULATION + 8)
- End Get
- End Property
- Public ReadOnly Property PlayPauseToolTip As String
- Get
- Return EgtMsg(MSG_SIMULATION + 9)
- End Get
- End Property
- Public ReadOnly Property StopHomeToolTip As String
- Get
- Return EgtMsg(MSG_SIMULATION + 10)
- End Get
- End Property
-
-#End Region
-
-#End Region
+#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
@@ -280,147 +63,15 @@ Public Class SimulationExpanderVM
ShowCncData()
End If
End Sub)
+ SimulationMsg_Const = MSG_SIMULATION
+ SetPlayImagePath("/Resources/OptionPanel/MachiningOptionPanel/SimulationExpander/Play.png")
+ SetPauseImagePath("/Resources/OptionPanel/MachiningOptionPanel/SimulationExpander/Pause.png")
End Sub
-#End Region
+#End Region ' CONSTRUCTOR
#Region "COMMANDS"
-#Region "StepCommand"
-
- '''
- ''' Returns a command that create a new tool.
- '''
- Public ReadOnly Property StepCommand As ICommand
- Get
- If m_cmdStep Is Nothing Then
- m_cmdStep = New RelayCommand(AddressOf StepCmd)
- End If
- Return m_cmdStep
- End Get
- End Property
-
- '''
- ''' Creata the new tool. This method is invoked by the NewCommand.
- '''
- Public Sub StepCmd(ByVal param As Object)
- StatusMsg = ""
- ' Disabilito check VMill
- VMill_IsEnabled = False
- ' Se stato stop, devo avviare simulazione
- If m_nStatus = MCH_SIM_ST.UI_STOP Then
- SimulationStatus = MCH_SIM_ST.UI_STEP
- ' Aggiorno bottone
- m_bShowPlay = False
- OnPropertyChanged("PlayPauseImage")
- ExecSim()
- ' Aggiorno bottone
- m_bShowPlay = True
- OnPropertyChanged("PlayPauseImage")
- ' Alrimenti imposto solo il nuovo stato
- Else
- SimulationStatus = MCH_SIM_ST.UI_STEP
- ' Aggiornamenti per bottone Play/Pause
- m_bShowPlay = False
- OnPropertyChanged("PlayPauseImage")
- End If
- End Sub
-
-#End Region ' StepCommand
-
-#Region "PlayPauseCommand"
-
- '''
- ''' Returns a command that create a new tool.
- '''
- Public ReadOnly Property PlayPauseCommand As ICommand
- Get
- If m_cmdPlayPause Is Nothing Then
- m_cmdPlayPause = New RelayCommand(AddressOf PlayPause)
- End If
- Return m_cmdPlayPause
- End Get
- End Property
-
- '''
- ''' Creata the new tool. This method is invoked by the NewCommand.
- '''
- Public Sub PlayPause(ByVal param As Object)
- StatusMsg = ""
- If m_bShowPlay Then
- ' Disabilito check VMill
- VMill_IsEnabled = False
- ' Aggiorno bottone
- m_bShowPlay = False
- OnPropertyChanged("PlayPauseImage")
- ' Eseguo
- If m_nStatus = MCH_SIM_ST.UI_STOP Then
- ' Lancio simulazione
- SimulationStatus = MCH_SIM_ST.UI_PLAY
- ExecSim()
- ' Aggiorno bottone
- m_bShowPlay = True
- OnPropertyChanged("PlayPauseImage")
- ElseIf m_nStatus = MCH_SIM_ST.UI_PAUSE Then
- SimulationStatus = MCH_SIM_ST.UI_PLAY
- End If
- Else
- ' Aggiorno bottone
- m_bShowPlay = True
- OnPropertyChanged("PlayPauseImage")
- ' Se play o step, imposto stato pausa
- If m_nStatus = MCH_SIM_ST.UI_PLAY Or m_nStatus = MCH_SIM_ST.UI_STEP Then
- SimulationStatus = MCH_SIM_ST.UI_PAUSE
- StatusMsg = EgtMsg(MSG_SIMULATION + 11) ' Pausa
- End If
- End If
- End Sub
-
-
-#End Region ' PlayPauseCommand
-
-#Region "StopCommand"
-
- '''
- ''' Returns a command that create a new tool.
- '''
- Public ReadOnly Property StopCommand As ICommand
- Get
- If m_cmdStop Is Nothing Then
- m_cmdStop = New RelayCommand(AddressOf StopCmd)
- End If
- Return m_cmdStop
- End Get
- End Property
-
- '''
- ''' Creata the new tool. This method is invoked by the NewCommand.
- '''
- Public Sub StopCmd(ByVal param As Object)
- StatusMsg = ""
- ' Abilito check VMill
- VMill_IsEnabled = True
- ' Se stato già stop, porto in home
- If m_nStatus = MCH_SIM_ST.UI_STOP Then
- ' Mi riporto all'inizio
- EgtSimStart()
- EgtDraw()
- ' Aggiorno dati CNC
- ShowCncData()
- StatusMsg = EgtMsg(MSG_SIMULATION + 14) ' Home
- Else
- StatusMsg = EgtMsg(MSG_SIMULATION + 12) ' Stop
- End If
- ' Aggiorno bottone
- m_bShowPlay = True
- OnPropertyChanged("PlayPauseImage")
- ' Imposto il nuovo stato
- SimulationStatus = MCH_SIM_ST.UI_STOP
- End Sub
-
-
-#End Region ' StopCommand
-
#Region "GenerateCommand"
'''
@@ -474,7 +125,7 @@ Public Class SimulationExpanderVM
#End Region ' GenerateCommand
-#End Region
+#End Region ' COMMANDS
#Region "METHODS"
@@ -491,13 +142,14 @@ Public Class SimulationExpanderVM
EgtShowOnlyTable(False)
EgtZoom(ZM.ALL, False)
End If
+
InitializeSimulation()
EgtDraw()
m_Simulation_IsExpanded = True
Map.refOperationParametersExpanderVM.OperParamsViewIsEnabled = False
Map.refOperationsListExpanderVM.SimulationExpander_Get_IsExpanded(True)
- OnPropertyChanged("Simulation_IsExpanded")
+ NotifyPropertyChanged("Simulation_IsExpanded")
Map.refMachiningOptionPanelVM.OnPropertyChanged("GenerateIsEnabled")
' disattivo database utensili, lavorazioni e setup se vado in simulazione
Map.refMachinePanelVM.ToolMachSetUpIsEnabled(False, False, False)
@@ -505,8 +157,8 @@ Public Class SimulationExpanderVM
End Function
Friend Function ExitSimulation() As Boolean
- If m_bSimExecuting Then Return False
- CloseSimulation()
+ If bSimExecuting Then Return False
+ ResetSimulation()
If IniFile.m_bShowOnlyTable Then
EgtShowOnlyTable(True)
EgtZoom(ZM.ALL)
@@ -516,7 +168,7 @@ Public Class SimulationExpanderVM
m_Simulation_IsExpanded = False
Map.refOperationParametersExpanderVM.OperParamsViewIsEnabled = True
Map.refOperationsListExpanderVM.SimulationExpander_Get_IsExpanded(False)
- OnPropertyChanged("Simulation_IsExpanded")
+ NotifyPropertyChanged("Simulation_IsExpanded")
Map.refMachiningOptionPanelVM.OnPropertyChanged("GenerateIsEnabled")
' disattivo database utensili, lavorazioni e setup se vado in simulazione
Map.refMachinePanelVM.ToolMachSetUpIsEnabled(True, True, True)
@@ -557,9 +209,9 @@ Public Class SimulationExpanderVM
End If
End If
' Imposto stato corrente
- SimulationStatus = MCH_SIM_ST.UI_STOP
- m_bShowPlay = True
- m_SliderX = GetPrivateProfileDouble(S_SIMUL, K_SLIDERX, 1)
+ SetSimulationStatus(MCH_SIM_ST.UI_STOP)
+ SetShowPlay(True)
+ SetSliderX(GetPrivateProfileDouble(S_SIMUL, K_SLIDERX, 1))
Dim SliderVal As Double = GetPrivateProfileDouble(S_SIMUL, K_SLIDERVAL, 10)
SliderValue = SliderVal
' Gestione check VMill
@@ -581,31 +233,14 @@ Public Class SimulationExpanderVM
StatusMsg = EgtMsg(MSG_SIMULATION + 14) ' Home
End Sub
- Private Sub CloseSimulation()
- StatusMsg = ""
- ' Mi assicuro di terminare la simulazione
- ResetSimulation()
- End Sub
-
- Private Sub ResetSimulation()
- ' Termino la simulazione
- SimulationStatus = MCH_SIM_ST.UI_STOP
- EgtSimExit()
- ' Salvo valore dello slider
- Dim sVal As String = DoubleToString(SliderValue, 1)
- WritePrivateProfileString(S_SIMUL, K_SLIDERVAL, sVal)
- ' Torno alla prima fase
- EgtSetCurrPhase(1, True)
- End Sub
-
- Private Sub ExecSim()
- m_bSimExecuting = True
+ Public Overrides Sub ExecSim()
+ SetSimExecuting(True)
IniFile.m_bSimulExecuting = True
Map.refTopCommandBarVM.DrawIsEnabled = False
Map.refOperationsListExpanderVM.OpersListViewIsEnabled = False
Map.refOperationParametersExpanderVM.OperParamsViewIsEnabled = False
Map.refMachGroupPanelVM.SetMachGroupState(False) ' Map.refMachGroupPanelVM.MachGroupPanelIsEnabled = False
- Map.refEstimationsExpanderVM.OnPropertyChanged("Estimation_IsEnabled")
+ Map.refEstimationsExpanderVM.NotifyPropertyChanged("Estimation_IsEnabled")
If Not EgtSimStart(False) Then
If EgtGetLastMachMgrErrorId() <> 0 Then
Dim sErr As String = EgtGetLastMachMgrErrorString()
@@ -615,38 +250,38 @@ Public Class SimulationExpanderVM
End If
End If
Dim nShowDataCounter As Integer = 0
- While m_nStatus <> MCH_SIM_ST.UI_STOP
+ While GetStatus() <> MCH_SIM_ST.UI_STOP
' Se simulazione in svolgimento
- If m_nStatus = MCH_SIM_ST.UI_PLAY Or m_nStatus = MCH_SIM_ST.UI_STEP Then
+ If GetStatus() = MCH_SIM_ST.UI_PLAY Or GetStatus() = MCH_SIM_ST.UI_STEP Then
' Eseguo movimento
Dim nMove As Integer
Dim bMove As Boolean = EgtSimMove(nMove)
' Se arrivato a fine step e sono in step
If bMove Then
- If m_nStatus = MCH_SIM_ST.UI_STEP And nMove = MCH_SIM.END_STEP Then
+ If GetStatus() = MCH_SIM_ST.UI_STEP And nMove = MCH_SIM.END_STEP Then
' Imposto stato Pausa
- SimulationStatus = MCH_SIM_ST.UI_PAUSE
+ SetSimulationStatus(MCH_SIM_ST.UI_PAUSE)
StatusMsg = EgtMsg(MSG_SIMULATION + 11) ' Pausa
' Aggiornamenti per bottone Play/Pause
- m_bShowPlay = True
- OnPropertyChanged("PlayPauseImage")
+ SetShowPlay(True)
+ NotifyPropertyChanged("PlayPauseImage")
End If
- ' Se movimento con collisione
- Else If nMove = MCH_SIM.COLLISION
+ ' Se movimento con collisione
+ ElseIf nMove = MCH_SIM.COLLISION Then
' Imposto stato Pausa
- SimulationStatus = MCH_SIM_ST.UI_PAUSE
+ SetSimulationStatus(MCH_SIM_ST.UI_PAUSE)
StatusMsg = EgtMsg(MSG_SIMULATION + 11) ' Pausa
' Aggiornamenti per bottone Play/Pause
- m_bShowPlay = True
- OnPropertyChanged("PlayPauseImage")
+ SetShowPlay(True)
+ NotifyPropertyChanged("PlayPauseImage")
' Messaggio
MessageBox.Show(EgtMsg(MSG_SIMULATION + 19), EgtMsg(MSG_SIMULATION + 15), MessageBoxButton.OK, MessageBoxImage.Warning)
- ' Altrimenti movimento non riuscito
+ ' Altrimenti movimento non riuscito
Else
- SimulationStatus = MCH_SIM_ST.UI_STOP
+ SetSimulationStatus(MCH_SIM_ST.UI_STOP)
' Aggiornamenti per bottone Play/Pause
- m_bShowPlay = True
- OnPropertyChanged("PlayPauseImage")
+ SetShowPlay(True)
+ NotifyPropertyChanged("PlayPauseImage")
' Abilito check VMill
VMill_IsEnabled = True
Select Case nMove
@@ -674,7 +309,7 @@ Public Class SimulationExpanderVM
' Aggiorno visualizzazione
EgtDraw()
' Aggiorno dati CNC
- If nShowDataCounter = 5 Or SimulationStatus = MCH_SIM_ST.UI_PAUSE Or SimulationStatus = MCH_SIM_ST.UI_STOP Then
+ If nShowDataCounter = 5 Or GetSimulationStatus() = MCH_SIM_ST.UI_PAUSE Or GetSimulationStatus() = MCH_SIM_ST.UI_STOP Then
ShowCncData()
nShowDataCounter = 0
ElseIf nShowDataCounter > 5 Then
@@ -689,110 +324,35 @@ Public Class SimulationExpanderVM
' Costringo ad aggiornare UI
UpdateUI()
End While
- m_bSimExecuting = False
+ SetSimExecuting(False)
IniFile.m_bSimulExecuting = False
Map.refTopCommandBarVM.DrawIsEnabled = True
Map.refOperationsListExpanderVM.OpersListViewIsEnabled = True
Map.refOperationParametersExpanderVM.OperParamsViewIsEnabled = True
Map.refMachGroupPanelVM.SetMachGroupState(True) ' Map.refMachGroupPanelVM.MachGroupPanelIsEnabled = True
- Map.refEstimationsExpanderVM.OnPropertyChanged("Estimation_IsEnabled")
+ Map.refEstimationsExpanderVM.NotifyPropertyChanged("Estimation_IsEnabled")
End Sub
- Private Sub ShowCncData()
- ' Assi
- Dim nEgtIndex As Integer = 0
- Dim nAxisIndex As Integer = 0
- Dim sName As String = String.Empty
- Dim sToken As String = String.Empty
- Dim bLinear As Boolean = True
- Dim dVal As Double = 0
- While EgtSimGetAxisInfoPos(nEgtIndex, sName, sToken, bLinear, dVal)
- If sToken <> "**" Then
- IsValidAxisIndex(nAxisIndex)
- m_MachineAxisList(nAxisIndex).Name = sName
- m_MachineAxisList(nAxisIndex).Token = sToken
- m_MachineAxisList(nAxisIndex).Linear = bLinear
- m_MachineAxisList(nAxisIndex).Value = If(bLinear, LenToString(dVal, -3), DoubleToString(dVal, -3))
- nAxisIndex += 1
- End If
- nEgtIndex += 1
- End While
- For ClearIndex = m_MachineAxisList.Count - 1 To nAxisIndex Step -1
- m_MachineAxisList.RemoveAt(ClearIndex)
- Next
- ' Tipo di movimento e feed
- ShowMoveTypeFeed()
- ' Nome utensile e speed
- ShowToolNameSpeed()
- ' Nome operazione e tipo
- ShowOperationName()
+ Public Overrides Sub OnPostSetSimulationStatus(value As MCH_SIM_ST)
+ If IniFile.m_nUserLevel >= 5 AndAlso (value = MCH_SIM_ST.UI_PAUSE OrElse value = MCH_SIM_ST.UI_STOP) Then
+ For Index = 0 To MachineAxisList.Count - 1
+ MachineAxisList(Index).IsReadOnlyAxesValue = False
+ Next
+ Else
+ For Index = 0 To MachineAxisList.Count - 1
+ MachineAxisList(Index).IsReadOnlyAxesValue = True
+ Next
+ End If
+ EgtSimSetUiStatus(GetStatus())
End Sub
- Private Sub IsValidAxisIndex(nIndex As Integer)
- For Index = m_MachineAxisList.Count To nIndex
- m_MachineAxisList.Add(New MachineAxis)
- Next
- End Sub
-
- Private Function ShowMoveTypeFeed() As Boolean
- Dim nG As Integer = 0
- Dim dFeed As Double = 0
- If EgtSimGetMoveInfo(nG, dFeed) Then
- If nG <> 0 Then
- GCode = "G" & nG.ToString()
- FValue = "F" & LenToString(dFeed, 0)
- Else
- GCode = "G" & nG.ToString()
- FValue = ""
- End If
- Return True
+ Public Overrides Sub VMillActiveInfoTitle(VMillActive As Boolean)
+ If VMillActive Then
+ EgtSetInfo(EgtGetCurrMachGroup(), KEY_MCHGRP_VM, VMillActive)
Else
- GCode = ""
- FValue = ""
- Return False
- End If
- End Function
-
- Private Function ShowToolNameSpeed() As Boolean
- Dim sTool As String = String.Empty
- Dim dSpeed As Double = 0
- If EgtSimGetToolInfo(sTool, dSpeed) Then
- TName = sTool
- If dSpeed > 1 Then
- SValue = "S" & DoubleToString(dSpeed, 0)
- Else
- SValue = ""
- End If
- Return True
- Else
- TName = ""
- SValue = ""
- Return False
- End If
- End Function
-
- Private Function ShowOperationName() As Boolean
- Dim sName As String = String.Empty
- Dim nType As Integer = 0
- If EgtSimGetOperationInfo(sName, nType) Then
- OpeName = sName
- Return True
- Else
- OpeName = ""
- Return False
- End If
- End Function
-
- Private Sub UpdateMachView()
- ' Se cambiato utensile, aggiorno stato visualizzazione macchina
- Dim sTool As String = String.Empty
- Dim dSpeed As Double = 0
- If EgtSimGetToolInfo(sTool, dSpeed) Then
- If sTool <> m_sCurrTool Then
- m_sCurrTool = sTool
- EgtSetMachineLook(m_nMachLook)
- End If
+ EgtRemoveInfo(EgtGetCurrMachGroup(), KEY_MCHGRP_VM)
End If
+ Application.Msn.NotifyColleagues(Application.EMITTITLE)
End Sub
Private Function GetCncFileName(bAskSave As Boolean, ByRef sCncFile As String, ByRef sInfo As String) As Boolean
@@ -834,6 +394,6 @@ Public Class SimulationExpanderVM
Return True
End Function
-#End Region
+#End Region ' METHODS
-End Class
\ No newline at end of file
+End Class