From bca16579ea6a33cea7413021cd4a95d066d9b144 Mon Sep 17 00:00:00 2001 From: SaraP Date: Mon, 12 May 2025 14:42:33 +0200 Subject: [PATCH] DataWindow : - sistemata lettura per file jwd generati dal programma - eliminata scrittura e salvataggio file ( fatti solo da programma). --- Designing/WinJWDConst.lua | 42 +- Designing/WinLib/WinManageProject.lua | 434 ++++++++++--------- Designing/WinOpenProjectFile.lua | 15 +- Designing/WinSaveProjectFile.lua | 589 -------------------------- 4 files changed, 253 insertions(+), 827 deletions(-) delete mode 100644 Designing/WinSaveProjectFile.lua diff --git a/Designing/WinJWDConst.lua b/Designing/WinJWDConst.lua index 7cc883f..fa36e97 100644 --- a/Designing/WinJWDConst.lua +++ b/Designing/WinJWDConst.lua @@ -17,37 +17,27 @@ 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_LIST = 'AreaList' JWD_AREA_TYPE = 'AreaType' +JWD_JOINTS = 'JointList' +JWD_JOINT_TYPE = 'JointType' +JWD_BOTTOMRAIL = 'BottomRail' +JWD_BOTTOMRAIL_QTY = 'BottomRailQty' +JWD_DIMENSION = 'dDimension' +JWD_VALUE = 'dValue' -JWD_JOINT_BL = 'JointBL' -JWD_JOINT_BR = 'JointBR' -JWD_JOINT_TL = 'JointTL' -JWD_JOINT_TR = 'JointTR' +JWD_FRAME_SHAPE = 'Shape' +JWD_DIMENSION_LIST = 'DimensionList' -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_LIST = 'SashList' +JWD_HAS_HANDLE = 'bHasHandle' +JWD_OPENING_TYPE = 'OpeningType' +JWD_HARDWARE = 'Hardware' + +JWD_SPLIT_TYPE = 'SplitShape' +JWD_SPLIT_POS = 'SplitPositionList' -JWD_SASH_TYPE = 'SashType' JWD_FILL_TYPE = 'FillType' --------------------------------------------------------------------- diff --git a/Designing/WinLib/WinManageProject.lua b/Designing/WinLib/WinManageProject.lua index f7e45ce..7848382 100644 --- a/Designing/WinLib/WinManageProject.lua +++ b/Designing/WinLib/WinManageProject.lua @@ -27,225 +27,248 @@ 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} +--------------------------------------------------------------------- +local function GetJoints( tJoints) + local vJoints = {} + for i = 1, #tJoints do + if tJoints[i][JWD_JOINT_TYPE] == 'FULL_H' then + vJoints[i] = WIN_JNT.FULL_H + elseif tJoints[i][JWD_JOINT_TYPE] == 'FULL_V' then + vJoints[i] = WIN_JNT.FULL_V + elseif tJoints[i][JWD_JOINT_TYPE] == 'ANGLED' then + vJoints[i] = WIN_JNT.ANGLED + end end + return vJoints 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 +--------------------------------------------------------------------- +local function GetFrameShape( sShape) + + if sShape == 'RECTANGLE' then + return WIN_FRAME_TYPES.RECT + elseif sShape == 'RIGHTCHAMFER' or sShape == 'LEFTCHAMFER' then + return WIN_FRAME_TYPES.CHAMFER_SIDE + elseif sShape == 'DOUBLECHAMFER' then + return WIN_FRAME_TYPES.CHAMFER + elseif sShape == 'ARC_FULL' then + return WIN_FRAME_TYPES.ROUND_ARC + elseif sShape == 'ARC' then + return WIN_FRAME_TYPES.SEGMENTAL_ARC + elseif sShape == 'DOUBLEARC' then + return WIN_FRAME_TYPES.POINTED_ARC + elseif sShape == 'TRIANGLE' then + return WIN_FRAME_TYPES.TRG + end + +end - elseif nAreaType == WIN_AREATYPES.SPLIT then +--------------------------------------------------------------------- +local function GetOpeningType( sOpeningType) + + if sOpeningType == 'NULL' then + return WIN_OPENING_TYPES.NULL + elseif sOpeningType == 'TURNONLY_LEFT' then + return WIN_OPENING_TYPES.TURNONLY_LEFT + elseif sOpeningType == 'TURNONLY_RIGHT' then + return WIN_OPENING_TYPES.TURNONLY_RIGHT + elseif sOpeningType == 'TILTTURN_LEFT' then + return WIN_OPENING_TYPES.TILTTURN_LEFT + elseif sOpeningType == 'TILTTURN_RIGHT' then + return WIN_OPENING_TYPES.TILTTURN_RIGHT + elseif sOpeningType == 'TILTONLY_TOP' then + return WIN_OPENING_TYPES.TILTONLY_TOP + elseif sOpeningType == 'TILTONLY_BOTTOM' then + return WIN_OPENING_TYPES.TILTONLY_BOTTOM + elseif sOpeningType == 'PIVOT' then + return WIN_OPENING_TYPES.PIVOT + elseif sOpeningType == 'FIXED' then + return WIN_OPENING_TYPES.FIXED + elseif sOpeningType == 'COPLANARSLIDE_LEFT' then + return WIN_OPENING_TYPES.COPLANARSLIDE_LEFT + elseif sOpeningType == 'COPLANARSLIDE_RIGHT' then + return WIN_OPENING_TYPES.COPLANARSLIDE_RIGHT + elseif sOpeningType == 'LIFTSLIDE_LEFT' then + return WIN_OPENING_TYPES.LIFTSLIDE_LEFT + elseif sOpeningType == 'LIFTSLIDE_RIGHT' then + return WIN_OPENING_TYPES.LIFTSLIDE_RIGHT + end + +end +--------------------------------------------------------------------- +-- funzione che ricava la tipologia dell'anta in base al tipo di apertura e alla struttura +local function GetSashTypes( tSashes, vOpeningTypes) + + -- alzante scorrevole + local bSlideWindow = ( vOpeningTypes[1] == WIN_OPENING_TYPES.FIXED or vOpeningTypes[1] == WIN_OPENING_TYPES.COPLANARSLIDE_RIGHT or vOpeningTypes[1] == WIN_OPENING_TYPES.LIFTSLIDE_RIGHT) + if bSlideWindow then + if #tSashes == 2 then + if vOpeningTypes[1] == WIN_OPENING_TYPES.FIXED then + return { WIN_SASHTYPES.SLIDE_FIXED, WIN_SASHTYPES.SLIDE_MOVABLE} + elseif vOpeningTypes[2] == WIN_OPENING_TYPES.FIXED then + return { WIN_SASHTYPES.SLIDE_MOVABLE, WIN_SASHTYPES.SLIDE_FIXED} + else + -- TODO individuare parametro per disinguerle + return { WIN_SASHTYPES.SLIDE_MOVABLE, WIN_SASHTYPES.SLIDE_MOVABLE_BACK} + end + else + if vOpeningTypes[1] == WIN_OPENING_TYPES.FIXED then + return { WIN_SASHTYPES.SLIDE_FIXED, WIN_SASHTYPES.SLIDE_MOVABLE, WIN_SASHTYPES.SLIDE_MOVABLE, WIN_SASHTYPES.SLIDE_FIXED} + elseif vOpeningTypes[2] == WIN_OPENING_TYPES.FIXED then + return { WIN_SASHTYPES.SLIDE_MOVABLE, WIN_SASHTYPES.SLIDE_FIXED, WIN_SASHTYPES.SLIDE_MOVABLE} + else + return { WIN_SASHTYPES.SLIDE_MOVABLE_BACK, WIN_SASHTYPES.SLIDE_MOVABLE, WIN_SASHTYPES.SLIDE_MOVABLE, WIN_SASHTYPES.SLIDE_MOVABLE_BACK} + end + end + end + + -- casi standard + if #tSashes == 2 then + if tSashes[1][JWD_HAS_HANDLE] then + return { WIN_SASHTYPES.ACTIVE, WIN_SASHTYPES.INACTIVE} + else + return { WIN_SASHTYPES.INACTIVE, WIN_SASHTYPES.ACTIVE} + end - 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_AREA .. '*') - 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_AREA .. '*') - 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) + elseif #tSashes == 3 then + if tSashes[1][JWD_HAS_HANDLE] then + return { WIN_SASHTYPES.ACTIVE, WIN_SASHTYPES.INACTIVE_IN, WIN_SASHTYPES.INACTIVE_OUT} + elseif tSashes[2][JWD_HAS_HANDLE] then + if vOpeningTypes[2] == WIN_OPENING_TYPES.TURNONLY_LEFT or vOpeningTypes[2] == WIN_OPENING_TYPES.TILTTURN_LEFT then + return { WIN_SASHTYPES.ACTIVE_OUT, WIN_SASHTYPES.ACTIVE_IN, WIN_SASHTYPES.INACTIVE} + else + return { WIN_SASHTYPES.INACTIVE, WIN_SASHTYPES.ACTIVE_IN, WIN_SASHTYPES.ACTIVE_OUT} + end + else + return { WIN_SASHTYPES.INACTIVE_OUT, WIN_SASHTYPES.INACTIVE_IN, WIN_SASHTYPES.ACTIVE} end - local nFrameBottomId = EgtGetFirstInGroup(nDrawFrameLayerId) - EgtSetName( nFrameBottomId, WIN_BOTTOM) - local nFrameRightId = EgtGetNext(nFrameBottomId) - EgtSetName( nFrameRightId, WIN_RIGHT) - local nFrameTopId = EgtGetNext(nFrameRightId) - EgtSetName( nFrameTopId, WIN_TOP) - local nFrameLeftId = EgtGetNext(nFrameTopId) - EgtSetName( nFrameLeftId, WIN_LEFT) - -- creo frame - nAreaId = WinCreate.CreateGenFrame( {nFrameBottomId, nFrameRightId, nFrameTopId, nFrameLeftId}, {AreaTable[JWD_JOINT][JWD_JOINT_BL], AreaTable[JWD_JOINT][JWD_JOINT_BR], AreaTable[JWD_JOINT][JWD_JOINT_TR], AreaTable[JWD_JOINT][JWD_JOINT_TL]}) - -- 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), AreaTable["SplitType"]) - -- local nArea1Id, nArea2Id = WinCreate.AddGenSplit( nAreaId, EgtGetFirstInGroup(nDrawFrameLayerId)) - 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 + if tSashes[2][JWD_HAS_HANDLE] then + return { WIN_SASHTYPES.ACTIVE_OUT, WIN_SASHTYPES.ACTIVE_IN, WIN_SASHTYPES.INACTIVE_IN, WIN_SASHTYPES.INACTIVE_OUT} + else + return { WIN_SASHTYPES.INACTIVE_OUT, WIN_SASHTYPES.INACTIVE_IN, WIN_SASHTYPES.ACTIVE_IN, WIN_SASHTYPES.ACTIVE_OUT} 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 - if not WinCreate.ImportProfile( WinTable[JWD_PROFILE_PATH]) then - return false - end - -- creo aree - ConvertTableToGeometry( WinTable[JWD_AREA .. 1], GDB_ID.ROOT) - return true -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') +--------------------------------------------------------------------- +-- funzione ricorsiva che legge le aree in tabella e crea le geometrie +local function ConvertTableToGeometry( AreaTable, nParentId) + + if not AreaTable then return end - DestFh:write( sData) - DestFh:close() + + -- TELAIO + if AreaTable[JWD_AREA_TYPE] == 'FRAME' then + + -- recupero i dati del telaio ( forma, giunzioni, dimensioni) + local nType = GetFrameShape( AreaTable[JWD_FRAME_SHAPE]) + local vJoints = GetJoints( AreaTable[JWD_JOINTS]) + local vDim = {} + local tDimensions = AreaTable[JWD_DIMENSION_LIST] + for i = 1, #tDimensions do + vDim[i] = tDimensions[i][JWD_VALUE] + end + + -- creo il telaio + local nAreaId = WinCreate.CreateFrame( nType, vJoints, vDim[1], vDim[2], vDim[3]) + + -- verifico presenza bottomrail + if AreaTable[JWD_BOTTOMRAIL] then + WinCreate.AddBottomRail( nAreaId, AreaTable[JWD_BOTTOMRAIL_QTY]) + end + + -- analizzo sottoaree + if AreaTable[JWD_AREA_LIST] then + ConvertTableToGeometry( AreaTable[JWD_AREA_LIST][1], nAreaId) + end + + + -- ANTA + elseif AreaTable[JWD_AREA_TYPE] == 'SASH' then + + -- recupero dati + local tSashes = AreaTable[JWD_SASH_LIST] + local vJoints = GetJoints( AreaTable[JWD_JOINTS]) + local nBottomRailNbr = 0 + if AreaTable[JWD_BOTTOMRAIL] then + nBottomRailNbr = AreaTable[JWD_BOTTOMRAIL_QTY] + end + + -- anta singola + if #tSashes == 1 then + local nAreaId = WinCreate.AddSash( nParentId, vJoints, WIN_SASHTYPES.NULL, GetOpeningType( tSashes[1][JWD_OPENING_TYPE])) + -- aggiungo ferramenta sull'anta + WinCreate.AddHardware( nAreaId, AreaTable[JWD_HARDWARE]) + -- bottomrail + WinCreate.AddBottomRail( nAreaId, nBottomRailNbr) + -- analizzo sottaree + ConvertTableToGeometry( AreaTable[JWD_AREA_LIST][1], nAreaId) + + -- ante multiple + else + -- aggiungo la ferramenta sull'area parent + WinCreate.AddHardware( nParentId, AreaTable[JWD_HARDWARE]) + + -- recupero dati delle ante + local vDimensions = {} + local vOpeningTypes = {} + for i = 1, #tSashes do + vDimensions[i] = tSashes[i][JWD_DIMENSION] / 100 + vOpeningTypes[i] = GetOpeningType( tSashes[i][JWD_OPENING_TYPE]) + end + table.remove( vDimensions) + local vSashTypes = GetSashTypes( tSashes, vOpeningTypes) + + -- aggiungo gli split + local vSplitAreas = WinCreate.AddSplits( nParentId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, vDimensions, 1, WIN_SPLITTYPES.FRENCH) + + -- aggiungo le ante + for i = 1, #vSplitAreas do + local nAreaId = WinCreate.AddSash( vSplitAreas[i], vJoints, vSashTypes[i], vOpeningTypes[i]) + -- bottomrail + WinCreate.AddBottomRail( nAreaId, nBottomRailNbr) + -- analizzo sottaree + ConvertTableToGeometry( AreaTable[JWD_AREA_LIST][i], nAreaId) + end + end + + + -- FILL + elseif AreaTable[JWD_AREA_TYPE] == 'FILL' then + local nFillType = EgtIf( AreaTable[JWD_FILL_TYPE] == 'GLASS', WIN_FILLTYPES.GLASS, WIN_FILLTYPES.WOOD) + WinCreate.AddFill( nParentId, nFillType) + + + -- SPLIT + elseif AreaTable[JWD_AREA_TYPE] == 'SPLIT' then + local nSplitDir = EgtIf( AreaTable[JWD_SPLIT_TYPE] == 'VERTICAL', WIN_SPLITORIENTATION.VERTICAL, WIN_SPLITORIENTATION.HORIZONTAL) + local vDimensions = {} + local vSplitDimensions = AreaTable[JWD_SPLIT_POS] + for i = 1, #vSplitDimensions - 1 do + vDimensions[i] = vSplitDimensions[i][JWD_DIMENSION] / 100 + end + local vSplitAreas = WinCreate.AddSplits( nParentId, nSplitDir, WIN_MEASURE.PERCENTAGE, vDimensions, 1) + for i = 1, #vSplitAreas do + ConvertTableToGeometry( AreaTable[JWD_AREA_LIST][i], vSplitAreas[i]) + end + + + -- NULL + elseif AreaTable[JWD_AREA_TYPE] == 'SPLITTED' then + if AreaTable[JWD_AREA_LIST] then + ConvertTableToGeometry( AreaTable[JWD_AREA_LIST][1], nParentId) + end + end end +--------------------------------------------------------------------- -- funzione che dato un file in json ne crea il progetto gerarchico -function WinManageProject.ReadFromFile( sFilePath) +function WinManageProject.ReadFromFile( sFilePath, sProfileDir) + -- leggo il file local SouFh = io.open( sFilePath, "rb") if not SouFh then EgtOutBox( 'Error opening ' .. sFilePath, 'ReadFromFile', 'ERROR') @@ -254,9 +277,16 @@ function WinManageProject.ReadFromFile( sFilePath) local content = SouFh:read( "*all") SouFh:close() local tData = JSON:decode( content) - if not WinManageProject.CreateGeomFromTable( tData) then + + -- importo il profilo + local sProfilePath = sProfileDir .. '\\' .. tData[JWD_PROFILE_PATH] .. '.nge' + if not WinCreate.ImportProfile( sProfilePath) then return false end + + -- creo le aree + ConvertTableToGeometry( tData[JWD_AREA_LIST][1], GDB_ID.ROOT) + return true end diff --git a/Designing/WinOpenProjectFile.lua b/Designing/WinOpenProjectFile.lua index bdc5835..d2a296b 100644 --- a/Designing/WinOpenProjectFile.lua +++ b/Designing/WinOpenProjectFile.lua @@ -16,7 +16,6 @@ require( 'EgtBase') _ENV = EgtProtectGlobal() EgtEnableDebug( false) ---EgtEnableDebug( false) -- Imposto direttorio per librerie local sBaseDir = EgtGetSourceDir() @@ -24,10 +23,6 @@ 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 @@ -39,7 +34,7 @@ if WINDOW and WINDOW.FILE then sOpenFilePath = WINDOW.FILE else -- altrimenti apro dialogo di scelta file - local sOpenDirPath = 'c:\\EgtData\\EgwWindowLua\\Projects' + local sOpenDirPath = 'c:\\EgtData\\EgtWindowMaker\\Projects' local FilePathList = EgtFindAllFiles( sOpenDirPath .. '\\*.jwd') local sDialogFile = 'CB:' for FilePathIndex = 1, #FilePathList do @@ -58,8 +53,8 @@ EgtNewFile() EgtStartCounter() ---local sFileName = 'RoundArc_FixedGlass_Vertical&HorizontalSplit.jwd' -if not WinManageProject.ReadFromFile( sOpenFilePath) then +local sProfileDir = 'C:\\EgtData\\EgtWindowMaker\\Profiles' +if not WinManageProject.ReadFromFile( sOpenFilePath, sProfileDir) then return end @@ -69,9 +64,9 @@ WinCalculate.SetCalcSolid( true) -- creo i pezzi local nFrameId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_AREA .. '*') WinCalculate.CreatePartFromArea( nFrameId) +-- WinCalculate.AddHardware( nFrameId) +-- WinCalculate.AddAccessories( nFrameId, true) --- preparo per automatismo lavorazioni --- WinCalculate.PrepareProject() -- elimino profilo se in batch per test if WINDOW and WINDOW.TEST and WINDOW.TEST == 1 then diff --git a/Designing/WinSaveProjectFile.lua b/Designing/WinSaveProjectFile.lua deleted file mode 100644 index 1ab9674..0000000 --- a/Designing/WinSaveProjectFile.lua +++ /dev/null @@ -1,589 +0,0 @@ --- --- 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( false) --- 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\\EgwWindowLua\\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 ------------------------ - ---sFileName = sFileName .. 'DoubleHorizontalSash_Mullion' --- ----- 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 ------------------------ - ---sFileName = sFileName .. 'TripleVertical&HorizontalSash_Mullion' --- ----- 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_Horizontal&VerticalSplit_Mullion' --- ----- 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, nArea22Id = WinCreate.AddSplit( nArea2Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) ---local nArea22Id, nArea23Id = WinCreate.AddSplit( nArea22Id, 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 montanti verticale e orizzontali ------------------------ - -sFileName = sFileName .. 'SixSash_Vertical&HorizontalSplit_Mullion' - --- definisco divisioni verticali -local nArea1Id, nArea2Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) -local nArea2Id, nArea3Id = WinCreate.AddSplit( nArea2Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) - --- definisco divisione orizzontali -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) -local nArea31Id, nArea32Id = WinCreate.AddSplit( nArea3Id, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight / 2) - --- 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( nArea21Id, SashJointType, SashJointType, SashJointType, SashJointType) --- aggiungo vetro -local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) - --- aggiungo quarta anta -local nSash4Id = WinCreate.AddSash( nArea22Id, SashJointType, SashJointType, SashJointType, SashJointType) --- aggiungo vetro -local nFill4Id = WinCreate.AddFill( nSash4Id, WIN_FILLTYPES.GLASS) - --- aggiungo quinta anta -local nSash5Id = WinCreate.AddSash( nArea31Id, SashJointType, SashJointType, SashJointType, SashJointType) --- aggiungo vetro -local nFill5Id = WinCreate.AddFill( nSash5Id, WIN_FILLTYPES.GLASS) - --- aggiungo sesta anta -local nSash6Id = WinCreate.AddSash( nArea32Id, 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_AREA .. '*') -WinCalculate.CreatePartFromArea( nFrameId) - --- salvo progetto su file -local sSaveDirPath = 'c:\\EgtData\\EgwWindowLua\\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)