diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index 6133984..f65dc8d 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -860,7 +860,7 @@ function BeamLib.GetBlockedAxis( sMachining, sBlockedAxis, b3Raw, vtTool, vtOut) end -- se presente funzione specifica nella macchina, la richiamo if BD.GetBlockedAxis then - return BD.GetBlockedAxis( sHead, nToolType, sBlockedAxis, b3Raw, vtTool, vtOut) + return BD.GetBlockedAxis( sHead, nToolType, sBlockedAxis, b3Raw, vtTool, vtOut) or '' -- sezione mantenuta per retrocompatibilità con GetChainSawBlockedAxis elseif nToolType == MCH_TY.MORTISE_STD then local nInd = EgtIf( sBlockedAxis == 'parallel', 0, 1) diff --git a/LuaLibs/ProcessHeadCut.lua b/LuaLibs/ProcessHeadCut.lua index dbfbafb..12ccc6d 100644 --- a/LuaLibs/ProcessHeadCut.lua +++ b/LuaLibs/ProcessHeadCut.lua @@ -281,7 +281,7 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut local dLastCutOffset = i * dOffsL local vtMoveLimitingSurf = Vector3d( dLastCutOffset - 10 * GEO.EPS_SMALL, 0, 0) EgtMove( nLimitingSurf, vtMoveLimitingSurf, GDB_RT.GLOB) - local vtNLimitingSurf = EgtSurfTmFacetNormVersor( nLimitingSurf, 0) + local vtNLimitingSurf = EgtSurfTmFacetNormVersor( nLimitingSurf, 0, GDB_ID.ROOT) if AreSameVectorApprox( X_AX(), vtNLimitingSurf) then EgtInvertSurf( nLimitingSurf) end end -- tagli verticali diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 7736ea6..314e656 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -89,6 +89,10 @@ -- 2023/12/06 In VerifySideMillAsSaw, se SIDEDEPTH non definita, viene calcolata. -- 2024/01/18 Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile. -- 2024/01/22 Implementata gestione seghe a catena multiple. +-- 2024/01/31 In tagli con sega a catena ora si considera l'ingombro della testa per il calcolo della massima profondità. +-- Aggiunta funzione GetToolEntryAngle per determinare l'angolo di ingresso dell'utensile nella faccia. +-- 2024/02/08 Ora i rabbet lungo X che guardano in basso sono sempre fatti con fresatura di lato per evitare di ruotare. +-- 2024/02/13 In MakeMoreFaces escluse le Groove 2 facce dalla gestione Special3faces. -- Tabella per definizione modulo local ProcessLapJoint = {} @@ -323,7 +327,8 @@ local function VerifyChainSaw( Proc, dMinDim, dMaxDim, dDepth) local dMaxMat = 0 local dSawCornerRad = 0 local dSawThick = 0 - local dMaxDepth = 200 + local dMaxDepth = 200 + local dSawWidth = 0 -- se non trova una lavorazione di sawing esco if not sSawing then return bUseChainSaw @@ -346,7 +351,7 @@ local function VerifyChainSaw( Proc, dMinDim, dMaxDim, dDepth) end end end - return bUseChainSaw, sSawing, dMaxMat, dSawCornerRad, dSawThick, dMaxDepth + return bUseChainSaw, sSawing, dMaxMat, dSawCornerRad, dSawThick, dMaxDepth, dSawWidth end --------------------------------------------------------------------- @@ -755,8 +760,9 @@ function ProcessLapJoint.Classify( Proc, b3Raw) local bDown = ( vtN[1]:getZ() < BD.NZ_MINB and vtN[2]:getZ() < BD.NZ_MINB) or ( vtN[1]:getZ() < BD.NZ_MINA and vtN[2]:getZ() < 0.5 and ( vtN[2]:getZ() < -0.1 or not bSmall)) or ( vtN[2]:getZ() < BD.NZ_MINA and vtN[1]:getZ() < 0.5 and ( vtN[1]:getZ() < -0.1 or not bSmall)) - -- se forzata la lavorazione con fresa di lato da parametro Q03=2/3 non devo ruotare - local bForceSideMill = ( EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'd') == 2 or EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'd') == 3) + -- se forzata la lavorazione con fresa di lato da parametro Q03=2/3 non devo ruotare; se rabbet lungo X che guarda in giù sempre fresatura di lato e quindi non ruoto + local bIsRabbetAlongXTowardsBottom = ( Proc.TopologyLongName == 'Rabbet-Through-RightAngles-Parallel-2' and ( Proc.AffectedFaces.Front or Proc.AffectedFaces.Back) and Proc.AffectedFaces.Bottom and Proc.AffectedFaces.Left and Proc.AffectedFaces.Right) + local bForceSideMill = ( bIsRabbetAlongXTowardsBottom or ( EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'd') == 2 or EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'd') == 3)) bDown = ( bDown and not BD.DOWN_HEAD and not BD.TURN and not bForceSideMill) return true, bDown -- se più di 2 facce @@ -1348,6 +1354,54 @@ local function CheckToInvert( AuxId, bPositive) return false end +--------------------------------------------------------------------- +--- +---@param Proc table la feature +---@param vtTool Vector3d il vettore direzione utensile +---@return number dAngle angolo tra la faccia d'ingresso e la direzione utensile +---@return number dSinAngle seno dell'angolo +---@return number dCosAngle coseno dell'angolo +---@return number|nil dTanAngle tangente dell'angolo +local function GetToolEntryAngle( Proc, vtTool) + + local dSinAngle = -10 * GEO.EPS_SMALL + local vtNorm + if Proc.AffectedFaces.Top then + vtNorm = Z_AX() + dSinAngle = max( dSinAngle, vtTool * vtNorm) + end + if Proc.AffectedFaces.Bottom then + vtNorm = -Z_AX() + dSinAngle = max( dSinAngle, vtTool * vtNorm) + end + if Proc.AffectedFaces.Front then + vtNorm = -Y_AX() + dSinAngle = max( dSinAngle, vtTool * vtNorm) + end + if Proc.AffectedFaces.Back then + vtNorm = Y_AX() + dSinAngle = max( dSinAngle, vtTool * vtNorm) + end + if Proc.AffectedFaces.Left then + vtNorm = -X_AX() + dSinAngle = max( dSinAngle, vtTool * vtNorm) + end + if Proc.AffectedFaces.Right then + vtNorm = X_AX() + dSinAngle = max( dSinAngle, vtTool * vtNorm) + end + + local dCosAngle = sqrt( 1 - sqr( dSinAngle)) + local dAngle = acos( dCosAngle) + local dTanAngle + if dAngle ~= 0 and dAngle ~= 90 then + dTanAngle = sqrt( 1 - dCosAngle * dCosAngle) / dCosAngle + end + + return dAngle, dSinAngle, dCosAngle, dTanAngle + +end + --------------------------------------------------------------------- local function MakeRoundCleanCorner( Proc, nPhase, nRawId, nPartId, b3Raw, nFacInd, nAddGrpId, dDiam, bMillDown, bDoubleSide) @@ -2671,6 +2725,8 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, local b3Raw = EgtGetRawPartBBox( nRawId) -- ottengo la distanza tra la fine del pezzo e il pezzo successivo local dDistToNextPiece = BL.GetDistanceToNextPart( nRawId, nPhase) + -- angolo d'ingresso dell'utensile + local dToolEntryAngle, _, _, dTanToolEntryAngle = GetToolEntryAngle( Proc, rfFac:getVersZ()) -- verifico se fessura con 3 facce o tunnel local bOrthoFaces local bIs3Faces = ( Proc.Fct == 3) @@ -2884,6 +2940,14 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, if nStep > 1 then dStep = ( dV - dSawThick) / ( nStep - 1) end + -- se necessario riduco la profondità di lavoro per considerare l'ingombro della testa + local dChainSawTHLength = EgtIf( EgtTdbGetCurrToolThLength() > 10 * GEO.EPS_SMALL, EgtTdbGetCurrToolThLength(), 88) + local dChainSawExtraLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) - dChainSawTHLength - dMaxDepth + local dMaxMatReduction = 0 + if dToolEntryAngle > 10 * GEO.EPS_ANG_SMALL and dToolEntryAngle < 90 - 10 * GEO.EPS_ANG_SMALL then + dMaxMatReduction = max( ( ( 2 * BD.C_SIMM_ENC - dSawWidth) / ( 2 * dTanToolEntryAngle) - dChainSawExtraLength) - 5, 0) + end + dMaxDepth = dMaxDepth - dMaxMatReduction for i = 1, nStep do -- Applico la lavorazione con sega a catena a questa faccia local sName = 'Csaw_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( i) @@ -2926,8 +2990,9 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, -- imposto offset radiale local dOffs = ( i - 1) * dStep EgtSetMachiningParam( MCH_MP.OFFSR, dOffs) - -- se necessario, avverto limitazioneo dell'affondamento - if dElev > dMaxDepth + 10 * GEO.EPS_SMALL then + -- se necessario, avverto limitazione dell'affondamento + if dElev > dMaxDepth + 10 * GEO.EPS_SMALL then + EgtSetMachiningParam( MCH_MP.DEPTH, dMaxDepth) sWarn = 'Warning in LapJoint : elevation (' .. EgtNumToString( dElev, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')' EgtOutLog( sWarn) --local dDepth = dMaxDepth - dElev @@ -4554,7 +4619,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa -- Se la svuotatura precedente non è stata fatta e chamfer non è mutuamente esclusivo provo con la sega-catena if bTryWithBlades and nChamfer < 2 then -- verifico se posso farlo con la sega-catena - local bMakeChainSaw, sSawing, dMaxMat, dSawCornerRad, dSawThick = VerifyChainSaw( Proc, dDimMin, dDimMax, dDepth) + local bMakeChainSaw, sSawing, dMaxMat, dSawCornerRad, dSawThick, _, dSawWidth = VerifyChainSaw( Proc, dDimMin, dDimMax, dDepth) if bMakeChainSaw then -- Ricalcolo l'affondamento tenendo conto di eventuale inclinazione local dSlDepth @@ -4588,12 +4653,20 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa dDepth = dDepth / 2 + BD.CUT_EXTRA end end - local dWorkDepth = dMaxMat + -- se necessario riduco la profondità di lavoro per considerare l'ingombro della testa + local dChainSawTHLength = EgtIf( EgtTdbGetCurrToolThLength() > 10 * GEO.EPS_SMALL, EgtTdbGetCurrToolThLength(), 88) + local dChainSawExtraLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) - dChainSawTHLength - dMaxMat + local dMaxMatReduction = 0 + local dToolEntryAngle, _, _, dTanToolEntryAngle = GetToolEntryAngle( Proc, vtOrtho) + if dToolEntryAngle > 10 * GEO.EPS_ANG_SMALL and dTanToolEntryAngle then + dMaxMatReduction = max( ( ( 2 * BD.C_SIMM_ENC - dSawWidth) / ( 2 * dTanToolEntryAngle) - dChainSawExtraLength) - 5, 0) + end + local dWorkDepth = dMaxMat - dMaxMatReduction -- cerco di estendere il taglio considerando la parte arrotondata della lama - if dMaxMat > dDepth + dSawCornerRad + 1 then + if dMaxMat - dMaxMatReduction > dDepth + dSawCornerRad + 1 then dWorkDepth = dDepth + dSawCornerRad + 1 -- se massimo affondamento utensile inferiore alla profondità da lavorare, setto la profondità di lavoro e emetto warning - elseif dMaxMat < dDepth then + elseif dMaxMat - dMaxMatReduction < dDepth then sWarn = 'Warning : elevation bigger than max tool depth' EgtOutLog( sWarn) end @@ -4635,8 +4708,9 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa local bIsU = ( Proc.Fct == 3 and not TestElleShape3( Proc)) -- verifico se due facce o L con una o due facce di terminazione local bIsL = ( Proc.Fct == 2 or TestElleShape3( Proc) or TestElleShape4( Proc) == 2) - -- se parametro Q03=2 forzo la fresatura di lato; con Q03=3 forzo solo se la faccia di lavoro non è rivolta verso l'alto +/-10° - local bForceSideMill = ( EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') == 2 or ( EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') == 3 and vtN:getZ() < 0.985)) and ( Proc.Fct == 4 or Proc.Fct == 3 or Proc.Fct == 2) + -- se parametro Q03=2 forzo la fresatura di lato; con Q03=3 forzo solo se la faccia di lavoro non è rivolta verso l'alto +/-10°; se rabbet lungo X che guarda in giù sempre fresatura di lato + local bIsRabbetAlongXTowardsBottom = ( Proc.TopologyLongName == 'Rabbet-Through-RightAngles-Parallel-2' and ( Proc.AffectedFaces.Front or Proc.AffectedFaces.Back) and Proc.AffectedFaces.Bottom and Proc.AffectedFaces.Left and Proc.AffectedFaces.Right) + local bForceSideMill = bIsRabbetAlongXTowardsBottom or ( ( EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') == 2 or ( EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') == 3 and vtN:getZ() < 0.985)) and ( Proc.Fct == 4 or Proc.Fct == 3 or Proc.Fct == 2)) -- se fattibile con fresa BH di fianco e spessore utensile inferiore alla larghezza faccia local bMakeBySideMill, bHead, bHeadDir, sMilling, dMaxMat, dToolDiam = VerifyBHSideMill( Proc, bIsU, bIsL, bSinglePart, bPrevBhSideMill) if bPrevBhSideMill == nil then @@ -4757,7 +4831,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa -- verifico se lavorando la faccia principale rimane esclusa molta sezione trasversale complessiva della feature (da box) local rfFac, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT) local bBoxF = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, rfFac) - if dH * dV < 0.9 * ( bBoxF:getDimX() * bBoxF:getDimY()) and nFacInd2 and dFacElev2 < 1.5 * dFacElev then + if dH * dV < 0.9 * ( bBoxF:getDimX() * bBoxF:getDimY()) and nFacInd2 and dFacElev2 < 1.5 * dFacElev and not ( Proc.Topology == 'Groove' and Proc.Fct == 2) then bSpecial3faces = true end -- se riconosciuta gestione 3 facce (limitatamente per ora alla feature 20) @@ -5896,6 +5970,8 @@ end -- Applicazione della lavorazione --------------------------------------------------------------------- function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) + -- inizializzazione costanti + if not BD.C_SIMM_ENC then BD.C_SIMM_ENC = EgtIf( BD.C_SIMM, 180, 90) end -- setto a nil la variabile smussi bMadeChamfer = nil -- limiti di fresatura semplice diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index bfda135..3bee763 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -879,8 +879,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- imposto posizione braccio porta testa per non ingombrare agli estremi EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- imposto angolo 3° asse rot - local bDownHead = not bIsTopBladeCurrent - local vtOut = EgtIf( vtN:getX() > 0, X_AX(), -X_AX()) + local vtOut = EgtIf( vtN[vOrd[j]]:getX() > 0, X_AX(), -X_AX()) EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCutting, 'perpendicular', b3Raw, vtN, vtOut)) -- eseguo if not ML.ApplyMachining( true, false) then @@ -1072,7 +1071,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- determino e imposto l'utilizzo della faccia EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse[vOrd[j]]) -- imposto angolo 3° asse rot - local vtOut = EgtIf( vtN:getX() > 0, X_AX(), -X_AX()) + local vtOut = EgtIf( vtN[vOrd[j]]:getX() > 0, X_AX(), -X_AX()) EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCutting, 'perpendicular', b3Raw, vtN, vtOut)) -- eseguo if not ML.ApplyMachining( true, false) then diff --git a/UpdateLog.txt b/UpdateLog.txt index 10a92fd..8eedcb5 100644 --- a/UpdateLog.txt +++ b/UpdateLog.txt @@ -1,5 +1,12 @@ ==== Beam Update Log ==== +Versione 2.6b1 (14/02/2024) +- Fixed : corretto bug in Split in cui si chiamava la EgtSurfTmFacetNormVersor senza riferimento +- Fixed : in L20 corretta gestione 2 facce +- Modif : modifiche per limiti pinzaggio con pinze con fronte verticale (ONE, PF) anzichè inclinato (FAST) quindi parametro BD.VICE_MINH grande +- Modif : nei tagli con sega a catena ora si considera l'ingombro della testa per il calcolo della massima profondità +- Modif : in LapJoint ora i rabbet lungo X che guardano in basso sono sempre fatti con fresatura di lato per evitare di ruotare. + Versione 2.6a1 (24/01/2024) - Added : in HeadCut e Split aggiunti tagli verticali addizionali per travi di larghezza elevata - Added : in Split gestita separazione con sega a catena + lama diff --git a/Version.lua b/Version.lua index 440bcb6..bab2abf 100644 --- a/Version.lua +++ b/Version.lua @@ -2,5 +2,5 @@ -- Gestione della versione di Beam NAME = 'Beam' -VERSION = '2.6a2' +VERSION = '2.6b1' MIN_EXE = '2.6a1'