From 1ed912ebfd3ddfc320205a091cbb4c575f90dde6 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 9 Feb 2026 12:58:36 +0100 Subject: [PATCH] - in batchProcess modifiche per lettura part offset da btl --- BatchProcess.lua | 65 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 2 deletions(-) diff --git a/BatchProcess.lua b/BatchProcess.lua index 04ad952..316dc5b 100644 --- a/BatchProcess.lua +++ b/BatchProcess.lua @@ -241,7 +241,11 @@ if bToProcess then EgtEraseFile( sNgeFile) -- eseguo import EgtNewFile() - if not EgtImportBtl( BEAM.FILE, EIB_FL.TS3_POS + EIB_FL.USEUATTR) then + local nBtlFlag = EIB_FL.TS3_POS + EIB_FL.USEUATTR + if BD.USE_PART_OFFSET then + nBtlFlag = nBtlFlag + EIB_FL.PARTOFFSET + end + if not EgtImportBtl( BEAM.FILE, nBtlFlag) then BEAM.ERR = 13 BEAM.MSG = 'Error importing BTL file : ' .. BEAM.FILE WriteErrToLogFile( BEAM.ERR, BEAM.MSG) @@ -381,7 +385,7 @@ if bToProcess then end end - -- Verifico sezione barra non troppo piccola + -- Verifico sezione barra non troppo piccola if dRawW < BD.MIN_WIDTH - 10 * GEO.EPS_SMALL or dRawH < BD.MIN_HEIGHT - 10 * GEO.EPS_SMALL then local sOut = 'Sezione (' .. EgtNumToString( dRawW, 2) .. ' x ' .. EgtNumToString( dRawH, 2) .. ') ' .. 'sotto i limiti della macchina (' .. EgtNumToString( BD.MIN_WIDTH, 2) .. ' x ' .. EgtNumToString( BD.MIN_HEIGHT, 2) .. ')' @@ -391,6 +395,63 @@ if bToProcess then PostErrView( BEAM.ERR, BEAM.MSG) return end + + -- Se presente offset da btl, verifico se offset uguale per tutti i pezzi + if BD.USE_PART_OFFSET then + vBeamErr = {} + local sPartOffset = EgtGetInfo( vBeam[1].Id, 'PARTOFFSET', 's') or '' + local vPartOffset = EgtSplitString( sPartOffset) + local dRotAng = EgtGetInfo( vBeam[1].Id, 'ROTATED_OK', 'd') or 0 + + for i = 2, #vBeam do + local sPartOffsetCurrent = EgtGetInfo( vBeam[i].Id, 'PARTOFFSET', 's') or '' + local vPartOffsetCurrent = EgtSplitString( sPartOffsetCurrent) + local dRotAngCurrent = EgtGetInfo( vBeam[i].Id, 'ROTATED_OK', 'd') or 0 + local dRotAngDelta = abs( dRotAngCurrent - dRotAng) + if ( #vPartOffset == 5) and ( #vPartOffsetCurrent == 5) then + if dRotAngDelta < GEO.EPS_ANG_SMALL then + if ( vPartOffsetCurrent[2] ~= vPartOffsetCurrent[2]) + or ( vPartOffsetCurrent[3] ~= vPartOffset[3]) + or ( vPartOffsetCurrent[4] ~= vPartOffset[4]) + or ( vPartOffsetCurrent[5] ~= vPartOffset[5]) then + + table.insert( vBeamErr, i) + end + elseif dRotAngDelta - 180 < GEO.EPS_ANG_SMALL then + if ( vPartOffsetCurrent[2] ~= vPartOffsetCurrent[4]) + or ( vPartOffsetCurrent[3] ~= vPartOffset[5]) + or ( vPartOffsetCurrent[4] ~= vPartOffset[2]) + or ( vPartOffsetCurrent[5] ~= vPartOffset[3]) then + + table.insert( vBeamErr, i) + end + -- se pezzo ruotato di 90deg rispetto al principale, al momento si dà sempre errore + else + table.insert( vBeamErr, i) + end + else + if sPartOffsetCurrent ~= sPartOffset then + table.insert( vBeamErr, i) + end + end + end + + if #vBeamErr > 0 then + local sOut = 'Part offset not consistent in beam(s) : ' + for i = #vBeamErr, 1, -1 do + local sSeparator = ', ' + if i == 1 then + sSeparator = '' + end + sOut = sOut .. vBeam[vBeamErr[i]].Name .. sSeparator + end + BEAM.ERR = 17 + BEAM.MSG = sOut + WriteErrToLogFile( BEAM.ERR, BEAM.MSG) + PostErrView( BEAM.ERR, BEAM.MSG) + return + end + end -- Lunghezza della barra local dRawL = ( EgtGetInfo( EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL, 'BARLEN', 'd') or 12000) + 0.1