Files
2026-03-05 08:44:06 +01:00

372 lines
20 KiB
Lua

-- BeamData.lua by Egaltech s.r.l. 2024/03/28
-- Raccolta dati generali per Travi
EgtOutLog( ' FAST-BeamData started', 1)
-- Tabella per definizione modulo
local BeamData = {
GO_FAST = 0, -- flag abilitazione modalità veloce (0=no, 1=carrelli, 2=anche cambio utensili)
RIGHT_LOAD = false, -- flag carico da destra
ROT90 = false, -- flag abilitazione rotazione 90 gradi
ROT180 = true, -- flag abilitazione rotazione 180 gradi
NEWCLAMPING = true, -- flag abilitazione nuovo metodo riposizionamento carrelli
FASTCLAMPING= false, -- flag abilitazione riduzione numero riposizionamenti al carico e durante grande trascinamento
MIN_WIDTH = 40, -- larghezza minima del grezzo
MIN_HEIGHT = 40, -- altezza minima del grezzo
MAX_WIDTH = 240, -- larghezza massima del grezzo
MAX_HEIGHT = 625, -- altezza massima del grezzo
MAX_WIDTH2 = 305, -- seconda larghezza massima del grezzo
MAX_HEIGHT2 = 625, -- altezza massima per seconda larghezza massima del grezzo
LEN_SHORT_PART = 1200, -- lunghezza massima pezzo corto
LEN_VERY_SHORT_PART = 400, -- lunghezza massima pezzo molto corto (molto probabile lo scarico a caduta)
MAX_RAW = 30000, -- massima lunghezza grezzo (deve essere minore di LenTable - RAW_OFFSET)
STD_RAW = 14000, -- lunghezza standard della barra di grezzo
OVM_HEAD = 10, -- sovramateriale testa
OVM_MID = 5.4, -- sovramateriale intermedio (spessore lama)
MINRAW_S = 750, -- minimo grezzo in coda scaricabile per sezioni piccole
MINRAW_L = 1070, -- minimo grezzo in coda scaricabile per sezioni grandi
MAX_LEN_SCRAP = 270, -- massima lunghezza scarto di coda
MAX_LEN_SCRAP_START = 270, -- massima lunghezza scarto di testa
MAX_DIM_HTCUT = 200, -- larghezza massima taglio di testa o coda
MAX_DIM_HTCUT_HBEAM = 180, -- larghezza massima taglio di testa o coda con trave alta
MIN_DIM_HBEAM = 380, -- altezza minima di trave alta
MAX_DIM_DICE = 155, -- dimensione trasversale massima cubetto
MAX_LEN_DICE = 400, -- lunghezza massima cubetto
COLL_SIC = 5, -- distanza di sicurezza per collisioni
CUT_SIC = 20, -- distanza di sicurezza per tagli
CUT_EXTRA = 5, -- affondamento extra standard per tagli di lama e fresature
CUT_EXTRA_MIN = 1, -- affondamento extra ridotto per tagli di lama e fresature
NZ_MINA = -0.6, -- componente limite in Z normale di una faccia (-36.8deg)
NZ_MINB = -0.4, -- componente limite in Z normale di un insieme di facce (-23deg)
DRILL_TOL = 0.2, -- tolleranza tra diametro foro e diametro punta
DRILL_VZ_MIN = -0.51, -- componente limite in Z del versore di un foro
DRILL_VX_MAX = 0.867, -- componente limite in X del versore di un foro sulle facce laterali
DRILL_OVERLAP = 5, -- sovrapposizione tra due mezze forature
MAX_ANGLE_DRILL_CUT = 10, -- angolo massimo tra la foratura e il taglio che la attraversa
MILL_OVERLAP = 5, -- sovrapposizione tra due mezze fresature
MAX_DIST_HTFEA = 50.0, -- massima distanza di feature da testa o coda per essere considerata tale
MAX_LEN_HTFEA = 2000.0, -- massima lunghezza di feature di testa o coda
LONGCUT_ENDLEN = 600, -- lunghezza lavoro estremi iniziale e finale (std=600)
LONGCUT_MAXLEN = 1200, -- lunghezza massima sezione di taglio longitudinale
MAX_LEN_RIDGELAP_FROM_BOTTOM = 141, -- massima lunghezza ridgelap lavorabile da sotto
MAX_LEN_RIDGELAP_FROM_BOTTOM_HBEAM = 96, -- massima lunghezza ridgelap lavorabile da sotto con trave alta
DIM_TO_CENTER_STRIP = 0, -- larghezza minima trave per inseriemento codolo nel centro del trave; 0 = automatico
DIM_STRIP = -1, -- dimensione codolo sostegno parti lasciate su contorno libero o archi (-1 = da Q...)
DIM_STRIP_SMALL = 1, -- dimensione codolo piccolo (quando le parti sostenute sono sicuramente sulla parte sopra del pezzo)
RAWCOL = { 255, 160, 32, 30}, -- colore del grezzo
RAW_OFFSET = 2000, -- spostamento grezzo rimanente dopo split
VICE_MINH = 110, -- altezza minima della morsa
VICE_MAXH = 370, -- altezza massima zona pinzaggio orizzontale
ENABLE_TOOL_BETWEEN_VICES = false, -- abilita calcolo pinze permettendo di avere l'utensile tra di esse (ovviamente lontano da bordi in Y)
OFFSET_DRILL_TENON = 0, -- offset fori su tenoni verso base degli stessi (0=non fare)
USER_HOLE_DIAM = 0, -- diametro foro per L20
MAX_TOOL_LEN_FOR_HOR_MACH = 311, -- massima lunghezza utensile per poter fare forature (fresature) oltre i 10 gradi dalla verticale
DRILL_VZ_MIN_LONG_TOOL = 0.984, -- componente limite per lavorazioni con punta lunga
MAX_TOOL_LEN_BACK_HOR_MACH = 250, -- massima lunghezza utensile per poter eseguire lavorazioni (forature/svuotature) da dietro (faccia 4)
MAX_HEIGHT_ROT_B_ABOVE = 500, -- massima altezza della trave che permette di ruotare l'asse B sopra la stessa senza collisioni
KIOTP = 3, -- coefficiente moltiplicativo per attacco/uscita lama tangente anzichè perpendicolare
MAXDIAM_POCK_CORNER = 30, -- diametro massimo utensile ammesso per tasche con angoli interni
ADVANCE_TAIL_CUT = true, -- per spostare prima del taglio di separazione il taglio di coda su pezzi corti con robabile caduta
ADVANCE_TAIL_OFFS = 5, -- accorciamento taglio di coda avanzato (minimo 1)
HEAD_DIM_FOR_BH = 190, -- dimensione di ingombro della testa per block haus
MAX_LEN_BH_FROM_BOTTOM = 195, -- massima lunghezza lavorabile da un lato di block haus da sotto
MAX_DIST_BH_FROM_BOTTOM = 395, -- massima distanza tra naso mandrino e sopra della trave senza collisione
BH_MACHINE = false, -- flag che indica la tipologia di macchina configurata BlockHaus
ANG_TRASM = false, -- presenza rinvio angolare per lavorazioni da sotto
PRECUT_HEAD = true, -- flag abilitazione pretaglio grezzo a zero in testa
PRECUT_TAIL = true, -- flag abilitazione pretaglio grezzo a zero in coda
MIN_HEIGHT_ADDED_CUTS = 400, -- altezza minima pezzo per effettuare tagli orizzontali aggiuntivi in testa e coda
GAIN_RECLAMPING = 1000, -- in caso di scarso pinzaggio, mm da recuperare con pinzaggio ulteriore prima di spostare
NEWTOPC = true,
STRATEGIES_SCRIPT = 'Essetre',
STRATEGIES_CONFIG_FILE = 'Std1.json'
}
-- Aggiornamento con dati da TechnoEssetre7
local sTs3Data = EgtGetStringFromIni( 'Beam', 'DATA_DIR', "C:\\TechnoEssetre7\\EgtData", EgtGetIniFile()).."\\Essetre-Fast.data"
local sData = EgtGetCurrMachineDir().."\\Beam\\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.Offsets then
BeamData.ANG_TRASM = ( Machine.Offsets.SECSUP and Machine.Offsets.SECSUP >= 3)
BeamData.BH_MACHINE = ( Machine.Offsets.BLOCKHAUS == 1)
BeamData.MINRAW_S = max( BeamData.MINRAW_S, Machine.Offsets.MINRAW_S or BeamData.MINRAW_S)
BeamData.MINRAW_L = max( BeamData.MINRAW_L, Machine.Offsets.MINRAW_L or BeamData.MINRAW_L)
BeamData.CUT_EXTRA = Machine.Offsets.CUT_EXTRA or BeamData.CUT_EXTRA
BeamData.CUT_EXTRA_MIN = Machine.Offsets.CUT_EXTRA_MIN or BeamData.CUT_EXTRA_MIN
BeamData.DIM_STRIP_SMALL = Machine.Offsets.DIM_STRIP_SMALL or BeamData.DIM_STRIP_SMALL
BeamData.DIM_TO_CENTER_STRIP = Machine.Offsets.DIM_TO_CENTER_STRIP or BeamData.DIM_TO_CENTER_STRIP
BeamData.MAXDIAM_POCK_CORNER = Machine.Offsets.MAXDIAM_POCK_CORNER or BeamData.MAXDIAM_POCK_CORNER
BeamData.LONGCUT_ENDLEN = Machine.Offsets.LONGCUT_ENDLEN or BeamData.LONGCUT_ENDLEN
BeamData.LONGCUT_MAXLEN = Machine.Offsets.LONGCUT_MAXLEN or BeamData.LONGCUT_MAXLEN
if Machine.Offsets.MAX_ANGLE_DRILL_CUT then BeamData.MAX_ANGLE_DRILL_CUT = EgtClamp( Machine.Offsets.MAX_ANGLE_DRILL_CUT, 1, 89) end
BeamData.ADVANCE_TAIL_OFFS = Machine.Offsets.ADVANCE_TAIL_OFFS or BeamData.ADVANCE_TAIL_OFFS
BeamData.LEN_VERY_SHORT_PART = Machine.Offsets.LEN_VERY_SHORT_PART or BeamData.LEN_VERY_SHORT_PART
BeamData.LEN_SHORT_PART = Machine.Offsets.LEN_SHORT_PART or BeamData.LEN_SHORT_PART
BeamData.MAX_DIM_HTCUT_HBEAM = Machine.Offsets.MAX_DIM_HTCUT_HBEAM or BeamData.MAX_DIM_HTCUT_HBEAM
BeamData.MAX_HEIGHT2 = Machine.Offsets.MAX_HEIGHT2 or BeamData.MAX_HEIGHT2
BeamData.OVM_MID = Machine.Offsets.OVM_MID or BeamData.OVM_MID
if Machine.Offsets.PRECUT_HEAD_DISABLE then BeamData.PRECUT_HEAD = ( Machine.Offsets.PRECUT_HEAD_DISABLE == 0) end
if Machine.Offsets.PRECUT_TAIL_DISABLE then BeamData.PRECUT_TAIL = ( Machine.Offsets.PRECUT_TAIL_DISABLE == 0) end
if Machine.Offsets.MIN_HEIGHT_ADDED_CUTS then BeamData.MIN_HEIGHT_ADDED_CUTS = min( Machine.Offsets.MIN_HEIGHT_ADDED_CUTS, BeamData.MIN_HEIGHT_ADDED_CUTS) end
if Machine.Offsets.NEWCLAMPING ~= nil then BeamData.NEWCLAMPING = ( Machine.Offsets.NEWCLAMPING == 1) end
if Machine.Offsets.FASTCLAMPING ~= nil then BeamData.FASTCLAMPING = ( Machine.Offsets.FASTCLAMPING == 1) end
if Machine.Offsets.ROT90 ~= nil then BeamData.ROT90 = ( Machine.Offsets.ROT90 == 1) end
if Machine.Offsets.ROT180 ~= nil then BeamData.ROT180 = ( Machine.Offsets.ROT180 == 1) end
if Machine.Offsets.CUT_SIC then BeamData.CUT_SIC = EgtClamp( Machine.Offsets.CUT_SIC, 15, 50) end
if Machine.Offsets.NEWTOPC then BeamData.NEWTOPC = ( Machine.Offsets.NEWTOPC == 1) end
end
if Machine.Trave then
BeamData.MIN_WIDTH = Machine.Trave.XMIN or BeamData.MIN_WIDTH
BeamData.MIN_HEIGHT = Machine.Trave.ZMIN or BeamData.MIN_HEIGHT
BeamData.MAX_WIDTH = Machine.Trave.XMAX or BeamData.MAX_WIDTH
BeamData.MAX_HEIGHT = Machine.Trave.ZMAX or BeamData.MAX_HEIGHT
end
if Machine.User then
BeamData.OFFSET_DRILL_TENON = Machine.User.L040_OFFSET_P1 or BeamData.OFFSET_DRILL_TENON
if Machine.User.OPTIMIZATIONS_ENABLE_SLICES_F5 == 1 then
BeamData.MAX_LEN_SCRAP = Machine.User.OPTIMIZATIONS_LENGTH_SLICES or BeamData.MAX_LEN_SCRAP
else
BeamData.MAX_LEN_SCRAP = 100000
end
if Machine.User.OPTIMIZATIONS_ENABLE_SLICES_F6 == 1 then
BeamData.MAX_LEN_SCRAP_START = Machine.User.OPTIMIZATIONS_LENGTH_SLICES or BeamData.MAX_LEN_SCRAP_START
else
BeamData.MAX_LEN_SCRAP_START = 100000
end
BeamData.USER_HOLE_DIAM = Machine.User.L020_DIAM_HOLE or BeamData.USER_HOLE_DIAM
BeamData.ENABLE_TOOL_BETWEEN_VICES = ( Machine.User.ENABLE_TOOL_BETWEEN_VICES == 1) or BeamData.ENABLE_TOOL_BETWEEN_VICES
end
end
end
---------------------------------------------------------------------
local function GetMaxLenRidgeLapFromBottom( dHRaw)
if dHRaw < BeamData.MIN_DIM_HBEAM then
return BeamData.MAX_LEN_RIDGELAP_FROM_BOTTOM + 0.01
else
return BeamData.MAX_LEN_RIDGELAP_FROM_BOTTOM_HBEAM + 0.01
end
end
BeamData.GetMaxLenRidgeLapFromBottom = GetMaxLenRidgeLapFromBottom
---------------------------------------------------------------------
local function GetBlockedAxis( sHead, nToolType, sBlockedAxis)
-- lama
if nToolType == MCH_TY.SAW_STD or nToolType == MCH_TY.SAW_FLAT then
return ''
-- sega a catena
elseif nToolType == MCH_TY.MORTISE_STD then
if sHead == 'H3' then
if sBlockedAxis == 'parallel' then
return 'A=0'
elseif sBlockedAxis == 'perpendicular' then
return 'A=90'
end
else
return ''
end
-- fresa
elseif nToolType == MCH_TY.MILL_STD or nToolType == MCH_TY.MILL_NOTIP then
return ''
-- punta
elseif nToolType == MCH_TY.DRILL_STD or nToolType == MCH_TY.DRILL_LONG then
return ''
else
return ''
end
end
BeamData.GetBlockedAxis = GetBlockedAxis
---------------------------------------------------------------------
local function GetChainSawInitAngs( vtN, vtO, nInd)
if nInd == 1 then
return ''
else
return EgtIf( vtN:getY() > 0, 'C=180', 'C=-180')
end
end
BeamData.GetChainSawInitAngs = GetChainSawInitAngs
---------------------------------------------------------------------
local function GetSCC( vtToolDirection, vtEdgeDirection, vtNFace)
local nSCC = MCH_SCC.NONE
if abs( vtToolDirection:getX()) > abs( vtToolDirection:getY()) - GEO.EPS_SMALL then
-- se il taglio è orizzontale, si gira aggregato lama per facilitare caduta del legno
if abs( vtEdgeDirection:getZ()) < 10 * GEO.EPS_SMALL and not AreSameOrOppositeVectorApprox( vtNFace, Z_AX()) then
nSCC = EgtIf( ( vtToolDirection:getX() > -GEO.EPS_SMALL), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
else
nSCC = EgtIf( ( vtToolDirection:getX() > -GEO.EPS_SMALL), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
end
else
-- se il taglio è orizzontale, si gira aggregato lama per facilitare caduta del legno
if abs( vtEdgeDirection:getZ()) < 10 * GEO.EPS_SMALL and not AreSameOrOppositeVectorApprox( vtNFace, Z_AX()) then
nSCC = EgtIf( ( vtToolDirection:getY() > -GEO.EPS_SMALL), MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)
else
nSCC = EgtIf( ( vtToolDirection:getY() > -GEO.EPS_SMALL), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
end
end
return nSCC
end
---------------------------------------------------------------------
-- sAxis può essere AB, C, Z; restituisce direzioni, profondità di estrusione e punti per il controllo precollisione
local function GetPreCollisionData( sAxis, vtC, vtHead)
local PreCollisionData = {}
-- Pivot uguale per tutti; non c'è aggregato quindi non dipende da SCC
-- riferimento vtPivot
-- - vtHead (Z): asse rotazione utensile, guarda il mandrino
-- - vtToolSCC (X): direzione asse C o aggregato
-- - vtEdge (Y): direzione lato, verso in base a X e Z
-- - punto di applicazione: naso mandrino o aggregato
PreCollisionData.vtMovePivot = Vector3d( 0, 0, 242.55)
-- carro Z
if sAxis == 'Z' then
PreCollisionData.Directions = { vtDirectionX = X_AX(), vtDirectionY = Z_AX(), vtDirectionZ = -Y_AX()}
PreCollisionData.bSurfTmByRevolve = true
PreCollisionData.Points = {
Point3d( 0, 523, 0),
Point3d( 109.556, 523, 0),
Point3d( 109.556, 583, 0),
Point3d( 143.113, 583, 0),
Point3d( 143.113, 2533, 0),
Point3d( 0, 2533, 0)
}
-- motore (asse A o B)
elseif sAxis == 'AB' then
PreCollisionData.Directions = { vtDirectionX = vtC, vtDirectionY = -vtHead, vtDirectionZ = vtC ^ -vtHead}
PreCollisionData.dExtrusionDepth = 180
PreCollisionData.Points = {
Point3d( 100,-122,0),
Point3d( 100, -232.5, 0),
Point3d( -90, -232.5, 0),
Point3d( -90, 204.505, 0),
Point3d( -77.5, 216.55, 0),
Point3d( -89, 234.05, 0),
Point3d( -89, 242.55, 0),
Point3d( 89, 242.55, 0),
Point3d( 89, 234.05, 0),
Point3d( 77.5, 216.55, 0),
Point3d( 90, 204.505, 0),
Point3d( 90, 93, 0),
Point3d( 125, 93, 0),
Point3d( 125, -122, 0),
Point3d( 100, -122, 0)
}
-- asse C
elseif sAxis == 'C' then
PreCollisionData.Directions = { vtDirectionX = vtC, vtDirectionY = Z_AX(), vtDirectionZ = vtC ^ Z_AX()}
PreCollisionData.dExtrusionDepth = 200
PreCollisionData.Points = {
Point3d( 125, -92.752, 0),
Point3d( 203.5, -92.752, 0),
Point3d( 203.5, -100, 0),
Point3d( 400, -100, 0),
Point3d( 450, -50, 0),
Point3d( 450, 400, 0),
Point3d( 360, 490, 0),
Point3d( 170, 490, 0),
Point3d( 170, 523, 0),
Point3d( EgtIf( BeamData.NEWTOPC, -110, -175), 523, 0),
Point3d( EgtIf( BeamData.NEWTOPC, -110, -175), 400, 0),
Point3d( 230.858, 400, 0),
Point3d( 325, 305.858, 0),
Point3d( 325, 146, 0),
Point3d( 203.5, 146, 0),
Point3d( 203.5, 93, 0),
Point3d( 125, 93, 0),
Point3d( 125, -92.752, 0)
}
end
return PreCollisionData
end
---------------------------------------------------------------------
local function GetSetupInfo( sHead)
local SetupInfo = {}
-- dati comuni
SetupInfo.bIsCSymmetrical = false
SetupInfo.dCAxisEncumbrance = 180
SetupInfo.dCAxisSideEncumbrance = 200
SetupInfo.dPivot = 175 -- per uscita fresa, diverso da uscita lama
SetupInfo.bToolOnAggregate = false
SetupInfo.vtRotationAxisC = Z_AX()
SetupInfo.vtRotationAxisAB = X_AX()
-- testa 5 assi da sopra
if sHead == 'H1' then
SetupInfo.HeadType = { bTop = true, bBottom = false}
SetupInfo.PreferredSide = {}
SetupInfo.GetMinNz = function() return sin( -45) end
-- lama su testa 5 assi da sopra
elseif sHead == 'H2' then
SetupInfo.HeadType = { bTop = true, bBottom = false}
SetupInfo.PreferredSide = {}
SetupInfo.GetMinNz = function() return sin( -45) end
SetupInfo.GetPreCollisionData = GetPreCollisionData
SetupInfo.GetSCC = GetSCC
-- motosega
elseif sHead == 'H3' then
SetupInfo.HeadType = { bTop = true, bBottom = false}
SetupInfo.PreferredSide = {}
SetupInfo.GetMinNz = function() return 0 end
-- rinvio angolare 90° (considerato come fosse una testa da sotto)
elseif sHead == 'H5' then
SetupInfo.bToolOnAggregate = true
SetupInfo.HeadType = { bTop = false, bBottom = true}
SetupInfo.PreferredSide = {}
SetupInfo.GetMaxNz = function() return 0 end
end
return SetupInfo
end
BeamData.GetSetupInfo = GetSetupInfo
---------------------------------------------------------------------
local function GetMaxMatReductionBladeCut( sHead, vtDir)
local MaxMatReductionBladeCut = 0
-- la lama è montata solo su H2, non si controllano altre teste
if sHead == 'H2' then
if BeamData.NEWTOPC == nil or BeamData.NEWTOPC then
MaxMatReductionBladeCut = -65
end
if AreSameVectorApprox( vtDir, X_AX()) then
MaxMatReductionBladeCut = MaxMatReductionBladeCut + 175
elseif AreSameVectorApprox( vtDir, -X_AX()) then
MaxMatReductionBladeCut = MaxMatReductionBladeCut + 175
elseif AreSameVectorApprox( vtDir, Y_AX()) then
MaxMatReductionBladeCut = MaxMatReductionBladeCut + 175
elseif AreSameVectorApprox( vtDir, -Y_AX()) then
MaxMatReductionBladeCut = MaxMatReductionBladeCut + 175
elseif AreSameVectorApprox( vtDir, Z_AX()) then
MaxMatReductionBladeCut = 80
elseif AreSameVectorApprox( vtDir, -Z_AX()) then
MaxMatReductionBladeCut = 80
end
MaxMatReductionBladeCut = MaxMatReductionBladeCut + BeamData.COLL_SIC
end
return MaxMatReductionBladeCut + BeamData.COLL_SIC
end
BeamData.GetMaxMatReductionBladeCut = GetMaxMatReductionBladeCut
---------------------------------------------------------------------
return BeamData