- modificato nesting semplice per cabinet. Ora si assegna il nome del PDN del pezzo. Se presenti multipli, si aggiunge il contatore del multiplo al PDN.

This commit is contained in:
luca.mazzoleni
2025-08-28 14:44:41 +02:00
parent a449af35d9
commit 7775fa75fc
+37 -5
View File
@@ -1684,10 +1684,11 @@ NEST.ERR = 0
EgtResetCurrMachGroup()
-- modalità nesting utile per cabinet: un grezzo per ogni pezzo, pezzo centrato nel grezzo. Il grezzo non viene preso da magazzino ma creato ad hoc, con un dato sovramateriale.
-- il numero del MachGroup deve coincidere con il PDN del pezzo originale
if WD.ENABLE_SIMPLE_NESTING then
-- sovramateriale richiesto
local dOverMaterial = max( 0, NEST.KERF or 2.5)
local dOverMaterial = max( 0, NEST.KERF or 2)
-- inizializzazione parametri per creazione grezzo tramite BatchProcessNew
_G.WALL = {}
@@ -1697,8 +1698,31 @@ if WD.ENABLE_SIMPLE_NESTING then
WALL.FLAG = 6 -- CREATE_PANEL
WALL.NESTING_REF = 'BL'
-- per ogni singolo pezzo si creano duplo e machgroup e si settano le note opportune per poi creare i grezzi richiamando la BatchProcessNew (flag 6)
-- si ricrea la lista pezzi ordinata
local PartList = {}
local nPartCounter = 0
for nPartId, nCount in pairs( PART) do
nPartCounter = nPartCounter + 1
PartList[nPartCounter] = {}
PartList[nPartCounter].nId = nPartId
PartList[nPartCounter].nCount = nCount
PartList[nPartCounter].nPdn = EgtGetInfo( nPartId, "PDN", 'i')
PartList[nPartCounter].bAddCounterToNaming = false
-- se presente un pezzo con multipli il PDN sarà seguito da un contatore
if nCount > 1 then
PartList[nPartCounter].bAddCounterToNaming = true
end
end
-- si riordina in base al PDN
table.sort( PartList, function(a, b) return tonumber( a.nPdn) < tonumber( b.nPdn) end)
-- per ogni singolo pezzo si creano duplo e machgroup e si settano le note opportune per poi creare i grezzi richiamando la BatchProcessNew (flag 6)
for i = 1, #PartList do
local nPartId = PartList[i].nId
local nPartCount = PartList[i].nCount
local nPdn = PartList[i].nPdn
local bAddCounterToNaming = PartList[i].bAddCounterToNaming
-- informazioni dalla parte originale
-- box e relative dimensioni
@@ -1713,11 +1737,19 @@ if WD.ENABLE_SIMPLE_NESTING then
local dRawLength = b3Part:getDimX() + 2 * dOverMaterial
local dRawWidth = b3Part:getDimY() + 2 * dOverMaterial
for _ = 1, nCount do
for j = 1, nPartCount do
-- creazione gruppo di lavoro
local sMachGroupName = max( 1000, NewMachGroupName())
local sMachGroupName = nPdn
if bAddCounterToNaming then
sMachGroupName = nPdn .. '_' .. string.format("%02d", j)
end
local nMachGroupId = EgtAddMachGroup( sMachGroupName)
if not nMachGroupId then
EgtOutLog( "Errore: MachGroup " .. nPdn .. " già presente")
EgtOutBox( 'Error : MachGroup ' .. nPdn .. ' already existing', 'Nesting failed')
NEST.ERR = 2
return
end
-- settaggio note in gruppo di lavoro
EgtSetInfo( nMachGroupId, "PANELLEN", dRawLength)
EgtSetInfo( nMachGroupId, "PANELWIDTH", dRawWidth)