EgtDOORCreator :
- migliorata gestione Debug - corretta gestione UserLevel - ora possibilità di Configurazione interattiva dipende da UserLevel > 4 - sistemato script ChangeConfig.lua - riabilitato lancio CAM5 con generazione lavorazioni (basta premere Shift).
This commit is contained in:
@@ -32,7 +32,7 @@ Public Class AboutBoxV
|
||||
sInfo = If( EgtIsDebug(), "*** Debug Libraries ***" & vbCrLf, "")
|
||||
sInfo &= "User " & Environment.MachineName & "\" & Environment.UserName &
|
||||
" Inst" & Map.refMainWindowVM.Instance().ToString() &
|
||||
" Ulv" & IniFile.m_nUserLevel.ToString() & " Dbg" & Map.refMainWindowVM.DebugLevel().ToString() & vbCrLf
|
||||
" Ulv" & IniFile.m_nUserLevel.ToString() & " Dbg" & IniFile.m_nDebug.ToString() & vbCrLf
|
||||
sInfo &= sKey & " - " & sKlev & " - " & sOpts & vbCrLf
|
||||
sInfo &= "SupportPlane " & sAssStatus & vbCrLf
|
||||
sInfo &= "DataRoot " & IniFile.m_sDataRoot & vbCrLf
|
||||
|
||||
+3
-1
@@ -13,6 +13,8 @@ Friend Module IniFile
|
||||
|
||||
' Livello dell'utilizzatore
|
||||
Friend m_nUserLevel As Integer = 1
|
||||
' Livello di debug
|
||||
Friend m_nDebug As Integer = 0
|
||||
' Livello della chiave inserita nel PC
|
||||
Friend m_nKeyLevel As Integer = 0
|
||||
' Opzioni attive sulla chiave
|
||||
@@ -58,7 +60,7 @@ Friend Module IniFile
|
||||
' Path del modello ListLabel
|
||||
Friend m_sListLabelCurrent As String = String.Empty
|
||||
' Path dell'eseguibile Cam5
|
||||
Friend m_sEgtCameEXEPath As String = String.Empty
|
||||
Friend m_sEgtCam5EXEPath As String = String.Empty
|
||||
' Path LuaLibs Dir
|
||||
Friend m_sLuaLibsDir As String = String.Empty
|
||||
|
||||
|
||||
@@ -14,8 +14,6 @@ Friend Class MainWindowModel
|
||||
Friend m_nInstance As Integer = 0
|
||||
' Path cartella Data
|
||||
Friend m_sDataRoot As String = String.Empty
|
||||
' Livello di debug
|
||||
Friend m_nDebug As Integer = 0
|
||||
|
||||
#End Region
|
||||
|
||||
@@ -35,7 +33,7 @@ Friend Class MainWindowModel
|
||||
' Impostazione direttorio Ini file
|
||||
IniFile.m_sIniFile = IniFile.m_sConfigDir & "\" & INI_FILE_NAME
|
||||
' Impostazione path Ini file
|
||||
EgtWPFLib5.IniFile.m_sIniFile = m_sConfigDir & "\" & INI_FILE_NAME
|
||||
EgtWPFLib5.IniFile.m_sIniFile = IniFile.m_sIniFile
|
||||
' Impostazione direttorio della cartella Help
|
||||
IniFile.m_sHelpDir = m_sDataRoot & "\" & HELP_DIR
|
||||
' Impostazione direttorio della cartella Template
|
||||
@@ -55,13 +53,11 @@ Friend Class MainWindowModel
|
||||
Dim sKey As String = String.Empty
|
||||
EgtUILib.GetPrivateProfileString(S_LICENCE, K_KEY, "", sKey, sLicFile)
|
||||
EgtSetKey(sKey)
|
||||
|
||||
Dim sNestKey As String = ""
|
||||
EgtUILib.GetPrivateProfileString(S_LICENCE, K_NESTKEY, "", sNestKey, sLicFile)
|
||||
EgtSetNestKey(sNestKey)
|
||||
Dim bNetHwKey As Boolean = (GetPrivateProfileInt(S_GENERAL, K_NETKEY, 0, m_sIniFile) = 1)
|
||||
EgtSetNetHwKey(bNetHwKey)
|
||||
|
||||
' Impostazioni per chiave di rete
|
||||
Dim bNetKey As Boolean = (GetPrivateProfileInt(S_GENERAL, K_NETKEY, 0, m_sIniFile) = 1)
|
||||
EgtSetNetHwKey(bNetKey)
|
||||
@@ -70,15 +66,13 @@ Friend Class MainWindowModel
|
||||
If Not String.IsNullOrEmpty(sLockId) Then
|
||||
EgtSetLockId(sLockId)
|
||||
End If
|
||||
|
||||
' Verifico abilitazione nesting automatico
|
||||
m_bAutoNest = Not String.IsNullOrWhiteSpace(sNestKey)
|
||||
|
||||
' Recupero livello e opzioni della chiave
|
||||
Dim bKey As Boolean = EgtGetKeyLevel(3279, 2703, 1, IniFile.m_nKeyLevel) And
|
||||
EgtGetKeyOptions(3279, 2703, 1, IniFile.m_nKeyOptions)
|
||||
' Leggo e imposto livello utilizzatore
|
||||
IniFile.m_nUserLevel = Math.Min(IniFile.m_nKeyLevel, GetMainPrivateProfileInt(S_GENERAL, K_USERLEVEL, 1))
|
||||
'Inizializzazione generale di EgtInterface
|
||||
m_nDebug = GetMainPrivateProfileInt(S_GENERAL, K_DEBUG, 0)
|
||||
IniFile.m_nDebug = GetMainPrivateProfileInt(S_GENERAL, K_DEBUG, 0)
|
||||
Dim sLogFile As String = IniFile.m_sTempDir & "\" & GENLOG_FILE_NAME.Replace("#", m_nInstance.ToString())
|
||||
Dim sLogMsg As String = "User " & Environment.UserName & "\" & Environment.MachineName & " (" & m_nInstance.ToString() & ")" & vbLf &
|
||||
My.Application.Info.Description.ToString() & " ver. " &
|
||||
@@ -86,7 +80,7 @@ Friend Class MainWindowModel
|
||||
"." & My.Application.Info.Version.Minor.ToString() &
|
||||
(ChrW(97 - 1 + My.Application.Info.Version.Build)).ToString() &
|
||||
My.Application.Info.Version.Revision.ToString()
|
||||
EgtInit(m_nDebug, sLogFile, sLogMsg)
|
||||
EgtInit(IniFile.m_nDebug, sLogFile, sLogMsg)
|
||||
' Carico i messaggi
|
||||
OptionModule.ReadMessages()
|
||||
' Carico direttorio doors
|
||||
|
||||
@@ -15,12 +15,6 @@ Public Class MainWindowVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property DebugLevel As Integer
|
||||
Get
|
||||
Return m_MainWindowModel.m_nDebug
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_VisibilityAssemblyManager As Visibility = Visibility.Visible
|
||||
Public Property VisibilityAssemblyManager As Visibility
|
||||
Get
|
||||
|
||||
@@ -333,7 +333,7 @@ Friend Module OptionModule
|
||||
Dim sEgtCam5EXE As String = String.Empty
|
||||
' AndAlso File.Exists(sListLabelFile)
|
||||
If GetMainPrivateProfileString(S_GENERAL, K_EGTCAMEXE, "", sEgtCam5EXE) > 0 Then
|
||||
IniFile.m_sEgtCameEXEPath = sEgtCam5EXE
|
||||
IniFile.m_sEgtCam5EXEPath = sEgtCam5EXE
|
||||
End If
|
||||
|
||||
Dim nHelpSelct As Integer = 0
|
||||
|
||||
@@ -122,7 +122,7 @@ Public Class OptionsVM
|
||||
|
||||
Public ReadOnly Property EnableConfig As Boolean
|
||||
Get
|
||||
If GetMainPrivateProfileInt(S_GENERAL, K_DEBUG, 0) > 4 And File.Exists(IniFile.m_sConfigDir & "\ChangeConfig.lua") Then
|
||||
If IniFile.m_nUserLevel > 4 AndAlso File.Exists(IniFile.m_sConfigDir & "\ChangeConfig.lua") Then
|
||||
Return True
|
||||
Else
|
||||
Return False
|
||||
@@ -2065,35 +2065,38 @@ Public Class OptionsVM
|
||||
OptionsWindow.Close()
|
||||
End If
|
||||
Next
|
||||
|
||||
If EnableConfig AndAlso m_IsChangedConfig Then
|
||||
' Se modifico il direttorio Compo: aggiorno il file Config.ini dell'EgtCAM5
|
||||
EgtLuaExecFile(IniFile.m_sConfigDir & "\ChangeConfig.lua")
|
||||
' assegno variabili
|
||||
EgtLuaSetGlobStringVar("CCD.NewBaseDir", IniFile.m_sDoorsDirPath)
|
||||
EgtLuaSetGlobStringVar("CCD.NewMTable", OptionModule.m_SelectedMTable.Name)
|
||||
' eseguo la funzione che esegue la scrittura delle variabili
|
||||
EgtLuaCallFunction("CCD.ChangeConfigDirectory")
|
||||
Dim sVal As String = ""
|
||||
EgtLuaGetGlobStringVar("CCD.NewMachineName", sVal)
|
||||
OptionModule.m_CurrentMachine = sVal
|
||||
EgtLuaResetGlobVar("CCD")
|
||||
' chiudo il programma e lo riavvio
|
||||
Map.refMainWindowVM.CloseApplication()
|
||||
Process.Start(Application.ResourceAssembly.Location)
|
||||
'End If
|
||||
ElseIf EnableConfig AndAlso m_OrigMTable <> OptionModule.m_SelectedMTable.Name Then
|
||||
' aggiorno il file Config.ini dell'EgtCAM5
|
||||
EgtLuaExecFile(IniFile.m_sConfigDir & "\ChangeConfig.lua")
|
||||
' assegno variabili
|
||||
EgtLuaSetGlobStringVar("CCD.NewBaseDir", IniFile.m_sDoorsDirPath)
|
||||
EgtLuaSetGlobStringVar("CCD.NewMTable", OptionModule.m_SelectedMTable.Name)
|
||||
' eseguo la funzione che esegue la scrittura delle variabili
|
||||
EgtLuaCallFunction("CCD.ChangeConfigDirectory")
|
||||
Dim sVal As String = ""
|
||||
EgtLuaGetGlobStringVar("CCD.NewMachineName", sVal)
|
||||
OptionModule.m_CurrentMachine = sVal
|
||||
EgtLuaResetGlobVar("CCD")
|
||||
' Se abilitata modifica configurazione
|
||||
If EnableConfig Then
|
||||
' Se cambiato direttorio Doors
|
||||
If m_IsChangedConfig Then
|
||||
' Se modifico il direttorio Compo: aggiorno il file Config.ini dell'EgtCAM5
|
||||
EgtLuaExecFile(IniFile.m_sConfigDir & "\ChangeConfig.lua")
|
||||
' assegno variabili
|
||||
EgtLuaSetGlobStringVar("CCD.NewBaseDir", IniFile.m_sDoorsDirPath)
|
||||
EgtLuaSetGlobStringVar("CCD.NewMTable", OptionModule.m_SelectedMTable.Name)
|
||||
' eseguo la funzione che esegue la scrittura delle variabili
|
||||
EgtLuaCallFunction("CCD.ChangeConfigDirectory")
|
||||
Dim sVal As String = ""
|
||||
EgtLuaGetGlobStringVar("CCD.NewMachineName", sVal)
|
||||
OptionModule.m_CurrentMachine = sVal
|
||||
EgtLuaResetGlobVar("CCD")
|
||||
' chiudo il programma e lo riavvio
|
||||
Map.refMainWindowVM.CloseApplication()
|
||||
Process.Start(Application.ResourceAssembly.Location)
|
||||
' se altrimenti cambiata MTable
|
||||
ElseIf m_OrigMTable <> OptionModule.m_SelectedMTable.Name Then
|
||||
' aggiorno il file Config.ini dell'EgtCAM5
|
||||
EgtLuaExecFile(IniFile.m_sConfigDir & "\ChangeConfig.lua")
|
||||
' assegno variabili
|
||||
EgtLuaSetGlobStringVar("CCD.NewBaseDir", IniFile.m_sDoorsDirPath)
|
||||
EgtLuaSetGlobStringVar("CCD.NewMTable", OptionModule.m_SelectedMTable.Name)
|
||||
' eseguo la funzione che esegue la scrittura delle variabili
|
||||
EgtLuaCallFunction("CCD.ChangeConfigDirectory")
|
||||
Dim sVal As String = ""
|
||||
EgtLuaGetGlobStringVar("CCD.NewMachineName", sVal)
|
||||
OptionModule.m_CurrentMachine = sVal
|
||||
EgtLuaResetGlobVar("CCD")
|
||||
End If
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
@@ -67,11 +67,11 @@ Public Class ProjectManagerVM
|
||||
|
||||
Public ReadOnly Property VisibilityEgtCAM As Visibility
|
||||
Get
|
||||
If String.IsNullOrEmpty(IniFile.m_sEgtCameEXEPath) Then
|
||||
If String.IsNullOrEmpty(IniFile.m_sEgtCam5EXEPath) Then
|
||||
Return Visibility.Collapsed
|
||||
ElseIf Not File.Exists(IniFile.m_sEgtCameEXEPath) Then
|
||||
ElseIf Not File.Exists(IniFile.m_sEgtCam5EXEPath) Then
|
||||
Return Visibility.Collapsed
|
||||
ElseIf File.Exists(IniFile.m_sEgtCameEXEPath) Then
|
||||
ElseIf File.Exists(IniFile.m_sEgtCam5EXEPath) Then
|
||||
Return Visibility.Visible
|
||||
Else
|
||||
Return Visibility.Collapsed
|
||||
@@ -1374,15 +1374,13 @@ Public Class ProjectManagerVM
|
||||
|
||||
Public Sub OpenCam()
|
||||
If IsNothing(Map.refAssemblyManagerVM.CurrProject) OrElse
|
||||
IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then
|
||||
IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then
|
||||
' 50192 = Impossible to export to machine a door if there is not a door!
|
||||
MessageBox.Show(EgtMsg(50192), EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning)
|
||||
Return
|
||||
End If
|
||||
'Verifico che tutto sia salvato, altrimenti esco con messaggio
|
||||
If Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified Then
|
||||
'' Project must be saved before copying
|
||||
'MessageBox.Show(EgtMsg(50186), EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning)
|
||||
' 50177=Do you want to save the current changes?
|
||||
Dim ResultMsg As MessageBoxResult = MessageBox.Show(EgtMsg(50177), EgtMsg(50144), MessageBoxButton.OKCancel, MessageBoxImage.Warning)
|
||||
If ResultMsg = MessageBoxResult.OK Then
|
||||
@@ -1393,22 +1391,14 @@ Public Class ProjectManagerVM
|
||||
Return
|
||||
End If
|
||||
End If
|
||||
'' elimino eventuali file .txt associati a ddf corrente (per lettura dei messaggi di errore stampati nel dal log del CAM5)
|
||||
'Dim FileLog As String = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name
|
||||
'FileLog = FileLog.Replace(DDF_EXTENSION, ".txt")
|
||||
'Try
|
||||
' File.Delete(FileLog)
|
||||
'Catch
|
||||
'End Try
|
||||
' Lancio esecuzione CAM5
|
||||
Dim Proc As New Process
|
||||
' Dim CurrFile As String = IniFile.m_sTempDir & "\CurrPart" & DDF_EXTENSION
|
||||
Dim CurrFile As String = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name
|
||||
Dim sCurrFile As String = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name
|
||||
' Flag : 0 = solo disegno, 1 = anche calcolo lavorazioni
|
||||
Dim nFlag As Integer = If((Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift, 1, 0)
|
||||
Try
|
||||
Proc.StartInfo.FileName = IniFile.m_sEgtCameEXEPath
|
||||
' 0: creata una porta come descritta nel file riferito
|
||||
' 1 viene creata la porta e il suo programma di lavorazione sul centro di lavoro preconfigurato
|
||||
' Proc.StartInfo.Arguments = """" & CurrFile & """ " & If((Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift, """1""", """0""")
|
||||
Proc.StartInfo.Arguments = """" & CurrFile & """ " & """0"""
|
||||
Proc.StartInfo.FileName = IniFile.m_sEgtCam5EXEPath
|
||||
Proc.StartInfo.Arguments = """" & sCurrFile & """ """ & nFlag & """"
|
||||
If Not Proc.Start() Then
|
||||
' Error in starting EgtCam5.exe
|
||||
MessageBox.Show(EgtMsg(50567), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
||||
@@ -1417,22 +1407,6 @@ Public Class ProjectManagerVM
|
||||
' Error in starting EgtCam5.exe
|
||||
MessageBox.Show(EgtMsg(50567), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
||||
End Try
|
||||
'Dim sError As String = String.Empty
|
||||
'Dim nType As Integer = 0
|
||||
'Dim nCountCycle As Integer = 0
|
||||
'' al massimo attendo 5 secondi
|
||||
'While Not (Proc.HasExited Or File.Exists(FileLog)) And nCountCycle < 50
|
||||
' Threading.Thread.Sleep(100)
|
||||
' nCountCycle += 1
|
||||
'End While
|
||||
'ShowGraphicError(sError, nType)
|
||||
'If Not String.IsNullOrEmpty(sError) And nType > 0 Then
|
||||
' 'Proc.Kill()
|
||||
' MessageBox.Show(sError, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
||||
'ElseIf Not String.IsNullOrEmpty(sError) And nType < 0 Then
|
||||
' 'Proc.Kill()
|
||||
' MessageBox.Show(sError, EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning)
|
||||
'End If
|
||||
End Sub
|
||||
|
||||
#End Region ' Copy
|
||||
|
||||
Reference in New Issue
Block a user