Se è presente squadratura, si cancellano tutti i VMILL esterni al box della squadratura

This commit is contained in:
andrea.villa
2024-11-07 11:58:57 +01:00
parent 9e1ce21278
commit acd721ded9
2 changed files with 40 additions and 16 deletions
+38 -14
View File
@@ -490,6 +490,27 @@ function ExecScrapRemove()
-- salvo i dati
table.insert( vVmPart, { Box = b3VmPart, BoxExp = b3VmPartExp, Area = dVmPartArea})
end
-- se presente squadratura, tengo tutti i pezzi all'interno
local nRawId = EgtGetFirstRawPart()
local SquaringEntities = {}
SquaringEntities = EgtGetNameInGroup( nRawId, 'SquaringGeometry')
local b3SquaringBox = nil
if SquaringEntities then
for i = 1, #SquaringEntities do
if i == 1 then
b3SquaringBox = EgtGetBBoxGlob( SquaringEntities[i], GDB_BB.STANDARD)
else
if b3SquaringBox then
b3SquaringBox:Add( EgtGetBBoxGlob( SquaringEntities[i], GDB_BB.STANDARD))
end
end
end
if b3SquaringBox then
b3SquaringBox:expand( 50)
end
end
-- Tengo solo le parti del Vmill che contengono almeno un box di un pezzo o che interferiscono e sono abbastanza grandi
local nValidCnt = 0
for i = #vVmPart, 1, -1 do
@@ -497,21 +518,24 @@ function ExecScrapRemove()
local bToRemove = true
-- se area abbastanza grande, allora da verificare
if vVmPart[i].Area > 1e4 then
-- verifico se sono sicuramente valide (i due box si equivalgono entro la tolleranza)
for j = 1, #vPart do
if ( vPart[j].Outline and vVmPart[i].Area > 0.95 * vPart[j].Area and vVmPart[i].Area < 1.05 * vPart[j].Area) or
( EnclosesXY( vVmPart[i].BoxExp, vPart[j].Box) and EnclosesXY( vPart[j].BoxExp, vVmPart[i].Box)) then
bToRemove = false
vVmPart[i].Part = j
nValidCnt = nValidCnt + 1
break
-- se presente squadratura, verifico che il VMILL sia all'interno del BOX squadratura
if not b3SquaringBox or EnclosesXY( b3SquaringBox, vVmPart[i].Box) then
-- verifico se sono sicuramente valide (i due box si equivalgono entro la tolleranza)
for j = 1, #vPart do
if ( vPart[j].Outline and vVmPart[i].Area > 0.95 * vPart[j].Area and vVmPart[i].Area < 1.05 * vPart[j].Area) or
( EnclosesXY( vVmPart[i].BoxExp, vPart[j].Box) and EnclosesXY( vPart[j].BoxExp, vVmPart[i].Box)) then
bToRemove = false
vVmPart[i].Part = j
nValidCnt = nValidCnt + 1
break
end
end
end
-- verifico se sono molto probabilmente valide
for j = 1, #vPart do
if bToRemove and ( OverlapsXY( vVmPart[i].Box, vPart[j].Box) and vVmPart[i].Area > 0.25 * vPart[j].Area) then
bToRemove = false
break
-- verifico se sono molto probabilmente valide
for j = 1, #vPart do
if bToRemove and ( OverlapsXY( vVmPart[i].Box, vPart[j].Box) and vVmPart[i].Area > 0.25 * vPart[j].Area) then
bToRemove = false
break
end
end
end
end
+2 -2
View File
@@ -15,8 +15,8 @@
require( 'EmtGenerator')
EgtEnableDebug( false)
PP_VER = '2.6i3'
PP_NVER = '2.6.9.3'
PP_VER = '2.6k1'
PP_NVER = '2.6.11.1'
-- Parametri macchina
NumericalControl = 'TPA' -- NUM o TPA