diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..867c9bd --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,105 @@ +{ + "Lua.diagnostics.globals": [ + "EgtProtectGlobal", + "EgtGetFirstNameInGroup", + "EgtGetBBox", + "REF", + "GDB_BB", + "EgtGetName", + "EgtSP", + "EgtEP", + "EgtRectangle2P", + "EgtModifyCurveExtrusion", + "EgtSetName", + "EgtModifyCurveThickness", + "Z_AX", + "Y_AX", + "X_AX", + "EgtCopy", + "EgtMove", + "EgtRotate", + "Point3d", + "EgtSurfTmByExtrusion", + "EgtInvertSurf", + "EgtGetBBoxGlob", + "EgtSurfTmCut", + "EgtErase", + "EgtGroup", + "GDB_ID", + "ORIG", + "EgtInvertCurve", + "EgtSetInfo", + "EgtIf", + "EgtGetInfo", + "Color3d", + "EgtSetColor", + "EgtChangeGroupFrame", + "Frame3d", + "EgtSV", + "SphericalFromVector", + "EgtGetParent", + "EgtLine", + "EgtCurveCompo", + "EgtGetFirstInGroup", + "EgtGetNext", + "EgtSurfFlatRegion", + "EgtTrimCurveWithRegion", + "EgtCurveCompoFromPoints", + "EgtAddCurveCompoLine", + "EgtCurveLength", + "GetAngle", + "GLOB_FRM", + "GDB_RT", + "EgtGetAllInGroup", + "EgtFR", + "EgtTransform", + "EgtOffsetCurve", + "EgtIP", + "EgtCurveParamAtPoint", + "EgtTrimCurveStartAtParam", + "EgtTrimCurveEndAtParam", + "EgtCurveCompoByChain", + "EgtExtendCurveStartByLen", + "EgtExtendCurveEndByLen", + "EgtSurfTmSwept", + "abs", + "EgtEV", + "EgtLinePVL", + "AreSamePointExact", + "EgtGetBBoxRef", + "EgtEmptyGroup", + "EgtRemoveInfo", + "EgtSetAlpha", + "EgtSurfTmByRegionExtrusion", + "EgtRelocateGlob", + "EgtGetPrev", + "EgtGetLastInGroup", + "EgtRemoveName", + "AreSameVectorExact", + "AreSameVectorApprox", + "AreSamePointApprox", + "min", + "max", + "EgtTrimCurveStartEndAtParam", + "EgtGetNextName", + "EgtMP", + "EgtPointCurveDist", + "EgtGetType", + "GDB_TY", + "EgtArc3P", + "EgtInsertFile", + "EgtSetStatus", + "GDB_ST", + "EgtOutBox", + "EgtChangePathExtension", + "EgtPointCurveDistSide", + "EgtMV", + "EgtUV", + "EgtCopyGlob", + "EgtCP", + "Vector3d" + ], + "Lua.diagnostics.disable": [ + "empty-block" + ] +} \ No newline at end of file diff --git a/Profiles/Main - 2023-06-24-2.lua b/Profiles/Main - 2023-06-24-2.lua new file mode 100644 index 0000000..e75897f --- /dev/null +++ b/Profiles/Main - 2023-06-24-2.lua @@ -0,0 +1,271 @@ +-- +-- EEEEEEEEEE GGGGGG TTTTTTTTTTTTTT +-- EEEEEEEEEE GGGGGGGGGG TTTTTTTTTTTTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEEEEEEEE GGGGGGGGGG TTTT +-- EEEEEEEEEE GGGGGG TTTT +-- +-- by Egalware s.r.l. +-- Window project software by Egalware s.r.l. 2023/05/02 + +require( 'EgtBase') +_ENV = EgtProtectGlobal() +EgtEnableDebug( true) + +---- Imposto direttorio libreria specializzata per Nesting +--local sBaseDir = EgtGetSourceDir() +--EgtOutLog("BaseDir=" .. sBaseDir) +--EgtAddToPackagePath( sBaseDir .. '?.lua') + +-- local Config = require( 'Config') + +------------------------------------------- PARAMETERS ------------------------------------------- +local DebugCode = false + +-- Tipi di giunzioni (joint) +JNT = { + ANGLED = 1, + CP_H = 2, + CP_V = 3, + CP_M = 4 +} + +-- Tipi di profilo +PRF = { + NULL = 0, + TOP = 1, + BOTTOM = 2, + LEFT = 3, + RIGHT = 4, + VERTICAL = 5, + HORIZONTAL = 6 +} + +local CUT_SURF_EPS_SMALL = 0.05 + +local PROFILE = 'Profile' +local FRAME = 'Frame' +local OUTLINE = 'Outline' +local GEO = 'Geo' +local SOLID = 'Solid' +local BOTTOM = 'Bottom' +local RIGHT = 'Right' +local TOP = 'Top' +local LEFT = 'Left' + +local SASH_TOP = 'Sash_Top' +local SASH_BOTTOM = 'Sash_Bottom' +local FIXED_TOP = 'Fixed_Top' +local FIXED_BOTTOM = 'Fixed_Bottom' + +local REF = 'Ref' +local SECTION = 'Section' +local ALU = 'Alu' +local CTRIN = 'CtrIn' +local OUT = 'Out' +local OUTOFST = 'OutOfst' + +local HoleHeight = 1200 +local HoleWidth = 1200 + +local WindowWidth = 1200 +local WindowHeight = 1200 + +local WindowTree + +local sProfilePath = 'c:\\EgtData\\Window\\Profiles\\Profilo78 - Offset.nge' + +------------------------------------------- ************** ------------------------------------------- + +-- funzioni + +-- funzione che restituisce BBox del Ref del profilo +local function GetRefWithBBoxFromProfile( nProfileFrameId, sProfileType) + local nProfileId = EgtGetFirstNameInGroup( nProfileFrameId, sProfileType) + local nProfileRefId = EgtGetFirstNameInGroup( nProfileId, REF) + local b3Ref = EgtGetBBox( nProfileRefId, GDB_BB.STANDARD) + return nProfileId, b3Ref +end + +-- funzione che restituisce ref e calcola delta controprofilo dal profilo passatogli +local function GetDeltaProfile( nProfileFrameId, sProfileType) + local nProfileId, b3Ref = GetRefWithBBoxFromProfile( nProfileFrameId, sProfileType) + local nCPId = EgtGetFirstNameInGroup( nProfileId, CTRIN) + local b3CP = EgtGetBBox( nCPId, GDB_BB.STANDARD) + local dCPDelta = b3Ref:getDimY() - b3CP:getDimY() + return dCPDelta, b3Ref +end + +-- funzione che calcola l'ingombro dei pezzi del telaio +local function CalcFrameFootPrint( nProfileFrameId, nId, nGeoId) + -- ricavo tipo dal nome + local sName = EgtGetName( nId) + local nProfileType = PRF.NULL + if sName == TOP then + nProfileType = PRF.TOP + elseif sName == BOTTOM then + nProfileType = PRF.BOTTOM + elseif sName == LEFT then + nProfileType = PRF.LEFT + elseif sName == RIGHT then + nProfileType = PRF.RIGHT + end + local p3FrameStart = EgtSP( nId) + local p3FrameEnd = EgtEP( nId) + local nNewGeoId + if nProfileType == PRF.TOP then + -- recupero ref e controprofilo del top e calcolo delta + local _, b3TopRef = GetRefWithBBoxFromProfile( nProfileFrameId, SASH_TOP) + nNewGeoId = EgtRectangle2P( nGeoId, p3FrameEnd - Y_AX() * b3TopRef:getDimY(), p3FrameStart) + EgtModifyCurveExtrusion( nNewGeoId, Z_AX()) + EgtModifyCurveThickness( nNewGeoId, -b3TopRef:getDimX()) + EgtSetName( nNewGeoId, TOP) + elseif nProfileType == PRF.BOTTOM then + local _, b3BottomRef = GetRefWithBBoxFromProfile( nProfileFrameId, SASH_BOTTOM) + nNewGeoId = EgtRectangle2P( nGeoId, p3FrameStart, p3FrameEnd + Y_AX() * b3BottomRef:getDimY()) + EgtModifyCurveExtrusion( nNewGeoId, Z_AX()) + EgtModifyCurveThickness( nNewGeoId, -b3BottomRef:getDimX()) + EgtSetName( nNewGeoId, BOTTOM) + elseif nProfileType == PRF.LEFT then + -- recupero ref e controprofilo del top e calcolo delta + local dTopCPDelta, b3TopRef = GetDeltaProfile( nProfileFrameId, SASH_TOP) + -- recupero ref e controprofilo del bottom e calcolo delta + local dBottomCPDelta, b3BottomRef = GetDeltaProfile( nProfileFrameId, SASH_BOTTOM) + -- creo rettangolo ingombro + nNewGeoId = EgtRectangle2P( nGeoId, p3FrameEnd + Y_AX() * dBottomCPDelta , p3FrameStart + X_AX() * b3TopRef:getDimY() - Y_AX() * dTopCPDelta) + EgtModifyCurveExtrusion( nNewGeoId, Z_AX()) + EgtModifyCurveThickness( nNewGeoId, -b3TopRef:getDimX()) + EgtSetName( nNewGeoId, LEFT) + elseif nProfileType == PRF.RIGHT then + -- recupero ref e controprofilo del top e calcolo delta + local dTopCPDelta, b3TopRef = GetDeltaProfile( nProfileFrameId, SASH_TOP) + -- recupero ref e controprofilo del bottom e calcolo delta + local dBottomCPDelta, b3BottomRef = GetDeltaProfile( nProfileFrameId, SASH_BOTTOM) + -- creo rettangolo ingombro + nNewGeoId = EgtRectangle2P( nGeoId, p3FrameStart - X_AX() * b3TopRef:getDimY() + Y_AX() * dBottomCPDelta , p3FrameEnd - Y_AX() * dTopCPDelta) + EgtModifyCurveExtrusion( nNewGeoId, Z_AX()) + EgtModifyCurveThickness( nNewGeoId, -b3TopRef:getDimX()) + EgtSetName( nNewGeoId, RIGHT) + end +end + +------------------------------------------- ************** ------------------------------------------- + +-- ciclo principale + +EgtNewFile() + +-- creo gruppo per il profilo +local nProfileId = EgtGroup( GDB_ID.ROOT) +EgtSetName( nProfileId, PROFILE) + +-- importo profilo prescelto +local bOk = EgtInsertFile( sProfilePath) + +local nGroupId = EgtGetFirstInGroup( GDB_ID.ROOT) +while nGroupId do + if nGroupId ~= nProfileId then + local nCurrId = nGroupId + nGroupId = EgtGetNext( nGroupId) + EgtRelocateGlob( nCurrId, nProfileId) + EgtSetStatus( nCurrId, GDB_ST.OFF) + else + nGroupId = EgtGetNext( nGroupId) + end +end + +-- creo struttura layer del frame +local nFrameLayerId = EgtGroup( GDB_ID.ROOT) +EgtSetName( nFrameLayerId, FRAME) +local nOutlineId = EgtGroup( nFrameLayerId) +EgtSetName( nOutlineId, OUTLINE) +local nGeoId = EgtGroup( nFrameLayerId) +EgtSetName( nGeoId, GEO) +local nSolidId = EgtGroup( nFrameLayerId) +EgtSetName( nSolidId, SOLID) +local nFrameProfileId = EgtGroup( nFrameLayerId) +EgtSetName( nFrameProfileId, PROFILE) + +-- disegno outline +local nFrameBottomId = EgtLine( nOutlineId, Point3d( 0, 0, 0), Point3d( WindowWidth, 0, 0) ) +EgtSetName( nFrameBottomId, BOTTOM) +local nFrameRightId = EgtLine( nOutlineId, Point3d( WindowWidth, 0, 0), Point3d( WindowWidth, WindowHeight, 0) ) +EgtSetName( nFrameRightId, RIGHT) +local nFrameTopId = EgtLine( nOutlineId, Point3d( WindowWidth, WindowHeight, 0), Point3d( 0, WindowHeight, 0) ) +EgtSetName( nFrameTopId, TOP) +local nFrameLeftId = EgtLine( nOutlineId, Point3d( 0, WindowHeight, 0), Point3d( 0, 0, 0) ) +EgtSetName( nFrameLeftId, LEFT) + +-- scelgo tipo di giunzioni +-- per il momento faccio controprofili verticali + + +-- scelgo il tipo +-- per il momento faccio controprofili per anta + +-- disegno ingombri frame +local nProfileFrameId = EgtGetFirstNameInGroup( nProfileId, FRAME) + +local nCurrOutlineId = EgtGetFirstInGroup( nOutlineId) +while nCurrOutlineId do + CalcFrameFootPrint( nProfileFrameId, nCurrOutlineId, nGeoId) + nCurrOutlineId = EgtGetNext( nCurrOutlineId) +end + +-- posiziono profili +-- bottom +local nBottomProfileId = EgtGetFirstNameInGroup( nProfileFrameId, SASH_BOTTOM) +-- creo copia +local nBottomFrameProfileId = EgtCopy( nBottomProfileId, nFrameProfileId) +local b3BottomFrameProfile = EgtGetBBox( nBottomFrameProfileId, GDB_BB.STANDARD) +-- recupero posizione e BBox del geo +local nBottomGeoId = EgtGetFirstNameInGroup( nGeoId, BOTTOM) +local b3BottomGeo = EgtGetBBox(nBottomGeoId, GDB_BB.STANDARD) +EgtMove( nBottomFrameProfileId, b3BottomGeo:getMin() + Z_AX() * b3BottomGeo:getDimZ() - Point3d( b3BottomFrameProfile:getMax():getX(), b3BottomFrameProfile:getMin():getY(), b3BottomGeo:getMax():getZ())) +EgtRotate( nBottomFrameProfileId, b3BottomGeo:getMin() + Z_AX() * b3BottomGeo:getDimZ(), Y_AX(), -90) +-- recupero profilo outline e lo estrudo +local nBottomFrameOutlineId = EgtGetFirstNameInGroup( nBottomFrameProfileId, SECTION) +local nBottomExtrusionId = EgtSurfTmByExtrusion( nSolidId, nBottomFrameOutlineId, X_AX() * b3BottomGeo:getDimX()) +EgtInvertSurf( nBottomExtrusionId) +-- copio e sposto profilo out left su start bottom per tagliarlo +local nLeftProfileId = EgtGetFirstNameInGroup( nProfileFrameId, SASH_TOP) +local nBottomOutLeftProfileId = EgtCopy( nLeftProfileId, nFrameProfileId) +EgtRotate( nBottomOutLeftProfileId, Point3d( b3BottomGeo:getMin():getX(), b3BottomGeo:getMin():getY(), b3BottomGeo:getMax():getZ()), Y_AX(), -90) +EgtRotate( nBottomOutLeftProfileId, Point3d( b3BottomGeo:getMin():getX(), b3BottomGeo:getMin():getY(), b3BottomGeo:getMax():getZ()), Z_AX(), 90) +local b3BottomOutLeftProfileId = EgtGetBBoxGlob(nBottomOutLeftProfileId, GDB_BB.STANDARD) +EgtMove( nBottomOutLeftProfileId, b3BottomGeo:getMin() - b3BottomOutLeftProfileId:getMin()) +local nOutLeftProfileId = EgtGetFirstNameInGroup( nBottomOutLeftProfileId, OUTOFST) +local nBottomOutLeftProfileExtrusionId = EgtSurfTmByExtrusion( nSolidId, nOutLeftProfileId, Y_AX() * b3BottomFrameProfile:getDimY()) +EgtInvertSurf( nBottomOutLeftProfileExtrusionId) +local nExtrCopyId = EgtCopy( nBottomExtrusionId, nSolidId) +EgtSurfTmCut( nBottomExtrusionId, nBottomOutLeftProfileExtrusionId, true, false) +EgtSurfTmCut( nBottomOutLeftProfileExtrusionId, nExtrCopyId, true, false) +--EgtErase( nExtrCopyId) +-- copio e sposto profilo out left su end bottom per tagliarlo +local nRightProfileId = EgtGetFirstNameInGroup( nProfileFrameId, SASH_TOP) +local nBottomOutRightProfileId = EgtCopy( nRightProfileId, nFrameProfileId) +EgtRotate( nBottomOutRightProfileId, Point3d( b3BottomGeo:getMin():getX(), b3BottomGeo:getMin():getY(), b3BottomGeo:getMax():getZ()), Y_AX(), -90) +EgtRotate( nBottomOutRightProfileId, Point3d( b3BottomGeo:getMin():getX(), b3BottomGeo:getMin():getY(), b3BottomGeo:getMax():getZ()), Z_AX(), -90) +local b3BottomOutRightProfileId = EgtGetBBoxGlob(nBottomOutRightProfileId, GDB_BB.STANDARD) +EgtMove( nBottomOutRightProfileId, Point3d( b3BottomGeo:getMax():getX(),b3BottomGeo:getMin():getY(),b3BottomGeo:getMin():getZ()) - Point3d( b3BottomOutRightProfileId:getMax():getX(), b3BottomOutRightProfileId:getMin():getY(),b3BottomOutRightProfileId:getMin():getZ())) +local nOutRightProfileId = EgtGetFirstNameInGroup( nBottomOutRightProfileId, OUTOFST) +local nBottomOutRightProfileExtrusionId = EgtSurfTmByExtrusion( nSolidId, nOutRightProfileId, Y_AX() * b3BottomFrameProfile:getDimY()) +--EgtInvertSurf( nBottomOutLeftProfileExtrusionId) +--local nExtrCopyId = EgtCopy( nBottomExtrusionId, nSolidId) +EgtSurfTmCut( nBottomExtrusionId, nBottomOutRightProfileExtrusionId, true, false) +EgtSurfTmCut( nBottomOutRightProfileExtrusionId, nExtrCopyId, true, false) +EgtErase( nExtrCopyId) + + + + + + + + + diff --git a/Profiles/Main - 2023-06-24-3.lua b/Profiles/Main - 2023-06-24-3.lua new file mode 100644 index 0000000..1bc095b --- /dev/null +++ b/Profiles/Main - 2023-06-24-3.lua @@ -0,0 +1,338 @@ +-- +-- EEEEEEEEEE GGGGGG TTTTTTTTTTTTTT +-- EEEEEEEEEE GGGGGGGGGG TTTTTTTTTTTTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEEEEEEEE GGGGGGGGGG TTTT +-- EEEEEEEEEE GGGGGG TTTT +-- +-- by Egalware s.r.l. +-- Window project software by Egalware s.r.l. 2023/05/02 + +require( 'EgtBase') +_ENV = EgtProtectGlobal() +EgtEnableDebug( true) + +---- Imposto direttorio libreria specializzata per Nesting +--local sBaseDir = EgtGetSourceDir() +--EgtOutLog("BaseDir=" .. sBaseDir) +--EgtAddToPackagePath( sBaseDir .. '?.lua') + +-- local Config = require( 'Config') + +------------------------------------------- PARAMETERS ------------------------------------------- +local DebugCode = false + +-- Tipi di giunzioni (joint) +JNT = { + ANGLED = 1, + CP_H = 2, + CP_V = 3, + CP_M = 4 +} + +-- Tipi di profilo +PRF = { + NULL = 0, + TOP = 1, + BOTTOM = 2, + LEFT = 3, + RIGHT = 4, + VERTICAL = 5, + HORIZONTAL = 6 +} + +local CUT_SURF_EPS_SMALL = 0.05 + +local PROFILE = 'Profile' +local FRAME = 'Frame' +local OUTLINE = 'Outline' +local GEO = 'Geo' +local SOLID = 'Solid' +local BOTTOM = 'Bottom' +local RIGHT = 'Right' +local TOP = 'Top' +local LEFT = 'Left' + +local SASH_TOP = 'Sash_Top' +local SASH_BOTTOM = 'Sash_Bottom' +local FIXED_TOP = 'Fixed_Top' +local FIXED_BOTTOM = 'Fixed_Bottom' + +local REF = 'Ref' +local SECTION = 'Section' +local ALU = 'Alu' +local CTRIN = 'CtrIn' +local OUT = 'Out' +local OUTOFST = 'OutOfst' + +local HoleHeight = 1200 +local HoleWidth = 1200 + +local WindowWidth = 1200 +local WindowHeight = 1200 + +local WindowTree + +local sProfilePath = 'c:\\EgtData\\Window\\Profiles\\Profilo78 - Offset.nge' + +------------------------------------------- ************** ------------------------------------------- + +-- funzioni + +-- funzione che restituisce BBox del Ref del profilo +local function GetRefWithBBoxFromProfile( nProfileFrameLayerId, sProfileType) + local nProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, sProfileType) + local nProfileRefId = EgtGetFirstNameInGroup( nProfileId, REF) + local b3Ref = EgtGetBBox( nProfileRefId, GDB_BB.STANDARD) + return nProfileId, b3Ref +end + +-- funzione che restituisce ref e calcola delta controprofilo dal profilo passatogli +local function GetDeltaProfile( nProfileFrameLayerId, sProfileType) + local nProfileId, b3Ref = GetRefWithBBoxFromProfile( nProfileFrameLayerId, sProfileType) + local nCPId = EgtGetFirstNameInGroup( nProfileId, CTRIN) + local b3CP = EgtGetBBox( nCPId, GDB_BB.STANDARD) + local dCPDelta = b3Ref:getDimY() - b3CP:getDimY() + return dCPDelta, b3Ref +end + +-- funzione che calcola l'ingombro dei pezzi del telaio +local function CalcFrameFootPrint( nProfileFrameLayerId, nId, nGeoId) + -- ricavo tipo dal nome + local sName = EgtGetName( nId) + local nProfileType = PRF.NULL + if sName == TOP then + nProfileType = PRF.TOP + elseif sName == BOTTOM then + nProfileType = PRF.BOTTOM + elseif sName == LEFT then + nProfileType = PRF.LEFT + elseif sName == RIGHT then + nProfileType = PRF.RIGHT + end + local p3FrameStart = EgtSP( nId) + local p3FrameEnd = EgtEP( nId) + local nNewGeoId + if nProfileType == PRF.TOP then + -- recupero ref e controprofilo del top e calcolo delta + local _, b3TopRef = GetRefWithBBoxFromProfile( nProfileFrameLayerId, SASH_TOP) + nNewGeoId = EgtRectangle2P( nGeoId, p3FrameEnd - Y_AX() * b3TopRef:getDimY(), p3FrameStart) + EgtModifyCurveExtrusion( nNewGeoId, Z_AX()) + EgtModifyCurveThickness( nNewGeoId, -b3TopRef:getDimX()) + EgtSetName( nNewGeoId, TOP) + elseif nProfileType == PRF.BOTTOM then + local _, b3BottomRef = GetRefWithBBoxFromProfile( nProfileFrameLayerId, SASH_BOTTOM) + nNewGeoId = EgtRectangle2P( nGeoId, p3FrameStart, p3FrameEnd + Y_AX() * b3BottomRef:getDimY()) + EgtModifyCurveExtrusion( nNewGeoId, Z_AX()) + EgtModifyCurveThickness( nNewGeoId, -b3BottomRef:getDimX()) + EgtSetName( nNewGeoId, BOTTOM) + elseif nProfileType == PRF.LEFT then + -- recupero ref e controprofilo del top e calcolo delta + local dTopCPDelta, b3TopRef = GetDeltaProfile( nProfileFrameLayerId, SASH_TOP) + -- recupero ref e controprofilo del bottom e calcolo delta + local dBottomCPDelta, b3BottomRef = GetDeltaProfile( nProfileFrameLayerId, SASH_BOTTOM) + -- creo rettangolo ingombro + nNewGeoId = EgtRectangle2P( nGeoId, p3FrameEnd + Y_AX() * dBottomCPDelta , p3FrameStart + X_AX() * b3TopRef:getDimY() - Y_AX() * dTopCPDelta) + EgtModifyCurveExtrusion( nNewGeoId, Z_AX()) + EgtModifyCurveThickness( nNewGeoId, -b3TopRef:getDimX()) + EgtSetName( nNewGeoId, LEFT) + elseif nProfileType == PRF.RIGHT then + -- recupero ref e controprofilo del top e calcolo delta + local dTopCPDelta, b3TopRef = GetDeltaProfile( nProfileFrameLayerId, SASH_TOP) + -- recupero ref e controprofilo del bottom e calcolo delta + local dBottomCPDelta, b3BottomRef = GetDeltaProfile( nProfileFrameLayerId, SASH_BOTTOM) + -- creo rettangolo ingombro + nNewGeoId = EgtRectangle2P( nGeoId, p3FrameStart - X_AX() * b3TopRef:getDimY() + Y_AX() * dBottomCPDelta , p3FrameEnd - Y_AX() * dTopCPDelta) + EgtModifyCurveExtrusion( nNewGeoId, Z_AX()) + EgtModifyCurveThickness( nNewGeoId, -b3TopRef:getDimX()) + EgtSetName( nNewGeoId, RIGHT) + end +end + +-- funzione che calcola l'ingombro dei pezzi del telaio +local function CalcFrameSolid( nProfileFrameLayerId, nGeoId, nFrameProfileLayerId, nGeoLayerId, nSolidLayerId) + -- ricavo tipo dal nome + local sName = EgtGetName( nGeoId) + local nProfileType = PRF.NULL + if sName == TOP then + nProfileType = PRF.TOP + elseif sName == BOTTOM then + nProfileType = PRF.BOTTOM + elseif sName == LEFT then + nProfileType = PRF.LEFT + elseif sName == RIGHT then + nProfileType = PRF.RIGHT + end + if nProfileType == PRF.TOP then + elseif nProfileType == PRF.BOTTOM then + local nBottomProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, SASH_BOTTOM) + -- creo copia + local nBottomFrameProfileId = EgtCopy( nBottomProfileId, nFrameProfileLayerId) + local b3BottomFrameProfile = EgtGetBBox( nBottomFrameProfileId, GDB_BB.STANDARD) + -- recupero posizione e BBox del geo + local nBottomGeoId = EgtGetFirstNameInGroup( nGeoLayerId, BOTTOM) + local b3BottomGeo = EgtGetBBox(nBottomGeoId, GDB_BB.STANDARD) + EgtMove( nBottomFrameProfileId, b3BottomGeo:getMin() + Z_AX() * b3BottomGeo:getDimZ() - Point3d( b3BottomFrameProfile:getMax():getX(), b3BottomFrameProfile:getMin():getY(), b3BottomGeo:getMax():getZ())) + EgtRotate( nBottomFrameProfileId, b3BottomGeo:getMin() + Z_AX() * b3BottomGeo:getDimZ(), Y_AX(), -90) + -- recupero profilo outline e lo estrudo + local nBottomFrameOutlineId = EgtGetFirstNameInGroup( nBottomFrameProfileId, SECTION) + local nBottomExtrusionId = EgtSurfTmByExtrusion( nSolidLayerId, nBottomFrameOutlineId, X_AX() * b3BottomGeo:getDimX()) + EgtInvertSurf( nBottomExtrusionId) + -- copio e sposto profilo out left su start bottom per tagliarlo + local nLeftProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, SASH_TOP) + local nBottomOutLeftProfileId = EgtCopy( nLeftProfileId, nFrameProfileLayerId) + EgtRotate( nBottomOutLeftProfileId, Point3d( b3BottomGeo:getMin():getX(), b3BottomGeo:getMin():getY(), b3BottomGeo:getMax():getZ()), Y_AX(), -90) + EgtRotate( nBottomOutLeftProfileId, Point3d( b3BottomGeo:getMin():getX(), b3BottomGeo:getMin():getY(), b3BottomGeo:getMax():getZ()), Z_AX(), 90) + local b3BottomOutLeftProfileId = EgtGetBBoxGlob(nBottomOutLeftProfileId, GDB_BB.STANDARD) + EgtMove( nBottomOutLeftProfileId, b3BottomGeo:getMin() - b3BottomOutLeftProfileId:getMin()) + local nOutLeftProfileId = EgtGetFirstNameInGroup( nBottomOutLeftProfileId, OUTOFST) + local nBottomOutLeftProfileExtrusionId = EgtSurfTmByExtrusion( nSolidLayerId, nOutLeftProfileId, Y_AX() * b3BottomFrameProfile:getDimY()) + EgtInvertSurf( nBottomOutLeftProfileExtrusionId) + local nExtrCopyId = EgtCopy( nBottomExtrusionId, nSolidLayerId) + EgtSurfTmCut( nBottomExtrusionId, nBottomOutLeftProfileExtrusionId, true, false) + EgtSurfTmCut( nBottomOutLeftProfileExtrusionId, nExtrCopyId, true, false) + --EgtErase( nExtrCopyId) + -- copio e sposto profilo out left su end bottom per tagliarlo + local nRightProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, SASH_TOP) + local nBottomOutRightProfileId = EgtCopy( nRightProfileId, nFrameProfileLayerId) + EgtRotate( nBottomOutRightProfileId, Point3d( b3BottomGeo:getMin():getX(), b3BottomGeo:getMin():getY(), b3BottomGeo:getMax():getZ()), Y_AX(), -90) + EgtRotate( nBottomOutRightProfileId, Point3d( b3BottomGeo:getMin():getX(), b3BottomGeo:getMin():getY(), b3BottomGeo:getMax():getZ()), Z_AX(), -90) + local b3BottomOutRightProfileId = EgtGetBBoxGlob(nBottomOutRightProfileId, GDB_BB.STANDARD) + EgtMove( nBottomOutRightProfileId, Point3d( b3BottomGeo:getMax():getX(),b3BottomGeo:getMin():getY(),b3BottomGeo:getMin():getZ()) - Point3d( b3BottomOutRightProfileId:getMax():getX(), b3BottomOutRightProfileId:getMin():getY(),b3BottomOutRightProfileId:getMin():getZ())) + local nOutRightProfileId = EgtGetFirstNameInGroup( nBottomOutRightProfileId, OUTOFST) + local nBottomOutRightProfileExtrusionId = EgtSurfTmByExtrusion( nSolidLayerId, nOutRightProfileId, Y_AX() * b3BottomFrameProfile:getDimY()) + --EgtInvertSurf( nBottomOutLeftProfileExtrusionId) + --local nExtrCopyId = EgtCopy( nBottomExtrusionId, nSolidLayerId) + EgtSurfTmCut( nBottomExtrusionId, nBottomOutRightProfileExtrusionId, true, false) + EgtSurfTmCut( nBottomOutRightProfileExtrusionId, nExtrCopyId, true, false) + EgtErase( nExtrCopyId) + elseif nProfileType == PRF.LEFT then + elseif nProfileType == PRF.RIGHT then + end +end + +------------------------------------------- ************** ------------------------------------------- + +-- ciclo principale + +EgtNewFile() + +-- creo gruppo per il profilo +local nProfileId = EgtGroup( GDB_ID.ROOT) +EgtSetName( nProfileId, PROFILE) + +-- importo profilo prescelto +local bOk = EgtInsertFile( sProfilePath) + +local nGroupId = EgtGetFirstInGroup( GDB_ID.ROOT) +while nGroupId do + if nGroupId ~= nProfileId then + local nCurrId = nGroupId + nGroupId = EgtGetNext( nGroupId) + EgtRelocateGlob( nCurrId, nProfileId) + EgtSetStatus( nCurrId, GDB_ST.OFF) + else + nGroupId = EgtGetNext( nGroupId) + end +end + +-- creo struttura layer del frame +local nFrameLayerId = EgtGroup( GDB_ID.ROOT) +EgtSetName( nFrameLayerId, FRAME) +local nOutlineLayerId = EgtGroup( nFrameLayerId) +EgtSetName( nOutlineLayerId, OUTLINE) +local nGeoLayerId = EgtGroup( nFrameLayerId) +EgtSetName( nGeoLayerId, GEO) +local nSolidLayerId = EgtGroup( nFrameLayerId) +EgtSetName( nSolidLayerId, SOLID) +local nFrameProfileLayerId = EgtGroup( nFrameLayerId) +EgtSetName( nFrameProfileLayerId, PROFILE) + +-- disegno outline +local nFrameBottomId = EgtLine( nOutlineLayerId, Point3d( 0, 0, 0), Point3d( WindowWidth, 0, 0) ) +EgtSetName( nFrameBottomId, BOTTOM) +local nFrameRightId = EgtLine( nOutlineLayerId, Point3d( WindowWidth, 0, 0), Point3d( WindowWidth, WindowHeight, 0) ) +EgtSetName( nFrameRightId, RIGHT) +local nFrameTopId = EgtLine( nOutlineLayerId, Point3d( WindowWidth, WindowHeight, 0), Point3d( 0, WindowHeight, 0) ) +EgtSetName( nFrameTopId, TOP) +local nFrameLeftId = EgtLine( nOutlineLayerId, Point3d( 0, WindowHeight, 0), Point3d( 0, 0, 0) ) +EgtSetName( nFrameLeftId, LEFT) + +-- scelgo tipo di giunzioni +-- per il momento faccio controprofili verticali + + +-- scelgo il tipo +-- per il momento faccio controprofili per anta + +-- disegno ingombri frame +local nProfileFrameLayerId = EgtGetFirstNameInGroup( nProfileId, FRAME) + +local nCurrOutlineId = EgtGetFirstInGroup( nOutlineLayerId) +while nCurrOutlineId do + CalcFrameFootPrint( nProfileFrameLayerId, nCurrOutlineId, nGeoLayerId) + nCurrOutlineId = EgtGetNext( nCurrOutlineId) +end + +-- posiziono profili +local nGeoId = EgtGetFirstInGroup( nGeoLayerId) +CalcFrameSolid(nProfileFrameLayerId, nGeoId, nFrameProfileLayerId, nGeoLayerId, nSolidLayerId) + + + +---- bottom +--local nBottomProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, SASH_BOTTOM) +---- creo copia +--local nBottomFrameProfileId = EgtCopy( nBottomProfileId, nFrameProfileLayerId) +--local b3BottomFrameProfile = EgtGetBBox( nBottomFrameProfileId, GDB_BB.STANDARD) +---- recupero posizione e BBox del geo +--local nBottomGeoId = EgtGetFirstNameInGroup( nGeoId, BOTTOM) +--local b3BottomGeo = EgtGetBBox(nBottomGeoId, GDB_BB.STANDARD) +--EgtMove( nBottomFrameProfileId, b3BottomGeo:getMin() + Z_AX() * b3BottomGeo:getDimZ() - Point3d( b3BottomFrameProfile:getMax():getX(), b3BottomFrameProfile:getMin():getY(), b3BottomGeo:getMax():getZ())) +--EgtRotate( nBottomFrameProfileId, b3BottomGeo:getMin() + Z_AX() * b3BottomGeo:getDimZ(), Y_AX(), -90) +---- recupero profilo outline e lo estrudo +--local nBottomFrameOutlineId = EgtGetFirstNameInGroup( nBottomFrameProfileId, SECTION) +--local nBottomExtrusionId = EgtSurfTmByExtrusion( nSolidLayerId, nBottomFrameOutlineId, X_AX() * b3BottomGeo:getDimX()) +--EgtInvertSurf( nBottomExtrusionId) +---- copio e sposto profilo out left su start bottom per tagliarlo +--local nLeftProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, SASH_TOP) +--local nBottomOutLeftProfileId = EgtCopy( nLeftProfileId, nFrameProfileLayerId) +--EgtRotate( nBottomOutLeftProfileId, Point3d( b3BottomGeo:getMin():getX(), b3BottomGeo:getMin():getY(), b3BottomGeo:getMax():getZ()), Y_AX(), -90) +--EgtRotate( nBottomOutLeftProfileId, Point3d( b3BottomGeo:getMin():getX(), b3BottomGeo:getMin():getY(), b3BottomGeo:getMax():getZ()), Z_AX(), 90) +--local b3BottomOutLeftProfileId = EgtGetBBoxGlob(nBottomOutLeftProfileId, GDB_BB.STANDARD) +--EgtMove( nBottomOutLeftProfileId, b3BottomGeo:getMin() - b3BottomOutLeftProfileId:getMin()) +--local nOutLeftProfileId = EgtGetFirstNameInGroup( nBottomOutLeftProfileId, OUTOFST) +--local nBottomOutLeftProfileExtrusionId = EgtSurfTmByExtrusion( nSolidLayerId, nOutLeftProfileId, Y_AX() * b3BottomFrameProfile:getDimY()) +--EgtInvertSurf( nBottomOutLeftProfileExtrusionId) +--local nExtrCopyId = EgtCopy( nBottomExtrusionId, nSolidLayerId) +--EgtSurfTmCut( nBottomExtrusionId, nBottomOutLeftProfileExtrusionId, true, false) +--EgtSurfTmCut( nBottomOutLeftProfileExtrusionId, nExtrCopyId, true, false) +----EgtErase( nExtrCopyId) +---- copio e sposto profilo out left su end bottom per tagliarlo +--local nRightProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, SASH_TOP) +--local nBottomOutRightProfileId = EgtCopy( nRightProfileId, nFrameProfileLayerId) +--EgtRotate( nBottomOutRightProfileId, Point3d( b3BottomGeo:getMin():getX(), b3BottomGeo:getMin():getY(), b3BottomGeo:getMax():getZ()), Y_AX(), -90) +--EgtRotate( nBottomOutRightProfileId, Point3d( b3BottomGeo:getMin():getX(), b3BottomGeo:getMin():getY(), b3BottomGeo:getMax():getZ()), Z_AX(), -90) +--local b3BottomOutRightProfileId = EgtGetBBoxGlob(nBottomOutRightProfileId, GDB_BB.STANDARD) +--EgtMove( nBottomOutRightProfileId, Point3d( b3BottomGeo:getMax():getX(),b3BottomGeo:getMin():getY(),b3BottomGeo:getMin():getZ()) - Point3d( b3BottomOutRightProfileId:getMax():getX(), b3BottomOutRightProfileId:getMin():getY(),b3BottomOutRightProfileId:getMin():getZ())) +--local nOutRightProfileId = EgtGetFirstNameInGroup( nBottomOutRightProfileId, OUTOFST) +--local nBottomOutRightProfileExtrusionId = EgtSurfTmByExtrusion( nSolidLayerId, nOutRightProfileId, Y_AX() * b3BottomFrameProfile:getDimY()) +----EgtInvertSurf( nBottomOutLeftProfileExtrusionId) +----local nExtrCopyId = EgtCopy( nBottomExtrusionId, nSolidLayerId) +--EgtSurfTmCut( nBottomExtrusionId, nBottomOutRightProfileExtrusionId, true, false) +--EgtSurfTmCut( nBottomOutRightProfileExtrusionId, nExtrCopyId, true, false) +--EgtErase( nExtrCopyId) + + + + + + + + + diff --git a/Profiles/Main - 2023-06-24.lua b/Profiles/Main - 2023-06-24.lua new file mode 100644 index 0000000..21ebe94 --- /dev/null +++ b/Profiles/Main - 2023-06-24.lua @@ -0,0 +1,266 @@ +-- +-- EEEEEEEEEE GGGGGG TTTTTTTTTTTTTT +-- EEEEEEEEEE GGGGGGGGGG TTTTTTTTTTTTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEEEEEEEE GGGGGGGGGG TTTT +-- EEEEEEEEEE GGGGGG TTTT +-- +-- by Egalware s.r.l. +-- Window project software by Egalware s.r.l. 2023/05/02 + +require( 'EgtBase') +_ENV = EgtProtectGlobal() +EgtEnableDebug( true) + +---- Imposto direttorio libreria specializzata per Nesting +--local sBaseDir = EgtGetSourceDir() +--EgtOutLog("BaseDir=" .. sBaseDir) +--EgtAddToPackagePath( sBaseDir .. '?.lua') + +-- local Config = require( 'Config') + +------------------------------------------- PARAMETERS ------------------------------------------- +local DebugCode = false + +-- Tipi di giunzioni (joint) +JNT = { + ANGLED = 1, + CP_H = 2, + CP_V = 3, + CP_M = 4 +} + +-- Tipi di profilo +PRF = { + NULL = 0, + TOP = 1, + BOTTOM = 2, + LEFT = 3, + RIGHT = 4, + VERTICAL = 5, + HORIZONTAL = 6 +} + +local CUT_SURF_EPS_SMALL = 0.05 + +local PROFILE = 'Profile' +local FRAME = 'Frame' +local OUTLINE = 'Outline' +local GEO = 'Geo' +local SOLID = 'Solid' +local BOTTOM = 'Bottom' +local RIGHT = 'Right' +local TOP = 'Top' +local LEFT = 'Left' + +local SASH_TOP = 'Sash_Top' +local SASH_BOTTOM = 'Sash_Bottom' +local FIXED_TOP = 'Fixed_Top' +local FIXED_BOTTOM = 'Fixed_Bottom' + +local REF = 'Ref' +local SECTION = 'Section' +local ALU = 'Alu' +local CTRIN = 'CtrIn' +local OUT = 'Out' +local OUTOFST = 'OutOfst' + +local HoleHeight = 1200 +local HoleWidth = 1200 + +local WindowWidth = 1200 +local WindowHeight = 1200 + +local WindowTree + +local sProfilePath = 'c:\\EgtData\\Window\\Profiles\\Profilo78 - Offset.nge' + +------------------------------------------- ************** ------------------------------------------- + +-- funzioni + +-- funzione che restituisce BBox del Ref del profilo +local function GetRefWithBBoxFromProfile( nProfileFrameId, sProfileType) + local nProfileId = EgtGetFirstNameInGroup( nProfileFrameId, sProfileType) + local nProfileRefId = EgtGetFirstNameInGroup( nProfileId, REF) + local b3Ref = EgtGetBBox( nProfileRefId, GDB_BB.STANDARD) + return nProfileId, b3Ref +end + +-- funzione che restituisce ref e calcola delta controprofilo dal profilo passatogli +local function GetDeltaProfile( nProfileFrameId, sProfileType) + local nProfileId, b3Ref = GetRefWithBBoxFromProfile( nProfileFrameId, sProfileType) + local nCPId = EgtGetFirstNameInGroup( nProfileId, CTRIN) + local b3CP = EgtGetBBox( nCPId, GDB_BB.STANDARD) + local dCPDelta = b3Ref:getDimY() - b3CP:getDimY() + return dCPDelta, b3Ref +end + +-- funzione che calcola l'ingombro dei pezzi del telaio +local function CalcFrameFootPrint( nProfileFrameId, nId, nGeoId) + -- ricavo tipo dal nome + local sName = EgtGetName( nId) + local nProfileType = PRF.NULL + if sName == TOP then + nProfileType = PRF.TOP + elseif sName == BOTTOM then + nProfileType = PRF.BOTTOM + elseif sName == LEFT then + nProfileType = PRF.LEFT + elseif sName == RIGHT then + nProfileType = PRF.RIGHT + end + local p3FrameStart = EgtSP( nId) + local p3FrameEnd = EgtEP( nId) + local nNewGeoId + if nProfileType == PRF.TOP then + -- recupero ref e controprofilo del top e calcolo delta + local _, b3TopRef = GetRefWithBBoxFromProfile( nProfileFrameId, SASH_TOP) + nNewGeoId = EgtRectangle2P( nGeoId, p3FrameEnd - Y_AX() * b3TopRef:getDimY(), p3FrameStart) + EgtModifyCurveExtrusion( nNewGeoId, Z_AX()) + EgtModifyCurveThickness( nNewGeoId, -b3TopRef:getDimX()) + EgtSetName( nNewGeoId, TOP) + elseif nProfileType == PRF.BOTTOM then + local _, b3BottomRef = GetRefWithBBoxFromProfile( nProfileFrameId, SASH_BOTTOM) + nNewGeoId = EgtRectangle2P( nGeoId, p3FrameStart, p3FrameEnd + Y_AX() * b3BottomRef:getDimY()) + EgtModifyCurveExtrusion( nNewGeoId, Z_AX()) + EgtModifyCurveThickness( nNewGeoId, -b3BottomRef:getDimX()) + EgtSetName( nNewGeoId, BOTTOM) + elseif nProfileType == PRF.LEFT then + -- recupero ref e controprofilo del top e calcolo delta + local dTopCPDelta, b3TopRef = GetDeltaProfile( nProfileFrameId, SASH_TOP) + -- recupero ref e controprofilo del bottom e calcolo delta + local dBottomCPDelta, b3BottomRef = GetDeltaProfile( nProfileFrameId, SASH_BOTTOM) + -- creo rettangolo ingombro + nNewGeoId = EgtRectangle2P( nGeoId, p3FrameEnd + Y_AX() * dBottomCPDelta , p3FrameStart + X_AX() * b3TopRef:getDimY() - Y_AX() * dTopCPDelta) + EgtModifyCurveExtrusion( nNewGeoId, Z_AX()) + EgtModifyCurveThickness( nNewGeoId, -b3TopRef:getDimX()) + EgtSetName( nNewGeoId, LEFT) + elseif nProfileType == PRF.RIGHT then + -- recupero ref e controprofilo del top e calcolo delta + local dTopCPDelta, b3TopRef = GetDeltaProfile( nProfileFrameId, SASH_TOP) + -- recupero ref e controprofilo del bottom e calcolo delta + local dBottomCPDelta, b3BottomRef = GetDeltaProfile( nProfileFrameId, SASH_BOTTOM) + -- creo rettangolo ingombro + nNewGeoId = EgtRectangle2P( nGeoId, p3FrameStart - X_AX() * b3TopRef:getDimY() + Y_AX() * dBottomCPDelta , p3FrameEnd - Y_AX() * dTopCPDelta) + EgtModifyCurveExtrusion( nNewGeoId, Z_AX()) + EgtModifyCurveThickness( nNewGeoId, -b3TopRef:getDimX()) + EgtSetName( nNewGeoId, RIGHT) + end +end + +------------------------------------------- ************** ------------------------------------------- + +-- ciclo principale + +EgtNewFile() + +-- creo gruppo per il profilo +local nProfileId = EgtGroup( GDB_ID.ROOT) +EgtSetName( nProfileId, PROFILE) + +-- importo profilo prescelto +local bOk = EgtInsertFile( sProfilePath) + +local nGroupId = EgtGetFirstInGroup( GDB_ID.ROOT) +while nGroupId do + if nGroupId ~= nProfileId then + local nCurrId = nGroupId + nGroupId = EgtGetNext( nGroupId) + EgtRelocateGlob( nCurrId, nProfileId) + EgtSetStatus( nCurrId, GDB_ST.OFF) + else + nGroupId = EgtGetNext( nGroupId) + end +end + +-- creo struttura layer del frame +local nFrameLayerId = EgtGroup( GDB_ID.ROOT) +EgtSetName( nFrameLayerId, FRAME) +local nOutlineId = EgtGroup( nFrameLayerId) +EgtSetName( nOutlineId, OUTLINE) +local nGeoId = EgtGroup( nFrameLayerId) +EgtSetName( nGeoId, GEO) +local nSolidId = EgtGroup( nFrameLayerId) +EgtSetName( nSolidId, SOLID) +local nFrameProfileId = EgtGroup( nFrameLayerId) +EgtSetName( nFrameProfileId, PROFILE) + +-- disegno outline +local nFrameBottomId = EgtLine( nOutlineId, Point3d( 0, 0, 0), Point3d( WindowWidth, 0, 0) ) +EgtSetName( nFrameBottomId, BOTTOM) +local nFrameRightId = EgtLine( nOutlineId, Point3d( WindowWidth, 0, 0), Point3d( WindowWidth, WindowHeight, 0) ) +EgtSetName( nFrameRightId, RIGHT) +local nFrameTopId = EgtLine( nOutlineId, Point3d( WindowWidth, WindowHeight, 0), Point3d( 0, WindowHeight, 0) ) +EgtSetName( nFrameTopId, TOP) +local nFrameLeftId = EgtLine( nOutlineId, Point3d( 0, WindowHeight, 0), Point3d( 0, 0, 0) ) +EgtSetName( nFrameLeftId, LEFT) + +-- scelgo tipo di giunzioni +-- per il momento faccio controprofili verticali + + +-- scelgo il tipo +-- per il momento faccio controprofili per anta + +-- disegno ingombri frame +local nProfileFrameId = EgtGetFirstNameInGroup( nProfileId, FRAME) + +local nCurrOutlineId = EgtGetFirstInGroup( nOutlineId) +while nCurrOutlineId do + CalcFrameFootPrint( nProfileFrameId, nCurrOutlineId, nGeoId) + nCurrOutlineId = EgtGetNext( nCurrOutlineId) +end + +-- posiziono profili +-- bottom +local nBottomProfileId = EgtGetFirstNameInGroup( nProfileFrameId, SASH_BOTTOM) +-- creo copia +local nBottomFrameProfileId = EgtCopy( nBottomProfileId, nFrameProfileId) +local b3BottomFrameProfile = EgtGetBBox( nBottomFrameProfileId, GDB_BB.STANDARD) +-- recupero posizione e BBox del geo +local nBottomGeoId = EgtGetFirstNameInGroup( nGeoId, BOTTOM) +local b3BottomGeo = EgtGetBBox(nBottomGeoId, GDB_BB.STANDARD) +EgtMove( nBottomFrameProfileId, b3BottomGeo:getMin() + Z_AX() * b3BottomGeo:getDimZ() - Point3d( b3BottomFrameProfile:getMax():getX(), b3BottomFrameProfile:getMin():getY(), b3BottomGeo:getMax():getZ())) +EgtRotate( nBottomFrameProfileId, b3BottomGeo:getMin() + Z_AX() * b3BottomGeo:getDimZ(), Y_AX(), -90) +-- recupero profilo outline e lo estrudo +local nBottomFrameOutlineId = EgtGetFirstNameInGroup( nBottomFrameProfileId, SECTION) +local nBottomExtrusionId = EgtSurfTmByExtrusion( nSolidId, nBottomFrameOutlineId, X_AX() * b3BottomGeo:getDimX()) +EgtInvertSurf( nBottomExtrusionId) +-- copio e sposto profilo out left su start bottom per tagliarlo +local nLeftProfileId = EgtGetFirstNameInGroup( nProfileFrameId, SASH_TOP) +local nBottomOutLeftProfileId = EgtCopy( nLeftProfileId, nFrameProfileId) +EgtRotate( nBottomOutLeftProfileId, Point3d( b3BottomGeo:getMin():getX(), b3BottomGeo:getMin():getY(), b3BottomGeo:getMax():getZ()), Y_AX(), -90) +EgtRotate( nBottomOutLeftProfileId, Point3d( b3BottomGeo:getMin():getX(), b3BottomGeo:getMin():getY(), b3BottomGeo:getMax():getZ()), Z_AX(), 90) +local b3BottomOutLeftProfileId = EgtGetBBoxGlob(nBottomOutLeftProfileId, GDB_BB.STANDARD) +EgtMove( nBottomOutLeftProfileId, b3BottomGeo:getMin() - b3BottomOutLeftProfileId:getMin()) +local nOutLeftProfileId = EgtGetFirstNameInGroup( nBottomOutLeftProfileId, OUTOFST) +local nBottomOutLeftProfileExtrusionId = EgtSurfTmByExtrusion( nSolidId, nOutLeftProfileId, Y_AX() * b3BottomFrameProfile:getDimY()) +EgtInvertSurf( nBottomOutLeftProfileExtrusionId) +local nExtrCopyId = EgtCopy( nBottomExtrusionId, nSolidId) +EgtSurfTmCut( nBottomExtrusionId, nBottomOutLeftProfileExtrusionId, true, false) +EgtSurfTmCut( nBottomOutLeftProfileExtrusionId, nExtrCopyId, true, false) +EgtErase( nExtrCopyId) + + + + +--local nLeftProfileId = EgtGetFirstNameInGroup( nProfileFrameId, SASH_TOP) +--local nOutLeftProfileId = EgtGetFirstNameInGroup( nLeftProfileId, OUTOFST) +--local nBottomOutLeftProfileId = EgtCopy( nOutLeftProfileId, nFrameProfileId) +--EgtRotate( nBottomOutLeftProfileId, Point3d( b3BottomGeo:getMin():getX(), b3BottomGeo:getMin():getY(), b3BottomGeo:getMax():getZ()), Y_AX(), -90) +--EgtRotate( nBottomOutLeftProfileId, Point3d( b3BottomGeo:getMin():getX(), b3BottomGeo:getMin():getY(), b3BottomGeo:getMax():getZ()), Z_AX(), 90) +--local b3BottomOutLeftProfileId = EgtGetBBox(nBottomOutLeftProfileId, GDB_BB.STANDARD) +--EgtMove( nBottomOutLeftProfileId, b3BottomGeo:getMin() - b3BottomOutLeftProfileId:getMin()) +--local nBottomOutLeftProfileExtrusionId = EgtSurfTmByExtrusion( nSolidId, nBottomOutLeftProfileId, Y_AX() * b3BottomFrameProfile:getDimY()) +--EgtSurfTmCut( nBottomOutLeftProfileExtrusionId, nBottomExtrusionId, true, false) +--EgtSurfTmCut( nBottomExtrusionId, nBottomOutLeftProfileExtrusionId, false, false) + + + + diff --git a/Profiles/Main - 2023-06-26.lua b/Profiles/Main - 2023-06-26.lua new file mode 100644 index 0000000..487d146 --- /dev/null +++ b/Profiles/Main - 2023-06-26.lua @@ -0,0 +1,337 @@ +-- +-- EEEEEEEEEE GGGGGG TTTTTTTTTTTTTT +-- EEEEEEEEEE GGGGGGGGGG TTTTTTTTTTTTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEEEEEEEE GGGGGGGGGG TTTT +-- EEEEEEEEEE GGGGGG TTTT +-- +-- by Egalware s.r.l. +-- Window project software by Egalware s.r.l. 2023/05/02 + +require( 'EgtBase') +_ENV = EgtProtectGlobal() +EgtEnableDebug( true) + +---- Imposto direttorio libreria specializzata per Nesting +--local sBaseDir = EgtGetSourceDir() +--EgtOutLog("BaseDir=" .. sBaseDir) +--EgtAddToPackagePath( sBaseDir .. '?.lua') + +-- local Config = require( 'Config') + +------------------------------------------- PARAMETERS ------------------------------------------- +local DebugCode = false + +-- Tipi di giunzioni (joint) +JNT = { + ANGLED = 1, + CP_H = 2, + CP_V = 3, + CP_M = 4 +} + +-- Tipi di profilo +PRF = { + NULL = 0, + TOP = 1, + BOTTOM = 2, + LEFT = 3, + RIGHT = 4, + VERTICAL = 5, + HORIZONTAL = 6 +} + +local CUT_SURF_EPS_SMALL = 0.05 + +local PROFILE = 'Profile' +local FRAME = 'Frame' +local OUTLINE = 'Outline' +local GEO = 'Geo' +local SOLID = 'Solid' +local BOTTOM = 'Bottom' +local RIGHT = 'Right' +local TOP = 'Top' +local LEFT = 'Left' + +local SASH_TOP = 'Sash_Top' +local SASH_BOTTOM = 'Sash_Bottom' +local FIXED_TOP = 'Fixed_Top' +local FIXED_BOTTOM = 'Fixed_Bottom' + +local REF = 'Ref' +local SECTION = 'Section' +local ALU = 'Alu' +local CTRIN = 'CtrIn' +local OUT = 'Out' +local OUTOFST = 'OutOfst' + +local HoleHeight = 1200 +local HoleWidth = 1200 + +local WindowWidth = 1200 +local WindowHeight = 1200 + +local WindowTree + +local sProfilePath = 'c:\\EgtData\\Window\\Profiles\\Profilo78 - Offset.nge' + +------------------------------------------- ************** ------------------------------------------- + +-- funzioni + +-- funzione che restituisce BBox del Ref del profilo +local function GetRefWithBBoxFromProfile( nProfileFrameLayerId, sProfileType) + local nProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, sProfileType) + local nProfileRefId = EgtGetFirstNameInGroup( nProfileId, REF) + local b3Ref = EgtGetBBox( nProfileRefId, GDB_BB.STANDARD) + return nProfileId, b3Ref +end + +-- funzione che restituisce ref e calcola delta controprofilo dal profilo passatogli +local function GetDeltaProfile( nProfileFrameLayerId, sProfileType) + local nProfileId, b3Ref = GetRefWithBBoxFromProfile( nProfileFrameLayerId, sProfileType) + local nCPId = EgtGetFirstNameInGroup( nProfileId, CTRIN) + local b3CP = EgtGetBBox( nCPId, GDB_BB.STANDARD) + local dCPDelta = b3Ref:getDimY() - b3CP:getDimY() + return dCPDelta, b3Ref +end + +-- funzione che calcola l'ingombro dei pezzi del telaio +local function CalcFrameFootPrint( nProfileFrameLayerId, nId, nGeoId) + -- ricavo tipo dal nome + local sName = EgtGetName( nId) + local nProfileType = PRF.NULL + if sName == TOP then + nProfileType = PRF.TOP + elseif sName == BOTTOM then + nProfileType = PRF.BOTTOM + elseif sName == LEFT then + nProfileType = PRF.LEFT + elseif sName == RIGHT then + nProfileType = PRF.RIGHT + end + local p3FrameStart = EgtSP( nId) + local p3FrameEnd = EgtEP( nId) + local nNewGeoId + if nProfileType == PRF.TOP then + -- recupero ref e controprofilo del top e calcolo delta + local _, b3TopRef = GetRefWithBBoxFromProfile( nProfileFrameLayerId, SASH_TOP) + nNewGeoId = EgtRectangle2P( nGeoId, p3FrameEnd - Y_AX() * b3TopRef:getDimY(), p3FrameStart) + EgtModifyCurveExtrusion( nNewGeoId, Z_AX()) + EgtModifyCurveThickness( nNewGeoId, -b3TopRef:getDimX()) + EgtSetName( nNewGeoId, TOP) + elseif nProfileType == PRF.BOTTOM then + local _, b3BottomRef = GetRefWithBBoxFromProfile( nProfileFrameLayerId, SASH_BOTTOM) + nNewGeoId = EgtRectangle2P( nGeoId, p3FrameStart, p3FrameEnd + Y_AX() * b3BottomRef:getDimY()) + EgtModifyCurveExtrusion( nNewGeoId, Z_AX()) + EgtModifyCurveThickness( nNewGeoId, -b3BottomRef:getDimX()) + EgtSetName( nNewGeoId, BOTTOM) + elseif nProfileType == PRF.LEFT then + -- recupero ref e controprofilo del top e calcolo delta + local dTopCPDelta, b3TopRef = GetDeltaProfile( nProfileFrameLayerId, SASH_TOP) + -- recupero ref e controprofilo del bottom e calcolo delta + local dBottomCPDelta, b3BottomRef = GetDeltaProfile( nProfileFrameLayerId, SASH_BOTTOM) + -- creo rettangolo ingombro + nNewGeoId = EgtRectangle2P( nGeoId, p3FrameEnd + Y_AX() * dBottomCPDelta , p3FrameStart + X_AX() * b3TopRef:getDimY() - Y_AX() * dTopCPDelta) + EgtModifyCurveExtrusion( nNewGeoId, Z_AX()) + EgtModifyCurveThickness( nNewGeoId, -b3TopRef:getDimX()) + EgtSetName( nNewGeoId, LEFT) + elseif nProfileType == PRF.RIGHT then + -- recupero ref e controprofilo del top e calcolo delta + local dTopCPDelta, b3TopRef = GetDeltaProfile( nProfileFrameLayerId, SASH_TOP) + -- recupero ref e controprofilo del bottom e calcolo delta + local dBottomCPDelta, b3BottomRef = GetDeltaProfile( nProfileFrameLayerId, SASH_BOTTOM) + -- creo rettangolo ingombro + nNewGeoId = EgtRectangle2P( nGeoId, p3FrameStart - X_AX() * b3TopRef:getDimY() + Y_AX() * dBottomCPDelta , p3FrameEnd - Y_AX() * dTopCPDelta) + EgtModifyCurveExtrusion( nNewGeoId, Z_AX()) + EgtModifyCurveThickness( nNewGeoId, -b3TopRef:getDimX()) + EgtSetName( nNewGeoId, RIGHT) + end +end + +-- funzione che calcola l'ingombro dei pezzi del telaio +local function CalcFrameSolid( nProfileFrameLayerId, nGeoId, nFrameProfileLayerId, nGeoLayerId, nSolidLayerId) + -- ricavo tipo dal nome + local sName = EgtGetName( nGeoId) + local nProfileType = PRF.NULL + if sName == TOP then + nProfileType = PRF.TOP + elseif sName == BOTTOM then + nProfileType = PRF.BOTTOM + elseif sName == LEFT then + nProfileType = PRF.LEFT + elseif sName == RIGHT then + nProfileType = PRF.RIGHT + end + if nProfileType == PRF.TOP then + elseif nProfileType == PRF.BOTTOM then + local nProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, SASH_BOTTOM) + -- creo copia + local nFrameProfileId = EgtCopy( nProfileId, nFrameProfileLayerId) + local b3FrameProfile = EgtGetBBox( nFrameProfileId, GDB_BB.STANDARD) + -- recupero posizione e BBox del geo + local b3Geo = EgtGetBBox(nGeoId, GDB_BB.STANDARD) + EgtMove( nFrameProfileId, b3Geo:getMin() + Z_AX() * b3Geo:getDimZ() - Point3d( b3FrameProfile:getMax():getX(), b3FrameProfile:getMin():getY(), b3Geo:getMax():getZ())) + EgtRotate( nFrameProfileId, b3Geo:getMin() + Z_AX() * b3Geo:getDimZ(), Y_AX(), -90) + -- recupero profilo outline e lo estrudo + local nFrameOutlineId = EgtGetFirstNameInGroup( nFrameProfileId, SECTION) + local nExtrusionId = EgtSurfTmByExtrusion( nSolidLayerId, nFrameOutlineId, X_AX() * b3Geo:getDimX()) + EgtInvertSurf( nExtrusionId) + -- copio e sposto profilo out left su start bottom per tagliarlo + local nOrigStartProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, SASH_TOP) + local nStartProfileId = EgtCopy( nOrigStartProfileId, nFrameProfileLayerId) + EgtRotate( nStartProfileId, Point3d( b3Geo:getMin():getX(), b3Geo:getMin():getY(), b3Geo:getMax():getZ()), Y_AX(), -90) + EgtRotate( nStartProfileId, Point3d( b3Geo:getMin():getX(), b3Geo:getMin():getY(), b3Geo:getMax():getZ()), Z_AX(), 90) + local b3StartProfileId = EgtGetBBoxGlob(nStartProfileId, GDB_BB.STANDARD) + EgtMove( nStartProfileId, b3Geo:getMin() - b3StartProfileId:getMin()) + local nOutStartProfileId = EgtGetFirstNameInGroup( nStartProfileId, OUTOFST) + local nStartExtrusionId = EgtSurfTmByExtrusion( nSolidLayerId, nOutStartProfileId, Y_AX() * b3FrameProfile:getDimY()) + EgtInvertSurf( nStartExtrusionId) + local nExtrCopyId = EgtCopy( nExtrusionId, nSolidLayerId) + EgtSurfTmCut( nExtrusionId, nStartExtrusionId, true, false) + EgtSurfTmCut( nStartExtrusionId, nExtrCopyId, true, false) + --EgtErase( nExtrCopyId) + -- copio e sposto profilo out left su end bottom per tagliarlo + local nOrigEndProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, SASH_TOP) + local nEndProfileId = EgtCopy( nOrigEndProfileId, nFrameProfileLayerId) + EgtRotate( nEndProfileId, Point3d( b3Geo:getMin():getX(), b3Geo:getMin():getY(), b3Geo:getMax():getZ()), Y_AX(), -90) + EgtRotate( nEndProfileId, Point3d( b3Geo:getMin():getX(), b3Geo:getMin():getY(), b3Geo:getMax():getZ()), Z_AX(), -90) + local b3EndProfileId = EgtGetBBoxGlob(nEndProfileId, GDB_BB.STANDARD) + EgtMove( nEndProfileId, Point3d( b3Geo:getMax():getX(),b3Geo:getMin():getY(),b3Geo:getMin():getZ()) - Point3d( b3EndProfileId:getMax():getX(), b3EndProfileId:getMin():getY(),b3EndProfileId:getMin():getZ())) + local nOutEndProfileId = EgtGetFirstNameInGroup( nEndProfileId, OUTOFST) + local nEndExtrusionId = EgtSurfTmByExtrusion( nSolidLayerId, nOutEndProfileId, Y_AX() * b3FrameProfile:getDimY()) + --EgtInvertSurf( nBottomOutLeftProfileExtrusionId) + --local nExtrCopyId = EgtCopy( nBottomExtrusionId, nSolidLayerId) + EgtSurfTmCut( nExtrusionId, nEndExtrusionId, true, false) + EgtSurfTmCut( nEndExtrusionId, nExtrCopyId, true, false) + EgtErase( nExtrCopyId) + elseif nProfileType == PRF.LEFT then + elseif nProfileType == PRF.RIGHT then + end +end + +------------------------------------------- ************** ------------------------------------------- + +-- ciclo principale + +EgtNewFile() + +-- creo gruppo per il profilo +local nProfileId = EgtGroup( GDB_ID.ROOT) +EgtSetName( nProfileId, PROFILE) + +-- importo profilo prescelto +local bOk = EgtInsertFile( sProfilePath) + +local nGroupId = EgtGetFirstInGroup( GDB_ID.ROOT) +while nGroupId do + if nGroupId ~= nProfileId then + local nCurrId = nGroupId + nGroupId = EgtGetNext( nGroupId) + EgtRelocateGlob( nCurrId, nProfileId) + EgtSetStatus( nCurrId, GDB_ST.OFF) + else + nGroupId = EgtGetNext( nGroupId) + end +end + +-- creo struttura layer del frame +local nFrameLayerId = EgtGroup( GDB_ID.ROOT) +EgtSetName( nFrameLayerId, FRAME) +local nOutlineLayerId = EgtGroup( nFrameLayerId) +EgtSetName( nOutlineLayerId, OUTLINE) +local nGeoLayerId = EgtGroup( nFrameLayerId) +EgtSetName( nGeoLayerId, GEO) +local nSolidLayerId = EgtGroup( nFrameLayerId) +EgtSetName( nSolidLayerId, SOLID) +local nFrameProfileLayerId = EgtGroup( nFrameLayerId) +EgtSetName( nFrameProfileLayerId, PROFILE) + +-- disegno outline +local nFrameBottomId = EgtLine( nOutlineLayerId, Point3d( 0, 0, 0), Point3d( WindowWidth, 0, 0) ) +EgtSetName( nFrameBottomId, BOTTOM) +local nFrameRightId = EgtLine( nOutlineLayerId, Point3d( WindowWidth, 0, 0), Point3d( WindowWidth, WindowHeight, 0) ) +EgtSetName( nFrameRightId, RIGHT) +local nFrameTopId = EgtLine( nOutlineLayerId, Point3d( WindowWidth, WindowHeight, 0), Point3d( 0, WindowHeight, 0) ) +EgtSetName( nFrameTopId, TOP) +local nFrameLeftId = EgtLine( nOutlineLayerId, Point3d( 0, WindowHeight, 0), Point3d( 0, 0, 0) ) +EgtSetName( nFrameLeftId, LEFT) + +-- scelgo tipo di giunzioni +-- per il momento faccio controprofili verticali + + +-- scelgo il tipo +-- per il momento faccio controprofili per anta + +-- disegno ingombri frame +local nProfileFrameLayerId = EgtGetFirstNameInGroup( nProfileId, FRAME) + +local nCurrOutlineId = EgtGetFirstInGroup( nOutlineLayerId) +while nCurrOutlineId do + CalcFrameFootPrint( nProfileFrameLayerId, nCurrOutlineId, nGeoLayerId) + nCurrOutlineId = EgtGetNext( nCurrOutlineId) +end + +-- posiziono profili +local nGeoId = EgtGetFirstInGroup( nGeoLayerId) +CalcFrameSolid(nProfileFrameLayerId, nGeoId, nFrameProfileLayerId, nGeoLayerId, nSolidLayerId) + + + +---- bottom +--local nBottomProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, SASH_BOTTOM) +---- creo copia +--local nBottomFrameProfileId = EgtCopy( nBottomProfileId, nFrameProfileLayerId) +--local b3BottomFrameProfile = EgtGetBBox( nBottomFrameProfileId, GDB_BB.STANDARD) +---- recupero posizione e BBox del geo +--local nBottomGeoId = EgtGetFirstNameInGroup( nGeoId, BOTTOM) +--local b3BottomGeo = EgtGetBBox(nBottomGeoId, GDB_BB.STANDARD) +--EgtMove( nBottomFrameProfileId, b3BottomGeo:getMin() + Z_AX() * b3BottomGeo:getDimZ() - Point3d( b3BottomFrameProfile:getMax():getX(), b3BottomFrameProfile:getMin():getY(), b3BottomGeo:getMax():getZ())) +--EgtRotate( nBottomFrameProfileId, b3BottomGeo:getMin() + Z_AX() * b3BottomGeo:getDimZ(), Y_AX(), -90) +---- recupero profilo outline e lo estrudo +--local nBottomFrameOutlineId = EgtGetFirstNameInGroup( nBottomFrameProfileId, SECTION) +--local nBottomExtrusionId = EgtSurfTmByExtrusion( nSolidLayerId, nBottomFrameOutlineId, X_AX() * b3BottomGeo:getDimX()) +--EgtInvertSurf( nBottomExtrusionId) +---- copio e sposto profilo out left su start bottom per tagliarlo +--local nLeftProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, SASH_TOP) +--local nBottomOutLeftProfileId = EgtCopy( nLeftProfileId, nFrameProfileLayerId) +--EgtRotate( nBottomOutLeftProfileId, Point3d( b3BottomGeo:getMin():getX(), b3BottomGeo:getMin():getY(), b3BottomGeo:getMax():getZ()), Y_AX(), -90) +--EgtRotate( nBottomOutLeftProfileId, Point3d( b3BottomGeo:getMin():getX(), b3BottomGeo:getMin():getY(), b3BottomGeo:getMax():getZ()), Z_AX(), 90) +--local b3BottomOutLeftProfileId = EgtGetBBoxGlob(nBottomOutLeftProfileId, GDB_BB.STANDARD) +--EgtMove( nBottomOutLeftProfileId, b3BottomGeo:getMin() - b3BottomOutLeftProfileId:getMin()) +--local nOutLeftProfileId = EgtGetFirstNameInGroup( nBottomOutLeftProfileId, OUTOFST) +--local nBottomOutLeftProfileExtrusionId = EgtSurfTmByExtrusion( nSolidLayerId, nOutLeftProfileId, Y_AX() * b3BottomFrameProfile:getDimY()) +--EgtInvertSurf( nBottomOutLeftProfileExtrusionId) +--local nExtrCopyId = EgtCopy( nBottomExtrusionId, nSolidLayerId) +--EgtSurfTmCut( nBottomExtrusionId, nBottomOutLeftProfileExtrusionId, true, false) +--EgtSurfTmCut( nBottomOutLeftProfileExtrusionId, nExtrCopyId, true, false) +----EgtErase( nExtrCopyId) +---- copio e sposto profilo out left su end bottom per tagliarlo +--local nRightProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, SASH_TOP) +--local nBottomOutRightProfileId = EgtCopy( nRightProfileId, nFrameProfileLayerId) +--EgtRotate( nBottomOutRightProfileId, Point3d( b3BottomGeo:getMin():getX(), b3BottomGeo:getMin():getY(), b3BottomGeo:getMax():getZ()), Y_AX(), -90) +--EgtRotate( nBottomOutRightProfileId, Point3d( b3BottomGeo:getMin():getX(), b3BottomGeo:getMin():getY(), b3BottomGeo:getMax():getZ()), Z_AX(), -90) +--local b3BottomOutRightProfileId = EgtGetBBoxGlob(nBottomOutRightProfileId, GDB_BB.STANDARD) +--EgtMove( nBottomOutRightProfileId, Point3d( b3BottomGeo:getMax():getX(),b3BottomGeo:getMin():getY(),b3BottomGeo:getMin():getZ()) - Point3d( b3BottomOutRightProfileId:getMax():getX(), b3BottomOutRightProfileId:getMin():getY(),b3BottomOutRightProfileId:getMin():getZ())) +--local nOutRightProfileId = EgtGetFirstNameInGroup( nBottomOutRightProfileId, OUTOFST) +--local nBottomOutRightProfileExtrusionId = EgtSurfTmByExtrusion( nSolidLayerId, nOutRightProfileId, Y_AX() * b3BottomFrameProfile:getDimY()) +----EgtInvertSurf( nBottomOutLeftProfileExtrusionId) +----local nExtrCopyId = EgtCopy( nBottomExtrusionId, nSolidLayerId) +--EgtSurfTmCut( nBottomExtrusionId, nBottomOutRightProfileExtrusionId, true, false) +--EgtSurfTmCut( nBottomOutRightProfileExtrusionId, nExtrCopyId, true, false) +--EgtErase( nExtrCopyId) + + + + + + + + + diff --git a/Profiles/Main - 2023-07-05.lua b/Profiles/Main - 2023-07-05.lua new file mode 100644 index 0000000..f83f3f7 --- /dev/null +++ b/Profiles/Main - 2023-07-05.lua @@ -0,0 +1,227 @@ +-- +-- EEEEEEEEEE GGGGGG TTTTTTTTTTTTTT +-- EEEEEEEEEE GGGGGGGGGG TTTTTTTTTTTTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEEEEEEEE GGGGGGGGGG TTTT +-- EEEEEEEEEE GGGGGG TTTT +-- +-- by Egalware s.r.l. +-- Window project software by Egalware s.r.l. 2023/05/02 + +require( 'EgtBase') +_ENV = EgtProtectGlobal() +EgtEnableDebug( true) +--EgtEnableDebug( false) + +-- Imposto direttorio per librerie +local sBaseDir = EgtGetSourceDir() +EgtOutLog("BaseDir=" .. sBaseDir) +EgtAddToPackagePath( sBaseDir .. '?.lua') + +_G.package.loaded.WinConst = nil +require( 'WinConst') +_G.package.loaded.WinLib = nil +local WinLib = require( 'WinLib') + +------------------------------------------- PARAMETERS ------------------------------------------- +local DebugCode = false + +local HoleWidth = 1835 +local HoleHeight = 1516 + +local WindowWidth = 1800 +local WindowHeight = 1500 + +local WindowTree + +local sProfilePath = 'c:\\EgtData\\Window\\Profiles\\Profilo78 - Offset.nge' + +------------------------------------------- ************** ------------------------------------------- + +-- funzioni + +local function CreatePartFromArea( nAreaId) + -- creo pezzi outline + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_OUTLINE) + local nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) + while nOutlineId do + WinLib.CreatePartFromOutline( nAreaId, nOutlineId) + nOutlineId = EgtGetNext( nOutlineId) + end + -- verifico se c'e' uno split + local nSplitLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_SPLIT) + if nSplitLayerId then + local nSplitId = EgtGetFirstInGroup( nSplitLayerId) + if nSplitId then + -- creo pezzo split + WinLib.CreatePartFromOutline( nAreaId, nSplitId) + end + end + -- verifico se ci sono aree + local nArea1Id = EgtGetFirstNameInGroup( nAreaId, WIN_AREA1) + if nArea1Id then + -- lancio costruzione pezzi di quell'area + CreatePartFromArea(nArea1Id) + end + local nArea2Id = EgtGetFirstNameInGroup( nAreaId, WIN_AREA1) + if nArea1Id then + -- lancio costruzione pezzi di quell'area + CreatePartFromArea(nArea1Id) + end +end + +------------------------------------------- ************** ------------------------------------------- + +-- ciclo principale + +EgtNewFile() + +-- creo gruppo per il profilo +local nProfileId = EgtGroup( GDB_ID.ROOT) +EgtSetName( nProfileId, WIN_PROFILE) + +-- importo profilo prescelto +local bOk = EgtInsertFile( sProfilePath) + +local nGroupId = EgtGetFirstInGroup( GDB_ID.ROOT) +while nGroupId do + if nGroupId ~= nProfileId then + local nCurrId = nGroupId + nGroupId = EgtGetNext( nGroupId) + EgtRelocateGlob( nCurrId, nProfileId) + EgtSetStatus( nCurrId, GDB_ST.OFF) + else + nGroupId = EgtGetNext( nGroupId) + end +end + +-- creo buco +local nHoleLayerId = WinLib.CreateHole( HoleWidth, HoleHeight) + +-- creo frame come buco +WinLib.CreateFrameAsHole( nHoleLayerId, WIN_JNT.FULL_H) + +local nSashId = WinLib.AddSash( nHoleLayerId) + +local nFillId = WinLib.AddFill( nSashId, 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) +-- creo tutti i pezzi +CreatePartFromArea( nHoleLayerId) + + + + + + + + +-- assemblo i pezzi +--WinLib.AssembleFrame() + +EgtDraw() \ No newline at end of file diff --git a/Profiles/Main.lua b/Profiles/Main.lua new file mode 100644 index 0000000..84c9afb --- /dev/null +++ b/Profiles/Main.lua @@ -0,0 +1,644 @@ +-- +-- EEEEEEEEEE GGGGGG WW WW WW +-- EEEEEEEEEE GGGGGGGGGG WW WW WW +-- EEEE GGGG GGGG WW WW WW +-- EEEE GGGG WWW WWWW WWW +-- EEEEEEE GGGG GGGGGGG WW WWWW WW +-- EEEEEEE GGGG GGGGGGG WWW WWWW WWW +-- EEEE GGGG GGGG WWWW WWWW +-- EEEE GGGG GGGG WWWW WWWW +-- EEEEEEEEEE GGGGGGGGGG WWW WWW +-- EEEEEEEEEE GGGGGG WW WW +-- +-- by Egalware s.r.l. +-- Window project software by Egalware s.r.l. 2023/05/02 + +require( 'EgtBase') +_ENV = EgtProtectGlobal() +EgtEnableDebug( true) +-- EgtEnableDebug( false) + +-- Imposto direttorio per librerie +local sBaseDir = EgtGetSourceDir() +EgtOutLog("BaseDir=" .. sBaseDir) +EgtAddToPackagePath( sBaseDir .. '?.lua') +EgtAddToPackagePath( sBaseDir .. 'WinLib\\' .. '?.lua') + +_G.package.loaded.WinConst = nil +require( 'WinConst') +_G.package.loaded.WinCreate = nil +local WinCreate = require( 'WinCreate') +_G.package.loaded.WinCalculate = nil +local WinCalculate = require( 'WinCalculate') +_G.package.loaded.WinManageProject = nil +local WinManageProject = require( 'WinManageProject') + +------------------------------------------- PARAMETERS ------------------------------------------- +local DebugCode = false + +local HoleWidth = 1835 +local HoleHeight = 1516 + +local WindowWidth = 1800 +local WindowHeight = 1500 + +local WindowTree + +local sProfilePath = 'c:\\EgtData\\Window\\Profiles\\Profilo78 - Offset.nge' + +------------------------------------------- ************** ------------------------------------------- + +-- ciclo principale + +EgtStartCounter() + +EgtNewFile() + +-- importo profilo prescelto +WinCreate.ImportProfile( sProfilePath) + +-- creo telaio rettangolare +local FrameJointType = WIN_JNT.FULL_H +local nFrameId = WinCreate.CreateFrame( WindowWidth, WindowHeight, FrameJointType, FrameJointType, FrameJointType, FrameJointType) + +-- -- 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 ------------------------ + +-- -- aggiungo zoccolo +-- WinCreate.AddBottomRail( nFrameId) +-- -- aggiungo vetro +-- local nFillId = WinCreate.AddFill( nFrameId, WIN_FILLTYPES.GLASS) + +------------------------ Finestra vetro fisso con divisione orizzontale ------------------------ + +-- -- aggiungo zoccolo +-- WinCreate.AddBottomRail( nFrameId) + +-- -- definisco prima divisione +-- local nArea1Id, nArea2Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight / 2) + +-- -- aggiungo vetri +-- local nFill1Id = WinCreate.AddFill( nArea1Id, WIN_FILLTYPES.GLASS) +-- local nFill2Id = WinCreate.AddFill( nArea2Id, WIN_FILLTYPES.GLASS) + +------------------------ Finestra vetro fisso con divisione verticale ------------------------ + +-- -- aggiungo zoccolo +-- WinCreate.AddBottomRail( nFrameId) + +-- -- definisco prima divisione +-- local nArea1Id, nArea2Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 2) + +-- -- aggiungo vetri +-- local nFill1Id = WinCreate.AddFill( nArea1Id, WIN_FILLTYPES.GLASS) +-- local nFill2Id = WinCreate.AddFill( nArea2Id, WIN_FILLTYPES.GLASS) + +------------------------ Finestra vetro fisso con divisione orizzontale e verticale ------------------------ + +-- -- aggiungo zoccolo +-- WinCreate.AddBottomRail( nFrameId) + +-- -- definisco divisioni +-- local nArea1Id, nArea2Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 2) +-- local nArea11Id, nArea12Id = WinCreate.AddSplit( nArea1Id, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight / 2) +-- local nArea21Id, nArea22Id = WinCreate.AddSplit( nArea2Id, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight / 2) + +-- -- aggiungo vetri +-- local nFill1Id = WinCreate.AddFill( nArea11Id, WIN_FILLTYPES.GLASS) +-- local nFill2Id = WinCreate.AddFill( nArea12Id, WIN_FILLTYPES.GLASS) +-- local nFill3Id = WinCreate.AddFill( nArea21Id, WIN_FILLTYPES.GLASS) +-- local nFill4Id = WinCreate.AddFill( nArea22Id, WIN_FILLTYPES.GLASS) + +-- ------------------------ Finestra anta singola ------------------------ + +-- aggiungo anta +local SashJointType = WIN_JNT.FULL_V +local nSashId = WinCreate.AddSash( nFrameId, SashJointType, SashJointType, SashJointType, SashJointType) + +-- aggiungo vetro +local nFillId = WinCreate.AddFill( nSashId, 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) + +-- -- definisco prima divisione +-- local nArea1Id, nArea2Id = WinCreate.AddSplit( nSashId, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight / 3) + +-- -- aggiungo vetri +-- local nFill1Id = WinCreate.AddFill( nArea1Id, WIN_FILLTYPES.GLASS) +-- local nFill2Id = WinCreate.AddFill( nArea2Id, 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) + +-- -- definisco prima divisione +-- local nArea1Id, nArea2Id = WinCreate.AddSplit( nSashId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 2) + +-- -- aggiungo vetri +-- local nFill1Id = WinCreate.AddFill( nArea1Id, WIN_FILLTYPES.GLASS) +-- local nFill2Id = WinCreate.AddFill( nArea2Id, 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) + +-- -- definisco divisioni +-- local nArea1Id, nArea2Id = WinCreate.AddSplit( nSashId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 2) +-- local nArea11Id, nArea12Id = WinCreate.AddSplit( nArea1Id, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight / 2) +-- local nArea21Id, nArea22Id = WinCreate.AddSplit( nArea2Id, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight / 2) + +-- -- aggiungo vetri +-- local nFill1Id = WinCreate.AddFill( nArea11Id, WIN_FILLTYPES.GLASS) +-- local nFill2Id = WinCreate.AddFill( nArea12Id, WIN_FILLTYPES.GLASS) +-- local nFill3Id = WinCreate.AddFill( nArea21Id, WIN_FILLTYPES.GLASS) +-- local nFill4Id = WinCreate.AddFill( nArea22Id, 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 nTempSplitLayerId = EgtGroup( nFrameId) +-- EgtSetName( nTempSplitLayerId, WIN_TEMPSPLIT) + +-- -- creo decoro +-- local nRectangleId = EgtRectangle2P( nTempSplitLayerId, Point3d( WindowWidth / 3, WindowHeight / 3, 0), Point3d( WindowWidth * 2 / 3, WindowHeight * 2 / 3, 0)) + + +-- -- definisco prima divisione +-- local nArea1Id, nArea2Id = WinCreate.AddGenSplit( nSashId, nRectangleId) + +-- EgtErase( nTempSplitLayerId) + +-- -- aggiungo vetri +-- local nFill1Id = WinCreate.AddFill( nArea1Id, WIN_FILLTYPES.GLASS) +-- local nFill2Id = WinCreate.AddFill( nArea2Id, WIN_FILLTYPES.GLASS) + +------------------------ Finestra doppia anta con montante verticale ------------------------ + +-- -- definisco prima divisione +-- 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) + +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) + +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea2Id, SashJointType, SashJointType, SashJointType, SashJointType) + +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) + +------------------------ Finestra doppia anta battente ricevente ------------------------ + +-- -- definisco prima divisione +-- 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) + +-- -- 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) + +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) + +------------------------ Finestra doppia anta con montante orizzontale ------------------------ + +-- -- 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) + +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) + +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea2Id, SashJointType, SashJointType, SashJointType, SashJointType) + +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) + +------------------------ Finestra tripla anta con montanti verticali ------------------------ + +-- -- definisco prima divisione +-- local nArea1Id, nArea2Id = 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) + +-- -- aggiungo prima anta +-- local SashJointType = WIN_JNT.FULL_V +-- local nSash1Id = WinCreate.AddSash( nArea1Id, SashJointType, SashJointType, SashJointType, SashJointType) + +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) + +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea2Id, SashJointType, SashJointType, SashJointType, SashJointType) + +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) + +-- -- aggiungo terza anta +-- local nSash3Id = WinCreate.AddSash( nArea3Id, SashJointType, SashJointType, SashJointType, SashJointType) + +-- -- 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, nArea2Id = 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) + +-- -- aggiungo prima anta +-- local SashJointType = WIN_JNT.FULL_V +-- local nSash1Id = WinCreate.AddSash( nArea1Id, SashJointType, SashJointType, SashJointType, SashJointType) + +-- -- 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) + +-- -- 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) + +-- -- 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) + +-- -- definisco seconda divisione +-- local nArea2Id, nArea3Id = WinCreate.AddSplit( nArea2Id, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight / 3) + +-- -- aggiungo prima anta +-- local SashJointType = WIN_JNT.FULL_V +-- local nSash1Id = WinCreate.AddSash( nArea1Id, SashJointType, SashJointType, SashJointType, SashJointType) + +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) + +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea2Id, SashJointType, SashJointType, SashJointType, SashJointType) + +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) + +-- -- aggiungo terza anta +-- local nSash3Id = WinCreate.AddSash( nArea3Id, SashJointType, SashJointType, SashJointType, SashJointType) + +-- -- 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) + +-- -- aggiungo prima anta +-- local SashJointType = WIN_JNT.FULL_V +-- local nSash1Id = WinCreate.AddSash( nArea1Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) + +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea2Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) + +-- -- aggiungo terza anta +-- local nSash3Id = WinCreate.AddSash( nArea3Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- -- aggiungo vetro +-- local nFill3Id = WinCreate.AddFill( nSash3Id, 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 nArea21Id, nArea22Id = WinCreate.AddSplit( nArea21Id, 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) +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) + +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea12Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) + +-- -- aggiungo terza anta +-- local nSash3Id = WinCreate.AddSash( nArea13Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- -- aggiungo vetro +-- local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) + +-- -- aggiungo quarta anta +-- local nSash4Id = WinCreate.AddSash( nArea21Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- -- aggiungo vetro +-- local nFill4Id = WinCreate.AddFill( nSash4Id, WIN_FILLTYPES.GLASS) + +-- -- aggiungo quinta anta +-- local nSash5Id = WinCreate.AddSash( nArea22Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- -- aggiungo vetro +-- local nFill5Id = WinCreate.AddFill( nSash5Id, WIN_FILLTYPES.GLASS) + +-- -- aggiungo sesta anta +-- local nSash6Id = WinCreate.AddSash( nArea23Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- -- aggiungo vetro +-- local nFill6Id = WinCreate.AddFill( nSash6Id, WIN_FILLTYPES.GLASS) + +------------------------ Finestra sei ante con montante verticale e orizzontale ed ante battente ricevente ------------------------ + +-- -- 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) + +-- -- aggiungo prima anta +-- local SashJointType = WIN_JNT.FULL_V +-- local nSash1Id = WinCreate.AddSash( nArea11Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- -- 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) +-- -- 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) +-- -- 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) +-- -- 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) +-- -- aggiungo vetro +-- local nFill5Id = WinCreate.AddFill( nSash5Id, WIN_FILLTYPES.GLASS) + +-- -- aggiungo sesta anta +-- local nSash6Id = WinCreate.AddSash( nArea23Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- -- 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) + +-- -- definisco seconda divisione +-- local nArea2Id, nArea3Id = WinCreate.AddSplit( nArea2Id, 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) +-- -- 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) +-- -- 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) +-- -- definisco divisione +-- local nArea31Id, nArea32Id = WinCreate.AddSplit( nSash3Id, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight * 2 / 5) +-- -- aggiungo vetri +-- local nFill31Id = WinCreate.AddFill( nArea31Id, WIN_FILLTYPES.GLASS) +-- local nFill32Id = WinCreate.AddFill( nArea32Id, 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) + +-- -- aggiungo anta sopra +-- local SashJointType = WIN_JNT.FULL_V +-- local nSash0Id = WinCreate.AddSash( nArea0Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- -- 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) +-- -- 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) +-- -- 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) +-- -- definisco divisione +-- local nArea31Id, nArea32Id = WinCreate.AddSplit( nSash3Id, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight * 2 / 5) +-- -- aggiungo vetri +-- local nFill31Id = WinCreate.AddFill( nArea31Id, WIN_FILLTYPES.GLASS) +-- local nFill32Id = WinCreate.AddFill( nArea32Id, 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) + +-- imposto se calcolare i solidi o meno +WinCalculate.SetCalcSolid( true) + +-- -- creo i pezzi +WinCalculate.CreatePartFromArea( nFrameId) + + +-- -- creo tabella per salvataggio +-- local sSaveFilePath = 'c:\\Temp\\WindowTest1.txt' +-- local WinTable = WinManageProject.WriteToFile( nFrameId, sSaveFilePath) + + + + + +-- assemblo i pezzi +--WinLib.AssembleFrame() + +EgtZoom( SCE_ZM.ALL) + +-- riporto tempi di esecuzione +local sOut = string.format( ' ExecTime = %.2f ms', EgtStopCounter()) +EgtOutLog( sOut) diff --git a/Profiles/Profilo78 - Copy (2).nge b/Profiles/Profilo78 - Copy (2).nge new file mode 100644 index 0000000..b2c67c8 Binary files /dev/null and b/Profiles/Profilo78 - Copy (2).nge differ diff --git a/Profiles/Profilo78 - Copy (3).nge b/Profiles/Profilo78 - Copy (3).nge new file mode 100644 index 0000000..d4d7d96 Binary files /dev/null and b/Profiles/Profilo78 - Copy (3).nge differ diff --git a/Profiles/Profilo78 - Copy.nge b/Profiles/Profilo78 - Copy.nge new file mode 100644 index 0000000..9fd5a34 Binary files /dev/null and b/Profiles/Profilo78 - Copy.nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (10).nge b/Profiles/Profilo78 - Offset - Copy (10).nge new file mode 100644 index 0000000..163d7a6 Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (10).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (11).nge b/Profiles/Profilo78 - Offset - Copy (11).nge new file mode 100644 index 0000000..5b8cdae Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (11).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (12).nge b/Profiles/Profilo78 - Offset - Copy (12).nge new file mode 100644 index 0000000..d6476a9 Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (12).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (13).nge b/Profiles/Profilo78 - Offset - Copy (13).nge new file mode 100644 index 0000000..5f03975 Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (13).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (14).nge b/Profiles/Profilo78 - Offset - Copy (14).nge new file mode 100644 index 0000000..ca5ef25 Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (14).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (15).nge b/Profiles/Profilo78 - Offset - Copy (15).nge new file mode 100644 index 0000000..2cf66b2 Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (15).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (16).nge b/Profiles/Profilo78 - Offset - Copy (16).nge new file mode 100644 index 0000000..93f18b9 Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (16).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (17).nge b/Profiles/Profilo78 - Offset - Copy (17).nge new file mode 100644 index 0000000..3ca605c Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (17).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (18).nge b/Profiles/Profilo78 - Offset - Copy (18).nge new file mode 100644 index 0000000..a278554 Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (18).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (19).nge b/Profiles/Profilo78 - Offset - Copy (19).nge new file mode 100644 index 0000000..79f86db Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (19).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (2).nge b/Profiles/Profilo78 - Offset - Copy (2).nge new file mode 100644 index 0000000..71ede3a Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (2).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (20).nge b/Profiles/Profilo78 - Offset - Copy (20).nge new file mode 100644 index 0000000..c90b751 Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (20).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (21).nge b/Profiles/Profilo78 - Offset - Copy (21).nge new file mode 100644 index 0000000..f1cc3a0 Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (21).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (22).nge b/Profiles/Profilo78 - Offset - Copy (22).nge new file mode 100644 index 0000000..006d3b2 Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (22).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (23).nge b/Profiles/Profilo78 - Offset - Copy (23).nge new file mode 100644 index 0000000..fd217e0 Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (23).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (24).nge b/Profiles/Profilo78 - Offset - Copy (24).nge new file mode 100644 index 0000000..eab4e24 Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (24).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (25).nge b/Profiles/Profilo78 - Offset - Copy (25).nge new file mode 100644 index 0000000..52984ec Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (25).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (26).nge b/Profiles/Profilo78 - Offset - Copy (26).nge new file mode 100644 index 0000000..29183d6 Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (26).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (27).nge b/Profiles/Profilo78 - Offset - Copy (27).nge new file mode 100644 index 0000000..29183d6 Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (27).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (28).nge b/Profiles/Profilo78 - Offset - Copy (28).nge new file mode 100644 index 0000000..1913109 Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (28).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (29).nge b/Profiles/Profilo78 - Offset - Copy (29).nge new file mode 100644 index 0000000..f35288e Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (29).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (3).nge b/Profiles/Profilo78 - Offset - Copy (3).nge new file mode 100644 index 0000000..0551c82 Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (3).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (30).nge b/Profiles/Profilo78 - Offset - Copy (30).nge new file mode 100644 index 0000000..f35288e Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (30).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (31).nge b/Profiles/Profilo78 - Offset - Copy (31).nge new file mode 100644 index 0000000..46d4eb5 Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (31).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (32).nge b/Profiles/Profilo78 - Offset - Copy (32).nge new file mode 100644 index 0000000..f44be83 Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (32).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (33).nge b/Profiles/Profilo78 - Offset - Copy (33).nge new file mode 100644 index 0000000..e7d7bee Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (33).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (34).nge b/Profiles/Profilo78 - Offset - Copy (34).nge new file mode 100644 index 0000000..0eb915c Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (34).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (4).nge b/Profiles/Profilo78 - Offset - Copy (4).nge new file mode 100644 index 0000000..2728992 Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (4).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (5).nge b/Profiles/Profilo78 - Offset - Copy (5).nge new file mode 100644 index 0000000..a6e2cd2 Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (5).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (6).nge b/Profiles/Profilo78 - Offset - Copy (6).nge new file mode 100644 index 0000000..7ca377c Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (6).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (7).nge b/Profiles/Profilo78 - Offset - Copy (7).nge new file mode 100644 index 0000000..52ee4e1 Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (7).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (8).nge b/Profiles/Profilo78 - Offset - Copy (8).nge new file mode 100644 index 0000000..988fbc6 Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (8).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (9).nge b/Profiles/Profilo78 - Offset - Copy (9).nge new file mode 100644 index 0000000..e242eac Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (9).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy.nge b/Profiles/Profilo78 - Offset - Copy.nge new file mode 100644 index 0000000..9fa9760 Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy.nge differ diff --git a/Profiles/Profilo78 - Offset.nge b/Profiles/Profilo78 - Offset.nge new file mode 100644 index 0000000..aba1ec7 Binary files /dev/null and b/Profiles/Profilo78 - Offset.nge differ diff --git a/Profiles/Profilo78 - Offset.ok.nge b/Profiles/Profilo78 - Offset.ok.nge new file mode 100644 index 0000000..d6476a9 Binary files /dev/null and b/Profiles/Profilo78 - Offset.ok.nge differ diff --git a/Profiles/Profilo78.nge b/Profiles/Profilo78.nge new file mode 100644 index 0000000..5461fb5 Binary files /dev/null and b/Profiles/Profilo78.nge differ diff --git a/Profiles/Test Salvataggio.nge b/Profiles/Test Salvataggio.nge new file mode 100644 index 0000000..29fd2b8 Binary files /dev/null and b/Profiles/Test Salvataggio.nge differ diff --git a/Profiles/Test Salvataggio2.nge b/Profiles/Test Salvataggio2.nge new file mode 100644 index 0000000..1b3d0f4 Binary files /dev/null and b/Profiles/Test Salvataggio2.nge differ diff --git a/Profiles/TestAreas.nge b/Profiles/TestAreas.nge new file mode 100644 index 0000000..597e333 Binary files /dev/null and b/Profiles/TestAreas.nge differ diff --git a/Profiles/WinConst.lua b/Profiles/WinConst.lua new file mode 100644 index 0000000..69eb91e --- /dev/null +++ b/Profiles/WinConst.lua @@ -0,0 +1,211 @@ +-- +-- EEEEEEEEEE GGGGGG TTTTTTTTTTTTTT +-- EEEEEEEEEE GGGGGGGGGG TTTTTTTTTTTTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEEEEEEEE GGGGGGGGGG TTTT +-- EEEEEEEEEE GGGGGG TTTT +-- +-- by Egalware s.r.l. +-- Window project software by Egalware s.r.l. 2023/05/02 + +-- Tabella per definizione modulo +local WinConst = {} + +------------------------------------------- PARAMETERS ------------------------------------------- + +-- Tipi di giunzioni (joint) +WIN_JNT = { + ANGLED = 1, + FULL_H = 2, + FULL_V = 3, +} + +-- tipo di giunzione pezzo +WIN_PART_JNT = { + ANGLED = 1, + FULL = 2, + SHORT = 3, +} + +-- Tipi di profilo +WIN_PRF = { + NULL = 0, + TOP = 1, + BOTTOM = 2, + LEFT = 3, + RIGHT = 4, + VERTICAL = 5, + HORIZONTAL = 6, + SPLIT = 7, + BOTTOMRAIL = 8, +} + +-- Tipi di split +WIN_SPLITORIENTATION = { + VERTICAL = 1, + HORIZONTAL = 2, +} + +-- Tipi di misure +WIN_MEASURE = { + ABSOLUT = 1, + PROPORTIONAL = 2, +} + +-- tipo di Area +WIN_AREATYPES = { + NULL = 0, + FRAME = 1, + SASH = 2, + FILL = 3, + SPLIT = 4, +} + +-- tipo di split: +-- mullion = montante +-- french = battente / ricevente +WIN_SPLITTYPES = { + NULL = 0, + MULLION = 1, + FRENCH = 2, +} + +-- tipi di riempimento interno +WIN_FILLTYPES = { + NULL = 0, + GLASS = 1, + WOOD = 2, +} + +-- tipi di sash battente e ricevente +WIN_SASHTYPES = { + NULL = 0, + ACTIVE = 1, + INACTIVE = 2, +} + +WIN_SURF_APPROX = 0.05 + +WIN_PROFILE = 'Profile' +WIN_PROFILEPATH = 'ProfilePath' + +WIN_FRAME = 'Frame' +WIN_AREAOUTLINE = 'BaseOutline' +WIN_OUTLINE = 'Outline' +WIN_ORIGOUTLINE = 'OrigOutline' +WIN_GEO = 'Geo' +WIN_SOLID = 'Solid' +WIN_BOTTOM = 'Bottom' +WIN_RIGHT = 'Right' +WIN_TOP = 'Top' +WIN_LEFT = 'Left' +WIN_HORIZONTAL = 'Horizontal' +WIN_VERTICAL = 'Vertical' +WIN_BASESPLIT = 'BaseSplit' +WIN_TEMPSPLIT = 'TempSplit' +WIN_SPLIT = 'Split' +WIN_AREA = 'Area' +WIN_AREAASTERISK = 'Area*' +WIN_AREA1 = 'Area1' +WIN_AREA2 = 'Area2' +WIN_AREATYPE = 'AreaType' +WIN_SASH = 'Sash' +WIN_FILL = 'Fill' +WIN_FILLTYPE = 'FillType' +WIN_SIDE = 'Side' +WIN_SPLITTYPE = 'SplitType' +WIN_STARTJOINT = 'StartJoint' +WIN_ENDJOINT = 'EndJoint' +WIN_SASHTYPE = 'SashType' +WIN_REF_OUTLINE = 'OutlineRef' +WIN_REF_PART = 'PartRef' + +WIN_SASH_TOP = 'Sash_Top' +WIN_SASH_BOTTOM = 'Sash_Bottom' +WIN_SASH_VERTICAL = 'Sash_Vertical' +WIN_SASH_HORIZONTAL = 'Sash_Horizontal' +WIN_RAIL_BOTTOM = 'Rail_Bottom' +WIN_FRAME_TOP = 'Frame_Top' +WIN_FRAME_BOTTOM = 'Frame_Bottom' +WIN_FIXED_TOP = 'Fixed_Top' +WIN_FIXED_BOTTOM = 'Fixed_Bottom' +WIN_SASH_ACTIVE = 'Sash_Active' +WIN_SASH_INACTIVE = 'Sash_Inactive' +WIN_SASH_SPLIT = 'Sash_Split' +WIN_FRAME_SPLIT = 'Frame_Split' + +WIN_REF = 'Ref' +WIN_SECTION = 'Section' +WIN_STRIP = 'Strip' +WIN_ALU = 'Alu' +WIN_CTRIN = 'CtrIn' +WIN_OUT = 'Out' +WIN_OUTOFST = 'OfstOut' +WIN_CTRINOFST = 'OfstCtrIn' +WIN_OFST = 'Ofst' +WIN_SECTIONFRAME = 'SectionFrame' + +WIN_MINIZINKEN = 'MiniZinken' + +WIN_STARTCPDELTA = 'StartCPDelta' +WIN_ENDCPDELTA = 'EndCPDelta' +WIN_GEOWIDTH = 'GeoWidth' +WIN_GLASSTHICKNESS = 'GlassThickness' + +WIN_GEOOUTLINEBOTTOM = 'GeoOutlineBottom' + +WIN_JOINT_BL = 'JointBL' +WIN_JOINT_BR = 'JointBR' +WIN_JOINT_BDIV = 'JointBDiv' +WIN_JOINT_TL = 'JointTL' +WIN_JOINT_TR = 'JointTR' +WIN_JOINT_TDIV = 'JointTDiv' + + +WIN_GEO_IN = 'In' +WIN_GEO_OUT = 'Out' +WIN_GEO_LEFT = 'Left' +WIN_GEO_RIGHT = 'Right' + +WIN_PRF_MAIN = 'Main' +WIN_PRF_START = 'Start' +WIN_PRF_END = 'End' + +WIN_PROFILETYPE = 'ProfileType' +WIN_SEPARATIONTYPE = 'SeparationType' + +WIN_SPLIT_STARTINTERS = 'SplitStartInters' +WIN_SPLIT_ENDINTERS = 'SplitEndInters' + +WIN_SOU = 'SOU' +WIN_CHILD = 'CHILD' +WIN_COPY = 'COPY' + +WIN_OVERLAP = 'Overlap' +WIN_DELTA = 'Delta' +WIN_FILLOVERLAP = 'FillOverlap' +WIN_FILLDELTA = 'FillDelta' + +WIN_MAINGUIDE = 'MainGuide' +WIN_STARTGUIDE = 'StartGuide' +WIN_ENDGUIDE = 'EndGuide' + +WIN_BOTTOMRAIL = 'BottomRail' + +WIN_DOWEL = 'Dowel' +WIN_DWL_TOPPERPSTART = 'TopPerpStart' +WIN_DWL_TOPPERPEND = 'TopPerpEnd' +WIN_DWL_TOPPARASTART = 'TopParaStart' +WIN_DWL_TOPPARAEND = 'TopParaEnd' +WIN_DWL_BOTTOMPERPSTART = 'BottomPerpStart' +WIN_DWL_BOTTOMPERPEND = 'BottomPerpEnd' +WIN_DWL_BOTTOMPARASTART = 'BottomParaStart' +WIN_DWL_BOTTOMPARAEND = 'BottomParaEnd' + +--------------------------------------------------------------------- +return WinConst diff --git a/Profiles/WinJWDConst.lua b/Profiles/WinJWDConst.lua new file mode 100644 index 0000000..7cc883f --- /dev/null +++ b/Profiles/WinJWDConst.lua @@ -0,0 +1,54 @@ +-- +-- EEEEEEEEEE GGGGGG TTTTTTTTTTTTTT +-- EEEEEEEEEE GGGGGGGGGG TTTTTTTTTTTTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEEEEEEEE GGGGGGGGGG TTTT +-- EEEEEEEEEE GGGGGG TTTT +-- +-- by Egalware s.r.l. +-- Window project software by Egalware s.r.l. 2023/05/02 + +-- Tabella per definizione modulo +local WinJWDConst = {} + +------------------------------------------- PARAMETERS ------------------------------------------- + + +-- tipi di sash battente e ricevente +-- WIN_SASHTYPES = { +-- NULL = 0, +-- ACTIVE = 1, +-- INACTIVE = 2, +-- } + +JWD_EXT = '.jwd' + +JWD_PROFILE_PATH = 'ProfilePath' + +JWD_AREA = 'Area' +JWD_AREA_TYPE = 'AreaType' + +JWD_JOINT_BL = 'JointBL' +JWD_JOINT_BR = 'JointBR' +JWD_JOINT_TL = 'JointTL' +JWD_JOINT_TR = 'JointTR' + +JWD_OUTLINE = 'Outline' +JWD_JOINT = 'Joint' +JWD_SPLIT = 'Split' +JWD_CRV_TYPE = 'CurveType' +JWD_POINT_START = 'ptStart' +JWD_POINT_END = 'ptEnd' +JWD_POINT_MID = 'ptMid' +JWD_BOTTOM_RAIL = 'BottomRail' + +JWD_SASH_TYPE = 'SashType' +JWD_FILL_TYPE = 'FillType' + +--------------------------------------------------------------------- +return WinJWDConst diff --git a/Profiles/WinLib - Copy.lua b/Profiles/WinLib - Copy.lua new file mode 100644 index 0000000..c5cd787 --- /dev/null +++ b/Profiles/WinLib - Copy.lua @@ -0,0 +1,625 @@ +-- +-- EEEEEEEEEE GGGGGG TTTTTTTTTTTTTT +-- EEEEEEEEEE GGGGGGGGGG TTTTTTTTTTTTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEEEEEEEE GGGGGGGGGG TTTT +-- EEEEEEEEEE GGGGGG TTTT +-- +-- by Egalware s.r.l. +-- Window project software by Egalware s.r.l. 2023/05/02 + +-- Tabella per definizione modulo +local WinLib = {} + +-- Include +require( 'EgtBase') +_G.package.loaded.WinConst = nil +require( 'WinConst') + +-- funzioni + +-- funzione che crea un taglio split +function WinLib.AddSplit( nAreaLayerId, SplitType, MeasureType, nPosition, nProportion) + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaLayerId, WIN_OUTLINE) + local b3OutlineLayer = EgtGetBBox( nOutlineLayerId, GDB_BB.STANDARD) + -- recupero contorno + local OutlineIds = {} + local nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) + while nOutlineId do + table.insert( OutlineIds, nOutlineId) + nOutlineId = EgtGetNext( nOutlineId) + end + if SplitType == WIN_SPLIT.VERTICAL then + -- creo linea + local nCalcPosition = 0 + if MeasureType == WIN_MEASURE.ABSOLUT then + nCalcPosition = nPosition + elseif MeasureType == WIN_MEASURE.PROPORTIONAL then + nCalcPosition = b3OutlineLayer:getDimX() / nProportion * nPosition + end + local nTotSplitId = EgtLine( nOutlineLayerId, Point3d( nCalcPosition, 0, 0), Point3d( nCalcPosition, b3OutlineLayer:getDimY(), 0)) + EgtSetName( nTotSplitId, WIN_VERTICAL) + -- la taglio con i contorni + local nCompoOutlineId = EgtCurveCompo( nOutlineLayerId, OutlineIds, false) + local nFROutlineId = EgtSurfFlatRegion( nOutlineLayerId, nCompoOutlineId) + local nSplitId, _ = EgtTrimCurveWithRegion( nTotSplitId, nFROutlineId, true, false) + EgtErase( { nCompoOutlineId, nFROutlineId}) + elseif SplitType == WIN_SPLIT.HORIZONTAL then + local nFrameSplitId = EgtLine( nOutlineLayerId, Point3d( 0, nPosition, 0), Point3d( 0, nPosition, 0)) + EgtSetName( nFrameSplitId, WIN_HORIZONTAL) + end +end + +-- funzione che crea le aree da un taglio split +function WinLib.CreateAreaFromSplit( nOutlineLayerId, nFrameSplitId) + +end + +-- funzione che restituisce BBox del Ref del profilo +function WinLib.GetRefWithBBoxFromProfile( nProfileFrameLayerId, sProfileType) + local nProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, sProfileType) + local nProfileRefId = EgtGetFirstNameInGroup( nProfileId, WIN_REF) + local b3Ref = EgtGetBBox( nProfileRefId, GDB_BB.STANDARD) + return nProfileId, b3Ref + end + +-- funzione che restituisce ref e calcola delta controprofilo dal profilo passatogli +function WinLib.GetDeltaProfile( nProfileFrameLayerId, sProfileType) + local nProfileId, b3Ref = WinLib.GetRefWithBBoxFromProfile( nProfileFrameLayerId, sProfileType) + local nCPId = EgtGetFirstNameInGroup( nProfileId, WIN_CTRIN) + local b3CP = EgtGetBBox( nCPId, GDB_BB.STANDARD) + local dCPDelta = b3Ref:getDimY() - b3CP:getDimY() + return dCPDelta, b3Ref +end + +-- funzione che calcola l'ingombro dei pezzi del telaio +function WinLib.CalcFrameGeo( nPartId, nOutlineId) + -- recupero profilo + local nProfileLayerId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE) + local nProfileFrameLayerId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_FRAME) + -- creo layer per ingombro + local nGeoLayerId = EgtGroup( nPartId) + EgtSetName( nGeoLayerId, WIN_GEO) + -- ricavo tipo dal nome + local sName = EgtGetName( nOutlineId) + local nProfileType = WIN_PRF.NULL + if sName == WIN_TOP then + nProfileType = WIN_PRF.TOP + elseif sName == WIN_BOTTOM then + nProfileType = WIN_PRF.BOTTOM + elseif sName == WIN_LEFT then + nProfileType = WIN_PRF.LEFT + elseif sName == WIN_RIGHT then + nProfileType = WIN_PRF.RIGHT + end + local nOutlineLayerId = EgtGetParent( nOutlineId) + local b3OutlineId = EgtGetBBoxGlob( nOutlineId, GDB_BB.STANDARD) + local nNewGeoId + if nProfileType == WIN_PRF.TOP then + -- recupero tipo di giunzioni + local StartJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_TR, 'i') + local EndJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_TL, 'i') + -- recupero ref e controprofilo del top e calcolo delta + local dTopCPDelta, b3TopRef = WinLib.GetDeltaProfile( nProfileFrameLayerId, WIN_SASH_TOP) + -- recupero outline precedente + local nNextOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_LEFT) + local nPrevOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_RIGHT) + -- calcolo vettori direzione + local vtNextOutline = EgtSV( nNextOutlineId) + local vtPrevOutline = EgtSV( nPrevOutlineId) + local vtCurrOutline = EgtSV( nOutlineId) + -- calcolo punti con inclinazione + local dSenNext = ( vtCurrOutline ^ vtNextOutline):getZ() + local dSenPrev = ( vtPrevOutline ^ vtCurrOutline):getZ() + local dCosNext = ( vtCurrOutline * vtNextOutline) + local dCosPrev = ( vtCurrOutline * vtPrevOutline) + local ptBL = ORIG() + local ptBR = ptBL + X_AX() * EgtCurveLength( nOutlineId) - X_AX() * dSenPrev * EgtIf(StartJointType == WIN_JNT.FULL_V, dTopCPDelta, 0) - X_AX() * dSenNext * EgtIf(EndJointType == WIN_JNT.FULL_V, dTopCPDelta, 0) + local ptTR = ptBR + X_AX() * b3TopRef:getDimY() / dSenNext * dCosNext + Y_AX() * b3TopRef:getDimY() + local ptTL = ORIG() - X_AX() * b3TopRef:getDimY() / dSenPrev * dCosPrev + Y_AX() * b3TopRef:getDimY() + -- creo rettangolo ingombro + nNewGeoId = EgtCurveCompoFromPoints( nGeoLayerId, { ptBL, ptBR, ptTR, ptTL,ptBL}) + EgtSetInfo( nNewGeoId, WIN_GEOOUTLINEBOTTOM, EgtCurveLength( nOutlineId) - dSenPrev * EgtIf(StartJointType == WIN_JNT.FULL_V, dTopCPDelta, 0) - dSenNext * EgtIf(EndJointType == WIN_JNT.FULL_V, dTopCPDelta, 0)) + --nNewGeoId = EgtRectangle2P( nGeoLayerId, ORIG(), ORIG() + X_AX() * b3OutlineId:getDimX() - X_AX() * EgtIf(StartJointType == WIN_JNT.FULL_V, dTopCPDelta, 0) - X_AX() * EgtIf(EndJointType == WIN_JNT.FULL_V, dTopCPDelta, 0) + Y_AX() * b3TopRef:getDimY()) + if StartJointType == WIN_JNT.FULL_V then + EgtSetInfo( nNewGeoId, WIN_STARTCPDELTA, dTopCPDelta) + end + if EndJointType == WIN_JNT.FULL_V then + EgtSetInfo( nNewGeoId, WIN_ENDCPDELTA, dTopCPDelta) + end + EgtModifyCurveExtrusion( nNewGeoId, Z_AX()) + EgtModifyCurveThickness( nNewGeoId, -b3TopRef:getDimX()) + EgtSetName( nNewGeoId, WIN_TOP) + elseif nProfileType == WIN_PRF.BOTTOM then + -- recupero tipo di giunzioni + local StartJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_BL, 'i') + local EndJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_BR, 'i') + -- recupero ref e controprofilo del top e calcolo delta + local dTopCPDelta, b3TopRef = WinLib.GetDeltaProfile( nProfileFrameLayerId, WIN_SASH_TOP) + -- recupero ref del bottom + local _, b3BottomRef = WinLib.GetRefWithBBoxFromProfile( nProfileFrameLayerId, WIN_SASH_BOTTOM) + -- recupero outline precedente + local nNextOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_RIGHT) + local nPrevOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_LEFT) + -- calcolo vettori direzione + local vtNextOutline = EgtSV( nNextOutlineId) + local vtPrevOutline = EgtSV( nPrevOutlineId) + local vtCurrOutline = EgtSV( nOutlineId) + -- calcolo punti con inclinazione + local dSenNext = ( vtCurrOutline ^ vtNextOutline):getZ() + local dSenPrev = ( vtPrevOutline ^ vtCurrOutline):getZ() + local dCosNext = ( vtCurrOutline * vtNextOutline) + local dCosPrev = ( vtCurrOutline * vtPrevOutline) + local ptBL = ORIG() + local ptBR = ptBL + X_AX() * EgtCurveLength( nOutlineId) - X_AX() * dSenPrev * EgtIf(StartJointType == WIN_JNT.FULL_V, dTopCPDelta, 0) - X_AX() * dSenNext * EgtIf(EndJointType == WIN_JNT.FULL_V, dTopCPDelta, 0) + local ptTR = ptBR + X_AX() * b3TopRef:getDimY() / dSenNext * dCosNext + Y_AX() * b3BottomRef:getDimY() + local ptTL = ORIG() - X_AX() * b3TopRef:getDimY() / dSenPrev * dCosPrev + Y_AX() * b3BottomRef:getDimY() + -- creo rettangolo ingombro + nNewGeoId = EgtCurveCompoFromPoints( nGeoLayerId, { ptBL, ptBR, ptTR, ptTL,ptBL}) + EgtSetInfo( nNewGeoId, WIN_GEOOUTLINEBOTTOM, EgtCurveLength( nOutlineId) - dSenPrev * EgtIf(StartJointType == WIN_JNT.FULL_V, dTopCPDelta, 0) - dSenNext * EgtIf(EndJointType == WIN_JNT.FULL_V, dTopCPDelta, 0)) + --nNewGeoId = EgtRectangle2P( nGeoLayerId, ORIG(), ORIG() + X_AX() * b3OutlineId:getDimX() - X_AX() * EgtIf(StartJointType == WIN_JNT.FULL_V, dTopCPDelta, 0) - X_AX() * EgtIf(EndJointType == WIN_JNT.FULL_V, dTopCPDelta, 0) + Y_AX() * b3BottomRef:getDimY()) + if StartJointType == WIN_JNT.FULL_V then + EgtSetInfo( nNewGeoId, WIN_STARTCPDELTA, dTopCPDelta) + end + if EndJointType == WIN_JNT.FULL_V then + EgtSetInfo( nNewGeoId, WIN_ENDCPDELTA, dTopCPDelta) + end + EgtModifyCurveExtrusion( nNewGeoId, Z_AX()) + EgtModifyCurveThickness( nNewGeoId, -b3BottomRef:getDimX()) + EgtSetName( nNewGeoId, WIN_BOTTOM) + elseif nProfileType == WIN_PRF.LEFT then + -- recupero tipo di giunzioni + local StartJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_TL, 'i') + local EndJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_BL, 'i') + -- recupero ref e controprofilo del top e calcolo delta + local dTopCPDelta, b3TopRef = WinLib.GetDeltaProfile( nProfileFrameLayerId, WIN_SASH_TOP) + -- recupero ref e controprofilo del bottom e calcolo delta + local dBottomCPDelta, b3BottomRef = WinLib.GetDeltaProfile( nProfileFrameLayerId, WIN_SASH_BOTTOM) + -- recupero outline precedente + local nNextOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_BOTTOM) + local nPrevOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_TOP) + -- calcolo vettori direzione + local vtNextOutline = EgtSV( nNextOutlineId) + local vtPrevOutline = EgtSV( nPrevOutlineId) + local vtCurrOutline = EgtSV( nOutlineId) + -- calcolo punti con inclinazione + local dSenNext = ( vtCurrOutline ^ vtNextOutline):getZ() + local dSenPrev = ( vtPrevOutline ^ vtCurrOutline):getZ() + local dCosNext = ( vtCurrOutline * vtNextOutline) + local dCosPrev = ( vtCurrOutline * vtPrevOutline) + local ptBL = ORIG() + local ptBR = ptBL + X_AX() * EgtCurveLength( nOutlineId) - X_AX() * dSenPrev * EgtIf(StartJointType == WIN_JNT.FULL_H, dTopCPDelta, 0) - X_AX() * dSenNext * EgtIf(EndJointType == WIN_JNT.FULL_H, dBottomCPDelta, 0) + local ptTR = ptBR + X_AX() * b3TopRef:getDimY() / dSenNext * dCosNext + Y_AX() * b3TopRef:getDimY() + local ptTL = ORIG() - X_AX() * b3TopRef:getDimY() / dSenPrev * dCosPrev + Y_AX() * b3TopRef:getDimY() + -- creo rettangolo ingombro + nNewGeoId = EgtCurveCompoFromPoints( nGeoLayerId, { ptBL, ptBR, ptTR, ptTL,ptBL}) + EgtSetInfo( nNewGeoId, WIN_GEOOUTLINEBOTTOM, EgtCurveLength( nOutlineId) - dSenPrev * EgtIf(StartJointType == WIN_JNT.FULL_H, dTopCPDelta, 0) - dSenNext * EgtIf(EndJointType == WIN_JNT.FULL_H, dBottomCPDelta, 0)) + --nNewGeoId = EgtRectangle2P( nGeoLayerId, ORIG(), ORIG() + X_AX() * b3OutlineId:getDimY() - X_AX() * EgtIf(StartJointType == WIN_JNT.FULL_H, dTopCPDelta, 0) - X_AX() * EgtIf(EndJointType == WIN_JNT.FULL_H, dBottomCPDelta, 0) + Y_AX() * b3TopRef:getDimY()) + if StartJointType == WIN_JNT.FULL_H then + EgtSetInfo( nNewGeoId, WIN_STARTCPDELTA, dTopCPDelta) + end + if EndJointType == WIN_JNT.FULL_H then + EgtSetInfo( nNewGeoId, WIN_ENDCPDELTA, dBottomCPDelta) + end + EgtModifyCurveExtrusion( nNewGeoId, Z_AX()) + EgtModifyCurveThickness( nNewGeoId, -b3TopRef:getDimX()) + EgtSetName( nNewGeoId, WIN_LEFT) + elseif nProfileType == WIN_PRF.RIGHT then + -- recupero tipo di giunzioni + local StartJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_BR, 'i') + local EndJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_TR, 'i') + -- recupero ref e controprofilo del top e calcolo delta + local dTopCPDelta, b3TopRef = WinLib.GetDeltaProfile( nProfileFrameLayerId, WIN_SASH_TOP) + -- recupero ref e controprofilo del bottom e calcolo delta + local dBottomCPDelta, b3BottomRef = WinLib.GetDeltaProfile( nProfileFrameLayerId, WIN_SASH_BOTTOM) + -- recupero outline precedente + local nNextOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_TOP) + local nPrevOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_BOTTOM) + -- calcolo vettori direzione + local vtNextOutline = EgtSV( nNextOutlineId) + local vtPrevOutline = EgtSV( nPrevOutlineId) + local vtCurrOutline = EgtSV( nOutlineId) + -- calcolo punti con inclinazione + local dSenNext = ( vtCurrOutline ^ vtNextOutline):getZ() + local dSenPrev = ( vtPrevOutline ^ vtCurrOutline):getZ() + local dCosNext = ( vtCurrOutline * vtNextOutline) + local dCosPrev = ( vtCurrOutline * vtPrevOutline) + local ptBL = ORIG() + local ptBR = ptBL + X_AX() * EgtCurveLength( nOutlineId) - X_AX() * dSenPrev * EgtIf(StartJointType == WIN_JNT.FULL_H, dBottomCPDelta, 0) - X_AX() * dSenNext * EgtIf(EndJointType == WIN_JNT.FULL_H, dTopCPDelta, 0) + local ptTR = ptBR + X_AX() * b3TopRef:getDimY() / dSenNext * dCosNext + Y_AX() * b3TopRef:getDimY() + local ptTL = ORIG() - X_AX() * b3TopRef:getDimY() / dSenPrev * dCosPrev + Y_AX() * b3TopRef:getDimY() + -- creo rettangolo ingombro + nNewGeoId = EgtCurveCompoFromPoints( nGeoLayerId, { ptBL, ptBR, ptTR, ptTL,ptBL}) + EgtSetInfo( nNewGeoId, WIN_GEOOUTLINEBOTTOM, EgtCurveLength( nOutlineId) - dSenPrev * EgtIf(StartJointType == WIN_JNT.FULL_H, dBottomCPDelta, 0) - dSenNext * EgtIf(EndJointType == WIN_JNT.FULL_H, dTopCPDelta, 0)) + --nNewGeoId = EgtRectangle2P( nGeoLayerId, ORIG(), ORIG() + X_AX() * b3OutlineId:getDimY() - X_AX() * EgtIf(StartJointType == WIN_JNT.FULL_H, dBottomCPDelta, 0) - X_AX() * EgtIf(EndJointType == WIN_JNT.FULL_H, dTopCPDelta, 0) + Y_AX() * b3TopRef:getDimY()) + if StartJointType == WIN_JNT.FULL_H then + EgtSetInfo( nNewGeoId, WIN_STARTCPDELTA, dBottomCPDelta) + end + if EndJointType == WIN_JNT.FULL_H then + EgtSetInfo( nNewGeoId, WIN_ENDCPDELTA, dTopCPDelta) + end + EgtModifyCurveExtrusion( nNewGeoId, Z_AX()) + EgtModifyCurveThickness( nNewGeoId, -b3TopRef:getDimX()) + EgtSetName( nNewGeoId, WIN_RIGHT) + end + return nNewGeoId +end + +-- funzione che posiziona i profili, li estrude e crea il solido +function WinLib.CalcStartEndProfileType(nProfileType) + local StartJointType + local EndJointType + local nFrameLayerId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_FRAME) + local nOutlineLayerId = EgtGetFirstNameInGroup( nFrameLayerId, WIN_OUTLINE) + local sStartProfileType + local sEndProfileType + if nProfileType == WIN_PRF.BOTTOM then + StartJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_BL, 'i') + EndJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_BR, 'i') + if StartJointType == WIN_JNT.FULL_H then + sStartProfileType = WIN_OUTOFST + elseif StartJointType == WIN_JNT.FULL_V then + sStartProfileType = WIN_CTRINOFST + elseif StartJointType == WIN_JNT.ANGLED then + --sStartProfileType = WIN_OUTOFST + end + if EndJointType == WIN_JNT.FULL_H then + sEndProfileType = WIN_OUTOFST + elseif EndJointType == WIN_JNT.FULL_V then + sEndProfileType = WIN_CTRINOFST + elseif EndJointType == WIN_JNT.ANGLED then + --sEndProfileType = WIN_OUTOFST + end + elseif nProfileType == WIN_PRF.RIGHT then + StartJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_BR, 'i') + EndJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_TR, 'i') + if StartJointType == WIN_JNT.FULL_H then + sStartProfileType = WIN_CTRINOFST + elseif StartJointType == WIN_JNT.FULL_V then + sStartProfileType = WIN_OUTOFST + elseif StartJointType == WIN_JNT.ANGLED then + --sStartProfileType = WIN_OUTOFST + end + if EndJointType == WIN_JNT.FULL_H then + sEndProfileType = WIN_CTRINOFST + elseif EndJointType == WIN_JNT.FULL_V then + sEndProfileType = WIN_OUTOFST + elseif EndJointType == WIN_JNT.ANGLED then + --sEndProfileType = WIN_OUTOFST + end + elseif nProfileType == WIN_PRF.TOP then + StartJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_TR, 'i') + EndJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_TL, 'i') + if StartJointType == WIN_JNT.FULL_H then + sStartProfileType = WIN_OUTOFST + elseif StartJointType == WIN_JNT.FULL_V then + sStartProfileType = WIN_CTRINOFST + elseif StartJointType == WIN_JNT.ANGLED then + --sStartProfileType = WIN_OUTOFST + end + if EndJointType == WIN_JNT.FULL_H then + sEndProfileType = WIN_OUTOFST + elseif EndJointType == WIN_JNT.FULL_V then + sEndProfileType = WIN_CTRINOFST + elseif EndJointType == WIN_JNT.ANGLED then + --sEndProfileType = WIN_OUTOFST + end + elseif nProfileType == WIN_PRF.LEFT then + StartJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_TL, 'i') + EndJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_BL, 'i') + if StartJointType == WIN_JNT.FULL_H then + sStartProfileType = WIN_CTRINOFST + elseif StartJointType == WIN_JNT.FULL_V then + sStartProfileType = WIN_OUTOFST + elseif StartJointType == WIN_JNT.ANGLED then + --sStartProfileType = WIN_OUTOFST + end + if EndJointType == WIN_JNT.FULL_H then + sEndProfileType = WIN_CTRINOFST + elseif EndJointType == WIN_JNT.FULL_V then + sEndProfileType = WIN_OUTOFST + elseif EndJointType == WIN_JNT.ANGLED then + --sEndProfileType = WIN_OUTOFST + end + end + return sStartProfileType, sEndProfileType, StartJointType, EndJointType +end + +-- funzione che posiziona i profili, li estrude e crea il solido +function WinLib.MakeSolidByExtrusion(nGeoId, nMainProfileId, nStartProfileId, nEndProfileId, nProfileType, nSolidLayerId) + -- recupero outline + local nPartId = EgtGetParent( nSolidLayerId) + local nAreaId = EgtGetInfo( nPartId, WIN_AREA) + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_OUTLINE) + local sOutlineName = '' + local sPrevOutlineName = '' + local sNextOutlineName = '' + if nProfileType == WIN_PRF.BOTTOM then + sOutlineName = WIN_BOTTOM + sPrevOutlineName = WIN_LEFT + sNextOutlineName = WIN_RIGHT + elseif nProfileType == WIN_PRF.RIGHT then + sOutlineName = WIN_RIGHT + sPrevOutlineName = WIN_BOTTOM + sNextOutlineName = WIN_TOP + elseif nProfileType == WIN_PRF.TOP then + sOutlineName = WIN_TOP + sPrevOutlineName = WIN_RIGHT + sNextOutlineName = WIN_LEFT + elseif nProfileType == WIN_PRF.LEFT then + sOutlineName = WIN_LEFT + sPrevOutlineName = WIN_TOP + sNextOutlineName = WIN_BOTTOM + end + local nOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, sOutlineName) + local nPrevOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, sPrevOutlineName) + local nNextOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, sNextOutlineName) + -- calcolo vettori direzione degli outline + local vtNextOutline = EgtSV( nNextOutlineId) + local vtCurrOutline = EgtSV( nOutlineId) + local vtPrevOutline = EgtSV( nPrevOutlineId) + -- recupero posizione e BBox del geo + local b3Geo = EgtGetBBox(nGeoId, GDB_BB.STANDARD) + -- recupero BBox del profilo Main + local nRefMainProfileId = EgtGetFirstNameInGroup( nMainProfileId, WIN_REF) + local b3RefMainProfile = EgtGetBBoxGlob( nRefMainProfileId, GDB_BB.STANDARD) + -- recupero frame del profilo + local nMainProfileFrameId = EgtGetFirstNameInGroup( nMainProfileId, WIN_SECTIONFRAME) + local frInvertMainProfile = EgtFR( nMainProfileFrameId) + frInvertMainProfile:invert() + -- lo applico a tutte le geometrie del profilo + EgtTransform( EgtGetAllInGroup( nMainProfileId), frInvertMainProfile) + -- assegno come riferimento del profilo il punto start dell'outline + EgtChangeGroupFrame( nMainProfileId, Frame3d( Point3d( b3Geo:getMin():getX(), b3Geo:getMin():getY(), b3Geo:getMax():getZ()), - X_AX())) + -- recupero outline del profilo Main e lo estrudo + local nMainOutlineId = EgtGetFirstNameInGroup( nMainProfileId, WIN_SECTION) + if nProfileType == WIN_PRF.BOTTOM then + EgtInvertCurve( nMainOutlineId) + end + local nMainExtrusionId = EgtSurfTmByExtrusion( nSolidLayerId, nMainOutlineId, X_AX() * b3Geo:getDimX()) + -- posiziono il profilo Start + local nRefStartProfileId = EgtGetFirstNameInGroup( nStartProfileId, WIN_REF) + local b3RefStartProfile = EgtGetBBoxGlob(nRefStartProfileId, GDB_BB.STANDARD) + local dDelta = EgtGetInfo( nGeoId, WIN_STARTCPDELTA, 'd') or 0 + -- recupero frame del profilo + local nStartProfileFrameId = EgtGetFirstNameInGroup( nStartProfileId, WIN_SECTIONFRAME) + local frInvertStartProfile = EgtFR( nStartProfileFrameId) + frInvertStartProfile:move( - Y_AX() * dDelta) + frInvertStartProfile:invert() + -- lo applico a tutte le geometrie del profilo + EgtTransform( EgtGetAllInGroup( nStartProfileId), frInvertStartProfile) + -- assegno come riferimento del profilo il punto start dell'outline + --do return end + EgtChangeGroupFrame( nStartProfileId, Frame3d( ORIG(), - vtPrevOutline)) + local dSenNext = ( vtCurrOutline ^ vtNextOutline):getZ() + local dSenPrev = ( vtPrevOutline ^ vtCurrOutline):getZ() + local dCosNext = ( vtCurrOutline * vtNextOutline) + local dCosPrev = ( vtCurrOutline * vtPrevOutline) + local dDeltaStartAngle = b3RefStartProfile:getDimX() * dCosPrev / dSenPrev + EgtMove( nStartProfileId, vtPrevOutline * dDeltaStartAngle) + -- in base al tipo di incastro e di pezzo, ricavo i controprofili + local sStartProfileType + local sEndProfileType + -- recupero tipo di giunzioni + sStartProfileType, sEndProfileType, StartJointType, EndJointType = WinLib.CalcStartEndProfileType( nProfileType) + -- recupero outline del profilo Start e lo estrudo + local nOutStartProfileId = EgtGetFirstNameInGroup( nStartProfileId, sStartProfileType) + --if (StartJointType == WIN_JNT.FULL_H and ( nProfileType == WIN_PRF.BOTTOM or nProfileType == WIN_PRF.TOP or nProfileType == WIN_PRF.RIGHT)) or + -- (StartJointType == WIN_JNT.FULL_V and ( nProfileType == WIN_PRF.LEFT)) then + -- EgtInvertCurve( nOutStartProfileId) + --end + if StartJointType == WIN_JNT.FULL_H and nProfileType == WIN_PRF.BOTTOM then + EgtInvertCurve( nOutStartProfileId) + end + + local nStartExtrusionId = EgtSurfTmByExtrusion( nSolidLayerId, nOutStartProfileId, - vtPrevOutline * ( b3RefMainProfile:getDimY() / dSenPrev + dDeltaStartAngle)) + -- taglio estrusi per ottenere solido + local nExtrCopyId = EgtCopy( nMainExtrusionId, nSolidLayerId) + EgtSurfTmCut( nMainExtrusionId, nStartExtrusionId, true, false) + EgtSurfTmCut( nStartExtrusionId, nExtrCopyId, true, false) + -- posiziono il profilo End + --EgtRotate( EgtGetAllInGroup( nEndProfileId), ORIG(), Z_AX(), 90) + --EgtRotate( EgtGetAllInGroup( nEndProfileId), ORIG(), Y_AX(), 180) + local nRefEndProfileId = EgtGetFirstNameInGroup( nEndProfileId, WIN_REF) + local b3RefEndProfile = EgtGetBBoxGlob(nRefEndProfileId, GDB_BB.STANDARD) + local dDelta = EgtGetInfo( nGeoId, WIN_ENDCPDELTA, 'd') or 0 + --vtMove = vtMove - X_AX() * dDelta + --EgtMove( nStartProfileId, vtMove) + --EgtMove( EgtGetAllInGroup( nEndProfileId), ORIG() - Point3d( b3RefEndProfile:getMax():getX(), b3RefEndProfile:getMax():getY(), b3RefEndProfile:getMax():getZ()) + X_AX() * dDelta, GDB_RT.GLOB) + + -- recupero frame del profilo + local nEndProfileFrameId = EgtGetFirstNameInGroup( nEndProfileId, WIN_SECTIONFRAME) + local frInvertEndProfile = EgtFR( nEndProfileFrameId) + + frInvertEndProfile:move( - Y_AX() * dDelta) + EgtMove(nEndProfileFrameId, - Y_AX() * dDelta) + frInvertEndProfile:invert() + -- lo applico a tutte le geometrie del profilo + EgtTransform( EgtGetAllInGroup( nEndProfileId), frInvertEndProfile) + -- assegno come riferimento del profilo il punto start dell'outline + local b3Outline = EgtGetBBox( nOutlineId, GDB_BB.STANDARD) + local dBottomOutline = EgtGetInfo( nGeoId, WIN_GEOOUTLINEBOTTOM, 'd') + EgtChangeGroupFrame( nEndProfileId, Frame3d( ORIG() + X_AX() * dBottomOutline , - vtNextOutline)) + + --EgtChangeGroupFrame( nEndProfileId, Frame3d( Point3d( b3Outline:getMax():getX(), b3Outline:getMin():getY(), b3Outline:getMax():getZ()), - vtNextOutline)) + local dDeltaEndAngle = b3RefEndProfile:getDimX() * dCosNext / dSenNext + EgtMove( nEndProfileId, - vtNextOutline * dDeltaEndAngle) + + + --EgtRotate( nEndProfileId, Point3d( b3Geo:getMin():getX(), b3Geo:getMin():getY(), b3Geo:getMax():getZ()), Y_AX(), -90) + --local dSecondAngle = EgtIf( nProfileType == WIN_PRF.LEFT, 90, -90) + --EgtRotate( nEndProfileId, Point3d( b3Geo:getMin():getX(), b3Geo:getMin():getY(), b3Geo:getMax():getZ()), Z_AX(), dSecondAngle) + --local nRefEndProfileId = EgtGetFirstNameInGroup( nEndProfileId, WIN_REF) + --local b3RefEndProfile = EgtGetBBoxGlob(nRefEndProfileId, GDB_BB.STANDARD) + --local vtMove = Point3d( b3Geo:getMax():getX(),b3Geo:getMin():getY(),b3Geo:getMin():getZ()) - Point3d( b3RefEndProfile:getMax():getX(), b3RefEndProfile:getMin():getY(), b3RefEndProfile:getMin():getZ()) + ---- sposto del delta controprofilo se necessario + --local dDelta = EgtGetInfo( nGeoId, WIN_ENDCPDELTA, 'd') or 0 + --vtMove = vtMove + X_AX() * dDelta + --EgtMove( nEndProfileId, vtMove) + -- recupero outline del profilo End e lo estrudo + local nOutEndProfileId = EgtGetFirstNameInGroup( nEndProfileId, sEndProfileType) + if (EndJointType == WIN_JNT.FULL_H and nProfileType == WIN_PRF.RIGHT) or + (EndJointType == WIN_JNT.FULL_V and (nProfileType == WIN_PRF.BOTTOM or nProfileType == WIN_PRF.TOP or nProfileType == WIN_PRF.LEFT)) then + EgtInvertCurve( nOutEndProfileId) + end + local nEndExtrusionId = EgtSurfTmByExtrusion( nSolidLayerId, nOutEndProfileId, vtNextOutline * ( b3RefMainProfile:getDimY() / dSenNext + dDeltaEndAngle)) + -- taglio estrusi per ottenere solido + EgtSurfTmCut( nMainExtrusionId, nEndExtrusionId, true, false) + EgtSurfTmCut( nEndExtrusionId, nExtrCopyId, true, false) + EgtErase( nExtrCopyId) +end + +-- funzione che crea il solido del pezzo del telaio +function WinLib.CalcFrameSolid(nPartId, nGeoId) + -- recupero profilo + local nProfileId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE) + local nProfileFrameLayerId = EgtGetFirstNameInGroup( nProfileId, WIN_FRAME) + -- creo layer per solido e per profili di estrusione + local nSolidLayerId = EgtGroup( nPartId) + EgtSetName( nSolidLayerId, WIN_SOLID) + local nFrameProfileLayerId = EgtGroup( nPartId) + EgtSetName( nFrameProfileLayerId, WIN_PROFILE) + -- ricavo tipo dal nome + local sName = EgtGetName( nGeoId) + local nProfileType = WIN_PRF.NULL + if sName == WIN_TOP then + nProfileType = WIN_PRF.TOP + elseif sName == WIN_BOTTOM then + nProfileType = WIN_PRF.BOTTOM + elseif sName == WIN_LEFT then + nProfileType = WIN_PRF.LEFT + elseif sName == WIN_RIGHT then + nProfileType = WIN_PRF.RIGHT + end + local nOrigMainProfileId = GDB_ID.NULL + local nMainProfileId = GDB_ID.NULL + local nOrigStartProfileId = GDB_ID.NULL + local nStartProfileId = GDB_ID.NULL + local nOrigEndProfileId = GDB_ID.NULL + local nEndProfileId = GDB_ID.NULL + -- recupero profilo e controprofili per tipo + if nProfileType == WIN_PRF.BOTTOM then + nOrigMainProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, WIN_SASH_BOTTOM) + nOrigStartProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, WIN_SASH_TOP) + nOrigEndProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, WIN_SASH_TOP) + elseif nProfileType == WIN_PRF.RIGHT then + nOrigMainProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, WIN_SASH_TOP) + nOrigStartProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, WIN_SASH_BOTTOM) + nOrigEndProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, WIN_SASH_TOP) + elseif nProfileType == WIN_PRF.TOP then + nOrigMainProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, WIN_SASH_TOP) + nOrigStartProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, WIN_SASH_TOP) + nOrigEndProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, WIN_SASH_TOP) + elseif nProfileType == WIN_PRF.LEFT then + nOrigMainProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, WIN_SASH_TOP) + nOrigStartProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, WIN_SASH_TOP) + nOrigEndProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, WIN_SASH_BOTTOM) + end + -- creo copie di profilo e controprofili + nMainProfileId = EgtCopy( nOrigMainProfileId, nFrameProfileLayerId) + nStartProfileId = EgtCopy( nOrigStartProfileId, nFrameProfileLayerId) + nEndProfileId = EgtCopy( nOrigEndProfileId, nFrameProfileLayerId) + -- creo solido dai profili + WinLib.MakeSolidByExtrusion(nGeoId, nMainProfileId, nStartProfileId, nEndProfileId, nProfileType, nSolidLayerId) + end + + -- funzione che calcola l'ingombro dei pezzi del telaio +function WinLib.CreatePartFromOutline( nFrameLayerId, nOutlineId) + -- ricavo tipo dal nome + local sName = EgtGetName( nOutlineId) + local nProfileType = WIN_PRF.NULL + if sName == WIN_TOP then + nProfileType = WIN_PRF.TOP + elseif sName == WIN_BOTTOM then + nProfileType = WIN_PRF.BOTTOM + elseif sName == WIN_LEFT then + nProfileType = WIN_PRF.LEFT + elseif sName == WIN_RIGHT then + nProfileType = WIN_PRF.RIGHT + end + -- creo pezzo + local nPartId = EgtGroup( GDB_ID.ROOT) + EgtSetName( nPartId, sName) + if nProfileType == WIN_PRF.BOTTOM or nProfileType == WIN_PRF.TOP then + EgtSetColor( nPartId, Color3d( 204, 102, 0)) + elseif nProfileType == WIN_PRF.RIGHT or nProfileType == WIN_PRF.LEFT then + EgtSetColor( nPartId, Color3d( 251, 128, 4)) + end + + -- inserisco riferimento alla sua area + EgtSetInfo( nPartId, WIN_AREA, nFrameLayerId) + + -- disegno ingombro + local nGeoId = WinLib.CalcFrameGeo( nPartId, nOutlineId) + + -- disegno solido + WinLib.CalcFrameSolid(nPartId, nGeoId) + + -- offset per distanziare i pezzi + local dYPosOffset = 300 * ( nProfileType - 1) + EgtChangeGroupFrame( nPartId, Frame3d( Point3d( 0, dYPosOffset, 0))) + +end + +-- funzione che posiziona un pezzo +function WinLib.PositionPart(nPartId) + -- ricavo tipo dal nome + local sName = EgtGetName( nPartId) + local sDelta = '' + if sName == WIN_BOTTOM then + sDelta = WIN_STARTCPDELTA + elseif sName == WIN_RIGHT then + sDelta = WIN_STARTCPDELTA + elseif sName == WIN_TOP then + sDelta = WIN_STARTCPDELTA + elseif sName == WIN_LEFT then + sDelta = WIN_STARTCPDELTA + end + -- calcolo nuovo riferimento + local nGeoPartLayerId = EgtGetFirstNameInGroup( nPartId, WIN_GEO) + local nGeoPartId = EgtGetFirstNameInGroup( nGeoPartLayerId, sName) + local dDelta = EgtGetInfo( nGeoPartId, sDelta, 'd') or 0 + local nFrameLayerId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_FRAME) + local nOutlineLayerId = EgtGetFirstNameInGroup( nFrameLayerId, WIN_OUTLINE) + local nFramePartId = EgtGetFirstNameInGroup( nOutlineLayerId, sName) + local vtStart = EgtSV( nFramePartId) + local ptStart = EgtSP( nFramePartId) + vtStart * dDelta + local _, _, dAngRight = SphericalFromVector(vtStart) + local frStart = Frame3d( ptStart) + frStart:rotate( frStart:getOrigin(), Z_AX(), dAngRight) + EgtChangeGroupFrame( nPartId, frStart) +end + +-- funzione che assembla i pezzi +function WinLib.AssembleFrame() + local nBottomPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_BOTTOM) + WinLib.PositionPart(nBottomPartId) + local nRightPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_RIGHT) + WinLib.PositionPart(nRightPartId) + local nTopPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_TOP) + WinLib.PositionPart(nTopPartId) + local nLeftPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_LEFT) + WinLib.PositionPart(nLeftPartId) + -- assemblo i pezzi + --local nRightPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_RIGHT) + --local nGeoRightLayerId = EgtGetFirstNameInGroup( nRightPartId, WIN_GEO) + --local nGeoRightId = EgtGetFirstNameInGroup( nGeoRightLayerId, WIN_RIGHT) + --local dDelta = EgtGetInfo( nGeoRightId, WIN_BOTTOMCPDELTA, 'd') + --local nFrameLayerId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_FRAME) + --local nOutlineLayerId = EgtGetFirstNameInGroup( nFrameLayerId, WIN_OUTLINE) + --local nFrameRightId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_RIGHT) + --local vtRight = EgtSV( nFrameRightId) + --local ptRight = EgtSP( nFrameRightId) + vtRight * dDelta + --local _, _, dAngRight = SphericalFromVector(vtRight) + --local frRight = Frame3d( ptRight) + --frRight:rotate( frRight:getOrigin(), Z_AX(), dAngRight) + --EgtChangeGroupFrame( nRightPartId, frRight) +end + +--------------------------------------------------------------------- +return WinLib diff --git a/Profiles/WinLib.lua b/Profiles/WinLib.lua new file mode 100644 index 0000000..419803a --- /dev/null +++ b/Profiles/WinLib.lua @@ -0,0 +1,958 @@ +-- +-- EEEEEEEEEE GGGGGG TTTTTTTTTTTTTT +-- EEEEEEEEEE GGGGGGGGGG TTTTTTTTTTTTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEEEEEEEE GGGGGGGGGG TTTT +-- EEEEEEEEEE GGGGGG TTTT +-- +-- by Egalware s.r.l. +-- Window project software by Egalware s.r.l. 2023/05/02 + +-- Tabella per definizione modulo +local WinLib = {} + +-- Include +require( 'EgtBase') +_G.package.loaded.WinConst = nil +require( 'WinConst') + +-- funzioni + +-- funzione che crea il buco per la finestra +function WinLib.CreateHole( dWidth, dHeight) + -- creo gruppo per buco + local nAreaLayerId = EgtGroup( GDB_ID.ROOT) + EgtSetName( nAreaLayerId, WIN_FRAME) + local nAreaOutlineLayerId = EgtGroup( nAreaLayerId) + EgtSetName( nAreaOutlineLayerId, WIN_AREAOUTLINE) + -- disegno outline + local nHoleBottomId = EgtLine( nAreaOutlineLayerId, Point3d( 0, 0, 0), Point3d( dWidth, 0, 0)) + EgtSetName( nHoleBottomId, WIN_BOTTOM) + local nHoleRightId = EgtLine( nAreaOutlineLayerId, Point3d( dWidth, 0, 0), Point3d( dWidth, dHeight, 0)) + EgtSetName( nHoleRightId, WIN_RIGHT) + local nHoleTopId = EgtLine( nAreaOutlineLayerId, Point3d( dWidth, dHeight, 0), Point3d( 0, dHeight, 0)) + EgtSetName( nHoleTopId, WIN_TOP) + local nHoleLeftId = EgtLine( nAreaOutlineLayerId, Point3d( 0, dHeight, 0), Point3d( 0, 0, 0)) + EgtSetName( nHoleLeftId, WIN_LEFT) + return nAreaLayerId +end + +-- funzione che crea il telaio a partire dal buco +function WinLib.CreateFrameOnHole( nHoleLayerId, dWidth, dHeight) + local nAreaOutlineLayerId = EgtGroup( nHoleLayerId) + EgtSetName( nAreaOutlineLayerId, WIN_OUTLINE) + -- disegno outline + local nHoleBottomId = EgtLine( nAreaOutlineLayerId, Point3d( 0, 0, 0), Point3d( dWidth, 0, 0)) + EgtSetName( nHoleBottomId, WIN_BOTTOM) + local nHoleRightId = EgtLine( nAreaOutlineLayerId, Point3d( dWidth, 0, 0), Point3d( dWidth, dHeight, 0)) + EgtSetName( nHoleRightId, WIN_RIGHT) + local nHoleTopId = EgtLine( nAreaOutlineLayerId, Point3d( dWidth, dHeight, 0), Point3d( 0, dHeight, 0)) + EgtSetName( nHoleTopId, WIN_TOP) + local nHoleLeftId = EgtLine( nAreaOutlineLayerId, Point3d( 0, dHeight, 0), Point3d( 0, 0, 0)) + EgtSetName( nHoleLeftId, WIN_LEFT) +end + +-- funzione che crea il telaio a partire dal buco +function WinLib.CreateFrameAsHole( nAreaLayerId, JointType) + -- creo layer outline del frame + local nOutlineLayerId = EgtGroup( nAreaLayerId) + EgtSetName( nOutlineLayerId, WIN_OUTLINE) + -- recupero outline del buco + local nAreaOutlineLayerId = EgtGetFirstNameInGroup( nAreaLayerId, WIN_AREAOUTLINE) + -- lo copio + local nHoleOutlineId = EgtGetFirstInGroup( nAreaOutlineLayerId) + while nHoleOutlineId do + local nOutlineId = EgtCopy( nHoleOutlineId, nOutlineLayerId) + -- da modificare!!! + -- funzione che assegna i profili serramento ai vari outline + local sName = EgtGetName( nHoleOutlineId) + if sName == WIN_BOTTOM then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SASH_BOTTOM) + elseif sName == WIN_RIGHT then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SASH_TOP) + elseif sName == WIN_TOP then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SASH_TOP) + elseif sName == WIN_LEFT then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SASH_TOP) + end + nHoleOutlineId = EgtGetNext( nHoleOutlineId) + end + EgtSetInfo( nOutlineLayerId, WIN_JOINT_BL, JointType) + EgtSetInfo( nOutlineLayerId, WIN_JOINT_BR, JointType) + EgtSetInfo( nOutlineLayerId, WIN_JOINT_TL, JointType) + EgtSetInfo( nOutlineLayerId, WIN_JOINT_TR, JointType) +end + +-- funzione che aggiunge una anta +function WinLib.AddSash( nAreaId) + -- creo nuova area + local nSashAreaId = EgtGroup( nAreaId) + EgtSetName( nSashAreaId, WIN_SASH) + EgtSetInfo( nSashAreaId, WIN_AREATYPE, WIN_AREATYPES.SASH) + -- recupero outline area precedente + local nPrevAreaOutlineId = EgtGetFirstNameInGroup( nAreaId, WIN_AREAOUTLINE) + -- lo copio per outline area dell'anta + local nAreaOutlineId = EgtCopy( nPrevAreaOutlineId, nSashAreaId) + return nSashAreaId +end + +-- funzione che aggiunge un riempimento +function WinLib.AddFill( nAreaId, FillType) + -- creo nuova area + local nFillAreaId = EgtGroup( nAreaId) + EgtSetName( nFillAreaId, WIN_FILL) + EgtSetInfo( nFillAreaId, WIN_AREATYPE, WIN_AREATYPES.FILL) + -- recupero outline area precedente + local nPrevAreaOutlineId = EgtGetFirstNameInGroup( nAreaId, WIN_AREAOUTLINE) + -- lo copio per outline area dell'anta + local nAreaOutlineId = EgtCopy( nPrevAreaOutlineId, nFillAreaId) + -- imposto tipo di fill + EgtSetInfo( nFillAreaId, WIN_FILLTYPE, FillType) + return nFillAreaId +end + +-- funzione che restituisce un outline dato un pezzo +function WinLib.GetOutlineFromPart( nPartId) + local nAreaId = EgtGetInfo( nPartId, WIN_AREA) + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_OUTLINE) + local sName = EgtGetName( nPartId) + return EgtGetFirstNameInGroup( nOutlineLayerId, sName) +end + +-- funzione che crea un taglio split +function WinLib.AddSplit( nAreaLayerId, SplitType, MeasureType, nPosition, nProportion) + -- creo layer per split + local nSplitLayerId = EgtGroup( nAreaLayerId) + EgtSetName( nSplitLayerId, WIN_SPLIT) + -- recupero contorno area precedente + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaLayerId, WIN_AREAOUTLINE) + local b3OutlineLayer = EgtGetBBox( nOutlineLayerId, GDB_BB.STANDARD) + local OutlineIds = {} + local nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) + while nOutlineId do + local sName = EgtGetName( nOutlineId) + table.insert( OutlineIds, nOutlineId) + nOutlineId = EgtGetNext( nOutlineId) + end + local nSplitId + if SplitType == WIN_SPLITTYPE.VERTICAL then + -- creo linea + local nCalcPosition = 0 + if MeasureType == WIN_MEASURE.ABSOLUT then + nCalcPosition = nPosition + elseif MeasureType == WIN_MEASURE.PROPORTIONAL then + nCalcPosition = b3OutlineLayer:getDimX() / nProportion * nPosition + end + local nTotSplitId = EgtLine( nSplitLayerId, Point3d( nCalcPosition, 0, 0), Point3d( nCalcPosition, b3OutlineLayer:getDimY(), 0)) + -- la taglio con i contorni + local nCompoOutlineId = EgtCurveCompo( nSplitLayerId, OutlineIds, false) + local nFROutlineId = EgtSurfFlatRegion( nSplitLayerId, nCompoOutlineId) + nSplitId = EgtTrimCurveWithRegion( nTotSplitId, nFROutlineId, true, false) + EgtSetName( nSplitId, WIN_VERTICAL) + EgtErase( { nCompoOutlineId, nFROutlineId}) + EgtSetInfo( nSplitId, WIN_PROFILETYPE, WIN_SASH_VERTICAL) + elseif SplitType == WIN_SPLITTYPE.HORIZONTAL then + -- creo linea + local nCalcPosition = 0 + if MeasureType == WIN_MEASURE.ABSOLUT then + nCalcPosition = nPosition + elseif MeasureType == WIN_MEASURE.PROPORTIONAL then + nCalcPosition = b3OutlineLayer:getDimY() / nProportion * nPosition + end + local nTotSplitId = EgtLine( nSplitLayerId, Point3d( 0, nCalcPosition, 0), Point3d( b3OutlineLayer:getDimX(), nCalcPosition, 0)) + -- la taglio con i contorni + local nCompoOutlineId = EgtCurveCompo( nSplitLayerId, OutlineIds, false) + local nFROutlineId = EgtSurfFlatRegion( nSplitLayerId, nCompoOutlineId) + nSplitId = EgtTrimCurveWithRegion( nTotSplitId, nFROutlineId, true, false) + EgtSetName( nSplitId, WIN_HORIZONTAL) + EgtErase( { nCompoOutlineId, nFROutlineId}) + EgtSetInfo( nSplitId, WIN_PROFILETYPE, WIN_SASH_HORIZONTAL) + end + -- creo aree + WinLib.CreateAreaFromSplit( nAreaLayerId, nSplitId) +end + +-- funzione che crea tagli split multipli +function WinLib.AddSplits( nAreaLayerId, SplitType, MeasureType, PositionList, nProportion) + if MeasureType == WIN_MEASURE.ABSOLUT then + for nIndex = 1, #PositionList do + WinLib.AddSplit( nAreaLayerId, SplitType, MeasureType, PositionList[nIndex], nProportion) + end + elseif MeasureType == WIN_MEASURE.PROPORTIONAL then + for nIndex = 1, #PositionList do + WinLib.AddSplit( nAreaLayerId, SplitType, MeasureType, PositionList[nIndex], nProportion) + end + end +end + +-- funzione che crea un taglio split da una curva generica +function WinLib.AddGenSplit( nAreaLayerId, nSplitId) + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaLayerId, WIN_OUTLINE) + 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 = (CurrOutInters.IntersPoint - ptStartSplit):sqlen() + CurrOutInters.EndDistance = (CurrOutInters.IntersPoint - ptEndSplit):sqlen() + 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) + EgtSetInfo( nSplitId, WIN_SPLIT_STARTINTERS, StartInters.Id) + EgtSetInfo( nSplitId, WIN_SPLIT_ENDINTERS, EndInters.Id) + -- assegno nome e tipo profilo + EgtSetName( nSplitId, WIN_SPLIT) + EgtSetInfo( nSplitId, WIN_PROFILETYPE, WIN_SASH_HORIZONTAL) + -- creo aree + WinLib.CreateAreaFromSplit( nAreaLayerId, nSplitId) +end + +-- funzione che crea tagli split da curve generiche +function WinLib.AddGenSplits( nAreaLayerId, SplitList) + for nIndex = 1, #SplitList do + WinLib.AddSplit( nAreaLayerId, SplitList[nIndex]) + end +end + +-- funzione che crea le aree da un taglio split +function WinLib.CreateAreaFromSplit( nAreaLayerId, nSplitId) + -- creo layer per le due aree + local nArea1Id = EgtGroup( nAreaLayerId) + local nArea2Id = EgtGroup( nAreaLayerId) + EgtSetInfo( nArea1Id, 'SOU', nSplitId) + EgtSetName( nArea1Id , 'Area' .. 1) + local nArea1OutlineLayerId = EgtGroup( nArea1Id) + EgtSetName( nArea1OutlineLayerId , WIN_AREAOUTLINE) + EgtSetInfo( nArea2Id, 'SOU', nSplitId) + EgtSetName( nArea2Id , 'Area' .. 2) + local nArea2OutlineLayerId = EgtGroup( nArea2Id) + EgtSetName( nArea2OutlineLayerId , WIN_AREAOUTLINE) + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaLayerId, WIN_OUTLINE) + --local Outlines = {} + 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 + nInters = 1 + local nCopyId = EgtCopy( nOutlineId, nArea2OutlineLayerId) + local dStartIntersParam = EgtCurveParamAtPoint( nCopyId, ptInters) + EgtTrimCurveStartAtParam( nCopyId, dStartIntersParam) + elseif nInters == 1 then + -- trovato secondo punto di intersezione - fine area 2 + nInters = 2 + local nCopyId = EgtCopy( nOutlineId, nArea2OutlineLayerId) + local dEndIntersParam = EgtCurveParamAtPoint( nCopyId, ptInters) + EgtTrimCurveEndAtParam( nCopyId, dEndIntersParam) + -- copio anche split + local nSplitCopyId = EgtCopy( nSplitId, nArea2OutlineLayerId) + if not AreSamePointExact( EgtEP( nCopyId), EgtSP( nSplitCopyId)) then + EgtInvertCurve( nSplitCopyId) + end + -- inizio area 1 + local nCopyId = EgtCopy( nOutlineId, nArea1OutlineLayerId) + 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) + local dEndIntersParam = EgtCurveParamAtPoint( nCopyId, ptInters) + EgtTrimCurveEndAtParam( nCopyId, dEndIntersParam) + -- copio anche split + local nSplitCopyId = EgtCopy( nSplitId, nArea1OutlineLayerId) + if not AreSamePointExact( EgtEP( nCopyId), EgtSP( nSplitCopyId)) then + EgtInvertCurve( nSplitCopyId) + end + end + elseif nInters == 1 then + -- copio nel profilo 2 + EgtCopy( nOutlineId, nArea2OutlineLayerId) + elseif nInters == 2 then + -- copio nel profilo 1 + EgtCopy( nOutlineId, nArea1OutlineLayerId) + end + -- aggiorno indice + nOutlineId = EgtGetNext( nOutlineId) + -- se arrivato alla fine riparto + if not nOutlineId then + nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) + end + end +end + +-- funzione che restituisce BBox del Ref del profilo +function WinLib.GetRefWithBBoxFromProfile( nProfileFrameLayerId, sProfileType) + local nProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, sProfileType) + local nProfileRefId = EgtGetFirstNameInGroup( nProfileId, WIN_REF) + local b3Ref = EgtGetBBox( nProfileRefId, GDB_BB.STANDARD) + return nProfileId, b3Ref, nProfileRefId + end + +-- funzione che restituisce ref e calcola delta controprofilo dal profilo passatogli +function WinLib.GetDeltaProfile( nProfileFrameLayerId, sProfileType) + local nProfileId, b3Ref, nProfileRefId = WinLib.GetRefWithBBoxFromProfile( nProfileFrameLayerId, sProfileType) + local nCPId = EgtGetFirstNameInGroup( nProfileId, WIN_CTRIN) + local b3CP = EgtGetBBox( nCPId, GDB_BB.STANDARD) + local dCPDelta = b3Ref:getDimY() - b3CP:getDimY() + return dCPDelta, b3Ref, nProfileId, nProfileRefId +end + +-- funzione che crea le curve del geo +function WinLib.CreateFrameGeo( nOutlineId, nPrevOutlineId, nNextOutlineId, StartJointType, EndJointType, nProfileType, nGeoLayerId, nProfileFrameLayerId) + local nCurrCurveId + local nCurrOffsetId + local nPrevCurveId + local nNextCurveId + local dGeoWidth + -- recupero ref e controprofilo e calcolo delta del top, prev e next + local sCurrProfileType = EgtGetInfo( nOutlineId, WIN_PROFILETYPE) + local _, b3CurrRef, nCurrProfileId, nCurrProfileRefId = WinLib.GetDeltaProfile( nProfileFrameLayerId, sCurrProfileType) + local sPrevProfileType = EgtGetInfo( nPrevOutlineId, WIN_PROFILETYPE) + local dPrevCPDelta, _ = WinLib.GetDeltaProfile( nProfileFrameLayerId, sPrevProfileType) + local sNextProfileType = EgtGetInfo( nNextOutlineId, WIN_PROFILETYPE) + local dNextCPDelta, _ = WinLib.GetDeltaProfile( nProfileFrameLayerId, sNextProfileType) + -- calcolo spostamento della curva iniziale dovuto a posizione riferimento + local nProfileFrameId = EgtGetFirstNameInGroup( nCurrProfileId, WIN_SECTIONFRAME) + local frProfile = EgtFR( nProfileFrameId) + local b3CurrProfileFrame = EgtGetBBoxRef( nCurrProfileRefId, GDB_BB.STANDARD, frProfile) + local dCurrOffset = b3CurrProfileFrame:getMax():getX() + -- creo copie degli outline e li offsetto opportunamente + nCurrCurveId = EgtCopy( nOutlineId, nGeoLayerId) + EgtOffsetCurve( nCurrCurveId, dCurrOffset) + nCurrOffsetId = EgtCopy( nOutlineId, nGeoLayerId) + EgtOffsetCurve( nCurrOffsetId, dCurrOffset - b3CurrProfileFrame:getDimX()) + EgtInvertCurve( nCurrOffsetId) + if StartJointType == WIN_JNT.ANGLED then + -- calcolo la bisettrice + local vtMedia = ( ( EgtSV( nOutlineId) - EgtEV( nPrevOutlineId)) / 2) + if not vtMedia:normalize() then + vtMedia = EgtSV( nOutlineId) + vtMedia:rotate(Z_AX(), 90) + end + nPrevCurveId = EgtLinePVL( nGeoLayerId, EgtSP( nOutlineId), vtMedia, 3 * b3CurrProfileFrame:getDimX()) + EgtInvertCurve( nPrevCurveId) + else + nPrevCurveId = EgtCopy( nPrevOutlineId, nGeoLayerId) + end + if ( StartJointType == WIN_JNT.FULL_V and ( nProfileType == WIN_PRF.BOTTOM or nProfileType == WIN_PRF.TOP or nProfileType == WIN_PRF.HORIZONTAL)) or + ( StartJointType == WIN_JNT.FULL_H and ( nProfileType == WIN_PRF.RIGHT or nProfileType == WIN_PRF.LEFT or nProfileType == WIN_PRF.VERTICAL)) or + nProfileType == WIN_PRF.SPLIT then + EgtOffsetCurve( nPrevCurveId, - dPrevCPDelta) + EgtSetInfo( nGeoLayerId, WIN_STARTCPDELTA, dPrevCPDelta) + end + if EndJointType == WIN_JNT.ANGLED then + -- calcolo la bisettrice + local vtMedia = ( ( EgtSV( nNextOutlineId) - EgtEV( nOutlineId)) / 2) + if not vtMedia:normalize() then + vtMedia = EgtEV( nOutlineId) + vtMedia:rotate(Z_AX(), 90) + end + nNextCurveId = EgtLinePVL( nGeoLayerId, EgtEP( nOutlineId), vtMedia, 3 * b3CurrProfileFrame:getDimX()) + EgtInvertCurve( nNextCurveId) + else + nNextCurveId = EgtCopy( nNextOutlineId, nGeoLayerId) + end + if ( StartJointType == WIN_JNT.FULL_V and ( nProfileType == WIN_PRF.BOTTOM or nProfileType == WIN_PRF.TOP or nProfileType == WIN_PRF.HORIZONTAL)) or + ( StartJointType == WIN_JNT.FULL_H and ( nProfileType == WIN_PRF.RIGHT or nProfileType == WIN_PRF.LEFT or nProfileType == WIN_PRF.VERTICAL)) or + nProfileType == WIN_PRF.SPLIT then + EgtOffsetCurve( nNextCurveId, - dNextCPDelta) + EgtSetInfo( nGeoLayerId, WIN_ENDCPDELTA, dNextCPDelta) + end + dGeoWidth = b3CurrProfileFrame:getDimX() + -- salvo delta controprofilo + if StartJointType == WIN_JNT.FULL_V then + end + if EndJointType == WIN_JNT.FULL_V then + end + return nCurrCurveId, nCurrOffsetId, nPrevCurveId, nNextCurveId, dGeoWidth +end + +-- funzione che calcola l'ingombro dei pezzi del telaio +function WinLib.CalcFrameGeo( nPartId, nOutlineId, nOutlineLayerId) + -- recupero profilo + local nProfileLayerId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE) + local nProfileFrameLayerId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_FRAME) + -- creo layer per ingombro + local nGeoLayerId = EgtGroup( nPartId) + EgtSetName( nGeoLayerId, WIN_GEO) + -- ricavo tipo dal nome + local sName = EgtGetName( nOutlineId) + local nProfileType = WIN_PRF.NULL + if sName == WIN_TOP then + nProfileType = WIN_PRF.TOP + elseif sName == WIN_BOTTOM then + nProfileType = WIN_PRF.BOTTOM + elseif sName == WIN_LEFT then + nProfileType = WIN_PRF.LEFT + elseif sName == WIN_RIGHT then + nProfileType = WIN_PRF.RIGHT + elseif sName == WIN_VERTICAL then + nProfileType = WIN_PRF.VERTICAL + elseif sName == WIN_HORIZONTAL then + nProfileType = WIN_PRF.HORIZONTAL + elseif sName == WIN_SPLIT then + nProfileType = WIN_PRF.SPLIT + end + local StartJointType + local EndJointType + local nNextOutlineId + local nPrevOutlineId + local nCurrCurveId + local nCurrOffsetId + local nPrevCurveId + local nNextCurveId + local dGeoWidth + if nProfileType == WIN_PRF.TOP then + -- recupero tipo di giunzioni + StartJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_TR, 'i') + EndJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_TL, 'i') + -- recupero outline precedente e successivo + nPrevOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_RIGHT) + nNextOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_LEFT) + elseif nProfileType == WIN_PRF.BOTTOM then + -- recupero tipo di giunzioni + StartJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_BL, 'i') + EndJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_BR, 'i') + -- recupero outline precedente + nPrevOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_LEFT) + nNextOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_RIGHT) + elseif nProfileType == WIN_PRF.LEFT then + -- recupero tipo di giunzioni + StartJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_TL, 'i') + EndJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_BL, 'i') + -- recupero outline precedente + nPrevOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_TOP) + nNextOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_BOTTOM) + elseif nProfileType == WIN_PRF.RIGHT then + -- recupero tipo di giunzioni + StartJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_BR, 'i') + EndJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_TR, 'i') + -- recupero outline precedente + nPrevOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_BOTTOM) + nNextOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_TOP) + elseif nProfileType == WIN_PRF.VERTICAL then + -- recupero tipo di giunzioni + StartJointType = WIN_JNT.FULL_H + EndJointType = WIN_JNT.FULL_H + -- recupero outline precedente + nPrevOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_BOTTOM) + nNextOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_TOP) + elseif nProfileType == WIN_PRF.HORIZONTAL then + -- recupero tipo di giunzioni + StartJointType = WIN_JNT.FULL_V + EndJointType = WIN_JNT.FULL_V + -- recupero outline precedente + nPrevOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_LEFT) + nNextOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_RIGHT) + elseif nProfileType == WIN_PRF.SPLIT then + local nStartId = EgtGetInfo( nOutlineId, WIN_SPLIT_STARTINTERS, 'i') + local nEndId = EgtGetInfo( nOutlineId, WIN_SPLIT_ENDINTERS, 'i') + local sStartName = EgtGetName( nStartId) + local sEndName = EgtGetName( nEndId) + -- recupero tipo di giunzioni + if sStartName == WIN_BOTTOM or sStartName == WIN_TOP then + StartJointType = WIN_JNT.FULL_H + else + StartJointType = WIN_JNT.FULL_V + end + if sEndName == WIN_BOTTOM or sEndName == WIN_TOP then + EndJointType = WIN_JNT.FULL_H + else + EndJointType = WIN_JNT.FULL_V + end + -- recupero outline precedente + nPrevOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, sStartName) + nNextOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, sEndName) + end + -- creo lati dell'outline + nCurrCurveId, nCurrOffsetId, nPrevCurveId, nNextCurveId, dGeoWidth = WinLib.CreateFrameGeo( nOutlineId, nPrevOutlineId, nNextOutlineId, StartJointType, EndJointType, nProfileType, nGeoLayerId, nProfileFrameLayerId) + -- calcolo punti di intersezione + local ptIntersCurrPrev = EgtIP( nCurrCurveId, nPrevCurveId, EgtSP( nCurrCurveId)) + if not ptIntersCurrPrev then + -- allungo per intersecare + EgtExtendCurveStartByLen( nCurrCurveId, 200) + EgtExtendCurveEndByLen( nPrevCurveId, 200) + ptIntersCurrPrev = EgtIP( nCurrCurveId, nPrevCurveId, EgtSP( nCurrCurveId)) + end + local ptIntersCurrNext = EgtIP( nCurrCurveId, nNextCurveId, EgtEP( nCurrCurveId)) + if not ptIntersCurrNext then + -- allungo per intersecare + EgtExtendCurveEndByLen( nCurrCurveId, 200) + EgtExtendCurveStartByLen( nNextCurveId, 200) + ptIntersCurrNext = EgtIP( nCurrCurveId, nNextCurveId, EgtEP( nCurrCurveId)) + end + local ptIntersCurrOffsetPrev = EgtIP( nCurrOffsetId, nPrevCurveId, EgtEP( nCurrOffsetId)) + if not ptIntersCurrOffsetPrev then + -- allungo per intersecare + EgtExtendCurveEndByLen( nCurrOffsetId, 1000) + EgtExtendCurveStartByLen( nPrevCurveId, 200) + ptIntersCurrOffsetPrev = EgtIP( nCurrOffsetId, nPrevCurveId, EgtEP( nCurrOffsetId)) + end + local ptIntersCurrOffsetNext = EgtIP( nCurrOffsetId, nNextCurveId, EgtSP( nCurrOffsetId)) + if not ptIntersCurrOffsetNext then + -- allungo per intersecare + EgtExtendCurveStartByLen( nCurrOffsetId, 1000) + EgtExtendCurveStartByLen( nNextCurveId, 200) + ptIntersCurrOffsetNext = EgtIP( nCurrOffsetId, nNextCurveId, EgtSP( nCurrOffsetId)) + end + -- calcolo accorciamenti dei lati copiati alle intersezioni + local dIntersCurrPrevParam = EgtCurveParamAtPoint( nCurrCurveId, ptIntersCurrPrev) + EgtTrimCurveStartAtParam( nCurrCurveId, dIntersCurrPrevParam) + local dIntersCurrNextParam = EgtCurveParamAtPoint( nCurrCurveId, ptIntersCurrNext) + EgtTrimCurveEndAtParam( nCurrCurveId, dIntersCurrNextParam) + local dIntersCurrOffsetNextParam = EgtCurveParamAtPoint( nCurrOffsetId, ptIntersCurrOffsetNext) + EgtTrimCurveStartAtParam( nCurrOffsetId, dIntersCurrOffsetNextParam) + local dIntersCurrOffsetPrevParam = EgtCurveParamAtPoint( nCurrOffsetId, ptIntersCurrOffsetPrev) + EgtTrimCurveEndAtParam( nCurrOffsetId, dIntersCurrOffsetPrevParam) + local dIntersPrevOffsetParam = EgtCurveParamAtPoint( nPrevCurveId, ptIntersCurrOffsetPrev) + EgtTrimCurveStartAtParam( nPrevCurveId, dIntersPrevOffsetParam) + local dIntersPrevCurrParam = EgtCurveParamAtPoint( nPrevCurveId, ptIntersCurrPrev) + EgtTrimCurveEndAtParam( nPrevCurveId, dIntersPrevCurrParam) + local dIntersNextCurrParam = EgtCurveParamAtPoint( nNextCurveId, ptIntersCurrNext) + EgtTrimCurveStartAtParam( nNextCurveId, dIntersNextCurrParam) + local dIntersNextOffsetParam = EgtCurveParamAtPoint( nNextCurveId, ptIntersCurrOffsetNext) + EgtTrimCurveEndAtParam( nNextCurveId, dIntersNextOffsetParam) + -- creo composita dai lati + EgtSetName( nCurrCurveId, WIN_GEO_OUT) + EgtSetName( nCurrOffsetId, WIN_GEO_IN) + EgtSetName( nNextCurveId, WIN_GEO_RIGHT) + EgtSetName( nPrevCurveId, WIN_GEO_LEFT) + -- salvo spessore serramento in geo + EgtSetInfo( nCurrCurveId, WIN_GEOWIDTH, dGeoWidth) + + return nCurrCurveId +end + +-- funzione che posiziona i profili, li estrude e crea il solido +function WinLib.CalcStartEndProfileType(nProfileType, nOutlineId) + local StartJointType + local EndJointType + local nFrameLayerId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_FRAME) + local nOutlineLayerId = EgtGetFirstNameInGroup( nFrameLayerId, WIN_OUTLINE) + local sStartProfileType + local sEndProfileType + if nProfileType == WIN_PRF.BOTTOM then + StartJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_BL, 'i') + EndJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_BR, 'i') + if StartJointType == WIN_JNT.FULL_H then + sStartProfileType = WIN_OUTOFST + elseif StartJointType == WIN_JNT.FULL_V then + sStartProfileType = WIN_CTRINOFST + elseif StartJointType == WIN_JNT.ANGLED then + sStartProfileType = WIN_MINIZINKEN + end + if EndJointType == WIN_JNT.FULL_H then + sEndProfileType = WIN_OUTOFST + elseif EndJointType == WIN_JNT.FULL_V then + sEndProfileType = WIN_CTRINOFST + elseif EndJointType == WIN_JNT.ANGLED then + sEndProfileType = WIN_MINIZINKEN + end + elseif nProfileType == WIN_PRF.RIGHT then + StartJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_BR, 'i') + EndJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_TR, 'i') + if StartJointType == WIN_JNT.FULL_H then + sStartProfileType = WIN_CTRINOFST + elseif StartJointType == WIN_JNT.FULL_V then + sStartProfileType = WIN_OUTOFST + elseif StartJointType == WIN_JNT.ANGLED then + sStartProfileType = WIN_MINIZINKEN + end + if EndJointType == WIN_JNT.FULL_H then + sEndProfileType = WIN_CTRINOFST + elseif EndJointType == WIN_JNT.FULL_V then + sEndProfileType = WIN_OUTOFST + elseif EndJointType == WIN_JNT.ANGLED then + sEndProfileType = WIN_MINIZINKEN + end + elseif nProfileType == WIN_PRF.TOP then + StartJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_TR, 'i') + EndJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_TL, 'i') + if StartJointType == WIN_JNT.FULL_H then + sStartProfileType = WIN_OUTOFST + elseif StartJointType == WIN_JNT.FULL_V then + sStartProfileType = WIN_CTRINOFST + elseif StartJointType == WIN_JNT.ANGLED then + sStartProfileType = WIN_MINIZINKEN + end + if EndJointType == WIN_JNT.FULL_H then + sEndProfileType = WIN_OUTOFST + elseif EndJointType == WIN_JNT.FULL_V then + sEndProfileType = WIN_CTRINOFST + elseif EndJointType == WIN_JNT.ANGLED then + sEndProfileType = WIN_MINIZINKEN + end + elseif nProfileType == WIN_PRF.LEFT then + StartJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_TL, 'i') + EndJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_BL, 'i') + if StartJointType == WIN_JNT.FULL_H then + sStartProfileType = WIN_CTRINOFST + elseif StartJointType == WIN_JNT.FULL_V then + sStartProfileType = WIN_OUTOFST + elseif StartJointType == WIN_JNT.ANGLED then + sStartProfileType = WIN_MINIZINKEN + end + if EndJointType == WIN_JNT.FULL_H then + sEndProfileType = WIN_CTRINOFST + elseif EndJointType == WIN_JNT.FULL_V then + sEndProfileType = WIN_OUTOFST + elseif EndJointType == WIN_JNT.ANGLED then + sEndProfileType = WIN_MINIZINKEN + end + elseif nProfileType == WIN_PRF.VERTICAL then + StartJointType = WIN_JNT.FULL_H + EndJointType = WIN_JNT.FULL_H + sStartProfileType = WIN_CTRINOFST + sEndProfileType = WIN_CTRINOFST + elseif nProfileType == WIN_PRF.HORIZONTAL then + StartJointType = WIN_JNT.FULL_V + EndJointType = WIN_JNT.FULL_V + sStartProfileType = WIN_CTRINOFST + sEndProfileType = WIN_CTRINOFST + elseif nProfileType == WIN_PRF.SPLIT then + local nStartId = EgtGetInfo( nOutlineId, WIN_SPLIT_STARTINTERS, 'i') + local nEndId = EgtGetInfo( nOutlineId, WIN_SPLIT_ENDINTERS, 'i') + local sStartName = EgtGetName( nStartId) + local sEndName = EgtGetName( nEndId) + -- recupero tipo di giunzioni + if sStartName == WIN_BOTTOM or sStartName == WIN_TOP then + StartJointType = WIN_JNT.FULL_H + else + StartJointType = WIN_JNT.FULL_V + end + if sEndName == WIN_BOTTOM or sEndName == WIN_TOP then + EndJointType = WIN_JNT.FULL_H + else + EndJointType = WIN_JNT.FULL_V + end + sStartProfileType = WIN_CTRINOFST + sEndProfileType = WIN_CTRINOFST + end + return sStartProfileType, sEndProfileType, StartJointType, EndJointType +end + +-- funzione che posiziona i profili, li estrude e crea il solido +function WinLib.MakeSolidByExtrusion(nGeoId, nOutlineId, nMainProfileId, nStartProfileId, nEndProfileId, nProfileType, nSolidLayerId) + -- recupero outline + local nPartId = EgtGetParent( nSolidLayerId) + local nAreaId = EgtGetInfo( nPartId, WIN_AREA) + local nGeoLayerId = EgtGetParent( nGeoId) + -- recupero geo + local nPrevGeoId = EgtGetFirstNameInGroup( nGeoLayerId, WIN_GEO_LEFT) + local nNextGeoId = EgtGetFirstNameInGroup( nGeoLayerId, WIN_GEO_RIGHT) + -- recupero BBox e larghezza del geo + local dGeoWidth = EgtGetInfo( nGeoId, WIN_GEOWIDTH, 'd') + -- creo guida Main + local nGuideId = EgtCopy( nOutlineId, nSolidLayerId) + EgtExtendCurveStartByLen( nGuideId, 2 * dGeoWidth) + EgtExtendCurveEndByLen( nGuideId, 2 * dGeoWidth) + -- recupero frame del profilo + local nMainProfileFrameId = EgtGetFirstNameInGroup( nMainProfileId, WIN_SECTIONFRAME) + local frInvertMainProfile = EgtFR( nMainProfileFrameId) + frInvertMainProfile:invert() + -- lo applico a tutte le geometrie del profilo + EgtTransform( EgtGetAllInGroup( nMainProfileId), frInvertMainProfile) + -- assegno come riferimento del profilo il punto start dell'outline + EgtChangeGroupFrame( nMainProfileId, Frame3d( EgtSP( nGuideId), - EgtSV( nGuideId))) + -- recupero outline del profilo Main e lo estrudo + local nMainOutlineId = EgtGetFirstNameInGroup( nMainProfileId, WIN_SECTION) + local nMainExtrusionId = EgtSurfTmSwept( nSolidLayerId, nMainOutlineId, nGuideId, false) + -- posiziono il profilo Start + local nRefStartProfileId = EgtGetFirstNameInGroup( nStartProfileId, WIN_REF) + local b3RefStartProfile = EgtGetBBoxGlob(nRefStartProfileId, GDB_BB.STANDARD) + local dStartDelta = EgtGetInfo( nGeoLayerId, WIN_STARTCPDELTA, 'd') or 0 + -- creo guida per estrusione + local nStartGuideId = EgtCopy( nPrevGeoId, nSolidLayerId) + EgtExtendCurveStartByLen( nStartGuideId, 2 * dGeoWidth) + EgtExtendCurveEndByLen( nStartGuideId, 2 * dGeoWidth) + -- recupero frame del profilo + local nStartProfileFrameId = EgtGetFirstNameInGroup( nStartProfileId, WIN_SECTIONFRAME) + local frStartProfile = EgtFR( nStartProfileFrameId) + -- lo sposto se controprofilo + frStartProfile:move( - frStartProfile:getVersX() * dStartDelta) + frStartProfile:invert() + -- lo applico a tutte le geometrie del profilo + EgtTransform( EgtGetAllInGroup( nStartProfileId), frStartProfile) + -- assegno come riferimento del profilo il punto start dell'outline + EgtChangeGroupFrame( nStartProfileId, Frame3d( EgtSP( nStartGuideId), - EgtSV( nStartGuideId))) + -- in base al tipo di incastro e di pezzo, ricavo i controprofili + local sStartProfileType + local sEndProfileType + -- recupero tipo di giunzioni + sStartProfileType, sEndProfileType, StartJointType, EndJointType = WinLib.CalcStartEndProfileType( nProfileType, nOutlineId) + -- recupero outline del profilo Start e lo estrudo + local nOutStartProfileId + if sStartProfileType == WIN_MINIZINKEN then + nOutStartProfileId = EgtLine( nStartProfileId, EgtSP( nPrevGeoId), EgtSP( nPrevGeoId) - Z_AX() * b3RefStartProfile:getDimY(), GDB_RT.GLOB) + EgtInvertCurve( nOutStartProfileId) + else + nOutStartProfileId = EgtGetFirstNameInGroup( nStartProfileId, sStartProfileType) + end + local nStartExtrusionId = EgtSurfTmSwept( nSolidLayerId, nOutStartProfileId, nStartGuideId, false) + -- taglio estrusi per ottenere solido + local nExtrCopyId = EgtCopy( nMainExtrusionId, nSolidLayerId) + EgtSurfTmCut( nMainExtrusionId, nStartExtrusionId, true, false) + EgtSurfTmCut( nStartExtrusionId, nExtrCopyId, true, false) + -- posiziono il profilo End + local nRefEndProfileId = EgtGetFirstNameInGroup( nEndProfileId, 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( nNextGeoId, nSolidLayerId) + EgtExtendCurveStartByLen( nEndGuideId, 2 * dGeoWidth) + EgtExtendCurveEndByLen( nEndGuideId, 2 * dGeoWidth) + -- recupero frame del profilo + local nEndProfileFrameId = EgtGetFirstNameInGroup( nEndProfileId, WIN_SECTIONFRAME) + local frEndProfile = EgtFR( nEndProfileFrameId) + frEndProfile:move( - frEndProfile:getVersX() * dEndDelta) + frEndProfile:invert() + -- lo applico a tutte le geometrie del profilo + EgtTransform( EgtGetAllInGroup( nEndProfileId), frEndProfile) + -- assegno come riferimento del profilo il punto start dell'outline + EgtChangeGroupFrame( nEndProfileId, Frame3d( EgtSP( nEndGuideId), - EgtSV( nEndGuideId))) + -- recupero outline del profilo End e lo estrudo + local nOutEndProfileId + if sEndProfileType == WIN_MINIZINKEN then + nOutEndProfileId = EgtLine( nEndProfileId, EgtSP( nNextGeoId), EgtSP( nNextGeoId) - Z_AX() * b3RefEndProfile:getDimY(), GDB_RT.GLOB) + else + nOutEndProfileId = EgtGetFirstNameInGroup( nEndProfileId, sEndProfileType) + end + -- if (EndJointType == WIN_JNT.FULL_H and ( nProfileType == WIN_PRF.BOTTOM or nProfileType == WIN_PRF.TOP or nProfileType == WIN_PRF.LEFT)) or + -- (EndJointType == WIN_JNT.FULL_V and ( nProfileType == WIN_PRF.RIGHT)) then + -- EgtInvertCurve( nOutEndProfileId) + -- end + local nEndExtrusionId = EgtSurfTmSwept( nSolidLayerId, nOutEndProfileId, nEndGuideId, false) + -- taglio estrusi per ottenere solido + EgtSurfTmCut( nMainExtrusionId, nEndExtrusionId, true, false) + EgtSurfTmCut( nEndExtrusionId, nExtrCopyId, true, false) + EgtErase( nExtrCopyId) +end + +-- funzione che crea il solido del pezzo del telaio +function WinLib.CalcFrameSolid(nPartId, nOutlineId, nGeoId, nOutlineLayerId) + -- recupero profilo + local nProfileId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE) + local nProfileFrameLayerId = EgtGetFirstNameInGroup( nProfileId, WIN_FRAME) + -- creo layer per solido e per profili di estrusione + local nSolidLayerId = EgtGroup( nPartId) + EgtSetName( nSolidLayerId, WIN_SOLID) + local nFrameProfileLayerId = EgtGroup( nPartId) + EgtSetName( nFrameProfileLayerId, WIN_PROFILE) + -- ricavo tipo dal nome + local sName = EgtGetName( nPartId) + local nProfileType = WIN_PRF.NULL + if sName == WIN_TOP then + nProfileType = WIN_PRF.TOP + elseif sName == WIN_BOTTOM then + nProfileType = WIN_PRF.BOTTOM + elseif sName == WIN_LEFT then + nProfileType = WIN_PRF.LEFT + elseif sName == WIN_RIGHT then + nProfileType = WIN_PRF.RIGHT + elseif sName == WIN_VERTICAL then + nProfileType = WIN_PRF.VERTICAL + elseif sName == WIN_HORIZONTAL then + nProfileType = WIN_PRF.HORIZONTAL + elseif sName == WIN_SPLIT then + nProfileType = WIN_PRF.SPLIT + end + local nPrevOutlineId + local nNextOutlineId + local nOrigMainProfileId = GDB_ID.NULL + local nMainProfileId = GDB_ID.NULL + local nOrigStartProfileId = GDB_ID.NULL + local nStartProfileId = GDB_ID.NULL + local nOrigEndProfileId = GDB_ID.NULL + local nEndProfileId = GDB_ID.NULL + -- recupero outline precedente e successivo + if nProfileType == WIN_PRF.BOTTOM then + nPrevOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_LEFT) + nNextOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_RIGHT) + elseif nProfileType == WIN_PRF.RIGHT then + nPrevOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_BOTTOM) + nNextOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_TOP) + elseif nProfileType == WIN_PRF.TOP then + nPrevOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_RIGHT) + nNextOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_LEFT) + elseif nProfileType == WIN_PRF.LEFT then + nPrevOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_TOP) + nNextOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_BOTTOM) + elseif nProfileType == WIN_PRF.VERTICAL then + nPrevOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_BOTTOM) + nNextOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_TOP) + elseif nProfileType == WIN_PRF.HORIZONTAL then + nPrevOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_LEFT) + nNextOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_RIGHT) + elseif nProfileType == WIN_PRF.SPLIT then + local nStartId = EgtGetInfo( nOutlineId, WIN_SPLIT_STARTINTERS, 'i') + local nEndId = EgtGetInfo( nOutlineId, WIN_SPLIT_ENDINTERS, 'i') + local sStartName = EgtGetName( nStartId) + local sEndName = EgtGetName( nEndId) + nPrevOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, sStartName) + nNextOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, sEndName) + end + -- recupero profilo e controprofili + local sCurrProfileType = EgtGetInfo( nOutlineId, WIN_PROFILETYPE) + local sPrevProfileType = EgtGetInfo( nPrevOutlineId, WIN_PROFILETYPE) + local sNextProfileType = EgtGetInfo( nNextOutlineId, WIN_PROFILETYPE) + nOrigMainProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, sCurrProfileType) + nOrigStartProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, sPrevProfileType) + nOrigEndProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, sNextProfileType) + -- creo copie di profilo e controprofili + nMainProfileId = EgtCopy( nOrigMainProfileId, nFrameProfileLayerId) + EgtSetName( nMainProfileId, WIN_PRF_MAIN) + nStartProfileId = EgtCopy( nOrigStartProfileId, nFrameProfileLayerId) + EgtSetName( nStartProfileId, WIN_PRF_START) + nEndProfileId = EgtCopy( nOrigEndProfileId, nFrameProfileLayerId) + EgtSetName( nEndProfileId, WIN_PRF_END) + -- creo solido dai profili + WinLib.MakeSolidByExtrusion(nGeoId, nOutlineId, nMainProfileId, nStartProfileId, nEndProfileId, nProfileType, nSolidLayerId) + end + + -- funzione che calcola l'ingombro dei pezzi del telaio +function WinLib.CreatePartFromOutline( nAreaLayerId, nOutlineId) + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaLayerId, WIN_OUTLINE) + -- se area senza outline, cerco quella superiore + if not nOutlineLayerId then + local nParentAreaLayerId = EgtGetParent( nAreaLayerId) + if nParentAreaLayerId then + nOutlineLayerId = EgtGetFirstNameInGroup( nParentAreaLayerId, WIN_OUTLINE) + end + end + -- ricavo tipo dal nome + local sName = EgtGetName( nOutlineId) + local nProfileType = WIN_PRF.NULL + if sName == WIN_TOP then + nProfileType = WIN_PRF.TOP + elseif sName == WIN_BOTTOM then + nProfileType = WIN_PRF.BOTTOM + elseif sName == WIN_LEFT then + nProfileType = WIN_PRF.LEFT + elseif sName == WIN_RIGHT then + nProfileType = WIN_PRF.RIGHT + elseif sName == WIN_VERTICAL then + nProfileType = WIN_PRF.VERTICAL + elseif sName == WIN_HORIZONTAL then + nProfileType = WIN_PRF.HORIZONTAL + elseif sName == WIN_SPLIT then + nProfileType = WIN_PRF.SPLIT + end + -- creo pezzo + local nPartId = EgtGroup( GDB_ID.ROOT) + EgtSetName( nPartId, sName) + if nProfileType == WIN_PRF.BOTTOM or nProfileType == WIN_PRF.TOP or nProfileType == WIN_PRF.HORIZONTAL then + EgtSetColor( nPartId, Color3d( 204, 102, 0)) + elseif nProfileType == WIN_PRF.RIGHT or nProfileType == WIN_PRF.LEFT or nProfileType == WIN_PRF.VERTICAL then + EgtSetColor( nPartId, Color3d( 251, 128, 4)) + else + EgtSetColor( nPartId, Color3d( 255, 159, 57)) + end + + -- inserisco riferimento alla sua area + EgtSetInfo( nPartId, WIN_AREA, nAreaLayerId) + + -- disegno ingombro + local nGeoId = WinLib.CalcFrameGeo( nPartId, nOutlineId, nOutlineLayerId) + + -- disegno solido + WinLib.CalcFrameSolid(nPartId, nOutlineId, nGeoId, nOutlineLayerId) + + -- offset per distanziare i pezzi + --local dYPosOffset = 300 * ( nProfileType - 1) + --EgtChangeGroupFrame( nPartId, Frame3d( Point3d( 0, dYPosOffset, 0))) + +end + +-- funzione che posiziona un pezzo +function WinLib.PositionPart(nPartId) + -- ricavo tipo dal nome + local sName = EgtGetName( nPartId) + local sDelta = '' + if sName == WIN_BOTTOM then + sDelta = WIN_STARTCPDELTA + elseif sName == WIN_RIGHT then + sDelta = WIN_STARTCPDELTA + elseif sName == WIN_TOP then + sDelta = WIN_STARTCPDELTA + elseif sName == WIN_LEFT then + sDelta = WIN_STARTCPDELTA + end + -- calcolo nuovo riferimento + local nGeoPartLayerId = EgtGetFirstNameInGroup( nPartId, WIN_GEO) + local nGeoPartId = EgtGetFirstNameInGroup( nGeoPartLayerId, sName) + local dDelta = EgtGetInfo( nGeoPartId, sDelta, 'd') or 0 + local nFrameLayerId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_FRAME) + local nOutlineLayerId = EgtGetFirstNameInGroup( nFrameLayerId, WIN_OUTLINE) + local nFramePartId = EgtGetFirstNameInGroup( nOutlineLayerId, sName) + local vtStart = EgtSV( nFramePartId) + local ptStart = EgtSP( nFramePartId) + vtStart * dDelta + local _, _, dAngRight = SphericalFromVector(vtStart) + local frStart = Frame3d( ptStart) + frStart:rotate( frStart:getOrigin(), Z_AX(), dAngRight) + EgtChangeGroupFrame( nPartId, frStart) +end + +-- funzione che assembla i pezzi +function WinLib.AssembleFrame() + local nBottomPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_BOTTOM) + WinLib.PositionPart(nBottomPartId) + local nRightPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_RIGHT) + WinLib.PositionPart(nRightPartId) + local nTopPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_TOP) + WinLib.PositionPart(nTopPartId) + local nLeftPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_LEFT) + WinLib.PositionPart(nLeftPartId) + -- assemblo i pezzi + --local nRightPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_RIGHT) + --local nGeoRightLayerId = EgtGetFirstNameInGroup( nRightPartId, WIN_GEO) + --local nGeoRightId = EgtGetFirstNameInGroup( nGeoRightLayerId, WIN_RIGHT) + --local dDelta = EgtGetInfo( nGeoRightId, WIN_BOTTOMCPDELTA, 'd') + --local nFrameLayerId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_FRAME) + --local nOutlineLayerId = EgtGetFirstNameInGroup( nFrameLayerId, WIN_OUTLINE) + --local nFrameRightId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_RIGHT) + --local vtRight = EgtSV( nFrameRightId) + --local ptRight = EgtSP( nFrameRightId) + vtRight * dDelta + --local _, _, dAngRight = SphericalFromVector(vtRight) + --local frRight = Frame3d( ptRight) + --frRight:rotate( frRight:getOrigin(), Z_AX(), dAngRight) + --EgtChangeGroupFrame( nRightPartId, frRight) +end + +--------------------------------------------------------------------- +return WinLib diff --git a/Profiles/WinLib/WinCalculate.lua b/Profiles/WinLib/WinCalculate.lua new file mode 100644 index 0000000..7180cf5 --- /dev/null +++ b/Profiles/WinLib/WinCalculate.lua @@ -0,0 +1,2322 @@ +-- +-- EEEEEEEEEE GGGGGG TTTTTTTTTTTTTT +-- EEEEEEEEEE GGGGGGGGGG TTTTTTTTTTTTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEEEEEEEE GGGGGGGGGG TTTT +-- EEEEEEEEEE GGGGGG TTTT +-- +-- by Egalware s.r.l. +-- Window project software by Egalware s.r.l. 2023/05/02 + +-- Tabella per definizione modulo +local WinCalculate = {} + +-- Include +require( 'EgtBase') +require( 'WinConst') + +local bCalcSolid = false +function WinCalculate.GetCalcSolid() + return bCalcSolid +end +function WinCalculate.SetCalcSolid( bValue) + bCalcSolid = bValue +end + +-- funzioni + +-- funzione che cicla ricorsivamente sulla struttura per creare tutti i pezzi della finestra +function WinCalculate.CreatePartFromArea( nAreaId) + WinCalculate.CalcProfileType(nAreaId) + WinCalculate.CalculateOutlineFromAreaOutline( nAreaId) + -- recupero tipo di area + local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') + if nAreaType == WIN_AREATYPES.FRAME or nAreaType == WIN_AREATYPES.SASH then + -- creo pezzi outline + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_OUTLINE) + local nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) + while nOutlineId do + WinCalculate.CreatePartFromOutline( nAreaId, nOutlineId) + + -- se di tipo bottom + local sName = EgtGetName( nOutlineId) + if sName == WIN_BOTTOM then + -- se ha BottomRail + local nBottomRail = EgtGetInfo( nOutlineLayerId, WIN_BOTTOMRAIL, 'i') + if nBottomRail and nBottomRail == 1 then + WinCalculate.CreatePartFromOutline( nAreaId, nOutlineId, true) + end + end + + nOutlineId = EgtGetNext( nOutlineId) + end + end + if nAreaType == WIN_AREATYPES.FILL then + -- creo riempimento + WinCalculate.CreatePartFromOutline( nAreaId) + end + -- verifico se c'e' uno split + local nSplitLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_SPLIT) + if nSplitLayerId then + local nSplitType = EgtGetInfo( nSplitLayerId, WIN_SPLITTYPE, 'i') + local bCalcSplit = false + -- se split di tipo montante + if nSplitType == WIN_SPLITTYPES.MULLION then + bCalcSplit = true + elseif nSplitType == WIN_SPLITTYPES.FRENCH then + bCalcSplit = false + else + -- o split dell'anta + local nParentArea = nAreaId + local nParentType = nAreaType + while nParentArea and nParentType ~= WIN_AREATYPES.FRAME and nParentType ~= WIN_AREATYPES.SASH do + nParentArea = EgtGetParent( nParentArea) + nParentType = EgtGetInfo( nParentArea, WIN_AREATYPE, 'i') + end + if nParentArea and nParentType == WIN_AREATYPES.SASH then + bCalcSplit = true + else + bCalcSplit = true + end + end + if bCalcSplit then + local nSplitId = EgtGetFirstInGroup( nSplitLayerId) + if nSplitId then + -- creo pezzo split + WinCalculate.CreatePartFromOutline( nAreaId, nSplitId) + end + end + elseif nAreaType ~= WIN_AREATYPES.FILL then + if WinCalculate.GetCalcSolid() then + -- verifico se c'e' un'area Sash prima di questa + local nParentAreaId = nAreaId + local nParentAreaType = EgtGetInfo( nParentAreaId, WIN_AREATYPE, "i") + while nParentAreaId and nParentAreaType and nParentAreaType ~= WIN_AREATYPES.SASH do + nParentAreaId = EgtGetParent( nParentAreaId) + nParentAreaType = EgtGetInfo( nParentAreaId, WIN_AREATYPE, "i") + end + if nParentAreaId and nParentAreaType == WIN_AREATYPES.SASH then + -- calcolo strip dell'outline + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_OUTLINE) + local nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) + while nOutlineId do + WinCalculate.CreateStripFromOutline( nAreaId, nOutlineId) + nOutlineId = EgtGetNext( nOutlineId) + end + else + --- verifico se area successiva e' un fill + local nChildAreaId = EgtGetFirstNameInGroup( nAreaId, WIN_AREAASTERISK) + local nChildAreaType = EgtGetInfo( nChildAreaId, WIN_AREATYPE, "i") + if nChildAreaType == WIN_AREATYPES.FILL then + -- se lo e', vuol dire che e' un vetro fisso, quindi calcolo strip dell'outline + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_OUTLINE) + local nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) + while nOutlineId do + WinCalculate.CreateStripFromOutline( nAreaId, nOutlineId) + nOutlineId = EgtGetNext( nOutlineId) + end + end + end + end + end + -- verifico se ci sono aree + local nChildAreaId = EgtGetFirstNameInGroup( nAreaId, WIN_AREA .. '*') + while nChildAreaId do + -- lancio costruzione pezzi di quell'area + WinCalculate.CreatePartFromArea( nChildAreaId) + nChildAreaId = EgtGetNextName( nChildAreaId, WIN_AREA .. '*') + end +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 +function WinCalculate.TrimAndOrientOrderedCurveLayer( nLayerId) + local IntersCurveList = {} + local LastCurveInters + local ptInters + local nCurveId = EgtGetFirstInGroup( nLayerId) + -- ciclo sui segmenti per ottenere lista intersezioni + while nCurveId do + local nPrevId = EgtGetPrev( nCurveId) + if not nPrevId then + nPrevId = EgtGetLastInGroup( nLayerId) + end + ptInters = EgtIP( nCurveId, nPrevId, EgtSP( nCurveId)) + if not ptInters then + local dDist = abs( ( EgtEP( nPrevId) - EgtSP(nCurveId)):len()) + EgtExtendCurveStartByLen( nCurveId, 2 * dDist) + EgtExtendCurveEndByLen( nCurveId, 2 * dDist) + EgtExtendCurveStartByLen( nPrevId, 2 * dDist) + EgtExtendCurveEndByLen( nPrevId, 2 * dDist) + ptInters = EgtIP( nCurveId, nPrevId, EgtSP( nCurveId)) + end + if LastCurveInters then + LastCurveInters.EndInters = Point3d( ptInters) + end + local NewCurveInters = { CurveId = nCurveId, StartInters = Point3d( ptInters)} + table.insert( IntersCurveList, NewCurveInters) + LastCurveInters = NewCurveInters + nCurveId = EgtGetNext( nCurveId) + end + IntersCurveList[#IntersCurveList].EndInters = IntersCurveList[1].StartInters + -- ciclo per tagliare ed orientare + for nIntersCurveIndex = 1, #IntersCurveList do + local CurveInters = IntersCurveList[nIntersCurveIndex] + local dStartParam = EgtCurveParamAtPoint( CurveInters.CurveId, CurveInters.StartInters) + local dEndParam = EgtCurveParamAtPoint( CurveInters.CurveId, CurveInters.EndInters) + EgtTrimCurveStartEndAtParam( CurveInters.CurveId, min( dStartParam, dEndParam), max( dStartParam, dEndParam)) + if dStartParam > dEndParam then + EgtInvertCurve( CurveInters.CurveId) + end + end +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 +function WinCalculate.TrimInOrderedCurveLayer( nLayerId) + local nCurveId = EgtGetFirstInGroup( nLayerId) + while nCurveId do + local nNextId = EgtGetNext( nCurveId) + if not nNextId then + nNextId = EgtGetFirstInGroup( nLayerId) + end + local ptInters = EgtIP( nCurveId, nNextId, EgtEP( nCurveId)) + if ptInters then + local dIntersCurveParam = EgtCurveParamAtPoint( nCurveId, ptInters) + EgtTrimCurveEndAtParam( nCurveId, dIntersCurveParam) + local dIntersNextParam = EgtCurveParamAtPoint( nNextId, ptInters) + EgtTrimCurveStartAtParam( nNextId, dIntersNextParam) + end + nCurveId = EgtGetNext( nCurveId) + end +end + +function WinCalculate.TrimSplitWithOutline( nSplitId) + -- lo taglio con outline + local nStartIntersId = EgtGetInfo( nSplitId, WIN_SPLIT_STARTINTERS, 'i') + local nOutlineId = EgtGetInfo( nStartIntersId, WIN_CHILD, 'i') + local ptStartInters = EgtIP( nSplitId, nOutlineId, EgtSP( nSplitId)) + local dStartInters = EgtCurveParamAtPoint( nSplitId, ptStartInters) + EgtTrimCurveStartAtParam( nSplitId, dStartInters) + local nEndIntersId = EgtGetInfo( nSplitId, WIN_SPLIT_ENDINTERS, 'i') + nOutlineId = EgtGetInfo( nEndIntersId, WIN_CHILD, 'i') + local ptEndInters = EgtIP( nSplitId, nOutlineId, EgtSP( nSplitId)) + local dEndInters = EgtCurveParamAtPoint( nSplitId, ptEndInters) + EgtTrimCurveEndAtParam( nSplitId, dEndInters) +end + +-- funzione che calcola l'outline dall'area outline +function WinCalculate.CalculateOutlineFromAreaOutline( nAreaId) + local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') + -- if nAreaType == WIN_AREATYPES.FRAME or nAreaType == WIN_AREATYPES.SPLIT or nAreaType == WIN_AREATYPES.NULL then + -- -- copio BaseOutline in outline + -- local nAreaOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_AREAOUTLINE) + -- local nOutlineLayerId = EgtCopy( nAreaOutlineLayerId, nAreaId) + -- EgtSetName( nOutlineLayerId, WIN_OUTLINE) + -- local nAreaOutlineId = EgtGetFirstInGroup( nAreaOutlineLayerId) + -- local nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) + -- while nAreaOutlineId do + -- EgtSetInfo( nAreaOutlineId, WIN_COPY, nOutlineId) + -- EgtRemoveInfo( nOutlineId, WIN_SOU) + -- nAreaOutlineId = EgtGetNext( nAreaOutlineId) + -- nOutlineId = EgtGetNext( nOutlineId) + -- end + -- -- se presente, copio split + -- local nBaseSplitLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_BASESPLIT) + -- if nBaseSplitLayerId then + -- local nSplitLayerId = EgtCopy( nBaseSplitLayerId, nAreaId) + -- EgtSetName( nSplitLayerId, WIN_SPLIT) + -- local nBaseSplitId = EgtGetFirstInGroup( nBaseSplitLayerId) + -- local nSplitId = EgtGetFirstInGroup( nSplitLayerId) + -- EgtSetInfo( nBaseSplitId, WIN_COPY, nSplitId) + -- EgtRemoveInfo( nSplitId, WIN_SOU) + -- end + if nAreaType == WIN_AREATYPES.FRAME then + -- copio BaseOutline in outline + local nAreaOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_AREAOUTLINE) + local nOutlineLayerId = EgtCopy( nAreaOutlineLayerId, nAreaId) + EgtSetName( nOutlineLayerId, WIN_OUTLINE) + local nAreaOutlineId = EgtGetFirstInGroup( nAreaOutlineLayerId) + local nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) + while nAreaOutlineId do + EgtSetInfo( nAreaOutlineId, WIN_COPY, nOutlineId) + EgtRemoveInfo( nOutlineId, WIN_SOU) + nAreaOutlineId = EgtGetNext( nAreaOutlineId) + nOutlineId = EgtGetNext( nOutlineId) + end + -- se presente, copio split + local nBaseSplitLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_BASESPLIT) + if nBaseSplitLayerId then + local nSplitLayerId = EgtCopy( nBaseSplitLayerId, nAreaId) + EgtSetName( nSplitLayerId, WIN_SPLIT) + local nBaseSplitId = EgtGetFirstInGroup( nBaseSplitLayerId) + local nSplitId = EgtGetFirstInGroup( nSplitLayerId) + EgtSetInfo( nBaseSplitId, WIN_COPY, nSplitId) + EgtRemoveInfo( nSplitId, WIN_SOU) + end + elseif nAreaType == WIN_AREATYPES.SPLIT or nAreaType == WIN_AREATYPES.NULL then + -- creo gruppo per outline + local nAreaOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_AREAOUTLINE) + local nOutlineLayerId = EgtCopy( nAreaOutlineLayerId, nAreaId) + EgtSetName( nOutlineLayerId, WIN_OUTLINE) + EgtEmptyGroup( nOutlineLayerId) + -- recupero outline di livello precedente e lo copio pezzo per pezzo + local nSplitId + local nBaseOutlineId = EgtGetFirstInGroup( nAreaOutlineLayerId) + while nBaseOutlineId do + local sBaseName = EgtGetName( nBaseOutlineId) + local nSouId = EgtGetInfo( nBaseOutlineId, WIN_SOU) + local nSouParentId = EgtGetParent( nSouId) + local sSouParentName = EgtGetName( nSouParentId) + local nCopyId = EgtGetInfo( nSouId, WIN_COPY) + local nNewOutlineId = EgtCopy( nCopyId, nOutlineLayerId) + -- se discende da split + if sSouParentName == WIN_BASESPLIT then + -- aggiorno nome + EgtSetName( nNewOutlineId, sBaseName) + nSplitId = nNewOutlineId + end + EgtSetInfo( nNewOutlineId, WIN_SOU, nBaseOutlineId) + EgtSetInfo( nBaseOutlineId, WIN_COPY, nNewOutlineId) + EgtRemoveInfo( nNewOutlineId, WIN_CHILD) + EgtRemoveInfo( nNewOutlineId, WIN_COPY) + nBaseOutlineId = EgtGetNext( nBaseOutlineId) + end + -- taglio tutti i contorni + WinCalculate.TrimAndOrientOrderedCurveLayer( nOutlineLayerId) + -- se esiste un outline che deriva da uno split + if nSplitId then + -- recupero il successivo + local nNextId = EgtGetNext( nSplitId) + if not nNextId then + nNextId = EgtGetFirstInGroup( nOutlineLayerId) + end + end + -- se presente, copio split + local nBaseSplitLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_BASESPLIT) + if nBaseSplitLayerId then + local nSplitLayerId = EgtCopy( nBaseSplitLayerId, nAreaId) + EgtSetName( nSplitLayerId, WIN_SPLIT) + local nBaseSplitId = EgtGetFirstInGroup( nBaseSplitLayerId) + local nSplitId = EgtGetFirstInGroup( nSplitLayerId) + EgtSetInfo( nBaseSplitId, WIN_COPY, nSplitId) + EgtRemoveInfo( nSplitId, WIN_SOU) + -- lo taglio con outline + WinCalculate.TrimSplitWithOutline( nSplitId) + -- se split interno ad anta + local nParentAreaId = EgtGetParent( nAreaId) + local nParentAreaType = EgtGetInfo( nParentAreaId, WIN_AREATYPE, 'i') + 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.SASH then + -- recupero tipo di profilo + local sSplitProfile = EgtGetInfo( nSplitId, WIN_PROFILETYPE) + -- recupero profilo usato per anta + local nProfileLayerId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE) + local nSashProfileLayerId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_SASH) + local nSashProfileId = EgtGetFirstNameInGroup( nSashProfileLayerId, sSplitProfile) + -- calcolo offset sulla z dell'anta + local dSashZOffset = EgtGetInfo( nSashProfileId, WIN_DELTA, 'd') + -- sposto Split in Z + EgtMove( nSplitId, Z_AX() * dSashZOffset) + end + + end + elseif nAreaType == WIN_AREATYPES.SASH then + -- recupero BaseOutline dell'anta + local nSashAreaOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_AREAOUTLINE) + -- copio BaseOutline del sash e lo svuoto + local nSashOutlineLayerId = EgtCopy( nSashAreaOutlineLayerId, nAreaId) + EgtSetName( nSashOutlineLayerId, WIN_OUTLINE) + EgtEmptyGroup( nSashOutlineLayerId) + -- recupero se anta battente ricevente + local nSashType = EgtGetInfo( nAreaId, WIN_SASHTYPE, 'i') + -- ciclo su profilo disegnato anta + local nSashAreaOutlineId = EgtGetFirstInGroup( nSashAreaOutlineLayerId) + while nSashAreaOutlineId do + -- recupero pezzi del frame associati + local nPrevAreaOutlineId = EgtGetInfo( nSashAreaOutlineId, WIN_SOU , 'i') + local nPrevOutlineId = EgtGetInfo( nPrevAreaOutlineId, WIN_COPY, 'i') + -- verifico se outline e' segmento battente o ricevente che quindi deriva da split + local bFrenchSplitOutline = false + if nSashType and nSashType ~= WIN_SASHTYPES.NULL then + -- faccio sou due volte per trovare il tipo dell'outline originale da cui deriva + local nSouId = EgtGetInfo( nSashAreaOutlineId, WIN_SOU, 'i') + nSouId = EgtGetInfo( nSouId, WIN_SOU, 'i') + local nSouLayerId = EgtGetParent( nSouId) + local sSouLayerName = EgtGetName( nSouLayerId) + if sSouLayerName == WIN_BASESPLIT then + bFrenchSplitOutline = true + end + end + -- recupero tipo di profili anta + local sSashProfile = EgtGetInfo( nSashAreaOutlineId, WIN_PROFILETYPE) + -- recupero profilo usato per anta + local nProfileLayerId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE) + local nSashProfileLayerId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_SASH) + local nSashProfileId = EgtGetFirstNameInGroup( nSashProfileLayerId, sSashProfile) + -- calcolo offset sulla z dell'anta + local dSashZOffset = EgtGetInfo( nSashProfileId, WIN_DELTA, 'd') + local b3FrameProfile + if not bFrenchSplitOutline then + -- cerco a ritroso il frame + local nFrameAreaOutlineId = nSashAreaOutlineId + local nFrameAreaOutlineLayerId + local sFrameAreaOutlineLayer + local nFrameAreaId + local nFrameAreaType + repeat + nFrameAreaOutlineId = EgtGetInfo( nFrameAreaOutlineId, WIN_SOU , 'i') + nFrameAreaOutlineLayerId = EgtGetParent( nFrameAreaOutlineId) + sFrameAreaOutlineLayer = EgtGetName( nFrameAreaOutlineLayerId) + nFrameAreaId = EgtGetParent( nFrameAreaOutlineLayerId) + nFrameAreaType = EgtGetInfo( nFrameAreaId, WIN_AREATYPE, 'i') + until not nFrameAreaOutlineId or ( nFrameAreaType == WIN_AREATYPES.FRAME and sFrameAreaOutlineLayer == WIN_AREAOUTLINE or sFrameAreaOutlineLayer == WIN_BASESPLIT) or ( nFrameAreaType == WIN_AREATYPES.SPLIT and sFrameAreaOutlineLayer == WIN_BASESPLIT) + local nFrameOutlineId = EgtGetInfo( nFrameAreaOutlineId, WIN_COPY, 'i') + -- recupero tipi di profili anta e telaio + local sFrameProfile = EgtGetInfo( nFrameOutlineId, WIN_PROFILETYPE) + -- recupero profili usati per anta e telaio + local nFrameProfileLayerId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_FRAME) + local nFrameProfileId = EgtGetFirstNameInGroup( nFrameProfileLayerId, sFrameProfile) + -- recupero le relative origini + local nFrameFrameProfileId = EgtGetFirstNameInGroup( nFrameProfileId, WIN_SECTIONFRAME) + local frFrameProfileId = EgtFR(nFrameFrameProfileId) + -- calcolo il box del riferimento del profilo del frame + local nRefFrameProfileId = EgtGetFirstNameInGroup( nFrameProfileId, WIN_REF) + b3FrameProfile = EgtGetBBoxRef( nRefFrameProfileId, GDB_BB.STANDARD, frFrameProfileId) + end + -- creo copia outline e lo offsetto + local nSashOutlineId + if bFrenchSplitOutline then + -- copio outline del frame + nSashOutlineId = EgtCopy( nPrevOutlineId, nSashOutlineLayerId) + EgtSetInfo( nSashAreaOutlineId, WIN_COPY, nSashOutlineId) + else + -- calcolo offset perpendicolare + local dOverlap = EgtGetInfo( nSashProfileId, WIN_OVERLAP, 'd') + local dSashPerpOffset = abs( b3FrameProfile:getMin():getX()) - dOverlap + -- copio outline del frame + nSashOutlineId = EgtCopy( nPrevOutlineId, nSashOutlineLayerId) + EgtSetInfo( nSashAreaOutlineId, WIN_COPY, nSashOutlineId) + -- faccio offset + EgtOffsetCurve( nSashOutlineId, - dSashPerpOffset) + end + -- sposto anta in Z + EgtMove( nSashOutlineId, Z_AX() * dSashZOffset) + -- riporto info tipo profilo + EgtSetInfo( nSashOutlineId, WIN_PROFILETYPE, sSashProfile) + -- riporto riferimento ad elemento di BaseArea + EgtSetInfo( nSashOutlineId, WIN_COPY, nSashAreaOutlineId) + nSashAreaOutlineId = EgtGetNext( nSashAreaOutlineId) + end + -- accorcio gli offset + WinCalculate.TrimAndOrientOrderedCurveLayer( nSashOutlineLayerId) + -- WinCalculate.TrimInOrderedCurveLayer( nSashOutlineLayerId) + -- se presente, copio split + local nBaseSplitLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_BASESPLIT) + if nBaseSplitLayerId then + local nBaseSplitId = EgtGetFirstInGroup( nBaseSplitLayerId) + -- recupero tipo di profilo split + local sSplitProfile = EgtGetInfo( nBaseSplitId, WIN_PROFILETYPE) + -- recupero profilo usato per anta + local nProfileLayerId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE) + local nSplitProfileLayerId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_SASH) + local nSplitProfileId = EgtGetFirstNameInGroup( nSplitProfileLayerId, sSplitProfile) + -- calcolo offset sulla z dell'anta + local dSplitZOffset = EgtGetInfo( nSplitProfileId, WIN_DELTA, 'd') + -- creo copia + local nSplitLayerId = EgtCopy( nBaseSplitLayerId, nAreaId) + EgtSetName( nSplitLayerId, WIN_SPLIT) + local nSplitId = EgtGetFirstInGroup( nSplitLayerId) + -- la taglio con outline + WinCalculate.TrimSplitWithOutline( nSplitId) + -- sposto split in Z + EgtMove( nSplitId, Z_AX() * dSplitZOffset) + EgtSetInfo( nBaseSplitId, WIN_COPY, nSplitId) + EgtRemoveInfo( nSplitId, WIN_SOU) + end + elseif nAreaType == WIN_AREATYPES.FILL then + -- recupero BaseArea del riempimento + local nFillBaseAreaLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_AREAOUTLINE) + -- copio area outline del fill e la svuoto + local nFillOutlineLayerId = EgtCopy( nFillBaseAreaLayerId, nAreaId) + EgtSetName( nFillOutlineLayerId, WIN_OUTLINE) + EgtEmptyGroup( nFillOutlineLayerId) + -- ciclo su BaseArea riempimento + local nFillAreaOutlineId = EgtGetFirstInGroup( nFillBaseAreaLayerId) + while nFillAreaOutlineId do + local nParentBaseOutlineId = EgtGetInfo( nFillAreaOutlineId, WIN_SOU) + local nParentOutlineId = EgtGetInfo( nParentBaseOutlineId, WIN_COPY) + -- recupero pezzi dell'anta o dello split anta (o del frame a vetro fisso) associati + local nSashAreaOutlineId = nFillAreaOutlineId + local nSashAreaLayerId + local nSashAreaId + local nSashAreaType + local sSashLayerName + repeat + nSashAreaOutlineId = EgtGetInfo( nSashAreaOutlineId, WIN_SOU , 'i') + nSashAreaLayerId = EgtGetParent( nSashAreaOutlineId) + nSashAreaId = EgtGetParent( nSashAreaLayerId) + nSashAreaType = EgtGetInfo( nSashAreaId, WIN_AREATYPE, 'i') + if nSashAreaType == WIN_AREATYPES.SPLIT then + sSashLayerName = EgtGetName( nSashAreaLayerId) + end + until not nSashAreaOutlineId or not nSashAreaId or nSashAreaType == WIN_AREATYPES.FRAME or nSashAreaType == WIN_AREATYPES.SASH or ( nSashAreaType == WIN_AREATYPES.SPLIT and sSashLayerName == WIN_BASESPLIT) + -- recupero tipo di profilo anta (o frame a vetro fisso) + local sSashProfile = EgtGetInfo( nSashAreaOutlineId, WIN_PROFILETYPE) + -- verifico se BottomRail + if nSashAreaType == WIN_AREATYPES.FRAME then + local nBottomRail = EgtGetInfo( nSashAreaLayerId, WIN_BOTTOMRAIL, 'i') + local sSashAreaOutlineName = EgtGetName( nSashAreaOutlineId) + if nBottomRail and sSashAreaOutlineName == WIN_BOTTOM and nBottomRail == 1 then + -- allora imposto profilo BottomRail + sSashProfile = WIN_RAIL_BOTTOM + end + end + -- recupero se discende da anta o frame + local sProfileType + if nSashAreaType == WIN_AREATYPES.FRAME then + sProfileType = WIN_FRAME + elseif nSashAreaType == WIN_AREATYPES.SASH then + sProfileType = WIN_SASH + else + -- verifico guardando le aree prewcedentei se e' successivo ad un'anta o al frame + local nAreaLayerId = EgtGetParent( EgtGetParent( nFillAreaOutlineId)) + repeat + nAreaLayerId = EgtGetParent( nAreaLayerId) + nSashAreaType = EgtGetInfo( nAreaLayerId, WIN_AREATYPE, 'i') + until not nSashAreaOutlineId or not nAreaLayerId or nSashAreaType == WIN_AREATYPES.FRAME or nSashAreaType == WIN_AREATYPES.SASH + if nSashAreaOutlineId and nAreaLayerId and nSashAreaType == WIN_AREATYPES.FRAME then + sProfileType = WIN_FRAME + elseif nSashAreaOutlineId and nAreaLayerId and nSashAreaType == WIN_AREATYPES.SASH then + sProfileType = WIN_SASH + end + end + -- recupero profilo usato per anta (o frame a vetro fisso) + local nProfileLayerId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE) + local nSashProfileLayerId = EgtGetFirstNameInGroup( nProfileLayerId, sProfileType) + local nSashProfileId = EgtGetFirstNameInGroup( nSashProfileLayerId, sSashProfile) + -- recupero le relative origini + local nFrameSashProfileId = EgtGetFirstNameInGroup( nSashProfileId, WIN_SECTIONFRAME) + local frSashProfileId = EgtFR(nFrameSashProfileId) + -- calcolo il box del riferimento del profilo del frame + local nRefSashProfileId = EgtGetFirstNameInGroup( nSashProfileId, WIN_REF) + local b3FrameProfile = EgtGetBBoxRef( nRefSashProfileId, GDB_BB.STANDARD, frSashProfileId) + -- calcolo offset perpendicolare e sulla z dell'anta + local dOverlap = EgtGetInfo( nSashProfileId, WIN_FILLOVERLAP, 'd') + local dFillPerpOffset = abs( b3FrameProfile:getMin():getX()) - dOverlap + local dFillZOffset = EgtGetInfo( nSashProfileId, WIN_FILLDELTA, 'd') + -- copio outline del sash + local nFillOutlineId = EgtCopy( nParentOutlineId, nFillOutlineLayerId) + EgtSetInfo( nFillAreaOutlineId, WIN_CHILD, nFillOutlineId) + -- faccio offset + EgtOffsetCurve( nFillOutlineId, - dFillPerpOffset) + EgtMove( nFillOutlineId, Z_AX() * dFillZOffset) + nFillAreaOutlineId = EgtGetNext( nFillAreaOutlineId) + end + -- accorcio gli offset + WinCalculate.TrimAndOrientOrderedCurveLayer( nFillOutlineLayerId) + -- WinCalculate.TrimInOrderedCurveLayer( nFillOutlineLayerId) + + -- elseif ... + + end +end + +-- funzione che verifica se ci sono Sash dopo +function WinCalculate.VerifyChildArea( nAreaId) + local nChildAreaId = EgtGetFirstNameInGroup( nAreaId, WIN_AREAASTERISK) + local nChildAreaType + if nChildAreaId then + nChildAreaType = EgtGetInfo( nChildAreaId, WIN_AREATYPE, 'i') + if nChildAreaType == WIN_AREATYPES.SASH then + return true + end + if WinCalculate.VerifyChildArea( nChildAreaId) then return true end + end + while nChildAreaId and nChildAreaType ~= WIN_AREATYPES.SASH do + nChildAreaId = EgtGetNextName( nChildAreaId, WIN_AREAASTERISK) + if nChildAreaId then + nChildAreaType = EgtGetInfo( nChildAreaId, WIN_AREATYPE, 'i') + if nChildAreaType == WIN_AREATYPES.SASH then + return true + end + end + if WinCalculate.VerifyChildArea( nChildAreaId) then return true end + end + return false +end + +-- funzione che imposta i tipi di profilo in base al tipo di pezzi +function WinCalculate.CalcProfileType( nAreaId) + local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') + if nAreaType == WIN_AREATYPES.FRAME then + -- verifico se ci sono Split + local nSplitLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_BASESPLIT) + local nSplitType + if nSplitLayerId then + -- verifico il tipo di split + nSplitType = EgtGetInfo( nSplitLayerId, WIN_SPLITTYPE, 'i') + if not nSplitType then + -- verifico se ci sono Sash prima + local nParentAreaId = nAreaId + local nParentAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') + while nParentAreaId and nParentAreaType ~= WIN_AREATYPES.SASH do + nParentAreaId = EgtGetParent( nParentAreaId) + nParentAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') + end + -- se non ci sono + if not nParentAreaId or nParentAreaId ~= WIN_AREATYPES.SASH then + -- verifico se ci sono Sash dopo + local bSashAfter = WinCalculate.VerifyChildArea( nAreaId) + -- se ci sono + if bSashAfter then + -- assegno tipo di profilo a mullion + EgtSetInfo( nSplitLayerId, WIN_SPLITTYPE, WIN_SPLITTYPES.MULLION) + nSplitType = WIN_SPLITTYPES.MULLION + end + end + end + end + -- se montante, devo considerare separatamente le due ante + if nSplitType and nSplitType == WIN_SPLITTYPES.MULLION then + -- assegno tipo di profilo al montante + local nSplitId = EgtGetFirstInGroup( nSplitLayerId) + -- verifico direzione per dare nome + local vtMedia = ( ( EgtEV( nSplitId) - EgtSV( nSplitId)) / 2) + if not vtMedia:normalize() then + vtMedia = EgtSV( nSplitId) + end + if abs( vtMedia:getX()) > abs( vtMedia:getY()) then + EgtSetInfo( nSplitId, WIN_PROFILETYPE, WIN_SASH_HORIZONTAL ) + else + EgtSetInfo( nSplitId, WIN_PROFILETYPE, WIN_SASH_VERTICAL ) + end + -- ciclo su outline + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_AREAOUTLINE) + local nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) + while nOutlineId do + -- recupero tipo del child + local nChildId = nOutlineId + local nChildAreaId + local nChildType + -- ciclo fino a trovare un child che non sia uno split + repeat + nChildId = EgtGetInfo( nChildId, WIN_CHILD) + nChildAreaId = EgtGetParent( EgtGetParent( nChildId)) + nChildType = EgtGetInfo( nChildAreaId, WIN_AREATYPE, 'i') + until not nChildId or ( nChildType ~= WIN_AREATYPES.SPLIT and nChildType ~= WIN_AREATYPES.NULL) + local sName = EgtGetName( nOutlineId) + if nChildType == WIN_AREATYPES.SASH then + if sName == WIN_BOTTOM then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SASH_BOTTOM) + else + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SASH_TOP) + end + elseif nChildType == WIN_AREATYPES.FILL then + if sName == WIN_BOTTOM then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_FIXED_BOTTOM) + else + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_FIXED_TOP) + end + end + nOutlineId = EgtGetNext( nOutlineId) + end + -- se battente - ricevente, guardo tipo del contenuto + elseif nSplitType and nSplitType == WIN_SPLITTYPES.FRENCH then + -- ciclo su outline + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_AREAOUTLINE) + local nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) + while nOutlineId do + local sName = EgtGetName( nOutlineId) + -- assegno tipo profilo + if sName == WIN_BOTTOM then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SASH_BOTTOM) + else + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SASH_TOP) + end + nOutlineId = EgtGetNext( nOutlineId) + end + -- se interno a vetro fisso o senza split + else + -- se vetro fisso + if nSplitLayerId then + -- assegno tipo di profilo allo Split + local nSplitId = EgtGetFirstInGroup( nSplitLayerId) + EgtSetInfo( nSplitId, WIN_PROFILETYPE, WIN_FRAME_SPLIT) + end + -- ciclo su outline + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_AREAOUTLINE) + local nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) + while nOutlineId do + -- recupero tipo del child + local nChildId = nOutlineId + local nChildAreaId + local nChildType + -- ciclo fino a trovare un child che non sia uno split + repeat + nChildId = EgtGetInfo( nChildId, WIN_CHILD) + nChildAreaId = EgtGetParent( EgtGetParent( nChildId)) + nChildType = EgtGetInfo( nChildAreaId, WIN_AREATYPE, 'i') + until not nChildId or ( nChildType ~= WIN_AREATYPES.SPLIT and nChildType ~= WIN_AREATYPES.NULL) + local sName = EgtGetName( nOutlineId) + if nChildType == WIN_AREATYPES.SASH then + if sName == WIN_BOTTOM then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SASH_BOTTOM) + else + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SASH_TOP) + end + elseif nChildType == WIN_AREATYPES.FILL then + if sName == WIN_BOTTOM then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_FIXED_BOTTOM) + else + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_FIXED_TOP) + end + end + nOutlineId = EgtGetNext( nOutlineId) + end + end + elseif nAreaType == WIN_AREATYPES.SPLIT or nAreaType == WIN_AREATYPES.NULL then + -- verifico se ci sono Split + local nSplitLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_BASESPLIT) + -- se split non definito, verifico se sia implicitamente un mulion + if nSplitLayerId then + -- verifico il tipo di split + local nSplitType = EgtGetInfo( nSplitLayerId, WIN_SPLITTYPE, 'i') + if not nSplitType then + -- verifico il tipo di split + nSplitType = EgtGetInfo( nSplitLayerId, WIN_SPLITTYPE, 'i') + if not nSplitType then + -- verifico se ci sono Sash prima + local nParentAreaId = nAreaId + local nParentAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') + while nParentAreaId and nParentAreaType ~= WIN_AREATYPES.SASH do + nParentAreaId = EgtGetParent( nParentAreaId) + nParentAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') + end + -- se non ci sono + if not nParentAreaId or nParentAreaId ~= WIN_AREATYPES.SASH then + -- verifico se ci sono Sash dopo + local bSashAfter = WinCalculate.VerifyChildArea( nAreaId) + -- se ci sono + if bSashAfter then + -- assegno tipo di profilo a mullion + EgtSetInfo( nSplitLayerId, WIN_SPLITTYPE, WIN_SPLITTYPES.MULLION) + nSplitType = WIN_SPLITTYPES.MULLION + end + end + end + end + -- se split non definito + if not nSplitType then + -- se split interno ad anta + local nParentAreaId = EgtGetParent( nAreaId) + local nParentAreaType = EgtGetInfo( nParentAreaId, WIN_AREATYPE, 'i') + while nParentAreaType ~= WIN_AREATYPES.FRAME and nParentAreaType ~= WIN_AREATYPES.SASH do + nParentAreaId = EgtGetParent( nParentAreaId) + nParentAreaType = EgtGetInfo( nParentAreaId, WIN_AREATYPE, 'i') + end + -- assegno tipo di profilo allo Split + local nSplitId = EgtGetFirstInGroup( nSplitLayerId) + if nParentAreaType == WIN_AREATYPES.SASH then + EgtSetInfo( nSplitId, WIN_PROFILETYPE, WIN_SASH_SPLIT ) + else + -- altrimenti vetro fisso + EgtSetInfo( nSplitId, WIN_PROFILETYPE, WIN_FRAME_SPLIT ) + end + end + -- se montante + if nSplitType == WIN_SPLITTYPES.MULLION then + -- assegno tipo di profilo al montante + local nSplitId = EgtGetFirstInGroup( nSplitLayerId) + -- verifico direzione per dare nome + local vtMedia = ( ( EgtEV( nSplitId) - EgtSV( nSplitId)) / 2) + if not vtMedia:normalize() then + vtMedia = EgtSV( nSplitId) + end + if abs( vtMedia:getX()) > abs( vtMedia:getY()) then + EgtSetInfo( nSplitId, WIN_PROFILETYPE, WIN_SASH_HORIZONTAL ) + else + EgtSetInfo( nSplitId, WIN_PROFILETYPE, WIN_SASH_VERTICAL ) + end + end + end + elseif nAreaType == WIN_AREATYPES.SASH then + -- verifico se e' di tipo battente ricevente + local nSashType = EgtGetInfo( nAreaId, WIN_SASHTYPE, 'i') + if nSashType and nSashType ~= WIN_SASHTYPES.NULL then + -- imposto profili sash + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_AREAOUTLINE) + local nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) + while nOutlineId do + -- faccio sou due volte per trovare il tipo dell'outline originale da cui deriva + local nSouId = EgtGetInfo( nOutlineId, WIN_SOU, 'i') + nSouId = EgtGetInfo( nSouId, WIN_SOU, 'i') + local nSouLayerId = EgtGetParent( nSouId) + local sSouLayerName = EgtGetName( nSouLayerId) + if sSouLayerName == WIN_BASESPLIT then + if nSashType == WIN_SASHTYPES.ACTIVE then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SASH_ACTIVE) + elseif nSashType == WIN_SASHTYPES.INACTIVE then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SASH_INACTIVE) + end + else + local sName = EgtGetName( nOutlineId) + if sName ~= WIN_BOTTOM then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_FRAME_TOP) + else + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_FRAME_BOTTOM) + end + end + nOutlineId = EgtGetNext( nOutlineId) + end + else + -- imposto profili sash + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_AREAOUTLINE) + local nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) + while nOutlineId do + local sName = EgtGetName( nOutlineId) + if sName ~= WIN_BOTTOM then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_FRAME_TOP) + else + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_FRAME_BOTTOM) + end + nOutlineId = EgtGetNext( nOutlineId) + end + end + -- verifico se ci sono Split + local nSplitLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_BASESPLIT) + if nSplitLayerId then + -- assegno tipo di profilo + local nSplitId = EgtGetFirstInGroup( nSplitLayerId) + EgtSetInfo( nSplitId, WIN_PROFILETYPE, WIN_SASH_SPLIT ) + end + + + + + -- elseif ... + + end +end + +-- funzione che restituisce BBox del Ref del profilo +function WinCalculate.GetRefWithBBoxFromProfile( nProfileFrameLayerId, sProfileType) + local nProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, sProfileType) + local nSectionFrameId = EgtGetFirstNameInGroup( nProfileId, WIN_SECTIONFRAME) + local frSectionFrame = EgtFR( nSectionFrameId) + local nProfileRefId = EgtGetFirstNameInGroup( nProfileId, WIN_REF) + local b3Ref = EgtGetBBoxRef( nProfileRefId, GDB_BB.STANDARD, frSectionFrame) + return nProfileId, b3Ref, nProfileRefId, frSectionFrame + end + +-- funzione che restituisce ref e calcola delta controprofilo dal profilo passatogli +function WinCalculate.GetDeltaProfile( nProfileFrameLayerId, sProfileType, sCtrIn) + local nProfileId, b3Ref, nProfileRefId, frSectionFrame = WinCalculate.GetRefWithBBoxFromProfile( nProfileFrameLayerId, sProfileType) + local dCPDelta = 0 + if sCtrIn then + local nCPId = EgtGetFirstNameInGroup( nProfileId, sCtrIn) + local b3CP = EgtGetBBoxRef( nCPId, GDB_BB.STANDARD, frSectionFrame) + if sCtrIn == WIN_CTRIN .. WIN_BOTTOM then + dCPDelta = abs( b3CP:getMin():getX()) + else + dCPDelta = abs( b3CP:getMax():getX()) + end + --local dCPDelta = abs( b3Ref:getMin():getX() - b3CP:getDimX()) + end + return dCPDelta, b3Ref, nProfileId, nProfileRefId +end + +-- funzione che dato l'outline adiacente ed il tipo di profilo, restituisce il tipo di profilo dell'outline adiacente +function WinCalculate.GetProfileType( nProfileType, nPrevOutlineId) + if nProfileType == WIN_PRF.SPLIT then + local nOrigPrevSouId = nPrevOutlineId + local nOrigPrevSouAreaId = EgtGetParent( EgtGetParent( nOrigPrevSouId)) + local nOrigPrevSouType = EgtGetInfo( nOrigPrevSouAreaId, WIN_AREATYPE, 'i') + while nOrigPrevSouId and nOrigPrevSouType == WIN_AREATYPES.SPLIT do + nOrigPrevSouId = EgtGetInfo( nOrigPrevSouId, WIN_SOU) + nOrigPrevSouAreaId = EgtGetParent( EgtGetParent( nOrigPrevSouId)) + nOrigPrevSouType = EgtGetInfo( nOrigPrevSouAreaId, WIN_AREATYPE, 'i') + end + -- se profilo bottom + local sPrevName = EgtGetName( nOrigPrevSouId) + if sPrevName == WIN_BOTTOM then + -- ed e' presente BottomRail + local nBottomRailId = EgtGetInfo( nOrigPrevSouId, WIN_BOTTOMRAIL, 'i') + if nBottomRailId and nBottomRailId > 1 then + -- allora imposto profilo BottomRail + return WIN_RAIL_BOTTOM + else + return EgtGetInfo( nOrigPrevSouId, WIN_PROFILETYPE) + end + end + return EgtGetInfo( nOrigPrevSouId, WIN_PROFILETYPE) + else + return EgtGetInfo( nPrevOutlineId, WIN_PROFILETYPE) + end +end + +-- funzione che restituisce il tipo di profilo e di controprofilo dell'outline adiacente +function WinCalculate.GetProfileData( nProfileType, nPrevOutlineId, nOutlineId, nProfileFrameLayerId) + local sPrevProfileType = WinCalculate.GetProfileType( nProfileType, nPrevOutlineId) + -- recupero box dei controprofili rispetto al loro sistema di riferimento + local nProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, sPrevProfileType) + return sPrevProfileType, WinCalculate.GetProfileCtrIn( nProfileType, nPrevOutlineId, nOutlineId, nProfileId) +end + +-- funzione che restituisce il tipo di controprofilo dell'outline adiacente +function WinCalculate.GetProfileCtrIn( nProfileType, nPrevOutlineId, nOutlineId, nProfileId) + local sPrevCtrIn = WIN_CTRIN + if nProfileType == WIN_PRF.SPLIT then + -- verifico se il prev e' uno split + local nPrevSouId = nPrevOutlineId + local nPrevSouParentId + local sPrevSouParentId + repeat + nPrevSouId = EgtGetInfo( nPrevSouId, WIN_SOU) + if nPrevSouId then + nPrevSouParentId = EgtGetParent( nPrevSouId) + sPrevSouParentId = EgtGetName( nPrevSouParentId) + end + until not nPrevSouId or sPrevSouParentId == WIN_BASESPLIT + if nPrevSouId and sPrevSouParentId == WIN_BASESPLIT then + -- verifico da che lato sono dello split + local dOutlineDist, _, dSide = EgtPointCurveDistSide( EgtMP( nOutlineId), nPrevSouId, Z_AX()) + -- recupero box dei controprofili rispetto al loro sistema di riferimento + local nSectionFrameId = EgtGetFirstNameInGroup( nProfileId, WIN_SECTIONFRAME) + local frSectionFrame = EgtFR( nSectionFrameId, GDB_ID.ROOT) + local dMinDist + -- confronto distanze dei controprofili rispetto a distanza dell'outline per trovare il controprofilo piu' vicino + local nMinCtrInId + local nCtrInId = EgtGetFirstNameInGroup( nProfileId, WIN_CTRIN .. '*') + while nCtrInId do + local b3CtrIn = EgtGetBBoxRef( nCtrInId, GDB_BB.STANDARD, frSectionFrame) + local dCtrInDist = abs( ( dSide * dOutlineDist) - b3CtrIn:getCenter():getX()) + if not dMinDist or dCtrInDist < dMinDist then + dMinDist = dCtrInDist + nMinCtrInId = nCtrInId + end + nCtrInId = EgtGetNextName( nCtrInId, WIN_CTRIN .. '*') + end + if nMinCtrInId then + sPrevCtrIn = EgtGetName( nMinCtrInId) + end + end + end + return sPrevCtrIn +end + +-- -- funzione che restituisce il tipo di controprofilo +-- function WinCalculate.GetProfileData( nProfileType, nPrevOutlineId, nOutlineId, nProfileFrameLayerId) +-- local sPrevProfileType +-- local sPrevCtrIn = WIN_CTRIN +-- if nProfileType == WIN_PRF.SPLIT then +-- local nOrigPrevSouId = nPrevOutlineId +-- local nOrigPrevSouAreaId = EgtGetParent( EgtGetParent( nOrigPrevSouId)) +-- local nOrigPrevSouType = EgtGetInfo( nOrigPrevSouAreaId, WIN_AREATYPE, 'i') +-- while nOrigPrevSouId and nOrigPrevSouType == WIN_AREATYPES.SPLIT do +-- nOrigPrevSouId = EgtGetInfo( nOrigPrevSouId, WIN_SOU) +-- nOrigPrevSouAreaId = EgtGetParent( EgtGetParent( nOrigPrevSouId)) +-- nOrigPrevSouType = EgtGetInfo( nOrigPrevSouAreaId, WIN_AREATYPE, 'i') +-- end +-- sPrevProfileType = EgtGetInfo( nOrigPrevSouId, WIN_PROFILETYPE) +-- local sPrevName = EgtGetName( nPrevOutlineId) +-- -- verifico se il prev e' uno split +-- local nPrevSouId = nPrevOutlineId +-- local nPrevSouParentId +-- local sPrevSouParentId +-- repeat +-- nPrevSouId = EgtGetInfo( nPrevSouId, WIN_SOU) +-- if nPrevSouId then +-- nPrevSouParentId = EgtGetParent( nPrevSouId) +-- sPrevSouParentId = EgtGetName( nPrevSouParentId) +-- end +-- until not nPrevSouId or sPrevSouParentId == WIN_BASESPLIT +-- if nPrevSouId and sPrevSouParentId == WIN_BASESPLIT then +-- -- verifico da che lato sono dello split +-- local dOutlineDist = EgtPointCurveDist( EgtMP( nOutlineId), nPrevOutlineId) +-- -- recupero box dei controprofili rispetto al loro sistema di riferimento +-- local nProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, sPrevProfileType) +-- local nSectionFrameId = EgtGetFirstNameInGroup( nProfileId, WIN_SECTIONFRAME) +-- local frSectionFrame = EgtFR( nSectionFrameId) +-- local dMinDist +-- -- confronto distanze dei controprofili rispetto a distanza dell'outline per trovare il controprofilo piu' vicino +-- local nMinCtrInId +-- local nCtrInId = EgtGetFirstNameInGroup( nProfileId, WIN_CTRIN .. '*') +-- while nCtrInId do +-- local b3CtrIn = EgtGetBBoxRef( nCtrInId, GDB_BB.STANDARD, frSectionFrame) +-- local dCtrInDist = abs( dOutlineDist - b3CtrIn:getCenter():getX()) +-- if not dMinDist or dCtrInDist < dMinDist then +-- dMinDist = dCtrInDist +-- nMinCtrInId = nCtrInId +-- end +-- nCtrInId = EgtGetNextName( WIN_CTRIN .. '*') +-- end +-- if nMinCtrInId then +-- sPrevCtrIn = EgtGetName( nMinCtrInId) +-- end + + + + + + +-- -- -- se usa profilo verticale +-- -- if sPrevProfileType == WIN_SASH_VERTICAL then +-- -- if sPrevName == WIN_LEFT or sPrevName == WIN_TOP then +-- -- sPrevCtrIn = sPrevCtrIn .. WIN_RIGHT +-- -- elseif sPrevName == WIN_RIGHT or sPrevName == WIN_BOTTOM then +-- -- sPrevCtrIn = sPrevCtrIn .. WIN_LEFT +-- -- end +-- -- elseif sPrevProfileType == WIN_SASH_HORIZONTAL then +-- -- if sPrevName == WIN_TOP or sPrevName == WIN_RIGHT then +-- -- sPrevCtrIn = sPrevCtrIn .. WIN_BOTTOM +-- -- elseif sPrevName == WIN_BOTTOM or sPrevName == WIN_LEFT then +-- -- sPrevCtrIn = sPrevCtrIn .. WIN_TOP +-- -- end +-- -- elseif sPrevProfileType == WIN_SASH_SPLIT then +-- -- if sPrevName == WIN_LEFT or sPrevName == WIN_TOP then +-- -- sPrevCtrIn = sPrevCtrIn .. WIN_LEFT +-- -- elseif sPrevName == WIN_RIGHT or sPrevName == WIN_BOTTOM then +-- -- sPrevCtrIn = sPrevCtrIn .. WIN_LEFT +-- -- end +-- -- end +-- end +-- else +-- sPrevProfileType = EgtGetInfo( nPrevOutlineId, WIN_PROFILETYPE) +-- end +-- return sPrevProfileType, sPrevCtrIn +-- end + +-- funzione che crea le curve del geo +function WinCalculate.CreateFrameGeo( nOutlineId, nPrevOutlineId, nNextOutlineId, StartJointType, EndJointType, nProfileType, nGeoLayerId, nProfileFrameLayerId, bBottomRail) + local nCurrCurveId + local nCurrOffsetId + local nPrevCurveId + local nNextCurveId + local dGeoWidth + -- recupero ref e controprofilo e calcolo delta del top, prev e next + local sCurrProfileType = EgtGetInfo( nOutlineId, WIN_PROFILETYPE) + if bBottomRail then + sCurrProfileType = WIN_RAIL_BOTTOM + end + local _, b3CurrRef, nCurrProfileId, nCurrProfileRefId = WinCalculate.GetDeltaProfile( nProfileFrameLayerId, sCurrProfileType) + local sPrevProfileType, sPrevCtrIn = WinCalculate.GetProfileData( nProfileType, nPrevOutlineId, nOutlineId, nProfileFrameLayerId) + local dPrevCPDelta, _ = WinCalculate.GetDeltaProfile( nProfileFrameLayerId, sPrevProfileType, sPrevCtrIn) + local sNextProfileType, sNextCtrIn = WinCalculate.GetProfileData( nProfileType, nNextOutlineId, nOutlineId, nProfileFrameLayerId) + local dNextCPDelta, _ = WinCalculate.GetDeltaProfile( nProfileFrameLayerId, sNextProfileType, sNextCtrIn) + -- calcolo spostamento della curva iniziale dovuto a posizione riferimento + local nProfileFrameId = EgtGetFirstNameInGroup( nCurrProfileId, WIN_SECTIONFRAME) + local frProfile = EgtFR( nProfileFrameId) + local b3CurrProfileFrame = EgtGetBBoxRef( nCurrProfileRefId, GDB_BB.STANDARD, frProfile) + local dCurrOffset = b3CurrProfileFrame:getMax():getX() + -- creo copie degli outline e li offsetto opportunamente + nCurrCurveId = EgtCopy( nOutlineId, nGeoLayerId) + EgtOffsetCurve( nCurrCurveId, dCurrOffset) + nCurrOffsetId = EgtCopy( nOutlineId, nGeoLayerId) + EgtOffsetCurve( nCurrOffsetId, dCurrOffset - b3CurrProfileFrame:getDimX()) + EgtInvertCurve( nCurrOffsetId) + if StartJointType == WIN_JNT.ANGLED then + -- calcolo la bisettrice + local vtMedia = ( ( EgtSV( nOutlineId) - EgtEV( nPrevOutlineId)) / 2) + if not vtMedia:normalize() then + vtMedia = EgtSV( nOutlineId) + vtMedia:rotate(Z_AX(), 90) + end + nPrevCurveId = EgtLinePVL( nGeoLayerId, EgtSP( nOutlineId), vtMedia, 3 * b3CurrProfileFrame:getDimX()) + EgtInvertCurve( nPrevCurveId) + else + nPrevCurveId = EgtCopy( nPrevOutlineId, nGeoLayerId) + end + if ( StartJointType == WIN_JNT.FULL_V and ( nProfileType == WIN_PRF.BOTTOM or nProfileType == WIN_PRF.TOP or nProfileType == WIN_PRF.HORIZONTAL or nProfileType == WIN_PRF.BOTTOMRAIL)) or + ( StartJointType == WIN_JNT.FULL_H and ( nProfileType == WIN_PRF.RIGHT or nProfileType == WIN_PRF.LEFT or nProfileType == WIN_PRF.VERTICAL)) or + nProfileType == WIN_PRF.SPLIT then + EgtOffsetCurve( nPrevCurveId, - dPrevCPDelta) + EgtSetInfo( nGeoLayerId, WIN_STARTCPDELTA, dPrevCPDelta) + end + if EndJointType == WIN_JNT.ANGLED then + -- calcolo la bisettrice + local vtMedia = ( ( EgtSV( nNextOutlineId) - EgtEV( nOutlineId)) / 2) + if not vtMedia:normalize() then + vtMedia = EgtEV( nOutlineId) + vtMedia:rotate(Z_AX(), 90) + end + nNextCurveId = EgtLinePVL( nGeoLayerId, EgtEP( nOutlineId), vtMedia, 3 * b3CurrProfileFrame:getDimX()) + else + nNextCurveId = EgtCopy( nNextOutlineId, nGeoLayerId) + end + if ( EndJointType == WIN_JNT.FULL_V and ( nProfileType == WIN_PRF.BOTTOM or nProfileType == WIN_PRF.TOP or nProfileType == WIN_PRF.HORIZONTAL or nProfileType == WIN_PRF.BOTTOMRAIL)) or + ( EndJointType == WIN_JNT.FULL_H and ( nProfileType == WIN_PRF.RIGHT or nProfileType == WIN_PRF.LEFT or nProfileType == WIN_PRF.VERTICAL)) or + nProfileType == WIN_PRF.SPLIT then + EgtOffsetCurve( nNextCurveId, - dNextCPDelta) + EgtSetInfo( nGeoLayerId, WIN_ENDCPDELTA, dNextCPDelta) + end + dGeoWidth = b3CurrProfileFrame:getDimX() + return nCurrCurveId, nCurrOffsetId, nPrevCurveId, nNextCurveId, dGeoWidth +end + +-- funzione che dato il tipo di pezzo e di giunzione, restituisce se e' corto, lungo o angolato +local function CalcPartJointType( nProfileType, JointType) + if JointType == WIN_JNT.ANGLED then + return WIN_PART_JNT.ANGLED + end + if nProfileType == WIN_PRF.BOTTOMRAIL or nProfileType == WIN_PRF.SPLIT then + return WIN_PART_JNT.SHORT + elseif nProfileType == WIN_PRF.BOTTOM or nProfileType == WIN_PRF.TOP then + if JointType == WIN_JNT.FULL_H then + return WIN_PART_JNT.FULL + elseif JointType == WIN_JNT.FULL_V then + return WIN_PART_JNT.SHORT + end + elseif nProfileType == WIN_PRF.LEFT or nProfileType == WIN_PRF.RIGHT then + if JointType == WIN_JNT.FULL_V then + return WIN_PART_JNT.FULL + elseif JointType == WIN_JNT.FULL_H then + return WIN_PART_JNT.SHORT + end + end +end + +-- funzione che calcola l'ingombro dei pezzi del telaio +function WinCalculate.CalcFrameGeo( nPartId, nOutlineId, nOutlineLayerId, bBottomRail) + -- recupero profilo + local nProfileLayerId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE) + local nAreaId = nOutlineLayerId + local nAreaType + -- ciclo fino a trovare un child che non sia uno split + repeat + nAreaId = EgtGetParent( nAreaId) + nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') + until not nAreaId or ( nAreaType ~= WIN_AREATYPES.SPLIT and nAreaType ~= WIN_AREATYPES.NULL) + local nProfileFrameLayerId + if nAreaType == WIN_AREATYPES.FRAME then + nProfileFrameLayerId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_FRAME) + elseif nAreaType == WIN_AREATYPES.SASH then + nProfileFrameLayerId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_SASH) + end + -- creo layer per ingombro + local nGeoLayerId = EgtGroup( nPartId) + EgtSetName( nGeoLayerId, WIN_GEO) + -- ricavo tipo dal nome + local sName = EgtGetName( nOutlineId) + local nProfileType = WIN_PRF.NULL + if bBottomRail then + nProfileType = WIN_PRF.BOTTOMRAIL + elseif sName == WIN_TOP then + nProfileType = WIN_PRF.TOP + elseif sName == WIN_BOTTOM then + nProfileType = WIN_PRF.BOTTOM + elseif sName == WIN_LEFT then + nProfileType = WIN_PRF.LEFT + elseif sName == WIN_RIGHT then + nProfileType = WIN_PRF.RIGHT + elseif sName == WIN_VERTICAL then + nProfileType = WIN_PRF.VERTICAL + elseif sName == WIN_HORIZONTAL then + nProfileType = WIN_PRF.HORIZONTAL + elseif sName == WIN_SPLIT then + nProfileType = WIN_PRF.SPLIT + end + local StartJointType + local EndJointType + local nNextOutlineId + local nPrevOutlineId + local nCurrCurveId + local nCurrOffsetId + local nPrevCurveId + local nNextCurveId + local dGeoWidth + if nProfileType == WIN_PRF.BOTTOMRAIL then + StartJointType = WIN_JNT.FULL_V + EndJointType = WIN_JNT.FULL_V + elseif nProfileType == WIN_PRF.TOP then + -- recupero tipo di giunzioni + StartJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_TR, 'i') + EndJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_TL, 'i') + -- imposto valori joint su outline per disegno solido + EgtSetInfo( nOutlineId, WIN_STARTJOINT, CalcPartJointType( nProfileType, StartJointType)) + EgtSetInfo( nOutlineId, WIN_ENDJOINT, CalcPartJointType( nProfileType, EndJointType)) + elseif nProfileType == WIN_PRF.BOTTOM then + -- recupero tipo di giunzioni + StartJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_BL, 'i') + EndJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_BR, 'i') + -- imposto valori joint su outline per disegno solido + EgtSetInfo( nOutlineId, WIN_STARTJOINT, CalcPartJointType( nProfileType, StartJointType)) + EgtSetInfo( nOutlineId, WIN_ENDJOINT, CalcPartJointType( nProfileType, EndJointType)) + elseif nProfileType == WIN_PRF.LEFT then + -- recupero tipo di giunzioni + StartJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_TL, 'i') + EndJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_BL, 'i') + -- imposto valori joint su outline per disegno solido + EgtSetInfo( nOutlineId, WIN_STARTJOINT, CalcPartJointType( nProfileType, StartJointType)) + EgtSetInfo( nOutlineId, WIN_ENDJOINT, CalcPartJointType( nProfileType, EndJointType)) + elseif nProfileType == WIN_PRF.RIGHT then + -- recupero tipo di giunzioni + StartJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_BR, 'i') + EndJointType = EgtGetInfo( nOutlineLayerId, WIN_JOINT_TR, 'i') + -- imposto valori joint su outline per disegno solido + EgtSetInfo( nOutlineId, WIN_STARTJOINT, CalcPartJointType( nProfileType, StartJointType)) + EgtSetInfo( nOutlineId, WIN_ENDJOINT, CalcPartJointType( nProfileType, EndJointType)) + elseif nProfileType == WIN_PRF.VERTICAL then + -- recupero tipo di giunzioni + StartJointType = WIN_JNT.FULL_H + EndJointType = WIN_JNT.FULL_H + -- imposto valori joint su outline per disegno solido + EgtSetInfo( nOutlineId, WIN_STARTJOINT, CalcPartJointType( nProfileType, StartJointType)) + EgtSetInfo( nOutlineId, WIN_ENDJOINT, CalcPartJointType( nProfileType, EndJointType)) + -- recupero outline precedente + nPrevOutlineId = EgtGetInfo( nOutlineId, WIN_SPLIT_STARTINTERS, 'i') + nNextOutlineId = EgtGetInfo( nOutlineId, WIN_SPLIT_ENDINTERS, 'i') + elseif nProfileType == WIN_PRF.HORIZONTAL then + -- recupero tipo di giunzioni + StartJointType = WIN_JNT.FULL_V + EndJointType = WIN_JNT.FULL_V + -- imposto valori joint su outline per disegno solido + EgtSetInfo( nOutlineId, WIN_STARTJOINT, CalcPartJointType( nProfileType, StartJointType)) + EgtSetInfo( nOutlineId, WIN_ENDJOINT, CalcPartJointType( nProfileType, EndJointType)) + -- recupero outline precedente + nPrevOutlineId = EgtGetInfo( nOutlineId, WIN_SPLIT_STARTINTERS, 'i') + nNextOutlineId = EgtGetInfo( nOutlineId, WIN_SPLIT_ENDINTERS, 'i') + elseif nProfileType == WIN_PRF.SPLIT then + local nStartId = EgtGetInfo( nOutlineId, WIN_SPLIT_STARTINTERS, 'i') + local nEndId = EgtGetInfo( nOutlineId, WIN_SPLIT_ENDINTERS, 'i') + local sStartName = EgtGetName( nStartId) + local sEndName = EgtGetName( nEndId) + -- recupero tipo di giunzioni + if sStartName == WIN_BOTTOM or sStartName == WIN_TOP then + StartJointType = WIN_JNT.FULL_H + else + StartJointType = WIN_JNT.FULL_V + end + if sEndName == WIN_BOTTOM or sEndName == WIN_TOP then + EndJointType = WIN_JNT.FULL_H + else + EndJointType = WIN_JNT.FULL_V + end + -- imposto valori joint su outline per disegno solido + EgtSetInfo( nOutlineId, WIN_STARTJOINT, CalcPartJointType( nProfileType, StartJointType)) + EgtSetInfo( nOutlineId, WIN_ENDJOINT, CalcPartJointType( nProfileType, EndJointType)) + -- recupero outline precedente e successivo + local nPrevBaseOutlineId = EgtGetInfo( nOutlineId, WIN_SPLIT_STARTINTERS, 'i') + nPrevOutlineId = EgtGetInfo( nPrevBaseOutlineId, WIN_COPY, 'i') + local nNextBaseOutlineId = EgtGetInfo( nOutlineId, WIN_SPLIT_ENDINTERS, 'i') + nNextOutlineId = EgtGetInfo( nNextBaseOutlineId, WIN_COPY, 'i') + end + -- recupero outline precedente + if not nPrevOutlineId then + nPrevOutlineId = EgtGetPrev( nOutlineId) + if not nPrevOutlineId then + nPrevOutlineId = EgtGetLastInGroup( nOutlineLayerId) + end + end + if not nNextOutlineId then + nNextOutlineId = EgtGetNext( nOutlineId) + if not nNextOutlineId then + nNextOutlineId = EgtGetFirstInGroup( nOutlineLayerId) + end + end + -- se pezzo non e' split, giunzione diversa da bisettrice ed arco a tutto sesto + if nProfileType ~= WIN_PRF.SPLIT and StartJointType ~= WIN_JNT.ANGLED and AreSameVectorApprox( EgtEV( nPrevOutlineId), EgtSV( nOutlineId)) then + -- imposto giunzione a bisettrice + StartJointType = WIN_JNT.ANGLED + -- EgtSetInfo( nOutlineLayerId, WIN_JOINT_TR, 'i') + end + if nProfileType ~= WIN_PRF.SPLIT and EndJointType ~= WIN_JNT.ANGLED and AreSameVectorApprox( EgtEV( nOutlineId), EgtSV( nNextOutlineId)) then + -- imposto giunzione a bisettrice + EndJointType = WIN_JNT.ANGLED + -- EgtSetInfo( nOutlineLayerId, WIN_JOINT_TR, 'i') + end + -- creo lati dell'outline + nCurrCurveId, nCurrOffsetId, nPrevCurveId, nNextCurveId, dGeoWidth = WinCalculate.CreateFrameGeo( nOutlineId, nPrevOutlineId, nNextOutlineId, StartJointType, EndJointType, nProfileType, nGeoLayerId, nProfileFrameLayerId, bBottomRail) + -- calcolo punti di intersezione + local ptIntersCurrPrev = EgtIP( nCurrCurveId, nPrevCurveId, EgtSP( nCurrCurveId)) + if not ptIntersCurrPrev then + -- allungo per intersecare + EgtExtendCurveStartByLen( nCurrCurveId, 200) + EgtExtendCurveEndByLen( nPrevCurveId, 200) + ptIntersCurrPrev = EgtIP( nCurrCurveId, nPrevCurveId, EgtSP( nCurrCurveId)) + end + local ptIntersCurrNext = EgtIP( nCurrCurveId, nNextCurveId, EgtEP( nCurrCurveId)) + if not ptIntersCurrNext then + -- allungo per intersecare + EgtExtendCurveEndByLen( nCurrCurveId, 200) + EgtExtendCurveStartByLen( nNextCurveId, 200) + ptIntersCurrNext = EgtIP( nCurrCurveId, nNextCurveId, EgtEP( nCurrCurveId)) + end + local ptIntersCurrOffsetPrev = EgtIP( nCurrOffsetId, nPrevCurveId, EgtEP( nCurrOffsetId)) + if not ptIntersCurrOffsetPrev then + -- allungo per intersecare + EgtExtendCurveEndByLen( nCurrOffsetId, 1000) + EgtExtendCurveStartByLen( nPrevCurveId, 200) + ptIntersCurrOffsetPrev = EgtIP( nCurrOffsetId, nPrevCurveId, EgtEP( nCurrOffsetId)) + end + local ptIntersCurrOffsetNext = EgtIP( nCurrOffsetId, nNextCurveId, EgtSP( nCurrOffsetId)) + if not ptIntersCurrOffsetNext then + -- allungo per intersecare + EgtExtendCurveStartByLen( nCurrOffsetId, 1000) + EgtExtendCurveStartByLen( nNextCurveId, 200) + ptIntersCurrOffsetNext = EgtIP( nCurrOffsetId, nNextCurveId, EgtSP( nCurrOffsetId)) + end + -- calcolo accorciamenti dei lati copiati alle intersezioni + local dIntersCurrPrevParam = EgtCurveParamAtPoint( nCurrCurveId, ptIntersCurrPrev) + EgtTrimCurveStartAtParam( nCurrCurveId, dIntersCurrPrevParam) + local dIntersCurrNextParam = EgtCurveParamAtPoint( nCurrCurveId, ptIntersCurrNext) + EgtTrimCurveEndAtParam( nCurrCurveId, dIntersCurrNextParam) + local dIntersCurrOffsetNextParam = EgtCurveParamAtPoint( nCurrOffsetId, ptIntersCurrOffsetNext) + EgtTrimCurveStartAtParam( nCurrOffsetId, dIntersCurrOffsetNextParam) + local dIntersCurrOffsetPrevParam = EgtCurveParamAtPoint( nCurrOffsetId, ptIntersCurrOffsetPrev) + EgtTrimCurveEndAtParam( nCurrOffsetId, dIntersCurrOffsetPrevParam) + local dIntersPrevOffsetParam = EgtCurveParamAtPoint( nPrevCurveId, ptIntersCurrOffsetPrev) + EgtTrimCurveStartAtParam( nPrevCurveId, dIntersPrevOffsetParam) + local dIntersPrevCurrParam = EgtCurveParamAtPoint( nPrevCurveId, ptIntersCurrPrev) + EgtTrimCurveEndAtParam( nPrevCurveId, dIntersPrevCurrParam) + local dIntersNextCurrParam = EgtCurveParamAtPoint( nNextCurveId, ptIntersCurrNext) + EgtTrimCurveStartAtParam( nNextCurveId, dIntersNextCurrParam) + local dIntersNextOffsetParam = EgtCurveParamAtPoint( nNextCurveId, ptIntersCurrOffsetNext) + EgtTrimCurveEndAtParam( nNextCurveId, dIntersNextOffsetParam) + -- creo composita dai lati + EgtSetName( nCurrCurveId, WIN_GEO_OUT) + EgtSetName( nCurrOffsetId, WIN_GEO_IN) + EgtSetName( nNextCurveId, WIN_GEO_RIGHT) + EgtSetName( nPrevCurveId, WIN_GEO_LEFT) + -- salvo spessore serramento in geo + EgtSetInfo( nCurrCurveId, WIN_GEOWIDTH, dGeoWidth) + + return nCurrCurveId +end + +-- funzione che calcola l'ingombro del fill +function WinCalculate.CalcFillGeo( nPartId, nOutlineLayerId) + -- creo layer per ingombro + local nGeoLayerId = EgtGroup( nPartId) + EgtSetName( nGeoLayerId, WIN_GEO) + -- copio lati da Outline + local nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) + while nOutlineId do + EgtCopy( nOutlineId, nGeoLayerId) + nOutlineId = EgtGetNext( nOutlineId) + end + -- recupero e salvo spessore vetro + local nProfileLayerId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE) + local nSashProfileId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_SASH) + local dGlassThickness = EgtGetInfo( nSashProfileId, WIN_GLASSTHICKNESS, 'd') + EgtSetInfo( nGeoLayerId, WIN_GEOWIDTH, dGlassThickness) + return nGeoLayerId +end + +-- funzione che recupera tipo di inizio e fine pezzo +function WinCalculate.CalcStartEndProfileType(nProfileType, nOutlineId, nStartProfileId, nEndProfileId) + local StartJointType + local EndJointType + local nOutlineLayerId = EgtGetParent( nOutlineId) + local sStartProfileType + local sEndProfileType + StartJointType = EgtGetInfo( nOutlineId, WIN_STARTJOINT, 'i') + if StartJointType == WIN_PART_JNT.ANGLED then + sStartProfileType = WIN_MINIZINKEN + elseif StartJointType == WIN_PART_JNT.SHORT then + sStartProfileType = WIN_CTRINOFST + elseif StartJointType == WIN_PART_JNT.FULL then + sStartProfileType = WIN_OUTOFST + end + EndJointType = EgtGetInfo( nOutlineId, WIN_ENDJOINT, 'i') + if EndJointType == WIN_PART_JNT.ANGLED then + sEndProfileType = WIN_MINIZINKEN + elseif EndJointType == WIN_PART_JNT.SHORT then + sEndProfileType = WIN_CTRINOFST + elseif EndJointType == WIN_PART_JNT.FULL then + sEndProfileType = WIN_OUTOFST + end + -- if nProfileType == WIN_PRF.BOTTOM then + -- if StartJointType == WIN_JNT.FULL_H then + -- sStartProfileType = WIN_OUTOFST + -- elseif StartJointType == WIN_JNT.FULL_V then + -- sStartProfileType = WIN_CTRINOFST + -- elseif StartJointType == WIN_JNT.ANGLED then + -- sStartProfileType = WIN_MINIZINKEN + -- end + -- if EndJointType == WIN_JNT.FULL_H then + -- sEndProfileType = WIN_OUTOFST + -- elseif EndJointType == WIN_JNT.FULL_V then + -- sEndProfileType = WIN_CTRINOFST + -- elseif EndJointType == WIN_JNT.ANGLED then + -- sEndProfileType = WIN_MINIZINKEN + -- end + -- elseif nProfileType == WIN_PRF.RIGHT then + -- if StartJointType == WIN_JNT.FULL_H then + -- sStartProfileType = WIN_CTRINOFST + -- elseif StartJointType == WIN_JNT.FULL_V then + -- sStartProfileType = WIN_OUTOFST + -- elseif StartJointType == WIN_JNT.ANGLED then + -- sStartProfileType = WIN_MINIZINKEN + -- end + -- if EndJointType == WIN_JNT.FULL_H then + -- sEndProfileType = WIN_CTRINOFST + -- elseif EndJointType == WIN_JNT.FULL_V then + -- sEndProfileType = WIN_OUTOFST + -- elseif EndJointType == WIN_JNT.ANGLED then + -- sEndProfileType = WIN_MINIZINKEN + -- end + -- elseif nProfileType == WIN_PRF.TOP then + -- if StartJointType == WIN_JNT.FULL_H then + -- sStartProfileType = WIN_OUTOFST + -- elseif StartJointType == WIN_JNT.FULL_V then + -- sStartProfileType = WIN_CTRINOFST + -- elseif StartJointType == WIN_JNT.ANGLED then + -- sStartProfileType = WIN_MINIZINKEN + -- end + -- if EndJointType == WIN_JNT.FULL_H then + -- sEndProfileType = WIN_OUTOFST + -- elseif EndJointType == WIN_JNT.FULL_V then + -- sEndProfileType = WIN_CTRINOFST + -- elseif EndJointType == WIN_JNT.ANGLED then + -- sEndProfileType = WIN_MINIZINKEN + -- end + -- elseif nProfileType == WIN_PRF.LEFT then + -- if StartJointType == WIN_JNT.FULL_H then + -- sStartProfileType = WIN_CTRINOFST + -- elseif StartJointType == WIN_JNT.FULL_V then + -- sStartProfileType = WIN_OUTOFST + -- elseif StartJointType == WIN_JNT.ANGLED then + -- sStartProfileType = WIN_MINIZINKEN + -- end + -- if EndJointType == WIN_JNT.FULL_H then + -- sEndProfileType = WIN_CTRINOFST + -- elseif EndJointType == WIN_JNT.FULL_V then + -- sEndProfileType = WIN_OUTOFST + -- elseif EndJointType == WIN_JNT.ANGLED then + -- sEndProfileType = WIN_MINIZINKEN + -- end + -- elseif nProfileType == WIN_PRF.VERTICAL then + if nProfileType == WIN_PRF.VERTICAL then + sStartProfileType = WIN_CTRINOFST + sEndProfileType = WIN_CTRINOFST + elseif nProfileType == WIN_PRF.HORIZONTAL then + sStartProfileType = WIN_CTRINOFST + sEndProfileType = WIN_CTRINOFST + elseif nProfileType == WIN_PRF.SPLIT then + local nStartId = EgtGetInfo( nOutlineId, WIN_SPLIT_STARTINTERS, 'i') + local nEndId = EgtGetInfo( nOutlineId, WIN_SPLIT_ENDINTERS, 'i') + local sStartName = EgtGetName( nStartId) + local sEndName = EgtGetName( nEndId) + sStartProfileType = WinCalculate.GetProfileCtrIn( nProfileType, nStartId, nOutlineId, nStartProfileId) + sEndProfileType = WinCalculate.GetProfileCtrIn( nProfileType, nEndId, nOutlineId, nEndProfileId) + sStartProfileType = WIN_OFST .. sStartProfileType + sEndProfileType = WIN_OFST .. sEndProfileType + elseif nProfileType == WIN_PRF.BOTTOMRAIL then + StartJointType = WIN_JNT.FULL_V + EndJointType = WIN_JNT.FULL_V + sStartProfileType = WIN_CTRINOFST + sEndProfileType = WIN_CTRINOFST + end + return sStartProfileType, sEndProfileType, StartJointType, EndJointType +end + +-- funzione che posiziona i profili, li estrude e crea il solido +function WinCalculate.MakeSolidByExtrusion(nGeoId, nOutlineId, nMainProfileId, nStartProfileId, nEndProfileId, nProfileType, nSolidLayerId, nAreaType) + -- recupero outline + local nPartId = EgtGetParent( nSolidLayerId) + local nAreaId = EgtGetInfo( nPartId, WIN_AREAASTERISK) + local nGeoLayerId = EgtGetParent( nGeoId) + local nOutlineLayerId = EgtGetParent( nOutlineId) + -- recupero geo + local nPrevGeoId = EgtGetFirstNameInGroup( nGeoLayerId, WIN_GEO_LEFT) + local nNextGeoId = EgtGetFirstNameInGroup( nGeoLayerId, WIN_GEO_RIGHT) + -- recupero BBox e larghezza del geo + local dGeoWidth = EgtGetInfo( nGeoId, WIN_GEOWIDTH, 'd') + -- creo guida Main + local nGuideId = EgtCopy( nOutlineId, nSolidLayerId) + EgtSetName( nGuideId, WIN_MAINGUIDE) + EgtExtendCurveStartByLen( nGuideId, 2 * dGeoWidth) + EgtExtendCurveEndByLen( nGuideId, 2 * dGeoWidth) + -- recupero frame del profilo + local nMainProfileFrameId = EgtGetFirstNameInGroup( nMainProfileId, WIN_SECTIONFRAME) + local frInvertMainProfile = EgtFR( nMainProfileFrameId) + frInvertMainProfile:invert() + -- lo applico a tutte le geometrie del profilo + EgtTransform( EgtGetAllInGroup( nMainProfileId), frInvertMainProfile) + -- assegno come riferimento del profilo il punto start dell'outline + EgtChangeGroupFrame( nMainProfileId, Frame3d( EgtSP( nGuideId), - EgtSV( nGuideId))) + -- recupero outline del profilo Main e lo estrudo + local nMainOutlineId = EgtGetFirstNameInGroup( nMainProfileId, WIN_SECTION) + local nMainExtrusionId = EgtSurfTmSwept( nSolidLayerId, nMainOutlineId, nGuideId, false, WIN_SURF_APPROX) + -- posiziono il profilo Start + local nRefStartProfileId = EgtGetFirstNameInGroup( nStartProfileId, WIN_REF) + local b3RefStartProfile = EgtGetBBoxGlob(nRefStartProfileId, GDB_BB.STANDARD) + local dStartDelta = EgtGetInfo( nGeoLayerId, WIN_STARTCPDELTA, 'd') or 0 + -- creo guida per estrusione + local nStartGuideId = EgtCopy( nPrevGeoId, nSolidLayerId) + EgtSetName( nStartGuideId, WIN_STARTGUIDE) + EgtExtendCurveStartByLen( nStartGuideId, 2 * dGeoWidth) + EgtExtendCurveEndByLen( nStartGuideId, 2 * dGeoWidth) + -- recupero frame del profilo + local nStartProfileFrameId = EgtGetFirstNameInGroup( nStartProfileId, WIN_SECTIONFRAME) + local frStartProfile = EgtFR( nStartProfileFrameId) + -- lo sposto se controprofilo + frStartProfile:move( - frStartProfile:getVersX() * dStartDelta) + frStartProfile:invert() + -- lo applico a tutte le geometrie del profilo + EgtTransform( EgtGetAllInGroup( nStartProfileId), frStartProfile) + -- assegno come riferimento del profilo il punto start dell'outline + EgtChangeGroupFrame( nStartProfileId, Frame3d( EgtSP( nStartGuideId), - EgtSV( nStartGuideId))) + -- in base al tipo di incastro e di pezzo, ricavo i controprofili + local sStartProfileType + local sEndProfileType + -- recupero tipo di giunzioni + sStartProfileType, sEndProfileType, StartJointType, EndJointType = WinCalculate.CalcStartEndProfileType( nProfileType, nOutlineId, nStartProfileId, nEndProfileId) + -- se Start e' split + local nStartId = EgtGetInfo( nOutlineId, WIN_SPLIT_STARTINTERS, 'i') + local nStartProfileType + if nStartId then + local nStartAreaId = EgtGetParent( EgtGetParent( nStartId)) + if nStartAreaId then + nStartProfileType = EgtGetInfo( nStartAreaId, WIN_AREATYPE, 'i') + end + end + if nProfileType == WIN_PRF.SPLIT and nStartProfileType and nStartProfileType == WIN_AREATYPES.SPLIT then + local nStartSouId = nStartId + local nStartSouLayerId + local sStartSouLayer + repeat + nStartSouId = EgtGetInfo( nStartSouId, WIN_SOU) + nStartSouLayerId = EgtGetParent( nStartSouId) + if nStartSouLayerId then + sStartSouLayer = EgtGetName( nStartSouLayerId) + end + until not nStartSouId or not nStartSouLayerId or sStartSouLayer == WIN_BASESPLIT + if nStartSouId and nStartSouLayerId and sStartSouLayer == WIN_BASESPLIT then + -- recupero vettore tangente nel punto medio della curva di contorno + local ptMidStart = EgtMP( nStartId) + local vtMidStart = EgtMV( nStartId) + -- recupero vettore tangente nello stesso punto della curva split originale + local dMidStartOnStartSou = EgtCurveParamAtPoint( nStartSouId, ptMidStart) + local vtMidStartSou = EgtUV( nStartSouId, dMidStartOnStartSou, -1) + -- se i due vettori non sono orientati nella stessa direzione + if not AreSameVectorExact( vtMidStart, vtMidStartSou) then + -- ruoto di 180 gradi il profilo + local frStartProfileS = EgtFR( nStartProfileFrameId, GDB_ID.ROOT) + EgtRotate( nStartProfileId, frStartProfileS:getOrigin(), frStartProfileS:getVersY(), 180, GDB_RT.GLOB) + local nStartCntProfileId = EgtGetFirstNameInGroup( nStartProfileId, sStartProfileType) + EgtInvertCurve( nStartCntProfileId) + end + end + end + -- recupero outline del profilo Start e lo estrudo + local nOutStartProfileId + if sStartProfileType == WIN_MINIZINKEN then + nOutStartProfileId = EgtLine( nStartProfileId, EgtSP( nPrevGeoId), EgtSP( nPrevGeoId) - Z_AX() * b3RefStartProfile:getDimY(), GDB_RT.GLOB) + EgtInvertCurve( nOutStartProfileId) + else + nOutStartProfileId = EgtGetFirstNameInGroup( nStartProfileId, sStartProfileType) + end + local nStartExtrusionId = EgtSurfTmSwept( nSolidLayerId, nOutStartProfileId, nStartGuideId, false, WIN_SURF_APPROX) + -- taglio estrusi per ottenere solido + local nExtrCopyId = EgtCopy( nMainExtrusionId, nSolidLayerId) + EgtSurfTmCut( nMainExtrusionId, nStartExtrusionId, true, false) + EgtSurfTmCut( nStartExtrusionId, nExtrCopyId, true, false) + -- creo fori per spine su Start + local nDowelLayerId = EgtGroup( nPartId) + EgtSetName( nDowelLayerId, 'Dowel') + local nPrevOutlineId = EgtGetPrev( nOutlineId) + if not nPrevOutlineId then + nPrevOutlineId = EgtGetLastInGroup( nOutlineLayerId) + end + local sOutlineName = EgtGetName( nOutlineId) + local sPrevOutlineName = EgtGetName( nPrevOutlineId) + if StartJointType == WIN_PART_JNT.ANGLED then + + elseif StartJointType == WIN_PART_JNT.FULL then + -- recupero profondita' d'inizio e fine + local sStart = EgtIf( sOutlineName == WIN_BOTTOM, WIN_DWL_BOTTOMPERPSTART, WIN_DWL_TOPPERPSTART) + local sEnd = EgtIf( sOutlineName == WIN_BOTTOM, WIN_DWL_BOTTOMPERPEND, WIN_DWL_TOPPERPEND) + -- ciclo sui fori trovati + local nOrigDowelId = EgtGetFirstNameInGroup( nStartProfileId, WIN_DOWEL .. '*') + while nOrigDowelId do + local dStart = EgtGetInfo( nOrigDowelId, sStart, 'd') + if not dStart then + dStart = EgtGetInfo( nOrigDowelId, WIN_DWL_TOPPERPSTART, 'd') + end + local dEnd = EgtGetInfo( nOrigDowelId, sEnd, 'd') + if not dEnd then + dEnd = EgtGetInfo( nOrigDowelId, WIN_DWL_TOPPERPEND, 'd') + end + local nDowelId = EgtCopyGlob( nOrigDowelId, nDowelLayerId) + EgtSetColor( nDowelId, Color3d( 128, 128, 128)) + local nInGeoId = EgtGetFirstNameInGroup( nGeoLayerId, WIN_GEO_IN) + local ptDowelCenter = EgtCP( nDowelId) + local vtPerpStartPoint = EgtSV( nOutlineId) + vtPerpStartPoint:rotate( Z_AX(), 90) + -- posiziono i fori e gli assegno estrusione e spessore + EgtMove( nDowelId, ( EgtSP( nInGeoId) - ptDowelCenter) * vtPerpStartPoint * vtPerpStartPoint - vtPerpStartPoint * dStart) + -- EgtMove( nDowelId, Point3d( ptDowelCenter:getX(), EgtSP( nInGeoId):getY(), ptDowelCenter:getZ()) - ptDowelCenter - vtPerpStartPoint * dStart) + EgtModifyCurveExtrusion( nDowelId, - vtPerpStartPoint) + EgtModifyCurveThickness( nDowelId, dEnd - dStart) + -- creo solido di estrusione + local nDowelExtrusionId = EgtSurfTmByRegionExtrusion( nSolidLayerId, nDowelId, - vtPerpStartPoint * ( dEnd - dStart + 1)) + EgtMove( nDowelExtrusionId, vtPerpStartPoint) + EgtInvertSurf( nDowelExtrusionId) + -- taglio estrusi per ottenere solido + EgtSurfTmCut( nMainExtrusionId, nDowelExtrusionId, true, false) + EgtSurfTmCut( nDowelExtrusionId, nExtrCopyId, true, false) + nOrigDowelId = EgtGetNextName( nOrigDowelId, WIN_DOWEL .. '*') + end + elseif StartJointType == WIN_PART_JNT.SHORT then + -- recupero profondita' d'inizio e fine + local sStart = EgtIf( sOutlineName == WIN_BOTTOM or sPrevOutlineName == WIN_BOTTOM, WIN_DWL_BOTTOMPARASTART, WIN_DWL_TOPPARASTART) + local sEnd = EgtIf( sOutlineName == WIN_BOTTOM or sPrevOutlineName == WIN_BOTTOM, WIN_DWL_BOTTOMPARAEND, WIN_DWL_TOPPARAEND) + -- ciclo sui fori trovati + local nOrigDowelId = EgtGetFirstNameInGroup( nMainProfileId, WIN_DOWEL .. '*') + while nOrigDowelId do + local dStart = EgtGetInfo( nOrigDowelId, sStart, 'd') + if not dStart then + dStart = EgtGetInfo( nOrigDowelId, WIN_DWL_TOPPARASTART, 'd') + end + local dEnd = EgtGetInfo( nOrigDowelId, sEnd, 'd') + if not dEnd then + dEnd = EgtGetInfo( nOrigDowelId, WIN_DWL_TOPPARAEND, 'd') + end + local nDowelId = EgtCopyGlob( nOrigDowelId, nDowelLayerId) + EgtSetColor( nDowelId, Color3d( 128, 128, 128)) + local nLeftGeoId = EgtGetFirstNameInGroup( nGeoLayerId, WIN_GEO_LEFT) + local ptDowelCenter = EgtCP( nDowelId) + local vtParaStartPoint = EgtSV( nOutlineId) + -- posiziono i fori e gli assegno estrusione e spessore + EgtMove( nDowelId, ( EgtSP( nLeftGeoId) - ptDowelCenter) * vtParaStartPoint * vtParaStartPoint + vtParaStartPoint * dStart) + -- EgtMove( nDowelId, Point3d( ptDowelCenter:getX(), EgtSP( nLeftGeoId):getY(), ptDowelCenter:getZ()) - ptDowelCenter + vtParaStartPoint * dStart) + EgtModifyCurveExtrusion( nDowelId, vtParaStartPoint) + EgtModifyCurveThickness( nDowelId, dEnd - dStart) + -- creo solido di estrusione + local nDowelExtrusionId = EgtSurfTmByRegionExtrusion( nSolidLayerId, nDowelId, vtParaStartPoint * ( dEnd - dStart + 1)) + EgtMove( nDowelExtrusionId, - vtParaStartPoint) + EgtInvertSurf( nDowelExtrusionId) + -- taglio estrusi per ottenere solido + local nDowelExtrCopyId = EgtCopy( nDowelExtrusionId, nSolidLayerId) + EgtSurfTmCut( nDowelExtrusionId, nStartExtrusionId, true, false) + EgtSurfTmCut( nStartExtrusionId, nDowelExtrCopyId, true, false) + EgtErase( nDowelExtrCopyId) + nOrigDowelId = EgtGetNextName( nOrigDowelId, WIN_DOWEL .. '*') + end + end + -- posiziono il profilo End + local nRefEndProfileId = EgtGetFirstNameInGroup( nEndProfileId, 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( nNextGeoId, nSolidLayerId) + EgtSetName( nEndGuideId, WIN_ENDGUIDE) + EgtExtendCurveStartByLen( nEndGuideId, 2 * dGeoWidth) + EgtExtendCurveEndByLen( nEndGuideId, 2 * dGeoWidth) + -- recupero frame del profilo + local nEndProfileFrameId = EgtGetFirstNameInGroup( nEndProfileId, WIN_SECTIONFRAME) + local frEndProfile = EgtFR( nEndProfileFrameId) + frEndProfile:move( - frEndProfile:getVersX() * dEndDelta) + frEndProfile:invert() + -- lo applico a tutte le geometrie del profilo + EgtTransform( EgtGetAllInGroup( nEndProfileId), frEndProfile) + -- assegno come riferimento del profilo il punto start dell'outline + EgtChangeGroupFrame( nEndProfileId, Frame3d( EgtSP( nEndGuideId), - EgtSV( nEndGuideId))) + -- se End e' split, ruoto di 180 gradi il profilo + local nEndId = EgtGetInfo( nOutlineId, WIN_SPLIT_ENDINTERS, 'i') + local nEndProfileType + if nEndId then + local nEndAreaId = EgtGetParent( EgtGetParent( nEndId)) + if nEndAreaId then + nEndProfileType = EgtGetInfo( nEndAreaId, WIN_AREATYPE, 'i') + end + end + if nProfileType == WIN_PRF.SPLIT and nEndProfileType and nEndProfileType == WIN_AREATYPES.SPLIT then + local nEndSouId = nEndId + local nEndSouLayerId + local sEndSouLayer + repeat + nEndSouId = EgtGetInfo( nEndSouId, WIN_SOU) + nEndSouLayerId = EgtGetParent( nEndSouId) + if nEndSouLayerId then + sEndSouLayer = EgtGetName( nEndSouLayerId) + end + until not nEndSouId or not nEndSouLayerId or sEndSouLayer == WIN_BASESPLIT + if nEndSouId and nEndSouLayerId and sEndSouLayer == WIN_BASESPLIT then + -- recupero vettore tangente nel punto medio della curva di contorno + local ptMidEnd = EgtMP( nEndId) + local vtMidEnd = EgtMV( nEndId) + -- recupero vettore tangente nello stesso punto della curva split originale + local dMidStartOnEndSou = EgtCurveParamAtPoint( nEndSouId, ptMidEnd) + local vtMidEndSou = EgtUV( nEndSouId, dMidStartOnEndSou, -1) + -- se i due vettori non sono orientati nella stessa direzione + if not AreSameVectorExact( vtMidEnd, vtMidEndSou) then + -- ruoto di 180 gradi il profilo + local frEndProfileS = EgtFR( nEndProfileFrameId, GDB_ID.ROOT) + EgtRotate( nEndProfileId, frEndProfileS:getOrigin(), frEndProfileS:getVersY(), 180, GDB_RT.GLOB) + local nEndCntProfileId = EgtGetFirstNameInGroup( nEndProfileId, sEndProfileType) + EgtInvertCurve( nEndCntProfileId) + end + end + end + -- recupero outline del profilo End e lo estrudo + local nOutEndProfileId + if sEndProfileType == WIN_MINIZINKEN then + nOutEndProfileId = EgtLine( nEndProfileId, EgtSP( nNextGeoId), EgtSP( nNextGeoId) - Z_AX() * b3RefEndProfile:getDimY(), GDB_RT.GLOB) + EgtInvertCurve( nOutEndProfileId) + else + nOutEndProfileId = EgtGetFirstNameInGroup( nEndProfileId, sEndProfileType) + end + local nEndExtrusionId = EgtSurfTmSwept( nSolidLayerId, nOutEndProfileId, nEndGuideId, false, WIN_SURF_APPROX) + -- taglio estrusi per ottenere solido + EgtSurfTmCut( nMainExtrusionId, nEndExtrusionId, true, false) + EgtSurfTmCut( nEndExtrusionId, nExtrCopyId, true, false) + -- creo fori per spine su End + local nEndOutlineId = EgtGetNext( nOutlineId) + if not nEndOutlineId then + nEndOutlineId = EgtGetFirstInGroup( nOutlineLayerId) + end + local sOutlineName = EgtGetName( nOutlineId) + local sEndOutlineName = EgtGetName( nEndOutlineId) + if StartJointType == WIN_PART_JNT.ANGLED then + + elseif StartJointType == WIN_PART_JNT.FULL then + -- recupero profondita' d'inizio e fine + local sStart = EgtIf( sOutlineName == WIN_BOTTOM, WIN_DWL_BOTTOMPERPSTART, WIN_DWL_TOPPERPSTART) + local sEnd = EgtIf( sOutlineName == WIN_BOTTOM, WIN_DWL_BOTTOMPERPEND, WIN_DWL_TOPPERPEND) + -- ciclo sui fori trovati + local nOrigDowelId = EgtGetFirstNameInGroup( nEndProfileId, WIN_DOWEL .. '*') + while nOrigDowelId do + local dStart = EgtGetInfo( nOrigDowelId, sStart, 'd') + if not dStart then + dStart = EgtGetInfo( nOrigDowelId, WIN_DWL_TOPPERPSTART, 'd') + end + local dEnd = EgtGetInfo( nOrigDowelId, sEnd, 'd') + if not dEnd then + dEnd = EgtGetInfo( nOrigDowelId, WIN_DWL_TOPPERPEND, 'd') + end + local nDowelId = EgtCopyGlob( nOrigDowelId, nDowelLayerId) + EgtSetColor( nDowelId, Color3d( 128, 128, 128)) + local nInGeoId = EgtGetFirstNameInGroup( nGeoLayerId, WIN_GEO_IN) + local ptDowelCenter = EgtCP( nDowelId) + local vtPerpEndPoint = EgtEV( nOutlineId) + vtPerpEndPoint:rotate( Z_AX(), 90) + -- posiziono i fori e gli assegno estrusione e spessore + EgtMove( nDowelId, ( EgtSP( nInGeoId) - ptDowelCenter) * vtPerpEndPoint * vtPerpEndPoint - vtPerpEndPoint * dStart) + EgtModifyCurveExtrusion( nDowelId, - vtPerpEndPoint) + EgtModifyCurveThickness( nDowelId, dEnd - dStart) + -- creo solido di estrusione + local nDowelExtrusionId = EgtSurfTmByRegionExtrusion( nSolidLayerId, nDowelId, - vtPerpEndPoint * ( dEnd - dStart + 1)) + EgtMove( nDowelExtrusionId, vtPerpEndPoint) + EgtInvertSurf( nDowelExtrusionId) + -- taglio estrusi per ottenere solido + EgtSurfTmCut( nMainExtrusionId, nDowelExtrusionId, true, false) + EgtSurfTmCut( nDowelExtrusionId, nExtrCopyId, true, false) + nOrigDowelId = EgtGetNextName( nOrigDowelId, WIN_DOWEL .. '*') + end + elseif StartJointType == WIN_PART_JNT.SHORT then + -- recupero profondita' d'inizio e fine + local sStart = EgtIf( sOutlineName == WIN_BOTTOM or sPrevOutlineName == WIN_BOTTOM, WIN_DWL_BOTTOMPARASTART, WIN_DWL_TOPPARASTART) + local sEnd = EgtIf( sOutlineName == WIN_BOTTOM or sPrevOutlineName == WIN_BOTTOM, WIN_DWL_BOTTOMPARAEND, WIN_DWL_TOPPARAEND) + -- ciclo sui fori trovati + local nOrigDowelId = EgtGetFirstNameInGroup( nMainProfileId, WIN_DOWEL .. '*') + while nOrigDowelId do + local dStart = EgtGetInfo( nOrigDowelId, sStart, 'd') + if not dStart then + dStart = EgtGetInfo( nOrigDowelId, WIN_DWL_TOPPARASTART, 'd') + end + local dEnd = EgtGetInfo( nOrigDowelId, sEnd, 'd') + if not dEnd then + dEnd = EgtGetInfo( nOrigDowelId, WIN_DWL_TOPPARAEND, 'd') + end + local nDowelId = EgtCopyGlob( nOrigDowelId, nDowelLayerId) + EgtSetColor( nDowelId, Color3d( 128, 128, 128)) + local nRightGeoId = EgtGetFirstNameInGroup( nGeoLayerId, WIN_GEO_RIGHT) + local ptDowelCenter = EgtCP( nDowelId) + local vtParaEndPoint = EgtEV( nOutlineId) + -- posiziono i fori e gli assegno estrusione e spessore + EgtMove( nDowelId, ( EgtSP( nRightGeoId) - ptDowelCenter) * vtParaEndPoint * vtParaEndPoint - vtParaEndPoint * dStart) + EgtModifyCurveExtrusion( nDowelId, - vtParaEndPoint) + EgtModifyCurveThickness( nDowelId, dEnd - dStart) + -- creo solido di estrusione + local nDowelExtrusionId = EgtSurfTmByRegionExtrusion( nSolidLayerId, nDowelId, - vtParaEndPoint * ( dEnd - dStart + 1)) + EgtMove( nDowelExtrusionId, vtParaEndPoint) + EgtInvertSurf( nDowelExtrusionId) + -- taglio estrusi per ottenere solido + local nDowelExtrCopyId = EgtCopy( nDowelExtrusionId, nSolidLayerId) + EgtSurfTmCut( nDowelExtrusionId, nEndExtrusionId, true, false) + EgtSurfTmCut( nEndExtrusionId, nDowelExtrCopyId, true, false) + EgtErase( nDowelExtrCopyId) + nOrigDowelId = EgtGetNextName( nOrigDowelId, WIN_DOWEL .. '*') + end + end + -- elimino copia dell'estrusione principale + EgtErase( { nExtrCopyId}) +end + +-- funzione che restitutisce lo Strip piu' vicino +function WinCalculate.GetStripNearestToOutline( nStartProfileId, nOutlineId, sStripName) + -- recupero strip + local ptStartOutline = EgtMP( nOutlineId) + local vtStartOutline = EgtSV( nOutlineId) + local nStartStripId = EgtGetFirstNameInGroup( nStartProfileId, sStripName) + if not nStartStripId then + local nStripMinDistId + local dMinDistance + local nStripId = EgtGetFirstNameInGroup( nStartProfileId, sStripName .. '*') + while nStripId do + local b3Strip = EgtGetBBoxGlob( nStripId, GDB_BB.STANDARD) + -- calcolo il vettore distanza + local vtDistance = b3Strip:getCenter() - ptStartOutline + -- ne ricavo la componente nella stessa direzione dell'outline + local dDistance = abs( vtDistance * vtStartOutline) + if not dMinDistance or dDistance < dMinDistance then + dMinDistance = dDistance + nStripMinDistId = nStripId + end + nStripId = EgtGetNextName( nStripId, sStripName .. '*') + end + nStartStripId = nStripMinDistId + end + return nStartStripId +end + +-- funzione che crea gli Strip +function WinCalculate.CreateStripFromOutline( nAreaId, nOutlineId) + local nPartId = EgtGetInfo( nOutlineId, WIN_REF_PART) + local nAreaType = WIN_AREATYPES.SASH + local nGeoLayerId = EgtGetFirstNameInGroup( nPartId, WIN_GEO) + local nGeoId = EgtGetFirstNameInGroup( nGeoLayerId, WIN_GEO_OUT) + local nOutlineLayerId = EgtGetParent( nOutlineId) + -- recupero layer per solido e per profili di estrusione + local nSolidLayerId = EgtGetFirstNameInGroup( nPartId, WIN_SOLID) + local nMainProfileLayerId = EgtGetFirstNameInGroup( nPartId, WIN_PROFILE) + -- ricavo tipo dal nome + local sName = EgtGetName( nPartId) + local nProfileType = WIN_PRF.NULL + if sName == WIN_TOP then + nProfileType = WIN_PRF.TOP + elseif sName == WIN_BOTTOM then + nProfileType = WIN_PRF.BOTTOM + -- verifico se BottomRail + local nBottomRail = EgtGetInfo( nOutlineId, WIN_BOTTOMRAIL, 'i') + if nBottomRail and nBottomRail > 1 then + nProfileType = WIN_PRF.BOTTOMRAIL + nSolidLayerId = EgtGetFirstNameInGroup( nBottomRail, WIN_SOLID) + nMainProfileLayerId = EgtGetFirstNameInGroup( nBottomRail, WIN_PROFILE) + end + elseif sName == WIN_LEFT then + nProfileType = WIN_PRF.LEFT + elseif sName == WIN_RIGHT then + nProfileType = WIN_PRF.RIGHT + elseif sName == WIN_VERTICAL then + nProfileType = WIN_PRF.VERTICAL + elseif sName == WIN_HORIZONTAL then + nProfileType = WIN_PRF.HORIZONTAL + elseif sName == WIN_SPLIT then + nProfileType = WIN_PRF.SPLIT + end + local nMainProfileId = GDB_ID.NULL + local nStartProfileId = GDB_ID.NULL + local nEndProfileId = GDB_ID.NULL + local nPrevOutlineId = EgtGetPrev( nOutlineId) + if not nPrevOutlineId then + nPrevOutlineId = EgtGetLastInGroup( nOutlineLayerId) + end + local nNextOutlineId = EgtGetNext( nOutlineId) + if not nNextOutlineId then + nNextOutlineId = EgtGetFirstInGroup( nOutlineLayerId) + end + local nPrevPartId = EgtGetInfo( nPrevOutlineId, WIN_REF_PART) + local nPrevProfileLayerId = EgtGetFirstNameInGroup( nPrevPartId, WIN_PROFILE) + local nNextPartId = EgtGetInfo( nNextOutlineId, WIN_REF_PART) + local nNextProfileLayerId = EgtGetFirstNameInGroup( nNextPartId, WIN_PROFILE) + -- verifico se Prev o Next sono BottomRail + local nPrevBottomRail = EgtGetInfo( nPrevOutlineId, WIN_BOTTOMRAIL, 'i') + if nPrevBottomRail and nPrevBottomRail > 1 then + nPrevPartId = nPrevBottomRail + nPrevProfileLayerId = EgtGetFirstNameInGroup( nPrevBottomRail, WIN_PROFILE) + end + local nNextBottomRail = EgtGetInfo( nNextOutlineId, WIN_BOTTOMRAIL, 'i') + if nNextBottomRail and nNextBottomRail > 1 then + nNextPartId = nNextBottomRail + nNextProfileLayerId = EgtGetFirstNameInGroup( nNextBottomRail, WIN_PROFILE) + end + -- recupero profilo e controprofili + nMainProfileId = EgtGetFirstNameInGroup( nMainProfileLayerId, WIN_PRF_MAIN) + nStartProfileId = EgtGetFirstNameInGroup( nPrevProfileLayerId, WIN_PRF_MAIN) + nEndProfileId = EgtGetFirstNameInGroup( nNextProfileLayerId, WIN_PRF_MAIN) + -- recupero outline + local nOutlineLayerId = EgtGetParent( nOutlineId) + -- recupero geo + local nPrevGeoId = EgtGetFirstNameInGroup( nGeoLayerId, WIN_GEO_LEFT) + local nNextGeoId = EgtGetFirstNameInGroup( nGeoLayerId, WIN_GEO_RIGHT) + -- recupero BBox e larghezza del geo + local dGeoWidth = EgtGetInfo( nGeoId, WIN_GEOWIDTH, 'd') + -- creo guida Main + local nGuideId = EgtGetFirstNameInGroup( nSolidLayerId, WIN_MAINGUIDE) + -- recupero frame del profilo + local nMainProfileFrameId = EgtGetFirstNameInGroup( nMainProfileId, WIN_SECTIONFRAME) + -- se anta, estrudo anche il fermavetro + local nMainStripId + local nMainStripExtrusionId + local bStrip = false + if nAreaType == WIN_AREATYPES.SASH then + nMainStripId = WinCalculate.GetStripNearestToOutline( nMainProfileId, nPrevOutlineId, WIN_STRIP) + -- local nStripOutlineId = EgtGetFirstNameInGroup( nMainProfileId, WIN_STRIP) + if nMainStripId then + bStrip = true + -- recupero strip piu' vicino a prev outline + nMainStripExtrusionId = EgtSurfTmSwept( nSolidLayerId, nMainStripId, nGuideId, false, WIN_SURF_APPROX) + end + end + -- recupero frame del profilo start + local nStartProfileFrameId = EgtGetFirstNameInGroup( nStartProfileId, WIN_SECTIONFRAME) + local frStartProfile = EgtFR( nStartProfileFrameId, GDB_ID.ROOT) + -- posiziono il profilo Start + local nRefStartProfileId = EgtGetFirstNameInGroup( nStartProfileId, WIN_REF) + local b3RefStartProfile = EgtGetBBoxRef(nRefStartProfileId, GDB_BB.STANDARD, frStartProfile) + -- se anta, creo guida per il fermavetro + local nStartStripGuideId + local ptStripMinStart + local nMainStripMinOffsetId + local nMainStripMaxOffsetId + if nAreaType == WIN_AREATYPES.SASH and bStrip then + -- calcolo offset per Strip del Main + -- local nMainStripId = EgtGetFirstNameInGroup( nMainProfileId, WIN_STRIP) + local frMainProfile = EgtFR( nMainProfileFrameId, GDB_ID.ROOT) + -- se profilo e direzione prev uguali ( Prev e' Split), cambio segno all'offset di modo che rimanga sempre dalla stessa parte + local vtEndMain = EgtEV( nOutlineId) + local bMainInvertOffset = AreSameVectorApprox( frMainProfile:getVersZ(), vtEndMain) + -- calcolo BBox + local b3MainStrip = EgtGetBBoxRef( nMainStripId, GDB_BB.STANDARD, frMainProfile, GDB_RT.GLOB) + local dMainStripMinDelta = EgtIf( bMainInvertOffset, b3MainStrip:getMax():getX(), b3MainStrip:getMin():getX()) + nMainStripMinOffsetId = EgtCopy( nOutlineId, nSolidLayerId) + EgtOffsetCurve( nMainStripMinOffsetId, EgtIf( bMainInvertOffset, -1, 1) * dMainStripMinDelta) + local dMainStripMaxDelta = EgtIf( bMainInvertOffset, b3MainStrip:getMin():getX(), b3MainStrip:getMax():getX()) + nMainStripMaxOffsetId = EgtCopy( nOutlineId, nSolidLayerId) + EgtOffsetCurve( nMainStripMaxOffsetId, EgtIf( bMainInvertOffset, -1, 1) * dMainStripMaxDelta) + -- recupero strip piu' vicino ad outline + local nStartStripId = WinCalculate.GetStripNearestToOutline( nStartProfileId, nOutlineId, WIN_STRIP) + -- se profilo e direzione prev uguali ( Prev e' Split), cambio segno all'offset di modo che rimanga sempre dalla stessa parte + local vtEndPrev = EgtEV( nPrevOutlineId) + local bStartInvertOffset = AreSameVectorApprox( frStartProfile:getVersZ(), vtEndPrev) + -- calcolo BBox + local b3StartStrip = EgtGetBBoxRef( nStartStripId, GDB_BB.STANDARD, frStartProfile) + local dStarStripMinDelta = EgtIf( bStartInvertOffset, b3StartStrip:getMax():getX(), b3StartStrip:getMin():getX()) + local nStartStripMinOffsetId = EgtCopy( nPrevOutlineId, nSolidLayerId) + -- creo offset Min e Max + EgtOffsetCurve( nStartStripMinOffsetId, EgtIf( bStartInvertOffset, -1, 1) * dStarStripMinDelta) + local dStarStripMaxDelta = EgtIf( bStartInvertOffset, b3StartStrip:getMin():getX(), b3StartStrip:getMax():getX()) + local nStartStripMaxOffsetId = EgtCopy( nPrevOutlineId, nSolidLayerId) + EgtOffsetCurve( nStartStripMaxOffsetId, EgtIf( bStartInvertOffset, -1, 1) * dStarStripMaxDelta) + -- trovo intersezioni e disegno guida start per lo strip + ptStripMinStart = EgtIP( nMainStripMinOffsetId, nStartStripMinOffsetId, EgtSP( nMainStripMinOffsetId)) + local ptStripMaxStart = EgtIP( nMainStripMaxOffsetId, nStartStripMaxOffsetId, EgtSP( nMainStripMaxOffsetId)) + nStartStripGuideId = EgtLine( nSolidLayerId, ptStripMinStart, ptStripMaxStart) + EgtExtendCurveStartByLen( nStartStripGuideId, 10) + EgtExtendCurveEndByLen( nStartStripGuideId, 10) + end + -- se anta, estrudo Strip start e lo taglio con main + local nStartStripExtrusionId + local nStripExtrCopyId + if nAreaType == WIN_AREATYPES.SASH and bStrip then + local nStartStripProfileId = EgtLine( nStartProfileId, ptStripMinStart, ptStripMinStart - Z_AX() * b3RefStartProfile:getDimY(), GDB_RT.GLOB) + EgtInvertCurve( nStartStripProfileId) + nStartStripExtrusionId = EgtSurfTmSwept( nSolidLayerId, nStartStripProfileId, nStartStripGuideId, false, WIN_SURF_APPROX) + nStripExtrCopyId = EgtCopy( nMainStripExtrusionId, nSolidLayerId) + EgtSurfTmCut( nMainStripExtrusionId, nStartStripExtrusionId, true, false) + EgtSurfTmCut( nStartStripExtrusionId, nStripExtrCopyId, true, false) + end + -- recupero frame del profilo + local nEndProfileFrameId = EgtGetFirstNameInGroup( nEndProfileId, WIN_SECTIONFRAME) + local frEndProfile = EgtFR( nEndProfileFrameId, GDB_ID.ROOT) + -- -- posiziono il profilo End + local nRefEndProfileId = EgtGetFirstNameInGroup( nEndProfileId, WIN_REF) + local b3RefEndProfile = EgtGetBBoxRef(nRefEndProfileId, GDB_BB.STANDARD, frEndProfile) + -- se anta, creo guida per il fermavetro + local nEndStripGuideId + local ptStripMinEnd + if nAreaType == WIN_AREATYPES.SASH and bStrip then + -- recupero strip piu' vicino ad outline + local nEndStripId = WinCalculate.GetStripNearestToOutline( nEndProfileId, nOutlineId, WIN_STRIP) + -- se profilo e direzione next uguali ( Next e' Split), cambio segno all'offset di modo che rimanga sempre dalla stessa parte + local vtStartNext = EgtSV( nNextOutlineId) + local bInvertOffset = AreSameVectorApprox( frEndProfile:getVersZ(), vtStartNext) + -- recupero minimo e massimo del box dello Strip per avere offset da outline su Next + local b3EndStrip = EgtGetBBoxRef( nEndStripId, GDB_BB.STANDARD, frEndProfile) + local dEndStripMinDelta = EgtIf( bInvertOffset, b3EndStrip:getMax():getX(), b3EndStrip:getMin():getX()) + local nEndStripMinOffsetId = EgtCopy( nNextOutlineId, nSolidLayerId) + EgtOffsetCurve( nEndStripMinOffsetId, EgtIf( bInvertOffset, -1, 1) * dEndStripMinDelta) + local dEndStripMaxDelta = EgtIf( bInvertOffset, b3EndStrip:getMin():getX(), b3EndStrip:getMax():getX()) + local nEndStripMaxOffsetId = EgtCopy( nNextOutlineId, nSolidLayerId) + EgtOffsetCurve( nEndStripMaxOffsetId, EgtIf( bInvertOffset, -1, 1) * dEndStripMaxDelta) + -- calcolo intersezione degli outline minimi e massimi tra Main e Next per trovare guida dello strip + ptStripMinEnd = EgtIP( nMainStripMinOffsetId, nEndStripMinOffsetId, EgtSP( nMainStripMinOffsetId)) + local ptStripMaxEnd = EgtIP( nMainStripMaxOffsetId, nEndStripMaxOffsetId, EgtSP( nMainStripMaxOffsetId)) + nEndStripGuideId = EgtLine( nSolidLayerId, ptStripMinEnd, ptStripMaxEnd) + EgtExtendCurveStartByLen( nEndStripGuideId, 10) + EgtExtendCurveEndByLen( nEndStripGuideId, 10) + EgtInvertCurve(nEndStripGuideId) + end + -- se anta, estrudo Strip end e lo taglio con main + local nEndStripExtrusionId + if nAreaType == WIN_AREATYPES.SASH and bStrip then + local nEndStripProfileId = EgtLine( nEndProfileId, ptStripMinEnd, ptStripMinEnd - Z_AX() * b3RefEndProfile:getDimY(), GDB_RT.GLOB) + EgtInvertCurve( nEndStripProfileId) + nEndStripExtrusionId = EgtSurfTmSwept( nSolidLayerId, nEndStripProfileId, nEndStripGuideId, false, WIN_SURF_APPROX) + EgtSurfTmCut( nMainStripExtrusionId, nEndStripExtrusionId, true, false) + EgtSurfTmCut( nEndStripExtrusionId, nStripExtrCopyId, true, false) + end + EgtErase( { nStripExtrCopyId}) +end + +-- funzione che crea il solido del pezzo del telaio +function WinCalculate.CalcFrameSolid(nPartId, nOutlineId, nGeoId, nOutlineLayerId, bBottomRail) + local nAreaId = nOutlineLayerId + local nAreaType + -- ciclo fino a trovare un child che non sia uno split + repeat + nAreaId = EgtGetParent( nAreaId) + nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') + until not nAreaId or ( nAreaType ~= WIN_AREATYPES.SPLIT and nAreaType ~= WIN_AREATYPES.NULL) + -- recupero profilo + local nProfileLayerId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE) + local nProfileFrameLayerId + if nAreaType == WIN_AREATYPES.FRAME then + nProfileFrameLayerId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_FRAME) + elseif nAreaType == WIN_AREATYPES.SASH then + nProfileFrameLayerId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_SASH) + end + -- creo layer per solido e per profili di estrusione + local nSolidLayerId = EgtGroup( nPartId) + EgtSetName( nSolidLayerId, WIN_SOLID) + local nFrameProfileLayerId = EgtGroup( nPartId) + EgtSetName( nFrameProfileLayerId, WIN_PROFILE) + -- ricavo tipo dal nome + local sName = EgtGetName( nPartId) + local nProfileType = WIN_PRF.NULL + if bBottomRail then + nProfileType = WIN_PRF.BOTTOMRAIL + elseif sName == WIN_TOP then + nProfileType = WIN_PRF.TOP + elseif sName == WIN_BOTTOM then + nProfileType = WIN_PRF.BOTTOM + elseif sName == WIN_LEFT then + nProfileType = WIN_PRF.LEFT + elseif sName == WIN_RIGHT then + nProfileType = WIN_PRF.RIGHT + elseif sName == WIN_VERTICAL then + nProfileType = WIN_PRF.VERTICAL + elseif sName == WIN_HORIZONTAL then + nProfileType = WIN_PRF.HORIZONTAL + elseif sName == WIN_SPLIT then + nProfileType = WIN_PRF.SPLIT + end + local nPrevOutlineId + local nNextOutlineId + local nOrigMainProfileId = GDB_ID.NULL + local nMainProfileId = GDB_ID.NULL + local nOrigStartProfileId = GDB_ID.NULL + local nStartProfileId = GDB_ID.NULL + local nOrigEndProfileId = GDB_ID.NULL + local nEndProfileId = GDB_ID.NULL + -- recupero outline precedente e successivo + if nProfileType == WIN_PRF.BOTTOM then + -- nPrevOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_LEFT) + -- nNextOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_RIGHT) + elseif nProfileType == WIN_PRF.RIGHT then + -- nPrevOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_BOTTOM) + -- nNextOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_TOP) + elseif nProfileType == WIN_PRF.TOP then + -- nPrevOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_RIGHT) + -- nNextOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_LEFT) + elseif nProfileType == WIN_PRF.LEFT then + -- nPrevOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_TOP) + -- nNextOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_BOTTOM) + elseif nProfileType == WIN_PRF.VERTICAL then + -- nPrevOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_BOTTOM) + -- nNextOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_TOP) + nPrevOutlineId = EgtGetInfo( nOutlineId, WIN_SPLIT_STARTINTERS, 'i') + nNextOutlineId = EgtGetInfo( nOutlineId, WIN_SPLIT_ENDINTERS, 'i') + elseif nProfileType == WIN_PRF.HORIZONTAL then + -- nPrevOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_LEFT) + -- nNextOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_RIGHT) + nPrevOutlineId = EgtGetInfo( nOutlineId, WIN_SPLIT_STARTINTERS, 'i') + nNextOutlineId = EgtGetInfo( nOutlineId, WIN_SPLIT_ENDINTERS, 'i') + elseif nProfileType == WIN_PRF.SPLIT then + local nStartId = EgtGetInfo( nOutlineId, WIN_SPLIT_STARTINTERS, 'i') + local nEndId = EgtGetInfo( nOutlineId, WIN_SPLIT_ENDINTERS, 'i') + local sStartName = EgtGetName( nStartId) + local sEndName = EgtGetName( nEndId) + -- nPrevOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, sStartName) + -- nNextOutlineId = EgtGetFirstNameInGroup( nOutlineLayerId, sEndName) + nPrevOutlineId = EgtGetInfo( nOutlineId, WIN_SPLIT_STARTINTERS, 'i') + nNextOutlineId = EgtGetInfo( nOutlineId, WIN_SPLIT_ENDINTERS, 'i') + -- se di tipo split, cerco sou che non siano split + local nPrevSouId = nPrevOutlineId + local nPrevSouAreaId = EgtGetParent( EgtGetParent( nPrevSouId)) + local nPrevSouType = EgtGetInfo( nPrevSouAreaId, WIN_AREATYPE, 'i') + while nPrevSouId and nPrevSouType == WIN_AREATYPES.SPLIT do + nPrevSouId = EgtGetInfo( nPrevSouId, WIN_SOU) + nPrevSouAreaId = EgtGetParent( EgtGetParent( nPrevSouId)) + nPrevSouType = EgtGetInfo( nPrevSouAreaId, WIN_AREATYPE, 'i') + end + nPrevOutlineId = nPrevSouId + local nNextSouId = nNextOutlineId + local nNextSouAreaId = EgtGetParent( EgtGetParent( nNextSouId)) + local nNextSouType = EgtGetInfo( nNextSouAreaId, WIN_AREATYPE, 'i') + while nNextSouId and nNextSouType == WIN_AREATYPES.SPLIT do + nNextSouId = EgtGetInfo( nNextSouId, WIN_SOU) + nNextSouAreaId = EgtGetParent( EgtGetParent( nNextSouId)) + nNextSouType = EgtGetInfo( nNextSouAreaId, WIN_AREATYPE, 'i') + end + nNextOutlineId = nNextSouId + end + -- recupero outline precedente + if not nPrevOutlineId then + nPrevOutlineId = EgtGetPrev( nOutlineId) + if not nPrevOutlineId then + nPrevOutlineId = EgtGetLastInGroup( nOutlineLayerId) + end + end + if not nNextOutlineId then + nNextOutlineId = EgtGetNext( nOutlineId) + if not nNextOutlineId then + nNextOutlineId = EgtGetFirstInGroup( nOutlineLayerId) + end + end + -- recupero profilo e controprofili + local sCurrProfileType = EgtGetInfo( nOutlineId, WIN_PROFILETYPE) + -- se profilo principale BottomRail, gli imposto il profilo + if nProfileType == WIN_PRF.BOTTOMRAIL then + sCurrProfileType = WIN_RAIL_BOTTOM + end + local sPrevProfileType = EgtGetInfo( nPrevOutlineId, WIN_PROFILETYPE) + local sNextProfileType = EgtGetInfo( nNextOutlineId, WIN_PROFILETYPE) + -- se e' di tipo split + if nProfileType == WIN_PRF.SPLIT then + -- se profilo Prev e' bottom + local sPrevName = EgtGetName( nPrevOutlineId) + if sPrevName == WIN_BOTTOM then + -- ed e' presente BottomRail + local nBottomRailId = EgtGetInfo( EgtGetParent( nPrevOutlineId), WIN_BOTTOMRAIL, 'i') + if nBottomRailId and nBottomRailId == 1 then + -- allora imposto profilo BottomRail + sPrevProfileType = WIN_RAIL_BOTTOM + end + end + -- se profilo Next e' bottom + local sNextName = EgtGetName( nNextOutlineId) + if sNextName == WIN_BOTTOM then + -- ed e' presente BottomRail + local nBottomRailId = EgtGetInfo( EgtGetParent( nNextOutlineId), WIN_BOTTOMRAIL, 'i') + if nBottomRailId and nBottomRailId == 1 then + -- allora imposto profilo BottomRail + sNextProfileType = WIN_RAIL_BOTTOM + end + end + end + nOrigMainProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, sCurrProfileType) + nOrigStartProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, sPrevProfileType) + nOrigEndProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, sNextProfileType) + -- creo copie di profilo e controprofili + nMainProfileId = EgtCopy( nOrigMainProfileId, nFrameProfileLayerId) + EgtSetName( nMainProfileId, WIN_PRF_MAIN) + nStartProfileId = EgtCopy( nOrigStartProfileId, nFrameProfileLayerId) + EgtSetName( nStartProfileId, WIN_PRF_START) + nEndProfileId = EgtCopy( nOrigEndProfileId, nFrameProfileLayerId) + EgtSetName( nEndProfileId, WIN_PRF_END) + -- creo solido dai profili + WinCalculate.MakeSolidByExtrusion(nGeoId, nOutlineId, nMainProfileId, nStartProfileId, nEndProfileId, nProfileType, nSolidLayerId, nAreaType) + end + + -- funzione che crea il solido del Fill +function WinCalculate.CalcFillSolid(nPartId, nOutlineLayerId, nGeoLayerId) + -- creo layer per solido + local nSolidLayerId = EgtGroup( nPartId) + EgtSetName( nSolidLayerId, WIN_SOLID) + -- creo compo di outline + local OutlineList ={} + local nFirstSideId = EgtGetFirstInGroup( nOutlineLayerId) + local nOutlineId = nFirstSideId + while nOutlineId do + table.insert( OutlineList, nOutlineId) + nOutlineId = EgtGetNext( nOutlineId) + end + local nCompoOutlineId = EgtCurveCompoByChain( nSolidLayerId, OutlineList, EgtSP( nFirstSideId), false) + -- recupero spessore vetro + local dGlassThickness = EgtGetInfo( nGeoLayerId, WIN_GEOWIDTH, 'd') + local nSurfId = EgtSurfTmByRegionExtrusion( nSolidLayerId, nCompoOutlineId, Z_AX() * dGlassThickness) + EgtErase(nCompoOutlineId) +end + + -- funzione che calcola l'ingombro dei pezzi del telaio e i loro solidi +function WinCalculate.CreatePartFromOutline( nAreaLayerId, nOutlineId, bBottomRail) + local nAreaType = EgtGetInfo( nAreaLayerId, WIN_AREATYPE, 'i') + -- creo pezzo + local nPartId = EgtGroup( GDB_ID.ROOT) + -- se BottomRail, creo riferimento + if bBottomRail then + EgtSetInfo( nOutlineId, WIN_BOTTOMRAIL, nPartId) + -- local nBaseOutlineLayerId = EgtGetFirstNameInGroup( nAreaLayerId, WIN_AREAOUTLINE) + -- local nBaseOutlineId = EgtGetFirstInGroup( nBaseOutlineLayerId) + -- while nBaseOutlineId do + -- local nCopyId = EgtGetInfo( nBaseOutlineId, WIN_COPY) + -- if nCopyId == nOutlineId then + -- EgtSetInfo( nBaseOutlineId, WIN_BOTTOMRAIL, nPartId) + -- end + -- end + end + -- recupero outline + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaLayerId, WIN_OUTLINE) + local nProfileType = WIN_PRF.NULL + if nAreaType == WIN_AREATYPES.FRAME or nAreaType == WIN_AREATYPES.SASH or nAreaType == WIN_AREATYPES.SPLIT then + -- se area senza outline, cerco quella superiore + if not nOutlineLayerId then + local nParentAreaLayerId = EgtGetParent( nAreaLayerId) + if nParentAreaLayerId then + nOutlineLayerId = EgtGetFirstNameInGroup( nParentAreaLayerId, WIN_OUTLINE) + end + end + -- ricavo tipo dal nome + local sName = EgtGetName( nOutlineId) + if bBottomRail then + nProfileType = WIN_PRF.BOTTOMRAIL + sName = WIN_BOTTOMRAIL + elseif sName == WIN_TOP then + nProfileType = WIN_PRF.TOP + elseif sName == WIN_BOTTOM then + nProfileType = WIN_PRF.BOTTOM + elseif sName == WIN_LEFT then + nProfileType = WIN_PRF.LEFT + elseif sName == WIN_RIGHT then + nProfileType = WIN_PRF.RIGHT + elseif sName == WIN_VERTICAL then + nProfileType = WIN_PRF.VERTICAL + elseif sName == WIN_HORIZONTAL then + nProfileType = WIN_PRF.HORIZONTAL + elseif sName == WIN_SPLIT then + nProfileType = WIN_PRF.SPLIT + end + -- imposto nome + EgtSetName( nPartId, sName) + -- imposto colore + if nProfileType == WIN_PRF.BOTTOM or nProfileType == WIN_PRF.TOP or nProfileType == WIN_PRF.HORIZONTAL or nProfileType == WIN_PRF.BOTTOMRAIL then + EgtSetColor( nPartId, Color3d( 204, 102, 0)) + elseif nProfileType == WIN_PRF.RIGHT or nProfileType == WIN_PRF.LEFT or nProfileType == WIN_PRF.VERTICAL then + EgtSetColor( nPartId, Color3d( 251, 128, 4)) + else + EgtSetColor( nPartId, Color3d( 255, 159, 57)) + end + elseif nAreaType == WIN_AREATYPES.FILL then + -- imposto nome + EgtSetName( nPartId, WIN_FILL) + -- ricavo tipo + local nFillType = EgtGetInfo( nAreaLayerId, WIN_FILLTYPE, 'i') + if nFillType == WIN_FILLTYPES.GLASS then + EgtSetColor( nPartId, Color3d( 71, 161, 255)) + EgtSetAlpha( nPartId, 30) + elseif nFillType == WIN_FILLTYPES.WOOD then + EgtSetColor( nPartId, Color3d( 194, 148, 103)) + end + end + + -- inserisco riferimento alla sua area ed al suo outline + EgtSetInfo( nPartId, WIN_AREA, nAreaLayerId) + if nAreaType ~= WIN_AREATYPES.FILL then + EgtSetInfo( nPartId, WIN_REF_OUTLINE, nOutlineId) + if not bBottomRail then EgtSetInfo( nOutlineId, WIN_REF_PART, nPartId) end + end + + if nAreaType == WIN_AREATYPES.FRAME or nAreaType == WIN_AREATYPES.SASH or nAreaType == WIN_AREATYPES.SPLIT then + -- disegno ingombro + local nGeoId = WinCalculate.CalcFrameGeo( nPartId, nOutlineId, nOutlineLayerId, bBottomRail) + + -- disegno solido + if bCalcSolid then + WinCalculate.CalcFrameSolid(nPartId, nOutlineId, nGeoId, nOutlineLayerId, bBottomRail) + end + elseif nAreaType == WIN_AREATYPES.FILL then + -- disegno ingombro + local nGeoLayerId = WinCalculate.CalcFillGeo( nPartId, nOutlineLayerId) + + -- disegno solido + if bCalcSolid then + WinCalculate.CalcFillSolid(nPartId, nOutlineLayerId, nGeoLayerId) + end + end + + -- se di tipo bottom + if nProfileType == WIN_BOTTOM then + -- se ha BottomRail + local nBottomRail = EgtGetInfo( nOutlineId, WIN_BOTTOMRAIL, 'i') + if nBottomRail and nBottomRail == 1 then + + end + end + + -- offset per distanziare i pezzi + --local dYPosOffset = 300 * ( nProfileType - 1) + --EgtChangeGroupFrame( nPartId, Frame3d( Point3d( 0, dYPosOffset, 0))) + +end + +-- funzione che posiziona un pezzo +function WinCalculate.PositionPart(nPartId) + -- ricavo tipo dal nome + local sName = EgtGetName( nPartId) + local sDelta = '' + if sName == WIN_BOTTOM then + sDelta = WIN_STARTCPDELTA + elseif sName == WIN_RIGHT then + sDelta = WIN_STARTCPDELTA + elseif sName == WIN_TOP then + sDelta = WIN_STARTCPDELTA + elseif sName == WIN_LEFT then + sDelta = WIN_STARTCPDELTA + end + -- calcolo nuovo riferimento + local nGeoPartLayerId = EgtGetFirstNameInGroup( nPartId, WIN_GEO) + local nGeoPartId = EgtGetFirstNameInGroup( nGeoPartLayerId, sName) + local dDelta = EgtGetInfo( nGeoPartId, sDelta, 'd') or 0 + local nFrameLayerId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_FRAME) + local nOutlineLayerId = EgtGetFirstNameInGroup( nFrameLayerId, WIN_OUTLINE) + local nFramePartId = EgtGetFirstNameInGroup( nOutlineLayerId, sName) + local vtStart = EgtSV( nFramePartId) + local ptStart = EgtSP( nFramePartId) + vtStart * dDelta + local _, _, dAngRight = SphericalFromVector(vtStart) + local frStart = Frame3d( ptStart) + frStart:rotate( frStart:getOrigin(), Z_AX(), dAngRight) + EgtChangeGroupFrame( nPartId, frStart) +end + +-- funzione che assembla i pezzi +function WinCalculate.AssembleFrame() + local nBottomPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_BOTTOM) + WinCalculate.PositionPart(nBottomPartId) + local nRightPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_RIGHT) + WinCalculate.PositionPart(nRightPartId) + local nTopPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_TOP) + WinCalculate.PositionPart(nTopPartId) + local nLeftPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_LEFT) + WinCalculate.PositionPart(nLeftPartId) + -- assemblo i pezzi + --local nRightPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_RIGHT) + --local nGeoRightLayerId = EgtGetFirstNameInGroup( nRightPartId, WIN_GEO) + --local nGeoRightId = EgtGetFirstNameInGroup( nGeoRightLayerId, WIN_RIGHT) + --local dDelta = EgtGetInfo( nGeoRightId, WIN_BOTTOMCPDELTA, 'd') + --local nFrameLayerId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_FRAME) + --local nOutlineLayerId = EgtGetFirstNameInGroup( nFrameLayerId, WIN_OUTLINE) + --local nFrameRightId = EgtGetFirstNameInGroup( nOutlineLayerId, WIN_RIGHT) + --local vtRight = EgtSV( nFrameRightId) + --local ptRight = EgtSP( nFrameRightId) + vtRight * dDelta + --local _, _, dAngRight = SphericalFromVector(vtRight) + --local frRight = Frame3d( ptRight) + --frRight:rotate( frRight:getOrigin(), Z_AX(), dAngRight) + --EgtChangeGroupFrame( nRightPartId, frRight) +end + +--------------------------------------------------------------------- +return WinCalculate diff --git a/Profiles/WinLib/WinCreate.lua b/Profiles/WinLib/WinCreate.lua new file mode 100644 index 0000000..a6ac768 --- /dev/null +++ b/Profiles/WinLib/WinCreate.lua @@ -0,0 +1,430 @@ +-- +-- EEEEEEEEEE GGGGGG TTTTTTTTTTTTTT +-- EEEEEEEEEE GGGGGGGGGG TTTTTTTTTTTTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEEEEEEEE GGGGGGGGGG TTTT +-- EEEEEEEEEE GGGGGG TTTT +-- +-- by Egalware s.r.l. +-- Window project software by Egalware s.r.l. 2023/05/02 + +-- Tabella per definizione modulo +local WinCreate = {} + +-- Include +require( 'EgtBase') +require( 'WinConst') + +-- funzioni + +-- funzione che importa il profilo +function WinCreate.ImportProfile( sProfilePath) + -- creo gruppo per il profilo + local nProfileId = EgtGroup( GDB_ID.ROOT) + EgtSetName( nProfileId, WIN_PROFILE) + -- importo profilo prescelto + local bOk = EgtInsertFile( sProfilePath) + -- recupero gruppi importati e li sposto nel gruppo profilo + local nGroupId = EgtGetFirstInGroup( GDB_ID.ROOT) + while nGroupId do + if nGroupId ~= nProfileId then + local nCurrId = nGroupId + nGroupId = EgtGetNext( nGroupId) + EgtRelocateGlob( nCurrId, nProfileId) + EgtSetStatus( nCurrId, GDB_ST.OFF) + else + nGroupId = EgtGetNext( nGroupId) + end + end + -- riporto path nel Part del profilo + EgtSetInfo( nProfileId, WIN_PROFILEPATH, sProfilePath) +end + +-- funzione che crea il buco rettangolare per la finestra +function WinCreate.CreateFrame( dWidth, dHeight, nJointBL, nJointBR, nJointTR, nJointTL) + -- creo gruppo per telaio + local nFrameAreaId = EgtGroup( GDB_ID.ROOT) + EgtSetName( nFrameAreaId, WIN_AREA .. '(' .. WIN_FRAME .. ')') + -- imposto il tipo + EgtSetInfo( nFrameAreaId, WIN_AREATYPE, WIN_AREATYPES.FRAME) + local nAreaOutlineLayerId = EgtGroup( nFrameAreaId) + EgtSetName( nAreaOutlineLayerId, WIN_AREAOUTLINE) + -- disegno outline + local nFrameBottomId = EgtLine( nAreaOutlineLayerId, Point3d( 0, 0, 0), Point3d( dWidth, 0, 0)) + EgtSetName( nFrameBottomId, WIN_BOTTOM) + local nFrameRightId = EgtLine( nAreaOutlineLayerId, Point3d( dWidth, 0, 0), Point3d( dWidth, dHeight, 0)) + EgtSetName( nFrameRightId, WIN_RIGHT) + local nFrameTopId = EgtLine( nAreaOutlineLayerId, Point3d( dWidth, dHeight, 0), Point3d( 0, dHeight, 0)) + EgtSetName( nFrameTopId, WIN_TOP) + local nFrameLeftId = EgtLine( nAreaOutlineLayerId, Point3d( 0, dHeight, 0), Point3d( 0, 0, 0)) + EgtSetName( nFrameLeftId, WIN_LEFT) + -- 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) + return nFrameAreaId +end +-- funzione che crea il buco per la finestra +function WinCreate.CreateGenFrame( nFrameBottomId, nFrameRightId, nFrameTopId, nFrameLeftId, nJointBL, nJointBR, nJointTR, nJointTL) + -- creo gruppo per telaio + local nFrameAreaId = EgtGroup( GDB_ID.ROOT) + EgtSetName( nFrameAreaId, WIN_AREA .. '(' .. WIN_FRAME .. ')') + -- imposto il tipo + EgtSetInfo( nFrameAreaId, WIN_AREATYPE, WIN_AREATYPES.FRAME) + local nAreaOutlineLayerId = EgtGroup( nFrameAreaId) + EgtSetName( nAreaOutlineLayerId, WIN_AREAOUTLINE) + -- disegno outline + EgtRelocateGlob( nFrameBottomId, nAreaOutlineLayerId) + EgtSetName( nFrameBottomId, WIN_BOTTOM) + EgtRelocateGlob( nFrameRightId, nAreaOutlineLayerId) + EgtSetName( nFrameRightId, WIN_RIGHT) + EgtRelocateGlob( nFrameTopId, nAreaOutlineLayerId) + EgtSetName( nFrameTopId, WIN_TOP) + EgtRelocateGlob( nFrameLeftId, nAreaOutlineLayerId) + EgtSetName( nFrameLeftId, WIN_LEFT) + -- 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) + return nFrameAreaId +end + +-- -- funzione che crea il telaio a partire dal buco +-- function WinCreate.CreateFrameOnHole( nHoleLayerId, dWidth, dHeight) +-- local nAreaOutlineLayerId = EgtGroup( nHoleLayerId) +-- EgtSetName( nAreaOutlineLayerId, WIN_OUTLINE) +-- -- disegno outline +-- local nHoleBottomId = EgtLine( nAreaOutlineLayerId, Point3d( 0, 0, 0), Point3d( dWidth, 0, 0)) +-- EgtSetName( nHoleBottomId, WIN_BOTTOM) +-- local nHoleRightId = EgtLine( nAreaOutlineLayerId, Point3d( dWidth, 0, 0), Point3d( dWidth, dHeight, 0)) +-- EgtSetName( nHoleRightId, WIN_RIGHT) +-- local nHoleTopId = EgtLine( nAreaOutlineLayerId, Point3d( dWidth, dHeight, 0), Point3d( 0, dHeight, 0)) +-- EgtSetName( nHoleTopId, WIN_TOP) +-- local nHoleLeftId = EgtLine( nAreaOutlineLayerId, Point3d( 0, dHeight, 0), Point3d( 0, 0, 0)) +-- EgtSetName( nHoleLeftId, WIN_LEFT) +-- end + +-- funzione che aggiunge una anta +function WinCreate.AddSash( nAreaId, nJointBL, nJointBR, nJointTR, nJointTL, nSashType) + -- creo nuova area + local nSashAreaId = EgtGroup( nAreaId) + EgtSetName( nSashAreaId, WIN_AREA .. '(' .. WIN_SASH .. ')') + -- imposto il tipo + EgtSetInfo( nSashAreaId, WIN_AREATYPE, WIN_AREATYPES.SASH) + -- recupero outline area precedente + local nPrevAreaOutlineId = EgtGetFirstNameInGroup( nAreaId, WIN_AREAOUTLINE) + -- lo copio per outline area dell'anta + local nAreaOutlineLayerId = EgtGroup( nSashAreaId) + EgtSetName( nAreaOutlineLayerId, WIN_AREAOUTLINE) + local nAreaOutlineId = EgtGetFirstInGroup( nPrevAreaOutlineId) + while nAreaOutlineId do + local nOutlineId = EgtCopy( nAreaOutlineId, nAreaOutlineLayerId) + EgtSetInfo( nOutlineId, WIN_SOU, nAreaOutlineId) + EgtSetInfo( nAreaOutlineId, WIN_CHILD, nOutlineId) + 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) + -- imposto tipo di anta se presente + if nSashType then + EgtSetInfo( nSashAreaId, WIN_SASHTYPE, nSashType) + end + return nSashAreaId +end + +-- funzione che aggiunge un riempimento +function WinCreate.AddFill( nAreaId, FillType) + -- creo nuova area + local nFillAreaId = EgtGroup( nAreaId) + EgtSetName( nFillAreaId, WIN_AREA .. '(' .. WIN_FILL .. ')') + -- imposto il tipo + EgtSetInfo( nFillAreaId, WIN_AREATYPE, WIN_AREATYPES.FILL) + -- recupero outline area precedente + local nPrevAreaOutlineId = EgtGetFirstNameInGroup( nAreaId, WIN_AREAOUTLINE) + -- lo copio per outline area del riempimento + local nAreaOutlineLayerId = EgtGroup( nFillAreaId) + EgtSetName( nAreaOutlineLayerId, WIN_AREAOUTLINE) + local nAreaOutlineId = EgtGetFirstInGroup( nPrevAreaOutlineId) + while nAreaOutlineId do + local nOutlineId = EgtCopy( nAreaOutlineId, nAreaOutlineLayerId) + EgtSetInfo( nOutlineId, WIN_SOU, nAreaOutlineId) + EgtSetInfo( nAreaOutlineId, WIN_CHILD, nOutlineId) + EgtRemoveInfo( nAreaOutlineLayerId, WIN_JOINT_BL) + EgtRemoveInfo( nAreaOutlineLayerId, WIN_JOINT_BR) + EgtRemoveInfo( nAreaOutlineLayerId, WIN_JOINT_TL) + EgtRemoveInfo( nAreaOutlineLayerId, WIN_JOINT_TR) + nAreaOutlineId = EgtGetNext( nAreaOutlineId) + end + -- imposto tipo di fill + EgtSetInfo( nFillAreaId, WIN_FILLTYPE, FillType) + return nFillAreaId +end + +-- funzione che crea un taglio split +function WinCreate.AddSplit( nAreaLayerId, SplitType, MeasureType, nPosition, nProportion, nSplitType) + -- creo layer temporaneo per split + local nTempSplitLayerId = EgtGroup( nAreaLayerId) + EgtSetName( nTempSplitLayerId, WIN_TEMPSPLIT) + -- recupero contorno area precedente + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaLayerId, WIN_AREAOUTLINE) + local b3OutlineLayer = EgtGetBBox( nOutlineLayerId, GDB_BB.STANDARD) + local OutlineIds = {} + local nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) + while nOutlineId do + local sName = EgtGetName( nOutlineId) + table.insert( OutlineIds, nOutlineId) + nOutlineId = EgtGetNext( nOutlineId) + end + local nTotSplitId + if SplitType == WIN_SPLITORIENTATION.VERTICAL then + -- creo linea + local nCalcPosition = 0 + if MeasureType == WIN_MEASURE.ABSOLUT then + nCalcPosition = nPosition + elseif MeasureType == WIN_MEASURE.PROPORTIONAL then + nCalcPosition = b3OutlineLayer:getDimX() / nProportion * nPosition + end + nTotSplitId = EgtLine( nTempSplitLayerId, b3OutlineLayer:getMin() + X_AX() * nCalcPosition, b3OutlineLayer:getMin() + X_AX() * nCalcPosition + Y_AX() * b3OutlineLayer:getDimY()) + elseif SplitType == WIN_SPLITORIENTATION.HORIZONTAL then + -- creo linea + local nCalcPosition = 0 + if MeasureType == WIN_MEASURE.ABSOLUT then + nCalcPosition = nPosition + elseif MeasureType == WIN_MEASURE.PROPORTIONAL then + nCalcPosition = b3OutlineLayer:getDimY() / nProportion * nPosition + end + nTotSplitId = EgtLine( nTempSplitLayerId, b3OutlineLayer:getMin() + Y_AX() * nCalcPosition, b3OutlineLayer:getMin() + Y_AX() * nCalcPosition + X_AX() * b3OutlineLayer:getDimX()) + end + -- calcolo split + local nArea1Id, nArea2Id = WinCreate.AddGenSplit( nAreaLayerId, nTotSplitId, nSplitType) + EgtErase( nTempSplitLayerId) + return nArea1Id, nArea2Id +end + +-- funzione che crea tagli split multipli +function WinCreate.AddSplits( nAreaLayerId, SplitType, MeasureType, PositionList, nProportion) + if MeasureType == WIN_MEASURE.ABSOLUT then + for nIndex = 1, #PositionList do + WinCreate.AddSplit( nAreaLayerId, SplitType, MeasureType, PositionList[nIndex], nProportion) + end + elseif MeasureType == WIN_MEASURE.PROPORTIONAL then + for nIndex = 1, #PositionList do + WinCreate.AddSplit( nAreaLayerId, SplitType, MeasureType, PositionList[nIndex], nProportion) + end + end +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 = (CurrOutInters.IntersPoint - ptStartSplit):sqlen() + CurrOutInters.EndDistance = (CurrOutInters.IntersPoint - ptEndSplit):sqlen() + 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) + EgtSetInfo( nSplitId, WIN_SPLIT_STARTINTERS, StartInters.Id) + EgtSetInfo( nSplitId, WIN_SPLIT_ENDINTERS, EndInters.Id) + -- 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]) + end +end + +-- funzione che crea le aree da un taglio split +function WinCreate.CreateAreaFromSplit( nAreaLayerId, nSplitId) + -- creo layer per le due aree + local nArea1Id = EgtGroup( nAreaLayerId) + EgtSetName( nArea1Id , WIN_AREA1) + EgtSetInfo( nArea1Id, WIN_AREATYPE, WIN_AREATYPES.NULL) + local nArea1OutlineLayerId = EgtGroup( nArea1Id) + EgtSetName( nArea1OutlineLayerId , WIN_AREAOUTLINE) + local nArea2Id = EgtGroup( nAreaLayerId) + EgtSetName( nArea2Id , WIN_AREA2) + 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 + nInters = 1 + local nCopyId = EgtCopy( nOutlineId, nArea2OutlineLayerId) + EgtSetInfo( nCopyId, WIN_SOU, nOutlineId) + EgtSetInfo( nOutlineId, WIN_CHILD, nCopyId) + local dStartIntersParam = EgtCurveParamAtPoint( nCopyId, ptInters) + EgtTrimCurveStartAtParam( nCopyId, dStartIntersParam) + elseif nInters == 1 then + -- trovato secondo punto di intersezione - fine area 2 + nInters = 2 + local nCopyId = EgtCopy( nOutlineId, nArea2OutlineLayerId) + EgtSetInfo( nCopyId, WIN_SOU, nOutlineId) + EgtSetInfo( nOutlineId, WIN_CHILD, nCopyId) + local dEndIntersParam = EgtCurveParamAtPoint( nCopyId, ptInters) + EgtTrimCurveEndAtParam( nCopyId, dEndIntersParam) + -- copio anche split + local nSplitCopyId = EgtCopy( nSplitId, nArea2OutlineLayerId) + EgtSetInfo( nSplitCopyId, WIN_SOU, nSplitId) + EgtSetInfo( nSplitId, WIN_CHILD, nSplitCopyId) + EgtRemoveInfo( nSplitCopyId, WIN_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 + nCopyId = EgtCopy( nOutlineId, nArea1OutlineLayerId) + EgtSetInfo( nCopyId, WIN_SOU, nOutlineId) + EgtSetInfo( 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) + EgtSetInfo( nOutlineId, WIN_CHILD, nCopyId) + local dEndIntersParam = EgtCurveParamAtPoint( nCopyId, ptInters) + EgtTrimCurveEndAtParam( nCopyId, dEndIntersParam) + -- copio anche split + local nSplitCopyId = EgtCopy( nSplitId, nArea1OutlineLayerId) + EgtRemoveName( nSplitCopyId) + EgtSetInfo( nSplitCopyId, WIN_SOU, nSplitId) + EgtSetInfo( nSplitId, WIN_CHILD, nSplitCopyId) + EgtRemoveInfo( nSplitCopyId, WIN_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 + end + elseif nInters == 1 then + -- copio nel profilo 2 + local nCopyId = EgtCopy( nOutlineId, nArea2OutlineLayerId) + EgtSetInfo( nCopyId, WIN_SOU, nOutlineId) + EgtSetInfo( nOutlineId, WIN_CHILD, nCopyId) + elseif nInters == 2 then + -- copio nel profilo 1 + local nCopyId = EgtCopy( nOutlineId, nArea1OutlineLayerId) + EgtSetInfo( nCopyId, WIN_SOU, nOutlineId) + EgtSetInfo( nOutlineId, WIN_CHILD, nCopyId) + end + -- aggiorno indice + nOutlineId = EgtGetNext( nOutlineId) + -- se arrivato alla fine riparto + if not nOutlineId then + nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) + end + end + -- error('qqq') + return nArea1Id, nArea2Id +end + +-- funzione che aggiunge uno zoccolo +function WinCreate.AddBottomRail( nAreaId) + local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') + 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 + +--------------------------------------------------------------------- +return WinCreate diff --git a/Profiles/WinLib/WinDesign.lua b/Profiles/WinLib/WinDesign.lua new file mode 100644 index 0000000..10995fc --- /dev/null +++ b/Profiles/WinLib/WinDesign.lua @@ -0,0 +1,34 @@ +-- +-- EEEEEEEEEE GGGGGG TTTTTTTTTTTTTT +-- EEEEEEEEEE GGGGGGGGGG TTTTTTTTTTTTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEEEEEEEE GGGGGGGGGG TTTT +-- EEEEEEEEEE GGGGGG TTTT +-- +-- by Egalware s.r.l. +-- Window project software by Egalware s.r.l. 2023/05/02 + +-- Tabella per definizione modulo +local WinDesign = {} + +-- Include +require( 'EgtBase') +require( 'WinConst') + +-- funzioni + +function WinDesign.DesignFrame( dWidth, dHeight, nJointBL, nJointBR, nJointTR, nJointTL) + +end + +function WinDesign.DesignSash( sFilePath) + +end + +--------------------------------------------------------------------- +return WinDesign diff --git a/Profiles/WinLib/WinManageProject.lua b/Profiles/WinLib/WinManageProject.lua new file mode 100644 index 0000000..9b66c94 --- /dev/null +++ b/Profiles/WinLib/WinManageProject.lua @@ -0,0 +1,253 @@ +-- +-- EEEEEEEEEE GGGGGG TTTTTTTTTTTTTT +-- EEEEEEEEEE GGGGGGGGGG TTTTTTTTTTTTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEEEEEEEE GGGGGGGGGG TTTT +-- EEEEEEEEEE GGGGGG TTTT +-- +-- by Egalware s.r.l. +-- Window project software by Egalware s.r.l. 2023/05/02 + +-- Tabella per definizione modulo +local WinManageProject = {} + +-- Include +require( 'EgtBase') +_G.package.loaded.WinConst = nil +require( 'WinConst') +_G.package.loaded.WinJWDConst = nil +require( 'WinJWDConst') +_G.package.loaded.WinCreate = nil +local WinCreate = require( 'WinCreate') +_G.package.loaded.JSON = nil +local JSON = require( 'JSON') + +-- funzioni +local function ConvertCurveToTableEntity( nCurveId) + -- verifico il tipo di entita' + local nBaseOutlineType = EgtGetType( nCurveId) + if nBaseOutlineType == GDB_TY.CRV_LINE then + local ptStart = EgtSP( nCurveId) + local ptEnd = EgtEP( nCurveId) + return { [JWD_CRV_TYPE] = nBaseOutlineType, [JWD_POINT_START] = ptStart, [JWD_POINT_END] = ptEnd} + elseif nBaseOutlineType == GDB_TY.CRV_ARC then + local ptStart = EgtSP( nCurveId) + local ptEnd = EgtEP( nCurveId) + local ptMid = EgtMP( nCurveId) + return { [JWD_CRV_TYPE] = nBaseOutlineType, [JWD_POINT_START] = ptStart, [JWD_POINT_END] = ptEnd, [JWD_POINT_MID] = ptMid} + elseif nBaseOutlineType == GDB_TY.CRV_COMPO then + -- local ptStart = EgtSP( nCurveId) + -- local ptEnd = EgtEP( nCurveId) + -- local ptMid = EgtMP( nCurveId) + -- return { Type = nBaseOutlineType, ptStart = ptStart, ptEnd = ptEnd, ptMid = ptMid} + end +end + +-- funzione ricorsiva che legge le aree e ne riporta i dati in tabella +local function ConvertAreaToTable( nAreaId) + local AreaTable = {} + local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') + AreaTable[JWD_AREA_TYPE] = nAreaType + if nAreaType == WIN_AREATYPES.NULL then + -- non faccio nulla + elseif nAreaType == WIN_AREATYPES.FRAME then + -- recupero outline del frame + local nBaseOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_AREAOUTLINE, 'i') + local JointTable = {} + -- recupero tipo giunzioni + local nJointBL = EgtGetInfo( nBaseOutlineLayerId, WIN_JOINT_BL, 'i') + local nJointBR = EgtGetInfo( nBaseOutlineLayerId, WIN_JOINT_BR, 'i') + local nJointTL = EgtGetInfo( nBaseOutlineLayerId, WIN_JOINT_TL, 'i') + local nJointTR = EgtGetInfo( nBaseOutlineLayerId, WIN_JOINT_TR, 'i') + JointTable[JWD_JOINT_BL] = nJointBL + JointTable[JWD_JOINT_BR] = nJointBR + JointTable[JWD_JOINT_TL] = nJointTL + JointTable[JWD_JOINT_TR] = nJointTR + local OutlineTable = {} + -- recupero contorno + local nBaseOutlineId = EgtGetFirstInGroup( nBaseOutlineLayerId) + local nBaseOutlineIndex = 1 + while nBaseOutlineId do + local Entity = ConvertCurveToTableEntity( nBaseOutlineId) + table.insert( OutlineTable, Entity) + nBaseOutlineIndex = nBaseOutlineIndex + 1 + nBaseOutlineId = EgtGetNext( nBaseOutlineId) + end + AreaTable[JWD_JOINT] = JointTable + AreaTable[JWD_OUTLINE] = OutlineTable + -- verifico se c'e' BottomRail + local nBottomRailId = EgtGetInfo( nBaseOutlineLayerId, WIN_BOTTOMRAIL, 'i') + if nBottomRailId then + AreaTable[JWD_BOTTOM_RAIL] = 1 + end + elseif nAreaType == WIN_AREATYPES.SASH then + local nBaseOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_AREAOUTLINE) + local JointTable = {} + -- recupero tipo giunzioni + local nJointBL = EgtGetInfo( nBaseOutlineLayerId, WIN_JOINT_BL, 'i') + local nJointBR = EgtGetInfo( nBaseOutlineLayerId, WIN_JOINT_BR, 'i') + local nJointTL = EgtGetInfo( nBaseOutlineLayerId, WIN_JOINT_TL, 'i') + local nJointTR = EgtGetInfo( nBaseOutlineLayerId, WIN_JOINT_TR, 'i') + JointTable[JWD_JOINT_BL] = nJointBL + JointTable[JWD_JOINT_BR] = nJointBR + JointTable[JWD_JOINT_TL] = nJointTL + JointTable[JWD_JOINT_TR] = nJointTR + AreaTable[JWD_JOINT] = JointTable + local nSashType = EgtGetInfo( nAreaId, WIN_SASHTYPE, 'i') + if nSashType then + AreaTable[JWD_SASH_TYPE] = nSashType + end + elseif nAreaType == WIN_AREATYPES.FILL then + local nFillType = EgtGetInfo( nAreaId, WIN_FILLTYPE, 'i') + AreaTable[JWD_FILL_TYPE] = nFillType + + elseif nAreaType == WIN_AREATYPES.SPLIT then + + + end + -- verifico se c'e' Split + local nSplitLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_BASESPLIT) + if nSplitLayerId then + local SplitTable = {} + local nSplitId = EgtGetFirstInGroup( nSplitLayerId) + local Entity = ConvertCurveToTableEntity( nSplitId) + table.insert( SplitTable, Entity) + AreaTable[JWD_SPLIT] = SplitTable + end + -- ciclo sulle aree contenute + local nChildAreaId = EgtGetFirstNameInGroup( nAreaId, WIN_AREAASTERISK) + local nChildIndex = 1 + while nChildAreaId do + local ChildTable = ConvertAreaToTable( nChildAreaId) + local AreaName = JWD_AREA .. nChildIndex + AreaTable[AreaName] = ChildTable + nChildIndex = nChildIndex + 1 + nChildAreaId = EgtGetNextName( nChildAreaId, WIN_AREAASTERISK) + end + return AreaTable +end + +-- funzione che converte una curva descritta in tabella in una geometria +local function ConvertCurveTableToEntity( nDrawFrameLayerId, CurrCurve) + if CurrCurve[JWD_CRV_TYPE] == GDB_TY.CRV_LINE then + EgtLine( nDrawFrameLayerId, Point3d(CurrCurve[JWD_POINT_START]), Point3d(CurrCurve[JWD_POINT_END])) + elseif CurrCurve[JWD_CRV_TYPE] == GDB_TY.CRV_ARC then + EgtArc3P( nDrawFrameLayerId, Point3d(CurrCurve[JWD_POINT_START]), Point3d(CurrCurve[JWD_POINT_MID]), Point3d(CurrCurve[JWD_POINT_END])) + elseif CurrCurve[JWD_CRV_TYPE] == GDB_TY.CRV_COMPO then + -- local ptStart = EgtSP( nBaseOutlineId) + -- local ptEnd = EgtEP( nBaseOutlineId) + -- local ptMid = EgtMP( nBaseOutlineId) + -- local Entity = { Type = nBaseOutlineType, ptStart = ptStart, ptEnd = ptEnd, ptMid = ptMid} + end +end + +-- funzione ricorsiva che legge le aree in tabella e crea le geometrie +local function ConvertTableToGeometry( AreaTable, nAreaId) + if AreaTable[JWD_AREA_TYPE] == WIN_AREATYPES.NULL then + + elseif AreaTable[JWD_AREA_TYPE] == WIN_AREATYPES.FRAME then + -- creo gruppo e layer per contorno + local nDrawFramePartId = EgtGroup( GDB_ID.ROOT) + EgtSetName( nDrawFramePartId, 'DrawFrame') + local nDrawFrameLayerId = EgtGroup( nDrawFramePartId) + for nIndex = 1, #AreaTable[JWD_OUTLINE] do + local CurrCurve = AreaTable[JWD_OUTLINE][nIndex] + ConvertCurveTableToEntity( nDrawFrameLayerId, CurrCurve) + end + local nFrameBottomId = EgtGetFirstInGroup(nDrawFrameLayerId) + local nFrameRightId = EgtGetNext(nFrameBottomId) + local nFrameTopId = EgtGetNext(nFrameRightId) + local nFrameLeftId = EgtGetNext(nFrameTopId) + -- 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]) + -- elimino contorno frame + EgtErase( nDrawFramePartId) + -- se BottomRail + if AreaTable[JWD_BOTTOM_RAIL] and AreaTable[JWD_BOTTOM_RAIL] == 1 then + 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]) + 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 + + end + -- verifico se c'e' Split + if AreaTable[JWD_SPLIT] then + -- creo gruppo e layer per Split + local nDrawFramePartId = EgtGroup( GDB_ID.ROOT) + EgtSetName( nDrawFramePartId, 'DrawFrame') + local nDrawFrameLayerId = EgtGroup( nDrawFramePartId) + ConvertCurveTableToEntity( nDrawFrameLayerId, AreaTable[JWD_SPLIT][1]) + local nArea1Id, nArea2Id = WinCreate.AddGenSplit( nAreaId, EgtGetFirstInGroup(nDrawFrameLayerId)) --, nSplitType) + EgtErase(nDrawFramePartId) + ConvertTableToGeometry( AreaTable[JWD_AREA .. 1], nArea1Id) + ConvertTableToGeometry( AreaTable[JWD_AREA .. 2], nArea2Id) + else + -- ciclo sulle sotto aree + local nChildIndex = 1 + while AreaTable[JWD_AREA ..nChildIndex] do + ConvertTableToGeometry( AreaTable[JWD_AREA ..nChildIndex], nAreaId) + nChildIndex = nChildIndex + 1 + end + end +end + +-- funzione che crea le tabelle gerarchiche dalla struttura geometrica +function WinManageProject.CreateTableFromGeom( nFrameId) + -- creo la tabella + local WinTable = {} + -- riporto la path del profilo + local nProfileId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE) + local sProfilePath = EgtGetInfo( nProfileId, WIN_PROFILEPATH) + WinTable[JWD_PROFILE_PATH] = sProfilePath + -- leggo aree + local FrameTable = ConvertAreaToTable( nFrameId) + local AreaName = JWD_AREA .. 1 + WinTable[AreaName] = FrameTable + return WinTable +end + +-- funzione che crea la struttura geometrica dalle tabelle gerarchiche +function WinManageProject.CreateGeomFromTable( WinTable) + -- importo profilo + WinCreate.ImportProfile( WinTable[JWD_PROFILE_PATH]) + -- creo aree + ConvertTableToGeometry( WinTable[JWD_AREA .. 1], GDB_ID.ROOT) +end + +-- funzione che dato un progetto gerarchico lo scrive in json su un file +function WinManageProject.WriteToFile( nFrameId, sFilePath) + local sFilePath = EgtChangePathExtension( sFilePath, JWD_EXT) + local WinTable = WinManageProject.CreateTableFromGeom( nFrameId) + local sData = JSON:encode_pretty(WinTable) + local DestFh = io.open( sFilePath, 'w+') + if not DestFh then + EgtOutBox( 'Error opening ' .. sFilePath, 'WriteToFile', 'ERROR') + return + end + DestFh:write( sData) + DestFh:close() +end + +-- funzione che dato un file in json ne crea il progetto gerarchico +function WinManageProject.ReadFromFile( sFilePath) + local SouFh = io.open( sFilePath, "rb") + if not SouFh then + EgtOutBox( 'Error opening ' .. sFilePath, 'ReadFromFile', 'ERROR') + return + end + local content = SouFh:read( "*all") + SouFh:close() + local tData = JSON:decode( content) + WinManageProject.CreateGeomFromTable( tData) +end + +--------------------------------------------------------------------- +return WinManageProject diff --git a/Profiles/WinOpenProjectFile.lua b/Profiles/WinOpenProjectFile.lua new file mode 100644 index 0000000..737e0b8 --- /dev/null +++ b/Profiles/WinOpenProjectFile.lua @@ -0,0 +1,61 @@ +-- +-- EEEEEEEEEE GGGGGG TTTTTTTTTTTTTT +-- EEEEEEEEEE GGGGGGGGGG TTTTTTTTTTTTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEEEEEEEE GGGGGGGGGG TTTT +-- EEEEEEEEEE GGGGGG TTTT +-- +-- by Egalware s.r.l. +-- Window project software by Egalware s.r.l. 2023/05/02 + +require( 'EgtBase') +_ENV = EgtProtectGlobal() +EgtEnableDebug( true) +-- EgtEnableDebug( false) + +-- Imposto direttorio per librerie +local sBaseDir = EgtGetSourceDir() +EgtOutLog("BaseDir=" .. sBaseDir) +EgtAddToPackagePath( sBaseDir .. '?.lua') +EgtAddToPackagePath( sBaseDir .. 'WinLib\\' .. '?.lua') + +_G.package.loaded.WinConst = nil +require( 'WinConst') +_G.package.loaded.WinCreate = nil +local WinCreate = require( 'WinCreate') +_G.package.loaded.WinCalculate = nil +local WinCalculate = require( 'WinCalculate') +_G.package.loaded.WinManageProject = nil +local WinManageProject = require( 'WinManageProject') + +-- ciclo principale + +EgtStartCounter() + +EgtNewFile() + +local sOpeneDirPath = 'c:\\EgtData\\Window\\Projects' +local sFileName = 'RoundArc_TripleVerticalSash.jwd' +local sOpenFilePath = sOpeneDirPath .. '\\' .. sFileName +if WINDOW and WINDOW.FILE then + sOpenFilePath = WINDOW.FILE +end +WinManageProject.ReadFromFile( sOpenFilePath) + +-- imposto se calcolare i solidi o meno +WinCalculate.SetCalcSolid( true) + +-- creo i pezzi +local nFrameId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_AREAASTERISK) +WinCalculate.CreatePartFromArea( nFrameId) + +EgtZoom( SCE_ZM.ALL) + +-- riporto tempi di esecuzione +local sOut = string.format( ' ExecTime = %.2f ms', EgtStopCounter()) +EgtOutLog( sOut) diff --git a/Profiles/WinSaveProjectFile.lua b/Profiles/WinSaveProjectFile.lua new file mode 100644 index 0000000..b77ce24 --- /dev/null +++ b/Profiles/WinSaveProjectFile.lua @@ -0,0 +1,542 @@ +-- +-- EEEEEEEEEE GGGGGG TTTTTTTTTTTTTT +-- EEEEEEEEEE GGGGGGGGGG TTTTTTTTTTTTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEEEEE GGGG GGGGGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEE GGGG GGGG TTTT +-- EEEEEEEEEE GGGGGGGGGG TTTT +-- EEEEEEEEEE GGGGGG TTTT +-- +-- by Egalware s.r.l. +-- Window project software by Egalware s.r.l. 2023/05/02 + +require( 'EgtBase') +_ENV = EgtProtectGlobal() +EgtEnableDebug( true) +-- EgtEnableDebug( false) + +-- Imposto direttorio per librerie +local sBaseDir = EgtGetSourceDir() +EgtOutLog("BaseDir=" .. sBaseDir) +EgtAddToPackagePath( sBaseDir .. '?.lua') +EgtAddToPackagePath( sBaseDir .. 'WinLib\\' .. '?.lua') + +_G.package.loaded.WinConst = nil +require( 'WinConst') +_G.package.loaded.WinCreate = nil +local WinCreate = require( 'WinCreate') +_G.package.loaded.WinCalculate = nil +local WinCalculate = require( 'WinCalculate') +_G.package.loaded.WinManageProject = nil +local WinManageProject = require( 'WinManageProject') + +------------------------------------------- PARAMETERS ------------------------------------------- +local DebugCode = false + +local HoleWidth = 1835 +local HoleHeight = 1516 + +local WindowWidth = 1800 +local WindowHeight = 1500 + +local WindowTree + +local sProfilePath = 'c:\\EgtData\\Window\\Profiles\\Profilo78 - Offset.nge' + +------------------------------------------- ************** ------------------------------------------- + +-- ciclo principale + +EgtStartCounter() + +EgtNewFile() + +-- importo profilo prescelto +WinCreate.ImportProfile( sProfilePath) + +local sFileName = '' + +-- creo telaio rettangolare +sFileName = 'Rect_' +local FrameJointType = WIN_JNT.FULL_H +local nFrameId = WinCreate.CreateFrame( WindowWidth, WindowHeight, FrameJointType, FrameJointType, FrameJointType, FrameJointType) + +-- -- creo telaio generico +-- sFileName = 'RoundArc_' +-- 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.FULL_H +-- local nFrameId = WinCreate.CreateGenFrame( nFrameBottomId, nFrameRightId, nFrameTopId, nFrameLeftId, FrameJointType, FrameJointType, FrameJointType, FrameJointType) + +------------------------ Finestra vetro fisso ------------------------ + +-- sFileName = sFileName .. 'FixedGlass' + +-- -- aggiungo zoccolo +-- WinCreate.AddBottomRail( nFrameId) +-- -- aggiungo vetro +-- local nFillId = WinCreate.AddFill( nFrameId, WIN_FILLTYPES.GLASS) + +------------------------ Finestra vetro fisso con divisione orizzontale ------------------------ + +-- sFileName = sFileName .. 'FixedGlass_HorizontalSplit' + +-- -- aggiungo zoccolo +-- WinCreate.AddBottomRail( nFrameId) + +-- -- definisco prima divisione +-- local nArea1Id, nArea2Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight / 2) + +-- -- aggiungo vetri +-- local nFill1Id = WinCreate.AddFill( nArea1Id, WIN_FILLTYPES.GLASS) +-- local nFill2Id = WinCreate.AddFill( nArea2Id, WIN_FILLTYPES.GLASS) + +------------------------ Finestra vetro fisso con divisione verticale ------------------------ + +-- sFileName = sFileName .. 'FixedGlass_VerticalSplit' + +-- -- aggiungo zoccolo +-- WinCreate.AddBottomRail( nFrameId) + +-- -- definisco prima divisione +-- local nArea1Id, nArea2Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 2) + +-- -- aggiungo vetri +-- local nFill1Id = WinCreate.AddFill( nArea1Id, WIN_FILLTYPES.GLASS) +-- local nFill2Id = WinCreate.AddFill( nArea2Id, WIN_FILLTYPES.GLASS) + +------------------------ Finestra vetro fisso con divisione orizzontale e verticale ------------------------ + +sFileName = sFileName .. 'FixedGlass_Vertical&HorizontalSplit' + +-- aggiungo zoccolo +WinCreate.AddBottomRail( nFrameId) + +-- definisco divisioni +local nArea1Id, nArea2Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 2) +local nArea11Id, nArea12Id = WinCreate.AddSplit( nArea1Id, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight / 2) +local nArea21Id, nArea22Id = WinCreate.AddSplit( nArea2Id, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight / 2) + +-- aggiungo vetri +local nFill1Id = WinCreate.AddFill( nArea11Id, WIN_FILLTYPES.GLASS) +local nFill2Id = WinCreate.AddFill( nArea12Id, WIN_FILLTYPES.GLASS) +local nFill3Id = WinCreate.AddFill( nArea21Id, WIN_FILLTYPES.GLASS) +local nFill4Id = WinCreate.AddFill( nArea22Id, WIN_FILLTYPES.GLASS) + +------------------------ Finestra anta singola ------------------------ + +-- sFileName = sFileName .. 'Sash' + +-- -- aggiungo anta +-- local SashJointType = WIN_JNT.FULL_V +-- local nSashId = WinCreate.AddSash( nFrameId, SashJointType, SashJointType, SashJointType, SashJointType) + +-- -- aggiungo vetro +-- local nFillId = WinCreate.AddFill( nSashId, WIN_FILLTYPES.GLASS) + +------------------------ Finestra anta singola con divisione orizzontale ------------------------ + +-- sFileName = sFileName .. 'Sash_HorizontalSplit' + +-- -- aggiungo anta +-- local SashJointType = WIN_JNT.FULL_V +-- local nSashId = WinCreate.AddSash( nFrameId, SashJointType, SashJointType, SashJointType, SashJointType) + +-- -- definisco prima divisione +-- local nArea1Id, nArea2Id = WinCreate.AddSplit( nSashId, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight / 3) + +-- -- aggiungo vetri +-- local nFill1Id = WinCreate.AddFill( nArea1Id, WIN_FILLTYPES.GLASS) +-- local nFill2Id = WinCreate.AddFill( nArea2Id, WIN_FILLTYPES.GLASS) + +------------------------ Finestra anta singola con divisione verticale ------------------------ + +-- sFileName = sFileName .. 'Sash_VerticalSplit' + +-- -- aggiungo anta +-- local SashJointType = WIN_JNT.FULL_V +-- local nSashId = WinCreate.AddSash( nFrameId, SashJointType, SashJointType, SashJointType, SashJointType) + +-- -- definisco prima divisione +-- local nArea1Id, nArea2Id = WinCreate.AddSplit( nSashId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 2) + +-- -- aggiungo vetri +-- local nFill1Id = WinCreate.AddFill( nArea1Id, WIN_FILLTYPES.GLASS) +-- local nFill2Id = WinCreate.AddFill( nArea2Id, WIN_FILLTYPES.GLASS) + +------------------------ Finestra anta singola con divisione orizzontale e verticale ------------------------ + +-- sFileName = sFileName .. 'Sash_Vertical&HorizontalSplit' + +-- -- aggiungo anta +-- local SashJointType = WIN_JNT.FULL_V +-- local nSashId = WinCreate.AddSash( nFrameId, SashJointType, SashJointType, SashJointType, SashJointType) + +-- -- definisco divisioni +-- local nArea1Id, nArea2Id = WinCreate.AddSplit( nSashId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 2) +-- local nArea11Id, nArea12Id = WinCreate.AddSplit( nArea1Id, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight / 2) +-- local nArea21Id, nArea22Id = WinCreate.AddSplit( nArea2Id, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight / 2) + +-- -- aggiungo vetri +-- local nFill1Id = WinCreate.AddFill( nArea11Id, WIN_FILLTYPES.GLASS) +-- local nFill2Id = WinCreate.AddFill( nArea12Id, WIN_FILLTYPES.GLASS) +-- local nFill3Id = WinCreate.AddFill( nArea21Id, WIN_FILLTYPES.GLASS) +-- local nFill4Id = WinCreate.AddFill( nArea22Id, WIN_FILLTYPES.GLASS) + +------------------------ Finestra doppia anta con montante verticale ------------------------ + +-- sFileName = sFileName .. 'DoubleVerticalSash_Mullion' + +-- -- definisco prima divisione +-- 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) + +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) + +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea2Id, SashJointType, SashJointType, SashJointType, SashJointType) + +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) + +------------------------ Finestra doppia anta battente ricevente ------------------------ + +-- sFileName = sFileName .. 'DoubleVerticalSash_French' + +-- -- definisco prima divisione +-- 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) + +-- -- 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) + +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) + +------------------------ Finestra doppia anta con montante orizzontale ------------------------ + +-- -- 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) + +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) + +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea2Id, SashJointType, SashJointType, SashJointType, SashJointType) + +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) + +------------------------ Finestra tripla anta con montanti verticali ------------------------ + +-- sFileName = sFileName .. 'TripleVerticalSash_Mullion' + +-- -- definisco prima divisione +-- local nArea1Id, nArea2Id = 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) + +-- -- aggiungo prima anta +-- local SashJointType = WIN_JNT.FULL_V +-- local nSash1Id = WinCreate.AddSash( nArea1Id, SashJointType, SashJointType, SashJointType, SashJointType) + +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) + +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea2Id, SashJointType, SashJointType, SashJointType, SashJointType) + +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) + +-- -- aggiungo terza anta +-- local nSash3Id = WinCreate.AddSash( nArea3Id, SashJointType, SashJointType, SashJointType, SashJointType) + +-- -- aggiungo vetro +-- local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) + +------------------------ Finestra tripla anta con montante verticale e ante battente e ricevente ------------------------ + +-- sFileName = sFileName .. 'TripleVerticalSash_Mullion&French' + +-- -- definisco prima divisione +-- local nArea1Id, nArea2Id = 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) + +-- -- aggiungo prima anta +-- local SashJointType = WIN_JNT.FULL_V +-- local nSash1Id = WinCreate.AddSash( nArea1Id, SashJointType, SashJointType, SashJointType, SashJointType) + +-- -- 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) + +-- -- 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) + +-- -- 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) + +-- -- definisco seconda divisione +-- local nArea2Id, nArea3Id = WinCreate.AddSplit( nArea2Id, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight / 3) + +-- -- aggiungo prima anta +-- local SashJointType = WIN_JNT.FULL_V +-- local nSash1Id = WinCreate.AddSash( nArea1Id, SashJointType, SashJointType, SashJointType, SashJointType) + +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) + +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea2Id, SashJointType, SashJointType, SashJointType, SashJointType) + +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) + +-- -- aggiungo terza anta +-- local nSash3Id = WinCreate.AddSash( nArea3Id, SashJointType, SashJointType, SashJointType, SashJointType) + +-- -- 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) + +-- -- aggiungo prima anta +-- local SashJointType = WIN_JNT.FULL_V +-- local nSash1Id = WinCreate.AddSash( nArea1Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) + +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea2Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) + +-- -- aggiungo terza anta +-- local nSash3Id = WinCreate.AddSash( nArea3Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- -- aggiungo vetro +-- local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) + + +------------------------ Finestra sei ante con montanti verticali e orizzontale ------------------------ + +-- sFileName = sFileName .. 'SixSash_Vertical&HorizontalMullion' + +-- -- 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 nArea21Id, nArea22Id = WinCreate.AddSplit( nArea21Id, 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) +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) + +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea12Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) + +-- -- aggiungo terza anta +-- local nSash3Id = WinCreate.AddSash( nArea13Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- -- aggiungo vetro +-- local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) + +-- -- aggiungo quarta anta +-- local nSash4Id = WinCreate.AddSash( nArea21Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- -- aggiungo vetro +-- local nFill4Id = WinCreate.AddFill( nSash4Id, WIN_FILLTYPES.GLASS) + +-- -- aggiungo quinta anta +-- local nSash5Id = WinCreate.AddSash( nArea22Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- -- aggiungo vetro +-- local nFill5Id = WinCreate.AddFill( nSash5Id, WIN_FILLTYPES.GLASS) + +-- -- aggiungo sesta anta +-- local nSash6Id = WinCreate.AddSash( nArea23Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- -- aggiungo vetro +-- local nFill6Id = WinCreate.AddFill( nSash6Id, WIN_FILLTYPES.GLASS) + +------------------------ Finestra sei ante con montante verticale e orizzontale ed ante battente ricevente ------------------------ + +-- -- 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) + +-- -- aggiungo prima anta +-- local SashJointType = WIN_JNT.FULL_V +-- local nSash1Id = WinCreate.AddSash( nArea11Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- -- 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) +-- -- 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) +-- -- 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) +-- -- 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) +-- -- aggiungo vetro +-- local nFill5Id = WinCreate.AddFill( nSash5Id, WIN_FILLTYPES.GLASS) + +-- -- aggiungo sesta anta +-- local nSash6Id = WinCreate.AddSash( nArea23Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- -- 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) + +-- -- definisco seconda divisione +-- local nArea2Id, nArea3Id = WinCreate.AddSplit( nArea2Id, 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) +-- -- 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) +-- -- 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) +-- -- definisco divisione +-- local nArea31Id, nArea32Id = WinCreate.AddSplit( nSash3Id, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight * 2 / 5) +-- -- aggiungo vetri +-- local nFill31Id = WinCreate.AddFill( nArea31Id, WIN_FILLTYPES.GLASS) +-- local nFill32Id = WinCreate.AddFill( nArea32Id, 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) + +-- -- aggiungo anta sopra +-- local SashJointType = WIN_JNT.FULL_V +-- local nSash0Id = WinCreate.AddSash( nArea0Id, SashJointType, SashJointType, SashJointType, SashJointType) +-- -- 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) +-- -- 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) +-- -- 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) +-- -- definisco divisione +-- local nArea31Id, nArea32Id = WinCreate.AddSplit( nSash3Id, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight * 2 / 5) +-- -- aggiungo vetri +-- local nFill31Id = WinCreate.AddFill( nArea31Id, WIN_FILLTYPES.GLASS) +-- local nFill32Id = WinCreate.AddFill( nArea32Id, WIN_FILLTYPES.GLASS) + +----------------------------------------------------------------------------------- + +-- imposto se calcolare i solidi o meno +WinCalculate.SetCalcSolid( true) + +-- creo i pezzi +local nFrameId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_AREAASTERISK) +WinCalculate.CreatePartFromArea( nFrameId) + +-- salvo progetto su file +local sSaveDirPath = 'c:\\EgtData\\Window\\Projects' +local sSaveFilePath = sSaveDirPath .. '\\' .. sFileName +WinManageProject.WriteToFile( nFrameId, sSaveFilePath) + +EgtZoom( SCE_ZM.ALL) + +-- riporto tempi di esecuzione +local sOut = string.format( ' ExecTime = %.2f ms', EgtStopCounter()) +EgtOutLog( sOut) diff --git a/Projects/Rect_DoubleVerticalSash_French.jwd b/Projects/Rect_DoubleVerticalSash_French.jwd new file mode 100644 index 0000000..225d1e5 --- /dev/null +++ b/Projects/Rect_DoubleVerticalSash_French.jwd @@ -0,0 +1,68 @@ +{ + "Area1": { + "Area1": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 2, + "Joint": { + "JointBL": 3, + "JointBR": 3, + "JointTL": 3, + "JointTR": 3 + }, + "SashType": 2 + }, + "AreaType": 0 + }, + "Area2": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 2, + "Joint": { + "JointBL": 3, + "JointBR": 3, + "JointTL": 3, + "JointTR": 3 + }, + "SashType": 1 + }, + "AreaType": 0 + }, + "AreaType": 1, + "Joint": { + "JointBL": 2, + "JointBR": 2, + "JointTL": 2, + "JointTR": 2 + }, + "Outline": [ { + "CurveType": 256, + "ptEnd": [ 1800.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 0.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 1800.0, 1500.0, 0.0 ], + "ptStart": [ 1800.0, 0.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 0.0, 1500.0, 0.0 ], + "ptStart": [ 1800.0, 1500.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 0.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 1500.0, 0.0 ] + } ], + "Split": [ { + "CurveType": 256, + "ptEnd": [ 900.0, 1500.0, 0.0 ], + "ptStart": [ 900.0, 0.0, 0.0 ] + } ] + }, + "ProfilePath": "c:\\EgtData\\Window\\Profiles\\Profilo78 - Offset.nge" +} \ No newline at end of file diff --git a/Projects/Rect_DoubleVerticalSash_Mullion.jwd b/Projects/Rect_DoubleVerticalSash_Mullion.jwd new file mode 100644 index 0000000..fe0c2ae --- /dev/null +++ b/Projects/Rect_DoubleVerticalSash_Mullion.jwd @@ -0,0 +1,66 @@ +{ + "Area1": { + "Area1": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 2, + "Joint": { + "JointBL": 3, + "JointBR": 3, + "JointTL": 3, + "JointTR": 3 + } + }, + "AreaType": 0 + }, + "Area2": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 2, + "Joint": { + "JointBL": 3, + "JointBR": 3, + "JointTL": 3, + "JointTR": 3 + } + }, + "AreaType": 0 + }, + "AreaType": 1, + "Joint": { + "JointBL": 2, + "JointBR": 2, + "JointTL": 2, + "JointTR": 2 + }, + "Outline": [ { + "CurveType": 256, + "ptEnd": [ 1800.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 0.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 1800.0, 1500.0, 0.0 ], + "ptStart": [ 1800.0, 0.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 0.0, 1500.0, 0.0 ], + "ptStart": [ 1800.0, 1500.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 0.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 1500.0, 0.0 ] + } ], + "Split": [ { + "CurveType": 256, + "ptEnd": [ 900.0, 1500.0, 0.0 ], + "ptStart": [ 900.0, 0.0, 0.0 ] + } ] + }, + "ProfilePath": "c:\\EgtData\\Window\\Profiles\\Profilo78 - Offset.nge" +} \ No newline at end of file diff --git a/Projects/Rect_FixedGlass.jwd b/Projects/Rect_FixedGlass.jwd new file mode 100644 index 0000000..3b6ca4f --- /dev/null +++ b/Projects/Rect_FixedGlass.jwd @@ -0,0 +1,34 @@ +{ + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 1, + "BottomRail": 1, + "Joint": { + "JointBL": 2, + "JointBR": 2, + "JointTL": 2, + "JointTR": 2 + }, + "Outline": [ { + "CurveType": 256, + "ptEnd": [ 1800.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 0.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 1800.0, 1500.0, 0.0 ], + "ptStart": [ 1800.0, 0.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 0.0, 1500.0, 0.0 ], + "ptStart": [ 1800.0, 1500.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 0.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 1500.0, 0.0 ] + } ] + }, + "ProfilePath": "c:\\EgtData\\Window\\Profiles\\Profilo78 - Offset.nge" +} \ No newline at end of file diff --git a/Projects/Rect_FixedGlass_Vertical&HorizontalSplit.jwd b/Projects/Rect_FixedGlass_Vertical&HorizontalSplit.jwd new file mode 100644 index 0000000..1676710 --- /dev/null +++ b/Projects/Rect_FixedGlass_Vertical&HorizontalSplit.jwd @@ -0,0 +1,79 @@ +{ + "Area1": { + "Area1": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 0 + }, + "Area2": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 0 + }, + "AreaType": 4, + "Split": [ { + "CurveType": 256, + "ptEnd": [ 900.0, 750.0, 0.0 ], + "ptStart": [ 0.0, 750.0, 0.0 ] + } ] + }, + "Area2": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 0 + }, + "Area2": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 0 + }, + "AreaType": 4, + "Split": [ { + "CurveType": 256, + "ptEnd": [ 1800.0, 750.0, 0.0 ], + "ptStart": [ 900.0, 750.0, 0.0 ] + } ] + }, + "AreaType": 1, + "BottomRail": 1, + "Joint": { + "JointBL": 2, + "JointBR": 2, + "JointTL": 2, + "JointTR": 2 + }, + "Outline": [ { + "CurveType": 256, + "ptEnd": [ 1800.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 0.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 1800.0, 1500.0, 0.0 ], + "ptStart": [ 1800.0, 0.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 0.0, 1500.0, 0.0 ], + "ptStart": [ 1800.0, 1500.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 0.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 1500.0, 0.0 ] + } ], + "Split": [ { + "CurveType": 256, + "ptEnd": [ 900.0, 1500.0, 0.0 ], + "ptStart": [ 900.0, 0.0, 0.0 ] + } ] + }, + "ProfilePath": "c:\\EgtData\\Window\\Profiles\\Profilo78 - Offset.nge" +} \ No newline at end of file diff --git a/Projects/Rect_Sash.jwd b/Projects/Rect_Sash.jwd new file mode 100644 index 0000000..223c4f1 --- /dev/null +++ b/Projects/Rect_Sash.jwd @@ -0,0 +1,42 @@ +{ + "Area1": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 2, + "Joint": { + "JointBL": 3, + "JointBR": 3, + "JointTL": 3, + "JointTR": 3 + } + }, + "AreaType": 1, + "Joint": { + "JointBL": 2, + "JointBR": 2, + "JointTL": 2, + "JointTR": 2 + }, + "Outline": [ { + "CurveType": 256, + "ptEnd": [ 1800.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 0.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 1800.0, 1500.0, 0.0 ], + "ptStart": [ 1800.0, 0.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 0.0, 1500.0, 0.0 ], + "ptStart": [ 1800.0, 1500.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 0.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 1500.0, 0.0 ] + } ] + }, + "ProfilePath": "c:\\EgtData\\Window\\Profiles\\Profilo78 - Offset.nge" +} \ No newline at end of file diff --git a/Projects/Rect_Sash_Vertical&HorizontalSplit.jwd b/Projects/Rect_Sash_Vertical&HorizontalSplit.jwd new file mode 100644 index 0000000..defd60e --- /dev/null +++ b/Projects/Rect_Sash_Vertical&HorizontalSplit.jwd @@ -0,0 +1,87 @@ +{ + "Area1": { + "Area1": { + "Area1": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 0 + }, + "Area2": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 0 + }, + "AreaType": 4, + "Split": [ { + "CurveType": 256, + "ptEnd": [ 900.0, 750.0, 0.0 ], + "ptStart": [ 0.0, 750.0, 0.0 ] + } ] + }, + "Area2": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 0 + }, + "Area2": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 0 + }, + "AreaType": 4, + "Split": [ { + "CurveType": 256, + "ptEnd": [ 1800.0, 750.0, 0.0 ], + "ptStart": [ 900.0, 750.0, 0.0 ] + } ] + }, + "AreaType": 2, + "Joint": { + "JointBL": 3, + "JointBR": 3, + "JointTL": 3, + "JointTR": 3 + }, + "Split": [ { + "CurveType": 256, + "ptEnd": [ 900.0, 1500.0, 0.0 ], + "ptStart": [ 900.0, 0.0, 0.0 ] + } ] + }, + "AreaType": 1, + "Joint": { + "JointBL": 2, + "JointBR": 2, + "JointTL": 2, + "JointTR": 2 + }, + "Outline": [ { + "CurveType": 256, + "ptEnd": [ 1800.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 0.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 1800.0, 1500.0, 0.0 ], + "ptStart": [ 1800.0, 0.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 0.0, 1500.0, 0.0 ], + "ptStart": [ 1800.0, 1500.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 0.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 1500.0, 0.0 ] + } ] + }, + "ProfilePath": "c:\\EgtData\\Window\\Profiles\\Profilo78 - Offset.nge" +} \ No newline at end of file diff --git a/Projects/Rect_SixSash_Vertical&HorizontalMullion.jwd b/Projects/Rect_SixSash_Vertical&HorizontalMullion.jwd new file mode 100644 index 0000000..2ea0a2c --- /dev/null +++ b/Projects/Rect_SixSash_Vertical&HorizontalMullion.jwd @@ -0,0 +1,162 @@ +{ + "Area1": { + "Area1": { + "Area1": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 2, + "Joint": { + "JointBL": 3, + "JointBR": 3, + "JointTL": 3, + "JointTR": 3 + } + }, + "AreaType": 0 + }, + "Area2": { + "Area1": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 2, + "Joint": { + "JointBL": 3, + "JointBR": 3, + "JointTL": 3, + "JointTR": 3 + } + }, + "AreaType": 0 + }, + "Area2": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 2, + "Joint": { + "JointBL": 3, + "JointBR": 3, + "JointTL": 3, + "JointTR": 3 + } + }, + "AreaType": 0 + }, + "AreaType": 4, + "Split": [ { + "CurveType": 256, + "ptEnd": [ 1200.0, 750.0, 0.0 ], + "ptStart": [ 1200.0, 0.0, 0.0 ] + } ] + }, + "AreaType": 4, + "Split": [ { + "CurveType": 256, + "ptEnd": [ 600.0, 750.0, 0.0 ], + "ptStart": [ 600.0, 0.0, 0.0 ] + } ] + }, + "Area2": { + "Area1": { + "Area1": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 2, + "Joint": { + "JointBL": 3, + "JointBR": 3, + "JointTL": 3, + "JointTR": 3 + } + }, + "AreaType": 0 + }, + "Area2": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 2, + "Joint": { + "JointBL": 3, + "JointBR": 3, + "JointTL": 3, + "JointTR": 3 + } + }, + "AreaType": 0 + }, + "AreaType": 4, + "Split": [ { + "CurveType": 256, + "ptEnd": [ 1200.0, 1500.0, 0.0 ], + "ptStart": [ 1200.0, 750.0, 0.0 ] + } ] + }, + "Area2": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 2, + "Joint": { + "JointBL": 3, + "JointBR": 3, + "JointTL": 3, + "JointTR": 3 + } + }, + "AreaType": 0 + }, + "AreaType": 4, + "Split": [ { + "CurveType": 256, + "ptEnd": [ 600.0, 1500.0, 0.0 ], + "ptStart": [ 600.0, 750.0, 0.0 ] + } ] + }, + "AreaType": 1, + "Joint": { + "JointBL": 2, + "JointBR": 2, + "JointTL": 2, + "JointTR": 2 + }, + "Outline": [ { + "CurveType": 256, + "ptEnd": [ 1800.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 0.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 1800.0, 1500.0, 0.0 ], + "ptStart": [ 1800.0, 0.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 0.0, 1500.0, 0.0 ], + "ptStart": [ 1800.0, 1500.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 0.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 1500.0, 0.0 ] + } ], + "Split": [ { + "CurveType": 256, + "ptEnd": [ 1800.0, 750.0, 0.0 ], + "ptStart": [ 0.0, 750.0, 0.0 ] + } ] + }, + "ProfilePath": "c:\\EgtData\\Window\\Profiles\\Profilo78 - Offset.nge" +} \ No newline at end of file diff --git a/Projects/Rect_TripleVerticalSash_Mullion&French.jwd b/Projects/Rect_TripleVerticalSash_Mullion&French.jwd new file mode 100644 index 0000000..6b84116 --- /dev/null +++ b/Projects/Rect_TripleVerticalSash_Mullion&French.jwd @@ -0,0 +1,92 @@ +{ + "Area1": { + "Area1": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 2, + "Joint": { + "JointBL": 3, + "JointBR": 3, + "JointTL": 3, + "JointTR": 3 + } + }, + "AreaType": 0 + }, + "Area2": { + "Area1": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 2, + "Joint": { + "JointBL": 3, + "JointBR": 3, + "JointTL": 3, + "JointTR": 3 + }, + "SashType": 2 + }, + "AreaType": 0 + }, + "Area2": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 2, + "Joint": { + "JointBL": 3, + "JointBR": 3, + "JointTL": 3, + "JointTR": 3 + }, + "SashType": 1 + }, + "AreaType": 0 + }, + "AreaType": 4, + "Split": [ { + "CurveType": 256, + "ptEnd": [ 1200.0, 1500.0, 0.0 ], + "ptStart": [ 1200.0, 0.0, 0.0 ] + } ] + }, + "AreaType": 1, + "Joint": { + "JointBL": 2, + "JointBR": 2, + "JointTL": 2, + "JointTR": 2 + }, + "Outline": [ { + "CurveType": 256, + "ptEnd": [ 1800.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 0.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 1800.0, 1500.0, 0.0 ], + "ptStart": [ 1800.0, 0.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 0.0, 1500.0, 0.0 ], + "ptStart": [ 1800.0, 1500.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 0.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 1500.0, 0.0 ] + } ], + "Split": [ { + "CurveType": 256, + "ptEnd": [ 600.0, 1500.0, 0.0 ], + "ptStart": [ 600.0, 0.0, 0.0 ] + } ] + }, + "ProfilePath": "c:\\EgtData\\Window\\Profiles\\Profilo78 - Offset.nge" +} \ No newline at end of file diff --git a/Projects/Rect_TripleVerticalSash_Mullion.jwd b/Projects/Rect_TripleVerticalSash_Mullion.jwd new file mode 100644 index 0000000..2d8cd7f --- /dev/null +++ b/Projects/Rect_TripleVerticalSash_Mullion.jwd @@ -0,0 +1,90 @@ +{ + "Area1": { + "Area1": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 2, + "Joint": { + "JointBL": 3, + "JointBR": 3, + "JointTL": 3, + "JointTR": 3 + } + }, + "AreaType": 0 + }, + "Area2": { + "Area1": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 2, + "Joint": { + "JointBL": 3, + "JointBR": 3, + "JointTL": 3, + "JointTR": 3 + } + }, + "AreaType": 0 + }, + "Area2": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 2, + "Joint": { + "JointBL": 3, + "JointBR": 3, + "JointTL": 3, + "JointTR": 3 + } + }, + "AreaType": 0 + }, + "AreaType": 4, + "Split": [ { + "CurveType": 256, + "ptEnd": [ 1200.0, 1500.0, 0.0 ], + "ptStart": [ 1200.0, 0.0, 0.0 ] + } ] + }, + "AreaType": 1, + "Joint": { + "JointBL": 2, + "JointBR": 2, + "JointTL": 2, + "JointTR": 2 + }, + "Outline": [ { + "CurveType": 256, + "ptEnd": [ 1800.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 0.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 1800.0, 1500.0, 0.0 ], + "ptStart": [ 1800.0, 0.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 0.0, 1500.0, 0.0 ], + "ptStart": [ 1800.0, 1500.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 0.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 1500.0, 0.0 ] + } ], + "Split": [ { + "CurveType": 256, + "ptEnd": [ 600.0, 1500.0, 0.0 ], + "ptStart": [ 600.0, 0.0, 0.0 ] + } ] + }, + "ProfilePath": "c:\\EgtData\\Window\\Profiles\\Profilo78 - Offset.nge" +} \ No newline at end of file diff --git a/Projects/RoundArc_DoubleVerticalSash.jwd b/Projects/RoundArc_DoubleVerticalSash.jwd new file mode 100644 index 0000000..cb57554 --- /dev/null +++ b/Projects/RoundArc_DoubleVerticalSash.jwd @@ -0,0 +1,67 @@ +{ + "Area1": { + "Area1": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 2, + "Joint": { + "JointBL": 3, + "JointBR": 3, + "JointTL": 3, + "JointTR": 3 + } + }, + "AreaType": 0 + }, + "Area2": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 2, + "Joint": { + "JointBL": 3, + "JointBR": 3, + "JointTL": 3, + "JointTR": 3 + } + }, + "AreaType": 0 + }, + "AreaType": 1, + "Joint": { + "JointBL": 2, + "JointBR": 2, + "JointTL": 2, + "JointTR": 2 + }, + "Outline": [ { + "CurveType": 256, + "ptEnd": [ 1800.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 0.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 1800.0, 1500.0, 0.0 ], + "ptStart": [ 1800.0, 0.0, 0.0 ] + }, { + "CurveType": 257, + "ptEnd": [ 0.0, 1500.0, 0.0 ], + "ptMid": [ 900.0, 2400.0, 0.0 ], + "ptStart": [ 1800.0, 1500.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 0.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 1500.0, 0.0 ] + } ], + "Split": [ { + "CurveType": 256, + "ptEnd": [ 900.0, 2400.0, 0.0 ], + "ptStart": [ 900.0, 0.0, 0.0 ] + } ] + }, + "ProfilePath": "c:\\EgtData\\Window\\Profiles\\Profilo78 - Offset.nge" +} \ No newline at end of file diff --git a/Projects/RoundArc_FixedGlass_Vertical&HorizontalSplit.jwd b/Projects/RoundArc_FixedGlass_Vertical&HorizontalSplit.jwd new file mode 100644 index 0000000..57809e9 --- /dev/null +++ b/Projects/RoundArc_FixedGlass_Vertical&HorizontalSplit.jwd @@ -0,0 +1,80 @@ +{ + "Area1": { + "Area1": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 0 + }, + "Area2": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 0 + }, + "AreaType": 4, + "Split": [ { + "CurveType": 256, + "ptEnd": [ 900.0, 750.0, 0.0 ], + "ptStart": [ 0.0, 750.0, 0.0 ] + } ] + }, + "Area2": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 0 + }, + "Area2": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 0 + }, + "AreaType": 4, + "Split": [ { + "CurveType": 256, + "ptEnd": [ 1800.0, 750.0, 0.0 ], + "ptStart": [ 900.0, 750.0, 0.0 ] + } ] + }, + "AreaType": 1, + "BottomRail": 1, + "Joint": { + "JointBL": 2, + "JointBR": 2, + "JointTL": 2, + "JointTR": 2 + }, + "Outline": [ { + "CurveType": 256, + "ptEnd": [ 1800.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 0.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 1800.0, 1500.0, 0.0 ], + "ptStart": [ 1800.0, 0.0, 0.0 ] + }, { + "CurveType": 257, + "ptEnd": [ 0.0, 1500.0, 0.0 ], + "ptMid": [ 900.0, 2400.0, 0.0 ], + "ptStart": [ 1800.0, 1500.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 0.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 1500.0, 0.0 ] + } ], + "Split": [ { + "CurveType": 256, + "ptEnd": [ 900.0, 2400.0, 0.0 ], + "ptStart": [ 900.0, 0.0, 0.0 ] + } ] + }, + "ProfilePath": "c:\\EgtData\\Window\\Profiles\\Profilo78 - Offset.nge" +} \ No newline at end of file diff --git a/Projects/RoundArc_French.jwd b/Projects/RoundArc_French.jwd new file mode 100644 index 0000000..fb002f3 --- /dev/null +++ b/Projects/RoundArc_French.jwd @@ -0,0 +1,69 @@ +{ + "Area1": { + "Area1": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 2, + "Joint": { + "JointBL": 3, + "JointBR": 3, + "JointTL": 3, + "JointTR": 3 + }, + "SashType": 2 + }, + "AreaType": 0 + }, + "Area2": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 2, + "Joint": { + "JointBL": 3, + "JointBR": 3, + "JointTL": 3, + "JointTR": 3 + }, + "SashType": 1 + }, + "AreaType": 0 + }, + "AreaType": 1, + "Joint": { + "JointBL": 2, + "JointBR": 2, + "JointTL": 2, + "JointTR": 2 + }, + "Outline": [ { + "CurveType": 256, + "ptEnd": [ 1800.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 0.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 1800.0, 1500.0, 0.0 ], + "ptStart": [ 1800.0, 0.0, 0.0 ] + }, { + "CurveType": 257, + "ptEnd": [ 0.0, 1500.0, 0.0 ], + "ptMid": [ 900.0, 2400.0, 0.0 ], + "ptStart": [ 1800.0, 1500.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 0.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 1500.0, 0.0 ] + } ], + "Split": [ { + "CurveType": 256, + "ptEnd": [ 900.0, 2400.0, 0.0 ], + "ptStart": [ 900.0, 0.0, 0.0 ] + } ] + }, + "ProfilePath": "c:\\EgtData\\Window\\Profiles\\Profilo78 - Offset.nge" +} \ No newline at end of file diff --git a/Projects/RoundArc_Sash.jwd b/Projects/RoundArc_Sash.jwd new file mode 100644 index 0000000..16c921c --- /dev/null +++ b/Projects/RoundArc_Sash.jwd @@ -0,0 +1,43 @@ +{ + "Area1": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 2, + "Joint": { + "JointBL": 3, + "JointBR": 3, + "JointTL": 3, + "JointTR": 3 + } + }, + "AreaType": 1, + "Joint": { + "JointBL": 2, + "JointBR": 2, + "JointTL": 2, + "JointTR": 2 + }, + "Outline": [ { + "CurveType": 256, + "ptEnd": [ 1800.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 0.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 1800.0, 1500.0, 0.0 ], + "ptStart": [ 1800.0, 0.0, 0.0 ] + }, { + "CurveType": 257, + "ptEnd": [ 0.0, 1500.0, 0.0 ], + "ptMid": [ 900.0, 2400.0, 0.0 ], + "ptStart": [ 1800.0, 1500.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 0.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 1500.0, 0.0 ] + } ] + }, + "ProfilePath": "c:\\EgtData\\Window\\Profiles\\Profilo78 - Offset.nge" +} \ No newline at end of file diff --git a/Projects/RoundArc_Sash_Vertical&HorizontalSplit.jwd b/Projects/RoundArc_Sash_Vertical&HorizontalSplit.jwd new file mode 100644 index 0000000..4265218 --- /dev/null +++ b/Projects/RoundArc_Sash_Vertical&HorizontalSplit.jwd @@ -0,0 +1,88 @@ +{ + "Area1": { + "Area1": { + "Area1": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 0 + }, + "Area2": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 0 + }, + "AreaType": 4, + "Split": [ { + "CurveType": 256, + "ptEnd": [ 900.0, 750.0, 0.0 ], + "ptStart": [ 0.0, 750.0, 0.0 ] + } ] + }, + "Area2": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 0 + }, + "Area2": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 0 + }, + "AreaType": 4, + "Split": [ { + "CurveType": 256, + "ptEnd": [ 1800.0, 750.0, 0.0 ], + "ptStart": [ 900.0, 750.0, 0.0 ] + } ] + }, + "AreaType": 2, + "Joint": { + "JointBL": 3, + "JointBR": 3, + "JointTL": 3, + "JointTR": 3 + }, + "Split": [ { + "CurveType": 256, + "ptEnd": [ 900.0, 2400.0, 0.0 ], + "ptStart": [ 900.0, 0.0, 0.0 ] + } ] + }, + "AreaType": 1, + "Joint": { + "JointBL": 2, + "JointBR": 2, + "JointTL": 2, + "JointTR": 2 + }, + "Outline": [ { + "CurveType": 256, + "ptEnd": [ 1800.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 0.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 1800.0, 1500.0, 0.0 ], + "ptStart": [ 1800.0, 0.0, 0.0 ] + }, { + "CurveType": 257, + "ptEnd": [ 0.0, 1500.0, 0.0 ], + "ptMid": [ 900.0, 2400.0, 0.0 ], + "ptStart": [ 1800.0, 1500.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 0.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 1500.0, 0.0 ] + } ] + }, + "ProfilePath": "c:\\EgtData\\Window\\Profiles\\Profilo78 - Offset.nge" +} \ No newline at end of file diff --git a/Projects/RoundArc_TripleVerticalSash.jwd b/Projects/RoundArc_TripleVerticalSash.jwd new file mode 100644 index 0000000..8210ed5 --- /dev/null +++ b/Projects/RoundArc_TripleVerticalSash.jwd @@ -0,0 +1,91 @@ +{ + "Area1": { + "Area1": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 2, + "Joint": { + "JointBL": 3, + "JointBR": 3, + "JointTL": 3, + "JointTR": 3 + } + }, + "AreaType": 0 + }, + "Area2": { + "Area1": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 2, + "Joint": { + "JointBL": 3, + "JointBR": 3, + "JointTL": 3, + "JointTR": 3 + } + }, + "AreaType": 0 + }, + "Area2": { + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 2, + "Joint": { + "JointBL": 3, + "JointBR": 3, + "JointTL": 3, + "JointTR": 3 + } + }, + "AreaType": 0 + }, + "AreaType": 4, + "Split": [ { + "CurveType": 256, + "ptEnd": [ 1200.0, 2348.5281374239, 0.0 ], + "ptStart": [ 1200.0, 0.0, 0.0 ] + } ] + }, + "AreaType": 1, + "Joint": { + "JointBL": 2, + "JointBR": 2, + "JointTL": 2, + "JointTR": 2 + }, + "Outline": [ { + "CurveType": 256, + "ptEnd": [ 1800.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 0.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 1800.0, 1500.0, 0.0 ], + "ptStart": [ 1800.0, 0.0, 0.0 ] + }, { + "CurveType": 257, + "ptEnd": [ 0.0, 1500.0, 0.0 ], + "ptMid": [ 900.0, 2400.0, 0.0 ], + "ptStart": [ 1800.0, 1500.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 0.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 1500.0, 0.0 ] + } ], + "Split": [ { + "CurveType": 256, + "ptEnd": [ 600.0, 2348.5281374239, 0.0 ], + "ptStart": [ 600.0, 0.0, 0.0 ] + } ] + }, + "ProfilePath": "c:\\EgtData\\Window\\Profiles\\Profilo78 - Offset.nge" +} \ No newline at end of file diff --git a/Test/Data/Rect_FixedGlass.jwd b/Test/Data/Rect_FixedGlass.jwd new file mode 100644 index 0000000..3b6ca4f --- /dev/null +++ b/Test/Data/Rect_FixedGlass.jwd @@ -0,0 +1,34 @@ +{ + "Area1": { + "Area1": { + "AreaType": 3, + "FillType": 1 + }, + "AreaType": 1, + "BottomRail": 1, + "Joint": { + "JointBL": 2, + "JointBR": 2, + "JointTL": 2, + "JointTR": 2 + }, + "Outline": [ { + "CurveType": 256, + "ptEnd": [ 1800.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 0.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 1800.0, 1500.0, 0.0 ], + "ptStart": [ 1800.0, 0.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 0.0, 1500.0, 0.0 ], + "ptStart": [ 1800.0, 1500.0, 0.0 ] + }, { + "CurveType": 256, + "ptEnd": [ 0.0, 0.0, 0.0 ], + "ptStart": [ 0.0, 1500.0, 0.0 ] + } ] + }, + "ProfilePath": "c:\\EgtData\\Window\\Profiles\\Profilo78 - Offset.nge" +} \ No newline at end of file diff --git a/Test/Result.ok/Rect_FixedGlass.nge b/Test/Result.ok/Rect_FixedGlass.nge new file mode 100644 index 0000000..8676ea2 Binary files /dev/null and b/Test/Result.ok/Rect_FixedGlass.nge differ