diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index b30c460..44a051f 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -289,7 +289,7 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH) Proc.Fcs = EgtGetInfo( Proc.Id, 'FCS', 'i') or 0 Proc.Fce = EgtGetInfo( Proc.Id, 'FCE', 'i') or 0 -- verifico se necessaria seconda lavorazione da parte opposta per foro più lungo della punta - if Drill.Split( Proc) then + if Drill.Split( Proc, b3Raw) then -- aggiorno flag prima parte foro (dati tabelle sempre per riferimento) Proc.Flg = 2 -- definisco dati seconda parte diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index e41068d..8e907f5 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -1,4 +1,4 @@ --- ProcessCut.lua by Egaltech s.r.l. 2019/06/29 +-- ProcessCut.lua by Egaltech s.r.l. 2019/07/08 -- Gestione calcolo singoli tagli di lama per Travi -- Tabella per definizione modulo @@ -139,7 +139,7 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- tutti gli altri casi vengono saltati -- caso generale else - local bOk, sErr = BL.MakeOneFaceBySaw( vCuts[i][j], 0, sCutting, dSawDiam, nOrthoOpposite, - 0.1, -0.5, BD.CUT_SIC, 0, 0, nil, b3Raw) + local bOk, sErr = BL.MakeOneFaceBySaw( vCuts[i][j], 0, sCutting, dSawDiam, nOrthoOpposite, nil, -0.5, BD.CUT_SIC, 0, 0, nil, b3Raw) if not bOk then return bOk, sErr end diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index 5e68207..7e4b8ae 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -1,4 +1,4 @@ --- ProcessDrill.lua by Egaltech s.r.l. 2019/07/02 +-- ProcessDrill.lua by Egaltech s.r.l. 2019/07/08 -- Gestione calcolo forature per Travi -- Tabella per definizione modulo @@ -56,7 +56,7 @@ end --------------------------------------------------------------------- -- Verifica se da lavorare in due metà -function ProcessDrill.Split( Proc) +function ProcessDrill.Split( Proc, b3Raw) -- recupero e verifico l'entità foro local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0 if AuxId then AuxId = AuxId + Proc.Id end @@ -73,8 +73,8 @@ function ProcessDrill.Split( Proc) if not sDrilling then return bOpen end - -- restituisco se va fatto in doppio - return ( bOpen and dLen > dMaxMat + 10 * GEO.EPS_SMALL) + -- restituisco se va fatto in doppio (solo fori orizzontali) + return ( bOpen and dLen > dMaxMat + 10 * GEO.EPS_SMALL and abs( vtExtr:getY()) * b3Raw:getDimZ() > abs( vtExtr:getZ()) * b3Raw:getDimY()) end --------------------------------------------------------------------- @@ -180,9 +180,15 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) end EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- aggiusto l'affondamento - local dDepth = min( dLen, dMaxDepth) + local sMyWarn + local dDepth = dLen if Proc.Flg == 2 or Proc.Flg == -2 then - local dDepth = min( dLen / 2 + BD.DRILL_OVERLAP, dMaxDepth) + dDepth = dLen / 2 + BD.DRILL_OVERLAP + end + if dDepth > dMaxDepth + 10 * GEO.EPS_SMALL then + sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')' + dDepth = dMaxDepth + EgtOutLog( sMyWarn .. ' (process ' .. tostring( Proc.Id) .. ')') end EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) -- dichiaro non si generano sfridi per VMill @@ -198,11 +204,11 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) EgtSetOperationMode( nMchFId, false) return false, sWarn else - return true, sWarn + return true, ( sMyWarn or sWarn) end end - return true + return true, sMyWarn end --------------------------------------------------------------------- diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 6863b77..f3a59b5 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -1,4 +1,4 @@ --- ProcessLapJoint.lua by Egaltech s.r.l. 2019/07/01 +-- ProcessLapJoint.lua by Egaltech s.r.l. 2019/07/08 -- Gestione calcolo mezzo-legno per Travi -- Tabella per definizione modulo @@ -9,6 +9,8 @@ require( 'EgtBase') local BL = require( 'BeamLib') local Cut = require( 'ProcessCut') local DoubleCut = require( 'ProcessDoubleCut') +local LongCut = require( 'ProcessLongCut') +local Long2Cut = require( 'ProcessLongDoubleCut') local Fbs = require( 'FacesBySaw') EgtOutLog( ' ProcessLapJoint started', 1) @@ -35,6 +37,10 @@ function ProcessLapJoint.IsHeadFeature( Proc, b3Raw, dCurrOvmH) if Proc.Box:getMax():getX() < b3Raw:getMax():getX() - dCurrOvmH - BD.MAX_DIST_HTFEA then return false end + -- la sua lunghezza non deve superare la metà della lunghezza della trave + if Proc.Box:getDimX() > 0.5 * b3Raw:getDimX() then + return false + end -- se una o due facce ora è sicuramente di testa if Proc.Fct <= 2 then return true @@ -62,6 +68,10 @@ function ProcessLapJoint.IsTailFeature( Proc, b3Raw) if Proc.Box:getMin():getX() > b3Raw:getMin():getX() + BD.MAX_DIST_HTFEA then return false end + -- la sua lunghezza non deve superare la metà della lunghezza della trave + if Proc.Box:getDimX() > 0.5 * b3Raw:getDimX() then + return false + end -- se una o due facce ora è sicuramente di coda if Proc.Fct <= 2 then return true @@ -100,7 +110,10 @@ function ProcessLapJoint.Classify( Proc) ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT) -- verifico se è lavorabile solo dal basso - local bDown = ( vtN[1]:getZ() < BD.NZ_MINB and vtN[2]:getZ() < BD.NZ_MINB) + local bSmall = ( Proc.Box:getDimX() < BD.MAX_LEN_RIDGELAP_FROM_BOTTOM) + local bDown = ( vtN[1]:getZ() < BD.NZ_MINB and vtN[2]:getZ() < BD.NZ_MINB) or + ( vtN[1]:getZ() < BD.NZ_MINA and ( abs( vtN[2]:getZ()) > 0.1 or not bSmall)) or + ( vtN[2]:getZ() < BD.NZ_MINA and ( abs( vtN[1]:getZ()) > 0.1 or not bSmall)) return true, bDown -- se più di 2 facce else @@ -232,7 +245,9 @@ local function MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId) -- aggiungo geometria EgtSetMachiningGeometry( {{ Proc.Id, nFacInd}}) -- imposto uso faccia e lato correzione - if vtN[nOthInd]:getX() > 0 then + if vtN[nOthInd]:getZ() < -0.1 then + EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_TOP) + elseif vtN[nOthInd]:getX() > 0 then EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_LEFT) else EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_RIGHT) @@ -533,26 +548,38 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId) -- limiti di fresatura semplice local MAX_MILL_XZ = 80 local MAX_MILL_VOL = ( 80 * 240 * 20) / 2 + -- recupero l'ingombro del grezzo di appartenenza + local b3Raw = EgtGetRawPartBBox( nRawId) -- una faccia if Proc.Fct == 1 then - -- se piccola, con fresa - if ( Proc.Box:getDimX() < MAX_MILL_XZ and Proc.Box:getDimZ() < MAX_MILL_XZ) or Proc.Box:getDimX() * Proc.Box:getDimY() * Proc.Box:getDimZ() < MAX_MILL_VOL then - return MakeOneFaceByMill( Proc, nPhase, nRawId, nPartId) - -- altrimenti, con lama + -- se lunghezza richiede spezzatura + if Proc.Box:getDimX() > min( BD.LONGCUT_MAXLEN, 0.5 * b3Raw:getDimX()) then + return LongCut.Make( Proc, nPhase, nRawId, nPartId) else - return Cut.Make( Proc, nPhase, nRawId, nPartId, 0) + -- se piccola, con fresa + if ( Proc.Box:getDimX() < MAX_MILL_XZ and Proc.Box:getDimZ() < MAX_MILL_XZ) or Proc.Box:getDimX() * Proc.Box:getDimY() * Proc.Box:getDimZ() < MAX_MILL_VOL then + return MakeOneFaceByMill( Proc, nPhase, nRawId, nPartId) + -- altrimenti, con lama + else + return Cut.Make( Proc, nPhase, nRawId, nPartId, 0) + end end -- due facce elseif Proc.Fct == 2 then - -- determino l'angolo tra le facce - local _, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT) - -- se ortogonali e piccole, con fresa - if abs( dAng + 90) < 1 and - (( Proc.Box:getDimX() < MAX_MILL_XZ and Proc.Box:getDimZ() < MAX_MILL_XZ) or Proc.Box:getDimX() * Proc.Box:getDimY() * Proc.Box:getDimZ() < MAX_MILL_VOL) then - return MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId) - -- altrimenti, con lama + -- se lunghezza richiede spezzatura + if Proc.Box:getDimX() > min( BD.LONGCUT_MAXLEN, 0.5 * b3Raw:getDimX()) then + return Long2Cut.Make( Proc, nPhase, nRawId, nPartId) else - return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, 'HeadSide') + -- determino l'angolo tra le facce + local _, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT) + -- se ortogonali e piccole, con fresa + if abs( dAng + 90) < 1 and + (( Proc.Box:getDimX() < MAX_MILL_XZ and Proc.Box:getDimZ() < MAX_MILL_XZ) or Proc.Box:getDimX() * Proc.Box:getDimY() * Proc.Box:getDimZ() < MAX_MILL_VOL) then + return MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId) + -- altrimenti, con lama + else + return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, 'HeadSide') + end end -- tre o più facce else diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index 4cc612d..d126ee3 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -1,4 +1,4 @@ --- ProcessLongDoubleCut.lua by Egaltech s.r.l. 2019/05/25 +-- ProcessLongDoubleCut.lua by Egaltech s.r.l. 2019/07/08 -- Gestione calcolo doppio taglio longitudinale per Travi -- Tabella per definizione modulo @@ -51,9 +51,9 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId) --end -- verifico posizione (+1=sopra, -1=sotto, 0=sui lati) local nSide = 0 - if vtN[1]:getZ() > 0 and vtN[2]:getZ() > 0 then + if vtN[1]:getZ() > -GEO.EPS_SMALL and vtN[2]:getZ() > -GEO.EPS_SMALL then nSide = 1 - elseif vtN[1]:getZ() < 0 and vtN[2]:getZ() < 0 then + elseif vtN[1]:getZ() < GEO.EPS_SMALL and vtN[2]:getZ() < GEO.EPS_SMALL then nSide = -1 end -- angolo diedro per stabilire se taglio convesso @@ -67,28 +67,29 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId) ptM = ( ptC[1] + ptC[2]) / 2 bConvex = true end + local bOrtho = ( abs( dAng + 90) < 1) -- analisi del taglio local vOrd = {} local vFaceUse = {} if nSide == 1 then vOrd = EgtIf( ptC[1]:getY() < ptM:getY(), { 1, 2}, { 2, 1}) - vFaceUse = {[vOrd[1]] = MCH_MILL_FU.ORTHO_BACK, [vOrd[2]] = MCH_MILL_FU.ORTHO_FRONT} + vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)} elseif nSide == -1 then vOrd = EgtIf( ptC[1]:getY() < ptM:getY(), { 1, 2}, { 2, 1}) - vFaceUse = {[vOrd[1]] = MCH_MILL_FU.PARAL_BACK, [vOrd[2]] = MCH_MILL_FU.PARAL_FRONT} + vFaceUse = { BL.GetNearestParalOpposite( ptC[1] - ptM), BL.GetNearestParalOpposite( ptC[2] - ptM)} else local bFront = ( vtN[1]:getY() < 0) if bFront then vOrd = EgtIf( ptC[1]:getZ() < ptM:getZ(), { 1, 2}, { 2, 1}) - vFaceUse = {[vOrd[1]] = MCH_MILL_FU.ORTHO_TOP, [vOrd[2]] = MCH_MILL_FU.ORTHO_DOWN} + vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)} else vOrd = EgtIf( ptC[1]:getZ() < ptM:getZ(), { 2, 1}, { 1, 2}) - vFaceUse = {[vOrd[1]] = MCH_MILL_FU.ORTHO_DOWN, [vOrd[2]] = MCH_MILL_FU.ORTHO_TOP} + vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)} end end local vWidth = {} - _, _, vWidth[vOrd[1]] = BL.GetFaceHvRefDim( Proc.Id, vOrd[1] - 1) - _, _, vWidth[vOrd[2]] = BL.GetFaceHvRefDim( Proc.Id, vOrd[2] - 1) + _, _, vWidth[1] = BL.GetFaceHvRefDim( Proc.Id, 1 - 1) + _, _, vWidth[2] = BL.GetFaceHvRefDim( Proc.Id, 2 - 1) -- Se non è sotto : lavorazione Long2Cut if nSide ~= - 1 then @@ -121,8 +122,17 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId) -- ciclo sulle parti local nM = 0 for j = 1, nC do + -- se facce ortogonali (concave), lavoro solo quella con versore maggiomente verso l'alto + local nIni, nFin = 1, 2 + if bOrtho then + if vtN[vOrd[1]]:getZ() >= vtN[vOrd[2]]:getZ() then + nFin = 1 + else + nIni = 2 + end + end -- su entrambe le facce - for i = 1, 2 do + for i = nIni, nFin do -- Limitazioni della lavorazione local nPos = EgtIf( i == 1, j, nC - j + 1) local dSal = EgtIf( nPos == 1, 0, - dEndLen - ( nPos - 2) * dC) diff --git a/LuaLibs/ProcessMortise.lua b/LuaLibs/ProcessMortise.lua index d45a527..6b82eec 100644 --- a/LuaLibs/ProcessMortise.lua +++ b/LuaLibs/ProcessMortise.lua @@ -1,4 +1,4 @@ --- ProcessMortise.lua by Egaltech s.r.l. 2018/04/24 +-- ProcessMortise.lua by Egaltech s.r.l. 2019/07/08 -- Gestione calcolo mortase per Travi -- Tabella per definizione modulo @@ -109,11 +109,12 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId) EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) end -- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente + local sWarn if dMorH > dMaxDepth + 10 * GEO.EPS_SMALL then + sWarn = 'Warning in mortise : elevation (' .. EgtNumToString( dMorH,1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth,1) .. ')' EgtSetMachiningParam( MCH_MP.DEPTH, dMaxDepth - dMorH) dMorH = dMaxDepth - local sWarn = 'Warning in process ' .. tostring( Proc.Id) .. ' : elevation bigger than max tool depth' - EgtOutLog( sWarn) + EgtOutLog( sWarn .. ' (process ' .. tostring( Proc.Id) .. ')') end -- imposto elevazione EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMorH, 1) .. ';') @@ -123,8 +124,8 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId) EgtSetOperationMode( nMchFId, false) return false, sErr end - return true -end + return true, sWarn +end --------------------------------------------------------------------- return ProcessMortise diff --git a/LuaLibs/ProcessTenon.lua b/LuaLibs/ProcessTenon.lua index 91b89f8..4002cd5 100644 --- a/LuaLibs/ProcessTenon.lua +++ b/LuaLibs/ProcessTenon.lua @@ -1,4 +1,4 @@ --- ProcessTenon.lua by Egaltech s.r.l. 2019/07/01 +-- ProcessTenon.lua by Egaltech s.r.l. 2019/07/08 -- Gestione calcolo tenone per Travi -- Tabella per definizione modulo @@ -114,12 +114,23 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) end -- recupero i dati dell'utensile local dMillDiam = 20 + local dMaxDepth = 0 if EgtMdbSetCurrMachining( sMilling) then local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam + dMaxDepth = ( EgtTdbGetCurrToolMaxDepth() or dMaxDepth) - BD.COLL_SIC end end + -- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente + local sWarn + local dDepth = 0 + if dTenH > dMaxDepth + 10 * GEO.EPS_SMALL then + sWarn = 'Warning in tenon : elevation (' .. EgtNumToString( dTenH, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')' + dDepth = dMaxDepth - dTenH + dTenH = dMaxDepth + EgtOutLog( sWarn .. ' (process ' .. tostring( Proc.Id) .. ')') + end -- determino il numero di passate concentriche (max 4) local MAX_PASS = 4 local nPass = min( ceil( dPockL / ( 0.7 * dMillDiam)), MAX_PASS) @@ -137,6 +148,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) EgtSetMachiningGeometry( {{ AuxId, -1}}) -- sistemo i parametri EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dTenH, 1) .. ';') + EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) local dOffset = ( i - 1) * dStep EgtSetMachiningParam( MCH_MP.OFFSR, dOffset) -- se contorno aperto, cambio parametri di attacco/uscita @@ -169,7 +181,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) BL.UpdateTCING( nRawId, dOffs) end end - return true + return true, sWarn end ---------------------------------------------------------------------