From bc467fc784ec43a7ce1bc3141b52b9d6f9c02cda Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Thu, 18 Sep 2025 11:30:16 +0200 Subject: [PATCH] In PanelSaw migliorata gestione scrittura dati. Dato F7 uniformato a F1 e F2. Versione funzionante, testata in macchina. --- LuaLibs/PanelSaw.lua | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/LuaLibs/PanelSaw.lua b/LuaLibs/PanelSaw.lua index 74ef71d..c61fbef 100644 --- a/LuaLibs/PanelSaw.lua +++ b/LuaLibs/PanelSaw.lua @@ -80,18 +80,18 @@ local function GetProjectInfo() return ProjectInfo end -local function GetFormattedLine( Table, LineToPrint) +local function GetFormattedLine( ValuesList, ValuesPlaceholders, FieldFixLength) local sLine = '' - local Values = Table.ValuesList[LineToPrint] + local Values = ValuesList local nPos = 1 -- posizione partenza linea for j, Value in ipairs( Values) do - local Placeholder = Table.ValuesPlaceholders[j] + local Placeholder = ValuesPlaceholders[j] local sFormatted = string.format( Placeholder, Value) -- se il campo ha lunghezza fissa, si aggiungono spazi - if Table.FieldFixLength and Table.FieldFixLength[j] then - local sFieldLength = Table.FieldFixLength[j] + if FieldFixLength and FieldFixLength[j] then + local sFieldLength = FieldFixLength[j] -- troncamento se troppo lungo if #sFormatted > sFieldLength then sFormatted = string.sub( sFormatted, 1, sFieldLength) @@ -166,19 +166,7 @@ local function BuildCuttingList_Cutty( PanelList, SheetList, ProjectInfo) { 164, 164}, { 150, 150} }, - ValuesPlaceholders = { - { '%s', '%s'}, - { '%s', '%s'}, - { '%s', '%s'}, - { '%s', '%s'}, - { '%s', '%s'}, - { '%s', '%s'}, - { '%s', '%s'}, - { '%s', '%s'}, - { '%s', '%s'}, - { '%s', '%s'}, - { '%s', '%s'} - } + ValuesPlaceholders = { '%s', '%s'} } local F7b = { @@ -224,7 +212,7 @@ local function BuildCuttingList_Cutty( PanelList, SheetList, ProjectInfo) -- F1 - sheets table.insert( Lines, string.format( table.concat( F1.HeaderPlaceholders, ' '), table.unpack( F1.Header))) for i = 1, #F1.ValuesList do - local sLine = GetFormattedLine( F1, i) + local sLine = GetFormattedLine( F1.ValuesList[i], F1.ValuesPlaceholders, F1.FieldFixLength) table.insert( Lines, sLine) end @@ -234,7 +222,7 @@ local function BuildCuttingList_Cutty( PanelList, SheetList, ProjectInfo) -- F2 - panels table.insert( Lines, string.format( table.concat( F2.HeaderPlaceholders, ' '), table.unpack( F2.Header))) for i = 1, #F2.ValuesList do - local sLine = GetFormattedLine( F2, i) + local sLine = GetFormattedLine( F2.ValuesList[i], F2.ValuesPlaceholders, F2.FieldFixLength) table.insert( Lines, sLine) end @@ -244,9 +232,8 @@ local function BuildCuttingList_Cutty( PanelList, SheetList, ProjectInfo) -- F7 table.insert( Lines, string.format( table.concat( F7.HeaderPlaceholders, ' '), table.unpack( F7.Header))) for i = 1, #F7.ValuesList do - local Values = F7.ValuesList[i] - local Placeholders = F7.ValuesPlaceholders[i] - table.insert( Lines, string.format( table.concat( Placeholders, ' '), table.unpack( Values))) + local sLine = GetFormattedLine( F7.ValuesList[i], F7.ValuesPlaceholders, F7.FieldFixLength) + table.insert( Lines, sLine) end -- linea vuota