Aggiunta gestione squadratura. Default disabilitata da WallData

This commit is contained in:
andrea.villa
2024-11-18 16:25:10 +01:00
parent d50be997e0
commit 2cd3f0c26d
3 changed files with 62 additions and 16 deletions
+2 -2
View File
@@ -9,8 +9,8 @@
require( 'EmtGenerator')
EgtEnableDebug( false)
PP_VER = '2.6i1'
PP_NVER = '2.6.9.1'
PP_VER = '2.6k1'
PP_NVER = '2.6.11.1'
MIN_MACH_VER = '2.6h1'
-- Parametri macchina
+53 -14
View File
@@ -497,12 +497,20 @@ function ExecScrapRemove()
-- box e area
local b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
local dPartArea = b3Part:getDimX() * b3Part:getDimY()
local nOlEntId = EgtGetFirstInGroup( EgtGetFirstNameInGroup( nPartId, 'Outline') or GDB_ID.NULL)
while nOlEntId do
if EgtGetType( nOlEntId) == GDB_TY.SRF_FRGN and EgtSurfFrNormVersor( nOlEntId, GDB_ID.ROOT):getZ() > 0.8 then
dPartArea = EgtSurfArea( nOlEntId)
break
end
nOlEntId = EgtGetNext( nOlEntId)
end
-- box espanso
local b3PartExp = BBox3d( b3Part)
b3PartExp:Add( b3PartExp:getMin() - Vector3d( 10, 10, 0))
b3PartExp:Add( b3PartExp:getMax() + Vector3d( 10, 10, 0))
-- salvo i dati
table.insert( vPart, { Box = b3Part, BoxExp = b3PartExp, Area = dPartArea})
table.insert( vPart, { Box = b3Part, BoxExp = b3PartExp, Area = dPartArea, Outline = nOlEntId})
-- passo al successivo
nPartId = EgtGetNextPartInRawPart( nPartId)
end
@@ -519,6 +527,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
@@ -526,20 +555,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 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.49 * 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
@@ -602,6 +635,12 @@ function ExecScrapRemove()
bToRemove = false
break
end
-- controllo per gestire squadratura inserita manualmente da operatore
-- verifico se il box del part è completamente incluso nel box del VM, allora non posso cancellarlo
if Encloses( vVmPart[i].BoxExp, vPart[j].Box) then
bToRemove = false
break
end
end
for k = 1, #vVmPart do
if k ~= i then
+7
View File
@@ -39,6 +39,13 @@ local WallData = {
DELTA_Y = 0, -- allontanamento in Y dai riferimenti
RAWPART_ROT = 0, -- rotazione del pannello grezzo rispetto alla descrizione BTL
CUT_WITH_OUTLINE = true, -- taglio delle feature con l'outline del pezzo
SQUARING_TYPE = 0, -- master panel squaring: 0 = disabled, 1 = on rawpart, 2 = shrink to parts
SQUARING_TOOL = 0, -- 0 = auto, 1 = double diskmill, 2 = double diskmill+blade, 3 = double blade, 4 = diskmill, 5 = blade, 6 = double mill, 7 = mill
SQUARING_USE_ZIGZAG = true, -- false = oneway, true = zigzag. For mill only
SQUARING_STARTS_ON_REFERENCE = false, -- false = squaring starts near machine parking, true = squaring starts on reference edge
SQUARING_OFFSET_XY = 0, -- > 0 = larger rectangle, < 0 = smaller rectangle. Only with squaring on rawpart
SQUARING_EXTEND_Z = 0, -- > 0 = squaring extends below Z0, < 0 = squaring stops above Z0
SQUARING_MAX_OVERMATERIAL = 40, -- max overmaterial before squaring
}
-- Aggiornamento con dati da TechnoEssetre7