DataWindow :

- aggiunte funzioni per recuperare dal progetto le lunghezze totali per sezione e le dimensioni dei vetri.
This commit is contained in:
SaraP
2025-07-30 11:21:57 +02:00
parent 7239313342
commit 157107f805
3 changed files with 106 additions and 23 deletions
+57 -1
View File
@@ -72,7 +72,8 @@ _G.WinCreate_ImportProfile = WinCreate_ImportProfile
----------------------------------------------------------------------------------
local function FindThresholds( nGrpId)
local tThresholds = {}
local tThresholds = {} -- array delle soglie
-- ogni soglia è una tabella con due chiavi : nType = intero che indica la tipologia ( cfr. WIN_THRESHOLD_TYPES), sName = nome della soglia nel file dei profili
local tHash = {}
-- scorro tutti i profili del telaio
local nCurrId = EgtGetFirstInGroup( nGrpId)
@@ -265,3 +266,58 @@ local function WinSetAuxGrpStatus()
EgtSetStatus( nAuxGrp, EgtIf( WDG.AUXSTATUS, GDB_ST.ON, GDB_ST.OFF))
end
_G.WinSetAuxGrpStatus = WinSetAuxGrpStatus
----------------------------------------------------------------------------------
local function WinGetSectionsTotalLenghts()
WDG.SECTIONS_LENGTHS = {} -- array con le sezioni
-- ogni sezione è una tabella con le seguenti chiavi : w = spessore, h = altezza, l = lunghezza totale dei tronchetti con quella sezione
-- scorro tutti i pezzi
local nPartId = EgtGetFirstPart()
while nPartId do
local nPartType = EgtGetInfo( nPartId, WIN_PART_TYPE, 'i') or WIN_PART_TYPES.NULL
if nPartType ~= WIN_PART_TYPES.FILL then
-- recupero il gruppo logs ( per archi) o geo dove sono salvate le dimensioni del pezzo
local nLayerId = EgtGetFirstNameInGroup( nPartId, WIN_LOGS) or EgtGetFirstNameInGroup( nPartId, WIN_GEO) or GDB_ID.NULL
if nLayerId ~= GDB_ID.NULL then
local dWidth = EgtGetInfo( nLayerId, WIN_GEOWIDTH, 'd')
local dHeight = EgtGetInfo( nLayerId, WIN_GEOHEIGHT, 'd')
local dLen = EgtGetInfo( nLayerId, WIN_GEOLEN, 'd')
if dLen then
-- verfico se devo aggiornare sezione già presente o se devo aggiungerla
local bFound = false
for i = 1, #WDG.SECTIONS_LENGTHS do
if ( abs( WDG.SECTIONS_LENGTHS[i].w - dWidth) < GEO.EPS_SMALL and abs( WDG.SECTIONS_LENGTHS[i].h - dHeight) < GEO.EPS_SMALL) then
bFound = true
WDG.SECTIONS_LENGTHS[i].l = WDG.SECTIONS_LENGTHS[i].l + dLen
end
end
if not bFound then
table.insert( WDG.SECTIONS_LENGTHS, { w = dWidth, h = dHeight, l = dLen})
end
end
end
end
nPartId = EgtGetNextPart( nPartId)
end
end
_G.WinGetSectionsTotalLenghts = WinGetSectionsTotalLenghts
----------------------------------------------------------------------------------
local function WinGetGlassesList()
WDG.GLASSES_LIST = {} -- array dei vetri
-- ogni vetro è una tabella con le seguenti chiavi : bRect = true se rettangolo/false altrimenti, w/l/t sono le tre dimensioni
local nPartId = EgtGetFirstPart()
while nPartId do
local nFillType = EgtGetInfo( nPartId, WIN_FILLTYPE)
if nFillType == WIN_GLASS then
local nLayerId = EgtGetFirstNameInGroup( nPartId, WIN_GEO)
local bShapeRect = EgtGetInfo( nLayerId, WIN_GLASS_RECT, 'b') or false
local dW = EgtGetInfo( nLayerId, WIN_GEOWIDTH, 'd') or 0
local dL = EgtGetInfo( nLayerId, WIN_GEOHEIGHT, 'd') or 0
local dT = EgtGetInfo( nLayerId, WIN_GLASSTHICKNESS, 'd') or 0
table.insert( WDG.GLASSES_LIST, { bRect = bShapeRect, w = dW, l = dL, t = dT})
end
nPartId = EgtGetNextPart( nPartId)
end
end
_G.WinGetGlassesList = WinGetGlassesList