diff --git a/LuaLibs/WFeatureTopology.lua b/LuaLibs/WFeatureTopology.lua index afe47bb..ec07b2f 100644 --- a/LuaLibs/WFeatureTopology.lua +++ b/LuaLibs/WFeatureTopology.lua @@ -157,7 +157,7 @@ local function GetTopologyLongName( sFamily, bIsThrough, bAllRightAngles, bIsPar end --------------------------------------------------------------------- --- risonosce se Proc è una delle topologie standard e, in caso positivo, ne scrive le caratteristiche in campi specifici della Proc stessa restituendo true +-- riconosce se Proc è una delle topologie standard e, in caso positivo, ne scrive le caratteristiche in campi specifici della Proc stessa restituendo true function WFeatureTopology.Classify( Proc) local bRecognized = false local sFamily diff --git a/LuaLibs/WProcessLapJoint.lua b/LuaLibs/WProcessLapJoint.lua index b04d9ce..513c569 100644 --- a/LuaLibs/WProcessLapJoint.lua +++ b/LuaLibs/WProcessLapJoint.lua @@ -1326,6 +1326,82 @@ local function MakeByChainSaw( Proc, nFacet, nRawId, b3Raw, dElev, dH, dV) return true end +--------------------------------------------------------------------- +-- restituisce true se la lavorazione potrebbe danneggiare le parti limitrofe; restituisce anche i lati interessati +local function IsMachiningDamagingOtherParts( Proc, dMillDiameter, nRawId) + local bIsMachiningDamagingOtherParts = false + local vtSidesOverlapped = { Front = false, Back = false, Left = false, Right = false} + -- box esteso in tutte le direzioni + local b3ProcExtended = EgtGetBBoxGlob( Proc.Id, GDB_BB.STANDARD) + -- box estesi solo nelle rispettive direzioni + local b3ProcExtendedLeft = EgtGetBBoxGlob( Proc.Id, GDB_BB.STANDARD) + local b3ProcExtendedRight = EgtGetBBoxGlob( Proc.Id, GDB_BB.STANDARD) + local b3ProcExtendedFront = EgtGetBBoxGlob( Proc.Id, GDB_BB.STANDARD) + local b3ProcExtendedBack = EgtGetBBoxGlob( Proc.Id, GDB_BB.STANDARD) + -- punto minimo e massimo assoluti del box + local ptMin = b3ProcExtended:getMin() + local ptMax = b3ProcExtended:getMax() + -- punti di massima estensione dei box delle singole direzioni + local ptLeft = b3ProcExtended:getMin() + local ptRight = b3ProcExtended:getMax() + local ptFront = b3ProcExtended:getMin() + local ptBack = b3ProcExtended:getMax() + -- estensione aggiunta ai box + local dBoxExtensionLength = dMillDiameter / 2 + 10 + -- check box verso X- + if Proc.AffectedFaces.Left then + local vtMove = Vector3d( -dBoxExtensionLength, 0, 0) + ptMin:move( vtMove) + ptLeft:move( vtMove) + b3ProcExtendedLeft:Add( ptLeft) + end + -- check box verso X+ + if Proc.AffectedFaces.Right then + local vtMove = Vector3d( dBoxExtensionLength, 0, 0) + ptMax:move( vtMove) + ptRight:move( vtMove) + b3ProcExtendedRight:Add( ptRight) + end + -- check box verso Y- + if Proc.AffectedFaces.Front then + local vtMove = Vector3d( 0, -dBoxExtensionLength, 0) + ptMin:move( vtMove) + ptFront:move( vtMove) + b3ProcExtendedFront:Add( ptFront) + end + -- check box verso Y+ + if Proc.AffectedFaces.Back then + local vtMove = Vector3d( 0, dBoxExtensionLength, 0) + ptMax:move( vtMove) + ptBack:move( vtMove) + b3ProcExtendedBack:Add( ptBack) + end + -- estendo il box in direzione X e Y e verifico se interseca altre parti + b3ProcExtended:Add( ptMin) + b3ProcExtended:Add( ptMax) + local nPartId = EgtGetFirstPartInRawPart( nRawId) + while nPartId do + local b3Part = EgtGetBBoxGlob( nPartId or GDB_ID.NULL, GDB_BB.STANDARD) + if ( nPartId ~= Proc.PartId) and OverlapsXY( b3ProcExtended, b3Part) then + bIsMachiningDamagingOtherParts = true + end + if ( nPartId ~= Proc.PartId) and OverlapsXY( b3ProcExtendedLeft, b3Part) then + vtSidesOverlapped.Left = true + end + if ( nPartId ~= Proc.PartId) and OverlapsXY( b3ProcExtendedRight, b3Part) then + vtSidesOverlapped.Right = true + end + if ( nPartId ~= Proc.PartId) and OverlapsXY( b3ProcExtendedFront, b3Part) then + vtSidesOverlapped.Front = true + end + if ( nPartId ~= Proc.PartId) and OverlapsXY( b3ProcExtendedBack, b3Part) then + vtSidesOverlapped.Back = true + end + nPartId = EgtGetNextPartInRawPart( nPartId) + end + return bIsMachiningDamagingOtherParts, vtSidesOverlapped +end + --------------------------------------------------------------------- local function MakeByMill( Proc, nFacet, nOthFac, nRawId, b3Raw, dSideDist) -- dati della faccia e dell'altra @@ -2247,6 +2323,18 @@ local function MakeByPocketing( Proc, nFacet, nRawId, b3Raw, bCheckQPar) dThDiam = EgtTdbGetCurrToolThDiam() or dThDiam end end + -- verifico se la lavorazione (o il suo eventuale doppio) potrebbe danneggiare le parti limitrofe e devo quindi forzare una tasca chiusa + local bForceClosedPocket = false + if WD.AVOID_DAMAGING_OTHER_PARTS then + if IsMachiningDamagingOtherParts( Proc, dMillDiam, nRawId) then + bForceClosedPocket = true + end + if Proc.Double and Proc.Double > 0 then + if IsMachiningDamagingOtherParts( Proc.Mirror, dMillDiam, nRawId) then + bForceClosedPocket = true + end + end + end -- inserisco la lavorazione di svuotatura local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local nMchFId = WM.AddMachining( Proc, sName, sPocketing) @@ -2288,6 +2376,8 @@ local function MakeByPocketing( Proc, nFacet, nRawId, b3Raw, bCheckQPar) sUserNotes = EgtSetValInNotes( sUserNotes, 'MirrorAx', Proc.MirrorAx) sUserNotes = EgtSetValInNotes( sUserNotes, 'DeltaZ', Proc.MirrorDeltaZ) end + -- setto eventuale nota per forzare tasca chiusa + if bForceClosedPocket then sUserNotes = EgtSetValInNotes( sUserNotes, 'Open', 0) end -- scrivo le note della lavorazione EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo diff --git a/LuaLibs/WallExec.lua b/LuaLibs/WallExec.lua index 5a00a45..b01db2f 100644 --- a/LuaLibs/WallExec.lua +++ b/LuaLibs/WallExec.lua @@ -672,7 +672,7 @@ local function SetMirroredFeatures( vProc, b3Raw) -- raccolgo le tasche compatibili if WD.DOUBLE_HEAD_POCKET and ( - ( Proc.TopologyLongName == 'Rabbet-Through-RightAngles-Parallel-2' and ( Proc.AffectedFaces.Front or Proc.AffectedFaces.Back)) or + ( Proc.TopologyLongName == 'Rabbet-Through-RightAngles-Parallel-2' and Proc.AffectedFaces.Left and Proc.AffectedFaces.Right) or ( Proc.TopologyLongName == 'Groove-Through-RightAngles-Parallel-3' and ( not Proc.AffectedFaces.Bottom and Proc.AffectedFaces.Left and Proc.AffectedFaces.Right)) or ( Proc.TopologyLongName == 'Groove-Blind-RightAngles-Parallel-3') or ( Proc.TopologyLongName == 'Groove-Blind-RightAngles-Parallel-4') or @@ -699,7 +699,7 @@ local function SetMirroredFeatures( vProc, b3Raw) table.sort( vPockets, SortFeaturesForMirror) table.sort( vDrillings, SortFeaturesForMirror) - -- accoppio le groove passanti rivolte verso Z+ + -- accoppio le tasche local nCurrentPocket = 1 while nCurrentPocket <= #vPockets do local Proc = vPockets[nCurrentPocket] @@ -808,7 +808,7 @@ local function SetMirroredFeatures( vProc, b3Raw) -- scrivo i parametri nella lavorazione -- 2: specchiatura in Y Proc.Double = 2 - Proc.MirrorId = ProcMirror.Id + Proc.Mirror = ProcMirror -- posizione Y dell'asse di specchiatura Proc.MirrorAx = dYMirrorAx -- Offset Z tra le feature @@ -861,7 +861,7 @@ local function SetMirroredFeatures( vProc, b3Raw) -- scrivo i parametri nella lavorazione -- 2: specchiatura in Y Proc.Double = 2 - Proc.MirrorId = ProcMirror.Id + Proc.Mirror = ProcMirror -- posizione Y dell'asse di specchiatura Proc.MirrorAx = dYMirrorAx -- rimuovo dalla lista le groove già assegnate @@ -944,7 +944,6 @@ function WallExec.ProcessFeatures() ------- -- LAVORAZIONI IN DOPPIO - QUI INSERIRE: - -- ELIMINAZIONE LAVORAZIONI MIRROR IN BASE A SETTAGGIO MACHININGTODELETE IN PROC -- VERIFICA E UPDATE NOTE PER LAVORAZIONI IN CUI SI CONTROLLA SE I PERCORSI SONO SPECCHIATI ------- -- setto quali sono le lavorazioni da disattivare perchè specchiate di lavorazioni in doppio @@ -954,7 +953,7 @@ function WallExec.ProcessFeatures() if Proc.Double and Proc.Double > 0 then for j = 1, #vProc do local ProcMirror = vProc[j] - if Proc.MirrorId == ProcMirror.Id then + if Proc.Mirror.Id == ProcMirror.Id then -- per i fori l'operazione si basa sulla geometria ausiliaria if Proc.TopologyLongName == 'DRILLING' then local AuxId = EgtGetInfo( ProcMirror.Id, 'AUXID', 'i') or 0