cc55202ec5
- primo commit con versione corrente.
1116 lines
43 KiB
Lua
1116 lines
43 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
|
|
--
|
|
-- OverHeadPocket.lua by EgalWare s.r.l. 2016.06.30
|
|
-- Autore: Filippo Monchi
|
|
-- Over Head Arm dati i valori 'L' e 'H' e 'T' e 'd' e 'p' e 'DS' e con nomi attributi
|
|
|
|
-- 2016.09.21 V1.0a1 FM Add warning messages
|
|
-- 2018.04.05 V1.0a2 FM Manage info (KeepBackSet) for adjust probe on Z
|
|
-- 2018.10.17 V1.0a3 FM Add parameter to show into message 402
|
|
-- 2018.12.10 V1.0a4 FM Add notes InserPoint and DeltaPos on any geometries
|
|
-- 2019.10.18 V2.000 FM Manage use Materials
|
|
-- 2020.04.29 V2.001 FM Update for aluminum material
|
|
-- 2020.05.07 V2.002 FM Add Extra bores and manage geometries for Frames
|
|
-- 2020.05.25 V2.003 FM Manage geometries for calculate region when frame(jamb) is disposed on wide side
|
|
-- 2020.07.01 V2.004 FM Disable Warning message on frames if parameter DGD.Spd is <= 0
|
|
-- 2020.12.18 V2.005 FM Fix error on compare variables for errors that has their geometry disabled
|
|
-- 2021.01.22 V3.000 FM Manage better checking error on tools and dimension when produce flag is false
|
|
-- 2021.03.09 V3.001 FM Add missing function DrawAddCircleDrawCircle
|
|
-- 2021.03.12 V3.002 FM Manage rotation parameters on extra bores/buttonhole
|
|
-- 2021.11.24 V3.003 FM Manage side probe option if variable DGC.Pms > 2
|
|
-- 2022.07.27 V3.004 FM Modification to use compiled code
|
|
-- 2024.07.19 V3.005 FM Set note 'NotCheckDir' to pocketing paths
|
|
|
|
-- Tavola per definizione modulo (serve ma non usata)
|
|
local OverHeadPocket = {}
|
|
|
|
-- 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
|
|
|
|
-- tipologia hardware
|
|
local nTypeHdw = 1
|
|
|
|
local function DrawAddLineDrawCircle( pInitial, pFinal, nGroup, idTable, bPrev,
|
|
nGroupCirc, nRad, bDrawFirst, bDrawLast, cColor1, cColor2)
|
|
|
|
local nLine = EgtLine(nGroup, pInitial, pFinal, GDB_RT.LOC)
|
|
|
|
if idTable then
|
|
table.insert( idTable, nLine)
|
|
end
|
|
|
|
if bPrev then
|
|
if bDrawFirst then
|
|
local nCircle1 = EgtCircle( nGroupCirc, pInitial, nRad , GDB_RT.LOC)
|
|
EgtSetColor( nCircle1, cColor1)
|
|
end
|
|
|
|
if bDrawLast then
|
|
local nCircle2 = EgtCircle( nGroupCirc, pFinal, nRad , GDB_RT.LOC)
|
|
EgtSetColor( nCircle2, cColor2)
|
|
end
|
|
end
|
|
|
|
return nLine
|
|
end
|
|
|
|
local function 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, D10,
|
|
dParH, PY10, T10, RP10, AR10,
|
|
RCI10, kbs, bEqualTh, HB10, dws,
|
|
pbs)
|
|
|
|
local pIni, pEnd, pCen
|
|
local hint3, hint5
|
|
local tPath = {}
|
|
local tPathPok = {}
|
|
|
|
if IY10 > 0 and EBH10 ~= '' then -- se parametri asola presenti
|
|
|
|
pIni = Point3d((PX10+Int10+(D10/2)),(dParH+PY10),0)
|
|
pEnd = Point3d((PX10+Int10+(D10/2)),(dParH+PY10-(IY10/2)),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
pEnd = Point3d((PX10+Int10-(D10/2)),(dParH+PY10-(IY10/2)),0)
|
|
pCen = Point3d((PX10+Int10),(dParH+PY10-(IY10/2)),0)
|
|
DrawAddCircleDrawCircle( pCen, (D10/2), 0,-180, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
pEnd = Point3d((PX10+Int10-(D10/2)),(dParH+PY10+(IY10/2)),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
pEnd = Point3d((PX10+Int10+(D10/2)),(dParH+PY10+(IY10/2)),0)
|
|
pCen = Point3d((PX10+Int10),(dParH+PY10+(IY10/2)),0)
|
|
DrawAddCircleDrawCircle( pCen, (D10/2), 180,-180, Lg, tPath, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
pEnd = Point3d((PX10+Int10+(D10/2)),(dParH+PY10),0)
|
|
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 all'interasse
|
|
if RCI10 then
|
|
EgtRotate( hint3, Point3d((PX10),(dParH+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto
|
|
-- rotazione in centro all'asola
|
|
else
|
|
EgtRotate( hint3, Point3d((PX10+Int10),(dParH+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto
|
|
end
|
|
end
|
|
|
|
if nDrawMach > 0 and RP10 and RP10 > 0 and (RP10/2) < T10 then --se parametro step è valido, creao il percorso a zig-zag centrale
|
|
|
|
EgtSetName( hint3,'_'..EBH10) -- aggiungo _ per disabilitare lavorazione
|
|
local nStep = ceil(T10/RP10) -- numero di passate
|
|
local dStep = (T10/nStep) -- passo ricalcolato
|
|
local nPass = 1
|
|
local dZedStart = 0
|
|
local dZedWork
|
|
local nInv = 1
|
|
|
|
pIni = Point3d((PX10+Int10),(dParH+PY10+((IY10/2)*nInv)),dZedStart)
|
|
|
|
while nPass <= nStep do
|
|
|
|
dZedWork = dZedStart - (dStep/2)
|
|
nInv = -nInv
|
|
pEnd = Point3d((PX10+Int10),(dParH+PY10+((IY10/2)*nInv)),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPathPok, bPreview, Dm, 0, false, false, RED(), RED())
|
|
pIni = pEnd
|
|
dZedWork = dZedStart - dStep
|
|
nInv = -nInv
|
|
pEnd = Point3d((PX10+Int10),(dParH+PY10+((IY10/2)*nInv)),dZedWork)
|
|
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+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)
|
|
|
|
-- se rotazione attiva
|
|
if AR10 ~= 0 then
|
|
-- rotazione in centro all'interasse
|
|
if RCI10 then
|
|
EgtRotate( hint5, Point3d((PX10),(dParH+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto
|
|
-- rotazione in centro all'asola
|
|
else
|
|
EgtRotate( hint5, Point3d((PX10+Int10),(dParH+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto
|
|
end
|
|
end
|
|
else
|
|
EgtSetName( hint3, EBH10)
|
|
end
|
|
elseif EB10 ~= '' then
|
|
hint3 = EgtCircle( Lg, Point3d((PX10+Int10),(dParH+PY10),0), D10/2 , GDB_RT.LOC)
|
|
EgtModifyCurveThickness( hint3, -T10)
|
|
EgtSetName( hint3, EB10)
|
|
-- se rotazione in centro all'interasse (sono questo caso perchè non ha senso ruotare un foro in centro a se stesso)
|
|
if AR10 ~= 0 and RCI10 then
|
|
EgtRotate( hint3, Point3d((PX10),(dParH+PY10),0), Z_AX(), AR10, GDB_RT.LOC) -- ruoto
|
|
end
|
|
end
|
|
|
|
-- se mantiene backset
|
|
if kbs and kbs > 0 then
|
|
local sKeepMode = 'c' -- setto di default per mantenere il centro spessore
|
|
EgtSetInfo( hint3, 'KeepBackSet', sKeepMode)
|
|
if hint5 then
|
|
EgtSetInfo( hint5, 'KeepBackSet', sKeepMode)
|
|
end
|
|
end
|
|
if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then
|
|
EgtSetInfo( hint3, 'ProbeSide', '1')
|
|
if hint5 then
|
|
EgtSetInfo( hint5, 'ProbeSide', '1')
|
|
end
|
|
end
|
|
if HB10 then
|
|
EgtSetInfo( hint3, 'SideDoor', 'LockLH')
|
|
if hint5 then
|
|
EgtSetInfo( hint5, 'SideDoor', 'LockLH')
|
|
end
|
|
else
|
|
EgtSetInfo (hint3, 'SideDoor', 'SideLH')
|
|
if hint5 then
|
|
EgtSetInfo( hint5, 'SideDoor', 'SideLH')
|
|
end
|
|
end
|
|
if dws then
|
|
local nIdSideBoxUp = EgtCopyGlob( hint3, Lg)
|
|
EgtSetName( nIdSideBoxUp, 'upper')
|
|
EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper')
|
|
if hint5 then
|
|
nIdSideBoxUp = EgtCopyGlob( hint5, Lg)
|
|
EgtSetName( nIdSideBoxUp, 'upper')
|
|
EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper')
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Funzione di sistemazione parametri
|
|
function OverHeadPocket.AdjustParams( tMhPar)
|
|
|
|
local EgtDoorsMsg = require( 'EgtDoorsMsg')
|
|
local dMaxMat1
|
|
local dMaxMat2 -- per foro o foro profondo
|
|
local dNumMessage
|
|
local dNumLog = 0
|
|
local sMessToOut = ''
|
|
local nTempT1
|
|
local nTempT3
|
|
local sMchngName1
|
|
local sMchngName3
|
|
|
|
-- 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
|
|
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
|
|
|
|
-- Assegno parametri da dati utensili in macchina
|
|
local MB = require( 'MachiningBase')
|
|
local sLM
|
|
local nLMi
|
|
local sLGH -- bore machining
|
|
local nLGHi
|
|
|
|
-- se porta steel o aluminum disabilito tutto tranne il foro
|
|
if FindMaterial( DGD.Material, 'steel') or FindMaterial( DGD.Material, 'aluminum') then
|
|
-- tMhPar.LG = nil -- lascio la geometria di contorno
|
|
tMhPar.LM = nil
|
|
tMhPar.LA = nil
|
|
tMhPar.ech = false
|
|
tMhPar.CH = nil
|
|
tMhPar.est = true
|
|
tMhPar.d2 = nil
|
|
else
|
|
tMhPar.est = nil
|
|
end
|
|
|
|
tMhPar.sopp = ( DGD.Lock == 'L' and DGD.Push) or ( DGD.Lock == 'R' and not DGD.Push)
|
|
tMhPar.fopp = 1
|
|
|
|
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
|
|
|
|
-- foro o foro profondo
|
|
if tMhPar.mh and tMhPar.LGH then
|
|
sLGH = tMhPar.LGH
|
|
nLGHi = 1
|
|
if DGD.MachEn > 0 then nTempT3, dMaxMat2, sMchngName3 = MB.GetToolDataFromAttrib( sLGH, nLGHi) 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.d and nTempT1 and nTempT1 <= 0 then
|
|
dNumLog = -2292
|
|
sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT1, sLM, nLMi, tMhPar.d, dNumLog, sMchngName1)
|
|
elseif nTempT1 then
|
|
tMhPar.d = nTempT1
|
|
end
|
|
|
|
-- se non ho parametro di lunghezza massima utensile preparo messaggio di warning per foro profondo
|
|
if DGD.bProoduce and tMhPar.mh and tMhPar.LGH and not dMaxMat2 then
|
|
dNumLog = -2298
|
|
sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT3, sLGH, nLGHi, nil, dNumLog, sMchngName3)
|
|
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 = -2299
|
|
dNumMessage = 461
|
|
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T), EgtToUiUnits(dMaxMat1))
|
|
tMhPar.T = dMaxMat1
|
|
end
|
|
|
|
-- se foro e la sua profondità è maggiore della capacità utensile,
|
|
-- limito la profondità ed emetto un warning
|
|
if tMhPar.mh and dMaxMat2 and tMhPar.TB2 and tMhPar.TB2 > dMaxMat2 then
|
|
dNumLog = -2297
|
|
dNumMessage = 463
|
|
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.TB2), EgtToUiUnits(dMaxMat2))
|
|
tMhPar.TB2 = dMaxMat2
|
|
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 = -2296
|
|
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.TB2 and abs(tMhPar.TB2) > tMhPar.TTP then
|
|
dNumLog = -2296
|
|
dNumMessage = 681
|
|
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, sPieceName, 'TB2', EgtToUiUnits(tMhPar.TB2), EgtToUiUnits(tMhPar.TTP), EgtToUiUnits(tMhPar.dThD))
|
|
tMhPar.TB2 = tMhPar.TTP
|
|
end
|
|
end
|
|
|
|
if dNumLog ~= 0 then
|
|
return tMhPar, dNumLog, sMessToOut
|
|
end
|
|
|
|
return tMhPar, 0, ''
|
|
end
|
|
|
|
-- Funzione di disegno
|
|
function OverHeadPocket.Draw( tOHPkt, bPreview, bRunByCompo, nDrawMach)
|
|
|
|
-- Assegno le dimensioni
|
|
local L = tOHPkt.L
|
|
local H = tOHPkt.H
|
|
local T = tOHPkt.T
|
|
local d = tOHPkt.d
|
|
local p = tOHPkt.p
|
|
local s = tOHPkt.s
|
|
local DS = tOHPkt.DS
|
|
local est = tOHPkt.est
|
|
local kbs = tOHPkt.kbs -- keep backset/thickness (0: none, 1: only face, 2: all)
|
|
local pbs = tOHPkt.pbs
|
|
local mh = tOHPkt.mh
|
|
local HB2 = tOHPkt.HB2
|
|
local TB2 = tOHPkt.TB2
|
|
local sopp = tOHPkt.sopp
|
|
local fopp = tOHPkt.fopp
|
|
local dws = tOHPkt.Dws
|
|
local dthd = tOHPkt.dThD
|
|
local ttp = tOHPkt.TTP
|
|
local tExtraBore = {}
|
|
table.insert( tExtraBore, { tOHPkt.D3, tOHPkt.T3, tOHPkt.I3, tOHPkt.PX3, tOHPkt.PY3, tOHPkt.EB3, tOHPkt.HB3})
|
|
table.insert( tExtraBore, { tOHPkt.D4, tOHPkt.IY4, tOHPkt.T4, tOHPkt.I4, tOHPkt.PX4, tOHPkt.PY4, tOHPkt.RP4, tOHPkt.EB4, tOHPkt.EBH4, tOHPkt.HB4, tOHPkt.AR4, tOHPkt.RCI4})
|
|
table.insert( tExtraBore, { tOHPkt.D5, tOHPkt.IY5, tOHPkt.T5, tOHPkt.I5, tOHPkt.PX5, tOHPkt.PY5, tOHPkt.RP5, tOHPkt.EB5, tOHPkt.EBH5, tOHPkt.HB5, tOHPkt.AR5, tOHPkt.RCI5})
|
|
table.insert( tExtraBore, { tOHPkt.D6, tOHPkt.IY6, tOHPkt.T6, tOHPkt.I6, tOHPkt.PX6, tOHPkt.PY6, tOHPkt.RP6, tOHPkt.EB6, tOHPkt.EBH6, tOHPkt.HB6, tOHPkt.AR6, tOHPkt.RCI6})
|
|
-- Assegno i nomi geometrie
|
|
local LG = tOHPkt.LG
|
|
local LM = tOHPkt.LM
|
|
local LGH = tOHPkt.LGH -- nome geometria horizontal bore
|
|
local DM = 'DUMMY'
|
|
-- variabili per messaggi e settaggi vari
|
|
local sCompoName = tOHPkt.Nome
|
|
local nCompoNpar = tOHPkt.Npar
|
|
local sCompoPath = tOHPkt.Path
|
|
-- eventuale messaggio errore rilevato nell'adjust
|
|
local nCodAdj = tOHPkt.nCod
|
|
local sCodAdj = tOHPkt.sCod
|
|
-- nomi parametri per messaggi
|
|
local sNamePar1 = tOHPkt.N1 or 'L'
|
|
local sNamePar2 = tOHPkt.N2 or 'H'
|
|
local sNamePar3 = tOHPkt.N3 or 'T'
|
|
local sNamePar4 = tOHPkt.N4 or 'd'
|
|
local sNamePar5 = tOHPkt.N5 or 'p'
|
|
local sNamePar6 = tOHPkt.N6 or 's'
|
|
local sNamePar7 = tOHPkt.N7 or 'DS'
|
|
-- RunByComponetInterface
|
|
local RC = true
|
|
-- Messaggi codice errori
|
|
local EM = ' '
|
|
local EC = 0
|
|
local ErrorBase = 2250
|
|
-- Variabili per risalita distaccata
|
|
local nDeltaMovX = 2
|
|
local nDeltaMovY = 2
|
|
-- variabili che abilitano la creazione della geometria
|
|
local bMakeMortGeom = true
|
|
local bMakeBoreGeom = true
|
|
|
|
if not bRunByCompo then -- controllo se lanciato da componente
|
|
RC = false
|
|
end
|
|
|
|
-- if est or not L or not H then -- permetto con materiale steel e aluminum
|
|
if not L or not H then
|
|
bMakeMortGeom = false
|
|
end
|
|
|
|
if not DS then
|
|
DS = 0
|
|
end
|
|
|
|
if ( not HB2 or not TB2) or not mh then
|
|
bMakeBoreGeom = false
|
|
end
|
|
|
|
-- 0 solo geom esterna, 1 solo geom mach, 2 entrambe
|
|
if not nDrawMach then -- se non definita la setto per non creare geometria di lavorazione
|
|
nDrawMach = 0
|
|
end
|
|
|
|
local EgtDoorsMsg = require( 'EgtDoorsMsg')
|
|
|
|
-- Verifica delle dimensioni, le condizioni vengono verificate in base a quale geometria deve essere creata
|
|
if nDrawMach > 0 and bMakeMortGeom and d and d < DgMin then
|
|
EC = 1
|
|
EM = string.format(EgtDoorsMsg[400],sNamePar4,EgtToUiUnits(d),EgtToUiUnits(DgMin)) -- il diametro utensile deve essere >= di
|
|
d = DgMin
|
|
elseif bMakeMortGeom and H <= 0 then
|
|
EC = 2
|
|
EM = string.format(EgtDoorsMsg[401],sNamePar2,EgtToUiUnits(H), sCompoPath) -- il parametro 'H' deve essere > 0
|
|
H = d/2
|
|
elseif nDrawMach > 0 and bMakeMortGeom and L <= d then
|
|
if DGD.bProoduce then
|
|
EC = 3
|
|
EM = string.format(EgtDoorsMsg[402],sNamePar1,EgtToUiUnits(L),sNamePar4,EgtToUiUnits(d), sCompoPath) -- il parametro 'L' deve essere maggiore al diametro utensile d
|
|
L = d + 0.002
|
|
else
|
|
d = L - 0.002
|
|
end
|
|
elseif nDrawMach > 0 and bMakeMortGeom and ( p < PtMin or p > PtMax) then
|
|
EC = 4
|
|
EM = string.format(EgtDoorsMsg[403],sNamePar5,p,PtMin,PtMax, sCompoPath) -- il parametro 'p' deve essere compreso tra
|
|
p = 0.8
|
|
elseif bMakeMortGeom and T < 0 then
|
|
EC = 5
|
|
EM = string.format(EgtDoorsMsg[404],sNamePar3,EgtToUiUnits(T), sCompoPath) -- il parametro 'T' deve essere >= 0
|
|
T = 0
|
|
elseif bMakeMortGeom and L <= 0 then
|
|
EC = 6
|
|
EM = string.format(EgtDoorsMsg[401],sNamePar1,EgtToUiUnits(L), sCompoPath) -- il parametro 'L' deve essere > 0
|
|
L = d
|
|
elseif nDrawMach > 0 and bMakeMortGeom and s <= 0 then
|
|
EM = string.format(EgtDoorsMsg[401],sNamePar6,EgtToUiUnits(s), sCompoPath) -- il parametro 's' deve essere > 0
|
|
EC = 7
|
|
s = d
|
|
elseif bMakeMortGeom and DS < 0 then
|
|
EC = 10
|
|
EM = string.format(EgtDoorsMsg[404],sNamePar7,EgtToUiUnits(DS), sCompoPath) -- il parametro 'DS' deve essere > 0
|
|
DS = 0
|
|
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, Dor
|
|
|
|
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)
|
|
Dor = EgtGroup( Pz, GDB_RT.LOC) -- layer disegni cerchi rappresentante l'origine
|
|
EgtSetName( Dor, DM)
|
|
end
|
|
|
|
local hint1, hint2, hint3, hint4, hint5, hint6, hint, hintPk, hintH
|
|
|
|
-- disegno cerchio origine
|
|
if Dor then
|
|
local dDiamCircle
|
|
if d then
|
|
dDiamCircle = d
|
|
else
|
|
dDiamCircle = 10
|
|
end
|
|
local nCircleOri = EgtCircle( Dor, Point3d(0,0,0), dDiamCircle/4 , GDB_RT.LOC)
|
|
EgtSetColor( nCircleOri, NAVY())
|
|
end
|
|
|
|
if nDrawMach ~= 1 and LG and bMakeMortGeom then -- se abilitata geometria esterna
|
|
|
|
hint1 = DrawAddLineDrawCircle( Point3d(0,H/2,0), Point3d(L/2,H/2,0), Lg, nil, bPreview, Dm, 0, false, false, RED(), RED())
|
|
hint2 = DrawAddLineDrawCircle( Point3d(L/2,H/2,0), Point3d(L/2,-(H/2),0), Lg, nil, bPreview, Dm, 0, false, false, RED(), RED())
|
|
hint3 = DrawAddLineDrawCircle( Point3d(L/2,-(H/2),0), Point3d(-L/2,-(H/2),0), Lg, nil, bPreview, Dm, 0, false, false, RED(), RED())
|
|
hint4 = DrawAddLineDrawCircle( Point3d(-L/2,-(H/2),0), Point3d(-L/2,H/2,0), Lg, nil, bPreview, Dm, 0, false, false, RED(), RED())
|
|
hint5 = DrawAddLineDrawCircle( Point3d(-L/2,H/2,0), Point3d(0,H/2,0), Lg, nil, bPreview, Dm, 0, false, false, RED(), RED())
|
|
hint = EgtCurveCompo( Lg, {hint1,hint2,hint3,hint4,hint5}, true)
|
|
EgtModifyCurveThickness(hint, -T)
|
|
EgtSetName(hint,LG)
|
|
-- muovo la geometria verso sinistra del valore di L/2 + DS
|
|
EgtMove( hint, Point3d(-((L/2)+DS),0,0) - ORIG())
|
|
EgtSetInfo( hint,'InserPoint' ,'Center') -- setto una nota per indicare su che lato della porta deve essere spostato
|
|
EgtSetInfo( hint,'DeltaPos' ,( L+(2*DS)))
|
|
-- se mantiene centro spessore anche su face
|
|
if kbs and kbs > 0 then
|
|
EgtSetInfo( hint, 'KeepBackSet', 'c') -- setto 'c' perchè viene mantenuto il centro spessore
|
|
end
|
|
if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then
|
|
EgtSetInfo( hint, 'ProbeSide', '1')
|
|
end
|
|
end
|
|
|
|
if bMakeBoreGeom then -- se foro orizzontale abilitato
|
|
-- se parametri secondo foro
|
|
if HB2 and TB2 and abs(HB2) > 0 and abs(TB2) > 0 then
|
|
hintH = EgtCircle( Lg, Point3d(0,0,0), abs(HB2/2) , GDB_RT.LOC)
|
|
EgtModifyCurveThickness(hintH, -abs(TB2))
|
|
EgtSetName(hintH,LGH)
|
|
EgtSetInfo( hintH,'InserPoint' ,'Center') -- setto una nota per indicare su che lato della porta deve essere spostato
|
|
-- muovo la geometria verso sinistra del valore di L/2 (o HB2/2) + DS
|
|
if L and L > 0 then
|
|
EgtMove( hintH, Point3d(-((L/2)+DS),0,0) - ORIG())
|
|
EgtSetInfo( hintH, 'DeltaPos',( L+(2*DS)))
|
|
else
|
|
EgtMove( hintH, Point3d(-((HB2/2)+DS),0,0) - ORIG())
|
|
EgtSetInfo( hintH, 'DeltaPos',( HB2+(2*DS)))
|
|
end
|
|
|
|
if kbs and kbs > 0 then
|
|
EgtSetInfo( hintH, 'KeepBackSet', 'c') -- setto 'c' perchè viene mantenuto il centro spessore
|
|
end
|
|
if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then
|
|
EgtSetInfo( hintH, 'ProbeSide', '1')
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Costruzione della geometria di lavorazione
|
|
if nDrawMach > 0 and LM and bMakeMortGeom then -- se abilitata geometria lavorazione
|
|
|
|
if not Lg then
|
|
Lg = EgtGroup(Pz,GDB_RT.LOC)
|
|
EgtSetName(Lg,sCompoName)
|
|
end
|
|
|
|
---------------------------------------
|
|
-- geometria svuotatura giro interno
|
|
---------------------------------------
|
|
local tPocket = {}
|
|
local pIni
|
|
local pEnd
|
|
local pEnd2
|
|
local nStep
|
|
local dStep
|
|
local dPerim
|
|
local nDirVers
|
|
local nPass
|
|
local dZedStart = 0
|
|
local dZedWork = -T
|
|
|
|
-- individuo in che caso sono
|
|
local nCase
|
|
if abs(H-d) < 0.03 then -- solo 1 passaggio in centro
|
|
nCase = 1
|
|
elseif (H-d) <= ( d*0.98) then -- solo passaggio di contornatura
|
|
nCase = 2
|
|
elseif ((H-d) > ( d*0.98)) and ( (H-d) <= (d*(1+p))) then -- passaggio di contornatura + un passaggio centrale
|
|
nCase = 3
|
|
elseif (H-d) > (d*(1+p)) then -- passaggio di contornatura + passaggi zig zag
|
|
nCase = 4
|
|
end
|
|
|
|
dPerim = 2*( H + L -(2*d))
|
|
nStep = ceil(T/s) -- numero di passate
|
|
dStep = (T/nStep) -- passo ricalcolato
|
|
|
|
if nCase == 1 then -- solo 1 passaggio in centro
|
|
|
|
nPass = 1
|
|
nDirVers = 1
|
|
dZedStart = 0
|
|
pEnd = Point3d((-nDirVers*((L-d)/2)),0,dZedStart) -- nuovo punto finale
|
|
hint3 = EgtCircle( Dm, pEnd, (d/2) , GDB_RT.LOC)
|
|
EgtSetColor(hint3,PURPLE())
|
|
|
|
local nDoubleStep = nStep * 2
|
|
|
|
while nPass <= nDoubleStep do
|
|
|
|
-- primo mezzo passo
|
|
nDirVers = - nDirVers
|
|
pIni = pEnd
|
|
dZedWork = dZedStart - ((dStep * nPass)/2)
|
|
if nPass == nDoubleStep then
|
|
dZedWork = -T
|
|
end
|
|
pEnd = Point3d((-nDirVers*((L-d)/2)),0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE())
|
|
|
|
nPass = nPass + 1
|
|
end
|
|
|
|
-- ultimo mezzo passo
|
|
nDirVers = - nDirVers
|
|
pIni = pEnd
|
|
dZedWork = -T
|
|
pEnd = Point3d((-nDirVers*((L-d)/2)),0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE())
|
|
|
|
-- Uscita in Z0
|
|
pIni = pEnd
|
|
dZedWork = 0
|
|
|
|
if ( nDeltaMovX > (L-d)) then
|
|
nDeltaMovX = (L-d)
|
|
end
|
|
pEnd = Point3d((-nDirVers*((L-d)/2)-nDeltaMovX),0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, GREEN(), GREEN())
|
|
|
|
-- solo contornatura or contornatura + un passaggio centrale or contornatura + passaggi svuotatura
|
|
elseif ( nCase == 2) or ( nCase == 3) or ( nCase == 4) then
|
|
|
|
nPass = 1
|
|
nDirVers = 1
|
|
dZedStart = 0
|
|
pEnd = Point3d(((L-d)/2),((H-d)/2),dZedStart) -- nuovo punto finale
|
|
hint3 = EgtCircle( Dm, pEnd, (d/2) , GDB_RT.LOC)
|
|
EgtSetColor(hint3,PURPLE())
|
|
|
|
while nPass <= nStep do
|
|
|
|
if nCase > 2 then -- se ho la svuotatura centrale scendo direttamente al passo
|
|
|
|
-- prima linea discendente
|
|
pIni = pEnd
|
|
dZedWork = dZedStart - dStep
|
|
if nPass == nStep then
|
|
dZedWork = -T
|
|
end
|
|
pEnd = Point3d(((L-d)/2),((H-d)/2),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE())
|
|
end
|
|
|
|
-- prima linea contorno
|
|
pIni = pEnd
|
|
if nCase == 2 then
|
|
dZedWork = dZedStart - ( dStep*((H-d)/dPerim))
|
|
end
|
|
pEnd = Point3d(((L-d)/2),-((H-d)/2),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE())
|
|
|
|
-- seconda linea contorno
|
|
pIni = pEnd
|
|
if nCase == 2 then
|
|
dZedWork = dZedStart - ( dStep*((H+L-(2*d))/dPerim))
|
|
end
|
|
pEnd = Point3d(-((L-d)/2),-((H-d)/2),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE())
|
|
|
|
-- terza linea contorno
|
|
pIni = pEnd
|
|
if nCase == 2 then
|
|
dZedWork = dZedStart - ( dStep*(((2*H)+L-(3*d))/dPerim))
|
|
end
|
|
pEnd = Point3d(-((L-d)/2),((H-d)/2),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE())
|
|
|
|
-- quarta linea contorno
|
|
pIni = pEnd
|
|
if nCase == 2 then
|
|
dZedWork = dZedStart - dStep
|
|
if nPass == nStep then
|
|
dZedWork = -T
|
|
end
|
|
end
|
|
pEnd = Point3d(((L-d)/2),((H-d)/2),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE())
|
|
|
|
-- Se passaggio di contornatura e sono all'ultimo passo, faccio ancora un giro di contorno
|
|
if nCase == 2 and nPass == nStep then -- passaggio di contornatura
|
|
|
|
-- prima linea contorno
|
|
pIni = pEnd
|
|
pEnd = Point3d(((L-d)/2),-((H-d)/2),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE())
|
|
|
|
-- seconda linea contorno
|
|
pIni = pEnd
|
|
pEnd = Point3d(-((L-d)/2),-((H-d)/2),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE())
|
|
|
|
-- terza linea contorno
|
|
pIni = pEnd
|
|
pEnd = Point3d(-((L-d)/2),((H-d)/2),dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE())
|
|
|
|
-- quarta linea contorno
|
|
pIni = pEnd
|
|
pEnd = Point3d(((L-d)/2),((H-d)/2),dZedWork)
|
|
|
|
if ( nDeltaMovX > ((L-d)/2)) then -- se delta più grande di metà cava in X
|
|
nDeltaMovX = (L-d)/2
|
|
end
|
|
if ( nDeltaMovY > ((H-d)/2)) then -- se delta più grande di metà cava in Y
|
|
nDeltaMovY = (H-d)/2
|
|
end
|
|
|
|
pEnd2 = Point3d((((L-d)/2)-nDeltaMovX),(((H-d)/2)-nDeltaMovY),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE())
|
|
end
|
|
|
|
if nCase == 3 then -- passaggio di contornatura + un passaggio centrale
|
|
|
|
-- quinta linea posizionamento passata centrale
|
|
pIni = pEnd
|
|
pEnd = Point3d((((L*2)-(d*3))/4),0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, LIME(), LIME())
|
|
|
|
-- sesta linea passata centrale
|
|
pIni = pEnd
|
|
pEnd = Point3d(-(((L*2)-(d*3))/4),0,dZedWork)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, LIME(), LIME())
|
|
|
|
-- settima linea ritorno a posizione iniziale
|
|
pIni = pEnd
|
|
pEnd = Point3d(((L-d)/2),((H-d)/2),dZedWork)
|
|
|
|
if ( nDeltaMovX > ((L-d)/2)) then -- se delta più grande di metà cava in X
|
|
nDeltaMovX = (L-d)/2
|
|
end
|
|
if ( nDeltaMovY > ((H-d)/2)) then -- se delta più grande di metà cava in Y
|
|
nDeltaMovY = (H-d)/2
|
|
end
|
|
|
|
pEnd2 = Point3d((((L-d)/2)-nDeltaMovX),(((H-d)/2)-nDeltaMovY),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE())
|
|
|
|
elseif nCase == 4 then -- passaggio di contornatura + passaggi svuotatura
|
|
|
|
nDirVers = -1
|
|
local nDistYcentr = (d*p)
|
|
local nPosYcentr = ((H-d)/2) - nDistYcentr
|
|
local bContinue = nPosYcentr > -((H-d)/2)
|
|
|
|
-- linea posizionamento passaggi svuotatura
|
|
pIni = pEnd
|
|
pEnd = Point3d((-nDirVers * (((L*2)-(d*3))/4)),nPosYcentr,dZedWork)
|
|
|
|
-- ciclo passate svuotatura
|
|
while bContinue do
|
|
|
|
-- linea affondamento in Y
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, YELLOW(), YELLOW())
|
|
|
|
-- linea passata in X
|
|
pIni = pEnd
|
|
pEnd = Point3d((nDirVers * (((L*2)-(d*3))/4)),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
|
|
bContinue = nPosYcentr > -((H-d)/2)
|
|
|
|
-- calcolo prossimo punto solo se sono ancora dentro l'area
|
|
if bContinue then
|
|
nDirVers = -nDirVers
|
|
-- ricalcolo punti per linea successiva
|
|
pIni = pEnd
|
|
pEnd = Point3d((-nDirVers * (((L*2)-(d*3))/4)),nPosYcentr,dZedWork)
|
|
end
|
|
end
|
|
|
|
-- ultima linea ritorno a posizione iniziale
|
|
pIni = pEnd
|
|
pEnd = Point3d(((L-d)/2),((H-d)/2),dZedWork)
|
|
|
|
if ( nDeltaMovX > ((L-d)/2)) then -- se delta più grande di metà cava in X
|
|
nDeltaMovX = (L-d)/2
|
|
end
|
|
if ( nDeltaMovY > ((H-d)/2)) then -- se delta più grande di metà cava in Y
|
|
nDeltaMovY = (H-d)/2
|
|
end
|
|
|
|
pEnd2 = Point3d((((L-d)/2)-nDeltaMovX),(((H-d)/2)-nDeltaMovY),0)
|
|
DrawAddLineDrawCircle( pIni, pEnd, Lg, tPocket, bPreview, Dm, (d/2), false, true, PURPLE(), PURPLE())
|
|
end
|
|
|
|
nPass = nPass + 1
|
|
dZedStart = dZedStart - dStep
|
|
end
|
|
|
|
-- Uscita in Z0
|
|
pIni = pEnd
|
|
DrawAddLineDrawCircle( pIni, pEnd2, Lg, tPocket, bPreview, Dm, (d/2), false, true, GREEN(), GREEN())
|
|
end
|
|
|
|
-- trasformo in geometria composita il percorso di svuotatura
|
|
if ( #tPocket > 0) then
|
|
hintPk = EgtCurveCompo( Lg, tPocket, true)
|
|
if hintPk then
|
|
EgtModifyCurveThickness( hintPk, 0)
|
|
EgtSetName( hintPk, LM)
|
|
EgtSetInfo( hintPk, 'NotCheckDir', '1')
|
|
-- muovo la geometria verso sinistra del valore di L/2 + DS
|
|
EgtMove( hintPk, Point3d(-((L/2)+DS),0,0) - ORIG())
|
|
-- muovo la geometria verso sinistra del valore di L/2 + DS
|
|
EgtMove( Dm, Point3d(-((L/2)+DS),0,0) - ORIG())
|
|
EgtSetInfo( hintPk,'InserPoint', 'Center') -- setto una nota per indicare su che lato della porta deve essere spostato
|
|
EgtSetInfo( Dm,'InserPoint', 'Center') -- setto una nota per indicare su che lato della porta deve essere spostato
|
|
EgtSetInfo( hintPk,'DeltaPos', ( L+(2*DS)))
|
|
EgtSetInfo( Dm,'DeltaPos', ( L+(2*DS)))
|
|
-- se mantiene centro spessore anche su face
|
|
if kbs and kbs > 0 then
|
|
EgtSetInfo( hintPk, 'KeepBackSet', 'c') -- setto 'c' perchè viene mantenuto il centro spessore
|
|
end
|
|
if pbs and pbs > 0 and DGC.Pms and DGC.Pms > 2 then
|
|
EgtSetInfo( hintPk, 'ProbeSide', '1')
|
|
end
|
|
else
|
|
EC = ErrorBase + 11
|
|
EM = string.format(EgtDoorsMsg[427], sCompoPath)
|
|
end
|
|
end
|
|
end
|
|
|
|
if EC == 0 and nDrawMach >= 0 then
|
|
|
|
if not ( LG and bMakeMortGeom) then
|
|
L = 0
|
|
end
|
|
|
|
-- fori ( viti o passaggio filo elettrico)
|
|
for k = 1, 4 do
|
|
|
|
local D10
|
|
local IY10
|
|
local T10
|
|
local I10
|
|
local PX10
|
|
local PY10
|
|
local RP10
|
|
local EB10
|
|
local EBH10
|
|
local HB10
|
|
local AR10
|
|
local RCI10
|
|
|
|
if k == 1 then
|
|
D10 = tExtraBore[k][1]
|
|
T10 = tExtraBore[k][2]
|
|
I10 = tExtraBore[k][3]
|
|
PX10 = tExtraBore[k][4]
|
|
PY10 = tExtraBore[k][5]
|
|
EB10 = tExtraBore[k][6]
|
|
HB10 = tExtraBore[k][7]
|
|
else
|
|
D10 = tExtraBore[k][1]
|
|
IY10 = tExtraBore[k][2]
|
|
T10 = tExtraBore[k][3]
|
|
I10 = tExtraBore[k][4]
|
|
PX10 = tExtraBore[k][5]
|
|
PY10 = tExtraBore[k][6]
|
|
RP10 = tExtraBore[k][7]
|
|
EB10 = tExtraBore[k][8]
|
|
EBH10 = tExtraBore[k][9]
|
|
HB10 = tExtraBore[k][10]
|
|
AR10 = tExtraBore[k][11]
|
|
RCI10 = tExtraBore[k][12]
|
|
end
|
|
|
|
if dws and T10 and abs(T10) > ttp then
|
|
T10 = ttp
|
|
end
|
|
|
|
if D10 and T10 and ( EB10 or EBH10) then
|
|
if D10 > 0 and T10 ~= 0 and ( EB10 ~= '' or EBH10 ~= '') then
|
|
|
|
if not IY10 then IY10 = 0 end
|
|
if not I10 then I10 = 0 end
|
|
if not PX10 then PX10 = 0 end
|
|
if not PY10 then PY10 = 0 end
|
|
if not AR10 then AR10 = 0 end
|
|
|
|
local dInt10 = (I10/2)
|
|
local dPosX10 = ( PX10 * EgtIf( sopp, 1, -1)) - ( (L/2) + DS)
|
|
-- local dPosX10 = ( PX10 * EgtIf( sopp, 1, -1)) - L+(2*DS)
|
|
-- local dPosX10 = ( PX10 * EgtIf( sopp, 1, -1))
|
|
local dPosY10 = -PY10
|
|
-- if bEqualTh or not ls then
|
|
-- dPosY10 = ( dPosY10 - (dThickDoor/2))
|
|
-- end
|
|
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, D10, 0, dPosY10, T10, RP10, AR10, RCI10, kbs, bEqualTh, HB10, dws, pbs)
|
|
|
|
-- se l'interasse è valido
|
|
if abs(I10) > GEO.EPS_SMALL then
|
|
-- creo foro o asola con eventuale svuotatura a rampa
|
|
MakeBoreOrButtoHole( Lg, bPreview, Dm, nDrawMach, IY10, EBH10, EB10, dPosX10, -dInt10, D10, 0, dPosY10, T10, RP10, AR10, RCI10, kbs, bEqualTh, HB10, dws, pbs)
|
|
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 hint then
|
|
nIdSideBoxUp = EgtCopyGlob( hint, Lg)
|
|
EgtSetName( nIdSideBoxUp, 'upper')
|
|
EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper')
|
|
end
|
|
if hintH then
|
|
nIdSideBoxUp = EgtCopyGlob( hintH, Lg)
|
|
EgtSetName( nIdSideBoxUp, 'upper')
|
|
EgtSetInfo( nIdSideBoxUp, 'SideDoor', 'upper')
|
|
end
|
|
end
|
|
end
|
|
|
|
-- cambio colore alla geometria
|
|
if bPreview then
|
|
if EC == 0 then
|
|
if hint then
|
|
EgtSetColor(hint,AQUA())
|
|
end
|
|
if hintH then
|
|
EgtSetColor(hintH,AQUA())
|
|
end
|
|
if hintPk then
|
|
EgtSetColor(hintPk,AQUA())
|
|
end
|
|
else
|
|
if hint then
|
|
EgtSetColor(hint,ORANGE())
|
|
end
|
|
if hintH then
|
|
EgtSetColor(hintH,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 Dor then
|
|
EgtErase(Dor)
|
|
end
|
|
|
|
if bRunByCompo then
|
|
-- scrivo i parametri nelle info del pezzo
|
|
WriteCompoDataToPart(Pz,sCompoName,nCompoNpar)
|
|
end
|
|
|
|
-- scrivo note nel layer della cerniera
|
|
EgtSetInfo(Lg,'Type' ,'OverHeadPocket')
|
|
EgtSetInfo(Lg,'Nome' ,sCompoName)
|
|
EgtSetInfo(Lg,'L' ,L)
|
|
EgtSetInfo(Lg,'H' ,H)
|
|
EgtSetInfo(Lg,'T' ,T)
|
|
EgtSetInfo(Lg,'d' ,d)
|
|
EgtSetInfo(Lg,'p' ,p)
|
|
EgtSetInfo(Lg,'DS' ,DS)
|
|
EgtSetInfo(Lg,'est' ,est)
|
|
EgtSetInfo(Lg,'kbs' ,kbs)
|
|
EgtSetInfo(Lg,'pbs' ,pbs)
|
|
EgtSetInfo(Lg,'HB2' ,HB2)
|
|
EgtSetInfo(Lg,'TB2' ,TB2)
|
|
EgtSetInfo(Lg,'sopp' ,sopp)
|
|
EgtSetInfo(Lg,'fopp' ,fopp)
|
|
EgtSetInfo(Lg,'dws' ,dws)
|
|
EgtSetInfo(Lg,'dthd' ,dthd)
|
|
EgtSetInfo(Lg,'ttp' ,ttp)
|
|
EgtSetInfo(Lg,'LG' ,LG)
|
|
EgtSetInfo(Lg,'LM' ,LM)
|
|
EgtSetInfo(Lg,'LGH' ,LGH)
|
|
EgtSetInfo(Lg,'InserPoint' ,'Center') -- setto una nota per indicare su che lato della porta deve essere spostato
|
|
if L then
|
|
EgtSetInfo(Lg,'DeltaPos' ,( L+(2*DS)))
|
|
elseif HB2 then
|
|
EgtSetInfo(Lg,'DeltaPos' ,( HB2+(2*DS)))
|
|
end
|
|
EgtSetInfo(Lg,'Path' ,sCompoPath)
|
|
end
|
|
|
|
if EC == 0 and nCodAdj and nCodAdj < 0 then
|
|
EC = nCodAdj
|
|
EM = sCodAdj
|
|
end
|
|
|
|
return EC, EM, Lg, nTypeHdw
|
|
end
|
|
|
|
return OverHeadPocket
|