diff --git a/LuaLibs/RunSlicing.lua b/LuaLibs/RunSlicing.lua index 8051f91..0d5b261 100644 --- a/LuaLibs/RunSlicing.lua +++ b/LuaLibs/RunSlicing.lua @@ -1,4 +1,4 @@ --- RunSlicing.lua by Egaltech s.r.l. 2022/09/15 +-- RunSlicing.lua by Egaltech s.r.l. 2022/09/16 -- Calcoli prima fase per Stampa 3d -- Tabella per definizione modulo @@ -234,14 +234,29 @@ local function SetViewInfo() EgtSetInfo( nViewId, TOOLPATH_GRP, true) end +--------------------------------------------------------------------- +local function VerifyNgeFile( sFilePath) + if not sFilePath or type( sFilePath) ~= 'string' then + return false + end + if EgtGetFileType then + return ( EgtGetFileType( sFilePath) == EEX_FT.NGE) + else + local _, _, sExt = EgtSplitPath( sFilePath or '') + return ( sExt:lower() == '.nge') + end +end + --------------------------------------------------------------------- function RunSlicing.Exec() - -- Verifico che il progetto abbia un nome + -- Verifico che il progetto abbia un nome valido local sCurrProjectPath = EgtGetCurrFilePath() - if not sCurrProjectPath or sCurrProjectPath == '' then - EgtOutBox( 'Save project before calculating slices!', 'Warning', 'WARNING') - return + if not PRINT or PRINT.PROGRAM ~= 1 then + if not VerifyNgeFile( sCurrProjectPath) then + EgtOutBox( 'Save project before calculating slices!', 'Warning', 'WARNING') + return + end end -- Recupero il primo pezzo giĆ  posizionato in macchina @@ -285,8 +300,10 @@ function RunSlicing.Exec() end -- Elimino eventuale precedente file dei risultati - local sResultFile = EgtChangePathExtension( sCurrProjectPath, '.csv') - EgtEraseFile( sResultFile) + if not PRINT or PRINT.PROGRAM ~= 1 then + local sResultFile = EgtChangePathExtension( sCurrProjectPath, '.csv') + EgtEraseFile( sResultFile) + end -- Elimino eventuale precedente lavorazione EgtSetCurrMachGroup()