From 2d8ee96d5f758c8adc1fdafbe575874dc9fd3531 Mon Sep 17 00:00:00 2001 From: DarioS Date: Fri, 16 Sep 2022 17:50:31 +0200 Subject: [PATCH] =?UTF-8?q?3dPrinting=20:=20-=20miglioria=20per=20riconosc?= =?UTF-8?q?imento=20necessit=C3=A0=20salvataggio=20progetto=20prima=20di?= =?UTF-8?q?=20slicing.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/RunSlicing.lua | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) 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()