2978b800ae
- semplificazioni e sistemazioni varie per esecuzione manuale.
84 lines
2.6 KiB
Lua
84 lines
2.6 KiB
Lua
-- ManCreateWindow.lua by Egalware s.r.l. 2026/07/27
|
|
-- Creazione serramento 3d da descrizione JWD
|
|
|
|
require( 'EgtBase')
|
|
_ENV = EgtProtectGlobal()
|
|
EgtEnableDebug( false)
|
|
|
|
-- Imposto direttorio per librerie
|
|
local sBaseDir = EgtGetSourceDir() .. 'Designing\\'
|
|
EgtAddToPackagePath( sBaseDir .. '?.lua')
|
|
EgtAddToPackagePath( sBaseDir .. 'WinLib\\' .. '?.lua')
|
|
|
|
_G.package.loaded.WinConst = nil
|
|
_G.package.loaded.WinJWDConst = nil
|
|
_G.package.loaded.WinCreate = nil
|
|
_G.package.loaded.WinCalculate = nil
|
|
_G.package.loaded.WinManageProject = nil
|
|
_G.package.loaded.JSON = nil
|
|
_G.package.loaded.xml2lua = nil
|
|
_G.package.loaded.xml2lua_tree = nil
|
|
|
|
require( 'WinConst')
|
|
local WinManageProject = require( 'WinManageProject')
|
|
local WinCalculate = require( 'WinCalculate')
|
|
|
|
|
|
local sOpenFilePath = ''
|
|
-- verifico se lanciato file in batch per test
|
|
if WINDOW and WINDOW.FILE then
|
|
sOpenFilePath = WINDOW.FILE
|
|
-- oppure in interattivo
|
|
else
|
|
-- se voglio aprire ultima finestra generata
|
|
if EgtGetKeyPressed( GEN_VK.SHIFT) then
|
|
local sLastWinPath = EgtGetStringFromIni( 'Window', 'LastWin', '', EgtGetIniFile())
|
|
if not EgtExistsFile( sLastWinPath) then
|
|
EgtOutBox( 'Non esiste Finestra corrente', 'Crea Serramento - Window', 'INFO', 'OK')
|
|
return
|
|
end
|
|
EgtOpenFile( sLastWinPath)
|
|
EgtZoom( SCE_ZM.ALL)
|
|
return
|
|
-- altrimenti apro dialogo di scelta file JWD
|
|
else
|
|
local sOpenDirPath = 'C:\\EgtData\\EgtWindowMaker\\Projects\\*.jwd'
|
|
sOpenFilePath = EgtFileDialog( true, sOpenDirPath, "Window Project Files (*.jwd)|*.jwd||")
|
|
if not sOpenFilePath then
|
|
return
|
|
end
|
|
end
|
|
end
|
|
|
|
EgtNewFile()
|
|
|
|
local sProfileDir = EgtGetStringFromIni( 'Window', 'ProfileDir', 'C:\\EgtData\\EgtWindowMaker\\Profiles', EgtGetIniFile())
|
|
if not WinManageProject.ReadFromFile( sOpenFilePath, sProfileDir) then
|
|
return
|
|
end
|
|
|
|
local sFilePath = EgtChangePathExtension( sOpenFilePath, 'nge')
|
|
EgtSetCurrFilePath( sFilePath)
|
|
|
|
-- imposto se calcolare i solidi o meno
|
|
WinCalculate.SetCalcSolid( true)
|
|
--WinCalculate.SetCalcPreview( true)
|
|
|
|
-- creo i pezzi
|
|
local nFrameId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_AREA .. '*')
|
|
WinCalculate.CreatePartFromArea( nFrameId)
|
|
WinCalculate.AddHardware( nFrameId, true, false, false, false)
|
|
WinCalculate.AddAccessories( nFrameId, true)
|
|
|
|
-- elimino profilo se in batch per test
|
|
if WINDOW and WINDOW.TEST == 1 then
|
|
local nProfileGroupId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE)
|
|
if nProfileGroupId and nProfileGroupId ~= GDB_ID.NULL then
|
|
EgtErase( nProfileGroupId)
|
|
end
|
|
else
|
|
EgtSaveFile()
|
|
EgtZoom( SCE_ZM.ALL)
|
|
EgtWriteStringToIni( 'Window', 'LastWin', sFilePath, EgtGetIniFile())
|
|
end
|