cff250ca37
- Prima versione funzionante tagli PRECUT
119 lines
4.2 KiB
Lua
119 lines
4.2 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
|
|
-- elevazione sempre in negativo
|
|
if EdgeToMachine.Elev < 10 * GEO.EPS_SMALL then
|
|
LeadIn.dPerpDistance = BeamData.CUT_SIC - EdgeToMachine.Elev
|
|
LeadOut.dPerpDistance = BeamData.CUT_SIC - EdgeToMachine.Elev
|
|
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 or 0
|
|
Cutting.dLongitudinalOffset = OptionalParameters.dLongitudinalOffset or 0
|
|
Cutting.dRadialOffset = OptionalParameters.dRadialOffset or 0
|
|
|
|
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 |