diff --git a/BatchProcessNew.lua b/BatchProcessNew.lua index a9d33f7..06de795 100644 --- a/BatchProcessNew.lua +++ b/BatchProcessNew.lua @@ -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 diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index e302e21..ec287c7 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -309,7 +309,7 @@ local function IsCombinationAvailable( sCombination, nUnloadPos, bSquareSection) end ------------------------------------------------------------------------------------------------------------- -local function GetAvailableCombinations( PartInfo) +function BeamExec.GetAvailableCombinations( PartInfo) local CombinationList = {} CombinationList.Rotations = {0, 0, 0, 0} -- indice rotazione attiva, per calcolo collect feature