From fd070db4d03291cfc01b75739a6260cc5d5f1a73 Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Mon, 14 Jul 2025 10:26:09 +0200 Subject: [PATCH] Corretto inversione pezzo --- LuaLibs/BeamExec.lua | 2 -- LuaLibs/BeamLib.lua | 18 +++++++++++++----- Process.lua | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 1688fa9..dd2fbd4 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -1482,8 +1482,6 @@ function BeamExec.ProcessMachinings( PARTS) local nTotErr = 0 local Stats = {} local nOrd = 1 - local ProcessCompleted = false - local nMaxLoops = 5 -- TODO da rimuovere o lasciare solo per debug --if EgtGetDebugLevel() >= 3 then diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index 3aa2905..4072af2 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -189,12 +189,20 @@ function BeamLib.InvertRawPart( Part, nNumberOfRotations) if nNumberOfRotations == 0 then return end - - --TODO è giusto ruotare il pezzo all'interno del grezzo, ma sembra non funzionare correttamente. Appena sistemato, cambiare richiamo funzione con questa commentata - --EgtRotatePartInRawPart( Part.id, Z_AX(), nNumberOfRotations * 90) - EgtRotateRawPart( Part.idRaw, Z_AX(), nNumberOfRotations * 90) - + -- box del solido + local b3BoxPart = EgtGetBBoxGlob( EgtGetFirstNameInGroup( Part.id or GDB_ID.NULL, 'Box') or GDB_ID.NULL, GDB_BB.EXACT) + -- box esatto del pezzo + local b3BoxExact = EgtGetBBoxGlob( Part.id or GDB_ID.NULL, GDB_BB.EXACT) + -- rotazione + local dAngRot = nNumberOfRotations * 90 + EgtRotatePartInRawPart( Part.id, Z_AX(), dAngRot) + -- correggo per eccentricità solido rispetto a geometria complessiva del pezzo + local vtEccOri = b3BoxPart:getCenter() - b3BoxExact:getCenter() + local vtEccRot = Vector3d( vtEccOri) + vtEccRot:rotate( Z_AX(), dAngRot) + EgtMovePartInRawPart( Part.id, ( vtEccOri - vtEccRot)) end + ------------------------------------------------------------------------------------------------------------- --- funzione che ruota il grezzo function BeamLib.RotateRawPart( Part, nNumberOfRotations) diff --git a/Process.lua b/Process.lua index f13ecb2..79fad63 100644 --- a/Process.lua +++ b/Process.lua @@ -7,7 +7,7 @@ -- Intestazioni require( 'EgtBase') _ENV = EgtProtectGlobal() -EgtEnableDebug( false) +EgtEnableDebug( true) -- Imposto direttorio libreria specializzata per Travi EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua')