cc55202ec5
- primo commit con versione corrente.
1705 lines
71 KiB
Lua
1705 lines
71 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
|
|
--
|
|
-- EdgePullFlat.lua by EgalWare s.r.l. 2016.06.14
|
|
-- Autore: Filippo Monchi
|
|
-- Lock edge pull dati i valori 'L' e 'H' e 'T' e 'd' e 'p' e 'd2' e con nomi attributi
|
|
|
|
-- 2016.09.21 V1.011 FM Add warning messages
|
|
-- 2016.09.21 V1.011 FM Disabled to use reverse geometries _R on tool diameter caculation
|
|
-- 2017.08.30 V1.012 FM Manage Offset_WS if present
|
|
-- 2017.09.05 V1.013 FM Manage lead-in on opposite side and anti-splint path V lead-in
|
|
-- 2018.04.05 V1.014 FM Manage info (KeepBackSet) for adjust probe on Z
|
|
-- 2018.07.20 V1.015 FM Assign note 'LikeStrike' to all geometries if runned as Strike
|
|
-- 2018.10.17 V1.016 FM Add parameter to show into message 402
|
|
-- 2018.10.22 V1.017 FM Add new parameter D_XE to move all geometries
|
|
-- 2018.12.06 V1.018 FM Manage geometry for calculate box without EdgePullFlat volume
|
|
-- 2019.10.10 V1.019 FM Manage steel option (disable to generate pocket path, make closed and extend path)
|
|
-- 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.25 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.26 V2.005 FM Manage geometries for calculate region when frame(jamb) is disposed on wide side
|
|
-- 2020.05.25 V2.006 FM Manage geometries for calculate region when frame(jamb) is disposed on narrow side
|
|
-- 2020.07.01 V2.007 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
|
|
-- 2022.07.27 V3.001 FM Modification to use compiled code
|
|
-- 2022.08.25 V3.002 FM Fix error on use wrong geometry name name hintAS1 instead of hintAs1
|
|
-- 2024.07.19 V3.003 FM Set note 'NotCheckDir' to pocketing, antisplint paths
|
|
-- 2024.10.04 V3.004 FM Manage probe geometry and their offset position when template is disposed
|
|
-- 2024.10.29 V3.005 FM Manage new DGC.Fpd CurrDoorCustomData variable to force shuttle probe geometry to stay horizontal
|
|
|
|
-- Tavola per definizione modulo (serve ma non usata)
|
|
local LockEdgePull = {}
|
|
|
|
-- 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.5
|
|
local sMaxFeed = 'MaxFeed'
|
|
local sRapid = 'Rapid'
|
|
|
|
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 di sistemazione parametri
|
|
function LockEdgePull.AdjustParams( tMhPar)
|
|
|
|
local EgtDoorsMsg = require( 'EgtDoorsMsg')
|
|
local dMaxMat0
|
|
local dMaxMat1
|
|
local dMaxMat2
|
|
local dMaxMat1x
|
|
local dMaxMat2x
|
|
local dNumMessage
|
|
local dNumLog = 0
|
|
local sMessToOut = ''
|
|
local nTempT0
|
|
local nTempT1
|
|
local nTempT2
|
|
local nTempT1x
|
|
local nTempT2x
|
|
local sMchngName0
|
|
local sMchngName1
|
|
local sMchngName2
|
|
local sMchngName1x
|
|
local sMchngName2x
|
|
|
|
-- 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
|
|
|
|
-- do errore se profilo lock 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, 1999, string.format(EgtDoorsMsg[431], tMhPar.Nome, DGD.tProfs.lockedge.trimming)
|
|
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
|
|
|
|
-- Assegno parametri da dati utensili in macchina
|
|
local MB = require( 'MachiningBase')
|
|
local sLM
|
|
local nLMi = 1
|
|
local sLA
|
|
local nLAi = 1
|
|
local sLG
|
|
local nLGi = 1
|
|
local dOffset = 0
|
|
|
|
-- se porta steel o aluminum disabilito l'antischeggia, la svuotatura, il chisel e modifico il nome geometria
|
|
if FindMaterial( DGD.Material, 'steel') or FindMaterial( DGD.Material, 'aluminum') then
|
|
tMhPar.LM = nil
|
|
tMhPar.LA = nil
|
|
tMhPar.ech = false
|
|
tMhPar.CH = nil
|
|
tMhPar.est = true
|
|
tMhPar.d2 = nil
|
|
else
|
|
tMhPar.est = nil
|
|
end
|
|
|
|
-- calcolo altezza effettiva in relazione allo spessore porta
|
|
-- e calcolo punto di partena in Y
|
|
tMhPar.OriH = tMhPar.H
|
|
tMhPar.bETh = true
|
|
tMhPar.fht = 0 -- setto il face h top a 0
|
|
tMhPar.fhb = 0 -- setto il face h bottom a 0
|
|
|
|
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.H = tMhPar.H / cos(3)
|
|
if DGD.OFFSET and DGD.OFFSET > 0 then
|
|
dOffset = ( DGD.OFFSET / cos(3))
|
|
end
|
|
-- setto il flag che indica profilo bevel
|
|
tMhPar.bev = true
|
|
else
|
|
if DGD.OFFSET and DGD.OFFSET > 0 then
|
|
dOffset = DGD.OFFSET
|
|
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
|
|
|
|
-- se altezza supera lo spessore porta la riporto allo stesso valore
|
|
if (tMhPar.OriH-DGD.dT) > 0.001 then -- se altezza oltre lo spessore porta
|
|
if tMhPar.H > tMhPar.OriH then -- se sono su bevel
|
|
tMhPar.H = DGD.dT / cos(3)
|
|
else
|
|
tMhPar.H = DGD.dT
|
|
end
|
|
tMhPar.OriH = DGD.dT
|
|
if DGD.OFFSET and DGD.OFFSET > 0 then
|
|
tMhPar.StY = dOffset
|
|
else
|
|
tMhPar.StY = tMhPar.H/2
|
|
end
|
|
tMhPar.ech = false -- disattivo il chiseling
|
|
tMhPar.rf = 0 -- disattivo il radius face
|
|
tMhPar.clc = nil
|
|
tMhPar.CLC = nil
|
|
elseif abs(tMhPar.OriH-DGD.dT) < 0.001 then -- uguale allo spessore porta
|
|
if DGD.OFFSET and DGD.OFFSET > 0 then
|
|
tMhPar.StY = dOffset
|
|
else
|
|
tMhPar.StY = tMhPar.H/2
|
|
end
|
|
tMhPar.ech = false -- disattivo il chiseling
|
|
tMhPar.rf = 0 -- disattivo il radius face
|
|
tMhPar.clc = nil -- disattivo il clean corner
|
|
tMhPar.CLC = nil
|
|
else -- minore dello spessore porta
|
|
if tMhPar.H > tMhPar.OriH then -- se sono su bevel
|
|
if DGD.OFFSET and DGD.OFFSET > 0 then
|
|
tMhPar.StY = dOffset
|
|
else
|
|
tMhPar.StY = ( ( DGD.dT / cos(3)) * 0.5)
|
|
end
|
|
else
|
|
if DGD.OFFSET and DGD.OFFSET > 0 then
|
|
tMhPar.StY = dOffset
|
|
else
|
|
tMhPar.StY = ( DGD.dT * 0.5)
|
|
end
|
|
end
|
|
tMhPar.bETh = false
|
|
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) + DGD.OFFSET
|
|
else
|
|
tMhPar.posh = 0
|
|
end
|
|
|
|
if tMhPar.bev and not DGC.Fpd then
|
|
tMhPar.posh = tMhPar.posh / cos( 3)
|
|
end
|
|
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 serratura bevel up
|
|
-- se lato cerniere opposto mi troverò il bevel al contrario perché comanda il lato cerniere
|
|
if DGD.bBothOppoBevel then
|
|
nLGi = 3
|
|
nLMi = 3
|
|
nLAi = 3
|
|
else
|
|
nLGi = 2
|
|
nLMi = 2
|
|
nLAi = 2
|
|
end
|
|
elseif DGD.tProfs.lockedge.trimming == 'BD' or DGD.tProfs.lockedge.trimming == 'BDEB' then -- profilo serratura bevel dw
|
|
-- se lato cerniere opposto mi troverò il bevel al contrario perché comanda il lato cerniere
|
|
if DGD.bBothOppoBevel then
|
|
nLGi = 2
|
|
nLMi = 2
|
|
nLAi = 2
|
|
else
|
|
nLGi = 3
|
|
nLMi = 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
|
|
if DGD.MachEn > 0 and tMhPar.d then nTempT1x, dMaxMat1x, sMchngName1x = MB.GetToolDataFromAttrib( sLM ..'_R', nLMi) end
|
|
end
|
|
|
|
if tMhPar.LA then
|
|
sLA = tMhPar.LA
|
|
if DGD.MachEn > 0 and tMhPar.d2 then nTempT2, dMaxMat2, sMchngName2 = MB.GetToolDataFromAttrib( sLA, nLAi) end
|
|
if DGD.MachEn > 0 and tMhPar.d2 then nTempT2x, dMaxMat2x, sMchngName2x = MB.GetToolDataFromAttrib( sLA ..'_R', nLAi) 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
|
|
|
|
-- 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 = -1996
|
|
sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT0, sLG, nLGi, tMhPar.d, dNumLog, sMchngName0)
|
|
elseif tMhPar.est and nTempT0 then
|
|
tMhPar.d = nTempT0
|
|
end
|
|
|
|
--------------------------------------------------------------------------------
|
|
-- se c'è materiale steel faccio in modo che non assegni il diametro utensile
|
|
--------------------------------------------------------------------------------
|
|
-- gestisco il risultato della lettura utensili
|
|
if DGD.bProoduce and not tMhPar.est and tMhPar.d and nTempT1 and nTempT1 <= 0 and nTempT1x and nTempT1x <= 0 then
|
|
dNumLog = -1990
|
|
sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT1, sLM, nLMi, tMhPar.d, dNumLog, sMchngName1)
|
|
elseif not tMhPar.est then
|
|
if nTempT1 and nTempT1 > 0 then
|
|
tMhPar.d = nTempT1
|
|
elseif nTempT1x and nTempT1x > 0 then
|
|
tMhPar.d = nTempT1x
|
|
end
|
|
end
|
|
|
|
-- antischeggia
|
|
if DGD.bProoduce and not tMhPar.est and tMhPar.d2 and nTempT2 and nTempT2 <= 0 and nTempT2x and nTempT2x <= 0 then
|
|
dNumLog = -1990
|
|
sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT2, sLA, nLAi, tMhPar.d2, dNumLog, sMchngName2)
|
|
elseif not tMhPar.est then
|
|
if nTempT2 and nTempT2 > 0 then
|
|
tMhPar.d2 = nTempT2
|
|
elseif nTempT2x and nTempT2x > 0 then
|
|
tMhPar.d2 = nTempT2x
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Regola applicazione chiseling:
|
|
-- se ho impostato un raccordo, anche se poi viene annullato perché inferiore del raggio fresa
|
|
-- disabilito il chiseling perché implica che se c'è un valore di raccordo non devo fare il chiseling
|
|
|
|
-- se ho il raggio valido disabilito il chiseling e il clean corner
|
|
if tMhPar.rf and tMhPar.rf > 0 then
|
|
tMhPar.ech = false
|
|
tMhPar.clc = nil
|
|
tMhPar.CLC = nil
|
|
else -- se non è definito o già nullo lo azzero
|
|
tMhPar.rf = 0
|
|
end
|
|
|
|
-- se devo disegnare le geometrie di lavorazione
|
|
if DGD.MachEn > 0 then
|
|
|
|
-- 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.d and tMhPar.rf < ((tMhPar.d/2)+0.02)) then
|
|
tMhPar.rf = 0
|
|
end
|
|
|
|
-- chiseling
|
|
if tMhPar.ech and tMhPar.d0 and nTempT0 > 0 then
|
|
tMhPar.d0 = nTempT0
|
|
end
|
|
|
|
-- se la profondità della face per steel è maggiore della capacità utensile limito la profondità ed emetto un warning
|
|
if tMhPar.est and tMhPar.T and dMaxMat0 and tMhPar.T > dMaxMat0 then
|
|
dNumLog = -1995
|
|
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) and ( dMaxMat1x and tMhPar.T > dMaxMat1x)) then
|
|
dNumLog = -1998
|
|
dNumMessage = 460
|
|
if dMaxMat1 and tMhPar.T > dMaxMat1 then
|
|
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T), EgtToUiUnits(dMaxMat1))
|
|
tMhPar.T = dMaxMat1
|
|
elseif dMaxMat1x and tMhPar.T > dMaxMat1x then
|
|
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T), EgtToUiUnits(dMaxMat1x))
|
|
tMhPar.T = dMaxMat1x
|
|
end
|
|
end
|
|
|
|
-- se la profondità antischeggia della face é maggiore della capacità utensile limito la profondità ed emetto un warning
|
|
if tMhPar.T and ((dMaxMat2 and tMhPar.T > dMaxMat2) and (dMaxMat2x and tMhPar.T > dMaxMat2x)) then
|
|
dNumLog = -1997
|
|
dNumMessage = 462
|
|
if dMaxMat2 and tMhPar.T > dMaxMat2 then
|
|
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T), EgtToUiUnits(dMaxMat2))
|
|
tMhPar.T = dMaxMat2
|
|
elseif dMaxMat2x and tMhPar.T > dMaxMat2x then
|
|
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T), EgtToUiUnits(dMaxMat2x))
|
|
tMhPar.T = dMaxMat2x
|
|
end
|
|
end
|
|
|
|
-- setto un valore di poco inferiore allo spessore per non fresare le ventose
|
|
local sPieceName
|
|
if tMhPar.Dws then
|
|
tMhPar.TTP = tMhPar.dThD - DGD.Spd
|
|
if DGD.nTypePz == 3 then sPieceName = 'left Jamb'
|
|
elseif DGD.nTypePz == 4 then sPieceName = 'right Jamb'
|
|
elseif DGD.nTypePz == 5 then sPieceName = 'Frame header'
|
|
else sPieceName = 'Threshold' end
|
|
end
|
|
|
|
-- controllo se le profondità delle geometrie non superano lo spessore frame
|
|
if tMhPar.Dws and DGD.Spd > 0 and tMhPar.T and abs(tMhPar.T) > tMhPar.TTP then
|
|
dNumLog = -1994
|
|
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.T and tMhPar.T > 0 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.fht = tMhPar.T / cos(3)
|
|
-- se passante calcolo l'ingombro sulla parte opposta considerando l'angolo
|
|
if tMhPar.bETh then
|
|
tMhPar.fhb = tMhPar.fht + ( DGD.dT * TAN3)
|
|
else
|
|
tMhPar.fhb = tMhPar.fht
|
|
end
|
|
else
|
|
tMhPar.fht = tMhPar.T
|
|
tMhPar.fhb = tMhPar.fht
|
|
end
|
|
end
|
|
|
|
if tMhPar.CLC and tMhPar.clc and tMhPar.clc > 0 and ( tMhPar.clc >= tMhPar.H or tMhPar.clc >= tMhPar.L) then
|
|
tMhPar.clc = nil
|
|
elseif not tMhPar.CLC then
|
|
tMhPar.clc = nil
|
|
end
|
|
end
|
|
|
|
if dNumLog ~= 0 then
|
|
return tMhPar, dNumLog, sMessToOut
|
|
end
|
|
|
|
return tMhPar, 0, ''
|
|
end
|
|
|
|
-- Funzione di disegno
|
|
function LockEdgePull.Draw( tLckP, bPreview, bRunByCompo, nDrawMach, dThickDoor)
|
|
|
|
-- Assegno le dimensioni
|
|
local L = tLckP.L
|
|
local H = tLckP.H
|
|
local T = tLckP.T
|
|
local R = tLckP.rf
|
|
local clc = tLckP.clc
|
|
local ccr = tLckP.ccr
|
|
local d = tLckP.d
|
|
local p = tLckP.p
|
|
local s = tLckP.sf
|
|
local d2 = tLckP.d2
|
|
local ech = tLckP.ech
|
|
local est = tLckP.est -- altro materiale trovato
|
|
local bEqualTh = tLckP.bETh
|
|
local nStartY = tLckP.StY
|
|
local kbs = tLckP.kbs -- keep backset (0: none, 1: only face, 2: all)
|
|
local pbs = tLckP.pbs
|
|
local stk = tLckP.stk
|
|
local fht = tLckP.fht
|
|
local fhb = tLckP.fhb
|
|
local drf = tLckP.drf
|
|
local dws = tLckP.Dws
|
|
local dthd = tLckP.dThD
|
|
local posh = tLckP.posh -- posizione in Y del foro di tastatura
|
|
local posp = tLckP.posp -- posizione in X del foro di tastatura
|
|
-- Disassamento globale
|
|
local D_XE = tLckP.D_XE -- Extra delta on X pos for all geometries
|
|
-- Assegno i nomi
|
|
local LG = tLckP.LG
|
|
local LM = tLckP.LM
|
|
local LA = tLckP.LA
|
|
local CH = tLckP.CH
|
|
local CLC = tLckP.CLC
|
|
local DM = 'DUMMY'
|
|
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
|
|
-- nomi parametri per messaggi
|
|
local sNamePar1 = tLckP.N1 or 'L'
|
|
local sNamePar2 = tLckP.N2 or 'H'
|
|
local sNamePar3 = tLckP.N3 or 'T'
|
|
local sNamePar4 = tLckP.N4 or 'd'
|
|
local sNamePar5 = tLckP.N5 or 'p'
|
|
local sNamePar6 = tLckP.N6 or 'd2'
|
|
local sNamePar7 = tLckP.N7 or 's'
|
|
local sNamePar8 = tLckP.N8 or 'R'
|
|
local sNamePar9 = tLckP.N9 or 'clc'
|
|
local sNamePar10 = tLckP.N10 or 'ccr'
|
|
|
|
-- settaggio opzione per partenza ad angolo o meno
|
|
local bStartAng = true
|
|
local bStartOppo = true
|
|
|
|
-- RunByComponetInterface
|
|
local RC = true
|
|
-- Messaggi codice errori
|
|
local EM = ' '
|
|
local EC = 0
|
|
local ErrorBase = 1900
|
|
|
|
if bRunByCompo == nil or not bRunByCompo then -- controllo se lanciato da componente
|
|
RC = false
|
|
end
|
|
|
|
-- step face: per compatibilità con tutti i componenti, se non è definito lo setto = alla profondità cava
|
|
if not s or abs(s) <= GEO.EPS_SMALL then
|
|
s = T
|
|
end
|
|
|
|
if not D_XE then
|
|
D_XE = 0
|
|
end
|
|
|
|
-- 0 solo geom esterna, 1 solo geom mach, 2 entrambe
|
|
if nDrawMach == nil 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
|
|
if nDrawMach == 1 then -- se ho abilitato solo le geometrie di lavorazione
|
|
nForceMakeFace = 2
|
|
end
|
|
end
|
|
|
|
local EgtDoorsMsg = require( 'EgtDoorsMsg')
|
|
|
|
-- Verifica delle dimensioni, le condizioni vengono verificate in base a quale geometria deve essere creata
|
|
if nDrawMach > 0 and d < DgMin then
|
|
EC = 1
|
|
EM = string.format(EgtDoorsMsg[400],sNamePar4,EgtToUiUnits(d),EgtToUiUnits(DgMin)) -- il diametro utensile deve essere >= di
|
|
d = DgMin
|
|
elseif nDrawMach > 0 and d2 and d2 < DgMin then
|
|
EC = 2
|
|
EM = string.format(EgtDoorsMsg[400],sNamePar6,EgtToUiUnits(d2),EgtToUiUnits(DgMin)) -- il diametro utensile deve essere >= di
|
|
d2 = DgMin
|
|
elseif H <= 0 then
|
|
if DGD.bProoduce then
|
|
EC = 3
|
|
EM = string.format(EgtDoorsMsg[401],sNamePar2,EgtToUiUnits(H), sCompoPath) -- il parametro 'H' deve essere > 0
|
|
H = d
|
|
else
|
|
d = H - 0.002
|
|
end
|
|
elseif nDrawMach > 0 and L <= d then
|
|
if DGD.bProoduce then
|
|
EC = 4
|
|
EM = string.format(EgtDoorsMsg[402],sNamePar1,EgtToUiUnits(L),sNamePar4,EgtToUiUnits(d), sCompoPath) -- il parametro 'L' deve essere maggiore al diametro utensile
|
|
L = d + 0.002
|
|
else
|
|
d = L - 0.002
|
|
end
|
|
elseif nDrawMach > 0 and d2 and L <= d2 then
|
|
if DGD.bProoduce then
|
|
EC = 5
|
|
EM = string.format(EgtDoorsMsg[402],sNamePar1,EgtToUiUnits(L),sNamePar6,EgtToUiUnits(d2), sCompoPath) -- il parametro 'L' deve essere maggiore al diametro utensile
|
|
L = d2 + 0.002
|
|
else
|
|
d2 = L - 0.002
|
|
end
|
|
elseif nDrawMach > 0 and ( p < PtMin or p > PtMax) then
|
|
EC = 6
|
|
EM = string.format(EgtDoorsMsg[403],sNamePar5,p,PtMin,PtMax, sCompoPath) -- il parametro 'p' deve essere compreso tra
|
|
p = 0.8
|
|
elseif T < 0 then
|
|
EC = 7
|
|
EM = string.format(EgtDoorsMsg[404],sNamePar3,EgtToUiUnits(T), sCompoPath) -- il parametro 'T' deve essere >= 0
|
|
T = 0
|
|
elseif L <= 0 then
|
|
EC = 8
|
|
EM = string.format(EgtDoorsMsg[401],sNamePar1,EgtToUiUnits(L), sCompoPath) -- il parametro 'L' deve essere > 0
|
|
L = d
|
|
elseif nDrawMach > 0 and s and s <= 0 then
|
|
EC = 9
|
|
EM = string.format(EgtDoorsMsg[401],sNamePar7,EgtToUiUnits(s), sCompoPath) -- il parametro 's' deve essere > 0
|
|
s = d
|
|
elseif R < 0 then
|
|
EC = 10
|
|
EM = string.format(EgtDoorsMsg[404],sNamePar8,EgtToUiUnits(R), sCompoPath) -- il parametro 'R' deve essere >= 0
|
|
R = d/2
|
|
elseif 2*R >= L then
|
|
EC = 11
|
|
EM = string.format(EgtDoorsMsg[406],sNamePar8,EgtToUiUnits(R),sNamePar1..'/2',EgtToUiUnits(L/2), sCompoPath) -- il parametro 'R' deve essere > 0
|
|
R = d/2
|
|
elseif R >= H then
|
|
EC = 12
|
|
EM = string.format(EgtDoorsMsg[406],sNamePar8,EgtToUiUnits(R),sNamePar2,EgtToUiUnits(H), sCompoPath) -- il parametro 'R' deve essere > 0
|
|
R = d/2
|
|
elseif CLC and clc and ccr and clc > 0 and ccr > 0 and (2*(ccr*sin(45))) >= clc then
|
|
EC = 12
|
|
EM = string.format(EgtDoorsMsg[407],sNamePar9,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
|
|
|
|
local Lg, Dm
|
|
|
|
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 rappresentatte il diametro utensile
|
|
EgtSetName(Dm,DM)
|
|
end
|
|
|
|
local hint1, hint2, hint3, hint4, hint5
|
|
local hint, hintPk, hintAs1, hintAs2, hintPkR, hintAsR1, hintAsR2
|
|
local pIni, pEnd, pCen
|
|
local pIni2, pEnd2
|
|
|
|
if nForceMakeFace ~= 1 then -- se abilitata geometria esterna
|
|
|
|
-- Costruzione della geometria
|
|
if bEqualTh then -- se cava alta come lo spessore porta disegno un contorno chiuso
|
|
if est then -- se altro materiale
|
|
hint1 = DrawAddLineDrawCircle( Point3d(-((L/2)-(d/2)-dExtraH),(nStartY+(d/2)+dExtraH),0), Point3d((L/2),(nStartY+(d/2)+dExtraH),0), Lg, nil, bPreview, Dm, 0, false, false, RED(), RED())
|
|
hint2 = DrawAddLineDrawCircle( Point3d((L/2),(nStartY+(d/2)+dExtraH),0), Point3d((L/2),(nStartY-(H+(d/2)+dExtraH)),0), Lg, nil, bPreview, Dm, 0, false, false, RED(), RED())
|
|
hint3 = DrawAddLineDrawCircle( Point3d((L/2),(nStartY-(H+(d/2)+dExtraH)),0), Point3d(-(L/2),(nStartY-(H+(d/2)+dExtraH)),0), Lg, nil, bPreview, Dm, 0, false, false, RED(), RED())
|
|
hint4 = DrawAddLineDrawCircle( Point3d(-(L/2),(nStartY-(H+(d/2)+dExtraH)),0), Point3d(-(L/2),(nStartY+(d/2)+dExtraH),0), Lg, nil, bPreview, Dm, 0, false, false, RED(), RED())
|
|
hint5 = DrawAddLineDrawCircle( Point3d(-(L/2),(nStartY+(d/2)+dExtraH),0), Point3d(-((L/2)-(d/2)-dExtraH),(nStartY+(d/2)+dExtraH),0), Lg, nil, bPreview, Dm, 0, false, false, RED(), RED())
|
|
else
|
|
hint1 = DrawAddLineDrawCircle( Point3d(0,nStartY,0), Point3d((L/2),nStartY,0), Lg, nil, bPreview, Dm, 0, false, false, RED(), RED())
|
|
hint2 = DrawAddLineDrawCircle( Point3d((L/2),nStartY,0), Point3d((L/2),(nStartY-H),0), Lg, nil, bPreview, Dm, 0, false, false, RED(), RED())
|
|
hint3 = DrawAddLineDrawCircle( Point3d((L/2),(nStartY-H),0), Point3d(-(L/2),(nStartY-H),0), Lg, nil, bPreview, Dm, 0, false, false, RED(), RED())
|
|
hint4 = DrawAddLineDrawCircle( Point3d(-(L/2),(nStartY-H),0), Point3d(-(L/2),nStartY,0), Lg, nil, bPreview, Dm, 0, false, false, RED(), RED())
|
|
hint5 = DrawAddLineDrawCircle( Point3d(-(L/2),nStartY,0), Point3d(0,nStartY,0), Lg, nil, bPreview, Dm, 0, false, false, RED(), RED())
|
|
end
|
|
hint = EgtCurveCompo( Lg, {hint1,hint2,hint3,hint4,hint5}, true)
|
|
else -- altrimenti contorno aperto
|
|
|
|
local tPocket = {}
|
|
|
|
if est then -- se altro materiale
|
|
pIni = Point3d(-((L/2)-(d/2)-dExtraH),(nStartY+(d/2)+dExtraH),0)
|
|
pEnd = Point3d(L/2,(nStartY+(d/2)+dExtraH),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
else
|
|
pIni = Point3d(L/2,nStartY,0)
|
|
end
|
|
|
|
if R > 0 then
|
|
pEnd = Point3d(L/2,(nStartY-H+R),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
pEnd = Point3d(((L/2)-R),(nStartY-H),0)
|
|
pCen = Point3d(((L/2)-R),(nStartY-H+R),0)
|
|
DrawAddCircleDrawCircle( pCen, R, 0,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
else
|
|
pEnd = Point3d(L/2,(nStartY-H),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
end
|
|
|
|
if R > 0 then
|
|
pEnd = Point3d((-(L/2)+R),(nStartY-H),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
pEnd = Point3d(-(L/2),(nStartY-H+R),0)
|
|
pCen = Point3d((-(L/2)+R),(nStartY-H+R),0)
|
|
DrawAddCircleDrawCircle( pCen, R, -90,-90, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
else
|
|
pEnd = Point3d(-(L/2),(nStartY-H),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
end
|
|
|
|
if est then -- se altro materiale
|
|
pEnd = Point3d(-(L/2),(nStartY+(d/2)+dExtraH),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
pEnd = Point3d(-((L/2)-(d/2)-dExtraH),(nStartY+(d/2)+dExtraH),0)
|
|
else
|
|
pEnd = Point3d(-(L/2),nStartY,0)
|
|
end
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
|
|
hint = EgtCurveCompo( Lg, tPocket, true)
|
|
end
|
|
|
|
if hint then
|
|
EgtModifyCurveThickness(hint, -T)
|
|
EgtSetName(hint,LG)
|
|
EgtSetInfo(hint,'SideDoor','Sidelh') -- setto una nota per indicare su che lato della porta deve essere spostato
|
|
if est then
|
|
EgtSetInfo( hint, 'StartFromExt', 1)
|
|
end
|
|
if stk then
|
|
EgtSetInfo(hint,'LikeStrike', '1') -- setto una nota per indicare che è una geometria trattata come strike
|
|
end
|
|
|
|
-- se mantiene backset
|
|
if kbs and kbs > 0 then
|
|
local sKeepMode = 'w' -- setto di default per mantenere il lato wide
|
|
if bEqualTh then -- se spessore passante
|
|
sKeepMode = 'c' -- setto per mantenere il centro dello spessore
|
|
end
|
|
EgtSetInfo( hint, 'KeepBackSet', sKeepMode)
|
|
end
|
|
if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then
|
|
EgtSetInfo( hint, 'ProbeSide', '1')
|
|
end
|
|
end
|
|
|
|
-- Clean corner
|
|
if CLC and clc and clc > 0 and clc < H and clc < L then
|
|
|
|
local CLC1 = MakeClcPath( clc, ccr, CLC, Lg, -T)
|
|
if CLC1 then
|
|
-- se mantiene backset
|
|
if kbs and kbs > 0 then
|
|
local sKeepMode = 'w' -- setto di default per mantenere il lato wide
|
|
if bEqualTh then -- se spessore passante
|
|
sKeepMode = 'c' -- setto per mantenere il centro dello spessore
|
|
end
|
|
EgtSetInfo( CLC1, 'KeepBackSet', sKeepMode)
|
|
end
|
|
if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then
|
|
EgtSetInfo( CLC1, 'ProbeSide', '1')
|
|
end
|
|
EgtSetInfo( CLC1,'SideDoor','Sidelh') -- setto una nota per indicare su che lato della porta deve essere spostato
|
|
if stk then
|
|
EgtSetInfo( CLC1,'LikeStrike', '1') -- setto una nota per indicare che è una geometria trattata come strike
|
|
end
|
|
-- angolo x+y-
|
|
local CLC2 = EgtCopyGlob( CLC1, Lg)
|
|
EgtRotate( CLC2, Point3d(0,0,0), Z_AX(), 180)
|
|
EgtMove( CLC2, Point3d((L/2),nStartY-H,0) - ORIG())
|
|
-- angolo x-y-
|
|
EgtRotate( CLC1, Point3d(0,0,0), Z_AX(), 90)
|
|
EgtMove( CLC1, Point3d(-(L/2),nStartY-H,0) - ORIG())
|
|
end
|
|
end
|
|
end
|
|
|
|
-----------------------------------------------
|
|
-----------------------------------------------
|
|
-- Costruzione delle geometrie di lavorazione
|
|
-----------------------------------------------
|
|
-----------------------------------------------
|
|
if nDrawMach > 0 then -- se abilitata geometria lavorazione
|
|
|
|
if not Lg then
|
|
Lg = EgtGroup(Pz,GDB_RT.LOC)
|
|
EgtSetName(Lg,sCompoName)
|
|
end
|
|
|
|
local dZedStart
|
|
local dZedWork
|
|
local nStep
|
|
local dStep
|
|
local nPass
|
|
|
|
-- geometria antischeggia
|
|
if d2 then -- se parametro valido
|
|
|
|
local tPocketAs = {}
|
|
local tPocketAs2 = {}
|
|
|
|
if s >= T then -- se passo unico
|
|
|
|
local dPosY, dEndPosY, dIniPosY, dDeltaPosX
|
|
local dPosY2, dEndPosY2, dIniPosY2
|
|
|
|
if bStartAng then -- se lead-in con angolo
|
|
|
|
if H >= (d2*3/4) then
|
|
if (H-R) > (d2/4) then
|
|
dEndPosY = (nStartY-(d2/4))
|
|
dEndPosY2 = (nStartY-H+(d2/4))
|
|
else
|
|
dEndPosY = (nStartY-(H-R))
|
|
dEndPosY2 = (nStartY-R)
|
|
end
|
|
else
|
|
if (H-R) > 0 then
|
|
dEndPosY = (nStartY-(H-R))
|
|
dEndPosY2 = (nStartY-R)
|
|
else
|
|
dEndPosY = (nStartY-H+(d2/2))
|
|
dEndPosY2 = (nStartY-(d2/2))
|
|
end
|
|
end
|
|
|
|
dPosY = dEndPosY + (d2/8)
|
|
dPosY2 = dEndPosY2 - (d2/8)
|
|
dIniPosY = dPosY + (d2*7/8)
|
|
dIniPosY2 = dPosY2 - (d2*7/8)
|
|
dDeltaPosX = ( (d2*7/8) / tan(30))
|
|
|
|
-- linea entrante inclinata
|
|
pIni = Point3d(-((L-d2)/2) + 0.2 + dDeltaPosX, dIniPosY,0)
|
|
pEnd = Point3d(-((L-d2)/2) + 0.2, dPosY,0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
|
|
-- linea entrante in Y
|
|
pIni = pEnd
|
|
pEnd = Point3d(-((L-d2)/2) + 0.2, dEndPosY,0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
-- linee tangente al percorso
|
|
pIni = pEnd
|
|
pEnd = Point3d(-((L-d2)/2), dEndPosY,0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
-- linea di uscita
|
|
pIni = pEnd
|
|
pEnd = Point3d(-((L-d2)/2),(nStartY+(d2*3/4)),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
if bEqualTh then
|
|
|
|
-- linea entrante inclinata
|
|
pIni = Point3d((((L-d2)/2) - 0.2 - dDeltaPosX), dIniPosY2,0)
|
|
pEnd = Point3d((((L-d2)/2) - 0.2), dPosY2,0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs2, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
|
|
-- linea entrante in Y
|
|
pIni = pEnd
|
|
pEnd = Point3d((((L-d2)/2) - 0.2), dEndPosY2,0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
-- linee tangente al percorso
|
|
pIni = pEnd
|
|
pEnd = Point3d(((L-d2)/2), dEndPosY2,0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
-- linea di uscita
|
|
pIni = pEnd
|
|
pEnd = Point3d(((L-d2)/2),(nStartY-H-(d2*3/4)),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
end
|
|
else -- lead-in diritto
|
|
|
|
if H >= (d2*3/4) then
|
|
if (H-R) > (d2/4) then
|
|
dEndPosY = (nStartY-(d2/4))
|
|
dEndPosY2 = (nStartY-H+(d2/4))
|
|
else
|
|
dEndPosY = (nStartY-(H-R))
|
|
dEndPosY2 = (nStartY-R)
|
|
end
|
|
else
|
|
if (H-R) > 0 then
|
|
dEndPosY = (nStartY-(H-R))
|
|
dEndPosY2 = (nStartY-R)
|
|
else
|
|
dEndPosY = (nStartY-H+(d2/2))
|
|
dEndPosY2 = (nStartY-(d2/2))
|
|
end
|
|
end
|
|
|
|
dIniPosY = (nStartY+(d2*3/4))
|
|
dIniPosY2 = (nStartY-H-(d2*3/4))
|
|
|
|
pIni = Point3d(-((L-d2)/2), dIniPosY,0)
|
|
pEnd = Point3d(-((L-d2)/2), dEndPosY,0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
|
|
if bEqualTh then
|
|
pIni = Point3d(((L-d2)/2), dIniPosY2,0)
|
|
pEnd = Point3d(((L-d2)/2), dEndPosY2,0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs2, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
end
|
|
end
|
|
|
|
-- trasformo in geometria composita
|
|
if ( #tPocketAs > 0) then
|
|
hintAs1 = EgtCurveCompo( Lg, tPocketAs, true)
|
|
if hintAs1 then
|
|
EgtModifyCurveThickness( hintAs1, -T)
|
|
EgtSetName( hintAs1, LA)
|
|
EgtSetInfo( hintAs1, 'SideDoor', 'Sidelh') -- setto una nota per indicare su che lato della porta deve essere spostato
|
|
EgtSetInfo( hintAs1, 'NotCheckDir', '1')
|
|
if stk then
|
|
EgtSetInfo( hintAs1, 'LikeStrike', '1') -- setto una nota per indicare che è una geometria trattata come strike
|
|
end
|
|
-- se mantiene backset
|
|
if kbs and kbs > 0 then
|
|
local sKeepMode = 'w' -- setto di default per mantenere il lato wide
|
|
if bEqualTh then -- se spessore passante
|
|
sKeepMode = 'c' -- setto per mantenere il centro dello spessore
|
|
end
|
|
EgtSetInfo( hintAs1, 'KeepBackSet', sKeepMode)
|
|
end
|
|
if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then
|
|
EgtSetInfo( hintAs1, 'ProbeSide', '1')
|
|
end
|
|
end
|
|
end
|
|
|
|
if ( #tPocketAs2 > 0) then
|
|
hintAs2 = EgtCurveCompo( Lg, tPocketAs2, true)
|
|
if hintAs2 then
|
|
EgtModifyCurveThickness(hintAs2, -T)
|
|
EgtSetName( hintAs2, LA)
|
|
EgtSetInfo( hintAs2, 'SideDoor', 'Sidelh') -- setto una nota per indicare su che lato della porta deve essere spostato
|
|
EgtSetInfo( hintAs2, 'NotCheckDir', '1')
|
|
if stk then
|
|
EgtSetInfo( hintAs2, 'LikeStrike', '1') -- setto una nota per indicare che è una geometria trattata come strike
|
|
end
|
|
-- se mantiene backset
|
|
if kbs and kbs > 0 then
|
|
local sKeepMode = 'w' -- setto di default per mantenere il lato wide
|
|
if bEqualTh then -- se spessore passante
|
|
sKeepMode = 'c' -- setto per mantenere il centro dello spessore
|
|
end
|
|
EgtSetInfo( hintAs2, 'KeepBackSet', sKeepMode)
|
|
end
|
|
if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then
|
|
EgtSetInfo( hintAS2, 'ProbeSide', '1')
|
|
end
|
|
end
|
|
end
|
|
else -- altrimenti più passate
|
|
|
|
nStep = ceil(T/s) -- numero di passate
|
|
dStep = (T/nStep) -- passo ricalcolato
|
|
nPass = 1
|
|
dZedStart = 0
|
|
local tMVar = {}
|
|
local tMVar2 = {}
|
|
local nConEnt
|
|
local sKindVar
|
|
local dPosY, dEndPosY, dIniPosY, dDeltaPosX
|
|
local dPosY2, dEndPosY2, dIniPosY2
|
|
|
|
while nPass <= nStep do
|
|
|
|
dZedWork = dZedStart - dStep
|
|
if nPass == nStep then
|
|
dZedWork = -T
|
|
end
|
|
|
|
if bStartAng then -- se lead-in con angolo
|
|
|
|
if H >= (d2*3/4) then
|
|
if (H-R) > (d2/4) then
|
|
dEndPosY = (nStartY-(d2/4))
|
|
dEndPosY2 = (nStartY-H+(d2/4))
|
|
else
|
|
dEndPosY = (nStartY-(H-R))
|
|
dEndPosY2 = (nStartY-R)
|
|
end
|
|
else
|
|
if (H-R) > 0 then
|
|
dEndPosY = (nStartY-(H-R))
|
|
dEndPosY2 = (nStartY-R)
|
|
else
|
|
dEndPosY = (nStartY-H+(d2/2))
|
|
dEndPosY2 = (nStartY-(d2/2))
|
|
end
|
|
end
|
|
|
|
dPosY = dEndPosY + (d2/8)
|
|
dPosY2 = dEndPosY2 - (d2/8)
|
|
dIniPosY = dPosY + (d2*7/8)
|
|
dIniPosY2 = dPosY2 - (d2*7/8)
|
|
dDeltaPosX = ( (d2*7/8) / tan(30))
|
|
|
|
-- linea entrante inclinata
|
|
pIni = Point3d(-((L-d2)/2) + 0.2 + dDeltaPosX, dIniPosY, dZedWork)
|
|
pEnd = Point3d(-((L-d2)/2) + 0.2, dPosY, dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
|
|
-- linea entrante in Y
|
|
pIni = pEnd
|
|
pEnd = Point3d(-((L-d2)/2) + 0.2, dEndPosY, dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
-- linee tangente al percorso
|
|
pIni = pEnd
|
|
pEnd = Point3d(-((L-d2)/2), dEndPosY, dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
-- linea di uscita
|
|
pIni = pEnd
|
|
pEnd = Point3d(-((L-d2)/2),(nStartY+(d2*3/4)), dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
pIni = pEnd
|
|
pEnd = Point3d(-((L-d2)/2) + 0.2 + dDeltaPosX, pIni:getY(), dZedWork)
|
|
|
|
if bEqualTh then
|
|
|
|
-- linea entrante inclinata
|
|
pIni2 = Point3d(((L-d2)/2) - 0.2 - dDeltaPosX, dIniPosY2,dZedWork)
|
|
pEnd2 = Point3d(((L-d2)/2) - 0.2, dPosY2,dZedWork)
|
|
DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
|
|
-- linea entrante in Y
|
|
pIni2 = pEnd2
|
|
pEnd2 = Point3d(((L-d2)/2) - 0.2, dEndPosY2,dZedWork)
|
|
DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
-- linee tangente al percorso
|
|
pIni2 = pEnd2
|
|
pEnd2 = Point3d(((L-d2)/2), dEndPosY2,dZedWork)
|
|
DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
-- linea di uscita
|
|
pIni2 = pEnd2
|
|
pEnd2 = Point3d(((L-d2)/2),(nStartY-H-(d2*3/4)),dZedWork)
|
|
DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
pIni2 = pEnd2
|
|
pEnd2 = Point3d(((L-d2)/2) - 0.2 - dDeltaPosX, pIni2:getY(), dZedWork)
|
|
end
|
|
else -- lead-in diritto
|
|
|
|
if H >= (d2*3/4) then
|
|
if (H-R) > (d2/4) then
|
|
dEndPosY = (nStartY-(d2/4))
|
|
dEndPosY2 = (nStartY-H+(d2/4))
|
|
else
|
|
dEndPosY = (nStartY-(H-R))
|
|
dEndPosY2 = (nStartY-R)
|
|
end
|
|
else
|
|
if (H-R) > 0 then
|
|
dEndPosY = (nStartY-(H-R))
|
|
dEndPosY2 = (nStartY-R)
|
|
else
|
|
dEndPosY = (nStartY-H+(d2/2))
|
|
dEndPosY2 = (nStartY-(d2/2))
|
|
end
|
|
end
|
|
|
|
dIniPosY = (nStartY+(d2*3/4))
|
|
dIniPosY2 = (nStartY-H-(d2*3/4))
|
|
|
|
pIni = Point3d((-((L-d2)/2) + 0.2), dIniPosY, dZedWork)
|
|
pEnd = Point3d((-((L-d2)/2) + 0.2), dEndPosY, dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
|
|
-- faccio il ritorno alla posizione di partenza
|
|
pIni = pEnd
|
|
pEnd = Point3d(-((L-d2)/2), dEndPosY, dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
pIni = pEnd
|
|
pEnd = Point3d( pIni:getX(), dIniPosY, dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
pIni = pEnd
|
|
pEnd = Point3d(-((L-d2)/2) + 0.2, pIni:getY(), dZedWork)
|
|
|
|
if bEqualTh then
|
|
|
|
pIni2 = Point3d(((L-d2)/2) - 0.2, dIniPosY2, dZedWork)
|
|
pEnd2 = Point3d(((L-d2)/2) - 0.2, dEndPosY2, dZedWork)
|
|
DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), true, true, ORANGE(), ORANGE())
|
|
|
|
-- faccio il ritorno alla posizione di partenza
|
|
pIni2 = pEnd2
|
|
pEnd2 = Point3d(((L-d2)/2), dEndPosY2, dZedWork)
|
|
DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
pIni2 = pEnd2
|
|
pEnd2 = Point3d( pIni2:getX(), dIniPosY2, dZedWork)
|
|
DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true, ORANGE(), ORANGE())
|
|
|
|
pIni2 = pEnd2
|
|
pEnd2 = Point3d(((L-d2)/2) + 0.2, pIni2:getY(), dZedWork)
|
|
end
|
|
end
|
|
|
|
nPass = nPass + 1
|
|
dZedStart = dZedWork
|
|
|
|
-- se ho altri passi scendo in z
|
|
if nPass <= nStep then
|
|
local pIniLoc = pEnd
|
|
pEnd = Point3d(pIniLoc:getX(), pIniLoc:getY(), (dZedStart - dStep))
|
|
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocketAs, bPreview, Dm, (d2/2), false, true,
|
|
ORANGE(), ORANGE(), sMaxFeed)
|
|
table.insert( tMVar, {nConEnt,sKindVar})
|
|
if bEqualTh then
|
|
local pIniLoc2 = pEnd2
|
|
pEnd2 = Point3d(pIniLoc2:getX(), pIniLoc2:getY(), (dZedStart - dStep))
|
|
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni2, pEnd2, Lg, tPocketAs2, bPreview, Dm, (d2/2), false, true,
|
|
ORANGE(), ORANGE(), sMaxFeed)
|
|
table.insert( tMVar2, {nConEnt,sKindVar})
|
|
end
|
|
end
|
|
end -- end while
|
|
|
|
-- trasformo in geometria composita
|
|
if ( #tPocketAs > 0) then
|
|
hintAs1 = EgtCurveCompo( Lg, tPocketAs, true)
|
|
if hintAs1 then
|
|
EgtModifyCurveThickness( hintAs1, 0)
|
|
-- assegno nota con la lista delle entità di variazione
|
|
local sListEnt = ''
|
|
for i = 1, #tMVar do
|
|
sListEnt = sListEnt .. '{ ent=' .. EgtNumToString( tMVar[i][1], 0) .. ', ' .. 'code=' .. tMVar[i][2] .. '}'
|
|
if i < #tMVar then
|
|
sListEnt = sListEnt .. ','
|
|
end
|
|
end -- end for
|
|
if string.len( sListEnt) > 0 then EgtSetInfo( hintAs1, 'MVar', sListEnt) end
|
|
EgtSetName( hintAs1, LA)
|
|
EgtSetInfo( hintAs1, 'NotCheckDir', '1')
|
|
EgtSetInfo( hintAs1, 'SideDoor', 'Sidelh') -- setto una nota per indicare su che lato della porta deve essere spostato
|
|
if stk then
|
|
EgtSetInfo( hintAs1, 'LikeStrike', '1') -- setto una nota per indicare che è una geometria trattata come strike
|
|
end
|
|
-- se mantiene backset
|
|
if kbs and kbs > 0 then
|
|
local sKeepMode = 'w' -- setto di default per mantenere il lato wide
|
|
if bEqualTh then -- se spessore passante
|
|
sKeepMode = 'c' -- setto per mantenere il centro dello spessore
|
|
end
|
|
EgtSetInfo( hintAs1, 'KeepBackSet', sKeepMode)
|
|
end
|
|
if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then
|
|
EgtSetInfo( hintAs1, 'ProbeSide', '1')
|
|
end
|
|
end
|
|
end
|
|
|
|
if ( #tPocketAs2 > 0) then
|
|
hintAs2 = EgtCurveCompo( Lg, tPocketAs2, true)
|
|
if hintAs2 then
|
|
EgtModifyCurveThickness( hintAs2, 0)
|
|
-- assegno nota con la lista delle entità di variazione
|
|
local sListEnt = ''
|
|
for i = 1, #tMVar2 do
|
|
sListEnt = sListEnt .. '{ ent=' .. EgtNumToString( tMVar2[i][1], 0) .. ', ' .. 'code=' .. tMVar2[i][2] .. '}'
|
|
if i < #tMVar2 then
|
|
sListEnt = sListEnt .. ','
|
|
end
|
|
end -- end for
|
|
if string.len( sListEnt) > 0 then EgtSetInfo( hintAs2, 'MVar', sListEnt) end
|
|
EgtSetName( hintAs2, LA)
|
|
EgtSetInfo( hintAs2, 'NotCheckDir', '1')
|
|
EgtSetInfo( hintAs2, 'SideDoor', 'Sidelh') -- setto una nota per indicare su che lato della porta deve essere spostato
|
|
if stk then
|
|
EgtSetInfo( hintAs2, 'LikeStrike', '1') -- setto una nota per indicare che è una geometria trattata come strike
|
|
end
|
|
-- se mantiene backset
|
|
if kbs and kbs > 0 then
|
|
local sKeepMode = 'w' -- setto di default per mantenere il lato wide
|
|
if bEqualTh then -- se spessore passante
|
|
sKeepMode = 'c' -- setto per mantenere il centro dello spessore
|
|
end
|
|
EgtSetInfo( hintAs2, 'KeepBackSet', sKeepMode)
|
|
end
|
|
if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then
|
|
EgtSetInfo( hintAS2, 'ProbeSide', '1')
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
---------------------------------------
|
|
-- geometria svuotatura giro esterno
|
|
---------------------------------------
|
|
|
|
if not est then -- se non c'è lavorazione steel
|
|
|
|
local tPocket = {}
|
|
local tMVar = {}
|
|
local nConEnt
|
|
local sKindVar
|
|
local pStart
|
|
nStep = ceil(T/s) -- numero di passate
|
|
dStep = (T/nStep) -- passo ricalcolato
|
|
nPass = 1
|
|
dZedStart = 0
|
|
|
|
while nPass <= nStep do
|
|
|
|
dZedWork = dZedStart - dStep
|
|
if nPass == nStep then
|
|
dZedWork = -T
|
|
end
|
|
|
|
if bStartOppo then
|
|
pIni = Point3d(-((L-d)/2) + 0.2,(nStartY+(d*3/4)),dZedWork)
|
|
pStart = pIni -- memorizzo punto per ritorno e reiniziare nuovo step
|
|
-- linea in Y con centro utensile fuori
|
|
pEnd = Point3d(-((L-d)/2) + 0.2,(nStartY+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), true, true, RED(), RED())
|
|
-- linea traversa in X per andare sul vecchio punto iniziale (in X)
|
|
pIni = pEnd
|
|
pEnd = Point3d(((L-d)/2),(nStartY+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED())
|
|
pIni = pEnd
|
|
else
|
|
pIni = Point3d(((L-d)/2),(nStartY+(d*3/4)),dZedWork)
|
|
pStart = pIni -- memorizzo punto per ritorno e reiniziare nuovo step
|
|
end
|
|
|
|
local bDrawCircle = EgtIf( bStartOppo, false, true)
|
|
|
|
if H <= (d/2) then -- se cava troppo bassa
|
|
|
|
-- linea entrante in Y
|
|
if bEqualTh then
|
|
pEnd = Point3d(((L-d)/2),(nStartY-H-dExtraH),dZedWork)
|
|
else
|
|
pEnd = Point3d(((L-d)/2),(nStartY-H+(d/2)),dZedWork)
|
|
end
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), bDrawCircle, true, RED(), RED())
|
|
-- linea traversa in X
|
|
pIni = pEnd
|
|
if bEqualTh then
|
|
pEnd = Point3d(-((L-d)/2),(nStartY-H-dExtraH),dZedWork)
|
|
else
|
|
pEnd = Point3d(-((L-d)/2),(nStartY-H+(d/2)),dZedWork)
|
|
end
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED())
|
|
-- linea di risalita in Y
|
|
pIni = pEnd
|
|
pEnd = Point3d(-((L-d)/2),(nStartY+(d*3/4)),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED())
|
|
pIni = pEnd
|
|
else
|
|
|
|
if R > (d/2) then -- NB se c'è il raggio non è passante
|
|
-- linea entrante in Y
|
|
pEnd = Point3d(((L-d)/2),(nStartY-H+R),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), bDrawCircle, true, RED(), RED())
|
|
-- raccordo 1
|
|
pIni = pEnd
|
|
pEnd = Point3d(((L/2)-R),(nStartY-H+(d/2)),dZedWork)
|
|
pCen = Point3d(((L/2)-R),(nStartY-H+R),dZedWork)
|
|
DrawAddCircleDrawCircle( pCen, (R-(d/2)), 0,-90, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED())
|
|
-- linea traversa in X
|
|
pIni = pEnd
|
|
pEnd = Point3d((-(L/2)+R),(nStartY-H+(d/2)),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED())
|
|
-- raccordo 2
|
|
pIni = pEnd
|
|
pEnd = Point3d(-((L-d)/2),(nStartY-H+R),dZedWork)
|
|
pCen = Point3d((-(L/2)+R),(nStartY-H+R),dZedWork)
|
|
DrawAddCircleDrawCircle( pCen, (R-(d/2)), -90,-90, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED())
|
|
pIni = pEnd
|
|
else
|
|
-- linea entrante in Y
|
|
if bEqualTh then
|
|
pEnd = Point3d(((L-d)/2),(nStartY-H-dExtraH),dZedWork)
|
|
else
|
|
pEnd = Point3d(((L-d)/2),(nStartY-H+(d/2)),dZedWork)
|
|
end
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), bDrawCircle, true, RED(), RED())
|
|
-- linea traversa in X
|
|
pIni = pEnd
|
|
if bEqualTh then
|
|
pEnd = Point3d(-((L-d)/2),(nStartY-H-dExtraH),dZedWork)
|
|
else
|
|
pEnd = Point3d(-((L-d)/2),(nStartY-H+(d/2)),dZedWork)
|
|
end
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED())
|
|
pIni = pEnd
|
|
end
|
|
|
|
-- linea di risalita in Y
|
|
pEnd = Point3d(-((L-d)/2),(nStartY+dExtraH),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, RED(), RED())
|
|
pIni = pEnd
|
|
|
|
-- linea di riposizionamento in X
|
|
if bStartOppo then
|
|
pEnd = Point3d(-(((L*2)-(d*3))/4),(nStartY+dExtraH),dZedWork)
|
|
else
|
|
pEnd = Point3d((((L*2)-(d*3))/4),(nStartY+dExtraH),dZedWork)
|
|
end
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW())
|
|
pIni = pEnd
|
|
|
|
local nDirVers = EgtIf( bStartOppo, 1, -1)
|
|
local nDistYcentr = (d*p)
|
|
local nPosYcentr = (nStartY+dExtraH) - nDistYcentr
|
|
local bContinue
|
|
local nDeltaXPk = 0
|
|
|
|
if bEqualTh then
|
|
bContinue = nPosYcentr > nStartY-H
|
|
else
|
|
bContinue = nPosYcentr > (nStartY-H+(d/2))
|
|
end
|
|
|
|
-- se c'è il raggio e la coordinata Y è entrata nell'influenza del raccordo ne calcolo il delta in x
|
|
if bContinue and R > (d/2) and nPosYcentr < (nStartY-H+R) then
|
|
local nDeltaY = nPosYcentr - (nStartY-H+R)
|
|
nDeltaXPk = (R-(d/2)) - sqrt( ((R-(d/2))*(R-(d/2))) - (nDeltaY*nDeltaY))
|
|
end
|
|
|
|
if bContinue then
|
|
pEnd = Point3d((-nDirVers * ((((L*2)-(d*3))/4)-nDeltaXPk)),nPosYcentr,dZedWork)
|
|
end
|
|
|
|
-- ciclo passate svuotatura
|
|
while bContinue do
|
|
|
|
-- linea affondamento in Y
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW())
|
|
pIni = pEnd
|
|
|
|
-- linea passata in X
|
|
pEnd = Point3d((nDirVers * ((((L*2)-(d*3))/4)-nDeltaXPk)),nPosYcentr,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW())
|
|
|
|
-- calcolo nuovo passo in Y e indice direzione
|
|
nPosYcentr = nPosYcentr - nDistYcentr
|
|
if bEqualTh then
|
|
bContinue = nPosYcentr > nStartY-H
|
|
else
|
|
bContinue = nPosYcentr > (nStartY-H+(d/2))
|
|
end
|
|
|
|
-- calcolo il delta x relativo alla presenza del raccordo
|
|
if bContinue and R > (d/2) and nPosYcentr < (nStartY-H+R) then
|
|
local nDeltaY = nPosYcentr - (nStartY-H+R)
|
|
nDeltaXPk = (R-(d/2)) - sqrt( ((R-(d/2))*(R-(d/2))) - (nDeltaY*nDeltaY))
|
|
end
|
|
|
|
-- se ancora dentro l'area
|
|
if bContinue then
|
|
nDirVers = -nDirVers
|
|
-- ricalcolo punti per linea successiva
|
|
pIni = pEnd
|
|
pEnd = Point3d((-nDirVers * ((((L*2)-(d*3))/4)-nDeltaXPk)),nPosYcentr,dZedWork)
|
|
end
|
|
end -- end while
|
|
|
|
-- linea di risalita in Y
|
|
pIni = pEnd
|
|
pEnd = Point3d(pIni:getX(), (nStartY+(d*3/4)), dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW())
|
|
end
|
|
|
|
nPass = nPass + 1
|
|
dZedStart = dZedWork
|
|
|
|
-- se ho altri passi torno al punto di inizio
|
|
if nPass <= nStep then
|
|
pIni = pEnd
|
|
pEnd = Point3d(pStart:getX(), pStart:getY(), (dZedStart - dStep))
|
|
_, nConEnt, sKindVar = DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true,
|
|
YELLOW(), YELLOW(), sMaxFeed)
|
|
table.insert( tMVar, {nConEnt,sKindVar})
|
|
end
|
|
end -- end while
|
|
|
|
-- trasformo in geometria composita
|
|
if ( #tPocket > 0) then
|
|
hintPk = EgtCurveCompo( Lg, tPocket, true)
|
|
if hintPk then
|
|
EgtModifyCurveThickness( hintPk, 0)
|
|
-- assegno nota con la lista delle entità di variazione
|
|
local sListEnt = ''
|
|
for i = 1, #tMVar do
|
|
sListEnt = sListEnt .. '{ ent=' .. EgtNumToString( tMVar[i][1], 0) .. ', ' .. 'code=' .. tMVar[i][2] .. '}'
|
|
if i < #tMVar then
|
|
sListEnt = sListEnt .. ','
|
|
end
|
|
end -- end for
|
|
if string.len( sListEnt) > 0 then EgtSetInfo( hintPk, 'MVar', sListEnt) end
|
|
EgtSetName( hintPk, LM)
|
|
EgtSetInfo( hintPk, 'SideDoor', 'Sidelh') -- setto una nota per indicare su che lato della porta deve essere spostato
|
|
EgtSetInfo( hintPk, 'NotCheckDir', '1')
|
|
if stk then
|
|
EgtSetInfo( hintPk, 'LikeStrike', '1') -- setto una nota per indicare che è una geometria trattata come strike
|
|
end
|
|
-- se mantiene backset
|
|
if kbs and kbs > 0 then
|
|
local sKeepMode = 'w' -- setto di default per mantenere il lato wide
|
|
if bEqualTh then -- se spessore passante
|
|
sKeepMode = 'c' -- setto per mantenere il centro dello spessore
|
|
end
|
|
EgtSetInfo( hintPk, 'KeepBackSet', sKeepMode)
|
|
end
|
|
if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then
|
|
EgtSetInfo( hintPk, 'ProbeSide', '1')
|
|
end
|
|
else
|
|
EC = ErrorBase + 13
|
|
EM = string.format(EgtDoorsMsg[427], sCompoPath)
|
|
end
|
|
end
|
|
end
|
|
|
|
if EC == 0 then
|
|
|
|
if not dws then -- se frame viene disposto sul lato narrow o è sulla porta(disposto sul lato stretto)
|
|
|
|
-- se la sezione supera 1/6 dello spessore porta
|
|
-- 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 = EgtRectangle2P( Lg, Point3d((L/2),0,nStartY), Point3d(-(L/2),-fhb,nStartY), GDB_RT.GRID)
|
|
-- 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 nIdSideBoxUp then
|
|
if bEqualTh then
|
|
EgtModifyCurveThickness(nIdSideBoxUp, -dThickDoor)
|
|
else
|
|
EgtModifyCurveThickness(nIdSideBoxUp, -H)
|
|
end
|
|
EgtSetName( nIdSideBoxUp, 'upper')
|
|
EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper')
|
|
end
|
|
EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.TOP))
|
|
end
|
|
--debug
|
|
-- EgtSaveFile()
|
|
-- EgtMove(DGD.PZ, Point3d(0,0,nil) - ORIG())
|
|
else -- altrimenti frame viene disposto sul lato wide
|
|
|
|
local nIdSideBoxUp
|
|
|
|
if hint then
|
|
nIdSideBoxUp = EgtCopyGlob( hint, Lg)
|
|
EgtSetName( nIdSideBoxUp, 'upper')
|
|
EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper')
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- aggiungo foro probe
|
|
if EC == 0 and nDrawMach > 0 and posh and L then
|
|
|
|
local dPosProbe = 0
|
|
local sPositiveSuffixProbe = ''
|
|
local sNegativeSuffixProbe = ''
|
|
|
|
if posp and posp > 0 then
|
|
dPosProbe = (L/2) + posp
|
|
sPositiveSuffixProbe = '_NEG'
|
|
sNegativeSuffixProbe = '_POS'
|
|
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 = 'Sidelh'
|
|
if DGC.Fpd then
|
|
sSideDoorInfo = 'Lock'
|
|
end
|
|
|
|
if hintPr then
|
|
EgtModifyCurveThickness( hintPr, -10)
|
|
EgtSetName( hintPr, LH..sPositiveSuffixProbe)
|
|
EgtSetInfo( hintPr, 'SideDoor', sSideDoorInfo)
|
|
if stk then
|
|
EgtSetInfo( hintPr, 'LikeStrike', '1') -- setto una nota per indicare che è una geometria trattata come strike
|
|
end
|
|
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)
|
|
if stk then
|
|
EgtSetInfo( hintPr, 'LikeStrike', '1') -- setto una nota per indicare che è una geometria trattata come strike
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
if EC == 0 and D_XE and D_XE ~= 0 then
|
|
EgtMove( Lg, Point3d(0,D_XE,0) - ORIG())
|
|
end
|
|
|
|
-- cambio colore alla geometria
|
|
if bPreview then
|
|
if EC == 0 then
|
|
if hint then
|
|
EgtSetColor(hint,AQUA())
|
|
end
|
|
if hintAs1 then
|
|
EgtSetColor(hintAs1,AQUA())
|
|
end
|
|
if hintAs2 then
|
|
EgtSetColor(hintAs2,AQUA())
|
|
end
|
|
if hintPk then
|
|
EgtSetColor(hintPk,AQUA())
|
|
end
|
|
else
|
|
if hint then
|
|
EgtSetColor(hint,ORANGE())
|
|
end
|
|
if hintAs1 then
|
|
EgtSetColor(hintAs1,ORANGE())
|
|
end
|
|
if hintAs2 then
|
|
EgtSetColor(hintAs2,ORANGE())
|
|
end
|
|
if hintPk then
|
|
EgtSetColor(hintPk,ORANGE())
|
|
end
|
|
end
|
|
else -- altrimenti non Preview
|
|
|
|
-- (NOTA : se ci sono errori il componente non viene eseguito dal programma di gestione dei componenti)
|
|
-- cancello le parti ausiliarie se disegnate
|
|
if Dm then
|
|
EgtErase(Dm)
|
|
end
|
|
|
|
if nDrawMach > 0 then -- se abilitata geometria lavorazione
|
|
|
|
-- faccio la copia e il mirror delle lavorazioni per gestire il caso che la geometria finisca sottosquadra
|
|
if hintAs1 then
|
|
hintAsR1 = EgtCopyGlob ( hintAs1, Lg)
|
|
if hintAsR1 then
|
|
EgtMirror( hintAsR1, ORIG(), X_AX()) -- faccio il mirror su asse Y
|
|
EgtSetName( hintAsR1, LA..'_R')
|
|
end
|
|
end
|
|
if hintAs2 then
|
|
hintAsR2 = EgtCopyGlob ( hintAs2, Lg)
|
|
if hintAsR2 then
|
|
EgtMirror( hintAsR2, ORIG(), X_AX()) -- faccio il mirror su asse Y
|
|
EgtSetName( hintAsR2, LA..'_R')
|
|
end
|
|
end
|
|
if hintPk then
|
|
hintPkR = EgtCopyGlob ( hintPk, Lg)
|
|
if hintPkR then
|
|
EgtMirror( hintPkR, ORIG(), X_AX()) -- faccio il mirror su asse Y
|
|
EgtSetName( hintPkR, LM..'_R')
|
|
end
|
|
end
|
|
end
|
|
|
|
if bRunByCompo then
|
|
-- scrivo i parametri nelle info del pezzo
|
|
WriteCompoDataToPart( Pz, sCompoName, nCompoNpar)
|
|
end
|
|
|
|
-- scrivo note nel layer della serratura
|
|
EgtSetInfo( Lg, 'Type' ,'EdgePullFlat')
|
|
EgtSetInfo( Lg, 'Nome' ,sCompoName)
|
|
EgtSetInfo( Lg, 'L' ,L)
|
|
EgtSetInfo( Lg, 'H' ,H)
|
|
EgtSetInfo( Lg, 'R' ,R)
|
|
EgtSetInfo( Lg, 'clc' ,clc)
|
|
EgtSetInfo( Lg, 'ccr' ,ccr)
|
|
EgtSetInfo( Lg, 'T' ,T)
|
|
EgtSetInfo( Lg, 'd' ,d)
|
|
EgtSetInfo( Lg, 'p' ,p)
|
|
EgtSetInfo( Lg, 's' ,s)
|
|
EgtSetInfo( Lg, 'd2' ,d2)
|
|
EgtSetInfo( Lg, 'posh' ,posh)
|
|
EgtSetInfo( Lg, 'posp' ,posp)
|
|
EgtSetInfo( Lg, 'ech' ,ech)
|
|
EgtSetInfo( Lg, 'est' ,est)
|
|
EgtSetInfo( Lg, 'bEqualTh' ,bEqualTh)
|
|
EgtSetInfo( Lg, 'nStartY' ,nStartY)
|
|
EgtSetInfo( Lg, 'kbs' ,kbs)
|
|
EgtSetInfo( Lg, 'pbs' ,pbs)
|
|
EgtSetInfo( Lg, 'stk' ,stk)
|
|
EgtSetInfo( Lg, 'fht' ,fht)
|
|
EgtSetInfo( Lg, 'fhb' ,fhb)
|
|
EgtSetInfo( Lg, 'drf' ,drf)
|
|
EgtSetInfo( Lg, 'dws' ,dws)
|
|
EgtSetInfo( Lg, 'dthd' ,dthd)
|
|
EgtSetInfo( Lg, 'D_XE' ,D_XE)
|
|
EgtSetInfo( Lg, 'LG' ,LG)
|
|
EgtSetInfo( Lg, 'LM' ,LM)
|
|
EgtSetInfo( Lg, 'LA' ,LA)
|
|
EgtSetInfo( Lg, 'CLC' ,CLC)
|
|
EgtSetInfo( Lg, 'LH' ,LH)
|
|
EgtSetInfo( Lg, 'CH' ,CH)
|
|
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 LockEdgePull
|