From f84c491295fb61f906d970ec6a382d4a43fce4cd Mon Sep 17 00:00:00 2001 From: Emmanuele Sassi Date: Tue, 27 Sep 2022 17:20:33 +0200 Subject: [PATCH] - Aggiunti ProcessEvents su calcolo solido - Lettura pezzi per Icarus --- LuaLibs/RunCalcSolids.lua | 4 ++-- LuaLibs/RunGcodeGenerate.lua | 27 ++++++++++++++++++++++++++- LuaLibs/RunMachParamFromSWCalc.lua | 5 +++++ 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/LuaLibs/RunCalcSolids.lua b/LuaLibs/RunCalcSolids.lua index 6a872af..5687256 100644 --- a/LuaLibs/RunCalcSolids.lua +++ b/LuaLibs/RunCalcSolids.lua @@ -203,7 +203,7 @@ end function RunCalcSolids.Exec() local nPartIndex = 1 - local nPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, PART .. nPartIndex) + local nPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, PART .. nPartIndex) or EgtGetFirstNameInGroup( GDB_ID.ROOT, PART) while nPartId do if EgtGetInfo( nPartId, KEY_PART_ON_TABLE, 'b') then @@ -295,7 +295,7 @@ function RunCalcSolids.Exec() end nPartIndex = nPartIndex + 1 - nPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, PART .. nPartIndex) + nPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, PART .. nPartIndex) or EgtGetNextName( nPartId, PART) end end diff --git a/LuaLibs/RunGcodeGenerate.lua b/LuaLibs/RunGcodeGenerate.lua index e5918c4..d1c1870 100644 --- a/LuaLibs/RunGcodeGenerate.lua +++ b/LuaLibs/RunGcodeGenerate.lua @@ -23,6 +23,9 @@ end --------------------------------------------------------------------- function RunGcodeGenerate.Exec() + -- aggiorno interfaccia + EgtProcessEvents( 501, 0) + -- Recupero il pezzo (per ora primo e unico) local nPartIndex = 1 local nPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, PART .. nPartIndex) or EgtGetFirstNameInGroup( GDB_ID.ROOT, PART) @@ -41,6 +44,9 @@ function RunGcodeGenerate.Exec() -- Recupero i parametri relativi al layer local LayerParams = GetLayerParamsForGcodeGenerate( nPartId) + -- aggiorno interfaccia + EgtProcessEvents( 505, 0) + -- Ciclo sui layer local vEntId = {} for nIdx = 1, #vLayIds do @@ -50,7 +56,7 @@ function RunGcodeGenerate.Exec() -- recupero il gruppo dei percorsi utensile local nTpathGrpId = EgtGetFirstNameInGroup( nCrvGrpId, TOOLPATH_GRP) if not nTpathGrpId then - EgtOutBox( 'Error missing toolpaths', 'GcodeGenerate') + EgtOutBox( 'Error missing toolpaths', 'GcodeGenerate') return end -- recupero le entità nel gruppo @@ -68,6 +74,9 @@ function RunGcodeGenerate.Exec() return end + -- aggiorno interfaccia + EgtProcessEvents( 510, 0) + -- Imposto gruppo di lavoro EgtSetCurrMachGroup() @@ -87,6 +96,9 @@ function RunGcodeGenerate.Exec() return end + -- aggiorno interfaccia + EgtProcessEvents( 520, 0) + EgtSetMachiningGeometry( vEntId) local sNotes = EgtAdjustNotes( '', 'LinkZup', LayerParams.LinkZup) @@ -103,12 +115,18 @@ function RunGcodeGenerate.Exec() return end + -- aggiorno interfaccia + EgtProcessEvents( 550, 0) + -- Salvo il progetto local sFilePath = EgtGetCurrFilePath() sFilePath = EgtChangePathExtension( sFilePath, 'nge') EgtSetCurrFilePath( sFilePath) EgtSaveFile() + -- aggiorno interfaccia + EgtProcessEvents( 580, 0) + -- Genero il programma CN local sInfo = 'EgtCAM5 ver.' .. EgtGetExeVersion() .. ' - ' .. sPath local bGenOk = EgtGenerate( '', sInfo) @@ -116,6 +134,9 @@ function RunGcodeGenerate.Exec() EgtEstimate('') end + -- aggiorno interfaccia + EgtProcessEvents( 590, 0) + EgtResetCurrMachGroup() if PRINT and PRINT.PROGRAM == 1 then @@ -131,6 +152,10 @@ function RunGcodeGenerate.Exec() EgtOutBox( 'Generation failed.', 'GcodeGeneration', 'ERROR') end end + + -- aggiorno interfaccia + EgtProcessEvents( 600, 0) + end --------------------------------------------------------------------- diff --git a/LuaLibs/RunMachParamFromSWCalc.lua b/LuaLibs/RunMachParamFromSWCalc.lua index 22fb09e..d281bd0 100644 --- a/LuaLibs/RunMachParamFromSWCalc.lua +++ b/LuaLibs/RunMachParamFromSWCalc.lua @@ -57,6 +57,9 @@ function RunMachParamFromSWCalc.Exec() local dSliceStep = EgtGetInfo( nPartId, KEY_SLICE_STEP, 'd') local dStrand = EgtGetInfo( nPartId, KEY_STRAND, 'd') local dStrandCount = EgtGetInfo( nPartId, KEY_SHELLS_NBR, 'd') + -- recupero numero di strati per progress + local nLastLayerId = EgtGetLastNameInGroup( nPartId, SLICE_LAYER .. '*') + local nLayerQty = EgtGetInfo( nLastLayerId, KEY_SLICE_NBR, 'i') -- ciclo sui layer local nLayerIndex = 1 local nLayerId = EgtGetFirstNameInGroup( nPartId, SLICE_LAYER .. nLayerIndex) @@ -166,6 +169,8 @@ function RunMachParamFromSWCalc.Exec() EgtSetInfo( nLayerResultId, KEY_FCUR, dLayerFeed) EgtSetInfo( nLayerResultId, KEY_LENGTH, dTotLayerLength) EgtSetInfo( nLayerResultId, KEY_SPEED, dSpeed) + -- aggiorno interfaccia + EgtProcessEvents( 400 + ( nLayerIndex / nLayerQty * 100), 0) nLayerIndex = nLayerIndex + 1 nLayerId = EgtGetFirstNameInGroup( nPartId, SLICE_LAYER .. nLayerIndex) end