1ef1c22337
- in DiceCut le superifici create non hanno un colore specifico (prendono quello dell'AddGroup come le altre) - in TAILCUT corretto box da passare alla cubettatura (ora è il grezzo attuale unito a quello di coda successivo) - in FACEBYBLADE.GetLeadInOutType migliorata scelta attacco
132 lines
5.0 KiB
Lua
132 lines
5.0 KiB
Lua
-- Strategia: TAILCUT
|
|
-- Descrizione
|
|
-- Taglio di separazione
|
|
-- Feature: TailCut
|
|
|
|
-- carico librerie
|
|
local BeamLib = require( 'BeamLib')
|
|
local BeamData = require( 'BeamData')
|
|
local MachiningLib = require( 'MachiningLib')
|
|
local SPLITCUT = require( 'SPLITCUT')
|
|
-- strategie di base
|
|
local BladeToWaste = require('BLADETOWASTE')
|
|
|
|
-- Tabella per definizione modulo
|
|
local TAILCUT = {}
|
|
local Strategy = {}
|
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
local function MakeChamfer()
|
|
-- TODO funzionalità da aggiungere
|
|
end
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
function TAILCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
|
local StrategyLib = {}
|
|
StrategyLib.Config = STRATEGIES_CONFIG[CustomParameters.sStrategyId]
|
|
Strategy.sName = StrategyLib.Config.sStrategyId
|
|
Strategy.Parameters = BeamLib.LoadCustomParametersInStrategy( Proc, CustomParameters, StrategyLib.Config)
|
|
Strategy.SplitStrategy = {}
|
|
Strategy.Result = {}
|
|
Strategy.Machining = {}
|
|
Strategy.Result.sInfo = ''
|
|
local bAreAllMachiningsAdded = true
|
|
|
|
-- separazione solo se esiste grezzo successivo con pezzi o scaricabile
|
|
Strategy.bSplit = not( Part.bIsLastPart) or Part.dRestLength >= BeamData.dMinRaw
|
|
|
|
-- se devo fare split perchè c'è un grezzo da scaricare o un altro pezzo
|
|
if Strategy.bSplit then
|
|
Strategy.SplitStrategy, Strategy.Result = SPLITCUT.GetStrategy( Proc, Part, Strategy.Parameters)
|
|
|
|
-- se devo rimuovere tutto il restante
|
|
else
|
|
-- se abilitato, faccio tagli di PRECUT a zero (come SPLIT)
|
|
if Strategy.Parameters.bExecutePreCut then
|
|
Strategy.SplitStrategy, Strategy.Result = SPLITCUT.GetStrategy( Proc, Part, Strategy.Parameters)
|
|
-- se non faccio tagli PRECUT, imposto tabella Result direttamente. Non serve verificare che riesca a rimuovere il materiale extra
|
|
else
|
|
Strategy.Result.sStatus = 'Completed'
|
|
Strategy.Result.nCompletionIndex = 5
|
|
Strategy.Result.dMRR = 1
|
|
-- TODO di quale utensile si deve impostare la qualità qui?
|
|
Strategy.Result.nQuality = 5
|
|
Strategy.Result.sInfo = 'Split not possible'
|
|
end
|
|
end
|
|
|
|
-- se devo applicare le lavorazioni
|
|
if bAddMachining then
|
|
|
|
-- inserimento smussi su spigoli del taglio
|
|
if Strategy.Parameters.bMakeChamfer then
|
|
MakeChamfer()
|
|
end
|
|
|
|
local MachiningsToAdd = {}
|
|
-- se devo fare split perchè c'è un grezzo da scaricare o un altro pezzo
|
|
if Strategy.bSplit then
|
|
Strategy.dOffset = 0
|
|
MachiningsToAdd = SPLITCUT.Execute( Proc, Part, Strategy)
|
|
-- se devo rimuovere tutto il restante
|
|
else
|
|
local bExecutePrecutOnly = false
|
|
-- se abilitato, faccio tagli di PRECUT a zero (come SPLIT)
|
|
if Strategy.Parameters.bExecutePreCut then
|
|
if Part.dRestLength < 10 then
|
|
bExecutePrecutOnly = true
|
|
Strategy.dOffset = 0
|
|
else
|
|
Strategy.bIsPreCut = true
|
|
Strategy.dOffset = Part.dRestLength
|
|
end
|
|
MachiningsToAdd = SPLITCUT.Execute( Proc, Part, Strategy)
|
|
end
|
|
|
|
if not bExecutePrecutOnly then
|
|
local OptionalParameters = {}
|
|
|
|
-- eventuale grezzo custom per dicing (grezzo attuale + grezzo di coda)
|
|
local nNextRawId = EgtGetNextRawPart( Part.idRaw)
|
|
if nNextRawId then
|
|
local b3BoxDicing = EgtGetRawPartBBox( nNextRawId)
|
|
b3BoxDicing:Add( Part.b3Raw)
|
|
OptionalParameters.b3BoxDicing = b3BoxDicing
|
|
end
|
|
|
|
OptionalParameters.dMaxWasteVolume = Strategy.Parameters.dMaxWasteVolume
|
|
OptionalParameters.dMaxWasteLength = Strategy.Parameters.dMaxWasteLength
|
|
|
|
Strategy.Machining, _ = BladeToWaste.Make( Proc, Part, OptionalParameters)
|
|
if Strategy.Machining and #Strategy.Machining > 0 then
|
|
for i = 1, #Strategy.Machining do
|
|
local TempList = {}
|
|
TempList.Splitting = Strategy.Machining[i]
|
|
if i == #Strategy.Machining then
|
|
TempList.Splitting.sUserNotes = 'Cut;'
|
|
TempList.AuxiliaryData = { bIsSplitOrCut = true}
|
|
else
|
|
TempList.Splitting.sUserNotes = 'Precut;'
|
|
end
|
|
table.insert( MachiningsToAdd, TempList)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- aggiungo lavorazioni trovate alla lista generale
|
|
for i = 1, #MachiningsToAdd do
|
|
MachiningsToAdd[i].Splitting.sStage = 'Tail'
|
|
MachiningLib.AddMachinings( Proc, MachiningsToAdd[i].Splitting, MachiningsToAdd[i].AuxiliaryData)
|
|
end
|
|
|
|
return bAreAllMachiningsAdded, Strategy.Result
|
|
else
|
|
return nil, Strategy.Result
|
|
end
|
|
end
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
|
|
return TAILCUT |