diff --git a/LuaLibs/FacesBySaw.lua b/LuaLibs/FacesBySaw.lua index 4caccce..cb94c89 100644 --- a/LuaLibs/FacesBySaw.lua +++ b/LuaLibs/FacesBySaw.lua @@ -1,4 +1,4 @@ --- FacesBySaw.lua by Egaltech s.r.l. 2022/09/24 +-- FacesBySaw.lua by Egaltech s.r.l. 2023/05/18 -- Gestione taglio con lama di feature con una o due facce -- 2021/01/06 Cambiato limite per attacco Tg con lama e CalcLeadInOutGeom rinominata in CalcLeadInOutPerpGeom. -- 2021/02/03 In taglio lama si accettano anche due lati con deviazione minore di 20deg. @@ -14,7 +14,8 @@ -- 2022/06/29 DS In MakeTwo modificato controllo facce dirette verso il basso. -- 2022/09/08 In MakeOne aggiunto argomento bForceInvert per poter forzare l'inversione del percorso. -- 2023/02/13 Migliorata la direzione di lavoro della lama in modo da essere tendenzialmente opposta all'avanzamento. --- 2023/04/20 Alcune modifiche per gestire tagli con faceuse parallelo +-- 2023/04/20 Alcune modifiche per gestire tagli con faceuse parallelo. +-- 2023/05/18 Imposto in ogni caso dVzLimDwnUp prima anche di bDownHead. -- Tabella per definizione modulo local FacesBySaw = {} @@ -44,8 +45,10 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw nOrthoOpposite = Par5 vtOrthO = BL.GetVersRef( Par5) end - -- verifico se testa da sotto + -- verifico se testa da sotto oppure se lavorazione sotto con testa da sopra + if not dVzLimDwnUp then dVzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN, vtOrthO) end local bDownHead = ( dVzLimDwnUp and dVzLimDwnUp < - 1.5) + local bDownUp = ( vtN:getZ() < dVzLimDwnUp) -- linea o bilinea di lavorazione (qui uso nOrthoOpposite per ripetere esattamente il calcolo del Mach) local ptP1, ptPm, ptP2, vtV1, vtV2, dLen, dWidth = EgtSurfTmFacetOppositeSide( nSurfId, nFacet, BL.GetVersRef( nOrthoOpposite), GDB_ID.ROOT) if not dLen or dLen < 1.1 or not dWidth or dWidth < 1.1 then @@ -54,24 +57,24 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw return true, '' end vtV1 = - vtV1 - -- verifico se lavorazione con lama sotto e testa sopra - if not dVzLimDwnUp then dVzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN, vtOrthO) end - local bDownUp = ( vtN:getZ() < dVzLimDwnUp) -- verifico se la lama ruota in senso antiorario if not EgtMdbSetCurrMachining( sCutting) then return false end - local bIsSawCCW = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0 + local bIsSawCCW = ( EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0) local bInvert = bForceInvert -- se la lama ruota in senso antiorario inverto la direzione di lavorazione, per avere rotazione lama opposta a avanzamento - if bInvert == nil and bIsSawCCW and not bDownUp then - if ( ptP2:getZ() > ptP1:getZ() + 100 * GEO.EPS_SMALL) then - bInvert = false + if bInvert == nil then + if not BD.TURN then + if bIsSawCCW and not bDownUp then + bInvert = ( ptP2:getZ() < ptP1:getZ() + 100 * GEO.EPS_SMALL) + else + bInvert = ( ptP2:getZ() < ptP1:getZ() - 100 * GEO.EPS_SMALL) + end else - bInvert = true + local vtTmp = ptP2 - ptP1 ; vtTmp:normalize() + bInvert = ( ( vtOrthO:getX() > 0.1 and vtTmp:getX() < -0.1) or ( vtOrthO:getX() < -0.1 and vtTmp:getX() > 0.1)) end - elseif bInvert == nil then - bInvert = ( ptP2:getZ() < ptP1:getZ() - 100 * GEO.EPS_SMALL) end if bInvert then ptP1, ptP2 = ptP2, ptP1 @@ -148,15 +151,13 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw local b3Box = BBox3d( b3Raw) b3Box:expand( dCutSic) local dCutDeltaN, dCutDeltaX = dCutOffset, dCutExtra - -- per lavorazioni parallele, nel calcolo dei lead in e out gli offset vanno invertiti - if ( - nFaceUse == MCH_MILL_FU.PARAL_DOWN or - nFaceUse == MCH_MILL_FU.PARAL_TOP or - nFaceUse == MCH_MILL_FU.PARAL_FRONT or - nFaceUse == MCH_MILL_FU.PARAL_BACK or - nFaceUse == MCH_MILL_FU.PARAL_LEFT or - nFaceUse == MCH_MILL_FU.PARAL_RIGHT - ) then + -- per lavorazioni parallele, nel calcolo dei Lead-In e Out gli offset vanno invertiti + if ( nFaceUse == MCH_MILL_FU.PARAL_DOWN or + nFaceUse == MCH_MILL_FU.PARAL_TOP or + nFaceUse == MCH_MILL_FU.PARAL_FRONT or + nFaceUse == MCH_MILL_FU.PARAL_BACK or + nFaceUse == MCH_MILL_FU.PARAL_LEFT or + nFaceUse == MCH_MILL_FU.PARAL_RIGHT) then dCutDeltaN, dCutDeltaX = dCutDeltaX, dCutDeltaN end local ptP1act = ptP1 + vtN * dCutDeltaN @@ -170,7 +171,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw local dLenLi2 = abs( dLi2Tang) local dLenLo2 = abs( dLo2Tang) -- scelgo l'attacco più conveniente (se non taglio praticamente longitudinale) - local bTurnTang + local bLioTang local Ktp = 1.1 if BD.KIOTP then Ktp = BD.KIOTP end if ( not bDownUp or abs( vtTg:getY()) > 0.5) and @@ -179,10 +180,11 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw ( ( abs( vtTg:getZ()) < 0.17 and ( vtV1:getZ() < -0.5 or vtV2:getZ() < -0.5) and not bDownHead) or ( abs( vtTg:getZ()) < 0.51 and b3Box:getDimZ() > 300 and BD.C_SIMM and BD.MAX_HEIGHT > 450 and b3Box:getDimX() > BD.LEN_SHORT_PART) or ( abs( vtTg:getZ()) < 0.51 and ( dLenLi2 + dLenLo2) < ( dLenLi + dLenLo)) or Ktp * ( dLenLi2 + dLenLo2) < ( dLenLi + dLenLo)) then + bLioTang = true dLiTang, dLiPerp, dLoTang, dLoPerp = dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp if BD.TURN then - bTurnTang = true - dLoTang = -( dLiTang + dAllStart - dAccStart + dAllEnd - dAccEnd + dLen) + local dMove = dist( ptP1, ptP2) + dLoTang = -( dLiTang + dAllStart - dAccStart + dAllEnd - dAccEnd + dMove) dLoPerp = BD.COLL_SIC end end @@ -198,8 +200,9 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw nSCC = EgtIf( ( vtAux:getY() > -GEO.EPS_SMALL), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM) end else - if bTurnTang then - local vtTest = EgtIf( bInvert, vtTg, -vtTg) + if bLioTang then + --local vtTest = EgtIf( bInvert, vtTg, -vtTg) + local vtTest = -vtTg if abs( vtTest:getY()) > abs( vtTest:getZ()) then nSCC = EgtIf( vtTest:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM) else @@ -246,7 +249,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw -- imposto attacco/uscita EgtSetMachiningParam( MCH_MP.LITANG, dLiTang) EgtSetMachiningParam( MCH_MP.LIPERP, dLiPerp) - if bTurnTang then EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG) end + if BD.TURN and bLioTang then EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG) end EgtSetMachiningParam( MCH_MP.LOTANG, dLoTang) EgtSetMachiningParam( MCH_MP.LOPERP, dLoPerp) -- imposto allungamenti iniziale e finale @@ -332,7 +335,7 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType, local nOtInd = 3 - nUpInd -- metto in relazione la scelta facce con il confronto del versore Z con la scelta in base alla grandezza faccia -- se la faccia più grande è messa secondaria e il suo versore Z non è troppo negativo - if nOtInd == nBigInd and vtN[nBigInd]:getZ() > -0.5 and vtN[nSmaInd]:getZ() < 0.966 then + if nOtInd == nBigInd and (( vtN[nBigInd]:getZ() > -0.5 and vtN[nSmaInd]:getZ() < 0.966) or bDownHead) then nUpInd = nBigInd nOtInd = nSmaInd end diff --git a/LuaLibs/ProcessRidgeLap.lua b/LuaLibs/ProcessRidgeLap.lua index 0e5a666..0a42616 100644 --- a/LuaLibs/ProcessRidgeLap.lua +++ b/LuaLibs/ProcessRidgeLap.lua @@ -1,4 +1,4 @@ --- ProcessRidgeLap.lua by Egaltech s.r.l. 2021/09/10 +-- ProcessRidgeLap.lua by Egaltech s.r.l. 2023/05/18 -- Gestione calcolo mezzolegno di testa per Travi -- Tabella per definizione modulo @@ -26,8 +26,8 @@ end --------------------------------------------------------------------- -- Classificazione della feature function ProcessRidgeLap.Classify( Proc, b3Raw) - -- se PF con testa da sotto, ammessa qualunque orientazione - if BD.C_SIMM and BD.DOWN_HEAD then + -- se PF con testa da sotto oppure TURN, ammessa qualunque orientazione + if ( BD.C_SIMM and BD.DOWN_HEAD) or BD.TURN then return true, false end -- Se più corta del limite si può fare anche da sotto diff --git a/LuaLibs/ProcessRoundArch.lua b/LuaLibs/ProcessRoundArch.lua index 31477a5..5b4efe0 100644 --- a/LuaLibs/ProcessRoundArch.lua +++ b/LuaLibs/ProcessRoundArch.lua @@ -1,4 +1,4 @@ --- ProcessRoundArch.lua by Egaltech s.r.l. 2021/01/29 +-- ProcessRoundArch.lua by Egaltech s.r.l. 2023/05/18 -- Gestione calcolo archi per Travi -- Tabella per definizione modulo @@ -93,6 +93,8 @@ function ProcessRoundArch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) EgtOutLog( sErr) return false, sErr end + -- normale alla superficie nel mezzo + local vtN = EgtSurfTmFacetNormVersor( Proc.Id, Proc.Fct // 2, GDB_RT.GLOB) -- recupero e verifico l'entità curva local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') if AuxId then AuxId = AuxId + Proc.Id end @@ -222,13 +224,27 @@ function ProcessRoundArch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) end -- posizione braccio porta testa - if Proc.Head then - EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_XP) - elseif Proc.Tail then - EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_XM) - elseif AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then - EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) + local nSCC = MCH_SCC.NONE + if not BD.C_SIMM and not BD.TURN then + if Proc.Head then + nSCC = MCH_SCC.ADIR_XP + elseif Proc.Tail then + nSCC = MCH_SCC.ADIR_XM + elseif AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then + nSCC = MCH_SCC.ADIR_YP + end + elseif BD.TURN then + if vtN:getZ() > 0.707 then + nSCC = MCH_SCC.ADIR_ZP + elseif vtN:getZ() < -0.707 then + nSCC = MCH_SCC.ADIR_ZM + elseif vtN:getY() > 0.707 then + nSCC = MCH_SCC.ADIR_YP + elseif vtN:getY() < -0.707 then + nSCC = MCH_SCC.ADIR_YM + end end + EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- eseguo if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() diff --git a/Version.lua b/Version.lua index 4a6c7cd..abf9560 100644 --- a/Version.lua +++ b/Version.lua @@ -1,6 +1,6 @@ --- Version.lua by Egaltech s.r.l. 2023/05/11 +-- Version.lua by Egaltech s.r.l. 2023/05/18 -- Gestione della versione di Beam NAME = 'Beam' -VERSION = '2.5e3' +VERSION = '2.5e4' MIN_EXE = '2.5c1'