From 9e869b5c2659d61ca774f18e563bc5cc8f917753 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 6 Oct 2025 17:27:53 +0200 Subject: [PATCH 1/4] - in PanelSaw implementata scrittura cutting list anche per HOMAG (csv) --- LuaLibs/PanelSaw.lua | 58 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 4 deletions(-) diff --git a/LuaLibs/PanelSaw.lua b/LuaLibs/PanelSaw.lua index c50f993..37f2331 100644 --- a/LuaLibs/PanelSaw.lua +++ b/LuaLibs/PanelSaw.lua @@ -39,10 +39,18 @@ local function GetPanelList() PanelList[i].nPdn = EgtGetInfo( idPart, 'PDN', 'i') PanelList[i].sName = EgtGetInfo( idPart, 'NAM', 's') PanelList[i].sDescription = PanelList[i].sName + -- TODO le informazioni della venatura vanno lette dalle info pezzo + PanelList[i].sGrain = 'None' -- in questa modalità ogni MachGroup è 1 pezzo, non esistono multipli -- TODO valutare se raggruppare i pannelli uguali per la cutting list PanelList[i].nQuantity = 1 - -- TODO aggiungere labeling, edgebanding, graindirection, ... + -- TODO le informazioni di edgebanding devono arrivare dal btl + PanelList[i].sEdgeMaterialLeft = '' + PanelList[i].sEdgeMaterialRight = '' + PanelList[i].sEdgeMaterialTop = '' + PanelList[i].sEdgeMaterialBottom = '' + -- TODO il barcode deve arrivare dal btl + PanelList[i].sBarcode = '' idMachGroup = EgtGetNextMachGroup( idMachGroup) end @@ -75,7 +83,7 @@ local function GetProjectInfo() local ProjectInfo = {} local idBtlInfo = EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL - ProjectInfo.sProjectName = EgtGetInfo( idBtlInfo, 'PROJECTNAME', 's') or '' + _, ProjectInfo.sProjectName = EgtSplitPath( EgtGetInfo( idBtlInfo, 'PROJECTNAME', 's') or '') return ProjectInfo end @@ -264,9 +272,48 @@ local function BuildCuttingList_Cutty( PanelList, SheetList, ProjectInfo) end +local function BuildCuttingList_Homag( PanelList, ActualSheetList, ProjectInfo) + + local LinesToWriteList = {} + local sExtension = 'csv' + local Lines = {} + local dRequiredThickness = PanelList[1].dThickness + + local Header = { + Values = { 'Description', 'Quantity', 'Length', 'Width', 'Material', 'Grain', 'EdgeLeft', 'EdgeRight', 'EdgeTop', 'EdgeBottom', 'OrderNumber', 'BarCode'}, + ValuesPlaceholders = { '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s'} + } + + local Panels = { + ValuesList = {}, + ValuesPlaceholders = { '%s', '%d', '%.1f', '%.1f', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' } + } + for i = 1, #PanelList do + -- TODO questo deve essere un campo del Panel comune a tutte le esportazioni + local sMaterialPlusThickness = PanelList[i].sMaterialFullName .. '_' .. tostring( string.format( '%.1f', dRequiredThickness)) + Panels.ValuesList[i] = { PanelList[i].sDescription, PanelList[i].nQuantity, PanelList[i].dLength, PanelList[i].dWidth, sMaterialPlusThickness, PanelList[i].sGrain, PanelList[i].sEdgeMaterialLeft, PanelList[i].sEdgeMaterialRight, PanelList[i].sEdgeMaterialTop, PanelList[i].sEdgeMaterialBottom, ProjectInfo.sProjectName, PanelList[i].sBarcode} + end + + -- Intestazione + table.insert( Lines, string.format( table.concat( Header.ValuesPlaceholders, ','), table.unpack( Header.Values))) + + -- Lista Pannelli + for i = 1, #Panels.ValuesList do + local Values = Panels.ValuesList[i] + local Placeholders = Panels.ValuesPlaceholders + table.insert( Lines, string.format( table.concat( Placeholders, ','), table.unpack( Values))) + end + + LinesToWriteList[1] = Lines + + return LinesToWriteList, sExtension +end + + local function BuildCuttingList( PanelList, sOutputType) local LinesToWriteList = {} + local sExtension = '' local SheetList = GetSheetList() local ProjectInfo = GetProjectInfo() local dRequiredThickness = PanelList[1].dThickness @@ -292,10 +339,11 @@ local function BuildCuttingList( PanelList, sOutputType) -- Homag elseif sOutputType == 'HOMAG' then + LinesToWriteList, sExtension = BuildCuttingList_Homag( PanelList, ActualSheetList, ProjectInfo) end - return LinesToWriteList + return LinesToWriteList, sExtension end @@ -335,12 +383,14 @@ function PanelSaw.GenerateCuttingList( sOutputType) if sOutputType then -- costruzione lista istruzioni - local LinesToWriteList = BuildCuttingList( PanelListSingleMaterial, sOutputType) + local LinesToWriteList, sExtension = BuildCuttingList( PanelListSingleMaterial, sOutputType) for i = 1, #LinesToWriteList do -- scrittura file local sFilename = sCurrentNgePath .. 'CutList-' .. sCurrentNgeName .. '-' .. key .. '-' .. i .. sOutputType sFilename = sFilename:gsub( '%.', '_') + -- aggiunta eventuale estensione + sFilename = sFilename .. '.' .. sExtension local hFile, nFileErr = io.open( sFilename, 'w') if not hFile then EgtOutLog( 'Error creating cutting list : IO error ' .. tostring( nFileErr)) From 366a9d5f49b54cd782ad7b0ea9617268bbc1bbf6 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Tue, 7 Oct 2025 10:28:56 +0200 Subject: [PATCH 2/4] - in PanelSaw piccolo refactoring --- LuaLibs/PanelSaw.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/LuaLibs/PanelSaw.lua b/LuaLibs/PanelSaw.lua index 37f2331..eb8ee95 100644 --- a/LuaLibs/PanelSaw.lua +++ b/LuaLibs/PanelSaw.lua @@ -32,6 +32,7 @@ local function GetPanelList() PanelList[i].dWidth = EgtGetInfo( idMachGroup, 'PANELWIDTH', 'd') PanelList[i].dThickness = EgtGetInfo( idMachGroup, 'PANELHEIGHT', 'd') PanelList[i].sMaterialFullName = EgtGetInfo( idMachGroup, 'MATERIAL', 's') or '0000-MATERIAL' + PanelList[i].sMaterialPlusThickness = PanelList[i].sMaterialFullName .. '_' .. tostring( string.format( '%.1f', PanelList[i].dThickness)) local vMaterialInfo = EgtSplitString( PanelList[i].sMaterialFullName, '-') PanelList[i].idMaterial = vMaterialInfo[1] PanelList[i].idProd = EgtGetInfo( idMachGroup, 'PRODID', 'i') @@ -277,7 +278,6 @@ local function BuildCuttingList_Homag( PanelList, ActualSheetList, ProjectInfo) local LinesToWriteList = {} local sExtension = 'csv' local Lines = {} - local dRequiredThickness = PanelList[1].dThickness local Header = { Values = { 'Description', 'Quantity', 'Length', 'Width', 'Material', 'Grain', 'EdgeLeft', 'EdgeRight', 'EdgeTop', 'EdgeBottom', 'OrderNumber', 'BarCode'}, @@ -289,9 +289,7 @@ local function BuildCuttingList_Homag( PanelList, ActualSheetList, ProjectInfo) ValuesPlaceholders = { '%s', '%d', '%.1f', '%.1f', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' } } for i = 1, #PanelList do - -- TODO questo deve essere un campo del Panel comune a tutte le esportazioni - local sMaterialPlusThickness = PanelList[i].sMaterialFullName .. '_' .. tostring( string.format( '%.1f', dRequiredThickness)) - Panels.ValuesList[i] = { PanelList[i].sDescription, PanelList[i].nQuantity, PanelList[i].dLength, PanelList[i].dWidth, sMaterialPlusThickness, PanelList[i].sGrain, PanelList[i].sEdgeMaterialLeft, PanelList[i].sEdgeMaterialRight, PanelList[i].sEdgeMaterialTop, PanelList[i].sEdgeMaterialBottom, ProjectInfo.sProjectName, PanelList[i].sBarcode} + Panels.ValuesList[i] = { PanelList[i].sDescription, PanelList[i].nQuantity, PanelList[i].dLength, PanelList[i].dWidth, PanelList[i].sMaterialPlusThickness, PanelList[i].sGrain, PanelList[i].sEdgeMaterialLeft, PanelList[i].sEdgeMaterialRight, PanelList[i].sEdgeMaterialTop, PanelList[i].sEdgeMaterialBottom, ProjectInfo.sProjectName, PanelList[i].sBarcode} end -- Intestazione From 7f4e11733970ccd049b1923858204723516f35d4 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Tue, 7 Oct 2025 15:34:17 +0200 Subject: [PATCH 3/4] - in PanelSaw, in esportazione Cutty e Homag si gestisce la direzione fibra --- LuaLibs/PanelSaw.lua | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/LuaLibs/PanelSaw.lua b/LuaLibs/PanelSaw.lua index eb8ee95..f39339c 100644 --- a/LuaLibs/PanelSaw.lua +++ b/LuaLibs/PanelSaw.lua @@ -40,8 +40,19 @@ local function GetPanelList() PanelList[i].nPdn = EgtGetInfo( idPart, 'PDN', 'i') PanelList[i].sName = EgtGetInfo( idPart, 'NAM', 's') PanelList[i].sDescription = PanelList[i].sName - -- TODO le informazioni della venatura vanno lette dalle info pezzo - PanelList[i].sGrain = 'None' + local sGrainInfo = EgtGetInfo( idPart, "GRAINDIRECTION", 's') + PanelList[i].sGrainDirection = 'None' + if sGrainInfo then + local bUseGrain = ( string.sub( sGrainInfo, 7) == '1') + local sGrainDirection = string.sub( sGrainInfo, 1, 5) + if bUseGrain then + if sGrainDirection == "1,0,0" then + PanelList[i].sGrainDirection = 'Length' + elseif sGrainDirection == "0,1,0" then + PanelList[i].sGrainDirection = 'Width' + end + end + end -- in questa modalità ogni MachGroup è 1 pezzo, non esistono multipli -- TODO valutare se raggruppare i pannelli uguali per la cutting list PanelList[i].nQuantity = 1 @@ -131,7 +142,14 @@ local function BuildCuttingList_Cutty( PanelList, SheetList, ProjectInfo) ValuesPlaceholders = { '%.3f', '%.3f', '%d', '%d', '%d', '%d', '%d', '%-20s', '%d', '%d', '%d', '%d', '%-50s', '%d', '%d', '%d', '%d', '%d', '%d', '%.3f', '%d', '%d', '%-85d', '%.3f', '%.3f'}, } for i = 1, #CurrentPanelList do - F2.ValuesList[i] = { CurrentPanelList[i].dLength, CurrentPanelList[i].dWidth, CurrentPanelList[i].nQuantity, 0, 0, 0, 0, CurrentPanelList[i].nPdn, 0, 0, 0, 0, CurrentPanelList[i].sDescription, 0, 0, 0, 0, 1, 0, 1500, 0, 0, 0, 0, 0} + local nGrain = 0 + if PanelList[i].sGrainDirection == 'Length' then + nGrain = 1 + elseif PanelList[i].sGrainDirection == 'Width' then + nGrain = 1 + CurrentPanelList[i].dLength, CurrentPanelList[i].dWidth = CurrentPanelList[i].dWidth, CurrentPanelList[i].dLength + end + F2.ValuesList[i] = { CurrentPanelList[i].dLength, CurrentPanelList[i].dWidth, CurrentPanelList[i].nQuantity, 0, nGrain, 0, 0, CurrentPanelList[i].nPdn, 0, 0, 0, 0, CurrentPanelList[i].sDescription, 0, 0, 0, 0, 1, 0, 1500, 0, 0, 0, 0, 0} end local F7 = { @@ -289,7 +307,8 @@ local function BuildCuttingList_Homag( PanelList, ActualSheetList, ProjectInfo) ValuesPlaceholders = { '%s', '%d', '%.1f', '%.1f', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' } } for i = 1, #PanelList do - Panels.ValuesList[i] = { PanelList[i].sDescription, PanelList[i].nQuantity, PanelList[i].dLength, PanelList[i].dWidth, PanelList[i].sMaterialPlusThickness, PanelList[i].sGrain, PanelList[i].sEdgeMaterialLeft, PanelList[i].sEdgeMaterialRight, PanelList[i].sEdgeMaterialTop, PanelList[i].sEdgeMaterialBottom, ProjectInfo.sProjectName, PanelList[i].sBarcode} + local sGrain = PanelList[i].sGrainDirection + Panels.ValuesList[i] = { PanelList[i].sDescription, PanelList[i].nQuantity, PanelList[i].dLength, PanelList[i].dWidth, PanelList[i].sMaterialPlusThickness, sGrain, PanelList[i].sEdgeMaterialLeft, PanelList[i].sEdgeMaterialRight, PanelList[i].sEdgeMaterialTop, PanelList[i].sEdgeMaterialBottom, ProjectInfo.sProjectName, PanelList[i].sBarcode} end -- Intestazione From 30d0efa0ca2c3d7fd57f231793990d746db33ea7 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Wed, 8 Oct 2025 17:16:55 +0200 Subject: [PATCH 4/4] =?UTF-8?q?-=20in=20PanelSaw=20in=20esportazione=20Hom?= =?UTF-8?q?ag=20la=20descrizione=20del=20tipo=20di=20grain=20=C3=A8=20in?= =?UTF-8?q?=20olandese?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/PanelSaw.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/LuaLibs/PanelSaw.lua b/LuaLibs/PanelSaw.lua index f39339c..287f7ce 100644 --- a/LuaLibs/PanelSaw.lua +++ b/LuaLibs/PanelSaw.lua @@ -308,6 +308,14 @@ local function BuildCuttingList_Homag( PanelList, ActualSheetList, ProjectInfo) } for i = 1, #PanelList do local sGrain = PanelList[i].sGrainDirection + -- TODO questo dipenderà dalla lingua dell'esportazione; andrà fatto un tipo di esportazione specifica per ogni lingua (es: HOMAG_NL, HOMAG_ENG, ...) + if sGrain == 'None' then + sGrain = 'Geen' + elseif sGrain == 'Length' then + sGrain = 'Lengte' + elseif sGrain == 'Width' then + sGrain = 'Breedte' + end Panels.ValuesList[i] = { PanelList[i].sDescription, PanelList[i].nQuantity, PanelList[i].dLength, PanelList[i].dWidth, PanelList[i].sMaterialPlusThickness, sGrain, PanelList[i].sEdgeMaterialLeft, PanelList[i].sEdgeMaterialRight, PanelList[i].sEdgeMaterialTop, PanelList[i].sEdgeMaterialBottom, ProjectInfo.sProjectName, PanelList[i].sBarcode} end