- in BLADETOWASTE e FACEBYBLADE implementato taglio ridotto e a ghigliottina, solo per facce rettangolari

- in FaceData introdotta funzione IsFaceRectangular
- in STR0005 aggiunto il parametro bReduceBladePath (gestito in BLADETOWASTE)
This commit is contained in:
luca.mazzoleni
2025-07-04 16:20:45 +02:00
parent c7b3668418
commit 4a9db5d986
6 changed files with 137 additions and 11 deletions
+72 -8
View File
@@ -6,6 +6,7 @@
local BeamLib = require( 'BeamLib')
local BeamData = require( 'BeamData')
local MachiningLib = require( 'MachiningLib')
local FaceData = require( 'FaceData')
-- Tabella per definizione modulo
local FACEBYBLADE = {}
@@ -60,8 +61,16 @@ end
local function CalculateLeadInOut( Machining, EdgeToMachine, bIsSplitFeature)
-- TODO implementare le funzioni di Tool Collision Avoidance (vedi wiki e FacesBysaw -> CalcLeadInOutPerpGeom)
-- si determina l'eventuale riduzione da applicare in caso di inizio o fine chiusi
local dAddLengthToReduce = sqrt( Machining.dDepthToMachine * TOOLS[Machining.nToolIndex].dDiameter - Machining.dDepthToMachine * Machining.dDepthToMachine)
-- accorciamento per lati chiusi (è sempre l'impronta utensile)
local dToolMarkLength = sqrt( Machining.dDepthToMachine * TOOLS[Machining.nToolIndex].dDiameter - Machining.dDepthToMachine * Machining.dDepthToMachine)
-- allungamento per faccia singola (aperta in tutte le direzioni)
local dAddedLengthOpenFace = BeamData.CUT_EXTRA
if Machining.sCutType == 'Guillotine' then
local dGuillotineLengthToMachine
dAddedLengthOpenFace = ( - EdgeToMachine.dLength + dGuillotineLengthToMachine) / 2
elseif Machining.sCutType == 'Reduced' then
dAddedLengthOpenFace = - FACEBYBLADE.GetPathReductionLength( Machining.nToolIndex, Machining.dMaxRadialOffset)
end
if Machining.bInvert then
Machining.bIsStartClosed, Machining.bIsEndClosed = Machining.bIsEndClosed, Machining.bIsStartClosed
@@ -113,19 +122,19 @@ local function CalculateLeadInOut( Machining, EdgeToMachine, bIsSplitFeature)
LeadIn.dCompLength = 0
LeadOut.dCompLength = 0
if Machining.bIsStartClosed and Machining.bIsEndClosed then
LeadIn.dStartAddLength = -dAddLengthToReduce
LeadOut.dEndAddLength = -dAddLengthToReduce
LeadIn.dStartAddLength = -dToolMarkLength
LeadOut.dEndAddLength = -dToolMarkLength
elseif Machining.bIsStartClosed then
LeadIn.dStartAddLength = -dAddLengthToReduce
LeadIn.dStartAddLength = -dToolMarkLength
-- eventuale correzione per accorciamento maggiore di larghezza tasca
LeadOut.dEndAddLength = max( -LeadIn.dStartAddLength - EdgeToMachine.dLength + 10 * BeamData.CUT_EXTRA, BeamData.CUT_EXTRA)
elseif Machining.bIsEndClosed then
LeadOut.dEndAddLength = -dAddLengthToReduce
LeadOut.dEndAddLength = -dToolMarkLength
-- eventuale correzione per accorciamento maggiore di larghezza tasca
LeadIn.dStartAddLength = max( -LeadOut.dEndAddLength - EdgeToMachine.dLength + 10 * BeamData.CUT_EXTRA, BeamData.CUT_EXTRA)
else
LeadIn.dStartAddLength = BeamData.CUT_EXTRA
LeadOut.dEndAddLength = BeamData.CUT_EXTRA
LeadIn.dStartAddLength = dAddedLengthOpenFace
LeadOut.dEndAddLength = dAddedLengthOpenFace
end
-- stima lunghezza reale attacchi per calcolo lunghezza lavorata
local dEstimatedLeadInPerpDistance = 0
@@ -175,6 +184,42 @@ local function GetSCC( vtMachiningDirection, vtEdgeDirection, vtNFace)
end
-- dato un certo offset radiale (uscente) e la distanza da mantenere dallo spigolo, calcola di quanto la lama deve arretrare lateralmente rispetto al centro per lavorare il lato
function FACEBYBLADE.GetPathReductionLength( nToolIndex, dRadialOffset, OptionalParameters)
local Tool = TOOLS[nToolIndex]
local dToolRadius = Tool.dDiameter / 2
-- parametri opzionali
if not OptionalParameters then
OptionalParameters = {}
end
local dExtra = OptionalParameters.dExtra or BeamData.CUT_EXTRA
-- calcolo
local dReductionLength = sqrt( ( dToolRadius - dExtra)^2 - ( dToolRadius - dRadialOffset)^2)
return dReductionLength
end
-- data la lunghezza del lato da lavorare e la distanza da mantenere dallo spigolo, calcola di quanto la lama deve andare oltre per lavorare il lato
function FACEBYBLADE.GetRadialOffsetForGuillotine( nToolIndex, dEdgeLength, OptionalParameters)
local Tool = TOOLS[nToolIndex]
local dToolRadius = Tool.dDiameter / 2
-- parametri opzionali
if not OptionalParameters then
OptionalParameters = {}
end
local dExtra = OptionalParameters.dExtra or BeamData.CUT_EXTRA
-- calcolo
local dRadialOffset = sqrt( ( dToolRadius - dExtra)^2 - ( dEdgeLength / 2)^2)
return dRadialOffset
end
-- TODO EdgeToMachineAlternative da gestire
-- TODO invert avanzato (direzione, Z, alternativa, ...) da gestire
-- TODO bilinea da gestire
@@ -200,6 +245,7 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
local dDepthToMachine = OptionalParameters.dDepthToMachine or EdgeToMachine.dElevation
local bIsSplitFeature = OptionalParameters.bIsSplitFeature or false
local bOppositeToolDirection = OptionalParameters.bOppositeToolDirection or false
local bReduceBladePath = OptionalParameters.bReduceBladePath or false
local sDepth = OptionalParameters.sDepth or 0
local nToolIndex = OptionalParameters.nToolIndex
local dLongitudinalOffset = OptionalParameters.dLongitudinalOffset or 0
@@ -325,6 +371,24 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
else
Cutting.dDepthToMachine = dDepthToMachine
Cutting.dResidualDepth = 0
Cutting.sCutType = 'Standard'
if bReduceBladePath
and ( Proc.nFct == 1)
and FaceData.IsFaceRectangular( Proc, FaceToMachine.id) then
local bIsTopBlade = TOOLS[nToolIndex].SetupInfo.HeadType.bTop
Cutting.dMaxRadialOffset = TOOLS[nToolIndex].dMaxMaterial - EdgeToMachine.dElevation - BeamData.CUT_SIC
Cutting.dRadialOffsetGuillotine = FACEBYBLADE.GetRadialOffsetForGuillotine( nToolIndex, EdgeToMachine.dLength)
-- taglio a ghigliottina
if bIsTopBlade and ( Cutting.dRadialOffsetGuillotine > 10 * GEO.EPS_SMALL) then
dDepthToMachine = EdgeToMachine.dElevation + Cutting.dRadialOffsetGuillotine
Cutting.sCutType = 'Guillotine'
-- taglio ridotto
elseif Cutting.dMaxRadialOffset > 10 * GEO.EPS_SMALL then
dDepthToMachine = EdgeToMachine.dElevation + Cutting.dMaxRadialOffset
Cutting.sCutType = 'Reduced'
end
end
if bOppositeToolDirection then
Cutting.dRadialOffset = -dDepthToMachine
else