From 04aed7f175912f45032d5f42e01338e5b7a23e44 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Fri, 24 Jun 2022 18:14:59 +0200 Subject: [PATCH 01/17] =?UTF-8?q?DataBeam:=20-=20primo=20implemento=20modi?= =?UTF-8?q?fiche=20per=20forature=20in=20testa=20o=20coda=20per=20consider?= =?UTF-8?q?are=20materiale=20eventualmente=20gi=C3=A0=20rimosso=20da=20lav?= =?UTF-8?q?orazioni=20precedenti?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/BeamExec.lua | 57 +++++++++++++++++++++++++++++++++++++--- LuaLibs/ProcessDrill.lua | 11 ++++++++ 2 files changed, 64 insertions(+), 4 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 831c16d..c15a181 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -224,13 +224,22 @@ local function IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT) return false end +------------------------------------------------------------------------------------------------------------- +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() + local dRawH = b3Raw:getDimZ() -- recupero le feature local vProc = {} local LayerId = {} LayerId[1] = BL.GetAddGroup( PartId) LayerId[2] = EgtGetFirstNameInGroup( PartId or GDB_ID.NULL, 'Processings') + local nMachineBeforeIntersectingDrillingsIdHead, dMachineBeforeIntersectingDrillingsXHead, nMachineBeforeIntersectingDrillingsIdTail, dMachineBeforeIntersectingDrillingsXTail = nil, GEO.INFINITO, nil, -GEO.INFINITO + local b3MachineBeforeIntersectingDrillingsBoxHead, b3MachineBeforeIntersectingDrillingsBoxTail = nil, nil for nInd = 1, 2 do local ProcId = EgtGetFirstInGroup( LayerId[nInd] or GDB_ID.NULL) while ProcId do @@ -258,6 +267,17 @@ 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.Head and Proc.Box:getCenter():getX() < dMachineBeforeIntersectingDrillingsXHead then + dMachineBeforeIntersectingDrillingsXHead = Proc.Box:getCenter():getX() + nMachineBeforeIntersectingDrillingsIdHead = Proc.Id + b3MachineBeforeIntersectingDrillingsBoxHead = Proc.Box + elseif Proc.Tail and Proc.Box:getCenter():getX() > dMachineBeforeIntersectingDrillingsXTail then + dMachineBeforeIntersectingDrillingsXTail = Proc.Box:getCenter():getX() + nMachineBeforeIntersectingDrillingsIdTail = Proc.Id + b3MachineBeforeIntersectingDrillingsBoxTail = Proc.Box + end + end table.insert( vProc, Proc) -- se foro if Drill.Identify( Proc) then @@ -308,7 +328,11 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT) ProcId = EgtGetNext( ProcId) end end - return vProc + local vMachineBeforeIntersectingDrillings = { + Head = { Id = nMachineBeforeIntersectingDrillingsIdHead, Box = b3MachineBeforeIntersectingDrillingsBoxHead}, + Tail = { Id = nMachineBeforeIntersectingDrillingsIdTail, Box = b3MachineBeforeIntersectingDrillingsBoxTail} + } + return vProc, vMachineBeforeIntersectingDrillings end ------------------------------------------------------------------------------------------------------------- @@ -328,7 +352,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 ((abs(Proc.Box:getDimY() - dRawW) < 10 * GEO.EPS_SMALL or Proc.Box:getDimY() > dRawW) and (abs(Proc.Box:getDimZ() - dRawH) < 10 * GEO.EPS_SMALL or Proc.Box:getDimZ() > dRawH)) + bHeadFinishingNeeded = not IsFeatureCuttingEntireSection( Proc.Box, dRawW, dRawH) end end return bHeadFinishingNeeded, nReplacedFeatureId @@ -351,7 +375,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 ((abs(Proc.Box:getDimY() - dRawW) < 10 * GEO.EPS_SMALL or Proc.Box:getDimY() > dRawW) and (abs(Proc.Box:getDimZ() - dRawH) < 10 * GEO.EPS_SMALL or Proc.Box:getDimZ() > dRawH)) + bTailFinishingNeeded = not IsFeatureCuttingEntireSection( Proc.Box, dRawW, dRawH) end end return bTailFinishingNeeded, nReplacedFeatureId @@ -853,12 +877,18 @@ local function ClassifyFeatures( vProc, b3Raw, Stats) local bSplitRot = false local nHeading local nSplitting + local vMachineBeforeIntersectingDrillingsId = {} for i = 1, #vProc do local Proc = vProc[i] local bOk = true local bDown = false local bSide = false local bDownSideOnHeadOk = false + + if Proc.MachineBeforeIntersectingDrillings then + table.Insert ( vMachineBeforeIntersectingDrillingsId, Proc.Id) + end + -- se senza geometria (già disabilitato if Proc.Flg == 0 then bOk = false @@ -1275,6 +1305,23 @@ local function MoveDrillsOnTenon( vProc) end end +------------------------------------------------------------------------------------------------------------- +local function SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeIntersectingDrillings) + for i = 1, #vProc do + if Drill.Identify( vProc[i]) then + -- se esiste intersezione tra il foro e la feature di testa + if vMachineBeforeIntersectingDrillings.Head.Box and vProc[i].Box:getMin():getX() < vMachineBeforeIntersectingDrillings.Head.Box:getMax():getX() + 100 * GEO.EPS_SMALL and + vMachineBeforeIntersectingDrillings.Head.Box:getMin():getX() < vProc[i].Box:getMax():getX() + 100 * GEO.EPS_SMALL then + vProc[i].MachineAfterHeadCutId = vMachineBeforeIntersectingDrillings.Head.Id + -- se esiste intersezione tra il foro e la feature di coda + elseif vMachineBeforeIntersectingDrillings.Tail.Box and vProc[i].Box:getMin():getX() < vMachineBeforeIntersectingDrillings.Tail.Box:getMax():getX() + 100 * GEO.EPS_SMALL and + vMachineBeforeIntersectingDrillings.Tail.Box:getMin():getX() < vProc[i].Box:getMax():getX() + 100 * GEO.EPS_SMALL then + vProc[i].MachineAfterTailCutId = vMachineBeforeIntersectingDrillings.Tail.Id + end + end + end +end + ------------------------------------------------------------------------------------------------------------- function BeamExec.ProcessFeatures() -- verifica se possibile rotazione di 90 gradi @@ -1304,7 +1351,9 @@ function BeamExec.ProcessFeatures() local dCurrOvmH = EgtGetInfo( nRawId, 'HOVM', 'd') or 0 local dCurrOvmT = EgtGetInfo( nRawId, 'TOVM', 'd') or 0 -- recupero le feature di lavorazione della trave - local vProc = CollectFeatures( nPartId, b3Raw, dCurrOvmH, dCurrOvmT) + local vProc, vMachineBeforeIntersectingDrillings = CollectFeatures( nPartId, b3Raw, dCurrOvmH, dCurrOvmT) + -- verifica presenza forature da spostare dopo le lavorazioni di testa o coda + SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeIntersectingDrillings) -- le ordino lungo X OrderFeatures( vProc, b3Raw) -- le classifico diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index 1427943..970077c 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -394,6 +394,17 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- aggiusto l'affondamento local sMyWarn + + -- test + if Proc.MachineAfterHeadCutId then + local ptCen = EgtCP( AuxId, GDB_RT.GLOB) + local dMoveDistance, ptPointOnSurface = EgtPointSurfTmDist( ptCen, Proc.MachineAfterHeadCutId, GDB_RT.GLOB) + local vtMove = -vtExtr * dMoveDistance + EgtMove( AuxId, vtMove, GDB_RT.GLOB) + EgtModifyCurveThickness( Proc.MachineAfterHeadCutId, dLen - dMoveDistance) + end + -- fine test + 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 From 2ae06e9abf161c8dc2719500333d9a1e1f37d9cb Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 30 Jun 2022 16:55:02 +0200 Subject: [PATCH 02/17] implemento gestione MaxElev per affondamento foro --- LuaLibs/BeamExec.lua | 3 +-- LuaLibs/ProcessDrill.lua | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index c9ca8f8..8bae782 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -123,7 +123,6 @@ local FreeContour = require( 'ProcessFreeContour') local Decor = require( 'ProcessDecor') EgtOutLog( ' BeamExec started', 1) - EgtMdbSetGeneralParam( MCH_GP.MAXDEPTHSAFE, BD.COLL_SIC) EgtMdbSave() @@ -1322,7 +1321,7 @@ local function SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeInt -- se esiste intersezione tra il foro e la feature di coda elseif vMachineBeforeIntersectingDrillings.Tail.Box and vProc[i].Box:getMin():getX() < vMachineBeforeIntersectingDrillings.Tail.Box:getMax():getX() + 100 * GEO.EPS_SMALL and vMachineBeforeIntersectingDrillings.Tail.Box:getMin():getX() < vProc[i].Box:getMax():getX() + 100 * GEO.EPS_SMALL then - vProc[i].MachineAfterTailCutId = vMachineBeforeIntersectingDrillings.Tail.Id + vProc[i].MachineAfterTailCutId = vMachineBeforeIntersectingDrillings.Tail.Id end end end diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index 2264178..e387c63 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -395,25 +395,31 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) local sMyWarn -- test - if Proc.MachineAfterHeadCutId then + local dMaxElev = dDepth + if Proc.MachineAfterHeadCutId or Proc.MachineAfterTailCutId then local ptCen = EgtCP( AuxId, GDB_RT.GLOB) - local dMoveDistance, ptPointOnSurface = EgtPointSurfTmDist( ptCen, Proc.MachineAfterHeadCutId, GDB_RT.GLOB) - local vtMove = -vtExtr * dMoveDistance - EgtMove( AuxId, vtMove, GDB_RT.GLOB) - EgtModifyCurveThickness( Proc.MachineAfterHeadCutId, dLen - dMoveDistance) + if ( Proc.MachineAfterHeadCutId and vtExtr:getX() < 0) or ( Proc.MachineAfterTailCutId and vtExtr:getX() > 0) then + local vtMove = -vtExtr * dLen + ptCen:move( vtMove) + end + local bIntersectionOk, _, vDistance = EgtLineSurfTmInters( ptCen, -vtExtr, Proc.MachineAfterHeadCutId or Proc.MachineAfterTailCutId, GDB_RT.GLOB) + if bIntersectionOk == true then + dMaxElev = abs( vDistance[1]) + end end -- fine test - if dDepth > dMaxDepth + 10 * GEO.EPS_SMALL then + if dMaxElev > 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) end + EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) -- Note utente con dichiarazione nessuna generazione sfridi per Vmill local sUserNotes = 'VMRS=0;' -- aggiungo alle note massima elevazione (coincide con affondamento) - sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( dDepth, 1) .. ';' + sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( dMaxElev, 1) .. ';' -- se foro passante, aggiungo questa qualifica alle note if ( sType == 'Drill' or sType == 'Drill_H2') and bOpen then sUserNotes = sUserNotes .. 'Open=1;' From d5709be6b0a3332f4b761f6b72f5f2fc8a55c5aa Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Fri, 1 Jul 2022 09:10:37 +0200 Subject: [PATCH 03/17] miglioramento e correzione gestione MaxElev per affondamento foro --- LuaLibs/BeamExec.lua | 2 ++ LuaLibs/ProcessDrill.lua | 25 ++++++++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 8bae782..4d8d1d1 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -1318,10 +1318,12 @@ local function SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeInt if vMachineBeforeIntersectingDrillings.Head.Box and vProc[i].Box:getMin():getX() < vMachineBeforeIntersectingDrillings.Head.Box:getMax():getX() + 100 * GEO.EPS_SMALL and vMachineBeforeIntersectingDrillings.Head.Box:getMin():getX() < vProc[i].Box:getMax():getX() + 100 * GEO.EPS_SMALL then vProc[i].MachineAfterHeadCutId = vMachineBeforeIntersectingDrillings.Head.Id + --vProc[i].Head = true -- se esiste intersezione tra il foro e la feature di coda elseif vMachineBeforeIntersectingDrillings.Tail.Box and vProc[i].Box:getMin():getX() < vMachineBeforeIntersectingDrillings.Tail.Box:getMax():getX() + 100 * GEO.EPS_SMALL and vMachineBeforeIntersectingDrillings.Tail.Box:getMin():getX() < vProc[i].Box:getMax():getX() + 100 * GEO.EPS_SMALL then vProc[i].MachineAfterTailCutId = vMachineBeforeIntersectingDrillings.Tail.Id + --vProc[i].Tail = true end end end diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index e387c63..183e834 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -396,17 +396,28 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) -- test local dMaxElev = dDepth - if Proc.MachineAfterHeadCutId or Proc.MachineAfterTailCutId then + local dToolHolderExtraLength = 0 + local dSafetyExtraLength = 0 + if ( Proc.MachineAfterHeadCutId and vtExtr:getX() > 0) or ( Proc.MachineAfterTailCutId and vtExtr:getX() < 0) then local ptCen = EgtCP( AuxId, GDB_RT.GLOB) - if ( Proc.MachineAfterHeadCutId and vtExtr:getX() < 0) or ( Proc.MachineAfterTailCutId and vtExtr:getX() > 0) then - local vtMove = -vtExtr * dLen - ptCen:move( vtMove) - end local bIntersectionOk, _, vDistance = EgtLineSurfTmInters( ptCen, -vtExtr, Proc.MachineAfterHeadCutId or Proc.MachineAfterTailCutId, GDB_RT.GLOB) - if bIntersectionOk == true then - dMaxElev = abs( vDistance[1]) + dHoleEndToCutDistance = vDistance[1] + if bIntersectionOk then + if dHoleEndToCutDistance > 0 then + dMaxElev = dLen - dHoleEndToCutDistance + dToolHolderExtraLength + dSafetyExtraLength + elseif dHoleEndToCutDistance < 0 then + dMaxElev = dHoleEndToCutDistance + dToolHolderExtraLength + dSafetyExtraLength + end end end +-- local vtMove = -vtExtr * dLen +-- ptCen:move( vtMove) +-- end +-- local bIntersectionOk, _, vDistance = EgtLineSurfTmInters( ptCen, -vtExtr, Proc.MachineAfterHeadCutId or Proc.MachineAfterTailCutId, GDB_RT.GLOB) +-- if bIntersectionOk == true then +-- dMaxElev = dDepth - abs( vDistance[1]) +-- end +-- end -- fine test if dMaxElev > dMaxDepth + 10 * GEO.EPS_SMALL then From f30a44fb63ceb6166cf03905b199b67461c513c2 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Fri, 1 Jul 2022 14:59:39 +0200 Subject: [PATCH 04/17] gestiti ulteriori casi per allungamento foro --- LuaLibs/ProcessDrill.lua | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index 183e834..3b131c7 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -8,6 +8,7 @@ -- 2022/03/29 DS Corretta assegnazione fori molto inclinati fianco/coda a coda. -- 2022/04/21 DS Corretto riconoscimento fori di coda. -- 2022/06/22 Nel riconoscimento fori di coda si utilizza ora il reale sovramateriale di coda (dOvmTail) invece di BD.OVM_MID. +-- 2022/07/01 Aggiunta gestione allungamento percorsi fori in caso di materiale già rimosso da lavorazioni precedenti -- Tabella per definizione modulo local ProcessDrill = {} @@ -393,39 +394,28 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- aggiusto l'affondamento local sMyWarn - - -- test - local dMaxElev = dDepth - local dToolHolderExtraLength = 0 - local dSafetyExtraLength = 0 + local dMaxElev = dLen + -- se c'è un taglio precedente di testa o coda posso impostare MaxElev per allungare il percorso + -- considero solo i fori "entranti" in testa o coda if ( Proc.MachineAfterHeadCutId and vtExtr:getX() > 0) or ( Proc.MachineAfterTailCutId and vtExtr:getX() < 0) then local ptCen = EgtCP( AuxId, GDB_RT.GLOB) local bIntersectionOk, _, vDistance = EgtLineSurfTmInters( ptCen, -vtExtr, Proc.MachineAfterHeadCutId or Proc.MachineAfterTailCutId, GDB_RT.GLOB) - dHoleEndToCutDistance = vDistance[1] + dHoleToCutDistance = vDistance[1] + -- il segno della distanza data dalla funzione di intersezione mi indica dove sia la geometria del foro if bIntersectionOk then - if dHoleEndToCutDistance > 0 then - dMaxElev = dLen - dHoleEndToCutDistance + dToolHolderExtraLength + dSafetyExtraLength - elseif dHoleEndToCutDistance < 0 then - dMaxElev = dHoleEndToCutDistance + dToolHolderExtraLength + dSafetyExtraLength + if dHoleToCutDistance > 0 then + dMaxElev = dLen - dHoleToCutDistance + elseif dHoleToCutDistance < 0 then + dMaxElev = -dHoleToCutDistance end end end --- local vtMove = -vtExtr * dLen --- ptCen:move( vtMove) --- end --- local bIntersectionOk, _, vDistance = EgtLineSurfTmInters( ptCen, -vtExtr, Proc.MachineAfterHeadCutId or Proc.MachineAfterTailCutId, GDB_RT.GLOB) --- if bIntersectionOk == true then --- dMaxElev = dDepth - abs( vDistance[1]) --- end --- end - -- fine test - - if dMaxElev > dMaxDepth + 10 * GEO.EPS_SMALL then - sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')' - dDepth = dMaxDepth + local dToolAddLength = dLen - dMaxElev + if dDepth - dToolAddLength > dMaxDepth + 10 * GEO.EPS_SMALL then + sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth - dToolAddLength, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')' + dDepth = dMaxDepth + dToolAddLength EgtOutLog( sMyWarn) end - EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) -- Note utente con dichiarazione nessuna generazione sfridi per Vmill local sUserNotes = 'VMRS=0;' From 83196da193c52649c0681a4eeddf4e1ada58a47a Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Fri, 1 Jul 2022 18:39:38 +0200 Subject: [PATCH 05/17] =?UTF-8?q?inserito=20parametro=20IMPROVE=5FHEAD=5FT?= =?UTF-8?q?AIL=5FDRILLINGS=20per=20attivare=20o=20disattivare=20questa=20f?= =?UTF-8?q?eature.=20Di=20default=20=C3=A8=20attiva?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/BeamExec.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 4d8d1d1..114a883 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -30,6 +30,8 @@ -- 2022/06/10 Per sezioni alte e larghe modificata la gestione del sovramateriale per considerare la presenza di feature preesistenti ed -- eventuale parametro Q05, che determinano la presenza o meno della finitura. -- Create le funzioni AnalyzeHeadFeatures e AnalyzeTailFeatures. Spostate più in alto le funzioni CollectFeatures, isHeadFeature e isTailFeature. +-- 2022/07/01 Aggiunta la gestione delle forature migliorate in presenza di feature testa/coda ad 1 faccia che tagliano tutta la sezione, +-- controllata tramite il parametro IMPROVE_HEAD_TAIL_DRILLINGS da BeamData. Attivata di default. -- Tabella per definizione modulo local BeamExec = {} @@ -1331,6 +1333,9 @@ end ------------------------------------------------------------------------------------------------------------- function BeamExec.ProcessFeatures() + if not BD.IMPROVE_HEAD_TAIL_DRILLINGS then + BD.IMPROVE_HEAD_TAIL_DRILLINGS = true + end -- verifica se possibile rotazione di 90 gradi BD.ROT90 = BD.ROT90 and Verify90DegRotation( EgtGetFirstRawPart()) -- ciclo sui pezzi @@ -1359,8 +1364,10 @@ function BeamExec.ProcessFeatures() local dCurrOvmT = EgtGetInfo( nRawId, 'TOVM', 'd') or 0 -- recupero le feature di lavorazione della trave local vProc, vMachineBeforeIntersectingDrillings = CollectFeatures( nPartId, b3Raw, dCurrOvmH, dCurrOvmT) - -- verifica presenza forature da spostare dopo le lavorazioni di testa o coda - SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeIntersectingDrillings) + -- verifica presenza forature influenzate da lavorazioni di testa o coda + if BD.IMPROVE_HEAD_TAIL_DRILLINGS then + SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeIntersectingDrillings) + end -- le ordino lungo X OrderFeatures( vProc, b3Raw) -- le classifico From 0054646e78540b7929f8dd70e627dc23cd0a0fa9 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 4 Jul 2022 12:25:37 +0200 Subject: [PATCH 06/17] corretta gestione affondamento in caso di utensile troppo corto, per abbinarsi con MaxElev --- LuaLibs/BeamExec.lua | 4 ++-- LuaLibs/ProcessDrill.lua | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 114a883..a793209 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -1320,12 +1320,12 @@ local function SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeInt if vMachineBeforeIntersectingDrillings.Head.Box and vProc[i].Box:getMin():getX() < vMachineBeforeIntersectingDrillings.Head.Box:getMax():getX() + 100 * GEO.EPS_SMALL and vMachineBeforeIntersectingDrillings.Head.Box:getMin():getX() < vProc[i].Box:getMax():getX() + 100 * GEO.EPS_SMALL then vProc[i].MachineAfterHeadCutId = vMachineBeforeIntersectingDrillings.Head.Id - --vProc[i].Head = true + vProc[i].Head = true -- se esiste intersezione tra il foro e la feature di coda elseif vMachineBeforeIntersectingDrillings.Tail.Box and vProc[i].Box:getMin():getX() < vMachineBeforeIntersectingDrillings.Tail.Box:getMax():getX() + 100 * GEO.EPS_SMALL and vMachineBeforeIntersectingDrillings.Tail.Box:getMin():getX() < vProc[i].Box:getMax():getX() + 100 * GEO.EPS_SMALL then vProc[i].MachineAfterTailCutId = vMachineBeforeIntersectingDrillings.Tail.Id - --vProc[i].Tail = true + vProc[i].Tail = true end end end diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index 3b131c7..471a893 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -413,7 +413,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) local dToolAddLength = dLen - dMaxElev if dDepth - dToolAddLength > dMaxDepth + 10 * GEO.EPS_SMALL then sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth - dToolAddLength, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')' - dDepth = dMaxDepth + dToolAddLength + dDepth = dLen EgtOutLog( sMyWarn) end EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) From 007453337a1524f5d097faf39ec5d689c3503dc1 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 4 Jul 2022 15:47:02 +0200 Subject: [PATCH 07/17] correzione ulteriore --- LuaLibs/BeamExec.lua | 2 +- LuaLibs/ProcessDrill.lua | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index a793209..5d16f02 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -1333,7 +1333,7 @@ end ------------------------------------------------------------------------------------------------------------- function BeamExec.ProcessFeatures() - if not BD.IMPROVE_HEAD_TAIL_DRILLINGS then + if BD.IMPROVE_HEAD_TAIL_DRILLINGS == nil then BD.IMPROVE_HEAD_TAIL_DRILLINGS = true end -- verifica se possibile rotazione di 90 gradi diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index 471a893..cf836ab 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -413,7 +413,11 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) local dToolAddLength = dLen - dMaxElev if dDepth - dToolAddLength > dMaxDepth + 10 * GEO.EPS_SMALL then sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth - dToolAddLength, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')' - dDepth = dLen + if dMaxDepth == 0 then + dDepth = 0 + else + dDepth = dLen + end EgtOutLog( sMyWarn) end EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) From 57dba9b76c3594d1cc15be6f9a6f9b78bbc690e4 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 4 Jul 2022 18:03:40 +0200 Subject: [PATCH 08/17] modifiche ulteriori al calcolo dell'affondamento --- LuaLibs/ProcessDrill.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index cf836ab..04d512a 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -394,7 +394,8 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) EgtSetMachiningParam( MCH_MP.SCC, nSCC) -- aggiusto l'affondamento local sMyWarn - local dMaxElev = dLen + local dMaxElev = dDepth + local dToolAddLength = 0 -- se c'è un taglio precedente di testa o coda posso impostare MaxElev per allungare il percorso -- considero solo i fori "entranti" in testa o coda if ( Proc.MachineAfterHeadCutId and vtExtr:getX() > 0) or ( Proc.MachineAfterTailCutId and vtExtr:getX() < 0) then @@ -408,14 +409,15 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) elseif dHoleToCutDistance < 0 then dMaxElev = -dHoleToCutDistance end + dToolAddLength = dLen - dMaxElev end end - local dToolAddLength = dLen - dMaxElev if dDepth - dToolAddLength > dMaxDepth + 10 * GEO.EPS_SMALL then sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth - dToolAddLength, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')' - if dMaxDepth == 0 then - dDepth = 0 - else + if dMaxDepth == 0 or dToolAddLength == 0 then + dDepth = dMaxDepth + dMaxElev = dDepth + elseif abs( dMaxElev - dDepth) > GEO.EPS_SMALL then dDepth = dLen end EgtOutLog( sMyWarn) From 9e3aadd2a691676bebe57e6f181ca6df8fea94f3 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Tue, 5 Jul 2022 17:07:27 +0200 Subject: [PATCH 09/17] gestione corretta di MaxElev in tutti i casi --- LuaLibs/ProcessDrill.lua | 108 ++++++++++++++++++++++++++++++--------- 1 file changed, 84 insertions(+), 24 deletions(-) diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index 04d512a..a7e2b36 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -392,36 +392,96 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) nSCC = MCH_SCC.NONE end EgtSetMachiningParam( MCH_MP.SCC, nSCC) + + ----------------------------------------- -- aggiusto l'affondamento - local sMyWarn +-- local sMyWarn +-- local dMaxElev = dDepth +-- local dToolAddLength = 0 +-- -- se c'è un taglio precedente di testa o coda posso impostare MaxElev per allungare il percorso +-- -- considero solo i fori "entranti" in testa o coda +-- if ( Proc.MachineAfterHeadCutId and vtExtr:getX() > 0) or ( Proc.MachineAfterTailCutId and vtExtr:getX() < 0) then +-- local ptCen = EgtCP( AuxId, GDB_RT.GLOB) +-- local bIntersectionOk, _, vDistance = EgtLineSurfTmInters( ptCen, -vtExtr, Proc.MachineAfterHeadCutId or Proc.MachineAfterTailCutId, GDB_RT.GLOB) +-- dHoleToCutDistance = vDistance[1] +-- -- il segno della distanza data dalla funzione di intersezione mi indica dove sia la geometria del foro +-- if bIntersectionOk then +-- if dHoleToCutDistance > 0 then +-- dMaxElev = dLen - dHoleToCutDistance +-- elseif dHoleToCutDistance < 0 then +-- dMaxElev = -dHoleToCutDistance +-- end +-- dToolAddLength = dLen - dMaxElev +-- end +-- end +-- if dDepth - dToolAddLength > dMaxDepth + 10 * GEO.EPS_SMALL then +-- sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth - dToolAddLength, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')' +-- if dMaxDepth == 0 or dToolAddLength == 0 then +-- dDepth = dMaxDepth +-- dMaxElev = dDepth +-- elseif abs( dMaxElev - dDepth) > GEO.EPS_SMALL then +-- dDepth = dLen +-- end +-- EgtOutLog( sMyWarn) +-- end + ------------------------------------------ + + -- aggiusto affondamento e MaxElev local dMaxElev = dDepth - local dToolAddLength = 0 - -- se c'è un taglio precedente di testa o coda posso impostare MaxElev per allungare il percorso - -- considero solo i fori "entranti" in testa o coda - if ( Proc.MachineAfterHeadCutId and vtExtr:getX() > 0) or ( Proc.MachineAfterTailCutId and vtExtr:getX() < 0) then - local ptCen = EgtCP( AuxId, GDB_RT.GLOB) - local bIntersectionOk, _, vDistance = EgtLineSurfTmInters( ptCen, -vtExtr, Proc.MachineAfterHeadCutId or Proc.MachineAfterTailCutId, GDB_RT.GLOB) - dHoleToCutDistance = vDistance[1] - -- il segno della distanza data dalla funzione di intersezione mi indica dove sia la geometria del foro - if bIntersectionOk then - if dHoleToCutDistance > 0 then - dMaxElev = dLen - dHoleToCutDistance - elseif dHoleToCutDistance < 0 then - dMaxElev = -dHoleToCutDistance + local sMyWarn + if dDepth > dMaxDepth + 10 * GEO.EPS_SMALL then + -- se c'è un taglio precedente di testa o coda posso impostare MaxElev per allungare il percorso + -- considero solo i fori "entranti" in testa o coda + if (( Proc.MachineAfterHeadCutId and vtExtr:getX() > 0) or ( Proc.MachineAfterTailCutId and vtExtr:getX() < 0)) and dMaxDepth ~= 0 then + local ptCen = EgtCP( AuxId, GDB_RT.GLOB) + local bIntersectionOk, _, vDistance = EgtLineSurfTmInters( ptCen, -vtExtr, Proc.MachineAfterHeadCutId or Proc.MachineAfterTailCutId, GDB_RT.GLOB) + dHoleToCutDistance = vDistance[1] + -- setto MaxElev + -- il segno della distanza data dalla funzione di intersezione mi indica dove sia la geometria del foro + if bIntersectionOk then + if dHoleToCutDistance > 0 then + dMaxElev = dLen - dHoleToCutDistance + elseif dHoleToCutDistance < 0 then + dMaxElev = -dHoleToCutDistance + end + local dToolAddLength = dLen - dMaxElev + -- se l'utensile è comunque troppo corto lavoro il massimo possibile + if dDepth - dToolAddLength > dMaxDepth + 10 * GEO.EPS_SMALL then + sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth - dToolAddLength, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')' + dDepth = dLen + else + dMaxElev = dMaxElev - dLen + dDepth + end + -- se per qualche motivo fallisce l'intersezione torno al caso standard + else + sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')' + dDepth = dMaxDepth + dMaxElev = dMaxDepth end - dToolAddLength = dLen - dMaxElev - end - end - if dDepth - dToolAddLength > dMaxDepth + 10 * GEO.EPS_SMALL then - sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth - dToolAddLength, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')' - if dMaxDepth == 0 or dToolAddLength == 0 then + -- caso standard + else + sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')' dDepth = dMaxDepth - dMaxElev = dDepth - elseif abs( dMaxElev - dDepth) > GEO.EPS_SMALL then - dDepth = dLen + dMaxElev = dMaxDepth + end + if sMyWarn then + EgtOutLog( sMyWarn) end - EgtOutLog( sMyWarn) end + + + + + + + + + + + + + + EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) -- Note utente con dichiarazione nessuna generazione sfridi per Vmill local sUserNotes = 'VMRS=0;' From b83f427a55c9d94cc9b5105861aeff27f02bf102 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Tue, 5 Jul 2022 18:40:16 +0200 Subject: [PATCH 10/17] piccola modifica per bypassare il check precedente che azzera MaxDepth --- LuaLibs/ProcessDrill.lua | 57 ++++++---------------------------------- 1 file changed, 8 insertions(+), 49 deletions(-) diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index a7e2b36..12f5130 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -319,6 +319,8 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) -- se foro non su testa o coda e inclinato local bInMid = false local bInvertFcse = ( bToInvert and Proc.Flg ~= -2) + -- tengo via il valore originale di MaxDepth per poter eventualmente bypassare i check successivi + local dMaxDepthOri = dMaxDepth if ( not bInvertFcse and Proc.Fcs ~= 5 and Proc.Fcs ~= 6) or ( bInvertFcse and Proc.Fce ~= 5 and Proc.Fce ~= 6) then bInMid = true local CosB = abs( vtExtr:getX()) @@ -392,53 +394,23 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) nSCC = MCH_SCC.NONE end EgtSetMachiningParam( MCH_MP.SCC, nSCC) - - ----------------------------------------- - -- aggiusto l'affondamento --- local sMyWarn --- local dMaxElev = dDepth --- local dToolAddLength = 0 --- -- se c'è un taglio precedente di testa o coda posso impostare MaxElev per allungare il percorso --- -- considero solo i fori "entranti" in testa o coda --- if ( Proc.MachineAfterHeadCutId and vtExtr:getX() > 0) or ( Proc.MachineAfterTailCutId and vtExtr:getX() < 0) then --- local ptCen = EgtCP( AuxId, GDB_RT.GLOB) --- local bIntersectionOk, _, vDistance = EgtLineSurfTmInters( ptCen, -vtExtr, Proc.MachineAfterHeadCutId or Proc.MachineAfterTailCutId, GDB_RT.GLOB) --- dHoleToCutDistance = vDistance[1] --- -- il segno della distanza data dalla funzione di intersezione mi indica dove sia la geometria del foro --- if bIntersectionOk then --- if dHoleToCutDistance > 0 then --- dMaxElev = dLen - dHoleToCutDistance --- elseif dHoleToCutDistance < 0 then --- dMaxElev = -dHoleToCutDistance --- end --- dToolAddLength = dLen - dMaxElev --- end --- end --- if dDepth - dToolAddLength > dMaxDepth + 10 * GEO.EPS_SMALL then --- sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth - dToolAddLength, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')' --- if dMaxDepth == 0 or dToolAddLength == 0 then --- dDepth = dMaxDepth --- dMaxElev = dDepth --- elseif abs( dMaxElev - dDepth) > GEO.EPS_SMALL then --- dDepth = dLen --- end --- EgtOutLog( sMyWarn) --- end - ------------------------------------------ - -- aggiusto affondamento e MaxElev local dMaxElev = dDepth local sMyWarn if dDepth > dMaxDepth + 10 * GEO.EPS_SMALL then -- se c'è un taglio precedente di testa o coda posso impostare MaxElev per allungare il percorso -- considero solo i fori "entranti" in testa o coda - if (( Proc.MachineAfterHeadCutId and vtExtr:getX() > 0) or ( Proc.MachineAfterTailCutId and vtExtr:getX() < 0)) and dMaxDepth ~= 0 then + if (( Proc.MachineAfterHeadCutId and vtExtr:getX() > 0) or ( Proc.MachineAfterTailCutId and vtExtr:getX() < 0)) then local ptCen = EgtCP( AuxId, GDB_RT.GLOB) local bIntersectionOk, _, vDistance = EgtLineSurfTmInters( ptCen, -vtExtr, Proc.MachineAfterHeadCutId or Proc.MachineAfterTailCutId, GDB_RT.GLOB) dHoleToCutDistance = vDistance[1] -- setto MaxElev -- il segno della distanza data dalla funzione di intersezione mi indica dove sia la geometria del foro if bIntersectionOk then + -- se MaxDepth era stato settato a 0 per disattivare la lavorazione gli riassegno il valore originale + if dMaxDepth == 0 then + dMaxDepth = dMaxDepthOri + end if dHoleToCutDistance > 0 then dMaxElev = dLen - dHoleToCutDistance elseif dHoleToCutDistance < 0 then @@ -450,6 +422,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth - dToolAddLength, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')' dDepth = dLen else + -- se non lavoro la massima lunghezza disponibile devo correggere MaxElev dMaxElev = dMaxElev - dLen + dDepth end -- se per qualche motivo fallisce l'intersezione torno al caso standard @@ -468,20 +441,6 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) EgtOutLog( sMyWarn) end end - - - - - - - - - - - - - - EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) -- Note utente con dichiarazione nessuna generazione sfridi per Vmill local sUserNotes = 'VMRS=0;' From 75833d5f1ca7ea97a4c9a85cc4665c66af6e28f0 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Wed, 6 Jul 2022 09:20:52 +0200 Subject: [PATCH 11/17] modifica default per costante attivazione --- LuaLibs/BeamExec.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 5d16f02..9e47bc1 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -1333,9 +1333,8 @@ end ------------------------------------------------------------------------------------------------------------- function BeamExec.ProcessFeatures() - if BD.IMPROVE_HEAD_TAIL_DRILLINGS == nil then - BD.IMPROVE_HEAD_TAIL_DRILLINGS = true - end + -- default per costanti qualora non definite + BD.IMPROVE_HEAD_TAIL_DRILLINGS = ( BD.IMPROVE_HEAD_TAIL_DRILLINGS or true) -- verifica se possibile rotazione di 90 gradi BD.ROT90 = BD.ROT90 and Verify90DegRotation( EgtGetFirstRawPart()) -- ciclo sui pezzi From 071389a8582f90b87de0b6b8085f784bbca13c14 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Wed, 6 Jul 2022 09:25:05 +0200 Subject: [PATCH 12/17] Revert "modifica default per costante attivazione" This reverts commit 75833d5f1ca7ea97a4c9a85cc4665c66af6e28f0. --- LuaLibs/BeamExec.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 9e47bc1..5d16f02 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -1333,8 +1333,9 @@ end ------------------------------------------------------------------------------------------------------------- function BeamExec.ProcessFeatures() - -- default per costanti qualora non definite - BD.IMPROVE_HEAD_TAIL_DRILLINGS = ( BD.IMPROVE_HEAD_TAIL_DRILLINGS or true) + if BD.IMPROVE_HEAD_TAIL_DRILLINGS == nil then + BD.IMPROVE_HEAD_TAIL_DRILLINGS = true + end -- verifica se possibile rotazione di 90 gradi BD.ROT90 = BD.ROT90 and Verify90DegRotation( EgtGetFirstRawPart()) -- ciclo sui pezzi From ccb363f6f18410f092764fc2bbd1ab7beb7f8e6d Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Wed, 6 Jul 2022 12:01:40 +0200 Subject: [PATCH 13/17] Per forature su feature di testa o coda corretta l'assegnazione di head o tail ( funzione SetDrillingsToMachineAfterHeadOrTailCut in BeamExec) --- LuaLibs/BeamExec.lua | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 5d16f02..a9db6a9 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -228,6 +228,7 @@ local function IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT) 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 @@ -1313,20 +1314,35 @@ local function MoveDrillsOnTenon( vProc) end ------------------------------------------------------------------------------------------------------------- +-- verifica se ci sono forature da lavorare dopo tagli di testa o coda e nel caso le classifica come Head o Tail e gli assegna l'Id della rispettiva feature di taglio local function SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeIntersectingDrillings) for i = 1, #vProc do if Drill.Identify( vProc[i]) then - -- se esiste intersezione tra il foro e la feature di testa - if vMachineBeforeIntersectingDrillings.Head.Box and vProc[i].Box:getMin():getX() < vMachineBeforeIntersectingDrillings.Head.Box:getMax():getX() + 100 * GEO.EPS_SMALL and - vMachineBeforeIntersectingDrillings.Head.Box:getMin():getX() < vProc[i].Box:getMax():getX() + 100 * GEO.EPS_SMALL then + -- recupero e verifico l'entità foro + local AuxId = EgtGetInfo( vProc[i].Id, 'AUXID', 'i') + if AuxId then AuxId = AuxId + vProc[i].Id end + if not AuxId or EgtGetType( AuxId) ~= GDB_TY.CRV_ARC then + return false + end + -- recupero il vettore estrusione + local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) + -- se esiste intersezione tra il foro e la feature di testa + if vMachineBeforeIntersectingDrillings.Head.Box and vProc[i].Box:getMin():getX() < vMachineBeforeIntersectingDrillings.Head.Box:getMax():getX() + 100 * GEO.EPS_SMALL and + vMachineBeforeIntersectingDrillings.Head.Box:getMin():getX() < vProc[i].Box:getMax():getX() + 100 * GEO.EPS_SMALL then + -- verifico che il foro sia di testa + if ( vProc[i].Flg > 0 and vtExtr:getX() > 0) or ( vProc[i].Flg == -2 and vtExtr:getX() < 0) then vProc[i].MachineAfterHeadCutId = vMachineBeforeIntersectingDrillings.Head.Id vProc[i].Head = true - -- se esiste intersezione tra il foro e la feature di coda - elseif vMachineBeforeIntersectingDrillings.Tail.Box and vProc[i].Box:getMin():getX() < vMachineBeforeIntersectingDrillings.Tail.Box:getMax():getX() + 100 * GEO.EPS_SMALL and - vMachineBeforeIntersectingDrillings.Tail.Box:getMin():getX() < vProc[i].Box:getMax():getX() + 100 * GEO.EPS_SMALL then + end + -- se esiste intersezione tra il foro e la feature di coda + elseif vMachineBeforeIntersectingDrillings.Tail.Box and vProc[i].Box:getMin():getX() < vMachineBeforeIntersectingDrillings.Tail.Box:getMax():getX() + 100 * GEO.EPS_SMALL and + vMachineBeforeIntersectingDrillings.Tail.Box:getMin():getX() < vProc[i].Box:getMax():getX() + 100 * GEO.EPS_SMALL then + -- verifico che il foro sia di coda + if ( vProc[i].Flg > 0 and vtExtr:getX() < 0) or ( vProc[i].Flg == -2 and vtExtr:getX() > 0) then vProc[i].MachineAfterTailCutId = vMachineBeforeIntersectingDrillings.Tail.Id vProc[i].Tail = true end + end end end end From 4b9c4af1b5e3a573ce07c7c4704c83caa1d4ce7c Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Wed, 6 Jul 2022 15:11:32 +0200 Subject: [PATCH 14/17] Correzione per forature su feature di testa o coda: ora riconosce correttamente anche le forature aperte con versore opposto --- LuaLibs/BeamExec.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index a9db6a9..e6dc89f 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -1326,11 +1326,12 @@ local function SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeInt end -- recupero il vettore estrusione local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) + local bOpen = ( vProc[i].Fcs ~= 0 and vProc[i].Fce ~= 0) -- se esiste intersezione tra il foro e la feature di testa if vMachineBeforeIntersectingDrillings.Head.Box and vProc[i].Box:getMin():getX() < vMachineBeforeIntersectingDrillings.Head.Box:getMax():getX() + 100 * GEO.EPS_SMALL and vMachineBeforeIntersectingDrillings.Head.Box:getMin():getX() < vProc[i].Box:getMax():getX() + 100 * GEO.EPS_SMALL then -- verifico che il foro sia di testa - if ( vProc[i].Flg > 0 and vtExtr:getX() > 0) or ( vProc[i].Flg == -2 and vtExtr:getX() < 0) then + if ( bOpen or ( not bOpen and vtExtr:getX() > 0)) then vProc[i].MachineAfterHeadCutId = vMachineBeforeIntersectingDrillings.Head.Id vProc[i].Head = true end @@ -1338,7 +1339,7 @@ local function SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeInt elseif vMachineBeforeIntersectingDrillings.Tail.Box and vProc[i].Box:getMin():getX() < vMachineBeforeIntersectingDrillings.Tail.Box:getMax():getX() + 100 * GEO.EPS_SMALL and vMachineBeforeIntersectingDrillings.Tail.Box:getMin():getX() < vProc[i].Box:getMax():getX() + 100 * GEO.EPS_SMALL then -- verifico che il foro sia di coda - if ( vProc[i].Flg > 0 and vtExtr:getX() < 0) or ( vProc[i].Flg == -2 and vtExtr:getX() > 0) then + if ( bOpen or ( not bOpen and vtExtr:getX() < 0)) then vProc[i].MachineAfterTailCutId = vMachineBeforeIntersectingDrillings.Tail.Id vProc[i].Tail = true end From 33cd018a906d79e23d6e0013976298e0a8e9792e Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Wed, 6 Jul 2022 19:12:24 +0200 Subject: [PATCH 15/17] in SetDrillingsToMachineAfterHeadOrTailCut (BeamExec) corretto check intersezione fori --- LuaLibs/BeamExec.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index e6dc89f..0e12b87 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -1327,17 +1327,18 @@ local function SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeInt -- recupero il vettore estrusione local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) local bOpen = ( vProc[i].Fcs ~= 0 and vProc[i].Fce ~= 0) + local ptCen = EgtCP( AuxId, GDB_RT.GLOB) + local _, _, vDistHead = EgtLineSurfTmInters( ptCen, -vtExtr, vMachineBeforeIntersectingDrillings.Head.Id, GDB_RT.GLOB) + local _, _, vDistTail = EgtLineSurfTmInters( ptCen, -vtExtr, vMachineBeforeIntersectingDrillings.Tail.Id, GDB_RT.GLOB) -- se esiste intersezione tra il foro e la feature di testa - if vMachineBeforeIntersectingDrillings.Head.Box and vProc[i].Box:getMin():getX() < vMachineBeforeIntersectingDrillings.Head.Box:getMax():getX() + 100 * GEO.EPS_SMALL and - vMachineBeforeIntersectingDrillings.Head.Box:getMin():getX() < vProc[i].Box:getMax():getX() + 100 * GEO.EPS_SMALL then + if #vDistHead > 0 then -- verifico che il foro sia di testa if ( bOpen or ( not bOpen and vtExtr:getX() > 0)) then vProc[i].MachineAfterHeadCutId = vMachineBeforeIntersectingDrillings.Head.Id vProc[i].Head = true end -- se esiste intersezione tra il foro e la feature di coda - elseif vMachineBeforeIntersectingDrillings.Tail.Box and vProc[i].Box:getMin():getX() < vMachineBeforeIntersectingDrillings.Tail.Box:getMax():getX() + 100 * GEO.EPS_SMALL and - vMachineBeforeIntersectingDrillings.Tail.Box:getMin():getX() < vProc[i].Box:getMax():getX() + 100 * GEO.EPS_SMALL then + elseif #vDistTail > 0 then -- verifico che il foro sia di coda if ( bOpen or ( not bOpen and vtExtr:getX() < 0)) then vProc[i].MachineAfterTailCutId = vMachineBeforeIntersectingDrillings.Tail.Id From ac4f32e5165243601c12b36d9b19340a99783121 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 7 Jul 2022 12:32:56 +0200 Subject: [PATCH 16/17] =?UTF-8?q?Feature/DrillingsOnHeadOrTailCut:=20ora?= =?UTF-8?q?=20le=20forature=20prolungate=20arrivano=20fino=20alla=20massim?= =?UTF-8?q?a=20profondit=C3=A0=20possibile=20(limite=20dLen=20-=2010)=20in?= =?UTF-8?q?=20caso=20di=20split?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/BeamExec.lua | 15 +++++++++++---- LuaLibs/ProcessDrill.lua | 9 +++++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 0e12b87..da0d99d 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -1328,17 +1328,24 @@ local function SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeInt local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) local bOpen = ( vProc[i].Fcs ~= 0 and vProc[i].Fce ~= 0) local ptCen = EgtCP( AuxId, GDB_RT.GLOB) - local _, _, vDistHead = EgtLineSurfTmInters( ptCen, -vtExtr, vMachineBeforeIntersectingDrillings.Head.Id, GDB_RT.GLOB) - local _, _, vDistTail = EgtLineSurfTmInters( ptCen, -vtExtr, vMachineBeforeIntersectingDrillings.Tail.Id, GDB_RT.GLOB) + local vDistHead, vDistTail + -- check intersezione con feature di testa + if vMachineBeforeIntersectingDrillings.Head.Id then + _, _, vDistHead = EgtLineSurfTmInters( ptCen, -vtExtr, vMachineBeforeIntersectingDrillings.Head.Id, GDB_RT.GLOB) + end + -- check intersezione con feature di coda + if vMachineBeforeIntersectingDrillings.Tail.Id then + _, _, vDistTail = EgtLineSurfTmInters( ptCen, -vtExtr, vMachineBeforeIntersectingDrillings.Tail.Id, GDB_RT.GLOB) + end -- se esiste intersezione tra il foro e la feature di testa - if #vDistHead > 0 then + if vDistHead and #vDistHead > 0 then -- verifico che il foro sia di testa if ( bOpen or ( not bOpen and vtExtr:getX() > 0)) then vProc[i].MachineAfterHeadCutId = vMachineBeforeIntersectingDrillings.Head.Id vProc[i].Head = true end -- se esiste intersezione tra il foro e la feature di coda - elseif #vDistTail > 0 then + elseif vDistTail and #vDistTail > 0 then -- verifico che il foro sia di coda if ( bOpen or ( not bOpen and vtExtr:getX() < 0)) then vProc[i].MachineAfterTailCutId = vMachineBeforeIntersectingDrillings.Tail.Id diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index 12f5130..e268770 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -9,6 +9,7 @@ -- 2022/04/21 DS Corretto riconoscimento fori di coda. -- 2022/06/22 Nel riconoscimento fori di coda si utilizza ora il reale sovramateriale di coda (dOvmTail) invece di BD.OVM_MID. -- 2022/07/01 Aggiunta gestione allungamento percorsi fori in caso di materiale già rimosso da lavorazioni precedenti +-- 2022/07/07 Aggiunta la gestione delle forature migliorate in presenza di feature testa/coda che tagliano tutta la sezione; gli Id delle feature sono nelle proprietà MachineAfterHeadCutId e MachineAfterTailCutId. -- Tabella per definizione modulo local ProcessDrill = {} @@ -311,6 +312,8 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) EgtOutLog( sErr) return false, sErr end + -- conservo il valore originale di MaxDepth per poter eventualmente bypassare i check successivi + local dMaxDepthOri = dMaxDepth -- verifico il massimo affondamento local dSubL1 = 0 local dSubL2 = 0 @@ -319,8 +322,6 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) -- se foro non su testa o coda e inclinato local bInMid = false local bInvertFcse = ( bToInvert and Proc.Flg ~= -2) - -- tengo via il valore originale di MaxDepth per poter eventualmente bypassare i check successivi - local dMaxDepthOri = dMaxDepth if ( not bInvertFcse and Proc.Fcs ~= 5 and Proc.Fcs ~= 6) or ( bInvertFcse and Proc.Fce ~= 5 and Proc.Fce ~= 6) then bInMid = true local CosB = abs( vtExtr:getX()) @@ -422,6 +423,10 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth - dToolAddLength, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')' dDepth = dLen else + -- se è un foro splittato cerco comunque di arrivare alla massima profondità possibile, evitando di sfondare dall'altro lato. + if Proc.Flg == 2 or Proc.Flg == -2 then + dDepth = dLen - 10 + end -- se non lavoro la massima lunghezza disponibile devo correggere MaxElev dMaxElev = dMaxElev - dLen + dDepth end From e22bc6bd19a210bcb66f92fd9a9c43d54032d596 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Fri, 8 Jul 2022 15:01:26 +0200 Subject: [PATCH 17/17] Feature/DrillingsOnHeadOrTailCut: in SetDrillingsToMachineAfterHeadOrTailCut (BeamExec) corretto di nuovo check intersezione fori --- LuaLibs/BeamExec.lua | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index da0d99d..85a0666 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -1331,23 +1331,37 @@ local function SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeInt local vDistHead, vDistTail -- check intersezione con feature di testa if vMachineBeforeIntersectingDrillings.Head.Id then - _, _, vDistHead = EgtLineSurfTmInters( ptCen, -vtExtr, vMachineBeforeIntersectingDrillings.Head.Id, GDB_RT.GLOB) + -- verifico che ci sia intersezione tra la feature foro e la feature taglio di testa + local bIntersectionWithHead = + vMachineBeforeIntersectingDrillings.Head.Box and vProc[i].Box:getMin():getX() < vMachineBeforeIntersectingDrillings.Head.Box:getMax():getX() + 100 * GEO.EPS_SMALL and + vMachineBeforeIntersectingDrillings.Head.Box:getMin():getX() < vProc[i].Box:getMax():getX() + 100 * GEO.EPS_SMALL + -- verifico che ci sia intersezione tra la direzione di estrusione e la faccia della feature taglio di testa + if bIntersectionWithHead then + _, _, vDistHead = EgtLineSurfTmInters( ptCen, -vtExtr, vMachineBeforeIntersectingDrillings.Head.Id, GDB_RT.GLOB) + end end -- check intersezione con feature di coda if vMachineBeforeIntersectingDrillings.Tail.Id then - _, _, vDistTail = EgtLineSurfTmInters( ptCen, -vtExtr, vMachineBeforeIntersectingDrillings.Tail.Id, GDB_RT.GLOB) + -- verifico che ci sia intersezione tra la feature foro e la feature taglio di coda + local bIntersectionWithTail = + vMachineBeforeIntersectingDrillings.Tail.Box and vProc[i].Box:getMin():getX() < vMachineBeforeIntersectingDrillings.Tail.Box:getMax():getX() + 100 * GEO.EPS_SMALL and + vMachineBeforeIntersectingDrillings.Tail.Box:getMin():getX() < vProc[i].Box:getMax():getX() + 100 * GEO.EPS_SMALL + -- verifico che ci sia intersezione tra la direzione di estrusione e la faccia della feature taglio di coda + if bIntersectionWithTail then + _, _, vDistTail = EgtLineSurfTmInters( ptCen, -vtExtr, vMachineBeforeIntersectingDrillings.Tail.Id, GDB_RT.GLOB) + end end -- se esiste intersezione tra il foro e la feature di testa if vDistHead and #vDistHead > 0 then -- verifico che il foro sia di testa - if ( bOpen or ( not bOpen and vtExtr:getX() > 0)) then + if ( bOpen or ( not bOpen and vtExtr:getX() > 0 and vProc[i].Fcs ~= 0) or ( not bOpen and vtExtr:getX() < 0 and vProc[i].Fce ~= 0)) then vProc[i].MachineAfterHeadCutId = vMachineBeforeIntersectingDrillings.Head.Id vProc[i].Head = true end -- se esiste intersezione tra il foro e la feature di coda elseif vDistTail and #vDistTail > 0 then -- verifico che il foro sia di coda - if ( bOpen or ( not bOpen and vtExtr:getX() < 0)) then + if ( bOpen or ( not bOpen and vtExtr:getX() < 0 and vProc[i].Fcs ~= 0) or ( not bOpen and vtExtr:getX() > 0 and vProc[i].Fce ~= 0)) then vProc[i].MachineAfterTailCutId = vMachineBeforeIntersectingDrillings.Tail.Id vProc[i].Tail = true end