5e2cbcc9dd
Prima versione macchina derivata da Essetre-90480025
183 lines
8.2 KiB
Lua
183 lines
8.2 KiB
Lua
-- WallData.lua by Egaltech s.r.l. 2022/01/12
|
|
-- Raccolta dati generali per Pareti
|
|
|
|
EgtOutLog( ' 90480023_XS-MW-WallData started', 1)
|
|
|
|
-- Tabella per definizione modulo
|
|
local WallData = {
|
|
MIN_LENGTH = 100, -- lunghezza minima del grezzo
|
|
MIN_WIDTH = 100, -- larghezza minima del grezzo
|
|
MIN_HEIGHT = 10, -- altezza minima del grezzo
|
|
MAX_LENGTH = 18000, -- lunghezza massima del grezzo
|
|
MAX_WIDTH = 4900, -- larghezza massima del grezzo
|
|
MAX_HEIGHT = 400, -- altezza massima del grezzo
|
|
STD_RAW_LENGTH = 10000, -- lunghezza standard del grezzo
|
|
STD_RAW_WIDTH = 4000, -- larghezza standard del grezzo
|
|
OVM_HEAD = 60, -- sovramateriale testa
|
|
OVM_MID = 50, -- sovramateriale intermedio
|
|
COLL_SIC = 5, -- distanza di sicurezza per collisioni
|
|
CUT_SIC = 20, -- distanza di sicurezza per tagli
|
|
CUT_EXTRA = 0, -- affondamento extra standard per tagli di lama e fresature
|
|
CUT_EXTRA_MIN = 0, -- affondamento extra ridotto per tagli di lama e fresature
|
|
NZ_MINA = 0.5, -- componente limite in Z normale di una faccia (-30deg)
|
|
NZ_MINB = -0.4, -- componente limite in Z normale di un insieme di facce (-23deg)
|
|
DRILL_TOL = 0.5, -- tolleranza tra diametro foro e diametro punta
|
|
DRILL_VZ_MIN = 0.5, -- componente limite in Z del versore di un foro
|
|
DRILL_VX_MAX = 0.866, -- componente limite in X del versore di un foro sulle facce laterali
|
|
DRILL_OVERLAP = 5, -- sovrapposizione tra due mezze forature
|
|
MILL_OVERLAP = 5, -- sovrapposizione tra due mezze fresature
|
|
MAX_CLEAN_CRN30 = 60, -- massimo spessore per pulitura angolo con fresa 30deg
|
|
MAX_CLEAN_CRN60 = 150, -- massimo spessore per pulitura angolo con fresa 60deg
|
|
MILL_MAX_DEPTH_AS_MAT = true, -- massimo affondamento frese uguale ad altezza tagliente (max materiale)
|
|
T14_T12_DOUBLE = true, -- abilita chiodatura in doppio con teste T14 e T12
|
|
RAWCOL = { 255, 160, 32, 30}, -- colore del grezzo
|
|
SIMUL_VIEW_DIR = 3, -- direzione di vista predefinita per la simulazione (1=NW, 2=SW, 3=NE, 4=SE)
|
|
ORIG_CORNER = 'TL', -- posizione origine (TL,BL,TR,BR,TM,BM)
|
|
MID_REF = 27000, -- posizione X dell'origine intermedia
|
|
USE_POSY = true -- utilizzare POSY di BTL (spostamento sullo spessore per pareti a layer)
|
|
}
|
|
|
|
-- Aggiornamento con dati da TechnoEssetre7
|
|
local sTs3Data = EgtGetStringFromIni( 'Wall', 'DATA_DIR', "C:\\TechnoEssetre7\\EgtData", EgtGetIniFile()).."\\Essetre-90480023_XS-MW.data"
|
|
local sData = EgtGetCurrMachineDir().."\\Wall\\Ts3Data.lua"
|
|
if EgtExistsFile( sTs3Data) then
|
|
EgtCopyFile( sTs3Data, sData)
|
|
local sTs3DataOld = sTs3Data..'.old'
|
|
EgtEraseFile( sTs3DataOld)
|
|
EgtRenameFile( sTs3Data, sTs3DataOld)
|
|
end
|
|
if EgtExistsFile( sData) then
|
|
local Machine = dofile( sData)
|
|
if Machine then
|
|
if Machine.Trave then
|
|
WallData.MIN_LENGTH = Machine.Trave.YMIN or BeamData.MIN_LENGTH
|
|
WallData.MIN_WIDTH = Machine.Trave.XMIN or BeamData.MIN_WIDTH
|
|
WallData.MIN_HEIGHT = Machine.Trave.ZMIN or BeamData.MIN_HEIGHT
|
|
WallData.MAX_LENGTH = Machine.Trave.YMAX or BeamData.MAX_LENGTH
|
|
WallData.MAX_WIDTH = Machine.Trave.XMAX or BeamData.MAX_WIDTH
|
|
WallData.MAX_HEIGHT = Machine.Trave.ZMAX or BeamData.MAX_HEIGHT
|
|
end
|
|
if Machine.Offsets then
|
|
WallData.MID_REF = -Machine.Offsets.OFFSET_ZERO5_Y
|
|
WallData.T14_T12_DOUBLE = ( Machine.Offsets.T14_T12_DOUBLE == 1)
|
|
end
|
|
end
|
|
end
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
local function GetOrigCorner( RefPos)
|
|
if RefPos == 1 then
|
|
return 'TL'
|
|
elseif RefPos == 2 then
|
|
return 'BL'
|
|
elseif RefPos == 3 then
|
|
return 'TR'
|
|
elseif RefPos == 4 then
|
|
return 'BR'
|
|
elseif RefPos == 5 then
|
|
return 'TM'
|
|
elseif RefPos == 6 then
|
|
return 'BM'
|
|
else
|
|
return 'TL'
|
|
end
|
|
end
|
|
WallData.GetOrigCorner = GetOrigCorner
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
local function VerifyFeatureForDouble( Proc)
|
|
-- deve essere attiva
|
|
if Proc.Flg == 0 then return 0 end
|
|
-- non deve essere già associata
|
|
if Proc.Double then return 0 end
|
|
-- deve essere contorno libero
|
|
if not ( ( Proc.Grp == 0 or Proc.Grp == 3 or Proc.Grp == 4) and ( Proc.Prc == 250)) then return 0 end
|
|
-- non deve essere una svuotatura
|
|
if EgtGetInfo( Proc.Id, 'PCKT', 'i') == 1 then return 0 end
|
|
-- deve richiedere utensili opportuni
|
|
local nTool = EgtGetInfo( Proc.Id, 'CNT_DATA', 'i')
|
|
if nTool ~= 12 and nTool ~= 14 then return 0 end
|
|
-- deve avere una curva ausiliaria associata
|
|
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
|
|
if not AuxId then return 0 end
|
|
AuxId = AuxId + Proc.Id
|
|
-- questa curva deve essere una retta orientata come gli assi X o Y
|
|
if Proc.Box:getDimY() > 1 and Proc.Box:getDimX() > 1 then return 0 end
|
|
local ptS = EgtSP( AuxId, GDB_ID.ROOT)
|
|
local ptE = EgtEP( AuxId, GDB_ID.ROOT)
|
|
-- va bene se diretta come l'asse X
|
|
if abs( ptS:getY() - ptE:getY()) < 1 then
|
|
if ptS:getX() <ptE:getX() then
|
|
return 1, ptS, ptE
|
|
else
|
|
return 1, ptE, ptS
|
|
end
|
|
end
|
|
-- va bene se diretta come l'asse Y
|
|
if abs( ptS:getX() - ptE:getX()) < 1 then
|
|
return 2, ptS, ptE
|
|
end
|
|
-- non va bene
|
|
return 0
|
|
end
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
local function FindFeaturesInDouble( vProc, b3Raw)
|
|
if not WallData.T14_T12_DOUBLE then return end
|
|
local MIN_INTERAX = 1350
|
|
local MIN_EXTRA_Y = 400
|
|
for i = 1, #vProc do
|
|
local Proc = vProc[i]
|
|
local nType, ptS, ptE = VerifyFeatureForDouble( Proc)
|
|
-- se linea lungo X
|
|
if nType == 1 then
|
|
for j = i + 1, #vProc do
|
|
local OtherProc = vProc[j]
|
|
local nOtherType, ptOtherS, ptOtherE = VerifyFeatureForDouble( OtherProc)
|
|
if nOtherType == 1 and abs( ptS:getX() - ptOtherS:getX()) < 1 and abs( ptE:getX() - ptOtherE:getX()) < 1 then
|
|
-- verifico l'interasse come distanza tra i due inizi
|
|
local dDeltaY = ptS:getY() - ptOtherS:getY()
|
|
if dDeltaY >= MIN_INTERAX then
|
|
Proc.Double = 1
|
|
Proc.Delta = dDeltaY
|
|
EgtSetInfo( Proc.Id, 'CNT_DATA', '14')
|
|
OtherProc.Flg = 0
|
|
OtherProc.Double = -1
|
|
break
|
|
elseif dDeltaY <= -MIN_INTERAX then
|
|
OtherProc.Double = 1
|
|
OtherProc.Delta = -dDeltaY
|
|
EgtSetInfo( OtherProc.Id, 'CNT_DATA', '14')
|
|
Proc.Flg = 0
|
|
Proc.Double = -1
|
|
break
|
|
end
|
|
end
|
|
end
|
|
-- se altrimenti linea lungo Y
|
|
elseif nType == 2 then
|
|
local dLen = ptS:getY() - ptE:getY()
|
|
if abs( dLen) >= MIN_INTERAX + MIN_EXTRA_Y then
|
|
Proc.Double = 2
|
|
Proc.Delta = max( abs( dLen) / 2, MIN_INTERAX) * EgtIf( dLen > 0, 1, -1)
|
|
Proc.DblAcc = abs( dLen) - abs( Proc.Delta)
|
|
EgtSetInfo( Proc.Id, 'CNT_DATA', '14')
|
|
end
|
|
end
|
|
end
|
|
end
|
|
WallData.FindFeaturesInDouble = FindFeaturesInDouble
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
local function GetSawHeadSide( dSpeed, sHead)
|
|
if sHead == 'H2' then
|
|
return EgtIf( dSpeed > 0, MCH_SAW_HS.LEFT, MCH_SAW_HS.RIGHT)
|
|
else
|
|
return EgtIf( dSpeed < 0, MCH_SAW_HS.LEFT, MCH_SAW_HS.RIGHT)
|
|
end
|
|
end
|
|
WallData.GetSawHeadSide = GetSawHeadSide
|
|
|
|
---------------------------------------------------------------------
|
|
return WallData
|