diff --git a/Profiles/Main.lua b/Profiles/Main.lua index 31e8a3c..4df78ce 100644 --- a/Profiles/Main.lua +++ b/Profiles/Main.lua @@ -382,6 +382,80 @@ local nFillId = WinCreate.AddFill( nSashId, WIN_FILLTYPES.GLASS) -- -- aggiungo vetro -- local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) +------------------------ Finestra tripla anta battente / ricevente / ricevente ------------------------ + +-- -- definisco divisioni +-- local nArea1Id, nArea0Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3, _, WIN_SPLITTYPES.FRENCH) +-- local nArea2Id, nArea3Id = WinCreate.AddSplit( nArea0Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3, _, WIN_SPLITTYPES.FRENCH) +-- +-- -- aggiungo prima anta +-- local SashJointType = WIN_JNT.FULL_V +-- local nSash1Id = WinCreate.AddSash( nArea1Id, SashJointType, SashJointType, SashJointType, SashJointType, WIN_SASHTYPES.ACTIVE) +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea2Id, SashJointType, SashJointType, SashJointType, SashJointType, WIN_SASHTYPES.INACTIVE_IN) +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo terza anta +-- local nSash3Id = WinCreate.AddSash( nArea3Id, SashJointType, SashJointType, SashJointType, SashJointType, WIN_SASHTYPES.INACTIVE_OUT) +-- -- aggiungo vetro +-- local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) + + +------------------------ Finestra tripla anta battente / battente / ricevente ------------------------ + +-- -- definisco divisioni +-- local nArea1Id, nArea0Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3, _, WIN_SPLITTYPES.FRENCH) +-- local nArea2Id, nArea3Id = WinCreate.AddSplit( nArea0Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3, _, WIN_SPLITTYPES.FRENCH) +-- +-- -- aggiungo prima anta +-- local SashJointType = WIN_JNT.FULL_V +-- local nSash1Id = WinCreate.AddSash( nArea1Id, SashJointType, SashJointType, SashJointType, SashJointType, WIN_SASHTYPES.ACTIVE_OUT) +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea2Id, SashJointType, SashJointType, SashJointType, SashJointType, WIN_SASHTYPES.ACTIVE_IN) +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo terza anta +-- local nSash3Id = WinCreate.AddSash( nArea3Id, SashJointType, SashJointType, SashJointType, SashJointType, WIN_SASHTYPES.INACTIVE) +-- -- aggiungo vetro +-- local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) + + +------------------------ Finestra quattro ante battente / battente / ricevente / ricevente ------------------------ + +-- -- definisco divisioni +-- local nArea1Id, nAreaTmpId = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 4, _, WIN_SPLITTYPES.FRENCH) +-- local nArea2Id, nAreaTmp1Id = WinCreate.AddSplit( nAreaTmpId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 4, _, WIN_SPLITTYPES.FRENCH) +-- local nArea3Id, nArea4Id = WinCreate.AddSplit( nAreaTmp1Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 4, _, WIN_SPLITTYPES.FRENCH) +-- +-- -- aggiungo prima anta +-- local SashJointType = WIN_JNT.FULL_V +-- local nSash1Id = WinCreate.AddSash( nArea1Id, SashJointType, SashJointType, SashJointType, SashJointType, WIN_SASHTYPES.ACTIVE_OUT) +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea2Id, SashJointType, SashJointType, SashJointType, SashJointType, WIN_SASHTYPES.ACTIVE_IN) +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo terza anta +-- local nSash3Id = WinCreate.AddSash( nArea3Id, SashJointType, SashJointType, SashJointType, SashJointType, WIN_SASHTYPES.INACTIVE_IN) +-- -- aggiungo vetro +-- local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo quarta anta +-- local nSash4Id = WinCreate.AddSash( nArea4Id, SashJointType, SashJointType, SashJointType, SashJointType, WIN_SASHTYPES.INACTIVE_OUT) +-- -- aggiungo vetro +-- local nFill4Id = WinCreate.AddFill( nSash4Id, WIN_FILLTYPES.GLASS) + ------------------------ Finestra sei ante con montanti verticali e orizzontale ------------------------ diff --git a/Profiles/Profilo78 - Offset - Copy (46).nge b/Profiles/Profilo78 - Offset - Copy (46).nge new file mode 100644 index 0000000..bceecb3 Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (46).nge differ diff --git a/Profiles/Profilo78 - Offset.nge b/Profiles/Profilo78 - Offset.nge index bceecb3..5f0a680 100644 Binary files a/Profiles/Profilo78 - Offset.nge and b/Profiles/Profilo78 - Offset.nge differ diff --git a/Profiles/WinConst.lua b/Profiles/WinConst.lua index 4d59ec7..305138f 100644 --- a/Profiles/WinConst.lua +++ b/Profiles/WinConst.lua @@ -88,6 +88,10 @@ WIN_SASHTYPES = { NULL = 0, ACTIVE = 1, INACTIVE = 2, + ACTIVE_IN = 3, + ACTIVE_OUT = 4, + INACTIVE_IN = 5, + INACTIVE_OUT = 6, } WIN_SURF_APPROX = 0.05 @@ -139,6 +143,8 @@ WIN_FIXED_TOP = 'Fixed_Top' WIN_FIXED_BOTTOM = 'Fixed_Bottom' WIN_SASH_ACTIVE = 'Sash_Active' WIN_SASH_INACTIVE = 'Sash_Inactive' +WIN_FRENCH_IN = 'French_In' +WIN_FRENCH_OUT = 'French_Out' WIN_SASH_SPLIT = 'Sash_Split' WIN_FRAME_SPLIT = 'Frame_Split' @@ -209,6 +215,8 @@ WIN_PRC_TOOL_NAME = 'TOOL_NAME' WIN_PRC_OFFL = 'OFFL' WIN_PRC_OFFR = 'OFFR' +WIN_CRV_ON_FRENCH_SPLIT = 'OutlineOnFrenchSplit' + WIN_MAINGUIDE = 'MainGuide' WIN_STARTGUIDE = 'StartGuide' WIN_ENDGUIDE = 'EndGuide' diff --git a/Profiles/WinLib/WinCalculate.lua b/Profiles/WinLib/WinCalculate.lua index e63a958..3cee2d5 100644 --- a/Profiles/WinLib/WinCalculate.lua +++ b/Profiles/WinLib/WinCalculate.lua @@ -233,6 +233,28 @@ local function CalcSplitProfileType( nSplitLayerId, nAreaId) -- se split di tipo french non ha profilo assegnato perchè non ha un pezzo associato end +--------------------------------------------------------------------- +local function FindAdjacentSashType( nSplitId, nSouId) + + -- recupero l'altro child dello split + local vSplitChildren = EgtGetInfo( nSplitId, WIN_CHILD, 'vi') + local vChildren = EgtIf( vSplitChildren[1] == nSouId, {vSplitChildren[2]}, {vSplitChildren[1]}) + -- cerco il suo primo figlio di tipo sash + local nAreaType + local nArea + repeat + vChildren = EgtGetInfo( vChildren[1], WIN_CHILD, 'vi') + if vChildren then + nArea = EgtGetParent( EgtGetParent( vChildren[1])) + nAreaType = EgtGetInfo( nArea or GDB_ID.NULL, WIN_AREATYPE, 'i') + end + until not vChildren or nAreaType == WIN_AREATYPES.SASH + + -- recupero il sash type + local nSashType = EgtGetInfo( nArea or GDB_ID.NULL, WIN_SASHTYPE, 'i') + return nSashType +end + --------------------------------------------------------------------- -- funzione che imposta i tipi di profilo in base al tipo di pezzi local function CalcProfileType( nAreaId) @@ -245,20 +267,21 @@ local function CalcProfileType( nAreaId) local nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) while nOutlineId do -- recupero tipo del child - local nChildId = nOutlineId + local vChildId = { nOutlineId} local nChildAreaId local nChildType -- ciclo fino a trovare un child che non sia uno split + -- ( considero solo il primo figlio perchè non è ancora gestito cambio di profilo) repeat - nChildId = EgtGetInfo( nChildId, WIN_CHILD) - if nChildId then - nChildAreaId = EgtGetParent( EgtGetParent( nChildId)) + vChildId = EgtGetInfo( vChildId[1], WIN_CHILD, 'vi') + if vChildId then + nChildAreaId = EgtGetParent( EgtGetParent( vChildId[1])) nChildType = EgtGetInfo( nChildAreaId, WIN_AREATYPE, 'i') end - until not nChildId or ( nChildType ~= WIN_AREATYPES.SPLIT and nChildType ~= WIN_AREATYPES.NULL) + until not vChildId or ( nChildType ~= WIN_AREATYPES.SPLIT and nChildType ~= WIN_AREATYPES.NULL) local sName = EgtGetName( nOutlineId) - if not nChildId or nChildType == WIN_AREATYPES.SASH then + if not vChildId or nChildType == WIN_AREATYPES.SASH then if sName == WIN_BOTTOM then EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SASH_BOTTOM) else @@ -298,16 +321,49 @@ local function CalcProfileType( nAreaId) local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_AREAOUTLINE) local nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) while nOutlineId do - -- faccio sou due volte per trovare il tipo dell'outline originale da cui deriva + -- verifico se deriva da una curva di split di tipo french ( e quindi deve avere profilo battente/ricevente) local nSouId = EgtGetInfo( nOutlineId, WIN_SOU, 'i') - nSouId = EgtGetInfo( nSouId, WIN_SOU, 'i') - local sSouName = EgtGetName( nSouId) - if sSouName == WIN_SPLIT then + local nSouPrevId + local nSplitType + repeat + nSouPrevId = nSouId + nSouId = EgtGetInfo( nSouId, WIN_SOU, 'i') + if nSouId then + local sName = EgtGetName( nSouId) + if sName == WIN_SPLIT then + local nParentId = EgtGetParent( nSouId) + nSplitType = EgtGetInfo( nParentId, WIN_SPLITTYPE, 'i') + end + end + until not nSouId or nSplitType == WIN_SPLITTYPES.FRENCH + + if nSplitType == WIN_SPLITTYPES.FRENCH then + -- setto info sulla curva per ricordare che deriva da un french split ( utile nel calcolo degli outlines) + EgtSetInfo( nOutlineId, WIN_CRV_ON_FRENCH_SPLIT, true) + if nSashType == WIN_SASHTYPES.ACTIVE then EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SASH_ACTIVE) elseif nSashType == WIN_SASHTYPES.INACTIVE then EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SASH_INACTIVE) - end + elseif nSashType == WIN_SASHTYPES.ACTIVE_OUT or nSashType == WIN_SASHTYPES.INACTIVE_OUT then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_FRENCH_OUT) + else + -- devo verificare il tipo dell'anta adiacente + local nAdjSashType = FindAdjacentSashType( nSouId, nSouPrevId) + if nSashType == WIN_SASHTYPES.ACTIVE_IN then + if nAdjSashType == WIN_SASHTYPES.ACTIVE_OUT then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_FRENCH_IN) + else -- adiacente è inactive + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SASH_ACTIVE) + end + elseif nSashType == WIN_SASHTYPES.INACTIVE_IN then + if nAdjSashType == WIN_SASHTYPES.INACTIVE_OUT then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_FRENCH_IN) + else -- adiacente è active + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SASH_INACTIVE) + end + end + end else local sName = EgtGetName( nOutlineId) if sName ~= WIN_BOTTOM then @@ -487,20 +543,10 @@ local function CalculateOutlineFromAreaOutline( nAreaId) EgtSetInfo( nOutlineId, WIN_COPY, nBaseOutlineId) EgtSetInfo( nOutlineId, WIN_PROFILETYPE, sSashProfile) - -- verifico se outline e' segmento battente o ricevente che quindi deriva da split - local bOnFrenchSplit = false - if nSashType ~= WIN_SASHTYPES.NULL then - -- faccio sou due volte per trovare il tipo dell'outline originale da cui deriva - local nSouId = EgtGetInfo( nBaseOutlineId, WIN_SOU, 'i') - nSouId = EgtGetInfo( nSouId, WIN_SOU, 'i') - local sSouName = EgtGetName( nSouId) - -- se deriva da split è segmento battente/ricevente - if sSouName == WIN_SPLIT then - bOnFrenchSplit = true - end - end + -- verifico se outline e' segmento battente o ricevente ( che quindi deriva da split di tipo french) + local bOnFrenchSplit = EgtGetInfo( nBaseOutlineId, WIN_CRV_ON_FRENCH_SPLIT, 'b') or false - -- se outline non è segmento battente o ricevente ( che quindi deriva da split) necessita di offset + -- se outline non è segmento battente o ricevente necessita di offset if not bOnFrenchSplit then -- recupero a ritroso il profilo dell'elemento del frame su cui poggia diff --git a/Profiles/WinLib/WinCreate.lua b/Profiles/WinLib/WinCreate.lua index 5c83c49..645da9b 100644 --- a/Profiles/WinLib/WinCreate.lua +++ b/Profiles/WinLib/WinCreate.lua @@ -22,6 +22,12 @@ require( 'WinConst') -- funzioni +local function AddInfo( nId, sInfo, nVal) + local vInfo = EgtGetInfo( nId, sInfo, 'vi') or {} + table.insert( vInfo, nVal) + EgtSetInfo( nId, sInfo, vInfo) +end + -- funzione che importa il profilo function WinCreate.ImportProfile( sProfilePath) -- verifico esistenza file @@ -136,7 +142,8 @@ function WinCreate.AddSash( nAreaId, nJointBL, nJointBR, nJointTR, nJointTL, nSa while nAreaOutlineId do local nOutlineId = EgtCopy( nAreaOutlineId, nAreaOutlineLayerId) EgtSetInfo( nOutlineId, WIN_SOU, nAreaOutlineId) - EgtSetInfo( nAreaOutlineId, WIN_CHILD, nOutlineId) + EgtRemoveInfo( nOutlineId, WIN_CHILD) + AddInfo( nAreaOutlineId, WIN_CHILD, nOutlineId) nAreaOutlineId = EgtGetNext( nAreaOutlineId) end -- imposto tipo giunzioni @@ -167,7 +174,8 @@ function WinCreate.AddFill( nAreaId, FillType) while nAreaOutlineId do local nOutlineId = EgtCopy( nAreaOutlineId, nAreaOutlineLayerId) EgtSetInfo( nOutlineId, WIN_SOU, nAreaOutlineId) - EgtSetInfo( nAreaOutlineId, WIN_CHILD, nOutlineId) + EgtRemoveInfo( nOutlineId, WIN_CHILD) + AddInfo( nAreaOutlineId, WIN_CHILD, nOutlineId) EgtRemoveInfo( nAreaOutlineLayerId, WIN_JOINT_BL) EgtRemoveInfo( nAreaOutlineLayerId, WIN_JOINT_BR) EgtRemoveInfo( nAreaOutlineLayerId, WIN_JOINT_TL) @@ -369,7 +377,8 @@ function WinCreate.CreateAreaFromSplit( nAreaLayerId, nSplitId) nInters = 1 local nCopyId = EgtCopy( nOutlineId, nArea2OutlineLayerId) EgtSetInfo( nCopyId, WIN_SOU, nOutlineId) - EgtSetInfo( nOutlineId, WIN_CHILD, nCopyId) + EgtRemoveInfo( nCopyId, WIN_CHILD) + AddInfo( nOutlineId, WIN_CHILD, nCopyId) local dStartIntersParam = EgtCurveParamAtPoint( nCopyId, ptInters) EgtTrimCurveStartAtParam( nCopyId, dStartIntersParam) elseif nInters == 1 then @@ -377,13 +386,15 @@ function WinCreate.CreateAreaFromSplit( nAreaLayerId, nSplitId) nInters = 2 local nCopyId = EgtCopy( nOutlineId, nArea2OutlineLayerId) EgtSetInfo( nCopyId, WIN_SOU, nOutlineId) - EgtSetInfo( nOutlineId, WIN_CHILD, nCopyId) + EgtRemoveInfo( nCopyId, WIN_CHILD) + AddInfo( nOutlineId, WIN_CHILD, nCopyId) local dEndIntersParam = EgtCurveParamAtPoint( nCopyId, ptInters) EgtTrimCurveEndAtParam( nCopyId, dEndIntersParam) -- copio anche split local nSplitCopyId = EgtCopy( nSplitId, nArea2OutlineLayerId) EgtSetInfo( nSplitCopyId, WIN_SOU, nSplitId) - EgtSetInfo( nSplitId, WIN_CHILD, nSplitCopyId) + EgtRemoveInfo( nSplitCopyId, WIN_CHILD) + AddInfo( nSplitId, WIN_CHILD, nSplitCopyId) EgtRemoveInfo( nSplitCopyId, WIN_SPLIT_STARTINTERS) EgtRemoveInfo( nSplitCopyId, WIN_SPLIT_ENDINTERS) if not AreSamePointExact( EgtEP( nCopyId), EgtSP( nSplitCopyId)) then @@ -402,7 +413,8 @@ function WinCreate.CreateAreaFromSplit( nAreaLayerId, nSplitId) -- inizio area 1 nCopyId = EgtCopy( nOutlineId, nArea1OutlineLayerId) EgtSetInfo( nCopyId, WIN_SOU, nOutlineId) - EgtSetInfo( nOutlineId, WIN_CHILD, nCopyId) + EgtRemoveInfo( nCopyId, WIN_CHILD) + AddInfo( nOutlineId, WIN_CHILD, nCopyId) local dStartIntersParam = EgtCurveParamAtPoint( nCopyId, ptInters) EgtTrimCurveStartAtParam( nCopyId, dStartIntersParam) elseif nInters == 2 then @@ -410,14 +422,16 @@ function WinCreate.CreateAreaFromSplit( nAreaLayerId, nSplitId) nInters = 3 local nCopyId = EgtCopy( nOutlineId, nArea1OutlineLayerId) EgtSetInfo( nCopyId, WIN_SOU, nOutlineId) - EgtSetInfo( nOutlineId, WIN_CHILD, nCopyId) + EgtRemoveInfo( nCopyId, WIN_CHILD) + AddInfo( nOutlineId, WIN_CHILD, nCopyId) local dEndIntersParam = EgtCurveParamAtPoint( nCopyId, ptInters) EgtTrimCurveEndAtParam( nCopyId, dEndIntersParam) -- copio anche split local nSplitCopyId = EgtCopy( nSplitId, nArea1OutlineLayerId) EgtRemoveName( nSplitCopyId) EgtSetInfo( nSplitCopyId, WIN_SOU, nSplitId) - EgtSetInfo( nSplitId, WIN_CHILD, nSplitCopyId) + EgtRemoveInfo( nSplitCopyId, WIN_CHILD) + AddInfo( nSplitId, WIN_CHILD, nSplitCopyId) EgtRemoveInfo( nSplitCopyId, WIN_SPLIT_STARTINTERS) EgtRemoveInfo( nSplitCopyId, WIN_SPLIT_ENDINTERS) if not AreSamePointExact( EgtEP( nCopyId), EgtSP( nSplitCopyId)) then @@ -438,12 +452,14 @@ function WinCreate.CreateAreaFromSplit( nAreaLayerId, nSplitId) -- copio nel profilo 2 local nCopyId = EgtCopy( nOutlineId, nArea2OutlineLayerId) EgtSetInfo( nCopyId, WIN_SOU, nOutlineId) - EgtSetInfo( nOutlineId, WIN_CHILD, nCopyId) + EgtRemoveInfo( nCopyId, WIN_CHILD) + AddInfo( nOutlineId, WIN_CHILD, nCopyId) elseif nInters == 2 then -- copio nel profilo 1 local nCopyId = EgtCopy( nOutlineId, nArea1OutlineLayerId) EgtSetInfo( nCopyId, WIN_SOU, nOutlineId) - EgtSetInfo( nOutlineId, WIN_CHILD, nCopyId) + EgtRemoveInfo( nCopyId, WIN_CHILD) + AddInfo( nOutlineId, WIN_CHILD, nCopyId) end -- aggiorno indice nOutlineId = EgtGetNext( nOutlineId)