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
+2
View File
@@ -346,7 +346,9 @@ WIN_GEO_RIGHT = 'Right'
WIN_PRC_FRAME = 'AuxFrame'
WIN_GEOWIDTH = 'GeoWidth'
WIN_GEOHEIGHT = 'GeoHeight'
WIN_GEOLEN = 'GeoLen'
WIN_SEMI_PROFILE = 'SemiProfileId'
WIN_GLASS_RECT = 'GlassRectangle'
-- CAMBIO PROFILO
+47 -22
View File
@@ -1406,19 +1406,19 @@ local function CreateFrameGeo( nOutlineId, vPrevOutlineId, vNextOutlineId, nStar
-- creo copie degli outline e le offsetto opportunamente
-- curva out
local nCurrCurveId = EgtCopy( nOutlineId, nGeoLayerId)
EgtOffsetCurve( nCurrCurveId, dCurrOffset)
EgtSetName( nCurrCurveId, WIN_GEO_OUT)
local nOutId = EgtCopy( nOutlineId, nGeoLayerId)
EgtOffsetCurve( nOutId, dCurrOffset)
EgtSetName( nOutId, WIN_GEO_OUT)
local nSemiProfileOut = EgtGetFirstNameInGroup( nCurrProfileId, WIN_OUT) or EgtGetFirstNameInGroup( nCurrProfileId, WIN_IN .. '1')
EgtSetInfo( nCurrCurveId, WIN_SEMI_PROFILE, nSemiProfileOut)
EgtSetInfo( nOutId, WIN_SEMI_PROFILE, nSemiProfileOut)
-- cruva in
local nCurrOffsetId = EgtCopy( nOutlineId, nGeoLayerId)
EgtOffsetCurve( nCurrOffsetId, dCurrOffset - b3CurrProfileFrame:getDimX())
EgtInvertCurve( nCurrOffsetId)
EgtSetName( nCurrOffsetId, WIN_GEO_IN)
local nInId = EgtCopy( nOutlineId, nGeoLayerId)
EgtOffsetCurve( nInId, dCurrOffset - b3CurrProfileFrame:getDimX())
EgtInvertCurve( nInId)
EgtSetName( nInId, WIN_GEO_IN)
local nSemiProfileIn = EgtGetFirstNameInGroup( nCurrProfileId, WIN_IN) or EgtGetFirstNameInGroup( nCurrProfileId, WIN_IN .. '2') or EgtGetFirstNameInGroup( nCurrProfileId, WIN_MIXED_COMMON .. WIN_IN)
EgtSetInfo( nCurrOffsetId, WIN_SEMI_PROFILE, nSemiProfileIn)
EgtSetInfo( nInId, WIN_SEMI_PROFILE, nSemiProfileIn)
-- curve left
local vPrevProfileId = EgtGetNameInGroup( nProfileLayerId, WIN_PRF_START)
@@ -1480,7 +1480,7 @@ local function CreateFrameGeo( nOutlineId, vPrevOutlineId, vNextOutlineId, nStar
EgtSetName( nNextCurveId, WIN_GEO_RIGHT)
EgtSetInfo( nNextCurveId, WIN_SEMI_PROFILE, nNextSemiProfile)
EgtSetInfo( nNextCurveId, WIN_REF_OUTLINE, vNextOutlineId[i])
EgtRelocateGlob( nNextCurveId, nCurrOffsetId, GDB_IN.BEFORE)
EgtRelocateGlob( nNextCurveId, nInId, GDB_IN.BEFORE)
end
local vIds = EgtGetAllInGroup( nGeoLayerId)
@@ -1496,6 +1496,14 @@ local function CreateFrameGeo( nOutlineId, vPrevOutlineId, vNextOutlineId, nStar
local dGeoWidth = b3CurrProfileFrame:getDimX()
EgtSetInfo( nGeoLayerId, WIN_GEOWIDTH, dGeoWidth)
EgtSetInfo( nGeoLayerId, WIN_GEOHEIGHT, dGeoH)
-- calcolo lunghezza se pezzo lineare ( se arco verrà gestito nel calcolo dei tronchetti)
if EgtGetType( nOutlineId) == GDB_TY.CRV_LINE then
local vtS = EgtSV( nOutlineId)
local frRef = Frame3d( ORIG(), vtS, Z_AX() ^ vtS, Z_AX())
local b3Ref = EgtGetBBoxRef( nGeoLayerId, GDB_BB.STANDARD, frRef)
EgtSetInfo( nGeoLayerId, WIN_GEOLEN, b3Ref:getDimX())
end
end
---------------------------------------------------------------------
@@ -1586,7 +1594,18 @@ local function CalcFillGeo( nPartId, nOutlineLayerId)
local nProfileLayerId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE)
local nSashProfileId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_SASH)
local dGlassThickness = EgtGetInfo( nSashProfileId, WIN_GLASSTHICKNESS, 'd')
EgtSetInfo( nGeoLayerId, WIN_GEOWIDTH, dGlassThickness)
EgtSetInfo( nGeoLayerId, WIN_GLASSTHICKNESS, dGlassThickness)
-- verifico forma e salvataggio info associate
local nCompo = EgtCurveCompo( nGeoLayerId, EgtGetAllInGroup( nGeoLayerId), false)
local bRect, ptTest, vtEdge1, vtEdge2 = EgtCurveIsARectangle( nCompo)
EgtSetInfo( nGeoLayerId, WIN_GLASS_RECT, bRect)
if bRect then
EgtSetInfo( nGeoLayerId, WIN_GEOWIDTH, vtEdge1:len())
EgtSetInfo( nGeoLayerId, WIN_GEOHEIGHT, vtEdge2:len())
end
EgtErase( nCompo)
return nGeoLayerId
end
@@ -2514,7 +2533,7 @@ local function CalcFillSolid( nPartId, nOutlineLayerId, nGeoLayerId)
local vOutlineList = EgtGetAllInGroup( nOutlineLayerId)
local nCompoOutlineId = EgtCurveCompoByChain( nSolidLayerId, vOutlineList, EgtSP( vOutlineList[1]), false)
-- recupero spessore vetro
local dGlassThickness = EgtGetInfo( nGeoLayerId, WIN_GEOWIDTH, 'd')
local dGlassThickness = EgtGetInfo( nGeoLayerId, WIN_GLASSTHICKNESS, 'd')
local nSurfId = EgtSurfTmByRegionExtrusion( nSolidLayerId, nCompoOutlineId, Z_AX() * dGlassThickness)
EgtErase( nCompoOutlineId)
end
@@ -3983,6 +4002,7 @@ local function CalcLogs( nGrp, nGeoOut, dOverMatIn, dOverMatOut, dOverMatExt, dO
local ptC = EgtCP( vCrvsIn[1])
-- calcolo i tronchetti
local dLenTot = 0
for i = 1, #vCrvsIn do
local ptSIn = EgtSP( vCrvsIn[i])
@@ -4020,8 +4040,9 @@ local function CalcLogs( nGrp, nGeoOut, dOverMatIn, dOverMatOut, dOverMatExt, dO
-- calcolo il box locale al frame
local b3Ref = EgtGetBBoxRef( nCompo, GDB_BB.STANDARD, frRef)
local ptMin = b3Ref:getMin()
local ptMax = b3Ref:getMax()
local ptMin = b3Ref:getMin()
ptMin:setZ( ptMax:getZ()) -- per avere curve sullo stesso piano ( e gestire correttamente le intersezioni)
-- verifico se necessario sovramateriale extra per raggiungere la sezione desiderata
local dExtraSection = max( 0, dRefSection - b3Ref:getDimY() - dOverMatIn - dOverMatOut)
@@ -4066,6 +4087,8 @@ local function CalcLogs( nGrp, nGeoOut, dOverMatIn, dOverMatOut, dOverMatExt, dO
-- TO DO : controllo lunghezza minima
-- local dLenTop = EgtCurveLength( nLineTop)
dLenTot = dLenTot + EgtCurveLength( nLineTop)
-- creo il tronchetto
local nLogCrv = EgtCurveCompo( nGrp, vCrvs)
@@ -4082,6 +4105,11 @@ local function CalcLogs( nGrp, nGeoOut, dOverMatIn, dOverMatOut, dOverMatExt, dO
EgtSetStatus( nOut, GDB_ST.OFF)
EgtErase( nCompo)
end
-- salvo i dati della sezione ( analogamente a quanto fatto nel geo per pezzi lineari)
EgtSetInfo( nGrp, WIN_GEOWIDTH, dRefSection)
CopyInfo( nGrp, EgtGetParent( nGeoOut), WIN_GEOHEIGHT)
EgtSetInfo( nGrp, WIN_GEOLEN, dLenTot)
end
---------------------------------------------------------------------
@@ -5408,8 +5436,7 @@ local function CalcThreshold( nOutlineId, nAreaId)
end
-- salvo info lunghezza
local nAreaGrp = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_AREA .. '*')
EgtSetInfo( nAreaGrp, WIN_THRESHOLD_LEN, dLenTot)
EgtSetInfo( nAreaId, WIN_THRESHOLD_LEN, dLenTot)
end
---------------------------------------------------------------------
@@ -5503,8 +5530,7 @@ local function CalcWaterdrip( nPartId, nOutlineId, nAreaId, bDraw)
end
-- salvo la lunghezza del gocciolatoio
local nAreaGrp = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_AREA .. '*')
EgtSetInfo( nAreaGrp, WIN_WATERDRIP_LEN, dLenTot)
EgtSetInfo( nAreaId, WIN_WATERDRIP_LEN, dLenTot)
EgtErase( nGrp)
@@ -5657,16 +5683,14 @@ local function CalcGaskets( nAreaId, bDraw)
end
-- aggiorno valore lunghezza
local nAreaGrp = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_AREA .. '*')
local dLenOld = EgtGetInfo( nAreaGrp, WIN_GASKET_LEN, 'd') or 0
EgtSetInfo( nAreaGrp, WIN_GASKET_LEN, dLenOld + dLenTot)
EgtSetInfo( nAreaId, WIN_GASKET_LEN, dLenTot)
EgtErase( nGrp)
end
---------------------------------------------------------------------
function WinCalculate.AddAccessories( nAreaId, bDraw)
local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i')
if nAreaType == WIN_AREATYPES.FRAME then
local nOutlineLayId = EgtGetFirstNameInGroup( nAreaId, WIN_OUTLINE)
@@ -5768,7 +5792,8 @@ function WinCalculate.RecalcSolids( nFrameId)
-- ricalcolo dei solidi
else
-- se fill, lo uso per ricalcolare strip
if EgtExistsInfo( nPartId, WIN_FILLTYPE) then
local nPartType = EgtGetInfo( nPartId, WIN_PART_TYPE, 'i')
if nPartType == WIN_PART_TYPES.FILL then
local nAreaId = EgtGetInfo( nPartId, WIN_AREA, 'i')
local nParentAreaId = EgtGetParent( nAreaId)
local nParentOutlineLayId = EgtGetFirstNameInGroup( nParentAreaId, WIN_OUTLINE)
+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