From c26ba36f6db5f879eef608bbc8f259f946f249bd Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Tue, 2 Dec 2025 13:10:41 +0100 Subject: [PATCH] - in BeamData modificata GetCollisionData per nuovo automatismo --- Beam/BeamData.lua | 217 +++++++++++++++------------------------------- Version.lua | 2 +- 2 files changed, 73 insertions(+), 146 deletions(-) diff --git a/Beam/BeamData.lua b/Beam/BeamData.lua index 82a0b47..fc15159 100644 --- a/Beam/BeamData.lua +++ b/Beam/BeamData.lua @@ -76,6 +76,7 @@ local BeamData = { 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' } @@ -118,6 +119,7 @@ if EgtExistsFile( sData) then 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 @@ -191,181 +193,104 @@ end BeamData.GetChainSawInitAngs = GetChainSawInitAngs --------------------------------------------------------------------- -local function GetMinNzTopHead( vtNFace) - return sin( -45) -end +local function GetSCC( vtToolDirection, vtEdgeDirection, vtNFace) + local nSCC = MCH_SCC.NONE ---------------------------------------------------------------------- -local function GetMinNzDownUp( b3Raw, vtNFace, vtToolDirection) - if vtToolDirection and vtToolDirection:getZ() > 0.35 then - -- N_HorAng < 15° or N_HorAng > 55° - if vtNFace and ( abs( vtNFace:getY()) < 0.259 or abs( vtNFace:getY()) > 0.819) then - return -0.708 - -- N_HorAng > 50° - elseif vtNFace and abs( vtNFace:getY()) > 0.766 then - return -0.383 + 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 - return EgtIf( b3Raw:getDimZ() < BeamData.MIN_DIM_HBEAM, -0.609, -0.383) + nSCC = EgtIf( ( vtToolDirection:getX() > -GEO.EPS_SMALL), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM) end - elseif vtToolDirection and vtToolDirection:getZ() < - 0.01 - and ( vtNFace and ( abs( vtNFace:getY()) > 0.983)) - and ( b3Raw:getDimY() < 210) then - - return -0.173 - elseif vtToolDirection and abs( vtToolDirection:getX()) > 0.708 and abs( vtNFace:getX()) < 0.708 then - return -1 else - -- N_HorAng > 60° - if vtNFace and ( abs( vtNFace:getY()) > 0.866) then - return -0.708 + -- 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 - if b3Raw:getDimZ() < 120 then - return -0.708 - elseif b3Raw:getDimZ() < 200 then - -- N_HorAng < 15° or N_HorAng > 55° - if vtNFace and ( abs( vtNFace:getY()) < 0.259 or abs( vtNFace:getY()) > 0.819) then - return -0.5 - else - return -0.383 - end - elseif b3Raw:getDimZ() < 300 then - -- N_HorAng < 10° - if vtNFace and ( abs( vtNFace:getY()) < 0.174) then - return -0.5 - else - return -0.259 - end - elseif b3Raw:getDimZ() < BeamData.MIN_DIM_HBEAM then - -- N_HorAng < 10° - if vtNFace and ( abs( vtNFace:getY()) < 0.174) then - return -0.342 - else - return -0.259 - end - else - -- N_HorAng < 10° - if vtNFace and ( abs( vtNFace:getY()) < 0.174) then - return -0.383 - else - return -0.188 - end - end + 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 e punti per il controllo precollisione -local function GetPreCollisionData( sAxis, vtSCC, vtHead) +-- 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 = { {}, {}, {}} + local PreCollisionData = {} -- Pivot uguale per tutti; non c'è aggregato quindi non dipende da SCC -- riferimento vtPivot -- - vtHead (Z): asse rotazione utensile, guarda il mandrino --- - vtSCC (X): direzione asse C o aggregato (è vtTool con verso in base a SCC) +-- - 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[1].vtMovePivot = Vector3d( 0, 0, 242.55) - PreCollisionData[2].vtMovePivot = Vector3d( 0, 0, 242.55) - PreCollisionData[3].vtMovePivot = Vector3d( 0, 0, 242.55) + PreCollisionData.vtMovePivot = Vector3d( 0, 0, 242.55) -- carro Z if sAxis == 'Z' then - PreCollisionData[1].Directions = { vtDirectionX = X_AX(), vtDirectionY = Z_AX(), vtDirectionZ = -Y_AX()} - PreCollisionData[1].Points = { - Point3d( 115, 518, 0), - Point3d( 115, 578, 0), - Point3d( 149, 578, 0), - Point3d( 149, 2538, 0), - Point3d( -149, 2538, 0), - Point3d( -149, 578, 0), - Point3d( -115, 578, 0), - Point3d( -115, 518, 0), - Point3d( 115, 518, 0) - } - - PreCollisionData[2].Directions = { vtDirectionX = Y_AX(), vtDirectionY = Z_AX(), vtDirectionZ = X_AX()} - PreCollisionData[2].Points = { - Point3d( 113, 518, 0), - Point3d( 113, 578, 0), - Point3d( 120, 578, 0), - Point3d( 120, 2538, 0), - Point3d( -120, 2538, 0), - Point3d( -120, 578, 0), - Point3d( -113, 578, 0), - Point3d( -113, 518, 0), - Point3d( 113, 518, 0) - } - - PreCollisionData[3].Directions = { vtDirectionX = X_AX(), vtDirectionY = Y_AX(), vtDirectionZ = Z_AX()} - PreCollisionData[3].Points = { - Point3d( -73, -127, 518), - Point3d( 73, -127, 518), - Point3d( 134, -22, 518), - Point3d( 149, -22, 518), - Point3d( 149, 22, 518), - Point3d( 134, 22, 518), - Point3d( 73, 127, 518), - Point3d( -73, 127, 518), - Point3d( -134, 22, 518), - Point3d( -149, 22, 518), - Point3d( -149, -22, 518), - Point3d( -134, -22, 518), - Point3d( -73, -127, 518) + 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[1].Directions = { vtDirectionX = vtSCC, vtDirectionY = -vtHead, vtDirectionZ = vtSCC ^ -vtHead} - PreCollisionData[1].Points = { - Point3d( -69, -182, 0), - Point3d( 69, -182, 0), - Point3d( 69, -157, 0), - Point3d( 80, -157, 0), - Point3d( 111, -127, 0), - Point3d( 130, -127, 0), - Point3d( 130, 98, 0), - Point3d( 95, 98, 0), - Point3d( 95, 242.55, 0), - Point3d( -95, 242.55, 0), - Point3d( -95, -143, 0), - Point3d( -80, -157, 0), - Point3d( -69, -157, 0), - Point3d( -69, -182, 0) - } - - PreCollisionData[2].Directions = { vtDirectionX = vtSCC ^ vtHead, vtDirectionY = -vtHead, vtDirectionZ = vtSCC} - PreCollisionData[2].Points = { - Point3d( -95, 242.55, 0), - Point3d( -95, -143, 0), - Point3d( -80, -158, 0), - Point3d( -69, -158, 0), - Point3d( -69, -182, 0), - Point3d( 69, -182, 0), - Point3d( 69, -157, 0), - Point3d( 80, -157, 0), - Point3d( 95, -143, 0), - Point3d( 95, 242.55, 0), - Point3d( -95, 242.55, 0) - } - - PreCollisionData[3].Directions = { vtDirectionX = vtSCC, vtDirectionY = -vtHead ^ vtSCC, vtDirectionZ = -vtHead} - PreCollisionData[3].Points = { - Point3d( 130, 95, 0), - Point3d( -62, 95, 0), - Point3d( -95, 62, 0), - Point3d( -95, -62, 0), - Point3d( -62, -95, 0), - Point3d( 130, -95, 0), - Point3d( 130, 95, 0) + 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 @@ -381,6 +306,8 @@ local function GetSetupInfo( sHead) 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 @@ -392,8 +319,8 @@ local function GetSetupInfo( sHead) SetupInfo.HeadType = { bTop = true, bBottom = false} SetupInfo.PreferredSide = {} SetupInfo.GetMinNz = function() return sin( -45) end - SetupInfo.GetMinNzDownUp = GetMinNzDownUp SetupInfo.GetPreCollisionData = GetPreCollisionData + SetupInfo.GetSCC = GetSCC -- motosega elseif sHead == 'H3' then SetupInfo.HeadType = { bTop = true, bBottom = false} diff --git a/Version.lua b/Version.lua index ecafe4c..e914a70 100644 --- a/Version.lua +++ b/Version.lua @@ -3,7 +3,7 @@ local InfoCommon_STD_PP = { NAME = 'Common_FAST', -- nome script PP standard - VERSION = '2.7k6', -- versione script + VERSION = '2.7l1', -- versione script MIN_MACH_VER_PP_COMMON = '2.5k1' -- versione minima kernel }