In BatchProcessNew, si ricavano tutte le informazioni dei pezzi nestati nella barra

This commit is contained in:
andrea.villa
2025-04-29 12:53:19 +02:00
parent 3e2541bd87
commit 81ab09a122
2 changed files with 47 additions and 4 deletions
+46 -3
View File
@@ -261,8 +261,8 @@ if bToProcess then
local b3Raw = EgtGetRawPartBBox( nRawId)
-- Calcolo posizione estremo TR o BR della tavola rispetto a sua origine in BL
local dPosY = EgtIf( BeamData.CENTER_BEAM, ( b3Tab:getDimY() + b3Raw:getDimY() * EgtIf( BeamData.RIGHT_LOAD, -1, 1)) / 2, EgtIf( BeamData.RIGHT_LOAD, 0, b3Tab:getDimY()))
BeamData.OriXR = Point3d( b3Tab:getDimX(), dPosY, 0)
BeamData.PosXR = EgtIf( BeamData.RIGHT_LOAD, MCH_CR.BR, MCH_CR.TR)
BeamData.ptOriXR = Point3d( b3Tab:getDimX(), dPosY, 0)
BeamData.dPosXR = EgtIf( BeamData.RIGHT_LOAD, MCH_CR.BR, MCH_CR.TR)
-- Calcolo minimo grezzo scaricabile
BeamExec.CalcMinUnloadableRaw( b3Raw:getDimY(), b3Raw:getDimZ())
-- altrimenti devo recuperare i pezzi per creare la barra
@@ -489,7 +489,50 @@ if bToProcess then
if not vVal or #vVal < 2 then break end
local nPartId = tonumber( vVal[1])
local dPosX = tonumber( vVal[2])
table.insert( PARTS, { id = nPartId, dPosX = dPosX, sName = ( EgtGetName( nPartId) or ( 'Id=' .. tonumber( nPartId)))})
table.insert( PARTS, { nInd = #PARTS + 1, id = nPartId, dPosX = dPosX, sName = ( EgtGetName( nPartId) or ( 'Id=' .. tonumber( nPartId)))})
end
-- se lunghezza barra non settata, la leggo ora
if not dBarLen then
dBarLen = EgtGetInfo( nMGrpId, 'BARLEN', 'd')
end
-- Recupero tutte le informazioni dei pezzi
local dLen = dBarLen
for i = 1, #PARTS do
-- aggiorno grezzo precedente
PARTS[i].idRaw = EgtGetRawPartFromPart( PARTS[i].id)
PARTS[i].bIsLastPart = ( i == #PARTS)
-- dimensioni del grezzo ( comprende sovramateriale di testa e lavorazione di coda per separazione)
PARTS[i].b3Raw = EgtGetRawPartBBox( PARTS[i].idRaw)
PARTS[i].dRawLength = PARTS[i].b3Raw:getDimX()
PARTS[i].dRawWidth = PARTS[i].b3Raw:getDimY()
PARTS[i].dRawHeight = PARTS[i].b3Raw:getDimZ()
-- dimensione pezzo finito
PARTS[i].b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[i].id, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
PARTS[i].dLength = PARTS[i].b3Part:getDimX()
PARTS[i].dWidth = PARTS[i].b3Part:getDimY()
PARTS[i].dHeight = PARTS[i].b3Part:getDimZ()
PARTS[i].bSquareSection = abs( PARTS[i].dWidth - PARTS[i].dHeight) < 100 * GEO.EPS_SMALL
PARTS[i].nIndexInParts = i
PARTS[i].CombinationList = BeamExec.GetAvailableCombinations( PARTS[i])
PARTS[i].SplittingPoints = BeamLib.GetPartSplittingPoints( PARTS[i])
-- sovramateriale in testa al pezzo
local dDeltaS = max( PARTS[i].dPosX - ( dBarLen - dLen), 0)
-- lunghezza grezzo (comprende sovramateriale di testa e mm tagliati in coda dalla lavorazione, tipicamente 5.4mm dello spessore lama)
local dCrawLen = PARTS[i].dRawLength
-- materiale tolto in coda dalla lavorazione di separazione
local dDeltaE = dCrawLen - PARTS[i].dLength - dDeltaS
local dDeltaNextPiece
if PARTS[i+1] then
dDeltaNextPiece = PARTS[i+1].dPosX - ( dBarLen - dLen) - dCrawLen + dDeltaE
else
dDeltaNextPiece = 10000
end
PARTS[i].dDistanceToNextPiece = dDeltaNextPiece
-- aggiorno la lunghezza residua della barra
dLen = dLen - dCrawLen
PARTS[i].dRestLength = dLen
end
end