From 51d8cb33f44027955cef62261dc48d82b8157087 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Thu, 21 May 2020 08:32:43 +0000 Subject: [PATCH] DataBeam : - aggiunta gestione spostamento opzionale fori su tenoni (BeamData.OFFSET_DRILL_TENON). --- LuaLibs/BeamExec.lua | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index f5e60b3..43a868c 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -827,6 +827,41 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, b3 return bOk, sErr, bNewPhase end +------------------------------------------------------------------------------------------------------------- +local function MoveDrillsOnTenon( vProc) + -- se non richiesto spostamento fori su tenone, esco + if abs( BD.OFFSET_DRILL_TENON) < 0.1 then return end + -- ciclo sulle feature + for i = 1, #vProc do + if Tenon.Identify( vProc[i]) then + for j = 1, #vProc do + if Drill.Identify( vProc[j]) then + -- se esiste intersezione tra tenone e foro + if vProc[i].Box:getMin():getX() < vProc[j].Box:getMax():getX() + 100 * GEO.EPS_SMALL and + vProc[j].Box:getMin():getX() < vProc[i].Box:getMax():getX() + 100 * GEO.EPS_SMALL then + -- verifico se foro giĆ  spostato + if not EgtExistsInfo( vProc[j].Id, 'MOV') then + -- recupero curva ausiliaria del foro + local AuxDriId = EgtGetInfo( vProc[j].Id, 'AUXID', 'i') + AuxDriId = EgtIf( AuxDriId, AuxDriId + vProc[j].Id, nil) + -- recupero versore normale del tenone + local AuxTenId = EgtGetInfo( vProc[i].Id, 'AUXID', 'i') + AuxTenId = EgtIf( AuxTenId, AuxTenId + vProc[i].Id, GDB_ID.NULL) + local vtExtr = EgtCurveExtrusion( AuxTenId, GDB_RT.GLOB) + -- se tutto ok, eseguo spostamento + if AuxDriId and vtExtr then + local vtMove = -vtExtr * BD.OFFSET_DRILL_TENON + EgtMove( AuxDriId, vtMove, GDB_RT.GLOB) + EgtSetInfo( vProc[j].Id, 'MOV', vtMove) + end + end + end + end + end + end + end +end + ------------------------------------------------------------------------------------------------------------- function BeamExec.ProcessFeatures() -- verifica se possibile rotazione di 90 gradi @@ -867,6 +902,8 @@ function BeamExec.ProcessFeatures() if EgtGetDebugLevel() >= 1 then PrintFeatures( vProc, b3Raw) end + -- eventuale spostamento fori sui tenoni + MoveDrillsOnTenon( vProc) -- se richiesto ribaltamento (oppure rotazione) if bSomeDown or bSomeSide then -- ribalto le travi della fase corrente