From f54cfa7eb3083e5a6197ce2d3fd361019809cd53 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Tue, 26 Sep 2023 17:39:16 +0200 Subject: [PATCH] - in BeamExec funzione IsFeatureCuttingEntireSection spostata in BeamLib; in ClassifyTopology aggiunto passaggio del parametro nRawId - in BeamLib -> GetFaceWithMostAdj gestito primo parametro anche come Proc; gestito caso strip con facce tutte in sottosquadro; spostata qui funzione IsFeatureCuttingEntireSection da BeamExec - In FeatureTopology aggiunte topologie Strip e Cut - In ProcessDoveTail, ProcessLapJoint, ProcessLongCut, ProcessTyroleanDovetail modificata chiamata a GetFaceWithMostAdj --- LuaLibs/BeamExec.lua | 23 +++++------ LuaLibs/BeamLib.lua | 55 +++++++++++---------------- LuaLibs/FeatureTopology.lua | 14 ++++++- LuaLibs/ProcessDovetail.lua | 9 +++-- LuaLibs/ProcessLapJoint.lua | 59 ++++++++++++++++++----------- LuaLibs/ProcessLongCut.lua | 3 +- LuaLibs/ProcessTyroleanDovetail.lua | 5 ++- 7 files changed, 92 insertions(+), 76 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 8916d6f..efcf30e 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -47,6 +47,8 @@ -- 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 -- Tabella per definizione modulo local BeamExec = {} @@ -249,12 +251,6 @@ local function IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT) return false end -------------------------------------------------------------------------------------------------------------- --- restituisce vero se la feature con box b3Proc taglia l'intera sezione della barra, rappresentata dalle sue dimensioni W e H -local function IsFeatureCuttingEntireSection( b3Proc, dRawW, dRawH) - return ((abs(b3Proc:getDimY() - dRawW) < 10 * GEO.EPS_SMALL or b3Proc:getDimY() > dRawW) and (abs(b3Proc:getDimZ() - dRawH) < 10 * GEO.EPS_SMALL or b3Proc:getDimZ() > dRawH)) -end - ------------------------------------------------------------------------------------------------------------- local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT) local dRawW = b3Raw:getDimY() @@ -312,7 +308,7 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT) if Proc.Box and not Proc.Box:isEmpty() then Proc.Head = IsHeadFeature( Proc, b3Raw, dCurrOvmH) Proc.Tail, Proc.AdvTail = IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT) - if Proc.Fct == 1 and IsFeatureCuttingEntireSection( Proc.Box , dRawW, dRawH) and ( Proc.Head or Proc.Tail) and Proc.Prc ~= 340 and Proc.Prc ~= 350 then + if Proc.Fct == 1 and BL.IsFeatureCuttingEntireSection( Proc.Box, dRawW, dRawH) and ( Proc.Head or Proc.Tail) and Proc.Prc ~= 340 and Proc.Prc ~= 350 then if Proc.Head and Proc.Box:getCenter():getX() < dMachineBeforeIntersectingDrillingsXHead then dMachineBeforeIntersectingDrillingsXHead = Proc.Box:getCenter():getX() nMachineBeforeIntersectingDrillingsIdHead = Proc.Id @@ -356,7 +352,7 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT) end -- se BlockHaus HalfLap elseif Proc.Prc == 37 then - local nFacInd = BL.GetFaceWithMostAdj( Proc.Id, PartId) + local nFacInd = BL.GetFaceWithMostAdj( Proc, PartId) if nFacInd then local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT) if vtN then @@ -400,7 +396,7 @@ local function AnalyzeHeadFeatures( b3Solid, vProc, dRawW, dRawH) end if Proc.Head and Proc.Id ~= nReplacedFeatureId and Proc.Prc ~= 340 then -- controllo se la feature taglia l'intera sezione; in caso positivo la finitura non è necessaria - bHeadFinishingNeeded = not IsFeatureCuttingEntireSection( Proc.Box, dRawW, dRawH) + bHeadFinishingNeeded = not BL.IsFeatureCuttingEntireSection( Proc.Box, dRawW, dRawH) end end return bHeadFinishingNeeded, nReplacedFeatureId @@ -423,7 +419,7 @@ local function AnalyzeTailFeatures( b3Solid, vProc, dRawW, dRawH) end if Proc.Tail and Proc.Id ~= nReplacedFeatureId and Proc.Prc ~= 350 then -- controllo se la feature taglia l'intera sezione; in caso positivo la finitura non è necessaria - bTailFinishingNeeded = not IsFeatureCuttingEntireSection( Proc.Box, dRawW, dRawH) + bTailFinishingNeeded = not BL.IsFeatureCuttingEntireSection( Proc.Box, dRawW, dRawH) end end return bTailFinishingNeeded, nReplacedFeatureId @@ -1151,11 +1147,12 @@ local function ClassifyFeatures( vProc, b3Raw, Stats) end ------------------------------------------------------------------------------------------------------------- -local function ClassifyTopology( vProc) +local function ClassifyTopology( vProc, nRawId) + local b3Raw = EgtGetRawPartBBox( nRawId) local nRecognized = 0 for i = 1, #vProc do local Proc = vProc[i] - if Topology.Classify( Proc) then + if Topology.Classify( Proc, b3Raw) then nRecognized = nRecognized + 1 end end @@ -1843,7 +1840,7 @@ function BeamExec.ProcessFeatures() SetMirroredFeatures( vProc, b3Raw) end -- classifico topologicamente le feature - ClassifyTopology( vProc) + ClassifyTopology( vProc, nRawId) -- le ordino lungo X OrderFeatures( vProc, b3Raw) -- le classifico diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index ce2c6aa..961b95f 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -24,6 +24,8 @@ -- 2023/06/12 In ChangeOrOpenStart corretta ricerca segmento più lungo. -- 2023/09/13 Aggiunte funzioni Is3EdgesApprox e GetProcessAffectedFaces. -- 2023/09/25 In GetFaceWithMostAdj aggiunta verifica sottosquadro anche per facce non adiacenti. +-- 2023/09/26 In GetFaceWithMostAdj gestito primo parametro anche come Proc; gestito caso strip con facce tutte in sottosquadro. +-- 2023/09/26 Spostata qui funzione IsFeatureCuttingEntireSection da BeamExec. -- Tabella per definizione modulo local BeamLib = {} @@ -511,7 +513,8 @@ function BeamLib.GetFaceElevationFromPointDir( nSurfId, nPartId, ptC, vtN, nIdGe end --------------------------------------------------------------------- -function BeamLib.GetFaceWithMostAdj( nSurfId, nPartId, bCompare3Fc, dCosSideAng) +function BeamLib.GetFaceWithMostAdj( Proc, nPartId, bCompare3Fc, dCosSideAng) + local nSurfId = Proc.Id -- verifica che la superficie non sia chiusa e quindi non lavorabile if EgtSurfIsClosed( nSurfId) then return @@ -533,6 +536,7 @@ function BeamLib.GetFaceWithMostAdj( nSurfId, nPartId, bCompare3Fc, dCosSideAng) local vAdj = {} local vUcut = {} local vOrtho = {} + local nFacesWithUnderCut = 0 for i = 1, nFacCnt do -- recupero le adiacenze del loop esterno local vFacAdj = EgtSurfTmFacetAdjacencies( nSurfId, i - 1)[1] @@ -593,44 +597,25 @@ function BeamLib.GetFaceWithMostAdj( nSurfId, nPartId, bCompare3Fc, dCosSideAng) if not bShadowSurfIsExternal then bUcut = true end - EgtErase( nMasterSurfFlatId) + EgtErase( { nMasterSurfFlatId, nShadowSurfFlatId}) end EgtErase( { nMasterContourId, nShadowContourId, nShadowFacetId}) end end + if bUcut then + nFacesWithUnderCut = nFacesWithUnderCut + 1 + end vUcut[i] = bUcut vOrtho[i] = bOrtho end - -- se 4 facce tutte con adiacenza 2, allora è un tunnel - if nFacCnt == 4 then - if vAdj[1] == 2 and vAdj[2] == 2 and vAdj[3] == 2 and vAdj[4] == 2 then - -- se tutte le facce sono ortogonali tra loro esco con un flag che ne indica questa propietà - if vOrtho[1] == true and vOrtho[2] == true and vOrtho[3] == true and vOrtho[4] == true then - return -1, GEO.INFINITO, true - else - return -1, GEO.INFINITO - end - end - end - -- se 3 facce con una che ha 2 adiacenze e le altre hanno 1 adiacenza, allora è una semi-fessura - if bCompare3Fc and nFacCnt == 3 then - local nCount2Adc = 0 - local nCount1Adc = 0 - -- ottengo il numero di facce con due adiacenze e il numero di facce con una adiacenza - for i = 1, #vAdj do - if vAdj[i] == 2 then - nCount2Adc = nCount2Adc + 1 - elseif vAdj[i] == 1 then - nCount1Adc = nCount1Adc + 1 - end - end - -- se il numero di adiacenze corrisponde - if nCount2Adc == 1 and nCount1Adc == 2 then - if vOrtho[1] == true and vOrtho[2] == true and vOrtho[3] == true then - return -1, GEO.INFINITO, true - else - return -1, GEO.INFINITO - end + local bEveryFaceHasUndercut = ( nFacesWithUnderCut == nFacCnt) + -- tunnel o assimilabile + if Proc.Topology == 'Tunnel' or ( bCompare3Fc and Proc.Topology == 'Groove' and Proc.IsThrough) or ( Proc.Topology == 'Strip' and bEveryFaceHasUndercut) then + if Proc.IsParallel or Proc.AllRightAngles then + return -1, GEO.INFINITO, true + else + -- non gestito nella LapJoint + return -1, GEO.INFINITO end end -- recupero le facce non in sottosquadra e con il maggior numero di adiacenze @@ -1155,5 +1140,11 @@ function BeamLib.GetProcessAffectedFaces( Proc) return vtFacesAffected end +------------------------------------------------------------------------------------------------------------- +-- restituisce vero se la feature con box b3Proc taglia l'intera sezione della barra, rappresentata dalle sue dimensioni W e H +function BeamLib.IsFeatureCuttingEntireSection( b3Proc, dRawW, dRawH) + return ((abs(b3Proc:getDimY() - dRawW) < 10 * GEO.EPS_SMALL or b3Proc:getDimY() > dRawW) and (abs(b3Proc:getDimZ() - dRawH) < 10 * GEO.EPS_SMALL or b3Proc:getDimZ() > dRawH)) +end + ------------------------------------------------------------------------------------------------------------- return BeamLib diff --git a/LuaLibs/FeatureTopology.lua b/LuaLibs/FeatureTopology.lua index b057026..0adf516 100644 --- a/LuaLibs/FeatureTopology.lua +++ b/LuaLibs/FeatureTopology.lua @@ -1,5 +1,6 @@ -- FeatureTopology.lua by Egaltech s.r.l. 2023/09/12 -- Libreria per classificazione topologica feature travi +-- 2023/09/26 Aggiunte topologie Strip e Cut. -- Tabella per definizione modulo local FeatureTopology = {} @@ -108,7 +109,7 @@ local function GetFacesParallelToPart( Proc, sFamily) local vFacesParallelToPart = {} for i = 0, Proc.Fct - 1 do local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i, GDB_ID.ROOT) - if sFamily == 'Bevel' or sFamily == 'DoubleBevel' then + if sFamily == 'Bevel' or sFamily == 'DoubleBevel' or sFamily == 'Strip' or sFamily == 'Tunnel' or ( sFamily == 'Groove' and Proc.IsThrough == true) then local vTriangularFaces = GetTriangularFaces( Proc) local bIsTriangularFace = false -- verifico se la faccia è triangolare @@ -158,7 +159,7 @@ end --------------------------------------------------------------------- -- riconosce se Proc è una delle topologie standard e, in caso positivo, ne scrive le caratteristiche in campi specifici della Proc stessa restituendo true -function FeatureTopology.Classify( Proc) +function FeatureTopology.Classify( Proc, b3Raw) local bRecognized = false local sFamily local bIsThrough @@ -172,14 +173,20 @@ function FeatureTopology.Classify( Proc) bAllAnglesConcave, bAllRightAngles = AreAllAnglesConcaveOrRight( Proc) local vTriangularFaces = GetTriangularFaces( Proc) local bIsAnyDimensionLongAsPart = IsAnyDimensionLongAsPart( Proc) + local vFacesWithOneAdj = FeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, 1) local vFacesWithTwoAdj = FeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, 2) local vFacesWithThreeAdj = FeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, 3) local vFacesWithFourAdj = FeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, 4) + local dRawW, dRawH = b3Raw:getDimY(), b3Raw:getDimZ() + local bIsFeatureCuttingEntireSection = BL.IsFeatureCuttingEntireSection( Proc.Box, dRawW, dRawH) if Proc.IsOutline then sFamily = 'OUTLINE' elseif Proc.Prc == 40 then sFamily = 'DRILLING' + bIsThrough = true + elseif Proc.Fct == 1 and bIsAnyDimensionLongAsPart and bIsFeatureCuttingEntireSection then + sFamily = 'Cut' elseif Proc.Fct == 1 and bIsAnyDimensionLongAsPart then sFamily = 'Bevel' bIsThrough = true @@ -207,6 +214,9 @@ function FeatureTopology.Classify( Proc) elseif Proc.Fct == 4 and bAllAnglesConcave and #vFacesWithTwoAdj == 4 and bIsAnyDimensionLongAsPart then sFamily = 'Tunnel' bIsThrough = true + elseif Proc.Fct >= 4 and #vFacesWithOneAdj == 2 and bIsAnyDimensionLongAsPart then + sFamily = 'Strip' + bIsThrough = true elseif Proc.Fct == 5 and bAllAnglesConcave and #vFacesWithFourAdj == 1 then sFamily = 'Pocket' bIsThrough = false diff --git a/LuaLibs/ProcessDovetail.lua b/LuaLibs/ProcessDovetail.lua index ce72834..ebfde81 100644 --- a/LuaLibs/ProcessDovetail.lua +++ b/LuaLibs/ProcessDovetail.lua @@ -1,6 +1,7 @@ -- ProcessDovetail.lua by Egaltech s.r.l. 2021/02/04 -- Gestione calcolo giunzione coda di rondine -- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe) +-- 2023/09/26 Modificata chiamata a GetFaceWithMostAdj. -- Tabella per definizione modulo local ProcessDovetail = {} @@ -280,7 +281,7 @@ function ProcessDovetail.IsHeadFeature( Proc, b3Raw, dCurrOvmH) end -- deve avere la normale principale diretta verso la testa local nPartId = EgtGetParent( EgtGetParent( Proc.Id) or GDB_ID.NULL) - local nFacInd, dElev, nFacInd2, dElev2 = BL.GetFaceWithMostAdj( Proc.Id, nPartId) + local nFacInd, dElev, nFacInd2, dElev2 = BL.GetFaceWithMostAdj( Proc, nPartId) local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT) if vtN:getZ() < BD.NZ_MINA and nFacInd2 then ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT) @@ -341,7 +342,7 @@ function ProcessDovetail.IsTailFeature( Proc, b3Raw) end end -- deve avere la normale principale diretta verso la coda - local nFacInd, dElev, nFacInd2, dElev2 = BL.GetFaceWithMostAdj( Proc.Id, nPartId) + local nFacInd, dElev, nFacInd2, dElev2 = BL.GetFaceWithMostAdj( Proc, nPartId) local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT) if vtN:getZ() < BD.NZ_MINA and nFacInd2 then ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT) @@ -933,10 +934,10 @@ local function MachSideFaces( Proc, nPartId, b3Raw, nFacetCnt, bForceUseRough, end else -- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa - nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc.Id, nPartId, false, sin(dSideAngle)) + nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc, nPartId, false, sin(dSideAngle)) if not nFacInd or nFacInd < 0 then -- provo eliminando i sottosquadra - nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc.Id, nPartId, false, -2) + nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc, nPartId, false, -2) if not nFacInd or nFacInd < 0 then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' MachSideFaces could not find reference face' EgtOutLog( sErr) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index a3e5867..2e3d22e 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -74,6 +74,7 @@ -- 2023/08/02 Corretto incremento della profondità pari al raggio utensile per tunnel con sega a catena. -- 2023/08/10 Modificata scelta SCC per tasche in Y+/- in coda o quasi (anche per relativi antischeggia con lama). -- 2023/09/12 In MakeByPockets gestito correttamente il ritorno nil di GetUShapeWidth. +-- 2023/09/26 Modificata chiamata a GetFaceWithMostAdj. -- Tabella per definizione modulo local ProcessLapJoint = {} @@ -634,7 +635,7 @@ function ProcessLapJoint.IsHeadFeature( Proc, b3Raw, dCurrOvmH) end end -- deve avere la normale principale diretta verso la testa - local nFacInd, dElev = BL.GetFaceWithMostAdj( Proc.Id, nPartId) + local nFacInd, dElev = BL.GetFaceWithMostAdj( Proc, nPartId) local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT) if vtN and vtN:getX() < 0.499 then return false @@ -688,7 +689,7 @@ function ProcessLapJoint.IsTailFeature( Proc, b3Raw) end end -- deve avere la normale principale diretta verso la coda (oppure tunnel) - local nFacInd, dElev, nFacInd2, dElev2 = BL.GetFaceWithMostAdj( Proc.Id, nPartId) + local nFacInd, dElev, nFacInd2, dElev2 = BL.GetFaceWithMostAdj( Proc, nPartId) local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT) if vtN and vtN:getZ() < BD.NZ_MINA and nFacInd2 then ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT) @@ -737,7 +738,7 @@ function ProcessLapJoint.Classify( Proc, b3Raw) local nDeletedFace -- recupero la faccia con il maggior numero di adiacenze e minor elevazione local nPartId = EgtGetParent( EgtGetParent( Proc.Id) or GDB_ID.NULL) - local nFacInd, dElev, nFacInd2, dElev2 = BL.GetFaceWithMostAdj( Proc.Id, nPartId) + local nFacInd, dElev, nFacInd2, dElev2 = BL.GetFaceWithMostAdj( Proc, nPartId) if not nFacInd or nFacInd < 0 then if nFacInd == -1 then bClosedOrthoFaces = nFacInd2 @@ -761,25 +762,32 @@ function ProcessLapJoint.Classify( Proc, b3Raw) end -- dalla copia della superfice, ciclo eliminando una faccia per volta per verificare se trova fessura for i = 1, Proc.Fct do - local nNewProc = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL + local nNewProc = {} + nNewProc.Id = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL + nNewProc.Topology = Proc.Topology + nNewProc.TopologyLongName = Proc.TopologyLongName + nNewProc.AllRightAngles = Proc.AllRightAngles + nNewProc.IsThrough = Proc.IsThrough + nNewProc.IsParallel = Proc.IsParallel + nNewProc.Fct = Proc.Fct -- elimino una faccia nDeletedFace = i - 1 - if EgtSurfTmRemoveFacet( nNewProc, nDeletedFace) then + if EgtSurfTmRemoveFacet( nNewProc.Id, nDeletedFace) then -- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa nFacInd, dElev, nFacInd2, dElev2 = BL.GetFaceWithMostAdj( nNewProc, nPartId) if not nFacInd or nFacInd < 0 then if nFacInd == -1 then bClosedOrthoFaces = nFacInd2 - EgtErase( nNewProc) + EgtErase( nNewProc.Id) break else - EgtErase( nNewProc) + EgtErase( nNewProc.Id) return false end end -- altrimenti esco else - EgtErase( nNewProc) + EgtErase( nNewProc.Id) break end end @@ -2681,7 +2689,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, local bIs3Faces = ( Proc.Fct == 3) if bIs3Faces then -- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa - local nFacInd1, dFacElev1, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( Proc.Id, nPartId, bIs3Faces) + local nFacInd1, dFacElev1, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( Proc, nPartId, bIs3Faces) if not nFacInd1 or nFacInd1 < 0 then if nFacInd1 == -1 then bOrthoFaces = nFacInd2 @@ -3480,7 +3488,7 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha end if bIs3Faces then -- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa - local nFacInd, dFacElev, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( Proc.Id, nPartId, bIs3Faces) + local nFacInd, dFacElev, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( Proc, nPartId, bIs3Faces) if not nFacInd or nFacInd < 0 then if nFacInd == -1 then bOrthoFaces = nFacInd2 @@ -3503,7 +3511,7 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha dDimMin = 2 * dDimMin -- se tre facce aumento il diametro di quanto possibile elseif Proc.Fct == 3 then - local nFacInd = BL.GetFaceWithMostAdj( Proc.Id, nPartId, false) + local nFacInd = BL.GetFaceWithMostAdj( Proc, nPartId, false) local dWidth = GetUShapeWidth( Proc, nFacInd or -1) or dDimMin if dWidth > dDimMin then dDimMin = min( 2 * dDimMin, dWidth) @@ -3530,7 +3538,7 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha EgtInvertSurf( nSurfInt) end end - local nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc.Id, nPartId) + local nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc, nPartId) local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT) local bMakeContour = false local sMilling @@ -3877,7 +3885,7 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha -- se non completo e U, cerco di lavorare anche la faccia di fondo (con il massimo affondamento possibile) if not bComplete and bIs3Faces then -- recupero la faccia da lavorare - local nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc.Id, nPartId) + local nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc, nPartId) local vtN local bPock3rd = false if nFacInd then @@ -4502,7 +4510,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa local nBottomFace local sMchFindBackUp -- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa - nFacInd, dFacElev, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( Proc.Id, nPartId) + nFacInd, dFacElev, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( Proc, nPartId) if not nFacInd or nFacInd < 0 then if nFacInd == -1 then bClosedOrthoFaces = nFacInd2 @@ -4516,19 +4524,26 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa if Proc.Prc == 16 and Proc.Fct == 5 and not bClosedOrthoFaces then -- dalla copia della superfice, ciclo eliminando una faccia per volta per verificare se trova fessura for i = 1, Proc.Fct do - local nNewProc = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL + local nNewProc = {} + nNewProc.Id = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL + nNewProc.Topology = Proc.Topology + nNewProc.TopologyLongName = Proc.TopologyLongName + nNewProc.AllRightAngles = Proc.AllRightAngles + nNewProc.IsThrough = Proc.IsThrough + nNewProc.IsParallel = Proc.IsParallel + nNewProc.Fct = Proc.Fct -- elimino una faccia nBottomFace = i - 1 - if EgtSurfTmRemoveFacet( nNewProc, nBottomFace) then + if EgtSurfTmRemoveFacet( nNewProc.Id, nBottomFace) then -- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa nFacInd, dFacElev, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( nNewProc, nPartId) if not nFacInd or nFacInd < 0 then if nFacInd == -1 then bClosedOrthoFaces = nFacInd2 - EgtErase( nNewProc) + EgtErase( nNewProc.Id) break else - EgtErase( nNewProc) + EgtErase( nNewProc.Id) local sErr = 'Error : MakeMoreFaces could not find reference face' EgtOutLog( sErr) return false, sErr @@ -4536,7 +4551,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa end -- altrimenti esco else - EgtErase( nNewProc) + EgtErase( nNewProc.Id) break end end @@ -5161,7 +5176,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa local bMadeASbyBld = false local bPassThrou = ( Proc.Box:getDimY() > b3Raw:getDimY() - 1 or Proc.Box:getDimZ() > b3Raw:getDimZ() - 1) local bPassEdge = ((( bIsU and Proc.Fct == 3) or ( bIsL and Proc.Fct == 2)) and bSinglePart and Proc.Box:getDimX() < 0.9 * b3Raw:getDimX()) - local nFacIndOri = BL.GetFaceWithMostAdj( Proc.Id, nPartId) + local nFacIndOri = BL.GetFaceWithMostAdj( Proc, nPartId) local vtNOri = EgtSurfTmFacetNormVersor( Proc.Id, nFacIndOri, GDB_ID.ROOT) if nChamfer < 2 and nQAntisplintResult == 1 and (( bIsU or bIsL) and ( bPassThrou or bPassEdge)) and ( vtNOri:getZ() > -0.087 or BD.DOWN_HEAD or BD.TURN) then local bOk @@ -5299,7 +5314,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa sWarn = sErr -- se ho antischeggia con fresa le inserisco -- if nChamfer < 2 and nQAntisplintResult == 2 and ( bIsU or bIsL) then - local nFacIndOri, dFacElevOri = BL.GetFaceWithMostAdj( Proc.Id, nPartId) + local nFacIndOri, dFacElevOri = BL.GetFaceWithMostAdj( Proc, nPartId) if nChamfer < 2 and nQAntisplintResult == 2 then local bOk, sWarn2 = ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw, nFacIndOri, nAddGrpId, bMillDown, dDiamTool, nil, @@ -5400,7 +5415,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa local bMadeASbyBld = false local bPassThrou = ( Proc.Box:getDimY() > b3Raw:getDimY() - 1 or Proc.Box:getDimZ() > b3Raw:getDimZ() - 1) local bPassEdge = ((( bIsU and Proc.Fct == 3) or ( bIsL and Proc.Fct == 2)) and bSinglePart and Proc.Box:getDimX() < 0.9 * b3Raw:getDimX()) - local nFacIndOri = BL.GetFaceWithMostAdj( Proc.Id, nPartId) + local nFacIndOri = BL.GetFaceWithMostAdj( Proc, nPartId) local vtNOri = EgtSurfTmFacetNormVersor( Proc.Id, nFacIndOri, GDB_ID.ROOT) if nChamfer < 2 and nQAntisplintResult == 1 and (( bIsU or bIsL) and ( bPassThrou or bPassEdge)) and ( vtNOri:getZ() > -0.087 or BD.DOWN_HEAD or BD.TURN) then local bOk diff --git a/LuaLibs/ProcessLongCut.lua b/LuaLibs/ProcessLongCut.lua index e515674..6f52027 100644 --- a/LuaLibs/ProcessLongCut.lua +++ b/LuaLibs/ProcessLongCut.lua @@ -29,6 +29,7 @@ -- 2023/05/03 Corretto SCC in caso di asse utensile allineato con Z. -- 2023/05/19 Migliorato calcolo e verifica affondamento per lavorazione con lama con codolo in mezzo. -- 2023/08/01 Ammesso uso lama da sotto fino a N +3deg in verticale. +-- 2023/09/26 Modificata chiamata a GetFaceWithMostAdj. -- Tabella per definizione modulo local ProcessLongCut = {} @@ -437,7 +438,7 @@ end -- Applicazione della lavorazione local function MakeByPocketing( Proc, nPhase, nRawId, nPartId) -- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa - local nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc.Id, nPartId) + local nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc, nPartId) -- cerco la svuotatura opportuna local sPocketing = ML.FindPocketing( 'OpenPocket', Proc.Box:getDimX()) if not sPocketing then diff --git a/LuaLibs/ProcessTyroleanDovetail.lua b/LuaLibs/ProcessTyroleanDovetail.lua index ba7b31d..b8d00ce 100644 --- a/LuaLibs/ProcessTyroleanDovetail.lua +++ b/LuaLibs/ProcessTyroleanDovetail.lua @@ -1,6 +1,7 @@ -- ProcessTyroleanDovetail.lua by Egaltech s.r.l. 2022/03/21 -- Gestione calcolo giunzione tirolese -- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe) +-- 2023/09/26 Modificata chiamata a GetFaceWithMostAdj. -- Tabella per definizione modulo local ProcessTyroleanDovetail = {} @@ -510,10 +511,10 @@ local function MakeMachByMill( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b dStepmach = dMaxMat * 0.5 end -- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa - local nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc.Id, nPartId, false, sin(dSideAngle)) + local nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc, nPartId, false, sin(dSideAngle)) if not nFacInd or nFacInd < 0 then -- provo eliminando i sottosquadra - nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc.Id, nPartId, false, -2) + nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc, nPartId, false, -2) if not nFacInd or nFacInd < 0 then local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' MakeMachByMill could not find reference face' EgtOutLog( sErr)