diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index bb06fba..da1e6f6 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -1267,5 +1267,32 @@ function BeamLib.GetMachiningSteps( dMachiningDepth, dStep) return MachiningSteps end +------------------------------------------------------------------------------------------------------------- +function BeamLib.IsCutNeeded( Proc, b3Raw, dOvmHead, dOvmTail) + if not dOvmTail then + dOvmTail = BD.OVM_MID + end + local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) + + if Proc.Head then + -- se coincide con il taglio di separazione precedente, non va fatto + if AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Raw:getMax():getX() + dOvmHead) < 10 * GEO.EPS_SMALL then + return false + end + -- altrimenti taglio di coda + else + -- se coincide con taglio di separazione, non va fatto + if AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then + return false + end + end + -- se coincide con un taglio frontale non va fatto + if Proc.CutFront then + return false + end + + return true +end + ------------------------------------------------------------------------------------------------------------- return BeamLib \ No newline at end of file diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index d74d6b7..df70d66 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -821,20 +821,7 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) -- se taglio di testa if not bForced then - if Proc.Head then - -- se coincide con il taglio di separazione precedente, non va fatto - if AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Raw:getMax():getX() + dOvmHead) < 10 * GEO.EPS_SMALL then - return true - end - -- altrimenti taglio di coda - else - -- se coincide con taglio di separazione, non va fatto - if AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then - return true - end - end - -- se coincide con un taglio frontale non va fatto - if Proc.CutFront then + if not BL.IsCutNeeded( Proc, b3Raw, dOvmHead, dOvmTail) then return true end end diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index fc0851d..0d846a6 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -203,6 +203,8 @@ local function AssignQIdent( Proc) Q_BLADE_ON_ALONG_FACE = 'Q04' -- i Q_ANTISPLINT_TYPE = 'Q06' -- i Q_DEPTH_CHAMFER = 'Q07' -- d + elseif ( Proc.Grp == 1 or Proc.Grp == 2) and Proc.Prc == 30 then + Q_BLADE_ON_ALONG_FACE = 'Q04' -- i elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 32 then Q_SIDE_ROUGH_TOOL = 'Q01' -- i Q_CONTOUR_SMALL_TOOL = 'Q02' -- i @@ -3339,7 +3341,11 @@ local function MakePocket( Proc, nPartId, b3Solid, ptPs, tvtN, nFaceRef, sMchFin EgtOutLog( sWarn) end -- imposto elevazione e dichiaro non si generano sfridi per VMill - local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';' + -- eventuale massima elevazione imposta dall'utente + local dMaxElev = EgtGetInfo( Proc.Id, Q_MAX_ELEVATION, 'd') + if dMaxElev and dMaxElev < 1 then dMaxElev = nil end + dMaxElev = dMaxElev or dElev + local sNotes = 'MaxElev=' .. EgtNumToString( dMaxElev, 1) .. ';' sNotes = sNotes .. 'VMRS=0;' if bOpenOutRaw then sNotes = sNotes .. 'OpenOutRaw=1;' @@ -6921,6 +6927,7 @@ local function MakeStaircaseStep( Proc, nRawId, b3Raw, nPartId) local nFacetRiser, nFacetTread = 0, 1 if abs( vtNRiser:getZ()) > abs( vtNTread:getZ()) then EgtSurfTmSwapFacets( Proc.Id, 0, 1) + Proc.Face = BL.GetFacetsInfo( Proc, b3Raw) vtNRiser, vtNTread = vtNTread, vtNRiser end -- riferimenti e dimensioni delle facce @@ -7146,7 +7153,8 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) end -- se lunghezza richiede spezzatura if ( Proc.Box:getDimX() > BD.LONGCUT_MAXLEN) or - ( Proc.Box:getDimX() > 0.7 * b3Solid:getDimX() and Proc.Box:getDimX() > BD.LONGCUT_ENDLEN) then + ( Proc.Box:getDimX() > 0.7 * b3Solid:getDimX() and Proc.Box:getDimX() > BD.LONGCUT_ENDLEN) or + ( nForceUseBladeOnNotContinueFace > 0 and ( Proc.Box:getDimX() > BD.LEN_SHORT_PART or 1000)) then -- una faccia if Proc.Fct == 1 then if bUseBlade then @@ -7185,6 +7193,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) elseif b3Fac1:getDimX() < 1 and abs( vtN2:getX()) < GEO.EPS_SMALL then -- la faccia 0 deve essere quella lunga EgtSurfTmSwapFacets( Proc.Id, 0, 1) + Proc.Face = BL.GetFacetsInfo( Proc, b3Raw) if bUseBlade then if nForceUseBladeOnNotContinueFace and nForceUseBladeOnNotContinueFace > 0 then return LongCut.Make( Proc, nPhase, nRawId, nPartId, bUseBlade, nForceUseBladeOnNotContinueFace) @@ -7224,10 +7233,12 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) if b3Fac1:getDimX() < 1 and b3Fac3:getDimX() < 1 then -- la faccia 0 deve essere quella lunga EgtSurfTmSwapFacets( Proc.Id, 0, 1) + Proc.Face = BL.GetFacetsInfo( Proc, b3Raw) bApplyBladeOnLongNotContinueFace = true elseif b3Fac1:getDimX() < 1 and b3Fac2:getDimX() < 1 then -- la faccia 0 deve essere quella lunga EgtSurfTmSwapFacets( Proc.Id, 0, 2) + Proc.Face = BL.GetFacetsInfo( Proc, b3Raw) bApplyBladeOnLongNotContinueFace = true elseif b3Fac2:getDimX() < 1 and b3Fac3:getDimX() < 1 then bApplyBladeOnLongNotContinueFace = true diff --git a/LuaLibs/ProcessRidgeLap.lua b/LuaLibs/ProcessRidgeLap.lua index cd81679..4d57e48 100644 --- a/LuaLibs/ProcessRidgeLap.lua +++ b/LuaLibs/ProcessRidgeLap.lua @@ -10,6 +10,7 @@ local BL = require( 'BeamLib') local Fbs = require( 'FacesBySaw') local Cut = require( 'ProcessCut') local DC = require( 'DiceCut') +local LapJoint = require( 'ProcessLapJoint') EgtOutLog( ' ProcessRidgeLap started', 1) @@ -48,6 +49,7 @@ end --------------------------------------------------------------------- -- Applicazione della lavorazione function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) + local nForceUseBladeOnNotContinueFace = EgtGetInfo( Proc.Id, 'Q04', 'i') or 0 -- recupero l'ingombro del grezzo di appartenenza local b3Raw = EgtGetRawPartBBox( nRawId) -- ingombro del pezzo @@ -133,8 +135,15 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) local b3Cut = EgtGetBBoxGlob( AddId or GDB_ID.NULL, GDB_BB.STANDARD) local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Cut, Fct = 1, Flg = Proc.Flg, Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId} - local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, false) - if not bOk then return bOk, sErr end + if BL.IsCutNeeded( CutProc, b3Raw, dOvmHead) then + local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, false) + if not bOk then return bOk, sErr end + elseif nForceUseBladeOnNotContinueFace > 0 then + EgtSurfTmRemoveFacet( Proc.Id, vFaceOrd[1] - 1) + Proc.Fct = Proc.Fct - 1 + Proc.Face = BL.GetFacetsInfo( Proc, b3Raw) + return LapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) + end end end -- recupero gruppo per geometria addizionale diff --git a/LuaLibs/ProcessStepJoint.lua b/LuaLibs/ProcessStepJoint.lua index 4d16d32..fd267f9 100644 --- a/LuaLibs/ProcessStepJoint.lua +++ b/LuaLibs/ProcessStepJoint.lua @@ -320,10 +320,12 @@ local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead) if bAdj12 then if dAng12 < 0 then EgtSurfTmSwapFacets( Proc.Id, 0, 2) + Proc.Face = BL.GetFacetsInfo( Proc, b3Raw) end elseif bAdj20 then if dAng20 < 0 then EgtSurfTmSwapFacets( Proc.Id, 1, 2) + Proc.Face = BL.GetFacetsInfo( Proc, b3Raw) end end -- dati delle facce diff --git a/LuaLibs/ProcessStepJointNotch.lua b/LuaLibs/ProcessStepJointNotch.lua index 8960b37..6cc0035 100644 --- a/LuaLibs/ProcessStepJointNotch.lua +++ b/LuaLibs/ProcessStepJointNotch.lua @@ -11,6 +11,7 @@ local BL = require( 'BeamLib') local Fbs = require( 'FacesBySaw') local DC = require( 'DiceCut') local Cut = require( 'ProcessCut') +local Topology = require( 'FeatureTopology') EgtOutLog( ' ProcessStepJointNotch started', 1) @@ -384,6 +385,8 @@ local function MakeFourFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, nDiffWidt EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) -- applico lavorazione local NewProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg} + local b3Raw = EgtGetRawPartBBox( nRawId) + Topology.Classify( NewProc, b3Raw) local bOk, sErr = MakeTwoFaces( NewProc, nPhase, nRawId, nPartId, dOvmHead, nDiffWidth) if not bOk then return bOk, sErr end end