Window 3.1g3 :

- semplificazioni e sistemazioni varie per esecuzione manuale.
This commit is contained in:
Dario Sassi
2026-07-27 20:01:09 +02:00
parent 685b363859
commit 2978b800ae
5 changed files with 70 additions and 40 deletions
+41 -23
View File
@@ -7,44 +7,62 @@ _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
-- Verifico che il progetto sia un serramento
local nAreaId = EgtGetFirstNameInGroup( GDB_ID.ROOT, 'Area(Frame)')
if not nAreaId then
EgtOutBox( 'Caricare il progetto di una finestra', 'Lavora Una Macchinata - Window', 'INFO', 'OK')
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)
-- Verifico che il progetto contenga già le macchinate
if not EgtGetFirstMachGroup() then
EgtOutBox( 'Preparare le macchinate della finestra', 'Lavora Una Macchinata - Window', 'INFO', 'OK')
return
end
-- cancello eventuali vecchi file con lo stesso nome
local vFiles = EgtFindAllFiles( EgtChangePathExtension( sOpenFilePath, '*'))
-- dati generali del progetto
local sWinPath = EgtGetCurrFilePath()
local sDir = EgtSplitPath( sWinPath)
-- Scelta della macchinata da lavorare
local sMGrpList
local nMGrpId = EgtGetFirstMachGroup()
while nMGrpId do
local sMGrpName = EgtGetMachGroupName( nMGrpId)
local sDone = ''
if EgtExistsFile( sDir .. sMGrpName .. '.bwe') then
sDone = ' [===]'
end
if not sMGrpList then
sMGrpList = 'CB:' .. sMGrpName .. sDone
else
sMGrpList = sMGrpList .. ',' .. sMGrpName .. sDone
end
nMGrpId = EgtGetNextMachGroup( nMGrpId)
end
local vRes = EgtDialogBox( 'Lavora Una Macchinata - Window', { 'Macchinata', sMGrpList})
if not vRes or #vRes < 1 then
return
end
local sMGrpName = EgtReplaceString( vRes[1], ' [===]', '')
-- cancello tutti i file del direttorio con il nome della macchinata
local vFiles = EgtFindAllFiles( sDir .. sMGrpName .. '.*') or {}
for i = 1, #vFiles do
local sFileToErase = sDir .. vFiles[i]
if string.upper( sFileToErase) ~= string.upper( sOrigFile) then
EgtEraseFile( sFileToErase)
end
EgtEraseFile( sFileToErase)
end
-- copio l'originale come nuovo file di partenza
EgtCopyFile( sOrigFile, sOpenFilePath)
-- salvo la macchinata scelta in un nuovo file
local sMGrpPath = sDir .. sMGrpName .. '.bwe'
EgtSaveMachGroupToFile( EgtGetMachGroupId( sMGrpName), sMGrpPath)
-- lancio
local _, sBaseDir = EgtEndsWith( EgtGetSourceDir(), '\\')
sBaseDir = sBaseDir .. '\\CAMAuto'
_G.WIN = { BASEDIR = sBaseDir,
FILE = sOpenFilePath,
FILE = sMGrpPath,
MACHINE = 'Saomad-Just3500',
FLAG = 1}