DataWindow

- inglesine.
This commit is contained in:
SaraP
2026-04-07 09:53:11 +02:00
parent f8eab3581c
commit 52853e953c
7 changed files with 440 additions and 236 deletions
+292 -200
View File
@@ -607,30 +607,36 @@ end
-- funzione che restituisce il tipo di controprofilo dell'outline adiacente
local function GetProfileCtrIn( nPrevOutlineId, nOutlineId, nPrevProfileId)
local sPrevCtrIn = WIN_CTRIN
-- gestione particolare del caso di split o cambio profilo
if not EgtGetFirstNameInGroup( nPrevProfileId, sPrevCtrIn) then
-- 1) split
if EgtGetName( nPrevOutlineId) == WIN_SPLIT then
-- verifico da quale lato dello split originale si trova l'outline per decidere quale controprofilo considerare
-- TODO si potrebbe considerare il segno di nPrevOutlineId ?
local _, _, nSide = EgtPointCurveDistSide( EgtMP( nOutlineId), nPrevOutlineId, Z_AX())
if nSide == 1 then
sPrevCtrIn = WIN_CTRIN .. '1' -- dx
else
sPrevCtrIn = WIN_CTRIN .. '2' -- sx
-- 1) se è inglesina interna deve finire contro il fermavetro ( dal lato corretto nel caso di split) oppure contro il bordo interno se finisce contro altra inglesina
if EgtGetName( nOutlineId) == WIN_SPLIT and EgtGetInfo( nOutlineId, WIN_MUNTINFILL_SIDE, 'i') == WIN_MUNTINFILL_SIDES.IN then
if EgtGetName( abs( nPrevOutlineId)) == WIN_SPLIT then
if EgtGetInfo( abs( nPrevOutlineId), WIN_SPLITTYPE, 'i') ~= WIN_SPLITTYPES.MUNTIN_FILL then
sPrevCtrIn = WIN_CTRIN .. WIN_STRIP
end
-- 2) pezzo del telaio con cambio profilo
-- recupero il lato da cui si trova
sPrevCtrIn = sPrevCtrIn .. EgtIf( nPrevOutlineId < 0, '1', '2')
else
-- il profilo da usare dipende dal pezzo corrente: se ha figli di tipo fill allora è legato alla parte fill del cambio profilo, se ha figli di tipo sash è legato alla parte sash,
-- se ha entrambe le tipologie di figli allora è mixed split e va considerata la parte sash ( perchè è quella utilizzata per tagliare il pezzo)
local vSashChildren = EgtGetInfo( nOutlineId, WIN_SASH_CHILDREN, 'vi')
if vSashChildren then
sPrevCtrIn = WIN_SASH .. WIN_CTRIN
else
sPrevCtrIn = WIN_FILL .. WIN_CTRIN
end
sPrevCtrIn = WIN_CTRIN .. WIN_STRIP
end
-- 2) se finisce contro split devo individuare da quale lato dello split originale si trova l'outline per decidere quale controprofilo considerare
elseif EgtGetName( abs( nPrevOutlineId)) == WIN_SPLIT then
if nPrevOutlineId < 0 then
sPrevCtrIn = sPrevCtrIn .. '1' -- dx
else
sPrevCtrIn = sPrevCtrIn .. '2' -- sx
end
-- 3) se finisce contro pezzo con cambio profilo
elseif not EgtGetFirstNameInGroup( nPrevProfileId, sPrevCtrIn) then
-- il profilo da usare dipende dal pezzo corrente: se ha figli di tipo fill allora è legato alla parte fill del cambio profilo, se ha figli di tipo sash è legato alla parte sash,
-- se ha entrambe le tipologie di figli allora è mixed split e va considerata la parte sash ( perchè è quella utilizzata per tagliare il pezzo)
local vSashChildren = EgtGetInfo( nOutlineId, WIN_SASH_CHILDREN, 'vi')
if vSashChildren then
sPrevCtrIn = WIN_SASH .. WIN_CTRIN
else
sPrevCtrIn = WIN_FILL .. WIN_CTRIN
end
end
@@ -789,24 +795,27 @@ local function GetSplitType( nSplitId, nAreaId)
local nSplitType = EgtGetInfo( nAreaId, WIN_SPLITTYPE, 'i')
-- la tipologia è salvata nell'area solo se si tratta di un french split, negli altri casi va calcolata
if not nSplitType then
-- controllo se è dentro anta o telaio
-- controllo se è dentro telaio, anta o vetro
local nParentAreaId = nAreaId
local nParentAreaType = EgtGetInfo( nParentAreaId, WIN_AREATYPE, 'i') or WIN_AREATYPES.NULL
while nParentAreaId and nParentAreaType ~= WIN_AREATYPES.SASH and nParentAreaType ~= WIN_AREATYPES.FRAME do
while nParentAreaId and ( nParentAreaType == WIN_AREATYPES.NULL or nParentAreaType == WIN_AREATYPES.SPLIT) do
nParentAreaId = EgtGetParent( nParentAreaId)
nParentAreaType = EgtGetInfo( nParentAreaId or GDB_ID.NULL, WIN_AREATYPE, 'i') or WIN_AREATYPES.NULL
end
-- se dentro anta
if nParentAreaType == WIN_AREATYPES.SASH then
-- se dentro anta
nSplitType = WIN_SPLITTYPES.INSASH
else
-- se dentro telaio verifico la tipologia dei figli
nSplitType = WIN_SPLITTYPES.MUNTIN_SASH
-- se dentro vetro è inglesina incollata
elseif nParentAreaType == WIN_AREATYPES.FILL then
nSplitType = WIN_SPLITTYPES.MUNTIN_FILL
-- se dentro telaio verifico la tipologia dei figli
elseif nParentAreaType == WIN_AREATYPES.FRAME then
local nChildrenType = GetChildrenType( nSplitId)
if nChildrenType == WIN_CHILDREN_TYPES.MIXED then
nSplitType = WIN_SPLITTYPES.MIXED
elseif nChildrenType == WIN_CHILDREN_TYPES.FILL then
nSplitType = WIN_SPLITTYPES.INFRAME
nSplitType = WIN_SPLITTYPES.MUNTIN_FRAME
else -- sash o non definiti
nSplitType = WIN_SPLITTYPES.MULLION
end
@@ -1087,11 +1096,25 @@ local function CalcProfileType( nAreaId)
EgtSetInfo( vSplitIds[i], WIN_PROFILETYPE, WIN_SASH_VERTICAL)
end
elseif nSplitType == WIN_SPLITTYPES.INSASH then
elseif nSplitType == WIN_SPLITTYPES.MUNTIN_SASH then
EgtSetInfo( vSplitIds[i], WIN_PROFILETYPE, WIN_SASH_SPLIT)
elseif nSplitType == WIN_SPLITTYPES.INFRAME then
elseif nSplitType == WIN_SPLITTYPES.MUNTIN_FRAME then
EgtSetInfo( vSplitIds[i], WIN_PROFILETYPE, WIN_FRAME_SPLIT)
elseif nSplitType == WIN_SPLITTYPES.MUNTIN_FILL then
-- se solo interne o entrambe assegno il profilo in ( l'out verrà aggiunto successivamente durante il calcolo del suo outline), se solo out assegno direttamente
-- il profilo corretto
local sProfile = WIN_FILL_SPLIT_IN
local nType = EgtGetInfo( nAreaId, WIN_MUNTINFILL_SIDE, 'i')
if nType == WIN_MUNTINFILL_SIDES.OUT then
sProfile = WIN_FILL_SPLIT_OUT
end
local bSlide = EgtGetInfo( EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_AREA .. '*'), WIN_SLIDE_WINDOW, 'b') or false
if bSlide then
sProfile = WIN_SLIDE .. '_' .. sProfile
end
EgtSetInfo( vSplitIds[i], WIN_PROFILETYPE, sProfile)
elseif nSplitType == WIN_SPLITTYPES.MIXED then
EgtSetInfo( vSplitIds[i], WIN_PROFILETYPE, WIN_MIXED_SPLIT)
@@ -1179,19 +1202,21 @@ local function AdjustProfileDimension( nOutlineId, nProfileId, dDimOld, dDim)
local vtMove = - frSection:getVersX()
-- traslo le curve "interne"
local vCurves = { WIN_IN, WIN_CTRIN, WIN_OFST .. WIN_CTRIN, WIN_STRIP, WIN_SIMPLIFIED .. WIN_IN, WIN_SIMPLIFIED .. WIN_OFST .. WIN_CTRIN, WIN_SIMPLIFIED .. WIN_STRIP}
local vCurves = { WIN_IN, WIN_CTRIN, WIN_OFST .. WIN_CTRIN, WIN_STRIP, WIN_CTRIN .. WIN_STRIP, WIN_OFST .. WIN_CTRIN .. WIN_STRIP}
if bSplit then
vCurves = { WIN_IN .. '2', WIN_CTRIN .. '2', WIN_OFST .. WIN_CTRIN .. '2', WIN_STRIP .. '2',
WIN_SIMPLIFIED .. WIN_IN .. '2', WIN_SIMPLIFIED .. WIN_OFST .. WIN_CTRIN .. '2', WIN_SIMPLIFIED .. WIN_STRIP .. '2'}
for i = 1, #vCurves do
vCurves[i] = vCurves[i] .. '2'
end
elseif bMixed then
vCurves = { WIN_SASH .. WIN_IN, WIN_FILL .. WIN_IN, WIN_SASH .. WIN_CTRIN, WIN_FILL .. WIN_CTRIN, WIN_OFST .. WIN_SASH .. WIN_CTRIN, WIN_OFST .. WIN_FILL .. WIN_CTRIN, WIN_STRIP,
WIN_SIMPLIFIED .. WIN_SASH .. WIN_IN, WIN_SIMPLIFIED .. WIN_FILL .. WIN_IN, WIN_SIMPLIFIED .. WIN_OFST .. WIN_SASH .. WIN_CTRIN,
WIN_SIMPLIFIED .. WIN_OFST .. WIN_FILL .. WIN_CTRIN, WIN_SIMPLIFIED .. WIN_STRIP, WIN_MIXED_COMMON .. WIN_IN}
vCurves = { WIN_SASH .. WIN_IN, WIN_FILL .. WIN_IN, WIN_SASH .. WIN_CTRIN, WIN_FILL .. WIN_CTRIN, WIN_OFST .. WIN_SASH .. WIN_CTRIN, WIN_OFST .. WIN_FILL .. WIN_CTRIN,
WIN_MIXED_COMMON .. WIN_IN, WIN_STRIP, WIN_CTRIN .. WIN_STRIP, WIN_OFST .. WIN_CTRIN .. WIN_STRIP}
end
for i = 1, #vCurves do
local nCrvId = EgtGetFirstNameInGroup( nProfileId, vCurves[i]) or GDB_ID.NULL
EgtMove( nCrvId, dDeltaDim * vtMove, GDB_RT.GLOB)
local nSimplifiedCrvId = EgtGetFirstNameInGroup( nProfileId, WIN_SIMPLIFIED .. vCurves[i]) or GDB_ID.NULL
EgtMove( nSimplifiedCrvId, dDeltaDim * vtMove, GDB_RT.GLOB)
end
-- traslo i dowels
@@ -1264,6 +1289,8 @@ local function CreatePartProfile( nPartId, nOutlineId, dDim, nBottomRail)
nLayerId = EgtGetFirstNameInGroup( nProfilesGrpId, WIN_FRAME)
elseif nAreaType == WIN_AREATYPES.SASH then
nLayerId = EgtGetFirstNameInGroup( nProfilesGrpId, WIN_SASH)
elseif nAreaType == WIN_AREATYPES.FILL then
nLayerId = EgtGetFirstNameInGroup( nProfilesGrpId, WIN_FILL)
end
-- recupero il nome del profilo
@@ -1465,11 +1492,16 @@ local function CalcPartName( nAreaId, nAreaType)
-- per split o riempimento devo ricavare il nome del parent che lo contiene
local nParentId = EgtGetParent( nAreaId)
local nParentType = EgtGetInfo( nParentId, WIN_AREATYPE, 'i')
while nParentType ~= WIN_AREATYPES.FRAME and nParentType ~= WIN_AREATYPES.SASH do
while nParentType == WIN_AREATYPES.SPLIT or nParentType == WIN_AREATYPES.NULL do
nParentId = EgtGetParent( nParentId)
nParentType = EgtGetInfo( nParentId, WIN_AREATYPE, 'i')
end
sName = EgtGetInfo( nParentId, WIN_AREA_NAME, sName)
sName = EgtGetInfo( nParentId, WIN_AREA_NAME)
if nAreaType == WIN_AREATYPES.FILL then
sName = sName .. '_' .. WIN_FILL
EgtSetInfo( nAreaId, WIN_AREA_NAME, sName)
end
end
return sName
@@ -1556,7 +1588,7 @@ local function CreateFillPartFromArea( nAreaId, sName)
EgtSetInfo( nPartId, WIN_AREA, nAreaId)
-- imposto nome del pezzo
EgtSetName( nPartId, sName .. '_' .. WIN_FILL)
EgtSetName( nPartId, sName)
EgtSetInfo( nPartId, WIN_PART_TYPE, WIN_PART_TYPES.FILL)
-- imposto colore e tipologia
@@ -1816,7 +1848,7 @@ local function TestSplitTrimOutlines( nOutlineId, nTrimOutline, tabOutlines, nMa
local vsCtrIn = {}
for i = 1, #vTestOutlines do
vProfiles[i] = GetOutlineProfileId( abs( vTestOutlines[i]), true)
vsCtrIn[i] = GetProfileCtrIn( abs( vTestOutlines[i]), nOutlineId, vProfiles[i])
vsCtrIn[i] = GetProfileCtrIn( vTestOutlines[i], nOutlineId, vProfiles[i])
end
-- testo le curve
@@ -3033,10 +3065,9 @@ local function CalculateFillOutline( nAreaId, nOutlineLayerId)
local nParentProfileId = GetOutlineProfileId( abs( vSplitIds[i]), true)
local b3FrameProfile = GetProfileLocalBox( nParentProfileId)
local dOverlap = EgtGetInfo( nParentProfileId, WIN_FILLOVERLAP, 'd')
local bMixedSplit = EgtGetInfo( abs( vSplitIds[i]), WIN_PRF_CHANGE, 'b') or false
local dDimRef = EgtIf( bMixedSplit, b3FrameProfile:getMax():getX(), b3FrameProfile:getMin():getX())
local dFillPerpOffset = abs( dDimRef) - dOverlap
EgtOffsetCurve( nOutlineId, - dFillPerpOffset)
local dDimRef = EgtIf( vSplitIds[i] < 0, b3FrameProfile:getMax():getX(), b3FrameProfile:getMin():getX())
local dOffs = abs( dDimRef) - dOverlap
EgtOffsetCurve( nOutlineId, - dOffs)
-- movimento in z
local dFillZOffset = EgtGetInfo( nParentProfileId, WIN_FILLDELTA, 'd')
EgtMove( nOutlineId, Z_AX() * dFillZOffset)
@@ -3080,7 +3111,7 @@ local function CalculateOutlineFromAreaOutline( nAreaId)
local nOutlineLayerId = EgtGroup( nAreaId)
EgtSetName( nOutlineLayerId, WIN_OUTLINE)
EgtSetStatus( nOutlineLayerId, GDB_ST.OFF)
-- FRAME
if nAreaType == WIN_AREATYPES.FRAME then
@@ -3102,6 +3133,10 @@ local function CalculateOutlineFromAreaOutline( nAreaId)
-- l'outline è copia del parent outline
local nParentId = EgtGetParent( nAreaId)
if EgtGetInfo( nParentId, WIN_AREATYPE, 'i') == WIN_AREATYPES.FILL then
-- se inglesina il parent è un vetro. Il pezzo però non va tagliato con il vetro ma con l'elemento che contiene il vetro, quindi considero come outline quello del parent del vetro
nParentId = EgtGetParent( nParentId)
end
local nParentOutlineId = EgtGetFirstNameInGroup( nParentId, WIN_OUTLINE)
local vParentOutlines = EgtGetAllInGroup( nParentOutlineId)
for i = 1, #vParentOutlines do
@@ -3122,24 +3157,9 @@ local function CalculateOutlineFromAreaOutline( nAreaId)
EgtSetInfo( vBaseSplitIds[i], WIN_COPY, vSplitIds[i])
end
-- se split interni ad anta ricavo quota in z dal suo profilo
local nSplitType = EgtGetInfo( vSplitIds[1], WIN_SPLITTYPE, 'i')
if nSplitType == WIN_SPLITTYPES.INSASH then
-- recupero area sash che lo contiene
local nSashAreaId = nAreaId
local nAreaType = EgtGetInfo( nSashAreaId, WIN_AREATYPE, 'i')
while nAreaType ~= WIN_AREATYPES.SASH do
nSashAreaId = EgtGetParent( nSashAreaId)
nAreaType = EgtGetInfo( nSashAreaId, WIN_AREATYPE, 'i')
end
-- recupero il profilo dell'anta da una curva dell'outline
local nSashOutlineLayerId = EgtGetFirstNameInGroup( nSashAreaId, WIN_OUTLINE)
local nSashOutlineId = EgtGetFirstInGroup( nSashOutlineLayerId)
local nSashProfileId = GetOutlineProfileId( nSashOutlineId)
-- calcolo movimento in z
local dZMove = EgtGetInfo( nSashProfileId, WIN_DELTA, 'd')
EgtMove( vSplitIds, dZMove * Z_AX())
end
-- aggiusto la quota degli split per allinearli all'outline
local dZMove = ( EgtSP( vParentOutlines[1]) - EgtSP( vSplitIds[1])) * Z_AX()
EgtMove( vSplitIds, dZMove * Z_AX())
-- aggiusto gli outlines e calcolo l'outline delle sottoaree null generate
local bGrid = EgtGetInfo( nAreaId, WIN_GRID_SPLIT, 'b') or false
@@ -3149,10 +3169,52 @@ local function CalculateOutlineFromAreaOutline( nAreaId)
CalculateSplitOutline( nAreaId, vSplitIds, sName)
end
local nSplitType = EgtGetInfo( vSplitIds[1], WIN_SPLITTYPE, 'i')
if nSplitType == WIN_SPLITTYPES.FRENCH then
IdentifySashShape( nAreaId, nOutlineLayerId)
end
-- se inglesina su entrambi i lati creo copia degli outline per le inglesine esterne
if nSplitType == WIN_SPLITTYPES.MUNTIN_FILL then
local nMuntinType = EgtGetInfo( nAreaId, WIN_MUNTINFILL_SIDE, 'i')
if nMuntinType == WIN_MUNTINFILL_SIDES.BOTH then
local bSlide = EgtGetInfo( EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_AREA .. '*'), WIN_SLIDE_WINDOW, 'b') or false
for i = 1, #vSplitIds do
local nId = EgtCopyGlob( vSplitIds[i], nSplitLayerId)
EgtSetInfo( vSplitIds[i], WIN_REF_MUNTIN, nId)
EgtSetInfo( nId, WIN_PROFILETYPE, EgtIf( bSlide, WIN_SLIDE .. '_', '') .. WIN_FILL_SPLIT_OUT)
local dDim = EgtGetInfo( nId, WIN_PART_DIM, 'd')
CreateOutlinePart( nId, sName, dDim)
EgtSetInfo( vSplitIds[i], WIN_MUNTINFILL_SIDE, WIN_MUNTINFILL_SIDES.IN)
EgtSetInfo( nId, WIN_MUNTINFILL_SIDE, WIN_MUNTINFILL_SIDES.OUT)
-- verifico se devo aggiornare i prev/next ( caso di inglesina contro inglesina)
local vPrevOutlines = EgtGetInfo( nId, WIN_PREV_OUTLINES, 'vi')
for j = 1, #vPrevOutlines do
local nRef = EgtGetInfo( abs( vPrevOutlines[j]), WIN_REF_MUNTIN, 'i')
if nRef then
vPrevOutlines[j] = EgtIf( vPrevOutlines[j] > 0, nRef, - nRef)
end
end
EgtSetInfo( nId, WIN_PREV_OUTLINES, vPrevOutlines)
local vNextOutlines = EgtGetInfo( nId, WIN_NEXT_OUTLINES, 'vi')
for j = 1, #vNextOutlines do
local nRef = EgtGetInfo( abs( vNextOutlines[j]), WIN_REF_MUNTIN, 'i')
if nRef then
vNextOutlines[j] = EgtIf( vNextOutlines[j] > 0, nRef, - nRef)
end
end
EgtSetInfo( nId, WIN_NEXT_OUTLINES, vNextOutlines)
end
else
for i = 1, #vSplitIds do
EgtSetInfo( vSplitIds[i], WIN_MUNTINFILL_SIDE, nMuntinType)
end
end
end
-- SASH
elseif nAreaType == WIN_AREATYPES.SASH then
@@ -3210,14 +3272,21 @@ local function SetAreaProfiles( nAreaId)
elseif nAreaType == WIN_AREATYPES.SPLIT then
local nSplitType = EgtGetInfo( nAreaId, WIN_SPLITTYPE, 'i')
if nSplitType ~= WIN_SPLITTYPES.FRENCH then
-- recupero area parent per capire se dentro telaio o anta
-- recupero area parent per capire se dentro telaio, anta o vetro
local nParentAreaId = EgtGetParent( nAreaId)
local nParentAreaType = EgtGetInfo( nParentAreaId, WIN_AREATYPE, 'i')
while nParentAreaType ~= WIN_AREATYPES.FRAME and nParentAreaType ~= WIN_AREATYPES.SASH do
while nParentAreaType == WIN_AREATYPES.SPLIT or nParentAreaType == WIN_AREATYPES.NULL do
nParentAreaId = EgtGetParent( nParentAreaId)
nParentAreaType = EgtGetInfo( nParentAreaId, WIN_AREATYPE, 'i')
end
local sAreaName = EgtIf( nParentAreaType == WIN_AREATYPES.FRAME, WIN_FRAME, WIN_SASH)
local sAreaName
if nParentAreaType == WIN_AREATYPES.FRAME then
sAreaName = WIN_FRAME
elseif nParentAreaType == WIN_AREATYPES.SASH then
sAreaName = WIN_SASH
else
sAreaName = WIN_FILL
end
local nSplitLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_SPLIT)
local vSplitIds = EgtGetAllInGroup( nSplitLayerId)
@@ -3226,12 +3295,14 @@ local function SetAreaProfiles( nAreaId)
-- recupero i profili distinguendoli per ordine di split
local tabProfiles = {}
for i = 1, #vSplitIds do
local nOrder = EgtGetInfo( vSplitIds[i], WIN_GRIDSPLIT_ORDER, 'i')
local sProfile = sAreaName .. '_' .. EgtGetInfo( vSplitIds[i], WIN_PROFILETYPE)
if tabProfiles[nOrder+1] then
table.insert( tabProfiles[nOrder+1], sProfile)
else
tabProfiles[nOrder+1] = { sProfile}
if not EgtExistsInfo( vSplitIds[i], WIN_REF_MUNTIN) then
local nOrder = EgtGetInfo( vSplitIds[i], WIN_GRIDSPLIT_ORDER, 'i')
local sProfile = sAreaName .. '_' .. EgtGetInfo( vSplitIds[i], WIN_PROFILETYPE)
if tabProfiles[nOrder+1] then
table.insert( tabProfiles[nOrder+1], sProfile)
else
tabProfiles[nOrder+1] = { sProfile}
end
end
end
-- salvo in info separate
@@ -3240,9 +3311,13 @@ local function SetAreaProfiles( nAreaId)
end
else
-- recupero tutti i profili degli split
-- se ha info WIN_REF_MUNTIN significa che split è inglesina sia interna che esterna, non ha senso considerarla due volte anche se sono due outlines distinti perchè
-- lo split che la definisce è uno solo
local vProfiles = {}
for i = 1, #vSplitIds do
vProfiles[i] = sAreaName .. '_' .. EgtGetInfo( vSplitIds[i], WIN_PROFILETYPE)
if not EgtExistsInfo( vSplitIds[i], WIN_REF_MUNTIN) then
table.insert( vProfiles, sAreaName .. '_' .. EgtGetInfo( vSplitIds[i], WIN_PROFILETYPE))
end
end
EgtSetInfo( nAreaId, WIN_AREA_PROFILES, vProfiles)
end
@@ -3475,14 +3550,15 @@ local function CalcGeoRegion( vCrvs, nGrp)
end
---------------------------------------------------------------------
local function GetDeltaProfile( nProfileId, sCtrIn)
local function GetDeltaProfile( nProfileId, sCtrIn, nOutlineId)
local dCPDelta = 0
local nSectionFrId = EgtGetFirstNameInGroup( nProfileId, WIN_SECTIONFRAME)
local frSectionFrame = EgtFR( nSectionFrId, GDB_ID.ROOT)
local nCPId = EgtGetFirstNameInGroup( nProfileId, sCtrIn)
local b3CP = EgtGetBBoxRef( nCPId, GDB_BB.STANDARD, frSectionFrame)
if sCtrIn == WIN_CTRIN .. 1 then
if nOutlineId < 0 then
-- se a destra della curva sto considerando i semiprofili 1
dCPDelta = abs( b3CP:getMin():getX())
else
dCPDelta = abs( b3CP:getMax():getX())
@@ -3698,8 +3774,8 @@ local function CreateGeoCurves( nOutlineId, vPrevOutlineId, vNextOutlineId, vSta
local dOffs, nPrevSemiProfile
if vStartJoints[i] == WIN_PART_JNT.SHORT then
-- la curva del geo corrisponde al bordo del controprofilo in del pezzo vicino
local sCtrIn = GetProfileCtrIn( abs( vPrevOutlineId[i]), nOutlineId, vPrevProfileId[i])
local dCPDelta = GetDeltaProfile( vPrevProfileId[i], sCtrIn)
local sCtrIn = GetProfileCtrIn( vPrevOutlineId[i], nOutlineId, vPrevProfileId[i])
local dCPDelta = GetDeltaProfile( vPrevProfileId[i], sCtrIn, vPrevOutlineId[i])
dOffs = - dCPDelta
nPrevSemiProfile = EgtGetFirstNameInGroup( vPrevProfileId[i], sCtrIn)
else
@@ -3769,8 +3845,8 @@ local function CreateGeoCurves( nOutlineId, vPrevOutlineId, vNextOutlineId, vSta
end
local dOffs, nNextSemiProfile
if vEndJoints[i] == WIN_PART_JNT.SHORT then
local sCtrIn = GetProfileCtrIn( abs( vNextOutlineId[i]), nOutlineId, vNextProfileId[i])
local dCPDelta = GetDeltaProfile( vNextProfileId[i], sCtrIn)
local sCtrIn = GetProfileCtrIn( vNextOutlineId[i], nOutlineId, vNextProfileId[i])
local dCPDelta = GetDeltaProfile( vNextProfileId[i], sCtrIn, vNextOutlineId[i])
dOffs = - dCPDelta
nNextSemiProfile = EgtGetFirstNameInGroup( vNextProfileId[i], sCtrIn)
else
@@ -5513,131 +5589,135 @@ local function CalcSplitDowels( nSplitId, bStartOrEnd)
for i = 1, #vGeoCrvs do
local nOrigOutline = abs( EgtGetInfo( vGeoCrvs[i], WIN_REF_OUTLINE, 'i'))
-- verifico se soglia ( in quel caso non ci sono dowels quindi va ignorato)
local bThreshold = EgtGetInfo( nOrigOutline, WIN_THRESHOLD, 'b') or false
-- se la curva non ha lavorazione associata allora il pezzo non influisce direttamente sullo split e può essere ignorato
local nPrcRef = EgtGetInfo( vGeoCrvs[i], WIN_REF_PRC, 'i')
if nPrcRef then
local nOrigOutline = abs( EgtGetInfo( vGeoCrvs[i], WIN_REF_OUTLINE, 'i'))
-- verifico se soglia ( in quel caso non ci sono dowels quindi va ignorato)
local bThreshold = EgtGetInfo( nOrigOutline, WIN_THRESHOLD, 'b') or false
if not bThreshold then
if not bThreshold then
-- recupero il pezzo associato e il suo outline di riferimento
local nPartId = FindAssociatedPart( nOrigOutline, true)
local nOutlineId = EgtGetInfo( nPartId, WIN_REF_OUTLINE, 'i')
local nGeoLayerId = EgtGetFirstNameInGroup( nPartId, WIN_GEO)
local nGeoCrvId = EgtGetFirstNameInGroup( nGeoLayerId, WIN_GEO_IN)
local sDowelSide = WIN_PRC_SIDETYPE.IN
-- se split verifico se interferisce con lato in o out del geo
if EgtGetName( nOutlineId) == WIN_SPLIT then
local _, _, nSide = EgtPointCurveDistSide( EgtMP( nSplitId), nOutlineId, Z_AX())
if nSide == 1 then
nGeoCrvId = EgtGetFirstNameInGroup( nGeoLayerId, WIN_GEO_OUT)
sDowelSide = WIN_PRC_SIDETYPE.OUT
end
end
-- calcolo il frame di destinazione
local ptOrig = EgtIf( bStartOrEnd, EgtSP( nSplitId), EgtEP( nSplitId))
local frDest = Frame3d( ptOrig, - EgtSV( nSplitId))
-- recupero il pezzo associato e il suo outline di riferimento
local nPartId = FindAssociatedPart( nOrigOutline, true)
local nOutlineId = EgtGetInfo( nPartId, WIN_REF_OUTLINE, 'i')
-- recupero il layer con le lavorazioni
local nLayerId = EgtGetFirstNameInGroup( nPartId, WIN_PRC)
-- nel layer dei profili del pezzo aggiungo il profilo dello split posizionato correttamente
local nProfileLayerId = EgtGetFirstNameInGroup( nPartId, WIN_PROFILE)
local nSplitProfileCopyId = EgtCopy( nSplitProfile, nProfileLayerId)
CopyInfo( nSplitProfileCopyId, nSplitProfile, WIN_PROFILETYPE)
EgtSetName( nSplitProfileCopyId, WIN_PRF_SPLIT)
-- posiziono il profilo sulla curva di split
EgtTransform( EgtGetAllInGroup( nSplitProfileCopyId), frOrig, GDB_RT.GLOB)
EgtChangeGroupFrame( nSplitProfileCopyId, frDest, GDB_RT.GLOB)
-- recupero eventuale solido
local nSolidId
if s_bCalcSolid then
local nSolidLayerId = EgtGetFirstNameInGroup( nPartId, WIN_SOLID)
nSolidId = EgtGetFirstNameInGroup( nSolidLayerId, WIN_SRF_MAIN)
end
-- recupero le chiavi delle lunghezze ( dipendono dal profilo del pezzo su cui poggia lo split)
local sSplitLenKey = WIN_DWL_TOP_PARA_LEN
local sLenKey = WIN_DWL_TOP_PERP_LEN
if EgtGetName( nOutlineId) == WIN_BOTTOM then
-- verifico se ha bottomrails
local nBottomRails = EgtGetInfo( nOutlineId, WIN_BOTTOMRAIL, 'i') or 0
if nBottomRails == 0 then
sSplitLenKey = WIN_DWL_BOTTOM_PARA_LEN
sLenKey = WIN_DWL_BOTTOM_PERP_LEN
else
sSplitLenKey = WIN_DWL_RAILBOTTOM_PARA_LEN
sLenKey = WIN_DWL_RAILBOTTOM_PERP_LEN
end
elseif EgtGetName( nOutlineId) == WIN_SPLIT then
sSplitLenKey = WIN_DWL_SPLIT_PARA_LEN
sLenKey = WIN_DWL_SPLIT_PERP_LEN
end
-- creo la superficie di test per il posizionamento dei dowels
local nProfileId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_PRF_MAIN)
local nTestSurf
if not s_bCalcSolid or s_bSimplSolid then
local bChangeProfile = EgtGetInfo( nSplitId, WIN_PRF_CHANGE, 'b') or false
if bChangeProfile then
local vOutlines
if bStartOrEnd then
vOutlines = EgtGetInfo( nSplitId, WIN_PREV_OUTLINES, 'vi')
else
vOutlines = EgtGetInfo( nSplitId, WIN_NEXT_OUTLINES, 'vi')
local nGeoLayerId = EgtGetFirstNameInGroup( nPartId, WIN_GEO)
local nGeoCrvId = EgtGetFirstNameInGroup( nGeoLayerId, WIN_GEO_IN)
local sDowelSide = WIN_PRC_SIDETYPE.IN
-- se split verifico se interferisce con lato in o out del geo
if EgtGetName( nOutlineId) == WIN_SPLIT then
local _, _, nSide = EgtPointCurveDistSide( EgtMP( nSplitId), nOutlineId, Z_AX())
if nSide == 1 then
nGeoCrvId = EgtGetFirstNameInGroup( nGeoLayerId, WIN_GEO_OUT)
sDowelSide = WIN_PRC_SIDETYPE.OUT
end
end
-- calcolo il frame di destinazione
local ptOrig = EgtIf( bStartOrEnd, EgtSP( nSplitId), EgtEP( nSplitId))
local frDest = Frame3d( ptOrig, - EgtSV( nSplitId))
-- recupero il layer con le lavorazioni
local nLayerId = EgtGetFirstNameInGroup( nPartId, WIN_PRC)
-- nel layer dei profili del pezzo aggiungo il profilo dello split posizionato correttamente
local nProfileLayerId = EgtGetFirstNameInGroup( nPartId, WIN_PROFILE)
local nSplitProfileCopyId = EgtCopy( nSplitProfile, nProfileLayerId)
CopyInfo( nSplitProfileCopyId, nSplitProfile, WIN_PROFILETYPE)
EgtSetName( nSplitProfileCopyId, WIN_PRF_SPLIT)
-- posiziono il profilo sulla curva di split
EgtTransform( EgtGetAllInGroup( nSplitProfileCopyId), frOrig, GDB_RT.GLOB)
EgtChangeGroupFrame( nSplitProfileCopyId, frDest, GDB_RT.GLOB)
-- recupero eventuale solido
local nSolidId
if s_bCalcSolid then
local nSolidLayerId = EgtGetFirstNameInGroup( nPartId, WIN_SOLID)
nSolidId = EgtGetFirstNameInGroup( nSolidLayerId, WIN_SRF_MAIN)
end
-- recupero le chiavi delle lunghezze ( dipendono dal profilo del pezzo su cui poggia lo split)
local sSplitLenKey = WIN_DWL_TOP_PARA_LEN
local sLenKey = WIN_DWL_TOP_PERP_LEN
if EgtGetName( nOutlineId) == WIN_BOTTOM then
-- verifico se ha bottomrails
local nBottomRails = EgtGetInfo( nOutlineId, WIN_BOTTOMRAIL, 'i') or 0
if nBottomRails == 0 then
sSplitLenKey = WIN_DWL_BOTTOM_PARA_LEN
sLenKey = WIN_DWL_BOTTOM_PERP_LEN
else
sSplitLenKey = WIN_DWL_RAILBOTTOM_PARA_LEN
sLenKey = WIN_DWL_RAILBOTTOM_PERP_LEN
end
elseif EgtGetName( nOutlineId) == WIN_SPLIT then
sSplitLenKey = WIN_DWL_SPLIT_PARA_LEN
sLenKey = WIN_DWL_SPLIT_PERP_LEN
end
-- creo la superficie di test per il posizionamento dei dowels
local nProfileId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_PRF_MAIN)
local nTestSurf
if not s_bCalcSolid or s_bSimplSolid then
local bChangeProfile = EgtGetInfo( nSplitId, WIN_PRF_CHANGE, 'b') or false
if bChangeProfile then
local vOutlines
if bStartOrEnd then
vOutlines = EgtGetInfo( nSplitId, WIN_PREV_OUTLINES, 'vi')
else
vOutlines = EgtGetInfo( nSplitId, WIN_NEXT_OUTLINES, 'vi')
end
nTestSurf = CreateMixedSplitTrimSurf( nSplitId, vOutlines, nProfileId, 100, bStartOrEnd, not bStartOrEnd, nLayerId)
else
local sCtr = WIN_OFST .. GetProfileCtrIn( nOutlineId, nSplitId, nProfileId)
nTestSurf = CreateProfileSurf( nOutlineId, nProfileId, sCtr, 100, nLayerId)
end
nTestSurf = CreateMixedSplitTrimSurf( nSplitId, vOutlines, nProfileId, 100, bStartOrEnd, not bStartOrEnd, nLayerId)
else
local sCtr = WIN_OFST .. GetProfileCtrIn( nOutlineId, nSplitId, nProfileId)
nTestSurf = CreateProfileSurf( nOutlineId, nProfileId, sCtr, 100, nLayerId)
-- è la stessa superficie utilizzata per il trim del solido
local nTrimSurf = EgtGetInfo( vGeoCrvs[i], WIN_REF_SURF, 'i')
nTestSurf = EgtCopyGlob( nTrimSurf, nSplitLayerId)
end
else
-- è la stessa superficie utilizzata per il trim del solido
local nTrimSurf = EgtGetInfo( vGeoCrvs[i], WIN_REF_SURF, 'i')
nTestSurf = EgtCopyGlob( nTrimSurf, nSplitLayerId)
end
local nTestSurfInverted = EgtCopyGlob( nTestSurf, nSplitLayerId)
EgtInvertSurf( nTestSurfInverted)
-- calcolo le direzioni entranti nei pezzi
local vtSplitDir = EgtIf( bStartOrEnd, - frDest:getVersZ(), frDest:getVersZ())
local vtDir = EgtIf( bStartOrEnd, - EgtSV( nSplitId), EgtSV( nSplitId))
-- recupero la superficie del pezzo per verificare se dowel interno
local nGeo = EgtGetFirstNameInGroup( nPartId, WIN_GEO)
local nSurf = EgtGetFirstNameInGroup( nGeo, WIN_GEO_SURF)
-- aggiungo i dowels
local vDowels = EgtGetNameInGroup( nSplitProfile, WIN_DOWEL .. '*') or {}
for i = 1, #vDowels do
-- split
local dLen1 = CalcDowelLen( vDowels[i], sSplitLenKey, false)
local nDowel1 = CreateDowel( vDowels[i], nSplitLayerId, frOrig, frDest, vtSplitDir, nTestSurf, dLen1, sSplitDowelSide, nSplitSolidId)
-- verifico se dowel è interno al pezzo ( TO DO : da migliorare!)
local ptTest = EgtCP( nDowel1) - vtSplitDir * EgtCurveThickness( nDowel1)
local nTestPoint = EgtPoint( nSplitLayerId, ptTest)
if EgtSurfFrTestExternal( nSplitSurf, nTestPoint) then
EgtErase( nDowel1)
end
EgtErase( nTestPoint)
local nTestSurfInverted = EgtCopyGlob( nTestSurf, nSplitLayerId)
EgtInvertSurf( nTestSurfInverted)
-- pezzo
local dLen2 = CalcDowelLen( vDowels[i], sLenKey, true)
local nDowel2 = CreateDowel( vDowels[i], nLayerId, frOrig, frDest, vtDir, nTestSurfInverted, dLen2, sDowelSide, nSolidId)
ptTest = EgtCP( nDowel2) - vtDir * EgtCurveThickness( nDowel2)
nTestPoint = EgtPoint( nLayerId, ptTest)
if EgtSurfFrTestExternal( nSurf, nTestPoint) then
EgtErase( nDowel2)
-- calcolo le direzioni entranti nei pezzi
local vtSplitDir = EgtIf( bStartOrEnd, - frDest:getVersZ(), frDest:getVersZ())
local vtDir = EgtIf( bStartOrEnd, - EgtSV( nSplitId), EgtSV( nSplitId))
-- recupero la superficie del pezzo per verificare se dowel interno
local nGeo = EgtGetFirstNameInGroup( nPartId, WIN_GEO)
local nSurf = EgtGetFirstNameInGroup( nGeo, WIN_GEO_SURF)
-- aggiungo i dowels
local vDowels = EgtGetNameInGroup( nSplitProfile, WIN_DOWEL .. '*') or {}
for i = 1, #vDowels do
-- split
local dLen1 = CalcDowelLen( vDowels[i], sSplitLenKey, false)
local nDowel1 = CreateDowel( vDowels[i], nSplitLayerId, frOrig, frDest, vtSplitDir, nTestSurf, dLen1, sSplitDowelSide, nSplitSolidId)
-- verifico se dowel è interno al pezzo ( TO DO : da migliorare!)
local ptTest = EgtCP( nDowel1) - vtSplitDir * EgtCurveThickness( nDowel1)
local nTestPoint = EgtPoint( nSplitLayerId, ptTest)
if EgtSurfFrTestExternal( nSplitSurf, nTestPoint) then
EgtErase( nDowel1)
end
EgtErase( nTestPoint)
-- pezzo
local dLen2 = CalcDowelLen( vDowels[i], sLenKey, true)
local nDowel2 = CreateDowel( vDowels[i], nLayerId, frOrig, frDest, vtDir, nTestSurfInverted, dLen2, sDowelSide, nSolidId)
ptTest = EgtCP( nDowel2) - vtDir * EgtCurveThickness( nDowel2)
nTestPoint = EgtPoint( nLayerId, ptTest)
if EgtSurfFrTestExternal( nSurf, nTestPoint) then
EgtErase( nDowel2)
end
EgtErase( nTestPoint)
end
EgtErase( nTestPoint)
EgtErase( nTestSurf)
EgtErase( nTestSurfInverted)
end
EgtErase( nTestSurf)
EgtErase( nTestSurfInverted)
end
end
end
@@ -7830,8 +7910,8 @@ local function CalcWaterdrip( nPartId, nOutlineId, nAreaId, bDraw)
end
end
-- se non è anta o vetro ( che interrompono la cascata di pezzi relativi al telaio) salvo le sottaree per analizzarle
if nAreaType ~= WIN_AREATYPES.SASH and nAreaType ~= WIN_AREATYPES.FILL then
-- se non è anta ( che interrompe la cascata di pezzi relativi al telaio) salvo le sottaree per analizzarle
if nAreaType ~= WIN_AREATYPES.SASH then
local vChildren = EgtGetNameInGroup( vStack[i], WIN_AREA .. '*') or {}
vStack = EgtJoinTables( vStack, vChildren)
end
@@ -7840,8 +7920,15 @@ local function CalcWaterdrip( nPartId, nOutlineId, nAreaId, bDraw)
end
end
-- riordino i parametri ( non dovrebbero mai capitare parametri coincidenti)
-- riordino i parametri ed elimino quelli coincidenti
table.sort( vParams)
local vNewParams = { vParams[1]}
for j = 2, #vParams do
if abs( vParams[j] - vNewParams[#vNewParams]) > GEO.EPS_ZERO then
table.insert( vNewParams, vParams[j])
end
end
vParams = vNewParams
for j = 1, #vParams, 2 do
-- ricavo la guida per il tratto di gocciolatoio
@@ -8335,6 +8422,11 @@ local function CalcPartPreview( nPartId, nPreviewGrp)
elseif nSashType == WIN_SASHTYPES.INACTIVE_OUT then
EgtMove( nAreaId, Vector3d( 0, 0, - 0.2))
end
elseif nAreaType == WIN_AREATYPES.SPLIT then
-- se inglesina esterna la abbasso per averla sotto il vetro
if EgtGetInfo( nOutlineId, WIN_MUNTINFILL_SIDE, 'i') == WIN_MUNTINFILL_SIDES.OUT then
EgtMove( nAreaId, Vector3d( 0, 0, - 1000))
end
end
local color = EgtGetColor( nPartId)
EgtSetColor( nAreaId, color)