- PROCESSINGS spostata in BeamExec
- aggiunte a STR0005, da completare
This commit is contained in:
@@ -31,6 +31,7 @@ EgtMdbSave()
|
||||
TOOLS = {} -- tabella contenente tutti gli utensili
|
||||
STRATEGIES = nil -- tabella contenente le strategie disponibili per ogni feature
|
||||
MACHININGS = {} -- tabella contenente le lavorazioni da applicare
|
||||
PROCESSINGS = {} -- tabella contenente tutte le informazioni di ogni feature, processate per ogni rotazione
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- *** COSTANTI *** TODO -> DA SPOSTARE IN BEAMDATA???
|
||||
@@ -883,7 +884,7 @@ local function CalculateStrategies( vProcSingleRot, Part)
|
||||
|
||||
Proc.AvailableStrategies[nIndexCurrentStrategy].Result = FeatureLib.CalculateCompositeRating( Proc.AvailableStrategies[nIndexCurrentStrategy].Result)
|
||||
-- se scelta strategia in modalità base o standard, esco subito alla prima che trovo completa
|
||||
-- TODO serve paraemtro da Beam&Wall ( oppure da confirgurazione) !!!!!!!!
|
||||
-- TODO serve parametro da Beam&Wall ( oppure da confirgurazione) !!!!!!!!
|
||||
if BEAM.GetFirstCompletedStrategy and Proc.AvailableStrategies[nIndexCurrentStrategy].Result.sStatus == 'Complete' then
|
||||
break
|
||||
end
|
||||
@@ -1008,7 +1009,7 @@ local function PrintFeatures( vProc, Part)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamExec.GetProcessings( PROCESSINGS, PARTS)
|
||||
function BeamExec.GetProcessings( PARTS)
|
||||
-- recupero tutti i processing di tutti i pezzi in tutte le rotazioni
|
||||
-- TODO calcolo tempi da rimuovere o lasciare solo per debug
|
||||
-- if EgtGetDebugLevel() >= 3 then
|
||||
@@ -1274,7 +1275,7 @@ local function GetBestResultFromCombinationsMatrix( ProcessingsOnPart, PartInfo)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamExec.ProcessMachinings( PROCESSINGS, PARTS)
|
||||
function BeamExec.ProcessMachinings( PARTS)
|
||||
-- ciclo sui pezzi
|
||||
local nTotErr = 0
|
||||
local Stats = {}
|
||||
|
||||
+2
-3
@@ -76,7 +76,6 @@ end
|
||||
|
||||
-- Variabili globali
|
||||
PARTS = {} -- tabella contenente tutte le informazioni di ogni pezzo
|
||||
PROCESSINGS = {} -- tabella contenente tutte le informazioni di ogni feature, processate per ogni rotazione
|
||||
|
||||
-- Carico i dati globali
|
||||
local BeamData = require( 'BeamData')
|
||||
@@ -307,8 +306,8 @@ end
|
||||
-- *** Inserimento delle lavorazioni nelle travi ***
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function MyProcessFeatures()
|
||||
PROCESSINGS = BeamExec.GetProcessings( PROCESSINGS, PARTS)
|
||||
local bOk, Stats = BeamExec.ProcessMachinings( PROCESSINGS, PARTS)
|
||||
BeamExec.GetProcessings( PARTS)
|
||||
local bOk, Stats = BeamExec.ProcessMachinings( PARTS)
|
||||
local nErrCnt = 0
|
||||
local nWarnCnt = 0
|
||||
local sOutput = ''
|
||||
|
||||
@@ -15,10 +15,43 @@ local FaceByBlade = require( 'FACEBYBLADE')
|
||||
-- Tabella per definizione modulo
|
||||
local STR0005 = {}
|
||||
local Strategy = {}
|
||||
local Cutting = {}
|
||||
Cutting.Result = {}
|
||||
local Blade = {}
|
||||
Blade.Result = {}
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function CompareEdges( EdgeA, EdgeB)
|
||||
-- prima i lati orientati lungo X
|
||||
if abs( EdgeA.Norm:getX()) < abs( EdgeB.Norm:getX()) - 10 * GEO.EPS_SMALL then
|
||||
return true
|
||||
elseif abs( EdgeA.Norm:getX()) > abs( EdgeB.Norm:getX()) + 10 * GEO.EPS_SMALL then
|
||||
return false
|
||||
-- se stessa X si preferiscono i lati più in basso
|
||||
else
|
||||
if EdgeA.Norm:getZ() > EdgeB.Norm:getZ() + 10 * GEO.EPS_SMALL then
|
||||
return true
|
||||
elseif EdgeA.Norm:getZ() < EdgeB.Norm:getZ() - 10 * GEO.EPS_SMALL then
|
||||
return false
|
||||
-- se stessa Z si preferiscono i lati verso il fronte della trave
|
||||
else
|
||||
if EdgeA.Norm:getY() > EdgeB.Norm:getY() + 10 * GEO.EPS_SMALL then
|
||||
return true
|
||||
elseif EdgeA.Norm:getY() < EdgeB.Norm:getY() - 10 * GEO.EPS_SMALL then
|
||||
return false
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function Blade.AddResult( Cutting)
|
||||
table.insert( Blade.Result, Cutting)
|
||||
|
||||
return Blade.Result
|
||||
end
|
||||
|
||||
|
||||
function STR0005.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
-- carico parametri da default e li aggiorno con quelli passati dal chiamante (potrebbero non essere congruenti)
|
||||
local StrategyLib = {}
|
||||
@@ -28,33 +61,111 @@ function STR0005.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
Strategy.Parameters = BeamLib.LoadCustomParametersInStrategy( CustomParameters)
|
||||
Strategy.Result = {}
|
||||
Strategy.Result.sInfo = ''
|
||||
Cutting.Result = {}
|
||||
Blade.Result = {}
|
||||
|
||||
local dFeatureMaxNotClampableLengthHead, dFeatureMaxNotClampableLengthTail = FeatureLib.GetFeatureMaxNotClampableLengths( Proc, Part)
|
||||
local bLeaveWasteAttached = Strategy.Parameters.sCuttingStrategy == 'LEAVE_WASTE_ATTACHED'
|
||||
local bFeatureHindersClamping = FeatureLib.IsMachiningLong( max( dFeatureMaxNotClampableLengthHead, dFeatureMaxNotClampableLengthTail), Part, { dMaxSegmentLength = BeamData.LONGCUT_ENDLEN})
|
||||
local Cutting = {}
|
||||
if bFeatureHindersClamping or bLeaveWasteAttached then
|
||||
-- TODO Lavorazione con codolo
|
||||
-- verificare se basta una lavorazione o ne servono due. Servirà cercare l'utensile e stabilire dove lasciare il codolo.
|
||||
-- La FaceByBlade (o altra??) dovrà accettare opzionalmente di fermarsi prima (basta l'Offset??) e accettare l'utensile forzato.
|
||||
-- attenzione perchè se l'inclinazione della faccia la fa finire oltre lo spigolo questo riduce il massimo calcolare (come calcolare????)
|
||||
--Cutting = FaceByBlade.Make( )
|
||||
-- il FindBlade dovrà restituire di utilizzare sempre la lama sopra se l'angolo lo permette, ma avendo un'altezza massima (da macchina) oltre cui il DownUp non sarà fattibile (evita collisioni tra asse e pezzo)
|
||||
--Cutting = FaceByBlade.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalParameters)
|
||||
--Cutting.AddResult( Cutting)
|
||||
|
||||
-- si trovano i lati da lavorare
|
||||
local EdgesSorted = {}
|
||||
for i = 1, #Proc.Faces[1].Edges do
|
||||
table.insert( EdgesSorted, Proc.Faces[1].Edges[i])
|
||||
end
|
||||
table.sort( EdgesSorted, CompareEdges)
|
||||
|
||||
-- se la lavorazione con codolo fallisce o non è possibile si proseguirà a quella con cubetti
|
||||
local dDepthToMachine = EdgesSorted[1].Elevation / 2 + BeamData.CUT_EXTRA
|
||||
|
||||
-- TODO gestione lavorazioni spezzate
|
||||
-- ricerca utensile
|
||||
local ToolSearchParameters = {}
|
||||
ToolSearchParameters.dElevation = dDepthToMachine
|
||||
ToolSearchParameters.vtToolDirection = EdgesSorted[1].Norm
|
||||
ToolSearchParameters.bAllowTopHead = true
|
||||
ToolSearchParameters.bAllowBottomHead = true
|
||||
ToolSearchParameters.bForceLongcutBlade = bForceLongcutBlade
|
||||
local ToolInfo = MachiningLib.FindBlade( Proc, ToolSearchParameters)
|
||||
Cutting.nToolIndex = ToolInfo.nToolIndex
|
||||
Cutting.nType = MCH_OY.MILLING
|
||||
if not TOOLS[Cutting.nToolIndex].sName then
|
||||
Cutting.sMessage = 'Blade not found'
|
||||
Cutting.bIsApplicable = false
|
||||
EgtOutLog( Cutting.sMessage)
|
||||
return Cutting, EdgeToMachine.dElevation
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- si lavora il primo lato
|
||||
local OptionalParameters = { dRadialOffset = 100}
|
||||
Cutting = FaceByBlade.Make( Proc, Part, Proc.Faces[1], EdgesSorted[1], OptionalParameters)
|
||||
Blade.AddResult( Cutting)
|
||||
|
||||
-- lavorazioni raggruppate in unica lista
|
||||
Blade.Result.Sorted = {}
|
||||
for i = 1, #Blade.Result do
|
||||
if Blade.Result[i].bIsApplicable then
|
||||
table.insert( Blade.Result.Sorted, Blade.Result[i])
|
||||
end
|
||||
end
|
||||
|
||||
-- TODO ordinamento lavorazioni (se necessario)
|
||||
|
||||
-- aggiunta eventuali lavorazioni splittate
|
||||
local FeatureSplittingPoints = FeatureLib.GetFeatureSplittingPoints( Proc, Part)
|
||||
if #FeatureSplittingPoints > 0 then
|
||||
Blade.Result.Sorted = MachiningLib.GetSplitMachinings( Blade.Result, FeatureSplittingPoints, Part)
|
||||
end
|
||||
|
||||
-- se la lavorazione con codolo fallisce o non è possibile si proseguirà a quella con cubetti
|
||||
end
|
||||
|
||||
if #Cutting.Result == 0 and not bLeaveWasteAttached then
|
||||
if #Blade.Result == 0 and not bLeaveWasteAttached then
|
||||
-- BladeToWaste
|
||||
end
|
||||
|
||||
-- aggiunta lavorazioni alla lista. Vanno gestiti anche eventuali stepXY?
|
||||
|
||||
-- output risultati
|
||||
-- aggiunta lavorazioni
|
||||
local nIsApplicableCount = 0
|
||||
local dFinalCompletionPercentage = 100
|
||||
local bAreAllMachiningsAdded = true
|
||||
for i = 1, #Blade.Result.Sorted do
|
||||
if Blade.Result.Sorted[i].bIsApplicable then
|
||||
nIsApplicableCount = nIsApplicableCount + 1
|
||||
if bAddMachining then
|
||||
local bIsMachiningAdded = Blade.AddMachiningAllSteps( Proc, Blade.Result.Sorted[i])
|
||||
if not bIsMachiningAdded then
|
||||
bAreAllMachiningsAdded = false
|
||||
end
|
||||
end
|
||||
Strategy.Result.sInfo = Strategy.Result.sInfo .. '\n' .. Blade.Result.Sorted[i].sMessage
|
||||
end
|
||||
end
|
||||
if nIsApplicableCount > 0 then
|
||||
if Cutting.dCompletionPercentage > 100 - 10 * GEO.EPS_SMALL then
|
||||
Strategy.Result.sStatus = 'Completed'
|
||||
else
|
||||
Strategy.Result.sStatus = 'Not-Completed'
|
||||
-- TODO al momento si assume che la percentuale di completamento dell'ultima lavorazione sia quella rilevante
|
||||
dFinalCompletionPercentage = Cutting.dCompletionPercentage
|
||||
end
|
||||
else
|
||||
Strategy.Result.sStatus = 'Not-Applicable'
|
||||
end
|
||||
Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( dFinalCompletionPercentage)
|
||||
Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( 'Blade')
|
||||
local MRRParametersBlade = {
|
||||
dStep = min( TOOLS[Cutting.nToolIndex].dStep, Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1].dLength),
|
||||
dSideStep = TOOLS[Cutting.nToolIndex].dThickness,
|
||||
dFeed = TOOLS[Cutting.nToolIndex].Feeds.dFeed}
|
||||
local dMRRBlade = MachiningLib.GetToolMRR( MRRParametersBlade)
|
||||
Strategy.Result.dMRR = dMRRBlade
|
||||
|
||||
return bAreAllMachiningsAdded, Strategy.Result
|
||||
end
|
||||
|
||||
@@ -79,6 +79,7 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
Cutting.id = Proc.id
|
||||
Cutting.vtToolDirection = vtMachiningDirection
|
||||
|
||||
-- TODO se l'utensile non arriva dai parametri opzionali va cercato!!
|
||||
|
||||
-- ===== calcolo LeadIn/out =====
|
||||
if OptionalParameters.LeadIn and OptionalParameters.LeadOut then
|
||||
|
||||
Reference in New Issue
Block a user