489 lines
23 KiB
VB.net
489 lines
23 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports System.IO
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
|
|
Public Class MyMachinePanelVM
|
|
Inherits MachinePanelVM
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
' Radice del direttorio delle macchine
|
|
Private m_sMachinesRoot As String
|
|
|
|
Private m_MachPanel_IsEnabled As Boolean = True
|
|
Public Property MachPanel_IsEnabled As Boolean
|
|
Get
|
|
Return m_MachPanel_IsEnabled
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_MachPanel_IsEnabled = value
|
|
NotifyPropertyChanged("MachPanel_IsEnabled")
|
|
End Set
|
|
End Property
|
|
|
|
Public ReadOnly Property WjDb_Visibility As Visibility
|
|
Get
|
|
Return If(CurrentMachine.bWaterJet And CurrentMachine.bFromDBWaterJet, Visibility.Visible, Visibility.Collapsed)
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Messages"
|
|
|
|
Public ReadOnly Property ToolDBMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_MACHINEPAGEUC + 6)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property MachiningDbMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_MACHINEPAGEUC + 7)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property SetUpMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_ALARMSPAGEUC + 33)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property WaterjetDbMsg As String
|
|
Get
|
|
Return "DB WaterJet" 'EgtMsg(MSG_MACHINEPAGEUC + 7)
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' Messages
|
|
|
|
#Region "ToolTip"
|
|
|
|
Public ReadOnly Property ToolDBToolTip As String
|
|
Get
|
|
Return "Tool DB"
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property MachiningDbToolTip As String
|
|
Get
|
|
Return "Machining DB"
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property SetUpToolTip As String
|
|
Get
|
|
Return "SetUp"
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property WaterjetDbToolTip As String
|
|
Get
|
|
Return "Waterjet DB"
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' ToolTip
|
|
|
|
' Definizione comandi
|
|
Private m_cmdToolDb As ICommand
|
|
Private m_cmdMachDb As ICommand
|
|
Private m_cmdSetUp As ICommand
|
|
Private m_cmdMachOptions As ICommand
|
|
Private m_cmdWaterjetDb As ICommand
|
|
|
|
#End Region 'FIELDS & PROPERTIES
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New()
|
|
MyBase.New()
|
|
' Creo riferimento a questa classe in OmagOFFICEMap
|
|
OmagOFFICEMap.SetRefMachinePanelVM(Me)
|
|
' recupero cartella radice delle macchine
|
|
m_sMachinesRoot = OmagOFFICEMap.refMainWindowVM.MainWindowM.sMachinesRoot
|
|
End Sub
|
|
|
|
#End Region ' CONSTRUCTOR
|
|
|
|
#Region "METHODS"
|
|
|
|
Public Sub Init( sMchRoots As String)
|
|
' procedo ad inizializzare la classe → carico la lista "MachineList" che visualizzo per l'inserimento di nuovi MachGroup
|
|
Machine.MachineListInit(sMchRoots, MachineList)
|
|
' Inizializzo valori visibilità parametri Db utensili e lavorazioni
|
|
' OmagOFFICETMDbParamVisibility.Init()
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Execute the Exec. This method is invoked by the ExecCommand.
|
|
''' </summary>
|
|
Public Overrides Sub ToolDb(ByVal param As Object)
|
|
If Not VerifyMachinesDir(m_sMachinesRoot) Then Return
|
|
' ricarico il database per intercettare eventuali aggiornamenti fatti da altre istanze del programma (se la cartella Machines è condivisa)
|
|
If Not EgtTdbReload() Then
|
|
EgtOutLog("Impossible reloading tool Db")
|
|
MessageBox.Show(EgtMsg(MSG_TOOLDBERRORS + 30), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return
|
|
End If
|
|
|
|
Dim ToolDbWindowVM As New ToolDbWindowVM(CurrentMachine.sMachDir, CurrentMachine.sMachIniFile, OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx(), "Stone", OmagOFFICEMap.refMainWindowVM.MainWindowM.nUserLevel > 5)
|
|
' imposto colori sfondo
|
|
Dim BackTopColor As New Color3d(192, 192, 192)
|
|
GetMainPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor)
|
|
Dim BackBotColor As New Color3d(BackTopColor)
|
|
GetMainPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor)
|
|
ToolDbWindowVM.SetBackgroundColor(BackTopColor, BackBotColor)
|
|
|
|
ToolDbWindowVM.bPersonalInterface = True
|
|
|
|
' Collegata allo stile della GroupBox
|
|
ToolDbWindowVM.MyBorderGrbThickness = 0.25
|
|
ToolDbWindowVM.MyForegroundGrbColor = Brushes.White
|
|
|
|
' Definisco lo stile della pagina
|
|
ToolDbWindowVM.BorderBrushIsMouseOver = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
ToolDbWindowVM.GeneralBorderBrush = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
ToolDbWindowVM.BorderBrushIsFocused = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
ToolDbWindowVM.BackgroundBrdEnable = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
ToolDbWindowVM.BackgroundBrdDisable = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
ToolDbWindowVM.BackgroundTxBlDisable = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
ToolDbWindowVM.ForegroundTxBlEnable = Brushes.White
|
|
ToolDbWindowVM.ForegroundTxBlDisable = Brushes.White
|
|
ToolDbWindowVM.GeneralForeground = Brushes.White
|
|
ToolDbWindowVM.GeneralBackground = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
|
|
' Definisco lo stile della ComboBox
|
|
ToolDbWindowVM.BackgroundCmBxTxBl = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
ToolDbWindowVM.BackgroundListCmBxTxBl = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
ToolDbWindowVM.ForegroundCmBxTxBl = Brushes.White
|
|
ToolDbWindowVM.BorderBrushCmBxTxBl = Brushes.Black
|
|
ToolDbWindowVM.BorderThicknessCmBxTxBl = New Thickness(1)
|
|
ToolDbWindowVM.VerticalContentAlignmentCmBxTxBl = "Center"
|
|
ToolDbWindowVM.HeightCmBxTxBl = "25"
|
|
ToolDbWindowVM.WidthCmBxTxBl = "Auto"
|
|
ToolDbWindowVM.ForegroundTextBoxCmBxTxBl = Brushes.White
|
|
|
|
'Definisco lo stile del Button
|
|
ToolDbWindowVM.BackgroundButton = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
ToolDbWindowVM.ForegroundButton = Brushes.White
|
|
ToolDbWindowVM.BorderBrushButton = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
ToolDbWindowVM.BorderThicknessButton = New Thickness(1)
|
|
|
|
''Definisco lo stile della DataGrid
|
|
'ToolDbWindowVM.HeaderVisibility = DataGridHeadersVisibility.Column
|
|
'ToolDbWindowVM.BackgroundDataGrid = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
'ToolDbWindowVM.BackGroundHeader = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
'ToolDbWindowVM.ForegroundHeader = Brushes.White
|
|
'ToolDbWindowVM.BorderBrushHeader = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
'ToolDbWindowVM.BorderThicknessHeader = 0.0
|
|
'ToolDbWindowVM.FontWeightHeader = FontWeights.Bold
|
|
'ToolDbWindowVM.BackgroundDataGrid = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
'ToolDbWindowVM.BorderBrushDataGrid = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
'ToolDbWindowVM.BackgroundDataGridRow = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
'ToolDbWindowVM.ForegroundDataGridRow = Brushes.White
|
|
'ToolDbWindowVM.BorderBrushDataGridRow = Brushes.DarkGray
|
|
'ToolDbWindowVM.BorderThicknessDataGridRow = "0 0 0 1"
|
|
'ToolDbWindowVM.BorderBrushDataGridCell = Brushes.DarkGray
|
|
'ToolDbWindowVM.BorderThicknessDataGridCell = "0 0 1 0"
|
|
|
|
' Definisco stile New Mach Grouo
|
|
|
|
|
|
' Dim ToolDbWindowV As New ToolDbWindowV(Application.Current.MainWindow, ToolDbWindowVM)
|
|
Dim ToolDbWindowV As New MyToolDbWindowV(Application.Current.MainWindow, ToolDbWindowVM)
|
|
If ToolDbWindowVM.MatType <> 0 Then
|
|
ToolDbWindowV.Height = 768
|
|
ToolDbWindowV.Width = 1024
|
|
ToolDbWindowV.ShowDialog()
|
|
Else
|
|
Exit Sub
|
|
End If
|
|
|
|
If Not SetUpUtility.IsValidToolHeadExitInSetUp() Then
|
|
SetUp_Background = Brushes.Red
|
|
Else
|
|
SetUp_Background = OmagOFFICEDictionary.Button_Static_Background
|
|
End If
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Execute the Exec. This method is invoked by the ExecCommand.
|
|
''' </summary>
|
|
Public Overrides Sub MachDb(ByVal param As Object)
|
|
If Not VerifyMachinesDir(m_sMachinesRoot) Then Return
|
|
|
|
' ricarico il database per intercettare eventuali aggiornamenti fatti da altre istanze del programma (se la cartella Machines è condivisa)
|
|
If Not EgtMdbReload() Then
|
|
EgtOutLog("Impossible reloading machining Db")
|
|
MessageBox.Show(EgtMsg(MSG_MACHININGDBERRORS + 8), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return
|
|
End If
|
|
|
|
EgtOutLog("Call function: Creazione oggetto MachDbWindowVM")
|
|
TimeSpanInit()
|
|
Dim MachDbWindowVM As New EgtWPFLib5.MachiningDbWindowVM(CurrentMachine.sMachIniFile, OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx(), "Stone", OmagOFFICEMap.refMainWindowVM.MainWindowM.nUserLevel > 5)
|
|
' Dim MachDbWindowV As New EgtWPFLib5.MachiningDbWindowV(Application.Current.MainWindow, MachDbWindowVM)
|
|
EgtOutLog(TimeSpanEnd())
|
|
|
|
EgtOutLog("Call function: Aggiorna oggetto MachDbWindowVM")
|
|
TimeSpanInit()
|
|
MachDbWindowVM.bPersonalInterface = True
|
|
|
|
' Collegata allo stile della GroupBox
|
|
MachDbWindowVM.MyBorderGrbThickness = 0.25
|
|
MachDbWindowVM.MyForegroundGrbColor = Brushes.White
|
|
|
|
' Definisco lo stile della pagina
|
|
MachDbWindowVM.BorderBrushIsMouseOver = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
MachDbWindowVM.GeneralBorderBrush = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
MachDbWindowVM.BorderBrushIsFocused = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
MachDbWindowVM.BackgroundBrdEnable = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
MachDbWindowVM.BackgroundBrdDisable = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
MachDbWindowVM.BackgroundTxBlDisable = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
MachDbWindowVM.ForegroundTxBlEnable = Brushes.White
|
|
MachDbWindowVM.ForegroundTxBlDisable = Brushes.White
|
|
MachDbWindowVM.GeneralForeground = Brushes.White
|
|
MachDbWindowVM.GeneralBackground = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
MachDbWindowVM.MyForegroundChColor = Brushes.White
|
|
|
|
' Definisco lo stile della ComboBox
|
|
MachDbWindowVM.BackgroundCmBxTxBl = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
MachDbWindowVM.BackgroundListCmBxTxBl = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
MachDbWindowVM.ForegroundCmBxTxBl = Brushes.White
|
|
MachDbWindowVM.BorderBrushCmBxTxBl = Brushes.Black
|
|
MachDbWindowVM.BorderThicknessCmBxTxBl = New Thickness(1)
|
|
MachDbWindowVM.VerticalContentAlignmentCmBxTxBl = "Center"
|
|
MachDbWindowVM.HeightCmBxTxBl = "25"
|
|
MachDbWindowVM.WidthCmBxTxBl = "Auto"
|
|
MachDbWindowVM.ForegroundTextBoxCmBxTxBl = Brushes.White
|
|
|
|
'Definisco lo stile del ToggleButton
|
|
MachDbWindowVM.BackgroundIsChecked = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
MachDbWindowVM.ForegroundIsChecked = Brushes.White
|
|
MachDbWindowVM.BorderBrushIsChecked = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
MachDbWindowVM.BorderThicknessIsChecked = New Thickness(1)
|
|
MachDbWindowVM.OpacityIsChecked = 0.25
|
|
|
|
'Definisco lo stile della DataGrid
|
|
MachDbWindowVM.HeaderVisibility = DataGridHeadersVisibility.Column
|
|
MachDbWindowVM.BackgroundDataGrid = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#484D55"), Brush)
|
|
MachDbWindowVM.BackGroundHeader = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#484D55"), Brush)
|
|
MachDbWindowVM.ForegroundHeader = Brushes.White
|
|
MachDbWindowVM.BorderBrushHeader = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
MachDbWindowVM.BorderThicknessHeader = New Thickness(0)
|
|
MachDbWindowVM.FontWeightHeader = FontWeights.Bold
|
|
MachDbWindowVM.BorderBrushDataGrid = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
MachDbWindowVM.BackgroundDataGridRow = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush)
|
|
MachDbWindowVM.ForegroundDataGridRow = Brushes.White
|
|
MachDbWindowVM.BorderBrushDataGridRow = Brushes.DarkGray
|
|
MachDbWindowVM.BorderThicknessDataGridRow = New Thickness(0, 0, 0, 1)
|
|
MachDbWindowVM.BorderBrushDataGridCell = Brushes.DarkGray
|
|
MachDbWindowVM.BorderThicknessDataGridCell = New Thickness(0, 0, 1, 0)
|
|
|
|
EgtOutLog(TimeSpanEnd())
|
|
|
|
EgtOutLog("Call function: Creazione oggetto MachDbWindowV")
|
|
TimeSpanInit()
|
|
Dim MachDbWindowV As New MyMachiningDbWindowV(Application.Current.MainWindow, MachDbWindowVM)
|
|
|
|
|
|
If EgtWPFLib5.MachiningTreeViewItem.m_MatType <> 0 Then
|
|
EgtOutLog("Call function: Visualizzazione oggetto MachDbWindowV")
|
|
TimeSpanInit()
|
|
MachDbWindowV.Height = 768
|
|
MachDbWindowV.Width = 1024
|
|
MachDbWindowV.ShowDialog()
|
|
EgtOutLog(TimeSpanEnd())
|
|
Else
|
|
Exit Sub
|
|
End If
|
|
|
|
|
|
' Verifico che gli utensili delle lavorazioni correnti siano attrezzati (necessario perchè potrei aver cambiato gli utensili delle lavorazioni)
|
|
' e che le lavorazioni correnti siano compatibili con materiale e spessore
|
|
' Lama
|
|
Dim bOkSetUp As Boolean = True
|
|
Dim bOkMatThick As Boolean = True
|
|
Dim sTUUID As String = String.Empty
|
|
If Not String.IsNullOrWhiteSpace(CurrentMachine.sCurrSawing) Then
|
|
EgtMdbSetCurrMachining(CurrentMachine.sCurrSawing)
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sTUUID)
|
|
bOkSetUp = bOkSetUp And SetUpUtility.IsToolInSetUp(sTUUID)
|
|
bOkMatThick = bOkMatThick And CurrMachWindowVM.VerifyMatThickCompatibility()
|
|
End If
|
|
' Fresa
|
|
If Not String.IsNullOrWhiteSpace(CurrentMachine.sCurrMilling) Then
|
|
EgtMdbSetCurrMachining(CurrentMachine.sCurrMilling)
|
|
sTUUID = String.Empty
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sTUUID)
|
|
bOkSetUp = bOkSetUp And SetUpUtility.IsToolInSetUp(sTUUID)
|
|
bOkMatThick = bOkMatThick And CurrMachWindowVM.VerifyMatThickCompatibility()
|
|
End If
|
|
' Scasso
|
|
If Not String.IsNullOrWhiteSpace(CurrentMachine.sCurrPocketing) Then
|
|
EgtMdbSetCurrMachining(CurrentMachine.sCurrPocketing)
|
|
sTUUID = String.Empty
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sTUUID)
|
|
bOkSetUp = bOkSetUp And SetUpUtility.IsToolInSetUp(sTUUID)
|
|
bOkMatThick = bOkMatThick And CurrMachWindowVM.VerifyMatThickCompatibility()
|
|
End If
|
|
' Foretto
|
|
If Not String.IsNullOrWhiteSpace(CurrentMachine.sCurrDrilling) Then
|
|
EgtMdbSetCurrMachining(CurrentMachine.sCurrDrilling)
|
|
sTUUID = String.Empty
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sTUUID)
|
|
bOkSetUp = bOkSetUp And SetUpUtility.IsToolInSetUp(sTUUID)
|
|
bOkMatThick = bOkMatThick And CurrMachWindowVM.VerifyMatThickCompatibility()
|
|
End If
|
|
' Waterjet
|
|
If Not String.IsNullOrWhiteSpace(CurrentMachine.sCurrWaterJetting) Then
|
|
EgtMdbSetCurrMachining(CurrentMachine.sCurrWaterJetting)
|
|
sTUUID = String.Empty
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sTUUID)
|
|
bOkSetUp = bOkSetUp And SetUpUtility.IsToolInSetUp(sTUUID)
|
|
bOkMatThick = bOkMatThick And CurrMachWindowVM.VerifyMatThickCompatibility()
|
|
End If
|
|
|
|
If Not bOkSetUp Then
|
|
SetUp_Background = Brushes.Red
|
|
Else
|
|
SetUp_Background = DirectCast(New BrushConverter().ConvertFrom("#1C1D22"), SolidColorBrush)
|
|
End If
|
|
If Not bOkMatThick Then
|
|
OmagOFFICEMap.refOptionPanelVM.RawPart_Background = Brushes.Red
|
|
OmagOFFICEMap.refRawPartTabVM.CurrMach_Background = Brushes.Red
|
|
Else
|
|
OmagOFFICEMap.refOptionPanelVM.RawPart_Background = OmagOFFICEDictionary.TabControl_Header_Background
|
|
OmagOFFICEMap.refRawPartTabVM.CurrMach_Background = DirectCast(New BrushConverter().ConvertFrom("#1C1D22"), SolidColorBrush)
|
|
End If
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Execute the Exec. This method is invoked by the ExecCommand.
|
|
''' </summary>
|
|
Public Overrides Sub SetUp(ByVal param As Object)
|
|
' verifico che il file di configurazione attrezzaggio (lua) della macchina esista
|
|
If Not File.Exists(CurrentMachine.sMachDir & "\Scripts\" & 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(CurrentMachine.sMachDir & "\Scripts\" & 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
|
|
' Reset lua
|
|
EgtLuaResetGlobVar("STU")
|
|
|
|
' Dim SetUpWindow As New SetUpWindowV(Application.Current.MainWindow, New MySetUpWindowVM(CurrentMachine.sMachDir, CurrentMachine.sMachineName))
|
|
Dim SetUpWindow As New MySetUpWindowV(Application.Current.MainWindow, New MySetUpWindowVM(CurrentMachine.sMachDir, CurrentMachine.sMachineName))
|
|
SetUpWindow.Height = 614
|
|
SetUpWindow.Width = 1024
|
|
SetUpWindow.ShowDialog()
|
|
|
|
' Ripristino stato visualizzazione tavola opportuno
|
|
If OmagOFFICEMap.refOptionPanelVM.SelItem <> OptionPanelVM.Tabs.SIMUL Then
|
|
EgtSetMachineLook(MCH_LOOK.TAB)
|
|
Else
|
|
EgtSetMachineLook(OmagOFFICEMap.refSimulTabVM.MySimul.GetMachLook())
|
|
End If
|
|
|
|
' Verifico che gli utensili delle lavorazioni correnti siano attrezzati (necessario perchè potrei aver cambiato gli utensili delle lavorazioni)
|
|
' Lama
|
|
Dim bOk As Boolean = True
|
|
Dim sTUUID As String = String.Empty
|
|
If Not String.IsNullOrWhiteSpace(CurrentMachine.sCurrSawing) Then
|
|
EgtMdbSetCurrMachining(CurrentMachine.sCurrSawing)
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sTUUID)
|
|
bOk = bOk And SetUpUtility.IsToolInSetUp(sTUUID)
|
|
End If
|
|
' Fresa
|
|
If Not String.IsNullOrWhiteSpace(CurrentMachine.sCurrMilling) Then
|
|
EgtMdbSetCurrMachining(CurrentMachine.sCurrMilling)
|
|
sTUUID = String.Empty
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sTUUID)
|
|
bOk = bOk And SetUpUtility.IsToolInSetUp(sTUUID)
|
|
End If
|
|
' Scasso
|
|
If Not String.IsNullOrWhiteSpace(CurrentMachine.sCurrPocketing) Then
|
|
EgtMdbSetCurrMachining(CurrentMachine.sCurrPocketing)
|
|
sTUUID = String.Empty
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sTUUID)
|
|
bOk = bOk And SetUpUtility.IsToolInSetUp(sTUUID)
|
|
End If
|
|
' Foretto
|
|
If Not String.IsNullOrWhiteSpace(CurrentMachine.sCurrDrilling) Then
|
|
EgtMdbSetCurrMachining(CurrentMachine.sCurrDrilling)
|
|
sTUUID = String.Empty
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sTUUID)
|
|
bOk = bOk And SetUpUtility.IsToolInSetUp(sTUUID)
|
|
End If
|
|
' Waterjet
|
|
If Not String.IsNullOrWhiteSpace(CurrentMachine.sCurrWaterJetting) Then
|
|
EgtMdbSetCurrMachining(CurrentMachine.sCurrWaterJetting)
|
|
sTUUID = String.Empty
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sTUUID)
|
|
bOk = bOk And SetUpUtility.IsToolInSetUp(sTUUID)
|
|
End If
|
|
If Not bOk Then
|
|
SetUp_Background = Brushes.Red
|
|
Else
|
|
SetUp_Background = DirectCast(New BrushConverter().ConvertFrom("#FFDDDDDD"), SolidColorBrush)
|
|
End If
|
|
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Execute the Exec. This method is invoked by the ExecCommand.
|
|
''' </summary>
|
|
Public Overrides Sub MachOptions(ByVal param As Object)
|
|
Dim MachOptionWindow As New MachOptionWindowV(Application.Current.MainWindow, New MachOptionWindowVM)
|
|
MachOptionWindow.Height = 546
|
|
MachOptionWindow.Width = 546
|
|
MachOptionWindow.ShowDialog()
|
|
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
|
|
End Sub
|
|
|
|
#Region "WaterjetDbCommand"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do Exec.
|
|
''' </summary>
|
|
Public ReadOnly Property WaterjetDbCommand As ICommand
|
|
Get
|
|
If m_cmdWaterjetDb Is Nothing Then
|
|
m_cmdWaterjetDb = New Command(AddressOf WaterjetDb)
|
|
End If
|
|
Return m_cmdWaterjetDb
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the Exec. This method is invoked by the ExecCommand.
|
|
''' </summary>
|
|
Public Sub WaterjetDb(ByVal param As Object)
|
|
' Dim WaterjetDbWindow As New WaterjetDbWindowV(Application.Current.MainWindow, New WaterjetDbWindowVM(CurrentMachine.sMachDir))
|
|
Dim WaterjetDbWindow As New MyWaterjetDbWindowV(Application.Current.MainWindow, New WaterjetDbWindowVM(CurrentMachine.sMachDir))
|
|
WaterjetDbWindow.Height = 546
|
|
WaterjetDbWindow.Width = 846
|
|
WaterjetDbWindow.ShowDialog()
|
|
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
|
|
End Sub
|
|
|
|
#End Region ' SpeedDbCommand
|
|
|
|
#End Region ' METHODS
|
|
|
|
End Class |