cc55202ec5
- primo commit con versione corrente.
813 lines
32 KiB
Lua
813 lines
32 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
|
|
--
|
|
-- OverHead.lua by EgalWare s.r.l. 2016.06.29
|
|
-- 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.11.15 V1.0a4 FM Manage latch strike option
|
|
-- 2018.11.15 V1.0a4 FM Manage Y shift from door side
|
|
-- 2018.11.15 V1.0a4 FM Manage face thru the thickness (only when it strike) and double anti-splint paths
|
|
-- 2018.12.10 V1.0a5 FM Manage geometry for calculate box without Arm volume (when strike)
|
|
-- 2019.10.16 V1.0a6 FM Manage steel option (disable generation of some geometries)
|
|
-- 2019.10.18 V2.000 FM Manage use Materials
|
|
-- 2019.10.30 V2.001 FM Add clean corner geometries
|
|
-- 2020.04.29 V2.002 FM Update for aluminum material
|
|
-- 2021.01.22 V3.000 FM Manage better checking error on tools and dimension when produce flag is false
|
|
-- 2021.11.24 V3.001 FM Manage side probe option if variable DGC.Pms > 2
|
|
-- 2022.07.27 V3.002 FM Modification to use compiled code
|
|
|
|
-- Tavola per definizione modulo (serve ma non usata)
|
|
local OverHead = {}
|
|
|
|
-- 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 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 OverHead.AdjustParams( tMhPar)
|
|
|
|
local EgtDoorsMsg = require( 'EgtDoorsMsg')
|
|
local dMaxMat0
|
|
local dMaxMat1
|
|
local dMaxMat2
|
|
local dMaxMat3
|
|
local dNumMessage
|
|
local dNumLog = 0
|
|
local sMessToOut = ''
|
|
local nTempT0
|
|
local nTempT1
|
|
local nTempT2
|
|
local nTempT3
|
|
local sMchngName0
|
|
local sMchngName1
|
|
local sMchngName2
|
|
local sMchngName3
|
|
|
|
tMhPar.fht = 0 -- setto il face h top a 0
|
|
tMhPar.fhb = 0 -- setto il face h bottom a 0
|
|
|
|
-- se non ho parametro step o è 0 lo assegno uguale allo spessore cava
|
|
if not tMhPar.sf or abs(tMhPar.sf) < GEO.EPS_SMALL then
|
|
tMhPar.sf = tMhPar.T
|
|
end
|
|
|
|
-- se non ho il parametro lo setto disattivato
|
|
if not tMhPar.ech then
|
|
tMhPar.ech = false
|
|
end
|
|
|
|
-- se non c'è la variabile suffisso del chisel
|
|
if not tMhPar.CH then
|
|
tMhPar.CH = '_Chisel'
|
|
end
|
|
|
|
-- se non c'è la variabile che indica al face di sbordare
|
|
if tMhPar.ls == nil then
|
|
tMhPar.ls = true
|
|
end
|
|
|
|
-- se altezza cava maggiore o uguale dello spessore porta la risetto come spessore porta
|
|
-- e disabilito il chisel e il clean corner
|
|
tMhPar.bETh = false
|
|
if ( tMhPar.H - DGD.dT) >= GEO.EPS_SMALL then
|
|
tMhPar.H = DGD.dT
|
|
tMhPar.ech = false -- disattivo il chisel
|
|
tMhPar.rf = 0 -- disattivo il radius face
|
|
tMhPar.bETh = true
|
|
tMhPar.ls = true
|
|
tMhPar.clc = nil
|
|
tMhPar.CLC = nil
|
|
-- do errore se altezza cava maggiore o uguale dello spessore porta
|
|
-- return tMhPar, 2399, string.format(EgtDoorsMsg[432], tMhPar.Nome, tMhPar.H, DGD.dT, tMhPar.Path)
|
|
end
|
|
|
|
if not tMhPar.DY or tMhPar.DY == 0 then -- se non c'è il parametro spostamento o è a 0
|
|
tMhPar.DY = 0
|
|
if not tMhPar.ls and tMhPar.H then -- se non sborda (latch strike) lo setto per stare in centro allo spessore porta
|
|
tMhPar.DY = (DGD.dT - tMhPar.H) / 2
|
|
end
|
|
end
|
|
|
|
-- Assegno parametri da ddf
|
|
if DGD.ARMLENGTH then
|
|
tMhPar.L = DGD.ARMLENGTH
|
|
end
|
|
|
|
if DGD.ARMPOS then
|
|
tMhPar.DS = 0
|
|
end
|
|
|
|
if DGD.POCKLENGTH then
|
|
tMhPar.L2 = DGD.POCKLENGTH
|
|
end
|
|
|
|
if DGD.POCKPOS then
|
|
tMhPar.DS2 = 0
|
|
end
|
|
|
|
if DGD.POCKET_OFFSET then -- se esiste offset in Z ne prendo il valore assoluto
|
|
DGD.POCKET_OFFSET = abs(DGD.POCKET_OFFSET)
|
|
end
|
|
|
|
if DGD.ARMPOS <= GEO.EPS_SMALL and tMhPar.DS <= GEO.EPS_SMALL then
|
|
|
|
if DGD.Lock == 'L' then
|
|
tMhPar.OS = 1
|
|
else
|
|
tMhPar.OS = -1
|
|
end
|
|
|
|
-- inverto il valore perché il bordo a filo si trova dal lato opposto
|
|
if DGD.Push then
|
|
tMhPar.OS = - tMhPar.OS
|
|
end
|
|
else
|
|
tMhPar.OS = 0
|
|
end
|
|
|
|
-- Assegno parametri da dati utensili in macchina
|
|
local MB = require( 'MachiningBase')
|
|
local sLM
|
|
local nLMi = 1
|
|
local sLA
|
|
local nLAi = 1
|
|
local sLMM
|
|
local nLMMi = 1
|
|
local sLG
|
|
local nLGi = 1
|
|
|
|
-- se porta steel o aluminum disabilito l'antischeggia, la svuotatura, il chisel e modifico il nome geometria
|
|
if FindMaterial( DGD.Material, 'steel') or FindMaterial( DGD.Material, 'aluminum') then
|
|
tMhPar.LM = nil
|
|
tMhPar.LA = nil
|
|
tMhPar.ech = false
|
|
tMhPar.CH = nil
|
|
tMhPar.est = true
|
|
tMhPar.d2 = nil
|
|
tMhPar.LGM = nil
|
|
tMhPar.LMM = nil
|
|
else
|
|
tMhPar.est = nil
|
|
end
|
|
|
|
if tMhPar.est and tMhPar.LG then
|
|
sLG = tMhPar.LG
|
|
if DGD.MachEn > 0 and tMhPar.d then nTempT0, dMaxMat0, sMchngName0 = MB.GetToolDataFromAttrib( sLG, nLGi) end
|
|
end
|
|
|
|
if tMhPar.LM then -- geometria arm
|
|
sLM = tMhPar.LM
|
|
if DGD.MachEn > 0 and tMhPar.d then nTempT1, dMaxMat1, sMchngName1 = MB.GetToolDataFromAttrib( sLM, nLMi) end
|
|
end
|
|
if tMhPar.LA then -- geometria antischeggia arm
|
|
sLA = tMhPar.LA
|
|
if DGD.MachEn > 0 and tMhPar.d2 then nTempT2, dMaxMat2, sMchngName2 = MB.GetToolDataFromAttrib( sLA, nLAi) end
|
|
end
|
|
if tMhPar.LMM then -- geometria pocket
|
|
sLMM = tMhPar.LMM
|
|
if DGD.MachEn > 0 and tMhPar.d3 then nTempT3, dMaxMat3, sMchngName3 = MB.GetToolDataFromAttrib( sLMM, nLMMi) end
|
|
end
|
|
if tMhPar.ech and tMhPar.LG then -- se chisel abilitato
|
|
sLG = tMhPar.LG .. tMhPar.CH
|
|
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 and nTempT0 <= 0 then
|
|
dNumLog = -2394
|
|
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 then
|
|
dNumLog = -2396
|
|
sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT1, sLM, nLMi, tMhPar.d, dNumLog, sMchngName1)
|
|
elseif not tMhPar.est and nTempT1 then
|
|
tMhPar.d = nTempT1
|
|
end
|
|
|
|
if DGD.bProoduce and not tMhPar.est and tMhPar.d2 and nTempT2 and nTempT2 <= 0 then
|
|
dNumLog = -2396
|
|
sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT2, sLA, nLAi, tMhPar.d2, dNumLog, sMchngName2)
|
|
elseif not tMhPar.est and nTempT2 then
|
|
tMhPar.d2 = nTempT2
|
|
end
|
|
|
|
if DGD.bProoduce and not tMhPar.est and tMhPar.d3 and nTempT3 and nTempT3 <= 0 then
|
|
dNumLog = -2396
|
|
sMessToOut = sMessToOut .. '\n'.. GetMachToolErrorMessage( nTempT3, sLMM, nLMMi, tMhPar.d3, dNumLog, sMchngName3)
|
|
elseif not tMhPar.est and nTempT3 then
|
|
tMhPar.d3 = nTempT3
|
|
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 se raggio minore del diametro utensile + delta, lo annullo
|
|
if tMhPar.est and tMhPar.rf and tMhPar.rf > 0 and tMhPar.d and tMhPar.rf < ((tMhPar.d/2)+0.02) then
|
|
tMhPar.rf = 0
|
|
end
|
|
|
|
-- chiseling
|
|
if tMhPar.ech and tMhPar.d0 and nTempT0 > 0 then
|
|
tMhPar.d0 = nTempT0
|
|
end
|
|
|
|
-- se la profondità della arm 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 = -2393
|
|
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 arm è maggiore della capacità utensile limito la profondità ed emetto un warning
|
|
if tMhPar.T and dMaxMat1 and tMhPar.T > dMaxMat1 then
|
|
dNumLog = -2398
|
|
dNumMessage = 460
|
|
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T), EgtToUiUnits(dMaxMat1))
|
|
tMhPar.T = dMaxMat1 - 0.05 -- tolgo 0.05 per permettere la lavorazione
|
|
end
|
|
|
|
-- se la profondità antischeggia della arm è maggiore della capacità utensile limito la profondità ed emetto un warning
|
|
if tMhPar.T and dMaxMat2 and tMhPar.T > dMaxMat2 then
|
|
dNumLog = -2397
|
|
dNumMessage = 462
|
|
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T), EgtToUiUnits(dMaxMat2))
|
|
tMhPar.T = dMaxMat2 - 0.05 -- tolgo 0.05 per permettere la lavorazione
|
|
end
|
|
|
|
if tMhPar.T and tMhPar.T > 0 and tMhPar.ls then
|
|
tMhPar.fht = tMhPar.T
|
|
tMhPar.fhb = tMhPar.fht
|
|
end
|
|
|
|
-- se la profondità della pocket è maggiore della capacità utensile limito la profondità ed emetto un warning
|
|
if tMhPar.T2 and dMaxMat3 and tMhPar.T2 > dMaxMat3 then
|
|
dNumLog = -2395
|
|
dNumMessage = 461
|
|
sMessToOut = sMessToOut .. '\n'.. string.format(EgtDoorsMsg[dNumMessage], dNumLog, tMhPar.Nome, EgtToUiUnits(tMhPar.T2), EgtToUiUnits(dMaxMat3))
|
|
tMhPar.T2 = dMaxMat3
|
|
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 OverHead.Draw( tOHead, bPreview, bRunByCompo, nDrawMach, dThickDoor)
|
|
|
|
-- Assegno le dimensioni
|
|
local L = tOHead.L
|
|
local H = tOHead.H
|
|
local T = tOHead.T
|
|
local R = tOHead.rf
|
|
local clc = tOHead.clc
|
|
local ccr = tOHead.ccr
|
|
local d = tOHead.d
|
|
local p = tOHead.p
|
|
local sf = tOHead.sf
|
|
local d2 = tOHead.d2
|
|
local DS = tOHead.DS
|
|
local OS = tOHead.OS
|
|
local L2 = tOHead.L2
|
|
local H2 = tOHead.H2
|
|
local T2 = tOHead.T2
|
|
local d3 = tOHead.d3
|
|
local p3 = tOHead.p3
|
|
local s = tOHead.s
|
|
local DS2 = tOHead.DS2
|
|
local ech = tOHead.ech -- abilitazione chisel
|
|
local bEqualTh = tOHead.bETh
|
|
local ls = tOHead.ls
|
|
local fht = tOHead.fht
|
|
local fhb = tOHead.fhb
|
|
local est = tOHead.est
|
|
local kbs = tOHead.kbs -- keep backset/thickness (0: none, 1: only face, 2: all)
|
|
local pbs = tOHead.pbs
|
|
local DY = tOHead.DY
|
|
local cl = 0
|
|
local invG = 1
|
|
-- Assegno i nomi geometrie
|
|
local LG = tOHead.LG -- nome geometria arm
|
|
local LM = tOHead.LM -- nome lavorazione arm
|
|
local LA = tOHead.LA -- nome geometria antischeggia
|
|
local LGM = tOHead.LGM -- nome geometria pocket
|
|
local LMM = tOHead.LMM -- nome lavorazione pocket
|
|
local CH = tOHead.CH -- nome suffisso lavorazione chisel
|
|
local CLC = tOHead.CLC -- nome geometria clean corner
|
|
local DM = 'DUMMY'
|
|
-- variabili per messaggi e settaggi vari
|
|
local sCompoName = tOHead.Nome
|
|
local nCompoNpar = tOHead.Npar
|
|
local sCompoPath = tOHead.Path
|
|
-- eventuale messaggio errore rilevato nell'adjust
|
|
local nCodAdj = tOHead.nCod
|
|
local sCodAdj = tOHead.sCod
|
|
-- nomi parametri per messaggi
|
|
local sNamePar1 = tOHead.N1 or 'L'
|
|
local sNamePar2 = tOHead.N2 or 'H'
|
|
local sNamePar3 = tOHead.N3 or 'T'
|
|
local sNamePar4 = tOHead.N4 or 'd'
|
|
local sNamePar5 = tOHead.N5 or 'p'
|
|
local sNamePar6 = tOHead.N6 or 'd2'
|
|
local sNamePar7 = tOHead.N7 or 'DS'
|
|
local sNamePar8 = tOHead.N8 or 'OS'
|
|
local sNamePar9 = tOHead.N9 or 'sf'
|
|
local sNamePar10 = tOHead.N10 or 'L2'
|
|
local sNamePar11 = tOHead.N11 or 'H2'
|
|
local sNamePar12 = tOHead.N12 or 'T2'
|
|
local sNamePar13 = tOHead.N13 or 'd3'
|
|
local sNamePar14 = tOHead.N14 or 'p3'
|
|
local sNamePar15 = tOHead.N15 or 's'
|
|
local sNamePar16 = tOHead.N16 or 'DS2'
|
|
local sNamePar17 = tOHead.N17 or 'R'
|
|
local sNamePar18 = tOHead.N18 or 'clc'
|
|
local sNamePar19 = tOHead.N19 or 'ccr'
|
|
|
|
-- RunByComponetInterface
|
|
local RC = true
|
|
-- Messaggi codice errori
|
|
local EM = ' '
|
|
local EC = 0
|
|
local ErrorBase = 2300
|
|
-- variabili che abilitano la creazione della geometria
|
|
local bMakeFaceGeom = true
|
|
local bMakeMortGeom = true
|
|
-- variabili dei percorsi geometrici
|
|
local nGeom1, nGeom2, nAS1, nAS2
|
|
local nPkToJoin1, nPkToJoin2, nPkToJoin, nIdSideBoxUp
|
|
|
|
if not bRunByCompo then -- controllo se lanciato da componente
|
|
RC = false
|
|
end
|
|
|
|
-- verifico se dei parametri sono nulli e in qual caso assegno dei valori sostitutivi
|
|
-- o setto la disabilitazione della creazione di alcune geometrie
|
|
if not L or not H then
|
|
bMakeFaceGeom = false
|
|
clc = nil
|
|
CLC = nil
|
|
end
|
|
|
|
if not T then
|
|
T = 0
|
|
end
|
|
|
|
-- se non sborda
|
|
if not ls then
|
|
DY = DY + H/2 -- compenso lo spostamento della metà cava
|
|
-- se c'è un raccordo setto per raccordare tutti gli angoli
|
|
if R and R > 0 then
|
|
cl = 3
|
|
end
|
|
end
|
|
|
|
if est or not L2 or not H2 then
|
|
bMakeMortGeom = false
|
|
end
|
|
|
|
if not T2 then
|
|
T2 = 0
|
|
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 nForceMakeFace = nDrawMach
|
|
|
|
-- se ho abilitato il chiseling modifico il nome geometria
|
|
if ech then
|
|
LG = LG .. CH
|
|
tOHead.LG = LG
|
|
tOHead.smr = 1 -- inserisco i raccordini per non fare il chisel
|
|
-- se ho abilitato solo le geometrie di lavorazione, abilito la generazione di entrambe per il contorno chisel
|
|
if nDrawMach == 1 then
|
|
nForceMakeFace = 2
|
|
end
|
|
end
|
|
|
|
local EgtDoorsMsg = require( 'EgtDoorsMsg')
|
|
|
|
-- Verifica delle dimensioni, le condizioni vengono verificate in base a quale geometria deve essere creata
|
|
if bMakeFaceGeom and nDrawMach > 0 and d < DgMin then
|
|
EC = 1
|
|
EM = string.format(EgtDoorsMsg[400],sNamePar4,EgtToUiUnits(d),EgtToUiUnits(DgMin)) -- il diametro utensile deve essere >= di
|
|
d = DgMin
|
|
elseif bMakeFaceGeom and 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 bMakeFaceGeom and H <= 0 then
|
|
EC = 3
|
|
EM = string.format(EgtDoorsMsg[401],sNamePar2,EgtToUiUnits(H), sCompoPath) -- il parametro 'H' deve essere > 0
|
|
H = d/2
|
|
elseif bMakeFaceGeom and nDrawMach > 0 and L <= d then
|
|
if DGD.bProoduce then
|
|
EC = 4
|
|
EM = string.format(EgtDoorsMsg[402],sNamePar1,EgtToUiUnits(L),sNamePar4,EgtToUiUnits(d), sCompoPath) -- il parametro 'L' deve essere maggiore al diametro utensile d
|
|
L = d + 0.002
|
|
else
|
|
d = L - 0.002
|
|
end
|
|
elseif bMakeFaceGeom and 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 d2
|
|
L = d2 + 0.002
|
|
else
|
|
d2 = L - 0.002
|
|
end
|
|
elseif bMakeFaceGeom and 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 bMakeFaceGeom and T < 0 then
|
|
EC = 7
|
|
EM = string.format(EgtDoorsMsg[404],sNamePar3,EgtToUiUnits(T), sCompoPath) -- il parametro 'T' deve essere >= 0
|
|
T = 0
|
|
elseif bMakeFaceGeom and L <= 0 then
|
|
EC = 8
|
|
EM = string.format(EgtDoorsMsg[401],sNamePar1,EgtToUiUnits(L), sCompoPath) -- il parametro 'L' deve essere > 0
|
|
L = d
|
|
elseif bMakeFaceGeom and OS ~= 0 and OS ~= 1 and OS ~= -1 then
|
|
EC = 9
|
|
EM = string.format(EgtDoorsMsg[417],sNamePar8,OS, sCompoPath) -- il parametro 'OS' accetta solo valore: 0, 1 o -1
|
|
OS = 0
|
|
elseif bMakeFaceGeom and DS < 0 then
|
|
EC = 10
|
|
EM = string.format(EgtDoorsMsg[404],sNamePar7,EgtToUiUnits(DS), sCompoPath) -- il parametro 'DS' deve essere > 0
|
|
DS = 0
|
|
elseif bMakeMortGeom and nDrawMach > 0 and d3 < DgMin then
|
|
EC = 11
|
|
EM = string.format(EgtDoorsMsg[400],sNamePar13,EgtToUiUnits(d3),EgtToUiUnits(DgMin)) -- il diametro utensile deve essere >= di
|
|
d3 = DgMin
|
|
elseif bMakeMortGeom and H2 <= 0 then
|
|
EC = 12
|
|
EM = string.format(EgtDoorsMsg[401],sNamePar11,EgtToUiUnits(H2), sCompoPath) -- il parametro 'H2' deve essere > 0
|
|
H2 = d3/2
|
|
elseif bMakeMortGeom and nDrawMach > 0 and L2 <= d3 then
|
|
if DGD.bProoduce then
|
|
EC = 13
|
|
EM = string.format(EgtDoorsMsg[402],sNamePar10,EgtToUiUnits(L2),sNamePar13,EgtToUiUnits(d3), sCompoPath) -- il parametro 'L2' deve essere maggiore al diametro utensile d3
|
|
L2 = d3 + 0.002
|
|
else
|
|
d3 = L2 - 0.002
|
|
end
|
|
elseif bMakeMortGeom and nDrawMach > 0 and ( p3 < PtMin or p3 > PtMax) then
|
|
EC = 14
|
|
EM = string.format(EgtDoorsMsg[403],sNamePar14,p3,PtMin,PtMax, sCompoPath) -- il parametro 'p3' deve essere compreso tra
|
|
p3 = 0.8
|
|
elseif bMakeMortGeom and T2 < 0 then
|
|
EC = 15
|
|
EM = string.format(EgtDoorsMsg[404],sNamePar12,EgtToUiUnits(T2), sCompoPath) -- il parametro 'T2' deve essere >= 0
|
|
T2 = 0
|
|
elseif bMakeMortGeom and L2 <= 0 then
|
|
EC = 16
|
|
EM = string.format(EgtDoorsMsg[401],sNamePar10,EgtToUiUnits(L2), sCompoPath) -- il parametro 'L' deve essere > 0
|
|
L2 = d3 + 0.002
|
|
elseif bMakeFaceGeom and nDrawMach > 0 and sf and sf <= 0 then
|
|
EM = string.format(EgtDoorsMsg[401],sNamePar9,EgtToUiUnits(sf), sCompoPath) -- il parametro 'sf' deve essere > 0
|
|
EC = 17
|
|
sf = d
|
|
elseif bMakeMortGeom and nDrawMach > 0 and s and s <= 0 then
|
|
EM = string.format(EgtDoorsMsg[401],sNamePar15,EgtToUiUnits(s), sCompoPath) -- il parametro 's' deve essere > 0
|
|
EC = 18
|
|
s = d3
|
|
elseif bMakeMortGeom and DS2 < 0 then
|
|
EC = 19
|
|
EM = string.format(EgtDoorsMsg[404],sNamePar16,EgtToUiUnits(DS2), sCompoPath) -- il parametro 'DS2' deve essere > 0
|
|
DS2 = 0
|
|
elseif bMakeFaceGeom and ls and R < 0 then
|
|
EC = 20
|
|
EM = string.format(EgtDoorsMsg[404],sNamePar17,EgtToUiUnits(R), sCompoPath) -- il parametro 'R' deve essere >= 0
|
|
R = d/2
|
|
elseif bMakeFaceGeom and R and L <= R*2 then
|
|
EC = 21
|
|
EM = string.format(EgtDoorsMsg[406],sNamePar17,EgtToUiUnits(R),sNamePar1..'/2',EgtToUiUnits(L/2), sCompoPath) -- il parametro 'R' deve essere < 'L/2'
|
|
L = (R*2)+1
|
|
elseif bMakeFaceGeom and ls and R >= H then
|
|
EC = 22
|
|
EM = string.format(EgtDoorsMsg[406],sNamePar17,EgtToUiUnits(R),sNamePar2,EgtToUiUnits(H), sCompoPath) -- il parametro 'R' deve essere < H
|
|
R = d/2
|
|
elseif bMakeFaceGeom and not ls and H < d then
|
|
if DGD.bProoduce then
|
|
EC = 23
|
|
EM = string.format(EgtDoorsMsg[405],sNamePar2,EgtToUiUnits(H),EgtToUiUnits(d), sCompoPath) -- il parametro 'H' deve essere maggiore o uguale del diametro utensile
|
|
H = d
|
|
else
|
|
d = H - 0.002
|
|
end
|
|
elseif bMakeFaceGeom and not ls and R and H <= R*2 then
|
|
EC = 24
|
|
EM = string.format(EgtDoorsMsg[406],sNamePar17,EgtToUiUnits(R),sNamePar2..'/2',EgtToUiUnits(H/2), sCompoPath) -- il parametro 'R' deve essere < H/2
|
|
R = H/2
|
|
elseif bMakeFaceGeom and not ls and cl > 0 and R and R < 0 then
|
|
EC = 25
|
|
EM = string.format(EgtDoorsMsg[404],sNamePar17,EgtToUiUnits(R), sCompoPath) -- il parametro 'R' deve essere >= 0
|
|
R = H/2
|
|
elseif bMakeFaceGeom and not ls and cl > 0 and R and abs(R - (H/2)) < GEO.EPS_SMALL and L <= H then
|
|
EC = 26
|
|
EM = string.format(EgtDoorsMsg[407],sNamePar1,EgtToUiUnits(L),sNamePar2,EgtToUiUnits(H), sCompoPath) -- il parametro 'L' deve essere > 'H'
|
|
L = H+5
|
|
elseif bMakeFaceGeom and not ls and cl > 0 and R and R < (H/2) and L <= (R*2) then
|
|
EC = 27
|
|
EM = string.format(EgtDoorsMsg[407],sNamePar1,EgtToUiUnits(L),sNamePar17..'*2',EgtToUiUnits(R*2), sCompoPath) -- il parametro 'L' deve essere > 'R*2'
|
|
L = (R*2)+5
|
|
elseif bMakeFaceGeom and CLC and clc and ccr and clc > 0 and ccr > 0 and (2*(ccr*sin(45))) >= clc then
|
|
EC = 28
|
|
EM = string.format(EgtDoorsMsg[407],sNamePar18,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
|
|
local sRequireCompoName
|
|
|
|
Lg = EgtGroup(Pz,GDB_RT.LOC) -- layer della figura principale
|
|
EgtSetName(Lg,sCompoName)
|
|
|
|
if nDrawMach > 0 then -- se abilitata geometria lavorazione
|
|
Dm = EgtGroup( Pz, GDB_RT.LOC) -- layer disegni cerchi rappresentante il diametro utensile
|
|
EgtSetName( Dm, DM)
|
|
end
|
|
|
|
if ls then -- se latch strike lancio il componente standard
|
|
sRequireCompoName = '_OverHeadArm'
|
|
else
|
|
sRequireCompoName = '_Latch'
|
|
tOHead.cl = cl
|
|
tOHead.invG = invG
|
|
tOHead.DY = -DY
|
|
tOHead.smr = 0
|
|
end
|
|
|
|
if bMakeFaceGeom then
|
|
-- lancio il primo componente base
|
|
MHgen = require( sRequireCompoName)
|
|
nGeom1, nPkToJoin1, nAS1, nAS2, nIdSideBoxUp = MHgen.Draw( EC, EM, tOHead, bPreview, bRunByCompo, nForceMakeFace, Pz, Lg, dThickDoor, 'OH')
|
|
|
|
-- Clean corner
|
|
if nDrawMach >= 0 then -- se abilitata geometria
|
|
local CLC1
|
|
if CLC and clc and clc > 0 and clc < H and clc < L then
|
|
CLC1 = MakeClcPath( clc, ccr, CLC, Lg, -T)
|
|
if CLC1 then
|
|
-- se mantiene lato anche su face
|
|
if kbs and kbs > 0 then
|
|
local sKeepMode = 'n' -- setto di default per mantenere il lato narrow
|
|
if bEqualTh or not ls then -- se spessore passante o in centro allo spessore
|
|
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,'InserPoint' ,'Edge') -- setto una nota per indicare su che lato della porta deve essere spostato
|
|
EgtSetInfo( CLC1,'DeltaPos' ,( L+(2*DS)))
|
|
|
|
if ls then -- se latch string
|
|
if OS <= 0 then -- se cava non aperta a destra
|
|
-- angolo x+y-
|
|
local CLC2 = EgtCopyGlob( CLC1, Lg)
|
|
EgtRotate( CLC2, Point3d(0,0,0), Z_AX(), 180)
|
|
EgtMove( CLC2, Point3d((L/2),-H,0) - ORIG())
|
|
-- muovo ulteriormente le geometrie
|
|
EgtMove( CLC2, Point3d(-((L/2)+DS),0,0) - ORIG())
|
|
end
|
|
if OS >= 0 then -- se cava non aperta a sinistra
|
|
-- angolo x-y-
|
|
EgtRotate( CLC1, Point3d(0,0,0), Z_AX(), 90)
|
|
EgtMove( CLC1, Point3d(-(L/2),-H,0) - ORIG())
|
|
-- muovo ulteriormente le geometrie
|
|
EgtMove( CLC1, Point3d(-((L/2)+DS),0,0) - ORIG())
|
|
else
|
|
EgtErase(CLC1)
|
|
end
|
|
else -- altrimenti non latch strike
|
|
if OS <= 0 then -- se cava non aperta a destra
|
|
-- angolo x+y+
|
|
local CLC2 = EgtCopyGlob( CLC1, Lg)
|
|
EgtRotate( CLC2, Point3d(0,0,0), Z_AX(), -90)
|
|
EgtMove( CLC2, Point3d((L/2),(H/2),0) - ORIG())
|
|
-- angolo x+y-
|
|
local CLC3 = EgtCopyGlob( CLC1, Lg)
|
|
EgtRotate( CLC3, Point3d(0,0,0), Z_AX(), 180)
|
|
EgtMove( CLC3, Point3d((L/2),-(H/2),0) - ORIG())
|
|
EgtMove( CLC2, Point3d(-((L/2)+DS),-(dThickDoor/2),0) - ORIG())
|
|
EgtMove( CLC3, Point3d(-((L/2)+DS),-(dThickDoor/2),0) - ORIG())
|
|
end
|
|
if OS >= 0 then -- se cava non aperta a sinistra
|
|
-- angolo x-y-
|
|
local CLC4 = EgtCopyGlob( CLC1, Lg)
|
|
EgtRotate( CLC4, Point3d(0,0,0), Z_AX(), 90)
|
|
EgtMove( CLC4, Point3d(-(L/2),-(H/2),0) - ORIG())
|
|
-- angolo x-y+
|
|
EgtMove( CLC1, Point3d(-(L/2),(H/2),0) - ORIG())
|
|
-- muovo ulteriormente le geometrie
|
|
EgtMove( CLC1, Point3d(-((L/2)+DS),-(dThickDoor/2),0) - ORIG())
|
|
EgtMove( CLC4, Point3d(-((L/2)+DS),-(dThickDoor/2),0) - ORIG())
|
|
else
|
|
EgtErase(CLC1)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
if bMakeMortGeom then
|
|
tOHead.smr = 0
|
|
-- lancio il secondo componente base
|
|
MHgen = require('_OverHeadPocket')
|
|
nGeom2, nPkToJoin2 = MHgen.Draw( EC, EM, tOHead, bPreview, bRunByCompo, nDrawMach, Pz, Lg)
|
|
end
|
|
|
|
-- Se non Preview
|
|
if not bPreview and EC == 0 then
|
|
if bRunByCompo then
|
|
-- scrivo i parametri nelle info del pezzo
|
|
WriteCompoDataToPart(Pz,sCompoName,nCompoNpar)
|
|
end
|
|
|
|
-- scrivo note nel layer della geometria
|
|
EgtSetInfo(Lg,'Type' ,'OverHead')
|
|
EgtSetInfo(Lg,'L' ,L)
|
|
EgtSetInfo(Lg,'H' ,H)
|
|
EgtSetInfo(Lg,'T' ,T)
|
|
EgtSetInfo(Lg,'rf' ,rf)
|
|
EgtSetInfo(Lg,'d' ,d)
|
|
EgtSetInfo(Lg,'p' ,p)
|
|
EgtSetInfo(Lg,'sf' ,sf)
|
|
EgtSetInfo(Lg,'d2' ,d2)
|
|
EgtSetInfo(Lg,'DS' ,DS)
|
|
EgtSetInfo(Lg,'OS' ,OS)
|
|
EgtSetInfo(Lg,'ech' ,ech)
|
|
EgtSetInfo(Lg,'ls' ,ls)
|
|
EgtSetInfo(Lg,'bEqualTh' ,bEqualTh)
|
|
EgtSetInfo(Lg,'DY' ,DY)
|
|
EgtSetInfo(Lg,'L2' ,L2)
|
|
EgtSetInfo(Lg,'H2' ,H2)
|
|
EgtSetInfo(Lg,'T2' ,T2)
|
|
EgtSetInfo(Lg,'d3' ,d3)
|
|
EgtSetInfo(Lg,'p3' ,p3)
|
|
EgtSetInfo(Lg,'s' ,s)
|
|
EgtSetInfo(Lg,'est' ,est)
|
|
EgtSetInfo(Lg,'kbs' ,kbs)
|
|
EgtSetInfo(Lg,'pbs' ,pbs)
|
|
EgtSetInfo(Lg,'DS2' ,DS2)
|
|
EgtSetInfo(Lg,'fht' ,fht)
|
|
EgtSetInfo(Lg,'fhb' ,fhb)
|
|
EgtSetInfo(Lg,'LG' ,LG)
|
|
EgtSetInfo(Lg,'LM' ,LM)
|
|
EgtSetInfo(Lg,'LA' ,LA)
|
|
EgtSetInfo(Lg,'LGM' ,LGM)
|
|
EgtSetInfo(Lg,'LMM' ,LMM)
|
|
EgtSetInfo(Lg,'CH' ,CH)
|
|
EgtSetInfo(Lg,'Path' ,sCompoPath)
|
|
|
|
-- cancello le parti ausiliarie se disegnate
|
|
if Dm then
|
|
EgtErase( Dm)
|
|
end
|
|
elseif not bPreview then
|
|
-- cancello le parti ausiliarie se disegnate
|
|
if Dm then
|
|
EgtErase( Dm)
|
|
end
|
|
end
|
|
|
|
if EC == 0 and nCodAdj and nCodAdj < 0 then
|
|
EC = nCodAdj
|
|
EM = sCodAdj
|
|
end
|
|
|
|
return EC, EM, Lg
|
|
end
|
|
|
|
return OverHead
|