diff --git a/LuaLibs/CalcPaths.lua b/LuaLibs/CalcPaths.lua index 0d4daa7..50fcbbb 100644 --- a/LuaLibs/CalcPaths.lua +++ b/LuaLibs/CalcPaths.lua @@ -21,7 +21,7 @@ local s_vtSlicing local s_dOffsTol = 50 * GEO.EPS_SMALL --------------------------------------------------------------------- -local function GetLayerParamsForPathCalc() +local function GetLayerParamsForPathCalc() local LayerParams = {} LayerParams.bSpiralVase = EgtGetInfo( s_nPartId, KEY_SPIRAL_VASE, 'b') or false LayerParams.nShellsNbr = EgtGetInfo( s_nPartId, KEY_SHELLS_NBR, 'i') @@ -451,7 +451,8 @@ end --------------------------------------------------------------------------- local function ReorderPath( vOldIds, vNewIds) - if not vNewIds or not vOldIds then return end + if not vNewIds or #vNewIds == 0 then return end + if not vOldIds or #vOldIds == 0 then return end -- suddivido in base alla tipologia di loop ( esterno o interno) local tOldIds = {{}, {}} @@ -980,7 +981,7 @@ end ------------------------------------------------------------------- local function FindHoleCurve( pt, vLoopIds) -- trovo indice della curva di vLoopIds a cui appartiene pt ( in globale) - if not vLoopIds then return end + if not vLoopIds or #vLoopIds == 0 then return end for i = 1, #vLoopIds do local dPar = EgtCurveParamAtPoint( vLoopIds[i], pt, 100 * GEO.EPS_SMALL, GDB_RT.GLOB) if dPar then @@ -1726,13 +1727,12 @@ end local function HandleRibsIntersections( nRibsGrp, nOffsGrp, nRibsPathGrp, nSrfInt, nSrfExt, bAllTwoStrands, vTypeSequence, nLoopGrp, tSurfOffs) local bSpecialCase = false - local vOffsIds = EgtGetNameInGroup( nRibsPathGrp, RIBS_CRV .. '*') -- passate dei setti local vAllRibsIds = EgtGetNameInGroup( nRibsGrp, RIBS_CRV .. '*') -- setti originali local vRibsIds = {} -- ignoro setti che non hanno passate corrispondenti for i = 1, #vAllRibsIds do local vOffs = EgtGetNameInGroup( nRibsPathGrp, EgtGetName( vAllRibsIds[i])) - if vOffs then table.insert( vRibsIds, vAllRibsIds[i]) end + if vOffs and #vOffs > 0 then table.insert( vRibsIds, vAllRibsIds[i]) end end -- creo un gruppo con frame locale per calcolare le intersezioni ( è il piano XY locale dove calcolare intersezioni) @@ -2807,7 +2807,7 @@ local function HandleRibsIntersectionForRibsMergedShells( vOrigRibs, nRibsGrp, n -- ignoro setti che non hanno passate corrispondenti for i = 1, #vOrigRibs do local vOffs = EgtGetNameInGroup( nRibsGrp, EgtGetName( vOrigRibs[i])) - if vOffs then table.insert( vRibsIds, vOrigRibs[i]) end + if vOffs and #vOffs > 0 then table.insert( vRibsIds, vOrigRibs[i]) end end -- creo un gruppo con frame locale per calcolare le intersezioni ( è il piano XY locale dove calcolare intersezioni) @@ -3752,7 +3752,7 @@ local function ReorderExtraShells( nPathGrp, vPtStart, LayerParams) end local vIds = EgtGetNameInGroup( nPathGrp, EXTRA_SHELL_CRV .. '*') - if not vIds then return end + if not vIds or #vIds == 0 then return end -- eventuale inversione di tutte le curve if LayerParams.bPrintInvert then @@ -4101,7 +4101,7 @@ end local function AddExtraZigZag( nSrf, sName, dStrand, nGrp, nSrfTrim) local vIds = EgtGetNameInGroup( nGrp, sName) - if not vIds then return end + if not vIds or #vIds == 0 then return end local vtDir = EgtSV( vIds[1], GDB_ID.ROOT) local vtYLoc = s_vtSlicing ^ vtDir @@ -4308,7 +4308,7 @@ function CalcPaths.Exec( nPartId) s_nPartId = nPartId local vLayIds = EgtGetNameInGroup( s_nPartId, SLICE_LAYER.."*") - if not vLayIds then + if not vLayIds or #vLayIds == 0 then EgtOutBox( 'Error no slice', 'PathCalc') return true end diff --git a/LuaLibs/CalcToolPath.lua b/LuaLibs/CalcToolPath.lua index fa18fcc..c8cf1c7 100644 --- a/LuaLibs/CalcToolPath.lua +++ b/LuaLibs/CalcToolPath.lua @@ -537,7 +537,7 @@ end --------------------------------------------------------------------- local function CalcShellsToolPath( vEntIds, nTpathGrpId, LayerParams) - if not vEntIds then return end + if not vEntIds or #vEntIds == 0 then return end -- aggiungo le curve nel toolpath local vIds = AddCurvesToToolPath( vEntIds, nTpathGrpId, LayerParams.nOrder, LayerParams.bInvert, LayerParams.vtSlicing, LayerParams.dLayHeight) @@ -585,7 +585,7 @@ end --------------------------------------------------------------------- local function CalcExtraShellToolPath( vEntIds, nTpathGrpId, LayerParams) - if not vEntIds then return end + if not vEntIds or #vEntIds == 0 then return end -- aggiungo le curve nel toolpath local vIds = AddCurvesToToolPath( vEntIds, nTpathGrpId, PRINT_ORDER.EXT_INT, false, LayerParams.vtSlicing, LayerParams.dLayHeight) @@ -938,7 +938,7 @@ local function JoinShellsAndSolidFills( nInfillGrp, vShellIds, vExtraShells, Lay local nFillType = EgtGetInfo( nInfillGrp, KEY_FILL_TYPE, 'i') or FILL_TYPE.NONE - if nFillType == FILL_TYPE.OFFSET and vShellIds then + if nFillType == FILL_TYPE.OFFSET and vShellIds and #vShellIds > 0 then -- cerco indice di realizzazione dei vari elementi di stampa local vTypeSequence = {} @@ -955,7 +955,7 @@ local function JoinShellsAndSolidFills( nInfillGrp, vShellIds, vExtraShells, Lay end -- verifico se extra shell realizzate tra shell e infill - if vExtraShells and nMin < vTypeSequence[PRINT_ELEMENT.EXTRA_SHELL] and vTypeSequence[PRINT_ELEMENT.EXTRA_SHELL] < nMax then + if vExtraShells and #vExtraShells > 0 and nMin < vTypeSequence[PRINT_ELEMENT.EXTRA_SHELL] and vTypeSequence[PRINT_ELEMENT.EXTRA_SHELL] < nMax then return end @@ -996,7 +996,7 @@ local function CalcAuxSolidsToolPath( nAuxSolidsGrp, nAuxSolidsPathGrp, nTpathGr -- recupero tutti i percorsi relativi a quel solido local sName = EgtGetName( nSolidId) local vEntIds = EgtGetNameInGroup( nAuxSolidsPathGrp, sName .. '*') - if vEntIds then + if vEntIds and #vEntIds > 0 then -- recupero i parametri relativi al solido dalla curva di slicing local nFillType = EgtGetInfo( nSolidId, KEY_AUX_SOLIDS_INFILL, 'i') @@ -2156,7 +2156,7 @@ function CalcToolPath.Exec( nPartId) -- Recupero i layer da processare local vLayIds = EgtGetNameInGroup( s_nPartId, SLICE_LAYER.."*") - if not vLayIds then + if not vLayIds or #vLayIds == 0 then EgtOutBox( 'Error missing slices', 'ToolPathCalc') return true end diff --git a/LuaLibs/RunCalcSolids.lua b/LuaLibs/RunCalcSolids.lua index 6b1f9bc..4925b99 100644 --- a/LuaLibs/RunCalcSolids.lua +++ b/LuaLibs/RunCalcSolids.lua @@ -398,7 +398,7 @@ function RunCalcSolids.Exec() -- recupero i suoi slice local vLayIds = EgtGetNameInGroup( nPartId, SLICE_LAYER .. '*') - if not vLayIds then + if not vLayIds or #vLayIds == 0 then EgtOutBox( 'No sliced part in this project!', 'Error', 'ERROR') return end @@ -464,7 +464,7 @@ function RunCalcSolids.Exec() for i = 1, #vLayIds do local vGrpId = EgtGetNameInGroup( vLayIds[i], CONTOUR_GRP .. '*') or {} for j = 1, #vGrpId do - local nSolidId = EgtGetNameInGroup( vGrpId[j], SOLID_GRP .. '*') or GDB_ID.NULL + local nSolidId = EgtGetFirstNameInGroup( vGrpId[j], SOLID_GRP .. '*') or GDB_ID.NULL EgtErase( nSolidId) end end diff --git a/LuaLibs/RunGcodeGenerate.lua b/LuaLibs/RunGcodeGenerate.lua index 9171af2..2ebd2b5 100644 --- a/LuaLibs/RunGcodeGenerate.lua +++ b/LuaLibs/RunGcodeGenerate.lua @@ -36,7 +36,7 @@ function RunGcodeGenerate.Exec() -- Recupero i layer da processare local vLayIds = EgtGetNameInGroup( nPartId, SLICE_LAYER.."*") - if not vLayIds then + if not vLayIds or #vLayIds == 0 then EgtOutBox( 'Error missing slices', 'GcodeGenerate') return end diff --git a/Version.lua b/Version.lua index 19186b2..5541b92 100644 --- a/Version.lua +++ b/Version.lua @@ -1,4 +1,4 @@ -- Version.lua by Egaltech s.r.l. 2024/05/06 -- Gestione della versione di 3dPrinting -VERSION = '2.6l1' \ No newline at end of file +VERSION = '2.7a1' \ No newline at end of file