cc55202ec5
- primo commit con versione corrente.
1684 lines
67 KiB
Lua
1684 lines
67 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
|
|
--
|
|
-- ConcealedHinge.lua by EgalWare s.r.l. 2016.06.14
|
|
-- Autore: Filippo Monchi
|
|
-- Concealed Hinge dati i valori 'L' e 'H' e 'T' e 'L2' e 'T2' e 'd' e 'p' e 'P' e con nomi attributi
|
|
|
|
-- 2016.09.21 V1.011 FM add warning messages
|
|
-- 2017.12.08 V1.012 FM Manage offset position on probe geometry and duplicate it for manage probe when door is placed on left or right position
|
|
-- 2018.01.11 V1.013 FM Manage new extra bore parameters (4 couples of bores)
|
|
-- 2018.04.05 V1.014 FM Manage info (KeepBackSet) for adjust probe on Z
|
|
-- 2018.10.17 V1.015 FM Add parameter to show into message 402
|
|
-- 2018.10.22 V1.016 FM Manage better the big radius fillet parameter
|
|
-- 2018.11.09 V1.017 FM Manage flag to enable/disable rotation on profile on extra bores
|
|
-- 2018.11.12 V1.018 FM To be compatible to new geometry movement into Main,
|
|
-- move any geometries instead of move only layer
|
|
-- 2019.10.02 V1.019 FM Manage steel option (disable to generate pocket paths, mortise)
|
|
-- 2019.10.18 V2.000 FM Manage use Materials
|
|
-- 2019.10.21 V2.001 FM Modify the closed path start point for steel material
|
|
-- 2019.10.21 V2.001 FM Add Button hole geometry and its machining path (only for steel material)
|
|
-- 2019.10.24 V2.002 FM Add clean corner geometries
|
|
-- 2019.12.18 V2.003 FM Use new parameter DGC.Eah that allow insert template also on bullnose ans convex profiles
|
|
-- 2020.04.29 V2.004 FM Update for aluminum material
|
|
-- 2020.05.04 V2.005 FM Manage extra bores as Mortise hinge component
|
|
-- 2020.05.25 V2.006 FM Manage geometries for calculate region when frame(jamb) is disposed on wide side
|
|
-- 2020.05.25 V2.007 FM Manage new parameter mfp and jnb
|
|
-- 2020.07.01 V2.008 FM Disable Warning message on frames if parameter DGD.Spd is <= 0
|
|
-- 2021.01.22 V3.000 FM Manage better checking error on tools and dimension when produce flag is false
|
|
-- 2021.03.12 V3.001 FM Manage rotation parameters on extra bores/buttonhole
|
|
-- 2021.11.24 V3.002 FM Manage side probe option if variable DGC.Pms > 2
|
|
-- 2022.07.27 V3.003 FM Modification to use compiled code
|
|
-- 2022.12.06 V3.004 FM Manage (by new nNewType variable) the extra bores rotation around 2 interax (along door heigh (local X) and alog door thickness (local Y))
|
|
-- 2024.07.19 V3.005 FM Set note 'NotCheckDir' to pocketing and buttonhole pocketing paths
|
|
-- 2024.10.29 V3.006 FM Manage new DGC.Fpd CurrDoorCustomData variable to force shuttle probe geometry to stay horizontal
|
|
-- 2025.03.11 V3.021 DS Backset reference side from DGC.ChBsNs.
|
|
|
|
-- Tavola per definizione modulo (serve ma non usata)
|
|
local ConcealedHinge = {}
|
|
|
|
-- 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 nNewType = 1
|
|
|
|
local function DrawAddLineDrawCircle( pInitial, pFinal, nGroup, idTable, bPrev, nGroupCirc,
|
|
nRad, bDrawFirst, bDrawLast, cColor1, cColor2, sMVar)
|
|
|
|
local nLine = EgtLine(nGroup, pInitial, pFinal, GDB_RT.LOC)
|
|
local nNumLine
|
|
|
|
if idTable then
|
|
table.insert( idTable, nLine)
|
|
-- se devo inserire una variazione nell'entità
|
|
if sMVar then
|
|
nNumLine = #idTable
|
|
end
|
|
end
|
|
|
|
if bPrev then
|
|
if bDrawFirst then
|
|
local nCircle1 = EgtCircle( nGroupCirc, pInitial, nRad , GDB_RT.LOC)
|
|
EgtSetColor( nCircle1, cColor1)
|
|
end
|
|
|
|
if bDrawLast then
|
|
local nCircle2 = EgtCircle( nGroupCirc, pFinal, nRad , GDB_RT.LOC)
|
|
EgtSetColor( nCircle2, cColor2)
|
|
end
|
|
end
|
|
|
|
return nLine, nNumLine, sMVar
|
|
end
|
|
|
|
local function DrawAddCircleDrawCircle( pCenter, dRadius, dAngIni, dAngCen, nGroup, idTable, bPrev, nGroupCirc,
|
|
nRad, bDrawFirst, bDrawLast, cColor1, cColor2, sMVar)
|
|
|
|
local nCircle = EgtArc( nGroup, pCenter, dRadius, dAngIni, dAngCen, 0, GDB_RT.LOC)
|
|
local nNumCircle
|
|
|
|
if idTable then
|
|
table.insert( idTable, nCircle)
|
|
-- se devo inserire una variazione nell'entità
|
|
if sMVar then
|
|
nNumCircle = #idTable
|
|
end
|
|
end
|
|
|
|
if bPrev then
|
|
if bDrawFirst then
|
|
local nCircle1 = EgtCircle( nGroupCirc, EgtSP( nCircle), nRad , GDB_RT.LOC)
|
|
EgtSetColor( nCircle1, cColor1)
|
|
end
|
|
|
|
if bDrawLast then
|
|
local nCircle2 = EgtCircle( nGroupCirc, EgtEP( nCircle), nRad , GDB_RT.LOC)
|
|
EgtSetColor( nCircle2, cColor2)
|
|
end
|
|
end
|
|
|
|
return nCircle, nNumCircle, sMVar
|
|
end
|
|
|
|
local function GetMachToolErrorMessage( nErrorId, sGeomName, dIdMach, dOriDiamTool, nIdLogErr, sMchngName)
|
|
|
|
local EgtDoorsMsg = require( 'EgtDoorsMsg')
|
|
local sMessage = ''
|
|
|
|
if dOriDiamTool then
|
|
if nErrorId == -1 then -- lavorazione non presente in tabella
|
|
sMessage = string.format(EgtDoorsMsg[466], nIdLogErr, dIdMach, sGeomName, EgtToUiUnits( dOriDiamTool))
|
|
elseif nErrorId == -2 then -- errore nel settare la lavorazione, lavorazione non presente in libreria
|
|
sMessage = string.format(EgtDoorsMsg[467], nIdLogErr, sMchngName, dIdMach, sGeomName, EgtToUiUnits( dOriDiamTool))
|
|
elseif nErrorId == -3 then -- errore nell'acquisire parametri lavorazione
|
|
sMessage = string.format(EgtDoorsMsg[468], nIdLogErr, sMchngName, dIdMach, sGeomName, EgtToUiUnits( dOriDiamTool))
|
|
elseif nErrorId == -4 then -- errore nell'acquisire parametri lavorazione
|
|
sMessage = string.format(EgtDoorsMsg[469], nIdLogErr, sMchngName, dIdMach, sGeomName, EgtToUiUnits( dOriDiamTool))
|
|
elseif nErrorId == -5 then -- diametro utensile non trovato
|
|
sMessage = string.format(EgtDoorsMsg[470], nIdLogErr, sMchngName, dIdMach, sGeomName, EgtToUiUnits( dOriDiamTool))
|
|
elseif nErrorId == -6 then -- nome geometria non presente in tabella
|
|
sMessage = string.format(EgtDoorsMsg[471], nIdLogErr, sGeomName, EgtToUiUnits( dOriDiamTool))
|
|
elseif nErrorId == -7 then -- altezza massima utensile non trovata
|
|
sMessage = string.format(EgtDoorsMsg[472], nIdLogErr, sMchngName, dIdMach, sGeomName, EgtToUiUnits( dOriDiamTool))
|
|
elseif nErrorId == -8 then -- tabella non presente nelle note
|
|
sMessage = string.format(EgtDoorsMsg[509], nIdLogErr)
|
|
end
|
|
elseif nErrorId == -1 then -- lavorazione non presente in tabella
|
|
sMessage = string.format(EgtDoorsMsg[504], nIdLogErr, dIdMach, sGeomName)
|
|
elseif nErrorId == -2 then -- errore nel settare la lavorazione
|
|
sMessage = string.format(EgtDoorsMsg[505], nIdLogErr, sMchngName, dIdMach, sGeomName)
|
|
elseif nErrorId == -3 then -- errore nell'acquisire parametri lavorazione
|
|
sMessage = string.format(EgtDoorsMsg[506], nIdLogErr, sMchngName, dIdMach, sGeomName)
|
|
elseif nErrorId == -4 then -- errore nell'acquisire parametri lavorazione
|
|
sMessage = string.format(EgtDoorsMsg[507], nIdLogErr, sMchngName, dIdMach, sGeomName)
|
|
elseif nErrorId == -5 then -- diametro utensile non trovato
|
|
sMessage = string.format(EgtDoorsMsg[508], nIdLogErr, sMchngName, dIdMach, sGeomName)
|
|
elseif nErrorId == -6 then -- nome geometria non presente in tabella
|
|
sMessage = string.format(EgtDoorsMsg[503], nIdLogErr, sGeomName)
|
|
elseif nErrorId == -7 then -- altezza massima utensile non trovata
|
|
sMessage = string.format(EgtDoorsMsg[473], nIdLogErr, sMchngName, dIdMach, sGeomName)
|
|
elseif nErrorId == -8 then -- tabella non presente nelle note
|
|
sMessage = string.format(EgtDoorsMsg[509], nIdLogErr)
|
|
end
|
|
|
|
return sMessage
|
|
end
|
|
|
|
-- Funzione creazione foro o asola o rampa per asola
|
|
local function MakeBoreOrButtoHole( Lg, bPreview, Dm, nDrawMach, IY10,
|
|
EBH10, EB10, PX10, Int10, dIntT10,
|
|
D10, dParH, PY10, T10, RP10,
|
|
AR10, RCI10, kbs, bEqualTh, HB10,
|
|
dws, pbs, RCIT10)
|
|
|
|
local pIni, pEnd, pCen
|
|
local hint3, hint5
|
|
local tPath = {}
|
|
local tPathPok = {}
|
|
|
|
if IY10 > 0 and EBH10 ~= '' then -- se parametri asola presenti
|
|
|
|
pIni = Point3d((PX10+Int10+(D10/2)),(dParH+dIntT10+PY10),0)
|
|
pEnd = Point3d((PX10+Int10+(D10/2)),(dParH+dIntT10+PY10-(IY10/2)),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
pEnd = Point3d((PX10+Int10-(D10/2)),(dParH+dIntT10+PY10-(IY10/2)),0)
|
|
pCen = Point3d((PX10+Int10),(dParH+dIntT10+PY10-(IY10/2)),0)
|
|
DrawAddCircleDrawCircle( pCen, (D10/2), 0,-180, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
pEnd = Point3d((PX10+Int10-(D10/2)),(dParH+dIntT10+PY10+(IY10/2)),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
pEnd = Point3d((PX10+Int10+(D10/2)),(dParH+dIntT10+PY10+(IY10/2)),0)
|
|
pCen = Point3d((PX10+Int10),(dParH+dIntT10+PY10+(IY10/2)),0)
|
|
DrawAddCircleDrawCircle( pCen, (D10/2), 180,-180, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
pEnd = Point3d((PX10+Int10+(D10/2)),(dParH+dIntT10+PY10),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
hint3 = EgtCurveCompo( Lg, tPath, true)
|
|
EgtModifyCurveThickness( hint3, -T10)
|
|
|
|
-- se rotazione attiva
|
|
if AR10 ~= 0 then
|
|
-- rotazione in centro a entrambe gli interassi
|
|
if RCI10 and RCIT10 then
|
|
EgtRotate( hint3, Point3d((PX10),(dParH+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto
|
|
-- rotazione in centro all'interasse lungo l'altezza porta (X locale)
|
|
elseif RCI10 then
|
|
-- nuova rotazione, solo attornoo all'interasse X locale (ma non sulla Y locale)
|
|
if nNewType and nNewType > 0 then
|
|
EgtRotate( hint3, Point3d((PX10),(dParH+dIntT10+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto
|
|
-- vecchia rotazione in centro all'interasse X e Y locale
|
|
else
|
|
EgtRotate( hint3, Point3d((PX10),(dParH+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto
|
|
end
|
|
-- rotazione in centro all'interasse lungo lo sspessore porta (Y locale)
|
|
elseif RCIT10 then
|
|
EgtRotate( hint3, Point3d((PX10+Int10),(dParH+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto
|
|
-- rotazione in centro all'asola
|
|
else
|
|
EgtRotate( hint3, Point3d((PX10+Int10),(dParH+dIntT10+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto
|
|
end
|
|
end
|
|
|
|
if nDrawMach > 0 and RP10 and RP10 > 0 and (RP10/2) < T10 then --se parametro step è valido, creo il percorso a zig-zag centrale
|
|
|
|
EgtSetName( hint3,'_'..EBH10) -- aggiungo _ per disabilitare lavorazione
|
|
local nStep = ceil(T10/RP10) -- numero di passate
|
|
local dStep = (T10/nStep) -- passo ricalcolato
|
|
local nPass = 1
|
|
local dZedStart = 0
|
|
local dZedWork
|
|
local nInv = 1
|
|
|
|
pIni = Point3d((PX10+Int10),(dParH+dIntT10+PY10+((IY10/2)*nInv)),dZedStart)
|
|
|
|
while nPass <= nStep do
|
|
|
|
dZedWork = dZedStart - (dStep/2)
|
|
nInv = -nInv
|
|
pEnd = Point3d((PX10+Int10),(dParH+dIntT10+PY10+((IY10/2)*nInv)),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPathPok, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
dZedWork = dZedStart - dStep
|
|
nInv = -nInv
|
|
pEnd = Point3d((PX10+Int10),(dParH+dIntT10+PY10+((IY10/2)*nInv)),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPathPok, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
|
|
-- se ho altri passi scendo in z
|
|
if nPass < nStep then
|
|
dZedStart = dZedWork
|
|
end
|
|
nPass = nPass + 1
|
|
end
|
|
-- faccio passata di ritorno
|
|
nInv = -nInv
|
|
pEnd = Point3d((PX10+Int10),(dParH+dIntT10+PY10+((IY10/2)*nInv)),-T10)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPathPok, bPreview, Dm, 0, false, false, RED(), RED())
|
|
|
|
hint5 = EgtCurveCompo( Lg, tPathPok, true)
|
|
EgtModifyCurveThickness( hint5, 0)
|
|
EgtSetName( hint5, EBH10)
|
|
EgtSetInfo( hint5, 'NotCheckDir', '1')
|
|
|
|
-- se rotazione attiva
|
|
if AR10 ~= 0 then
|
|
-- rotazione in centro a entrambe gli interassi
|
|
if RCI10 and RCIT10 then
|
|
EgtRotate( hint5, Point3d((PX10),(dParH+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto
|
|
-- rotazione in centro all'interasse lungo l'altezza porta (X locale)
|
|
elseif RCI10 then
|
|
-- nuova rotazione, solo attornoo all'interasse X locale (ma non sulla Y locale)
|
|
if nNewType and nNewType > 0 then
|
|
EgtRotate( hint5, Point3d((PX10),(dParH+dIntT10+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto
|
|
-- vecchia rotazione in centro all'interasse X e Y locale
|
|
else
|
|
EgtRotate( hint5, Point3d((PX10),(dParH+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto
|
|
end
|
|
-- rotazione in centro all'interasse lungo lo sspessore porta (Y locale)
|
|
elseif RCIT10 then
|
|
EgtRotate( hint5, Point3d((PX10+Int10),(dParH+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto
|
|
-- rotazione in centro all'asola
|
|
else
|
|
EgtRotate( hint5, Point3d((PX10+Int10),(dParH+dIntT10+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto
|
|
end
|
|
end
|
|
else
|
|
EgtSetName( hint3, EBH10)
|
|
end
|
|
elseif EB10 ~= '' then
|
|
hint3 = EgtCircle( Lg, Point3d((PX10+Int10),(dParH+dIntT10+PY10),0), D10/2 , GDB_RT.LOC)
|
|
EgtModifyCurveThickness( hint3, -T10)
|
|
EgtSetName( hint3, EB10)
|
|
-- se rotazione in centro all'interasse (solo questo caso perchè non ha senso ruotare un foro in centro a se stesso)
|
|
if AR10 ~= 0 then
|
|
-- rotazione in centro a entrambe gli interassi
|
|
if RCI10 and RCIT10 then
|
|
EgtRotate( hint3, Point3d((PX10),(dParH+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto
|
|
-- rotazione in centro all'interasse lungo l'altezza porta (X locale)
|
|
elseif RCI10 then
|
|
-- nuova rotazione, solo attornoo all'interasse X locale (ma non sulla Y locale)
|
|
if nNewType and nNewType > 0 then
|
|
EgtRotate( hint3, Point3d((PX10),(dParH+dIntT10+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto
|
|
-- vecchia rotazione in centro all'interasse X e Y locale
|
|
else
|
|
EgtRotate( hint3, Point3d((PX10),(dParH+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto
|
|
end
|
|
-- rotazione in centro all'interasse lungo lo sspessore porta (Y locale)
|
|
elseif RCIT10 then
|
|
EgtRotate( hint3, Point3d((PX10+Int10),(dParH+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto
|
|
end
|
|
end
|
|
end
|
|
|
|
-- se mantiene backset
|
|
if kbs and kbs > 0 then
|
|
EgtSetInfo( hint3, 'KeepBackSet', 'w') -- setto 'w' perché il backset viene mantenuto sul lato wide
|
|
if hint5 then
|
|
EgtSetInfo( hint5, 'KeepBackSet', 'w') -- setto 'w' perché il backset viene mantenuto sul lato wide
|
|
end
|
|
end
|
|
if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then
|
|
EgtSetInfo( hint3, 'ProbeSide', '1')
|
|
if hint5 then
|
|
EgtSetInfo( hint5, 'ProbeSide', '1')
|
|
end
|
|
end
|
|
if HB10 then
|
|
EgtSetInfo( hint3, 'SideDoor', 'LockLH')
|
|
if hint5 then
|
|
EgtSetInfo( hint5, 'SideDoor', 'LockLH')
|
|
end
|
|
else
|
|
EgtSetInfo (hint3, 'SideDoor', 'SideLH')
|
|
if hint5 then
|
|
EgtSetInfo( hint5, 'SideDoor', 'SideLH')
|
|
end
|
|
end
|
|
if dws then
|
|
local nIdSideBoxUp = EgtCopyGlob( hint3, Lg)
|
|
EgtSetName( nIdSideBoxUp, 'upper')
|
|
EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper')
|
|
if hint5 then
|
|
nIdSideBoxUp = EgtCopyGlob( hint5, Lg)
|
|
EgtSetName( nIdSideBoxUp, 'upper')
|
|
EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper')
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Funzione di sistemazione parametri
|
|
function ConcealedHinge.AdjustParams( tMhPar)
|
|
|
|
local EgtDoorsMsg = require( 'EgtDoorsMsg')
|
|
local dMaxMat0
|
|
local dMaxMat1
|
|
local dMaxMat2
|
|
local dMaxMat3
|
|
local dNumMessage
|
|
local dNumLog = 0
|
|
local sMessToOut = ''
|
|
local nTempT0
|
|
local nTempT1
|
|
local nTempT2
|
|
local nTempT3
|
|
local sMchngName0
|
|
local sMchngName1
|
|
local sMchngName2
|
|
local sMchngName3
|
|
|
|
-- do errore se profilo diverso da SQ e EB e non è ammesso
|
|
if not DGC.Eah and DGD.tProfs.hingeedge.trimming ~= 'SQ' and DGD.tProfs.hingeedge.trimming ~= 'EB' then
|
|
return tMhPar, 1699, string.format(EgtDoorsMsg[429], tMhPar.Nome, DGD.tProfs.hingeedge.trimming)
|
|
end
|
|
|
|
-- 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
|
|
|
|
-- se profilo bevel disabilito la giunzione tra face e mortise a meno del parametro di adattamento mortise
|
|
if DGD.tProfs.hingeedge.trimming == 'BD' or DGD.tProfs.hingeedge.trimming == 'BU' or
|
|
DGD.tProfs.hingeedge.trimming == 'BDEB' or DGD.tProfs.hingeedge.trimming == 'BUEB' then
|
|
-- se parametro non presente o false disattivo la giunzione
|
|
if not tMhPar.mfp then
|
|
tMhPar.jnb = false -- giunzione non possibile
|
|
else
|
|
tMhPar.jnb = true -- giunzione possibile
|
|
end
|
|
tMhPar.bev = true
|
|
else
|
|
tMhPar.jnb = true -- giunzione possibile
|
|
end
|
|
|
|
local bLockOnRight = DGD.Lock == 'R'
|
|
|
|
if ( DGD.Lock == 'R' or not DGD.Push) and
|
|
( DGD.Lock == 'R' ~= not DGD.Push) then
|
|
if tMhPar.D_X then
|
|
tMhPar.D_X = -tMhPar.D_X
|
|
end
|
|
if tMhPar.DB_X then
|
|
tMhPar.DB_X = -tMhPar.DB_X
|
|
end
|
|
end
|
|
|
|
if tMhPar.D_Y then
|
|
tMhPar.D_Y = -tMhPar.D_Y
|
|
end
|
|
if tMhPar.DB_Y then
|
|
tMhPar.DB_Y = -tMhPar.DB_Y
|
|
end
|
|
|
|
-- Assegno parametri da ddf (verifico se configurato Concealed Hinges with Backset from NarrowSide)
|
|
if DGC.ChBsNs then
|
|
tMhPar.D = DGD.dT - tChPar.H - DGD.BACK_SET
|
|
else
|
|
tMhPar.D = DGD.BACK_SET
|
|
end
|
|
|
|
-- calcolo la posizione del centro foro sullo spessore porta
|
|
-- se non ruota su profilo bevel o non è bevel
|
|
if DGC.Fpd or not tMhPar.bev then
|
|
tMhPar.posh = (tMhPar.D + (tMhPar.H/2)) - (DGD.dT/2)
|
|
else
|
|
tMhPar.posh = ((tMhPar.D + (tMhPar.H/2)) * cos( 3)) - (DGD.dT/2)
|
|
end
|
|
|
|
-- se non ho il parametro lo setto disattivato
|
|
if not tMhPar.ech then
|
|
tMhPar.ech = false
|
|
end
|
|
|
|
-- se ho arrotondamento disabilito il chisel e il cleancorner
|
|
if tMhPar.CL then
|
|
tMhPar.ech = false
|
|
tMhPar.clc = nil
|
|
tMhPar.CLH = nil
|
|
end
|
|
|
|
if not tMhPar.rf then
|
|
tMhPar.rf = 0
|
|
if tMhPar.CL and tMhPar.H then
|
|
tMhPar.rf = tMhPar.H/2
|
|
end
|
|
end
|
|
|
|
-- se non c'è la variabile suffisso
|
|
if not tMhPar.CH then
|
|
tMhPar.CH = '_Chisel'
|
|
end
|
|
|
|
-- se porta steel o aluminum disabilito la svuotatura, la mortasa e i fori e modifico il nome geometria
|
|
if FindMaterial( DGD.Material, 'steel') or FindMaterial( DGD.Material, 'aluminum') then
|
|
tMhPar.LM = nil
|
|
tMhPar.LA = nil
|
|
tMhPar.ech = false
|
|
tMhPar.CH = nil
|
|
tMhPar.est = true
|
|
tMhPar.d2 = nil
|
|
else
|
|
tMhPar.est = nil
|
|
tMhPar.IY4 = nil
|
|
tMhPar.EBH4 = nil
|
|
tMhPar.IY5 = nil
|
|
tMhPar.EBH5 = nil
|
|
tMhPar.IY6 = nil
|
|
tMhPar.EBH6 = nil
|
|
end
|
|
|
|
-- Regola applicazione chiseling:
|
|
-- se ho impostato un raccordo, anche se poi viene annullato perché inferiore del raggio fresa
|
|
-- disabilito il chiseling perché se c'è un valore di raccordo non devo fare il chiseling
|
|
|
|
-- se ho il raggio valido disabilito il chiseling e,
|
|
-- se è attivo l'arrotondamento, anche il clean corner
|
|
if tMhPar.rf > 0 then
|
|
tMhPar.ech = false
|
|
if tMhPar.CL then
|
|
tMhPar.clc = nil
|
|
tMhPar.CLH = nil
|
|
end
|
|
end
|
|
|
|
-- Assegno parametri da dati utensili in macchina
|
|
local MB = require( 'MachiningBase')
|
|
local sLG
|
|
local nLGi = 1
|
|
local sLM
|
|
local nLMi = 1
|
|
local sLA
|
|
local nLAi = 1
|
|
local sLMM
|
|
local nLMMi = 1
|
|
|
|
-- se profilo cerniere bevel up
|
|
if DGD.tProfs.hingeedge.trimming == 'BU' or DGD.tProfs.hingeedge.trimming == 'BUEB' then
|
|
nLGi = 2
|
|
nLMi = 2
|
|
if tMhPar.mfp then
|
|
nLAi = 2 -- l'antischeggia avrà le tre lavorazioni identiche perché l'utensile è su aggregato orizzontale
|
|
nLMMi = 2
|
|
end
|
|
elseif DGD.tProfs.hingeedge.trimming == 'BD' or DGD.tProfs.hingeedge.trimming == 'BDEB' then -- se profilo cerniere bevel down
|
|
nLGi = 3
|
|
nLMi = 3
|
|
if tMhPar.mfp then
|
|
nLAi = 3 -- l'antischeggia avrà le tre lavorazioni identiche perché l'utensile è su aggregato orizzontale
|
|
nLMMi = 3
|
|
end
|
|
end
|
|
|
|
if tMhPar.est and tMhPar.LG then
|
|
sLG = tMhPar.LG
|
|
nLGi = 1
|
|
if DGD.MachEn > 0 and tMhPar.d then nTempT0, dMaxMat0, sMchngName0 = MB.GetToolDataFromAttrib( sLG, nLGi) end
|
|
end
|
|
|
|
if tMhPar.LM then
|
|
sLM = tMhPar.LM
|
|
nLMi = 1
|
|
if DGD.MachEn > 0 and tMhPar.d then nTempT1, dMaxMat1, sMchngName1 = MB.GetToolDataFromAttrib( sLM, nLMi) end
|
|
end
|
|
|
|
if tMhPar.LA then
|
|
sLA = tMhPar.LA
|
|
nLAi = 1
|
|
if DGD.MachEn > 0 and tMhPar.d2 then nTempT2, dMaxMat2, sMchngName2 = MB.GetToolDataFromAttrib( sLA, nLAi) end
|
|
end
|
|
|
|
if tMhPar.LMM then
|
|
sLMM = tMhPar.LMM
|
|
nLMMi = 1
|
|
if DGD.MachEn > 0 and tMhPar.d2a then nTempT3, dMaxMat3, sMchngName3 = MB.GetToolDataFromAttrib( sLMM, nLMMi) end
|
|
end
|
|
|
|
if tMhPar.ech and tMhPar.LG then -- se chisel abilitato
|
|
sLG = tMhPar.LG .. tMhPar.CH
|
|
nLGi = 1
|
|
tMhPar.d0 = 0
|
|
if DGD.MachEn > 0 and tMhPar.d0 then nTempT0, dMaxMat0, sMchngName0 = MB.GetToolDataFromAttrib( sLG, nLGi) 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 = -1695
|
|
sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT0, sLG, nLGi, tMhPar.d, dNumLog, sMchngName0)
|
|
elseif tMhPar.est and nTempT0 then
|
|
tMhPar.d = nTempT0
|
|
end
|
|
|
|
-- gestisco il risultato della lettura utensili
|
|
if DGD.bProoduce and not tMhPar.est and tMhPar.d and nTempT1 and nTempT1 <= 0 then
|
|
dNumLog = -1695
|
|
sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT1, sLM, nLMi, tMhPar.d, dNumLog, sMchngName2)
|
|
elseif not tMhPar.est and nTempT1 then
|
|
tMhPar.d = nTempT1
|
|
end
|
|
|
|
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 = -1695
|
|
sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT2, sLA, nLAi, tMhPar.d2, dNumLog, sMchngName2)
|
|
end
|
|
elseif not tMhPar.est and nTempT2 then
|
|
tMhPar.d2 = nTempT2
|
|
end
|
|
|
|
if not tMhPar.est and tMhPar.d2a and nTempT3 and nTempT3 <= 0 then
|
|
if DGD.bProoduce and not tMhPar.jn2 then -- se non si concatenano i due percorsi
|
|
dNumLog = -1695
|
|
sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT3, sLMM, nLMMi, tMhPar.d2a, dNumLog, sMchngName3)
|
|
end
|
|
elseif not tMhPar.est and nTempT3 then
|
|
tMhPar.d2a = nTempT3
|
|
end
|
|
|
|
-- chiseling
|
|
if tMhPar.ech and tMhPar.d0 and nTempT0 > 0 then
|
|
tMhPar.d0 = nTempT0
|
|
end
|
|
|
|
-- Raggio: se altro materiale e raggio presente e se raggio minore del diametro utensile + delta, lo annullo
|
|
if tMhPar.est and tMhPar.rf and tMhPar.rf > 0 and tMhPar.d and tMhPar.rf < ((tMhPar.d/2)+0.02) then
|
|
tMhPar.rf = 0
|
|
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 = -1691
|
|
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 = -1698
|
|
dNumMessage = 460
|
|
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T), EgtToUiUnits(dMaxMat1))
|
|
tMhPar.T = dMaxMat1 - 0.02 -- tolgo 0.02 per permettere la lavorazione
|
|
end
|
|
|
|
-- se mortise concatenata a face e la profondità della mortise è maggiore della capacità utensile,
|
|
-- limito la profondità ed emetto un warning
|
|
if tMhPar.jn and tMhPar.jnb and tMhPar.T2 and dMaxMat1 and tMhPar.T2 > dMaxMat1 then
|
|
dNumLog = -1697
|
|
dNumMessage = 461
|
|
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T2), EgtToUiUnits(dMaxMat1))
|
|
tMhPar.T2 = dMaxMat1
|
|
end
|
|
|
|
-- se mortise non concatenata a face e la profondità della mortise è maggiore della capacità utensile,
|
|
-- limito la profondità ed emetto un warning
|
|
if( not tMhPar.jn or not tMhPar.jnb) and tMhPar.T2 and dMaxMat2 and tMhPar.T2 > dMaxMat2 then
|
|
dNumLog = -1696
|
|
dNumMessage = 461
|
|
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T2), EgtToUiUnits(dMaxMat2))
|
|
tMhPar.T2 = dMaxMat2
|
|
end
|
|
|
|
-- se seconda mortise concatenata a prima e a face e la profondità della seconda mortise è maggiore della capacità utensile,
|
|
-- limito la profondità ed emetto un warning
|
|
if tMhPar.jn and tMhPar.jn2 and
|
|
tMhPar.T2a and dMaxMat1 and tMhPar.T2a > dMaxMat1 then
|
|
dNumLog = -1693
|
|
dNumMessage = 461
|
|
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T2a), EgtToUiUnits(dMaxMat1))
|
|
tMhPar.T2a = dMaxMat1
|
|
end
|
|
|
|
-- se seconda mortise concatenata a prima ma non 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
|
|
tMhPar.T2a and dMaxMat2 and tMhPar.T2a > dMaxMat2 then
|
|
dNumLog = -1692
|
|
dNumMessage = 461
|
|
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T2a), EgtToUiUnits(dMaxMat2))
|
|
tMhPar.T2a = dMaxMat2
|
|
end
|
|
|
|
-- se la profondità della seconda mortise non è concatenata ed è maggiore della capacità utensile limito la profondità ed emetto un warning
|
|
if not tMhPar.jn and not tMhPar.jn2 and
|
|
tMhPar.T2a and dMaxMat3 and tMhPar.T2a > dMaxMat3 then
|
|
dNumLog = -1694
|
|
dNumMessage = 461
|
|
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T2a), EgtToUiUnits(dMaxMat3))
|
|
tMhPar.T2a = dMaxMat3
|
|
end
|
|
|
|
if tMhPar.CLH and tMhPar.clc and tMhPar.clc > 0 and ( tMhPar.clc >= tMhPar.H or tMhPar.clc >= tMhPar.L) then
|
|
tMhPar.clc = nil
|
|
elseif not tMhPar.CLH then
|
|
tMhPar.clc = nil
|
|
end
|
|
|
|
-- setto un valore di poco inferiore allo spessore per non fresare le ventose
|
|
local sPieceName
|
|
if tMhPar.Dws then
|
|
tMhPar.TTP = tMhPar.dThD - DGD.Spd
|
|
if DGD.nTypePz == 3 then sPieceName = 'left Jamb'
|
|
elseif DGD.nTypePz == 4 then sPieceName = 'right Jamb'
|
|
elseif DGD.nTypePz == 5 then sPieceName = 'Frame header'
|
|
else sPieceName = 'Threshold' end
|
|
end
|
|
|
|
-- controllo se le profondità delle geometrie non superano lo spessore frame
|
|
if tMhPar.Dws and DGD.Spd > 0 and tMhPar.T and abs(tMhPar.T) > tMhPar.TTP then
|
|
dNumLog = -1690
|
|
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.TTP then
|
|
dNumLog = -1690
|
|
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.T2a and abs(tMhPar.T2a) > tMhPar.TTP then
|
|
dNumLog = -1690
|
|
dNumMessage = 681
|
|
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, sPieceName, 'T2a', EgtToUiUnits(tMhPar.T2a), EgtToUiUnits(tMhPar.TTP), EgtToUiUnits(tMhPar.dThD))
|
|
tMhPar.T2a = tMhPar.TTP
|
|
end
|
|
end
|
|
|
|
-- se non ho parametro step o è 0 lo assegno uguale allo spessore cava
|
|
if tMhPar.T and ( not tMhPar.sf or abs(tMhPar.sf) < GEO.EPS_SMALL) then
|
|
tMhPar.sf = tMhPar.T
|
|
end
|
|
|
|
if dNumLog ~= 0 then
|
|
return tMhPar, dNumLog, sMessToOut
|
|
end
|
|
|
|
return tMhPar, 0, ''
|
|
end
|
|
|
|
-- Funzione di disegno
|
|
function ConcealedHinge.Draw( tConcldPar, bPreview, bRunByCompo, nDrawMach, dThickDoor)
|
|
|
|
-- setto un parametro atteso nel componente _latch
|
|
tConcldPar.invG = 1
|
|
|
|
-- Assegno le dimensioni
|
|
local L = tConcldPar.L
|
|
local H = tConcldPar.H
|
|
local T = tConcldPar.T
|
|
local D = tConcldPar.D
|
|
local L2 = tConcldPar.L2
|
|
local H2 = tConcldPar.H2
|
|
local T2 = tConcldPar.T2
|
|
local sf = tConcldPar.sf
|
|
local rf = tConcldPar.rf
|
|
local clc = tConcldPar.clc
|
|
local ccr = tConcldPar.ccr
|
|
local s = tConcldPar.s
|
|
local d = tConcldPar.d
|
|
local p = tConcldPar.p
|
|
local jn = tConcldPar.jn -- flag per giunzione prima cava face con seconda cava (mortasa)
|
|
local jnb = tConcldPar.jnb -- flag che indica se profilo tipo bevel o no
|
|
local mfp = tConcldPar.mfp -- flag che indica se la mortasa deve seguire il profilo
|
|
local d2 = tConcldPar.d2
|
|
local p2 = tConcldPar.p2
|
|
local CL = tConcldPar.CL
|
|
local D_X = tConcldPar.D_X -- delta on X pos on mortise
|
|
local D_Y = tConcldPar.D_Y -- delta on X pos on mortise
|
|
local L2a = tConcldPar.L2a
|
|
local H2a = tConcldPar.H2a
|
|
local T2a = tConcldPar.T2a
|
|
local d2a = tConcldPar.d2a
|
|
local p2a = tConcldPar.p2a
|
|
local s2a = tConcldPar.s2a
|
|
local posh = tConcldPar.posh -- posizione in Y del foro di tastatura
|
|
local posp = tConcldPar.posp -- posizione in X del foro di tastatura
|
|
local jn2 = tConcldPar.jn2 -- flag per giunzione seconda cava (mortasa) con terza cava ( seconda mortasa)
|
|
local DB_X = tConcldPar.DB_X -- delta on X pos on second mortise
|
|
local DB_Y = tConcldPar.DB_Y -- delta on Y pos on second mortise
|
|
local invG = tConcldPar.invG
|
|
local ech = tConcldPar.ech
|
|
local est = tConcldPar.est
|
|
local kbs = tConcldPar.kbs -- keep backset/thickness (0: none, 1: only face, 2: all)
|
|
local pbs = tConcldPar.pbs
|
|
local dws = tConcldPar.Dws
|
|
local dthd = tConcldPar.dThD
|
|
local ttp = tConcldPar.TTP
|
|
local tExtraBore = {}
|
|
table.insert( tExtraBore, { tConcldPar.D3, tConcldPar.T3, tConcldPar.I3, tConcldPar.PX3, tConcldPar.PY3, tConcldPar.EB3, tConcldPar.HB3, tConcldPar.IT3})
|
|
table.insert( tExtraBore, { tConcldPar.D4, tConcldPar.IY4, tConcldPar.T4, tConcldPar.I4, tConcldPar.PX4, tConcldPar.PY4, tConcldPar.RP4, tConcldPar.EB4, tConcldPar.EBH4, tConcldPar.HB4, tConcldPar.AR4, tConcldPar.RCI4, tConcldPar.IT4, tConcldPar.RCIT4})
|
|
table.insert( tExtraBore, { tConcldPar.D5, tConcldPar.IY5, tConcldPar.T5, tConcldPar.I5, tConcldPar.PX5, tConcldPar.PY5, tConcldPar.RP5, tConcldPar.EB5, tConcldPar.EBH5, tConcldPar.HB5, tConcldPar.AR5, tConcldPar.RCI5, tConcldPar.IT5, tConcldPar.RCIT5})
|
|
table.insert( tExtraBore, { tConcldPar.D6, tConcldPar.IY6, tConcldPar.T6, tConcldPar.I6, tConcldPar.PX6, tConcldPar.PY6, tConcldPar.RP6, tConcldPar.EB6, tConcldPar.EBH6, tConcldPar.HB6, tConcldPar.AR6, tConcldPar.RCI6, tConcldPar.IT6, tConcldPar.RCIT6})
|
|
|
|
-- Assegno i nomi dei layer
|
|
local LG = tConcldPar.LG
|
|
local LM = tConcldPar.LM
|
|
local LG2 = tConcldPar.LG2
|
|
local LA = tConcldPar.LA
|
|
local CLH = tConcldPar.CLH
|
|
local LGM = tConcldPar.LGM
|
|
local LMM = tConcldPar.LMM
|
|
local CH = tConcldPar.CH
|
|
local LH = 'Hinge_Probe'
|
|
local DM = 'DUMMY'
|
|
-- variabili per messaggi e settaggi vari
|
|
local sCompoName = tConcldPar.Nome
|
|
local nCompoNpar = tConcldPar.Npar
|
|
local sCompoPath = tConcldPar.Path
|
|
-- eventuale messaggio errore rilevato nell'adjust
|
|
local nCodAdj = tConcldPar.nCod
|
|
local sCodAdj = tConcldPar.sCod
|
|
-- nomi parametri per messaggi
|
|
local sNamePar1 = tConcldPar.N1 or 'L'
|
|
local sNamePar2 = tConcldPar.N2 or 'H'
|
|
local sNamePar3 = tConcldPar.N3 or 'T'
|
|
local sNamePar4 = tConcldPar.N4 or 'D'
|
|
local sNamePar5 = tConcldPar.N5 or 'L2'
|
|
local sNamePar6 = tConcldPar.N6 or 'T2'
|
|
local sNamePar7 = tConcldPar.N7 or 's'
|
|
local sNamePar8 = tConcldPar.N8 or 'd'
|
|
local sNamePar9 = tConcldPar.N9 or 'p'
|
|
local sNamePar11 = tConcldPar.N11 or 'd2'
|
|
local sNamePar12 = tConcldPar.N12 or 'sf'
|
|
local sNamePar13 = tConcldPar.N13 or 'D_X'
|
|
local sNamePar14 = tConcldPar.N14 or 'D_Y'
|
|
local sNamePar15 = tConcldPar.N15 or 'H2'
|
|
local sNamePar16 = tConcldPar.N16 or 'H2a'
|
|
local sNamePar17 = tConcldPar.N17 or 'T2a'
|
|
local sNamePar18 = tConcldPar.N18 or 'DB_X'
|
|
local sNamePar19 = tConcldPar.N19 or 'DB_Y'
|
|
local sNamePar20 = tConcldPar.N20 or 'd2a'
|
|
local sNamePar21 = tConcldPar.N21 or 'rf'
|
|
local sNamePar22 = tConcldPar.N22 or 'p2'
|
|
local sNamePar23 = tConcldPar.N23 or 'L2a'
|
|
local sNamePar24 = tConcldPar.N24 or 'p2a'
|
|
local sNamePar25 = tConcldPar.N25 or 's2a'
|
|
local sNamePar26 = tConcldPar.N26 or 'clc'
|
|
local sNamePar27 = tConcldPar.N27 or 'ccr'
|
|
|
|
-- RunByComponetInterface
|
|
local RC = true
|
|
-- Messaggi codice errori
|
|
local EM = ' '
|
|
local EC = 0
|
|
local ErrorBase = 1650
|
|
-- Variabili per risalita distaccata
|
|
local nDeltaMovX = 2
|
|
local nDeltaMovY = 2
|
|
-- variabili che abilitano la creazione della geometria
|
|
local bMakeFaceGeom = true
|
|
local bMakeMortGeom = true
|
|
local bMakeMortGeom2nd = true
|
|
|
|
-- 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
|
|
CLH = nil
|
|
end
|
|
|
|
-- se le dimensioni del raccordo sono eccessive le riconduco a valori accettabili
|
|
if bMakeFaceGeom then
|
|
if L >= H then
|
|
if rf > (H/2) then
|
|
rf = (H/2)
|
|
tConcldPar.rf = rf
|
|
end
|
|
else
|
|
if rf > (L/2) then
|
|
rf = (L/2)
|
|
tConcldPar.rf = rf
|
|
end
|
|
end
|
|
end
|
|
|
|
if not bRunByCompo then RC = false end
|
|
if not T then T = 0 end
|
|
-- se junzione impossibilitata disattivo il join tra face e mortasa
|
|
if not jnb then
|
|
jn = false
|
|
tConcldPar.jn = false
|
|
end
|
|
|
|
if not nDrawMach then -- se non definita la setto per non creare geometria di lavorazione
|
|
nDrawMach = 0
|
|
end
|
|
local nForceMakeFace = nDrawMach
|
|
|
|
-- se ho abilitato il chiseling modifico il nome geometria
|
|
if ech then
|
|
LG = LG .. CH
|
|
tConcldPar.LG = LG
|
|
if nDrawMach == 1 then -- se ho abilitato solo le geometrie di lavorazione
|
|
nForceMakeFace = 2
|
|
end
|
|
end
|
|
|
|
--------------------------------------------------------
|
|
-- set parametri attesi nel componente _latch o _mortise
|
|
-- o che potrebbero non esserci nei vecchi lua
|
|
--------------------------------------------------------
|
|
|
|
-- posizione in X mortasa dal centro face
|
|
if not D_X then
|
|
D_X = 0
|
|
tConcldPar.D_X = 0
|
|
end
|
|
|
|
-- posizione in Y mortasa dal centro face
|
|
if not D_Y then
|
|
D_Y = 0
|
|
tConcldPar.D_Y = 0
|
|
end
|
|
|
|
-- qui utilizzo un bool ma nel componente _latch uso un numero per definire l'arrotondamento
|
|
if bMakeFaceGeom and CL then
|
|
cl = 3 -- setto entrambe gli estremi raccordati
|
|
tConcldPar.cl = 3
|
|
else
|
|
cl = 0 -- setto nessun estremo raccordato
|
|
tConcldPar.cl = 0
|
|
end
|
|
|
|
-- altezza mortise, setto come altezza face per compatibilità con i vecchi lua
|
|
if not H2 then
|
|
H2 = H
|
|
tConcldPar.H2 = H
|
|
end
|
|
|
|
if est or ( not L2 or not H2) then
|
|
bMakeMortGeom = false
|
|
-- disattivo i join
|
|
jn = false
|
|
jn2 = false
|
|
end
|
|
|
|
if not T2 then
|
|
T2 = 0
|
|
end
|
|
|
|
if est or ( not L2a or not H2a) then
|
|
bMakeMortGeom2nd = false
|
|
jn2 = false
|
|
end
|
|
|
|
if not T2a then
|
|
T2a = 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
|
|
elseif not p2 and bMakeMortGeom then
|
|
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
|
|
d2a = d2
|
|
p2a = p2
|
|
end
|
|
|
|
-- posizione in X seconda mortise dal centro mortise
|
|
if bMakeMortGeom2nd and not DB_X then
|
|
DB_X = 0
|
|
if bMakeMortGeom then
|
|
DB_X = D_X
|
|
end
|
|
tConcldPar.DB_X = DB_X
|
|
end
|
|
|
|
-- posizione in Y seconda mortise dal centro mortise
|
|
if bMakeMortGeom2nd and not DB_Y then
|
|
DB_Y = 0
|
|
if bMakeMortGeom then
|
|
DB_Y = D_Y
|
|
end
|
|
tConcldPar.DB_Y = DB_Y
|
|
end
|
|
|
|
local EgtDoorsMsg = require( 'EgtDoorsMsg')
|
|
|
|
-- Verifica delle dimensioni, alcune condizioni vengono verificate solo se è abilitata la creazione dei percorsi di lavorazione
|
|
if bMakeFaceGeom and nDrawMach > 0 and d < DgMin then
|
|
EM = string.format(EgtDoorsMsg[400],sNamePar8,EgtToUiUnits(d),EgtToUiUnits(DgMin)) -- il diametro utensile 'd' deve essere >= di
|
|
EC = 1
|
|
d = DgMin
|
|
elseif bMakeMortGeom and nDrawMach > 0 and d2 < DgMin then
|
|
EM = string.format(EgtDoorsMsg[400],sNamePar11,EgtToUiUnits(d2),EgtToUiUnits(DgMin)) -- il diametro utensile 'd2' deve essere >= di
|
|
EC = 2
|
|
d2 = DgMin
|
|
elseif bMakeMortGeom2nd and nDrawMach > 0 and d2a < DgMin then
|
|
EM = string.format(EgtDoorsMsg[400],sNamePar20,EgtToUiUnits(d2a),EgtToUiUnits(DgMin)) -- il diametro utensile 'd2a' deve essere >= di
|
|
EC = 3
|
|
d2a = DgMin
|
|
elseif bMakeFaceGeom and nDrawMach > 0 and H < d then
|
|
if DGD.bProoduce then
|
|
EM = string.format(EgtDoorsMsg[405],sNamePar2,EgtToUiUnits(H),EgtToUiUnits(d), sCompoPath) -- il parametro 'H' deve essere >= del diametro utensile
|
|
EC = 4
|
|
H = d
|
|
else
|
|
d = H - 0.002
|
|
end
|
|
elseif bMakeMortGeom and nDrawMach > 0 and H2 < d2 then
|
|
if DGD.bProoduce then
|
|
EM = string.format(EgtDoorsMsg[405],sNamePar15,EgtToUiUnits(H2),EgtToUiUnits(d2), sCompoPath) -- il parametro 'H2' deve essere >= del diametro utensile
|
|
EC = 5
|
|
H2 = d2
|
|
else
|
|
d2 = H2 - 0.002
|
|
end
|
|
elseif bMakeMortGeom2nd and nDrawMach > 0 and H2a < d2a then
|
|
if DGD.bProoduce then
|
|
EM = string.format(EgtDoorsMsg[405],sNamePar16,EgtToUiUnits(H2a),EgtToUiUnits(d2a), sCompoPath) -- il parametro 'H2a' deve essere >= del diametro utensile
|
|
EC = 6
|
|
H2a = d2a
|
|
else
|
|
d2a = H2a - 0.002
|
|
end
|
|
elseif bMakeFaceGeom and nDrawMach > 0 and L <= d then
|
|
if DGD.bProoduce then
|
|
EM = string.format(EgtDoorsMsg[402],sNamePar1,EgtToUiUnits(L),sNamePar8,EgtToUiUnits(d), sCompoPath) -- il parametro 'L' deve essere maggiore al diametro utensile
|
|
EC = 7
|
|
L = d + 0.002
|
|
else
|
|
d = L - 0.002
|
|
end
|
|
elseif bMakeMortGeom and nDrawMach > 0 and L2 <= d2 then
|
|
if DGD.bProoduce then
|
|
EM = string.format(EgtDoorsMsg[402],sNamePar5,EgtToUiUnits(L2),sNamePar11,EgtToUiUnits(d2), sCompoPath) -- il parametro 'L2' deve essere maggiore al diametro utensile
|
|
EC = 8
|
|
L2 = d2 + 0.002
|
|
else
|
|
d2 = L2 - 0.002
|
|
end
|
|
elseif bMakeMortGeom2nd and nDrawMach > 0 and L2a <= d2a then
|
|
if DGD.bProoduce then
|
|
EM = string.format(EgtDoorsMsg[402],sNamePar23,EgtToUiUnits(L2a),sNamePar20,EgtToUiUnits(d2a), sCompoPath) -- il parametro 'L2a' deve essere maggiore al diametro utensile
|
|
EC = 9
|
|
L2a = d2a + 0.002
|
|
else
|
|
d2a = L2a - 0.002
|
|
end
|
|
elseif bMakeFaceGeom and nDrawMach > 0 and ( p < PtMin or p > PtMax) then
|
|
EM = string.format(EgtDoorsMsg[403],sNamePar9,p,PtMin,PtMax, sCompoPath) -- il parametro 'p' deve essere compreso tra
|
|
EC = 10
|
|
p = 0.8
|
|
elseif bMakeMortGeom and nDrawMach > 0 and p2 and ( p2 < PtMin or p2 > PtMax) then
|
|
EM = string.format(EgtDoorsMsg[403],sNamePar22,p2,PtMin,PtMax, sCompoPath) -- il parametro 'p2' deve essere compreso tra
|
|
EC = 11
|
|
p2 = 0.8
|
|
elseif bMakeMortGeom2nd and nDrawMach > 0 and p2a and ( p2a < PtMin or p2a > PtMax) then
|
|
EM = string.format(EgtDoorsMsg[403],sNamePar24,p2a,PtMin,PtMax, sCompoPath) -- il parametro 'p2a' deve essere compreso tra
|
|
EC = 12
|
|
p2a = 0.8
|
|
elseif bMakeFaceGeom and T < 0 then
|
|
EM = string.format(EgtDoorsMsg[404],sNamePar3,EgtToUiUnits(T), sCompoPath) -- il parametro 'T' deve essere >= 0
|
|
EC = 13
|
|
T = 0
|
|
elseif bMakeMortGeom and T2 <= 0 then
|
|
EM = string.format(EgtDoorsMsg[401],sNamePar6,EgtToUiUnits(T2), sCompoPath) -- il parametro 'T2' deve essere > 0
|
|
EC = 14
|
|
T2 = 0.1
|
|
elseif bMakeMortGeom2nd and T2a < 0 then
|
|
EM = string.format(EgtDoorsMsg[404],sNamePar17,EgtToUiUnits(T2a), sCompoPath) -- il parametro 'T2a' deve essere >= 0
|
|
EC = 15
|
|
T2a = 0
|
|
elseif D < 0 then
|
|
EM = string.format(EgtDoorsMsg[404],sNamePar4,EgtToUiUnits(D), sCompoPath) -- il parametro 'D' deve essere >= 0
|
|
EC = 16
|
|
D = 0
|
|
elseif bMakeFaceGeom and bMakeMortGeom and L2 >= L then
|
|
EM = string.format(EgtDoorsMsg[406],sNamePar5,EgtToUiUnits(L2),sNamePar1,EgtToUiUnits(L), sCompoPath) -- il parametro 'L2' deve essere < 'L'
|
|
EC = 17
|
|
L2 = L - 0.1
|
|
elseif bMakeMortGeom and bMakeMortGeom2nd and L2a >= L2 then
|
|
EM = string.format(EgtDoorsMsg[406],sNamePar23,EgtToUiUnits(L2a),sNamePar5,EgtToUiUnits(L2), sCompoPath) -- il parametro 'L2a' deve essere < 'L2'
|
|
EC = 18
|
|
L2a = L2 - 0.1
|
|
elseif bMakeFaceGeom and bMakeMortGeom and not dws and T2 <= T then
|
|
EM = string.format(EgtDoorsMsg[407],sNamePar6,EgtToUiUnits(T2),sNamePar3,EgtToUiUnits(T), sCompoPath) -- il parametro 'T2' deve essere > 'T'
|
|
EC = 19
|
|
T2 = T + 0.1
|
|
elseif bMakeMortGeom and bMakeMortGeom2nd and not dws and T2a <= T2 then
|
|
EM = string.format(EgtDoorsMsg[407],sNamePar17,EgtToUiUnits(T2a),sNamePar6,EgtToUiUnits(T2), sCompoPath) -- il parametro 'T2a' deve essere > 'T2'
|
|
EC = 20
|
|
T2a = T2 + 0.1
|
|
elseif bMakeFaceGeom and nDrawMach > 0 and sf and sf <= 0 then
|
|
EM = string.format(EgtDoorsMsg[401],sNamePar12,EgtToUiUnits(sf), sCompoPath) -- il parametro 'sf' deve essere > 0
|
|
EC = 21
|
|
sf = d
|
|
elseif bMakeMortGeom and nDrawMach > 0 and s and s <= 0 then
|
|
EM = string.format(EgtDoorsMsg[401],sNamePar7,EgtToUiUnits(s), sCompoPath) -- il parametro 's' deve essere > 0
|
|
EC = 22
|
|
s = d2
|
|
elseif bMakeMortGeom2nd and nDrawMach > 0 and s2a and s2a <= 0 then
|
|
EM = string.format(EgtDoorsMsg[401],sNamePar25,EgtToUiUnits(s2a), sCompoPath) -- il parametro 's2a' deve essere > 0
|
|
EC = 23
|
|
s2a = d2a
|
|
elseif bMakeFaceGeom and CL and rf < 0 then
|
|
EM = string.format(EgtDoorsMsg[404],sNamePar21,EgtToUiUnits(rf), sCompoPath) -- il parametro 'rf' deve essere >= 0
|
|
EC = 24
|
|
rf = H/2
|
|
elseif bMakeFaceGeom and CL and abs(rf - (H/2)) < GEO.EPS_SMALL and L <= H then
|
|
EM = string.format(EgtDoorsMsg[407],sNamePar1,EgtToUiUnits(L),sNamePar2,EgtToUiUnits(H), sCompoPath) -- il parametro 'L' deve essere > 'H'
|
|
EC = 25
|
|
L = H+5
|
|
elseif bMakeFaceGeom and CL and rf < (H/2) and L <= (rf*2) then
|
|
EM = string.format(EgtDoorsMsg[407],sNamePar1,EgtToUiUnits(L),sNamePar21..'*2',EgtToUiUnits(rf)*2, sCompoPath) -- il parametro 'L' deve essere > 'rf*2'
|
|
EC = 26
|
|
L = (rf*2)+5
|
|
elseif bMakeFaceGeom and bMakeMortGeom and CL and (L-(rf*2)) < (L2 - d2 + (2*abs(D_X))) then
|
|
EM = string.format(EgtDoorsMsg[423],sNamePar13,EgtToUiUnits(D_X),EgtToUiUnits((L-(rf*2)-L2)/2), sCompoPath) -- il parametro 'D_X' é troppo grande, max valore:
|
|
EC = 27
|
|
D_X = 0
|
|
elseif bMakeFaceGeom and bMakeMortGeom and not CL and L < (L2+(2*abs(D_X))) then
|
|
EM = string.format(EgtDoorsMsg[423],sNamePar13,EgtToUiUnits(D_X),EgtToUiUnits((L-L2)/2), sCompoPath) -- il parametro 'D_X' é troppo grande, max valore:
|
|
EC = 28
|
|
D_X = 0
|
|
elseif bMakeFaceGeom and bMakeMortGeom and H2 > H then
|
|
EM = string.format(EgtDoorsMsg[422],sNamePar2,EgtToUiUnits(H),sNamePar15,EgtToUiUnits(H2), sCompoPath) -- il parametro 'H' deve essere >= del parametro 'H2'
|
|
EC = 29
|
|
H2 = H
|
|
elseif bMakeMortGeom and bMakeMortGeom2nd and H2a > H2 then
|
|
EM = string.format(EgtDoorsMsg[422],sNamePar15,EgtToUiUnits(H2),sNamePar16,EgtToUiUnits(H2a), sCompoPath) -- il parametro 'H2' deve essere >= del parametro 'H2a'
|
|
EC = 30
|
|
H2a = H2
|
|
elseif bMakeMortGeom and nDrawMach > 0 and jn and H < (H2+abs(2*D_Y)) then
|
|
EM = string.format(EgtDoorsMsg[423],sNamePar14,EgtToUiUnits(abs(D_Y)),EgtToUiUnits((H-H2)/2), sCompoPath) -- il parametro 'D_Y' é troppo grande, max valore:
|
|
EC = 31
|
|
D_Y = 0
|
|
elseif bMakeFaceGeom and bMakeMortGeom2nd and H2a > H then
|
|
EM = string.format(EgtDoorsMsg[422],sNamePar2,EgtToUiUnits(H),sNamePar16,EgtToUiUnits(H2a), sCompoPath) -- il parametro 'H' deve essere >= del parametro 'H2a'
|
|
EC = 32
|
|
H2a = H
|
|
elseif bMakeFaceGeom and CLH and clc and ccr and clc > 0 and ccr > 0 and (2*(ccr*sin(45))) >= clc then
|
|
EC = 33
|
|
EM = string.format(EgtDoorsMsg[407],sNamePar26,EgtToUiUnits(clc),'',EgtToUiUnits(2*(ccr*sin(45))), sCompoPath) -- il parametro 'clc' deve essere > 'crc'
|
|
clc = (2*(ccr*sin(45)))+0.2
|
|
end
|
|
|
|
if not bPreview and EC ~= 0 then
|
|
return (ErrorBase+EC), EM
|
|
end
|
|
|
|
-- Se Preview cancello tutto
|
|
if bPreview then
|
|
EgtNewFile()
|
|
EgtSetDefaultMaterial( BLACK())
|
|
end
|
|
|
|
-- Pezzo e Layer
|
|
local Pz
|
|
|
|
if bPreview then
|
|
Pz = EgtGroup(GDB_ID.ROOT,GDB_RT.LOC) -- nuovo pezzo
|
|
else
|
|
if not RC then
|
|
Pz = EgtGetCurrPart() -- pezzo corrente
|
|
end
|
|
if not Pz then
|
|
Pz = EgtGroup(GDB_ID.ROOT,GDB_RT.LOC) -- nuovo pezzo
|
|
end
|
|
end
|
|
|
|
-- variabili dei percorsi geometrici
|
|
local nGeom1, nGeom2, nGeom3
|
|
local nPkToJoin1, nPkToJoin2, nPkToJoin3, nPkToJoin
|
|
local nPkJoin1
|
|
local hint3, hint5
|
|
|
|
local Lg, Dm
|
|
local sRequireCompoName
|
|
|
|
Lg = EgtGroup(Pz,GDB_RT.LOC) -- layer della figura principale
|
|
EgtSetName(Lg,sCompoName)
|
|
|
|
if nDrawMach > 0 then -- se abilitata geometria lavorazione
|
|
Dm = EgtGroup( Pz, GDB_RT.LOC) -- layer disegni cerchi rappresentante il diametro utensile
|
|
EgtSetName( Dm, DM)
|
|
end
|
|
|
|
tConcldPar.Dws = nil -- disabilito per non creare geometrie (doppie) inerenti il calcolo regioni nei componenti chiamati
|
|
sRequireCompoName = '_Latch'
|
|
|
|
if bMakeFaceGeom then
|
|
-- lancio il primo componente base
|
|
MHgen = require( sRequireCompoName)
|
|
nGeom1, nPkToJoin1 = MHgen.Draw( EC, EM, tConcldPar, bPreview, bRunByCompo, nForceMakeFace, Pz, Lg, dThickDoor)
|
|
|
|
-- setto le note che indicano su che lato della porta devono essere messe le geometrie
|
|
if nGeom1 then EgtSetInfo(nGeom1,'SideDoor','SideLH') end
|
|
if nPkToJoin1 then EgtSetInfo(nPkToJoin1,'SideDoor','SideLH') end
|
|
|
|
-- Clean corner
|
|
if nDrawMach >= 0 then -- se abilitata geometria
|
|
|
|
if CLH and clc and clc > 0 and clc < H and clc < L then
|
|
|
|
local CLC1 = MakeClcPath( clc, ccr, CLH, Lg, -T)
|
|
if CLC1 then
|
|
-- se mantiene backset
|
|
if kbs and kbs > 0 then
|
|
EgtSetInfo( CLC1, 'KeepBackSet', 'w') -- setto 'w' perché il backset viene mantenuto sul lato wide
|
|
end
|
|
if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then
|
|
EgtSetInfo( CLC1, 'ProbeSide', '1')
|
|
end
|
|
EgtSetInfo( CLC1,'SideDoor','SideLH')
|
|
-- angolo x+y+
|
|
local CLC2 = EgtCopyGlob( CLC1, Lg)
|
|
EgtRotate( CLC2, Point3d(0,0,0), Z_AX(), -90)
|
|
EgtMove( CLC2, Point3d((L/2),(H/2),0) - ORIG())
|
|
-- angolo x+y-
|
|
local CLC3 = EgtCopyGlob( CLC1, Lg)
|
|
EgtRotate( CLC3, Point3d(0,0,0), Z_AX(), 180)
|
|
EgtMove( CLC3, Point3d((L/2),-(H/2),0) - ORIG())
|
|
-- angolo x-y-
|
|
local CLC4 = EgtCopyGlob( CLC1, Lg)
|
|
EgtRotate( CLC4, Point3d(0,0,0), Z_AX(), 90)
|
|
EgtMove( CLC4, Point3d(-(L/2),-(H/2),0) - ORIG())
|
|
-- angolo x-y+
|
|
EgtMove( CLC1, Point3d(-(L/2),(H/2),0) - ORIG())
|
|
end
|
|
end
|
|
end
|
|
else
|
|
-- disattivo il join dei percorsi
|
|
jn = false
|
|
tConcldPar.jn = false
|
|
end
|
|
|
|
if bMakeMortGeom then
|
|
-- cava mortasa
|
|
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.d3 = d2
|
|
dMortise.p3 = p2
|
|
dMortise.invG = invG
|
|
dMortise.mkrev = false -- disabilito la creazione del percorso in senso contrario
|
|
dMortise.L3 = L2a
|
|
dMortise.H3 = H2a
|
|
dMortise.LGM = LG2
|
|
dMortise.LMM = LA
|
|
dMortise.Nome = sCompoName
|
|
dMortise.jne = jn2
|
|
dMortise.mfp = mfp
|
|
-- calcolo la posizione dal centro seconda cava (mortasa) al centro della cava successiva
|
|
if jn2 then
|
|
dMortise.D_X = (DB_X-D_X)
|
|
end
|
|
|
|
-- lancio il secondo componente base
|
|
MHgen = require('_Mortise')
|
|
nGeom2, nPkToJoin2 = MHgen.Draw( EC, EM, dMortise, bPreview, bRunByCompo, nDrawMach, Pz, Lg, dThickDoor)
|
|
|
|
-- setto le note che indicano su che lato della porta devono essere messe le geometrie
|
|
if nGeom2 then
|
|
if mfp then
|
|
EgtSetInfo(nGeom2,'SideDoor','SideLH')
|
|
else
|
|
EgtSetInfo(nGeom2,'SideDoor','LockLH')
|
|
end
|
|
end
|
|
if nPkToJoin2 then
|
|
if mfp then
|
|
EgtSetInfo(nPkToJoin2,'SideDoor','SideLH')
|
|
else
|
|
EgtSetInfo(nPkToJoin2,'SideDoor','LockLH')
|
|
end
|
|
end
|
|
end
|
|
|
|
if EC == 0 and ( nGeom2 or nPkToJoin2) then
|
|
if D_X ~= 0 or D_Y ~= 0 then
|
|
if nGeom2 then
|
|
EgtMove( nGeom2, Point3d(D_X,D_Y,0) - ORIG())
|
|
end
|
|
if nPkToJoin2 then
|
|
EgtMove( nPkToJoin2, Point3d(D_X,D_Y,0) - ORIG())
|
|
end
|
|
end
|
|
end
|
|
|
|
if bMakeMortGeom2nd then
|
|
|
|
-- cava mortasa
|
|
local dMortise = {}
|
|
-- assegno i valori coerenti con la tabella del componente
|
|
dMortise.T = T2
|
|
dMortise.L2 = L2a
|
|
dMortise.H2 = H2a
|
|
dMortise.T2 = T2a
|
|
dMortise.s = s2a
|
|
dMortise.d = d2a
|
|
dMortise.p = p2a
|
|
dMortise.jn = jn2
|
|
dMortise.d3 = d2a
|
|
dMortise.p3 = p2a
|
|
dMortise.invG = invG
|
|
dMortise.mkrev = false -- disabilito la creazione del percorso in senso contrario
|
|
dMortise.jne = false -- non ci sono ulteriori cave, disabilito il join alla successiva
|
|
dMortise.LGM = LGM
|
|
dMortise.LMM = LMM
|
|
dMortise.Nome = sCompoName
|
|
-- calcolo la posizione dal centro seconda cava (mortasa) al centro della cava successiva
|
|
dMortise.D_X = 0
|
|
|
|
-- lancio il secondo componente base
|
|
MHgen = require('_Mortise')
|
|
nGeom3, nPkToJoin3 = MHgen.Draw( EC, EM, dMortise, bPreview, bRunByCompo, nDrawMach, Pz, Lg, dThickDoor)
|
|
|
|
-- setto le note che indicano su che lato della porta devono essere messe le geometrie
|
|
if nGeom3 then
|
|
if mfp then
|
|
EgtSetInfo(nGeom3,'SideDoor','SideLH')
|
|
else
|
|
EgtSetInfo(nGeom3,'SideDoor','LockLH')
|
|
end
|
|
end
|
|
if nPkToJoin3 then
|
|
if mfp then
|
|
EgtSetInfo(nPkToJoin3,'SideDoor','SideLH')
|
|
else
|
|
EgtSetInfo(nPkToJoin3,'SideDoor','LockLH')
|
|
end
|
|
end
|
|
end
|
|
|
|
if EC == 0 and ( nGeom3 or nPkToJoin3) then
|
|
if DB_X ~= 0 or DB_Y ~= 0 then
|
|
if nGeom3 then
|
|
EgtMove( nGeom3, Point3d(DB_X,DB_Y,0) - ORIG())
|
|
end
|
|
if nPkToJoin3 then
|
|
EgtMove( nPkToJoin3, Point3d(DB_X,DB_Y,0) - ORIG())
|
|
end
|
|
end
|
|
end
|
|
|
|
-- se percorsi fatti con lo stesso utensile, li concateno
|
|
if jn and EC == 0 and nDrawMach > 0 and nPkToJoin1 and nPkToJoin2 then
|
|
nPkToJoin = EgtCurveCompo( Lg, {nPkToJoin1,nPkToJoin2}, true)
|
|
if nPkToJoin then
|
|
EgtSetName( nPkToJoin, LM)
|
|
EgtSetInfo( nPkToJoin, 'NotCheckDir', '1')
|
|
-- se mantiene backset anche su face
|
|
if kbs and kbs > 0 then
|
|
EgtSetInfo( nPkToJoin, 'KeepBackSet', 'w') -- setto 'w' perché il backset viene mantenuto sul lato wide
|
|
EgtSetInfo( nGeom1, 'KeepBackSet', 'w') -- setto 'w' perché il backset viene mantenuto sul lato wide
|
|
EgtSetInfo( nGeom2, 'KeepBackSet', 'w') -- setto 'w' perché il backset viene mantenuto sul lato wide
|
|
end
|
|
if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then
|
|
EgtSetInfo( nPkToJoin, 'ProbeSide', '1')
|
|
EgtSetInfo( nGeom1, 'ProbeSide', '1')
|
|
EgtSetInfo( nGeom2, 'ProbeSide', '1')
|
|
end
|
|
else
|
|
EC = ErrorBase + 34
|
|
EM = string.format(EgtDoorsMsg[426], sCompoPath)
|
|
end
|
|
elseif not jn and EC == 0 and nDrawMach > 0 then -- altrimenti se non devo concatenare
|
|
-- se mantiene backset su face
|
|
if kbs and kbs > 0 and nPkToJoin1 then
|
|
EgtSetInfo( nPkToJoin1, 'KeepBackSet', 'w') -- setto 'w' perché il backset viene mantenuto sul lato wide
|
|
EgtSetInfo( nGeom1, 'KeepBackSet', 'w') -- setto 'w' perché il backset viene mantenuto sul lato wide
|
|
-- se mantiene backset su face e mortise
|
|
elseif kbs and kbs > 0 then
|
|
if nPkToJoin1 then
|
|
EgtSetInfo( nPkToJoin1, 'KeepBackSet', 'w') -- setto 'w' perché il backset viene mantenuto sul lato wide
|
|
EgtSetInfo( nGeom1, 'KeepBackSet', 'w') -- setto 'w' perché il backset viene mantenuto sul lato wide
|
|
end
|
|
if nPkToJoin2 then
|
|
EgtSetInfo( nPkToJoin2, 'KeepBackSet', 'w') -- setto 'w' perché il backset viene mantenuto sul lato wide
|
|
EgtSetInfo( nGeom2, 'KeepBackSet', 'w') -- setto 'w' perché il backset viene mantenuto sul lato wide
|
|
end
|
|
end
|
|
if pbs and pbs > 0 and nPkToJoin1 and DGC.Pms and DGC.Pms > 2 then
|
|
EgtSetInfo( nPkToJoin1, 'ProbeSide', '1')
|
|
EgtSetInfo( nGeom1, 'ProbeSide', '1')
|
|
-- se mantiene backset su face e mortise
|
|
elseif pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then
|
|
if nPkToJoin1 then
|
|
EgtSetInfo( nPkToJoin1, 'ProbeSide', '1')
|
|
EgtSetInfo( nGeom1, 'ProbeSide', '1')
|
|
end
|
|
if nPkToJoin2 then
|
|
EgtSetInfo( nPkToJoin2, 'ProbeSide', '1')
|
|
EgtSetInfo( nGeom2, 'ProbeSide', '1')
|
|
end
|
|
end
|
|
end
|
|
|
|
if jn2 and EC == 0 and nDrawMach > 0 and ( nPkToJoin or nPkToJoin2) and nPkToJoin3 then
|
|
if nPkToJoin then -- se riuscito primo concatenamento
|
|
nPkJoin1 = EgtCurveCompo( Lg, {nPkToJoin,nPkToJoin3}, true)
|
|
else
|
|
nPkJoin1 = EgtCurveCompo( Lg, {nPkToJoin2,nPkToJoin3}, true)
|
|
end
|
|
|
|
if nPkJoin1 then
|
|
if nPkToJoin then
|
|
EgtSetName( nPkJoin1, LM)
|
|
EgtSetInfo( nPkJoin1, 'NotCheckDir', '1')
|
|
-- se mantiene backset anche su face
|
|
if kbs and kbs > 0 then
|
|
EgtSetInfo( nPkJoin1, 'KeepBackSet', 'w') -- setto 'w' perché il backset viene mantenuto sul lato wide
|
|
EgtSetInfo( nGeom3, 'KeepBackSet', 'w') -- setto 'w' perché il backset viene mantenuto sul lato wide
|
|
end
|
|
if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then
|
|
EgtSetInfo( nPkJoin1, 'ProbeSide', '1')
|
|
EgtSetInfo( nGeom3, 'ProbeSide', '1')
|
|
end
|
|
else
|
|
EgtSetName( nPkJoin1, LA)
|
|
EgtSetInfo( nPkJoin1, 'NotCheckDir', '1')
|
|
-- se mantiene backset su mortise
|
|
if kbs and kbs > 0 then
|
|
EgtSetInfo( nPkJoin1, 'KeepBackSet', 'w') -- setto 'w' perché il backset viene mantenuto sul lato wide
|
|
EgtSetInfo( nGeom3, 'KeepBackSet', 'w') -- setto 'w' perché il backset viene mantenuto sul lato wide
|
|
end
|
|
if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then
|
|
EgtSetInfo( nPkJoin1, 'ProbeSide', '1')
|
|
EgtSetInfo( nGeom3, 'ProbeSide', '1')
|
|
end
|
|
end
|
|
else
|
|
EC = ErrorBase + 35
|
|
EM = string.format(EgtDoorsMsg[426], sCompoPath)
|
|
end
|
|
elseif not jn2 and EC == 0 and nDrawMach > 0 and nPkToJoin3 then -- altrimenti se non devo concatenare
|
|
-- se mantiene backset su mortise
|
|
if kbs and kbs > 0 then
|
|
EgtSetInfo( nPkToJoin3, 'KeepBackSet', 'w') -- setto 'w' perché il backset viene mantenuto sul lato wide
|
|
EgtSetInfo( nGeom3, 'KeepBackSet', 'w') -- setto 'w' perché il backset viene mantenuto sul lato wide
|
|
end
|
|
if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then
|
|
EgtSetInfo( nPkToJoin3, 'ProbeSide', '1')
|
|
EgtSetInfo( nGeom3, 'ProbeSide', '1')
|
|
end
|
|
end
|
|
|
|
-- aggiungo foro/i probe
|
|
if EC == 0 and nDrawMach > 0 and posh then
|
|
|
|
local dPosProbe = 0
|
|
local sPositiveSuffixProbe = ''
|
|
local sNegativeSuffixProbe = ''
|
|
|
|
if posp and posp > 0 then
|
|
dPosProbe = (L/2) + posp
|
|
sPositiveSuffixProbe = '_POS'
|
|
sNegativeSuffixProbe = '_NEG'
|
|
end
|
|
|
|
local pCentr = Point3d( dPosProbe, posh, 0)
|
|
local hintPr = EgtArc( Lg, pCentr, 1, 0, -360, 0, GDB_RT.LOC)
|
|
|
|
-- verifico se devo forzare direzione orizzontale o seguire il profilo
|
|
local sSideDoorInfo
|
|
if DGC.Fpd then
|
|
sSideDoorInfo = 'LockLH'
|
|
else
|
|
sSideDoorInfo = EgtIf( dl, 'LockLH', 'SideLH')
|
|
end
|
|
|
|
if hintPr then
|
|
EgtModifyCurveThickness( hintPr, -10)
|
|
EgtSetName( hintPr, LH..sPositiveSuffixProbe)
|
|
EgtSetInfo( hintPr, 'SideDoor', sSideDoorInfo)
|
|
end
|
|
if dPosProbe > 0 then
|
|
pCentr = Point3d( -dPosProbe, posh, 0)
|
|
hintPr = EgtArc( Lg, pCentr, 1, 0, -360, 0, GDB_RT.LOC)
|
|
if hintPr then
|
|
EgtModifyCurveThickness( hintPr, -10)
|
|
EgtSetName( hintPr, LH..sNegativeSuffixProbe)
|
|
EgtSetInfo( hintPr, 'SideDoor', sSideDoorInfo)
|
|
end
|
|
end
|
|
end
|
|
|
|
if EC == 0 then
|
|
-- fori ( viti o passaggio filo elettrico)
|
|
for k = 1, 4 do
|
|
|
|
local D10
|
|
local IY10
|
|
local T10
|
|
local I10
|
|
local IT10
|
|
local PX10
|
|
local PY10
|
|
local RP10
|
|
local EB10
|
|
local EBH10
|
|
local HB10
|
|
local AR10
|
|
local RCI10
|
|
local RCIT10
|
|
|
|
if k == 1 then
|
|
D10 = tExtraBore[k][1]
|
|
T10 = tExtraBore[k][2]
|
|
I10 = tExtraBore[k][3]
|
|
PX10 = tExtraBore[k][4]
|
|
PY10 = tExtraBore[k][5]
|
|
EB10 = tExtraBore[k][6]
|
|
HB10 = tExtraBore[k][7]
|
|
IT10 = tExtraBore[k][8]
|
|
else
|
|
D10 = tExtraBore[k][1]
|
|
IY10 = tExtraBore[k][2]
|
|
T10 = tExtraBore[k][3]
|
|
I10 = tExtraBore[k][4]
|
|
PX10 = tExtraBore[k][5]
|
|
PY10 = tExtraBore[k][6]
|
|
RP10 = tExtraBore[k][7]
|
|
EB10 = tExtraBore[k][8]
|
|
EBH10 = tExtraBore[k][9]
|
|
HB10 = tExtraBore[k][10]
|
|
AR10 = tExtraBore[k][11]
|
|
RCI10 = tExtraBore[k][12]
|
|
IT10 = tExtraBore[k][13]
|
|
RCIT10 = tExtraBore[k][14]
|
|
end
|
|
|
|
if dws and T10 and abs(T10) > ttp then
|
|
T10 = ttp
|
|
end
|
|
|
|
if D10 and T10 and ( EB10 or EBH10) then
|
|
if D10 > 0 and T10 ~= 0 and ( EB10 ~= '' or EBH10 ~= '') then
|
|
|
|
if not IY10 then IY10 = 0 end
|
|
if not I10 then I10 = 0 end
|
|
if not PX10 then PX10 = 0 end
|
|
if not PY10 then PY10 = 0 end
|
|
if not AR10 then AR10 = 0 end
|
|
if not IT10 then IT10 = 0 end
|
|
|
|
local dInt10 = (I10/2)
|
|
local dIntT10 = (IT10/2)
|
|
local dPosX10 = PX10
|
|
|
|
if abs(AR10) >= 360 then
|
|
while abs(AR10) >= 360 do
|
|
AR10 = AR10 + EgtIf( AR10 > 0, -360, 360)
|
|
end
|
|
end
|
|
|
|
-- creo foro o asola con eventuale svuotatura a rampa
|
|
MakeBoreOrButtoHole( Lg, bPreview, Dm, nDrawMach, IY10,
|
|
EBH10, EB10, dPosX10, dInt10, dIntT10,
|
|
D10, 0, -PY10, T10, RP10,
|
|
AR10, RCI10, kbs, bEqualTh, HB10,
|
|
dws, pbs, RCIT10)
|
|
|
|
-- se l'interasse lungo lo spessore è valido
|
|
if abs(IT10) > GEO.EPS_SMALL then
|
|
-- creo foro o asola con eventuale svuotatura a rampa
|
|
MakeBoreOrButtoHole( Lg, bPreview, Dm, nDrawMach, IY10,
|
|
EBH10, EB10, dPosX10, dInt10, -dIntT10,
|
|
D10, 0, -PY10, T10, RP10,
|
|
AR10, RCI10, kbs, bEqualTh, HB10,
|
|
dws, pbs, RCIT10)
|
|
end
|
|
|
|
-- se l'interasse lungo l'altezza porta è valido
|
|
if abs(I10) > GEO.EPS_SMALL then
|
|
-- creo foro o asola con eventuale svuotatura a rampa
|
|
MakeBoreOrButtoHole( Lg, bPreview, Dm, nDrawMach, IY10,
|
|
EBH10, EB10, dPosX10, -dInt10, dIntT10,
|
|
D10, 0, -PY10, T10, RP10,
|
|
AR10, RCI10, kbs, bEqualTh, HB10,
|
|
dws, pbs, RCIT10)
|
|
-- se l'interasse lungo lo spessore è valido
|
|
if abs(IT10) > GEO.EPS_SMALL then
|
|
-- creo foro o asola con eventuale svuotatura a rampa
|
|
MakeBoreOrButtoHole( Lg, bPreview, Dm, nDrawMach, IY10,
|
|
EBH10, EB10, dPosX10, -dInt10, -dIntT10,
|
|
D10, 0, -PY10, T10, RP10,
|
|
AR10, RCI10, kbs, bEqualTh, HB10,
|
|
dws, pbs, RCIT10)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
if EC == 0 and nDrawMach > 0 then -- se abilitata geometria lavorazione
|
|
|
|
if dws then -- se frame viene disposto sul lato wide
|
|
|
|
local nIdSideBoxUp
|
|
|
|
if 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
|
|
end
|
|
end
|
|
|
|
--spostamento layer
|
|
-- EgtMove( Lg, Point3d(0,-(D+(H/2)),0) - ORIG())
|
|
-- ciclo di spostamento di tutta la geometria
|
|
local nSubIdGeom = EgtGetFirstInGroup( Lg)
|
|
|
|
while nSubIdGeom do
|
|
EgtMove( nSubIdGeom, Point3d(0,-(D+(H/2)),0) - ORIG())
|
|
nSubIdGeom = EgtGetNext(nSubIdGeom)
|
|
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' ,'ConceleadHinge')
|
|
EgtSetInfo( Lg, 'Nome' ,sCompoName)
|
|
EgtSetInfo( Lg, 'L' ,L)
|
|
EgtSetInfo( Lg, 'H' ,H)
|
|
EgtSetInfo( Lg, 'T' ,T)
|
|
EgtSetInfo( Lg, 'D' ,D)
|
|
EgtSetInfo( Lg, 'rf' ,rf)
|
|
EgtSetInfo( Lg, 'clc' ,clc)
|
|
EgtSetInfo( Lg, 'ccr' ,ccr)
|
|
EgtSetInfo( Lg, 'sf' ,sf)
|
|
EgtSetInfo( Lg, 'L2' ,L2)
|
|
EgtSetInfo( Lg, 'H2' ,H2)
|
|
EgtSetInfo( Lg, 'T2' ,T2)
|
|
EgtSetInfo( Lg, 's' ,s)
|
|
EgtSetInfo( Lg, 'd' ,d)
|
|
EgtSetInfo( Lg, 'p' ,p)
|
|
EgtSetInfo( Lg, 'jn' ,jn)
|
|
EgtSetInfo( Lg, 'jnb' ,jnb)
|
|
EgtSetInfo( Lg, 'mfp' ,mfp)
|
|
EgtSetInfo( Lg, 'd2' ,d2)
|
|
EgtSetInfo( Lg, 'p2' ,p2)
|
|
EgtSetInfo( Lg, 'D_X' ,D_X)
|
|
EgtSetInfo( Lg, 'D_Y' ,D_Y)
|
|
EgtSetInfo( Lg, 'L2a' ,L2a)
|
|
EgtSetInfo( Lg, 'H2a' ,H2a)
|
|
EgtSetInfo( Lg, 'T2a' ,T2a)
|
|
EgtSetInfo( Lg, 'd2a' ,d2a)
|
|
EgtSetInfo( Lg, 'p2a' ,p2a)
|
|
EgtSetInfo( Lg, 's2a' ,s2a)
|
|
EgtSetInfo( Lg, 'jn2' ,jn2)
|
|
EgtSetInfo( Lg, 'posh' ,posh)
|
|
EgtSetInfo( Lg, 'posp' ,posp)
|
|
EgtSetInfo( Lg, 'ech' ,ech)
|
|
EgtSetInfo( Lg, 'est' ,est)
|
|
EgtSetInfo( Lg, 'kbs' ,kbs)
|
|
EgtSetInfo( Lg, 'pbs' ,pbs)
|
|
EgtSetInfo( Lg, 'dws' ,dws)
|
|
EgtSetInfo( Lg, 'dthd' ,dthd)
|
|
EgtSetInfo( Lg, 'ttp' ,ttp)
|
|
EgtSetInfo( Lg, 'DB_X' ,DB_X)
|
|
EgtSetInfo( Lg, 'DB_Y' ,DB_Y)
|
|
EgtSetInfo( Lg, 'invG' ,invG)
|
|
EgtSetInfo( Lg, 'LG' ,LG)
|
|
EgtSetInfo( Lg, 'LM' ,LM)
|
|
EgtSetInfo( Lg, 'LG2' ,LG2)
|
|
EgtSetInfo( Lg, 'LA' ,LA)
|
|
EgtSetInfo( Lg, 'LGM' ,LGM)
|
|
EgtSetInfo( Lg, 'LMM' ,LMM)
|
|
EgtSetInfo( Lg, 'CLH' ,CLH)
|
|
EgtSetInfo( Lg, 'LH' ,LH)
|
|
EgtSetInfo( Lg, 'CH' ,CH)
|
|
EgtSetInfo( Lg, 'Path' ,sCompoPath)
|
|
|
|
-- cancello le parti ausiliarie se disegnate
|
|
if Dm then
|
|
EgtErase( Dm)
|
|
end
|
|
elseif not bPreview then
|
|
-- cancello le parti ausiliarie se disegnate
|
|
if Dm then
|
|
EgtErase( Dm)
|
|
end
|
|
end
|
|
|
|
if EC == 0 and nCodAdj and nCodAdj < 0 then
|
|
EC = nCodAdj
|
|
EM = sCodAdj
|
|
end
|
|
|
|
return EC, EM, Lg
|
|
end
|
|
|
|
return ConcealedHinge
|