|
|
|
@@ -46,30 +46,6 @@ local function IsTopologyOk( Proc)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local function GetCompletionPercentage( Proc, Result)
|
|
|
|
|
local dNotMachinedArea = 0
|
|
|
|
|
local dCompletionPercentage = 0
|
|
|
|
|
|
|
|
|
|
if Proc.Topology.sFamily == 'Tunnel' then
|
|
|
|
|
dNotMachinedArea = Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1].dLength * ( Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1].dLength - Result[1].dDepthMachined)
|
|
|
|
|
if #Result == 2 then
|
|
|
|
|
dNotMachinedArea = dNotMachinedArea - Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1].dLength * ( Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1].dLength - Result[2].dDepthMachined)
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
if #Result == 1 then
|
|
|
|
|
dNotMachinedArea = Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.dLength * ( Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1].dLength - Result[1].dDepthMachined)
|
|
|
|
|
elseif #Result == 2 then
|
|
|
|
|
dNotMachinedArea = ( Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.dLength - Result[2].dDepthMachined) * ( Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1].dLength - Result[1].dDepthMachined)
|
|
|
|
|
elseif #Result == 3 then
|
|
|
|
|
dNotMachinedArea = ( Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.dLength - Result[2].dDepthMachined - Result[3].dDepthMachined) * ( Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1].dLength - Result[1].dDepthMachined)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
dCompletionPercentage = 100 - dNotMachinedArea / Proc.MainFaces.LongFaces[1].dArea * 100
|
|
|
|
|
|
|
|
|
|
return dCompletionPercentage
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- TODO si può unificare con eguale funzione in STR0004
|
|
|
|
|
local function SortMachiningsBySegment( MachiningA, MachiningB)
|
|
|
|
|
if MachiningA.nFeatureSegment > MachiningB.nFeatureSegment then
|
|
|
|
@@ -161,25 +137,21 @@ local function AddResult( Machining, Result)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local function AddMachinings( Proc, Machinings, bAddMachining)
|
|
|
|
|
local nIsApplicableCount = 0
|
|
|
|
|
local function AddMachinings( Proc, Machinings)
|
|
|
|
|
local bAreAllMachiningsAdded = true
|
|
|
|
|
|
|
|
|
|
for i = 1, #Machinings do
|
|
|
|
|
if Machinings[i].bIsApplicable then
|
|
|
|
|
nIsApplicableCount = nIsApplicableCount + 1
|
|
|
|
|
if bAddMachining then
|
|
|
|
|
local bIsMachiningAdded
|
|
|
|
|
bIsMachiningAdded = MachiningLib.AddMachinings( Proc, Machinings[i])
|
|
|
|
|
if not bIsMachiningAdded then
|
|
|
|
|
bAreAllMachiningsAdded = false
|
|
|
|
|
end
|
|
|
|
|
local bIsMachiningAdded
|
|
|
|
|
bIsMachiningAdded = MachiningLib.AddMachinings( Proc, Machinings[i])
|
|
|
|
|
if not bIsMachiningAdded then
|
|
|
|
|
bAreAllMachiningsAdded = false
|
|
|
|
|
end
|
|
|
|
|
Strategy.Result.sInfo = Strategy.Result.sInfo .. '\n' .. Machinings[i].sMessage
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return bAreAllMachiningsAdded, nIsApplicableCount
|
|
|
|
|
return bAreAllMachiningsAdded
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -225,6 +197,9 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
|
|
|
|
dExtendAfterTail = 10000
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- volume della feature
|
|
|
|
|
local dFeatureVolume = FeatureLib.GetFeatureVolume( Proc, Part)
|
|
|
|
|
|
|
|
|
|
-- eventuali punti di spezzatura
|
|
|
|
|
local FeatureSplittingPoints = FeatureLib.GetFeatureSplittingPoints( Proc, Part)
|
|
|
|
|
local bIsSplitFeature = false
|
|
|
|
@@ -285,6 +260,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
|
|
|
|
OptionalParameters.bOppositeToolDirection = true
|
|
|
|
|
|
|
|
|
|
Cutting = FaceByBlade.Make( Proc, Part, LongFace, SideEdge1, OptionalParameters)
|
|
|
|
|
Cutting.dAreaToMachine = Cutting.dDepthToMachine * ( Cutting.dEdgeLength - Blade.Result.Bottom[1].dDepthToMachine)
|
|
|
|
|
Blade.AddResult( Cutting)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@@ -293,6 +269,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
|
|
|
|
OptionalParameters.bOppositeToolDirection = true
|
|
|
|
|
|
|
|
|
|
Cutting = FaceByBlade.Make( Proc, Part, LongFace, SideEdge2, OptionalParameters)
|
|
|
|
|
Cutting.dAreaToMachine = Cutting.dDepthToMachine * ( Cutting.dEdgeLength - Blade.Result.Bottom[1].dDepthToMachine)
|
|
|
|
|
Blade.AddResult( Cutting)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@@ -303,16 +280,27 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- lama - lavorazioni raggruppate in unica lista
|
|
|
|
|
-- lama - lavorazioni raggruppate in unica lista, escluse le lavorazioni non applicabili
|
|
|
|
|
Blade.Result.Sorted = MergeResults( Blade.Result)
|
|
|
|
|
|
|
|
|
|
-- lama - nessuna lavorazione successiva - calcolo qualità e completamento
|
|
|
|
|
if not Strategy.Parameters.bFinishWithChainSaw then
|
|
|
|
|
Strategy.Result.nQuality = FeatureLib.GetStrategyQuality( Blade.Result.Sorted)
|
|
|
|
|
local dTotalAreaToMachine = 0
|
|
|
|
|
for i = 1, #Blade.Result.Sorted do
|
|
|
|
|
local Machining = Blade.Result.Sorted[i]
|
|
|
|
|
dTotalAreaToMachine = dTotalAreaToMachine + Machining.dAreaToMachine
|
|
|
|
|
end
|
|
|
|
|
Strategy.Result.dCompletionPercentage = dTotalAreaToMachine / LongFace.dArea * 100
|
|
|
|
|
Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( Strategy.Result.dCompletionPercentage)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- lama - aggiunta eventuali lavorazioni splittate
|
|
|
|
|
if bIsSplitFeature then
|
|
|
|
|
Blade.Result.Sorted = MachiningLib.GetSplitMachinings( Blade.Result.Sorted, FeatureSplittingPoints, Part)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- lama - nessuna lavorazione successiva - aggiunta lavorazioni e calcolo risultati
|
|
|
|
|
-- TODO bisogna uscire se la lama non può fare alcuna lavorazione; non ha senso che STR0003 lama+catena sia scelta se la lama non può lavorare, in quel caso deve essere scelta la STR0004 solo catena
|
|
|
|
|
if not Strategy.Parameters.bFinishWithChainSaw then
|
|
|
|
|
|
|
|
|
|
-- ordinamento
|
|
|
|
@@ -323,33 +311,25 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- aggiunta lavorazioni
|
|
|
|
|
local nIsApplicableCount = 0
|
|
|
|
|
local bAreAllMachiningsAdded = true
|
|
|
|
|
local dFinalCompletionPercentage = 100
|
|
|
|
|
bAreAllMachiningsAdded, nIsApplicableCount = AddMachinings( Proc, Blade.Result.Sorted, bAddMachining)
|
|
|
|
|
if bAddMachining then
|
|
|
|
|
bAreAllMachiningsAdded = AddMachinings( Proc, Blade.Result.Sorted)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if nIsApplicableCount > 0 then
|
|
|
|
|
-- TODO sistemare il calcolo completamento - implementare calcolo area lavorata
|
|
|
|
|
-- calcolo MRR e esito strategia
|
|
|
|
|
local dTimeToMachine = FeatureLib.GetStrategyTimeToMachine( Blade.Result.Sorted)
|
|
|
|
|
Strategy.Result.dMRR = ( dFeatureVolume / dTimeToMachine) / pow( 10, 6)
|
|
|
|
|
if #Blade.Result.Sorted > 0 then
|
|
|
|
|
if not Strategy.Parameters.bNotCompleteWithBladeRadius and 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
|
|
|
|
|
-- non ha senso che STR0003 lama+catena sia applicabile se la lama non può lavorare, in quel caso deve essere scelta la STR0004 solo catena
|
|
|
|
|
else
|
|
|
|
|
Strategy.Result.sStatus = 'Not-Applicable'
|
|
|
|
|
Strategy.Result = FeatureLib.GetStrategyResultNotApplicable()
|
|
|
|
|
Strategy.Parameters.bFinishWithChainSaw = false
|
|
|
|
|
end
|
|
|
|
|
Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( dFinalCompletionPercentage)
|
|
|
|
|
Strategy.Result.nQuality = TOOLS[Cutting.nToolIndex].nQuality
|
|
|
|
|
local MRRParametersBlade = {
|
|
|
|
|
dStep = TOOLS[Cutting.nToolIndex].dThickness,
|
|
|
|
|
dSideStep = min( TOOLS[Cutting.nToolIndex].dSideStep, SideEdge1.dLength),
|
|
|
|
|
dFeed = TOOLS[Cutting.nToolIndex].Feeds.dFeed
|
|
|
|
|
}
|
|
|
|
|
local dMRRBlade = MachiningLib.GetToolMRR( MRRParametersBlade)
|
|
|
|
|
Strategy.Result.dMRR = dMRRBlade
|
|
|
|
|
|
|
|
|
|
return bAreAllMachiningsAdded, Strategy.Result
|
|
|
|
|
end
|
|
|
|
@@ -650,13 +630,14 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- aggiunta lavorazioni per tutti gli utensili
|
|
|
|
|
local nIsApplicableCount = 0
|
|
|
|
|
local bAreAllMachiningsAdded = true
|
|
|
|
|
local dFinalCompletionPercentage = 100
|
|
|
|
|
bAreAllMachiningsAdded, nIsApplicableCount = AddMachinings( Proc, Result, bAddMachining)
|
|
|
|
|
if bAddMachining then
|
|
|
|
|
bAreAllMachiningsAdded = AddMachinings( Proc, Result)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- calcolo risultati
|
|
|
|
|
if nIsApplicableCount > 0 then
|
|
|
|
|
if #Result > 0 then
|
|
|
|
|
if Mortising.dCompletionPercentage > 100 - 10 * GEO.EPS_SMALL then
|
|
|
|
|
Strategy.Result.sStatus = 'Completed'
|
|
|
|
|
else
|
|
|
|
|