eadf2ebe3c
- migliorata gestione manuale aggiunta lavorazioni a gruppo di lavoro.
58 lines
1.7 KiB
Lua
58 lines
1.7 KiB
Lua
-- ManProcOneMachGroup.lua by Egalware s.r.l. 2026/07/25
|
|
-- Creazione delle lavorazioni del MachGroup selezionato
|
|
|
|
-- Intestazioni
|
|
require( 'EgtBase')
|
|
_ENV = EgtProtectGlobal()
|
|
EgtEnableDebug( false)
|
|
|
|
|
|
-- scelta della macchinata da aprire
|
|
local sOpenDirPath = EgtGetStringFromIni( 'Window', 'LastJwdDir', 'C:\\EgtData\\EgtWindowMaker\\Projects', EgtGetIniFile())
|
|
if EgtEndsWith( sOpenDirPath, '\\') then
|
|
sOpenDirPath = sOpenDirPath .. '*.bwe'
|
|
else
|
|
sOpenDirPath = sOpenDirPath .. '\\*.bwe'
|
|
end
|
|
sOpenFilePath = EgtFileDialog( true, sOpenDirPath, "Window MachGroup Files (*.bwe)|*.bwe||")
|
|
if not sOpenFilePath then
|
|
return
|
|
end
|
|
local sDir = EgtSplitPath( sOpenFilePath)
|
|
EgtWriteStringToIni( 'Window', 'LastJwdDir', sDir, EgtGetIniFile())
|
|
|
|
-- eventuale copia dell'originale
|
|
local sOrigFile = EgtChangePathExtension( sOpenFilePath, '.omgr')
|
|
if not EgtExistsFile( sOrigFile) then
|
|
EgtCopyFile( sOpenFilePath, sOrigFile)
|
|
end
|
|
|
|
-- cancello eventuali vecchi file con lo stesso nome
|
|
local vFiles = EgtFindAllFiles( EgtChangePathExtension( sOpenFilePath, '*'))
|
|
for i = 1, #vFiles do
|
|
local sFileToErase = sDir .. vFiles[i]
|
|
if string.upper( sFileToErase) ~= string.upper( sOrigFile) then
|
|
EgtEraseFile( sFileToErase)
|
|
end
|
|
end
|
|
|
|
-- copio l'originale come nuovo file di partenza
|
|
EgtCopyFile( sOrigFile, sOpenFilePath)
|
|
|
|
-- lancio
|
|
local _, sBaseDir = EgtEndsWith( EgtGetSourceDir(), '\\')
|
|
|
|
_G.WIN = { BASEDIR = sBaseDir,
|
|
FILE = sOpenFilePath,
|
|
MACHINE = 'Saomad-Just3500',
|
|
FLAG = 1}
|
|
|
|
-- aggiungo le lavorazioni
|
|
local bOk, sErr = pcall( dofile, sBaseDir .. '\\BatchProcessWin.lua')
|
|
|
|
-- salvo il file
|
|
EgtSaveFile()
|
|
|
|
EgtSetCurrMachGroup()
|
|
EgtZoom( SCE_ZM.ALL)
|