Compare commits
63 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cba228c626 | |||
| 49d7bccb41 | |||
| 057fb91994 | |||
| d709c374e6 | |||
| 106c373b52 | |||
| 73a5ad4507 | |||
| f04a6f72c5 | |||
| d8d34552e9 | |||
| b8b10497a7 | |||
| 68425bd133 | |||
| d0398e9d5d | |||
| b27b0e6bf6 | |||
| c2946b8d9c | |||
| f39063d4d2 | |||
| 402400353b | |||
| a85a50d7c1 | |||
| f70604fd6c | |||
| b648385b60 | |||
| 228d6d4cb3 | |||
| fee697d330 | |||
| 182f5c91db | |||
| ce91996f40 | |||
| 499ff1f245 | |||
| c8a7fa0c11 | |||
| 17bb7b06ba | |||
| a459c31537 | |||
| 984ea28304 | |||
| f20ff953d0 | |||
| f81856f523 | |||
| a77901fcc3 | |||
| 36691a7e06 | |||
| 7564dbdc0b | |||
| 46bf9740e5 | |||
| 6cee6e52ab | |||
| 65d7bcec33 | |||
| 1f3db97f73 | |||
| a090d17e07 | |||
| 15e3bf7921 | |||
| a79836db69 | |||
| b1d85c173b | |||
| 77fa6641b1 | |||
| b0259acf2f | |||
| 67589d44ef | |||
| 109f43c927 | |||
| 212360c666 | |||
| f5aae593e1 | |||
| 00c660811d | |||
| 66d41f20a3 | |||
| d29ecc5a84 | |||
| bb291d6101 | |||
| cf8065e226 | |||
| 6434b264fa | |||
| 1d14ff1535 | |||
| 5d9fad7e3a | |||
| f04367e529 | |||
| 407e32d6b0 | |||
| 0173df493d | |||
| 5e4a0b2cb1 | |||
| 665ad78c87 | |||
| 6c075e9053 | |||
| 75be8c4864 | |||
| 100db4fb90 | |||
| afe6afc961 |
@@ -0,0 +1,409 @@
|
||||
-- BatchProcessNew.lua by Egalware s.r.l. 2025/04/24
|
||||
|
||||
-- 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\\Window.nge'
|
||||
|
||||
-- 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')
|
||||
|
||||
local sTxtLogFile = EgtChangePathExtension( WIN.FILE, '.txt')
|
||||
EgtOpenFile( WIN.FILE)
|
||||
|
||||
-- Verifico che la macchina corrente sia abilitata per la lavorazione delle Travi
|
||||
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
|
||||
_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')
|
||||
|
||||
-- Carico i dati globali
|
||||
local WinData = require( 'WinData')
|
||||
|
||||
-- Variabili globali
|
||||
PARTS = {} -- tabella contenente tutte le informazioni di ogni pezzo
|
||||
|
||||
-- Colore del grezzo
|
||||
local ColA = Color3d( 255, 165, 0, 30)
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function GetDataConfig()
|
||||
-- recupero utensili dal magazzino
|
||||
WinExec.GetToolsFromDB()
|
||||
|
||||
-- TODO da gestire eventuali errori bloccanti
|
||||
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
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- *** Recupero i pezzi da processare ***
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function MyProcessInputData()
|
||||
-- Recupero le travi selezionate
|
||||
local nId = EgtGetFirstInGroup( GDB_ID.ROOT)
|
||||
while nId do
|
||||
-- Per capire se è un pezzo controllo una nota, servirebbe info dedicata, oppure essere sicuri che vengano passati solo pezzi
|
||||
if EgtGetInfo( nId, 'OFFY_1', 'd') then
|
||||
table.insert( PARTS, { id = nId, sName = ( EgtGetName( nId) or ( 'Id=' .. tonumber( nId)))})
|
||||
-- TODO RIMUOVERE! Bisogna sempre prendere tuttti i pezzi all'interno del file. Devono arrivare solo i pezzi da mettere nella macchinata
|
||||
if #PARTS == 2 then
|
||||
break
|
||||
end
|
||||
end
|
||||
nId = EgtGetNext( 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)
|
||||
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
|
||||
|
||||
EgtDeselectAll()
|
||||
|
||||
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
|
||||
local sOffYPh1 = EgtIf( PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetY, tostring( PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetY), tostring( PARTS[nPieceIndex].dPartWidth / 2))
|
||||
local sOffZPh1 = EgtIf( PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetZ, tostring( PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetZ), '0')
|
||||
local sOffYPh2 = EgtIf( PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetY, tostring( PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetY), tostring( PARTS[nPieceIndex].dPartWidth / 2))
|
||||
local sOffZPh2 = EgtIf( PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetZ, tostring( PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetZ), '0')
|
||||
|
||||
local vInp = EgtDialogBox( 'Dati di disposizione pezzo: ' .. PARTS[nPieceIndex].sName,
|
||||
{'Sporgenza laterale FASE1', sOffYPh1}, {'Posizione Z FASE1', sOffZPh1},
|
||||
{'Sporgenza laterale FASE2', sOffYPh2}, {'Posizione Z FASE2', sOffZPh2})
|
||||
if not vInp or #vInp == 0 then
|
||||
return false
|
||||
end
|
||||
|
||||
-- salvo input nei valori che utilizzerò dopo
|
||||
PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetY = tonumber( vInp[1])
|
||||
PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetZ = tonumber( vInp[2])
|
||||
PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetY = tonumber( vInp[3])
|
||||
PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetZ = tonumber( vInp[4])
|
||||
|
||||
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
|
||||
---------------------------------------------------------------------
|
||||
local function CreateRaws( PARTS)
|
||||
for i = 1, #PARTS do
|
||||
-- si crea un grezzo "finto" (un cubo da 100mm) nell'origine del pezzo, verrà poi dimensionato uan volta adeguato con i vari sovramateriali
|
||||
PARTS[i].idRaw = EgtAddRawPart( PARTS[i].frame:getOrigin(), 100, 100, 100, ColA)
|
||||
EgtAddPartToRawPart( PARTS[i].id, ORIG(), PARTS[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( PARTS)
|
||||
for i = 1, #PARTS do
|
||||
-- allineo il pezzo all'interno del grezzo
|
||||
local dRotX, dRotY, dRotZ = GetFixedAxesRotABCFromFrame( PARTS[i].frame)
|
||||
-- se devo ruotare
|
||||
if abs( dRotZ) > GEO.EPS_ANG_SMALL then
|
||||
EgtRotatePartInRawPart( PARTS[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( PARTS[i].id, GDB_BB.ONLY_VISIBLE)
|
||||
local dPartPosX = b3Part:getMin():getX()
|
||||
local dPartPosY = b3Part:getMin():getY()
|
||||
local dPartPosZ = b3Part:getMin():getZ()
|
||||
local b3Raw = EgtGetRawPartBBox( PARTS[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( PARTS[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
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- *** Inserimento delle travi nel grezzo ***
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function MyProcessPieces()
|
||||
|
||||
-- creo macchinata
|
||||
local MachGroupName = NewMachGroupName()
|
||||
local nMachGroup = EgtAddMachGroup( MachGroupName)
|
||||
|
||||
-- si crea il grezzo
|
||||
CreateRaws( PARTS)
|
||||
|
||||
-- allineo i pezzi come orientamento richiesto dalla macchina
|
||||
AlignRawsToTable( PARTS)
|
||||
|
||||
-- aggiungo sovramateriale ai grezzi
|
||||
AddOverMaterialToRaw( PARTS)
|
||||
|
||||
-- recupero offset per posizionamento
|
||||
for i = 1, #PARTS do
|
||||
PARTS[i].DispOffsets = {}
|
||||
PARTS[i].DispOffsets.Phase1 = {}
|
||||
PARTS[i].DispOffsets.Phase2 = {}
|
||||
|
||||
local bInsertedAllOffs = GetDispOffsetFromNotes( i)
|
||||
-- se non sono settati nelle note, li chiedo
|
||||
if not bInsertedAllOffs then
|
||||
bInsertedAllOffs = GetDispOffsetFromInput( i)
|
||||
end
|
||||
-- se non sono stati inseriti o c'è stato un errore esco subito
|
||||
if not bInsertedAllOffs then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-- si dispongono i pezzi sulla tavola
|
||||
local bDispOk, sErr = WinData.ExecDisposition( PARTS)
|
||||
if not bDispOk then
|
||||
if not sErr then
|
||||
sErr = 'Errore non gestito in WinData.ExecDisposition'
|
||||
end
|
||||
EgtOutBox( sErr, 'ProcessWin', 'ERROR', 'OK')
|
||||
return false
|
||||
end
|
||||
|
||||
-- Impostazione dell'attrezzaggio di default
|
||||
local bOk = EgtImportSetup()
|
||||
if not bOk then
|
||||
EgtImportSetup( 'Default')
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- *** Inserimento delle lavorazioni ***
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function MyProcessFeatures()
|
||||
local bOk = WinExec.ProcessFeatures( PARTS)
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- *** Esecuzione ***
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- script principale
|
||||
|
||||
local sFlag = ''
|
||||
if WIN.FLAG == 0 then
|
||||
sFlag = 'CHECK+GENERATE'
|
||||
else
|
||||
sFlag = 'FLAG='..tostring( WIN.FLAG)
|
||||
end
|
||||
local sLog = 'BatchProcess : ' .. WIN.FILE .. ', ' .. ( WIN.MACHINE or EgtGetCurrMachineName()) .. ', ' .. sFlag
|
||||
EgtOutLog( sLog)
|
||||
|
||||
|
||||
-- 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')
|
||||
|
||||
if not MyProcessFeatures() then return end
|
||||
|
||||
|
||||
-- Imposto Nome file CN
|
||||
local _, sName, _ = EgtSplitPath( WIN.FILE)
|
||||
EgtSetInfo( EgtGetCurrMachGroup(), 'NcName', sName .. '.cnc')
|
||||
|
||||
|
||||
-- Salvo il progetto
|
||||
EgtSaveFile( WIN.FILE)
|
||||
|
||||
|
||||
-- *** 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 '')
|
||||
end
|
||||
WriteErrToLogFile( WIN.ERR, WIN.MSG, WIN.ROT, WIN.CUTID, WIN.TASKID)
|
||||
-- TODO gestire collisione su feature specifica!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
BeamExec.AddApplyResultToGlobalList( WIN.ERR, WIN.CUTID, WIN.MSG)
|
||||
WIN.RESULT = WinLib.TableCopyDeep( RESULT)
|
||||
WriteResultToJson( RESULT)
|
||||
return
|
||||
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
|
||||
-- TODO gestire errori in stima
|
||||
end
|
||||
|
||||
|
||||
EgtOutLog( ' +++ BatchProcess completed')
|
||||
@@ -0,0 +1,374 @@
|
||||
-- Process.lua by Egalware s.r.l. 2024/06/13
|
||||
-- Gestione calcolo disposizione e lavorazioni per serramenti
|
||||
-- Si opera sulla macchina corrente
|
||||
-- 2024/06/13 PRIMA VERSIONE
|
||||
|
||||
|
||||
-- Intestazioni
|
||||
require( 'EgtBase')
|
||||
_ENV = EgtProtectGlobal()
|
||||
EgtEnableDebug( false)
|
||||
|
||||
|
||||
-- Verifico che la macchina corrente sia abilitata per la lavorazione delle Travi
|
||||
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
|
||||
|
||||
-- Carico i dati globali
|
||||
local WinData = require( 'WinData')
|
||||
|
||||
-- Variabili globali
|
||||
PARTS = {}
|
||||
GROUPS = {}
|
||||
|
||||
-- Colore del grezzo
|
||||
local ColA = Color3d( 255, 165, 0, 30)
|
||||
|
||||
-- TODO DA RIMUOVERE, il parametro deve essere passato
|
||||
local WIN = {}
|
||||
WIN.OPT_TYPE = 'PIECE'
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- *** Recupero offset applicato al profilo ***
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
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
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- *** Recupero i pezzi da processare ***
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function GetInfoPieces()
|
||||
-- Recupero le travi selezionate
|
||||
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 = GetDispOffsetFromNotes( 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
|
||||
return false
|
||||
end
|
||||
|
||||
sOut = sOut .. PARTS[i].sName .. ', '
|
||||
end
|
||||
sOut = sOut:sub( 1, -3)
|
||||
EgtOutLog( 'Pezzi : ' .. sOut, 1)
|
||||
end
|
||||
|
||||
EgtDeselectAll()
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Aggiunge al grezzo i sovramateriali pre-impostati
|
||||
---------------------------------------------------------------------
|
||||
local function AddOverMaterialToRaw( PiecesInMachGroup)
|
||||
for i = 1, #PiecesInMachGroup do
|
||||
|
||||
-- prima di aggiungere sovramateriale al grezzo, calcolo dimensioni del finito
|
||||
local b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PiecesInMachGroup[i].id, 'Geo') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
PiecesInMachGroup[i].b3Part = b3Part
|
||||
PiecesInMachGroup[i].dPartLength = PiecesInMachGroup[i].b3Part:getDimX()
|
||||
PiecesInMachGroup[i].dPartWidth = PiecesInMachGroup[i].b3Part:getDimY()
|
||||
PiecesInMachGroup[i].dPartHeight = PiecesInMachGroup[i].b3Part:getDimZ()
|
||||
|
||||
-- recupero sovramateriale
|
||||
PiecesInMachGroup[i].RawOffset = {}
|
||||
-- recupero info sovramateriale
|
||||
PiecesInMachGroup[i].RawOffset.dOverMatIn = EgtGetInfo( PiecesInMachGroup[i].id, 'OVERMAT_IN', 'd') or 5
|
||||
PiecesInMachGroup[i].RawOffset.dOverMatOut = EgtGetInfo( PiecesInMachGroup[i].id, 'OVERMAT_OUT', 'd') or 5
|
||||
PiecesInMachGroup[i].RawOffset.dOverMatLeft = EgtGetInfo( PiecesInMachGroup[i].id, 'OVERMAT_LEFT', 'd') or 5
|
||||
PiecesInMachGroup[i].RawOffset.dOverMatRight = EgtGetInfo( PiecesInMachGroup[i].id, 'OVERMAT_RIGHT', 'd') or 5
|
||||
|
||||
PiecesInMachGroup[i].dRawLength = PiecesInMachGroup[i].RawOffset.dOverMatLeft + PiecesInMachGroup[i].dPartLength + PiecesInMachGroup[i].RawOffset.dOverMatRight
|
||||
PiecesInMachGroup[i].dRawWidth = PiecesInMachGroup[i].RawOffset.dOverMatOut + PiecesInMachGroup[i].dPartWidth + PiecesInMachGroup[i].RawOffset.dOverMatIn
|
||||
PiecesInMachGroup[i].dRawHeight = PiecesInMachGroup[i].dPartHeight
|
||||
|
||||
EgtModifyRawPartSize( PiecesInMachGroup[i].idRaw, PiecesInMachGroup[i].dRawLength, PiecesInMachGroup[i].dRawWidth, PiecesInMachGroup[i].dPartHeight)
|
||||
|
||||
local vtMove = Vector3d( PiecesInMachGroup[i].RawOffset.dOverMatLeft, PiecesInMachGroup[i].RawOffset.dOverMatOut, 0)
|
||||
EgtMovePartInRawPart( PiecesInMachGroup[i].id, vtMove)
|
||||
|
||||
-- TODO da controllare, se ruotato di 180° bisognerebbe prendere dOverMatIn. Lo stesso per la X
|
||||
PiecesInMachGroup[i].OffsetPartToRaw = {}
|
||||
PiecesInMachGroup[i].OffsetPartToRaw.X = PiecesInMachGroup[i].RawOffset.dOverMatLeft
|
||||
PiecesInMachGroup[i].OffsetPartToRaw.Y = PiecesInMachGroup[i].RawOffset.dOverMatOut
|
||||
end
|
||||
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
|
||||
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
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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] = BeamLib.TableCopyDeep( value)
|
||||
end
|
||||
else
|
||||
CopiedTable[ key] = value
|
||||
end
|
||||
end
|
||||
|
||||
return CopiedTable
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
return WinLib
|
||||
+520
-585
File diff suppressed because it is too large
Load Diff
+65
-28
@@ -27,17 +27,33 @@ 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,
|
||||
}
|
||||
@@ -84,9 +100,11 @@ WIN_AREATYPES = {
|
||||
WIN_SPLITTYPE = 'SplitType'
|
||||
WIN_SPLITTYPES = {
|
||||
NULL = 0,
|
||||
MULLION = 1, -- montante
|
||||
FRENCH = 2, -- battente / ricevente
|
||||
MULLION = 1, -- montante nel telaio che separa due ante
|
||||
FRENCH = 2, -- per ante battente / ricevente
|
||||
MIXED = 3, -- cambio profilo
|
||||
INSASH = 4, -- divisione nell'anta
|
||||
INFRAME = 5, -- divisione nel telaio che separa due vetri fissi
|
||||
}
|
||||
|
||||
-- tipi di riempimento interno
|
||||
@@ -134,11 +152,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 +168,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,6 +177,7 @@ WIN_TOP = 'Top'
|
||||
WIN_LEFT = 'Left'
|
||||
|
||||
-- info varie su aree e curve
|
||||
WIN_PART_DIM = 'PartDim'
|
||||
WIN_SOU = 'SOU'
|
||||
WIN_CHILD = 'CHILD'
|
||||
WIN_COPY = 'COPY'
|
||||
@@ -166,7 +187,7 @@ WIN_REF_BOTTOMRAIL_PART = 'BottomRailPartRef'
|
||||
WIN_PREV_OUTLINES = 'PrevOutlines'
|
||||
WIN_NEXT_OUTLINES = 'NextOutlines'
|
||||
WIN_REF_SPLIT = 'RefSplit'
|
||||
WIN_PRJ_ORIGSPLIT = 'OrigSplit'
|
||||
WIN_INV_SPLIT = 'InvSplit'
|
||||
WIN_CRV_ON_FRENCH_SPLIT = 'OutlineOnFrenchSplit'
|
||||
WIN_SPLIT_STARTINTERS = 'SplitStartInters'
|
||||
WIN_SPLIT_ENDINTERS = 'SplitEndInters'
|
||||
@@ -174,7 +195,15 @@ 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_REF_DIM = 'SplitRefDim'
|
||||
WIN_SPLIT_OFFS = 'SplitOffs'
|
||||
WIN_GRID_SPLIT = 'GridSplit'
|
||||
|
||||
-- PROFILI
|
||||
WIN_PROFILE = 'Profile'
|
||||
@@ -193,6 +222,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'
|
||||
@@ -244,13 +274,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 +313,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,22 +331,8 @@ 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'
|
||||
@@ -349,16 +370,22 @@ 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_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_MIXED_SASHFILL = 'MixedSashFill'
|
||||
|
||||
|
||||
-- SOLIDI
|
||||
@@ -366,8 +393,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 +420,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 +461,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
|
||||
|
||||
@@ -24,21 +24,33 @@ 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_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_FILL_TYPE = 'FillType'
|
||||
|
||||
|
||||
+4296
-2758
File diff suppressed because it is too large
Load Diff
+545
-477
File diff suppressed because it is too large
Load Diff
@@ -17,31 +17,49 @@
|
||||
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 GetSplitDimensions( tDimensions)
|
||||
local vDims = {}
|
||||
for i = 1, #tDimensions do
|
||||
local nIndex = tDimensions[i][JWD_INDEX]
|
||||
local nArea = tDimensions[i][JWD_SPLIT_AREA]
|
||||
if not vDims[nArea] then
|
||||
vDims[nArea] = {}
|
||||
end
|
||||
vDims[nArea][nIndex] = tDimensions[i][JWD_VALUE]
|
||||
end
|
||||
return vDims
|
||||
end
|
||||
---------------------------------------------------------------------
|
||||
local function GetFrameShape( sShape)
|
||||
|
||||
@@ -57,6 +75,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 +116,20 @@ 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
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- funzione che ricava la tipologia dell'anta in base al tipo di apertura e alla struttura
|
||||
local function GetSashTypes( tSashes, vOpeningTypes)
|
||||
@@ -160,25 +194,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 +236,128 @@ local function ConvertTableToGeometry( AreaTable, nParentId)
|
||||
|
||||
-- recupero dati
|
||||
local tSashes = AreaTable[JWD_SASH_LIST]
|
||||
local vJoints = GetJoints( AreaTable[JWD_JOINTS])
|
||||
local nBottomRailNbr = 0
|
||||
local vElementDim = GetDimensions( AreaTable[JWD_BR_ELEMENT_DIMENSION])
|
||||
if AreaTable[JWD_BOTTOMRAIL] then
|
||||
nBottomRailNbr = AreaTable[JWD_BOTTOMRAIL_QTY]
|
||||
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)
|
||||
|
||||
|
||||
-- aggiungo il gruppo di ante
|
||||
local vAreas = WinCreate.AddSashGroup( nParentId, vMeasureType, vDimensions, 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)
|
||||
WinCreate.AddFill( nParentId, nFillType, nAreaNbr)
|
||||
|
||||
|
||||
-- SPLIT
|
||||
elseif AreaTable[JWD_AREA_TYPE] == 'SPLIT' then
|
||||
elseif AreaTable[JWD_AREA_TYPE] == 'SPLIT' then
|
||||
local vVertDimensions = {}
|
||||
local vVertMeasureType = {}
|
||||
local vVertElementDimension = GetSplitDimensions(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 = GetSplitDimensions(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 vSplitAreas
|
||||
if AreaTable[JWD_SPLIT_TYPE] == 'GRID' then
|
||||
vSplitAreas = WinCreate.AddGridSplits( nParentId, WIN_MEASURE.PERCENTAGE, vVertDimensions, vHorizDimensions, AreaTable[JWD_SPLIT_START_VERT])
|
||||
local vElementDimension = {}
|
||||
if AreaTable[JWD_SPLIT_START_VERT] then
|
||||
vElementDimension = vVertElementDimension[0]
|
||||
for i = 1, #vHorizElementDimension do
|
||||
EgtJoinTables( vElementDimension, vHorizElementDimension[i])
|
||||
end
|
||||
else
|
||||
vElementDimension = vHorizElementDimension[0]
|
||||
for i = 1, #vVertElementDimension do
|
||||
EgtJoinTables( vElementDimension, vVertElementDimension[i])
|
||||
end
|
||||
end
|
||||
vSplitAreas = WinCreate.AddGridSplits( nParentId, vVertMeasureType, vVertDimensions, vHorizMeasureType, vHorizDimensions, AreaTable[JWD_SPLIT_START_VERT], vElementDimension, 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[0], false, nAreaNbr)
|
||||
else
|
||||
vSplitAreas = WinCreate.AddSplits( nParentId, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.PERCENTAGE, vHorizDimensions)
|
||||
vSplitAreas = WinCreate.AddSplits( nParentId, WIN_SPLITORIENTATION.HORIZONTAL, vHorizMeasureType, vHorizDimensions, vHorizElementDimension[0], false, nAreaNbr)
|
||||
end
|
||||
for i = 1, #vSplitAreas do
|
||||
ConvertTableToGeometry( AreaTable[JWD_AREA_LIST][i], vSplitAreas[i])
|
||||
@@ -286,6 +366,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 +393,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)
|
||||
|
||||
@@ -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
|
||||
|
||||
+242
-75
@@ -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,128 @@ local function GetProfileThresholdsList()
|
||||
end
|
||||
_G.GetProfileThresholdsList = GetProfileThresholdsList
|
||||
|
||||
----------------------------------------------------------------------------------
|
||||
local function GetProfileData( nFrameGrp, nSashGrp)
|
||||
local tData = {}
|
||||
|
||||
-- a) dimensioni
|
||||
for i = 1, 2 do
|
||||
-- scorro tutti i profili e salvo le dimensioni
|
||||
local sName = EgtIf( i == 1, WIN_FRAME, WIN_SASH)
|
||||
local vProfiles = EgtGetAllInGroup( EgtIf( i ==1, nFrameGrp, nSashGrp))
|
||||
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( nFrameGrp)
|
||||
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( nSashGrp, WIN_SASH_ACTIVE)
|
||||
if nSashActive then
|
||||
tData[WIN_SASH_ACTIVE .. '_' .. WIN_OVERLAP] = EgtGetInfo( nSashActive, WIN_OVERLAP, 'd')
|
||||
end
|
||||
local nSashFrench = EgtGetFirstNameInGroup( nSashGrp, WIN_FRENCH_IN)
|
||||
if nSashFrench then
|
||||
tData[WIN_FRENCH_IN .. '_' .. WIN_OVERLAP] = EgtGetInfo( nSashFrench, WIN_OVERLAP, 'd')
|
||||
end
|
||||
local nSlideActive = EgtGetFirstNameInGroup( nSashGrp, WIN_SLIDE_ACTIVE)
|
||||
if nSlideActive then
|
||||
tData[WIN_SLIDE_ACTIVE .. '_' .. WIN_OVERLAP] = EgtGetInfo( nSlideActive, WIN_OVERLAP, 'd')
|
||||
end
|
||||
|
||||
-- tra bottomrail
|
||||
local nFrameBottomRail = EgtGetFirstNameInGroup( nFrameGrp, WIN_RAIL_BOTTOM)
|
||||
if nFrameBottomRail then
|
||||
tData[WIN_FRAME .. '_'.. WIN_BOTTOMRAIL .. '_' .. WIN_OVERLAP] = EgtGetInfo( nFrameBottomRail, WIN_OVERLAP, 'd')
|
||||
end
|
||||
local nSashBottomRail = EgtGetFirstNameInGroup( nSashGrp, 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)
|
||||
tData = GetProfileData( nFrameGrp, nSashGrp)
|
||||
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[1], vGrps[2])
|
||||
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 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, WDG.MEASURETYPE, DimensionList, JointList, SashTypeList, OpeningTypeList, WDG.AREANBR, SashNbrList)
|
||||
FillVariableList( 'AREAID', AreaList)
|
||||
|
||||
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 +292,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 +310,23 @@ _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 PositionList = GetVariableList( 'POSITION')
|
||||
local AreaList = WinCreate.AddSplits( WDG.AREAID, WDG.SPLITORIENTATION, WDG.MEASURETYPE, PositionList, false, WDG.AREANBR)
|
||||
FillVariableList( 'AREAID', AreaList)
|
||||
CleanVariableList( 'POSITION')
|
||||
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 PositionListVert = GetVariableList( 'POSITION_VERT')
|
||||
local PositionListHoriz = GetVariableList( 'POSITION_HORIZ')
|
||||
|
||||
local AreaList = WinCreate.AddGridSplits( WDG.AREAID, WDG.MEASURETYPE, PositionListVert, PositionListHoriz, WDG.STARTVERTICAL, WDG.AREANBR)
|
||||
FillVariableList( 'AREAID', AreaList)
|
||||
|
||||
CleanVariableList( 'POSITION_VERT')
|
||||
CleanVariableList( 'POSITION_HORIZ')
|
||||
end
|
||||
_G.WinCreate_AddGridSplits = WinCreate_AddGridSplits
|
||||
|
||||
@@ -253,15 +362,24 @@ _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 +478,69 @@ 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 nSplitLayId = EgtGetFirstNameInGroup( vAreaIds[i], WIN_SPLIT)
|
||||
local nSplitType = EgtGetInfo( nSplitLayId, 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 = -1, 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 |
@@ -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'
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user