diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index f1db4f1..1229107 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -47,14 +47,15 @@ -- 2023/03/31 Corretto ordinamento per fori di coda da lasciare in coda. -- 2023/07/31 Corretto errore nelle mortase in doppio. -- 2023/09/13 Aggiunta ClassifyTopology per la classificazione topologica delle feature. In CollectFeatures aggiunta la raccolta preliminare di alcune informazioni. --- 2022/09/26 Funzione IsFeatureCuttingEntireSection spostata in BeamLib --- 2022/09/26 In ClassifyTopology aggiunto passaggio del parametro nRawId +-- 2023/09/26 Funzione IsFeatureCuttingEntireSection spostata in BeamLib +-- 2023/09/26 In ClassifyTopology aggiunto passaggio del parametro nRawId -- 2023/10/24 Aggiunta scrittura parametro BARLEN nelle info del mach group -- 2023/11/08 Aggiunta gestione processi Variant. -- 2023/11/30 Migliorato il calcolo elevazione con l'utilizzo della nuova funzione EgtSurfTmFacetElevationInBBox. -- 2023/12/26 Modifiche per centrare i pezzi in Y sulla tavola. -- 2024/02/26 Migliorata 'CompareFeatures' per ordine lavorazioni -- Migliorata 'CompareFeatures' per ordine forature +-- 2024/02/19 In Collect aggiunta la scrittura nella Proc di Width e Height delle facce. -- Tabella per definizione modulo local BeamExec = {} @@ -344,7 +345,8 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT) if not Proc.Face then Proc.Face = {} for i = 1, Proc.Fct do - Proc.Face[i] = { Id = i - 1, VtN = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT )} + local _, dFaceWidth, dFaceHeight = BL.GetFaceHvRefDim( Proc.Id, i - 1, b3Raw) + Proc.Face[i] = { Id = i - 1, VtN = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT ), Width = dFaceWidth, Height = dFaceHeight} if Proc.Fct < 10 then Proc.Face[i].Elevation = EgtSurfTmFacetElevationInBBox( Proc.Id, i - 1, b3Solid, true, GDB_ID.ROOT) end diff --git a/LuaLibs/FacesBySaw.lua b/LuaLibs/FacesBySaw.lua index 3dc1a00..06caeee 100644 --- a/LuaLibs/FacesBySaw.lua +++ b/LuaLibs/FacesBySaw.lua @@ -529,7 +529,7 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType, local bFaceOk = {} bFaceOk[1] = ( vtN[1]:getZ() >= BD.NZ_MINB or abs( vtN[1]:getY()) < 0.174) bFaceOk[2] = ( vtN[2]:getZ() >= BD.NZ_MINB or abs( vtN[2]:getY()) < 0.174) - if not bDownHead and not bFaceOk[1] and not bFaceOk[2] then + if not bDownHead and ( not bFaceOk[1] or not bFaceOk[2]) then local sErr = 'Error : TwoFacesBySaw from bottom impossible' EgtOutLog( sErr) return false, sErr diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 20790c7..274f21a 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -96,6 +96,7 @@ -- 2024/02/22 Migliorato calcolo area non pinzabile in testa HCING e coda TCING -- Rimosso un caso di controllo per HCING/TCING -- 2024/02/29 In MakeMoreFaces passato b3Solid alla funzione ManageAntiSplintByMill +-- 2024/02/29 In lapjoint 2 facce (TestTwoFacesDownHead) migliorata la scelta della lama da sotto. -- Tabella per definizione modulo local ProcessLapJoint = {} @@ -5792,19 +5793,49 @@ end --------------------------------------------------------------------- local function TestTwoFacesDownHead( Proc) - -- verifico ci siano due facce + -- test valido solo per due facce if Proc.Fct ~= 2 then return false end + local bDownHeadBlade = false + local bDownHeadMill = false -- verifico se da lavorare con testa da sotto - local bDownHead = false if BD.DOWN_HEAD then - local ptC = {} - local vtN = {} - ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) - ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT) - local vtNm = ( vtN[1] + vtN[2]) ; vtNm:normalize() - bDownHead = ( vtNm:getZ() < -0.5) + local vtNm = ( Proc.Face[1].VtN + Proc.Face[2].VtN) + vtNm:normalize() + bDownHeadMill = ( vtNm:getZ() < -0.5) + -- recupero il massimo materiale della lama sopra + local sCutting = ML.FindCutting( 'HeadSide', true, false) + if not sCutting then + local sErr = 'Error : cutting not found in library' + EgtOutLog( sErr) + return false, sErr + end + local dTopBladeMaxDepth = 0 + if EgtMdbSetCurrMachining( sCutting) then + local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then + dTopBladeMaxDepth = EgtTdbGetCurrToolMaxDepth() or dTopBladeMaxDepth + end + end + -- recupero le caratteristiche della feature e delle facce + local vtRes = Proc.Face[1].VtN ^ Proc.Face[2].VtN + Proc.IsTopDownRabbet = abs( vtRes:getZ()) > 10 * GEO.EPS_SMALL + for i = 1, Proc.Fct do + Proc.Face[i].IsTooDownwardForTopBlade = Proc.Face[i].VtN:getZ() < ( BD.CUT_VZ_MIN or -0.484) - 10 * GEO.EPS_SMALL + Proc.Face[i].IsTooWideForTopBlade = Proc.Face[i].Width > dTopBladeMaxDepth + end + -- serve la lama sotto se c'è almeno una faccia troppo inclinata verso il basso e non è un rabbet stretto lavorabile dal lato + if not ( Proc.Face[1].IsTooDownwardForTopBlade or Proc.Face[2].IsTooDownwardForTopBlade) then + bDownHeadBlade = false + else + for i = 1, Proc.Fct do + if Proc.Face[i].IsTooDownwardForTopBlade and ( not Proc.IsTopDownRabbet or Proc.Face[i].IsTooWideForTopBlade) then + bDownHeadBlade = true + break + end + end + end end - return bDownHead + return bDownHeadBlade, bDownHeadMill end --------------------------------------------------------------------- @@ -6068,7 +6099,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- due facce elseif Proc.Fct == 2 then -- verifico se da lavorare con testa da sotto - local bDownHead = TestTwoFacesDownHead( Proc) + local bDownHeadBlade = TestTwoFacesDownHead( Proc) -- dati delle facce local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, 0, GDB_BB.STANDARD) local b3Fac2 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, 1, GDB_BB.STANDARD) @@ -6096,7 +6127,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) if nForceUseBladeOnNotContinueFace and nForceUseBladeOnNotContinueFace > 0 then return LongCut.Make( Proc, nPhase, nRawId, nPartId, bUseBlade, nForceUseBladeOnNotContinueFace) else - return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHead, '_H2', ''), true, bDownHead) + return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHeadBlade, '_H2', ''), true, bDownHeadBlade) end else return LongCut.Make( Proc, nPhase, nRawId, nPartId) @@ -6107,7 +6138,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) if nForceUseBladeOnNotContinueFace and nForceUseBladeOnNotContinueFace > 0 then return LongCut.Make( Proc, nPhase, nRawId, nPartId, bUseBlade, nForceUseBladeOnNotContinueFace) else - return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHead, '_H2', ''), true, bDownHead) + return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHeadBlade, '_H2', ''), true, bDownHeadBlade) end else return LongCut.Make( Proc, nPhase, nRawId, nPartId) @@ -6115,7 +6146,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- altrimenti else if bUseBlade and ( abs( vtN1:getX()) > 0.5 or abs( vtN2:getX()) > 0.5) then - return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHead, '_H2', ''), true, bDownHead) + return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHeadBlade, '_H2', ''), true, bDownHeadBlade) else return MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead) end @@ -6186,7 +6217,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- altrimenti else -- verifico se da lavorare con testa da sotto - local bDownHead = TestTwoFacesDownHead( Proc) + local bDownHeadblade, bDownHeadMill = TestTwoFacesDownHead( Proc) -- determino l'angolo tra le facce local bAdj, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT) -- se con BH @@ -6196,7 +6227,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) elseif not bUseBlade then -- se piccole if Proc.Box:getDimX() < MAX_MILL_LIN and ( Proc.Box:getDimZ() < MAX_MILL_LIN or Proc.Box:getDimY() < MAX_MILL_LIN) and bAdj and abs( dAng + 90) < 1 then - return MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId, bDownHead) + return MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId, bDownHeadMill) else return MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, true) end @@ -6220,7 +6251,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) end -- se smusso non esclusivo if nChamfer < 2 then - return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHead, '_H2', ''), true, bDownHead or BD.TURN) + return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHeadblade, '_H2', ''), true, bDownHeadblade or BD.TURN) end return true end