-- -- 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 -- -- LockMortiseCyl.lua by EgalWare s.r.l. 2016.06.14 -- Autore: Filippo Monchi -- serratura tipo mortise o cilindrica -- 2016.09.21 FM aggiunta messaggi di wanrning -- 2017.06.16 V1.011 FM Disable check if screw interax < handle bore diam -- 2017.06.16 V1.011 FM Is possible insert only screws bores without handle bore ( on keyway and secure side) -- 2017.06.16 V1.011 FM Check if bore thickness > door thickness and modify if their thickness > door thickness -- 2017.08.17 V1.012 FM Add Mounting screw, 10 more Extra bore on keyway side and 10 more Extra bore on secure side, -- Add flag for not rotate Face on bevel profile -- 2017.12.12 V1.013 FM Add parameter for rotate horizontal bore and manage a pre Bore before long dril -- 2018.02.27 V1.014 FM Add vertical rectangle (5 on secure side and 5 on keyway side) -- 2018.02.27 V1.014 FM Add vertical line (5 on secure side and 5 on keyway side) -- 2018.02.28 V1.015 FM Manage new mode to allow mortise and 2 horizontah hole together and manage also old mode (only mortise or side holes) -- 2018.03.01 V1.016 FM Fix bugs on new mode horizontal bores -- 2018.04.06 V1.017 FM Manage info (KeepBackSet) for adjust probe on Z -- 2018.10.17 V1.018 FM Add parameter to show into message 402 -- 2018.10.22 V1.019 FM Manage better the big radius fillet parameter -- 2018.10.22 V1.019 FM Add new parameter D_XE to move all geometries -- 2018.10.22 V1.019 FM Manage new parameter reference (backset or door side) for keyway and secure extra geometries -- 2018.11.21 V1.01a FM Manage inclinated slide machining on first keyway/secure custom bore -- 2018.11.26 V1.01b FM Manage disposition also on top and bottom side -- 2018.12.20 V1.01c FM Extend previous feature to different disposition/reference side assigned to paremeter DGD.SIDE: -- top, lock_top, lock_bottom, bottom -- 2019.01.14 V1.01d FM Fix error on assign wrong Mtable column if check .dl is set to force horizontal the face geometries on bevel edge -- 2019.03.25 V1.01e FM Add 2nd horizontal bore and its pilot bore -- 2019.05.22 V1.01f FM Manage anti-splint path on strike extra rectangle geometry -- 2019.09.30 V1.020 FM Manage anti-splint path on anti-splint path -- 2019.10.10 V1.021 FM Manage steel option (disable to generate pocket paths, mortise) -- 2019.10.18 V2.000 FM Manage use Materials -- 2019.10.28 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.25 V2.005 FM Manage geometries for calculate region when frame(jamb) is disposed on wide side -- 2020.06.24 V2.006 FM Add new line of mounting screw bores -- 2020.07.01 V2.007 FM Disable Warning message on frames if parameter DGD.Spd is <= 0 -- 2020.10.28 V2.008 FM Add 3 mounting screw bore groups -- 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 Check and adjust the angle parameter on ebtra rectangle and extra lines -- 2021.03.24 V3.002 FM Fix error on check GD.SIDE with value lock_top -- 2021.11.08 V3.003 FM Fix error on not disable jn parameter when face is not present -- 2021.11.24 V3.004 FM Manage side probe option if variable DGC.Pms > 2 -- 2022.07.20 V3.005 FM Use parameter .ITP (Internal Path) from template lua file instead of function EgtGetSourceDir(1) -- 2022.07.27 V3.006 FM Modification to use compiled code -- 2024.02.02 V3.007 FM Manage new geometry name suffix _HD, enabled by SideDoorDefined CurrCamInfo parameter, to applied on side geometry -- when the lock is applied on side differeent than lock side -- 2024.02.16 V3.008 FM Manage new parameter TPGxx on Extra Rect geometries to trim protruding geometry and leave open path ( for contouring machining), -- or trim the protruding geometry and close the path with line (defined as OPEN) for pocketing machining ( into MakeAspOnStrikeRect function) -- 2024.05.09 V3.009 FM Fix error on check parameter DGD.SIDE on setting suffix _HD (by DGD.SDF/SideDoorDefined parameter) -- 2024.07.19 V3.00a FM Set note 'NotCheckDir' to pocketing and antisplint paths -- 2024.10.02 V3.00b FM Manage probe geometry and their offset position when template is disposed on lock side -- 2024.10.29 V3.00c FM Manage new DGC.Fpd CurrDoorCustomData variable to force shuttle probe geometry to stay horizontal -- Tavola per definizione modulo (serve ma non usata) local LockMortiseCyl = {} -- 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 dExtraH = 0.25 local function DrawAddLineDrawCircle( pInitial, pFinal, nGroup, idTable, bPrev, nGroupCirc, nRad, bDrawFirst, bDrawLast, cColor1, cColor2, sMVar, sReference) local nReference = GDB_RT.LOC if sReference and sReference == 'grid' then nReference = GDB_RT.GRID end local nLine = EgtLine(nGroup, pInitial, pFinal, nReference) 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 , nReference) EgtSetColor( nCircle1, cColor1) end if bDrawLast then local nCircle2 = EgtCircle( nGroupCirc, pFinal, nRad , nReference) EgtSetColor( nCircle2, cColor2) end end return nLine, nNumLine, sMVar end local function MakeRectWithFillet( Lg, P1, P2, Rf, Ang, bBigLength, est) local hint_3 = EgtRectangle2P( Lg, P1, P2, GDB_RT.LOC) if hint_3 then local nNewId, nNumEnt = EgtExplodeCurveCompo( hint_3) if nNewId and nNumEnt and nNumEnt > 0 then local pStartIni -- se devo inserire i raccordi if Rf > 0 then local tIdFil = {} local nLine for p = 1, (nNumEnt-1) do nLine = EgtCurveFillet( Lg, ( nNewId + p - 1), EgtEP( nNewId + p - 1), ( nNewId + p), EgtSP( nNewId + p), Rf, true) table.insert( tIdFil, nLine) end nLine = EgtCurveFillet( Lg, ( nNewId + nNumEnt - 1), EgtEP( nNewId + nNumEnt - 1), nNewId, EgtSP(nNewId), Rf, true) table.insert( tIdFil, nLine) if est then -- se materiale steel inizio sul lato più corto if bBigLength then -- se lunghezza maggiore (in X) di altezza (in Y) pStartIni = EgtMP( nNewId+1) else -- lunghezza (in X) minore o uguale a altezza (in Y) pStartIni = EgtMP( nNewId) end else -- altrimenti come fatto prima (sulla prima entità) pStartIni = EgtMP( nNewId) end -- creo curvecompo hint_3 = EgtCurveCompo( Lg, { nNewId, tIdFil[1], (nNewId+1), tIdFil[2], (nNewId+2), tIdFil[3], (nNewId+3), tIdFil[4]}, true) else if est then -- se materiale steel inizio sul lato più corto if bBigLength then -- se lunghezza maggiore (in X) di altezza (in Y) pStartIni = EgtMP( nNewId+1) else -- lunghezza (in X) minore o uguale a altezza (in Y) pStartIni = EgtMP( nNewId) end else -- altrimenti come fatto prima (sulla prima entità) pStartIni = EgtMP( nNewId) end -- creo curvecompo hint_3 = EgtCurveCompo( Lg, { nNewId, (nNewId+1), (nNewId+2), (nNewId+3)}, true) end if hint_3 then EgtChangeClosedCurveStartPoint( hint_3, pStartIni, GDB_RT.LOC) -- cambio punto di inizio if Ang ~= 0 then EgtRotate( hint_3, EgtGP( hint_3), Z_AX(), Ang, GDB_RT.LOC) -- ruoto end end end end return hint_3 end local function MakeSlidePath( Lg, dX, dY, dDiam, dPlaneAng, dTiltAng, dStep) if dTiltAng == 0 or dTiltAng == 90 then return end local tPath = {} local dCompAng = 90 - dTiltAng -- angolo complementare -- calcolo l'ampiezza della cava local dLung = dDiam / sin(dCompAng) local dMaxDepth = (dDiam / cos(dCompAng)) - ( dDiam * tan(dCompAng)) local nStep = ceil(dMaxDepth/dStep) -- ricalcolo i passi in modo che siano dispari nStep = EgtIf( fmod(nStep,2) > 0, nStep, nStep + 1) local dStep = dMaxDepth/nStep local nInv = 1 local pIni, pEnd pIni = Point3d( 0, 0, 0) for g = 1, nStep do -- determino l'ingresso if nInv > 0 then -- se positivo ingresso perpendicolare pEnd = Point3d( pIni:getX(), 0, -(dStep*g)) else pEnd = Point3d( pIni:getX()-(dStep/tan(dCompAng)), 0, -(dStep*g)) end DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, false, nil, (dDiam/2), false, true, ORANGE(), ORANGE()) pIni = pEnd -- determino la passata local dLength = 1 if nInv > 0 then -- se positivo dLength = ( dLung - dDiam - ((dStep*g)/tan(dCompAng))) pEnd = Point3d( (pIni:getX() + dLength), 0, pIni:getZ()) else pEnd = Point3d( 0, 0, pIni:getZ()) end if dLength > 0 then DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, false, nil, (dDiam/2), false, true, ORANGE(), ORANGE()) end pIni = pEnd -- inverto il senso di lavorazione nInv = -nInv end -- uscita inclinata pEnd = Point3d( pIni:getX()+(((dStep*nStep)+0.5)/tan(dCompAng)), 0, 0.5) DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, false, nil, (dDiam/2), false, true, ORANGE(), ORANGE()) pIni = pEnd local hint_3 -- se il percorso esiste if tPath then hint_3 = EgtCurveCompo( Lg, tPath, true) if hint_3 then -- se il percorso esiste lo ruoto e lo posiziono if dPlaneAng ~= 0 then -- se l'angolo non è nullo lo ruoto EgtRotate( hint_3, Point3d(0,0,0), Z_AX(), dPlaneAng, GDB_RT.LOC) -- ruoto end EgtMove( hint_3, Point3d(dX,dY,0) - ORIG()) end end return hint_3 end local function MakeAspOnStrikeRect( Lg, nHint, dX, dY, dThick, dDoorTh, dShiftX, dShiftY, bRefSide, dBack_set, dDiam, bOpposite, dZedPos, dDiam2, sSideLock, Fc, Tpg) local nLine local ptIni, ptEnd, pInt1, pInt1, ptIni2, ptEnd2 local tPath = {} local nPath1, nPath2, nPath3, nPath4 local nInv = 1 local dLocDiam = dDiam if not dBack_set then dBack_set = 0 end -- se ho il lato aperto ma non ho selezionato l'amtisplint setto un valore minimo al diametro if ( Tpg and Tpg > 0) and not dLocDiam then dLocDiam = 1 end -- creo la linea ptIni = Point3d( (dShiftX - max(dX, dY)), EgtIf( bRefSide, 0, -dBack_set), 0) ptEnd = Point3d( (dShiftX + max(dX, dY)), EgtIf( bRefSide, 0, -dBack_set), 0) nLine = DrawAddLineDrawCircle( ptIni, ptEnd, Lg, nil, false, nil, (dLocDiam/2), true, true, ORANGE(), ORANGE()) if nLine then -- verifico se ci sono intersezioni pInt1 = EgtIP( nLine, nHint, ptIni) pInt2 = EgtIP( nLine, nHint, ptEnd) -- se ci sono entrambe i punti e la loro distanza è maggiore del diametro fresa if pInt1 and pInt2 then local dDist = dist( pInt1, pInt2) if dDiam and dDist>= dDiam then -- se larghezza maggiore dell'utensile -- imposto la griglia if bOpposite then EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.BACK)) nInv = -1 else EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.FRONT)) end ptIni = Point3d( (pInt1:getX() + (dDiam/2) - dExtraH)*nInv, dDiam*3/4, -pInt1:getY()) if dDiam2 then ptIni2 = Point3d( (pInt1:getX() + (dDiam2/2) - dExtraH)*nInv, dDiam2*3/4, -pInt1:getY()) end if dDoorTh - dThick > GEO.EPS_SMALL then -- se spessore non passante -- creo percorso con 3 linee ptEnd = Point3d( ptIni:getX(), -dThick + (dDiam/2) - dExtraH, ptIni:getZ()) DrawAddLineDrawCircle( ptIni, ptEnd, Lg, tPath, false, nil, (dDiam/2), true, true, ORANGE(), ORANGE(), nil, 'grid') ptIni = ptEnd ptEnd = Point3d( (pInt2:getX() - (dDiam/2) + dExtraH)*nInv, ptIni:getY(), -pInt2:getY()) DrawAddLineDrawCircle( ptIni, ptEnd, Lg, tPath, false, nil, (dDiam/2), true, true, ORANGE(), ORANGE(), nil, 'grid') ptIni = ptEnd ptEnd = Point3d( ptIni:getX(), dDiam*3/4, ptIni:getZ()) DrawAddLineDrawCircle( ptIni, ptEnd, Lg, tPath, false, nil, (dDiam/2), true, true, ORANGE(), ORANGE(), nil, 'grid') -- se il percorso esiste if tPath then nPath2 = EgtCurveCompo( Lg, tPath, true) end if dDiam2 then -- creo il secondo percorso con 3 linee tPath = {} ptEnd2 = Point3d( ptIni2:getX(), -dThick + (dDiam2/2) - dExtraH, ptIni2:getZ()) DrawAddLineDrawCircle( ptIni2, ptEnd2, Lg, tPath, false, nil, (dDiam2/2), true, true, ORANGE(), ORANGE(), nil, 'grid') ptIni2 = ptEnd2 ptEnd2 = Point3d( (pInt2:getX() - (dDiam2/2) + dExtraH)*nInv, ptIni2:getY(), -pInt2:getY()) DrawAddLineDrawCircle( ptIni2, ptEnd2, Lg, tPath, false, nil, (dDiam2/2), true, true, ORANGE(), ORANGE(), nil, 'grid') ptIni2 = ptEnd2 ptEnd2 = Point3d( ptIni2:getX(), dDiam2*3/4, ptIni2:getZ()) DrawAddLineDrawCircle( ptIni2, ptEnd2, Lg, tPath, false, nil, (dDiam2/2), true, true, ORANGE(), ORANGE(), nil, 'grid') -- se il percorso esiste if tPath then nPath4 = EgtCurveCompo( Lg, tPath, true) end end else -- se spessore passante if (dDist - dDiam) < 2*dDiam then -- se larghezza minore del doppio diametro utensile -- creo percorso con 3 linee ptEnd = Point3d( ptIni:getX(), -dThick - (dDiam*3/4), ptIni:getZ()) DrawAddLineDrawCircle( ptIni, ptEnd, Lg, tPath, false, nil, (dDiam/2), true, true, ORANGE(), ORANGE(), nil, 'grid') ptIni = ptEnd ptEnd = Point3d( (pInt2:getX() - (dDiam/2) + dExtraH)*nInv, ptIni:getY(), -pInt2:getY()) DrawAddLineDrawCircle( ptIni, ptEnd, Lg, tPath, false, nil, (dDiam/2), true, true, ORANGE(), ORANGE(), nil, 'grid') ptIni = ptEnd ptEnd = Point3d( ptIni:getX(), dDiam*3/4, ptIni:getZ()) DrawAddLineDrawCircle( ptIni, ptEnd, Lg, tPath, false, nil, (dDiam/2), true, true, ORANGE(), ORANGE(), nil, 'grid') -- se il percorso esiste if tPath then nPath2 = EgtCurveCompo( Lg, tPath, true) end if dDiam2 then -- creo il secondo percorso con 3 linee tPath = {} ptEnd2 = Point3d( ptIni2:getX(), -dThick - (dDiam2*3/4), ptIni2:getZ()) DrawAddLineDrawCircle( ptIni2, ptEnd2, Lg, tPath, false, nil, (dDiam2/2), true, true, ORANGE(), ORANGE(), nil, 'grid') ptIni2 = ptEnd2 ptEnd2 = Point3d( (pInt2:getX() - (dDiam2/2) + dExtraH)*nInv, ptIni2:getY(), -pInt2:getY()) DrawAddLineDrawCircle( ptIni2, ptEnd2, Lg, tPath, false, nil, (dDiam2/2), true, true, ORANGE(), ORANGE(), nil, 'grid') ptIni2 = ptEnd2 ptEnd2 = Point3d( ptIni2:getX(), dDiam2*3/4, ptIni2:getZ()) DrawAddLineDrawCircle( ptIni2, ptEnd2, Lg, tPath, false, nil, (dDiam2/2), true, true, ORANGE(), ORANGE(), nil, 'grid') -- se il percorso esiste if tPath then nPath4 = EgtCurveCompo( Lg, tPath, true) end end else -- larghezza maggiore del doppio diametro, creao due linee distinte -- creo 2 persorsi composti da una linea ciascuno ptEnd = Point3d( ptIni:getX(), -dThick - (dDiam*3/4), ptIni:getZ()) nPath1 = DrawAddLineDrawCircle( ptIni, ptEnd, Lg, nil, false, nil, (dDiam/2), true, true, ORANGE(), ORANGE(), nil, 'grid') ptIni = Point3d( (pInt2:getX() - (dDiam/2) + dExtraH)*nInv, ptEnd:getY(), -pInt2:getY()) ptEnd = Point3d( ptIni:getX(), (dDiam*3/4), ptIni:getZ()) nPath2 = DrawAddLineDrawCircle( ptIni, ptEnd, Lg, nil, false, nil, (dDiam/2), true, true, ORANGE(), ORANGE(), nil, 'grid') if dDiam2 then -- creo 2 persorsi composti da una linea ciascuno ptEnd2 = Point3d( ptIni2:getX(), -dThick - (dDiam2*3/4), ptIni2:getZ()) nPath3 = DrawAddLineDrawCircle( ptIni2, ptEnd2, Lg, nil, false, nil, (dDiam2/2), true, true, ORANGE(), ORANGE(), nil, 'grid') ptIni2 = Point3d( (pInt2:getX() - (dDiam2/2) + dExtraH)*nInv, ptEnd2:getY(), -pInt2:getY()) ptEnd2 = Point3d( ptIni2:getX(), (dDiam2*3/4), ptIni2:getZ()) nPath4 = DrawAddLineDrawCircle( ptIni2, ptEnd2, Lg, nil, false, nil, (dDiam2/2), true, true, ORANGE(), ORANGE(), nil, 'grid') end end end end if dDist>= dLocDiam then -- se larghezza maggiore dell'utensile -- se c'è il flag per tagliare la geometria che sborda dalla porta if Tpg and Tpg > 0 then -- verifico se posso tagliare il percorso con i punti di intersezione -- setto il punto di partenza if bOpposite then -- setto il pnto di partenza vicino al punto finale if EgtChangeClosedCurveStartPoint( nHint, pInt1) then local SecondPath = EgtSplitCurveAtPoint( nHint, pInt2) if SecondPath then EgtErase( SecondPath) end -- se opzione di svuotatura chiudo il percorso iniziale con una linea e segno l'entità nelle note open del percorso if Tpg == 1 then EgtCloseCurveCompo( nHint) local nNumEnt1, nNumEnt2 = EgtCurveDomain( nHint) if nNumEnt2 > 1 then EgtSetInfo( nHint, 'OPEN', nNumEnt2-1) end end end else -- setto il pnto di partenza vicino al punto iniziale if EgtChangeClosedCurveStartPoint( nHint, pInt2) then local SecondPath = EgtSplitCurveAtPoint( nHint, pInt1) if SecondPath then EgtErase( SecondPath) end -- se opzione di svuotatura chiudo il percorso iniziale con una linea e segno l'entità nelle note open del percorso if Tpg == 1 then EgtCloseCurveCompo( nHint) local nNumEnt1, nNumEnt2 = EgtCurveDomain( nHint) if nNumEnt2 > 1 then EgtSetInfo( nHint, 'OPEN', nNumEnt2-1) end end end end end end -- se esistono gli eventuali percorso setto spessore 0 if nPath1 then EgtModifyCurveThickness(nPath1, 0) if sSideLock == 'L' then -- inverto il percorso EgtInvertCurve(nPath1) end if string.lower(Fc) == 'keyway' then -- inverto il percorso EgtInvertCurve(nPath1) end end if nPath2 then EgtModifyCurveThickness(nPath2, 0) if sSideLock == 'L' then -- inverto il percorso EgtInvertCurve(nPath2) end if string.lower(Fc) == 'keyway' then -- inverto il percorso EgtInvertCurve(nPath2) end end if nPath3 then EgtModifyCurveThickness(nPath3, 0) if sSideLock == 'R' then -- inverto il percorso EgtInvertCurve(nPath3) end if string.lower(Fc) == 'keyway' then -- inverto il percorso EgtInvertCurve(nPath3) end end if nPath4 then EgtModifyCurveThickness(nPath4, 0) if sSideLock == 'R' then -- inverto il percorso EgtInvertCurve(nPath4) end if string.lower(Fc) == 'keyway' then -- inverto il percorso EgtInvertCurve(nPath4) end end -- re-imposto la griglia da sopra EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP)) end -- elimino la linea EgtErase(nLine) end return nPath1, nPath2, nPath3, nPath4 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 LockMortiseCyl.AdjustParams( tMhPar) tMhPar.invG = 1 local EgtDoorsMsg = require( 'EgtDoorsMsg') local dMaxMat0 -- per face chisel o materiale diverso da wood local dMaxMat1 -- per face machining local dMaxMat2 -- per mortise machining o foro profondo local dMaxMat3 -- per 2nd foro profondo local dMaxMat4 -- per mounting screw local dMaxMat10 -- per mounting screw local dMaxMat11 -- per mounting screw local dMaxMat12 -- per mounting screw local dMaxMat13 -- per mounting screw local dMaxMat5 -- per preforo local dMaxMat7 -- per 2nd preforo local dMaxMat8 -- per antisplint su extra-rettangolo local dMaxMat9 -- per antisplint su antisplint local dNumMessage local dNumLog = 0 local sMessToOut = '' local nTempT0 local nTempT1 local nTempT2 local nTempT3 local nTempT4 local nTempT5 local nTempT6 local nTempT7 local nTempT8 local nTempT9 local nTempT10 local nTempT11 local nTempT12 local nTempT13 local sMchngName0 local sMchngName1 local sMchngName2 local sMchngName3 local sMchngName4 local sMchngName5 local sMchngName6 local sMchngName7 local sMchngName8 local sMchngName9 local sMchngName10 local sMchngName11 local sMchngName12 local sMchngName13 local dOffset = DGD.OFFSET or 0 -- 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 DGD.nTypePz == 3 or DGD.nTypePz == 4 then tMhPar.dThD = DGD.dW tMhPar.TTP = DGD.dW -- setto come valore iniziale, poi se è abilitata le generazione si setta con il giusto valore elseif DGD.nTypePz == 5 or DGD.nTypePz == 6 then tMhPar.dThD = DGD.dH tMhPar.TTP = DGD.dH -- setto come valore iniziale, poi se è abilitata le generazione si setta con il giusto valore elseif DGD.nTypePz <= 2 then tMhPar.dThD = DGD.dT tMhPar.TTP = DGD.dT end tMhPar.TyP = DGD.nTypePz -- do errore se il tipo di giunzione flushbolt non è adatto per il tipo di porta ( inactive) if tMhPar.Type and string.lower(tMhPar.Type) == 'flushbolt' and not( DGD.sSwing == 'LHI' or DGD.sSwing == 'RHI' or DGD.sSwing == 'RHRI' or DGD.sSwing == 'LHRI') then return tMhPar, 1798, string.format(EgtDoorsMsg[458], tMhPar.Type, DGD.sSwing) end -- do errore se profilo lock è tipo bullnose e/o convesso e non è ammesso if not DGC.Eah and ( DGD.tProfs.lockedge.trimming == 'CV' or 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') and ( not DGD.SIDE or DGD.SIDE == 'lock_top' or DGD.SIDE == 'lock_bottom') then return tMhPar, 1799, string.format(EgtDoorsMsg[430], tMhPar.Nome, DGD.tProfs.lockedge.trimming) end -- se profilo bevel disabilito la giunzione tra face e mortise 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 ( not DGD.SIDE or DGD.SIDE == 'lock_top' or DGD.SIDE == 'lock_bottom') then tMhPar.jnb = false -- setto il flag che indica profilo bevel tMhPar.bev = true else tMhPar.jnb = true end -- se serratura su lato destro setto il flag per invertire i percorsi if DGD.Lock == 'R' then tMhPar.invG = -tMhPar.invG end tMhPar.SL = DGD.Lock if tMhPar.dl and tMhPar.H and tMhPar.T and tMhPar.T > 0 and not tMhPar.jnb then -- se non ruoto face risetto il flag che impedisce il chain tra face e mortise tMhPar.jnb = true -- ricalcolo la profondità per avere spessore minimo = al valore di .T tMhPar.T = tMhPar.T + EgtIf( DGC.Bwd and DGC.Bwd == 2, 0, (( tMhPar.H/2) * TAN3)) else tMhPar.dl = false end --se non è presente il face ed è attivo il join lo disabilito if ( not tMhPar.L or not tMhPar.H or not tMhPar.LM) and tMhPar.jn then tMhPar.jn = false -- disattivo il join tra face e mortasa end -- se non ho il parametro di abilitazione chisel 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 -- se c'è la variabile CurrCamInfo che indica che la porta è disposta con il lato lock sul lato navetta -- e il template è applicato sul lato top o bottom, attivo il suffisso per tutte le geometrie sul lato tMhPar.HD = '' if DGD.SDF and DGD.SDF > 1 and ( DGD.SIDE == 'top' or DGD.SIDE == 'bottom') then tMhPar.HD = '_HD' -- se c'è la variabile CurrCamInfo che indica che la porta è disposta con il lato lock sul lato navetta -- e il template non è sui lati top e bottom elseif DGD.SDF and DGD.SDF > 1 then -- calcolo la posizione del centro foro sullo spessore porta if dOffset > 0 then if DGD.Push then tMhPar.posh = (DGD.dT/2) - dOffset else tMhPar.posh = -(DGD.dT/2) + dOffset end else tMhPar.posh = 0 end if tMhPar.bev and not tMhPar.dl and not DGC.Fpd then tMhPar.posh = tMhPar.posh / cos( 3) end end -- se non ho il parametro di arrotondamento lati lo setto disabilitato if not tMhPar.cl then tMhPar.cl = 0 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 if not tMhPar.rf then tMhPar.rf = 0 if tMhPar.cl > 0 and tMhPar.H then tMhPar.rf = tMhPar.H/2 end end -- se non c'è il parametro angolo foro lo setto a 0 if not tMhPar.AB then tMhPar.AB = 0 elseif abs(tMhPar.AB) >= 80 then tMhPar.AB = 0 end -- se non c'è il parametro angolo foro lo setto a 0 if not tMhPar.AB2 then tMhPar.AB2 = 0 elseif abs(tMhPar.AB2) >= 80 then tMhPar.AB2 = 0 end -- se non c'è il parametro di profondità preforo lo setto a -1 if not tMhPar.FBP then tMhPar.FBP = -1 end -- se non c'è il parametro di profondità preforo lo setto a -1 if not tMhPar.FBP2 then tMhPar.FBP2 = -1 end -- se non c'è il parametro di diametro preforo lo setto a 0 if not tMhPar.FBD then tMhPar.FBD = 0 end -- se non c'è il parametro di diametro preforo lo setto a 0 if not tMhPar.FBD2 then tMhPar.FBD2 = 0 end if tMhPar.FBP >= 0 then -- se ha un valore lo ricalcolo perché il valore indica la profondità minima -- se ho il diametro e l'angolo è maggiore di zero if tMhPar.FBD > 0 and abs(tMhPar.AB) >= 0 then tMhPar.FBP = tMhPar.FBP + ( ( tMhPar.FBD / tan( 90 - abs(tMhPar.AB))) / 2) if tMhPar.FBP < GEO.EPS_SMALL then -- se la profondità calcolata è zero lo annullo tMhPar.FBD = 0 tMhPar.FBP = -1 end -- se il diametro è valido e di conseguenza l'angolo è a zero, annullo in diametro per non fare il foro. elseif tMhPar.FBD > 0 then tMhPar.FBD = 0 tMhPar.FBP = -1 end end if tMhPar.FBP2 >= 0 then -- se ha un valore lo ricalcolo perché il valore indica la profondità minima -- se ho il diametro e l'angolo è maggiore di zero if tMhPar.FBD2 > 0 and abs(tMhPar.AB2) >= 0 then tMhPar.FBP2 = tMhPar.FBP2 + ( ( tMhPar.FBD2 / tan( 90 - abs(tMhPar.AB2))) / 2) if tMhPar.FBP2 < GEO.EPS_SMALL then -- se la profondità calcolata è zero lo annullo tMhPar.FBD2 = 0 tMhPar.FBP2 = -1 end -- se il diametro è valido e di conseguenza l'angolo è a zero, annullo in diametro per non fare il foro. elseif tMhPar.FBD2 > 0 then tMhPar.FBD2 = 0 tMhPar.FBP2 = -1 end end -- se c'è il parametro delta Y delle mounting screw e la porta è a tirare, inverto il valore dell'offset if tMhPar.PY9 then if not DGD.Push then tMhPar.PY9 = - tMhPar.PY9 end end if tMhPar.PY41 then if not DGD.Push then tMhPar.PY41 = - tMhPar.PY41 end end -- Assegno parametri da dati utensili in macchina local MB = require( 'MachiningBase') local sLM -- face machining local nLMi = 1 local sLA -- mortise machining local nLAi = 1 local sLGH -- bore machining local nLGHi = 1 local sLGH2 -- 2nd bore machining local nLGH2i = 1 local sLG -- face chiseling or other material local nLGi = 1 local sLMS1 -- mounting screws machining local sLMS2 -- mounting screws machining local sLMS3 -- mounting screws machining local sLMS4 -- mounting screws machining local sLMS5 -- mounting screws machining local nLMSi = 1 local sLMP -- prebore machining local nLMPi = 1 local sLMP2 -- 2nd prebore machining local nLMP2i = 1 local sASG -- anti-splint on extra rectangle local nASGi = 1 local sASGR -- anti-splint on antisplint local nASGRi = 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.ech = false tMhPar.CH = nil tMhPar.est = true tMhPar.d2 = nil tMhPar.ASG = 0 tMhPar.EAR = nil tMhPar.das = nil else tMhPar.est = nil end -- devo considerare il profilo serratura e se eventualmente è opposto a quello cerniere if ( DGD.tProfs.lockedge.trimming == 'BU' or DGD.tProfs.lockedge.trimming == 'BUEB') and not tMhPar.dl then -- profilo serrratura bevel up e non è forzato come mortise -- se lato cerniere opposto mi troverò il bevel al contrario perché comanda il lato cerniere if DGD.bBothOppoBevel then nLGi = 3 nLMi = 3 else nLGi = 2 nLMi = 2 end elseif ( DGD.tProfs.lockedge.trimming == 'BD' or DGD.tProfs.lockedge.trimming == 'BDEB') and not tMhPar.dl then -- profilo serrratura bevel dn e non è forzato come mortise -- se lato cerniere opposto mi troverò il bevel al contrario perché comanda il lato cerniere if DGD.bBothOppoBevel then nLGi = 2 nLMi = 2 else nLGi = 3 nLMi = 3 end end if tMhPar.est and tMhPar.LG then -- se altro materiale sLG = tMhPar.LG .. tMhPar.HD if DGD.MachEn > 0 and tMhPar.d then nTempT0, dMaxMat0, sMchngName0 = MB.GetToolDataFromAttrib( sLG, nLGi) end end if tMhPar.LM then sLM = tMhPar.LM .. tMhPar.HD if DGD.MachEn > 0 and tMhPar.d then nTempT1, dMaxMat1, sMchngName1 = MB.GetToolDataFromAttrib( sLM, nLMi) end end if tMhPar.ech and tMhPar.LG then -- se chisel abilitato sLG = tMhPar.LG .. tMhPar.CH .. tMhPar.HD tMhPar.d0 = 0 if DGD.MachEn > 0 and tMhPar.d0 then nTempT0, dMaxMat0, sMchngName0 = MB.GetToolDataFromAttrib( sLG, nLGi) end end if tMhPar.LA then -- mortasa sLA = tMhPar.LA .. tMhPar.HD if DGD.MachEn > 0 and tMhPar.d2 then nTempT2, dMaxMat2, sMchngName2 = MB.GetToolDataFromAttrib( sLA, nLAi) end end -- foro o foro profondo if tMhPar.mh and tMhPar.LGH then sLGH = tMhPar.LGH .. tMhPar.HD if DGD.MachEn > 0 then nTempT3, dMaxMat2, sMchngName3 = MB.GetToolDataFromAttrib( sLGH, nLGHi) end end -- secondo foro o secondo foro profondo if tMhPar.mh2 and tMhPar.LGH2 then sLGH2 = tMhPar.LGH2 .. tMhPar.HD if DGD.MachEn > 0 then nTempT6, dMaxMat3, sMchngName6 = MB.GetToolDataFromAttrib( sLGH2, nLGH2i) end end -- mounting screws if tMhPar.LMS then sLMS1 = tMhPar.LMS .. tMhPar.HD if DGD.MachEn > 0 then nTempT4, dMaxMat4, sMchngName4 = MB.GetToolDataFromAttrib( sLMS1, nLMSi) end end if tMhPar.LMS41 then sLMS2 = tMhPar.LMS41 .. tMhPar.HD if DGD.MachEn > 0 then nTempT10, dMaxMat10, sMchngName10 = MB.GetToolDataFromAttrib( sLMS2, nLMSi) end end if tMhPar.LMS42 then sLMS3 = tMhPar.LMS42 .. tMhPar.HD if DGD.MachEn > 0 then nTempT11, dMaxMat11, sMchngName11 = MB.GetToolDataFromAttrib( sLMS3, nLMSi) end end if tMhPar.LMS43 then sLMS4 = tMhPar.LMS43 .. tMhPar.HD if DGD.MachEn > 0 then nTempT12, dMaxMat12, sMchngName12 = MB.GetToolDataFromAttrib( sLMS4, nLMSi) end end if tMhPar.LMS44 then sLMS5 = tMhPar.LMS44 .. tMhPar.HD if DGD.MachEn > 0 then nTempT13, dMaxMat13, sMchngName13 = MB.GetToolDataFromAttrib( sLMS5, nLMSi) end end -- preforo if tMhPar.mh and tMhPar.LMP and tMhPar.FBP > GEO.EPS_SMALL then sLMP = tMhPar.LMP .. tMhPar.HD if DGD.MachEn > 0 then nTempT5, dMaxMat5, sMchngName5 = MB.GetToolDataFromAttrib( sLMP, nLMPi) end end -- secondo preforo if tMhPar.mh2 and tMhPar.LMP2 and tMhPar.FBP2 > GEO.EPS_SMALL then sLMP2 = tMhPar.LMP2 .. tMhPar.HD if DGD.MachEn > 0 then nTempT7, dMaxMat7, sMchngName7 = MB.GetToolDataFromAttrib( sLMP2, nLMP2i) end end -- vertical bores parameters if tMhPar.T3 then if tMhPar.T3 == -0.5 then tMhPar.T3 = DGD.dT / 2 elseif tMhPar.T3 == -1 or tMhPar.T3 > DGD.dT then tMhPar.T3 = DGD.dT end end if tMhPar.T4 then if tMhPar.T4 == -0.5 then tMhPar.T4 = DGD.dT / 2 elseif tMhPar.T4 == -1 or tMhPar.T4 > DGD.dT then tMhPar.T4 = DGD.dT end end if tMhPar.T5 then if tMhPar.T5 == -0.5 then tMhPar.T5 = DGD.dT / 2 elseif tMhPar.T5 == -1 or tMhPar.T5 > DGD.dT then tMhPar.T5 = DGD.dT end end if tMhPar.T6 then if tMhPar.T6 == -0.5 then tMhPar.T6 = DGD.dT / 2 elseif tMhPar.T6 == -1 or tMhPar.T6 > DGD.dT then tMhPar.T6 = DGD.dT end end if tMhPar.T7 then if tMhPar.T7 == -0.5 then tMhPar.T7 = DGD.dT / 2 elseif tMhPar.T7 == -1 or tMhPar.T7 > DGD.dT then tMhPar.T7 = DGD.dT end end if tMhPar.T8 then if tMhPar.T8 == -0.5 then tMhPar.T8 = DGD.dT / 2 elseif tMhPar.T8 == -1 or tMhPar.T8 > DGD.dT then tMhPar.T8 = DGD.dT end end -- extra bores if tMhPar.T10 then if tMhPar.T10 == -0.5 then tMhPar.T10 = DGD.dT / 2 elseif tMhPar.T10 == -1 or tMhPar.T10 > DGD.dT then tMhPar.T10 = DGD.dT end end -- inclinated slide on first extra bore if tMhPar.AP10 and not tMhPar.est then while tMhPar.AP10 > 360 do tMhPar.AP10 = tMhPar.AP10 - 360 end while tMhPar.AP10 < -360 do tMhPar.AP10 = tMhPar.AP10 + 360 end else tMhPar.AP10 = nil end if tMhPar.TA10 and not tMhPar.est then if tMhPar.TA10 > 85 then -- se superiore a 80 gradi lo setto la max 80 gradi tMhPar.TA10 = 85 end if tMhPar.TA10 > 0 and tMhPar.TA10 < 5 then -- se inferiore di 10 gradi lo setto al minimo di 10 gradi tMhPar.TA10 = 5 end if tMhPar.TA10 < -85 then -- se superiore a 80 gradi lo setto la max 80 gradi tMhPar.TA10 = -85 end if tMhPar.TA10 < 0 and tMhPar.TA10 > -5 then -- se inferiore di -10 gradi lo setto al minimo di -10 gradi tMhPar.TA10 = -5 end else tMhPar.TA10 = nil end if tMhPar.T11 then if tMhPar.T11 == -0.5 then tMhPar.T11 = DGD.dT / 2 elseif tMhPar.T11 == -1 or tMhPar.T11 > DGD.dT then tMhPar.T11 = DGD.dT end end if tMhPar.T12 then if tMhPar.T12 == -0.5 then tMhPar.T12 = DGD.dT / 2 elseif tMhPar.T12 == -1 or tMhPar.T12 > DGD.dT then tMhPar.T12 = DGD.dT end end if tMhPar.T13 then if tMhPar.T13 == -0.5 then tMhPar.T13 = DGD.dT / 2 elseif tMhPar.T13 == -1 or tMhPar.T13 > DGD.dT then tMhPar.T13 = DGD.dT end end if tMhPar.T14 then if tMhPar.T14 == -0.5 then tMhPar.T14 = DGD.dT / 2 elseif tMhPar.T14 == -1 or tMhPar.T14 > DGD.dT then tMhPar.T14 = DGD.dT end end if tMhPar.T15 then if tMhPar.T15 == -0.5 then tMhPar.T15 = DGD.dT / 2 elseif tMhPar.T15 == -1 or tMhPar.T15 > DGD.dT then tMhPar.T15 = DGD.dT end end if tMhPar.T16 then if tMhPar.T16 == -0.5 then tMhPar.T16 = DGD.dT / 2 elseif tMhPar.T16 == -1 or tMhPar.T16 > DGD.dT then tMhPar.T16 = DGD.dT end end if tMhPar.T17 then if tMhPar.T17 == -0.5 then tMhPar.T17 = DGD.dT / 2 elseif tMhPar.T17 == -1 or tMhPar.T17 > DGD.dT then tMhPar.T17 = DGD.dT end end if tMhPar.T18 then if tMhPar.T18 == -0.5 then tMhPar.T18 = DGD.dT / 2 elseif tMhPar.T18 == -1 or tMhPar.T18 > DGD.dT then tMhPar.T18 = DGD.dT end end if tMhPar.T19 then if tMhPar.T19 == -0.5 then tMhPar.T19 = DGD.dT / 2 elseif tMhPar.T19 == -1 or tMhPar.T19 > DGD.dT then tMhPar.T19 = DGD.dT end end if tMhPar.T20 then if tMhPar.T20 == -0.5 then tMhPar.T20 = DGD.dT / 2 elseif tMhPar.T20 == -1 or tMhPar.T20 > DGD.dT then tMhPar.T20 = DGD.dT end end -- inclinated slide on first extra bore if tMhPar.AP20 and not tMhPar.est then while tMhPar.AP20 > 360 do tMhPar.AP20 = tMhPar.AP20 - 360 end while tMhPar.AP20 < -360 do tMhPar.AP20 = tMhPar.AP20 + 360 end else tMhPar.AP20 = nil end if tMhPar.TA20 and not tMhPar.est then if tMhPar.TA20 > 85 then -- se superiore a 80 gradi lo setto la max 80 gradi tMhPar.TA20 = 85 end if tMhPar.TA20 > 0 and tMhPar.TA20 < 5 then -- se inferiore di 10 gradi lo setto al minimo di 10 gradi tMhPar.TA20 = 5 end if tMhPar.TA20 < -85 then -- se superiore a 80 gradi lo setto la max 80 gradi tMhPar.TA20 = -85 end if tMhPar.TA20 < 0 and tMhPar.TA20 > -5 then -- se inferiore di -10 gradi lo setto al minimo di -10 gradi tMhPar.TA20 = -5 end else tMhPar.TA20 = nil end if tMhPar.T21 then if tMhPar.T21 == -0.5 then tMhPar.T21 = DGD.dT / 2 elseif tMhPar.T21 == -1 or tMhPar.T21 > DGD.dT then tMhPar.T21 = DGD.dT end end if tMhPar.T22 then if tMhPar.T22 == -0.5 then tMhPar.T22 = DGD.dT / 2 elseif tMhPar.T22 == -1 or tMhPar.T22 > DGD.dT then tMhPar.T22 = DGD.dT end end if tMhPar.T23 then if tMhPar.T23 == -0.5 then tMhPar.T23 = DGD.dT / 2 elseif tMhPar.T23 == -1 or tMhPar.T23 > DGD.dT then tMhPar.T23 = DGD.dT end end if tMhPar.T24 then if tMhPar.T24 == -0.5 then tMhPar.T24 = DGD.dT / 2 elseif tMhPar.T24 == -1 or tMhPar.T24 > DGD.dT then tMhPar.T24 = DGD.dT end end if tMhPar.T25 then if tMhPar.T25 == -0.5 then tMhPar.T25 = DGD.dT / 2 elseif tMhPar.T25 == -1 or tMhPar.T25 > DGD.dT then tMhPar.T25 = DGD.dT end end if tMhPar.T26 then if tMhPar.T26 == -0.5 then tMhPar.T26 = DGD.dT / 2 elseif tMhPar.T26 == -1 or tMhPar.T26 > DGD.dT then tMhPar.T26 = DGD.dT end end if tMhPar.T27 then if tMhPar.T27 == -0.5 then tMhPar.T27 = DGD.dT / 2 elseif tMhPar.T27 == -1 or tMhPar.T27 > DGD.dT then tMhPar.T27 = DGD.dT end end if tMhPar.T28 then if tMhPar.T28 == -0.5 then tMhPar.T28 = DGD.dT / 2 elseif tMhPar.T28 == -1 or tMhPar.T28 > DGD.dT then tMhPar.T28 = DGD.dT end end if tMhPar.T29 then if tMhPar.T29 == -0.5 then tMhPar.T29 = DGD.dT / 2 elseif tMhPar.T29 == -1 or tMhPar.T29 > DGD.dT then tMhPar.T29 = DGD.dT end end -- extra rectangles if tMhPar.TR10 then if tMhPar.TR10 == -0.5 then tMhPar.TR10 = DGD.dT / 2 elseif tMhPar.TR10 == -1 or tMhPar.TR10 > DGD.dT then tMhPar.TR10 = DGD.dT end end if tMhPar.TR11 then if tMhPar.TR11 == -0.5 then tMhPar.TR11 = DGD.dT / 2 elseif tMhPar.TR11 == -1 or tMhPar.TR11 > DGD.dT then tMhPar.TR11 = DGD.dT end end if tMhPar.TR12 then if tMhPar.TR12 == -0.5 then tMhPar.TR12 = DGD.dT / 2 elseif tMhPar.TR12 == -1 or tMhPar.TR12 > DGD.dT then tMhPar.TR12 = DGD.dT end end if tMhPar.TR13 then if tMhPar.TR13 == -0.5 then tMhPar.TR13 = DGD.dT / 2 elseif tMhPar.TR13 == -1 or tMhPar.TR13 > DGD.dT then tMhPar.TR13 = DGD.dT end end if tMhPar.TR14 then if tMhPar.TR14 == -0.5 then tMhPar.TR14 = DGD.dT / 2 elseif tMhPar.TR14 == -1 or tMhPar.TR14 > DGD.dT then tMhPar.TR14 = DGD.dT end end if tMhPar.TR20 then if tMhPar.TR20 == -0.5 then tMhPar.TR20 = DGD.dT / 2 elseif tMhPar.TR20 == -1 or tMhPar.TR20 > DGD.dT then tMhPar.TR20 = DGD.dT end end if tMhPar.TR21 then if tMhPar.TR21 == -0.5 then tMhPar.TR21 = DGD.dT / 2 elseif tMhPar.TR21 == -1 or tMhPar.TR21 > DGD.dT then tMhPar.TR21 = DGD.dT end end if tMhPar.TR22 then if tMhPar.TR22 == -0.5 then tMhPar.TR22 = DGD.dT / 2 elseif tMhPar.TR22 == -1 or tMhPar.TR22 > DGD.dT then tMhPar.TR22 = DGD.dT end end if tMhPar.TR23 then if tMhPar.TR23 == -0.5 then tMhPar.TR23 = DGD.dT / 2 elseif tMhPar.TR23 == -1 or tMhPar.TR23 > DGD.dT then tMhPar.TR23 = DGD.dT end end if tMhPar.TR24 then if tMhPar.TR24 == -0.5 then tMhPar.TR24 = DGD.dT / 2 elseif tMhPar.TR24 == -1 or tMhPar.TR24 > DGD.dT then tMhPar.TR24 = DGD.dT end end -- Anti-splint su extra rettangoli if DGD.MachEn > 0 and tMhPar.ASG and tMhPar.EAR and ( ( tMhPar.TR10 and tMhPar.TR10 > GEO.EPS_SMALL) or ( tMhPar.TR11 and tMhPar.TR11 > GEO.EPS_SMALL) or ( tMhPar.TR12 and tMhPar.TR12 > GEO.EPS_SMALL) or ( tMhPar.TR13 and tMhPar.TR13 > GEO.EPS_SMALL) or ( tMhPar.TR14 and tMhPar.TR14 > GEO.EPS_SMALL) or ( tMhPar.TR20 and tMhPar.TR20 > GEO.EPS_SMALL) or ( tMhPar.TR21 and tMhPar.TR21 > GEO.EPS_SMALL) or ( tMhPar.TR22 and tMhPar.TR22 > GEO.EPS_SMALL) or ( tMhPar.TR23 and tMhPar.TR23 > GEO.EPS_SMALL) or ( tMhPar.TR24 and tMhPar.TR24 > GEO.EPS_SMALL)) then sASG = tMhPar.ASG nTempT8, dMaxMat8, sMchngName8 = MB.GetToolDataFromAttrib( sASG, nASGi) end -- Anti-splint su Anti-splint if DGD.MachEn > 0 and tMhPar.EAR and tMhPar.EAR == 2 and sASG then sASGR = tMhPar.ASG..'_R' tMhPar.ASGR = sASGR tMhPar.das2 = tMhPar.das nTempT9, dMaxMat9, sMchngName9 = MB.GetToolDataFromAttrib( sASGR, nASGRi) end -- extra lines if tMhPar.TL10 then if tMhPar.TL10 == -0.5 then tMhPar.TL10 = DGD.dT / 2 elseif tMhPar.TL10 == -1 or tMhPar.TL10 > DGD.dT then tMhPar.TL10 = DGD.dT end end if tMhPar.TL11 then if tMhPar.TL11 == -0.5 then tMhPar.TL11 = DGD.dT / 2 elseif tMhPar.TL11 == -1 or tMhPar.TL11 > DGD.dT then tMhPar.TL11 = DGD.dT end end if tMhPar.TL12 then if tMhPar.TL12 == -0.5 then tMhPar.TL12 = DGD.dT / 2 elseif tMhPar.TL12 == -1 or tMhPar.TL12 > DGD.dT then tMhPar.TL12 = DGD.dT end end if tMhPar.TL13 then if tMhPar.TL13 == -0.5 then tMhPar.TL13 = DGD.dT / 2 elseif tMhPar.TL13 == -1 or tMhPar.TL13 > DGD.dT then tMhPar.TL13 = DGD.dT end end if tMhPar.TL14 then if tMhPar.TL14 == -0.5 then tMhPar.TL14 = DGD.dT / 2 elseif tMhPar.TL14 == -1 or tMhPar.TL14 > DGD.dT then tMhPar.TL14 = DGD.dT end end if tMhPar.TL20 then if tMhPar.TL20 == -0.5 then tMhPar.TL20 = DGD.dT / 2 elseif tMhPar.TL20 == -1 or tMhPar.TL20 > DGD.dT then tMhPar.TL20 = DGD.dT end end if tMhPar.TL21 then if tMhPar.TL21 == -0.5 then tMhPar.TL21 = DGD.dT / 2 elseif tMhPar.TL21 == -1 or tMhPar.TL21 > DGD.dT then tMhPar.TL21 = DGD.dT end end if tMhPar.TL22 then if tMhPar.TL22 == -0.5 then tMhPar.TL22 = DGD.dT / 2 elseif tMhPar.TL22 == -1 or tMhPar.TL22 > DGD.dT then tMhPar.TL22 = DGD.dT end end if tMhPar.TL23 then if tMhPar.TL23 == -0.5 then tMhPar.TL23 = DGD.dT / 2 elseif tMhPar.TL23 == -1 or tMhPar.TL23 > DGD.dT then tMhPar.TL23 = DGD.dT end end if tMhPar.TL24 then if tMhPar.TL24 == -0.5 then tMhPar.TL24 = DGD.dT / 2 elseif tMhPar.TL24 == -1 or tMhPar.TL24 > DGD.dT then tMhPar.TL24 = DGD.dT end end -- percorso custom nge if tMhPar.CGF and tMhPar.CGP then if string.len(tMhPar.CGF) > 0 and string.len(tMhPar.CGP) == 0 then tMhPar.CGP = tMhPar.ITP end 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 <= 0 then dNumLog = -1794 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 per face machining if DGD.bProoduce and not tMhPar.est and tMhPar.d and nTempT1 and nTempT1 <= 0 then dNumLog = -1794 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT1, sLM, nLMi, tMhPar.d, dNumLog, sMchngName1) elseif not tMhPar.est and nTempT1 then tMhPar.d = nTempT1 end -- gestisco il risultato della lettura utensili per mortise machining if not tMhPar.est and tMhPar.d2 and nTempT2 and nTempT2 <= 0 then if DGD.bProoduce and not tMhPar.jn then -- se non si concatenano i due percorsi dNumLog = -1794 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT2, sLA, nLAi, tMhPar.d2, dNumLog, sMchngName2) end elseif not tMhPar.est and nTempT2 then tMhPar.d2 = nTempT2 end -- gestisco il risultato della lettura utensili per antischeggia su extra rettangoli if DGD.bProoduce and not tMhPar.est and tMhPar.das and nTempT8 and nTempT8 <= 0 then dNumLog = -1794 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT8, sASG, nASGi, tMhPar.das, dNumLog, sMchngName8) elseif not tMhPar.est and nTempT8 then tMhPar.das = nTempT8 end -- gestisco il risultato della lettura utensili per antischeggia su antischeggia if DGD.bProoduce and not tMhPar.est and tMhPar.das2 and nTempT9 and nTempT9 <= 0 then dNumLog = -1794 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT9, sASGR, nASGRi, tMhPar.das2, dNumLog, sMchngName9) elseif not tMhPar.est and nTempT9 then tMhPar.das2 = nTempT9 end -- primo foro orizzontale -- se non ho parametro di lunghezza massima utensile preparo messaggio di warning per foro profondo if DGD.bProoduce and tMhPar.mh and sLGH and not dMaxMat2 then dNumLog = -1793 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT3, sLGH, nLGHi, nil, dNumLog, sMchngName3) end -- primo pre-foro orizzontale -- se non ho parametro di lunghezza massima utensile preparo messaggio di warning per preforo if DGD.bProoduce and tMhPar.mh and sLMP and not dMaxMat5 then dNumLog = -1793 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT5, sLMP, nLMPi, nil, dNumLog, sMchngName5) end -- secondo foro orizzontale -- se non ho parametro di lunghezza massima utensile preparo messaggio di warning per foro profondo if DGD.bProoduce and tMhPar.mh2 and sLGH2 and not dMaxMat3 then dNumLog = -1793 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT6, sLGH2, nLGH2i, nil, dNumLog, sMchngName6) end -- secondo pre-foro orizzontale -- se non ho parametro di lunghezza massima utensile preparo messaggio di warning per preforo if DGD.bProoduce and tMhPar.mh2 and sLMP2 and not dMaxMat7 then dNumLog = -1793 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT7, sLMP2, nLMP2i, nil, dNumLog, sMchngName7) end -- se non ho parametro di lunghezza massima utensile preparo messaggio di warning per mounting screw if DGD.bProoduce and sLMS1 and not dMaxMat4 then dNumLog = -1792 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT4, sLMS1, nLMSi, nil, dNumLog, sMchngName4) end if DGD.bProoduce and sLMS2 and not dMaxMat10 then dNumLog = -1792 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT10, sLMS2, nLMSi, nil, dNumLog, sMchngName10) end if DGD.bProoduce and sLMS3 and not dMaxMat11 then dNumLog = -1792 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT11, sLMS3, nLMSi, nil, dNumLog, sMchngName11) end if DGD.bProoduce and sLMS4 and not dMaxMat12 then dNumLog = -1792 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT12, sLMS4, nLMSi, nil, dNumLog, sMchngName12) end if DGD.bProoduce and sLMS5 and not dMaxMat13 then dNumLog = -1792 sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT13, sLMS5, nLMSi, nil, dNumLog, sMchngName13) 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 = -1790 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 = -1797 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 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 or ( tMhPar.mh and tMhPar.TB2)) and tMhPar.jnb and tMhPar.T2 and dMaxMat1 and tMhPar.T2 > dMaxMat1 then dNumLog = -1796 dNumMessage = 461 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T2), EgtToUiUnits(dMaxMat1)) tMhPar.T2 = dMaxMat1 end -- se mortise non concatenata a face e la profondità della mortise è maggiore della capacità utensile, -- limito la profondità ed emetto un warning if ( not tMhPar.jn or not tMhPar.jnb) and not tMhPar.mh and tMhPar.T2 and dMaxMat2 and tMhPar.T2 > dMaxMat2 then dNumLog = -1795 dNumMessage = 461 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T2), EgtToUiUnits(dMaxMat2)) tMhPar.T2 = dMaxMat2 end -- se primo foro e la sua profondità è maggiore della capacità utensile, -- limito la profondità ed emetto un warning if tMhPar.mh and dMaxMat2 then if tMhPar.TB2 and tMhPar.TB2 > dMaxMat2 then dNumLog = -1795 dNumMessage = 463 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.TB2), EgtToUiUnits(dMaxMat2)) tMhPar.TB2 = dMaxMat2 elseif tMhPar.T2 and not tMhPar.L2 and tMhPar.T2 > dMaxMat2 then dNumLog = -1795 dNumMessage = 463 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T2), EgtToUiUnits(dMaxMat2)) tMhPar.T2 = dMaxMat2 end end -- se primo preforo e la sua profondità è maggiore della capacità utensile, -- limito la profondità ed emetto un warning if tMhPar.mh and dMaxMat5 and tMhPar.FBP and tMhPar.FBP > dMaxMat5 then dNumLog = -1795 dNumMessage = 463 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.FBP), EgtToUiUnits(dMaxMat5)) tMhPar.FBP = dMaxMat5 end -- se secondo foro e la sua profondità è maggiore della capacità utensile, -- limito la profondità ed emetto un warning if tMhPar.mh2 and dMaxMat3 then if tMhPar.TB2_2 and tMhPar.TB2_2 > dMaxMat3 then dNumLog = -1795 dNumMessage = 463 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.TB2_2), EgtToUiUnits(dMaxMat3)) tMhPar.TB2_2 = dMaxMat3 end end -- se primo preforo e la sua profondità è maggiore della capacità utensile, -- limito la profondità ed emetto un warning if tMhPar.mh2 and dMaxMat7 and tMhPar.FBP2 and tMhPar.FBP2 > dMaxMat7 then dNumLog = -1795 dNumMessage = 463 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.FBP2), EgtToUiUnits(dMaxMat7)) tMhPar.FBP2 = dMaxMat7 end -- se la profondità dei mounting screws è maggiore della capacità utensile limito la profondità ed emetto un warning if tMhPar.T9 and dMaxMat4 and tMhPar.T9 > dMaxMat4 then dNumLog = -1791 dNumMessage = 463 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T9), EgtToUiUnits(dMaxMat4)) tMhPar.T9 = dMaxMat4 - 0.02 -- tolgo 0.02 per permettere la lavorazione end -- se la profondità dei mounting screws è maggiore della capacità utensile limito la profondità ed emetto un warning if tMhPar.T41 and dMaxMat10 and tMhPar.T41 > dMaxMat10 then dNumLog = -1791 dNumMessage = 463 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T41), EgtToUiUnits(dMaxMat10)) tMhPar.T41 = dMaxMat10 - 0.02 -- tolgo 0.02 per permettere la lavorazione end -- se la profondità dei mounting screws è maggiore della capacità utensile limito la profondità ed emetto un warning if tMhPar.T42 and dMaxMat11 and tMhPar.T42 > dMaxMat11 then dNumLog = -1791 dNumMessage = 463 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T42), EgtToUiUnits(dMaxMat11)) tMhPar.T42 = dMaxMat11 - 0.02 -- tolgo 0.02 per permettere la lavorazione end -- se la profondità dei mounting screws è maggiore della capacità utensile limito la profondità ed emetto un warning if tMhPar.T43 and dMaxMat12 and tMhPar.T43 > dMaxMat12 then dNumLog = -1791 dNumMessage = 463 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T43), EgtToUiUnits(dMaxMat12)) tMhPar.T43 = dMaxMat12 - 0.02 -- tolgo 0.02 per permettere la lavorazione end -- se la profondità dei mounting screws è maggiore della capacità utensile limito la profondità ed emetto un warning if tMhPar.T44 and dMaxMat13 and tMhPar.T44 > dMaxMat13 then dNumLog = -1791 dNumMessage = 463 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T44), EgtToUiUnits(dMaxMat13)) tMhPar.T44 = dMaxMat13 - 0.02 -- tolgo 0.02 per permettere la lavorazione end -- Raggio: se altro materiale e raggio presente e se raggio minore del diametro utensile + delta, lo annullo if tMhPar.est and 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 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 -- 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 = -1789 dNumMessage = 681 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, sPieceName, 'T', EgtToUiUnits(tMhPar.T), EgtToUiUnits(tMhPar.TTP), EgtToUiUnits(tMhPar.dThD)) tMhPar.T = tMhPar.TTP end if tMhPar.Dws and DGD.Spd > 0 and tMhPar.FBP2 and abs(tMhPar.FBP2) > tMhPar.TTP then dNumLog = -1789 dNumMessage = 681 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, sPieceName, 'FBP2', EgtToUiUnits(tMhPar.FBP2), EgtToUiUnits(tMhPar.TTP), EgtToUiUnits(tMhPar.dThD)) tMhPar.FBP2 = tMhPar.TTP end if tMhPar.Dws and DGD.Spd > 0 and tMhPar.T2 and abs(tMhPar.T2) > tMhPar.TTP then dNumLog = -1789 dNumMessage = 681 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, sPieceName, 'T2', EgtToUiUnits(tMhPar.T2), EgtToUiUnits(tMhPar.TTP), EgtToUiUnits(tMhPar.dThD)) tMhPar.T2 = tMhPar.TTP end if tMhPar.Dws and DGD.Spd > 0 and tMhPar.T9 and abs(tMhPar.T9) > tMhPar.TTP then dNumLog = -1789 dNumMessage = 681 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, sPieceName, 'T9', EgtToUiUnits(tMhPar.T9), EgtToUiUnits(tMhPar.TTP), EgtToUiUnits(tMhPar.dThD)) tMhPar.T9 = tMhPar.TTP end if tMhPar.Dws and DGD.Spd > 0 and tMhPar.T41 and abs(tMhPar.T41) > tMhPar.TTP then dNumLog = -1789 dNumMessage = 681 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, sPieceName, 'T41', EgtToUiUnits(tMhPar.T41), EgtToUiUnits(tMhPar.TTP), EgtToUiUnits(tMhPar.dThD)) tMhPar.T41 = tMhPar.TTP end if tMhPar.Dws and DGD.Spd > 0 and tMhPar.T42 and abs(tMhPar.T42) > tMhPar.TTP then dNumLog = -1789 dNumMessage = 681 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, sPieceName, 'T42', EgtToUiUnits(tMhPar.T42), EgtToUiUnits(tMhPar.TTP), EgtToUiUnits(tMhPar.dThD)) tMhPar.T42 = tMhPar.TTP end if tMhPar.Dws and DGD.Spd > 0 and tMhPar.T43 and abs(tMhPar.T43) > tMhPar.TTP then dNumLog = -1789 dNumMessage = 681 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, sPieceName, 'T43', EgtToUiUnits(tMhPar.T43), EgtToUiUnits(tMhPar.TTP), EgtToUiUnits(tMhPar.dThD)) tMhPar.T43 = tMhPar.TTP end if tMhPar.Dws and DGD.Spd > 0 and tMhPar.T44 and abs(tMhPar.T44) > tMhPar.TTP then dNumLog = -1789 dNumMessage = 681 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, sPieceName, 'T44', EgtToUiUnits(tMhPar.T44), EgtToUiUnits(tMhPar.TTP), EgtToUiUnits(tMhPar.dThD)) tMhPar.T44 = tMhPar.TTP end if tMhPar.Dws and DGD.Spd > 0 and tMhPar.FBP and abs(tMhPar.FBP) > tMhPar.TTP then dNumLog = -1789 dNumMessage = 681 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, sPieceName, 'FBP', EgtToUiUnits(tMhPar.FBP), EgtToUiUnits(tMhPar.TTP), EgtToUiUnits(tMhPar.dThD)) tMhPar.FBP = tMhPar.TTP end if tMhPar.Dws and DGD.Spd > 0 and tMhPar.TB2 and abs(tMhPar.TB2) > tMhPar.TTP then dNumLog = -1789 dNumMessage = 681 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, sPieceName, 'TB2', EgtToUiUnits(tMhPar.TB2), EgtToUiUnits(tMhPar.TTP), EgtToUiUnits(tMhPar.dThD)) tMhPar.TB2 = tMhPar.TTP end if tMhPar.Dws and DGD.Spd > 0 and tMhPar.TB2_2 and abs(tMhPar.TB2_2) > tMhPar.TTP then dNumLog = -1789 dNumMessage = 681 sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, sPieceName, 'TB2_2', EgtToUiUnits(tMhPar.TB2_2), EgtToUiUnits(tMhPar.TTP), EgtToUiUnits(tMhPar.dThD)) tMhPar.TB2_2 = tMhPar.TTP 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 LockMortiseCyl.Draw( tLckP, bPreview, bRunByCompo, nDrawMach) -- Assegno le dimensioni geometrie di fianco local L = tLckP.L local H = tLckP.H local T = tLckP.T local d = tLckP.d local p = tLckP.p local sf = tLckP.sf local dl = tLckP.dl local mh = tLckP.mh local mh2 = tLckP.mh2 local L2 = tLckP.L2 local H2 = tLckP.H2 local T2 = tLckP.T2 local HB2 = tLckP.HB2 local TB2 = tLckP.TB2 local HB2_2 = tLckP.HB2_2 local TB2_2 = tLckP.TB2_2 local d2 = tLckP.d2 local p2 = tLckP.p2 local s = tLckP.s local FBD = tLckP.FBD local FBP = tLckP.FBP local AB = tLckP.AB local FBD2 = tLckP.FBD2 local FBP2 = tLckP.FBP2 local AB2 = tLckP.AB2 local cl = tLckP.cl local rf = tLckP.rf -- raggio arrotondamento face local clc = tLckP.clc local ccr = tLckP.ccr local ech = tLckP.ech -- abilitazione chisel local est = tLckP.est -- altro materiale trovato local kbs = tLckP.kbs -- keep backset/thickness (0: none, 1: only face, 2: all) local pbs = tLckP.pbs local SL = tLckP.SL -- tabelle per i viti fissaggio (mounting screw) local tMountingScrew = {} -- inserimento dati nella tabella fori table.insert( tMountingScrew, { tLckP.D9, tLckP.T9, tLckP.I9, tLckP.IY9, tLckP.PX9, tLckP.PY9, tLckP.LMS}) table.insert( tMountingScrew, { tLckP.D41, tLckP.T41, tLckP.I41, tLckP.IY41, tLckP.PX41, tLckP.PY41, tLckP.LMS41}) table.insert( tMountingScrew, { tLckP.D42, tLckP.T42, tLckP.I42, tLckP.IY42, tLckP.PX42, tLckP.PY42, tLckP.LMS42}) table.insert( tMountingScrew, { tLckP.D43, tLckP.T43, tLckP.I43, tLckP.IY43, tLckP.PX43, tLckP.PY43, tLckP.LMS43}) table.insert( tMountingScrew, { tLckP.D44, tLckP.T44, tLckP.I44, tLckP.IY44, tLckP.PX44, tLckP.PY44, tLckP.LMS44}) local dws = tLckP.Dws local dthd = tLckP.dThD local typ = tLckP.TyP -- gestione inversione percorsi local invG = tLckP.invG -- flag per invertire il senso dei percorsi di lavorazione -- Assegno i flag local jn = tLckP.jn -- flag per giunzione face con mortise local jnb = tLckP.jnb -- flag che indica se profilo tipo bevel o no -- Inserimento geometrie probe local posh = tLckP.posh -- posizione in Y del foro di tastatura local posp = tLckP.posp -- posizione in X del foro di tastatura -- Disassamento della mortise rispetto alla face local D_X = tLckP.D_X -- disassamento cava (mortasa o foro) da centro lunghezza face -- Disassamento dei fori (1st) rispetto al face local DH_X = tLckP.DH_X -- disassamento fori (1st) da centro lunghezza face -- Disassamento dei fori (2nd) rispetto al face local DH_X2 = tLckP.DH_X2 -- disassamento fori (2nd) da centro lunghezza face -- Disassamento globale local D_XE = tLckP.D_XE -- Extra delta on X pos for all geometries -- Nome file custom geometry e percorso file da caricare local CustGeomFile = tLckP.CGF or '' local CustGeomPath = tLckP.CGP or '' -- Anti-splint su extra rectangle geometry local EAR = tLckP.EAR local das = tLckP.das local ASG = tLckP.ASG -- Second anti-splint on extra rectangle geometry local das2 = tLckP.das2 local ASGR = tLckP.ASGR -- tabelle per i fori, rettangoli e linee opzionali local tExtraBore = {} local tExtraRect = {} local tExtraLine = {} -- Assegno le dimensioni geometrie KEYWAY local D3 = tLckP.D3 local T3 = tLckP.T3 local P3 = tLckP.P3 local D4 = tLckP.D4 local T4 = tLckP.T4 local P4 = tLckP.P4 local ms = tLckP.ms local D5 = tLckP.D5 local T5 = tLckP.T5 local I5 = tLckP.I5 local AV = tLckP.AV local mc = tLckP.mc -- inserimento dati nella tabella fori table.insert( tExtraBore, { tLckP.D10, tLckP.T10, tLckP.PX10, tLckP.PY10, tLckP.EB10, tLckP.RBS10, tLckP.mis10, tLckP.AP10, tLckP.TA10, tLckP.ss10, tLckP.SLD10}) table.insert( tExtraBore, { tLckP.D11, tLckP.T11, tLckP.PX11, tLckP.PY11, tLckP.EB11, tLckP.RBS11}) table.insert( tExtraBore, { tLckP.D12, tLckP.T12, tLckP.PX12, tLckP.PY12, tLckP.EB12, tLckP.RBS12}) table.insert( tExtraBore, { tLckP.D13, tLckP.T13, tLckP.PX13, tLckP.PY13, tLckP.EB13, tLckP.RBS13}) table.insert( tExtraBore, { tLckP.D14, tLckP.T14, tLckP.PX14, tLckP.PY14, tLckP.EB14, tLckP.RBS14}) table.insert( tExtraBore, { tLckP.D15, tLckP.T15, tLckP.PX15, tLckP.PY15, tLckP.EB15, tLckP.RBS15}) table.insert( tExtraBore, { tLckP.D16, tLckP.T16, tLckP.PX16, tLckP.PY16, tLckP.EB16, tLckP.RBS16}) table.insert( tExtraBore, { tLckP.D17, tLckP.T17, tLckP.PX17, tLckP.PY17, tLckP.EB17, tLckP.RBS17}) table.insert( tExtraBore, { tLckP.D18, tLckP.T18, tLckP.PX18, tLckP.PY18, tLckP.EB18, tLckP.RBS18}) table.insert( tExtraBore, { tLckP.D19, tLckP.T19, tLckP.PX19, tLckP.PY19, tLckP.EB19, tLckP.RBS19}) -- inserimento dati nella tabella rettangoli table.insert( tExtraRect, { tLckP.LR10, tLckP.WR10, tLckP.RR10, tLckP.TR10, tLckP.PRX10, tLckP.PRY10, tLckP.AR10, tLckP.ER10, tLckP.RRS10, tLckP.TPG10}) table.insert( tExtraRect, { tLckP.LR11, tLckP.WR11, tLckP.RR11, tLckP.TR11, tLckP.PRX11, tLckP.PRY11, tLckP.AR11, tLckP.ER11, tLckP.RRS11, tLckP.TPG11}) table.insert( tExtraRect, { tLckP.LR12, tLckP.WR12, tLckP.RR12, tLckP.TR12, tLckP.PRX12, tLckP.PRY12, tLckP.AR12, tLckP.ER12, tLckP.RRS12, tLckP.TPG12}) table.insert( tExtraRect, { tLckP.LR13, tLckP.WR13, tLckP.RR13, tLckP.TR13, tLckP.PRX13, tLckP.PRY13, tLckP.AR13, tLckP.ER13, tLckP.RRS13, tLckP.TPG13}) table.insert( tExtraRect, { tLckP.LR14, tLckP.WR14, tLckP.RR14, tLckP.TR14, tLckP.PRX14, tLckP.PRY14, tLckP.AR14, tLckP.ER14, tLckP.RRS14, tLckP.TPG14}) -- inserimento dati nella tabella linee table.insert( tExtraLine, { tLckP.LL10, tLckP.TL10, tLckP.PLX10, tLckP.PLY10, tLckP.AL10, tLckP.EL10, tLckP.RLS10}) table.insert( tExtraLine, { tLckP.LL11, tLckP.TL11, tLckP.PLX11, tLckP.PLY11, tLckP.AL11, tLckP.EL11, tLckP.RLS11}) table.insert( tExtraLine, { tLckP.LL12, tLckP.TL12, tLckP.PLX12, tLckP.PLY12, tLckP.AL12, tLckP.EL12, tLckP.RLS12}) table.insert( tExtraLine, { tLckP.LL13, tLckP.TL13, tLckP.PLX13, tLckP.PLY13, tLckP.AL13, tLckP.EL13, tLckP.RLS13}) table.insert( tExtraLine, { tLckP.LL14, tLckP.TL14, tLckP.PLX14, tLckP.PLY14, tLckP.AL14, tLckP.EL14, tLckP.RLS14}) -- Assegno le dimensioni geometrie SECURE local D6 = tLckP.D6 local T6 = tLckP.T6 local P6 = tLckP.P6 local D7 = tLckP.D7 local T7 = tLckP.T7 local P7 = tLckP.P7 local msd = tLckP.msd local D8 = tLckP.D8 local T8 = tLckP.T8 local I8 = tLckP.I8 local AVd = tLckP.AVd local mcd = tLckP.mcd -- inserimento dati nella tabella fori table.insert( tExtraBore, { tLckP.D20, tLckP.T20, tLckP.PX20, tLckP.PY20, tLckP.EB20, tLckP.RBS20, tLckP.mis20, tLckP.AP20, tLckP.TA20, tLckP.ss20, tLckP.SLD20}) table.insert( tExtraBore, { tLckP.D21, tLckP.T21, tLckP.PX21, tLckP.PY21, tLckP.EB21, tLckP.RBS21}) table.insert( tExtraBore, { tLckP.D22, tLckP.T22, tLckP.PX22, tLckP.PY22, tLckP.EB22, tLckP.RBS22}) table.insert( tExtraBore, { tLckP.D23, tLckP.T23, tLckP.PX23, tLckP.PY23, tLckP.EB23, tLckP.RBS23}) table.insert( tExtraBore, { tLckP.D24, tLckP.T24, tLckP.PX24, tLckP.PY24, tLckP.EB24, tLckP.RBS24}) table.insert( tExtraBore, { tLckP.D25, tLckP.T25, tLckP.PX25, tLckP.PY25, tLckP.EB25, tLckP.RBS25}) table.insert( tExtraBore, { tLckP.D26, tLckP.T26, tLckP.PX26, tLckP.PY26, tLckP.EB26, tLckP.RBS26}) table.insert( tExtraBore, { tLckP.D27, tLckP.T27, tLckP.PX27, tLckP.PY27, tLckP.EB27, tLckP.RBS27}) table.insert( tExtraBore, { tLckP.D28, tLckP.T28, tLckP.PX28, tLckP.PY28, tLckP.EB28, tLckP.RBS28}) table.insert( tExtraBore, { tLckP.D29, tLckP.T29, tLckP.PX29, tLckP.PY29, tLckP.EB29, tLckP.RBS29}) -- inserimento dati nella tabella rettangoli table.insert( tExtraRect, { tLckP.LR20, tLckP.WR20, tLckP.RR20, tLckP.TR20, tLckP.PRX20, tLckP.PRY20, tLckP.AR20, tLckP.ER20, tLckP.RRS20, tLckP.TPG20}) table.insert( tExtraRect, { tLckP.LR21, tLckP.WR21, tLckP.RR21, tLckP.TR21, tLckP.PRX21, tLckP.PRY21, tLckP.AR21, tLckP.ER21, tLckP.RRS21, tLckP.TPG21}) table.insert( tExtraRect, { tLckP.LR22, tLckP.WR22, tLckP.RR22, tLckP.TR22, tLckP.PRX22, tLckP.PRY22, tLckP.AR22, tLckP.ER22, tLckP.RRS22, tLckP.TPG22}) table.insert( tExtraRect, { tLckP.LR23, tLckP.WR23, tLckP.RR23, tLckP.TR23, tLckP.PRX23, tLckP.PRY23, tLckP.AR23, tLckP.ER23, tLckP.RRS23, tLckP.TPG23}) table.insert( tExtraRect, { tLckP.LR24, tLckP.WR24, tLckP.RR24, tLckP.TR24, tLckP.PRX24, tLckP.PRY24, tLckP.AR24, tLckP.ER24, tLckP.RRS24, tLckP.TPG24}) -- inserimento dati nella tabella linee table.insert( tExtraLine, { tLckP.LL20, tLckP.TL20, tLckP.PLX20, tLckP.PLY20, tLckP.AL20, tLckP.EL20, tLckP.RLS20}) table.insert( tExtraLine, { tLckP.LL21, tLckP.TL21, tLckP.PLX21, tLckP.PLY21, tLckP.AL21, tLckP.EL21, tLckP.RLS21}) table.insert( tExtraLine, { tLckP.LL22, tLckP.TL22, tLckP.PLX22, tLckP.PLY22, tLckP.AL22, tLckP.EL22, tLckP.RLS22}) table.insert( tExtraLine, { tLckP.LL23, tLckP.TL23, tLckP.PLX23, tLckP.PLY23, tLckP.AL23, tLckP.EL23, tLckP.RLS23}) table.insert( tExtraLine, { tLckP.LL24, tLckP.TL24, tLckP.PLX24, tLckP.PLY24, tLckP.AL24, tLckP.EL24, tLckP.RLS24}) -- Assegno le label degli attributi fianco porta local LG = tLckP.LG -- nome geometria face local LG2 = tLckP.LG2 -- nome geometria mortise local LM = tLckP.LM -- nome geometria lavorazione face local LA = tLckP.LA -- nome geometria lavorazione mortise local CH = tLckP.CH -- nome suffisso lavorazione chisel local CLC = tLckP.CLC -- nome geometria clean corner local LGH = tLckP.LGH -- nome geometria 1st horizontal bore local LMP = tLckP.LMP -- nome geometria 1st horizontal pre bore local LGH2 = tLckP.LGH2 -- nome geometria 2nd horizontal bore local LMP2 = tLckP.LMP2 -- nome geometria 2nd horizontal pre bore local HD = tLckP.HD -- nome suffisso lavorazione su lati superiore/inferiore porta -- Assegno le label degli attributi porta KEYWAY local LSU = tLckP.LSU local HHU = tLckP.HHU local SCU = tLckP.SCU -- Assegno le label degli attributi porta SECURE local LSD = tLckP.LSD local HHD = tLckP.HHD local SCD = tLckP.SCD -- variabile nome geometrie probe local LH = 'Shuttle_Probe' -- variabili per messaggi e settaggi vari local sCompoName = tLckP.Nome local nCompoNpar = tLckP.Npar local sCompoPath = tLckP.Path -- eventuale messaggio errore rilevato nell'adjust local nCodAdj = tLckP.nCod local sCodAdj = tLckP.sCod -- variabili per messaggi di errore local sNamePar1 = tLckP.NPL or 'L' local sNamePar2 = tLckP.NPH or 'H' local sNamePar3 = tLckP.NPT or 'T' local sNamePar4 = tLckP.NPd or 'd' local sNamePar5 = tLckP.NPp or 'p' local sNamePar7 = tLckP.NL2 or 'L2' local sNamePar8 = tLckP.NT2 or 'T2' local sNamePar9 = tLckP.NPd2 or 'd2' local sNamePar10 = tLckP.NPp2 or 'p2' local sNamePar11 = tLckP.NPS or 's' local sNamePar12 = tLckP.NTB2 or 'TB2' local sNamePar13 = tLckP.NTB2_2 or 'TB2_2' local sNamePar14 = tLckP.FPB or 'FPB' local sNamePar15 = tLckP.FPB_2 or 'FPB2' local sNamePar21 = tLckP.NPI5 or 'I5' local sNamePar22 = tLckP.NPAV or 'Screw direction on KEYWAY side' local sNamePar33 = tLckP.NPI8 or 'I8' local sNamePar34 = tLckP.NPAVd or 'Screw direction on SECURE side' local sNamePar47 = tLckP.NPH2 or 'H2' local sNamePar48 = tLckP.NPSF or 'sf' local sNamePar49 = tLckP.NPRF or 'rf' local sNamePar50 = tLckP.N50 or 'clc' local sNamePar51 = tLckP.N51 or 'ccr' -- RunByComponetInterface local RC = true -- Messaggi codice errori local EM = ' ' local EC = 0 local ErrorBase = 1700 -- variabili che abilitano la creazione della geometria local bMakeFaceGeom = true local bMakeMortGeom = true local bMakeBoreGeom = true local bMake2ndBoreGeom = true -- se ho il suffisso per lavorazione su teste modifico i nomi geometrie applicati sui lati if HD and #HD > 0 then if LG then LG = LG .. HD end if LG2 then LG2 = LG2 .. HD end if LM then LM = LM .. HD end if LA then LA = LA .. HD end if CLC then CLC = CLC .. HD end if LGH then LGH = LGH .. HD end if LMP then LMP = LMP .. HD end if LGH2 then LGH2 = LGH2 .. HD end if LMP2 then LMP2 = LMP2 .. HD end end -- verifico se dei parametri sono nulli e nel caso disattivo la generazione della face if not L or not H then bMakeFaceGeom = false jn = false -- disattivo il join tra face e mortasa clc = nil CLC = nil end -- se le dimensioni del raccordo sono eccessive le riconduco a valori accettabili if bMakeFaceGeom then if L >= H then if rf > (H/2) then rf = (H/2) end else if rf > (L/2) then rf = (L/2) end end end -- verifico se dei parametri sono nulli e in qual caso assegno dei valori sostitutivi if not bRunByCompo then RC = false end if not T then T = 0 end if not T2 then T2 = 0 end if not D_X then D_X = 0 end if not DH_X then DH_X = 0 end if not DH_X2 then DH_X2 = 0 end if not D_XE then D_XE = 0 end -- se rilevato profilo bevel disattivo il join tra face e mortasa if not jnb then jn = false end -- se non definita o parametri relativi alla definizione dei percorsi sono mancanti, la setto per non creare geometria di lavorazione if not nDrawMach then nDrawMach = 0 end if est or ( not L2 or not H2 or not LG2 or not LA) or ( mh and not HB2) then bMakeMortGeom = false -- disattivo il join jn = false end -- if ( not HB2 or not TB2) and ( not ( H2 and not L2) or not T2) or not mh then if ( not HB2 or not TB2) and ( not H2 or not T2) or not mh then bMakeBoreGeom = false end if ( not HB2_2 or not TB2_2) or not mh2 then bMake2ndBoreGeom = false end -- se prima e seconda cava giuntate assegno il diametro della seconda cava uguale alla prima if jn and bMakeFaceGeom and bMakeMortGeom then d2 = d p2 = p end if not ASGR then das2 = nil end local EgtDoorsMsg = require( 'EgtDoorsMsg') -- Verifica delle dimensioni, alcune condizioni vengono verificate solo se è abilitata la creazione dei percorsi di lavorazione 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 bMakeMortGeom and nDrawMach > 0 and not mh and d2 < DgMin then EC = 2 EM = string.format(EgtDoorsMsg[400],sNamePar9, EgtToUiUnits(d),EgtToUiUnits(DgMin)) -- il diametro utensile deve essere >= di d2 = DgMin elseif bMakeFaceGeom and nDrawMach > 0 and H < d then if DGD.bProoduce then EC = 3 EM = string.format(EgtDoorsMsg[405],sNamePar2,EgtToUiUnits(H),EgtToUiUnits(d), sCompoPath) -- il parametro 'H' deve essere >= del diametro utensile H = d else d = H - 0.002 end elseif bMakeFaceGeom and nDrawMach > 0 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 L = d + 0.002 else d = L - 0.002 end elseif bMakeFaceGeom and nDrawMach > 0 and ( p < PtMin or p > PtMax) then EC = 5 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 mh and ( p2 < PtMin or p2 > PtMax) then EC = 6 EM = string.format(EgtDoorsMsg[403],sNamePar10,p2,PtMin,PtMax, sCompoPath) -- il parametro 'p2' deve essere compreso tra p2 = 0.8 elseif ms and ( AV < 0 or AV > 180) then EC = 7 EM = string.format(EgtDoorsMsg[403],sNamePar22,AV,0,180, sCompoPath) -- il parametro 'AV' deve essere compreso tra AV = 90 elseif msd and ( AVd < 0 or AVd > 180) then EC = 8 EM = string.format(EgtDoorsMsg[403],sNamePar34,AVd,0,180, sCompoPath) -- il parametro 'AVd' deve essere compreso tra AVd = 90 elseif bMakeFaceGeom and T < 0 then EC = 9 EM = string.format(EgtDoorsMsg[404],sNamePar3,EgtToUiUnits(T), sCompoPath) -- il parametro 'T' deve essere >= 0 T = 0 elseif bMakeFaceGeom and L <= 0 then EC = 10 EM = string.format(EgtDoorsMsg[401],sNamePar1,EgtToUiUnits(L), sCompoPath) -- il parametro 'L' deve essere > 0 L = d*2 elseif bMakeFaceGeom and bMakeMortGeom and not mh and L2 >= L then EC = 11 EM = string.format(EgtDoorsMsg[406],sNamePar7,EgtToUiUnits(L2),sNamePar1,EgtToUiUnits(L), sCompoPath) -- il parametro 'L2' deve essere < 'L' L2 = L - 0.1 elseif bMakeFaceGeom and bMakeMortGeom and H2 > H then EC = 12 EM = string.format(EgtDoorsMsg[456],sNamePar47,EgtToUiUnits(H2),sNamePar2,EgtToUiUnits(H), sCompoPath) -- il parametro 'H2' deve essere <= 'H' H2 = H elseif bMakeMortGeom and T2 <= 0 then EC = 13 EM = string.format(EgtDoorsMsg[401],sNamePar8,EgtToUiUnits(T2), sCompoPath) -- il parametro 'T2' deve essere > 0 T2 = 0.1 elseif bMakeFaceGeom and bMakeMortGeom and not dws and T2 <= T then EC = 14 EM = string.format(EgtDoorsMsg[407],sNamePar8,EgtToUiUnits(T2),sNamePar3,EgtToUiUnits(T), sCompoPath) -- il parametro 'T2' deve essere > 'T' T2 = T + 0.1 elseif bMakeMortGeom and nDrawMach > 0 and not mh and s and s <= 0 then EC = 15 EM = string.format(EgtDoorsMsg[401],sNamePar11,EgtToUiUnits(s), sCompoPath) -- il parametro 's' deve essere > 0 s = d2 elseif bMakeMortGeom and nDrawMach > 0 and not mh and L2 <= d2 then if DGD.bProoduce then EC = 16 EM = string.format(EgtDoorsMsg[402],sNamePar7,EgtToUiUnits(L2),sNamePar9,EgtToUiUnits(d2), sCompoPath) -- il parametro 'L2' deve essere maggiore al diametro utensile L2 = d + 0.002 else d = L2 - 0.002 end elseif bMakeMortGeom and nDrawMach > 0 and not mh and H2 < d2 then if DGD.bProoduce then EC = 17 EM = string.format(EgtDoorsMsg[405],sNamePar47,EgtToUiUnits(H2),EgtToUiUnits(d2), sCompoPath) -- il parametro 'H2' deve essere >= del diametro utensile H2 = d2 else d2 = H2 - 0.002 end elseif bMakeFaceGeom and H <= 0 then EC = 18 EM = string.format(EgtDoorsMsg[401],sNamePar2,EgtToUiUnits(H), sCompoPath) -- il parametro 'H' deve essere > 0 H = d elseif bMakeMortGeom and H2 <= 0 then EC = 19 EM = string.format(EgtDoorsMsg[401],sNamePar47,EgtToUiUnits(H2), sCompoPath) -- il parametro 'H2' deve essere > 0 H2 = d2 elseif bMakeFaceGeom and nDrawMach > 0 and sf and sf <= 0 then EC = 20 EM = string.format(EgtDoorsMsg[401],sNamePar48,EgtToUiUnits(sf), sCompoPath) -- il parametro 'sf' deve essere > 0 sf = d elseif bMakeFaceGeom and cl and cl > 0 and rf < 0 then EC = 21 EM = string.format(EgtDoorsMsg[404],sNamePar49,EgtToUiUnits(rf), sCompoPath) -- il parametro 'rf' deve essere >= 0 rf = H/2 elseif bMakeFaceGeom and CLC and clc and ccr and clc > 0 and ccr > 0 and (2*(ccr*sin(45))) >= clc then EC = 22 EM = string.format(EgtDoorsMsg[407],sNamePar50,EgtToUiUnits(clc),'',EgtToUiUnits(2*(ccr*sin(45))), sCompoPath) -- il parametro 'clc' deve essere > 'crc' clc = (2*(ccr*sin(45)))+0.2 elseif bMakeBoreGeom and FBP and ( ( TB2 and FBP >= TB2) or ( not TB2 and T2 and FBP >= T2)) then if TB2 and FBP >= TB2 then EC = 23 EM = string.format(EgtDoorsMsg[407],sNamePar12,EgtToUiUnits(TB2),sNamePar14,EgtToUiUnits(FBP), sCompoPath) -- il parametro 'TB2' deve essere > 'FBP' TB2 = FBP + 0.1 elseif T2 and FBP >= T2 then EC = 24 EM = string.format(EgtDoorsMsg[407],sNamePar8,EgtToUiUnits(T2),sNamePar14,EgtToUiUnits(FBP), sCompoPath) -- il parametro 'T2' deve essere > 'FBP' T2 = FBP + 0.1 end elseif bMake2ndBoreGeom and FBP2 and TB2_2 and FBP2 >= TB2_2 then EC = 25 EM = string.format(EgtDoorsMsg[407],sNamePar13,EgtToUiUnits(TB2_2),sNamePar15,EgtToUiUnits(FBP2), sCompoPath) -- il parametro 'TB2_2' deve essere > 'FBP2' TB2_2 = FBP2 + 0.1 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 Lg = EgtGroup(Pz,GDB_RT.LOC) -- layer principale EgtSetName(Lg,sCompoName) local nPos1st = 0 local hint, hint_1, hint_2, hint_7, hint_8, hint_9 -- variabili percorsi sul fianco local thint_3, thint_4, thint_5, thint_6 -- tabelle fori sul fianco local hint_10, hint_11, hint_12, hint_13, hint_14, hint_15 -- variabili percorsi su secure o keyway local hintPk, hintPk2 -- variabili percorsi di lavorazione local nPkJoin local dFirstface = {} local dMortise = {} local nForceMakeFace = nDrawMach 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 -- prima cava face completa -- assegno i valori coerenti con la tabella del componente dFirstface.L = L dFirstface.H = H dFirstface.T = T dFirstface.d = d dFirstface.p = p dFirstface.sf = sf dFirstface.jn = jn dFirstface.L2 = L2 dFirstface.H2 = H2 dFirstface.cl = cl dFirstface.rf = rf dFirstface.est = est dFirstface.invG = invG -- se ho abilitato il chiseling modifico il nome geometria if ech then dFirstface.LG = LG .. CH -- se ho abilitato solo le geometrie di lavorazione, abilito la generazione di entrambe per il contorno chisel if nDrawMach == 1 then nForceMakeFace = 2 end else dFirstface.LG = LG end dFirstface.LM = LM dFirstface.Nome = sCompoName dFirstface.D_X = D_X - nPos1st dFirstface.Dws = nil -- disabilito per non creare geometrie (doppie) inerenti il calcolo regioni nei componenti chiamati -- lancio il primo componente base per disegnare la face completa MHgen = require( '_Latch') hint, hintPk = MHgen.Draw( EC, EM, dFirstface, bPreview, bRunByCompo, nForceMakeFace, Pz, Lg, dThickDoor) -- setto le note che indicano su che lato della porta devono essere messe le geometrie local sSide = EgtIf( dl, 'Lock', 'Side') -- setto le note che indicano su che lato della porta devono essere messe le geometrie if hint then EgtSetInfo(hint,'SideDoor', sSide) -- se mantiene centro spessore anche su face if kbs and kbs > 0 then EgtSetInfo( hint, 'KeepBackSet', 'c') -- setto 'c' perché viene mantenuto il centro spessore end if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint, 'ProbeSide', '1') end end if hintPk then EgtSetInfo(hintPk,'SideDoor', sSide) -- se mantiene centro spessore anche su face if kbs and kbs > 0 then EgtSetInfo( hintPk, 'KeepBackSet', 'c') -- setto 'c' perché viene mantenuto il centro spessore end if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hintPk, 'ProbeSide', '1') end end -- Clean corner if nDrawMach >= 0 then -- se abilitata geometria if cl ~= 3 or ( cl == 3 and rf > 0) then -- se c'è almeno un lato senza raccordo if CLC and clc and clc > 0 and clc < H and clc < L then local bInvert = (SL == 'R') if DGD.SIDE == 'top' then bInvert = not bInvert end local CLC1 = MakeClcPath( clc, ccr, CLC, Lg, -T, bInvert) if CLC1 then -- se mantiene backset if kbs and kbs > 0 then EgtSetInfo( CLC1, 'KeepBackSet', 'c') -- setto 'c' perché viene mantenuto il centro spessore end if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( CLC1, 'ProbeSide', '1') end EgtSetInfo( CLC1,'SideDoor',sSide) 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 end if bMakeBoreGeom then -- se primo foro orizzontale abilitato -- se parametri foro/preforo if FBD and FBD > 0 and FBP and FBP > 0 then hint_7 = EgtCircle( Lg, Point3d(0,0,0), FBD/2 , GDB_RT.LOC) EgtModifyCurveThickness( hint_7, -FBP) EgtSetName( hint_7, LMP) if AB and abs(AB) > 0 then -- setto la griglia di fronte EgtSetGridFrame( Frame3d( 0, 0, 0, GDB_FR.FRONT)) EgtRotate( hint_7, Point3d(0,0,0), Z_AX(), AB, GDB_RT.GRID) -- ruoto su faccia frontale -- setto la griglia di top EgtSetGridFrame( Frame3d( 0, 0, 0, GDB_FR.TOP)) end end -- se parametri secondo foro if HB2 and TB2 and LGH then hint_8 = EgtCircle( Lg, Point3d(0,0,0), HB2/2 , GDB_RT.LOC) EgtModifyCurveThickness( hint_8, -TB2) elseif H2 and T2 and LGH then hint_8 = EgtCircle( Lg, Point3d(0,0,0), H2/2 , GDB_RT.LOC) EgtModifyCurveThickness( hint_8, -T2) end if hint_8 then -- se esiste secondo foro EgtSetName( hint_8, LGH) if AB and abs(AB) > 0 then -- setto la griglia di fronte EgtSetGridFrame( Frame3d( 0, 0, 0, GDB_FR.FRONT)) EgtRotate( hint_8, Point3d(0,0,0), Z_AX(), AB, GDB_RT.GRID) -- ruoto su faccia frontale -- setto la griglia di top EgtSetGridFrame( Frame3d( 0, 0, 0, GDB_FR.TOP)) end EgtSetInfo( hint_8, 'SideDoor', 'Lock') -- se mantiene centro spessore su mortise if kbs and kbs > 0 then EgtSetInfo( hint_8, 'KeepBackSet', 'c') -- setto 'c' perché viene mantenuto il centro spessore end if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_8, 'ProbeSide', '1') end end if hint_7 then -- se esiste foro/preforo EgtSetInfo( hint_7, 'SideDoor', 'Lock') -- se mantiene centro spessore su mortise if kbs and kbs > 0 then EgtSetInfo( hint_7, 'KeepBackSet', 'c') -- setto 'c' perché viene mantenuto il centro spessore end if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_7, 'ProbeSide', '1') end end end if bMake2ndBoreGeom then -- se secondo foro orizzontale abilitato -- se parametri foro/preforo if FBD2 and FBD2 > 0 and FBP2 and FBP2 > 0 then hint_1 = EgtCircle( Lg, Point3d(0,0,0), FBD2/2 , GDB_RT.LOC) EgtModifyCurveThickness( hint_1, -FBP2) EgtSetName( hint_1, LMP2) if AB2 and abs(AB2) > 0 then -- setto la griglia di fronte EgtSetGridFrame( Frame3d( 0, 0, 0, GDB_FR.FRONT)) EgtRotate( hint_1, Point3d(0,0,0), Z_AX(), AB2, GDB_RT.GRID) -- ruoto su faccia frontale -- setto la griglia di top EgtSetGridFrame( Frame3d( 0, 0, 0, GDB_FR.TOP)) end end -- se parametri secondo foro if HB2_2 and TB2_2 and LGH2 then hint_9 = EgtCircle( Lg, Point3d(0,0,0), HB2_2/2 , GDB_RT.LOC) EgtModifyCurveThickness( hint_9, -TB2_2) end if hint_9 then -- se esiste secondo foro EgtSetName( hint_9, LGH2) if AB2 and abs(AB2) > 0 then -- setto la griglia di fronte EgtSetGridFrame( Frame3d( 0, 0, 0, GDB_FR.FRONT)) EgtRotate( hint_9, Point3d(0,0,0), Z_AX(), AB2, GDB_RT.GRID) -- ruoto su faccia frontale -- setto la griglia di top EgtSetGridFrame( Frame3d( 0, 0, 0, GDB_FR.TOP)) end EgtSetInfo( hint_9, 'SideDoor', 'Lock') -- se mantiene centro spessore su mortise if kbs and kbs > 0 then EgtSetInfo( hint_9, 'KeepBackSet', 'c') -- setto 'c' perché viene mantenuto il centro spessore end if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_9, 'ProbeSide', '1') end end if hint_1 then -- se esiste foro/preforo EgtSetInfo( hint_1, 'SideDoor', 'Lock') -- se mantiene centro spessore su mortise if kbs and kbs > 0 then EgtSetInfo( hint_1, 'KeepBackSet', 'c') -- setto 'c' perché viene mantenuto il centro spessore end if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_1, 'ProbeSide', '1') end end end if bMakeMortGeom then -- se seconda cava abilitata -- assegno i valori coerenti con la tabella del componente dMortise.T = T dMortise.L2 = L2 dMortise.H2 = H2 dMortise.T2 = T2 dMortise.s = s dMortise.d = d dMortise.p = p dMortise.jn = jn dMortise.d3 = d2 dMortise.p3 = p2 dMortise.invG = invG dMortise.mkrev = false -- disabilito la creazione del percorso in senso contrario dMortise.L3 = L2 dMortise.H3 = H2 dMortise.LGM = LG2 dMortise.LMM = LA dMortise.Nome = sCompoName dMortise.jne = false dMortise.D_X = D_X dMortise.pbs = pbs -- lancio il secondo componente base MHgen = require('_Mortise') hint_2, hintPk2 = MHgen.Draw( EC, EM, dMortise, bPreview, bRunByCompo, nDrawMach, Pz, Lg, 0) -- setto le note che indicano su che lato della porta devono essere messe le geometrie if hint_2 then EgtSetInfo(hint_2,'SideDoor','Lock') end if hintPk2 then EgtSetInfo(hintPk2,'SideDoor','Lock') end end -- disegno le geometrie mounting screw if EC == 0 then thint_3 = {} thint_4 = {} thint_5 = {} thint_6 = {} for k = 1, 5 do local D9 = tMountingScrew[k][1] local T9 = tMountingScrew[k][2] local I9 = tMountingScrew[k][3] or 0 local IY9 = tMountingScrew[k][4] or 0 local PX9 = tMountingScrew[k][5] or 0 local PY9 = tMountingScrew[k][6] or 0 local LMS = tMountingScrew[k][7] -- se dimensioni foro viti idonee if D9 and T9 and LMS then if D9 > 0 and T9 ~= 0 and LMS ~= '' then if not Lg then Lg = EgtGroup(Pz,GDB_RT.LOC) EgtSetName(Lg,sCompoName) end local hint_3 = EgtCircle( Lg, Point3d(PX9+(I9/2),PY9+(IY9/2),0), D9/2 , GDB_RT.LOC) EgtModifyCurveThickness( hint_3, -T9) -- se ho il suffisso per lavorazione su teste if HD and #HD > 0 then LMS = LMS .. HD end EgtSetName( hint_3, LMS) EgtSetInfo( hint_3, 'SideDoor', 'Lock') -- setto una nota per indicare su che lato della porta deve essere spostato -- se mantiene centro spessore anche su face if kbs and kbs > 0 then EgtSetInfo( hint_3, 'KeepBackSet', 'c') -- setto 'c' perché viene mantenuto il centro spessore end if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_3, 'ProbeSide', '1') end table.insert( thint_3, hint_3) if IY9 ~= 0 then local hint_5 = EgtCircle( Lg, Point3d(PX9+(I9/2),PY9-(IY9/2),0), D9/2 , GDB_RT.LOC) EgtModifyCurveThickness( hint_5, -T9) EgtSetName( hint_5, LMS) EgtSetInfo( hint_5, 'SideDoor', 'Lock') -- setto una nota per indicare su che lato della porta deve essere spostato -- se mantiene centro spessore anche su face if kbs and kbs > 0 then EgtSetInfo( hint_5, 'KeepBackSet', 'c') -- setto 'c' perché viene mantenuto il centro spessore end if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_5, 'ProbeSide', '1') end table.insert( thint_5, hint_5) end if I9 ~= 0 then local hint_4 = EgtCircle( Lg, Point3d(PX9-(I9/2),PY9+(IY9/2),0), D9/2 , GDB_RT.LOC) EgtModifyCurveThickness( hint_4, -T9) EgtSetName( hint_4, LMS) EgtSetInfo( hint_4, 'SideDoor', 'Lock') -- setto una nota per indicare su che lato della porta deve essere spostato -- se mantiene centro spessore anche su face if kbs and kbs > 0 then EgtSetInfo( hint_4, 'KeepBackSet', 'c') -- setto 'c' perché viene mantenuto il centro spessore end if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_4, 'ProbeSide', '1') end table.insert( thint_4, hint_4) if IY9 ~= 0 then local hint_6 = EgtCircle( Lg, Point3d(PX9-(I9/2),PY9-(IY9/2),0), D9/2 , GDB_RT.LOC) EgtModifyCurveThickness( hint_6, -T9) EgtSetName( hint_6, LMS) EgtSetInfo( hint_6, 'SideDoor', 'Lock') -- setto una nota per indicare su che lato della porta deve essere spostato -- se mantiene centro spessore anche su face if kbs and kbs > 0 then EgtSetInfo( hint_6, 'KeepBackSet', 'c') -- setto 'c' perché viene mantenuto il centro spessore end if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_6, 'ProbeSide', '1') end table.insert( thint_6, hint_6) end end end end end end if EC == 0 and ( hint or hintPk) and abs(nPos1st) > GEO.EPS_SMALL then -- se esiste la prima face if hint then EgtMove( hint, Point3d(nPos1st,0,0) - ORIG()) end if hintPk then EgtMove( hintPk, Point3d(nPos1st,0,0) - ORIG()) end end if EC == 0 and bMakeBoreGeom and hint_8 then -- se esiste il secondo foro (1st) if DH_X and abs(DH_X) > GEO.EPS_SMALL then EgtMove( hint_8, Point3d(DH_X,0,0) - ORIG()) elseif not HB2 and abs(D_X) > GEO.EPS_SMALL then EgtMove( hint_8, Point3d(D_X,0,0) - ORIG()) end end if EC == 0 and bMakeBoreGeom and hint_7 then -- se esiste il foro/preforo (1st) if DH_X and abs(DH_X) > GEO.EPS_SMALL then EgtMove( hint_7, Point3d(DH_X,0,0) - ORIG()) elseif not HB2 and abs(D_X) > GEO.EPS_SMALL then EgtMove( hint_7, Point3d(D_X,0,0) - ORIG()) end end if EC == 0 and bMake2ndBoreGeom and hint_9 then -- se esiste il secondo foro (2nd) if DH_X2 and abs(DH_X2) > GEO.EPS_SMALL then EgtMove( hint_9, Point3d(DH_X2,0,0) - ORIG()) end end if EC == 0 and bMake2ndBoreGeom and hint_1 then -- se esiste il foro/preforo (2nd) if DH_X2 and abs(DH_X2) > GEO.EPS_SMALL then EgtMove( hint_1, Point3d(DH_X2,0,0) - ORIG()) end end if EC == 0 and ( hint_2 or hintPk2) and abs(D_X) > GEO.EPS_SMALL then -- se esiste la seconda cava if hint_2 then EgtMove( hint_2, Point3d(D_X,0,0) - ORIG()) end if hintPk2 then EgtMove( hintPk2, Point3d(D_X,0,0) - ORIG()) end end if jn and EC == 0 and hintPk and hintPk2 then nPkJoin = EgtCurveCompo( Lg, {hintPk,hintPk2}, true) if nPkJoin then EgtSetName( nPkJoin, LM) -- se concatenata con la seconda cava (mortasa), forzo la posizione a Lock ( non segue angolo del profilo bevel) EgtSetInfo( nPkJoin, 'SideDoor', 'Lock') EgtSetInfo( nPkJoin, 'NotCheckDir', '1') -- se mantiene centro spessore anche su face if kbs and kbs > 0 then EgtSetInfo( nPkJoin, 'KeepBackSet', 'c') -- setto 'c' perché viene mantenuto il centro spessore EgtSetInfo( hint_2, 'KeepBackSet', 'c') -- setto 'c' perché viene mantenuto il centro spessore end if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( nPkJoin, 'ProbeSide', '1') EgtSetInfo( hint_2, 'ProbeSide', '1') end else EC = ErrorBase + 40 EM = string.format(EgtDoorsMsg[426], sCompoPath) end elseif not jn and EC == 0 and hintPk2 then -- se mantiene centro spessore su mortise if kbs and kbs > 1 then EgtSetInfo( hintPk2, 'KeepBackSet', 'c') -- setto 'c' perché viene mantenuto il centro spessore EgtSetInfo( hint_2, '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( hintPk2, 'ProbeSide', '1') EgtSetInfo( hint_2, 'ProbeSide', '1') end end if EC == 0 then -- se nessun errore -- Gestione file custom local MakeFaceGeom = true -- caricamento del file custom if string.len(CustGeomFile) > 0 and string.find( string.lower(CustGeomFile), '.nge') > 0 then -- sostituisco il carattere '\' con '_' nel nome file CustGeomFile = string.gsub(CustGeomFile, '\\', '_') CustGeomFile = string.gsub(CustGeomFile, '/', '_') -- concateno il file alla path local sCustomPathFile = CustGeomPath..CustGeomFile local nNewPart local nNewLayer local nNewEnt local nTypeEnt local sTypeInfo local cColor -- provo ad inserire MakeFaceGeom = not EgtInsertFile( sCustomPathFile) -- se fallito inserimento file dò un messaggio di errore if MakeFaceGeom then EC = ErrorBase + 41 EM = string.format( EgtDoorsMsg[457], sCustomPathFile) else nNewPart = EgtGetNext(Pz) -- nome nuovo pezzo nNewLayer = EgtGetFirstInGroup( nNewPart) -- ottengo nuovo layer -- riloco tutti i nuovi layer dal nuovo pezzo al pezzo corrente while nNewLayer do nNewEnt = EgtGetFirstInGroup( nNewLayer) -- ottengo nuova entità while nNewEnt do -- controllo se ha dei colori e le note giuste per cambiare lo spessore nTypeEnt = EgtGetType( nNewEnt) sTypeInfo = EgtGetInfo( nNewEnt, 'SideDoor') cColor = EgtGetCalcColor( nNewEnt) if sTypeInfo and cColor and DGD.dT then if string.lower(sTypeInfo) == 'keyway' or string.lower(sTypeInfo) == 'secure' then if AreSameColor(cColor,RED(),30) then -- se colore rosso allora spessore completo EgtModifyCurveThickness(nNewEnt, -DGD.dT) elseif AreSameColor(cColor,LIME(),30) then -- se colore verde allora metà spessore EgtModifyCurveThickness(nNewEnt, -(DGD.dT/2)) -- se mantiene profondità e non è a spessore passante if kbs and kbs > 1 then EgtSetInfo( nNewEnt, 'KeepBackSet', 'x') -- setto 'x' provvisoriamente end if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( nNewEnt, 'ProbeSide', '1') end else -- altrimenti controllo che lo spessore non supera quello della porta, se lo supera lo setto = spessore porta local dTh = EgtCurveThickness( nNewEnt) if abs(dTh) > DGD.dT then EgtModifyCurveThickness( nNewEnt, EgtIf( dTh > 0, DGD.dT, -DGD.dT)) elseif abs(dTh) < DGD.dT then -- se mantiene profondità e non è a spessore passante if kbs and kbs > 1 then EgtSetInfo( nNewEnt, 'KeepBackSet', 'x') -- setto 'x' provvisoriamente end if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( nNewEnt, 'ProbeSide', '1') end end end end elseif sTypeInfo and string.lower(sTypeInfo) == 'keyway' or string.lower(sTypeInfo) == 'secure' then -- controllo che lo spessore non supera quello della porta, se lo supera lo setto = spessore porta local dTh = EgtCurveThickness( nNewEnt) if abs(dTh) > DGD.dT then EgtModifyCurveThickness( nNewEnt, EgtIf( dTh > 0, DGD.dT, -DGD.dT)) elseif abs(dTh) < DGD.dT then -- se mantiene profondità e non è a spessore passante if kbs and kbs > 1 then EgtSetInfo( nNewEnt, 'KeepBackSet', 'x') -- setto 'x' provvisoriamente end if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( nNewEnt, 'ProbeSide', '1') end end end EgtRelocateGlob( nNewEnt, Lg) -- riloco nel layer della serratura nNewEnt = EgtGetFirstInGroup(nNewLayer) end nNewLayer = EgtGetNext(nNewLayer) end -- cancello il nuovo pezzo EgtErase(nNewPart) end end -- Costruzione della geometria Keyway -- se dimensioni foro serratura idonee if D3 and T3 and LSU then if D3 > 0 and T3 ~= 0 then if not Lg then Lg = EgtGroup(Pz,GDB_RT.LOC) EgtSetName(Lg,sCompoName) end if not P3 then P3 = 0 end hint_13 = EgtCircle( Lg, Point3d(P3,0,0), D3/2 , GDB_RT.LOC) EgtModifyCurveThickness(hint_13, -T3) EgtSetName(hint_13,LSU) EgtSetInfo(hint_13,'SideDoor','Keyway') -- setto una nota per indicare su che lato della porta deve essere spostato if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_13, 'ProbeSide', '1') end end end -- se dimensioni foro maniglia idonee Keyway if D4 and T4 and HHU then if D4 > 0 and T4 ~= 0 then if not Lg then Lg = EgtGroup(Pz,GDB_RT.LOC) EgtSetName(Lg,sCompoName) end if not P4 then P4 = 0 end hint_13 = EgtCircle( Lg, Point3d(P4,0,0), D4/2 , GDB_RT.LOC) EgtModifyCurveThickness(hint_13, -T4) EgtSetName(hint_13,HHU) EgtSetInfo(hint_13,'SideDoor','Keyway') -- setto una nota per indicare su che lato della porta deve essere spostato if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_13, 'ProbeSide', '1') end end end if ms then -- se devo fare le viti Keyway if not P4 then P4 = 0 end if D5 and T5 and SCU then -- se dimensioni foro vite idonee if D5 > 0 and T5 ~= 0 then if not Lg then Lg = EgtGroup(Pz,GDB_RT.LOC) EgtSetName(Lg,sCompoName) end if not I5 then I5 = D4 end hint_12 = EgtCircle( Lg, Point3d((P4-((I5/2) * sin(AV))),((I5/2) * cos(AV)),0), D5/2 , GDB_RT.LOC) hint_13 = EgtCircle( Lg, Point3d((P4+((I5/2) * sin(AV))),-((I5/2) * cos(AV)),0), D5/2 , GDB_RT.LOC) EgtModifyCurveThickness(hint_12, -T5) EgtModifyCurveThickness(hint_13, -T5) EgtSetName(hint_12,SCU) EgtSetName(hint_13,SCU) EgtSetInfo(hint_12,'SideDoor','Keyway') -- setto una nota per indicare su che lato della porta deve essere spostato EgtSetInfo(hint_13,'SideDoor','Keyway') -- setto una nota per indicare su che lato della porta deve essere spostato if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_12, 'ProbeSide', '1') EgtSetInfo( hint_13, 'ProbeSide', '1') end if mc then -- se fori vite a croce hint_12 = EgtCircle( Lg, Point3d((P4-((I5/2) * sin(AV+90))),((I5/2) * cos(AV+90)),0), D5/2 , GDB_RT.LOC) hint_13 = EgtCircle( Lg, Point3d((P4+((I5/2) * sin(AV+90))),-((I5/2) * cos(AV+90)),0), D5/2 , GDB_RT.LOC) EgtModifyCurveThickness(hint_12, -T5) EgtModifyCurveThickness(hint_13, -T5) EgtSetName(hint_12,SCU) EgtSetName(hint_13,SCU) EgtSetInfo(hint_12,'SideDoor','Keyway') -- setto una nota per indicare su che lato della porta deve essere spostato EgtSetInfo(hint_13,'SideDoor','Keyway') -- setto una nota per indicare su che lato della porta deve essere spostato if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_12, 'ProbeSide', '1') EgtSetInfo( hint_13, 'ProbeSide', '1') end end end end end local mis10 local AP10 local TA10 local ss10 local SLD10 -- Extra bores Keyway for k = 1, 10 do local D10 = tExtraBore[k][1] local T10 = tExtraBore[k][2] local PX10 = tExtraBore[k][3] or 0 local PY10 = tExtraBore[k][4] or 0 local EB10 = tExtraBore[k][5] local RBS10 = tExtraBore[k][6] if k == 1 then mis10 = tExtraBore[k][7] AP10 = tExtraBore[k][8] TA10 = tExtraBore[k][9] ss10 = tExtraBore[k][10] SLD10 = tExtraBore[k][11] end -- se dimensioni foro serratura idonee if D10 and T10 and EB10 then if D10 > 0 and T10 ~= 0 and EB10 ~= '' then if not Lg then Lg = EgtGroup(Pz,GDB_RT.LOC) EgtSetName(Lg,sCompoName) end hint_13 = EgtCircle( Lg, Point3d(PX10,PY10,0), D10/2, GDB_RT.LOC) EgtModifyCurveThickness(hint_13, -T10) EgtSetName(hint_13,EB10) EgtSetInfo(hint_13,'SideDoor','Keyway') -- setto una nota per indicare su che lato della porta deve essere spostato EgtSetInfo(hint_13,'ReferHw',RBS10) -- setto la nota che indica a cosa è riferita, false: per backset true: per door side if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_13, 'ProbeSide', '1') end end end if k == 1 and mis10 and AP10 and TA10 and ss10 and SLD10 then if ss10 > 0 and SLD10 ~= '' and hint_13 then hint_13 = MakeSlidePath ( Lg, PX10, PY10, D10, AP10, TA10, ss10) if hint_13 then EgtModifyCurveThickness(hint_13, 0) EgtSetName(hint_13,SLD10) EgtSetInfo(hint_13,'SideDoor','Keyway') -- setto una nota per indicare su che lato della porta deve essere spostato EgtSetInfo(hint_13,'ReferHw',RBS10) -- setto la nota che indica a cosa è riferita, false: per backset true: per door side if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_13, 'ProbeSide', '1') end end end end end -- Extra rectangles Keyway for k = 1, 5 do local LR10 = tExtraRect[k][1] local WR10 = tExtraRect[k][2] local RR10 = tExtraRect[k][3] local TR10 = tExtraRect[k][4] local PRX10 = tExtraRect[k][5] or 0 local PRY10 = tExtraRect[k][6] or 0 local AR10 = tExtraRect[k][7] local ER10 = tExtraRect[k][8] local RRS10 = tExtraRect[k][9] local TPG10 = tExtraRect[k][10] -- se parametri esistenti e dimensioni rettangolo idonee if LR10 and WR10 and TR10 and ER10 then if LR10 > 0 and WR10 > 0 and TR10 ~= 0 and ER10 ~= '' and (2*RR10) < LR10 and (2*RR10) < WR10 then if not Lg then Lg = EgtGroup(Pz,GDB_RT.LOC) EgtSetName(Lg,sCompoName) end if AR10 and abs(AR10) >= 360 then while abs(AR10) >= 360 do AR10 = AR10 + EgtIf( AR10 > 0, -360, 360) end end hint_13 = MakeRectWithFillet( Lg, Point3d((PRX10-(LR10/2)),(PRY10-(WR10/2)),0), Point3d((PRX10+(LR10/2)),(PRY10+(WR10/2)),0), RR10, AR10, (LR10 > WR10), est) if hint_13 then EgtModifyCurveThickness(hint_13, -TR10) EgtSetName(hint_13,ER10) EgtSetInfo(hint_13,'SideDoor','Keyway') -- setto una nota per indicare su che lato della porta deve essere spostato EgtSetInfo(hint_13,'ReferHw',RRS10) -- setto la nota che indica a cosa è riferita, false: per backset true: per door side -- se rettangolo sborda faccio antischeggia if nDrawMach > 0 and ( ( EAR and (( das and das > 0) or ( das2 and das2 > 0))) or ( TPG10 and TPG10 > 0)) then -- creo percorso anti-scheggia se rettangolo sborda hint_14, hint_15, hint_10, hint_11 = MakeAspOnStrikeRect( Lg, hint_13, LR10, WR10, TR10, DGD.dT, PRX10, PRY10, RRS10, DGD.BACK_SET, das, nil, nil, das2, SL, 'keyway', TPG10) if hint_14 then EgtSetName( hint_14, ASG) EgtSetInfo( hint_14, 'NotCheckDir', '1') EgtSetInfo( hint_14, 'SideDoor', 'Keyway') -- setto una nota per indicare su che lato della porta deve essere spostato EgtSetInfo( hint_14, 'ReferHw', RRS10) -- setto la nota che indica a cosa è riferita, false: per backset true: per door side if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_14, 'ProbeSide', '1') end end if hint_15 then EgtSetName( hint_15, ASG) EgtSetInfo( hint_15, 'NotCheckDir', '1') EgtSetInfo( hint_15, 'SideDoor', 'Keyway') -- setto una nota per indicare su che lato della porta deve essere spostato EgtSetInfo( hint_15, 'ReferHw', RRS10) -- setto la nota che indica a cosa è riferita, false: per backset true: per door side if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_15, 'ProbeSide', '1') end end if hint_10 then EgtSetName( hint_10, ASGR) EgtSetInfo( hint_10, 'NotCheckDir', '1') EgtSetInfo( hint_10, 'SideDoor', 'Keyway') -- setto una nota per indicare su che lato della porta deve essere spostato EgtSetInfo( hint_10, 'ReferHw', RRS10) -- setto la nota che indica a cosa è riferita, false: per backset true: per door side if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_10, 'ProbeSide', '1') end end if hint_11 then EgtSetName( hint_11, ASGR) EgtSetInfo( hint_11, 'NotCheckDir', '1') EgtSetInfo( hint_11, 'SideDoor', 'Keyway') -- setto una nota per indicare su che lato della porta deve essere spostato EgtSetInfo( hint_11, 'ReferHw', RRS10) -- setto la nota che indica a cosa è riferita, false: per backset true: per door side if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_11, 'ProbeSide', '1') end end end -- setto nota per correzione profondità con probe -- se mantiene profondità e non è a spessore passante if kbs and kbs > 1 and TR10 < DGD.dT then EgtSetInfo( hint_13, 'KeepBackSet', 'x') -- setto 'x' perché non si sa ancora da quale parte viene applicato end if pbs and pbs > 1 and TR10 < DGD.dT and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_13, 'ProbeSide', '1') end end end end end -- Extra lines Keyway for k = 1, 5 do local LL10 = tExtraLine[k][1] local TL10 = tExtraLine[k][2] local PLX10 = tExtraLine[k][3] or 0 local PLY10 = tExtraLine[k][4] or 0 local AL10 = tExtraLine[k][5] local EL10 = tExtraLine[k][6] local RLS10 = tExtraLine[k][7] -- se parametri esistenti e dimensioni linea idonee if LL10 and TL10 and EL10 then if LL10 > 0 and TL10 ~= 0 and EL10 ~= '' and AL10 < 360 and AL10 > -360 then if not Lg then Lg = EgtGroup(Pz,GDB_RT.LOC) EgtSetName(Lg,sCompoName) end if AL10 and abs(AL10) >= 360 then while abs(AL10) >= 360 do AL10 = AL10 + EgtIf( AL10 > 0, -360, 360) end end hint_13 = EgtLinePDL( Lg, Point3d( PLX10,PLY10,0), AL10, LL10, GDB_RT.LOC) EgtModifyCurveThickness(hint_13, -TL10) EgtSetName(hint_13,EL10) EgtSetInfo(hint_13,'SideDoor','Keyway') -- setto una nota per indicare su che lato della porta deve essere spostato EgtSetInfo(hint_13,'ReferHw',RLS10) -- setto la nota che indica a cosa è riferita, false: per backset true: per door side -- setto nota per correzione profondità con probe -- se mantiene profondità e non è a spessore passante if kbs and kbs > 1 and TL10 < DGD.dT then EgtSetInfo( hint_13, 'KeepBackSet', 'x') -- setto 'x' perché non si sa ancora da quale parte viene applicato end if pbs and pbs > 1 and TL10 < DGD.dT and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_13, 'ProbeSide', '1') end end end end -- Costruzione della geometria SECURE -- se dimensioni foro serratura idonee if D6 and T6 and LSD then if D6 > 0 and T6 ~= 0 then if not Lg then Lg = EgtGroup(Pz,GDB_RT.LOC) EgtSetName(Lg,sCompoName) end if not P6 then P6 = 0 end hint_13 = EgtCircle( Lg, Point3d(P6,0,0), D6/2 , GDB_RT.LOC) EgtModifyCurveThickness(hint_13, -T6) EgtSetName(hint_13,LSD) EgtSetInfo(hint_13,'SideDoor','Secure') -- setto una nota per indicare su che lato della porta deve essere spostato if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_13, 'ProbeSide', '1') end end end -- se dimensioni foro maniglia idonee if D7 and T7 and HHD then if D7 > 0 and T7 ~= 0 then if not Lg then Lg = EgtGroup(Pz,GDB_RT.LOC) EgtSetName(Lg,sCompoName) end if not P7 then P7 = 0 end hint_13 = EgtCircle( Lg, Point3d(P7,0,0), D7/2 , GDB_RT.LOC) EgtModifyCurveThickness(hint_13, -T7) EgtSetName(hint_13,HHD) EgtSetInfo(hint_13,'SideDoor','Secure') -- setto una nota per indicare su che lato della porta deve essere spostato if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_13, 'ProbeSide', '1') end end end if msd then -- se devo fare le viti lato secure if not P7 then P7 = 0 end -- se dimensioni foro vite idonee if D8 and T8 and SCD then if D8 > 0 and T8 ~= 0 then if not Lg then Lg = EgtGroup(Pz,GDB_RT.LOC) -- layer del foro serratura SECURE EgtSetName(Lg,sCompoName) end if not I8 then I8 = D7 end hint_12 = EgtCircle( Lg, Point3d((P7-((I8/2) * sin(AVd))),((I8/2) * cos(AVd)),0), D8/2 , GDB_RT.LOC) hint_13 = EgtCircle( Lg, Point3d((P7+((I8/2) * sin(AVd))),-((I8/2) * cos(AVd)),0), D8/2 , GDB_RT.LOC) EgtModifyCurveThickness(hint_12, -T8) EgtModifyCurveThickness(hint_13, -T8) EgtSetName(hint_12,SCD) EgtSetName(hint_13,SCD) EgtSetInfo(hint_12,'SideDoor','Secure') -- setto una nota per indicare su che lato della porta deve essere spostato EgtSetInfo(hint_13,'SideDoor','Secure') -- setto una nota per indicare su che lato della porta deve essere spostato if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_12, 'ProbeSide', '1') EgtSetInfo( hint_13, 'ProbeSide', '1') end if mcd then -- se fori vite a croce hint_12 = EgtCircle( Lg, Point3d((P7-((I8/2) * sin(AVd+90))),((I8/2) * cos(AVd-90)),0), D8/2 , GDB_RT.LOC) hint_13 = EgtCircle( Lg, Point3d((P7+((I8/2) * sin(AVd+90))),-((I8/2) * cos(AVd-90)),0), D8/2 , GDB_RT.LOC) EgtModifyCurveThickness(hint_12, -T8) EgtModifyCurveThickness(hint_13, -T8) EgtSetName(hint_12,SCD) EgtSetName(hint_13,SCD) EgtSetInfo(hint_12,'SideDoor','Secure') -- setto una nota per indicare su che lato della porta deve essere spostato EgtSetInfo(hint_13,'SideDoor','Secure') -- setto una nota per indicare su che lato della porta deve essere spostato if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_12, 'ProbeSide', '1') EgtSetInfo( hint_13, 'ProbeSide', '1') end end end end end mis10 = nil AP10 = nil TA10 = nil ss10 = nil SLD10 = nil -- Extra bores Secure for k = 11, 20 do local D10 = tExtraBore[k][1] local T10 = tExtraBore[k][2] local PX10 = tExtraBore[k][3] or 0 local PY10 = tExtraBore[k][4] or 0 local EB10 = tExtraBore[k][5] local RBS10 = tExtraBore[k][6] if k == 11 then mis10 = tExtraBore[k][7] AP10 = tExtraBore[k][8] TA10 = tExtraBore[k][9] ss10 = tExtraBore[k][10] SLD10 = tExtraBore[k][11] end -- se dimensioni foro serratura idonee if D10 and T10 and EB10 then if D10 > 0 and T10 ~= 0 and EB10 ~= '' then if not Lg then Lg = EgtGroup(Pz,GDB_RT.LOC) EgtSetName(Lg,sCompoName) end hint_13 = EgtCircle( Lg, Point3d(PX10,-PY10,0), D10/2 , GDB_RT.LOC) EgtModifyCurveThickness(hint_13, -T10) EgtSetName(hint_13,EB10) EgtSetInfo(hint_13,'SideDoor','Secure') -- setto una nota per indicare su che lato della porta deve essere spostato EgtSetInfo(hint_13,'ReferHw',RBS10) -- setto la nota che indica a cosa è riferita, false: per backset true: per door side if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_13, 'ProbeSide', '1') end end end if k == 11 and mis10 and AP10 and TA10 and ss10 and SLD10 then if ss10 > 0 and SLD10 ~= '' and hint_13 then hint_13 = MakeSlidePath ( Lg, PX10, -PY10, D10, -AP10, TA10, ss10) if hint_13 then EgtModifyCurveThickness(hint_13, 0) EgtSetName(hint_13,SLD10) EgtSetInfo(hint_13,'SideDoor','Secure') -- setto una nota per indicare su che lato della porta deve essere spostato EgtSetInfo(hint_13,'ReferHw',RBS10) -- setto la nota che indica a cosa è riferita, false: per backset true: per door side if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_13, 'ProbeSide', '1') end end end end end -- Extra rectangles Secure for k = 6, 10 do local LR10 = tExtraRect[k][1] local WR10 = tExtraRect[k][2] local RR10 = tExtraRect[k][3] local TR10 = tExtraRect[k][4] local PRX10 = tExtraRect[k][5] or 0 local PRY10 = tExtraRect[k][6] or 0 local AR10 = tExtraRect[k][7] local ER10 = tExtraRect[k][8] local RRS10 = tExtraRect[k][9] local TPG10 = tExtraRect[k][10] -- se dimensioni rettangolo idonee if LR10 and WR10 and TR10 and ER10 then if LR10 > 0 and WR10 > 0 and TR10 ~= 0 and ER10 ~= '' and (2*RR10) < LR10 and (2*RR10) < WR10 then if not Lg then Lg = EgtGroup(Pz,GDB_RT.LOC) EgtSetName(Lg,sCompoName) end if AR10 and abs(AR10) >= 360 then while abs(AR10) >= 360 do AR10 = AR10 + EgtIf( AR10 > 0, -360, 360) end end hint_13 = MakeRectWithFillet( Lg, Point3d((PRX10-(LR10/2)),(-PRY10-(WR10/2)),0), Point3d((PRX10+(LR10/2)),(-PRY10+(WR10/2)),0), RR10, AR10, (LR10 > WR10), est) if hint_13 then EgtModifyCurveThickness( hint_13, -TR10) EgtSetName( hint_13, ER10) EgtSetInfo( hint_13, 'SideDoor', 'Secure') -- setto una nota per indicare su che lato della porta deve essere spostato EgtSetInfo( hint_13, 'ReferHw', RRS10) -- setto la nota che indica a cosa è riferita, false: per backset true: per door side -- se rettangolo sborda faccio antischeggia if nDrawMach > 0 and ( ( EAR and (( das and das > 0) or ( das2 and das2 > 0))) or ( TPG10 and TPG10 > 0)) then -- creo percorso anti-scheggia se rettangolo sborda hint_14, hint_15, hint_10, hint_11 = MakeAspOnStrikeRect( Lg, hint_13, LR10, WR10, TR10, DGD.dT, PRX10, PRY10, RRS10, DGD.BACK_SET, das, true, nil, das2, SL, 'secure', TPG10) if hint_14 then EgtSetName( hint_14, ASG) EgtSetInfo( hint_14, 'NotCheckDir', '1') EgtSetInfo( hint_14, 'SideDoor', 'Secure') -- setto una nota per indicare su che lato della porta deve essere spostato EgtSetInfo( hint_14, 'ReferHw', RRS10) -- setto la nota che indica a cosa è riferita, false: per backset true: per door side if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_14, 'ProbeSide', '1') end end if hint_15 then EgtSetName( hint_15, ASG) EgtSetInfo( hint_15, 'NotCheckDir', '1') EgtSetInfo( hint_15, 'SideDoor', 'Secure') -- setto una nota per indicare su che lato della porta deve essere spostato EgtSetInfo( hint_15, 'ReferHw', RRS10) -- setto la nota che indica a cosa è riferita, false: per backset true: per door side if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_15, 'ProbeSide', '1') end end if hint_10 then EgtSetName( hint_10, ASGR) EgtSetInfo( hint_10, 'NotCheckDir', '1') EgtSetInfo( hint_10, 'SideDoor', 'Secure') -- setto una nota per indicare su che lato della porta deve essere spostato EgtSetInfo( hint_10, 'ReferHw', RRS10) -- setto la nota che indica a cosa è riferita, false: per backset true: per door side if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_10, 'ProbeSide', '1') end end if hint_11 then EgtSetName( hint_11, ASGR) EgtSetInfo( hint_11, 'NotCheckDir', '1') EgtSetInfo( hint_11, 'SideDoor', 'Secure') -- setto una nota per indicare su che lato della porta deve essere spostato EgtSetInfo( hint_11, 'ReferHw', RRS10) -- setto la nota che indica a cosa è riferita, false: per backset true: per door side if pbs and pbs > 1 and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_11, 'ProbeSide', '1') end end end -- setto nota per correzione profondità con probe -- se mantiene profondità e non è a spessore passante if kbs and kbs > 1 and TR10 < DGD.dT then EgtSetInfo( hint_13, 'KeepBackSet', 'x') -- setto 'x' perché non si sa ancora da quale parte viene applicato end if pbs and pbs > 1 and TR10 < DGD.dT and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_13, 'ProbeSide', '1') end end end end end -- Extra lines Secure for k = 6, 10 do local LL10 = tExtraLine[k][1] local TL10 = tExtraLine[k][2] local PLX10 = tExtraLine[k][3] or 0 local PLY10 = tExtraLine[k][4] or 0 local AL10 = tExtraLine[k][5] local EL10 = tExtraLine[k][6] local RLS10 = tExtraLine[k][7] -- se parametri esistenti e dimensioni linea idonee if LL10 and TL10 and EL10 then if LL10 > 0 and TL10 ~= 0 and EL10 ~= '' and AL10 < 360 and AL10 > -360 then if not Lg then Lg = EgtGroup(Pz,GDB_RT.LOC) EgtSetName(Lg,sCompoName) end if AL10 and abs(AL10) >= 360 then while abs(AL10) >= 360 do AL10 = AL10 + EgtIf( AL10 > 0, -360, 360) end end hint_13 = EgtLinePDL( Lg, Point3d( PLX10,-PLY10,0), AL10, LL10, GDB_RT.LOC) EgtModifyCurveThickness(hint_13, -TL10) EgtSetName(hint_13,EL10) EgtSetInfo(hint_13,'SideDoor','Secure') -- setto una nota per indicare su che lato della porta deve essere spostato EgtSetInfo(hint_13,'ReferHw',RLS10) -- setto la nota che indica a cosa è riferita, false: per backset true: per door side -- setto nota per correzione profondità con probe -- se mantiene profondità e non è a spessore passante if kbs and kbs > 1 and TL10 < DGD.dT then EgtSetInfo( hint_13, 'KeepBackSet', 'x') -- setto 'x' perché non si sa ancora da quale parte viene applicato end if pbs and pbs > 1 and TL10 < DGD.dT and DGC.Pms and DGC.Pms > 2 then EgtSetInfo( hint_13, 'ProbeSide', '1') 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 ( SL == 'R' and DGD.Push) or ( SL == 'L' and not 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 = 'Lock' else sSideDoorInfo = EgtIf( dl, 'Lock', 'Side') 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 dws then -- se frame viene disposto sul lato wide local nIdSideBoxUp if hint then nIdSideBoxUp = EgtCopyGlob( hint, Lg) EgtSetName( nIdSideBoxUp, 'upper') EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper') end if hint_1 then nIdSideBoxUp = EgtCopyGlob( hint_1, Lg) EgtSetName( nIdSideBoxUp, 'upper') EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper') end if hint_2 then nIdSideBoxUp = EgtCopyGlob( hint_2, Lg) EgtSetName( nIdSideBoxUp, 'upper') EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper') end if #thint_3 > 0 then for i = 1, #thint_3 do local hint_3 = thint_3[i] nIdSideBoxUp = EgtCopyGlob( hint_3, Lg) EgtSetName( nIdSideBoxUp, 'upper') EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper') end end if #thint_4 > 0 then for i = 1, #thint_4 do local hint_4 = thint_4[i] nIdSideBoxUp = EgtCopyGlob( hint_4, Lg) EgtSetName( nIdSideBoxUp, 'upper') EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper') end end if #thint_5 > 0 then for i = 1, #thint_5 do local hint_5 = thint_5[i] nIdSideBoxUp = EgtCopyGlob( hint_5, Lg) EgtSetName( nIdSideBoxUp, 'upper') EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper') end end if #thint_6 > 0 then for i = 1, #thint_6 do local hint_6 = thint_6[i] nIdSideBoxUp = EgtCopyGlob( hint_6, Lg) EgtSetName( nIdSideBoxUp, 'upper') EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper') end end if hint_7 then nIdSideBoxUp = EgtCopyGlob( hint_7, Lg) EgtSetName( nIdSideBoxUp, 'upper') EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper') end if hint_8 then nIdSideBoxUp = EgtCopyGlob( hint_8, Lg) EgtSetName( nIdSideBoxUp, 'upper') EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper') end if hint_9 then nIdSideBoxUp = EgtCopyGlob( hint_9, Lg) EgtSetName( nIdSideBoxUp, 'upper') EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper') end end end if EC == 0 and D_XE and D_XE ~= 0 then EgtMove( Lg, Point3d(0,D_XE,0) - ORIG()) end -- cambio colore alla geometria 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' ,'LockMortiseCyl') EgtSetInfo( Lg, 'Nome' ,sCompoName) EgtSetInfo( Lg, 'L' ,L) EgtSetInfo( Lg, 'H' ,H) EgtSetInfo( Lg, 'T' ,T) EgtSetInfo( Lg, 'cl' ,cl) EgtSetInfo( Lg, 'rf' ,rf) EgtSetInfo( Lg, 'd' ,d) EgtSetInfo( Lg, 'p' ,p) EgtSetInfo( Lg, 'sf' ,sf) EgtSetInfo( Lg, 'dl' ,dl) EgtSetInfo( Lg, 'ech' ,ech) EgtSetInfo( Lg, 'clc' ,clc) EgtSetInfo( Lg, 'ccr' ,ccr) EgtSetInfo( Lg, 'mh' ,mh) EgtSetInfo( Lg, 'mh2' ,mh2) EgtSetInfo( Lg, 'L2' ,L2) EgtSetInfo( Lg, 'H2' ,H2) EgtSetInfo( Lg, 'T2' ,T2) EgtSetInfo( Lg, 'HB2' ,HB2) EgtSetInfo( Lg, 'TB2' ,TB2) EgtSetInfo( Lg, 'HB2_2' ,HB2_2) EgtSetInfo( Lg, 'TB2_2' ,TB2_2) EgtSetInfo( Lg, 'd2' ,d2) EgtSetInfo( Lg, 'p2' ,p2) EgtSetInfo( Lg, 's' ,s) EgtSetInfo( Lg, 'FBD' ,FBD) EgtSetInfo( Lg, 'FBP' ,FBP) EgtSetInfo( Lg, 'AB' ,AB) EgtSetInfo( Lg, 'FBD2' ,FBD2) EgtSetInfo( Lg, 'FBP2' ,FBP2) EgtSetInfo( Lg, 'AB2' ,AB2) EgtSetInfo( Lg, 'posh' ,posh) EgtSetInfo( Lg, 'posp' ,posp) EgtSetInfo( Lg, 'est' ,est) EgtSetInfo( Lg, 'kbs' ,kbs) EgtSetInfo( Lg, 'pbs' ,pbs) EgtSetInfo( Lg, 'invG' ,invG) EgtSetInfo( Lg, 'jn' ,jn) EgtSetInfo( Lg, 'jnb' ,jnb) EgtSetInfo( Lg, 'dws' ,dws) EgtSetInfo( Lg, 'dthd' ,dthd) EgtSetInfo( Lg, 'SL' ,SL) EgtSetInfo( Lg, 'D_X' ,D_X) EgtSetInfo( Lg, 'DH_X' ,DH_X) EgtSetInfo( Lg, 'D_XE' ,D_XE) EgtSetInfo( Lg, 'DH_X2' ,DH_X2) EgtSetInfo(Lg,'CustGeomFile' ,CustGeomFile) EgtSetInfo(Lg,'CustGeomPath' ,CustGeomPath) EgtSetInfo(Lg,'D3' ,D3) EgtSetInfo(Lg,'T3' ,T3) EgtSetInfo(Lg,'P3' ,P3) EgtSetInfo(Lg,'D4' ,D4) EgtSetInfo(Lg,'T4' ,T4) EgtSetInfo(Lg,'P4' ,P4) EgtSetInfo(Lg,'ms' ,ms) EgtSetInfo(Lg,'D5' ,D5) EgtSetInfo(Lg,'T5' ,T5) EgtSetInfo(Lg,'I5' ,I5) EgtSetInfo(Lg,'AV' ,AV) EgtSetInfo(Lg,'mc' ,mc) EgtSetInfo(Lg,'D6' ,D6) EgtSetInfo(Lg,'T6' ,T6) EgtSetInfo(Lg,'P6' ,P6) EgtSetInfo(Lg,'D7' ,D7) EgtSetInfo(Lg,'T7' ,T7) EgtSetInfo(Lg,'P7' ,P7) EgtSetInfo(Lg,'msd' ,msd) EgtSetInfo(Lg,'D8' ,D8) EgtSetInfo(Lg,'T8' ,T8) EgtSetInfo(Lg,'I8' ,I8) EgtSetInfo(Lg,'AVd' ,AVd) EgtSetInfo(Lg,'mcd' ,mcd) EgtSetInfo(Lg,'LG' ,LG) EgtSetInfo(Lg,'LG2' ,LG2) EgtSetInfo(Lg,'LM' ,LM) EgtSetInfo(Lg,'LA' ,LA) EgtSetInfo(Lg,'LSU' ,LSU) EgtSetInfo(Lg,'HHU' ,HHU) EgtSetInfo(Lg,'SCU' ,SCU) EgtSetInfo(Lg,'LSD' ,LSD) EgtSetInfo(Lg,'HHD' ,HHD) EgtSetInfo(Lg,'SCD' ,SCD) EgtSetInfo(Lg,'CH' ,CH) EgtSetInfo(Lg,'HD' ,HD) EgtSetInfo(Lg,'CLC' ,CLC) EgtSetInfo(Lg,'LGH' ,LGH) EgtSetInfo(Lg,'LMP' ,LMP) EgtSetInfo(Lg,'LGH2' ,LGH2) EgtSetInfo(Lg,'LMP2' ,LMP2) EgtSetInfo(Lg,'EAR' ,EAR) EgtSetInfo(Lg,'das' ,das) EgtSetInfo(Lg,'ASG' ,ASG) EgtSetInfo(Lg,'das2' ,das2) EgtSetInfo(Lg,'ASGR' ,ASGR) EgtSetInfo(Lg,'Path' ,sCompoPath) end if EC == 0 and nCodAdj and nCodAdj < 0 then EC = nCodAdj EM = sCodAdj end return EC, EM, Lg end return LockMortiseCyl