diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index bbff33f..eecf5d3 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -1,7 +1,8 @@ --- BeamLib.lua by Egaltech s.r.l. 2020/10/23 +-- BeamLib.lua by Egaltech s.r.l. 2020/11/03 -- Libreria globale per Travi -- 2020/07/28 Corretto calcolo attacchi e uscite di lame per non uscire dalla faccia sotto. -- 2020/08/18 Aggiunto a GetNearestParalOpposite e GetNearestOrthoOpposite parametro opzionale vtNorm. +-- 2020/11/03 Aggiunta funzione IsEndOrEnd2Phase. -- Tabella per definizione modulo local BeamLib = {} @@ -896,5 +897,15 @@ function BeamLib.GetNzLimDownUp( b3Raw) end end +------------------------------------------------------------------------------------------------------------- +function BeamLib.IsEndOrEnd2Phase( nPhase) + local sVal = BeamLib.GetPhaseType( nPhase) + return ( sVal == 'END' or sVal == 'END2') +end +--------------------------------------------------------------------- +function BeamLib.GetPhaseType( nPhase) + return ( EgtGetInfo( EgtGetPhaseDisposition( nPhase) or GDB_ID.NULL, 'TYPE') or '') +end + ------------------------------------------------------------------------------------------------------------- return BeamLib diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index 38a1e89..62cc0d4 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -1,4 +1,4 @@ --- ProcessDrill.lua by Egaltech s.r.l. 2020/10/25 +-- ProcessDrill.lua by Egaltech s.r.l. 2020/11/03 -- Gestione calcolo forature per Travi -- Tabella per definizione modulo @@ -6,6 +6,7 @@ local ProcessDrill = {} -- Include require( 'EgtBase') +local BL = require( 'BeamLib') EgtOutLog( ' ProcessDrill started', 1) @@ -300,7 +301,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) if AreSameVectorApprox( vtExtr, Z_AX()) then nSCC = MCH_SCC.ADIR_YM elseif abs( vtExtr:getX()) < 0.1 then - nSCC = MCH_SCC.ADIR_XP + nSCC = EgtIf( BL.IsEndOrEnd2Phase( nPhase), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP) elseif vtExtr:getY() > 0.1 then nSCC = MCH_SCC.ADIR_YP end diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 6e43836..de50195 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -1,4 +1,4 @@ --- ProcessLapJoint.lua by Egaltech s.r.l. 2020/10/23 +-- ProcessLapJoint.lua by Egaltech s.r.l. 2020/11/03 -- Gestione calcolo mezzo-legno per Travi -- 2019/10/08 Agg. gestione OpenPocket. @@ -619,7 +619,7 @@ local function MakeOneFaceByMill( Proc, nPhase, nRawId, nPartId) -- recupero la lavorazione local sMilling = ML.FindMilling( 'BirdsMouth') if not sMilling then - local sErr = 'Error : milling not found in library' + local sErr = 'Error : BirdsMouth not found in library' EgtOutLog( sErr) return false, sErr end @@ -695,7 +695,7 @@ local function MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId) -- recupero la lavorazione local dTDiam = 0 if not sMilling then - local sErr = 'Error : milling not found in library' + local sErr = 'Error : LongSmallCut & BirdsMouth not found in library' EgtOutLog( sErr) return false, sErr else @@ -932,7 +932,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, nFacInd, rfFac, dH, dV else sMilling = ML.FindMilling( 'LongSmallCut') if not sMilling then - sErr = 'Error : milling not found in library' + sErr = 'Error : LongSmallCut not found in library' EgtOutLog( sErr) return false, sErr end @@ -1275,7 +1275,7 @@ local function MakeCleanCorner( Proc, nPhase, nRawId, nPartId, b3Raw, nFacInd, n -- recupero la lavorazione non calcolando l'elevazione sMilling = ML.FindMilling( 'CleanCorner', (dDiam*0.5)) if not sMilling then - local sErr = 'Error : clean corner milling/tool not found in library' + local sErr = 'Error : CleanCorner not found in library' EgtOutLog( sErr) return false, sErr end @@ -1765,7 +1765,7 @@ local function MakeChamfer( Proc, b3FacesUsed, nAddGrpId, vtOrtho, b3Solid, nSur -- recupero la lavorazione local sMilling = ML.FindMilling( 'Mark') if not sMilling then - local sErr = 'Error : chamfer not found in library' + local sErr = 'Error : Mark not found in library' EgtOutLog( sErr) return -1, sErr end @@ -1985,7 +1985,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, -- Recupero la lavorazione di lama local sCutting = ML.FindCutting( 'HeadSide') if not sCutting then - local sErr = 'Error : cutting not found in library' + local sErr = 'Error : HeadSide (cutting) not found in library' EgtOutLog( sErr) return false, sErr, 'MNF' end @@ -2030,7 +2030,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, -- Recupero la lavorazione local sSawing = ML.FindSawing( 'Sawing') if not sSawing then - local sErr = 'Error : chainsawing not found in library' + local sErr = 'Error : Sawing not found in library' EgtOutLog( sErr) return false, sErr, 'MNF' end @@ -2210,7 +2210,7 @@ local function MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw) -- Recupero la lavorazione di lama local sCutting = ML.FindCutting( 'HeadSide') if not sCutting then - local sErr = 'Error : cutting not found in library' + local sErr = 'Error : HeadSide (cutting) not found in library' EgtOutLog( sErr) return false, sErr end @@ -2291,7 +2291,7 @@ local function MakePocket( Proc, nPartId, ptPs, tvtN, nFaceRef, sMchFind, nUseRo sPocketing = ML.FindPocketing( sMchFind, dFaceDiamTool, dElev + dCollSic) end if not sPocketing then - local sErr = 'Error : pocketing not found in library' + local sErr = 'Error : '..sMchFind..' not found in library' EgtOutLog( sErr) return false, sErr end @@ -2322,19 +2322,20 @@ local function MakePocket( Proc, nPartId, ptPs, tvtN, nFaceRef, sMchFind, nUseRo -- imposto uso faccia EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT) -- imposto posizione braccio porta testa + local nSCC = MCH_SCC.NONE if not BD.C_SIMM then - if tvtN[2]:getY() < GEO.EPS_SMALL then - EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM) - else - EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) + nSCC = MCH_SCC.ADIR_YM + if AreSameVectorApprox( tvtN[2], Z_AX()) then + nSCC = MCH_SCC.ADIR_YM + elseif abs( tvtN[2]:getX()) < 0.1 then + nSCC = EgtIf( BL.IsEndOrEnd2Phase( EgtGetCurrPhase()), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP) + elseif tvtN[2]:getY() > 0.1 then + nSCC = MCH_SCC.ADIR_YP end else - if abs( tvtN[2]:getZ()) < 0.866 then - EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) - else - EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) - end + nSCC = MCH_SCC.NONE end + EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- se tasca aperta e non lavorata col truciolatore, imposto opportuno attacco if sMchFind == 'OpenPocket' and nUseRoughTool == 0 then EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN) @@ -2393,7 +2394,7 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, tvtN, nBas -- recupero la lavorazione local sMilling = ML.FindMilling( 'Long2Cut', dElev, sTuuidPk) if not sMilling then - local sErr = 'Error : milling not found in library' + local sErr = 'Error : Long2Cut not found in library' EgtOutLog( sErr) return false, sErr end @@ -2469,7 +2470,7 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, tvtN, nBas sMilling = ML.FindMilling( 'LongSmallCut', nil, sTuuidPk) end if not sMilling then - local sErr = 'Error : milling not found in library' + local sErr = 'Error : Long2Cut & LongSmallCut not found in library' EgtOutLog( sErr) return false, sErr end @@ -3144,7 +3145,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa -- Recupero la lavorazione di fresa local sMilling = ML.FindMilling( 'LongSmallCut') if not sMilling then - local sErr = 'Error : milling not found in library' + local sErr = 'Error : LongSmallCut not found in library' EgtOutLog( sErr) return false, sErr end @@ -3173,7 +3174,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa vtN, vtN2 = vtN2, vtN sPocketing = ML.FindPocketing( sMchFind, dDiam2, dFacElev2 + dCollSic2) if not sPocketing then - local sErr = 'Error : pocketing not found in library' + local sErr = 'Error : '..sMchFind..' not found in library' EgtOutLog( sErr) return false, sErr end @@ -3393,7 +3394,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa if sStat == 'MNF' then sPocketing = ML.FindPocketing( sMchFind, dDiam) if not sPocketing then - local sErr = 'Error : pocketing not found in library' + local sErr = 'Error : '..sMchFind..' not found in library' EgtOutLog( sErr) return false, sErr end @@ -3407,7 +3408,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa else sPocketing = ML.FindPocketing( sMchFind, dDiam) if not sPocketing then - local sErr = 'Error : pocketing not found in library' + local sErr = 'Error : '..sMchFind..' not found in library' EgtOutLog( sErr) return false, sErr end @@ -3456,7 +3457,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa if not bOk and sStat == 'MNF' then sPocketing = ML.FindPocketing( sMchFind, dDiam) if not sPocketing then - local sErr2 = 'Error : pocketing not found in library' + local sErr2 = 'Error : '..sMchFind..' not found in library' EgtOutLog( sErr2) return false, sErr2 end