diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 3377084..127d2d5 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -73,8 +73,8 @@ 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 + -- la sua lunghezza non deve superare 1/4 della lunghezza della trave + if Proc.Box:getDimX() > 0.25 * b3Raw:getDimX() then return false end -- se una o due facce ora è sicuramente di coda @@ -660,24 +660,17 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- due facce elseif Proc.Fct == 2 then -- determino se due facce lunghe oppure una lunga e l'altra terminale - local CopyId = EgtCopyGlob( Proc.Id, Proc.Id, GDB_IN.AFTER) - local NewId, nCount = EgtExplodeSurf( CopyId) - local b3Fac1 = EgtGetBBoxGlob( NewId, GDB_BB.STANDARD) - local b3Fac2 = EgtGetBBoxGlob( NewId + 1, GDB_BB.STANDARD) - if abs( b3Fac1:getDimX() - b3Fac2:getDimX()) < 10 then + local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, 0, GDB_BB.STANDARD) + local b3Fac2 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, 1, GDB_BB.STANDARD) + if abs( b3Fac1:getDimX() - b3Fac2:getDimX()) < 50 then return Long2Cut.Make( Proc, nPhase, nRawId, nPartId) elseif b3Fac1:getDimX() < 1 then -- la faccia 0 deve essere quella lunga - local nNew2Id = EgtSurfTmBySewing( EgtGetParent( Proc.Id), { NewId+1, NewId}) - EgtCopyAttributes( Proc.Id, nNew2Id) - EgtErase( Proc.Id) - EgtChangeId( nNew2Id, Proc.Id) + EgtSurfTmSwapFacets( Proc.Id, 0, 1) return LongCut.Make( Proc, nPhase, nRawId, nPartId) elseif b3Fac2:getDimX() < 1 then - EgtErase( {NewId, NewId+1}) return LongCut.Make( Proc, nPhase, nRawId, nPartId) else - EgtErase( {NewId, NewId+1}) return MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId) end -- tre o più facce diff --git a/LuaLibs/ProcessLongCut.lua b/LuaLibs/ProcessLongCut.lua index 63fddff..df7c732 100644 --- a/LuaLibs/ProcessLongCut.lua +++ b/LuaLibs/ProcessLongCut.lua @@ -1,4 +1,4 @@ --- ProcessLongCut.lua by Egaltech s.r.l. 2019/09/25 +-- ProcessLongCut.lua by Egaltech s.r.l. 2019/09/30 -- Gestione calcolo taglio longitudinale per Travi -- Tabella per definizione modulo @@ -56,9 +56,15 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId) bLimXmax = true end end - -- Verifico se lavorazione da sotto + -- Verifico lato di lavorazione local nSide = 1 - if vtN:getZ() < - 0.5 then nSide = -1 end + if vtN:getZ() < - 0.5 then + nSide = -1 + elseif vtN:getY() < -0.7071 then + nSide = -2 + elseif vtN:getY() > 0.7071 then + nSide = 2 + end -- Se non è sotto : lavorazione Long2Cut if nSide ~= - 1 then @@ -78,22 +84,57 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId) end end local dStartDist = 0 + local dStartAccDist = BD.LONGCUT_ENDLEN + local bStartFixed = true if ( bLimXmin and vtN:getY() < 0) or ( bLimXmax and vtN:getY() > 0) then - dStartDist = dToolDiam / 2 + dStartDist = dToolDiam / 2 + dStartAccDist = BD.LONGCUT_MAXLEN + bStartFixed = false end local dEndDist = 0 + local dEndAccDist = BD.LONGCUT_ENDLEN + local bEndFixed = true if ( bLimXmin and vtN:getY() > 0) or ( bLimXmax and vtN:getY()< 0) then dEndDist = dToolDiam / 2 + dEndAccDist = BD.LONGCUT_MAXLEN + bEndFixed = false end -- determino numero di parti - local nC = ceil( ( dLen - 2 * BD.LONGCUT_ENDLEN) / BD.LONGCUT_MAXLEN) - local dC = ( dLen - 2 * BD.LONGCUT_ENDLEN) / nC - local dAccDist = BD.LONGCUT_ENDLEN + local nC = ceil( ( dLen - dStartAccDist - dEndAccDist) / BD.LONGCUT_MAXLEN) + local dC = 0 if nC > 0 then + if bStartFixed and bEndFixed then + dC = ( dLen - dStartAccDist - dEndAccDist) / nC + elseif bStartFixed then + dC = ( dLen - dStartAccDist) / ( nC + 1) + dEndAccDist = dC + elseif bEndFixed then + dC = ( dLen - dEndAccDist) / ( nC + 1) + dStartAccDist = dC + else + dC = dLen / ( nC + 2) + dStartAccDist = dC + dEndAccDist = dC + end nC = nC + 2 else - nC = EgtIf( dLen > BD.LONGCUT_ENDLEN, 2, 1) - dAccDist = EgtIf( nC == 2, dLen / 2, 0) + if dLen > min( dStartAccDist, dEndAccDist) then + nC = 2 + if bStartFixed and not bEndFixed then + dStartAccDist = min( dStartAccDist, dLen/2) + dEndAccDist = dLen - dStartAccDist + elseif not bStartFixed and bEndFixed then + dEndAccDist = min( dEndAccDist, dLen/2) + dStartAccDist = dLen - dEndAccDist + else + dStartAccDist = dLen/2 + dEndAccDist = dStartAccDist + end + else + nC = 1 + dStartAccDist = 0 + dEndAccDist = 0 + end end -- si percorre il lato basso della faccia local nM = 0 @@ -120,9 +161,9 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId) -- aggiungo geometria EgtSetMachiningGeometry( {{ Proc.Id, 0}}) -- limito opportunamente la lavorazione - local dSal = EgtIf( i == 1, -dStartDist, - dAccDist - ( i - 2) * dC) + local dSal = EgtIf( i == 1, -dStartDist, - dStartAccDist - ( i - 2) * dC) EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal) - local dEal = EgtIf( i == nC, -dEndDist, - dAccDist - ( nC - i - 1) * dC) + local dEal = EgtIf( i == nC, -dEndDist, - dEndAccDist - ( nC - i - 1) * dC) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal) -- imposto offset radiale (nullo se concavo) if k >1 then @@ -154,7 +195,13 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId) EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) -- uso della faccia - EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN) + local nFaceUse = MCH_MILL_FU.PARAL_DOWN + if nSide == -2 then + nFaceUse = MCH_MILL_FU.PARAL_BACK + elseif nSide == 2 then + nFaceUse = MCH_MILL_FU.PARAL_FRONT + end + EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) -- attacco e uscita EgtSetMachiningParam( MCH_MP.LIPERP, 0) EgtSetMachiningParam( MCH_MP.LITANG, dToolDiam / 2 + 30)