- in BatchProcessNew si scrive Json risultati

This commit is contained in:
luca.mazzoleni
2025-05-20 11:57:07 +02:00
parent f947f761f1
commit e1b4089bfc
+24 -1
View File
@@ -3,7 +3,7 @@
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( true)
EgtEnableDebug( false)
-- Imposto direttorio libreria specializzata per Travi
EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua')
@@ -91,6 +91,7 @@ local BeamData = require( 'BeamData')
local BeamExec = require( 'BeamExec')
local BeamLib = require( 'BeamLib')
local FeatureLib = require( 'FeatureLib')
local JSON = require( 'JSON')
-- Variabili di modulo
local dRawW
@@ -161,6 +162,24 @@ local function ResetMachGroup( PARTS)
EgtRemoveMachGroup( EgtGetCurrMachGroup() or GDB_ID.NULL)
end
-- scrittura JSON risultati
-- TODO da migliorare/completare
local function WriteResultToJson( RESULT)
local sData = JSON:encode_pretty( RESULT)
-- Salvataggio e visualizzazione tabella
local sOutFile = EgtChangePathExtension( BEAM.FILE, '.json')
local DestFh = io.open( sOutFile, 'w+')
if not DestFh then
EgtOutBox( 'Error opening ' .. sOutFile, 'TestJson', 'ERROR')
return false
end
DestFh:write( sData)
DestFh:close()
return true
end
-------------------------------------------------------------------------------------------------------------
local sFlag = ''
if BEAM.FLAG == 0 then
@@ -599,6 +618,10 @@ if bToProcess then
BeamExec.GetProcessings( PARTS)
BeamExec.ProcessMachinings( PARTS)
local sOutput = ''
-- Scrittura json risultati
WriteResultToJson( RESULT)
-- scrittura txt risultati
for i = 1, #RESULT do
local sMsg = ''
if RESULT[i].sType == 'Feature' then