From 5dd44069bc4c1bf5aafea860e04bfa19de961c24 Mon Sep 17 00:00:00 2001 From: SaraP Date: Fri, 5 Jul 2024 12:15:11 +0200 Subject: [PATCH] - correzione telaio triangolare - gestione delle giunzioni come vettore - modificato il calcolo delle sottaree generate da uno split - aggiunta info lato di riferimento per lavorazione dowels - correzioni varie per telai non rettangolari. --- Profiles/Main.lua | 412 ++++++------------- Profiles/WinConst.lua | 8 + Profiles/WinLib/WinCalculate.lua | 451 ++++++++++++++------- Profiles/WinLib/WinCreate.lua | 570 +++++++++++++-------------- Profiles/WinLib/WinManageProject.lua | 6 +- Profiles/WinProject.lua | 4 +- 6 files changed, 710 insertions(+), 741 deletions(-) diff --git a/Profiles/Main.lua b/Profiles/Main.lua index ea215d8..667a0af 100644 --- a/Profiles/Main.lua +++ b/Profiles/Main.lua @@ -59,27 +59,27 @@ WinCreate.ImportProfile( sProfilePath) -- creo telaio generico local FrameJointType = WIN_JNT.FULL_H +local vFrameJoints = { FrameJointType, FrameJointType, FrameJointType, FrameJointType} +local SashJointType = WIN_JNT.FULL_V +local vSashJoints = { SashJointType, SashJointType, SashJointType, SashJointType} + +local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPE.RECT, vFrameJoints, WindowWidth, WindowHeight) +-- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPE.CHAMFER_SIDE, vFrameJoints, WindowWidth, WindowHeight, WindowHeight + 500) +-- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPE.CHAMFER_SIDE, vFrameJoints, WindowWidth, WindowHeight + 500, WindowHeight) +-- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPE.ROUND_ARC, vFrameJoints, WindowWidth, WindowHeight) +-- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPE.SEGMENTAL_ARC, vFrameJoints, WindowWidth, WindowHeight, WindowHeight + 100) + +-- vSashJoints = { SashJointType, SashJointType, SashJointType, SashJointType, SashJointType} +-- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPE.CHAMFER, { FrameJointType, FrameJointType, FrameJointType, FrameJointType, FrameJointType}, WindowWidth, WindowHeight, WindowHeight + 500) + +-- vSashJoints = { SashJointType, SashJointType, SashJointType, SashJointType, SashJointType} +-- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPE.POINTED_ARC, { FrameJointType, FrameJointType, FrameJointType, FrameJointType, FrameJointType}, WindowWidth, WindowHeight, WindowHeight + 600) + +-- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPE.TRG, {WIN_JNT.FULL_H, WIN_JNT.FULL_H, WIN_JNT.FULL_V}, WindowWidth, WindowHeight, WindowWidth) +-- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPE.TRG, {WIN_JNT.FULL_V, WIN_JNT.FULL_V, WIN_JNT.FULL_V}, WindowWidth, WindowHeight, 0) +-- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPE.TRG, {WIN_JNT.FULL_V, WIN_JNT.FULL_H, WIN_JNT.FULL_V}, WindowWidth, WindowHeight, WindowWidth - 100) -local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPE.RECT, FrameJointType, FrameJointType, FrameJointType, FrameJointType, WindowWidth, WindowHeight) --- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPE.CHAMFER_SIDE, FrameJointType, FrameJointType, FrameJointType, FrameJointType, WindowWidth, WindowHeight, WindowHeight + 500) --- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPE.CHAMFER_SIDE, FrameJointType, FrameJointType, FrameJointType, FrameJointType, WindowWidth, WindowHeight + 500, WindowHeight) --- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPE.CHAMFER, FrameJointType, FrameJointType, FrameJointType, FrameJointType, WindowWidth, WindowHeight, WindowHeight + 500) --- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPE.ROUND_ARC, FrameJointType, FrameJointType, FrameJointType, FrameJointType, WindowWidth, WindowHeight) --- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPE.SEGMENTAL_ARC, FrameJointType, FrameJointType, FrameJointType, FrameJointType, WindowWidth, WindowHeight, WindowHeight + 100) --- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPE.POINTED_ARC, FrameJointType, FrameJointType, FrameJointType, FrameJointType, WindowWidth, WindowHeight, WindowHeight + 600) --- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPE.TRG, FrameJointType, FrameJointType, WIN_JNT.ANGLED, WIN_JNT.ANGLED, WindowWidth, WindowHeight, 0) --- -- creo telaio generico --- local nDrawFramePartId = EgtGroup( GDB_ID.ROOT) --- EgtSetName( nDrawFramePartId, 'DrawFrame') --- local nDrawFrameLayerId = EgtGroup( nDrawFramePartId) --- local nFrameBottomId = EgtLine( nDrawFrameLayerId, Point3d( 0, 0, 0), Point3d( WindowWidth, 0, 0)) --- local nFrameRightId = EgtLine( nDrawFrameLayerId, Point3d( WindowWidth, 0, 0), Point3d( WindowWidth, WindowHeight, 0)) --- local nFrameTopId = EgtArc2PV( nDrawFrameLayerId, Point3d( WindowWidth, WindowHeight, 0), Point3d( 0, WindowHeight, 0), Vector3d( 0, 1, 0)) --- --local nFrameTopId = EgtLine( nDrawFrameLayerId, Point3d( WindowWidth, WindowHeight, 0), Point3d( 0, WindowHeight, 0)) --- local nFrameLeftId = EgtLine( nDrawFrameLayerId, Point3d( 0, WindowHeight, 0), Point3d( 0, 0, 0)) --- local FrameJointType = WIN_JNT.ANGLED --- local nFrameId = WinCreate.CreateGenFrame( {nFrameBottomId, nFrameRightId, nFrameTopId, nFrameLeftId}, FrameJointType, FrameJointType, FrameJointType, FrameJointType) ------------------------ Finestra vetro fisso ------------------------ @@ -131,8 +131,7 @@ local nFillId = WinCreate.AddFill( nFrameId, WIN_FILLTYPES.GLASS) ------------------------ Finestra anta singola ------------------------ -- -- aggiungo anta --- local SashJointType = WIN_JNT.FULL_V --- local nSashId = WinCreate.AddSash( nFrameId, SashJointType, SashJointType, SashJointType, SashJointType) +-- local nSashId = WinCreate.AddSash( nFrameId, vSashJoints) -- -- -- aggiungo vetro -- local nFillId = WinCreate.AddFill( nSashId, WIN_FILLTYPES.GLASS) @@ -140,8 +139,7 @@ local nFillId = WinCreate.AddFill( nFrameId, WIN_FILLTYPES.GLASS) ------------------------ Finestra anta singola con divisione orizzontale ------------------------ -- -- aggiungo anta --- local SashJointType = WIN_JNT.FULL_V --- local nSashId = WinCreate.AddSash( nFrameId, SashJointType, SashJointType, SashJointType, SashJointType) +-- local nSashId = WinCreate.AddSash( nFrameId, vSashJoints) -- -- -- definisco prima divisione -- local nArea1Id, nArea2Id = WinCreate.AddSplit( nSashId, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight / 3) @@ -153,8 +151,7 @@ local nFillId = WinCreate.AddFill( nFrameId, WIN_FILLTYPES.GLASS) ------------------------ Finestra anta singola con divisione verticale ------------------------ -- -- aggiungo anta --- local SashJointType = WIN_JNT.FULL_V --- local nSashId = WinCreate.AddSash( nFrameId, SashJointType, SashJointType, SashJointType, SashJointType) +-- local nSashId = WinCreate.AddSash( nFrameId, vSashJoints) -- -- -- definisco prima divisione -- local nArea1Id, nArea2Id = WinCreate.AddSplit( nSashId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 2) @@ -166,8 +163,7 @@ local nFillId = WinCreate.AddFill( nFrameId, WIN_FILLTYPES.GLASS) ------------------------ Finestra anta singola con divisione orizzontale e verticale ------------------------ -- -- aggiungo anta --- local SashJointType = WIN_JNT.FULL_V --- local nSashId = WinCreate.AddSash( nFrameId, SashJointType, SashJointType, SashJointType, SashJointType) +-- local nSashId = WinCreate.AddSash( nFrameId, vSashJoints) -- -- -- definisco divisioni -- local nArea1Id, nArea2Id = WinCreate.AddSplit( nSashId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 2) @@ -183,8 +179,7 @@ local nFillId = WinCreate.AddFill( nFrameId, WIN_FILLTYPES.GLASS) ------------------------ Finestra anta singola con divisione custom ------------------------ -- -- aggiungo anta --- local SashJointType = WIN_JNT.FULL_V --- local nSashId = WinCreate.AddSash( nFrameId, SashJointType, SashJointType, SashJointType, SashJointType) +-- local nSashId = WinCreate.AddSash( nFrameId, vSashJoints) -- local nTempSplitLayerId = EgtGroup( nFrameId) -- EgtSetName( nTempSplitLayerId, WIN_TEMPSPLIT) @@ -208,15 +203,12 @@ local nFillId = WinCreate.AddFill( nFrameId, WIN_FILLTYPES.GLASS) -- local nArea1Id, nArea2Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 2) -- -- -- aggiungo prima anta --- local SashJointType = WIN_JNT.FULL_V --- local nSash1Id = WinCreate.AddSash( nArea1Id, SashJointType, SashJointType, SashJointType, SashJointType) --- +-- local nSash1Id = WinCreate.AddSash( nArea1Id, vSashJoints) -- -- aggiungo vetro -- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) -- -- -- aggiungo seconda anta --- local nSash2Id = WinCreate.AddSash( nArea2Id, SashJointType, SashJointType, SashJointType, SashJointType) --- +-- local nSash2Id = WinCreate.AddSash( nArea2Id, vSashJoints) -- -- aggiungo vetro -- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) @@ -226,15 +218,12 @@ local nFillId = WinCreate.AddFill( nFrameId, WIN_FILLTYPES.GLASS) -- local nArea1Id, nArea2Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 2, _, WIN_SPLITTYPES.FRENCH) -- -- -- aggiungo prima anta --- local SashJointType = WIN_JNT.FULL_V --- local nSash1Id = WinCreate.AddSash( nArea1Id, SashJointType, SashJointType, SashJointType, SashJointType, WIN_SASHTYPES.INACTIVE) --- +-- local nSash1Id = WinCreate.AddSash( nArea1Id, vSashJoints, WIN_SASHTYPES.INACTIVE) -- -- 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) --- +-- local nSash2Id = WinCreate.AddSash( nArea2Id, vSashJoints, WIN_SASHTYPES.ACTIVE) -- -- aggiungo vetro -- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) @@ -242,17 +231,14 @@ local nFillId = WinCreate.AddFill( nFrameId, WIN_FILLTYPES.GLASS) -- -- definisco prima divisione -- local nArea1Id, nArea2Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight / 2) - +-- -- -- aggiungo prima anta --- local SashJointType = WIN_JNT.FULL_V --- local nSash1Id = WinCreate.AddSash( nArea1Id, SashJointType, SashJointType, SashJointType, SashJointType) - +-- local nSash1Id = WinCreate.AddSash( nArea1Id, vSashJoints) -- -- aggiungo vetro -- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) - +-- -- -- aggiungo seconda anta --- local nSash2Id = WinCreate.AddSash( nArea2Id, SashJointType, SashJointType, SashJointType, SashJointType) - +-- local nSash2Id = WinCreate.AddSash( nArea2Id, vSashJoints) -- -- aggiungo vetro -- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) @@ -260,133 +246,108 @@ local nFillId = WinCreate.AddFill( nFrameId, WIN_FILLTYPES.GLASS) -- -- definisco prima divisione -- local nArea1Id, nArea0Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) --- -- -- definisco seconda divisione -- local nArea2Id, nArea3Id = WinCreate.AddSplit( nArea0Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) -- -- -- aggiungo prima anta --- local SashJointType = WIN_JNT.FULL_V --- local nSash1Id = WinCreate.AddSash( nArea1Id, SashJointType, SashJointType, SashJointType, SashJointType) --- +-- local nSash1Id = WinCreate.AddSash( nArea1Id, vSashJoints) -- -- aggiungo vetro -- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) -- -- -- aggiungo seconda anta --- local nSash2Id = WinCreate.AddSash( nArea2Id, SashJointType, SashJointType, SashJointType, SashJointType) --- +-- local nSash2Id = WinCreate.AddSash( nArea2Id, vSashJoints) -- -- aggiungo vetro -- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) -- -- -- aggiungo terza anta --- local nSash3Id = WinCreate.AddSash( nArea3Id, SashJointType, SashJointType, SashJointType, SashJointType) --- +-- local nSash3Id = WinCreate.AddSash( nArea3Id, vSashJoints) -- -- aggiungo vetro -- local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) ------------------------ Finestra tripla anta con montanti verticali(2) ------------------------ --- definisco prima divisione ---local nAreaList = WinCreate.AddSplits( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, { WindowWidth / 3, WindowWidth / 3}) ---local nAreaList = WinCreate.AddSplits( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PROPORTIONAL, { 1}, 3) ---local nAreaList = WinCreate.AddSplits( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, { 0.33}) - --- definisco seconda divisione ---local nArea2Id, nArea3Id = WinCreate.AddSplit( nArea2Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) - ----- aggiungo prima anta ---local SashJointType = WIN_JNT.FULL_V ---local nSash1Id = WinCreate.AddSash( nAreaList[1], SashJointType, SashJointType, SashJointType, SashJointType) --- ----- aggiungo vetro ---local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) --- ----- aggiungo seconda anta ---local nSash2Id = WinCreate.AddSash( nAreaList[2], SashJointType, SashJointType, SashJointType, SashJointType) --- ----- aggiungo vetro ---local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) --- ----- aggiungo terza anta ---local nSash3Id = WinCreate.AddSash( nAreaList[3], SashJointType, SashJointType, SashJointType, SashJointType) --- ----- aggiungo vetro ---local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) +-- -- definisco divisioni +-- local nAreaList = WinCreate.AddSplits( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, { WindowWidth / 3, WindowWidth / 3}) +-- -- local nAreaList = WinCreate.AddSplits( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PROPORTIONAL, { 1, 1}, 3) +-- -- local nAreaList = WinCreate.AddSplits( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, { 0.33, 0.33}, 1) +-- +-- -- aggiungo prima anta +-- local nSash1Id = WinCreate.AddSash( nAreaList[1], vSashJoints) +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nAreaList[2], vSashJoints) +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo terza anta +-- local nSash3Id = WinCreate.AddSash( nAreaList[3], vSashJoints) +-- -- aggiungo vetro +-- local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) ------------------------ Finestra tripla anta con montante verticale e ante battente e ricevente ------------------------ -- -- definisco prima divisione -- local nArea1Id, nArea0Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) --- -- -- definisco seconda divisione -- 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) --- +-- local nSash1Id = WinCreate.AddSash( nArea1Id, vSashJoints) -- -- 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) --- +-- local nSash2Id = WinCreate.AddSash( nArea2Id, vSashJoints, WIN_SASHTYPES.INACTIVE) -- -- aggiungo vetro -- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) -- -- -- aggiungo terza anta --- local nSash3Id = WinCreate.AddSash( nArea3Id, SashJointType, SashJointType, SashJointType, SashJointType, WIN_SASHTYPES.ACTIVE) --- +-- local nSash3Id = WinCreate.AddSash( nArea3Id, vSashJoints, WIN_SASHTYPES.ACTIVE) -- -- aggiungo vetro -- local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) ------------------------ Finestra tripla anta con montanti orizzontali ------------------------ -- -- definisco prima divisione --- local nArea1Id, nArea2Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight / 3) --- +-- local nArea1Id, nArea0Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight / 3) -- -- definisco seconda divisione --- local nArea2Id, nArea3Id = WinCreate.AddSplit( nArea2Id, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight / 3) +-- local nArea2Id, nArea3Id = WinCreate.AddSplit( nArea0Id, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, 2 / 3 * WindowHeight) -- -- -- aggiungo prima anta --- local SashJointType = WIN_JNT.FULL_V --- local nSash1Id = WinCreate.AddSash( nArea1Id, SashJointType, SashJointType, SashJointType, SashJointType) --- +-- local nSash1Id = WinCreate.AddSash( nArea1Id, vSashJoints) -- -- aggiungo vetro -- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) -- -- -- aggiungo seconda anta --- local nSash2Id = WinCreate.AddSash( nArea2Id, SashJointType, SashJointType, SashJointType, SashJointType) --- +-- local nSash2Id = WinCreate.AddSash( nArea2Id, vSashJoints) -- -- aggiungo vetro -- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) -- -- -- aggiungo terza anta --- local nSash3Id = WinCreate.AddSash( nArea3Id, SashJointType, SashJointType, SashJointType, SashJointType) --- +-- local nSash3Id = WinCreate.AddSash( nArea3Id, vSashJoints) -- -- aggiungo vetro -- local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) ---------------------- Finestra tripla anta con montante orizzontale e verticale ------------------------ --- -- definisco prima divisione --- local nArea1Id, nArea2Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight / 2) - --- -- definisco seconda divisione --- local nArea2Id, nArea3Id = WinCreate.AddSplit( nArea2Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 2) - +-- -- definisco divisioni +-- local nArea1Id, nArea0Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight / 2) +-- local nArea2Id, nArea3Id = WinCreate.AddSplit( nArea0Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 2) +-- -- -- aggiungo prima anta --- local SashJointType = WIN_JNT.FULL_V --- local nSash1Id = WinCreate.AddSash( nArea1Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- local nSash1Id = WinCreate.AddSash( nArea1Id, vSashJoints) -- -- aggiungo vetro -- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) - +-- -- -- aggiungo seconda anta --- local nSash2Id = WinCreate.AddSash( nArea2Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- local nSash2Id = WinCreate.AddSash( nArea2Id, vSashJoints) -- -- aggiungo vetro -- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) - +-- -- -- aggiungo terza anta --- local nSash3Id = WinCreate.AddSash( nArea3Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- local nSash3Id = WinCreate.AddSash( nArea3Id, vSashJoints) -- -- aggiungo vetro -- local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) @@ -397,22 +358,20 @@ local nFillId = WinCreate.AddFill( nFrameId, WIN_FILLTYPES.GLASS) -- 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) +-- local nSash1Id = WinCreate.AddSash( nArea1Id, vSashJoints, 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) +-- local nSash2Id = WinCreate.AddSash( nArea2Id, vSashJoints, 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) +-- local nSash3Id = WinCreate.AddSash( nArea3Id, vSashJoints, WIN_SASHTYPES.INACTIVE_OUT) -- -- aggiungo vetro -- local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) - ------------------------ Finestra tripla anta battente / battente / ricevente ------------------------ -- -- definisco divisioni @@ -420,22 +379,20 @@ local nFillId = WinCreate.AddFill( nFrameId, WIN_FILLTYPES.GLASS) -- 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) +-- local nSash1Id = WinCreate.AddSash( nArea1Id, vSashJoints, 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) +-- local nSash2Id = WinCreate.AddSash( nArea2Id, vSashJoints, 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) +-- local nSash3Id = WinCreate.AddSash( nArea3Id, vSashJoints, WIN_SASHTYPES.INACTIVE) -- -- aggiungo vetro -- local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) - ------------------------ Finestra quattro ante battente / battente / ricevente / ricevente ------------------------ -- -- definisco divisioni @@ -444,66 +401,62 @@ local nFillId = WinCreate.AddFill( nFrameId, WIN_FILLTYPES.GLASS) -- 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) +-- local nSash1Id = WinCreate.AddSash( nArea1Id, vSashJoints, 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) +-- local nSash2Id = WinCreate.AddSash( nArea2Id, vSashJoints, 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) +-- local nSash3Id = WinCreate.AddSash( nArea3Id, vSashJoints, 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) +-- local nSash4Id = WinCreate.AddSash( nArea4Id, vSashJoints, WIN_SASHTYPES.INACTIVE_OUT) -- -- aggiungo vetro -- local nFill4Id = WinCreate.AddFill( nSash4Id, WIN_FILLTYPES.GLASS) - ------------------------ Finestra sei ante con montanti verticali e orizzontale ------------------------ -- -- definisco divisione orizzontale -- local nArea1Id, nArea2Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight / 2) --- -- -- definisco divisioni verticali --- local nArea11Id, nArea12Id = WinCreate.AddSplit( nArea1Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) --- local nArea12Id, nArea13Id = WinCreate.AddSplit( nArea12Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) --- local nArea21Id, nArea23Id = WinCreate.AddSplit( nArea2Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) --- local nArea22Id, nArea23Id = WinCreate.AddSplit( nArea23Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) +-- local nArea11Id, nArea0Id = WinCreate.AddSplit( nArea1Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) +-- local nArea12Id, nArea13Id = WinCreate.AddSplit( nArea0Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) +-- local nArea21Id, nArea00Id = WinCreate.AddSplit( nArea2Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) +-- local nArea22Id, nArea23Id = WinCreate.AddSplit( nArea00Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) -- -- -- aggiungo prima anta --- local SashJointType = WIN_JNT.FULL_V --- local nSash1Id = WinCreate.AddSash( nArea11Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- local nSash1Id = WinCreate.AddSash( nArea11Id, vSashJoints) -- -- aggiungo vetro -- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) -- -- -- aggiungo seconda anta --- local nSash2Id = WinCreate.AddSash( nArea12Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- local nSash2Id = WinCreate.AddSash( nArea12Id, vSashJoints) -- -- aggiungo vetro -- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) -- -- -- aggiungo terza anta --- local nSash3Id = WinCreate.AddSash( nArea13Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- local nSash3Id = WinCreate.AddSash( nArea13Id, vSashJoints) -- -- aggiungo vetro -- local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) -- -- -- aggiungo quarta anta --- local nSash4Id = WinCreate.AddSash( nArea21Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- local nSash4Id = WinCreate.AddSash( nArea21Id, vSashJoints) -- -- aggiungo vetro -- local nFill4Id = WinCreate.AddFill( nSash4Id, WIN_FILLTYPES.GLASS) -- -- -- aggiungo quinta anta --- local nSash5Id = WinCreate.AddSash( nArea22Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- local nSash5Id = WinCreate.AddSash( nArea22Id, vSashJoints) -- -- aggiungo vetro -- local nFill5Id = WinCreate.AddFill( nSash5Id, WIN_FILLTYPES.GLASS) -- -- -- aggiungo sesta anta --- local nSash6Id = WinCreate.AddSash( nArea23Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- local nSash6Id = WinCreate.AddSash( nArea23Id, vSashJoints) -- -- aggiungo vetro -- local nFill6Id = WinCreate.AddFill( nSash6Id, WIN_FILLTYPES.GLASS) @@ -511,71 +464,67 @@ local nFillId = WinCreate.AddFill( nFrameId, WIN_FILLTYPES.GLASS) -- -- definisco divisione orizzontale -- local nArea1Id, nArea2Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight / 2) - -- -- definisco divisioni verticali --- local nArea11Id, nArea12Id = WinCreate.AddSplit( nArea1Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) --- local nArea12Id, nArea13Id = WinCreate.AddSplit( nArea12Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3, _, WIN_SPLITTYPES.FRENCH) --- local nArea21Id, nArea23Id = WinCreate.AddSplit( nArea2Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) --- local nArea21Id, nArea22Id = WinCreate.AddSplit( nArea21Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3, _, WIN_SPLITTYPES.FRENCH) - +-- local nArea11Id, nArea0Id = WinCreate.AddSplit( nArea1Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) +-- local nArea12Id, nArea13Id = WinCreate.AddSplit( nArea0Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3, _, WIN_SPLITTYPES.FRENCH) +-- local nArea21Id, nArea00Id = WinCreate.AddSplit( nArea2Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) +-- local nArea22Id, nArea23Id = WinCreate.AddSplit( nArea00Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3, _, WIN_SPLITTYPES.FRENCH) +-- -- -- aggiungo prima anta --- local SashJointType = WIN_JNT.FULL_V --- local nSash1Id = WinCreate.AddSash( nArea11Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- local nSash1Id = WinCreate.AddSash( nArea11Id, vSashJoints) -- -- aggiungo vetro -- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) - +-- -- -- aggiungo seconda anta --- local nSash2Id = WinCreate.AddSash( nArea12Id, SashJointType, SashJointType, SashJointType, SashJointType, WIN_SASHTYPES.INACTIVE) +-- local nSash2Id = WinCreate.AddSash( nArea12Id, vSashJoints, WIN_SASHTYPES.INACTIVE) -- -- aggiungo vetro -- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) - +-- -- -- aggiungo terza anta --- local nSash3Id = WinCreate.AddSash( nArea13Id, SashJointType, SashJointType, SashJointType, SashJointType, WIN_SASHTYPES.ACTIVE) +-- local nSash3Id = WinCreate.AddSash( nArea13Id, vSashJoints, WIN_SASHTYPES.ACTIVE) -- -- aggiungo vetro -- local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) - +-- -- -- aggiungo quarta anta --- local nSash4Id = WinCreate.AddSash( nArea21Id, SashJointType, SashJointType, SashJointType, SashJointType, WIN_SASHTYPES.INACTIVE) +-- local nSash4Id = WinCreate.AddSash( nArea21Id, vSashJoints) -- -- aggiungo vetro -- local nFill4Id = WinCreate.AddFill( nSash4Id, WIN_FILLTYPES.GLASS) - +-- -- -- aggiungo quinta anta --- local nSash5Id = WinCreate.AddSash( nArea22Id, SashJointType, SashJointType, SashJointType, SashJointType, WIN_SASHTYPES.ACTIVE) +-- local nSash5Id = WinCreate.AddSash( nArea22Id, vSashJoints, WIN_SASHTYPES.INACTIVE) -- -- aggiungo vetro -- local nFill5Id = WinCreate.AddFill( nSash5Id, WIN_FILLTYPES.GLASS) - +-- -- -- aggiungo sesta anta --- local nSash6Id = WinCreate.AddSash( nArea23Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- local nSash6Id = WinCreate.AddSash( nArea23Id, vSashJoints, WIN_SASHTYPES.ACTIVE) -- -- aggiungo vetro -- local nFill6Id = WinCreate.AddFill( nSash6Id, WIN_FILLTYPES.GLASS) ------------------------ Finestra tre ante con montante verticale, ante battente ricevente e split di tutte le ante ------------------------ -- -- definisco prima divisione --- local nArea1Id, nArea2Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) - +-- local nArea1Id, nArea0Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) -- -- definisco seconda divisione --- local nArea2Id, nArea3Id = WinCreate.AddSplit( nArea2Id, 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) +-- local nSash1Id = WinCreate.AddSash( nArea1Id, vSashJoints) -- -- definisco divisione -- local nArea11Id, nArea12Id = WinCreate.AddSplit( nSash1Id, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight * 2 / 5) -- -- aggiungo vetri -- local nFill11Id = WinCreate.AddFill( nArea11Id, WIN_FILLTYPES.GLASS) -- local nFill12Id = WinCreate.AddFill( nArea12Id, WIN_FILLTYPES.GLASS) - +-- -- -- aggiungo seconda anta --- local nSash2Id = WinCreate.AddSash( nArea2Id, SashJointType, SashJointType, SashJointType, SashJointType, WIN_SASHTYPES.INACTIVE) +-- local nSash2Id = WinCreate.AddSash( nArea2Id, vSashJoints, WIN_SASHTYPES.INACTIVE) -- -- definisco divisione -- local nArea21Id, nArea22Id = WinCreate.AddSplit( nSash2Id, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight * 2 / 5) -- -- aggiungo vetri -- local nFill21Id = WinCreate.AddFill( nArea21Id, WIN_FILLTYPES.GLASS) -- local nFill22Id = WinCreate.AddFill( nArea22Id, WIN_FILLTYPES.GLASS) - +-- -- -- aggiungo terza anta --- local nSash3Id = WinCreate.AddSash( nArea3Id, SashJointType, SashJointType, SashJointType, SashJointType, WIN_SASHTYPES.ACTIVE) +-- local nSash3Id = WinCreate.AddSash( nArea3Id, vSashJoints, WIN_SASHTYPES.ACTIVE) -- -- definisco divisione -- local nArea31Id, nArea32Id = WinCreate.AddSplit( nSash3Id, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight * 2 / 5) -- -- aggiungo vetri @@ -585,39 +534,33 @@ local nFillId = WinCreate.AddFill( nFrameId, WIN_FILLTYPES.GLASS) ------------------------ Finestra tre ante con montante orizzontale e verticale, ante battente ricevente e split di tutte le ante ------------------------ -- -- definisco prima divisione --- local nArea1Id, nArea0Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight) - --- -- definisco prima divisione --- local nArea1Id, nArea2Id = WinCreate.AddSplit( nArea1Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) - --- -- definisco seconda divisione --- local nArea2Id, nArea3Id = WinCreate.AddSplit( nArea2Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3, _, WIN_SPLITTYPES.FRENCH) - +-- local nArea1Id, nArea0Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, 2 * WindowHeight / 3) +-- local nArea2Id, nArea00Id = WinCreate.AddSplit( nArea1Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) +-- local nArea3Id, nArea4Id = WinCreate.AddSplit( nArea00Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3, _, WIN_SPLITTYPES.FRENCH) +-- -- -- aggiungo anta sopra --- local SashJointType = WIN_JNT.FULL_V --- local nSash0Id = WinCreate.AddSash( nArea0Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- local nSash0Id = WinCreate.AddSash( nArea0Id, vSashJoints) -- -- aggiungo vetri -- local nFill0Id = WinCreate.AddFill( nSash0Id, WIN_FILLTYPES.GLASS) - +-- -- -- aggiungo prima anta --- local SashJointType = WIN_JNT.FULL_V --- local nSash1Id = WinCreate.AddSash( nArea1Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- local nSash1Id = WinCreate.AddSash( nArea2Id, vSashJoints) -- -- definisco divisione -- local nArea11Id, nArea12Id = WinCreate.AddSplit( nSash1Id, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight * 2 / 5) -- -- aggiungo vetri -- local nFill11Id = WinCreate.AddFill( nArea11Id, WIN_FILLTYPES.GLASS) -- local nFill12Id = WinCreate.AddFill( nArea12Id, WIN_FILLTYPES.GLASS) - +-- -- -- aggiungo seconda anta --- local nSash2Id = WinCreate.AddSash( nArea2Id, SashJointType, SashJointType, SashJointType, SashJointType, WIN_SASHTYPES.INACTIVE) +-- local nSash2Id = WinCreate.AddSash( nArea3Id, vSashJoints, WIN_SASHTYPES.INACTIVE) -- -- definisco divisione -- local nArea21Id, nArea22Id = WinCreate.AddSplit( nSash2Id, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight * 2 / 5) -- -- aggiungo vetri -- local nFill21Id = WinCreate.AddFill( nArea21Id, WIN_FILLTYPES.GLASS) -- local nFill22Id = WinCreate.AddFill( nArea22Id, WIN_FILLTYPES.GLASS) - +-- -- -- aggiungo terza anta --- local nSash3Id = WinCreate.AddSash( nArea3Id, SashJointType, SashJointType, SashJointType, SashJointType, WIN_SASHTYPES.ACTIVE) +-- local nSash3Id = WinCreate.AddSash( nArea4Id, vSashJoints, WIN_SASHTYPES.ACTIVE) -- -- definisco divisione -- local nArea31Id, nArea32Id = WinCreate.AddSplit( nSash3Id, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight * 2 / 5) -- -- aggiungo vetri @@ -627,109 +570,6 @@ local nFillId = WinCreate.AddFill( nFrameId, WIN_FILLTYPES.GLASS) ----------------------------------------------------------------------------------- --- -- creo gruppo frame --- local nFrameLayerId = EgtGroup( GDB_ID.ROOT) --- EgtSetName( nFrameLayerId, WIN_FRAME) --- local nOutlineLayerId = EgtGroup( nFrameLayerId) --- EgtSetName( nOutlineLayerId, WIN_OUTLINE) - - --- -- disegno outline --- local nFrameBottomId = EgtLine( nOutlineLayerId, Point3d( 0, 0, 0), Point3d( WindowWidth, 0, 0)) --- EgtSetName( nFrameBottomId, WIN_BOTTOM) --- local nFrameRightId = EgtLine( nOutlineLayerId, Point3d( WindowWidth, 0, 0), Point3d( WindowWidth, WindowHeight, 0)) --- EgtSetName( nFrameRightId, WIN_RIGHT) --- local nFrameTopId = EgtLine( nOutlineLayerId, Point3d( WindowWidth, WindowHeight, 0), Point3d( 0, WindowHeight, 0), Vector3d( -1, 0.5, 0)) --- EgtSetName( nFrameTopId, WIN_TOP) --- local nFrameLeftId = EgtLine( nOutlineLayerId, Point3d( 0, WindowHeight, 0), Point3d( 0, 0, 0)) --- EgtSetName( nFrameLeftId, WIN_LEFT) - --- -- cerchio --- local nFrameBottomId = EgtArcC2P( nOutlineLayerId, Point3d( WindowHeight / 2, WindowHeight / 2, 0), Point3d( 0, 0, 0), Point3d( WindowWidth, 0, 0)) --- EgtSetName( nFrameBottomId, WIN_BOTTOM) --- local nFrameRightId = EgtArcC2P( nOutlineLayerId, Point3d( WindowHeight / 2, WindowHeight / 2, 0), Point3d( WindowWidth, 0, 0), Point3d( WindowWidth, WindowHeight, 0)) --- EgtSetName( nFrameRightId, WIN_RIGHT) --- local nFrameTopId = EgtArcC2P( nOutlineLayerId, Point3d( WindowHeight / 2, WindowHeight / 2, 0), Point3d( WindowWidth, WindowHeight, 0), Point3d( 0, WindowHeight, 0)) --- EgtSetName( nFrameTopId, WIN_TOP) --- local nFrameLeftId = EgtArcC2P( nOutlineLayerId, Point3d( WindowHeight / 2, WindowHeight / 2, 0), Point3d( 0, WindowHeight, 0), Point3d( 0, 0, 0)) --- EgtSetName( nFrameLeftId, WIN_LEFT) - - - - --- -- disegno outline --- local nFrameBottomId = EgtLine( nOutlineLayerId, Point3d( 0, 0, 0), Point3d( WindowWidth, 0, 0)) --- EgtSetName( nFrameBottomId, WIN_BOTTOM) --- local nFrameRightId = EgtLine( nOutlineLayerId, Point3d( WindowWidth, 0, 0), Point3d( WindowWidth+400, WindowHeight, 0)) --- EgtSetName( nFrameRightId, WIN_RIGHT) --- local nFrameTopId = EgtLine( nOutlineLayerId, Point3d( WindowWidth+400, WindowHeight, 0), Point3d( -200, WindowHeight-300, 0)) --- --local nFrameTopId = EgtArc2PV( nOutlineLayerId, Point3d( WindowWidth+400, WindowHeight, 0), Point3d( -200, WindowHeight-300, 0), Vector3d( -1, 0.5, 0)) - --- --local nFirstArcId = EgtArc2PDEx(nOutlineLayerId,{-200,1220,0},{0,1700,0},GDB_PT.STD,-1,90,GDB_RT.GRID) -- Id=369 --- --local nFrameTopId = EgtCurveCompo(nOutlineLayerId,nFirstArcId,true) -- Id=369 --- --local nSecondArcId = EgtArc2PDEx(nOutlineLayerId,{0,1700,0},{1700,1900,0},GDB_PT.STD,-1,44.7603,GDB_RT.GRID) -- Id=370 --- --EgtAddCurveCompoCurve(nFrameTopId,nSecondArcId,true,true) -- Ok=1 --- --local nThirdArcId = EgtArc2PDEx(nOutlineLayerId,{1700,1900,0},{1930,1520,0},GDB_PT.STD,199,328.6594,GDB_RT.GRID) -- Id=370 --- --EgtAddCurveCompoCurve(nFrameTopId,nThirdArcId,true,true) -- Ok=1 --- --EgtInvertCurve( nFrameTopId) - --- --local nFrameTop1Id = EgtLine( nOutlineLayerId, Point3d( WindowWidth+400, WindowHeight, 0), Point3d( WindowWidth / 2, WindowHeight+100, 0)) --- --local nFrameTop2Id = EgtLine( nOutlineLayerId, Point3d( WindowWidth / 2, WindowHeight+100, 0), Point3d( -200, WindowHeight-300, 0)) --- --local nFrameTopId = EgtCurveCompo(nOutlineLayerId,nFrameTop1Id,true) -- Id=369 --- --EgtAddCurveCompoCurve(nFrameTopId,nFrameTop2Id,true,true) -- Ok=1 - --- EgtSetName( nFrameTopId, WIN_TOP) --- local nFrameLeftId = EgtLine( nOutlineLayerId, Point3d( -200, WindowHeight-300, 0), Point3d( 0, 0, 0)) --- EgtSetName( nFrameLeftId, WIN_LEFT) - - --- -- scelgo tipo di giunzioni --- local JointType = WIN_JNT.FULL_H --- EgtSetInfo( nOutlineLayerId, WIN_JOINT_BL, JointType) --- EgtSetInfo( nOutlineLayerId, WIN_JOINT_BR, JointType) --- EgtSetInfo( nOutlineLayerId, WIN_JOINT_TL, JointType) --- EgtSetInfo( nOutlineLayerId, WIN_JOINT_TR, JointType) - - --- -- funzione che assegna i profili serramento ai vari outline --- -- per il momento li assegno a mano --- EgtSetInfo( nFrameBottomId, WIN_PROFILETYPE, WIN_SASH_BOTTOM) --- EgtSetInfo( nFrameRightId, WIN_PROFILETYPE, WIN_SASH_TOP) --- EgtSetInfo( nFrameTopId, WIN_PROFILETYPE, WIN_SASH_TOP) --- EgtSetInfo( nFrameLeftId, WIN_PROFILETYPE, WIN_SASH_TOP) - - - --- -- definisco prima divisione --- WinLib.AddSplit( nHoleLayerId, WIN_SPLITTYPE.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 2) - - --- WinLib.AddSplit( nFrameLayerId, WIN_SPLITTYPE.HORIZONTAL, WIN_MEASURE.PROPORTIONAL, 2, 3) ---WinLib.AddSplits( nFrameLayerId, WIN_SPLITTYPE.VERTICAL, WIN_MEASURE.ABSOLUT, { WindowWidth / 5, WindowWidth / 3 * 2}) ---WinLib.AddSplits( nFrameLayerId, WIN_SPLITTYPE.HORIZONTAL, WIN_MEASURE.PROPORTIONAL, { 1.5, 3}, 4.5) --- local nSplitId = EgtLine( nOutlineLayerId, Point3d( 0, WindowHeight / 2, 0), Point3d( WindowWidth, WindowHeight / 4, 0)) - --- local nArc1Id = EgtArc2PDEx( nOutlineLayerId, { 600, 1500, 0}, { 900, 800, 0}, GDB_PT.STD, -1, 270, GDB_RT.GRID) -- Id=301 --- local nSplitId = EgtCurveCompo( nOutlineLayerId, nArc1Id, true) -- Id=301 --- local nArc2Id = EgtArc2PDEx( nOutlineLayerId, { 900, 800, 0}, { 900, 0, 0}, GDB_PT.STD, -1, 316.3972, GDB_RT.GRID) -- Id=302 --- EgtAddCurveCompoCurve( nSplitId, nArc2Id, true, true) -- Ok=1 --- EgtInvertCurve( nSplitId) - --- WinLib.AddGenSplit( nFrameLayerId, nSplitId) - --- local nArea1Id = EgtGetFirstNameInGroup( nHoleLayerId, WIN_AREA1) --- WinLib.AddSplit( nArea1Id, WIN_SPLITTYPE.HORIZONTAL, WIN_MEASURE.PROPORTIONAL, 2, 3) - - --- creo pezzi per outline --- local nCurrOutlineId = EgtGetFirstInGroup( nOutlineLayerId) --- while nCurrOutlineId do --- WinLib.CreatePartFromOutline( nFrameLayerId, nCurrOutlineId) --- nCurrOutlineId = EgtGetNext( nCurrOutlineId) --- end --- local nCurrOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_SPLIT) --- WinLib.CreatePartFromOutline( nFrameLayerId, nCurrOutlineId) - -- aggiungo ferramenta WinCreate.AddHardware( nFrameId, '000545') diff --git a/Profiles/WinConst.lua b/Profiles/WinConst.lua index 184df20..eb051a6 100644 --- a/Profiles/WinConst.lua +++ b/Profiles/WinConst.lua @@ -188,6 +188,7 @@ WIN_JOINT_BDIV = 'JointBDiv' WIN_JOINT_TL = 'JointTL' WIN_JOINT_TR = 'JointTR' WIN_JOINT_TDIV = 'JointTDiv' +WIN_JOINTS = 'Joints' WIN_GEO_IN = 'In' @@ -253,6 +254,13 @@ WIN_PRC_OVERMAT_IN = 'OVERMAT_IN' WIN_PRC_OVERMAT_OUT = 'OVERMAT_OUT' WIN_PRC_OVERMAT_LEFT = 'OVERMAT_LEFT' WIN_PRC_OVERMAT_RIGHT = 'OVERMAT_RIGHT' +WIN_PRC_DWL_SIDE = 'REFERENCE_SIDE' +WIN_PRC_DWL_SIDETYPE = { + OUT = 'Out', + IN = 'In', + LEFT = 'Left', + RIGHT = 'Right' +} WIN_DOWEL = 'Dowel' WIN_DWL_TOPPERPSTART = 'TopPerpStart' diff --git a/Profiles/WinLib/WinCalculate.lua b/Profiles/WinLib/WinCalculate.lua index 6d900fc..c606d85 100644 --- a/Profiles/WinLib/WinCalculate.lua +++ b/Profiles/WinLib/WinCalculate.lua @@ -30,15 +30,14 @@ end --------------------------------------------------------------------- -- funzione che copia la info di chiave sInfo da nSou a nDest -local function CopyInfo( nDest, nSou, sInfo) - local sVal = EgtGetInfo( nSou, sInfo) or '0' +local function CopyInfo( nDest, nSou, sInfo, Default) + local sVal = EgtGetInfo( nSou, sInfo) or Default EgtSetInfo( nDest, sInfo, sVal) end --------------------------------------------------------------------- -- funzione che trova punto di intersezione fra due curve eventualmente estendendole -local function FindIntersectionPoint( nCrv1, nCrv2) - local ptRef = EgtSP( nCrv1) +local function FindIntersectionPoint( nCrv1, nCrv2, ptRef) local ptInt = EgtIP( nCrv1, nCrv2, ptRef) if not ptInt then -- se entrambe linee @@ -85,7 +84,7 @@ end --------------------------------------------------------------------- -- funzione che dato un gruppo contenente curve ordinate che creano una curva chiusa, -- ne estende/taglia i contorni per ottenere una curva chiusa continua -local function TrimAndOrientOrderedCurveLayer( nLayerId) +local function TrimAndOrientOrderedCurveLayer( nLayerId, bOrient) local IntersCurveList = {} local LastCurveInters local nCurveId = EgtGetFirstInGroup( nLayerId) @@ -95,9 +94,15 @@ local function TrimAndOrientOrderedCurveLayer( nLayerId) if not nPrevId then nPrevId = EgtGetLastInGroup( nLayerId) end - local ptInters = FindIntersectionPoint( nCurveId, nPrevId) + local ptInters = FindIntersectionPoint( nCurveId, nPrevId, EgtSP( nCurveId)) if LastCurveInters then LastCurveInters.EndInters = Point3d( ptInters) + -- se il punto di intersezione è lo stesso trovato nell'iterazione precedente cerco una seconda + -- intersezione tra le due curve + if AreSamePointApprox( ptInters, LastCurveInters.StartInters) then + ptInters = FindIntersectionPoint( nCurveId, nPrevId, EgtEP( nCurveId)) + LastCurveInters.EndInters = Point3d( ptInters) + end end local NewCurveInters = { CurveId = nCurveId, StartInters = Point3d( ptInters)} table.insert( IntersCurveList, NewCurveInters) @@ -111,8 +116,8 @@ local function TrimAndOrientOrderedCurveLayer( nLayerId) local CurveInters = IntersCurveList[nIntersCurveIndex] local dStartParam = EgtCurveParamAtPoint( CurveInters.CurveId, CurveInters.StartInters, 100 * GEO.EPS_SMALL) local dEndParam = EgtCurveParamAtPoint( CurveInters.CurveId, CurveInters.EndInters, 100 * GEO.EPS_SMALL) - EgtTrimCurveStartEndAtParam( CurveInters.CurveId, min( dStartParam, dEndParam), max( dStartParam, dEndParam)) - if dStartParam > dEndParam then + EgtTrimCurveStartEndAtParam( CurveInters.CurveId, min( dStartParam, dEndParam), max( dStartParam, dEndParam)) + if bOrient and dStartParam > dEndParam then EgtInvertCurve( CurveInters.CurveId) end end @@ -172,6 +177,29 @@ local function GetOutlineProfileId( nOutlineId, bUseBottomRail) return EgtGetFirstNameInGroup( nLayerId, sProfileName) end +--------------------------------------------------------------------- +-- funzione che recupera il pezzo associato ad un outline +local function FindAssociatedPart( nOutlineId) + + local nPartId = EgtGetInfo( nOutlineId, WIN_REF_BOTTOMRAIL_PART, 'i') or EgtGetInfo( nOutlineId, WIN_REF_PART, 'i') + if not nPartId then + -- cerco la prima curva da cui deriva che ha un pezzo associato + local nBaseOutline = EgtGetInfo( nOutlineId, WIN_COPY, 'i') + while not nPartId do + -- recupero il base outline da cui deriva + nBaseOutline = EgtGetInfo( nBaseOutline, WIN_SOU, 'i') + -- verifico se ha un profilo associato ( e quindi un pezzo) + local sProfileType = EgtGetInfo( nBaseOutline, WIN_PROFILETYPE) + if sProfileType then + -- recupero l'outline associato + local nCrvId = EgtGetInfo( nBaseOutline, WIN_COPY, 'i') + nPartId = EgtGetInfo( nCrvId, WIN_REF_BOTTOMRAIL_PART, 'i') or EgtGetInfo( nCrvId, WIN_REF_PART, 'i') + end + end + end + + return nPartId +end --------------------------------------------------------------------- ----------------- CALCOLO DEI PROFILI ------------------------------ @@ -294,6 +322,26 @@ local function FindAdjacentSashType( nSplitId, nSouId) return nSashType end +--------------------------------------------------------------------- +local function GetSubAreaType( nAreaId) + + local vStack = { nAreaId} + local i = 1 + while vStack[i] do + -- verifico se area è di tipo sash o fill + local nType = EgtGetInfo( vStack[i], WIN_AREATYPE, 'i') + if nType == WIN_AREATYPES.FILL or nType == WIN_AREATYPES.SASH then + return nType + end + -- aggiungo le sue sottoaree ( se esistono) tra gli elementi da analizzare + local vSubAreas = EgtGetNameInGroup( vStack[i], WIN_AREA .. '*') or {} + vStack = EgtJoinTables( vStack, vSubAreas) + -- aggiorno il contatore + i = i + 1 + end + return nil +end + --------------------------------------------------------------------- -- funzione che imposta i tipi di profilo in base al tipo di pezzi local function CalcProfileType( nAreaId) @@ -301,26 +349,14 @@ local function CalcProfileType( nAreaId) -- FRAME if nAreaType == WIN_AREATYPES.FRAME then + -- recupero il tipo delle sottoaree + local nChildType = GetSubAreaType( nAreaId) -- assegno il profilo alle curve di outline local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_AREAOUTLINE) local nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) while nOutlineId do - -- recupero tipo del child - 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 - vChildId = EgtGetInfo( vChildId[1], WIN_CHILD, 'vi') - if vChildId then - nChildAreaId = EgtGetParent( EgtGetParent( vChildId[1])) - nChildType = EgtGetInfo( nChildAreaId, WIN_AREATYPE, 'i') - end - until not vChildId or ( nChildType ~= WIN_AREATYPES.SPLIT and nChildType ~= WIN_AREATYPES.NULL) local sName = EgtGetName( nOutlineId) - - if not vChildId or nChildType == WIN_AREATYPES.SASH then + if not nChildType or nChildType == WIN_AREATYPES.SASH then if sName == WIN_BOTTOM then EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SASH_BOTTOM) else @@ -459,22 +495,23 @@ end local function CalculateOutlineFromAreaOutline( nAreaId) local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') - -- recupero il base outline e lo copio + -- recupero il base outline e creo gruppo per outline local nAreaOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_AREAOUTLINE) - local nOutlineLayerId = EgtCopyGlob( nAreaOutlineLayerId, nAreaId) + local nOutlineLayerId = EgtGroup( nAreaId) EgtSetName( nOutlineLayerId, WIN_OUTLINE) EgtSetStatus( nOutlineLayerId, GDB_ST.OFF) + CopyInfo( nOutlineLayerId, nAreaOutlineLayerId, WIN_JOINTS) + CopyInfo( nOutlineLayerId, nAreaOutlineLayerId, WIN_BOTTOMRAIL) -- FRAME if nAreaType == WIN_AREATYPES.FRAME then -- sistemo le info local nAreaOutlineId = EgtGetFirstInGroup( nAreaOutlineLayerId) - local nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) while nAreaOutlineId do + local nOutlineId = EgtCopyGlob( nAreaOutlineId, nOutlineLayerId) EgtSetInfo( nAreaOutlineId, WIN_COPY, nOutlineId) EgtSetInfo( nOutlineId, WIN_COPY, nAreaOutlineId) nAreaOutlineId = EgtGetNext( nAreaOutlineId) - nOutlineId = EgtGetNext( nOutlineId) end -- se presente, copio split @@ -488,12 +525,10 @@ local function CalculateOutlineFromAreaOutline( nAreaId) EgtSetInfo( nBaseSplitId, WIN_COPY, nSplitId) EgtSetInfo( nSplitId, WIN_COPY, nBaseSplitId) end - + -- SPLIT elseif nAreaType == WIN_AREATYPES.SPLIT or nAreaType == WIN_AREATYPES.NULL then - -- svuoto il gruppo - EgtEmptyGroup( nOutlineLayerId) -- recupero outline di livello precedente e lo copio pezzo per pezzo local nBaseOutlineId = EgtGetFirstInGroup( nAreaOutlineLayerId) while nBaseOutlineId do @@ -517,7 +552,7 @@ local function CalculateOutlineFromAreaOutline( nAreaId) nBaseOutlineId = EgtGetNext( nBaseOutlineId) end -- taglio tutti i contorni - TrimAndOrientOrderedCurveLayer( nOutlineLayerId) + TrimAndOrientOrderedCurveLayer( nOutlineLayerId, true) -- se presente, copio split local nBaseSplitLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_BASESPLIT) @@ -546,12 +581,10 @@ local function CalculateOutlineFromAreaOutline( nAreaId) EgtMove( nSplitId, Z_AX() * dSashZOffset) end end - - + + -- SASH elseif nAreaType == WIN_AREATYPES.SASH then - -- svuoto il gruppo - EgtEmptyGroup( nOutlineLayerId) -- recupero se anta battente ricevente local nSashType = EgtGetInfo( nAreaId, WIN_SASHTYPE, 'i') or WIN_SASHTYPES.NULL @@ -614,7 +647,7 @@ local function CalculateOutlineFromAreaOutline( nAreaId) nBaseOutlineId = EgtGetNext( nBaseOutlineId) end -- accorcio gli offset - TrimAndOrientOrderedCurveLayer( nOutlineLayerId) + TrimAndOrientOrderedCurveLayer( nOutlineLayerId, true) -- se presente, copio split local nBaseSplitLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_BASESPLIT) @@ -645,8 +678,6 @@ local function CalculateOutlineFromAreaOutline( nAreaId) -- FILL elseif nAreaType == WIN_AREATYPES.FILL then - -- svuoto il gruppo - EgtEmptyGroup( nOutlineLayerId) -- ciclo su BaseArea riempimento local nBaseOutlineId = EgtGetFirstInGroup( nAreaOutlineLayerId) while nBaseOutlineId do @@ -686,7 +717,7 @@ local function CalculateOutlineFromAreaOutline( nAreaId) nBaseOutlineId = EgtGetNext( nBaseOutlineId) end -- accorcio gli offset - TrimAndOrientOrderedCurveLayer( nOutlineLayerId) + TrimAndOrientOrderedCurveLayer( nOutlineLayerId, true) end end @@ -765,6 +796,72 @@ local function GetOutlineProfileType( nOutlineId, bBottomRail) return nProfileType end +--------------------------------------------------------------------- +-- funzione che calcola gli outline precedenti e successivi nel caso di split +local function GetSplitOtherOutline( nSplitId, nSurfSplit, nOutlineId, bPrevOrNext) + + local vOutlineIds = {} + + -- verifico se devo controllare la curva precedente o successiva dell'outline corrente + local nCrv + local bPrevOutline = false + local ptRef = EgtIf( bPrevOrNext, EgtSP( nSplitId), EgtEP( nSplitId)) + local dPar = EgtCurveParamAtPoint( nOutlineId, ptRef) + local dLenInt = EgtCurveLengthAtParam( nOutlineId, dPar) + local dLenTot = EgtCurveLength( nOutlineId) + -- se l'intersezione è più vicina alla fine dell'outline devo controllare il suo next, altrimenti il suo prev + if abs( dLenTot - dLenInt) < dLenInt then + nCrv = EgtGetNext( nOutlineId) or EgtGetFirstInGroup( EgtGetParent( nOutlineId)) + else + bPrevOutline = true + nCrv = EgtGetPrev( nOutlineId) or EgtGetLastInGroup( EgtGetParent( nOutlineId)) + end + + -- recupero il geo associato e costruisco superficie test + local nPartId = FindAssociatedPart( nCrv) + local nGeoId = EgtGetFirstNameInGroup( nPartId, WIN_GEO) + local nGeoOut = EgtGetFirstNameInGroup( nGeoId, WIN_GEO_OUT) + local nGeoIn = EgtGetFirstNameInGroup( nGeoId, WIN_GEO_IN) + local nCrv1 = EgtCopyGlob( nGeoOut, nGeoId) + local nCrv2 = EgtCopyGlob( nGeoIn, nGeoId) + local nCompoTest = EgtCurveCompo( nGeoId, nCrv1) + if bPrevOutline then + -- considero solo la parte finale del pezzo + EgtTrimCurveStartAtParam( nCompoTest, 0.5) + EgtAddCurveCompoLine( nCompoTest, EgtSP( nCrv2)) + EgtTrimCurveEndAtParam( nCrv2, 0.5) + else + -- considero solo la parte iniziale del pezzo + EgtTrimCurveEndAtParam( nCompoTest, 0.5) + EgtTrimCurveStartAtParam( nCrv2, 0.5) + EgtAddCurveCompoLine( nCompoTest, EgtSP( nCrv2)) + end + EgtAddCurveCompoCurve( nCompoTest, nCrv2) + EgtCloseCurveCompo( nCompoTest) + local nSurfTest = EgtSurfFlatRegion( nGeoId, { nCompoTest}) + + -- verifico se le due regioni interferiscono + if EgtSurfFrTestExternal( nSurfSplit, nSurfTest) then + vOutlineIds = { nOutlineId} + else + -- aggiungo la curva trovata tra le curve di outline da considerare rispettando l'ordinamento + if bPrevOutline then + vOutlineIds = { nCrv, nOutlineId} + else + vOutlineIds = { nOutlineId, nCrv} + end + + -- aggiorno le info di intersezione dello split per non dover ripetere questo calcolo nelle future chiamate a GetPrevNextOutline + local vBaseOutlineId = { EgtGetInfo( vOutlineIds[1], WIN_COPY, 'i'), EgtGetInfo( vOutlineIds[2], WIN_COPY, 'i')} + EgtSetInfo( nSplitId, EgtIf( bPrevOrNext, WIN_SPLIT_STARTINTERS, WIN_SPLIT_ENDINTERS), vBaseOutlineId) + end + + EgtErase( nCompoTest) + EgtErase( nSurfTest) + + return vOutlineIds +end + --------------------------------------------------------------------- -- funzione che recupera gli outline precedenti e successivi local function GetPrevNextOutline( nProfileType, nOutlineId, nOutlineLayerId) @@ -772,7 +869,10 @@ local function GetPrevNextOutline( nProfileType, nOutlineId, nOutlineLayerId) local vPrevOutlineId = {} local vNextOutlineId = {} - if nProfileType == WIN_PRF.SPLIT then + if nProfileType ~= WIN_PRF.SPLIT then + vPrevOutlineId = { EgtGetPrev( nOutlineId) or EgtGetLastInGroup( nOutlineLayerId)} + vNextOutlineId = { EgtGetNext( nOutlineId) or EgtGetFirstInGroup( nOutlineLayerId)} + else -- se split recupero tutte le curve di base outline che lo tagliano local vPrevBaseOutlineId = EgtGetInfo( nOutlineId, WIN_SPLIT_STARTINTERS, 'vi') for i = 1, #vPrevBaseOutlineId do @@ -783,9 +883,40 @@ local function GetPrevNextOutline( nProfileType, nOutlineId, nOutlineLayerId) for i = 1, #vNextBaseOutlineId do table.insert( vNextOutlineId, EgtGetInfo( vNextBaseOutlineId[i], WIN_COPY, 'i')) end - else - vPrevOutlineId = { EgtGetPrev( nOutlineId) or EgtGetLastInGroup( nOutlineLayerId)} - vNextOutlineId = { EgtGetNext( nOutlineId) or EgtGetFirstInGroup( nOutlineLayerId)} + + -- se lo split è tagliato da una sola curva di base outline, verifico se coinvolge altre curve + if #vPrevBaseOutlineId == 1 or #vNextBaseOutlineId == 1 then + + -- costruisco una regione approssimata per il pezzo dello split + local nGrp = EgtGetParent( nOutlineId) + local nSplitProfileId = GetOutlineProfileId( nOutlineId, false) + local nRefId = EgtGetFirstNameInGroup( nSplitProfileId, WIN_REF) + local nFrameId = EgtGetFirstNameInGroup( nSplitProfileId, WIN_SECTIONFRAME) + local frProfile = EgtFR( nFrameId) + local b3Profile = EgtGetBBoxRef( nRefId, GDB_BB.STANDARD, frProfile) + local nCrvOut = EgtCopyGlob( nOutlineId, nGrp) + local nCrvIn = EgtCopyGlob( nOutlineId, nGrp) + EgtOffsetCurve( nCrvOut, b3Profile:getMax():getX()) + EgtOffsetCurve( nCrvIn, b3Profile:getMin():getX()) + EgtInvertCurve( nCrvIn) + local nCompoTest = EgtCurveCompo( nGrp, nCrvOut) + EgtAddCurveCompoLine( nCompoTest, EgtSP( nCrvIn)) + EgtAddCurveCompoCurve( nCompoTest, nCrvIn) + EgtCloseCurveCompo( nCompoTest) + local nSurfTest = EgtSurfFlatRegion( nGrp, nCompoTest) + + -- se necessario aggiorno il prev + if #vPrevBaseOutlineId == 1 and EgtGetName( vPrevBaseOutlineId[1]) ~= WIN_SPLIT then + vPrevOutlineId = GetSplitOtherOutline( nOutlineId, nSurfTest, vPrevOutlineId[1], true) + end + -- se necessario aggiorno il next + if #vNextOutlineId == 1 and EgtGetName( vNextBaseOutlineId[1]) ~= WIN_SPLIT then + vNextOutlineId = GetSplitOtherOutline( nOutlineId, nSurfTest, vNextOutlineId[1], false) + end + + EgtErase( nSurfTest) + EgtErase( nCompoTest) + end end return vPrevOutlineId, vNextOutlineId @@ -880,10 +1011,10 @@ local function CalcFrameProfiles( nPartId, nOutlineId, vPrevOutlineId, vNextOutl end -- recupero le info di pinzaggio dal profilo di estrusione - CopyInfo( nPartId, nMainProfileId, WIN_PRC_OFFY_1) - CopyInfo( nPartId, nMainProfileId, WIN_PRC_OFFZ_1) - CopyInfo( nPartId, nMainProfileId, WIN_PRC_OFFY_2) - CopyInfo( nPartId, nMainProfileId, WIN_PRC_OFFZ_2) + CopyInfo( nPartId, nMainProfileId, WIN_PRC_OFFY_1, 0) + CopyInfo( nPartId, nMainProfileId, WIN_PRC_OFFZ_1, 0) + CopyInfo( nPartId, nMainProfileId, WIN_PRC_OFFY_2, 0) + CopyInfo( nPartId, nMainProfileId, WIN_PRC_OFFZ_2, 0) return nProfileLayerId end @@ -933,6 +1064,8 @@ local function CreateFrameGeo( nOutlineId, vPrevOutlineId, vNextOutlineId, nStar EgtSetInfo( nCurrOffsetId, WIN_SEMI_PROFILE, nSemiProfileIn) -- curve left + local vPrevProfileId = EgtGetNameInGroup( nProfileLayerId, WIN_PRF_START) + local vStartCPDelta = {} for i = 1, #vPrevOutlineId do local nPrevCurveId local nPrevSemiProfile @@ -943,28 +1076,32 @@ local function CreateFrameGeo( nOutlineId, vPrevOutlineId, vNextOutlineId, nStar vtMedia = EgtSV( nOutlineId) vtMedia:rotate( Z_AX(), 90) end + table.insert( vStartCPDelta, 0) nPrevCurveId = EgtLinePVL( nGeoLayerId, EgtSP( nOutlineId), vtMedia, 3 * b3CurrProfileFrame:getDimX()) EgtInvertCurve( nPrevCurveId) else nPrevCurveId = EgtCopy( vPrevOutlineId[i], nGeoLayerId) - local nPrevProfileId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_PRF_START) if nStartPartJointType == WIN_PART_JNT.SHORT then - local sCtrIn = GetProfileCtrIn( vPrevOutlineId[i], nOutlineId, nPrevProfileId) - local dPrevCPDelta = GetDeltaProfile( nPrevProfileId, sCtrIn) + local sCtrIn = GetProfileCtrIn( vPrevOutlineId[i], nOutlineId, vPrevProfileId[i]) + local dPrevCPDelta = GetDeltaProfile( vPrevProfileId[i], sCtrIn) EgtOffsetCurve( nPrevCurveId, - dPrevCPDelta) - EgtSetInfo( nGeoLayerId, WIN_STARTCPDELTA, dPrevCPDelta) + table.insert( vStartCPDelta, dPrevCPDelta) -- ricavo il semiprofilo associato - nPrevSemiProfile = EgtGetFirstNameInGroup( nPrevProfileId, sCtrIn) + nPrevSemiProfile = EgtGetFirstNameInGroup( vPrevProfileId[i], sCtrIn) else - nPrevSemiProfile = EgtGetFirstNameInGroup( nPrevProfileId, WIN_OUT) + table.insert( vStartCPDelta, 0) + nPrevSemiProfile = EgtGetFirstNameInGroup( vPrevProfileId[i], WIN_OUT) end end EgtSetName( nPrevCurveId, WIN_GEO_LEFT) EgtSetInfo( nPrevCurveId, WIN_SEMI_PROFILE, nPrevSemiProfile) EgtRelocateGlob( nPrevCurveId, nGeoLayerId, GDB_IN.LAST_SON) end + EgtSetInfo( nGeoLayerId, WIN_STARTCPDELTA, vStartCPDelta) -- curve right + local vNextProfileId = EgtGetNameInGroup( nProfileLayerId, WIN_PRF_END) + local vNextCPDelta = {} for i = 1, #vNextOutlineId do local nNextCurveId local nNextSemiProfile @@ -975,29 +1112,31 @@ local function CreateFrameGeo( nOutlineId, vPrevOutlineId, vNextOutlineId, nStar vtMedia = EgtEV( nOutlineId) vtMedia:rotate(Z_AX(), 90) end + table.insert( vNextCPDelta, 0) nNextCurveId = EgtLinePVL( nGeoLayerId, EgtEP( nOutlineId), vtMedia, 3 * b3CurrProfileFrame:getDimX()) else nNextCurveId = EgtCopy( vNextOutlineId[i], nGeoLayerId) - local nNextProfileId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_PRF_END) if nEndPartJointType == WIN_PART_JNT.SHORT then - local sCtrIn = GetProfileCtrIn( vNextOutlineId[i], nOutlineId, nNextProfileId) - local dNextCPDelta = GetDeltaProfile( nNextProfileId, sCtrIn) + local sCtrIn = GetProfileCtrIn( vNextOutlineId[i], nOutlineId, vNextProfileId[i]) + local dNextCPDelta = GetDeltaProfile( vNextProfileId[i], sCtrIn) EgtOffsetCurve( nNextCurveId, - dNextCPDelta) - EgtSetInfo( nGeoLayerId, WIN_ENDCPDELTA, dNextCPDelta) + table.insert( vNextCPDelta, dNextCPDelta) -- ricavo il semiprofilo associato - nNextSemiProfile = EgtGetFirstNameInGroup( nNextProfileId, sCtrIn) + nNextSemiProfile = EgtGetFirstNameInGroup( vNextProfileId[i], sCtrIn) else - nNextSemiProfile = EgtGetFirstNameInGroup( nNextProfileId, WIN_OUT) + table.insert( vNextCPDelta, 0) + nNextSemiProfile = EgtGetFirstNameInGroup( vNextProfileId[i], WIN_OUT) end end EgtSetName( nNextCurveId, WIN_GEO_RIGHT) EgtSetInfo( nNextCurveId, WIN_SEMI_PROFILE, nNextSemiProfile) EgtRelocateGlob( nNextCurveId, nCurrOffsetId, GDB_IN.BEFORE) end - + EgtSetInfo( nGeoLayerId, WIN_ENDCPDELTA, vNextCPDelta) + -- trim delle curve - TrimAndOrientOrderedCurveLayer( nGeoLayerId) - + TrimAndOrientOrderedCurveLayer( nGeoLayerId, false) + -- salvo spessore serramento nella curva out local dGeoWidth = b3CurrProfileFrame:getDimX() EgtSetInfo( nCurrCurveId, WIN_GEOWIDTH, dGeoWidth) @@ -1043,7 +1182,7 @@ end --------------------------------------------------------------------- -- funzione che calcola l'ingombro dei pezzi del telaio -local function CalcFrameGeo( nPartId, nOutlineId, nOutlineLayerId, nProfileType) +local function CalcFrameGeo( nPartId, nOutlineId, nOutlineCrvNbr, nOutlineLayerId, nProfileType) -- creo layer per ingombro local nGeoLayerId = EgtGroup( nPartId) @@ -1055,35 +1194,39 @@ local function CalcFrameGeo( nPartId, nOutlineId, nOutlineLayerId, nProfileType) -- recupero il tipo di giunzioni local nStartJointType local nEndJointType - if nProfileType == WIN_PRF.TOP then - nStartJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_TR, 'i') - nEndJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_TL, 'i') - elseif nProfileType == WIN_PRF.BOTTOM then - nStartJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_BL, 'i') - nEndJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_BR, 'i') - elseif nProfileType == WIN_PRF.LEFT then - nStartJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_TL, 'i') - nEndJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_BL, 'i') - elseif nProfileType == WIN_PRF.RIGHT then - nStartJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_BR, 'i') - nEndJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_TR, 'i') + if nProfileType == WIN_PRF.SPLIT or nProfileType == WIN_PRF.BOTTOMRAIL then + -- non serve settare dei valori per StartJointType ed EndJointType perchè in CalcPartJointType la loro giunzione viene settata a short else - -- nei casi di profilo BottomRail e Split non serve settare dei valori per StartJointType ed EndJointType perchè - -- in CalcPartJointType la loro giunzione viene settata a short - end - -- se pezzo non e' split, giunzione diversa da bisettrice e arco a tutto sesto oppure elementi entrambi top, forzo il tipo a bisettrice - if nProfileType ~= WIN_PRF.SPLIT and nStartJointType ~= WIN_JNT.ANGLED and - ( AreSameVectorApprox( EgtEV( vPrevOutlineId[1]), EgtSV( nOutlineId)) or EgtGetName( nOutlineId) == EgtGetName( vPrevOutlineId[1])) then + -- recupero i joints dal vettore + local vJoints = EgtGetInfo( nOutlineLayerId, WIN_JOINTS, 'vi') + nStartJointType = vJoints[nOutlineCrvNbr] + nEndJointType = vJoints[nOutlineCrvNbr + 1] or vJoints[1] + + -- se giunzione diversa da bisettrice e arco a tutto sesto oppure elementi entrambi dello stesso tipo, forzo il tipo a bisettrice + if nStartJointType ~= WIN_JNT.ANGLED and ( AreSameVectorApprox( EgtEV( vPrevOutlineId[1]), EgtSV( nOutlineId)) or EgtGetName( nOutlineId) == EgtGetName( vPrevOutlineId[1])) then nStartJointType = WIN_JNT.ANGLED - end - if nProfileType ~= WIN_PRF.SPLIT and nEndJointType ~= WIN_JNT.ANGLED and - ( AreSameVectorApprox( EgtEV( nOutlineId), EgtSV( vNextOutlineId[1])) or EgtGetName( nOutlineId) == EgtGetName( vNextOutlineId[1])) then + end + if nEndJointType ~= WIN_JNT.ANGLED and ( AreSameVectorApprox( EgtEV( nOutlineId), EgtSV( vNextOutlineId[1])) or EgtGetName( nOutlineId) == EgtGetName( vNextOutlineId[1])) then nEndJointType = WIN_JNT.ANGLED + end end - + + -- correzione per caso del triangolo + local nProfileTypeS = nProfileType + local nProfileTypeE = nProfileType + if nProfileType == WIN_PRF.TOP then + -- se lato top contro lato bottom, il lato top deve essere trattato come un left/right nel calcolo della giunzione + if EgtGetName( vPrevOutlineId[1]) == WIN_BOTTOM then + nProfileTypeS = WIN_PRF.LEFT + end + if EgtGetName( vNextOutlineId[1]) == WIN_BOTTOM then + nProfileTypeE = WIN_PRF.LEFT + end + end + -- calcolo il tipo di giunzione per la parte - local nStartPartJointType = CalcPartJointType( nProfileType, nStartJointType) - local nEndPartJointType = CalcPartJointType( nProfileType, nEndJointType) + local nStartPartJointType = CalcPartJointType( nProfileTypeS, nStartJointType) + local nEndPartJointType = CalcPartJointType( nProfileTypeE, nEndJointType) -- salvo i valori joint su outline per disegno solido e calcolo dowels EgtSetInfo( nOutlineId, WIN_STARTJOINT, nStartPartJointType) @@ -1155,6 +1298,7 @@ local function AddStartDowels( nOutlineId, nPrevOutlineId, nProfileLayerId, nDow EgtModifyCurveThickness( nDowelId, - ( dEnd - dStart)) -- setto info di lavorazione EgtSetInfo( nDowelId, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.HOLE) + EgtSetInfo( nDowelId, WIN_PRC_DWL_SIDE, WIN_PRC_DWL_SIDETYPE.IN) if bCalcSolid then -- creo solido di estrusione @@ -1203,6 +1347,10 @@ local function AddStartDowels( nOutlineId, nPrevOutlineId, nProfileLayerId, nDow EgtExtendCurveEndByLen( nLeftCopy, 200) local ptInt = EgtIP( nOutlineId, nLeftCopy, ORIG()) EgtErase( nLeftCopy) + if not ptInt then + return + end + local dParRef = EgtCurveParamAtPoint( nOutlineId, ptInt) local vtRef = EgtUV( nOutlineId, dParRef, -1) local frDest = Frame3d( ptInt, - vtRef) @@ -1229,6 +1377,7 @@ local function AddStartDowels( nOutlineId, nPrevOutlineId, nProfileLayerId, nDow EgtModifyCurveThickness( nDowelId, - ( dEnd - dStart)) -- setto info di lavorazione EgtSetInfo( nDowelId, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.HOLE) + EgtSetInfo( nDowelId, WIN_PRC_DWL_SIDE, WIN_PRC_DWL_SIDETYPE.LEFT) if bCalcSolid then -- creo solido di estrusione @@ -1295,6 +1444,7 @@ local function AddEndDowels( nOutlineId, nEndOutlineId, nProfileLayerId, nDowelL EgtModifyCurveThickness( nDowelId, - ( dEnd - dStart)) -- setto info di lavorazione EgtSetInfo( nDowelId, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.HOLE) + EgtSetInfo( nDowelId, WIN_PRC_DWL_SIDE, WIN_PRC_DWL_SIDETYPE.IN) if bCalcSolid then -- creo solido di estrusione @@ -1342,6 +1492,9 @@ local function AddEndDowels( nOutlineId, nEndOutlineId, nProfileLayerId, nDowelL EgtExtendCurveEndByLen( nRightCopy, 200) local ptInt = EgtIP( nOutlineId, nRightCopy, ORIG()) EgtErase( nRightCopy) + if not ptInt then + return + end local dParRef = EgtCurveParamAtPoint( nOutlineId, ptInt) local vtRef = EgtUV( nOutlineId, dParRef, -1) local frDest = Frame3d( ptInt, - vtRef) @@ -1368,6 +1521,7 @@ local function AddEndDowels( nOutlineId, nEndOutlineId, nProfileLayerId, nDowelL EgtModifyCurveThickness( nDowelId, - ( dEnd - dStart)) -- setto info di lavorazione EgtSetInfo( nDowelId, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.HOLE) + EgtSetInfo( nDowelId, WIN_PRC_DWL_SIDE, WIN_PRC_DWL_SIDETYPE.RIGHT) if bCalcSolid then -- creo solido di estrusione @@ -1393,6 +1547,7 @@ local function CalSplitDowel( nSplitLayerId, nOutlineId, nProfileType, nPartId) if not ptInt then return end + -- TO DO gestire il caso in cui lo split ha due intersezioni con l'outline -- se interseca, recupero il profilo dello split local nOrigSplitProfileId = GetOutlineProfileId( nSplitId, false) @@ -1408,9 +1563,15 @@ local function CalSplitDowel( nSplitLayerId, nOutlineId, nProfileType, nPartId) local nGeoLayerId = EgtGetFirstNameInGroup( nPartId, WIN_GEO) local nGeoCrvId = EgtGetFirstNameInGroup( nGeoLayerId, WIN_GEO_IN) local ptInters = EgtIP( nGeoCrvId, nSplitId, EgtSP( nSplitId)) + local sDowelRefSide = WIN_PRC_DWL_SIDETYPE.IN if not ptInters and nProfileType == WIN_PRF.SPLIT then nGeoCrvId = EgtGetFirstNameInGroup( nGeoLayerId, WIN_GEO_OUT) ptInters = EgtIP( nGeoCrvId, nSplitId, EgtSP( nSplitId)) + sDowelRefSide = WIN_PRC_DWL_SIDETYPE.OUT + end + -- se non trovo intersezione esco ( TO DO da sistemare perchè anche se non trova intersezione potrebbe essere coinvolto dai dowels dello split!) + if not ptInters then + return end -- recupero frame del profilo e lo applico a tutte le sue geometrie @@ -1484,7 +1645,8 @@ local function CalSplitDowel( nSplitLayerId, nOutlineId, nProfileType, nPartId) EgtModifyCurveThickness( nDowelId, - ( dEnd - dStart)) -- setto info di lavorazione EgtSetInfo( nDowelId, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.HOLE) - + EgtSetInfo( nDowelId, WIN_PRC_DWL_SIDE, sDowelRefSide) + if bCalcSolid then -- creo solido di estrusione local nDowelExtrusionId = EgtSurfTmByRegionExtrusion( nSolidLayerId, nDowelId, vtDowelDir * ( dEnd - dStart + 1)) @@ -1560,7 +1722,7 @@ local function CalcFrameDowels( nPartId, nOutlineId, nOutlineLayerId, nProfileTy for i = 1, #vNextOutlineId do AddEndDowels( nOutlineId, vNextOutlineId[i], nProfileLayerId, nProcLayerId, nGeoLayerId, nMainExtrusionId) end - + -- split dowels AddSplitDowels( nOutlineId, nOutlineLayerId, nPartId, nProfileType) end @@ -1577,13 +1739,14 @@ local function CalcStartEndProfileType( nProfileType, nOutlineId, vStartProfileI if nProfileType == WIN_PRF.SPLIT then local vStartBaseOutlineId = EgtGetInfo( nOutlineId, WIN_SPLIT_STARTINTERS, 'vi') - for i = 1, #vStartBaseOutlineId do + for i = 1, #vStartProfileId do local nStartId = EgtGetInfo( vStartBaseOutlineId[i], WIN_COPY, 'i') local sStartProfileType = GetProfileCtrIn( nStartId, nOutlineId, vStartProfileId[i]) table.insert( vsStartProfileType, WIN_OFST .. sStartProfileType) end + local vEndBaseOutlineId = EgtGetInfo( nOutlineId, WIN_SPLIT_ENDINTERS, 'vi') - for i = 1, #vEndBaseOutlineId do + for i = 1, #vEndProfileId do local nEndId = EgtGetInfo( vEndBaseOutlineId[i], WIN_COPY, 'i') local sEndProfileType = GetProfileCtrIn( nEndId, nOutlineId, vEndProfileId[i]) table.insert( vsEndProfileType, WIN_OFST .. sEndProfileType) @@ -1673,30 +1836,36 @@ local function CalcFrameSolid( nPartId, nOutlineId, nGeoId, nProfileType) -- b) START PROFILE + local vStartDelta = EgtGetInfo( nGeoLayerId, WIN_STARTCPDELTA, 'vd') for i = 1, #vPrevGeoId do -- posiziono il profilo Start local nRefStartProfileId = EgtGetFirstNameInGroup( vStartProfileId[i], WIN_REF) - local b3RefStartProfile = EgtGetBBoxGlob( nRefStartProfileId, GDB_BB.STANDARD) - local dStartDelta = EgtGetInfo( nGeoLayerId, WIN_STARTCPDELTA, 'd') or 0 - -- creo guida per estrusione + local b3RefStartProfile = EgtGetBBoxGlob( nRefStartProfileId, GDB_BB.STANDARD) + -- creo guida per estrusione con estensione in tangenza local nStartGuideId = EgtCopy( vPrevGeoId[i], nSolidLayerId) - EgtExtendCurveStartByLen( nStartGuideId, 2 * dGeoWidth) - EgtExtendCurveEndByLen( nStartGuideId, 2 * dGeoWidth) + if EgtGetType( nStartGuideId) == GDB_TY.CRV_LINE then + EgtExtendCurveStartByLen( nStartGuideId, 4 * dGeoWidth) + EgtExtendCurveEndByLen( nStartGuideId, 4 * dGeoWidth) + else + nStartGuideId = EgtCurveCompo( nSolidLayerId, nStartGuideId) + EgtAddCurveCompoLineTg( nStartGuideId, 4 * dGeoWidth) + EgtAddCurveCompoLineTg( nStartGuideId, 4 * dGeoWidth, false) + end -- recupero frame del profilo local nStartProfileFrameId = EgtGetFirstNameInGroup( vStartProfileId[i], WIN_SECTIONFRAME) local frStartProfile = EgtFR( nStartProfileFrameId) -- lo sposto se controprofilo - frStartProfile:move( - frStartProfile:getVersX() * dStartDelta) + frStartProfile:move( - frStartProfile:getVersX() * vStartDelta[i]) frStartProfile:invert() -- lo applico a tutte le geometrie del profilo EgtTransform( EgtGetAllInGroup( vStartProfileId[i]), frStartProfile) -- assegno come riferimento del profilo il punto start dell'outline EgtChangeGroupFrame( vStartProfileId[i], Frame3d( EgtSP( nStartGuideId), - EgtSV( nStartGuideId))) - + if bSplitInsideSplitArea then -- verifico se il suo start deriva da uno split - local nStartId = EgtGetInfo( nOutlineId, WIN_SPLIT_STARTINTERS, 'i') - local nStartSouId = nStartId + local vStartId = EgtGetInfo( nOutlineId, WIN_SPLIT_STARTINTERS, 'vi') + local nStartSouId = vStartId[i] local sStartSouName repeat nStartSouId = EgtGetInfo( nStartSouId, WIN_SOU, 'i') @@ -1704,8 +1873,8 @@ local function CalcFrameSolid( nPartId, nOutlineId, nGeoId, nProfileType) until not nStartSouId or sStartSouName == WIN_SPLIT if sStartSouName == WIN_SPLIT then -- recupero vettore tangente nel punto medio della curva di contorno - local ptMidStart = EgtMP( nStartId) - local vtMidStart = EgtMV( nStartId) + local ptMidStart = EgtMP( vStartId[i]) + local vtMidStart = EgtMV( vStartId[i]) -- recupero vettore tangente nello stesso punto della curva split originale local dMidStartOnStartSou = EgtCurveParamAtPoint( nStartSouId, ptMidStart) local vtMidStartSou = EgtUV( nStartSouId, dMidStartOnStartSou, -1) @@ -1736,19 +1905,25 @@ local function CalcFrameSolid( nPartId, nOutlineId, nGeoId, nProfileType) -- c) END PROFILE + local vEndDelta = EgtGetInfo( nGeoLayerId, WIN_ENDCPDELTA, 'vd') for i = 1, #vNextGeoId do -- posiziono il profilo End local nRefEndProfileId = EgtGetFirstNameInGroup( vEndProfileId[i], WIN_REF) local b3RefEndProfile = EgtGetBBoxGlob( nRefEndProfileId, GDB_BB.STANDARD) - local dEndDelta = EgtGetInfo( nGeoLayerId, WIN_ENDCPDELTA, 'd') or 0 -- creo guida per estrusione local nEndGuideId = EgtCopy( vNextGeoId[i], nSolidLayerId) - EgtExtendCurveStartByLen( nEndGuideId, 2 * dGeoWidth) - EgtExtendCurveEndByLen( nEndGuideId, 2 * dGeoWidth) + if EgtGetType( nEndGuideId) == GDB_TY.CRV_LINE then + EgtExtendCurveStartByLen( nEndGuideId, 4 * dGeoWidth) + EgtExtendCurveEndByLen( nEndGuideId, 4 * dGeoWidth) + else + nEndGuideId = EgtCurveCompo( nSolidLayerId, nEndGuideId) + EgtAddCurveCompoLineTg( nEndGuideId, 4 * dGeoWidth) + EgtAddCurveCompoLineTg( nEndGuideId, 4 * dGeoWidth, false) + end -- recupero frame del profilo local nEndProfileFrameId = EgtGetFirstNameInGroup( vEndProfileId[i], WIN_SECTIONFRAME) local frEndProfile = EgtFR( nEndProfileFrameId) - frEndProfile:move( - frEndProfile:getVersX() * dEndDelta) + frEndProfile:move( - frEndProfile:getVersX() * vEndDelta[i]) frEndProfile:invert() -- lo applico a tutte le geometrie del profilo EgtTransform( EgtGetAllInGroup( vEndProfileId[i]), frEndProfile) @@ -1758,8 +1933,8 @@ local function CalcFrameSolid( nPartId, nOutlineId, nGeoId, nProfileType) -- verifico se necessario ruotare di 180 gradi il profilo if bSplitInsideSplitArea then -- verifico se end deriva da split - local nEndId = EgtGetInfo( nOutlineId, WIN_SPLIT_ENDINTERS, 'i') - local nEndSouId = nEndId + local vEndId = EgtGetInfo( nOutlineId, WIN_SPLIT_ENDINTERS, 'vi') + local nEndSouId = vEndId[i] local sEndSouName repeat nEndSouId = EgtGetInfo( nEndSouId, WIN_SOU) @@ -1767,8 +1942,8 @@ local function CalcFrameSolid( nPartId, nOutlineId, nGeoId, nProfileType) until not nEndSouId or sEndSouName == WIN_SPLIT if sEndSouName == WIN_SPLIT then -- recupero vettore tangente nel punto medio della curva di contorno - local ptMidEnd = EgtMP( nEndId) - local vtMidEnd = EgtMV( nEndId) + local ptMidEnd = EgtMP( vEndId[i]) + local vtMidEnd = EgtMV( vEndId[i]) -- recupero vettore tangente nello stesso punto della curva split originale local dMidStartOnEndSou = EgtCurveParamAtPoint( nEndSouId, ptMidEnd) local vtMidEndSou = EgtUV( nEndSouId, dMidStartOnEndSou, -1) @@ -1800,7 +1975,7 @@ end --------------------------------------------------------------------- -- funzione che calcola l'ingombro dei pezzi del telaio e i loro solidi -local function CreatePartFromOutline( nAreaLayerId, nOutlineId, bBottomRail) +local function CreatePartFromOutline( nAreaLayerId, nOutlineId, nOutlineCrvNbr, bBottomRail) -- creo pezzo local nPartId = EgtGroup( GDB_ID.ROOT) @@ -1846,7 +2021,7 @@ local function CreatePartFromOutline( nAreaLayerId, nOutlineId, bBottomRail) -- ricavo il tipo di profilo local nProfileType = GetOutlineProfileType( nOutlineId, bBottomRail) -- disegno ingombro - local nGeoId = CalcFrameGeo( nPartId, nOutlineId, nOutlineLayerId, nProfileType) + local nGeoId = CalcFrameGeo( nPartId, nOutlineId, nOutlineCrvNbr, nOutlineLayerId, nProfileType) -- disegno solido if bCalcSolid then CalcFrameSolid( nPartId, nOutlineId, nGeoId, nProfileType) @@ -1933,30 +2108,6 @@ local function CreateStripGuideLines( nOutlineId, nStripId, nProfileId, nSolidLa end ---------------------------------------------------------------------- --- funzione che recupera il pezzo associato ad un outline -local function FindAssociatedPart( nOutlineId) - - local nPartId = EgtGetInfo( nOutlineId, WIN_REF_BOTTOMRAIL_PART, 'i') or EgtGetInfo( nOutlineId, WIN_REF_PART, 'i') - if not nPartId then - -- cerco la prima curva da cui deriva che ha un pezzo associato - local nBaseOutline = EgtGetInfo( nOutlineId, WIN_COPY, 'i') - while not nPartId do - -- recupero il base outline da cui deriva - nBaseOutline = EgtGetInfo( nBaseOutline, WIN_SOU, 'i') - -- verifico se ha un profilo associato ( e quindi un pezzo) - local sProfileType = EgtGetInfo( nBaseOutline, WIN_PROFILETYPE) - if sProfileType then - -- recupero l'outline associato - local nCrvId = EgtGetInfo( nBaseOutline, WIN_COPY, 'i') - nPartId = EgtGetInfo( nCrvId, WIN_REF_BOTTOMRAIL_PART, 'i') or EgtGetInfo( nCrvId, WIN_REF_PART, 'i') - end - end - end - - return nPartId -end - --------------------------------------------------------------------- -- funzione che crea gli Strip local function CreateStripFromOutline( nAreaId, nOutlineId) @@ -2000,8 +2151,8 @@ local function CreateStripFromOutline( nAreaId, nOutlineId) -- disegno guida start per lo strip trovando le intersezioni degli outline minimi e massimi tra MainStrip e StartStrip local nMainStripMinOffsetId, nMainStripMaxOffsetId = CreateStripGuideLines( nOutlineId, nMainStripId, nMainProfileId, nSolidLayerId) local nStartStripMinOffsetId, nStartStripMaxOffsetId = CreateStripGuideLines( nPrevOutlineId, nStartStripId, nStartProfileId, nSolidLayerId) - local ptStripMinStart = FindIntersectionPoint( nMainStripMinOffsetId, nStartStripMinOffsetId) - local ptStripMaxStart = FindIntersectionPoint( nMainStripMaxOffsetId, nStartStripMaxOffsetId) + local ptStripMinStart = FindIntersectionPoint( nMainStripMinOffsetId, nStartStripMinOffsetId, EgtSP( nMainStripMinOffsetId)) + local ptStripMaxStart = FindIntersectionPoint( nMainStripMaxOffsetId, nStartStripMaxOffsetId, EgtSP( nMainStripMinOffsetId)) local nStartStripGuideId = EgtLine( nSolidLayerId, ptStripMinStart, ptStripMaxStart) EgtExtendCurveStartByLen( nStartStripGuideId, 10) EgtExtendCurveEndByLen( nStartStripGuideId, 10) @@ -2024,8 +2175,8 @@ local function CreateStripFromOutline( nAreaId, nOutlineId) -- disegno guida end per lo strip trovando le intersezioni degli outline minimi e massimi tra MainStrip ed EndStrip local nEndStripMinOffsetId, nEndStripMaxOffsetId = CreateStripGuideLines( nNextOutlineId, nEndStripId, nEndProfileId, nSolidLayerId) - local ptStripMinEnd = FindIntersectionPoint( nMainStripMinOffsetId, nEndStripMinOffsetId) - local ptStripMaxEnd = FindIntersectionPoint( nMainStripMaxOffsetId, nEndStripMaxOffsetId) + local ptStripMinEnd = FindIntersectionPoint( nMainStripMinOffsetId, nEndStripMinOffsetId, EgtEP( nMainStripMinOffsetId)) + local ptStripMaxEnd = FindIntersectionPoint( nMainStripMaxOffsetId, nEndStripMaxOffsetId, EgtEP( nMainStripMaxOffsetId)) local nEndStripGuideId = EgtLine( nSolidLayerId, ptStripMinEnd, ptStripMaxEnd) EgtExtendCurveStartByLen( nEndStripGuideId, 10) EgtExtendCurveEndByLen( nEndStripGuideId, 10) @@ -2058,19 +2209,18 @@ local function CalculateAreaParts( nAreaId) if nAreaType == WIN_AREATYPES.FRAME or nAreaType == WIN_AREATYPES.SASH then -- creo pezzi per ogni outline local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_OUTLINE) - local nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) - while nOutlineId do + local vOutlines = EgtGetAllInGroup( nOutlineLayerId) + for i = 1, #vOutlines do -- creo pezzo - CreatePartFromOutline( nAreaId, nOutlineId) + CreatePartFromOutline( nAreaId, vOutlines[i], i) -- se di tipo bottom verifico se ha bottomrail - local sName = EgtGetName( nOutlineId) + local sName = EgtGetName( vOutlines[i]) if sName == WIN_BOTTOM then local bBottomRail = EgtGetInfo( nOutlineLayerId, WIN_BOTTOMRAIL, 'b') or false if bBottomRail then - CreatePartFromOutline( nAreaId, nOutlineId, true) + CreatePartFromOutline( nAreaId, vOutlines[i], i, true) end end - nOutlineId = EgtGetNext( nOutlineId) end elseif nAreaType == WIN_AREATYPES.FILL then -- creo riempimento @@ -2092,8 +2242,13 @@ local function CalculateAreaParts( nAreaId) EgtSetName( nSelectionLayerId, WIN_SPLITSELECTION) EgtSetStatus( nSelectionLayerId, GDB_ST.OFF) local nSplitPartGeoId = EgtGetFirstNameInGroup( nSplitPartId, WIN_GEO) - local vOutlineList = EgtGetAllInGroup( nSplitPartGeoId) - local nCompoId = EgtCurveCompo( nSelectionLayerId, vOutlineList, false) + -- costruisco curva semplificata a partire dai lati out e in per evitare problemi con autointersezioni del geo + local nGeoOut = EgtGetFirstNameInGroup( nSplitPartGeoId, WIN_GEO_OUT) + local nGeoIn = EgtGetFirstNameInGroup( nSplitPartGeoId, WIN_GEO_IN) + local nCompoId = EgtCurveCompo( nSelectionLayerId, nGeoOut, false) + EgtAddCurveCompoLine( nCompoId, EgtSP( nGeoIn)) + EgtAddCurveCompoCurve( nCompoId, nGeoIn, false) + EgtCloseCurveCompo( nCompoId) local nSelectionArea = EgtSurfFlatRegion( nSelectionLayerId, nCompoId) EgtSetColor( nSelectionArea, 'YELLOW') EgtSetAlpha( nSelectionArea, 10) diff --git a/Profiles/WinLib/WinCreate.lua b/Profiles/WinLib/WinCreate.lua index 530bc1a..80b9f29 100644 --- a/Profiles/WinLib/WinCreate.lua +++ b/Profiles/WinLib/WinCreate.lua @@ -63,8 +63,7 @@ end ------------------------------------- TELAIO ------------------------------------- ---------------------------------------------------------------------------------- -- funzione che crea il buco per la finestra a partire da curve generiche --- TO DO rendere i joints un vettore con un numero variabile a seconda del tipo di finestra -function WinCreate.CreateGenFrame( vFrameCrvs, nJointBL, nJointBR, nJointTL, nJointTR) +function WinCreate.CreateGenFrame( vFrameCrvs, vJoints) -- creo gruppo per telaio local nFrameAreaId = EgtGroup( GDB_ID.ROOT) EgtSetName( nFrameAreaId, WIN_AREA .. '(' .. WIN_FRAME .. ')') @@ -77,10 +76,7 @@ function WinCreate.CreateGenFrame( vFrameCrvs, nJointBL, nJointBR, nJointTL, nJo EgtRelocateGlob( vFrameCrvs[i], nAreaOutlineLayerId) end -- imposto tipo giunzioni - EgtSetInfo( nAreaOutlineLayerId, WIN_JOINT_BL, nJointBL) - EgtSetInfo( nAreaOutlineLayerId, WIN_JOINT_BR, nJointBR) - EgtSetInfo( nAreaOutlineLayerId, WIN_JOINT_TL, nJointTL) - EgtSetInfo( nAreaOutlineLayerId, WIN_JOINT_TR, nJointTR) + EgtSetInfo( nAreaOutlineLayerId, WIN_JOINTS, vJoints) return nFrameAreaId end @@ -88,104 +84,116 @@ end ---------------------------------------------------------------------------------- -- funzione che crea le curve che definiscono il telaio in base alla geometria richiesta local function CreateFrameCurves( nLayerId, nType, dWidth, dHeight, dVal) - + + -- rettangolo if nType == WIN_FRAME_TYPE.RECT then -- telaio rettangolare - local nFrameBottomId = EgtLine( nLayerId, Point3d( 0, 0, 0), Point3d( dWidth, 0, 0)) - EgtSetName( nFrameBottomId, WIN_BOTTOM) - local nFrameRightId = EgtLine( nLayerId, Point3d( dWidth, 0, 0), Point3d( dWidth, dHeight, 0)) - EgtSetName( nFrameRightId, WIN_RIGHT) - local nFrameTopId = EgtLine( nLayerId, Point3d( dWidth, dHeight, 0), Point3d( 0, dHeight, 0)) - EgtSetName( nFrameTopId, WIN_TOP) - local nFrameLeftId = EgtLine( nLayerId, Point3d( 0, dHeight, 0), Point3d( 0, 0, 0)) - EgtSetName( nFrameLeftId, WIN_LEFT) + local nBottomId = EgtLine( nLayerId, ORIG(), Point3d( dWidth, 0, 0)) + EgtSetName( nBottomId, WIN_BOTTOM) + local nRightId = EgtLine( nLayerId, Point3d( dWidth, 0, 0), Point3d( dWidth, dHeight, 0)) + EgtSetName( nRightId, WIN_RIGHT) + local nTopId = EgtLine( nLayerId, Point3d( dWidth, dHeight, 0), Point3d( 0, dHeight, 0)) + EgtSetName( nTopId, WIN_TOP) + local nLeftId = EgtLine( nLayerId, Point3d( 0, dHeight, 0), ORIG()) + EgtSetName( nLeftId, WIN_LEFT) + -- lato top inclinato elseif nType == WIN_FRAME_TYPE.CHAMFER_SIDE then -- dHeight è l'altezza del lato sx, dVal è l'altezza del lato dx - local nFrameBottomId = EgtLine( nLayerId, Point3d( 0, 0, 0), Point3d( dWidth, 0, 0)) - EgtSetName( nFrameBottomId, WIN_BOTTOM) - local nFrameRightId = EgtLine( nLayerId, Point3d( dWidth, 0, 0), Point3d( dWidth, dVal, 0)) - EgtSetName( nFrameRightId, WIN_RIGHT) - local nFrameTopId = EgtLine( nLayerId, Point3d( dWidth, dVal, 0), Point3d( 0, dHeight, 0)) - EgtSetName( nFrameTopId, WIN_TOP) - local nFrameLeftId = EgtLine( nLayerId, Point3d( 0, dHeight, 0), Point3d( 0, 0, 0)) - EgtSetName( nFrameLeftId, WIN_LEFT) - - + local nBottomId = EgtLine( nLayerId, ORIG(), Point3d( dWidth, 0, 0)) + EgtSetName( nBottomId, WIN_BOTTOM) + local nRightId = EgtLine( nLayerId, Point3d( dWidth, 0, 0), Point3d( dWidth, dVal, 0)) + EgtSetName( nRightId, WIN_RIGHT) + local nTopId = EgtLine( nLayerId, Point3d( dWidth, dVal, 0), Point3d( 0, dHeight, 0)) + EgtSetName( nTopId, WIN_TOP) + local nLeftId = EgtLine( nLayerId, Point3d( 0, dHeight, 0), ORIG()) + EgtSetName( nLeftId, WIN_LEFT) + + -- triangular arch elseif nType == WIN_FRAME_TYPE.CHAMFER then -- dHeight è l'altezza dei lati verticali, dVal è l'altezza complessiva della finestra - local nFrameBottomId = EgtLine( nLayerId, Point3d( 0, 0, 0), Point3d( dWidth, 0, 0)) - EgtSetName( nFrameBottomId, WIN_BOTTOM) - local nFrameRightId = EgtLine( nLayerId, Point3d( dWidth, 0, 0), Point3d( dWidth, dHeight, 0)) - EgtSetName( nFrameRightId, WIN_RIGHT) - local nFrameTop1Id = EgtLine( nLayerId, Point3d( dWidth, dHeight, 0), Point3d( dWidth / 2, dVal, 0)) - local nFrameTop2Id = EgtLine( nLayerId, Point3d( dWidth / 2, dVal, 0), Point3d( 0, dHeight, 0)) - EgtSetName( nFrameTop1Id, WIN_TOP) - EgtSetName( nFrameTop2Id, WIN_TOP) - local nFrameLeftId = EgtLine( nLayerId, Point3d( 0, dHeight, 0), Point3d( 0, 0, 0)) - EgtSetName( nFrameLeftId, WIN_LEFT) - + local nBottomId = EgtLine( nLayerId, ORIG(), Point3d( dWidth, 0, 0)) + EgtSetName( nBottomId, WIN_BOTTOM) + local nRightId = EgtLine( nLayerId, Point3d( dWidth, 0, 0), Point3d( dWidth, dHeight, 0)) + EgtSetName( nRightId, WIN_RIGHT) + local nTop1Id = EgtLine( nLayerId, Point3d( dWidth, dHeight, 0), Point3d( dWidth / 2, dVal, 0)) + local nTop2Id = EgtLine( nLayerId, Point3d( dWidth / 2, dVal, 0), Point3d( 0, dHeight, 0)) + EgtSetName( nTop1Id, WIN_TOP) + EgtSetName( nTop2Id, WIN_TOP) + local nLeftId = EgtLine( nLayerId, Point3d( 0, dHeight, 0), ORIG()) + EgtSetName( nLeftId, WIN_LEFT) + + -- arco a tutto sesto elseif nType == WIN_FRAME_TYPE.ROUND_ARC then - -- arco a tutto sesto - local nFrameBottomId = EgtLine( nLayerId, Point3d( 0, 0, 0), Point3d( dWidth, 0, 0)) - EgtSetName( nFrameBottomId, WIN_BOTTOM) - local nFrameRightId = EgtLine( nLayerId, Point3d( dWidth, 0, 0), Point3d( dWidth, dHeight - 0.5 * dWidth, 0)) - EgtSetName( nFrameRightId, WIN_RIGHT) - local nFrameTopId = EgtArcCPA( nLayerId, Point3d( 0.5 * dWidth, dHeight - 0.5 * dWidth, 0), Point3d( dWidth, dHeight - 0.5 * dWidth, 0), 180, 0) - EgtSetName( nFrameTopId, WIN_TOP) - local nFrameLeftId = EgtLine( nLayerId, Point3d( 0, dHeight - 0.5 * dWidth, 0), Point3d( 0, 0, 0)) - EgtSetName( nFrameLeftId, WIN_LEFT) - + local nBottomId = EgtLine( nLayerId, ORIG(), Point3d( dWidth, 0, 0)) + EgtSetName( nBottomId, WIN_BOTTOM) + local nRightId = EgtLine( nLayerId, Point3d( dWidth, 0, 0), Point3d( dWidth, dHeight - 0.5 * dWidth, 0)) + EgtSetName( nRightId, WIN_RIGHT) + local nTopId = EgtArcCPA( nLayerId, Point3d( 0.5 * dWidth, dHeight - 0.5 * dWidth, 0), Point3d( dWidth, dHeight - 0.5 * dWidth, 0), 180, 0) + EgtSetName( nTopId, WIN_TOP) + local nLeftId = EgtLine( nLayerId, Point3d( 0, dHeight - 0.5 * dWidth, 0), ORIG()) + EgtSetName( nLeftId, WIN_LEFT) + + -- arco ribassato elseif nType == WIN_FRAME_TYPE.SEGMENTAL_ARC then - -- arco ribassato -- dHeight è l'altezza dei lati verticali, dVal è l'altezza complessiva della finestra - local nFrameBottomId = EgtLine( nLayerId, Point3d( 0, 0, 0), Point3d( dWidth, 0, 0)) - EgtSetName( nFrameBottomId, WIN_BOTTOM) - local nFrameRightId = EgtLine( nLayerId, Point3d( dWidth, 0, 0), Point3d( dWidth, dHeight, 0)) - EgtSetName( nFrameRightId, WIN_RIGHT) - local nFrameTopId = EgtArc3P( nLayerId, Point3d( dWidth, dHeight, 0), Point3d( 0.5 * dWidth, dVal, 0), Point3d( 0, dHeight, 0)) - EgtSetName( nFrameTopId, WIN_TOP) - local nFrameLeftId = EgtLine( nLayerId, Point3d( 0, dHeight, 0), Point3d( 0, 0, 0)) - EgtSetName( nFrameLeftId, WIN_LEFT) - + local nBottomId = EgtLine( nLayerId, ORIG(), Point3d( dWidth, 0, 0)) + EgtSetName( nBottomId, WIN_BOTTOM) + local nRightId = EgtLine( nLayerId, Point3d( dWidth, 0, 0), Point3d( dWidth, dHeight, 0)) + EgtSetName( nRightId, WIN_RIGHT) + local nTopId = EgtArc3P( nLayerId, Point3d( dWidth, dHeight, 0), Point3d( 0.5 * dWidth, dVal, 0), Point3d( 0, dHeight, 0)) + EgtSetName( nTopId, WIN_TOP) + local nLeftId = EgtLine( nLayerId, Point3d( 0, dHeight, 0), ORIG()) + EgtSetName( nLeftId, WIN_LEFT) + + -- arco a tutto sesto elseif nType == WIN_FRAME_TYPE.POINTED_ARC then - -- arco a tutto sesto -- dHeight è l'altezza dei lati verticali, dVal è l'altezza complessiva della finestra -- verifico che le due altezze abbiano valori sensati per realizzare i due archi if dVal - dHeight < 0.5 * dWidth then return end - local nFrameBottomId = EgtLine( nLayerId, Point3d( 0, 0, 0), Point3d( dWidth, 0, 0)) - EgtSetName( nFrameBottomId, WIN_BOTTOM) - local nFrameRightId = EgtLine( nLayerId, Point3d( dWidth, 0, 0), Point3d( dWidth, dHeight, 0)) - EgtSetName( nFrameRightId, WIN_RIGHT) - local nFrameTop1Id = EgtArc2PV( nLayerId, Point3d( dWidth, dHeight, 0), Point3d( 0.5 * dWidth, dVal, 0), Y_AX()) - EgtSetName( nFrameTop1Id, WIN_TOP) - local nFrameTop2Id = EgtArc2PV( nLayerId, Point3d( 0, dHeight, 0), Point3d( 0.5 * dWidth, dVal, 0), Y_AX()) - EgtInvertCurve( nFrameTop2Id) - EgtSetName( nFrameTop2Id, WIN_TOP) - local nFrameLeftId = EgtLine( nLayerId, Point3d( 0, dHeight, 0), Point3d( 0, 0, 0)) - EgtSetName( nFrameLeftId, WIN_LEFT) - + local nBottomId = EgtLine( nLayerId, ORIG(), Point3d( dWidth, 0, 0)) + EgtSetName( nBottomId, WIN_BOTTOM) + local nRightId = EgtLine( nLayerId, Point3d( dWidth, 0, 0), Point3d( dWidth, dHeight, 0)) + EgtSetName( nRightId, WIN_RIGHT) + local nTop1Id = EgtArc2PV( nLayerId, Point3d( dWidth, dHeight, 0), Point3d( 0.5 * dWidth, dVal, 0), Y_AX()) + EgtSetName( nTop1Id, WIN_TOP) + local nTop2Id = EgtArc2PV( nLayerId, Point3d( 0, dHeight, 0), Point3d( 0.5 * dWidth, dVal, 0), Y_AX()) + EgtInvertCurve( nTop2Id) + EgtSetName( nTop2Id, WIN_TOP) + local nLeftId = EgtLine( nLayerId, Point3d( 0, dHeight, 0), ORIG()) + EgtSetName( nLeftId, WIN_LEFT) + + -- triangolo elseif nType == WIN_FRAME_TYPE.TRG then - local nFrameBottomId = EgtLine( nLayerId, Point3d( 0, 0, 0), Point3d( dWidth, 0, 0)) - EgtSetName( nFrameBottomId, WIN_BOTTOM) - local nFrameRightId = EgtLine( nLayerId, Point3d( dWidth, 0, 0), Point3d( dVal, dHeight, 0)) - EgtSetName( nFrameRightId, WIN_RIGHT) - local nFrameLeftId = EgtLine( nLayerId, Point3d( dVal, dHeight, 0), Point3d( 0, 0, 0)) - EgtSetName( nFrameLeftId, WIN_LEFT) + local nBottomId = EgtLine( nLayerId, ORIG(), Point3d( dWidth, 0, 0)) + EgtSetName( nBottomId, WIN_BOTTOM) + local nEdge1Id = EgtLine( nLayerId, Point3d( dWidth, 0, 0), Point3d( dVal, dHeight, 0)) + local nEdge2Id = EgtLine( nLayerId, Point3d( dVal, dHeight, 0), ORIG()) + -- un lato verticale è right/left, un lato inclinato è top + if dVal < GEO.EPS_SMALL then + EgtSetName( nEdge1Id, WIN_TOP) + EgtSetName( nEdge2Id, WIN_LEFT) + elseif abs( dVal - dWidth) < GEO.EPS_SMALL then + EgtSetName( nEdge1Id, WIN_RIGHT) + EgtSetName( nEdge2Id, WIN_TOP) + else + EgtSetName( nEdge1Id, WIN_TOP) + EgtSetName( nEdge2Id, WIN_TOP) + end end end ---------------------------------------------------------------------------------- -- funzione che crea il telaio a partire da una specifica geometria ( rettangolo, chamfer...) -function WinCreate.CreateFrame( nType, nJointBL, nJointBR, nJointTL, nJointTR, dWidth, dHeight, dHeight2) +function WinCreate.CreateFrame( nType, vJoints, dWidth, dHeight, dHeight2) -- creo un gruppo temporaneo per le curve di outline local nTmpLay = EgtGroup( GDB_ID.ROOT) -- disegno outline CreateFrameCurves( nTmpLay, nType, dWidth, dHeight, dHeight2) - local nFrameAreaId = WinCreate.CreateGenFrame( EgtGetAllInGroup( nTmpLay), nJointBL, nJointBR, nJointTL, nJointTR) + local nFrameAreaId = WinCreate.CreateGenFrame( EgtGetAllInGroup( nTmpLay), vJoints) EgtErase( nTmpLay) return nFrameAreaId @@ -195,7 +203,7 @@ end -------------------------------------- ANTA -------------------------------------- ---------------------------------------------------------------------------------- -- funzione che aggiunge una anta -function WinCreate.AddSash( nAreaId, nJointBL, nJointBR, nJointTR, nJointTL, nSashType) +function WinCreate.AddSash( nAreaId, vJoints, nSashType) -- creo nuova area local nSashAreaId = EgtGroup( nAreaId) EgtSetName( nSashAreaId, WIN_AREA .. '(' .. WIN_SASH .. ')') @@ -215,10 +223,7 @@ function WinCreate.AddSash( nAreaId, nJointBL, nJointBR, nJointTR, nJointTL, nSa nAreaOutlineId = EgtGetNext( nAreaOutlineId) end -- imposto tipo giunzioni - EgtSetInfo( nAreaOutlineLayerId, WIN_JOINT_BL, nJointBL) - EgtSetInfo( nAreaOutlineLayerId, WIN_JOINT_BR, nJointBR) - EgtSetInfo( nAreaOutlineLayerId, WIN_JOINT_TL, nJointTL) - EgtSetInfo( nAreaOutlineLayerId, WIN_JOINT_TR, nJointTR) + EgtSetInfo( nAreaOutlineLayerId, WIN_JOINTS, vJoints) -- imposto tipo di anta se presente if nSashType then EgtSetInfo( nSashAreaId, WIN_SASHTYPE, nSashType) @@ -250,10 +255,8 @@ function WinCreate.AddFill( nAreaId, FillType) nAreaOutlineId = EgtGetNext( nAreaOutlineId) end -- rimuovo eventuali info di giunzioni - EgtRemoveInfo( nAreaOutlineLayerId, WIN_JOINT_BL) - EgtRemoveInfo( nAreaOutlineLayerId, WIN_JOINT_BR) - EgtRemoveInfo( nAreaOutlineLayerId, WIN_JOINT_TL) - EgtRemoveInfo( nAreaOutlineLayerId, WIN_JOINT_TR) + EgtRemoveInfo( nAreaOutlineLayerId, WIN_JOINTS) + -- imposto tipo di fill EgtSetInfo( nFillAreaId, WIN_FILLTYPE, FillType) return nFillAreaId @@ -355,117 +358,33 @@ function WinCreate.AddSplits( nAreaLayerId, SplitType, MeasureType, PositionList end ---------------------------------------------------------------------------------- --- funzione che crea un taglio split da una curva generica -function WinCreate.AddGenSplit( nAreaLayerId, nSplitId, nSplitType) - -- se area nulla diventa di tipo split - local nAreaType = EgtGetInfo( nAreaLayerId, WIN_AREATYPE, 'i') - if nAreaType == WIN_AREATYPES.NULL then - EgtSetInfo( nAreaLayerId, WIN_AREATYPE, WIN_AREATYPES.SPLIT) - end - -- creo layer per split - local nSplitLayerId = EgtGroup( nAreaLayerId) - EgtSetName( nSplitLayerId, WIN_BASESPLIT) - -- sposto curva split nel layer - EgtRelocateGlob( nSplitId, nSplitLayerId) - local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaLayerId, WIN_AREAOUTLINE) - local b3OutlineLayer = EgtGetBBox( nOutlineLayerId, GDB_BB.STANDARD) - -- allungo curva split per cercare intersezioni - EgtExtendCurveStartByLen( nSplitId, 10) - EgtExtendCurveEndByLen( nSplitId, 10) - -- recupero lista intersezioni - local OutlineInters = {} - local nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) - while nOutlineId do - local sName = EgtGetName( nOutlineId) - -- verifico se ci siano intersezioni con questo outline - local ptInters = EgtIP( nSplitId, nOutlineId, EgtSP( nSplitId)) - if ptInters then - table.insert( OutlineInters, { Id = nOutlineId, IntersPoint = ptInters}) - end - nOutlineId = EgtGetNext( nOutlineId) - end - local ptStartSplit = EgtSP( nSplitId) - local ptEndSplit = EgtEP( nSplitId) - local StartInters - local EndInters - for nIndex = 1, #OutlineInters do - local CurrOutInters = OutlineInters[nIndex] - CurrOutInters.StartDistance = dist( CurrOutInters.IntersPoint, ptStartSplit) - CurrOutInters.EndDistance = dist( CurrOutInters.IntersPoint, ptEndSplit) - if not StartInters or CurrOutInters.StartDistance < StartInters.StartDistance then - StartInters = CurrOutInters - end - if not EndInters or CurrOutInters.EndDistance < EndInters.EndDistance then - EndInters = CurrOutInters - end - end - -- accorcio la curva split su intersezione outline - local dStartSplitInters = EgtCurveParamAtPoint( nSplitId, StartInters.IntersPoint) - EgtTrimCurveStartAtParam( nSplitId, dStartSplitInters) - local dEndSplitInters = EgtCurveParamAtPoint( nSplitId, EndInters.IntersPoint) - EgtTrimCurveEndAtParam( nSplitId, dEndSplitInters) +-- funzione che assegna il nome alla curva di split nella sottoarea in base alla sua direzione +local function SetSplitName( nSplitId) - -- sistemo le info di intersezione - local dPar1 = EgtCurveParamAtPoint( StartInters.Id, StartInters.IntersPoint, 100 * GEO.EPS_SMALL) - local _, dParE1 = EgtCurveDomain( StartInters.Id) - if dPar1 < GEO.EPS_SMALL then - -- intersezione coinvolge anche curva precedente - local nOther = EgtGetPrev( StartInters.Id) or EgtGetLastInGroup( nOutlineLayerId) - EgtSetInfo( nSplitId, WIN_SPLIT_STARTINTERS, { nOther, StartInters.Id}) - elseif abs( dPar1 - dParE1) < GEO.EPS_SMALL then - -- intersezione coinvolge anche curva successiva - local nOther = EgtGetNext( StartInters.Id) or EgtGetFirstInGroup( nOutlineLayerId) - EgtSetInfo( nSplitId, WIN_SPLIT_STARTINTERS, { StartInters.Id, nOther}) + local vtMedia = ( ( EgtEV( nSplitId) - EgtSV( nSplitId)) / 2) + if not vtMedia:normalize() then + vtMedia = EgtSV( nSplitId) + end + if abs( vtMedia:getX()) > abs( vtMedia:getY()) then + if vtMedia:getX() > 0 then + EgtSetName( nSplitId, WIN_BOTTOM) + else + EgtSetName( nSplitId, WIN_TOP) + end else - EgtSetInfo( nSplitId, WIN_SPLIT_STARTINTERS, { StartInters.Id}) - end - - local dPar2 = EgtCurveParamAtPoint( EndInters.Id, EndInters.IntersPoint, 100 * GEO.EPS_SMALL) - local _, dParE2 = EgtCurveDomain( EndInters.Id) - if dPar2 < GEO.EPS_SMALL then - -- intersezione coinvolge anche curva precedente - local nOther = EgtGetPrev( EndInters.Id) or EgtGetLastInGroup( nOutlineLayerId) - EgtSetInfo( nSplitId, WIN_SPLIT_ENDINTERS, { nOther, EndInters.Id}) - elseif abs( dPar2 - dParE2) < GEO.EPS_SMALL then - -- intersezione coinvolge anche curva successiva - local nOther = EgtGetNext( EndInters.Id) or EgtGetFirstInGroup( nOutlineLayerId) - EgtSetInfo( nSplitId, WIN_SPLIT_ENDINTERS, { EndInters.Id, nOther}) - else - EgtSetInfo( nSplitId, WIN_SPLIT_ENDINTERS, { EndInters.Id}) - end - - -- assegno nome profilo - EgtSetName( nSplitId, WIN_SPLIT) - -- creo aree - local nArea1Id, nArea2Id = WinCreate.CreateAreaFromSplit( nAreaLayerId, nSplitId) - -- verifico se discende da Frame - local nParentAreaId = nAreaLayerId - local nParentAreaType = nAreaType - -- recupero parent fino a trovare frame o sash - while nParentAreaType ~= WIN_AREATYPES.FRAME and nParentAreaType ~= WIN_AREATYPES.SASH do - nParentAreaId = EgtGetParent( nParentAreaId) - nParentAreaType = EgtGetInfo( nParentAreaId, WIN_AREATYPE, 'i') - end - if nParentAreaType == WIN_AREATYPES.FRAME and nSplitType then - -- imposto tipo di split - EgtSetInfo( nSplitLayerId, WIN_SPLITTYPE, nSplitType) - -- EgtSetInfo( nSplitLayerId, WIN_SPLITTYPE, EgtIf( not nSplitType, WIN_SPLITTYPES.MULLION, nSplitType)) - end - return nArea1Id, nArea2Id -end - ----------------------------------------------------------------------------------- --- funzione che crea tagli split da curve generiche -function WinCreate.AddGenSplits( nAreaLayerId, SplitList) - for nIndex = 1, #SplitList do - WinCreate.AddSplit( nAreaLayerId, SplitList[nIndex]) + if vtMedia:getY() > 0 then + EgtSetName( nSplitId, WIN_RIGHT) + else + EgtSetName( nSplitId, WIN_LEFT) + end end end ---------------------------------------------------------------------------------- -- funzione che crea le aree da un taglio split -function WinCreate.CreateAreaFromSplit( nAreaLayerId, nSplitId) - -- creo layer per le due aree +local function CreateAreaFromSplit( nAreaLayerId, nCompo, nSplitId, dPar1, dPar2, vOutlineCrvs) + + -- creo layer per le due sottoaree local nArea1Id = EgtGroup( nAreaLayerId) EgtSetName( nArea1Id , WIN_AREA1) EgtSetInfo( nArea1Id, WIN_AREATYPE, WIN_AREATYPES.NULL) @@ -476,120 +395,52 @@ function WinCreate.CreateAreaFromSplit( nAreaLayerId, nSplitId) EgtSetInfo( nArea2Id, WIN_AREATYPE, WIN_AREATYPES.NULL) local nArea2OutlineLayerId = EgtGroup( nArea2Id) EgtSetName( nArea2OutlineLayerId , WIN_AREAOUTLINE) - local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaLayerId, WIN_AREAOUTLINE) - local nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) - local nInters = 0 - while nOutlineId and nInters ~= 3 do - local sName = EgtGetName( nOutlineId) - -- calcolo intersezioni con questo outline - local ptInters = EgtIP( nSplitId, nOutlineId, EgtSP( nSplitId)) - if ptInters then - if nInters == 0 then - -- trovato primo punto di intersezione - inizio area 2 - local dStartIntersParam = EgtCurveParamAtPoint( nOutlineId, ptInters) - local _, dParE = EgtCurveDomain( nOutlineId) - if abs( dStartIntersParam - dParE) < GEO.EPS_SMALL then - -- se intersezione nel punto finale della curva la ignoro, la ritroverò analizzando l'outline successivo - else - nInters = 1 - local nCopyId = EgtCopy( nOutlineId, nArea2OutlineLayerId) - EgtSetInfo( nCopyId, WIN_SOU, nOutlineId) - EgtRemoveInfo( nCopyId, WIN_CHILD) - AddInfo( nOutlineId, WIN_CHILD, nCopyId) - EgtTrimCurveStartAtParam( nCopyId, dStartIntersParam) - end - elseif nInters == 1 then - -- trovato secondo punto di intersezione - fine area 2 - nInters = 2 - local nCopyId = EgtCopy( nOutlineId, nArea2OutlineLayerId) - EgtSetInfo( nCopyId, WIN_SOU, nOutlineId) - 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) - 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 - EgtInvertCurve( nSplitCopyId) - end - -- verifico direzione per dare nome - local vtMedia = ( ( EgtEV( nSplitCopyId) - EgtSV( nSplitCopyId)) / 2) - if not vtMedia:normalize() then - vtMedia = EgtSV( nSplitCopyId) - end - if abs( vtMedia:getX()) > abs( vtMedia:getY()) then - EgtSetName( nSplitCopyId, WIN_BOTTOM) - else - EgtSetName( nSplitCopyId, WIN_LEFT) - end - -- inizio area 1 - local _, dEnd = EgtCurveDomain( nOutlineId) - if abs( dEndIntersParam - dEnd) < GEO.EPS_SMALL then - -- l'intersezione è sul punto finale della curva di outline, quindi è la curva successiva che dà inizio all'area 1 - nOutlineId = EgtGetNext( nOutlineId) or EgtGetFirstInGroup( nOutlineLayerId) - end - nCopyId = EgtCopy( nOutlineId, nArea1OutlineLayerId) - EgtSetInfo( nCopyId, WIN_SOU, nOutlineId) - EgtRemoveInfo( nCopyId, WIN_CHILD) - AddInfo( nOutlineId, WIN_CHILD, nCopyId) - local dStartIntersParam = EgtCurveParamAtPoint( nCopyId, ptInters) - EgtTrimCurveStartAtParam( nCopyId, dStartIntersParam) - elseif nInters == 2 then - -- trovato secondo punto di intersezione - fine area 1 - nInters = 3 - local nCopyId = EgtCopy( nOutlineId, nArea1OutlineLayerId) - EgtSetInfo( nCopyId, WIN_SOU, nOutlineId) - 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) - 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 - EgtInvertCurve( nSplitCopyId) - end - -- verifico direzione per dare nome - local vtMedia = ( ( EgtEV( nSplitCopyId) - EgtSV( nSplitCopyId)) / 2) - if not vtMedia:normalize() then - vtMedia = EgtSV( nSplitCopyId) - end - if abs( vtMedia:getX()) > abs( vtMedia:getY()) then - EgtSetName( nSplitCopyId, WIN_TOP) - else - EgtSetName( nSplitCopyId, WIN_RIGHT) - end + + -- ad ogni sottoarea associo la porzione di curva composita corrispondente + local nCrv1 = EgtCopyGlob( nCompo, nArea1OutlineLayerId) + local nCrv2 = EgtCopyGlob( nCompo, nArea2OutlineLayerId) + EgtTrimCurveStartEndAtParam( nCrv1, dPar2, dPar1) + EgtTrimCurveStartEndAtParam( nCrv2, dPar1, dPar2) + + -- copio curva di split + local nSplitId1 = EgtCopyGlob( nSplitId, nArea1OutlineLayerId) + local nSplitId2 = EgtCopyGlob( nSplitId, nArea2OutlineLayerId) + -- verifico se necessaria inversione + if AreSamePointApprox( EgtSP( nSplitId1), EgtSP( nCrv1)) then + EgtInvertCurve( nSplitId1) + end + if AreSamePointApprox( EgtSP( nSplitId2), EgtSP( nCrv2)) then + EgtInvertCurve( nSplitId2) + end + -- assegno il nome in base alla direzione + SetSplitName( nSplitId1) + SetSplitName( nSplitId2) + -- assengo le info di source e child + EgtSetInfo( nSplitId, WIN_CHILD, { nSplitId1, nSplitId2}) + EgtSetInfo( nSplitId1, WIN_SOU, nSplitId) + EgtSetInfo( nSplitId2, WIN_SOU, nSplitId) + + -- spezzo le curve composite per riottenere le curve originarie di partenza + local nFirst1, nCnt1 = EgtExplodeCurveCompo( nCrv1) + local nFirst2, nCnt2 = EgtExplodeCurveCompo( nCrv2) + -- assegno nome e info + local vCrvs = EgtTableFill( nFirst1, nCnt1) + EgtTableAdd( vCrvs, nFirst2, nCnt2) + for i = 1, #vCrvs do + -- ricavo la curva di outline originale da cui deriva + local ptM = EgtMP( vCrvs[i]) + for j = 1, #vOutlineCrvs do + if EgtCurveParamAtPoint( vOutlineCrvs[j], ptM, 100 * GEO.EPS_SMALL) then + -- ne prendo il nome + EgtSetName( vCrvs[i], EgtGetName( vOutlineCrvs[j])) + -- assegno le info di child e source + EgtSetInfo( vCrvs[i], WIN_SOU, vOutlineCrvs[j]) + AddInfo( vOutlineCrvs[j], WIN_CHILD, vCrvs[i]) + break end - elseif nInters == 1 then - -- copio nel profilo 2 - local nCopyId = EgtCopy( nOutlineId, nArea2OutlineLayerId) - EgtSetInfo( nCopyId, WIN_SOU, nOutlineId) - 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) - EgtRemoveInfo( nCopyId, WIN_CHILD) - AddInfo( nOutlineId, WIN_CHILD, nCopyId) - end - -- aggiorno indice - nOutlineId = EgtGetNext( nOutlineId) - -- se arrivato alla fine riparto - if not nOutlineId then - nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) end end + -- scorro pezzi del primo e secondo outline per avere bottom come primo local nFirstInAreaId = EgtGetFirstInGroup( nArea1OutlineLayerId) local sFirstInAreaName = EgtGetName( nFirstInAreaId) @@ -605,9 +456,125 @@ function WinCreate.CreateAreaFromSplit( nAreaLayerId, nSplitId) nFirstInAreaId = EgtGetFirstInGroup( nArea2OutlineLayerId) sFirstInAreaName = EgtGetName( nFirstInAreaId) end + return nArea1Id, nArea2Id end +---------------------------------------------------------------------------------- +-- funzione che crea un taglio split da una curva generica +function WinCreate.AddGenSplit( nAreaLayerId, nSplitId, nSplitType) + -- se area nulla diventa di tipo split + local nAreaType = EgtGetInfo( nAreaLayerId, WIN_AREATYPE, 'i') + if nAreaType == WIN_AREATYPES.NULL then + EgtSetInfo( nAreaLayerId, WIN_AREATYPE, WIN_AREATYPES.SPLIT) + end + -- creo layer per split + local nSplitLayerId = EgtGroup( nAreaLayerId) + EgtSetName( nSplitLayerId, WIN_BASESPLIT) + -- sposto curva split nel layer + EgtRelocateGlob( nSplitId, nSplitLayerId) + -- assegno nome profilo + EgtSetName( nSplitId, WIN_SPLIT) + + -- verifico se devo impostare tipo di split ( solo se deriva da tipo frame) + if nSplitType then + local nParentAreaId = nAreaLayerId + local nParentAreaType = nAreaType + -- recupero parent fino a trovare frame o sash + while nParentAreaType ~= WIN_AREATYPES.FRAME and nParentAreaType ~= WIN_AREATYPES.SASH do + nParentAreaId = EgtGetParent( nParentAreaId) + nParentAreaType = EgtGetInfo( nParentAreaId, WIN_AREATYPE, 'i') + end + if nParentAreaType == WIN_AREATYPES.FRAME then + -- imposto tipo di split + EgtSetInfo( nSplitLayerId, WIN_SPLITTYPE, nSplitType) + end + end + + -- Ricerca delle intersezioni : + -- creo una curva composita a partire da tutte le curve di outline + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaLayerId, WIN_AREAOUTLINE) + local vOutlineCrvs = EgtGetAllInGroup( nOutlineLayerId) + local nCompo = EgtCurveCompo( nSplitLayerId, vOutlineCrvs, false) + -- allungo curva split per cercare intersezioni + EgtExtendCurveStartByLen( nSplitId, 10) + EgtExtendCurveEndByLen( nSplitId, 10) + -- trovo intersezioni tra composita e lo split + local nFirst, nPntCnt, nCrvCnt = EgtCurveCurveInters( nCompo, nSplitId, nSplitLayerId) + if nCrvCnt ~= 0 or nPntCnt ~= 2 then + -- errore + return + end + -- recupero i due punti di intersezione + local pt1 = EgtSP( nFirst) + local pt2 = EgtSP( nFirst + 1) + EgtErase( { nFirst, nFirst + 1}) + + -- recupero i parametri di intersezione sulla curva di split + local dSplitParS = EgtCurveParamAtPoint( nSplitId, pt1, 100 * GEO.EPS_SMALL) + local dSplitParE = EgtCurveParamAtPoint( nSplitId, pt2, 100 * GEO.EPS_SMALL) + -- recupero i parametri di intersezione sulla curva composita + local dPar1 = EgtCurveParamAtPoint( nCompo, pt1, 100 * GEO.EPS_SMALL) + local dPar2 = EgtCurveParamAtPoint( nCompo, pt2, 100 * GEO.EPS_SMALL) + + -- ricavo i parametri di intersezione legati a start ed end dello split + local dParCrvS = dPar1 + local dParCrvE = dPar2 + if dSplitParS > dSplitParE then + dSplitParS, dSplitParE = dSplitParE, dSplitParS + dParCrvS, dParCrvE = dParCrvE, dParCrvS + end + + -- taglio la curva di split nei punti di intersezione + EgtTrimCurveStartEndAtParam( nSplitId, dSplitParS, dSplitParE) + + -- setto info per intersezione start + -- se il parametro è intero allora l'intersezione coinvolge due curve successive + if abs( dParCrvS - ceil( dParCrvS)) < GEO.EPS_SMALL then + local nCrv = vOutlineCrvs[ ceil( dParCrvS) + 1] + local nOther = EgtGetPrev( nCrv) or EgtGetLastInGroup( nOutlineLayerId) + EgtSetInfo( nSplitId, WIN_SPLIT_STARTINTERS, { nOther, nCrv}) + elseif abs( dParCrvS - floor( dParCrvS)) < GEO.EPS_SMALL then + local nCrv = vOutlineCrvs[ floor( dParCrvS) + 1] + local nOther = EgtGetPrev( nCrv) or EgtGetLastInGroup( nOutlineLayerId) + EgtSetInfo( nSplitId, WIN_SPLIT_STARTINTERS, { nOther, nCrv}) + else + -- se il parametro non è intero allora l'intersezione coinvolge una sola curva + local nCrv = vOutlineCrvs[ floor( dParCrvS) + 1] + EgtSetInfo( nSplitId, WIN_SPLIT_STARTINTERS, { nCrv}) + end + + -- setto info per intersezione end + if abs( dParCrvE - ceil( dParCrvE)) < GEO.EPS_SMALL then + local nCrv = vOutlineCrvs[ ceil( dParCrvE) + 1] + local nOther = EgtGetPrev( nCrv) or EgtGetLastInGroup( nOutlineLayerId) + EgtSetInfo( nSplitId, WIN_SPLIT_ENDINTERS, { nOther, nCrv}) + elseif abs( dParCrvE - floor( dParCrvE)) < GEO.EPS_SMALL then + local nCrv = vOutlineCrvs[ floor( dParCrvE) + 1] + local nOther = EgtGetPrev( nCrv) or EgtGetLastInGroup( nOutlineLayerId) + EgtSetInfo( nSplitId, WIN_SPLIT_ENDINTERS, { nOther, nCrv}) + else + local nCrv = vOutlineCrvs[ floor( dParCrvE) + 1] + EgtSetInfo( nSplitId, WIN_SPLIT_ENDINTERS, { nCrv}) + end + + -- creo sottoaree + local nArea1, nArea2 = CreateAreaFromSplit( nAreaLayerId, nCompo, nSplitId, dPar1, dPar2, vOutlineCrvs) + + EgtErase( nCompo) + + return nArea1, nArea2 + +end + +---------------------------------------------------------------------------------- +-- funzione che crea tagli split da curve generiche +function WinCreate.AddGenSplits( nAreaLayerId, SplitList) + for nIndex = 1, #SplitList do + WinCreate.AddSplit( nAreaLayerId, SplitList[nIndex]) + end +end + ---------------------------------------------------------------------------------- ---------------------------------- BOTTOMRAIL ------------------------------------ ---------------------------------------------------------------------------------- @@ -617,7 +584,6 @@ function WinCreate.AddBottomRail( nAreaId) if nAreaType == WIN_AREATYPES.FRAME then -- recupero l'outline bottom local nBaseOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_AREAOUTLINE) - -- local nBottomOutlineId = EgtGetFirstNameInGroup( nBaseOutlineLayerId, WIN_BOTTOM) EgtSetInfo( nBaseOutlineLayerId, WIN_BOTTOMRAIL, 1) end end diff --git a/Profiles/WinLib/WinManageProject.lua b/Profiles/WinLib/WinManageProject.lua index 208c809..b0c34a3 100644 --- a/Profiles/WinLib/WinManageProject.lua +++ b/Profiles/WinLib/WinManageProject.lua @@ -168,15 +168,15 @@ local function ConvertTableToGeometry( AreaTable, nAreaId) local nFrameLeftId = EgtGetNext(nFrameTopId) EgtSetName( nFrameLeftId, WIN_LEFT) -- creo frame - nAreaId = WinCreate.CreateGenFrame( {nFrameBottomId, nFrameRightId, nFrameTopId, nFrameLeftId}, AreaTable[JWD_JOINT][JWD_JOINT_BL], AreaTable[JWD_JOINT][JWD_JOINT_BR], AreaTable[JWD_JOINT][JWD_JOINT_TR], AreaTable[JWD_JOINT][JWD_JOINT_TL]) + nAreaId = WinCreate.CreateGenFrame( {nFrameBottomId, nFrameRightId, nFrameTopId, nFrameLeftId}, {AreaTable[JWD_JOINT][JWD_JOINT_BL], AreaTable[JWD_JOINT][JWD_JOINT_BR], AreaTable[JWD_JOINT][JWD_JOINT_TR], AreaTable[JWD_JOINT][JWD_JOINT_TL]}) -- elimino contorno frame EgtErase( nDrawFramePartId) -- se BottomRail if AreaTable[JWD_BOTTOM_RAIL] and AreaTable[JWD_BOTTOM_RAIL] == 1 then - WinCreate.AddBottomRail( nAreaId) + WinCreate.AddBottomRail( nAreaId) end elseif AreaTable[JWD_AREA_TYPE] == WIN_AREATYPES.SASH then - nAreaId = WinCreate.AddSash( nAreaId, AreaTable[JWD_JOINT][JWD_JOINT_BL], AreaTable[JWD_JOINT][JWD_JOINT_BR], AreaTable[JWD_JOINT][JWD_JOINT_TR], AreaTable[JWD_JOINT][JWD_JOINT_TL], AreaTable[JWD_SASH_TYPE]) + nAreaId = WinCreate.AddSash( nAreaId, {AreaTable[JWD_JOINT][JWD_JOINT_BL], AreaTable[JWD_JOINT][JWD_JOINT_BR], AreaTable[JWD_JOINT][JWD_JOINT_TR], AreaTable[JWD_JOINT][JWD_JOINT_TL]}, AreaTable[JWD_SASH_TYPE]) elseif AreaTable[JWD_AREA_TYPE] == WIN_AREATYPES.FILL then WinCreate.AddFill( nAreaId, AreaTable[JWD_FILL_TYPE]) elseif AreaTable[JWD_AREA_TYPE] == WIN_AREATYPES.SPLIT then diff --git a/Profiles/WinProject.lua b/Profiles/WinProject.lua index 2c40235..6426d15 100644 --- a/Profiles/WinProject.lua +++ b/Profiles/WinProject.lua @@ -43,12 +43,12 @@ end _G.WinCreate_ImportProfile = WinCreate_ImportProfile local function WinCreate_CreateFrame() - WDG.AREAID = WinCreate.CreateFrame(WDG.FRAMETYPE, WDG.JOINTBL, WDG.JOINTBR, WDG.JOINTTR, WDG.JOINTTL, WDG.WIDTH, WDG.HEIGHT, WDG.HEIGHT2) + WDG.AREAID = WinCreate.CreateFrame( WDG.FRAMETYPE, {WDG.JOINTBL, WDG.JOINTBR, WDG.JOINTTR, WDG.JOINTTL, WDG.JOINTBL}, WDG.WIDTH, WDG.HEIGHT, WDG.HEIGHT2) end _G.WinCreate_CreateFrame = WinCreate_CreateFrame local function WinCreate_AddSash() - WDG.AREAID = WinCreate.AddSash(WDG.AREAID, WDG.JOINTBL, WDG.JOINTBR, WDG.JOINTTR, WDG.JOINTTL, WDG.SASHTYPE) + WDG.AREAID = WinCreate.AddSash( WDG.AREAID, {WDG.JOINTBL, WDG.JOINTBR, WDG.JOINTTR, WDG.JOINTTL, WDG.JOINTBL}, WDG.SASHTYPE) end _G.WinCreate_AddSash = WinCreate_AddSash