Files
Dario Sassi cc55202ec5 DataDoors 2.7c1 :
- primo commit con versione corrente.
2025-03-18 17:02:20 +01:00

3747 lines
163 KiB
Lua

--
-- 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
--
-- Strike.lua by EgalWare s.r.l. 2016.06.14
-- Autore: Filippo Monchi
-- edge pull tipo mortise o cilindrica
-- 2016.09.21 V1.011 FM add warning messages
-- 2017.08.30 V1.012 FM Add flag for not rotate Face on bevel profile
-- 2018.04.05 V1.013 FM Manage info (KeepBackSet) for adjust probe on Z
-- 2018.10.17 V1.014 FM Add parameter to show into message 402
-- 2018.10.22 V1.015 FM Manage better the big radius fillet parameter
-- 2018.10.22 V1.015 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
-- 2019.05.23 V1.01a FM Manage anti-splint path on strike extra rectangle geometry
-- 2019.09.30 V1.01b FM Manage anti-splint path on anti-splint path
-- 2019.10.10 V1.01c FM Manage steel option (disable to generate pocket paths, mortise, make closed and extend face path)
-- 2019.10.18 V2.000 FM Manage use Materials
-- 2019.10.29 V2.001 FM Add clean corner geometries
-- 2019.12.16 V2.002 FM Fix error on 2nd mortise (not assign tool diameter in case join is false)
-- 2019.12.18 V2.003 FM Use new parameter DGC.Eah that allow insert template also on bullnose ans convex profiles
-- 2019.12.20 V2.004 FM fix a bug on clean corner direction path in case main path turn reverse
-- 2020.04.29 V2.005 FM Update for aluminum material
-- 2020.05.25 V2.006 FM Manage geometries for calculate region when frame(jamb) is disposed on wide side
-- 2020.05.29 V2.007 FM Manage geometries for calculate region when frame(jamb) is disposed on narrow side
-- 2020.06.24 V2.008 FM Add new line of mounting screw bores
-- 2020.07.01 V2.009 FM Disable Warning message on frames if parameter DGD.Spd is <= 0
-- 2021.01.22 V3.000 FM Manage better checking error on tools and dimension when produce flag is false
-- 2021.02.22 V3.001 FM fix error on check DGD.SIDE (not yet used on strike)
-- 2021.03.12 V3.002 FM Check and adjust the angle parameter on extra rectangle and extra lines
-- 2021.05.11 V3.003 FM fix error on assign name to join paths
-- 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.07.19 V3.007 FM Set note 'NotCheckDir' to pocketing and antisplint paths
-- 2024.10.04 V3.008 FM Manage probe geometry and their offset position when template is disposed on lock side
-- 2024.10.29 V3.009 FM Manage new DGC.Fpd CurrDoorCustomData variable to force shuttle probe geometry to stay horizontal
-- Tavola per definizione modulo (serve ma non usata)
local Strike = {}
-- 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)
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)
-- creo curvecompo
pStartIni = EgtMP( nNewId)
hint_3 = EgtCurveCompo( Lg, { nNewId, tIdFil[1], (nNewId+1), tIdFil[2], (nNewId+2), tIdFil[3], (nNewId+3), tIdFil[4]}, true)
else
-- creo curvecompo
pStartIni = EgtMP( nNewId)
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 MakeAspOnStrikeRect( Lg, nHint, dX, dY, dThick,
dDoorTh, dShiftX, dShiftY, bRefSide, dBack_set,
dDiam, bOpposite, dZedPos, dDiam2, sSideLock,
Fc)
local nLine
local ptIni, ptEnd, pInt1, pInt1, ptIni2, ptEnd2
local tPath = {}
local nPath1, nPath2, nPath3, nPath4
local nInv = 1
if not dBack_set then dBack_set = 0 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, (dDiam/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 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
--debug
-- EgtSaveFile( sNgeFile)
-- EgtMove(DGD.PZ, Point3d(0,0,nil) - ORIG())
-- 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 SetProbeProperty( kbs, nValKbsPbs, pbs, sValKbs, nIdGeom, bOtherCondition, nVal1, nVal2)
if not bOtherCondition then
if kbs and kbs > nValKbsPbs then
EgtSetInfo( nIdGeom, 'KeepBackSet', sValKbs)
end
if pbs and pbs > nValKbsPbs and DGC.Pms and DGC.Pms > 2 then
EgtSetInfo( nIdGeom, 'ProbeSide', '1')
end
else
if kbs and kbs > nValKbsPbs and nVal1 < nVal2 then
EgtSetInfo( nIdGeom, 'KeepBackSet', sValKbs)
end
if pbs and pbs > nValKbsPbs and nVal1 < nVal2 and DGC.Pms and DGC.Pms > 2 then
EgtSetInfo( nIdGeom, 'ProbeSide', '1')
end
end
end
local function SetPropertyAndMoveGeom( sSide, kbs, pbs, sValKbs, nPosMove, nIdGeom)
if nIdGeom then
EgtSetInfo(nIdGeom,'SideDoor',sSide)
-- se mantiene centro spessore anche su face
if kbs and kbs > 0 then
EgtSetInfo( nIdGeom, 'KeepBackSet', sValKbs)
end
if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then
EgtSetInfo( nIdGeom, 'ProbeSide', '1')
end
if abs(nPosMove) > GEO.EPS_SMALL then
EgtMove( nIdGeom, Point3d(nPosMove,0,0) - ORIG())
end
end
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 Strike.AdjustParams( tMhPar)
tMhPar.invG = 1
local EgtDoorsMsg = require( 'EgtDoorsMsg')
local dMaxMat0 -- per face chisel
local dMaxMat1 -- per face machining
local dMaxMata -- per anti splint machining
local dMaxMat2 -- per 1st mortise machining o foro profondo
local dMaxMat3 -- per 2nd mortise machining
local dMaxMat4 -- per mounting screw
local dMaxMat7 -- per mounting screw
local dMaxMat5 -- per 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 nTempTa
local nTempT2
local nTempT3
local nTempT4
local nTempT5
local nTempT6
local nTempT7
local nTempT8
local nTempT9
local sMchngName0
local sMchngName1
local sMchngNamea
local sMchngName2
local sMchngName3
local sMchngName4
local sMchngName5
local sMchngName6
local sMchngName7
local sMchngName8
local sMchngName9
local dOffset = DGD.OFFSET or 0
tMhPar.mkrev = false
tMhPar.ls = false
tMhPar.fht = 0 -- setto il face h top a 0
tMhPar.fhb = 0 -- setto il face h bottom a 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 tMhPar.Dws then -- se disposto sul lato wide, calcolo lo spessore relativo
if DGD.nTypePz == 3 or DGD.nTypePz == 4 then
tMhPar.dThD = DGD.dW
elseif DGD.nTypePz == 5 or DGD.nTypePz == 6 then
tMhPar.dThD = DGD.dH
end
end
-- setto parametro riferimento profondità roller
tMhPar.drf = DGD.dT/6
if DGD.sFrame then -- se è un assemblato
tMhPar.drf = 0.1 -- in questo modo crea semre la regione da togliere relativa al materiale asportato
end
-- do errore se il tipo strike non è adatto per il tipo di porta ( inactive)
if not( DGD.sSwing == 'LHI' or DGD.sSwing == 'RHI' or DGD.sSwing == 'RHRI' or DGD.sSwing == 'LHRI') and not DGC.Eif then
return tMhPar, 2698, string.format(EgtDoorsMsg[458], tMhPar.Nome, DGD.sSwing)
end
-- do errore se profilo tipo bullnose e 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') then
return tMhPar, 2699, string.format(EgtDoorsMsg[431], 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' 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 DGD.Push then tMhPar.invG = -tMhPar.invG end
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à (se non devo riferirmi al wide della porta) 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 ho il parametro lo setto disattivato
if not tMhPar.ech then
tMhPar.ech = false
end
-- se non c'è la variabile suffisso
if not tMhPar.CH then
tMhPar.CH = '_Chisel'
end
-- se non ho il parametro di arrotondamento lati lo setto disabilitato
if not tMhPar.CL then
tMhPar.cl = 0
else
tMhPar.cl = 3
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 arrotondo entrambe le estremità disabilito il radius face
if tMhPar.cl == 0 then
tMhPar.rf = 0
end
if not tMhPar.rs then
tMhPar.rs = 0
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 di profondità preforo lo setto a -1
if not tMhPar.FBP then
tMhPar.FBP = -1
end
-- se non c'è il parametro di diametro preforo lo setto a 0
if not tMhPar.FBD then
tMhPar.FBD = 0
end
if tMhPar.FBP >= 0 then -- se ha un valore lo ricalcolo perche' 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)
-- se il diametro è valido e di coseguenza 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
-- se c'è il parametro delta Y delle mounting screw e la porta è a tirare, inverto il valore dell'offset
if tMhPar.PY8 then
if not DGD.Push or DGD.sFrame then
tMhPar.PY8 = - tMhPar.PY8
end
end
if tMhPar.PY9 then
if not DGD.Push or DGD.sFrame then
tMhPar.PY9 = - tMhPar.PY9
end
end
-- se non c'è il parametro angolo strike face lo setto a 0
if not tMhPar.AS then
tMhPar.AS = 0
elseif abs(tMhPar.AS) > 45 then -- se supera max angolo consentito
tMhPar.AS = 45
end
-- se non c'è il parametro interasse strike face lo setto a 0
if not tMhPar.IS then
tMhPar.IS = 0
end
-- se non c'è il parametro intersaase 1st mortise lo setto a 0
if not tMhPar.I2 then
tMhPar.I2 = 0
end
-- se non c'è il parametro intersaase 2nd mortise lo setto a 0
if not tMhPar.I3 then
tMhPar.I3 = 0
end
-- se la larghezza del dente è uguale o maggiore della lunghezza del face lo ricalcolo
if tMhPar.L and tMhPar.LS and tMhPar.LS >= tMhPar.L then
if tMhPar.LS > tMhPar.L then
tMhPar.LS = tMhPar.L
end
tMhPar.rf = 0
tMhPar.rs = 0
tMhPar.cl = 0
tMhPar.D_SS = 0
end
-- se ci sono tutti i parametri del face e non c'è la distanza di partenza
if tMhPar.L and tMhPar.H and tMhPar.LS and tMhPar.LS > 0 and not tMhPar.D_SS then
tMhPar.D_SS = (tMhPar.L - tMhPar.IS - tMhPar.LS) / 2
end
-- se ci sono tutti i parametri del face e c'è la larghezza e l'altezza dello strike face lo ricalcolo in base allo spessore porta
if tMhPar.L and tMhPar.H and tMhPar.LS and tMhPar.LS > 0 and tMhPar.HS and tMhPar.HS > 0 then
if DGD.OFFSET and DGD.OFFSET > 0 then -- se c'è l'offset wide_side
-- si considera che lo strike esce sempre dal lato wide
tMhPar.HS = DGD.OFFSET-(tMhPar.H/2)
tMhPar.ls = true
if tMhPar.HS < 0 then -- se esce negativo è perchè il wide side è troppo poco
tMhPar.HS = 0
tMhPar.ls = false
end
else -- se non c'è l'offset lo calcolo dal centro spessore
tMhPar.HS = (DGD.dT-tMhPar.H)/2
tMhPar.ls = true
if tMhPar.HS < 0 then -- se esce negativo è perchè il wide side è troppo poco
tMhPar.HS = 0
tMhPar.ls = false
end
end
else
tMhPar.HS = 0
tMhPar.ls = false
end
-- se c'è face strike ed ha bordi bevel
if tMhPar.ls then
if DGD.tProfs.lockedge.trimming == 'BD' or DGD.tProfs.lockedge.trimming == 'BU' or
DGD.tProfs.lockedge.trimming == 'BDEB' or DGD.tProfs.lockedge.trimming == 'BUEB' then
tMhPar.mkrev = true -- assegno flag per creare percorso inverso
end
end
-- 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
if DGD.SDF and DGD.SDF > 1 then
-- calcolo la posizione del centro foro sullo spessore porta
if dOffset > 0 then
tMhPar.posh = -(DGD.dT/2) + dOffset
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
-- Assegno parametri da dati utensili in macchina
local MB = require( 'MachiningBase')
local sLM -- face machining
local nLMi = 1
local sLA -- antisplint machining
local nLAi = 1
local sLA2 -- 1st mortise machining
local nLA2i = 1
local sLA3 -- 2nd mortise machining
local nLA3i = 1
local sLGH -- bore machining
local nLGHi = 1
local sLG -- face chiseling or face with other material
local nLGi = 1
local sLMS1 -- mounting screws machining
local sLMS2 -- mounting screws machining
local nLMSi = 1
local sLMP -- prebore machining
local nLMPi = 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.LA2 = nil
tMhPar.LA3 = nil
tMhPar.ech = false
tMhPar.CH = nil
tMhPar.est = true
tMhPar.da = nil
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' then -- profilo serrratura bevel up
-- se lato cerniere opposto mi troverò il bevel al contrario perchè comanda il lato cerniere
if DGD.bBothOppoBevel then
nLMi = 3
nLGi = 3
nLAi = 3
else
nLMi = 2
nLGi = 2
nLAi = 2
end
elseif DGD.tProfs.lockedge.trimming == 'BD' or DGD.tProfs.lockedge.trimming == 'BDEB' then -- profilo serrratura bevel dn
-- se lato cerniere opposto mi troverò il bevel al contrario perchè comanda il lato cerniere
if DGD.bBothOppoBevel then
nLMi = 2
nLGi = 2
nLAi = 2
else
nLMi = 3
nLGi = 3
nLAi = 3
end
end
if tMhPar.est and tMhPar.LG then -- se altro materiale
sLG = tMhPar.LG
if DGD.MachEn > 0 and tMhPar.d then nTempT0, dMaxMat0, sMchngName0 = MB.GetToolDataFromAttrib( sLG, nLGi) end
end
if tMhPar.LM then
sLM = tMhPar.LM
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.d0 = 0
if DGD.MachEn > 0 and tMhPar.d0 then nTempT0, dMaxMat0, sMchngName0 = MB.GetToolDataFromAttrib( sLG, nLGi) end
end
if tMhPar.LA then -- antischeggia
sLA = tMhPar.LA
if DGD.MachEn > 0 and tMhPar.da then nTempTa, dMaxMata, sMchngNamea = MB.GetToolDataFromAttrib( sLA, nLAi) end
end
if tMhPar.LA2 then -- prima mortasa
sLA2 = tMhPar.LA2
if DGD.MachEn > 0 and tMhPar.d2 then nTempT2, dMaxMat2, sMchngName2 = MB.GetToolDataFromAttrib( sLA2, nLA2i) end
end
if tMhPar.LA3 then -- seconda mortasa
sLA3 = tMhPar.LA3
if DGD.MachEn > 0 and tMhPar.d3 then nTempT3, dMaxMat3, sMchngName3 = MB.GetToolDataFromAttrib( sLA3, nLA3i) end
end
if tMhPar.mh and tMhPar.LGH then -- foro o foro profondo
sLGH = tMhPar.LGH
if DGD.MachEn > 0 then nTempT6, dMaxMat2, sMchngName6 = MB.GetToolDataFromAttrib( sLGH, nLGHi) end
end
-- mounting screws
if tMhPar.LMS8 then
sLMS1 = tMhPar.LMS8
if DGD.MachEn > 0 then nTempT4, dMaxMat4, sMchngName4 = MB.GetToolDataFromAttrib( sLMS1, nLMSi) end
end
if tMhPar.LMS9 then
sLMS2 = tMhPar.LMS9
if DGD.MachEn > 0 then nTempT7, dMaxMat7, sMchngName7 = MB.GetToolDataFromAttrib( sLMS2, nLMSi) end
end
-- preforo
if tMhPar.mh and tMhPar.LMP then
sLMP = tMhPar.LMP
if DGD.MachEn > 0 then nTempT5, dMaxMat5, sMchngName5 = MB.GetToolDataFromAttrib( sLMP, nLMPi) 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
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
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 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 = -2697
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 = -2690
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 anti-splint machining
if DGD.bProoduce and not tMhPar.est and tMhPar.da and nTempTa and nTempTa <= 0 then
dNumLog = -2690
sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempTa, sLA, nLAi, tMhPar.da, dNumLog, sMchngNamea)
elseif not tMhPar.est and nTempTa then
tMhPar.da = nTempTa
end
-- gestisco il risultato della lettura utensili per 1st 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 = -2690
sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT2, sLA2, nLA2i, tMhPar.d2, dNumLog, sMchngName2)
end
elseif not tMhPar.est and nTempT2 then
tMhPar.d2 = nTempT2
end
-- gestisco il risultato della lettura utensili per 2nd mortise machining
if not tMhPar.est and tMhPar.d3 and nTempT3 and nTempT3 <= 0 then
if DGD.bProoduce and not tMhPar.jn2 then -- se non si concatenano i due percorsi
dNumLog = -2690
sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT3, sLA3, nLA3i, tMhPar.d3, dNumLog, sMchngName3)
end
elseif not tMhPar.est and nTempT3 then
tMhPar.d3 = nTempT3
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 = -2690
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 = -2690
sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT9, sASGR, nASGRi, tMhPar.das2, dNumLog, sMchngName9)
elseif not tMhPar.est and nTempT9 then
tMhPar.das2 = nTempT9
end
-- se non ho parametro di lunghezza massima utensile preparo messaggio di warning per foro profondo
if DGD.bProoduce and tMhPar.mh and tMhPar.LGH and not dMaxMat2 then
dNumLog = -2689
sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT6, sLGH, nLGHi, nil, dNumLog, sMchngName6)
end
-- se non ho parametro di lunghezza massima utensile preparo messaggio di warning per preforo
if DGD.bProoduce and tMhPar.mh and tMhPar.LMP and not dMaxMat5 then
dNumLog = -2689
sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT5, sLMP, nLMPi, nil, dNumLog, sMchngName5)
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 = -2688
sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT4, sLMS1, nLMSi, nil, dNumLog, sMchngName4)
end
if DGD.bProoduce and sLMS2 and not dMaxMat7 then
dNumLog = -2688
sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT7, sLMS2, nLMSi, nil, dNumLog, sMchngName7)
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 = -2687
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 = -2698
dNumMessage = 460
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T), EgtToUiUnits(dMaxMat1))
tMhPar.T = dMaxMat1 - 0.02 -- tolgo 0.05 per permettere la lavorazione
end
-- se 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 = -2696
dNumMessage = 461
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T2), EgtToUiUnits(dMaxMat1))
tMhPar.T2 = dMaxMat1 - 0.02
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 = -2695
dNumMessage = 461
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T2), EgtToUiUnits(dMaxMat2))
tMhPar.T2 = dMaxMat2 - 0.02
end
-- se 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 = -2695
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 = -2695
dNumMessage = 463
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T2), EgtToUiUnits(dMaxMat2))
tMhPar.T2 = dMaxMat2
end
end
-- se 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 = -2695
dNumMessage = 463
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.FBP), EgtToUiUnits(dMaxMat5))
tMhPar.FBP = dMaxMat5
end
-- se la profondità dei mounting screws è maggiore della capacità utensile limito la profondità ed emetto un warning
if tMhPar.T8 and dMaxMat4 and tMhPar.T8 > dMaxMat4 then
dNumLog = -2691
dNumMessage = 463
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T8), EgtToUiUnits(dMaxMat4))
tMhPar.T8 = 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.T9 and dMaxMat7 and tMhPar.T9 > dMaxMat7 then
dNumLog = -2691
dNumMessage = 463
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T9), EgtToUiUnits(dMaxMat7))
tMhPar.T9 = dMaxMat7 - 0.02 -- tolgo 0.02 per permettere la lavorazione
end
-- se tutte le mortise concatenate a face e la profondità della mortise è maggiore della capacità utensile,
-- limito la profondità ed emetto un warning
if tMhPar.jn and tMhPar.jn2 and not tMhPar.mh and tMhPar.jnb and
tMhPar.T2 and dMaxMat1 and tMhPar.T2 > dMaxMat1 then
dNumLog = -2694
dNumMessage = 461
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T2), EgtToUiUnits(dMaxMat1))
tMhPar.T2 = dMaxMat1 - 0.02
end
-- se tutte le mortise concatenate a face e la profondità della mortise è maggiore della capacità utensile,
-- limito la profondità ed emetto un warning
if tMhPar.jn and tMhPar.jn2 and not tMhPar.mh and tMhPar.jnb and
tMhPar.T3 and dMaxMat1 and tMhPar.T3 > dMaxMat1 then
dNumLog = -2693
dNumMessage = 461
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T3), EgtToUiUnits(dMaxMat1))
tMhPar.T3 = dMaxMat1
end
-- se solo le mortise concatenate a face e la profondità della seconda mortise è maggiore della capacità utensile,
-- limito la profondità ed emetto un warning
if not tMhPar.jn and tMhPar.jn2 and not tMhPar.mh and
tMhPar.T3 and dMaxMat2 and tMhPar.T3 > dMaxMat2 then
dNumLog = -2692
dNumMessage = 461
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T3), EgtToUiUnits(dMaxMat2))
tMhPar.T3 = dMaxMat2
end
-- se nessuna mortise è concatenate a face e la profondità della mortise è maggiore della capacità utensile,
-- limito la profondità ed emetto un warning
if not tMhPar.jn and not tMhPar.jn2 and
tMhPar.T3 and dMaxMat2 and tMhPar.T3 > dMaxMat2 then
dNumLog = -2691
dNumMessage = 461
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T3), EgtToUiUnits(dMaxMat2))
tMhPar.T3 = dMaxMat2
end
-- Raggio: se altro materiale e raggio presente e 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.dThD or abs( abs(tMhPar.T) - tMhPar.dThD) < DGD.Spd) then
dNumLog = -2686
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.T2 and ( abs(tMhPar.T2) > tMhPar.dThD or abs( abs(tMhPar.T2) - tMhPar.dThD) < DGD.Spd) then
dNumLog = -2686
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.T3 and ( abs(tMhPar.T3) > tMhPar.dThD or abs( abs(tMhPar.T3) - tMhPar.dThD) < DGD.Spd) then
dNumLog = -2686
dNumMessage = 681
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, sPieceName, 'T3', EgtToUiUnits(tMhPar.T3), EgtToUiUnits(tMhPar.TTP), EgtToUiUnits(tMhPar.dThD))
tMhPar.T3 = tMhPar.TTP
end
if tMhPar.Dws and DGD.Spd > 0 and tMhPar.T8 and ( abs(tMhPar.T8) > tMhPar.dThD or abs( abs(tMhPar.T8) - tMhPar.dThD) < DGD.Spd) then
dNumLog = -2686
dNumMessage = 681
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, sPieceName, 'T8', EgtToUiUnits(tMhPar.T8), EgtToUiUnits(tMhPar.TTP), EgtToUiUnits(tMhPar.dThD))
tMhPar.T8 = tMhPar.TTP
end
if tMhPar.Dws and DGD.Spd > 0 and tMhPar.T9 and ( abs(tMhPar.T9) > tMhPar.dThD or abs( abs(tMhPar.T9) - tMhPar.dThD) < DGD.Spd) then
dNumLog = -2686
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.FBP and ( abs(tMhPar.FBP) > tMhPar.dThD or abs( abs(tMhPar.FBP) - tMhPar.dThD) < DGD.Spd) then
dNumLog = -2686
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.dThD or abs( abs(tMhPar.TB2) - tMhPar.dThD) < DGD.Spd) then
dNumLog = -2686
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.T and tMhPar.T > 0 and tMhPar.ls then
-- Se c'è il profilo bevel e la geometria è applicata al lato lock
if ( DGD.tProfs.lockedge.trimming == 'BD' or DGD.tProfs.lockedge.trimming == 'BU' or
DGD.tProfs.lockedge.trimming == 'BDEB' or DGD.tProfs.lockedge.trimming == 'BUEB') and
( not DGD.SIDE or string.lower(DGD.SIDE) == 'lock') then
-- Se il parametro per impedire la rotazione sul lato bevel non è attivo
if not tMhPar.dl then
tMhPar.fht = tMhPar.T / cos(3)
else
tMhPar.fht = tMhPar.T
end
-- considerando l'angolo calcolo l'ingombro totale riferito al lato wide
tMhPar.fhb = tMhPar.fht + ( DGD.dT * TAN3)
else
tMhPar.fht = tMhPar.T
tMhPar.fhb = tMhPar.fht
end
end
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 Strike.Draw( tLckP, bPreview, bRunByCompo, nDrawMach, dThickDoor)
-- Assegno le dimensioni geometria
local L = tLckP.L -- lunghezza face
local H = tLckP.H -- larghezza face
local T = tLckP.T -- spessore face
local LS = tLckP.LS -- lunghezza strike face
local HS = tLckP.HS -- altezza strike face
local AS = tLckP.AS -- angolo strike face
local IS = tLckP.IS -- interasse strike face
local D_SS = tLckP.D_SS -- distanza partenza srike
local rs = tLckP.rs -- raggio arrotondamento strike
local ls = tLckP.ls -- latch strike
local cl = tLckP.cl -- arrotonda estremità face, 0: nessun arrotondamento, 1: arrotonda a sinistra,
-- 2: arrotonda a destra, 3: arrotonda entrambe i lati
local rf = tLckP.rf -- raggio arrotondamento face
local clc = tLckP.clc
local ccr = tLckP.ccr
local d = tLckP.d -- diametro utensile face
local p = tLckP.p -- percentuale uso utensile face
local sf = tLckP.sf -- passo affondamento face
local dl = tLckP.dl -- disponi face come lock, cioè non ruotata su bevel
local da = tLckP.da -- diametro utensile anti-splint
local ech = tLckP.ech -- abilitazione chisel
local est = tLckP.est -- altro materiale trovato
local mh = tLckP.mh -- crea foro: true o mortasa: false
local L2 = tLckP.L2 -- lunghezza mortasa (seconda cava)
local H2 = tLckP.H2 -- larghezza mortasa o diametro foro
local T2 = tLckP.T2 -- profondità mortasa o foro
local I2 = tLckP.I2 -- intersasse mortasa
local HB2 = tLckP.HB2 -- diametro foro orizzontale
local TB2 = tLckP.TB2 -- profondità foro orizzontale
local d2 = tLckP.d2 -- diametro utensile svuotatura mortasa ( non per foro)
local p2 = tLckP.p2 -- percentuale uso utensile mortasa
local s = tLckP.s -- passo affondamento mortasa
local FBD = tLckP.FBD -- diametro preforo
local FBP = tLckP.FBP -- profondità preforo
local AB = tLckP.AB -- angolo fori
local L3 = tLckP.L3 -- lunghezza seconda mortasa ( terza cava)
local H3 = tLckP.H3 -- larghezza seconda mortasa ( terza cava)
local T3 = tLckP.T3 -- profondità seconda mortasa ( terza cava)
local I3 = tLckP.I3 -- intersasse seconda mortasa
local d3 = tLckP.d3 -- diametro utensile svuotatura seconda mortasa
local p3 = tLckP.p3 -- percentuale uso utensile seconda mortasa
local s3 = tLckP.s3 -- passo affondamento seconda mortasa
-- tabelle per i viti fissaggio (mounting screw)
local tMountingScrew = {}
-- inserimento dati nella tabella fori
table.insert( tMountingScrew, { tLckP.D8, tLckP.T8, tLckP.I8, tLckP.IY8, tLckP.mcs8, tLckP.mss8, tLckP.PX8C, tLckP.PX8, tLckP.PY8, tLckP.LMS8})
table.insert( tMountingScrew, { tLckP.D9, tLckP.T9, tLckP.I9, tLckP.IY9, tLckP.mcs9, tLckP.mss9, tLckP.PX9C, tLckP.PX9, tLckP.PY9, tLckP.LMS9})
local kbs = tLckP.kbs -- keep backset/thickness (0: none, 1: only face, 2: all)
local pbs = tLckP.pbs -- Probe on side, 0 = none, 1 = only face geometries, 2 = all
local mkrev = tLckP.mkrev -- flag creazione inversione percorsi
local SL = tLckP.SL
local fht = tLckP.fht
local fhb = tLckP.fhb
local drf = tLckP.drf
local dws = tLckP.Dws
local dthd = tLckP.dThD
-- 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 prima cava face con seconda cava (mortasa)
local jn2 = tLckP.jn2 -- flag per giunzione seconda cava (mortasa) con terza cava ( seconda mortasa)
local jnb = tLckP.jnb -- flag che indica se profilo tipo bevel o meno
-- 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 delle 2 cave rispetto alla face
local D_X = tLckP.D_X -- disassamento seconda cava (mortasa o foro) da centro lunghezza face
local D_X3 = tLckP.D_X3 -- disassamento terza cava (seconda mortasa) da centro lunghezza face
-- Disassamento dei fori rispetto al face
local DH_X = tLckP.DH_X -- disassamento fori 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 = {}
-- inserimento dati nella tabella fori
table.insert( tExtraBore, { tLckP.D10, tLckP.T10, tLckP.PX10, tLckP.PY10, tLckP.EB10, tLckP.RBS10})
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})
table.insert( tExtraRect, { tLckP.LR11, tLckP.WR11, tLckP.RR11, tLckP.TR11, tLckP.PRX11, tLckP.PRY11, tLckP.AR11, tLckP.ER11, tLckP.RRS11})
table.insert( tExtraRect, { tLckP.LR12, tLckP.WR12, tLckP.RR12, tLckP.TR12, tLckP.PRX12, tLckP.PRY12, tLckP.AR12, tLckP.ER12, tLckP.RRS12})
table.insert( tExtraRect, { tLckP.LR13, tLckP.WR13, tLckP.RR13, tLckP.TR13, tLckP.PRX13, tLckP.PRY13, tLckP.AR13, tLckP.ER13, tLckP.RRS13})
table.insert( tExtraRect, { tLckP.LR14, tLckP.WR14, tLckP.RR14, tLckP.TR14, tLckP.PRX14, tLckP.PRY14, tLckP.AR14, tLckP.ER14, tLckP.RRS14})
-- 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})
-- inserimento dati nella tabella fori
table.insert( tExtraBore, { tLckP.D20, tLckP.T20, tLckP.PX20, tLckP.PY20, tLckP.EB20, tLckP.RBS20})
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})
table.insert( tExtraRect, { tLckP.LR21, tLckP.WR21, tLckP.RR21, tLckP.TR21, tLckP.PRX21, tLckP.PRY21, tLckP.AR21, tLckP.ER21, tLckP.RRS21})
table.insert( tExtraRect, { tLckP.LR22, tLckP.WR22, tLckP.RR22, tLckP.TR22, tLckP.PRX22, tLckP.PRY22, tLckP.AR22, tLckP.ER22, tLckP.RRS22})
table.insert( tExtraRect, { tLckP.LR23, tLckP.WR23, tLckP.RR23, tLckP.TR23, tLckP.PRX23, tLckP.PRY23, tLckP.AR23, tLckP.ER23, tLckP.RRS23})
table.insert( tExtraRect, { tLckP.LR24, tLckP.WR24, tLckP.RR24, tLckP.TR24, tLckP.PRX24, tLckP.PRY24, tLckP.AR24, tLckP.ER24, tLckP.RRS24})
-- 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: per la doppia face, la prima geometria è LG..'1st'
local LG2 = tLckP.LG2 -- nome geometria seconda cava (mortasa)
local LG3 = tLckP.LG3 -- nome geometria terza cava (seconda mortasa)
local LM = tLckP.LM -- nome geometria lavorazione face: per la doppia face, la prima geometria è LM..'1st'
local LA = tLckP.LA -- nome geometria lavorazione antischeggia
local LA2 = tLckP.LA2 -- nome geometria lavorazione seconda cava (mortasa)
local LA3 = tLckP.LA3 -- nome geometria lavorazione terza cava (seconda mortasa)
local CH = tLckP.CH -- nome suffisso lavorazione chisel
local CLC = tLckP.CLC -- nome geometria clean corner
-- Assegno le label alla geometria foro profondo di lato
local LGH = tLckP.LGH -- nome geometria seconda cava (foro)
local LMP = tLckP.LMP -- nome geometrie precut bore
-- 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 tsNamePar = {}
table.insert( tsNamePar, tLckP.NPL or 'L')
table.insert( tsNamePar, tLckP.NPH or 'H')
table.insert( tsNamePar, tLckP.NPT or 'T')
table.insert( tsNamePar, tLckP.NPd or 'd')
table.insert( tsNamePar, tLckP.NPp or 'p') -- 5
table.insert( tsNamePar, tLckP.NPLS or 'LS')
table.insert( tsNamePar, tLckP.NL2 or 'L2')
table.insert( tsNamePar, tLckP.NT2 or 'T2')
table.insert( tsNamePar, tLckP.NPd2 or 'd2')
table.insert( tsNamePar, tLckP.NPp2 or 'p2') -- 10
table.insert( tsNamePar, tLckP.NPS or 's')
table.insert( tsNamePar, tLckP.NPH2 or 'H2')
table.insert( tsNamePar, tLckP.NPHS or 'HS')
table.insert( tsNamePar, tLckP.NL3 or 'L3')
table.insert( tsNamePar, tLckP.NL3 or 'H3') -- 15
table.insert( tsNamePar, tLckP.NT3 or 'T3')
table.insert( tsNamePar, tLckP.NPd3 or 'd3')
table.insert( tsNamePar, tLckP.NPp3 or 'p3')
table.insert( tsNamePar, tLckP.NPS3 or 's3')
table.insert( tsNamePar, tLckP.NPD_X or 'D_X') -- 20
table.insert( tsNamePar, tLckP.NPD_X3 or 'D_X3')
table.insert( tsNamePar, tLckP.NPAS or 'AS')
table.insert( tsNamePar, tLckP.NPIS or 'IS')
table.insert( tsNamePar, tLckP.NPDS or 'D_SS')
table.insert( tsNamePar, tLckP.NPRS or 'rs') -- 25
table.insert( tsNamePar, tLckP.NPDL or 'dl')
table.insert( tsNamePar, tLckP.NPDA or 'da')
table.insert( tsNamePar, tLckP.NPI2 or 'I2')
table.insert( tsNamePar, tLckP.NPHB2 or 'HB2')
table.insert( tsNamePar, tLckP.NPTB2 or 'TB2') -- 30
table.insert( tsNamePar, tLckP.NPFBD or 'FBD')
table.insert( tsNamePar, tLckP.NPFBP or 'FBP')
table.insert( tsNamePar, tLckP.NPI2 or 'I3')
table.insert( tsNamePar, tLckP.NPSF or 'sf')
table.insert( tsNamePar, tLckP.NPRF or 'rf') -- 35
table.insert( tsNamePar, tLckP.N50 or 'clc')
table.insert( tsNamePar, tLckP.N51 or 'ccr')
-- RunByComponetInterface
local RC = true
-- Messaggi codice errori
local EM = ' '
local EC = 0
local ErrorBase = 2600
-- variabili che abilitano la creazione della geometria
local bMakeFaceGeom = true
local bMakeMortGeom = true
local bMakeBoreGeom = true
local bMakeMortGeom2nd = true
if not bRunByCompo then
RC = false
end
-- verifico se dei parametri sono nulli e in qual caso assegno dei valori sostitutivi
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 and cl and cl > 0 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
-- se rilevato profilo bevel disattivo il join tra face e mortasa
if not jnb then
jn = false
end
if not T then T = 0 end
if not D_X then D_X = 0 end
if not DH_X then DH_X = 0 end
if not D_XE then D_XE = 0 end
if est or ( not L2 or not H2) or ( mh and not HB2) then
bMakeMortGeom = false
-- disattivo il join
jn = false
jn2 = false
end
if not mh or not LGH or (( not HB2 or not TB2) and ( not H2 or not T2)) then
bMakeBoreGeom = false
end
if not T2 then
T2 = 0
end
if est or not L3 or not H3 then
bMakeMortGeom2nd = false
jn2 = false
end
if not T3 then
T3 = 0
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
-- se seconda e terza cava giuntate assegno il diametro della terza cava uguale alla seconda
if jn2 and bMakeMortGeom and bMakeMortGeom2nd then
d3 = d2
p3 = p2
s3 = s
end
-- determino se c'è strike
local dLSc = 0
local dR1 = rs
if ls then -- c'è strike
dLSc = HS * tan(AS)
dR1 = rs * tan((90-AS)/2)
end
if ls and IS > 0 and IS <= LS+(2*dR1) then -- se strike e interasse troppo corto per creare due denti
IS = 0 -- annullo interasse, singolo dente
end
if not ASGR then
das2 = nil
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
local EgtDoorsMsg = require( 'EgtDoorsMsg')
-- Verifica delle dimensioni, alcune condizioni vengono verificate solo se è abilitata la creazione dei percorsi di lavorazione
if bMakeFaceGeom and L <= 0 then
EC = 1
EM = string.format(EgtDoorsMsg[401],tsNamePar[1],EgtToUiUnits(L), sCompoPath) -- il parametro 'L' deve essere > 0
L = d*2
elseif bMakeMortGeom and not mh and L2 < 0 then
EC = 2
EM = string.format(EgtDoorsMsg[404],tsNamePar[7],EgtToUiUnits(L2), sCompoPath) -- il parametro 'L2' deve essere >= 0
L2 = d2*2
elseif bMakeMortGeom2nd and L3 < 0 then
EC = 3
EM = string.format(EgtDoorsMsg[404],tsNamePar[14],EgtToUiUnits(L3), sCompoPath) -- il parametro 'L3' deve essere >= 0
L3 = d3*2
elseif bMakeFaceGeom and H <= 0 then
EC = 4
EM = string.format(EgtDoorsMsg[401],tsNamePar[2],EgtToUiUnits(H), sCompoPath) -- il parametro 'H' deve essere > 0
H = d
elseif bMakeMortGeom and H2 <= 0 then
EC = 5
EM = string.format(EgtDoorsMsg[401],tsNamePar[12],EgtToUiUnits(H2), sCompoPath) -- il parametro 'H2' deve essere > 0
H2 = d2
elseif bMakeMortGeom2nd and H3 <= 0 then
EC = 6
EM = string.format(EgtDoorsMsg[401],tsNamePar[15],EgtToUiUnits(H3), sCompoPath) -- il parametro 'H3' deve essere > 0
H3 = d3
elseif bMakeFaceGeom and T < 0 then
EC = 7
EM = string.format(EgtDoorsMsg[404],tsNamePar[3],EgtToUiUnits(T), sCompoPath) -- il parametro 'T' deve essere >= 0
T = 0
elseif bMakeMortGeom and T2 <= 0 then
EC = 8
EM = string.format(EgtDoorsMsg[401],tsNamePar[8],EgtToUiUnits(T2), sCompoPath) -- il parametro 'T2' deve essere > 0
T2 = 0.1
elseif bMakeMortGeom2nd and T3 <= 0 then
EC = 9
EM = string.format(EgtDoorsMsg[401],tsNamePar[16],EgtToUiUnits(T3), sCompoPath) -- il parametro 'T3' deve essere > 0
T3 = 0.1
elseif bMakeFaceGeom and nDrawMach > 0 and L <= d then
if DGD.bProoduce then
EC = 11
EM = string.format(EgtDoorsMsg[402],tsNamePar[1],EgtToUiUnits(L),tsNamePar[4],EgtToUiUnits(d), sCompoPath) -- il parametro 'L' deve essere maggiore al diametro utensile
L = d + 0.002
else
d = L - 0.002
end
elseif bMakeMortGeom and nDrawMach > 0 and not mh and L2 <= d2 then
if DGD.bProoduce then
EC = 12
EM = string.format(EgtDoorsMsg[402],tsNamePar[7],EgtToUiUnits(L2),tsNamePar[9],EgtToUiUnits(d2), sCompoPath) -- il parametro 'L2' deve essere maggiore al diametro utensile
L2 = d2 + 0.002
else
d2 = L2 - 0.002
end
elseif bMakeMortGeom2nd and nDrawMach > 0 and L3 <= d3 then
if DGD.bProoduce then
EC = 13
EM = string.format(EgtDoorsMsg[402],tsNamePar[7],EgtToUiUnits(L2),tsNamePar[9],EgtToUiUnits(d2), sCompoPath) -- il parametro 'L2' deve essere maggiore al diametro utensile
L3 = d3 + 0.002
else
d3 = L3 - 0.002
end
elseif bMakeFaceGeom and nDrawMach > 0 and H < d then
if DGD.bProoduce then
EC = 14
EM = string.format(EgtDoorsMsg[405],tsNamePar[2],EgtToUiUnits(H),EgtToUiUnits(d), sCompoPath) -- il parametro 'H' deve essere >= del diametro utensile
H = d
else
d = H - 0.002
end
elseif bMakeMortGeom and nDrawMach > 0 and not mh and H2 < d2 then
if DGD.bProoduce then
EC = 15
EM = string.format(EgtDoorsMsg[405],tsNamePar[12],EgtToUiUnits(H2),EgtToUiUnits(d2), sCompoPath) -- il parametro 'H2' deve essere >= del diametro utensile
H2 = d2
else
d2 = H2 - 0.002
end
elseif bMakeMortGeom2nd and nDrawMach > 0 and H3 < d3 then
if DGD.bProoduce then
EC = 16
EM = string.format(EgtDoorsMsg[405],tsNamePar[15],EgtToUiUnits(H3),EgtToUiUnits(d2), sCompoPath) -- il parametro 'H3' deve essere >= del diametro utensile
H3 = d3
else
d3 = H3 - 0.002
end
elseif bMakeFaceGeom and nDrawMach > 0 and d < DgMin then
EC = 17
EM = string.format(EgtDoorsMsg[400],tsNamePar[4], 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 = 18
EM = string.format(EgtDoorsMsg[400],tsNamePar[9], EgtToUiUnits(d),EgtToUiUnits(DgMin)) -- il diametro utensile deve essere >= di
d2 = DgMin
elseif bMakeMortGeom2nd and nDrawMach > 0 and d3 < DgMin then
EC = 19
EM = string.format(EgtDoorsMsg[400],tsNamePar[17], EgtToUiUnits(d3),EgtToUiUnits(DgMin)) -- il diametro utensile deve essere >= di
d3 = DgMin
elseif bMakeFaceGeom and nDrawMach > 0 and ( p < PtMin or p > PtMax) then
EC = 20
EM = string.format(EgtDoorsMsg[403],tsNamePar[5],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 = 21
EM = string.format(EgtDoorsMsg[403],tsNamePar[10],p2,PtMin,PtMax, sCompoPath) -- il parametro 'p2' deve essere compreso tra
p2 = 0.8
elseif bMakeMortGeom2nd and nDrawMach > 0 and ( p3 < PtMin or p3 > PtMax) then
EC = 22
EM = string.format(EgtDoorsMsg[403],tsNamePar[18],p3,PtMin,PtMax, sCompoPath) -- il parametro 'p3' deve essere compreso tra
p3 = 0.8
elseif bMakeFaceGeom and bMakeMortGeom and not mh and L2 >= L then
EC = 23
EM = string.format(EgtDoorsMsg[406],tsNamePar[7],EgtToUiUnits(L2),tsNamePar[1],EgtToUiUnits(L), sCompoPath) -- il parametro 'L2' deve essere < 'L'
L2 = L - 0.1
-- elseif bMakeMortGeom and bMakeMortGeom2nd and not mh and L3 >= L2 then
-- EC = 24
-- EM = string.format(EgtDoorsMsg[406],tsNamePar[14],EgtToUiUnits(L3),tsNamePar[7],EgtToUiUnits(L2), sCompoPath) -- il parametro 'L3' deve essere < 'L2'
-- L3 = L2 - 0.1
elseif bMakeFaceGeom and bMakeMortGeom and H2 > H then
EC = 25
EM = string.format(EgtDoorsMsg[456],tsNamePar[12],EgtToUiUnits(H2),tsNamePar[2],EgtToUiUnits(H), sCompoPath) -- il parametro 'H2' deve essere <= 'H'
H2 = H
elseif bMakeMortGeom and bMakeMortGeom2nd and H3 > H2 then
EC = 26
EM = string.format(EgtDoorsMsg[456],tsNamePar[15],EgtToUiUnits(H3),tsNamePar[12],EgtToUiUnits(H2), sCompoPath) -- il parametro 'H3' deve essere <= 'H2'
H3 = H2
elseif bMakeFaceGeom and bMakeMortGeom and not dws and T2 <= T then
EC = 27
EM = string.format(EgtDoorsMsg[407],tsNamePar[8],EgtToUiUnits(T2),tsNamePar[3],EgtToUiUnits(T), sCompoPath) -- il parametro 'T2' deve essere > 'T'
T2 = T + 0.1
-- elseif bMakeMortGeom and bMakeMortGeom2nd and not dws and T3 <= T2 then
-- EC = 29
-- EM = string.format(EgtDoorsMsg[407],tsNamePar[16],EgtToUiUnits(T3),tsNamePar[8],EgtToUiUnits(T2), sCompoPath) -- il parametro 'T3' deve essere > 'T2'
-- T3 = T2 + 0.1
elseif bMakeMortGeom and nDrawMach > 0 and not mh and s and s <= 0 then
EC = 30
EM = string.format(EgtDoorsMsg[401],tsNamePar[11],EgtToUiUnits(s), sCompoPath) -- il parametro 's' deve essere > 0
s = d2
elseif bMakeMortGeom2nd and nDrawMach > 0 and s3 and s3 <= 0 then
EC = 31
EM = string.format(EgtDoorsMsg[401],tsNamePar[19],EgtToUiUnits(s3), sCompoPath) -- il parametro 's3' deve essere > 0
s3 = d3
elseif bMakeFaceGeom and bMakeMortGeom and jn and abs(I2)<=0 and D_X and L and L2 and abs(D_X) > ((L-L2)/2) then -- se il decentramento è troppo alto e fa sbordare la cava2 dalla 1
EC = 32
local dDelta = abs(((L-L2)/2)-abs(D_X))
EM = string.format(EgtDoorsMsg[423],tsNamePar[20],EgtToUiUnits(D_X),EgtToUiUnits(D_X + EgtIf( D_X >= 0, -dDelta, dDelta)), sCompoPath) -- il parametro 'D_X' é troppo grande, max valore:
D_X = 0
elseif bMakeFaceGeom and bMakeMortGeom and jn and abs(I2)>0 and D_X and L and L2 and abs(D_X) > ((L-(L2+abs(I2)))/2) then -- se il decentramento è troppo alto e fa sbordare la cava2 dalla 1
EC = 33
local dDelta = abs(((L-(L2+abs(I2)))/2)-abs(D_X))
EM = string.format(EgtDoorsMsg[423],tsNamePar[20],EgtToUiUnits(D_X),EgtToUiUnits(D_X + EgtIf( D_X >= 0, -dDelta, dDelta)), sCompoPath) -- il parametro 'D_X' é troppo grande, max valore:
D_X = 0
elseif bMakeMortGeom and bMakeMortGeom2nd and jn2 and abs(I2)<=0 and abs(I3)<=0 and D_X and D_X3 and L2 and L3 and abs(D_X-D_X3) < ((L2+L3)/2) and abs(D_X-D_X3) > ((L2-L3)/2) then -- se il decentramento è troppo alto e fa sbordare la cava3 dalla cava2
EC = 34
local dDelta = abs(((L2-(L3+abs(I3)))/2)-abs(D_X-D_X3))
EM = string.format(EgtDoorsMsg[624],tsNamePar[21],EgtToUiUnits(D_X3),EgtToUiUnits(D_X3 + EgtIf( D_X3 >= 0, -dDelta, dDelta)), sCompoPath) -- il parametro 'D_X3' é troppo grande, max valore:
D_X3 = 0
elseif bMakeMortGeom and bMakeMortGeom2nd and jn2 and abs(I2)<=0 and abs(I3)>0 and D_X and D_X3 and L2 and L3 and (L2-(L3+abs(I3))) >= 0 and ((L2-(L3+abs(I3)))/2) <= abs(D_X3-D_X) then -- se il decentramento è troppo alto e fa sbordare la cava3 dalla 2
EC = 35
local dDelta = abs(((L2-L3)/2)-abs(D_X-D_X3))
EM = string.format(EgtDoorsMsg[624],tsNamePar[21],EgtToUiUnits(D_X3),EgtToUiUnits(D_X3 + EgtIf( D_X3 >= 0, -dDelta, dDelta)), sCompoPath) -- il parametro 'D_X3' é troppo grande, max valore:
D_X3 = 0
elseif bMakeMortGeom and bMakeMortGeom2nd and D_X and D_X3 and abs(abs(D_X)-abs(D_X3)) < GEO.EPS_SMALL and abs(I2)>0 and abs(I3)>0 and abs(abs(I2)-abs(I3)) > GEO.EPS_SMALL and (abs(I2)-L2) > (abs(I3)-L3) then -- se le seconde mortase doppie sbordano delle prime mortase doppie
EC = 36
EM = string.format(EgtDoorsMsg[625],tsNamePar[33],EgtToUiUnits(I3),EgtToUiUnits(abs(I2)-L2+L3), sCompoPath) -- il parametro 'I3' é troppo piccolo, min valore:
I3 = abs(I2)-L2+L3
elseif bMakeMortGeom and bMakeMortGeom2nd and D_X and D_X3 and abs(abs(D_X)-abs(D_X3)) < GEO.EPS_SMALL and abs(I2)>0 and abs(I3)>0 and abs(I2-abs(I3)) > GEO.EPS_SMALL and (I2+L2) < (abs(I3)+L3) then -- se le seconde mortase doppie sbordano delle prime mortase doppie
EC = 37
EM = string.format(EgtDoorsMsg[624],tsNamePar[33],EgtToUiUnits(I3),EgtToUiUnits(abs(I2)+L2-L3), sCompoPath) -- il parametro 'I3' é troppo grande, max valore:
I3 = abs(I2)+L2-L3
elseif bMakeFaceGeom and nDrawMach > 0 and sf and sf <= 0 then
EC = 38
EM = string.format(EgtDoorsMsg[401],tsNamePar[34],EgtToUiUnits(sf), sCompoPath) -- il parametro 'sf' deve essere > 0
sf = d
elseif bMakeFaceGeom and cl and cl > 0 and rf < 0 then
EC = 39
EM = string.format(EgtDoorsMsg[404],tsNamePar[35],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 = 40
EM = string.format(EgtDoorsMsg[407],tsNamePar[36],EgtToUiUnits(clc),'',EgtToUiUnits(2*(ccr*sin(45))), sCompoPath) -- il parametro 'clc' deve essere > 'crc'
clc = (2*(ccr*sin(45)))+0.2
elseif bMakeBoreGeom and not dws and FBP and ( ( TB2 and FBP >= TB2) or ( not TB2 and T2 and FBP >= T2)) then
if TB2 and FBP >= TB2 then
EC = 41
EM = string.format(EgtDoorsMsg[407],tsNamePar[30],EgtToUiUnits(TB2),tsNamePar[32],EgtToUiUnits(FBP), sCompoPath) -- il parametro 'TB2' deve essere > 'FBP'
TB2 = FBP + 0.1
elseif T2 and FBP >= T2 then
EC = 42
EM = string.format(EgtDoorsMsg[407],tsNamePar[8],EgtToUiUnits(T2),tsNamePar[32],EgtToUiUnits(FBP), sCompoPath) -- il parametro 'T2' deve essere > 'FBP'
T2 = FBP + 0.1
end
elseif bMakeFaceGeom and ls then
if (L-(2*rf)) < (LS+IS+(2*dR1)) then -- se lunghezza face troppo corta per parte latch
EC = 43
EM = string.format(EgtDoorsMsg[627],tsNamePar[1],EgtToUiUnits(L),EgtToUiUnits((2*rf)+LS+IS+(2*dR1)), sCompoPath) -- il parametro 'L' é troppo piccolo, min valore:
L = (2*rf)+LS+IS+(2*dR1)
elseif LS <= (d+(dLSc*2)) then -- se larghezza dello strike è inferiore della componente inclinata
EC = 44
EM = string.format(EgtDoorsMsg[627],tsNamePar[6],EgtToUiUnits(LS),EgtToUiUnits(d+(2*dLSc)), sCompoPath) -- il parametro 'LS' é troppo piccolo, min valore:
LS = d+(2*dLSc)+ 0.1
elseif D_SS < (dR1+rf) then
EC = 45
EM = string.format(EgtDoorsMsg[627],tsNamePar[24],EgtToUiUnits(D_SS),EgtToUiUnits(dR1+rf), sCompoPath) -- il parametro 'LS' é troppo piccolo, min valore:
D_SS = dR1+rf + 0.1
end
end
if not bPreview and EC ~= 0 then
return (ErrorBase+EC), EM
end
-- Se Preview cancello tutto
if bPreview then
EgtNewFile()
EgtSetDefaultMaterial( BLACK())
end
-- Pezzo e Layer
local Pz
if bPreview then
Pz = EgtGroup(GDB_ID.ROOT,GDB_RT.LOC) -- nuovo pezzo
else
if not RC then
Pz = EgtGetCurrPart() -- pezzo corrente
end
if not Pz then
Pz = EgtGroup(GDB_ID.ROOT,GDB_RT.LOC) -- nuovo pezzo
end
end
local Lg
-- variabili dei percorsi geometrici
local nGeom1st, nGeom2st, nGeom1, nGeom2, nGeom3, nGeom4
local nAS1, nAS2, nAS3, nAS4
local hint_1, hint_2, hint_3, hint_4, hint_5, hint_6, hint_7, hint_8 -- variabili percorsi su fianco
local hint_10, hint_11, hint_13, hint_14, hint_15 -- variabili percorsi su secure o keyway
local nPkToJoin1st, nPkToJoin1, nPkToJoin2, nPkToJoin3, nPkToJoin4
local nPkToJoin1st_r, nPkToJoin1_r, nPkToJoin2_r, nPkToJoin3_r, nPkToJoin4_r
local nPkJoin, nPkJoin1, nPkJoin2, nPkJoin3
local nPkJoin_rev, nPkJoin1_rev, nPkJoin2_rev, nPkJoin3_rev
local nPos1st = 0
local nDirMort1 = 1
local nDirMort2 = 1
local bMatchMort = false
local dFirstface = {}
local nForceMakeFace = nDrawMach
Lg = EgtGroup(Pz,GDB_RT.LOC) -- layer principale
EgtSetName(Lg,sCompoName)
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.rf = rf
dFirstface.cl = cl
dFirstface.d = d
dFirstface.p = p
dFirstface.sf = sf
dFirstface.jn = jn
dFirstface.L2 = L2
dFirstface.H2 = H2
dFirstface.invG = invG
dFirstface.est = est
dFirstface.smr = 0 -- così il latch non crea i raccordini per evitare il chiseling
dFirstface.mkrev = mkrev
-- 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 + (abs(I2/2)*nDirMort1) - nPos1st
dFirstface.Dws = nil -- disabilito per non creare geometrie (doppie) inerenti il calcolo regioni nei componenti chiamati
local sRequireCompoName = '_Latch'
if ls then
dFirstface.LS = LS
dFirstface.HS = HS
dFirstface.AS = AS
dFirstface.IS = IS
dFirstface.D_SS = D_SS
dFirstface.rs = rs
dFirstface.da = da
dFirstface.LA = LA
if IS > 0 then -- se doppio strike setto la posizione della prossima mortise
nDirMort1 = -1 -- setto per invertire il senso di inserimento delle prime mortase
dFirstface.D_X = D_X + (abs(I2/2)*nDirMort1) - nPos1st
end
sRequireCompoName = '_Strike'
end
-- lancio il primo componente base per disegnare la face completa
MHgen = require( sRequireCompoName)
if ls then
nGeom1st, nPkToJoin1st, nGeom2st, nAS1, nAS2, nAS3, nAS4, nPkToJoin1st_r = MHgen.Draw( EC, EM, dFirstface, bPreview, bRunByCompo, nForceMakeFace, Pz, Lg, dThickDoor)
else
nGeom1st, nPkToJoin1st, nGeom2st, nAS1, nAS2, nPkToJoin1st_r = MHgen.Draw( EC, EM, dFirstface, bPreview, bRunByCompo, nForceMakeFace, Pz, Lg, dThickDoor)
end
-- setto le note che indicano su che lato della porta devono essere messe le geometrie
local sSide = EgtIf( dl, 'Lock', 'Side')
-- assegno le note e muovo nella posizione definitiva
SetPropertyAndMoveGeom( sSide, kbs, pbs, 'c', nPos1st, nGeom1st)
SetPropertyAndMoveGeom( sSide, kbs, pbs, 'c', nPos1st, nPkToJoin1st)
SetPropertyAndMoveGeom( sSide, kbs, pbs, 'c', nPos1st, nGeom2st)
SetPropertyAndMoveGeom( sSide, kbs, pbs, 'c', nPos1st, nAS1)
SetPropertyAndMoveGeom( sSide, kbs, pbs, 'c', nPos1st, nAS2)
SetPropertyAndMoveGeom( sSide, kbs, pbs, 'c', nPos1st, nAS3)
SetPropertyAndMoveGeom( sSide, kbs, pbs, 'c', nPos1st, nAS4)
SetPropertyAndMoveGeom( sSide, kbs, pbs, 'c', nPos1st, nPkToJoin1st_r)
-- 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 CLC1 = MakeClcPath( clc, ccr, CLC, Lg, -T, (invG == -1))
if CLC1 then
local nLS = 0
local nD_SS = 0
if LS then nLS = LS end
if D_SS then nD_SS = D_SS end
-- se mantiene backset
SetProbeProperty( kbs, 0, pbs, 'c', CLC1) -- setto 'c' perché viene mantenuto il centro spessore
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
if LS ~= L and D_SS ~= 0 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())
end
-- 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())
if LS ~= L and abs(L-nD_SS-nLS) >= GEO.EPS_SMALL then
-- angolo x-y+
EgtMove( CLC1, Point3d(-(L/2),(H/2),0) - ORIG())
else
EgtErase(CLC1)
end
end
end
end
end
end
end
if bMakeBoreGeom then -- se foro orizzontale abilitato
-- se parametri foro/preforo
if LMP and 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 then
hint_8 = EgtCircle( Lg, Point3d(0,0,0), HB2/2 , GDB_RT.LOC)
EgtModifyCurveThickness(hint_8, -TB2)
elseif H2 and T2 then
hint_8 = EgtCircle( Lg, Point3d(0,0,0), H2/2 , GDB_RT.LOC)
EgtModifyCurveThickness(hint_8, -T2)
end
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
if hint_8 then -- se esiste secondo foro
EgtSetInfo(hint_8,'SideDoor','Lock')
-- se mantiene centro spessore su mortise
SetProbeProperty( kbs, 0, pbs, 'c', hint_8) -- setto 'c' perché viene mantenuto il centro spessore
end
if hint_7 then -- se esiste foro/preforo
EgtSetInfo(hint_7,'SideDoor','Lock')
-- se mantiene centro spessore su mortise
SetProbeProperty( kbs, 0, pbs, 'c', hint_7) -- setto 'c' perchè viene mantenuto il centro spessore
end
end
-- determino se ho due coppie di mortase compatibili al concatenamento in Z
if bMakeMortGeom and bMakeMortGeom2nd and jn2 and abs(I2)> 0 and abs(I3)>0 and
(D_X+(abs(I2)-L2)/2) <= (D_X3+(abs(I3)-L3)/2) and (D_X+(abs(I2)+L2)/2) >= (D_X3+(abs(I3)+L3)/2) then
bMatchMort = true -- setto flag per indicare che le coppie di mortase sono centrate
end
if bMakeMortGeom then -- se seconda cava abilitata
-- eseguo la prima delle prime mortase
local dMortise = {}
-- 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 = d2
dMortise.p = p2
dMortise.jn = jn
dMortise.invG = invG
dMortise.mkrev = mkrev
dMortise.LGM = LG2
dMortise.LMM = LA2
dMortise.L3 = L2
dMortise.H3 = H2
dMortise.d3 = d2
dMortise.p3 = p2
dMortise.Nome = sCompoName
dMortise.jne = jn2
dMortise.D_X = 0
-- se c'è il match tra le 4 mortase
if bMatchMort then
dMortise.L3 = L3
dMortise.H3 = H3
dMortise.d3 = d3
dMortise.p3 = p3
dMortise.D_X = -(((abs(I2)-abs(I3))/2)-(D_X-D_X3))*nDirMort1
dMortise.jne = jn2
dMortise.jnt = false
nDirMort2 = nDirMort1
else -- se non c'è il match vedo se c'è intersasse con la mortsa dello stesso livello
-- calcolo la posizione dal centro seconda cava (mortasa) al centro della cava successiva
if abs(I2) > 0 then -- se ho seconda cava
dMortise.L3 = L2
dMortise.H3 = H2
dMortise.D_X = -abs(I2)*nDirMort1
dMortise.jne = true
dMortise.jnt = true
nDirMort2 = -nDirMort1
else -- se ho solo una cava
if jn2 then -- se si concatena alle seguenti
nDirMort1 = 1
dMortise.L3 = L3
dMortise.H3 = H3
dMortise.D_X = D_X3 + ((abs(I3)/2)*nDirMort1) - D_X
nDirMort2 = nDirMort1
dMortise.jnt = true
if ((L2 - (L3+abs(I3)))/2) > abs(D_X3-D_X) then -- se prima mortasa contiene la/e seconda/e mortasa/e rimango a z della prima mortasa
dMortise.jnt = false
end
end
end
end
-- lancio il componente base
MHgen = require('_Mortise')
nGeom1, nPkToJoin1, nPkToJoin1_r = MHgen.Draw( EC, EM, dMortise, bPreview, bRunByCompo, nDrawMach, Pz, Lg, dThickDoor)
-- assegno le note e muovo nella posizione definitiva
SetPropertyAndMoveGeom( 'Lock', kbs, pbs, 'c', (D_X+(abs(I2/2)*nDirMort1)), nGeom1)
SetPropertyAndMoveGeom( 'Lock', kbs, pbs, 'c', (D_X+(abs(I2/2)*nDirMort1)), nPkToJoin1)
SetPropertyAndMoveGeom( 'Lock', kbs, pbs, 'c', (D_X+(abs(I2/2)*nDirMort1)), nPkToJoin1_r)
end
if bMatchMort then -- se le mortase sono centrate
-- eseguo la prima delle seconde mortase
local dMortise = {}
-- assegno i valori coerenti con la tabella del componente
dMortise.T = T2
dMortise.L2 = L3
dMortise.H2 = H3
dMortise.T2 = T3
dMortise.s = s3
dMortise.d = d3
dMortise.p = p3
dMortise.jn = jn2
dMortise.invG = invG
dMortise.mkrev = mkrev
dMortise.LGM = LG3
dMortise.LMM = LA3
dMortise.Nome = sCompoName
-- assegno i seguenti valori cava con le dimensioni della prima mortasa
dMortise.L3 = L2
dMortise.H3 = H2
dMortise.d3 = d2
dMortise.p3 = p2
dMortise.D_X = -(((abs(I2)+abs(I3))/2)+D_X-D_X3)*nDirMort1
dMortise.jne = jn2
dMortise.jnt = true
dMortise.TE = T
-- lancio il componente base
MHgen = require('_Mortise')
nGeom3, nPkToJoin3, nPkToJoin3_r = MHgen.Draw( EC, EM, dMortise, bPreview, bRunByCompo, nDrawMach, Pz, Lg, dThickDoor)
-- assegno le note e muovo nella posizione definitiva
SetPropertyAndMoveGeom( 'Lock', kbs, pbs, 'c', (D_X3+(abs(I3/2)*nDirMort2)), nGeom3)
SetPropertyAndMoveGeom( 'Lock', kbs, pbs, 'c', (D_X3+(abs(I3/2)*nDirMort2)), nPkToJoin3)
SetPropertyAndMoveGeom( 'Lock', kbs, pbs, 'c', (D_X3+(abs(I3/2)*nDirMort2)), nPkToJoin3_r)
else -- altrimenti verifico se ho doppia prima mortasa
if bMakeMortGeom and abs(I2) > 0 then -- se ho seconda cava doppia
-- eseguo la doppia delle prime mortase
local dMortise = {}
-- 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 = d2
dMortise.p = p2
dMortise.jn = jn
dMortise.invG = invG
dMortise.mkrev = mkrev
dMortise.L3 = L2
dMortise.H3 = H2
dMortise.d3 = d2
dMortise.p3 = p2
dMortise.LGM = LG2
dMortise.LMM = LA2
dMortise.Nome = sCompoName
dMortise.jne = jn2
dMortise.jnt = false
if bMakeMortGeom2nd then -- se ho seconda mortasa
dMortise.jnt = true
end
if jn2 then
dMortise.L3 = L3
dMortise.H3 = H3
dMortise.d3 = d3
dMortise.p3 = p3
dMortise.D_X = ((D_X3+abs(I3/2))-(D_X-(abs(I2/2)*nDirMort1)))
end
-- lancio il componente base
MHgen = require('_Mortise')
nGeom2, nPkToJoin2, nPkToJoin2_r = MHgen.Draw( EC, EM, dMortise, bPreview, bRunByCompo, nDrawMach, Pz, Lg, dThickDoor)
-- assegno le note e muovo nella posizione definitiva
SetPropertyAndMoveGeom( 'Lock', kbs, pbs, 'c', (D_X-(abs(I2/2)*nDirMort1)), nGeom2)
SetPropertyAndMoveGeom( 'Lock', kbs, pbs, 'c', (D_X-(abs(I2/2)*nDirMort1)), nPkToJoin2)
SetPropertyAndMoveGeom( 'Lock', kbs, pbs, 'c', (D_X-(abs(I2/2)*nDirMort1)), nPkToJoin2_r)
end
end
if bMatchMort then -- se le mortase sono centrate
-- eseguo la doppia delle prime mortase
local dMortise = {}
-- 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 = d2
dMortise.p = p2
dMortise.jn = jn2
dMortise.invG = invG
dMortise.mkrev = mkrev
dMortise.LGM = LG2
dMortise.LMM = LA2
dMortise.L3 = L3
dMortise.H3 = H3
dMortise.d3 = d3
dMortise.p3 = p3
dMortise.Nome = sCompoName
dMortise.jne = jn2
dMortise.jnt = false
dMortise.D_X = (((abs(I2)-abs(I3))/2)+D_X-D_X3)*nDirMort2
-- lancio il secondo componente base
MHgen = require('_Mortise')
nGeom2, nPkToJoin2, nPkToJoin2_r = MHgen.Draw( EC, EM, dMortise, bPreview, bRunByCompo, nDrawMach, Pz, Lg, dThickDoor)
-- assegno le note e muovo nella posizione definitiva
SetPropertyAndMoveGeom( 'Lock', kbs, pbs, 'c', (D_X-(abs(I2/2)*nDirMort1)), nGeom2)
SetPropertyAndMoveGeom( 'Lock', kbs, pbs, 'c', (D_X-(abs(I2/2)*nDirMort1)), nPkToJoin2)
SetPropertyAndMoveGeom( 'Lock', kbs, pbs, 'c', (D_X-(abs(I2/2)*nDirMort1)), nPkToJoin2_r)
else
if bMakeMortGeom2nd then -- se seconde mortase abilitate
-- eseguo la prima delle seconde mortase
local dMortise = {}
-- assegno i valori coerenti con la tabella del componente
dMortise.T = T
dMortise.L2 = L3
dMortise.H2 = H3
dMortise.T2 = T3
dMortise.s = s3
dMortise.d = d3
dMortise.p = p3
dMortise.jn = jn2
dMortise.invG = invG
dMortise.mkrev = mkrev
dMortise.LGM = LG3
dMortise.LMM = LA3
dMortise.Nome = sCompoName
dMortise.D_X = 0
dMortise.jne = false
dMortise.jnt = true
if I3 and abs(I3) > 0 then -- se ho doppia seconda mortasa
dMortise.L3 = L3
dMortise.H3 = H3
dMortise.d3 = d3
dMortise.p3 = p3
dMortise.D_X = -abs(I3)*nDirMort2
dMortise.jne = true
else
dMortise.TE = 0
if not jn2 then
dMortise.d3 = d3
dMortise.p3 = p3
dMortise.s3 = s3
end
end
if abs(I2) < GEO.EPS_SMALL and ((L2 - (L3+abs(I3)))/2) > abs(D_X3-D_X) then -- se prima mortasa non doppia contiene la/e seconda/e martasa/e rimango a z della prima mortasa
dMortise.T = T2
if abs(I3) > 0 then
dMortise.TE = T2
else
dMortise.TE = 0
end
elseif abs(I2) < GEO.EPS_SMALL then -- altrimenti se prima mortasa non doppia e non contiene le seconde mortase
if not jn then -- se non collegate a svuotatura face
dMortise.T = 0
end
end
-- lancio il secondo componente base
MHgen = require('_Mortise')
nGeom3, nPkToJoin3, nPkToJoin3_r = MHgen.Draw( EC, EM, dMortise, bPreview, bRunByCompo, nDrawMach, Pz, Lg, dThickDoor)
-- assegno le note e muovo nella posizione definitiva
SetPropertyAndMoveGeom( 'Lock', kbs, pbs, 'c', (D_X3+(abs(I3/2)*nDirMort2)), nGeom3)
SetPropertyAndMoveGeom( 'Lock', kbs, pbs, 'c', (D_X3+(abs(I3/2)*nDirMort2)), nPkToJoin3)
SetPropertyAndMoveGeom( 'Lock', kbs, pbs, 'c', (D_X3+(abs(I3/2)*nDirMort2)), nPkToJoin3_r)
end
end
if bMakeMortGeom2nd then -- se seconde mortase abilitate
if bMatchMort or abs(I3) > 0 then -- se ho terza cava doppia
-- eseguo la doppia delle seconde mortase
local dMortise = {}
-- assegno i valori coerenti con la tabella del componente
dMortise.T = T2
dMortise.TE = 0
-- se le mortase non sono centrate e le seconde non sono contenute nella prima
if not bMatchMort and (((L2 - (L3+abs(I3)))/2) <= abs(D_X3-D_X)) then
if not jn then -- se non collegate a svuotatura face
dMortise.T = 0 -- quota di partezza alla profondità face
else
dMortise.T = T -- quota di partezza alla profondità face
end
end
dMortise.L2 = L3
dMortise.H2 = H3
dMortise.T2 = T3
dMortise.s = s3
dMortise.d = d3
dMortise.p = p3
dMortise.jn = jn2
dMortise.invG = invG
dMortise.mkrev = mkrev
dMortise.LGM = LG3
dMortise.LMM = LA3
dMortise.Nome = sCompoName
dMortise.D_X = 0
dMortise.jne = false
dMortise.jnt = true
dMortise.L3 = L3
dMortise.H3 = H3
dMortise.d3 = d3
dMortise.p3 = p3
-- lancio il secondo componente base
MHgen = require('_Mortise')
nGeom4, nPkToJoin4, nPkToJoin4_r = MHgen.Draw( EC, EM, dMortise, bPreview, bRunByCompo, nDrawMach, Pz, Lg, dThickDoor)
-- assegno le note e muovo nella posizione definitiva
SetPropertyAndMoveGeom( 'Lock', kbs, pbs, 'c', (D_X3-(abs(I3/2)*nDirMort2)), nGeom4)
SetPropertyAndMoveGeom( 'Lock', kbs, pbs, 'c', (D_X3-(abs(I3/2)*nDirMort2)), nPkToJoin4)
SetPropertyAndMoveGeom( 'Lock', kbs, pbs, 'c', (D_X3-(abs(I3/2)*nDirMort2)), nPkToJoin4_r)
end
end
-- disegno le geometrie mounting screw
if EC == 0 then
for k = 1, 2 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 mcs = tMountingScrew[k][5]
local mss = tMountingScrew[k][6]
local PX9C = tMountingScrew[k][7] or 0
local PX9 = tMountingScrew[k][8] or 0
local PY9 = tMountingScrew[k][9] or 0
local LMS = tMountingScrew[k][10]
-- 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
hint_3 = EgtCircle( Lg, Point3d(PX9+(I9/2),PY9+(IY9/2),0), D9/2 , GDB_RT.LOC)
EgtModifyCurveThickness( hint_3, -T9)
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
SetProbeProperty( kbs, 0, pbs, 'c', hint_3) -- setto 'c' perchè viene mantenuto il centro spessore
if IY9 ~= 0 then
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
SetProbeProperty( kbs, 0, pbs, 'c', hint_5) -- setto 'c' perchè viene mantenuto il centro spessore
end
if mcs then
if mss then
hint_1 = EgtCircle( Lg, Point3d(PX9+PX9C,PY9,0), D9/2 , GDB_RT.LOC)
EgtModifyCurveThickness( hint_1, -T9)
EgtSetName( hint_1, LMS)
EgtSetInfo( hint_1, 'SideDoor', 'Lock') -- setto una nota per indicare su che lato della porta deve essere spostato
-- se mantiene centro spessore anche su face
SetProbeProperty( kbs, 0, pbs, 'c', hint_1) -- setto 'c' perchè viene mantenuto il centro spessore
else
hint_1 = EgtCircle( Lg, Point3d(PX9+PX9C,PY9+(IY9/2),0), D9/2 , GDB_RT.LOC)
EgtModifyCurveThickness( hint_1, -T9)
EgtSetName( hint_1, LMS)
EgtSetInfo( hint_1, 'SideDoor', 'Lock') -- setto una nota per indicare su che lato della porta deve essere spostato
-- se mantiene centro spessore anche su face
SetProbeProperty( kbs, 0, pbs, 'c', hint_1) -- setto 'c' perchè viene mantenuto il centro spessore
hint_2 = EgtCircle( Lg, Point3d(PX9+PX9C,PY9-(IY9/2),0), D9/2 , GDB_RT.LOC)
EgtModifyCurveThickness( hint_2, -T9)
EgtSetName( hint_2, LMS)
EgtSetInfo( hint_2,'SideDoor','Lock') -- setto una nota per indicare su che lato della porta deve essere spostato
-- se mantiene centro spessore anche su face
SetProbeProperty( kbs, 0, pbs, 'c', hint_2) -- setto 'c' perchè viene mantenuto il centro spessore
end
end
if I9 ~= 0 then
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
SetProbeProperty( kbs, 0, pbs, 'c', hint_4) -- setto 'c' perchè viene mantenuto il centro spessore
if IY9 ~= 0 then
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
SetProbeProperty( kbs, 0, pbs, 'c', hint_6) -- setto 'c' perchè viene mantenuto il centro spessore
end
end
end
end
end
end
if EC == 0 and bMakeBoreGeom and hint_8 then -- se esiste il secondo foro
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
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
-- se percorsi fatti con lo stesso utensile, li concateno
if jn and EC == 0 and nPkToJoin1st and nPkToJoin1 then
-- recupero la nota delle variazioni dalla geometria del face
local sVarNote = EgtGetInfo( nPkToJoin1st, 'MVar')
nPkJoin = EgtCurveCompo( Lg, {nPkToJoin1st,nPkToJoin1}, true)
if nPkJoin then
EgtSetName( nPkJoin, LM)
if sVarNote then EgtSetInfo( nPkJoin, 'MVar', sVarNote) end
-- 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
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin) -- setto 'c' perchè viene mantenuto il centro spessore
SetProbeProperty( kbs, 0, pbs, 'c', nGeom1) -- setto 'c' perchè viene mantenuto il centro spessore
else
EC = ErrorBase + 52
EM = string.format( EgtDoorsMsg[426], sCompoPath)
end
end
-- se percorsi inversi fatti con lo stesso utensile, li concateno
if jn and EC == 0 and nPkToJoin1st_r and nPkToJoin1_r then
-- recupero la nota delle variazioni dalla geometria del face
local sVarNote = EgtGetInfo( nPkToJoin1st_r, 'MVar')
nPkJoin_rev = EgtCurveCompo( Lg, {nPkToJoin1st_r,nPkToJoin1_r}, true)
if nPkJoin_rev then
EgtSetName( nPkJoin_rev, LM..'R')
if sVarNote then EgtSetInfo( nPkJoin_rev, 'MVar', sVarNote) end
-- se concatenata con la seconda cava (mortasa), forzo la posizione a Lock ( non segue angolo del profilo bevel)
EgtSetInfo( nPkJoin_rev, 'SideDoor', 'Lock')
EgtSetInfo( nPkJoin_rev, 'NotCheckDir', '1')
-- se mantiene centro spessore anche su face
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin_rev) -- setto 'c' perchè viene mantenuto il centro spessore
SetProbeProperty( kbs, 0, pbs, 'c', nGeom1) -- setto 'c' perchè viene mantenuto il centro spessore
else
EC = ErrorBase + 53
EM = string.format( EgtDoorsMsg[425], sCompoPath)
end
end
if not bMatchMort then -- se le cave non si combinano
-- se ho doppia cava e non matchano con le 4 cave
if EC == 0 and nPkToJoin1 and nPkToJoin2 then
local sVarNote
if nPkJoin then -- se fatto concatenamento con face
sVarNote = EgtGetInfo( nPkJoin, 'MVar')
nPkJoin1 = EgtCurveCompo( Lg, {nPkJoin,nPkToJoin2}, true)
else
nPkJoin1 = EgtCurveCompo( Lg, {nPkToJoin1,nPkToJoin2}, true)
end
if nPkJoin1 then
if nPkJoin then
if sVarNote then EgtSetInfo( nPkJoin1, 'MVar', sVarNote) end
EgtSetName( nPkJoin1, LM)
-- se mantiene centro spessore anche su face
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin1) -- setto 'c' perchè viene mantenuto il centro spessore
SetProbeProperty( kbs, 0, pbs, 'c', nGeom2) -- setto 'c' perchè viene mantenuto il centro spessore
else
EgtSetName( nPkJoin1, LA2)
-- se mantiene centro spessore su mortise
SetProbeProperty( kbs, 1, pbs, 'c', nPkJoin1) -- setto 'c' perchè viene mantenuto il centro spessore
end
EgtSetInfo( nPkJoin1, 'SideDoor', 'Lock')
EgtSetInfo( nPkJoin1, 'NotCheckDir', '1')
else
EC = ErrorBase + 54
EM = string.format( EgtDoorsMsg[426], sCompoPath)
end
end
-- se ho doppia cava inversa senza match tra le mortase
if EC == 0 and nPkToJoin1_r and nPkToJoin2_r then
local sVarNote
if nPkJoin_rev then -- se fatto concatenamento con face
sVarNote = EgtGetInfo( nPkJoin_rev, 'MVar')
nPkJoin1_rev = EgtCurveCompo( Lg, {nPkJoin_rev,nPkToJoin2_r}, true)
else
nPkJoin1_rev = EgtCurveCompo( Lg, {nPkToJoin1_r,nPkToJoin2_r}, true)
end
if nPkJoin1_rev then
if nPkJoin_rev then
if sVarNote then EgtSetInfo( nPkJoin1_rev, 'MVar', sVarNote) end
EgtSetName( nPkJoin1_rev, LM..'R')
-- se mantiene centro spessore anche su face
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin1_rev) -- setto 'c' perchè viene mantenuto il centro spessore
SetProbeProperty( kbs, 0, pbs, 'c', nGeom2) -- setto 'c' perchè viene mantenuto il centro spessore
else
EgtSetName( nPkJoin1_rev, LA2..'R')
-- se mantiene centro spessore su mortise
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin1_rev) -- setto 'c' perchè viene mantenuto il centro spessore
end
EgtSetInfo( nPkJoin1_rev, 'SideDoor', 'Lock')
EgtSetInfo( nPkJoin1_rev, 'NotCheckDir', '1')
else
EC = ErrorBase + 55
EM = string.format(EgtDoorsMsg[425], sCompoPath)
end
end
-- se ho terza cava senza match
if jn2 and EC == 0 and nPkToJoin3 then
if nPkJoin1 then -- se riuscito precedente concatenamento
-- recupero la nota delle variazioni dalla geometria del face
local sVarNote = EgtGetInfo( nPkJoin1, 'MVar')
nPkJoin2 = EgtCurveCompo( Lg, {nPkJoin1,nPkToJoin3}, true)
if nPkJoin2 then
if nPkJoin then -- se riuscito primo concatenamento
if sVarNote then EgtSetInfo( nPkJoin2, 'MVar', sVarNote) end
EgtSetName( nPkJoin2, LM)
-- se mantiene centro spessore anche su face
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin2) -- setto 'c' perchè viene mantenuto il centro spessore
SetProbeProperty( kbs, 0, pbs, 'c', nGeom3) -- setto 'c' perchè viene mantenuto il centro spessore
else
EgtSetName( nPkJoin2, LA2)
-- se mantiene centro spessore su mortise
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin2) -- setto 'c' perchè viene mantenuto il centro spessore
end
EgtSetInfo( nPkJoin2, 'SideDoor', 'Lock')
EgtSetInfo( nPkJoin2, 'NotCheckDir', '1')
else
EC = ErrorBase + 56
EM = string.format(EgtDoorsMsg[426], sCompoPath)
end
else
local sVarNote
if nPkJoin then -- se riuscito primo concatenamento
-- recupero la nota delle variazioni dalla geometria del face
sVarNote = EgtGetInfo( nPkJoin, 'MVar')
nPkJoin2 = EgtCurveCompo( Lg, {nPkJoin,nPkToJoin3}, true)
elseif nPkToJoin1 then
nPkJoin2 = EgtCurveCompo( Lg, {nPkToJoin1,nPkToJoin3}, true)
end
if nPkJoin2 then
if sVarNote then EgtSetInfo( nPkJoin2, 'MVar', sVarNote) end
EgtSetName( nPkJoin2, LA2)
-- se mantiene centro spessore su mortise
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin2) -- setto 'c' perchè viene mantenuto il centro spessore
EgtSetInfo( nPkJoin2, 'SideDoor', 'Lock')
EgtSetInfo( nPkJoin2, 'NotCheckDir', '1')
else
EC = ErrorBase + 57
EM = string.format(EgtDoorsMsg[426], sCompoPath)
end
end
end
-- se ho terza cava inversa senza match
if jn2 and EC == 0 and nPkToJoin3_r then
if nPkJoin1_rev then -- se riuscito precedente concatenamento
-- recupero la nota delle variazioni dalla geometria del face
local sVarNote = EgtGetInfo( nPkJoin1_rev, 'MVar')
nPkJoin2_rev = EgtCurveCompo( Lg, {nPkJoin1_rev,nPkToJoin3_r}, true)
if nPkJoin2_rev then
if nPkJoin_rev then -- se riuscito primo concatenamento
if sVarNote then EgtSetInfo( nPkJoin2_rev, 'MVar', sVarNote) end
EgtSetName( nPkJoin2_rev, LM..'R')
-- se mantiene centro spessore anche su face
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin2_rev) -- setto 'c' perchè viene mantenuto il centro spessore
SetProbeProperty( kbs, 0, pbs, 'c', nGeom3) -- setto 'c' perchè viene mantenuto il centro spessore
else
EgtSetName( nPkJoin2_rev, LA2..'R')
-- se mantiene centro spessore su mortise
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin2_rev) -- setto 'c' perchè viene mantenuto il centro spessore
end
EgtSetInfo( nPkJoin2_rev, 'SideDoor', 'Lock')
EgtSetInfo( nPkJoin2_rev, 'NotCheckDir', '1')
else
EC = ErrorBase + 58
EM = string.format( EgtDoorsMsg[425], sCompoPath)
end
else
local sVarNote
if nPkJoin_rev then -- se riuscito primo concatenamento
-- recupero la nota delle variazioni dalla geometria del face
sVarNote = EgtGetInfo( nPkJoin_rev, 'MVar')
nPkJoin2_rev = EgtCurveCompo( Lg, {nPkJoin_rev,nPkToJoin3_r}, true)
elseif nPkToJoin1_r then
nPkJoin2_rev = EgtCurveCompo( Lg, {nPkToJoin1_r,nPkToJoin3_r}, true)
end
if nPkJoin2_rev then
if sVarNote then EgtSetInfo( nPkJoin2_rev, 'MVar', sVarNote) end
EgtSetName( nPkJoin2_rev, LA2..'R')
-- se mantiene centro spessore su mortise
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin2_rev) -- setto 'c' perchè viene mantenuto il centro spessore
EgtSetInfo( nPkJoin2_rev, 'SideDoor', 'Lock')
EgtSetInfo( nPkJoin2_rev, 'NotCheckDir', '1')
else
EC = ErrorBase + 59
EM = string.format( EgtDoorsMsg[425], sCompoPath)
end
end
end
-- se ho doppia terza cava senza match
if EC == 0 and nPkToJoin3 and nPkToJoin4 then
local sVarNote
if nPkJoin2 then -- se fatto concatenamento con face
-- recupero la nota delle variazioni dalla geometria del face
sVarNote = EgtGetInfo( nPkJoin2, 'MVar')
nPkJoin3 = EgtCurveCompo( Lg, {nPkJoin2,nPkToJoin4}, true)
else
nPkJoin3 = EgtCurveCompo( Lg, {nPkToJoin3,nPkToJoin4}, true)
end
if nPkJoin3 then
if nPkJoin2 then
if sVarNote then EgtSetInfo( nPkJoin3, 'MVar', sVarNote) end
if nPkJoin then
EgtSetName( nPkJoin3, LM)
else
EgtSetName( nPkJoin3, LA2)
end
-- se mantiene centro spessore anche su face
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin3) -- setto 'c' perchè viene mantenuto il centro spessore
SetProbeProperty( kbs, 0, pbs, 'c', nGeom4) -- setto 'c' perchè viene mantenuto il centro spessore
else
EgtSetName( nPkJoin3, LA3)
-- se mantiene centro spessore su mortise
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin3) -- setto 'c' perchè viene mantenuto il centro spessore
end
EgtSetInfo( nPkJoin3, 'SideDoor', 'Lock')
EgtSetInfo( nPkJoin3, 'NotCheckDir', '1')
else
EC = ErrorBase + 60
EM = string.format(EgtDoorsMsg[426], sCompoPath)
end
end
-- se ho doppia terza cava inversa senza match
if EC == 0 and nPkToJoin3_r and nPkToJoin4_r then
local sVarNote
if nPkJoin2_rev then -- se fatto concatenamento con face
-- recupero la nota delle variazioni dalla geometria del face
sVarNote = EgtGetInfo( nPkJoin2_rev, 'MVar')
nPkJoin3_rev = EgtCurveCompo( Lg, {nPkJoin2_rev,nPkToJoin4_r}, true)
else
nPkJoin3_rev = EgtCurveCompo( Lg, {nPkToJoin3_r,nPkToJoin4_r}, true)
end
if nPkJoin3_rev then
if nPkJoin2_rev then
if sVarNote then EgtSetInfo( nPkJoin3_rev, 'MVar', sVarNote) end
if nPkJoin_rev then
EgtSetName( nPkJoin3_rev, LM..'R')
else
EgtSetName( nPkJoin3_rev, LA2..'R')
end
-- se mantiene centro spessore anche su face
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin3_rev) -- setto 'c' perchè viene mantenuto il centro spessore
SetProbeProperty( kbs, 0, pbs, 'c', nGeom4) -- setto 'c' perchè viene mantenuto il centro spessore
else
EgtSetName( nPkJoin3_rev, LA3..'R')
-- se mantiene centro spessore su mortise
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin3_rev) -- setto 'c' perchè viene mantenuto il centro spessore
end
EgtSetInfo( nPkJoin3_rev, 'SideDoor', 'Lock')
EgtSetInfo( nPkJoin3_rev, 'NotCheckDir', '1')
else
EC = ErrorBase + 61
EM = string.format(EgtDoorsMsg[425], sCompoPath)
end
end
else -- se ho il match con tra le mortase
-- se ho doppia cava e matchano con le 4 cave concateno con la seconda mortasa
if EC == 0 and nPkToJoin1 and nPkToJoin3 then
local sVarNote
if nPkJoin then -- se fatto concatenamento con face
-- recupero la nota delle variazioni dalla geometria del face
sVarNote = EgtGetInfo( nPkJoin, 'MVar')
nPkJoin1 = EgtCurveCompo( Lg, {nPkJoin,nPkToJoin3}, true)
else
nPkJoin1 = EgtCurveCompo( Lg, {nPkToJoin1,nPkToJoin3}, true)
end
if nPkJoin1 then
if nPkJoin then
if sVarNote then EgtSetInfo( nPkJoin1, 'MVar', sVarNote) end
EgtSetName( nPkJoin1, LM)
-- se mantiene centro spessore anche su face
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin1) -- setto 'c' perchè viene mantenuto il centro spessore
SetProbeProperty( kbs, 0, pbs, 'c', nGeom3) -- setto 'c' perchè viene mantenuto il centro spessore
else
EgtSetName( nPkJoin1, LA2)
-- se mantiene centro spessore su mortise
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin1) -- setto 'c' perchè viene mantenuto il centro spessore
end
EgtSetInfo( nPkJoin1, 'SideDoor', 'Lock')
EgtSetInfo( nPkJoin1, 'NotCheckDir', '1')
else
EC = ErrorBase + 62
EM = string.format(EgtDoorsMsg[426], sCompoPath)
end
end
-- se ho doppia cava inversa con match tra le mortase
if EC == 0 and nPkToJoin1_r and nPkToJoin3_r then
local sVarNote
if nPkJoin_rev then -- se fatto concatenamento con face
-- recupero la nota delle variazioni dalla geometria del face
sVarNote = EgtGetInfo( nPkJoin_rev, 'MVar')
nPkJoin1_rev = EgtCurveCompo( Lg, {nPkJoin_rev,nPkToJoin3_r}, true)
else
nPkJoin1_rev = EgtCurveCompo( Lg, {nPkToJoin1_r,nPkToJoin3_r}, true)
end
if nPkJoin1_rev then
if nPkJoin_rev then
if sVarNote then EgtSetInfo( nPkJoin1_rev, 'MVar', sVarNote) end
EgtSetName( nPkJoin1_rev, LM..'R')
-- se mantiene centro spessore anche su face
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin1_rev) -- setto 'c' perchè viene mantenuto il centro spessore
SetProbeProperty( kbs, 0, pbs, 'c', nGeom3) -- setto 'c' perchè viene mantenuto il centro spessore
else
EgtSetName( nPkJoin1_rev, LA2..'R')
-- se mantiene centro spessore su mortise
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin1_rev) -- setto 'c' perchè viene mantenuto il centro spessore
end
EgtSetInfo( nPkJoin1_rev, 'SideDoor', 'Lock')
EgtSetInfo( nPkJoin1_rev, 'NotCheckDir', '1')
else
EC = ErrorBase + 63
EM = string.format(EgtDoorsMsg[425], sCompoPath)
end
end
-- se ho seconda cava con match
if jn2 and EC == 0 and nPkToJoin2 then
if nPkJoin1 then -- se riuscito precedente concatenamento
-- recupero la nota delle variazioni dalla geometria del face
local sVarNote = EgtGetInfo( nPkJoin1, 'MVar')
nPkJoin2 = EgtCurveCompo( Lg, {nPkJoin1,nPkToJoin2}, true)
if nPkJoin2 then
if nPkJoin then -- se riuscito primo concatenamento
if sVarNote then EgtSetInfo( nPkJoin2, 'MVar', sVarNote) end
EgtSetName( nPkJoin2, LM)
-- se mantiene centro spessore anche su face
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin2) -- setto 'c' perchè viene mantenuto il centro spessore
SetProbeProperty( kbs, 0, pbs, 'c', nGeom2) -- setto 'c' perchè viene mantenuto il centro spessore
else
EgtSetName( nPkJoin2, LA2)
-- se mantiene centro spessore su mortise
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin2) -- setto 'c' perchè viene mantenuto il centro spessore
end
EgtSetInfo( nPkJoin2, 'SideDoor', 'Lock')
EgtSetInfo( nPkJoin2, 'NotCheckDir', '1')
else
EC = ErrorBase + 64
EM = string.format(EgtDoorsMsg[426], sCompoPath)
end
else
local sVarNote
if nPkJoin then -- se riuscito primo concatenamento
-- recupero la nota delle variazioni dalla geometria del face
sVarNote = EgtGetInfo( nPkJoin, 'MVar')
nPkJoin2 = EgtCurveCompo( Lg, {nPkJoin,nPkToJoin2}, true)
elseif nPkToJoin3 then
nPkJoin2 = EgtCurveCompo( Lg, {nPkToJoin3,nPkToJoin2}, true)
end
if nPkJoin2 then
if sVarNote then EgtSetInfo( nPkJoin2, 'MVar', sVarNote) end
EgtSetName( nPkJoin2, LA2)
-- se mantiene centro spessore su mortise
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin2) -- setto 'c' perchè viene mantenuto il centro spessore
EgtSetInfo( nPkJoin2, 'SideDoor', 'Lock')
EgtSetInfo( nPkJoin2, 'NotCheckDir', '1')
else
EC = ErrorBase + 65
EM = string.format(EgtDoorsMsg[426], sCompoPath)
end
end
end
-- se ho seconda cava inversa con match
if jn2 and EC == 0 and nPkToJoin2_r then
if nPkJoin1_rev then -- se riuscito precedente concatenamento
-- recupero la nota delle variazioni dalla geometria del face
local sVarNote = EgtGetInfo( nPkJoin1_rev, 'MVar')
nPkJoin2_rev = EgtCurveCompo( Lg, {nPkJoin1_rev,nPkToJoin2_r}, true)
if nPkJoin2_rev then
if nPkJoin_rev then -- se riuscito primo concatenamento
if sVarNote then EgtSetInfo( nPkJoin2_rev, 'MVar', sVarNote) end
EgtSetName( nPkJoin2_rev, LM..'R')
-- se mantiene centro spessore anche su face
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin2_rev) -- setto 'c' perchè viene mantenuto il centro spessore
SetProbeProperty( kbs, 0, pbs, 'c', nGeom2) -- setto 'c' perchè viene mantenuto il centro spessore
else
EgtSetName( nPkJoin2_rev, LA2..'R')
-- se mantiene centro spessore su mortise
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin2_rev) -- setto 'c' perchè viene mantenuto il centro spessore
end
EgtSetInfo( nPkJoin2_rev, 'SideDoor', 'Lock')
EgtSetInfo( nPkJoin2_rev, 'NotCheckDir', '1')
else
EC = ErrorBase + 66
EM = string.format(EgtDoorsMsg[425], sCompoPath)
end
else
local sVarNote
if nPkJoin_rev then -- se riuscito primo concatenamento
-- recupero la nota delle variazioni dalla geometria del face
sVarNote = EgtGetInfo( nPkJoin_rev, 'MVar')
nPkJoin2_rev = EgtCurveCompo( Lg, {nPkJoin_rev,nPkToJoin2_r}, true)
elseif nPkToJoin3_r then
nPkJoin2_rev = EgtCurveCompo( Lg, {nPkToJoin3_r,nPkToJoin2_r}, true)
end
if nPkJoin2_rev then
if sVarNote then EgtSetInfo( nPkJoin2_rev, 'MVar', sVarNote) end
EgtSetName( nPkJoin2_rev, LA2..'R')
-- se mantiene centro spessore su mortise
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin2_rev) -- setto 'c' perchè viene mantenuto il centro spessore
EgtSetInfo( nPkJoin2_rev, 'SideDoor', 'Lock')
EgtSetInfo( nPkJoin2_rev, 'NotCheckDir', '1')
else
EC = ErrorBase + 67
EM = string.format(EgtDoorsMsg[425], sCompoPath)
end
end
end
-- se ho doppia terza cava con match
if EC == 0 and nPkToJoin2 and nPkToJoin4 then
local sVarNote
if nPkJoin2 then -- se fatto concatenamento con face
-- recupero la nota delle variazioni dalla geometria del face
sVarNote = EgtGetInfo( nPkJoin2, 'MVar')
nPkJoin3 = EgtCurveCompo( Lg, {nPkJoin2,nPkToJoin4}, true)
else
nPkJoin3 = EgtCurveCompo( Lg, {nPkToJoin2,nPkToJoin4}, true)
end
if nPkJoin3 then
if nPkJoin2 then
if sVarNote then EgtSetInfo( nPkJoin3, 'MVar', sVarNote) end
if nPkJoin then
EgtSetName( nPkJoin3, LM)
else
EgtSetName( nPkJoin3, LA2)
end
-- se mantiene centro spessore anche su face
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin3) -- setto 'c' perchè viene mantenuto il centro spessore
SetProbeProperty( kbs, 0, pbs, 'c', nGeom4) -- setto 'c' perchè viene mantenuto il centro spessore
else
EgtSetName( nPkJoin3, LA3)
-- se mantiene centro spessore su mortise
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin3) -- setto 'c' perchè viene mantenuto il centro spessore
end
EgtSetInfo( nPkJoin3, 'SideDoor', 'Lock')
EgtSetInfo( nPkJoin3, 'NotCheckDir', '1')
else
EC = ErrorBase + 68
EM = string.format(EgtDoorsMsg[426], sCompoPath)
end
end
-- se ho doppia terza cava inversa con match
if EC == 0 and nPkToJoin2_r and nPkToJoin4_r then
local sVarNote
if nPkJoin2_rev then -- se fatto concatenamento con face
-- recupero la nota delle variazioni dalla geometria del face
sVarNote = EgtGetInfo( nPkJoin2_rev, 'MVar')
nPkJoin3_rev = EgtCurveCompo( Lg, {nPkJoin2_rev,nPkToJoin4_r}, true)
else
nPkJoin3_rev = EgtCurveCompo( Lg, {nPkToJoin2_r,nPkToJoin4_r}, true)
end
if nPkJoin3_rev then
if nPkJoin2_rev then
if sVarNote then EgtSetInfo( nPkJoin3_rev, 'MVar', sVarNote) end
if nPkJoin_rev then
EgtSetName( nPkJoin3_rev, LM..'R')
else
EgtSetName( nPkJoin3_rev, LA2..'R')
end
-- se mantiene centro spessore anche su face
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin3_rev) -- setto 'c' perchè viene mantenuto il centro spessore
SetProbeProperty( kbs, 0, pbs, 'c', nGeom4) -- setto 'c' perchè viene mantenuto il centro spessore
else
EgtSetName( nPkJoin3_rev, LA3..'R')
-- se mantiene centro spessore su mortise
SetProbeProperty( kbs, 0, pbs, 'c', nPkJoin3_rev) -- setto 'c' perchè viene mantenuto il centro spessore
end
EgtSetInfo( nPkJoin3_rev, 'SideDoor', 'Lock')
EgtSetInfo( nPkJoin3_rev, 'NotCheckDir', '1')
else
EC = ErrorBase + 69
EM = string.format(EgtDoorsMsg[425], sCompoPath)
end
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 + 51
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
SetProbeProperty( kbs, 1, pbs, 'x', nNewEnt) -- setto 'x' perchè viene mantenuto il centro spessore
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
SetProbeProperty( kbs, 1, pbs, 'x', nNewEnt) -- setto 'x' provvisoriamente
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
SetProbeProperty( kbs, 1, pbs, 'x', nNewEnt) -- setto 'x' provvisoriamente
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
-- 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]
-- 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 indicaa 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
-- 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]
-- 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)
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 indicaa 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)) 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')
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
SetProbeProperty( kbs, 1, pbs, 'x', hint_13, true, TR10, DGD.dT) -- setto 'x' perchè non si sa ancora da quale parte viene applicato
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 indicaa cosa è riferita, false: per backset true: per door side
-- setto nota per correzione profondità con probe
-- se mantiene profondità e non è a spessore passante
SetProbeProperty( kbs, 1, pbs, 'x', hint_13, true, TL10, DGD.dT) -- setto 'x' perchè non si sa ancora da quale parte viene applicato
end
end
end
-- 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]
-- 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 indicaa 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
-- 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]
-- 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)
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 indicaa 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)) 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')
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
SetProbeProperty( kbs, 1, pbs, 'x', hint_13, true, TR10, DGD.dT) -- setto 'x' perchè non si sa ancora da quale parte viene applicato
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 indicaa cosa è riferita, false: per backset true: per door side
-- setto nota per correzione profondità con probe
-- se mantiene profondità e non è a spessore passante
SetProbeProperty( kbs, 1, pbs, 'x', hint_13, true, TL10, DGD.dT) -- setto 'x' perchè non si sa ancora da quale parte viene applicato
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 not dws then -- se frame viene disposto sul lato narrow o è sulla porta(disposto sul lato stretto)
-- se la sezione strike supera 1/6 dello spessore porta (se è un frame drf vale 0.1 e crea sempre regione)
-- disegno sezione ribasso su faccia superiore/inferiore porta
if fhb > drf then
-- setto griglia dietro per l'ingombro sicuramente esistente
EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.BACK))
local nIdSideBoxUp
local nIdSideBoxUp2
if LS > 0 then
nIdSideBoxUp = EgtRectangle2P( Lg, Point3d(-(L/2)+D_SS,0,((H/2)+HS)), Point3d(-(L/2)+D_SS+LS,-fhb,((H/2)+HS)), GDB_RT.GRID)
if IS > 0 then
nIdSideBoxUp2 = EgtRectangle2P( Lg, Point3d(-(L/2)+D_SS+IS,0,((H/2)+HS)), Point3d(-(L/2)+D_SS+IS+LS,-fhb,((H/2)+HS)), GDB_RT.GRID)
end
end
if nIdSideBoxUp then
EgtModifyCurveThickness(nIdSideBoxUp, -(HS+H))
EgtSetName( nIdSideBoxUp, 'upper')
EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper')
end
if nIdSideBoxUp2 then
EgtModifyCurveThickness(nIdSideBoxUp2, -(HS+H))
EgtSetName( nIdSideBoxUp2, 'upper')
EgtSetInfo( nIdSideBoxUp2, 'SideDoor', 'upper')
end
EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP))
end
--debug
-- EgtSaveFile()
-- EgtMove(DGD.PZ, Point3d(0,0,nil) - ORIG())
else -- altrimenti frame viene disposto sul lato wide
local nIdSideBoxUp
if nGeom1st then
nIdSideBoxUp = EgtCopyGlob( nGeom1st, Lg)
EgtSetName( nIdSideBoxUp, 'upper')
EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper')
end
if nGeom2st then
nIdSideBoxUp = EgtCopyGlob( nGeom2st, Lg)
EgtSetName( nIdSideBoxUp, 'upper')
EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper')
end
if nGeom1 then
nIdSideBoxUp = EgtCopyGlob( nGeom1, Lg)
EgtSetName( nIdSideBoxUp, 'upper')
EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper')
end
if nGeom2 then
nIdSideBoxUp = EgtCopyGlob( nGeom2, Lg)
EgtSetName( nIdSideBoxUp, 'upper')
EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper')
end
if nGeom3 then
nIdSideBoxUp = EgtCopyGlob( nGeom3, Lg)
EgtSetName( nIdSideBoxUp, 'upper')
EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper')
end
if nGeom4 then
nIdSideBoxUp = EgtCopyGlob( nGeom4, 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 hint_3 then
nIdSideBoxUp = EgtCopyGlob( hint_3, Lg)
EgtSetName( nIdSideBoxUp, 'upper')
EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper')
end
if hint_4 then
nIdSideBoxUp = EgtCopyGlob( hint_4, Lg)
EgtSetName( nIdSideBoxUp, 'upper')
EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper')
end
if hint_5 then
nIdSideBoxUp = EgtCopyGlob( hint_5, Lg)
EgtSetName( nIdSideBoxUp, 'upper')
EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper')
end
if hint_6 then
nIdSideBoxUp = EgtCopyGlob( hint_6, Lg)
EgtSetName( nIdSideBoxUp, 'upper')
EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper')
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
end
end
if EC == 0 and D_XE and D_XE ~= 0 then
EgtMove( Lg, Point3d(0,D_XE,0) - ORIG())
end
-- Se non Preview
if not bPreview and EC == 0 then
if bRunByCompo then
-- scrivo i parametri nelle info del pezzo
WriteCompoDataToPart(Pz,sCompoName,nCompoNpar)
end
-- scrivo note nel layer della cerniera
EgtSetInfo( Lg, 'Type' ,'Strike')
EgtSetInfo( Lg, 'Nome' ,sCompoName)
EgtSetInfo( Lg, 'L' ,L)
EgtSetInfo( Lg, 'H' ,H)
EgtSetInfo( Lg, 'T' ,T)
EgtSetInfo( Lg, 'LS' ,LS)
EgtSetInfo( Lg, 'HS' ,HS)
EgtSetInfo( Lg, 'AS' ,AS)
EgtSetInfo( Lg, 'IS' ,IS)
EgtSetInfo( Lg, 'D_SS' ,D_SS)
EgtSetInfo( Lg, 'rs' ,rs)
EgtSetInfo( Lg, 'ls' ,ls)
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, 'da' ,da)
EgtSetInfo( Lg, 'ech' ,ech)
EgtSetInfo( Lg, 'clc' ,clc)
EgtSetInfo( Lg, 'ccr' ,ccr)
EgtSetInfo( Lg, 'mh' ,mh)
EgtSetInfo( Lg, 'L2' ,L2)
EgtSetInfo( Lg, 'H2' ,H2)
EgtSetInfo( Lg, 'T2' ,T2)
EgtSetInfo( Lg, 'I2' ,I2)
EgtSetInfo( Lg, 'HB2' ,HB2)
EgtSetInfo( Lg, 'TB2' ,TB2)
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, 'L3' ,L3)
EgtSetInfo( Lg, 'H3' ,H3)
EgtSetInfo( Lg, 'T3' ,T3)
EgtSetInfo( Lg, 'I3' ,I3)
EgtSetInfo( Lg, 'd3' ,d3)
EgtSetInfo( Lg, 'p3' ,p3)
EgtSetInfo( Lg, 's3' ,s3)
EgtSetInfo( Lg, 'est' ,est)
EgtSetInfo( Lg, 'kbs' ,kbs)
EgtSetInfo( Lg, 'pbs' ,pbs)
EgtSetInfo( Lg, 'invG' ,invG)
EgtSetInfo( Lg, 'posh' ,posh)
EgtSetInfo( Lg, 'posp' ,posp)
EgtSetInfo( Lg, 'mkrev' ,mkrev)
EgtSetInfo( Lg, 'jn' ,jn)
EgtSetInfo( Lg, 'jn2' ,jn2)
EgtSetInfo( Lg, 'jnb' ,jnb)
EgtSetInfo( Lg, 'fht' ,fht)
EgtSetInfo( Lg, 'fhb' ,fhb)
EgtSetInfo( Lg, 'drf' ,drf)
EgtSetInfo( Lg, 'dws' ,dws)
EgtSetInfo( Lg, 'dthd' ,dthd)
EgtSetInfo( Lg, 'SL' ,SL)
EgtSetInfo( Lg, 'D_X' ,D_X)
EgtSetInfo( Lg, 'D_X3' ,D_X3)
EgtSetInfo( Lg, 'DH_X' ,DH_X)
EgtSetInfo( Lg, 'D_XE' ,D_XE)
EgtSetInfo( Lg, 'CustGeomFile' ,CustGeomFile)
EgtSetInfo( Lg, 'CustGeomPath' ,CustGeomPath)
EgtSetInfo( Lg, 'LG' ,LG)
EgtSetInfo( Lg, 'LG2' ,LG2)
EgtSetInfo( Lg, 'LG3' ,LG3)
EgtSetInfo( Lg, 'LM' ,LM)
EgtSetInfo( Lg, 'LA' ,LA)
EgtSetInfo( Lg, 'LA2' ,LA2)
EgtSetInfo( Lg, 'LA3' ,LA3)
EgtSetInfo( Lg, 'CH' ,CH)
EgtSetInfo( Lg, 'CLC' ,CLC)
EgtSetInfo( Lg, 'LGH' ,LGH)
EgtSetInfo( Lg, 'LMP' ,LMP)
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 Strike