-- Groove.lua by EgalWare s.r.l. 2025.11.05 -- Groove dati i valori 'L' e 'H' e 'T' e 'd' e 'p' e con nomi attributi -- 2016.09.21 V1.011 FM aggiunta messaggi di wanrning -- 2017.12.18 V1.011 FM Gestito uso una sola lama -- 2017.12.19 V1.012 FM Gestito uso lama anche su groove non passante con percorsi pulitura -- 2018.04.06 V1.018 FM Manage info (KeepBackSet) for adjust probe on Z -- 2018.05.18 V1.019 FM Manage groove on narroow side -- 2018.05.23 V1.01a FM Manage groove for all 4 sides -- 2018.07.18 V1.01b FM Manage groove for new ddf parameters (DGD.FST, DGD.HST, DGD.LST) -- 2018.10.17 V1.01c FM Add parameter to show into message 402 -- 2019.04.05 V1.01d FM Manage new version that not modify the blade path name by different lead-in and lead-out -- but assign notes to a path -- 2019.04.16 V1.01e FM Manage insert mill anti-splint path also on blade cuts -- 2019.04.16 V1.01e FM Fix problem on mill anti-splint paths when distance on middle line is 0: Add dMinDist set to 0.0015mm parameter -- 2019.04.29 V1.01f FM Manage max depth by blade parameter .MaxBd -- 2019.05.14 V1.020 FM Manage antisplint path on Hinge side and opposite side (when they use different tool diameters) -- 2019.10.18 V1.021 FM Manage steel option (disable to generate anti-splint paths) -- 2019.10.18 V2.000 FM Manage use Materials -- 2020.04.29 V2.001 FM Update for aluminum material -- 2021.11.24 V2.002 FM Manage side probe option if variable DGC.Pms > 2 -- 2022.04.07 V2.003 FM Manage side step by blade parameter .StpBd -- 2022.07.27 V2.004 FM Modification to use compiled code -- 2022.08.31 V2.004 FM Manage groove applied on door with top angle -- 2022.09.07 V2.005 FM Fix error on assigne a nil value by EgtIf intruction -- 2024.10.17 V2.006 FM Improve multiple blade step (on Z dir) when wide groobe is bigger than double blade thickness -- 2024.10.30 V2.007 FM Manage a new .alw parameter to allow width door bigger than door thickness and -- when blade is enables, get the mill max thickness as blade thickness in case mill is used instead blade -- 2025.01.20 V2.008 FM Manage a new .slb parameter to set to force use 1 blade for machining LH side. -- 2025.10.19 V2.7j1 DS Aggiunto BOXGROOVE anche nel caso di lama sul top della porta. -- 2025.10.22 V2.7j2 DS Il box precedente è limitato alla sola parte che interseca la porta (per evitare problemi successivi con spessore porta). -- 2025.10.22 V2.7k1 DS Correzione del punto precedente per porte con serratura a destra o a sinistra. -- Tavola per definizione modulo (serve ma non usata) local Groove = {} -- Intestazioni require( 'EgtBase') EgtEnableDebug( false) -- per messaggi -- EgtAddToPackagePath( EgtGetSourceDir() .. '?.lua') EgtAddToPackagePath( DGD.BASEDIR .. '?.lua') -- Valori limite local dExtraH = 0.25 local DgMin = 3. -- valore minimo diametro utensile local PtMin = 0.1 local PtMax = 1.0 -- valore globale di settaggio local nNewLeadInOutMode = true local function DrawAddLineDrawCircle( pInitial, pFinal, nGroup, idTable, bPrev, nGroupCirc, nRad, bDrawFirst, bDrawLast, cColor1, cColor2, sMVar) local nLine = EgtLine(nGroup, pInitial, pFinal, GDB_RT.LOC) local nNumLine if idTable then table.insert( idTable, nLine) -- se devo inserire una variazione nell'entità if sMVar then nNumLine = #idTable end end if bPrev then if bDrawFirst then local nCircle1 = EgtCircle( nGroupCirc, pInitial, nRad , GDB_RT.LOC) EgtSetColor( nCircle1, cColor1) end if bDrawLast then local nCircle2 = EgtCircle( nGroupCirc, pFinal, nRad , GDB_RT.LOC) EgtSetColor( nCircle2, cColor2) end end return nLine, nNumLine, sMVar end local function GetMachToolErrorMessage( nErrorId, sGeomName, dIdMach, dOriDiamTool, nIdLogErr, sMchngName) local EgtDoorsMsg = require( 'EgtDoorsMsg') local sMessage = '' if dOriDiamTool then if nErrorId == -1 then -- lavorazione non presente in tabella sMessage = string.format(EgtDoorsMsg[466], nIdLogErr, dIdMach, sGeomName, EgtToUiUnits( dOriDiamTool)) elseif nErrorId == -2 then -- errore nel settare la lavorazione, lavorazione non presente in libreria sMessage = string.format(EgtDoorsMsg[467], nIdLogErr, sMchngName, dIdMach, sGeomName, EgtToUiUnits( dOriDiamTool)) elseif nErrorId == -3 then -- errore nell'acquisire parametri lavorazione sMessage = string.format(EgtDoorsMsg[468], nIdLogErr, sMchngName, dIdMach, sGeomName, EgtToUiUnits( dOriDiamTool)) elseif nErrorId == -4 then -- errore nell'acquisire parametri lavorazione sMessage = string.format(EgtDoorsMsg[469], nIdLogErr, sMchngName, dIdMach, sGeomName, EgtToUiUnits( dOriDiamTool)) elseif nErrorId == -5 then -- diametro utensile non trovato sMessage = string.format(EgtDoorsMsg[470], nIdLogErr, sMchngName, dIdMach, sGeomName, EgtToUiUnits( dOriDiamTool)) elseif nErrorId == -6 then -- nome geometria non presente in tabella sMessage = string.format(EgtDoorsMsg[471], nIdLogErr, sGeomName, EgtToUiUnits( dOriDiamTool)) elseif nErrorId == -7 then -- altezza massima utensile non trovata sMessage = string.format(EgtDoorsMsg[472], nIdLogErr, sMchngName, dIdMach, sGeomName, EgtToUiUnits( dOriDiamTool)) elseif nErrorId == -8 then -- tabella non presente nelle note sMessage = string.format(EgtDoorsMsg[509], nIdLogErr) end elseif nErrorId == -1 then -- lavorazione non presente in tabella sMessage = string.format(EgtDoorsMsg[504], nIdLogErr, dIdMach, sGeomName) elseif nErrorId == -2 then -- errore nel settare la lavorazione sMessage = string.format(EgtDoorsMsg[505], nIdLogErr, sMchngName, dIdMach, sGeomName) elseif nErrorId == -3 then -- errore nell'acquisire parametri lavorazione sMessage = string.format(EgtDoorsMsg[506], nIdLogErr, sMchngName, dIdMach, sGeomName) elseif nErrorId == -4 then -- errore nell'acquisire parametri lavorazione sMessage = string.format(EgtDoorsMsg[507], nIdLogErr, sMchngName, dIdMach, sGeomName) elseif nErrorId == -5 then -- diametro utensile non trovato sMessage = string.format(EgtDoorsMsg[508], nIdLogErr, sMchngName, dIdMach, sGeomName) elseif nErrorId == -6 then -- nome geometria non presente in tabella sMessage = string.format(EgtDoorsMsg[503], nIdLogErr, sGeomName) elseif nErrorId == -7 then -- altezza massima utensile non trovata sMessage = string.format(EgtDoorsMsg[473], nIdLogErr, sMchngName, dIdMach, sGeomName) elseif nErrorId == -8 then -- tabella non presente nelle note sMessage = string.format(EgtDoorsMsg[509], nIdLogErr) end return sMessage end -- Funzione di sistemazione parametri function Groove.AdjustParams( tMhPar) tMhPar.invG = 1 local EgtDoorsMsg = require( 'EgtDoorsMsg') local dMaxMat0 local dMaxMat1 local dMaxMat2 local dMaxMat3 local dMaxMat4 local dMaxMat5 local dMaxMat6 local dNumMessage local dNumLog = 0 local sMessToOut = '' local nTempT0 local nTempT1 local nTempT2 local nTempT3 local nTempT4 local nTempT5 local nTempT6 local sMchngName0 local sMchngName1 local sMchngName2 local sMchngName3 local sMchngName4 local sMchngName5 local sMchngName6 local nThBl0 local nThBl1 local nThBl2 local nThBl3 local nThBl4 local nThBl5 local nThBl6 -- Assegno parametri da ddf if DGD.WIDTH then tMhPar.H = DGD.WIDTH end if DGD.DEPTH then tMhPar.T = DGD.DEPTH tMhPar.T3 = DGD.DEPTH end -- do errore se altezza cava maggiore o uguale dello spessore porta if ( not tMhPar.alw or tMhPar.alw == 0 ) and ( tMhPar.H - DGD.dT) >= GEO.EPS_SMALL then return tMhPar, 2499, string.format(EgtDoorsMsg[540], tMhPar.Nome, tMhPar.H, DGD.dT, tMhPar.Path) end -- disattivo il radius face tMhPar.rf = 0 -- se attivato groove che sborda dal lato narrow forzo alcune caratteristiche if tMhPar.grs then tMhPar.bl = false -- disattivo lama tMhPar.LCC = nil -- disattivo pulitura spigoli DGD.GRS = true else DGD.GRS = false end if DGD.Lock == 'R' then tMhPar.invG = -tMhPar.invG end if DGD.Push then tMhPar.invG = -tMhPar.invG end -- disattivo la lama se la cava è più grande di una certa quota if tMhPar.MaxBl and tMhPar.H and tMhPar.H > tMhPar.MaxBl then tMhPar.bl = false end -- disattivo la lama se la cava è più profonda di una certa quota if tMhPar.MaxBd and tMhPar.T and tMhPar.T > tMhPar.MaxBd then tMhPar.bl = false end -- se non ho il parametro lo setto disattivato if not tMhPar.ech then tMhPar.ech = false end -- se non c'è la variabile suffisso if not tMhPar.CH then tMhPar.CH = '_Chisel' end if DGD.SIDE == 'hinge' or DGD.SIDE == 'lock' then -- se groove sui fianchi -- se è di tipo side la trasformo in center if DGD.TYPE == 'side' then DGD.TYPE = 'center' end end if DGD.TYPE == 'center' then tMhPar.L = DGD.LENGTH - ( 2 * tMhPar.Red) if not tMhPar.fbagt then tMhPar.bl = false -- disattivo la lama in caso lo fosse end -- se ho specificato gli spessori degli styles if DGD.HST and DGD.LST then if ( DGD.SIDE == 'top' or DGD.SIDE == 'top_angle' or DGD.SIDE == 'top_flat' or DGD.SIDE == 'bottom') then -- se groove disposto sui lati top o bottom -- considerando che la porta di base è RH, D_X è positivo se lo spessore style lato lock > style lato hinge tMhPar.D_X = (DGD.LST - DGD.HST)/2 else -- altrimenti se groove disposta su lato lock calcolo il D_X per portarsi in centro tMhPar.D_X = 0 end end elseif DGD.TYPE == 'side' then tMhPar.L = DGD.LENGTH - tMhPar.Red if not tMhPar.fbagt then tMhPar.bl = false -- disattivo la lama in caso lo fosse end else -- thru tMhPar.L = DGD.LENGTH tMhPar.ech = false -- disattivo chisel se groove passante tMhPar.LCC = nil -- disattivo pulitura spigoli end -- in caso il lato sia top o bottom e ci sia il delta controllo se la cava sborda sulla larghezza if tMhPar.D_X then if ( DGD.SIDE == 'top' or DGD.SIDE == 'top_angle' or DGD.SIDE == 'top_flat' or DGD.SIDE == 'bottom') and ( (2*abs(tMhPar.D_X)) + tMhPar.L) >= DGD.SIDELENGTH then return tMhPar, 2492, string.format(EgtDoorsMsg[634], tMhPar.Nome, tMhPar.Path) end end -- se non ho parametro step o è 0 lo assegno uguale allo spessore cava if not tMhPar.s or abs(tMhPar.s) < GEO.EPS_SMALL then tMhPar.s = tMhPar.T end -- se porta steel o aluminum disabilito la svuotatura, la mortasa e i fori e modifico il nome geometria if FindMaterial( DGD.Material, 'steel') or FindMaterial( DGD.Material, 'aluminum') then tMhPar.LA = nil tMhPar.ech = false tMhPar.CH = nil tMhPar.est = true tMhPar.d2 = nil else tMhPar.est = nil end -- Assegno parametri da dati utensili in macchina local MB = require( 'MachiningBase') local sLM local nLMi = 1 local sLA local nLAi = 1 local sLAH local nLAHi = 1 local sLAL local nLALi = 1 local sLBM local nLBMi = 1 local sLG local nLGi = 1 local sLCC local nLCCi = 1 if tMhPar.LM then -- geometria groove sLM = tMhPar.LM end if tMhPar.LA then -- geometria antischeggia groove sLA = tMhPar.LA end if tMhPar.LA then -- geometria antischeggia groove lato hinge if DGD.SIDE == 'lock' or DGD.SIDE == 'hinge' then -- se lati lunghi sLAH = tMhPar.LA else sLAH = tMhPar.LA .. '_HNG' if DGD.SDF and DGD.SDF > 1 then sLAL = tMhPar.LA .. '_LK' tMhPar.d6 = tMhPar.d2 tMhPar.T6 = tMhPar.T2 end end tMhPar.d5 = tMhPar.d2 tMhPar.T5 = tMhPar.T2 end if tMhPar.LBM then -- geometria groove con lama sLBM = tMhPar.LBM end if tMhPar.ech and tMhPar.LG then -- se chisel abilitato sLG = tMhPar.LG .. tMhPar.CH tMhPar.d0 = 0 if DGD.MachEn > 0 and tMhPar.d0 then nTempT0, dMaxMat0, sMchngName0 = MB.GetToolDataFromAttrib( sLG, nLGi) end end if tMhPar.LCC then -- geometria pulizia spigoli sLCC = tMhPar.LCC end if DGD.MachEn > 0 and sLM and tMhPar.d and not tMhPar.bl then nTempT1, dMaxMat1, sMchngName1, nThBl1 = MB.GetToolDataFromAttrib( sLM, nLMi) end if DGD.MachEn > 0 and sLA and tMhPar.d2 and not ( tMhPar.bl and not tMhPar.uab) and DGD.TYPE ~= 'center' then nTempT2, dMaxMat2, sMchngName2, nThBl2 = MB.GetToolDataFromAttrib( sLA, nLAi) end if DGD.MachEn > 0 and sLBM and tMhPar.d3 and tMhPar.bl then nTempT3, dMaxMat3, sMchngName3, nThBl3 = MB.GetToolDataFromAttrib( sLBM, nLBMi, nil, true) end if DGD.MachEn > 0 and sLCC and tMhPar.d4 and tMhPar.bl and DGD.TYPE ~= 'thru' then nTempT4, dMaxMat4, sMchngName4, nThBl4 = MB.GetToolDataFromAttrib( sLCC, nLCCi) end if DGD.MachEn > 0 and sLAH and tMhPar.d5 and not ( tMhPar.bl and not tMhPar.uab) and DGD.TYPE ~= 'center' then nTempT5, dMaxMat5, sMchngName5, nThBl5 = MB.GetToolDataFromAttrib( sLAH, nLAHi) end if DGD.MachEn > 0 and sLAL and tMhPar.d6 and not ( tMhPar.bl and not tMhPar.uab) and DGD.TYPE ~= 'center' then nTempT6, dMaxMat6, sMchngName6, nThBl6 = MB.GetToolDataFromAttrib( sLAL, nLALi) end -- se devo disegnare le geometrie di lavorazione if DGD.MachEn > 0 then -- gestisco il risultato della lettura utensili if tMhPar.d and nTempT1 and nTempT1 <= 0 then -- utensile fresatura if DGD.bProoduce and not tMhPar.bl then dNumLog = -2496 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT1, sLM, nLMi, tMhPar.d, dNumLog, sMchngName1) end elseif nTempT1 then tMhPar.d = nTempT1 end if tMhPar.d2 and nTempT2 and nTempT2 <= 0 then -- utensile antischeggia if DGD.bProoduce and not tMhPar.bl and DGD.TYPE ~= 'center' then dNumLog = -2496 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT2, sLA, nLAi, tMhPar.d2, dNumLog, sMchngName2) end elseif nTempT2 then tMhPar.d2 = nTempT2 end if tMhPar.d5 and nTempT5 and nTempT5 <= 0 then -- utensile antischeggia lato hinge if DGD.bProoduce and not tMhPar.bl and DGD.TYPE ~= 'center' then dNumLog = -2496 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT5, sLAH, nLAHi, tMhPar.d5, dNumLog, sMchngName5) end elseif nTempT5 then tMhPar.d5 = nTempT5 end if tMhPar.d6 and nTempT6 and nTempT6 <= 0 then -- utensile antischeggia lato lock if DGD.bProoduce and not tMhPar.bl and DGD.TYPE ~= 'center' then dNumLog = -2496 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT6, sLAL, nLALi, tMhPar.d6, dNumLog, sMchngName6) end elseif nTempT6 then tMhPar.d6 = nTempT6 end if tMhPar.d3 and nTempT3 and nTempT3 <= 0 then -- lama if DGD.bProoduce and tMhPar.bl then -- se utilizzo la lama dNumLog = -2496 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT3, sLBM, nLMMi, tMhPar.d3, dNumLog, sMchngName3) end elseif nTempT3 then tMhPar.d3 = nTempT3 if nThBl3 and nThBl3 > 0 then tMhPar.thb = nThBl3 end end -- chiseling if tMhPar.ech and tMhPar.d0 and nTempT0 > 0 then tMhPar.d0 = nTempT0 end if tMhPar.d4 and nTempT4 and nTempT4 <= 0 then -- utensile ripresa angoli if DGD.bProoduce and tMhPar.bl and DGD.TYPE ~= 'thru' then dNumLog = -2496 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT4, sLCC, nLCCi, tMhPar.d4, dNumLog, sMchngName4) end elseif nTempT4 then tMhPar.d4 = nTempT4 end -- se la profondità della groove è maggiore della capacità utensile limito la profondità ed emetto un warning if not tMhPar.bl and tMhPar.T and dMaxMat1 and tMhPar.T > dMaxMat1 then dNumLog = -2498 dNumMessage = 461 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T), EgtToUiUnits(dMaxMat1)) tMhPar.T = dMaxMat1 - 0.02 -- tolgo 0.05 per permettere la lavorazione end -- se la profondità antischeggia è maggiore della capacità utensile limito la profondità ed emetto un warning if not tMhPar.bl and tMhPar.T2 and dMaxMat2 and tMhPar.T2 > dMaxMat2 then dNumLog = -2497 dNumMessage = 541 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T2), EgtToUiUnits(dMaxMat2)) tMhPar.T2 = dMaxMat2 - 0.05 -- tolgo 0.05 per permettere la lavorazione end -- se la profondità antischeggia lato hinge è maggiore della capacità utensile limito la profondità ed emetto un warning if not tMhPar.bl and tMhPar.T5 and dMaxMat5 and tMhPar.T5 > dMaxMat5 then dNumLog = -2491 dNumMessage = 541 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T5), EgtToUiUnits(dMaxMat5)) tMhPar.T5 = dMaxMat5 - 0.05 -- tolgo 0.05 per permettere la lavorazione end -- se la profondità antischeggia lato lock è maggiore della capacità utensile limito la profondità ed emetto un warning if not tMhPar.bl and tMhPar.T6 and dMaxMat6 and tMhPar.T6 > dMaxMat6 then dNumLog = -2489 dNumMessage = 541 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T6), EgtToUiUnits(dMaxMat6)) tMhPar.T6 = dMaxMat6 - 0.05 -- tolgo 0.05 per permettere la lavorazione end -- se la profondità della groove è maggiore della capacità lama limito la profondità ed emetto un warning if tMhPar.bl and tMhPar.T and dMaxMat3 and tMhPar.T > dMaxMat3 then dNumLog = -2495 dNumMessage = 461 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T), EgtToUiUnits(dMaxMat3)) tMhPar.T = dMaxMat3 end if tMhPar.bl and tMhPar.H and nThBl3 and ( tMhPar.H - nThBl3) < -GEO.EPS_SMALL then dNumLog = -2494 dNumMessage = 542 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.H), EgtToUiUnits(nThBl3)) end -- se la profondità della groove è maggiore della capacità utensile ripresa antispigolo limito la profondità del percorso di questo ed emetto un warning if tMhPar.bl and DGD.TYPE ~= 'thru' and tMhPar.T and dMaxMat4 and tMhPar.T > dMaxMat4 then dNumLog = -2493 dNumMessage = 612 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T), EgtToUiUnits(dMaxMat4)) tMhPar.T3 = dMaxMat4 - 0.05 -- tolgo 0.05 per permettere la lavorazione end end if dNumLog ~= 0 then return tMhPar, dNumLog, sMessToOut end return tMhPar, 0, '' end -- Funzione di disegno function Groove.Draw( tOHead, bPreview, bRunByCompo, nDrawMach, dThickDoor) -- Assegno le dimensioni local L = tOHead.L local H = tOHead.H local T = tOHead.T local d = tOHead.d local p = tOHead.p local s = tOHead.s local T2 = tOHead.T2 local T5 = tOHead.T5 local T6 = tOHead.T6 local d2 = tOHead.d2 local d5 = tOHead.d5 local d6 = tOHead.d6 local grs = tOHead.grs local rf = tOHead.rf local uab = tOHead.uab local bl = tOHead.bl local f1b = tOHead.f1b -- force 1 blade (RH side) local slb = tOHead.slb -- set for LH side (only if use 1 blade) local d3 = tOHead.d3 -- blade diameter local red = tOHead.Red local thb = tOHead.thb local ech = tOHead.ech local est = tOHead.est local kbs = tOHead.kbs -- keep backset/thicknesss (0: none, 1: only face, 2: all) local pbs = tOHead.pbs local T3 = tOHead.T3 -- clean corner thickness path local d4 = tOHead.d4 -- clean corner diameter tool local invG = tOHead.invG -- push door flag local D_X = tOHead.D_X -- delta position along length local StpBd = tOHead.StpBd -- side step blade -- Assegno i nomi geometrie local LG = tOHead.LG -- nome geometria groove local LM = tOHead.LM -- nome lavorazione groove con fresa local LA = tOHead.LA -- nome geometria antischeggia local LAM = tOHead.LAM -- nome lavorazione groove antischeggia con lama local LAMU = tOHead.LAMU -- nome lavorazione groove UP antischeggia con lama local LBM = tOHead.LBM -- nome lavorazione groove con lama local LBMU = tOHead.LBMU -- nome lavorazione groove UP con lama local LCC = tOHead.LCC -- nome lavorazione pulitura spigoli local CH = tOHead.CH -- suffisso lavorazione chisel local DM = 'DUMMY' -- variabili per messaggi e settaggi vari local sCompoName = tOHead.Nome local nCompoNpar = tOHead.Npar local sCompoPath = tOHead.Path -- eventuale messaggio errore rilevato nell'adjust local nCodAdj = tOHead.nCod local sCodAdj = tOHead.sCod -- nomi parametri per messaggi local sNamePar1 = tOHead.N1 or 'L' local sNamePar2 = tOHead.N2 or 'H' local sNamePar3 = tOHead.N3 or 'T' local sNamePar4 = tOHead.N4 or 'd' local sNamePar5 = tOHead.N5 or 'p' local sNamePar6 = tOHead.N6 or 'd2' local sNamePar7 = tOHead.N7 or 'd5' local sNamePar8 = tOHead.N8 or 'd6' local sNamePar12 = tOHead.N12 or 'T2' local sNamePar13 = tOHead.N13 or 'T5' local sNamePar14 = tOHead.N14 or 'T6' local sNamePar15 = tOHead.N15 or 's' local sNamePar16 = tOHead.N16 or 'red' local sNamePar17 = tOHead.N17 or 'rf' -- impronta lama local dExLenBl = 0 -- RunByComponetInterface local RC = true -- Messaggi codice errori local EM = ' ' local EC = 0 local ErrorBase = 2400 -- variabili che abilitano la creazione della geometria local bMakeMortGeom = true local bMakeAsGeom = true if not bRunByCompo then -- controllo se lanciato da componente RC = false end -- verifico se dei parametri sono nulli e in qual caso assegno dei valori sostitutivi -- o setto la disabilitazione della creazione di alcune geometrie if not L or not H then bMakeMortGeom = false end if not D_X then D_X = 0 end if not T then T = 0 end if not T2 then T2 = 0 end if not T5 then T5 = 0 end if not T6 then T6 = 0 end if not thb then thb = 0 end if not StpBd or abs(StpBd) < 1 then StpBd = T + 0.1 end -- se ho abilitato il chiseling modifico il nome geometria if ech then LG = LG .. CH tOHead.LG = LG end -- variabile larghezza porta local dWidthDoor local dWidthShape = L -- se il tipo di cava non è passante disabilito la generazione dei percorsi anti-scheggia if DGD.TYPE == 'center' or ( bl and not uab) then bMakeAsGeom = false elseif DGD.TYPE == 'side' then -- se sborda da un lato aumento del raggio fresa + 0.5mm dWidthDoor = L + red if not bl then L = L + ( d / 2) + 0.5 end else dWidthDoor = L if not bl then L = L + d + 1 -- se sborda da due lati aumento del diametro fresa + 1mm end end -- se posso inserire antischeggia if bMakeAsGeom then -- se diametro utensile antischeggia lato lock e porta ad angolo if d2 and DGD.Tpa then -- Se applicato su lato inclinato o applicato su lato piatto e lock si trova dalla parte opposta al lato piatto if DGD.SIDE == 'top_angle' or ( DGD.SIDE == 'top_flat' and ( ( DGD.Lock == 'L' and DGD.tProfs.top.angle > 0) or ( DGD.Lock == 'R' and DGD.tProfs.top.angle < 0))) then d2 = nil end end -- se diametro utensile antischeggia lato LOCK (con shuttle lato lock) e porta ad angolo if d6 and DGD.Tpa then -- Se applicato su lato inclinato o applicato su lato piatto e hinge si trova dalla parte opposta al lato piatto if DGD.SIDE == 'top_angle' or ( DGD.SIDE == 'top_flat' and ( ( DGD.Lock == 'L' and DGD.tProfs.top.angle > 0) or ( DGD.Lock == 'R' and DGD.tProfs.top.angle < 0))) then d6 = nil end end -- se diametro utensile antischeggia lato HINGE e porta ad angolo if d5 and DGD.Tpa then -- Se applicato su lato inclinato o applicato su lato piatto e hinge si trova dalla parte opposta al lato piatto if DGD.SIDE == 'top_angle' or ( DGD.SIDE == 'top_flat' and ( ( DGD.Lock == 'R' and DGD.tProfs.top.angle > 0) or ( DGD.Lock == 'L' and DGD.tProfs.top.angle < 0))) then d5 = nil end end end -- 0 solo geom esterna, 1 solo geom mach, 2 entrambe if not nDrawMach then -- se non definita la setto per non creare geometria di lavorazione nDrawMach = 0 end local EgtDoorsMsg = require( 'EgtDoorsMsg') -- Verifica delle dimensioni, le condizioni vengono verificate in base a quale geometria deve essere creata if bMakeMortGeom and nDrawMach > 0 and not bl and d < DgMin then EC = 1 EM = string.format(EgtDoorsMsg[400],sNamePar4,EgtToUiUnits(d),EgtToUiUnits(DgMin)) -- il diametro utensile deve essere >= di d = DgMin elseif bMakeMortGeom and bMakeAsGeom and nDrawMach > 0 and not bl and d2 and d2 < DgMin then EC = 2 EM = string.format(EgtDoorsMsg[400],sNamePar6,EgtToUiUnits(d2),EgtToUiUnits(DgMin)) -- il diametro utensile deve essere >= di d2 = DgMin elseif bMakeMortGeom and nDrawMach > 0 and not grs and not bl and H <= d then if DGD.bProoduce then EC = 3 EM = string.format(EgtDoorsMsg[402],sNamePar2,EgtToUiUnits(H),sNamePar4,EgtToUiUnits(d), sCompoPath) -- il parametro 'H' deve essere maggiore al diametro utensile d H = d + 0.002 else d = H - 0.002 end elseif bMakeMortGeom and nDrawMach > 0 and not bl and L <= d then if DGD.bProoduce then EC = 4 EM = string.format(EgtDoorsMsg[402],sNamePar1,EgtToUiUnits(L),sNamePar4,EgtToUiUnits(d), sCompoPath) -- il parametro 'L' deve essere maggiore al diametro utensile d L = d + 0.002 else d = L - 0.002 end elseif bMakeMortGeom and bMakeAsGeom and not grs and nDrawMach > 0 and not bl and d2 and H <= d2 then if DGD.bProoduce then EC = 5 EM = string.format(EgtDoorsMsg[402],sNamePar2,EgtToUiUnits(H),sNamePar6,EgtToUiUnits(d2), sCompoPath) -- il parametro 'H' deve essere maggiore al diametro utensile d2 H = d2 + 0.002 else d2 = H - 0.002 end elseif bMakeMortGeom and nDrawMach > 0 and not bl and ( p < PtMin or p > PtMax) then EC = 6 EM = string.format(EgtDoorsMsg[403],sNamePar5,p,PtMin,PtMax, sCompoPath) -- il parametro 'p' deve essere compreso tra p = 0.8 elseif bMakeMortGeom and T < 0 then EC = 7 EM = string.format(EgtDoorsMsg[404],sNamePar3,EgtToUiUnits(T), sCompoPath) -- il parametro 'T' deve essere >= 0 T = 0 elseif bMakeMortGeom and bMakeAsGeom and T2 < 0 then EC = 8 EM = string.format(EgtDoorsMsg[404],sNamePar12,EgtToUiUnits(T2), sCompoPath) -- il parametro 'T2' deve essere >= 0 T2 = 0 elseif bMakeMortGeom and nDrawMach > 0 and not bl and s and s <= 0 then EC = 9 EM = string.format(EgtDoorsMsg[401],sNamePar15,EgtToUiUnits(s), sCompoPath) -- il parametro 's' deve essere > 0 s = d elseif bMakeMortGeom and nDrawMach > 0 and grs and rf and L and 2*rf >= L and DGD.TYPE == 'center' then EC = 10 EM = string.format(EgtDoorsMsg[406],sNamePar17,EgtToUiUnits(rf),sNamePar1..'/2',EgtToUiUnits(L/2), sCompoPath) -- il parametro 'rf' deve essere < del parametro L/2 rf = d/2 elseif bMakeMortGeom and nDrawMach > 0 and grs and H and rf and rf >= H then EC = 11 EM = string.format(EgtDoorsMsg[406],sNamePar17,EgtToUiUnits(rf),sNamePar2,EgtToUiUnits(H), sCompoPath) -- il parametro 'rf' deve essere < del parametro H rf = H/2 elseif bMakeMortGeom and nDrawMach > 0 and bl and DGD.TYPE ~= 'thru' then if DGD.TYPE ~= 'thru' then local dR3 = d3/2 local dDt = dR3 - T dExLenBl = sqrt( (dR3 * dR3) - ( dDt * dDt)) end if DGD.TYPE == 'side' and ( L - dExLenBl) <= 0 then EC = 12 EM = string.format(EgtDoorsMsg[407],sNamePar1,EgtToUiUnits(L), 'BladeResult', EgtToUiUnits(dExLenBl), sCompoPath) -- il parametro 'T2' deve essere >= 0 elseif DGD.TYPE == 'center' and ( L - ( 2*dExLenBl)) <= 0 then EC = 13 EM = string.format(EgtDoorsMsg[407],sNamePar1,EgtToUiUnits(L), 'BladeResult', EgtToUiUnits(dExLenBl*2), sCompoPath) -- il parametro 'T2' deve essere >= 0 end elseif bMakeMortGeom and bMakeAsGeom and nDrawMach > 0 and not bl and d5 and d5 < DgMin then EC = 14 EM = string.format(EgtDoorsMsg[400],sNamePar7,EgtToUiUnits(d5),EgtToUiUnits(DgMin)) -- il diametro utensile deve essere >= di d5 = DgMin elseif bMakeMortGeom and bMakeAsGeom and nDrawMach > 0 and not bl and d6 and d6 < DgMin then EC = 17 EM = string.format(EgtDoorsMsg[400],sNamePar8,EgtToUiUnits(d6),EgtToUiUnits(DgMin)) -- il diametro utensile deve essere >= di d6 = DgMin elseif bMakeMortGeom and bMakeAsGeom and not grs and nDrawMach > 0 and not bl and d5 and H <= d5 then if DGD.bProoduce then EC = 15 EM = string.format(EgtDoorsMsg[402],sNamePar2,EgtToUiUnits(H),sNamePar7,EgtToUiUnits(d5), sCompoPath) -- il parametro 'H' deve essere maggiore al diametro utensile d5 H = d5 + 0.002 else d5 = H - 0.002 end elseif bMakeMortGeom and bMakeAsGeom and not grs and nDrawMach > 0 and not bl and d6 and H <= d6 then if DGD.bProoduce then EC = 18 EM = string.format(EgtDoorsMsg[402],sNamePar2,EgtToUiUnits(H),sNamePar8,EgtToUiUnits(d6), sCompoPath) -- il parametro 'H' deve essere maggiore al diametro utensile d6 H = d6 + 0.002 else d6 = H - 0.002 end elseif bMakeMortGeom and bMakeAsGeom and T5 < 0 then EC = 16 EM = string.format(EgtDoorsMsg[404],sNamePar13,EgtToUiUnits(T5), sCompoPath) -- il parametro 'T5' deve essere >= 0 T5 = 0 elseif bMakeMortGeom and bMakeAsGeom and T6 < 0 then EC = 19 EM = string.format(EgtDoorsMsg[404],sNamePar14,EgtToUiUnits(T6), sCompoPath) -- il parametro 'T6' deve essere >= 0 T5 = 0 end if not bPreview and EC ~= 0 then return (ErrorBase+EC), EM end -- Se Preview cancello tutto if bPreview then EgtNewFile() EgtSetDefaultMaterial( BLACK()) end -- Pezzo e Layer local Pz if bPreview then Pz = EgtGroup(GDB_ID.ROOT,GDB_RT.LOC) -- nuovo pezzo else if not RC then Pz = EgtGetCurrPart() -- pezzo corrente end if not Pz then Pz = EgtGroup(GDB_ID.ROOT,GDB_RT.LOC) -- nuovo pezzo end end -- variabili dei percorsi geometrici local Lg, Dm local nGeom1 local nPkToJoin1, nPkToJoin2, nPkToJoin3, nPkToJoin4 local hint1, hint2, hint3, hint4, hint5, hint6, hintAs, hintAsR local CleanCor2 = {} local tPocketAs = {} local pIni, pEnd local dMinDist = 0 Lg = EgtGroup(Pz,GDB_RT.LOC) -- layer della figura principale EgtSetName(Lg,sCompoName) if nDrawMach > 0 then -- se abilitata geometria lavorazione Dm = EgtGroup( Pz, GDB_RT.LOC) -- layer disegni cerchi rappresentante il diametro utensile EgtSetName( Dm, DM) end -- geometria antischeggia if bMakeAsGeom and nDrawMach > 0 then if grs then -- se groove on side if DGD.TYPE == 'thru' then -- de groove passante (antisplint da entrambe i lati) -- se lato lock lavorato con shuttle if d6 and T6 and not( DGD.SIDE == 'hinge' or DGD.SIDE == 'lock') then d2 = d6 T2 = T6 end -- disegno secondo percorso (lato lock) |__ <-- if d2 then -- se parametro diametro utensile valido if invG > 0 then -- --> __| pIni = Point3d(-(d2*3/4),-(H-(d2/2)+dExtraH),0) pEnd = Point3d(T-(d2/2)+dExtraH,-(H-(d2/2)+dExtraH),0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE()) pIni = pEnd pEnd = Point3d(T-(d2/2)+dExtraH,(d2*3/4),0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE()) else -- |__ <-- pIni = Point3d((d2*3/4),-(H-(d2/2)+dExtraH),0) pEnd = Point3d(-(T-(d2/2)+dExtraH),-(H-(d2/2)+dExtraH),0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE()) pIni = pEnd pEnd = Point3d(-(T-(d2/2)+dExtraH),(d2*3/4),0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE()) end -- creo percorso hintAsR = EgtCurveCompo( Lg, tPocketAs, true) -- posizionamento geometria local dAngleRot = -90 local sNamePR if hintAsR and LA and ( DGD.SIDE == 'hinge' or DGD.SIDE == 'lock') then sNamePR = LA elseif LA then sNamePR = LA ..'_LK' end if invG > 0 then dAngleRot = 90 end if hintAsR then -- se esiste secondo percorso EgtModifyCurveThickness( hintAsR, -T2) -- assegno nome percorso EgtSetName( hintAsR, sNamePR) EgtRotate( hintAsR, ORIG(), Y_AX(), dAngleRot ) -- ruoto su faccia laterale opposta if invG > 0 then EgtMove( hintAsR, Point3d((dWidthDoor/2),0,0) - ORIG()) EgtInvertCurve(hintAsR) else EgtMove( hintAsR, Point3d(-(dWidthDoor/2),0,0) - ORIG()) end if kbs and kbs > 1 then EgtSetInfo( hintAsR, 'KeepBackSet', 'n') -- setto 'n' perché viene mantenuto lato narrow end if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hintAsR, 'ProbeSide', '1') end if DGD.SIDE and ( DGD.SIDE == 'top' or DGD.SIDE == 'top_angle' or DGD.SIDE == 'top_flat') then EgtInvertCurve(hintAsR) end end end end if DGD.TYPE ~= 'center' then -- se groove non in centro -- disegno primo percorso (lato hinge) --> __| if d5 then -- se parametro valido tPocketAs = {} if invG > 0 then -- |__ <-- pIni = Point3d((d5*3/4),-(H-(d5/2)+dExtraH),0) pEnd = Point3d(-(T-(d5/2)+dExtraH),-(H-(d5/2)+dExtraH),0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d5/2), true, true, ORANGE(), ORANGE()) pIni = pEnd pEnd = Point3d(-(T-(d5/2)+dExtraH),(d5*3/4),0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d5/2), true, true, ORANGE(), ORANGE()) else -- --> __| pIni = Point3d(-(d5*3/4),-(H-(d5/2)+dExtraH),0) pEnd = Point3d(T-(d5/2)+dExtraH,-(H-(d5/2)+dExtraH),0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d5/2), true, true, ORANGE(), ORANGE()) pIni = pEnd pEnd = Point3d(T-(d5/2)+dExtraH,(d5*3/4),0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d5/2), true, true, ORANGE(), ORANGE()) end hintAs = EgtCurveCompo( Lg, tPocketAs, true) end -- posizionamento geometria local dAngleRot = 90 local sNameP if hintAs and LA and ( DGD.SIDE == 'hinge' or DGD.SIDE == 'lock') then sNameP = LA elseif LA then sNameP = LA ..'_HNG' end if invG > 0 then dAngleRot = -90 end if hintAs then -- se esiste primo percorso EgtModifyCurveThickness( hintAs, -T5) -- assegno nome percorso EgtSetName( hintAs, sNameP) -- rotazione percorso EgtRotate( hintAs, ORIG(), Y_AX(), dAngleRot ) -- ruoto su faccia laterale EgtSetInfo( hintAs, 'UseBlade', bl) EgtSetInfo( hintAs, 'UseTwiceBl', not f1b) EgtSetInfo( hintAs, 'SideApp', EgtIf( DGD.SIDE == 'top_angle' or DGD.SIDE == 'top_flat', 'top', DGD.SIDE)) if invG > 0 then EgtMove( hintAs, Point3d(-(dWidthDoor/2),0,0) - ORIG()) else EgtMove( hintAs, Point3d((dWidthDoor/2),0,0) - ORIG()) EgtInvertCurve(hintAs) end if kbs and kbs > 1 then EgtSetInfo( hintAs, 'KeepBackSet', 'n') -- setto 'n' perché viene mantenuto lato narrow end if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hintAs, 'ProbeSide', '1') end if DGD.SIDE and ( DGD.SIDE == 'top' or DGD.SIDE == 'top_angle' or DGD.SIDE == 'top_flat') then EgtInvertCurve(hintAs) end end end else -- groove normale if DGD.TYPE == 'thru' then -- se groove passante (antisplint da entrambe i lati) -- se lato lock lavorato con shuttle if d6 and T6 and not( DGD.SIDE == 'hinge' or DGD.SIDE == 'lock') then d2 = d6 T2 = T6 end -- disegno secondo percorso (lato lock) if d2 then -- se parametro valido if abs(H-d2+(2*dExtraH)) <= GEO.EPS_SMALL then -- se distanza punti inconsistente, aggiungo 0.0015mm per fare almeno una piccola linea dMinDist = 0.0015 end pIni = Point3d(-(d2*3/4),-((H-d2+dMinDist)/2)-dExtraH,0) pEnd = Point3d(T-(d2/2)+dExtraH,-((H-d2+dMinDist)/2)-dExtraH,0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE()) pIni = pEnd pEnd = Point3d(T-(d2/2)+dExtraH,((H-d2+dMinDist)/2)+dExtraH,0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE()) pIni = pEnd pEnd = Point3d(-(d2*3/4),((H-d2+dMinDist)/2)+dExtraH,0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE()) -- creo percorso hintAsR = EgtCurveCompo( Lg, tPocketAs, true) end end if DGD.TYPE ~= 'center' then -- se groove non in centro -- disegno primo percorso (lato hinge) if d5 then -- se parametro valido tPocketAs = {} if abs(H-d5+(2*dExtraH)) <= GEO.EPS_SMALL then -- se distanza punti inconsistente, aggiungo 0.0015mm per fare almeno una piccola linea dMinDist = 0.0015 end pIni = Point3d(-(d5*3/4),-((H-d5+dMinDist)/2)-dExtraH,0) pEnd = Point3d(T-(d5/2)+dExtraH,-((H-d5+dMinDist)/2)-dExtraH,0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d5/2), true, true, ORANGE(), ORANGE()) pIni = pEnd pEnd = Point3d(T-(d5/2)+dExtraH,((H-d5+dMinDist)/2)+dExtraH,0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d5/2), true, true, ORANGE(), ORANGE()) pIni = pEnd pEnd = Point3d(-(d5*3/4),((H-d5+dMinDist)/2)+dExtraH,0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d5/2), true, true, ORANGE(), ORANGE()) hintAs = EgtCurveCompo( Lg, tPocketAs, true) end end local dAngleRot = 90 local sNameP if hintAs and LA and (DGD.SIDE == 'hinge' or DGD.SIDE == 'lock') then sNameP = LA elseif LA then sNameP = LA ..'_HNG' end local sNamePR if hintAsR and LA and (DGD.SIDE == 'hinge' or DGD.SIDE == 'lock') then sNamePR = LA elseif LA then sNamePR = LA ..'_LK' end if hintAs then -- se esiste primo percorso EgtModifyCurveThickness( hintAs, -T5) -- assegno nome percorso EgtSetName( hintAs, sNameP) -- rotazione percorso EgtRotate( hintAs, ORIG(), Y_AX(), dAngleRot ) -- ruoto su faccia laterale EgtSetInfo( hintAs, 'UseBlade', bl) EgtSetInfo( hintAs, 'UseTwiceBl', not f1b) EgtSetInfo( hintAs, 'SideApp', EgtIf( DGD.SIDE == 'top_angle' or DGD.SIDE == 'top_flat', 'top', DGD.SIDE)) -- posizionamento geometria EgtMove( hintAs, Point3d((dWidthDoor/2),0,0) - ORIG()) EgtSetInfo( hintAs, 'TypePath', 1) EgtInvertCurve(hintAs) -- se mantiene backset anche su mortise if kbs and kbs > 1 then EgtSetInfo( hintAs, 'KeepBackSet', 'c') -- setto 'c' perché viene mantenuto il centro spessore end if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hintAs, 'ProbeSide', '1') end end if hintAsR then -- se esiste secondo percorso EgtModifyCurveThickness( hintAsR, -T2) -- assegno nomi ai percorsi EgtSetName( hintAsR, sNamePR) -- rotazione percorso EgtRotate( hintAsR, ORIG(), Y_AX(), dAngleRot ) -- ruoto su faccia laterale -- rotazione geometria EgtRotate( hintAsR, ORIG(), Z_AX(), 180 ) -- ruoto copia su faccia laterale opposta -- posizionamento geometria EgtMove( hintAsR, Point3d(-(dWidthDoor/2),0,0) - ORIG()) EgtSetInfo( hintAsR, 'TypePath', 2) EgtInvertCurve(hintAsR) -- se mantiene backset anche su mortise if kbs and kbs > 1 then EgtSetInfo( hintAsR, 'KeepBackSet', 'c') -- setto 'c' perché viene mantenuto il centro spessore end if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hintAsR, 'ProbeSide', '1') end end end end --[[ -- vecchia -- geometria antischeggia if bMakeAsGeom and nDrawMach > 0 then if d2 then -- se parametro valido if grs then -- se groove on side if DGD.TYPE == 'thru' then -- disegno secondo percorso pIni = Point3d((d2*3/4),-(H-(d2/2)+dExtraH),0) pEnd = Point3d(-(T-(d2/2)+dExtraH),-(H-(d2/2)+dExtraH),0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE()) pIni = pEnd pEnd = Point3d(-(T-(d2/2)+dExtraH),(d2*3/4),0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE()) -- creo percorso hintAsR = EgtCurveCompo( Lg, tPocketAs, true) EgtModifyCurveThickness( hintAsR, -T2) -- rotazione geometria EgtRotate( hintAsR, ORIG(), Y_AX(), -90 ) -- ruoto su faccia laterale opposta tPocketAs = {} -- disegno primo percorso pIni = Point3d(-(d2*3/4),-(H-(d2/2)+dExtraH),0) pEnd = Point3d(T-(d2/2)+dExtraH,-(H-(d2/2)+dExtraH),0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE()) pIni = pEnd pEnd = Point3d(T-(d2/2)+dExtraH,(d2*3/4),0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE()) else -- disegno primo percorso if invG > 0 then pIni = Point3d((d2*3/4),-(H-(d2/2)+dExtraH),0) pEnd = Point3d(-(T-(d2/2)+dExtraH),-(H-(d2/2)+dExtraH),0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE()) pIni = pEnd pEnd = Point3d(-(T-(d2/2)+dExtraH),(d2*3/4),0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE()) else pIni = Point3d(-(d2*3/4),-(H-(d2/2)+dExtraH),0) pEnd = Point3d(T-(d2/2)+dExtraH,-(H-(d2/2)+dExtraH),0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE()) pIni = pEnd pEnd = Point3d(T-(d2/2)+dExtraH,(d2*3/4),0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE()) end end else if abs(H-d2) <= GEO.EPS_SMALL then -- se distanza punti inconsistente, aggiungo 0.0015mm per fare almeno una piccola linea dMinDist = 0.0015 end pIni = Point3d(-(d2*3/4),-((H-d2+dMinDist)/2),0) pEnd = Point3d(T-(d2/2),-((H-d2+dMinDist)/2),0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE()) pIni = pEnd pEnd = Point3d(T-(d2/2),((H-d2+dMinDist)/2),0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE()) pIni = pEnd pEnd = Point3d(-(d2*3/4),((H-d2+dMinDist)/2),0) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE()) end hintAs = EgtCurveCompo( Lg, tPocketAs, true) EgtModifyCurveThickness( hintAs, -T2) local dAngleRot = 90 local sNameP = EgtIf( DGD.SIDE == 'hinge' or DGD.SIDE == 'lock', LA, LA ..'_HNG') if grs then if DGD.TYPE == 'thru' then if invG > 0 then sNameP = LA end else if invG > 0 then dAngleRot = -90 end end end -- assegno nome percorso EgtSetName( hintAs, sNameP) -- rotazione percorso EgtRotate( hintAs, ORIG(), Y_AX(), dAngleRot ) -- ruoto su faccia laterale EgtSetInfo( hintAs, 'UseBlade', bl) EgtSetInfo( hintAs, 'UseTwiceBl', not f1b) EgtSetInfo( hintAs, 'SideApp', DGD.SIDE) -- posizionamento geometria if DGD.TYPE == 'side' then if grs then if invG > 0 then EgtMove( hintAs, Point3d(-(dWidthDoor/2),0,0) - ORIG()) else EgtMove( hintAs, Point3d((dWidthDoor/2),0,0) - ORIG()) end -- se mantiene backset anche su mortise if kbs and kbs > 1 then EgtSetInfo( hintAs, 'KeepBackSet', 'n') -- setto 'n' perché viene mantenuto il lato narrow end if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hintAs, 'ProbeSide', '1') end else EgtMove( hintAs, Point3d((dWidthDoor/2),0,0) - ORIG()) EgtSetInfo( hintAs, 'TypePath', 1) -- se mantiene backset anche su mortise if kbs and kbs > 1 then EgtSetInfo( hintAs, 'KeepBackSet', 'c') -- setto 'c' perché viene mantenuto il centro spessore end if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hintAs, 'ProbeSide', '1') end end elseif DGD.TYPE == 'thru' then local sNameP local sNamePR if grs then if invG > 0 then sNamePR = EgtIf( DGD.SIDE == 'hinge' or DGD.SIDE == 'lock', LA, LA ..'_HNG') -- per lato cerniere (groove top o bottom) aggiungo suffisso sNameP = LA else sNamePR = LA sNameP = EgtIf( DGD.SIDE == 'hinge' or DGD.SIDE == 'lock', LA, LA ..'_HNG') -- per lato cerniere (groove top o bottom) aggiungo suffisso end else -- copio il percorso hintAsR = EgtCopyGlob ( hintAs, Lg) sNamePR = LA sNameP = EgtIf( DGD.SIDE == 'hinge' or DGD.SIDE == 'lock', LA, LA ..'_HNG') -- per lato cerniere (groove top o bottom) aggiungo suffisso -- rotazione geometria EgtRotate( hintAsR, ORIG(), Z_AX(), 180 ) -- ruoto copia su faccia laterale opposta end -- assegno nomi ai percorsi EgtSetName( hintAsR, sNamePR) EgtSetName( hintAs, sNameP) if grs then -- inverto il percorso EgtInvertCurve(hintAsR) else EgtSetInfo( hintAs, 'TypePath', 1) EgtSetInfo( hintAsR, 'TypePath', 2) end EgtMove( hintAs, Point3d((dWidthDoor/2),0,0) - ORIG()) EgtMove( hintAsR, Point3d(-(dWidthDoor/2),0,0) - ORIG()) -- se mantiene backset anche su mortise if kbs and kbs > 1 then if grs then -- se groove on side EgtSetInfo( hintAs, 'KeepBackSet', 'n') -- setto 'n' perché viene mantenuto lato narrow EgtSetInfo( hintAsR, 'KeepBackSet', 'n') -- setto 'n' perché viene mantenuto lato narrow else EgtSetInfo( hintAs, 'KeepBackSet', 'c') -- setto 'c' perché viene mantenuto il centro spessore EgtSetInfo( hintAsR, 'KeepBackSet', 'c') -- setto 'c' perché viene mantenuto il centro spessore end end if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hintAs, 'ProbeSide', '1') EgtSetInfo( hintAsR, 'ProbeSide', '1') end end if grs and DGD.SIDE and DGD.SIDE == 'top' then if hintAs then EgtInvertCurve(hintAs) end if hintAsR then EgtInvertCurve(hintAsR) end end end end ]]-- if bMakeMortGeom then if not bl then -- cava mortasa local dMortise = {} local sRequireCompoName local GId -- assegno i valori coerenti con la tabella del componente if grs then dMortise.L = L dMortise.H = H dMortise.T = T dMortise.d = d dMortise.p = p dMortise.sf = s dMortise.rf = rf dMortise.d2 = nil dMortise.jn = false dMortise.L2 = L dMortise.H2 = H dMortise.D = 0 dMortise.D_X = 0 dMortise.invG = EgtIf( DGD.SIDE and ( DGD.SIDE == 'top' or DGD.SIDE == 'top_angle' or DGD.SIDE == 'top_flat'), -1, 1) dMortise.LG = LG dMortise.LM = LM dMortise.LA = LA dMortise.Nome = sCompoName sRequireCompoName = '_LatchStrike' else dMortise.T = T dMortise.L2 = L dMortise.H2 = H dMortise.T2 = T dMortise.d = d dMortise.p = p dMortise.s = s dMortise.jn = false dMortise.d3 = d dMortise.p3 = p dMortise.invG = 1 dMortise.mkrev = false -- disabilito la creazione del percorso in senso contrario dMortise.L3 = L dMortise.H3 = H dMortise.LGM = LG dMortise.LMM = LM dMortise.Nome = sCompoName dMortise.jne = false dMortise.D_X = 0 if DGD.TYPE == 'side' and ech then dMortise.smr = 1 -- inserisco i raccordini per non fare il chisel else dMortise.smr = 0 -- così il latch non crea i raccordini per evitare il chiseling end sRequireCompoName = '_Mortise' end -- lancio il primo componente base MHgen = require( sRequireCompoName) nGeom1, nPkToJoin1 = MHgen.Draw( EC, EM, dMortise, bPreview, bRunByCompo, nDrawMach, Pz, Lg, dThickDoor) -- creo la geometria che rappresenta l'ingombro della groove sulla porta if EC == 0 and grs and nDrawMach > 0 then -- setto la griglia dietro EgtSetGridFrame( Frame3d( 0, 0, 0, GDB_FR.BACK)) GId = EgtRectangle2P( Lg, Point3d( -((dWidthShape-d)/2), 0, 0), Point3d( ((dWidthShape-d)/2), -T, 0), GDB_RT.GRID) if GId then EgtInvertCurve(GId) EgtModifyCurveThickness( GId, -H) EgtSetName( GId, 'BOXGROOVE') end -- risetto la griglia top EgtSetGridFrame( Frame3d( 0, 0, 0, GDB_FR.TOP)) end if EC == 0 and ( nGeom1 or nPkToJoin1) then if DGD.TYPE == 'side' then -- sposto le geometrie del valore settato if red and red ~= 0 then local dMove = ((red/2)+(d/4)+0.25) local dMove2 = (red/2) if grs and invG > 0 then dMove = -dMove dMove2 = -dMove2 end if nGeom1 then EgtMove( nGeom1, Point3d(dMove,0,0) - ORIG()) end if nPkToJoin1 then EgtMove( nPkToJoin1, Point3d(dMove,0,0) - ORIG()) end if GId then EgtMove( GId, Point3d(dMove2,0,0) - ORIG()) end end elseif DGD.TYPE == 'center' and D_X then -- se in centro e D_X ha un valore sposto le geometrie if nGeom1 then EgtMove( nGeom1, Point3d(D_X,0,0) - ORIG()) end if nPkToJoin1 then EgtMove( nPkToJoin1, Point3d(D_X,0,0) - ORIG()) end if GId then EgtMove( GId, Point3d(D_X,0,0) - ORIG()) end end if kbs and kbs > 1 then if nGeom1 then if grs then EgtSetInfo( nGeom1, 'KeepBackSet', 'n') -- setto 'n' perché viene mantenuto il lato narrow else EgtSetInfo( nGeom1, 'KeepBackSet', 'c') -- setto 'c' perché viene mantenuto il centro spessore end end if nPkToJoin1 then if grs then EgtSetInfo( nPkToJoin1, 'KeepBackSet', 'n') -- setto 'n' perché viene mantenuto il lato narrow else EgtSetInfo( nPkToJoin1, 'KeepBackSet', 'c') -- setto 'c' perché viene mantenuto il centro spessore end end end if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then if nGeom1 then EgtSetInfo( nGeom1, 'ProbeSide', '1') end if nPkToJoin1 then EgtSetInfo( nPkToJoin1, 'ProbeSide', '1') end end end else -- con lama -- posizione Y iniziale (Z bassa) local dIniPosY = ((-H+thb)/2) local nEndPosY = ((H-thb)/2) if DGD.TYPE == 'side' then pEnd = EgtIf( f1b, Point3d((L/2), dIniPosY,-T), Point3d(2, dIniPosY,-T)) else pEnd = EgtIf( f1b, Point3d(((L/2)-dExLenBl), dIniPosY,-T), Point3d(2, dIniPosY,-T)) end pIni = Point3d( -((L/2)-dExLenBl), dIniPosY, -T) local nSideStep = 0 local dSideDepth local bInvertPoint -- creo n percorsi di side step repeat nSideStep = nSideStep + 1 dSideDepth = EgtIf( (StpBd * nSideStep) > T, T, (StpBd * nSideStep)) -- se lama singola e settata antioraria inverto i punti if f1b and slb and not bInvertPoint then pIni, pEnd = pEnd, pIni bInvertPoint = true end -- percorso dw già affondato allo spessore cava e calcolato per il centro spessore lama hint1 = DrawAddLineDrawCircle( Point3d( pIni:getX(), pIni:getY(), -dSideDepth), Point3d( pEnd:getX(), pEnd:getY(), -dSideDepth), Lg, nil, bPreview, Dm, (d3/2), false, false, ORANGE(), ORANGE()) nPkToJoin1 = EgtCurveCompo( Lg, {hint1}, true) EgtModifyCurveThickness( nPkToJoin1, 0) EgtModifyCurveExtrusion( nPkToJoin1, Y_AX(), GDB_RT.GLOB) if DGD.TYPE == 'side' then if not nNewLeadInOutMode then EgtSetName( nPkToJoin1, LBM .. '_NLI') else EgtSetName( nPkToJoin1, LBM) EgtSetInfo( nPkToJoin1, 'PathType', 'NR') -- se lama singola e settata antioraria inverto i punti if f1b and slb then EgtSetInfo( nPkToJoin1, 'InvDir', 'INV') end EgtSetInfo( nPkToJoin1, 'LeadType', '_NLI') if not f1b then EgtSetInfo( nPkToJoin1, 'ToolsUse', 'TW') end end elseif DGD.TYPE == 'center' then if not nNewLeadInOutMode then EgtSetName( nPkToJoin1, LBM .. '_NLILO') else EgtSetName( nPkToJoin1, LBM) EgtSetInfo( nPkToJoin1, 'PathType', 'NR') EgtSetInfo( nPkToJoin1, 'LeadType', '_NLILO') if not f1b then EgtSetInfo( nPkToJoin1, 'ToolsUse', 'TW') end end else EgtSetName( nPkToJoin1, LBM) if nNewLeadInOutMode then EgtSetInfo( nPkToJoin1, 'PathType', 'NR') if not f1b then EgtSetInfo( nPkToJoin1, 'ToolsUse', 'TW') end end end if red and red ~= 0 and DGD.TYPE == 'side' and nPkToJoin1 then EgtMove( nPkToJoin1, Point3d((red/2),0,0) - ORIG()) end -- se mantiene backset su mortise if kbs and kbs > 1 and nPkToJoin1 then EgtSetInfo( nPkToJoin1, 'KeepBackSet', 'c') -- setto 'c' perché viene mantenuto il centro spessore end if pbs and pbs > 1 and nPkToJoin1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( nPkToJoin1, 'ProbeSide', '1') end until dSideDepth >= T -- se passi intermedi if H > ( thb + 10*GEO.EPS_SMALL) then -- calsolo il passo in Y in base alla larghezza cava local dMatOnY = (H-thb) local dStepOnY = thb if dMatOnY > ( thb + 10*GEO.EPS_SMALL) then dStepOnY = thb * 0.95 end local nStepY = EgtIf( thb > 10*GEO.EPS_SMALL, ceil((H-thb)/dStepOnY), 1) -- numero di passate local dStepY = ((H-thb)/nStepY) -- passo ricalcolato local nPass = 1 local dMiddlePosY = dIniPosY + dStepY -- ciclo inserimento linee while nPass <= nStepY and dMiddlePosY < ( nEndPosY + 10*GEO.EPS_SMALL) do if DGD.TYPE == 'side' then pEnd = EgtIf( f1b, Point3d((L/2), dMiddlePosY,-T), Point3d(2, dMiddlePosY,-T)) else pEnd = EgtIf( f1b, Point3d(((L/2)-dExLenBl), dMiddlePosY,-T), Point3d(2, dMiddlePosY,-T)) end nSideStep = 0 bInvertPoint = false pIni = Point3d( -((L/2)-dExLenBl), dMiddlePosY, -T) -- creo n percorsi di side step repeat nSideStep = nSideStep + 1 dSideDepth = EgtIf( (StpBd * nSideStep) > T, T, (StpBd * nSideStep)) -- se lama singola e settata antioraria inverto i punti if f1b and slb and not bInvertPoint then pIni, pEnd = pEnd, pIni bInvertPoint = true end -- percorso up già affondato allo spessore cava e calcolato per il centro spessore lama hint3 = DrawAddLineDrawCircle( Point3d( pIni:getX(), pIni:getY(), -dSideDepth), Point3d( pEnd:getX(), pEnd:getY(), -dSideDepth), Lg, nil, bPreview, Dm, (d3/2), false, false, ORANGE(), ORANGE()) nPkToJoin3 = EgtCurveCompo( Lg, {hint3}, true) EgtModifyCurveThickness( nPkToJoin3, 0) EgtModifyCurveExtrusion( nPkToJoin3, Y_AX(), GDB_RT.GLOB) if DGD.TYPE == 'side' then if not nNewLeadInOutMode then EgtSetName( nPkToJoin3, LBMU .. '_NLI') else EgtSetName( nPkToJoin3, LBM) EgtSetInfo( nPkToJoin3, 'PathType', 'NR') -- se lama singola e settata antioraria inverto i punti if f1b and slb then EgtSetInfo( nPkToJoin3, 'InvDir', 'INV') end EgtSetInfo( nPkToJoin3, 'LeadType', '_NLI') if not f1b then EgtSetInfo( nPkToJoin3, 'ToolsUse', 'TW') end end elseif DGD.TYPE == 'center' then if not nNewLeadInOutMode then EgtSetName( nPkToJoin3, LBMU .. '_NLILO') else EgtSetName( nPkToJoin3, LBM) EgtSetInfo( nPkToJoin3, 'PathType', 'NR') EgtSetInfo( nPkToJoin3, 'LeadType', '_NLILO') if not f1b then EgtSetInfo( nPkToJoin3, 'ToolsUse', 'TW') end end else if not nNewLeadInOutMode then EgtSetName( nPkToJoin3, LBMU) else EgtSetName( nPkToJoin3, LBM) EgtSetInfo( nPkToJoin3, 'PathType', 'NR') if not f1b then EgtSetInfo( nPkToJoin3, 'ToolsUse', 'TW') end end end if red and red ~= 0 and DGD.TYPE == 'side' and nPkToJoin3 then EgtMove( nPkToJoin3, Point3d((red/2),0,0) - ORIG()) end -- se mantiene backset su mortise if kbs and kbs > 1 and nPkToJoin3 then EgtSetInfo( nPkToJoin3, 'KeepBackSet', 'c') -- setto 'c' perché viene mantenuto il centro spessore end if pbs and pbs > 1 and nPkToJoin3 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( nPkToJoin3, 'ProbeSide', '1') end until dSideDepth >= T -- incremento passo nPass = nPass + 1 -- nuova posizione in Y dMiddlePosY = dMiddlePosY + dStepY end end -- se non ho la forzatura a utilizzare solo una lama if not f1b then if DGD.TYPE == 'side' then pIni = Point3d((L/2), dIniPosY,-T) else pIni = Point3d(((L/2)-dExLenBl), dIniPosY,-T) end nSideStep = 0 -- creo n percorsi di side step repeat nSideStep = nSideStep + 1 dSideDepth = EgtIf( (StpBd * nSideStep) > T, T, (StpBd * nSideStep)) -- percorso inverso ( antischeggia) dw già affondato allo spessore cava e calcolato per il centro spessore lama hint2 = DrawAddLineDrawCircle( Point3d( pIni:getX(), pIni:getY(),-dSideDepth), Point3d(-2, dIniPosY,-dSideDepth), Lg, nil, bPreview, Dm, (d3/2), false, false, ORANGE(), ORANGE()) nPkToJoin2 = EgtCurveCompo( Lg, {hint2}, true) EgtModifyCurveThickness( nPkToJoin2, 0) EgtModifyCurveExtrusion( nPkToJoin2, Y_AX(), GDB_RT.GLOB) if DGD.TYPE == 'side' then if not nNewLeadInOutMode then EgtSetName( nPkToJoin2, LAM .. '_NLO') else EgtSetName( nPkToJoin2, LAM) EgtSetInfo( nPkToJoin2, 'LeadType', '_NLO') EgtSetInfo( nPkToJoin2, 'PathType', 'AS') end elseif DGD.TYPE == 'center' then if not nNewLeadInOutMode then EgtSetName( nPkToJoin2, LAM .. '_NLILO') else EgtSetName( nPkToJoin2, LAM) EgtSetInfo( nPkToJoin2, 'LeadType', '_NLILO') EgtSetInfo( nPkToJoin2, 'PathType', 'AS') end else EgtSetName( nPkToJoin2, LAM) if nNewLeadInOutMode then EgtSetInfo( nPkToJoin2, 'PathType', 'AS') end end if red and red ~= 0 and DGD.TYPE == 'side' and nPkToJoin2 then EgtMove( nPkToJoin2, Point3d((red/2),0,0) - ORIG()) end -- se mantiene backset su mortise if kbs and kbs > 1 and nPkToJoin2 then EgtSetInfo( nPkToJoin2, 'KeepBackSet', 'c') -- setto 'c' perché viene mantenuto il centro spessore end if pbs and pbs > 1 and nPkToJoin2 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( nPkToJoin2, 'ProbeSide', '1') end until dSideDepth >= T -- se passi intermedi if H > ( thb + 10*GEO.EPS_SMALL) then -- calsolo il passo in Y in base alla larghezza cava local dMatOnY = (H-thb) local dStepOnY = thb if dMatOnY > ( thb + 10*GEO.EPS_SMALL) then dStepOnY = thb * 0.95 end local nStepY = EgtIf( thb > 10*GEO.EPS_SMALL, ceil((H-thb)/dStepOnY), 1) -- numero di passate local dStepY = ((H-thb)/nStepY) -- passo ricalcolato local nPass = 1 local dMiddlePosY = dIniPosY + dStepY -- ciclo inserimento linee while nPass <= nStepY and dMiddlePosY < ( nEndPosY + 10*GEO.EPS_SMALL) do if DGD.TYPE == 'side' then pIni = Point3d((L/2), dMiddlePosY,-T) else pIni = Point3d(((L/2)-dExLenBl), dMiddlePosY,-T) end nSideStep = 0 -- creo n percorsi di side step repeat nSideStep = nSideStep + 1 dSideDepth = EgtIf( (StpBd * nSideStep) > T, T, (StpBd * nSideStep)) -- percorso inverso ( antischeggia) up già affondato allo spessore cava e calcolato per il centro spessore lama hint4 = DrawAddLineDrawCircle( Point3d( pIni:getX(), pIni:getY(),-dSideDepth), Point3d(-2, dMiddlePosY,-dSideDepth), Lg, nil, bPreview, Dm, (d3/2), false, false, ORANGE(), ORANGE()) nPkToJoin4 = EgtCurveCompo( Lg, {hint4}, true) EgtModifyCurveThickness( nPkToJoin4, 0) EgtModifyCurveExtrusion( nPkToJoin4, Y_AX(), GDB_RT.GLOB) if DGD.TYPE == 'side' then if not nNewLeadInOutMode then EgtSetName( nPkToJoin4, LAMU .. '_NLO') else EgtSetName( nPkToJoin4, LAM) EgtSetInfo( nPkToJoin4, 'LeadType', '_NLO') EgtSetInfo( nPkToJoin4, 'PathType', 'AS') end elseif DGD.TYPE == 'center' then if not nNewLeadInOutMode then EgtSetName( nPkToJoin4, LAMU .. '_NLILO') else EgtSetName( nPkToJoin4, LAM) EgtSetInfo( nPkToJoin4, 'LeadType', '_NLILO') EgtSetInfo( nPkToJoin4, 'PathType', 'AS') end else if not nNewLeadInOutMode then EgtSetName( nPkToJoin4, LAMU) else EgtSetName( nPkToJoin4, LAM) EgtSetInfo( nPkToJoin4, 'PathType', 'AS') end end if red and red ~= 0 and DGD.TYPE == 'side' and nPkToJoin4 then EgtMove( nPkToJoin4, Point3d((red/2),0,0) - ORIG()) end -- se mantiene backset su mortise if kbs and kbs > 1 and nPkToJoin4 then EgtSetInfo( nPkToJoin4, 'KeepBackSet', 'c') -- setto 'c' perché viene mantenuto il centro spessore end if pbs and pbs > 1 and nPkToJoin4 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( nPkToJoin4, 'ProbeSide', '1') end until dSideDepth >= T -- incremento passo nPass = nPass + 1 -- nuova posizione in Y dMiddlePosY = dMiddlePosY + dStepY end end end -- creo percorso/i pulitura spigoli if DGD.TYPE ~= 'thru' and d4 and dExLenBl and dExLenBl > 0 then local CleanCor1 = {} pIni = Point3d(-((L/2)-dExLenBl-(H/2)),0,0) pEnd = Point3d(-((L/2)-dExLenBl-(H/2)),-(H/2),0) DrawAddLineDrawCircle( pIni, pEnd, Lg, CleanCor1, bPreview, Dm, (d4/2), false, false, ORANGE(), ORANGE()) pIni = pEnd pEnd = Point3d(-(L/2),-(H/2),0) DrawAddLineDrawCircle( pIni, pEnd, Lg, CleanCor1, bPreview, Dm, (d4/2), false, false, ORANGE(), ORANGE()) pIni = pEnd pEnd = Point3d(-(L/2),(H/2),0) DrawAddLineDrawCircle( pIni, pEnd, Lg, CleanCor1, bPreview, Dm, (d4/2), false, false, ORANGE(), ORANGE()) pIni = pEnd pEnd = Point3d(-((L/2)-dExLenBl-(H/2)),(H/2),0) DrawAddLineDrawCircle( pIni, pEnd, Lg, CleanCor1, bPreview, Dm, (d4/2), false, false, ORANGE(), ORANGE()) pIni = pEnd pEnd = Point3d(-((L/2)-dExLenBl-(H/2)),0,0) DrawAddLineDrawCircle( pIni, pEnd, Lg, CleanCor1, bPreview, Dm, (d4/2), false, false, ORANGE(), ORANGE()) hint5 = EgtCurveCompo( Lg, CleanCor1, true) EgtModifyCurveThickness( hint5, -T3) EgtSetName( hint5, LCC) if DGD.TYPE == 'center' then hint6 = EgtCopyGlob( hint5, Lg) EgtRotate( hint6, ORIG(), Z_AX(), 180) -- se mantiene backset su mortise if kbs and kbs > 1 then EgtSetInfo( hint6, 'KeepBackSet', 'c') -- setto 'c' perché viene mantenuto il centro spessore end if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint6, 'ProbeSide', '1') end end if red and red ~= 0 and DGD.TYPE == 'side' and hint5 then EgtMove( hint5, Point3d((red/2),0,0) - ORIG()) end -- se mantiene backset su mortise if kbs and kbs > 1 and hint5 then EgtSetInfo( hint5, 'KeepBackSet', 'c') -- setto 'c' perché viene mantenuto il centro spessore end if pbs and pbs > 1 and hint5 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint5, 'ProbeSide', '1') end end -- se groove sul top della porta, creo la geometria che ne rappresenta l'ingombro (per poi verificare eventuale collisione con ventose) if EC == 0 and DGD.SIDE == 'top' and nDrawMach > 0 then -- determino se interessa la porta local dOffset = DGD.GROOVE_OFFSET or DGD.dT / 2 local dMaxZ = min( dOffset + H / 2, DGD.dT) local dMinZ = max( dOffset - H / 2, 0) if dMaxZ > dMinZ + 0.1 then -- setto la griglia back o front a seconda del lato serratura EgtSetGridFrame( Frame3d( 0, 0, 0, EgtIf( DGD.Lock == 'R', GDB_FR.BACK, GDB_FR.FRONT))) local dPosZ = dMaxZ - dOffset local dHeight = dMaxZ - dMinZ GId = EgtRectangle2P( Lg, Point3d( -((dWidthShape-d)/2), 0, dPosZ), Point3d( ((dWidthShape-d)/2), -T, dPosZ), GDB_RT.GRID) if GId then EgtInvertCurve(GId) EgtModifyCurveThickness( GId, -dHeight) EgtSetName( GId, 'BOXGROOVE') end -- risetto la griglia top EgtSetGridFrame( Frame3d( 0, 0, 0, GDB_FR.TOP)) end end end end -- Se non Preview if not bPreview and EC == 0 then if bRunByCompo then -- scrivo i parametri nelle info del pezzo WriteCompoDataToPart(Pz,sCompoName,nCompoNpar) end -- scrivo note nel layer della cerniera EgtSetInfo(Lg,'Type' ,'Groove') EgtSetInfo(Lg,'L' ,L) EgtSetInfo(Lg,'H' ,H) EgtSetInfo(Lg,'T' ,T) EgtSetInfo(Lg,'d' ,d) EgtSetInfo(Lg,'p' ,p) EgtSetInfo(Lg,'s' ,s) EgtSetInfo(Lg,'T2' ,T2) EgtSetInfo(Lg,'T5' ,T5) EgtSetInfo(Lg,'T6' ,T6) EgtSetInfo(Lg,'d2' ,d2) EgtSetInfo(Lg,'d5' ,d5) EgtSetInfo(Lg,'d6' ,d6) EgtSetInfo(Lg,'grs' ,grs) EgtSetInfo(Lg,'rf' ,rf) EgtSetInfo(Lg,'bl' ,bl) EgtSetInfo(Lg,'f1b' ,f1b) EgtSetInfo(Lg,'slb' ,slb) EgtSetInfo(Lg,'d3' ,d3) EgtSetInfo(Lg,'T3' ,T3) EgtSetInfo(Lg,'d4' ,d4) EgtSetInfo(Lg,'red' ,red) EgtSetInfo(Lg,'thb' ,thb) EgtSetInfo(Lg,'ech' ,ech) EgtSetInfo(Lg,'est' ,est) EgtSetInfo(Lg,'kbs' ,kbs) EgtSetInfo(Lg,'pbs' ,pbs) EgtSetInfo(Lg,'D_X' ,D_X) EgtSetInfo(Lg,'LG' ,LG) EgtSetInfo(Lg,'LM' ,LM) EgtSetInfo(Lg,'LA' ,LA) EgtSetInfo(Lg,'LAM' ,LAM) EgtSetInfo(Lg,'LAMU' ,LAMU) EgtSetInfo(Lg,'LBM' ,LBM) EgtSetInfo(Lg,'LBMU' ,LBMU) EgtSetInfo(Lg,'LCC' ,LCC) EgtSetInfo(Lg,'CH' ,CH) EgtSetInfo(Lg,'Path' ,sCompoPath) -- cancello le parti ausiliarie se disegnate if Dm then EgtErase( Dm) end elseif not bPreview then -- cancello le parti ausiliarie se disegnate if Dm then EgtErase( Dm) end end if EC == 0 and nCodAdj and nCodAdj < 0 then EC = nCodAdj EM = sCodAdj end return EC, EM, Lg end return Groove