-- -- EEEEEEEEEE GGGGGG wwww wwww -- EEEEEEEEEE GGGGGGGGGG wwww wwww -- EEEE GGGG GGGG wwww wwww wwww -- EEEE GGGG wwww wwww wwww -- EEEEEEE GGGG GGGGGGG wwww wwwwww wwww -- EEEEEEE GGGG GGGGGGG wwww wwwwww wwww -- EEEE GGGG GGGG wwww wwwwwwww wwww -- EEEE GGGG GGGG wwww wwww wwww wwww -- EEEEEEEEEE GGGGGGGGGG wwwwwwww wwwwwwww -- EEEEEEEEEE GGGGGG wwwwwww wwwwwww -- -- Main.lua by EgalWare s.r.l. 2016.05.28 -- Main creazione porte da descrizione DDF -- 2016.09.07 V1.001 FM Modificata gestione flush bolt -- 2016.09.14 V1.002 FM Aggiunta gestione log file -- 2017.06.27 V1.013 FM Manage frame jamb ( hinges jamb and lock jamb) -- 2017.07.24 V1.014 FM Manage frame jamb ( top frame) and assembly ( more pieces into one ddf file) -- 2017.12.13 V1.014 FM Manage parameter side on groove and face on flushpull models -- 2018.01.12 V1.015 FM Fix errors on calculate frame point -- 2018.01.22 V1.016 FM Manage Arc on top door side -- 2018.02.14 V1.017 FM Add sizing -- 2018.02.16 V1.018 FM Sizing top arc -- 2018.02.16 V1.018 FM Fix missing assignement of DGD.SIDE with Stop & Closer and OverHead hardware model -- 2018.03.23 V1.019 FM Add notes on side paths -- 2018.04.09 V1.01a FM Manage KeepBackSet notes on flush pull geometries (into MoveFlushPull) and -- on Lock sides (keyway and secure) rectangles and lines geometries (into MoveSubGeomLock) -- 2018.04.17 V1.01b FM Manage new ddf parameters for viewers, louver and vision cutouts (to manage different application points) -- 2018.05.09 V1.01c FM Assign name to all face surfaces ( before only on top and bottom surfaces) -- 2018.05.17 V1.01d FM Manage position of Groove on narrow face and its surface -- 2018.05.23 V1.01e FM Manage grove for all 4 sides -- 2018.06.01 V1.01f FM Manage Z probe geometry near hardware templates -- 2018.06.15 V1.020 FM Manage Rebuid Door and hardware application by probe point -- 2018.06.22 V1.021 FM Fix bug on calculate rebuildel door -- 2018.06.25 V1.022 FM Read different probe distance from dat file and extend line by these values -- 2018.06.27 V1.023 FM Modify dat table, add manage error messages if dat file is missing and if enable side trim with probe mode -- 2018.07.18 V1.024 FM Manage new groove parameters into ddf -- 2018.07.19 V1.025 FM Manage properties field into DDF -- 2018.07.20 V1.026 FM Fix bug on Strike Half disposition ( modify also EdgePullFlat component) -- 2018.07.23 V1.027 FM Manage Alias Swing (actually for Haley Bros) -- 2018.08.24 V1.028 FM Manage data.dat file instead of .dat into LoadDataProbeFile function -- 2018.10.01 V1.029 FM Manage read zero value parameter (means disable probe in Z) into LoadDataProbeFile function -- 2018.10.17 V1.02a FM Manage by parameter DGC.Edp ( into CurrDoorsCustomData.lua) differents profiles on Top Arc between top and sdes -- 2018.10.17 V1.02a FM Fix error on create top arc beveled machining path -- 2018.10.18 V1.02b FM Manage better recognizing opposite bevel profile (between sides) on Inactive doors -- 2018.10.19 V1.02c FM Manage better recognize bad swing code from ddf -- 2018.10.19 V1.02c FM Fix pivot disposition with new offset pivot dispositions -- 2018.10.22 V1.02d FM Manage reference position (backset or door side) for secure and keyway geometries, for: lock -- 2018.10.23 V1.02e FM DDF can manage more LouverCutOut items -- 2018.10.26 V1.02f FM Manage disposition of flush bolt extra geometries -- 2018.10.31 V1.030 FM Fix error on check backset (when backset is not defined into ddf) -- 2018.11.09 V1.031 FM Move hinges geometries by new function MoveSubGeomHinge to manage which geometries have to rotate on profile or not -- 2018.11.16 V1.032 FM Manage OH Stop and Closer aggregate of lua templates -- 2018.11.26 V1.033 FM Manage Lock hardware disposition also on top and bottom door side by ddf parameter 'side:' -- 'lock', 'bottom', 'top'. If ddf parameter is missing the default application side is 'lock' -- 2018.11.30 V1.034 FM Manage RollerLatch hardware disposition also on lock door side -- 2018.12.06 V1.035 FM Fix error on move keyway geometries into MoveSubGeomFlushBolt function -- 2018.12.10 V1.036 FM Manage better solid geometry/shape with deepr striker horizontal faces: -- (Roller latch strike, Edge pull flat, Mortise hinge, Over head Arm, Stop and Closer Arm) -- 2018.12.11 V1.037 FM Manage reading DDF radius parameter on VisionCutOut with rectangle shape -- 2018.12.17 V1.038 FM Fix bug on contour machining paths when profiles between head (top, bottom) and side (lock, hinge) are differents -- 2018.12.18 V1.039 FM Make anti-splint machining path on top bottom side ( for horizontal tool) -- 2018.12.20 V1.03a FM Extend previous feature V1.033 to different disposition side/reference assigned to ddf parameter 'side:' -- 'lock_top', 'lock_bottom', 'bottom', 'top'. If ddf parameter is missing the default application side is 'lock_top' -- 2019.01.15 V1.03b FM Fix error when load old ddf that not have lock reference with 'lock_top', 'lock_bottom' but only 'lock' -- 2019.03.22 V1.03c FM Make better top arc paths with precise end point -- 2019.03.29 V1.03d FM Manage Edge break (EB) and Bevel Edge break (BVEB) profiles -- 2019.04.11 V1.03e FM Fix bug on calculate top arc points with new mode to set side profile (now top and side profiles can be set indipendent) -- 2019.04.19 V1.03e FM Fix import hinges as nge file -- 2019.04.29 V1.03f FM Manage new disposition for Flush_pull hardware, now dispose geometries one by one -- 2019.05.06 V1.040 FM Fix semantic error on assign value = 0 to a not specified variable: tHinge.thickness into GetOneHinge function -- 2019.05.15 V1.041 FM Manage new hardware type: Decoration -- 2019.05.21 V1.042 FM Draw short sides on Draw mode only -- 2019.05.30 V1.043 FM Fix error on calculate negative value for sqrt into CalcSideRectTringle function -- 2019.07.01 V1.044 FM Manage new probe modes by variable DGC.Pms: 0 old complete probe (8 probe points) and door rebuild; -- 1: recalculate dimension only on door width (4 probe points); 2: recalculate dimension on door width and length (5 probe points) -- 2019.08.16 V1.045 FM Fix error on Move strike geometry managed as EdgePull, now it manage also 'upper' geometry in case side face is deep than 1/6 of door thickness -- 2019.08.16 V1.046 FM Fix error on Move strike geometry managed as EdgePull, now not consider the backset value (that's used for locks and not for EdgePull) -- 2019.08.27 V1.046 FM Modify the disposition of Pivot, now it move one by one geometry instead of move layer -- 2019.08.30 V1.047 FM Manage 8 bullnose radius (according to default.ini Compo configuration amd CurrDoorsCustomdata.lua) -- 2019.09.16 V1.048 FM Identify door properties by DGC settings variables -- 2019.09.19 V1.049 FM Add manage new ddf side distance parameters for Decoration -- 2019.10.03 V1.048 FM Remove: identify door properties by DGC settings variables -- 2019.10.04 V1.049 FM Manage new ddf section: material. Now, by material value, lua components change geometries -- 2019.10.18 V2.000 FM Manage use Materials -- 2019.11.11 V2.001 FM Manage Top Chamfer Shape -- 2019.11.22 V2.002 FM Manage let any profiles (SQ,BV,EB,BVEB,1B,2B,3B,4B,5B,6B,7B,8B,CV) to any sides (Top, Top Arc, Top Angle, Bottom, Hinge, Lock) -- 2019.12.19 V2.003 FM Fix error on double use of SetInvertEdgeTrimming when bevel lock side is set to opposite bevel -- 2020.05.06 V2.004 FM Enable roller latch, pivot, flush bolt also on frame bottom -- 2020.05.18 V2.005 FM Manage frame disposition (on wide side or narrow side) by CurrDoorCustomData parameter DGC.Dxjs (x depend to material) -- 2020.05.20 V2.006 FM Manage frame disposition narrow face limit by CurrDoorCustomData parameter DGC.Mjn -- if narros side is smaller than this parameter then frame is dispossed on wide side (wide side on pods) -- 2020.05.20 V2.007 FM Enable roller latch also on lock jamb, enable lock also on top and bottom frames -- 2020.10.28 V2.008 FM Fix lock/strike disposition on top and bottom frames -- 2020.11.12 V2.009 FM Fix flush_bolt disposition on top and bottom frames with or without lock/hinge rabbets -- 2020.11.13 V2.00a FM Fix type error on definition of name variable sLocalHingeProf was sLocalHingeProfm -- 2021.02.10 V3.000 FM Manage apply rabbet on opposite face (than standard) -- 2021.04.23 V3.001 FM set DGD variable if a cut out has not hatching -- 2021.05.27 V3.002 FM Manage special region (added to main region) from hatching paths to remove pods under hatching paths -- 2021.06.01 V3.003 FM If not run by dProd, Show a message to update the ddf if ddf parameter 'piece:' not exists -- 2021.08.05 V3.004 FM Fix error on disposition of geometry used to calculate regions of EdgePull flat hardware -- 2021.10.11 V3.005 FM I not agree to this modification: manage DGC.Bwd parameter to refer the backset on wide side dimension, but this modification is not -- for general purpose but apply this reference change only to some geometries that are on keyway/secure faces -- 2021.10.26 V3.006 FM Manage FD Wedge Cup (FDWC) profile -- 2021.11.23 V3.007 FM Manage option side probing. Expand function number of CurrDoorCustomData DGC.Pms: 3 side probe on all hardware (for NE machines) ; -- 4: side probe on all hardware except hardware on hinge side (for machines with shuttles) -- 2022.01.17 V3.008 FM Manage Split door cut by new Vision CutOut type -- 2022.03.11 V3.009 FM Fix error (into MoveFlushBolt function) on calculate probe path with corner flush bolt and into InsertProbeGeom when side probe path has not to does -- 2022.04.12 V3.00a FM Manage better the Sideprobe info into function InsertProbeGeom -- 2022.04.28 V3.00a FM Manage Split door on door width direction -- 2022.07.07 V3.00b FM Manage Lock aggregate of lua templates -- 2022.07.27 V3.00c FM Modification to use compiled code -- 2022.08.31 V3.00d FM Manage groove applied on top angle -- 2022.11.15 V3.00e FM Manage side grove region as throu region and not as blind region -- 2023.04.26 V3.00f FM Manage new DDF format by new ddf version number parameter -- 2023.05.11 V3.010 FM Read new ddf group 'options:' (actually not used) at the end of ddf file -- 2023.09.07 V3.011 FM try to delete the .tok file (it's a copy of .txt file) that dProd uses -- 2023.12.01 V3.012 FM Manage new CurrDoorCustomData parameter DGC.CVP to define a small line on both corner of Convex profile -- 2023.12.04 V3.013 FM Fix errors on build solid with bevel profile on top arc -- 2024.02.01 V3.014 FM Manage new CurrCamInfo parameter 'SideDoorDefined' to manage door disposition with lock side machined by shuttle/s -- 2024.07.01 V3.015 FM Fix error (that it appens only with frames) on DGD variable assignemente into InsertGeom function -- 2024.10.15 V3.016 FM Manage new DGC.NPM parameter to indicate new DGD.PROBE meaning -- 2024.10.31 V3.017 FM Manage probe id number and note 'ProbeId' on geometries that have hinge or lock probe geometry -- 202x.xx.xx V3.xxx FM Manage new CurrCamInfo parameter 'WideDoorWidth' to manage large wide doors stored into new DGD.Part parameter -- 2023.04.27 Max num error message DGD.ERR = 28 -- Intestazioni require( 'EgtBase') _ENV = EgtProtectGlobal() EgtEnableDebug( false) if not _G.DGD then _G.DGD = {} end --local sBaseDir = EgtGetSourceDir() local sBaseDir = DGD.BASEDIR EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua') EgtAddToPackagePath( sBaseDir .. 'MTables\\?.mtl') EgtAddToPackagePath( sBaseDir .. '?.lua') require( 'EgtDoorsBase') require( 'EgtDoorsData') require( 'CurrDoorsCustomData') local EgtDoorsMsg = require( 'EgtDoorsMsg') -- variabili gestione macchine local tMachineData local sMTable local sMTablePath local sMTableOri -- info della porta local tGenInfo={} local tProbeDoor={} local nNumHingePivot = 0 local nCountPieces = 0 local nTypePiece = 0 local sFirstDoor local sSecondDoor local sFrameSx local sFrameDx local sFrameTop local sFrameBot -- variabili dei file local sFileDir, sFileName, sFileExt local sErrFileM local sErrFile local sTxtOkFile local sCncFile local sLogFile local sNgeFile local sPrbFile local sOriPrbFile -- variabili percorsi creati da probe 2 local nDoorLeft local nDoorRight local nDoorTop local nDoorBot local nDoorLeftTop local nDoorRightTop local nDoorTopTop local nDoorBotTop local nDoorLeftMid local nDoorRightMid local nDoorTopMid local nDoorBotMid local bRemake = false ---------------------------------------------------------------- -- *** Error write file functions *** ----------------------------------------------------------------- local function WriteErrFile( sFileErr, sDispMsg) local nIdFile = io.open( sFileErr, 'w') if nIdFile then if DGD.ERM and string.len(DGD.ERM) > 0 then nIdFile:write( 'Err=' .. tostring( DGD.ERR) .. '\n' .. DGD.ERM) if DGD.EGR == 0 then DGD.EGR = DGD.ERR end if DGD.EGM then DGD.EGM = DGD.EGM .. '\n' .. DGD.ERM end else nIdFile:write( 'Err=' .. tostring( DGD.ERR)) end if sDispMsg and string.len(sDispMsg) > 0 then nIdFile:write('\n' .. sDispMsg) DoorOutLog( sDispMsg, 0) if DGD.EGM then DGD.EGM = DGD.EGM .. '\n' .. sDispMsg end end nIdFile:close() end end local function WriteErrFileAsmbl( sFileErr, sDispMsg) local nIdFile = io.open( sFileErr, 'w') if nIdFile then if DGD.EGR ~= 0 then nIdFile:write( 'Err=' .. tostring( DGD.EGR) .. DGD.EGM) else nIdFile:write( 'Err=' .. tostring( DGD.EGR)) end if sDispMsg and string.len(sDispMsg) > 0 then nIdFile:write('\n' .. sDispMsg) DoorOutLog( sDispMsg, 0) end nIdFile:close() end end ----------------------------------------------------------------- -- *** Geometry Calc *** ----------------------------------------------------------------- local function CalcSideRectTringle( nCat1, nCat2, nIpo) local nSide = 0 if not nIpo then -- se non ho l'ipotenusa nSide = sqrt((nCat1*nCat1)+(nCat2*nCat2)) elseif not nCat1 then -- se manca cateto 1 nSide = sqrt(abs((nIpo*nIpo)-(nCat2*nCat2))) -- use abs in case the sub results is near 0 but negative value elseif not nCat2 then -- se manca cateto 2 nSide = sqrt(abs((nIpo*nIpo)-(nCat1*nCat1))) -- use abs in case the sub results is near 0 but negative value end return nSide end ----------------------------------------------------------------- -- *** DDF file parsing *** ----------------------------------------------------------------- local function KeyFromLine( sKey) local sLine = GetLine() if not sLine then return false end if not sLine:find( sKey, 1, true) then UngetLine( sLine) return false end return true end ----------------------------------------------------------------- local function CheckKeyFromLine( sKey) local sLine = GetLine() if not sLine then return false end if not sLine:find( sKey, 1, true) then UngetLine( sLine) return false else UngetLine( sLine) end return true end ----------------------------------------------------------------- local function EndOfFile( ) local sLine = GetLine() if not sLine then return true else UngetLine( sLine) return nil end end ----------------------------------------------------------------- local function StringFromLine( sKey) local sLine = GetLine() if not sLine then return nil end if not sLine:find( sKey, 1, true) then UngetLine( sLine) return nil end local sVal = sLine:gsub( sKey, '') return EgtTrim( sVal) end ----------------------------------------------------------------- local function LenFromLine( sKey, bNotConv) local sVal = StringFromLine( sKey) if not sVal then return nil end local dVal = tonumber( sVal) if not dVal then return nil end if not bNotConv and not DGD.bMM then dVal = dVal * GEO.ONE_INCH end return dVal end ----------------------------------------------------------------- local function GetVersion() -- leggo il parametro di produzione del pezzo local nPr = LenFromLine( 'version:', true) if not nPr then DGD.nVersion = 1 else DGD.nVersion = nPr end -- salvo in tabella table.insert( tGenInfo, {'DDF version', DGD.nVersion}) return true end ----------------------------------------------------------------- local function GetProoduce() -- leggo il parametro di produzione del pezzo local sPr = StringFromLine( 'produce:') if not sPr then DGD.bProoduce = true else -- la interpreto DGD.bProoduce = sPr == 'true' end -- salvo in tabella table.insert( tGenInfo, {'Produce',DGD.bProoduce}) return true end ----------------------------------------------------------------- local function GetMeasures() -- leggo l'unità di misura local sUM = StringFromLine( 'measures:') if not sUM then return false end -- la interpreto DGD.bMM = not ( sUM == 'inches') -- salvo in tabella table.insert( tGenInfo, {'MM',DGD.bMM}) return true end ----------------------------------------------------------------- local function GetCode() -- leggo il codice DGD.sCode = StringFromLine( 'code:') if not ( DGD.sCode and DGD.sCode:len() > 0) then return false end -- salvo in tabella table.insert( tGenInfo, {'Code',DGD.sCode}) return true end ----------------------------------------------------------------- local function GetOrder() -- leggo la chiave if not KeyFromLine( 'order:') then return false end -- leggo tutte le voci dell'ordine line = GetLine() while line do -- se trovo la data ho finito if line:find( 'date:', 1, true) then UngetLine( line) break end -- leggo la voce line = EgtTrim( line) table.insert( DGD.tOrder, line) -- leggo la prossima linea utile line = GetLine() end -- salvo in tabella table.insert( tGenInfo, {'Order', table.concat( DGD.tOrder, ',')}) return true end ----------------------------------------------------------------- local function GetDate() -- leggo la data DGD.sDate = StringFromLine( 'date:') if not ( DGD.sDate and DGD.sDate:len() > 0) then return false end -- salvo in tabella table.insert( tGenInfo, {'Date',DGD.sDate}) return true end ----------------------------------------------------------------- local function GetPiece() -- leggo se è un pezzo porta o telaio local sPiece = StringFromLine( 'piece:') -- se non trovato Piece assegno codice come porta singola e visualizzo un avviso if not ( sPiece and sPiece:len() > 0) then nTypePiece = 1 DGD.nTypePz = nTypePiece DoorOutLog( string.format( EgtDoorsMsg[691], DGD.FILE), 0) if not DGD.NCGEN then EgtOutBox( string.format(EgtDoorsMsg[691], DGD.FILE), EgtDoorsMsg[501], EgtDoorsMsg[502]) end return false end if string.find( sPiece, 'DO_1') then nTypePiece = 1 DGD.sFrame = nil elseif string.find( sPiece, 'DO_2') then nTypePiece = 2 DGD.sFrame = nil elseif string.find( sPiece, 'FL_') then nTypePiece = 3 DGD.sFrame = string.gsub( sPiece, 'FL_', '') elseif string.find( sPiece, 'FR_') then nTypePiece = 4 DGD.sFrame = string.gsub( sPiece, 'FR_', '') elseif string.find( sPiece, 'FT_') then nTypePiece = 5 DGD.sFrame = string.gsub( sPiece, 'FT_', '') elseif string.find( sPiece, 'FB_') then nTypePiece = 6 DGD.sFrame = string.gsub( sPiece, 'FB_', '') else nTypePiece = 1 DGD.sFrame = nil end DGD.nTypePz = nTypePiece -- salvo in tabella table.insert( tGenInfo, {'Frame',DGD.sFrame}) table.insert( tGenInfo, {'Piece Type',nTypePiece}) return true end ----------------------------------------------------------------- local function GetPosition() if not KeyFromLine( 'position:') then return false end -- leggo la posizione in X table.insert( DGD.tPosition, LenFromLine( 'x:')) -- leggo la posizione in Y table.insert( DGD.tPosition, LenFromLine( 'y:')) -- leggo la posizione in Z table.insert( DGD.tPosition, LenFromLine( 'z:')) if not ( DGD.tPosition[1] and DGD.tPosition[2] and DGD.tPosition[3]) then return false end table.insert( tGenInfo, {'PosFromDoor', DGD.tPosition}) return true end ----------------------------------------------------------------- local function GetSize() -- leggo la chiave if not KeyFromLine( 'size:') then return false end -- leggo la larghezza DGD.dW = LenFromLine( 'width:') -- leggo l'altezza DGD.dH = LenFromLine( 'height:') -- leggo lo spessore DGD.dT = LenFromLine( 'thickness:') -- leggo la pressione local sPressure = StringFromLine( 'pressure:') or '0' DGD.Pressure = tonumber(sPressure) if DGD.Pressure < 0 then DGD.Pressure = 0 elseif DGD.Pressure > 20 then DGD.Pressure = 20 end -- verifico le letture if not ( DGD.dW and DGD.dH and DGD.dT) then return false end -- salvo in tabella if DGD.sFrame then if DGD.nTypePz == 5 or DGD.nTypePz == 6 then table.insert( tGenInfo, {'W',DGD.dT}) table.insert( tGenInfo, {'H',DGD.dW}) table.insert( tGenInfo, {'T',DGD.dH}) else table.insert( tGenInfo, {'W',DGD.dT}) table.insert( tGenInfo, {'H',DGD.dH}) table.insert( tGenInfo, {'T',DGD.dW}) end else table.insert( tGenInfo, {'W',DGD.dW}) table.insert( tGenInfo, {'H',DGD.dH}) table.insert( tGenInfo, {'T',DGD.dT}) end table.insert( tGenInfo, {'P',DGD.Pressure}) return true end ----------------------------------------------------------------- local function GetDoorHeight() -- leggo l'altezza originale porta DGD.dOH = LenFromLine( 'origdoorheight:') if not DGD.dOH then return false end -- salvo in tabella table.insert( tGenInfo, {'OH', DGD.dOH}) return true end ----------------------------------------------------------------- local function GetSwing() -- leggo il brandeggio DGD.sAliasSwng = StringFromLine( 'swing:') if not ( DGD.sAliasSwng and #DGD.sAliasSwng > 0) then return false, '' end DGD.sAliasSwng = string.upper(DGD.sAliasSwng) ----------------------------------------------------- -- interpretazione swing e gestione alias per Haley ----------------------------------------------------- if DGD.sAliasSwng == 'LW' or DGD.sAliasSwng == 'RM' or DGD.sAliasSwng == 'BLANK' then -- alias per RH DGD.sSwing = 'RH' elseif DGD.sAliasSwng == 'RW' or DGD.sAliasSwng == 'LM' then -- alias per LH DGD.sSwing = 'LH' else -- per tutti gli altri casi if DGD.sAliasSwng == 'RH' or DGD.sAliasSwng == 'RHA' or DGD.sAliasSwng == 'RHI' or DGD.sAliasSwng == 'RHR' or DGD.sAliasSwng == 'RHRA' or DGD.sAliasSwng == 'RHRI' or DGD.sAliasSwng == 'LH' or DGD.sAliasSwng == 'LHA' or DGD.sAliasSwng == 'LHI' or DGD.sAliasSwng == 'LHR' or DGD.sAliasSwng == 'LHRA' or DGD.sAliasSwng == 'LHRI' then DGD.sSwing = DGD.sAliasSwng else return false, DGD.sAliasSwng end end -- salvo in tabella table.insert( tGenInfo, {'AliasSwing', DGD.sAliasSwng}) table.insert( tGenInfo, {'Swing', DGD.sSwing}) return true end ----------------------------------------------------------------- local function GetSecurSide() -- leggo la disposzione del lato secure DGD.sSecSide = StringFromLine( 'secure:') if not ( DGD.sSecSide and #DGD.sSecSide > 0) then return false end -- salvo in tabella table.insert( tGenInfo, {'Secure', DGD.sSecSide}) return true end ----------------------------------------------------------------- local function GetDoorMaterial() -- leggo il materiale porta DGD.Material = StringFromLine( 'material:') if not DGD.Material then return false end -- se nome materiale esiste tolgo eventuali spazi vuoti if #DGD.Material > 0 then DGD.Material = string.gsub( DGD.Material, ' ', '') else return false end -- salvo in tabella table.insert( tGenInfo, {'Material', DGD.Material}) return true end ----------------------------------------------------------------- local function GetDoorProperties() -- leggo i parametri di proprietà local sProperties = StringFromLine( 'properties:') if not ( sProperties and sProperties:len() > 0) then return false end -- converto in tabella DGD.Properties = EgtSplitString( sProperties) -- salvo in tabella table.insert( tGenInfo, {'Properties', sProperties}) return true end ----------------------------------------------------------------- local function GetOneProfile( sName, nFindTopCurve) local tProf = {} -- tProf.trimming = EgtIf( DGD.sFrame, 'SQ', StringFromLine( sName..':')) tProf.trimming = StringFromLine( sName..':') if DGD.nVersion >= 2 then tProf.trimming = StringFromLine( 'type:') end if not ( #tProf.trimming > 0) then if DGD.nVersion >= 2 then return 11 else return 5 end end if StringFromLine( 'machining:') == 'ON' then tProf.machining = true else tProf.machining = false end tProf.offset = LenFromLine( 'overmaterial:') if not tProf.offset then return 1 end if nFindTopCurve == 1 and not DGD.sFrame then tProf.radius = LenFromLine( 'radius:') tProf.xdeltapos = LenFromLine( 'posx:') tProf.angle = LenFromLine( 'angle:', true) -- se c'è il parametro del raggio e dell'angolo do errore if tProf.angle and tProf.radius then return 6 -- se c'è l'angolo ma non il parametro della posizione x do errore elseif tProf.angle and not tProf.xdeltapos then return 7 elseif tProf.angle and abs(tProf.angle) < GEO.EPS_SMALL then tProf.angle = nil tProf.xdeltapos = 0 -- se c'è l'angolo e il parametro della posizione centro/inizio angolo in x è negativo, cambio di segno senza dare errore elseif tProf.angle and tProf.xdeltapos < 0 then tProf.xdeltapos = abs(tProf.xdeltapos) -- se c'è l'angolo e il parametro posizione supera o eguaglia la larghezza porta azzero l'angolo e non do errore elseif tProf.angle and tProf.xdeltapos > DGD.dW then tProf.xdeltapos = 0 tProf.angle = 0 -- se c'è l'angolo e il suo valore supera i 45° do errore elseif tProf.angle and abs(tProf.angle) > 45 then return 9 -- se c'è l'angolo e la risultante della parte inclinata in Y supera l'altezza porta do errore elseif tProf.angle and abs((( DGD.dW - tProf.xdeltapos)*tan(abs(tProf.angle))) - DGD.dH) < GEO.EPS_SMALL*1000 then return 10 -- se c'è il parametro del centro in x ma non c'è il raggio o l'angolo do errore elseif tProf.xdeltapos and not tProf.radius and not tProf.angle then return 2 -- se il raggio è inferiore alla metà larghezza porta do errore elseif tProf.radius and tProf.radius < (DGD.dW/2) then return 3 -- Se la posizione X del centro sommata alla metà larghezza porta è maggiore del raggio -- do errore perché non crea un arco che va tangente o secante al lato della porta opposto alla -- posizione X del centro elseif tProf.radius and tProf.xdeltapos and abs(tProf.xdeltapos) + (DGD.dW/2) > tProf.radius then return 3 -- se profilo ad arco controllo i settaggi dei profili consentiti elseif tProf.radius then if DGC.Edp then -- se sono consentiti i profili differenti tra top e sides -- in questo caso almeno i due lati devono essere uguali, se non lo sono do errore -- if DGD.tProfs.lockedge.trimming ~= DGD.tProfs.hingeedge.trimming then -- return 4 -- end -- altrimenti se non sono consentiti differenti profili tra top e sides e non lo sono do errore elseif DGD.tProfs.lockedge.trimming ~= tProf.trimming or DGD.tProfs.hingeedge.trimming ~= tProf.trimming then return 4 end end end DGD.tProfs[sName] = tProf -- salvo in tabella table.insert( tGenInfo, { sName..'_trimming',tProf.trimming}) table.insert( tGenInfo, { sName..'_machining',tProf.machining}) table.insert( tGenInfo, { sName..'_offset',tProf.offset}) if nFindTopCurve == 1 then if tProf.radius then table.insert( tGenInfo, { sName..'_radius',tProf.radius}) end if tProf.xdeltapos then table.insert( tGenInfo, { sName..'_xdeltapos',tProf.xdeltapos}) end if tProf.angle then table.insert( tGenInfo, { sName..'_angle',tProf.angle}) end end return 0 end ----------------------------------------------------------------- local function GetProfiles() -- leggo la chiave if not KeyFromLine( 'profiles:') then return 1 end -- leggo le diverse parti local nCodeErr = GetOneProfile( 'lockedge', 0) if nCodeErr > 0 then return nCodeErr end nCodeErr = GetOneProfile( 'hingeedge', 0) if nCodeErr > 0 then return nCodeErr end nCodeErr = GetOneProfile( 'top', 1) if nCodeErr > 0 then return nCodeErr end nCodeErr = GetOneProfile( 'bottom', 0) if nCodeErr > 0 then return nCodeErr end return 0 end ----------------------------------------------------------------- local function GetOneVisionCutOut() local tVision = {} tVision.shape = StringFromLine( '- shape:') if not tVision.shape then return false end local sSplit = StringFromLine( 'split:') tVision.length = LenFromLine( 'length:') tVision.width = LenFromLine( 'width:') tVision.dir = StringFromLine( 'direction:') tVision.top_rail = LenFromLine( 'top_rail:') tVision.lock_stile = LenFromLine( 'lock_stile:') tVision.radius = LenFromLine( 'radius:') tVision.center_from_top = LenFromLine( 'center_from_top:') tVision.center_from_lock = LenFromLine( 'center_from_lock:') tVision.door_center = StringFromLine( 'door_center:') or 'lock' -- se nulla assegno vecchio valore default tVision.split = sSplit == '1' if ( tVision.split and not tVision.width) or ( sSplit == nil and not ( tVision.length and tVision.width and tVision.top_rail and tVision.lock_stile) and not ( tVision.radius and tVision.center_from_top and tVision.center_from_lock)) then -- messaggio errore dati inconguenti DoorOutLog( string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[513]), 0) DGD.ERM = DGD.ERM .. string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[513]) DGD.ERR = -9 return false end -- se ho split abilitato ( == '1') if tVision.split then tVision.lock_stile = 0 if not tVision.dir or tVision.dir == '0' then tVision.door_center = 'center' tVision.top_rail = 0 else if not tVision.top_rail then tVision.top_rail = 0 end end -- altrimenti se ho split assente elseif sSplit == nil then tVision.split = sSplit end table.insert( DGD.tVisions, tVision) -- salvo in tabella local sName = 'vision_cut_out'..tostring(#DGD.tVisions) table.insert( tGenInfo, {sName ..'_shape',tVision.shape}) table.insert( tGenInfo, {sName ..'_split',tVision.split}) table.insert( tGenInfo, {sName ..'_length',tVision.length}) table.insert( tGenInfo, {sName ..'_width',tVision.width}) table.insert( tGenInfo, {sName ..'_direction',tVision.dir}) table.insert( tGenInfo, {sName ..'_top_rail',tVision.top_rail}) table.insert( tGenInfo, {sName ..'_lock_stile',tVision.lock_stile}) table.insert( tGenInfo, {sName ..'_radius',tVision.radius}) table.insert( tGenInfo, {sName ..'_center_from_top',tVision.center_from_top}) table.insert( tGenInfo, {sName ..'_center_from_lock',tVision.center_from_lock}) table.insert( tGenInfo, {sName ..'_door_center',tVision.door_center}) return true end ----------------------------------------------------------------- local function GetVisionCutOuts() -- leggo la chiave if not KeyFromLine( 'vision_cut_outs:') then return false end -- leggo le diverse sfinestrature while GetOneVisionCutOut() do end return true end ----------------------------------------------------------------- local function GetOneLouverCutOut() local tLouver = {} tLouver.shape = StringFromLine( '- shape:') if not tLouver.shape then return false end tLouver.length = LenFromLine( 'length:') tLouver.width = LenFromLine( 'width:') tLouver.bottom_rail = LenFromLine( 'bottom_rail:') tLouver.lock_stile = LenFromLine( 'lock_stile:') tLouver.door_center = StringFromLine( 'door_center:') or 'lock' -- se nulla assegno vecchio valore default if not ( tLouver.length and tLouver.width and tLouver.bottom_rail and tLouver.lock_stile) then -- messaggio errore dati inconguenti DoorOutLog( string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[514]), 0) DGD.ERM = DGD.ERM .. string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[514]) DGD.ERR = -9 return false end table.insert( DGD.tLouvers, tLouver) -- salvo in tabella local sName = 'louver_cut_out'..tostring(#DGD.tLouvers) table.insert( tGenInfo, {sName ..'_shape',tLouver.shape}) table.insert( tGenInfo, {sName ..'_length',tLouver.length}) table.insert( tGenInfo, {sName ..'_width',tLouver.width}) table.insert( tGenInfo, {sName ..'_bottom_rail',tLouver.bottom_rail}) table.insert( tGenInfo, {sName ..'_lock_stile',tLouver.lock_stile}) table.insert( tGenInfo, {sName ..'_door_center',tLouver.door_center}) return true end ----------------------------------------------------------------- local function GetLouverCutOut() -- leggo la chiave if not KeyFromLine( 'louver_cut_outs:') then return false end -- leggo le diverse sfinestrature while GetOneLouverCutOut() do end return true end ----------------------------------------------------------------- local function GetOneMailSlot( ) -- i parametri acquisiti in questa funzione e i loro nomi, possono non essere quelli passati local tMailSlot = {} tMailSlot.template = StringFromLine( '- template:') -- template o shape ? if not tMailSlot.template then return false end tMailSlot.length = LenFromLine( 'height:') -- cambiato nome parametro da length a height tMailSlot.bottom_rail = LenFromLine( 'bottom_rail:') tMailSlot.delta_center = LenFromLine( 'delta_center:') -- nome inventato if not ( tMailSlot.length and tMailSlot.bottom_rail and tMailSlot.delta_center) then -- messaggio errore dati inconguenti DoorOutLog( string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[515]), 0) DGD.ERM = DGD.ERM .. string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[515]) DGD.ERR = -9 return false end table.insert( DGD.tMailSlots, tMailSlot) -- salvo in tabella local sName = 'mail_slot'..tostring(#DGD.tMailSlots) table.insert( tGenInfo, {sName ..'_template',tMailSlot.template}) table.insert( tGenInfo, {sName ..'_height',tMailSlot.length}) table.insert( tGenInfo, {sName ..'_bottom_rail',tMailSlot.bottom_rail}) table.insert( tGenInfo, {sName ..'_delta_center',tMailSlot.delta_center}) return true end ----------------------------------------------------------------- local function GetMailSlots() -- leggo la chiave if not KeyFromLine( 'mail_slots:') then return false end -- leggo le diverse sfinestrature while GetOneMailSlot() do end return true end ----------------------------------------------------------------- local function GetOneViewer( ) -- i parametri acquisiti in questa funzione e i loro nomi, possono non essere quelli passati local tViewer = {} tViewer.template = StringFromLine( '- template:') -- template if not tViewer.template then return false end tViewer.bottom_rail = LenFromLine( 'bottom_rail:') tViewer.delta_center = LenFromLine( 'delta_center:') -- nome inventato tViewer.side = StringFromLine( 'side:') if not ( tViewer.bottom_rail and tViewer.delta_center) then -- messaggio errore dati inconguenti DoorOutLog( string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[516]), 0) DGD.ERM = DGD.ERM .. string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[516]) DGD.ERR = -9 return false end table.insert( DGD.tViewers, tViewer) -- salvo in tabella local sName = 'viewer'..tostring(#DGD.tViewers) table.insert( tGenInfo, {sName ..'_template',tViewer.template}) table.insert( tGenInfo, {sName ..'_bottom_rail',tViewer.bottom_rail}) table.insert( tGenInfo, {sName ..'_delta_center',tViewer.delta_center}) table.insert( tGenInfo, {sName ..'_side',tViewer.side}) return true end ----------------------------------------------------------------- local function GetViewers() -- leggo la chiave if not KeyFromLine( 'viewers:') then return false end -- leggo le diverse sfinestrature while GetOneViewer() do end return true end ----------------------------------------------------------------- local function GetOneFlushPull() local tFlushPull = {} tFlushPull.template = StringFromLine( '- template:') -- template o shape ? if not tFlushPull.template then return false end tFlushPull.position = LenFromLine( 'position:') tFlushPull.back_set = LenFromLine( 'back_set:') tFlushPull.depth = LenFromLine( 'depth:') tFlushPull.face = StringFromLine( 'face:') if not ( tFlushPull.position and tFlushPull.back_set) then -- messaggio errore dati inconguenti DoorOutLog( string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[517]), 0) DGD.ERM = DGD.ERM .. string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[517]) DGD.ERR = -9 return false end table.insert( DGD.tFlushPulls, tFlushPull) -- salvo in tabella local sName = 'flush_pull'..tostring(#DGD.tFlushPulls) table.insert( tGenInfo, {sName ..'_template',tFlushPull.template}) table.insert( tGenInfo, {sName ..'_position',tFlushPull.position}) table.insert( tGenInfo, {sName ..'_back_set',tFlushPull.back_set}) table.insert( tGenInfo, {sName ..'_depth',tFlushPull.depth}) table.insert( tGenInfo, {sName ..'_face',tFlushPull.face}) return true end ----------------------------------------------------------------- local function GetFlushPulls() -- leggo la chiave if not KeyFromLine( 'flush_pulls:') then return false end -- leggo le diverse sfinestrature while GetOneFlushPull() do end return true end ----------------------------------------------------------------- local function GetOneHinge( ) local tHinge = {} tHinge.template = StringFromLine( '- template:') if not tHinge.template then return false end tHinge.position = LenFromLine( 'ToptoTop:') if not tHinge.position then tHinge.position = LenFromLine( 'ToptoCL:') end tHinge.back_set = LenFromLine( 'back_set:') tHinge.thickness = LenFromLine( 'thickness:') -- if not tHinge.thickness then tHinge.thickness = 0 end if not ( tHinge.position and tHinge.back_set) then -- messaggio errore dati inconguenti DoorOutLog( string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[518]), 0) DGD.ERM = DGD.ERM .. string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[518]) DGD.ERR = -9 return false end table.insert( DGD.tHinges, tHinge) -- salvo in tabella local sName = 'hinge'..tostring(#DGD.tHinges) table.insert( tGenInfo, {sName ..'_template',tHinge.template}) table.insert( tGenInfo, {sName ..'_position',tHinge.position}) table.insert( tGenInfo, {sName ..'_back_set',tHinge.back_set}) table.insert( tGenInfo, {sName ..'_thickness',tHinge.thickness}) return true end ----------------------------------------------------------------- local function GetHinges() -- leggo la chiave if not KeyFromLine( 'hinges:') then return false end -- leggo le diverse parti while GetOneHinge() do end return true end ----------------------------------------------------------------- local function GetOneEPT( ) local tEPT = {} tEPT.template = StringFromLine( '- template:') if not tEPT.template then return false end tEPT.position = LenFromLine( 'ToptoCL:') tEPT.back_set = LenFromLine( 'FacetoCL:') if not ( tEPT.position and tEPT.back_set) then -- messaggio errore dati inconguenti DoorOutLog( string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[588]), 0) DGD.ERM = DGD.ERM .. string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[588]) DGD.ERR = -9 return false end table.insert( DGD.tEPTs, tEPT) -- salvo in tabella local sName = 'ept'..tostring(#DGD.tEPTs) table.insert( tGenInfo, {sName ..'_template',tEPT.template}) table.insert( tGenInfo, {sName ..'_toptocl',tEPT.position}) table.insert( tGenInfo, {sName ..'_facetocl',tEPT.back_set}) return true end ----------------------------------------------------------------- local function GetEPT() -- leggo la chiave if not KeyFromLine( 'ept:') then return false end -- leggo le diverse parti while GetOneEPT() do end return true end ----------------------------------------------------------------- local function GetOneLock( ) local tLock = {} tLock.template = StringFromLine( '- template:') if not tLock.template then return false end tLock.position = LenFromLine( 'position:') tLock.back_set = LenFromLine( 'back_set:') tLock.offset = LenFromLine( 'offset_WS:') tLock.side = StringFromLine( 'side:') tLock.other_door = StringFromLine( 'other_door:') -- per compatibilità con vecchie versioni, se parametro .side == 'lock' lo rinomino in 'lock_top' if tLock.side and tLock.side == 'lock' then tLock.side = 'lock_top' end if not ( tLock.position and tLock.back_set) then -- messaggio errore dati inconguenti DoorOutLog( string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[519]), 0) DGD.ERM = DGD.ERM .. string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[519]) DGD.ERR = -9 return false end table.insert( DGD.tLocks, tLock) -- salvo in tabella local sName = 'lock'..tostring(#DGD.tLocks) table.insert( tGenInfo, {sName ..'_template',tLock.template}) table.insert( tGenInfo, {sName ..'_position',tLock.position}) table.insert( tGenInfo, {sName ..'_back_set',tLock.back_set}) table.insert( tGenInfo, {sName ..'_offset_WS',tLock.offset}) table.insert( tGenInfo, {sName ..'_side',tLock.side}) table.insert( tGenInfo, {sName ..'_other_door',tLock.other_door}) return true end ----------------------------------------------------------------- local function GetLocks() -- leggo la chiave if not KeyFromLine( 'locks:') then return false end -- leggo le diverse parti while GetOneLock() do end return true end ----------------------------------------------------------------- local function GetOneFlushBolt( ) local tFlushBolt = {} tFlushBolt.template = StringFromLine( '- template:') if not tFlushBolt.template then return false end tFlushBolt.type = StringFromLine( 'type:') tFlushBolt.side = StringFromLine( 'side:') tFlushBolt.position = LenFromLine( 'position:') tFlushBolt.offset = LenFromLine( 'offset_WS:') tFlushBolt.back_set = LenFromLine( 'back_set:') tFlushBolt.other_door = StringFromLine( 'other_door:') if not ( tFlushBolt.type and tFlushBolt.side and tFlushBolt.position) then -- messaggio errore dati inconguenti DoorOutLog( string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[520]), 0) DGD.ERM = DGD.ERM .. string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[520]) DGD.ERR = -9 return false end table.insert( DGD.tFlushBolts, tFlushBolt) -- salvo in tabella local sName = 'flush bolt'..tostring(#DGD.tFlushBolts) table.insert( tGenInfo, {sName ..'_template',tFlushBolt.template}) table.insert( tGenInfo, {sName ..'_type',tFlushBolt.type}) table.insert( tGenInfo, {sName ..'_side',tFlushBolt.side}) table.insert( tGenInfo, {sName ..'_position',tFlushBolt.position}) table.insert( tGenInfo, {sName ..'_offset_WS',tFlushBolt.offset}) table.insert( tGenInfo, {sName ..'_back_set',tFlushBolt.back_set}) table.insert( tGenInfo, {sName ..'_other_door',tFlushBolt.other_door}) return true end ----------------------------------------------------------------- local function GetFlushBolts() -- leggo la chiave if not KeyFromLine( 'flush_bolts:') then return false end -- leggo le diverse parti while GetOneFlushBolt() do end return true end ----------------------------------------------------------------- local function GetOneEdgePull() local tEdgePull = {} tEdgePull.template = StringFromLine( '- template:') if not tEdgePull.template then return false end tEdgePull.position = LenFromLine( 'position:') tEdgePull.offset = LenFromLine( 'offset_WS:') if not ( tEdgePull.position) then -- messaggio errore dati inconguenti DoorOutLog( string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[521]), 0) DGD.ERM = DGD.ERM .. string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[521]) DGD.ERR = -9 return false end table.insert( DGD.tEdgePulls, tEdgePull) -- salvo in tabella local sName = 'edge_pull'..tostring(#DGD.tEdgePulls) table.insert( tGenInfo, {sName ..'_template',tEdgePull.template}) table.insert( tGenInfo, {sName ..'_position',tEdgePull.position}) table.insert( tGenInfo, {sName ..'_offset_WS',tEdgePull.offset}) return true end ----------------------------------------------------------------- local function GetEdgePulls() -- leggo la chiave if not KeyFromLine( 'edge_pulls:') then return false end -- leggo le diverse parti while GetOneEdgePull() do end return true end ----------------------------------------------------------------- local function GetOneRollerLatch() local tRollerLatch = {} tRollerLatch.template = StringFromLine( '- template:') if not tRollerLatch.template then return false end tRollerLatch.side = StringFromLine( 'side:') tRollerLatch.position = LenFromLine( 'position:') tRollerLatch.offset = LenFromLine( 'offset_WS:') tRollerLatch.other_door = StringFromLine( 'other_door:') if not ( tRollerLatch.side and tRollerLatch.position) then -- messaggio errore dati inconguenti DoorOutLog( string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[522]), 0) DGD.ERM = DGD.ERM .. string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[522]) DGD.ERR = -9 return false end table.insert( DGD.tRollerLatchs, tRollerLatch) -- salvo in tabella local sName = 'roller_latch'..tostring(#DGD.tRollerLatchs) table.insert( tGenInfo, {sName ..'_template',tRollerLatch.template}) table.insert( tGenInfo, {sName ..'_side',tRollerLatch.side}) table.insert( tGenInfo, {sName ..'_position',tRollerLatch.position}) table.insert( tGenInfo, {sName ..'_offset_WS',tRollerLatch.offset}) table.insert( tGenInfo, {sName ..'_other_door',tRollerLatch.other_door}) return true end ----------------------------------------------------------------- local function GetRollerLatchs() -- leggo la chiave if not KeyFromLine( 'roller_latchs:') then return false end -- leggo le diverse parti while GetOneRollerLatch() do end return true end ----------------------------------------------------------------- local function GetOnePivot() local tPivot = {} tPivot.template = StringFromLine( '- template:') if not tPivot.template then return false end tPivot.type = StringFromLine( 'type:') tPivot.side = StringFromLine( 'side:') tPivot.radius = LenFromLine( 'radius:') tPivot.position = LenFromLine( 'position:') tPivot.back_set = LenFromLine( 'back_set:') tPivot.depth_f = LenFromLine( 'depth:') tPivot.offset = LenFromLine( 'offset_WS:') tPivot.other_door = StringFromLine( 'other_door:') if not ( tPivot.type and tPivot.side and tPivot.position and tPivot.back_set) then -- messaggio errore dati inconguenti DoorOutLog( string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[523]), 0) DGD.ERM = DGD.ERM .. string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[523]) DGD.ERR = -9 return false end table.insert( DGD.tPivots, tPivot) -- salvo in tabella local sName = 'pivot'..tostring(#DGD.tPivots) table.insert( tGenInfo, {sName ..'_template',tPivot.template}) table.insert( tGenInfo, {sName ..'_type',tPivot.type}) table.insert( tGenInfo, {sName ..'_side',tPivot.side}) table.insert( tGenInfo, {sName ..'_radius',tPivot.radius}) table.insert( tGenInfo, {sName ..'_position',tPivot.position}) table.insert( tGenInfo, {sName ..'_back_set',tPivot.back_set}) table.insert( tGenInfo, {sName ..'_depth',tPivot.depth_f}) table.insert( tGenInfo, {sName ..'_offset_WS',tPivot.offset}) table.insert( tGenInfo, {sName ..'_other_door',tPivot.other_door}) return true end ----------------------------------------------------------------- local function GetPivots() -- leggo la chiave if not KeyFromLine( 'pivot:') then return false end -- leggo le diverse parti while GetOnePivot() do end return true end ----------------------------------------------------------------- local function GetOneStopAndCloser( ) local tStopAndCloser = {} tStopAndCloser.template = StringFromLine( '- template:') if not tStopAndCloser.template then return false end tStopAndCloser.position = LenFromLine( 'position:') tStopAndCloser.pocket_offset = LenFromLine( 'pocket_offset_WS:') tStopAndCloser.other_door = StringFromLine( 'other_door:') if not ( tStopAndCloser.position) then -- messaggio errore dati inconguenti DoorOutLog( string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[524]), 0) DGD.ERM = DGD.ERM .. string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[524]) DGD.ERR = -9 return false end table.insert( DGD.tStopsAndClosers, tStopAndCloser) -- salvo in tabella local sName = 'StopAndCloser'..tostring(#DGD.tStopsAndClosers) table.insert( tGenInfo, {sName ..'_template',tStopAndCloser.template}) table.insert( tGenInfo, {sName ..'_position',tStopAndCloser.position}) table.insert( tGenInfo, {sName ..'_pocket_offset',tStopAndCloser.pocket_offset}) table.insert( tGenInfo, {sName ..'_other_door',tStopAndCloser.other_door}) return true end ----------------------------------------------------------------- local function GetStopsAndClosers() -- leggo la chiave if not KeyFromLine( 'stops_and_closers:') then return false end -- leggo le diverse parti while GetOneStopAndCloser() do end return true end ----------------------------------------------------------------- local function GetOneOHead( ) local tOHead = {} tOHead.template = StringFromLine( '- template:') if not tOHead.template then return false end tOHead.pockpos = LenFromLine( 'point_to_pocket:') tOHead.pocklength = LenFromLine( 'pocket_length:') tOHead.pocket_offset = LenFromLine( 'pocket_offset_WS:') tOHead.armpos = LenFromLine( 'point_to_arm:') tOHead.armlength = LenFromLine( 'arm_length:') tOHead.other_door = StringFromLine( 'other_door:') if not ( tOHead.pockpos and tOHead.pocklength and tOHead.armpos and tOHead.armlength) then -- messaggio errore dati inconguenti DoorOutLog( string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[525]), 0) DGD.ERM = DGD.ERM .. string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[525]) DGD.ERR = -9 return false end table.insert( DGD.tOHeads, tOHead) -- salvo in tabella local sName = 'OverHead'..tostring(#DGD.tOHeads) table.insert( tGenInfo, {sName ..'_template',tOHead.template}) table.insert( tGenInfo, {sName ..'_point_to_pocket',tOHead.pockpos}) table.insert( tGenInfo, {sName ..'_pocket_length',tOHead.pocklength}) table.insert( tGenInfo, {sName ..'_pocket_offset_WS',tOHead.pocket_offset}) table.insert( tGenInfo, {sName ..'_point_to_arm',tOHead.armpos}) table.insert( tGenInfo, {sName ..'_arm_length',tOHead.armlength}) table.insert( tGenInfo, {sName ..'_other_door',tOHead.other_door}) return true end ----------------------------------------------------------------- local function GetOverHeads() -- leggo la chiave if not KeyFromLine( 'oh_stop_closer:') then return false end -- leggo le diverse parti while GetOneOHead() do end return true end ----------------------------------------------------------------- local function GetOneStrike( ) local tStrike = {} tStrike.template = StringFromLine( '- template:') if not tStrike.template then return false end tStrike.position = LenFromLine( 'position:') tStrike.back_set = LenFromLine( 'back_set:') tStrike.offset = LenFromLine( 'offset_WS:') tStrike.other_door = StringFromLine( 'other_door:') if not ( tStrike.position and tStrike.back_set) then -- messaggio errore dati inconguenti DoorOutLog( string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[538]), 0) DGD.ERM = DGD.ERM .. string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[538]) DGD.ERR = -9 return false end if not DGD.sFrame or DGD.sFrame == 'L' or DGD.sFrame == 'LE' then table.insert( DGD.tStrikes, tStrike) -- salvo in tabella local sName = 'strike'..tostring(#DGD.tStrikes) table.insert( tGenInfo, {sName ..'_template',tStrike.template}) table.insert( tGenInfo, {sName ..'_position',tStrike.position}) table.insert( tGenInfo, {sName ..'_back_set',tStrike.back_set}) table.insert( tGenInfo, {sName ..'_offset_WS',tStrike.offset}) table.insert( tGenInfo, {sName ..'_other_door',tStrike.other_door}) end return true end ----------------------------------------------------------------- local function GetStrikes() -- leggo la chiave if not KeyFromLine( 'strikes:') then return false end -- leggo le diverse parti while GetOneStrike() do end return true end ----------------------------------------------------------------- local function GetOneGroove( ) local tGroove = {} tGroove.template = StringFromLine( '- template:') if not tGroove.template then return false end tGroove.type = StringFromLine( 'type:') tGroove.width = LenFromLine( 'width:') tGroove.depth = LenFromLine( 'depth:') tGroove.fst = LenFromLine( 'face skin thick:') tGroove.hst = LenFromLine( 'hinge style thick:') tGroove.lst = LenFromLine( 'lock style thick:') tGroove.groove_offset = LenFromLine( 'offset_WS:') tGroove.side = StringFromLine( 'side:') if not ( tGroove.type and tGroove.width and tGroove.depth) and not ( tGroove.type and tGroove.fst and tGroove.hst and tGroove.lst and tGroove.depth) then -- messaggio errore dati incongruenti DoorOutLog( string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[539]), 0) DGD.ERM = DGD.ERM .. string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[539]) DGD.ERR = -9 return false end table.insert( DGD.tGrooves, tGroove) -- salvo in tabella local sName = 'Groove'..tostring(#DGD.tGrooves) table.insert( tGenInfo, {sName ..'_template',tGroove.template}) table.insert( tGenInfo, {sName ..'_type',tGroove.type}) table.insert( tGenInfo, {sName ..'_width',tGroove.width}) table.insert( tGenInfo, {sName ..'_depth',tGroove.depth}) table.insert( tGenInfo, {sName ..'_face_skin_thick',tGroove.fst}) table.insert( tGenInfo, {sName ..'_hinge_skin_thick',tGroove.hst}) table.insert( tGenInfo, {sName ..'_lock_skin_thick',tGroove.lst}) table.insert( tGenInfo, {sName ..'_offset_WS',tGroove.groove_offset}) table.insert( tGenInfo, {sName ..'_side',tGroove.side}) return true end ----------------------------------------------------------------- local function GetGrooves() -- leggo la chiave if not KeyFromLine( 'groove:') then return false end -- leggo le diverse parti while GetOneGroove() do end return true end ----------------------------------------------------------------- local function GetOneRabbet( ) local tRabbet = {} tRabbet.template = StringFromLine( '- template:') if not tRabbet.template then return false end tRabbet.side = StringFromLine( 'side:') tRabbet.width = LenFromLine( 'width:') tRabbet.depth = LenFromLine( 'depth:') tRabbet.angle = LenFromLine( 'angle:', true) tRabbet.oppo = LenFromLine( 'opposite:', true) if not ( tRabbet.side and tRabbet.width and tRabbet.depth) then -- messaggio errore dati inconguenti DoorOutLog( string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[550]), 0) DGD.ERM = DGD.ERM .. string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[550]) DGD.ERR = -9 return false end table.insert( DGD.tRabbets, tRabbet) -- salvo in tabella local sName = 'Rabbet'..tostring(#DGD.tRabbets) table.insert( tGenInfo, {sName ..'_template',tRabbet.template}) table.insert( tGenInfo, {sName ..'_side',tRabbet.side}) table.insert( tGenInfo, {sName ..'_width',tRabbet.width}) table.insert( tGenInfo, {sName ..'_depth',tRabbet.depth}) table.insert( tGenInfo, {sName ..'_angle',tRabbet.angle}) table.insert( tGenInfo, {sName ..'_opposite',tRabbet.oppo}) return true end ----------------------------------------------------------------- local function GetRabbets() -- leggo la chiave if not KeyFromLine( 'rabbet:') then return false end -- leggo le diverse parti while GetOneRabbet() do -- se è un frame lato lock o hinge, Exterior if DGD.sFrame and ( DGD.sFrame == 'LE' or DGD.sFrame == 'HE' or DGD.sFrame == 'TE' or DGD.sFrame == 'BE') then -- prendo il parametro di affondamento del rabbet sul lato local sRabbetType = DGD.tRabbets[#DGD.tRabbets].side if sRabbetType == 'hinge' or sRabbetType == 'lock' then if DGD.dZedExtFrame == 0 then DGD.dZedExtFrame = DGD.tRabbets[#DGD.tRabbets].depth end if DGD.dSideExtFrame == 0 and ( DGD.sFrame == 'LE' or DGD.sFrame == 'HE') then DGD.dSideExtFrame = DGD.tRabbets[#DGD.tRabbets].depth end -- prendo la larghezza del rabbet per il sill( frame bottom) con angolo if DGD.sFrame == 'LE' or DGD.sFrame == 'HE' then if DGD.dWidthRabbet == 0 then DGD.dWidthRabbet = DGD.tRabbets[#DGD.tRabbets].width end end end end end return true end ----------------------------------------------------------------- local function GetOneDecoration( ) local tDecoration = {} tDecoration.template = StringFromLine( '- template:') if not tDecoration.template then return false end tDecoration.type = StringFromLine( 'type:') tDecoration.depth = LenFromLine( 'depth:') tDecoration.dft = LenFromLine( 'topdistance:') tDecoration.dfb = LenFromLine( 'bottomdistance:') tDecoration.dfl = LenFromLine( 'lockstiledistance:') tDecoration.dfh = LenFromLine( 'hingestiledistance:') tDecoration.face = StringFromLine( 'face:') if not ( tDecoration.face and tDecoration.type) then -- messaggio errore dati incongruenti DoorOutLog( string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[646]), 0) DGD.ERM = DGD.ERM .. string.format(EgtDoorsMsg[512], GetLineNumber(), EgtDoorsMsg[646]) DGD.ERR = -9 return false end table.insert( DGD.tDecorations, tDecoration) -- salvo in tabella local sName = 'Face Decoration'..tostring(#DGD.tDecorations) table.insert( tGenInfo, {sName ..'_template',tDecoration.template}) table.insert( tGenInfo, {sName ..'_type',tDecoration.type}) table.insert( tGenInfo, {sName ..'_depth',tDecoration.depth}) table.insert( tGenInfo, {sName ..'_distance_from_top',tDecoration.dft}) table.insert( tGenInfo, {sName ..'_distance_from_bottom',tDecoration.dfb}) table.insert( tGenInfo, {sName ..'_distance_from_lock',tDecoration.dfl}) table.insert( tGenInfo, {sName ..'_distance_from_hinge',tDecoration.dfh}) table.insert( tGenInfo, {sName ..'_face',tDecoration.face}) return true end ----------------------------------------------------------------- local function GetDecorations() -- leggo la chiave if not KeyFromLine( 'face_decoration:') then return false end -- leggo le diverse parti while GetOneDecoration() do end return true end ----------------------------------------------------------------- local function GetOptions() -- leggo la chiave if not KeyFromLine( 'options:') then return false end -- mentre non è finito il file while not( CheckKeyFromLine( '---') or CheckKeyFromLine( '...') or EndOfFile()) do -- leggo tutte le voci dell'ordine line = GetLine() -- leggo la voce line = EgtTrim( line) table.insert( DGD.tOptions, line) end -- salvo in tabella table.insert( tGenInfo, {'Options', table.concat( DGD.tOptions, ',')}) return true end ------------------------------------------------------------------------- -- *** Insert probe point into door piece *** ------------------------------------------------------------------------- local function InsertProbeGeom( nIdGeom, ptPosGeom, ptFromExt, nTypeHw, nNumSide) if not DGD.sFrame and DGD.MachEn > 0 then -- cerco se ho delle geometrie di tastatura con gli shuttle su lato hinge o lato lock local bFoundShuttleProbe local nIdEnt = EgtGetFirstInGroup( nIdGeom) -- ottengo prima entità while nIdEnt do local sNameEnt = EgtGetName( nIdEnt) or '' if sNameEnt and string.find( sNameEnt, 'Hinge_Probe') or string.find( sNameEnt, 'Shuttle_Probe') then bFoundShuttleProbe = true break end nIdEnt = EgtGetNext(nIdEnt) end -- ottengo le note kbs o pbs dal layer local bExistsKbs = EgtGetInfo( nIdGeom, 'kbs', 'i') or 0 local bExistspbs = EgtGetInfo( nIdGeom, 'pbs', 'i') or 0 local bProbeParGeom = ptPosGeom and ( bExistsKbs > 0 or bExistspbs > 0) -- foro lato secure e parametri probe esistenti oppure presente shuttle probe if bFoundShuttleProbe or bProbeParGeom then DGD.CPR = DGD.CPR + 1 -- assegnazione nota a tutte le geometrie del layer nIdEnt = EgtGetFirstInGroup( nIdGeom) -- ottengo prima entità while nIdEnt do EgtSetInfo( nIdEnt, 'ProbeId', DGD.CPR) nIdEnt = EgtGetNext(nIdEnt) end end if bProbeParGeom then -- se prod comanda tastature (completa o solo ricalcolo dimensioni) ed è presente il flag if DGD.PROBE == 1 and bExistsKbs > 0 then EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.BOTTOM)) local pCenter = Point3d( ptPosGeom:getX(),-ptPosGeom:getY(),0) local nCircle = EgtArc( nIdGeom, pCenter, 0.25, 0, 360, 0, GDB_RT.GRID) if nCircle then EgtModifyCurveThickness( nCircle, -5) EgtSetName( nCircle,'ProbePoint_secure') EgtSetInfo( nCircle, 'ProbeId', DGD.CPR) end EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) end -- creazione geometria di tastatura laterale if DGD.PROBE == 0 and bExistspbs > 0 and DGC.Pms and ( DGC.Pms == 3 or ( DGC.Pms == 4 and nTypeHw and nTypeHw ~= 5 and nTypeHw ~= 17)) and ptFromExt then local nLine = EgtLine( nIdGeom, Point3d( ptFromExt:getX(), ptFromExt:getY(), 0), Point3d( ptPosGeom:getX(), ptPosGeom:getY(), 0), GDB_RT.GLOB) if nLine then -- se linea più lunga di un millimetro la accorcio o viceversa se è più corta local dDist = dist( Point3d( ptFromExt:getX(), ptFromExt:getY(), 0), Point3d( ptPosGeom:getX(), ptPosGeom:getY(), 0)) if dDist < 0.9 or dDist > 1.1 then EgtTrimExtendCurveByLen( nLine, 1-dDist, Point3d( ptPosGeom:getX(), ptPosGeom:getY(), 0), GDB_RT.GLOB) end EgtModifyCurveThickness( nLine, 0) EgtSetName( nLine,'ProbeSidePoint_secure') EgtSetInfo( nLine, 'ProbeId', DGD.CPR) EgtSetInfo( nLine, 'SideApplied', nNumSide) end end end -- se prod comanda tastature (completa o solo ricalcolo dimensioni) ed è presente il flag inserisco foro lato keyway -- foro lato keyway if DGD.PROBE == 1 and bExistsKbs > 0 and ptPosGeom then EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) local pCenter = Point3d( ptPosGeom:getX(),ptPosGeom:getY(),DGD.dT) local nCircle = EgtArc( nIdGeom, pCenter, 0.25, 0, 360, 0, GDB_RT.GRID) if nCircle then EgtModifyCurveThickness( nCircle, -5) EgtSetName( nCircle,'ProbePoint_keyway') EgtSetInfo( nCircle, 'ProbeId', DGD.CPR) end end -- creazione geometria di tastatura laterale if ptPosGeom and DGD.PROBE == 0 and bExistspbs > 0 and DGC.Pms and ( DGC.Pms == 3 or ( DGC.Pms == 4 and nTypeHw and nTypeHw ~= 5 and nTypeHw ~= 17)) and ptFromExt then local nLine = EgtLine( nIdGeom, Point3d( ptFromExt:getX(), ptFromExt:getY(), DGD.dT), Point3d( ptPosGeom:getX(), ptPosGeom:getY(), DGD.dT), GDB_RT.GLOB) if nLine then -- se linea più lunga di un millimetro la accorcio o viceversa se è più corta local dDist = dist( Point3d( ptFromExt:getX(), ptFromExt:getY(), DGD.dT), Point3d( ptPosGeom:getX(), ptPosGeom:getY(), DGD.dT)) if dDist < 0.9 or dDist > 1.1 then EgtTrimExtendCurveByLen( nLine, 1-dDist, Point3d( ptPosGeom:getX(), ptPosGeom:getY(), 0), GDB_RT.GLOB) end EgtModifyCurveThickness( nLine, 0) EgtSetName( nLine,'ProbeSidePoint_keyway') EgtSetInfo( nLine, 'ProbeId', DGD.CPR) EgtSetInfo( nLine, 'SideApplied', nNumSide) end end end end ------------------------------------------------------------------------- -- *** Geometric processing : VISION, LOUVER, MAIL *** ------------------------------------------------------------------------- local function MoveCutOuts( tCutOut, sSideLk, bPushDr, bImport, nTypeCout) if not tCutOut then return end if not tCutOut.geom then return end if not DGD.SPLIT and DGD.SPLIT ~= nil then return end local ptPos local ptRef local dZedPos = 0 local dExtraPosX = 0 local dExtraPosY = 0 local nAngleBase local nRadBase -- setto presenza cutout DGD.ExistCutOut = true -- rilevo e setto presenza hatching sfridi if not EgtGetInfo( tCutOut.geom, 'hatch', 'b') then DGD.NotExistHatch = true end if bImport then dZedPos = DGD.dT end -- se vision cut out if nTypeCout == 1 then if tCutOut.lock_stile and tCutOut.top_rail then if tCutOut.split and tCutOut.dir and tCutOut.dir == '1' then if sSideLk == 'L' then -- se serratura a sinistra dExtraPosX = 0 else dExtraPosX = DGD.dW - tCutOut.width end if abs(tCutOut.top_rail) > 0 then dExtraPosY = 0 else dExtraPosY = (DGD.dH - tCutOut.width) / 2 end else dExtraPosX = EgtIf( tCutOut.door_center == 'center', (( DGD.dW - tCutOut.width)/2), 0) end if sSideLk == 'L' then -- se serratura a sinistra if bRemake then nAngleBase = atan((tCutOut.lock_stile + dExtraPosX),tCutOut.top_rail) nRadBase = sqrt(((tCutOut.lock_stile + dExtraPosX)*(tCutOut.lock_stile + dExtraPosX))+(tCutOut.top_rail*tCutOut.top_rail)) ptRef = DGD.PminTop ptPos = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A4+nAngleBase)), ptRef:getY()+(nRadBase*sin(DGD.A4+nAngleBase)) , dZedPos) else ptPos = Point3d( ( tCutOut.lock_stile + dExtraPosX), ( DGD.dH - tCutOut.top_rail - dExtraPosY), dZedPos) end else -- if tCutOut.width < 0 then tCutOut.width = DGD.dW end -- vecchia modalita per creare porta ad arco if bRemake then nAngleBase = atan((tCutOut.lock_stile + tCutOut.width + dExtraPosX),tCutOut.top_rail) nRadBase = sqrt(((tCutOut.lock_stile + tCutOut.width + dExtraPosX)*(tCutOut.lock_stile + tCutOut.width + dExtraPosX))+(tCutOut.top_rail*tCutOut.top_rail)) ptRef = DGD.PmaxTop ptPos = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A7-nAngleBase)), ptRef:getY()+(nRadBase*sin(DGD.A7-nAngleBase)) , dZedPos) else ptPos = Point3d( ( DGD.dW - tCutOut.lock_stile - tCutOut.width - dExtraPosX), ( DGD.dH - tCutOut.top_rail - dExtraPosY), dZedPos) end end else dExtraPosX = EgtIf( tCutOut.door_center == 'center', (DGD.dW/2), 0) if bRemake then nAngleBase = atan((tCutOut.center_from_lock + dExtraPosX),tCutOut.center_from_top) nRadBase = sqrt(((tCutOut.center_from_lock + dExtraPosX)*(tCutOut.center_from_lock + dExtraPosX))+(tCutOut.center_from_top*tCutOut.center_from_top)) end if sSideLk == 'L' then -- se serratura a sinistra if bRemake then ptRef = DGD.PminTop ptPos = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A4+nAngleBase)), ptRef:getY()+(nRadBase*sin(DGD.A4+nAngleBase)) , dZedPos) else ptPos = Point3d( ( tCutOut.center_from_lock + dExtraPosX), DGD.dH - tCutOut.center_from_top, dZedPos) end else if bRemake then ptRef = DGD.PmaxTop ptPos = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A7-nAngleBase)), ptRef:getY()+(nRadBase*sin(DGD.A7-nAngleBase)) , dZedPos) else ptPos = Point3d( ( DGD.dW - tCutOut.center_from_lock - dExtraPosX), DGD.dH - tCutOut.center_from_top, dZedPos) end end end -- per non scaricare sfrido quando corto e cade if DGD.LENGTH and DGD.LENGTH < 400 then DGD.NotExistHatch = false end -- se louver cut out elseif nTypeCout == 2 then dExtraPosX = EgtIf( tCutOut.door_center == 'center', (( DGD.dW - tCutOut.width)/2), 0) if sSideLk == 'L' then -- se serratura a sinistra if bRemake then nAngleBase = atan((tCutOut.lock_stile + dExtraPosX),tCutOut.bottom_rail) nRadBase = sqrt(((tCutOut.lock_stile + dExtraPosX)*(tCutOut.lock_stile + dExtraPosX))+(tCutOut.bottom_rail*tCutOut.bottom_rail)) ptRef = DGD.PminBot ptPos = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A3-nAngleBase)), ptRef:getY()+(nRadBase*sin(DGD.A3-nAngleBase)) , dZedPos) else ptPos = Point3d( ( tCutOut.lock_stile + dExtraPosX), tCutOut.bottom_rail, dZedPos) end else if bRemake then nAngleBase = atan((tCutOut.lock_stile + tCutOut.width + dExtraPosX),tCutOut.bottom_rail) nRadBase = sqrt(((tCutOut.lock_stile + tCutOut.width + dExtraPosX)*(tCutOut.lock_stile + tCutOut.width + dExtraPosX))+(tCutOut.bottom_rail*tCutOut.bottom_rail)) ptRef = DGD.PmaxBot ptPos = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A8+nAngleBase)), ptRef:getY()+(nRadBase*sin(DGD.A8+nAngleBase)) , dZedPos) else ptPos = Point3d( ( DGD.dW - tCutOut.lock_stile - tCutOut.width - dExtraPosX), tCutOut.bottom_rail, dZedPos) end end -- per non scaricare sfrido quando corto e cade if DGD.LENGTH and DGD.LENGTH < 400 then DGD.NotExistHatch = false end -- se mail slot elseif nTypeCout == 6 then if sSideLk == 'L' then -- se serratura a sinistra if bRemake then nAngleBase = atan((( DGD.dW / 2) + tCutOut.delta_center),tCutOut.bottom_rail) nRadBase = sqrt(((( DGD.dW / 2) + tCutOut.delta_center)*(( DGD.dW / 2) + tCutOut.delta_center))+(tCutOut.bottom_rail*tCutOut.bottom_rail)) ptRef = DGD.PminBot ptPos = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A3-nAngleBase)), ptRef:getY()+(nRadBase*sin(DGD.A3-nAngleBase)) , dZedPos) else ptPos = Point3d( ( ( DGD.dW / 2) + tCutOut.delta_center), tCutOut.bottom_rail, dZedPos) end else if bRemake then nAngleBase = atan((( DGD.dW / 2) - tCutOut.delta_center),tCutOut.bottom_rail) nRadBase = sqrt(((( DGD.dW / 2) - tCutOut.delta_center)*(( DGD.dW / 2) - tCutOut.delta_center))+(tCutOut.bottom_rail*tCutOut.bottom_rail)) ptRef = DGD.PmaxBot ptPos = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A8+nAngleBase)), ptRef:getY()+(nRadBase*sin(DGD.A8+nAngleBase)) , dZedPos) else ptPos = Point3d( ( ( DGD.dW / 2) - tCutOut.delta_center), tCutOut.bottom_rail, dZedPos) end end -- per non scaricare sfrido (in questo caso piccolo e cade) DGD.NotExistHatch = false end EgtMove( tCutOut.geom, ptPos - ORIG()) if bRemake then if abs(dExtraPosX) > 0 or tCutOut.delta_center then local dAngleLoc dAngleLoc = (DGD.A3 + DGD.A8) / 2 EgtRotate( tCutOut.geom, ptPos, Z_AX(), ( dAngleLoc-90)) else EgtRotate( tCutOut.geom, ptPos, Z_AX(), ( EgtIf( sSideLk == 'L', DGD.A3, DGD.A8)-90)) end end if bImport then EgtModifyCurveThickness(tCutOut.geom, -DGD.dT) -- se non ci sono tagli di hatching if DGD.NotExistHatch then -- creo estrusi e superfici piane delle geometrie passanti AddSurfTmByExtrusion( tCutOut.geom, tCutOut.geom, false) else -- creo estrusi e superfici piane delle geometrie passanti AddSurfTmByExtrusion( tCutOut.geom, tCutOut.geom, false, 1) end end -- sposto gli estrusi e le superfici piane nel layer solid AddFlatSurf( tCutOut.geom, tCutOut.geom) end ------------------------------------------------------------------------- -- *** Geometric processing : FLUSH_PULL *** ------------------------------------------------------------------------- local function MoveFlushPull( tFlushPull, sSideLk, bPushDr, bImport) if not tFlushPull then return end if not tFlushPull.geom then return end local ptPos local ptPosBox local ptRef local dZedPos = 0 local nNewEnt local sTypeInfo local sKeepBSNote local nAngleBase local nRadBase local nRadBaseBox -- sul lato keyway o secure if bImport then nNewEnt = EgtGetFirstInGroup( tFlushPull.geom) -- ottengo nuova entità while nNewEnt do sTypeInfo = EgtGetInfo( nNewEnt, 'SideDoor') if sTypeInfo then EgtSetInfo( nNewEnt, 'SideDoor', '') end nNewEnt = EgtGetNext(nNewEnt) end end -- setto la faccia dove portare la geometrie if not DGD.FACE then -- se non ho definito il face la setto come era prima if bPushDr then -- se porta a spingere la geometria va dietro DGD.FACE = 'secure' else -- altrimenti DGD.FACE = 'keyway' end end if string.lower(DGD.FACE) == 'secure' then -- se specificato face su lato interno (dietro) -- faccio il mirror di tutte le geometrie su asse Z nNewEnt = EgtGetFirstInGroup( tFlushPull.geom) -- ottengo nuova entità while nNewEnt do EgtMirror( nNewEnt, ORIG(), Z_AX()) -- faccio il mirror su asse Z nNewEnt = EgtGetNext(nNewEnt) end if not bImport then dZedPos = DGD.dT InvertSurfName( tFlushPull.geom) end else -- altrimenti va su lato esterno (davanti) if bImport then dZedPos = DGD.dT end end if bRemake then nAngleBase = atan(tFlushPull.back_set,tFlushPull.position) nRadBase = sqrt((tFlushPull.back_set*tFlushPull.back_set)+(tFlushPull.position*tFlushPull.position)) nRadBaseBox = tFlushPull.position end if sSideLk == 'L' then -- se serratura a sinistra if bRemake then ptRef = DGD.PminTop ptPos = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A4+nAngleBase)), ptRef:getY()+(nRadBase*sin(DGD.A4+nAngleBase)) , dZedPos) ptPosBox = Point3d( ptRef:getX()+(nRadBaseBox*cos(DGD.A4)), ptRef:getY()+(nRadBaseBox*sin(DGD.A4)) , dZedPos) else ptPos = Point3d( tFlushPull.back_set, DGD.dH - tFlushPull.position, dZedPos) ptPosBox = Point3d( 0, DGD.dH - tFlushPull.position, dZedPos) end else if bRemake then ptRef = DGD.PmaxTop ptPos = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A7-nAngleBase)), ptRef:getY()+(nRadBase*sin(DGD.A7-nAngleBase)) , dZedPos) ptPosBox = Point3d( ptRef:getX()+(nRadBaseBox*cos(DGD.A7)), ptRef:getY()+(nRadBaseBox*sin(DGD.A7)) , dZedPos) else ptPos = Point3d( DGD.dW - tFlushPull.back_set, DGD.dH - tFlushPull.position, dZedPos) ptPosBox = Point3d( DGD.dW, DGD.dH - tFlushPull.position, dZedPos) end -- faccio il mirror di tutte le geometrie in X nNewEnt = EgtGetFirstInGroup( tFlushPull.geom) -- ottengo nuova entità while nNewEnt do EgtMirror( nNewEnt, ORIG(), X_AX()) -- faccio il mirror in X nNewEnt = EgtGetNext(nNewEnt) end end -- ciclo spostamento e rotazione di tutte le geometrie del flush_pull nNewEnt = EgtGetFirstInGroup( tFlushPull.geom) -- ottengo la prima geometria while nNewEnt do local bReference = EgtGetInfo( nNewEnt, 'ReferHw', 'b') or false local ptPosLoc = ptPos if bReference then ptPosLoc = Point3d( ptPosBox:getX(), ptPosLoc:getY() , ptPosLoc:getZ()) end EgtMove( nNewEnt, ptPosLoc - ORIG()) -- EgtSaveFile( sNgeFile) if bRemake then EgtRotate( nNewEnt, ptPosLoc, Z_AX(), ( EgtIf( sSideLk == 'L', DGD.A3, DGD.A8)-90)) -- EgtSaveFile( sNgeFile) end AddSurfTmByExtrusion( EgtGetParent(nNewEnt), nNewEnt, true) -- sposto gli estrusi e le superfici piane nel layer solid AddFlatSurf( tFlushPull.geom, tFlushPull.geom) nNewEnt = EgtGetNext(nNewEnt) end --[[ -- spostamento e rotazione del layer del flush_pull EgtMove( tFlushPull.geom, ptPos - ORIG()) if bRemake then EgtRotate( tFlushPull.geom, ptPos, Z_AX(), ( EgtIf( sSideLk == 'L', DGD.A3, DGD.A8)-90)) end if bImport then -- creo estrusi e superfici piane delle geometrie passanti AddSurfTmByExtrusion( tFlushPull.geom, tFlushPull.geom, false) end -- sposto gli estrusi e le superfici piane nel layer solid AddFlatSurf( tFlushPull.geom, tFlushPull.geom) ]]-- -- setto le note per il probe in Z in base a dove si sono piazzate -- devo ottenere tutte le geometrie nNewEnt = EgtGetFirstInGroup( tFlushPull.geom) -- ottengo la prima geometria while nNewEnt do sKeepBSNote = EgtGetInfo( nNewEnt, 'KeepBackSet') if sKeepBSNote == 'x' then -- se ha la nota la modifico in funzione a dove è stata piazzata -- se geometria su lato wide, risetto la nota opportuna if ( string.lower(DGD.FACE) == 'secure' and bPushDr) or ( string.lower(DGD.FACE) == 'keyway' and not bPushDr) then EgtSetInfo( nNewEnt, 'KeepBackSet', 'w') -- setto 'w' perché la profondità non passante è applicata sul lato wide else -- altrimenti è sul lato narrow EgtSetInfo( nNewEnt, 'KeepBackSet', 'n') -- setto 'n' perché la profondità non passante è applicata sul lato narrow end end nNewEnt = EgtGetNext(nNewEnt) end InsertProbeGeom( tFlushPull.geom, ptPos) end ----------------------------------------------- -- *** Geometric subgeom processing : HINGE *** ----------------------------------------------- local function MoveSubGeomHinge( nSubHingeId, sSideDoor, sSideLk, bPushDr, ptPos, nExtraAngle, ptPosUpGeom, ptPosDwGeom) local nUpperToDelete -- rinomino eventuali geometrie che descrivono solo la sezione if sSideDoor and sSideDoor == 'upper' then if not DGD.Dws then -- se disposizione frame su lato narrow o porta if bPushDr then EgtSetInfo( nSubHingeId, 'SideDoor', 'secure') sSideDoor = 'secure' else EgtSetInfo( nSubHingeId, 'SideDoor', 'keyway') sSideDoor = 'keyway' end else EgtSetInfo( nSubHingeId, 'SideDoor', 'keyway') sSideDoor = 'keyway' end nUpperToDelete = nSubHingeId end -- se non ha nota o ha la nota hinge if not sSideDoor or string.lower( sSideDoor) == 'hinge' then EgtRotate( nSubHingeId, ORIG(), X_AX(), ( 90 + nExtraAngle)) -- ruoto su faccia frontale if sSideLk == 'L' then -- se serratura a sinistra EgtRotate( nSubHingeId, ORIG(), Z_AX(), 90 ) -- ruoto su faccia destra else EgtRotate( nSubHingeId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra end if bPushDr then -- se apertura a spingere EgtRotate( nSubHingeId, ORIG(), X_AX(), 180 ) -- ruoto attorno a X per capovolgere la cerniera end EgtMove( nSubHingeId, ptPos - ORIG()) elseif sSideDoor == 'locklh' or sSideDoor == 'sidelh' then -- se posizionamento serratura tipo cerniera if sSideDoor == 'locklh' then nExtraAngle = 0 end EgtRotate( nSubHingeId, ORIG(), X_AX(), ( 90 + nExtraAngle)) -- ruoto su faccia frontale con angolo if sSideLk == 'L' then -- se serratura a sinistra EgtRotate( nSubHingeId, ORIG(), Z_AX(), 90 ) -- ruoto su faccia destra else EgtRotate( nSubHingeId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra end if bPushDr then -- se apertura a spingere EgtRotate( nSubHingeId, ORIG(), X_AX(), 180 ) -- ruoto attorno a X per capovolgere la cerniera end EgtMove( nSubHingeId, ptPos - ORIG()) elseif sSideDoor == 'keyway' or sSideDoor == 'secure' then if not DGD.Dws then -- se disposizione frame su lato narrow o porta if sSideLk == 'L' then -- se serratura a sinistra EgtRotate( nSubHingeId, ORIG(), Z_AX(), 90 ) -- ruoto su faccia destra else EgtRotate( nSubHingeId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra end if bPushDr then -- se apertura a spingere EgtRotate( nSubHingeId, ORIG(), X_AX(), 180 ) -- ruoto attorno a X per capovolgere la cerniera end if sSideDoor == 'keyway' then EgtMove( nSubHingeId, ptPosUpGeom - ORIG()) elseif sSideDoor == 'secure' then EgtMove( nSubHingeId, ptPosDwGeom - ORIG()) end else EgtRotate( nSubHingeId, ORIG(), X_AX(), 90 ) -- ruoto su faccia frontale con angolo if sSideLk == 'L' then -- se serratura a sinistra EgtRotate( nSubHingeId, ORIG(), Z_AX(), 90 ) -- ruoto su faccia destra else EgtRotate( nSubHingeId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra end if bPushDr then -- se apertura a spingere EgtRotate( nSubHingeId, ORIG(), X_AX(), 180 ) -- ruoto attorno a X per capovolgere la cerniera end EgtMove( nSubHingeId, ptPos - ORIG()) end -- creo estrusi e superfici piane delle geometrie passanti AddSurfTmByExtrusion( EgtGetParent(nSubHingeId), nSubHingeId, true) -- sposto gli estrusi e le superfici piane nel layer solid AddFlatSurf( EgtGetParent(nSubHingeId), EgtGetParent(nSubHingeId)) end return nUpperToDelete end --------------------------------------------- -- *** Geometric subgeom processing : EPT *** --------------------------------------------- local function MoveSubGeomEpt( nSubEptId, sSideDoor, sSideLk, bPushDr, ptPos, nExtraAngle) local nUpperToDelete -- rinomino eventuali geometrie che descrivono solo la sezione if sSideDoor and sSideDoor == 'upper' then if DGD.Dws then -- se disposizione frame su lato wide EgtSetInfo( nSubEptId, 'SideDoor', 'keyway') sSideDoor = 'keyway' end nUpperToDelete = nSubEptId end -- se geometria sul fianco if sSideDoor == 'lock' or sSideDoor == 'side' then -- if bPushDr then -- nExtraAngle = - nExtraAngle -- end if sSideDoor == 'lock' then nExtraAngle = 0 end EgtRotate( nSubEptId, ORIG(), X_AX(), ( 90 + nExtraAngle)) -- ruoto su faccia frontale con angolo EgtRotate( nSubEptId, ORIG(), Z_AX(), 90 ) -- ruoto su faccia destra if sSideLk == 'R' then -- se serratura a destra EgtMirror( nSubEptId, ORIG(), X_AX()) -- faccio il mirror su asse Y end EgtMove( nSubEptId, ptPos - ORIG()) elseif sSideDoor == 'locklh' or sSideDoor == 'sidelh' then -- se posizionamento serratura tipo cerniera -- cambio di segno ancora un'altra volta if bPushDr then nExtraAngle = - nExtraAngle end if sSideDoor == 'locklh' then nExtraAngle = 0 end EgtRotate( nSubEptId, ORIG(), X_AX(), ( 90 + nExtraAngle)) -- ruoto su faccia frontale con angolo if sSideLk == 'L' then -- se serratura a sinistra EgtRotate( nSubEptId, ORIG(), Z_AX(), 90 ) -- ruoto su faccia destra else EgtRotate( nSubEptId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra end if bPushDr then -- se apertura a spingere EgtRotate( nSubEptId, ORIG(), X_AX(), 180 ) -- ruoto attorno a X per capovolgere la cerniera end EgtMove( nSubEptId, ptPos - ORIG()) elseif sSideDoor == 'keyway' or sSideDoor == 'secure' then if DGD.Dws then -- se disposizione frame su lato wide EgtRotate( nSubEptId, ORIG(), X_AX(), 90) -- ruoto su faccia frontale con angolo if sSideLk == 'L' then -- se serratura a sinistra EgtRotate( nSubEptId, ORIG(), Z_AX(), 90 ) -- ruoto su faccia destra else EgtRotate( nSubEptId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra end if bPushDr then -- se apertura a spingere EgtRotate( nSubEptId, ORIG(), X_AX(), 180 ) -- ruoto attorno a X per capovolgere la cerniera end EgtMove( nSubEptId, ptPos - ORIG()) end -- creo estrusi e superfici piane delle geometrie passanti AddSurfTmByExtrusion( EgtGetParent(nSubEptId), nSubEptId, true) -- sposto gli estrusi e le superfici piane nel layer solid AddFlatSurf( EgtGetParent(nSubEptId), EgtGetParent(nSubEptId)) end return nUpperToDelete end ----------------------------------------------------------------------- -- *** Geometric processing : common functions for hinge and Ept *** ----------------------------------------------------------------------- local function MoveGeometryHng( sTypeGeom, nGeomId, sSideLk, bPushDr, ptPos, nExtraAngle, ptPosUpGeom, ptPosDwGeom) if not nGeomId then return end -- se profilo lato cerniere è bevel setto il supplemento di rotazione local nIdGeomType local sSideDoorToMove local sMessageErr = '' if nExtraAngle > 0 and sTypeGeom == 'ept' then if bPushDr then nExtraAngle = - nExtraAngle end end -- ottengo la prima geometria nIdGeomType = EgtGetFirstInGroup( nGeomId) local nErr = 0 while nIdGeomType do sSideDoorToMove = EgtGetInfo( nIdGeomType, 'SideDoor') local nUpperToDelete if sSideDoorToMove and sTypeGeom == 'ept' then -- Controllo se la nota è corretta local sSideDoor = string.lower(sSideDoorToMove) -- lock: senza rotazione angolo profilo; side: con rotazione angolo profilo; keyway e Secure: no rotazione angolo profilo; -- SideLH: con rotazione angolo profilo e disposizione come cerniera ( suffisso LH: like hinge), cioè senza effettuare mirror; -- LockLH: senza rotazione agolo profilo e disposizione come cerniera ( suffisso LH: like hinge), cioè senza effettuare mirror -- attenzione! la geometria con nota SideLH DEVE ESSERE SIMMETRICA sulla X e Y locale -- attenzione! la geometria con nota LockLH DEVE ESSERE SIMMETRICA sulla X e Y locale if sSideDoor == 'lock' or sSideDoor == 'side' or sSideDoor == 'sidelh' or sSideDoor == 'locklh' or sSideDoor == 'upper' then nUpperToDelete = MoveSubGeomEpt( nIdGeomType, sSideDoor, sSideLk, bPushDr, ptPos, nExtraAngle) else -- messaggio di errore sMessageErr = string.format( EgtDoorsMsg[413],nIdGeomType,'Ept',nGeomId, sSideDoor, DGD.FILE) DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr nErr = 1019 end else -- messaggio di errore in base al tipo di pezzo if sTypeGeom == 'ept' then sMessageErr = string.format( EgtDoorsMsg[414],nIdGeomType,'Ept',nEdgePId, DGD.FILE) DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr nErr = 1020 else -- altrimenti è hinge local sSideDoor -- Acquisisco la nota if sSideDoorToMove then sSideDoor = string.lower(sSideDoorToMove) end -- SideLH: con rotazione angolo profilo e disposizione come cerniera ( suffisso LH: like hinge), cioè senza effettuare mirror; -- LockLH: senza rotazione agolo profilo e disposizione come cerniera ( suffisso LH: like hinge), cioè senza effettuare mirror nUpperToDelete = MoveSubGeomHinge( nIdGeomType, sSideDoor, sSideLk, bPushDr, ptPos, nExtraAngle, ptPosUpGeom, ptPosDwGeom) end end nIdGeomType = EgtGetNext(nIdGeomType) -- cancello il percorso 'upper' if nUpperToDelete then EgtErase( nUpperToDelete) end end -- assegno codice errore se ancora non fatto if DGD.ERR == 0 then DGD.ERR = nErr end end ----------------------------------------------------------------- -- *** Geometric processing : HINGES *** ----------------------------------------------------------------- local function MoveHinge( tHinge, sSideLk, bPushDr) if not tHinge then return end if not tHinge.geom then return end local dDeltaPos = 0 local sDeltaPos = EgtGetInfo( tHinge.geom, 'DeltaPos') if sDeltaPos then dDeltaPos = tonumber( sDeltaPos) end if DGD.sFrame then sSideLk = EgtIf( sSideLk == 'L', 'R', 'L') end local ptPos local ptRef local ptProbe local ptFromExt local dZedPos = EgtIf( bPushDr, 0, DGD.dT) local ptPosUpGeom local ptPosDwGeom if sSideLk == 'L' then -- se serratura a sinistra if DGD.sFrame then ptPos = Point3d( DGD.dW - DGD.dZedExtFrame, ( DGD.dH - tHinge.position - dDeltaPos), dZedPos) ptProbe = Point3d( DGD.dW - DGD.DPR, ( DGD.dH - tHinge.position - dDeltaPos), 0) else if bRemake then ptRef = DGD.PmaxTop ptPos = Point3d( ptRef:getX()+((tHinge.position + dDeltaPos)*cos(DGD.A7)), ptRef:getY()+((tHinge.position + dDeltaPos)*sin(DGD.A7)) , dZedPos) else ptPos = Point3d( DGD.dW, ( DGD.dH - tHinge.position - dDeltaPos), dZedPos) ptProbe = Point3d( DGD.dW - DGD.DPR, ( DGD.dH - tHinge.position - dDeltaPos), 0) ptFromExt = Point3d( DGD.dW, ( DGD.dH - tHinge.position - dDeltaPos), 0) end end else -- serratura a destra if DGD.sFrame then ptPos = Point3d( DGD.dZedExtFrame, ( DGD.dH - tHinge.position - dDeltaPos), dZedPos) ptProbe = Point3d( DGD.DPR, ( DGD.dH - tHinge.position - dDeltaPos), 0) ptFromExt = Point3d( 0, ( DGD.dH - tHinge.position - dDeltaPos), 0) else if bRemake then ptRef = DGD.PminTop ptPos = Point3d( ptRef:getX()+((tHinge.position + dDeltaPos)*cos(DGD.A4)), ptRef:getY()+((tHinge.position + dDeltaPos)*sin(DGD.A4)) , dZedPos) else ptPos = Point3d( 0, ( DGD.dH - tHinge.position - dDeltaPos), dZedPos) ptProbe = Point3d( DGD.DPR, ( DGD.dH - tHinge.position - dDeltaPos), 0) ptFromExt = Point3d( 0, ( DGD.dH - tHinge.position - dDeltaPos), 0) end end end -- setto i punti sulle facce per le geometrie di ingombro ptPosUpGeom = Point3d( ptPos:getX(), ptPos:getY() , DGD.dT) ptPosDwGeom = Point3d( ptPos:getX(), ptPos:getY() , 0) -- se profilo lato cerniera è bevel setto il supplemento di rotazione local nExtraAngle = 0 if DGD.tProfs.hingeedge.trimming == 'BD' or DGD.tProfs.hingeedge.trimming == 'BU' or DGD.tProfs.hingeedge.trimming == 'BDEB' or DGD.tProfs.hingeedge.trimming == 'BUEB' then nExtraAngle = 3 end MoveGeometryHng( 'hinge', tHinge.geom, sSideLk, bPushDr, ptPos, nExtraAngle, ptPosUpGeom, ptPosDwGeom) if bRemake then EgtRotate( tHinge.geom, ptPos, Z_AX(), ( EgtIf( sSideLk == 'L', DGD.A8, DGD.A3)-90)) end InsertProbeGeom( tHinge.geom, ptProbe, ptFromExt, 5, 1) end ----------------------------------------------------------------- -- *** Geometric subgeom processing : LOCKS *** ----------------------------------------------------------------- local function MoveSubGeomLock( nSubLockId, sSideDoor, sSideLk, bPushDr, ptPos, ptPosUpGeom, ptPosDwGeom, nExtraAngle, ptPosBox) local sKeepBSNote local nUpperToDelete -- se geometria sul fianco if sSideDoor == 'lock' or sSideDoor == 'side' then if sSideDoor == 'lock' or ( DGD.SIDE and DGD.SIDE ~= 'lock_top' and DGD.SIDE ~= 'lock_bottom') then nExtraAngle = 0 end EgtRotate( nSubLockId, ORIG(), X_AX(), ( 90 + nExtraAngle)) -- ruoto su faccia frontale con angolo if not DGD.SIDE or DGD.SIDE == 'lock_top' or DGD.SIDE == 'lock_bottom' then EgtRotate( nSubLockId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra if sSideLk == 'R' then -- se serratura a destra EgtMirror( nSubLockId, ORIG(), X_AX()) -- faccio il mirror su asse Y end EgtMove( nSubLockId, ptPos - ORIG()) if bRemake then EgtRotate( nSubLockId, ptPos, Z_AX(), ( EgtIf( sSideLk == 'L', DGD.A3, DGD.A8)-90)) end elseif DGD.SIDE == 'top' then if not DGD.sFrame then EgtRotate( nSubLockId, ORIG(), Z_AX(), 180 ) -- ruoto su faccia superiore (già pronta per serratura lato destro) if sSideLk == 'L' then -- se serratura a destra EgtMirror( nSubLockId, ORIG(), X_AX()) -- faccio il mirror su asse X end EgtMove( nSubLockId, ptPos - ORIG()) if bRemake then EgtRotate( nSubLockId, ptPos, Z_AX(), EgtIf( sSideLk == 'L', DGD.A5, ( DGD.A6-180))) end else -- frame inferiore (ha il side opposto) if sSideLk == 'R' then -- se serratura a destra EgtMirror( nSubLockId, ORIG(), X_AX()) -- faccio il mirror su asse X end if DGD.OTHERD then EgtMirror( nSubLockId, ORIG(), X_AX()) end EgtMirror( nSubLockId, Point3d( 0,DGD.dH/2,0), Y_AX()) -- faccio il mirror su asse Y EgtMove( nSubLockId, ptPos - ORIG()) end elseif DGD.SIDE == 'bottom' then if not DGD.sFrame then if sSideLk == 'R' then -- se serratura a destra EgtMirror( nSubLockId, ORIG(), X_AX()) -- faccio il mirror su asse X end EgtMove( nSubLockId, ptPos - ORIG()) if bRemake then EgtRotate( nSubLockId, ptPos, Z_AX(), EgtIf( sSideLk == 'L', DGD.A2, ( DGD.A1-180))) end else -- frame superiore ( ha il side opposto) EgtRotate( nSubLockId, ORIG(), Z_AX(), 180 ) -- ruoto su faccia superiore (già pronta per serratura lato destro) if sSideLk == 'L' then -- se serratura a destra EgtMirror( nSubLockId, ORIG(), X_AX()) -- faccio il mirror su asse X end if DGD.OTHERD then EgtMirror( nSubLockId, ORIG(), X_AX()) end EgtMirror( nSubLockId, Point3d( 0,-DGD.dH/2,0), Y_AX()) -- faccio il mirror su asse Y EgtMove( nSubLockId, ptPos - ORIG()) end end elseif ( sSideDoor == 'sidelh') then -- se posizionamento serratura tipo cerniera -- si presume che sia su bordo SQ ( non BV) EgtRotate( nSubLockId, ORIG(), X_AX(), 90) -- ruoto su faccia frontale senza angolo if not DGD.SIDE or DGD.SIDE == 'lock_top' or DGD.SIDE == 'lock_bottom' then if sSideLk == 'L' then -- se serratura a sinistra EgtRotate( nSubLockId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra else EgtRotate( nSubLockId, ORIG(), Z_AX(), 90 ) -- ruoto su faccia destra end if bPushDr then -- se apertura a spingere EgtRotate( nSubLockId, ORIG(), X_AX(), 180 ) -- ruoto attorno a X per capovolgere la cerniera end EgtMove( nSubLockId, ptPos - ORIG()) if bRemake then EgtRotate( nSubLockId, ptPos, Z_AX(), ( EgtIf( sSideLk == 'L', DGD.A3, DGD.A8)-90)) end elseif DGD.SIDE == 'top' then EgtRotate( nSubLockId, ORIG(), Z_AX(), 180 ) -- ruoto su faccia superiore (già pronta per serratura lato destro) if sSideLk == 'L' then -- se serratura a sinistra EgtMirror( nSubLockId, ORIG(), X_AX()) -- faccio il mirror su asse X end if bPushDr then -- se apertura a spingere EgtRotate( nSubLockId, ORIG(), Y_AX(), 180 ) -- ruoto attorno a X per capovolgere la cerniera end EgtMove( nSubLockId, ptPos - ORIG()) if bRemake then EgtRotate( nSubLockId, ptPos, Z_AX(), EgtIf( sSideLk == 'L', DGD.A5, ( DGD.A6-180))) end elseif DGD.SIDE == 'bottom' then if sSideLk == 'R' then -- se serratura a destra EgtMirror( nSubLockId, ORIG(), X_AX()) -- faccio il mirror su asse X end if bPushDr then -- se apertura a spingere EgtRotate( nSubLockId, ORIG(), Y_AX(), 180 ) -- ruoto attorno a X per capovolgere la cerniera end EgtMove( nSubLockId, ptPos - ORIG()) if bRemake then EgtRotate( nSubLockId, ptPos, Z_AX(), EgtIf( sSideLk == 'L', DGD.A2, ( DGD.A1-180))) end end elseif ( sSideDoor == 'keyway') then if not DGD.SIDE or DGD.SIDE == 'lock_top' or DGD.SIDE == 'lock_bottom' then EgtRotate( nSubLockId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra if sSideLk == 'R' then -- se serratura a destra EgtMirror( nSubLockId, ORIG(), X_AX()) -- faccio il mirror su asse Y end local bReference = EgtGetInfo( nSubLockId, 'ReferHw', 'b') or false if bReference then ptPosUpGeom = Point3d( ptPosBox:getX(), ptPosUpGeom:getY() , ptPosUpGeom:getZ()) end EgtMove( nSubLockId, ptPosUpGeom - ORIG()) if bRemake then EgtRotate( nSubLockId, ptPosUpGeom, Z_AX(), ( EgtIf( sSideLk == 'L', DGD.A3, DGD.A8)-90)) end elseif DGD.SIDE == 'top' then EgtRotate( nSubLockId, ORIG(), Z_AX(), 180 ) -- ruoto su faccia superiore (già pronta per serratura lato destro) if sSideLk == 'L' then -- se serratura a sinistra EgtMirror( nSubLockId, ORIG(), X_AX()) -- faccio il mirror su asse X end local bReference = EgtGetInfo( nSubLockId, 'ReferHw', 'b') or false if bReference then ptPosUpGeom = Point3d( ptPosBox:getX(), ptPosUpGeom:getY() , ptPosUpGeom:getZ()) end EgtMove( nSubLockId, ptPosUpGeom - ORIG()) if bRemake then EgtRotate( nSubLockId, ptPosUpGeom, Z_AX(), EgtIf( sSideLk == 'L', DGD.A5, ( DGD.A6-180))) end elseif DGD.SIDE == 'bottom' then if sSideLk == 'R' then -- se serratura a destra EgtMirror( nSubLockId, ORIG(), X_AX()) -- faccio il mirror su asse Y end local bReference = EgtGetInfo( nSubLockId, 'ReferHw', 'b') or false if bReference then ptPosUpGeom = Point3d( ptPosBox:getX(), ptPosUpGeom:getY() , ptPosUpGeom:getZ()) end EgtMove( nSubLockId, ptPosUpGeom - ORIG()) if bRemake then EgtRotate( nSubLockId, ptPosUpGeom, Z_AX(), EgtIf( sSideLk == 'L', DGD.A2, ( DGD.A1-180))) end end -- creo estrusi e superfici piane delle geometrie passanti AddSurfTmByExtrusion( EgtGetParent(nSubLockId), nSubLockId, true) -- sposto gli estrusi e le superfici piane nel layer solid AddFlatSurf( EgtGetParent(nSubLockId), EgtGetParent(nSubLockId)) -- se c'è la nota per mantenere la posizione con il probe sKeepBSNote = EgtGetInfo( nSubLockId, 'KeepBackSet') if sKeepBSNote == 'x' then -- se ha la nota la modifico in funzione a dove è stata piazzata if bPushDr then -- se porta a spingere allora la geometrie è sul lato narrow EgtSetInfo( nSubLockId, 'KeepBackSet', 'n') -- setto 'n' perché la profondità non passante è applicata sul lato narroe else -- atrimenti è sul lato wide EgtSetInfo( nSubLockId, 'KeepBackSet', 'w') -- setto 'w' perché la profondità non passante è applicata sul lato wide end end elseif ( sSideDoor == 'secure') then EgtRotate( nSubLockId, ORIG(), X_AX(), 180 ) -- ruoto su faccia inferiore if not DGD.SIDE or DGD.SIDE == 'lock_top' or DGD.SIDE == 'lock_bottom' then EgtRotate( nSubLockId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra if sSideLk == 'R' then -- se serratura a destra EgtMirror( nSubLockId, ORIG(), X_AX()) -- faccio il mirror su asse Y end local bReference = EgtGetInfo( nSubLockId, 'ReferHw', 'b') or false if bReference then ptPosDwGeom = Point3d( ptPosBox:getX(), ptPosDwGeom:getY() , ptPosDwGeom:getZ()) end EgtMove( nSubLockId, ptPosDwGeom - ORIG()) if bRemake then EgtRotate( nSubLockId, ptPosDwGeom, Z_AX(), ( EgtIf( sSideLk == 'L', DGD.A3, DGD.A8)-90)) end elseif DGD.SIDE == 'top' then EgtRotate( nSubLockId, ORIG(), Z_AX(), 180 ) -- ruoto su faccia superiore (già pronta per serratura lato destro) if sSideLk == 'L' then -- se serratura a sinistra EgtMirror( nSubLockId, ORIG(), X_AX()) -- faccio il mirror su asse X end local bReference = EgtGetInfo( nSubLockId, 'ReferHw', 'b') or false if bReference then ptPosDwGeom = Point3d( ptPosBox:getX(), ptPosDwGeom:getY() , ptPosDwGeom:getZ()) end EgtMove( nSubLockId, ptPosDwGeom - ORIG()) if bRemake then EgtRotate( nSubLockId, ptPosDwGeom, Z_AX(), EgtIf( sSideLk == 'L', DGD.A5, ( DGD.A6-180))) end elseif DGD.SIDE == 'bottom' then if sSideLk == 'R' then -- se serratura a destra EgtMirror( nSubLockId, ORIG(), X_AX()) -- faccio il mirror su asse Y end local bReference = EgtGetInfo( nSubLockId, 'ReferHw', 'b') or false if bReference then ptPosDwGeom = Point3d( ptPosBox:getX(), ptPosDwGeom:getY() , ptPosDwGeom:getZ()) end EgtMove( nSubLockId, ptPosDwGeom - ORIG()) if bRemake then EgtRotate( nSubLockId, ptPosDwGeom, Z_AX(), EgtIf( sSideLk == 'L', DGD.A2, ( DGD.A1-180))) end end -- creo estrusi e superfici piane delle geometrie passanti AddSurfTmByExtrusion( EgtGetParent(nSubLockId), nSubLockId, true) -- sposto gli estrusi e le superfici piane nel layer solid AddFlatSurf( EgtGetParent(nSubLockId), EgtGetParent(nSubLockId)) -- se c'è la nota per mantenere la posizione con il probe sKeepBSNote = EgtGetInfo( nSubLockId, 'KeepBackSet') if sKeepBSNote == 'x' then -- se ha la nota la modifico in funzione a dove è stata piazzata if bPushDr then -- se porta a spingere allora la geometrie è sul lato wide EgtSetInfo( nSubLockId, 'KeepBackSet', 'w') -- setto 'w' perché la profondità non passante è applicata sul lato wide else -- atrimenti è sul lato narrow EgtSetInfo( nSubLockId, 'KeepBackSet', 'n') -- setto 'n' perché la profondità non passante è applicata sul lato narroe end end elseif ( sSideDoor == 'upper') then EgtRotate( nSubLockId, ORIG(), X_AX(), 90) -- ruoto su faccia frontale if not DGD.SIDE or DGD.SIDE == 'lock_top' or DGD.SIDE == 'lock_bottom' then EgtRotate( nSubLockId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra if sSideLk == 'R' then -- se serratura a destra EgtMirror( nSubLockId, ORIG(), X_AX()) -- faccio il mirror su asse Y end EgtMove( nSubLockId, ptPos - ORIG()) elseif DGD.SIDE == 'top' then if not DGD.sFrame then EgtRotate( nSubLockId, ORIG(), Z_AX(), 180 ) -- ruoto su faccia superiore (già pronta per serratura lato destro) if sSideLk == 'L' then -- se serratura a destra EgtMirror( nSubLockId, ORIG(), X_AX()) -- faccio il mirror su asse X end EgtMirror( nSubLockId, Point3d( 0,-DGD.dH/2,0), Y_AX()) -- faccio il mirror su asse Y EgtMove( nSubLockId, ptPos - ORIG()) else -- frame inferiore (ha il side opposto) if sSideLk == 'R' then -- se serratura a destra EgtMirror( nSubLockId, ORIG(), X_AX()) -- faccio il mirror su asse X end if DGD.OTHERD then EgtMirror( nSubLockId, ORIG(), X_AX()) end EgtMirror( nSubLockId, Point3d( 0,DGD.dH/2,0), Y_AX()) -- faccio il mirror su asse Y EgtMove( nSubLockId, ptPos - ORIG()) end elseif DGD.SIDE == 'bottom' then if not DGD.sFrame then if sSideLk == 'R' then -- se serratura a destra EgtMirror( nSubLockId, ORIG(), X_AX()) -- faccio il mirror su asse X end EgtMirror( nSubLockId, Point3d( 0,DGD.dH/2,0), Y_AX()) -- faccio il mirror su asse Y EgtMove( nSubLockId, ptPos - ORIG()) else -- frame superiore ( ha il side opposto) EgtRotate( nSubLockId, ORIG(), Z_AX(), 180 ) -- ruoto su faccia superiore (già pronta per serratura lato destro) if sSideLk == 'L' then -- se serratura a destra EgtMirror( nSubLockId, ORIG(), X_AX()) -- faccio il mirror su asse X end if DGD.OTHERD then EgtMirror( nSubLockId, ORIG(), X_AX()) end EgtMirror( nSubLockId, Point3d( 0,-DGD.dH/2,0), Y_AX()) -- faccio il mirror su asse Y EgtMove( nSubLockId, ptPos - ORIG()) end end -- creo estrusi e superfici piane delle geometrie passanti AddSurfTmByExtrusion( EgtGetParent(nSubLockId), nSubLockId, true) -- sposto gli estrusi e le superfici piane nel layer solid AddFlatSurf( EgtGetParent(nSubLockId), EgtGetParent(nSubLockId)) nUpperToDelete = nSubLockId end return nUpperToDelete end ----------------------------------------------------------------- -- *** Geometric subgeom processing : FLUSHBOLTS *** ----------------------------------------------------------------- local function MoveSubGeomFlushBolt( nSubFlushBId, sSideDoor, sSideLk, bPushDr, ptPos, ptPosHead, ptPosHeadExt, nExtraAngle, dPosXHead, ptPosBox, ptPosUpGeom, ptPosDwGeom) local nUpperToDelete -- se geometria sul fianco if sSideDoor == 'lock' or sSideDoor == 'side' then if sSideDoor == 'lock' then nExtraAngle = 0 else -- se geometria sotto inverto il lato di rotazione if DGD.SIDE == 'bottom' then nExtraAngle = - nExtraAngle end end -- se sono in remake sposto le geometrie della testa prima nel loro zero originale if bRemake then sSideDoorHead = EgtGetInfo( nSubFlushBId, 'HeadSide') if sSideDoorHead == 'head' and string.lower(DGD.TYPE) == 'extension' then EgtMove( nSubFlushBId, Point3d(DGD.POSITION,0,dPosXHead) - ORIG()) end end EgtRotate( nSubFlushBId, ORIG(), X_AX(), ( 90 + nExtraAngle)) -- ruoto su faccia frontale con angolo EgtRotate( nSubFlushBId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra if DGD.sFrame then if ( string.lower(DGD.SIDE) == 'bottom') then EgtRotate( nSubFlushBId, ORIG(), X_AX(), 180 ) -- ribalto in Y end if ( string.lower(DGD.SIDE) == 'top') then if sSideLk == 'R' then -- se serratura a destra EgtMirror( nSubFlushBId, ORIG(), X_AX()) -- faccio il mirror su asse X end EgtMirror( nSubFlushBId, ORIG(), Y_AX()) -- faccio il mirror su asse Y else if sSideLk == 'R' then -- se serratura a destra EgtMirror( nSubFlushBId, ORIG(), X_AX()) -- faccio il mirror su asse X end EgtMirror( nSubFlushBId, Point3d( 0,DGD.dH/2,0), Y_AX()) -- faccio il mirror su asse Y end else if ( string.lower(DGD.SIDE) == 'bottom') then EgtRotate( nSubFlushBId, ORIG(), X_AX(), 180 ) -- ribalto in Y end if sSideLk == 'R' then -- se serratura a destra EgtMirror( nSubFlushBId, ORIG(), X_AX()) -- faccio il mirror su asse Y end end if bRemake then sSideDoorHead = EgtGetInfo( nSubFlushBId, 'HeadSide') if sSideDoorHead == 'head' then if string.lower(DGD.TYPE) == 'extension' then EgtMove( nSubFlushBId, ptPosHeadExt - ORIG()) EgtRotate( nSubFlushBId, ptPosHeadExt, Z_AX(), EgtIf( DGD.SIDE == 'top', DGD.A5, DGD.A2)) else EgtMove( nSubFlushBId, ptPosHead - ORIG()) EgtRotate( nSubFlushBId, ptPosHead, Z_AX(), EgtIf( DGD.SIDE == 'top', DGD.A5, DGD.A2)) end else EgtMove( nSubFlushBId, ptPos - ORIG()) EgtRotate( nSubFlushBId, ptPos, Z_AX(), ( EgtIf( sSideLk == 'L', DGD.A3, DGD.A8)-90)) end else sSideDoorHead = EgtGetInfo( nSubFlushBId, 'HeadSide') if sSideDoorHead == 'head' and DGC.Bwd and DGC.Bwd >= 1 then EgtMove( nSubFlushBId, Point3d( ptPosBox:getX(), ptPos:getY(), ptPos:getZ()) - ORIG()) else EgtMove( nSubFlushBId, ptPos - ORIG()) end end elseif ( sSideDoor == 'sidelh') then -- se posizionamento serratura tipo cerniera -- cambio di segno ancora un'altra volta if bPushDr then nExtraAngle = - nExtraAngle end -- se sono in remake sposto le geometrie della testa prima nel loro zero originale if bRemake then sSideDoorHead = EgtGetInfo( nSubFlushBId, 'HeadSide') if sSideDoorHead == 'head' and string.lower(DGD.TYPE) == 'extension' then EgtMove( nSubFlushBId, Point3d(DGD.POSITION,0,dPosXHead) - ORIG()) end end EgtRotate( nSubFlushBId, ORIG(), X_AX(), ( 90 + nExtraAngle)) -- ruoto su faccia frontale con angolo if sSideLk == 'L' then -- se serratura a sinistra EgtRotate( nSubFlushBId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra else EgtRotate( nSubFlushBId, ORIG(), Z_AX(), 90 ) -- ruoto su faccia destra end if bPushDr then -- se apertura a spingere EgtRotate( nSubFlushBId, ORIG(), X_AX(), 180 ) -- ruoto attorno a X per capovolgere la cerniera end if bRemake then sSideDoorHead = EgtGetInfo( nSubFlushBId, 'HeadSide') if sSideDoorHead == 'head' then if string.lower(DGD.TYPE) == 'extension' then EgtMove( nSubFlushBId, ptPosHeadExt - ORIG()) EgtRotate( nSubFlushBId, ptPosHeadExt, Z_AX(), EgtIf( DGD.SIDE == 'top', DGD.A5, DGD.A2)) else EgtMove( nSubFlushBId, ptPosHead - ORIG()) EgtRotate( nSubFlushBId, ptPosHead, Z_AX(), EgtIf( DGD.SIDE == 'top', DGD.A5, DGD.A2)) end else EgtMove( nSubFlushBId, ptPos - ORIG()) EgtRotate( nSubFlushBId, ptPos, Z_AX(), ( EgtIf( sSideLk == 'L', DGD.A3, DGD.A8)-90)) end else sSideDoorHead = EgtGetInfo( nSubFlushBId, 'HeadSide') if sSideDoorHead == 'head' and DGC.Bwd and DGC.Bwd >= 1 then EgtMove( nSubFlushBId, Point3d( ptPosBox:getX(), ptPos:getY(), ptPos:getZ()) - ORIG()) else EgtMove( nSubFlushBId, ptPos - ORIG()) end end elseif ( sSideDoor == 'keyway') then EgtRotate( nSubFlushBId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra if sSideLk == 'R' then -- se serratura a destra EgtMirror( nSubFlushBId, ORIG(), X_AX()) -- faccio il mirror su asse Y end local bReference = EgtGetInfo( nSubFlushBId, 'ReferHw', 'b') or false if bReference then ptPosUpGeom = Point3d( ptPosBox:getX(), ptPosUpGeom:getY() , ptPosUpGeom:getZ()) end EgtMove( nSubFlushBId, ptPosUpGeom - ORIG()) if bRemake then EgtRotate( nSubFlushBId, ptPosUpGeom, Z_AX(), ( EgtIf( sSideLk == 'L', DGD.A3, DGD.A8)-90)) end -- creo estrusi e superfici piane delle geometrie passanti AddSurfTmByExtrusion( EgtGetParent(nSubFlushBId), nSubFlushBId, true) -- sposto gli estrusi e le superfici piane nel layer solid AddFlatSurf( EgtGetParent(nSubFlushBId), EgtGetParent(nSubFlushBId)) -- se c'è la nota per mantenere la posizione con il probe sKeepBSNote = EgtGetInfo( nSubFlushBId, 'KeepBackSet') if sKeepBSNote == 'x' then -- se ha la nota la modifico in funzione a dove è stata piazzata if bPushDr then -- se porta a spingere allora la geometrie è sul lato narrow EgtSetInfo( nSubFlushBId, 'KeepBackSet', 'n') -- setto 'n' perché la profondità non passante è applicata sul lato narroe else -- atrimenti è sul lato wide EgtSetInfo( nSubFlushBId, 'KeepBackSet', 'w') -- setto 'w' perché la profondità non passante è applicata sul lato wide end end elseif ( sSideDoor == 'secure') then EgtRotate( nSubFlushBId, ORIG(), X_AX(), 180 ) -- ruoto su faccia inferiore EgtRotate( nSubFlushBId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra if sSideLk == 'R' then -- se serratura a destra EgtMirror( nSubFlushBId, ORIG(), X_AX()) -- faccio il mirror su asse Y end local bReference = EgtGetInfo( nSubFlushBId, 'ReferHw', 'b') or false if bReference then ptPosDwGeom = Point3d( ptPosBox:getX(), ptPosDwGeom:getY() , ptPosDwGeom:getZ()) end EgtMove( nSubFlushBId, ptPosDwGeom - ORIG()) if bRemake then EgtRotate( nSubFlushBId, ptPosDwGeom, Z_AX(), ( EgtIf( sSideLk == 'L', DGD.A3, DGD.A8)-90)) end -- creo estrusi e superfici piane delle geometrie passanti AddSurfTmByExtrusion( EgtGetParent(nSubFlushBId), nSubFlushBId, true) -- sposto gli estrusi e le superfici piane nel layer solid AddFlatSurf( EgtGetParent(nSubFlushBId), EgtGetParent(nSubFlushBId)) -- se c'è la nota per mantenere la posizione con il probe sKeepBSNote = EgtGetInfo( nSubFlushBId, 'KeepBackSet') if sKeepBSNote == 'x' then -- se ha la nota la modifico in funzione a dove è stata piazzata if bPushDr then -- se porta a spingere allora la geometrie è sul lato wide EgtSetInfo( nSubFlushBId, 'KeepBackSet', 'w') -- setto 'w' perché la profondità non passante è applicata sul lato wide else -- atrimenti è sul lato narrow EgtSetInfo( nSubFlushBId, 'KeepBackSet', 'n') -- setto 'n' perché la profondità non passante è applicata sul lato narroe end end elseif ( sSideDoor == 'upper') then EgtRotate( nSubFlushBId, ORIG(), X_AX(), ( 90 + nExtraAngle)) -- ruoto su faccia frontale EgtRotate( nSubFlushBId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra if ( string.lower(DGD.SIDE) == 'bottom') then EgtRotate( nSubFlushBId, ORIG(), X_AX(), 180 ) -- ribalto in Y end if ( string.lower(DGD.SIDE) == 'top') then if sSideLk == 'R' then -- se serratura a destra EgtMirror( nSubFlushBId, ORIG(), X_AX()) -- faccio il mirror su asse X end EgtMirror( nSubFlushBId, ORIG(), Y_AX()) -- faccio il mirror su asse Y else if sSideLk == 'R' then -- se serratura a destra EgtMirror( nSubFlushBId, ORIG(), X_AX()) -- faccio il mirror su asse X end EgtMirror( nSubFlushBId, Point3d( 0,DGD.dH/2,0), Y_AX()) -- faccio il mirror su asse Y end sSideDoorHead = EgtGetInfo( nSubFlushBId, 'HeadSide') if sSideDoorHead == 'head' and DGC.Bwd and DGC.Bwd >= 1 then EgtMove( nSubFlushBId, Point3d( ptPosBox:getX(), ptPos:getY(), ptPos:getZ()) - ORIG()) else EgtMove( nSubFlushBId, ptPos - ORIG()) end -- creo estrusi e superfici piane delle geometrie passanti AddSurfTmByExtrusion( EgtGetParent(nSubFlushBId), nSubFlushBId, true) -- sposto gli estrusi e le superfici piane nel layer solid AddFlatSurf( EgtGetParent(nSubFlushBId), EgtGetParent(nSubFlushBId)) nUpperToDelete = nSubFlushBId end return nUpperToDelete end ----------------------------------------------------------------- -- *** Geometric subgeom processing : EDGEPULLS *** ----------------------------------------------------------------- local function MoveSubGeomEdgePull( nSubEdgePId, sSideDoor, sSideLk, bPushDr, ptPos, nExtraAngle, ptPosUpGeom, ptPosDwGeom) local nUpperToDelete -- rinomino eventuali geometrie che descrivono solo la sezione if sSideDoor == 'upper' then if not DGD.Dws then if bPushDr then EgtSetInfo( nSubEdgePId, 'SideDoor', 'secure') sSideDoor = 'secure' else EgtSetInfo( nSubEdgePId, 'SideDoor', 'keyway') sSideDoor = 'keyway' end else EgtSetInfo( nSubEdgePId, 'SideDoor', 'keyway') sSideDoor = 'keyway' end nUpperToDelete = nSubEdgePId end -- se geometria sul fianco if sSideDoor == 'lock' or sSideDoor == 'side' then if sSideDoor == 'lock' then nExtraAngle = 0 end EgtRotate( nSubEdgePId, ORIG(), X_AX(), ( 90 + nExtraAngle)) -- ruoto su faccia frontale con angolo EgtRotate( nSubEdgePId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra if sSideLk == 'R' then -- se serratura a destra EgtMirror( nSubEdgePId, ORIG(), X_AX()) -- faccio il mirror su asse Y end EgtMove( nSubEdgePId, ptPos - ORIG()) if bRemake then EgtRotate( nSubEdgePId, ptPos, Z_AX(), ( EgtIf( sSideLk == 'L', DGD.A3, DGD.A8)-90)) end elseif sSideDoor == 'sidelh' then -- se posizionamento serratura tipo cerniera -- cambio di segno ancora un'altra volta if bPushDr then nExtraAngle = - nExtraAngle end EgtRotate( nSubEdgePId, ORIG(), X_AX(), ( 90 + nExtraAngle)) -- ruoto su faccia frontale con angolo if sSideLk == 'L' then -- se serratura a sinistra EgtRotate( nSubEdgePId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra else EgtRotate( nSubEdgePId, ORIG(), Z_AX(), 90 ) -- ruoto su faccia destra end if bPushDr then -- se apertura a spingere EgtRotate( nSubEdgePId, ORIG(), X_AX(), 180 ) -- ruoto attorno a X per capovolgere la cerniera end EgtMove( nSubEdgePId, ptPos - ORIG()) if bRemake then EgtRotate( nSubEdgePId, ptPos, Z_AX(), ( EgtIf( sSideLk == 'L', DGD.A3, DGD.A8)-90)) end elseif sSideDoor == 'keyway' then if DGD.Dws == nil and nUpperToDelete then -- se disposizione frame su porta EgtRotate( nSubEdgePId, ORIG(), X_AX(), 90) -- ruoto su faccia frontale if sSideLk == 'L' then -- se serratura a sinistra EgtRotate( nSubEdgePId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra else EgtRotate( nSubEdgePId, ORIG(), Z_AX(), 90 ) -- ruoto su faccia destra end EgtMove( nSubEdgePId, ptPos - ORIG()) if bRemake then EgtRotate( nSubEdgePId, ptPosUpGeom, Z_AX(), ( EgtIf( sSideLk == 'L', DGD.A3, DGD.A8)-90)) end elseif not DGD.Dws then -- se disposizione frame su lato narrow if nUpperToDelete then -- se non è una geometria di ingombro/box EgtRotate( nSubEdgePId, ORIG(), Z_AX(), 90 ) -- ruoto su faccia destra else EgtRotate( nSubEdgePId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra end if sSideLk == 'R' then -- se serratura a destra EgtMirror( nSubEdgePId, ORIG(), X_AX()) -- faccio il mirror su asse Y end EgtMove( nSubEdgePId, ptPosUpGeom - ORIG()) if bRemake then EgtRotate( nSubEdgePId, ptPosUpGeom, Z_AX(), ( EgtIf( sSideLk == 'L', DGD.A3, DGD.A8)-90)) end else EgtRotate( nSubEdgePId, ORIG(), X_AX(), 90) -- ruoto su faccia frontale EgtRotate( nSubEdgePId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra if sSideLk == 'R' then -- se serratura a destra EgtMirror( nSubEdgePId, ORIG(), X_AX()) -- faccio il mirror su asse Y end EgtMove( nSubEdgePId, ptPos - ORIG()) end -- creo estrusi e superfici piane delle geometrie passanti AddSurfTmByExtrusion( EgtGetParent(nSubEdgePId), nSubEdgePId, true) -- sposto gli estrusi e le superfici piane nel layer solid AddFlatSurf( EgtGetParent(nSubEdgePId), EgtGetParent(nSubEdgePId)) if not nUpperToDelete then -- se non è una geometria di ingombro/box -- se c'è la nota per mantenere la posizione con il probe sKeepBSNote = EgtGetInfo( nSubEdgePId, 'KeepBackSet') if sKeepBSNote == 'x' then -- se ha la nota la modifico in funzione a dove è stata piazzata if bPushDr then -- se porta a spingere allora la geometrie è sul lato narrow EgtSetInfo( nSubEdgePId, 'KeepBackSet', 'n') -- setto 'n' perché la profondità non passante è applicata sul lato narroe else -- atrimenti è sul lato wide EgtSetInfo( nSubEdgePId, 'KeepBackSet', 'w') -- setto 'w' perché la profondità non passante è applicata sul lato wide end end end elseif sSideDoor == 'secure' then if DGD.Dws == nil and nUpperToDelete then -- se disposizione frame su porta EgtRotate( nSubEdgePId, ORIG(), X_AX(), 90) -- ruoto su faccia frontale if sSideLk == 'L' then -- se serratura a sinistra EgtRotate( nSubEdgePId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra else EgtRotate( nSubEdgePId, ORIG(), Z_AX(), 90 ) -- ruoto su faccia destra end EgtRotate( nSubEdgePId, ORIG(), X_AX(), 180 ) -- ruoto attorno a X per capovolgere la cerniera EgtMove( nSubEdgePId, ptPos - ORIG()) else EgtRotate( nSubEdgePId, ORIG(), X_AX(), 180 ) -- ruoto su faccia inferiore EgtRotate( nSubEdgePId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra if sSideLk == 'R' then -- se serratura a destra EgtMirror( nSubEdgePId, ORIG(), X_AX()) -- faccio il mirror su asse Y end EgtMove( nSubEdgePId, ptPosDwGeom - ORIG()) end if bRemake then EgtRotate( nSubEdgePId, ptPosDwGeom, Z_AX(), ( EgtIf( sSideLk == 'L', DGD.A3, DGD.A8)-90)) end -- creo estrusi e superfici piane delle geometrie passanti AddSurfTmByExtrusion( EgtGetParent(nSubEdgePId), nSubEdgePId, true) -- sposto gli estrusi e le superfici piane nel layer solid AddFlatSurf( EgtGetParent(nSubEdgePId), EgtGetParent(nSubEdgePId)) if not nUpperToDelete then -- se non è una geometria di ingombro/box -- se c'è la nota per mantenere la posizione con il probe sKeepBSNote = EgtGetInfo( nSubEdgePId, 'KeepBackSet') if sKeepBSNote == 'x' then -- se ha la nota la modifico in funzione a dove è stata piazzata if bPushDr then -- se porta a spingere allora la geometrie è sul lato wide EgtSetInfo( nSubEdgePId, 'KeepBackSet', 'w') -- setto 'w' perché la profondità non passante è applicata sul lato wide else -- atrimenti è sul lato narrow EgtSetInfo( nSubEdgePId, 'KeepBackSet', 'n') -- setto 'n' perché la profondità non passante è applicata sul lato narroe end end end end return nUpperToDelete end ----------------------------------------------------------------- -- *** Geometric subgeom processing : STRIKES *** ----------------------------------------------------------------- local function MoveSubGeomStrike( nSubStrikeId, sSideDoor, sSideLk, bPushDr, ptPos, ptPosUpGeom, ptPosDwGeom, nExtraAngle, ptPosBox) local sKeepBSNote -- Controllo se la nota è corretta local sLikeStrike = EgtGetInfo( nSubStrikeId, 'LikeStrike') local nUpperToDelete -- se geometria sul fianco if sSideDoor == 'lock' or sSideDoor == 'side' then -- cambio di segno ancora un'altra volta if bPushDr then nExtraAngle = - nExtraAngle end if sSideDoor == 'lock' then nExtraAngle = 0 end EgtRotate( nSubStrikeId, ORIG(), X_AX(), ( 90 + nExtraAngle)) -- ruoto su faccia frontale con angolo EgtRotate( nSubStrikeId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra RHR(I) e LHR(I) if bPushDr and not sLikeStrike then -- se apertura a spingere RH(I) LH(I) EgtMirror( nSubStrikeId, ORIG(), Z_AX()) end if sSideLk == 'R' then -- se serratura a destra LH(I) LHR(I) EgtMirror( nSubStrikeId, ORIG(), X_AX()) -- faccio il mirror su asse Y end EgtMove( nSubStrikeId, ptPos - ORIG()) if bRemake then EgtRotate( nSubStrikeId, ptPos, Z_AX(), ( EgtIf( sSideLk == 'L', DGD.A3, DGD.A8)-90)) end elseif ( sSideDoor == 'sidelh') then -- se posizionamento serratura tipo cerniera if not sLikeStrike then EgtRotate( nSubStrikeId, ORIG(), X_AX(), ( 90 + nExtraAngle)) -- ruoto su faccia frontale con angolo EgtRotate( nSubStrikeId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra RHR(I) e LHR(I) if bPushDr then -- se apertura a spingere RH(I) LH(I) EgtMirror( nSubStrikeId, ORIG(), Z_AX()) end if sSideLk == 'R' then -- se serratura a destra LH(I) LHR(I) EgtMirror( nSubStrikeId, ORIG(), X_AX()) -- faccio il mirror su asse Y end else -- cambio di segno ancora un'altra volta if bPushDr then nExtraAngle = - nExtraAngle end EgtRotate( nSubStrikeId, ORIG(), X_AX(), ( 90 + nExtraAngle)) -- ruoto su faccia frontale con angolo if sSideLk == 'L' then -- se serratura a sinistra EgtRotate( nSubStrikeId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra else EgtRotate( nSubStrikeId, ORIG(), Z_AX(), 90 ) -- ruoto su faccia destra end if bPushDr then -- se apertura a spingere EgtRotate( nSubStrikeId, ORIG(), X_AX(), 180 ) -- ruoto attorno a X per capovolgere la cerniera end end EgtMove( nSubStrikeId, ptPos - ORIG()) if bRemake then EgtRotate( nSubStrikeId, ptPos, Z_AX(), ( EgtIf( sSideLk == 'L', DGD.A3, DGD.A8)-90)) end elseif ( sSideDoor == 'keyway') then EgtRotate( nSubStrikeId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra if sSideLk == 'R' then -- se serratura a destra EgtMirror( nSubStrikeId, ORIG(), X_AX()) -- faccio il mirror su asse Y end local bReference = EgtGetInfo( nSubStrikeId, 'ReferHw', 'b') or false if bReference then ptPosUpGeom = Point3d( ptPosBox:getX(), ptPosUpGeom:getY() , ptPosUpGeom:getZ()) end EgtMove( nSubStrikeId, ptPosUpGeom - ORIG()) if bRemake then EgtRotate( nSubStrikeId, ptPosUpGeom, Z_AX(), ( EgtIf( sSideLk == 'L', DGD.A3, DGD.A8)-90)) end -- creo estrusi e superfici piane delle geometrie passanti AddSurfTmByExtrusion( EgtGetParent(nSubStrikeId), nSubStrikeId, true) -- sposto gli estrusi e le superfici piane nel layer solid AddFlatSurf( EgtGetParent(nSubStrikeId), EgtGetParent(nSubStrikeId)) -- se c'è la nota per mantenere la posizione con il probe sKeepBSNote = EgtGetInfo( nSubStrikeId, 'KeepBackSet') if sKeepBSNote == 'x' then -- se ha la nota la modifico in funzione a dove è stata piazzata if bPushDr then -- se porta a spingere allora la geometrie è sul lato narrow EgtSetInfo( nSubStrikeId, 'KeepBackSet', 'n') -- setto 'n' perché la profondità non passante è applicata sul lato narroe else -- atrimenti è sul lato wide EgtSetInfo( nSubStrikeId, 'KeepBackSet', 'w') -- setto 'w' perché la profondità non passante è applicata sul lato wide end end elseif ( sSideDoor == 'secure') then EgtRotate( nSubStrikeId, ORIG(), X_AX(), 180 ) -- ruoto su faccia inferiore EgtRotate( nSubStrikeId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra if sSideLk == 'R' then -- se serratura a destra EgtMirror( nSubStrikeId, ORIG(), X_AX()) -- faccio il mirror su asse Y end local bReference = EgtGetInfo( nSubStrikeId, 'ReferHw', 'b') or false if bReference then ptPosDwGeom = Point3d( ptPosBox:getX(), ptPosDwGeom:getY() , ptPosDwGeom:getZ()) end EgtMove( nSubStrikeId, ptPosDwGeom - ORIG()) if bRemake then EgtRotate( nSubStrikeId, ptPosDwGeom, Z_AX(), ( EgtIf( sSideLk == 'L', DGD.A3, DGD.A8)-90)) end -- creo estrusi e superfici piane delle geometrie passanti AddSurfTmByExtrusion( EgtGetParent(nSubStrikeId), nSubStrikeId, true) -- sposto gli estrusi e le superfici piane nel layer solid AddFlatSurf( EgtGetParent(nSubStrikeId), EgtGetParent(nSubStrikeId)) -- se c'è la nota per mantenere la posizione con il probe sKeepBSNote = EgtGetInfo( nSubStrikeId, 'KeepBackSet') if sKeepBSNote == 'x' then -- se ha la nota la modifico in funzione a dove è stata piazzata if bPushDr then -- se porta a spingere allora la geometrie è sul lato wide EgtSetInfo( nSubStrikeId, 'KeepBackSet', 'w') -- setto 'w' perché la profondità non passante è applicata sul lato wide else -- atrimenti è sul lato narrow EgtSetInfo( nSubStrikeId, 'KeepBackSet', 'n') -- setto 'n' perché la profondità non passante è applicata sul lato narroe end end elseif ( sSideDoor == 'upper') then if not DGD.Dws then -- se disposizione frame su lato narrow o porta EgtRotate( nSubStrikeId, ORIG(), X_AX(), 90) -- ruoto su faccia frontale EgtRotate( nSubStrikeId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra RHR(I) e LHR(I) if bPushDr and not sLikeStrike then -- se apertura a spingere RH(I) LH(I) EgtMirror( nSubStrikeId, ORIG(), Z_AX()) end if sSideLk == 'R' then -- se serratura a destra EgtMirror( nSubStrikeId, ORIG(), X_AX()) -- faccio il mirror su asse Y end EgtMove( nSubStrikeId, ptPos - ORIG()) else EgtRotate( nSubStrikeId, ORIG(), X_AX(), 90) -- ruoto su faccia frontale EgtRotate( nSubStrikeId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra RHR(I) e LHR(I) if bPushDr and not sLikeStrike then -- se apertura a spingere RH(I) LH(I) EgtMirror( nSubStrikeId, ORIG(), Z_AX()) end if sSideLk == 'R' then -- se serratura a destra EgtMirror( nSubStrikeId, ORIG(), X_AX()) -- faccio il mirror su asse Y end EgtMove( nSubStrikeId, ptPos - ORIG()) end -- creo estrusi e superfici piane delle geometrie passanti AddSurfTmByExtrusion( EgtGetParent(nSubStrikeId), nSubStrikeId, true) -- sposto gli estrusi e le superfici piane nel layer solid AddFlatSurf( EgtGetParent(nSubStrikeId), EgtGetParent(nSubStrikeId)) -- nUpperToDelete = nSubStrikeId end return nUpperToDelete end ----------------------------------------------------------------------------------------------- -- *** Geometric processing : common functions for locks, flushbolts, edgepulls, strikes *** ----------------------------------------------------------------------------------------------- local function MoveGeometryLck( sTypeGeom, nGeomId, sSideLk, bPushDr, ptPos, ptPosUpGeom, ptPosDwGeom, dPosXHead, ptPosBox, ptPosUpGeomFB, ptPosDwGeomFB) if not nGeomId then return end -- se profilo lato serratura è bevel setto il supplemento di rotazione local nExtraAngle local nIdGeomType local sSideDoorToMove local sMessageErr = '' -- stabilisco l'angolo extra di inclinazione in base al profilo e alla direzione di apertura porta ( Push o Pull) if DGD.tProfs.lockedge.trimming == 'BD' or DGD.tProfs.lockedge.trimming == 'BU' or DGD.tProfs.lockedge.trimming == 'BDEB' or DGD.tProfs.lockedge.trimming == 'BUEB' then nExtraAngle = 3 if bPushDr then nExtraAngle = - nExtraAngle end -- se è un lato senza maniglia e abilitazione inversione profilo, re-inverto l'angolo if ( DGD.sSwing == 'LHI' or DGD.sSwing == 'RHI' or DGD.sSwing == 'RHRI' or DGD.sSwing == 'LHRI') and ( ( DGD.RevInBv and DGD.RevInBv == 1) or DGD.bBothOppoBevel) then nExtraAngle = - nExtraAngle end else nExtraAngle = 0 end -- devo ottenere tutte le geometrie della serratura nIdGeomType = EgtGetFirstInGroup( nGeomId) -- ottengo la prima geometria local nErr = 0 local nUpperToDelete while nIdGeomType do sSideDoorToMove = EgtGetInfo( nIdGeomType, 'SideDoor') if sSideDoorToMove then -- Controllo se la nota è corretta local sSideDoor = string.lower(sSideDoorToMove) -- lock: senza rotazione angolo profilo; side: con rotazione angolo profilo; keyway e Secure: no rotazione angolo profilo; -- SideLH: senza rotazione angolo profilo e disposizione come cerniera ( suffisso LH: like hinge), cioè senza effettuare mirror -- attenzione! la geometria con nota SideLH DEVE ESSERE SIMMETRICA sulla X e Y locale if sTypeGeom == 'lock' then if sSideDoor == 'lock' or sSideDoor == 'side' or sSideDoor == 'sidelh' or sSideDoor == 'keyway' or sSideDoor == 'secure' or sSideDoor == 'upper' then if DGD.sFrame and DGD.nTypePz == 5 then DGD.SIDE = 'bottom' elseif DGD.sFrame and DGD.nTypePz == 6 then DGD.SIDE = 'top' end nUpperToDelete = MoveSubGeomLock( nIdGeomType, sSideDoor, sSideLk, bPushDr, ptPos, ptPosUpGeom, ptPosDwGeom, nExtraAngle, ptPosBox) else -- messaggio di errore sMessageErr = string.format( EgtDoorsMsg[413],nIdGeomType,'Lock',nGeomId, sSideDoor, DGD.FILE) DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr nErr = 1001 end elseif sTypeGeom == 'flushbolt' then if sSideDoor == 'lock' or sSideDoor == 'side' or sSideDoor == 'sidelh' or sSideDoor == 'keyway' or sSideDoor == 'secure' or sSideDoor == 'upper' then nUpperToDelete = MoveSubGeomFlushBolt( nIdGeomType, sSideDoor, sSideLk, bPushDr, ptPos, ptPosUpGeom, ptPosDwGeom, nExtraAngle, dPosXHead, ptPosBox, ptPosUpGeomFB, ptPosDwGeomFB) else -- messaggio di errore sMessageErr = string.format( EgtDoorsMsg[413],nIdGeomType,'Flush Bolt',nGeomId, sSideDoor, DGD.FILE) DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr nErr = 1003 end elseif sTypeGeom == 'edgepull' then if sSideDoor == 'lock' or sSideDoor == 'side' or sSideDoor == 'sidelh' or sSideDoor == 'keyway' or sSideDoor == 'secure' or sSideDoor == 'upper' then nUpperToDelete = MoveSubGeomEdgePull( nIdGeomType, sSideDoor, sSideLk, bPushDr, ptPos, nExtraAngle, ptPosUpGeom, ptPosDwGeom) else -- messaggio di errore sMessageErr = string.format( EgtDoorsMsg[413],nIdGeomType,'Edge Pull',nGeomId, sSideDoor, DGD.FILE) DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr nErr = 1005 end elseif sTypeGeom == 'strike' then if sSideDoor == 'lock' or sSideDoor == 'side' or sSideDoor == 'sidelh' or sSideDoor == 'keyway' or sSideDoor == 'secure' or sSideDoor == 'upper' then nUpperToDelete = MoveSubGeomStrike( nIdGeomType, sSideDoor, sSideLk, bPushDr, ptPos, ptPosUpGeom, ptPosDwGeom, nExtraAngle, ptPosBox) else -- messaggio di errore sMessageErr = string.format( EgtDoorsMsg[413],nIdGeomType,'Strike',nGeomId, sSideDoor, DGD.FILE) DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr nErr = 1017 end end else -- messaggio di errore in base al tipo di pezzo if sTypeGeom == 'lock' then sMessageErr = string.format( EgtDoorsMsg[414],nIdGeomType,'Lock',nGeomId, DGD.FILE) DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr nErr = 1002 elseif sTypeGeom == 'flushbolt' then sMessageErr = string.format( EgtDoorsMsg[414],nIdGeomType,'Flush Bolt',nGeomId, DGD.FILE) DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr nErr = 1004 elseif sTypeGeom == 'edgepull' then sMessageErr = string.format( EgtDoorsMsg[414],nIdGeomType,'Edge Pull',nEdgePId, DGD.FILE) DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr nErr = 1006 elseif sTypeGeom == 'strike' then sMessageErr = string.format( EgtDoorsMsg[414],nIdGeomType,'Strike',nEdgePId, DGD.FILE) DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr nErr = 1018 end end nIdGeomType = EgtGetNext(nIdGeomType) -- cancello il percorso 'upper' if nUpperToDelete then EgtErase( nUpperToDelete) nUpperToDelete = nil end end -- assegno codice errore se ancora non fatto if DGD.ERR == 0 then DGD.ERR = nErr end end ------------------------------------------------------------------------------- -- *** Geometric main processing : LOCKS, FLUSHBOLTS, EDGEPULLS, STRIKES *** ------------------------------------------------------------------------------- local function MoveLock( tLock, sSideLk, bPushDr) local ptPos local ptPosBox local ptRef local ptFromExt local ptPosUpGeom local ptPosDwGeom local dPosX local dPosXUpDw local dPosZ local dDeltaX local dZedPos = 0 local nAngleBase local nRadBase local nRadBaseBox local nAngleBaseUpDw local nRadBaseUpDw local nSideApplied = 3 if tLock.offset and tLock.offset > 0 then dDeltaX = tLock.offset * TAN3 dPosZ = tLock.offset else dDeltaX = (DGD.dT/2) * TAN3 dPosZ = (DGD.dT/2) end if ( DGD.tProfs.lockedge.trimming == 'BU' or DGD.tProfs.lockedge.trimming == 'BD' or DGD.tProfs.lockedge.trimming == 'BDEB' or DGD.tProfs.lockedge.trimming == 'BUEB') and ( not DGD.SIDE or DGD.SIDE == 'lock_top' or DGD.SIDE == 'lock_bottom') then -- se profilo bevel su lato lock dPosX = dDeltaX dPosXUpDw = dDeltaX else dPosX = 0 dPosXUpDw = 0 end -- by DGC.Bwd setting set to 0 the dPosXUpDw and dPosX parameters if DGC.Bwd and DGC.Bwd >= 1 then dPosXUpDw = 0 if DGC.Bwd == 2 then dPosX = 0 end end if DGD.sFrame then if ( DGD.nTypePz == 3 or DGD.nTypePz == 4) then sSideLk = EgtIf( sSideLk == 'L', 'R', 'L') end if DGD.nTypePz == 5 then tLock.side = 'bottom' elseif DGD.nTypePz == 6 then tLock.side = 'top' end end if bRemake then nAngleBase = atan(dPosX/tLock.position) nRadBase = sqrt((dPosX*dPosX)+(tLock.position*tLock.position)) nRadBaseBox = tLock.position nAngleBaseUpDw = atan((dPosXUpDw+tLock.back_set)/tLock.position) nRadBaseUpDw = sqrt(((dPosXUpDw+tLock.back_set)*(dPosXUpDw+tLock.back_set))+(tLock.position*tLock.position)) end if bPushDr then dZedPos = dPosZ else dZedPos = (DGD.dT - dPosZ) end if sSideLk == 'L' then -- se serratura a sinistra if bRemake then if not DGD.SIDE or DGD.SIDE == 'lock_top' then ptRef = DGD.PminTop ptPos = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A4+nAngleBase)), ptRef:getY()+(nRadBase*sin(DGD.A4+nAngleBase)) , dZedPos) ptPosBox = Point3d( ptRef:getX()+(nRadBaseBox*cos(DGD.A4)), ptRef:getY()+(nRadBaseBox*sin(DGD.A4)) , dZedPos) ptPosUpGeom = Point3d( ptRef:getX()+(nRadBaseUpDw*cos(DGD.A4+nAngleBaseUpDw)), ptRef:getY()+(nRadBaseUpDw*sin(DGD.A4+nAngleBaseUpDw)) , DGD.dT) elseif DGD.SIDE == 'lock_bottom' then ptRef = DGD.PminBot ptPos = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A3-nAngleBase)), ptRef:getY()+(nRadBase*sin(DGD.A3-nAngleBase)) , dZedPos) ptPosBox = Point3d( ptRef:getX()+(nRadBaseBox*cos(DGD.A3)), ptRef:getY()+(nRadBaseBox*sin(DGD.A3)) , dZedPos) ptPosUpGeom = Point3d( ptRef:getX()+(nRadBaseUpDw*cos(DGD.A3-nAngleBaseUpDw)), ptRef:getY()+(nRadBaseUpDw*sin(DGD.A3-nAngleBaseUpDw)) , DGD.dT) elseif DGD.SIDE == 'top' then ptRef = DGD.PminTop ptPos = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A5+nAngleBase)), ptRef:getY()+(nRadBase*sin(DGD.A5+nAngleBase)) , dZedPos) ptPosBox = Point3d( ptRef:getX()+(nRadBaseBox*cos(DGD.A5)), ptRef:getY()+(nRadBaseBox*sin(DGD.A5)) , dZedPos) ptPosUpGeom = Point3d( ptRef:getX()+(nRadBaseUpDw*cos(DGD.A5-nAngleBaseUpDw)), ptRef:getY()+(nRadBaseUpDw*sin(DGD.A5-nAngleBaseUpDw)) , DGD.dT) nSideApplied = 2 elseif DGD.SIDE == 'bottom' then ptRef = DGD.PminBot ptPos = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A2+nAngleBase)), ptRef:getY()+(nRadBase*sin(DGD.A2+nAngleBase)) , dZedPos) ptPosBox = Point3d( ptRef:getX()+(nRadBaseBox*cos(DGD.A2)), ptRef:getY()+(nRadBaseBox*sin(DGD.A2)) , dZedPos) ptPosUpGeom = Point3d( ptRef:getX()+(nRadBaseUpDw*cos(DGD.A2+nAngleBaseUpDw)), ptRef:getY()+(nRadBaseUpDw*sin(DGD.A2+nAngleBaseUpDw)) , DGD.dT) nSideApplied = 4 end ptPosDwGeom = Point3d( ptPosUpGeom:getX(), ptPosUpGeom:getY() , 0) else if not DGD.SIDE or DGD.SIDE == 'lock_top' then ptPos = Point3d( dPosX + EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0), ( DGD.dH - tLock.position) , dZedPos) ptPosBox = Point3d( EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0), ( DGD.dH - tLock.position) , dZedPos) ptPosUpGeom = Point3d( ( dPosXUpDw + tLock.back_set + EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0)), ( DGD.dH - tLock.position) , DGD.dT) ptFromExt = Point3d( EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0), ( DGD.dH - tLock.position) , DGD.dT) elseif DGD.SIDE == 'lock_bottom' then ptPos = Point3d( dPosX + EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0), tLock.position , dZedPos) ptPosBox = Point3d( EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0), tLock.position , dZedPos) ptPosUpGeom = Point3d( ( dPosXUpDw + tLock.back_set + EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0)), tLock.position , DGD.dT) ptFromExt = Point3d( EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0), tLock.position , DGD.dT) elseif DGD.SIDE == 'top' then ptPos = Point3d( tLock.position, DGD.dH, dZedPos) ptPosBox = Point3d( tLock.position, DGD.dH, dZedPos) ptPosUpGeom = Point3d( tLock.position, ( DGD.dH - tLock.back_set) , DGD.dT) ptFromExt = Point3d( tLock.position, DGD.dH , DGD.dT) nSideApplied = 2 elseif DGD.SIDE == 'bottom' then ptPos = Point3d( tLock.position, 0, dZedPos) ptPosBox = Point3d( tLock.position, 0, dZedPos) ptPosUpGeom = Point3d( tLock.position, tLock.back_set , DGD.dT) ptFromExt = Point3d( tLock.position, 0 , DGD.dT) nSideApplied = 4 end ptPosDwGeom = Point3d( ptPosUpGeom:getX(), ptPosUpGeom:getY() , 0) end else -- serratura a destra if bRemake then if not DGD.SIDE or DGD.SIDE == 'lock_top' then ptRef = DGD.PmaxTop ptPos = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A7-nAngleBase)), ptRef:getY()+(nRadBase*sin(DGD.A7-nAngleBase)) , dZedPos) ptPosBox = Point3d( ptRef:getX()+(nRadBaseBox*cos(DGD.A7)), ptRef:getY()+(nRadBaseBox*sin(DGD.A7)) , dZedPos) ptPosUpGeom = Point3d( ptRef:getX()+(nRadBaseUpDw*cos(DGD.A7-nAngleBaseUpDw)), ptRef:getY()+(nRadBaseUpDw*sin(DGD.A7-nAngleBaseUpDw)) , DGD.dT) elseif DGD.SIDE == 'lock_bottom' then ptRef = DGD.PmaxBot ptPos = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A8+nAngleBase)), ptRef:getY()+(nRadBase*sin(DGD.A8+nAngleBase)) , dZedPos) ptPosBox = Point3d( ptRef:getX()+(nRadBaseBox*cos(DGD.A8)), ptRef:getY()+(nRadBaseBox*sin(DGD.A8)) , dZedPos) ptPosUpGeom = Point3d( ptRef:getX()+(nRadBaseUpDw*cos(DGD.A8+nAngleBaseUpDw)), ptRef:getY()+(nRadBaseUpDw*sin(DGD.A8+nAngleBaseUpDw)) , DGD.dT) elseif DGD.SIDE == 'top' then ptRef = DGD.PmaxTop ptPos = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A6-nAngleBase)), ptRef:getY()+(nRadBase*sin(DGD.A6-nAngleBase)) , dZedPos) ptPosBox = Point3d( ptRef:getX()+(nRadBaseBox*cos(DGD.A6)), ptRef:getY()+(nRadBaseBox*sin(DGD.A6)) , dZedPos) ptPosUpGeom = Point3d( ptRef:getX()+(nRadBaseUpDw*cos(DGD.A6+nAngleBaseUpDw)), ptRef:getY()+(nRadBaseUpDw*sin(DGD.A6+nAngleBaseUpDw)) , DGD.dT) nSideApplied = 2 elseif DGD.SIDE == 'bottom' then ptRef = DGD.PmaxBot ptPos = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A1+nAngleBase)), ptRef:getY()+(nRadBase*sin(DGD.A1+nAngleBase)) , dZedPos) ptPosBox = Point3d( ptRef:getX()+(nRadBaseBox*cos(DGD.A1)), ptRef:getY()+(nRadBaseBox*sin(DGD.A1)) , dZedPos) ptPosUpGeom = Point3d( ptRef:getX()+(nRadBaseUpDw*cos(DGD.A1-nAngleBaseUpDw)), ptRef:getY()+(nRadBaseUpDw*sin(DGD.A1-nAngleBaseUpDw)) , DGD.dT) nSideApplied = 4 end ptPosDwGeom = Point3d( ptPosUpGeom:getX(), ptPosUpGeom:getY() , 0) else if not DGD.SIDE or DGD.SIDE == 'lock_top' then ptPos = Point3d( ( DGD.dW - dPosX - EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0)), ( DGD.dH - tLock.position) , dZedPos) ptPosBox = Point3d( ( DGD.dW - EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0)), ( DGD.dH - tLock.position) , dZedPos) ptPosUpGeom = Point3d( ( DGD.dW - dPosXUpDw - tLock.back_set - EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0)), ( DGD.dH - tLock.position) , DGD.dT) ptFromExt = Point3d( ( DGD.dW - EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0)), ( DGD.dH - tLock.position) , DGD.dT) elseif DGD.SIDE == 'lock_bottom' then ptPos = Point3d( ( DGD.dW - dPosX - EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0)), tLock.position , dZedPos) ptPosBox = Point3d( ( DGD.dW - EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0)), tLock.position , dZedPos) ptPosUpGeom = Point3d( ( DGD.dW - dPosXUpDw - tLock.back_set - EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0)), tLock.position , DGD.dT) ptFromExt = Point3d( ( DGD.dW - EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0)), tLock.position , DGD.dT) elseif DGD.SIDE == 'top' then ptPos = Point3d( ( DGD.dW - tLock.position), DGD.dH, dZedPos) ptPosBox = Point3d( ( DGD.dW - tLock.position), DGD.dH, dZedPos) ptPosUpGeom = Point3d( ( DGD.dW - tLock.position), ( DGD.dH - tLock.back_set) , DGD.dT) ptFromExt = Point3d( ( DGD.dW - tLock.position), DGD.dH , DGD.dT) nSideApplied = 2 elseif DGD.SIDE == 'bottom' then ptPos = Point3d( ( DGD.dW - tLock.position), 0, dZedPos) ptPosBox = Point3d( ( DGD.dW - tLock.position), 0, dZedPos) ptPosUpGeom = Point3d( ( DGD.dW - tLock.position), tLock.back_set , DGD.dT) ptFromExt = Point3d( ( DGD.dW - tLock.position), 0 , DGD.dT) nSideApplied = 4 end ptPosDwGeom = Point3d( ptPosUpGeom:getX(), ptPosUpGeom:getY() , 0) end end MoveGeometryLck( 'lock', tLock.geom, sSideLk, bPushDr, ptPos, ptPosUpGeom, ptPosDwGeom, nil, ptPosBox) InsertProbeGeom( tLock.geom, ptPosUpGeom, ptFromExt, 3, nSideApplied) end ----------------------------------------------------------------- local function MoveFlushBolt( tFlushB, sSideLk, bPushDr) local ptPos local ptPosBox local ptRef local ptPosHead local ptPosHeadExt local ptPosUpGeom local ptPosDwGeom local ptDummy = Point3d{0,0,0} local dPosY local dPosYBox local dPosYUpDw local dPosYHead local dPosYHeadExt local dPosYProbe local dPosX local dPosXUpDw local dPosXHead local dPosXProbe local dPosZ local dXFromExt local dYFromExt local dDeltaX local dZedPos = 0 local nAngleBase local nRadBase local nRadBaseBox local nAngleBaseUpDw local nRadBaseUpDw if DGD.OFFSET and DGD.OFFSET > 0 then dDeltaX = DGD.OFFSET * TAN3 dPosZ = DGD.OFFSET else dDeltaX = (DGD.dT/2) * TAN3 dPosZ = (DGD.dT/2) end if DGD.tProfs.lockedge.trimming == 'BU' or DGD.tProfs.lockedge.trimming == 'BD' or DGD.tProfs.lockedge.trimming == 'BDEB' or DGD.tProfs.lockedge.trimming == 'BUEB' then -- se profilo bevel dPosX = dDeltaX dPosXUpDw = dDeltaX else dPosX = 0 dPosXUpDw = 0 end -- by DGC.Bwd setting set to 0 the dPosXUpDw and dPosX parameters if DGC.Bwd and DGC.Bwd >= 1 then dPosXUpDw = 0 if DGC.Bwd == 2 then dPosX = 0 end end if DGD.sFrame then sSideLk = EgtIf( sSideLk == 'L', 'R', 'L') end if not tFlushB.position then tFlushB.position = 100 end if not tFlushB.back_set then tFlushB.back_set = 0 end if bRemake then nAngleBase = atan(dPosX,tFlushB.position) nRadBase = sqrt((dPosX*dPosX)+(tFlushB.position*tFlushB.position)) nRadBaseBox = tFlushB.position if tFlushB.back_set then nAngleBaseUpDw = atan((dPosXUpDw+tFlushB.back_set)/tFlushB.position) nRadBaseUpDw = sqrt(((dPosXUpDw+tFlushB.back_set)*(dPosXUpDw+tFlushB.back_set))+(tFlushB.position*tFlushB.position)) end end -- se è extension if string.lower(tFlushB.type) == 'extension' then if DGD.sFrame and ( DGD.nTypePz == 5 or DGD.nTypePz == 6) then dPosY = 0 + DGD.dZedExtFrame dPosYUpDw = dPosY bPushDr = not bPushDr else if bRemake then -- ricavo nota spostamento cava di testa dPosXHead = EgtGetInfo( tFlushB.geom, 'DB_X', 'd') or 0 -- se applicato a lato top o bottom cambio la coordinata in Y if string.lower(tFlushB.side) == 'top' then ptRef = EgtIf( sSideLk == 'L', DGD.PminTop, DGD.PmaxTop) if sSideLk == 'L' then -- se serratura a sinistra dPosY = ptRef:getY()+(nRadBase*sin(DGD.A4+nAngleBase)) dPosYBox = ptRef:getY()+(nRadBaseBox*sin(DGD.A4)) dPosYUpDw = ptRef:getY()+(nRadBaseUpDw*sin(DGD.A4+nAngleBaseUpDw)) dPosYHeadExt = ptRef:getY()+(dPosXHead*sin(DGD.A5)) else dPosY = ptRef:getY()+(nRadBase*sin(DGD.A7-nAngleBase)) dPosYBox = ptRef:getY()+(nRadBaseBox*sin(DGD.A7)) dPosYUpDw = ptRef:getY()+(nRadBaseUpDw*sin(DGD.A7-nAngleBaseUpDw)) dPosYHeadExt = ptRef:getY()+(dPosXHead*sin(DGD.A6)) end else ptRef = EgtIf( sSideLk == 'L', DGD.PminBot, DGD.PmaxBot) if sSideLk == 'L' then -- se serratura a sinistra dPosY = ptRef:getY()+(nRadBase*sin(DGD.A3-nAngleBase)) dPosYBox = ptRef:getY()+(nRadBaseBox*sin(DGD.A3)) dPosYUpDw = ptRef:getY()+(nRadBaseUpDw*sin(DGD.A3-nAngleBaseUpDw)) dPosYHeadExt = ptRef:getY()+(dPosXHead*sin(DGD.A2)) else dPosY = ptRef:getY()+(nRadBase*sin(DGD.A8+nAngleBase)) dPosYBox = ptRef:getY()+(nRadBaseBox*sin(DGD.A8)) dPosYUpDw = ptRef:getY()+(nRadBaseUpDw*sin(DGD.A8+nAngleBaseUpDw)) dPosYHeadExt = ptRef:getY()+(dPosXHead*sin(DGD.A1)) end end dPosYHead = ptRef:getY() else -- se applicato a lato top o bottom cambio la coordinata in Y if string.lower(tFlushB.side) == 'top' then dPosY = DGD.dH - tFlushB.position dPosYUpDw = DGD.dH - tFlushB.position else dPosY = tFlushB.position dPosYUpDw = tFlushB.position end end end dPosYProbe = dPosY dYFromExt = dPosY else -- altrimenti tipo corner if DGD.sFrame and ( DGD.nTypePz == 5 or DGD.nTypePz == 6) then dPosY = 0 + DGD.dZedExtFrame dPosYUpDw = dPosY bPushDr = not bPushDr else if bRemake then -- se applicato a lato top o bottom cambio la coordinata in Y if string.lower(tFlushB.side) == 'top' then if sSideLk == 'L' then -- se serratura a sinistra ptRef = DGD.PminTop dPosY = ptRef:getY()+(dPosX*cos(DGD.A4)) else ptRef = DGD.PmaxTop dPosY = ptRef:getY()+(dPosX*cos(DGD.A8)) end dPosYProbe = dPosY - DGD.DPR dYFromExt = dPosY - DGD.DPR else if sSideLk == 'L' then -- se serratura a sinistra ptRef = DGD.PminBot dPosY = ptRef:getY()+(dPosX*cos(DGD.A4)) else ptRef = DGD.PmaxBot dPosY = ptRef:getY()+(dPosX*cos(DGD.A8)) end dPosYProbe = dPosY + DGD.DPR dYFromExt = dPosY + DGD.DPR end dPosYHead = ptRef:getY() else -- se applicato a lato top o bottom cambio la coordinata in Y if string.lower(tFlushB.side) == 'top' then dPosY = DGD.dH dPosYProbe = dPosY - DGD.DPR dYFromExt = dPosY - DGD.DPR else dPosY = 0 dPosYProbe = DGD.DPR dYFromExt = dPosY + DGD.DPR end end end dPosYUpDw = dPosY end if bPushDr then dZedPos = dPosZ else dZedPos = (DGD.dT - dPosZ) end if sSideLk == 'L' then -- se serratura a sinistra if bRemake then if string.lower(tFlushB.type) == 'extension' then if string.lower(tFlushB.side) == 'top' then ptPos = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A4+nAngleBase)), dPosY , dZedPos) ptPosBox = Point3d( ptRef:getX()+(nRadBaseBox*cos(DGD.A4)), dPosYBox , dZedPos) ptPosUpGeom = Point3d( ptRef:getX()+(nRadBaseUpDw*cos(DGD.A4+nAngleBaseUpDw)),dPosYUpDw , DGD.dT) ptPosHeadExt = Point3d( ptRef:getX()+(dPosXHead*cos(DGD.A5)), dPosYHeadExt , dZedPos) else ptPos = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A3-nAngleBase)), dPosY , dZedPos) ptPosBox = Point3d( ptRef:getX()+(nRadBaseBox*cos(DGD.A3)), dPosYBox , dZedPos) ptPosUpGeom = Point3d( ptRef:getX()+(nRadBaseUpDw*cos(DGD.A3-nAngleBaseUpDw)), dPosYUpDw , DGD.dT) ptPosHeadExt = Point3d( ptRef:getX()+(dPosXHead*cos(DGD.A2)), dPosYHeadExt , dZedPos) end ptPosDwGeom = Point3d( ptPosUpGeom:getX(), ptPosUpGeom:getY() , 0) else ptPos = Point3d( ptRef:getX()+(dPosX*sin(DGD.A3)), dPosY , dZedPos) end ptPosHead = Point3d( ptRef:getX(), dPosYHead , dZedPos) dPosXProbe = ptPos:getX() + DGD.DPR dXFromExt = ptPos:getX() else ptPos = Point3d( dPosX + EgtIf( DGD.sFrame, DGD.dSideExtFrame, 0), dPosY , dZedPos) ptPosBox = Point3d( EgtIf( DGD.sFrame, DGD.dSideExtFrame, 0), dPosY , dZedPos) dPosXProbe = dPosX + DGD.DPR dXFromExt = 0 if tFlushB.back_set then ptPosUpGeom = Point3d( ( dPosXUpDw + tFlushB.back_set + EgtIf( DGD.sFrame, DGD.dSideExtFrame, 0)), dPosYUpDw , DGD.dT) ptPosDwGeom = Point3d( ptPosUpGeom:getX(), ptPosUpGeom:getY() , 0) end end else -- serratura a destra if bRemake then if string.lower(tFlushB.type) == 'extension' then if string.lower(tFlushB.side) == 'top' then ptPos = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A7-nAngleBase)), dPosY , dZedPos) ptPosBox = Point3d( ptRef:getX()+(nRadBaseBox*cos(DGD.A7)), dPosYBox , dZedPos) ptPosUpGeom = Point3d( ptRef:getX()+(nRadBaseUpDw*cos(DGD.A7-nAngleBaseUpDw)), dPosYUpDw , DGD.dT) ptPosHeadExt = Point3d( ptRef:getX()+(dPosXHead*cos(DGD.A6)), dPosYHeadExt , dZedPos) else ptPos = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A8+nAngleBase)), dPosY , dZedPos) ptPosBox = Point3d( ptRef:getX()+(nRadBaseBox*cos(DGD.A8)), dPosYBox , dZedPos) ptPosUpGeom = Point3d( ptRef:getX()+(nRadBaseUpDw*cos(DGD.A8+nAngleBaseUpDw)), dPosYUpDw , DGD.dT) ptPosHeadExt = Point3d( ptRef:getX()+(dPosXHead*cos(DGD.A1)), dPosYHeadExt , dZedPos) end ptPosDwGeom = Point3d( ptPosUpGeom:getX(), ptPosUpGeom:getY() , 0) else ptPos = Point3d( ptRef:getX()+(dPosX*sin(DGD.A7)), dPosY , dZedPos) end ptPosHead = Point3d( ptRef:getX(), dPosYHead , dZedPos) dPosXProbe = ptPos:getX() - DGD.DPR dXFromExt = ptPos:getX() else ptPos = Point3d( ( DGD.dW - dPosX - EgtIf( DGD.sFrame, DGD.dSideExtFrame, 0)), dPosY , dZedPos) ptPosBox = Point3d( DGD.dW - EgtIf( DGD.sFrame, DGD.dSideExtFrame, 0), dPosY , dZedPos) dPosXProbe = DGD.dW - dPosX - DGD.DPR dXFromExt = DGD.dW if tFlushB.back_set then ptPosUpGeom = Point3d( ( DGD.dW - dPosXUpDw - tFlushB.back_set - EgtIf( DGD.sFrame, DGD.dSideExtFrame, 0)), dPosYUpDw , DGD.dT) ptPosDwGeom = Point3d( ptPosUpGeom:getX(), ptPosUpGeom:getY() , 0) end end end MoveGeometryLck( 'flushbolt', tFlushB.geom, sSideLk, bPushDr, ptPos, ptPosHead, ptPosHeadExt, dPosXHead, ptPosBox, ptPosUpGeom, ptPosDwGeom) InsertProbeGeom( tFlushB.geom, Point3d(dPosXProbe,dPosYProbe,0), Point3d(dXFromExt,dYFromExt,0), 11, 3) end ----------------------------------------------------------------- local function MoveEdgePull( tEdgeP, sSideLk, bPushDr) local dPosX local dPosZ local ptPos local ptRef local ptPosUpGeom local ptPosDwGeom local dPosXProbe local dXFromExt local dYFromExt local dDeltaX local dZedPos = 0 local nAngleBase local nRadBase local ptDummy = Point3d{0,0,0} if DGD.OFFSET and DGD.OFFSET > 0 then dDeltaX = DGD.OFFSET * TAN3 dPosZ = DGD.OFFSET else dDeltaX = (DGD.dT/2) * TAN3 dPosZ = (DGD.dT/2) end if DGD.tProfs.lockedge.trimming == 'BU' or DGD.tProfs.lockedge.trimming == 'BD' or DGD.tProfs.lockedge.trimming == 'BDEB' or DGD.tProfs.lockedge.trimming == 'BUEB' then -- se profilo bevel dPosX = dDeltaX else dPosX = 0 end -- by DGC.Bwd setting set to 0 the dPosX parameter if DGC.Bwd and DGC.Bwd == 2 then dPosX = 0 end if DGD.sFrame then sSideLk = EgtIf( sSideLk == 'L', 'R', 'L') end if bRemake then nAngleBase = atan(dPosX/tEdgeP.position) nRadBase = sqrt((dPosX*dPosX)+(tEdgeP.position*tEdgeP.position)) end if bPushDr then dZedPos = dPosZ else dZedPos = (DGD.dT - dPosZ) end if sSideLk == 'L' then -- se serratura a sinistra if bRemake then ptRef = DGD.PminTop ptPos = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A4+nAngleBase)), ptRef:getY()+(nRadBase*sin(DGD.A4+nAngleBase)) , dZedPos) ptPosUpGeom = Point3d( ptRef:getX()+(tEdgeP.position*cos(DGD.A4)), ptRef:getY()+(tEdgeP.position*sin(DGD.A4)) , DGD.dT) ptPosDwGeom = Point3d( ptPosUpGeom:getX(), ptPosUpGeom:getY() , 0) else ptPos = Point3d( dPosX + EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0), ( DGD.dH - tEdgeP.position) , dZedPos) ptPosUpGeom = Point3d( EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0), ( DGD.dH - tEdgeP.position) , DGD.dT) ptPosDwGeom = Point3d( ptPosUpGeom:getX(), ptPosUpGeom:getY() , 0) end dPosXProbe = dPosX + DGD.DPR dXFromExt = 0 dYFromExt = ptPos:getY() else -- serratura a destra if bRemake then ptRef = DGD.PmaxTop ptPos = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A7-nAngleBase)), ptRef:getY()+(nRadBase*sin(DGD.A7-nAngleBase)) , dZedPos) ptPosUpGeom = Point3d( ptRef:getX()+(tEdgeP.position*cos(DGD.A7)), ptRef:getY()+(tEdgeP.position*sin(DGD.A7)) , DGD.dT) ptPosDwGeom = Point3d( ptPosUpGeom:getX(), ptPosUpGeom:getY() , 0) else ptPos = Point3d( ( DGD.dW - dPosX - EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0)), ( DGD.dH - tEdgeP.position) , dZedPos) ptPosUpGeom = Point3d( ( DGD.dW - EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0)), ( DGD.dH - tEdgeP.position) , DGD.dT) ptPosDwGeom = Point3d( ptPosUpGeom:getX(), ptPosUpGeom:getY() , 0) end dPosXProbe = DGD.dW - dPosX - DGD.DPR dXFromExt = DGD.dW dYFromExt = ptPos:getY() end MoveGeometryLck( 'edgepull', tEdgeP.geom, sSideLk, bPushDr, ptPos, ptPosUpGeom, ptPosDwGeom) InsertProbeGeom( tEdgeP.geom, Point3d(dPosXProbe,ptPos:getY(),0), Point3d(dXFromExt,dYFromExt,0), 10, 3) end ----------------------------------------------------------------- local function MoveStrike( tStrike, sSideLk, bPushDr) local dPosX local dPosXUpDw local dPosZ local ptPos local ptPosBox local ptRef local ptFromExt local ptPosUpGeom local ptPosDwGeom local dDeltaX local dZedPos = 0 local nAngleBase local nRadBase local nAngleBaseUpDw local nRadBaseUpDw if DGD.OFFSET and DGD.OFFSET > 0 then dDeltaX = DGD.OFFSET * TAN3 dPosZ = DGD.OFFSET else dDeltaX = (DGD.dT/2) * TAN3 dPosZ = (DGD.dT/2) end if DGD.tProfs.lockedge.trimming == 'BU' or DGD.tProfs.lockedge.trimming == 'BD' or DGD.tProfs.lockedge.trimming == 'BDEB' or DGD.tProfs.lockedge.trimming == 'BUEB' then -- se profilo bevel dPosX = dDeltaX dPosXUpDw = dDeltaX else dPosX = 0 dPosXUpDw = 0 end -- by DGC.Bwd setting set to 0 the dPosXUpDw and dPosX parameters if DGC.Bwd and DGC.Bwd >= 1 then dPosXUpDw = 0 if DGC.Bwd == 2 then dPosX = 0 end end if DGD.sFrame then sSideLk = EgtIf( sSideLk == 'L', 'R', 'L') end if bRemake then nAngleBase = atan(dPosX/tStrike.position) nRadBase = sqrt((dPosX*dPosX)+(tStrike.position*tStrike.position)) nRadBaseBox = tStrike.position nAngleBaseUpDw = atan((dPosXUpDw+tStrike.back_set)/tStrike.position) nRadBaseUpDw = sqrt(((dPosXUpDw+tStrike.back_set)*(dPosXUpDw+tStrike.back_set))+(tStrike.position*tStrike.position)) end if bPushDr then dZedPos = dPosZ else dZedPos = (DGD.dT - dPosZ) end if sSideLk == 'L' then -- se serratura a sinistra if bRemake then ptRef = DGD.PminTop ptPos = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A4+nAngleBase)), ptRef:getY()+(nRadBase*sin(DGD.A4+nAngleBase)) , dZedPos) ptPosBox = Point3d( ptRef:getX()+(nRadBaseBox*cos(DGD.A4)), ptRef:getY()+(nRadBaseBox*sin(DGD.A4)) , dZedPos) ptPosUpGeom = Point3d( ptRef:getX()+(nRadBaseUpDw*cos(DGD.A4+nAngleBaseUpDw)), ptRef:getY()+(nRadBaseUpDw*sin(DGD.A4+nAngleBaseUpDw)) , DGD.dT) ptPosDwGeom = Point3d( ptRef:getX()+(nRadBaseUpDw*cos(DGD.A4+nAngleBaseUpDw)), ptRef:getY()+(nRadBaseUpDw*sin(DGD.A4+nAngleBaseUpDw)) , 0) ptFromExt = ptPosUpGeom else ptPos = Point3d( dPosX + EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0), ( DGD.dH - tStrike.position) , dZedPos) ptPosBox = Point3d( EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0), ( DGD.dH - tStrike.position) , dZedPos) ptPosUpGeom = Point3d( ( dPosXUpDw + tStrike.back_set + EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0)), ( DGD.dH - tStrike.position) , DGD.dT) ptPosDwGeom = Point3d( ( dPosXUpDw + tStrike.back_set + EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0)), ( DGD.dH - tStrike.position) , 0) ptFromExt = Point3d( EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0), ( DGD.dH - tStrike.position) , DGD.dT) end else -- serratura a destra if bRemake then ptRef = DGD.PmaxTop ptPos = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A7-nAngleBase)), ptRef:getY()+(nRadBase*sin(DGD.A7-nAngleBase)) , dZedPos) ptPosBox = Point3d( ptRef:getX()+(nRadBaseBox*cos(DGD.A7)), ptRef:getY()+(nRadBaseBox*sin(DGD.A7)) , dZedPos) ptPosUpGeom = Point3d( ptRef:getX()+(nRadBaseUpDw*cos(DGD.A7-nAngleBaseUpDw)), ptRef:getY()+(nRadBaseUpDw*sin(DGD.A7-nAngleBaseUpDw)) , DGD.dT) ptPosDwGeom = Point3d( ptRef:getX()+(nRadBaseUpDw*cos(DGD.A7-nAngleBaseUpDw)), ptRef:getY()+(nRadBaseUpDw*sin(DGD.A7-nAngleBaseUpDw)) , 0) ptFromExt = ptPosUpGeom else ptPos = Point3d( ( DGD.dW - dPosX - EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0)), ( DGD.dH - tStrike.position) , dZedPos) ptPosBox = Point3d( ( DGD.dW - EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0)), ( DGD.dH - tStrike.position) , dZedPos) ptPosUpGeom = Point3d( ( DGD.dW - dPosXUpDw - tStrike.back_set - EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0)), ( DGD.dH - tStrike.position) , DGD.dT) ptPosDwGeom = Point3d( ( DGD.dW - dPosXUpDw - tStrike.back_set - EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0)), ( DGD.dH - tStrike.position) , 0) ptFromExt = Point3d( ( DGD.dW - EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0)), ( DGD.dH - tStrike.position) , DGD.dT) end end MoveGeometryLck( 'strike', tStrike.geom, sSideLk, bPushDr, ptPos, ptPosUpGeom, ptPosDwGeom, nil, ptPosBox) InsertProbeGeom( tStrike.geom, ptPosUpGeom, ptFromExt, 14, 3) end ----------------------------------------------------------------- -- *** Geometric processing : VIEWERS *** ----------------------------------------------------------------- local function MoveSubGeomViewer( nSubViewerId, sSideDoor, sSideLk, ptPosUpGeom, ptPosDwGeom) if ( sSideDoor == 'secure') then EgtRotate( nSubViewerId, ORIG(), X_AX(), 180 ) -- ruoto su faccia inferiore end EgtRotate( nSubViewerId, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra if sSideLk == 'R' then -- se serratura a destra EgtMirror( nSubViewerId, ORIG(), X_AX()) -- faccio il mirror su asse Y end if ( sSideDoor == 'secure') then EgtMove( nSubViewerId, ptPosDwGeom - ORIG()) else EgtMove( nSubViewerId, ptPosUpGeom - ORIG()) end -- creo estrusi e superfici piane delle geometrie passanti AddSurfTmByExtrusion( EgtGetParent(nSubViewerId), nSubViewerId, true) -- sposto gli estrusi e le superfici piane nel layer solid AddFlatSurf( EgtGetParent(nSubViewerId), EgtGetParent(nSubViewerId)) end ----------------------------------------------------------------- local function MoveGeomViewer( nViewerId, sSideLk, ptPosUpGeom, ptPosDwGeom) if not nViewerId then return end local nIdGeomViewer local sSideDoorToMove local sMessageErr = '' -- devo ottenere tutte le geometrie dello spioncino nIdGeomViewer = EgtGetFirstInGroup( nViewerId) -- ottengo la prima geometria local nErr = 0 while nIdGeomViewer do sSideDoorToMove = EgtGetInfo( nIdGeomViewer, 'SideDoor') if sSideDoorToMove then -- Controllo se la nota è corretta local sSideDoor = string.lower(sSideDoorToMove) -- keyway e secure: no rotazione angolo profilo; if sSideDoor == 'keyway' or sSideDoor == 'secure' then MoveSubGeomViewer( nIdGeomViewer, sSideDoor, sSideLk, ptPosUpGeom, ptPosDwGeom) else -- messaggio di errore sMessageErr = string.format( EgtDoorsMsg[418],nIdGeomViewer,nViewerId, sSideDoor, DGD.FILE) DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr nErr = 1007 end else -- messaggio di errore sMessageErr = string.format( EgtDoorsMsg[419],nIdGeomViewer,nViewerId, DGD.FILE) DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr nErr = 1008 end nIdGeomViewer = EgtGetNext(nIdGeomViewer) end -- assegno codice errore se ancora non fatto if DGD.ERR == 0 then DGD.ERR = nErr end end ----------------------------------------------------------------- local function MoveViewer( tViewer, sSideLk, bPushDr) local ptPosUpGeom local ptPosDwGeom local ptRef local dZedPos = 0 local nAngleBase local nRadBase local dPosY local dPosX if bRemake then dPosX = EgtIf( sSideLk == 'L', ( DGD.dW / 2) + tViewer.delta_center, ( DGD.dW / 2) - tViewer.delta_center) nAngleBase = atan(dPosX,tViewer.bottom_rail) nRadBase = sqrt((dPosX*dPosX)+(tViewer.bottom_rail*tViewer.bottom_rail)) end local dPosY = EgtIf( tViewer.side and tViewer.side == 'top', ( DGD.dH - tViewer.bottom_rail), tViewer.bottom_rail) if sSideLk == 'L' then -- se serratura a sinistra if bRemake then if tViewer.side and tViewer.side == 'top' then ptRef = DGD.PminTop ptPosUpGeom = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A4+nAngleBase)), ptRef:getY()+(nRadBase*sin(DGD.A4+nAngleBase)) , DGD.dT) else ptRef = DGD.PminBot ptPosUpGeom = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A3-nAngleBase)), ptRef:getY()+(nRadBase*sin(DGD.A3-nAngleBase)) , DGD.dT) end ptPosDwGeom = Point3d( ptPosUpGeom:getX(), ptPosUpGeom:getY() , 0) else ptPosUpGeom = Point3d( ( ( DGD.dW / 2) + tViewer.delta_center), dPosY , DGD.dT) ptPosDwGeom = Point3d( ( ( DGD.dW / 2) + tViewer.delta_center), dPosY , 0) end else -- serratura a destra if bRemake then if tViewer.side and tViewer.side == 'top' then ptRef = DGD.PmaxTop ptPosUpGeom = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A7-nAngleBase)), ptRef:getY()+(nRadBase*sin(DGD.A7-nAngleBase)) , DGD.dT) else ptRef = DGD.PmaxBot ptPosUpGeom = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A8+nAngleBase)), ptRef:getY()+(nRadBase*sin(DGD.A8+nAngleBase)) , DGD.dT) end ptPosDwGeom = Point3d( ptPosUpGeom:getX(), ptPosUpGeom:getY() , 0) else ptPosUpGeom = Point3d( ( ( DGD.dW / 2) - tViewer.delta_center), dPosY , DGD.dT) ptPosDwGeom = Point3d( ( ( DGD.dW / 2) - tViewer.delta_center), dPosY , 0) end end MoveGeomViewer( tViewer.geom, sSideLk, ptPosUpGeom, ptPosDwGeom) if bRemake then local dAngleLoc dAngleLoc = (DGD.A3 + DGD.A8) / 2 EgtRotate( tViewer.geom, ptPosUpGeom, Z_AX(), ( dAngleLoc-90)) end InsertProbeGeom( tViewer.geom, ptPosDwGeom) end ----------------------------------------------------------------- -- *** Geometric subgeom processing : ROLLERLATCHS *** ----------------------------------------------------------------- local function ApplyDispRollerLatch( nIdGeomType, nExtraAngle, sSideLk, bPushDr, sSideDoor, ptPosUpGeom, ptPos) EgtRotate( nIdGeomType, ORIG(), X_AX(), -( 90 + nExtraAngle)) -- ruoto su faccia dietro if DGD.SIDE == 'lock' then if sSideLk == 'L' then -- se serratura a destra EgtRotate( nIdGeomType, ORIG(), Z_AX(), 90 ) -- ruoto su faccia sinistra else EgtRotate( nIdGeomType, ORIG(), Z_AX(), -90 ) -- ruoto su faccia destra end end if bPushDr then -- se apertura a spingere EgtMirror( nIdGeomType, ORIG(), Z_AX()) end if DGD.sFrame then if string.lower(DGD.SIDE) == 'bottom' then -- frame superiore ( ha il side opposto) if DGD.OTHERD then EgtMirror( nIdGeomType, ORIG(), Y_AX()) else EgtMirror( nIdGeomType, ORIG(), X_AX()) EgtMirror( nIdGeomType, ORIG(), Y_AX()) end elseif string.lower(DGD.SIDE) == 'top' then -- frame inferiore (ha il side opposto) if not DGD.OTHERD then EgtMirror( nIdGeomType, ORIG(), X_AX()) end end else if string.lower(DGD.SIDE) == 'bottom' then EgtMirror( nIdGeomType, ORIG(), Y_AX()) end end -- se geometria sul fianco if sSideDoor == 'edge' then -- se spostamento sul bordo EgtMove( nIdGeomType, ptPosUpGeom - ORIG()) elseif ( sSideDoor == 'center') then -- se posizionamento in centro spessore EgtMove( nIdGeomType, ptPos - ORIG()) end end local function MoveSubGeomRollerLatch( nSubRollerLatchId, sSideDoor, sSideLk, bPushDr, ptPos, ptPosUpGeom, nExtraAngle, ptPosDwGeom) -- ciclo sulle geometrie singole invece di modificare il layer local nIdGeomType nIdGeomType = EgtGetFirstInGroup( nSubRollerLatchId) -- ottengo la prima geometria while nIdGeomType do local sSideDoorBox = EgtGetInfo( nIdGeomType, 'SideDoor') local nUpperToDelete -- rinomino eventuali geometrie che descrivono solo la sezione if sSideDoorBox and sSideDoorBox == 'upper' then if not DGD.Dws then if bPushDr then EgtSetInfo( nIdGeomType, 'SideDoor', 'keyway') sSideDoorBox = 'keyway' else EgtSetInfo( nIdGeomType, 'SideDoor', 'secure') sSideDoorBox = 'secure' end else EgtSetInfo( nIdGeomType, 'SideDoor', 'keyway') sSideDoorBox = 'keyway' end nUpperToDelete = nIdGeomType end if sSideDoorBox == 'keyway' or sSideDoorBox == 'secure' then if not DGD.Dws then -- se disposizione frame su lato narrow o porta EgtRotate( nIdGeomType, ORIG(), X_AX(), 180) if DGD.SIDE == 'lock' then if sSideLk == 'L' then -- se serratura a destra EgtRotate( nIdGeomType, ORIG(), Z_AX(), 90 ) -- ruoto su faccia sinistra else EgtRotate( nIdGeomType, ORIG(), Z_AX(), -90 ) -- ruoto su faccia destra end end if bPushDr then -- se apertura a spingere EgtMirror( nIdGeomType, ORIG(), Z_AX()) end if DGD.sFrame then if string.lower(DGD.SIDE) == 'bottom' then -- frame superiore ( ha il side opposto) if DGD.OTHERD then EgtMirror( nIdGeomType, ORIG(), Y_AX()) else EgtMirror( nIdGeomType, ORIG(), X_AX()) EgtMirror( nIdGeomType, ORIG(), Y_AX()) end elseif string.lower(DGD.SIDE) == 'top' then -- frame inferiore (ha il side opposto) if not DGD.OTHERD then EgtMirror( nIdGeomType, ORIG(), X_AX()) end end else if string.lower(DGD.SIDE) == 'bottom' then EgtMirror( nIdGeomType, ORIG(), Y_AX()) end end EgtMove( nIdGeomType, ptPosDwGeom - ORIG()) else ApplyDispRollerLatch( nIdGeomType, nExtraAngle, sSideLk, bPushDr, sSideDoor, ptPosUpGeom, ptPos) end -- creo estrusi e superfici piane delle geometrie passanti AddSurfTmByExtrusion( EgtGetParent(nIdGeomType), nIdGeomType, true) -- sposto gli estrusi e le superfici piane nel layer solid AddFlatSurf( EgtGetParent(nIdGeomType), EgtGetParent(nIdGeomType)) else if sSideDoorBox and string.lower(sSideDoorBox) == 'locklh' then nExtraAngle = 0 end ApplyDispRollerLatch( nIdGeomType, nExtraAngle, sSideLk, bPushDr, sSideDoor, ptPosUpGeom, ptPos) end nIdGeomType = EgtGetNext(nIdGeomType) -- cancello il percorso 'upper' if nUpperToDelete then EgtErase( nUpperToDelete) end end end ----------------------------------------------------------------- -- *** Geometric subgeom processing : PIVOTS *** ----------------------------------------------------------------- local function ApplyDispPivot( nIdGeomType, nLocAngle, bPushDr, sSideLk, sSideDoor, ptPosUpGeom, ptPos) EgtRotate( nIdGeomType, ORIG(), X_AX(), ( 90 + nLocAngle), GDB_RT.GLOB) -- ruoto su faccia frontale per RHR e LHR EgtRotate( nIdGeomType, ORIG(), Z_AX(), 90, GDB_RT.GLOB) -- ruoto su faccia destra RHR e LHR if bPushDr then -- se apertura a spingere RH LH EgtMirror( nIdGeomType, ORIG(), Z_AX(), GDB_RT.GLOB) end if sSideLk == 'R' then -- se serratura a destra LH LHR EgtMirror( nIdGeomType, ORIG(), X_AX(), GDB_RT.GLOB) end if sSideDoor == 'edge' then -- se spostamento sul bordo EgtMove( nIdGeomType, ptPosUpGeom - ORIG(), GDB_RT.GLOB) elseif ( sSideDoor == 'center') then -- se posizionamento in centro spessore EgtMove( nIdGeomType, ptPos - ORIG(), GDB_RT.GLOB) end end local function MoveSubGeomPivot( nSubPivotId, sSideDoor, sSideLk, bPushDr, ptPos, ptPosUpGeom, nExtraAngle, ptPosDwGeom) if string.lower(DGD.TYPE) ~= 'offsetintermediate' then EgtRotate( nSubPivotId, ORIG(), X_AX(), -90) -- ruoto su faccia dietro if DGD.sFrame then if DGD.nTypePz == 5 then -- se serratura a destra: LH, LHR, ... e non è sulla seconda anta if ( sSideLk == 'R' and not DGD.OTHERD) or ( sSideLk == 'L' and DGD.OTHERD) then EgtMirror( nSubPivotId, ORIG(), X_AX()) end elseif DGD.nTypePz == 6 then -- se serratura a destra: LH, LHR, ... e non è sulla seconda anta if ( sSideLk == 'R' and DGD.OTHERD) or ( sSideLk == 'L' and not DGD.OTHERD) then EgtMirror( nSubPivotId, ORIG(), X_AX()) end end if not bPushDr then -- se apertura a tirare EgtMirror( nSubPivotId, ORIG(), Z_AX()) end else if sSideLk == 'R' then -- se serratura a destra: LH, LHR, ... EgtMirror( nSubPivotId, ORIG(), X_AX()) end if not bPushDr then -- se apertura a tirare EgtMirror( nSubPivotId, ORIG(), Z_AX()) end end if ( string.lower(DGD.SIDE) == 'bottom') then EgtMirror( nSubPivotId, ORIG(), Y_AX()) elseif DGD.sFrame and ( string.lower(DGD.SIDE) == 'top') then EgtMirror( nSubPivotId, ORIG(), X_AX()) end if sSideDoor == 'edge' then -- se spostamento sul bordo EgtMove( nSubPivotId, ptPosUpGeom - ORIG()) elseif ( sSideDoor == 'center') then -- se posizionamento in centro spessore EgtMove( nSubPivotId, ptPos - ORIG()) end -- gestione percorsi upper local nIdGeomType = EgtGetFirstInGroup( nSubPivotId) -- ottengo la prima geometria local sSideDoorBox while nIdGeomType do sSideDoorBox = EgtGetInfo( nIdGeomType, 'SideDoor') local nUpperToDelete -- rinomino eventuali geometrie che descrivono solo la sezione if sSideDoorBox and sSideDoorBox == 'upper' then if not DGD.Dws then if bPushDr then EgtSetInfo( nIdGeomType, 'SideDoor', 'secure') sSideDoorBox = 'secure' else EgtSetInfo( nIdGeomType, 'SideDoor', 'keyway') sSideDoorBox = 'keyway' end else EgtSetInfo( nIdGeomType, 'SideDoor', 'keyway') sSideDoorBox = 'keyway' end nUpperToDelete = nIdGeomType end if sSideDoorBox == 'keyway' or sSideDoorBox == 'secure' then -- creo estrusi e superfici piane delle geometrie passanti AddSurfTmByExtrusion( EgtGetParent(nIdGeomType), nIdGeomType, true) -- sposto gli estrusi e le superfici piane nel layer solid AddFlatSurf( EgtGetParent(nIdGeomType), EgtGetParent(nIdGeomType)) end nIdGeomType = EgtGetNext(nIdGeomType) -- cancello il percorso 'upper' if nUpperToDelete then EgtErase( nUpperToDelete) end end else -- altimrnti è offset intermediate local nLocAngle = nExtraAngle local sSideDoorBox local nIdGeomType = EgtGetFirstInGroup( nSubPivotId) -- ottengo la prima geometria while nIdGeomType do sSideDoorBox = EgtGetInfo( nIdGeomType, 'SideDoor') local nUpperToDelete if sSideDoorBox and string.lower(sSideDoorBox) == 'locklh' then nLocAngle = 0 end -- rinomino eventuali geometrie che descrivono solo la sezione if sSideDoorBox and sSideDoorBox == 'upper' then if not DGD.Dws then if bPushDr then EgtSetInfo( nIdGeomType, 'SideDoor', 'secure') sSideDoorBox = 'secure' else EgtSetInfo( nIdGeomType, 'SideDoor', 'keyway') sSideDoorBox = 'keyway' end else EgtSetInfo( nIdGeomType, 'SideDoor', 'keyway') sSideDoorBox = 'keyway' end nUpperToDelete = nIdGeomType end if sSideDoorBox == 'keyway' or sSideDoorBox == 'secure' then if not DGD.Dws then -- se disposizione frame su lato narrow o porta -- if DGD.SIDE == 'hinge' then -- if sSideLk == 'L' then -- se serratura a sinistra -- EgtRotate( nIdGeomType, ORIG(), Z_AX(), 90 ) -- ruoto su faccia destra -- else -- EgtRotate( nIdGeomType, ORIG(), Z_AX(), -90 ) -- ruoto su faccia sinistra -- end -- end EgtRotate( nIdGeomType, ORIG(), Z_AX(), 90 ) -- ruoto su faccia destra if bPushDr then -- se apertura a spingere EgtMirror( nIdGeomType, ORIG(), Z_AX()) end if sSideLk == 'R' then -- se serratura a destra LH LHR EgtMirror( nIdGeomType, ORIG(), X_AX(), GDB_RT.GLOB) end if DGD.sFrame then if string.lower(DGD.SIDE) == 'bottom' then -- frame superiore ( ha il side opposto) if DGD.OTHERD then EgtMirror( nIdGeomType, ORIG(), Y_AX()) else EgtMirror( nIdGeomType, ORIG(), X_AX()) EgtMirror( nIdGeomType, ORIG(), Y_AX()) end elseif string.lower(DGD.SIDE) == 'top' then -- frame inferiore (ha il side opposto) if not DGD.OTHERD then EgtMirror( nIdGeomType, ORIG(), X_AX()) end end else -- if string.lower(DGD.SIDE) == 'bottom' then -- EgtMirror( nIdGeomType, ORIG(), Y_AX()) -- end end EgtMove( nIdGeomType, ptPosDwGeom - ORIG()) else ApplyDispPivot( nIdGeomType, nLocAngle, bPushDr, sSideLk, sSideDoor, ptPosUpGeom, ptPos) end -- creo estrusi e superfici piane delle geometrie passanti AddSurfTmByExtrusion( EgtGetParent(nIdGeomType), nIdGeomType, true) -- sposto gli estrusi e le superfici piane nel layer solid AddFlatSurf( EgtGetParent(nIdGeomType), EgtGetParent(nIdGeomType)) else ApplyDispPivot( nIdGeomType, nLocAngle, bPushDr, sSideLk, sSideDoor, ptPosUpGeom, ptPos) end nIdGeomType = EgtGetNext(nIdGeomType) -- cancello il percorso 'upper' if nUpperToDelete then EgtErase( nUpperToDelete) end end end end ----------------------------------------------------------------- -- *** Geometric subgeom processing : STOPSANDCLOSERS *** ----------------------------------------------------------------- local function MoveSubGeomStopAndCloser( nSubtStopAndCloserId, sSideDoor, sSideLk, bPushDr, ptPos, ptPosUp, nBoxGeom, ptPosUpGeom, ptPosDwGeom) local dDeltaPos = 0 local sDeltaPos local psDelta -- ciclo sulle geometrie singole invece di modificare il layer local nIdGeomType -- se devo muovere le singole geometrie dell' OverHead o il layer dello stop&closer e la geometria di ingombro presente nello Stop&Closer if not nBoxGeom or nBoxGeom == 0 then nIdGeomType = nSubtStopAndCloserId -- se geometria sul fianco if sSideDoor == 'edge' then -- se spostamento sul bordo sDeltaPos = EgtGetInfo( nIdGeomType, 'DeltaPos') if sDeltaPos then dDeltaPos = tonumber( sDeltaPos) end EgtRotate( nIdGeomType, ORIG(), X_AX(), -90 ) -- ruoto su faccia dietro if DGD.SIDE and string.lower(DGD.SIDE) == 'bottom' then EgtMirror( nIdGeomType, ORIG(), Y_AX()) end if bPushDr then -- se apertura a spingere EgtMirror( nIdGeomType, ORIG(), Z_AX()) -- faccio il mirror su asse Z per ribaltare l'uscita in alto EgtMirror( nIdGeomType, ORIG(), X_AX()) -- faccio il mirror su asse X per risistemare la direzione percorso EgtMove( nIdGeomType, Point3d( -dDeltaPos, 0, 0) - ORIG()) -- riposiziono per il ribaltamento del mirror in X end if DGD.sFrame then if ( sSideLk == 'R' and DGD.OTHERD) or ( sSideLk == 'L' and not DGD.OTHERD) then dDeltaPos = 0 end else if sSideLk == 'L' then -- se serratura a sinistra dDeltaPos = 0 end end if bRemake then if DGD.SIDE and string.lower(DGD.SIDE) == 'bottom' then psDelta = Point3d( ( dDeltaPos * cos(DGD.A2)), ( dDeltaPos * sin(DGD.A2)), 0) else psDelta = Point3d( ( dDeltaPos * cos(DGD.A5)), ( dDeltaPos * sin(DGD.A5)), 0) end else psDelta = Point3d( dDeltaPos, 0, 0) end EgtMove( nIdGeomType, ( ptPosUp + psDelta) - ORIG()) if bRemake then if DGD.SIDE and string.lower(DGD.SIDE) == 'bottom' then EgtRotate( nIdGeomType, ( ptPosUp + psDelta), Z_AX(), DGD.A2) else EgtRotate( nIdGeomType, ( ptPosUp + psDelta), Z_AX(), DGD.A5) end end elseif ( sSideDoor == 'center') then -- se posizionamento in centro spessore sDeltaPos = EgtGetInfo( nIdGeomType, 'DeltaPos') if sDeltaPos then dDeltaPos = tonumber( sDeltaPos) end EgtRotate( nIdGeomType, ORIG(), X_AX(), -90, GDB_RT.GLOB) -- ruoto su faccia dietro su coordinate globali if DGD.SIDE and string.lower(DGD.SIDE) == 'bottom' then EgtMirror( nIdGeomType, ORIG(), Y_AX()) end if DGD.sFrame then if ( sSideLk == 'R' and DGD.OTHERD) or ( sSideLk == 'L' and not DGD.OTHERD) then dDeltaPos = 0 end else if sSideLk == 'L' then -- se serratura a sinistra dDeltaPos = 0 end end if bRemake then if DGD.SIDE and string.lower(DGD.SIDE) == 'bottom' then psDelta = Point3d( ( dDeltaPos * cos(DGD.A2)), ( dDeltaPos * sin(DGD.A2)), 0) else psDelta = Point3d( ( dDeltaPos * cos(DGD.A5)), ( dDeltaPos * sin(DGD.A5)), 0) end else psDelta = Point3d( dDeltaPos, 0, 0) end EgtMove( nIdGeomType, ( ptPos + psDelta) - ORIG()) if bRemake then if DGD.SIDE and string.lower(DGD.SIDE) == 'bottom' then EgtRotate( nIdGeomType, ( ptPos + psDelta), Z_AX(), DGD.A2) else EgtRotate( nIdGeomType, ( ptPos + psDelta), Z_AX(), DGD.A5) end end end -- cerco nel layer la geometria di ingombro presente nello Stop&Closer if nBoxGeom then nIdGeomType = EgtGetFirstInGroup( nSubtStopAndCloserId) -- ottengo la prima geometria while nIdGeomType do local sSideDoorBox = EgtGetInfo( nIdGeomType, 'SideDoor') local nUpperToDelete -- rinomino eventuali geometrie che descrivono solo la sezione if sSideDoorBox and sSideDoorBox == 'upper' then if not DGD.Dws then if bPushDr then EgtSetInfo( nIdGeomType, 'SideDoor', 'keyway') sSideDoorBox = 'keyway' else EgtSetInfo( nIdGeomType, 'SideDoor', 'secure') sSideDoorBox = 'secure' end else EgtSetInfo( nIdGeomType, 'SideDoor', 'keyway') sSideDoorBox = 'keyway' end nUpperToDelete = nIdGeomType end if sSideDoorBox == 'keyway' or sSideDoorBox == 'secure' then if not DGD.Dws then -- se disposizione frame su lato narrow o porta EgtRotate( nIdGeomType, ORIG(), X_AX(), -90 ) -- ruoto su faccia dietro end -- creo estrusi e superfici piane delle geometrie passanti AddSurfTmByExtrusion( EgtGetParent(nIdGeomType), nIdGeomType, true) -- sposto gli estrusi e le superfici piane nel layer solid AddFlatSurf( EgtGetParent(nIdGeomType), EgtGetParent(nIdGeomType)) elseif sSideDoorBox == 'Keyway' then -- geometria originale if not DGD.Dws then -- creo estrusi e superfici piane delle geometrie passanti AddSurfTmByExtrusion( EgtGetParent(nIdGeomType), nIdGeomType, true) -- sposto gli estrusi e le superfici piane nel layer solid AddFlatSurf( EgtGetParent(nIdGeomType), EgtGetParent(nIdGeomType)) end elseif sSideDoorBox == 'Secure' then -- geometria originale if not DGD.Dws then -- creo estrusi e superfici piane delle geometrie passanti AddSurfTmByExtrusion( EgtGetParent(nIdGeomType), nIdGeomType, true) -- sposto gli estrusi e le superfici piane nel layer solid AddFlatSurf( EgtGetParent(nIdGeomType), EgtGetParent(nIdGeomType)) end end nIdGeomType = EgtGetNext(nIdGeomType) -- cancello il percorso 'upper' if nUpperToDelete then EgtErase( nUpperToDelete) end end end elseif nBoxGeom == 1 then -- se singolo persorso di ingombro dell'OverHead nIdGeomType = nSubtStopAndCloserId if bPushDr then EgtSetInfo( nIdGeomType, 'SideDoor', 'keyway') sSideDoorBox = 'keyway' else EgtSetInfo( nIdGeomType, 'SideDoor', 'secure') sSideDoorBox = 'secure' end -- le geometrie di ingombro sono posizionate sempre sul bordo, quindi tipo 'edge' sDeltaPos = EgtGetInfo( nIdGeomType, 'DeltaPos') if sDeltaPos then dDeltaPos = tonumber( sDeltaPos) end EgtRotate( nIdGeomType, ORIG(), X_AX(), 180 ) -- ruoto su faccia dietro if DGD.SIDE and string.lower(DGD.SIDE) == 'bottom' then EgtMirror( nIdGeomType, ORIG(), Y_AX()) end if bPushDr then -- se apertura a spingere EgtMirror( nIdGeomType, ORIG(), Z_AX()) -- faccio il mirror su asse Z per ribaltare l'uscita in alto EgtMirror( nIdGeomType, ORIG(), X_AX()) -- faccio il mirror su asse X per risistemare la direzione percorso EgtMove( nIdGeomType, Point3d( -dDeltaPos, 0, 0) - ORIG()) -- riposiziono per il ribaltamento del mirror in X end if DGD.sFrame then -- se serratura a destra: LH, LHR, ... e non è sulla seconda anta if ( sSideLk == 'R' and not DGD.OTHERD) or ( sSideLk == 'L' and DGD.OTHERD) then EgtMirror( nSubPivotId, ORIG(), X_AX()) end if sSideLk == 'L' then -- se serratura a sinistra dDeltaPos = 0 end else if sSideLk == 'L' then -- se serratura a sinistra dDeltaPos = 0 end end if bRemake then if DGD.SIDE and string.lower(DGD.SIDE) == 'bottom' then psDelta = Point3d( ( dDeltaPos * cos(DGD.A2)), ( dDeltaPos * sin(DGD.A2)), 0) else psDelta = Point3d( ( dDeltaPos * cos(DGD.A5)), ( dDeltaPos * sin(DGD.A5)), 0) end else psDelta = Point3d( dDeltaPos, 0, 0) end EgtMove( nIdGeomType, ( ptPosUp + psDelta) - ORIG()) if bRemake then if DGD.SIDE and string.lower(DGD.SIDE) == 'bottom' then EgtRotate( nIdGeomType, ( ptPosUp + psDelta), Z_AX(), DGD.A2) else EgtRotate( nIdGeomType, ( ptPosUp + psDelta), Z_AX(), DGD.A5) end end -- creo estrusi e superfici piane delle geometrie passanti AddSurfTmByExtrusion( EgtGetParent(nIdGeomType), nIdGeomType, true) -- sposto gli estrusi e le superfici piane nel layer solid AddFlatSurf( EgtGetParent(nIdGeomType), EgtGetParent(nIdGeomType)) -- cancello il percorso 'upper' EgtErase( nUpperToDelete) end end ----------------------------------------------------------------------------------------- -- *** Geometric processing : common functions for rollerlatch, pivot, stopandcloser *** ----------------------------------------------------------------------------------------- local function MoveGeometryTopDwHSide( sTypeGeom, nGeomId, sSideLk, bPushDr, ptPos, ptPosUp, nExtraAngle, ptPosDw, ptPosUpGeom, ptPosDwGeom) if not nGeomId then return end local sSideDoorToMove local sMessageErr = '' sSideDoorToMove = EgtGetInfo( nGeomId, 'InserPoint') local nErr = 0 if DGD.sFrame and DGD.nTypePz == 5 then DGD.SIDE = 'bottom' elseif DGD.sFrame and DGD.nTypePz == 6 then DGD.SIDE = 'top' end if sSideDoorToMove then -- Controllo se la nota è corretta local sSideDoor = string.lower(sSideDoorToMove) if sTypeGeom == 'rollerlatch' then -- Edge: sullo spigolo della porta; Centre: in centro allo spessore if sSideDoor == 'edge' or sSideDoor == 'center' then MoveSubGeomRollerLatch( nGeomId, sSideDoor, sSideLk, bPushDr, ptPos, ptPosUp, nExtraAngle, ptPosDw) else -- messaggio di errore sMessageErr = string.format( EgtDoorsMsg[415],nGeomId,'RollerLatch',sSideDoor, DGD.FILE) DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr nErr = 1009 end elseif sTypeGeom == 'pivot' then -- Edge: sullo spigolo della porta; Centre: in centro allo spessore if sSideDoor == 'edge' or sSideDoor == 'center' then MoveSubGeomPivot( nGeomId, sSideDoor, sSideLk, bPushDr, ptPos, ptPosUp, nExtraAngle, ptPosDw) else -- messaggio di errore sMessageErr = string.format( EgtDoorsMsg[415],nGeomId,'Pivot',sSideDoor, DGD.FILE) DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr nErr = 1011 end elseif sTypeGeom == 'stopandcloser' then -- Edge: sullo spigolo della porta; Centre: in centro allo spessore if sSideDoor == 'edge' or sSideDoor == 'center' then local nBoxGeom = 0 MoveSubGeomStopAndCloser( nGeomId, sSideDoor, sSideLk, bPushDr, ptPos, ptPosUp, nBoxGeom, ptPosUpGeom, ptPosDwGeom) else -- messaggio di errore sMessageErr = string.format( EgtDoorsMsg[415],nGeomId,'StopAndCloser',sSideDoor, DGD.FILE) DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr nErr = 1013 end end else -- messaggio di errore in base al tipo di pezzo if sTypeGeom == 'rollerlatch' then sMessageErr = string.format( EgtDoorsMsg[416],nGeomId,'RollerLatch', DGD.FILE) DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr nErr = 1010 elseif sTypeGeom == 'pivot' then sMessageErr = string.format( EgtDoorsMsg[416],nPivotId,'Pivot', DGD.FILE) DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr nErr = 1012 elseif sTypeGeom == 'stopandcloser' then sMessageErr = string.format( EgtDoorsMsg[416],nStopAndCloserId,'StopAndCloser', DGD.FILE) DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr nErr = 1014 end end -- assegno codice errore se ancora non fatto if DGD.ERR == 0 then DGD.ERR = nErr end end ---------------------------------------------------------------------- -- *** Geometric processing : ROLLERLATCH, PIVOTS, STOPSANDCLOSERS *** ---------------------------------------------------------------------- local function MoveRollerLatch( tRollerLatch, sSideLk, bPushDr) local ptPos local ptPosBox local ptRef local ptPosUpGeom local ptPosDwGeom local dPosX local dPosY local dPosXProbe local dPosYProbe local dPosZ local dPosZup local dXFromExt local dYFromExt local dDeltaX local nAngleBase local nRadBase local nExtraAngle = 0 local nSideApplied = 2 if DGD.sFrame and DGD.nTypePz == 5 then tRollerLatch.side = 'bottom' bPushDr = not bPushDr elseif DGD.sFrame and DGD.nTypePz == 6 then tRollerLatch.side = 'top' bPushDr = not bPushDr end if DGD.OFFSET and DGD.OFFSET > 0 then dDeltaX = DGD.OFFSET * TAN3 dPosZ = DGD.OFFSET else dDeltaX = (DGD.dT/2) * TAN3 dPosZ = (DGD.dT/2) end -- se latch face ricalcolo il delta if DGD.LSREF then dDeltaX = DGD.dT * TAN3 end if bPushDr then dPosZup = DGD.dT else dPosZ = (DGD.dT - dPosZ) dPosZup = 0 end -- se applicato a lato top o bottom cambio la coordinata in Y if string.lower(tRollerLatch.side) == 'bottom' then if bRemake then local dLocAngle if sSideLk == 'L' then -- se serratura a sinistra ptRef = DGD.PminBot dLocAngle = DGD.A2 else ptRef = DGD.PmaxBot dLocAngle = DGD.A1 end dPosY = ptRef:getY()+((tRollerLatch.position)*sin(dLocAngle)) else dPosY = EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0) end dPosYProbe = dPosY + DGD.DPR dYFromExt = dPosY nSideApplied = 4 elseif string.lower(tRollerLatch.side) == 'lock' then if DGD.tProfs.lockedge.trimming == 'BU' or DGD.tProfs.lockedge.trimming == 'BD' or DGD.tProfs.lockedge.trimming == 'BDEB' or DGD.tProfs.lockedge.trimming == 'BUEB' then -- se profilo bevel su lato lock dPosX = dDeltaX -- se non è presente il blocco rotazione su bevel if not DGD.NOBVROT then nExtraAngle = 3 end else dPosX = 0 end -- by DGC.Bwd setting set to 0 the dPosX parameter if DGC.Bwd and DGC.Bwd == 2 then dPosX = 0 end if bRemake then nAngleBase = atan(dPosX/tRollerLatch.position) nRadBase = sqrt((dPosX*dPosX)+(tRollerLatch.position*tRollerLatch.position)) if sSideLk == 'L' then -- se serratura a sinistra ptRef = DGD.PminTop ptPos = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A4+nAngleBase)), ptRef:getY()+(nRadBase*sin(DGD.A4+nAngleBase)) , dPosZ) ptPosBox = Point3d( ptRef:getX()+(tRollerLatch.position*cos(DGD.A4)), ptRef:getY()+(tRollerLatch.position*sin(DGD.A4)) , dPosZ) dPosXProbe = ptRef:getX() + DGD.DPR dXFromExt = ptRef:getX() dPosYProbe = ptRef:getX()+(nRadBase*cos(DGD.A4+nAngleBase)) + DGD.DPR -- setto la X invece della Y dYFromExt = dPosYProbe else ptRef = DGD.PmaxTop ptPos = Point3d( ptRef:getX()+(nRadBase*cos(DGD.A7-nAngleBase)), ptRef:getY()+(nRadBase*sin(DGD.A7-nAngleBase)) , dPosZ) ptPosBox = Point3d( ptRef:getX()+(tRollerLatch.position*cos(DGD.A7)), ptRef:getY()+(tRollerLatch.position*sin(DGD.A7)) , dPosZ) dPosXProbe = ptRef:getX() - DGD.DPR dXFromExt = ptRef:getX() dPosYProbe = ptRef:getX()+(nRadBase*cos(DGD.A7-nAngleBase)) - DGD.DPR -- setto la X invece della Y dYFromExt = dPosYProbe end else if sSideLk == 'L' then -- se serratura a sinistra ptPos = Point3d( dPosX + EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0), ( DGD.dH - tRollerLatch.position) , dPosZ) ptPosBox = Point3d( EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0), ( DGD.dH - tRollerLatch.position) , dPosZ) dPosXProbe = ptPos:getX() + DGD.DPR dXFromExt = EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0) else ptPos = Point3d( ( DGD.dW - dPosX - EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0)), ( DGD.dH - tRollerLatch.position) , dPosZ) ptPosBox = Point3d( ( DGD.dW - EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0)), ( DGD.dH - tRollerLatch.position) , dPosZ) dPosXProbe = ptPos:getX() - DGD.DPR dXFromExt = DGD.dW - EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0) end dPosYProbe = DGD.dH - tRollerLatch.position dYFromExt = dPosYProbe end ptPosUpGeom = Point3d( ptPos:getX(), ptPos:getY(), dPosZup) ptPosDwGeom = Point3d( ptPosBox:getX(), ptPosBox:getY(), dPosZup) nSideApplied = 3 else if bRemake then local dLocAngle if sSideLk == 'L' then -- se serratura a sinistra ptRef = DGD.PminTop dLocAngle = DGD.A5 else ptRef = DGD.PmaxTop dLocAngle = DGD.A6 end dPosY = ptRef:getY()+((tRollerLatch.position)*sin(dLocAngle)) else dPosY = DGD.dH - EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0) end dPosYProbe = dPosY - DGD.DPR dYFromExt = dPosY end if string.lower(tRollerLatch.side) ~= 'lock' then if sSideLk == 'R' then -- se serratura a destra if bRemake then if string.lower(tRollerLatch.side) == 'top' then dPosX = ptRef:getX()+(tRollerLatch.position*cos(DGD.A6)) else dPosX = ptRef:getX()+(tRollerLatch.position*cos(DGD.A1)) end else dPosX = DGD.dW - tRollerLatch.position end dPosXProbe = dPosX dXFromExt = dPosX else -- serratura a sinistra if bRemake then if string.lower(tRollerLatch.side) == 'top' then dPosX = ptRef:getX()+(tRollerLatch.position*cos(DGD.A5)) else dPosX = ptRef:getX()+(tRollerLatch.position*cos(DGD.A2)) end else dPosX = tRollerLatch.position end dPosXProbe = dPosX dXFromExt = dPosX end ptPos = Point3d( dPosX, dPosY, dPosZ) ptPosUpGeom = Point3d( dPosX, dPosY, dPosZup) ptPosDwGeom = ptPosUpGeom end MoveGeometryTopDwHSide( 'rollerlatch', tRollerLatch.geom, sSideLk, bPushDr, ptPos, ptPosUpGeom, nExtraAngle, ptPosDwGeom) if bRemake then if string.lower(tRollerLatch.side) == 'top' then EgtRotate( tRollerLatch.geom, ptPos, Z_AX(), DGD.A5) elseif string.lower(tRollerLatch.side) == 'bottom' then EgtRotate( tRollerLatch.geom, ptPos, Z_AX(), DGD.A2) else EgtRotate( tRollerLatch.geom, ptPos, Z_AX(), ( EgtIf( sSideLk == 'L', DGD.A3, DGD.A8)-90)) end end InsertProbeGeom( tRollerLatch.geom, Point3d(dPosXProbe,dPosYProbe,0), Point3d(dXFromExt,dYFromExt,0), 9, nSideApplied) end ----------------------------------------------------------------- local function MovePivot( tPivot, sSideLk, bPushDr) local ptPos local ptPosProbe local ptPosUpGeom local ptPosDwGeom local ptRef local ptFromExt local dPosX local dPosXProbe local dPosY local dPosYProbe local dPosZ = (DGD.dT/2) local dPosZup local dPosZReg local dXFromExt local dYFromExt local dDeltaPos = 0 local sDeltaPos local nDeltaX = 0 local nExtraAngle = 0 local nAngleBase local nRadBase local nErr = 0 local nHardwareType = 12 local nSideApplied = 1 -- se non è offsetintermediate ( quindi offset o centerhung) if string.lower(tPivot.type) ~= 'offsetintermediate' then if string.lower(tPivot.side) == 'hinge' then -- messaggio di errore sMessageErr = string.format( EgtDoorsMsg[594], tPivot.type..' Pivot', tPivot.side) DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr nErr = 1021 end if DGD.sFrame and DGD.nTypePz == 5 then tPivot.side = 'bottom' elseif DGD.sFrame and DGD.nTypePz == 6 then tPivot.side = 'top' end if string.lower(tPivot.type) == 'offset' then sDeltaPos = EgtGetInfo( tPivot.geom, 'DeltaPos') if sDeltaPos then dDeltaPos = tonumber( sDeltaPos) end end -- se applicato a lato top o bottom cambio la coordinata in Y if string.lower(tPivot.side) == 'top' then if bRemake then local dLocAngle if sSideLk == 'L' then -- se serratura a sinistra ptRef = DGD.PmaxTop dLocAngle = DGD.A6 else ptRef = DGD.PminTop dLocAngle = DGD.A5 end dPosY = ptRef:getY()+((tPivot.position+dDeltaPos)*sin(dLocAngle)) else dPosY = DGD.dH - EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0) end dPosYProbe = dPosY - DGD.DPR dYFromExt = dPosY nSideApplied = 2 else if bRemake then local dLocAngle if sSideLk == 'L' then -- se serratura a sinistra ptRef = DGD.PmaxBot dLocAngle = DGD.A1 else ptRef = DGD.PminBot dLocAngle = DGD.A2 end dPosY = ptRef:getY()+((tPivot.position+dDeltaPos)*sin(dLocAngle)) else dPosY = EgtIf( DGD.sFrame, DGD.dZedExtFrame, 0) end dPosYProbe = dPosY + DGD.DPR dYFromExt = dPosY nSideApplied = 4 end if DGD.OFFSET and DGD.OFFSET > 0 then dPosZ = DGD.OFFSET else dPosZ = (DGD.dT/2) end if sSideLk == 'L' then -- se serratura a sinistra: RH, RHR, ... if bRemake then if string.lower(tPivot.side) == 'top' then dPosX = ptRef:getX()+((tPivot.position+dDeltaPos)*cos(DGD.A6)) else dPosX = ptRef:getX()+((tPivot.position+dDeltaPos)*cos(DGD.A1)) end else dPosX = DGD.dW - tPivot.position - dDeltaPos end else -- serratura a destra if bRemake then if string.lower(tPivot.side) == 'top' then dPosX = ptRef:getX()+((tPivot.position+dDeltaPos)*cos(DGD.A5)) else dPosX = ptRef:getX()+((tPivot.position+dDeltaPos)*cos(DGD.A2)) end else dPosX = tPivot.position + dDeltaPos end end dPosXProbe = dPosX dXFromExt = dPosX if bPushDr then dPosZup = DGD.BACK_SET dPosZReg = 0 else dPosZ = (DGD.dT - dPosZ) dPosZup = DGD.dT - DGD.BACK_SET dPosZReg = DGD.dT end else -- altrimenti tipo offsetintermediate if DGD.sFrame then sSideLk = EgtIf( sSideLk == 'L', 'R', 'L') end if string.lower(tPivot.side) ~= 'hinge' then -- messaggio di errore sMessageErr = string.format( EgtDoorsMsg[593], tPivot.type..' Pivot', 'hinge') DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr nErr = -1022 end -- incremento il contatore di cerniere e pivot ( disposti su lato hinges) nNumHingePivot = nNumHingePivot + 1 if DGD.tProfs.hingeedge.trimming == 'BD' or DGD.tProfs.hingeedge.trimming == 'BU' or DGD.tProfs.hingeedge.trimming == 'BDEB' or DGD.tProfs.hingeedge.trimming == 'BUEB' then nExtraAngle = 3 nDeltaX = (tPivot.back_set * sin(nExtraAngle)) end -- by DGC.Bwd setting set to 0 the nDeltaX parameter if DGC.Bwd and DGC.Bwd == 2 then nDeltaX = 0 end sDeltaPos = EgtGetInfo( tPivot.geom, 'DeltaPos') if sDeltaPos then dDeltaPos = tonumber( sDeltaPos) end if bRemake then local dLocAngle nAngleBase = atan(nDeltaX/(tPivot.position+dDeltaPos)) nRadBase = sqrt((nDeltaX*nDeltaX)+((tPivot.position+dDeltaPos)*(tPivot.position+dDeltaPos))) if sSideLk == 'L' then -- se serratura a sinistra ptRef = DGD.PmaxTop dLocAngle = DGD.A7 else ptRef = DGD.PminTop dLocAngle = DGD.A4 end dPosY = ptRef:getY()+((tPivot.position+dDeltaPos)*sin(dLocAngle)) dPosYProbe = dPosY dYFromExt = dPosY else dPosY = DGD.dH - tPivot.position - dDeltaPos dPosYProbe = dPosY dYFromExt = dPosY end if sSideLk == 'L' then -- se serratura a sinistra: RH, RHR, ... if DGD.sFrame then dPosX = DGD.dW - nDeltaX - DGD.dZedExtFrame dXFromExt = DGD.dW - DGD.dZedExtFrame else if bRemake then dPosX = ptRef:getX()+(nRadBase*cos(DGD.A7-nAngleBase)) dXFromExt = dPosX else dPosX = DGD.dW - nDeltaX dXFromExt = DGD.dW end end dPosXProbe = dPosX - DGD.DPR else -- serratura a destra if DGD.sFrame then dPosX = nDeltaX + DGD.dZedExtFrame dXFromExt = DGD.dZedExtFrame else if bRemake then dPosX = ptRef:getX()+(nRadBase*cos(DGD.A4+nAngleBase)) dXFromExt = dPosX else dPosX = nDeltaX dXFromExt = 0 end end dPosXProbe = dPosX + DGD.DPR end if bPushDr then dPosZup = DGD.BACK_SET dPosZReg = 0 else dPosZup = DGD.dT - DGD.BACK_SET dPosZReg = DGD.dT end -- assegno il tipo hardware come una hinge perchè viene applicato su quel lato nHardwareType = 5 end ptPos = Point3d( dPosX, dPosY, dPosZ) ptPosUpGeom = Point3d( dPosX, dPosY, dPosZup) ptPosDwGeom = Point3d( dPosX, dPosY, dPosZReg) ptPosProbe = Point3d( dPosXProbe, dPosYProbe, 0) ptFromExt = Point3d( dXFromExt, dYFromExt, 0) MoveGeometryTopDwHSide( 'pivot', tPivot.geom, sSideLk, bPushDr, ptPos, ptPosUpGeom, nExtraAngle, ptPosDwGeom) if bRemake then if string.lower(tPivot.type) == 'offsetintermediate' then EgtRotate( tPivot.geom, ptPos, Z_AX(), ( EgtIf( sSideLk == 'L', DGD.A8, DGD.A3)-90)) else EgtRotate( tPivot.geom, ptPos, Z_AX(), EgtIf( string.lower(tPivot.side) == 'top', DGD.A5, DGD.A2)) end end InsertProbeGeom( tPivot.geom, ptPosProbe, ptFromExt, nHardwareType, nSideApplied) -- assegno codice errore se ancora non fatto if DGD.ERR == 0 then DGD.ERR = nErr end end ----------------------------------------------------------------- local function MoveStopAndCloser( tStopAndCloser, sSideLk, bPushDr) local ptPos local ptPosUp local ptPosUpGeom local ptPosDwGeom local ptRef local dPosY local dPosZ local dPosZup local dPosProbe local ptFromExt if DGD.sFrame and ( DGD.nTypePz == 5 or DGD.nTypePz == 6) then dPosY = 0 + DGD.dZedExtFrame bPushDr = not bPushDr else if bRemake then local dLocAngle if sSideLk == 'L' then -- se serratura a sinistra ptRef = DGD.PmaxTop dLocAngle = DGD.A6 else ptRef = DGD.PminTop dLocAngle = DGD.A5 end dPosY = ptRef:getY()+((tStopAndCloser.position)*sin(dLocAngle)) else dPosY = DGD.dH end end if DGD.POCKET_OFFSET and DGD.POCKET_OFFSET > 0 then dPosZ = EgtIf( bPushDr, DGD.POCKET_OFFSET, (DGD.dT - DGD.POCKET_OFFSET)) else dPosZ = DGD.dT/2 end dPosZup = EgtIf( bPushDr, DGD.dT, 0) if sSideLk == 'R' then -- se serratura a destra if bRemake then ptPos = Point3d( ptRef:getX()+(tStopAndCloser.position*cos(DGD.A5)), dPosY, dPosZ) ptPosUp = Point3d( ptRef:getX()+(tStopAndCloser.position*cos(DGD.A5)), dPosY, dPosZup) dPosProbe = Point3d( ptRef:getX()+(EgtIf( abs(tStopAndCloser.position) < DGD.DPR, (DGD.dW/4), tStopAndCloser.position)*cos(DGD.A5)), dPosY, dPosZup) ptPosUpGeom = Point3d( ptRef:getX()+(tStopAndCloser.position*cos(DGD.A5)), dPosY, DGD.dT) else ptPos = Point3d( tStopAndCloser.position, dPosY, dPosZ) ptPosUp = Point3d( tStopAndCloser.position, dPosY, dPosZup) dPosProbe = Point3d( EgtIf( abs(tStopAndCloser.position) < DGD.DPR, (DGD.dW/4), tStopAndCloser.position), dPosY, dPosZup) ptPosUpGeom = Point3d( tStopAndCloser.position, dPosY, DGD.dT) end ptPosDwGeom = Point3d( ptPosUpGeom:getX(), ptPosUpGeom:getY() , 0) ptFromExt = dPosProbe else -- serratura a sinistra if bRemake then ptPos = Point3d( ptRef:getX()+(tStopAndCloser.position*cos(DGD.A6)), dPosY, dPosZ) ptPosUp = Point3d( ptRef:getX()+(tStopAndCloser.position*cos(DGD.A6)), dPosY, dPosZup) dPosProbe = Point3d( ptRef:getX()+(EgtIf( abs(tStopAndCloser.position) < DGD.DPR, (DGD.dW/4), tStopAndCloser.position)*cos(DGD.A6)), dPosY, dPosZup) ptPosUpGeom = Point3d( ptRef:getX()+(tStopAndCloser.position*cos(DGD.A6)), dPosY, DGD.dT) else ptPos = Point3d( ( DGD.dW - tStopAndCloser.position), dPosY, dPosZ) ptPosUp = Point3d( ( DGD.dW - tStopAndCloser.position), dPosY, dPosZup) dPosProbe = Point3d( ( DGD.dW - EgtIf( abs(tStopAndCloser.position) < DGD.DPR, (DGD.dW/4), tStopAndCloser.position)), dPosY, dPosZup) ptPosUpGeom = Point3d( ( DGD.dW - tStopAndCloser.position), dPosY, DGD.dT) end ptPosDwGeom = Point3d( ptPosUpGeom:getX(), ptPosUpGeom:getY() , 0) ptFromExt = dPosProbe end MoveGeometryTopDwHSide( 'stopandcloser', tStopAndCloser.geom, sSideLk, bPushDr, ptPos, ptPosUp, nil, nil, ptPosUpGeom, ptPosDwGeom) InsertProbeGeom( tStopAndCloser.geom, Point3d(dPosProbe:getX(),dPosProbe:getY()-DGD.DPR,0), Point3d(ptFromExt:getX(),ptFromExt:getY(),0), 4, 2) end ----------------------------------------------------------------------------------------- -- *** Geometric processing : functions for overhead *** ----------------------------------------------------------------------------------------- local function MoveGeometryOverHead( sTypeGeom, nGeomId, sSideLk, bPushDr, ptPos, ptPosUp) if not nGeomId then return end local nIdGeomType local sSideDoorToMove local sMessageErr = '' local nBoxGeom = 1 -- devo ottenere tutte le geometrie del over head nIdGeomType = EgtGetFirstInGroup( nGeomId) -- ottengo la prima geometria local nErr = 0 while nIdGeomType do local sSideDoorBox = EgtGetInfo( nIdGeomType, 'SideDoor') -- se geometrie che descrivono la sezione if sSideDoorBox and sSideDoorBox == 'upper' then MoveSubGeomStopAndCloser( nIdGeomType, sSideDoorBox, sSideLk, bPushDr, ptPos, ptPosUp, nBoxGeom) else sSideDoorToMove = EgtGetInfo( nIdGeomType, 'InserPoint') if sSideDoorToMove then -- Controllo se la nota è corretta local sSideDoor = string.lower(sSideDoorToMove) if sTypeGeom == 'overhead' then -- Edge: sullo spigolo della porta; Centre: in centro allo spessore if sSideDoor == 'edge' or sSideDoor == 'center' then MoveSubGeomStopAndCloser( nIdGeomType, sSideDoor, sSideLk, bPushDr, ptPos, ptPosUp) else -- messaggio di errore sMessageErr = string.format( EgtDoorsMsg[415], nIdGeomType,'OverHead',sSideDoor, DGD.FILE) DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr nErr = 1015 end end else -- messaggio di errore in base al tipo di pezzo if sTypeGeom == 'overhead' then sMessageErr = string.format( EgtDoorsMsg[416], nIdGeomType,'OverHead', DGD.FILE) DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr nErr = 1016 end end end nIdGeomType = EgtGetNext(nIdGeomType) end -- assegno codice errore se ancora non fatto if DGD.ERR == 0 then DGD.ERR = nErr end end ----------------------------------------------------------------- local function MoveOverHead( tOverHead, sSideLk, bPushDr) local ptPos local ptPosUpGeom local ptFromExt local ptRef local dPosY local dPosYUp local dPosZ local dPosZup if DGD.sFrame and ( DGD.nTypePz == 5 or DGD.nTypePz == 6) then dPosY = 0 + DGD.dZedExtFrame DGD.SIDE = 'bottom' bPushDr = not bPushDr else if bRemake then local dLocAngle if sSideLk == 'L' then -- se serratura a sinistra ptRef = DGD.PmaxTop dLocAngle = DGD.A6 else ptRef = DGD.PminTop dLocAngle = DGD.A5 end dPosY = ptRef:getY()+((tOverHead.pockpos)*sin(dLocAngle)) dPosYUp = ptRef:getY()+((tOverHead.armpos)*sin(dLocAngle)) else dPosY = DGD.dH end end if DGD.POCKET_OFFSET and DGD.POCKET_OFFSET > 0 then dPosZ = EgtIf( bPushDr, DGD.POCKET_OFFSET, (DGD.dT - DGD.POCKET_OFFSET)) else dPosZ = DGD.dT/2 end dPosZup = EgtIf( bPushDr, DGD.dT, 0) if sSideLk == 'R' then -- se serratura a destra if bRemake then ptPos = Point3d( ptRef:getX()+(tOverHead.pockpos*cos(DGD.A5)), dPosY, dPosZ) ptPosUpGeom = Point3d( ptRef:getX()+(tOverHead.armpos*cos(DGD.A5)), dPosYUp, dPosZup) else ptPos = Point3d( tOverHead.pockpos, dPosY, dPosZ) ptPosUpGeom = Point3d( tOverHead.armpos, dPosY, dPosZup) end else -- serratura a sinistra if bRemake then ptPos = Point3d( ptRef:getX()+(tOverHead.pockpos*cos(DGD.A6)), dPosY, dPosZ) ptPosUpGeom = Point3d( ptRef:getX()+(tOverHead.armpos*cos(DGD.A6)), dPosYUp, dPosZup) else ptPos = Point3d( ( DGD.dW - tOverHead.pockpos), dPosY, dPosZ) ptPosUpGeom = Point3d( ( DGD.dW - tOverHead.armpos), dPosY, dPosZup) end end ptFromExt = ptPosUpGeom MoveGeometryOverHead( 'overhead', tOverHead.geom, sSideLk, bPushDr, ptPos, ptPosUpGeom) InsertProbeGeom( tOverHead.geom, Point3d(ptPosUpGeom:getX(),ptPosUpGeom:getY()-DGD.DPR,0), Point3d(ptFromExt:getX(),ptFromExt:getY(),0), 13, 2) end ----------------------------------------------------------------------------------------- -- *** Geometric processing : functions for GROOVE *** ----------------------------------------------------------------------------------------- local function MoveGeomGroove( nGrooveId, sSideLk, ptPos, sSide, bPushDr, dTopAngleDoor) if sSide and ( sSide == 'top' or sSide == 'top_flat' or sSide == 'top_angle') then if DGD.GRS then EgtRotate( nGrooveId, ORIG(), X_AX(), 90 ) -- ruoto su faccia frontale ( faccia sotto della porta) EgtMirror( nGrooveId, ORIG(), Y_AX()) -- faccio mirror in Y else EgtRotate( nGrooveId, ORIG(), X_AX(), -90 ) -- ruoto su faccia dietro ( faccia sopra della porta) end else EgtRotate( nGrooveId, ORIG(), X_AX(), 90 ) -- ruoto su faccia frontale ( faccia sotto della porta) end if not sSide or ( sSide == 'top' or sSide == 'top_flat' or sSide == 'top_angle') or sSide == 'bottom' then if sSideLk == 'R' and not DGD.GRS then -- se serratura a destra EgtRotate( nGrooveId, ORIG(), Y_AX(), 180 ) -- ruoto per portare l'eventuale uscita dalla parte delle cerniere end if not bPushDr and DGD.GRS then -- se è una bevel dn EgtRotate( nGrooveId, ORIG(), Y_AX(), 180 ) -- ruoto per portare lo scasso in basso sul lato narrow end if sSide == 'top_angle' and dTopAngleDoor and abs(dTopAngleDoor) > 0 then EgtRotate( nGrooveId, ORIG(), Z_AX(), dTopAngleDoor) -- ruoto sull'angolo inclinato lato top end else -- se piazzamento sui fianchi if not bPushDr and DGD.GRS then -- se è una bevel dn EgtRotate( nGrooveId, ORIG(), Y_AX(), 180 ) -- ruoto per portare lo scasso in basso sul lato narrow end if sSide == 'hinge' then if sSideLk == 'R' then EgtRotate( nGrooveId, ORIG(), Z_AX(), -90 ) else EgtRotate( nGrooveId, ORIG(), Z_AX(), 90 ) end else if sSideLk == 'R' then EgtRotate( nGrooveId, ORIG(), Z_AX(), 90 ) else EgtRotate( nGrooveId, ORIG(), Z_AX(), -90 ) end end end EgtMove( nGrooveId, ptPos - ORIG()) end ----------------------------------------------------------------- local function MoveGroove( tGroove, sSideLk, bPushDr) local ptPos local ptRef local dPosX = DGD.dW / 2 local dPosY = 0 if tGroove.side and ( tGroove.side == 'top' or tGroove.side == 'top_flat' or tGroove.side == 'top_angle') then -- se è ad angoolo ricalcolo la posizione if DGD.Tpa then -- se è applicato su lato dritto piatto if tGroove.side == 'top_flat' then -- se lunghezza lato dritto esiste if DGD.tProfs.top.xdeltapos > 0 then -- se parte angolata sulla parte sinistra if DGD.tProfs.top.angle > 0 then dPosX = DGD.dW - ( DGD.tProfs.top.xdeltapos / 2) -- altrimenti parte angolata sulla parte destra else dPosX = ( DGD.tProfs.top.xdeltapos / 2) end else dPosX = DGD.dW / 2 end -- altrimenti se applicato sul lato inclinato elseif tGroove.side == 'top_angle' then -- se lunghezza lato inclinato esiste if ( DGD.dW - DGD.tProfs.top.xdeltapos) > 0 then -- se parte angolata sulla parte sinistra if DGD.tProfs.top.angle > 0 then dPosX = ( DGD.dW - DGD.tProfs.top.xdeltapos) / 2 -- altrimenti parte angolata sulla parte destra else dPosX = DGD.dW - ( ( DGD.dW - DGD.tProfs.top.xdeltapos) / 2) end else dPosX = DGD.dW / 2 end else dPosX = DGD.dW / 2 end else dPosX = DGD.dW / 2 end -- se è ad angoolo e deve essere applicato sul lato inclinato if DGD.Tpa and tGroove.side == 'top_angle' then -- se lunghezza lato inclinato esiste if ( DGD.dW - DGD.tProfs.top.xdeltapos) > 0 then dPosY = DGD.dH - ( ( ( DGD.dW - DGD.tProfs.top.xdeltapos) / 2) * tan( abs( DGD.tProfs.top.angle))) else dPosY = DGD.dH end -- inserisco nota nella porta con id geometria se il groove è effettivamente applicato sul lato inclinato if dPosY < DGD.dH then -- verifico se la nota esiste già local sAngGrooveNote = EgtGetInfo( DGD.PZ, 'GrooveOnAngle', 's') -- se non è presente aggiungo if not sAngGrooveNote then sAngGrooveNote = EgtNumToString( tGroove.geom, 0) else sAngGrooveNote = sAngGrooveNote .. ',' .. EgtNumToString( tGroove.geom, 0) end EgtSetInfo( DGD.PZ, 'GrooveOnAngle', sAngGrooveNote) end else dPosY = DGD.dH end elseif tGroove.side and tGroove.side == 'hinge' then dPosY = DGD.dH/2 if sSideLk == 'R' then -- se serratura a destra dPosX = 0 else dPosX = DGD.dW end elseif tGroove.side and tGroove.side == 'lock' then dPosY = DGD.dH/2 if sSideLk == 'R' then -- se serratura a destra dPosX = DGD.dW else dPosX = 0 end else dPosX = DGD.dW / 2 dPosY = 0 end if bPushDr then -- se è una bevel up if tGroove.groove_offset then if DGD.GRS then if bRemake then if tGroove.side and ( tGroove.side == 'top' or tGroove.side == 'top_angle' or tGroove.side == 'top_flat') then ptRef = EgtMP(nDoorTopTop) elseif tGroove.side and tGroove.side == 'hinge' then if sSideLk == 'R' then -- se serratura a destra ptRef = EgtMP(nDoorLeftTop) else ptRef = EgtMP(nDoorRightTop) end elseif tGroove.side and tGroove.side == 'lock' then if sSideLk == 'R' then -- se serratura a destra ptRef = EgtMP(nDoorRightTop) else ptRef = EgtMP(nDoorLeftTop) end else ptRef = EgtMP(nDoorBotTop) end ptPos = ptRef else ptPos = Point3d( dPosX, dPosY , DGD.dT) end else if bRemake then if tGroove.side and ( tGroove.side == 'top' or tGroove.side == 'top_flat' or tGroove.side == 'top_angle') then ptRef = EgtMP(nDoorTopMid) elseif tGroove.side and tGroove.side == 'hinge' then if sSideLk == 'R' then -- se serratura a destra ptRef = EgtMP(nDoorLeftMid) else ptRef = EgtMP(nDoorRightMid) end elseif tGroove.side and tGroove.side == 'lock' then if sSideLk == 'R' then -- se serratura a destra ptRef = EgtMP(nDoorRightMid) else ptRef = EgtMP(nDoorLeftMid) end else ptRef = EgtMP(nDoorBotMid) end ptPos = Point3d( EgtMP:getX(ptRef), EgtMP:getY(ptRef) , tGroove.groove_offset) else ptPos = Point3d( dPosX, dPosY , tGroove.groove_offset) end end else if DGD.GRS then if bRemake then if tGroove.side and ( tGroove.side == 'top' or tGroove.side == 'top_flat' or tGroove.side == 'top_angle') then ptRef = EgtMP(nDoorTopTop) elseif tGroove.side and tGroove.side == 'hinge' then if sSideLk == 'R' then -- se serratura a destra ptRef = EgtMP(nDoorLeftTop) else ptRef = EgtMP(nDoorRightTop) end elseif tGroove.side and tGroove.side == 'lock' then if sSideLk == 'R' then -- se serratura a destra ptRef = EgtMP(nDoorRightTop) else ptRef = EgtMP(nDoorLeftTop) end else ptRef = EgtMP(nDoorBotTop) end ptPos = ptRef else ptPos = Point3d( dPosX, dPosY, DGD.dT) end else if bRemake then if tGroove.side and ( tGroove.side == 'top' or tGroove.side == 'top_flat' or tGroove.side == 'top_angle') then ptRef = EgtMP(nDoorTopMid) elseif tGroove.side and tGroove.side == 'hinge' then if sSideLk == 'R' then -- se serratura a destra ptRef = EgtMP(nDoorLeftMid) else ptRef = EgtMP(nDoorRightMid) end elseif tGroove.side and tGroove.side == 'lock' then if sSideLk == 'R' then -- se serratura a destra ptRef = EgtMP(nDoorRightMid) else ptRef = EgtMP(nDoorLeftMid) end else ptRef = EgtMP(nDoorBotMid) end ptPos = ptRef else ptPos = Point3d( dPosX, dPosY , (DGD.dT/2)) end end end else -- se è bevel dw if tGroove.groove_offset then if DGD.GRS then if bRemake then if tGroove.side and ( tGroove.side == 'top' or tGroove.side == 'top_flat' or tGroove.side == 'top_angle') then ptRef = EgtMP(nDoorTop) elseif tGroove.side and tGroove.side == 'hinge' then if sSideLk == 'R' then -- se serratura a destra ptRef = EgtMP(nDoorLeft) else ptRef = EgtMP(nDoorRight) end elseif tGroove.side and tGroove.side == 'lock' then if sSideLk == 'R' then -- se serratura a destra ptRef = EgtMP(nDoorRight) else ptRef = EgtMP(nDoorLeft) end else ptRef = EgtMP(nDoorBot) end ptPos = ptRef else ptPos = Point3d( dPosX, dPosY , 0) end else if bRemake then if tGroove.side and ( tGroove.side == 'top' or tGroove.side == 'top_flat' or tGroove.side == 'top_angle') then ptRef = EgtMP(nDoorTopMid) elseif tGroove.side and tGroove.side == 'hinge' then if sSideLk == 'R' then -- se serratura a destra ptRef = EgtMP(nDoorLeftMid) else ptRef = EgtMP(nDoorRightMid) end elseif tGroove.side and tGroove.side == 'lock' then if sSideLk == 'R' then -- se serratura a destra ptRef = EgtMP(nDoorRightMid) else ptRef = EgtMP(nDoorLeftMid) end else ptRef = EgtMP(nDoorBotMid) end ptPos = Point3d( EgtMP:getX(ptRef), EgtMP:getY(ptRef) , tGroove.groove_offset) else ptPos = Point3d( dPosX, dPosY , ( DGD.dT - tGroove.groove_offset)) end end else if DGD.GRS then if bRemake then if tGroove.side and ( tGroove.side == 'top' or tGroove.side == 'top_flat' or tGroove.side == 'top_angle') then ptRef = EgtMP(nDoorTop) elseif tGroove.side and tGroove.side == 'hinge' then if sSideLk == 'R' then -- se serratura a destra ptRef = EgtMP(nDoorLeft) else ptRef = EgtMP(nDoorRight) end elseif tGroove.side and tGroove.side == 'lock' then if sSideLk == 'R' then -- se serratura a destra ptRef = EgtMP(nDoorRight) else ptRef = EgtMP(nDoorLeft) end else ptRef = EgtMP(nDoorBot) end ptPos = ptRef else ptPos = Point3d( dPosX, dPosY , 0) end else if bRemake then if tGroove.side and ( tGroove.side == 'top' or tGroove.side == 'top_flat' or tGroove.side == 'top_angle') then ptRef = EgtMP(nDoorTopMid) elseif tGroove.side and tGroove.side == 'hinge' then if sSideLk == 'R' then -- se serratura a destra ptRef = EgtMP(nDoorLeftMid) else ptRef = EgtMP(nDoorRightMid) end elseif tGroove.side and tGroove.side == 'lock' then if sSideLk == 'R' then -- se serratura a destra ptRef = EgtMP(nDoorRightMid) else ptRef = EgtMP(nDoorLeftMid) end else ptRef = EgtMP(nDoorBotMid) end ptPos = ptRef else ptPos = Point3d( dPosX, dPosY , (DGD.dT/2)) end end end end MoveGeomGroove( tGroove.geom, sSideLk, ptPos, tGroove.side, bPushDr, DGD.tProfs.top.angle) if bRemake then if tGroove.side and ( tGroove.side == 'top' or tGroove.side == 'top_flat' or tGroove.side == 'top_angle') then EgtRotate( tGroove.geom, ptPos, Z_AX(), DGD.A5) elseif tGroove.side and tGroove.side == 'hinge' then if sSideLk == 'R' then -- se serratura a destra EgtRotate( tGroove.geom, ptPos, Z_AX(), (DGD.A3-90)) else EgtRotate( tGroove.geom, ptPos, Z_AX(), (DGD.A8-90)) end elseif tGroove.side and tGroove.side == 'lock' then if sSideLk == 'R' then -- se serratura a destra EgtRotate( tGroove.geom, ptPos, Z_AX(), (DGD.A8-90)) else EgtRotate( tGroove.geom, ptPos, Z_AX(), (DGD.A3-90)) end else EgtRotate( tGroove.geom, ptPos, Z_AX(), DGD.A2) end end -- creo estrusi e superfici piane delle geometrie passanti local nGId = EgtGetFirstNameInGroup( tGroove.geom, 'BOXGROOVE') if nGId then AddSurfTmByExtrusion( tGroove.geom, nGId, true, nil, true) -- sposto gli estrusi e le superfici piane nel layer solid AddFlatSurf( tGroove.geom, tGroove.geom) EgtErase(nGId) end end ----------------------------------------------------------------------------------------- -- *** Geometric processing : functions for RABBET *** ----------------------------------------------------------------------------------------- local function MoveGeomRabbet( nRabbetId, sSideLk, bPushDr, ptPos) local nRotX local nRotY local nRotZ if DGD.sFrame then -- se frame lock or frame hinge on left if (( DGD.sFrame == 'L' or DGD.sFrame == 'LE') and sSideLk == 'L') or (( DGD.sFrame == 'H' or DGD.sFrame == 'HE') and sSideLk == 'R') then EgtRotate( nRabbetId, ORIG(), Y_AX(), 90 ) if DGD.SIDE == 'top' then nRotX = 0 elseif DGD.SIDE == 'bottom' then nRotX = 180 else if bPushDr then nRotX = -90 else nRotX = 90 end end if nRotX ~= 0 then EgtRotate( nRabbetId, ORIG(), X_AX(), nRotX) end -- se frame lock or frame hinge on right elseif (( DGD.sFrame == 'L' or DGD.sFrame == 'LE') and sSideLk == 'R') or (( DGD.sFrame == 'H' or DGD.sFrame == 'HE') and sSideLk == 'L') then EgtRotate( nRabbetId, ORIG(), Y_AX(), -90 ) if DGD.SIDE == 'top' then nRotX = 0 elseif DGD.SIDE == 'bottom' then nRotX = 180 else if bPushDr then nRotX = -90 else nRotX = 90 end end if nRotX ~= 0 then EgtRotate( nRabbetId, ORIG(), X_AX(), nRotX) end -- se frame top elseif DGD.nTypePz == 5 then EgtRotate( nRabbetId, ORIG(), X_AX(), 90 ) if DGD.SIDE == 'top' then nRotY = 90 elseif DGD.SIDE == 'bottom' then nRotY = -90 else if bPushDr then nRotY = 180 else nRotY = 0 end end if nRotY ~= 0 then EgtRotate( nRabbetId, ORIG(), Y_AX(), nRotY) end -- frame bottom else EgtRotate( nRabbetId, ORIG(), X_AX(), -90 ) if DGD.SIDE == 'top' then nRotY = -90 elseif DGD.SIDE == 'bottom' then nRotY = 90 else if bPushDr then nRotY = 0 else nRotY = 180 end end if nRotY ~= 0 then EgtRotate( nRabbetId, ORIG(), Y_AX(), nRotY) end end else -- se porta a tirare il rabbet va sotto if not bPushDr then EgtRotate( nRabbetId, ORIG(), Y_AX(), 180 ) end if DGD.SIDE == 'hinge' then if sSideLk == 'R' then -- se serratura a destra nRotZ = 90 else nRotZ = -90 end elseif DGD.SIDE == 'lock' then if sSideLk == 'R' then -- se serratura a destra nRotZ = -90 else nRotZ = 90 end elseif DGD.SIDE == 'bottom' then nRotZ = 180 elseif DGD.SIDE == 'top' then nRotZ = 0 end if nRotZ ~= 0 then EgtRotate( nRabbetId, ORIG(), Z_AX(), nRotZ ) end end EgtMove( nRabbetId, ptPos - ORIG()) end ----------------------------------------------------------------- local function CalcCommonFramePos( sSideLk, bPushDr) local dPosX, dPosY, dPosZ if DGD.sFrame == 'L' or DGD.sFrame == 'LE' then -- se frame lock if sSideLk == 'L' then -- se lock a sx dPosX = DGD.dW else dPosX = 0 end dPosY = DGD.dH/2 elseif DGD.sFrame == 'H' or DGD.sFrame == 'HE' then -- se frame hinge if sSideLk == 'L' then -- se lock a sx dPosX = 0 else dPosX = DGD.dW end dPosY = DGD.dH/2 else -- se frame top o bottom dPosX = DGD.dW / 2 if DGD.nTypePz == 5 then -- se frame top dPosY = 0 else dPosY = DGD.dH end end if bPushDr then dPosZ = 0 else dPosZ = DGD.dT end return dPosX, dPosY, dPosZ end ----------------------------------------------------------------- local function MoveRabbet( tRabbet, sSideLk, bPushDr) local ptPos local ptRef local dPosX local dPosY local dPosZ -- per i frame la posizione della rabbet sia su lato hinge che lock portano sempre allo spesso lato if tRabbet.side == 'hinge' then if DGD.sFrame then dPosX,dPosY,dPosZ = CalcCommonFramePos( sSideLk, bPushDr) else if sSideLk == 'R' then -- se serratura a destra dPosX = 0 else dPosX = DGD.dW end dPosY = DGD.dH/2 end elseif tRabbet.side == 'lock' then if DGD.sFrame then dPosX,dPosY,dPosZ = CalcCommonFramePos( sSideLk, bPushDr) else if sSideLk == 'R' then -- se serratura a destra dPosX = DGD.dW else dPosX = 0 end dPosY = DGD.dH/2 end elseif tRabbet.side == 'top' then if DGD.sFrame then if DGD.sFrame == 'L' or DGD.sFrame == 'LE' then -- se frame lock if sSideLk == 'L' then -- se lock a sx dPosX = DGD.dW else dPosX = 0 end dPosY = DGD.dH elseif DGD.sFrame == 'H' or DGD.sFrame == 'HE' then -- se frame hinge if sSideLk == 'L' then -- se lock a sx dPosX = 0 else dPosX = DGD.dW end dPosY = DGD.dH elseif DGD.nTypePz == 5 then -- se frame top dPosX = DGD.dW dPosY = 0 else -- frame bottom dPosX = DGD.dW dPosY = DGD.dH end dPosZ = DGD.dT / 2 else dPosX = DGD.dW/2 dPosY = DGD.dH end elseif tRabbet.side == 'bottom' then if DGD.sFrame then if DGD.sFrame == 'L' or DGD.sFrame == 'LE' then -- se frame lock if sSideLk == 'L' then -- se lock a sx dPosX = DGD.dW else dPosX = 0 end dPosY = 0 elseif DGD.sFrame == 'H' or DGD.sFrame == 'HE' then -- se frame hinge if sSideLk == 'L' then -- se lock a sx dPosX = 0 else dPosX = DGD.dW end dPosY = 0 elseif DGD.nTypePz == 5 then -- se frame top dPosX = 0 dPosY = 0 else dPosX = 0 dPosY = DGD.dH end dPosZ = DGD.dT / 2 else dPosX = DGD.dW/2 dPosY = 0 end end if not DGD.sFrame then if bPushDr then if tRabbet.oppo and tRabbet.oppo == 1 then dPosZ = 0 else dPosZ = DGD.dT end else if tRabbet.oppo and tRabbet.oppo == 1 then dPosZ = DGD.dT else dPosZ = 0 end end end if bRemake then if bPushDr then -- se è una bevel up if tRabbet.side and tRabbet.side == 'top' then if tRabbet.oppo and tRabbet.oppo == 1 then ptRef = EgtMP(nDoorTop) else ptRef = EgtMP(nDoorTopTop) end elseif tRabbet.side and tRabbet.side == 'hinge' then if sSideLk == 'R' then -- se serratura a destra if tRabbet.oppo and tRabbet.oppo == 1 then ptRef = EgtMP(nDoorLeft) else ptRef = EgtMP(nDoorLeftTop) end else if tRabbet.oppo and tRabbet.oppo == 1 then ptRef = EgtMP(nDoorRight) else ptRef = EgtMP(nDoorRightTop) end end elseif tRabbet.side and tRabbet.side == 'lock' then if sSideLk == 'R' then -- se serratura a destra if tRabbet.oppo and tRabbet.oppo == 1 then ptRef = EgtMP(nDoorRight) else ptRef = EgtMP(nDoorRightTop) end else if tRabbet.oppo and tRabbet.oppo == 1 then ptRef = EgtMP(nDoorLeft) else ptRef = EgtMP(nDoorLeftTop) end end else if tRabbet.oppo and tRabbet.oppo == 1 then ptRef = EgtMP(nDoorBot) else ptRef = EgtMP(nDoorBotTop) end end else -- se è bevel dw if tRabbet.side and tRabbet.side == 'top' then if tRabbet.oppo and tRabbet.oppo == 1 then ptRef = EgtMP(nDoorTopTop) else ptRef = EgtMP(nDoorTop) end elseif tRabbet.side and tRabbet.side == 'hinge' then if sSideLk == 'R' then -- se serratura a destra if tRabbet.oppo and tRabbet.oppo == 1 then ptRef = EgtMP(nDoorLeftTop) else ptRef = EgtMP(nDoorLeft) end else if tRabbet.oppo and tRabbet.oppo == 1 then ptRef = EgtMP(nDoorRightTop) else ptRef = EgtMP(nDoorRight) end end elseif tRabbet.side and tRabbet.side == 'lock' then if sSideLk == 'R' then -- se serratura a destra if tRabbet.oppo and tRabbet.oppo == 1 then ptRef = EgtMP(nDoorRightTop) else ptRef = EgtMP(nDoorRight) end else if tRabbet.oppo and tRabbet.oppo == 1 then ptRef = EgtMP(nDoorLeftTop) else ptRef = EgtMP(nDoorLeft) end end else if tRabbet.oppo and tRabbet.oppo == 1 then ptRef = EgtMP(nDoorBotTop) else ptRef = EgtMP(nDoorBot) end end end ptPos = ptRef else ptPos = Point3d( dPosX, dPosY , dPosZ) end MoveGeomRabbet( tRabbet.geom, sSideLk, bPushDr, ptPos) if bRemake then if tRabbet.side and tRabbet.side == 'top' then EgtRotate( tRabbet.geom, ptPos, Z_AX(), DGD.A5) elseif tRabbet.side and tRabbet.side == 'hinge' then if sSideLk == 'R' then -- se serratura a destra EgtRotate( tRabbet.geom, ptPos, Z_AX(), (DGD.A3-90)) else EgtRotate( tRabbet.geom, ptPos, Z_AX(), (DGD.A8-90)) end elseif tRabbet.side and tRabbet.side == 'lock' then if sSideLk == 'R' then -- se serratura a destra EgtRotate( tRabbet.geom, ptPos, Z_AX(), (DGD.A8-90)) else EgtRotate( tRabbet.geom, ptPos, Z_AX(), (DGD.A3-90)) end else EgtRotate( tRabbet.geom, ptPos, Z_AX(), DGD.A2) end end end ----------------------------------------------------------------- local function MoveEPT( tEPT, sSideLk, bPushDr) local ptPos local ptProbe local ptFromExt local ptRef local dPosX local dPosXProbe local dXFromExt local dPosY local dPosZ = 0 local dDeltaPos = 0 local sDeltaPos local nDeltaX = 0 local nExtraAngle = 0 local nAngleBase local nRadBase if DGD.sFrame then sSideLk = EgtIf( sSideLk == 'L', 'R', 'L') end if DGD.tProfs.hingeedge.trimming == 'BD' or DGD.tProfs.hingeedge.trimming == 'BU' or DGD.tProfs.hingeedge.trimming == 'BDEB' or DGD.tProfs.hingeedge.trimming == 'BUEB' then nExtraAngle = 3 nDeltaX = tEPT.back_set * TAN3 end -- by DGC.Bwd setting set to 0 the nDeltaX parameter if DGC.Bwd and DGC.Bwd == 2 then nDeltaX = 0 end sDeltaPos = EgtGetInfo( tEPT.geom, 'DeltaPos') if sDeltaPos then dDeltaPos = tonumber( sDeltaPos) end if bRemake then nAngleBase = atan(nDeltaX/(tEPT.position+dDeltaPos)) nRadBase = sqrt((nDeltaX*nDeltaX)+((tEPT.position+dDeltaPos)*(tEPT.position+dDeltaPos))) if sSideLk == 'L' then -- se serratura a sinistra ptRef = DGD.PmaxTop dPosY = ptRef:getY()+((tEPT.position+dDeltaPos)*sin(DGD.A7)) else ptRef = DGD.PminTop dPosY = ptRef:getY()+((tEPT.position+dDeltaPos)*sin(DGD.A4)) end else dPosY = DGD.dH - tEPT.position - dDeltaPos end if sSideLk == 'L' then -- se serratura a sinistra: RH, RHR, ... if DGD.sFrame then dPosX = DGD.dW - nDeltaX - DGD.dZedExtFrame dXFromExt = DGD.dW - DGD.dZedExtFrame else if bRemake then dPosX = ptRef:getX()+(nRadBase*cos(DGD.A7-nAngleBase)) dXFromExt = dPosX else dPosX = DGD.dW - nDeltaX dXFromExt = DGD.dW end end dPosXProbe = dPosX - DGD.DPR else -- serratura a destra if DGD.sFrame then dPosX = nDeltaX + DGD.dZedExtFrame dXFromExt = DGD.dZedExtFrame else if bRemake then dPosX = ptRef:getX()+(nRadBase*cos(DGD.A4+nAngleBase)) dXFromExt = dPosX else dPosX = nDeltaX dXFromExt = 0 end end dPosXProbe = dPosX + DGD.DPR end if bPushDr then dPosZ = tEPT.back_set else dPosZ = DGD.dT - tEPT.back_set end ptPos = Point3d( dPosX, dPosY, dPosZ) ptProbe = Point3d( dPosXProbe, dPosY, 0) ptFromExt = Point3d( dXFromExt, dPosY, 0) MoveGeometryHng( 'ept', tEPT.geom, sSideLk, bPushDr, ptPos, nExtraAngle) if bRemake then EgtRotate( tEPT.geom, ptPos, Z_AX(), ( EgtIf( sSideLk == 'L', DGD.A8, DGD.A3)-90)) end InsertProbeGeom( tEPT.geom, ptProbe, ptFromExt, 17, 1) end ----------------------------------------------------------------------------------------- -- *** Geometric processing : functions for FACE DECORATION *** ----------------------------------------------------------------------------------------- local function MoveGeomDecoration( nGeomId, sFace, sSideLk) local ptPos local ptRef local dZedPos = 0 local nNewEnt if string.lower(sFace) == 'keyway' then -- se specificato face su lato keyway (davanti) dZedPos = DGD.dT elseif string.lower(sFace) == 'secure' then -- se specificato face su lato secure (dietro) -- faccio il mirror di tutte le geometrie su asse Z nNewEnt = EgtGetFirstInGroup( nGeomId) -- ottengo nuova entità while nNewEnt do EgtMirror( nNewEnt, ORIG(), Z_AX()) -- faccio il mirror su asse Z nNewEnt = EgtGetNext(nNewEnt) end end if sSideLk == 'L' then -- se serratura a sinistra if bRemake then ptRef = DGD.PminBot ptPos = Point3d( ptRef:getX(), ptRef:getY(), dZedPos) else ptPos = Point3d( 0, 0, dZedPos) end else -- serratura a destra if bRemake then ptRef = DGD.PmaxBot ptPos = Point3d( ptRef:getX(), ptRef:getY(), dZedPos) else ptPos = Point3d( DGD.dW, 0, dZedPos) end -- faccio il mirror di tutte le geometrie in X nNewEnt = EgtGetFirstInGroup( nGeomId) -- ottengo nuova entità while nNewEnt do EgtMirror( nNewEnt, ORIG(), X_AX()) -- faccio il mirror in X nNewEnt = EgtGetNext(nNewEnt) end end EgtMove( nGeomId, ptPos - ORIG()) if bRemake then EgtRotate( nGeomId, ptPos, Z_AX(), ( EgtIf( sSideLk == 'L', DGD.A3, DGD.A8)-90)) end end ----------------------------------------------------------------- local function MoveCopyDecoration( tDecoration, sSideLk, bPushDr, bImport) if not tDecoration then return end if not tDecoration.geom then return end local tCopyDec if bImport then -- se importato -- determino posizione della decorazione local b3Box = EgtGetBBoxGlob( tDecoration.geom, GDB_BB.STANDARD) local dX = 0 local dY = DGD.dH if DGD.DFL then dX = 0 + DGD.DFL elseif DGD.DFH then dX = DGD.dW - DGD.WIDTH - DGD.DFH end if DGD.DFT then dY = DGD.dH - DGD.DFT else dY = 0 + DGD.LENGTH + DGD.DFB end local ptRef = Point3d( b3Box:getMin():getX(), b3Box:getMax():getY(), 0) local ptPos = Point3d( dX, dY, 0) -- muovo entità local nNewEnt = EgtGetFirstInGroup( tDecoration.geom) while nNewEnt do EgtMove( nNewEnt, ptPos - ptRef) -- sistemo lo spessore (negativo) if tDecoration.depth then -- se ho spessore da ddf EgtModifyCurveThickness( nNewEnt, -tDecoration.depth) else -- non ho spessore local dTh = EgtCurveThickness( nNewEnt) -- leggo spessore locale if abs( dTh) > DGD.dT then -- se maggiore di spessore porta lo annullo dTh = 0 end EgtModifyCurveThickness( nNewEnt, -abs(dTh)) end nNewEnt = EgtGetNext( nNewEnt) end -- eseguo trim con rettangolo porta aumentato di un poco local dOffs = 20 local frRef = Frame3d( -dOffs, -dOffs, -dOffs) local vtDiag = Vector3d( DGD.dW + 2 * dOffs, DGD.dH + 2 * dOffs, 2 * dOffs) nNewEnt = EgtGetFirstInGroup( tDecoration.geom) while nNewEnt do local nNextEnt = EgtGetNext( nNewEnt) local nCrvId, nCnt = EgtTrimFlatCurveWithBox( nNewEnt, frRef, vtDiag, true, true, GDB_RT.GLOB) if nCnt > 1 then for i = 2, nCnt do local ptStart = EgtSP( nCrvId + i - 1, nCrvId) EgtAddCurveCompoLine( nCrvId, ptStart, true, GDB_RT.LOC) EgtAddCurveCompoCurve( nCrvId, nCrvId + i - 1, true, true) end end EgtCloseCurveCompo( nCrvId) nNewEnt = nNextEnt end end if string.lower(DGD.FACE) == 'both' then -- se specificato su entrambe i lati faccio la copia tCopyDec = EgtCopyGlob( tDecoration.geom, DGD.PZ) MoveGeomDecoration( tDecoration.geom, 'secure', sSideLk) if tCopyDec then MoveGeomDecoration( tCopyDec, 'keyway', sSideLk) end else MoveGeomDecoration( tDecoration.geom, DGD.FACE, sSideLk) end end ----------------------------------------------------------------- -- *** General Geometric Processing *** ----------------------------------------------------------------- local function InsertSize( nTypeGeom, sSideLock, ptMedArc, dPosXHead, dAggrXPos, dAggrYPos, dAggrBackSet, dAggrOffset, bRefXFromDoor, bRefYFromDoor, nNumGeom) -- se si disegnano anche le geometrie di lavorazione esco if DGD.MachEn > 0 then return end local dXPos local dXPosRef local dYPos local dYPosRef local dDeltaXPos local dExtraXPos local dExtraYPos local dDeltaXValue local bRigth local bTop local bCenter local dBack local dPosition local nUp local nRigth -- tipo door if nTypeGeom == 0 then local DoorLayerDim if DGD.tProfs.top.radius then DoorLayerDim = AssignSize( DGD.PZ, DoorLayerDim, nTypePiece, 0, Point3d(DGD.dW,0,0), Point3d(DGD.dW,DGD.dH,0), DGD.dH, false, 0, 1, BLACK()) DoorLayerDim = AssignSize( DGD.PZ, DoorLayerDim, nTypePiece, 0, Point3d(0,0,0), Point3d(DGD.dW,0,0), DGD.dW, true, 0, 0, BLACK()) DoorLayerDim = AssignSize( DGD.PZ, DoorLayerDim, nTypePiece, 0, Point3d(((DGD.dW/2)+DGD.tProfs.top.xdeltapos), (DGD.dH-DGD.tProfs.top.ydeltapos), DGD.Dra), ptMedArc, DGD.tProfs.top.radius, false, 0, 0, BLACK(), true) elseif DGD.tProfs.top.angle then if DGD.tProfs.top.angle > 0 then DoorLayerDim = AssignSize( DGD.PZ, DoorLayerDim, nTypePiece, 0, Point3d(DGD.dW,0,0), Point3d(DGD.dW,DGD.dH,0), DGD.dH, false, 0, 1, BLACK()) if DGD.tProfs.top.xdeltapos > 0 then DoorLayerDim = AssignSize( DGD.PZ, DoorLayerDim, nTypePiece, 0, Point3d((DGD.dW-DGD.tProfs.top.xdeltapos),DGD.dH,0), Point3d(DGD.dW,DGD.dH,0), DGD.tProfs.top.xdeltapos, true, 1, 0, BLACK()) end -- quoto angolo -- DGD.DIM_DOOR = true -- per abilitare le quote nell'EgtCam5 DoorLayerDim = AssignSize( DGD.PZ, DoorLayerDim, nTypePiece, 0, Point3d((DGD.dW-DGD.tProfs.top.xdeltapos),DGD.dH,0), 180, DGD.tProfs.top.angle, true, 0, 1, BLACK(), false, '°', true) -- DGD.DIM_DOOR = nil -- per abilitare le quote nell'EgtCam5 else DoorLayerDim = AssignSize( DGD.PZ, DoorLayerDim, nTypePiece, 0, Point3d(0,0,0), Point3d(0,DGD.dH,0), DGD.dH, false, 0, 0, BLACK()) if DGD.tProfs.top.xdeltapos > 0 then DoorLayerDim = AssignSize( DGD.PZ, DoorLayerDim, nTypePiece, 0, Point3d(0,DGD.dH,0), Point3d(DGD.tProfs.top.xdeltapos,DGD.dH,0), DGD.tProfs.top.xdeltapos, true, 1, 0, BLACK()) end -- quoto angolo -- DGD.DIM_DOOR = true -- per abilitare le quote nell'EgtCam5 DoorLayerDim = AssignSize( DGD.PZ, DoorLayerDim, nTypePiece, 0, Point3d(DGD.tProfs.top.xdeltapos,DGD.dH,0), 0, DGD.tProfs.top.angle, true, 0, 1, BLACK(), false, '°', true) -- DGD.DIM_DOOR = nil -- per abilitare le quote nell'EgtCam5 end DoorLayerDim = AssignSize( DGD.PZ, DoorLayerDim, nTypePiece, 0, Point3d(0,0,0), Point3d(DGD.dW,0,0), DGD.dW, true, 0, 0, BLACK()) else -- DGD.DIM_DOOR = true -- per abilitare le quote nell'EgtCam5 DoorLayerDim = AssignSize( DGD.PZ, DoorLayerDim, nTypePiece, 0, Point3d(DGD.dW,0,0), Point3d(DGD.dW,DGD.dH,0), DGD.dH, false, 0, 1, BLACK()) DoorLayerDim = AssignSize( DGD.PZ, DoorLayerDim, nTypePiece, 0, Point3d(0,0,0), Point3d(DGD.dW,0,0), DGD.dW, true, 0, 0, BLACK()) -- DGD.DIM_DOOR = nil -- per abilitare le quote nell'EgtCam5 --debug -- if nTypePiece == 5 then -- EgtSaveFile( sNgeFile) -- EgtMove(DGD.PZ, Point3d(0,0,nil) - ORIG()) -- end end -- tipo vision elseif nTypeGeom == 1 then dXPos = 0 dYPos = EgtIf( DGD.TOP_RAIL, DGD.TOP_RAIL, DGD.CENTER_FROM_TOP) or 0 dDeltaXPos = EgtIf( DGD.LOCK_STYLE, DGD.LOCK_STYLE, DGD.CENTER_FROM_LOCK) or 0 nRigth = 0 dBack = 1 bCenter = DGD.POINTAPP == 'center' if sSideLock ~= 'L' then dXPos = DGD.dW nRigth = 1 dBack = -1 end dXPosRef = dXPos if bCenter then dXPos = DGD.dW / 2 end -- quota position DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPosRef,DGD.dH,0), Point3d((dXPos+(dDeltaXPos*dBack)),(DGD.dH-dYPos),0), dYPos, false, 0, nRigth, GREEN()) -- quota lock stile DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos,DGD.dH,0), Point3d((dXPos+(dDeltaXPos*dBack)),(DGD.dH-dYPos),0), dDeltaXPos, true, 1, nRigth, GREEN()) elseif nTypeGeom == 2 then -- tipo louver dXPos = 0 dYPos = DGD.BOTTOM_RAIL dDeltaXPos = DGD.LOCK_STYLE nRigth = 0 dBack = 1 bCenter = DGD.POINTAPP == 'center' if sSideLock ~= 'L' then dXPos = DGD.dW nRigth = 1 dBack = -1 end dXPosRef = dXPos if bCenter then dXPos = DGD.dW / 2 end -- quota position DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPosRef,0,0), Point3d((dXPos+(dDeltaXPos*dBack)),dYPos,0), dYPos, false, 0, nRigth, GREEN()) -- quota lock stile DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos,0,0), Point3d((dXPos+(dDeltaXPos*dBack)),dYPos,0), dDeltaXPos, true, 0, nRigth, GREEN()) elseif nTypeGeom == 3 then -- tipo lock -- DGD.DIM_LOCK = true -- per abilitare le quote nell'EgtCam5 if not DGD.SIDE or DGD.SIDE == 'lock_top' or DGD.SIDE == 'lock_bottom' then dXPos = 0 nUp = 1 nRigth = 0 dYPos = DGD.dH dExtraYPos = dAggrYPos or 0 dBack = 1 dPosition = DGD.POSITION dAggrXPos = dAggrXPos or 0 if sSideLock ~= 'L' then dXPos = DGD.dW nRigth = 1 dBack = -1 end if DGD.SIDE == 'lock_bottom' then nUp = 0 dYPos = 0 if bRefYFromDoor then dPosition = 0 else dPosition = -DGD.POSITION end elseif DGD.SIDE == 'lock_top' and bRefYFromDoor then dExtraYPos = -dAggrYPos or 0 dPosition = 0 end if not nNumGeom or nNumGeom == 1 then -- quota position DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos,dYPos,0), Point3d(dXPos,dYPos-dPosition,0), DGD.POSITION, false, nUp, nRigth, RED()) end -- quota backset local dLocBackSet = DGD.BACK_SET if dAggrBackSet then dLocBackSet = dAggrBackSet end -- se offset Y presente if abs(dExtraYPos) > 0 then local dOffsPoint = 0 if abs(dAggrXPos) > 0 then -- se riferimengo globale in X quoto if bRefXFromDoor then dOffsPoint = dAggrXPos * EgtIf( sSideLock ~= 'L', 1, -1) else dOffsPoint = (dAggrXPos + dLocBackSet) * EgtIf( sSideLock ~= 'L', 1, -1) end end -- se riferito a lato top-bottom if bRefYFromDoor then DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos,dYPos,0), Point3d(dXPos-dOffsPoint,dYPos+dExtraYPos,0), abs(dExtraYPos), false, nUp, nRigth, Color3d(64,128,128)) else DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos,dYPos-dPosition,0), Point3d(dXPos-dOffsPoint,dYPos-dPosition+dExtraYPos,0), abs(dExtraYPos), false, nUp, nRigth, Color3d(64,128,128)) end end -- se riferimengo globale in X quoto if bRefXFromDoor then -- se offset esistente if abs(dAggrXPos) > 0 then DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos,dYPos-dPosition+dExtraYPos,0), Point3d((dXPos+(dAggrXPos*dBack)), dYPos-dPosition+dExtraYPos,0), abs(dAggrXPos), true, -1, nRigth, Color3d(64,128,128), nil, EgtIf( not DGC.Bwd or DGC.Bwd == 0, '*', nil)) end else if dLocBackSet and dLocBackSet > 0 then DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos,dYPos-dPosition+dExtraYPos,0), Point3d((dXPos+(dLocBackSet*dBack)), dYPos-dPosition+dExtraYPos,0), dLocBackSet, true, -1, nRigth, RED(), nil, EgtIf( not DGC.Bwd or DGC.Bwd == 0, '*', nil)) end -- se offset esistente if abs(dAggrXPos) > 0 then DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d((dXPos+(dLocBackSet*dBack)),dYPos-dPosition+dExtraYPos,0), Point3d((dXPos+((dLocBackSet+dAggrXPos)*dBack)), dYPos-dPosition+dExtraYPos,0), abs(dAggrXPos), true, -1, nRigth, Color3d(64,128,128), nil, EgtIf( not dLocBackSet or dLocBackSet == 0, '*', nil)) end end elseif DGD.SIDE == 'top' then dXPos = 0 nUp = 1 nRigth = 0 dYPos = DGD.dH dExtraXPos = dAggrXPos dPosition = DGD.POSITION dBack = 1 if sSideLock ~= 'L' then dXPos = DGD.dW nRigth = 1 dPosition = -DGD.POSITION dExtraXPos = -dAggrXPos dBack = -1 end if not nNumGeom or nNumGeom == 1 then -- quota position DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos,dYPos,0), Point3d((dXPos+dPosition),dYPos,0), DGD.POSITION, true, nUp, false, RED()) end -- quota backset local dLocBackSet = DGD.BACK_SET if dAggrBackSet then dLocBackSet = dAggrBackSet end -- se offset X presente if dExtraXPos and abs(dExtraXPos) > 0 then local dOffsPoint = 0 if dAggrYPos and abs(dAggrYPos) > 0 then -- se riferimengo globale in Y quoto if bRefYFromDoor then dOffsPoint = -dAggrYPos else dOffsPoint = -dLocBackSet+dAggrYPos end end -- se riferito a lato lock if bRefXFromDoor then DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos,dYPos,0), Point3d((dXPos+dExtraXPos),dYPos+dOffsPoint,0), abs(dExtraXPos), true, nUp, false, Color3d(64,128,128), nil, EgtIf( not DGC.Bwd or DGC.Bwd == 0, '*', nil)) else DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos+dPosition,dYPos,0), Point3d((dXPos+dPosition+dExtraXPos),dYPos+dOffsPoint,0), abs(dExtraXPos), true, nUp, false, Color3d(64,128,128)) end end -- riassegno la posizione in base al flag di riferimento posizione globale in X if bRefXFromDoor then dPosition = 0 else dPosition = DGD.POSITION end -- se riferimengo globale in Y quoto if bRefYFromDoor then -- se offset esistente if dExtraXPos and abs(dExtraXPos) > 0 then DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos+(dPosition*dBack)+dExtraXPos,dYPos,0), Point3d(dXPos+(dPosition*dBack)+dExtraXPos,dYPos-dAggrYPos,0), abs(dAggrYPos), false, -1, -1, Color3d(64,128,128)) end else -- se quota backset maggiore di 0 if dLocBackSet and dLocBackSet > 0 then DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos+(dPosition*dBack)+dExtraXPos,dYPos,0), Point3d(dXPos+(dPosition*dBack)+dExtraXPos,dYPos-dLocBackSet,0), dLocBackSet, false, -1, -1, RED()) end -- se offset esistente if dExtraXPos and abs(dExtraXPos) > 0 then DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos+(dPosition*dBack)+dExtraXPos,dYPos-dLocBackSet,0), Point3d(dXPos+(dPosition*dBack)+dExtraXPos,dYPos-dLocBackSet+dAggrYPos,0), abs(dAggrYPos), false, -1, -1, Color3d(64,128,128)) end end -- quota offset (solo sui frame) local dLocOffset = DGD.OFFSET if dAggrOffset then dLocOffset = dAggrOffset end if dLocOffset and dLocOffset > 0 and nTypePiece > 2 then DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos+(DGD.POSITION*dBack), 0, -DGD.dH), Point3d(dXPos+(DGD.POSITION*dBack), dLocOffset, -DGD.dH), dLocOffset, false, -1, -1, RED(), nil, nil, nil, GDB_FR.FRONT) end elseif DGD.SIDE == 'bottom' then dXPos = 0 nUp = 0 nRigth = 0 dYPos = 0 dExtraXPos = dAggrXPos dPosition = DGD.POSITION dBack = 1 if sSideLock ~= 'L' then dXPos = DGD.dW nRigth = 1 dPosition = -DGD.POSITION dExtraXPos = -dAggrXPos dBack = -1 end if not nNumGeom or nNumGeom == 1 then -- quota position DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos,dYPos,0), Point3d((dXPos+dPosition),dYPos,0), DGD.POSITION, true, nUp, false, RED()) end -- quota backset local dLocBackSet = DGD.BACK_SET if dAggrBackSet then dLocBackSet = dAggrBackSet end -- se offset X presente if dExtraXPos and abs(dExtraXPos) > 0 then local dOffsPoint = 0 if dAggrYPos and abs(dAggrYPos) > 0 then -- se riferimengo globale in Y quoto if bRefYFromDoor then dOffsPoint = dAggrYPos else dOffsPoint = dLocBackSet+dAggrYPos end end -- se riferito a lato lock if bRefXFromDoor then DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos,dYPos,0), Point3d((dXPos+dExtraXPos),dYPos+dOffsPoint,0), abs(dExtraXPos), true, nUp, false, Color3d(64,128,128), nil, EgtIf( not DGC.Bwd or DGC.Bwd == 0, '*', nil)) else DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos+dPosition,dYPos,0), Point3d((dXPos+dPosition+dExtraXPos),dYPos+dOffsPoint,0), abs(dExtraXPos), true, nUp, false, Color3d(64,128,128)) end end -- riassegno la posizione in base al flag di riferimento posizione globale in X if bRefXFromDoor then dPosition = 0 else dPosition = DGD.POSITION end -- se riferimengo globale in Y quoto if bRefYFromDoor then -- se offset esistente if dExtraXPos and abs(dExtraXPos) > 0 then DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos+(dPosition*dBack)+dExtraXPos,dYPos,0), Point3d(dXPos+(dPosition*dBack)+dExtraXPos,dYPos+dAggrYPos,0), abs(dAggrYPos), false, -1, -1, Color3d(64,128,128)) end else -- se quota backset maggiore di 0 if dLocBackSet and dLocBackSet > 0 then DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos+(dPosition*dBack)+dExtraXPos,dYPos,0), Point3d(dXPos+(dPosition*dBack)+dExtraXPos,dYPos+dLocBackSet,0), dLocBackSet, false, -1, -1, RED()) end -- se quota esistente if dExtraXPos and abs(dExtraXPos) > 0 then DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos+(dPosition*dBack)+dExtraXPos,dYPos+dLocBackSet,0), Point3d(dXPos+(dPosition*dBack)+dExtraXPos,dYPos+dLocBackSet+dAggrYPos,0), abs(dAggrYPos), false, -1, -1, Color3d(64,128,128)) end end -- quota offset (solo sui frame) local dLocOffset = DGD.OFFSET if dAggrOffset then dLocOffset = dAggrOffset end if dLocOffset and dLocOffset > 0 and nTypePiece > 2 then DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos+(DGD.POSITION*dBack),dYPos,0), Point3d(dXPos+(DGD.POSITION*dBack),dYPos+dLocOffset,0), dLocOffset, false, -1, -1, RED(), nil, nil, nil, GDB_FR.FRONT) end end -- DGD.DIM_LOCK = nil -- per abilitare le quote nell'EgtCam5 --debug -- if nTypePiece == 5 then -- EgtSaveFile( sNgeFile) -- EgtMove(DGD.PZ, Point3d(0,0,nil) - ORIG()) -- end elseif nTypeGeom == 5 then -- tipo hinge dXPos = 0 nRigth = 0 if sSideLock == 'L' then dXPos = DGD.dW nRigth = 1 end DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos,DGD.dH,0), Point3d(dXPos,DGD.dH-DGD.POSITION,0), DGD.POSITION, false, 0, nRigth, BLUE()) elseif nTypeGeom == 6 then -- tipo mail_slot dXPos = DGD.dW dYPos = DGD.BOTTOM_RAIL dDeltaXPos = DGD.DELTA_CENTER dDeltaXValue = DGD.DELTA_CENTER nRigth = 1 dBack = 1 if sSideLock ~= 'L' then dXPos = 0 dDeltaXPos = -DGD.DELTA_CENTER nRigth = 0 dBack = -1 end -- quota position DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos,0,0), Point3d(((DGD.dW/2)+dDeltaXPos),dYPos,0), dYPos, false, 0, nRigth, GREEN()) -- quota delta_center DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d((DGD.dW/2),0,0), Point3d(((DGD.dW/2)+dDeltaXPos),dYPos,0), dDeltaXValue, true, 0, nRigth, GREEN()) elseif nTypeGeom == 7 then -- tipo flush_pull dXPos = 0 nRigth = 0 dBack = 1 if sSideLock ~= 'L' then dXPos = DGD.dW nRigth = 1 dBack = -1 end -- quota position DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos,DGD.dH,0), Point3d(dXPos,DGD.dH-DGD.POSITION,0), DGD.POSITION, false, 0, nRigth, {221,0,0,100}) -- quota backset if DGD.BACK_SET and DGD.BACK_SET > 0 then DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos,DGD.dH-DGD.POSITION,0), Point3d((dXPos+(DGD.BACK_SET*dBack)),DGD.dH-DGD.POSITION,0), DGD.BACK_SET, true, -1, bRigth, {221,0,0,100}) end elseif nTypeGeom == 8 then -- tipo viewer dXPos = DGD.dW dYPos = DGD.BOTTOM_RAIL dDeltaXPos = DGD.DELTA_CENTER dDeltaXValue = DGD.DELTA_CENTER nRigth = 1 bTop = DGD.SIDE and DGD.SIDE == 'top' dBack = 1 if sSideLock ~= 'L' then dXPos = 0 dDeltaXPos = -DGD.DELTA_CENTER nRigth = 0 dBack = -1 end if not bTop then -- quota position DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos,0,0), Point3d(((DGD.dW/2)+dDeltaXPos),dYPos,0), dYPos, false, 0, nRigth, GREEN()) -- quota delta_center DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d((DGD.dW/2),0,0), Point3d(((DGD.dW/2)+dDeltaXPos),dYPos,0), dDeltaXValue, true, 0, nRigth, GREEN()) else -- quota position DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos,DGD.dH,0), Point3d(((DGD.dW/2)+dDeltaXPos),(DGD.dH-dYPos),0), dYPos, false, 0, nRigth, GREEN()) -- quota delta_center DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d((DGD.dW/2),DGD.dH,0), Point3d(((DGD.dW/2)+dDeltaXPos),(DGD.dH-dYPos),0), dDeltaXValue, true, 1, nRigth, GREEN()) end elseif nTypeGeom == 9 then -- tipo rollerlatch if DGD.SIDE == 'lock' then dXPos = 0 nUp = 0 nRigth = 0 dYPos = DGD.dH dBack = 1 if sSideLock ~= 'L' then dXPos = DGD.dW nRigth = 1 dBack = -1 end -- quota position DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos,dYPos,0), Point3d(dXPos,dYPos-DGD.POSITION,0), DGD.POSITION, false, nUp, nRigth, {17,255,17,100}) else dXPos = 0 nUp = 1 dYPos = DGD.dH dPosition = DGD.POSITION if sSideLock ~= 'L' then dXPos = DGD.dW dPosition = -DGD.POSITION end if DGD.SIDE ~= 'top' then dYPos = 0 nUp = 0 end DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos,dYPos,0), Point3d((dXPos+dPosition),dYPos,0), DGD.POSITION, true, nUp, false, {17,255,17,100}) end elseif nTypeGeom == 10 then -- tipo edgepull dXPos = 0 nRigth = 0 dBack = 1 if sSideLock ~= 'L' then dXPos = DGD.dW nRigth = 1 dBack = -1 end -- quota position DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos,DGD.dH,0), Point3d(dXPos,DGD.dH-DGD.POSITION,0), DGD.POSITION, false, 0, nRigth, {193,0,0,100}) -- quota backset if DGD.BACK_SET and DGD.BACK_SET > 0 then DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos,DGD.dH-DGD.POSITION,0), Point3d((dXPos+(DGD.BACK_SET*dBack)),DGD.dH-DGD.POSITION,0), DGD.BACK_SET, true, -1, nRigth, RED(), nil, EgtIf( not DGC.Bwd or DGC.Bwd == 0, '*', nil)) end elseif nTypeGeom == 11 then -- tipo flushbolt -- quoto solo gli extension if string.lower(DGD.TYPE) == 'extension' then dXPos = 0 dYPos = DGD.dH nRigth = 0 dBack = 1 nUp = 1 dPosition = DGD.POSITION if sSideLock ~= 'L' then dXPos = DGD.dW nRigth = 1 dBack = -1 end if DGD.SIDE ~= 'top' then dYPos = 0 nUp = 0 dPosition = -DGD.POSITION end -- quota top/bottom position DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos,dYPos,0), Point3d(dXPos,dYPos-dPosition,0), DGD.POSITION, false, 0, nRigth, {147,0,0,100}) -- se presente cava di testa if abs(dPosXHead) > 0 then DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos,dYPos,0), Point3d((dXPos+(dPosXHead*dBack)),dYPos,0), dPosXHead, true, nUp, nRigth, {147,0,0,100}, nil, EgtIf( not DGC.Bwd or DGC.Bwd == 0, '*', nil)) end end elseif nTypeGeom == 12 then -- tipo pivot -- se tipo center hung o offset if string.lower(DGD.TYPE) ~= 'offsetintermediate' then dXPos = 0 dYPos = DGD.dH nUp = 1 dPosition = DGD.POSITION if sSideLock == 'L' then dXPos = DGD.dW dPosition = -DGD.POSITION end if DGD.SIDE ~= 'top' then dYPos = 0 nUp = 0 end -- quota top/bottom position DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos,dYPos,0), Point3d((dXPos+dPosition),dYPos,0), DGD.POSITION, true, nUp, false, {255,0,128,100}) else -- tipo offsetintermediate dXPos = 0 nRigth = 0 if sSideLock == 'L' then dXPos = DGD.dW nRigth = 1 end DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos,DGD.dH,0), Point3d(dXPos,DGD.dH-DGD.POSITION,0), DGD.POSITION, false, 0, nRigth, {255,0,128,100}) end elseif nTypeGeom == 14 then -- tipo strike dXPos = 0 nRigth = 0 dBack = 1 if sSideLock ~= 'L' then dXPos = DGD.dW nRigth = 1 dBack = -1 end -- quota position DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos,DGD.dH,0), Point3d(dXPos,DGD.dH-DGD.POSITION,0), DGD.POSITION, false, 0, nRigth, RED()) -- quota backset if DGD.BACK_SET and DGD.BACK_SET > 0 then DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos,DGD.dH-DGD.POSITION,0), Point3d((dXPos+(DGD.BACK_SET*dBack)),DGD.dH-DGD.POSITION,0), DGD.BACK_SET, true, -1, nRigth, RED(), nil, EgtIf( not DGC.Bwd or DGC.Bwd == 0, '*', nil)) end elseif nTypeGeom == 17 then -- tipo ept dXPos = 0 nRigth = 0 if sSideLock == 'L' then dXPos = DGD.dW nRigth = 1 end DGD.tSizeLayer[nTypeGeom] = AssignSize( DGD.PZ, DGD.tSizeLayer[nTypeGeom], nTypePiece, nTypeGeom, Point3d(dXPos,DGD.dH,0), Point3d(dXPos,DGD.dH-DGD.TOPTOCL,0), DGD.TOPTOCL, false, 0, nRigth, {0,0,164,100}) end end ----------------------------------------------------------------- local function InsertGeom( tGeometries, sSideLock, bPushDoor, sTypeGeom) local nCont = 1 local sFileExt local sFileName local sFilePath local nErr, sErr local bBox local sPathLua local sSubPath local nTypeGeom local bImport local sImportType local nGeomId if not sTypeGeom then return false elseif string.lower(sTypeGeom) == 'vision' then sSubPath = 'Compo\\VisionCutOuts\\' nTypeGeom = 1 elseif string.lower(sTypeGeom) == 'louver' then sSubPath = 'Compo\\LouverCutOuts\\' nTypeGeom = 2 elseif string.lower(sTypeGeom) == 'lock' then sSubPath = 'Compo\\Locks\\' nTypeGeom = 3 elseif string.lower(sTypeGeom) == 'stopandcloser' then sSubPath = 'Compo\\StopsAndClosers\\' nTypeGeom = 4 elseif string.lower(sTypeGeom) == 'hinge' then sSubPath = 'Compo\\Hinges\\' nTypeGeom = 5 elseif string.lower(sTypeGeom) == 'mail' then sSubPath = 'Compo\\MailSlots\\' nTypeGeom = 6 elseif string.lower(sTypeGeom) == 'flush' then sSubPath = 'Compo\\FlushPulls\\' nTypeGeom = 7 elseif string.lower(sTypeGeom) == 'viewer' then sSubPath = 'Compo\\Viewers\\' nTypeGeom = 8 elseif string.lower(sTypeGeom) == 'rollerlatch' then sSubPath = 'Compo\\RollerLatchs\\' nTypeGeom = 9 elseif string.lower(sTypeGeom) == 'edgepull' then sSubPath = 'Compo\\EdgePulls\\' nTypeGeom = 10 elseif string.lower(sTypeGeom) == 'flushbolt' then sSubPath = 'Compo\\FlushBolts\\' nTypeGeom = 11 elseif string.lower(sTypeGeom) == 'pivot' then sSubPath = 'Compo\\Pivots\\' nTypeGeom = 12 elseif string.lower(sTypeGeom) == 'overhead' then sSubPath = 'Compo\\OverHeads\\' nTypeGeom = 13 elseif string.lower(sTypeGeom) == 'strike' then sSubPath = 'Compo\\Strikes\\' nTypeGeom = 14 elseif string.lower(sTypeGeom) == 'groove' then sSubPath = 'Compo\\Groove\\' nTypeGeom = 15 elseif string.lower(sTypeGeom) == 'rabbet' then sSubPath = 'Compo\\Rabbets\\' nTypeGeom = 16 elseif string.lower(sTypeGeom) == 'ept' then sSubPath = 'Compo\\Epts\\' nTypeGeom = 17 elseif string.lower(sTypeGeom) == 'facedecoration' then sSubPath = 'Compo\\FaceDecoration\\' nTypeGeom = 18 end while nCont <= #tGeometries do if nTypeGeom == 1 then -- se vision sPathLua = sBaseDir .. sSubPath .. tGeometries[nCont].shape DGD.SPLIT = tGeometries[nCont].split DGD.DIR = tGeometries[nCont].dir if tGeometries[nCont].split or ( tGeometries[nCont].length and tGeometries[nCont].width) then DGD.LENGTH = tGeometries[nCont].length DGD.WIDTH = tGeometries[nCont].width DGD.TOP_RAIL = tGeometries[nCont].top_rail DGD.LOCK_STYLE = tGeometries[nCont].lock_stile DGD.POINTAPP = tGeometries[nCont].door_center DGD.RADIUS = tGeometries[nCont].radius -- se split è assente elseif tGeometries[nCont].split == nil then -- setto anche variabili lunghezza e larghezza che sono a nil per evitare di mantenere precedenti settaggi delle stesse variabili DGD.LENGTH = tGeometries[nCont].length DGD.WIDTH = tGeometries[nCont].width DGD.RADIUS = tGeometries[nCont].radius DGD.CENTER_FROM_TOP = tGeometries[nCont].center_from_top DGD.CENTER_FROM_LOCK = tGeometries[nCont].center_from_lock DGD.POINTAPP = tGeometries[nCont].door_center end elseif nTypeGeom == 2 then -- se louver if not tGeometries[nCont].shape then -- se non ho shape lancio il rect di default sPathLua = sBaseDir .. sSubPath .. 'rect' -- con il louver c'è solo una forma rettangolare else sPathLua = sBaseDir .. sSubPath .. tGeometries[nCont].shape end if tGeometries[nCont].length and tGeometries[nCont].width then DGD.LENGTH = tGeometries[nCont].length DGD.WIDTH = tGeometries[nCont].width DGD.BOTTOM_RAIL = tGeometries[nCont].bottom_rail DGD.LOCK_STYLE = tGeometries[nCont].lock_stile DGD.POINTAPP = tGeometries[nCont].door_center end elseif nTypeGeom == 3 then -- se lock sPathLua = sBaseDir .. sSubPath .. tGeometries[nCont].template DGD.BACK_SET = tGeometries[nCont].back_set DGD.POSITION = tGeometries[nCont].position DGD.OFFSET = tGeometries[nCont].offset DGD.SIDE = tGeometries[nCont].side DGD.OTHERD = tGeometries[nCont].other_door elseif nTypeGeom == 4 then -- se stop_and_closer sPathLua = sBaseDir .. sSubPath .. tGeometries[nCont].template DGD.POSITION = tGeometries[nCont].position DGD.POCKET_OFFSET = tGeometries[nCont].pocket_offset DGD.SIDE = tGeometries[nCont].side DGD.OTHERD = tGeometries[nCont].other_door elseif nTypeGeom == 5 then -- se hinge sPathLua = sBaseDir .. sSubPath .. tGeometries[nCont].template DGD.BACK_SET = tGeometries[nCont].back_set DGD.THICKNESS = tGeometries[nCont].thickness DGD.POSITION = tGeometries[nCont].position elseif nTypeGeom == 6 then -- se mail_slot sPathLua = sBaseDir .. sSubPath .. tGeometries[nCont].template DGD.LENGTH = tGeometries[nCont].length DGD.BOTTOM_RAIL = tGeometries[nCont].bottom_rail DGD.DELTA_CENTER = tGeometries[nCont].delta_center elseif nTypeGeom == 7 then -- se flush_pull sPathLua = sBaseDir .. sSubPath .. tGeometries[nCont].template DGD.BACK_SET = tGeometries[nCont].back_set DGD.POSITION = tGeometries[nCont].position DGD.DEPTH = tGeometries[nCont].depth DGD.FACE = tGeometries[nCont].face elseif nTypeGeom == 8 then -- se viewer sPathLua = sBaseDir .. sSubPath .. tGeometries[nCont].template DGD.BOTTOM_RAIL = tGeometries[nCont].bottom_rail DGD.DELTA_CENTER = tGeometries[nCont].delta_center DGD.SIDE = tGeometries[nCont].side elseif nTypeGeom == 9 then -- se roller_latch sPathLua = sBaseDir .. sSubPath .. tGeometries[nCont].template DGD.SIDE = tGeometries[nCont].side DGD.POSITION = tGeometries[nCont].position DGD.OFFSET = tGeometries[nCont].offset DGD.OTHERD = tGeometries[nCont].other_door elseif nTypeGeom == 10 then -- se edge_pull sPathLua = sBaseDir .. sSubPath .. tGeometries[nCont].template DGD.POSITION = tGeometries[nCont].position DGD.OFFSET = tGeometries[nCont].offset elseif nTypeGeom == 11 then -- se flush_bolt sPathLua = sBaseDir .. sSubPath .. tGeometries[nCont].template DGD.TYPE = tGeometries[nCont].type DGD.SIDE = tGeometries[nCont].side DGD.POSITION = tGeometries[nCont].position DGD.OFFSET = tGeometries[nCont].offset DGD.BACK_SET = tGeometries[nCont].back_set DGD.OTHERD = tGeometries[nCont].other_door elseif nTypeGeom == 12 then -- se pivot sPathLua = sBaseDir .. sSubPath .. tGeometries[nCont].template DGD.TYPE = tGeometries[nCont].type DGD.SIDE = tGeometries[nCont].side DGD.RADIUS = tGeometries[nCont].radius DGD.POSITION = tGeometries[nCont].position DGD.BACK_SET = tGeometries[nCont].back_set DGD.DEPTH_F = tGeometries[nCont].depth_f DGD.OFFSET = tGeometries[nCont].offset DGD.OTHERD = tGeometries[nCont].other_door elseif nTypeGeom == 13 then -- se overhead sPathLua = sBaseDir .. sSubPath .. tGeometries[nCont].template DGD.POCKPOS = tGeometries[nCont].pockpos DGD.POCKLENGTH = tGeometries[nCont].pocklength DGD.POCKET_OFFSET = tGeometries[nCont].pocket_offset DGD.ARMPOS = tGeometries[nCont].armpos DGD.ARMLENGTH = tGeometries[nCont].armlength DGD.SIDE = tGeometries[nCont].side DGD.OTHERD = tGeometries[nCont].other_door elseif nTypeGeom == 14 then -- se strike sPathLua = sBaseDir .. sSubPath .. tGeometries[nCont].template DGD.BACK_SET = tGeometries[nCont].back_set DGD.POSITION = tGeometries[nCont].position DGD.OFFSET = tGeometries[nCont].offset DGD.OTHERD = tGeometries[nCont].other_door elseif nTypeGeom == 15 then -- se groove sPathLua = sBaseDir .. sSubPath .. tGeometries[nCont].template DGD.TYPE = tGeometries[nCont].type DGD.SIDE = tGeometries[nCont].side DGD.FST = tGeometries[nCont].fst DGD.HST = tGeometries[nCont].hst DGD.LST = tGeometries[nCont].lst if DGD.SIDE == 'hinge' or DGD.SIDE == 'lock' then if bRemake then if DGD.SIDE == 'lock' then DGD.LENGTH = EgtIf( sSideLock == 'L', max(DGD.L2Top,DGD.L2), max(DGD.L4Top,DGD.L4)) else DGD.LENGTH = EgtIf( sSideLock == 'L', max(DGD.L4Top,DGD.L4), max(DGD.L2Top,DGD.L2)) end else DGD.LENGTH = DGD.dH -- setto come altezza porta end if DGD.HST and DGD.LST and DGD.TYPE == 'center' then DGD.LENGTH = DGD.LENGTH - DGD.HST - DGD.LST end else if bRemake then if DGD.SIDE == 'top' or DGD.SIDE == 'top_angle' or DGD.SIDE == 'top_flat' then DGD.LENGTH = max(DGD.L3Top,DGD.L3) else DGD.LENGTH = max(DGD.L1Top,DGD.L1) end else -- se lato top ed è ad angoolo ricalcolo il lato if ( DGD.SIDE == 'top_flat' or DGD.SIDE == 'top_angle') and DGD.Tpa then -- se devo applicare il groove su lato diritto corto if DGD.SIDE == 'top_flat' then -- se lunghezza lato dritto esiste if DGD.tProfs.top.xdeltapos > 0 then DGD.LENGTH = DGD.tProfs.top.xdeltapos else DGD.LENGTH = DGD.dW -- setto di base come larghezza porta end -- altrimenti è da applicare su lato inclinato else if ( DGD.dW - DGD.tProfs.top.xdeltapos) > 0 then DGD.LENGTH = ( DGD.dW - DGD.tProfs.top.xdeltapos) / cos(abs(DGD.tProfs.top.angle)) else DGD.LENGTH = DGD.dW -- setto di base come larghezza porta end end else DGD.LENGTH = DGD.dW -- setto di base come larghezza porta end end DGD.SIDELENGTH = DGD.LENGTH if DGD.HST and DGD.LST then -- se lato top ed è ad angoolo ed è presente lato piano ricalcolo il lato -- if DGD.SIDE == 'top_flat' and DGD.Tpa and DGD.tProfs.top.xdeltapos > 0 then -- -- se parte angolata sulla parte sinistra -- if DGD.tProfs.top.angle > 0 then -- -- se lato losk a sinsitra -- if DGD.Lock == 'L' then -- -- ricalcolo il lato -- DGD.LENGTH = DGD.LENGTH - DGD.HST -- DGD.LST = 0 -- else -- -- ricalcolo il lato -- DGD.LENGTH = DGD.LENGTH - DGD.LST -- DGD.HST = 0 -- end -- -- altrimenti parte angolata sulla parte destra -- else -- -- se lato losk a sinsitra -- if DGD.Lock == 'L' then -- -- ricalcolo il lato -- DGD.LENGTH = DGD.LENGTH - DGD.LST -- DGD.HST = 0 -- else -- -- ricalcolo il lato -- DGD.LENGTH = DGD.LENGTH - DGD.HST -- DGD.LST = 0 -- end -- end -- elseif DGD.SIDE == 'top_angle' and DGD.Tpa and ( DGD.dW - DGD.tProfs.top.xdeltapos) > 0 then -- -- se parte angolata sulla parte sinistra -- if DGD.tProfs.top.angle > 0 then -- -- se lato losk a sinsitra -- if DGD.Lock == 'L' then -- -- ricalcolo il lato -- DGD.LENGTH = DGD.LENGTH - DGD.LST -- DGD.HST = 0 -- else -- -- ricalcolo il lato -- DGD.LENGTH = DGD.LENGTH - DGD.HST -- DGD.LST = 0 -- end -- -- altrimenti parte angolata sulla parte destra -- else -- -- se lato losk a sinsitra -- if DGD.Lock == 'L' then -- -- ricalcolo il lato -- DGD.LENGTH = DGD.LENGTH - DGD.HST -- DGD.LST = 0 -- else -- -- ricalcolo il lato -- DGD.LENGTH = DGD.LENGTH - DGD.LST -- DGD.HST = 0 -- end -- end -- else DGD.LENGTH = DGD.LENGTH - DGD.HST - DGD.LST -- end end -- se larghezza porta è large width setto flag if DGD.Part and DGD.Part > 0 and DGD.dW > DGD.Part then DGD.bPart = true end end if DGD.FST then tGeometries[nCont].width = DGD.dT - DGD.FST - DGD.FST end DGD.WIDTH = tGeometries[nCont].width DGD.DEPTH = tGeometries[nCont].depth DGD.GROOVE_OFFSET = tGeometries[nCont].groove_offset elseif nTypeGeom == 16 then -- se rabbet sPathLua = sBaseDir .. sSubPath .. tGeometries[nCont].template DGD.SIDE = tGeometries[nCont].side if DGD.SIDE == 'hinge' or DGD.SIDE == 'lock' then if bRemake then if DGD.SIDE == 'lock' then DGD.LENGTH = EgtIf( sSideLock == 'L', max(DGD.L2Top,DGD.L2), max(DGD.L4Top,DGD.L4)) else DGD.LENGTH = EgtIf( sSideLock == 'L', max(DGD.L4Top,DGD.L4), max(DGD.L2Top,DGD.L2)) end else DGD.LENGTH = DGD.dH -- setto come altezza porta end else if bRemake then if DGD.SIDE == 'top' then DGD.LENGTH = max(DGD.L3Top,DGD.L3) else DGD.LENGTH = max(DGD.L1Top,DGD.L1) end else DGD.LENGTH = DGD.dW -- setto di base come larghezza porta end -- se larghezza porta è large width setto flag if DGD.Part and DGD.Part > 0 and DGD.dW > DGD.Part then DGD.bPart = true end end DGD.WIDTH = tGeometries[nCont].width DGD.DEPTH = tGeometries[nCont].depth DGD.ANGLE = tGeometries[nCont].angle DGD.OPPO = tGeometries[nCont].oppo elseif nTypeGeom == 17 then -- se ept sPathLua = sBaseDir .. sSubPath .. tGeometries[nCont].template DGD.FACETOCL = tGeometries[nCont].back_set DGD.TOPTOCL = tGeometries[nCont].position elseif nTypeGeom == 18 then -- se facedecoration sPathLua = sBaseDir .. sSubPath .. tGeometries[nCont].template DGD.TYPE = tGeometries[nCont].type DGD.DEPTH = tGeometries[nCont].depth DGD.DFT = tGeometries[nCont].dft DGD.DFB = tGeometries[nCont].dfb DGD.DFL = tGeometries[nCont].dfl DGD.DFH = tGeometries[nCont].dfh DGD.FACE = tGeometries[nCont].face end -- Controllo se nel nome file è già presente l'estensione .nge sFilePath,sFileName,sFileExt = EgtSplitPath( string.lower(sPathLua)) bImport = false -- se trovata estensione .nge nel template if sFileExt and sFileExt == '.nge' then sImportType = 'nge' else -- non contiene direttamente estensione nge if EgtExistsFile( string.lower(sPathLua)..'.lua') then-- provo con lua sImportType = 'lua' elseif EgtExistsFile( string.lower(sPathLua)..'.nge') then -- provo con nge sImportType = 'nge' sFileExt = '.nge' else -- altrimenti tipo non riconosciuto sImportType = 'bad' end end -- in base al tipo lancio l'import, o il componente lua o do errore if sImportType == 'nge' then local sPathNge = sBaseDir .. 'LuaLibs\\ImportNgeFile.lua' -- compongo il parametro nomefile sFileName = sFileName .. sFileExt local MHgen = require('ImportNgeFile') nErr, sErr, nGeomId = MHgen.Draw( sFilePath,sFileName) if nErr == 0 and nGeomId then -- in base al tipo ri-setto le dimensioni di ingombro della geometria importata if nTypeGeom == 1 or nTypeGeom == 2 or nTypeGeom == 18 then -- se vision o louver o decoration bBox = EgtGetBBox( nGeomId, 0) tGeometries[nCont].length = bBox:getDimY(bBox) tGeometries[nCont].width = bBox:getDimX(bBox) DGD.LENGTH = tGeometries[nCont].length DGD.WIDTH = tGeometries[nCont].width elseif nTypeGeom == 6 then -- se mail slot bBox = EgtGetBBox( nGeomId, 0) tGeometries[nCont].length = bBox:getDimY(bBox) DGD.LENGTH = tGeometries[nCont].length end bImport = true end elseif sImportType == 'lua' then -- componente lua sPathLua = sPathLua .. '.lua' nErr, sErr, nGeomId = dofile( sPathLua) else nErr = 1000 sErr = string.format(EgtDoorsMsg[411],sPathLua, DGD.FILE) end if nErr > 0 then DoorOutLog( sErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sErr if DGD.ERR <= 0 then DGD.ERR = nErr end break else -- se presente messaggio di warning if nErr < 0 then DoorOutLog( sErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sErr if DGD.ERR == 0 then DGD.ERR = nErr end end --debug -- EgtSaveFile( sNgeFile) -- EgtMove(DGD.PZ, Point3d(0,0,nil) - ORIG()) -- posizionamento geometria -- tipo vision if nTypeGeom == 1 then if DGD.SPLIT then if DGD.LENGTH and tGeometries[nCont].length and abs( DGD.LENGTH - tGeometries[nCont].length) > GEO.EPS_SMALL then tGeometries[nCont].length = DGD.LENGTH end if DGD.WIDTH and tGeometries[nCont].width and abs( DGD.WIDTH - tGeometries[nCont].width) > GEO.EPS_SMALL then tGeometries[nCont].width = DGD.WIDTH end end tGeometries[nCont].geom = nGeomId MoveCutOuts( tGeometries[nCont], sSideLock, bPushDoor, bImport, nTypeGeom) -- vision sizing InsertSize( nTypeGeom, sSideLock) elseif nTypeGeom == 2 then -- tipo louver tGeometries[nCont].geom = nGeomId MoveCutOuts( tGeometries[nCont], sSideLock, bPushDoor, bImport, nTypeGeom) -- louver sizing InsertSize( nTypeGeom, sSideLock) elseif nTypeGeom == 3 then -- tipo lock -- verifico se è un aggregato local sType = type(nGeomId) if sType == 'table' then if #nGeomId >= 1 then for k = 1, #nGeomId do tGeometries[nCont].geom = nGeomId[k][1] tGeometries[nCont].back_set = nGeomId[k][2] tGeometries[nCont].offset = nGeomId[k][3] MoveLock( tGeometries[nCont], sSideLock, bPushDoor) -- lock sizing InsertSize( nTypeGeom, sSideLock, nil, nil, nGeomId[k][4], nGeomId[k][5], nGeomId[k][2], nGeomId[k][3], nGeomId[k][6], nGeomId[k][7], k) end end else tGeometries[nCont].geom = nGeomId MoveLock( tGeometries[nCont], sSideLock, bPushDoor) -- lock sizing InsertSize( nTypeGeom, sSideLock, nil, nil, 0, 0) end elseif nTypeGeom == 4 then -- tipo stop_and_closer -- verifico se è un aggregato local sType = type(nGeomId) if sType == 'table' then if #nGeomId >= 1 then for k = 1, #nGeomId do tGeometries[nCont].geom = nGeomId[k] MoveStopAndCloser( tGeometries[nCont], sSideLock, bPushDoor) end end else tGeometries[nCont].geom = nGeomId MoveStopAndCloser( tGeometries[nCont], sSideLock, bPushDoor) end elseif nTypeGeom == 5 then -- tipo hinge tGeometries[nCont].geom = nGeomId MoveHinge( tGeometries[nCont], sSideLock, bPushDoor) -- hinge sizing InsertSize( nTypeGeom, sSideLock) elseif nTypeGeom == 6 then -- tipo mail_slot tGeometries[nCont].geom = nGeomId MoveCutOuts( tGeometries[nCont], sSideLock, bPushDoor, bImport, nTypeGeom) -- mail slot sizing InsertSize( nTypeGeom, sSideLock) elseif nTypeGeom == 7 then -- tipo flush_pull tGeometries[nCont].geom = nGeomId MoveFlushPull( tGeometries[nCont], sSideLock, bPushDoor, bImport) -- flush_pull sizing InsertSize( nTypeGeom, sSideLock) elseif nTypeGeom == 8 then -- tipo viewer tGeometries[nCont].geom = nGeomId MoveViewer( tGeometries[nCont], sSideLock, bPushDoor) -- viewer sizing InsertSize( nTypeGeom, sSideLock) elseif nTypeGeom == 9 then -- tipo rollerlatch tGeometries[nCont].geom = nGeomId MoveRollerLatch( tGeometries[nCont], sSideLock, bPushDoor) -- roller latch sizing InsertSize( nTypeGeom, sSideLock) elseif nTypeGeom == 10 then -- tipo edgepull tGeometries[nCont].geom = nGeomId MoveEdgePull( tGeometries[nCont], sSideLock, bPushDoor) -- EdgePull sizing InsertSize( nTypeGeom, sSideLock) elseif nTypeGeom == 11 then -- tipo flushbolt tGeometries[nCont].geom = nGeomId MoveFlushBolt( tGeometries[nCont], sSideLock, bPushDoor) -- FlushBolt sizing local dPosHead = 0 if string.lower(DGD.TYPE) == 'extension' then -- ricavo nota spostamento cava di testa dPosHead = EgtGetInfo( tGeometries[nCont].geom, 'DB_X', 'd') or 0 end InsertSize( nTypeGeom, sSideLock, nil, dPosHead) elseif nTypeGeom == 12 then -- tipo pivot tGeometries[nCont].geom = nGeomId MovePivot( tGeometries[nCont], sSideLock, bPushDoor) -- Pivot sizing InsertSize( nTypeGeom, sSideLock) elseif nTypeGeom == 13 then -- tipo overhead tGeometries[nCont].geom = nGeomId MoveOverHead( tGeometries[nCont], sSideLock, bPushDoor) elseif nTypeGeom == 14 then -- tipo strike tGeometries[nCont].geom = nGeomId MoveStrike( tGeometries[nCont], sSideLock, bPushDoor) -- Strike sizing InsertSize( nTypeGeom, sSideLock) elseif nTypeGeom == 15 then -- tipo groove tGeometries[nCont].geom = nGeomId MoveGroove( tGeometries[nCont], sSideLock, bPushDoor) elseif nTypeGeom == 16 then -- tipo rabbet tGeometries[nCont].geom = nGeomId MoveRabbet( tGeometries[nCont], sSideLock, bPushDoor) elseif nTypeGeom == 17 then -- tipo ept tGeometries[nCont].geom = nGeomId MoveEPT( tGeometries[nCont], sSideLock, bPushDoor) -- EPT sizing InsertSize( nTypeGeom, sSideLock) elseif nTypeGeom == 18 then -- tipo facedecoration tGeometries[nCont].geom = nGeomId MoveCopyDecoration( tGeometries[nCont], sSideLock, bPushDoor, bImport) end end nCont = nCont + 1 end end ----------------------------------------------------------------- local function SubAndDeleteTempSurf( nIdLs) local nIdSurf local sSurfName local nIdSurfUp local nIdSurfDw local nIdSurfTmpUp local nIdSurfTmpDw local bFisrtUp = true local bFisrtDw = true nIdSurf = EgtGetFirstInGroup( nIdLs) -- ottengo la prima superfice while nIdSurf do sSurfName = EgtGetName( nIdSurf) local nNextId = EgtGetNext(nIdSurf) -- se trovata superfice up principale if sSurfName and bFisrtUp and string.lower(sSurfName) == 'flat_up' then nIdSurfUp = nIdSurf bFisrtUp = false end -- se trovata superfice dw principale if sSurfName and bFisrtDw and string.lower(sSurfName) == 'flat_dw' then nIdSurfDw = nIdSurf bFisrtDw = false end -- se superfice up temporanea la sottraggo alla principale e poi la elimino if sSurfName and string.lower(sSurfName) == 'flat_up_tmp' then nIdSurfTmpUp = nIdSurf EgtSurfFrSubtract( nIdSurfUp, nIdSurfTmpUp) EgtErase(nIdSurfTmpUp) end -- se superfice dw temporanea la sottraggo alla principale e poi la elimino if sSurfName and string.lower(sSurfName) == 'flat_dw_tmp' then nIdSurfTmpDw = nIdSurf EgtSurfFrSubtract( nIdSurfDw, nIdSurfTmpDw) EgtErase(nIdSurfTmpDw) end -- se superfice up temporanea speciale (da percorsi di hatching) la sommo alla principale e poi la elimino if sSurfName and string.lower(sSurfName) == 'flat_up_tmp_sp' then nIdSurfTmpUp = nIdSurf EgtSurfFrAdd( nIdSurfUp, nIdSurfTmpUp) EgtErase(nIdSurfTmpUp) end -- se superfice dw temporanea speciale (da percorsi di hatching) la sommo alla principale e poi la elimino if sSurfName and string.lower(sSurfName) == 'flat_dw_tmp_sp' then nIdSurfTmpDw = nIdSurf EgtSurfFrAdd( nIdSurfDw, nIdSurfTmpDw) EgtErase(nIdSurfTmpDw) end nIdSurf = nNextId end return true end ----------------------------------------------------------------- local function GetEdgeToMachine( sSide) if DGD.Lock == sSide then return DGD.tProfs.lockedge.machining elseif sSide == 'L' or sSide == 'R' then return DGD.tProfs.hingeedge.machining elseif sSide == 'T' then return DGD.tProfs.top.machining elseif sSide == 'B' then return DGD.tProfs.bottom.machining end end ----------------------------------------------------------------- local function GetEdgeTrimming( sSide) if DGD.Lock == sSide then return DGD.tProfs.lockedge.trimming elseif sSide == 'L' or sSide == 'R' then return DGD.tProfs.hingeedge.trimming elseif sSide == 'T' then return DGD.tProfs.top.trimming elseif sSide == 'B' then return DGD.tProfs.bottom.trimming end end ----------------------------------------------------------------- local function SetInvertEdgeTrimming( sProfile) if sProfile == 'BD' then sProfile = 'BU' elseif sProfile == 'BU' then sProfile = 'BD' elseif sProfile == 'BDEB' then sProfile = 'BUEB' elseif sProfile == 'BUEB' then sProfile = 'BDEB' end return sProfile end ----------------------------------------------------------------- local function GetRealEdgeTrimming( sSide) local sTrim = GetEdgeTrimming( sSide) if not DGD.sFrame then if sTrim == 'BD' or sTrim == 'BU' then if DGD.Push then sTrim = 'BU' else sTrim = 'BD' end elseif sTrim == 'BDEB' or sTrim == 'BUEB' then if DGD.Push then sTrim = 'BUEB' else sTrim = 'BDEB' end end end return sTrim end ----------------------------------------------------------------- local function GetEdgeOffset( sSide) if DGD.Lock == sSide then return DGD.tProfs.lockedge.offset else return DGD.tProfs.hingeedge.offset end end ----------------------------------------------------------------- local function SetFrameThickValues( bSideLeft) if DGD.sFrame then if nTypePiece == 3 then -- se frame SX if bSideLeft then DGD.Lut = 0 DGD.Lub = 0 DGD.Rut = DGD.dW DGD.Rub = DGD.dW else DGD.Ldt = 0 DGD.Ldb = 0 DGD.Rdt = DGD.dW DGD.Rdb = DGD.dW end elseif nTypePiece == 4 then -- se frame DX if bSideLeft then DGD.Ldt = 0 DGD.Ldb = 0 DGD.Rdt = DGD.dW DGD.Rdb = DGD.dW else DGD.Lut = 0 DGD.Lub = 0 DGD.Rut = DGD.dW DGD.Rub = DGD.dW end elseif nTypePiece == 5 then -- se frame TOP if bSideLeft then DGD.Bul = 0 DGD.Bur = 0 DGD.Tul = DGD.dH DGD.Tur = DGD.dH else DGD.Bdl = 0 DGD.Bdr = 0 DGD.Tdl = DGD.dH DGD.Tdr = DGD.dH end elseif nTypePiece == 6 then -- se frame BOTTOM if bSideLeft then DGD.Bdl = 0 DGD.Bdr = 0 DGD.Tdl = DGD.dH DGD.Tdr = DGD.dH else DGD.Bul = 0 DGD.Bur = 0 DGD.Tul = DGD.dH DGD.Tur = DGD.dH end end else if bSideLeft then DGD.Ult = DGD.dT DGD.Ulb = DGD.dT DGD.Dlb = 0 DGD.Dlt = 0 if DGD.PROBE == 2 then DGD.Mlb = DGD.dT/2 DGD.Mlt = DGD.dT/2 end else DGD.Urt = DGD.dT DGD.Urb = DGD.dT DGD.Drb = 0 DGD.Drt = 0 if DGD.PROBE == 2 then DGD.Mrb = DGD.dT/2 DGD.Mrt = DGD.dT/2 end end end end local function RemakeDoor( sLeftType, dRadProf, sRightType, dRadProfR) local nLa = EgtGroup( DGD.PZ) EgtSetName( nLa, 'REC') EgtSetColor( nLa, BROWN()) local dDistToExtX = tProbeDoor.PX + (2*25.4) -- calcolo linea di estensione in X in base al settaggio nella macro + 2 Inch extra local dDistToExtY = tProbeDoor.PY + (2*25.4) -- calcolo linea di estensione in Y in base al settaggio nella macro + 2 inch extra -- dichiaro le variabili dei lati local nBase local nBaseMid local nBaseTop local nRight local nRightMid local nRightTop local nTop local nTopMid local nTopTop local nLeft local nLeftMid local nLeftTop -- creo linee principali (in senso antiorario) nBase = EgtLine( nLa, { tProbeDoor.P2x, tProbeDoor.P2y, 0}, { tProbeDoor.P3x, tProbeDoor.P3y, 0}, GDB_RT.LOC) -- p2 a p3 if not nBase then return end if DGC.Pms == 0 then -- se ricostruzione completa porta nRight = EgtLine( nLa, { tProbeDoor.P4x, tProbeDoor.P4y, 0}, { tProbeDoor.P5x, tProbeDoor.P5y, 0}, GDB_RT.LOC) -- p4 a p5 nTop = EgtLine( nLa, { tProbeDoor.P6x, tProbeDoor.P6y, 0}, { tProbeDoor.P7x, tProbeDoor.P7y, 0}, GDB_RT.LOC) -- p6 a p7 nLeft = EgtLine( nLa, { tProbeDoor.P8x, tProbeDoor.P8y, 0}, { tProbeDoor.P1x, tProbeDoor.P1y, 0}, GDB_RT.LOC) -- p8 a p1 else -- se modalità 1 (solo 4 punti probe, calcolo solo larghezza) o modalità 2 ( 5 punti probe, calcolo larghezza e lunghezza) -- calcolo l'angolo di rotazione local vDirEnt = EgtSV(nBase) local dAngRotbase = atan(vDirEnt:getY(),vDirEnt:getX()) -- continuo la costruzione delle linee con un solo angolo calcolato if tProbeDoor.DD == 0 then -- se porta disposta a destra -- linea destra calcolata sul punto più vicino alla linea di base nRight = EgtLinePDL( nLa, { tProbeDoor.P4x, tProbeDoor.P4y, 0}, dAngRotbase+90, ( DGD.dW - (2*tProbeDoor.PY)) ,GDB_RT.LOC) -- p4 con angolo e lunghezza -- linea top calcolata sul punto opposto in Y a P3 cioè P6 nTop = EgtLinePDL( nLa, { tProbeDoor.P6x, tProbeDoor.P6y, 0}, dAngRotbase + 180, ( DGD.dH - (2*tProbeDoor.PX)), GDB_RT.LOC) -- p6 con angolo e lunghezza -- se ho il punto anche in lunghezza if DGC.Pms == 2 then nLeft = EgtLinePDL( nLa, { tProbeDoor.P1x, tProbeDoor.P1y, 0}, dAngRotbase+90, ( DGD.dW - (2*tProbeDoor.PY)), GDB_RT.LOC) -- p1 con angolo e lunghezza -- inverto la direzione EgtInvertCurve(nLeft) elseif DGC.Pms == 1 then -- faccio l'offset della linea alla distanza pari all'altezza della porta nLeft = EgtOffsetCurveAdv( nRight, -DGD.dH) -- inverto la direzione EgtInvertCurve(nLeft) end else -- altrimenti disposta a sinistra -- linea sinistra calcolata sul punto più vicino alla linea di base nLeft = EgtLinePDL( nLa, { tProbeDoor.P1x, tProbeDoor.P1y, 0}, dAngRotbase+90, ( DGD.dW - (2*tProbeDoor.PY)) ,GDB_RT.LOC) -- p4 con angolo e lunghezza -- inverto la direzione EgtInvertCurve(nLeft) -- linea top calcolata sul punto opposto in Y a P2, cioè P7 nTop = EgtLinePDL( nLa, { tProbeDoor.P7x, tProbeDoor.P7y, 0}, dAngRotbase, ( DGD.dH - (2*tProbeDoor.PX)), GDB_RT.LOC) -- p6 con angolo e lunghezza -- inverto la direzione EgtInvertCurve(nTop) -- se ho il punto anche in lunghezza if DGC.Pms == 2 then nRight = EgtLinePDL( nLa, { tProbeDoor.P4x, tProbeDoor.P4y, 0}, dAngRotbase+90, ( DGD.dW - (2*tProbeDoor.PY)), GDB_RT.LOC) -- p1 con angolo e lunghezza elseif DGC.Pms == 1 then -- faccio l'offset della linea alla distanza pari all'altezza della porta nRight = EgtOffsetCurveAdv( nLeft, -DGD.dH) -- inverto la direzione EgtInvertCurve(nRight) end end end -- lati di riferimento della porta local nParFlip = 1 if tProbeDoor.FD > 0.5 then -- se porta flippata if tProbeDoor.TD > 0.5 then -- se top a destra nDoorLeft = nBase nDoorRight = nTop nDoorTop = nRight nDoorBot = nLeft else nDoorLeft = nTop nDoorRight = nBase nDoorTop = nLeft nDoorBot = nRight end nParFlip = -1 else -- porta non flippata if tProbeDoor.TD > 0.5 then -- se top a destra nDoorLeft = nTop nDoorRight = nBase nDoorTop = nRight nDoorBot = nLeft else nDoorLeft = nBase nDoorRight = nTop nDoorTop = nLeft nDoorBot = nRight end end if nBase then if abs(tProbeDoor.DR) > 0 then -- se ho la linea probase faccio l'eventuale offset e la assegno alla variabile giusta EgtOffsetCurve( nBase, tProbeDoor.DR) end -- se la base è il lato sinistro if nDoorLeft == nBase then nDoorLeftTop = EgtCopyGlob(nBase, nLa) nBaseTop = nDoorLeftTop nDoorLeftMid = EgtCopyGlob(nBase, nLa) nBaseMid = nDoorLeftMid if sLeftType == 'SQ' or sLeftType == 'EB' or sLeftType == 'FDWC' then EgtMove( nDoorLeftTop, ORIG() + Point3d(0,0,(nParFlip*DGD.dT)), GDB_RT.GRID) EgtMove( nDoorLeftMid, ORIG() + Point3d(0,0,(nParFlip*DGD.dT/2)), GDB_RT.GRID) elseif sLeftType == 'BU' or sLeftType == 'BUEB' then EgtMove( nDoorLeftTop, ORIG() + Point3d(0,0,(nParFlip*DGD.dT)), GDB_RT.GRID) EgtMove( nDoorLeftMid, ORIG() + Point3d(0,0,(nParFlip*DGD.dT/2)), GDB_RT.GRID) EgtOffsetCurve( nDoorLeftTop, -DGD.dT * TAN3) EgtOffsetCurve( nDoorLeftMid, -DGD.dT/2 * TAN3) elseif sLeftType == 'BD' or sLeftType == 'BDEB' then EgtMove( nDoorLeftTop, ORIG() + Point3d(0,0,(nParFlip*DGD.dT)), GDB_RT.GRID) EgtMove( nDoorLeftMid, ORIG() + Point3d(0,0,(nParFlip*DGD.dT/2)), GDB_RT.GRID) EgtOffsetCurve( nBase, -DGD.dT * TAN3) EgtOffsetCurve( nDoorLeftMid, -DGD.dT/2 * TAN3) elseif sLeftType == '1B' or sLeftType == '2B' or sLeftType == '3B' or sLeftType == '4B' or sLeftType == '5B' or sLeftType == '6B' or sLeftType == '7B' or sLeftType == '8B'then EgtMove( nDoorLeftTop, ORIG() + Point3d(0,0,(nParFlip*DGD.dT)), GDB_RT.GRID) EgtMove( nDoorLeftMid, ORIG() + Point3d(0,0,(nParFlip*DGD.dT/2)), GDB_RT.GRID) EgtOffsetCurve( nBase, -(dRadProf - sqrt( ( dRadProf * dRadProf) - ((DGD.dT/2)*(DGD.dT/2))))) EgtOffsetCurve( nDoorLeftTop, -(dRadProf - sqrt( ( dRadProf * dRadProf) - ((DGD.dT/2)*(DGD.dT/2))))) elseif sLeftType == 'CV' then EgtMove( nDoorLeftTop, ORIG() + Point3d(0,0,(nParFlip*DGD.dT)), GDB_RT.GRID) EgtMove( nDoorLeftMid, ORIG() + Point3d(0,0,(nParFlip*DGD.dT/2)), GDB_RT.GRID) EgtOffsetCurve( nDoorLeftMid, -(dRadProf - sqrt( ( dRadProf * dRadProf) - ((DGD.dT/2)*(DGD.dT/2))))) end else nDoorRightTop = EgtCopyGlob(nBase, nLa) nBaseTop = nDoorRightTop nDoorRightMid = EgtCopyGlob(nBase, nLa) nBaseMid = nDoorRightMid if sRightType == 'SQ' or sRightType == 'EB' or sRightType == 'FDWC' then EgtMove( nDoorRightTop, ORIG() + Point3d(0,0,(nParFlip*DGD.dT)), GDB_RT.GRID) EgtMove( nDoorRightMid, ORIG() + Point3d(0,0,(nParFlip*DGD.dT/2)), GDB_RT.GRID) elseif sRightType == 'BU' or sRightType == 'BUEB' then EgtMove( nDoorRightTop, ORIG() + Point3d(0,0,(nParFlip*DGD.dT)), GDB_RT.GRID) EgtMove( nDoorRightMid, ORIG() + Point3d(0,0,(nParFlip*DGD.dT/2)), GDB_RT.GRID) EgtOffsetCurve( nDoorRightTop, -DGD.dT * TAN3) EgtOffsetCurve( nDoorRightMid, -DGD.dT/2 * TAN3) elseif sRightType == 'BD' or sRightType == 'BDEB' then EgtMove( nDoorRightTop, ORIG() + Point3d(0,0,(nParFlip*DGD.dT)), GDB_RT.GRID) EgtMove( nDoorRightMid, ORIG() + Point3d(0,0,(nParFlip*DGD.dT/2)), GDB_RT.GRID) EgtOffsetCurve( nBase, -DGD.dT * TAN3) EgtOffsetCurve( nDoorRightMid, -DGD.dT/2 * TAN3) elseif sRightType == '1B' or sRightType == '2B' or sRightType == '3B' or sRightType == '4B' or sRightType == '5B' or sRightType == '6B' or sRightType == '7B' or sRightType == '8B' then EgtMove( nDoorRightTop, ORIG() + Point3d(0,0,(nParFlip*DGD.dT)), GDB_RT.GRID) EgtMove( nDoorRightMid, ORIG() + Point3d(0,0,(nParFlip*DGD.dT/2)), GDB_RT.GRID) EgtOffsetCurve( nBase, -(dRadProfR - sqrt( ( dRadProfR * dRadProfR) - ((DGD.dT/2)*(DGD.dT/2))))) EgtOffsetCurve( nDoorRightTop, -(dRadProfR - sqrt((dRadProfR * dRadProfR) - ((DGD.dT/2)*(DGD.dT/2))))) elseif sRightType == 'CV' then EgtMove( nDoorRightTop, ORIG() + Point3d(0,0,(nParFlip*DGD.dT)), GDB_RT.GRID) EgtMove( nDoorRightMid, ORIG() + Point3d(0,0,(nParFlip*DGD.dT/2)), GDB_RT.GRID) EgtOffsetCurve( nDoorRightMid, -(dRadProfR - sqrt((dRadProfR * dRadProfR) - ((DGD.dT/2)*(DGD.dT/2))))) end end end if nTop then if abs(tProbeDoor.DO) > 0 then -- se ho la linea probase faccio l'eventuale offset e la assegno alla variabile giusta EgtOffsetCurve( nTop, tProbeDoor.DO) end -- se il lato top è il lato sinistro if nDoorLeft == nTop then nDoorLeftTop = EgtCopyGlob(nTop, nLa) nTopTop = nDoorLeftTop nDoorLeftMid = EgtCopyGlob(nTop, nLa) nTopMid = nDoorLeftMid if sLeftType == 'SQ' or sLeftType == 'EB' or sLeftType == 'FDWC' then EgtMove( nDoorLeftTop, ORIG() + Point3d(0,0,(nParFlip*DGD.dT)), GDB_RT.GRID) EgtMove( nDoorLeftMid, ORIG() + Point3d(0,0,(nParFlip*DGD.dT/2)), GDB_RT.GRID) elseif sLeftType == 'BU' or sLeftType == 'BUEB' then EgtMove( nDoorLeftTop, ORIG() + Point3d(0,0,(nParFlip*DGD.dT)), GDB_RT.GRID) EgtMove( nDoorLeftMid, ORIG() + Point3d(0,0,(nParFlip*DGD.dT/2)), GDB_RT.GRID) EgtOffsetCurve( nDoorLeftTop, -DGD.dT * TAN3) EgtOffsetCurve( nDoorLeftMid, -DGD.dT/2 * TAN3) elseif sLeftType == 'BD' or sLeftType == 'BDEB' then EgtMove( nDoorLeftTop, ORIG() + Point3d(0,0,(nParFlip*DGD.dT)), GDB_RT.GRID) EgtMove( nDoorLeftMid, ORIG() + Point3d(0,0,(nParFlip*DGD.dT/2)), GDB_RT.GRID) EgtOffsetCurve( nTop, -DGD.dT * TAN3) EgtOffsetCurve( nDoorLeftMid, -DGD.dT/2 * TAN3) elseif sLeftType == '1B' or sLeftType == '2B' or sLeftType == '3B' or sLeftType == '4B' or sLeftType == '5B' or sLeftType == '6B' or sLeftType == '7B' or sLeftType == '8B' then EgtMove( nDoorLeftTop, ORIG() + Point3d(0,0,(nParFlip*DGD.dT)), GDB_RT.GRID) EgtMove( nDoorLeftMid, ORIG() + Point3d(0,0,(nParFlip*DGD.dT/2)), GDB_RT.GRID) EgtOffsetCurve( nTop, -(dRadProf - sqrt( ( dRadProf * dRadProf) - ((DGD.dT/2)*(DGD.dT/2))))) EgtOffsetCurve( nDoorLeftTop, -(dRadProf - sqrt( ( dRadProf * dRadProf) - ((DGD.dT/2)*(DGD.dT/2))))) elseif sLeftType == 'CV' then EgtMove( nDoorLeftTop, ORIG() + Point3d(0,0,(nParFlip*DGD.dT)), GDB_RT.GRID) EgtMove( nDoorLeftMid, ORIG() + Point3d(0,0,(nParFlip*DGD.dT/2)), GDB_RT.GRID) EgtOffsetCurve( nDoorLeftMid, -(dRadProf - sqrt( ( dRadProf * dRadProf) - ((DGD.dT/2)*(DGD.dT/2))))) end else nDoorRightTop = EgtCopyGlob(nTop, nLa) nTopTop = nDoorRightTop nDoorRightMid = EgtCopyGlob(nTop, nLa) nTopMid = nDoorRightMid if sRightType == 'SQ' or sRightType == 'EB' or sRightType == 'FDWC' then EgtMove( nDoorRightTop, ORIG() + Point3d(0,0,(nParFlip*DGD.dT)), GDB_RT.GRID) EgtMove( nDoorRightMid, ORIG() + Point3d(0,0,(nParFlip*DGD.dT/2)), GDB_RT.GRID) elseif sRightType == 'BU' or sRightType == 'BUEB' then EgtMove( nDoorRightTop, ORIG() + Point3d(0,0,(nParFlip*DGD.dT)), GDB_RT.GRID) EgtMove( nDoorRightMid, ORIG() + Point3d(0,0,(nParFlip*DGD.dT/2)), GDB_RT.GRID) EgtOffsetCurve( nDoorRightTop, -DGD.dT * TAN3) EgtOffsetCurve( nDoorRightMid, -DGD.dT/2 * TAN3) elseif sRightType == 'BD' or sRightType == 'BDEB' then EgtMove( nDoorRightTop, ORIG() + Point3d(0,0,(nParFlip*DGD.dT)), GDB_RT.GRID) EgtMove( nDoorRightMid, ORIG() + Point3d(0,0,(nParFlip*DGD.dT/2)), GDB_RT.GRID) EgtOffsetCurve( nTop, -DGD.dT * TAN3) EgtOffsetCurve( nDoorRightMid, -DGD.dT/2 * TAN3) elseif sRightType == '1B' or sRightType == '2B' or sRightType == '3B' or sRightType == '4B' or sRightType == '5B' or sRightType == '6B' or sRightType == '7B' or sRightType == '8B' then EgtMove( nDoorRightTop, ORIG() + Point3d(0,0,(nParFlip*DGD.dT)), GDB_RT.GRID) EgtMove( nDoorRightMid, ORIG() + Point3d(0,0,(nParFlip*DGD.dT/2)), GDB_RT.GRID) EgtOffsetCurve( nTop, -(dRadProfR - sqrt( ( dRadProfR * dRadProfR) - ((DGD.dT/2)*(DGD.dT/2))))) EgtOffsetCurve( nDoorRightTop, -(dRadProfR - sqrt((dRadProfR * dRadProfR) - ((DGD.dT/2)*(DGD.dT/2))))) elseif sRightType == 'CV' then EgtMove( nDoorRightTop, ORIG() + Point3d(0,0,(nParFlip*DGD.dT)), GDB_RT.GRID) EgtMove( nDoorRightMid, ORIG() + Point3d(0,0,(nParFlip*DGD.dT/2)), GDB_RT.GRID) EgtOffsetCurve( nDoorRightMid, -(dRadProfR - sqrt((dRadProfR * dRadProfR) - ((DGD.dT/2)*(DGD.dT/2))))) end end end if nLeft then -- se il lato sinistro è il top if nDoorTop == nLeft then nDoorTopTop = EgtCopyGlob(nLeft, nLa) nLeftTop = nDoorTopTop nDoorTopMid = EgtCopyGlob(nLeft, nLa) nLeftMid = nDoorTopMid EgtMove( nDoorTopTop, ORIG() + Point3d(0,0,(nParFlip*DGD.dT)), GDB_RT.GRID) EgtMove( nDoorTopMid, ORIG() + Point3d(0,0,(nParFlip*DGD.dT/2)), GDB_RT.GRID) else nDoorBotTop = EgtCopyGlob(nLeft, nLa) nLeftTop = nDoorBotTop nDoorBotMid = EgtCopyGlob(nLeft, nLa) nLeftMid = nDoorBotMid EgtMove( nDoorBotTop, ORIG() + Point3d(0,0,(nParFlip*DGD.dT)), GDB_RT.GRID) EgtMove( nDoorBotMid, ORIG() + Point3d(0,0,(nParFlip*DGD.dT/2)), GDB_RT.GRID) end end if nRight then -- se il lato sinistro è il bottom if nDoorBot == nRight then nDoorBotTop = EgtCopyGlob(nRight, nLa) nRightTop = nDoorBotTop nDoorBotMid = EgtCopyGlob(nRight, nLa) nRightMid = nDoorBotMid EgtMove( nDoorBotTop, ORIG() + Point3d(0,0,(nParFlip*DGD.dT)), GDB_RT.GRID) EgtMove( nDoorBotMid, ORIG() + Point3d(0,0,(nParFlip*DGD.dT/2)), GDB_RT.GRID) else nDoorTopTop = EgtCopyGlob(nRight, nLa) nRightTop = nDoorTopTop nDoorTopMid = EgtCopyGlob(nRight, nLa) nRightMid = nDoorTopMid EgtMove( nDoorTopTop, ORIG() + Point3d(0,0,(nParFlip*DGD.dT)), GDB_RT.GRID) EgtMove( nDoorTopMid, ORIG() + Point3d(0,0,(nParFlip*DGD.dT/2)), GDB_RT.GRID) end end -- estendo le linee per creare i quadrilateri di base, medio e top if nRight and nBase then -- base con destra EgtTrimExtendCurveByLen( nBase,dDistToExtX,EgtEP(nBase)) EgtTrimExtendCurveByLen( nRight,dDistToExtY,EgtSP(nRight)) local nIdDel = EgtSplitCurveAtPoint( nBase, EgtIP(nBase,nRight,EgtEP(nBase))) EgtErase(nIdDel) nIdDel = nRight nRight = EgtSplitCurveAtPoint( nRight, EgtEP(nBase)) EgtErase(nIdDel) end if nRightMid and nBaseMid then -- base con destra mid EgtTrimExtendCurveByLen( nBaseMid,dDistToExtX,EgtEP(nBaseMid)) EgtTrimExtendCurveByLen( nRightMid,dDistToExtY,EgtSP(nRightMid)) local nIdDel = EgtSplitCurveAtPoint( nBaseMid, EgtIP(nBaseMid,nRightMid,EgtEP(nBaseMid))) EgtErase(nIdDel) nIdDel = nRightMid nRightMid = EgtSplitCurveAtPoint( nRightMid, EgtEP(nBaseMid)) EgtErase(nIdDel) end if nRightTop and nBaseTop then -- base con destra top EgtTrimExtendCurveByLen( nBaseTop,dDistToExtX,EgtEP(nBaseTop)) EgtTrimExtendCurveByLen( nRightTop,dDistToExtY,EgtSP(nRightTop)) local nIdDel = EgtSplitCurveAtPoint( nBaseTop, EgtIP(nBaseTop,nRightTop,EgtEP(nBaseTop))) EgtErase(nIdDel) nIdDel = nRightTop nRightTop = EgtSplitCurveAtPoint( nRightTop, EgtEP(nBaseTop)) EgtErase(nIdDel) end if nLeft and nBase then -- base con sinistra EgtTrimExtendCurveByLen( nBase,dDistToExtX,EgtSP(nBase)) EgtTrimExtendCurveByLen( nLeft,dDistToExtY, EgtEP(nLeft)) local nIdDel = nBase nBase = EgtSplitCurveAtPoint( nBase, EgtIP(nBase,nLeft,EgtSP(nBase))) EgtErase(nIdDel) nIdDel = EgtSplitCurveAtPoint( nLeft, EgtSP(nBase)) EgtErase(nIdDel) end if nLeftMid and nBaseMid then -- base con sinistra mid EgtTrimExtendCurveByLen( nBaseMid,dDistToExtX,EgtSP(nBaseMid)) EgtTrimExtendCurveByLen( nLeftMid,dDistToExtY, EgtEP(nLeftMid)) local nIdDel = nBaseMid nBaseMid = EgtSplitCurveAtPoint( nBaseMid, EgtIP(nBaseMid,nLeftMid,EgtSP(nBaseMid))) EgtErase(nIdDel) nIdDel = EgtSplitCurveAtPoint( nLeftMid, EgtSP(nBaseMid)) EgtErase(nIdDel) end if nLeftTop and nBaseTop then -- base con sinistra top EgtTrimExtendCurveByLen( nBaseTop,dDistToExtX,EgtSP(nBaseTop)) EgtTrimExtendCurveByLen( nLeftTop,dDistToExtY, EgtEP(nLeftTop)) local nIdDel = nBaseTop nBaseTop = EgtSplitCurveAtPoint( nBaseTop, EgtIP(nBaseTop,nLeftTop,EgtSP(nBaseTop))) EgtErase(nIdDel) nIdDel = EgtSplitCurveAtPoint( nLeftTop, EgtSP(nBaseTop)) EgtErase(nIdDel) end if nRight and nTop then -- top con destra EgtTrimExtendCurveByLen( nTop,dDistToExtX,EgtSP(nTop)) EgtTrimExtendCurveByLen( nRight,dDistToExtY, EgtEP(nRight)) local nIdDel = nTop nTop = EgtSplitCurveAtPoint( nTop, EgtIP(nTop,nRight,EgtSP(nTop))) EgtErase(nIdDel) nIdDel = EgtSplitCurveAtPoint( nRight, EgtSP(nTop)) EgtErase(nIdDel) end if nRightMid and nTopMid then -- top con destra mid EgtTrimExtendCurveByLen( nTopMid,dDistToExtX,EgtSP(nTopMid)) EgtTrimExtendCurveByLen( nRightMid,dDistToExtY, EgtEP(nRightMid)) local nIdDel = nTopMid nTopMid = EgtSplitCurveAtPoint( nTopMid, EgtIP(nTopMid,nRightMid,EgtSP(nTopMid))) EgtErase(nIdDel) nIdDel = EgtSplitCurveAtPoint( nRightMid, EgtSP(nTopMid)) EgtErase(nIdDel) end if nRightTop and nTopTop then -- top con destra top EgtTrimExtendCurveByLen( nTopTop,dDistToExtX,EgtSP(nTopTop)) EgtTrimExtendCurveByLen( nRightTop,dDistToExtY, EgtEP(nRightTop)) local nIdDel = nTopTop nTopTop = EgtSplitCurveAtPoint( nTopTop, EgtIP(nTopTop,nRightTop,EgtSP(nTopTop))) EgtErase(nIdDel) nIdDel = EgtSplitCurveAtPoint( nRightTop, EgtSP(nTopTop)) EgtErase(nIdDel) end if nLeft and nTop then -- top con sinistra EgtTrimExtendCurveByLen( nTop,dDistToExtX,EgtEP(nTop)) EgtTrimExtendCurveByLen( nLeft,dDistToExtY, EgtSP(nLeft)) local nIdDel = EgtSplitCurveAtPoint( nTop, EgtIP(nTop,nLeft,EgtEP(nTop))) EgtErase(nIdDel) nIdDel = nLeft nLeft = EgtSplitCurveAtPoint( nLeft, EgtEP(nTop)) EgtErase(nIdDel) end if nLeftMid and nTopMid then -- top con sinistra mid EgtTrimExtendCurveByLen( nTopMid,dDistToExtX,EgtEP(nTopMid)) EgtTrimExtendCurveByLen( nLeftMid,dDistToExtY, EgtSP(nLeftMid)) local nIdDel = EgtSplitCurveAtPoint( nTopMid, EgtIP(nTopMid,nLeftMid,EgtEP(nTopMid))) EgtErase(nIdDel) nIdDel = nLeftMid nLeftMid = EgtSplitCurveAtPoint( nLeftMid, EgtEP(nTopMid)) EgtErase(nIdDel) end if nLeftTop and nTopTop then -- top con sinistra top EgtTrimExtendCurveByLen( nTopTop,dDistToExtX,EgtEP(nTopTop)) EgtTrimExtendCurveByLen( nLeftTop,dDistToExtY, EgtSP(nLeftTop)) local nIdDel = EgtSplitCurveAtPoint( nTopTop, EgtIP(nTopTop,nLeftTop,EgtEP(nTopTop))) EgtErase(nIdDel) nIdDel = nLeftTop nLeftTop = EgtSplitCurveAtPoint( nLeftTop, EgtEP(nTopTop)) EgtErase(nIdDel) end if tProbeDoor.FD > 0.5 then -- se porta flippata -- dopo rotazione il giro è orario EgtRotate( {nBase,nRight,nTop,nLeft} , ORIG(), X_AX(), 180 ) EgtRotate( {nBaseMid,nRightMid,nTopMid,nLeftMid} , ORIG(), X_AX(), 180 ) EgtRotate( {nBaseTop,nRightTop,nTopTop,nLeftTop} , ORIG(), X_AX(), 180 ) if tProbeDoor.TD > 0.5 then -- se top a destra EgtRotate( {nBase,nRight,nTop,nLeft} , ORIG(), Z_AX(), 90 ) EgtRotate( {nBaseMid,nRightMid,nTopMid,nLeftMid} , ORIG(), Z_AX(), 90 ) EgtRotate( {nBaseTop,nRightTop,nTopTop,nLeftTop} , ORIG(), Z_AX(), 90 ) nDoorLeft = nBase nDoorRight = nTop nDoorTop = nRight nDoorBot = nLeft nDoorLeftMid = nBaseMid nDoorRightMid = nTopMid nDoorTopMid = nRightMid nDoorBotMid = nLeftMid nDoorLeftTop = nBaseTop nDoorRightTop = nTopTop nDoorTopTop = nRightTop nDoorBotTop = nLeftTop else EgtRotate( {nBase,nRight,nTop,nLeft} , ORIG(), Z_AX(), -90 ) EgtRotate( {nBaseMid,nRightMid,nTopMid,nLeftMid} , ORIG(), Z_AX(), -90 ) EgtRotate( {nBaseTop,nRightTop,nTopTop,nLeftTop} , ORIG(), Z_AX(), -90 ) nDoorLeft = nTop nDoorRight = nBase nDoorTop = nLeft nDoorBot = nRight nDoorLeftMid = nTopMid nDoorRightMid = nBaseMid nDoorTopMid = nLeftMid nDoorBotMid = nRightMid nDoorLeftTop = nTopTop nDoorRightTop = nBaseTop nDoorTopTop = nLeftTop nDoorBotTop = nRightTop end else -- porta non flippata --inverto la direzione delle entità per avere giro orario EgtInvertCurve({nBase,nRight,nTop,nLeft}) EgtInvertCurve({nBaseMid,nRightMid,nTopMid,nLeftMid}) EgtInvertCurve({nBaseTop,nRightTop,nTopTop,nLeftTop}) if tProbeDoor.TD > 0.5 then -- se top a destra EgtRotate( {nBase,nRight,nTop,nLeft} , ORIG(), Z_AX(), 90 ) EgtRotate( {nBaseMid,nRightMid,nTopMid,nLeftMid} , ORIG(), Z_AX(), 90 ) EgtRotate( {nBaseTop,nRightTop,nTopTop,nLeftTop} , ORIG(), Z_AX(), 90 ) nDoorLeft = nTop nDoorRight = nBase nDoorTop = nRight nDoorBot = nLeft nDoorLeftMid = nTopMid nDoorRightMid = nBaseMid nDoorTopMid = nRightMid nDoorBotMid = nLeftMid nDoorLeftTop = nTopTop nDoorRightTop = nBaseTop nDoorTopTop = nRightTop nDoorBotTop = nLeftTop else EgtRotate( {nBase,nRight,nTop,nLeft} , ORIG(), Z_AX(), -90 ) EgtRotate( {nBaseMid,nRightMid,nTopMid,nLeftMid} , ORIG(), Z_AX(), -90 ) EgtRotate( {nBaseTop,nRightTop,nTopTop,nLeftTop} , ORIG(), Z_AX(), -90 ) nDoorLeft = nBase nDoorRight = nTop nDoorTop = nLeft nDoorBot = nRight nDoorLeftMid = nBaseMid nDoorRightMid = nTopMid nDoorTopMid = nLeftMid nDoorBotMid = nRightMid nDoorLeftTop = nBaseTop nDoorRightTop = nTopTop nDoorTopTop = nLeftTop nDoorBotTop = nRightTop end end EgtSetName (nDoorLeft, 'Left') EgtSetName (nDoorRight, 'Right') EgtSetName (nDoorTop, 'Top') EgtSetName (nDoorBot, 'Bottom') EgtSetName (nDoorLeftMid, 'LeftMid') EgtSetName (nDoorRightMid, 'RightMid') EgtSetName (nDoorTopMid, 'TopMid') EgtSetName (nDoorBotMid, 'BottomMid') EgtSetName (nDoorLeftTop, 'LeftTop') EgtSetName (nDoorRightTop, 'RightTop') EgtSetName (nDoorTopTop, 'TopTop') EgtSetName (nDoorBotTop, 'BottomTop') -- Per ogni quadrilatero Prendo i 4 punti base e le direzioni relative che definiranno la porta DGD.P1=EgtEP( nDoorBotTop, GDB_RT.GLOB) DGD.P2=EgtEP( nDoorRightTop, GDB_RT.GLOB) DGD.P3=EgtEP( nDoorRight, GDB_RT.GLOB) DGD.P4=EgtEP( nDoorBot, GDB_RT.GLOB) DGD.P5=EgtEP( nDoorBotMid, GDB_RT.GLOB) DGD.P6=EgtEP( nDoorRightMid, GDB_RT.GLOB) DGD.P7=EgtEP( nDoorLeftTop, GDB_RT.GLOB) DGD.P8=EgtEP( nDoorTopTop, GDB_RT.GLOB) DGD.P9=EgtEP( nDoorTop, GDB_RT.GLOB) DGD.P10=EgtEP( nDoorLeft, GDB_RT.GLOB) DGD.P11=EgtEP( nDoorLeftMid, GDB_RT.GLOB) DGD.P12=EgtEP( nDoorTopMid, GDB_RT.GLOB) if sLeftType == 'SQ' or sLeftType == 'EB' or sLeftType == '1B' or sLeftType == '2B' or sLeftType == '3B' or sLeftType == '4B' or sLeftType == '5B' or sLeftType == '6B' or sLeftType == '7B' or sLeftType == '8B' or sLeftType == 'FDWC' then DGD.PminBot = DGD.P5 DGD.PminTop = DGD.P11 elseif sLeftType == 'BU' or sLeftType == 'BUEB' or sLeftType == 'CV' then DGD.PminBot = DGD.P4 DGD.PminTop = DGD.P10 elseif sLeftType == 'BD' or sLeftType == 'BDEB' then DGD.PminBot = DGD.P1 DGD.PminTop = DGD.P7 end if sRightType == 'SQ' or sRightType == 'EB' or sRightType == '1B' or sRightType == '2B' or sRightType == '3B' or sRightType == '4B' or sRightType == '5B' or sRightType == '6B' or sRightType == '7B' or sRightType == '8B' or sRightType == 'FDWC' then DGD.PmaxBot = DGD.P6 DGD.PmaxTop = DGD.P12 elseif sRightType == 'BU' or sRightType == 'BUEB' or sRightType == 'CV' then DGD.PmaxBot = DGD.P3 DGD.PmaxTop = DGD.P9 elseif sRightType == 'BD' or sRightType == 'BDEB' then DGD.PmaxBot = DGD.P2 DGD.PmaxTop = DGD.P8 end local vDirEnt = EgtSV(nDoorBot) DGD.A1=atan(vDirEnt:getY(),vDirEnt:getX()) DGD.A2=DGD.A1+180 DGD.L1=EgtCurveLength( nDoorBot) DGD.L1Top=EgtCurveLength( nDoorBotTop) vDirEnt = EgtSV(nDoorLeft) DGD.A3=atan(vDirEnt:getY(),vDirEnt:getX()) DGD.A4=DGD.A3+180 DGD.L2=EgtCurveLength( nDoorLeft) DGD.L2Top=EgtCurveLength( nDoorLeftTop) vDirEnt = EgtSV(nDoorTop) DGD.A5=atan(vDirEnt:getY(),vDirEnt:getX()) DGD.A6=DGD.A5+180 DGD.L3=EgtCurveLength( nDoorTop) DGD.L3Top=EgtCurveLength( nDoorTopTop) vDirEnt = EgtSV(nDoorRight) DGD.A7=atan(vDirEnt:getY(),vDirEnt:getX()) DGD.A8=DGD.A7+180 DGD.L4=EgtCurveLength( nDoorRight) DGD.L4Top=EgtCurveLength( nDoorRightTop) -- errato calcolo: prende le ipotenuse di maggior lunghezza e larghezza e non i box -- calcolo le dimensioni della porta -- local dLungMax = max ( sqrt( ( DGD.PmaxBot[1] - DGD.PmaxTop[1]) * ( DGD.PmaxBot[1] - DGD.PmaxTop[1]) + -- ( DGD.PmaxBot[2] - DGD.PmaxTop[2]) * ( DGD.PmaxBot[2] - DGD.PmaxTop[2])), -- sqrt( ( DGD.PminBot[1] - DGD.PminTop[1]) * ( DGD.PminBot[1] - DGD.PminTop[1]) + -- ( DGD.PminBot[2] - DGD.PminTop[2]) * ( DGD.PminBot[2] - DGD.PminTop[2]))) -- -- local dLarghMax = max ( sqrt( ( DGD.PmaxBot[1] - DGD.PminBot[1]) * ( DGD.PmaxBot[1] - DGD.PminBot[1]) + -- ( DGD.PmaxBot[2] - DGD.PminBot[2]) * ( DGD.PmaxBot[2] - DGD.PminBot[2])), -- sqrt( ( DGD.PmaxTop[1] - DGD.PminTop[1]) * ( DGD.PmaxTop[1] - DGD.PminTop[1]) + -- ( DGD.PmaxTop[2] - DGD.PminTop[2]) * ( DGD.PmaxTop[2] - DGD.PminTop[2]))) local dLungMax = max ( DGD.PmaxTop[2], DGD.PminTop[2]) - min( DGD.PmaxBot[2], DGD.PminBot[2]) local dLarghMax = max ( DGD.PmaxTop[1], DGD.PmaxBot[1]) - min( DGD.PminTop[1], DGD.PminBot[1]) -- Sposto tutte e 4 le geometrie nel primo quadrante -- EgtMove( {nBase,nRight,nTop,nLeft}, ORIG() - EgtSP(nDoorLeft), GDB_RT.GRID) -- allineo il lato sinistro con la Y -- local vDirLeft = EgtSV( nDoorLeft) -- EgtRotate( {nBase,nRight,nTop,nLeft} , ORIG(), Z_AX(), atan(vDirLeft:getX()/vDirLeft:getY()) ) -- ritorno le dimensioni calcolate return dLungMax, dLarghMax end ----------------------------------------------------------------- local function MakeSurfProfiles( nParLay, sBotType, dRadProfB, sRghtType, dRadProfR, sTopType, dRadProfT, sLftType, dRadProfL, sSideName, dPlnProfB, dPlnProfR, dPlnProfT, dPlnProf) -- setto variabili che indicano se i profili sono compatibili local bJoinRgt = true local bJoinLft = true local bDelete = true -- profilo superiore local nTopPath, nToptSezPath, ptMedArc -- creo curva superiore if DGD.tProfs.top.radius then -- se ci sono tangenze con profili diversi verifico se concatenare la swept superiore if DGD.TPR then if sTopType == 'BD' or sTopType == 'BDEB' or sTopType == 'BU' or sTopType == 'BUEB' then if sRghtType == 'SQ' or sRghtType == 'EB' or sRightType == 'FDWC' then bJoinRgt = false elseif sRghtType == '1B' or sRghtType == '2B' or sRghtType == '3B' or sRghtType == '4B' or sRghtType == '5B' or sRghtType == '6B' or sRghtType == '7B' or sRghtType == '8B' then bJoinRgt = true elseif sRghtType == 'CV' then bJoinRgt = false end elseif sTopType == '1B' or sTopType == '2B' or sTopType == '3B' or sTopType == '4B' or sTopType == '5B' or sTopType == '6B' or sTopType == '7B' or sTopType == '8B' then if sRghtType == '1B' or sRghtType == '2B' or sRghtType == '3B' or sRghtType == '4B' or sRghtType == '5B' or sRghtType == '6B' or sRghtType == '7B' or sRghtType == '8B' then -- tolgo di mezzo il B e confronto i numeri local sNumProfTop = sTopType:gsub( 'B', '') local sNumProfSide = sRghtType:gsub( 'B', '') local nNumProfTop = tonumber(sNumProfTop) local nNumProfSide = tonumber(sNumProfSide) if nNumProfTop < nNumProfSide then bJoinRgt = false end elseif sRghtType == 'BD' or sRghtType == 'BDEB' or sRghtType == 'BU' or sRghtType == 'BUEB' then bJoinRgt = false elseif sRghtType == 'CV' or sRghtType == 'SQ' or sRghtType == 'EB' or sRightType == 'FDWC' then bJoinRgt = false end elseif sTopType == 'CV' then if sRghtType == 'BD' or sRghtType == 'BDEB' or sRghtType == 'BU' or sRghtType == 'BUEB' then bJoinRgt = false elseif sRghtType == '1B' or sRghtType == '2B' or sRghtType == '3B' or sRghtType == '4B' or sRghtType == '5B' or sRghtType == '6B' or sRghtType == '7B' or sRghtType == '8B' then bJoinRgt = false end end end if DGD.TPL then if sTopType == 'BD' or sTopType == 'BDEB' or sTopType == 'BU' or sTopType == 'BUEB' then if sLftType == 'SQ' or sLftType == 'EB' or sLftType == 'FDWC' then bJoinLft = false elseif sLftType == '1B' or sLftType == '2B' or sLftType == '3B' or sLftType == '4B' or sLftType == '5B' or sLftType == '6B' or sLftType == '7B' or sLftType == '8B' then bJoinLft = true elseif sLftType == 'CV' then bJoinLft = false end elseif sTopType == '1B' or sTopType == '2B' or sTopType == '3B' or sTopType == '4B' or sTopType == '5B' or sTopType == '6B' or sTopType == '7B' or sTopType == '8B' then if sLftType == '1B' or sLftType == '2B' or sLftType == '3B' or sLftType == '4B' or sLftType == '5B' or sLftType == '6B' or sLftType == '7B' or sLftType == '8B' then -- tolgo di mezzo il B e confronto i numeri local sNumProfTop = sTopType:gsub( 'B', '') local sNumProfSide = sLftType:gsub( 'B', '') local nNumProfTop = tonumber(sNumProfTop) local nNumProfSide = tonumber(sNumProfSide) if nNumProfTop < nNumProfSide then bJoinLft = false end elseif sLftType == 'BD' or sLftType == 'BDEB' or sLftType == 'BU' or sLftType == 'BUEB' then bJoinLft = false elseif sLftType == 'CV' or sLftType == 'SQ' or sLftType == 'EB' or sLftType == 'FDWC' then bJoinLft = false end elseif sTopType == 'CV' then if sLftType == 'BD' or sLftType == 'BDEB' or sLftType == 'BU' or sLftType == 'BUEB' then bJoinLft = false elseif sLftType == '1B' or sLftType == '2B' or sLftType == '3B' or sLftType == '4B' or sLftType == '5B' or sLftType == '6B' or sLftType == '7B' or sLftType == '8B' then bJoinLft = false end end end -- Arco top nTopPath = EgtArcC2P( nParLay, {((DGD.dW/2)+DGD.tProfs.top.xdeltapos), (DGD.dH-DGD.tProfs.top.ydeltapos), DGD.Dra}, { DGD.RMa, DGD.AMr, DGD.Dra}, { DGD.LMa, DGD.AMl, DGD.Dla}, GDB_RT.GLOB) -- arco max local vcIni = EgtSV(nTopPath) EgtErase(nTopPath) nTopPath = EgtArc2PV( nParLay, { DGD.RMa, DGD.AMr, DGD.Dra}, { DGD.LMa, DGD.AMl, DGD.Dla}, vcIni, GDB_RT.GLOB) ptMedArc = EgtMP(nTopPath) if not DGD.TPR then -- se non ho tangenza a destra allungo il percorso local dDistY = abs((DGD.dH-DGD.tProfs.top.ydeltapos) - DGD.AMr) if dDistY > 50.8 then EgtTrimExtendCurveByLen( nTopPath, 50.8 , { DGD.RMa, DGD.AMr, DGD.Dra}) else EgtTrimExtendCurveByLen( nTopPath, dDistY*1.1 , { DGD.RMa, DGD.AMr, DGD.Dra}) end end if not DGD.TPL then -- se non ho tangenza a sinistra allungo il percorso local dDistY = abs((DGD.dH-DGD.tProfs.top.ydeltapos) - DGD.AMl) if dDistY > 50.8 then EgtTrimExtendCurveByLen( nTopPath, 50.8 , { DGD.LMa, DGD.AMl, DGD.Dla}) else EgtTrimExtendCurveByLen( nTopPath, dDistY*1.1 , { DGD.LMa, DGD.AMl, DGD.Dla}) end end elseif DGD.Tpa then if DGD.tProfs.top.xdeltapos > 0 then local nE1 = EgtLine( nParLay, {DGD.Rua,DGD.Aur,DGD.Dra}, {DGD.Cmu,DGD.Aut,DGD.Dla}, GDB_RT.GLOB) -- p14 a p19 local nE2 = EgtLine( nParLay, {DGD.Cmu,DGD.Aut,DGD.Dla}, {DGD.Lua,DGD.Aul,DGD.Dla}, GDB_RT.GLOB) -- p19 a p13 nTopPath = EgtCurveCompo( nParLay, {nE1,nE2}, true) else nTopPath = EgtLine( nParLay, {DGD.Rua,DGD.Aur,DGD.Dra}, {DGD.Lua,DGD.Aul,DGD.Dla}, GDB_RT.GLOB) -- p14 a p13 end EgtTrimExtendCurveByLen( nTopPath, DGD.dW/4, {DGD.Rua,DGD.Aur,DGD.Dra}) EgtTrimExtendCurveByLen( nTopPath, DGD.dW/4, {DGD.Lua,DGD.Aul,DGD.Dla}) else nTopPath = EgtLine( nParLay, {DGD.Rut,DGD.Tur,DGD.Drt}, {DGD.Lut,DGD.Tul,DGD.Dlt}, GDB_RT.GLOB) -- p8 a p7 EgtTrimExtendCurveByLen( nTopPath, DGD.dW/4, {DGD.Rut,DGD.Tur,DGD.Drt}) EgtTrimExtendCurveByLen( nTopPath, DGD.dW/4, {DGD.Lut,DGD.Tul,DGD.Dlt}) end -- prendo il versore iniziale local vIni = EgtSV( nTopPath, GDB_RT.GLOB) local pIni = EgtSP( nTopPath, GDB_RT.GLOB) -- griglia locale EgtSetGridFrame( Frame3d( pIni, vIni)) if sTopType == 'BD' or sTopType == 'BDEB' then -- profilo sezione nToptSezPath = EgtLine ( nParLay, {(DGD.dT*TAN3),0,0}, {0,DGD.dT,0}, GDB_RT.GRID) elseif sTopType == 'BU' or sTopType == 'BUEB' then if DGD.tProfs.top.radius then -- profilo sezione nToptSezPath = EgtLine ( nParLay, {0,0,0}, {(DGD.dT*TAN3),DGD.dT,0}, GDB_RT.GRID) else -- profilo sezione nToptSezPath = EgtLine ( nParLay, {-(DGD.dT*TAN3),0,0}, {0,DGD.dT,0}, GDB_RT.GRID) end elseif sTopType == '1B' or sTopType == '2B' or sTopType == '3B' or sTopType == '4B' or sTopType == '5B' or sTopType == '6B' or sTopType == '7B' or sTopType == '8B' then local dDeltaPos = dRadProfT - sqrt( ( dRadProfT * dRadProfT) - ((DGD.dT/2)*(DGD.dT/2))) if DGD.tProfs.top.radius then -- profilo sezione nToptSezPath = EgtArc3P( nParLay, {dDeltaPos,0,0}, {0,DGD.dT/2,0}, {dDeltaPos,DGD.dT,0}, GDB_RT.GRID) else -- profilo sezione nToptSezPath = EgtArc3P( nParLay, {0,0,0}, {-dDeltaPos,DGD.dT/2,0}, {0,DGD.dT,0}, GDB_RT.GRID) end elseif sTopType == 'CV' then local dDeltaPos = dRadProfT - sqrt( ( dRadProfT * dRadProfT) - (((DGD.dT/2)-dPlnProfT)*((DGD.dT/2)-dPlnProfT))) -- profilo sezione if dPlnProfT > 0 then local nLine1, nLine2, nArc nLine1 = EgtLine ( nParLay, {0,0,0}, {0,dPlnProfT,0}, GDB_RT.GRID) nArc = EgtArc3P( nParLay, {0,dPlnProfT,0}, {dDeltaPos,DGD.dT/2,0}, {0,DGD.dT-dPlnProfT,0}, GDB_RT.GRID) nLine2 = EgtLine ( nParLay, {0,DGD.dT-dPlnProfT,0}, {0,DGD.dT,0}, GDB_RT.GRID) nToptSezPath = EgtCurveCompo( nParLay, {nLine1,nArc,nLine2}, true) else nToptSezPath = EgtArc3P( nParLay, {0,0,0}, {dDeltaPos,DGD.dT/2,0}, {0,DGD.dT,0}, GDB_RT.GRID) end else -- profilo SQ o FDWC -- profilo sezione nToptSezPath = EgtLine ( nParLay, {0,0,0}, {0,DGD.dT,0}, GDB_RT.GRID) end -- disegno le swept sopra EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) local nSwT = EgtSurfTmSwept( nParLay, nToptSezPath, nTopPath,false, 0.05) ------------------------------- -- semi-profili inferiori ------------------------------- local nBotPath, nBotPath2, nBotPathL, nBotPathR, nBotSezPath -- griglia a sinistra EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.LEFT)) if sBotType == 'BD' or sBotType == 'BDEB' then -- profilo sezione nBotSezPath = EgtLine ( nParLay, {-(DGD.dT*TAN3),0,0}, {0,DGD.dT,0}, GDB_RT.GRID) -- percorsi guida EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) nBotPathL = EgtLine ( nParLay, {-(DGD.dW/4),(DGD.dT*TAN3),0}, {(DGD.dW/2),(DGD.dT*TAN3),0}, GDB_RT.GRID) nBotPathR = EgtLine ( nParLay, {(DGD.dW/2),(DGD.dT*TAN3),0}, {(DGD.dW*1.25),(DGD.dT*TAN3),0}, GDB_RT.GRID) elseif sBotType == 'BU' or sBotType == 'BUEB' then -- profilo sezione nBotSezPath = EgtLine ( nParLay, {0,0,0}, {-(DGD.dT*TAN3),DGD.dT,0}, GDB_RT.GRID) -- percorsi guida EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) nBotPathL = EgtLine ( nParLay, {-(DGD.dW/4),0,0}, {(DGD.dW/2),0,0}, GDB_RT.GRID) nBotPathR = EgtLine ( nParLay, {(DGD.dW/2),0,0}, {(DGD.dW*1.25),0,0}, GDB_RT.GRID) elseif sBotType == '1B' or sBotType == '2B' or sBotType == '3B' or sBotType == '4B' or sBotType == '5B' or sBotType == '6B' or sBotType == '7B' or sBotType == '8B' then local dDeltaPos = dRadProfB - sqrt( ( dRadProfB * dRadProfB) - ((DGD.dT/2)*(DGD.dT/2))) -- profilo sezione nBotSezPath = EgtArc3P( nParLay, {-dDeltaPos,0,0}, {0,DGD.dT/2,0}, {-dDeltaPos,DGD.dT,0}, GDB_RT.GRID) -- percorsi guida EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) nBotPathL = EgtLine ( nParLay, {-(DGD.dW/4),dDeltaPos,0}, {(DGD.dW/2),dDeltaPos,0}, GDB_RT.GRID) nBotPathR = EgtLine ( nParLay, {(DGD.dW/2),dDeltaPos,0}, {(DGD.dW*1.25),dDeltaPos,0}, GDB_RT.GRID) elseif sBotType == 'CV' then local dDeltaPos = dRadProfB - sqrt( ( dRadProfB * dRadProfB) - (((DGD.dT/2)-dPlnProfB)*((DGD.dT/2)-dPlnProfB))) -- profilo sezione if dPlnProfB > 0 then local nLine1, nLine2, nArc nLine1 = EgtLine ( nParLay, {0,0,0}, {0,dPlnProfB,0}, GDB_RT.GRID) nArc = EgtArc3P( nParLay, {0,dPlnProfB,0}, {-dDeltaPos,DGD.dT/2,0}, {0,DGD.dT-dPlnProfB,0}, GDB_RT.GRID) nLine2 = EgtLine ( nParLay, {0,DGD.dT-dPlnProfB,0}, {0,DGD.dT,0}, GDB_RT.GRID) nBotSezPath = EgtCurveCompo( nParLay, {nLine1,nArc,nLine2}, true) else nBotSezPath = EgtArc3P( nParLay, {0,0,0}, {-dDeltaPos,DGD.dT/2,0}, {0,DGD.dT,0}, GDB_RT.GRID) end -- percorsi guida EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) nBotPathL = EgtLine ( nParLay, {-(DGD.dW/4),0,0}, {(DGD.dW/2),0,0}, GDB_RT.GRID) nBotPathR = EgtLine ( nParLay, {(DGD.dW/2),0,0}, {(DGD.dW*1.25),0,0}, GDB_RT.GRID) else -- profilo SQ o FDWC -- profilo sezione nBotSezPath = EgtLine ( nParLay, {0,0,0}, {0,DGD.dT,0}, GDB_RT.GRID) -- percorsi guida EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) nBotPathL = EgtLine ( nParLay, {-(DGD.dW/4),0,0}, {(DGD.dW/2),0,0}, GDB_RT.GRID) nBotPathR = EgtLine ( nParLay, {(DGD.dW/2),0,0}, {(DGD.dW*1.25),0,0}, GDB_RT.GRID) end -- disegno le swept inferiori local nSwBL, nSwBR nSwBL = EgtSurfTmSwept( nParLay, nBotSezPath, nBotPathL,false, 0.05) nSwBR = EgtSurfTmSwept( nParLay, nBotSezPath, nBotPathR,false, 0.05) -- profilo destro local nRghtPath, nRghtSezPath -- griglia in fronte EgtSetGridFrame( Frame3d( DGD.dW,0,0, GDB_FR.FRONT)) if sRghtType == 'BD' or sRghtType == 'BDEB' then -- profilo sezione nRghtSezPath = EgtLine ( nParLay, {-(DGD.dT*TAN3),0,0}, {0,DGD.dT,0}, GDB_RT.GRID) -- percorsi guida EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) nRghtPath = EgtLine ( nParLay, {DGD.dW,-(DGD.dH*0.25),0}, {DGD.dW,(DGD.dH*1.25),0}, GDB_RT.GRID) elseif sRghtType == 'BU' or sRghtType == 'BUEB' then -- profilo sezione nRghtSezPath = EgtLine ( nParLay, {0,0,0}, {-(DGD.dT*TAN3),DGD.dT,0}, GDB_RT.GRID) -- percorsi guida EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) nRghtPath = EgtLine ( nParLay, {DGD.dW-(DGD.dT*TAN3),-(DGD.dH*0.25),0}, {DGD.dW-(DGD.dT*TAN3),(DGD.dH*1.25),0}, GDB_RT.GRID) elseif sRghtType == '1B' or sRghtType == '2B' or sRghtType == '3B' or sRghtType == '4B' or sRghtType == '5B' or sRghtType == '6B' or sRghtType == '7B' or sRghtType == '8B' then local dDeltaPos = dRadProfR - sqrt( ( dRadProfR * dRadProfR) - ((DGD.dT/2)*(DGD.dT/2))) -- profilo sezione nRghtSezPath = EgtArc3P( nParLay, {-dDeltaPos,0,0}, {0,DGD.dT/2,0}, {-dDeltaPos,DGD.dT,0}, GDB_RT.GRID) -- percorsi guida EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) nRghtPath = EgtLine ( nParLay, {DGD.dW-dDeltaPos,-(DGD.dH*0.25),0}, {DGD.dW-dDeltaPos,(DGD.dH*1.25),0}, GDB_RT.GRID) elseif sRghtType == 'CV' then local dDeltaPos = dRadProfR - sqrt( ( dRadProfR * dRadProfR) - (((DGD.dT/2)-dPlnProfR)*((DGD.dT/2)-dPlnProfR))) -- profilo sezione if dPlnProfR > 0 then local nLine1, nLine2, nArc nLine1 = EgtLine ( nParLay, {0,0,0}, {0,dPlnProfR,0}, GDB_RT.GRID) nArc = EgtArc3P( nParLay, {0,dPlnProfR,0}, {-dDeltaPos,DGD.dT/2,0}, {0,DGD.dT-dPlnProfR,0}, GDB_RT.GRID) nLine2 = EgtLine ( nParLay, {0,DGD.dT-dPlnProfR,0}, {0,DGD.dT,0}, GDB_RT.GRID) nRghtSezPath = EgtCurveCompo( nParLay, {nLine1,nArc,nLine2}, true) else nRghtSezPath = EgtArc3P( nParLay, {0,0,0}, {-dDeltaPos,DGD.dT/2,0}, {0,DGD.dT,0}, GDB_RT.GRID) end -- percorsi guida EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) nRghtPath = EgtLine ( nParLay, {DGD.dW,-(DGD.dH*0.25),0}, {DGD.dW,(DGD.dH*1.25),0}, GDB_RT.GRID) else -- profilo SQ o FDWC -- profilo sezione nRghtSezPath = EgtLine ( nParLay, {0,0,0}, {0,DGD.dT,0}, GDB_RT.GRID) -- percorsi guida EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) nRghtPath = EgtLine ( nParLay, {DGD.dW,-(DGD.dH*0.25),0}, {DGD.dW,(DGD.dH*1.25),0}, GDB_RT.GRID) end -- disegno la swept destra local nSwR = EgtSurfTmSwept( nParLay, nRghtSezPath, nRghtPath,false, 0.05) -- profilo sinistro local nLftPath, nLftSezPath -- griglia dietro EgtSetGridFrame( Frame3d( 0,DGD.dH,0, GDB_FR.BACK)) if sLftType == 'BD' or sLftType == 'BDEB' then -- profilo sezione nLftSezPath = EgtLine ( nParLay, {-(DGD.dT*TAN3),0,0}, {0,DGD.dT,0}, GDB_RT.GRID) -- percorsi guida EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) nLftPath = EgtLine ( nParLay, {(DGD.dT*TAN3),(DGD.dH*1.25),0}, {(DGD.dT*TAN3),-(DGD.dH*0.25),0}, GDB_RT.GRID) elseif sLftType == 'BU' or sLftType == 'BUEB' then -- profilo sezione nLftSezPath = EgtLine ( nParLay, {0,0,0}, {-(DGD.dT*TAN3),DGD.dT,0}, GDB_RT.GRID) -- percorsi guida EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) nLftPath = EgtLine ( nParLay, {0,(DGD.dH*1.25),0}, {0,-(DGD.dH*0.25),0}, GDB_RT.GRID) elseif sLftType == '1B' or sLftType == '2B' or sLftType == '3B' or sLftType == '4B' or sLftType == '5B' or sLftType == '6B' or sLftType == '7B' or sLftType == '8B' then local dDeltaPos = dRadProfL - sqrt( ( dRadProfL * dRadProfL) - ((DGD.dT/2)*(DGD.dT/2))) -- profilo sezione nLftSezPath = EgtArc3P( nParLay, {-dDeltaPos,0,0}, {0,DGD.dT/2,0}, {-dDeltaPos,DGD.dT,0}, GDB_RT.GRID) -- percorsi guida EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) nLftPath = EgtLine ( nParLay, {dDeltaPos,(DGD.dH*1.25),0}, {dDeltaPos,-(DGD.dH*0.25),0}, GDB_RT.GRID) elseif sLftType == 'CV' then local dDeltaPos = dRadProfL - sqrt( ( dRadProfL * dRadProfL) - (((DGD.dT/2)-dPlnProf)*((DGD.dT/2)-dPlnProf))) -- profilo sezione if dPlnProf > 0 then local nLine1, nLine2, nArc nLine1 = EgtLine ( nParLay, {0,0,0}, {0,dPlnProf,0}, GDB_RT.GRID) nArc = EgtArc3P( nParLay, {0,dPlnProf,0}, {-dDeltaPos,DGD.dT/2,0}, {0,DGD.dT-dPlnProf,0}, GDB_RT.GRID) nLine2 = EgtLine ( nParLay, {0,DGD.dT-dPlnProf,0}, {0,DGD.dT,0}, GDB_RT.GRID) nLftSezPath = EgtCurveCompo( nParLay, {nLine1,nArc,nLine2}, true) else nLftSezPath = EgtArc3P( nParLay, {0,0,0}, {-dDeltaPos,DGD.dT/2,0}, {0,DGD.dT,0}, GDB_RT.GRID) end -- percorsi guida EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) nLftPath = EgtLine ( nParLay, {0,(DGD.dH*1.25),0}, {0,-(DGD.dH*0.25),0}, GDB_RT.GRID) else -- profilo SQ o FDWC -- profilo sezione nLftSezPath = EgtLine ( nParLay, {0,0,0}, {0,DGD.dT,0}, GDB_RT.GRID) -- percorsi guida EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) nLftPath = EgtLine ( nParLay, {0,(DGD.dH*1.25),0}, {0,-(DGD.dH*0.25),0}, GDB_RT.GRID) end -- disegno la swept sinistra local nSwL = EgtSurfTmSwept( nParLay, nLftSezPath, nLftPath,false, 0.05) -- se ci sono tutte le swept procedo a rastremarle if nSwT and nSwBL and nSwBR and nSwR and nSwL then -- in base al profilo del top e se è in tangenza creo una superficie di appoggio if DGD.TPL and sTopType ~= 'SQ' and sTopType ~= 'EB' and sTopType ~= 'FDWC' then local nLine1, nLine2, nSwTmp nLine1 = EgtLine( nParLay, {(DGD.dW/2),DGD.AMl,0}, {(DGD.dW/2),DGD.AMl,DGD.dT}) nLine2 = EgtLine( nParLay, {-100,DGD.AMl,0}, {-100,DGD.AMl,DGD.dT}) -- nLine1 = EgtLine( nParLay, {(DGD.Lda+DGD.dT),DGD.Adl+(DGD.dT*tan(60)),0}, {(DGD.Lua+DGD.dT),DGD.Aul+(DGD.dT*tan(60)),DGD.dT}) -- nLine2 = EgtLine( nParLay, {-10,DGD.Adl-((10+DGD.Lda)*tan(60)),0}, {-10,DGD.Aul-((10+DGD.Lua)*tan(60)),DGD.dT}) nSwTmp = EgtSurfTmRuled( nParLay, nLine2, nLine1, 0.05) if bDelete then EgtErase( nLine1) EgtErase( nLine2) end -- somma tra le due superfici EgtSurfTmAdd(nSwT,nSwTmp) if nSwT then -- se ho una superficie sommata cancello la seconda EgtErase( nSwTmp) end end -- estrapolo il percorso intersezione EgtSurfTmSurfTmInters(nSwL,nSwT,nParLay) -- trimmo la swept sinistra con la superiore EgtSurfTmIntersect(nSwL,nSwT) if nSwL then -- se ho una superficie trimmata cancello la seconda -- EgtOutBox( 'trim ok', 'Trim', 'Trim') EgtErase( nSwT) else -- EgtOutBox( 'trim bad', 'Error Trim', 'Error Trim') return false end -- in base al profilo del top e se è in tangenza creo una superficie di appoggio if DGD.TPR and sTopType ~= 'SQ' and sTopType ~= 'EB' and sTopType ~= 'FDWC' then local nLine1, nLine2, nSwTmp nLine1 = EgtLine( nParLay, {DGD.dW+100,DGD.AMr,0}, {DGD.dW+100,DGD.AMr,DGD.dT}) nLine2 = EgtLine( nParLay, {(DGD.dW/2),DGD.AMr,0}, {(DGD.dW/2),DGD.AMr,DGD.dT}) -- nLine1 = EgtLine( nParLay, {DGD.dW+10,DGD.Adr-((DGD.dW-DGD.Rda+10)*tan(60)),0}, {DGD.dW+10,DGD.Aur-((DGD.dW-DGD.Rua+10)*tan(60)),DGD.dT}) -- nLine2 = EgtLine( nParLay, {(DGD.Rda-DGD.dT),DGD.Adr+(DGD.dT*tan(60)),0}, {(DGD.Rua-DGD.dT),DGD.Aur+(DGD.dT*tan(60)),DGD.dT}) nSwTmp = EgtSurfTmRuled( nParLay, nLine2, nLine1, 0.05) if bDelete then EgtErase( nLine1) EgtErase( nLine2) end -- somma tra le due superfici EgtSurfTmAdd(nSwL,nSwTmp) if nSwL then -- se ho una superficie sommata cancello la seconda EgtErase( nSwTmp) end end --debug -- EgtSaveFile( sNgeFile) -- EgtMove(DGD.PZ, Point3d(0,0,nil) - ORIG()) -- estrapolo il percorso intersezione EgtSurfTmSurfTmInters(nSwL,nSwR,nParLay) -- trimmo la swept sinistra/superiore con la destra EgtSurfTmIntersect(nSwL,nSwR) if nSwL then -- se ho una superficie trimmata cancello la seconda EgtErase( nSwR) else return false end -- estrapolo il percorso intersezione EgtSurfTmSurfTmInters(nSwL,nSwBL,nParLay) -- trimmo la swept sinistra/superiore/destra con la swept inferiore sinistra EgtSurfTmIntersect(nSwL,nSwBL) if nSwL then -- se ho una superficie trimmata cancello la seconda EgtErase( nSwBL) else return false end -- estrapolo il percorso intersezione EgtSurfTmSurfTmInters(nSwL,nSwBR,nParLay) -- trimmo la swept inferiore destra con la restante swept EgtSurfTmIntersect(nSwL,nSwBR) if nSwL then -- se ho una superficie trimmata cancello la seconda EgtErase( nSwBR) else return false end EgtSetName( nSwL, sSideName) --debug -- EgtSaveFile( sNgeFile) -- EgtMove(DGD.PZ, Point3d(0,0,nil) - ORIG()) if bDelete then -- cancello eventuali percorsi di costruzione if nTopPath then EgtErase(nTopPath) end if nToptSezPath then EgtErase(nToptSezPath) end if nBotPathL then EgtErase(nBotPathL) end if nBotPathR then EgtErase(nBotPathR) end if nBotSezPath then EgtErase(nBotSezPath) end if nRghtPath then EgtErase(nRghtPath) end if nRghtSezPath then EgtErase(nRghtSezPath) end if nLftPath then EgtErase(nLftPath) end if nLftSezPath then EgtErase(nLftSezPath) end end return true, ptMedArc, bJoinRgt, bJoinLft else return false end end ----------------------------------------------------------------- local function CreateDoor() local bInactive -- determinazione lato serratura if DGD.sSwing == 'RH' or DGD.sSwing == 'RHR' or DGD.sSwing == 'RHA' or DGD.sSwing == 'RHRI' or DGD.sSwing == 'RHI' or DGD.sSwing == 'RHRA' then DGD.Lock = 'L' else DGD.Lock = 'R' end -- determinazione se apertura a spingere o tirare if DGD.sSwing == 'RH' or DGD.sSwing == 'RHA' or DGD.sSwing == 'RHI' or DGD.sSwing == 'LH' or DGD.sSwing == 'LHI' or DGD.sSwing == 'LHA' then DGD.Push = true else DGD.Push = false end if DGD.sSwing == 'LHI' or DGD.sSwing == 'RHI' or DGD.sSwing == 'RHRI' or DGD.sSwing == 'LHRI' then bInactive = true end local sLocalLockPrf = DGD.tProfs.lockedge.trimming local sLocalHingeProf = DGD.tProfs.hingeedge.trimming if string.find( DGD.tProfs.lockedge.trimming, 'BU') then sLocalLockPrf = 'BU' elseif string.find( DGD.tProfs.lockedge.trimming, 'BD') then sLocalLockPrf = 'BD' end if string.find( DGD.tProfs.hingeedge.trimming, 'BU') then sLocalHingeProf = 'BU' elseif string.find( DGD.tProfs.hingeedge.trimming, 'BD') then sLocalHingeProf = 'BD' end -- Se porta inattiva if bInactive then -- Premessa: per definizione il profilo scritto indica la disposizione voluta, quindi se un profilo bevel è in opposizione -- al parametro secure, allora indica il profilo opposto. -- Se profilo serratura opposto al secure e diverso dal profilo hinge if ( ( DGD.Push and DGD.sSecSide == 'UP' and sLocalLockPrf == 'BU' ) or ( DGD.Push and DGD.sSecSide == 'DN' and sLocalLockPrf == 'BD' ) or ( not DGD.Push and DGD.sSecSide == 'DN' and sLocalLockPrf == 'BU' ) or ( not DGD.Push and DGD.sSecSide == 'UP' and sLocalLockPrf == 'BD' ) ) and sLocalHingeProf ~= sLocalLockPrf then DGD.bBothOppoBevel = true else DGD.bBothOppoBevel = false end else -- determino se ho entrambe profili bevel e diversi tra loro DGD.bBothOppoBevel = ( sLocalLockPrf == 'BU' or sLocalLockPrf == 'BD') and ( sLocalHingeProf == 'BU' or sLocalHingeProf == 'BD') and ( sLocalHingeProf ~= sLocalLockPrf) end -- se porta non inactive e profilo hinge e lock con bevel discordanti emetto warning if not bInactive and DGD.bBothOppoBevel then -- Warning con outbox DoorOutLog( string.format( EgtDoorsMsg[500], DGD.sSwing, DGD.tProfs.hingeedge.trimming, DGD.tProfs.lockedge.trimming), 0) EgtOutBox( string.format(EgtDoorsMsg[500], DGD.sSwing, DGD.tProfs.hingeedge.trimming, DGD.tProfs.lockedge.trimming), EgtDoorsMsg[501], EgtDoorsMsg[502]) end -- verifico congruenza tra presenza di profili bevel ed eventuale parametro 'secure' local sBevelPrf if sLocalHingeProf == 'BU' then sBevelPrf = 'BU' end if not sBevelPrf and sLocalHingeProf == 'BD' then sBevelPrf = 'BD' end if not sBevelPrf and sLocalLockPrf == 'BU' then sBevelPrf = 'BU' end if not sBevelPrf and sLocalLockPrf == 'BD' then sBevelPrf = 'BD' end -- casi di parametri incongruenti ( solo su porta, nei frame il secure è sempre DN) if DGD.sSecSide and sBevelPrf then -- se profilo bevel e parametro secure esistenti if not DGD.sFrame then if ( DGD.Push and sBevelPrf == 'BU' and DGD.sSecSide == 'UP' and not DGD.bBothOppoBevel) or ( DGD.Push and sBevelPrf == 'BD' and DGD.sSecSide == 'DN' and not DGD.bBothOppoBevel) or ( not DGD.Push and sBevelPrf == 'BU' and DGD.sSecSide == 'DN' and not DGD.bBothOppoBevel) or ( not DGD.Push and sBevelPrf == 'BD' and DGD.sSecSide == 'UP' and not DGD.bBothOppoBevel) then DoorOutLog( string.format( EgtDoorsMsg[544], DGD.sSwing, sBevelPrf, DGD.sSecSide), 0) EgtOutBox( string.format( EgtDoorsMsg[544], DGD.sSwing, sBevelPrf, DGD.sSecSide), EgtDoorsMsg[476], EgtDoorsMsg[477]) return false, 0 end end -- se non c'è il profilo bevel e neppure il secure elseif ( not DGD.sSecSide or #DGD.sSecSide == 0) and not sBevelPrf and DGD.MachEn > 0 then DoorOutLog( EgtDoorsMsg[545], 0) EgtOutBox( EgtDoorsMsg[545], EgtDoorsMsg[476], EgtDoorsMsg[477]) return false, 0 end -- casi di incongruenza per frame: se posizione nel ddf non corrisponde con swing e tipo frame if DGD.sFrame then -- se frame sinistro if nTypePiece == 3 then -- se tipo hinge e lato serratura sinistro o tipo lock e lato serratura destro, incongruenza if ( ( DGD.sFrame == 'H' or DGD.sFrame == 'HE') and DGD.Lock == 'L') or ( ( DGD.sFrame == 'L' or DGD.sFrame == 'LE') and DGD.Lock == 'R') then DoorOutLog( string.format( EgtDoorsMsg[609],EgtDoorsMsg[605], DGD.sFrame, DGD.Lock), 0) EgtOutBox( string.format( EgtDoorsMsg[609], EgtDoorsMsg[605], DGD.sFrame, DGD.Lock), EgtDoorsMsg[476], EgtDoorsMsg[477]) return false, 0 end -- se frame destro elseif nTypePiece == 4 then -- se tipo hinge e lato serratura destro o tipo lock e lato serratura sinistro, incongruenza if ( ( DGD.sFrame == 'H' or DGD.sFrame == 'HE') and DGD.Lock == 'R') or ( ( DGD.sFrame == 'L' or DGD.sFrame == 'LE') and DGD.Lock == 'L') then DoorOutLog( string.format( EgtDoorsMsg[609],EgtDoorsMsg[606], DGD.sFrame, DGD.Lock), 0) EgtOutBox( string.format( EgtDoorsMsg[609], EgtDoorsMsg[606], DGD.sFrame, DGD.Lock), EgtDoorsMsg[476], EgtDoorsMsg[477]) return false, 0 end -- se frame top elseif nTypePiece == 5 then -- se tipo non top incongruenza if DGD.nTypePz ~= 5 then DoorOutLog( string.format( EgtDoorsMsg[609],EgtDoorsMsg[607], DGD.sFrame, '-'), 0) EgtOutBox( string.format( EgtDoorsMsg[609], EgtDoorsMsg[607], DGD.sFrame, '-'), EgtDoorsMsg[476], EgtDoorsMsg[477]) return false, 0 end -- se frame bottom elseif nTypePiece == 6 then -- se tipo non bottom incongruenza if DGD.nTypePz ~= 6 then DoorOutLog( string.format( EgtDoorsMsg[609],EgtDoorsMsg[608], DGD.sFrame, '-'), 0) EgtOutBox( string.format( EgtDoorsMsg[609], EgtDoorsMsg[608], DGD.sFrame, '-'), EgtDoorsMsg[476], EgtDoorsMsg[477]) return false, 0 end end else -- setto la variabile che indica che il top è effettivamente ad angolo e -- il lato piatto è minore della larghezza porta - un delta DGD.Tpa = DGD.tProfs.top.angle and abs(DGD.tProfs.top.angle) >= GEO.EPS_SMALL DGD.Tpa = DGD.Tpa and DGD.tProfs.top.xdeltapos and DGD.tProfs.top.xdeltapos < ( DGD.dW - (2* DGD.dT * TAN3)) -- se porta ad arco o con angolo con probe attivato do errore if ( DGD.tProfs.top.radius or DGD.Tpa) and ( DGD.PROBE > 0 and DGC.NPM == 0) then DoorOutLog( EgtDoorsMsg[628], 0) EgtOutBox( EgtDoorsMsg[628], EgtDoorsMsg[476], EgtDoorsMsg[477]) return false, 0 end end -- setto le variabili profili per edge break (EB) local tEbThProf = {} local sFoundProfEb = '' local sProfName = '' -- verifico (e correggo) se variabile globale per dimensione piano su profilo CV si avvicina alla metà spessore porta if DGC.CVP and DGC.CVP >= ( DGD.dT*0.45) then DGC.CVP = 0 end -- tipo profilo lato sinistro local sLeftType = GetRealEdgeTrimming( 'L') local dRadProf = 0 local dPlnProf = 0 -- se profilo tondo ottengo il raggio per il confronto con lo spessore porta if sLeftType == '1B' then dRadProf = DGC.B1 end if sLeftType == '2B' then dRadProf = DGC.B2 end if sLeftType == '3B' then dRadProf = DGC.B3 end if sLeftType == '4B' then dRadProf = DGC.B4 end if sLeftType == '5B' then dRadProf = DGC.B5 end if sLeftType == '6B' then dRadProf = DGC.B6 end if sLeftType == '7B' then dRadProf = DGC.B7 end if sLeftType == '8B' then dRadProf = DGC.B8 end if sLeftType == 'CV' then dRadProf = DGC.CV end if sLeftType == 'CV' then dPlnProf = DGC.CVP or 0 end local dRadProfL = dRadProf -- se profilo edge break ottengo la tabella con gli spessori dei profili con gli errori per ogni profilo if sLeftType == 'EB' or sLeftType == 'BUEB' or sLeftType == 'BDEB' then tEbThProf = DGC.EB sFoundProfEb = EgtIf( DGD.Lock == 'L', EgtDoorsMsg[519], EgtDoorsMsg[518]) .. ',' .. sFoundProfEb sProfName = sLeftType end if (sLeftType == 'BD' or sLeftType == 'BDEB' or sLeftType == 'BU' or sLeftType == 'BUEB') and not DGD.sFrame then -- se lato sinistro con serratura e senza maniglia e abilitata la funzione -- di inversione automatica bevel sul lato inactive o discordanza tra i due profili, inverto l'inclinazione if DGD.Lock == 'L' and ( DGD.sSwing == 'RHI' or DGD.sSwing == 'RHRI') and ( ( DGD.RevInBv and DGD.RevInBv == 1) or DGD.bBothOppoBevel) then -- inverto il profilo sLeftType = SetInvertEdgeTrimming(sLeftType) end end -- tipo profilo lato destro local sRightType = GetRealEdgeTrimming( 'R') local dRadProfR = 0 local dPlnProfR = 0 -- se profilo tondo ottengo il raggio per il confronto con lo spessore porta if sRightType == '1B' then dRadProfR = DGC.B1 end if sRightType == '2B' then dRadProfR = DGC.B2 end if sRightType == '3B' then dRadProfR = DGC.B3 end if sRightType == '4B' then dRadProfR = DGC.B4 end if sRightType == '5B' then dRadProfR = DGC.B5 end if sRightType == '6B' then dRadProfR = DGC.B6 end if sRightType == '7B' then dRadProfR = DGC.B7 end if sRightType == '8B' then dRadProfR = DGC.B8 end if sRightType == 'CV' then dRadProfR = DGC.CV end if sRightType == 'CV' then dPlnProfR = DGC.CVP or 0 end -- se profilo edge break ottengo la tabella con gli spessori dei profili con gli errori per ogni profilo if sRightType == 'EB' or sRightType == 'BUEB' or sRightType == 'BDEB' then tEbThProf = DGC.EB sFoundProfEb = EgtIf( DGD.Lock == 'L', EgtDoorsMsg[518], EgtDoorsMsg[519]) .. ',' .. sFoundProfEb sProfName = sRightType end if ( sRightType == 'BD' or sRightType == 'BDEB' or sRightType == 'BU' or sRightType == 'BUEB') and not DGD.sFrame then -- se lato destro con serratura e senza maniglia e abilitata la funzione -- di inversione automatica bevel sul lato inactive o discordanza tra i due profili, inverto l'inclinazione if DGD.Lock == 'R' and ( DGD.sSwing == 'LHI' or DGD.sSwing == 'LHRI') and ( ( DGD.RevInBv and DGD.RevInBv == 1) or DGD.bBothOppoBevel) then -- inverto il profilo sRightType = SetInvertEdgeTrimming(sRightType) end end -- tipo profilo lato top local sTopType = GetRealEdgeTrimming( 'T') local dRadProfT = 0 local dPlnProfT = 0 -- se profilo tondo ottengo il raggio per il confronto con lo spessore porta if sTopType == '1B' then dRadProfT = DGC.B1 end if sTopType == '2B' then dRadProfT = DGC.B2 end if sTopType == '3B' then dRadProfT = DGC.B3 end if sTopType == '4B' then dRadProfT = DGC.B4 end if sTopType == '5B' then dRadProfT = DGC.B5 end if sTopType == '6B' then dRadProfT = DGC.B6 end if sTopType == '7B' then dRadProfT = DGC.B7 end if sTopType == '8B' then dRadProfT = DGC.B8 end if sTopType == 'CV' then dRadProfT = DGC.CV end if sTopType == 'CV' then dPlnProfT = DGC.CVP or 0 end -- se profilo edge break ottengo la tabella con gli spessori dei profili con gli errori per ogni profilo if sTopType == 'EB' or sTopType == 'BUEB' or sTopType == 'BDEB' then tEbThProf = DGC.EB sFoundProfEb = EgtDoorsMsg[607] .. ',' .. sFoundProfEb sProfName = sTopType end -- tipo profilo lato bottom local sBotType = GetRealEdgeTrimming( 'B') local dRadProfB = 0 local dPlnProfB = 0 -- se profilo tondo ottengo il raggio per il confronto con lo spessore porta if sBotType == '1B' then dRadProfB = DGC.B1 end if sBotType == '2B' then dRadProfB = DGC.B2 end if sBotType == '3B' then dRadProfB = DGC.B3 end if sBotType == '4B' then dRadProfB = DGC.B4 end if sBotType == '5B' then dRadProfB = DGC.B5 end if sBotType == '6B' then dRadProfB = DGC.B6 end if sBotType == '7B' then dRadProfB = DGC.B7 end if sBotType == '8B' then dRadProfB = DGC.B8 end if sBotType == 'CV' then dRadProfB = DGC.CV end if sBotType == 'CV' then dPlnProfB = DGC.CVP or 0 end -- se profilo edge break ottengo la tabella con gli spessori dei profili con gli errori per ogni profilo if sBotType == 'EB' or sTopType == 'BUEB' or sTopType == 'BDEB' then tEbThProf = DGC.EB sFoundProfEb = EgtDoorsMsg[644] .. ',' .. sFoundProfEb sProfName = sBotType end ------------------------------------------------------------------------------ -- verifica se il profilo EB è stato configurato nel file CurrDoorsCustomData ------------------------------------------------------------------------------ if not tEbThProf and #sFoundProfEb > 0 then local sErrMess = string.format( EgtDoorsMsg[667], sProfName, sFoundProfEb) return false, 2, sErrMess end ------------------------------------------------------------------------------ -- verifica del profilo EB nei lati destro, sinistro, sopra e sotto -- in caso lo spessore è compatibile con uno dei profili, viene ridefinito anche -- il valore della variabile di massimo errore ammesso sullo spessore tastato: DGC.Dt ------------------------------------------------------------------------------ -- se ho un profilo edge break (EB) verifico se gli spessori profili sono congruenti con lo spessore porta if #tEbThProf > 0 then local bMatchprofile if #DGD.EBP > 0 then -- se ho già settato la compatibilità di profilo, evito di ricalcolarla bMatchprofile = true else for i = 1, #tEbThProf do -- se lo spessore porta è compreso tra lo spessore profilo + o - la tolleranza esco con match a true if DGD.dT <= ( tEbThProf[i][1] + tEbThProf[i][2]) and DGD.dT >= ( tEbThProf[i][1] - tEbThProf[i][2]) then bMatchprofile = true DGD.EBP = string.format( '%s', i) -- setto la variabile globale con il numero profilo congruente -- reinizializzo la variabile di errore massimo in tastatura dello spessore if not DGD.sFrame and DGD.PROBE == 2 then DGC.Dt = tEbThProf[i][2] end break end end end if not bMatchprofile then local sListThProf = '(' for i = 1, #tEbThProf do sListThProf = sListThProf .. string.format( EgtDoorsMsg[642], i, EgtToUiUnits(tEbThProf[i][1])) .. ',' end sListThProf = sListThProf .. ')' local sErrMess = string.format( EgtDoorsMsg[643], sProfName, sFoundProfEb, EgtToUiUnits(DGD.dT), sProfName, sListThProf) return false, 2, sErrMess end end -- se non è un frame e la tabella è completa, ricreo pezzo porta if not DGD.sFrame and DGD.PROBE == 2 then -- ricostruisco la geometria porta dai punti tastati local dLungMax, dLarghMax = RemakeDoor( sLeftType, dRadProf, sRightType, dRadProfR, dPlnProf, dPlnProfR) bRemake = true -- setto il flag per indicare che la funzione RemakeDoor è stata fatta -- verifico se le dimensioni ricavate differiscono molto dalle dimensioni originarie if ( abs( dLungMax - DGD.dH) > DGC.Dh) or ( abs( dLarghMax - DGD.dW) > DGC.Dw) or ( abs( tProbeDoor.PZ - DGD.dT) > DGC.Dt) then DoorOutLog( string.format( EgtDoorsMsg[629], EgtNumToString( EgtToUiUnits(dLungMax), 4), EgtNumToString( EgtToUiUnits(dLarghMax), 4), EgtNumToString( EgtToUiUnits(tProbeDoor.PZ), 4), EgtToUiUnits(DGC.Dh), EgtToUiUnits(DGC.Dw), EgtToUiUnits(DGC.Dt), EgtToUiUnits(DGD.dH), EgtToUiUnits(DGD.dW), EgtToUiUnits(DGD.dT)), 0) EgtOutBox( string.format( EgtDoorsMsg[629], EgtNumToString( EgtToUiUnits(dLungMax), 4), EgtNumToString( EgtToUiUnits(dLarghMax), 4), EgtNumToString( EgtToUiUnits(tProbeDoor.PZ), 4), EgtToUiUnits(DGC.Dh), EgtToUiUnits(DGC.Dw), EgtToUiUnits(DGC.Dt), EgtToUiUnits(DGD.dH), EgtToUiUnits(DGD.dW), EgtToUiUnits(DGD.dT)), EgtDoorsMsg[476], EgtDoorsMsg[477]) return false, 1 else -- altrimenti le dimensioni accettate, scrivo le note con le dimensioni calcolate EgtSetInfo( DGD.PZ, 'ProbeDoorWidth', EgtToUiUnits(dLarghMax)) EgtSetInfo( DGD.PZ, 'ProbeDoorHeight', EgtToUiUnits(dLungMax)) EgtSetInfo( DGD.PZ, 'ProbeDoorThick', EgtToUiUnits(tProbeDoor.PZ)) end end ----------------- -- lato sinistro ----------------- -- assegno a variabile globale if DGD.Lock == 'R' then DGD.RPH = dRadProf DGD.PPH = dPlnProf DGD.RPL = dRadProfR DGD.PPL = dPlnProfR end -- verifico se lo spessore porta è congruente con il raggio profilo if dRadProf > 0 then if ( DGD.dT - (2*dPlnProf)) > (2*dRadProf) then DoorOutLog( string.format( EgtDoorsMsg[433], ( DGD.dT - (2*dPlnProf)), sLeftType, dRadProf), 0) return false, 0 end end if sLeftType == 'SQ' or sLeftType == 'EB' or sLeftType == 'FDWC' then if DGD.sFrame then if nTypePiece == 3 or nTypePiece == 5 then -- se frame SX o TOP DGD.Ulb = DGD.dT DGD.Urb = DGD.dT DGD.Ult = DGD.dT DGD.Urt = DGD.dT elseif nTypePiece == 4 or nTypePiece == 6 then -- se frame DX o BOTTOM DGD.Drb = 0 DGD.Dlb = 0 DGD.Drt = 0 DGD.Dlt = 0 end else if DGD.PROBE == 2 and bRemake then DGD.Lut = DGD.P7:getX() DGD.Lub = DGD.P1:getX() DGD.Ldt = DGD.P10:getX() DGD.Ldb = DGD.P4:getX() else DGD.Lut = 0 DGD.Lub = 0 DGD.Ldt = 0 DGD.Ldb = 0 end end elseif sLeftType == 'BD' or sLeftType == 'BU' or sLeftType == 'BDEB' or sLeftType == 'BUEB'then if DGD.sFrame then -- se frame left e BD if ( nTypePiece == 3 and ( sLeftType == 'BD' or sLeftType == 'BDEB')) then DGD.Ulb = DGD.dT - ( DGD.dW * TAN3) DGD.Ult = DGD.Ulb DGD.Urb = DGD.dT DGD.Urt = DGD.dT -- se frame left e BU elseif ( nTypePiece == 3 and ( sLeftType == 'BU' or sLeftType == 'BUEB')) then DGD.Urb = DGD.dT - ( DGD.dW * TAN3) DGD.Urt = DGD.Urb DGD.Ulb = DGD.dT DGD.Ult = DGD.dT -- se frame right e BD elseif ( nTypePiece == 4 and ( sLeftType == 'BD' or sLeftType == 'BDEB')) then DGD.Dlb = 0 DGD.Dlt = 0 DGD.Drb = ( DGD.dW * TAN3) DGD.Drt = DGD.Drb -- se frame right e BU elseif ( nTypePiece == 4 and ( sLeftType == 'BU' or sLeftType == 'BUEB')) then DGD.Drb = 0 DGD.Drt = 0 DGD.Dlb = ( DGD.dW * TAN3) DGD.Dlt = DGD.Dlb elseif nTypePiece == 5 then -- se frame top if sLeftType == 'BD' or sLeftType == 'BDEB' then DGD.Ulb = DGD.dT DGD.Urb = DGD.dT DGD.Ult = DGD.dT - ( DGD.dH * TAN3) DGD.Urt = DGD.Ult elseif sLeftType == 'BU' or sLeftType == 'BUEB' then DGD.Ulb = DGD.dT - ( DGD.dH * TAN3) DGD.Urb = DGD.Ulb DGD.Ult = DGD.dT DGD.Urt = DGD.dT end elseif nTypePiece == 6 then -- se frame bottom if sLeftType == 'BD' or sLeftType == 'BDEB' then DGD.Drb = ( DGD.dH * TAN3) DGD.Dlb = DGD.Drb DGD.Drt = 0 DGD.Dlt = 0 elseif sLeftType == 'BU' or sLeftType == 'BUEB' then DGD.Drb = 0 DGD.Dlb = 0 DGD.Drt = ( DGD.dH * TAN3) DGD.Dlt = DGD.Drt end end else if DGD.PROBE == 2 and bRemake then DGD.Lut = DGD.P7:getX() DGD.Lub = DGD.P1:getX() DGD.Ldt = DGD.P10:getX() DGD.Ldb = DGD.P4:getX() else -- se lato sinistro con serratura e senza maniglia e abilitata la funzione -- di inversione automatica bevel sul lato inactive o discordanza tra i due profili, inverto l'inclinazione if DGD.Lock == 'L' and ( DGD.sSwing == 'RHI' or DGD.sSwing == 'RHRI') and ( ( DGD.RevInBv and DGD.RevInBv == 1) or DGD.bBothOppoBevel) then if DGD.Push then DGD.Lut = 0 DGD.Lub = 0 DGD.Ldt = DGD.dT * TAN3 DGD.Ldb = DGD.Ldt else DGD.Lut = DGD.dT * TAN3 DGD.Lub = DGD.Lut DGD.Ldt = 0 DGD.Ldb = 0 end else -- altrimenti normale if DGD.Push then DGD.Lut = DGD.dT * TAN3 DGD.Lub = DGD.Lut DGD.Ldt = 0 DGD.Ldb = 0 else DGD.Lut = 0 DGD.Lub = 0 DGD.Ldt = DGD.dT * TAN3 DGD.Ldb = DGD.Ldt end end end end elseif sLeftType == '1B' or sLeftType == '2B' or sLeftType == '3B' or sLeftType == '4B' or sLeftType == '5B' or sLeftType == '6B' or sLeftType == '7B' or sLeftType == '8B' then if DGD.PROBE == 2 and bRemake then DGD.Lut = DGD.P7:getX() DGD.Lub = DGD.P1:getX() DGD.Ldt = DGD.P10:getX() DGD.Ldb = DGD.P4:getX() DGD.Lmb = DGD.P5:getX() DGD.Lmt = DGD.P11:getX() else DGD.Lut = dRadProf - sqrt( ( dRadProf * dRadProf) - ((DGD.dT/2)*(DGD.dT/2))) DGD.Lub = DGD.Lut DGD.Ldt = DGD.Lut DGD.Ldb = DGD.Lut DGD.Lm = 0 end elseif sLeftType == 'CV' then if DGD.PROBE == 2 and bRemake then DGD.Lut = DGD.P7:getX() DGD.Lub = DGD.P1:getX() DGD.Ldt = DGD.P10:getX() DGD.Ldb = DGD.P4:getX() DGD.Lmb = DGD.P5:getX() DGD.Lmt = DGD.P11:getX() else DGD.Lut = 0 DGD.Lub = 0 DGD.Ldt = 0 DGD.Ldb = 0 DGD.Lm = dRadProf - sqrt( ( dRadProf * dRadProf) - (((DGD.dT/2)-dPlnProf)*((DGD.dT/2)-dPlnProf))) end end -- setto punti relativi allo spessore SetFrameThickValues( true) ----------------- -- lato destro ----------------- -- assegno a variabile globale if DGD.Lock == 'L' then DGD.RPH = dRadProfR DGD.PPH = dPlnProfR DGD.RPL = dRadProf DGD.PPL = dPlnProf end dRadProf = dRadProfR -- assegno il valore del raggio profilo -- verifico se lo spessore porta è congruente con il raggio profilo if dRadProf > 0 then if ( DGD.dT - (2*dPlnProfR)) > (2*dRadProf) then DoorOutLog( string.format( EgtDoorsMsg[433], ( DGD.dT - (2*dPlnProfR)), sRightType, dRadProf), 0) return false, 0 end end if sRightType == 'SQ' or sRightType == 'EB' or sRightType == 'FDWC' then if DGD.sFrame then if nTypePiece == 3 or nTypePiece == 5 then -- se frame SX o TOP DGD.Drb = 0 DGD.Dlb = 0 DGD.Drt = 0 DGD.Dlt = 0 elseif nTypePiece == 4 or nTypePiece == 6 then -- se frame DX o BOTTOM DGD.Ulb = DGD.dT DGD.Urb = DGD.dT DGD.Ult = DGD.dT DGD.Urt = DGD.dT end else if DGD.PROBE == 2 and bRemake then DGD.Rub = DGD.P2:getX() DGD.Rut = DGD.P8:getX() DGD.Rdb = DGD.P3:getX() DGD.Rdt = DGD.P9:getX() else DGD.Rub = DGD.dW DGD.Rut = DGD.dW DGD.Rdb = DGD.dW DGD.Rdt = DGD.dW end end elseif sRightType == 'BD' or sRightType == 'BU' or sRightType == 'BDEB' or sRightType == 'BUEB' then if DGD.sFrame then -- se frame left e BD if ( nTypePiece == 3 and ( sRightType == 'BD' or sRightType == 'BDEB')) then DGD.Dlb = ( DGD.dW * TAN3) DGD.Dlt = DGD.Dlb DGD.Drb = 0 DGD.Drt = 0 -- se frame left e BU elseif ( nTypePiece == 3 and ( sLeftType == 'BU' or sLeftType == 'BUEB')) then DGD.Drb = ( DGD.dW * TAN3) DGD.Drt = DGD.Drb DGD.Dlb = 0 DGD.Dlt = 0 -- se frame right e BU elseif ( nTypePiece == 4 and ( sRightType == 'BU' or sRightType == 'BUEB')) then DGD.Ulb = DGD.dT - ( DGD.dW * TAN3) DGD.Ult = DGD.Ulb DGD.Urb = DGD.dT DGD.Urt = DGD.dT -- se frame right e BD elseif ( nTypePiece == 4 and ( sRightType == 'BD' or sRightType == 'BDEB')) then DGD.Urb = DGD.dT - ( DGD.dW * TAN3) DGD.Urt = DGD.Urb DGD.Ulb = DGD.dT DGD.Ult = DGD.dT elseif nTypePiece == 5 then -- se frame top if sRightType == 'BD' or sRightType == 'BDEB' then DGD.Dlb = 0 DGD.Drb = 0 DGD.Dlt = ( DGD.dH * TAN3) DGD.Drt = DGD.Dlt elseif sRightType == 'BU' or sRightType == 'BUEB'then DGD.Dlb = ( DGD.dH * TAN3) DGD.Drb = DGD.Dlb DGD.Dlt = 0 DGD.Drt = 0 end elseif nTypePiece == 6 then -- se frame bottom if sRightType == 'BD' or sRightType == 'BDEB' then DGD.Urb = DGD.dT - ( DGD.dH * TAN3) DGD.Ulb = DGD.Urb DGD.Urt = DGD.dT DGD.Ult = DGD.dT elseif sRightType == 'BU' or sRightType == 'BUEB' then DGD.Urb = DGD.dT DGD.Ulb = DGD.dT DGD.Urt = DGD.dT - ( DGD.dH * TAN3) DGD.Ult = DGD.Urt end end else if DGD.PROBE == 2 and bRemake then DGD.Rub = DGD.P2:getX() DGD.Rut = DGD.P8:getX() DGD.Rdb = DGD.P3:getX() DGD.Rdt = DGD.P9:getX() else -- se lato destro con serratura e senza maniglia e abilitata la funzione -- di inversione automatica bevel sul lato inactive o discordanza tra i due profili, inverto l'inclinazione if DGD.Lock == 'R' and ( DGD.sSwing == 'LHI' or DGD.sSwing == 'LHRI') and ( ( DGD.RevInBv and DGD.RevInBv == 1) or DGD.bBothOppoBevel) then if DGD.Push then DGD.Rut = DGD.dW DGD.Rub = DGD.dW DGD.Rdt = DGD.dW - ( DGD.dT * TAN3) DGD.Rdb = DGD.Rdt else DGD.Rut = DGD.dW - ( DGD.dT * TAN3) DGD.Rub = DGD.Rut DGD.Rdt = DGD.dW DGD.Rdb = DGD.dW end else -- altrimenti normale if DGD.Push then DGD.Rut = DGD.dW - ( DGD.dT * TAN3) DGD.Rub = DGD.Rut DGD.Rdt = DGD.dW DGD.Rdb = DGD.dW else DGD.Rut = DGD.dW DGD.Rub = DGD.dW DGD.Rdt = DGD.dW - ( DGD.dT * TAN3) DGD.Rdb = DGD.Rdt end end end end elseif sRightType == '1B' or sRightType == '2B' or sRightType == '3B' or sRightType == '4B' or sRightType == '5B' or sRightType == '6B' or sRightType == '7B' or sRightType == '8B' then if DGD.PROBE == 2 and bRemake then DGD.Rub = DGD.P2:getX() DGD.Rut = DGD.P8:getX() DGD.Rdb = DGD.P3:getX() DGD.Rdt = DGD.P9:getX() DGD.Rmb = DGD.P6:getX() DGD.Rmt = DGD.P12:getX() else DGD.Rut = DGD.dW - dRadProf + sqrt( ( dRadProf * dRadProf) - ((DGD.dT/2)*(DGD.dT/2))) DGD.Rub = DGD.Rut DGD.Rdt = DGD.Rut DGD.Rdb = DGD.Rut DGD.Rm = DGD.dW end elseif sRightType == 'CV' then if DGD.PROBE == 2 and bRemake then DGD.Rub = DGD.P2:getX() DGD.Rut = DGD.P8:getX() DGD.Rdb = DGD.P3:getX() DGD.Rdt = DGD.P9:getX() DGD.Rmb = DGD.P6:getX() DGD.Rmt = DGD.P12:getX() else DGD.Rut = DGD.dW DGD.Rub = DGD.dW DGD.Rdt = DGD.dW DGD.Rdb = DGD.dW DGD.Rm = DGD.dW + sqrt( ( dRadProf * dRadProf) - (((DGD.dT/2)-dPlnProfR)*((DGD.dT/2)-dPlnProfR))) - dRadProf end end -- setto punti relativi allo spessore SetFrameThickValues() ----------------- -- lato top ----------------- dRadProf = dRadProfT -- setto il valore del raggio profilo -- assegno a variabile globale DGD.RPT = dRadProf DGD.PPT = dPlnProfT -- verifico se lo spessore porta è congruente con il raggio profilo if dRadProf > 0 then if ( DGD.dT - (2*dPlnProfT)) > (2*dRadProf) then DoorOutLog( string.format( EgtDoorsMsg[433], ( DGD.dT - (2*dPlnProfT)), sRightType, dRadProf), 0) return false, 0 end end -- Nei frame top e bottom sempre SQ o FDWC if DGD.sFrame then if nTypePiece == 3 or nTypePiece == 4 then -- se frame SX o DX DGD.Bul = 0 DGD.Bur = 0 DGD.Bdl = 0 DGD.Bdr = 0 DGD.Tul = DGD.dH DGD.Tur = DGD.dH DGD.Tdl = DGD.dH DGD.Tdr = DGD.dH elseif nTypePiece == 5 or nTypePiece == 6 then -- se frame TOP o BOTTOM DGD.Lut = 0 DGD.Lub = 0 DGD.Ldt = 0 DGD.Ldb = 0 DGD.Rut = DGD.dW DGD.Rub = DGD.dW DGD.Rdt = DGD.dW DGD.Rdb = DGD.dW end else if DGD.PROBE == 2 and bRemake then DGD.Bul = DGD.P1:getY() DGD.Bur = DGD.P2:getY() DGD.Bdl = DGD.P4:getY() DGD.Bdr = DGD.P3:getY() DGD.Bml = DGD.P5:getY() DGD.Bmr = DGD.P6:getY() DGD.Tul = DGD.P7:getY() DGD.Tur = DGD.P8:getY() DGD.Tdl = DGD.P10:getY() DGD.Tdr = DGD.P9:getY() DGD.Tml = DGD.P11:getY() DGD.Tmr = DGD.P12:getY() else if sTopType == 'SQ' or sTopType == 'EB' or sTopType == 'FDWC' then DGD.Tul = DGD.dH DGD.Tur = DGD.dH DGD.Tdl = DGD.dH DGD.Tdr = DGD.dH DGD.Tml = DGD.dH DGD.Tmr = DGD.dH elseif sTopType == 'BD' or sTopType == 'BU' or sTopType == 'BDEB' or sTopType == 'BUEB' then if DGD.Push then DGD.Tul = DGD.dH - ( DGD.dT * TAN3) DGD.Tur = DGD.Tul DGD.Tdl = DGD.dH DGD.Tdr = DGD.dH DGD.Tml = DGD.dH - ( DGD.dT * TAN3)/2 DGD.Tmr = DGD.Tml else DGD.Tul = DGD.dH DGD.Tur = DGD.dH DGD.Tdl = DGD.dH - ( DGD.dT * TAN3) DGD.Tdr = DGD.Tdl DGD.Tml = DGD.dH - ( DGD.dT * TAN3)/2 DGD.Tmr = DGD.Tml end elseif sTopType == '1B' or sTopType == '2B' or sTopType == '3B' or sTopType == '4B' or sTopType == '5B' or sTopType == '6B' or sTopType == '7B' or sTopType == '8B' then DGD.Tul = DGD.dH - dRadProf + sqrt( ( dRadProf * dRadProf) - ((DGD.dT/2)*(DGD.dT/2))) DGD.Tur = DGD.Tul DGD.Tdl = DGD.Tul DGD.Tdr = DGD.Tul DGD.Tml = DGD.dH DGD.Tmr = DGD.dH elseif sTopType == 'CV' then DGD.Tul = DGD.dH DGD.Tur = DGD.dH DGD.Tdl = DGD.dH DGD.Tdr = DGD.dH DGD.Tml = DGD.dH - dRadProf + sqrt( ( dRadProf * dRadProf) - (((DGD.dT/2)-dPlnProfT)*((DGD.dT/2)-dPlnProfT))) DGD.Tmr = DGD.Tml end -- se top è ad arco if DGD.tProfs.top.radius then if not DGD.tProfs.top.xdeltapos then DGD.tProfs.top.xdeltapos = 0 end -- calcolo il delta y dell'arco -- se centro arco è compreso nella larghezza porta if abs(DGD.tProfs.top.xdeltapos) <= (DGD.dW/2) then DGD.tProfs.top.ydeltapos = DGD.tProfs.top.radius else -- altrimenti è esterno DGD.tProfs.top.ydeltapos = CalcSideRectTringle( ((DGD.dW/2) - abs(DGD.tProfs.top.xdeltapos)), nil, DGD.tProfs.top.radius) end -- verifico se ho una tangenza con l'arco if abs( abs(DGD.tProfs.top.xdeltapos) + (DGD.dW/2) - DGD.tProfs.top.radius) <= GEO.EPS_SMALL then if DGD.tProfs.top.xdeltapos < 0 then -- se centro arco verso X- la tangenza è a destra DGD.TPR = DGD.dH-DGD.tProfs.top.ydeltapos elseif DGD.tProfs.top.xdeltapos > 0 then -- se centro arco verso X+ la tangenza è a sinistra DGD.TPL = DGD.dH-DGD.tProfs.top.ydeltapos else -- entrambe le tangenze DGD.TPR = DGD.dH-DGD.tProfs.top.ydeltapos DGD.TPL = DGD.TPR end end if sTopType == 'SQ' or sTopType == 'EB' or sTopType == 'FDWC' then -- se top con profilo diritto prendo i valori dai fianchi DGD.Rua = DGD.Rut DGD.Rda = DGD.Rdt DGD.Rma = DGD.Rm DGD.Lua = DGD.Lut DGD.Lda = DGD.Ldt DGD.Lma = DGD.Lm elseif sTopType == 'BD' or sTopType == 'BDEB' then -- se la quota X dell'arco è interna al fianco tengo quella dell'arco if DGD.dW - DGD.Rut >= GEO.EPS_SMALL then DGD.Rua = DGD.Rut else DGD.Rua = DGD.dW end if DGD.Rdt <= (DGD.dW - ( DGD.dT * TAN3)) then DGD.Rda = DGD.Rdt else if not DGD.TPR then if sRightType == 'CV' or sRightType == 'SQ' or sRightType == 'EB' or sRightType == 'FDWC' then DGD.Rda = DGD.dW else DGD.Rda = DGD.dW - ( DGD.dT * TAN3) end else DGD.Rda = DGD.dW - ( DGD.dT * TAN3) end end if DGD.Lut >= GEO.EPS_SMALL then DGD.Lua = DGD.Lut else DGD.Lua = 0 end if DGD.Ldt >= ( DGD.dT * TAN3) then DGD.Lda = DGD.Ldt else if not DGD.TPL then if sLeftType == 'CV' or sLeftType == 'SQ' or sLeftType == 'EB' or sLeftType == 'FDWC' then DGD.Lda = 0 else DGD.Lda = ( DGD.dT * TAN3) end else DGD.Lda = ( DGD.dT * TAN3) end end elseif sTopType == 'BU' or sTopType == 'BUEB' then if DGD.Rut <= (DGD.dW - ( DGD.dT * TAN3)) then DGD.Rua = DGD.Rut else if not DGD.TPR then if sRightType == 'CV' or sRightType == 'SQ' or sRightType == 'EB' or sRightType == 'FDWC' then DGD.Rua = DGD.dW else DGD.Rua = DGD.dW - ( DGD.dT * TAN3) end else DGD.Rua = DGD.dW - ( DGD.dT * TAN3) end end if DGD.Rdt <= DGD.dW then DGD.Rda = DGD.Rdt else DGD.Rda = DGD.dW end if DGD.Lut >= ( DGD.dT * TAN3) then DGD.Lua = DGD.Lut else if not DGD.TPL then if sLeftType == 'CV' or sLeftType == 'SQ' or sLeftType == 'EB' or sLeftType == 'FDWC' then DGD.Lua = 0 else DGD.Lua = ( DGD.dT * TAN3) end else DGD.Lua = ( DGD.dT * TAN3) end end if DGD.Ldt >= 0 then DGD.Lda = DGD.Ldt else DGD.Lda = 0 end elseif sTopType == '1B' or sTopType == '2B' or sTopType == '3B' or sTopType == '4B' or sTopType == '5B' or sTopType == '6B' or sTopType == '7B' or sTopType == '8B' then if DGD.Rut <= (DGD.dW - ( dRadProf + sqrt( ( dRadProf * dRadProf) - ((DGD.dT/2)*(DGD.dT/2))))) then DGD.Rua = DGD.Rut else DGD.Rua = DGD.dW - dRadProf + sqrt( ( dRadProf * dRadProf) - ((DGD.dT/2)*(DGD.dT/2))) end if DGD.Rdt <= (DGD.dW - ( dRadProf + sqrt( ( dRadProf * dRadProf) - ((DGD.dT/2)*(DGD.dT/2))))) then DGD.Rda = DGD.Rdt else DGD.Rda = DGD.dW - dRadProf + sqrt( ( dRadProf * dRadProf) - ((DGD.dT/2)*(DGD.dT/2))) end DGD.Rma = DGD.dW if DGD.Lut >= ( dRadProf - sqrt( ( dRadProf * dRadProf) - ((DGD.dT/2)*(DGD.dT/2)))) then DGD.Lua = DGD.Lut else DGD.Lua = dRadProf - sqrt( ( dRadProf * dRadProf) - ((DGD.dT/2)*(DGD.dT/2))) end if DGD.Ldt >= ( dRadProf - sqrt( ( dRadProf * dRadProf) - ((DGD.dT/2)*(DGD.dT/2)))) then DGD.Lda = DGD.Ldt else DGD.Lda = dRadProf - sqrt( ( dRadProf * dRadProf) - ((DGD.dT/2)*(DGD.dT/2))) end DGD.Lma = 0 elseif sTopType == 'CV' then if DGD.dW - DGD.Rut >= GEO.EPS_SMALL then DGD.Rua = DGD.Rut else DGD.Rua = DGD.dW end if DGD.dW - DGD.Rdt >= GEO.EPS_SMALL then DGD.Rda = DGD.Rdt else DGD.Rda = DGD.dW end DGD.Rma = DGD.dW - dRadProf + sqrt( ( dRadProf * dRadProf) - (((DGD.dT/2)-dPlnProfT)*((DGD.dT/2)-dPlnProfT))) if DGD.Lut >= GEO.EPS_SMALL then DGD.Lua = DGD.Lut else DGD.Lua = 0 end if DGD.Ldt >= GEO.EPS_SMALL then DGD.Lda = DGD.Ldt else DGD.Lda = 0 end DGD.Lma = dRadProf - sqrt( ( dRadProf * dRadProf) - (((DGD.dT/2)-dPlnProfT)*((DGD.dT/2)-dPlnProfT))) end local dDistRad = 0 local dDistRadCv = 0 if sTopType == 'BD' or sTopType == 'BDEB' then -- se top bevel down DGD.Adt = ( DGD.dT * TAN3) DGD.Amt = DGD.Adt / 2 elseif sTopType == 'BU' or sTopType == 'BUEB' then DGD.Aut = ( DGD.dT * TAN3) DGD.Amt = DGD.Aut / 2 elseif sTopType == 'CV' then dDistRadCv = dRadProf - sqrt( ( dRadProf * dRadProf) - (((DGD.dT/2)-dPlnProfT)*((DGD.dT/2)-dPlnProfT))) elseif sTopType == '1B' or sTopType == '2B' or sTopType == '3B' or sTopType == '4B' or sTopType == '5B' or sTopType == '6B' or sTopType == '7B' or sTopType == '8B' then dDistRad = dRadProf - sqrt( ( dRadProf * dRadProf) - ((DGD.dT/2)*(DGD.dT/2))) end -- valori x max arco DGD.LMa = 0 DGD.RMa = DGD.dW -- valori x min arco DGD.lma = dDistRadCv + (DGD.Amt*2) DGD.rma = DGD.dW - dDistRadCv - (DGD.Amt*2) -- valori in Z arco DGD.Ula = DGD.dT DGD.Ura = DGD.dT DGD.Dra = 0 DGD.Dla = 0 DGD.Mla = DGD.dT / 2 DGD.Mra = DGD.dT / 2 -- se centro arco è compreso nella larghezza porta if abs(DGD.tProfs.top.xdeltapos) <= (DGD.dW/2) then DGD.Aul = DGD.dH - DGD.tProfs.top.radius + CalcSideRectTringle( ((DGD.dW/2) + DGD.tProfs.top.xdeltapos - DGD.Lua), nil, ( DGD.tProfs.top.radius - DGD.Aut-dDistRad)) DGD.Adl = DGD.dH - DGD.tProfs.top.radius + CalcSideRectTringle( ((DGD.dW/2) + DGD.tProfs.top.xdeltapos - DGD.Lda), nil, ( DGD.tProfs.top.radius - DGD.Adt-dDistRad)) DGD.Aur = DGD.dH - DGD.tProfs.top.radius + CalcSideRectTringle( ((DGD.dW/2) - DGD.tProfs.top.xdeltapos - (DGD.dW - DGD.Rua)), nil, ( DGD.tProfs.top.radius - DGD.Aut-dDistRad)) DGD.Adr = DGD.dH - DGD.tProfs.top.radius + CalcSideRectTringle( ((DGD.dW/2) - DGD.tProfs.top.xdeltapos - (DGD.dW - DGD.Rda)), nil, ( DGD.tProfs.top.radius - DGD.Adt-dDistRad)) DGD.Aml = DGD.dH - DGD.tProfs.top.radius + CalcSideRectTringle( ((DGD.dW/2) + DGD.tProfs.top.xdeltapos - DGD.Lma), nil, ( DGD.tProfs.top.radius - DGD.Amt-dDistRad)) DGD.Amr = DGD.dH - DGD.tProfs.top.radius + CalcSideRectTringle( ((DGD.dW/2) - DGD.tProfs.top.xdeltapos - (DGD.dW - DGD.Rma)), nil, ( DGD.tProfs.top.radius - DGD.Amt-dDistRad)) -- punti con ingombro max DGD.AMl = DGD.dH - DGD.tProfs.top.radius + CalcSideRectTringle( ((DGD.dW/2) + DGD.tProfs.top.xdeltapos - DGD.LMa), nil, DGD.tProfs.top.radius) DGD.AMr = DGD.dH - DGD.tProfs.top.radius + CalcSideRectTringle( ((DGD.dW/2) - DGD.tProfs.top.xdeltapos - (DGD.dW - DGD.RMa)), nil, DGD.tProfs.top.radius) -- punti con ingombro min per profilo CV DGD.aml = DGD.dH - DGD.tProfs.top.radius + CalcSideRectTringle( ((DGD.dW/2) + DGD.tProfs.top.xdeltapos - DGD.lma), nil, ( DGD.tProfs.top.radius - dDistRadCv - (DGD.Amt*2))) DGD.amr = DGD.dH - DGD.tProfs.top.radius + CalcSideRectTringle( ((DGD.dW/2) - DGD.tProfs.top.xdeltapos - (DGD.dW - DGD.rma)), nil, ( DGD.tProfs.top.radius - dDistRadCv - (DGD.Amt*2))) else -- altrimenti è esterno if DGD.tProfs.top.xdeltapos > 0 then -- se centro arco è a destra DGD.Aul = DGD.dH - DGD.tProfs.top.ydeltapos + CalcSideRectTringle( ((DGD.dW/2) + abs(DGD.tProfs.top.xdeltapos) - DGD.Lua), nil, ( DGD.tProfs.top.radius - DGD.Aut-dDistRad)) DGD.Adl = DGD.dH - DGD.tProfs.top.ydeltapos + CalcSideRectTringle( ((DGD.dW/2) + abs(DGD.tProfs.top.xdeltapos) - DGD.Lda), nil, ( DGD.tProfs.top.radius - DGD.Adt-dDistRad)) DGD.Aur = DGD.dH - DGD.tProfs.top.ydeltapos + CalcSideRectTringle( ((DGD.dW/2) - abs(DGD.tProfs.top.xdeltapos) - (DGD.dW - DGD.Rua)), nil, ( DGD.tProfs.top.radius - DGD.Aut-dDistRad)) DGD.Adr = DGD.dH - DGD.tProfs.top.ydeltapos + CalcSideRectTringle( ((DGD.dW/2) - abs(DGD.tProfs.top.xdeltapos) - (DGD.dW - DGD.Rda)), nil, ( DGD.tProfs.top.radius - DGD.Adt-dDistRad)) DGD.Aml = DGD.dH - DGD.tProfs.top.ydeltapos + CalcSideRectTringle( ((DGD.dW/2) + abs(DGD.tProfs.top.xdeltapos) - DGD.Lma), nil, ( DGD.tProfs.top.radius - DGD.Amt-dDistRad)) DGD.Amr = DGD.dH - DGD.tProfs.top.ydeltapos + CalcSideRectTringle( ((DGD.dW/2) - abs(DGD.tProfs.top.xdeltapos) - (DGD.dW - DGD.Rma)), nil, ( DGD.tProfs.top.radius - DGD.Amt-dDistRad)) -- punti con ingombro max DGD.AMl = DGD.dH - DGD.tProfs.top.ydeltapos + CalcSideRectTringle( ((DGD.dW/2) + abs(DGD.tProfs.top.xdeltapos) - DGD.LMa), nil, DGD.tProfs.top.radius) DGD.AMr = DGD.dH - DGD.tProfs.top.ydeltapos + CalcSideRectTringle( ((DGD.dW/2) - abs(DGD.tProfs.top.xdeltapos) - (DGD.dW - DGD.RMa)), nil, DGD.tProfs.top.radius) -- punti con ingombro min per profilo CV DGD.aml = DGD.dH - DGD.tProfs.top.ydeltapos + CalcSideRectTringle( ((DGD.dW/2) + abs(DGD.tProfs.top.xdeltapos) - DGD.lma), nil, ( DGD.tProfs.top.radius - dDistRadCv - (DGD.Amt*2))) DGD.amr = DGD.dH - DGD.tProfs.top.ydeltapos + CalcSideRectTringle( ((DGD.dW/2) - abs(DGD.tProfs.top.xdeltapos) - (DGD.dW - DGD.rma)), nil, ( DGD.tProfs.top.radius - dDistRadCv - (DGD.Amt*2))) else -- altrimenti centro arco è a sinistra DGD.Aul = DGD.dH - DGD.tProfs.top.ydeltapos + CalcSideRectTringle( ((DGD.dW/2) - abs(DGD.tProfs.top.xdeltapos) - DGD.Lua), nil, ( DGD.tProfs.top.radius - DGD.Aut-dDistRad)) DGD.Adl = DGD.dH - DGD.tProfs.top.ydeltapos + CalcSideRectTringle( ((DGD.dW/2) - abs(DGD.tProfs.top.xdeltapos) - DGD.Lda), nil, ( DGD.tProfs.top.radius - DGD.Adt-dDistRad)) DGD.Aur = DGD.dH - DGD.tProfs.top.ydeltapos + CalcSideRectTringle( ((DGD.dW/2) + abs(DGD.tProfs.top.xdeltapos) - (DGD.dW - DGD.Rua)), nil, ( DGD.tProfs.top.radius - DGD.Aut-dDistRad)) DGD.Adr = DGD.dH - DGD.tProfs.top.ydeltapos + CalcSideRectTringle( ((DGD.dW/2) + abs(DGD.tProfs.top.xdeltapos) - (DGD.dW - DGD.Rda)), nil, ( DGD.tProfs.top.radius - DGD.Adt-dDistRad)) DGD.Aml = DGD.dH - DGD.tProfs.top.ydeltapos + CalcSideRectTringle( ((DGD.dW/2) - abs(DGD.tProfs.top.xdeltapos) - DGD.Lma), nil, ( DGD.tProfs.top.radius - DGD.Amt-dDistRad)) DGD.Amr = DGD.dH - DGD.tProfs.top.ydeltapos + CalcSideRectTringle( ((DGD.dW/2) + abs(DGD.tProfs.top.xdeltapos) - (DGD.dW - DGD.Rma)), nil, ( DGD.tProfs.top.radius - DGD.Amt-dDistRad)) -- punti con ingombro max DGD.AMl = DGD.dH - DGD.tProfs.top.ydeltapos + CalcSideRectTringle( ((DGD.dW/2) - abs(DGD.tProfs.top.xdeltapos) - DGD.LMa), nil, DGD.tProfs.top.radius) DGD.AMr = DGD.dH - DGD.tProfs.top.ydeltapos + CalcSideRectTringle( ((DGD.dW/2) + abs(DGD.tProfs.top.xdeltapos) - (DGD.dW - DGD.RMa)), nil, DGD.tProfs.top.radius) -- punti con ingombro min per profilo CV DGD.aml = DGD.dH - DGD.tProfs.top.ydeltapos + CalcSideRectTringle( ((DGD.dW/2) - abs(DGD.tProfs.top.xdeltapos) - DGD.lma), nil, ( DGD.tProfs.top.radius - dDistRadCv - (DGD.Amt*2))) DGD.amr = DGD.dH - DGD.tProfs.top.ydeltapos + CalcSideRectTringle( ((DGD.dW/2) + abs(DGD.tProfs.top.xdeltapos) - (DGD.dW - DGD.rma)), nil, ( DGD.tProfs.top.radius - dDistRadCv - (DGD.Amt*2))) end end elseif DGD.Tpa then -- se top ad angolo if not DGD.tProfs.top.xdeltapos then DGD.tProfs.top.xdeltapos = 0 end if DGD.tProfs.top.xdeltapos <= (2* DGD.dT * TAN3) and ( sLeftType == 'BD' or sLeftType == 'BU' or sLeftType == 'BDEB' or sLeftType == 'BUEB') and ( sRightType == 'BD' or sRightType == 'BU' or sRightType == 'BDEB' or sRightType == 'BUEB') then DGD.tProfs.top.xdeltapos = 0 end if sLeftType == 'BD' or sLeftType == 'BU' or sLeftType == 'BDEB' or sLeftType == 'BUEB' or sLeftType == 'SQ' or sLeftType == 'EB' or sLeftType == 'FDWC' then DGD.Lua = DGD.Lut DGD.Lda = DGD.Ldt DGD.Lma = (DGD.Lut + DGD.Ldt) / 2 else DGD.Lua = DGD.Lut DGD.Lda = DGD.Lua DGD.Lma = DGD.Lm end if sRightType == 'BD' or sRightType == 'BU' or sRightType == 'BDEB' or sRightType == 'BUEB' or sRightType == 'SQ' or sRightType == 'EB' or sRightType == 'FDWC' then DGD.Rua = DGD.Rut DGD.Rda = DGD.Rdt DGD.Rma = (DGD.Rut + DGD.Rdt) / 2 else DGD.Rua = DGD.Rut DGD.Rda = DGD.Rua DGD.Rma = DGD.Rm end if sTopType == 'BD' or sTopType == 'BDEB' then -- se top bevel down DGD.Adt = ( DGD.dT * TAN3) DGD.Amt = DGD.Adt / 2 DGD.Dpd = DGD.Adt / abs(cos(DGD.tProfs.top.angle)) elseif sTopType == 'BU' or sTopType == 'BUEB' then DGD.Aut = ( DGD.dT * TAN3) DGD.Amt = DGD.Aut / 2 DGD.Dpu = DGD.Aut / abs(cos(DGD.tProfs.top.angle)) elseif sTopType == '1B' or sTopType == '2B' or sTopType == '3B' or sTopType == '4B' or sTopType == '5B' or sTopType == '6B' or sTopType == '7B' or sTopType == '8B' then DGD.Adt = dRadProf - sqrt( ( dRadProf * dRadProf) - ((DGD.dT/2)*(DGD.dT/2))) DGD.Aut = DGD.Adt DGD.Dpu = DGD.Adt / abs(cos(DGD.tProfs.top.angle)) DGD.Dpd = DGD.Dpu elseif sTopType == 'CV' then DGD.Amt = dRadProf - sqrt( ( dRadProf * dRadProf) - (((DGD.dT/2)-dPlnProfT)*((DGD.dT/2)-dPlnProfT))) DGD.Dpm = DGD.Amt / abs(cos(DGD.tProfs.top.angle)) end DGD.Ula = DGD.dT DGD.Ura = DGD.dT DGD.Dra = 0 DGD.Dla = 0 DGD.Mla = DGD.dT / 2 DGD.Mra = DGD.dT / 2 -- se angolo positivo if DGD.tProfs.top.angle > 0 then DGD.Aul = DGD.dH - (( DGD.dW - DGD.tProfs.top.xdeltapos - DGD.Lua) * tan( DGD.tProfs.top.angle)) - DGD.Dpu DGD.Adl = DGD.dH - (( DGD.dW - DGD.tProfs.top.xdeltapos - DGD.Lda) * tan( DGD.tProfs.top.angle)) - DGD.Dpd DGD.Aur = DGD.dH - EgtIf( DGD.tProfs.top.xdeltapos > 0, DGD.Aut, ((( DGD.dW - DGD.Rua) * tan( DGD.tProfs.top.angle)) + DGD.Dpu)) DGD.Adr = DGD.dH - EgtIf( DGD.tProfs.top.xdeltapos > 0, DGD.Adt, ((( DGD.dW - DGD.Rda) * tan( DGD.tProfs.top.angle)) + DGD.Dpd)) DGD.Aml = DGD.dH - (( DGD.dW - DGD.tProfs.top.xdeltapos - DGD.Lma) * tan( DGD.tProfs.top.angle)) - DGD.Amt DGD.Amr = DGD.dH - EgtIf( DGD.tProfs.top.xdeltapos > 0, DGD.Amt, ((( DGD.dW - DGD.Rma) * tan( DGD.tProfs.top.angle)) + DGD.Dpm)) else DGD.Aul = DGD.dH - EgtIf( DGD.tProfs.top.xdeltapos > 0, DGD.Aut, (( DGD.Lua * tan( abs(DGD.tProfs.top.angle))) + DGD.Dpu)) DGD.Adl = DGD.dH - EgtIf( DGD.tProfs.top.xdeltapos > 0, DGD.Adt, (( DGD.Lda * tan( abs(DGD.tProfs.top.angle))) + DGD.Dpd)) DGD.Aur = DGD.dH - (( DGD.Rua - DGD.tProfs.top.xdeltapos) * tan( abs(DGD.tProfs.top.angle))) - DGD.Dpu DGD.Adr = DGD.dH - (( DGD.Rda - DGD.tProfs.top.xdeltapos) * tan( abs(DGD.tProfs.top.angle))) - DGD.Dpd DGD.Aml = DGD.dH - EgtIf( DGD.tProfs.top.xdeltapos > 0, DGD.Amt, (( DGD.Lma * tan( abs(DGD.tProfs.top.angle))) + DGD.Dpm)) DGD.Amr = DGD.dH - (( DGD.Rma - DGD.tProfs.top.xdeltapos) * tan( abs(DGD.tProfs.top.angle))) - DGD.Amt end -- punti intersezione curva sopra if DGD.tProfs.top.xdeltapos > 0 then local dTempU = DGD.Aut local dTempD = DGD.Adt local dTempM = DGD.Amt DGD.Aut = DGD.dH - DGD.Aut DGD.Adt = DGD.dH - DGD.Adt DGD.Amt = DGD.dH - DGD.Amt -- se angolo positivo if DGD.tProfs.top.angle > 0 then DGD.Cmu = DGD.dW - DGD.tProfs.top.xdeltapos + ( dTempU * tan(DGD.tProfs.top.angle/2)) DGD.Cmd = DGD.dW - DGD.tProfs.top.xdeltapos + ( dTempD * tan(DGD.tProfs.top.angle/2)) DGD.Cmm = DGD.dW - DGD.tProfs.top.xdeltapos + ( dTempM * tan(DGD.tProfs.top.angle/2)) else DGD.Cmu = DGD.tProfs.top.xdeltapos + ( dTempU * tan(DGD.tProfs.top.angle/2)) DGD.Cmd = DGD.tProfs.top.xdeltapos + ( dTempD * tan(DGD.tProfs.top.angle/2)) DGD.Cmm = DGD.tProfs.top.xdeltapos + ( dTempM * tan(DGD.tProfs.top.angle/2)) end end end end end ----------------- -- lato bottom ----------------- dRadProf = dRadProfB -- setto il valore del raggio profilo -- assegno a variabile globale DGD.RPB = dRadProf DGD.PPB = dPlnProfB -- verifico se lo spessore porta è congruente con il raggio profilo if dRadProf > 0 then if ( DGD.dT - (2*dPlnProfB)) > (2*dRadProf) then DoorOutLog( string.format( EgtDoorsMsg[433], ( DGD.dT - (2*dPlnProfB)), sRightType, dRadProf), 0) return false, 0 end end if not DGD.sFrame then if not( DGD.PROBE == 2 and bRemake) then DGD.Bul = 0 DGD.Bur = 0 DGD.Bdl = 0 DGD.Bdr = 0 if sBotType == 'BD' or sBotType == 'BU' or sBotType == 'BDEB' or sBotType == 'BUEB' then if DGD.Push then DGD.Bul = ( DGD.dT * TAN3) DGD.Bur = ( DGD.dT * TAN3) DGD.Bml = DGD.Bul / 2 DGD.Bmr = DGD.Bml else DGD.Bdl = ( DGD.dT * TAN3) DGD.Bdr = ( DGD.dT * TAN3) DGD.Bml = DGD.Bdl / 2 DGD.Bmr = DGD.Bml end elseif sBotType == '1B' or sBotType == '2B' or sBotType == '3B' or sBotType == '4B' or sBotType == '5B' or sBotType == '6B' or sBotType == '7B' or sBotType == '8B' then DGD.Bul = dRadProf - sqrt( ( dRadProf * dRadProf) - ((DGD.dT/2)*(DGD.dT/2))) DGD.Bur = DGD.Bul DGD.Bdl = DGD.Bul DGD.Bdr = DGD.Bul elseif sBotType == 'CV' then DGD.Bml = dRadProf - sqrt( ( dRadProf * dRadProf) - (((DGD.dT/2)-dPlnProfB)*((DGD.dT/2)-dPlnProfB))) DGD.Bmr = DGD.Bml end end end -------------------- -- creo pezzo porta -------------------- --local nP = EgtGetFirstGroupInGroup( GDB_ID.ROOT) local nLa = EgtGroup( DGD.PZ) EgtSetName( nLa, 'AUX') EgtSetColor( nLa, BROWN()) local nLs = EgtGroup( DGD.PZ) EgtSetName( nLs, 'SOLID') if DGD.bProoduce then if DGD.Material and string.lower(DGD.Material) == 'wood' then EgtSetColor( nLs, ORANGE()) EgtSetBackground( Color3d(176,208,210), Color3d(145,177,196), false) elseif DGD.Material and string.lower(DGD.Material) == 'steel' then EgtSetColor( nLs, Color3d(167,196,197)) -- EgtSetColor( nLs, Color3d(186,193,199)) EgtSetBackground( WHITE(), GRAY(), false) elseif DGD.Material and string.lower(DGD.Material) == 'aluminum' then EgtSetColor( nLs, Color3d(208,213,217)) -- EgtSetBackground( WHITE(), GRAY(), false) EgtSetBackground( WHITE(), Color3d(170,170,170), false) elseif DGD.Material and string.lower(DGD.Material) == 'fiberglass' then EgtSetColor( nLs, Color3d(198,227,211)) EgtSetBackground( WHITE(), Color3d(210,255,210), false) else EgtSetColor( nLs, ORANGE()) end EgtSetAlpha( nLs, 30) else EgtSetColor( nLs, BLACK()) EgtSetAlpha( nLs, 20) EgtSetAlpha( nLa, 20) end local nFu, nFd local sFlatU = 'FLAT_UP' local sFlatU2 = 'FLAT_UP_2' local sFlatD = 'FLAT_DW' local sFlatD2 = 'FLAT_DW_2' local sSideL = 'SIDE_LF' local sSideR = 'SIDE_RH' local sSide = 'SIDE' local bMakeSideSurf, ptMedArc, bJoinRgt, bJoinLft = MakeSurfProfiles( nLs, sBotType, dRadProfB, sRightType, dRadProfR, sTopType, dRadProfT, sLeftType, dRadProfL, sSide, dPlnProfB, dPlnProfR, dPlnProfT, dPlnProf) if not bMakeSideSurf then local sErrMess = EgtDoorsMsg[677] return bMakeSideSurf, 2, sErrMess end -- disegno facce sopra e sotto if DGD.sFrame then -- setto la disposizione di piatto o di fianco dei jamb laterali e superiore, -- per quello inferiore, se le dimensioni della sezione sono sotto un certo valore, viene disposto solo di piatto if nTypePiece == 3 then -- se frame SX if DGD.Dws then -- se disposizione sul lato wide (di piatto) EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.RIGHT)) nFu = EgtRectangle2P( nLa, { DGD.Bur, DGD.Urb, DGD.Rub}, { DGD.Tdr, DGD.Drt, DGD.Rdt}, GDB_RT.GRID ) -- p2 a p9 nFd = EgtRectangle2P( nLa, { DGD.Bul, DGD.Ulb, DGD.Lub}, { DGD.Tdl, DGD.Dlt, DGD.Ldt}, GDB_RT.GRID ) -- p1 a p10 EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) else -- altrimenti disposizione su lato narrow nFu = EgtRectangle2P( nLa, { DGD.Lub, DGD.Bul, DGD.Ulb}, { DGD.Rut, DGD.Tur, DGD.Urt}) -- p1 a p8 nFd = EgtRectangle2P( nLa, { DGD.Ldb, DGD.Bdl, DGD.Dlb}, { DGD.Rdt, DGD.Tdr, DGD.Drt}) -- p4 a p9 end elseif nTypePiece == 4 then -- se frame DX if DGD.Dws then -- se disposizione sul lato wide (di piatto) EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.LEFT)) nFu = EgtRectangle2P( nLa, { -DGD.Tdl, DGD.Dlt, -DGD.Ldt}, { -DGD.Bul, DGD.Ulb, -DGD.Lub}, GDB_RT.GRID ) -- p10 a p1 nFd = EgtRectangle2P( nLa, { -DGD.Tdr, DGD.Drt, -DGD.Rdt}, { -DGD.Bur, DGD.Urb, -DGD.Rub}, GDB_RT.GRID ) -- p9 a p2 EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) else -- altrimenti disposizione su lato narrow nFu = EgtRectangle2P( nLa, { DGD.Lub, DGD.Bul, DGD.Ulb}, { DGD.Rut, DGD.Tur, DGD.Urt}) -- p1 a p8 nFd = EgtRectangle2P( nLa, { DGD.Ldb, DGD.Bdl, DGD.Dlb}, { DGD.Rdt, DGD.Tdr, DGD.Drt}) -- p4 a p9 end elseif nTypePiece == 5 then -- tipo frame top if DGD.Dws then -- se disposizione sul lato wide (di piatto) EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.FRONT)) nFu = EgtRectangle2P( nLa, { DGD.Lub, DGD.Ulb, DGD.Bul}, { DGD.Rdb, DGD.Drb, DGD.Bdr}, GDB_RT.GRID ) -- p1 a p3 nFd = EgtRectangle2P( nLa, { DGD.Lut, DGD.Ult, -DGD.Tul}, { DGD.Rdt, DGD.Drt, -DGD.Tdr}, GDB_RT.GRID ) -- p7 a p9 EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) else -- altrimenti disposizione su lato narrow nFu = EgtRectangle2P( nLa, { DGD.Lub, DGD.Bul, DGD.Ulb}, { DGD.Rut, DGD.Tur, DGD.Urt}) -- p1 a p8 nFd = EgtRectangle2P( nLa, { DGD.Ldb, DGD.Bdl, DGD.Dlb}, { DGD.Rdt, DGD.Tdr, DGD.Drt}) -- p4 a p9 end else -- tipo frame bottom if DGD.Dws then -- se disposizione sul lato wide (di piatto) EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.BACK)) nFu = EgtRectangle2P( nLa, { -DGD.Ldt, DGD.Dlt, DGD.Tdl}, { -DGD.Rut, DGD.Urt, DGD.Tur}, GDB_RT.GRID ) -- p10 a p8 nFd = EgtRectangle2P( nLa, { -DGD.Ldb, DGD.Dlb, DGD.Bdl}, { -DGD.Rub, DGD.Urb, DGD.Bur}, GDB_RT.GRID ) --p4 a p2 EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) else -- altrimenti disposizione su lato narrow nFu = EgtRectangle2P( nLa, { DGD.Lub, DGD.Bul, DGD.Ulb}, { DGD.Rut, DGD.Tur, DGD.Urt}) -- p1 a p8 nFd = EgtRectangle2P( nLa, { DGD.Ldb, DGD.Bdl, DGD.Dlb}, { DGD.Rdt, DGD.Tdr, DGD.Drt}) -- p4 a p9 end end else -- se top è ad arco if DGD.tProfs.top.radius then -- percorso superiore local nE1 = EgtLine( nLa, { DGD.Lub, DGD.Bul, DGD.Ulb}, { DGD.Rub, DGD.Bur, DGD.Urb}, GDB_RT.LOC) -- p1 a p2 local nE2 local nE4 local nE5 local nE6 if bJoinRgt then nE2 = EgtLine( nLa, { DGD.Rub, DGD.Bur, DGD.Urb}, { DGD.Rua, DGD.Aur, DGD.Ura}, GDB_RT.LOC) -- p2 a p14(con XY nuova) else nE2 = EgtLine( nLa, { DGD.Rub, DGD.Bur, DGD.Urb}, { DGD.Rut, DGD.Aur, DGD.Ura}, GDB_RT.LOC) -- p2 a p14(con XY nuova) nE5 = EgtLine( nLa, { DGD.Rut, DGD.Aur, DGD.Ura}, { DGD.Rua, DGD.Aur, DGD.Ura}, GDB_RT.LOC) -- linea giunzione discontinuità end local nE3 = EgtArcC2P( nLa, {((DGD.dW/2)+DGD.tProfs.top.xdeltapos), (DGD.dH-DGD.tProfs.top.ydeltapos), DGD.Ura}, { DGD.Rua, DGD.Aur, DGD.Ura}, { DGD.Lua, DGD.Aul, DGD.Ula}, GDB_RT.LOC) -- arco p14 a p13 -- per migliorare l'arco recupero la direzione iniziale, cancello l'arco e lo ricreo con il punto finale preciso if nE3 then local vcIni = EgtSV(nE3) EgtErase(nE3) nE3 = EgtArc2PV( nLa, { DGD.Rua, DGD.Aur, DGD.Ura}, { DGD.Lua, DGD.Aul, DGD.Ula}, vcIni, GDB_RT.LOC) end if bJoinLft then nE4 = EgtLine( nLa, { DGD.Lua, DGD.Aul, DGD.Ula}, { DGD.Lub, DGD.Bul, DGD.Ulb}, GDB_RT.LOC) -- p13(con Y nuova) a p1 else nE6 = EgtLine( nLa, { DGD.Lua, DGD.Aul, DGD.Ula}, { DGD.Lut, DGD.Aul, DGD.Ula}, GDB_RT.LOC) -- linea giunzione discontinuità nE4 = EgtLine( nLa, { DGD.Lut, DGD.Aul, DGD.Ula}, { DGD.Lub, DGD.Bul, DGD.Ulb}, GDB_RT.LOC) -- p13(con XY nuova) a p1 end if nE5 and nE6 then nFu = EgtCurveCompo( nLa, {nE1,nE2,nE5,nE3,nE6,nE4}, true) elseif nE5 and not nE6 then nFu = EgtCurveCompo( nLa, {nE1,nE2,nE5,nE3,nE4}, true) elseif not nE5 and nE6 then nFu = EgtCurveCompo( nLa, {nE1,nE2,nE3,nE6,nE4}, true) else nFu = EgtCurveCompo( nLa, {nE1,nE2,nE3,nE4}, true) end -- percorso inferiore nE5 = nil nE6 = nil nE1 = EgtLine( nLa, { DGD.Ldb, DGD.Bdl, DGD.Dlb}, { DGD.Rdb, DGD.Bdr, DGD.Drb}, GDB_RT.LOC) -- p4 a p3 if bJoinRgt then nE2 = EgtLine( nLa, { DGD.Rdb, DGD.Bdr, DGD.Drb}, { DGD.Rda, DGD.Adr, DGD.Dra}, GDB_RT.LOC) -- p3 a p15(con XY nuova) else nE2 = EgtLine( nLa, { DGD.Rdb, DGD.Bdr, DGD.Drb}, { DGD.Rdt, DGD.Adr, DGD.Dra}, GDB_RT.LOC) -- p3 a p15(con XY nuova) nE5 = EgtLine( nLa, { DGD.Rdt, DGD.Adr, DGD.Dra}, { DGD.Rda, DGD.Adr, DGD.Dra}, GDB_RT.LOC) -- linea giunzione discontinuità end nE3 = EgtArcC2P( nLa, {((DGD.dW/2)+DGD.tProfs.top.xdeltapos), (DGD.dH-DGD.tProfs.top.ydeltapos), DGD.Dra}, { DGD.Rda, DGD.Adr, DGD.Dra}, { DGD.Lda, DGD.Adl, DGD.Dla}, GDB_RT.LOC) -- arco p15 a p16 -- per migliorare l'arco recupero la direzione iniziale, cancello l'arco e lo ricreo con il punto finale preciso if nE3 then local vcIni = EgtSV(nE3) EgtErase(nE3) nE3 = EgtArc2PV( nLa, { DGD.Rda, DGD.Adr, DGD.Dra}, { DGD.Lda, DGD.Adl, DGD.Dla}, vcIni, GDB_RT.LOC) end if bJoinLft then nE4 = EgtLine( nLa, { DGD.Lda, DGD.Adl, DGD.Dla}, { DGD.Ldb, DGD.Bdl, DGD.Dlb}, GDB_RT.LOC) -- p16 a p4 else nE6 = EgtLine( nLa, { DGD.Lda, DGD.Adl, DGD.Dla}, { DGD.Ldt, DGD.Adl, DGD.Dla}, GDB_RT.LOC) -- linea giunzione discontinuità nE4 = EgtLine( nLa, { DGD.Ldt, DGD.Adl, DGD.Dla}, { DGD.Ldb, DGD.Bdl, DGD.Dlb}, GDB_RT.LOC) -- p16 a p4 end if nE5 and nE6 then nFd = EgtCurveCompo( nLa, {nE1,nE2,nE5,nE3,nE6,nE4}, true) elseif nE5 and not nE6 then nFd = EgtCurveCompo( nLa, {nE1,nE2,nE5,nE3,nE4}, true) elseif not nE5 and nE6 then nFd = EgtCurveCompo( nLa, {nE1,nE2,nE3,nE6,nE4}, true) else nFd = EgtCurveCompo( nLa, {nE1,nE2,nE3,nE4}, true) end elseif DGD.Tpa then -- se top è ad angolo -- percorso superiore local nE1 = EgtLine( nLa, { DGD.Lub, DGD.Bul, DGD.Ulb}, { DGD.Rub, DGD.Bur, DGD.Urb}, GDB_RT.LOC) -- p1 a p2 local nE2 = EgtLine( nLa, { DGD.Rub, DGD.Bur, DGD.Urb}, { DGD.Rua, DGD.Aur, DGD.Ura}, GDB_RT.LOC) -- p2 a p14 local nE3, nE4, nE5 if DGD.tProfs.top.xdeltapos > 0 then nE3 = EgtLine( nLa, { DGD.Rua, DGD.Aur, DGD.Ura}, { DGD.Cmu, DGD.Aut, DGD.Ura}, GDB_RT.LOC) -- p14 a p19 nE4 = EgtLine( nLa, { DGD.Cmu, DGD.Aut, DGD.Ura}, { DGD.Lua, DGD.Aul, DGD.Ula}, GDB_RT.LOC) -- p19 a p13 nE5 = EgtLine( nLa, { DGD.Lua, DGD.Aul, DGD.Ula}, { DGD.Lub, DGD.Bul, DGD.Ulb}, GDB_RT.LOC) -- p13 a p1 nFu = EgtCurveCompo( nLa, {nE1,nE2,nE3,nE4,nE5}, true) else nE3 = EgtLine( nLa, { DGD.Rua, DGD.Aur, DGD.Ura}, { DGD.Lua, DGD.Aul, DGD.Ula}, GDB_RT.LOC) -- p14 a p13 nE4 = EgtLine( nLa, { DGD.Lua, DGD.Aul, DGD.Ula}, { DGD.Lub, DGD.Bul, DGD.Ulb}, GDB_RT.LOC) -- p13 a p1 nFu = EgtCurveCompo( nLa, {nE1,nE2,nE3,nE4}, true) end -- percorso inferiore nE1 = EgtLine( nLa, { DGD.Ldb, DGD.Bdl, DGD.Dlb}, { DGD.Rdb, DGD.Bdr, DGD.Drb}, GDB_RT.LOC) -- p4 a p3 nE2 = EgtLine( nLa, { DGD.Rdb, DGD.Bdr, DGD.Drb}, { DGD.Rda, DGD.Adr, DGD.Dra}, GDB_RT.LOC) -- p3 a p15 if DGD.tProfs.top.xdeltapos > 0 then nE3 = EgtLine( nLa, { DGD.Rda, DGD.Adr, DGD.Dra}, { DGD.Cmd, DGD.Adt, DGD.Dra}, GDB_RT.LOC) -- p15 a p20 nE4 = EgtLine( nLa, { DGD.Cmd, DGD.Adt, DGD.Dra}, { DGD.Lda, DGD.Adl, DGD.Dla}, GDB_RT.LOC) -- p20 a p16 nE5 = EgtLine( nLa, { DGD.Lda, DGD.Adl, DGD.Dla}, { DGD.Ldb, DGD.Bdl, DGD.Dlb}, GDB_RT.LOC) -- p16 a p4 nFd = EgtCurveCompo( nLa, {nE1,nE2,nE3,nE4,nE5}, true) else nE3 = EgtLine( nLa, { DGD.Rda, DGD.Adr, DGD.Dra}, { DGD.Lda, DGD.Adl, DGD.Dla}, GDB_RT.LOC) -- p15 a p16 nE4 = EgtLine( nLa, { DGD.Lda, DGD.Adl, DGD.Dla}, { DGD.Ldb, DGD.Bdl, DGD.Dlb}, GDB_RT.LOC) -- p16 a p4 nFd = EgtCurveCompo( nLa, {nE1,nE2,nE3,nE4}, true) end else if DGD.PROBE == 2 and bRemake then EgtInvertCurve({nDoorLeft,nDoorTop,nDoorRight,nDoorBot}) EgtInvertCurve({nDoorLeftMid,nDoorTopMid,nDoorRightMid,nDoorBotMid}) EgtInvertCurve({nDoorLeftTop,nDoorTopTop,nDoorRightTop,nDoorBotTop}) nFu = EgtCurveCompo( nLa, {nDoorBotTop,nDoorRightTop,nDoorTopTop,nDoorLeftTop}, false) nFd = EgtCurveCompo( nLa, {nDoorBot,nDoorRight,nDoorTop,nDoorLeft}, false) else nFu = EgtRectangle2P( nLa, { DGD.Lub, DGD.Bul, DGD.Ulb}, { DGD.Rut, DGD.Tur, DGD.Urt}) -- p1 a p8 nFd = EgtRectangle2P( nLa, { DGD.Ldb, DGD.Bdl, DGD.Dlb}, { DGD.Rdt, DGD.Tdr, DGD.Drt}) -- p4 a p9 end end end local nFrU local nFrD local nCountSurf if DGD.PROBE == 2 and bRemake then nFrU = EgtSurfFlatRegion( nLs, nFu) EgtSetName( nFrU, sFlatU2) EgtSetAlpha( nFrU, 10) end nFrU = EgtSurfFlatRegion( nLs, nFu) EgtSetName( nFrU, sFlatU) if DGD.PROBE == 2 and bRemake then nFrD = EgtSurfFlatRegion( nLs, nFd) EgtInvertSurf(nFrD) EgtSetName( nFrD, sFlatD2) EgtSetAlpha( nFrD, 10) end nFrD = EgtSurfFlatRegion( nLs, nFd) EgtInvertSurf(nFrD) EgtSetName( nFrD, sFlatD) -- tabelle percorsi profili local tProPath = {} -- disegno bordo sinistro local nFrL if sLeftType == 'SQ' or sLeftType == 'EB' or sLeftType == 'BD' or sLeftType == 'BU' or sLeftType == 'BDEB' or sLeftType == 'BUEB' or sLeftType == 'FDWC' then -- disegno if DGD.sFrame then if nTypePiece == 3 then -- se frame SX tProPath.nClt = EgtLine( nLa, {DGD.Lut,DGD.Tul,DGD.Ult}, {DGD.Rut,DGD.Tur,DGD.Urt}) -- p7 a p8 tProPath.nClb = EgtLine( nLa, {DGD.Lub,DGD.Bul,DGD.Ulb}, {DGD.Rub,DGD.Bur,DGD.Urb}) -- p1 a p2 elseif nTypePiece == 4 then -- se frame DX tProPath.nClt = EgtLine( nLa, {DGD.Rdt,DGD.Tdr,DGD.Drt}, {DGD.Ldt,DGD.Tdl,DGD.Dlt}) -- p9 a p10 tProPath.nClb = EgtLine( nLa, {DGD.Rdb,DGD.Bdr,DGD.Drb}, {DGD.Ldb,DGD.Bdl,DGD.Dlb}) -- p3 a p4 elseif nTypePiece == 5 then -- tipo frame top tProPath.nClt = EgtLine( nLa, {DGD.Rut,DGD.Tur,DGD.Urt}, {DGD.Rub,DGD.Bur,DGD.Urb}) -- p8 a p2 tProPath.nClb = EgtLine( nLa, {DGD.Lut,DGD.Tul,DGD.Ult}, {DGD.Lub,DGD.Bul,DGD.Ulb}) -- p7 a p1 else -- tipo frame bottom tProPath.nClt = EgtLine( nLa, {DGD.Rdb,DGD.Bdr,DGD.Drb}, {DGD.Rdt,DGD.Tdr,DGD.Drt}) -- p3 a p9 tProPath.nClb = EgtLine( nLa, {DGD.Ldb,DGD.Bdl,DGD.Dlb}, {DGD.Ldt,DGD.Tdl,DGD.Dlt}) -- p4 a p10 end nFrL = EgtSurfTmRuled( nLs, tProPath.nClt, tProPath.nClb, 0.05) EgtInvertSurf(nFrL) EgtSetName( nFrL, sSideL) end -- se richiesta lavorazione if GetEdgeToMachine( 'L') and DGD.MachEn > 0 then local nLl = EgtGroup( DGD.PZ) EgtSetName( nLl, 'Left') EgtSetInfo( nLl, 'Offs', GetEdgeOffset( 'L')) local nMId if DGD.sFrame then if nTypePiece == 3 then -- se frame SX nMId = EgtLine( nLl, {DGD.Lut,DGD.Tul,DGD.Ult}, {DGD.Lub,DGD.Bul,DGD.Ulb}) -- p7 a p1 elseif nTypePiece == 4 then -- se frame DX nMId = EgtLine( nLl, {DGD.Rdt,DGD.Tdr,DGD.Drt}, {DGD.Rdb,DGD.Bdr,DGD.Drb}) -- p9 a p3 elseif nTypePiece == 5 then -- tipo frame top nMId = EgtLine( nLl, {DGD.Rut,DGD.Tur,DGD.Urt}, {DGD.Lut,DGD.Tul,DGD.Ult}) -- p8 a p7 else -- tipo frame bottom nMId = EgtLine( nLl, {DGD.Rdb,DGD.Bdr,DGD.Drb}, {DGD.Ldb,DGD.Bdl,DGD.Dlb}) -- p3 a p4 end else -- se top è ad arco e solo in modalità disegno if ( DGD.tProfs.top.radius or DGD.Tpa) and DGD.MachEn == 0 then nMId = EgtLine( nLl, {DGD.Lda,max(DGD.Adl,DGD.Aul),DGD.Dla}, {DGD.Ldb,min(DGD.Bdl,DGD.Bul,DGD.Bml),DGD.Dlb}) -- p16 a p4 else nMId = EgtLine( nLl, {DGD.Ldt,max(DGD.Tdl,DGD.Tul,DGD.Tml),DGD.Dlt}, {DGD.Ldb,min(DGD.Bdl,DGD.Bul,DGD.Bml),DGD.Dlb}) -- p10 a p4 end end if sLeftType == 'BD' or sLeftType == 'BU' or sLeftType == 'BDEB' or sLeftType == 'BUEB' then if DGD.sFrame then if nTypePiece == 3 then -- se frame SX if sLeftType == 'BD' or sLeftType == 'BDEB' then EgtModifyCurveExtrusion( nMId, Vector3d( COS3, 0, SIN3), GDB_RT.GLOB) else EgtModifyCurveExtrusion( nMId, Vector3d( COS3, 0, -SIN3), GDB_RT.GLOB) end elseif nTypePiece == 4 then -- se frame DX if sLeftType == 'BD' or sLeftType == 'BDEB' then EgtModifyCurveExtrusion( nMId, Vector3d( -COS3, 0, -SIN3), GDB_RT.GLOB) else EgtModifyCurveExtrusion( nMId, Vector3d( -COS3, 0, SIN3), GDB_RT.GLOB) end elseif nTypePiece == 5 then -- tipo frame top if sLeftType == 'BD' or sLeftType == 'BDEB' then EgtModifyCurveExtrusion( nMId, Vector3d( 0, -COS3, SIN3), GDB_RT.GLOB) else EgtModifyCurveExtrusion( nMId, Vector3d( 0, -COS3, -SIN3), GDB_RT.GLOB) end else -- tipo frame bottom if sLeftType == 'BD' or sLeftType == 'BDEB' then EgtModifyCurveExtrusion( nMId, Vector3d( 0, COS3, -SIN3), GDB_RT.GLOB) else EgtModifyCurveExtrusion( nMId, Vector3d( 0, COS3, SIN3), GDB_RT.GLOB) end end else -- se lato sinistro con serratura e senza maniglia e abilitata la funzione -- di inversione automatica bevel sul lato inactive o discordanza tra i due profili, inverto l'inclinazione if DGD.Lock == 'L' and ( DGD.sSwing == 'RHI' or DGD.sSwing == 'RHRI') and ( ( DGD.RevInBv and DGD.RevInBv == 1) or DGD.bBothOppoBevel) then if DGD.Push then EgtModifyCurveExtrusion( nMId, Vector3d( -SIN3, 0, COS3), GDB_RT.GLOB) else EgtModifyCurveExtrusion( nMId, Vector3d( SIN3, 0, COS3), GDB_RT.GLOB) end else if DGD.Push then EgtModifyCurveExtrusion( nMId, Vector3d( SIN3, 0, COS3), GDB_RT.GLOB) else EgtModifyCurveExtrusion( nMId, Vector3d( -SIN3, 0, COS3), GDB_RT.GLOB) end end end if DGD.sFrame then if nTypePiece == 3 or nTypePiece == 4 then -- se frame SX o DX EgtModifyCurveThickness( nMId, DGD.dW / COS3) else EgtModifyCurveThickness( nMId, DGD.dH / COS3) end else EgtModifyCurveThickness( nMId, DGD.dT / COS3) end else if DGD.sFrame then if nTypePiece == 3 then -- se frame SX EgtModifyCurveExtrusion( nMId, Vector3d( 1, 0, 0), GDB_RT.GLOB) EgtModifyCurveThickness( nMId, DGD.dW) elseif nTypePiece == 4 then -- se frame DX EgtModifyCurveExtrusion( nMId, Vector3d( -1, 0, 0), GDB_RT.GLOB) EgtModifyCurveThickness( nMId, DGD.dW) elseif nTypePiece == 5 then -- tipo frame top EgtModifyCurveExtrusion( nMId, Vector3d( 0, -1, 0), GDB_RT.GLOB) EgtModifyCurveThickness( nMId, DGD.dH) else -- tipo frame bottom EgtModifyCurveExtrusion( nMId, Vector3d( 0, 1, 0), GDB_RT.GLOB) EgtModifyCurveThickness( nMId, DGD.dH) end else EgtModifyCurveThickness( nMId, DGD.dT) end end EgtSetName( nMId, sLeftType .. EgtIf( string.find( sLeftType,'EB'), DGD.EBP, '')) EgtSetColor( nMId, BLACK()) if DGD.Lock == 'L' then EgtSetInfo( nMId, 'EdgeDoor', 'L') else EgtSetInfo( nMId, 'EdgeDoor', 'H') end end elseif sLeftType == '1B' or sLeftType == '2B' or sLeftType == '3B' or sLeftType == '4B' or sLeftType == '5B' or sLeftType == '6B' or sLeftType == '7B' or sLeftType == '8B' then -- setto la griglia di fronte : da rivedere if DGD.PROBE == 2 and bRemake then tProPath.nClb = EgtArc3P( nLa, {DGD.Ldb,DGD.Bdl,DGD.Dlb}, {DGD.Lmb,DGD.Bml,DGD.Mlb}, {DGD.Lub,DGD.Bul,DGD.Ulb}) -- p4 a p5 a p1 -- se top è ad arco e solo in modalità disegno if ( DGD.tProfs.top.radius or DGD.Tpa) and DGD.MachEn == 0 then tProPath.nClt = EgtArc3P( nLa, {DGD.Lda,DGD.Adl,DGD.Dla}, {DGD.Lma,DGD.Aml,DGD.Mla}, {DGD.Lua,DGD.Aul,DGD.Ula}) -- p16 a p17 a p13 else tProPath.nClt = EgtArc3P( nLa, {DGD.Ldt,DGD.Tdl,DGD.Dlt}, {DGD.Lmt,DGD.Tml,DGD.Mlt}, {DGD.Lut,DGD.Tul,DGD.Ult}) -- p10 a p11 a p7 end nFrL = EgtSurfTmRuled( nLs, tProPath.nClt, tProPath.nClb, 0.05) EgtInvertSurf(nFrL) EgtSetName( nFrL, sSideL) end -- se richiesta lavorazione if GetEdgeToMachine( 'L') and DGD.MachEn > 0 then local nLl = EgtGroup( DGD.PZ) EgtSetName( nLl, 'Left') EgtSetInfo( nLl, 'Offs', GetEdgeOffset( 'L')) local nMId if DGD.PROBE == 2 and bRemake then -- se top è ad arco e solo in modalità disegno if ( DGD.tProfs.top.radius or DGD.Tpa) and DGD.MachEn == 0 then nMId = EgtLine( nLl, {DGD.Lma, DGD.Aml, DGD.Dla}, { DGD.Lmb, DGD.Bml, DGD.Dlb}) -- pmu a pmd else nMId = EgtLine( nLl, {DGD.Lmt, DGD.Tml, DGD.Dlt}, { DGD.Lmb, DGD.Bml, DGD.Dlb}) -- pmu a pmd end else -- se top è ad arco e solo in modalità disegno if ( DGD.tProfs.top.radius or DGD.Tpa) and DGD.MachEn == 0 then nMId = EgtLine( nLl, {DGD.Lm, max(DGD.Adl,DGD.Aul), DGD.Dla}, { DGD.Lm, min(DGD.Bdl,DGD.Bul,DGD.Bml), DGD.Dlb}) -- pmu a pmd else nMId = EgtLine( nLl, {DGD.Lm, max(DGD.Tdl,DGD.Tul,DGD.Tml), DGD.Dlt}, { DGD.Lm, min(DGD.Bdl,DGD.Bul,DGD.Bml), DGD.Dlb}) -- pmu a pmd end end EgtModifyCurveThickness( nMId, DGD.dT) EgtSetName( nMId, sLeftType) EgtSetColor( nMId, BLACK()) if DGD.Lock == 'L' then EgtSetInfo( nMId, 'EdgeDoor', 'L') else EgtSetInfo( nMId, 'EdgeDoor', 'H') end end elseif sLeftType == 'CV' then -- setto la griglia di fronte: da rivedere if DGD.PROBE == 2 and bRemake then tProPath.nClb = EgtArc3P( nLa, {DGD.Ldb,DGD.Bdl,DGD.Dlb}, {DGD.Lmb,DGD.Bml,DGD.Mlb}, {DGD.Lub,DGD.Bul,DGD.Ulb}) -- p4 a p5 a p1 -- se top è ad arco e solo in modalità disegno if ( DGD.tProfs.top.radius or DGD.Tpa) and DGD.MachEn == 0 then tProPath.nClt = EgtArc3P( nLa, {DGD.Lda,DGD.Adl,DGD.Dla}, {DGD.Lma,DGD.Aml,DGD.Mla}, {DGD.Lua,DGD.Aul,DGD.Ula}) -- p16 a p17 a p13 else tProPath.nClt = EgtArc3P( nLa, {DGD.Ldt,DGD.Tdl,DGD.Dlt}, {DGD.Lmt,DGD.Tml,DGD.Mlt}, {DGD.Lut,DGD.Tul,DGD.Ult}) -- p10 a p11 a p7 end nFrL = EgtSurfTmRuled( nLs, tProPath.nClt, tProPath.nClb, 0.05) EgtInvertSurf(nFrL) EgtSetName( nFrL, sSideL) end -- se richiesta lavorazione if GetEdgeToMachine( 'L') and DGD.MachEn > 0 then local nLl = EgtGroup( DGD.PZ) EgtSetName( nLl, 'Left') EgtSetInfo( nLl, 'Offs', GetEdgeOffset( 'L')) local nMId if DGD.PROBE == 2 and bRemake then -- se top è ad arco e solo in modalità disegno if ( DGD.tProfs.top.radius or DGD.Tpa) and DGD.MachEn == 0 then nMId = EgtLine( nLl, {DGD.Lma, DGD.Aml, DGD.Dla}, { DGD.Lmb, DGD.Bml, DGD.Dlb}) -- pmu a pmd else nMId = EgtLine( nLl, {DGD.Lmt, DGD.Tml, DGD.Dlt}, { DGD.Lmb, DGD.Bml, DGD.Dlb}) -- pmu a pmd end else -- se top è ad arco e solo in modalità disegno if ( DGD.tProfs.top.radius or DGD.Tpa) and DGD.MachEn == 0 then nMId = EgtLine( nLl, {DGD.Lm, max(DGD.Adl,DGD.Aul), DGD.Dla}, { DGD.Lm, min(DGD.Bdl,DGD.Bul,DGD.Bml), DGD.Dlb}) -- pmu a pmd else nMId = EgtLine( nLl, {DGD.Lm, max(DGD.Tdl,DGD.Tul,DGD.Tml), DGD.Dlt}, { DGD.Lm, min(DGD.Bdl,DGD.Bul,DGD.Bml), DGD.Dlb}) -- pmu a pmd end end EgtModifyCurveThickness( nMId, DGD.dT) EgtSetName( nMId, sLeftType) EgtSetColor( nMId, BLACK()) if DGD.Lock == 'L' then EgtSetInfo( nMId, 'EdgeDoor', 'L') else EgtSetInfo( nMId, 'EdgeDoor', 'H') end end end -- disegno bordo destro local nFrR if sRightType == 'SQ' or sRightType == 'EB' or sRightType == 'BD' or sRightType == 'BU' or sRightType == 'BDEB' or sRightType == 'BUEB' or sRightType == 'FDWC' then -- disegno if DGD.sFrame then if nTypePiece == 3 then -- se frame SX tProPath.nCrt = EgtLine( nLa, {DGD.Ldt,DGD.Tdl,DGD.Dlt}, {DGD.Rdt,DGD.Tdr,DGD.Drt}) -- p10 a p9 tProPath.nCrb = EgtLine( nLa, {DGD.Ldb,DGD.Bdl,DGD.Dlb}, {DGD.Rdb,DGD.Bdr,DGD.Drb}) -- p4 a p3 elseif nTypePiece == 4 then -- se frame DX tProPath.nCrt = EgtLine( nLa, {DGD.Rut,DGD.Tur,DGD.Urt}, {DGD.Lut,DGD.Tul,DGD.Ult}) -- p8 a p7 tProPath.nCrb = EgtLine( nLa, {DGD.Rub,DGD.Bur,DGD.Urb}, {DGD.Lub,DGD.Bul,DGD.Ulb}) -- p2 a p1 elseif nTypePiece == 5 then -- tipo frame top tProPath.nCrt = EgtLine( nLa, {DGD.Rdt,DGD.Tdr,DGD.Drt}, {DGD.Rdb,DGD.Bdr,DGD.Drb}) -- p9 a p3 tProPath.nCrb = EgtLine( nLa, {DGD.Ldt,DGD.Tdl,DGD.Dlt}, {DGD.Ldb,DGD.Bdl,DGD.Dlb}) -- p10 a p4 else -- tipo frame bottom tProPath.nCrt = EgtLine( nLa, {DGD.Rub,DGD.Bur,DGD.Urb}, {DGD.Rut,DGD.Tur,DGD.Urt}) -- p2 a p8 tProPath.nCrb = EgtLine( nLa, {DGD.Lub,DGD.Bul,DGD.Ulb}, {DGD.Lut,DGD.Tul,DGD.Ult}) -- p1 a p7 end nFrR = EgtSurfTmRuled( nLs, tProPath.nCrt, tProPath.nCrb, 0.05) EgtSetName( nFrR, sSideR) end -- se richiesta lavorazione if GetEdgeToMachine( 'R') and DGD.MachEn > 0 then local nLl = EgtGroup( DGD.PZ) EgtSetName( nLl, 'Right') EgtSetInfo( nLl, 'Offs', GetEdgeOffset( 'R')) local nMId if DGD.sFrame then if nTypePiece == 3 then -- se frame SX nMId = EgtLine( nLl, {DGD.Ldb,DGD.Bdl,DGD.Dlb}, {DGD.Ldt,DGD.Tdl,DGD.Dlt}) -- p4 a p10 elseif nTypePiece == 4 then -- se frame DX nMId = EgtLine( nLl, {DGD.Rub,DGD.Bur,DGD.Urb}, {DGD.Rut,DGD.Tur,DGD.Urt}) -- p2 a p8 elseif nTypePiece == 5 then -- tipo frame top nMId = EgtLine( nLl, {DGD.Ldt,DGD.Tdl,DGD.Dlt}, {DGD.Rdt,DGD.Tdr,DGD.Drt}) -- p10 a p9 else -- tipo frame bottom nMId = EgtLine( nLl, {DGD.Lub,DGD.Bul,DGD.Ulb}, {DGD.Rub,DGD.Bur,DGD.Urb}) -- p1 a p2 end else -- se top è ad arco e solo in modalità disegno if ( DGD.tProfs.top.radius or DGD.Tpa) and DGD.MachEn == 0 then nMId = EgtLine( nLl, {DGD.Rdb,min(DGD.Bdr,DGD.Bur),DGD.Drb}, {DGD.Rda,max(DGD.Adr,DGD.Aur),DGD.Dra}) -- p3 a p15 else nMId = EgtLine( nLl, {DGD.Rdb,min(DGD.Bdr,DGD.Bur,DGD.Bmr),DGD.Drb}, {DGD.Rdt,max(DGD.Tdr,DGD.Tur,DGD.Tmr),DGD.Drt}) -- p3 a p9 end end if sRightType == 'BD' or sRightType == 'BU' or sRightType == 'BDEB' or sRightType == 'BUEB' then if DGD.sFrame then if nTypePiece == 3 then -- se frame SX if sRightType == 'BD' or sRightType == 'BDEB' then EgtModifyCurveExtrusion( nMId, Vector3d( COS3, 0, -SIN3), GDB_RT.GLOB) else EgtModifyCurveExtrusion( nMId, Vector3d( COS3, 0, SIN3), GDB_RT.GLOB) end elseif nTypePiece == 4 then -- se frame DX if sRightType == 'BD' or sRightType == 'BDEB' then EgtModifyCurveExtrusion( nMId, Vector3d( -COS3, 0, SIN3), GDB_RT.GLOB) else EgtModifyCurveExtrusion( nMId, Vector3d( -COS3, 0, -SIN3), GDB_RT.GLOB) end elseif nTypePiece == 5 then -- tipo frame top if sRightType == 'BD' or sRightType == 'BDEB' then EgtModifyCurveExtrusion( nMId, Vector3d( 0, -COS3, -SIN3), GDB_RT.GLOB) else EgtModifyCurveExtrusion( nMId, Vector3d( 0, -COS3, SIN3), GDB_RT.GLOB) end else -- tipo frame bottom if sRightType == 'BD' or sRightType == 'BDEB' then EgtModifyCurveExtrusion( nMId, Vector3d( 0, COS3, SIN3), GDB_RT.GLOB) else EgtModifyCurveExtrusion( nMId, Vector3d( 0, COS3, -SIN3), GDB_RT.GLOB) end end else -- se lato destro con serratura e senza maniglia e abilitata la funzione -- di inversione automatica bevel sul lato inactive o discordanza tra i due profili, inverto l'inclinazione if DGD.Lock == 'R' and ( DGD.sSwing == 'LHI' or DGD.sSwing == 'LHRI') and ( ( DGD.RevInBv and DGD.RevInBv == 1) or DGD.bBothOppoBevel) then if DGD.Push then EgtModifyCurveExtrusion( nMId, Vector3d( SIN3, 0, COS3), GDB_RT.GLOB) else EgtModifyCurveExtrusion( nMId, Vector3d( -SIN3, 0, COS3), GDB_RT.GLOB) end else if DGD.Push then EgtModifyCurveExtrusion( nMId, Vector3d( -SIN3, 0, COS3), GDB_RT.GLOB) else EgtModifyCurveExtrusion( nMId, Vector3d( SIN3, 0, COS3), GDB_RT.GLOB) end end end if DGD.sFrame then if nTypePiece == 3 or nTypePiece == 4 then -- se frame SX o DX EgtModifyCurveThickness( nMId, DGD.dW / COS3) else EgtModifyCurveThickness( nMId, DGD.dH / COS3) end else EgtModifyCurveThickness( nMId, DGD.dT / COS3) end else if DGD.sFrame then if nTypePiece == 3 then -- se frame SX EgtModifyCurveExtrusion( nMId, Vector3d( 1, 0, 0), GDB_RT.GLOB) EgtModifyCurveThickness( nMId, DGD.dW) elseif nTypePiece == 4 then -- se frame DX EgtModifyCurveExtrusion( nMId, Vector3d( -1, 0, 0), GDB_RT.GLOB) EgtModifyCurveThickness( nMId, DGD.dW) elseif nTypePiece == 5 then -- tipo frame top EgtModifyCurveExtrusion( nMId, Vector3d( 0, -1, 0), GDB_RT.GLOB) EgtModifyCurveThickness( nMId, DGD.dH) else -- tipo frame bottom EgtModifyCurveExtrusion( nMId, Vector3d( 0, 1, 0), GDB_RT.GLOB) EgtModifyCurveThickness( nMId, DGD.dH) end else EgtModifyCurveThickness( nMId, DGD.dT) end end EgtSetName( nMId, sRightType .. EgtIf( string.find( sRightType,'EB'), DGD.EBP, '')) EgtSetColor( nMId, BLACK()) if DGD.Lock == 'L' then EgtSetInfo( nMId, 'EdgeDoor', 'H') else EgtSetInfo( nMId, 'EdgeDoor', 'L') end end elseif sRightType == '1B' or sRightType == '2B' or sRightType == '3B' or sRightType == '4B' or sRightType == '5B' or sRightType == '6B' or sRightType == '7B' or sRightType == '8B' then -- setto la griglia di fronte: da rivedere if DGD.PROBE == 2 and bRemake then tProPath.nCrb = EgtArc3P( nLa, {DGD.Rdb,DGD.Bdr,DGD.Drb}, {DGD.Rmb,DGD.Bmr,DGD.Mrb}, {DGD.Rub,DGD.Bur,DGD.Urb}) -- p3 a p6 a p2 -- se top è ad arco e solo in modalità disegno if ( DGD.tProfs.top.radius or DGD.Tpa) and DGD.MachEn == 0 then tProPath.nCrt = EgtArc3P( nLa, {DGD.Rda,DGD.Adr,DGD.Dra}, {DGD.Rma,DGD.Amr,DGD.Mra}, {DGD.Rua,DGD.Aur,DGD.Ura}) -- p15 a p18 a p14 else tProPath.nCrt = EgtArc3P( nLa, {DGD.Rdt,DGD.Tdr,DGD.Drt}, {DGD.Rmt,DGD.Tmr,DGD.Mrt}, {DGD.Rut,DGD.Tur,DGD.Urt}) -- p9 a p12 a p8 end nFrR = EgtSurfTmRuled( nLs, tProPath.nCrt, tProPath.nCrb, 0.05) EgtSetName( nFrR, sSideR) end -- se richiesta lavorazione if GetEdgeToMachine( 'R') and DGD.MachEn > 0 then local nLl = EgtGroup( DGD.PZ) EgtSetName( nLl, 'Right') EgtSetInfo( nLl, 'Offs', GetEdgeOffset( 'R')) local nMId if DGD.PROBE == 2 and bRemake then -- se top è ad arco e solo in modalità disegno if ( DGD.tProfs.top.radius or DGD.Tpa) and DGD.MachEn == 0 then nMId = EgtLine( nLl, {DGD.Rmb, DGD.Bmr, DGD.Drb}, { DGD.Rma, DGD.Amr, DGD.Dra}) -- pmd a pmu else nMId = EgtLine( nLl, {DGD.Rmb, DGD.Bmr, DGD.Drb}, { DGD.Rmt, DGD.Tmr, DGD.Drt}) -- pmd a pmu end else -- se top è ad arco e solo in modalità disegno if ( DGD.tProfs.top.radius or DGD.Tpa) and DGD.MachEn == 0 then nMId = EgtLine( nLl, {DGD.Rm, min(DGD.Bdr,DGD.Bur), DGD.Drb}, { DGD.Rm, max(DGD.Adr,DGD.Aur), DGD.Dra}) -- pmd a pmu else nMId = EgtLine( nLl, {DGD.Rm, min(DGD.Bdr,DGD.Bur,DGD.Bmr), DGD.Drb}, { DGD.Rm, max(DGD.Tdr,DGD.Tur,DGD.Tmr), DGD.Drt}) -- pmd a pmu end end EgtModifyCurveThickness( nMId, DGD.dT) EgtSetName( nMId, sRightType) EgtSetColor( nMId, BLACK()) if DGD.Lock == 'L' then EgtSetInfo( nMId, 'EdgeDoor', 'H') else EgtSetInfo( nMId, 'EdgeDoor', 'L') end end elseif sRightType == 'CV' then -- setto la griglia di fronte: da rivedere if DGD.PROBE == 2 and bRemake then tProPath.nCrb = EgtArc3P( nLa, {DGD.Rdb,DGD.Bdr,DGD.Drb}, {DGD.Rmb,DGD.Bmr,DGD.Mrb}, {DGD.Rub,DGD.Bur,DGD.Urb}) -- p3 a p6 a p2 -- se top è ad arco e solo in modalità disegno if ( DGD.tProfs.top.radius or DGD.Tpa) and DGD.MachEn == 0 then tProPath.nCrt = EgtArc3P( nLa, {DGD.Rda,DGD.Adr,DGD.Dra}, {DGD.Rma,DGD.Amr,DGD.Mra}, {DGD.Rua,DGD.Aur,DGD.Ura}) -- p15 a p18 a p14 else tProPath.nCrt = EgtArc3P( nLa, {DGD.Rdt,DGD.Tdr,DGD.Drt}, {DGD.Rmt,DGD.Tmr,DGD.Mrt}, {DGD.Rut,DGD.Tur,DGD.Urt}) -- p9 a p12 a p8 end nFrR = EgtSurfTmRuled( nLs, tProPath.nCrt, tProPath.nCrb, 0.05) EgtSetName( nFrR, sSideR) end -- se richiesta lavorazione if GetEdgeToMachine( 'R') and DGD.MachEn > 0 then local nLl = EgtGroup( DGD.PZ) EgtSetName( nLl, 'Right') EgtSetInfo( nLl, 'Offs', GetEdgeOffset( 'R')) local nMId if DGD.PROBE == 2 and bRemake then -- se top è ad arco e solo in modalità disegno if ( DGD.tProfs.top.radius or DGD.Tpa) and DGD.MachEn == 0 then nMId = EgtLine( nLl, {DGD.Rmb, DGD.Bmr, DGD.Drb}, { DGD.Rma, DGD.Amr, DGD.Dra}) -- pmd a pmu else nMId = EgtLine( nLl, {DGD.Rmb, DGD.Bmr, DGD.Drb}, { DGD.Rmt, DGD.Tmr, DGD.Drt}) -- pmd a pmu end else -- se top è ad arco e solo in modalità disegno if ( DGD.tProfs.top.radius or DGD.Tpa) and DGD.MachEn == 0 then nMId = EgtLine( nLl, {DGD.Rm, min(DGD.Bdr,DGD.Bur), DGD.Drb}, { DGD.Rm, max(DGD.Adr,DGD.Aur), DGD.Dra}) -- pmd a pmu else nMId = EgtLine( nLl, {DGD.Rm, min(DGD.Bdr,DGD.Bur,DGD.Bmr), DGD.Drb}, { DGD.Rm, max(DGD.Tdr,DGD.Tur,DGD.Tmr), DGD.Drt}) -- pmd a pmu end end EgtModifyCurveThickness( nMId, DGD.dT) EgtSetName( nMId, sRightType) EgtSetColor( nMId, BLACK()) if DGD.Lock == 'L' then EgtSetInfo( nMId, 'EdgeDoor', 'H') else EgtSetInfo( nMId, 'EdgeDoor', 'L') end end end -- bordo in basso -- se richiesta lavorazione if GetEdgeToMachine( 'B') and DGD.MachEn > 0 then local nLl = EgtGroup( DGD.PZ) EgtSetName( nLl, 'Bottom') EgtSetInfo( nLl, 'Offs', DGD.tProfs.bottom.offset) local nMId, nAsl, nAsr if DGD.sFrame then if nTypePiece == 3 then -- se frame SX nMId = EgtLine( nLl, {DGD.Lub,DGD.Bul,DGD.Ulb}, {DGD.Ldb,DGD.Bdl,DGD.Dlb}) -- p1 a p4 EgtModifyCurveExtrusion( nMId, Vector3d( 1, 0, 0), GDB_RT.GLOB) EgtModifyCurveThickness( nMId, DGD.dW) elseif nTypePiece == 4 then -- se frame DX nMId = EgtLine( nLl, {DGD.Rdb,DGD.Bdr,DGD.Drb}, {DGD.Rub,DGD.Bur,DGD.Urb}) -- p3 a p2 EgtModifyCurveExtrusion( nMId, Vector3d( -1, 0, 0), GDB_RT.GLOB) EgtModifyCurveThickness( nMId, DGD.dW) elseif nTypePiece == 5 then -- tipo frame top nMId = EgtLine( nLl, {DGD.Lut,DGD.Tul,DGD.Ult}, {DGD.Ldt,DGD.Tdl,DGD.Dlt}) -- p7 a p10 EgtModifyCurveExtrusion( nMId, Vector3d( 0, -1, 0), GDB_RT.GLOB) EgtModifyCurveThickness( nMId, DGD.dH) else -- tipo frame bottom nMId = EgtLine( nLl, {DGD.Ldb,DGD.Bdl,DGD.Dlb}, {DGD.Lub,DGD.Bul,DGD.Ulb}) -- p4 a p1 EgtModifyCurveExtrusion( nMId, Vector3d( 0, 1, 0), GDB_RT.GLOB) EgtModifyCurveThickness( nMId, DGD.dH) end EgtSetName( nMId, 'SQ_H') EgtSetColor( nMId, BLACK()) else if sBotType == 'BD' or sBotType == 'BU' or sBotType == 'BDEB' or sBotType == 'BUEB' then nMId = EgtLine( nLl, {min(DGD.Ldb,DGD.Lm,DGD.Lub),DGD.Bdl,DGD.Dlb}, {max(DGD.Rdb,DGD.Rm,DGD.Rub),DGD.Bdr,DGD.Drb}) -- p4 a p3 if DGD.Push then EgtModifyCurveExtrusion( nMId, Vector3d( 0, SIN3, COS3), GDB_RT.GLOB) else EgtModifyCurveExtrusion( nMId, Vector3d( 0, -SIN3, COS3), GDB_RT.GLOB) end EgtModifyCurveThickness( nMId, DGD.dT / COS3) elseif sBotType == '1B' or sBotType == '2B' or sBotType == '3B' or sBotType == '4B' or sBotType == '5B' or sBotType == '6B' or sBotType == '7B' or sBotType == '8B' then nMId = EgtLine( nLl, {min(DGD.Ldb,DGD.Lm,DGD.Lub),DGD.Bml,DGD.Dlb}, {max(DGD.Rdb,DGD.Rm,DGD.Rub),DGD.Bmr,DGD.Drb}) -- p5 a p6 con Z0 EgtModifyCurveThickness( nMId, DGD.dT) elseif sBotType == 'CV' then nMId = EgtLine( nLl, {min(DGD.Ldb,DGD.Lm,DGD.Lub),DGD.Bml,DGD.Dlb}, {max(DGD.Rdb,DGD.Rm,DGD.Rub),DGD.Bmr,DGD.Drb}) -- p4 a p3 EgtModifyCurveThickness( nMId, DGD.dT) else -- SQ/EB/FDWC nMId = EgtLine( nLl, {min(DGD.Ldb,DGD.Lm,DGD.Lub),DGD.Bdl,DGD.Dlb}, {max(DGD.Rdb,DGD.Rm,DGD.Rub),DGD.Bdr,DGD.Drb}) -- p4 a p3 EgtModifyCurveThickness( nMId, DGD.dT) end -- creo percorsi anti-scheggia lungo lo spessore if not ( sBotType == '1B' or sBotType == '2B' or sBotType == '3B' or sBotType == '4B' or sBotType == '5B' or sBotType == '6B' or sBotType == '7B' or sBotType == '8B' or sBotType == 'CV') then -- griglia a sinistra per percorso a sinistra EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.LEFT)) if sLeftType == 'SQ' or sLeftType == 'EB' or sLeftType == 'BD' or sLeftType == 'BU' or sLeftType == 'BDEB' or sLeftType == 'BUEB' or sLeftType == 'FDWC' then nAsl = EgtLine( nLl, {-DGD.Bdl,DGD.Dlb,-DGD.Ldb}, {-DGD.Bul,DGD.Ulb,-DGD.Lub}, GDB_RT.GRID) -- p4 a p1 else nAsl = EgtLine( nLl, {-DGD.Bdl,DGD.Dlb,-(min(DGD.Ldb,DGD.Lm,DGD.Lub))}, {-DGD.Bul,DGD.Ulb,-(min(DGD.Ldb,DGD.Lm,DGD.Lub))}, GDB_RT.GRID) -- p4 a p1 end EgtModifyCurveThickness( nAsl, 0) EgtSetColor( nAsl, BLACK()) -- griglia a destra per percorso a destra EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.RIGHT)) if sRightType == 'SQ' or sRightType == 'EB' or sRightType == 'BD' or sRightType == 'BU' or sRightType == 'BDEB' or sRightType == 'BUEB' or sRightType == 'FDWC' then nAsr = EgtLine( nLl, {DGD.Bur,DGD.Urb,DGD.Rub}, {DGD.Bdr,DGD.Drb,DGD.Rdb}, GDB_RT.GRID) -- p2 a p3 else nAsr = EgtLine( nLl, {DGD.Bur,DGD.Urb,max(DGD.Rub,DGD.Rm,DGD.Rdb)}, {DGD.Bdr,DGD.Drb,max(DGD.Rub,DGD.Rm,DGD.Rdb)}, GDB_RT.GRID) -- p2 a p3 end EgtModifyCurveThickness( nAsr, 0) EgtSetColor( nAsr, BLACK()) EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) if DGD.Lock == 'R' then EgtSetName( nAsl, 'ASLB_HNG') -- indico nel nome che è sul lato hinge EgtSetName( nAsr, 'ASRB') else EgtSetName( nAsl, 'ASLB') EgtSetName( nAsr, 'ASRB_HNG') -- indico nel nome che è sul lato hinge end end EgtSetName( nMId, sBotType .. EgtIf( string.find( sBotType,'EB'), DGD.EBP, '') .. '_H') EgtSetColor( nMId, BLACK()) end EgtSetInfo( nMId, 'EdgeDoor', 'B') end -- bordo in alto -- se richiesta lavorazione if GetEdgeToMachine( 'T') and DGD.MachEn > 0 then local nLl = EgtGroup( DGD.PZ) EgtSetName( nLl, 'Top') EgtSetInfo( nLl, 'Offs', DGD.tProfs.top.offset) local nMId, nAsl, nAsr if DGD.sFrame then if nTypePiece == 3 then -- se frame SX nMId = EgtLine( nLl, {DGD.Ldt,DGD.Tdl,DGD.Dlt}, {DGD.Lut,DGD.Tul,DGD.Ult}) -- p10 a p7 EgtModifyCurveExtrusion( nMId, Vector3d( 1, 0, 0), GDB_RT.GLOB) EgtModifyCurveThickness( nMId, DGD.dW) elseif nTypePiece == 4 then -- se frame DX nMId = EgtLine( nLl, {DGD.Rut,DGD.Tur,DGD.Urt}, {DGD.Rdt,DGD.Tdr,DGD.Drt}) -- p8 a p9 EgtModifyCurveExtrusion( nMId, Vector3d( -1, 0, 0), GDB_RT.GLOB) EgtModifyCurveThickness( nMId, DGD.dW) elseif nTypePiece == 5 then -- tipo frame top nMId = EgtLine( nLl, {DGD.Rdt,DGD.Tdr,DGD.Drt}, {DGD.Rut,DGD.Tur,DGD.Urt}) -- p9 a p8 EgtModifyCurveExtrusion( nMId, Vector3d( 0, -1, 0), GDB_RT.GLOB) EgtModifyCurveThickness( nMId, DGD.dH) else -- tipo frame bottom nMId = EgtLine( nLl, {DGD.Rub,DGD.Bur,DGD.Urb}, {DGD.Rdb,DGD.Bdr,DGD.Drb}) -- p2 a p3 EgtModifyCurveExtrusion( nMId, Vector3d( 0, 1, 0), GDB_RT.GLOB) EgtModifyCurveThickness( nMId, DGD.dH) end EgtSetName( nMId, 'SQ_H') EgtSetColor( nMId, BLACK()) else -- se top è ad arco if DGD.tProfs.top.radius then if sTopType == 'BD' or sTopType == 'BU' or sTopType == 'BDEB' or sTopType == 'BUEB' or sTopType == 'SQ' or sTopType == 'EB' or sTopType == 'BV' or sTopType == 'BVEB' or sTopType == 'FDWC' then -- profilo top if DGD.Push then -- se a spingere percorso con punti da curva sopra spessore (la curva più stretta) nMId = EgtArcC2P( nLl, {((DGD.dW/2)+DGD.tProfs.top.xdeltapos), (DGD.dH-DGD.tProfs.top.ydeltapos), DGD.Dra}, { DGD.rma, DGD.amr, DGD.Dra}, { DGD.lma, DGD.aml, DGD.Dla}, GDB_RT.LOC) -- arco p22 a p23 -- nMId = EgtArcC2P( nLl, {((DGD.dW/2)+DGD.tProfs.top.xdeltapos), (DGD.dH-DGD.tProfs.top.ydeltapos), DGD.Dra}, -- { DGD.Rua, DGD.Aur, DGD.Dra}, { DGD.Lua, DGD.Aul, DGD.Dla}, GDB_RT.LOC) -- arco p22 a p23 else -- altrimenti a tirare percorso con punti da curva sotto (la curva più stretta) nMId = EgtArcC2P( nLl, {((DGD.dW/2)+DGD.tProfs.top.xdeltapos), (DGD.dH-DGD.tProfs.top.ydeltapos), DGD.Dra}, { DGD.rma, DGD.amr, DGD.Dra}, { DGD.lma, DGD.aml, DGD.Dla}, GDB_RT.LOC) -- arco p24 a p25 -- nMId = EgtArcC2P( nLl, {((DGD.dW/2)+DGD.tProfs.top.xdeltapos), (DGD.dH-DGD.tProfs.top.ydeltapos), DGD.Dra}, -- { DGD.Rda, DGD.Adr, DGD.Dra}, { DGD.Lda, DGD.Adl, DGD.Dla}, GDB_RT.LOC) -- arco p24 a p25 end elseif sTopType == 'CV' then nMId = EgtArcC2P( nLl, {((DGD.dW/2)+DGD.tProfs.top.xdeltapos), (DGD.dH-DGD.tProfs.top.ydeltapos), DGD.Dra}, { DGD.rma, DGD.amr, DGD.Dra}, { DGD.lma, DGD.aml, DGD.Dla}, GDB_RT.LOC) -- arco interno P24 a P25 else nMId = EgtArcC2P( nLl, {((DGD.dW/2)+DGD.tProfs.top.xdeltapos), (DGD.dH-DGD.tProfs.top.ydeltapos), DGD.Dra}, { DGD.RMa, DGD.AMr, DGD.Dra}, { DGD.LMa, DGD.AMl, DGD.Dla}, GDB_RT.LOC) -- arco p22 a p23 end EgtModifyCurveThickness( nMId, DGD.dT) EgtSetName( nMId, sTopType .. EgtIf( string.find( sTopType,'EB'), DGD.EBP, '') .. '_H') EgtSetColor( nMId, BLACK()) EgtSetInfo( nMId, 'EdgeDoor', 'T') elseif DGD.Tpa then -- se top ad angolo if sTopType == 'BD' or sTopType == 'BU' or sTopType == 'BDEB' or sTopType == 'BUEB' or sTopType == 'SQ' or sTopType == 'EB' or sTopType == 'BV' or sTopType == 'BVEB' or sTopType == 'FDWC' then -- profilo top if DGD.Push then if DGD.tProfs.top.xdeltapos > 0 then local nE1 = EgtLine( nLl, {DGD.Rua,DGD.Aur,DGD.Dra}, {DGD.Cmu,DGD.Aut,DGD.Dla}) -- p14 a p19 local nE2 = EgtLine( nLl, {DGD.Cmu,DGD.Aut,DGD.Dla}, {DGD.Lua,DGD.Aul,DGD.Dla}) -- p19 a p13 -- eventuale allungamento percorso sull'inizio local dDistMax = max(DGD.Rda,DGD.Rua,DGD.Rma) - min(DGD.Rda,DGD.Rua,DGD.Rma) if dDistMax > GEO.EPS_SMALL and abs(max(DGD.Rda,DGD.Rua,DGD.Rma) - DGD.Rua) > GEO.EPS_SMALL then local sVecIni = EgtSV(nE1) local dCompoY = (dDistMax/sVecIni:getX()*sVecIni:getY()) EgtTrimExtendCurveByLen( nE1, sqrt( (dDistMax*dDistMax) + (dCompoY*dCompoY)) ,{DGD.Rua,DGD.Aur,DGD.Dra}) end -- eventuale allungamento percorso sulla fine dDistMax = max(DGD.Lda,DGD.Lua,DGD.Lma) - min(DGD.Lda,DGD.Lua,DGD.Lma) if dDistMax > GEO.EPS_SMALL and abs(min(DGD.Lda,DGD.Lua,DGD.Lma) - DGD.Lua) > GEO.EPS_SMALL then local sVecIni = EgtEV(nE2) local dCompoY = (dDistMax/sVecIni:getX()*sVecIni:getY()) EgtTrimExtendCurveByLen( nE2, sqrt( (dDistMax*dDistMax) + (dCompoY*dCompoY)), {DGD.Lua,DGD.Aul,DGD.Dla}) end nMId = EgtCurveCompo( nLl, {nE1,nE2}, true) else nMId = EgtLine( nLl, {DGD.Rua,DGD.Aur,DGD.Dra}, {DGD.Lua,DGD.Aul,DGD.Dla}) -- p14 a p13 -- eventuale allungamento percorso sull'inizio local dDistMax = max(DGD.Rda,DGD.Rua,DGD.Rma) - min(DGD.Rda,DGD.Rua,DGD.Rma) if dDistMax > GEO.EPS_SMALL and abs(max(DGD.Rda,DGD.Rua,DGD.Rma) - DGD.Rua) > GEO.EPS_SMALL then local sVecIni = EgtSV(nMId) local dCompoY = (dDistMax/sVecIni:getX()*sVecIni:getY()) EgtTrimExtendCurveByLen( nMId, sqrt( (dDistMax*dDistMax) + (dCompoY*dCompoY)) ,{DGD.Rua,DGD.Aur,DGD.Dra}) end -- eventuale allungamento percorso sulla fine dDistMax = max(DGD.Lda,DGD.Lua,DGD.Lma) - min(DGD.Lda,DGD.Lua,DGD.Lma) if dDistMax > GEO.EPS_SMALL and abs(min(DGD.Lda,DGD.Lua,DGD.Lma) - DGD.Lua) > GEO.EPS_SMALL then local sVecIni = EgtEV(nMId) local dCompoY = (dDistMax/sVecIni:getX()*sVecIni:getY()) EgtTrimExtendCurveByLen( nMId, sqrt( (dDistMax*dDistMax) + (dCompoY*dCompoY)), {DGD.Lua,DGD.Aul,DGD.Dla}) end end else if DGD.tProfs.top.xdeltapos > 0 then local nE1 = EgtLine( nLl, {DGD.Rda,DGD.Adr,DGD.Dra}, {DGD.Cmd,DGD.Adt,DGD.Drt}) -- p15 a p20 local nE2 = EgtLine( nLl, {DGD.Cmd,DGD.Adt,DGD.Drt}, {DGD.Lda,DGD.Adl,DGD.Dla}) -- p20 a p16 -- eventuale allungamento percorso sull'inizio local dDistMax = max(DGD.Rda,DGD.Rua,DGD.Rma) - min(DGD.Rda,DGD.Rua,DGD.Rma) if dDistMax > GEO.EPS_SMALL and abs( max(DGD.Rda,DGD.Rua,DGD.Rma) - DGD.Rda) > GEO.EPS_SMALL then local sVecIni = EgtSV(nE1) local dCompoY = (dDistMax/sVecIni:getX()*sVecIni:getY()) EgtTrimExtendCurveByLen( nE1, sqrt( (dDistMax*dDistMax) + (dCompoY*dCompoY)) ,{DGD.Rda,DGD.Adr,DGD.Dra}) end -- eventuale allungamento percorso sulla fine dDistMax = max( DGD.Lda,DGD.Lua,DGD.Lma) - min(DGD.Lda,DGD.Lua,DGD.Lma) if dDistMax > GEO.EPS_SMALL and abs( min(DGD.Lda,DGD.Lua,DGD.Lma) - DGD.Lda) > GEO.EPS_SMALL then local sVecIni = EgtEV(nE2) local dCompoY = (dDistMax/sVecIni:getX()*sVecIni:getY()) EgtTrimExtendCurveByLen( nE2, sqrt( (dDistMax*dDistMax) + (dCompoY*dCompoY)), {DGD.Lda,DGD.Adl,DGD.Dla}) end nMId = EgtCurveCompo( nLl, {nE1,nE2}, true) else nMId = EgtLine( nLl, {DGD.Rda,DGD.Adr,DGD.Dra}, {DGD.Lda,DGD.Adl,DGD.Dla}) -- p15 a p16 -- eventuale allungamento percorso sull'inizio local dDistMax = max(DGD.Rda,DGD.Rua,DGD.Rma) - min(DGD.Rda,DGD.Rua,DGD.Rma) if dDistMax > GEO.EPS_SMALL and abs(max(DGD.Rda,DGD.Rua,DGD.Rma) - DGD.Rda) > GEO.EPS_SMALL then local sVecIni = EgtSV(nMId) local dCompoY = (dDistMax/sVecIni:getX()*sVecIni:getY()) EgtTrimExtendCurveByLen( nMId, sqrt( (dDistMax*dDistMax) + (dCompoY*dCompoY)) ,{DGD.Rda,DGD.Adr,DGD.Dra}) end -- eventuale allungamento percorso sulla fine dDistMax = max(DGD.Lda,DGD.Lua,DGD.Lma) - min(DGD.Lda,DGD.Lua,DGD.Lma) if dDistMax > GEO.EPS_SMALL and abs(min(DGD.Lda,DGD.Lua,DGD.Lma) - DGD.Lda) > GEO.EPS_SMALL then local sVecIni = EgtEV(nMId) local dCompoY = (dDistMax/sVecIni:getX()*sVecIni:getY()) EgtTrimExtendCurveByLen( nMId, sqrt( (dDistMax*dDistMax) + (dCompoY*dCompoY)), {DGD.Lda,DGD.Adl,DGD.Dla}) end end end else if DGD.tProfs.top.xdeltapos > 0 then local nE1 = EgtLine( nLl, {DGD.Rma,DGD.Amr,DGD.Dra}, {DGD.Cmm,DGD.Amt,DGD.Drt}) -- p18 a p21 local nE2 = EgtLine( nLl, {DGD.Cmm,DGD.Amt,DGD.Drt}, {DGD.Lma,DGD.Aml,DGD.Dla}) -- p21 a p17 -- eventuale allungamento percorso sull'inizio local dDistMax = max(DGD.Rda,DGD.Rua,DGD.Rma) - min(DGD.Rda,DGD.Rua,DGD.Rma) if dDistMax > GEO.EPS_SMALL and abs( max(DGD.Rda,DGD.Rua,DGD.Rma) - DGD.Rma) > GEO.EPS_SMALL then local sVecIni = EgtSV(nE1) local dCompoY = (dDistMax/sVecIni:getX()*sVecIni:getY()) EgtTrimExtendCurveByLen( nE1, sqrt( (dDistMax*dDistMax) + (dCompoY*dCompoY)) ,{DGD.Rdm,DGD.Amr,DGD.Dra}) end -- eventuale allungamento percorso sulla fine dDistMax = max( DGD.Lda,DGD.Lua,DGD.Lma) - min(DGD.Lda,DGD.Lua,DGD.Lma) if dDistMax > GEO.EPS_SMALL and abs( min(DGD.Lda,DGD.Lua,DGD.Lma) - DGD.Lma) > GEO.EPS_SMALL then local sVecIni = EgtEV(nE2) local dCompoY = (dDistMax/sVecIni:getX()*sVecIni:getY()) EgtTrimExtendCurveByLen( nE2, sqrt( (dDistMax*dDistMax) + (dCompoY*dCompoY)), {DGD.Lma,DGD.Aml,DGD.Dla}) end nMId = EgtCurveCompo( nLl, {nE1,nE2}, true) else nMId = EgtLine( nLl, {DGD.Rma,DGD.Amr,DGD.Dra}, {DGD.Lma,DGD.Aml,DGD.Dla}) -- p18 a p17 -- eventuale allungamento percorso sull'inizio local dDistMax = max(DGD.Rda,DGD.Rua,DGD.Rma) - min(DGD.Rda,DGD.Rua,DGD.Rma) if dDistMax > GEO.EPS_SMALL and abs(max(DGD.Rda,DGD.Rua,DGD.Rma) - DGD.Rma) > GEO.EPS_SMALL then local sVecIni = EgtSV(nMId) local dCompoY = (dDistMax/sVecIni:getX()*sVecIni:getY()) EgtTrimExtendCurveByLen( nMId, sqrt( (dDistMax*dDistMax) + (dCompoY*dCompoY)) ,{DGD.Rma,DGD.Amr,DGD.Dra}) end -- eventuale allungamento percorso sulla fine dDistMax = max(DGD.Lda,DGD.Lua,DGD.Lma) - min(DGD.Lda,DGD.Lua,DGD.Lma) if dDistMax > GEO.EPS_SMALL and abs(min(DGD.Lda,DGD.Lua,DGD.Lma) - DGD.Lma) > GEO.EPS_SMALL then local sVecIni = EgtEV(nMId) local dCompoY = (dDistMax/sVecIni:getX()*sVecIni:getY()) EgtTrimExtendCurveByLen( nMId, sqrt( (dDistMax*dDistMax) + (dCompoY*dCompoY)), {DGD.Lma,DGD.Aml,DGD.Dla}) end end end EgtModifyCurveThickness( nMId, DGD.dT) EgtSetName( nMId, sTopType .. EgtIf( string.find( sTopType,'EB'), DGD.EBP, '') .. '_H') EgtSetColor( nMId, BLACK()) EgtSetInfo( nMId, 'EdgeDoor', 'T') else if sTopType == 'BD' or sTopType == 'BU' or sTopType == 'BDEB' or sTopType == 'BUEB' or sTopType == 'SQ' or sTopType == 'EB' or sTopType == 'FDWC' then nMId = EgtLine( nLl, {max(DGD.Rdt,DGD.Rm,DGD.Rut),DGD.Tdr,DGD.Drt}, {min(DGD.Ldt,DGD.Lm,DGD.Lut),DGD.Tdl,DGD.Dlt}) -- p9 a p10 if sTopType == 'BD' or sTopType == 'BU' or sTopType == 'BDEB' or sTopType == 'BUEB' then if DGD.Push then EgtModifyCurveExtrusion( nMId, Vector3d( 0, -SIN3, COS3), GDB_RT.GLOB) else EgtModifyCurveExtrusion( nMId, Vector3d( 0, SIN3, COS3), GDB_RT.GLOB) end EgtModifyCurveThickness( nMId, DGD.dT / COS3) else -- SQ/EB/FDWC EgtModifyCurveThickness( nMId, DGD.dT) end EgtSetName( nMId, sTopType .. EgtIf( string.find( sTopType,'EB'), DGD.EBP, '') .. '_H') EgtSetColor( nMId, BLACK()) EgtSetInfo( nMId, 'EdgeDoor', 'T') -- creo percorsi anti-scheggia lungo lo spessore -- griglia a destra per percorso a destra EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.RIGHT)) if sRightType == 'SQ' or sRightType == 'EB' or sRightType == 'BD' or sRightType == 'BU' or sRightType == 'BDEB' or sRightType == 'BUEB' or sRightType == 'FDWC' then nAsr = EgtLine( nLl, {DGD.Tdr,DGD.Drt,DGD.Rdt}, {DGD.Tur,DGD.Urt,DGD.Rut}, GDB_RT.GRID) -- p9 a p8 else nAsr = EgtLine( nLl, {DGD.Tdr,DGD.Drt,max(DGD.Rdt,DGD.Rm,DGD.Rut)}, {DGD.Tur,DGD.Urt,max(DGD.Rdt,DGD.Rm,DGD.Rut)}, GDB_RT.GRID) -- p9 a p8 end EgtModifyCurveThickness( nAsr, 0) EgtSetColor( nAsr, BLACK()) -- griglia a sinistra per percorso a sinistra EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.LEFT)) if sLeftType == 'SQ' or sLeftType == 'EB' or sLeftType == 'BD' or sLeftType == 'BU' or sLeftType == 'BDEB' or sLeftType == 'BUEB' or sLeftType == 'FDWC' then nAsl = EgtLine( nLl, {-DGD.Tul,DGD.Ult,-DGD.Lut}, {-DGD.Tdl,DGD.Dlt,-DGD.Ldt}, GDB_RT.GRID) -- p7 a p10 else nAsl = EgtLine( nLl, {-DGD.Tul,DGD.Ult,-(min(DGD.Lut,DGD.Lm,DGD.Ldt))}, {-DGD.Tdl,DGD.Dlt,-(min(DGD.Lut,DGD.Lm,DGD.Ldt))}, GDB_RT.GRID) -- p7 a p10 end EgtModifyCurveThickness( nAsl, 0) EgtSetColor( nAsl, BLACK()) EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) if DGD.Lock == 'R' then EgtSetName( nAsl, 'ASLT_HNG') -- indico nel nome che è sul lato hinge EgtSetName( nAsr, 'ASRT') else EgtSetName( nAsl, 'ASLT') EgtSetName( nAsr, 'ASRT_HNG') -- indico nel nome che è sul lato hinge end elseif sTopType == '1B' or sTopType == '2B' or sTopType == '3B' or sTopType == '4B' or sTopType == '5B' or sTopType == '6B' or sTopType == '7B' or sTopType == '8B' then nMId = EgtLine( nLl, {max(DGD.Rdt,DGD.Rm,DGD.Rut),DGD.Tdr,DGD.Drt}, {min(DGD.Ldt,DGD.Lm,DGD.Lut),DGD.Tdl,DGD.Dlt}) -- p9 a p10 EgtModifyCurveThickness( nMId, DGD.dT) EgtSetName( nMId, sTopType..'_H') EgtSetColor( nMId, BLACK()) EgtSetInfo( nMId, 'EdgeDoor', 'T') --[[ -- creo percorsi antischeggia lungo lo spessore -- griglia a destra per percorso a destra EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.RIGHT)) nAsr = EgtLine( nLl, {max(DGD.Tdr,DGD.Tur),DGD.Drt,max(DGD.Rdt,DGD.Rm,DGD.Rut)}, {max(DGD.Tdr,DGD.Tur),DGD.Urt,max(DGD.Rdt,DGD.Rm,DGD.Rut)}, GDB_RT.GRID) -- p9 a p8 EgtModifyCurveThickness( nAsr, 0) EgtSetColor( nAsr, BLACK()) -- griglia a sinistra per percorso a sinistra EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.LEFT)) nAsl = EgtLine( nLl, {-(max(DGD.Tul,DGD.Tdl)),DGD.Ult,-(min(DGD.Lut,DGD.Lm,DGD.Ldt))}, {-(max(DGD.Tul,DGD.Tdl)),DGD.Dlt,-(min(DGD.Lut,DGD.Lm,DGD.Ldt))}, GDB_RT.GRID) -- p7 a p10 EgtModifyCurveThickness( nAsl, 0) EgtSetColor( nAsl, BLACK()) if DGD.Lock == 'R' then EgtSetName( nAsl, 'ASLT_HNG') -- indico nel nome che è sul lato hinge EgtSetName( nAsr, 'ASRT') else EgtSetName( nAsl, 'ASLT') EgtSetName( nAsr, 'ASRT_HNG') -- indico nel nome che è sul lato hinge end ]]-- elseif sTopType == 'CV' then nMId = EgtLine( nLl, {max(DGD.Rdt,DGD.Rm,DGD.Rut),DGD.Tmr,DGD.Drt}, {min(DGD.Ldt,DGD.Lm,DGD.Lut),DGD.Tml,DGD.Dlt}) -- p9 a p10 EgtModifyCurveThickness( nMId, DGD.dT) EgtSetName( nMId, sTopType..'_H') EgtSetColor( nMId, BLACK()) EgtSetInfo( nMId, 'EdgeDoor', 'T') --[[ -- creo percorsi antischeggia lungo lo spessore -- griglia a destra per percorso a destra EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.RIGHT)) nAsr = EgtLine( nLl, {max(DGD.Tdr,DGD.Tur),DGD.Drt,max(DGD.Rdt,DGD.Rm,DGD.Rut)}, {max(DGD.Tdr,DGD.Tur),DGD.Urt,max(DGD.Rdt,DGD.Rm,DGD.Rut)}, GDB_RT.GRID) -- p9 a p8 EgtModifyCurveThickness( nAsr, 0) EgtSetColor( nAsr, BLACK()) -- griglia a sinistra per percorso a sinistra EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.LEFT)) nAsl = EgtLine( nLl, {-(max(DGD.Tul,DGD.Tdl)),DGD.Ult,-(min(DGD.Lut,DGD.Lm,DGD.Ldt))}, {-(max(DGD.Tul,DGD.Tdl)),DGD.Dlt,-(min(DGD.Lut,DGD.Lm,DGD.Ldt))}, GDB_RT.GRID) -- p7 a p10 EgtModifyCurveThickness( nAsl, 0) EgtSetColor( nAsl, BLACK()) if DGD.Lock == 'R' then EgtSetName( nAsl, 'ASLT_HNG') -- indico nel nome che è sul lato hinge EgtSetName( nAsr, 'ASRT') else EgtSetName( nAsl, 'ASLT') EgtSetName( nAsr, 'ASRT_HNG') -- indico nel nome che è sul lato hinge end ]]-- end end end end -- elimino le 12 linee EgtErase(nDoorBot) EgtErase(nDoorLeft) EgtErase(nDoorTop) EgtErase(nDoorRight) EgtErase(nDoorBotMid) EgtErase(nDoorLeftMid) EgtErase(nDoorTopMid) EgtErase(nDoorRightMid) EgtErase(nDoorBotTop) EgtErase(nDoorLeftTop) EgtErase(nDoorTopTop) EgtErase(nDoorRightTop) -- per i frame risetto le variabili profilo a SQ if DGD.sFrame then DGD.tProfs.hingeedge.trimming = 'SQ' DGD.tProfs.lockedge.trimming = 'SQ' end -- inserisco sfinestrature if #DGD.tVisions > 0 then InsertGeom( DGD.tVisions, DGD.Lock, DGD.Push, 'vision') end -- inserisco sfinestrature inferiori if #DGD.tLouvers > 0 then InsertGeom( DGD.tLouvers, DGD.Lock, DGD.Push, 'louver') end -- inserisco sfinestrature inferiori mail slot if #DGD.tMailSlots > 0 then InsertGeom( DGD.tMailSlots, DGD.Lock, DGD.Push, 'mail') end -- inserisco spioncini if #DGD.tViewers > 0 then InsertGeom( DGD.tViewers, DGD.Lock, DGD.Push, 'viewer') end -- inserisco disegni flush pull if #DGD.tFlushPulls > 0 then InsertGeom( DGD.tFlushPulls, DGD.Lock, DGD.Push, 'flush') end -- inserisco disegni cerniere if #DGD.tHinges > 0 then nNumHingePivot = nNumHingePivot + #DGD.tHinges -- prendo il numero di cerniere inserite InsertGeom( DGD.tHinges, DGD.Lock, DGD.Push, 'hinge') end -- inserisco disegni EPT if #DGD.tEPTs > 0 then InsertGeom( DGD.tEPTs, DGD.Lock, DGD.Push, 'ept') end --inserisco disegni serrature if #DGD.tLocks > 0 then InsertGeom( DGD.tLocks, DGD.Lock, DGD.Push, 'lock') end --inserisco disegni flush bolt if #DGD.tFlushBolts > 0 then InsertGeom( DGD.tFlushBolts, DGD.Lock, DGD.Push, 'flushbolt') end --inserisco disegni edge pull if #DGD.tEdgePulls > 0 then InsertGeom( DGD.tEdgePulls, DGD.Lock, DGD.Push, 'edgepull') end --inserisco disegni Roller Latch if #DGD.tRollerLatchs > 0 then InsertGeom( DGD.tRollerLatchs, DGD.Lock, DGD.Push, 'rollerlatch') end --inserisco disegni Pivot if #DGD.tPivots > 0 then InsertGeom( DGD.tPivots, DGD.Lock, DGD.Push, 'pivot') end --inserisco disegni stops and closers if #DGD.tStopsAndClosers > 0 then InsertGeom( DGD.tStopsAndClosers, DGD.Lock, DGD.Push, 'stopandcloser') end --inserisco disegni over heads if #DGD.tOHeads > 0 then InsertGeom( DGD.tOHeads, DGD.Lock, DGD.Push, 'overhead') end --inserisco disegni strike if #DGD.tStrikes > 0 then InsertGeom( DGD.tStrikes, DGD.Lock, DGD.Push, 'strike') end --inserisco disegni groove if #DGD.tGrooves > 0 then InsertGeom( DGD.tGrooves, DGD.Lock, DGD.Push, 'groove') end --inserisco disegni rabbet if #DGD.tRabbets > 0 then InsertGeom( DGD.tRabbets, DGD.Lock, DGD.Push, 'rabbet') end --inserisco disegni face decoration if #DGD.tDecorations > 0 then InsertGeom( DGD.tDecorations, DGD.Lock, DGD.Push, 'facedecoration') end --debug -- EgtSaveFile() -- EgtMove(DGD.PZ, Point3d(0,0,nil) - ORIG()) -- sottraggo le superfici in modo da avere la visualizzazione della porta con le sfinestrature -- ed elimino le superfici temporanee SubAndDeleteTempSurf( nLs) if DGD.sFrame then if nTypePiece == 3 then -- se frame SX EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.FRONT)) EgtRotate( DGD.PZ, Point3d(0,0,0), Z_AX(), 90, GDB_RT.GRID) -- ruoto su faccia frontale EgtMove( DGD.PZ, Point3d(DGD.dT,0,0) - ORIG(), GDB_RT.GRID) EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) elseif nTypePiece == 4 then -- se frame DX EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.FRONT)) EgtRotate( DGD.PZ, Point3d(DGD.dW,0,0), Z_AX(), -90, GDB_RT.GRID) -- ruoto su faccia frontale EgtMove( DGD.PZ, Point3d(-DGD.dW,0,0) - ORIG(), GDB_RT.GRID) EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) elseif nTypePiece == 5 then -- tipo frame top EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.LEFT)) EgtRotate( DGD.PZ, Point3d(-DGD.dH,0,0), Z_AX(), 90, GDB_RT.GRID) -- ruoto su faccia sinistra EgtMove( DGD.PZ, Point3d(DGD.dH,0,0) - ORIG(), GDB_RT.GRID) EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) EgtRotate( DGD.PZ, Point3d(0,0,0), Z_AX(), 90, GDB_RT.GRID) -- ruoto su faccia top EgtMove( DGD.PZ, Point3d(DGD.dT,0,0) - ORIG(), GDB_RT.GRID) else -- tipo frame bottom EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.LEFT)) EgtRotate( DGD.PZ, Point3d(0,0,0), Z_AX(), -90, GDB_RT.GRID) -- ruoto su faccia sinistra EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) EgtRotate( DGD.PZ, Point3d(0,0,0), Z_AX(), 90, GDB_RT.GRID) -- ruoto su faccia top end end -- scritta TOP per debug if DGD.sFrame then if nTypePiece == 3 or nTypePiece == 4 then -- se frame SX o DX EgtText(nLa,{ 5, DGD.dH - 100, DGD.dW},'TOP-'.. EgtIf( nTypePiece == 3, 'JL', 'JR') .. '-' .. DGD.sAliasSwng,20,GDB_RT.GLOB) else EgtText(nLa,{ 5, DGD.dW - 100, DGD.dH},'TOP-'.. EgtIf( nTypePiece == 5, 'JT', 'JB') .. '-' .. DGD.sAliasSwng,20,GDB_RT.GLOB) end else if DGD.tProfs.top.angle then -- faccio il calcolo per capire se taglia la scritta local nDltPosY if DGD.tProfs.top.angle > 0 then nDltPosY = ( DGD.dW - DGD.tProfs.top.xdeltapos - (0.5*(DGD.Lut+DGD.Rut)-150)) * tan(DGD.tProfs.top.angle) else nDltPosY = ( ( 0.5*(DGD.Lut+DGD.Rut)+150) - DGD.tProfs.top.xdeltapos) * tan(abs(DGD.tProfs.top.angle)) end if nDltPosY < 0 then nDltPosY = 0 end EgtText(nLa,{ 0.5*(DGD.Lut+DGD.Rut)-150, DGD.Tul - 100 - nDltPosY, DGD.dT},'TOP-'..DGD.sAliasSwng,50,GDB_RT.GLOB) else EgtText(nLa,{ 0.5*(DGD.Lut+DGD.Rut)-150, DGD.Tul - 100, DGD.dT},'TOP-'..DGD.sAliasSwng,50,GDB_RT.GLOB) end EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) end ------------------- -- quotatura porta ------------------- InsertSize( 0, nil, ptMedArc, nil) return true end ----------------------------------------------------------------- -- *** read Probe file *** ----------------------------------------------------------------- local function LoadDataProbeFile( sOriProbeFile, sProbeFile) local bReadFile = true if DGD.PROBE == 2 then local nIdPrb = OpenPrbFile( sOriProbeFile, 'r') -- se trovato il file generico data.dat lo rinomino in .dat if nIdPrb then nIdPrb:close() -- chiudo il file EgtCopyFile( sOriProbeFile, sProbeFile) -- faccio la copia sovrascrivendo l'eventuale file .dat -- elimino il file data.dat così poi c'è il tempo per riaprire il file .dat EgtEraseFile( sOriProbeFile) end nIdPrb = OpenPrbFile( sProbeFile, 'r') if nIdPrb then -- leggo la prossima linea local sLine = nIdPrb:read( '*l') while sLine do -- elimino spazi finali (compresi tab e simili) sLine = EgtTrimRight( sLine) -- se linea contiene qualcosa if sLine:len() > 0 then -- se non ci sono commenti local nI = sLine:find( ';', 1, true) if not nI then if sLine:find( 'OPM=', 1, true) then sLine = sLine:sub( 5) tProbeDoor.OPM = tonumber(sLine) elseif sLine:find( 'P1.x=', 1, true) then sLine = sLine:sub( 6) tProbeDoor.P1x = tonumber(sLine) elseif sLine:find( 'P1.y=', 1, true) then sLine = sLine:sub( 6) tProbeDoor.P1y = tonumber(sLine) elseif sLine:find( 'P2.x=', 1, true) then sLine = sLine:sub( 6) tProbeDoor.P2x = tonumber(sLine) elseif sLine:find( 'P2.y=', 1, true) then sLine = sLine:sub( 6) tProbeDoor.P2y = tonumber(sLine) elseif sLine:find( 'P3.x=', 1, true) then sLine = sLine:sub( 6) tProbeDoor.P3x = tonumber(sLine) elseif sLine:find( 'P3.y=', 1, true) then sLine = sLine:sub( 6) tProbeDoor.P3y = tonumber(sLine) elseif sLine:find( 'P4.x=', 1, true) then sLine = sLine:sub( 6) tProbeDoor.P4x = tonumber(sLine) elseif sLine:find( 'P4.y=', 1, true) then sLine = sLine:sub( 6) tProbeDoor.P4y = tonumber(sLine) elseif sLine:find( 'P5.x=', 1, true) then sLine = sLine:sub( 6) tProbeDoor.P5x = tonumber(sLine) elseif sLine:find( 'P5.y=', 1, true) then sLine = sLine:sub( 6) tProbeDoor.P5y = tonumber(sLine) elseif sLine:find( 'P6.x=', 1, true) then sLine = sLine:sub( 6) tProbeDoor.P6x = tonumber(sLine) elseif sLine:find( 'P6.y=', 1, true) then sLine = sLine:sub( 6) tProbeDoor.P6y = tonumber(sLine) elseif sLine:find( 'P7.x=', 1, true) then sLine = sLine:sub( 6) tProbeDoor.P7x = tonumber(sLine) elseif sLine:find( 'P7.y=', 1, true) then sLine = sLine:sub( 6) tProbeDoor.P7y = tonumber(sLine) elseif sLine:find( 'P8.x=', 1, true) then sLine = sLine:sub( 6) tProbeDoor.P8x = tonumber(sLine) elseif sLine:find( 'P8.y=', 1, true) then sLine = sLine:sub( 6) tProbeDoor.P8y = tonumber(sLine) elseif sLine:find( 'FD=', 1, true) then sLine = sLine:sub( 4) tProbeDoor.FD = tonumber(sLine) elseif sLine:find( 'TD=', 1, true) then sLine = sLine:sub( 4) tProbeDoor.TD = tonumber(sLine) elseif sLine:find( 'DR=', 1, true) then sLine = sLine:sub( 4) tProbeDoor.DR = EgtIf( DGD.bMM, 1, GEO.ONE_INCH)*tonumber(sLine) elseif sLine:find( 'DO=', 1, true) then sLine = sLine:sub( 4) tProbeDoor.DO = EgtIf( DGD.bMM, 1, GEO.ONE_INCH)*tonumber(sLine) elseif sLine:find( 'DD=', 1, true) then sLine = sLine:sub( 4) tProbeDoor.DD = tonumber(sLine) elseif sLine:find( 'PX=', 1, true) then sLine = sLine:sub( 4) tProbeDoor.PX = tonumber(sLine) elseif sLine:find( 'PY=', 1, true) then sLine = sLine:sub( 4) tProbeDoor.PY = tonumber(sLine) elseif sLine:find( 'PZ=', 1, true) then sLine = sLine:sub( 4) tProbeDoor.PZ = tonumber(sLine) -- se lo spessore passato è 0 lo setto allo spessore nominale if abs(tProbeDoor.PZ) < GEO.EPS_SMALL then tProbeDoor.PZ = DGD.dT end end end end sLine = nIdPrb:read( '*l') end -- chiudo il file nIdPrb:close() else bReadFile = false end end return bReadFile end ----------------------------------------------------------------- -- *** Verify Mtable *** ----------------------------------------------------------------- local function VerifyMtable() local M local bLocFoundMTable = true -- verifico se esiste il nome file if not sMTable or #sMTable <= 0 then bLocFoundMTable = false end if bLocFoundMTable and DGD.MachEn > 0 then -- verifico se esiste il file sMTablePath = sBaseDir..'MTables\\'..sMTable..'.mtl' if EgtExistsFile(sMTablePath) then sMTablePath = sBaseDir..'MTables\\' M = require( sMTable) if M then tMachineData = M.MMachineData if not tMachineData then local sMessageErr = string.format( EgtDoorsMsg[489], sMTable) -- dati macchina non validi DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr DGD.ERR = 25 -- WriteErrFile( sErrFileM) bLocFoundMTable = false end else local sMessageErr = string.format( EgtDoorsMsg[490], sMTable) -- tabella non trovata DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr DGD.ERR = 24 -- WriteErrFile( sErrFileM) bLocFoundMTable = false end else local sMessageErr = string.format( EgtDoorsMsg[487], 'Mtable ',sMTablePath) -- non c'è il file della tabella DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr DGD.ERR = 23 -- WriteErrFile( sErrFileM) bLocFoundMTable = false end elseif DGD.MachEn > 0 then local sMessageErr = string.format( EgtDoorsMsg[487], 'Mtable ', sMTable) -- il nome del file della tabella non è valido DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr DGD.ERR = 22 -- WriteErrFile( sErrFileM) end return bLocFoundMTable end ----------------------------------------------------------------- -- *** DOOR creation *** ----------------------------------------------------------------- local function DoorCreation() local bLocFoundMTable = true -- Creo pezzo porta EgtNewFile() DGD.PZ = EgtGroup( GDB_ID.ROOT) if not DGD.sFrame then EgtSetName( DGD.PZ, 'DOOR') elseif DGD.sFrame == 'L' then EgtSetName( DGD.PZ, 'FRAME_LOCK') elseif DGD.sFrame == 'LE' then EgtSetName( DGD.PZ, 'FRAME_LOCK_EXT') elseif DGD.sFrame == 'H' then EgtSetName( DGD.PZ, 'FRAME_HINGE') elseif DGD.sFrame == 'HE' then EgtSetName( DGD.PZ, 'FRAME_HINGE_EXT') elseif DGD.sFrame == 'T' then EgtSetName( DGD.PZ, 'FRAME_TOP') elseif DGD.sFrame == 'TE' then EgtSetName( DGD.PZ, 'FRAME_TOP_EXT') elseif DGD.sFrame == 'B' then EgtSetName( DGD.PZ, 'FRAME_BOT') elseif DGD.sFrame == 'BE' then EgtSetName( DGD.PZ, 'FRAME_BOT_EXT') end EgtSetCurrPartLayer( DGD.PZ, GDB_ID.NULL) -- scrivo le note local tAppo local sParam, sValue for i = 1, #tGenInfo do tAppo = tGenInfo[i] sParam = tAppo[1] sValue = tAppo[2] EgtSetInfo( DGD.PZ, sParam, sValue) end -- nota del frame EgtSetInfo( DGD.PZ, 'Frame', DGD.sFrame) -- controllo la macchina solo se ho abilitato la generazione della geometria di lavorazione if DGD.MachEn > 0 then -- faccio qui il controllo come frame deve essere disposto ed eventualmente modifico la Mtable if DGD.sFrame then local nDispJamb = 0 if DGC.Dwjs and DGD.Material and string.lower(DGD.Material) == 'wood' then nDispJamb = DGC.Dwjs elseif DGC.Dsjs and DGD.Material and string.lower(DGD.Material) == 'steel' then nDispJamb = DGC.Dsjs elseif DGC.Dajs and DGD.Material and string.lower(DGD.Material) == 'aluminum' then nDispJamb = DGC.Dajs elseif DGC.Dfjs and DGD.Material and string.lower(DGD.Material) == 'fiberglass' then nDispJamb = DGC.Dfjs end -- setto la disposizione di piatto o di fianco dei jamb laterali e superiore, -- per quello inferiore, se le dimensioni della sezione sono sotto un certo valore, viene disposto solo di piatto if nTypePiece == 3 then -- se frame SX if nDispJamb > 0 and DGD.dW > DGC.Mjn then -- se disposizione sul lato narrow e lato maggiore del valore minimo DGD.Dws = false else DGD.Dws = true end elseif nTypePiece == 4 then -- se frame DX if nDispJamb > 0 and DGD.dW > DGC.Mjn then -- se disposizione sul lato narrow e lato maggiore del valore minimo DGD.Dws = false else DGD.Dws = true end elseif nTypePiece == 5 then -- tipo frame top if nDispJamb > 0 and DGD.dH > DGC.Mjn then -- se disposizione sul lato narrow e lato maggiore del valore minimo DGD.Dws = false else DGD.Dws = true end else -- tipo frame bottom if nDispJamb > 0 and DGD.dH > DGC.Mjn then -- se disposizione sul lato narrow e lato maggiore del valore minimo DGD.Dws = false else DGD.Dws = true end end -- se ho disposto eventuale frame sul lato wide modifico il nome della Mtable e la verifico if DGD.Dws then sMTable = sMTable .. '_wide' bLocFoundMTable = VerifyMtable() end DGD.Spd = DGC.Spd or 0 else DGD.Dws = nil DGD.Spd = 0 end -- Check machines and search into CurrCamInfo the parameter for manage large wide door for i = 1, #tMachineData do -- se nome macchina non c'è if not tMachineData[i].MachName then DoorOutLog( string.format(EgtDoorsMsg[488], tMachineData[i].MachName), 0) DGD.ERM = DGD.ERM .. '\n' .. string.format(EgtDoorsMsg[488], tMachineData[i].MachName) DGD.ERR = -12 -- se non c'è la macchina elseif not EgtSetCurrMachine( tMachineData[i].MachName) then DoorOutLog( string.format(EgtDoorsMsg[488], tMachineData[i].MachName), 0) DGD.ERM = DGD.ERM .. '\n' .. string.format(EgtDoorsMsg[488], tMachineData[i].MachName) DGD.ERR = -11 -- macchina presente else local CCI = require( 'CurrCamInfo') for j = 1, #CCI do if CCI[j].MachName == tMachineData[i].MachName then if CCI[j].WideDoorWidth and CCI[j].WideDoorWidth > 0 then DGD.Part = CCI[j].WideDoorWidth end if CCI[j].SideDoorDefined and CCI[j].SideDoorDefined >= 0 then DGD.SDF = CCI[j].SideDoorDefined end end end end end -- Note della tabella utilizzata ( deve essere settata prima di creare il pezzo con CreateDoor() perchè i componenti inseriti vanno ad utilizzarla) EgtSetInfo( DGD.PZ, 'MTable', sMTable) EgtSetInfo( DGD.PZ, 'MTablePath', sMTablePath) -- setto il tipo di disposizione del frame EgtSetInfo( DGD.PZ, 'FrameDispositionOnSide', DGD.Dws) -- setto la nota per large wide door if DGD.Part and DGD.Part > 0 then EgtSetInfo( DGD.PZ, 'ManageLargeWideDoor', DGD.Part) end end -- Note della disposizione EgtSetInfo( DGD.PZ, 'SwingDriveDisp', DGD.SwDD or 1) if bLocFoundMTable then ------------------------------------------------------ ------------------------------------------------------ -- Costruzione della porta local bOk, nNumErr, sMessErr = CreateDoor() ------------------------------------------------------ ------------------------------------------------------ -- In caso di errore, lo segnalo if not bOk then if nNumErr == 0 then DoorOutLog( EgtDoorsMsg[454], 0) DGD.ERM = DGD.ERM .. '\n' .. EgtDoorsMsg[454] DGD.ERR = 10 elseif nNumErr == 1 then DoorOutLog( EgtDoorsMsg[630], 0) DGD.ERM = DGD.ERM .. '\n' .. EgtDoorsMsg[630] DGD.ERR = 11 elseif nNumErr == 2 then DoorOutLog( sMessErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessErr DGD.ERR = 14 end else -- Note del profilo bevel invertito EgtSetInfo( DGD.PZ, 'OppoBevelProf', DGD.bBothOppoBevel) -- Note del raggio profilo su hinge EgtSetInfo( DGD.PZ, 'RadHingeProfile', DGD.RPH or 0) -- Note del raggio profilo su lock EgtSetInfo( DGD.PZ, 'RadLockProfile', DGD.RPL or 0) -- Note del raggio profilo su top EgtSetInfo( DGD.PZ, 'RadTopProfile', DGD.RPT or 0) -- Note del raggio profilo su bottom EgtSetInfo( DGD.PZ, 'RadBottomProfile', DGD.RPB or 0) -- Note del piano sul profilo CV su hinge EgtSetInfo( DGD.PZ, 'PlnHingeProfile', DGD.PPH or 0) -- Note del piano sul profilo CV su lock EgtSetInfo( DGD.PZ, 'PlnLockProfile', DGD.PPL or 0) -- Note del piano sul profilo CV su top EgtSetInfo( DGD.PZ, 'PlnTopProfile', DGD.PPT or 0) -- Note del piano sul profilo CV su bottom EgtSetInfo( DGD.PZ, 'PlnBottomProfile', DGD.PPB or 0) -- note del numero di elementi inseriti nel lato cerniere (esclusi EPT per il momento) EgtSetInfo( DGD.PZ, 'NumHingesPivots', nNumHingePivot or 0) -- note dispsizione jambs materiale legno EgtSetInfo( DGD.PZ, 'DisposeWJambsOnSide', DGC.Dwjs or 0) -- note dispsizione jambs materiale acciaio EgtSetInfo( DGD.PZ, 'DisposeSJambsOnSide', DGC.Dsjs or 0) -- note dispsizione jambs materiale alluminio EgtSetInfo( DGD.PZ, 'DisposeAJambsOnSide', DGC.Dajs or 0) -- note dispsizione jambs materiale fibra di vetro EgtSetInfo( DGD.PZ, 'DisposeFJambsOnSide', DGC.Dfjs or 0) -- nota presenza cutout EgtSetInfo( DGD.PZ, 'ExistsCutOut', DGD.ExistCutOut) -- nota mancanza riduzione sfridi EgtSetInfo( DGD.PZ, 'WholeCutOut', DGD.NotExistHatch) end end return bLocFoundMTable, bWriteWide end ----------------------------------------------------------------- -- *** DDF parse and make door *** ----------------------------------------------------------------- local function ReadAndParseDdfAndMakeDoors() local sOutLogMsg = '' local sPrvKeyLine = '' local bOpenDdf = true local bWriteErr = false local bLocFoundMTable local nLimitPieces = 6 --------------------------------------------------- -- Lettura parametri necessari con errori bloccanti --------------------------------------------------- -- Apertura file DDF if not OpenFile( DGD.FILE) then DoorOutLog( EgtDoorsMsg[434], 0) DGD.ERM = DGD.ERM .. '\n' .. EgtDoorsMsg[434] DGD.ERR = 1 bOpenDdf = false end -- esco se trovo il codice di fine file o non è finito il file while bOpenDdf and not EndOfFile() and not KeyFromLine( '...') and nCountPieces < nLimitPieces do -- Reset librerie per evitare l'errore in caso riparto da una situazione di errore dello script ResetDoorsGlobData() tGenInfo={} if not KeyFromLine( '---') then sPrvKeyLine = '' -- Lettura numero versione ddf GetVersion() sOutLogMsg = ' DGD.nVersion=' .. tostring( DGD.nVersion) DoorOutLog( sOutLogMsg, 0) -- Lettura flag di produzione pezzo GetProoduce() sOutLogMsg = ' DGD.bProoduce=' .. tostring( DGD.bProoduce) DoorOutLog( sOutLogMsg, 0) -- Lettura unità di misura if not GetMeasures() then DoorOutLog( string.format( EgtDoorsMsg[435], GetLineNumber()), 0) DGD.ERM = DGD.ERM .. '\n' .. string.format( EgtDoorsMsg[435], GetLineNumber()) DGD.ERR = 2 bWriteErr = false break end sOutLogMsg = ' DGD.bMM=' .. tostring( DGD.bMM) DoorOutLog( sOutLogMsg, 0) -- Lettura codice identificativo if not GetCode() then DoorOutLog( string.format( EgtDoorsMsg[436], GetLineNumber()), 0) DGD.ERM = DGD.ERM .. '\n' .. string.format( EgtDoorsMsg[436], GetLineNumber()) DGD.ERR = 3 bWriteErr = false break end sOutLogMsg = ' DGD.sCode=' .. DGD.sCode DoorOutLog( sOutLogMsg, 0) -- Lettura dati ordine if not GetOrder() then DoorOutLog( string.format( EgtDoorsMsg[437], GetLineNumber()), 0) DGD.ERM = DGD.ERM .. '\n' .. string.format( EgtDoorsMsg[437], GetLineNumber()) DGD.ERR = 4 bWriteErr = false break end sOutLogMsg = ' DGD.tOrder=' .. table.concat( DGD.tOrder, ',') DoorOutLog( sOutLogMsg, 0) -- Lettura data if not GetDate() then DoorOutLog( string.format( EgtDoorsMsg[438], GetLineNumber()), 0) DGD.ERM = DGD.ERM .. '\n' .. string.format( EgtDoorsMsg[438], GetLineNumber()) DGD.ERR = 5 bWriteErr = false break end sOutLogMsg = ' DGD.sDate=' .. DGD.sDate DoorOutLog( sOutLogMsg, 0) -- lettura tipo pezzo if GetPiece() then sOutLogMsg = ' DGD.sFrame=' .. ( DGD.sFrame or '') DoorOutLog( sOutLogMsg, 0) end -- lettura coordinate disposizione if GetPosition() then sOutLogMsg = ' DGD.tPosition=' .. EgtNumToString( DGD.tPosition[1], 4) .. ' ' .. EgtNumToString( DGD.tPosition[2], 4) .. ' ' .. EgtNumToString( DGD.tPosition[3], 4) DoorOutLog( sOutLogMsg, 0) end -- Lettura dimensioni if not GetSize() then DoorOutLog( string.format( EgtDoorsMsg[439], GetLineNumber()), 0) DGD.ERM = DGD.ERM .. '\n' .. string.format( EgtDoorsMsg[439], GetLineNumber()) DGD.ERR = 6 bWriteErr = false break end sOutLogMsg = ' DGD.dW='..EgtNumToString( DGD.dW, 4)..' DGD.dH='..EgtNumToString( DGD.dH, 4)..' DGD.dT='..EgtNumToString( DGD.dT, 4) DoorOutLog( sOutLogMsg, 0) -- lettura altezza originale porta (opzionale, solo per i frame) if GetDoorHeight() then sOutLogMsg = ' DGD.dOH='..EgtNumToString( DGD.dOH, 4) DoorOutLog( sOutLogMsg, 0) end -- Lettura tipo di apertura local bGetSwing, sTmpSwing = GetSwing() if not bGetSwing then DoorOutLog( string.format( EgtDoorsMsg[440], sTmpSwing, GetLineNumber()), 0) DGD.ERM = DGD.ERM .. '\n' .. string.format( EgtDoorsMsg[440], sTmpSwing, GetLineNumber()) DGD.ERR = 7 bWriteErr = false break end sOutLogMsg = ' DGD.sAliasSwng=' .. DGD.sAliasSwng DoorOutLog( sOutLogMsg, 0) sOutLogMsg = ' DGD.sSwing=' .. DGD.sSwing DoorOutLog( sOutLogMsg, 0) -- lettura disposizione porta senza bevel if not GetSecurSide() then DoorOutLog( EgtDoorsMsg[543], 0) else sOutLogMsg = ' DGD.sSecSide=' .. DGD.sSecSide DoorOutLog( sOutLogMsg, 0) end -- lettura materiale porta if not GetDoorMaterial() then DoorOutLog( EgtDoorsMsg[668], 0) else sOutLogMsg = ' DGD.Material=' .. DGD.Material DoorOutLog( sOutLogMsg, 0) end -- lettura proprietà porta if not GetDoorProperties() then DoorOutLog( EgtDoorsMsg[635], 0) else if DGD.Properties and #DGD.Properties > 0 then local sProp = '' for k = 1, #DGD.Properties do sProp = sProp .. DGD.Properties[k] .. ',' end sOutLogMsg = ' DGD.Properties=' .. sProp DoorOutLog( sOutLogMsg, 0) end end -- Lettura tipo di profili local nErrPrf = GetProfiles() if nErrPrf == 1 then DoorOutLog( string.format( EgtDoorsMsg[441], GetLineNumber()), 0) DGD.ERM = DGD.ERM .. '\n' .. string.format( EgtDoorsMsg[441], GetLineNumber()) DGD.ERR = 8 bWriteErr = false break elseif nErrPrf == 2 then DoorOutLog( string.format( EgtDoorsMsg[613], GetLineNumber()), 0) DGD.ERM = DGD.ERM .. '\n' .. string.format( EgtDoorsMsg[613], GetLineNumber()) DGD.ERR = 8 bWriteErr = false break elseif nErrPrf == 3 then DoorOutLog( string.format( EgtDoorsMsg[614], GetLineNumber()), 0) DGD.ERM = DGD.ERM .. '\n' .. string.format( EgtDoorsMsg[614], GetLineNumber()) DGD.ERR = 8 bWriteErr = false break elseif nErrPrf == 4 then DoorOutLog( string.format( EgtDoorsMsg[615], GetLineNumber()), 0) DGD.ERM = DGD.ERM .. '\n' .. string.format( EgtDoorsMsg[615], GetLineNumber()) DGD.ERR = 8 bWriteErr = false break elseif nErrPrf == 5 then DoorOutLog( string.format( EgtDoorsMsg[637], GetLineNumber()), 0) DGD.ERM = DGD.ERM .. '\n' .. string.format( EgtDoorsMsg[637], GetLineNumber()) DGD.ERR = 8 bWriteErr = false break elseif nErrPrf == 6 then DoorOutLog( string.format( EgtDoorsMsg[660], GetLineNumber()), 0) DGD.ERM = DGD.ERM .. '\n' .. string.format( EgtDoorsMsg[660], GetLineNumber()) DGD.ERR = 8 bWriteErr = false break elseif nErrPrf == 7 then DoorOutLog( string.format( EgtDoorsMsg[661], GetLineNumber()), 0) DGD.ERM = DGD.ERM .. '\n' .. string.format( EgtDoorsMsg[661], GetLineNumber()) DGD.ERR = 8 bWriteErr = false break elseif nErrPrf == 8 then DoorOutLog( string.format( EgtDoorsMsg[662], GetLineNumber()), 0) DGD.ERM = DGD.ERM .. '\n' .. string.format( EgtDoorsMsg[662], GetLineNumber()) DGD.ERR = 8 bWriteErr = false break elseif nErrPrf == 9 then DoorOutLog( string.format( EgtDoorsMsg[663], GetLineNumber()), 0) DGD.ERM = DGD.ERM .. '\n' .. string.format( EgtDoorsMsg[663], GetLineNumber()) DGD.ERR = 8 bWriteErr = false break elseif nErrPrf == 10 then DoorOutLog( string.format( EgtDoorsMsg[664], GetLineNumber()), 0) DGD.ERM = DGD.ERM .. '\n' .. string.format( EgtDoorsMsg[664], GetLineNumber()) DGD.ERR = 8 bWriteErr = false break elseif nErrPrf == 11 then DoorOutLog( string.format( EgtDoorsMsg[703], DGD.nVersion, GetLineNumber()), 0) DGD.ERM = DGD.ERM .. '\n' .. string.format( EgtDoorsMsg[703], DGD.nVersion, GetLineNumber()) DGD.ERR = 8 bWriteErr = false break else -- se non ci sono proprietà alla porta, con modalità probe e uno dei fianchi è lavorato, do errore per incompatibilità if not DGD.Properties and ( DGD.PROBE > 0 and DGC.NPM == 0) and ( DGD.tProfs.top.machining or DGD.tProfs.bottom.machining or DGD.tProfs.hingeedge.machining or DGD.tProfs.lockedge.machining) then DoorOutLog( EgtDoorsMsg[632], 0) DGD.ERM = DGD.ERM .. '\n' .. EgtDoorsMsg[632] DGD.ERR = 13 bWriteErr = false break end end sOutLogMsg = ' DGD.tProfs.top='..DGD.tProfs.top.trimming..' '.. tostring(DGD.tProfs.top.machining)..' '.. EgtNumToString(DGD.tProfs.top.offset,4) DoorOutLog( sOutLogMsg, 0) sOutLogMsg = ' DGD.tProfs.bottom='..DGD.tProfs.bottom.trimming..' '.. tostring(DGD.tProfs.bottom.machining)..' '.. EgtNumToString(DGD.tProfs.bottom.offset,4) DoorOutLog( sOutLogMsg, 0) sOutLogMsg = ' DGD.tProfs.hingeedge='..DGD.tProfs.hingeedge.trimming..' '.. tostring(DGD.tProfs.hingeedge.machining)..' '.. EgtNumToString(DGD.tProfs.hingeedge.offset,4) DoorOutLog( sOutLogMsg, 0) sOutLogMsg = ' DGD.tProfs.lockedge='..DGD.tProfs.lockedge.trimming..' '.. tostring(DGD.tProfs.lockedge.machining)..' '.. EgtNumToString(DGD.tProfs.lockedge.offset,4) DoorOutLog( sOutLogMsg, 0) ------------------------------------------ -- Lettura parametri ferramenta, opzionali ------------------------------------------ if DGD.nVersion >= 2 then local StartHw = StringFromLine( 'hardware:') if not StartHw then DoorOutLog( string.format( EgtDoorsMsg[702], DGD.nVersion), 0) DGD.ERM = DGD.ERM .. '\n' .. string.format( EgtDoorsMsg[702], DGD.nVersion) DGD.ERR = 28 bWriteErr = false break end end -- Lettura sfinestrature vision cutout if not DGD.sFrame then if GetVisionCutOuts() then if DGD.tVisions then local nContVC = 1 while nContVC <= #DGD.tVisions do sOutLogMsg = ' DGD.tVisions.Id='..EgtNumToString(nContVC,0)..' '.. DGD.tVisions[nContVC].shape if DGD.tVisions[nContVC].length then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tVisions[nContVC].length,4) end if DGD.tVisions[nContVC].width then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tVisions[nContVC].width,4) end if DGD.tVisions[nContVC].top_rail then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tVisions[nContVC].top_rail,4) end if DGD.tVisions[nContVC].lock_stile then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tVisions[nContVC].lock_stile,4) end if DGD.tVisions[nContVC].radius then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tVisions[nContVC].radius,4) end if DGD.tVisions[nContVC].center_from_top then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tVisions[nContVC].center_from_top,4) end if DGD.tVisions[nContVC].center_from_lock then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tVisions[nContVC].center_from_lock,4) end if DGD.tVisions[nContVC].door_center then sOutLogMsg = sOutLogMsg..' '..DGD.tVisions[nContVC].door_center end if DGD.tVisions[nContVC].split then sOutLogMsg = sOutLogMsg..' '.. EgtIf( DGD.tVisions[nContVC].split, '1', '0') end if DGD.tVisions[nContVC].dir then sOutLogMsg = sOutLogMsg..' '.. DGD.tVisions[nContVC].dir end DoorOutLog( sOutLogMsg, 0) nContVC = nContVC + 1 end end end end if #DGD.tVisions == 0 then -- se non ho trovato sfinestrature DoorOutLog( EgtDoorsMsg[442], 0) end -- Lettura sfinestratura inferiori: louver if not DGD.sFrame then if GetLouverCutOut() then if DGD.tLouvers then local nContLC = 1 while nContLC <= #DGD.tLouvers do sOutLogMsg = ' DGD.tLouvers.Id='..EgtNumToString(nContLC,0) if DGD.tLouvers[nContLC].length then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tLouvers[nContLC].length,4) end if DGD.tLouvers[nContLC].width then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tLouvers[nContLC].width,4) end if DGD.tLouvers[nContLC].bottom_rail then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tLouvers[nContLC].bottom_rail,4) end if DGD.tLouvers[nContLC].lock_stile then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tLouvers[nContLC].lock_stile,4) end if DGD.tLouvers[nContLC].door_center then sOutLogMsg = sOutLogMsg..' '..DGD.tLouvers[nContLC].door_center end DoorOutLog( sOutLogMsg, 0) nContLC = nContLC + 1 end end end end if #DGD.tLouvers == 0 then -- se non ho trovato sfinestrature inferiori DoorOutLog( EgtDoorsMsg[443], 0) end -- Lettura sfinestrature inferiori: mail slot if not DGD.sFrame then if GetMailSlots() then if DGD.tMailSlots then local nContMS = 1 while nContMS <= #DGD.tMailSlots do sOutLogMsg = ' DGD.tMailSlots.Id='..EgtNumToString(nContMS,0)..' '.. DGD.tMailSlots[nContMS].template if DGD.tMailSlots[nContMS].length then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tMailSlots[nContMS].length,4) end if DGD.tMailSlots[nContMS].bottom_rail then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tMailSlots[nContMS].bottom_rail,4) end if DGD.tMailSlots[nContMS].delta_center then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tMailSlots[nContMS].delta_center,4) end DoorOutLog( sOutLogMsg, 0) nContMS = nContMS + 1 end end end end if #DGD.tMailSlots == 0 then -- se non ho trovato sfinestrature inferiori tipo mail slot DoorOutLog( EgtDoorsMsg[444], 0) end -- Lettura spioncini: viewer if not DGD.sFrame then if GetViewers() then if DGD.tViewers then local nContVw = 1 while nContVw <= #DGD.tViewers do sOutLogMsg = ' DGD.tViewers.Id='..EgtNumToString(nContVw,0)..' '.. DGD.tViewers[nContVw].template if DGD.tViewers[nContVw].bottom_rail then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tViewers[nContVw].bottom_rail,4) end if DGD.tViewers[nContVw].delta_center then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tViewers[nContVw].delta_center,4) end if DGD.tViewers[nContVw].side then sOutLogMsg = sOutLogMsg..' '..DGD.tViewers[nContVw].side end DoorOutLog( sOutLogMsg, 0) nContVw = nContVw + 1 end end end end if #DGD.tViewers == 0 then -- se non ho trovato spioncini viewer DoorOutLog( EgtDoorsMsg[445], 0) end -- Lettura sfinestrature flush pull if not DGD.sFrame then if GetFlushPulls() then if DGD.tFlushPulls then local nContFp = 1 while nContFp <= #DGD.tFlushPulls do sOutLogMsg = ' DGD.tFlushPulls.Id='..EgtNumToString(nContFp,0)..' '.. DGD.tFlushPulls[nContFp].template if DGD.tFlushPulls[nContFp].position then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tFlushPulls[nContFp].position,4) end if DGD.tFlushPulls[nContFp].back_set then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tFlushPulls[nContFp].back_set,4) end if DGD.tFlushPulls[nContFp].depth then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tFlushPulls[nContFp].depth,4) end if DGD.tFlushPulls[nContFp].face then sOutLogMsg = sOutLogMsg..' '..DGD.tFlushPulls[nContFp].face end DoorOutLog( sOutLogMsg, 0) nContFp = nContFp + 1 end end end end if #DGD.tFlushPulls == 0 then -- se non ho trovato geometrie tipo flush pull DoorOutLog( EgtDoorsMsg[446], 0) end -- Lettura dati cerniere if not DGD.sFrame or DGD.sFrame == 'H' or DGD.sFrame == 'HE' then if GetHinges() then if DGD.tHinges then local nContHg = 1 while nContHg <= #DGD.tHinges do sOutLogMsg = ' DGD.tHinges.Id='..EgtNumToString(nContHg,0)..' '.. DGD.tHinges[nContHg].template if DGD.tHinges[nContHg].position then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tHinges[nContHg].position,4) end if DGD.tHinges[nContHg].back_set then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tHinges[nContHg].back_set,4) end if DGD.tHinges[nContHg].thickness then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tHinges[nContHg].thickness,4) end DoorOutLog( sOutLogMsg, 0) nContHg = nContHg + 1 end end end end if #DGD.tHinges == 0 then -- se non ho trovato cerniere DoorOutLog( EgtDoorsMsg[447], 0) end -- Lettura dati EPT if not DGD.sFrame or DGD.sFrame == 'H' or DGD.sFrame == 'HE' then if GetEPT() then if DGD.tEPTs then local nContEPT = 1 while nContEPT <= #DGD.tEPTs do sOutLogMsg = ' DGD.tEPTs.Id='..EgtNumToString(nContEPT,0)..' '.. DGD.tEPTs[nContEPT].template if DGD.tEPTs[nContEPT].position then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tEPTs[nContEPT].position,4) end if DGD.tEPTs[nContEPT].back_set then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tEPTs[nContEPT].back_set,4) end DoorOutLog( sOutLogMsg, 0) nContEPT = nContEPT + 1 end end end end if #DGD.tEPTs == 0 then -- se non ho trovato EPT DoorOutLog( EgtDoorsMsg[557], 0) end -- Lettura dati serrature if not DGD.sFrame or DGD.sFrame == 'L' or DGD.sFrame == 'LE' or DGD.nTypePz == 5 or DGD.nTypePz == 6 then if GetLocks() then if DGD.tLocks then local nContLk = 1 while nContLk <= #DGD.tLocks do sOutLogMsg = ' DGD.tLocks.Id='..EgtNumToString(nContLk,0)..' '.. DGD.tLocks[nContLk].template if DGD.tLocks[nContLk].position then sOutLogMsg = sOutLogMsg .. ' ' .. EgtNumToString(DGD.tLocks[nContLk].position,4) end if DGD.tLocks[nContLk].back_set then sOutLogMsg = sOutLogMsg .. ' ' .. EgtNumToString(DGD.tLocks[nContLk].back_set,4) end if DGD.tLocks[nContLk].offset then sOutLogMsg = sOutLogMsg .. ' ' .. EgtNumToString(DGD.tLocks[nContLk].offset,4) end if DGD.tLocks[nContLk].side then sOutLogMsg = sOutLogMsg .. ' ' .. DGD.tLocks[nContLk].side end if DGD.tLocks[nContLk].other_door then sOutLogMsg = sOutLogMsg .. ' ' .. DGD.tLocks[nContLk].other_door end DoorOutLog( sOutLogMsg, 0) nContLk = nContLk + 1 end end end end if #DGD.tLocks == 0 then -- se non ho trovato serrature DoorOutLog( EgtDoorsMsg[448], 0) end -- Lettura dati flush bolts if not DGD.sFrame or DGD.nTypePz == 5 or DGD.nTypePz == 6 then if GetFlushBolts() then if DGD.tFlushBolts then local nContFBt = 1 while nContFBt <= #DGD.tFlushBolts do sOutLogMsg = ' DGD.tFlushBolts.Id='..EgtNumToString(nContFBt,0)..' '.. DGD.tFlushBolts[nContFBt].template if DGD.tFlushBolts[nContFBt].type then sOutLogMsg = sOutLogMsg..' '..DGD.tFlushBolts[nContFBt].type end if DGD.tFlushBolts[nContFBt].side then sOutLogMsg = sOutLogMsg..' '..DGD.tFlushBolts[nContFBt].side end if DGD.tFlushBolts[nContFBt].position then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tFlushBolts[nContFBt].position,4) end if DGD.tFlushBolts[nContFBt].offset then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tFlushBolts[nContFBt].offset,4) end if DGD.tFlushBolts[nContFBt].back_set then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tFlushBolts[nContFBt].back_set,4) end if DGD.tFlushBolts[nContFBt].other_door then sOutLogMsg = sOutLogMsg .. ' ' .. DGD.tFlushBolts[nContFBt].other_door end DoorOutLog( sOutLogMsg, 0) nContFBt = nContFBt + 1 end end end end if #DGD.tFlushBolts == 0 then -- se non ho trovato serrature DoorOutLog( EgtDoorsMsg[449], 0) end -- Lettura dati serrature if not DGD.sFrame or DGD.sFrame == 'L' or DGD.sFrame == 'LE' then if GetEdgePulls() then if DGD.tEdgePulls then local nContEp = 1 while nContEp <= #DGD.tEdgePulls do sOutLogMsg = ' DGD.tEdgePulls.Id='..EgtNumToString(nContEp,0)..' '.. DGD.tEdgePulls[nContEp].template if DGD.tEdgePulls[nContEp].position then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tEdgePulls[nContEp].position,4) end DoorOutLog( sOutLogMsg, 0) nContEp = nContEp + 1 end end end end if #DGD.tEdgePulls == 0 then -- se non ho trovato serrature DoorOutLog( EgtDoorsMsg[450], 0) end -- Lettura dati Roller Latch if not DGD.sFrame or DGD.sFrame == 'L' or DGD.sFrame == 'LE' or DGD.nTypePz == 5 or DGD.nTypePz == 6 then if GetRollerLatchs() then if DGD.tRollerLatchs then local nContRL = 1 while nContRL <= #DGD.tRollerLatchs do sOutLogMsg = ' DGD.tRollerLatchs.Id='..EgtNumToString(nContRL,0)..' '.. DGD.tRollerLatchs[nContRL].template if DGD.tRollerLatchs[nContRL].side then sOutLogMsg = sOutLogMsg..' '..DGD.tRollerLatchs[nContRL].side end if DGD.tRollerLatchs[nContRL].position then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tRollerLatchs[nContRL].position,4) end if DGD.tRollerLatchs[nContRL].offset then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tRollerLatchs[nContRL].offset,4) end if DGD.tRollerLatchs[nContRL].other_door then sOutLogMsg = sOutLogMsg .. ' ' .. DGD.tRollerLatchs[nContRL].other_door end DoorOutLog( sOutLogMsg, 0) nContRL = nContRL + 1 end end end end if #DGD.tRollerLatchs == 0 then -- se non ho trovato Roller Latchs DoorOutLog( EgtDoorsMsg[451], 0) end -- Lettura dati Pivot Hinge if not DGD.sFrame or DGD.sFrame == 'H' or DGD.sFrame == 'HE' or DGD.nTypePz == 5 or DGD.nTypePz == 6 then if GetPivots() then if DGD.tPivots then local nContPv = 1 while nContPv <= #DGD.tPivots do sOutLogMsg = ' DGD.tPivots.Id='..EgtNumToString(nContPv,0)..' '.. DGD.tPivots[nContPv].template if DGD.tPivots[nContPv].type then sOutLogMsg = sOutLogMsg..' '..DGD.tPivots[nContPv].type end if DGD.tPivots[nContPv].side then sOutLogMsg = sOutLogMsg..' '..DGD.tPivots[nContPv].side end if DGD.tPivots[nContPv].radius then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tPivots[nContPv].radius,4) end if DGD.tPivots[nContPv].position then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tPivots[nContPv].position,4) end if DGD.tPivots[nContPv].back_set then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tPivots[nContPv].back_set,4) end if DGD.tPivots[nContPv].depth_f then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tPivots[nContPv].depth_f,4) end if DGD.tPivots[nContPv].offset then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tPivots[nContPv].offset,4) end if DGD.tPivots[nContPv].other_door then sOutLogMsg = sOutLogMsg .. ' ' .. DGD.tPivots[nContPv].other_door end DoorOutLog( sOutLogMsg, 0) nContPv = nContPv + 1 end end end end if #DGD.tPivots == 0 then -- se non ho trovato Pivot Hinges DoorOutLog( EgtDoorsMsg[452], 0) end -- Lettura dati stops and closers if not DGD.sFrame or DGD.nTypePz == 5 then if GetStopsAndClosers() then if DGD.tStopsAndClosers then local nContSC = 1 while nContSC <= #DGD.tStopsAndClosers do sOutLogMsg = ' DGD.tStopsAndClosers.Id='..EgtNumToString(nContSC,0)..' '.. DGD.tStopsAndClosers[nContSC].template if DGD.tStopsAndClosers[nContSC].position then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tStopsAndClosers[nContSC].position,4) end if DGD.tStopsAndClosers[nContSC].pocket_offset then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tStopsAndClosers[nContSC].pocket_offset,4) end if DGD.tStopsAndClosers[nContSC].other_door then sOutLogMsg = sOutLogMsg .. ' ' .. DGD.tStopsAndClosers[nContSC].other_door end DoorOutLog( sOutLogMsg, 0) nContSC = nContSC + 1 end end end end if #DGD.tStopsAndClosers == 0 then -- se non ho trovato stop and closers DoorOutLog( EgtDoorsMsg[453], 0) end -- Lettura dati over head if not DGD.sFrame or DGD.nTypePz == 5 then if GetOverHeads() then if DGD.tOHeads then local nContOH = 1 while nContOH <= #DGD.tOHeads do sOutLogMsg = ' DGD.tOHeads.Id='..EgtNumToString(nContOH,0)..' '.. DGD.tOHeads[nContOH].template if DGD.tOHeads[nContOH].pockpos then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tOHeads[nContOH].pockpos,4) end if DGD.tOHeads[nContOH].pocklength then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tOHeads[nContOH].pocklength,4) end if DGD.tOHeads[nContOH].pocket_offset then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tOHeads[nContOH].pocket_offset,4) end if DGD.tOHeads[nContOH].armpos then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tOHeads[nContOH].armpos,4) end if DGD.tOHeads[nContOH].armlength then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tOHeads[nContOH].armlength,4) end if DGD.tOHeads[nContOH].other_door then sOutLogMsg = sOutLogMsg .. ' ' .. DGD.tOHeads[nContOH].other_door end DoorOutLog( sOutLogMsg, 0) nContOH = nContOH + 1 end end end end if #DGD.tOHeads == 0 then -- se non ho trovato over head DoorOutLog( EgtDoorsMsg[526], 0) end -- Lettura dati strike ( non inserisce stike che stonno su frame top e bottom) if not DGD.sFrame or DGD.sFrame == 'L' or DGD.sFrame == 'LE' or DGD.nTypePz == 5 or DGD.nTypePz == 6 then if GetStrikes() then if DGD.tStrikes then local nContSt = 1 while nContSt <= #DGD.tStrikes do sOutLogMsg = ' DGD.tStrikes.Id='..EgtNumToString(nContSt,0)..' '.. DGD.tStrikes[nContSt].template if DGD.tStrikes[nContSt].position then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tStrikes[nContSt].position,4) end if DGD.tStrikes[nContSt].back_set then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tStrikes[nContSt].back_set,4) end if DGD.tStrikes[nContSt].offset then sOutLogMsg = sOutLogMsg .. ' ' .. EgtNumToString(DGD.tStrikes[nContSt].offset,4) end if DGD.tStrikes[nContSt].other_door then sOutLogMsg = sOutLogMsg .. ' ' .. DGD.tStrikes[nContSt].other_door end DoorOutLog( sOutLogMsg, 0) nContSt = nContSt + 1 end end end end if #DGD.tStrikes == 0 then -- se non ho trovato strike DoorOutLog( EgtDoorsMsg[535], 0) end -- Lettura dati groove if not DGD.sFrame then if GetGrooves() then if DGD.tGrooves then local nContGr = 1 while nContGr <= #DGD.tGrooves do sOutLogMsg = ' DGD.tGrooves.Id='..EgtNumToString(nContGr,0)..' '.. DGD.tGrooves[nContGr].template if DGD.tGrooves[nContGr].type then sOutLogMsg = sOutLogMsg..' '..DGD.tGrooves[nContGr].type end if DGD.tGrooves[nContGr].width then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tGrooves[nContGr].width,4) end if DGD.tGrooves[nContGr].depth then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tGrooves[nContGr].depth,4) end if DGD.tGrooves[nContGr].fst then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tGrooves[nContGr].fst,4) end if DGD.tGrooves[nContGr].hst then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tGrooves[nContGr].hst,4) end if DGD.tGrooves[nContGr].lst then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tGrooves[nContGr].lst,4) end if DGD.tGrooves[nContGr].groove_offset then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tGrooves[nContGr].groove_offset,4) end if DGD.tGrooves[nContGr].side then sOutLogMsg = sOutLogMsg..' '..DGD.tGrooves[nContGr].side end DoorOutLog( sOutLogMsg, 0) nContGr = nContGr + 1 end end end end if #DGD.tGrooves == 0 then -- se non ho trovato groove DoorOutLog( EgtDoorsMsg[536], 0) end -- Lettura dati rabbet -- if not DGD.sFrame then if GetRabbets() then if DGD.tRabbets then local nContRb = 1 while nContRb <= #DGD.tRabbets do sOutLogMsg = ' DGD.tRabbets.Id='..EgtNumToString(nContRb,0)..' '.. DGD.tRabbets[nContRb].template if DGD.tRabbets[nContRb].side then sOutLogMsg = sOutLogMsg..' '..DGD.tRabbets[nContRb].side end if DGD.tRabbets[nContRb].width then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tRabbets[nContRb].width,4) end if DGD.tRabbets[nContRb].depth then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tRabbets[nContRb].depth,4) end if DGD.tRabbets[nContRb].oppo then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tRabbets[nContRb].oppo,4) end DoorOutLog( sOutLogMsg, 0) nContRb = nContRb + 1 end end end -- end if #DGD.tRabbets == 0 then -- se non ho trovato rabbet DoorOutLog( EgtDoorsMsg[537], 0) end -- Lettura dati Face Decoration if not DGD.sFrame then if GetDecorations() then if DGD.tDecorations then local nContDc = 1 while nContDc <= #DGD.tDecorations do sOutLogMsg = ' DGD.tDecorations.Id='..EgtNumToString(nContDc,0)..' '.. DGD.tDecorations[nContDc].template if DGD.tDecorations[nContDc].type then sOutLogMsg = sOutLogMsg..' '..DGD.tDecorations[nContDc].type end if DGD.tDecorations[nContDc].depth then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tDecorations[nContDc].depth,4) end if DGD.tDecorations[nContDc].dft then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tDecorations[nContDc].dft,4) end if DGD.tDecorations[nContDc].dfb then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tDecorations[nContDc].dfb,4) end if DGD.tDecorations[nContDc].dfl then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tDecorations[nContDc].dfl,4) end if DGD.tDecorations[nContDc].dfh then sOutLogMsg = sOutLogMsg..' '..EgtNumToString(DGD.tDecorations[nContDc].dfh,4) end if DGD.tDecorations[nContDc].face then sOutLogMsg = sOutLogMsg .. ' ' .. DGD.tDecorations[nContDc].face end DoorOutLog( sOutLogMsg, 0) nContDc = nContDc + 1 end end end end if #DGD.tDecorations == 0 then -- se non ho trovato serrature DoorOutLog( EgtDoorsMsg[645], 0) end -- lettura nuovo gruppo options if GetOptions() then sOutLogMsg = ' DGD.tOptions=' .. table.concat( DGD.tOptions, ',') DoorOutLog( sOutLogMsg, 0) end -- se a questo punto il ddf non termina o non ha il separatore di pezzo '---' -- c'è un errore nel ddf appena letto if not CheckKeyFromLine( '---') and not CheckKeyFromLine( '...') and not EndOfFile() then DoorOutLog( string.format( EgtDoorsMsg[604], GetLineNumber()), 0) DGD.ERM = DGD.ERM .. '\n' .. string.format( EgtDoorsMsg[604], GetLineNumber()) DGD.ERR = 9 bWriteErr = false break end ------------------------------------------- ------------------------------------------- -- faccio la verifica sulla Mtable ------------------------------------------- ------------------------------------------- sMTable = sMTableOri -- per risalire al nome file della tabella, aggiungo eventuale nome materiale -- tranne se il nome è wood if DGD.Material and #DGD.Material > 0 and string.lower(DGD.Material) ~= 'wood' then sMTable = sMTable .. '_' .. DGD.Material end bLocFoundMTable = VerifyMtable() -- percorsi dei file pezzo locale sTxtOkFile = sFileDir .. DGD.sCode .. '.tok' sErrFile = sFileDir .. DGD.sCode .. '.txt' sCncFile = sFileDir .. DGD.sCode .. '.cnc' sNgeFile = sFileDir .. DGD.sCode .. '.nge' sOriPrbFile = sFileDir .. 'data.dat' sPrbFile = sFileDir .. DGD.sCode .. '.dat' -- Rimozione vecchi file log, nge e cnc e tok EgtEraseFile( sErrFile) EgtEraseFile( sTxtOkFile) EgtEraseFile( sNgeFile) EgtEraseFile( sCncFile) -- creo pezzo porta if DGD.ERR <= 0 then nCountPieces = nCountPieces + 1 -- leggo il file probe (se c'è il flag di ri-calcolo porta da file probe) local bReadFileDat = LoadDataProbeFile( sOriPrbFile, sPrbFile) if bReadFileDat then -- Controllo che la versione del file .prb non coincide con il settaggio presente nel file CurrDoorsCustomData if DGD.PROBE == 2 and ( not tProbeDoor.OPM or not DGC.Pms or ( tProbeDoor.OPM and DGC.Pms and tProbeDoor.OPM ~= DGC.Pms)) then local sMessageErr = string.format( EgtDoorsMsg[659], sPrbFile) -- file dat non trovato DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr DGD.ERR = 26 else -- Creazione della porta bLocFoundMTable = DoorCreation() EgtSaveFile( sNgeFile) DoorOutLog( ' *** Door creation completed ***', 0) -- se prima porta if nTypePiece == 1 then sFirstDoor = sNgeFile elseif nTypePiece == 2 then sSecondDoor = sNgeFile elseif nTypePiece == 3 then sFrameSx = sNgeFile elseif nTypePiece == 4 then sFrameDx = sNgeFile elseif nTypePiece == 5 then sFrameTop = sNgeFile elseif nTypePiece == 6 then sFrameBot = sNgeFile end end else local sMessageErr = string.format( EgtDoorsMsg[631], sPrbFile) -- file dat non trovato DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr DGD.ERR = 12 end end -- Scrivo il risultato su file apposito WriteErrFile( sErrFile) DoorOutLog( ' Err=' .. tostring( DGD.ERR) .. '\n', 1) bWriteErr = true else -- se non trovata descrizione ddf sPrvKeyLine = '---' end -- se trovato separatore altro pezzo if KeyFromLine( '---') then if sNgeFile then DoorOutLog( ' *** End piece file : ' .. sNgeFile ..' ***\n', 0) sNgeFile = nil end DoorOutLog( ' *** Next piece into parsing file : ' .. DGD.FILE ..' ***\n', 0) sPrvKeyLine = '---' else if sNgeFile then DoorOutLog( ' *** End piece file : ' .. sNgeFile ..' ***', 0) end end end -- end while -- se il file txt dell'errore non ancora scritto, assegno le variabili di errore degli assemblati if not bWriteErr then if DGD.EGR == 0 then DGD.EGR = DGD.ERR end if DGD.ERM and string.len(DGD.ERM) > 0 then if DGD.EGM then DGD.EGM = DGD.EGM .. '\n' .. DGD.ERM end end end -- Scrivo il risultato su file apposito WriteErrFileAsmbl( sErrFileM) if not bWriteErr then DoorOutLog( ' Err=' .. tostring( DGD.ERR) .. '\n', 1) end -- Chiusura file DDF if bOpenDdf then CloseFile() end return bLocFoundMTable end ----------------------------------------------------------------- -- *** Main function *** ----------------------------------------------------------------- local function Doors() -- Reset librerie per evitare l'errore in caso riparto da una situazione di errore dello script ResetDoorsLibs() -- Reset dati globali ResetDoorsGlobDataAssembly() ResetDoorsGlobData() -- Reset dati custom ResetDoorsCustomData() local sMessageErr -- debug per abilitare le quote nell'EgtCam5 -- DGD.MachEn = 0 -- per evitare problemi nel caso che nel nome file o nella cartella sia presente 'ddf' -- separo path nome ed estensione e poi successivamente concateno direttamente l'estensione sFileDir, sFileName, sFileExt = EgtSplitPath( DGD.FILE) sErrFileM = sFileDir .. sFileName .. '.txt' sLogFile = sFileDir .. sFileName .. '.log' sTxtOkFile = sFileDir .. sFileName .. '.tok' -- Rimozione vecchi file log, nge e cnc EgtEraseFile( sLogFile) EgtEraseFile( sErrFileM) EgtEraseFile( sTxtOkFile) -- creo nuovo file log OpenLogFile(sLogFile, 'w') -- variabili per gestione file MTable local sIniFilePath = EgtGetIniFile() -- percorso del file ini dell'EgtCam5 sMTable = EgtGetStringFromIni( 'Doors', 'CurrMTable', '', sIniFilePath) sMTableOri = sMTable local tMTable local tMachineOptions local bFoundMTable -- local M -- resetto contatore pezzi e il tipo pezzi nCountPieces = 0 nTypePiece = 0 --[[ -- questo è un codice ipotetico -- la tabella attualmente non viene passata dal file batch -- verifico se c'è il nome tabella passato da batch -- if DGD.NCGEN and DGD.NTB and string.len(DGD.NTB) > 0 then -- sMTable = DGD.NTB -- bFoundMTable = true -- else -- verifico se esiste il nome file if sMTable and string.len(sMTable) > 0 then bFoundMTable = true end -- end -- se nome MTable presente if bFoundMTable and DGD.MachEn > 0 then -- verifico se esiste il file sMTablePath = sBaseDir..'MTables\\'..sMTable..'.mtl' if EgtExistsFile(sMTablePath) then sMTablePath = sBaseDir..'MTables\\' M = require( sMTable) if M then tMachineData = M.MMachineData if not tMachineData then sMessageErr = string.format( EgtDoorsMsg[489], sMTable) -- dati macchina non validi DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr DGD.ERR = 25 WriteErrFile( sErrFileM) bFoundMTable = false end else sMessageErr = string.format( EgtDoorsMsg[490], sMTable) -- tabella non trovata DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr DGD.ERR = 24 WriteErrFile( sErrFileM) bFoundMTable = false end else sMessageErr = string.format( EgtDoorsMsg[487], sMTablePath) -- non c'è il file della tabella DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr DGD.ERR = 23 WriteErrFile( sErrFileM) bFoundMTable = false end elseif DGD.MachEn > 0 then sMessageErr = string.format( EgtDoorsMsg[487], sMTable) -- il nome del file della tabella non è valido DoorOutLog( sMessageErr, 0) DGD.ERM = DGD.ERM .. '\n' .. sMessageErr DGD.ERR = 22 WriteErrFile( sErrFileM) end ]]-- -- if ( bFoundMTable and DGD.MachEn > 0) or DGD.MachEn == 0 then if DGD.MachEn >= 0 then -- Segnalo inizio interpretazione file DoorOutLog( ' *** Start parsing file : ' .. DGD.FILE ..' ***', 0) -- controllo variabile che dovrebbe provenire dal prod if not DGD.PROBE then DGD.PROBE = 0 end -- controllo variabile che dovrebbe provenire dal CurrDoorsCustomData if not DGC.NPM then DGC.NPM = 0 end -- se DGD.NPM = 1 ma settata nuova interpretazione, forzo il parametro DGC.Pms = 1 if DGC.NPM > 0 then DGC.Pms = 1 -- se DGD.NPM = 2 forzo il parametro DGC.PROBE = 1 if DGC.NPM == 2 then DGD.PROBE = 1 end end -- controllo variabile che dovrebbe provenire dal CurrDoorsCustomData if not DGC.Pms then DGC.Pms = 0 end -- Lettura file DDF e creazione geometria porta bFoundMTable = ReadAndParseDdfAndMakeDoors() if bFoundMTable then -- se non è lanciato dal batch e ci sono più pezzi li carico in un unico progetto if nCountPieces > 1 and DGD.ERR <= 0 then EgtNewFile() DGD.PZ = EgtGroup( GDB_ID.ROOT) EgtSetName( DGD.PZ, sFileName) EgtSetCurrPartLayer( DGD.PZ, GDB_ID.NULL) local nIdDummyPart = EgtGetFirstPart() local nIdFrameSx, nIdDoor1, nIdDoor2, nIdFrameDx, nIdFrameTop, nIdFrameBot local dOffsLeft = 0 if sFirstDoor and EgtInsertFile( sFirstDoor) then -- non muovo la prima porta nIdDoor1 = EgtGetLastPart() EgtSetInfo( nIdDoor1, 'Assembly', 'first') EgtSetInfo( nIdDoor1, 'MoveedTo', {0,0,0}) local dWidthPiece = EgtGetInfo( nIdDoor1, 'W', 'd') dOffsLeft = dWidthPiece -- setto nota modalità probe EgtSetInfo( nIdDoor1, 'ProbeMode', DGD.PROBE) -- setto nota postprocessor probe mode setting EgtSetInfo( nIdDoor1, 'PostProbeSet', DGC.Pms) EgtSetInfo( nIdDoor1, 'NewProbeMean', DGC.NPM) end if sSecondDoor and EgtInsertFile( sSecondDoor) then -- rototraslazione del pezzo nIdDoor2 = EgtGetLastPart() EgtSetInfo( nIdDoor2, 'Assembly', 'second') local dWidthPiece = EgtGetInfo( nIdDoor2, 'W', 'd') local dThickPiece = EgtGetInfo( nIdDoor2, 'T', 'd') if dOffsLeft > 0 then dOffsLeft = dOffsLeft + 10 end EgtMove( nIdDoor2, Point3d( dOffsLeft,0,0) - ORIG(), GDB_RT.GRID) EgtSetInfo( nIdDoor2, 'MoveedTo', {dOffsLeft,0,0}) -- setto nota modalità probe EgtSetInfo( nIdDoor2, 'ProbeMode', DGD.PROBE) -- setto nota postprocessor probe mode setting EgtSetInfo( nIdDoor2, 'PostProbeSet', DGC.Pms) EgtSetInfo( nIdDoor2, 'NewProbeMean', DGC.NPM) -- aggiorno offset per eventuale prossimo pezzo dOffsLeft = dOffsLeft + dWidthPiece end if sFrameSx and EgtInsertFile( sFrameSx) then -- rototraslazione del pezzo nIdFrameSx = EgtGetLastPart() EgtSetInfo( nIdFrameSx, 'Assembly', 'framesx') local dWidthPiece = EgtGetInfo( nIdFrameSx, 'W', 'd') local dThickPiece = EgtGetInfo( nIdFrameSx, 'T', 'd') EgtMove( nIdFrameSx, Point3d(-( dWidthPiece + dThickPiece),0,0) - ORIG(), GDB_RT.GRID) EgtSetInfo( nIdFrameSx, 'MoveedTo', {-( dWidthPiece + dThickPiece),0,0}) end if sFrameDx and EgtInsertFile( sFrameDx) then -- rototraslazione del pezzo nIdFrameDx = EgtGetLastPart() EgtSetInfo( nIdFrameDx, 'Assembly', 'framedx') local dWidthPiece = EgtGetInfo( nIdFrameDx, 'W', 'd') local dThickPiece = EgtGetInfo( nIdFrameDx, 'T', 'd') if dOffsLeft > 0 then EgtMove( nIdFrameDx, Point3d(( dOffsLeft + dThickPiece),0,0) - ORIG(), GDB_RT.GRID) EgtSetInfo( nIdFrameDx, 'MoveedTo', {( dOffsLeft + dThickPiece),0,0}) else EgtMove( nIdFrameDx, Point3d( dThickPiece,0,0) - ORIG(), GDB_RT.GRID) EgtSetInfo( nIdFrameDx, 'MoveedTo', {dThickPiece,0,0}) end dOffsLeft = dOffsLeft + dWidthPiece + dThickPiece end if sFrameTop and EgtInsertFile( sFrameTop) then -- rototraslazione del pezzo nIdFrameTop = EgtGetLastPart() EgtSetInfo( nIdFrameTop, 'Assembly', 'frametop') local dWidthPiece = EgtGetInfo( nIdFrameTop, 'W', 'd') local dThickPiece = EgtGetInfo( nIdFrameTop, 'T', 'd') if dOffsLeft > 0 then EgtMove( nIdFrameTop, Point3d(( dOffsLeft + dThickPiece),0,0) - ORIG(), GDB_RT.GRID) EgtSetInfo( nIdFrameTop, 'MoveedTo', {( dOffsLeft + dThickPiece),0,0}) else EgtMove( nIdFrameTop, Point3d( dThickPiece,0,0) - ORIG(), GDB_RT.GRID) EgtSetInfo( nIdFrameTop, 'MoveedTo', {dThickPiece,0,0}) end dOffsLeft = dOffsLeft + dWidthPiece + dThickPiece end if sFrameBot and EgtInsertFile( sFrameBot) then -- rototraslazione del pezzo nIdFrameBot = EgtGetLastPart() EgtSetInfo( nIdFrameBot, 'Assembly', 'framebot') local dWidthPiece = EgtGetInfo( nIdFrameBot, 'W', 'd') local dThickPiece = EgtGetInfo( nIdFrameBot, 'T', 'd') if dOffsLeft > 0 then EgtMove( nIdFrameBot, Point3d(( dOffsLeft + dThickPiece),0,0) - ORIG(), GDB_RT.GRID) EgtSetInfo( nIdFrameBot, 'MoveedTo', {( dOffsLeft + dThickPiece),0,0}) else EgtMove( nIdFrameBot, Point3d( dThickPiece,0,0) - ORIG(), GDB_RT.GRID) EgtSetInfo( nIdFrameBot, 'MoveedTo', {dThickPiece,0,0}) end end if nIdFrameSx or nIdDoor1 or nIdDoor2 or nIdFrameDx or nIdFrameBot then EgtErase(nIdDummyPart) end -- setto la griglia top EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) sNgeFile = sFileDir .. sFileName .. '.nge' EgtSaveFile( sNgeFile) elseif nCountPieces == 1 and DGD.ERR <= 0 then if sFrameSx then local nIdPiece = EgtGetLastPart() EgtSetInfo( nIdPiece, 'Assembly', 'framesx') EgtSetInfo( nIdPiece, 'MoveedTo', {0,0,0}) elseif sFrameDx then local nIdPiece = EgtGetLastPart() EgtSetInfo( nIdPiece, 'Assembly', 'framedx') EgtSetInfo( nIdPiece, 'MoveedTo', {0,0,0}) elseif sFrameTop then local nIdPiece = EgtGetLastPart() EgtSetInfo( nIdPiece, 'Assembly', 'frametop') EgtSetInfo( nIdPiece, 'MoveedTo', {0,0,0}) elseif sFrameBot then local nIdPiece = EgtGetLastPart() EgtSetInfo( nIdPiece, 'Assembly', 'framebot') EgtSetInfo( nIdPiece, 'MoveedTo', {0,0,0}) end -- setto nota modalità probe local nIdPiece = EgtGetLastPart() EgtSetInfo( nIdPiece, 'ProbeMode', DGD.PROBE) -- setto nota postprocessor probe mode setting EgtSetInfo( nIdPiece, 'PostProbeSet', DGC.Pms) EgtSetInfo( nIdPiece, 'NewProbeMean', DGC.NPM) -- setto la griglia top EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) sNgeFile = sFileDir .. sFileName .. '.nge' EgtSaveFile( sNgeFile) end -- Se richiesta generazione lavorazioni da file batch e non ci sono stati errori if DGD.NCGEN and DGD.ERR <= 0 then if not dofile( sBaseDir..'Machining.lua') then -- se machining va male if string.len(DGD.EMC) > 0 then DoorOutLog( DGD.EMC, 0) else DoorOutLog( EgtDoorsMsg[455], 0) end DGD.ERM = DGD.ERM .. '\n' .. EgtDoorsMsg[455] if DGD.ERR <= 0 then DGD.ERR = 20 end DoorOutLog( ' Err=' .. tostring( DGD.ERR) .. '\n', 1) else DoorOutLog( ' ' .. EgtDoorsMsg[498], 0) EgtOutText( EgtDoorsMsg[498]) end end end end -- chiudo file log CloseLogFile() -- Reset librerie ResetDoorsLibs() package.loaded.EgtDoorsBase = nil if DGD.EGR and DGD.EGR ~= 0 and DGD.ERR ~= DGD.EGR then DGD.ERR = DGD.EGR elseif DGD.EGR and DGD.EGR ~= 0 then DGD.ERR = DGD.EGR end DGC = nil return DGD.ERR end DGD.Doors = Doors return {}