- modifiche parziali per creazione cutting list per Casadei
This commit is contained in:
@@ -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
|
||||
+6
-1
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user