diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index bab79b6..337b5cc 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -43,6 +43,7 @@ -- 2023/01/31 Nelle lavorazioni in doppio aggiunta la minima distanza tra le feature. -- 2023/02/17 Ora le forature che intersecano le mortase sono sempre fatte prima della mortasa stessa. -- 2023/02/17 Nelle tasche in doppio, la distanza minima ammessa tra le feature è stata portata a 50. +-- 2023/02/20 Ora le mortase a coda di rondine laterali sono sempre fatte prima dei tagli longitudinali. -- Tabella per definizione modulo local BeamExec = {} @@ -705,6 +706,16 @@ local function OrderFeatures( vProc, b3Raw) B2.Box:getCenter():getX() > B1.Box:getMin():getX() and B2.Box:getCenter():getX() < B1.Box:getMax():getX() then return false end + -- se prima è coda di rondine e secondo taglio longitudinale, la coda di rondine va sempre prima + if DtMortise.SideIdentify(B1) and ( LongCut.Identify(B2) or Long2Cut.Identify(B2)) and + OverlapsXY( B1.Box, B2.Box) then + return true + end + -- se primo è taglio longitudinale e seconda è coda di rondine, il taglio longitudinale va sempre dopo + if ( LongCut.Identify(B1) or Long2Cut.Identify(B1)) and DtMortise.SideIdentify(B2) and + OverlapsXY( B1.Box, B2.Box) then + return false + end -- se entrambi tenoni e si intersecano, metto prima tenone vero e poi base tenone if ( Tenon.Identify( B1) or DtTenon.Identify( B1)) and ( Tenon.Identify( B2) or DtTenon.Identify( B2)) and B1.Box:getMin():getX() < B2.Box:getMax():getX() + 100 * GEO.EPS_SMALL and B2.Box:getMin():getX() < B1.Box:getMax():getX() + 100 * GEO.EPS_SMALL then diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 72ed4ec..e2a2996 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -62,7 +62,8 @@ -- 2023/01/19 In MakeMoreFaces -> MakeBySideMill aggiunto controllo che lo step finale non superi lo spessore utensile. -- 2023/01/24 In MakeByPocket gestito caso il caso in cui veniva applicata una fresatura con percorso vuoto. Ora viene rimossa e la tasca viene fatta con lama. -- 2023/02/06 Alla MakeDrillOnCorner aggiunto controllo distanza di sicurezza minima. --- 2023/02/16 Piccola correziona alla scelta utensile di svuotatura. +-- 2023/02/16 Piccola correzione alla scelta utensile di svuotatura. +-- 2023/02/21 Piccola correzione alla MakeByPocket. -- Tabella per definizione modulo local ProcessLapJoint = {} @@ -3503,22 +3504,21 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha local bMakeContour = false local sMilling if dFacElev < dMinFaceElevForPocket and ( bIsU or bIsL) and ( Proc.Fct == 2 or Proc.Fct == 3) and abs( vtN:getZ()) > 0.996 then - bMakeContour = true -- recupero la lavorazione di contornatura sMilling = ML.FindMilling( 'Prof', nil, nil, nil, nil, not bMillDown, bMillDown) if not sMilling then local sMyWarn = 'Warning : Prof not found in library' EgtOutLog( sMyWarn) - return true, sMyWarn end -- recupero i dati dell'utensile dDiamTool = 50 dMaxDepth = 0 - if EgtMdbSetCurrMachining( sMilling) then + if sMilling and EgtMdbSetCurrMachining( sMilling) then local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then dDiamTool = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dToolMaxDepth + bMakeContour = true end end end diff --git a/LuaLibs/ProcessLongCut.lua b/LuaLibs/ProcessLongCut.lua index 0a4df10..9578eea 100644 --- a/LuaLibs/ProcessLongCut.lua +++ b/LuaLibs/ProcessLongCut.lua @@ -20,6 +20,8 @@ -- 2023/01/27 In MakeSideFace il prolungamento di uscita è ora fissato a 10 mm. -- 2023/01/27 In caso di lavorazione aggiuntiva con fresa a catena il taglio con lama da sotto viene effettuato a step. -- 2023/02/15 Migliorato verso di avanzamento della lama. +-- 2023/02/21 Verso di avanzamento della lama migliorato anche con lama LC. +-- 2023/02/22 Nuova gestione del verso di avanzamento ottimale che contempla tutti i casi. -- Tabella per definizione modulo local ProcessLongCut = {} @@ -921,33 +923,75 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus if ( not bFront and k == 1) or ( bFront and k == 2) then dSal, dEal = dEal, dSal end - + + -- settaggio di workside, uso faccia e eventuale inversione + -- verifico lama in uso e imposto uso faccia + local bIsTopBladeCurrent + local nFaceUseCurrent if bCanUseBlade and bCanUseUnderBlade then - EgtSetMachiningParam( MCH_MP.INVERT, true) - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) - dSal, dEal = dEal, dSal - -- imposto uso della faccia - EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse2, nFaceUse)) - elseif bCanUseBlade and BD.USE_LONGCUT then - EgtSetMachiningParam( MCH_MP.INVERT, true) - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) - dSal, dEal = dEal, dSal - -- imposto uso della faccia - EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse2, nFaceUse)) - elseif bCanUseUnderBlade then - if abs(nSide) ~= 2 then - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) + if k == 1 then + bIsTopBladeCurrent = true + nFaceUseCurrent = nFaceUse2 + else + bIsTopBladeCurrent = false + nFaceUseCurrent = nFaceUse + end + elseif bCanUseUnderBlade then + if k == 1 then + bIsTopBladeCurrent = false + nFaceUseCurrent = nFaceUse + else + bIsTopBladeCurrent = false + nFaceUseCurrent = nFaceUse2 end - -- imposto uso della faccia - EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse, nFaceUse2)) else - EgtSetMachiningParam( MCH_MP.INVERT, false) - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) - dSal, dEal = dEal, dSal - -- imposto uso della faccia - EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse, nFaceUse2)) + if k == 1 then + bIsTopBladeCurrent = true + nFaceUseCurrent = nFaceUse + else + bIsTopBladeCurrent = true + nFaceUseCurrent = nFaceUse2 + end end + -- recupero alcune informazioni utili dalla lavorazione attuale + local bIsCurrentBladeCW + local bIsCurrentMachiningInverted + if bIsTopBladeCurrent then + EgtMdbSetCurrMachining( sCutting) + else + EgtMdbSetCurrMachining( sCuttingDn) + end + bIsCurrentBladeCW = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0 + bIsCurrentMachiningInverted = EgtMdbGetCurrMachiningParam( MCH_MP.INVERT) + + -- imposto la direzione di lavoro per avere scarico del truciolo ottimale + local nWorkSide, bInvert + if not bIsTopBladeCurrent and abs( nSide) ~= 2 then + if bIsCurrentBladeCW then + nWorkSide = MCH_MILL_WS.LEFT + bInvert = true + dSal, dEal = dEal, dSal + else + nWorkSide = MCH_MILL_WS.RIGHT + bInvert = false + end + else + if bIsCurrentBladeCW then + nWorkSide = MCH_MILL_WS.LEFT + bInvert = false + else + nWorkSide = MCH_MILL_WS.RIGHT + bInvert = true + dSal, dEal = dEal, dSal + end + end + + -- setto la lavorazione con i valori calcolati + EgtSetMachiningParam( MCH_MP.INVERT, bInvert) + EgtSetMachiningParam( MCH_MP.WORKSIDE, nWorkSide) + EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUseCurrent) + EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal) -- imposto offset radiale diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index fddbb06..11512af 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -13,6 +13,8 @@ -- 2023/01/26 Rimossa la pulitura della faccia laterale nel caso in cui la feature abbia almeno una faccia rivolta verso il basso. -- 2023/01/27 In MakeSideFace il prolungamento di uscita è ora fissato a 10 mm. -- 2023/02/15 Migliorato verso di avanzamento della lama. +-- 2023/02/21 Verso di avanzamento della lama migliorato anche con lama LC. +-- 2023/02/22 Nuova gestione del verso di avanzamento ottimale che contempla tutti i casi. -- Tabella per definizione modulo local ProcessLong2Cut = {} @@ -688,44 +690,87 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster if ( not bFront and k == 1) or ( bFront and k == 2) then dSal, dEal = dEal, dSal end + + -- settaggio di workside, uso faccia e eventuale inversione + -- verifico lama in uso e imposto uso faccia + local bIsTopBladeCurrent + local nFaceUseCurrent if bCanUseBlade and bCanUseUnderBlade then - if bCanUseBlade and nSide == -1 then - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) - -- imposto uso della faccia - EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse2, nFaceUse)) + if nSide == -1 then + if k == 1 then + bIsTopBladeCurrent = true + nFaceUseCurrent = nFaceUse2 + else + bIsTopBladeCurrent = false + nFaceUseCurrent = nFaceUse + end else - EgtSetMachiningParam( MCH_MP.INVERT, true) - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) - -- imposto uso della faccia - EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse, nFaceUse2)) + if k == 1 then + bIsTopBladeCurrent = false + nFaceUseCurrent = nFaceUse + else + bIsTopBladeCurrent = true + nFaceUseCurrent = nFaceUse2 + end end - elseif bCanUseBlade and BD.USE_LONGCUT then - EgtSetMachiningParam( MCH_MP.INVERT, true) - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) - dSal, dEal = dEal, dSal - -- imposto uso della faccia - EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse, nFaceUse2)) elseif bCanUseUnderBlade then - if nSide ~= 0 then - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) - end - -- imposto uso della faccia - EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse, nFaceUse2)) - else - if bCanUseBlade and nSide == -1 then - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) + if k == 1 then + bIsTopBladeCurrent = false + nFaceUseCurrent = nFaceUse else - EgtSetMachiningParam( MCH_MP.INVERT, false) - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) + bIsTopBladeCurrent = false + nFaceUseCurrent = nFaceUse2 + end + else + if k == 1 then + bIsTopBladeCurrent = true + nFaceUseCurrent = nFaceUse + else + bIsTopBladeCurrent = true + nFaceUseCurrent = nFaceUse2 + end + end + + -- recupero alcune informazioni utili dalla lavorazione attuale + local bIsCurrentBladeCW + local bIsCurrentMachiningInverted + if bIsTopBladeCurrent then + EgtMdbSetCurrMachining( sCutting) + else + EgtMdbSetCurrMachining( sCuttingDn) + end + bIsCurrentBladeCW = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0 + bIsCurrentMachiningInverted = EgtMdbGetCurrMachiningParam( MCH_MP.INVERT) + + -- imposto la direzione di lavoro per avere scarico del truciolo ottimale + local nWorkSide, bInvert + if ( not bIsTopBladeCurrent and abs( nSide) ~= 0) or ( bCanUseBlade and bCanUseUnderBlade and nSide == -1) then + if bIsCurrentBladeCW then + nWorkSide = MCH_MILL_WS.LEFT + bInvert = true + dSal, dEal = dEal, dSal + else + nWorkSide = MCH_MILL_WS.RIGHT + bInvert = false + end + else + if bIsCurrentBladeCW then + nWorkSide = MCH_MILL_WS.LEFT + bInvert = false + else + nWorkSide = MCH_MILL_WS.RIGHT + bInvert = true dSal, dEal = dEal, dSal end - -- imposto uso della faccia - EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse, nFaceUse2)) end + -- setto la lavorazione con i valori calcolati + EgtSetMachiningParam( MCH_MP.INVERT, bInvert) + EgtSetMachiningParam( MCH_MP.WORKSIDE, nWorkSide) + EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUseCurrent) + EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal) - -- imposto offset radiale EgtSetMachiningParam( MCH_MP.OFFSR, EgtIf( nSide == -1, -dOffset, dOffset)) -- imposto attacco/uscita