- piccole correzioni a WallExec

- in LapJoint -> MakeByPocketing aggiunta forzatura tasche chiuse se la lavorazione potrebbe danneggiare  i pezzi limitrofi
This commit is contained in:
luca.mazzoleni
2023-08-23 12:24:45 +02:00
parent 4a5c213de6
commit 756d58b3e4
3 changed files with 96 additions and 7 deletions
+90
View File
@@ -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