From a449af35d9e3b3b1af72e8ef56a3e52681009abb Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 25 Aug 2025 18:06:02 +0200 Subject: [PATCH 01/10] - in NestProcess implementato nesting semplice per cabinet, un pezzo per grezzo --- NestProcess.lua | 67 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/NestProcess.lua b/NestProcess.lua index a6acbec..a8ddf03 100644 --- a/NestProcess.lua +++ b/NestProcess.lua @@ -1683,6 +1683,71 @@ NEST.ERR = 0 -- resetto gruppo di lavorazione corrente EgtResetCurrMachGroup() +-- modalità nesting utile per cabinet: un grezzo per ogni pezzo, pezzo centrato nel grezzo. Il grezzo non viene preso da magazzino ma creato ad hoc, con un dato sovramateriale. +if WD.ENABLE_SIMPLE_NESTING then + + -- sovramateriale richiesto + local dOverMaterial = max( 0, NEST.KERF or 2.5) + + -- inizializzazione parametri per creazione grezzo tramite BatchProcessNew + _G.WALL = {} + WALL.FILE = NEST.FILE + WALL.MACHINE = NEST.MACHINE + WALL.BASEDIR = NEST.BASEDIR + WALL.FLAG = 6 -- CREATE_PANEL + WALL.NESTING_REF = 'BL' + + -- per ogni singolo pezzo si creano duplo e machgroup e si settano le note opportune per poi creare i grezzi richiamando la BatchProcessNew (flag 6) + for nPartId, nCount in pairs( PART) do + + -- informazioni dalla parte originale + -- box e relative dimensioni + local nBoxLayerId = EgtGetFirstNameInGroup( nPartId, "Box") + local nBoxId = EgtGetFirstNameInGroup( nBoxLayerId, "Box") + local b3Part = EgtGetBBoxGlob( nBoxId, GDB_BB.STANDARD) + -- inversione e rotazione + local nPartFlip = EgtGetInfo( nPartId, "INVERTED", 'i') or 0 + local nPartRotation = EgtGetInfo( nPartId, "ROTATED", 'i') or 0 + + -- dimensioni grezzo, considerando sovramateriale + local dRawLength = b3Part:getDimX() + 2 * dOverMaterial + local dRawWidth = b3Part:getDimY() + 2 * dOverMaterial + + for _ = 1, nCount do + + -- creazione gruppo di lavoro + local sMachGroupName = max( 1000, NewMachGroupName()) + local nMachGroupId = EgtAddMachGroup( sMachGroupName) + -- settaggio note in gruppo di lavoro + EgtSetInfo( nMachGroupId, "PANELLEN", dRawLength) + EgtSetInfo( nMachGroupId, "PANELWIDTH", dRawWidth) + EgtSetInfo( nMachGroupId, "MATERIAL", NEST.MATERIAL) + EgtSetInfo( nMachGroupId, "PRODID", NEST.PRODID) + EgtSetInfo( nMachGroupId, "PATTID", nMachGroupId) + + -- creazione duplo + local nPartDuploId = EgtDuploNew( nPartId) + -- settaggio note in duplo + EgtSetInfo( nMachGroupId, "PART" .. 1, nPartDuploId .. "," .. EgtNumToString( dOverMaterial) .. "," .. EgtNumToString( dOverMaterial) .. "," .. 0 .."," .. 0) + EgtSetInfo( nPartDuploId, "POSY", dOverMaterial) + EgtSetInfo( nPartDuploId, "POSX", dOverMaterial) + EgtSetInfo( nPartDuploId, "FLIP", nPartFlip) + EgtSetInfo( nPartDuploId, "ROT", nPartRotation) + + -- creazione grezzi tramite BatchProcessNew + EgtSetCurrMachGroup( nMachGroupId) + EgtSetInfo( nMachGroupId, "UPDATEUI", 1) + dofile( NEST.BASEDIR .. "\\BatchProcessNew.lua") + end + end + + EgtProcessEvents( 200 + 100, 0) + EgtResetCurrMachGroup() + EgtOutLog( ' +++ NestProcess completed') + + return +end + -- inizio nesting automatico EgtAutoNestStart() @@ -1691,7 +1756,7 @@ local RawParts = {} -- creo tabella dei grezzi for sIndex, dLen in pairs( LEN) do RawParts[tonumber(sIndex)] = { Len = dLen} -end +end for sIndex, dWidth in pairs( WIDTH) do RawParts[tonumber(sIndex)].Width = dWidth end From 7775fa75fc201d84a62db471c98dd351f745438a Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 28 Aug 2025 14:44:41 +0200 Subject: [PATCH 02/10] - modificato nesting semplice per cabinet. Ora si assegna il nome del PDN del pezzo. Se presenti multipli, si aggiunge il contatore del multiplo al PDN. --- NestProcess.lua | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/NestProcess.lua b/NestProcess.lua index a8ddf03..281b940 100644 --- a/NestProcess.lua +++ b/NestProcess.lua @@ -1684,10 +1684,11 @@ NEST.ERR = 0 EgtResetCurrMachGroup() -- modalità nesting utile per cabinet: un grezzo per ogni pezzo, pezzo centrato nel grezzo. Il grezzo non viene preso da magazzino ma creato ad hoc, con un dato sovramateriale. +-- il numero del MachGroup deve coincidere con il PDN del pezzo originale if WD.ENABLE_SIMPLE_NESTING then -- sovramateriale richiesto - local dOverMaterial = max( 0, NEST.KERF or 2.5) + local dOverMaterial = max( 0, NEST.KERF or 2) -- inizializzazione parametri per creazione grezzo tramite BatchProcessNew _G.WALL = {} @@ -1697,8 +1698,31 @@ if WD.ENABLE_SIMPLE_NESTING then WALL.FLAG = 6 -- CREATE_PANEL WALL.NESTING_REF = 'BL' - -- per ogni singolo pezzo si creano duplo e machgroup e si settano le note opportune per poi creare i grezzi richiamando la BatchProcessNew (flag 6) + -- si ricrea la lista pezzi ordinata + local PartList = {} + local nPartCounter = 0 for nPartId, nCount in pairs( PART) do + nPartCounter = nPartCounter + 1 + PartList[nPartCounter] = {} + PartList[nPartCounter].nId = nPartId + PartList[nPartCounter].nCount = nCount + PartList[nPartCounter].nPdn = EgtGetInfo( nPartId, "PDN", 'i') + PartList[nPartCounter].bAddCounterToNaming = false + -- se presente un pezzo con multipli il PDN sarà seguito da un contatore + if nCount > 1 then + PartList[nPartCounter].bAddCounterToNaming = true + end + end + -- si riordina in base al PDN + table.sort( PartList, function(a, b) return tonumber( a.nPdn) < tonumber( b.nPdn) end) + + -- per ogni singolo pezzo si creano duplo e machgroup e si settano le note opportune per poi creare i grezzi richiamando la BatchProcessNew (flag 6) + for i = 1, #PartList do + + local nPartId = PartList[i].nId + local nPartCount = PartList[i].nCount + local nPdn = PartList[i].nPdn + local bAddCounterToNaming = PartList[i].bAddCounterToNaming -- informazioni dalla parte originale -- box e relative dimensioni @@ -1713,11 +1737,19 @@ if WD.ENABLE_SIMPLE_NESTING then local dRawLength = b3Part:getDimX() + 2 * dOverMaterial local dRawWidth = b3Part:getDimY() + 2 * dOverMaterial - for _ = 1, nCount do - + for j = 1, nPartCount do -- creazione gruppo di lavoro - local sMachGroupName = max( 1000, NewMachGroupName()) + local sMachGroupName = nPdn + if bAddCounterToNaming then + sMachGroupName = nPdn .. '_' .. string.format("%02d", j) + end local nMachGroupId = EgtAddMachGroup( sMachGroupName) + if not nMachGroupId then + EgtOutLog( "Errore: MachGroup " .. nPdn .. " già presente") + EgtOutBox( 'Error : MachGroup ' .. nPdn .. ' already existing', 'Nesting failed') + NEST.ERR = 2 + return + end -- settaggio note in gruppo di lavoro EgtSetInfo( nMachGroupId, "PANELLEN", dRawLength) EgtSetInfo( nMachGroupId, "PANELWIDTH", dRawWidth) From 9dc093e16b1c273b938e1ed990954bf39badc522 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Fri, 29 Aug 2025 18:19:42 +0200 Subject: [PATCH 03/10] - in NestProcess modifiche per ruotare il pezzo in caso di presenza fori orizzontali D50 --- NestProcess.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NestProcess.lua b/NestProcess.lua index 281b940..ed6c91a 100644 --- a/NestProcess.lua +++ b/NestProcess.lua @@ -65,6 +65,7 @@ local s_dSideMillDiamDown = WD.SIDEMILL_DIAM_DOWN or 350 local s_dSideMillDiamUp = WD.SIDEMILL_DIAM_UP or 65 local s_dHorDrillLen = WD.HOR_DRILL_LEN or 1780 local s_dHorDrillDiam = WD.HOR_DRILL_DIAM or 35 +local s_dHorDrillDiam5Axes = WD.HOR_DRILL_DIAM_5AX or 0 local s_sOrigCorner = WD.ORIG_CORNER or 'TL' local s_dIntRulli = WD.INTRULLI or 1200 local s_dMinRawYHorDrill = WD.MINRAWY_HOR_DRILL or 2800 @@ -535,7 +536,7 @@ local function ClassifyDrillsOnLateralFaces( nPartId, dMinSheetWidth) if not AuxId or EgtGetType( AuxId) ~= GDB_TY.CRV_ARC then break end -- verifico se diametro compatibile con la punta local dDiam = 2 * EgtArcRadius( AuxId) - if abs( dDiam - s_dHorDrillDiam) < WD.DRILL_TOL + GEO.EPS_SMALL then + if ( abs( dDiam - s_dHorDrillDiam5Axes) < WD.DRILL_TOL + GEO.EPS_SMALL) or ( abs( dDiam - s_dHorDrillDiam) < WD.DRILL_TOL + GEO.EPS_SMALL) then local ptDrill = EgtCP( AuxId, GDB_RT.GLOB) local dLen = abs( EgtCurveThickness( AuxId)) local bLong = dLen > s_dHorDrillLen - 1 From 14d726ffae4e4eedfc03fcf9bb954eb99a98f055 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 4 Sep 2025 09:13:58 +0200 Subject: [PATCH 04/10] - modifiche parziali per creazione cutting list per Casadei --- LuaLibs/PanelSaw.lua | 115 +++++++++++++++++++++++++++++++++++++++++++ NestProcess.lua | 7 ++- 2 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 LuaLibs/PanelSaw.lua diff --git a/LuaLibs/PanelSaw.lua b/LuaLibs/PanelSaw.lua new file mode 100644 index 0000000..8ee8129 --- /dev/null +++ b/LuaLibs/PanelSaw.lua @@ -0,0 +1,115 @@ +-- PanelSaw.lua by Egalware s.r.l. 2025/09/02 +-- Creazione lista taglio e/o programmi di taglio per sezionatrici + +-- Intestazioni +require( 'EgtBase') +_ENV = EgtProtectGlobal() +EgtEnableDebug( false) + +local PanelSaw = {} + + +local function GetPanelList() + + local PanelList = {} + local idMachGroup = EgtGetFirstMachGroup() + local nMachGroupCount = EgtGetMachGroupCount() + + -- nessun MachGroup ossia nessun pannello: si esce subito + if ( not idMachGroup) or ( nMachGroupCount == 0) then + return nil + end + + -- per ogni MachGroup si estraggono le informazioni del pannello + for i = 1, nMachGroupCount do + + local vPartInfo = EgtSplitString( EgtGetInfo( idMachGroup, 'PART1', 's')) + local idPart = vPartInfo[1] + + table.insert( PanelList, {}) + PanelList[i].dLength = EgtGetInfo( idMachGroup, 'PANELLEN', 'd') + PanelList[i].dWidth = EgtGetInfo( idMachGroup, 'PANELWIDTH', 'd') + PanelList[i].dThickness = EgtGetInfo( idMachGroup, 'PANELHEIGHT', 'd') + PanelList[i].sMaterial = EgtGetInfo( idMachGroup, 'MATERIAL', 's') + PanelList[i].idProd = EgtGetInfo( idMachGroup, 'PRODID', 'i') + PanelList[i].idPatt = EgtGetInfo( idMachGroup, 'PATTID', 'i') + PanelList[i].nPdn = EgtGetInfo( idPart, 'PDN', 'i') + PanelList[i].sName = EgtGetInfo( idPart, 'NAM', 's') + -- 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 + + idMachGroup = EgtGetNextMachGroup( idMachGroup) + + end + + return PanelList +end + + +local function GetSheetList() + + local SheetList = { + { + dLength = 2800, + dWidth = 2070, + dThickness = 8 + }, + { + dLength = 2800, + dWidth = 2070, + dThickness = 18 + } + } + + return SheetList +end + + +local function GetProjectInfo() + + local ProjectInfo = {} + local idBtlInfo = EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL + + ProjectInfo.sProjectName = EgtGetInfo( idBtlInfo, 'PROJECTNAME', 's') or '' + + return ProjectInfo +end + + +local function BuildCuttingList( sOutputType) + + local LinesToWrite = {} + local PanelList = GetPanelList() + local SheetList = GetSheetList() + local ProjectInfo = GetProjectInfo() + + -- Casadei + if sOutputType == 'Cutty' then + + -- Homag Optimat + elseif sOutputType == 'Homag' then + + -- formato json generico + else + + end + + return LinesToWrite +end + + +function PanelSaw.GenerateCuttingList( sOutputType) + + local LinesToWrite = BuildCuttingList( sOutputType) + + -- scrittura file + local file = io.open( sProjectName .. '.' .. sOutputType, "w") + file:write( table.concat( LinesToWrite, "\n")) + file:close() + + return +end + + +return PanelSaw \ No newline at end of file diff --git a/NestProcess.lua b/NestProcess.lua index ed6c91a..f695983 100644 --- a/NestProcess.lua +++ b/NestProcess.lua @@ -4,7 +4,7 @@ -- Intestazioni require( 'EgtBase') _ENV = EgtProtectGlobal() -EgtEnableDebug( false) +EgtEnableDebug( true) -- Per test --NEST = {} @@ -56,6 +56,8 @@ _G.package.loaded.WProcessDoubleCut = nil local DoubleCut = require( 'WProcessDoubleCut') _G.package.loaded.WProcessFreeContour = nil local FreeContour = require( 'WProcessFreeContour') +_G.package.loaded.PanelSaw = nil +local PanelSaw = require( 'PanelSaw') -- Carico i dati globali local WD = require( 'WallData') @@ -1778,6 +1780,9 @@ if WD.ENABLE_SIMPLE_NESTING then EgtResetCurrMachGroup() EgtOutLog( ' +++ NestProcess completed') + EgtOutLog( ' +++ Generating Cutting List') + PanelSaw.GenerateCuttingList() + return end From ed0e726391906bc5dad2710fdef5f9e17c244c39 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 4 Sep 2025 17:18:52 +0200 Subject: [PATCH 05/10] - in panel saw si scrive una cutlist per ogni combinazione unica di materiale e spessore --- LuaLibs/PanelSaw.lua | 62 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 51 insertions(+), 11 deletions(-) diff --git a/LuaLibs/PanelSaw.lua b/LuaLibs/PanelSaw.lua index 8ee8129..4254f3c 100644 --- a/LuaLibs/PanelSaw.lua +++ b/LuaLibs/PanelSaw.lua @@ -3,8 +3,6 @@ -- Intestazioni require( 'EgtBase') -_ENV = EgtProtectGlobal() -EgtEnableDebug( false) local PanelSaw = {} @@ -30,7 +28,9 @@ local function GetPanelList() PanelList[i].dLength = EgtGetInfo( idMachGroup, 'PANELLEN', 'd') PanelList[i].dWidth = EgtGetInfo( idMachGroup, 'PANELWIDTH', 'd') PanelList[i].dThickness = EgtGetInfo( idMachGroup, 'PANELHEIGHT', 'd') - PanelList[i].sMaterial = EgtGetInfo( idMachGroup, 'MATERIAL', 's') + PanelList[i].sMaterialFullName = EgtGetInfo( idMachGroup, 'MATERIAL', 's') + local vMaterialInfo = EgtSplitString( PanelList[i].sMaterialFullName, '-') + PanelList[i].idMaterial = vMaterialInfo[1] PanelList[i].idProd = EgtGetInfo( idMachGroup, 'PRODID', 'i') PanelList[i].idPatt = EgtGetInfo( idMachGroup, 'PATTID', 'i') PanelList[i].nPdn = EgtGetInfo( idPart, 'PDN', 'i') @@ -77,10 +77,9 @@ local function GetProjectInfo() end -local function BuildCuttingList( sOutputType) +local function BuildCuttingList( PanelList, sOutputType) local LinesToWrite = {} - local PanelList = GetPanelList() local SheetList = GetSheetList() local ProjectInfo = GetProjectInfo() @@ -99,14 +98,55 @@ local function BuildCuttingList( sOutputType) end +-- restituisce i pannelli raggruppati per coppia materiale-spessore univoca +local function GroupByMaterial( PanelList) + local PanelsGroupedByMaterial = {} + + for i = 1, #PanelList do + local idMaterial = PanelList[i].idMaterial + local dMaterialThickness = PanelList[i].dThickness + + -- si crea una chiave unica dalla coppia + local key = idMaterial .. "_" .. tostring( dMaterialThickness) + + -- se la chiave non esiste già nella tabella, si crea + if not PanelsGroupedByMaterial[key] then + PanelsGroupedByMaterial[key] = {} + end + + -- aggiunta del pezzo corrente al gruppo chiave corrispondente + table.insert( PanelsGroupedByMaterial[key], PanelList[i]) + end + + return PanelsGroupedByMaterial +end + + function PanelSaw.GenerateCuttingList( sOutputType) - local LinesToWrite = BuildCuttingList( sOutputType) - - -- scrittura file - local file = io.open( sProjectName .. '.' .. sOutputType, "w") - file:write( table.concat( LinesToWrite, "\n")) - file:close() + local PanelList = GetPanelList() + local PanelsGroupedByMaterial = GroupByMaterial( PanelList) + + for key, PanelListSingleMaterial in pairs( PanelsGroupedByMaterial) do + + if not sOutputType then + sOutputType = 'json' + end + + -- costruzione lista istruzioni + local LinesToWrite = BuildCuttingList( PanelListSingleMaterial, sOutputType) + + -- scrittura file + local sCurrentNgePath = EgtSplitPath( EgtGetCurrFilePath()) + local sFilename = sCurrentNgePath .. 'CutList_' .. key .. '.' .. sOutputType + local hFile, nFileErr = io.open( sFilename, 'w') + if not hFile then + EgtOutLog( 'Error creating cutting list : IO error ' .. tostring( nFileErr)) + return false + end + hFile:write( table.concat( LinesToWrite, "\n")) + hFile:close() + end return end From 2b9453128104c89b095f383638e6bc3a6989b645 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 8 Sep 2025 11:43:38 +0200 Subject: [PATCH 06/10] - in PanelSaw si costruisce il file esportato in formato Cutty - in NestProcess si chiama la PanelSaw formato Cutty (test) --- LuaLibs/PanelSaw.lua | 226 +++++++++++++++++++++++++++++++++++++++---- NestProcess.lua | 8 +- 2 files changed, 213 insertions(+), 21 deletions(-) diff --git a/LuaLibs/PanelSaw.lua b/LuaLibs/PanelSaw.lua index 4254f3c..33eb222 100644 --- a/LuaLibs/PanelSaw.lua +++ b/LuaLibs/PanelSaw.lua @@ -38,9 +38,9 @@ local function GetPanelList() -- 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, ... idMachGroup = EgtGetNextMachGroup( idMachGroup) - end return PanelList @@ -77,21 +77,205 @@ local function GetProjectInfo() end +local function BuildCuttingList_Cutty( PanelList, SheetList, ProjectInfo) + + local Lines = {} + + local F0 = { + Header = { 'F0'}, + HeaderPlaceholders = { '%s'}, + Values = { ' 7.70', '210700', '150300'}, + ValuesPlaceholders = { '%s', '%s', '%s'} + } + + local F0b = { + Header = { 'F0b', '""', '""', '""', '""'}, + HeaderPlaceholders = { '%s', '%s', '%s', '%s', '%s'} + } + + local F1 = { + Header = { 'F1', PanelList[1].dThickness, 0, 0, 0}, + HeaderPlaceholders = { '%s', '%.3f', '%.3f', '%.3f', '%.3f'}, + ValuesList = {}, + ValuesPlaceholders = { '%.3f', '%.3f', '%d', '%d', '%d', '%d', '%d', '%.3f', '%d', '%d', '%d', '%d'} + } + for i = 1, #SheetList do + F1.ValuesList[i] = { SheetList[i].dLength, SheetList[i].dWidth, 99, 200, 1, 1, 0, 1, 0, 0, 0, 0} + end + + local F2 = { + Header = { 'F2', 0, 0, 0}, + HeaderPlaceholders = { '%s', '%d', '%d', '%d'}, + ValuesList = {}, + ValuesPlaceholders = { '%.3f', '%.3f', '%d', '%d', '%d', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%.3f', '%d', '%d', '%d', '%.3f', '%.3f'} + } + for i = 1, #PanelList do + F2.ValuesList[i] = { PanelList[i].dLength, PanelList[i].dWidth, PanelList[i].nQuantity, 0, 0, 0, 0, PanelList[i].nPdn, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1500, 0, 0, 0, 0, 0} + end + + local F7 = { + Header = { 'F7', 3052, 0}, + HeaderPlaceholders = { '%s', '%s', '%d'}, + ValuesList = { + { 218, 436}, + { 167, 669}, + { 204, 408}, + { 204, 204}, + { 204, 204}, + { 209, 209}, + { 167, 167}, + { 213, 213}, + { 229, 229}, + { 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'} + } + } + + local F7b = { + Header = { 'F7b', 0, 0, 0, 0}, + HeaderPlaceholders = { '%s', '%.3f', '%.3f', '%.3f', '%.3f'}, + Values = {}, + ValuesPlaceholders = {} + } + + local F8 = { + Header = { 'F8', 0, 0, 20, 20, 0, 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + HeaderPlaceholders = { '%s', '%.3f', '%.3f', '%d', '%d', '%d', '%d', '%.3f', '%d', '%d', '%d', '%d', '%d', '%d', '%.3f', '%d', '%d', '%d', '%d', '%d', '%d', '%.3f', '%.3f', '%.3f'} + } + + local F9 = { + Header = { 'F9', 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 4.3, 0, 0, 0, 2, 0, 2450, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + HeaderPlaceholders = { '%s', '%d', '%.3f', '%d', '%.3f', '%.3f', '%.3f', '%.3f', '%.3f', '%d', '%d', '%.3f', '%d', '%d', '%d', '%d', '%.3f', '%.3f', '%d', '%d', '%.3f', '%.3f', '%.3f', '%.3f', '%d', '%d', '%.3f', '%.3f'} + } + + local F3 = { + Header = { 'F3'}, + HeaderPlaceholders = { '%s'} + } + + local E0 = { + Header = { 'E0'}, + HeaderPlaceholders = { '%s'} + } + + -- F0 + table.insert( Lines, string.format( table.concat( F0.HeaderPlaceholders, ' '), table.unpack( F0.Header))) + table.insert( Lines, string.format( table.concat( F0.ValuesPlaceholders, ' '), table.unpack( F0.Values))) + + -- linea vuota + table.insert( Lines, '') + + -- F0b + table.insert( Lines, string.format( table.concat( F0b.HeaderPlaceholders, ' '), table.unpack( F0b.Header))) + + -- linea vuota + table.insert( Lines, '') + + -- F1 - sheets + table.insert( Lines, string.format( table.concat( F1.HeaderPlaceholders, ' '), table.unpack( F1.Header))) + for i = 1, #F1.ValuesList do + local Values = F1.ValuesList[i] + local Placeholders = F1.ValuesPlaceholders + table.insert( Lines, string.format( table.concat( Placeholders, ' '), table.unpack( Values))) + end + + -- linea vuota + table.insert( Lines, '') + + -- F2 - panels + table.insert( Lines, string.format( table.concat( F2.HeaderPlaceholders, ' '), table.unpack( F2.Header))) + for i = 1, #F2.ValuesList do + local Values = F2.ValuesList[i] + local Placeholders = F2.ValuesPlaceholders + table.insert( Lines, string.format( table.concat( Placeholders, ' '), table.unpack( Values))) + end + + -- linea vuota + table.insert( Lines, '') + + -- 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))) + end + + -- linea vuota + table.insert( Lines, '') + + -- F7b + table.insert( Lines, string.format( table.concat( F7b.HeaderPlaceholders, ' '), table.unpack( F7b.Header))) + + -- linea vuota + table.insert( Lines, '') + + -- F8 + table.insert( Lines, string.format( table.concat( F8.HeaderPlaceholders, ' '), table.unpack( F8.Header))) + + -- linea vuota + table.insert( Lines, '') + + -- F9 + table.insert( Lines, string.format( table.concat( F9.HeaderPlaceholders, ' '), table.unpack( F9.Header))) + + -- linea vuota + table.insert( Lines, '') + + -- F3 + table.insert ( Lines, string.format( table.concat( F3.HeaderPlaceholders, ' '), table.unpack( F3.Header))) + + -- E0 + table.insert( Lines, string.format( table.concat( E0.HeaderPlaceholders, ' '), table.unpack( E0.Header))) + + -- linea vuota + table.insert( Lines, '') + + return Lines +end + + local function BuildCuttingList( PanelList, sOutputType) local LinesToWrite = {} local SheetList = GetSheetList() local ProjectInfo = GetProjectInfo() + local dRequiredThickness = PanelList[1].dThickness + + -- solo gli sheets dello spessore corretto vanno considerati + local ActualSheetList = {} + for i = 1, #SheetList do + if abs( SheetList[i].dThickness - dRequiredThickness) < 10 * GEO.EPS_SMALL then + ActualSheetList[#ActualSheetList+1] = { + dLength = SheetList[i].dLength, + dWidth = SheetList[i].dWidth, + dThickness = SheetList[i].dThickness + } + end + end -- Casadei if sOutputType == 'Cutty' then + + LinesToWrite = BuildCuttingList_Cutty( PanelList, ActualSheetList, ProjectInfo) -- Homag Optimat elseif sOutputType == 'Homag' then - -- formato json generico - else - + end return LinesToWrite @@ -129,23 +313,27 @@ function PanelSaw.GenerateCuttingList( sOutputType) for key, PanelListSingleMaterial in pairs( PanelsGroupedByMaterial) do - if not sOutputType then - sOutputType = 'json' - end - - -- costruzione lista istruzioni - local LinesToWrite = BuildCuttingList( PanelListSingleMaterial, sOutputType) - - -- scrittura file + -- path in cui scrivere i file local sCurrentNgePath = EgtSplitPath( EgtGetCurrFilePath()) - local sFilename = sCurrentNgePath .. 'CutList_' .. key .. '.' .. sOutputType - local hFile, nFileErr = io.open( sFilename, 'w') - if not hFile then - EgtOutLog( 'Error creating cutting list : IO error ' .. tostring( nFileErr)) - return false + + if sOutputType then + -- costruzione lista istruzioni + local LinesToWrite = BuildCuttingList( PanelListSingleMaterial, sOutputType) + + -- scrittura file + local sFilename = sCurrentNgePath .. 'CutList_' .. key .. '.' .. sOutputType + local hFile, nFileErr = io.open( sFilename, 'w') + if not hFile then + EgtOutLog( 'Error creating cutting list : IO error ' .. tostring( nFileErr)) + return false + end + hFile:write( table.concat( LinesToWrite, "\n")) + hFile:close() + + -- se nessun tipo si deve scrivere un json semplice + else + end - hFile:write( table.concat( LinesToWrite, "\n")) - hFile:close() end return diff --git a/NestProcess.lua b/NestProcess.lua index f695983..c318667 100644 --- a/NestProcess.lua +++ b/NestProcess.lua @@ -4,7 +4,7 @@ -- Intestazioni require( 'EgtBase') _ENV = EgtProtectGlobal() -EgtEnableDebug( true) +EgtEnableDebug( false) -- Per test --NEST = {} @@ -1781,7 +1781,11 @@ if WD.ENABLE_SIMPLE_NESTING then EgtOutLog( ' +++ NestProcess completed') EgtOutLog( ' +++ Generating Cutting List') - PanelSaw.GenerateCuttingList() + + + -- TEST + PanelSaw.GenerateCuttingList( 'Cutty') + -- TEST return end From 5b45aee1f211788263e967b42ac071135cb59094 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 8 Sep 2025 15:39:28 +0200 Subject: [PATCH 07/10] - in NestProcess, per nesting tipo cabinet si chiama la fliprot prima di nestare; - in PanelSaw si gestisce il caso in cui il materiale sia vuoto --- LuaLibs/PanelSaw.lua | 2 +- NestProcess.lua | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/LuaLibs/PanelSaw.lua b/LuaLibs/PanelSaw.lua index 33eb222..5ddc7c0 100644 --- a/LuaLibs/PanelSaw.lua +++ b/LuaLibs/PanelSaw.lua @@ -28,7 +28,7 @@ local function GetPanelList() PanelList[i].dLength = EgtGetInfo( idMachGroup, 'PANELLEN', 'd') PanelList[i].dWidth = EgtGetInfo( idMachGroup, 'PANELWIDTH', 'd') PanelList[i].dThickness = EgtGetInfo( idMachGroup, 'PANELHEIGHT', 'd') - PanelList[i].sMaterialFullName = EgtGetInfo( idMachGroup, 'MATERIAL', 's') + PanelList[i].sMaterialFullName = EgtGetInfo( idMachGroup, 'MATERIAL', 's') or '0000-MATERIAL' local vMaterialInfo = EgtSplitString( PanelList[i].sMaterialFullName, '-') PanelList[i].idMaterial = vMaterialInfo[1] PanelList[i].idProd = EgtGetInfo( idMachGroup, 'PRODID', 'i') diff --git a/NestProcess.lua b/NestProcess.lua index c318667..dcde14a 100644 --- a/NestProcess.lua +++ b/NestProcess.lua @@ -1719,7 +1719,8 @@ if WD.ENABLE_SIMPLE_NESTING then -- si riordina in base al PDN table.sort( PartList, function(a, b) return tonumber( a.nPdn) < tonumber( b.nPdn) end) - -- per ogni singolo pezzo si creano duplo e machgroup e si settano le note opportune per poi creare i grezzi richiamando la BatchProcessNew (flag 6) + -- per ogni singolo pezzo si chiama la fliprot per avere la migliore orientazione + -- si creano duplo e machgroup e si settano le note opportune per poi creare i grezzi richiamando la BatchProcessNew (flag 6) for i = 1, #PartList do local nPartId = PartList[i].nId @@ -1727,6 +1728,14 @@ if WD.ENABLE_SIMPLE_NESTING then local nPdn = PartList[i].nPdn local bAddCounterToNaming = PartList[i].bAddCounterToNaming + -- si ruotano e invertono i pezzi per avere la migliore posizione di lavorazione + _G.NFAR = {} + NFAR.ERR = 0 + NFAR.MSG = '' + NFAR.PARTID = nPartId + NFAR.BASEDIR = NEST.BASEDIR + dofile( NEST.BASEDIR .. "\\NestFlipAndRotate.lua") + -- informazioni dalla parte originale -- box e relative dimensioni local nBoxLayerId = EgtGetFirstNameInGroup( nPartId, "Box") From dbf668863ada09d95a729f4fc660bdbbad530d3a Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 8 Sep 2025 18:14:37 +0200 Subject: [PATCH 08/10] - NestProcess modificata per riflettere nuovi FLAg da BeamWall - in PanelSaw modificato il nome del file esportato --- LuaLibs/PanelSaw.lua | 4 ++-- NestProcess.lua | 21 ++++++++++++--------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/LuaLibs/PanelSaw.lua b/LuaLibs/PanelSaw.lua index 5ddc7c0..8dd5f4e 100644 --- a/LuaLibs/PanelSaw.lua +++ b/LuaLibs/PanelSaw.lua @@ -314,14 +314,14 @@ function PanelSaw.GenerateCuttingList( sOutputType) for key, PanelListSingleMaterial in pairs( PanelsGroupedByMaterial) do -- path in cui scrivere i file - local sCurrentNgePath = EgtSplitPath( EgtGetCurrFilePath()) + local sCurrentNgePath, sCurrentNgeName = EgtSplitPath( EgtGetCurrFilePath()) if sOutputType then -- costruzione lista istruzioni local LinesToWrite = BuildCuttingList( PanelListSingleMaterial, sOutputType) -- scrittura file - local sFilename = sCurrentNgePath .. 'CutList_' .. key .. '.' .. sOutputType + local sFilename = sCurrentNgePath .. 'CutList-' .. sCurrentNgeName .. '-' .. key .. '.' .. sOutputType local hFile, nFileErr = io.open( sFilename, 'w') if not hFile then EgtOutLog( 'Error creating cutting list : IO error ' .. tostring( nFileErr)) diff --git a/NestProcess.lua b/NestProcess.lua index dcde14a..cad8109 100644 --- a/NestProcess.lua +++ b/NestProcess.lua @@ -18,13 +18,14 @@ NEST.MACH_AREA_USE_OTHER_DIAM = 1 -- 0 NEST.MACH_AREA_OTHER_DIAM = 200 NEST.MACH_AREA_IGNORE_3rdFACE = 1 -- 0 +if NEST.FLAG ~= 11 then + local sLog = 'NestProcess : ' .. NEST.FILE .. ', ' .. NEST.MACHINE .. ', ' .. LEN[1] .. ', ' .. WIDTH[1] + EgtOutLog( sLog) -local sLog = 'NestProcess : ' .. NEST.FILE .. ', ' .. NEST.MACHINE .. ', ' .. LEN[1] .. ', ' .. WIDTH[1] -EgtOutLog( sLog) - --- Cancello file di log specifico -local sLogFile = EgtChangePathExtension( NEST.FILE, '.txt') -EgtEraseFile( sLogFile) + -- Cancello file di log specifico + local sLogFile = EgtChangePathExtension( NEST.FILE, '.txt') + EgtEraseFile( sLogFile) +end -- Imposto direttorio libreria specializzata per Travi EgtAddToPackagePath( NEST.BASEDIR .. '\\LuaLibs\\?.lua') @@ -1688,7 +1689,7 @@ EgtResetCurrMachGroup() -- modalità nesting utile per cabinet: un grezzo per ogni pezzo, pezzo centrato nel grezzo. Il grezzo non viene preso da magazzino ma creato ad hoc, con un dato sovramateriale. -- il numero del MachGroup deve coincidere con il PDN del pezzo originale -if WD.ENABLE_SIMPLE_NESTING then +if NEST.FLAG == 2 then -- sovramateriale richiesto local dOverMaterial = max( 0, NEST.KERF or 2) @@ -1791,10 +1792,12 @@ if WD.ENABLE_SIMPLE_NESTING then EgtOutLog( ' +++ Generating Cutting List') + return - -- TEST +elseif NEST.FLAG == 11 then + + -- TODO gestire tipo di cutting list da generare (PANELSAW) PanelSaw.GenerateCuttingList( 'Cutty') - -- TEST return end From 8d26b20ce4688e5fdd1838360399f6c87d34c93e Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 11 Sep 2025 12:37:07 +0200 Subject: [PATCH 09/10] =?UTF-8?q?-=20in=20NestProcess=20modifiche=20per=20?= =?UTF-8?q?leggere=20la=20modalit=C3=A0=20di=20nesting=20e=20le=20sezionat?= =?UTF-8?q?rici=20per=20cui=20esportare=20da=20WallData?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/PanelSaw.lua | 4 ++-- NestProcess.lua | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/LuaLibs/PanelSaw.lua b/LuaLibs/PanelSaw.lua index 8dd5f4e..052a79d 100644 --- a/LuaLibs/PanelSaw.lua +++ b/LuaLibs/PanelSaw.lua @@ -268,12 +268,12 @@ local function BuildCuttingList( PanelList, sOutputType) end -- Casadei - if sOutputType == 'Cutty' then + if sOutputType == 'CUTTY' then LinesToWrite = BuildCuttingList_Cutty( PanelList, ActualSheetList, ProjectInfo) -- Homag Optimat - elseif sOutputType == 'Homag' then + elseif sOutputType == 'HOMAG' then end diff --git a/NestProcess.lua b/NestProcess.lua index cad8109..ef1904a 100644 --- a/NestProcess.lua +++ b/NestProcess.lua @@ -1689,7 +1689,7 @@ EgtResetCurrMachGroup() -- modalità nesting utile per cabinet: un grezzo per ogni pezzo, pezzo centrato nel grezzo. Il grezzo non viene preso da magazzino ma creato ad hoc, con un dato sovramateriale. -- il numero del MachGroup deve coincidere con il PDN del pezzo originale -if NEST.FLAG == 2 then +if NEST.FLAG ~= 11 and WD.ENABLE_SIMPLE_NESTING then -- sovramateriale richiesto local dOverMaterial = max( 0, NEST.KERF or 2) @@ -1796,8 +1796,11 @@ if NEST.FLAG == 2 then elseif NEST.FLAG == 11 then - -- TODO gestire tipo di cutting list da generare (PANELSAW) - PanelSaw.GenerateCuttingList( 'Cutty') + local vCuttingListType = EgtSplitString( WD.PANELSAW_TYPE) + for i = 1, #vCuttingListType do + local sCuttingListType = vCuttingListType[i] + PanelSaw.GenerateCuttingList( sCuttingListType) + end return end From c91b58b6a186763282fed590daaf56845aa4bfc3 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Tue, 16 Sep 2025 12:24:19 +0200 Subject: [PATCH 10/10] update version e log --- UpdateLog.txt | 3 +++ Version.lua | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/UpdateLog.txt b/UpdateLog.txt index 35e4479..6934276 100644 --- a/UpdateLog.txt +++ b/UpdateLog.txt @@ -1,5 +1,8 @@ ==== Wall Update Log ==== +Versione 2.7i1 (16/09/2025) +- Added : per cabinet aggiunta esportazione cutting list e modalità nesting semplice + Versione 2.7h1 (06/08/2025) - Modif : in LapJoint migliorata scelta lavorazione in caso di feature piccola diff --git a/Version.lua b/Version.lua index eb15608..344c6fb 100644 --- a/Version.lua +++ b/Version.lua @@ -2,5 +2,5 @@ -- Gestione della versione di Wall NAME = 'Wall' -VERSION = '2.7h1' +VERSION = '2.7i1' MIN_EXE = '2.7f2'