80 Commits

Author SHA1 Message Date
Annamaria Sassi 0fdeaaf619 CAMAuto :
correzione per evitare doppio spostamento pezzo nel grezzo.
2026-05-06 09:09:14 +02:00
SaraP 65e0b550c6 DataWindow :
- cambio profilo su split
- sistemata identificazione dei cambi profilo dopo gli spostamenti degli outlines degli split per misura luce
- preview con pezzi dello stesso colore.
2026-04-23 15:39:35 +02:00
Annamaria Sassi e05890f9a8 DataWindow :
- correzione numero area.
2026-04-14 14:39:06 +02:00
SaraP 52cc15686e DataWindow :
- lettura inglesina da jwd.
2026-04-13 11:01:29 +02:00
SaraP 52853e953c DataWindow
- inglesine.
2026-04-07 09:53:11 +02:00
SaraP f8eab3581c DataWindow :
- gestione dei pezzi di ante troppo piccoli che scompaiono
- correzione nel calcolo outline sash e fill nel caso di cambio profilo
- migliorie nel calcolo solidi e lavorazioni.
2026-04-01 09:19:23 +02:00
Annamaria Sassi 1ff7a583fa DataWindow :
- corretto passaggio dimensione elementi per split.
2026-02-23 14:39:18 +01:00
Annamaria Sassi ff953deaff CAMAuto :
- Raggruppate funzioni riguardati i pezzi in PartData.
2026-02-20 09:55:15 +01:00
andrea.villa e623f2d789 Nuova versione BatchProcess:
- gestione WIN.FLAG ( per ora valori ammessi 0, 1 e 2)
- Cancellato funzioni non più utilizzate
- Aggiunta nuove funzioni scrittura file di log
- Aggiunta stima tempi
2026-02-19 09:33:25 +01:00
Emmanuele Sassi f793af4d44 - aggiunto passaggio dati da script web
- modificato process che non crea più il grezzo ma utilizza quello presente
2026-02-17 10:43:28 +01:00
Annamaria Sassi 12b5794e49 - Aggiunto caricamento librerie in CreateMachGroups
- Piccola correzione in WinLib
2026-02-12 18:34:41 +01:00
Annamaria Sassi f2b05d3fd7 DataWindow :
- modifica a WinGetAreaProfiles per cambiare valore di default EntId per split non a griglia.
2026-02-12 12:18:03 +01:00
SaraP 5f8a44aecc DataWindow :
- modifica a GetProfileData per overlap ante battenti/riceventi.
2026-02-11 09:40:07 +01:00
SaraP 315a6159fe DataWindow :
- aggiornato il main per ultime modifiche.
2026-02-10 17:04:53 +01:00
Annamaria Sassi c5ce236cf7 DataWindow :
- correzione creazione split.
2026-02-10 16:03:51 +01:00
SaraP ad8eec53e0 DataWindow :
- dimensioni degli split date come luce o esterno anta
- aree split orizzontali ordinate dal basso all'alto ( e non più dall'alto al basso)
- dimensioni dei pezzi di split a griglia differenziate per direzioni e non per pezzi.
2026-02-09 12:52:24 +01:00
andrea.villa 3c04c2ae7b Merge branch 'CreateMachGroups' 2026-02-06 11:29:01 +01:00
andrea.villa cba228c626 - Corrette chiamate alle funzioni, si passano solo i pezzi del gruppo
- Piccole migliorie varie
2026-02-06 10:49:06 +01:00
andrea.villa 49d7bccb41 Prima versione (non funzionante) script creazione gruppi 2026-02-03 13:00:44 +01:00
SaraP 057fb91994 DataWindow :
- correzione a SetAreaProfiles.
2026-02-02 17:08:47 +01:00
SaraP d709c374e6 DataWindow :
- aggiunte info per le lavorazioni.
2026-02-02 15:51:36 +01:00
andrea.villa 106c373b52 Prima versione script BatchProcess per automatismo.
NOTE:
- Per ora apre SEMPRE il file C:\\Temp\\Window.nge
- Legge sempre i primi 2 pezzi
- I pezzi vengono riconosciuti in base alla lettura di una nota
La gestione è da rivedere
2026-02-02 09:37:18 +01:00
Annamaria Sassi 73a5ad4507 DataWindow :
- lettura da jwd bottom rail con dimensioni variabili.
2026-01-29 16:34:49 +01:00
Annamaria Sassi f04a6f72c5 DataWindow :
- lettura da jwd pezzi con dimensioni variabili.
2026-01-29 14:56:44 +01:00
SaraP d8d34552e9 DataWindow :
- pezzi con dimensioni variabili ( prima versione).
2026-01-29 12:25:25 +01:00
SaraP b8b10497a7 DataWindow :
- in WinGetAreaProfiles aggiunta gestione degli split.
2026-01-28 15:43:21 +01:00
SaraP 68425bd133 DataWindow :
- piccola modifica a WinGetAreaProfiles per uniformare caso telaio a caso anta.
2026-01-28 11:43:08 +01:00
SaraP d0398e9d5d DataWindow :
- correzioni a WinGetAreaProfiles.
2026-01-26 15:27:01 +01:00
SaraP b27b0e6bf6 DataWindow :
- aggiunta funzione che restituisce i profili dei vari pezzi di un'area telaio o anta.
2026-01-23 12:47:10 +01:00
SaraP c2946b8d9c DataWindow :
- aggiunta funzione che ricava dati dai profili.
2026-01-21 14:49:57 +01:00
SaraP f39063d4d2 DataWindow :
- correzione nel calcolo dei solidi di lavorazione.
2026-01-14 13:13:05 +01:00
Dario Sassi 402400353b Window 3.1a1 :
- aggiunta gestione versione con relativo file
2026-01-14 11:23:07 +01:00
SaraP a85a50d7c1 DataWindow :
- modificato nome file WinConst in CAMAuto per evitare conflitto con Designing
- sistemato caricamento librerie.
2026-01-14 09:28:10 +01:00
Dario Sassi f70604fd6c DataWindow :
- aggiunte immagini e INI per bottoni CAM5.
2026-01-13 19:22:25 +01:00
SaraP b648385b60 DataWindow :
- nell'apertura di un jwd impostato il percorso del file nge allo stesso path cartella del jwd.
2026-01-13 16:36:05 +01:00
SaraP 228d6d4cb3 DataWindow :
- in WinOpenProjectFile riabilitato calcolo ferramenta.
2026-01-13 16:17:19 +01:00
SaraP fee697d330 DataWindow :
- modifiche alla soglia per gestire meglio la preview degli split che terminano sulla soglia.
2026-01-12 14:35:57 +01:00
SaraP 182f5c91db DataWindow :
- correzioni e migliorie nel calcolo delle lavorazioni e dei solidi quando vi è taglio con più pezzi
- correzione estensione archi.
2026-01-12 12:23:44 +01:00
SaraP ce91996f40 DataWindow :
- correzione errore soglia.
2026-01-07 10:13:27 +01:00
SaraP 499ff1f245 DataWindow :
- aggiunta preview soglia.
2025-12-22 12:12:15 +01:00
SaraP c8a7fa0c11 DataWindow :
- gestione di cambio profilo che coinvolge più pezzi ( prima versione).
2025-12-22 11:03:38 +01:00
Annamaria Sassi 17bb7b06ba DataWindow:
- aggiunta lettura threshold da jwd.
2025-12-22 10:36:54 +01:00
SaraP a459c31537 DataWindow :
- migliorie nella preview per casi di profili con ante e telai allineati.
2025-12-17 11:18:51 +01:00
Annamaria Sassi 984ea28304 DataWindow : correzione mancato valore altezza maniglia da opzioni 2025-12-03 17:54:56 +01:00
Annamaria Sassi f20ff953d0 DataWindow :
- correzione tipo dimensione.
2025-12-02 16:36:50 +01:00
Annamaria Sassi f81856f523 DataWindow :
- gestione errore dimensioni telaio.
2025-12-02 15:22:52 +01:00
SaraP a77901fcc3 DataWindow :
- nella creazione degli split aggiunto measure type per ogni valore.
2025-12-02 14:47:42 +01:00
SaraP 36691a7e06 DataWindow :
- correzione errore giunzione a 45°.
2025-12-02 11:59:55 +01:00
SaraP 7564dbdc0b DataWindow :
- correzione errore nella preview con soglia
- migliora nella preview maniglia.
2025-12-02 10:25:56 +01:00
SaraP 46bf9740e5 DataWindow :
- sistemate giunzioni angled per casi di archi e di profili diversi.
2025-12-01 12:19:52 +01:00
Annamaria Sassi 6cee6e52ab DataWindow: in lettura jwd per gli split letto il tipo di misura per le dimensioni. 2025-11-26 16:41:39 +01:00
Annamaria Sassi 65d7bcec33 DataWindow: correzione lettura joint anta singola 2025-11-19 16:21:15 +01:00
Annamaria Sassi 1f3db97f73 DataWindow: spostati joint nelle singole ante 2025-11-19 15:11:48 +01:00
Annamaria Sassi a090d17e07 DataWindow: correzione calcolo dimensioni ante 2025-11-18 18:11:45 +01:00
SaraP 15e3bf7921 DataWindow :
- in lettura jwd per le ante letto il tipo di misura per le dimensioni.
2025-11-17 16:55:07 +01:00
SaraP a79836db69 DataWindow :
- estensione in tangenza per pezzi ad arco nel caso di giunzioni problematiche.
2025-11-17 15:49:47 +01:00
SaraP b1d85c173b DataWindow :
- spostato calcolo del GeoRaw per pezzi ad arco nel calcolo tronchetti
- correzione nel calcolo fill outline per cambio profilo.
2025-11-05 10:02:56 +01:00
SaraP 77fa6641b1 DataWindow :
- aggiunti controlli sulle dimensioni nella creazione di telai ad arco.
2025-11-04 14:39:36 +01:00
Emmanuele Sassi b0259acf2f - cambiato nome arco a tre centri 2025-11-04 12:16:09 +01:00
SaraP 67589d44ef DataWindow :
- arco a 3 centri
- migliorie e correzioni varie per gestire correttamente l'arco a 3 centri ( calcolo solidi, strip, outline del fill).
2025-11-04 11:41:44 +01:00
SaraP 109f43c927 DataWindow :
- correzioni connesione Redis locale.
2025-11-03 11:52:49 +01:00
Emmanuele Sassi 212360c666 - aggiunto funzionamento Redis con connessione sia globale che locale 2025-11-03 10:37:19 +01:00
SaraP f5aae593e1 DataWindow :
- aggiunta lettura opzioni ferramenta da jwd
- sistemate costanti jwd.
2025-10-31 09:02:17 +01:00
SaraP 00c660811d DataWindow :
- correzione calcolo ferramenta per ante multiple.
2025-10-30 16:52:11 +01:00
SaraP 66d41f20a3 DataWindow :
- corretta lettura ferramenta da jwd nel caso di ante multiple.
2025-10-30 15:46:12 +01:00
Emmanuele Sassi d29ecc5a84 - eliminato doppio richiamo hardware
- allungato timeout attesa dati da hardware
- commentata connessione redis per hardware
2025-10-30 11:31:18 +01:00
SaraP bb291d6101 DataWindow :
- AddHardwareByGroupId ora riceve più valori di area number.
2025-10-29 13:04:35 +01:00
SaraP cf8065e226 DataWindow :
- aggiunta funzione per calcolo ferramenta a partire dal numero dell'area e non dal suo id geometrico.
2025-10-29 12:32:39 +01:00
SaraP 6434b264fa DataWindow :
- sistemate forme ante.
2025-10-24 08:24:17 +02:00
SaraP 1d14ff1535 DataWindow :
- sistemato calcolo della ferramenta con preferito nullo '000000'.
2025-10-23 12:18:25 +02:00
SaraP 5d9fad7e3a DataWindow :
- modificata funzione WinGetSashShape per ricevere più aree.
2025-10-23 10:59:44 +02:00
SaraP f04367e529 DataWindow :
- sistemate costanti.
2025-10-23 10:26:45 +02:00
SaraP 407e32d6b0 DataWindow :
- se non definita altezza maniglia, richiesta delle opzioni della ferramenta per ricavarne valore di default
- aggiunta forma dell'anta.
2025-10-21 10:04:35 +02:00
Annamaria Sassi 0173df493d DataWindow :
- connessione Redis per ferramenta.
2025-10-16 14:40:50 +02:00
SaraP 5e4a0b2cb1 DataWindow :
- modifiche per uniformare struttura jwd con struttura del progetto
- gestione numerazione delle aree
- correzioni varie.
2025-10-15 13:01:06 +02:00
Annamaria Sassi 665ad78c87 DataWindow :
- correzione.
2025-10-06 16:52:26 +02:00
SaraP 6c075e9053 DataWindow :
- correzioni varie per casi di split contro 2 pezzi o che comportano cambio di forma
- nuova gestione calcolo fermavetri.
2025-10-06 15:25:27 +02:00
Annamaria Sassi 75be8c4864 Merge branch 'develop' 2025-10-03 11:43:07 +02:00
SaraP 100db4fb90 DataWindow :
- piccola correzione.
2025-09-25 11:07:09 +02:00
SaraP afe6afc961 DataWindow :
- in preview aggiunte apertura ante e ferramenta
- correzione preview e disegno aperture con bottomrails.
2025-09-25 09:49:14 +02:00
19 changed files with 9999 additions and 5474 deletions
+354
View File
@@ -0,0 +1,354 @@
-- BatchProcessNew.lua by Egalware s.r.l. 2026/02/09
-- Applicazione lavorazioni, simulazione, generazione e stima
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-- TODO DA CANCELLARE!!!! quando verrà passato automaticamente da programma
--local WIN = {}
--WIN.BASEDIR = 'C:\\EgtData\\Window\\CAMAuto'
--WIN.FILE = 'C:\\Temp\\TestSerramenti\\4.bwe'
--WIN.MACHINE = 'Saomad-Just3500'
--WIN.FLAG = 2
-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-- Imposto direttorio libreria specializzata per serramenti
EgtAddToPackagePath( WIN.BASEDIR .. '\\LuaLibs\\?.lua')
-- Imposto direttorio strategie. N.B. Le strategie dovranno essere caricate con il nome del direttorio padre
EgtAddToPackagePath( WIN.BASEDIR .. '\\Strategies\\?.lua')
-- carico il progetto
EgtOpenFile( WIN.FILE)
local nMachGroupId = EgtGetFirstMachGroup()
if not nMachGroupId then
EgtOutLog( 'Errore! Nessun gruppo di lavorazione presente!')
return
end
EgtSetCurrMachGroup( nMachGroupId)
-- controlli preliminari
local sMachDir = EgtGetCurrMachineDir()
local sMachine = WIN.MACHINE
EgtResetCurrMachGroup()
if not sMachDir then
WIN.ERR = 11
WIN.MSG = 'Errore nel caricamento della macchina corrente'
WriteErrToLogFile( WIN.ERR, WIN.MSG)
return
end
if not EgtExistsFile( sMachDir .. '\\Window\\WinData.lua') then
WIN.ERR = 11
WIN.MSG = 'La macchina corrente non è configurata per lavorare serramenti'
WriteErrToLogFile( WIN.ERR, WIN.MSG)
return
end
if not EgtSetCurrMachine( sMachine) then
WIN.ERR = 11
WIN.MSG = 'Error selecting machine : ' .. sMachine
WriteErrToLogFile( WIN.ERR, WIN.MSG)
return
end
local sTxtLogFile = EgtChangePathExtension( WIN.FILE, '.txt')
-- Elimino direttori altre macchine e imposto direttorio macchina corrente per ricerca librerie
EgtRemoveBaseMachineDirFromPackagePath()
EgtAddToPackagePath( sMachDir .. '\\Window\\?.lua')
-- Segnalazione avvio
EgtOutLog( '*** Window Process Start ***', 1)
-- Carico le librerie
_G.package.loaded.WinData = nil
_G.package.loaded.WinExec = nil
_G.package.loaded.WinLib = nil
_G.package.loaded.FeatureData = nil
_G.package.loaded.MachiningLib = nil
local WinExec = require( 'WinExec')
local WinLib = require( 'WinLib')
local JSON = require( 'JSON')
local PartData = require( 'PartData')
-- Carico i dati globali
local WinData = require( 'WinData')
-- Variabili globali
PARTS = {} -- tabella contenente tutte le informazioni di ogni pezzo
-------------------------------------------------------------------------------------------------------------
local function GetDataConfig()
-- recupero utensili dal magazzino
WinExec.GetToolsFromDB()
-- TODO da gestire eventuali errori bloccanti
return true
end
-------------------------------------------------------------------------------------------------------------
-- scrittura JSON risultati
-- TODO da migliorare/completare
local function WriteResultToJson( RESULT)
local sData = JSON:encode_pretty( RESULT)
-- Salvataggio e visualizzazione tabella
local sOutFile = EgtChangePathExtension( WIN.FILE, '.json')
local DestFh = io.open( sOutFile, 'w+')
if not DestFh then
EgtOutBox( 'Error opening ' .. sOutFile, 'TestJson', 'ERROR')
return false
end
DestFh:write( sData)
DestFh:close()
return true
end
-------------------------------------------------------------------------------------------------------------
local function WriteErrToLogFile( nErr, sMsg, nRot, idCut, idTask)
local hFile = io.open( sTxtLogFile, 'a')
hFile:write( 'ERR=' .. tostring( nErr) .. '\n')
hFile:write( sMsg .. '\n')
hFile:write( 'ROT=' .. tostring( nRot or 0) .. '\n')
hFile:write( 'CUTID=' .. tostring( idCut or 0) .. '\n')
hFile:write( 'TASKID=' .. tostring( idTask or 0) .. '\n')
hFile:close()
end
local function WriteTimeToLogFile( dTime)
local hFile = io.open( sTxtLogFile, 'a')
hFile:write( 'TIME=' .. EgtNumToString( dTime) .. '\n')
hFile:close()
end
-------------------------------------------------------------------------------------------------------------
-- *** Recupero i pezzi da processare ***
-------------------------------------------------------------------------------------------------------------
local function MyProcessInputData()
local nId = EgtGetFirstPart()
while nId do
-- TODO caricare il file di costanti
-- si processano solo BOTTOMRAIL (WIN_PART_TYPES.BOTTOMRAIL = 2) o STANDARD (WIN_PART_TYPES.STD = 3)
if EgtGetInfo( nId, 'PART_TYPE', 'd') == 2 or EgtGetInfo( nId, 'PART_TYPE', 'd') == 3 then
table.insert( PARTS, { id = nId, sName = ( EgtGetName( nId) or ( 'Id=' .. tonumber( nId)))})
end
nId = EgtGetNext( nId)
end
PartData.GetDimensionPart( PARTS)
EgtDeselectAll()
return true
end
-------------------------------------------------------------------------------------------------------------
-- *** Inserimento dei pezzi nel grezzo ***
-------------------------------------------------------------------------------------------------------------
local function MyProcessPieces()
-- recupero macchinata (è sempre la prima e ce n'è solo una)
local nMachGroup = EgtGetFirstMachGroup()
EgtSetCurrMachGroup( nMachGroup)
for i = 1, #PARTS do
PARTS[i].idRaw = EgtGetRawPartFromPart( PARTS[i].id)
end
-- aggiungo sovramateriale ai grezzi
PartData.AddOverMaterialToRaw( PARTS)
-- recupero offset per posizionamento
for i = 1, #PARTS do
PARTS[i].DispOffsets = {}
PARTS[i].DispOffsets.Phase1 = {}
PARTS[i].DispOffsets.Phase2 = {}
local bInsertedAllOffs = PartData.GetDispOffsetFromNotes( PARTS, i)
-- se non sono stati inseriti o c'è stato un errore esco subito
if not bInsertedAllOffs then
EgtOutBox( 'Errore offset non trovati', 'BatchProcessWin', 'ERROR', 'OK')
return false
end
end
-- si dispongono i pezzi sulla tavola
local bDispOk, sErr = WinData.AdjustDisposition( PARTS)
if not bDispOk then
if not sErr then
sErr = 'Errore non gestito in WinData.AdjustDisposition'
end
EgtOutBox( sErr, 'BatchProcessWin', 'ERROR', 'OK')
return false
end
-- Impostazione dell'attrezzaggio di default
local bOk = EgtImportSetup()
if not bOk then
EgtImportSetup( 'Default')
end
return true
end
-------------------------------------------------------------------------------------------------------------
-- *** Esecuzione ***
-------------------------------------------------------------------------------------------------------------
-- WIN.FLAG :
-- 0 = generazione e stima, esegue solo un aggiornamento (eventuale) delle lavorazioni
-- 1 = da processare completamente, applicazione lavorazioni, simulazione, generazione e stima
-- 2 = da processare in preverifica, applicazione lavorazioni e stima
-- In generale va completamente riprocessato
local bToProcess = true
local bToRecalc = false
local bCheckNoSim = false
-- se il progetto deve essere completamente riprocessato
if WIN.FLAG == 1 then
bToProcess = true
-- se deve essere fatta la preverifica, senza simulazione
elseif WIN.FLAG == 2 then
bToProcess = true
bCheckNoSim = true
-- altrimenti solo aggiornato (se necessario)
else
bToProcess = false
end
local sLog = 'BatchProcess : ' .. WIN.FILE .. ', ' .. ( WIN.MACHINE or EgtGetCurrMachineName()) .. ', ' .. 'FLAG='..tostring( WIN.FLAG)
EgtOutLog( sLog)
-- se bisogna processare
if bToProcess then
-- Se da elaborare
EgtOutLog( ' +++ Processing Parts >>>')
-- nascondo geometrie varie
local vAuxId = { EgtGetFirstNameInGroup( GDB_ID.ROOT, 'Profile'), EgtGetFirstNameInGroup( GDB_ID.ROOT, 'Area*'), EgtGetFirstNameInGroup( GDB_ID.ROOT, 'Aux')}
EgtSetStatus( vAuxId, GDB_ST.OFF)
if not MyProcessInputData() then return end
if not MyProcessPieces() then return end
if not GetDataConfig() then return end
-- Abilito Vmill
EgtSetInfo( EgtGetCurrMachGroup(), 'Vm', '1')
WinExec.ProcessFeatures( PARTS)
-- Imposto Nome file CN
local _, sName, _ = EgtSplitPath( WIN.FILE)
EgtSetInfo( EgtGetCurrMachGroup(), 'NcName', sName .. '.cnc')
-- Salvo il progetto
EgtSaveFile( WIN.FILE)
-- altrimenti è solo da ricalcolare (eventualmente)
else
-- se cambiata configurazione macchina da ultima elaborazione, devo aggiornare
if EgtCompareFilesLastWriteTime( WIN.FILE, sMachDir .. '\\Tools\\Tools.data') == -1 or
EgtCompareFilesLastWriteTime( WIN.FILE, sMachDir .. '\\' .. sMachine ..'.mlde') == -1 then
bToRecalc = true
end
EgtOutLog( ' +++ Loading Project already processed >>>')
-- Passo in modalità lavora
EgtSetCurrMachGroup( EgtGetLastMachGroup())
-- Se necessario eseguo aggiornamento con setup corrente e ricalcolo delle lavorazioni
if bToRecalc then
EgtOutLog( ' +++ Recalculating all dispositions and machinings >>>')
EgtImportSetup()
EgtApplyAllMachinings()
-- Salvo il progetto
EgtSaveFile( WIN.FILE)
end
end
-- se è da riprocessare o da ricalcolare, si lancia simulazione e calcolo stima tempi
if bToProcess or bToRecalc then
-- simulazione e generazione eseguiti se non è la pre-verifica per stima tempi
if not bCheckNoSim then
-- *** Eseguo simulazione con verifica collisione in cieco ***
local bSimOk, nErr, sErr = EgtSimulate()
if not bSimOk then
if nErr == MCH_SHE.INIT then
WIN.ERR = 19
WIN.MSG = 'Error starting simulation'
elseif nErr == MCH_SHE.COLLISION then
WIN.ERR = 22
WIN.MSG = 'Head-part collision'
elseif nErr == MCH_SHE.OUTSTROKE then
WIN.ERR = 23
WIN.MSG = 'Axis outstroke ' .. sErr
elseif nErr == MCH_SHE.SPECIAL then
WIN.ERR = 24
WIN.MSG = 'Special error ' .. sErr
else
WIN.ERR = 25
WIN.MSG = 'General failure (contact supplier)'
end
WIN.ROT = 0
WIN.CUTID = 0
WIN.TASKID = 0
local vItem = EgtSplitString( sErr, ';') or {}
for i = 1, #vItem do
vItem[i] = EgtTrim( vItem[i] or '')
if string.find( vItem[i], 'CUTID', 1, true) then
WIN.CUTID = EgtGetVal( vItem[i], 'CUTID', 'i') or 0
elseif string.find( vItem[i], 'TASKID', 1, true) then
WIN.TASKID = EgtGetVal( vItem[i], 'TASKID', 'i') or 0
end
end
WriteErrToLogFile( WIN.ERR, WIN.MSG, WIN.ROT, WIN.CUTID, WIN.TASKID)
-- TODO gestire collisione su feature specifica!!!!!!!!!!!!!!!!!!!!!!!!!!!!
WinExec.AddApplyResultToGlobalList( WIN.ERR, WIN.CUTID, WIN.MSG)
WIN.RESULT = WinLib.TableCopyDeep( RESULT)
WriteResultToJson( RESULT)
return
end
end
end
-- *** Genero programma CN *** ( se richiesto)
local bIsGenerationEnabled = ( EgtVerifyKeyOption( 110) == false)
if bIsGenerationEnabled then
EgtOutLog( ' +++ Generating NC part program >>>')
-- TODO gestire generazione
end
-- *** Eseguo stima tempi ***
EgtOutLog( ' +++ Estimating T&L >>>')
if not EgtEstimate( '', 'EgtCAM5 - ' .. WIN.FILE) then
WIN.ERR = 21
WIN.MSG = 'Error estimating production time : ' .. WIN.FILE
WriteErrToLogFile( WIN.ERR, WIN.MSG)
WinExec.AddApplyResultToGlobalList( WIN.ERR, 0, WIN.MSG)
WIN.RESULT = WinLib.TableCopyDeep( RESULT)
WriteResultToJson( RESULT)
return
end
local Ttot = EgtGetInfo( EgtGetCurrMachGroup(), 'Ttot', 'd')
local sTime = 'Total Time = ' .. EgtNumToString( Ttot, 1)
EgtOutLog( sTime)
-- Scrittura tempo totale stimato di lavorazione
WriteTimeToLogFile( Ttot)
RESULT[#RESULT+1] = { dTime = Ttot, sType = 'Time'}
-- Riporto risultati in tabella globale WIN
WIN.RESULT = WinLib.TableCopyDeep( RESULT)
-- Scrittura json risultati
WriteResultToJson( RESULT)
EgtOutLog( ' +++ BatchProcess completed')
+332
View File
@@ -0,0 +1,332 @@
-- CreateMachGroups.lua by Egalware s.r.l. 2026/02/09
-- Creazione dei MachGroup del file già aperto
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-- TODO DA CANCELLARE!!!! quando verrà passato automaticamente da programma
--local WIN = {}
--WIN.MACHINELIST = {}
--WIN.MACHINELIST[1] = 'Saomad-Just3500'
--WIN.OPT_TYPE = 'WINDOW'
-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
--Libero eventuali librerie rimaste caricate
_G.package.loaded.WinData = nil
_G.package.loaded.WinLib = nil
-- Verifico che la macchina corrente sia abilitata per la lavorazione delle finestre
if not WIN.MACHINELIST or #WIN.MACHINELIST == 0 or #WIN.MACHINELIST[1] == 0 then
EgtOutLog( 'Errore! Macchina non impostata!')
return
end
if not EgtSetCurrMachine( WIN.MACHINELIST[1]) then
EgtOutLog( 'Errore! Macchina impostata non trovata!')
return
end
local sMachDir = EgtGetCurrMachineDir()
if not sMachDir then
EgtOutBox( 'Errore nel caricamento della macchina corrente', 'Lavora Serramenti', 'ERROR')
return
end
if not EgtExistsFile( sMachDir .. '\\Window\\WinData.lua') then
EgtOutBox( 'La macchina corrente non è configurata per lavorare serramenti', 'Lavora Serramenti', 'ERROR')
return
end
-- Elimino direttori altre macchine e imposto direttorio macchina corrente per ricerca librerie
EgtRemoveBaseMachineDirFromPackagePath()
EgtAddToPackagePath( sMachDir .. '\\Window\\?.lua')
-- Segnalazione avvio
EgtOutLog( '*** Window Process Start ***', 1)
-- Carico le librerie
EgtAddToPackagePath( EgtGetSourceDir() .. 'LuaLibs\\?.lua')
local WinLib = require( 'WinLib')
local PartData = require( 'PartData')
-- Carico i dati globali
local WinData = require( 'WinData')
-- Variabili globali
PARTS = {}
GROUPS = {}
-- Colore del grezzo
local ColA = Color3d( 255, 165, 0, 30)
-------------------------------------------------------------------------------------------------------------
-- *** Recupero i pezzi da processare ***
-------------------------------------------------------------------------------------------------------------
local function GetInfoPieces()
-- Recupero i pezzi delle finestre
local nId = EgtGetFirstPart()
while nId do
-- TODO caricare il file di costanti
-- si processano solo BOTTOMRAIL (WIN_PART_TYPES.BOTTOMRAIL = 2) o STANDARD (WIN_PART_TYPES.STD = 3)
if EgtGetInfo( nId, 'PART_TYPE', 'd') == 2 or EgtGetInfo( nId, 'PART_TYPE', 'd') == 3 then
table.insert( PARTS, { id = nId, sName = ( EgtGetName( nId) or ( 'Id=' .. tonumber( nId)))})
end
nId = EgtGetNextPart( nId)
end
if #PARTS == 0 then
EgtOutBox( 'Non ci sono pezzi', 'Lavora Pezzi', 'ERROR')
return false
else
-- recupero tutte le dimensioni necessarie
local sOut = ''
for i = 1, #PARTS do
PARTS[i].b3Raw = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[i].id, 'GeoRaw') or GDB_ID.NULL, GDB_BB.STANDARD)
local idFrame = EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( PARTS[i].id, 'GeoRaw'), 'AuxFrame')
PARTS[i].frame = EgtFR( idFrame)
-- recupero offset per posizionamento
PARTS[i].DispOffsets = {}
PARTS[i].DispOffsets.Phase1 = {}
PARTS[i].DispOffsets.Phase2 = {}
local bInsertedAllOffs = PartData.GetDispOffsetFromNotes( PARTS, i)
-- recupero info profili
PARTS[i].SemiProfiles = {}
table.insert( PARTS[i].SemiProfiles, EgtGetInfo( PARTS[i].id, 'PROFILE_IN', 's') or '')
table.insert( PARTS[i].SemiProfiles, EgtGetInfo( PARTS[i].id, 'PROFILE_OUT', 's') or '')
table.insert( PARTS[i].SemiProfiles, EgtGetInfo( PARTS[i].id, 'PROFILE_LEFT', 's') or '')
table.insert( PARTS[i].SemiProfiles, EgtGetInfo( PARTS[i].id, 'PROFILE_RIGHT', 's') or '')
-- TODO info deve essere passata da programma
-- recupero info finestra
PARTS[i].sWindow = EgtGetInfo( PARTS[i].id, 'WIN_ID', 's') or ''
-- TODO è lo stesso del PART_TYPE o serve altro??? da verificare!
-- tipo di pezzo
PARTS[i].sPieceType = EgtGetInfo( PARTS[i].id, 'PART_TYPE', 'd') or ''
-- definisco il pezzo per famiglia ( TODO da recuperare dal nome del pezzo, o da una nota)
-- se non sono stati inseriti o c'è stato un errore esco subito
if not bInsertedAllOffs then
EgtOutBox( 'Errore offset non trovati', 'BatchProcessWin', 'ERROR', 'OK')
return false
end
sOut = sOut .. PARTS[i].sName .. ', '
end
sOut = sOut:sub( 1, -3)
EgtOutLog( 'Pezzi : ' .. sOut, 1)
end
EgtDeselectAll()
return true
end
---------------------------------------------------------------------
-- Crea il grezzo che verrà messo in macchina
---------------------------------------------------------------------
local function CreateRaws( PiecesInMachGroup)
for i = 1, #PiecesInMachGroup do
-- si crea un grezzo "finto" (un cubo da 100mm) nell'origine del pezzo, verrà poi dimensionato uan volta adeguato con i vari sovramateriali
PiecesInMachGroup[i].idRaw = EgtAddRawPart( PiecesInMachGroup[i].frame:getOrigin(), 100, 100, 100, ColA)
EgtAddPartToRawPart( PiecesInMachGroup[i].id, ORIG(), PiecesInMachGroup[i].idRaw)
end
end
---------------------------------------------------------------------
-- Allinea i pezzi in base a come devono essere disposti sulla tavola
---------------------------------------------------------------------
-- TODO in questa fase bisogna già sapere qual è la prima fase e posizionare il pezzo di conseguenza
-- TODO (bassa priorità) adesso allinea sempre in X, ma bisognerebbe farlo in base ad un parametro in WINDATA che dice come si dispongono in macchina
local function AlignRawsToTable( PiecesInMachGroup)
for i = 1, #PiecesInMachGroup do
-- allineo il pezzo all'interno del grezzo
local dRotX, dRotY, dRotZ = GetFixedAxesRotABCFromFrame( PiecesInMachGroup[i].frame)
-- se devo ruotare
if abs( dRotZ) > GEO.EPS_ANG_SMALL then
EgtRotatePartInRawPart( PiecesInMachGroup[i].id, Z_AX(), -dRotZ)
end
-- sposto punto in basso a sinistra del pezzo sul punto in basso a sinistra del grezzo
local b3Part = EgtGetBBoxGlob( PiecesInMachGroup[i].id, GDB_BB.ONLY_VISIBLE)
local dPartPosX = b3Part:getMin():getX()
local dPartPosY = b3Part:getMin():getY()
local dPartPosZ = b3Part:getMin():getZ()
local b3Raw = EgtGetRawPartBBox( PiecesInMachGroup[i].idRaw)
local dRawPosX = b3Raw:getMin():getX()
local dRawPosY = b3Raw:getMin():getY()
local dRawPosZ = b3Raw:getMin():getZ()
local vtMove = Vector3d( dRawPosX - dPartPosX, dRawPosY - dPartPosY, dRawPosZ - dPartPosZ)
EgtMovePartInRawPart( PiecesInMachGroup[i].id, vtMove)
end
return true
end
-------------------------------------------------------------------------------------------------------------
-- *** Funzione per trovare nome MachGroup ***
-------------------------------------------------------------------------------------------------------------
local function NewMachGroupName()
local nMachGroupId = EgtGetFirstMachGroup()
if not nMachGroupId then return '1' end
local nMaxMachGroup = 0
while nMachGroupId do
local sMachGroupName = EgtGetMachGroupName( nMachGroupId)
local nMachGroupName = tonumber( sMachGroupName)
if nMachGroupName > nMaxMachGroup then
nMaxMachGroup = nMachGroupName
end
nMachGroupId = EgtGetNextMachGroup( nMachGroupId)
end
return tostring( nMaxMachGroup + 1)
end
-------------------------------------------------------------------------------------------------------------
-- *** Funzione per raggruppamento pezzi ***
-------------------------------------------------------------------------------------------------------------
-- TODO punteggio da verificare!!
-- Calcolo un punteggio di similitudine tra due pezzi
local function CalculateSimilarity( Part1, Part2)
-- peso lati: IN, OUT, LEFT, RIGHT (i lati lunghi hanno più peso rispetto alle teste)
local ProfilesWeights = { 3, 3, 1, 1}
local dScore = 0
for i = 1, 4 do
if Part1.SemiProfiles[i] == Part2.SemiProfiles[i] then
dScore = dScore + ProfilesWeights[i]
end
end
-- punteggio "bonus" se il tipo di pezzo è lo stesso
if Part1.sPieceType and Part2.sPieceType and Part1.sPieceType == Part2.sPieceType then
dScore = dScore + 2
end
return dScore
end
-------------------------------------------------------------------------------------------------------------
-- raggruppamento con vincoli ( lunghezza / numero pezzi)
local function GroupParts( PartsList, sOptimisationType)
-- TIPI DI OTTIMIZZAZIONE (sOptimisationType)
-- 'PIECE' : pezzo singolo
-- 'WINDOW' : ottimizza finestra
-- 'FULL_LIST': ottimizza progetto
local Groups = {}
local Used = {}
for i = 1, #PartsList do
if not Used[i] then
local Group = {}
-- Add the main part
table.insert( Group, PartsList[i])
Used[i] = true
-- se non è ottimizzazione pezzo singolo, cerco altri pezzi che possono essere lavorati nella stessa macchinata
if sOptimisationType ~= 'PIECE' then
-- cerca un altro pezzo compatibile
while true do
local nBestIndex = nil
local nBestScore = -1
for j = 1, #PartsList do
if not Used[j] then
local bCanBeGrouped = not( sOptimisationType == 'WINDOW' and PartsList[i].sWindow ~= PartsList[j].sWindow)
-- se possono essere raggruppati per tipo di ottimizzazione
if bCanBeGrouped then
local VirtualList = WinLib.TableCopyDeep( Group)
table.insert( VirtualList, PartsList[j])
bCanBeGrouped = WinData.VerifyPieces( VirtualList)
-- se possono effettivamente essere messi nella stessa macchinata
if bCanBeGrouped then
-- il punteggio è sempre calcolato rispetto al primo pezzo del gruppo
local nScore = CalculateSimilarity( PartsList[i], PartsList[j])
if nScore > nBestScore then
nBestScore = nScore
nBestIndex = j
end
end
end
end
end
if not nBestIndex then
break
end
-- Add the best matching part
table.insert( Group, PartsList[nBestIndex])
Used[nBestIndex] = true
end
end
table.insert( Groups, Group)
end
end
return Groups
end
-------------------------------------------------------------------------------------------------------------
-- *** Inserimento dei pezzi nelle macchinate ***
-------------------------------------------------------------------------------------------------------------
local function CreateMachGroups()
for j = 1, #GROUPS do
-- creo macchinata
local MachGroupName = NewMachGroupName()
local nMachGroup = EgtAddMachGroup( MachGroupName)
-- si setta gruppo appena creato come corrente
EgtSetCurrMachGroup( nMachGroup)
-- si crea il grezzo
CreateRaws( GROUPS[j])
-- allineo i pezzi come orientamento richiesto dalla macchina
AlignRawsToTable( GROUPS[j])
-- aggiungo sovramateriale ai grezzi
PartData.AddOverMaterialToRaw( GROUPS[j])
-- si dispongono i pezzi sulla tavola
local bDispOk, sErr = WinData.ExecDisposition( GROUPS[j])
if not bDispOk then
if not sErr then
sErr = 'Errore non gestito in WinData.ExecDisposition'
end
return false
end
-- Impostazione dell'attrezzaggio di default
local bOk = EgtImportSetup()
if not bOk then
EgtImportSetup( 'Default')
end
end
return true
end
-------------------------------------------------------------------------------------------------------------
-- *** Esecuzione ***
-------------------------------------------------------------------------------------------------------------
if not GetInfoPieces() then return end
GROUPS = GroupParts( PARTS, WIN.OPT_TYPE)
if not GROUPS or #GROUPS == 0 then
return
end
if not CreateMachGroups() then return end
+92
View File
@@ -0,0 +1,92 @@
-- PartData.lua by Egalware s.r.l. 2026/02/19
-- Libreria globale per Serramenti
-- Tabella per definizione modulo
local PartData = {}
-- Include
require( 'EgtBase')
local WinData = require( 'WinData')
EgtOutLog( ' PartData started', 1)
-------------------------------------------------------------------------------------------------------------
-- Recupero offset applicato al profilo
function PartData.GetDispOffsetFromNotes( PARTS, nPieceIndex)
local bAllOffsetsAreOk = false
PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetX = 0 -- dovrà essere calcolato in base alle lavorazioni
PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetY = EgtGetInfo( PARTS[nPieceIndex].id, 'OFFY_1', 'd')
PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetZ = EgtGetInfo( PARTS[nPieceIndex].id, 'OFFZ_1', 'd')
PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetX = 0 -- dovrà essere calcolato in base alle lavorazioni
PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetY = EgtGetInfo( PARTS[nPieceIndex].id, 'OFFY_2', 'd')
PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetZ = EgtGetInfo( PARTS[nPieceIndex].id, 'OFFZ_2', 'd')
-- controllo se tutti gli offset siano settati
if PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetY and PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetZ and
PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetY and PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetZ then
bAllOffsetsAreOk = true
end
return bAllOffsetsAreOk
end
---------------------------------------------------------------------
-- Crea il grezzo che verrà messo in macchina
function PartData.AddOverMaterialToRaw( PARTS)
for i = 1, #PARTS do
-- prima di aggiungere sovramateriale al grezzo, calcolo dimensioni del finito
local b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[i].id, 'Geo') or GDB_ID.NULL, GDB_BB.STANDARD)
PARTS[i].b3Part = b3Part
PARTS[i].dPartLength = PARTS[i].b3Part:getDimX()
PARTS[i].dPartWidth = PARTS[i].b3Part:getDimY()
PARTS[i].dPartHeight = PARTS[i].b3Part:getDimZ()
-- recupero sovramateriale
PARTS[i].RawOffset = {}
-- recupero info sovramateriale
PARTS[i].RawOffset.dOverMatIn = EgtGetInfo( PARTS[i].id, 'OVERMAT_IN', 'd') or 5
PARTS[i].RawOffset.dOverMatOut = EgtGetInfo( PARTS[i].id, 'OVERMAT_OUT', 'd') or 5
PARTS[i].RawOffset.dOverMatLeft = EgtGetInfo( PARTS[i].id, 'OVERMAT_LEFT', 'd') or 5
PARTS[i].RawOffset.dOverMatRight = EgtGetInfo( PARTS[i].id, 'OVERMAT_RIGHT', 'd') or 5
PARTS[i].dRawLength = PARTS[i].RawOffset.dOverMatLeft + PARTS[i].dPartLength + PARTS[i].RawOffset.dOverMatRight
PARTS[i].dRawWidth = PARTS[i].RawOffset.dOverMatOut + PARTS[i].dPartWidth + PARTS[i].RawOffset.dOverMatIn
PARTS[i].dRawHeight = PARTS[i].dPartHeight
EgtModifyRawPartSize( PARTS[i].idRaw, PARTS[i].dRawLength, PARTS[i].dRawWidth, PARTS[i].dPartHeight)
--local vtMove = Vector3d( PARTS[i].RawOffset.dOverMatLeft, PARTS[i].RawOffset.dOverMatOut, 0)
--EgtMovePartInRawPart( PARTS[i].id, vtMove)
-- TODO da controllare, se ruotato di 180° bisognerebbe prendere dOverMatIn. Lo stesso per la X
PARTS[i].OffsetPartToRaw = {}
PARTS[i].OffsetPartToRaw.X = PARTS[i].RawOffset.dOverMatLeft
PARTS[i].OffsetPartToRaw.Y = PARTS[i].RawOffset.dOverMatOut
end
end
---------------------------------------------------------------------
-- Recupera le dimensioni dei pezzi
function PartData.GetDimensionPart( PARTS)
if #PARTS == 0 then
EgtOutBox( 'Non ci sono pezzi', 'Lavora Pezzi', 'ERROR')
return false
else
-- recupero tutte le dimensioni necessarie
local sOut = ''
for i = 1, #PARTS do
PARTS[i].b3Raw = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[i].id, 'GeoRaw') or GDB_ID.NULL, GDB_BB.STANDARD)
PARTS[i].b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[i].id, 'Geo') or GDB_ID.NULL, GDB_BB.STANDARD)
local idFrame = EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( PARTS[i].id, 'GeoRaw'), 'AuxFrame')
PARTS[i].frame = EgtFR( idFrame)
sOut = sOut .. PARTS[i].sName .. ', '
end
sOut = sOut:sub( 1, -3)
EgtOutLog( 'Pezzi selezionati : ' .. sOut, 1)
end
end
-------------------------------------------------------------------------------------------------------------
return PartData
@@ -1,9 +1,9 @@
-- WinConst.lua libreria di costanti EgalWare per progetto serramenti 2024/10/07
-- WinCAMConst.lua libreria di costanti EgalWare per progetto serramenti 2024/10/07
-- Tavola per definizione modulo (serve ma non usata)
local WinConst = {}
local WinCAMConst = {}
EgtOutLog( 'WinConst started', 1)
EgtOutLog( 'WinCAMConst started', 1)
-- Funzione per rendere non modificabili le costanti
local protect = function(tbl)
@@ -31,4 +31,4 @@ MACH_GROUP = {
}
MACH_GROUP = protect( MACH_GROUP)
return WinConst
return WinCAMConst
+16 -2
View File
@@ -33,8 +33,9 @@ EgtMdbSave()
-------------------------------------------------------------------------------------------------------------
-- *** variabili globali ***
-------------------------------------------------------------------------------------------------------------
TOOLS = nil
MACHININGS = nil
TOOLS = {}
MACHININGS = {}
RESULT = {} -- tabella contenente il risultato, feature per feature, dell'applicazione della strategia scelta e il resoconto dell'analisi fatta
-------------------------------------------------------------------------------------------------------------
-- *** COSTANTI *** TODO -> DA SPOSTARE IN WINDATA???
@@ -192,6 +193,17 @@ function WinExec.GetToolsFromDB()
end
-------------------------------------------------------------------------------------------------------------
function WinExec.AddApplyResultToGlobalList( nErr, idCut, sMsg)
RESULT[#RESULT+1] = {
sType = 'Part',
idCut = idCut,
idTask = 0,
nErr = nErr,
sMsg = sMsg
}
end
-------------------------------------------------------------------------------------------------------------
-- *** Inserimento delle lavorazioni nelle travi ***
-------------------------------------------------------------------------------------------------------------
@@ -218,6 +230,8 @@ local function CollectFeatures( vProc, Part, nIndexPart)
Proc.sType = sType
Proc.b3Box = EgtGetBBoxGlob( ProcId, GDB_BB.STANDARD)
Proc.nPhase = EgtGetInfo( ProcId, 'PHASE', 'i') or nil
Proc.idCut = EgtGetInfo( EgtGetParent( EgtGetParent( ProcId)), 'CUTID', 'i') or 0
Proc.idTask = EgtGetInfo( ProcId, 'TASKID', 'i') or 0
-- se esiste la geometria
if Proc.b3Box and not Proc.b3Box:isEmpty() then
+34
View File
@@ -138,5 +138,39 @@ function WinLib.GetPathMinRadius( IdCurve)
return dSmallRadius
end
-------------------------------------------------------------------------------------------------------------
--- copia una tabella lua in modo ricorsivo, ossia mantiene indipendenti anche tutte le sottotabelle
--- ATTENZIONE: in caso di modifiche vanno gestiti anche i tipi custom; sarebbe meglio metterla nel LuaLibs
function WinLib.TableCopyDeep( OriginalTable)
-- controllo se oggetto passato è valido, altrimenti errore. Non deve mai succedere
if not OriginalTable then
error( "TableCopyDeep : can't copy nil object")
end
local CopiedTable = {}
for key, value in pairs( OriginalTable) do
if type( value) == "table" then
if isBBox3d( value) then
CopiedTable[ key] = BBox3d( value)
elseif isColor3d( value) then
CopiedTable[ key] = Color3d( value)
elseif isFrame3d( value) then
CopiedTable[ key] = Frame3d( value)
elseif isPoint3d( value) then
CopiedTable[ key] = Point3d( value)
elseif isQuaternion( value) then
CopiedTable[ key] = Quaternion( value)
elseif isVector3d( value) then
CopiedTable[ key] = Vector3d( value)
else
CopiedTable[ key] = WinLib.TableCopyDeep( value)
end
else
CopiedTable[ key] = value
end
end
return CopiedTable
end
-------------------------------------------------------------------------------------------------------------
return WinLib
+9 -79
View File
@@ -18,7 +18,7 @@ EgtAddToPackagePath( WIN.BASEDIR .. '\\LuaLibs\\?.lua')
-- Imposto direttorio strategie. N.B. Le strategie dovranno essere caricate con il nome del direttorio padre
EgtAddToPackagePath( WIN.BASEDIR .. '\\Strategies\\?.lua')
-- Verifico che la macchina corrente sia abilitata per la lavorazione delle Travi
-- Verifico che la macchina corrente sia abilitata per la lavorazione delle finestre
local sMachDir = EgtGetCurrMachineDir()
if not sMachDir then
EgtOutBox( 'Errore nel caricamento della macchina corrente', 'Lavora Serramenti', 'ERROR')
@@ -44,6 +44,7 @@ _G.package.loaded.FeatureData = nil
_G.package.loaded.MachiningLib = nil
local WinExec = require( 'WinExec')
local PartData = require( 'PartData')
-- Carico i dati globali
local WinData = require( 'WinData')
@@ -58,7 +59,7 @@ local ColA = Color3d( 255, 165, 0, 30)
-- *** Recupero i pezzi da processare ***
-------------------------------------------------------------------------------------------------------------
local function MyProcessInputData()
-- Recupero le travi selezionate
-- Recupero i pezzi selezionati
local nId = EgtGetFirstSelectedObj()
while nId do
local nPartId = EgtGetParent( EgtGetParent( nId or GDB_ID.NULL) or GDB_ID.NULL)
@@ -76,23 +77,9 @@ local function MyProcessInputData()
end
nId = EgtGetNextSelectedObj()
end
if #PARTS == 0 then
EgtOutBox( 'Non sono state selezionati pezzi', 'Lavora Pezzi', 'ERROR')
return false
else
-- recupero tutte le dimensioni necessarie
local sOut = ''
for i = 1, #PARTS do
PARTS[i].b3Raw = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[i].id, 'GeoRaw') or GDB_ID.NULL, GDB_BB.STANDARD)
PARTS[i].b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[i].id, 'Geo') or GDB_ID.NULL, GDB_BB.STANDARD)
local idFrame = EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( PARTS[i].id, 'GeoRaw'), 'AuxFrame')
PARTS[i].frame = EgtFR( idFrame)
sOut = sOut .. PARTS[i].sName .. ', '
end
sOut = sOut:sub( 1, -3)
EgtOutLog( 'Pezzi selezionati : ' .. sOut, 1)
end
PartData.GetDimensionPart( PARTS)
EgtDeselectAll()
return true
@@ -107,26 +94,6 @@ local function GetDataConfig()
return true
end
-------------------------------------------------------------------------------------------------------------
local function GetDispOffsetFromNotes( nPieceIndex)
local bAllOffsetsAreOk = false
PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetX = 0 -- dovrà essere calcolato in base alle lavorazioni
PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetY = EgtGetInfo( PARTS[nPieceIndex].id, 'OFFY_1', 'd')
PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetZ = EgtGetInfo( PARTS[nPieceIndex].id, 'OFFZ_1', 'd')
PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetX = 0 -- dovrà essere calcolato in base alle lavorazioni
PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetY = EgtGetInfo( PARTS[nPieceIndex].id, 'OFFY_2', 'd')
PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetZ = EgtGetInfo( PARTS[nPieceIndex].id, 'OFFZ_2', 'd')
-- controllo se tutti gli offset siano settati
if PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetY and PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetZ and
PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetY and PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetZ then
bAllOffsetsAreOk = true
end
return bAllOffsetsAreOk
end
-------------------------------------------------------------------------------------------------------------
local function GetDispOffsetFromInput( nPieceIndex)
-- assegno alle stringhe i valori letti, in modo che vengano proposti quelli nel dialogo
@@ -151,43 +118,6 @@ local function GetDispOffsetFromInput( nPieceIndex)
return true
end
---------------------------------------------------------------------
-- Crea il grezzo che verrà messo in macchina
---------------------------------------------------------------------
local function AddOverMaterialToRaw( PARTS)
for i = 1, #PARTS do
-- prima di aggiungere sovramateriale al grezzo, calcolo dimensioni del finito
local b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[i].id, 'Geo') or GDB_ID.NULL, GDB_BB.STANDARD)
PARTS[i].b3Part = b3Part
PARTS[i].dPartLength = PARTS[i].b3Part:getDimX()
PARTS[i].dPartWidth = PARTS[i].b3Part:getDimY()
PARTS[i].dPartHeight = PARTS[i].b3Part:getDimZ()
-- recupero sovramateriale
PARTS[i].RawOffset = {}
-- recupero info sovramateriale
PARTS[i].RawOffset.dOverMatIn = EgtGetInfo( PARTS[i].id, 'OVERMAT_IN', 'd') or 5
PARTS[i].RawOffset.dOverMatOut = EgtGetInfo( PARTS[i].id, 'OVERMAT_OUT', 'd') or 5
PARTS[i].RawOffset.dOverMatLeft = EgtGetInfo( PARTS[i].id, 'OVERMAT_LEFT', 'd') or 5
PARTS[i].RawOffset.dOverMatRight = EgtGetInfo( PARTS[i].id, 'OVERMAT_RIGHT', 'd') or 5
PARTS[i].dRawLength = PARTS[i].RawOffset.dOverMatLeft + PARTS[i].dPartLength + PARTS[i].RawOffset.dOverMatRight
PARTS[i].dRawWidth = PARTS[i].RawOffset.dOverMatOut + PARTS[i].dPartWidth + PARTS[i].RawOffset.dOverMatIn
PARTS[i].dRawHeight = PARTS[i].dPartHeight
EgtModifyRawPartSize( PARTS[i].idRaw, PARTS[i].dRawLength, PARTS[i].dRawWidth, PARTS[i].dPartHeight)
local vtMove = Vector3d( PARTS[i].RawOffset.dOverMatLeft, PARTS[i].RawOffset.dOverMatOut, 0)
EgtMovePartInRawPart( PARTS[i].id, vtMove)
-- TODO da controllare, se ruotato di 180° bisognerebbe prendere dOverMatIn. Lo stesso per la X
PARTS[i].OffsetPartToRaw = {}
PARTS[i].OffsetPartToRaw.X = PARTS[i].RawOffset.dOverMatLeft
PARTS[i].OffsetPartToRaw.Y = PARTS[i].RawOffset.dOverMatOut
end
end
---------------------------------------------------------------------
-- Crea il grezzo che verrà messo in macchina
---------------------------------------------------------------------
@@ -246,7 +176,7 @@ local nMachGroupId = EgtGetFirstMachGroup()
end
-------------------------------------------------------------------------------------------------------------
-- *** Inserimento delle travi nel grezzo ***
-- *** Inserimento dei pezzi nel grezzo ***
-------------------------------------------------------------------------------------------------------------
local function MyProcessPieces()
@@ -261,7 +191,7 @@ local function MyProcessPieces()
AlignRawsToTable( PARTS)
-- aggiungo sovramateriale ai grezzi
AddOverMaterialToRaw( PARTS)
PartData.AddOverMaterialToRaw( PARTS)
-- recupero offset per posizionamento
for i = 1, #PARTS do
@@ -269,7 +199,7 @@ local function MyProcessPieces()
PARTS[i].DispOffsets.Phase1 = {}
PARTS[i].DispOffsets.Phase2 = {}
local bInsertedAllOffs = GetDispOffsetFromNotes( i)
local bInsertedAllOffs = PartData.GetDispOffsetFromNotes( PARTS, i)
-- se non sono settati nelle note, li chiedo
if not bInsertedAllOffs then
bInsertedAllOffs = GetDispOffsetFromInput( i)
+602 -585
View File
File diff suppressed because it is too large Load Diff
+99 -40
View File
@@ -27,22 +27,39 @@ WIN_FRAME_TYPES = {
SEGMENTAL_ARC = 5,
POINTED_ARC = 6,
TRG = 7,
THREE_CENTER_ARC = 8,
}
-- forme per anta
WIN_SASH_SHAPE = 'SashShape'
WIN_SASH_SHAPES = {
RECT = 'Rectangle',
TRAP = 'Trapezoid',
ROUND_ARC = 'FullArc',
SEGMENTAL_ARC = 'Arc',
SEMI_ROUND_ARC = 'SemiFullArc',
SEMI_SEGMENTAL_ARC = 'SemiArc',
CIRCLE = 'Circle',
GENERIC = 'Custom',
}
-- direzioni di split
WIN_SPLIT_DIR = 'SplitOrientation'
WIN_SPLITORIENTATION = {
VERTICAL = 1,
HORIZONTAL = 2,
}
-- tipi di misure
WIN_MEASURE_TYPE = 'MeasureType'
WIN_MEASURE = {
ABSOLUT = 1,
ABSOLUTE = 1,
PROPORTIONAL = 2,
PERCENTAGE = 3,
}
-- tipologia di figli
WIN_CHILDREN_TYPE = 'ChildrenType'
WIN_CHILDREN_TYPES = {
NULL = 0,
SASH = 1,
@@ -84,11 +101,23 @@ WIN_AREATYPES = {
WIN_SPLITTYPE = 'SplitType'
WIN_SPLITTYPES = {
NULL = 0,
MULLION = 1, -- montante
FRENCH = 2, -- battente / ricevente
MIXED = 3, -- cambio profilo
MULLION = 1, -- montante nel telaio che separa due ante
FRENCH = 2, -- per ante battente / ricevente
MIXED = 3, -- cambio profilo
MUNTIN_SASH = 4, -- divisione nell'anta che separa due vetri
MUNTIN_FRAME = 5, -- divisione nel telaio che separa due vetri fissi
MUNTIN_FILL = 6 -- inglesina incollata sul vetro
}
WIN_MUNTINFILL_SIDE = 'MuntinFillSide'
WIN_MUNTINFILL_SIDES = {
NULL = 0,
IN = 1, -- inglesina solo interna
OUT = 2, -- inglesina solo esterna
BOTH = 3, -- inglesina interna ed esterna
}
-- tipi di riempimento interno
WIN_FILLTYPE = 'FillType'
WIN_FILLTYPES = {
@@ -134,11 +163,12 @@ WIN_OPENING_TYPES = {
}
-- tipi di pezzo
WIN_PART_TYPE = 'PartType'
WIN_PART_TYPE = 'PART_TYPE'
WIN_PART_TYPES = {
NULL = 0,
FILL = 1,
BOTTOMRAIL = 2,
STD = 3,
}
WIN_AREAOUTLINE = 'BaseOutline'
@@ -149,6 +179,7 @@ WIN_SPLITSELECTION = 'SplitSelection'
WIN_SASH_OPENING = 'Opening'
WIN_AUX = 'Aux'
WIN_PREVIEW = 'Preview'
WIN_VIRTUAL_AREA = 'VirtualArea'
WIN_BOTTOM = 'Bottom'
WIN_BOTTOMRAIL = 'BottomRail'
@@ -157,29 +188,41 @@ WIN_TOP = 'Top'
WIN_LEFT = 'Left'
-- info varie su aree e curve
WIN_SOU = 'SOU'
WIN_SLIDE_WINDOW = 'SlideWindow'
WIN_MIXED_WINDOW = 'ProfileChangeWindow'
WIN_PART_DIM = 'PartDim'
WIN_CHILD = 'CHILD'
WIN_COPY = 'COPY'
WIN_SASH_CHILDREN = 'SashChildren'
WIN_FILL_CHILDREN = 'FillChildren'
WIN_SOU_OUTLINE = 'SouOutline'
WIN_CHILD_OUTLINE = 'ChildOutline'
WIN_CHILD_VIRTUAL_OUTLINE = 'ChildVirtualOutline'
WIN_CHILD_PRFCHANGE_SPLIT = 'ChildPrfChangeSplit'
WIN_REF_OUTLINE = 'OutlineRef'
WIN_REF_MUNTIN = 'MuntinRef'
WIN_REF_PART = 'PartRef'
WIN_REF_BOTTOMRAIL_PART = 'BottomRailPartRef'
WIN_PREV_OUTLINES = 'PrevOutlines'
WIN_NEXT_OUTLINES = 'NextOutlines'
WIN_REF_SPLIT = 'RefSplit'
WIN_PRJ_ORIGSPLIT = 'OrigSplit'
WIN_CRV_ON_FRENCH_SPLIT = 'OutlineOnFrenchSplit'
WIN_SPLIT_STARTINTERS = 'SplitStartInters'
WIN_SPLIT_ENDINTERS = 'SplitEndInters'
WIN_SASH_CHILDREN = 'SashChildren'
WIN_FILL_CHILDREN = 'FillChildren'
WIN_THRESHOLD_PROFILE = 'ThresholdProfile'
WIN_SLIDE_WINDOW = 'SlideWindow'
WIN_SASH_NBR = 'SashNbr'
WIN_AREA_NBR = 'AreaNbr'
WIN_AREA_PROFILES = 'AreaProfiles'
WIN_MEASURE_VALUE = 'MeasureValue'
WIN_GRIDSPLIT_ORDER = 'GridSplitOrder'
WIN_SPLIT_POSITION = 'SplitPosition'
WIN_SPLIT_OFFS = 'SplitOffs'
WIN_GRID_SPLIT = 'GridSplit'
WIN_DAYLIGHT_MEASURE = 'DaylightMeasure'
WIN_EXTRA_CRV = 'Extra'
WIN_SPECIAL_CRV = 'Special'
-- PROFILI
WIN_PROFILE = 'Profile'
WIN_PROFILEPATH = 'ProfilePath'
WIN_INFO_GRP = 'Info'
-- nomi dei profili
WIN_SASH_TOP = 'Sash_Top'
@@ -193,6 +236,7 @@ WIN_FILL_RAIL = 'Fill_Rail'
WIN_FRAME_SPLIT = 'Frame_Split'
WIN_SASH_VERTICAL = 'Sash_Vertical'
WIN_SASH_HORIZONTAL = 'Sash_Horizontal'
WIN_MIXED = 'Mixed'
WIN_MIXED_BOTTOM = 'Mixed_Bottom'
WIN_MIXED_TOP = 'Mixed_Top'
WIN_MIXED_SPLIT = 'Mixed_Split'
@@ -206,6 +250,9 @@ WIN_FRENCH_IN = 'French_In'
WIN_FRENCH_OUT = 'French_Out'
WIN_SASH_SPLIT = 'Sash_Split'
WIN_FILL_SPLIT_OUT = 'Fill_Split_Out'
WIN_FILL_SPLIT_IN = 'Fill_Split_In'
WIN_SLIDE = 'Slide'
WIN_MOVABLE = 'Movable'
WIN_SLIDE_MOVABLEBACK = 'Slide_MovableBack'
@@ -244,13 +291,17 @@ WIN_GASKET = 'Gasket'
WIN_THRESHOLD = 'Threshold'
-- info sui profili
WIN_DIM_STD = 'DimStd'
WIN_DIM_MIN = 'DimMin'
WIN_DIM_MAX = 'DimMax'
WIN_OVERLAP = 'Overlap'
WIN_SASH_TOP_OVERLAP = 'SashTopOverlap'
WIN_SASH_BOTTOM_OVERLAP = 'SashBottomOverlap'
WIN_DELTA = 'Delta'
WIN_FILLOVERLAP = 'FillOverlap'
WIN_FILLDELTA = 'FillDelta'
WIN_GLASSTHICKNESS = 'GlassThickness'
WIN_RAILDELTA = 'RailDelta'
WIN_RAILOFFS = 'RailOffs'
-- per ferramenta
WIN_GAPDELTA = 'GapDelta'
WIN_GAPDELTAZ = 'GapDeltaZ'
@@ -279,6 +330,7 @@ WIN_PRC_OFFY_2 = 'OFFY_2'
WIN_PRC_OFFZ_2 = 'OFFZ_2'
WIN_PRC_CLAMPV_1 = 'CLAMPV_1'
WIN_PRC_CLAMPV_2 = 'CLAMPV_2'
WIN_PRC_ID = 'ID'
-- codici
WIN_PROFILE_CODES = {
@@ -296,28 +348,10 @@ WIN_PRF_MAIN = 'Main'
WIN_PRF_START = 'Start'
WIN_PRF_END = 'End'
WIN_PRF_SPLIT = 'Split'
WIN_PRF_TYPE = 'Type'
WIN_PROFILETYPE = 'ProfileType'
-- tipi di profilo
WIN_PRF = {
NULL = 0,
TOP = 1,
BOTTOM = 2,
LEFT = 3,
RIGHT = 4,
SPLIT = 5,
BOTTOMRAIL = 6,
BOTTOMRAIL_FINAL = 7,
}
-- GIUNZIONI
WIN_JOINTS = 'Joints'
WIN_JOINT_BL = 'JointBL'
WIN_JOINT_BR = 'JointBR'
WIN_JOINT_TL = 'JointTL'
WIN_JOINT_TR = 'JointTR'
WIN_STARTJOINT = 'StartJoint'
WIN_ENDJOINT = 'EndJoint'
@@ -349,16 +383,31 @@ WIN_GEOHEIGHT = 'GeoHeight'
WIN_GEOLEN = 'GeoLen'
WIN_SEMI_PROFILE = 'SemiProfileId'
WIN_GLASS_RECT = 'GlassRectangle'
WIN_GEO_SURF = 'GeoRegion'
WIN_GEO_EXTRA = 'GeoExtra'
WIN_REF_GEO = 'GeoRef'
WIN_GEO_OFFS = 'GeoOffs'
WIN_TANG_START = 'ExtendTangStart'
WIN_TANG_END = 'ExtendTangEnd'
WIN_REF_SURF = 'SurfRef'
WIN_REF_PRC = 'PrcRef'
-- CAMBIO PROFILO
WIN_PRF_CHANGE = 'ProfileChange'
WIN_MIXED_OUTLINES = 'ProfileChangeOutlines'
WIN_MIXED_INTERSECTIONS = 'ProfileChangeIntersections'
WIN_PRF_CHANGE_TYPES = { -- binario
NULL = 0,
OUT = 1, -- cambio profilo sul lato esterno
IN = 2, -- cambio profilo sul lato interno
START = 4, -- cambio profilo sull'estremo iniziale
END = 8, -- cambio profilo sull'estremo finale
}
WIN_MIXED_CURVES = 'ProfileChangeCurves'
WIN_MIXED_MILLING = 'ProfileChangeMilling'
WIN_MIXED_SPLIT_REF = 'MixedSplitRef'
WIN_MIXED_INTERS_REF = 'MixedIntersRef'
WIN_MIXED_REF_START = 'MixedRefEnd'
WIN_MIXED_REF_END = 'MixedRefStart'
WIN_FILL_ON_SPLIT_RIGHT = 'FillOnSplitRight'
WIN_MIXED_START_CHILDREN = 'StartChildrenType'
WIN_MIXED_END_CHILDREN = 'EndChildrenType'
-- SOLIDI
@@ -366,8 +415,6 @@ WIN_SOLID = 'Solid'
WIN_MAINGUIDE = 'MainGuide'
WIN_SRF_MAIN = 'MainSurface'
WIN_SRF_ORIGMAIN = 'OrigMainSurface'
WIN_SRF_START = 'StartSurface'
WIN_SRF_END = 'EndSurface'
WIN_SRF_STRIP = 'StripSurface'
@@ -395,6 +442,10 @@ WIN_PRC_SIDETYPE = {
LEFT = 'Left',
RIGHT = 'Right'
}
WIN_PRC_PROFILE_IN = 'PROFILE_IN'
WIN_PRC_PROFILE_OUT = 'PROFILE_OUT'
WIN_PRC_PROFILE_LEFT = 'PROFILE_LEFT'
WIN_PRC_PROFILE_RIGHT = 'PROFILE_RIGHT'
-- SPINE
@@ -432,5 +483,13 @@ WIN_HDW_FRAME = 'HdwFrame'
WIN_HDW_HANDLE_HEIGHT = 'HMan'
WIN_HDW_OPTIONS = 'HdwOptions'
WIN_HDW_HINGES = 'HdwHinges'
-- Return mode
WIN_HDW_RETURNMODE = {
HARDWARELIST = 1,
POSITIONLIST = 2,
MACHININGLIST = 4,
OPTIONLIST = 8
}
---------------------------------------------------------------------
return WinConst
+17 -3
View File
@@ -24,21 +24,35 @@ JWD_JOINTS = 'JointList'
JWD_JOINT_TYPE = 'JointType'
JWD_BOTTOMRAIL = 'BottomRail'
JWD_BOTTOMRAIL_QTY = 'BottomRailQty'
JWD_DIMENSION = 'dDimension'
JWD_VALUE = 'dValue'
JWD_BR_ELEMENT_DIMENSION = 'BottomRailElemDimList'
JWD_INDEX = 'Index'
JWD_DIMENSION = 'Dimension'
JWD_NAME = 'Name'
JWD_VALUE = 'Value'
JWD_ID_GROUP = 'GroupId'
JWD_ID_SASH = 'SashId'
JWD_MEASURE_TYPE = 'MeasureType'
JWD_MEASURE_DAYLIGHT = 'IsDimensionLight'
JWD_ELEMENT_DIMENSION = 'ElementDimensionList'
JWD_FRAME_SHAPE = 'Shape'
JWD_DIMENSION_LIST = 'DimensionList'
JWD_THRESHOLD = 'Threshold'
JWD_SASH_LIST = 'SashList'
JWD_HAS_HANDLE = 'bHasHandle'
JWD_HAS_HANDLE = 'HasHandle'
JWD_OPENING_TYPE = 'OpeningType'
JWD_HARDWARE = 'Hardware'
JWD_HARDWARE_OPTIONS = 'HwOptionList'
JWD_SPLIT_TYPE = 'SplitShape'
JWD_SPLIT_START_VERT = 'SplitStartVert'
JWD_SPLIT_VERT_POS = 'SplitVertList'
JWD_SPLIT_HORIZ_POS = 'SplitHorizList'
JWD_SPLIT_AREA = 'Area'
JWD_ELEMENT_VERT_DIMENSION = 'ElementDimVertList'
JWD_ELEMENT_HORIZ_DIMENSION = 'ElementDimHorizList'
JWD_MUNTIN_SIDE = 'Side'
JWD_FILL_TYPE = 'FillType'
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+127 -51
View File
@@ -17,31 +17,36 @@
local WinManageProject = {}
-- Include
require( 'EgtBase')
_G.package.loaded.WinConst = nil
require( 'WinConst')
_G.package.loaded.WinJWDConst = nil
require( 'WinJWDConst')
_G.package.loaded.WinCreate = nil
local WinCreate = require( 'WinCreate')
_G.package.loaded.JSON = nil
local JSON = require( 'JSON')
---------------------------------------------------------------------
local function GetJoints( tJoints)
local vJoints = {}
for i = 1, #tJoints do
local nIndex = tJoints[i][JWD_INDEX]
if tJoints[i][JWD_JOINT_TYPE] == 'FULL_H' then
vJoints[i] = WIN_JNT.FULL_H
vJoints[nIndex] = WIN_JNT.FULL_H
elseif tJoints[i][JWD_JOINT_TYPE] == 'FULL_V' then
vJoints[i] = WIN_JNT.FULL_V
vJoints[nIndex] = WIN_JNT.FULL_V
elseif tJoints[i][JWD_JOINT_TYPE] == 'ANGLED' then
vJoints[i] = WIN_JNT.ANGLED
vJoints[nIndex] = WIN_JNT.ANGLED
end
end
return vJoints
end
---------------------------------------------------------------------
local function GetDimensions( tDimensions)
local vDims = {}
for i = 1, #tDimensions do
local nIndex = tDimensions[i][JWD_INDEX]
vDims[nIndex] = tDimensions[i][JWD_VALUE]
end
return vDims
end
---------------------------------------------------------------------
local function GetFrameShape( sShape)
@@ -57,6 +62,8 @@ local function GetFrameShape( sShape)
return WIN_FRAME_TYPES.SEGMENTAL_ARC
elseif sShape == 'DOUBLEARC' then
return WIN_FRAME_TYPES.POINTED_ARC
elseif sShape == 'THREECENTERARC' then
return WIN_FRAME_TYPES.THREE_CENTER_ARC
elseif sShape == 'TRIANGLE' then
return WIN_FRAME_TYPES.TRG
end
@@ -96,6 +103,32 @@ local function GetOpeningType( sOpeningType)
end
---------------------------------------------------------------------
local function GetMeasureType( sMeasureType)
if sMeasureType == 'ABSOLUTE' then
return WIN_MEASURE.ABSOLUTE
elseif sMeasureType == 'PROPORTIONAL' then
return WIN_MEASURE.PROPORTIONAL
elseif sMeasureType == 'PERCENTAGE' then
return WIN_MEASURE.PERCENTAGE
end
return WIN_MEASURE.PERCENTAGE
end
---------------------------------------------------------------------
local function GetMuntinSide( sSide)
if sSide == 'INTERNAL' then
return WIN_MUNTINFILL_SIDES.IN
elseif sSide == 'EXTERNAL' then
return WIN_MUNTINFILL_SIDES.OUT
elseif sSide == 'BOTH' then
return WIN_MUNTINFILL_SIDES.BOTH
end
return
end
---------------------------------------------------------------------
-- funzione che ricava la tipologia dell'anta in base al tipo di apertura e alla struttura
local function GetSashTypes( tSashes, vOpeningTypes)
@@ -160,25 +193,34 @@ local function ConvertTableToGeometry( AreaTable, nParentId)
if not AreaTable then
return
end
-- recupero numerazione
local nAreaNbr = AreaTable[JWD_ID_GROUP]
-- TELAIO
if AreaTable[JWD_AREA_TYPE] == 'FRAME' then
-- recupero i dati del telaio ( forma, giunzioni, dimensioni)
local nType = GetFrameShape( AreaTable[JWD_FRAME_SHAPE])
local vJoints = GetJoints( AreaTable[JWD_JOINTS])
local vDim = {}
local tDimensions = AreaTable[JWD_DIMENSION_LIST]
for i = 1, #tDimensions do
vDim[i] = tDimensions[i][JWD_VALUE]
local vDim = GetDimensions( AreaTable[JWD_DIMENSION_LIST])
local vElementDim = GetDimensions( AreaTable[JWD_ELEMENT_DIMENSION])
-- creo il telaio
local nAreaId = WinCreate.CreateFrame( nType, vDim, vJoints, vElementDim, nAreaNbr)
if not nAreaId then
return
end
-- verifico presenza threshold
if AreaTable[JWD_THRESHOLD] then
WinCreate.AddThreshold( nAreaId, AreaTable[JWD_THRESHOLD])
end
-- creo il telaio
local nAreaId = WinCreate.CreateFrame( nType, vJoints, vDim[1], vDim[2], vDim[3])
-- verifico presenza bottomrail
if AreaTable[JWD_BOTTOMRAIL] then
WinCreate.AddBottomRail( nAreaId, AreaTable[JWD_BOTTOMRAIL_QTY])
local vElementDim = GetDimensions( AreaTable[JWD_BR_ELEMENT_DIMENSION])
WinCreate.AddBottomRail( nAreaId, AreaTable[JWD_BOTTOMRAIL_QTY], vElementDim)
end
-- analizzo sottoaree
@@ -193,91 +235,124 @@ local function ConvertTableToGeometry( AreaTable, nParentId)
-- recupero dati
local tSashes = AreaTable[JWD_SASH_LIST]
local vJoints = GetJoints( AreaTable[JWD_JOINTS])
local nBottomRailNbr = 0
local vElementDim = {}
if AreaTable[JWD_BOTTOMRAIL] then
nBottomRailNbr = AreaTable[JWD_BOTTOMRAIL_QTY]
vElementDim = GetDimensions( AreaTable[JWD_BR_ELEMENT_DIMENSION])
end
-- lettura opzioni ferramenta
local HdwOptions = AreaTable[JWD_HARDWARE_OPTIONS] or {}
local vsOptions = {}
for i = 1, #HdwOptions do
local sName = HdwOptions[i][JWD_NAME]
local sValue = HdwOptions[i][JWD_VALUE]
table.insert( vsOptions, sName .. '=' .. sValue)
end
-- anta singola
if #tSashes == 1 then
local vJoints = GetJoints( tSashes[1][JWD_JOINTS])
local nOpeningType = GetOpeningType( tSashes[1][JWD_OPENING_TYPE])
local nAreaId = WinCreate.AddSash( nParentId, vJoints, WIN_SASHTYPES.NULL, nOpeningType)
local vElementDim = GetDimensions( tSashes[1][JWD_ELEMENT_DIMENSION])
local nAreaId = WinCreate.AddSash( nParentId, vJoints, vElementDim, nOpeningType, nAreaNbr)
-- aggiungo ferramenta sull'anta
local sHandleSide
if nOpeningType == WIN_OPENING_TYPES.TURNONLY_LEFT or
nOpeningType == WIN_OPENING_TYPES.TILTTURN_LEFT or
nOpeningType == WIN_OPENING_TYPES.TILTONLY_TOP or
nOpeningType == WIN_OPENING_TYPES.COPLANARSLIDE_LEFT or
nOpeningType == WIN_OPENING_TYPES.LIFTSLIDE_LEFT then
EgtSetInfo( nAreaId, WIN_HDW_HANDLE, 'Sx')
sHandleSide = 'Sx'
elseif nOpeningType == WIN_OPENING_TYPES.TURNONLY_RIGHT or
nOpeningType == WIN_OPENING_TYPES.TILTTURN_RIGHT or
nOpeningType == WIN_OPENING_TYPES.TILTONLY_BOTTOM or
nOpeningType == WIN_OPENING_TYPES.COPLANARSLIDE_RIGHT or
nOpeningType == WIN_OPENING_TYPES.LIFTSLIDE_RIGHT then
EgtSetInfo( nAreaId, WIN_HDW_HANDLE, 'Dx')
sHandleSide = 'Dx'
end
WinCreate.AddHardware( nAreaId, AreaTable[JWD_HARDWARE])
WinCreate.AddHardware( nAreaId, AreaTable[JWD_HARDWARE], sHandleSide)
EgtSetInfo( nAreaId, WIN_HDW_OPTIONS, vsOptions)
-- bottomrail
WinCreate.AddBottomRail( nAreaId, nBottomRailNbr)
WinCreate.AddBottomRail( nAreaId, nBottomRailNbr, vElementDim)
-- analizzo sottaree
ConvertTableToGeometry( AreaTable[JWD_AREA_LIST][1], nAreaId)
-- ante multiple
else
-- aggiungo la ferramenta sull'area parent
WinCreate.AddHardware( nParentId, AreaTable[JWD_HARDWARE])
-- recupero dati delle ante
local vDimensions = {}
local vOpeningTypes = {}
local vMeasureType = {}
local vSashNbrs = {}
local vJoints = {}
local vPartsDim = {}
for i = 1, #tSashes do
vDimensions[i] = tSashes[i][JWD_DIMENSION] / 100
vMeasureType[i] = GetMeasureType( tSashes[i][JWD_MEASURE_TYPE])
vDimensions[i] = tSashes[i][JWD_DIMENSION]
vOpeningTypes[i] = GetOpeningType( tSashes[i][JWD_OPENING_TYPE])
vSashNbrs[i] = tSashes[i][JWD_ID_SASH]
vJoints[i] = GetJoints( tSashes[i][JWD_JOINTS])
vPartsDim[i] = GetDimensions( tSashes[i][JWD_ELEMENT_DIMENSION])
end
table.remove( vDimensions)
local vSashTypes, sHandleSide = GetSashTypes( tSashes, vOpeningTypes)
EgtSetInfo( nParentId, WIN_HDW_HANDLE, sHandleSide)
-- aggiungo gli split
local vSplitAreas = WinCreate.AddSplits( nParentId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, vDimensions, 1, WIN_SPLITTYPES.FRENCH)
local bDaylight = AreaTable[JWD_MEASURE_DAYLIGHT]
-- aggiungo il gruppo di ante
local vAreas = WinCreate.AddSashGroup( nParentId, vMeasureType, vDimensions, bDaylight, vJoints, vPartsDim, vSashTypes, vOpeningTypes, nAreaNbr, vSashNbrs)
-- aggiungo le ante
for i = 1, #vSplitAreas do
local nAreaId = WinCreate.AddSash( vSplitAreas[i], vJoints, vSashTypes[i], vOpeningTypes[i])
for i = 1, #vAreas do
-- bottomrail
WinCreate.AddBottomRail( nAreaId, nBottomRailNbr)
WinCreate.AddBottomRail( vAreas[i], nBottomRailNbr, vElementDim)
-- analizzo sottaree
ConvertTableToGeometry( AreaTable[JWD_AREA_LIST][i], nAreaId)
ConvertTableToGeometry( AreaTable[JWD_AREA_LIST][i], vAreas[i])
end
-- aggiungo la ferramenta sull'area split
local nSplitAreaId = EgtGetParent( vAreas[1])
WinCreate.AddHardware( nSplitAreaId, AreaTable[JWD_HARDWARE], sHandleSide)
EgtSetInfo( nSplitAreaId, WIN_HDW_OPTIONS, vsOptions)
end
-- FILL
elseif AreaTable[JWD_AREA_TYPE] == 'FILL' then
local nFillType = EgtIf( AreaTable[JWD_FILL_TYPE] == 'GLASS', WIN_FILLTYPES.GLASS, WIN_FILLTYPES.WOOD)
WinCreate.AddFill( nParentId, nFillType)
local nAreaId = WinCreate.AddFill( nParentId, nFillType, nAreaNbr)
if AreaTable[JWD_AREA_LIST] then
-- inglesine
ConvertTableToGeometry( AreaTable[JWD_AREA_LIST][1], nAreaId)
end
-- SPLIT
elseif AreaTable[JWD_AREA_TYPE] == 'SPLIT' then
elseif AreaTable[JWD_AREA_TYPE] == 'SPLIT' or AreaTable[JWD_AREA_TYPE] == 'INGLESINA' then
local vVertDimensions = {}
local vVertMeasureType = {}
local vVertElementDimension = GetDimensions( AreaTable[JWD_ELEMENT_VERT_DIMENSION])
local vSplitVertDimensions = AreaTable[JWD_SPLIT_VERT_POS]
for i = 1, #vSplitVertDimensions - 1 do
vVertDimensions[i] = vSplitVertDimensions[i][JWD_DIMENSION] / 100
for i = 1, #vSplitVertDimensions do
vVertMeasureType[i] = GetMeasureType( vSplitVertDimensions[i][JWD_MEASURE_TYPE])
vVertDimensions[i] = vSplitVertDimensions[i][JWD_DIMENSION]
end
local vHorizDimensions = {}
local vHorizMeasureType = {}
local vHorizElementDimension = GetDimensions( AreaTable[JWD_ELEMENT_HORIZ_DIMENSION])
local vSplitHorizDimensions = AreaTable[JWD_SPLIT_HORIZ_POS]
for i = 1, #vSplitHorizDimensions - 1 do
vHorizDimensions[i] = vSplitHorizDimensions[i][JWD_DIMENSION] / 100
for i = 1, #vSplitHorizDimensions do
vHorizMeasureType[i] = GetMeasureType( vSplitHorizDimensions[i][JWD_MEASURE_TYPE])
vHorizDimensions[i] = vSplitHorizDimensions[i][JWD_DIMENSION]
end
local nMuntinFillSide = GetMuntinSide( AreaTable[JWD_MUNTIN_SIDE]) -- lato inglesine
local vSplitAreas
if AreaTable[JWD_SPLIT_TYPE] == 'GRID' then
vSplitAreas = WinCreate.AddGridSplits( nParentId, WIN_MEASURE.PERCENTAGE, vVertDimensions, vHorizDimensions, AreaTable[JWD_SPLIT_START_VERT])
vSplitAreas = WinCreate.AddGridSplits( nParentId, vVertMeasureType, vVertDimensions, vHorizMeasureType, vHorizDimensions, AreaTable[JWD_SPLIT_START_VERT],
vVertElementDimension, vHorizElementDimension, nMuntinFillSide, nAreaNbr)
elseif AreaTable[JWD_SPLIT_TYPE] == 'VERTICAL' then
vSplitAreas = WinCreate.AddSplits( nParentId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, vVertDimensions)
vSplitAreas = WinCreate.AddSplits( nParentId, WIN_SPLITORIENTATION.VERTICAL, vVertMeasureType, vVertDimensions, vVertElementDimension, false, true, nMuntinFillSide, nAreaNbr)
else
vSplitAreas = WinCreate.AddSplits( nParentId, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.PERCENTAGE, vHorizDimensions)
vSplitAreas = WinCreate.AddSplits( nParentId, WIN_SPLITORIENTATION.HORIZONTAL, vHorizMeasureType, vHorizDimensions, vHorizElementDimension, false, true, nMuntinFillSide, nAreaNbr)
end
for i = 1, #vSplitAreas do
ConvertTableToGeometry( AreaTable[JWD_AREA_LIST][i], vSplitAreas[i])
@@ -286,6 +361,7 @@ elseif AreaTable[JWD_AREA_TYPE] == 'SPLIT' then
-- NULL
elseif AreaTable[JWD_AREA_TYPE] == 'SPLITTED' then
EgtSetInfo( nParentId, WIN_AREA_NBR, nAreaNbr)
if AreaTable[JWD_AREA_LIST] then
ConvertTableToGeometry( AreaTable[JWD_AREA_LIST][1], nParentId)
end
@@ -312,11 +388,11 @@ function WinManageProject.ReadFromFile( sFilePath, sProfileDir)
end
-- creo le aree
ConvertTableToGeometry( tData[JWD_AREA_LIST][1], GDB_ID.ROOT)
return ConvertTableToGeometry( tData[JWD_AREA_LIST][1], GDB_ID.ROOT)
return true
end
---------------------------------------------------------------------
-- funzione che apre un file jwd
function WinManageProject.ReadFromJwd( sJwd)
local tData = JSON:decode( sJwd)
+16 -3
View File
@@ -23,10 +23,19 @@ EgtOutLog("BaseDir=" .. sBaseDir)
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
local WinCalculate = require( 'WinCalculate')
_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
@@ -58,14 +67,18 @@ 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)
-- WinCalculate.AddAccessories( nFrameId, true)
WinCalculate.AddHardware( nFrameId, true, false, false, false)
WinCalculate.AddAccessories( nFrameId, true)
-- elimino profilo se in batch per test
+261 -81
View File
@@ -24,13 +24,19 @@ EgtAddToPackagePath( sBaseDir .. '?.lua')
EgtAddToPackagePath( sBaseDir .. 'WinLib\\' .. '?.lua')
_G.package.loaded.WinConst = nil
require( 'WinConst')
_G.package.loaded.WinJWDConst = nil
_G.package.loaded.WinCreate = nil
local WinCreate = require( 'WinCreate')
_G.package.loaded.WinCalculate = nil
local WinCalculate = require( 'WinCalculate')
_G.package.loaded.WinManageProject = nil
_G.package.loaded.JSON = nil
_G.package.loaded.xml2lua = nil
_G.package.loaded.xml2lua_tree = nil
require( 'WinConst')
local WinCreate = require( 'WinCreate')
local WinManageProject = require( 'WinManageProject')
local WinCalculate = require( 'WinCalculate')
-- WDG
@@ -40,7 +46,7 @@ local function GetVariableList( sName)
local List = {}
local nIndex = 1
while WDG[sName .. nIndex] do
table.insert(List, WDG['JOINT' .. nIndex])
table.insert(List, WDG[sName .. nIndex])
nIndex = nIndex + 1
end
return List
@@ -55,6 +61,41 @@ local function CleanVariableList( sName)
end
end
----------------------------------------------------------------------------------
local function FillVariableList( sName, List)
CleanVariableList( sName)
for i = 1, #List do
WDG[sName .. i] = List[i]
end
end
----------------------------------------------------------------------------------
local function GetAreaIdsFromNumbers( vAreaNbrs)
-- inizializzo la lista
local vAreaIds = {}
for i = 1, #vAreaNbrs do
vAreaIds[i] = GDB_ID.NULL
end
-- recupero le aree richieste
local vStack = { EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_AREA .. '*')}
local i = 1
while vStack[i] do
local nAreaNbr = EgtGetInfo( vStack[i], WIN_AREA_NBR, 'i') or -1
for j = 1, #vAreaNbrs do
if nAreaNbr == vAreaNbrs[j] then
vAreaIds[j] = vStack[i]
break
end
end
-- ricerco nelle sue sottoaree
local vChildren = EgtGetNameInGroup( vStack[i], WIN_AREA .. '*')
vStack = EgtJoinTables( vStack, vChildren)
i = i + 1
end
return vAreaIds
end
----------------------------------------------------------------------------------
local function SetProfilePath()
_G.sProfilePath = WDG.PROFILEPATH
@@ -94,6 +135,7 @@ local function FindThresholds( nGrpId)
return tThresholds
end
----------------------------------------------------------------------------------
local function GetProfileThresholdsList()
local tThresholds = {}
if _G.sProfile == WDG.PROFILE then
@@ -120,22 +162,133 @@ local function GetProfileThresholdsList()
end
_G.GetProfileThresholdsList = GetProfileThresholdsList
----------------------------------------------------------------------------------
local function GetProfileData( vGrps)
local tData = {}
-- a) dimensioni
for i = 1, #vGrps do
-- scorro tutti i profili e salvo le dimensioni
local sName = EgtGetName( vGrps[i])
local vProfiles = EgtGetAllInGroup( vGrps[i])
for j = 1, #vProfiles do
local sCurrName = sName .. '_' .. EgtGetName( vProfiles[j])
tData[sCurrName .. '_' .. WIN_DIM_STD] = EgtGetInfo( vProfiles[j], WIN_DIM_STD, 'd')
tData[sCurrName .. '_' .. WIN_DIM_MIN] = EgtGetInfo( vProfiles[j], WIN_DIM_MIN, 'd')
tData[sCurrName .. '_' .. WIN_DIM_MAX] = EgtGetInfo( vProfiles[j], WIN_DIM_MAX, 'd')
end
end
-- b) overlap
-- tra ante e telaio
local vProfiles = EgtGetAllInGroup( vGrps[1])
for i = 1, #vProfiles do
local dTopOverlap = EgtGetInfo( vProfiles[i], WIN_SASH_TOP_OVERLAP, 'd')
local dBottomOverlap = EgtGetInfo( vProfiles[i], WIN_SASH_BOTTOM_OVERLAP, 'd')
if dTopOverlap and dBottomOverlap then
tData[EgtGetName( vProfiles[i]) .. '_' .. WIN_TOP .. '_' .. WIN_OVERLAP] = dTopOverlap
tData[EgtGetName( vProfiles[i]) .. '_' .. WIN_BOTTOM .. '_' .. WIN_OVERLAP] = dBottomOverlap
else
tData[EgtGetName( vProfiles[i]) .. '_' .. WIN_OVERLAP] = dTopOverlap or dBottomOverlap
end
end
-- tra ante battenti/riceventi
local nSashActive = EgtGetFirstNameInGroup( vGrps[2], WIN_SASH_ACTIVE)
if nSashActive then
tData[WIN_SASH_ACTIVE .. '_' .. WIN_OVERLAP] = EgtGetInfo( nSashActive, WIN_OVERLAP, 'd')
tData[WIN_SASH_INACTIVE .. '_' .. WIN_OVERLAP] = EgtGetInfo( nSashActive, WIN_OVERLAP, 'd')
end
local nSashFrench = EgtGetFirstNameInGroup( vGrps[2], WIN_FRENCH_IN)
if nSashFrench then
tData[WIN_FRENCH_IN .. '_' .. WIN_OVERLAP] = EgtGetInfo( nSashFrench, WIN_OVERLAP, 'd')
tData[WIN_FRENCH_OUT .. '_' .. WIN_OVERLAP] = EgtGetInfo( nSashFrench, WIN_OVERLAP, 'd')
end
local nSlideActive = EgtGetFirstNameInGroup( vGrps[2], WIN_SLIDE_ACTIVE)
if nSlideActive then
tData[WIN_SLIDE_ACTIVE .. '_' .. WIN_OVERLAP] = EgtGetInfo( nSlideActive, WIN_OVERLAP, 'd')
end
-- tra bottomrail
local nFrameBottomRail = EgtGetFirstNameInGroup( vGrps[1], WIN_RAIL_BOTTOM)
if nFrameBottomRail then
tData[WIN_FRAME .. '_'.. WIN_BOTTOMRAIL .. '_' .. WIN_OVERLAP] = EgtGetInfo( nFrameBottomRail, WIN_OVERLAP, 'd')
end
local nSashBottomRail = EgtGetFirstNameInGroup( vGrps[2], WIN_RAIL_BOTTOM)
if nSashBottomRail then
tData[WIN_SASH .. '_'.. WIN_BOTTOMRAIL .. '_' .. WIN_OVERLAP] = EgtGetInfo( nSashBottomRail, WIN_OVERLAP, 'd')
end
return tData
end
----------------------------------------------------------------------------------
local function WinGetProfileData()
local tData
if _G.sProfile == WDG.PROFILE then
-- se profilo corrente
local nProfileGrp = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE)
local nFrameGrp = EgtGetFirstNameInGroup( nProfileGrp, WIN_FRAME)
local nSashGrp = EgtGetFirstNameInGroup( nProfileGrp, WIN_SASH)
local nFillGrp = EgtGetFirstNameInGroup( nProfileGrp, WIN_FILL)
tData = GetProfileData( { nFrameGrp, nSashGrp, nFillGrp})
else
-- importo temporaneamente il profilo
local nLastId = EgtGetLastInGroup( GDB_ID.ROOT)
local bOk = EgtInsertFile( _G.sProfilePath .. '\\' .. WDG.PROFILE .. '.nge')
local nCurrId = EgtGetNext( nLastId or GDB_ID.NULL) or EgtGetFirstInGroup( GDB_ID.ROOT)
local vGrps = {}
while nCurrId do
table.insert( vGrps, nCurrId)
nCurrId = EgtGetNext( nCurrId)
end
tData = GetProfileData( vGrps)
EgtErase( vGrps)
end
WDG.PROFILEDATA = tData
end
_G.WinGetProfileData = WinGetProfileData
----------------------------------------------------------------------------------
local function WinCreate_CreateFrame()
local JointList = GetVariableList( 'JOINT')
WDG.AREAID = WinCreate.CreateFrame( WDG.FRAMETYPE, JointList, WDG.WIDTH, WDG.HEIGHT, WDG.HEIGHT2)
local DimensionList = GetVariableList( 'DIMENSION')
WDG.AREAID = WinCreate.CreateFrame( WDG.FRAMETYPE, JointList, DimensionList, WDG.AREANBR)
CleanVariableList('JOINT')
CleanVariableList('DIMENSION')
end
_G.WinCreate_CreateFrame = WinCreate_CreateFrame
----------------------------------------------------------------------------------
local function WinCreate_AddSash()
local JointList = GetVariableList( 'JOINT')
WDG.AREAID = WinCreate.AddSash( WDG.AREAID, JointList, WDG.SASHTYPE, WDG.OPENINGTYPE)
WDG.AREAID = WinCreate.AddSash( WDG.AREAID, JointList, WDG.OPENINGTYPE, WDG.AREANBR)
CleanVariableList( 'JOINT')
end
_G.WinCreate_AddSash = WinCreate_AddSash
----------------------------------------------------------------------------------
local function WinCreate_AddSashGroup()
local MeasureTypeList = GetVariableList( 'MEASURETYPE')
local DimensionList = GetVariableList( 'DIMENSION')
local JointList = GetVariableList( 'JOINT')
local SashTypeList = GetVariableList( 'SASHTYPE')
local OpeningTypeList = GetVariableList( 'OPENINGTYPE')
local SashNbrList = GetVariableList( 'SASHNBR')
local AreaList = WinCreate.AddSashGroup( WDG.AREAID, MeasureTypeList, DimensionList, WDG.DAYLIGHT, JointList, nil, SashTypeList, OpeningTypeList, WDG.AREANBR, SashNbrList)
FillVariableList( 'AREAID', AreaList)
CleanVariableList( 'MEASURETYPE')
CleanVariableList( 'DIMENSION')
CleanVariableList( 'JOINT')
CleanVariableList( 'SASHTYPE')
CleanVariableList( 'OPENINGTYPE')
CleanVariableList( 'SASHNBR')
end
_G.WinCreate_AddSashGroup = WinCreate_AddSashGroup
----------------------------------------------------------------------------------
local function WinCreate_AddHardware()
WinCreate.AddHardware( WDG.AREAID, WDG.FAVOURITE, WDG.HANDLE)
@@ -144,7 +297,7 @@ _G.WinCreate_AddHardware = WinCreate_AddHardware
----------------------------------------------------------------------------------
local function WinCreate_AddFill()
WDG.AREAID = WinCreate.AddFill( WDG.AREAID, WDG.FILLTYPE)
WDG.AREAID = WinCreate.AddFill( WDG.AREAID, WDG.FILLTYPE, WDG.AREANBR)
end
_G.WinCreate_AddFill = WinCreate_AddFill
@@ -162,62 +315,38 @@ _G.WinCreate_AddThreshold = WinCreate_AddThreshold
----------------------------------------------------------------------------------
local function WinCreate_AddSplits()
local AreaIndex = 1
while WDG['AREAID' .. AreaIndex] do
WDG['AREAID' .. AreaIndex] = nil
AreaIndex = AreaIndex + 1
end
local PositionList = {}
local PositionIndex = 1
while WDG['POSITION' .. PositionIndex] do
table.insert( PositionList, WDG['POSITION' .. PositionIndex])
PositionIndex = PositionIndex + 1
end
local AreaList = WinCreate.AddSplits(WDG.AREAID, WDG.SPLITORIENTATION, WDG.MEASURETYPE, PositionList, WDG.PROPORTION, WDG.SPLITTYPE)
for AreaIndex = 1, #AreaList do
WDG['AREAID' .. AreaIndex] = AreaList[ AreaIndex]
end
PositionIndex = 1
while WDG['POSITION' .. PositionIndex] do
WDG['POSITION' .. PositionIndex] = nil
PositionIndex = PositionIndex + 1
end
local MeasureTypeList = GetVariableList( 'MEASURETYPE')
local PositionList = GetVariableList( 'POSITION')
local ElemDimList = GetVariableList( 'ELEMENTDIM')
local AreaList = WinCreate.AddSplits( WDG.AREAID, WDG.SPLITORIENTATION, MeasureTypeList, PositionList, ElemDimList, false, true, WDG_MUNTINSIDE, WDG.AREANBR)
FillVariableList( 'AREAID', AreaList)
CleanVariableList( 'MEASURETYPE')
CleanVariableList( 'POSITION')
CleanVariableList( 'ELEMENTDIM')
end
_G.WinCreate_AddSplits = WinCreate_AddSplits
----------------------------------------------------------------------------------
local function WinCreate_AddGridSplits()
local AreaIndex = 1
while WDG['AREAID' .. AreaIndex] do
WDG['AREAID' .. AreaIndex] = nil
AreaIndex = AreaIndex + 1
end
local PositionListVert = {}
local PositionIndex = 1
while WDG['POSITION_VERT' .. PositionIndex] do
table.insert( PositionListVert, WDG['POSITION' .. PositionIndex])
PositionIndex = PositionIndex + 1
end
local PositionListHoriz = {}
PositionIndex = 1
while WDG['POSITION_HORIZ' .. PositionIndex] do
table.insert( PositionListHoriz, WDG['POSITION' .. PositionIndex])
PositionIndex = PositionIndex + 1
end
local AreaList = WinCreate.AddGridSplits(WDG.AREAID, WDG.MEASURETYPE, PositionListVert, PositionListHoriz, WDG.STARTVERTICAL, WDG.SPLITTYPE)
for AreaIndex = 1, #AreaList do
WDG['AREAID' .. AreaIndex] = AreaList[ AreaIndex]
end
PositionIndex = 1
while WDG['POSITION_VERT' .. PositionIndex] do
WDG['POSITION_VERT' .. PositionIndex] = nil
PositionIndex = PositionIndex + 1
end
PositionIndex = 1
while WDG['POSITION_HORIZ' .. PositionIndex] do
WDG['POSITION_HORIZ' .. PositionIndex] = nil
PositionIndex = PositionIndex + 1
end
local MeasureTypeListVert = GetVariableList( 'MEASURETYPE_VERT')
local MeasureTypeListHoriz = GetVariableList( 'MEASURETYPE_HORIZ')
local PositionListVert = GetVariableList( 'POSITION_VERT')
local PositionListHoriz = GetVariableList( 'POSITION_HORIZ')
local ElemDimListVert = GetVariableList( 'ELEMENTDIM_VERT')
local ElemDimListHoriz = GetVariableList( 'ELEMENTDIM_HORIZ')
local AreaList = WinCreate.AddGridSplits( WDG.AREAID, MeasureTypeListVert, PositionListVert, MeasureTypeListHoriz, PositionListHoriz, WDG.STARTVERTICAL,
ElemDimListVert, ElemDimListHoriz, WDG.MUNTINSIDE, WDG.AREANBR)
FillVariableList( 'AREAID', AreaList)
CleanVariableList( 'MEASURETYPE_VERT')
CleanVariableList( 'MEASURETYPE_HORIZ')
CleanVariableList( 'POSITION_VERT')
CleanVariableList( 'POSITION_HORIZ')
CleanVariableList( 'ELEMENTDIM_VERT')
CleanVariableList( 'ELEMENTDIM_HORIZ')
end
_G.WinCreate_AddGridSplits = WinCreate_AddGridSplits
@@ -245,23 +374,26 @@ local function WinCalculate_CreatePartFromArea()
end
_G.WinCalculate_CreatePartFromArea = WinCalculate_CreatePartFromArea
----------------------------------------------------------------------------------
local function WinCalculate_RecalcSolids()
WinCalculate.RecalcSolids( WDG.FRAMEID)
end
_G.WinCalculate_RecalcSolids = WinCalculate_RecalcSolids
----------------------------------------------------------------------------------
local function WinCalculate_AddHardware()
WDG.HARDWAREKIT_LIST, WDG.HARDWAREPOSITION_LIST = WinCalculate.AddHardware( WDG.FRAMEID)
WDG.HARDWAREKIT_LIST, WDG.HARDWAREPOSITION_LIST, WDG.HARDWAREOPTION_LIST = WinCalculate.AddHardware( WDG.FRAMEID, WDG.CALC_MACHINING, WDG.CALC_HARDWARELIST, WDG.CALC_POSITIONLIST, WDG.CALC_OPTIONLIST)
end
_G.WinCalculate_AddHardware = WinCalculate_AddHardware
----------------------------------------------------------------------------------
local function WinCreate_GetHardwareOptionPath()
WDG.HWDOPTPATH = WinCalculate.AddHardwareForSash( WDG.AREAID, true)
local function WinCalculate_AddHardwareByGroupId()
-- recupero gli id geometrici delle aree richieste
local vAreaNbrs = GetVariableList( 'AREANBR')
local vAreaIds = GetAreaIdsFromNumbers( vAreaNbrs)
for i = 1, #vAreaIds do
if vAreaIds[i] ~= GDB_ID.NULL then
WDG['HARDWAREKIT_LIST' .. tostring(i)], WDG['HARDWAREPOSITION_LIST' .. tostring(i)], WDG['HARDWAREOPTION_LIST' .. tostring(i)] =
WinCalculate.AddHardware( vAreaIds[i], WDG.CALC_MACHINING, WDG.CALC_HARDWARELIST, WDG.CALC_POSITIONLIST, WDG.CALC_OPTIONLIST)
end
end
end
_G.WinCreate_GetHardwareOptionPath = WinCreate_GetHardwareOptionPath
_G.WinCalculate_AddHardwareByGroupId = WinCalculate_AddHardwareByGroupId
----------------------------------------------------------------------------------
local function WinCalculate_AddAccessories()
@@ -360,20 +492,68 @@ end
_G.WinGetGlassesList = WinGetGlassesList
----------------------------------------------------------------------------------
local function WinCalculate_SetCalcHardwareKit()
WinCalculate.SetCalcHardwareKit( WDG.VALUE)
local function WinGetSashShape()
-- recupero gli id geometrici delle aree richieste
local vAreaNbrs = GetVariableList( 'AREANBR')
local vAreaIds = GetAreaIdsFromNumbers( vAreaNbrs)
-- ricavo le forme
for i = 1, #vAreaIds do
if vAreaIds[i] ~= GDB_ID.NULL then
WDG['SASHSHAPE' .. tostring( i)] = EgtGetInfo( vAreaIds[i], WIN_SASH_SHAPE)
end
end
end
_G.WinCalculate_SetCalcHardwareKit = WinCalculate_SetCalcHardwareKit
_G.WinGetSashShape = WinGetSashShape
----------------------------------------------------------------------------------
local function WinCalculate_SetCalcHardwarePosition()
WinCalculate.SetCalcHardwarePosition( WDG.VALUE)
local function WinGetAreaProfiles()
-- restituisce una lista dove ogni elemento è una tabella con le seguenti chiavi : GroupId = AREANBR corrispondente, EntId = sottoentità ( e.g. anta, area di split a griglia),
-- Profiles = lista dei profili dei pezzi di quell'area
-- recupero gli id geometrici delle aree richieste
local vAreaNbrs = GetVariableList( 'AREANBR')
local vAreaIds = GetAreaIdsFromNumbers( vAreaNbrs)
-- ricavo i profili
local tabProfiles = {}
for i = 1, #vAreaIds do
if vAreaIds[i] ~= GDB_ID.NULL then
local nAreaType = EgtGetInfo( vAreaIds[i], WIN_AREATYPE, 'i')
if nAreaType == WIN_AREATYPES.FRAME then
table.insert( tabProfiles, { GroupId = vAreaNbrs[i], EntId = -1, Profiles = EgtGetInfo( vAreaIds[i], WIN_AREA_PROFILES, 'vs')})
elseif nAreaType == WIN_AREATYPES.SASH then
table.insert( tabProfiles, { GroupId = vAreaNbrs[i], EntId = 1, Profiles = EgtGetInfo( vAreaIds[i], WIN_AREA_PROFILES, 'vs')})
elseif nAreaType == WIN_AREATYPES.SPLIT then
local nSplitType = EgtGetInfo( vAreaIds[i], WIN_SPLITTYPE, 'i')
-- se french split devo recuperare le ante che definisce
if nSplitType == WIN_SPLITTYPES.FRENCH then
local vSashes = EgtGetNameInGroup( vAreaIds[i], WIN_AREA .. '*')
for j = 1, #vSashes do
local nSashId = EgtGetInfo( vSashes[j], WIN_SASH_NBR, 'i')
table.insert( tabProfiles, { GroupId = vAreaNbrs[i], EntId = nSashId, Profiles = EgtGetInfo( vSashes[j], WIN_AREA_PROFILES, 'vs')})
end
-- se split standard recupero i profili
else
local bGridSplit = EgtGetInfo( vAreaIds[i], WIN_GRID_SPLIT, 'b') or false
if bGridSplit then
-- distinguo per ordine di split
local nOrder = 0
local vProfiles = EgtGetInfo( vAreaIds[i], WIN_AREA_PROFILES .. tostring( nOrder), 'vs')
while vProfiles do
table.insert( tabProfiles, { GroupId = vAreaNbrs[i], EntId = nOrder, Profiles = vProfiles})
nOrder = nOrder + 1
vProfiles = EgtGetInfo( vAreaIds[i], WIN_AREA_PROFILES .. tostring( nOrder), 'vs')
end
else
table.insert( tabProfiles, { GroupId = vAreaNbrs[i], EntId = 0, Profiles = EgtGetInfo( vAreaIds[i], WIN_AREA_PROFILES, 'vs')})
end
end
end
end
end
WDG['AREAPROFILES'] = tabProfiles
end
_G.WinCalculate_SetCalcHardwarePosition = WinCalculate_SetCalcHardwarePosition
----------------------------------------------------------------------------------
local function WinCalculate_GetHardwareOptions()
WDG.HARDWAREOPTIONS = WinCalculate.GetHardwareOptions( WDG.AREAID)
end
_G.WinCalculate_GetHardwareOptions = WinCalculate_GetHardwareOptions
_G.WinGetAreaProfiles = WinGetAreaProfiles
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

+6
View File
@@ -0,0 +1,6 @@
-- Version.lua by Egaltech s.r.l. 2026/01/14
-- Gestione della versione di Window
NAME = 'Window'
VERSION = '3.1a1'
MIN_EXE = '3.1a1'
+6
View File
@@ -0,0 +1,6 @@
[Window]
JwdEnable=1
BaseDir=C:\EgtData\Window
Button1=Designing\WinOpenProjectFile.lua,Images\CreateWin.png,Crea Serramento 3d
Button2=CAMAuto\ProcessWin.lua,Images\ProcessWin.png,Lavora Pezzi Serramento