From 050c129d1eb9f2496fe970fa8dbd429024bd21ff Mon Sep 17 00:00:00 2001 From: "luca.bacis" Date: Wed, 29 Dec 2021 09:13:12 +0100 Subject: [PATCH] - Ottimizzazioni --- LuaLibs/ProcessLapJoint.lua | 68 ++++++++++++------------------------- 1 file changed, 21 insertions(+), 47 deletions(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 7ca5559..3bc2188 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -357,8 +357,7 @@ local function VerifyBHSideMill( Proc, bMasterIsU, bMasterIsL, bSinglePart, bPre -- si elude il controllo del Q solo se la variabile del Beamdata BD.BH_MACHINE segnala che non è una macchina tipo BH (ha la fresa blockhaus al posto della lama) -- se non feature BlockHausHalfLap o non abilitato parametro Q per lavorarlo di fianco esco - local nUseSideTool = Q_SIDE_ROUGH_TOOL - if Proc.Prc ~= 37 and nUseSideTool == 0 and not BD.BH_MACHINE then + if Proc.Prc ~= 37 and Q_SIDE_ROUGH_TOOL == 0 and not BD.BH_MACHINE then return false end -- verifico se U @@ -2260,17 +2259,17 @@ local function ExtractExternalPaths( nPathInt, nNumIdAux, vtOrtho, b3Solid, nAdd if sDeleteByDir == 'Z' then -- se hanno variazione in Z cancello l'entità if abs( ptP1:getZ() - ptP2:getZ()) > 10 * GEO.EPS_SMALL then - EgtErase( nStartId + i - 1) + EgtErase( nStartId + i - 1) end elseif sDeleteByDir == 'Y' then -- se hanno variazione in Y cancello l'entità if abs( ptP1:getY() - ptP2:getY()) > 10 * GEO.EPS_SMALL then - EgtErase( nStartId + i - 1) + EgtErase( nStartId + i - 1) end elseif sDeleteByDir == 'X' then -- se hanno variazione in X cancello l'entità if abs( ptP1:getX() - ptP2:getX()) > 10 * GEO.EPS_SMALL then - EgtErase( nStartId + i - 1) + EgtErase( nStartId + i - 1) end end end @@ -4415,21 +4414,6 @@ local function AreAllFacesOrthogonal( nSurfId, dCosSideAng) return dOrtho end ---------------------------------------------------------------------- -local function MakeObliquePoket( Proc, nPartId, tvtN, nSideFace, ptPs, tDimAndRef, nUseRoughTool, dAng, sPocketing, dPrevFaceElev) - - local sMchFind = 'Pocket' - - -- applico la svuotatura - local bOk, sWarn, _, _, _ = MakePocket( Proc, nPartId, ptPs, tvtN, nSideFace, sMchFind, nUseRoughTool, sPocketing, dPrevFaceElev, tDimAndRef, dAng) - - if not bOk and sWarn == '' then - sWarn = 'Unable to make Pocket on oblique face' - end - - return bOk, sWarn -end - --------------------------------------------------------------------- local function MakeSpecialThreeFaces( Proc, nPhase, bIsL, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nChamfer) @@ -4545,9 +4529,12 @@ local function MakeSpecialThreeFaces( Proc, nPhase, bIsL, nRawId, nPartId, dOvmH _, tvtNx[2] = EgtSurfTmFacetCenter( Proc.Id, vAdj[i], GDB_ID.ROOT) tDimAndRef[2] = {dH2, dV2, rfFac2} local ptPs = ( ptP1 + ptP2) / 2 - local bOk, sWarn = MakeObliquePoket( Proc, nPartId, tvtNx, vAdj[i], ptPs, tDimAndRef, nUseRoughTool, dAng, sPocketing, dFacElev) + local sMchFind = 'Pocket' + -- applico la svuotatura + local bOk, sWarn, _, _, _ = MakePocket( Proc, nPartId, ptPs, tvtNx, vAdj[i], sMchFind, nUseRoughTool, sPocketing, dPrevFaceElev, tDimAndRef, dAng) + if not bOk then - EgtOutLog( sWarn) + EgtOutLog( 'Unable to make Pocket on the oblique face: ' + sWarn) end end end @@ -4688,8 +4675,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa local bTryWithBlades = true -- lavoro fessura con svuotature (singola o doppia contrapposta) local sMyMchFind = 'Pocket' - local nOk, sErr, dDimMin, dDimMax, dDepth, vtOrtho, - nLundIdFace = MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMyMchFind, false, b3Solid, bClosedOrthoFaces) + local nOk, sErr, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace = + MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMyMchFind, false, b3Solid, bClosedOrthoFaces) if nOk < 0 then return false, sErr elseif nOk > 0 then @@ -4808,7 +4795,6 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa local bOk, sErr = MakeSpecialThreeFaces( Proc, nPhase, bIsL, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nChamfer) return bOk, sErr end - -- altrimenti lavorazione di svuotatura o contornatura else local bUseOtherFace @@ -4826,7 +4812,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa EgtOutLog( sErr) return false, sErr end - rfFac, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT) + --- rfFac, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT) -- se forma a L e la componente in X è maggiore di 60° e non in testa allora verifico se posso utilizzare la faccia secondaria if bIsL and abs( vtN:getX()) > 0.866 and ( Proc.Box:getMax():getX() < b3Solid:getMax():getX() - 10 or vtN:getX() < 0) and @@ -4888,15 +4874,13 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa end sMchFindBackUp = sMchFind local nUseRoughTool = EgtIf( bSinglePart, 0, 1) - local nUseRT -- 04/08/2020 Se settato parametro uso truciolatore (parametro Q), non si devono prendere altre frese, si da errore (Fabio) -- Questa opzione si scontra facilmente con altre interpretazioni dello stasso parametro Q (per tornare indietro bNewCheck = false) local bNewCheck = true -- se processo 20 e non sto usando il truciolatore if bNewCheck and Proc.Prc == 20 and nUseRoughTool == 0 then -- verifico se forzato uso truciolatore - nUseRT = Q_USE_ROUGH_TOOL - if nUseRT and nUseRT ~= 0 then + if Q_USE_ROUGH_TOOL and Q_USE_ROUGH_TOOL ~= 0 then sMchFind = 'OpenPocket' nUseRoughTool = 1 end @@ -4904,15 +4888,14 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa -- 03/12/2020 aggiunto controllo su feature 30 senza uso truciolatore if bNewCheck and Proc.Prc == 30 and nUseRoughTool == 0 then -- verifico se forzato uso truciolatore - nUseRT = Q_SIDE_ROUGH_TOOL - if nUseRT and nUseRT ~= 0 then + if Q_SIDE_ROUGH_TOOL and Q_SIDE_ROUGH_TOOL ~= 0 then sMchFind = 'OpenPocket' nUseRoughTool = 1 end end -- se processo 20 e non sto usando il truciolatore if Proc.Prc == 20 and nUseRoughTool == 0 then - if nUseRT and nUseRT ~= 0 then + if Q_USE_ROUGH_TOOL and Q_USE_ROUGH_TOOL ~= 0 then sMchFind = 'OpenPocket' nUseRoughTool = 1 end @@ -4958,7 +4941,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa if ( Proc.Prc == 16 or Proc.Prc == 30 or Proc.Prc == 32 or Proc.Prc == 39) then -- verifico se ho una gola con 3 facce ed eventualmente delle facce terminali: -- faccio una copia della superfice ed elimino le facce che hanno dimensione X < 1 e le facce risultanti devono essere una U - local nTestId = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL + local nTestId = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL if nTestId then local bNewIsU local bExit @@ -5448,26 +5431,21 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- se ho attivo la lama e ho la feature 30, verifico i parametri Q propri della feature if bUseBlade then if Proc.Prc == 30 then - local nBladeAntisplint = Q_ANTISPLINT_TYPE - local nUseRoughToolOnSide = Q_SIDE_ROUGH_TOOL nForceUseBladeOnNotContinueFace = Q_BLADE_ON_ALONG_FACE -- se antischeggia di fresa o abilitato sgrossatore di fianco - if nBladeAntisplint == 2 or nUseRoughToolOnSide == 1 then + if Q_ANTISPLINT_TYPE == 2 or Q_SIDE_ROUGH_TOOL == 1 then bUseBlade = false end -- se ho attivo la lama e ho la feature 32, verifico i parametri Q propri della feature elseif Proc.Prc == 32 then - local nBladeAntisplint = Q_ANTISPLINT_TYPE - local nUseRoughToolOnSide = Q_SIDE_ROUGH_TOOL -- se antischeggia di fresa o abilitato sgrossatore di fianco - if nBladeAntisplint == 2 or nUseRoughToolOnSide == 1 then + if Q_ANTISPLINT_TYPE == 2 or Q_SIDE_ROUGH_TOOL == 1 then bUseBlade = false end -- se ho attivo la lama e ho la feature 34, verifico i parametri Q propri della feature elseif Proc.Prc == 34 then - local nBladeAntisplint = Q_ANTISPLINT_TYPE -- se antischeggia di fresa o abilitato sgrossatore di fianco - if nBladeAntisplint == 2 then + if Q_ANTISPLINT_TYPE == 2 then bUseBlade = false end end @@ -5477,12 +5455,8 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) ( Proc.Box:getDimX() > 0.8 * b3Solid:getDimX() and Proc.Box:getDimX() > BD.LONGCUT_ENDLEN) then -- una faccia if Proc.Fct == 1 then - if bUseBlade then - if nForceUseBladeOnNotContinueFace and nForceUseBladeOnNotContinueFace > 0 then - return LongCut.Make( Proc, nPhase, nRawId, nPartId, bUseBlade, nForceUseBladeOnNotContinueFace) - else - return LongCut.Make( Proc, nPhase, nRawId, nPartId) - end + if bUseBlade and nForceUseBladeOnNotContinueFace and nForceUseBladeOnNotContinueFace > 0 then + return LongCut.Make( Proc, nPhase, nRawId, nPartId, bUseBlade, nForceUseBladeOnNotContinueFace) else return LongCut.Make( Proc, nPhase, nRawId, nPartId) end