Files
databeamnew/Strategies/Core/FACEBYBLADE.lua
T
andrea.villa 54c86774b7 - Corretta creazione barra in caso di più pezzi
- Libreria specifica per Log
- Nuovo log feature con tutte le strategie disponibili
- Nel log della matrice rotazioni si indica se la strategia scelta è completa (C), parziale (P) o non applicabile (N)
2024-11-20 14:28:20 +01:00

116 lines
4.1 KiB
Lua

-- Strategia: FACEBYBLADE
-- Descrizione
-- Strategia di base per la lavorazione di una faccia con lama
-- Feature: tutte
-- carico librerie
local BeamLib = require( 'BeamLib')
local BeamData = require( 'BeamData')
local MachiningLib = require( 'MachiningLib')
-- Tabella per definizione modulo
local FACEBYBLADE = {}
-------------------------------------------------------------------------------------------------------------
local function CalculateLeadInOut( EdgeToMachine)
local LeadIn = {}
local LeadOut = {}
LeadIn.dStartAddLength = 0
LeadOut.dEndAddLength = 0
LeadIn.nType = MCH_MILL_LI.LINEAR
LeadOut.nType = MCH_MILL_LI.LINEAR
LeadIn.dTangentDistance = 0
LeadOut.dTangentDistance = 0
if EdgeToMachine.Elev > -10 * GEO.EPS_SMALL then
LeadIn.dPerpDistance = EdgeToMachine.dElevation + BeamData.CUT_SIC
LeadOut.dPerpDistance = EdgeToMachine.dElevation + BeamData.CUT_SIC
else
LeadIn.dPerpDistance = BeamData.CUT_SIC
LeadOut.dPerpDistance = BeamData.CUT_SIC
end
LeadIn.dElevation = 0
LeadOut.dElevation = 0
LeadIn.dCompLength = 0
LeadOut.dCompLength = 0
LeadIn.dStartAddLength = BeamData.CUT_EXTRA
LeadOut.dEndAddLength = BeamData.CUT_EXTRA
return LeadIn, LeadOut
end
-------------------------------------------------------------------------------------------------------------
-- TODO da sistemare
local function GetSCC( vtMachiningDirection)
local nSCC = MCH_SCC.NONE
if vtMachiningDirection:getZ() < -0.9 then
nSCC = MCH_SCC.ADIR_ZM
elseif vtMachiningDirection:getZ() > 0.9 then
nSCC = MCH_SCC.ADIR_ZP
elseif vtMachiningDirection:getY() < -0.707 then
nSCC = MCH_SCC.ADIR_YM
elseif vtMachiningDirection:getY() > 0.707 then
nSCC = MCH_SCC.ADIR_YP
elseif vtMachiningDirection:getX() < -0.707 then
nSCC = MCH_SCC.ADIR_XM
elseif vtMachiningDirection:getX() > 0.707 then
nSCC = MCH_SCC.ADIR_XP
end
return nSCC
end
-------------------------------------------------------------------------------------------------------------
-- TODO da sistemare
function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalParameters)
local Cutting = {}
local vtMachiningDirection = EdgeToMachine.Norm
local vtN = Proc.Faces[FaceToMachine+1].vtN
Cutting.sDepth = OptionalParameters.sDepth
Cutting.nType = MCH_MY.MILLING
Cutting.nToolIndex = OptionalParameters.nToolIndex
Cutting.Geometry = {{ Proc.id, FaceToMachine}}
Cutting.id = Proc.id
-- ===== calcolo LeadIn/out =====
if OptionalParameters.LeadIn and OptionalParameters.LeadOut then
Cutting.LeadIn, Cutting.LeadOut = OptionalParameters.LeadIn, OptionalParameters.LeadOut
else
Cutting.LeadIn, Cutting.LeadOut = CalculateLeadInOut( EdgeToMachine)
end
-- ===== scelta soluzione braccio C del motore =====
Cutting.nSCC = GetSCC( vtMachiningDirection)
-- ===== parametri da settare in UserNotes =====
Cutting.nFaceuse = OptionalParameters.nFaceuse
Cutting.sUserNotes = EgtSetValInNotes( Cutting.sUserNotes, 'VtFaceUse', vtMachiningDirection)
if OptionalParameters.sUserNotes then
Cutting.sUserNotes = Cutting.sUserNotes .. OptionalParameters.sUserNotes
end
-- ===== scelta senso di lavorazione =====
local bIsSawCCW = TOOLS[Cutting.nToolIndex].bIsCCW
local bInvert
-- se la lama ruota in senso antiorario inverto la direzione di lavorazione, per avere rotazione lama opposta a avanzamento
if bInvert == nil then
bInvert = ( not bIsSawCCW)
if bIsSawCCW then
bInvert = (( Cutting.nFaceuse == MCH_MILL_FU.ORTHO_FRONT and vtN:getX() < 0) or ( Cutting.nFaceuse == MCH_MILL_FU.ORTHO_BACK and vtN:getX() > 0))
else
bInvert = (( Cutting.nFaceuse == MCH_MILL_FU.ORTHO_FRONT and vtN:getX() > 0) or ( Cutting.nFaceuse == MCH_MILL_FU.ORTHO_BACK and vtN:getX() < 0))
end
end
Cutting.bInvert = bInvert
Cutting.nWorkside = EgtIf( bInvert, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)
return Cutting
end
-------------------------------------------------------------------------------------------------------------
return FACEBYBLADE