-- -- 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 -- -- RollerLatch.lua by EgalWare s.r.l. 2016.06.14 -- Autore: Filippo Monchi -- Roller Latch -- 2016.09.21 V1.0a0 FM Add warning messages -- 2017.02.20 V1.0a1 FM Manage step face and radius face features -- 2018.04.05 V1.0a2 FM Manage info (KeepBackSet) for adjust probe on Z -- 2018.10.17 V1.0a3 FM Add parameter to show into message 402 -- 2018.10.22 V1.0a4 FM Manage better the big radius fillet parameter -- 2018.11.30 V1.0a5 FM Manage apply hardware on Lock side -- 2018.12.06 V1.0a6 FM Manage geometry for calculate box without RollerLatch volume (when strike) -- 2019.03.00 V1.0a7 FM Manage strike shape like Offset pivot (with knuckle) -- 2019.05.06 V1.0a8 FM Fix error on using DGD.OFFSET in case it is nil -- 2019.08.29 V1.0a9 FM Add setting pivot parameter for T shape -- 2019.10.11 V1.0aa FM Manage steel option (disable to generate pocket paths, mortise) -- 2019.10.18 V2.000 FM Manage use Materials -- 2019.10.29 V2.001 FM Add clean corner geometries -- 2019.12.18 V2.002 FM Use new parameter DGC.Eah that allow insert template also on bullnose ans convex profiles -- 2019.12.20 V2.003 FM fix a bug on clean corner direction path in case main path turn reverse -- 2020.04.29 V2.004 FM Update for aluminum material -- 2020.05.19 V2.005 FM Adjust position geometry for substract region on strike part -- 2020.05.19 V2.006 FM Adjust calculation parameter H3 and invert knuckle position on frames -- 2020.05.25 V2.007 FM Manage geometrie for calculate region when frame(jamb) is disposed on wide side -- 2020.06.19 V2.008 FM fix a bug on not initialized D variable -- 2020.07.01 V2.009 FM Disable Warning message on frames if parameter DGD.Spd is <= 0 -- 2021.01.22 V3.000 FM Manage better checking error on tools and dimension when produce flag is false -- 2021.03.12 V3.001 FM Manage rotation parameters on extra bores/buttonhole -- 2021.03.12 V3.001 FM Add missing functions DrawLocAddLineDrawCircle and DrawLocAddCircleDrawCircle -- 2021.03.12 V3.001 FM Remove not used variable bEqualTh into call function MakeBoreOrButtoHole -- 2021.05.10 V3.002 FM Set to 0 variable D_XT if it's not defined -- 2021.11.24 V3.003 FM Manage side probe option if variable DGC.Pms > 2 -- 2022.07.27 V3.004 FM Modification to use compiled code -- 2024.02.02 V3.005 FM Manage new geometry name suffix LK, enabled by SideDoorDefined CurrCamInfo parameter, to applied on side geometry -- when the lock is applied on side differeent than lock side -- 2024.07.19 V3.006 FM Set note 'NotCheckDir' to pocketing, antisplint and buttonhole pocketing paths -- 2024.10.02 V3.007 FM Manage probe geometry and their offset position when template is disposed on lock side -- 2024.10.29 V3.008 FM Manage new DGC.Fpd CurrDoorCustomData variable to force shuttle probe geometry to stay horizontal -- Tavola per definizione modulo (serve ma non usata) local RollerLatch = {} -- Intestazioni require( 'EgtBase') EgtEnableDebug( false) -- per messaggi -- EgtAddToPackagePath( EgtGetSourceDir() .. '?.lua') EgtAddToPackagePath( DGD.BASEDIR .. '?.lua') -- Valori limite local DgMin = 4. -- valore minimo diametro utensile local PtMin = 0.1 local PtMax = 1.0 local function DrawLocAddLineDrawCircle( pInitial, pFinal, nGroup, idTable, bPrev, nGroupCirc, nRad, bDrawFirst, bDrawLast, cColor1, cColor2) local nLine = EgtLine(nGroup, pInitial, pFinal, GDB_RT.LOC) if idTable then table.insert( idTable, nLine) 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 end local function DrawLocAddCircleDrawCircle( pCenter, dRadius, dAngIni, dAngCen, nGroup, idTable, bPrev, nGroupCirc, nRad, bDrawFirst, bDrawLast, cColor1, cColor2, sMVar) local nCircle = EgtArc( nGroup, pCenter, dRadius, dAngIni, dAngCen, 0, GDB_RT.LOC) local nNumCircle if idTable then table.insert( idTable, nCircle) -- se devo inserire una variazione nell'entità if sMVar then nNumCircle = #idTable end end if bPrev then if bDrawFirst then local nCircle1 = EgtCircle( nGroupCirc, EgtSP( nCircle), nRad , GDB_RT.LOC) EgtSetColor( nCircle1, cColor1) end if bDrawLast then local nCircle2 = EgtCircle( nGroupCirc, EgtEP( nCircle), nRad , GDB_RT.LOC) EgtSetColor( nCircle2, cColor2) end end return nCircle, nNumCircle, 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 creazione foro o asola o rampa per asola local function MakeBoreOrButtoHole( Lg, bPreview, Dm, nDrawMach, IY10, EBH10, EB10, PX10, Int10, D10, dParH, PY10, T10, RP10, AR10, RCI10, kbs, HB10, ls, dws, pbs) local pIni, pEnd, pCen local hint3, hint5 local tPath = {} local tPathPok = {} if IY10 > 0 and EBH10 ~= '' then -- se parametri asola presenti pIni = Point3d((PX10+Int10+(D10/2)),(dParH+PY10),0) pEnd = Point3d((PX10+Int10+(D10/2)),(dParH+PY10-(IY10/2)),0) DrawLocAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED()) pIni = pEnd pEnd = Point3d((PX10+Int10-(D10/2)),(dParH+PY10-(IY10/2)),0) pCen = Point3d((PX10+Int10),(dParH+PY10-(IY10/2)),0) DrawLocAddCircleDrawCircle( pCen, (D10/2), 0,-180, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED()) pIni = pEnd pEnd = Point3d((PX10+Int10-(D10/2)),(dParH+PY10+(IY10/2)),0) DrawLocAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED()) pIni = pEnd pEnd = Point3d((PX10+Int10+(D10/2)),(dParH+PY10+(IY10/2)),0) pCen = Point3d((PX10+Int10),(dParH+PY10+(IY10/2)),0) DrawLocAddCircleDrawCircle( pCen, (D10/2), 180,-180, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED()) pIni = pEnd pEnd = Point3d((PX10+Int10+(D10/2)),(dParH+PY10),0) DrawLocAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED()) pIni = pEnd hint3 = EgtCurveCompo( Lg, tPath, true) EgtModifyCurveThickness( hint3, -T10) -- se rotazione attiva if AR10 ~= 0 then -- rotazione in centro all'interasse if RCI10 then EgtRotate( hint3, Point3d((PX10),(dParH+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto -- rotazione in centro all'asola else EgtRotate( hint3, Point3d((PX10+Int10),(dParH+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto end end if nDrawMach > 0 and RP10 and RP10 > 0 and (RP10/2) < T10 then --se parametro step è valido, creao il percorso a zig-zag centrale EgtSetName( hint3,'_'..EBH10) -- aggiungo _ per disabilitare lavorazione local nStep = ceil(T10/RP10) -- numero di passate local dStep = (T10/nStep) -- passo ricalcolato local nPass = 1 local dZedStart = 0 local dZedWork local nInv = 1 pIni = Point3d((PX10+Int10),(dParH+PY10+((IY10/2)*nInv)),dZedStart) while nPass <= nStep do dZedWork = dZedStart - (dStep/2) nInv = -nInv pEnd = Point3d((PX10+Int10),(dParH+PY10+((IY10/2)*nInv)),dZedWork) DrawLocAddLineDrawCircle( pIni, pEnd, Lg, tPathPok, bPreview, Dm, 0, false, false, RED(), RED()) pIni = pEnd dZedWork = dZedStart - dStep nInv = -nInv pEnd = Point3d((PX10+Int10),(dParH+PY10+((IY10/2)*nInv)),dZedWork) DrawLocAddLineDrawCircle( pIni, pEnd, Lg, tPathPok, bPreview, Dm, 0, false, false, RED(), RED()) pIni = pEnd -- se ho altri passi scendo in z if nPass < nStep then dZedStart = dZedWork end nPass = nPass + 1 end -- faccio passata di ritorno nInv = -nInv pEnd = Point3d((PX10+Int10),(dParH+PY10+((IY10/2)*nInv)),-T10) DrawLocAddLineDrawCircle( pIni, pEnd, Lg, tPathPok, bPreview, Dm, 0, false, false, RED(), RED()) hint5 = EgtCurveCompo( Lg, tPathPok, true) EgtModifyCurveThickness( hint5, 0) EgtSetName( hint5, EBH10) EgtSetInfo( hint5, 'NotCheckDir', '1') -- se rotazione attiva if AR10 ~= 0 then -- rotazione in centro all'interasse if RCI10 then EgtRotate( hint5, Point3d((PX10),(dParH+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto -- rotazione in centro all'asola else EgtRotate( hint5, Point3d((PX10+Int10),(dParH+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto end end else EgtSetName( hint3, EBH10) end elseif EB10 ~= '' then hint3 = EgtCircle( Lg, Point3d((PX10+Int10),(dParH+PY10),0), D10/2 , GDB_RT.LOC) EgtModifyCurveThickness( hint3, -T10) EgtSetName( hint3, EB10) -- se rotazione in centro all'interasse (sono questo caso perchè non ha senso ruotare un foro in centro a se stesso) if AR10 ~= 0 and RCI10 then EgtRotate( hint3, Point3d((PX10),(dParH+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto end end -- se mantiene backset if kbs and kbs > 0 then local sKeepMode = 'c' -- setto di default per mantenere il centro spessore if ls then -- se latch strike sKeepMode = 'n' -- setto per mantenere per mantenere il lato narrow end EgtSetInfo( hint3, 'KeepBackSet', sKeepMode) if hint5 then EgtSetInfo( hint5, 'KeepBackSet', sKeepMode) end end if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint3, 'ProbeSide', '1') if hint5 then EgtSetInfo( hint5, 'ProbeSide', '1') end end if HB10 then EgtSetInfo( hint3, 'SideDoor', 'LockLH') if hint5 then EgtSetInfo( hint5, 'SideDoor', 'LockLH') end else EgtSetInfo (hint3, 'SideDoor', 'SideLH') if hint5 then EgtSetInfo( hint5, 'SideDoor', 'SideLH') end end if dws then local nIdSideBoxUp = EgtCopyGlob( hint3, Lg) EgtSetName( nIdSideBoxUp, 'upper') EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper') if hint5 then nIdSideBoxUp = EgtCopyGlob( hint5, Lg) EgtSetName( nIdSideBoxUp, 'upper') EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper') end end end -- Funzione di sistemazione parametri function RollerLatch.AdjustParams( tMhPar) local EgtDoorsMsg = require( 'EgtDoorsMsg') local dMaxMat local dMaxMat0 local dMaxMat1 local dMaxMat2 local dMaxMat3 local dNumMessage local dNumLog = 0 local sMessToOut = '' local nTempT0 local nTempT1 local nTempT2 local nTempT3 local nTempT4 local sMchngName0 local sMchngName1 local sMchngName2 local sMchngName3 local sMchngName4 local dOffset = DGD.OFFSET or 0 tMhPar.bETh = false -- parametro disposizione frame su lato wide (se = nil è sulla porta, se true dispsizione frame sul lato wide, se false dispsozione su lato narrow) tMhPar.Dws = DGD.Dws if tMhPar.Dws then -- se disposto sul lato wide, calcolo lo spessore relativo if DGD.nTypePz == 3 or DGD.nTypePz == 4 then tMhPar.dThD = DGD.dW elseif DGD.nTypePz == 5 or DGD.nTypePz == 6 then tMhPar.dThD = DGD.dH end end if tMhPar.H then if DGD.sFrame then -- se è un assemblato -- offset, in questo caso parte dal lato wide del frame, quindi gli si deve sottrarre la metà dello spessore del frame if abs(dOffset) > 0 then dOffset = dOffset - (DGD.dT/2) end tMhPar.H3 = ((DGD.dT + tMhPar.H)/2) - dOffset else -- l'offset è riferito dal centro spessore, -- cioè se <> da 0 le geometrie si spostano del valore offset da centro dello spessore tMhPar.H3 = ((DGD.dT + tMhPar.H)/2) - dOffset -- -tMhPar.H3 + (tMhPar.H/2) = -(DGD.dT/2) + dOffset -- -tMhPar.H3 + (tMhPar.H/2) + (DGD.dT/2) = dOffset end end tMhPar.invG = 1 tMhPar.invK = 1 tMhPar.fht = 0 -- setto il face h top a 0 tMhPar.fhb = 0 -- setto il face h bottom a 0 tMhPar.sopp = DGD.Lock == 'L' tMhPar.fopp = 1 if DGD.Lock == 'R' then if tMhPar.D_X then tMhPar.D_X = -tMhPar.D_X end else tMhPar.invK = -tMhPar.invK end if DGD.Push then tMhPar.invG = -tMhPar.invG end if string.lower(DGD.SIDE) == 'bottom' then tMhPar.invG = -tMhPar.invG end if tMhPar.nw and tMhPar.L3 and tMhPar.L3 <= 0.001 then tMhPar.ls = false end -- setto parametro riferimento profondità roller tMhPar.drf = DGD.dT/6 if DGD.sFrame then -- se è un assemblato tMhPar.drf = 0.1 -- in questo modo crea semre la regione da togliere relativa al materiale asportato tMhPar.sopp = not tMhPar.sopp tMhPar.fopp = -tMhPar.fopp if tMhPar.D_X then tMhPar.D_X = -tMhPar.D_X end end -- do errore se applicato a lato lock con profilo bullnose e convesso e non è ammesso if string.lower(DGD.SIDE) == 'lock' and not DGC.Eah and ( DGD.tProfs.lockedge.trimming == '1B' or DGD.tProfs.lockedge.trimming == '2B' or DGD.tProfs.lockedge.trimming == '3B' or DGD.tProfs.lockedge.trimming == '4B' or DGD.tProfs.lockedge.trimming == '5B' or DGD.tProfs.lockedge.trimming == '6B' or DGD.tProfs.lockedge.trimming == '7B' or DGD.tProfs.lockedge.trimming == '8B' or DGD.tProfs.lockedge.trimming == 'CV') then return tMhPar, 2099, string.format(EgtDoorsMsg[671], tMhPar.Nome, DGD.tProfs.lockedge.trimming) end -- se non ho il parametro chiseling lo setto disabilitato if not tMhPar.ech then tMhPar.ech = false end -- se non ho il parametro che impedisce la rotazione sul lato bevel lo setto a false if not tMhPar.dl then tMhPar.dl = false DGD.NOBVROT = false end -- Se c'è il profilo bevel e la geometria è applicata al lato lock if string.lower(DGD.SIDE) == 'lock' and ( DGD.tProfs.lockedge.trimming == 'BD' or DGD.tProfs.lockedge.trimming == 'BU' or DGD.tProfs.lockedge.trimming == 'BDEB' or DGD.tProfs.lockedge.trimming == 'BUEB') then -- setto il flag che indica profilo bevel tMhPar.bev = true -- Se il parametro per impedire la rotazione sul lato bevel è attivo, ricalcolo gli affondamenti if tMhPar.dl then -- setto la variabile di sistema per non ruotare la geometria DGD.NOBVROT = true local dExtraDepth = 0 if tMhPar.H and tMhPar.T and tMhPar.T > 0 and not tMhPar.ls then -- ricalcolo la profondità per avere spessore minimo = al valore di .T dExtraDepth = EgtIf( DGC.Bwd and DGC.Bwd == 2, 0, (( tMhPar.H/2) * TAN3)) tMhPar.T = tMhPar.T + dExtraDepth end if tMhPar.H2 and tMhPar.T2 and tMhPar.T2 > 0 then -- se il face è stato calcolato utilizzo il delta per mantenere lo stesso affondamento -- relativo quando non è bevel if dExtraDepth > 0 or tMhPar.ls then tMhPar.T2 = tMhPar.T2 + dExtraDepth else -- altrimenti ricalcolo la profondità per avere spessore minimo = al valore di .T tMhPar.T2 = tMhPar.T2 + EgtIf( DGC.Bwd and DGC.Bwd == 2, 0, (( tMhPar.H2/2) * TAN3)) end end end end -- se non c'è la variabile suffisso if not tMhPar.CH then tMhPar.CH = '_Chisel' end -- se c'è la variabile CurrCamInfo che indica che la porta è disposta con il lato lock sul lato navetta -- e il template è applicato sul lato lock, attivo il suffisso per tutte le geometrie sul lato tMhPar.LK = '' if DGD.SDF and DGD.SDF > 1 and string.lower(DGD.SIDE) == 'lock' then tMhPar.LK = '_LK' -- calcolo la posizione del centro foro sullo spessore porta if tMhPar.ls then tMhPar.posh = -(DGD.dT/2) else if dOffset > 0 then tMhPar.posh = (DGD.dT/2) - dOffset else tMhPar.posh = 0 end end if tMhPar.bev and not tMhPar.dl and not DGC.Fpd then tMhPar.posh = tMhPar.posh / cos( 3) end end -- se non è latch strike controllo il parametro arrotondamento e il raggio if not tMhPar.ls then DGD.LSREF = false -- setto la variabile globale if not tMhPar.cl then tMhPar.cl = 0 end if not tMhPar.rf then tMhPar.rf = 0 if tMhPar.cl > 0 and tMhPar.H then tMhPar.rf = tMhPar.H/2 end end -- se arrotondo entrambe le estremità disabilito il chisel e il clean corner if tMhPar.cl == 3 then tMhPar.ech = false tMhPar.clc = nil tMhPar.CLC = nil end end -- Assegno parametri da dati utensili in macchina local MB = require( 'MachiningBase') local sLM local nLMi = 1 local sLA local nLAi = 1 local sLMM local nLMMi = 1 local sLGH local nLGHi = 1 local sLG local nLGi = 1 -- se porta steel o aluminum disabilito l'antischeggia, la svuotatura, il chisel e modifico il nome geometria if FindMaterial( DGD.Material, 'steel') or FindMaterial( DGD.Material, 'aluminum') then tMhPar.LM = nil tMhPar.LA = nil tMhPar.LMM = nil tMhPar.ech = false tMhPar.CH = nil tMhPar.est = true tMhPar.d2 = nil else tMhPar.est = nil end if tMhPar.est and tMhPar.LG then sLG = tMhPar.LG .. tMhPar.LK if DGD.MachEn > 0 and tMhPar.d then nTempT0, dMaxMat0, sMchngName0 = MB.GetToolDataFromAttrib( sLG, nLGi) end end if tMhPar.LM then -- geometria face sLM = tMhPar.LM .. tMhPar.LK if DGD.MachEn > 0 and tMhPar.d then nTempT1, dMaxMat1, sMchngName1 = MB.GetToolDataFromAttrib( sLM, nLMi) end end if tMhPar.LA then -- geometria antischeggia face sLA = tMhPar.LA .. tMhPar.LK if DGD.MachEn > 0 and tMhPar.d2 then nTempT2, dMaxMat2, sMchngName2 = MB.GetToolDataFromAttrib( sLA, nLAi) end end if tMhPar.LMM then -- geometria mortise sLMM = tMhPar.LMM .. tMhPar.LK if DGD.MachEn > 0 and tMhPar.d3 then nTempT3, dMaxMat3, sMchngName3 = MB.GetToolDataFromAttrib( sLMM, nLMMi) end end if tMhPar.LGH then -- geometria foro sLGH = tMhPar.LGH .. tMhPar.LK if DGD.MachEn > 0 and tMhPar.mh and tMhPar.LGH then nTempT4, dMaxMat3, sMchngName4 = MB.GetToolDataFromAttrib( sLGH, nLGHi) end end if tMhPar.ech and tMhPar.LG then -- se chisel abilitato sLG = tMhPar.LG .. tMhPar.CH .. tMhPar.LK tMhPar.d0 = 0 if tMhPar.d0 then nTempT0, dMaxMat0, sMchngName0 = MB.GetToolDataFromAttrib( sLG, nLGi) end end if tMhPar.mh then -- se creo foro devo disabilitare il join tra face e mortise tMhPar.jn = false end -- se devo disegnare le geometrie di lavorazione if DGD.MachEn > 0 then -- gestisco il risultato della lettura utensili if DGD.bProoduce and tMhPar.est and tMhPar.d and nTempT0 and nTempT0 <= 0 then dNumLog = -2092 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT0, sLG, nLGi, tMhPar.d, dNumLog, sMchngName0) elseif tMhPar.est and nTempT0 then tMhPar.d = nTempT0 end -------------------------------------------------------------------------------- -- se c'è materiale steel faccio in modo che non assegni il diametro utensile -------------------------------------------------------------------------------- -- gestisco il risultato della lettura utensili if DGD.bProoduce and not tMhPar.est and tMhPar.d and nTempT1 <= 0 then dNumLog = -2099 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT1, sLM, nLMi, tMhPar.d, dNumLog, sMchngName1) elseif not tMhPar.est and nTempT1 then tMhPar.d = nTempT1 end if DGD.bProoduce and not tMhPar.est and tMhPar.d2 and nTempT2 <= 0 then dNumLog = -2099 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT2, sLA, nLAi, tMhPar.d2, dNumLog, sMchngName2) elseif not tMhPar.est and nTempT2 then tMhPar.d2 = nTempT2 end if not tMhPar.est and tMhPar.d3 and nTempT3 <= 0 then if DGD.bProoduce and not tMhPar.jn then -- se non si concatenano i due percorsi dNumLog = -2099 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT3, sLMM, nLMMi, tMhPar.d3, dNumLog, sMchngName3) end elseif not tMhPar.est and nTempT3 then tMhPar.d3 = nTempT3 end if DGD.bProoduce and tMhPar.mh and tMhPar.LGH and not dMaxMat3 then dNumLog = -2098 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT4, sLGH, nLGHi, nil, dNumLog, sMchngName4) end end -- Regola applicazione chiseling: -- se ho impostato un raccordo, anche se poi viene annullato perchè inferiore del raggio fresa -- disabilito il chiseling perchè implica che se c'è un valore di raccordo non devo fare il chiseling -- se tipo latch strike e il raggio valido disabilito il chiseling e il clean corner if tMhPar.ls then DGD.LSREF = true -- setto la variabile globale if tMhPar.R1 and tMhPar.R1 <= 0 then -- se a forma T valida, copio i valori del clean corner per eventuale applicazione su raggio singolo if tMhPar.H3 and tMhPar.H3 > 0 and tMhPar.L3 > 0 then tMhPar.clc5 = tMhPar.clc tMhPar.CLC5 = tMhPar.CLC end end if tMhPar.rf and tMhPar.rf > 0 then -- se a forma T copio i valori del clean corner per eventuale applicazione su raggio singolo -- e azzero il clean corner if tMhPar.H3 and tMhPar.H3 > 0 and tMhPar.L3 and tMhPar.L3 > 0 then tMhPar.clc5 = tMhPar.clc tMhPar.CLC5 = tMhPar.CLC tMhPar.clc = nil tMhPar.CLC = nil else tMhPar.clc = nil tMhPar.CLC = nil end else -- se non è definito o già nullo lo azzero tMhPar.rf = 0 end -- se ci sono tutti i raggi, disabilito il chisel if tMhPar.R1 and tMhPar.R1 > 0 and tMhPar.rf and tMhPar.rf > 0 then tMhPar.ech = false end -- se è alto come spessore porta annullo alcuni parametri (la forma ad L, il clean corner, il raggio, etc.) if tMhPar.H and tMhPar.H >= DGD.dT then tMhPar.bETh = true tMhPar.L3 = 0 tMhPar.H3 = 0 tMhPar.D_SK = 0 tMhPar.rf = 0 tMhPar.ech = false tMhPar.clc = nil tMhPar.CLC = nil tMhPar.clc5 = nil tMhPar.CLC5 = nil end if not tMhPar.H3 then tMhPar.H3 = 0 end if not tMhPar.L3 then tMhPar.L3 = 0 end -- se non esiste il valore della distanza del knuckle la setto a 0 if not tMhPar.D_SK then tMhPar.D_SK = 0 end -- prendo il valore assoluto tMhPar.D_SK = abs(tMhPar.D_SK) -- Se knuckle setto il raccordo R1 e R1i if tMhPar.D_SK > 0 then -- per face con knuckle in centro assegno il valore del raggio alla variabile di raggio interno tMhPar.R1i = tMhPar.R1 end if tMhPar.L3 > 0 and tMhPar.H3 > 0 then -- se ho forma ad L -- se non ho il parametro raccordo su singolo angolo lo setto al valore del raccordo if not tMhPar.R1 then tMhPar.R1 = tMhPar.rf end if DGD.sFrame then -- se è un assemblato rendo opposto la posizione del knuckle tMhPar.D_SK = tMhPar.L - tMhPar.L3 - tMhPar.D_SK end end else if tMhPar.H and tMhPar.H >= DGD.dT then tMhPar.bETh = true tMhPar.rf = 0 tMhPar.clc = nil tMhPar.CLC = nil end end -- se devo disegnare le geometrie di lavorazione if DGD.MachEn > 0 then -- se raggio non definito o minore del diametro utensile lo annullo -- if not tMhPar.rf or ( tMhPar.d and tMhPar.rf < tMhPar.d/2) then -- tMhPar.rf = 0 -- end -- chiseling if tMhPar.ech and tMhPar.d0 and nTempT0 > 0 then tMhPar.d0 = nTempT0 end -- se la profondità della face per steel è maggiore della capacità utensile limito la profondità ed emetto un warning if tMhPar.est and tMhPar.T and dMaxMat0 and tMhPar.T > dMaxMat0 then dNumLog = -2091 dNumMessage = 460 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T), EgtToUiUnits(dMaxMat0)) tMhPar.T = dMaxMat0 end -- se la profondità della face è maggiore della capacità utensile limito la profondità ed emetto un warning if tMhPar.T and dMaxMat1 and tMhPar.T > dMaxMat1 then dNumLog = -2097 dNumMessage = 460 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T), EgtToUiUnits(dMaxMat1)) tMhPar.T = dMaxMat1 - 0.02 -- tolgo 0.02 per permettere la lavorazione dMaxMat = dMaxMat1 end -- se la profondità antischeggia della face è maggiore della capacità utensile limito la profondità ed emetto un warning if tMhPar.T and dMaxMat2 and tMhPar.T > dMaxMat2 then dNumLog = -2096 dNumMessage = 462 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T), EgtToUiUnits(dMaxMat2)) tMhPar.T = dMaxMat2 - 0.02 -- tolgo 0.02 per permettere la lavorazione dMaxMat = dMaxMat2 end -- se foro abilitato e la profondità è maggiore della capacità utensile, -- limito la profondità ed emetto un warning if tMhPar.mh and tMhPar.T2 and dMaxMat3 and tMhPar.T2 > dMaxMat3 then dNumLog = -2095 dNumMessage = 463 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T2), EgtToUiUnits(dMaxMat3)) tMhPar.T2 = dMaxMat3 end -- se mortise concatenata a face e la profondità della mortise è maggiore della capacità utensile, -- limito la profondità ed emetto un warning if tMhPar.jn and not tMhPar.mh and tMhPar.T2 and dMaxMat and tMhPar.T2 > dMaxMat then dNumLog = -2094 dNumMessage = 461 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T2), EgtToUiUnits(dMaxMat)) tMhPar.T2 = dMaxMat end -- se la mortise non è concatenate a face e la profondità della mortise è maggiore della capacità utensile, -- limito la profondità ed emetto un warning if not tMhPar.jn and not tMhPar.mh and tMhPar.T2 and dMaxMat3 and tMhPar.T2 > dMaxMat3 then dNumLog = -2093 dNumMessage = 461 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T2), EgtToUiUnits(dMaxMat3)) tMhPar.T2 = dMaxMat3 end -- Raggio: se altro materiale e raggio presente e se raggio minore del diametro utensile + delta, lo annullo if tMhPar.est then if tMhPar.ls then if tMhPar.rf and tMhPar.rf > 0 and tMhPar.d and tMhPar.rf < ((tMhPar.d/2)+0.02) then tMhPar.rf = 0 end else if tMhPar.rf and tMhPar.rf > 0 and tMhPar.cl > 0 and tMhPar.d and tMhPar.rf < ((tMhPar.d/2)+0.02) then tMhPar.rf = 0 end end end -- setto un valore di poco inferiore allo spessore per non fresare le ventose local sPieceName if tMhPar.Dws then tMhPar.TTP = tMhPar.dThD - DGD.Spd if DGD.nTypePz == 3 then sPieceName = 'left Jamb' elseif DGD.nTypePz == 4 then sPieceName = 'right Jamb' elseif DGD.nTypePz == 5 then sPieceName = 'Frame header' else sPieceName = 'Threshold' end end -- controllo se le profondità delle geometrie non superano lo spessore frame if tMhPar.Dws and DGD.Spd > 0 and tMhPar.T and abs(tMhPar.T) > tMhPar.TTP then dNumLog = -2090 dNumMessage = 681 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, sPieceName, 'T', EgtToUiUnits(tMhPar.T), EgtToUiUnits(tMhPar.TTP), EgtToUiUnits(tMhPar.dThD)) .. ' \n' tMhPar.T = tMhPar.TTP end if tMhPar.Dws and DGD.Spd > 0 and tMhPar.T2 and abs(tMhPar.T2) > tMhPar.TTP then dNumLog = -2090 dNumMessage = 681 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, sPieceName, 'T2', EgtToUiUnits(tMhPar.T2), EgtToUiUnits(tMhPar.TTP), EgtToUiUnits(tMhPar.dThD)) .. ' \n' tMhPar.T2 = tMhPar.TTP end if tMhPar.T and tMhPar.T > 0 and tMhPar.ls then -- Se c'è il profilo bevel e la geometria è applicata al lato lock if ( DGD.tProfs.lockedge.trimming == 'BD' or DGD.tProfs.lockedge.trimming == 'BU' or DGD.tProfs.lockedge.trimming == 'BDEB' or DGD.tProfs.lockedge.trimming == 'BUEB') and string.lower(DGD.SIDE) == 'lock' then -- Se il parametro per impedire la rotazione sul lato bevel non è attivo if not tMhPar.dl then tMhPar.fht = tMhPar.T / cos(3) else tMhPar.fht = tMhPar.T end -- considerando l'angolo calcolo l'ingombro totale riferito al lato wide tMhPar.fhb = tMhPar.fht + ( DGD.dT * TAN3) else tMhPar.fht = tMhPar.T tMhPar.fhb = tMhPar.fht end end if tMhPar.CLC and tMhPar.clc and tMhPar.clc > 0 and ( tMhPar.clc >= tMhPar.H or tMhPar.clc >= tMhPar.L) then tMhPar.clc = nil elseif not tMhPar.CLC then tMhPar.clc = nil end if tMhPar.CLC5 and tMhPar.clc5 and tMhPar.clc5 > 0 and ( tMhPar.clc5 >= tMhPar.H3 or tMhPar.clc5 >= tMhPar.L) then tMhPar.clc5 = nil elseif not tMhPar.CLC5 then tMhPar.clc5 = nil end end -- se non ho parametro step o è 0 lo assegno uguale allo spessore cava if tMhPar.T and ( not tMhPar.sf or abs(tMhPar.sf) < GEO.EPS_SMALL) then tMhPar.sf = tMhPar.T end if dNumLog ~= 0 then return tMhPar, dNumLog, sMessToOut end return tMhPar, 0, '' end -- Funzione di disegno function RollerLatch.Draw( tRollerParam, bPreview, bRunByCompo, nDrawMach, dThickDoor) -- Assegno le dimensioni, parametri utensili e settaggi local L = tRollerParam.L local H = tRollerParam.H local T = tRollerParam.T local d = tRollerParam.d local p = tRollerParam.p local sf = tRollerParam.sf local cl = tRollerParam.cl local rf = tRollerParam.rf -- raggio arrotondamento face e a forma di L local R1 = tRollerParam.R1 -- raggio arrotondamento face su singolo corner local R1i = tRollerParam.R1i -- raggio interno per face con knuckle centrale local clc = tRollerParam.clc local ccr = tRollerParam.ccr local clc5 = tRollerParam.clc5 local D_SK = tRollerParam.D_SK -- distanza partenza knuckle local D_SK2 local L3 = tRollerParam.L3 -- lunghezza Knuckle a forma di L local H3 = tRollerParam.H3 -- altezza Knuckle a forma di L local d2 = tRollerParam.d2 local mh = tRollerParam.mh -- abilitazione creazione mortasa/foro local L2 = tRollerParam.L2 local H2 = tRollerParam.H2 local T2 = tRollerParam.T2 local d3 = tRollerParam.d3 local p3 = tRollerParam.p3 local s = tRollerParam.s local ls = tRollerParam.ls -- flag 'latch strike' local jn = tRollerParam.jn -- flag join paths, means use 'same tool' for face and mortise local posh = tRollerParam.posh -- posizione in Y del foro di tastatura local posp = tRollerParam.posp -- posizione in X del foro di tastatura local D = tRollerParam.D -- distance to edge local D_X = tRollerParam.D_X -- delta on X pos on mortaise local D_XT = tRollerParam.D_XT -- delta on X pos for all geometries local invG = tRollerParam.invG local invK = tRollerParam.invK local ech = tRollerParam.ech local est = tRollerParam.est local kbs = tRollerParam.kbs -- keep backset/thickness (0: none, 1: only face, 2: all) local pbs = tRollerParam.pbs local dl = tRollerParam.dl local bEqualTh = tRollerParam.bETh local fht = tRollerParam.fht local fhb = tRollerParam.fhb local sopp = tRollerParam.sopp local fopp = tRollerParam.fopp local drf = tRollerParam.drf local dws = tRollerParam.Dws local dthd = tRollerParam.dThD local ttp = tRollerParam.TTP local tExtraBore = {} table.insert( tExtraBore, { tRollerParam.D4, tRollerParam.T4, tRollerParam.I4, tRollerParam.PX4, tRollerParam.PY4, tRollerParam.EB4, tRollerParam.HB4}) table.insert( tExtraBore, { tRollerParam.D5, tRollerParam.IY5, tRollerParam.T5, tRollerParam.I5, tRollerParam.PX5, tRollerParam.PY5, tRollerParam.RP5, tRollerParam.EB5, tRollerParam.EBH5, tRollerParam.HB5, tRollerParam.AR5, tRollerParam.RCI5}) table.insert( tExtraBore, { tRollerParam.D6, tRollerParam.IY6, tRollerParam.T6, tRollerParam.I6, tRollerParam.PX6, tRollerParam.PY6, tRollerParam.RP6, tRollerParam.EB6, tRollerParam.EBH6, tRollerParam.HB6, tRollerParam.AR6, tRollerParam.RCI6}) table.insert( tExtraBore, { tRollerParam.D7, tRollerParam.IY7, tRollerParam.T7, tRollerParam.I7, tRollerParam.PX7, tRollerParam.PY7, tRollerParam.RP7, tRollerParam.EB7, tRollerParam.EBH7, tRollerParam.HB7, tRollerParam.AR7, tRollerParam.RCI7}) -- Assegno i nomi geometrie local LG = tRollerParam.LG -- nome geometria face local LM = tRollerParam.LM -- nome lavorazione face local LA = tRollerParam.LA -- nome geometria antischeggia local LGM = tRollerParam.LGM -- nome geometria mortise local LMM = tRollerParam.LMM -- nome lavorazione mortise local LGH = tRollerParam.LGH -- nome geometria foro profondo local CH = tRollerParam.CH -- suffisso lavorazione chisel local CLC = tRollerParam.CLC -- nome geometria clean corner local CLC5 = tRollerParam.CLC5 -- nome geometria clean corner su raggio singolo in caso roller a forma di T local LK = tRollerParam.LK -- nome suffisso lavorazione su lato lock local LH = 'Shuttle_Probe' local DM = 'DUMMY' -- variabili per messaggi e settaggi vari local sCompoName = tRollerParam.Nome local nCompoNpar = tRollerParam.Npar local sCompoPath = tRollerParam.Path -- eventuale messaggio errore rilevato nell'adjust local nCodAdj = tRollerParam.nCod local sCodAdj = tRollerParam.sCod -- variabili per messaggi di errore local sNamePar1 = tRollerParam.N1 or 'L' local sNamePar2 = tRollerParam.N2 or 'H' local sNamePar3 = tRollerParam.N3 or 'T' local sNamePar4 = tRollerParam.N4 or 'd' local sNamePar5 = tRollerParam.N5 or 'p' local sNamePar7 = tRollerParam.N7 or 'd2' local sNamePar8 = tRollerParam.N8 or 'L2' local sNamePar9 = tRollerParam.N9 or 'H2' local sNamePar10 = tRollerParam.N10 or 'T2' local sNamePar11 = tRollerParam.N11 or 'd3' local sNamePar12 = tRollerParam.N12 or 'p3' local sNamePar13 = tRollerParam.N13 or 's' local sNamePar14 = tRollerParam.N14 or 'L3' local sNamePar15 = tRollerParam.N15 or 'H3' local sNamePar16 = tRollerParam.N16 or 'D_SK' local sNamePar17 = tRollerParam.N17 or 'R1' local sNamePar18 = tRollerParam.N18 or 'R1i' local sNamePar22 = tRollerParam.N22 or 'D' local sNamePar23 = tRollerParam.N23 or 'DX' local sNamePar24 = tRollerParam.N24 or 'sf' local sNamePar25 = tRollerParam.N25 or 'rf' local sNamePar26 = tRollerParam.N26 or 'clc' local sNamePar27 = tRollerParam.N27 or 'clc5' -- RunByComponetInterface local RC = true -- Messaggi codice errori local EM = ' ' local EC = 0 local ErrorBase = 2000 -- variabili che abilitano la creazione della geometria local bMakeFaceGeom = true local bMakeMortGeom = true -- variabili dei percorsi geometrici local nGeom1, nGeom2, nAS1, nAS2 local nPkToJoin1, nPkToJoin2, nPkToJoin local dPosMortise = D_X or 0 -- se ho il suffisso per lavorazione su lato lock modifico i nomi geometrie applicati su questo lato if LK and #LK > 0 then if LG then LG = LG .. LK tRollerParam.LG = LG end if LM then LM = LM .. LK tRollerParam.LM = LM end if LA then LA = LA .. LK tRollerParam.LA = LA end if LGM then LGM = LGM .. LK tRollerParam.LGM = LGM end if LMM then LMM = LMM .. LK tRollerParam.LMM = LMM end if LGH then LGH = LGH .. LK tRollerParam.LGH = LHG end if CLC then CLC = CLC .. LK tRollerParam.CLC = CLC end if CLC5 then CLC5 = CLC5 .. LK tRollerParam.CLC5 = CLC5 end end 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 bMakeFaceGeom = false clc = nil CLC = nil clc5 = nil CLC5 = nil end -- se le dimensioni del raccordo sono eccessive le riconduco a valori accettabili if bMakeFaceGeom and not ls and cl > 0 then if L >= H then if rf > (H/2) then rf = (H/2) tRollerParam.rf = rf end else if rf > (L/2) then rf = (L/2) tRollerParam.rf = rf end end end if bMakeFaceGeom and ls and L3 and L3 > 0 and D_SK and D_SK > 0 then D_SK2 = L - ( D_SK + L3) end if not T then T = 0 end if not D then D = 0 end if est or not L2 or not H2 then bMakeMortGeom = false end if not H2 and not T2 then -- se non ci sono i parametri dimensionali per il foro lo disabilito bMakeMortGeom = false mh = false end if mh then -- se abilitato il foro disabilito la mortasa bMakeMortGeom = false end if not T2 then T2 = 0 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 nForceMakeFace = nDrawMach -- se ho abilitato il chiseling modifico il nome geometria if ech and LG then LG = LG .. CH tRollerParam.LG = LG -- se ho abilitato solo le geometrie di lavorazione, abilito la generazione di entrambe per il contorno chisel if nDrawMach == 1 then nForceMakeFace = 2 end end local EgtDoorsMsg = require( 'EgtDoorsMsg') -- Verifica delle dimensioni, le condizioni vengono verificate in base a quale geometria deve essere creata if bMakeFaceGeom and nDrawMach > 0 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 bMakeFaceGeom and nDrawMach > 0 and d2 and d2 < DgMin then EC = 2 EM = string.format(EgtDoorsMsg[400],sNamePar7,EgtToUiUnits(d2),EgtToUiUnits(DgMin)) -- il diametro utensile deve essere >= di d2 = DgMin elseif bMakeMortGeom and nDrawMach > 0 and not jn and d3 and d3 < DgMin then EC = 3 EM = string.format(EgtDoorsMsg[400],sNamePar11,EgtToUiUnits(d3),EgtToUiUnits(DgMin)) -- il diametro utensile deve essere >= di d3 = DgMin elseif bMakeFaceGeom and H <= 0 then EC = 4 EM = string.format(EgtDoorsMsg[401],sNamePar2,EgtToUiUnits(H), sCompoPath) -- il parametro 'H' deve essere > 0 H = d/2 elseif bMakeFaceGeom and nDrawMach > 0 and not ls and H < d then if DGD.bProoduce then EC = 5 EM = string.format(EgtDoorsMsg[405],sNamePar2,EgtToUiUnits(H),EgtToUiUnits(d), sCompoPath) -- il parametro 'H' deve essere maggiore o uguale del diametro utensile H = d else d = H - 0.002 end elseif bMakeMortGeom and nDrawMach > 0 and jn and H2 < d then if DGD.bProoduce then EC = 6 EM = string.format(EgtDoorsMsg[405],sNamePar9,EgtToUiUnits(H2),EgtToUiUnits(d), sCompoPath) -- il parametro 'H2' deve essere maggiore o uguale del diametro utensile H2 = d else d = H2 - 0.002 end elseif bMakeMortGeom and nDrawMach > 0 and not jn and H2 < d3 then if DGD.bProoduce then EC = 7 EM = string.format(EgtDoorsMsg[405],sNamePar9,EgtToUiUnits(H2),EgtToUiUnits(d3), sCompoPath) -- il parametro 'H2' deve essere maggiore o uguale del diametro utensile H2 = d3 else d3 = H2 - 0.002 end elseif bMakeFaceGeom and L <= 0 then EC = 8 EM = string.format(EgtDoorsMsg[401],sNamePar1,EgtToUiUnits(L), sCompoPath) -- il parametro 'L' deve essere > 0 L = d elseif bMakeFaceGeom and nDrawMach > 0 and L <= d then if DGD.bProoduce then EC = 9 EM = string.format(EgtDoorsMsg[402],sNamePar1,EgtToUiUnits(L),sNamePar4,EgtToUiUnits(d), sCompoPath) -- il parametro 'L' deve essere maggiore del diametro utensile L = d + 0.002 else d = L - 0.002 end elseif bMakeFaceGeom and nDrawMach > 0 and d2 and L <= d2 then if DGD.bProoduce then EC = 10 EM = string.format(EgtDoorsMsg[402],sNamePar1,EgtToUiUnits(L),sNamePar7,EgtToUiUnits(d2), sCompoPath) -- il parametro 'L' deve essere maggiore del diametro utensile L = d2 + 0.002 else d2 = L - 0.002 end elseif bMakeMortGeom and nDrawMach > 0 and jn and L2 <= d then if DGD.bProoduce then EC = 11 EM = string.format(EgtDoorsMsg[402],sNamePar8,EgtToUiUnits(L2),sNamePar4,EgtToUiUnits(d), sCompoPath) -- il parametro 'L2' deve essere maggiore del diametro utensile L2 = d + 0.002 else d = L2 - 0.002 end elseif bMakeMortGeom and nDrawMach > 0 and not jn and L2 <= d3 then if DGD.bProoduce then EC = 12 EM = string.format(EgtDoorsMsg[402],sNamePar8,EgtToUiUnits(L2),sNamePar11,EgtToUiUnits(d3), sCompoPath) -- il parametro 'L2' deve essere maggiore del diametro utensile L2 = d3 + 0.002 else d3 = L2 - 0.002 end elseif bMakeMortGeom and nDrawMach > 0 and s and s <= 0 then EC = 13 EM = string.format(EgtDoorsMsg[401],sNamePar13,EgtToUiUnits(s), sCompoPath) -- il parametro 's' deve essere > 0 s = d elseif bMakeFaceGeom and nDrawMach > 0 and ( p < PtMin or p > PtMax) then EC = 14 EM = string.format(EgtDoorsMsg[403],sNamePar5,p,PtMin,PtMax, sCompoPath) -- il parametro 'p' deve essere compreso tra p = 0.8 elseif bMakeMortGeom and nDrawMach > 0 and not jn and ( p3 < PtMin or p3 > PtMax) then EC = 15 EM = string.format(EgtDoorsMsg[403],sNamePar12,p3,PtMin,PtMax, sCompoPath) -- il parametro 'p3' deve essere compreso tra p3 = 0.8 elseif bMakeFaceGeom and T < 0 then EC = 16 EM = string.format(EgtDoorsMsg[404],sNamePar3,EgtToUiUnits(T), sCompoPath) -- il parametro 'T' deve essere >= 0 T = 0 elseif bMakeMortGeom and not dws and T2 <= T then EC = 17 EM = string.format(EgtDoorsMsg[407],sNamePar10,EgtToUiUnits(T2),sNamePar3,EgtToUiUnits(T), sCompoPath) -- il parametro 'T2' deve essere > del parametro 'T' T2 = T + 0.01 elseif bMakeFaceGeom and not ls and cl > 0 and rf and rf < 0 then EC = 18 EM = string.format(EgtDoorsMsg[404],sNamePar25,EgtToUiUnits(rf), sCompoPath) -- il parametro 'rf' deve essere >= 0 rf = H/2 elseif bMakeFaceGeom and not ls and cl > 0 and rf and abs(rf - (H/2)) < GEO.EPS_SMALL and L <= H then EC = 19 EM = string.format(EgtDoorsMsg[407],sNamePar1,EgtToUiUnits(L),sNamePar2,EgtToUiUnits(H), sCompoPath) -- il parametro 'L' deve essere > 'H' L = H+5 elseif bMakeFaceGeom and not ls and cl > 0 and rf and rf < (H/2) and L <= (rf*2) then EC = 20 EM = string.format(EgtDoorsMsg[407],sNamePar1,EgtToUiUnits(L),sNamePar25..'*2',EgtToUiUnits(rf)*2, sCompoPath) -- il parametro 'L' deve essere > 'rf*2' L = (rf*2)+5 elseif bMakeFaceGeom and ls and rf and rf >= H then EC = 30 EM = string.format(EgtDoorsMsg[407],sNamePar2,EgtToUiUnits(H),sNamePar25,EgtToUiUnits(rf), sCompoPath) -- il parametro 'H' deve essere > 'rf' H = rf + 0.01 elseif bMakeFaceGeom and ls and rf and L <= (rf*2) then EC = 31 EM = string.format(EgtDoorsMsg[407],sNamePar1,EgtToUiUnits(L),sNamePar25..'*2',EgtToUiUnits(rf)*2, sCompoPath) -- il parametro 'L' deve essere > 'rf*2' L = (rf*2)+1 -- elseif bMakeFaceGeom and bMakeMortGeom and (cl == 1 or cl == 2) and rf and (L-rf) < L2 then -- EC = 21 -- EM = string.format(EgtDoorsMsg[410],sNamePar1,EgtToUiUnits(L),sNamePar8,sNamePar25,EgtToUiUnits(L2+rf), sCompoPath) -- il parametro 'L' deve essere >= 'L2' + 'rf' -- L = rf+L2+5 -- elseif bMakeFaceGeom and bMakeMortGeom and cl == 3 and rf and (L-(rf*2)) < L2 then -- EC = 22 -- EM = string.format(EgtDoorsMsg[410],sNamePar1,EgtToUiUnits(L),sNamePar8,sNamePar25..'*2',EgtToUiUnits(L2+(rf*2)), sCompoPath) -- il parametro 'L' deve essere >= 'L2' + 'rf*2' -- L = (rf*2)+L2+5 -- elseif bMakeFaceGeom and bMakeMortGeom and cl == 3 and rf and (L-(rf*2)) < (L2+(2*abs(D_X))) then -- EC = 23 -- EM = string.format(EgtDoorsMsg[423],sNamePar23,EgtToUiUnits(D_X),EgtToUiUnits((L-(rf*2)-L2)/2), sCompoPath) -- il parametro 'D_X' é troppo grande, max valore: -- D_X = 0 -- elseif bMakeFaceGeom and bMakeMortGeom and (cl == 1 or cl == 2) and rf and (L-rf) < (L2+(2*abs(D_X))) then -- EC = 24 -- EM = string.format(EgtDoorsMsg[423],sNamePar23,EgtToUiUnits(D_X),EgtToUiUnits((L-rf-L2)/2), sCompoPath) -- il parametro 'D_X' é troppo grande, max valore: -- D_X = 0 elseif bMakeFaceGeom and bMakeMortGeom and L < L2 then EC = 25 EM = string.format(EgtDoorsMsg[407],sNamePar1,EgtToUiUnits(L),sNamePar8,EgtToUiUnits(L2), sCompoPath) -- il parametro 'L' deve essere > 'L2' L = L2+5 elseif bMakeFaceGeom and bMakeMortGeom and L < (L2+(2*abs(D_X))) then EC = 26 EM = string.format(EgtDoorsMsg[423],sNamePar23,EgtToUiUnits(D_X),EgtToUiUnits((L-L2)/2), sCompoPath) -- il parametro 'D_X' é troppo grande, max valore: D_X = 0 elseif bMakeFaceGeom and bMakeMortGeom and not ls and H2 > H then EC = 27 EM = string.format(EgtDoorsMsg[422],sNamePar2,EgtToUiUnits(H),sNamePar9,EgtToUiUnits(H2), sCompoPath) -- il parametro 'H' deve essere >= del parametro 'H2' H2 = H elseif bMakeFaceGeom and bMakeMortGeom and ls and L3 <= 0 and (H2+D) > H then EC = 28 EM = string.format(EgtDoorsMsg[423],sNamePar22,EgtToUiUnits(D),EgtToUiUnits(H-H2), sCompoPath) -- il parametro 'D' é troppo grande, max valore: D = 0 elseif bMakeFaceGeom and nDrawMach > 0 and sf and sf <= 0 then EC = 29 EM = string.format(EgtDoorsMsg[401],sNamePar24,EgtToUiUnits(sf), sCompoPath) -- il parametro 'sf' deve essere > 0 sf = d elseif bMakeFaceGeom and CLC and clc and ccr and clc > 0 and ccr > 0 and (2*(ccr*sin(45))) >= clc then EC = 43 EM = string.format(EgtDoorsMsg[407],sNamePar26,EgtToUiUnits(clc),'',EgtToUiUnits(2*(ccr*sin(45))), sCompoPath) -- il parametro 'clc' deve essere > 'crc' clc = (2*(ccr*sin(45)))+0.2 elseif bMakeFaceGeom and CLC5 and clc5 and ccr and clc5 > 0 and ccr > 0 and (2*(ccr*sin(45))) >= clc5 then EC = 44 EM = string.format(EgtDoorsMsg[407],sNamePar27,EgtToUiUnits(clc5),'',EgtToUiUnits(2*(ccr*sin(45))), sCompoPath) -- il parametro 'clc' deve essere > 'crc' clc5 = (2*(ccr*sin(45)))+0.2 -- controlli per forma ad L/T elseif bMakeFaceGeom and ls and L3 > 0 then if H3 > 0 and H3 <= H then EC = 32 EM = string.format(EgtDoorsMsg[407],sNamePar15,EgtToUiUnits(H3),sNamePar2,EgtToUiUnits(H), sCompoPath) -- il parametro 'H3' deve essere > 'H' H3 = H*1.5 elseif L3 >= L then EC = 33 EM = string.format(EgtDoorsMsg[406],sNamePar14,EgtToUiUnits(L3),sNamePar1,EgtToUiUnits(L), sCompoPath) -- il parametro 'L3' deve essere < 'L' L3 = L/2 elseif rf > H/2 then EC = 34 EM = string.format(EgtDoorsMsg[406],sNamePar25,EgtToUiUnits(rf),'H/2',EgtToUiUnits(H/2), sCompoPath) -- il parametro 'rf' deve essere < 'H/2' rf = H/2 elseif L-L3 < rf then EC = 35 EM = string.format(EgtDoorsMsg[407],sNamePar1,EgtToUiUnits(L),'L3+rf',EgtToUiUnits(L3+rf), sCompoPath) -- il parametro 'L' deve essere > 'L3+R' L = L3+rf elseif R1 >= L-rf then EC = 36 EM = string.format(EgtDoorsMsg[456],sNamePar17,EgtToUiUnits(R1),'L-rf',EgtToUiUnits(L-rf), sCompoPath) -- il parametro 'R1' deve essere <= 'L-rf' R1 = L-rf-1.5 elseif R1 > 0 and R1 >= H3 then EC = 37 EM = string.format(EgtDoorsMsg[406],sNamePar17,EgtToUiUnits(R1), sNamePar15,EgtToUiUnits(H3), sCompoPath) -- il parametro 'R1' deve essere < 'H3' R1 = H3-1.5 elseif D_SK > 0 and D_SK2 > 0 and ((R1i + rf) - D_SK) > GEO.EPS_SMALL then EC = 38 EM = string.format(EgtDoorsMsg[407],sNamePar16,EgtToUiUnits(D_SK),'rf+R1',EgtToUiUnits(rf+R1i), sCompoPath) -- il parametro 'D_SK' deve essere > 'rf+R1' D_SK = rf+R1+0.1 elseif D_SK > 0 and D_SK2 > 0 and ((R1i + rf) - (L-D_SK-L3)) > GEO.EPS_SMALL then EC = 39 EM = string.format(EgtDoorsMsg[407],sNamePar1,EgtToUiUnits(L),'D_SK+L3+rf+R1',EgtToUiUnits(D_SK+L3+rf+R1i), sCompoPath) -- il parametro 'L' deve essere > 'D_SK+L3+rf+R1' L = D_SK+L3+rf+R1+0.1 elseif D_SK > 0 and R1i > 0 and R1i > (H3-H) then EC = 40 EM = string.format(EgtDoorsMsg[406],sNamePar18,EgtToUiUnits(R1i),'H3-H (Backset)',EgtToUiUnits(H3-H), sCompoPath) -- il parametro 'R1' deve essere < 'H3-H' R1i = 0 R1 = 0 elseif bMakeMortGeom and H2 > H then EC = 41 EM = string.format(EgtDoorsMsg[422],sNamePar2,EgtToUiUnits(H),sNamePar9,EgtToUiUnits(H2), sCompoPath) -- il parametro 'H' deve essere >= del parametro 'H2' H2 = H elseif bMakeMortGeom and D and H2 and (abs(D)*2) > (H-H2) then EC = 42 EM = string.format(EgtDoorsMsg[423],sNamePar22,EgtToUiUnits(abs(D)),EgtToUiUnits((H-H2)/2), sCompoPath) -- il parametro 'D' é troppo grande, max valore: D = 0 end 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 local Lg, Dm local sRequireCompoName local nPos1st = 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 if ls then -- se latch strike lancio il componente tipo mortase hinge e tipo concelead hinge senza latch if H3 > 0 and L3 > 0 then -- se ha forma L/T sRequireCompoName = '_PivotL' tRollerParam.stype = 1 tRollerParam.rad = rf if D_SK > 0 then tRollerParam.D_SK2 = L - ( D_SK + L3) end if DGD.Lock == 'L' then tRollerParam.D_SK = L - ( D_SK + L3) tRollerParam.D_SK2 = L - ( tRollerParam.D_SK + L3) if D_SK == 0 then tRollerParam.D_SK2 = 0 end end else sRequireCompoName = '_LatchStrike' end else -- altrimenti lancio componente tipo concealed hinge if bMakeFaceGeom then -- in base agli arrotondamenti calcolo lo spostamento per posizionare la cava in centro if cl == 1 then -- se arrotondamento a sinistra nPos1st = rf/2 elseif cl == 2 then -- se arrotondamento a destra nPos1st = -(rf/2) else nPos1st = 0 end end tRollerParam.D_X = dPosMortise - nPos1st sRequireCompoName = '_Latch' tRollerParam.Dws = nil end if bMakeFaceGeom then if ls then tRollerParam.D_X = dPosMortise + tRollerParam.D_SK end -- lancio il primo componente base MHgen = require( sRequireCompoName) nGeom1, nPkToJoin1, nAS1, nAS2 = MHgen.Draw( EC, EM, tRollerParam, bPreview, bRunByCompo, nForceMakeFace, Pz, Lg, dThickDoor) -- se face a T/L sposto le geometrie if ls and H3 > 0 and L3 > 0 then if nGeom1 then EgtMove( nGeom1, Point3d(((L-L3)/2)-tRollerParam.D_SK,(-H3 + (H/2)),0) - ORIG()) end if nPkToJoin1 then EgtMove( nPkToJoin1, Point3d(((L-L3)/2)-tRollerParam.D_SK,(-H3 + (H/2)),0) - ORIG()) end if nAS1 then EgtMove( nAS1, Point3d(((L-L3)/2)-tRollerParam.D_SK,(-H3 + (H/2)),0) - ORIG()) end if nAS2 then EgtMove( nAS2, Point3d(((L-L3)/2)-tRollerParam.D_SK,(-H3 + (H/2)),0) - ORIG()) end elseif not ls and abs(nPos1st) > GEO.EPS_SMALL then if nGeom1 then EgtMove( nGeom1, Point3d(nPos1st,0,0) - ORIG()) end if nPkToJoin1 then EgtMove( nPkToJoin1, Point3d(nPos1st,0,0) - ORIG()) end end -- Clean corner if nDrawMach >= 0 then -- se abilitata geometria local CLC1 if CLC and clc and clc > 0 and clc < H and clc < L then CLC1 = MakeClcPath( clc, ccr, CLC, Lg, -T, (invG == -1)) if CLC1 then -- se mantiene backset if kbs and kbs > 0 then local sKeepMode = 'c' -- setto di default per mantenere il centro dello spessore if ls then -- se latch strike sKeepMode = 'n' -- setto per mantenere per mantenere il lato narrow end EgtSetInfo( CLC1, 'KeepBackSet', sKeepMode) end if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( CLC1, 'ProbeSide', '1') end end end if ls then -- se latch strike if H3 > 0 and L3 > 0 then -- se face a T/L if tRollerParam.D_SK > 0 and tRollerParam.D_SK2 > 0 then -- se ho knuckle centrato if CLC1 then -- angolo x+y+ local CLC2 = EgtCopyGlob( CLC1, Lg) EgtRotate( CLC2, Point3d(0,0,0), Z_AX(), -90) EgtMove( CLC2, Point3d((L/2),H-H3,0) - ORIG()) -- angolo x+y- local CLC3 = EgtCopyGlob( CLC1, Lg) EgtRotate( CLC3, Point3d(0,0,0), Z_AX(), 180) EgtMove( CLC3, Point3d((L/2),-H3,0) - ORIG()) -- angolo x-y- local CLC4 = EgtCopyGlob( CLC1, Lg) EgtRotate( CLC4, Point3d(0,0,0), Z_AX(), 90) EgtMove( CLC4, Point3d(-(L/2),-H3,0) - ORIG()) -- angolo x-y+ EgtMove( CLC1, Point3d(-(L/2),H-H3,0) - ORIG()) end elseif tRollerParam.D_SK > 0 then -- se knuckle opposto if CLC1 then -- angolo x+y+ local CLC2 = EgtCopyGlob( CLC1, Lg) EgtRotate( CLC2, Point3d(0,0,0), Z_AX(), -90) EgtMove( CLC2, Point3d((L/2),H-H3,0) - ORIG()) -- angolo x+y- EgtRotate( CLC1, Point3d(0,0,0), Z_AX(), 180) EgtMove( CLC1, Point3d((L/2),-H3,0) - ORIG()) end elseif tRollerParam.D_SK == 0 then -- se forma L classica if CLC1 then local CLC4 = EgtCopyGlob( CLC1, Lg) -- angolo x-y- EgtRotate( CLC1, Point3d(0,0,0), Z_AX(), 90) EgtMove( CLC1, Point3d(-(L/2),-H3,0) - ORIG()) -- angolo x-y+ EgtMove( CLC4, Point3d(-(L/2),H-H3,0) - ORIG()) end end if R1 <= 0 and ( tRollerParam.D_SK == 0 or tRollerParam.D_SK2 == 0) then -- se non c'è raccordo angolo singolo if CLC5 and clc5 and clc5 > 0 and clc5 < H3 and clc5 < L then local CLC5 = MakeClcPath(clc5, ccr, CLC5, Lg, -T, (invG == -1)) if CLC5 then -- se mantiene backset if kbs and kbs > 0 then local sKeepMode = 'c' -- setto di default per mantenere il centro dello spessore if ls then -- se latch strike sKeepMode = 'n' -- setto per mantenere per mantenere il lato narrow end EgtSetInfo( CLC5, 'KeepBackSet', sKeepMode) end if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( CLC5, 'ProbeSide', '1') end if tRollerParam.D_SK == 0 then -- se forma L classica -- angolo x+y- EgtRotate( CLC5, Point3d(0,0,0), Z_AX(), 180) EgtMove( CLC5, Point3d((L/2),-H3,0) - ORIG()) else -- se L opposta -- angolo x-y- EgtRotate( CLC5, Point3d(0,0,0), Z_AX(), 90) EgtMove( CLC5, Point3d(-(L/2),-H3,0) - ORIG()) end end end end else -- altrimenti forma latch srike standard if CLC1 then -- angolo x+y- local CLC2 = EgtCopyGlob( CLC1, Lg) EgtRotate( CLC2, Point3d(0,0,0), Z_AX(), 180) EgtMove( CLC2, Point3d((L/2),-H,0) - ORIG()) -- angolo x-y- EgtRotate( CLC1, Point3d(0,0,0), Z_AX(), 90) EgtMove( CLC1, Point3d(-(L/2),-H,0) - ORIG()) end end else -- altrimenti non latch strike if cl ~= 3 or ( cl == 3 and rf > 0) then -- se c'è almeno un lato senza raccordo if CLC1 then if cl <= 1 or cl == 3 then -- angolo x+y+ local CLC2 = EgtCopyGlob( CLC1, Lg) EgtRotate( CLC2, Point3d(0,0,0), Z_AX(), -90) EgtMove( CLC2, Point3d((L/2),(H/2),0) - ORIG()) -- angolo x+y- local CLC3 = EgtCopyGlob( CLC1, Lg) EgtRotate( CLC3, Point3d(0,0,0), Z_AX(), 180) EgtMove( CLC3, Point3d((L/2),-(H/2),0) - ORIG()) if cl == 1 then EgtErase(CLC1) end end if cl == 0 or cl >= 2 then -- angolo x-y- local CLC4 = EgtCopyGlob( CLC1, Lg) EgtRotate( CLC4, Point3d(0,0,0), Z_AX(), 90) EgtMove( CLC4, Point3d(-(L/2),-(H/2),0) - ORIG()) -- angolo x-y+ EgtMove( CLC1, Point3d(-(L/2),(H/2),0) - ORIG()) end end end end end else -- disattivo il join dei percorsi jn = false tRollerParam.jn = false end if bMakeMortGeom then tRollerParam.smr = 0 -- lancio il secondo componente base MHgen = require('_Mortise') nGeom2, nPkToJoin2 = MHgen.Draw( EC, EM, tRollerParam, bPreview, bRunByCompo, nDrawMach, Pz, Lg, dThickDoor) elseif mh then -- se devo fare il foro jn = false -- disattivo il join dei percorsi nGeom2 = EgtCircle( Lg, Point3d(0,0,0), H2/2 , GDB_RT.LOC) EgtModifyCurveThickness( nGeom2, -T2) EgtSetName( nGeom2, LGH) -- se mantiene altezza o centro spessore su mortise if kbs and kbs > 1 then local sKeepMode = 'c' -- setto di default per mantenere il centro dello spessore if ls then -- se latch strike sKeepMode = 'n' -- setto per mantenere per mantenere il lato narrow end EgtSetInfo( nGeom2, 'KeepBackSet', sKeepMode) end if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( nGeom2, 'ProbeSide', '1') end end -- se ci sono i percorsi antischegia (è ovvio che è strike) if EC == 0 and ( nAS1 or nAS2) then -- se mantiene altezza anche su face if kbs and kbs > 0 then local sKeepMode = 'n' -- setto per mantenere per mantenere il lato narrow if nAS1 then EgtSetInfo( nAS1, 'KeepBackSet', sKeepMode) end if nAS2 then EgtSetInfo( nAS2, 'KeepBackSet', sKeepMode) end end if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then if nAS1 then EgtSetInfo( nAS1, 'ProbeSide', '1') end if nAS2 then EgtSetInfo( nAS2, 'ProbeSide', '1') end end end if EC == 0 and ( nGeom2 or nPkToJoin2) then if ls then -- se latch strike muovo i percorsi della mortasa nella giusta posizione if H3 > 0 and L3 > 0 then if nGeom2 then EgtMove( nGeom2, Point3d(D_X,-( -D + H3 - (H/2)),0) - ORIG()) end if nPkToJoin2 then EgtMove( nPkToJoin2, Point3d(D_X,-( -D + H3 - (H/2)),0) - ORIG()) end else if nGeom2 then EgtMove( nGeom2, Point3d(D_X,-(D+(H2/2)),0) - ORIG()) end if nPkToJoin2 then EgtMove( nPkToJoin2, Point3d(D_X,-(D+(H2/2)),0) - ORIG()) end end else if nGeom2 then EgtMove( nGeom2, Point3d(D_X,0,0) - ORIG()) end if nPkToJoin2 then EgtMove( nPkToJoin2, Point3d(D_X,0,0) - ORIG()) end end end -- se percorsi fatti con lo stesso utensile, li concateno if jn and EC == 0 and nPkToJoin1 and nPkToJoin2 then -- recupero la nota delle variazioni dalla geometria del face local sVarNote = EgtGetInfo( nPkToJoin1, 'MVar') nPkToJoin = EgtCurveCompo( Lg, {nPkToJoin1,nPkToJoin2}, true) if nPkToJoin then EgtSetName( nPkToJoin, LM) EgtSetInfo( nPkToJoin, 'NotCheckDir', '1') if sVarNote then EgtSetInfo( nPkToJoin, 'MVar', sVarNote) end -- se mantiene altezza o centro spessore anche su face if kbs and kbs > 0 then local sKeepMode = 'c' -- setto di default per mantenere il centro dello spessore if ls then -- se latch strike sKeepMode = 'n' -- setto per mantenere per mantenere il lato narrow end EgtSetInfo( nPkToJoin, 'KeepBackSet', sKeepMode) EgtSetInfo( nGeom1, 'KeepBackSet', sKeepMode) EgtSetInfo( nGeom2, 'KeepBackSet', sKeepMode) end if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( nPkToJoin, 'ProbeSide', '1') EgtSetInfo( nGeom1, 'ProbeSide', '1') EgtSetInfo( nGeom2, 'ProbeSide', '1') end else EC = ErrorBase + 45 EM = string.format(EgtDoorsMsg[426], sCompoPath) end elseif not jn and EC == 0 then -- se mantiene altezza o centro spessore su face if kbs and kbs == 1 and nPkToJoin1 then local sKeepMode = 'c' -- setto di default per mantenere il centro dello spessore if ls then -- se latch strike sKeepMode = 'n' -- setto per mantenere per mantenere il lato narrow end EgtSetInfo( nPkToJoin1, 'KeepBackSet', sKeepMode) EgtSetInfo( nGeom1, 'KeepBackSet', sKeepMode) -- se mantiene altezza o centro spessore su face e mortise elseif kbs and kbs > 0 then local sKeepMode = 'c' -- setto di default per mantenere il centro dello spessore if ls then -- se latch strike sKeepMode = 'n' -- setto per mantenere per mantenere il lato narrow end if nPkToJoin1 then EgtSetInfo( nPkToJoin1, 'KeepBackSet', sKeepMode) EgtSetInfo( nGeom1, 'KeepBackSet', sKeepMode) end if nPkToJoin2 then EgtSetInfo( nPkToJoin2, 'KeepBackSet', sKeepMode) EgtSetInfo( nGeom2, 'KeepBackSet', sKeepMode) end end if pbs and pbs > 0 and nPkToJoin1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( nPkToJoin1, 'ProbeSide', '1') EgtSetInfo( nGeom1, 'ProbeSide', '1') elseif pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then if nPkToJoin1 then EgtSetInfo( nPkToJoin1, 'ProbeSide', '1') EgtSetInfo( nGeom1, 'ProbeSide', '1') end if nPkToJoin2 then EgtSetInfo( nPkToJoin2, 'ProbeSide', '1') EgtSetInfo( nGeom2, 'ProbeSide', '1') end end end -- aggiungo fori extra if EC == 0 and nDrawMach >= 0 then -- fori ( viti o passaggio filo elettrico) for k = 1, 4 do local D10 local IY10 local T10 local I10 local PX10 local PY10 local RP10 local EB10 local EBH10 local HB10 local AR10 local RCI10 if k == 1 then D10 = tExtraBore[k][1] T10 = tExtraBore[k][2] I10 = tExtraBore[k][3] PX10 = tExtraBore[k][4] PY10 = tExtraBore[k][5] EB10 = tExtraBore[k][6] HB10 = tExtraBore[k][7] else D10 = tExtraBore[k][1] IY10 = tExtraBore[k][2] T10 = tExtraBore[k][3] I10 = tExtraBore[k][4] PX10 = tExtraBore[k][5] PY10 = tExtraBore[k][6] RP10 = tExtraBore[k][7] EB10 = tExtraBore[k][8] EBH10 = tExtraBore[k][9] HB10 = tExtraBore[k][10] AR10 = tExtraBore[k][11] RCI10 = tExtraBore[k][12] end if dws and T10 and abs(T10) > ttp then T10 = ttp end if D10 and T10 and ( EB10 or EBH10) then if D10 > 0 and T10 ~= 0 and ( EB10 ~= '' or EBH10 ~= '') then if not IY10 then IY10 = 0 end if not I10 then I10 = 0 end if not PX10 then PX10 = 0 end if not PY10 then PY10 = 0 end if not AR10 then AR10 = 0 end local dInt10 = (I10/2) local dPosX10 = -PX10 * EgtIf( sopp, -1, 1) local dPosY10 if ls and not( L3 and L3 > 0) then dPosY10 = -PY10 else -- non è latch face -- PY10 è preso positivo perchè all'aumentare del valore deve distanziarsi dal wide side (riferimento in caso non si alatch) dPosY10 = PY10 * fopp end if ls and L3 and L3 > 0 then dPosY10 = dPosY10 - H3 + (H/2) end if abs(AR10) >= 360 then while abs(AR10) >= 360 do AR10 = AR10 + EgtIf( AR10 > 0, -360, 360) end end -- se ho il suffisso per lavorazione su lato lock if LK and #LK > 0 then EB10 = EB10 .. LK EBH10 = EBH10 .. LK end -- creo foro o asola con eventuale svuotatura a rampa MakeBoreOrButtoHole( Lg, bPreview, Dm, nDrawMach, IY10, EBH10, EB10, dPosX10, dInt10, D10, 0, dPosY10, T10, RP10, AR10, RCI10, kbs, HB10, ls, dws, pbs) -- se l'interasse è valido if abs(I10) > GEO.EPS_SMALL then -- creo foro o asola con eventuale svuotatura a rampa MakeBoreOrButtoHole( Lg, bPreview, Dm, nDrawMach, IY10, EBH10, EB10, dPosX10, -dInt10, D10, 0, dPosY10, T10, RP10, AR10, RCI10, kbs, HB10, ls, dws, pbs) end end end end -- aggiungo foro probe if nDrawMach > 0 and posh and L then local dPosProbe = 0 local sPositiveSuffixProbe = '' local sNegativeSuffixProbe = '' if posp and posp > 0 then dPosProbe = (L/2) + posp if DGD.Push then sPositiveSuffixProbe = '_NEG' sNegativeSuffixProbe = '_POS' else sPositiveSuffixProbe = '_POS' sNegativeSuffixProbe = '_NEG' end end local pCentr = Point3d( dPosProbe, posh, 0) local hintPr = EgtArc( Lg, pCentr, 1, 0, -360, 0, GDB_RT.LOC) -- verifico se devo forzare direzione orizzontale o seguire il profilo local sSideDoorInfo if DGC.Fpd then sSideDoorInfo = 'LockLH' else sSideDoorInfo = EgtIf( dl, 'LockLH', 'SideLH') end if hintPr then EgtModifyCurveThickness( hintPr, -10) EgtSetName( hintPr, LH..sPositiveSuffixProbe) EgtSetInfo( hintPr, 'SideDoor', sSideDoorInfo) end if dPosProbe > 0 then pCentr = Point3d( -dPosProbe, posh, 0) hintPr = EgtArc( Lg, pCentr, 1, 0, -360, 0, GDB_RT.LOC) if hintPr then EgtModifyCurveThickness( hintPr, -10) EgtSetName( hintPr, LH..sNegativeSuffixProbe) EgtSetInfo( hintPr, 'SideDoor', sSideDoorInfo) end end end end if EC == 0 and nDrawMach > 0 then -- se abilitata geometria lavorazione if not dws then -- se frame viene disposto sul lato narrow o è sulla porta(disposto sul lato stretto) -- se la sezione strike supera 1/6 dello spessore porta (se è un frame drf vale 0.1 e crea sempre regione) -- disegno sezione ribasso su faccia superiore/inferiore porta if fhb > drf then -- setto griglia dietro per l'ingombro sicuramente esistente EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.BACK)) local nIdSideBoxUp if L3 > 0 then nIdSideBoxUp = EgtRectangle2P( Lg, Point3d(((L/2)-D_SK)*invK,0,0), Point3d(((L/2)-D_SK-L3)*invK,fhb,0), GDB_RT.LOC) else nIdSideBoxUp = EgtRectangle2P( Lg, Point3d((L/2),0,0), Point3d(-(L/2),fhb,0), GDB_RT.LOC) end if nIdSideBoxUp then if bEqualTh then EgtModifyCurveThickness(nIdSideBoxUp, -dThickDoor) else if L3 > 0 then EgtModifyCurveThickness(nIdSideBoxUp, -H3) else EgtModifyCurveThickness(nIdSideBoxUp, -H) end end EgtSetName( nIdSideBoxUp, 'upper') EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper') end EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) end --debug -- EgtSaveFile() -- EgtMove(DGD.PZ, Point3d(0,0,nil) - ORIG()) else -- altrimenti viene lavorato disposto sul lato wide local nIdSideBoxUp if nGeom1 then nIdSideBoxUp = EgtCopyGlob( nGeom1, Lg) EgtSetName( nIdSideBoxUp, 'upper') EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper') end if nGeom2 then nIdSideBoxUp = EgtCopyGlob( nGeom2, Lg) EgtSetName( nIdSideBoxUp, 'upper') EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper') end end end if D_XT and D_XT ~= 0 then EgtMove( Lg, Point3d(D_XT,0,0) - ORIG()) elseif not D_XT then D_XT = 0 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 del roller latch EgtSetInfo( Lg, 'Type' ,'RollerLatch') EgtSetInfo( Lg, 'L' ,L) EgtSetInfo( Lg, 'H' ,H) EgtSetInfo( Lg, 'T' ,T) EgtSetInfo( Lg, 'd' ,d) EgtSetInfo( Lg, 'p' ,p) EgtSetInfo( Lg, 'sf' ,sf) EgtSetInfo( Lg, 'cl' ,cl) EgtSetInfo( Lg, 'rf' ,rf) EgtSetInfo( Lg, 'clc' ,clc) EgtSetInfo( Lg, 'ccr' ,ccr) EgtSetInfo( Lg, 'clc5' ,clc5) EgtSetInfo( Lg, 'd2' ,d2) EgtSetInfo( Lg, 'mh' ,mh) EgtSetInfo( Lg, 'L2' ,L2) EgtSetInfo( Lg, 'H2' ,H2) EgtSetInfo( Lg, 'T2' ,T2) EgtSetInfo( Lg, 'd3' ,d3) EgtSetInfo( Lg, 'p3' ,p3) EgtSetInfo( Lg, 's' ,s) EgtSetInfo( Lg, 'invG' ,invG) EgtSetInfo( Lg, 'invK' ,invK) EgtSetInfo( Lg, 'posh' ,posh) EgtSetInfo( Lg, 'posp' ,posp) EgtSetInfo( Lg, 'ech' ,ech) EgtSetInfo( Lg, 'est' ,est) EgtSetInfo( Lg, 'kbs' ,kbs) EgtSetInfo( Lg, 'pbs' ,pbs) EgtSetInfo( Lg, 'dl' ,dl) EgtSetInfo( Lg, 'bEqualTh' ,bEqualTh) EgtSetInfo( Lg, 'fht' ,fht) EgtSetInfo( Lg, 'fhb' ,fhb) EgtSetInfo( Lg, 'sopp' ,sopp) EgtSetInfo( Lg, 'fopp' ,fopp) EgtSetInfo( Lg, 'drf' ,drf) EgtSetInfo( Lg, 'dws' ,dws) EgtSetInfo( Lg, 'dthd' ,dthd) EgtSetInfo( Lg, 'ttp' ,ttp) EgtSetInfo( Lg, 'LG' ,LG) EgtSetInfo( Lg, 'LM' ,LM) EgtSetInfo( Lg, 'LA' ,LA) EgtSetInfo( Lg, 'LGM' ,LGM) EgtSetInfo( Lg, 'LMM' ,LMM) EgtSetInfo( Lg, 'LGH' ,LGH) EgtSetInfo( Lg, 'CH' ,CH) EgtSetInfo( Lg, 'LK' ,LK) EgtSetInfo( Lg, 'CLC' ,CLC) EgtSetInfo( Lg, 'CLC5' ,CLC5) EgtSetInfo( Lg, 'DeltaPos' ,(-(2*D_XT))) EgtSetInfo( Lg, 'Path' ,sCompoPath) if ls then -- se latch strike EgtSetInfo( Lg, 'AppPoint', 'Wide') -- setto una nota per indicare quale punto di riferimento prendere EgtSetInfo( Lg, 'InserPoint', 'Edge') -- setto una nota per indicare quale punto di riferimento prendere else EgtSetInfo( Lg, 'AppPoint', 'Wide') -- setto una nota per indicare quale punto di riferimento prendere EgtSetInfo( Lg, 'InserPoint', 'Center') -- setto una nota per indicare quale punto di riferimento prendere end -- 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 RollerLatch