-- BeamData.lua by Egalware s.r.l. 2025/12/03 -- Raccolta dati generali per Travi EgtOutLog( ' FAST-BeamData started', 1) -- Tabella per definizione modulo local BeamData = { RIGHT_LOAD = false, -- flag carico da destra ROT90 = false, -- flag abilitazione rotazione 90 gradi ROT180 = true, -- flag abilitazione rotazione 180 gradi 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, -- RENAME lunghezza massima pezzo corto LEN_VERY_SHORT_PART = 400, -- RENAME 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_DIM_HTCUT = 200, -- SOLO DICE larghezza massima taglio di testa o coda MIN_DIM_HBEAM = 380, -- SOLO DICE altezza minima di trave alta MAX_DIM_DICE = 155, -- dimensione trasversale massima cubetto MAX_LEN_DICE = 400, -- SOLO DICE 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 MILL_OVERLAP = 5, -- sovrapposizione tra due mezze fresature LONGCUT_ENDLEN = 600, -- RENAME??lunghezza lavoro estremi iniziale e finale (std=600) LONGCUT_MAXLEN = 1200, -- RENAME??lunghezza massima sezione di taglio longitudinale 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 USER_HOLE_DIAM = 0, -- diametro foro per L20 STRATEGIES_SCRIPT = 'Essetre', STRATEGIES_CONFIG_FILE = 'Std1.json' } -- costanti riportate da mlde non necessarie per automatismo (sostituire con GetParameters o simile) local MldeParameters = {} MldeParameters.NumericalControl = 'TPA' -- NUM o TPA o NUM_PLUS MldeParameters.MinX = 0 MldeParameters.MaxX = 1350 MldeParameters.MinZ = -1350 MldeParameters.MaxZ = 0 MldeParameters.MillOffs = 177.35 MldeParameters.SawOffs = -242.68 MldeParameters.DeltaTabY = 898.0 MldeParameters.DeltaTabZ = -1017.8 + MldeParameters.MillOffs -- per TPA : -1013.3 + MillOffs -- per NUM : -838.4 MldeParameters.NewTopC = true -- Aggiornamento con dati macchina personalizzati -- TODO sostituire con GetParameters o simile 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 if Machine.Offsets.TIPO_CN == 0 then MldeParameters.NumericalControl = 'NUM' elseif Machine.Offsets.TIPO_CN == 2 then MldeParameters.NumericalControl = 'NUM_PLUS' else MldeParameters.NumericalControl = 'TPA' end if Machine.Offsets.MAX_X then MldeParameters.MinX = - Machine.Offsets.MAX_X end if Machine.Offsets.MIN_X then MldeParameters.MaxX = - Machine.Offsets.MIN_X end if Machine.Offsets.MIN_Z then MldeParameters.MinZ = Machine.Offsets.MIN_Z end if Machine.Offsets.MAX_Z then MldeParameters.MaxZ = Machine.Offsets.MAX_Z end if Machine.Offsets.PIVOTFRESA then MldeParameters.MillOffs = - Machine.Offsets.PIVOTFRESA end if Machine.Offsets.PIVOTLAMA then MldeParameters.SawOffs = - Machine.Offsets.PIVOTLAMA end if Machine.Offsets.OFFSETX then MldeParameters.DeltaTabY = - Machine.Offsets.OFFSETX end if Machine.Offsets.OFFSETZ then MldeParameters.DeltaTabZ = Machine.Offsets.OFFSETZ + EgtIf( MldeParameters.NumericalControl == 'TPA', MldeParameters.MillOffs, 0) end if Machine.Offsets.NEWTOPC then MldeParameters.NewTopC = ( Machine.Offsets.NEWTOPC == 1) end 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.LONGCUT_ENDLEN = Machine.Offsets.LONGCUT_ENDLEN or BeamData.LONGCUT_ENDLEN BeamData.LONGCUT_MAXLEN = Machine.Offsets.LONGCUT_MAXLEN or BeamData.LONGCUT_MAXLEN 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_HEIGHT2 = Machine.Offsets.MAX_HEIGHT2 or BeamData.MAX_HEIGHT2 BeamData.OVM_MID = Machine.Offsets.OVM_MID or BeamData.OVM_MID 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 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.USER_HOLE_DIAM = Machine.User.L020_DIAM_HOLE or BeamData.USER_HOLE_DIAM end end end --------------------------------------------------------------------- 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, -MldeParameters.SawOffs) -- 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( MldeParameters.NewTopC, -110, -175), 523, 0), Point3d( EgtIf( MldeParameters.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.bToolOnAggregate = false SetupInfo.vtRotationAxisC = EgtGetAxisDir( 'C') SetupInfo.vtRotationAxisAB = EgtGetAxisDir( 'B') -- testa 5 assi da sopra if sHead == 'H1' then SetupInfo.HeadType = { bTop = true, bBottom = false} SetupInfo.PreferredSide = {} SetupInfo.dPivot = MldeParameters.MillOffs -- per uscita fresa, diverso da uscita lama 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 --------------------------------------------------------------------- return BeamData