Icarus :
- aggiornata simulazione come EgtCAM5.
This commit is contained in:
@@ -21,6 +21,10 @@ Public Class MySimulation
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_bStopOnNextCollision As Boolean = True
|
||||
|
||||
Friend m_bSimulEndExitApp As Boolean = False
|
||||
|
||||
#End Region ' FIELDS & PROPERTIES
|
||||
|
||||
#Region "Messages"
|
||||
@@ -38,9 +42,9 @@ Public Class MySimulation
|
||||
Sub New()
|
||||
SetPlayImagePath("/Resources/SimulationPanel/Play.png")
|
||||
SetPauseImagePath("/Resources/SimulationPanel/Pause.png")
|
||||
SetPauseMsg(EgtMsg(90561)) ' Pausa
|
||||
SetStopMsg(EgtMsg(90562)) ' Simulazione interrotta
|
||||
SetHomeMsg(EgtMsg(90564)) ' Home
|
||||
SetPauseMsg(EgtMsg(5311)) ' Pausa
|
||||
SetStopMsg(EgtMsg(5312)) ' Stop
|
||||
SetHomeMsg(EgtMsg(5314)) ' Home
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
@@ -48,8 +52,10 @@ Public Class MySimulation
|
||||
#Region "METHODS"
|
||||
|
||||
Public Overrides Sub ExecSim()
|
||||
SetSimExecuting(True)
|
||||
EgtSimStart(False)
|
||||
EgtSimSetStep(SliderValue * GetSliderX())
|
||||
m_bStopOnNextCollision = True
|
||||
Dim nShowDataCounter As Integer = 0
|
||||
While GetStatus() <> MCH_SIM_ST.UI_STOP
|
||||
' Se simulazione in svolgimento
|
||||
@@ -62,11 +68,25 @@ Public Class MySimulation
|
||||
If GetStatus() = MCH_SIM_ST.UI_STEP And nMove = MCH_SIM.END_STEP Then
|
||||
' Imposto stato Pausa
|
||||
SetSimulationStatus(MCH_SIM_ST.UI_PAUSE)
|
||||
StatusMsg = EgtMsg(MSG_SIMULATIONPAGEUC + 11) ' Pausa
|
||||
StatusMsg = EgtMsg(5311) ' Pausa
|
||||
' Aggiornamenti per bottone Play/Pause
|
||||
SetShowPlay(True)
|
||||
NotifyPropertyChanged("PlayPauseImage")
|
||||
End If
|
||||
' Se movimento con collisione
|
||||
ElseIf nMove = MCH_SIM.COLLISION Then
|
||||
If m_bStopOnNextCollision Then
|
||||
' Imposto stato Pausa
|
||||
SetSimulationStatus(MCH_SIM_ST.UI_PAUSE)
|
||||
StatusMsg = EgtMsg(5311) ' PAUSA
|
||||
' Aggiornamenti per bottone Play/Pause
|
||||
SetShowPlay(True)
|
||||
NotifyPropertyChanged("PlayPauseImage")
|
||||
' Messaggio
|
||||
MessageBox.Show(EgtMsg(5319), EgtMsg(5315), MessageBoxButton.OK, MessageBoxImage.Warning)
|
||||
Else
|
||||
m_bStopOnNextCollision = True
|
||||
End If
|
||||
' Se movimento non riuscito
|
||||
Else
|
||||
SetSimulationStatus(MCH_SIM_ST.UI_STOP)
|
||||
@@ -76,17 +96,26 @@ Public Class MySimulation
|
||||
' Eventuale messaggio
|
||||
Select Case nMove
|
||||
Case MCH_SIM.END_
|
||||
StatusMsg = EgtMsg(MSG_SIMULATIONPAGEUC + 1) 'Simulazione completata
|
||||
StatusMsg = EgtMsg(5301) 'Simulazione completata
|
||||
Case MCH_SIM.STOP_
|
||||
' Simulazione fermata dall'utente (non necessita messaggio)
|
||||
Case MCH_SIM.OUTSTROKE
|
||||
Dim sInfo As String = String.Empty
|
||||
EgtGetOutstrokeInfo(sInfo)
|
||||
MessageBox.Show(EgtMsg(MSG_SIMULATIONPAGEUC + 2) & " " & sInfo, EgtMsg(MSG_SIMULATIONPAGEUC + 5), MessageBoxButton.OK, MessageBoxImage.Stop) 'Extracorsa ...
|
||||
'Extracorsa ...
|
||||
MessageBox.Show(EgtMsg(5302) & " " & sInfo, EgtMsg(5305), MessageBoxButton.OK, MessageBoxImage.Stop)
|
||||
Case MCH_SIM.DIR_ERR
|
||||
MessageBox.Show(EgtMsg(MSG_SIMULATIONPAGEUC + 3), EgtMsg(MSG_SIMULATIONPAGEUC + 5), MessageBoxButton.OK, MessageBoxImage.Stop) 'Direzione utensile irraggiungibile
|
||||
'Direzione utensile irraggiungibile
|
||||
MessageBox.Show(EgtMsg(5303), EgtMsg(5305), MessageBoxButton.OK, MessageBoxImage.Stop)
|
||||
Case Else
|
||||
MessageBox.Show(EgtMsg(MSG_SIMULATIONPAGEUC + 4), EgtMsg(MSG_SIMULATIONPAGEUC + 5), MessageBoxButton.OK, MessageBoxImage.Stop) 'Errore
|
||||
If EgtGetLastMachMgrErrorId() <> 0 Then
|
||||
Dim sErr As String = EgtGetLastMachMgrErrorString()
|
||||
'..... - Errore
|
||||
MessageBox.Show(sErr, EgtMsg(5305), MessageBoxButton.OK, MessageBoxImage.Exclamation)
|
||||
Else
|
||||
'Errore - Errore
|
||||
MessageBox.Show(EgtMsg(5304), EgtMsg(5305), MessageBoxButton.OK, MessageBoxImage.Stop)
|
||||
End If
|
||||
End Select
|
||||
End If
|
||||
' Aggiorno stato visualizzazione macchina (dipende anche da utensile)
|
||||
@@ -94,14 +123,25 @@ Public Class MySimulation
|
||||
' Aggiorno visualizzazione
|
||||
EgtDraw()
|
||||
' Aggiorno dati CNC
|
||||
ShowCncData()
|
||||
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
|
||||
nShowDataCounter = 0
|
||||
Else
|
||||
nShowDataCounter += 1
|
||||
End If
|
||||
Else
|
||||
' Per evitare di ciclare rapidissimamente e consumare inutilmente CPU
|
||||
System.Threading.Thread.Sleep(1)
|
||||
System.Threading.Thread.Sleep(5)
|
||||
End If
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
End While
|
||||
SetSimExecuting(False)
|
||||
If m_bSimulEndExitApp Then
|
||||
refMainWindowVM.CloseApplication( Nothing)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Overrides Sub OnPostSetSimulationStatus(value As MCH_SIM_ST)
|
||||
@@ -126,6 +166,21 @@ Public Class MySimulation
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub Update_CncData( nFlag As Integer)
|
||||
ShowCncData()
|
||||
' Se fermo per Collisione rilevata da script Lua o per altra richiesta
|
||||
If nFlag = 11 Or nFlag = 12 Then
|
||||
' Imposto stato Pausa
|
||||
SetSimulationStatus(MCH_SIM_ST.UI_PAUSE)
|
||||
StatusMsg = EgtMsg(5311) ' PAUSA
|
||||
' Aggiornamenti per bottone Play/Pause
|
||||
SetShowPlay(True)
|
||||
NotifyPropertyChanged("PlayPauseImage")
|
||||
' Se fermo per Collisione, dichiaro di non arrestarsi alla successiva notifica di collisione
|
||||
If nFlag = 11 Then m_bStopOnNextCollision = False
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user