- in NestProcess correzione bug

This commit is contained in:
luca.mazzoleni
2026-05-18 16:40:58 +02:00
parent b79617fbe4
commit 974d1abb41
+66 -5
View File
@@ -9,6 +9,24 @@ EgtEnableDebug( false)
-- Include
local BeamData = require( 'BeamDataNew')
-- Imposto direttorio libreria specializzata per Travi
EgtAddToPackagePath( NEST.BASEDIR .. '\\LuaLibs\\?.lua')
-- Imposto la macchina corrente e verifico sia abilitata per la lavorazione delle Travi
EgtSetCurrMachine( NEST.MACHINE)
local sMachDir = EgtGetCurrMachineDir()
if not EgtExistsFile( sMachDir .. '\\Beam\\BeamData.lua') then
NEST.ERR = 12
NEST.MSG = 'Error : machine' .. sMachine .. 'note configured for Beam'
WriteErrToLogFile( NEST.ERR, NEST.MSG)
PostErrView( NEST.ERR, NEST.MSG)
return
end
-- Elimino direttori altre macchine e imposto direttorio macchina corrente per ricerca librerie
EgtRemoveBaseMachineDirFromPackagePath()
EgtAddToPackagePath( sMachDir .. '\\Beam\\?.lua')
----------------------------------------------------------------------------------------------------------
-- Parametri di configurazione Nesting
@@ -323,7 +341,7 @@ local function CalculateMove( Beam, dPartLength, sState, State)
dEfficiency = dUltimateUsed / Beam.dTotalLength
-- barra avviata: efficienza reale
else
dEfficiency = dPartLength / ( dPartLength + dFutureResidualLength)
dEfficiency = dPartLength / ( dPartLength - dSafeOverlap)
end
local dNormalizedLength = dPartLength / dMaxJobLength
local dLengthScore = dNormalizedLength * ( 1 - dGlobalProgress) * 1000
@@ -558,7 +576,7 @@ end
-- creazione MachGroup e Duplo
for i = 1, #RawInventory.ActiveBeams do
local dOffset = NEST.STARTOFFSET or 0
local dStartOffset = NEST.STARTOFFSET or 0
local Beam = RawInventory.ActiveBeams[i]
-- creazione MachGroup
@@ -573,12 +591,55 @@ for i = 1, #RawInventory.ActiveBeams do
EgtSetInfo( idMachGroup, "PATTID", idMachGroup)
-- Spostamento pezzi verso la testa della barra e aggiunta duplo
for j = 1, Beam.NestedParts do
local nIndex = 1
for j = #Beam.NestedParts, 1, -1 do
local Part = Beam.NestedParts[j]
Part.dPosX = Part.dPosX - Beam.dResidualLength + dOffset
-- spostamento verso la testa della barra
local dPosX = Part.dPosX - Beam.dResidualLength + dStartOffset
-- copia del pezzo (aggiunta duplo)
local idDuplo = EgtDuploNew( Part.id)
EgtSetInfo( idMachGroup, "PART" .. j, idDuplo .. "," .. Part.dPosX)
-- assegnazione info
EgtSetInfo( idMachGroup, "PART" .. nIndex, idDuplo .. "," .. dPosX)
nIndex = nIndex + 1
end
end
-- creazione grezzi per ogni MachGroup (si chiama la BatchProcess in modalità creazione barra)
local nRawCounter = 0
local nTotalRaws = #RawInventory.ActiveBeams
-- variabili per BatchProcess
_G.BEAM = {}
BEAM.FILE = NEST.FILE
BEAM.MACHINE = NEST.MACHINE
BEAM.FLAG = 6 -- CREATE_PANEL
BEAM.BASEDIR = NEST.BASEDIR
-- per ogni MachGroup si chiama la BatchProcess pe creare il grezzo
local idMachGroup = EgtGetFirstMachGroup()
while idMachGroup do
local nNextMachGroup = EgtGetNextMachGroup( idMachGroup)
EgtSetCurrMachGroup( idMachGroup)
if EgtGetInfo( idMachGroup, "AUTONEST",'i') == 1 then
EgtRemoveInfo( idMachGroup, "AUTONEST")
EgtSetInfo( idMachGroup, "UPDATEUI", 1)
local bOk, sErr = pcall( dofile, BEAM.BASEDIR .. "\\BatchProcessNew.lua")
if not bOk then
EgtOutLog( 'Error in BatchProcessNew.lua call (' .. ( sErr or '') ..')')
end
nRawCounter = nRawCounter + 1
-- aggiorno interfaccia
EgtProcessEvents( 200 + ( nRawCounter / nTotalRaws * 100), 0)
end
idMachGroup = nNextMachGroup
end
EgtResetCurrMachGroup()
NEST.ERR = 0
-- calcolo bontà soluzione
RawInventory:PrintDiagnosticReport()