diff --git a/.vscode/settings.json b/.vscode/settings.json index 9c290f3..91a0c32 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -102,7 +102,43 @@ "EgtOutLog", "EgtOutText", "EgtPause", - "EgtRelocate" + "EgtRelocate", + "WDG", + "EgtSplitString", + "EgtFrame", + "EgtReplaceString", + "EgtCircle", + "EgtArc2PV", + "EgtTdbSetCurrTool", + "EgtSurfTmSubtract", + "EgtSurfTmIntersect", + "GDB_IN", + "GEO", + "dist", + "EgtSetMachiningParam", + "EgtCreateMachining", + "EgtSetMachiningGeometry", + "EgtGetMachiningParam", + "EgtGetLastMachMgrError", + "EgtSetOperationMode", + "EgtApplyMachining", + "EgtSetCurrPhase", + "EgtApplyAllMachinings", + "EgtGetDebugLevel", + "EgtTdbGetCurrToolParam", + "EgtTdbGetCurrToolThDiam", + "EgtTdbGetCurrToolMaxDepth", + "EgtTdbGetCurrToolThLength", + "EgtFindToolInCurrSetup", + "EgtTdbGetFirstTool", + "EgtTdbGetNextTool", + "EgtMdbSave", + "EgtMoveRawPart", + "EgtCurveThickness", + "EgtSetCurrMachining", + "EgtCAvSetStdTool", + "EgtCAvToolPosStm", + "EgtCAvToolPosBox" ], "Lua.diagnostics.disable": [ "empty-block" diff --git a/CAMAuto/LuaLibs/FeatureData.lua b/CAMAuto/LuaLibs/FeatureData.lua new file mode 100644 index 0000000..bd39009 --- /dev/null +++ b/CAMAuto/LuaLibs/FeatureData.lua @@ -0,0 +1,77 @@ +-- FeatureData.lua by Egalware s.r.l. 2024/06/18 +-- Libreria lettura o calcolo dati e proprietà della feature + +-- Tabella per definizione modulo +local FeatureData = {} + +-- Carico i dati globali +local WinData = require( 'WinData') + +------------------------------------------------------------------------------------------------------------- +-- Recupero dati foro +function FeatureData.GetDrillingData( Proc) + local bOk, ptCentre, vtDir, dRadius = EgtCurveIsACircle( Proc.id) + + vtDir = EgtCurveExtrusion( Proc.id) + local Frame = EgtGetGlobFrame( Proc.id) + -- trasformo punti e vettori in globale + ptCentre:toGlob( Frame) + vtDir:toGlob( Frame) + + Proc.dDiameter = dRadius * 2 + Proc.dLength = abs( EgtCurveThickness( Proc.id)) or 0 + Proc.ptCentre = ptCentre + Proc.vtDir = vtDir + Proc.sReferenceSide = EgtGetInfo( Proc.id, 'REFERENCE_SIDE', 's') or nil + + return Proc +end + +------------------------------------------------------------------------------------------------------------- +-- Recupero dati taglio +function FeatureData.GetCuttingData( Proc) + + return Proc +end + +------------------------------------------------------------------------------------------------------------- +-- Recupero dati svuotatura +function FeatureData.GetPocketingData( Proc) + + return Proc +end + +------------------------------------------------------------------------------------------------------------- +-- Recupero dati per fresatura +function FeatureData.GetMillingData( Proc) + + return Proc +end + +------------------------------------------------------------------------------------------------------------- +-- Recupero dati profilatura +function FeatureData.GetProfilingData( Proc) + -- recupero utensili + Proc.nToolsToUse = EgtGetInfo( Proc.id, 'NTOOLS', 'i') or 0 + Proc.sEntityName = EgtGetInfo( Proc.id, 'N', 's') or nil + Proc.Tools = {} + for t = 1, Proc.nToolsToUse do + local Data = {} + Data.sName = EgtGetInfo( Proc.id, 'TOOL_NAME_' .. tostring(t), 's') or 0 + Data.dRadialOffset = EgtGetInfo( Proc.id, 'OFFR_' .. tostring(t), 'd') or 0 + Data.dLongitudinalOffset = EgtGetInfo( Proc.id, 'OFFL_' .. tostring(t), 'd') or 0 + table.insert( Proc.Tools, Data) + end + + Proc.sProfileInfo = EgtGetInfo( Proc.id, 'PROFILE_INFO', 's') or nil + + Proc.sReferenceSide = EgtGetInfo( Proc.id, 'REFERENCE_SIDE', 's') or '' + Proc.bHeadProfile = Proc.sReferenceSide == 'Head' or Proc.sEntityName == 'Left' or Proc.sEntityName == 'Right' + Proc.bLongitudinalProfile = Proc.sReferenceSide == 'Longitudinal' or Proc.sEntityName == 'In' or Proc.sEntityName == 'Out' + + return Proc +end + +------------------------------------------------------------------------------------------------------------- + +return FeatureData \ No newline at end of file diff --git a/CAMAuto/LuaLibs/Identity.lua b/CAMAuto/LuaLibs/Identity.lua new file mode 100644 index 0000000..a20ce15 --- /dev/null +++ b/CAMAuto/LuaLibs/Identity.lua @@ -0,0 +1,41 @@ +-- Identity.lua by Egalware s.r.l. 2024/06/18 +-- Libreria Riconoscimento della feature + +-- Tabella per definizione modulo +local Identity = {} + +--------------------------------------------------------------------- +------------------------ STANDARD FEATURES ------------------------ +--------------------------------------------------------------------- +-- Feature : Drilling +function Identity.IsDrilling( Proc) + return Proc.sType == 'Hole' +end +--------------------------------------------------------------------- +-- Feature : Cutting +function Identity.IsCutting( Proc) + return Proc.sType == 'Cut' +end +--------------------------------------------------------------------- +-- Feature : Milling +function Identity.IsMilling( Proc) + return Proc.sType == 'Milling' +end +--------------------------------------------------------------------- +-- Feature : Pocketing +function Identity.IsPocketing( Proc) + return Proc.sType == 'Pocket' +end +--------------------------------------------------------------------- +-- Feature : Profiling +function Identity.IsProfiling( Proc) + return Proc.sType == 'Profiling' +end + +--------------------------------------------------------------------- +----------------------------- PIECES ------------------------------ +--------------------------------------------------------------------- + + +--------------------------------------------------------------------- +return Identity diff --git a/CAMAuto/LuaLibs/MachiningLib.lua b/CAMAuto/LuaLibs/MachiningLib.lua new file mode 100644 index 0000000..1dd269d --- /dev/null +++ b/CAMAuto/LuaLibs/MachiningLib.lua @@ -0,0 +1,440 @@ +-- MachiningLib.lua by Egalware s.r.l. 2024/06/17 +-- Libreria ricerca lavorazioni per serramenti + +-- Tabella per definizione modulo +local MachiningLib = {} + +-- Include +require( 'EgtBase') + +-- Carico i dati globali +local WinData = require( 'WinData') +local ID = require( 'Identity') + +EgtOutLog( ' MachiningLib started', 1) + +------------------------------------------------------------------------------------------------------------- +-- funzione per cercare utensile tipo FRESA con certe caratteristiche +function MachiningLib.FindMill( Proc, ToolSearchParameters) + local ToolInfo = {} + + local nBestToolIndex + local dBestToolResidualDepth = 0 + for i = 1, #TOOLS do + -- prima verifico che utensile sia compatibile + local bIsToolCompatible = true + if ToolSearchParameters.sName and ToolSearchParameters.sName ~= TOOLS[i].sName then + bIsToolCompatible = false + elseif ToolSearchParameters.dMaxToolDiameter and TOOLS[i].dDiameter > ToolSearchParameters.dMaxToolDiameter then + bIsToolCompatible = false + elseif ToolSearchParameters.sMillShape and ToolSearchParameters.sMillShape == 'STANDARD' and ( TOOLS[i].dSideAngle ~= 0 or TOOLS[i].bIsPen) then + bIsToolCompatible = false + elseif ToolSearchParameters.sMillShape and ToolSearchParameters.sMillShape == 'DOVETAIL' and not TOOLS[i].bIsDoveTail then + bIsToolCompatible = false + elseif ToolSearchParameters.sMillShape and ToolSearchParameters.sMillShape == 'TSHAPEMILL' and not TOOLS[i].bIsTMill then + bIsToolCompatible = false + elseif ToolSearchParameters.sMillShape and ToolSearchParameters.sMillShape == 'PEN' and not TOOLS[i].bIsPen then + bIsToolCompatible = false + elseif ToolSearchParameters.sType and TOOLS[i].sType ~= ToolSearchParameters.sType then + -- se sto cercando una fresa che non può lavorare di testa, quelle che lavorano di testa sono comunque ammesse + if TOOLS[i].sType == 'MILL_STD' and ToolSearchParameters.sType == 'MILL_NOTIP' then + bIsToolCompatible = true + else + bIsToolCompatible = false + end + end + + -- scelgo il migliore + if bIsToolCompatible then + local dCurrentMaxMatReduction = WinData.COLL_SIC or 5 + + -- dCurrMachReduction = negativo -> limitare, positivo -> mm extra disponibili + local dCurrentResidualDepth = ToolSearchParameters.dElevation + dCurrentMaxMatReduction - TOOLS[i].dMaxDepth + + -- se non ancora trovato, oppure se completo e il migliore fino ad ora non è completo: corrente è il migliore + if not nBestToolIndex or ( dBestToolResidualDepth > 0 and dCurrentResidualDepth <= 0) then + nBestToolIndex = i + dBestToolResidualDepth = dCurrentResidualDepth + -- altrimenti scelgo il migliore + else + -- se entrambi completi + if dBestToolResidualDepth <= 0 and dCurrentResidualDepth <= 0 then + -- se il migliore era su aggregato e corrente montanto direttamente, prediligo utensile montato direttamente + if not TOOLS[i].SetupInfo.bToolOnAggregate and TOOLS[i].SetupInfo.bToolOnAggregate then + nBestToolIndex = i + dBestToolResidualDepth = dCurrentResidualDepth + -- se hanno stesso montaggio + elseif TOOLS[i].SetupInfo.bToolOnAggregate == TOOLS[nBestToolIndex].SetupInfo.bToolOnAggregate then + -- scelgo utensile con indice di bontà utensile calcolato come: lunghezza / massimo materiale / diametro + if ( TOOLS[i].dLength / TOOLS[i].dMaxMaterial) / TOOLS[i].dDiameter < ( TOOLS[nBestToolIndex].dLength / TOOLS[nBestToolIndex].dMaxMaterial) / TOOLS[nBestToolIndex].dDiameter then + nBestToolIndex = i + dBestToolResidualDepth = dCurrentResidualDepth + end + end + -- se entrambi incompleti + elseif dBestToolResidualDepth > 0 and dCurrentResidualDepth > 0 then + --scelgo quello che lavora di più + if dCurrentResidualDepth < dBestToolResidualDepth then + nBestToolIndex = i + dBestToolResidualDepth = dCurrentResidualDepth + end + end + end + end + end + + ToolInfo.nToolIndex = nBestToolIndex + ToolInfo.dResidualDepth = dBestToolResidualDepth + + return ToolInfo +end + +------------------------------------------------------------------------------------------------------------- +-- funzione per cercare utensile tipo LAMA con certe caratteristiche +-- TODO da completare +function MachiningLib.FindBlade( Proc, ToolSearchParameters) + local ToolInfo = {} + + -- parametri opzionali + ToolSearchParameters.dElevation = ToolSearchParameters.dElevation or 0 + ToolSearchParameters.bForceLongcutBlade = ToolSearchParameters.bForceLongcutBlade or false + + local nBestToolIndex + for i = 1, #TOOLS do + local bIsToolCompatible = false + + -- TODO per il momento si prende la prima lama. Da completare + if TOOLS[i].sFamily == 'SAWBLADE' then + bIsToolCompatible = true + end + + if bIsToolCompatible then + nBestToolIndex = i + break + end + end + + ToolInfo.nToolIndex = nBestToolIndex + + return ToolInfo +end + +------------------------------------------------------------------------------------------------------------- +-- funzione per cercare utensile tipo PUNTA A FORARE con certe caratteristiche +-- TODO da fare +function MachiningLib.FindDrill( Proc, ToolSearchParameters) + local ToolInfo = {} + + if not ToolSearchParameters.dTolerance then + ToolSearchParameters.dTolerance = 0 + end + + local nBestToolIndex + for i = 1, #TOOLS do + local bIsToolCompatible = false + + -- TODO per il momento si cercano solo le punte. Bisognerebbe valutare anche frese che possono lavorare di testa + if TOOLS[i].sFamily == 'DRILLBIT' then + bIsToolCompatible = true + end + if bIsToolCompatible then + --TODO per il momento si prende il primo utensile con lo stesso diametro, senza considerare altri parametri tipo lunghezza ecc... + if abs( TOOLS[i].dDiameter - ToolSearchParameters.dDiameter) < ToolSearchParameters.dTolerance + GEO.EPS_SMALL * 10 then + if not nBestToolIndex then + nBestToolIndex = i + break + end + end + end + end + + ToolInfo.nToolIndex = nBestToolIndex + + return ToolInfo +end + +------------------------------------------------------------------------------------------------------------- +-- funzione che ritorna fase di lavoro +function MachiningLib.GetPhaseMach( Proc) + local nPhase + -- se info già calcolata + if Proc.nPhase and Proc.nPhase ~= 0 then + nPhase = Proc.nPhase + -- altrimenti si calcola il comportamento standard + else + -- se macchina tipo LINEA + if WinData.MACH_TYPE == 'LINE' then + if Proc.AffectedFaces.bTop then + nPhase = 1 + end + if Proc.AffectedFaces.bFront or Proc.AffectedFaces.bLeft then + nPhase = EgtIf( WinData.FIRST_PHASE_LOAD == 'PUSH', 1, 2) + end + if Proc.AffectedFaces.bBack or Proc.AffectedFaces.bRight then + nPhase = EgtIf( WinData.FIRST_PHASE_LOAD == 'PUSH', 2, 1) + end + -- se macchina tipo PANTOGRAFO + else + if Proc.AffectedFaces.bTop or Proc.AffectedFaces.bLeft or Proc.AffectedFaces.bRight then + nPhase = 1 + end + if Proc.AffectedFaces.bFront then + nPhase = EgtIf( WinData.FIRST_PHASE_LOAD == 'PUSH', 1, 2) + end + if Proc.AffectedFaces.bBack then + nPhase = EgtIf( WinData.FIRST_PHASE_LOAD == 'PUSH', 2, 1) + end + end + end + return nPhase +end + +------------------------------------------------------------------------------------------------------------- +-- funzione che ritorna la distanza di sicurezza da aggiungere alla lavorazione di foratura per evitare colisioni in rapido +function MachiningLib.GetDrillAdditionalSafeDistanceToRaw( Proc, Part, Machining) + -- se non è foro esco subito + if Proc.sType ~= 'Hole' then + return 0 + end + local bVirtualToolOk = EgtCAvSetStdTool( TOOLS[Machining.nToolIndex].dLength, TOOLS[Machining.nToolIndex].dDiameter, 0) + local dStartSafetyLength = EgtCAvToolPosBox( Proc.ptCentre, Proc.vtDir, Part.b3RawPart, Proc.vtDir) + -- si riporta valore calcolato sulla punta utensile + dStartSafetyLength = dStartSafetyLength - TOOLS[Machining.nToolIndex].dLength + return dStartSafetyLength + 5 -- si aggiungono 5mm di sicurezza extra +end + +------------------------------------------------------------------------------------------------------------- +-- salva in lista globale la lavorazione appena calcolata +function MachiningLib.AddNewMachining( ProcToAdd, MachiningToAdd, AuxiliaryDataToAdd) + -- Controllo parametri obbligatori + if not MachiningToAdd.nType or not MachiningToAdd.nToolIndex or not MachiningToAdd.Geometry or not ProcToAdd.id then + return false + end + + -- Drilling + if MachiningToAdd.nType == MCH_MY.DRILLING then + MachiningToAdd.sTypeName = 'Drill_' + -- Milling + elseif MachiningToAdd.nType == MCH_MY.MILLING then + -- se utensile lama + if TOOLS[MachiningToAdd.nToolIndex].sFamily == 'SAWBLADE' then + MachiningToAdd.sTypeName = 'Cut_' + else + MachiningToAdd.sTypeName = 'Mill_' + end + -- Pocketing + elseif MachiningToAdd.nType == MCH_MY.POCKETING then + MachiningToAdd.sTypeName = 'Pocket_' + -- Mortising + elseif MachiningToAdd.nType == MCH_MY.MORTISING then + MachiningToAdd.sTypeName = 'ChSaw_' + end + -- se nome non definito, assegno alla lavorazioen un nome standard + if not MachiningToAdd.sOperationName then + MachiningToAdd.sOperationName = MachiningToAdd.sTypeName .. ( EgtGetName( ProcToAdd.id) or tostring( ProcToAdd.id)) -- TODO serve scrivere faccia? -->> .. '_' .. tostring( MachiningToAdd.Geometry[1][2]) + end + if not MachiningToAdd.sToolName then + MachiningToAdd.sToolName = TOOLS[MachiningToAdd.nToolIndex].sName + end + local Machining = {} + Machining.Proc = ProcToAdd + Machining.Machining = MachiningToAdd + Machining.AuxiliaryData = AuxiliaryDataToAdd + table.insert( MACHININGS, Machining) + return true +end + +------------------------------------------------------------------------------------------------------------- +-- funzione per aggiungere una nuova lavorazione +function MachiningLib.AddOperation( OperationToInsert) + local nErr + local sErr = '' + local bAreAllMachiningApplyOk = true + + -- parametri generali lavorazione + local MachiningParameters = { + { sName = 'sDepth', nMchParam = MCH_MP.DEPTH_STR}, + { sName = 'bInvert', nMchParam = MCH_MP.INVERT}, + { sName = 'nWorkside', nMchParam = MCH_MP.WORKSIDE}, + { sName = 'nFaceuse', nMchParam = MCH_MP.FACEUSE}, + { sName = 'nSCC', nMchParam = MCH_MP.SCC}, + { sName = 'bToolInvert', nMchParam = MCH_MP.TOOLINVERT}, + { sName = 'sBlockedAxis', nMchParam = MCH_MP.BLOCKEDAXIS}, + { sName = 'sInitialAngles', nMchParam = MCH_MP.INITANGS}, + { sName = 'nHeadSide', nMchParam = MCH_MP.HEADSIDE}, + { sName = 'nSubType', nMchParam = MCH_MP.SUBTYPE}, + { sName = 'dOverlap', nMchParam = MCH_MP.OVERL}, + { sName = 'nStepType', nMchParam = MCH_MP.STEPTYPE}, + { sName = 'dStartSafetyLength', nMchParam = MCH_MP.STARTPOS}, + { sName = 'dReturnPos', nMchParam = MCH_MP.RETURNPOS}, + { sName = 'dRadialOffset', nMchParam = MCH_MP.OFFSR}, + { sName = 'dLongitudinalOffset', nMchParam = MCH_MP.OFFSL}, + { sName = 'dStartSlowLen', nMchParam = MCH_MP.STARTSLOWLEN}, + { sName = 'dEndSlowLen', nMchParam = MCH_MP.ENDSLOWLEN}, + { sName = 'dThrouAddLen', nMchParam = MCH_MP.THROUADDLEN}, + { sName = 'sSystemNotes', nMchParam = MCH_MP.SYSNOTES}, + { sName = 'sUserNotes', nMchParam = MCH_MP.USERNOTES} + } + + -- parametri relativi allo step + MachiningParameters.Steps = { + { sName = 'nStepType', nMchParam = MCH_MP.STEPTYPE}, + { sName = 'dStep', nMchParam = MCH_MP.STEP}, + { sName = 'dSideStep', nMchParam = MCH_MP.SIDESTEP} + } + + -- parametri relativi all'approccio + MachiningParameters.LeadIn = { + { sName = 'nType', nMchParam = MCH_MP.LEADINTYPE}, + { sName = 'dStartAddLength', nMchParam = MCH_MP.STARTADDLEN}, + { sName = 'dTangentDistance', nMchParam = MCH_MP.LITANG}, + { sName = 'dPerpDistance', nMchParam = MCH_MP.LIPERP}, + { sName = 'dElevation', nMchParam = MCH_MP.LIELEV}, + { sName = 'dCompLength', nMchParam = MCH_MP.LICOMPLEN} + } + + -- parametri relativi alla retrazione + MachiningParameters.LeadOut = { + { sName = 'nType', nMchParam = MCH_MP.LEADOUTTYPE}, + { sName = 'dEndAddLength', nMchParam = MCH_MP.ENDADDLEN}, + { sName = 'dTangentDistance', nMchParam = MCH_MP.LOTANG}, + { sName = 'dPerpDistance', nMchParam = MCH_MP.LOPERP}, + { sName = 'dElevation', nMchParam = MCH_MP.LOELEV}, + { sName = 'dCompLength', nMchParam = MCH_MP.LOCOMPLEN} + } + + -- parametri da scrivere nelle note utente + local UserNotes = { + { sName = 'dMaxElev', sMchParam = 'MaxElev'} + } + + -- parametri da scrivere nelle note di sistema + local SystemNotes = { + } + + local nClonesToAdd = 1 + if OperationToInsert.AuxiliaryData.Clones then + nClonesToAdd = #OperationToInsert.AuxiliaryData.Clones + end + for j = 1, nClonesToAdd do + -- creazione lavorazione + local nOperationId = EgtCreateMachining( OperationToInsert.Machining.sOperationName, OperationToInsert.Machining.nType, OperationToInsert.Machining.sToolName) + + if nOperationId then + -- impostazione geometria + EgtSetMachiningGeometry( OperationToInsert.Machining.Geometry) + + -- impostazione parametri lavorazione + -- TODO scrivere sempre Steps, LeadIn, LeadOut nelle tabelle in modo da non dover controllare ogni volta che ci siano + for k = 1, #MachiningParameters do + local sValue + if OperationToInsert.AuxiliaryData.Clones and OperationToInsert.AuxiliaryData.Clones[j][MachiningParameters[k].sName] then + sValue = OperationToInsert.AuxiliaryData.Clones[j][MachiningParameters[k].sName] + elseif OperationToInsert.Machining[MachiningParameters[k].sName] then + sValue = OperationToInsert.Machining[MachiningParameters[k].sName] + end + if sValue then + EgtSetMachiningParam( MachiningParameters[k].nMchParam, sValue) + end + end + for k = 1, #MachiningParameters.Steps do + local sValue + if OperationToInsert.AuxiliaryData.Clones and OperationToInsert.AuxiliaryData.Clones[j].Steps and OperationToInsert.AuxiliaryData.Clones[j].Steps[MachiningParameters.Steps[k].sName] then + sValue = OperationToInsert.AuxiliaryData.Clones[j].Steps[MachiningParameters.Steps[k].sName] + elseif OperationToInsert.Machining.Steps and OperationToInsert.Machining.Steps[MachiningParameters.Steps[k].sName] then + sValue = OperationToInsert.Machining.Steps[MachiningParameters.Steps[k].sName] + end + if sValue then + EgtSetMachiningParam( MachiningParameters.Steps[k].nMchParam, sValue) + end + end + for k = 1, #MachiningParameters.LeadIn do + local sValue + if OperationToInsert.AuxiliaryData.Clones and OperationToInsert.AuxiliaryData.Clones[j].LeadIn and OperationToInsert.AuxiliaryData.Clones[j].LeadIn[MachiningParameters.LeadIn[k].sName] then + sValue = OperationToInsert.AuxiliaryData.Clones[j].LeadIn[MachiningParameters.LeadIn[k].sName] + elseif OperationToInsert.Machining.LeadIn and OperationToInsert.Machining.LeadIn[MachiningParameters.LeadIn[k].sName] then + sValue = OperationToInsert.Machining.LeadIn[MachiningParameters.LeadIn[k].sName] + end + if sValue then + EgtSetMachiningParam( MachiningParameters.LeadIn[k].nMchParam, sValue) + end + end + for k = 1, #MachiningParameters.LeadOut do + local sValue + if OperationToInsert.AuxiliaryData.Clones and OperationToInsert.AuxiliaryData.Clones[j].LeadOut and OperationToInsert.AuxiliaryData.Clones[j].LeadOut[MachiningParameters.LeadOut[k].sName] then + sValue = OperationToInsert.AuxiliaryData.Clones[j].LeadOut[MachiningParameters.LeadOut[k].sName] + elseif OperationToInsert.Machining.LeadOut and OperationToInsert.Machining.LeadOut[MachiningParameters.LeadOut[k].sName] then + sValue = OperationToInsert.Machining.LeadOut[MachiningParameters.LeadOut[k].sName] + end + if sValue then + EgtSetMachiningParam( MachiningParameters.LeadOut[k].nMchParam, sValue) + end + end + for k = 1, #UserNotes do + local sValue + if OperationToInsert.AuxiliaryData.Clones and OperationToInsert.AuxiliaryData.Clones[j][UserNotes[k].sName] then + sValue = OperationToInsert.AuxiliaryData.Clones[j][UserNotes[k].sName] + elseif OperationToInsert.Machining[UserNotes[k].sName] then + sValue = OperationToInsert.Machining[UserNotes[k].sName] + end + if sValue then + local sUserNotes = '' + sUserNotes = EgtSetValInNotes( sUserNotes, UserNotes[k].sMchParam, sValue) + EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) + end + end + -- parametri da settare nelle note di sistema + -- TODO da decidere quali sono le note da salvare qui. Probabilmente tutte quelle relative all'ordine delle lavorazioni + --if OperationToInsert.Machining.nMachiningOrder then + -- sSystemNotes = EgtSetValInNotes( sSystemNotes, 'MachiningOrder', OperationToInsert.Machining.nMachiningOrder) + --end + for k = 1, #SystemNotes do + local sValue + if OperationToInsert.AuxiliaryData.Clones and OperationToInsert.AuxiliaryData.Clones[j][SystemNotes[k].sName] then + sValue = OperationToInsert.AuxiliaryData.Clones[j][SystemNotes[k].sName] + elseif OperationToInsert.Machining[SystemNotes[k].sName] then + sValue = OperationToInsert.Machining[SystemNotes[k].sName] + end + if sValue then + local sSystemNotes = '' + sSystemNotes = EgtSetValInNotes( sSystemNotes, SystemNotes[k].sMchParam, sValue) + EgtSetMachiningParam( MCH_MP.SYSNOTES, sSystemNotes) + end + end + + local b3MachEncumbrance = nil + local bIsApplyOk = MachiningLib.ApplyMachining( true, false) + if not bIsApplyOk then + bAreAllMachiningApplyOk = false + nErr, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nOperationId, false) + else + local nClId = EgtGetFirstNameInGroup( nOperationId, 'CL') + local ptMin = EgtGetInfo( nClId, 'MMIN', 'p') + local ptMax = EgtGetInfo( nClId, 'MMAX', 'p') + -- box percorso lavorazione + if ptMin and ptMax then + local dToolRadius = TOOLS[OperationToInsert.Machining.nToolIndex].dTotDiameter / 2 + if dToolRadius then + ptMin = ptMin - Vector3d( dToolRadius, 0, 0) + ptMax = ptMax + Vector3d( dToolRadius, 0, 0) + end + end + b3MachEncumbrance = BBox3d( ptMin, ptMax) + end + + return bIsApplyOk, sErr, b3MachEncumbrance + else + return false, 'UNEXPECTED ERROR: Error on creating machining' + end + end +end + +------------------------------------------------------------------------------------------------------------- +function MachiningLib.ApplyMachining( bRecalc, bApplyPost) + local bResult = EgtApplyMachining( bRecalc, bApplyPost) + return bResult +end + +------------------------------------------------------------------------------------------------------------- +return MachiningLib diff --git a/CAMAuto/LuaLibs/WinConst.lua b/CAMAuto/LuaLibs/WinConst.lua new file mode 100644 index 0000000..5bdc751 --- /dev/null +++ b/CAMAuto/LuaLibs/WinConst.lua @@ -0,0 +1,34 @@ +-- WinConst.lua libreria di costanti EgalWare per progetto serramenti 2024/10/07 + +-- Tavola per definizione modulo (serve ma non usata) +local WinConst = {} + +EgtOutLog( 'WinConst started', 1) + +-- Funzione per rendere non modificabili le costanti +local protect = function(tbl) + return setmetatable({}, { + __index = tbl, + __newindex = function(t, key, value) + error("attempting to change constant " .. + tbl[1]..tostring(key) .. " to " .. tostring(value), 2) + end + }) +end + +-- Costanti fasi di lavorazione +MACH_GROUP = { + 'MACH_GROUP.', + HEAD_CUT = 1, + FEATURE_BEFORE_PROFILE = 2, + HEAD_PROFILE = 3, + LONG_PROFILE = 4, + MIXED_PROFILE = 5, + FEATURE_AFTER_PROFILE = 6, + STRIPCUT = 7, + PAUSE = 8, + MACH_AFTER_PAUSE = 9 +} +MACH_GROUP = protect( MACH_GROUP) + +return WinConst \ No newline at end of file diff --git a/CAMAuto/LuaLibs/WinExec.lua b/CAMAuto/LuaLibs/WinExec.lua new file mode 100644 index 0000000..e07a6e0 --- /dev/null +++ b/CAMAuto/LuaLibs/WinExec.lua @@ -0,0 +1,557 @@ +-- WinExec.lua by Egalware s.r.l. 2024/06/13 +-- Libreria esecuzione lavorazioni per Serramenti + +-- Tabella per definizione modulo +local WinExec = {} + +-- Include +require( 'EgtBase') + +-- Carico i dati globali +local WinData = require( 'WinData') +local WinLib = require( 'WinLib') +local ID = require( 'Identity') +local FeatureData = require( 'FeatureData') +local MachiningLib = require( 'MachiningLib') + +-- carico librerie di lavorazione +_G.package.loaded.Drilling = nil +_G.package.loaded.Cutting = nil +_G.package.loaded.Pocketing = nil +_G.package.loaded.Milling = nil +_G.package.loaded.Profiling = nil +local Drilling = require( 'Drilling') +local Cutting = require( 'Cutting') +local Pocketing = require( 'Pocketing') +local Milling = require( 'Milling') +local Profiling = require( 'Profiling') + + +EgtOutLog( ' WinExec started', 1) +EgtMdbSave() + +------------------------------------------------------------------------------------------------------------- +-- *** variabili globali *** +------------------------------------------------------------------------------------------------------------- +TOOLS = nil +MACHININGS = nil + +------------------------------------------------------------------------------------------------------------- +-- *** COSTANTI *** TODO -> DA SPOSTARE IN WINDATA??? +------------------------------------------------------------------------------------------------------------- +TH_DIAMETER_HSK63 = 63 +TH_LENGTH_HSK63 = 75 +SIDEANGLE_DOVETAIL = 15 + +------------------------------------------------------------------------------------------------------------- +-- *** funzioni di base *** +------------------------------------------------------------------------------------------------------------- +local function GetToolTypeNameFromToolTypeID( dToolTypeID) + if dToolTypeID == MCH_TY.DRILL_STD then + return 'DRILL_STD', 'DRILLBIT' + elseif dToolTypeID == MCH_TY.DRILL_LONG then + return 'DRILL_LONG', 'DRILLBIT' + elseif dToolTypeID == MCH_TY.SAW_STD then + return 'SAW_STD', 'SAWBLADE' + elseif dToolTypeID == MCH_TY.SAW_FLAT then + return 'SAW_FLAT', 'SAWBLADE' + elseif dToolTypeID == MCH_TY.MILL_STD then + return 'MILL_STD', 'MILL' + elseif dToolTypeID == MCH_TY.MILL_NOTIP then + return 'MILL_NOTIP', 'MILL' + elseif dToolTypeID == MCH_TY.MORTISE_STD then + return 'MORTISE_STD', 'MORTISE' + else + return nil + end +end + +------------------------------------------------------------------------------------------------------------- +local function IsToolOk( Tool) + -- controllo che i dati necessari siano impostati + if Tool.dMaxMaterial and Tool.dDiameter and Tool.dLength and Tool.sHead and Tool.sUUID then + -- se DRILLBIT non ho altri dati + if Tool.sFamily == 'DRILLBIT' then + return true + -- altrimenti controllo dati aggiuntivi altre famiglie di utensili + elseif Tool.sFamily == 'MORTISE' then + if Tool.dCornerRadius then + return true + end + else + if Tool.dThickness then + return true + end + end + end + + return false +end + +------------------------------------------------------------------------------------------------------------- +function WinExec.GetToolsFromDB() + +-- TODO gli utensili profilati devono essere messi in una lista a parte ad accesso diretto TOOLS['Prof1'] in modo da non dover scorrere la lista +-- dato che saranno molti e l'applicazione sarà diretta. Non serve ciclarli + + + -- creo lista globale utensili disponibili + TOOLS = {} + -- lista appoggio utensile + local Tool = {} + + -- recupero tutti gli utensili : punte a forare, lame, frese e motoseghe + Tool.sName = EgtTdbGetFirstTool( MCH_TF.DRILLBIT + MCH_TF.SAWBLADE + MCH_TF.MILL + MCH_TF.MORTISE) + while Tool.sName ~= '' do + -- imposto utensile come corrente per recuperarne i dati + EgtTdbSetCurrTool( Tool.sName) + + -- verifico se utensile disponibile in attrezzaggio attuale e che abbia un tipo ben definito + local bToolLoadedOnSetup, sToolTCPos = EgtFindToolInCurrSetup( Tool.sName) + local nToolTypeId = EgtTdbGetCurrToolParam( MCH_TP.TYPE) + local sToolType, sToolFamily = GetToolTypeNameFromToolTypeID( nToolTypeId) + + -- se verifica condizioni minime, recupero tutti gli altri dati + if bToolLoadedOnSetup and sToolType then + Tool.sTcPos = sToolTCPos + Tool.sFamily = sToolFamily + Tool.sType = sToolType + Tool.nTypeId = nToolTypeId + Tool.dMaxMaterial = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) + Tool.dDiameter = EgtTdbGetCurrToolParam( MCH_TP.DIAM) + Tool.dTotDiameter = EgtTdbGetCurrToolParam( MCH_TP.TOTDIAM) + Tool.dLength = EgtTdbGetCurrToolParam( MCH_TP.LEN) + Tool.dSpeed = EgtTdbGetCurrToolParam( MCH_TP.SPEED) + Tool.bIsCCW = Tool.dSpeed < 0 + Tool.Feeds = {} + Tool.Feeds.dFeed = EgtTdbGetCurrToolParam( MCH_TP.FEED) + Tool.Feeds.dStartFeed = EgtTdbGetCurrToolParam( MCH_TP.STARTFEED) + Tool.Feeds.dEndFeed = EgtTdbGetCurrToolParam( MCH_TP.ENDFEED) + Tool.Feeds.dTipFeed = EgtTdbGetCurrToolParam( MCH_TP.TIPFEED) + Tool.sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD) + Tool.SetupInfo = {} + Tool.SetupInfo = WinData.GetSetupInfo( {sHead = Tool.sHead, sTcPos = Tool.sTcPos}) + Tool.sUUID = EgtTdbGetCurrToolParam( MCH_TP.UUID) + Tool.sUserNotes = EgtTdbGetCurrToolParam( MCH_TP.USERNOTES) + Tool.dMaxDepth = EgtTdbGetCurrToolMaxDepth() or Tool.dMaxMaterial + Tool.ToolHolder = {} + Tool.ToolHolder.dDiameter = EgtTdbGetCurrToolThDiam() or TH_DIAMETER_HSK63 -- diametro standard HSK63 + Tool.ToolHolder.dLength = EgtTdbGetCurrToolThLength() or TH_LENGTH_HSK63 -- lunghezza standard HSK63 + -- parametri scritti nelle note + Tool.nDouble = EgtGetValInNotes( Tool.sUserNotes, 'DOUBLE') + + -- lettura parametri non comuni ( famiglia DRILLBIT non ha parametri specifici) + if sToolFamily ~= 'DRILLBIT' then + Tool.dThickness = EgtTdbGetCurrToolParam( MCH_TP.THICK) + Tool.dLongitudinalOffset = EgtTdbGetCurrToolParam( MCH_TP.LONOFFSET) + Tool.dRadialOffset = EgtTdbGetCurrToolParam( MCH_TP.RADOFFSET) + -- recupero parametri propri delle frese + if sToolFamily == 'MILL' then + Tool.dStemDiameter = EgtTdbGetCurrToolParam( MCH_TP.STEMDIAM) or Tool.ToolHolder.dDiameter -- se non settato, considero diametro come ToolHolder + Tool.dSideAngle = EgtTdbGetCurrToolParam( MCH_TP.SIDEANG) or 0 + -- verifico che parametri siano compatibili con una fresa a coda di rondine ( angolo di fianco standard Coda di rondine -> 15°) + Tool.bIsDoveTail = Tool.Type == 'MILL_NOTIP' and abs( abs( Tool.dSideAngle) - SIDEANGLE_DOVETAIL) < 1 + -- verifico che sia una fresa tipo T-Mill o BlockHaus + Tool.dSideDepth = EgtGetValInNotes( Tool.sUserNotes, 'SIDEDEPTH') or 0 -- se non settato nell'utensile, dico che non ha massimo affondamento laterale + Tool.bIsTMill = Tool.dSideDepth > 0 + Tool.dStep = EgtGetValInNotes( Tool.sUserNotes, 'STEP') or ( Tool.dMaxMaterial / 3) -- se non settato nell'utensile, considero metà del tagliente + Tool.dSideStep = EgtGetValInNotes( Tool.sUserNotes, 'SIDESTEP') or floor( Tool.dDiameter / 3) -- se non settato nell'utensile, considero metà del diametro + Tool.bIsPen = abs( Tool.dSpeed) < 5 + -- recupero parametri propri delle lame + elseif sToolFamily == 'SAWBLADE' then + Tool.bIsUsedForLongCut = EgtGetValInNotes( Tool.sUserNotes, 'LONGCUT') == 1 or false -- false coem valore di default + Tool.dStep = EgtGetValInNotes( Tool.sUserNotes, 'STEP') or Tool.dThickness -- se non settato nell'utensile, considero lo spessore lama + Tool.dSideStep = EgtGetValInNotes( Tool.sUserNotes, 'SIDESTEP') or Tool.dMaxMaterial -- se non settato nell'utensile, considero un quarto del diametro + -- recupero parametri propri delle motoseghe + elseif sToolFamily == 'MORTISE' then + Tool.dDistance = EgtTdbGetCurrToolParam( MCH_TP.DIST) or 90 -- 90mm dimensione standard aggregato catena + Tool.bIsMortise = EgtGetValInNotes( Tool.sUserNotes, 'MORTISE') == 1 + Tool.bIsChainSaw = not Tool.bIsMortise + Tool.dStep = EgtGetValInNotes( Tool.sUserNotes, 'STEP') or floor( Tool.dMaxMaterial / 3) -- se non settato nell'utensile, considero un terzo della lunghezza + Tool.dSideStep = EgtGetValInNotes( Tool.sUserNotes, 'SIDESTEP') or ( Tool.dThickness - 1) -- se non settato nell'utensile, considero spessore catena meno 1mm di sicurezza + Tool.dCornerRadius = EgtTdbGetCurrToolParam( MCH_TP.CORNRAD) + Tool.dWidth = Tool.dDiameter + end + end + + -- se tutti i dati necessari sono disponibili, inserisco utensile nella lista globale degli utensili disponibili + if IsToolOk( Tool) then + table.insert( TOOLS, Tool) + -- altrimenti scrivo nel log che l'utensile non è conforme + else + EgtOutLog( '*** ' .. Tool.sName .. ' : NOT-COMPLIANT ***', 1) + end + + -- reset dati + Tool = {} + end + + -- recupero utensile successivo ( punte a forare, lame, frese e motoseghe) + Tool.sName = EgtTdbGetNextTool( MCH_TF.DRILLBIT + MCH_TF.SAWBLADE + MCH_TF.MILL + MCH_TF.MORTISE) + end +end + + +------------------------------------------------------------------------------------------------------------- +-- *** Inserimento delle lavorazioni nelle travi *** +------------------------------------------------------------------------------------------------------------- + +local function CollectFeatures( vProc, Part, nIndexPart) + -- recupero le feature + local LayerId = {} + LayerId[1] = WinLib.GetAddGroup( Part.id) + LayerId[2] = EgtGetFirstNameInGroup( Part.id or GDB_ID.NULL, 'Processings') + for nInd = 1, 2 do + local ProcId = EgtGetFirstInGroup( LayerId[nInd] or GDB_ID.NULL) + while ProcId do + local nEntType = EgtGetType( ProcId) + if nEntType == GDB_TY.SRF_MESH or nEntType == GDB_TY.EXT_TEXT or + nEntType == GDB_TY.CRV_LINE or nEntType == GDB_TY.CRV_ARC or nEntType == GDB_TY.CRV_BEZ or nEntType == GDB_TY.CRV_COMPO then + local sType = EgtGetInfo( ProcId, 'FEATURE_TYPE', 's') + local nDo = EgtGetInfo( ProcId, 'DO', 'i') or 1 + if sType and nDo == 1 then + local Proc = {} + Proc.idPart = Part.id + Proc.nIndexPart = nIndexPart + Proc.id = ProcId + Proc.nFlg = 1 + Proc.sType = sType + Proc.b3Box = EgtGetBBoxGlob( ProcId, GDB_BB.STANDARD) + Proc.nPhase = EgtGetInfo( ProcId, 'PHASE', 'i') or nil + + -- se esiste la geometria + if Proc.b3Box and not Proc.b3Box:isEmpty() then + -- calcolo dati specifici per tipologia di feature / lavorazione + -- se foro + if ID.IsDrilling( Proc) then + Proc = FeatureData.GetDrillingData( Proc) + end + -- se taglio + if ID.IsCutting( Proc) then + Proc = FeatureData.GetCuttingData( Proc) + end + -- se fresatura + if ID.IsMilling( Proc) then + Proc = FeatureData.GetMillingData( Proc) + end + -- se svuotatura + if ID.IsPocketing( Proc) then + Proc = FeatureData.GetPocketingData( Proc) + end + -- se profilatura + if ID.IsProfiling( Proc) then + Proc = FeatureData.GetProfilingData( Proc) + end + -- informazioni facce + Proc.AffectedFaces = WinLib.GetAffectedFaces( Proc, Part) + -- inserisco feature in lista + table.insert( vProc, Proc) + else + Proc.nFlg = 0 + table.insert( vProc, Proc) + EgtOutLog( ' Feature ' .. tostring( Proc.idFeature) .. ' is empty (no geometry)') + end + end + end + ProcId = EgtGetNext( ProcId) + end + end + return vProc +end + +------------------------------------------------------------------------------------------------------------- +local function GetFeatureInfoAndDependency( vProc, Part) + -- ciclo tutte le feature + for i = 1, #vProc do + local Proc = vProc[i] + -- controllo la feature con tutte le altre per recuperare le dipendenze + for j = 1, #vProc do + -- non si controlla la feature con se stessa + if i ~= j then + local ProcB = vProc[j] + -- TODO dipendenze da controllare : + -- * gruppo di forature con aggregato 2/3 uscite + -- * Se 'Left' e 'Out' hanno stesso profilo, vanno concatenati (anche 'Right' se consentito dalla macchina) + end + end + end + return vProc +end + +------------------------------------------------------------------------------------------------------------- +-- ottimizza le lavorazioni, considerando di ridurre i cambi utensile +local function SortByChangeToolOpt( MACHININGS) + local vProcToSortToolOpt = {} + vProcToSortToolOpt = MACHININGS + + for i = 1, #vProcToSortToolOpt do + for j = i + 1, #vProcToSortToolOpt do + -- se sono su stessa fase + if vProcToSortToolOpt[i].AuxiliaryData.nPhase == vProcToSortToolOpt[j].AuxiliaryData.nPhase then + -- se stesso utensile + if vProcToSortToolOpt[i].Machining.nToolIndex == vProcToSortToolOpt[j].Machining.nToolIndex then + if i + 1 == j then + -- il confronto riparte dall'ultimo spostato + i = j + else + -- sposto lavorazione confrontata dopo la principale + WinLib.ChangeElementPositionInTable( vProcToSortToolOpt, j, i+1) + -- il confronto riparte dall'ultimo spostato + i = j + end + end + end + end + end + + return vProcToSortToolOpt +end + +------------------------------------------------------------------------------------------------------------- +-- Ordina le feature in base a fase di lavorazione +-- L'ordine è indicativamente: +-- 1) Tagli di testa +-- 2) Fori +-- 3) Scassi serratura/maniglia +-- 4) Profili testa / Minizinken +-- 5) Fori per spine dopo profilo di testa +-- 6) Profili longitudinali +-- 7) Passate pulitura per cambio profilo +-- 8) Incontri/scontri (encounter/clash) +-- 9) Listello ferma-vetro +-- 10) Pausa +-- 11) Lavorazioni dopo rimozione ferma-vetro + +-- TODO Verificare se assegnare le fasi già quando si mette la lavorazione e ordinare solo in base alla fase di lavoro. +-- TODO il punto 11) deve essere diviso in altri punti in base alle lavorazioni. Per adesso è un gruppo generico. +-- TODO Ridefinire le fasi, prevedere anche la fase di cambio pinzaggio + +local function OrderMachining( MACHININGS) + + local vProcToSort = MACHININGS + -- funzione di confronto. TRUE = B1 prima di B2. FALSE = B2 prima di B1 + local function CompareFeatures( B1, B2) + -- se secondo disabilitato, va lasciato dopo + if B1.Proc.nFlg ~= 0 and B2.Proc.nFlg == 0 then + return true + elseif B1.AuxiliaryData.nPhase < B2.AuxiliaryData.nPhase then + return true + elseif B1.AuxiliaryData.nPhase > B2.AuxiliaryData.nPhase then + return false + elseif B1.Machining.Geometry == B2.Machining.Geometry then + return B1.AuxiliaryData.nIndexMachining < B2.AuxiliaryData.nIndexMachining + elseif B1.AuxiliaryData.bIsProfiling and B2.AuxiliaryData.bIsDrilling and B2.AuxiliaryData.bExecAfterProfile then + return true + elseif B1.AuxiliaryData.bIsDrilling and B1.AuxiliaryData.bExecAfterProfile and B2.AuxiliaryData.bIsProfiling then + return false + elseif B1.AuxiliaryData.bIsDrilling and B2.AuxiliaryData.bIsProfiling then + return true + elseif B2.AuxiliaryData.bIsDrilling and B1.AuxiliaryData.bIsProfiling then + return false + elseif B1.AuxiliaryData.bIsProfiling and B2.AuxiliaryData.bIsProfiling then + -- profiling Generic sempre per ultimi + if B1.Proc.sProfileInfo == 'Generic' and B2.Proc.sProfileInfo ~= 'Generic' then + return false + elseif B2.Proc.sProfileInfo == 'Generic' and B1.Proc.sProfileInfo ~= 'Generic' then + return true + -- profiling Mixed dopo le profilature standard + elseif B1.Proc.sProfileInfo == 'Mixed' and B2.Proc.sProfileInfo ~= 'Mixed' then + return false + elseif B2.Proc.sProfileInfo == 'Mixed' and B1.Proc.sProfileInfo ~= 'Mixed' then + return true + -- negli altri casi si ordina solo in base alla posizione + elseif B1.Proc.b3Box:getCenter():getX() - B2.Proc.b3Box:getCenter():getX() < 10 * GEO.EPS_SMALL then + return EgtIf( B1.AuxiliaryData.nPhase == 1, true, false) -- se arrivati a questo controllo, la fase di lavorazione di entrambe è la stessa, quindi mi basta controllarne una + else + return EgtIf( B1.AuxiliaryData.nPhase == 1, false, true) -- se arrivati a questo controllo, la fase di lavorazione di entrambe è la stessa, quindi mi basta controllarne una + end + elseif B1.AuxiliaryData.bIsDrilling and B2.AuxiliaryData.bIsDrilling then + if B1.Proc.b3Box:getMin():getX() < B2.Proc.b3Box:getMin():getX() then + return true + else + return false + end + else + return false + end + end + + -- test della funzione di ordinamento + if EgtGetDebugLevel() >= 3 then + EgtOutLog( ' CompareFeatures Test ') + local bCompTest = true + for i = 1, #vProcToSort do + for j = i + 1, #vProcToSort do + local bComp1 = CompareFeatures( vProcToSort[i], vProcToSort[j]) + local bComp2 = CompareFeatures( vProcToSort[j], vProcToSort[i]) + if bComp1 == bComp2 then + bCompTest = false + EgtOutLog( string.format( ' ProcId : %d vs %d --> ERROR', vProcToSort[i].Proc.id, vProcToSort[j].Proc.id)) + end + end + end + if bCompTest then + EgtOutLog( ' ALL OK') + end + end + + -- eseguo un primo ordinamento + table.sort( vProcToSort, CompareFeatures) + + -- ordino per ottimizzare cambio utensile + -- MACHININGS = SortByChangeToolOpt( MACHININGS) + + return true +end + +------------------------------------------------------------------------------------------------------------- +-- applica le lavorazioni +local function AddMachinings( vProc, PARTS) + local bMachiningOk = true + for nFeatureIndex = 1, #vProc do + local Proc = vProc[nFeatureIndex] + local Part = PARTS[vProc[nFeatureIndex].nIndexPart] + if ID.IsDrilling( Proc) then + bMachiningOk = Drilling.Make( Proc, Part) + end + -- se taglio + if ID.IsCutting( Proc) then + bMachiningOk = Cutting.Make( Proc, Part) + end + -- se fresatura + if ID.IsMilling( Proc) then + bMachiningOk = Milling.Make( Proc, Part) + end + -- se svuotatura + if ID.IsPocketing( Proc) then + bMachiningOk = Pocketing.Make( Proc, Part) + end + -- se profilatura + if ID.IsProfiling( Proc) then + bMachiningOk = Profiling.Make( Proc, Part) + end + end + return bMachiningOk +end + +------------------------------------------------------------------------------------------------------------- +local function PrintFeatures( vProc, PARTS) + EgtOutLog( ' === PARTS ====') + for i = 1, #PARTS do + EgtOutLog( ' RawBox(' .. tostring( i) .. ') =' .. tostring( PARTS[i].RawBox)) + end + EgtOutLog( ' === FEATURES ====') + for i = 1, #vProc do + local Proc = vProc[i] + local sOut = string.format( 'Id=%3d Flg=%2d Type=%s', Proc.id, Proc.nFlg, Proc.sType) + EgtOutLog( sOut) + end +end + +------------------------------------------------------------------------------------------------------------- +local function UpdateRawPosition( PARTS) + for i = 1, #PARTS do + PARTS[i].b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[i].id, 'Geo') or GDB_ID.NULL, GDB_BB.STANDARD) + PARTS[i].b3RawPart = EgtGetRawPartBBox( PARTS[i].idRaw) + end +end + +------------------------------------------------------------------------------------------------------------- +local function CheckAndMovePawPart( nIdRawToMove, vtMove) + EgtMoveRawPart( nIdRawToMove, vtMove) +end + +------------------------------------------------------------------------------------------------------------- +function WinExec.ProcessFeatures( PARTS) + -- ciclo sui pezzi + local nTotErr = 0 + local Stats = {} + local vProc = {} + MACHININGS = {} + + -- aggiorno posizione grezzi dopo disposizione + EgtSetCurrPhase( 1) + UpdateRawPosition( PARTS) + + -- si recuperano tutte le feature di tutti i pezzi in una lista unica + for nPart = 1, #PARTS do + -- recupero le feature di lavorazione della trave + vProc = CollectFeatures( vProc, PARTS[nPart], nPart) + + -- recupero informazioni ausiliarie feature e dipendenze tra feature dello stesso pezzo + vProc = GetFeatureInfoAndDependency( vProc, PARTS[nPart]) + end + + -- debug + if EgtGetDebugLevel() >= 1 then + PrintFeatures( vProc, PARTS) + end + + EgtOutLog( ' *** AddMachinings ***', 1) + + -- esegue le lavorazioni e le salva in lista + AddMachinings( vProc, PARTS) + + -- ordina le lavorazioni + OrderMachining( MACHININGS) + + for i = 1, #MACHININGS do + if MACHININGS[i].AuxiliaryData.nPhase == 1 then + -- aggiunge effettivamente la lavorazione e restituisce gli ingombri + local bIsApplyOk, sErr, b3MachEncumbrance = MachiningLib.AddOperation( MACHININGS[i]) -- TODO ingombro lavorazione mi restituisce dati sbagliati. C'è un riferimento? + -- se feature di testa, sposto testa in base a ingombro lavorazione + if MACHININGS[i].Proc.bHeadProfile and b3MachEncumbrance then + PARTS[MACHININGS[i].Proc.nIndexPart].DispOffsets.Phase1.dOffsetX = b3MachEncumbrance:getMax():getX() - PARTS[MACHININGS[i].Proc.nIndexPart].b3Part:getMin():getX() + 5 + end + end + end + + -- TODO lo spostamento, oltre a controllare le collisioni con il profilo di testa, deve anche considerare il pinzaggio del pezzo nel suo insieme? + -- Es.: basterebbe aggiungere un offset di 50mm per la testa, ma se metto 60mm, posso utilizzare una morsa in più che altrimenti avrei dovuto togliere per una collisione con una svuotatura + + -- sposto pezzo per permettere pinzaggio migliore e non aver colisione in testa + for i = 1, #PARTS do + -- TODO controllare calcolo ingombro + local vtMove = Vector3d( - PARTS[i].DispOffsets.Phase1.dOffsetX, 0, 0) + if vtMove ~= V_NULL() then + CheckAndMovePawPart( PARTS[i].idRaw, vtMove) + end + end + + -- scrivo lavorazioni seconda fase + EgtSetCurrPhase( 2) + UpdateRawPosition( PARTS) + for i = 1, #MACHININGS do + if MACHININGS[i].AuxiliaryData.nPhase == 2 then + -- aggiunge effettivamente la lavorazione + local bIsApplyOk, sErr, b3MachEncumbrance = MachiningLib.AddOperation( MACHININGS[i]) -- TODO ingombro lavorazione mi restituisce dati sbagliati. C'è un riferimento? + -- se feature di testa, sposto testa in base a ingombro lavorazione + if MACHININGS[i].Proc.bHeadProfile and b3MachEncumbrance then + PARTS[MACHININGS[i].Proc.nIndexPart].DispOffsets.Phase2.dOffsetX = PARTS[MACHININGS[i].Proc.nIndexPart].b3Part:getMax():getX() - b3MachEncumbrance:getMin():getX() + 5 + end + end + end + -- sposto pezzo per permettere pinzaggio migliore e non aver colisione in testa + for i = 1, #PARTS do + -- TODO controllare calcolo ingombro + local vtMove = Vector3d( PARTS[i].DispOffsets.Phase2.dOffsetX, 0, 0) + if vtMove ~= V_NULL() then + CheckAndMovePawPart( PARTS[i].idRaw, vtMove) + end + end + + EgtOutLog( ' *** End AddMachinings ***', 1) + + -- Aggiornamento finale di tutto + EgtSetCurrPhase( 1) + local bApplOk, sApplErrors, sApplWarns = EgtApplyAllMachinings() + if not bApplOk then + nTotErr = nTotErr + 1 + table.insert( Stats, {nErr = 1, sMsg=sApplErrors}) + end + + return ( nTotErr == 0), Stats +end + +------------------------------------------------------------------------------------------------------------- +return WinExec diff --git a/CAMAuto/LuaLibs/WinLib.lua b/CAMAuto/LuaLibs/WinLib.lua new file mode 100644 index 0000000..64fc393 --- /dev/null +++ b/CAMAuto/LuaLibs/WinLib.lua @@ -0,0 +1,142 @@ +-- WinLib.lua by Egalware s.r.l. 2024/06/14 +-- Libreria globale per Serramenti + +-- Tabella per definizione modulo +local WinLib = {} + +-- Include +require( 'EgtBase') +local WinData = require( 'WinData') + +EgtOutLog( ' WinLib started', 1) + +------------------------------------------------------------------------------------------------------------- +-- restituisce le facce della parte interessate dalla feature Proc +function WinLib.GetAffectedFaces( Proc, Part) + local vtFacesAffected = { bTop = false, bBottom = false, bFront = false, bBack = false, bLeft = false, bRight = false} + if Proc.b3Box and not Proc.b3Box:isEmpty() then + -- caso speciale foro + if Proc.sType == 'Hole' and Proc.sReferenceSide then + if Proc.sReferenceSide == Part.SideNames.sLeft then + vtFacesAffected.bLeft = true + elseif Proc.sReferenceSide == Part.SideNames.sRight then + vtFacesAffected.bRight = true + elseif Proc.sReferenceSide == Part.SideNames.sFront then + vtFacesAffected.bFront = true + elseif Proc.sReferenceSide == Part.SideNames.sBack then + vtFacesAffected.bBack = true + end + -- caso speciale profili per pezzo con cambio-profilo + elseif Proc.sType == 'Profiling' and Proc.sProfileInfo == 'Mixed' then + if Proc.sReferenceSide == Part.SideNames.sLeft then + vtFacesAffected.bLeft = true + elseif Proc.sReferenceSide == Part.SideNames.sRight then + vtFacesAffected.bRight = true + elseif Proc.sReferenceSide == Part.SideNames.sFront then + vtFacesAffected.bFront = true + elseif Proc.sReferenceSide == Part.SideNames.sBack then + vtFacesAffected.bBack = true + end + -- caso speciale profili + elseif Proc.sType == 'Profiling' then + if not Part.SideNames then + Part.SideNames = {} + end + -- quando si settano i lati interessati, mi salvo anche il nome. + -- se c'è una rotazione di 180°, potrebbe essere che il lato LEFT del pezzo corrisponda al lato RIGHT della lavorazione. Stesso per IN/OUT + if Proc.b3Box:getMax():getX() < Part.b3Part:getCenter():getX() then + vtFacesAffected.bLeft = true + Part.SideNames.sLeft = Proc.sEntityName + elseif Proc.b3Box:getMin():getX() > Part.b3Part:getCenter():getX() then + vtFacesAffected.bRight = true + Part.SideNames.sRight = Proc.sEntityName + elseif Proc.b3Box:getMax():getY() < Part.b3Part:getCenter():getY() then + vtFacesAffected.bFront = true + Part.SideNames.sFront = Proc.sEntityName + elseif Proc.b3Box:getMin():getY() > Part.b3Part:getCenter():getY() then + vtFacesAffected.bBack = true + Part.SideNames.sBack = Proc.sEntityName + end + -- caso standard + else + if Proc.b3Box:getMax():getZ() > Part.b3Part:getMax():getZ() - 500 * GEO.EPS_SMALL then + vtFacesAffected.bTop = true + end + if Proc.b3Box:getMin():getZ() < Part.b3Part:getMin():getZ() + 500 * GEO.EPS_SMALL then + vtFacesAffected.bBottom = true + end + if Proc.b3Box:getMin():getY() < Part.b3Part:getMin():getY() + 500 * GEO.EPS_SMALL then + vtFacesAffected.bFront = true + end + if Proc.b3Box:getMax():getY() > Part.b3Part:getMax():getY() - 500 * GEO.EPS_SMALL then + vtFacesAffected.bBack = true + end + if Proc.b3Box:getMin():getX() < Part.b3Part:getMin():getX() + 500 * GEO.EPS_SMALL then + vtFacesAffected.bLeft = true + end + if Proc.b3Box:getMax():getX() > Part.b3Part:getMax():getX() - 500 * GEO.EPS_SMALL then + vtFacesAffected.bRight = true + end + end + end + + return vtFacesAffected +end + +------------------------------------------------------------------------------------------------------------- +function WinLib.SwapElements( Table, Pos1, Pos2) + Table[Pos1], Table[Pos2] = Table[Pos2], Table[Pos1] + return Table +end + +------------------------------------------------------------------------------------------------------------- +function WinLib.ChangeElementPositionInTable( Table, nCurrentPosition, nTargetPosition) + -- se indici uguali esco subito + if nTargetPosition == nCurrentPosition then + return Table + end + + local Item = Table[nCurrentPosition] + + if nTargetPosition > nCurrentPosition then + nTargetPosition = nTargetPosition - 1 + end + table.remove( Table, nCurrentPosition) + table.insert( Table, nTargetPosition, Item) + + return Table +end + + +------------------------------------------------------------------------------------------------------------- +function WinLib.GetAddGroup( PartId) + -- recupero il nome del gruppo di lavoro corrente + local sMchGrp = EgtGetMachGroupName( EgtGetCurrMachGroup() or GDB_ID.NULL) + if not sMchGrp then + return nil, nil + end + + -- cerco il gruppo aggiuntivo omonimo nel pezzo e se esiste lo restituisco + local AddGrpId = EgtGetFirstNameInGroup( PartId or GDB_ID.NULL, sMchGrp) + + -- restituisco Id e Nome + return AddGrpId, sMchGrp +end + + +------------------------------------------------------------------------------------------------------------- +function WinLib.GetPathMinRadius( IdCurve) + local dSmallRadius = 9999 + local InitIdEntity, LastIdEntity = EgtCurveDomain(IdCurve) + for i = InitIdEntity, LastIdEntity do + local dRadius = EgtCurveCompoRadius( IdCurve, i) + -- se è un arco ed è più piccolo del minimo, lo salvo + if dRadius and dRadius > 0 and dRadius < dSmallRadius then + dSmallRadius = dRadius + end + end + return dSmallRadius +end + +------------------------------------------------------------------------------------------------------------- +return WinLib \ No newline at end of file diff --git a/CAMAuto/ProcessWin.lua b/CAMAuto/ProcessWin.lua new file mode 100644 index 0000000..1bd789a --- /dev/null +++ b/CAMAuto/ProcessWin.lua @@ -0,0 +1,328 @@ +-- Process.lua by Egalware s.r.l. 2024/06/13 +-- Gestione calcolo disposizione e lavorazioni per serramenti +-- Si opera sulla macchina corrente +-- 2024/06/13 PRIMA VERSIONE + + +-- Intestazioni +require( 'EgtBase') +_ENV = EgtProtectGlobal() +EgtEnableDebug( false) + +-- TODO da cancellare quando verrà passato automaticamente da programma +local WIN = {} +WIN.BASEDIR = 'C:\\EgtData\\Window\\CAMAuto' + +-- Imposto direttorio libreria specializzata per serramenti +EgtAddToPackagePath( WIN.BASEDIR .. '\\LuaLibs\\?.lua') +-- Imposto direttorio strategie. N.B. Le strategie dovranno essere caricate con il nome del direttorio padre +EgtAddToPackagePath( WIN.BASEDIR .. '\\Strategies\\?.lua') + +-- Verifico che la macchina corrente sia abilitata per la lavorazione delle Travi +local sMachDir = EgtGetCurrMachineDir() +if not sMachDir then + EgtOutBox( 'Errore nel caricamento della macchina corrente', 'Lavora Serramenti', 'ERROR') + return +end +if not EgtExistsFile( sMachDir .. '\\Window\\WinData.lua') then + EgtOutBox( 'La macchina corrente non è configurata per lavorare serramenti', 'Lavora Serramenti', 'ERROR') + return +end + +-- Elimino direttori altre macchine e imposto direttorio macchina corrente per ricerca librerie +EgtRemoveBaseMachineDirFromPackagePath() +EgtAddToPackagePath( sMachDir .. '\\Window\\?.lua') + +-- Segnalazione avvio +EgtOutLog( '*** Window Process Start ***', 1) + +-- Carico le librerie +_G.package.loaded.WinData = nil +_G.package.loaded.WinExec = nil +_G.package.loaded.WinLib = nil +_G.package.loaded.FeatureData = nil +_G.package.loaded.MachiningLib = nil + +local WinExec = require( 'WinExec') + +-- Carico i dati globali +local WinData = require( 'WinData') + +-- Variabili globali +PARTS = {} + +-- Colore del grezzo +local ColA = Color3d( 255, 165, 0, 30) + +------------------------------------------------------------------------------------------------------------- +-- *** Recupero i pezzi da processare *** +------------------------------------------------------------------------------------------------------------- +local function MyProcessInputData() + -- Recupero le travi selezionate + local nId = EgtGetFirstSelectedObj() + while nId do + local nPartId = EgtGetParent( EgtGetParent( nId or GDB_ID.NULL) or GDB_ID.NULL) + if nPartId then + local bFound = false + for i = 1, #PARTS do + if PARTS[i].id == nPartId then + bFound = true + break + end + end + if not bFound then + table.insert( PARTS, { nInd = #PARTS + 1, id = nPartId, sName = ( EgtGetName( nPartId) or ( 'Id=' .. tonumber( nPartId)))}) + end + end + nId = EgtGetNextSelectedObj() + end + if #PARTS == 0 then + EgtOutBox( 'Non sono state selezionati pezzi', 'Lavora Pezzi', 'ERROR') + return false + else + -- recupero tutte le dimensioni necessarie + local sOut = '' + for i = 1, #PARTS do + PARTS[i].b3Raw = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[i].id, 'GeoRaw') or GDB_ID.NULL, GDB_BB.STANDARD) + PARTS[i].b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[i].id, 'Geo') or GDB_ID.NULL, GDB_BB.STANDARD) + local idFrame = EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( PARTS[i].id, 'GeoRaw'), 'AuxFrame') + PARTS[i].frame = EgtFR( idFrame) + sOut = sOut .. PARTS[i].sName .. ', ' + end + sOut = sOut:sub( 1, -3) + EgtOutLog( 'Pezzi selezionati : ' .. sOut, 1) + end + + EgtDeselectAll() + + return true +end + +------------------------------------------------------------------------------------------------------------- +local function GetDataConfig() + -- recupero utensili dal magazzino + WinExec.GetToolsFromDB() + + -- TODO da gestire eventuali errori bloccanti + return true +end + +------------------------------------------------------------------------------------------------------------- +local function GetDispOffsetFromNotes( nPieceIndex) + local bAllOffsetsAreOk = false + + PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetX = 0 -- dovrà essere calcolato in base alle lavorazioni + PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetY = EgtGetInfo( PARTS[nPieceIndex].id, 'OFFY_1', 'd') + PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetZ = EgtGetInfo( PARTS[nPieceIndex].id, 'OFFZ_1', 'd') + PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetX = 0 -- dovrà essere calcolato in base alle lavorazioni + PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetY = EgtGetInfo( PARTS[nPieceIndex].id, 'OFFY_2', 'd') + PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetZ = EgtGetInfo( PARTS[nPieceIndex].id, 'OFFZ_2', 'd') + + -- controllo se tutti gli offset siano settati + if PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetY and PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetZ and + PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetY and PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetZ then + bAllOffsetsAreOk = true + end + + return bAllOffsetsAreOk +end + +------------------------------------------------------------------------------------------------------------- +local function GetDispOffsetFromInput( nPieceIndex) + -- assegno alle stringhe i valori letti, in modo che vengano proposti quelli nel dialogo + local sOffYPh1 = EgtIf( PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetY, tostring( PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetY), tostring( PARTS[nPieceIndex].dPartWidth / 2)) + local sOffZPh1 = EgtIf( PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetZ, tostring( PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetZ), '0') + local sOffYPh2 = EgtIf( PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetY, tostring( PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetY), tostring( PARTS[nPieceIndex].dPartWidth / 2)) + local sOffZPh2 = EgtIf( PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetZ, tostring( PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetZ), '0') + + local vInp = EgtDialogBox( 'Dati di disposizione pezzo: ' .. PARTS[nPieceIndex].sName, + {'Sporgenza laterale FASE1', sOffYPh1}, {'Posizione Z FASE1', sOffZPh1}, + {'Sporgenza laterale FASE2', sOffYPh2}, {'Posizione Z FASE2', sOffZPh2}) + if not vInp or #vInp == 0 then + return false + end + + -- salvo input nei valori che utilizzerò dopo + PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetY = tonumber( vInp[1]) + PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetZ = tonumber( vInp[2]) + PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetY = tonumber( vInp[3]) + PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetZ = tonumber( vInp[4]) + + return true +end + +--------------------------------------------------------------------- +-- Crea il grezzo che verrà messo in macchina +--------------------------------------------------------------------- +local function AddOverMaterialToRaw( PARTS) + for i = 1, #PARTS do + + -- prima di aggiungere sovramateriale al grezzo, calcolo dimensioni del finito + local b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[i].id, 'Geo') or GDB_ID.NULL, GDB_BB.STANDARD) + PARTS[i].b3Part = b3Part + PARTS[i].dPartLength = PARTS[i].b3Part:getDimX() + PARTS[i].dPartWidth = PARTS[i].b3Part:getDimY() + PARTS[i].dPartHeight = PARTS[i].b3Part:getDimZ() + + -- recupero sovramateriale + PARTS[i].RawOffset = {} + -- recupero info sovramateriale + PARTS[i].RawOffset.dOverMatIn = EgtGetInfo( PARTS[i].id, 'OVERMAT_IN', 'd') or 5 + PARTS[i].RawOffset.dOverMatOut = EgtGetInfo( PARTS[i].id, 'OVERMAT_OUT', 'd') or 5 + PARTS[i].RawOffset.dOverMatLeft = EgtGetInfo( PARTS[i].id, 'OVERMAT_LEFT', 'd') or 5 + PARTS[i].RawOffset.dOverMatRight = EgtGetInfo( PARTS[i].id, 'OVERMAT_RIGHT', 'd') or 5 + + PARTS[i].dRawLength = PARTS[i].RawOffset.dOverMatLeft + PARTS[i].dPartLength + PARTS[i].RawOffset.dOverMatRight + PARTS[i].dRawWidth = PARTS[i].RawOffset.dOverMatOut + PARTS[i].dPartWidth + PARTS[i].RawOffset.dOverMatIn + PARTS[i].dRawHeight = PARTS[i].dPartHeight + + EgtModifyRawPartSize( PARTS[i].idRaw, PARTS[i].dRawLength, PARTS[i].dRawWidth, PARTS[i].dPartHeight) + + local vtMove = Vector3d( PARTS[i].RawOffset.dOverMatLeft, PARTS[i].RawOffset.dOverMatOut, 0) + EgtMovePartInRawPart( PARTS[i].id, vtMove) + + -- TODO da controllare, se ruotato di 180° bisognerebbe prendere dOverMatIn. Lo stesso per la X + PARTS[i].OffsetPartToRaw = {} + PARTS[i].OffsetPartToRaw.X = PARTS[i].RawOffset.dOverMatLeft + PARTS[i].OffsetPartToRaw.Y = PARTS[i].RawOffset.dOverMatOut + end +end + +--------------------------------------------------------------------- +-- Crea il grezzo che verrà messo in macchina +--------------------------------------------------------------------- +local function CreateRaws( PARTS) + for i = 1, #PARTS do + -- si crea un grezzo "finto" (un cubo da 100mm) nell'origine del pezzo, verrà poi dimensionato uan volta adeguato con i vari sovramateriali + PARTS[i].idRaw = EgtAddRawPart( PARTS[i].frame:getOrigin(), 100, 100, 100, ColA) + EgtAddPartToRawPart( PARTS[i].id, ORIG(), PARTS[i].idRaw) + end +end + +--------------------------------------------------------------------- +-- Allinea i pezzi in base a come devono essere disposti sulla tavola +--------------------------------------------------------------------- +-- TODO in questa fase bisogna già sapere qual è la prima fase e posizionare il pezzo di conseguenza +-- TODO (bassa priorità) adesso allinea sempre in X, ma bisognerebbe farlo in base ad un parametro in WINDATA che dice come si dispongono in macchina +local function AlignRawsToTable( PARTS) + for i = 1, #PARTS do + -- allineo il pezzo all'interno del grezzo + local dRotX, dRotY, dRotZ = GetFixedAxesRotABCFromFrame( PARTS[i].frame) + -- se devo ruotare + if abs( dRotZ) > GEO.EPS_ANG_SMALL then + EgtRotatePartInRawPart( PARTS[i].id, Z_AX(), -dRotZ) + end + -- sposto punto in basso a sinistra del pezzo sul punto in basso a sinistra del grezzo + local b3Part = EgtGetBBoxGlob( PARTS[i].id, GDB_BB.ONLY_VISIBLE) + local dPartPosX = b3Part:getMin():getX() + local dPartPosY = b3Part:getMin():getY() + local dPartPosZ = b3Part:getMin():getZ() + local b3Raw = EgtGetRawPartBBox( PARTS[i].idRaw) + local dRawPosX = b3Raw:getMin():getX() + local dRawPosY = b3Raw:getMin():getY() + local dRawPosZ = b3Raw:getMin():getZ() + local vtMove = Vector3d( dRawPosX - dPartPosX, dRawPosY - dPartPosY, dRawPosZ - dPartPosZ) + EgtMovePartInRawPart( PARTS[i].id, vtMove) + end + return true +end + +------------------------------------------------------------------------------------------------------------- +-- *** Funzione per trovare nome MachGroup *** +------------------------------------------------------------------------------------------------------------- +local function NewMachGroupName() +local nMachGroupId = EgtGetFirstMachGroup() + if not nMachGroupId then return '1' end + local nMaxMachGroup = 0 + while nMachGroupId do + local sMachGroupName = EgtGetMachGroupName( nMachGroupId) + local nMachGroupName = tonumber( sMachGroupName) + if nMachGroupName > nMaxMachGroup then + nMaxMachGroup = nMachGroupName + end + nMachGroupId = EgtGetNextMachGroup( nMachGroupId) + end + return tostring( nMaxMachGroup + 1) +end + +------------------------------------------------------------------------------------------------------------- +-- *** Inserimento delle travi nel grezzo *** +------------------------------------------------------------------------------------------------------------- +local function MyProcessPieces() + + -- creo macchinata + local MachGroupName = NewMachGroupName() + local nMachGroup = EgtAddMachGroup( MachGroupName) + + -- si crea il grezzo + CreateRaws( PARTS) + + -- allineo i pezzi come orientamento richiesto dalla macchina + AlignRawsToTable( PARTS) + + -- aggiungo sovramateriale ai grezzi + AddOverMaterialToRaw( PARTS) + + -- recupero offset per posizionamento + for i = 1, #PARTS do + PARTS[i].DispOffsets = {} + PARTS[i].DispOffsets.Phase1 = {} + PARTS[i].DispOffsets.Phase2 = {} + + local bInsertedAllOffs = GetDispOffsetFromNotes( i) + -- se non sono settati nelle note, li chiedo + if not bInsertedAllOffs then + bInsertedAllOffs = GetDispOffsetFromInput( i) + end + -- se non sono stati inseriti o c'è stato un errore esco subito + if not bInsertedAllOffs then + return false + end + end + + -- si dispongono i pezzi sulla tavola + local bDispOk, sErr = WinData.ExecDisposition( PARTS) + if not bDispOk then + if not sErr then + sErr = 'Errore non gestito in WinData.ExecDisposition' + end + EgtOutBox( sErr, 'ProcessWin', 'ERROR', 'OK') + return false + end + + -- Impostazione dell'attrezzaggio di default + local bOk = EgtImportSetup() + if not bOk then + EgtImportSetup( 'Default') + end + + return true +end + +------------------------------------------------------------------------------------------------------------- +-- *** Inserimento delle lavorazioni *** +------------------------------------------------------------------------------------------------------------- +local function MyProcessFeatures() + local bOk = WinExec.ProcessFeatures( PARTS) + + return true +end + +------------------------------------------------------------------------------------------------------------- +-- *** Esecuzione *** +------------------------------------------------------------------------------------------------------------- + +-- nascondo geometrie varie +local vAuxId = { EgtGetFirstNameInGroup( GDB_ID.ROOT, 'Profile'), EgtGetFirstNameInGroup( GDB_ID.ROOT, 'Area*'), EgtGetFirstNameInGroup( GDB_ID.ROOT, 'Aux')} +EgtSetStatus( vAuxId, GDB_ST.OFF) + +if not MyProcessInputData() then return end + +if not MyProcessPieces() then return end + +if not GetDataConfig() then return end + +-- Abilito Vmill +EgtSetInfo( EgtGetCurrMachGroup(), 'Vm', '1') + +if not MyProcessFeatures() then return end diff --git a/CAMAuto/Strategies/Cutting.lua b/CAMAuto/Strategies/Cutting.lua new file mode 100644 index 0000000..ceb4d3d --- /dev/null +++ b/CAMAuto/Strategies/Cutting.lua @@ -0,0 +1,22 @@ +-- Cutting.lua by Egalware s.r.l. 2024/06/13 +-- Libreria esecuzione lavorazioni per Serramenti -> Lavorazione di taglio + +-- Tabella per definizione modulo +local Cutting = {} + +-- Include +require( 'EgtBase') + +-- Carico i dati globali +local WinData = require( 'WinData') + +EgtOutLog( ' Cutting started', 1) +EgtMdbSave() + +------------------------------------------------------------------------------------------------------------- +function Cutting.Make( Proc, Part) + return true +end + +------------------------------------------------------------------------------------------------------------- +return Cutting \ No newline at end of file diff --git a/CAMAuto/Strategies/Drilling.lua b/CAMAuto/Strategies/Drilling.lua new file mode 100644 index 0000000..533e3cc --- /dev/null +++ b/CAMAuto/Strategies/Drilling.lua @@ -0,0 +1,81 @@ +-- Drilling.lua by Egalware s.r.l. 2024/06/13 +-- Libreria esecuzione lavorazioni per Serramenti -> Lavorazione di foratura + +-- Tabella per definizione modulo +local Drilling = {} + +-- Include +require( 'EgtBase') + +-- Carico i dati globali +local WinData = require( 'WinData') +local MachiningLib = require( 'MachiningLib') + +EgtOutLog( ' Drilling started', 1) +EgtMdbSave() + +------------------------------------------------------------------------------------------------------------- +-- funzione che decide se eseguire le forature dopo le profilature. Solo forature di testa inclinate. Altrimenti sempre prima. +local function IsDrillToMachineAfterProfile( Proc) + local bExecAfterProfile = false + if ( Proc.AffectedFaces.Left or Proc.AffectedFaces.Right) and abs( Proc.vtDir:getX()) > 0.15 then + bExecAfterProfile = true + end + return bExecAfterProfile +end + +------------------------------------------------------------------------------------------------------------- +function Drilling.Make( Proc, Part) + + local Machining = { LeadIn = {}, LeadOut = {}, Steps = {}} + local AuxiliaryData = {} + local ToolSearchParameters = {} + + -- cerco utensile punta a forare + ToolSearchParameters.dDiameter = Proc.dDiameter + ToolSearchParameters.dLength = Proc.dLength + local ToolInfo = MachiningLib.FindDrill( Proc, ToolSearchParameters) + + -- se trovato utensile + if ToolInfo.nToolIndex then + Machining.nType = MCH_OY.DRILLING + Machining.nToolIndex = ToolInfo.nToolIndex + Machining.sDepth = 'th' + Machining.Steps.dStep = TOOLS[ToolInfo.nToolIndex].dStep + Machining.Geometry = Proc.id + AuxiliaryData.bExecAfterProfile = IsDrillToMachineAfterProfile( Proc) + AuxiliaryData.bIsDrilling = true + AuxiliaryData.nIndexMachining = 1 + AuxiliaryData.nPhase = MachiningLib.GetPhaseMach( Proc) + Machining.dStartSafetyLength = MachiningLib.GetDrillAdditionalSafeDistanceToRaw( Proc, Part, Machining) + MachiningLib.AddNewMachining( Proc, Machining, AuxiliaryData) + else + -- provo a cercare una fresa che faccia una svuotatura + ToolSearchParameters.dMaxToolDiameter = Proc.dDiameter + ToolInfo = MachiningLib.FindDrill( Proc, ToolSearchParameters) + -- se trovato utensile + if ToolInfo.nToolIndex then + Machining.nType = MCH_OY.POCKETING + Machining.nSubType = MCH_POCK_SUB.SPIRALOUT + Machining.LeadIn.nType = MCH_POCK_LI.ZIGZAG + Machining.Steps.dStep = TOOLS[ToolInfo.nToolIndex].dStep + Machining.Steps.dSideStep = TOOLS[ToolInfo.nToolIndex].dSideStep + Machining.nToolIndex = ToolInfo.nToolIndex + Machining.LeadIn.dTangentDistance = TOOLS[ToolInfo.nToolIndex].dDiameter/2 + Machining.LeadIn.dElevation = TOOLS[ToolInfo.nToolIndex].dDiameter/2 + Machining.sDepth = 0 + Machining.Geometry = Proc.id + AuxiliaryData.bIsPocketingDrill = true + AuxiliaryData.nIndexMachining = 1 + AuxiliaryData.nPhase = MachiningLib.GetPhaseMach( Proc) + MachiningLib.AddNewMachining( Proc, Machining, AuxiliaryData) + else + return false + end + end + + return true +end + +------------------------------------------------------------------------------------------------------------- +return Drilling \ No newline at end of file diff --git a/CAMAuto/Strategies/Milling.lua b/CAMAuto/Strategies/Milling.lua new file mode 100644 index 0000000..b1dfe09 --- /dev/null +++ b/CAMAuto/Strategies/Milling.lua @@ -0,0 +1,22 @@ +-- Milling.lua by Egalware s.r.l. 2024/06/13 +-- Libreria esecuzione lavorazioni per Serramenti -> Lavorazione di fresatura + +-- Tabella per definizione modulo +local Milling = {} + +-- Include +require( 'EgtBase') + +-- Carico i dati globali +local WinData = require( 'WinData') + +EgtOutLog( ' Milling started', 1) +EgtMdbSave() + +------------------------------------------------------------------------------------------------------------- +function Milling.Make( Proc, Part) + return true +end + +------------------------------------------------------------------------------------------------------------- +return Milling \ No newline at end of file diff --git a/CAMAuto/Strategies/Pocketing.lua b/CAMAuto/Strategies/Pocketing.lua new file mode 100644 index 0000000..1759916 --- /dev/null +++ b/CAMAuto/Strategies/Pocketing.lua @@ -0,0 +1,22 @@ +-- Pocketing.lua by Egalware s.r.l. 2024/06/13 +-- Libreria esecuzione lavorazioni per Serramenti -> Lavorazione di svuotatura + +-- Tabella per definizione modulo +local Pocketing = {} + +-- Include +require( 'EgtBase') + +-- Carico i dati globali +local WinData = require( 'WinData') + +EgtOutLog( ' Pocketing started', 1) +EgtMdbSave() + +------------------------------------------------------------------------------------------------------------- +function Pocketing.Make( Proc, Part) + return true +end + +------------------------------------------------------------------------------------------------------------- +return Pocketing \ No newline at end of file diff --git a/CAMAuto/Strategies/Profiling.lua b/CAMAuto/Strategies/Profiling.lua new file mode 100644 index 0000000..2cffd44 --- /dev/null +++ b/CAMAuto/Strategies/Profiling.lua @@ -0,0 +1,109 @@ +-- Profiling.lua by Egalware s.r.l. 2024/06/13 +-- Libreria esecuzione lavorazioni per Serramenti -> Lavorazione di profilatura + +-- Tabella per definizione modulo +local Profiling = {} + +-- Include +require( 'EgtBase') + +-- Carico i dati globali +local WinData = require( 'WinData') +local WinLib = require( 'WinLib') +local MachiningLib = require( 'MachiningLib') + +EgtOutLog( ' Profiling started', 1) +EgtMdbSave() + +------------------------------------------------------------------------------------------------------------- +function Profiling.Make( Proc, Part) + + -- se so che utensili utilizzare, associazione diretta + if Proc.nToolsToUse > 0 then + for i = 1, Proc.nToolsToUse do + -- definizione liste + local Machining = { LeadIn = {}, LeadOut = {}, Steps = {}} + local AuxiliaryData = {} + local ToolSearchParameters = {} + -- ricerca utensile + ToolSearchParameters.sName = Proc.Tools[i].sName + ToolSearchParameters.dElevation = 0 + local ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters) + -- se trovato utensile + if ToolInfo.nToolIndex then + Machining.nType = MCH_MY.MILLING + Machining.nWorkside = MCH_MILL_WS.RIGHT + Machining.nToolIndex = ToolInfo.nToolIndex + Machining.sDepth = 0 + Machining.dRadialOffset = Proc.Tools[i].dRadialOffset + Machining.dLongitudinalOffset = Proc.Tools[i].dLongitudinalOffset + -- se il pezzo ha cambio-profilo + if Proc.sProfileInfo == 'Mixed' then + Machining.LeadIn.nType = MCH_MILL_LI.LINEAR + Machining.LeadOut.nType = MCH_MILL_LO.LINEAR + Machining.LeadIn.dTangentDistance = 0 + Machining.LeadIn.dPerpDistance = (TOOLS[ToolInfo.nToolIndex].dTotDiameter / 2) + 30 + Machining.LeadOut.dTangentDistance = 0 + Machining.LeadOut.dPerpDistance = (TOOLS[ToolInfo.nToolIndex].dTotDiameter / 2) + 30 + else + Machining.LeadIn.nType = MCH_MILL_LI.TANGENT + Machining.LeadOut.nType = MCH_MILL_LO.TANGENT + Machining.LeadIn.dTangentDistance = (TOOLS[ToolInfo.nToolIndex].dTotDiameter / 2) + 30 + Machining.LeadIn.dPerpDistance = (TOOLS[ToolInfo.nToolIndex].dTotDiameter / 2) + 30 + Machining.LeadOut.dTangentDistance = (TOOLS[ToolInfo.nToolIndex].dTotDiameter / 2) + 30 + Machining.LeadOut.dPerpDistance = 0 + end + Machining.Geometry = Proc.id + AuxiliaryData.bIsProfiling = true + AuxiliaryData.nIndexMachining = i + AuxiliaryData.nPhase = MachiningLib.GetPhaseMach( Proc) + MachiningLib.AddNewMachining( Proc, Machining, AuxiliaryData) + else + return false, 'Associated tool not found' + end + end + -- altrimenti cerco tra quelli disponibili + else + -- definizione liste + local Machining = { LeadIn = {}, LeadOut = {}, Steps = {}} + local AuxiliaryData = {} + local ToolSearchParameters = {} + -- se profilatura generica, cerco fresa che possa lavorare la geometria considerando spessore e raggio + if Proc.sProfileInfo == 'Generic' then + ToolSearchParameters.dElevation = abs( EgtCurveThickness( Proc.id)) + ToolSearchParameters.dMaxToolDiameter = WinLib.GetPathMinRadius( Proc.id) * 2 + ToolSearchParameters.sType = 'MILL_STD' + local ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters) + -- se trovato utensile + if ToolInfo.nToolIndex then + Machining.nType = MCH_MY.MILLING + Machining.nWorkside = MCH_MILL_WS.LEFT + Machining.nToolIndex = ToolInfo.nToolIndex + Machining.sDepth = ToolSearchParameters.dElevation + Machining.dRadialOffset = EgtGetInfo( Proc.id, 'OFFR', 'd') or 0 + Machining.dLongitudinalOffset = EgtGetInfo( Proc.id, 'OFFL', 'd') or 0 + + Machining.LeadIn.nType = MCH_MILL_LI.TANGENT + Machining.LeadOut.nType = MCH_MILL_LO.TANGENT + Machining.LeadIn.dTangentDistance = (TOOLS[ToolInfo.nToolIndex].dTotDiameter / 2) + Machining.LeadIn.dPerpDistance = (TOOLS[ToolInfo.nToolIndex].dTotDiameter / 2) + Machining.LeadOut.dTangentDistance = (TOOLS[ToolInfo.nToolIndex].dTotDiameter / 2) + Machining.LeadOut.dPerpDistance = (TOOLS[ToolInfo.nToolIndex].dTotDiameter / 2) + + Machining.Geometry = Proc.id + AuxiliaryData.bIsProfiling = true + AuxiliaryData.nIndexMachining = 1 + AuxiliaryData.nPhase = MachiningLib.GetPhaseMach( Proc) + MachiningLib.AddNewMachining( Proc, Machining, AuxiliaryData) + else + return false, 'Tool for generic profiling not found' + end + else + return false, 'Tool for profiling not found' + end + end + return true +end + +------------------------------------------------------------------------------------------------------------- +return Profiling \ No newline at end of file diff --git a/Designing/Main.lua b/Designing/Main.lua new file mode 100644 index 0000000..268fa05 --- /dev/null +++ b/Designing/Main.lua @@ -0,0 +1,743 @@ +-- +-- 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 = 2500 +local WindowHeight = 2000 + +local WindowTree + +local sProfilePath = 'C:\\EgtData\\EgtWindowMaker\\Profiles\\Profilo78.nge' + +------------------------------------------- ************** ------------------------------------------- + +-- ciclo principale + +EgtStartCounter() + +EgtNewFile() + +-- importo profilo prescelto +WinCreate.ImportProfile( sProfilePath) + +-- creo telaio generico +local FrameJointType = WIN_JNT.FULL_H +local vFrameJoints = { FrameJointType, FrameJointType, FrameJointType, FrameJointType} +local SashJointType = WIN_JNT.FULL_V +local vSashJoints = { SashJointType, SashJointType, SashJointType, SashJointType} + +-- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPES.RECT, vFrameJoints, WindowWidth, WindowHeight) +-- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPES.CHAMFER_SIDE, vFrameJoints, WindowWidth, WindowHeight, WindowHeight + 500) + local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPES.CHAMFER_SIDE, vFrameJoints, WindowWidth, WindowHeight + 500, WindowHeight) +-- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPES.ROUND_ARC, vFrameJoints, WindowWidth, WindowHeight) +-- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPES.SEGMENTAL_ARC, { FrameJointType, FrameJointType, FrameJointType, FrameJointType}, 1500, 1800, 2200) +-- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPES.CHAMFER, { FrameJointType, FrameJointType, FrameJointType, FrameJointType, FrameJointType}, WindowWidth, WindowHeight, WindowHeight + 500) +-- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPES.POINTED_ARC, { FrameJointType, FrameJointType, FrameJointType, FrameJointType, FrameJointType}, 900, 1500, 2100) + +------------------------ Aggiunta split a griglia ------------------------ +-- WinCreate.AddGridSplits( nFrameId, WIN_MEASURE.ABSOLUT, {900, 900}, {500, 500, 500, 600, 150, 150}, true, 1) + WinCreate.AddGridSplits( nFrameId, WIN_MEASURE.PERCENTAGE, {0.33, 0.33}, {0.3, 0.3}, true, 1) +-- WinCreate.AddGridSplits( nFrameId, WIN_MEASURE.PROPORTIONAL, {1, 1, 1}, {1, 1, 1}, true, 1) + +------------------------ Cambi profilo ------------------------ +-- vetro/anta +-- local vAreas = WinCreate.AddSplits( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, { 0.5}, 1) +-- WinCreate.AddFill( vAreas[1], WIN_FILLTYPES.GLASS) +-- WinCreate.AddSash( vAreas[2], vSashJoints) + +-- vetro/anta orizzontale +-- local vAreas = WinCreate.AddSplits( nFrameId, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.PERCENTAGE, { 0.5}, 1) +-- WinCreate.AddFill( vAreas[1], WIN_FILLTYPES.GLASS) +-- WinCreate.AddSash( vAreas[2], vSashJoints) + +-- anta/vetro +-- local vAreas = WinCreate.AddSplits( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, { 0.5}, 1) +-- WinCreate.AddFill( vAreas[2], WIN_FILLTYPES.GLASS) +-- WinCreate.AddSash( vAreas[1], vSashJoints) + +-- vetro/anta/vetro +-- local vAreas = WinCreate.AddSplits( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, { 0.33, 0.33}, 1) +-- WinCreate.AddFill( vAreas[1], WIN_FILLTYPES.GLASS) +-- WinCreate.AddSash( vAreas[2], vSashJoints) +-- WinCreate.AddFill( vAreas[3], WIN_FILLTYPES.GLASS) + +-- vetro/anta/anta +-- local vAreas = WinCreate.AddSplits( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, { 0.33, 0.33}, 1) +-- WinCreate.AddFill( vAreas[1], WIN_FILLTYPES.GLASS) +-- WinCreate.AddSash( vAreas[2], vSashJoints) +-- WinCreate.AddSash( vAreas[3], vSashJoints) + +-- anta battente/anta ricevente/vetro +-- local vAreas = WinCreate.AddSplits( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, { 0.66}, 1) +-- local vAreas2 = WinCreate.AddSplits( vAreas[1], WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, { 0.5}, 1, WIN_SPLITTYPES.FRENCH) +-- WinCreate.AddSash( vAreas2[1], vSashJoints, WIN_SASHTYPES.ACTIVE) +-- WinCreate.AddSash( vAreas2[2], vSashJoints, WIN_SASHTYPES.INACTIVE) +-- WinCreate.AddFill( vAreas[2], WIN_FILLTYPES.GLASS) + +-- vetro/anta/vetro/anta +-- local vAreas = WinCreate.AddSplits( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, { 0.5}, 1) +-- local vAreas2 = WinCreate.AddSplits( vAreas[1], WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, { 0.5}, 1) +-- local vAreas3 = WinCreate.AddSplits( vAreas[2], WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, { 0.5}, 1) +-- WinCreate.AddFill( vAreas2[1], WIN_FILLTYPES.GLASS) +-- WinCreate.AddFill( vAreas3[1], WIN_FILLTYPES.GLASS) +-- WinCreate.AddSash( vAreas2[2], vSashJoints) +-- WinCreate.AddSash( vAreas3[2], vSashJoints) + +-- vetro/anta/vetro/anta +-- local vAreas = WinCreate.AddSplits( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, { 0.25}, 1) +-- WinCreate.AddFill( vAreas[1], WIN_FILLTYPES.GLASS) +-- local vAreas2 = WinCreate.AddSplits( vAreas[2], WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, { 0.75}, 1) +-- WinCreate.AddSash( vAreas2[2], vSashJoints) +-- local vAreas3 = WinCreate.AddSplits( vAreas2[1], WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, { 0.5}, 1) +-- WinCreate.AddSash( vAreas3[1], vSashJoints) +-- WinCreate.AddFill( vAreas3[2], WIN_FILLTYPES.GLASS) + +-- con split +-- local vAreas = WinCreate.AddSplits( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, { 0.5}, 1) +-- WinCreate.AddSash( vAreas[1], vSashJoints) +-- local vAreas2 = WinCreate.AddSplits( vAreas[2], WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.PERCENTAGE, { 0.5}, 1) +-- WinCreate.AddFill( vAreas2[1], WIN_FILLTYPES.GLASS) +-- WinCreate.AddFill( vAreas2[2], WIN_FILLTYPES.GLASS) + +-- con split nell'anta +-- local vAreas = WinCreate.AddSplits( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, { 0.5}, 1) +-- local nSash = WinCreate.AddSash( vAreas[1], vSashJoints) +-- WinCreate.AddFill( vAreas[2], WIN_FILLTYPES.GLASS) +-- WinCreate.AddSplits( nSash, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.PERCENTAGE, { 0.5}, 1) + + + +------------------------ Alzante Scorrevole ------------------------ + +-- anta mobile a sx +-- local vAreas = WinCreate.AddSplits( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, { 0.5}, 1, WIN_SPLITTYPES.FRENCH) +-- local nSash1 = WinCreate.AddSash( vAreas[1], vSashJoints, WIN_SASHTYPES.SLIDE_MOVABLE) +-- local nSash2 = WinCreate.AddSash( vAreas[2], vSashJoints, WIN_SASHTYPES.SLIDE_FIXED) +-- WinCreate.AddFill( nSash1, WIN_FILLTYPES.GLASS) +-- WinCreate.AddFill( nSash2, WIN_FILLTYPES.GLASS) + +-- anta mobile a dx +-- local vAreas = WinCreate.AddSplits( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, { 0.5}, 1, WIN_SPLITTYPES.FRENCH) +-- local nSash1 = WinCreate.AddSash( vAreas[1], vSashJoints, WIN_SASHTYPES.SLIDE_FIXED) +-- local nSash2 = WinCreate.AddSash( vAreas[2], vSashJoints, WIN_SASHTYPES.SLIDE_MOVABLE) +-- WinCreate.AddFill( nSash1, WIN_FILLTYPES.GLASS) +-- WinCreate.AddFill( nSash2, WIN_FILLTYPES.GLASS) + +-- 2 ante mobili, sx davanti +-- local vAreas = WinCreate.AddSplits( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, { 0.5}, 1, WIN_SPLITTYPES.FRENCH) +-- local nSash1 = WinCreate.AddSash( vAreas[1], vSashJoints, WIN_SASHTYPES.SLIDE_MOVABLE) +-- local nSash2 = WinCreate.AddSash( vAreas[2], vSashJoints, WIN_SASHTYPES.SLIDE_MOVABLE_BACK) +-- WinCreate.AddFill( nSash1, WIN_FILLTYPES.GLASS) +-- WinCreate.AddFill( nSash2, WIN_FILLTYPES.GLASS) + +-- 2 ante mobili, dx davanti +-- local vAreas = WinCreate.AddSplits( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, { 0.5}, 1, WIN_SPLITTYPES.FRENCH) +-- local nSash1 = WinCreate.AddSash( vAreas[1], vSashJoints, WIN_SASHTYPES.SLIDE_MOVABLE_BACK) +-- local nSash2 = WinCreate.AddSash( vAreas[2], vSashJoints, WIN_SASHTYPES.SLIDE_MOVABLE) +-- WinCreate.AddFill( nSash1, WIN_FILLTYPES.GLASS) +-- WinCreate.AddFill( nSash2, WIN_FILLTYPES.GLASS) + +-- 4 ante, le centrali sono mobili +-- local vAreas = WinCreate.AddSplits( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, { 0.25, 0.25, 0.25}, 1, WIN_SPLITTYPES.FRENCH) +-- local nSash1 = WinCreate.AddSash( vAreas[1], vSashJoints, WIN_SASHTYPES.SLIDE_FIXED) +-- local nSash2 = WinCreate.AddSash( vAreas[2], vSashJoints, WIN_SASHTYPES.SLIDE_MOVABLE) +-- local nSash3 = WinCreate.AddSash( vAreas[3], vSashJoints, WIN_SASHTYPES.SLIDE_MOVABLE) +-- local nSash4 = WinCreate.AddSash( vAreas[4], vSashJoints, WIN_SASHTYPES.SLIDE_FIXED) +-- WinCreate.AddFill( nSash1, WIN_FILLTYPES.GLASS) +-- WinCreate.AddFill( nSash2, WIN_FILLTYPES.GLASS) +-- WinCreate.AddFill( nSash3, WIN_FILLTYPES.GLASS) +-- WinCreate.AddFill( nSash4, WIN_FILLTYPES.GLASS) + +-- 4 ante mobili +-- local vAreas = WinCreate.AddSplits( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, { 0.25, 0.25, 0.25}, 1, WIN_SPLITTYPES.FRENCH) +-- local nSash1 = WinCreate.AddSash( vAreas[1], vSashJoints, WIN_SASHTYPES.SLIDE_MOVABLE_BACK) +-- local nSash2 = WinCreate.AddSash( vAreas[2], vSashJoints, WIN_SASHTYPES.SLIDE_MOVABLE) +-- local nSash3 = WinCreate.AddSash( vAreas[3], vSashJoints, WIN_SASHTYPES.SLIDE_MOVABLE) +-- local nSash4 = WinCreate.AddSash( vAreas[4], vSashJoints, WIN_SASHTYPES.SLIDE_MOVABLE_BACK) +-- WinCreate.AddFill( nSash1, WIN_FILLTYPES.GLASS) +-- WinCreate.AddFill( nSash2, WIN_FILLTYPES.GLASS) +-- WinCreate.AddFill( nSash3, WIN_FILLTYPES.GLASS) +-- WinCreate.AddFill( nSash4, WIN_FILLTYPES.GLASS) + + +------------------------ 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 nSashId = WinCreate.AddSash( nFrameId, vSashJoints) +-- +-- -- aggiungo vetro +-- local nFillId = WinCreate.AddFill( nSashId, WIN_FILLTYPES.GLASS) + +------------------------ Finestra anta singola con divisione orizzontale ------------------------ + +-- -- aggiungo anta +-- local nSashId = WinCreate.AddSash( nFrameId, vSashJoints) +-- +-- -- 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 nSashId = WinCreate.AddSash( nFrameId, vSashJoints) +-- +-- -- 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 nSashId = WinCreate.AddSash( nFrameId, vSashJoints) +-- +-- -- 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 nSashId = WinCreate.AddSash( nFrameId, vSashJoints) + +-- 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 nSash1Id = WinCreate.AddSash( nArea1Id, vSashJoints) +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea2Id, vSashJoints) +-- -- 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 nSash1Id = WinCreate.AddSash( nArea1Id, vSashJoints, WIN_SASHTYPES.INACTIVE) +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea2Id, vSashJoints, 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 nSash1Id = WinCreate.AddSash( nArea1Id, vSashJoints) +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea2Id, vSashJoints) +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) + +------------------------ Finestra tripla anta con montanti verticali ------------------------ + +-- -- definisco prima divisione +-- local nArea1Id, nArea0Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) +-- -- definisco seconda divisione +-- local nArea2Id, nArea3Id = WinCreate.AddSplit( nArea0Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) +-- +-- -- aggiungo prima anta +-- local nSash1Id = WinCreate.AddSash( nArea1Id, vSashJoints) +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea2Id, vSashJoints) +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo terza anta +-- local nSash3Id = WinCreate.AddSash( nArea3Id, vSashJoints) +-- -- aggiungo vetro +-- local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) + +------------------------ Finestra tripla anta con montanti verticali(2) ------------------------ + +-- -- definisco divisioni +-- local nAreaList = WinCreate.AddSplits( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, { WindowWidth / 3, WindowWidth / 3}) +-- -- local nAreaList = WinCreate.AddSplits( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PROPORTIONAL, { 1, 1}, 3) +-- -- local nAreaList = WinCreate.AddSplits( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, { 0.33, 0.33}, 1) +-- +-- -- aggiungo prima anta +-- local nSash1Id = WinCreate.AddSash( nAreaList[1], vSashJoints) +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nAreaList[2], vSashJoints) +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo terza anta +-- local nSash3Id = WinCreate.AddSash( nAreaList[3], vSashJoints) +-- -- aggiungo vetro +-- local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) + +------------------------ Finestra tripla anta con montante verticale e ante battente e ricevente ------------------------ + +-- -- definisco prima divisione +-- local nArea1Id, nArea0Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) +-- -- definisco seconda divisione +-- local nArea2Id, nArea3Id = WinCreate.AddSplit( nArea0Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3, _, WIN_SPLITTYPES.FRENCH) +-- +-- -- aggiungo prima anta +-- local nSash1Id = WinCreate.AddSash( nArea1Id, vSashJoints) +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea2Id, vSashJoints, WIN_SASHTYPES.INACTIVE) +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo terza anta +-- local nSash3Id = WinCreate.AddSash( nArea3Id, vSashJoints, WIN_SASHTYPES.ACTIVE) +-- -- aggiungo vetro +-- local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) + +------------------------ Finestra tripla anta con montanti orizzontali ------------------------ + +-- -- definisco prima divisione +-- local nArea1Id, nArea0Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight / 3) +-- -- definisco seconda divisione +-- local nArea2Id, nArea3Id = WinCreate.AddSplit( nArea0Id, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, 2 / 3 * WindowHeight) +-- +-- -- aggiungo prima anta +-- local nSash1Id = WinCreate.AddSash( nArea1Id, vSashJoints) +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea2Id, vSashJoints) +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo terza anta +-- local nSash3Id = WinCreate.AddSash( nArea3Id, vSashJoints) +-- -- aggiungo vetro +-- local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) + +---------------------- Finestra tripla anta con montante orizzontale e verticale ------------------------ + +-- -- definisco divisioni +-- local nArea1Id, nArea0Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight / 2) +-- local nArea2Id, nArea3Id = WinCreate.AddSplit( nArea0Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 2) +-- +-- -- aggiungo prima anta +-- local nSash1Id = WinCreate.AddSash( nArea1Id, vSashJoints) +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea2Id, vSashJoints) +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo terza anta +-- local nSash3Id = WinCreate.AddSash( nArea3Id, vSashJoints) +-- -- aggiungo vetro +-- local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) + +------------------------ Finestra tripla anta battente / ricevente / ricevente ------------------------ + +-- -- definisco divisioni +-- local nArea1Id, nArea0Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3, _, WIN_SPLITTYPES.FRENCH) +-- local nArea2Id, nArea3Id = WinCreate.AddSplit( nArea0Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3, _, WIN_SPLITTYPES.FRENCH) +-- +-- -- aggiungo prima anta +-- local nSash1Id = WinCreate.AddSash( nArea1Id, vSashJoints, WIN_SASHTYPES.ACTIVE) +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea2Id, vSashJoints, WIN_SASHTYPES.INACTIVE_IN) +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo terza anta +-- local nSash3Id = WinCreate.AddSash( nArea3Id, vSashJoints, WIN_SASHTYPES.INACTIVE_OUT) +-- -- aggiungo vetro +-- local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) + +------------------------ Finestra tripla anta battente / battente / ricevente ------------------------ + +-- -- definisco divisioni +-- local nArea1Id, nArea0Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3, _, WIN_SPLITTYPES.FRENCH) +-- local nArea2Id, nArea3Id = WinCreate.AddSplit( nArea0Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3, _, WIN_SPLITTYPES.FRENCH) +-- +-- -- aggiungo prima anta +-- local nSash1Id = WinCreate.AddSash( nArea1Id, vSashJoints, WIN_SASHTYPES.ACTIVE_OUT) +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea2Id, vSashJoints, WIN_SASHTYPES.ACTIVE_IN) +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo terza anta +-- local nSash3Id = WinCreate.AddSash( nArea3Id, vSashJoints, WIN_SASHTYPES.INACTIVE) +-- -- aggiungo vetro +-- local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) + +------------------------ Finestra quattro ante battente / battente / ricevente / ricevente ------------------------ + +-- -- definisco divisioni +-- local nArea1Id, nAreaTmpId = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 4, _, WIN_SPLITTYPES.FRENCH) +-- local nArea2Id, nAreaTmp1Id = WinCreate.AddSplit( nAreaTmpId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 4, _, WIN_SPLITTYPES.FRENCH) +-- local nArea3Id, nArea4Id = WinCreate.AddSplit( nAreaTmp1Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 4, _, WIN_SPLITTYPES.FRENCH) +-- +-- -- aggiungo prima anta +-- local nSash1Id = WinCreate.AddSash( nArea1Id, vSashJoints, WIN_SASHTYPES.ACTIVE_OUT) +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea2Id, vSashJoints, WIN_SASHTYPES.ACTIVE_IN) +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo terza anta +-- local nSash3Id = WinCreate.AddSash( nArea3Id, vSashJoints, WIN_SASHTYPES.INACTIVE_IN) +-- -- aggiungo vetro +-- local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo quarta anta +-- local nSash4Id = WinCreate.AddSash( nArea4Id, vSashJoints, WIN_SASHTYPES.INACTIVE_OUT) +-- -- aggiungo vetro +-- local nFill4Id = WinCreate.AddFill( nSash4Id, WIN_FILLTYPES.GLASS) + +------------------------ Finestra sei ante con montanti verticali e orizzontale ------------------------ + +-- -- definisco divisione orizzontale +-- local nArea1Id, nArea2Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight / 2) +-- -- definisco divisioni verticali +-- local nArea11Id, nArea0Id = WinCreate.AddSplit( nArea1Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) +-- local nArea12Id, nArea13Id = WinCreate.AddSplit( nArea0Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) +-- local nArea21Id, nArea00Id = WinCreate.AddSplit( nArea2Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) +-- local nArea22Id, nArea23Id = WinCreate.AddSplit( nArea00Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) +-- +-- -- aggiungo prima anta +-- local nSash1Id = WinCreate.AddSash( nArea11Id, vSashJoints) +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea12Id, vSashJoints) +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo terza anta +-- local nSash3Id = WinCreate.AddSash( nArea13Id, vSashJoints) +-- -- aggiungo vetro +-- local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo quarta anta +-- local nSash4Id = WinCreate.AddSash( nArea21Id, vSashJoints) +-- -- aggiungo vetro +-- local nFill4Id = WinCreate.AddFill( nSash4Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo quinta anta +-- local nSash5Id = WinCreate.AddSash( nArea22Id, vSashJoints) +-- -- aggiungo vetro +-- local nFill5Id = WinCreate.AddFill( nSash5Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo sesta anta +-- local nSash6Id = WinCreate.AddSash( nArea23Id, vSashJoints) +-- -- 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, nArea0Id = WinCreate.AddSplit( nArea1Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) +-- local nArea12Id, nArea13Id = WinCreate.AddSplit( nArea0Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3, _, WIN_SPLITTYPES.FRENCH) +-- local nArea21Id, nArea00Id = WinCreate.AddSplit( nArea2Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) +-- local nArea22Id, nArea23Id = WinCreate.AddSplit( nArea00Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3, _, WIN_SPLITTYPES.FRENCH) +-- +-- -- aggiungo prima anta +-- local nSash1Id = WinCreate.AddSash( nArea11Id, vSashJoints) +-- -- aggiungo vetro +-- local nFill1Id = WinCreate.AddFill( nSash1Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea12Id, vSashJoints, WIN_SASHTYPES.INACTIVE) +-- -- aggiungo vetro +-- local nFill2Id = WinCreate.AddFill( nSash2Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo terza anta +-- local nSash3Id = WinCreate.AddSash( nArea13Id, vSashJoints, WIN_SASHTYPES.ACTIVE) +-- -- aggiungo vetro +-- local nFill3Id = WinCreate.AddFill( nSash3Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo quarta anta +-- local nSash4Id = WinCreate.AddSash( nArea21Id, vSashJoints) +-- -- aggiungo vetro +-- local nFill4Id = WinCreate.AddFill( nSash4Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo quinta anta +-- local nSash5Id = WinCreate.AddSash( nArea22Id, vSashJoints, WIN_SASHTYPES.INACTIVE) +-- -- aggiungo vetro +-- local nFill5Id = WinCreate.AddFill( nSash5Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo sesta anta +-- local nSash6Id = WinCreate.AddSash( nArea23Id, vSashJoints, WIN_SASHTYPES.ACTIVE) +-- -- aggiungo vetro +-- local nFill6Id = WinCreate.AddFill( nSash6Id, WIN_FILLTYPES.GLASS) + +------------------------ Finestra tre ante con montante verticale, ante battente ricevente e split di tutte le ante ------------------------ + +-- -- definisco prima divisione +-- local nArea1Id, nArea0Id = WinCreate.AddSplit( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) +-- -- definisco seconda divisione +-- local nArea2Id, nArea3Id = WinCreate.AddSplit( nArea0Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3, _, WIN_SPLITTYPES.FRENCH) +-- +-- -- aggiungo prima anta +-- local nSash1Id = WinCreate.AddSash( nArea1Id, vSashJoints) +-- -- definisco divisione +-- local nArea11Id, nArea12Id = WinCreate.AddSplit( nSash1Id, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight * 2 / 5) +-- -- aggiungo vetri +-- local nFill11Id = WinCreate.AddFill( nArea11Id, WIN_FILLTYPES.GLASS) +-- local nFill12Id = WinCreate.AddFill( nArea12Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea2Id, vSashJoints, WIN_SASHTYPES.INACTIVE) +-- -- definisco divisione +-- local nArea21Id, nArea22Id = WinCreate.AddSplit( nSash2Id, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight * 2 / 5) +-- -- aggiungo vetri +-- local nFill21Id = WinCreate.AddFill( nArea21Id, WIN_FILLTYPES.GLASS) +-- local nFill22Id = WinCreate.AddFill( nArea22Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo terza anta +-- local nSash3Id = WinCreate.AddSash( nArea3Id, vSashJoints, 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, 2 * WindowHeight / 3) +-- local nArea2Id, nArea00Id = WinCreate.AddSplit( nArea1Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3) +-- local nArea3Id, nArea4Id = WinCreate.AddSplit( nArea00Id, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.ABSOLUT, WindowWidth / 3, _, WIN_SPLITTYPES.FRENCH) +-- +-- -- aggiungo anta sopra +-- local nSash0Id = WinCreate.AddSash( nArea0Id, vSashJoints) +-- -- aggiungo vetri +-- local nFill0Id = WinCreate.AddFill( nSash0Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo prima anta +-- local nSash1Id = WinCreate.AddSash( nArea2Id, vSashJoints) +-- -- definisco divisione +-- local nArea11Id, nArea12Id = WinCreate.AddSplit( nSash1Id, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight * 2 / 5) +-- -- aggiungo vetri +-- local nFill11Id = WinCreate.AddFill( nArea11Id, WIN_FILLTYPES.GLASS) +-- local nFill12Id = WinCreate.AddFill( nArea12Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo seconda anta +-- local nSash2Id = WinCreate.AddSash( nArea3Id, vSashJoints, WIN_SASHTYPES.INACTIVE) +-- -- definisco divisione +-- local nArea21Id, nArea22Id = WinCreate.AddSplit( nSash2Id, WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, WindowHeight * 2 / 5) +-- -- aggiungo vetri +-- local nFill21Id = WinCreate.AddFill( nArea21Id, WIN_FILLTYPES.GLASS) +-- local nFill22Id = WinCreate.AddFill( nArea22Id, WIN_FILLTYPES.GLASS) +-- +-- -- aggiungo terza anta +-- local nSash3Id = WinCreate.AddSash( nArea4Id, vSashJoints, 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) + +----------------------------------------------------------------------------------- + +-- aggiungo ferramenta +-- WinCreate.AddHardware( nFrameId, '000545') + +-- imposto se calcolare i solidi o meno +-- WinCalculate.SetCalcSolid( true) + +-- creo i pezzi +-- WinCalculate.CreatePartFromArea( nFrameId) +-- WinCalculate.AddHardware( nFrameId) + +-- tronchetti +-- local nLogsNbr = 4 -- 0 per numero minimo +-- local vSections = { 100, 150, 80, 130, 120, 180} +-- local bAlign = false +-- local dOverMatOut = 10 +-- local dOverMatIn = 7 +-- local dOverMatExt = 5 +-- local dOverMatInt = 3 +-- local bCutExtremities = true +-- -- cero i pezzi top ad arco +-- local vTops = EgtGetNameInGroup( 0, WIN_TOP) +-- for i = 1, #vTops do +-- local nOutline = EgtGetInfo( vTops[i], WIN_REF_OUTLINE, 'i') +-- if EgtGetType( nOutline) == GDB_TY.CRV_ARC then +-- -- se anta richiedo allineamento con telaio +-- local nAreaId = EgtGetParent( EgtGetParent( nOutline)) +-- local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') +-- if nAreaType == WIN_AREATYPES.SASH then +-- bAlign = true +-- nLogsNbr = 0 +-- end +-- WinCalculate.CreateArcLogs( vTops[i], nLogsNbr, vSections, bAlign, dOverMatOut, dOverMatIn, dOverMatExt, dOverMatInt, bCutExtremities) +-- end +-- end + + +-- preparo per automatismo lavorazioni +-- WinCalculate.PrepareProject() + + +-- -- 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/Designing/WinConst.lua b/Designing/WinConst.lua new file mode 100644 index 0000000..fac0f32 --- /dev/null +++ b/Designing/WinConst.lua @@ -0,0 +1,436 @@ +-- +-- 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 telaio +WIN_FRAME_TYPES = { + RECT = 1, + CHAMFER_SIDE = 2, + CHAMFER = 3, + ROUND_ARC = 4, + SEGMENTAL_ARC = 5, + POINTED_ARC = 6, + TRG = 7, +} + +-- direzioni di split +WIN_SPLITORIENTATION = { + VERTICAL = 1, + HORIZONTAL = 2, +} + +-- tipi di misure +WIN_MEASURE = { + ABSOLUT = 1, + PROPORTIONAL = 2, + PERCENTAGE = 3, +} + +-- tipologia di figli +WIN_CHILDREN_TYPES = { + NULL = 0, + SASH = 1, + FILL = 2, + MIXED = 3, +} + +WIN_THRESHOLD_TYPES = { + NULL = 0, + ALU = 1, -- soglia + WOOD = 2, -- legno + WOOD_ALU = 3, -- gocciolatoio in alluminio +} + +WIN_SURF_APPROX = 0.05 + + + +-- AREE +WIN_AREA = 'Area' +WIN_AREA_NAME = 'AreaName' +WIN_FRAME = 'Frame' +WIN_SASH = 'Sash' +WIN_FILL = 'Fill' +WIN_SPLIT = 'Split' +WIN_FRAME_TYPE = 'FrameType' + +-- tipo di Area +WIN_AREATYPE = 'AreaType' +WIN_AREATYPES = { + NULL = 0, + FRAME = 1, + SASH = 2, + FILL = 3, + SPLIT = 4, +} + +-- tipi di split +WIN_SPLITTYPE = 'SplitType' +WIN_SPLITTYPES = { + NULL = 0, + MULLION = 1, -- montante + FRENCH = 2, -- battente / ricevente + MIXED = 3, -- cambio profilo +} + +-- tipi di riempimento interno +WIN_FILLTYPE = 'FillType' +WIN_FILLTYPES = { + NULL = 0, + GLASS = 1, + WOOD = 2, +} +WIN_GLASS = 'GLASS' +WIN_WOOD = 'WOOD' + +-- tipi di anta +WIN_SASHTYPE = 'SashType' +WIN_SASHTYPES = { + NULL = 0, + ACTIVE = 1, -- battente + INACTIVE = 2, -- ricevente + ACTIVE_IN = 3, -- battente contro ricevente ( nel caso di più ante battenti) + ACTIVE_OUT = 4, -- battente contro battente ( nel caso di più ante battenti) + INACTIVE_IN = 5, -- ricevente contro battente ( nel caso di più ante riceventi) + INACTIVE_OUT = 6, -- ricevente contro ricevente ( nel caso di più ante riceventi) + SLIDE_MOVABLE = 7, -- mobile in alzante scorrevole + SLIDE_FIXED = 8, -- fissa in alzante scorrevole + SLIDE_MOVABLE_BACK = 9, -- mobile più esterna in alzante scorrevole con tutte ante mobili +} +WIN_INACTIVE = 'INACTIVE' + +-- tipi di apertura ante +WIN_OPENING_TYPE = 'OpeningType' +WIN_OPENING_TYPES = { + NULL = 0, + TURNONLY_LEFT = 1, + TURNONLY_RIGHT = 2, + TILTTURN_LEFT = 3, + TILTTURN_RIGHT = 4, + TILTONLY_TOP = 5, + TILTONLY_BOTTOM = 6, + PIVOT = 7, + FIXED = 8, + COPLANARSLIDE_LEFT = 9, + COPLANARSLIDE_RIGHT = 10, + LIFTSLIDE_LEFT = 11, + LIFTSLIDE_RIGHT = 12, +} + +-- tipi di pezzo +WIN_PART_TYPE = 'PartType' +WIN_PART_TYPES = { + NULL = 0, + FILL = 1, + BOTTOMRAIL = 2, +} + +WIN_AREAOUTLINE = 'BaseOutline' +WIN_OUTLINE = 'Outline' +WIN_BASESPLIT = 'BaseSplit' +WIN_SELECTION = 'Selection' +WIN_SPLITSELECTION = 'SplitSelection' +WIN_SASH_OPENING = 'Opening' +WIN_AUX = 'Aux' +WIN_PREVIEW = 'Preview' + +WIN_BOTTOM = 'Bottom' +WIN_BOTTOMRAIL = 'BottomRail' +WIN_RIGHT = 'Right' +WIN_TOP = 'Top' +WIN_LEFT = 'Left' + +-- info varie su aree e curve +WIN_SOU = 'SOU' +WIN_CHILD = 'CHILD' +WIN_COPY = 'COPY' +WIN_REF_OUTLINE = 'OutlineRef' +WIN_REF_PART = 'PartRef' +WIN_REF_BOTTOMRAIL_PART = 'BottomRailPartRef' +WIN_PREV_OUTLINES = 'PrevOutlines' +WIN_NEXT_OUTLINES = 'NextOutlines' +WIN_REF_SPLIT = 'RefSplit' +WIN_PRJ_ORIGSPLIT = 'OrigSplit' +WIN_CRV_ON_FRENCH_SPLIT = 'OutlineOnFrenchSplit' +WIN_SPLIT_STARTINTERS = 'SplitStartInters' +WIN_SPLIT_ENDINTERS = 'SplitEndInters' +WIN_SASH_CHILDREN = 'SashChildren' +WIN_FILL_CHILDREN = 'FillChildren' +WIN_THRESHOLD_PROFILE = 'ThresholdProfile' +WIN_SLIDE_WINDOW = 'SlideWindow' + + +-- PROFILI +WIN_PROFILE = 'Profile' +WIN_PROFILEPATH = 'ProfilePath' +WIN_INFO_GRP = 'Info' + +-- nomi dei profili +WIN_SASH_TOP = 'Sash_Top' +WIN_SASH_BOTTOM = 'Sash_Bottom' +WIN_FIXED = 'Fixed' +WIN_FIXED_TOP = 'Fixed_Top' +WIN_FIXED_BOTTOM = 'Fixed_Bottom' +WIN_RAIL_BOTTOM = 'Rail_Bottom' +WIN_RAIL = 'Rail' +WIN_FILL_RAIL = 'Fill_Rail' +WIN_FRAME_SPLIT = 'Frame_Split' +WIN_SASH_VERTICAL = 'Sash_Vertical' +WIN_SASH_HORIZONTAL = 'Sash_Horizontal' +WIN_MIXED_BOTTOM = 'Mixed_Bottom' +WIN_MIXED_TOP = 'Mixed_Top' +WIN_MIXED_SPLIT = 'Mixed_Split' +WIN_SASH_THRESHOLD = 'Sash_Threshold' + +WIN_FRAME_TOP = 'Frame_Top' +WIN_FRAME_BOTTOM = 'Frame_Bottom' +WIN_SASH_ACTIVE = 'Sash_Active' +WIN_SASH_INACTIVE = 'Sash_Inactive' +WIN_FRENCH_IN = 'French_In' +WIN_FRENCH_OUT = 'French_Out' +WIN_SASH_SPLIT = 'Sash_Split' + +WIN_SLIDE = 'Slide' +WIN_MOVABLE = 'Movable' +WIN_SLIDE_MOVABLEBACK = 'Slide_MovableBack' +WIN_SLIDE_TOP = 'Slide_Top' +WIN_SLIDE_BOTTOM = 'Slide_Bottom' +WIN_SLIDE_MOVABLE = 'Slide_Movable' +WIN_SLIDE_FIXED = 'Slide_Fixed' +WIN_SLIDE_MOVABLE_TOP = 'Slide_Movable_Top' +WIN_SLIDE_MOVABLE_BOTTOM = 'Slide_Movable_Bottom' +WIN_SLIDE_MOVABLE_SIDE = 'Slide_Movable_Side' +WIN_SLIDE_MOVABLEBACK_TOP = 'Slide_MovableBack_Top' +WIN_SLIDE_MOVABLEBACK_BOTTOM = 'Slide_MovableBack_Bottom' +WIN_SLIDE_MOVABLEBACK_SIDE = 'Slide_MovableBack_Side' +WIN_SLIDE_FIXED_BOTTOM = 'Slide_Fixed_Bottom' +WIN_SLIDE_FIXED_TOP = 'Slide_Fixed_Top' +WIN_SLIDE_FIXED_SIDE = 'Slide_Fixed_Side' +WIN_SLIDE_ACTIVE = 'Slide_Active' +WIN_SLIDE_ACTIVE_IN = 'Slide_Active_In' +WIN_SLIDE_INACTIVE = 'Slide_Inactive' + +-- elementi dei profili +WIN_REF = 'Ref' +WIN_SECTIONFRAME = 'SectionFrame' +WIN_SECTION = 'Section' +WIN_IN = 'In' +WIN_CTRIN = 'CtrIn' +WIN_OUT = 'Out' +WIN_OFST = 'Ofst' +WIN_CTRINOFST = 'OfstCtrIn' +WIN_OUTOFST = 'OfstOut' +WIN_MIXED_COMMON = 'Common' +WIN_SIMPLIFIED = 'Simplified' +WIN_STRIP = 'Strip' +WIN_WATERDRIP = 'Waterdrip' +WIN_GASKET = 'Gasket' +WIN_THRESHOLD = 'Threshold' + +-- info sui profili +WIN_SASH_TOP_OVERLAP = 'SashTopOverlap' +WIN_SASH_BOTTOM_OVERLAP = 'SashBottomOverlap' +WIN_DELTA = 'Delta' +WIN_FILLOVERLAP = 'FillOverlap' +WIN_FILLDELTA = 'FillDelta' +WIN_GLASSTHICKNESS = 'GlassThickness' +WIN_RAILDELTA = 'RailDelta' +-- per ferramenta +WIN_GAPDELTA = 'GapDelta' +WIN_GAPDELTAZ = 'GapDeltaZ' +-- per accessori +WIN_STRIP_DIST = 'StripDistance' +WIN_TRIM = 'Trim' +-- per cambio profilo +WIN_FIXED_REF = 'FixedRef' +WIN_SASH_REF = 'SashRef' +WIN_SASH_DEPTH = 'SashDepth' +WIN_RAD_REF = 'RefRad' +WIN_EXTRA_DIST = 'ExtraDist' +-- per lavorazioni +WIN_PRC_OVERMAT_IN = 'OVERMAT_IN' +WIN_PRC_OVERMAT_OUT = 'OVERMAT_OUT' +WIN_PRC_OVERMAT_LEFT = 'OVERMAT_LEFT' +WIN_PRC_OVERMAT_RIGHT = 'OVERMAT_RIGHT' +WIN_PRC_PHASE = 'PHASE' +WIN_PRC_NTOOLS = 'NTOOLS' +WIN_PRC_TOOL_NAME = 'TOOL_NAME' +WIN_PRC_OFFL = 'OFFL' +WIN_PRC_OFFR = 'OFFR' +WIN_PRC_OFFY_1 = 'OFFY_1' +WIN_PRC_OFFZ_1 = 'OFFZ_1' +WIN_PRC_OFFY_2 = 'OFFY_2' +WIN_PRC_OFFZ_2 = 'OFFZ_2' +WIN_PRC_CLAMPV_1 = 'CLAMPV_1' +WIN_PRC_CLAMPV_2 = 'CLAMPV_2' + +-- codici +WIN_PROFILE_CODES = { + SASH = 1, + FIXED_GLASS = 2, + MIXED = 4, + FRAME_RAIL = 8, + SASH_RAIL = 16, + SLIDE = 32, +} + + +-- Profili pezzo +WIN_PRF_MAIN = 'Main' +WIN_PRF_START = 'Start' +WIN_PRF_END = 'End' +WIN_PRF_SPLIT = 'Split' +WIN_PRF_TYPE = 'Type' +WIN_PROFILETYPE = 'ProfileType' + +-- tipi di profilo +WIN_PRF = { + NULL = 0, + TOP = 1, + BOTTOM = 2, + LEFT = 3, + RIGHT = 4, + SPLIT = 5, + BOTTOMRAIL = 6, + BOTTOMRAIL_FINAL = 7, +} + + +-- GIUNZIONI +WIN_JOINTS = 'Joints' +WIN_JOINT_BL = 'JointBL' +WIN_JOINT_BR = 'JointBR' +WIN_JOINT_TL = 'JointTL' +WIN_JOINT_TR = 'JointTR' +WIN_STARTJOINT = 'StartJoint' +WIN_ENDJOINT = 'EndJoint' + +-- tipi di giunzioni +WIN_JNT = { + ANGLED = 1, + FULL_H = 2, + FULL_V = 3, +} + +-- tipi di giunzione pezzo +WIN_PART_JNT = { + ANGLED = 1, + FULL = 2, + SHORT = 3, +} + + +-- GEO +WIN_GEO = 'Geo' +WIN_GEO_RAW = 'GeoRaw' +WIN_GEO_IN = 'In' +WIN_GEO_OUT = 'Out' +WIN_GEO_LEFT = 'Left' +WIN_GEO_RIGHT = 'Right' +WIN_PRC_FRAME = 'AuxFrame' +WIN_GEOWIDTH = 'GeoWidth' +WIN_GEOHEIGHT = 'GeoHeight' +WIN_GEOLEN = 'GeoLen' +WIN_SEMI_PROFILE = 'SemiProfileId' +WIN_GLASS_RECT = 'GlassRectangle' + + +-- CAMBIO PROFILO +WIN_PRF_CHANGE = 'ProfileChange' +WIN_MIXED_OUTLINES = 'ProfileChangeOutlines' +WIN_MIXED_INTERSECTIONS = 'ProfileChangeIntersections' +WIN_MIXED_SPLIT_REF = 'MixedSplitRef' +WIN_MIXED_INTERS_REF = 'MixedIntersRef' +WIN_MIXED_REF_START = 'MixedRefEnd' +WIN_MIXED_REF_END = 'MixedRefStart' + + +-- SOLIDI +WIN_SOLID = 'Solid' +WIN_MAINGUIDE = 'MainGuide' +WIN_SRF_MAIN = 'MainSurface' +WIN_SRF_ORIGMAIN = 'OrigMainSurface' +WIN_SRF_START = 'StartSurface' +WIN_SRF_END = 'EndSurface' +WIN_SRF_STRIP = 'StripSurface' + + +-- LAVORAZIONI +WIN_PRC = 'Processings' +WIN_PRC_FEATURE_TYPE = 'FEATURE_TYPE' +WIN_PRC_TYPE = { + HOLE = 'Hole', + PROFILING = 'Profiling', + POCKET = 'Pocket', + CUT = 'Cut', + STRIP_CUT = 'StripCut' +} +WIN_PRC_PROFILE_INFO = 'PROFILE_INFO' +WIN_PRC_PROFILE_TYPE = { + HEAD = 'Head', + LONGITUDINAL = 'Longitudinal', + MIXED = 'Mixed', + GENERIC = 'Generic' +} +WIN_PRC_SIDE = 'REFERENCE_SIDE' +WIN_PRC_SIDETYPE = { + OUT = 'Out', + IN = 'In', + LEFT = 'Left', + RIGHT = 'Right' +} + + +-- SPINE +WIN_DOWEL = 'Dowel' +WIN_DWL_DIAM = 'DowelsDiam' +WIN_DWL_TOP_PERP_LEN = 'TopPerpLen' +WIN_DWL_TOP_PARA_LEN = 'TopParaLen' +WIN_DWL_INACTIVE_PERP_LEN = 'InactivePerpLen' +WIN_DWL_INACTIVE_PARA_LEN = 'InactiveParaLen' +WIN_DWL_BOTTOM_PERP_LEN = 'BottomPerpLen' +WIN_DWL_BOTTOM_PARA_LEN = 'BottomParaLen' +WIN_DWL_RAILBOTTOM_PERP_LEN = 'RailBottomPerpLen' +WIN_DWL_RAILBOTTOM_PARA_LEN = 'RailBottomParaLen' +WIN_DWL_SPLIT_PERP_LEN = 'SplitPerpLen' +WIN_DWL_SPLIT_PARA_LEN = 'SplitParaLen' +WIN_DWL_LOG_LEN = 'DowelsLogLen' + + +-- TRONCHETTI +WIN_LOGS = 'Log' + + +-- ACCESSORI +WIN_GASKET_LEN = 'GasketLen' +WIN_WATERDRIP = 'Waterdrip' +WIN_WATERDRIP_LEN = 'WaterdripLen' +WIN_THRESHOLD_LEN = 'ThresholdLen' + + +-- FERRAMENTA +WIN_HDW_FAVOURITE = 'HdwFavourite' +WIN_HDW_NULL = '000000' +WIN_HDW_HANDLE = 'HdwHandle' +WIN_HDW_FRAME = 'HdwFrame' +WIN_HDW_HANDLE_HEIGHT = 'HMan' +WIN_HDW_OPTIONS = 'HdwOptions' +WIN_HDW_HINGES = 'HdwHinges' +--------------------------------------------------------------------- +return WinConst diff --git a/Profiles/WinJWDConst.lua b/Designing/WinJWDConst.lua similarity index 63% rename from Profiles/WinJWDConst.lua rename to Designing/WinJWDConst.lua index 7cc883f..fa36e97 100644 --- a/Profiles/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/WinCalculate.lua b/Designing/WinLib/WinCalculate.lua new file mode 100644 index 0000000..2847825 --- /dev/null +++ b/Designing/WinLib/WinCalculate.lua @@ -0,0 +1,6102 @@ +-- +-- 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 s_dDowelTol = 1 +local s_dSimplSolidApprox = 0.2 -- approssimazione lineare nel caso di solidi semplificati +local s_nSashNbr = 0 -- contatore delle ante per assegnare nomi + +local s_bCalcSolid = false +function WinCalculate.GetCalcSolid() + return s_bCalcSolid +end +function WinCalculate.SetCalcSolid( bValue) + s_bCalcSolid = bValue +end + +local s_bSimplSolid = false +function WinCalculate.SetSimplifiedSolid( bValue) + s_bSimplSolid = bValue +end + +local s_bCalcPreview = false +function WinCalculate.SetCalcPreview( bValue) + s_bCalcPreview = bValue +end + +local s_bCalcHardwareKit = false +function WinCalculate.SetCalcHardwareKit( bValue) + s_bCalcHardwareKit = bValue +end + +local s_bCalcHardwarePosition = false +function WinCalculate.SetCalcHardwarePosition( bValue) + s_bCalcHardwarePosition = bValue +end + +local OutputKitList = {} +local OutputPositionList = {} + +--------------------------------------------------------------------- +-- funzione che copia la info di chiave sInfo da nSou a nDest +local function CopyInfo( nDest, nSou, sInfo, Default) + local sVal = EgtGetInfo( nSou, sInfo) or Default + EgtSetInfo( nDest, sInfo, sVal) +end + +--------------------------------------------------------------------- +-- funzione che restituisce o crea il layer ausiliario per soldi di ferramenta e accessori +local function GetAuxLayer() + local nAuxLayerId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_AUX) + if not nAuxLayerId then + nAuxLayerId = EgtGroup( GDB_ID.ROOT) + EgtSetName( nAuxLayerId, WIN_AUX) + EgtSetLevel( nAuxLayerId, GDB_LV.SYSTEM) + end + return nAuxLayerId +end + +--------------------------------------------------------------------- +-- funzione che trova punto di intersezione fra due curve eventualmente estendendole +local function FindIntersectionPoint( nCrv1, nCrv2, ptRef) + local ptInt + -- se archi, cerco intersezioni tra le circonferenze + if EgtGetType( nCrv1) == GDB_TY.CRV_ARC and EgtGetType( nCrv2) == GDB_TY.CRV_ARC then + -- trovo intersezione tra le due circonferenze + local nCircle1 = EgtCircle( GDB_ID.ROOT, EgtCP( nCrv1), EgtArcRadius( nCrv1)) + local nCircle2 = EgtCircle( GDB_ID.ROOT, EgtCP( nCrv2), EgtArcRadius( nCrv2)) + ptInt = EgtIP( nCircle1, nCircle2, ptRef) + EgtModifyCurveStartPoint( nCrv1, ptInt) + EgtModifyCurveEndPoint( nCrv2, ptInt) + EgtErase( nCircle1) + EgtErase( nCircle2) + + elseif EgtGetType( nCrv1) == GDB_TY.CRV_ARC or EgtGetType( nCrv2) == GDB_TY.CRV_ARC then + local nLine = EgtIf( EgtGetType( nCrv1) == GDB_TY.CRV_LINE, nCrv1, nCrv2) + local nArc = EgtIf( nLine == nCrv1, nCrv2, nCrv1) + -- creo circonferenza corrispondente all'arco + local nCircle = EgtCircle( GDB_ID.ROOT, EgtCP( nArc), EgtArcRadius( nArc)) + -- prolungo la linea dal lato opportuno + local dDist1 = dist( EgtSP( nLine), ptRef) + local dDist2 = dist( EgtEP( nLine), ptRef) + if dDist1 < dDist2 then + EgtExtendCurveStartByLen( nLine, 10000) + else + EgtExtendCurveEndByLen( nLine, 10000) + end + -- trovo le intersezioni tra retta e circonferenza + local nId1, nPoints = EgtCurveCurveInters( nCircle, nLine, GDB_ID.ROOT) + if nPoints == 1 then + ptInt = EgtSP( nId1) + EgtErase( nId1) + else + -- conservo quello più vicino al punto di riferimento + local ptInt1 = EgtSP( nId1) + local ptInt2 = EgtSP( nId1 + 1) + local ptNewRef = EgtIf( nArc == nCrv2, EgtEP( nArc), EgtSP( nArc)) + local dDist1 = dist( ptNewRef, ptInt1) + local dDist2 = dist( ptNewRef, ptInt2) + if dDist1 < dDist2 + GEO.EPS_SMALL then + ptInt = ptInt1 + else + ptInt = ptInt2 + end + EgtErase( nId1) + EgtErase( nId1 + 1) + end + EgtErase( nCircle) + + -- allungo l'arco per arrivare al punto di intersezione + if nArc == nCrv2 then + EgtModifyCurveEndPoint( nArc, ptInt) + else + EgtModifyCurveStartPoint( nArc, ptInt) + end + + else + ptInt = EgtIP( nCrv1, nCrv2, ORIG()) + if not ptInt then + -- tento estendendo le curve + EgtExtendCurveStartByLen( nCrv1, 10000) + EgtExtendCurveEndByLen( nCrv1, 10000) + EgtExtendCurveStartByLen( nCrv2, 10000) + EgtExtendCurveEndByLen( nCrv2, 10000) + ptInt = EgtIP( nCrv1, nCrv2, ORIG()) + end + end + + return ptInt +end + +--------------------------------------------------------------------- +-- funzione che data una lista di curve ordinate che creano una curva chiusa, +-- ne estende/taglia i contorni per ottenere una curva chiusa continua +local function TrimAndOrientOrderedCurves( vCrvs, bOrient) + local IntersCurveList = {} + local LastCurveInters + -- ciclo sulle curve per ottenere lista intersezioni + for i = 1, #vCrvs do + -- recupero la precedente + local nPrevIndex = EgtIf( i == 1, #vCrvs, i - 1) + -- calcolo intersezione + local ptInters = FindIntersectionPoint( vCrvs[i], vCrvs[ nPrevIndex], EgtSP( vCrvs[i])) + if LastCurveInters then + LastCurveInters.EndInters = Point3d( ptInters) + end + local NewCurveInters = { CurveId = vCrvs[i], StartInters = Point3d( ptInters)} + table.insert( IntersCurveList, NewCurveInters) + LastCurveInters = NewCurveInters + 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, 100 * GEO.EPS_SMALL) + local dEndParam = EgtCurveParamAtPoint( CurveInters.CurveId, CurveInters.EndInters, 100 * GEO.EPS_SMALL) + EgtTrimCurveStartEndAtParam( CurveInters.CurveId, min( dStartParam, dEndParam), max( dStartParam, dEndParam)) + if bOrient and dStartParam > dEndParam then + EgtInvertCurve( CurveInters.CurveId) + end + end +end + +--------------------------------------------------------------------- +local function TrimSplitWithOutline( nSplitId) + -- estendo agli estremi ( TO DO : gestire caso di split non lineare) + EgtExtendCurveStartByLen( nSplitId, 50) + EgtExtendCurveEndByLen( nSplitId, 50) + -- lo taglio con outline + local nStartIntersId = EgtGetInfo( nSplitId, WIN_SPLIT_STARTINTERS, 'i') + local nOutlineId = EgtGetInfo( nStartIntersId, WIN_COPY, '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_COPY, 'i') + local ptEndInters = EgtIP( nSplitId, nOutlineId, EgtSP( nSplitId)) + local dEndInters = EgtCurveParamAtPoint( nSplitId, ptEndInters) + EgtTrimCurveEndAtParam( nSplitId, dEndInters) +end + +--------------------------------------------------------------------- +-- funzione che data una curva di outline restituisce l'id del suo profilo +local function GetOutlineProfileId( nOutlineId, bForceBottomRail, nProfileType) + + -- ciclo fino a trovare il primo parent che abbia un AreaType definito ( frame o sash) + local nParentId = EgtGetParent( nOutlineId) + local nAreaType = WIN_AREATYPES.NULL + while nParentId and ( nAreaType == WIN_AREATYPES.SPLIT or nAreaType == WIN_AREATYPES.NULL) do + nParentId = EgtGetParent( nParentId) + nAreaType = EgtGetInfo( nParentId or GDB_ID.NULL, WIN_AREATYPE, 'i') or WIN_AREATYPES.NULL + end + + -- recupero il gruppo contenente il profilo + local nProfilesGrpId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE) + local nLayerId + if nAreaType == WIN_AREATYPES.FRAME then + nLayerId = EgtGetFirstNameInGroup( nProfilesGrpId, WIN_FRAME) + elseif nAreaType == WIN_AREATYPES.SASH then + nLayerId = EgtGetFirstNameInGroup( nProfilesGrpId, WIN_SASH) + end + + -- recupero il nome del profilo + local sProfileName = EgtGetInfo( nOutlineId, WIN_PROFILETYPE) + + -- controlli per bottomrail + if EgtGetName( nOutlineId) == WIN_BOTTOM and bForceBottomRail then + local nBottomRailTot = EgtGetInfo( nOutlineId, WIN_BOTTOMRAIL, 'i') or 0 + if nBottomRailTot > 0 then + sProfileName = WIN_FILL_RAIL + end + elseif nProfileType == WIN_PRF.BOTTOMRAIL then + sProfileName = WIN_RAIL + elseif nProfileType == WIN_PRF.BOTTOMRAIL_FINAL then + sProfileName = WIN_FILL_RAIL + end + + -- recupero il profilo + return EgtGetFirstNameInGroup( nLayerId, sProfileName) +end + +--------------------------------------------------------------------- +-- funzione che recupera il pezzo associato ad un outline +local function FindAssociatedPart( nOutlineId, bUseBottomRail) + + local nCrvId = nOutlineId + local nPartId = EgtGetInfo( nCrvId, WIN_REF_PART, 'i') + if not nPartId then + -- cerco la prima curva da cui deriva che ha un pezzo associato + local nBaseOutline = EgtGetInfo( nOutlineId, WIN_COPY, 'i') + while not nPartId do + -- recupero il base outline da cui deriva + nBaseOutline = EgtGetInfo( nBaseOutline, WIN_SOU, 'i') + -- verifico se ha un profilo associato ( e quindi un pezzo) + local sProfileType = EgtGetInfo( nBaseOutline, WIN_PROFILETYPE) + if sProfileType then + -- recupero l'outline associato + nCrvId = EgtGetInfo( nBaseOutline, WIN_COPY, 'i') + nPartId = EgtGetInfo( nCrvId, WIN_REF_PART, 'i') + end + end + end + + -- se serve bottomrail verifico se presente + if bUseBottomRail then + local vBottomRailParts = EgtGetInfo( nCrvId, WIN_REF_BOTTOMRAIL_PART, 'vi') + if vBottomRailParts then + nPartId = vBottomRailParts[#vBottomRailParts] + end + end + + return nPartId +end + +--------------------------------------------------------------------- +-- funzione che calcola il box di un profilo ( guardando la sua curva Ref) rispetto al suo frame +local function GetProfileLocalBox( nProfileId) + -- recupero il frame del profilo + local nFrameId = EgtGetFirstNameInGroup( nProfileId, WIN_SECTIONFRAME) + local frFrame = EgtFR( nFrameId, GDB_ID.ROOT) + -- recupero il Ref del profilo e ne calcolo il box + local nRefId = EgtGetFirstNameInGroup( nProfileId, WIN_REF) + local b3Box = EgtGetBBoxRef( nRefId, GDB_BB.STANDARD, frFrame, GDB_RT.GLOB) + return b3Box +end + + + +---------------------------------------------------------------------------------- +----------------------------- CALCOLO DEI PROFILI ------------------------------ +---------------------------------------------------------------------------------- +-- funzione che restituisce il primo tipo di area definito tra le sottoaree che si generano da nAreaId +local function GetAreaChildrenType( nAreaId) + + local vStack = EgtGetNameInGroup( nAreaId, WIN_AREA .. '*') or {} + local i = 1 + while vStack[i] do + local nType = EgtGetInfo( vStack[i], WIN_AREATYPE, 'i') + -- appena trovo un tipo definito esco + if nType == WIN_AREATYPES.FILL then + return WIN_CHILDREN_TYPES.FILL + elseif nType == WIN_AREATYPES.SASH then + return WIN_CHILDREN_TYPES.SASH + else + -- altrimenti analizzo le sottoaree + local vSubAreas = EgtGetNameInGroup( vStack[i], WIN_AREA .. '*') or {} + vStack = EgtJoinTables( vStack, vSubAreas) + end + i = i + 1 + end + -- se non trovo un tipo definito + return WIN_CHILDREN_TYPES.NULL +end + +--------------------------------------------------------------------- +local function GetClosestAreaChildrenType( nAreaId) + + local nChildrenType = WIN_CHILDREN_TYPES.NULL + local nType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') + while nChildrenType == WIN_CHILDREN_TYPES.NULL and nType ~= WIN_AREATYPES.FRAME do + nAreaId = EgtGetParent( nAreaId) + nType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') + nChildrenType = GetAreaChildrenType( nAreaId) + end + + return nChildrenType +end + +--------------------------------------------------------------------- +-- funzione che verifica la tipologia delle curve figlie di una curva +local function GetChildrenType( nCrvId) + + local vStack = EgtGetInfo( nCrvId, WIN_CHILD, 'vi') or {} + local i = 1 + local vFillChildren = {} + local vSashChildren = {} + while vStack[i] do + -- verifico se la sua area è di tipo sash o fill + local nAreaId = EgtGetParent( EgtGetParent( vStack[i])) + local nType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') + if nType == WIN_AREATYPES.FILL then + table.insert( vFillChildren, vStack[i]) + elseif nType == WIN_AREATYPES.SASH then + table.insert( vSashChildren, vStack[i]) + else + -- recupero i suoi figli + local vChildren = EgtGetInfo( vStack[i], WIN_CHILD, 'vi') or {} + if #vChildren == 0 then + -- se non ha figli, per non creare problemi nel caso di cambio profilo ( in cui è necessario conoscere la struttura completa), + -- assegno come tipologia quella dell'area più "vicina" nella struttura delle aree + local nCurrType = GetClosestAreaChildrenType( nAreaId) + if nCurrType == WIN_CHILDREN_TYPES.FILL then + table.insert( vFillChildren, vStack[i]) + elseif nCurrType == WIN_CHILDREN_TYPES.SASH then + table.insert( vSashChildren, vStack[i]) + end + end + -- aggiungo i suoi figli tra gli elementi da analizzare + vStack = EgtJoinTables( vStack, vChildren) + end + -- aggiorno il contatore + i = i + 1 + end + + -- salvo i figli individuati come info della curva + EgtSetInfo( nCrvId, WIN_SASH_CHILDREN, vSashChildren) + EgtSetInfo( nCrvId, WIN_FILL_CHILDREN, vFillChildren) + + if #vFillChildren > 0 and #vSashChildren > 0 then + return WIN_CHILDREN_TYPES.MIXED -- cambio profilo + elseif #vFillChildren > 0 then + return WIN_CHILDREN_TYPES.FILL + elseif #vSashChildren > 0 then + return WIN_CHILDREN_TYPES.SASH + else + return WIN_CHILDREN_TYPES.NULL + end +end + +--------------------------------------------------------------------- +-- funzione che identifica il tipo di split ( null, mullion, french, mixed) +local function GetSplitType( nSplitLayerId) + + local nSplitType = EgtGetInfo( nSplitLayerId, WIN_SPLITTYPE, 'i') + -- se non ha split specifico impostato verifico se ha sash prima o dopo per capire se è di tipo mullion + if not nSplitType or nSplitType == WIN_SPLITTYPES.NULL then + local nParentAreaId = EgtGetParent( nSplitLayerId) + local nParentAreaType = EgtGetInfo( nParentAreaId, WIN_AREATYPE, 'i') or WIN_AREATYPES.NULL + while nParentAreaId and nParentAreaType ~= WIN_AREATYPES.SASH do + nParentAreaId = EgtGetParent( nParentAreaId) + nParentAreaType = EgtGetInfo( nParentAreaId or GDB_ID.NULL, WIN_AREATYPE, 'i') or WIN_AREATYPES.NULL + end + -- se dentro anta è di tipo null, se non è dentro anta devo verificare le tipologie dei figli + if not nParentAreaId or nParentAreaType ~= WIN_AREATYPES.SASH then + local nSplitId = EgtGetFirstInGroup( nSplitLayerId) + local nChildrenType = GetChildrenType( nSplitId) + if nChildrenType == WIN_CHILDREN_TYPES.MIXED then + nSplitType = WIN_SPLITTYPES.MIXED + elseif nChildrenType == WIN_CHILDREN_TYPES.SASH or nChildrenType == WIN_CHILDREN_TYPES.NULL then + nSplitType = WIN_SPLITTYPES.MULLION + end + end + end + if not nSplitType then + nSplitType = WIN_SPLITTYPES.NULL + end + EgtSetInfo( nSplitLayerId, WIN_SPLITTYPE, nSplitType) + return nSplitType +end + +--------------------------------------------------------------------- +-- funzione che imposta i tipi di profilo per gli split +local function CalcSplitProfileType( nSplitLayerId, nAreaId) + + local nSplitId = EgtGetFirstInGroup( nSplitLayerId) + -- verifico il tipo di split + local nSplitType = GetSplitType( nSplitLayerId) + if nSplitType == WIN_SPLITTYPES.MULLION then + -- 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 + + elseif nSplitType == WIN_SPLITTYPES.NULL then + -- verifico se interno ad anta o a frame + local nParentAreaId = 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 + if nParentAreaType == WIN_AREATYPES.SASH then + EgtSetInfo( nSplitId, WIN_PROFILETYPE, WIN_SASH_SPLIT) + else + EgtSetInfo( nSplitId, WIN_PROFILETYPE, WIN_FRAME_SPLIT) + end + + elseif nSplitType == WIN_SPLITTYPES.MIXED then + EgtSetInfo( nSplitId, WIN_PROFILETYPE, WIN_MIXED_SPLIT) + EgtSetInfo( nSplitId, WIN_PRF_CHANGE, true) + + -- verifico se l'orientamento dello split è coerente con il cambio profilo ( vetro fisso a destra e anta a sinistra) : + -- recupero il lato da cui si trova il figlio di tipo anta + local nSashChild = EgtGetInfo( nSplitId, WIN_SASH_CHILDREN, 'i') + local nRefCrv = EgtGetNext( nSashChild) or EgtGetPrev( nSashChild) + local _, _, nSide = EgtPointCurveDistSide( EgtMP( nRefCrv), nSplitId, Z_AX()) + -- se si trova a destra, lo split va invertito + if nSide == 1 then + EgtInvertCurve( nSplitId) + -- scambio le info di intersezione + local vStartInters = EgtGetInfo( nSplitId, WIN_SPLIT_STARTINTERS, 'vi') + local vEndInters = EgtGetInfo( nSplitId, WIN_SPLIT_ENDINTERS, 'vi') + EgtSetInfo( nSplitId, WIN_SPLIT_STARTINTERS, vEndInters) + EgtSetInfo( nSplitId, WIN_SPLIT_ENDINTERS, vStartInters) + end + end + + -- se split di tipo french non ha profilo assegnato perchè non ha un pezzo associato +end + +--------------------------------------------------------------------- +local function FindAdjacentSashType( nSplitId, nSouId) + + -- recupero l'altro child dello split + local vSplitChildren = EgtGetInfo( nSplitId, WIN_CHILD, 'vi') + local vChildren = EgtIf( vSplitChildren[1] == nSouId, {vSplitChildren[2]}, {vSplitChildren[1]}) + -- cerco il suo primo figlio di tipo sash + local nAreaType + local nArea + repeat + vChildren = EgtGetInfo( vChildren[1], WIN_CHILD, 'vi') + if vChildren then + nArea = EgtGetParent( EgtGetParent( vChildren[1])) + nAreaType = EgtGetInfo( nArea or GDB_ID.NULL, WIN_AREATYPE, 'i') + end + until not vChildren or nAreaType == WIN_AREATYPES.SASH + + -- recupero il sash type + local nSashType = EgtGetInfo( nArea or GDB_ID.NULL, WIN_SASHTYPE, 'i') + return nSashType +end + +--------------------------------------------------------------------- +-- funzione che imposta i tipi di profilo in base al tipo di pezzi +local function CalcProfileType( nAreaId) + local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') + + -- FRAME + if nAreaType == WIN_AREATYPES.FRAME then + -- gestione soglia + local sThreshold = EgtGetInfo( nAreaId, WIN_THRESHOLD_PROFILE) or WIN_BOTTOM + local bThreshold = ( sThreshold == WIN_THRESHOLD) + + -- assegno il profilo alle curve di outline + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_AREAOUTLINE) + local nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) + while nOutlineId do + local sName = EgtGetName( nOutlineId) + -- recupero il tipo dei figli + local nChildrenType = GetChildrenType( nOutlineId) + + -- a) se non definiti gestisco come anta o fixed + if nChildrenType == WIN_CHILDREN_TYPES.NULL then + local nBottomRail = EgtGetInfo( nAreaId, WIN_BOTTOMRAIL, 'i') or 0 + if nBottomRail > 0 then + -- se bottomrail gestisco come fixed + bThreshold = false + if sName == WIN_BOTTOM then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_RAIL .. '_' .. sThreshold) + else + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_FIXED_TOP) + end + else + -- se no bottomrail gestisco come anta + if sName == WIN_BOTTOM then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SASH .. '_' .. sThreshold) + else + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SASH_TOP) + end + end + + -- b) se anta + elseif nChildrenType == WIN_CHILDREN_TYPES.SASH then + EgtRemoveInfo( nAreaId, WIN_BOTTOMRAIL) + -- verifico tipologia di anta contro cui poggia + local vChildren = EgtGetInfo( nOutlineId, WIN_SASH_CHILDREN, 'vi') + local nSashArea = EgtGetParent( EgtGetParent( vChildren[1])) + local nSashType = EgtGetInfo( nSashArea, WIN_SASHTYPE, 'i') or WIN_SASHTYPES.NULL + -- b1) alzante scorrevole + if nSashType == WIN_SASHTYPES.SLIDE_MOVABLE or nSashType == WIN_SASHTYPES.SLIDE_FIXED or nSashType == WIN_SASHTYPES.SLIDE_MOVABLE_BACK then + EgtSetInfo( nAreaId, WIN_SLIDE_WINDOW, true) + if sName == WIN_BOTTOM then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE .. '_' .. sThreshold) + -- se le ante contro cui poggia sono tutte mobili devo aggiornare il profilo + if nSashType == WIN_SASHTYPES.SLIDE_MOVABLE_BACK then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_MOVABLEBACK .. '_' .. sThreshold) + elseif nSashType == WIN_SASHTYPES.SLIDE_MOVABLE then + for i = 2, #vChildren do + local nSashArea = EgtGetParent( EgtGetParent( vChildren[i])) + local nSashType = EgtGetInfo( nSashArea, WIN_SASHTYPE, 'i') or WIN_SASHTYPES.NULL + if nSashType == WIN_SASHTYPES.SLIDE_MOVABLE_BACK then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_MOVABLEBACK .. '_' .. sThreshold) + break + elseif nSashType == WIN_SASHTYPES.SLIDE_FIXED then + break + end + end + end + elseif sName == WIN_TOP then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_TOP) + else + if nSashType == WIN_SASHTYPES.SLIDE_MOVABLE then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_MOVABLE) + else + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_FIXED) + end + end + -- b2) standard + else + if sName == WIN_BOTTOM then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SASH .. '_' .. sThreshold) + else + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SASH_TOP) + end + end + + -- c) se riempimento + elseif nChildrenType == WIN_CHILDREN_TYPES.FILL then + bThreshold = false + if sName == WIN_BOTTOM then + -- verifico presenza bottomrail + local nBottomRail = EgtGetInfo( nAreaId, WIN_BOTTOMRAIL, 'i') or 0 + if nBottomRail == 0 then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_FIXED .. '_' .. sThreshold) + else + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_RAIL .. '_' .. sThreshold) + end + else + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_FIXED_TOP) + end + + -- d) se cambio profilo + elseif nChildrenType == WIN_CHILDREN_TYPES.MIXED then + EgtRemoveInfo( nAreaId, WIN_BOTTOMRAIL) + bThreshold = false + EgtSetInfo( nOutlineId, WIN_PRF_CHANGE, true) + if sName == WIN_BOTTOM then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_MIXED_BOTTOM) + else + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_MIXED_TOP) + end + end + nOutlineId = EgtGetNext( nOutlineId) + end + -- assegno info soglia + if bThreshold then + EgtSetInfo( nAreaId, WIN_THRESHOLD, true) + end + + -- verifico se ci sono split e ne assegno il profilo + local nSplitLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_BASESPLIT) + if nSplitLayerId then + CalcSplitProfileType( nSplitLayerId, nAreaId) + end + + -- SPLIT + elseif nAreaType == WIN_AREATYPES.SPLIT or nAreaType == WIN_AREATYPES.NULL then + -- verifico se ci sono split e ne assegno il profilo + local nSplitLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_BASESPLIT) + if nSplitLayerId then + CalcSplitProfileType( nSplitLayerId, nAreaId) + end + + -- SASH + elseif nAreaType == WIN_AREATYPES.SASH then + -- verifico tipologia di anta ( battente, ricevente, alzante scorrevole) + local nSashType = EgtGetInfo( nAreaId, WIN_SASHTYPE, 'i') or WIN_SASHTYPES.NULL + -- verifico se bottomrail + local nBottomRail = EgtGetInfo( nAreaId, WIN_BOTTOMRAIL, 'i') or 0 + -- imposto profili sash + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_AREAOUTLINE) + local nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) + while nOutlineId do + local sName = EgtGetName( nOutlineId) + + -- se non è definita tipologia + if nSashType == WIN_SASHTYPES.NULL then + if sName == WIN_BOTTOM then + if nBottomRail == 0 then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_FRAME_BOTTOM) + else + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_RAIL_BOTTOM) + end + else + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_FRAME_TOP) + end + + else + -- verifico se deriva da una curva di split di tipo french ( e quindi deve avere profilo speciale e.g. battente/ricevente) + local nSouId = EgtGetInfo( nOutlineId, WIN_SOU, 'i') + local nSouPrevId + local nSplitType + repeat + nSouPrevId = nSouId + nSouId = EgtGetInfo( nSouId, WIN_SOU, 'i') + if nSouId then + local sName = EgtGetName( nSouId) + if sName == WIN_SPLIT then + local nParentId = EgtGetParent( nSouId) + nSplitType = EgtGetInfo( nParentId, WIN_SPLITTYPE, 'i') + end + end + until not nSouId or nSplitType == WIN_SPLITTYPES.FRENCH + + if nSplitType == WIN_SPLITTYPES.FRENCH then + -- setto info sulla curva per ricordare che deriva da un french split ( utile nel calcolo degli outlines) + EgtSetInfo( nOutlineId, WIN_CRV_ON_FRENCH_SPLIT, true) + + -- a) battente/ricevente + 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) + elseif nSashType == WIN_SASHTYPES.ACTIVE_OUT or nSashType == WIN_SASHTYPES.INACTIVE_OUT then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_FRENCH_OUT) + elseif nSashType == WIN_SASHTYPES.ACTIVE_IN or nSashType == WIN_SASHTYPES.INACTIVE_IN then + -- devo verificare il tipo dell'anta adiacente + local nAdjSashType = FindAdjacentSashType( nSouId, nSouPrevId) + if nSashType == WIN_SASHTYPES.ACTIVE_IN then + if nAdjSashType == WIN_SASHTYPES.ACTIVE_OUT then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_FRENCH_IN) + else -- adiacente è inactive + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SASH_ACTIVE) + end + elseif nSashType == WIN_SASHTYPES.INACTIVE_IN then + if nAdjSashType == WIN_SASHTYPES.INACTIVE_OUT then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_FRENCH_IN) + else -- adiacente è active + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SASH_INACTIVE) + end + end + + -- b) alzante scorrevole + elseif nSashType == WIN_SASHTYPES.SLIDE_MOVABLE then + local nAdjSashType = FindAdjacentSashType( nSouId, nSouPrevId) + if nAdjSashType == WIN_SASHTYPES.SLIDE_MOVABLE then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_ACTIVE_IN) + else + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_ACTIVE) + end + elseif nSashType == WIN_SASHTYPES.SLIDE_FIXED then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_INACTIVE) + elseif nSashType == WIN_SASHTYPES.SLIDE_MOVABLE_BACK then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_INACTIVE) + end + + else + -- a) alzante scorrevole + if nSashType == WIN_SASHTYPES.SLIDE_MOVABLE then + if sName == WIN_BOTTOM then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_MOVABLE_BOTTOM) + elseif sName == WIN_TOP then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_MOVABLE_TOP) + else + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_MOVABLE_SIDE) + end + elseif nSashType == WIN_SASHTYPES.SLIDE_FIXED then + if sName == WIN_BOTTOM then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_FIXED_BOTTOM) + elseif sName == WIN_TOP then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_FIXED_TOP) + else + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_FIXED_SIDE) + end + elseif nSashType == WIN_SASHTYPES.SLIDE_MOVABLE_BACK then + if sName == WIN_BOTTOM then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_MOVABLEBACK_BOTTOM) + elseif sName == WIN_TOP then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_MOVABLEBACK_TOP) + else + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_MOVABLEBACK_SIDE) + end + + -- b) standard + else + if sName == WIN_BOTTOM then + -- verifico se bottomrail + if nBottomRail == 0 then + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_FRAME_BOTTOM) + else + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_RAIL_BOTTOM) + end + else + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_FRAME_TOP) + end + end + end + end + nOutlineId = EgtGetNext( nOutlineId) + 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 + end +end + +--------------------------------------------------------------------- +-- funzione che cicla ricorsivamente su aree e sottoaree per impostare i tipi di profilo +local function CalculateAreaProfileType( nAreaId) + -- calcolo i profili per l'area corrente + CalcProfileType( nAreaId) + -- calcolo i profili per le eventuali sottoaree + local nChildAreaId = EgtGetFirstNameInGroup( nAreaId, WIN_AREA .. '*') + while nChildAreaId do + CalculateAreaProfileType( nChildAreaId) + nChildAreaId = EgtGetNextName( nChildAreaId, WIN_AREA .. '*') + end +end + + + +---------------------------------------------------------------------------------- +------------------------------ CALCOLO OUTLINE --------------------------------- +---------------------------------------------------------------------------------- +-- funzione che calcola l'outline dall'area outline ( base outline) +local function CalculateOutlineFromAreaOutline( nAreaId) + + local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') + -- recupero il base outline e creo gruppo per outline + local nAreaOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_AREAOUTLINE) + local nOutlineLayerId = EgtGroup( nAreaId) + EgtSetName( nOutlineLayerId, WIN_OUTLINE) + EgtSetStatus( nOutlineLayerId, GDB_ST.OFF) + CopyInfo( nOutlineLayerId, nAreaOutlineLayerId, WIN_JOINTS) + + -- FRAME + if nAreaType == WIN_AREATYPES.FRAME then + -- sistemo le info + local nAreaOutlineId = EgtGetFirstInGroup( nAreaOutlineLayerId) + while nAreaOutlineId do + local nOutlineId = EgtCopyGlob( nAreaOutlineId, nOutlineLayerId) + EgtSetInfo( nAreaOutlineId, WIN_COPY, nOutlineId) + EgtSetInfo( nOutlineId, WIN_COPY, nAreaOutlineId) + -- se bottom riporto informazione dei bottomrail e soglia + if EgtGetName( nOutlineId) == WIN_BOTTOM then + CopyInfo( nOutlineId, nAreaId, WIN_BOTTOMRAIL) + CopyInfo( nOutlineId, nAreaId, WIN_THRESHOLD) + end + nAreaOutlineId = EgtGetNext( nAreaOutlineId) + end + + -- se presente, copio split + local nBaseSplitLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_BASESPLIT) + if nBaseSplitLayerId then + local nSplitLayerId = EgtCopy( nBaseSplitLayerId, nAreaId) + EgtSetName( nSplitLayerId, WIN_SPLIT) + EgtSetStatus( nSplitLayerId, GDB_ST.OFF) + local nBaseSplitId = EgtGetFirstInGroup( nBaseSplitLayerId) + local nSplitId = EgtGetFirstInGroup( nSplitLayerId) + EgtSetInfo( nBaseSplitId, WIN_COPY, nSplitId) + EgtSetInfo( nSplitId, WIN_COPY, nBaseSplitId) + end + + + -- SPLIT + elseif nAreaType == WIN_AREATYPES.SPLIT or nAreaType == WIN_AREATYPES.NULL then + -- recupero outline di livello precedente e lo copio pezzo per pezzo + local nBaseOutlineId = EgtGetFirstInGroup( nAreaOutlineLayerId) + while nBaseOutlineId do + -- recupero la curva di outline corrispondente alla curva del base outline da cui deriva e la copio + local nSouId = EgtGetInfo( nBaseOutlineId, WIN_SOU, 'i') + local nCopyId = EgtGetInfo( nSouId, WIN_COPY, 'i') + local nOutlineId = EgtCopy( nCopyId, nOutlineLayerId) + + -- se deriva da split devo aggiornare il nome e setto il riferimento + local sSouName = EgtGetName( nSouId) + if sSouName == WIN_SPLIT then + local sBaseName = EgtGetName( nBaseOutlineId) + EgtSetName( nOutlineId, sBaseName) + EgtSetInfo( nOutlineId, WIN_REF_SPLIT, nSouId) + end + + -- sistemo le info + EgtSetInfo( nOutlineId, WIN_COPY, nBaseOutlineId) + EgtSetInfo( nBaseOutlineId, WIN_COPY, nOutlineId) + EgtRemoveInfo( nOutlineId, WIN_CHILD) + + nBaseOutlineId = EgtGetNext( nBaseOutlineId) + end + -- taglio tutti i contorni + TrimAndOrientOrderedCurves( EgtGetAllInGroup( nOutlineLayerId), true) + + -- se presente, copio split + local nBaseSplitLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_BASESPLIT) + if nBaseSplitLayerId then + local nSplitLayerId = EgtCopy( nBaseSplitLayerId, nAreaId) + EgtSetName( nSplitLayerId, WIN_SPLIT) + EgtSetStatus( nSplitLayerId, GDB_ST.OFF) + local nBaseSplitId = EgtGetFirstInGroup( nBaseSplitLayerId) + local nSplitId = EgtGetFirstInGroup( nSplitLayerId) + EgtSetInfo( nBaseSplitId, WIN_COPY, nSplitId) + EgtSetInfo( nSplitId, WIN_COPY, nBaseSplitId) + EgtRemoveInfo( nSplitId, WIN_SOU) + -- lo taglio con outline + TrimSplitWithOutline( nSplitId) + -- recupero tipo di profilo + local sSplitProfile = EgtGetInfo( nSplitId, WIN_PROFILETYPE) + -- se split interno ad anta devo alzarlo in z come l'anta che lo contiene + if sSplitProfile == WIN_SASH_SPLIT then + -- recupero l'anta + local nSashAreaId = EgtGetParent( nAreaId) + local nAreaType = EgtGetInfo( nSashAreaId, WIN_AREATYPE, 'i') + while nAreaType ~= WIN_AREATYPES.SASH do + nSashAreaId = EgtGetParent( nSashAreaId) + nAreaType = EgtGetInfo( nSashAreaId, WIN_AREATYPE, 'i') + end + local nSashBaseOutlineLayerId = EgtGetFirstNameInGroup( nSashAreaId, WIN_AREAOUTLINE) + local nSashBaseOutlineId = EgtGetFirstInGroup( nSashBaseOutlineLayerId) + -- recupero il profilo dell'anta + local sSashProfile = EgtGetInfo( nSashBaseOutlineId, WIN_PROFILETYPE) + 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') + -- sposto Split in Z + EgtMove( nSplitId, Z_AX() * dSashZOffset) + end + end + + + -- SASH + elseif nAreaType == WIN_AREATYPES.SASH then + -- recupero se anta battente ricevente + local nSashType = EgtGetInfo( nAreaId, WIN_SASHTYPE, 'i') or WIN_SASHTYPES.NULL + + -- recupero gruppo profili anta e telaio + local nProfileLayerId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE) + local nSashProfileLayerId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_SASH) + local nFrameProfileLayerId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_FRAME) + + -- ciclo su profilo disegnato anta + local nBaseOutlineId = EgtGetFirstInGroup( nAreaOutlineLayerId) + while nBaseOutlineId do + -- recupero la curva di outline del base outline da cui deriva e la copio + local nSouId = EgtGetInfo( nBaseOutlineId, WIN_SOU, 'i') + local nCopyId = EgtGetInfo( nSouId, WIN_COPY, 'i') + local nOutlineId = EgtCopy( nCopyId, nOutlineLayerId) + + -- recupero profilo + local sSashProfile = EgtGetInfo( nBaseOutlineId, WIN_PROFILETYPE) + local nSashProfileId = EgtGetFirstNameInGroup( nSashProfileLayerId, sSashProfile) + + -- calcolo offset sulla z dell'anta + local dSashZOffset = EgtGetInfo( nSashProfileId, WIN_DELTA, 'd') + + -- sposto anta in Z + EgtMove( nOutlineId, Z_AX() * dSashZOffset) + + -- sistemo le info + EgtSetInfo( nBaseOutlineId, WIN_COPY, nOutlineId) + EgtSetInfo( nOutlineId, WIN_COPY, nBaseOutlineId) + EgtSetInfo( nOutlineId, WIN_PROFILETYPE, sSashProfile) + if EgtGetName( nOutlineId) == WIN_BOTTOM then + CopyInfo( nOutlineId, nAreaId, WIN_BOTTOMRAIL) + end + EgtRemoveInfo( nOutlineId, WIN_PRF_CHANGE) + EgtRemoveInfo( nOutlineId, WIN_REF_SPLIT) + EgtRemoveInfo( nOutlineId, WIN_THRESHOLD) + + -- verifico se outline e' segmento battente o ricevente ( che quindi deriva da split di tipo french) + local bOnFrenchSplit = EgtGetInfo( nBaseOutlineId, WIN_CRV_ON_FRENCH_SPLIT, 'b') or false + + -- se outline non è segmento battente o ricevente necessita di offset + if not bOnFrenchSplit then + + -- recupero a ritroso il profilo dell'elemento del frame su cui poggia + local nFrameBaseOutlineId = nSouId + local sFrameProfile = EgtGetInfo( nFrameBaseOutlineId, WIN_PROFILETYPE) + while not sFrameProfile and nFrameBaseOutlineId do + nFrameBaseOutlineId = EgtGetInfo( nFrameBaseOutlineId, WIN_SOU , 'i') + sFrameProfile = EgtGetInfo( nFrameBaseOutlineId or GDB_ID.NULL, WIN_PROFILETYPE) + end + local nFrameProfileId = EgtGetFirstNameInGroup( nFrameProfileLayerId, sFrameProfile) + + -- calcolo il box del riferimento del profilo del frame + local b3FrameProfile = GetProfileLocalBox( nFrameProfileId) + -- calcolo offset perpendicolare + local sOverlapInfo = EgtIf( EgtGetName( nOutlineId) == WIN_BOTTOM, WIN_SASH_BOTTOM_OVERLAP, WIN_SASH_TOP_OVERLAP) + local dOverlap = EgtGetInfo( nFrameProfileId, sOverlapInfo, 'd') + local dSashPerpOffset = abs( b3FrameProfile:getMin():getX()) - dOverlap + + -- faccio offset + EgtOffsetCurve( nOutlineId, - dSashPerpOffset) + end + + nBaseOutlineId = EgtGetNext( nBaseOutlineId) + end + -- accorcio gli offset + TrimAndOrientOrderedCurves( EgtGetAllInGroup( nOutlineLayerId), true) + + -- se presente, copio split + local nBaseSplitLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_BASESPLIT) + if nBaseSplitLayerId then + local nBaseSplitId = EgtGetFirstInGroup( nBaseSplitLayerId) + -- creo copia + local nSplitLayerId = EgtCopy( nBaseSplitLayerId, nAreaId) + EgtSetName( nSplitLayerId, WIN_SPLIT) + EgtSetStatus( nSplitLayerId, GDB_ST.OFF) + local nSplitId = EgtGetFirstInGroup( nSplitLayerId) + EgtSetInfo( nBaseSplitId, WIN_COPY, nSplitId) + EgtSetInfo( nSplitId, WIN_COPY, nBaseSplitId) + EgtRemoveInfo( nSplitId, WIN_SOU) + -- la taglio con outline + TrimSplitWithOutline( nSplitId) + + -- calcolo offset sulla z dal profilo dell'anta + local nPrevId = EgtGetInfo( nBaseSplitId, WIN_SPLIT_STARTINTERS, 'i') + local sSashProfile = EgtGetInfo( nPrevId, WIN_PROFILETYPE) + local nSashProfileId = EgtGetFirstNameInGroup( nSashProfileLayerId, sSashProfile) + local dSplitZOffset = EgtGetInfo( nSashProfileId, WIN_DELTA, 'd') + + -- sposto split in Z + EgtMove( nSplitId, Z_AX() * dSplitZOffset) + end + + + -- FILL + elseif nAreaType == WIN_AREATYPES.FILL then + -- ciclo su BaseArea riempimento + local nBaseOutlineId = EgtGetFirstInGroup( nAreaOutlineLayerId) + while nBaseOutlineId do + -- recupero la curva di outline del base outline da cui deriva e la copio + local nSouId = EgtGetInfo( nBaseOutlineId, WIN_SOU, 'i') + local nCopyId = EgtGetInfo( nSouId, WIN_COPY, 'i') + local nOutlineId = EgtCopy( nCopyId, nOutlineLayerId) + -- sistemo le info + EgtSetInfo( nBaseOutlineId, WIN_COPY, nOutlineId) + EgtSetInfo( nOutlineId, WIN_COPY, nBaseOutlineId) + + -- recupero a ritroso il profilo dell'elemento su cui poggia ( anta, split o frame) + local nParentBaseOutlineId = nSouId + local sParentProfile = EgtGetInfo( nParentBaseOutlineId, WIN_PROFILETYPE) + while not sParentProfile and nParentBaseOutlineId do + nParentBaseOutlineId = EgtGetInfo( nParentBaseOutlineId, WIN_SOU , 'i') + sParentProfile = EgtGetInfo( nParentBaseOutlineId or GDB_ID.NULL, WIN_PROFILETYPE) + end + local nParentOutlineId = EgtGetInfo( nParentBaseOutlineId, WIN_COPY, 'i') + local nParentProfileId = GetOutlineProfileId( nParentOutlineId, true) + sParentProfile = EgtGetName( nParentProfileId) + + -- calcolo il box del riferimento del profilo del frame + local b3FrameProfile = GetProfileLocalBox( nParentProfileId) + -- calcolo offset perpendicolare e sulla z dell'anta + local dOverlap = EgtGetInfo( nParentProfileId, WIN_FILLOVERLAP, 'd') + local bMixedSplit = ( EgtGetInfo( nParentOutlineId, WIN_PRF_CHANGE, 'b') or false) and EgtGetName( nParentOutlineId) == WIN_SPLIT + local dDimRef = EgtIf( bMixedSplit, b3FrameProfile:getMax():getX(), b3FrameProfile:getMin():getX()) + local dFillPerpOffset = abs( dDimRef) - dOverlap + if sParentProfile == WIN_FILL_RAIL then + -- se bottom rail considero la distanza necessaria per il numero di bottomrail richiesti + local nBottomRails = EgtGetInfo( nParentOutlineId, WIN_BOTTOMRAIL, 'i') + local dRailDelta1 = EgtGetInfo( nParentProfileId, WIN_RAILDELTA .. '1', 'd') + local dRailDelta2 = EgtGetInfo( nParentProfileId, WIN_RAILDELTA .. '2', 'd') + dFillPerpOffset = dFillPerpOffset + dRailDelta1 + ( nBottomRails - 1) * dRailDelta2 + end + -- faccio offset + EgtOffsetCurve( nOutlineId, - dFillPerpOffset) + + -- movimento in z + local dFillZOffset = EgtGetInfo( nParentProfileId, WIN_FILLDELTA, 'd') + EgtMove( nOutlineId, Z_AX() * dFillZOffset) + + nBaseOutlineId = EgtGetNext( nBaseOutlineId) + end + -- accorcio gli offset + TrimAndOrientOrderedCurves( EgtGetAllInGroup( nOutlineLayerId), true) + end + +end + +--------------------------------------------------------------------- +-- funzione che cicla ricorsivamente su aree e sottaree per calcolare gli outlines +local function CalculateAreaOutline( nAreaId) + -- calcolo outlines per l'area corrente + CalculateOutlineFromAreaOutline( nAreaId) + -- calcolo outlines per le eventuali sottoaree + local nChildAreaId = EgtGetFirstNameInGroup( nAreaId, WIN_AREA .. '*') + while nChildAreaId do + CalculateAreaOutline( nChildAreaId) + nChildAreaId = EgtGetNextName( nChildAreaId, WIN_AREA .. '*') + end +end + + + +---------------------------------------------------------------------------------- +------------------------ FUNZIONI AUX PER CALCOLO PEZZI ------------------------ +---------------------------------------------------------------------------------- +-- funzione che restituisce il WIN_PRF in base al nome della curva +local function GetOutlineProfileType( nOutlineId, bForceBottomRail, nBottomRail) + -- 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 + local nBottomRailTot = EgtGetInfo( nOutlineId, WIN_BOTTOMRAIL, 'i') or 0 + if bForceBottomRail and nBottomRailTot > 0 then + nProfileType = WIN_PRF.BOTTOMRAIL_FINAL + elseif nBottomRail then + -- verifico se bottomrail intermedio o finale + if nBottomRail == nBottomRailTot then + nProfileType = WIN_PRF.BOTTOMRAIL_FINAL + else + nProfileType = WIN_PRF.BOTTOMRAIL + end + else + nProfileType = WIN_PRF.BOTTOM + end + elseif sName == WIN_LEFT then + nProfileType = WIN_PRF.LEFT + elseif sName == WIN_RIGHT then + nProfileType = WIN_PRF.RIGHT + elseif sName == WIN_SPLIT then + nProfileType = WIN_PRF.SPLIT + end + return nProfileType +end + +--------------------------------------------------------------------- +-- funzione che calcola gli outline precedenti e successivi nel caso di split +local function GetSplitOtherOutline( nSplitId, nSurfSplit, nOutlineId, bPrevOrNext) + + local vOutlineIds = {} + + -- verifico se devo controllare la curva precedente o successiva dell'outline corrente + local nCrv + local bPrevOutline = false + local ptRef = EgtIf( bPrevOrNext, EgtSP( nSplitId), EgtEP( nSplitId)) + local dPar = EgtCurveParamAtPoint( nOutlineId, ptRef) + local dLenInt = EgtCurveLengthAtParam( nOutlineId, dPar) + local dLenTot = EgtCurveLength( nOutlineId) + -- se l'intersezione è più vicina alla fine dell'outline devo controllare il suo next, altrimenti il suo prev + if abs( dLenTot - dLenInt) < dLenInt then + nCrv = EgtGetNext( nOutlineId) or EgtGetFirstInGroup( EgtGetParent( nOutlineId)) + else + bPrevOutline = true + nCrv = EgtGetPrev( nOutlineId) or EgtGetLastInGroup( EgtGetParent( nOutlineId)) + end + + -- recupero il geo associato e costruisco superficie test + local nPartId = FindAssociatedPart( nCrv, true) + local nGeoId = EgtGetFirstNameInGroup( nPartId, WIN_GEO) + local nGeoOut = EgtGetFirstNameInGroup( nGeoId, WIN_GEO_OUT) + local nGeoIn = EgtGetFirstNameInGroup( nGeoId, WIN_GEO_IN) + local nCrv1 = EgtCopyGlob( nGeoOut, nGeoId) + local nCrv2 = EgtCopyGlob( nGeoIn, nGeoId) + local nCompoTest = EgtCurveCompo( nGeoId, nCrv1) + local dParTest = 0.2 + if bPrevOutline then + -- considero solo la parte finale del pezzo + EgtTrimCurveStartAtParam( nCompoTest, 1 - dParTest) + EgtAddCurveCompoLine( nCompoTest, EgtSP( nCrv2)) + EgtTrimCurveEndAtParam( nCrv2, dParTest) + else + -- considero solo la parte iniziale del pezzo + EgtTrimCurveEndAtParam( nCompoTest, dParTest) + EgtTrimCurveStartAtParam( nCrv2, 1 - dParTest) + EgtAddCurveCompoLine( nCompoTest, EgtSP( nCrv2)) + end + EgtAddCurveCompoCurve( nCompoTest, nCrv2) + EgtCloseCurveCompo( nCompoTest) + local nSurfTest = EgtSurfFlatRegion( nGeoId, { nCompoTest}) + + -- verifico se le due regioni interferiscono + if EgtSurfFrTestExternal( nSurfSplit, nSurfTest) then + vOutlineIds = { nOutlineId} + else + -- aggiungo la curva trovata tra le curve di outline da considerare rispettando l'ordinamento + if bPrevOutline then + vOutlineIds = { nCrv, nOutlineId} + else + vOutlineIds = { nOutlineId, nCrv} + end + end + + EgtErase( nCompoTest) + EgtErase( nSurfTest) + + return vOutlineIds +end + +--------------------------------------------------------------------- +-- funzione che recupera gli outline precedenti e successivi +local function GetPrevNextOutline( nProfileType, nOutlineId, nOutlineLayerId) + + local vPrevOutlineId = {} + local vNextOutlineId = {} + + if nProfileType ~= WIN_PRF.SPLIT then + vPrevOutlineId = { EgtGetPrev( nOutlineId) or EgtGetLastInGroup( nOutlineLayerId)} + vNextOutlineId = { EgtGetNext( nOutlineId) or EgtGetFirstInGroup( nOutlineLayerId)} + else + -- se split recupero tutte le curve di base outline che lo tagliano + local vPrevBaseOutlineId = EgtGetInfo( nOutlineId, WIN_SPLIT_STARTINTERS, 'vi') + for i = 1, #vPrevBaseOutlineId do + -- recupero l'outline associato al base outline che lo taglia + table.insert( vPrevOutlineId, EgtGetInfo( vPrevBaseOutlineId[i], WIN_COPY, 'i')) + end + local vNextBaseOutlineId = EgtGetInfo( nOutlineId, WIN_SPLIT_ENDINTERS, 'vi') + for i = 1, #vNextBaseOutlineId do + table.insert( vNextOutlineId, EgtGetInfo( vNextBaseOutlineId[i], WIN_COPY, 'i')) + end + + -- se lo split è tagliato da una sola curva di base outline, verifico se coinvolge altre curve + if #vPrevBaseOutlineId == 1 or #vNextBaseOutlineId == 1 then + + -- costruisco una regione approssimata per il pezzo dello split + local nGrp = EgtGetParent( nOutlineId) + local nSplitProfileId = GetOutlineProfileId( nOutlineId, false) + local b3Profile = GetProfileLocalBox( nSplitProfileId) + local nCrvOut = EgtCopyGlob( nOutlineId, nGrp) + local nCrvIn = EgtCopyGlob( nOutlineId, nGrp) + EgtOffsetCurve( nCrvOut, b3Profile:getMax():getX()) + EgtOffsetCurve( nCrvIn, b3Profile:getMin():getX()) + EgtInvertCurve( nCrvIn) + local nCompoTest = EgtCurveCompo( nGrp, nCrvOut) + EgtAddCurveCompoLine( nCompoTest, EgtSP( nCrvIn)) + EgtAddCurveCompoCurve( nCompoTest, nCrvIn) + EgtCloseCurveCompo( nCompoTest) + local nSurfTest = EgtSurfFlatRegion( nGrp, nCompoTest) + + -- se necessario aggiorno il prev + if #vPrevBaseOutlineId == 1 and EgtGetName( vPrevBaseOutlineId[1]) ~= WIN_SPLIT then + vPrevOutlineId = GetSplitOtherOutline( nOutlineId, nSurfTest, vPrevOutlineId[1], true) + end + -- se necessario aggiorno il next + if #vNextOutlineId == 1 and EgtGetName( vNextBaseOutlineId[1]) ~= WIN_SPLIT then + vNextOutlineId = GetSplitOtherOutline( nOutlineId, nSurfTest, vNextOutlineId[1], false) + end + + EgtErase( nSurfTest) + EgtErase( nCompoTest) + end + end + + return vPrevOutlineId, vNextOutlineId +end + +--------------------------------------------------------------------- +-- funzione che restituisce il tipo di controprofilo dell'outline adiacente +local function GetProfileCtrIn( nPrevOutlineId, nOutlineId, nPrevProfileId) + local sPrevCtrIn = WIN_CTRIN + -- gestione particolare del caso di split o cambio profilo + if not EgtGetFirstNameInGroup( nPrevProfileId, sPrevCtrIn) then + + local nRefSplitId = EgtGetInfo( nPrevOutlineId, WIN_REF_SPLIT, 'i') + if nRefSplitId or EgtGetName( nPrevOutlineId) == WIN_SPLIT then + -- 1) split + -- verifico da quale lato dello split originale si trova l'outline per decidere quale controprofilo considerare + local _, _, nSide = EgtPointCurveDistSide( EgtMP( nOutlineId), nRefSplitId or nPrevOutlineId, Z_AX()) + if nSide == 1 then + sPrevCtrIn = WIN_CTRIN .. '1' -- dx + else + sPrevCtrIn = WIN_CTRIN .. '2' -- sx + end + else + -- 2) pezzo del telaio con cambio profilo + -- il profilo da usare dipende dal pezzo corrente: se ha figli di tipo fill allora è legato alla parte fill del cambio profilo, se ha figli di tipo sash è legato alla parte sash, + -- se ha entrambe le tipologie di figli allora è mixed split e va considerata la parte sash ( perchè è quella utilizzata per tagliare il pezzo) + local vSashChildren = EgtGetInfo( nOutlineId, WIN_SASH_CHILDREN, 'vi') + if vSashChildren then + sPrevCtrIn = WIN_SASH .. WIN_CTRIN + else + sPrevCtrIn = WIN_FILL .. WIN_CTRIN + end + end + end + + return sPrevCtrIn +end + +--------------------------------------------------------------------- +-- funzione che crea la superficie corrispondente al Geo di un pezzo gestendo i casi di autointersezione +local function CreateGeoArea( nGeoLayId, nDestLayId, bKeepBorder) + + -- recupero le curve left e right e verifico se hanno orientamento coerente ( quindi non generano autointersezioni) + local bAutointers = false + local vLeft = EgtGetNameInGroup( nGeoLayId, WIN_LEFT) + local vRight = EgtGetNameInGroup( nGeoLayId, WIN_RIGHT) + if #vLeft == 2 and not AreSamePointApprox( EgtEP( vLeft[1]), EgtSP( vLeft[2])) then + bAutointers = true + -- se orientamento non coerente devo ignorare la prima curva + vLeft[1] = GDB_ID.NULL + end + if #vRight == 2 and not AreSamePointApprox( EgtEP( vRight[1]), EgtSP( vRight[2])) then + bAutointers = true + -- se orientamento non coerente devo ignorare la seconda curva + vRight[2] = GDB_ID.NULL + end + + local nCompoId + if not bAutointers then + -- se no autointersezioni costruisco il bordo del geo usando direttamente le sue curve + local vCrvs = EgtGetAllInGroup( nGeoLayId) + nCompoId = EgtCurveCompo( nDestLayId, vCrvs, false) + else + -- nel caso di autointersezione devo ignorare le curve left e right con orientamento non coerente + local vGeoCrvs = {} + local nOutId = EgtGetFirstNameInGroup( nGeoLayId, WIN_GEO_OUT) + vGeoCrvs[1] = EgtCopyGlob( nOutId, nDestLayId) + for i = 1, #vRight do + if vRight[i] ~= GDB_ID.NULL then + table.insert( vGeoCrvs, EgtCopyGlob( vRight[i], nDestLayId)) + end + end + local nInId = EgtGetFirstNameInGroup( nGeoLayId, WIN_GEO_IN) + table.insert( vGeoCrvs, EgtCopyGlob( nInId, nDestLayId)) + for i = 1, #vLeft do + if vLeft[i] ~= GDB_ID.NULL then + table.insert( vGeoCrvs, EgtCopyGlob( vLeft[i], nDestLayId)) + end + end + -- taglio le curve + TrimAndOrientOrderedCurves( vGeoCrvs, false) + -- creo compo + nCompoId = EgtCurveCompo( nDestLayId, vGeoCrvs) + end + + local nArea = EgtSurfFlatRegion( nDestLayId, nCompoId) + if not bKeepBorder then + EgtErase( nCompoId) + end + + return nArea +end + + + +---------------------------------------------------------------------------------- +-------------------------------- GEO ------------------------------------------- +---------------------------------------------------------------------------------- +-- 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.BOTTOMRAIL_FINAL 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 e salva nel profilo il delta del bottomrail corrente rispetto alla sua curva di outline +local function SaveRailDelta( nProfileId, nBottomRail) + local dDelta1 = EgtGetInfo( nProfileId, WIN_RAILDELTA .. '1', 'd') + local dDelta2 = EgtGetInfo( nProfileId, WIN_RAILDELTA .. '2', 'd') + local dOffs = dDelta1 + ( nBottomRail - 1) * dDelta2 + EgtSetInfo( nProfileId, WIN_RAILDELTA, dOffs) +end + +--------------------------------------------------------------------- +-- funzione che crea il gruppo con i profili di un pezzo +local function CalcProfiles( nPartId, nOutlineId, vPrevOutlineId, vNextOutlineId, nProfileType, nBottomRail) + + -- creo gruppo per i profili + local nProfileLayerId = EgtGroup( nPartId) + EgtSetName( nProfileLayerId, WIN_PROFILE) + EgtSetStatus( nProfileLayerId, GDB_ST.OFF) + + -- recupero profilo principale e ne creo copia + local nOrigMainProfileId = GetOutlineProfileId( nOutlineId, false, nProfileType) + local nMainProfileId = EgtCopy( nOrigMainProfileId, nProfileLayerId) + local sMainProfileType = EgtGetName( nMainProfileId) + EgtSetInfo( nMainProfileId, WIN_PRF_TYPE, sMainProfileType) + EgtSetName( nMainProfileId, WIN_PRF_MAIN) + -- se bottomrail salvo info per scostamento dall'outline + if sMainProfileType == WIN_FILL_RAIL or sMainProfileType == WIN_RAIL then + SaveRailDelta( nMainProfileId, nBottomRail) + end + + -- recupero profili start e ne creo copia + -- se il tipo corrente è split il pezzo va tagliato con il bottomrail, altrimenti con il bottom + for i = 1, #vPrevOutlineId do + local nOrigStartProfileId = GetOutlineProfileId( vPrevOutlineId[i], nProfileType == WIN_PRF.SPLIT) + local nStartProfileId = EgtCopy( nOrigStartProfileId, nProfileLayerId) + local sStartProfileType = EgtGetName( nStartProfileId) + EgtSetInfo( nStartProfileId, WIN_PRF_TYPE, sStartProfileType) + EgtSetName( nStartProfileId, WIN_PRF_START) + if sStartProfileType == WIN_FILL_RAIL then + local nBottomRailTot = EgtGetInfo( vPrevOutlineId[i], WIN_BOTTOMRAIL, 'i') + SaveRailDelta( nStartProfileId, nBottomRailTot) + end + end + + -- recupero profili end e ne creo copia + for i = 1, #vNextOutlineId do + local nOrigEndProfileId = GetOutlineProfileId( vNextOutlineId[i], nProfileType == WIN_PRF.SPLIT) + local nEndProfileId = EgtCopy( nOrigEndProfileId, nProfileLayerId) + local sEndProfileType = EgtGetName( nEndProfileId) + EgtSetInfo( nEndProfileId, WIN_PRF_TYPE, sEndProfileType) + EgtSetName( nEndProfileId, WIN_PRF_END) + if sEndProfileType == WIN_FILL_RAIL then + local nBottomRailTot = EgtGetInfo( vPrevOutlineId[i], WIN_BOTTOMRAIL, 'i') + SaveRailDelta( nEndProfileId, nBottomRailTot) + end + end + + -- recupero le info di pinzaggio dal profilo di estrusione + CopyInfo( nPartId, nMainProfileId, WIN_PRC_OFFY_1, 0) + CopyInfo( nPartId, nMainProfileId, WIN_PRC_OFFZ_1, 0) + CopyInfo( nPartId, nMainProfileId, WIN_PRC_OFFY_2, 0) + CopyInfo( nPartId, nMainProfileId, WIN_PRC_OFFZ_2, 0) + CopyInfo( nPartId, nMainProfileId, WIN_PRC_CLAMPV_1, 0) + CopyInfo( nPartId, nMainProfileId, WIN_PRC_CLAMPV_2, 0) + + return nProfileLayerId +end + +--------------------------------------------------------------------- +local function GetDeltaProfile( nProfileId, sCtrIn) + + local dCPDelta = 0 + local nSectionFrId = EgtGetFirstNameInGroup( nProfileId, WIN_SECTIONFRAME) + local frSectionFrame = EgtFR( nSectionFrId, GDB_ID.ROOT) + local nCPId = EgtGetFirstNameInGroup( nProfileId, sCtrIn) + local b3CP = EgtGetBBoxRef( nCPId, GDB_BB.STANDARD, frSectionFrame) + if sCtrIn == WIN_CTRIN .. 1 then + dCPDelta = abs( b3CP:getMin():getX()) + else + dCPDelta = abs( b3CP:getMax():getX()) + end + -- se bottomrail considero anche scostamento dall'outline + local sProfileType = EgtGetInfo( nProfileId, WIN_PRF_TYPE) + if sProfileType == WIN_FILL_RAIL then + local dDelta = EgtGetInfo( nProfileId, WIN_RAILDELTA, 'd') + dCPDelta = dCPDelta + dDelta + end + return dCPDelta +end + +--------------------------------------------------------------------- +-- funzione che crea le curve del geo +local function CreateFrameGeo( nOutlineId, vPrevOutlineId, vNextOutlineId, nStartPartJointType, nEndPartJointType, nGeoLayerId, nProfileLayerId) + + local nCurrProfileId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_PRF_MAIN) + -- calcolo spostamento della curva iniziale dovuto a posizione riferimento + local b3CurrProfileFrame = GetProfileLocalBox( nCurrProfileId) + local dCurrOffset = b3CurrProfileFrame:getMax():getX() + local sProfileType = EgtGetInfo( nCurrProfileId, WIN_PRF_TYPE) + if sProfileType == WIN_FILL_RAIL or sProfileType == WIN_RAIL then + -- scostamento extra legato al bottomrail + local dDelta = EgtGetInfo( nCurrProfileId, WIN_RAILDELTA, 'd') + dCurrOffset = dCurrOffset - dDelta + end + + -- creo copie degli outline e le offsetto opportunamente + -- curva out + local nOutId = EgtCopy( nOutlineId, nGeoLayerId) + EgtOffsetCurve( nOutId, dCurrOffset) + EgtSetName( nOutId, WIN_GEO_OUT) + local nSemiProfileOut = EgtGetFirstNameInGroup( nCurrProfileId, WIN_OUT) or EgtGetFirstNameInGroup( nCurrProfileId, WIN_IN .. '1') + EgtSetInfo( nOutId, WIN_SEMI_PROFILE, nSemiProfileOut) + + -- cruva in + local nInId = EgtCopy( nOutlineId, nGeoLayerId) + EgtOffsetCurve( nInId, dCurrOffset - b3CurrProfileFrame:getDimX()) + EgtInvertCurve( nInId) + EgtSetName( nInId, WIN_GEO_IN) + local nSemiProfileIn = EgtGetFirstNameInGroup( nCurrProfileId, WIN_IN) or EgtGetFirstNameInGroup( nCurrProfileId, WIN_IN .. '2') or EgtGetFirstNameInGroup( nCurrProfileId, WIN_MIXED_COMMON .. WIN_IN) + EgtSetInfo( nInId, WIN_SEMI_PROFILE, nSemiProfileIn) + + -- curve left + local vPrevProfileId = EgtGetNameInGroup( nProfileLayerId, WIN_PRF_START) + for i = 1, #vPrevOutlineId do + local nPrevCurveId + local nPrevSemiProfile + if nStartPartJointType == WIN_PART_JNT.ANGLED then + -- calcolo la bisettrice + local vtMedia = ( ( EgtSV( nOutlineId) - EgtEV( vPrevOutlineId[i])) / 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( vPrevOutlineId[i], nGeoLayerId) + if nStartPartJointType == WIN_PART_JNT.SHORT then + local sCtrIn = GetProfileCtrIn( vPrevOutlineId[i], nOutlineId, vPrevProfileId[i]) + local dCPDelta = GetDeltaProfile( vPrevProfileId[i], sCtrIn) + EgtOffsetCurve( nPrevCurveId, - dCPDelta) + -- ricavo il semiprofilo associato + nPrevSemiProfile = EgtGetFirstNameInGroup( vPrevProfileId[i], sCtrIn) + else + nPrevSemiProfile = EgtGetFirstNameInGroup( vPrevProfileId[i], WIN_OUT) + end + end + EgtSetName( nPrevCurveId, WIN_GEO_LEFT) + EgtSetInfo( nPrevCurveId, WIN_SEMI_PROFILE, nPrevSemiProfile) + EgtSetInfo( nPrevCurveId, WIN_REF_OUTLINE, vPrevOutlineId[i]) + EgtRelocateGlob( nPrevCurveId, nGeoLayerId, GDB_IN.LAST_SON) + end + + -- curve right + local vNextProfileId = EgtGetNameInGroup( nProfileLayerId, WIN_PRF_END) + for i = 1, #vNextOutlineId do + local nNextCurveId + local nNextSemiProfile + if nEndPartJointType == WIN_PART_JNT.ANGLED then + -- calcolo la bisettrice + local vtMedia = ( ( EgtSV( vNextOutlineId[i]) - 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( vNextOutlineId[i], nGeoLayerId) + if nEndPartJointType == WIN_PART_JNT.SHORT then + local sCtrIn = GetProfileCtrIn( vNextOutlineId[i], nOutlineId, vNextProfileId[i]) + local dCPDelta = GetDeltaProfile( vNextProfileId[i], sCtrIn) + EgtOffsetCurve( nNextCurveId, - dCPDelta) + -- ricavo il semiprofilo associato + nNextSemiProfile = EgtGetFirstNameInGroup( vNextProfileId[i], sCtrIn) + else + nNextSemiProfile = EgtGetFirstNameInGroup( vNextProfileId[i], WIN_OUT) + end + end + EgtSetName( nNextCurveId, WIN_GEO_RIGHT) + EgtSetInfo( nNextCurveId, WIN_SEMI_PROFILE, nNextSemiProfile) + EgtSetInfo( nNextCurveId, WIN_REF_OUTLINE, vNextOutlineId[i]) + EgtRelocateGlob( nNextCurveId, nInId, GDB_IN.BEFORE) + end + + local vIds = EgtGetAllInGroup( nGeoLayerId) + + -- trim delle curve + TrimAndOrientOrderedCurves( vIds, false) + + -- assegno spessore + local dGeoH = b3CurrProfileFrame:getDimY() + EgtModifyCurveThickness( vIds, - dGeoH) + + -- salvo spessore serramento nel gruppo + local dGeoWidth = b3CurrProfileFrame:getDimX() + EgtSetInfo( nGeoLayerId, WIN_GEOWIDTH, dGeoWidth) + EgtSetInfo( nGeoLayerId, WIN_GEOHEIGHT, dGeoH) + + -- calcolo lunghezza se pezzo lineare ( se arco verrà gestito nel calcolo dei tronchetti) + if EgtGetType( nOutlineId) == GDB_TY.CRV_LINE then + local vtS = EgtSV( nOutlineId) + local frRef = Frame3d( ORIG(), vtS, Z_AX() ^ vtS, Z_AX()) + local b3Ref = EgtGetBBoxRef( nGeoLayerId, GDB_BB.STANDARD, frRef) + EgtSetInfo( nGeoLayerId, WIN_GEOLEN, b3Ref:getDimX()) + end +end + +--------------------------------------------------------------------- +-- funzione che calcola l'ingombro dei pezzi del telaio +local function CalcFrameGeo( nPartId, nOutlineId, nOutlineCrvNbr, nOutlineLayerId, nProfileType, nBottomRail) + + -- creo layer per ingombro + local nGeoLayerId = EgtGroup( nPartId) + EgtSetName( nGeoLayerId, WIN_GEO) + + -- recupero outline precedenti e successivi ( solo nel caso di split possono essere più di uno) + local vPrevOutlineId, vNextOutlineId = GetPrevNextOutline( nProfileType, nOutlineId, nOutlineLayerId) + EgtSetInfo( nOutlineId, WIN_PREV_OUTLINES, vPrevOutlineId) + EgtSetInfo( nOutlineId, WIN_NEXT_OUTLINES, vNextOutlineId) + + -- recupero il tipo di giunzioni + local nStartJointType + local nEndJointType + local nProfileTypeS = nProfileType + local nProfileTypeE = nProfileType + if nProfileType == WIN_PRF.SPLIT or nProfileType == WIN_PRF.BOTTOMRAIL or nProfileType == WIN_PRF.BOTTOMRAIL_FINAL then + -- non serve settare dei valori per StartJointType ed EndJointType perchè in CalcPartJointType la loro giunzione viene settata a short + else + -- recupero i joints opportuni dal vettore + local vJoints = EgtGetInfo( nOutlineLayerId, WIN_JOINTS, 'vi') + if EgtGetName( nOutlineId) == WIN_BOTTOM then + nStartJointType = vJoints[1] + nEndJointType = vJoints[2] + elseif EgtGetName( nOutlineId) == WIN_RIGHT then + nStartJointType = vJoints[2] + nEndJointType = vJoints[3] + elseif EgtGetName( nOutlineId) == WIN_TOP then + nStartJointType = vJoints[3] + nEndJointType = vJoints[4] + -- correzioni per caso a triangolo + if EgtGetName( vPrevOutlineId[1]) == WIN_BOTTOM then + nStartJointType = vJoints[2] + nEndJointType = vJoints[3] + -- il lato top deve essere trattato come un left/right nel calcolo della giunzione + nProfileTypeS = WIN_PRF.LEFT + end + if EgtGetName( vNextOutlineId[1]) == WIN_BOTTOM then + nStartJointType = vJoints[3] + nEndJointType = vJoints[1] + nProfileTypeE = WIN_PRF.LEFT + end + elseif EgtGetName( nOutlineId) == WIN_LEFT then + nStartJointType = vJoints[4] or vJoints[3] -- ( vJoints[3] per gestire caso a triangolo) + nEndJointType = vJoints[1] + end + + -- se giunzione diversa da bisettrice e arco a tutto sesto oppure elementi entrambi dello stesso tipo, forzo il tipo a bisettrice + if nStartJointType ~= WIN_JNT.ANGLED and ( AreSameVectorApprox( EgtEV( vPrevOutlineId[1]), EgtSV( nOutlineId)) or EgtGetName( nOutlineId) == EgtGetName( vPrevOutlineId[1])) then + nStartJointType = WIN_JNT.ANGLED + end + if nEndJointType ~= WIN_JNT.ANGLED and ( AreSameVectorApprox( EgtEV( nOutlineId), EgtSV( vNextOutlineId[1])) or EgtGetName( nOutlineId) == EgtGetName( vNextOutlineId[1])) then + nEndJointType = WIN_JNT.ANGLED + end + end + + -- calcolo il tipo di giunzione per la parte + local nStartPartJointType = CalcPartJointType( nProfileTypeS, nStartJointType) + local nEndPartJointType = CalcPartJointType( nProfileTypeE, nEndJointType) + -- nel caso di incontro con soglia la giunzione deve essere full + if EgtGetInfo( vPrevOutlineId[1], WIN_THRESHOLD, 'b') then + nStartPartJointType = WIN_JNT.FULL + end + if EgtGetInfo( vNextOutlineId[1], WIN_THRESHOLD, 'b') then + nEndPartJointType = WIN_JNT.FULL + end + + -- salvo il valore dei joints su outline + -- se bottomrail è sicuramente short quindi non salvo il valore che sovrascriverebbe quello del pezzo bottom ( che potrebbe essere short o full) + if nProfileType ~= WIN_PRF.BOTTOMRAIL and nProfileType ~= WIN_PRF.BOTTOMRAIL_FINAL then + EgtSetInfo( nOutlineId, WIN_STARTJOINT, nStartPartJointType) + EgtSetInfo( nOutlineId, WIN_ENDJOINT, nEndPartJointType) + end + + -- creo il gruppo con i profili del pezzo + local nProfileLayerId = CalcProfiles( nPartId, nOutlineId, vPrevOutlineId, vNextOutlineId, nProfileType, nBottomRail) + + -- creo lati dell'outline + CreateFrameGeo( nOutlineId, vPrevOutlineId, vNextOutlineId, nStartPartJointType, nEndPartJointType, nGeoLayerId, nProfileLayerId) + +end + +--------------------------------------------------------------------- +-- funzione che calcola l'ingombro del fill +local function 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_GLASSTHICKNESS, dGlassThickness) + + -- verifico forma e salvataggio info associate + local nCompo = EgtCurveCompo( nGeoLayerId, EgtGetAllInGroup( nGeoLayerId), false) + local bRect, ptTest, vtEdge1, vtEdge2 = EgtCurveIsARectangle( nCompo) + EgtSetInfo( nGeoLayerId, WIN_GLASS_RECT, bRect) + if bRect then + EgtSetInfo( nGeoLayerId, WIN_GEOWIDTH, vtEdge1:len()) + EgtSetInfo( nGeoLayerId, WIN_GEOHEIGHT, vtEdge2:len()) + else + -- se non è rettangolare salvo le dimensioni del suo box orientato in modo ottimale + local _, dDim1, dDim2 = EgtCurveMinAreaRectangleXY( nCompo) + EgtSetInfo( nGeoLayerId, WIN_GEOWIDTH, dDim1) + EgtSetInfo( nGeoLayerId, WIN_GEOHEIGHT, dDim2) + end + EgtErase( nCompo) + + return nGeoLayerId +end + + + +---------------------------------------------------------------------------------- +----------------------- CURVE AUX PER CAMBIO PROFILO ----------------------------- +---------------------------------------------------------------------------------- +-- funzione che individua e crea i diversi tratti uniformi della curva di outline +local function CalcMixedOutlines( nPartId, nOutlineId) + + -- creo gruppo dove salvare i sottotratti + local nGrp = EgtGroup( nPartId) + EgtSetName( nGrp, WIN_MIXED_OUTLINES) + EgtSetStatus( nGrp, GDB_ST.OFF) + + -- recupero i tratti di tipo sash e li concateno + local vSashChildren = EgtGetInfo( nOutlineId, WIN_SASH_CHILDREN, 'vi') + local vSash = {} + for i = 1, #vSashChildren do + local nCrv = EgtCopyGlob( vSashChildren[i], nGrp) + table.insert( vSash, nCrv) + end + local nCrvS, nCntS = EgtCurveCompoByReorder( nGrp, vSash, EgtSP( nOutlineId)) + for nId = nCrvS, nCrvS + nCntS - 1 do + EgtSetName( nId, WIN_SASH) + end + + -- recupero i tratti di tipo fill e li concateno + local vFillChildren = EgtGetInfo( nOutlineId, WIN_FILL_CHILDREN, 'vi') + local vFill = {} + for i = 1, #vFillChildren do + local nCrv = EgtCopyGlob( vFillChildren[i], nGrp) + table.insert( vFill, nCrv) + end + local nCrvF, nCntF = EgtCurveCompoByReorder( nGrp, vFill, EgtSP( nOutlineId)) + for nId = nCrvF, nCrvF + nCntF - 1 do + EgtSetName( nId, WIN_FILL) + end + + -- riordino le curve nel gruppo per ricostruire l'outline + EgtReorderCurvesInGroup( nGrp, EgtSP( nOutlineId)) + + -- creo associazione tra le sottocurve di outline e gli split che le separano : + -- recupero tutti gli split coinvolti + local nBaseOutline = EgtGetInfo( nOutlineId, WIN_COPY, 'i') + local vStack = { nBaseOutline} + local vSplitIds = {} + local i = 1 + while vStack[i] do + -- recupero il tipo di area + local nAreaId = EgtGetParent( EgtGetParent( vStack[i])) + local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') + if nAreaType ~= WIN_AREATYPES.SASH and nAreaType ~= WIN_AREATYPES.FILL then + -- salvo il suo eventuale split + local nSplitLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_SPLIT) + if nSplitLayerId then + local nSplitId = EgtGetFirstInGroup( nSplitLayerId) + table.insert( vSplitIds, nSplitId) + end + -- analizzo eventuali figli + local vChildren = EgtGetInfo( vStack[i], WIN_CHILD, 'vi') or {} + vStack = EgtJoinTables( vStack, vChildren) + end + i = i + 1 + end + + -- associo le curve con lo split che le taglia nel loro punto finale + local vCrvs = EgtGetAllInGroup( nGrp) + for i = 1, #vSplitIds do + local ptS = EgtSP( vSplitIds[i]) + local ptE = EgtEP( vSplitIds[i]) + for j = 1, #vCrvs - 1 do + local ptTest = EgtEP( vCrvs[j]) + if AreSamePointApprox( ptS, ptTest) then + EgtSetInfo( vSplitIds[i], WIN_MIXED_REF_START, vCrvs[j]) + EgtSetInfo( vCrvs[j], WIN_MIXED_SPLIT_REF, vSplitIds[i]) + break + elseif AreSamePointApprox( ptE, ptTest) then + EgtSetInfo( vSplitIds[i], WIN_MIXED_REF_END, vCrvs[j]) + EgtSetInfo( vCrvs[j], WIN_MIXED_SPLIT_REF, vSplitIds[i]) + break + end + end + end + + return nGrp +end + +--------------------------------------------------------------------- +-- funzione che crea la curva di riferimento sulla giunzione tra il pezzo di split e il pezzo di telaio con cambio profilo +local function CalcMixedIntersections( nPartId, nOutline, vOutlines) + + local nGrp = EgtGroup( nPartId) + EgtSetName( nGrp, WIN_MIXED_INTERSECTIONS) + EgtSetStatus( nGrp, GDB_ST.OFF) + + -- recupero il profilo dell'outline + local nProfileLayerId = EgtGetFirstNameInGroup( nPartId, WIN_PROFILE) + local nMainProfileId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_PRF_MAIN) + + for i = 1, #vOutlines - 1 do + + -- recupero la curva di split che separa i due tratti di outline + local nSplitId = EgtGetInfo( vOutlines[i], WIN_MIXED_SPLIT_REF, 'i') + local nSplitProfileId = GetOutlineProfileId( nSplitId, false) + + -- verifico ordinamento + local bSashFill = ( EgtGetName( vOutlines[i]) == WIN_SASH) + + -- ricavo il punto di incontro tra le due parti dei profili che vanno contro il vetro + local nCrv1 = EgtCopyGlob( nSplitId, nGrp) + local dDeltaFixedSplit = EgtGetInfo( nSplitProfileId, WIN_FIXED_REF, 'd') + EgtOffsetCurve( nCrv1, dDeltaFixedSplit) + local nCrv2 = EgtCopyGlob( nOutline, nGrp) + local dDeltaFixedFrame = EgtGetInfo( nMainProfileId, WIN_FIXED_REF, 'd') + EgtOffsetCurve( nCrv2, - dDeltaFixedFrame) + local ptRef1 = EgtIP( nCrv1, nCrv2, ORIG()) + + -- ricavo il punto di incontro tra il taglio a 45° e la parte del telaio contro anta + -- TO DO : capire come gestire correttamente la rotazione nel caso di arco + local dParRef = EgtCurveParamAtPoint( nCrv2, ptRef1) + local vtDir45 = EgtUV( nCrv2, dParRef, -1) + vtDir45:rotate( Z_AX(), EgtIf( bSashFill, 225, -45)) + local nCrv3 = EgtLinePVL( nGrp, ptRef1, vtDir45, 100) + local nCrv4 = EgtCopyGlob( nOutline, nGrp) + local dDeltaSashFrame = EgtGetInfo( nMainProfileId, WIN_SASH_REF .. '1', 'd') + EgtOffsetCurve( nCrv4, - dDeltaSashFrame) + local ptRef2 = EgtIP( nCrv3, nCrv4, ORIG()) + + -- curva di intersezione da usare come riferimento per i conti successivi + local nCrv = EgtCurveCompoFromPoints( nGrp, { ptRef1, ptRef2}) + + -- calcolo il raccordo + local dRad = EgtGetInfo( nMainProfileId, WIN_RAD_REF .. '1', 'd') + local dParFillet = EgtCurveParamAtPoint( nCrv4, ptRef2) + dParFillet = dParFillet + EgtIf( bSashFill, -10, 10) * GEO.EPS_SMALL + local nFillet = EgtCurveFillet( nGrp, nCrv, EgtUP( nCrv1, 0.9), nCrv4, EgtUP( nCrv4, dParFillet), dRad, true) or GDB_ID.NULL + EgtAddCurveCompoCurve( nCrv, nFillet) + + -- cancello curve di costruzione + EgtErase( { nCrv1, nCrv2, nCrv3, nCrv4}) + + -- assegno riferimento + EgtSetInfo( vOutlines[i], WIN_MIXED_INTERS_REF, nCrv) + end +end + +--------------------------------------------------------------------- +-- funzione che calcola curve ausiliarie per la gestione del cambio profilo +local function CalcMixedFrameCurves( nPartId, nOutlineId) + -- calcolo i sottotratti uniformi della curva di outline + local nOutlinesGrp = CalcMixedOutlines( nPartId, nOutlineId) + local vCrvs = EgtGetAllInGroup( nOutlinesGrp) + -- calcolo le curve di intersezione con gli split + CalcMixedIntersections( nPartId, nOutlineId, vCrvs) +end + + + +---------------------------------------------------------------------------------- +--------------------------- PROFILING PROCESSINGS -------------------------------- +---------------------------------------------------------------------------------- +-- funzione che copia sulla curva di lavorazione le informazioni prese dal semiprofilo corrispondente +local function GetProcessingInfoFromSemiProfile( nCrv, nSemiProfile) + + if nSemiProfile then + -- setto info di lavorazione + EgtSetInfo( nCrv, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.PROFILING) + -- setto info con il tipo di profiling + local sName = EgtGetName( nCrv) + if sName == WIN_GEO_LEFT or sName == WIN_GEO_RIGHT then + EgtSetInfo( nCrv, WIN_PRC_PROFILE_INFO, WIN_PRC_PROFILE_TYPE.HEAD) + else + EgtSetInfo( nCrv, WIN_PRC_PROFILE_INFO, WIN_PRC_PROFILE_TYPE.LONGITUDINAL) + end + -- recupero le info di lavorazione dal semiprofilo + if sName == WIN_GEO_OUT or sName == WIN_GEO_IN then + -- recupero la fase solo se si tratta di in o out + CopyInfo( nCrv, nSemiProfile, WIN_PRC_PHASE) + end + local nTools = EgtGetInfo( nSemiProfile, WIN_PRC_NTOOLS , 'i') or 0 + EgtSetInfo( nCrv, WIN_PRC_NTOOLS, nTools) + for j = 1, nTools do + CopyInfo( nCrv, nSemiProfile, WIN_PRC_TOOL_NAME .. '_' .. tostring(j)) + CopyInfo( nCrv, nSemiProfile, WIN_PRC_OFFL .. '_' .. tostring(j)) + CopyInfo( nCrv, nSemiProfile, WIN_PRC_OFFR .. '_' .. tostring(j)) + end + else + -- se non ha semiprofilo associato è un taglio + EgtSetInfo( nCrv, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.CUT) + end +end + +--------------------------------------------------------------------- +-- funzione che calcola la prima lavorazione per l'innesto dello split sul telaio nel caso di cambio profilo +local function CalcMixedFrameMilling1( nIntersCrv, nOutlineId, nMainProfileId, nSplitRef, bSashFill, nProcLayerId, nSurfGeoId) + + local dOffs = EgtGetInfo( nMainProfileId, WIN_SASH_REF .. '1', 'd') + local dDepth = EgtGetInfo( nMainProfileId, WIN_SASH_DEPTH .. '1', 'd') + local dFilletRad = EgtGetInfo( nMainProfileId, WIN_RAD_REF .. '1', 'd') + + -- primo tratto : taglio a 45° e fillet + local nCrv1 = EgtCopyGlob( nIntersCrv, nProcLayerId) + EgtExtendCurveStartByLen( nCrv1, 100) + + -- calcolo il tratto di outline + local nCrv2 = EgtCopyGlob( nOutlineId, nProcLayerId) + EgtOffsetCurve( nCrv2, - dOffs) + if bSashFill then + EgtInvertCurve( nCrv2) + end + local dParS = EgtCurveParamAtPoint( nCrv2, EgtEP( nCrv1)) + local ptEnd = EgtIP( nCrv2, nSplitRef, ORIG()) + local dParE = EgtCurveParamAtPoint( nCrv2, ptEnd) + EgtTrimCurveStartEndAtParam( nCrv2, dParS, dParE) + + -- tratto di uscita a 45° + local vtDir2 = EgtEV( nCrv2) + vtDir2:rotate( Z_AX(), EgtIf( bSashFill, - 45, 45)) + local nCrv3 = EgtLinePVL( nProcLayerId, ptEnd, vtDir2, 100) + + -- creo fillet + local nFillet = EgtCurveFillet( nProcLayerId, nCrv2, EgtUP( nCrv2, 0.9), nCrv3, EgtUP( nCrv3, 0.1), dFilletRad, true) + + -- creo curva di lavorazione + local nMillingCrv = EgtCurveCompo( nProcLayerId, {nCrv1, nCrv2, nFillet, nCrv3}) + if bSashFill then + EgtInvertCurve( nMillingCrv) + end + EgtModifyCurveThickness( nMillingCrv, - dDepth) + -- setto info di lavorazione + EgtSetInfo( nMillingCrv, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.PROFILING) + EgtSetInfo( nMillingCrv, WIN_PRC_PROFILE_INFO, WIN_PRC_PROFILE_TYPE.GENERIC) + EgtSetInfo( nMillingCrv, WIN_PRC_SIDE, WIN_PRC_SIDETYPE.IN) + EgtTrimCurveWithRegion( nMillingCrv, nSurfGeoId, true, false) + +end + +--------------------------------------------------------------------- +-- funzione che calcola la seconda lavorazione per l'innesto dello split sul telaio nel caso di cambio profilo +local function CalcMixedFrameMilling2( nIntersCrv, nOutlineId, nMainProfileId, nSplitProfileId, nSplitRef, bSashFill, nProcLayerId, nSurfGeoId) + + local dOffs = EgtGetInfo( nMainProfileId, WIN_SASH_REF .. '2', 'd') + local dDepth = EgtGetInfo( nMainProfileId, WIN_SASH_DEPTH .. '2', 'd') + local dFilletRad = EgtGetInfo( nMainProfileId, WIN_RAD_REF .. '2', 'd') + local dExtraDist = EgtGetInfo( nMainProfileId, WIN_EXTRA_DIST, 'd') + + local nCrv1 = EgtCopyGlob( nIntersCrv, nProcLayerId) + EgtExtendCurveStartByLen( nCrv1, 100) + + -- calcolo il primo tratto di outline + local nCrv2 = EgtCopyGlob( nOutlineId, nProcLayerId) + EgtOffsetCurve( nCrv2, - dOffs + dExtraDist) + if bSashFill then + EgtInvertCurve( nCrv2) + end + + -- taglio i due tratti per unirli + local pt1 = EgtIP( nCrv1, nCrv2, ORIG()) + local dParE1 = EgtCurveParamAtPoint( nCrv1, pt1) + EgtTrimCurveEndAtParam( nCrv1, dParE1) + local dParS2 = EgtCurveParamAtPoint( nCrv2, pt1) + EgtTrimCurveStartAtParam( nCrv2, dParS2) + + -- calcolo fillet + local nFillet1 = EgtCurveFillet( nProcLayerId, nCrv1, EgtUP( nCrv1, 0.9), nCrv2, EgtUP( nCrv2, 0.1), dFilletRad, true) + + -- calcolo il secondo tratto di outline + local nCrv3 = EgtCopyGlob( nOutlineId, nProcLayerId) + EgtOffsetCurve( nCrv3, - dOffs) + if bSashFill then + EgtInvertCurve( nCrv3) + end + local nSplitRef2 = EgtCopyGlob( nSplitRef, nProcLayerId) + local dOffs1 = EgtGetInfo( nSplitProfileId, WIN_SASH_REF .. '1', 'd') + local dOffs2 = EgtGetInfo( nSplitProfileId, WIN_SASH_REF .. '2', 'd') + EgtOffsetCurve( nSplitRef2, dOffs2 - dOffs1) + local pt2 = EgtIP( nCrv3, nSplitRef2, ORIG()) + local pt3 = EgtIP( nCrv3, nSplitRef, ORIG()) + local dParS3 = EgtCurveParamAtPoint( nCrv3, pt2) + local dParE3 = EgtCurveParamAtPoint( nCrv3, pt3) + EgtTrimCurveStartEndAtParam( nCrv3, dParS3, dParE3) + EgtErase( nSplitRef2) + + -- calcolo il raccordo tra i due tratti di outline : è arco di raggio dFilletRad, tangente a nCrv2 e con punto finale pt2 + -- calcolo il centro dell'arco + local nCircleTmp = EgtCircle( nProcLayerId, pt2, dFilletRad) + local nCrvTmp = EgtCopyGlob( nOutlineId, nProcLayerId) + EgtOffsetCurve( nCrvTmp, - dOffs + dExtraDist - dFilletRad) + local ptC = EgtIP( nCircleTmp, nCrvTmp, EgtIf( bSashFill, EgtEP( nCrvTmp), EgtSP( nCrvTmp))) + EgtErase( {nCircleTmp, nCrvTmp}) + local nFillet2 = EgtArcC2PEx( nProcLayerId, ptC, EgtSP( nCrv2), GDB_PT.TG, nCrv2, pt2) + + -- taglio il primo tratto di outline per collegarlo al raccordo + local dParE2 = EgtCurveParamAtPoint( nCrv2, EgtSP( nFillet2)) + EgtTrimCurveEndAtParam( nCrv2, dParE2) + + -- tratto di uscita a 45° + local vtDir2 = EgtEV( nCrv3) + vtDir2:rotate( Z_AX(), EgtIf( bSashFill, - 45, 45)) + local nCrv4 = EgtLinePVL( nProcLayerId, EgtEP( nCrv3), vtDir2, 100) + + -- creo fillet + local nFillet3 = EgtCurveFillet( nProcLayerId, nCrv3, EgtUP( nCrv3, 0.9), nCrv4, EgtUP( nCrv4, 0.1), dFilletRad, true) or GDB_ID.NULL + + -- creo curva di lavorazione + local nMillingCrv = EgtCurveCompo( nProcLayerId, {nCrv1, nFillet1, nCrv2, nFillet2, nCrv3, nFillet3, nCrv4}) + if bSashFill then + EgtInvertCurve( nMillingCrv) + end + EgtModifyCurveThickness( nMillingCrv, - dDepth) + -- setto info di lavorazione + EgtSetInfo( nMillingCrv, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.PROFILING) + EgtSetInfo( nMillingCrv, WIN_PRC_PROFILE_INFO, WIN_PRC_PROFILE_TYPE.GENERIC) + EgtSetInfo( nMillingCrv, WIN_PRC_SIDE, WIN_PRC_SIDETYPE.IN) + EgtTrimCurveWithRegion( nMillingCrv, nSurfGeoId, true, false) + +end + +--------------------------------------------------------------------- +-- funzione che calcola le lavorazioni di profiling per un pezzo di telaio con cambio profilo +local function CalcMixedFrameProfilingProcessings( nPartId, nProcLayerId, nGeoLayerId, nMainProfileId, nSurfGeoId) + + -- a) lavorazioni profili + -- per le lavorazioni dei profili out, left, right e in comune si usano le corrispondenti curve del geo + local vGeoCrvs = EgtGetAllInGroup( nGeoLayerId) + for i = 1, #vGeoCrvs do + -- copio curva + local nCrv = EgtCopyGlob( vGeoCrvs[i], nProcLayerId) + EgtModifyCurveThickness( nCrv, 0) + -- recupero il semiprofilo associato + local nSemiProfile = EgtGetInfo( nCrv, WIN_SEMI_PROFILE, 'i') + GetProcessingInfoFromSemiProfile( nCrv, nSemiProfile) + end + + -- lavorazioni dei sottotratti in di sash e fill + local nOutlinesGrp = EgtGetFirstNameInGroup( nPartId, WIN_MIXED_OUTLINES) + local vCrvs = EgtGetAllInGroup( nOutlinesGrp) + local b3Profile = GetProfileLocalBox( nMainProfileId) + local dOffs = b3Profile:getMin():getX() + for i = #vCrvs, 1, -1 do + -- calcolo la curva di lavorazione + local nCrv = EgtCopyGlob( vCrvs[i], nProcLayerId) + EgtOffsetCurve( nCrv, dOffs) + EgtInvertCurve( nCrv) + nCrv = EgtTrimCurveWithRegion( nCrv, nSurfGeoId, true, true) + -- setto le info di lavorazione dal semiprofilo + local nSemiProfile = EgtGetFirstNameInGroup( nMainProfileId, EgtGetName( vCrvs[i]) .. WIN_IN) + GetProcessingInfoFromSemiProfile( nCrv, nSemiProfile) + -- sistemo info di lavorazione + EgtSetInfo( nCrv, WIN_PRC_PROFILE_INFO, WIN_PRC_PROFILE_TYPE.MIXED) + EgtSetInfo( nCrv, WIN_PRC_SIDE, WIN_PRC_SIDETYPE.IN) + -- TO DO : calcolo di AddLen ? + end + + -- b) lavorazioni sulle intersezioni con gli split + local nIntersGrp = EgtGetFirstNameInGroup( nPartId, WIN_MIXED_INTERSECTIONS) + local vInters = EgtGetAllInGroup( nIntersGrp) + local nOutlineId = EgtGetInfo( nPartId, WIN_REF_OUTLINE, 'i') + for i = 1, #vInters do + + local bSashFill = ( EgtGetName( vCrvs[i]) == WIN_SASH) + -- recupero lo split associato e creo la curva di riferimento per le fresature + local nSplitId = EgtGetInfo( vCrvs[i], WIN_MIXED_SPLIT_REF, 'i') + local nSplitProfileId = GetOutlineProfileId( nSplitId, false) + local dRefSplit = EgtGetInfo( nSplitProfileId, WIN_SASH_REF .. '2', 'd') + local nSplitRef = EgtCopyGlob( nSplitId, nProcLayerId) + EgtOffsetCurve( nSplitRef, - dRefSplit) + + -- Fresatura 1 + CalcMixedFrameMilling1( vInters[i], nOutlineId, nMainProfileId, nSplitRef, bSashFill, nProcLayerId, nSurfGeoId) + -- Fresatura 2 + CalcMixedFrameMilling2( vInters[i], nOutlineId, nMainProfileId, nSplitProfileId, nSplitRef, bSashFill, nProcLayerId, nSurfGeoId) + + EgtErase( nSplitRef) + end +end + +--------------------------------------------------------------------- +-- funzione che calcola le lavorazioni di profiling nel caso di uno split coinvolto da cambio profilo +local function CalcMixedSplitProfilingProcessings( nSplitId, nProcLayerId, nGeoLayerId) + + -- a) lavorazione dei profili + local vGeoCrvs = EgtGetAllInGroup( nGeoLayerId) + for i = 1, #vGeoCrvs do + -- copio la curva + local nCrvId = EgtCopyGlob( vGeoCrvs[i], nProcLayerId) + EgtModifyCurveThickness( nCrvId, 0) + -- recupero il semiprofilo associato ( per left e right è stato salvato il profilo di tipo sash) + local nSemiProfileId = EgtGetInfo( nCrvId, WIN_SEMI_PROFILE, 'i') + -- setto le info dal semiprofilo + GetProcessingInfoFromSemiProfile( nCrvId, nSemiProfileId) + end + + -- b) tagli a 45° + -- left + local nMixedLeft = EgtGetInfo( nSplitId, WIN_MIXED_REF_START, 'i') + local nIntersLeft = EgtGetInfo( nMixedLeft, WIN_MIXED_INTERS_REF, 'i') + local nMillingLeft = EgtCopyGlob( nIntersLeft, nProcLayerId) + -- recupero profondità + local vOutlineLeft = EgtGetInfo( nSplitId, WIN_PREV_OUTLINES, 'vi') + local nProfileLeft = GetOutlineProfileId( vOutlineLeft[1], false) + local dDepthLeft = EgtGetInfo( nProfileLeft, WIN_SASH_DEPTH .. '2', 'd') + EgtModifyCurveThickness( nMillingLeft, - dDepthLeft) + -- setto info di lavorazione + EgtSetInfo( nMillingLeft, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.PROFILING) + EgtSetInfo( nMillingLeft, WIN_PRC_PROFILE_INFO, WIN_PRC_PROFILE_TYPE.GENERIC) + EgtSetInfo( nMillingLeft, WIN_PRC_SIDE, WIN_PRC_SIDETYPE.LEFT) + + -- right + local nMixedRight = EgtGetInfo( nSplitId, WIN_MIXED_REF_END, 'i') + local nIntersRight = EgtGetInfo( nMixedRight, WIN_MIXED_INTERS_REF, 'i') + local nMillingRight = EgtCopyGlob( nIntersRight, nProcLayerId) + -- recupero profondità + local vOutlineRight = EgtGetInfo( nSplitId, WIN_NEXT_OUTLINES, 'vi') + local nProfileRight = GetOutlineProfileId( vOutlineRight[1], false) + local dDepthRight = EgtGetInfo( nProfileRight, WIN_SASH_DEPTH .. '2', 'd') + EgtModifyCurveThickness( nMillingRight, - dDepthRight) + EgtInvertCurve( nMillingRight) + -- setto info di lavorazione + EgtSetInfo( nMillingRight, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.PROFILING) + EgtSetInfo( nMillingRight, WIN_PRC_PROFILE_INFO, WIN_PRC_PROFILE_TYPE.GENERIC) + EgtSetInfo( nMillingRight, WIN_PRC_SIDE, WIN_PRC_SIDETYPE.RIGHT) + +end + +--------------------------------------------------------------------- +-- funzione che calcola le lavorazioni di profiling +local function CalcProfilingProcessings( nPartId, nOutlineId) + + -- creo gruppo delle lavorazioni + local nProcLayerId = EgtGroup( nPartId) + EgtSetName( nProcLayerId, WIN_PRC) + EgtSetStatus( nProcLayerId, GDB_ST.OFF) + + -- recupero il geo e creo la superficie associata per limitare le lavorazioni + local nGeoLayerId = EgtGetFirstNameInGroup( nPartId, WIN_GEO) + local nSurfGeo = CreateGeoArea( nGeoLayerId, nProcLayerId, false) + EgtSurfFrOffset( nSurfGeo, 50 * GEO.EPS_SMALL) + + -- recupero il gruppo dei profili + local nProfileLayerId = EgtGetFirstNameInGroup( nPartId, WIN_PROFILE) + local nMainProfileId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_PRF_MAIN) + + -- recupero le info di sovramateriale dal profilo + CopyInfo( nPartId, nMainProfileId, WIN_PRC_OVERMAT_IN, 0) + CopyInfo( nPartId, nMainProfileId, WIN_PRC_OVERMAT_OUT, 0) + CopyInfo( nPartId, nMainProfileId, WIN_PRC_OVERMAT_LEFT, 0) + CopyInfo( nPartId, nMainProfileId, WIN_PRC_OVERMAT_RIGHT, 0) + + -- calcolo lavorazioni dei profili + local bChangeProfile = EgtGetInfo( nOutlineId, WIN_PRF_CHANGE, 'b') or false + if bChangeProfile then + -- 1) caso cambio profilo : telaio o split + if EgtGetName( nOutlineId) == WIN_SPLIT then + CalcMixedSplitProfilingProcessings( nOutlineId, nProcLayerId, nGeoLayerId) + else + CalcMixedFrameProfilingProcessings( nPartId, nProcLayerId, nGeoLayerId, nMainProfileId, nSurfGeo) + end + else + -- 2) caso standard + -- recupero tutte le curve del geo + local vGeoCrvs = EgtGetAllInGroup( nGeoLayerId) + for i = 1, #vGeoCrvs do + -- copio curva + local nCrvId = EgtCopyGlob( vGeoCrvs[i], nProcLayerId) + EgtModifyCurveThickness( nCrvId, 0) + -- recupero il semiprofilo associato + local nSemiProfileId = EgtGetInfo( nCrvId, WIN_SEMI_PROFILE, 'i') + -- setto le info dal semiprofilo + GetProcessingInfoFromSemiProfile( nCrvId, nSemiProfileId) + end + end + + -- calcolo eventuali lavorazioni per strip + local vStripDist = EgtGetInfo( nMainProfileId, WIN_STRIP_DIST, 'vi') or {} + for i = 1, #vStripDist do + local nStripCut = EgtCopyGlob( nOutlineId, nProcLayerId) + EgtOffsetCurve( nStripCut, vStripDist[i]) + -- modifico la curva in modo che sia a filo del geo + EgtExtendCurveStartByLen( nStripCut, 1000) + EgtExtendCurveEndByLen( nStripCut, 1000) + nStripCut = EgtTrimCurveWithRegion( nStripCut, nSurfGeo, true, false) + -- aggiusto orientamento per essere coerente con il geo corrispondente + if vStripDist[i] < 0 then + EgtInvertCurve( nStripCut) + end + -- setto info di lavorazione + EgtSetName( nStripCut, WIN_PRC_TYPE.STRIP_CUT) + EgtSetInfo( nStripCut, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.STRIP_CUT) + end + EgtErase( nSurfGeo) + + -- verifico se anta ricevente ( info necessaria per ottimizzazione lavorazioni) + local nAreaId = EgtGetParent( EgtGetParent( nOutlineId)) + local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') + if nAreaType == WIN_AREATYPES.SASH then + local nSashType = EgtGetInfo( nAreaId, WIN_SASHTYPE, 'i') + if nSashType == WIN_SASHTYPES.INACTIVE or nSashType == WIN_SASHTYPES.INACTIVE_IN then + local nBaseOutlineId = EgtGetInfo( nOutlineId, WIN_COPY, 'i') + local bOnFrenchSplit = EgtGetInfo( nBaseOutlineId, WIN_CRV_ON_FRENCH_SPLIT, 'b') + if bOnFrenchSplit then + EgtSetInfo( nPartId, WIN_SASHTYPE, WIN_INACTIVE) + end + end + end + +end + +--------------------------------------------------------------------- +-- funzione che calcola gli elementi ausiliari per la creazione del grezzo nell'automatismo delle lavorazioni +local function CalcGeoRaw( nPartId) + + local nGeoLayerId = EgtGetFirstNameInGroup( nPartId, WIN_GEO) + local nGeoRawLayerId = EgtCopyGlob( nGeoLayerId, nPartId) + EgtSetName( nGeoRawLayerId, WIN_GEO_RAW) + EgtSetStatus( nGeoRawLayerId, GDB_ST.OFF) + + -- recupero le curve del geo + local nOut = EgtGetFirstNameInGroup( nGeoRawLayerId, WIN_GEO_OUT) + local nIn = EgtGetFirstNameInGroup( nGeoRawLayerId, WIN_GEO_IN) + local vRight = EgtGetNameInGroup( nGeoRawLayerId, WIN_GEO_RIGHT) + local vLeft = EgtGetNameInGroup( nGeoRawLayerId, WIN_GEO_LEFT) + -- verifico se le curve right e left hanno direzioni coerenti + if #vRight == 2 and not AreSamePointApprox( EgtEP( vRight[1]), EgtSP( vRight[2])) then + -- la seconda curva va ignorata + EgtErase( vRight[2]) + vRight = { vRight[1]} + end + if #vLeft == 2 and not AreSamePointApprox( EgtEP( vLeft[1]), EgtSP( vLeft[2])) then + -- la prima curva va ignorata + EgtErase( vLeft[1]) + vLeft = { vLeft[2]} + end + + -- recupero i sovramateriali da applicare alle curve + local dOvermatOut = EgtGetInfo( nPartId, WIN_PRC_OVERMAT_OUT, 'd') + local dOvermatRight = EgtGetInfo( nPartId, WIN_PRC_OVERMAT_RIGHT, 'd') + local dOvermatIn = EgtGetInfo( nPartId, WIN_PRC_OVERMAT_IN, 'd') + local dOvermatLeft = EgtGetInfo( nPartId, WIN_PRC_OVERMAT_LEFT, 'd') + + -- applico i sovramateriali + EgtOffsetCurve( nOut, dOvermatOut) + for i = 1, #vRight do + EgtOffsetCurve( vRight[i], dOvermatRight) + end + EgtOffsetCurve( nIn, dOvermatIn) + for i = 1, #vLeft do + EgtOffsetCurve( vLeft[i], dOvermatLeft) + end + + -- creo la composita del grezzo a partire dalle curve + local vCrvs = EgtGetAllInGroup( nGeoRawLayerId) + TrimAndOrientOrderedCurves( vCrvs, false) + local nCompo = EgtCurveCompo( nGeoRawLayerId, vCrvs) + -- aggiungo spessore + local dDimH = EgtGetInfo( nGeoLayerId, WIN_GEOHEIGHT, 'd') + EgtModifyCurveThickness( nCompo, - dDimH) + + -- creo frame ausiliario + local vtX = EgtSV( nCompo) + local frGeo = Frame3d( EgtSP( nCompo), vtX, Z_AX() ^ vtX, Z_AX()) + local nFrameId = EgtFrame( nGeoRawLayerId, frGeo) + EgtSetName( nFrameId, WIN_PRC_FRAME) +end + + + +---------------------------------------------------------------------------------- +---------------------------------- SOLIDO ---------------------------------------- +---------------------------------------------------------------------------------- +-- funzione che costruisce una superficie estrudendo il nSectionId lungo l'outline +local function CreateProfileSurfById( nOutlineId, nProfileId, nSectionId, dExtraLen, nLayerId) + + -- creo guida con estensione in tangenza + local nGuideId = EgtCopy( nOutlineId, nLayerId) + if EgtGetType( nGuideId) == GDB_TY.CRV_LINE then + EgtExtendCurveStartByLen( nGuideId, dExtraLen) + EgtExtendCurveEndByLen( nGuideId, dExtraLen) + else + nGuideId = EgtCurveCompo( nLayerId, nGuideId) + EgtAddCurveCompoLineTg( nGuideId, dExtraLen) + EgtAddCurveCompoLineTg( nGuideId, dExtraLen, false) + end + -- correzione nel caso di bottomrail + local sProfileType = EgtGetInfo( nProfileId, WIN_PRF_TYPE) + if sProfileType == WIN_RAIL or sProfileType == WIN_FILL_RAIL then + local dOffs = EgtGetInfo( nProfileId, WIN_RAILDELTA, 'd') + EgtOffsetCurve( nGuideId, - dOffs) + end + + -- verifico se necessaria inversione della guida nel caso sia curva "virtuale" ( ovvero in area null o split) che deriva da pezzo di split + local nRefSplitId = EgtGetInfo( nOutlineId, WIN_REF_SPLIT, 'i') + if nRefSplitId then + -- recupero base outline per confrontarlo con lo split da cui deriva + local nBaseOutlineId = EgtGetInfo( nOutlineId, WIN_COPY, 'i') + -- recupero vettore tangente nel punto medio del base outline + local ptM = EgtMP( nBaseOutlineId) + local vtM = EgtMV( nBaseOutlineId) + -- recupero vettore tangente nello stesso punto della curva di split da cui deriva + local dRefSplitPar = EgtCurveParamAtPoint( nRefSplitId, ptM) + local vtMRefSplit = EgtUV( nRefSplitId, dRefSplitPar, -1) + -- se i due vettori non sono orientati nella stessa direzione inverto la guida + if not AreSameVectorApprox( vtM, vtMRefSplit) then + EgtInvertCurve( nGuideId) + end + end + + -- recupero il profilo da estrudere + local nSectionRefId = EgtCopyGlob( nSectionId, nLayerId) + + -- posiziono la sezione di estrusione sulla guida : + -- recupero frame del profilo + local nProfileFrameId = EgtGetFirstNameInGroup( nProfileId, WIN_SECTIONFRAME) + local frProfile = EgtFR( nProfileFrameId, GDB_ID.ROOT) + frProfile:invert() + -- calcolo il frame di destinazione sulla guida + local frDest = Frame3d( EgtSP( nGuideId), - EgtSV( nGuideId), GDB_RT.GLOB) + -- posiziono con i riferimenti + EgtTransform( nSectionRefId, frProfile, GDB_RT.GLOB) + EgtTransform( nSectionRefId, frDest, GDB_RT.GLOB) + + -- creo la superfice di estrusione + local nStmId = EgtSurfTmSwept( nLayerId, nSectionRefId, nGuideId, false, WIN_SURF_APPROX) + EgtErase( nGuideId) + EgtErase( nSectionRefId) + + return nStmId +end + +--------------------------------------------------------------------- +-- come CreateProfileSurfById ma riceve il nome della sezione da estrudere +local function CreateProfileSurf( nOutlineId, nProfileId, sSectionName, dExtraLen, nLayerId) + -- recupero l'id della sezione da estrudere + local nSectionId = EgtGetFirstNameInGroup( nProfileId, sSectionName) + if not nSectionId then return end + return CreateProfileSurfById( nOutlineId, nProfileId, nSectionId, dExtraLen, nLayerId) +end + +--------------------------------------------------------------------- +-- funzione che crea la superficie di trim per il solido +local function CreateTrimSurf( nGeoId, nProfileId, dGeoWidth, nLayerId) + + -- recupero profilo di riferimento dalla curva geo + local nOrigTrimProfileId = EgtGetInfo( nGeoId, WIN_SEMI_PROFILE, 'i') + + -- 1) minizinken + if not nOrigTrimProfileId then + + local nGuideId = EgtCopy( nGeoId, nLayerId) + EgtExtendCurveStartByLen( nGuideId, 4 * dGeoWidth) + EgtExtendCurveEndByLen( nGuideId, 4 * dGeoWidth) + EgtMove( nGuideId, Z_AX()) + local b3Profile = GetProfileLocalBox( nProfileId) + local nTrimSurf = EgtSurfTmByExtrusion( nLayerId, nGuideId, - Z_AX() * ( b3Profile:getDimY() + 2), WIN_SURF_APPROX) + EgtInvertSurf( nTrimSurf) + EgtErase( nGuideId) + return nTrimSurf + + -- 2) controprofilo + else + -- recupero il controprofilo da estrudere + local sTrimProfileName = EgtGetName( nOrigTrimProfileId) + sTrimProfileName = EgtIf( s_bSimplSolid, WIN_SIMPLIFIED, '') .. WIN_OFST .. sTrimProfileName + -- recupero la curva di outline associata alla curva di geo + local nRefOutline = EgtGetInfo( nGeoId, WIN_REF_OUTLINE, 'i') + -- calcolo la superficie di estrusione + return CreateProfileSurf( nRefOutline, nProfileId, sTrimProfileName, 4 * dGeoWidth, nLayerId) + end + +end + +--------------------------------------------------------------------- +-- funzione che crea le superfici di trim per uno split coinvolto da cambio profilo ( controprofilo della parte sash del telaio e taglio a 45°) +local function CreateMixedSplitTrimSurf( nMixedOutlineId, nProfileId, dExtraLen, nLayerId) + + -- estrudo il controprofilo di tipo sash + local nPartId = EgtGetParent( EgtGetParent( nMixedOutlineId)) + local nOutlineId = EgtGetInfo( nPartId, WIN_REF_OUTLINE, 'i') + local sTrimProfile = EgtIf( s_bSimplSolid, WIN_SIMPLIFIED, '') .. WIN_OFST .. WIN_SASH .. WIN_CTRIN + local nTrimStmId = CreateProfileSurf( nOutlineId, nProfileId, sTrimProfile, dExtraLen, nLayerId) + + -- creo il solido da intersecare con il controprofilo per il taglio a 45° + local nIntersCrvId = EgtGetInfo( nMixedOutlineId, WIN_MIXED_INTERS_REF, 'i') + local nGuideId = EgtCopyGlob( nIntersCrvId, nLayerId) + local bSashFill = ( EgtGetName( nMixedOutlineId) ~= WIN_SASH) + local vtDirH = EgtSV( nGuideId) + vtDirH:rotate( Z_AX(), EgtIf( bSashFill, -135, 135)) + local vtDirV = EgtSV( nGuideId) + vtDirV:rotate( Z_AX(), EgtIf( bSashFill, -45, 45)) + EgtAddCurveCompoLine( nGuideId, EgtEP( nGuideId) + dExtraLen * vtDirV) + EgtAddCurveCompoLine( nGuideId, EgtSP( nGuideId) + dExtraLen * vtDirH, false) + EgtAddCurveCompoLine( nGuideId, EgtSP( nGuideId) + dExtraLen * vtDirV, false) + EgtCloseCurveCompo( nGuideId) + EgtMove( nGuideId, 0.01 * Z_AX()) + if bSashFill then + EgtInvertCurve( nGuideId) + end + local dDepth = EgtGetInfo( nProfileId, WIN_SASH_DEPTH .. '2', 'd') + local nCutStmId = EgtSurfTmByRegionExtrusion( nLayerId, nGuideId, - ( dDepth + 2) * Z_AX()) + + -- creo una superficie di trim unica + EgtSurfTmSubtract( nTrimStmId, nCutStmId) + + EgtErase( { nGuideId, nCutStmId}) + + return nTrimStmId +end + +--------------------------------------------------------------------- +-- funzione che crea il solido di estrusione principale +local function CreateMainSurf( nOutlineId, dExtraLen, nProfileId, sSectionName, nLayerId) + + -- curva guida + local nGuideId = EgtCopy( nOutlineId, nLayerId) + EgtSetName( nGuideId, WIN_MAINGUIDE) + EgtSetStatus( nGuideId, GDB_ST.OFF) + EgtExtendCurveStartByLen( nGuideId, dExtraLen) + EgtExtendCurveEndByLen( nGuideId, dExtraLen) + + -- se bottomrail sposto opportunamente l'outline + local sProfileType = EgtGetInfo( nProfileId, WIN_PRF_TYPE) + if sProfileType == WIN_RAIL or sProfileType == WIN_FILL_RAIL then + local dOffs = EgtGetInfo( nProfileId, WIN_RAILDELTA, 'd') + EgtOffsetCurve( nGuideId, -dOffs) + end + + -- posiziono il profilo sulla curva guida : + -- recupero il frame del profilo + local nProfileFrameId = EgtGetFirstNameInGroup( nProfileId, WIN_SECTIONFRAME) + local frInvert = EgtFR( nProfileFrameId) + frInvert:invert() + -- lo applico a tutte le geometrie del profilo + EgtTransform( EgtGetAllInGroup( nProfileId), frInvert) + -- assegno come riferimento del profilo il punto start dell'outline + EgtChangeGroupFrame( nProfileId, Frame3d( EgtSP( nGuideId), - EgtSV( nGuideId))) + + -- recupero outline del profilo Main e lo estrudo + local nSectionId = EgtGetFirstNameInGroup( nProfileId, sSectionName) + local nMainExtrusionId = EgtSurfTmSwept( nLayerId, nSectionId, nGuideId, false, WIN_SURF_APPROX) + EgtSetName( nMainExtrusionId, WIN_SRF_MAIN) + + return nMainExtrusionId +end + +--------------------------------------------------------------------- +-- funzione che crea il solido di un pezzo di telaio con cambio profilo +local function CalcMixedFrameSolid( nOutlineId, nSolidLayerId, nProfileLayerId, nGeoLayerId, dGeoWidth) + + -- a) SOLIDO PRINCIPALE + local nMainProfileId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_PRF_MAIN) + -- creo i solidi corrispondenti ai diversi sottotratti uniformi del pezzo + local nMixedOutlinesGrp = EgtGetFirstNameInGroup( EgtGetParent( nSolidLayerId), WIN_MIXED_OUTLINES) + local vMixedOutlines = EgtGetAllInGroup( nMixedOutlinesGrp) + local vMainExtrusions = {} + for i = 1, #vMixedOutlines do + local sSection = EgtIf( s_bSimplSolid, WIN_SIMPLIFIED, '') .. EgtGetName( vMixedOutlines[i]) .. WIN_SECTION + local nMainExtrusionId = CreateMainSurf( vMixedOutlines[i], 2 * dGeoWidth, nMainProfileId, sSection, nSolidLayerId) + table.insert( vMainExtrusions, nMainExtrusionId) + end + + -- taglio i sottopezzi nei punti di intersezione per unirli + local nMixedIntersectionsGrp = EgtGetFirstNameInGroup( EgtGetParent( nSolidLayerId), WIN_MIXED_INTERSECTIONS) + local vIntersections = EgtGetAllInGroup( nMixedIntersectionsGrp) + for i = 1, #vIntersections do + -- creo la superficie di separazione tra i due sottopezzi + local bSashFill = ( EgtGetName( vMixedOutlines[i]) == WIN_SASH) + local vtDirS = EgtSV( vIntersections[i]) + vtDirS:rotate( Z_AX(), EgtIf( bSashFill, -135, 135)) + local vtDirE = EgtSV( vIntersections[i]) + vtDirE:rotate( Z_AX(), EgtIf( bSashFill, 45, -45)) + local nCrvTrim = EgtCurveCompo( nSolidLayerId, vIntersections[i], false) + EgtAddCurveCompoLine( nCrvTrim, EgtSP( nCrvTrim) + dGeoWidth * vtDirS, false) + EgtAddCurveCompoLine( nCrvTrim, EgtEP( nCrvTrim) + dGeoWidth * vtDirE) + EgtMove( nCrvTrim, Z_AX()) + local nStmTrim = EgtSurfTmByExtrusion( nSolidLayerId, nCrvTrim, - 2 * dGeoWidth * Z_AX()) + + -- taglio i due sottopezzi + EgtSurfTmSubtract( vMainExtrusions[i+1], nStmTrim) + EgtInvertSurf( nStmTrim) + EgtSurfTmSubtract( vMainExtrusions[i], nStmTrim) + + EgtErase( nCrvTrim) + EgtErase( nStmTrim) + end + + -- unisco i sottopezzi in una sola superficie + for i = 2, #vMainExtrusions do + EgtSurfTmAdd( vMainExtrusions[1], vMainExtrusions[i]) + EgtErase( vMainExtrusions[i]) + end + + -- creo una copia dell'estrusione principale ( usata per ferramenta) + local nOrigMainExtrusionId = EgtCopy( vMainExtrusions[1], nSolidLayerId) + EgtSetName( nOrigMainExtrusionId, WIN_SRF_ORIGMAIN) + EgtSetStatus( nOrigMainExtrusionId, GDB_ST.OFF) + + -- come guida tengo solo una copia della curva di outline + local vMainGuideIds = EgtGetNameInGroup( nSolidLayerId, WIN_MAINGUIDE) + EgtErase( vMainGuideIds) + local nMainGuideId = EgtCopyGlob( nOutlineId, nSolidLayerId) + EgtSetName( nMainGuideId, WIN_MAINGUIDE) + EgtSetStatus( nMainGuideId, GDB_ST.OFF) + + -- b) TRIM START + local nPrevGeoId = EgtGetFirstNameInGroup( nGeoLayerId, WIN_GEO_LEFT) + local nStartProfileId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_PRF_START) + local nTrimSurfStart = CreateTrimSurf( nPrevGeoId, nStartProfileId, dGeoWidth, nSolidLayerId) + EgtSetName( nTrimSurfStart, WIN_SRF_START) + EgtSetStatus( nTrimSurfStart, GDB_ST.OFF) + EgtSurfTmIntersect( vMainExtrusions[1], nTrimSurfStart) + + -- c) TRIM END + local nNextGeoId = EgtGetFirstNameInGroup( nGeoLayerId, WIN_GEO_RIGHT) + local nEndProfileId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_PRF_END) + local nTrimSurfEnd = CreateTrimSurf( nNextGeoId, nEndProfileId, dGeoWidth, nSolidLayerId) + EgtSetName( nTrimSurfEnd, WIN_SRF_END) + EgtSetStatus( nTrimSurfEnd, GDB_ST.OFF) + EgtSurfTmIntersect( vMainExtrusions[1], nTrimSurfEnd) + + return vMainExtrusions[1] +end + +--------------------------------------------------------------------- +-- funzione che crea il solido di un pezzo di split coinvolto da cambio profilo +local function CalcMixedSplitSolid( nOutlineId, nSolidLayerId, nProfileLayerId, dGeoWidth) + + -- a) creo il solido di estrusione principale + local nMainProfileId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_PRF_MAIN) + local sSection = EgtIf( s_bSimplSolid, WIN_SIMPLIFIED, '') .. WIN_SECTION + local nMainExtrusionId = CreateMainSurf( nOutlineId, 2 * dGeoWidth, nMainProfileId, sSection, nSolidLayerId) + -- creo una copia + local nOrigMainExtrusionId = EgtCopy( nMainExtrusionId, nSolidLayerId) + EgtSetName( nOrigMainExtrusionId, WIN_SRF_ORIGMAIN) + EgtSetStatus( nOrigMainExtrusionId, GDB_ST.OFF) + + -- b) trim start + local nPrevProfileId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_PRF_START) + local nPrevMixedOutline = EgtGetInfo( nOutlineId, WIN_MIXED_REF_START, 'i') + local nStmTrimStart = CreateMixedSplitTrimSurf( nPrevMixedOutline, nPrevProfileId, dGeoWidth, nSolidLayerId) + EgtSetName( nStmTrimStart, WIN_SRF_START) + EgtSetStatus( nStmTrimStart, GDB_ST.OFF) + EgtSurfTmIntersect( nMainExtrusionId, nStmTrimStart) + + -- c) trim end + local nNextProfileId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_PRF_END) + local nNextMixedOutline = EgtGetInfo( nOutlineId, WIN_MIXED_REF_END, 'i') + local nStmTrimEnd = CreateMixedSplitTrimSurf( nNextMixedOutline, nNextProfileId, dGeoWidth, nSolidLayerId) + EgtSetName( nStmTrimEnd, WIN_SRF_END) + EgtSetStatus( nStmTrimEnd, GDB_ST.OFF) + EgtSurfTmIntersect( nMainExtrusionId, nStmTrimEnd) + + return nMainExtrusionId +end + +--------------------------------------------------------------------- +-- funzione che crea il solido del pezzo +local function CalcSolid( nPartId, nOutlineId) + + -- creo layer per solido + local nSolidLayerId = EgtGroup( nPartId) + EgtSetName( nSolidLayerId, WIN_SOLID) + + -- recupero profilo principale + local nProfileLayerId = EgtGetFirstNameInGroup( nPartId, WIN_PROFILE) + + -- recupero geo e la sua larghezza + local nGeoLayerId = EgtGetFirstNameInGroup( nPartId, WIN_GEO) + local dGeoWidth = EgtGetInfo( nGeoLayerId, WIN_GEOWIDTH, 'd') + + -- gestione speciale per pezzi con CAMBIO PROFILO + local bChangeProfile = EgtGetInfo( nOutlineId, WIN_PRF_CHANGE, 'b') or false + if bChangeProfile then + if EgtGetName( nOutlineId) == WIN_SPLIT then + return CalcMixedSplitSolid( nOutlineId, nSolidLayerId, nProfileLayerId, dGeoWidth) + else + return CalcMixedFrameSolid( nOutlineId, nSolidLayerId, nProfileLayerId, nGeoLayerId, dGeoWidth) + end + end + + -- a) creo il solido di estrusione principale + local nMainProfileId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_PRF_MAIN) + local sSection = EgtIf( s_bSimplSolid, WIN_SIMPLIFIED, '') .. WIN_SECTION + local nMainExtrusionId = CreateMainSurf( nOutlineId, 2 * dGeoWidth, nMainProfileId, sSection, nSolidLayerId) + -- creo una copia ( usata per calcolo ferramenta) + local nOrigMainExtrusionId = EgtCopy( nMainExtrusionId, nSolidLayerId) + EgtSetName( nOrigMainExtrusionId, WIN_SRF_ORIGMAIN) + EgtSetStatus( nOrigMainExtrusionId, GDB_ST.OFF) + + -- b) trim con i controprofili sullo start + local vPrevGeoId = EgtGetNameInGroup( nGeoLayerId, WIN_GEO_LEFT) + local vStartProfileId = EgtGetNameInGroup( nProfileLayerId, WIN_PRF_START) + for i = 1, #vPrevGeoId do + -- creo la superficie di trim + local nTrimSurf = CreateTrimSurf( vPrevGeoId[i], vStartProfileId[i], dGeoWidth, nSolidLayerId) + EgtSetStatus( nTrimSurf, GDB_ST.OFF) + EgtSetName( nTrimSurf, WIN_SRF_START) + -- eseguo intersezione per ottenere un solido unico ( tagliare le due superfici con EgtSurfTmCut e poi unirle potrebbe creare piccoli buchi legati alle diverse approssimazioni) + EgtSurfTmIntersect( nMainExtrusionId, nTrimSurf) + end + + -- c) trim con i controprofili sull'end + local vNextGeoId = EgtGetNameInGroup( nGeoLayerId, WIN_GEO_RIGHT) + local vEndProfileId = EgtGetNameInGroup( nProfileLayerId, WIN_PRF_END) + for i = 1, #vNextGeoId do + -- creo la superficie di trim + local nTrimSurf = CreateTrimSurf( vNextGeoId[i], vEndProfileId[i], dGeoWidth, nSolidLayerId) + EgtSetStatus( nTrimSurf, GDB_ST.OFF) + EgtSetName( nTrimSurf, WIN_SRF_END) + -- eseguo intersezione per ottenere un solido unico + EgtSurfTmIntersect( nMainExtrusionId, nTrimSurf) + end + + return nMainExtrusionId +end + +--------------------------------------------------------------------- +-- funzione che crea il solido del Fill +local function CalcFillSolid( nPartId, nOutlineLayerId, nGeoLayerId) + -- creo layer per solido + local nSolidLayerId = EgtGroup( nPartId) + EgtSetName( nSolidLayerId, WIN_SOLID) + -- creo compo di outline + local vOutlineList = EgtGetAllInGroup( nOutlineLayerId) + local nCompoOutlineId = EgtCurveCompoByChain( nSolidLayerId, vOutlineList, EgtSP( vOutlineList[1]), false) + -- recupero spessore vetro + local dGlassThickness = EgtGetInfo( nGeoLayerId, WIN_GLASSTHICKNESS, 'd') + local nSurfId = EgtSurfTmByRegionExtrusion( nSolidLayerId, nCompoOutlineId, Z_AX() * dGlassThickness) + EgtErase( nCompoOutlineId) +end + +---------------------------------------------------------------------------------- +-- funzione che aggiorna il solido principale con quello associato ad una lavorazione partendo dalla sua curva +local function UpdateSolidWithProcessingSurf( nProcId, nSolidId, nLayerId) + + if not EgtCurveIsClosed( nProcId) then + return + end + + local vtExtr = EgtCurveExtrusion( nProcId) + local dThick = EgtCurveThickness( nProcId) + local nRefCrv = nProcId + -- se solidi semplificati approssimo in modo grossolano per velocizzare operazioni di subtract ( soprattuto su archi) + if s_bSimplSolid then + nRefCrv = EgtCopyGlob( nProcId, nLayerId) + EgtApproxCurve( nRefCrv, GDB_CA.LINES, s_dSimplSolidApprox) + end + local nProcSolidId = EgtSurfTmByRegionExtrusion( nLayerId, nRefCrv, dThick * vtExtr) + + -- sottraggo al solido + EgtSurfTmSubtract( nSolidId, nProcSolidId) + + EgtErase( nProcSolidId) + if s_bSimplSolid then + EgtErase( nRefCrv) + end +end + + + +---------------------------------------------------------------------------------- +--------------------------------- PREVIEW ---------------------------------------- +---------------------------------------------------------------------------------- +local function CalcBottomRailPreview( nPreviewGrp, nOutlineId, nBottomRail, nProfileGrp, nGeoGrp, color) + + -- costruisco box complessivo degli zoccoli + local vCrvs = {} + + -- la curva out corrisponde al geo in del pezzo bottom + local nPartGeoIn = EgtGetFirstNameInGroup( nGeoGrp, WIN_GEO_IN) + vCrvs[1] = EgtCopyGlob( nPartGeoIn, nPreviewGrp) + + local vNextOutlines = EgtGetInfo( nOutlineId, WIN_NEXT_OUTLINES, 'vi') + local vEndProfiles = EgtGetNameInGroup( nProfileGrp, WIN_PRF_END) + local b3ProfileEnd = GetProfileLocalBox( vEndProfiles[1]) + vCrvs[2] = EgtCopyGlob( vNextOutlines[1], nPreviewGrp) + EgtOffsetCurve( vCrvs[2], b3ProfileEnd:getMin():getX()) + + -- la curva in corrisponde al geo in dell'ultimo bottomrail + local vBottomRails = EgtGetInfo( nOutlineId, WIN_REF_BOTTOMRAIL_PART, 'vi') + local nBottomRailPart = vBottomRails[#vBottomRails] + local nGeoLayer = EgtGetFirstNameInGroup( nBottomRailPart, WIN_GEO) + local nGeoIn = EgtGetFirstNameInGroup( nGeoLayer, WIN_GEO_IN) + vCrvs[3] = EgtCopyGlob( nGeoIn, nPreviewGrp) + + local vPrevOutlines = EgtGetInfo( nOutlineId, WIN_PREV_OUTLINES, 'vi') + local vStartProfiles = EgtGetNameInGroup( nProfileGrp, WIN_PRF_START) + local b3ProfileStart = GetProfileLocalBox( vStartProfiles[1]) + vCrvs[4] = EgtCopyGlob( vPrevOutlines[1], nPreviewGrp) + EgtOffsetCurve( vCrvs[4], b3ProfileStart:getMin():getX()) + + -- creo il bordo + TrimAndOrientOrderedCurves( vCrvs, true) + local nCrvId = EgtCurveCompo( nPreviewGrp, vCrvs, false) + EgtSetColor( nCrvId, EgtStdColor( 'BLACK')) + EgtModifyCurveThickness( nCrvId, 0) + -- creo la regione + local nAreaId = EgtSurfFlatRegion( nPreviewGrp, {nCrvId}) + EgtSetColor( nAreaId, color) + EgtRelocateGlob( nCrvId, nAreaId, GDB_IN.AFTER) + + -- creo linee di divisione tra gli zoccoli + if nBottomRail > 1 then + local dLen = EgtCurveLength( vCrvs[1]) + local dStep = 1 / nBottomRail + for i = 1, nBottomRail - 1 do + local pt = EgtUP( vCrvs[4], i * dStep) + local nCrvId = EgtLinePVL( nPreviewGrp, pt, X_AX(), dLen) + EgtSetColor( nCrvId, EgtStdColor( 'BLACK')) + end + end + + EgtErase( vCrvs) +end + +---------------------------------------------------------------------------------- +local function CalcPartPreview( nPartId, nPreviewGrp) + + local nOutlineId = EgtGetInfo( nPartId, WIN_REF_OUTLINE, 'i') + local nGeoGrp = EgtGetFirstNameInGroup( nPartId, WIN_GEO) + local nProfileGrp = EgtGetFirstNameInGroup( nPartId, WIN_PROFILE) + + -- gruppo temporaneo per i conti + local nGrpTmp = EgtGroup( nPreviewGrp) + + -- curva out è il geo out tranne nel caso di sash active/inactive per le quali considero l'outline per evitare sovrapposizioni + local nBaseOutlineId = EgtGetInfo( nOutlineId, WIN_COPY, 'i') + local bOnSplit = EgtGetInfo( nBaseOutlineId, WIN_CRV_ON_FRENCH_SPLIT, 'b') + if bOnSplit then + local nCrv = EgtCopyGlob( nOutlineId, nGrpTmp) + EgtSetName( nCrv, WIN_GEO_OUT) -- setto il nome per la funzione CreateGeoArea + else + local nGeoOut = EgtGetFirstNameInGroup( nGeoGrp, WIN_GEO_OUT) + EgtCopyGlob( nGeoOut, nGrpTmp) + end + + -- curva right + local nEndJoint = EgtGetInfo( nOutlineId, WIN_ENDJOINT, 'i') + if nEndJoint == WIN_PART_JNT.SHORT then + -- se giunzione short per evitare sovrapposizioni devo fermarla al box del pezzo adiacente + local vNextOutlines = EgtGetInfo( nOutlineId, WIN_NEXT_OUTLINES, 'vi') + local vEndProfiles = EgtGetNameInGroup( nProfileGrp, WIN_PRF_END) + for i = 1, #vNextOutlines do + local nCrv = EgtCopyGlob( vNextOutlines[i], nGrpTmp) + local b3Profile = GetProfileLocalBox( vEndProfiles[i]) + local dOffs = b3Profile:getMin():getX() + EgtOffsetCurve( nCrv, dOffs) + EgtSetName( nCrv, WIN_RIGHT) + end + else + -- altrimenti posso utilizzare la curva del geo + local vGeoRight = EgtGetNameInGroup( nGeoGrp, WIN_RIGHT) + for i = 1, #vGeoRight do + EgtCopyGlob( vGeoRight[i], nGrpTmp) + end + end + + -- curva in + local nGeoIn = EgtGetFirstNameInGroup( nGeoGrp, WIN_GEO_IN) + EgtCopyGlob( nGeoIn, nGrpTmp) + + -- curva left + local nStartJoint = EgtGetInfo( nOutlineId, WIN_STARTJOINT, 'i') + if nStartJoint == WIN_PART_JNT.SHORT then + local vPrevOutlines = EgtGetInfo( nOutlineId, WIN_PREV_OUTLINES, 'vi') + local vStartProfiles = EgtGetNameInGroup( nProfileGrp, WIN_PRF_START) + for i = 1, #vPrevOutlines do + local nCrv = EgtCopyGlob( vPrevOutlines[i], nGrpTmp) + local b3Profile = GetProfileLocalBox( vStartProfiles[i]) + local dOffs = b3Profile:getMin():getX() + EgtOffsetCurve( nCrv, dOffs) + EgtSetName( nCrv, WIN_LEFT) + end + else + local vGeoLeft = EgtGetNameInGroup( nGeoGrp, WIN_LEFT) + for i = 1, #vGeoLeft do + EgtCopyGlob( vGeoLeft[i], nGrpTmp) + end + end + + -- eventuale trim delle curve se non ho considerato tutte le curve del geo + if nStartJoint == WIN_PART_JNT.SHORT or nEndJoint == WIN_PART_JNT.SHORT or bOnSplit then + TrimAndOrientOrderedCurves( EgtGetAllInGroup( nGrpTmp), true) + end + + -- creo il bordo e la regione + local nAreaId = CreateGeoArea( nGrpTmp, nPreviewGrp, true) + local color = EgtGetColor( nPartId) + EgtSetColor( nAreaId, color) + local nCrvId = EgtGetPrev( nAreaId or GDB_ID.NULL) or GDB_ID.NULL + EgtRelocateGlob( nCrvId, nAreaId, GDB_IN.AFTER) + EgtSetColor( nCrvId, EgtStdColor( 'BLACK')) + EgtModifyCurveThickness( nCrvId, 0) + EgtErase( nGrpTmp) + + -- se bottom aggiungo anche eventuale preview del bottomrail + if EgtGetName( nOutlineId) == WIN_BOTTOM then + local nBottomRail = EgtGetInfo( nOutlineId, WIN_BOTTOMRAIL, 'i') or 0 + if nBottomRail > 0 then + CalcBottomRailPreview( nPreviewGrp, nOutlineId, nBottomRail, nProfileGrp, nGeoGrp, color) + end + end +end + +---------------------------------------------------------------------------------- +local function CalcFillPreview( nPartId, nPreviewGrp) + -- creo bordo a partire dall'outline + local nAreaId = EgtGetInfo( nPartId, WIN_AREA, 'i') + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_OUTLINE) + local vOutlineList = EgtGetAllInGroup( nOutlineLayerId) + local nCompoOutlineId = EgtCurveCompoByChain( nPreviewGrp, vOutlineList, EgtSP( vOutlineList[1]), false) + -- creo area + local nSurfId = EgtSurfFlatRegion( nPreviewGrp, {nCompoOutlineId}) + EgtSetColor( nSurfId, EgtGetColor( nPartId)) + EgtErase( nCompoOutlineId) +end + +---------------------------------------------------------------------------------- +local function CalcPreview( nFrameId) + + -- creo gruppo per la preview + local nPreviewGrp = EgtGroup( GDB_ID.ROOT) + EgtSetName( nPreviewGrp, WIN_PREVIEW) + EgtSetLevel( nPreviewGrp, GDB_LV.SYSTEM) + EgtSetStatus( nPreviewGrp, GDB_ST.OFF) + + -- scorro tutti i pezzi e ne realizzo la preview + local nPartId = EgtGetFirstPart() + while nPartId do + local nPartType = EgtGetInfo( nPartId, WIN_PART_TYPE, 'i') or WIN_PART_TYPES.NULL + if nPartType == WIN_PART_TYPES.FILL then + CalcFillPreview( nPartId, nPreviewGrp) + elseif nPartType == WIN_PART_TYPES.BOTTOMRAIL then + -- pezzo di bottomrail viene ignorato perchè già creato con il corrispondente pezzo bottom + else + CalcPartPreview( nPartId, nPreviewGrp) + end + nPartId = EgtGetNextPart( nPartId) + end +end + + + +---------------------------------------------------------------------------------- +---------------------------------- DOWELS ---------------------------------------- +---------------------------------------------------------------------------------- +-- funzione che recupera la lunghezza del dowel +local function CalcDowelLen( nDowelId, sKey, bFullOrShort) + + local sDefaultKey = EgtIf( bFullOrShort, WIN_DWL_TOP_PERP_LEN, WIN_DWL_TOP_PARA_LEN) + local dLen = EgtGetInfo( nDowelId, sKey, 'd') or EgtGetInfo( nDowelId, sDefaultKey, 'd') + dLen = dLen + s_dDowelTol + return dLen + +end + +--------------------------------------------------------------------- +-- funzione che calcola il riferimento dove posizionare i dowels +local function CreateDowelFrameDest( nRefProfileType, nPrevGeo, nGeo, nRefOutline, bCurrFullOrShort, bSashOrFrame) + + -- 1) la direzione z è determinata dal pezzo short + local vtZ + if EgtGetType( nRefOutline) == GDB_TY.CRV_LINE then + vtZ = EgtEV( nRefOutline) + else + -- se pezzo ad arco, recupero la direzione dalla curva nel punto estremo del geo + local nGeoRefCrv + if bCurrFullOrShort then + nGeoRefCrv = EgtGetFirstNameInGroup( nPrevGeo, WIN_RIGHT) + else + nGeoRefCrv = EgtGetFirstNameInGroup( nGeo, WIN_LEFT) + end + local ptInt = EgtIP( nGeoRefCrv, nRefOutline, ORIG()) + local dPar = EgtCurveParamAtPoint( nRefOutline, ptInt, 100 * GEO.EPS_SMALL) + vtZ = EgtUV( nRefOutline, dPar, -1) + end + + local frDest = Frame3d( ORIG(), - vtZ) + + -- 2) punto di origine + local nPrevRight = EgtGetFirstNameInGroup( nPrevGeo, WIN_GEO_RIGHT) + local ptRef1 = EgtIf( bCurrFullOrShort, EgtSP( nPrevRight), EgtEP( nPrevRight)) + local nLeft = EgtGetFirstNameInGroup( nGeo, WIN_GEO_LEFT) + local ptRef2 = EgtIf( bCurrFullOrShort, EgtSP( nLeft), EgtEP( nLeft)) + -- riporto i punti sulla curva di outline su cui va posizionato il profilo con le spine + local _, ptInt1 = EgtPointCurveDist( ptRef1, nRefOutline) + local _, ptInt2 = EgtPointCurveDist( ptRef2, nRefOutline) + + -- nel caso di telaio conviene tenere il punto più "interno" visto che la correzione sarà fatta verso l'esterno + -- nel caso di anta conviene tenere quello più "esterno" visto che la correzione sarà fatta verso l'interno + ptInt1:toLoc( frDest) + ptInt2:toLoc( frDest) + local ptInt + if ptInt1:getX() > ptInt2:getX() then + ptInt = EgtIf( bSashOrFrame, Point3d( ptInt1), Point3d( ptInt2)) + else + ptInt = EgtIf( bSashOrFrame, Point3d( ptInt2), Point3d( ptInt1)) + end + ptInt:toGlob( frDest) + + -- modifico il punto di origine del frame nel punto individuato + frDest:move( ptInt - ORIG()) + + return frDest +end + +--------------------------------------------------------------------- +-- funzione che posiziona il dowel tramite i riferimenti +local function PositionDowel( nDowelId, frOrig, frDest, vtDir, nSurfId) + + -- posiziono il dowel utilizzando i riferimenti + EgtTransform( nDowelId, frOrig, GDB_RT.GLOB) + EgtTransform( nDowelId, frDest, GDB_RT.GLOB) + EgtMove( nDowelId, 300 * vtDir) + -- creo il tool corrispondente al dowel + local dRad = EgtArcRadius( nDowelId) + + EgtCAvSetStdTool( s_dDowelTol, 2 * dRad, 0) + -- calcolo spostamento per posizionarlo in corrispondenza della superficie + local dStart = EgtCAvToolPosStm( EgtCP( nDowelId), - vtDir, nSurfId, - vtDir) + EgtMove( nDowelId, - dStart * vtDir) + +end + +--------------------------------------------------------------------- +-- funzione che crea il dowel e lo sottrae al solido +local function CreateDowel( nOrigDowelId, nLayerId, frOrig, frDest, vtDir, nTestSurfId, dLen, sDowelSide, nMainExtrusionId) + + -- vtDir rivolta verso interno del pezzo + + local nDowelId = EgtCopyGlob( nOrigDowelId, nLayerId) + EgtSetColor( nDowelId, Color3d( 128, 128, 128)) + + -- posiziono il dowel + PositionDowel( nDowelId, frOrig, frDest, vtDir, nTestSurfId) + + -- assegno estrusione e spessore + EgtModifyCurveExtrusion( nDowelId, - vtDir) + EgtModifyCurveThickness( nDowelId, - dLen) + + -- setto info di lavorazione + EgtSetInfo( nDowelId, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.HOLE) + EgtSetInfo( nDowelId, WIN_PRC_SIDE, sDowelSide) + + -- eventuale aggiornamento del solido + if nMainExtrusionId then + UpdateSolidWithProcessingSurf( nDowelId, nMainExtrusionId, nLayerId) + end + + return nDowelId +end + +--------------------------------------------------------------------- +-- funzione che calcola la correzione da applicare al frame dei dowels per evitare che fuoriescano dal pezzo da un lato visibile ( esterno per ante ed interno per telaio) +local function CalcDowelFrameCorrection( nOutlineId, nPrevOutlineId, nDowelRef, frOrig, frDest, nTestSurfPos, nTestSurfPosPrev, nTestSurf, vtMove, nLayerId, dLen, dPrevLen) + + local dMove = 0 + -- se le curve sono due linee non serve correzione + if EgtGetType( nOutlineId) == GDB_TY.CRV_LINE and EgtGetType( nPrevOutlineId) == GDB_TY.CRV_LINE then + return dMove + end + + -- 1) verifico posizione per il pezzo corrente + -- posiziono il dowel + local nDowel1 = EgtCopyGlob( nDowelRef, nLayerId) + PositionDowel( nDowel1, frOrig, frDest, - frDest:getVersZ(), nTestSurfPos) + -- verifico se la faccia di fondo fuoriesce dalla superficie di test + local dMove1 = EgtCAvToolPosStm( EgtCP( nDowel1) - frDest:getVersZ() * dLen, frDest:getVersZ(), nTestSurf, vtMove) + + -- 2) verifico posizione per il pezzo precedente + -- posiziono il dowel + local nDowel2 = EgtCopyGlob( nDowelRef, nLayerId) + PositionDowel( nDowel2, frOrig, frDest, frDest:getVersZ(), nTestSurfPosPrev) + -- verifico se la faccia di fondo fuoriesce dalla superficie di test + local dMove2 = EgtCAvToolPosStm( EgtCP( nDowel2) + frDest:getVersZ() * dPrevLen, - frDest:getVersZ(), nTestSurf, vtMove) + + EgtErase( nDowel1) + EgtErase( nDowel2) + + -- calcolo la correzione complessiva + dMove = max( dMove1, dMove2) + s_dDowelTol + return dMove +end + +--------------------------------------------------------------------- +-- funzione che calcola i dowels tra due pezzi +local function CalcDowels( nOrigOutlineId, nOrigPrevOutlineId, bSashOrFrame, nBottomRail) + + -- se soglia non ci sono dowels + if EgtGetInfo( nOrigOutlineId, WIN_THRESHOLD, 'b') or EgtGetInfo( nOrigPrevOutlineId, WIN_THRESHOLD, 'b') then + return + end + + -- recupero i pezzi + local nPart = EgtGetInfo( nOrigOutlineId, WIN_REF_PART, 'i') + local nPrevPart = EgtGetInfo( nOrigPrevOutlineId, WIN_REF_PART, 'i') + if nBottomRail then + if EgtGetName( nOrigOutlineId) == WIN_BOTTOM then + local vParts = EgtGetInfo( nOrigOutlineId, WIN_REF_BOTTOMRAIL_PART, 'vi') + nPart = vParts[nBottomRail] + else + local vParts = EgtGetInfo( nOrigPrevOutlineId, WIN_REF_BOTTOMRAIL_PART, 'vi') + nPrevPart = vParts[nBottomRail] + end + end + + -- recupero i layer delle lavorazioni + local nLayerId = EgtGetFirstNameInGroup( nPart, WIN_PRC) + local nPrevLayerId = EgtGetFirstNameInGroup( nPrevPart, WIN_PRC) + + -- recupero i profili + local nProfileLay = EgtGetFirstNameInGroup( nPart, WIN_PROFILE) + local nProfileId = EgtGetFirstNameInGroup( nProfileLay, WIN_PRF_MAIN) + local nPrevProfileLay = EgtGetFirstNameInGroup( nPrevPart, WIN_PROFILE) + local nPrevProfileId = EgtGetFirstNameInGroup( nPrevProfileLay, WIN_PRF_MAIN) + + -- copio curve outlines + local nOutlineId = EgtCopyGlob( nOrigOutlineId, nLayerId) + local nPrevOutlineId = EgtCopyGlob( nOrigPrevOutlineId, nLayerId) + if nBottomRail then + -- eventuale offset per bottomrail + local dOffs + local nRefCrv + if EgtGetName( nOutlineId) == WIN_BOTTOM then + nRefCrv = nOutlineId + dOffs = EgtGetInfo( nProfileId, WIN_RAILDELTA, 'd') + else + nRefCrv = nPrevOutlineId + dOffs = EgtGetInfo( nPrevProfileId, WIN_RAILDELTA, 'd') + end + EgtOffsetCurve( nRefCrv, - dOffs) + end + + -- recupero i geo + local nGeo = EgtGetFirstNameInGroup( nPart, WIN_GEO) + local nPrevGeo = EgtGetFirstNameInGroup( nPrevPart, WIN_GEO) + + -- recupero i tipi di profilo + local nPrevProfileType = GetOutlineProfileType( nPrevOutlineId, false, nBottomRail) + local nProfileType = GetOutlineProfileType( nOutlineId, false, nBottomRail) + -- caso particolare del triangolo : se lato top contro bottom il top deve essere gestito come un left/right + if nProfileType == WIN_PRF.TOP and nPrevProfileType == WIN_PRF.BOTTOM then + nProfileType = WIN_PRF.RIGHT + elseif nProfileType == WIN_PRF.BOTTOM and nPrevProfileType == WIN_PRF.TOP then + nPrevProfileType = WIN_PRF.LEFT + end + + -- recupero i solidi + local nPrevSolidId, nSolidId, nPrevSolidLay, nSolidLay + if s_bCalcSolid then + nSolidLay = EgtGetFirstNameInGroup( nPart, WIN_SOLID) + nSolidId = EgtGetFirstNameInGroup( nSolidLay, WIN_SRF_MAIN) + nPrevSolidLay = EgtGetFirstNameInGroup( nPrevPart, WIN_SOLID) + nPrevSolidId = EgtGetFirstNameInGroup( nPrevSolidLay, WIN_SRF_MAIN) + end + + -- recupero il tipo di giunzione + local nJointType = EgtGetInfo( nOutlineId, WIN_STARTJOINT, 'i') + if nBottomRail then + if EgtGetName( nOutlineId) == WIN_BOTTOM then + nJointType = WIN_PART_JNT.SHORT + else + nJointType = WIN_PART_JNT.FULL + end + end + + if nJointType == WIN_PART_JNT.ANGLED then + -- TO DO + + elseif nJointType == WIN_PART_JNT.FULL then + + -- calcolo il riferimento del profilo + local nFrameProfile = EgtGetFirstNameInGroup( nPrevProfileId, WIN_SECTIONFRAME) + local frOrig = EgtFR( nFrameProfile, GDB_ID.ROOT) + frOrig:invert() + + -- calcolo il riferimento su cui posizionare i dowels + local frDest = CreateDowelFrameDest( nPrevProfileType, nPrevGeo, nGeo, nPrevOutlineId, true, bSashOrFrame) + + -- recupero info con la lunghezza ( dipendono dal profilo del pezzo full quindi dal corrente) + local sLenKey = WIN_DWL_TOP_PERP_LEN + local sPrevLenKey = WIN_DWL_TOP_PARA_LEN + if nProfileType == WIN_PRF.BOTTOM then + sLenKey = WIN_DWL_BOTTOM_PERP_LEN + sPrevLenKey = WIN_DWL_BOTTOM_PARA_LEN + elseif EgtExistsInfo( nPart, WIN_SASHTYPE) then + -- verifico se è inactive sash dalla info settata per lavorazione + sLenKey = WIN_DWL_INACTIVE_PERP_LEN + sPrevLenKey = WIN_DWL_INACTIVE_PARA_LEN + end + + -- superficie test per il posizionamento dei dowels : è la superficie in del pezzo full + local nTestSurf + if not s_bCalcSolid or s_bSimplSolid then + local sCtrIn = WIN_OFST .. GetProfileCtrIn( nOrigOutlineId, nPrevOutlineId, nProfileId) -- controprofilo in del pezzo corrente + nTestSurf = CreateProfileSurf( nOrigOutlineId, nProfileId, sCtrIn, 100, nLayerId) + else + -- è la superficie che viene utilizzata per trimmare l'end del pezzo prev + local nOrigSurf = EgtGetFirstNameInGroup( nPrevSolidLay, WIN_SRF_END) + nTestSurf = EgtCopyGlob( nOrigSurf, nLayerId) + end + local nTestSurfInverted = EgtCopyGlob( nTestSurf, nLayerId) + EgtInvertSurf( nTestSurfInverted) + + -- superficie test per la traslazione dei dowels + local nTestSurf2 + if bSashOrFrame then + -- se anta la superficie da cui non fuoriuscire è quella esterna del pezzo short, ovvero la superficie usata per trimmare lo start del pezzo corrente + if not s_bCalcSolid or s_bSimplSolid then + nTestSurf2 = CreateProfileSurf( nOrigPrevOutlineId, nPrevProfileId, WIN_OFST .. WIN_OUT, 100, nLayerId) + else + local nOrigSurf = EgtGetFirstNameInGroup( nSolidLay, WIN_SRF_START) + nTestSurf2 = EgtCopyGlob( nOrigSurf, nLayerId) + end + EgtInvertSurf( nTestSurf2) + else + -- se telaio la superficie da cui non fuoriuscire è quella interna del pezzo short + local sCtrIn2 = WIN_OFST .. GetProfileCtrIn( nOrigPrevOutlineId, nOutlineId, nPrevProfileId) + nTestSurf2 = CreateProfileSurf( nOrigPrevOutlineId, nPrevProfileId, sCtrIn2, 100, nLayerId) + end + + -- direzione per la traslazione dei dowels + local vtMove = EgtIf( bSashOrFrame, - frDest:getVersX(), frDest:getVersX()) + + -- analizzo le singole file di dowels + for k = 0, 3 do + -- recupero i dowels della fila k-esima + local vDowels = EgtGetNameInGroup( nPrevProfileId, WIN_DOWEL .. 'Row' .. tostring( k)) + if #vDowels > 0 then + + -- recupero il dowel nella posizione più problematica ( per le ante è quello più esterno, per il telaio quello più interno) + local nDowelRef = EgtIf( bSashOrFrame, vDowels[1], vDowels[#vDowels]) + -- calcolo correzione da applicare al frame affinchè i dowels non fuoriescano da un lato visibile ( esterno per ante ed interno per telaio) + local dLenCurr = CalcDowelLen( nDowelRef, sLenKey, true) + local dLenPrev = CalcDowelLen( nDowelRef, sPrevLenKey, false) + local dMove = CalcDowelFrameCorrection( nOutlineId, nPrevOutlineId, nDowelRef, frOrig, frDest, nTestSurfInverted, nTestSurf, nTestSurf2, vtMove, nLayerId, dLenCurr, dLenPrev) + local frDestDowel = Frame3d( frDest) + frDestDowel:move( dMove * vtMove) + + for i = 1, #vDowels do + -- dowels per pezzo corrente ( full) + local dLenFull = CalcDowelLen( vDowels[i], sLenKey, true) + CreateDowel( vDowels[i], nLayerId, frOrig, frDestDowel, - frDestDowel:getVersZ(), nTestSurfInverted, dLenFull, WIN_PRC_SIDETYPE.IN, nSolidId) + -- dowels per prezzo precedente ( short) + local dLenShort = CalcDowelLen( vDowels[i], sPrevLenKey, false) + CreateDowel( vDowels[i], nPrevLayerId, frOrig, frDestDowel, frDestDowel:getVersZ(), nTestSurf, dLenShort, WIN_PRC_SIDETYPE.RIGHT, nPrevSolidId) + end + end + end + + EgtErase( nTestSurf) + EgtErase( nTestSurfInverted) + EgtErase( nTestSurf2) + + + elseif nJointType == WIN_PART_JNT.SHORT then + + -- calcolo il riferimento del profilo + local nFrameProfile = EgtGetFirstNameInGroup( nProfileId, WIN_SECTIONFRAME) + local frOrig = EgtFR( nFrameProfile, GDB_ID.ROOT) + frOrig:invert() + + -- calcolo il riferimento su cui posizionare i dowels + local frDest = CreateDowelFrameDest( nProfileType, nPrevGeo, nGeo, nOutlineId, false, bSashOrFrame) + + -- recupero info con la lunghezza ( dipendono dal profilo del pezzo full, quindi da prezzo prev) + local sLenKey = WIN_DWL_TOP_PARA_LEN + local sPrevLenKey = WIN_DWL_TOP_PERP_LEN + if nPrevProfileType == WIN_PRF.BOTTOM then + sLenKey = WIN_DWL_BOTTOM_PARA_LEN + sPrevLenKey = WIN_DWL_BOTTOM_PERP_LEN + elseif nPrevProfileType == WIN_PRF.BOTTOMRAIL or nPrevProfileType == WIN_PRF.BOTTOMRAIL_FINAL then + sLenKey = WIN_DWL_BOTTOMRAIL_PARA_LEN + sPrevLenKey = WIN_DWL_BOTTOMRAIL_PERP_LEN + elseif EgtExistsInfo( nPrevPart, WIN_SASHTYPE) then + -- verifico se è inactive sash dalla info settata per lavorazione + sLenKey = WIN_DWL_INACTIVE_PARA_LEN + sPrevLenKey = WIN_DWL_INACTIVE_PERP_LEN + end + + -- superficie test per il posizionamento dei dowels + -- è il controprofilo in del pezzo full quindi è la stessa superficie che viene utilizzata per trimmare lo start del pezzo corrente + local nTestSurf + if not s_bCalcSolid or s_bSimplSolid then + local sCtrIn = WIN_OFST .. GetProfileCtrIn( nOrigPrevOutlineId, nOutlineId, nPrevProfileId) -- controprofilo del pezzo full + nTestSurf = CreateProfileSurf( nOrigPrevOutlineId, nPrevProfileId, sCtrIn, 100, nLayerId) + else + local nOrigSurf = EgtGetFirstNameInGroup( nSolidLay, WIN_SRF_START) + nTestSurf = EgtCopyGlob( nOrigSurf, nLayerId) + end + local nTestSurfInverted = EgtCopyGlob( nTestSurf, nLayerId) + EgtInvertSurf( nTestSurfInverted) + + -- superficie test per la traslazione dei dowels + local nTestSurf2 + if bSashOrFrame then + if not s_bCalcSolid or s_bSimplSolid then + nTestSurf2 = CreateProfileSurf( nOrigOutlineId, nProfileId, WIN_OFST .. WIN_OUT, 100, nLayerId) + else + local nOrigSurf = EgtGetFirstNameInGroup( nPrevSolidLay, WIN_SRF_END) + nTestSurf2 = EgtCopyGlob( nOrigSurf, nLayerId) + end + EgtInvertSurf( nTestSurf2) + else + local sCtrIn2 = WIN_OFST .. GetProfileCtrIn( nOutlineId, nPrevOutlineId, nProfileId) -- controprofilo del pezzo short + nTestSurf2 = CreateProfileSurf( nOrigOutlineId, nProfileId, sCtrIn2, 100, nLayerId) + end + + -- direzione per la traslazione dei dowels + local vtMove = EgtIf( bSashOrFrame, - frDest:getVersX(), frDest:getVersX()) + + -- analizzo le singole file di dowels + for k = 0, 3 do + -- recupero i dowels sulla fila k-esima + local vDowels = EgtGetNameInGroup( nProfileId, WIN_DOWEL .. 'Row' .. tostring(k)) + if #vDowels > 0 then + + -- recupero il dowel nella posizione più problematica ( per le ante è quello più esterno, per il telaio quello più interno) + local nDowelRef = EgtIf( bSashOrFrame, vDowels[1], vDowels[#vDowels]) + -- calcolo correzione da applicare al frame affinchè i dowels non fuoriescano da un lato visibile ( esterno per ante ed interno per telaio) + local dLenCurr = CalcDowelLen( nDowelRef, sLenKey, false) + local dLenPrev = CalcDowelLen( nDowelRef, sPrevLenKey, true) + local dMove = CalcDowelFrameCorrection( nOutlineId, nPrevOutlineId, nDowelRef, frOrig, frDest, nTestSurf, nTestSurfInverted, nTestSurf2, vtMove, nLayerId, dLenCurr, dLenPrev) + local frDestDowel = Frame3d( frDest) + frDestDowel:move( dMove * vtMove) + + for i = 1, #vDowels do + -- dowels per pezzo corrente ( short) + local dLenShort = CalcDowelLen( vDowels[i], sLenKey, false) + CreateDowel( vDowels[i], nLayerId, frOrig, frDestDowel, - frDestDowel:getVersZ(), nTestSurf, dLenShort, WIN_PRC_SIDETYPE.LEFT, nSolidId) + -- dowels per prezzo precedente ( full) + local dLenFull = CalcDowelLen( vDowels[i], sPrevLenKey, true) + CreateDowel( vDowels[i], nPrevLayerId, frOrig, frDestDowel, frDestDowel:getVersZ(), nTestSurfInverted, dLenFull, WIN_PRC_SIDETYPE.IN, nPrevSolidId) + end + end + end + + EgtErase( nTestSurf) + EgtErase( nTestSurfInverted) + EgtErase( nTestSurf2) + end + + EgtErase( nOutlineId) + EgtErase( nPrevOutlineId) + +end + +--------------------------------------------------------------------- +-- funzione che calcola i dowels tra uno split e i pezzi sui cui poggia +local function CalcSplitDowels( nSplitId, vOutlines, bStartOrEnd) + + -- TO DO : da gestire incrocio dowels di tre pezzi + + -- recupero il pezzo dello split + local nSplitPart = EgtGetInfo( nSplitId, WIN_REF_PART, 'i') + + -- recupero il profilo originale dello split e il suo frame + local nSplitProfile = GetOutlineProfileId( nSplitId, false) + local nSplitProfileFrameId = EgtGetFirstNameInGroup( nSplitProfile, WIN_SECTIONFRAME) + local frOrig = EgtFR( nSplitProfileFrameId, GDB_ID.ROOT) + frOrig:invert() + + -- recupero il gruppo delle lavorazioni + local nSplitLayerId = EgtGetFirstNameInGroup( nSplitPart, WIN_PRC) + + -- recupero eventuale solido e superifici usate per il suo trim + local nSplitSolidId, vTestSurf + if s_bCalcSolid then + local nSplitSolidLayerId = EgtGetFirstNameInGroup( nSplitPart, WIN_SOLID) + nSplitSolidId = EgtGetFirstNameInGroup( nSplitSolidLayerId, WIN_SRF_MAIN) + vTestSurf = EgtGetNameInGroup( nSplitSolidLayerId, EgtIf( bStartOrEnd, WIN_SRF_START, WIN_SRF_END)) + end + + -- indviduo il lato su cui andranno i dowels + local sSplitDowelSide = WIN_PRC_SIDETYPE.RIGHT + if bStartOrEnd then + sSplitDowelSide = WIN_PRC_SIDETYPE.LEFT + end + + -- creo la superficie di test per verificare se dowel interno al pezzo + local nSplitGeo = EgtGetFirstNameInGroup( nSplitPart, WIN_GEO) + local nSplitSurf = CreateGeoArea( nSplitGeo, nSplitLayerId, false) + + local ptRef = EgtIf( bStartOrEnd, EgtSP( nSplitId), EgtEP( nSplitId)) + + -- se il bottom è soglia va ignorato + local nStartIdx = EgtIf( EgtGetInfo( vOutlines[1], WIN_THRESHOLD, 'b'), 2, 1) + for i = nStartIdx, #vOutlines do + + -- recupero il pezzo associato e il suo outline di riferimento + local nPartId = FindAssociatedPart( vOutlines[i], true) + local nOutlineId = EgtGetInfo( nPartId, WIN_REF_OUTLINE, 'i') + local nProfileType = GetOutlineProfileType( nOutlineId, true) + + -- calcolo il frame di destinazione + -- trovo intersezione dello split con lato In o Out del geo + local nGeoLayerId = EgtGetFirstNameInGroup( nPartId, WIN_GEO) + local nGeoCrvId = EgtGetFirstNameInGroup( nGeoLayerId, WIN_GEO_IN) + local ptInters = EgtIP( nGeoCrvId, nSplitId, ptRef) + local sDowelSide = WIN_PRC_SIDETYPE.IN + if not ptInters and nProfileType == WIN_PRF.SPLIT then + nGeoCrvId = EgtGetFirstNameInGroup( nGeoLayerId, WIN_GEO_OUT) + ptInters = EgtIP( nGeoCrvId, nSplitId, ptRef) + sDowelSide = WIN_PRC_SIDETYPE.OUT + end + -- se non trovo intersezione passo al successivo + if ptInters then + + -- TO DO : gestione split non lineare + local frDest = Frame3d( ptInters, - EgtSV( nSplitId)) + + -- recupero il layer con le lavorazioni + local nLayerId = EgtGetFirstNameInGroup( nPartId, WIN_PRC) + + -- nel layer dei profili del pezzo aggiungo il profilo dello split posizionato correttamente + local nProfileLayerId = EgtGetFirstNameInGroup( nPartId, WIN_PROFILE) + local nSplitProfileCopyId = EgtCopy( nSplitProfile, nProfileLayerId) + local sSplitProfileType = EgtGetName( nSplitProfile) + EgtSetInfo( nSplitProfileCopyId, WIN_PRF_TYPE, sSplitProfileType) + EgtSetName( nSplitProfileCopyId, WIN_PRF_SPLIT) + -- posiziono il profilo sulla curva di split + EgtTransform( EgtGetAllInGroup( nSplitProfileCopyId), frOrig, GDB_RT.GLOB) + EgtChangeGroupFrame( nSplitProfileCopyId, frDest, GDB_RT.GLOB) + + -- recupero eventuale solido + local nSolidId + if s_bCalcSolid then + local nSolidLayerId = EgtGetFirstNameInGroup( nPartId, WIN_SOLID) + nSolidId = EgtGetFirstNameInGroup( nSolidLayerId, WIN_SRF_MAIN) + end + + -- recupero le chiavi delle lunghezze ( dipendono dal profilo del pezzo su cui poggia lo split) + local sSplitLenKey = WIN_DWL_TOP_PARA_LEN + local sLenKey = WIN_DWL_TOP_PERP_LEN + if nProfileType == WIN_PRF.BOTTOM then + sSplitLenKey = WIN_DWL_BOTTOM_PARA_LEN + sLenKey = WIN_DWL_BOTTOM_PERP_LEN + elseif nProfileType == WIN_PRF.BOTTOMRAIL_FINAL then + sSplitLenKey = WIN_DWL_RAILBOTTOM_PARA_LEN + sLenKey = WIN_DWL_RAILBOTTOM_PERP_LEN + elseif nProfileType == WIN_PRF.SPLIT then + sSplitLenKey = WIN_DWL_SPLIT_PARA_LEN + sLenKey = WIN_DWL_SPLIT_PERP_LEN + end + + -- creo la superficie di test per il posizionamento dei dowels + local nProfileId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_PRF_MAIN) + local nTestSurf + if not s_bCalcSolid or s_bSimplSolid then + local bChangeProfile = EgtGetInfo( nSplitId, WIN_PRF_CHANGE, 'b') or false + if bChangeProfile then + local nMixedOutline = EgtGetInfo( nSplitId, EgtIf( bStartOrEnd, WIN_MIXED_REF_START, WIN_MIXED_REF_END), 'i') + nTestSurf = CreateMixedSplitTrimSurf( nMixedOutline, nProfileId, 100, nLayerId) + else + local sCtr = WIN_OFST .. GetProfileCtrIn( nOutlineId, nSplitId, nProfileId) + nTestSurf = CreateProfileSurf( nOutlineId, nProfileId, sCtr, 100, nLayerId) + end + else + -- è la stessa superficie utilizzata per il trim del solido + nTestSurf = EgtCopyGlob( vTestSurf[i], nSplitLayerId) + end + local nTestSurfInverted = EgtCopyGlob( nTestSurf, nSplitLayerId) + EgtInvertSurf( nTestSurfInverted) + + -- calcolo le direzioni entranti nei pezzi + local vtSplitDir = EgtIf( bStartOrEnd, - frDest:getVersZ(), frDest:getVersZ()) + local vtDir = frDest:getVersZ() + local _, _, nSide = EgtPointCurveDistSide( ptInters + vtDir, nGeoCrvId, Z_AX()) + if nSide == 1 then + -- se a destra della curva significa che la direzione è uscente dal pezzo e va invertita + vtDir = - vtDir + end + + -- creo la superficie di test per verificare se dowel interno al pezzo + local nGeo = EgtGetFirstNameInGroup( nPartId, WIN_GEO) + local nSurf = CreateGeoArea( nGeo, nLayerId, false) + + -- aggiungo i dowels + local vDowels = EgtGetNameInGroup( nSplitProfile, WIN_DOWEL .. '*') or {} + for i = 1, #vDowels do + -- split + local dLen1 = CalcDowelLen( vDowels[i], sSplitLenKey, false) + local nDowel1 = CreateDowel( vDowels[i], nSplitLayerId, frOrig, frDest, vtSplitDir, nTestSurf, dLen1, sSplitDowelSide, nSplitSolidId) + -- verifico se dowel è interno al pezzo ( TO DO : da migliorare!) + local ptTest = EgtCP( nDowel1) - vtSplitDir * EgtCurveThickness( nDowel1) + local nTestPoint = EgtPoint( nSplitLayerId, ptTest) + if EgtSurfFrTestExternal( nSplitSurf, nTestPoint) then + EgtErase( nDowel1) + end + EgtErase( nTestPoint) + + -- pezzo + local dLen2 = CalcDowelLen( vDowels[i], sLenKey, true) + local nDowel2 = CreateDowel( vDowels[i], nLayerId, frOrig, frDest, vtDir, nTestSurfInverted, dLen2, sDowelSide, nSolidId) + ptTest = EgtCP( nDowel2) - vtDir * EgtCurveThickness( nDowel2) + nTestPoint = EgtPoint( nLayerId, ptTest) + if EgtSurfFrTestExternal( nSurf, nTestPoint) then + EgtErase( nDowel2) + end + EgtErase( nTestPoint) + + end + + EgtErase( nTestSurf) + EgtErase( nTestSurfInverted) + EgtErase( nSurf) + end + end + + EgtErase( nSplitSurf) +end + +--------------------------------------------------------------------- +-- funzione che calcola le spine +local function CalculateAreaDowels( nAreaId) + + local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_OUTLINE) + if nAreaType == WIN_AREATYPES.FRAME or nAreaType == WIN_AREATYPES.SASH then + -- verifico se presente bottomrail + local nBottomRails = EgtGetInfo( nAreaId, WIN_BOTTOMRAIL, 'i') or 0 + -- aggiungo le spine sui pezzi dell'area + local nOutline = EgtGetFirstInGroup( nOutlineLayerId) + local nPrevOutline = EgtGetLastInGroup( nOutlineLayerId) + while nOutline do + -- aggiungo spine su nOutline e nPrevOutline nel loro punto di giunzione + CalcDowels( nOutline, nPrevOutline, nAreaType == WIN_AREATYPES.SASH) + -- bottomrail + if nBottomRails > 0 and ( EgtGetName( nOutline) == WIN_BOTTOM or EgtGetName( nPrevOutline) == WIN_BOTTOM) then + for j = 1, nBottomRails do + CalcDowels( nOutline, nPrevOutline, false, j) + end + end + -- aggiorno per iterazione successiva + nPrevOutline = nOutline + nOutline = EgtGetNext( nOutline) + end + end + + -- verifico se c'e' uno split + local nSplitLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_SPLIT) + if nSplitLayerId then + local nSplitType = EgtGetInfo( nSplitLayerId, WIN_SPLITTYPE, 'i') or WIN_SPLITTYPES.NULL + -- se split non è di tipo french ha un pezzo associato per il quale vanno calcolate le spine + if nSplitType ~= WIN_SPLITTYPES.FRENCH then + local nSplitId = EgtGetFirstInGroup( nSplitLayerId) + -- start + local vPrevOutlineId = EgtGetInfo( nSplitId, WIN_PREV_OUTLINES, 'vi') + CalcSplitDowels( nSplitId, vPrevOutlineId, true) + -- end + local vNextOutlineId = EgtGetInfo( nSplitId, WIN_NEXT_OUTLINES, 'vi') + CalcSplitDowels( nSplitId, vNextOutlineId, false) + end + end + + -- calcolo le spine delle sottoaree + local nChildAreaId = EgtGetFirstNameInGroup( nAreaId, WIN_AREA .. '*') + while nChildAreaId do + CalculateAreaDowels( nChildAreaId) + nChildAreaId = EgtGetNextName( nChildAreaId, WIN_AREA .. '*') + end +end + + + +---------------------------------------------------------------------------------- +--------------------------------- STRIP ---------------------------------------- +---------------------------------------------------------------------------------- +-- funzione che restitutisce lo Strip piu' vicino +-- ( analoga a GetProfileCtrIn) +local function GetStripNearestToOutline( nPrevProfileId, nPrevOutlineId, nOutlineId) + local sStripName = WIN_STRIP + + -- gestione particolare del caso di profilo di split + if not EgtGetFirstNameInGroup( nPrevProfileId, sStripName) then + -- recupero la curva di base outline da cui deriva il precedente + local nPrevSouId = EgtGetInfo( nPrevOutlineId, WIN_COPY, 'i') + local sPrevSouName + repeat + nPrevSouId = EgtGetInfo( nPrevSouId, WIN_SOU, 'i') + sPrevSouName = EgtGetName( nPrevSouId or GDB_ID.NULL) + until not nPrevSouId or sPrevSouName == WIN_SPLIT + + -- verifico da quale lato si trova la curva per decidere quale controprofilo considerare + local _, _, nSide = EgtPointCurveDistSide( EgtMP( nOutlineId), nPrevSouId, Z_AX()) + if nSide == 1 then + sStripName = WIN_STRIP .. '1' -- dx + else + sStripName = WIN_STRIP .. '2' -- sx + end + end + + if s_bSimplSolid then + sStripName = WIN_SIMPLIFIED .. sStripName + end + local nStripId = EgtGetFirstNameInGroup( nPrevProfileId, sStripName) + return nStripId +end + +--------------------------------------------------------------------- +-- funzione che crea le linee di contorno massima e minima degli strip +local function CreateStripGuideLines( nOutlineId, nStripId, nProfileId, nSolidLayerId) + + -- recupero il frame del profilo + local nProfileFrameId = EgtGetFirstNameInGroup( nProfileId, WIN_SECTIONFRAME) + local frProfile = EgtFR( nProfileFrameId, 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 vtE = EgtEV( nOutlineId) + local bMainInvertOffset = AreSameVectorApprox( frProfile:getVersZ(), vtE) + -- calcolo BBox + local b3MainStrip = EgtGetBBoxRef( nStripId, GDB_BB.STANDARD, frProfile, GDB_RT.GLOB) + -- calcolo offset per Strip + local dDelta = EgtGetInfo( nProfileId, WIN_RAILDELTA, 'd') or 0 + local dMainStripMinDelta = EgtIf( bMainInvertOffset, - b3MainStrip:getMax():getX() + dDelta, b3MainStrip:getMin():getX() - dDelta) + local dMainStripMaxDelta = EgtIf( bMainInvertOffset, - b3MainStrip:getMin():getX() + dDelta, b3MainStrip:getMax():getX() - dDelta) + + local nStripMinOffsetId = EgtCopy( nOutlineId, nSolidLayerId) + EgtOffsetCurve( nStripMinOffsetId, dMainStripMinDelta) + local nStripMaxOffsetId = EgtCopy( nOutlineId, nSolidLayerId) + EgtOffsetCurve( nStripMaxOffsetId, dMainStripMaxDelta) + + return nStripMinOffsetId, nStripMaxOffsetId + +end + +--------------------------------------------------------------------- +-- funzione che crea gli Strip +local function CreateStripFromOutline( nAreaId, nOutlineId) + + -- recupero il pezzo associato ( prendendo quello di bottomrail se esiste) + local nPartId = FindAssociatedPart( nOutlineId, true) + -- recupero layer per solido e per profili di estrusione + local nSolidLayerId = EgtGetFirstNameInGroup( nPartId, WIN_SOLID) + + -- recupero gli outline precedente e successivo ( non serve utilizzare un WIN_PRF accurato perchè conta solo sia diverso da split) + local nOutlineLayerId = EgtGetParent( nOutlineId) + local vPrevOutlineId, vNextOutlineId = GetPrevNextOutline( WIN_PRF.NULL, nOutlineId, nOutlineLayerId) + + -- recupero i pezzi precedente e successivo, prendendo eventualmente quelli di bottomrail + local nPrevPartId = FindAssociatedPart( vPrevOutlineId[1], true) + local nNextPartId = FindAssociatedPart( vNextOutlineId[1], true) + + -- recupero profilo e controprofili + local nMainProfileLayerId = EgtGetFirstNameInGroup( nPartId, WIN_PROFILE) + local nMainProfileId = EgtGetFirstNameInGroup( nMainProfileLayerId, WIN_PRF_MAIN) + local nPrevProfileLayerId = EgtGetFirstNameInGroup( nPrevPartId, WIN_PROFILE) + local nStartProfileId = EgtGetFirstNameInGroup( nPrevProfileLayerId, WIN_PRF_MAIN) + local nNextProfileLayerId = EgtGetFirstNameInGroup( nNextPartId, WIN_PROFILE) + local nEndProfileId = EgtGetFirstNameInGroup( nNextProfileLayerId, WIN_PRF_MAIN) + + -- a) estrudo il fermavetro + -- recupero guida Main + local nGuideId = EgtGetFirstNameInGroup( nSolidLayerId, WIN_MAINGUIDE) + -- recupero strip piu' vicino a prev outline e lo posiziono sulla guida + local nMainStripId = GetStripNearestToOutline( nMainProfileId, nOutlineId, vPrevOutlineId[1]) + local nSectionId = EgtCopyGlob( nMainStripId, nSolidLayerId) + local nFrameProfileId = EgtGetFirstNameInGroup( nMainProfileId, WIN_SECTIONFRAME) + local frOrig = EgtFR( nFrameProfileId, GDB_ID.ROOT) + frOrig:invert() + local frDest = Frame3d( EgtSP( nGuideId), - EgtSV( nGuideId)) + EgtTransform( nSectionId, frOrig) + EgtTransform( nSectionId, frDest) + -- creo estrusione + local nMainStripExtrusionId = EgtSurfTmSwept( nSolidLayerId, nSectionId, nGuideId, false, WIN_SURF_APPROX) + EgtSetName( nMainStripExtrusionId, WIN_SRF_STRIP) + + -- b) taglio con start + -- recupero strip dello start piu' vicino ad outline + local nStartStripId = GetStripNearestToOutline( nStartProfileId, vPrevOutlineId[1], nOutlineId) + + -- disegno guida start per lo strip trovando le intersezioni degli outline minimi e massimi tra MainStrip e StartStrip + local nMainStripMinOffsetId, nMainStripMaxOffsetId = CreateStripGuideLines( nOutlineId, nMainStripId, nMainProfileId, nSolidLayerId) + local nStartStripMinOffsetId, nStartStripMaxOffsetId = CreateStripGuideLines( vPrevOutlineId[1], nStartStripId, nStartProfileId, nSolidLayerId) + local ptStripMinStart = FindIntersectionPoint( nMainStripMinOffsetId, nStartStripMinOffsetId, EgtSP( nMainStripMinOffsetId)) + local ptStripMaxStart = FindIntersectionPoint( nMainStripMaxOffsetId, nStartStripMaxOffsetId, EgtSP( nMainStripMinOffsetId)) + local nStartStripGuideId = EgtLine( nSolidLayerId, ptStripMinStart, ptStripMaxStart) + EgtExtendCurveStartByLen( nStartStripGuideId, 10) + EgtExtendCurveEndByLen( nStartStripGuideId, 10) + EgtMove( nStartStripGuideId, Z_AX()) + + -- estrudo Strip start + local b3RefStartProfile = GetProfileLocalBox( nStartProfileId) + local nStartStripExtrusionId = EgtSurfTmByExtrusion( nSolidLayerId, nStartStripGuideId, - Z_AX() * ( b3RefStartProfile:getDimY() + 2), WIN_SURF_APPROX) + EgtInvertSurf( nStartStripExtrusionId) + + -- intersezione con main + EgtSurfTmIntersect( nMainStripExtrusionId, nStartStripExtrusionId) + + -- c) taglio con end + -- recupero strip piu' vicino ad outline + local nEndStripId = GetStripNearestToOutline( nEndProfileId, vNextOutlineId[1], nOutlineId) + + -- disegno guida end per lo strip trovando le intersezioni degli outline minimi e massimi tra MainStrip ed EndStrip + local nEndStripMinOffsetId, nEndStripMaxOffsetId = CreateStripGuideLines( vNextOutlineId[1], nEndStripId, nEndProfileId, nSolidLayerId) + local ptStripMinEnd = FindIntersectionPoint( nMainStripMinOffsetId, nEndStripMinOffsetId, EgtEP( nMainStripMinOffsetId)) + local ptStripMaxEnd = FindIntersectionPoint( nMainStripMaxOffsetId, nEndStripMaxOffsetId, EgtEP( nMainStripMaxOffsetId)) + local nEndStripGuideId = EgtLine( nSolidLayerId, ptStripMinEnd, ptStripMaxEnd) + EgtExtendCurveStartByLen( nEndStripGuideId, 10) + EgtExtendCurveEndByLen( nEndStripGuideId, 10) + EgtMove( nEndStripGuideId, Z_AX()) + + -- estrudo Strip end + local b3RefEndProfile = GetProfileLocalBox( nEndProfileId) + local nEndStripExtrusionId = EgtSurfTmByExtrusion( nSolidLayerId, nEndStripGuideId, - Z_AX() * ( b3RefEndProfile:getDimY() + 2), WIN_SURF_APPROX) + + -- intersezione con main + EgtSurfTmIntersect( nMainStripExtrusionId, nEndStripExtrusionId) + + -- cancello curve e superfici di costruzione + EgtErase( nSectionId) + EgtErase( { nMainStripMinOffsetId, nMainStripMaxOffsetId}) + EgtErase( { nStartStripMinOffsetId, nStartStripMaxOffsetId, nStartStripGuideId, nStartStripExtrusionId}) + EgtErase( { nEndStripMinOffsetId, nEndStripMaxOffsetId, nEndStripGuideId, nEndStripExtrusionId}) + +end + + + +---------------------------------------------------------------------------------- +----------------------------- CALCOLO PEZZI ------------------------------------ +---------------------------------------------------------------------------------- +-- funzione che stabilisce il nome del pezzo +local function CalcPartName( nAreaId, nAreaType) + + local sName = '' + if nAreaType == WIN_AREATYPES.FRAME then + sName = WIN_FRAME + EgtSetInfo( nAreaId, WIN_AREA_NAME, sName) + elseif nAreaType == WIN_AREATYPES.SASH then + s_nSashNbr = s_nSashNbr + 1 + sName = WIN_SASH .. '_'.. tostring( s_nSashNbr) + EgtSetInfo( nAreaId, WIN_AREA_NAME, sName) + else + -- per split o riempimento devo ricavare il nome del parent che lo contiene + local nParentId = EgtGetParent( nAreaId) + local nParentType = EgtGetInfo( nParentId, WIN_AREATYPE, 'i') + while nParentType ~= WIN_AREATYPES.FRAME and nParentType ~= WIN_AREATYPES.SASH do + nParentId = EgtGetParent( nParentId) + nParentType = EgtGetInfo( nParentId, WIN_AREATYPE, 'i') + end + sName = EgtGetInfo( nParentId, WIN_AREA_NAME, sName) + end + + return sName +end + +--------------------------------------------------------------------- +-- funzione che disegna l'apertura dell'anta +local function DrawOpening( nAreaId) + + local nOpeningType = EgtGetInfo( nAreaId, WIN_OPENING_TYPE, 'i') + if nOpeningType == WIN_OPENING_TYPES.NULL then + return + end + + -- creo gruppo per aperture + local nOpeningLayId = EgtGroup( nAreaId) + EgtSetName( nOpeningLayId, WIN_SASH_OPENING) + + -- verifico se anta ricevente per impostare tratteggio + local nFactor = 7 + local nPattern = 0xAAAA + local nType = EgtGetInfo( nAreaId, WIN_SASHTYPE, 'i') + local bStippled = ( nType == WIN_SASHTYPES.INACTIVE or nType == WIN_SASHTYPES.INACTIVE_IN or nType == WIN_SASHTYPES.INACTIVE_OUT) + + -- calcolo la curva di riferimento per il disegno dell'apertura + local nOutlineLayId = EgtGetFirstNameInGroup( nAreaId, WIN_OUTLINE) + local vOutlines = EgtGetAllInGroup( nOutlineLayId) + -- TODO gestire caso di triangolo + if #vOutlines == 3 then + return + end + local vCrvs = {} + for i = 1, #vOutlines do + local nCrv = EgtCopyGlob( vOutlines[i], nOpeningLayId) + table.insert( vCrvs, nCrv) + local nProfileId = GetOutlineProfileId( vCrvs[i], false) + local b3FrameProfile = GetProfileLocalBox( nProfileId) + local dOffs = b3FrameProfile:getMin():getX() + EgtOffsetCurve( nCrv, dOffs) + end + TrimAndOrientOrderedCurves( vCrvs, false) + local nGuideId = EgtCurveCompo( nOpeningLayId, vCrvs) + local _, dParE = EgtCurveDomain( nGuideId) + + -- ribalta + if nOpeningType == WIN_OPENING_TYPES.TILTONLY_TOP or nOpeningType == WIN_OPENING_TYPES.TILTTURN_LEFT or nOpeningType == WIN_OPENING_TYPES.TILTTURN_RIGHT then + -- ricavo il punto sul top + local ptMid = EgtUP( nGuideId, 2.5) + if not EgtCurveIsARectangle( nGuideId) then + -- per maggiore simmetria ricavo il punto sul top in corrispondenza del punto medio del bottom + local ptTest = EgtUP( nGuideId, 0.5) + local nLineTest = EgtLinePVL( nOpeningLayId, ptTest + Y_AX(), Y_AX(), 10000) + ptMid = EgtIP( nGuideId, nLineTest, ORIG()) + EgtErase( nLineTest) + end + EgtCurveCompoFromPoints( nOpeningLayId, { EgtSP( nGuideId), ptMid, EgtUP( nGuideId, 1)}) + elseif nOpeningType == WIN_OPENING_TYPES.TILTONLY_BOTTOM then + -- ricavo il punto sul bottom + local ptMid = EgtUP( nGuideId, 0.5) + EgtCurveCompoFromPoints( nOpeningLayId, { EgtUP( nGuideId, 2), ptMid, EgtUP( nGuideId, dParE - 1)}) + end + + -- altre tipologie + if nOpeningType == WIN_OPENING_TYPES.TILTTURN_LEFT or nOpeningType == WIN_OPENING_TYPES.TURNONLY_LEFT then + -- battente sx + local dLenRight = EgtCurveCompoLength( nGuideId, 1) + local dLenLeft = EgtCurveCompoLength( nGuideId, dParE - 1) + local dParMid = 1.5 + -- se lato sinistro è il più corto, prendo sul destro il corrispondente del suo punto medio + if dLenLeft < dLenRight - GEO.EPS_SMALL then + dParMid = EgtCurveParamAtLength( nGuideId, EgtCurveCompoLength( nGuideId, 0) + dLenLeft * 0.5) + end + local nCrv = EgtCurveCompoFromPoints( nOpeningLayId, { EgtSP( nGuideId), EgtUP( nGuideId, dParMid), EgtUP( nGuideId, dParE - 1)}) + -- tratteggio + if bStippled then + EgtSetStipple( nCrv, nFactor, nPattern) + end + + elseif nOpeningType == WIN_OPENING_TYPES.TILTTURN_RIGHT or nOpeningType == WIN_OPENING_TYPES.TURNONLY_RIGHT then + -- battente dx + local dLenRight = EgtCurveCompoLength( nGuideId, 1) + local dLenLeft = EgtCurveCompoLength( nGuideId, dParE - 1) + local dParMid = dParE - 0.5 + -- se lato destro è il più corto, prendo sul sinistro il corrispondente del suo punto medio + if dLenRight < dLenLeft - GEO.EPS_SMALL then + dParMid = EgtCurveParamAtLength( nGuideId, EgtCurveLength( nGuideId) - dLenRight * 0.5) + end + local nCrv = EgtCurveCompoFromPoints( nOpeningLayId, { EgtUP( nGuideId, 1), EgtUP( nGuideId, dParMid), EgtUP( nGuideId, 2)}) + -- tratteggio + if bStippled then + EgtSetStipple( nCrv, nFactor, nPattern) + end + + elseif nOpeningType == WIN_OPENING_TYPES.COPLANARSLIDE_LEFT or nOpeningType == WIN_OPENING_TYPES.COPLANARSLIDE_RIGHT or + nOpeningType == WIN_OPENING_TYPES.LIFTSLIDE_LEFT or nOpeningType == WIN_OPENING_TYPES.LIFTSLIDE_RIGHT then + -- scorrevole e alzante scorrevole ( solo forma rettangolare) + local bRight = ( nOpeningType == WIN_OPENING_TYPES.COPLANARSLIDE_RIGHT or nOpeningType == WIN_OPENING_TYPES.LIFTSLIDE_RIGHT) + local dLen0 = EgtCurveCompoLength( nGuideId, 0) + local dLen1 = EgtCurveCompoLength( nGuideId, 1) + local dCoeff = 0.15 + local ptS = EgtUP( nGuideId, 1.5) - dCoeff * dLen0 * X_AX() + local ptE = EgtUP( nGuideId, dParE - 0.5) + dCoeff * dLen0 * X_AX() + if bRight then + ptS, ptE = ptE, ptS + end + local nCompo = EgtCurveCompoFromPoints( nOpeningLayId, { ptS, ptE}) + if nOpeningType == WIN_OPENING_TYPES.COPLANARSLIDE_LEFT or nOpeningType == WIN_OPENING_TYPES.COPLANARSLIDE_RIGHT then + EgtAddCurveCompoLine( nCompo, ptS - dCoeff * dLen1 * Y_AX(), false) + end + local dAng = EgtIf( bRight, 135, 45) + EgtLinePDL( nOpeningLayId, ptE, dAng, dCoeff * dLen0) + EgtLinePDL( nOpeningLayId, ptE, - dAng, dCoeff * dLen0) + + elseif nOpeningType == WIN_OPENING_TYPES.FIXED then + -- nessun disegno + + elseif nOpeningType == WIN_OPENING_TYPES.PIVOT then + -- bilico rettangolare + local nCompo = EgtCurveCompoFromPoints( nOpeningLayId, { EgtUP( nGuideId, 0.5), EgtUP( nGuideId, 1.5), EgtUP( nGuideId, 2.5), EgtUP( nGuideId, 3.5)}) + EgtCloseCurveCompo( nCompo) + -- TODO oblò + end + + EgtErase( nGuideId) +end + +--------------------------------------------------------------------- +-- funzione che calcola l'ingombro dei pezzi del telaio e i loro solidi +local function CreatePartFromOutline( nAreaLayerId, sName, nOutlineId, nOutlineCrvNbr, nBottomRail) + + -- se soglia ignoro + local bThreshold = EgtGetInfo( nOutlineId or GDB_ID.NULL, WIN_THRESHOLD, 'b') or false + if bThreshold then + return + end + + -- creo pezzo + local nPartId = EgtGroup( GDB_ID.ROOT) + -- inserisco riferimento alla sua area + EgtSetInfo( nPartId, WIN_AREA, nAreaLayerId) + + local nAreaType = EgtGetInfo( nAreaLayerId, WIN_AREATYPE, 'i') + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaLayerId, WIN_OUTLINE) + + -- a) Telaio, anta o split + if nAreaType == WIN_AREATYPES.FRAME or nAreaType == WIN_AREATYPES.SASH or nAreaType == WIN_AREATYPES.SPLIT then + + -- creo riferimenti tra pezzo e outline + EgtSetInfo( nPartId, WIN_REF_OUTLINE, nOutlineId) + if nBottomRail then + -- aggiorno i riferimenti del bottomrail + local vBottomRailParts = EgtGetInfo( nOutlineId, WIN_REF_BOTTOMRAIL_PART, 'vi') or {} + table.insert( vBottomRailParts, nPartId) + EgtSetInfo( nOutlineId, WIN_REF_BOTTOMRAIL_PART, vBottomRailParts) + EgtSetInfo( nPartId, WIN_PART_TYPE, WIN_PART_TYPES.BOTTOMRAIL) + else + EgtSetInfo( nOutlineId, WIN_REF_PART, nPartId) + end + + -- imposto nome del pezzo + local sOutlineName = EgtIf( nBottomRail, WIN_BOTTOMRAIL .. '_' .. tostring( nBottomRail), EgtGetName( nOutlineId)) + local sPartName = sName .. '_' .. sOutlineName + EgtSetName( nPartId, sPartName) + + -- imposto il colore + if sOutlineName == WIN_BOTTOM or sOutlineName == WIN_TOP or nBottomRail then + EgtSetColor( nPartId, Color3d( 204, 102, 0)) + elseif sOutlineName == WIN_RIGHT or sOutlineName == WIN_LEFT then + EgtSetColor( nPartId, Color3d( 251, 128, 4)) + else + EgtSetColor( nPartId, Color3d( 255, 159, 57)) + end + + -- ricavo il tipo di profilo + local nProfileType = GetOutlineProfileType( nOutlineId, false, nBottomRail) + -- disegno ingombro + CalcFrameGeo( nPartId, nOutlineId, nOutlineCrvNbr, nOutlineLayerId, nProfileType, nBottomRail) + -- calcolo eventuali curve ausiliarie per cambio profilo + local bChangeProfile = EgtGetInfo( nOutlineId, WIN_PRF_CHANGE, 'b') or false + if bChangeProfile and nProfileType ~= WIN_PRF.SPLIT then + CalcMixedFrameCurves( nPartId, nOutlineId) + end + -- calcolo le lavorazioni associate ai profili + CalcProfilingProcessings( nPartId, nOutlineId) + -- calcolo il georaw per automatismo lavorazioni + CalcGeoRaw( nPartId) + -- disegno solido + if s_bCalcSolid then + CalcSolid( nPartId, nOutlineId) + end + + -- b) Fill + elseif nAreaType == WIN_AREATYPES.FILL then + -- imposto nome del pezzo + EgtSetName( nPartId, sName .. '_' .. WIN_FILL) + EgtSetInfo( nPartId, WIN_PART_TYPE, WIN_PART_TYPES.FILL) + -- ricavo tipo + local nFillType = EgtGetInfo( nAreaLayerId, WIN_FILLTYPE, 'i') + + -- imposto colore e tipologia di riempimento + if nFillType == WIN_FILLTYPES.GLASS then + EgtSetColor( nPartId, Color3d( 71, 161, 255)) + EgtSetAlpha( nPartId, 30) + EgtSetInfo( nPartId, WIN_FILLTYPE, WIN_GLASS) + elseif nFillType == WIN_FILLTYPES.WOOD then + EgtSetColor( nPartId, Color3d( 194, 148, 103)) + EgtSetInfo( nPartId, WIN_FILLTYPE, WIN_WOOD) + end + + -- disegno ingombro + local nGeoLayerId = CalcFillGeo( nPartId, nOutlineLayerId) + -- disegno solido + if s_bCalcSolid then + CalcFillSolid( nPartId, nOutlineLayerId, nGeoLayerId) + end + end + return nPartId +end + +--------------------------------------------------------------------- +-- funzione che cicla ricorsivamente su aree e sottoaree per calcolare i pezzi +local function CalculateAreaParts( nAreaId) + + local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') + -- recupero nome dei pezzi in quest'area + local sName = CalcPartName( nAreaId, nAreaType) + if nAreaType == WIN_AREATYPES.FRAME or nAreaType == WIN_AREATYPES.SASH then + -- creo pezzi per ogni outline + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_OUTLINE) + local vOutlines = EgtGetAllInGroup( nOutlineLayerId) + for i = 1, #vOutlines do + -- creo pezzo + CreatePartFromOutline( nAreaId, sName, vOutlines[i], i) + -- se di tipo bottom verifico se ha bottomrail + if EgtGetName( vOutlines[i]) == WIN_BOTTOM then + local nBottomRail = EgtGetInfo( nAreaId, WIN_BOTTOMRAIL, 'i') or 0 + for j = 1, nBottomRail do + CreatePartFromOutline( nAreaId, sName, vOutlines[i], i, j) + end + end + end + elseif nAreaType == WIN_AREATYPES.FILL then + -- creo riempimento + CreatePartFromOutline( nAreaId, sName) + end + + -- verifico se c'e' uno split da realizzare + local nSplitLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_SPLIT) + if nSplitLayerId then + local nSplitType = EgtGetInfo( nSplitLayerId, WIN_SPLITTYPE, 'i') or WIN_SPLITTYPES.NULL + -- se split non è di tipo french ha un pezzo associato + if nSplitType ~= WIN_SPLITTYPES.FRENCH then + local nSplitId = EgtGetFirstInGroup( nSplitLayerId) + if nSplitId then + -- creo pezzo split + local nSplitPartId = CreatePartFromOutline( nAreaId, sName, nSplitId) + -- disegno area di selezione per programma + local nSelectionLayerId = EgtGroup( nAreaId) + EgtSetName( nSelectionLayerId, WIN_SPLITSELECTION) + EgtSetStatus( nSelectionLayerId, GDB_ST.OFF) + local nSplitPartGeoId = EgtGetFirstNameInGroup( nSplitPartId, WIN_GEO) + local nSelectionArea = CreateGeoArea( nSplitPartGeoId, nSelectionLayerId, false) + EgtSetColor( nSelectionArea, 'YELLOW') + EgtSetAlpha( nSelectionArea, 10) + EgtMove( nSelectionArea, 10 * Z_AX()) + end + end + elseif nAreaType ~= WIN_AREATYPES.FILL then + if s_bCalcSolid then + --- verifico se area successiva e' un fill + local nChildAreaId = EgtGetFirstNameInGroup( nAreaId, WIN_AREA .. '*') + local nChildAreaType = EgtGetInfo( nChildAreaId or GDB_ID.NULL, 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 + CreateStripFromOutline( nAreaId, nOutlineId) + nOutlineId = EgtGetNext( nOutlineId) + end + end + end + end + + -- se anta disegno apertura + if nAreaType == WIN_AREATYPES.SASH then + DrawOpening( nAreaId) + end + + -- disegno area di selezione per programma + local nSelectionLayerId = EgtGroup( nAreaId) + EgtSetName( nSelectionLayerId, WIN_SELECTION) + EgtSetStatus( nSelectionLayerId, GDB_ST.OFF) + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_OUTLINE) + local vOutlineList = EgtGetAllInGroup( nOutlineLayerId) + local nCompoId = EgtCurveCompo( nSelectionLayerId, vOutlineList, false) + local nSelectionArea = EgtSurfFlatRegion( nSelectionLayerId, nCompoId) + EgtSetColor( nSelectionArea, 'YELLOW') + EgtSetAlpha( nSelectionArea, 10) + EgtMove( nSelectionArea, 10 * Z_AX()) + EgtErase( nCompoId) + + -- calcolo i pezzi delle sottoaree + local nChildAreaId = EgtGetFirstNameInGroup( nAreaId, WIN_AREA .. '*') + while nChildAreaId do + CalculateAreaParts( nChildAreaId) + nChildAreaId = EgtGetNextName( nChildAreaId, WIN_AREA .. '*') + end +end + + + +---------------------------------------------------------------------------------- +---------------------------------- TRONCHETTI ---------------------------------- +---------------------------------------------------------------------------------- +-- funzione che spezza l'anta in corrispondenza dei tronchetti del telaio +local function SplitArcByAlignment( nGeoIn, nGrp) + + -- recupero il pezzo del telaio corrispondente + local nPartId = EgtGetParent( EgtGetParent( nGeoIn)) + local nOutlineId = EgtGetInfo( nPartId, WIN_REF_OUTLINE, 'i') + local nSouId = EgtGetInfo( nOutlineId, WIN_COPY, 'i') + local nAreaType = WIN_AREATYPES.NULL + while nSouId and nAreaType ~= WIN_AREATYPES.FRAME do + nSouId = EgtGetInfo( nSouId, WIN_SOU, 'i') or GDB_ID.NULL + local nParentArea = EgtGetParent( EgtGetParent( nSouId)) or GDB_ID.NULL + nAreaType = EgtGetInfo( nParentArea, WIN_AREATYPE, 'i') + end + if not nSouId then return end + local nFrameOutlineId = EgtGetInfo( nSouId, WIN_COPY, 'i') + local nFramePartId = EgtGetInfo( nFrameOutlineId, WIN_REF_PART, 'i') + + -- recupero le parti in cui era stato diviso l'arco del telaio + local nFrameLogsLayer = EgtGetFirstNameInGroup( nFramePartId, WIN_LOGS) + local vFrameLogs = EgtGetNameInGroup( nFrameLogsLayer, WIN_GEO_IN) + local ptC = EgtCP( vFrameLogs[1]) + + local nCurrCrvId = EgtCopyGlob( nGeoIn, nGrp) + local bInters = false + for i = 1, #vFrameLogs - 1 do + -- ricavo il punto di split sull'arco dell'anta + local ptFrame = EgtEP( vFrameLogs[i]) + local vtDir = ptFrame - ptC + local nLineSplit = EgtLinePVL( nGrp, ptC, vtDir, vtDir:len() + 1000) + local ptInt = EgtIP( nCurrCrvId, nLineSplit, ORIG()) + EgtErase( nLineSplit) + if ptInt then + nCurrCrvId = EgtSplitCurveAtPoint( nCurrCrvId, ptInt) or GDB_ID.NULL + bInters = true + elseif bInters then + -- se non ci sono più intersezioni esco + return + end + end +end + +--------------------------------------------------------------------- +-- funzione che spezza l'arco in base al numero di pezzi +local function SplitArcByNumber( nLogsNbr, nGeoIn, nGrp) + local nCopy = EgtCopyGlob( nGeoIn, nGrp) + EgtSplitCurve( nCopy, nLogsNbr) +end + +--------------------------------------------------------------------- +-- funzione che spezza gli archi per i tronchetti +local function SplitArc( nLogsNbr, vSections, bAlign, dOverMatTot, nGeoIn, nGeoOut, nGrp) + + -- per allineamento con telaio + if bAlign then + return SplitArcByAlignment( nGeoIn, nGrp) + + -- per sezione + elseif #vSections == 1 and nLogsNbr == 0 then + -- dalla sezione ricavo il numero minimo di pezzi + local dSection = vSections[1] - dOverMatTot + local dROut = EgtArcRadius( nGeoOut) + local dRIn = EgtArcRadius( nGeoIn) + local dAng = abs( EgtArcAngCenter( nGeoIn)) + local nParts + if dSection < dROut - dRIn + GEO.EPS_SMALL then + -- sezione troppo piccola + -- TO DO : gestione errore + EgtOutBox( 'Sezione tronchetto troppo piccola', '') + elseif dSection > dROut + dRIn - GEO.EPS_SMALL then + -- la sezione comprende già l'intero pezzo + nParts = 1 + else + nParts = dAng / 2 / acos( ( dROut - dSection) / dRIn) + nParts = ceil( nParts) + end + return SplitArcByNumber( nParts, nGeoIn, nGrp) + + -- per numero di pezzi + else + return SplitArcByNumber( nLogsNbr, nGeoIn, nGrp) + end +end + +--------------------------------------------------------------------- +-- funzione che calcola la sezione dei tronchetti +local function CalcLogsSection( nLogsNbr, vSections, bAlign, dOverMatTot, nGeoIn, nGeoOut, nGrp) + + -- se richiesta una sezione specifica senza vincoli sul numero di pezzi + if not bAlign and #vSections == 1 and nLogsNbr == 0 then + return vSections[1] + end + + -- calcolo la sezione necessaria per la suddivisione scelta + local dMySection = 0 + local dROut = EgtArcRadius( nGeoOut) + local dRIn = EgtArcRadius( nGeoIn) + if bAlign then + -- calcolo la massima sezione dai tronchetti ottenuti + local vSplits = EgtGetAllInGroup( nGrp) + for i = 1, #vSplits do + local dAng = abs( EgtArcAngCenter( vSplits[i])) + local dCurrSection = dROut - dRIn * cos( dAng / 2) + if dCurrSection > dMySection then + dMySection = dCurrSection + end + end + dMySection = dMySection + dOverMatTot + + else + -- ricavo la sezione dal numero di pezzi + local dAng = abs( EgtArcAngCenter( nGeoIn)) + dMySection = dROut - dRIn * cos( dAng / nLogsNbr / 2) + dOverMatTot + end + + if #vSections == 0 then + -- se no vincoli sulla sezione + return dMySection + else + -- cerco la sezione più adatta dalla lista di sezioni disponibili + table.sort( vSections) + for i = 1, #vSections do + if vSections[i] > dMySection - GEO.EPS_SMALL then + return vSections[i] + end + end + -- se non ho trovato la sezione errore + EgtOutBox( 'Sezioni tronchetti troppo piccole per suddivisione richiesta', '') + return nil + end +end + +--------------------------------------------------------------------- +local function CalcLogs( nGrp, nGeoOut, dOverMatIn, dOverMatOut, dOverMatExt, dOverMatInt, dRefSection, bCutExtremities) + + -- recupero tutti i tratti dell'arco + local vCrvsIn = EgtGetAllInGroup( nGrp) + local ptC = EgtCP( vCrvsIn[1]) + + -- calcolo i tronchetti + local dLenTot = 0 + for i = 1, #vCrvsIn do + + local ptSIn = EgtSP( vCrvsIn[i]) + local ptEIn = EgtEP( vCrvsIn[i]) + + -- recupero il tratto corrispondente sulla curva out + local ptSOut, dParSOut, ptEOut, dParEOut + if i == 1 then + -- forzo a coincidere con l'estremo della curva out + ptEOut = EgtEP( nGeoOut) + dParEOut = 1 + else + _, ptEOut, dParEOut = EgtPointCurveDist( ptSIn, nGeoOut) + end + if i == #vCrvsIn then + -- forzo a coincidere con l'estremo della curva out + ptSOut = EgtSP( nGeoOut) + dParSOut = 0 + else + _, ptSOut, dParSOut = EgtPointCurveDist( ptEIn, nGeoOut) + end + local nOut = EgtCopyGlob( nGeoOut, nGrp) + EgtTrimCurveStartEndAtParam( nOut, dParSOut, dParEOut) + + -- creo composita corrispondente al pezzo + local nCompo = EgtCurveCompo( nGrp, {vCrvsIn[i]}, false) + EgtAddCurveCompoLine( nCompo, ptSOut) + EgtAddCurveCompoCurve( nCompo, nOut, false) + EgtCloseCurveCompo( nCompo) + + -- calcolo il frame per il tronchetto + local ptM = EgtMP( vCrvsIn[i]) + local vtRad = ptM - ptC + local frRef = Frame3d( ptM, vtRad ^ Z_AX(), vtRad, Z_AX()) + + -- calcolo il box locale al frame + local b3Ref = EgtGetBBoxRef( nCompo, GDB_BB.STANDARD, frRef) + local ptMax = b3Ref:getMax() + local ptMin = b3Ref:getMin() + ptMin:setZ( ptMax:getZ()) -- per avere curve sullo stesso piano ( e gestire correttamente le intersezioni) + + -- verifico se necessario sovramateriale extra per raggiungere la sezione desiderata + local dExtraSection = max( 0, dRefSection - b3Ref:getDimY() - dOverMatIn - dOverMatOut) + + -- lato bottom + local nLineBottom = EgtLinePVL( nGrp, ptMin - ( dOverMatIn + 0.5 * dExtraSection) * Y_AX(), X_AX(), 10000) + EgtExtendCurveStartByLen( nLineBottom, 10000) + EgtTransform( nLineBottom, frRef) + + -- lato top + local nLineTop = EgtLinePVL( nGrp, ptMax + ( dOverMatOut + 0.5 * dExtraSection) * Y_AX(), - X_AX(), 10000) + EgtExtendCurveStartByLen( nLineTop, 10000) + EgtTransform( nLineTop, frRef) + + -- lato right + local nLineRight + if i == 1 and not bCutExtremities then + nLineRight = EgtLinePVL( nGrp, ptMin, - Y_AX(), 10000) + EgtTransform( nLineRight, frRef) + else + nLineRight = EgtLine( nGrp, ptEOut, ptSIn) + EgtExtendCurveEndByLen( nLineRight, 10000) + end + EgtOffsetCurve( nLineRight, EgtIf( i == 1, dOverMatExt, dOverMatInt)) + EgtExtendCurveStartByLen( nLineRight, 10000) + + -- lato left + local nLineLeft + if i == #vCrvsIn and not bCutExtremities then + nLineLeft = EgtLinePVL( nGrp, ptMax, Y_AX(), 10000) + EgtTransform( nLineLeft, frRef) + else + nLineLeft = EgtLine( nGrp, ptEIn, ptSOut) + EgtExtendCurveEndByLen( nLineLeft, 10000) + end + EgtOffsetCurve( nLineLeft, EgtIf( i == #vCrvsIn, dOverMatExt, dOverMatInt)) + EgtExtendCurveStartByLen( nLineLeft, 10000) + + -- taglio le curve nei loro punti di intersezione + local vCrvs = { nLineTop, nLineRight, nLineBottom, nLineLeft} + TrimAndOrientOrderedCurves( vCrvs, false) + + -- TO DO : controllo lunghezza minima + -- local dLenTop = EgtCurveLength( nLineTop) + + dLenTot = dLenTot + EgtCurveLength( nLineTop) + + -- creo il tronchetto + local nLogCrv = EgtCurveCompo( nGrp, vCrvs) + EgtSetName( nLogCrv, WIN_LOGS) + EgtSetColor( nLogCrv, EgtStdColor( 'BLUE')) + + -- salvo i sovramateriali utilizzati nella curva + EgtSetInfo( nLogCrv, WIN_PRC_OVERMAT_IN, dOverMatIn) + EgtSetInfo( nLogCrv, WIN_PRC_OVERMAT_OUT, dOverMatOut) + EgtSetInfo( nLogCrv, WIN_PRC_OVERMAT_LEFT, EgtIf( i == #vCrvsIn, dOverMatExt, dOverMatInt)) + EgtSetInfo( nLogCrv, WIN_PRC_OVERMAT_RIGHT, EgtIf( i == 1, dOverMatExt, dOverMatInt)) + + EgtSetStatus( vCrvsIn[i], GDB_ST.OFF) + EgtSetStatus( nOut, GDB_ST.OFF) + EgtErase( nCompo) + end + + -- salvo i dati della sezione ( analogamente a quanto fatto nel geo per pezzi lineari) + EgtSetInfo( nGrp, WIN_GEOWIDTH, dRefSection) + CopyInfo( nGrp, EgtGetParent( nGeoOut), WIN_GEOHEIGHT) + EgtSetInfo( nGrp, WIN_GEOLEN, dLenTot) +end + +--------------------------------------------------------------------- +-- funzione che crea la spina per tronchetti +local function CalcLogDowel( nOrigPartId, nCrvOut, bLeftOrRight, nProcLayerId, nProfileId, nInfoGrp, nSolidId) + + -- creo il frame per il posizionamento del dowel + local nOutlineRef = EgtGetInfo( nOrigPartId, WIN_REF_OUTLINE, 'i') + local ptRef = EgtIf( bLeftOrRight, EgtSP( nCrvOut), EgtEP( nCrvOut)) + local _, ptOrig, dParOrig = EgtPointCurveDist( ptRef, nOutlineRef) + local vtFrame = EgtUV( nOutlineRef, dParOrig, -1) + local frDest = Frame3d( ptOrig, - vtFrame) + + -- calcolo direzione verso interno del pezzo + local vtDir = frDest:getVersZ() + if bLeftOrRight then + vtDir = - vtDir + end + + -- recupero i dati del dowel + local dDowelDiam = EgtGetInfo( nInfoGrp, WIN_DWL_DIAM, 'd') + local dDowelLen = EgtGetInfo( nInfoGrp, WIN_DWL_LOG_LEN, 'd') + + -- creo il dowel nel riferimento della sezione + -- TO DO : recupero della sezione corretta nel caso di cambio profilo + local nSectionId = EgtGetFirstNameInGroup( nProfileId, WIN_SECTION) or EgtGetFirstNameInGroup( nProfileId, WIN_SASH .. WIN_SECTION) + local nDowelId = EgtCircle( nProcLayerId, EgtGP( nSectionId), 0.5 * dDowelDiam) + + -- posiziono il dowel usando i riferimenti + local nFrameId = EgtGetFirstNameInGroup( nProfileId, WIN_SECTIONFRAME) + local frOrig = EgtFR( nFrameId) + frOrig:invert() + EgtTransform( nDowelId, frOrig) + EgtTransform( nDowelId, frDest) + + local nPartId = EgtGetParent( nProcLayerId) + local dOverMat = EgtGetInfo( nPartId, EgtIf( bLeftOrRight, WIN_PRC_OVERMAT_LEFT, WIN_PRC_OVERMAT_RIGHT)) + EgtMove( nDowelId, - vtDir * ( s_dDowelTol + dOverMat)) + EgtModifyCurveExtrusion( nDowelId, - vtDir) + local dLen = dDowelLen + dOverMat + s_dDowelTol + EgtModifyCurveThickness( nDowelId, - dLen) + + -- setto info di lavorazione + EgtSetInfo( nDowelId, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.HOLE) + EgtSetInfo( nDowelId, WIN_PRC_SIDE, EgtIf( bLeftOrRight, WIN_PRC_SIDETYPE.LEFT, WIN_PRC_SIDETYPE.RIGHT)) + + -- eventuale aggiornamento del solido + if nSolidId then + UpdateSolidWithProcessingSurf( nDowelId, nSolidId, nProcLayerId) + end +end + +--------------------------------------------------------------------- +-- funzione che crea i pezzi dei tronchetti +local function CalcLogParts( nOrigPartId, bFinishedLogs) + + local nProfileGrp = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE) + local nInfoGrp = EgtGetFirstNameInGroup( nProfileGrp, WIN_INFO_GRP) + + -- recupero i gruppi dal pezzo ad arco + local nProfileLayerId = EgtGetFirstNameInGroup( nOrigPartId, WIN_PROFILE) + local nProfileId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_PRF_MAIN) + local nOrigSolidLayerId = EgtGetFirstNameInGroup( nOrigPartId, WIN_SOLID) + local nOrigProcLayerId = EgtGetFirstNameInGroup( nOrigPartId, WIN_PRC) + + -- recupero dimensione del profilo + local nGeoLayerId = EgtGetFirstNameInGroup( nOrigPartId, WIN_GEO) + local dThick = EgtGetInfo( nGeoLayerId, WIN_GEOHEIGHT, 'd') + + -- recupero i tronchetti + local nLogLayerId = EgtGetFirstNameInGroup( nOrigPartId, WIN_LOGS) + local vCrvIn = EgtGetNameInGroup( nLogLayerId, WIN_GEO_IN) + local vCrvOut = EgtGetNameInGroup( nLogLayerId, WIN_GEO_OUT) + local vLogs = {} + for i = 1, #vCrvIn do + -- creo il pezzo per il trochetto + local nPartId = EgtGroup( GDB_ID.ROOT) + EgtSetName( nPartId, WIN_LOGS) + EgtSetColor( nPartId, Color3d( 204, 102, 0)) + EgtSetStatus( nPartId, GDB_ST.OFF) + table.insert( vLogs, nPartId) + + local nCrvIn = vCrvIn[i] + local nCrvOut = vCrvOut[i] + local nLogCrv = EgtGetNext( nCrvOut) + + -- setto le info con i sovramateriali corrispondenti + CopyInfo( nPartId, nLogCrv, WIN_PRC_OVERMAT_IN, 0) + CopyInfo( nPartId, nLogCrv, WIN_PRC_OVERMAT_OUT, 0) + CopyInfo( nPartId, nLogCrv, WIN_PRC_OVERMAT_LEFT, 0) + CopyInfo( nPartId, nLogCrv, WIN_PRC_OVERMAT_RIGHT, 0) + + -- a) GEORAW + local nGeoRawLayerId = EgtGroup( nPartId) + EgtSetName( nGeoRawLayerId, WIN_GEO_RAW) + local nGeoRawCrvId = EgtCopyGlob( nLogCrv, nGeoRawLayerId) + EgtModifyCurveThickness( nGeoRawCrvId, - dThick) + -- creo il frame ausiliario + local vtX = EgtSV( nLogCrv) + local frGeo = Frame3d( EgtSP( nLogCrv), vtX, Z_AX() ^ vtX, Z_AX()) + local nFrameId = EgtFrame( nGeoRawLayerId, frGeo) + EgtSetName( nFrameId, WIN_PRC_FRAME) + + -- b) SOLIDO + local nSolidId + if s_bCalcSolid then + local nSolidLayerId = EgtGroup( nPartId) + EgtSetName( nSolidLayerId, WIN_SOLID) + if #vCrvIn == 1 then + -- essendo singolo pezzo il solido è quello originale + local nOrigSolidId = EgtGetFirstNameInGroup( nOrigSolidLayerId, WIN_SRF_MAIN) + EgtRelocateGlob( nOrigSolidId, nSolidLayerId) + elseif bFinishedLogs then + -- recupero il solido originale e lo taglio opportunamente agli estremi + local nOrigSolidId = EgtGetFirstNameInGroup( nOrigSolidLayerId, WIN_SRF_MAIN) + nSolidId = EgtCopyGlob( nOrigSolidId, nSolidLayerId) + + local bBox = GetProfileLocalBox( nProfileId) + local dDimY = bBox:getDimY() + if i ~= 1 then + local nTrimCrv = EgtLine( nSolidLayerId, EgtUP( nLogCrv, 2), EgtUP( nLogCrv, 1)) + EgtMove( nTrimCrv, Z_AX()) + local nTrimSrf = EgtSurfTmByExtrusion( nSolidLayerId, nTrimCrv, - Z_AX() * ( dDimY + 2), WIN_SURF_APPROX) + EgtSurfTmIntersect( nSolidId, nTrimSrf) + EgtErase( { nTrimCrv, nTrimSrf}) + end + if i ~= #vCrvIn then + local nTrimCrv = EgtLine( nSolidLayerId, EgtSP( nLogCrv), EgtUP( nLogCrv, 3)) + EgtMove( nTrimCrv, Z_AX()) + local nTrimSrf = EgtSurfTmByExtrusion( nSolidLayerId, nTrimCrv, - Z_AX() * ( dDimY + 2), WIN_SURF_APPROX) + EgtSurfTmIntersect( nSolidId, nTrimSrf) + EgtErase( { nTrimCrv, nTrimSrf}) + end + else + -- il solido è esattamente il tronchetto + local bBox = GetProfileLocalBox( nProfileId) + nSolidId = EgtSurfTmByRegionExtrusion( nSolidLayerId, nLogCrv, - bBox:getDimY() * Z_AX()) + EgtSetName( nSolidId, WIN_SOLID) + end + end + + -- c) LAVORAZIONI + -- se unico tronchetto le lavorazioni sono quelle del pezzo originale + if #vCrvIn == 1 then + EgtRelocateGlob( nOrigProcLayerId, nPartId) + EgtSetStatus( nOrigProcLayerId, GDB_ST.ON) + return + end + + local nProcLayerId = EgtGroup( nPartId) + EgtSetName( nProcLayerId, WIN_PRC) + + -- profili in e out + if bFinishedLogs then + local nCrvInCopy = EgtCopyGlob( nCrvIn, nProcLayerId) + local nSemiProfileInId = EgtGetInfo( nCrvInCopy, WIN_SEMI_PROFILE, 'i') + GetProcessingInfoFromSemiProfile( nCrvInCopy, nSemiProfileInId) + EgtSetStatus( nCrvInCopy, GDB_ST.ON) + local nCrvOutCopy = EgtCopyGlob( nCrvOut, nProcLayerId) + local nSemiProfileOutId = EgtGetInfo( nCrvOutCopy, WIN_SEMI_PROFILE, 'i') + GetProcessingInfoFromSemiProfile( nCrvOutCopy, nSemiProfileOutId) + EgtSetStatus( nCrvOutCopy, GDB_ST.ON) + end + + -- profilo left + if i == #vCrvIn and bFinishedLogs then + -- recupero la curva di lavorazione dal pezzo originale + local nLeftPrc = EgtGetFirstNameInGroup( nOrigProcLayerId, WIN_GEO_LEFT) + EgtRelocateGlob( nLeftPrc, nProcLayerId) + elseif i ~= #vCrvIn then + -- minizinken + local nLeftId = EgtLine( nProcLayerId, EgtUP( nLogCrv, 3), EgtSP( nLogCrv)) + EgtSetName( nLeftId, WIN_LEFT) + -- assegno le info di lavorazione + EgtSetInfo( nLeftId, WIN_PRC_NTOOLS, 1) + local sToolName = EgtGetInfo( nInfoGrp, WIN_PRC_TOOL_NAME) + EgtSetInfo( nLeftId, WIN_PRC_TOOL_NAME .. '_1', sToolName) + local dOffR = EgtGetInfo( nInfoGrp, WIN_PRC_OFFR, 'd') + -- TO DO : verificare valore OffsR + EgtSetInfo( nLeftId, WIN_PRC_OFFR .. '_1', dOffR) + local dOffL = EgtGetInfo( nInfoGrp, WIN_PRC_OFFL .. '_1', 'd') + EgtSetInfo( nLeftId, WIN_PRC_OFFL .. '_1', dOffL) + end + + -- profilo right + if i == 1 and bFinishedLogs then + -- recupero la curva di lavorazione dal pezzo originale + local nRightPrc = EgtGetFirstNameInGroup( nOrigProcLayerId, WIN_GEO_RIGHT) + EgtRelocateGlob( nRightPrc, nProcLayerId) + elseif i ~= 1 then + -- minizinken + local nRightId = EgtLine( nProcLayerId, EgtUP( nLogCrv, 1), EgtUP( nLogCrv, 2)) + EgtSetName( nRightId, WIN_RIGHT) + -- assegno info di lavorazione + EgtSetInfo( nRightId, WIN_PRC_NTOOLS, 1) + local sToolName = EgtGetInfo( nInfoGrp, WIN_PRC_TOOL_NAME) + EgtSetInfo( nRightId, WIN_PRC_TOOL_NAME .. '_1', sToolName) + local dOffR = EgtGetInfo( nInfoGrp, WIN_PRC_OFFR, 'd') + -- TO DO : verificare valore OffsR + EgtSetInfo( nRightId, WIN_PRC_OFFR .. '_1', dOffR) + local dOffL = EgtGetInfo( nInfoGrp, WIN_PRC_OFFL .. '_2', 'd') + EgtSetInfo( nRightId, WIN_PRC_OFFL .. '_1', dOffL) + end + + -- dowels per incastro dei tronchetti + if i ~= 1 then + CalcLogDowel( nOrigPartId, nCrvOut, false, nProcLayerId, nProfileId, nInfoGrp, nSolidId) + end + if i ~= #vCrvIn then + CalcLogDowel( nOrigPartId, nCrvOut, true, nProcLayerId, nProfileId, nInfoGrp, nSolidId) + end + + -- se i tronchetti sono gestiti come pezzi finiti cerco le lavorazioni del pezzo orginale che appartengono al tronchetto + if bFinishedLogs then + local vProcessings = EgtGetAllInGroup( nOrigProcLayerId) + local nSurfTest = EgtSurfFlatRegion( nProcLayerId, nLogCrv) + for i = 1, #vProcessings do + local sPrcType = EgtGetInfo( vProcessings[i], WIN_PRC_FEATURE_TYPE) + -- forature + if sPrcType == WIN_PRC_TYPE.HOLE then + local sSide = EgtGetInfo( vProcessings[i], WIN_PRC_SIDE) + -- se dowel sull'estremo lo assegno direttamente al tronchetto corrispondente + if ( sSide == WIN_PRC_SIDETYPE.LEFT and i == #vCrvIn) or ( sSide == WIN_PRC_SIDETYPE.RIGHT and i == 1) then + EgtRelocateGlob( vProcessings[i], nProcLayerId) + end + -- altrimenti verifico se interno al tronchetto corrente + if sSide == WIN_PRC_SIDETYPE.IN then + local _, _, nSide = EgtPointCurveDistSide( EgtCP( vProcessings[i]), nLogCrv, Z_AX()) + if nSide == -1 then + -- copio perchè la stessa lavorazione potrebbe coinvolgere più tronchetti + EgtCopyGlob( vProcessings[i], nProcLayerId) + else + -- verifico anche la faccia di fondo + local vtExtr = EgtCurveExtrusion( vProcessings[i]) + local dThickness = EgtCurveThickness( vProcessings[i]) + _, _, nSide = EgtPointCurveDistSide( EgtCP( vProcessings[i]) + dThickness * vtExtr, nLogCrv, Z_AX()) + if nSide == -1 then + EgtCopyGlob( vProcessings[i], nProcLayerId) + end + end + end + -- fermavetro + elseif sPrcType == WIN_PRC_TYPE.STRIP_CUT then + -- TO DO da sistemare + local nStrip = EgtCopyGlob( vProcessings[i], nProcLayerId) + EgtTrimCurveWithRegion( nStrip, nSurfTest, true, false) + else + -- TO DO lavorazioni legate alla ferramenta, cambio profilo + end + end + EgtErase( nSurfTest) + end + end + + -- salvo nel pezzo ad arco i pezzi dei tronchetti associati + EgtSetInfo( nOrigPartId, WIN_LOGS, vLogs) + +end + +--------------------------------------------------------------------- +-- funzione che crea gli elementi ausiliari per la creazione del grezzo nell'automatismo delle lavorazioni +local function CalcGeoRawFromLogs( nPartId) + + -- svuoto il GeoRaw per ricalcolarlo + local nGeoRawLayerId = EgtGetFirstNameInGroup( nPartId, WIN_GEO_RAW) + EgtEmptyGroup( nGeoRawLayerId) + + -- recupero i vari tronchetti + local nLogGrp = EgtGetFirstNameInGroup( nPartId, WIN_LOGS) + local vLogCrvs = EgtGetNameInGroup( nLogGrp, WIN_LOGS) + + -- salvo le info di sovramateriale nel pezzo + CopyInfo( nPartId, vLogCrvs[1], WIN_PRC_OVERMAT_IN, 0) + CopyInfo( nPartId, vLogCrvs[1], WIN_PRC_OVERMAT_OUT, 0) + local nOvermatLateral = EgtGetInfo( vLogCrvs[1], WIN_PRC_OVERMAT_RIGHT, 'd') + EgtSetInfo( nPartId, WIN_PRC_OVERMAT_RIGHT, nOvermatLateral) + EgtSetInfo( nPartId, WIN_PRC_OVERMAT_LEFT, nOvermatLateral) + + -- costruisco il grezzo a partire dai tronchetti + local vCrvs = {} + local vIdIn = {} + -- recupero le curve in e out dei tronchetti + for i = #vLogCrvs, 1, -1 do + local nLineOut = EgtLine( nGeoRawLayerId, EgtUP( vLogCrvs[i], 0), EgtUP( vLogCrvs[i], 1)) + local nLineIn = EgtLine( nGeoRawLayerId, EgtUP( vLogCrvs[i], 2), EgtUP( vLogCrvs[i], 3)) + table.insert( vCrvs, nLineOut) + table.insert( vIdIn, nLineIn) + end + local nLineR = EgtLine( nGeoRawLayerId, EgtEP( vCrvs[#vCrvs]), EgtSP( vIdIn[#vIdIn])) + table.insert( vCrvs, nLineR) + for i = #vIdIn, 1, -1 do + table.insert( vCrvs, vIdIn[i]) + end + local nLineL = EgtLine( nGeoRawLayerId, EgtEP( vIdIn[1]), EgtSP( vCrvs[1])) + table.insert( vCrvs, nLineL) + + -- taglio le curve nelle intersezioni ( va eliminato il sovramateriale per minizinken) + TrimAndOrientOrderedCurves( vCrvs, false) + + -- costruisco la compo del grezzo + local nCompo = EgtCurveCompo( nGeoRawLayerId, vCrvs) + local nGeoLayerId = EgtGetFirstNameInGroup( nPartId, WIN_GEO) + local dDimH = EgtGetInfo( nGeoLayerId, WIN_GEOHEIGHT, 'd') + EgtModifyCurveThickness( nCompo, - dDimH) + + -- creo il frame ausiliario + local vtX = EgtSV( nCompo) + local frGeo = Frame3d( EgtSP( nCompo), vtX, Z_AX() ^ vtX, Z_AX()) + local nFrameId = EgtFrame( nGeoRawLayerId, frGeo) + EgtSetName( nFrameId, WIN_PRC_FRAME) + +end + +--------------------------------------------------------------------- +-- funzione che calcola i tronchetti di un pezzo ad arco +function WinCalculate.CreateArcLogs( nPartId, nLogsNbr, vSections, bAlign, dOverMatOut, dOverMatIn, dOverMatExt, dOverMatInt, bCutExtremities) + + -- verifico dati in ingresso + if bAlign then nLogsNbr = 0 end + if not bAlign and nLogsNbr == 0 and ( #vSections == 0 or #vSections > 1) then + return + end + + -- recupero o creo il gruppo per i tronchetti + local nGrp = EgtGetFirstNameInGroup( nPartId, WIN_LOGS) + if not nGrp then + nGrp = EgtGroup( nPartId) + EgtSetName( nGrp, WIN_LOGS) + else + EgtEmptyGroup( nGrp) + end + + -- recupero il geo del pezzo + local nGeoLayerId = EgtGetFirstNameInGroup( nPartId, WIN_GEO) + local nGeoIn = EgtGetFirstNameInGroup( nGeoLayerId, WIN_GEO_IN) + local nGeoOut = EgtGetFirstNameInGroup( nGeoLayerId, WIN_GEO_OUT) + + -- spezzo l'arco interno + SplitArc( nLogsNbr, vSections, bAlign, dOverMatOut + dOverMatIn, nGeoIn, nGeoOut, nGrp) + + -- calcolo la sezione di riferimento per i tronchetti + local dSection = CalcLogsSection( nLogsNbr, vSections, bAlign, dOverMatOut + dOverMatIn, nGeoIn, nGeoOut, nGrp) + if not dSection then + return + end + + -- creo i tronchetti + CalcLogs( nGrp, nGeoOut, dOverMatIn, dOverMatOut, dOverMatExt, dOverMatInt, dSection, bCutExtremities) + + -- TODO : recupero modalità di lavorazione dei tronchetti + local bFinishedLogs = false + + -- creo i pezzi associati ai tronchetti + local vLogs = EgtGetInfo( nPartId, WIN_LOGS, 'vi') or {} + EgtErase( vLogs) + CalcLogParts( nPartId, bFinishedLogs) + if not bFinishedLogs then + -- sistemo il Georaw per il pezzo ad arco + CalcGeoRawFromLogs( nPartId) + else + -- TODO segnalare che il pezzo non va lavorato + end +end + + + +---------------------------------------------------------------------------------- +---------------------------------- FERRAMENTA ---------------------------------- +---------------------------------------------------------------------------------- +-- funzione che disegna le cerniere +local function DrawHinges( nOutlineId, nSolidLayerId) + + -- dimensioni cerniere + local dDimH = 16 + local dDimV = 70 + local dFilletRad = 5 + + local nBaseOutlineId = EgtGetInfo( nOutlineId, WIN_COPY, 'i') + local dDelta = ( EgtSP( nOutlineId) - EgtSP( nBaseOutlineId)) * Z_AX() + if dDelta < GEO.EPS_SMALL then + return + end + local vtDir = EgtSV( nOutlineId) + local vtDirIn = Vector3d( vtDir) + vtDirIn:rotate( Z_AX(), -90) + + -- prima cerniera + local pt1 = EgtSP( nOutlineId) - dDelta * Z_AX() + local nCompo = EgtCurveCompoFromPoints( nSolidLayerId, { pt1 + dFilletRad * vtDir, pt1 + ( dDimV - dFilletRad) * vtDir}) + EgtAddCurveCompoArcTg( nCompo, pt1 + dDimV * vtDir + dFilletRad * vtDirIn) + EgtAddCurveCompoLine( nCompo, pt1 + dDimV * vtDir + ( dDimH - dFilletRad) * vtDirIn) + EgtAddCurveCompoArcTg( nCompo, pt1 + ( dDimV - dFilletRad) * vtDir + dDimH * vtDirIn) + EgtAddCurveCompoLine( nCompo, pt1 + dFilletRad * vtDir + dDimH * vtDirIn) + EgtAddCurveCompoArcTg( nCompo, pt1 + ( dDimH - dFilletRad) * vtDirIn) + EgtAddCurveCompoLine( nCompo, pt1 + dFilletRad * vtDirIn) + EgtAddCurveCompoArcTg( nCompo, EgtSP( nCompo)) + local nStm1 = EgtSurfTmByRegionExtrusion( nSolidLayerId, nCompo, dDelta * Z_AX()) + EgtSetColor( nStm1, Color3d( 128, 128, 128)) + EgtSetName( nStm1, WIN_HDW_HINGES) + EgtErase( nCompo) + + -- seconda cerniera + local pt2 = EgtEP( nOutlineId) - dDelta * Z_AX() - dDimV * vtDir + local nStm2 = EgtCopyGlob( nStm1, nSolidLayerId) + EgtMove( nStm2, pt2 - pt1) + + -- correzioni per telai non rettangolari + local nFrameAreaId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_AREA .. '*') + local nFrameType = EgtGetInfo( nFrameAreaId, WIN_FRAME_TYPE, 'i') + + -- a) arco + if nFrameType == WIN_FRAME_TYPES.ROUND_ARC or nFrameType == WIN_FRAME_TYPES.SEGMENTAL_ARC then + local sName = EgtGetName( nOutlineId) + -- calcolo il delta da applicare ( euristico, calcolato in base ai risultati ferramenta) + local dDelta = 24 -- caso di arco a tutto sesto + local dDeltaSegArc = 54.7 -- caso di arco ribassato + if nFrameType == WIN_FRAME_TYPES.SEGMENTAL_ARC then + -- nel caso di arco ribassato il delta va calcolato rispetto al frame della ferramenta + local nAreaId = EgtGetParent( EgtGetParent( nOutlineId)) + local nHdwFramesId = EgtGetFirstNameInGroup( nAreaId, WIN_HDW_FRAME) + local sFrameName = EgtIf( sName == WIN_LEFT, 'B*', 'C*') + local nFrameId = EgtGetFirstNameInGroup( nHdwFramesId, sFrameName) + if sName == WIN_LEFT then + dDelta = ( EgtSP( nFrameId) - EgtSP( nOutlineId)) * vtDir + else + dDelta = ( EgtEP( nOutlineId) - EgtSP( nFrameId)) * vtDir + end + dDelta = dDelta + dDeltaSegArc + end + + -- traslazione + if sName == WIN_LEFT then + EgtMove( nStm1, dDelta * vtDir) + else + EgtMove( nStm2, - dDelta * vtDir) + end + + -- b) trapezio + elseif nFrameType == WIN_FRAME_TYPES.CHAMFER_SIDE then + -- calcolo il delta da applicare. Euristico. Dal calcolo della ferramenta si vede che la cerniera si trova circa nel punto di intersezione tra nOutlineId e una retta inclinata + -- come il top e passante per il frame della ferramenta + local sName = EgtGetName( nOutlineId) + local nOutlineLayId = EgtGetParent( nOutlineId) + local nAreaId = EgtGetParent( nOutlineLayId) + local nHdwFramesId = EgtGetFirstNameInGroup( nAreaId, WIN_HDW_FRAME) + local sFrameName = EgtIf( sName == WIN_LEFT, 'B*', 'C*') + local nFrameId = EgtGetFirstNameInGroup( nHdwFramesId , sFrameName) + local nTopId = EgtGetFirstNameInGroup( nOutlineLayId, WIN_TOP) + local vtTop = EgtSV( nTopId) + local ptRef = EgtIf( sName == WIN_LEFT, EgtSP( nOutlineId), EgtEP( nOutlineId)) + local vtDist = EgtSP( nFrameId) - ptRef + local dDelta = ( vtDist ^ vtTop):len() / ( vtTop ^ vtDir):len() + + if sName == WIN_LEFT then + EgtMove( nStm1, dDelta * vtDir) + else + EgtMove( nStm2, - dDelta * vtDir) + end + end +end + +--------------------------------------------------------------------- +-- funzione che disegna la maniglia +local function DrawHandle( nOutlineId, sHandleSide, dHandleH, nSolidLayerId, bSlide) + + -- dati della maniglia + local dBase1T = 40 + local dBase1B = 40 + local dBase2 = 18 + local dH = 9 + local dLen1 = 53 + local dLen2 = 115 + local dRadH = 12.5 + local dFillet = 10 + local dExtraGapDelta = 15 + if bSlide then + dBase1T = 50 + dBase1B = 100 + dBase2 = 18 + dLen2 = 155 + dRadH = 10 + dExtraGapDelta = 35.5 + end + + local nPartId = EgtGetInfo( nOutlineId, WIN_REF_PART, 'i') + local ptRef = EgtIf( sHandleSide == 'Sx', EgtSP( nOutlineId), EgtEP( nOutlineId)) + local vtDir = EgtIf( sHandleSide == 'Sx', EgtSV( nOutlineId), - EgtEV( nOutlineId)) + local vtDirIn = Vector3d( vtDir) + vtDirIn:rotate( Z_AX(), EgtIf( sHandleSide == 'Sx', 90, -90)) + + -- recupero il riferimento rispetto a cui leggere l'altezza maniglia + local nProfileLayId = EgtGetFirstNameInGroup( nPartId, WIN_PROFILE) + local nProfileId = EgtGetFirstNameInGroup( nProfileLayId, EgtIf( sHandleSide == 'Sx', WIN_PRF_START, WIN_PRF_END)) + local dGapHardware = EgtGetInfo( nProfileId, WIN_GAPDELTA, 'd') + -- recupero di quanto spostare la maniglia rispetto all'outline + local nMainProfileId = EgtGetFirstNameInGroup( nProfileLayId, WIN_PRF_MAIN) + local dGapDelta = EgtGetInfo( nMainProfileId, WIN_GAPDELTA, 'd') + local dDeltaIn = dGapDelta + dExtraGapDelta + + -- punto su cui centrare la maniglia + local ptC = ptRef + ( dHandleH + dGapHardware) * vtDir + dDeltaIn * vtDirIn + + local nCrv1 = EgtRectangle2P( nSolidLayerId, ptC - dBase1B * vtDir - dBase2 * vtDirIn, ptC + dBase1T * vtDir + dBase2 * vtDirIn) + local nStm1 = EgtSurfTmByRegionExtrusion( nSolidLayerId, {nCrv1}, dH * Z_AX()) + + local nCrv2 = EgtLinePVL( nSolidLayerId, ORIG(), X_AX(), dLen1 - dFillet) + local nCrv4 = EgtLinePVL( nSolidLayerId, Point3d( dLen1, -dFillet, 0), - Y_AX(), dLen2 - dFillet) + local nCrv3 = EgtArc2PR( nSolidLayerId, EgtEP( nCrv2), EgtSP( nCrv4), dFillet, false) + local nGuide = EgtCurveCompo( nSolidLayerId, { nCrv2, nCrv3, nCrv4}) + local frTransf = Frame3d( ptC, Z_AX(), vtDir, Z_AX() ^ vtDir) + EgtTransform( nGuide, frTransf) + local nSection = EgtCircle( nSolidLayerId, EgtSP( nGuide), dRadH) + local nStm2 = EgtSurfTmSwept( nSolidLayerId, nSection, nGuide, true) + + EgtSurfTmAdd( nStm1, nStm2) + EgtSetName( nStm1, WIN_HDW_HANDLE) + EgtSetColor( nStm1, Color3d( 128, 128, 128)) + EgtErase( { nCrv1, nGuide, nSection, nStm2}) +end + +--------------------------------------------------------------------- +-- funzione che disegna la ferramenta +local function DrawSashHardware( nAreaId, nRefAreaId, nSolidLayerId) + + local nOutlineLayId = EgtGetFirstNameInGroup( nAreaId, WIN_OUTLINE) + local nOpeningType = EgtGetInfo( nAreaId, WIN_OPENING_TYPE, 'i') + + if nOpeningType == WIN_OPENING_TYPES.NULL or nOpeningType == WIN_OPENING_TYPES.FIXED then + return + + -- Vasistas + elseif nOpeningType == WIN_OPENING_TYPES.TILTONLY_TOP then + -- cerniere sul pezzo inferiore + local nBottomId = EgtGetFirstNameInGroup( nOutlineLayId, WIN_BOTTOM) + DrawHinges( nBottomId, nSolidLayerId) + + -- recupero lato maniglia + local vOptions = EgtGetInfo( nRefAreaId, WIN_HDW_OPTIONS, 'vs') or {} + local sHandleSide = 'Sx' + local nOutlineId = EgtGetFirstNameInGroup( nOutlineLayId, WIN_RIGHT) + for i = 1, #vOptions do + local vString = EgtSplitString( vOptions[i], '=') + if vString[1] == 'PosizioneManiglia' then + if vString[2] == 'destra' then + sHandleSide = 'Dx' + nOutlineId = EgtGetFirstNameInGroup( nOutlineLayId, WIN_LEFT) + elseif vString[2] == 'sopra' then + nOutlineId = EgtGetFirstNameInGroup( nOutlineLayId, WIN_TOP) + end + break + end + end + -- altezza maniglia è fissata a metà del lato ( con compensazione per frame di riferimento della ferramenta) + local nPartId = EgtGetInfo( nOutlineId, WIN_REF_PART, 'i') + local nProfileLayId = EgtGetFirstNameInGroup( nPartId, WIN_PROFILE) + local nProfileId = EgtGetFirstNameInGroup( nProfileLayId, EgtIf( sHandleSide == 'Sx', WIN_PRF_START, WIN_PRF_END)) + local dGapHardware = EgtGetInfo( nProfileId, WIN_GAPDELTA, 'd') + local dHandleH = 0.5 * EgtCurveLength( nOutlineId) - dGapHardware + + -- disegno maniglia + DrawHandle( nOutlineId, sHandleSide, dHandleH, nSolidLayerId) + + -- Alzante scorrevole + elseif nOpeningType == WIN_OPENING_TYPES.COPLANARSLIDE_LEFT or nOpeningType == WIN_OPENING_TYPES.COPLANARSLIDE_RIGHT or + nOpeningType == WIN_OPENING_TYPES.LIFTSLIDE_LEFT or nOpeningType == WIN_OPENING_TYPES.LIFTSLIDE_RIGHT then + + local bLeftSlide = ( nOpeningType == WIN_OPENING_TYPES.COPLANARSLIDE_LEFT or nOpeningType == WIN_OPENING_TYPES.LIFTSLIDE_LEFT) + local nOutlineId = EgtGetFirstNameInGroup( nOutlineLayId, EgtIf( bLeftSlide, WIN_RIGHT, WIN_LEFT)) + local sHandleSide = EgtIf( bLeftSlide, 'Sx', 'Dx') + + -- recupero altezza maniglia dalle opzioni + local dHandleH = 400 + local vOptions = EgtGetInfo( nRefAreaId, WIN_HDW_OPTIONS, 'vs') or {} + for i = 1, #vOptions do + local vString = EgtSplitString( vOptions[i], '=') + if #vString == 2 and vString[1] == WIN_HDW_HANDLE_HEIGHT then + dHandleH = tonumber( vString[2]) + break + end + end + + DrawHandle( nOutlineId, sHandleSide, dHandleH, nSolidLayerId, true) + + -- Standard + else + local nSashType = EgtGetInfo( nAreaId, WIN_SASHTYPE, 'i') or WIN_SASHTYPES.NULL + + -- recupero pezzi interessati dalla ferramenta + local nLeftId = EgtGetFirstNameInGroup( nOutlineLayId, WIN_LEFT) + local nRightId = EgtGetFirstNameInGroup( nOutlineLayId, WIN_RIGHT) + + -- recupero dati della maniglia + local sHandleSide = EgtGetInfo( nRefAreaId, WIN_HDW_HANDLE) + local dHandleH = 500 + local vOptions = EgtGetInfo( nRefAreaId, WIN_HDW_OPTIONS, 'vs') or {} + for i = 1, #vOptions do + local vString = EgtSplitString( vOptions[i], '=') + if #vString == 2 and vString[1] == WIN_HDW_HANDLE_HEIGHT then + dHandleH = tonumber( vString[2]) + break + end + end + + -- cerniere + if nSashType == WIN_SASHTYPES.INACTIVE or nSashType == WIN_SASHTYPES.INACTIVE_OUT or + nSashType == WIN_SASHTYPES.ACTIVE or nSashType == WIN_SASHTYPES.ACTIVE_OUT then + -- le cerniere vanno messe sul lato che poggia sul telaio + local nBaseOutlineId = EgtGetInfo( nLeftId, WIN_COPY, 'i') + local bLeftInactive = EgtGetInfo( nBaseOutlineId, WIN_CRV_ON_FRENCH_SPLIT, 'b') or false + DrawHinges( EgtIf( bLeftInactive, nRightId, nLeftId), nSolidLayerId) + elseif nSashType == WIN_SASHTYPES.NULL then + -- è il lato senza maniglia + if sHandleSide == 'Sx' then + DrawHinges( nLeftId, nSolidLayerId) + else + DrawHinges( nRightId, nSolidLayerId) + end + end + + -- maniglia + if nSashType == WIN_SASHTYPES.ACTIVE or nSashType == WIN_SASHTYPES.ACTIVE_IN or nSashType == WIN_SASHTYPES.NULL then + if sHandleSide == 'Sx' then + DrawHandle( nRightId, sHandleSide, dHandleH, nSolidLayerId) + else + DrawHandle( nLeftId, sHandleSide, dHandleH, nSolidLayerId) + end + end + end +end + +--------------------------------------------------------------------- +-- funzione che calcola i dati necessari per la ferramenta +local function SearchSash( nAreaId, SashList) + -- verifico il tipo + local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') + if nAreaType == WIN_AREATYPES.SASH then + + -- creo gruppo temporaneo per i conti + local nOutlineOffsetLayerId = EgtGroup( nAreaId) + + -- recupero gruppi dei profili + local nProfileId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE) + local nSashProfileLayerId = EgtGetFirstNameInGroup( nProfileId, WIN_SASH) + local nFrameProfileLayerId = EgtGetFirstNameInGroup( nProfileId, WIN_FRAME) + + -- creo gruppo per i riferimenti della ferramenta per l'anta + local nHdwSashLayerId = EgtGroup( nAreaId) + EgtSetName( nHdwSashLayerId, WIN_HDW_FRAME) + EgtSetStatus( nHdwSashLayerId, GDB_ST.OFF) + + -- recupero o creo gruppo per i riferimenti della ferramenta per il telaio + local nFrameAreaId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_AREA .. '*') + local nHdwFrameLayerId = EgtGetFirstNameInGroup( nFrameAreaId, WIN_HDW_FRAME) + if not nHdwFrameLayerId then + nHdwFrameLayerId = EgtGroup( nFrameAreaId) + EgtSetName( nHdwFrameLayerId, WIN_HDW_FRAME) + EgtSetStatus( nHdwFrameLayerId, GDB_ST.OFF) + end + + -- verifico se alzante scorrevole + local bSlide = EgtGetInfo( nFrameAreaId, WIN_SLIDE_WINDOW, 'b') or false + + -- ricostruisco gli outlines dell'anta in corrispondenza del canalino della ferramenta ( orgine dei riferimenti) + local vOutlineCopy = {} + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_OUTLINE) + local nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) + while nOutlineId do + local sProfileType = EgtGetInfo( nOutlineId, WIN_PROFILETYPE) + local nSashProfileId = EgtGetFirstNameInGroup( nSashProfileLayerId, sProfileType) + local dGapDelta = EgtGetInfo( nSashProfileId, WIN_GAPDELTA, 'd') + local nOutlineCopyId = EgtCopy( nOutlineId, nOutlineOffsetLayerId) + EgtOffsetCurve( nOutlineCopyId, - dGapDelta) + table.insert( vOutlineCopy, nOutlineCopyId) + -- setto info ausiliarie sulla curva + EgtSetInfo( nOutlineCopyId, 'ORIG', nOutlineId) + CopyInfo( nOutlineCopyId, nSashProfileId, WIN_GAPDELTAZ) + local b3Profile = GetProfileLocalBox( nSashProfileId) + EgtSetInfo( nOutlineCopyId, WIN_GAPDELTAZ .. 2, b3Profile:getDimY()) + nOutlineId = EgtGetNext( nOutlineId) + end + TrimAndOrientOrderedCurves( vOutlineCopy, false) + + -- costruisco i riferimenti + local tFrame = {} + for nIndex = 1, #vOutlineCopy do + -- 1) Riferimenti ANTA + local ptOrig = EgtEP( vOutlineCopy[nIndex]) + local sOrigName = string.char( string.byte( 'A') + #vOutlineCopy - nIndex) + local vtDir = EgtEV( vOutlineCopy[nIndex]) + local nFA1Id = EgtFrame( nHdwSashLayerId, Frame3d( ptOrig, - vtDir, vtDir ^ Z_AX(), Z_AX())) + EgtSetName( nFA1Id, sOrigName .. '.FA1') + local vtIn = Vector3d( vtDir) + vtIn:rotate( Z_AX(), -90) + local dGapDeltaZ = EgtGetInfo( vOutlineCopy[nIndex], WIN_GAPDELTAZ, 'd') + local nFA2Id = EgtFrame( nHdwSashLayerId, Frame3d( ptOrig - dGapDeltaZ * Z_AX(), - vtDir, vtDir ^ vtIn, vtIn)) + EgtSetName( nFA2Id, sOrigName .. '.FA2') + local dGapDeltaZ2 = EgtGetInfo( vOutlineCopy[nIndex], WIN_GAPDELTAZ .. 2, 'd') + local nFA3Id = EgtFrame( nHdwSashLayerId, Frame3d( ptOrig - dGapDeltaZ2 * Z_AX(), - vtDir, vtDir ^ -Z_AX(), -Z_AX())) + EgtSetName( nFA3Id, sOrigName .. '.FA3') + + -- 2) Riferimenti TELAIO + -- ricavo elemento su cui poggia ( è il primo parent con un profilo associato. Potrebbe essere uno split in sottoarea del telaio o potrebbe non + -- esistere nel caso di french split) + local nOrigOutlineId = EgtGetInfo( vOutlineCopy[nIndex], 'ORIG', 'i') + local nBaseOutlineId = EgtGetInfo( nOrigOutlineId, WIN_COPY, 'i') + local nSouId = EgtGetInfo( nBaseOutlineId, WIN_SOU, 'i') + local sProfileFrame = EgtGetInfo( nSouId, WIN_PROFILETYPE) + while nSouId and not sProfileFrame do + nSouId = EgtGetInfo( nSouId, WIN_SOU, 'i') + sProfileFrame = EgtGetInfo( nSouId or GDB_ID.NULL, WIN_PROFILETYPE) + end + + if nSouId then + -- ricavo aria lato telaio + local nFrameProfileId = EgtGetFirstNameInGroup( nFrameProfileLayerId, sProfileFrame, 'i') + local dGapDeltaOut = EgtGetInfo( nFrameProfileId, WIN_GAPDELTA, 'd') + -- se deriva da split verifico il lato + if EgtGetName( nSouId) == WIN_SPLIT then + local bSameDir = AreSameVectorApprox( EgtSV( nSouId), EgtSV( nBaseOutlineId)) + -- recupero informazione dal lato corretto ( split orizzontale) + if not dGapDeltaOut then + if bSameDir then + dGapDeltaOut = EgtGetInfo( nFrameProfileId, WIN_GAPDELTA .. '2', 'd') + else + dGapDeltaOut = EgtGetInfo( nFrameProfileId, WIN_GAPDELTA .. '1', 'd') + end + end + -- verifico il segno dell'offset + if not bSameDir then + dGapDeltaOut = - dGapDeltaOut + end + end + local nOutlineOutId = EgtCopy( nSouId, nOutlineOffsetLayerId) + EgtOffsetCurve( nOutlineOutId, - dGapDeltaOut) + -- recupero origine come proiezione sul telaio dell'origine dell'anta + local _, ptOrigFr = EgtPointCurveDist( ptOrig, nOutlineOutId) + if bSlide then + -- nel caso di alzante scorrevole l'origine non è proiettata + ptOrigFr = EgtEP( nOutlineOutId) + end + local nFT1Id = EgtFrame( nHdwFrameLayerId, Frame3d( ptOrigFr, - vtDir, vtDir ^ Z_AX(), Z_AX())) + EgtSetName( nFT1Id, sOrigName .. '.FT1') + table.insert( tFrame, nFT1Id) + local vtFrameIn = Vector3d( vtDir) + vtFrameIn:rotate( Z_AX(), 90) + local dFrameGapDeltaZ = EgtGetInfo( nFrameProfileId, WIN_GAPDELTAZ, 'd') + local nFT2Id = EgtFrame( nHdwFrameLayerId, Frame3d( ptOrigFr - dFrameGapDeltaZ * Z_AX(), - vtDir, vtDir ^ vtFrameIn, vtFrameIn)) + EgtSetName( nFT2Id, sOrigName .. '.FT2') + table.insert( tFrame, nFT2Id) + local b3FrameProfile = GetProfileLocalBox( nFrameProfileId) + local dGapDeltaZ2 = b3FrameProfile:getDimY() + local nFT3Id = EgtFrame( nHdwFrameLayerId, Frame3d( ptOrigFr - dGapDeltaZ2 * Z_AX(), - vtDir, vtDir ^ -Z_AX(), -Z_AX())) + EgtSetName( nFT3Id, sOrigName .. '.FT3') + table.insert( tFrame, nFT3Id) + end + end + + -- preparo tabella per l'anta con i dati necessari per la ferramenta + local tSash = { nAreaId = nAreaId} + -- calcolo in centro per ordinamento + local b3Outline = EgtGetBBox( nOutlineLayerId, GDB_BB.STANDARD) + tSash.ptCenter = b3Outline:getCenter() + -- calcolo le dimensioni + tSash.LHeight = EgtCurveLength( vOutlineCopy[4]) + tSash.RHeight = EgtCurveLength( vOutlineCopy[2]) + tSash.BWidth = EgtCurveLength( vOutlineCopy[1]) + if EgtGetType( vOutlineCopy[3]) == GDB_TY.CRV_ARC then + -- tSash.BCLength = EgtCurveLength( vOutlineCopy[3]) -- in alternativa a BCArrow, è il parametro LBBA nel file di richiesta + tSash.BCArrow = dist( EgtMP( vOutlineCopy[3]), 0.5 * ( EgtEP( vOutlineCopy[3]) + EgtSP( vOutlineCopy[3]))) + end + -- salvo i frame del telaio associati + tSash.Frame = tFrame + table.insert( SashList, tSash) + + EgtErase( nOutlineOffsetLayerId) + end + + -- verifico se ci sono sotto-aree + local nChildAreaId = EgtGetFirstNameInGroup( nAreaId, WIN_AREA .. '*') + while nChildAreaId do + -- lancio costruzione pezzi di quell'area + SearchSash( nChildAreaId, SashList) + nChildAreaId = EgtGetNextName( nChildAreaId, WIN_AREA .. '*') + end +end + +--------------------------------------------------------------------- +-- funzione che aggiunge l'hardware +function WinCalculate.AddHardwareForSash( nFrameId, bOnlyRequest) + -- cerco ed indicizzo ante del serramento + local SashList = {} + SearchSash( nFrameId, SashList) + + -- ordino per X e Y + local function compareXY(a,b) + if abs( a.ptCenter:getX() - b.ptCenter:getX()) < GEO.EPS_SMALL then + return a.ptCenter:getY() < b.ptCenter:getY() + else + return a.ptCenter:getX() < b.ptCenter:getX() + end + end + table.sort( SashList, compareXY) + + -- correggo nomi Frame del telaio in base all'ordinamento delle ante + for nIndex = 1, #SashList do + for nFrameIndex = 1, #SashList[nIndex].Frame do + local nFrameId = SashList[nIndex].Frame[nFrameIndex] + local sName = EgtGetName( nFrameId) + EgtSetName( nFrameId, nIndex .. '.' .. sName) + end + end + + -- recupero preferito della ferramenta + local nFavourite = EgtGetInfo( nFrameId, WIN_HDW_FAVOURITE) + if bOnlyRequest then + nFavourite = WDG.HDWFAVOURITE + end + if not nFavourite or nFavourite == WIN_HDW_NULL then + EgtOutLog('Warning! No hardware favourite set!') + return + end + local sHandle = EgtGetInfo( nFrameId, WIN_HDW_HANDLE) + if bOnlyRequest then + sHandle = WDG.HDWHANDLE + end + if not sHandle then + EgtOutLog('Warning! No hardware handle set!') + return + end + -- creo file di richiesta ferramenta + local sNow = os.date( '_%Y_%m_%d_%H_%M_%S', os.time()) + local sInputFile = 'a:\\InputBatch\\Input' .. sNow .. '.txt' + local sAGBOutputKitFile = 'C:\\AGB3000NG\\OutputBatch\\Output' .. sNow .. '.txt' + local sAGBOutputPositionFile = 'C:\\AGB3000NG\\OutputBatch\\OutputPosition' .. sNow .. '.txt' + local sAGBOutputLavFile = 'C:\\AGB3000NG\\OutputBatch\\OutputLav' .. sNow .. '.txt' + local sOutputKitFile = 'a:\\OutputBatch\\Output' .. sNow .. '.txt' + local sOutputPositionFile = 'a:\\OutputBatch\\OutputPosition' .. sNow .. '.txt' + local sOutputLavFile = 'a:\\OutputBatch\\OutputLav' .. sNow .. '.txt' + -- Apro file Input in scrittura + local fhInput = io.open( sInputFile, 'w') + if not fhInput then + EgtOutLog( 'Error opening file ' .. sInputFile) + return false + end + + local sText = 'S_NAME=' .. nFavourite .. '\n' .. + 'RECORDID=15A' .. '\n' + if s_bCalcHardwareKit then + sText = sText .. 'EXTINFO=ON\n' .. + 'OUTPUTKIT=' .. sAGBOutputKitFile .. '\n' + + end + if s_bCalcHardwarePosition then + sText = sText .. 'OUTPUTARTICLEPOSITION=' .. sAGBOutputPositionFile .. '\n' + end + + -- recupero il tipo di apertura + local nOpeningType = WIN_OPENING_TYPES.NULL + if #SashList > 0 then + nOpeningType = EgtGetInfo( SashList[1].nAreaId, WIN_OPENING_TYPE, 'i') + end + -- recupero se scorrevole + local bSlide = EgtGetInfo( nFrameId, WIN_SLIDE_WINDOW, 'b') or false + + if bSlide then + -- le dimensioni per alzante scorrevole sono quelle del telaio + local nOutlineLayId = EgtGetFirstInGroup( nFrameId, WIN_AREAOUTLINE) + local nBottomId = EgtGetFirstNameInGroup( nOutlineLayId, WIN_BOTTOM) + local dMet = EgtCurveLength( nBottomId) + local nLeftId = EgtGetFirstNameInGroup( nOutlineLayId, WIN_LEFT) + local dHet = EgtCurveLength( nLeftId) + sText = sText .. 'MET=' .. tostring( dMet) .. '\n' + sText = sText .. 'HET=' .. tostring( dHet) .. '\n' + + else + if #SashList >= 1 and abs( SashList[1].LHeight - SashList[1].RHeight) < GEO.EPS_SMALL then + sText = sText .. 'HBB=' .. tostring( SashList[1].LHeight) .. '\n' + else + for nSashIndex = 1, #SashList do + if nSashIndex == 1 then + sText = sText .. 'HBB_sx=' .. tostring( SashList[nSashIndex].LHeight) .. '\n' + else + sText = sText .. 'HBB_' .. tostring( nSashIndex - 1) .. 'B=' .. tostring( SashList[nSashIndex].LHeight) .. '\n' + end + if nSashIndex == #SashList then + sText = sText .. 'HBB_dx=' .. tostring( SashList[nSashIndex].RHeight) .. '\n' + else + sText = sText .. 'HBB_' .. tostring( nSashIndex) .. '=' .. tostring( SashList[nSashIndex].RHeight) .. '\n' + end + end + end + + if #SashList == 1 then + sText = sText .. 'LBB=' .. tostring( SashList[1].BWidth) .. '\n' + if SashList[1].BCArrow then + sText = sText .. 'FRECCIA_1=' .. tostring( SashList[1].BCArrow) .. '\n' + end + else + for nSashIndex = 1, #SashList do + sText = sText .. 'LBB' .. nSashIndex .. '=' .. tostring( SashList[nSashIndex].BWidth) .. '\n' + if SashList[nSashIndex].BCArrow then + sText = sText .. 'FRECCIA_' .. nSashIndex .. '=' .. tostring( SashList[nSashIndex].BCArrow) .. '\n' + end + end + end + end + + sText = sText .. 'FINESTRAPORTAFINESTRA=Finestra' .. '\n' .. + 'Q=1' .. '\n' + + -- opzione manoserramento ( non per vasistas altrimenti sovrascrive l'opzione) + if nOpeningType ~= WIN_OPENING_TYPES.TILTONLY_TOP then + sText = sText .. 'MANOSERRAMENTO=' .. sHandle .. '\n' + end + + local vOptions = EgtGetInfo( nFrameId, WIN_HDW_OPTIONS, 'vs') or {} + for i = 1, #vOptions do + sText = sText .. vOptions[i] .. '\n' + end + + sText = sText .. 'CNCOUTPUT=' .. sAGBOutputLavFile .. '\n' .. + 'RUN' + + -- Scrittura nuova linea + fhInput:write( sText .. '\n') + + -- Chiudo file + fhInput:close() + + if bOnlyRequest then + return sInputFile + end + + -- attendo scrittura output lavorazioni + local nWait = 0 + while not EgtExistsFile( sOutputLavFile) and nWait < 1000 do + nWait = nWait + 1 + EgtPause( 10, true) + end + + EgtPause( 10, true) + + -- Apro file OutputLav in lettura + local fhOutputLav = io.open( sOutputLavFile, 'r') + if not fhOutputLav then + EgtOutLog( 'Error opening file ' .. sOutputLavFile) + return false + end + local nFrameAreaId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_AREA .. '*') + local nHdwFrameLayerId = EgtGetFirstNameInGroup( nFrameAreaId, WIN_HDW_FRAME) + for sMach in fhOutputLav:lines('l') do + local MachParams = EgtSplitString( sMach, ';') + local sPart = MachParams[3] + local nSashIndex = tonumber( MachParams[4]) + local sSashPart = MachParams[5] + local dPosX = tonumber( MachParams[6]) + local dPosY = tonumber( MachParams[7]) + local dPosZ = tonumber( MachParams[8]) + local sMacro = MachParams[9] + local sSide = MachParams[21] -- FT1, FT2, FT3, FA1, FA2, FA3 + local sOrigin = MachParams[24] -- AB, BC, CD, DA + + local nSashId = SashList[nSashIndex].nAreaId + local nOutlineLayerId = EgtGetFirstNameInGroup( nSashId, WIN_OUTLINE) + local vOutlineIds = EgtGetAllInGroup( nOutlineLayerId) + local nA = string.byte( 'A') + local nSashPart = string.byte( sSashPart) + local nOutlineIndex = #vOutlineIds - ( nSashPart - nA) + local nOutlineId = vOutlineIds[nOutlineIndex] + local nPartId = GDB_ID.NULL + local frHdw + if sPart == 'TELAIO' then + local nSashBaseOutlineId = EgtGetInfo( nOutlineId, WIN_COPY, 'i') + local nSouId = EgtGetInfo( nSashBaseOutlineId, WIN_SOU, 'i') + local sSouProfile = EgtGetInfo( nSouId, WIN_PROFILETYPE) + while nSouId and not sSouProfile do + nSouId = EgtGetInfo( nSouId, WIN_SOU, 'i') + sSouProfile = EgtGetInfo( nSouId or GDB_ID.NULL, WIN_PROFILETYPE) + end + local nFrameOutlineId = EgtGetInfo( nSouId, WIN_COPY, 'i') + nPartId = EgtGetInfo( nFrameOutlineId, WIN_REF_PART, 'i') + local nHdwFrameId = EgtGetLastNameInGroup( nHdwFrameLayerId, nSashIndex .. '.' .. sSashPart .. '.' .. sSide) + frHdw = EgtFR( nHdwFrameId) + elseif sPart == 'ANTA' then + nPartId = EgtGetInfo( nOutlineId, WIN_REF_PART, 'i') + local nHdwFrameLayerId = EgtGetFirstNameInGroup( nSashId, WIN_HDW_FRAME) + local nHdwFrameId = EgtGetLastNameInGroup( nHdwFrameLayerId, sSashPart .. '.' .. sSide) + frHdw = EgtFR( nHdwFrameId) + end + + local nProcLayerId = EgtGetFirstNameInGroup( nPartId, WIN_PRC) + + -- recupero solido ( se non calcolato non vengono utilizzate) + local nSolidLayerId = EgtGetFirstNameInGroup( nPartId, WIN_SOLID) or GDB_ID.NULL + local nMainExtrusionId = EgtGetFirstNameInGroup( nSolidLayerId, WIN_SRF_MAIN) + local nOrigMainId = EgtGetFirstNameInGroup( nSolidLayerId, WIN_SRF_ORIGMAIN) + + -- calcolo il punto centrale della lavorazione + local ptCenter = Point3d( dPosX, dPosY, dPosZ) + + -- gestione particolare per traverso superiore ad arco + if EgtGetType( nOutlineId) == GDB_TY.CRV_ARC then + local nProfileLayId = EgtGetFirstNameInGroup( nPartId, WIN_PROFILE) + local nProfileId = EgtGetFirstNameInGroup( nProfileLayId, WIN_PRF_MAIN) + + -- calcolo outline del telaio sul canalino della ferramenta + local nRefOutlineId = EgtGetInfo( nPartId, WIN_REF_OUTLINE, 'i') + local nOffsetId = EgtCopyGlob( nRefOutlineId, nPartId) + local dGapDelta = EgtGetInfo( nProfileId, WIN_GAPDELTA, 'd') + EgtOffsetCurve( nOffsetId, - dGapDelta) + + -- recupero origine sulla curva di offset a partire dai frame dell'anta + local nHdwSashLayerId = EgtGetFirstNameInGroup( nSashId, WIN_HDW_FRAME) + local sHdwName = EgtIf( sOrigin == 'AB', 'B', 'C') .. '.FA1' + local nHdwSashId = EgtGetLastNameInGroup( nHdwSashLayerId, sHdwName) + local _, _, dParRef = EgtPointCurveDist( EgtSP( nHdwSashId), nOffsetId) + local dLen = EgtCurveLengthAtParam( nOffsetId, dParRef) + dLen = dLen + dPosX + local dPar = EgtCurveParamAtLength( nOffsetId, dLen) + local ptOrig = EgtUP( nOffsetId, dPar) + + -- ricostruisco il frame in base alla nuova origine + local vtDir = EgtUV( nOffsetId, dPar, -1) + if sSide == 'FT1' or sSide == 'FA1' then + frHdw = Frame3d( ptOrig, - vtDir, vtDir ^ Z_AX(), Z_AX()) + elseif sSide == 'FT2' or sSide == 'FA2' then + local vtDirIn = Vector3d( vtDir) + vtDirIn:rotate( Z_AX(), 90) + local dFrameGapDeltaZ = EgtGetInfo( nProfileId, WIN_GAPDELTAZ, 'd') + frHdw = Frame3d( ptOrig - dFrameGapDeltaZ * Z_AX(), - vtDir, vtDir ^ vtDirIn, vtDirIn) + elseif sSide == 'FT3' or sSide == 'FA3' then + local b3FrameProfile = GetProfileLocalBox( nProfileId) + local dGapDeltaZ2 = b3FrameProfile:getDimY() + frHdw = Frame3d( ptOrig - dGapDeltaZ2 * Z_AX(), - vtDir, vtDir ^ -Z_AX(), -Z_AX()) + end + + -- calcolo il centro della lavorazione riferito al nuovo frame + ptCenter = Point3d( 0, dPosY, dPosZ) + + EgtErase( nOffsetId) + end + + local vMacro = EgtSplitString( sMacro, '_') + if vMacro[1] == 'FRESATA' then + elseif vMacro[1] == 'ASOLA' or vMacro[1] == 'MANIGLIA' then + + local dLength, dWidth, dHeight + if vMacro[1] == 'ASOLA' then + dLength = tonumber( vMacro[2]) + dWidth = tonumber( vMacro[3]) + dHeight = tonumber( vMacro[4]) + -- NB in alcune macro ASOLA il secondo parametro non è la width ma la width/2 ! + -- TODO Al momento sembra che questo avvenga solo quando il suo valore è 8. Da verificare + if abs( dWidth - 8) < GEO.EPS_SMALL then + dWidth = dWidth * 2 + end + elseif vMacro[1] == 'MANIGLIA' and vMacro[2] == '160' then + -- macro speciale che corrisponde ad ASOLA_216_12_56 quindi forzo direttamente i valori + -- TODO gestione di queste macro non parlanti + dLength = 216 + dWidth = 12 + dHeight = 56 + elseif vMacro[1] == 'MANIGLIA' then -- and vMacro[2] == '15' + -- corrisponde ad ASOLA_69_12_30 + dLength = 69 + dWidth = 12 + dHeight = 30 + end + local ptP1 = ptCenter + ( dLength / 2 - dWidth / 2) * X_AX() + dWidth / 2 * Y_AX() + local ptP2 = ptCenter - ( dLength / 2 - dWidth / 2) * X_AX() + dWidth / 2 * Y_AX() + local nPocketOutlineId = EgtCurveCompoFromPoints( nProcLayerId, { ptP1, ptP2}) + EgtAddCurveCompoArcTg( nPocketOutlineId, ptCenter - ( dLength / 2 - dWidth / 2) * X_AX() - dWidth / 2 * Y_AX()) + EgtAddCurveCompoArcTg( nPocketOutlineId, ptCenter + ( dLength / 2 - dWidth / 2) * X_AX() - dWidth / 2 * Y_AX(), false) + EgtCloseCurveCompo( nPocketOutlineId) + EgtSetColor( nPocketOutlineId, EgtStdColor( 'GRAY')) + -- setto info di lavorazione + EgtSetInfo( nPocketOutlineId, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.PROFILING) + EgtSetInfo( nPocketOutlineId, WIN_PRC_PROFILE_INFO, WIN_PRC_PROFILE_TYPE.GENERIC) + EgtSetInfo( nPocketOutlineId, WIN_PRC_SIDE, WIN_PRC_SIDETYPE.IN) + EgtModifyCurveExtrusion( nPocketOutlineId, Z_AX()) + EgtModifyCurveThickness( nPocketOutlineId, - dHeight) + -- porto la lavorazione in globale + EgtTransform( nPocketOutlineId, frHdw) + -- aggiornamento del solido + if s_bCalcSolid then + UpdateSolidWithProcessingSurf( nPocketOutlineId, nMainExtrusionId, nSolidLayerId) + end + + elseif vMacro[1] == 'TASCA' then + elseif vMacro[1] == 'VITE' then + local dRadius = 1.5 + local dDepth = 2 + if vMacro[2] == 'CANALINO' then + dRadius = 2 + dDepth = 3 + elseif vMacro[2] == 'ANTA' then + dRadius = 2.5 + dDepth = 4 + end + local nHoleId = EgtCircle( nProcLayerId, ptCenter, dRadius) + EgtMove( nHoleId, Z_AX()) + EgtModifyCurveExtrusion( nHoleId, Z_AX()) + EgtModifyCurveThickness( nHoleId, - ( dDepth + 1)) + EgtTransform( nHoleId, frHdw) + EgtSetInfo( nHoleId, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.HOLE) + + elseif vMacro[1] == 'FORO' then + local sDiameter = EgtReplaceString( vMacro[2], 'D', '') + local dRadius = tonumber( sDiameter) / 2 + local nHoleId = EgtCircle( nProcLayerId, ptCenter, dRadius) + -- setto info di lavorazione + EgtModifyCurveExtrusion( nHoleId, Z_AX()) + -- TODO : come gestire profondità non definita? + local dDepth = tonumber(25) + if #vMacro == 3 then + dDepth = tonumber( vMacro[3]) + end + EgtModifyCurveThickness( nHoleId, - dDepth) + EgtSetColor( nHoleId, EgtStdColor( 'GRAY')) + EgtSetInfo( nHoleId, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.HOLE) + -- porto la lavorazione in globale + EgtTransform( nHoleId, frHdw) + -- aggiornamento del solido + if s_bCalcSolid then + UpdateSolidWithProcessingSurf( nHoleId, nMainExtrusionId, nSolidLayerId) + end + end + end + + -- Chiudo file OutputLav in lettura + fhOutputLav:close() + + if s_bCalcHardwareKit then + + local OutputKit = {} + -- Apro file OutputKit in lettura + local fhOutputKit = io.open( sOutputKitFile, 'r') + if not fhOutputKit then + EgtOutLog( 'Error opening file ' .. sOutputKitFile) + return false + end + local nKitLineIndex = 1 + for sLine in fhOutputKit:lines('l') do + local KitParams = EgtSplitString( sLine, ';') + OutputKit[nKitLineIndex] = KitParams + nKitLineIndex = nKitLineIndex + 1 + end + table.insert( OutputKitList, OutputKit) + -- Chiudo file OutputKit in lettura + fhOutputKit:close() + end + if s_bCalcHardwarePosition then + + local OutputPosition = {} + -- Apro file OutputPosition in lettura + local fhOutputPosition = io.open( sOutputPositionFile, 'r') + if not fhOutputPosition then + EgtOutLog( 'Error opening file ' .. sOutputPositionFile) + return false + end + local nPositionLineIndex = 1 + for sLine in fhOutputPosition:lines('l') do + local PositionParams = EgtSplitString( sLine, ';') + OutputPosition[nPositionLineIndex] = PositionParams + nPositionLineIndex = nPositionLineIndex + 1 + end + table.insert( OutputPositionList, OutputPosition) + -- Chiudo file OutputPosition in lettura + fhOutputPosition:close() + end + + -- disegno la ferramenta + if s_bCalcSolid then + -- recupero o creo il gruppo per disegno ferramenta + local nAuxLayerId = GetAuxLayer() + for i = 1, #SashList do + DrawSashHardware( SashList[i].nAreaId, nFrameId, nAuxLayerId) + end + end + +end + +--------------------------------------------------------------------- +-- funzione che crea stringa per richiesta hardware AGB +function WinCalculate.GetAGBSashDescription( nFrameId) + -- cerco ed indicizzo ante del serramento + local SashList = {} + SearchSash( nFrameId, SashList) + + -- ordino per X e Y + local function compareXY(a,b) + if abs( a.ptCenter:getX() - b.ptCenter:getX()) < GEO.EPS_SMALL then + return a.ptCenter:getY() < b.ptCenter:getY() + else + return a.ptCenter:getX() < b.ptCenter:getX() + end + end + table.sort( SashList, compareXY) + + -- correggo nomi Frame del telaio in base all'ordinamento delle ante + for nIndex = 1, #SashList do + for nFrameIndex = 1, #SashList[nIndex].Frame do + local nFrameId = SashList[nIndex].Frame[nFrameIndex] + local sName = EgtGetName( nFrameId) + EgtSetName( nFrameId, nIndex .. '.' .. sName) + end + end + + -- recupero preferito della ferramenta + --local nFavourite = EgtGetInfo( nFrameId, WIN_HDW_FAVOURITE) + --if bOnlyRequest then + nFavourite = WDG.HDWFAVOURITE + --end + if not nFavourite or nFavourite == WIN_HDW_NULL then + EgtOutLog('Warning! No hardware favourite set!') + return + end + local sHandle = EgtGetInfo( nFrameId, WIN_HDW_HANDLE) + if bOnlyRequest then + sHandle = WDG.HDWHANDLE + end + if not sHandle then + EgtOutLog('Warning! No hardware handle set!') + return + end + + local sText = 'S_NAME=' .. nFavourite .. '\n' .. + 'RECORDID=15A' .. '\n' + + -- recupero il tipo di apertura + local nOpeningType = WIN_OPENING_TYPES.NULL + if #SashList > 0 then + nOpeningType = EgtGetInfo( SashList[1].nAreaId, WIN_OPENING_TYPE, 'i') + end + -- recupero se scorrevole + local bSlide = EgtGetInfo( nFrameId, WIN_SLIDE_WINDOW, 'b') or false + + if bSlide then + -- le dimensioni per alzante scorrevole sono quelle del telaio + local nOutlineLayId = EgtGetFirstInGroup( nFrameId, WIN_AREAOUTLINE) + local nBottomId = EgtGetFirstNameInGroup( nOutlineLayId, WIN_BOTTOM) + local dMet = EgtCurveLength( nBottomId) + local nLeftId = EgtGetFirstNameInGroup( nOutlineLayId, WIN_LEFT) + local dHet = EgtCurveLength( nLeftId) + sText = sText .. 'MET=' .. tostring( dMet) .. '\n' + sText = sText .. 'HET=' .. tostring( dHet) .. '\n' + + else + if #SashList >= 1 and abs( SashList[1].LHeight - SashList[1].RHeight) < GEO.EPS_SMALL then + sText = sText .. 'HBB=' .. tostring( SashList[1].LHeight) .. '\n' + else + for nSashIndex = 1, #SashList do + if nSashIndex == 1 then + sText = sText .. 'HBB_sx=' .. tostring( SashList[nSashIndex].LHeight) .. '\n' + else + sText = sText .. 'HBB_' .. tostring( nSashIndex - 1) .. 'B=' .. tostring( SashList[nSashIndex].LHeight) .. '\n' + end + if nSashIndex == #SashList then + sText = sText .. 'HBB_dx=' .. tostring( SashList[nSashIndex].RHeight) .. '\n' + else + sText = sText .. 'HBB_' .. tostring( nSashIndex) .. '=' .. tostring( SashList[nSashIndex].RHeight) .. '\n' + end + end + end + + if #SashList == 1 then + sText = sText .. 'LBB=' .. tostring( SashList[1].BWidth) .. '\n' + if SashList[1].BCArrow then + sText = sText .. 'FRECCIA_1=' .. tostring( SashList[1].BCArrow) .. '\n' + end + else + for nSashIndex = 1, #SashList do + sText = sText .. 'LBB' .. nSashIndex .. '=' .. tostring( SashList[nSashIndex].BWidth) .. '\n' + if SashList[nSashIndex].BCArrow then + sText = sText .. 'FRECCIA_' .. nSashIndex .. '=' .. tostring( SashList[nSashIndex].BCArrow) .. '\n' + end + end + end + end + + sText = sText .. 'FINESTRAPORTAFINESTRA=Finestra' .. '\n' .. + 'Q=1' .. '\n' + + -- opzione manoserramento ( non per vasistas altrimenti sovrascrive l'opzione) + if nOpeningType ~= WIN_OPENING_TYPES.TILTONLY_TOP then + sText = sText .. 'MANOSERRAMENTO=' .. sHandle .. '\n' + end + + local vOptions = EgtGetInfo( nFrameId, WIN_HDW_OPTIONS, 'vs') or {} + for i = 1, #vOptions do + sText = sText .. vOptions[i] .. '\n' + end + return sText +end + +--------------------------------------------------------------------- +-- funzione che recupera le opzioni dell'hardware +function WinCalculate.GetHardwareOptions( nAreaId) + local sAGBSashDescription = WinCalculate.GetAGBSashDescription( nAreaId) + -- creo file di richiesta ferramenta + local sNow = os.date( '_%Y_%m_%d_%H_%M_%S', os.time()) + local sInputFile = 'a:\\InputBatch\\Input' .. sNow .. '.txt' + local sInputOptFile = 'a:\\InputBatch\\Input' .. sNow .. '.opt' + -- Apro file Input in scrittura + local fhInput = io.open( sInputFile, 'w') + if not fhInput then + EgtOutLog( 'Error opening file ' .. sInputFile) + return false + end + + local sText = 'S_NAME=' .. nFavourite .. '\n' .. + 'RECORDID=15A' .. '\n' .. + 'only_options=on' .. '\n' .. + sAGBSashDescription .. '\n' .. + 'RUN' + -- Scrittura nuova linea + fhInput:write( sText .. '\n') + + -- Chiudo file + fhInput:close() + + if bOnlyRequest then + return sInputFile + end + + -- attendo scrittura output lavorazioni + local nWait = 0 + while not EgtExistsFile( sInputOptFile) and nWait < 1000 do + nWait = nWait + 1 + EgtPause( 10, true) + end + + EgtPause( 10, true) + + -- Apro file OutputKit in lettura + local fhOutputKit = io.open( sOutputKitFile, "rb") + if not fhOutputKit then + EgtOutLog( 'Error opening file ' .. sOutputKitFile) + return false + end + local content = SouFh:read( "*all") + -- Chiudo file OutputKit in lettura + fhOutputKit:close() + + return content +end + +--------------------------------------------------------------------- +-- funzione che aggiunge l'hardware +function WinCalculate.AddHardware( nAreaId) + OutputKitList = {} + OutputPositionList = {} + WinCalculate.AddHardwareRec( nAreaId) + return OutputKitList, OutputPositionList +end + +function WinCalculate.AddHardwareRec( nAreaId) + -- verifico il tipo + local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') + local nSplitLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_SPLIT) + local nSplitType = WIN_SPLITTYPES.NULL + if nSplitLayerId then + nSplitType = EgtGetInfo( nSplitLayerId, WIN_SPLITTYPE, 'i') + end + if nAreaType == WIN_AREATYPES.SASH or ( nSplitLayerId and nSplitType == WIN_SPLITTYPES.FRENCH) then + -- lancio calcolo sash + return WinCalculate.AddHardwareForSash( nAreaId) + else + -- verifico se ci sono sotto-aree + local nChildAreaId = EgtGetFirstNameInGroup( nAreaId, WIN_AREA .. '*') + while nChildAreaId do + -- lancio verifica di quell'area + WinCalculate.AddHardwareRec( nChildAreaId) + nChildAreaId = EgtGetNextName( nChildAreaId, WIN_AREA .. '*') + end + end +end + +--------------------------------------------------------------------- +-- funzione che disegna l'hardware +local function DrawHardware( nAreaId, nAuxLayerId) + -- verifico il tipo + local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') + -- se anta disegno la ferramenta + if nAreaType == WIN_AREATYPES.SASH then + -- se è stato definito un preferito disegno la ferramenta + local sFavourite = EgtGetInfo( nAreaId, WIN_HDW_FAVOURITE) or WIN_HDW_NULL + if sFavourite ~= WIN_HDW_NULL then + DrawSashHardware( nAreaId, nAreaId, nAuxLayerId) + end + return + + else + -- verifico se contiene un french split + local nSplitLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_SPLIT) + local nSplitType = WIN_SPLITTYPES.NULL + if nSplitLayerId then + nSplitType = EgtGetInfo( nSplitLayerId, WIN_SPLITTYPE, 'i') + end + if nSplitType == WIN_SPLITTYPES.FRENCH then + -- se ha definito un preferito devo disegnare la ferramenta + local sFavourite = EgtGetInfo( nAreaId, WIN_HDW_FAVOURITE) or WIN_HDW_NULL + if sFavourite ~= WIN_HDW_NULL then + -- recupero tutte le sottoaree di tipo anta + local vSashes = {} + local vStack = EgtGetNameInGroup( nAreaId, WIN_AREA .. '*') + local i = 1 + while vStack[i] do + local nType = EgtGetInfo( vStack[i], WIN_AREATYPE, 'i') + if nType == WIN_AREATYPES.SASH then + table.insert( vSashes, vStack[i]) + else + local vChildren = EgtGetNameInGroup( vStack[i], WIN_AREA .. '*') + vStack = EgtJoinTables( vStack, vChildren) + end + end + -- disegno la ferramenta su tutte le ante + for i = 1, #vSashes do + DrawSashHardware( vSashes[i], nAreaId, nAuxLayerId) + end + end + return + + else + -- verifico se ci sono sotto-aree + local nChildAreaId = EgtGetFirstNameInGroup( nAreaId, WIN_AREA .. '*') + while nChildAreaId do + -- lancio verifica di quell'area + DrawHardware( nChildAreaId, nAuxLayerId) + nChildAreaId = EgtGetNextName( nChildAreaId, WIN_AREA .. '*') + end + end + end +end + + + +---------------------------------------------------------------------------------- +----------------------------------- ACCESSORI ---------------------------------- +---------------------------------------------------------------------------------- +-- funzione che indidivua i parametri di trim della curva nCrvId in base al geo delle curve prev e next ( ricavate dalle info di nAuxCrv) +local function GetTrimParamsByPrevAndNext( nCrvId, nAuxCrvId, sGeoRef) + + local nAuxGrp = EgtGetParent( nCrvId) + -- recupero curve prev e next di riferimento + local nPrevCrv = EgtGetInfo( nAuxCrvId, WIN_PREV_OUTLINES, 'i') + local nNextCrv = EgtGetInfo( nAuxCrvId, WIN_NEXT_OUTLINES, 'i') + if not nPrevCrv or not nNextCrv then + -- gestione speciale per soglia dove prev e next non sono settati + local nRefGrp = EgtGetParent( nAuxCrvId) + nPrevCrv = EgtGetLastInGroup( nRefGrp) + nNextCrv = EgtGetNext( nAuxCrvId) + end + + -- recupero le curve del geo di interesse + local nPrevPart = EgtGetInfo( nPrevCrv, WIN_REF_PART, 'i') + local nPrevGeo = EgtGetFirstNameInGroup( nPrevPart, WIN_GEO) + local nPrevRef = EgtGetFirstNameInGroup( nPrevGeo, sGeoRef) + local nPrevCopy = EgtCopyGlob( nPrevRef, nAuxGrp) + EgtExtendCurveStartByLen( nPrevCopy, 1000) + EgtExtendCurveEndByLen( nPrevCopy, 1000) + local nNextPart = EgtGetInfo( nNextCrv, WIN_REF_PART, 'i') + local nNextGeo = EgtGetFirstNameInGroup( nNextPart, WIN_GEO) + local nNextRef = EgtGetFirstNameInGroup( nNextGeo, sGeoRef) + local nNextCopy = EgtCopyGlob( nNextRef, nAuxGrp) + EgtExtendCurveStartByLen( nNextCopy, 1000) + EgtExtendCurveEndByLen( nNextCopy, 1000) + + -- recupero punti di intersezione + local ptS = EgtIP( nCrvId, nPrevCopy, ORIG()) + local dParS = EgtCurveParamAtPoint( nCrvId, ptS) + local ptE = EgtIP( nCrvId, nNextCopy, ORIG()) + local dParE = EgtCurveParamAtPoint( nCrvId, ptE) + + EgtErase( { nPrevCopy, nNextCopy}) + + return dParS, dParE +end + +---------------------------------------------------------------------------------- +-- funzione che calcola e disegna la soglia +local function CalcThreshold( nOutlineId, nAreaId) + -- recupero il profilo della soglia + local nProfileId = GetOutlineProfileId( nOutlineId) + local dLenTot = 0 + + -- disegno + local nAuxGrp = GetAuxLayer() + local nStm = CreateProfileSurf( nOutlineId, nProfileId, WIN_SECTION, 0, nAuxGrp) + if nStm then + EgtSetColor( nStm, Color3d( 128, 128, 128)) + EgtSetName( nStm, WIN_THRESHOLD) + dLenTot = EgtCurveLength( nOutlineId) + end + + -- se slide window ci sono parti extra da estrudere in corrispondenza delle ante fisse + local bSlideWindow = EgtGetInfo( nAreaId, WIN_SLIDE_WINDOW, 'b') or false + if bSlideWindow then + -- 1) soglia extra per parte mobile + local nGuideId = EgtCopyGlob( nOutlineId, nAuxGrp) + local dParS, dParE = GetTrimParamsByPrevAndNext( nGuideId, nOutlineId, WIN_IN) + EgtTrimCurveStartEndAtParam( nGuideId, dParS, dParE) + local vMovableSections = EgtGetNameInGroup( nProfileId, WIN_MOVABLE .. WIN_SECTION) + for i = 1, #vMovableSections do + local nStmExtra = CreateProfileSurfById( nGuideId, nProfileId, vMovableSections[i], 0, nAuxGrp) + EgtSetColor( nStmExtra, Color3d( 128, 128, 128)) + EgtSetName( nStmExtra, WIN_MOVABLE .. WIN_SECTION) + end + dLenTot = dLenTot + #vMovableSections * EgtCurveLength( nGuideId) + EgtErase( nGuideId) + + -- 2) soglia extra per le sottoante fisse + -- recupero i profili extra da estrudere + local vExtraSections = EgtGetNameInGroup( nProfileId, WIN_FIXED .. WIN_SECTION) + if #vExtraSections > 0 then + -- cerco tutte le sottoante fisse + local vChildren = EgtGetInfo( nOutlineId, WIN_SASH_CHILDREN, 'vi') + for i = 1, #vChildren do + local nSashAreaId = EgtGetParent( EgtGetParent( vChildren[i])) + local nSashType = EgtGetInfo( nSashAreaId, WIN_SASHTYPE, 'i') + if nSashType == WIN_SASHTYPES.SLIDE_FIXED then + + local nGuideId = EgtCopyGlob( vChildren[i], nAuxGrp) + EgtExtendCurveStartByLen( nGuideId, 1000) + EgtExtendCurveEndByLen( nGuideId, 1000) + + -- trim della guida con il geo dei pezzi vicini + local nOutlineId = EgtGetInfo( vChildren[i], WIN_COPY, 'i') + local dParS, dParE = GetTrimParamsByPrevAndNext( nGuideId, nOutlineId, WIN_OUT) + EgtTrimCurveStartEndAtParam( nGuideId, dParS, dParE) + + for j = 1, #vExtraSections do + local nStmExtra = CreateProfileSurfById( nGuideId, nProfileId, vExtraSections[j], 0, nAuxGrp) + EgtSetColor( nStmExtra, Color3d( 128, 128, 128)) + EgtSetName( nStmExtra, WIN_FIXED .. WIN_THRESHOLD) + end + + -- aggiorno lunghezza ( TODO da gestire separatamente con i tipi di soglia) + dLenTot = dLenTot + #vExtraSections * EgtCurveLength( nGuideId) + EgtErase( nGuideId) + end + end + end + end + + -- salvo info lunghezza + EgtSetInfo( nAreaId, WIN_THRESHOLD_LEN, dLenTot) +end + +--------------------------------------------------------------------- +-- funzione che calcola e disegna il gocciolatoio +local function CalcWaterdrip( nPartId, nOutlineId, nAreaId, bDraw) + + -- verifico presenza gocciolatoio + local nProfileLayId = EgtGetFirstNameInGroup( nPartId, WIN_PROFILE) + local nProfileId = EgtGetFirstNameInGroup( nProfileLayId, WIN_PRF_MAIN) + local nWaterdripId = EgtGetFirstNameInGroup( nProfileId, WIN_WATERDRIP) + if not nWaterdripId then + return + end + + -- gruppi per i conti + local nGrp = EgtGroup( nPartId) + + -- recupero parametri di intersezione con i pezzi vicini + local dParPrev, dParNext = GetTrimParamsByPrevAndNext( nOutlineId, nOutlineId, WIN_IN) + local vParams = { dParPrev, dParNext} + + -- verifico se outline va spezzato ulteriormente a causa di montanti + local nBottomRail = EgtGetInfo( nOutlineId, WIN_REF_BOTTOMRAIL_PART, 'i') + if not nBottomRail then -- se ha bottomrail gli split non causano interruzioni nel gocciolatoio + local vStack = {nAreaId} + local i = 1 + while vStack[i] do + local nAreaType = EgtGetInfo( vStack[i], WIN_AREATYPE, 'i') + if nAreaType == WIN_AREATYPES.FRAME or nAreaType == WIN_AREATYPES.SPLIT then + local nSplitId = EgtGetFirstNameInGroup( vStack[i], WIN_SPLIT) + if nSplitId then + local nSplitType = EgtGetInfo( nSplitId, WIN_SPLITTYPE, 'i') + if nSplitType ~= WIN_SPLITTYPES.FRENCH then + -- recupero il pezzo associato allo split + local nSplitOutline = EgtGetFirstInGroup( nSplitId) + local nSplitPart = EgtGetInfo( nSplitOutline, WIN_REF_PART, 'i') + -- recupero le intersezioni con la curva di outline + local nSplitGeo = EgtGetFirstNameInGroup( nSplitPart, WIN_GEO) + local nCrv1 = EgtGetFirstNameInGroup( nSplitGeo, WIN_IN) + local nCopy1 = EgtCopyGlob( nCrv1, nGrp) + EgtExtendCurveStartByLen( nCopy1, 200) + EgtExtendCurveEndByLen( nCopy1, 200) + local nCrv2 = EgtGetFirstNameInGroup( nSplitGeo, WIN_OUT) + local nCopy2 = EgtCopyGlob( nCrv2, nGrp) + EgtExtendCurveStartByLen( nCopy2, 200) + EgtExtendCurveEndByLen( nCopy2, 200) + local pt1 = EgtIP( nOutlineId, nCopy1, ORIG()) + local pt2 = EgtIP( nOutlineId, nCopy2, ORIG()) + if pt1 and pt2 then + -- salvo i parametri di intersezione + local dPar1 = EgtCurveParamAtPoint( nOutlineId, pt1, 100 * GEO.EPS_SMALL) + local dPar2 = EgtCurveParamAtPoint( nOutlineId, pt2, 100 * GEO.EPS_SMALL) + table.insert( vParams, dPar1) + table.insert( vParams, dPar2) + end + + -- salvo le sue sottoaree per analizzarle + local vChildren = EgtGetNameInGroup( vStack[i], WIN_AREA .. '*') or {} + vStack = EgtJoinTables( vStack, vChildren) + end + end + end + i = i + 1 + end + end + + -- riordino i parametri ( non dovrebbero mai capitare parametri coincidenti) + table.sort( vParams) + + -- recupero il gruppo per il disegno dei solidi + local nSolidLayId + if bDraw and s_bCalcSolid then + nSolidLayId = GetAuxLayer() + end + + local dLenTot = 0 + for i = 1, #vParams, 2 do + -- creo la guida di estrusione per il gocciolatoio + local nGuideId = EgtCopyGlob( nOutlineId, nGrp) + -- trim della curva + EgtTrimCurveStartEndAtParam( nGuideId, vParams[i], vParams[i+1]) + -- aggiorno la lunghezza + dLenTot = dLenTot + EgtCurveLength( nGuideId) + -- disegno + if bDraw and s_bCalcSolid then + -- estrudo la superficie + local nStm = CreateProfileSurf( nGuideId, nProfileId, WIN_WATERDRIP, 0, nSolidLayId) + EgtSetColor( nStm, Color3d( 128, 128, 128)) + EgtSetName( nStm, WIN_WATERDRIP) + end + end + + -- salvo la lunghezza del gocciolatoio + EgtSetInfo( nAreaId, WIN_WATERDRIP_LEN, dLenTot) + + EgtErase( nGrp) + +end + +--------------------------------------------------------------------- +-- funzione che calcola e disegna le guarnizioni +local function CalcGaskets( nAreaId, bDraw) + + local nOutlineLayId = EgtGetFirstNameInGroup( nAreaId, WIN_OUTLINE) + local vOrigOutlines = EgtGetAllInGroup( nOutlineLayId) + local dLenTot = 0 + + -- recupero dati dei pezzi che serviranno nei conti e i veri outlines da considerare + local tParts = {} + local vOutlines = {} + for i = 1, #vOrigOutlines do + local bThreshold = EgtGetName( vOrigOutlines[i]) == WIN_BOTTOM and EgtGetInfo( vOrigOutlines[i], WIN_THRESHOLD, 'b') + if bThreshold then + -- gestione speciale per soglia che non ha pezzo associato + local nMainProfileId = GetOutlineProfileId( vOrigOutlines[i]) + tParts[i] = { nProfileId = nMainProfileId, frProfile = nil} + vOutlines[i] = vOrigOutlines[i] + else + local nPartId = FindAssociatedPart( vOrigOutlines[i], false) + local nProfileLayId = EgtGetFirstNameInGroup( nPartId, WIN_PROFILE) + local nMainProfileId = EgtGetFirstNameInGroup( nProfileLayId, WIN_PRF_MAIN) + local nFrameId = EgtGetFirstNameInGroup( nMainProfileId, WIN_SECTIONFRAME) + local frProfile = EgtFR( nFrameId, GDB_ID.ROOT) + tParts[i] = { nProfileId = nMainProfileId, frProfile = frProfile} + vOutlines[i] = EgtGetInfo( nPartId, WIN_REF_OUTLINE, 'i') + end + end + + -- gruppo temporaneo per i conti + local nGrp = EgtGroup( nAreaId) + + -- cerco tutte le possibili guarnizioni + for i = 1, 3 do + -- nome della guarnizione corrente + local sGasket = WIN_GASKET .. tostring( i) + local vCrvs = {} + for i = 1, #vOutlines do + local nCrv = EgtCopyGlob( vOutlines[i], nGrp) + table.insert( vCrvs, nCrv) + + -- calcolo offset da applicare alla curva + local dOffs + local vGasketIds = EgtGetNameInGroup( tParts[i].nProfileId, sGasket .. '*') + if #vGasketIds == 1 then + -- se guarnizione recupero offset dalla sua dimensione + local b3Box = EgtGetBBoxRef( vGasketIds[1], GDB_BB.STANDARD, tParts[i].frProfile) + dOffs = b3Box:getMax():getX() + tParts[i].sGasket = sGasket + elseif #vGasketIds > 1 then + -- se ho più guarnizioni devo identificare quella dal lato corretto ( caso di split) + local nCrvRef = EgtIf( i == 1, vOrigOutlines[2], vOrigOutlines[i-1]) + local _, _, nSide = EgtPointCurveDistSide( EgtMP( nCrvRef), nCrv, Z_AX()) + if nSide == 1 then + tParts[i].sGasket = sGasket .. '_1' + local nGasketId = EgtGetFirstNameInGroup( tParts[i].nProfileId, tParts[i].sGasket) + local b3Box = EgtGetBBoxRef( nGasketId, GDB_BB.STANDARD, tParts[i].frProfile) + dOffs = b3Box:getMin():getX() + else + tParts[i].sGasket = sGasket .. '_2' + local nGasketId = EgtGetFirstNameInGroup( tParts[i].nProfileId, tParts[i].sGasket) + local b3Box = EgtGetBBoxRef( nGasketId, GDB_BB.STANDARD, tParts[i].frProfile) + dOffs = b3Box:getMax():getX() + end + else + -- se non ha guarnizione è curva di trim ( quindi deve avere info) + dOffs = EgtGetInfo( tParts[i].nProfileId, WIN_TRIM .. sGasket, 'd') + if not dOffs then + -- se non ha info di trim significa che devo passare alla guarnizione successiva + vCrvs = {} + break + end + dOffs = - dOffs + tParts[i].sGasket = nil + end + + -- offset + EgtOffsetCurve( nCrv, dOffs) + end + + if #vCrvs > 0 then + -- taglio le curve + TrimAndOrientOrderedCurves( vCrvs, true) + + -- aggiorno lunghezza + for i = 1, #vCrvs do + if tParts[i].sGasket then -- devo ignorare le curve di trim + dLenTot = dLenTot + EgtCurveLength( vCrvs[i]) + end + end + + -- disegno + if bDraw and s_bCalcSolid then + -- recupero il gruppo per il disegno dei solidi + local nSolidLayerId = GetAuxLayer() + for i = 1, #vCrvs do + if tParts[i].sGasket then + -- estrusione principale della giunzione + local nGasketStm = CreateProfileSurf( vOutlines[i], tParts[i].nProfileId, tParts[i].sGasket, 100, nSolidLayerId) + EgtSetColor( nGasketStm, Color3d( 128, 128, 128)) + EgtSetName( nGasketStm, sGasket) + + -- trim start + local nPrev = EgtIf( i == 1, #vCrvs, i - 1) + local nGuideId + if not tParts[nPrev].sGasket then + -- se precedente è curva di trim la uso direttamente + nGuideId = EgtCopyGlob( vCrvs[nPrev], nSolidLayerId) + EgtInvertCurve( nGuideId) + else + -- taglio lungo la bisettrice + local vtDir = 0.5 * ( EgtSV( vCrvs[i]) - EgtEV( vCrvs[nPrev])) + if vtDir:isSmall() then + vtDir = EgtSV( vCrvs[i]) + vtDir:rotate( Z_AX(), 90) + end + nGuideId = EgtLinePVL( nSolidLayerId, EgtSP( vCrvs[i]), vtDir, 200) + EgtExtendCurveStartByLen( nGuideId, 100) + end + local nTrimStart = EgtSurfTmByExtrusion( nSolidLayerId, nGuideId, - 200 * Z_AX()) + EgtSurfTmIntersect( nGasketStm, nTrimStart) + EgtErase( { nGuideId, nTrimStart}) + + -- trim end + local nNext = EgtIf( i == #vCrvs, 1, i + 1) + if not tParts[nNext].sGasket then + nGuideId = EgtCopyGlob( vCrvs[nNext], nSolidLayerId) + else + local vtDir = 0.5 * ( EgtSV( vCrvs[nNext]) - EgtEV( vCrvs[i])) + if vtDir:isSmall() then + vtDir = EgtSV( vCrvs[nNext]) + vtDir:rotate( Z_AX(), 90) + end + nGuideId = EgtLinePVL( nSolidLayerId, EgtEP( vCrvs[i]), vtDir, 200) + EgtExtendCurveStartByLen( nGuideId, 100) + end + local nTrimEnd = EgtSurfTmByExtrusion( nSolidLayerId, nGuideId, - 200 * Z_AX()) + EgtInvertSurf( nTrimEnd) + EgtSurfTmIntersect( nGasketStm, nTrimEnd) + EgtErase( { nGuideId, nTrimEnd}) + end + end + end + end + end + + -- aggiorno valore lunghezza + EgtSetInfo( nAreaId, WIN_GASKET_LEN, dLenTot) + + EgtErase( nGrp) +end + +--------------------------------------------------------------------- +function WinCalculate.AddAccessories( nAreaId, bDraw) + + local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') + if nAreaType == WIN_AREATYPES.FRAME then + local nOutlineLayId = EgtGetFirstNameInGroup( nAreaId, WIN_OUTLINE) + + -- accessori del pezzo inferiore: soglia e gocciolatioio + local nBottomId = EgtGetFirstNameInGroup( nOutlineLayId, WIN_BOTTOM) + local bThreshold = EgtGetInfo( nAreaId, WIN_THRESHOLD, 'b') or false + if bThreshold then + -- soglia + CalcThreshold( nBottomId, nAreaId) + else + -- gocciolatoio + local nPartId = EgtGetInfo( nBottomId, WIN_REF_PART, 'i') + CalcWaterdrip( nPartId, nBottomId, nAreaId, bDraw) + end + + -- guarnizioni se definisce un french split o se definisce direttamente anta + local nSplitId = EgtGetFirstNameInGroup( nAreaId, WIN_SPLIT) or GDB_ID.NULL + local nSplitType = EgtGetInfo( nSplitId, WIN_SPLITTYPE, 'i') + if nSplitId == GDB_ID.NULL or nSplitType == WIN_SPLITTYPES.FRENCH then + CalcGaskets( nAreaId, bDraw) + end + -- TODO guarnizioni per gocciolatoio + + elseif nAreaType == WIN_AREATYPES.SASH then + -- guarnizioni anta + CalcGaskets( nAreaId, bDraw) + + elseif nAreaType == WIN_AREATYPES.SPLIT then + -- guarnizioni se è french split che non deriva da un french split + local nSplitId = EgtGetFirstNameInGroup( nAreaId, WIN_SPLIT) + local nSplitType = EgtGetInfo( nSplitId, WIN_SPLITTYPE, 'i') + if nSplitType == WIN_SPLITTYPES.FRENCH then + local nParentArea = EgtGetParent( nAreaId) + local nParentSplit = EgtGetFirstNameInGroup( nParentArea, WIN_SPLIT) or GDB_ID.NULL + local nSplitType = EgtGetInfo( nParentSplit, WIN_SPLITTYPE, 'i') + if nSplitType ~= WIN_SPLITTYPES.FRENCH then + CalcGaskets( nAreaId, bDraw) + end + end + + elseif nAreaType == WIN_AREATYPES.NULL then + -- guarnizioni se non deriva da french split e ha come sottoarea un'anta + local nParentArea = EgtGetParent( nAreaId) + local nParentSplit = EgtGetFirstNameInGroup( nParentArea, WIN_SPLIT) or GDB_ID.NULL + local nSplitType = EgtGetInfo( nParentSplit, WIN_SPLITTYPE, 'i') + if nSplitType == WIN_SPLITTYPES.MULLION then + local nChildArea = EgtGetFirstNameInGroup( nAreaId, WIN_AREA .. '*') or GDB_ID.NULL + local nChildType = EgtGetInfo( nChildArea, WIN_AREATYPE, 'i') + if nChildType == WIN_AREATYPES.SASH then + CalcGaskets( nAreaId, bDraw) + end + end + end + + -- calcolo accessori per sotto-aree + local nChildAreaId = EgtGetFirstNameInGroup( nAreaId, WIN_AREA .. '*') + while nChildAreaId do + WinCalculate.AddAccessories( nChildAreaId, bDraw) + nChildAreaId = EgtGetNextName( nChildAreaId, WIN_AREA .. '*') + end +end + + + +---------------------------------------------------------------------------------- +------------------------------ FUNZIONI ---------------------------------------- +---------------------------------------------------------------------------------- +-- funzione che crea tutti i pezzi della finestra partendo dal telaio +function WinCalculate.CreatePartFromArea( nFrameId) + -- assegno il tipo di profilo alle curve del base outline + CalculateAreaProfileType( nFrameId) + -- calcolo outline a partire dal base outline + CalculateAreaOutline( nFrameId) + -- creo pezzi + s_nSashNbr = 0 -- resetto il numero di ante del progetto + CalculateAreaParts( nFrameId) + -- calcolo le spine + CalculateAreaDowels( nFrameId) + + -- calcolo preview 2d se richiesta + if s_bCalcPreview then + CalcPreview( nFrameId) + end +end + +--------------------------------------------------------------------- +-- funzione che ricalcola i solidi ( per cambio modalità visualizzazione) +function WinCalculate.RecalcSolids( nFrameId) + + -- scorro tutti i pezzi + local nPartId = EgtGetFirstPart() + while nPartId do + -- se solidi non vanno calcolati elimino semplicemente il gruppo dei solidi da ogni pezzo + if not s_bCalcSolid then + local nSolidLayId = EgtGetFirstNameInGroup( nPartId, WIN_SOLID) or GDB_ID.NULL + EgtErase( nSolidLayId) + + -- ricalcolo dei solidi + else + -- se fill, lo uso per ricalcolare strip + local nPartType = EgtGetInfo( nPartId, WIN_PART_TYPE, 'i') + if nPartType == WIN_PART_TYPES.FILL then + local nAreaId = EgtGetInfo( nPartId, WIN_AREA, 'i') + local nParentAreaId = EgtGetParent( nAreaId) + local nParentOutlineLayId = EgtGetFirstNameInGroup( nParentAreaId, WIN_OUTLINE) + local vParentOutlines = EgtGetAllInGroup( nParentOutlineLayId) + for i = 1, #vParentOutlines do + CreateStripFromOutline( nParentAreaId, vParentOutlines[i]) + end + + -- verifico se solido da calcolare + local nSolidLayId = EgtGetFirstNameInGroup( nPartId, WIN_SOLID) + if not nSolidLayId then + local nOutlineLayId = EgtGetFirstNameInGroup( nAreaId, WIN_OUTLINE) + local nGeoLayId = EgtGetFirstNameInGroup( nPartId, WIN_GEO) + CalcFillSolid( nPartId, nOutlineLayId, nGeoLayId) + end + + -- se pezzo, ricalcolo il suo solido + else + -- elimino gruppo dei solidi + local nSolidLayId = EgtGetFirstNameInGroup( nPartId, WIN_SOLID) or GDB_ID.NULL + EgtErase( nSolidLayId) + -- ricalcolo il solido principale + local nOutlineId = EgtGetInfo( nPartId, WIN_REF_OUTLINE, 'i') + local nSolidId = CalcSolid( nPartId, nOutlineId) + -- aggiungo lavorazioni + local nProcLayId = EgtGetFirstNameInGroup( nPartId, WIN_PRC) + local vProc = EgtGetAllInGroup( nProcLayId) + for i = 1, #vProc do + local nType = EgtGetInfo( vProc[i], WIN_PRC_FEATURE_TYPE) + local nProfilingType = EgtGetInfo( vProc[i], WIN_PRC_PROFILE_INFO) + if nType == WIN_PRC_TYPE.HOLE or ( nType == WIN_PRC_TYPE.PROFILING and nProfilingType == WIN_PRC_PROFILE_TYPE.GENERIC) then + UpdateSolidWithProcessingSurf( vProc[i], nSolidId, nProcLayId) + end + end + end + end + + nPartId = EgtGetNextPart( nPartId) + end + + -- accessori e ferramenta + local nAuxGrp = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_AUX) + if not s_bCalcSolid then + EgtErase( nAuxGrp or GDB_ID.NULL) + elseif not nAuxGrp then + nAuxGrp = GetAuxLayer() + -- ferramenta + DrawHardware( nFrameId, nAuxGrp) + -- accessori + WinCalculate.AddAccessories( nFrameId, true) + end + +end + +--------------------------------------------------------------------- +return WinCalculate diff --git a/Designing/WinLib/WinCreate.lua b/Designing/WinLib/WinCreate.lua new file mode 100644 index 0000000..f60feeb --- /dev/null +++ b/Designing/WinLib/WinCreate.lua @@ -0,0 +1,667 @@ +-- +-- 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 +---------------------------------------------------------------------------------- +local function AddInfo( nId, sInfo, nVal) + local vInfo = EgtGetInfo( nId, sInfo, 'vi') or {} + table.insert( vInfo, nVal) + EgtSetInfo( nId, sInfo, vInfo) +end + +---------------------------------------------------------------------------------- +-- funzione che importa il profilo +function WinCreate.ImportProfile( sProfilePath) + -- verifico esistenza file + if not EgtExistsFile( sProfilePath) then + EgtOutLog( 'File del profilo non trovato! ' .. sProfilePath) + EgtOutText( 'File del profilo non trovato! ' .. sProfilePath) + EgtPause(5000) + return false + end + -- creo gruppo per il profilo + local nProfileId = EgtGroup( GDB_ID.ROOT) + EgtSetName( nProfileId, WIN_PROFILE) + EgtSetLevel( nProfileId, GDB_LV.SYSTEM) + -- 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) + return true +end + +---------------------------------------------------------------------------------- +------------------------------------- TELAIO ------------------------------------- +---------------------------------------------------------------------------------- +-- funzione che crea le curve che definiscono il telaio in base alla geometria richiesta +local function CreateFrameCurves( nLayerId, nType, dWidth, dHeight, dVal) + + -- rettangolo + if nType == WIN_FRAME_TYPES.RECT then + -- telaio rettangolare + local nBottomId = EgtLine( nLayerId, ORIG(), Point3d( dWidth, 0, 0)) + EgtSetName( nBottomId, WIN_BOTTOM) + local nRightId = EgtLine( nLayerId, Point3d( dWidth, 0, 0), Point3d( dWidth, dHeight, 0)) + EgtSetName( nRightId, WIN_RIGHT) + local nTopId = EgtLine( nLayerId, Point3d( dWidth, dHeight, 0), Point3d( 0, dHeight, 0)) + EgtSetName( nTopId, WIN_TOP) + local nLeftId = EgtLine( nLayerId, Point3d( 0, dHeight, 0), ORIG()) + EgtSetName( nLeftId, WIN_LEFT) + + -- lato top inclinato + elseif nType == WIN_FRAME_TYPES.CHAMFER_SIDE then + -- dHeight è l'altezza del lato sx, dVal è l'altezza del lato dx + local nBottomId = EgtLine( nLayerId, ORIG(), Point3d( dWidth, 0, 0)) + EgtSetName( nBottomId, WIN_BOTTOM) + local nRightId = EgtLine( nLayerId, Point3d( dWidth, 0, 0), Point3d( dWidth, dVal, 0)) + EgtSetName( nRightId, WIN_RIGHT) + local nTopId = EgtLine( nLayerId, Point3d( dWidth, dVal, 0), Point3d( 0, dHeight, 0)) + EgtSetName( nTopId, WIN_TOP) + local nLeftId = EgtLine( nLayerId, Point3d( 0, dHeight, 0), ORIG()) + EgtSetName( nLeftId, WIN_LEFT) + + -- triangular arch + elseif nType == WIN_FRAME_TYPES.CHAMFER then + -- dHeight è l'altezza dei lati verticali, dVal è l'altezza complessiva della finestra + local nBottomId = EgtLine( nLayerId, ORIG(), Point3d( dWidth, 0, 0)) + EgtSetName( nBottomId, WIN_BOTTOM) + local nRightId = EgtLine( nLayerId, Point3d( dWidth, 0, 0), Point3d( dWidth, dHeight, 0)) + EgtSetName( nRightId, WIN_RIGHT) + local nTop1Id = EgtLine( nLayerId, Point3d( dWidth, dHeight, 0), Point3d( dWidth / 2, dVal, 0)) + local nTop2Id = EgtLine( nLayerId, Point3d( dWidth / 2, dVal, 0), Point3d( 0, dHeight, 0)) + EgtSetName( nTop1Id, WIN_TOP) + EgtSetName( nTop2Id, WIN_TOP) + local nLeftId = EgtLine( nLayerId, Point3d( 0, dHeight, 0), ORIG()) + EgtSetName( nLeftId, WIN_LEFT) + + -- arco a tutto sesto + elseif nType == WIN_FRAME_TYPES.ROUND_ARC then + local nBottomId = EgtLine( nLayerId, ORIG(), Point3d( dWidth, 0, 0)) + EgtSetName( nBottomId, WIN_BOTTOM) + local nRightId = EgtLine( nLayerId, Point3d( dWidth, 0, 0), Point3d( dWidth, dHeight - 0.5 * dWidth, 0)) + EgtSetName( nRightId, WIN_RIGHT) + local nTopId = EgtArcCPA( nLayerId, Point3d( 0.5 * dWidth, dHeight - 0.5 * dWidth, 0), Point3d( dWidth, dHeight - 0.5 * dWidth, 0), 180, 0) + EgtSetName( nTopId, WIN_TOP) + local nLeftId = EgtLine( nLayerId, Point3d( 0, dHeight - 0.5 * dWidth, 0), ORIG()) + EgtSetName( nLeftId, WIN_LEFT) + + -- arco ribassato + elseif nType == WIN_FRAME_TYPES.SEGMENTAL_ARC then + -- dHeight è l'altezza dei lati verticali, dVal è l'altezza complessiva della finestra + local nBottomId = EgtLine( nLayerId, ORIG(), Point3d( dWidth, 0, 0)) + EgtSetName( nBottomId, WIN_BOTTOM) + local nRightId = EgtLine( nLayerId, Point3d( dWidth, 0, 0), Point3d( dWidth, dHeight, 0)) + EgtSetName( nRightId, WIN_RIGHT) + local nTopId = EgtArc3P( nLayerId, Point3d( dWidth, dHeight, 0), Point3d( 0.5 * dWidth, dVal, 0), Point3d( 0, dHeight, 0)) + EgtSetName( nTopId, WIN_TOP) + local nLeftId = EgtLine( nLayerId, Point3d( 0, dHeight, 0), ORIG()) + EgtSetName( nLeftId, WIN_LEFT) + + -- arco a tutto sesto + elseif nType == WIN_FRAME_TYPES.POINTED_ARC then + -- dHeight è l'altezza dei lati verticali, dVal è l'altezza complessiva della finestra + -- verifico che le due altezze abbiano valori sensati per realizzare i due archi + if dVal - dHeight < 0.5 * dWidth then + return + end + local nBottomId = EgtLine( nLayerId, ORIG(), Point3d( dWidth, 0, 0)) + EgtSetName( nBottomId, WIN_BOTTOM) + local nRightId = EgtLine( nLayerId, Point3d( dWidth, 0, 0), Point3d( dWidth, dHeight, 0)) + EgtSetName( nRightId, WIN_RIGHT) + local nTop1Id = EgtArc2PV( nLayerId, Point3d( dWidth, dHeight, 0), Point3d( 0.5 * dWidth, dVal, 0), Y_AX()) + EgtSetName( nTop1Id, WIN_TOP) + local nTop2Id = EgtArc2PV( nLayerId, Point3d( 0, dHeight, 0), Point3d( 0.5 * dWidth, dVal, 0), Y_AX()) + EgtInvertCurve( nTop2Id) + EgtSetName( nTop2Id, WIN_TOP) + local nLeftId = EgtLine( nLayerId, Point3d( 0, dHeight, 0), ORIG()) + EgtSetName( nLeftId, WIN_LEFT) + + -- triangolo + elseif nType == WIN_FRAME_TYPES.TRG then + local nBottomId = EgtLine( nLayerId, ORIG(), Point3d( dWidth, 0, 0)) + EgtSetName( nBottomId, WIN_BOTTOM) + local nEdge1Id = EgtLine( nLayerId, Point3d( dWidth, 0, 0), Point3d( dVal, dHeight, 0)) + local nEdge2Id = EgtLine( nLayerId, Point3d( dVal, dHeight, 0), ORIG()) + -- un lato verticale è right/left, un lato inclinato è top + if dVal < GEO.EPS_SMALL then + EgtSetName( nEdge1Id, WIN_TOP) + EgtSetName( nEdge2Id, WIN_LEFT) + elseif abs( dVal - dWidth) < GEO.EPS_SMALL then + EgtSetName( nEdge1Id, WIN_RIGHT) + EgtSetName( nEdge2Id, WIN_TOP) + else + EgtSetName( nEdge1Id, WIN_TOP) + EgtSetName( nEdge2Id, WIN_TOP) + end + end +end + +---------------------------------------------------------------------------------- +-- funzione che crea il telaio a partire da una specifica geometria ( rettangolo, chamfer...) +function WinCreate.CreateFrame( nType, vJoints, dWidth, dHeight, dHeight2) + + -- creo gruppo per telaio + local nAreaId = EgtGroup( GDB_ID.ROOT) + EgtSetName( nAreaId, WIN_AREA .. '(' .. WIN_FRAME .. ')') + EgtSetLevel( nAreaId, GDB_LV.SYSTEM) + -- imposto il tipo + EgtSetInfo( nAreaId, WIN_AREATYPE, WIN_AREATYPES.FRAME) + + -- costruisco le curve di outline + local nOutlineLayerId = EgtGroup( nAreaId) + EgtSetName( nOutlineLayerId, WIN_AREAOUTLINE) + CreateFrameCurves( nOutlineLayerId, nType, dWidth, dHeight, dHeight2) + EgtSetInfo( nAreaId, WIN_FRAME_TYPE, nType) + -- imposto tipo giunzioni + EgtSetInfo( nOutlineLayerId, WIN_JOINTS, vJoints) + + return nAreaId +end + +---------------------------------------------------------------------------------- +-------------------------------------- ANTA -------------------------------------- +---------------------------------------------------------------------------------- +-- funzione che aggiunge una anta +function WinCreate.AddSash( nAreaId, vJoints, nSashType, nOpeningType) + -- 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) + EgtRemoveInfo( nOutlineId, WIN_CHILD) + AddInfo( nAreaOutlineId, WIN_CHILD, nOutlineId) + nAreaOutlineId = EgtGetNext( nAreaOutlineId) + end + -- imposto tipo giunzioni + EgtSetInfo( nAreaOutlineLayerId, WIN_JOINTS, vJoints) + -- imposto tipo di anta e di apertura se presente + if nSashType then + EgtSetInfo( nSashAreaId, WIN_SASHTYPE, nSashType) + end + if nOpeningType then + EgtSetInfo( nSashAreaId, WIN_OPENING_TYPE, nOpeningType) + end + return nSashAreaId +end + +---------------------------------------------------------------------------------- +-------------------------------------- FILL -------------------------------------- +---------------------------------------------------------------------------------- +-- 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) + EgtRemoveInfo( nOutlineId, WIN_CHILD) + AddInfo( nAreaOutlineId, WIN_CHILD, nOutlineId) + nAreaOutlineId = EgtGetNext( nAreaOutlineId) + end + -- rimuovo eventuali info di giunzioni + EgtRemoveInfo( nAreaOutlineLayerId, WIN_JOINTS) + + -- imposto tipo di fill + EgtSetInfo( nFillAreaId, WIN_FILLTYPE, FillType) + return nFillAreaId +end + +---------------------------------------------------------------------------------- +------------------------------------- SPLIT -------------------------------------- +---------------------------------------------------------------------------------- +-- funzione che crea un taglio split +function WinCreate.AddSplit( nAreaLayerId, SplitType, MeasureType, nPosition, nProportion, nSplitType) + -- creo layer temporaneo per split + local nTempSplitLayerId = EgtGroup( nAreaLayerId) + -- recupero contorno area precedente + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaLayerId, WIN_AREAOUTLINE) + local b3OutlineLayer = EgtGetBBox( nOutlineLayerId, GDB_BB.STANDARD) + 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 + elseif MeasureType == WIN_MEASURE.PERCENTAGE then + nCalcPosition = b3OutlineLayer:getDimX() * 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 + elseif MeasureType == WIN_MEASURE.PERCENTAGE then + nCalcPosition = b3OutlineLayer:getDimY() * nPosition + end + if nCalcPosition > b3OutlineLayer:getDimY() - GEO.EPS_SMALL then + EgtErase( nTempSplitLayerId) + return + 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, nSplitType) + local AreaList = {} + if MeasureType == WIN_MEASURE.ABSOLUT then + local nResArea1 + local nResArea2 = nAreaLayerId + for nIndex = 1, #PositionList do + if nIndex > 1 then + EgtSetInfo( nResArea2, WIN_PRJ_ORIGSPLIT, nAreaLayerId) + end + nResArea1, nResArea2 = WinCreate.AddSplit( nResArea2, SplitType, MeasureType, PositionList[nIndex], nProportion, nSplitType) + if not nResArea2 then + return + end + table.insert( AreaList, nResArea1) + if nIndex == #PositionList then + table.insert( AreaList, nResArea2) + end + end + elseif MeasureType == WIN_MEASURE.PROPORTIONAL then + local nResArea1 + local nResArea2 = nAreaLayerId + local dAddPosition = 0 + for nIndex = 1, #PositionList do + if nIndex > 1 then + EgtSetInfo( nResArea2, WIN_PRJ_ORIGSPLIT, nAreaLayerId) + end + nResArea1, nResArea2 = WinCreate.AddSplit( nResArea2, SplitType, MeasureType, PositionList[nIndex], nProportion - dAddPosition, nSplitType) + if not nResArea2 then + return + end + table.insert( AreaList, nResArea1) + if nIndex == #PositionList then + table.insert( AreaList, nResArea2) + end + dAddPosition = dAddPosition + PositionList[nIndex] + end + elseif MeasureType == WIN_MEASURE.PERCENTAGE then + local nResArea1 + local nResArea2 = nAreaLayerId + local dAddPosition = 0 + local sChildAreas = '' + for nIndex = 1, #PositionList do + if nIndex > 1 then + EgtSetInfo( nResArea2, WIN_PRJ_ORIGSPLIT, nAreaLayerId) + sChildAreas = sChildAreas .. nResArea2 .. EgtIf( nIndex < #PositionList, ',', '') + end + nResArea1, nResArea2 = WinCreate.AddSplit( nResArea2, SplitType, MeasureType, EgtIf( nIndex == 1, PositionList[nIndex], PositionList[nIndex] / ( 1 - dAddPosition)), nProportion, nSplitType) + if not nResArea2 then + return + end + table.insert( AreaList, nResArea1) + if nIndex == #PositionList then + table.insert( AreaList, nResArea2) + end + dAddPosition = dAddPosition + PositionList[nIndex] + end + EgtSetInfo( nAreaLayerId, 'ChildSplit', sChildAreas) + end + return AreaList +end + +---------------------------------------------------------------------------------- +-- funzione che crea tagli split grid +function WinCreate.AddGridSplits( nAreaLayerId, MeasureType, PositionListVert, PositionListHoriz, bStartVertical, nSplitType) + local AreaResult = {} + if bStartVertical then + local nProportionVert = 0 + if MeasureType == WIN_MEASURE.PROPORTIONAL then + for i = 1, # PositionListVert do + nProportionVert = nProportionVert + PositionListVert[i] + end + end + local AreaList = WinCreate.AddSplits( nAreaLayerId, WIN_SPLITORIENTATION.VERTICAL, MeasureType, PositionListVert, nProportionVert, nSplitType) + -- recupero contorno area precedente + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaLayerId, WIN_AREAOUTLINE) + local b3OutlineLayer = EgtGetBBox( nOutlineLayerId, GDB_BB.STANDARD) + local HorizAbs = {} + local dPositionCum = 0 + local nProportionHoriz = 0 + if MeasureType == WIN_MEASURE.PROPORTIONAL then + for i = 1, # PositionListHoriz do + nProportionHoriz = nProportionHoriz + PositionListHoriz[i] + end + end + for i = 1, #PositionListHoriz do + if MeasureType == WIN_MEASURE.ABSOLUT then + HorizAbs[i] = PositionListHoriz[i] + elseif MeasureType == WIN_MEASURE.PROPORTIONAL then + HorizAbs[i] = b3OutlineLayer:getDimY() / ( nProportion - dPositionCum) * PositionListHoriz[i] + dPositionCum = dPositionCum + PositionListHoriz[i] + elseif MeasureType == WIN_MEASURE.PERCENTAGE then + -- PositionCum = dPositionCum + PositionListHoriz[i] + -- HorizAbs[i] = b3OutlineLayer:getDimY() * dPositionCum + HorizAbs[i] = b3OutlineLayer:getDimY() * PositionListHoriz[i] + end + end + for i = 1, #AreaList do + local AreaTemp = WinCreate.AddSplits( AreaList[i], WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, HorizAbs, nProportion, nSplitType) or {} + for j = 1, #AreaTemp do + table.insert( AreaResult, AreaTemp[j]) + end + end + else + local AreaList = WinCreate.AddSplits( nAreaLayerId, WIN_SPLITORIENTATION.HORIZONTAL, MeasureType, PositionListHoriz, nProportion, nSplitType) + for i = 1, #AreaList do + local AreaTemp = WinCreate.AddSplits( AreaList[i], WIN_SPLITORIENTATION.VERTICAL, MeasureType, PositionListVert, nProportion, nSplitType) or {} + for j = 1, #AreaTemp do + table.insert( AreaResult, AreaTemp[j]) + end + end + end + return AreaResult +end + +---------------------------------------------------------------------------------- +-- funzione che assegna il nome alla curva di split nella sottoarea in base alla sua direzione +local function SetSplitName( nSplitId) + + local vtMedia = ( ( EgtEV( nSplitId) - EgtSV( nSplitId)) / 2) + if not vtMedia:normalize() then + vtMedia = EgtSV( nSplitId) + end + if abs( vtMedia:getX()) > abs( vtMedia:getY()) then + if vtMedia:getX() > 0 then + EgtSetName( nSplitId, WIN_BOTTOM) + else + EgtSetName( nSplitId, WIN_TOP) + end + else + if vtMedia:getY() > 0 then + EgtSetName( nSplitId, WIN_RIGHT) + else + EgtSetName( nSplitId, WIN_LEFT) + end + end +end + +---------------------------------------------------------------------------------- +-- funzione che crea le aree da un taglio split +local function CreateAreaFromSplit( nAreaLayerId, nCompo, nSplitId, dPar1, dPar2, vOutlineCrvs) + + -- creo layer per le due sottoaree + local nArea1Id = EgtGroup( nAreaLayerId) + EgtSetName( nArea1Id , WIN_AREA .. '1') + EgtSetInfo( nArea1Id, WIN_AREATYPE, WIN_AREATYPES.NULL) + local nArea1OutlineLayerId = EgtGroup( nArea1Id) + EgtSetName( nArea1OutlineLayerId , WIN_AREAOUTLINE) + local nArea2Id = EgtGroup( nAreaLayerId) + EgtSetName( nArea2Id , WIN_AREA .. '2') + EgtSetInfo( nArea2Id, WIN_AREATYPE, WIN_AREATYPES.NULL) + local nArea2OutlineLayerId = EgtGroup( nArea2Id) + EgtSetName( nArea2OutlineLayerId , WIN_AREAOUTLINE) + + -- ad ogni sottoarea associo la porzione di curva composita corrispondente + local nCrv1 = EgtCopyGlob( nCompo, nArea1OutlineLayerId) + local nCrv2 = EgtCopyGlob( nCompo, nArea2OutlineLayerId) + EgtTrimCurveStartEndAtParam( nCrv1, dPar2, dPar1) + EgtTrimCurveStartEndAtParam( nCrv2, dPar1, dPar2) + + -- copio curva di split + local nSplitId1 = EgtCopyGlob( nSplitId, nArea1OutlineLayerId) + local nSplitId2 = EgtCopyGlob( nSplitId, nArea2OutlineLayerId) + -- verifico se necessaria inversione + if AreSamePointApprox( EgtSP( nSplitId1), EgtSP( nCrv1)) then + EgtInvertCurve( nSplitId1) + end + if AreSamePointApprox( EgtSP( nSplitId2), EgtSP( nCrv2)) then + EgtInvertCurve( nSplitId2) + end + -- assegno il nome in base alla direzione + SetSplitName( nSplitId1) + SetSplitName( nSplitId2) + -- assengo le info di source e child + EgtSetInfo( nSplitId, WIN_CHILD, { nSplitId1, nSplitId2}) + EgtSetInfo( nSplitId1, WIN_SOU, nSplitId) + EgtSetInfo( nSplitId2, WIN_SOU, nSplitId) + + -- spezzo le curve composite per riottenere le curve originarie di partenza + local nFirst1, nCnt1 = EgtExplodeCurveCompo( nCrv1) + local nFirst2, nCnt2 = EgtExplodeCurveCompo( nCrv2) + -- assegno nome e info + local vCrvs = EgtTableFill( nFirst1, nCnt1) + EgtTableAdd( vCrvs, nFirst2, nCnt2) + for i = 1, #vCrvs do + -- ricavo la curva di outline originale da cui deriva + local ptM = EgtMP( vCrvs[i]) + for j = 1, #vOutlineCrvs do + if EgtCurveParamAtPoint( vOutlineCrvs[j], ptM, 100 * GEO.EPS_SMALL) then + -- ne prendo il nome + EgtSetName( vCrvs[i], EgtGetName( vOutlineCrvs[j])) + -- assegno le info di child e source + EgtSetInfo( vCrvs[i], WIN_SOU, vOutlineCrvs[j]) + AddInfo( vOutlineCrvs[j], WIN_CHILD, vCrvs[i]) + break + end + end + end + + -- scorro pezzi del primo e secondo outline per avere bottom come primo + local nFirstInAreaId = EgtGetFirstInGroup( nArea1OutlineLayerId) + local sFirstInAreaName = EgtGetName( nFirstInAreaId) + while sFirstInAreaName ~= WIN_BOTTOM do + EgtRelocate( nFirstInAreaId, nArea1OutlineLayerId) + nFirstInAreaId = EgtGetFirstInGroup( nArea1OutlineLayerId) + sFirstInAreaName = EgtGetName( nFirstInAreaId) + end + nFirstInAreaId = EgtGetFirstInGroup( nArea2OutlineLayerId) + sFirstInAreaName = EgtGetName( nFirstInAreaId) + while sFirstInAreaName ~= WIN_BOTTOM do + EgtRelocate( nFirstInAreaId, nArea2OutlineLayerId) + nFirstInAreaId = EgtGetFirstInGroup( nArea2OutlineLayerId) + sFirstInAreaName = EgtGetName( nFirstInAreaId) + end + + return nArea1Id, nArea2Id +end + +---------------------------------------------------------------------------------- +-- funzione che crea un taglio split da una curva generica +function WinCreate.AddGenSplit( nAreaLayerId, nSplitId, nSplitType) + -- se area nulla diventa di tipo split + local nAreaType = EgtGetInfo( nAreaLayerId, WIN_AREATYPE, 'i') + if nAreaType == WIN_AREATYPES.NULL then + EgtSetInfo( nAreaLayerId, WIN_AREATYPE, WIN_AREATYPES.SPLIT) + end + -- creo layer per split + local nSplitLayerId = EgtGroup( nAreaLayerId) + EgtSetName( nSplitLayerId, WIN_BASESPLIT) + -- sposto curva split nel layer + EgtRelocateGlob( nSplitId, nSplitLayerId) + -- assegno nome profilo + EgtSetName( nSplitId, WIN_SPLIT) + + -- verifico se devo impostare tipo di split ( solo se deriva da tipo frame) + if nSplitType then + local nParentAreaId = nAreaLayerId + local nParentAreaType = nAreaType + -- recupero parent fino a trovare frame o sash + while nParentAreaType ~= WIN_AREATYPES.FRAME and nParentAreaType ~= WIN_AREATYPES.SASH do + nParentAreaId = EgtGetParent( nParentAreaId) + nParentAreaType = EgtGetInfo( nParentAreaId, WIN_AREATYPE, 'i') + end + if nParentAreaType == WIN_AREATYPES.FRAME then + -- imposto tipo di split + EgtSetInfo( nSplitLayerId, WIN_SPLITTYPE, nSplitType) + end + end + + -- Ricerca delle intersezioni : + -- creo una curva composita a partire da tutte le curve di outline + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaLayerId, WIN_AREAOUTLINE) + local vOutlineCrvs = EgtGetAllInGroup( nOutlineLayerId) + local nCompo = EgtCurveCompo( nSplitLayerId, vOutlineCrvs, false) + -- allungo curva split per cercare intersezioni + EgtExtendCurveStartByLen( nSplitId, 10) + EgtExtendCurveEndByLen( nSplitId, 10) + -- trovo intersezioni tra composita e lo split + local nFirst, nPntCnt, nCrvCnt = EgtCurveCurveInters( nCompo, nSplitId, nSplitLayerId) + if nCrvCnt ~= 0 or nPntCnt ~= 2 then + -- errore + return + end + -- recupero i due punti di intersezione + local pt1 = EgtSP( nFirst) + local pt2 = EgtSP( nFirst + 1) + EgtErase( { nFirst, nFirst + 1}) + + -- recupero i parametri di intersezione sulla curva di split + local dSplitParS = EgtCurveParamAtPoint( nSplitId, pt1, 100 * GEO.EPS_SMALL) + local dSplitParE = EgtCurveParamAtPoint( nSplitId, pt2, 100 * GEO.EPS_SMALL) + -- recupero i parametri di intersezione sulla curva composita + local dPar1 = EgtCurveParamAtPoint( nCompo, pt1, 100 * GEO.EPS_SMALL) + local dPar2 = EgtCurveParamAtPoint( nCompo, pt2, 100 * GEO.EPS_SMALL) + + -- ricavo i parametri di intersezione legati a start ed end dello split + local dParCrvS = dPar1 + local dParCrvE = dPar2 + if dSplitParS > dSplitParE then + dSplitParS, dSplitParE = dSplitParE, dSplitParS + dParCrvS, dParCrvE = dParCrvE, dParCrvS + end + + -- taglio la curva di split nei punti di intersezione + EgtTrimCurveStartEndAtParam( nSplitId, dSplitParS, dSplitParE) + + -- setto info per intersezione start + -- se il parametro è intero allora l'intersezione coinvolge due curve successive + if abs( dParCrvS - ceil( dParCrvS)) < GEO.EPS_SMALL then + local nCrv = vOutlineCrvs[ ceil( dParCrvS) + 1] + local nOther = EgtGetPrev( nCrv) or EgtGetLastInGroup( nOutlineLayerId) + EgtSetInfo( nSplitId, WIN_SPLIT_STARTINTERS, { nOther, nCrv}) + elseif abs( dParCrvS - floor( dParCrvS)) < GEO.EPS_SMALL then + local nCrv = vOutlineCrvs[ floor( dParCrvS) + 1] + local nOther = EgtGetPrev( nCrv) or EgtGetLastInGroup( nOutlineLayerId) + EgtSetInfo( nSplitId, WIN_SPLIT_STARTINTERS, { nOther, nCrv}) + else + -- se il parametro non è intero allora l'intersezione coinvolge una sola curva + local nCrv = vOutlineCrvs[ floor( dParCrvS) + 1] + EgtSetInfo( nSplitId, WIN_SPLIT_STARTINTERS, { nCrv}) + end + + -- setto info per intersezione end + if abs( dParCrvE - ceil( dParCrvE)) < GEO.EPS_SMALL then + local nCrv = vOutlineCrvs[ ceil( dParCrvE) + 1] + local nOther = EgtGetPrev( nCrv) or EgtGetLastInGroup( nOutlineLayerId) + EgtSetInfo( nSplitId, WIN_SPLIT_ENDINTERS, { nOther, nCrv}) + elseif abs( dParCrvE - floor( dParCrvE)) < GEO.EPS_SMALL then + local nCrv = vOutlineCrvs[ floor( dParCrvE) + 1] + local nOther = EgtGetPrev( nCrv) or EgtGetLastInGroup( nOutlineLayerId) + EgtSetInfo( nSplitId, WIN_SPLIT_ENDINTERS, { nOther, nCrv}) + else + local nCrv = vOutlineCrvs[ floor( dParCrvE) + 1] + EgtSetInfo( nSplitId, WIN_SPLIT_ENDINTERS, { nCrv}) + end + + -- creo sottoaree + local nArea1, nArea2 = CreateAreaFromSplit( nAreaLayerId, nCompo, nSplitId, dPar1, dPar2, vOutlineCrvs) + + EgtErase( nCompo) + + return nArea1, nArea2 + +end + +---------------------------------------------------------------------------------- +-- funzione che crea tagli split da curve generiche +function WinCreate.AddGenSplits( nAreaLayerId, SplitList) + for nIndex = 1, #SplitList do + WinCreate.AddSplit( nAreaLayerId, SplitList[nIndex]) + end +end + +---------------------------------------------------------------------------------- +---------------------------------- BOTTOMRAIL ------------------------------------ +---------------------------------------------------------------------------------- +-- funzione che aggiunge uno zoccolo +function WinCreate.AddBottomRail( nAreaId, nNbr) + local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') + if nAreaType == WIN_AREATYPES.FRAME or nAreaType == WIN_AREATYPES.SASH then + EgtSetInfo( nAreaId, WIN_BOTTOMRAIL, nNbr) + end +end + +---------------------------------------------------------------------------------- +---------------------------------- SOGLIA ------------------------------------ +---------------------------------------------------------------------------------- +-- funzione che aggiunge la soglia +function WinCreate.AddThreshold( nAreaId, sThresholdProfile) + local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') + if nAreaType == WIN_AREATYPES.FRAME then + EgtSetInfo( nAreaId, WIN_THRESHOLD_PROFILE, sThresholdProfile) + end +end + +---------------------------------------------------------------------------------- +---------------------------------- FERRAMENTA ------------------------------------ +---------------------------------------------------------------------------------- +function WinCreate.AddHardware( nFrameId, sFavourite, sHandle) + EgtSetInfo( nFrameId, WIN_HDW_FAVOURITE, sFavourite) + EgtSetInfo( nFrameId, WIN_HDW_HANDLE, sHandle) +end + +--------------------------------------------------------------------- +return WinCreate diff --git a/Designing/WinLib/WinManageProject.lua b/Designing/WinLib/WinManageProject.lua new file mode 100644 index 0000000..5a83ad9 --- /dev/null +++ b/Designing/WinLib/WinManageProject.lua @@ -0,0 +1,325 @@ +-- +-- 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') + +--------------------------------------------------------------------- +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 + +--------------------------------------------------------------------- +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 + +--------------------------------------------------------------------- +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}, 'Dx' + elseif vOpeningTypes[2] == WIN_OPENING_TYPES.FIXED then + return { WIN_SASHTYPES.SLIDE_MOVABLE, WIN_SASHTYPES.SLIDE_FIXED}, 'Sx' + else + -- TODO individuare parametro per disinguerle + return { WIN_SASHTYPES.SLIDE_MOVABLE, WIN_SASHTYPES.SLIDE_MOVABLE_BACK}, 'Sx' + 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}, 'Sx' + elseif vOpeningTypes[2] == WIN_OPENING_TYPES.FIXED then + return { WIN_SASHTYPES.SLIDE_MOVABLE, WIN_SASHTYPES.SLIDE_FIXED, WIN_SASHTYPES.SLIDE_MOVABLE}, 'Sx' + else + return { WIN_SASHTYPES.SLIDE_MOVABLE_BACK, WIN_SASHTYPES.SLIDE_MOVABLE, WIN_SASHTYPES.SLIDE_MOVABLE, WIN_SASHTYPES.SLIDE_MOVABLE_BACK}, 'Sx' + end + end + end + + -- casi standard + if #tSashes == 2 then + if tSashes[1][JWD_HAS_HANDLE] then + return { WIN_SASHTYPES.ACTIVE, WIN_SASHTYPES.INACTIVE}, 'Sx' + else + return { WIN_SASHTYPES.INACTIVE, WIN_SASHTYPES.ACTIVE}, 'Dx' + end + + elseif #tSashes == 3 then + if tSashes[1][JWD_HAS_HANDLE] then + return { WIN_SASHTYPES.ACTIVE, WIN_SASHTYPES.INACTIVE_IN, WIN_SASHTYPES.INACTIVE_OUT}, 'Sx' + 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}, 'Sx' + else + return { WIN_SASHTYPES.INACTIVE, WIN_SASHTYPES.ACTIVE_IN, WIN_SASHTYPES.ACTIVE_OUT}, 'Dx' + end + else + return { WIN_SASHTYPES.INACTIVE_OUT, WIN_SASHTYPES.INACTIVE_IN, WIN_SASHTYPES.ACTIVE}, 'Dx' + end + + else + if tSashes[2][JWD_HAS_HANDLE] then + return { WIN_SASHTYPES.ACTIVE_OUT, WIN_SASHTYPES.ACTIVE_IN, WIN_SASHTYPES.INACTIVE_IN, WIN_SASHTYPES.INACTIVE_OUT}, 'Sx' + else + return { WIN_SASHTYPES.INACTIVE_OUT, WIN_SASHTYPES.INACTIVE_IN, WIN_SASHTYPES.ACTIVE_IN, WIN_SASHTYPES.ACTIVE_OUT}, 'Dx' + end + end +end + +--------------------------------------------------------------------- +-- funzione ricorsiva che legge le aree in tabella e crea le geometrie +local function ConvertTableToGeometry( AreaTable, nParentId) + + if not AreaTable then + return + end + + -- 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 + + return nAreaId + + -- 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 nOpeningType = GetOpeningType( tSashes[1][JWD_OPENING_TYPE]) + local nAreaId = WinCreate.AddSash( nParentId, vJoints, WIN_SASHTYPES.NULL, nOpeningType) + -- aggiungo ferramenta sull'anta + if nOpeningType == WIN_OPENING_TYPES.TURNONLY_LEFT or + nOpeningType == WIN_OPENING_TYPES.TILTTURN_LEFT or + nOpeningType == WIN_OPENING_TYPES.TILTONLY_TOP or + nOpeningType == WIN_OPENING_TYPES.COPLANARSLIDE_LEFT or + nOpeningType == WIN_OPENING_TYPES.LIFTSLIDE_LEFT then + EgtSetInfo( nAreaId, WIN_HDW_HANDLE, 'Sx') + elseif nOpeningType == WIN_OPENING_TYPES.TURNONLY_RIGHT or + nOpeningType == WIN_OPENING_TYPES.TILTTURN_RIGHT or + nOpeningType == WIN_OPENING_TYPES.TILTONLY_BOTTOM or + nOpeningType == WIN_OPENING_TYPES.COPLANARSLIDE_RIGHT or + nOpeningType == WIN_OPENING_TYPES.LIFTSLIDE_RIGHT then + EgtSetInfo( nAreaId, WIN_HDW_HANDLE, 'Dx') + end + 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, sHandleSide = GetSashTypes( tSashes, vOpeningTypes) + EgtSetInfo( nParentId, WIN_HDW_HANDLE, sHandleSide) + + -- 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, sProfileDir) + -- leggo il file + local SouFh = io.open( sFilePath, "rb") + if not SouFh then + EgtOutBox( 'Error opening ' .. sFilePath, 'ReadFromFile', 'ERROR') + return false + end + local content = SouFh:read( "*all") + SouFh:close() + local tData = JSON:decode( content) + + -- 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 + +-- funzione che apre un file jwd +function WinManageProject.ReadFromJwd( sJwd) + local tData = JSON:decode( sJwd) + + -- importo il profilo + local sProfilePath = _G.sProfilePath .. '\\' .. tData[JWD_PROFILE_PATH] .. '.nge' + if not WinCreate.ImportProfile( sProfilePath) then + return false + end + + -- creo le aree + return ConvertTableToGeometry( tData[JWD_AREA_LIST][1], GDB_ID.ROOT) + +end + +--------------------------------------------------------------------- +return WinManageProject diff --git a/Profiles/WinOpenProjectFile.lua b/Designing/WinOpenProjectFile.lua similarity index 74% rename from Profiles/WinOpenProjectFile.lua rename to Designing/WinOpenProjectFile.lua index e638f45..d2a296b 100644 --- a/Profiles/WinOpenProjectFile.lua +++ b/Designing/WinOpenProjectFile.lua @@ -15,8 +15,7 @@ require( 'EgtBase') _ENV = EgtProtectGlobal() -EgtEnableDebug( true) --- 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 @@ -67,9 +62,19 @@ end WinCalculate.SetCalcSolid( true) -- creo i pezzi -local nFrameId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_AREAASTERISK) +local nFrameId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_AREA .. '*') WinCalculate.CreatePartFromArea( nFrameId) -WinCalculate.AddSplitDowelToParts( nFrameId) +-- WinCalculate.AddHardware( nFrameId) +-- WinCalculate.AddAccessories( nFrameId, true) + + +-- elimino profilo se in batch per test +if WINDOW and WINDOW.TEST and WINDOW.TEST == 1 then + local nProfileGroupId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE) + if nProfileGroupId and nProfileGroupId ~= GDB_ID.NULL then + EgtErase( nProfileGroupId) + end +end EgtZoom( SCE_ZM.ALL) diff --git a/Designing/WinProject.lua b/Designing/WinProject.lua new file mode 100644 index 0000000..0706646 --- /dev/null +++ b/Designing/WinProject.lua @@ -0,0 +1,379 @@ +-- +-- 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) + +-- 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') + +-- WDG + +-- funzioni +---------------------------------------------------------------------------------- +local function GetVariableList( sName) + local List = {} + local nIndex = 1 + while WDG[sName .. nIndex] do + table.insert(List, WDG['JOINT' .. nIndex]) + nIndex = nIndex + 1 + end + return List +end + +---------------------------------------------------------------------------------- +local function CleanVariableList( sName) + local nIndex = 1 + while WDG[sName .. nIndex] do + WDG[sName .. nIndex] = nil + nIndex = nIndex + 1 + end +end + +---------------------------------------------------------------------------------- +local function SetProfilePath() + _G.sProfilePath = WDG.PROFILEPATH +end +_G.SetProfilePath = SetProfilePath + +---------------------------------------------------------------------------------- +local function WinCreate_ImportProfile() + _G.sProfile = WDG.PROFILE + if _G.sProfilePath then + WinCreate.ImportProfile( _G.sProfilePath .. '\\' .. WDG.PROFILE .. '.nge') + end +end +_G.WinCreate_ImportProfile = WinCreate_ImportProfile + +---------------------------------------------------------------------------------- +local function FindThresholds( nGrpId) + local tThresholds = {} -- array delle soglie + -- ogni soglia è una tabella con due chiavi : nType = intero che indica la tipologia ( cfr. WIN_THRESHOLD_TYPES), sName = nome della soglia nel file dei profili + local tHash = {} + -- scorro tutti i profili del telaio + local nCurrId = EgtGetFirstInGroup( nGrpId) + while nCurrId do + -- verifico se di tipo bottom + local nBottomType = EgtGetInfo( nCurrId, WIN_BOTTOM, 'i') or WIN_THRESHOLD_TYPES.NULL + if nBottomType ~= WIN_THRESHOLD_TYPES.NULL then + -- recupero il nome + local vNames = EgtSplitString( EgtGetName( nCurrId), '_') + local sName = vNames[#vNames] + if not tHash[sName] then + table.insert( tThresholds, { nType = nBottomType, sName = sName}) + tHash[sName] = 1 + end + end + nCurrId = EgtGetNext( nCurrId) + end + return tThresholds +end + +local function GetProfileThresholdsList() + local tThresholds = {} + if _G.sProfile == WDG.PROFILE then + -- se profilo corrente + local nProfileGrp = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE) + local nFrameGrp = EgtGetFirstNameInGroup( nProfileGrp, WIN_FRAME) + tThresholds = FindThresholds( nFrameGrp) + else + -- importo temporaneamente il profilo + local nLastId = EgtGetLastInGroup( GDB_ID.ROOT) + local bOk = EgtInsertFile( _G.sProfilePath .. '\\' .. WDG.PROFILE .. '.nge') + local nCurrId = EgtGetNext( nLastId or GDB_ID.NULL) or EgtGetFirstInGroup( GDB_ID.ROOT) + while nCurrId do + if EgtGetName( nCurrId) == WIN_FRAME then + tThresholds = FindThresholds( nCurrId) + end + -- passo al successivo e cancello il corrente + local nOldId = nCurrId + nCurrId = EgtGetNext( nCurrId) + EgtErase( nOldId) + end + end + WDG.THRESHOLDSLIST = tThresholds +end +_G.GetProfileThresholdsList = GetProfileThresholdsList + +---------------------------------------------------------------------------------- +local function WinCreate_CreateFrame() + local JointList = GetVariableList( 'JOINT') + WDG.AREAID = WinCreate.CreateFrame( WDG.FRAMETYPE, JointList, WDG.WIDTH, WDG.HEIGHT, WDG.HEIGHT2) + CleanVariableList('JOINT') +end +_G.WinCreate_CreateFrame = WinCreate_CreateFrame + +---------------------------------------------------------------------------------- +local function WinCreate_AddSash() + local JointList = GetVariableList( 'JOINT') + WDG.AREAID = WinCreate.AddSash( WDG.AREAID, JointList, WDG.SASHTYPE, WDG.OPENINGTYPE) + CleanVariableList( 'JOINT') +end +_G.WinCreate_AddSash = WinCreate_AddSash + +---------------------------------------------------------------------------------- +local function WinCreate_AddHardware() + WinCreate.AddHardware( WDG.AREAID, WDG.FAVOURITE, WDG.HANDLE) +end +_G.WinCreate_AddHardware = WinCreate_AddHardware + +---------------------------------------------------------------------------------- +local function WinCreate_AddFill() + WDG.AREAID = WinCreate.AddFill( WDG.AREAID, WDG.FILLTYPE) +end +_G.WinCreate_AddFill = WinCreate_AddFill + +---------------------------------------------------------------------------------- +local function WinCreate_AddBottomRail() + WinCreate.AddBottomRail( WDG.AREAID, WDG.NBR) +end +_G.WinCreate_AddBottomRail = WinCreate_AddBottomRail + +---------------------------------------------------------------------------------- +local function WinCreate_AddThreshold() + WinCreate.AddThreshold( WDG.AREAID, WDG.THRESHOLDPROFILE) +end +_G.WinCreate_AddThreshold = WinCreate_AddThreshold + +---------------------------------------------------------------------------------- +local function WinCreate_AddSplits() + local AreaIndex = 1 + while WDG['AREAID' .. AreaIndex] do + WDG['AREAID' .. AreaIndex] = nil + AreaIndex = AreaIndex + 1 + end + local PositionList = {} + local PositionIndex = 1 + while WDG['POSITION' .. PositionIndex] do + table.insert( PositionList, WDG['POSITION' .. PositionIndex]) + PositionIndex = PositionIndex + 1 + end + local AreaList = WinCreate.AddSplits(WDG.AREAID, WDG.SPLITORIENTATION, WDG.MEASURETYPE, PositionList, WDG.PROPORTION, WDG.SPLITTYPE) + for AreaIndex = 1, #AreaList do + WDG['AREAID' .. AreaIndex] = AreaList[ AreaIndex] + end + PositionIndex = 1 + while WDG['POSITION' .. PositionIndex] do + WDG['POSITION' .. PositionIndex] = nil + PositionIndex = PositionIndex + 1 + end +end +_G.WinCreate_AddSplits = WinCreate_AddSplits + +---------------------------------------------------------------------------------- +local function WinCreate_AddGridSplits() + local AreaIndex = 1 + while WDG['AREAID' .. AreaIndex] do + WDG['AREAID' .. AreaIndex] = nil + AreaIndex = AreaIndex + 1 + end + local PositionListVert = {} + local PositionIndex = 1 + while WDG['POSITION_VERT' .. PositionIndex] do + table.insert( PositionListVert, WDG['POSITION' .. PositionIndex]) + PositionIndex = PositionIndex + 1 + end + local PositionListHoriz = {} + PositionIndex = 1 + while WDG['POSITION_HORIZ' .. PositionIndex] do + table.insert( PositionListHoriz, WDG['POSITION' .. PositionIndex]) + PositionIndex = PositionIndex + 1 + end + local AreaList = WinCreate.AddGridSplits(WDG.AREAID, WDG.MEASURETYPE, PositionListVert, PositionListHoriz, WDG.STARTVERTICAL, WDG.SPLITTYPE) + for AreaIndex = 1, #AreaList do + WDG['AREAID' .. AreaIndex] = AreaList[ AreaIndex] + end + PositionIndex = 1 + while WDG['POSITION_VERT' .. PositionIndex] do + WDG['POSITION_VERT' .. PositionIndex] = nil + PositionIndex = PositionIndex + 1 + end + PositionIndex = 1 + while WDG['POSITION_HORIZ' .. PositionIndex] do + WDG['POSITION_HORIZ' .. PositionIndex] = nil + PositionIndex = PositionIndex + 1 + end +end +_G.WinCreate_AddGridSplits = WinCreate_AddGridSplits + +---------------------------------------------------------------------------------- +local function WinCalculate_SetCalcSolid() + WinCalculate.SetCalcSolid( WDG.VALUE) +end +_G.WinCalculate_SetCalcSolid = WinCalculate_SetCalcSolid + +---------------------------------------------------------------------------------- +local function WinCalculate_SetSimplifiedSolid() + WinCalculate.SetSimplifiedSolid( WDG.VALUE) +end +_G.WinCalculate_SetSimplifiedSolid = WinCalculate_SetSimplifiedSolid + +---------------------------------------------------------------------------------- +local function WinCalculate_SetCalcPreview() + WinCalculate.SetCalcPreview( WDG.VALUE) +end +_G.WinCalculate_SetCalcPreview = WinCalculate_SetCalcPreview + +---------------------------------------------------------------------------------- +local function WinCalculate_CreatePartFromArea() + WinCalculate.CreatePartFromArea( WDG.FRAMEID) +end +_G.WinCalculate_CreatePartFromArea = WinCalculate_CreatePartFromArea + +---------------------------------------------------------------------------------- +local function WinCalculate_RecalcSolids() + WinCalculate.RecalcSolids( WDG.FRAMEID) +end +_G.WinCalculate_RecalcSolids = WinCalculate_RecalcSolids + +---------------------------------------------------------------------------------- +local function WinCalculate_AddHardware() + WDG.HARDWAREKIT_LIST, WDG.HARDWAREPOSITION_LIST = WinCalculate.AddHardware( WDG.FRAMEID) +end +_G.WinCalculate_AddHardware = WinCalculate_AddHardware + +---------------------------------------------------------------------------------- +local function WinCreate_GetHardwareOptionPath() + WDG.HWDOPTPATH = WinCalculate.AddHardwareForSash( WDG.AREAID, true) +end +_G.WinCreate_GetHardwareOptionPath = WinCreate_GetHardwareOptionPath + +---------------------------------------------------------------------------------- +local function WinCalculate_AddAccessories() + WinCalculate.AddAccessories( WDG.FRAMEID, WDG.DRAW) +end +_G.WinCalculate_AddAccessories = WinCalculate_AddAccessories + +---------------------------------------------------------------------------------- +local function WinManage_LoadJwd() + WDG.AREAID = WinManageProject.ReadFromJwd( WDG.JWD) +end +_G.WinManage_LoadJwd = WinManage_LoadJwd + +---------------------------------------------------------------------------------- +local function WinGetImage() + -- sistemo la vista + EgtSetView( SCE_VD.TOP, false) + EgtZoom( SCE_ZM.ALL, false) + -- salvo immagine + EgtGetImage( SCE_SM.SH, EgtStdColor('WHITE'), EgtStdColor('WHITE'), 1920, 1080, WDG.FILE) +end +_G.WinGetImage = WinGetImage + +---------------------------------------------------------------------------------- +local function WinGetSvg() + -- sistemo la vista + EgtSetView( SCE_VD.TOP, false) + EgtZoom( SCE_ZM.ALL, false) + -- salvo immagine + EgtExportSvg( WDG.GROUPID, WDG.FILE, EEX_FLT.LEV_SYSTEM + EEX_FLT.MODE_STD + EEX_FLT.STAT_OFF) +end +_G.WinGetSvg = WinGetSvg + +---------------------------------------------------------------------------------- +local function WinSetAuxGrpStatus() + -- recupero il gruppo aux della ferramenta e accessori e assegno stato + local nAuxGrp = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_AUX) or GDB_ID.NULL + EgtSetStatus( nAuxGrp, EgtIf( WDG.AUXSTATUS, GDB_ST.ON, GDB_ST.OFF)) +end +_G.WinSetAuxGrpStatus = WinSetAuxGrpStatus + +---------------------------------------------------------------------------------- +local function WinGetSectionsTotalLenghts() + WDG.SECTIONS_LENGTHS = {} -- array con le sezioni + -- ogni sezione è una tabella con le seguenti chiavi : w = spessore, h = altezza, l = array con le lunghezze dei pezzi di tale sezione + -- scorro tutti i pezzi + local nPartId = EgtGetFirstPart() + while nPartId do + local nPartType = EgtGetInfo( nPartId, WIN_PART_TYPE, 'i') or WIN_PART_TYPES.NULL + if nPartType ~= WIN_PART_TYPES.FILL then + -- recupero il gruppo logs ( per archi) o geo dove sono salvate le dimensioni del pezzo + local nLayerId = EgtGetFirstNameInGroup( nPartId, WIN_LOGS) or EgtGetFirstNameInGroup( nPartId, WIN_GEO) or GDB_ID.NULL + if nLayerId ~= GDB_ID.NULL then + local dWidth = EgtGetInfo( nLayerId, WIN_GEOWIDTH, 'd') + local dHeight = EgtGetInfo( nLayerId, WIN_GEOHEIGHT, 'd') + local dLen = EgtGetInfo( nLayerId, WIN_GEOLEN, 'd') + if dLen then + -- verfico se devo aggiornare sezione già presente o se devo aggiungerla + local bFound = false + for i = 1, #WDG.SECTIONS_LENGTHS do + if ( abs( WDG.SECTIONS_LENGTHS[i].W - dWidth) < GEO.EPS_SMALL and abs( WDG.SECTIONS_LENGTHS[i].H - dHeight) < GEO.EPS_SMALL) then + bFound = true + table.insert( WDG.SECTIONS_LENGTHS[i].L, dLen) + WDG.SECTIONS_LENGTHS[i].TotL = WDG.SECTIONS_LENGTHS[i].TotL + dLen + end + end + if not bFound then + table.insert( WDG.SECTIONS_LENGTHS, { W = dWidth, H = dHeight, L = {dLen}, TotL = dLen}) + end + end + end + end + nPartId = EgtGetNextPart( nPartId) + end +end +_G.WinGetSectionsTotalLenghts = WinGetSectionsTotalLenghts + +---------------------------------------------------------------------------------- +local function WinGetGlassesList() + WDG.GLASSES_LIST = {} -- array dei vetri + -- ogni vetro è una tabella con le seguenti chiavi : bRect = true se rettangolo/false altrimenti, w/l/t sono le tre dimensioni + local nPartId = EgtGetFirstPart() + while nPartId do + local nFillType = EgtGetInfo( nPartId, WIN_FILLTYPE) + if nFillType == WIN_GLASS then + local nLayerId = EgtGetFirstNameInGroup( nPartId, WIN_GEO) + local bShapeRect = EgtGetInfo( nLayerId, WIN_GLASS_RECT, 'b') or false + local dW = EgtGetInfo( nLayerId, WIN_GEOWIDTH, 'd') or 0 + local dL = EgtGetInfo( nLayerId, WIN_GEOHEIGHT, 'd') or 0 + local dT = EgtGetInfo( nLayerId, WIN_GLASSTHICKNESS, 'd') or 0 + table.insert( WDG.GLASSES_LIST, { Rect = bShapeRect, W = dW, L = dL, T = dT}) + end + nPartId = EgtGetNextPart( nPartId) + end +end +_G.WinGetGlassesList = WinGetGlassesList + +---------------------------------------------------------------------------------- +local function WinCalculate_SetCalcHardwareKit() + WinCalculate.SetCalcHardwareKit( WDG.VALUE) +end +_G.WinCalculate_SetCalcHardwareKit = WinCalculate_SetCalcHardwareKit + +---------------------------------------------------------------------------------- +local function WinCalculate_SetCalcHardwarePosition() + WinCalculate.SetCalcHardwarePosition( WDG.VALUE) +end +_G.WinCalculate_SetCalcHardwarePosition = WinCalculate_SetCalcHardwarePosition + +---------------------------------------------------------------------------------- +local function WinCalculate_GetHardwareOptions() + WDG.HARDWAREOPTIONS = WinCalculate.GetHardwareOptions( WDG.AREAID) +end +_G.WinCalculate_GetHardwareOptions = WinCalculate_GetHardwareOptions + diff --git a/Profiles/Main - 2023-06-24-2.lua b/Profiles/Main - 2023-06-24-2.lua deleted file mode 100644 index e75897f..0000000 --- a/Profiles/Main - 2023-06-24-2.lua +++ /dev/null @@ -1,271 +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( 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 deleted file mode 100644 index 1bc095b..0000000 --- a/Profiles/Main - 2023-06-24-3.lua +++ /dev/null @@ -1,338 +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( 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 deleted file mode 100644 index 21ebe94..0000000 --- a/Profiles/Main - 2023-06-24.lua +++ /dev/null @@ -1,266 +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( 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 deleted file mode 100644 index 487d146..0000000 --- a/Profiles/Main - 2023-06-26.lua +++ /dev/null @@ -1,337 +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( 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 deleted file mode 100644 index f83f3f7..0000000 --- a/Profiles/Main - 2023-07-05.lua +++ /dev/null @@ -1,227 +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( 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 deleted file mode 100644 index e18f81d..0000000 --- a/Profiles/Main.lua +++ /dev/null @@ -1,644 +0,0 @@ --- --- 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\\EgwWindowLua\\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 deleted file mode 100644 index b2c67c8..0000000 Binary files a/Profiles/Profilo78 - Copy (2).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Copy (3).nge b/Profiles/Profilo78 - Copy (3).nge deleted file mode 100644 index d4d7d96..0000000 Binary files a/Profiles/Profilo78 - Copy (3).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Copy.nge b/Profiles/Profilo78 - Copy.nge deleted file mode 100644 index 9fd5a34..0000000 Binary files a/Profiles/Profilo78 - Copy.nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (10).nge b/Profiles/Profilo78 - Offset - Copy (10).nge deleted file mode 100644 index 163d7a6..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (10).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (11).nge b/Profiles/Profilo78 - Offset - Copy (11).nge deleted file mode 100644 index 5b8cdae..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (11).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (12).nge b/Profiles/Profilo78 - Offset - Copy (12).nge deleted file mode 100644 index d6476a9..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (12).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (13).nge b/Profiles/Profilo78 - Offset - Copy (13).nge deleted file mode 100644 index 5f03975..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (13).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (14).nge b/Profiles/Profilo78 - Offset - Copy (14).nge deleted file mode 100644 index ca5ef25..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (14).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (15).nge b/Profiles/Profilo78 - Offset - Copy (15).nge deleted file mode 100644 index 2cf66b2..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (15).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (16).nge b/Profiles/Profilo78 - Offset - Copy (16).nge deleted file mode 100644 index 93f18b9..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (16).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (17).nge b/Profiles/Profilo78 - Offset - Copy (17).nge deleted file mode 100644 index 3ca605c..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (17).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (18).nge b/Profiles/Profilo78 - Offset - Copy (18).nge deleted file mode 100644 index a278554..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (18).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (19).nge b/Profiles/Profilo78 - Offset - Copy (19).nge deleted file mode 100644 index 79f86db..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (19).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (2).nge b/Profiles/Profilo78 - Offset - Copy (2).nge deleted file mode 100644 index 71ede3a..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (2).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (20).nge b/Profiles/Profilo78 - Offset - Copy (20).nge deleted file mode 100644 index c90b751..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (20).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (21).nge b/Profiles/Profilo78 - Offset - Copy (21).nge deleted file mode 100644 index f1cc3a0..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (21).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (22).nge b/Profiles/Profilo78 - Offset - Copy (22).nge deleted file mode 100644 index 006d3b2..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (22).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (23).nge b/Profiles/Profilo78 - Offset - Copy (23).nge deleted file mode 100644 index fd217e0..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (23).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (24).nge b/Profiles/Profilo78 - Offset - Copy (24).nge deleted file mode 100644 index eab4e24..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (24).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (25).nge b/Profiles/Profilo78 - Offset - Copy (25).nge deleted file mode 100644 index 52984ec..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (25).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (26).nge b/Profiles/Profilo78 - Offset - Copy (26).nge deleted file mode 100644 index 29183d6..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (26).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (27).nge b/Profiles/Profilo78 - Offset - Copy (27).nge deleted file mode 100644 index 29183d6..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (27).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (28).nge b/Profiles/Profilo78 - Offset - Copy (28).nge deleted file mode 100644 index 1913109..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (28).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (29).nge b/Profiles/Profilo78 - Offset - Copy (29).nge deleted file mode 100644 index f35288e..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (29).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (3).nge b/Profiles/Profilo78 - Offset - Copy (3).nge deleted file mode 100644 index 0551c82..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (3).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (30).nge b/Profiles/Profilo78 - Offset - Copy (30).nge deleted file mode 100644 index f35288e..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (30).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (31).nge b/Profiles/Profilo78 - Offset - Copy (31).nge deleted file mode 100644 index 46d4eb5..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (31).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (32).nge b/Profiles/Profilo78 - Offset - Copy (32).nge deleted file mode 100644 index f44be83..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (32).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (33).nge b/Profiles/Profilo78 - Offset - Copy (33).nge deleted file mode 100644 index e7d7bee..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (33).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (34).nge b/Profiles/Profilo78 - Offset - Copy (34).nge deleted file mode 100644 index 0eb915c..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (34).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (35).nge b/Profiles/Profilo78 - Offset - Copy (35).nge deleted file mode 100644 index aba1ec7..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (35).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (36).nge b/Profiles/Profilo78 - Offset - Copy (36).nge deleted file mode 100644 index dcef89e..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (36).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (37).nge b/Profiles/Profilo78 - Offset - Copy (37).nge deleted file mode 100644 index a1b4cd2..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (37).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (38).nge b/Profiles/Profilo78 - Offset - Copy (38).nge deleted file mode 100644 index e560455..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (38).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (39).nge b/Profiles/Profilo78 - Offset - Copy (39).nge deleted file mode 100644 index 637fca2..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (39).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (4).nge b/Profiles/Profilo78 - Offset - Copy (4).nge deleted file mode 100644 index 2728992..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (4).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (40).nge b/Profiles/Profilo78 - Offset - Copy (40).nge deleted file mode 100644 index f3fc101..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (40).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (41).nge b/Profiles/Profilo78 - Offset - Copy (41).nge deleted file mode 100644 index e6fce8c..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (41).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (5).nge b/Profiles/Profilo78 - Offset - Copy (5).nge deleted file mode 100644 index a6e2cd2..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (5).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (6).nge b/Profiles/Profilo78 - Offset - Copy (6).nge deleted file mode 100644 index 7ca377c..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (6).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (7).nge b/Profiles/Profilo78 - Offset - Copy (7).nge deleted file mode 100644 index 52ee4e1..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (7).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (8).nge b/Profiles/Profilo78 - Offset - Copy (8).nge deleted file mode 100644 index 988fbc6..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (8).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy (9).nge b/Profiles/Profilo78 - Offset - Copy (9).nge deleted file mode 100644 index e242eac..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy (9).nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset - Copy.nge b/Profiles/Profilo78 - Offset - Copy.nge deleted file mode 100644 index 9fa9760..0000000 Binary files a/Profiles/Profilo78 - Offset - Copy.nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset.nge b/Profiles/Profilo78 - Offset.nge deleted file mode 100644 index a5ac450..0000000 Binary files a/Profiles/Profilo78 - Offset.nge and /dev/null differ diff --git a/Profiles/Profilo78 - Offset.nge.no b/Profiles/Profilo78 - Offset.nge.no deleted file mode 100644 index 78ef43f..0000000 Binary files a/Profiles/Profilo78 - Offset.nge.no and /dev/null differ diff --git a/Profiles/Profilo78 - Offset.ok.nge b/Profiles/Profilo78 - Offset.ok.nge deleted file mode 100644 index d6476a9..0000000 Binary files a/Profiles/Profilo78 - Offset.ok.nge and /dev/null differ diff --git a/Profiles/Profilo78.nge b/Profiles/Profilo78.nge deleted file mode 100644 index 5461fb5..0000000 Binary files a/Profiles/Profilo78.nge and /dev/null differ diff --git a/Profiles/Test Salvataggio.nge b/Profiles/Test Salvataggio.nge deleted file mode 100644 index 29fd2b8..0000000 Binary files a/Profiles/Test Salvataggio.nge and /dev/null differ diff --git a/Profiles/Test Salvataggio2.nge b/Profiles/Test Salvataggio2.nge deleted file mode 100644 index 1b3d0f4..0000000 Binary files a/Profiles/Test Salvataggio2.nge and /dev/null differ diff --git a/Profiles/TestAreas.nge b/Profiles/TestAreas.nge deleted file mode 100644 index 597e333..0000000 Binary files a/Profiles/TestAreas.nge and /dev/null differ diff --git a/Profiles/WinConst.lua b/Profiles/WinConst.lua deleted file mode 100644 index a14faac..0000000 --- a/Profiles/WinConst.lua +++ /dev/null @@ -1,223 +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 - --- 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_TYPE = 'Type' -WIN_PRF_MAIN = 'Main' -WIN_PRF_START = 'Start' -WIN_PRF_END = 'End' -WIN_PRF_SPLIT = 'Split' - -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_SRF_MAIN = 'MainSurface' -WIN_SRF_ORIGMAIN = 'OrigMainSurface' -WIN_SRF_START = 'StartSurface' -WIN_SRF_END = 'EndSurface' - -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' -WIN_DWL_RAILBOTTOMPERPSTART = 'RailBottomPerpStart' -WIN_DWL_RAILBOTTOMPERPEND = 'RailBottomPerpEnd' -WIN_DWL_RAILBOTTOMPARASTART = 'RailBottomParaStart' -WIN_DWL_RAILBOTTOMPARAEND = 'RailBottomParaEnd' -WIN_DWL_SPLITPERPSTART = 'SplitPerpStart' -WIN_DWL_SPLITPERPEND = 'SplitPerpEnd' - ---------------------------------------------------------------------- -return WinConst diff --git a/Profiles/WinLib - Copy.lua b/Profiles/WinLib - Copy.lua deleted file mode 100644 index c5cd787..0000000 --- a/Profiles/WinLib - Copy.lua +++ /dev/null @@ -1,625 +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 - --- 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 deleted file mode 100644 index 419803a..0000000 --- a/Profiles/WinLib.lua +++ /dev/null @@ -1,958 +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 - --- 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 deleted file mode 100644 index f78bdab..0000000 --- a/Profiles/WinLib/WinCalculate.lua +++ /dev/null @@ -1,2691 +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 - --- 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 - -function WinCalculate.AddSplitDowelToParts( nAreaId) - -- recupero tipo di area - local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') - if nAreaType == WIN_AREATYPES.FRAME or nAreaType == WIN_AREATYPES.SASH then - -- recupero pezzi outline - local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_OUTLINE) - local nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) - while nOutlineId do - WinCalculate.AddSplitDowelToExtrusion( nOutlineId, nAreaType, false) - -- 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.AddSplitDowelToExtrusion( nOutlineId, nAreaType, true) - end - end - nOutlineId = EgtGetNext( nOutlineId) - end - 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.AddSplitDowelToExtrusion( nSplitId, nAreaType, false) - end - end - end - -- verifico se ci sono aree - local nChildAreaId = EgtGetFirstNameInGroup( nAreaId, WIN_AREA .. '*') - while nChildAreaId do - -- lancio costruzione pezzi di quell'area - WinCalculate.AddSplitDowelToParts( 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 .. 1 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') - local nLastOrigPrevSouId = nOrigPrevSouId - while nOrigPrevSouId and nOrigPrevSouType == WIN_AREATYPES.SPLIT do - nOrigPrevSouId = EgtGetInfo( nOrigPrevSouId, WIN_SOU) - -- se esiste un SOU, ne recupero l'area ed il tipo, altrimenti lascio nullo per uscire perche' sono arrivato allo split originale - if nOrigPrevSouId and nOrigPrevSouId ~= GDB_ID.NULL then - nLastOrigPrevSouId = nOrigPrevSouId - nOrigPrevSouAreaId = EgtGetParent( EgtGetParent( nOrigPrevSouId)) - nOrigPrevSouType = EgtGetInfo( nOrigPrevSouAreaId, WIN_AREATYPE, 'i') - end - end - if not nOrigPrevSouId then - nOrigPrevSouId = nLastOrigPrevSouId - 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( nOutlineId, WIN_STARTJOINT, 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( nOutlineId, WIN_ENDJOINT, 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 recupera l'outline precedente e successivo -local function GetPrevNextOutline( nProfileType, nOutlineId, nOutlineLayerId) - local nPrevOutlineId - local nNextOutlineId - -- recupero outline precedente e successivo -if nProfileType == WIN_PRF.VERTICAL then - nPrevOutlineId = EgtGetInfo( nOutlineId, WIN_SPLIT_STARTINTERS, 'i') - nNextOutlineId = EgtGetInfo( nOutlineId, WIN_SPLIT_ENDINTERS, 'i') - elseif nProfileType == WIN_PRF.HORIZONTAL then - 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 = 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') - local nLastPrevSouId = nPrevSouId - while nPrevSouId and nPrevSouType == WIN_AREATYPES.SPLIT do - nPrevSouId = EgtGetInfo( nPrevSouId, WIN_SOU) - if nPrevSouId and nPrevSouId ~= GDB_ID.NULL then - nLastPrevSouId = nPrevSouId - nPrevSouAreaId = EgtGetParent( EgtGetParent( nPrevSouId)) - nPrevSouType = EgtGetInfo( nPrevSouAreaId, WIN_AREATYPE, 'i') - end - end - if not nPrevSouId then - nPrevSouId = nLastPrevSouId - end - nPrevOutlineId = nPrevSouId - local nNextSouId = nNextOutlineId - local nNextSouAreaId = EgtGetParent( EgtGetParent( nNextSouId)) - local nNextSouType = EgtGetInfo( nNextSouAreaId, WIN_AREATYPE, 'i') - local nLastNextSouId = nNextSouId - while nNextSouId and nNextSouType == WIN_AREATYPES.SPLIT do - nNextSouId = EgtGetInfo( nNextSouId, WIN_SOU) - if nNextSouId and nNextSouId ~= GDB_ID.NULL then - nLastNextSouId = nNextSouId - nNextSouAreaId = EgtGetParent( EgtGetParent( nNextSouId)) - nNextSouType = EgtGetInfo( nNextSouAreaId, WIN_AREATYPE, 'i') - end - end - if not nNextSouId then - nNextSouId = nLastNextSouId - 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 - return nPrevOutlineId, nNextOutlineId -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) - EgtSetName( nMainExtrusionId, WIN_SRF_MAIN) - local nOrigMainExtrusionId = EgtCopy( nMainExtrusionId, nSolidLayerId) - EgtSetName( nOrigMainExtrusionId, WIN_SRF_ORIGMAIN) - EgtSetStatus( nOrigMainExtrusionId, GDB_ST.OFF) - -- 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) - EgtSetName( nStartExtrusionId, WIN_SRF_START) - -- 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, WIN_DOWEL) - local nPrevOutlineId, nEndOutlineId = GetPrevNextOutline( nProfileType, nOutlineId, nOutlineLayerId) - 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 = WIN_DWL_TOPPARASTART - local sEnd = WIN_DWL_TOPPARAEND - if sOutlineName == WIN_BOTTOM or sPrevOutlineName == WIN_BOTTOM then - sStart = WIN_DWL_BOTTOMPARASTART - sEnd = WIN_DWL_BOTTOMPARAEND - end - if sOutlineName == WIN_SPLIT then - local sStartType = EgtGetInfo( nStartProfileId, WIN_PRF_TYPE) - if ( sStartType and sStartType == WIN_RAIL_BOTTOM) or sPrevOutlineName == WIN_SPLIT then - sStart = WIN_DWL_RAILBOTTOMPARASTART - sEnd = WIN_DWL_RAILBOTTOMPARAEND - end - end - --local sStart = EgtIf( sOutlineName == WIN_BOTTOM or sPrevOutlineName == WIN_BOTTOM or sOutlineName == WIN_BOTTOMRAIL, WIN_DWL_BOTTOMPARASTART, WIN_DWL_TOPPARASTART) - --local sEnd = EgtIf( sOutlineName == WIN_BOTTOM or sPrevOutlineName == WIN_BOTTOM or sOutlineName == WIN_BOTTOMRAIL, 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 - -- verifico che start ed end abbiano dei valori - if dStart and dEnd then - 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) - end - 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) - EgtSetName( nEndExtrusionId, WIN_SRF_END) - -- taglio estrusi per ottenere solido - EgtSurfTmCut( nMainExtrusionId, nEndExtrusionId, true, false) - EgtSurfTmCut( nEndExtrusionId, nExtrCopyId, true, false) - -- creo fori per spine su End - local sEndOutlineName = EgtGetName( nEndOutlineId) - if EndJointType == WIN_PART_JNT.ANGLED then - - elseif EndJointType == 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 EndJointType == WIN_PART_JNT.SHORT then - -- recupero profondita' d'inizio e fine - local sStart = WIN_DWL_TOPPARASTART - local sEnd = WIN_DWL_TOPPARAEND - if sOutlineName == WIN_BOTTOM or sEndOutlineName == WIN_BOTTOM then - sStart = WIN_DWL_BOTTOMPARASTART - sEnd = WIN_DWL_BOTTOMPARAEND - end - if sOutlineName == WIN_SPLIT then - local sEndType = EgtGetInfo( nEndProfileId, WIN_PRF_TYPE) - if ( sEndType and sEndType == WIN_RAIL_BOTTOM) or sEndOutlineName == WIN_SPLIT then - sStart = WIN_DWL_RAILBOTTOMPARASTART - sEnd = WIN_DWL_RAILBOTTOMPARAEND - end - end - -- 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 - -- verifico che start ed end abbiano dei valori - if dStart and dEnd then - 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) - end - nOrigDowelId = EgtGetNextName( nOrigDowelId, WIN_DOWEL .. '*') - end - end - -- elimino copia dell'estrusione principale - EgtErase( { nExtrCopyId}) -end - --- funzione che calcola intersezione, geometrie e superfici dei dowel degli split -function CalSplitDowel( nSplitLayerId, nOutlineId, nProfileFrameLayerId, nFrameProfileLayerId, nProfileType, nPartId, nSolidLayerId) - local nSplitId = EgtGetFirstInGroup( nSplitLayerId) - - -- se presenti, verifico se intersecano l'outline che sto analizzando - local ptInters = EgtIP( nOutlineId, nSplitId, EgtSP( nSplitId)) - if not ptInters then - return - end - -- se interseca, recupero il profilo dello split - local sSplitProfileType = EgtGetInfo( nSplitId, WIN_PROFILETYPE) - local nOrigSplitProfileId = EgtGetFirstNameInGroup( nProfileFrameLayerId, sSplitProfileType) - -- creo copia del profilo - local nSplitProfileId = EgtCopy( nOrigSplitProfileId, nFrameProfileLayerId) - local sSplitProfileType = EgtGetName( nOrigSplitProfileId) - EgtSetInfo( nSplitProfileId, WIN_PRF_TYPE, sSplitProfileType) - EgtSetName( nSplitProfileId, WIN_PRF_SPLIT) - -- recupero intersezione con lato In - local bIsGeoOut = false - local nGeoLayerId = EgtGetFirstNameInGroup( nPartId, WIN_GEO) - local nGeoInId = EgtGetFirstNameInGroup(nGeoLayerId, WIN_GEO_IN) - local ptIntersIn = EgtIP( nGeoInId, nSplitId, EgtSP( nSplitId)) - if not ptIntersIn and nProfileType == WIN_PRF.SPLIT then - bIsGeoOut = true - nGeoInId = EgtGetFirstNameInGroup(nGeoLayerId, WIN_GEO_OUT) - ptIntersIn = EgtIP( nGeoInId, nSplitId, EgtSP( nSplitId)) - end - -- recupero frame del profilo - local nSplitProfileFrameId = EgtGetFirstNameInGroup( nSplitProfileId, WIN_SECTIONFRAME) - local frInvertSplitProfile = EgtFR( nSplitProfileFrameId) - frInvertSplitProfile:invert() - -- lo applico a tutte le geometrie del profilo - EgtTransform( EgtGetAllInGroup( nSplitProfileId), frInvertSplitProfile) - -- assegno come riferimento del profilo il punto di intersezione - local vtDir = - EgtSV( nSplitId) - if bIsGeoOut then - vtDir = - vtDir - end - EgtChangeGroupFrame( nSplitProfileId, Frame3d( ptIntersIn, vtDir)) - - -- e lo porto nel sistema di riferimento corretto - - -- recupero profondita' start e end dei dowel - - -- ne disegno la superficie - - -- recupero solido del pezzo - local nSolidLayerId = EgtGetFirstNameInGroup( nPartId, WIN_SOLID) - local nMainExtrusionId = EgtGetFirstNameInGroup( nSolidLayerId, WIN_SRF_MAIN) - local nOrigMainExtrusionId = EgtGetFirstNameInGroup( nSolidLayerId, WIN_SRF_ORIGMAIN) - -- creo fori per spine su Split - local nDowelLayerId = EgtGetFirstNameInGroup( nPartId, WIN_DOWEL) - -- recupero profondita' d'inizio e fine - local sStart = WIN_DWL_TOPPERPSTART - local sEnd = WIN_DWL_TOPPERPEND - if nProfileType == WIN_PRF.BOTTOM then - sStart = WIN_DWL_BOTTOMPERPSTART - sEnd = WIN_DWL_BOTTOMPERPEND - elseif nProfileType == WIN_PRF.BOTTOMRAIL then - sStart = WIN_DWL_RAILBOTTOMPERPSTART - sEnd = WIN_DWL_RAILBOTTOMPERPEND - elseif nProfileType == WIN_PRF.SPLIT then - sStart = WIN_DWL_SPLITPERPSTART - sEnd = WIN_DWL_SPLITPERPEND - end - -- ciclo sui fori trovati - local nOrigDowelId = EgtGetFirstNameInGroup( nSplitProfileId, 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 ptDowelCenter = EgtCP( nDowelId) - local vtPerpStartPoint = EgtSV( nOutlineId) - if bIsGeoOut then - vtPerpStartPoint:rotate( Z_AX(), -90) - else - vtPerpStartPoint:rotate( Z_AX(), 90) - end - -- posiziono i fori e gli assegno estrusione e spessore - EgtMove( nDowelId, ( EgtSP( nGeoInId) - 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 - --local nExtrCopyId = EgtCopy( nMainExtrusionId, nSolidLayerId) - EgtSurfTmCut( nMainExtrusionId, nDowelExtrusionId, true, false) - EgtSurfTmCut( nDowelExtrusionId, nOrigMainExtrusionId, true, false) - --EgtErase( nExtrCopyId) - nOrigDowelId = EgtGetNextName( nOrigDowelId, WIN_DOWEL .. '*') - end -end - --- funzione ricorsiva che cerca gli split che possono dare origine a dei dowel -function VerifyDowelArea( nAreaLayerId, nOutlineId, nPartId, nProfileType, nOrigAreaType) - --EgtSaveFile('c://Temp//DowelSplit.nge') - -- recupero profilo - local nProfileLayerId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE) - local nProfileFrameLayerId - if nOrigAreaType == WIN_AREATYPES.FRAME then - nProfileFrameLayerId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_FRAME) - elseif nOrigAreaType == WIN_AREATYPES.SASH then - nProfileFrameLayerId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_SASH) - end - -- creo layer per solido e per profili di estrusione - local nSolidLayerId = EgtGetFirstNameInGroup( nPartId, WIN_SOLID) - local nFrameProfileLayerId = EgtGetFirstNameInGroup( nPartId, WIN_PROFILE) --- verifico la presenza di eventuali Split - local nSplitLayerId = EgtGetFirstNameInGroup( nAreaLayerId, WIN_SPLIT) - if nSplitLayerId then - CalSplitDowel( nSplitLayerId, nOutlineId, nProfileFrameLayerId, nFrameProfileLayerId, nProfileType, nPartId, nSolidLayerId) - end - -- verifico la presenza di split in sotto aree - local nArea1LayerId = EgtGetFirstNameInGroup( nAreaLayerId, WIN_AREA1) - if nArea1LayerId then - local nAreaType = EgtGetInfo( nArea1LayerId, WIN_AREATYPE, 'i') - if nAreaType == WIN_AREATYPES.SPLIT then - VerifyDowelArea( nArea1LayerId, nOutlineId, nPartId, nProfileType, nOrigAreaType) - end - end - local nArea2LayerId = EgtGetFirstNameInGroup( nAreaLayerId, WIN_AREA2) - if nArea2LayerId then - local nAreaType = EgtGetInfo( nArea2LayerId, WIN_AREATYPE, 'i') - if nAreaType == WIN_AREATYPES.SPLIT then - VerifyDowelArea( nArea2LayerId, nOutlineId, nPartId, nProfileType, nOrigAreaType) - end - end -end - --- funzione che posiziona i fori delle spine degli split, li estrude e crea il solido -function WinCalculate.AddSplitDowelToExtrusion(nOutlineId, nAreaType, bIsBottomRail) - -- ricavo tipo dal - local sPartRef = WIN_REF_PART - if bIsBottomRail then - sPartRef = WIN_BOTTOMRAIL - end - local nPartId = EgtGetInfo( nOutlineId, sPartRef, 'i') - local sName = EgtGetName( nPartId) - local nProfileType = WIN_PRF.NULL - if bIsBottomRail 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 - -- recupero l'area di cui fa parte il pezzo - local nOutlineLayerId = EgtGetParent( nOutlineId) - local nAreaLayerId = EgtGetParent( nOutlineLayerId) - -- se profilo Bottom con BottomRail, esco - if nProfileType == WIN_PRF.BOTTOM then - local nBaseOutlineLayerId = EgtGetFirstNameInGroup( nAreaLayerId, WIN_AREAOUTLINE) - local nBottomRailId = EgtGetInfo( nBaseOutlineLayerId, WIN_BOTTOMRAIL, 'i') - if nBottomRailId and nBottomRailId == 1 then - return - end - end - -- verifico la presenza di eventuali Split - VerifyDowelArea( nAreaLayerId, nOutlineId, nPartId, nProfileType, nAreaType) - -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') - local nLastPrevSouId = nPrevSouId - while nPrevSouId and nPrevSouType == WIN_AREATYPES.SPLIT do - nPrevSouId = EgtGetInfo( nPrevSouId, WIN_SOU) - if nPrevSouId and nPrevSouId ~= GDB_ID.NULL then - nLastPrevSouId = nPrevSouId - nPrevSouAreaId = EgtGetParent( EgtGetParent( nPrevSouId)) - nPrevSouType = EgtGetInfo( nPrevSouAreaId, WIN_AREATYPE, 'i') - end - end - if not nPrevSouId then - nPrevSouId = nLastPrevSouId - end - nPrevOutlineId = nPrevSouId - local nNextSouId = nNextOutlineId - local nNextSouAreaId = EgtGetParent( EgtGetParent( nNextSouId)) - local nNextSouType = EgtGetInfo( nNextSouAreaId, WIN_AREATYPE, 'i') - local nLastNextSouId = nNextSouId - while nNextSouId and nNextSouType == WIN_AREATYPES.SPLIT do - nNextSouId = EgtGetInfo( nNextSouId, WIN_SOU) - if nNextSouId and nNextSouId ~= GDB_ID.NULL then - nLastNextSouId = nNextSouId - nNextSouAreaId = EgtGetParent( EgtGetParent( nNextSouId)) - nNextSouType = EgtGetInfo( nNextSouAreaId, WIN_AREATYPE, 'i') - end - end - if not nNextSouId then - nNextSouId = nLastNextSouId - 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) - local sMainProfileType = EgtGetName( nMainProfileId) - EgtSetInfo( nMainProfileId, WIN_PRF_TYPE, sMainProfileType) - EgtSetName( nMainProfileId, WIN_PRF_MAIN) - nStartProfileId = EgtCopy( nOrigStartProfileId, nFrameProfileLayerId) - local sStartProfileType = EgtGetName( nStartProfileId) - EgtSetInfo( nStartProfileId, WIN_PRF_TYPE, sStartProfileType) - EgtSetName( nStartProfileId, WIN_PRF_START) - nEndProfileId = EgtCopy( nOrigEndProfileId, nFrameProfileLayerId) - local sEndProfileType = EgtGetName( nEndProfileId) - EgtSetInfo( nEndProfileId, WIN_PRF_TYPE, sEndProfileType) - 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 deleted file mode 100644 index e577a1e..0000000 --- a/Profiles/WinLib/WinCreate.lua +++ /dev/null @@ -1,453 +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 - --- Tabella per definizione modulo -local WinCreate = {} - --- Include -require( 'EgtBase') -require( 'WinConst') - --- funzioni - --- funzione che importa il profilo -function WinCreate.ImportProfile( sProfilePath) - -- verifico esistenza file - if not EgtExistsFile( sProfilePath) then - EgtOutLog( 'File del profilo non trovato! ' .. sProfilePath) - EgtOutText( 'File del profilo non trovato! ' .. sProfilePath) - EgtPause(5000) - return false - end - -- 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) - return true -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 - -- scorro pezzi del primo e secondo outline per avere bottom come primo - local nFirstInAreaId = EgtGetFirstInGroup( nArea1OutlineLayerId) - local sFirstInAreaName = EgtGetName( nFirstInAreaId) - while sFirstInAreaName ~= WIN_BOTTOM do - EgtRelocate( nFirstInAreaId, nArea1OutlineLayerId) - nFirstInAreaId = EgtGetFirstInGroup( nArea1OutlineLayerId) - sFirstInAreaName = EgtGetName( nFirstInAreaId) - end - nFirstInAreaId = EgtGetFirstInGroup( nArea2OutlineLayerId) - sFirstInAreaName = EgtGetName( nFirstInAreaId) - while sFirstInAreaName ~= WIN_BOTTOM do - EgtRelocate( nFirstInAreaId, nArea2OutlineLayerId) - nFirstInAreaId = EgtGetFirstInGroup( nArea2OutlineLayerId) - sFirstInAreaName = EgtGetName( nFirstInAreaId) - 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 deleted file mode 100644 index 10995fc..0000000 --- a/Profiles/WinLib/WinDesign.lua +++ /dev/null @@ -1,34 +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 - --- 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 deleted file mode 100644 index ab4c0b2..0000000 --- a/Profiles/WinLib/WinManageProject.lua +++ /dev/null @@ -1,259 +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 - --- 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 - 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') - 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 false - end - local content = SouFh:read( "*all") - SouFh:close() - local tData = JSON:decode( content) - if not WinManageProject.CreateGeomFromTable( tData) then - return false - end - return true -end - ---------------------------------------------------------------------- -return WinManageProject diff --git a/Profiles/WinSaveProjectFile.lua b/Profiles/WinSaveProjectFile.lua deleted file mode 100644 index c84ff94..0000000 --- a/Profiles/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( 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\\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_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 montanti verticale e orizzontali ------------------------ - -sFileName = sFileName .. 'SixSash_Vertical&HorizontalMullion2' - --- 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_AREAASTERISK) -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) diff --git a/Projects/Rect_DoubleHorizontalSash_Mullion.jwd b/Projects/Rect_DoubleHorizontalSash_Mullion.jwd deleted file mode 100644 index 2b45d92..0000000 --- a/Projects/Rect_DoubleHorizontalSash_Mullion.jwd +++ /dev/null @@ -1,66 +0,0 @@ -{ - "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": [ 1800.0, 750.0, 0.0 ], - "ptStart": [ 0.0, 750.0, 0.0 ] - } ] - }, - "ProfilePath": "c:\\EgtData\\EgwWindowLua\\Profiles\\Profilo78 - Offset.nge" -} \ No newline at end of file diff --git a/Projects/Rect_DoubleVerticalSash_French.jwd b/Projects/Rect_DoubleVerticalSash_French.jwd deleted file mode 100644 index bf89396..0000000 --- a/Projects/Rect_DoubleVerticalSash_French.jwd +++ /dev/null @@ -1,68 +0,0 @@ -{ - "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\\EgwWindowLua\\Profiles\\Profilo78 - Offset.nge" -} \ No newline at end of file diff --git a/Projects/Rect_DoubleVerticalSash_Mullion.jwd b/Projects/Rect_DoubleVerticalSash_Mullion.jwd deleted file mode 100644 index 0e78c02..0000000 --- a/Projects/Rect_DoubleVerticalSash_Mullion.jwd +++ /dev/null @@ -1,66 +0,0 @@ -{ - "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\\EgwWindowLua\\Profiles\\Profilo78 - Offset.nge" -} \ No newline at end of file diff --git a/Projects/Rect_FixedGlass.jwd b/Projects/Rect_FixedGlass.jwd deleted file mode 100644 index ce03528..0000000 --- a/Projects/Rect_FixedGlass.jwd +++ /dev/null @@ -1,34 +0,0 @@ -{ - "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\\EgwWindowLua\\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 deleted file mode 100644 index 185752f..0000000 --- a/Projects/Rect_FixedGlass_Vertical&HorizontalSplit.jwd +++ /dev/null @@ -1,79 +0,0 @@ -{ - "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\\EgwWindowLua\\Profiles\\Profilo78 - Offset.nge" -} \ No newline at end of file diff --git a/Projects/Rect_Sash.jwd b/Projects/Rect_Sash.jwd deleted file mode 100644 index a7dd877..0000000 --- a/Projects/Rect_Sash.jwd +++ /dev/null @@ -1,42 +0,0 @@ -{ - "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\\EgwWindowLua\\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 deleted file mode 100644 index 4f9ae17..0000000 --- a/Projects/Rect_Sash_Vertical&HorizontalSplit.jwd +++ /dev/null @@ -1,87 +0,0 @@ -{ - "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\\EgwWindowLua\\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 deleted file mode 100644 index 6530efc..0000000 --- a/Projects/Rect_SixSash_Vertical&HorizontalMullion.jwd +++ /dev/null @@ -1,162 +0,0 @@ -{ - "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\\EgwWindowLua\\Profiles\\Profilo78 - Offset.nge" -} \ No newline at end of file diff --git a/Projects/Rect_SixSash_Vertical&HorizontalMullion2.jwd b/Projects/Rect_SixSash_Vertical&HorizontalMullion2.jwd deleted file mode 100644 index c16d352..0000000 --- a/Projects/Rect_SixSash_Vertical&HorizontalMullion2.jwd +++ /dev/null @@ -1,162 +0,0 @@ -{ - "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": { - "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, 750.0, 0.0 ], - "ptStart": [ 0.0, 750.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, 750.0, 0.0 ], - "ptStart": [ 600.0, 750.0, 0.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": [ 1800.0, 750.0, 0.0 ], - "ptStart": [ 1200.0, 750.0, 0.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\\EgwWindowLua\\Profiles\\Profilo78 - Offset.nge" -} \ No newline at end of file diff --git a/Projects/Rect_TripleVertical&HorizontalSash_Mullion.jwd b/Projects/Rect_TripleVertical&HorizontalSash_Mullion.jwd deleted file mode 100644 index a5f3415..0000000 --- a/Projects/Rect_TripleVertical&HorizontalSash_Mullion.jwd +++ /dev/null @@ -1,90 +0,0 @@ -{ - "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": [ 900.0, 1500.0, 0.0 ], - "ptStart": [ 900.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\\EgwWindowLua\\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 deleted file mode 100644 index 32af9ea..0000000 --- a/Projects/Rect_TripleVerticalSash_Mullion&French.jwd +++ /dev/null @@ -1,92 +0,0 @@ -{ - "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\\EgwWindowLua\\Profiles\\Profilo78 - Offset.nge" -} \ No newline at end of file diff --git a/Projects/Rect_TripleVerticalSash_Mullion.jwd b/Projects/Rect_TripleVerticalSash_Mullion.jwd deleted file mode 100644 index 195e4ef..0000000 --- a/Projects/Rect_TripleVerticalSash_Mullion.jwd +++ /dev/null @@ -1,90 +0,0 @@ -{ - "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\\EgwWindowLua\\Profiles\\Profilo78 - Offset.nge" -} \ No newline at end of file diff --git a/Projects/RoundArc_DoubleVerticalSash.jwd b/Projects/RoundArc_DoubleVerticalSash.jwd deleted file mode 100644 index 1d4fe2f..0000000 --- a/Projects/RoundArc_DoubleVerticalSash.jwd +++ /dev/null @@ -1,67 +0,0 @@ -{ - "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\\EgwWindowLua\\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 deleted file mode 100644 index 6bb356c..0000000 --- a/Projects/RoundArc_FixedGlass_Vertical&HorizontalSplit.jwd +++ /dev/null @@ -1,80 +0,0 @@ -{ - "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\\EgwWindowLua\\Profiles\\Profilo78 - Offset.nge" -} \ No newline at end of file diff --git a/Projects/RoundArc_French.jwd b/Projects/RoundArc_French.jwd deleted file mode 100644 index af421b3..0000000 --- a/Projects/RoundArc_French.jwd +++ /dev/null @@ -1,69 +0,0 @@ -{ - "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\\EgwWindowLua\\Profiles\\Profilo78 - Offset.nge" -} \ No newline at end of file diff --git a/Projects/RoundArc_Sash.jwd b/Projects/RoundArc_Sash.jwd deleted file mode 100644 index 2222040..0000000 --- a/Projects/RoundArc_Sash.jwd +++ /dev/null @@ -1,43 +0,0 @@ -{ - "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\\EgwWindowLua\\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 deleted file mode 100644 index da920e3..0000000 --- a/Projects/RoundArc_Sash_Vertical&HorizontalSplit.jwd +++ /dev/null @@ -1,88 +0,0 @@ -{ - "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\\EgwWindowLua\\Profiles\\Profilo78 - Offset.nge" -} \ No newline at end of file diff --git a/Projects/RoundArc_TripleVerticalSash.jwd b/Projects/RoundArc_TripleVerticalSash.jwd deleted file mode 100644 index 62d849f..0000000 --- a/Projects/RoundArc_TripleVerticalSash.jwd +++ /dev/null @@ -1,91 +0,0 @@ -{ - "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\\EgwWindowLua\\Profiles\\Profilo78 - Offset.nge" -} \ No newline at end of file diff --git a/Test/Data/Rect_FixedGlass.jwd b/Test/Data/Rect_FixedGlass.jwd deleted file mode 100644 index 3b6ca4f..0000000 --- a/Test/Data/Rect_FixedGlass.jwd +++ /dev/null @@ -1,34 +0,0 @@ -{ - "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 deleted file mode 100644 index 8676ea2..0000000 Binary files a/Test/Result.ok/Rect_FixedGlass.nge and /dev/null differ