From b43f8275e5ef6045b01b296f958d714b1c652a3f Mon Sep 17 00:00:00 2001 From: "luca.bacis" Date: Fri, 21 Jan 2022 11:27:48 +0100 Subject: [PATCH] - minors --- LuaLibs/ProcessLapJoint.lua | 61 ++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 75e40b0..2d497ff 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -478,7 +478,7 @@ local function VerifyChainSaw( dMinDim, dMaxDim) dSawThick = TI.dThick or dSawThick dSawCornerRad = TI.dCornerRad or dSawCornerRad dMaxDepth = TI.dMaxDepth or dMaxDepth - if dSawThick < dMinDim + 10 * GEO.EPS_SMALL and dSawWidth < dMaxDim + 10 * GEO.EPS_SMALL then + if dSawThick < ( dMinDim + 10 * GEO.EPS_SMALL) and dSawWidth < ( dMaxDim + 10 * GEO.EPS_SMALL) then bUseChainSaw = true end end @@ -527,7 +527,7 @@ local function VerifyBHSideMill( Proc, bSinglePart, bPrevBhSideMill) local dThickTool = 0 local dToolDiam = 0 -- 22/09/2021 Su richiesta di Alessandro Sola, si toglie la richiesta di presenza del parametro Q per poter applicare - -- la lavorazione su più features( che non hanno questo parametro Q), quindi questa lavorazione viene verificata se è abilitato il parametro utensile + -- la lavorazione su più features (che non hanno questo parametro Q), quindi questa lavorazione viene verificata se è abilitato il parametro utensile -- che ovviamente tramite la lavorazione è abbinata alla lista lavorazioni con BHSideMill. -- Al fine di mantenere il funzionamento precedente (purtroppo non sono stati descritti i motivi del confrontare il parametro Q) -- 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) @@ -542,8 +542,8 @@ local function VerifyBHSideMill( Proc, bSinglePart, bPrevBhSideMill) if bSinglePart == nil then -- se lunghezza non richiede spezzatura setto la variabile bSinglePart per non fare con fresa BH -- perchè deve avere almeno 2 facce - if not( ( Proc.Box:getDimX() > BD.LONGCUT_MAXLEN) or - ( Proc.Box:getDimX() > 0.8 * _b3Solid:getDimX() and Proc.Box:getDimX() > BD.LONGCUT_ENDLEN)) then + if not ( ( Proc.Box:getDimX() > BD.LONGCUT_MAXLEN) or + ( Proc.Box:getDimX() > 0.8 * _b3Solid:getDimX() and Proc.Box:getDimX() > BD.LONGCUT_ENDLEN)) then bSinglePart = true end end @@ -888,7 +888,7 @@ function ProcessLapJoint.Classify( Proc, b3Raw) else -- se può essere fatto con utensile tipo lama local bUseBHSideMill, _, _, dMaxMat = VerifyBHSideMill( Proc) --- if bUseBHSideMill and ( dMaxMat <= dV + 15 * GEO.EPS_SMALL) then +-- if bUseBHSideMill and ( dMaxMat <= tFData.dV + 15 * GEO.EPS_SMALL) then if bUseBHSideMill and ( dMaxMat <= tFData.dH + 15 * GEO.EPS_SMALL) then return true, false -- altrimenti controllo se deve essere ruotato con le altre lavorazioni @@ -1003,7 +1003,7 @@ local function DoMill( Proc, sMilling, offset, nFacInd, nFac2Ind, vtN) -- aggiungo geometria EgtSetMachiningGeometry( {{ Proc.Id, nFacInd}}) -- imposto uso faccia e lato correzione - local nFaceUse = BL.GetNearestOrthoOpposite( vtN[nFac2Ind + 1]) + local nFaceUse = BL.GetNearestOrthoOpposite( vtN[nFac2Ind+1]) EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) -- imposto lato di correzione EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) @@ -1012,7 +1012,7 @@ local function DoMill( Proc, sMilling, offset, nFacInd, nFac2Ind, vtN) -- aggiungo offset laterale if offset then EgtSetMachiningParam( MCH_MP.OFFSR, offset) end -- imposto posizione braccio porta testa - if vtN[nFacInd + 1]:getY() < GEO.EPS_SMALL then + if vtN[nFacInd+1]:getY() < GEO.EPS_SMALL then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM) else EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) @@ -1425,53 +1425,53 @@ local function SetOpenSide( nPathInt, vtOrtho, nStartPoint) local pPini = EgtUP( nPathInt, (i - 1), GDB_RT.GLOB) local pPend = EgtUP( nPathInt, EgtIf( i == nNumEnt, 0, i), GDB_RT.GLOB) -- Se normale lungo la Z considero il box in X e Y - if abs(vtOrtho:getZ()) > 0.999 then + if abs( vtOrtho:getZ()) > 0.999 then -- se corrisponde a X prendo i punti per eventuale modifica del punto di inizio percorso - if TestPoints(nPathInt, i - 1, 10 * GEO.EPS_SMALL, pPini, pPend, 'X') then + if TestPoints( nPathInt, i - 1, 10 * GEO.EPS_SMALL, pPini, pPend, 'X') then pLastPIni = pPini pLastPEnd = pPend -- altrimenti se corrisponde a Y prendo i punti per eventuale modifica del punto di inizio percorso - elseif TestPoints(nPathInt, i - 1, 10 * GEO.EPS_SMALL, pPini, pPend, 'Y') then + elseif TestPoints( nPathInt, i - 1, 10 * GEO.EPS_SMALL, pPini, pPend, 'Y') then pLastPIni = pPini pLastPEnd = pPend end -- altrimenti se normale lungo la Y considero il box in X e Z - elseif abs(vtOrtho:getZ()) < 0.001 and abs(vtOrtho:getY()) > 0.999 then + elseif abs( vtOrtho:getZ()) < 0.001 and abs( vtOrtho:getY()) > 0.999 then -- se corrisponde a X prendo i punti per eventuale modifica del punto di inizio percorso - if TestPoints(nPathInt, i - 1, 10 * GEO.EPS_SMALL, pPini, pPend, 'X') then + if TestPoints( nPathInt, i - 1, 10 * GEO.EPS_SMALL, pPini, pPend, 'X') then pLastPIni = pPini pLastPEnd = pPend -- altrimenti se corrisponde a Z prendo i punti per eventuale modifica del punto di inizio percorso - elseif TestPoints(nPathInt, i - 1, 10 * GEO.EPS_SMALL, pPini, pPend, 'Z') then + elseif TestPoints( nPathInt, i - 1, 10 * GEO.EPS_SMALL, pPini, pPend, 'Z') then pLastPIni = pPini pLastPEnd = pPend end -- caso che non dovrebbe mai capitare ma gestito per completezza -- altrimenti se normale lungo la X considero il box in Y e Z - elseif abs(vtOrtho:getZ()) < 0.001 and abs(vtOrtho:getX()) > 0.999 then + elseif abs( vtOrtho:getZ()) < 0.001 and abs( vtOrtho:getX()) > 0.999 then -- se corrisponde a Y prendo i punti per eventuale modifica del punto di inizio percorso - if TestPoints(nPathInt, i - 1, 10 * GEO.EPS_SMALL, pPini, pPend, 'Y') then + if TestPoints( nPathInt, i - 1, 10 * GEO.EPS_SMALL, pPini, pPend, 'Y') then pLastPIni = pPini pLastPEnd = pPend -- altrimenti se corrisponde a Z prendo i punti per eventuale modifica del punto di inizio percorso - elseif TestPoints(nPathInt, i - 1, 10 * GEO.EPS_SMALL, pPini, pPend, 'Z') then + elseif TestPoints( nPathInt, i - 1, 10 * GEO.EPS_SMALL, pPini, pPend, 'Z') then pLastPIni = pPini pLastPEnd = pPend end -- se asse Z orizzontale verifico se si avvicina piú a Y - elseif abs(vtOrtho:getZ()) < 0.001 then - if abs(vtOrtho:getY()) > 0.75 then + elseif abs( vtOrtho:getZ()) < 0.001 then + if abs( vtOrtho:getY()) > 0.75 then -- se corrisponde a Z prendo i punti per eventuale modifica del punto di inizio percorso - if TestPoints(nPathInt, i - 1, 10 * GEO.EPS_SMALL, pPini, pPend, 'Z') then + if TestPoints( nPathInt, i - 1, 10 * GEO.EPS_SMALL, pPini, pPend, 'Z') then pLastPIni = pPini pLastPEnd = pPend end end -- se asse Y a 0 (fresa ne davanti ne dietro) verifico se si avvicina piú a Z+ - elseif abs(vtOrtho:getY()) < 0.001 then - if abs(vtOrtho:getZ()) > 0.75 then + elseif abs( vtOrtho:getY()) < 0.001 then + if abs( vtOrtho:getZ()) > 0.75 then -- se corrisponde a Y prendo i punti per eventuale modifica del punto di inizio percorso - if TestPoints(nPathInt, i - 1, 10 * GEO.EPS_SMALL, pPini, pPend, 'Y') then + if TestPoints( nPathInt, i - 1, 10 * GEO.EPS_SMALL, pPini, pPend, 'Y') then pLastPIni = pPini pLastPEnd = pPend end @@ -2297,7 +2297,7 @@ end local function ErasePathIfNecessary( nPathId, sDeleteByDir, dDiff) local ptP1 = EgtSP( nPathId, GDB_RT.GLOB) local ptP2 = EgtEP( nPathId, GDB_RT.GLOB) - if abs( EgtIf( sDeleteByDir == 'X', (ptP1:getX() - ptP2:getX()), EgtIf( sDeleteByDir == 'Y', (ptP1:getY() - ptP2:getY()), (ptP1:getZ() - ptP2:getZ())))) > dDiff then + if abs( EgtIf( sDeleteByDir == 'X', ( ptP1:getX() - ptP2:getX()), EgtIf( sDeleteByDir == 'Y', ( ptP1:getY() - ptP2:getY()), ( ptP1:getZ() - ptP2:getZ())))) > dDiff then EgtErase( nPathId) end end @@ -2322,7 +2322,7 @@ local function TestPaths( sDeleteByDir, nStartId, nNumIds, dDiff) end -- se non ho trovato da inserirlo aggiungo nuovo elemento in tabella if not bInsTab then - table.insert( tPaths, {{( nIdx)}, ptP1:getX()}) + table.insert( tPaths, {{ nIdx}, ptP1:getX()}) dMaxVal = EgtIf( sDeleteByDir == 'X', _b3Solid:getMax():getX(), EgtIf( sDeleteByDir == 'Y', _b3Solid:getMax():getY(), _b3Solid:getMax():getZ())) dMinVal = EgtIf( sDeleteByDir == 'X', _b3Solid:getMin():getX(), EgtIf( sDeleteByDir == 'Y', _b3Solid:getMin():getY(), _b3Solid:getMin():getZ())) end @@ -2684,7 +2684,7 @@ local function MakeByMillAsSaw( Proc, tFData, nBottomFace, sMillingOnSide, dSawD end end -- in base all'elevazione calcolo l'impronta della lama - local dUsedBladeLen = sqrt( ((dSawDiam / 2) * (dSawDiam / 2)) - ( ((dSawDiam / 2) - tFData.dFacElev) * ((dSawDiam / 2) - tFData.dFacElev))) + local dUsedBladeLen = sqrt( ( (dSawDiam / 2) * (dSawDiam / 2)) - ( ( (dSawDiam / 2) - tFData.dFacElev) * ( (dSawDiam / 2) - tFData.dFacElev))) -- controllo direzione taglio e se il minimo della feature sborda in coda if abs( vtN:getX()) < GEO.EPS_SMALL and abs( _b3Solid:getMin():getX() - Proc.Box:getMin():getX()) < 100 * GEO.EPS_SMALL and dDistToNextPiece < dUsedBladeLen then -- do avviso che la lama può sbordare nel pezzo successivo @@ -3260,7 +3260,7 @@ end --------------------------------------------------------------------- local function DoHeadCut( Proc, nMchFId, sTuuidPk, dDiamTool, dElev, nSideFace, tvtN) if not sTuuidPk or not dDiamTool then - local sErr = 'Error : DoHeadCut has wrong parameters' + local sErr = 'Error : DoHeadCut misses some parameters' EgtOutLog( sErr) return false, sErr end @@ -3731,7 +3731,6 @@ end --------------------------------------------------------------------- local function ManageAntiSplintBySaw( Proc, bIsU, vtN, nFacInd, sWarn, bMillDown, bReduceDepth) - local bMadeASbyBld = false local nNumFac = EgtIf( bIsU, 2, 1) local nPrefSide = 1 -- di preferenza il motore è meglio tenerlo sinistra @@ -4564,7 +4563,7 @@ local function MakeSidePocketings( Proc, tFData, dCollSic, bSpecialMillOnSide, end sPocketing = ML.FindPocketing( sMchFind, dDiam) if not sPocketing then - local sErr2 = 'Error : '..sMchFind..' not found in library' + local sErr2 = 'Error : ' .. sMchFind .. ' not found in library' EgtOutLog( sErr2) return 1, false, sErr2 end @@ -4809,8 +4808,8 @@ local function MakePocketingOrMilling( Proc, tFData, bSinglePart) EgtErase( nTestId) if bNewIsU and ( not BD.MIN_LEN_LAMELLO or - ( Proc.TotBox and Proc.TotBox:getDimX() > BD.MIN_LEN_LAMELLO) or - ( not Proc.TotBox and Proc.Box:getDimX() > BD.MIN_LEN_LAMELLO)) then + ( Proc.TotBox and Proc.TotBox:getDimX() > BD.MIN_LEN_LAMELLO) or + ( not Proc.TotBox and Proc.Box:getDimX() > BD.MIN_LEN_LAMELLO)) then -- recupero la lavorazione if BD.DOWN_HEAD and tFData.vtN:getZ() < BD.NZ_MINA then sMillingOnSide = ML.FindMilling( 'SideMillAsBlade_H2') @@ -4925,7 +4924,7 @@ local function MakePocketingOrMilling( Proc, tFData, bSinglePart) tDimAndRef[2] = { dH2, dV2, rfFac2} local ptPs = ( ptP1 + ptP2) / 2 local bOk, sWarn2 = MachineByMill( Proc, tvtNx, tFData.nFacInd, vAdj[i], ptPs, tDimAndRef, - EgtIf( Proc.Fct == 3 and bIsU, 0, 2), nUseRoughTool, dAng, sPocketing, sTuuidPk, tFData.dFacElev) + EgtIf( Proc.Fct == 3 and bIsU, 0, 2), nUseRoughTool, dAng, sPocketing, sTuuidPk, tFData.dFacElev) if not bOk then return bOk, sWarn2 end sWarn = FormatWarning( sWarn, sWarn2) end