diff --git a/Constants/ConstIni.vb b/Constants/ConstIni.vb index 0e61d4c..c040307 100644 --- a/Constants/ConstIni.vb +++ b/Constants/ConstIni.vb @@ -45,6 +45,7 @@ Module ConstIni Public Const K_LIBSDIR As String = "LibsDir" Public Const K_LIBSDIR64 As String = "LibsDir64" Public Const K_BASELIB As String = "BaseLib" + Public Const K_BWSIM As String = "BWSim" Public Const S_GEOMDB As String = "GeomDB" Public Const K_DEFAULTFONT As String = "DefaultFont" @@ -117,6 +118,7 @@ Module ConstIni Public Const S_BEAM As String = "Beam" Public Const K_BEAMENABLE As String = "BtlEnable" Public Const K_BEAMBASEDIR As String = "BaseDir" + Public Const K_BEAMBASEDIR64 As String = "BaseDir64" Public Const K_BEAMBTLEXEC As String = "BtlExec" Public Const K_BEAMBWEEXEC As String = "BweExec" Public Const K_BEAMMACHINES As String = "Machines" @@ -125,6 +127,7 @@ Module ConstIni Public Const S_WALL As String = "Wall" Public Const K_WALLENABLE As String = "BtlEnable" Public Const K_WALLBASEDIR As String = "BaseDir" + Public Const K_WALLBASEDIR64 As String = "BaseDir64" Public Const K_WALLBTLEXEC As String = "BtlExec" Public Const K_WALLBWEEXEC As String = "BweExec" Public Const K_WALLBUTTON As String = "Button" diff --git a/MainWindow/MainWindowVM.vb b/MainWindow/MainWindowVM.vb index 9c72f44..9ab60b6 100644 --- a/MainWindow/MainWindowVM.vb +++ b/MainWindow/MainWindowVM.vb @@ -67,7 +67,6 @@ Public Class MainWindowVM End Property ' GRAPHICAL FIELDS WITH PROPERTY - Private m_StatusBar As StatusBarV Private m_bfirst As Boolean = True Public ReadOnly Property StatusBar As StatusBarV @@ -372,6 +371,7 @@ Public Class MainWindowVM " Ulv" & IniFile.m_nUserLevel.ToString() & " Dbg" & DebugLevel().ToString() & vbLf & My.Application.Info.Title.ToString() & " ver. " & m_sVersion EgtInit(m_nDebug, IniFile.m_sLogFile, sLogMsg) + EgtSetUserLevel( IniFile.m_nUserLevel) ' Leggo direttorio dei messaggi (se manca uso direttorio di configurazione) Dim sMsgDir As String = String.Empty If GetPrivateProfileString(S_GENERAL, K_MESSAGESDIR, "", sMsgDir) = 0 Then diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 146f8d2..43de259 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/Project/ProjectVM.vb b/Project/ProjectVM.vb index 6d563f0..885fa8f 100644 --- a/Project/ProjectVM.vb +++ b/Project/ProjectVM.vb @@ -11,6 +11,9 @@ Public Class ProjectVM #Region "FIELDS" + Friend Event OnPreControllerExec(sFilePath As String) + Friend Event OnPostControllerExec() + ' Variabili in cui salvo i filtri di selezione della modalità Draw e che poi ripristino all'uscita dalla modalità Machining Private m_bSelZeroDim As Boolean = True Private m_bSelCurve As Boolean = True @@ -64,8 +67,9 @@ Public Class ProjectVM #Region "CONSTRUCTOR" Sub New() - ' Creo riferimento a questa classe in EgtCAM5Map + ' Creo riferimento a questa classe in EgtCAM5Map e in ButtonItem Map.SetRefProjectVM(Me) + ButtonItem.m_ProjectVM = Me ' Creo classe di supporto per la visualizzazione dei parametri utensile e di lavorazione per Db e operazioni TMDbParamVisibility.bFirst = True ' Inizializza i parametri della scena @@ -228,7 +232,6 @@ Public Class ProjectVM Private Sub PostInitializeScene() ' Impostazioni Controller - m_Controller.SetUserLevel( IniFile.m_nUserLevel) m_Controller.SetScene(m_ProjectScene) Dim bLuaReg As Boolean = (GetPrivateProfileInt(S_GENERAL, K_COMMANDLOG, 0) <> 0) Dim sCmdLogFile As String = CMDLOG_FILE_NAME.Replace("#", IniFile.m_nInstance.ToString()) @@ -236,7 +239,7 @@ Public Class ProjectVM EgtOutLog("Command log not started") If Environment.GetCommandLineArgs.Count() <= 1 Then MessageBox.Show("Command log not started", "EgtCAM5 Warning", - MessageBoxButton.OK, MessageBoxImage.Warning) + MessageBoxButton.OK, MessageBoxImage.Warning) End If End If m_Controller.SetSurfTmTolerance(OptionModule.m_dGeometryTolerance) @@ -644,13 +647,15 @@ Public Class ProjectVM m_bScriptInMru = bScriptInMru End Sub - Friend Sub ExecScript(sFilePath As String) + Friend Sub ExecScript(sFilePath As String, Optional bRaiseEvent As Boolean = False) If String.IsNullOrEmpty(sFilePath) Then Dim sDir As String = String.Empty GetPrivateProfileString(S_GENERAL, K_LASTLUADIR, "", sDir) m_Controller.Exec(sDir) Else + If bRaiseEvent Then RaiseEvent OnPreControllerExec( sFilePath) m_Controller.Exec(sFilePath, False) + If bRaiseEvent Then RaiseEvent OnPostControllerExec() End If Dim bMachiningMode As Boolean = EgtGetCurrMachGroup() <> GDB_ID.NULL If Not bMachiningMode And EgtGetCurrLayer() = GDB_ID.NULL Then diff --git a/Special-BeamWall/Beam.vb b/Special-BeamWall/Beam.vb index eea11b5..542d100 100644 --- a/Special-BeamWall/Beam.vb +++ b/Special-BeamWall/Beam.vb @@ -33,6 +33,7 @@ Module Beam Map.refManageLayerExpanderVM.ClearObjTree() ' Assegno i dati EgtLuaCreateGlobTable("BEAM") + EgtLuaSetGlobStringVar("BEAM.BASEDIR", IniFile.m_sBeamDirPath) EgtLuaSetGlobStringVar("BEAM.FILE", sFile) EgtLuaSetGlobStringVar("BEAM.MACHINE", sMachine) EgtLuaSetGlobIntVar("BEAM.FLAG", nFlag) diff --git a/Special-BeamWall/BeamPanelVM.vb b/Special-BeamWall/BeamPanelVM.vb index 963e012..a425142 100644 --- a/Special-BeamWall/BeamPanelVM.vb +++ b/Special-BeamWall/BeamPanelVM.vb @@ -3,6 +3,7 @@ Imports EgtUILib Public Class BeamPanelVM + Friend Const BEAM_PROCESS As String = "Beam\Process.lua" Friend Const BEAM_MACHININGS As String = "BeamMachinings" Private m_ButtonList As New List(Of ButtonItem) diff --git a/Special-BeamWall/Wall.vb b/Special-BeamWall/Wall.vb index e714e14..7e8d96b 100644 --- a/Special-BeamWall/Wall.vb +++ b/Special-BeamWall/Wall.vb @@ -33,6 +33,7 @@ Module Wall Map.refManageLayerExpanderVM.ClearObjTree() ' Assegno i dati EgtLuaCreateGlobTable("WALL") + EgtLuaSetGlobStringVar("WALL.BASEDIR", IniFile.m_sWallDirPath) EgtLuaSetGlobStringVar("WALL.FILE", sFile) EgtLuaSetGlobStringVar("WALL.MACHINE", sMachine) EgtLuaSetGlobIntVar("WALL.FLAG", nFlag) diff --git a/SpecialPanel/SpecialPanelVM.vb b/SpecialPanel/SpecialPanelVM.vb index e6e5429..c6a8020 100644 --- a/SpecialPanel/SpecialPanelVM.vb +++ b/SpecialPanel/SpecialPanelVM.vb @@ -59,6 +59,10 @@ End Class Public Class ButtonItem Inherits ViewModelBase + Friend Shared WithEvents m_ProjectVM As ProjectVM + Private Shared m_sCurrBarName As String + + Private m_sBarName As String Private m_sImagePath As String Public ReadOnly Property ImagePath As String Get @@ -95,8 +99,9 @@ Public Class ButtonItem ' Definizione comandi Private m_cmdLuaExec As ICommand - Sub New(sLuaCmdPath As String, sImagePath As String, sToolTip As String, sDrawMachOrBoth As String) - If File.Exists(sImagePath) Then + Sub New( sBarName As String, sLuaCmdPath As String, sImagePath As String, sToolTip As String, sDrawMachOrBoth As String) + m_sBarName = sBarName + If File.Exists(sImagePath) Then m_sImagePath = sImagePath Else m_sImagePath = IniFile.m_sResourcesRoot & "\" & sImagePath @@ -138,9 +143,33 @@ Public Class ButtonItem End If If Not File.Exists(m_sLuaCmdPath) Then Return If Not Path.GetExtension(m_sLuaCmdPath).ToLower = ".lua" Then Return + ' Abilito eventi se comando lua termina con Beam\Process.lua + m_sCurrBarName = m_sBarName + Dim bRaiseEvent As Boolean = ( m_sBarName = "Beam" OrElse m_sBarName = "Wall") ' eseguo file Lua Map.refProjectVM.PreExecScript(False) - Map.refProjectVM.ExecScript(m_sLuaCmdPath) + Map.refProjectVM.ExecScript(m_sLuaCmdPath, bRaiseEvent) + m_sCurrBarName = Nothing + End Sub + + Private Shared Sub OnPreControllerExec(sFilePath As String) Handles m_ProjectVM.OnPreControllerExec + If m_sCurrBarName = "Beam" Then + EgtLuaCreateGlobTable("BEAM") + EgtLuaSetGlobStringVar("BEAM.BASEDIR", IniFile.m_sBeamDirPath) + If EgtGetUserLevel() >= 9 AndAlso GetPrivateProfileInt(S_LUA, K_BWSIM, 0) = 1 then EgtLuaSetGlobBoolVar("BEAM.BW", true) + ElseIf m_sCurrBarName = "Wall" Then + EgtLuaCreateGlobTable("WALL") + EgtLuaSetGlobStringVar("WALL.BASEDIR", IniFile.m_sWallDirPath) + If EgtGetUserLevel() >= 9 AndAlso GetPrivateProfileInt(S_LUA, K_BWSIM, 0) = 1 then EgtLuaSetGlobBoolVar("WALL.BW", true) + End If + End Sub + + Private Shared Sub OnPostControllerExec() Handles m_ProjectVM.OnPostControllerExec + If m_sCurrBarName = "Beam" Then + EgtLuaResetGlobVar("BEAM") + ElseIf m_sCurrBarName = "Wall" Then + EgtLuaResetGlobVar("WALL") + End If End Sub #End Region ' LuaExecCommand diff --git a/Utility/IniFile.vb b/Utility/IniFile.vb index c0474e4..6f6a35b 100644 --- a/Utility/IniFile.vb +++ b/Utility/IniFile.vb @@ -210,8 +210,8 @@ Public Module IniFile Return False End Function - Public Function GetPrivateProfileButton(sSection As String, sKey As String, sBaseDir As String, ByRef ReadedButtonItem As ButtonItem) As Boolean - ReadedButtonItem = Nothing + Public Function GetPrivateProfileButton(sSection As String, sKey As String, sBaseDir As String, ByRef ReadButtonItem As ButtonItem) As Boolean + ReadButtonItem = Nothing Dim sVal As String = String.Empty GetPrivateProfileString(sSection, sKey, "", sVal) If String.IsNullOrWhiteSpace(sVal) Then Return False @@ -225,7 +225,7 @@ Public Module IniFile If sLuaPath.Contains(".lua") Then sLuaPath = sBaseDir & "\" & sLuaPath If Not String.IsNullOrWhiteSpace(sImagePath) Then sImagePath = sBaseDir & "\" & sImagePath End If - ReadedButtonItem = New ButtonItem(sLuaPath, sImagePath, sToolTip, sDrawMachOrBoth) + ReadButtonItem = New ButtonItem(sSection, sLuaPath, sImagePath, sToolTip, sDrawMachOrBoth) Return True End If Return False @@ -250,13 +250,27 @@ Public Module IniFile Friend Function IsActiveBeam() As Boolean Dim bIsActive As Boolean = (IniFile.m_nKeyOptions And KEY_OPT.BEAM) <> 0 And (GetPrivateProfileInt(S_BEAM, K_BEAMENABLE, 0) <> 0) - If bIsActive Then GetPrivateProfileString(S_BEAM, K_BEAMBASEDIR, "", m_sBeamDirPath) + If bIsActive Then + Dim sTemp As String = "" + GetPrivateProfileString(S_BEAM, K_BEAMBASEDIR, "", sTemp) + #If PLATFORM = "x64" Then + GetPrivateProfileString(S_BEAM, K_BEAMBASEDIR64, sTemp, sTemp) + #End If + m_sBeamDirPath = sTemp.TrimEnd( "\"c) + End If Return bIsActive End Function Friend Function IsActiveWall() As Boolean Dim bIsActive As Boolean = (IniFile.m_nKeyOptions And KEY_OPT.WALL) <> 0 And (GetPrivateProfileInt(S_WALL, K_WALLENABLE, 0) <> 0) - If bIsActive Then GetPrivateProfileString(S_WALL, K_WALLBASEDIR, "", m_sWallDirPath) + If bIsActive Then + Dim sTemp As String = "" + GetPrivateProfileString(S_WALL, K_WALLBASEDIR, "", sTemp) + #If PLATFORM = "x64" Then + GetPrivateProfileString(S_WALL, K_WALLBASEDIR64, sTemp, sTemp) + #End If + m_sWallDirPath = sTemp.TrimEnd( "\"c) + End If Return bIsActive End Function diff --git a/Utility/Map.vb b/Utility/Map.vb index 3d65a2f..00d8de9 100644 --- a/Utility/Map.vb +++ b/Utility/Map.vb @@ -46,7 +46,7 @@ Module Map Return m_refTopCommandBarVM End Get End Property - Public ReadOnly Property refProjectVM As ProjectVM + Public ReadOnly Property refProjectVM As ProjectVM Get Return m_refProjectVM End Get