Merge branch 'BetterChainsawResults' into develop
This commit is contained in:
@@ -108,7 +108,7 @@ function MachiningLib.GetMachiningSteps( dMachiningDepth, dStep)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function MachiningLib.GetSplitMachinings( Machinings, SplittingPoints, Part )
|
||||
function MachiningLib.GetSplitMachinings( Machinings, SplittingPoints, Part)
|
||||
for i = #Machinings, 1, -1 do
|
||||
local nParts = #SplittingPoints + 1
|
||||
local dEdgeMaxX = Machinings[i].ptEdge1:getX()
|
||||
|
||||
@@ -165,6 +165,18 @@ function Chainsaw.AddResult( Mortising)
|
||||
end
|
||||
|
||||
|
||||
local function GetTotalAreaToMachine( Machinings)
|
||||
local dTotalAreaToMachine = 0
|
||||
|
||||
for i = 1, #Machinings do
|
||||
local Machining = Machinings[i]
|
||||
dTotalAreaToMachine = dTotalAreaToMachine + Machining.dAreaToMachine
|
||||
end
|
||||
|
||||
return dTotalAreaToMachine
|
||||
end
|
||||
|
||||
|
||||
function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
-- carico parametri da default e li aggiorno con quelli passati dal chiamante (potrebbero non essere congruenti)
|
||||
local StrategyLib = {}
|
||||
@@ -223,6 +235,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
local SideEdge2 = LongFace.MainEdges.SideEdges[2]
|
||||
local BottomEdge = LongFace.MainEdges.BottomEdge
|
||||
|
||||
-- TODO funzione separata
|
||||
-- lama - calcolo lavorazioni
|
||||
local Cutting = {}
|
||||
-- parametri comuni a tutte le lavorazioni cutting
|
||||
@@ -283,17 +296,8 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
-- 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 - calcolo area lavorata
|
||||
local dAreaToMachineBlade = GetTotalAreaToMachine( Blade.Result.Sorted)
|
||||
|
||||
-- lama - aggiunta eventuali lavorazioni splittate
|
||||
if bIsSplitFeature then
|
||||
@@ -316,7 +320,10 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
bAreAllMachiningsAdded = AddMachinings( Proc, Blade.Result.Sorted)
|
||||
end
|
||||
|
||||
-- calcolo MRR e esito strategia
|
||||
-- calcolo risultati
|
||||
Strategy.Result.nQuality = FeatureLib.GetStrategyQuality( Blade.Result.Sorted)
|
||||
Strategy.Result.dCompletionPercentage = dAreaToMachineBlade / LongFace.dArea * 100
|
||||
Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( Strategy.Result.dCompletionPercentage)
|
||||
local dTimeToMachine = FeatureLib.GetStrategyTimeToMachine( Blade.Result.Sorted)
|
||||
Strategy.Result.dMRR = ( dFeatureVolume / dTimeToMachine) / pow( 10, 6)
|
||||
if #Blade.Result.Sorted > 0 then
|
||||
@@ -334,6 +341,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
return bAreAllMachiningsAdded, Strategy.Result
|
||||
end
|
||||
|
||||
-- TODO funzione separata
|
||||
-- sega a catena - calcolo lavorazioni
|
||||
local Mortising = {}
|
||||
-- parametri comuni a tutte le lavorazioni mortising
|
||||
@@ -347,21 +355,23 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
|
||||
-- si lavora solamente l'impronta lama sui lati chiusi
|
||||
if ( Blade.Result.Bottom[1].dResidualDepth < 10 * GEO.EPS_SMALL) and
|
||||
( BottomEdge.dLength > 3 * Blade.Result.Bottom[1].dBladeMarkLength - 10 * GEO.EPS_SMALL) then
|
||||
( BottomEdge.dLength > 3 * Blade.Result.Bottom[1].dToolMarkLength - 10 * GEO.EPS_SMALL) then
|
||||
|
||||
if not BottomEdge.bIsStartOpen then
|
||||
OptionalParameters.sSideToMachine = 'Start'
|
||||
OptionalParameters.dLengthToMachine = Blade.Result.Bottom[1].dBladeMarkLength
|
||||
OptionalParameters.dLengthToMachine = Blade.Result.Bottom[1].dToolMarkLength
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, BottomEdge, OptionalParameters)
|
||||
Mortising.dAreaToMachine = Mortising.dDepthToMachine * Mortising.dEdgeLength
|
||||
Chainsaw.AddResult( Mortising)
|
||||
end
|
||||
|
||||
if not BottomEdge.bIsEndOpen then
|
||||
OptionalParameters.sSideToMachine = 'End'
|
||||
OptionalParameters.dLengthToMachine = Blade.Result.Bottom[1].dBladeMarkLength
|
||||
OptionalParameters.dLengthToMachine = Blade.Result.Bottom[1].dToolMarkLength
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, BottomEdge, OptionalParameters)
|
||||
Mortising.dAreaToMachine = Mortising.dDepthToMachine * Mortising.dEdgeLength
|
||||
Chainsaw.AddResult( Mortising)
|
||||
end
|
||||
|
||||
@@ -386,21 +396,23 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
-- si lavora solamente l'impronta lama sul fondo
|
||||
if ( #Blade.Result.Side > 0) and Blade.Result.Side[1].dResidualDepth < 10 * GEO.EPS_SMALL then
|
||||
|
||||
if ( BottomEdge.bIsStartOpen and SideEdge1.dLength > 3 * Blade.Result.Side[1].dBladeMarkLength - 10 * GEO.EPS_SMALL) then
|
||||
if ( BottomEdge.bIsStartOpen and SideEdge1.dLength > 3 * Blade.Result.Side[1].dToolMarkLength - 10 * GEO.EPS_SMALL) then
|
||||
|
||||
OptionalParameters.sSideToMachine = 'End'
|
||||
OptionalParameters.dLengthToMachine = Blade.Result.Side[1].dBladeMarkLength
|
||||
OptionalParameters.dLengthToMachine = Blade.Result.Side[1].dToolMarkLength
|
||||
OptionalParameters.bOppositeToolDirection = true
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge1, OptionalParameters)
|
||||
Mortising.dAreaToMachine = Mortising.dDepthToMachine * ( Mortising.dEdgeLength - Chainsaw.Result.Bottom[1].dDepthToMachine)
|
||||
|
||||
elseif ( BottomEdge.bIsEndOpen and SideEdge2.dLength > 3 * Blade.Result.Side[1].dBladeMarkLength - 10 * GEO.EPS_SMALL) then
|
||||
elseif ( BottomEdge.bIsEndOpen and SideEdge2.dLength > 3 * Blade.Result.Side[1].dToolMarkLength - 10 * GEO.EPS_SMALL) then
|
||||
|
||||
OptionalParameters.sSideToMachine = 'Start'
|
||||
OptionalParameters.dLengthToMachine = Blade.Result.Side[2].dBladeMarkLength
|
||||
OptionalParameters.dLengthToMachine = Blade.Result.Side[2].dToolMarkLength
|
||||
OptionalParameters.bOppositeToolDirection = true
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge2, OptionalParameters)
|
||||
Mortising.dAreaToMachine = Mortising.dDepthToMachine * ( Mortising.dEdgeLength - Chainsaw.Result.Bottom[1].dDepthToMachine)
|
||||
end
|
||||
|
||||
-- si lavora tutto il lato
|
||||
@@ -418,12 +430,14 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
OptionalParameters.bOppositeToolDirection = true
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge1, OptionalParameters)
|
||||
Mortising.dAreaToMachine = Mortising.dDepthToMachine * ( Mortising.dEdgeLength - Chainsaw.Result.Bottom[1].dDepthToMachine)
|
||||
|
||||
elseif BottomEdge.bIsEndOpen then
|
||||
OptionalParameters.dMaxElev = dBladeResidualDepth + BeamData.CUT_EXTRA
|
||||
OptionalParameters.bOppositeToolDirection = true
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge2, OptionalParameters)
|
||||
Mortising.dAreaToMachine = Mortising.dDepthToMachine * ( Mortising.dEdgeLength - Chainsaw.Result.Bottom[1].dDepthToMachine)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -448,15 +462,16 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
OptionalParameters.bExtendWithCornerRadius = true
|
||||
|
||||
-- si lavora solamente l'impronta lama sul fondo
|
||||
if ( Blade.Result.Side[1].dResidualDepth < 10 * GEO.EPS_SMALL and SideEdge1.dLength > 3 * Blade.Result.Side[1].dBladeMarkLength - 10 * GEO.EPS_SMALL) and
|
||||
( Blade.Result.Side[2].dResidualDepth < 10 * GEO.EPS_SMALL and SideEdge2.dLength > 3 * Blade.Result.Side[2].dBladeMarkLength - 10 * GEO.EPS_SMALL) then
|
||||
if ( Blade.Result.Side[1].dResidualDepth < 10 * GEO.EPS_SMALL and SideEdge1.dLength > 3 * Blade.Result.Side[1].dToolMarkLength - 10 * GEO.EPS_SMALL) and
|
||||
( Blade.Result.Side[2].dResidualDepth < 10 * GEO.EPS_SMALL and SideEdge2.dLength > 3 * Blade.Result.Side[2].dToolMarkLength - 10 * GEO.EPS_SMALL) then
|
||||
|
||||
OptionalParameters.dDepthToMachine = SideEdge1.dElevation + BeamData.CUT_EXTRA
|
||||
OptionalParameters.sSideToMachine = 'End'
|
||||
OptionalParameters.dLengthToMachine = Blade.Result.Side[1].dBladeMarkLength
|
||||
OptionalParameters.dLengthToMachine = Blade.Result.Side[1].dToolMarkLength
|
||||
OptionalParameters.bOppositeToolDirection = true
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge1, OptionalParameters)
|
||||
Mortising.dAreaToMachine = Mortising.dDepthToMachine * ( Mortising.dEdgeLength - Chainsaw.Result.Bottom[1].dDepthToMachine)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
|
||||
-- ancora materiale residuo - si lavora da entrambi i lati
|
||||
@@ -466,16 +481,18 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
|
||||
OptionalParameters.dDepthToMachine = SideEdge1.dElevation / 2 + BeamData.CUT_EXTRA_MIN
|
||||
OptionalParameters.sSideToMachine = 'End'
|
||||
OptionalParameters.dLengthToMachine = Blade.Result.Side[1].dBladeMarkLength
|
||||
OptionalParameters.dLengthToMachine = Blade.Result.Side[1].dToolMarkLength
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge1, OptionalParameters)
|
||||
Mortising.dAreaToMachine = Mortising.dDepthToMachine * ( Mortising.dEdgeLength - Chainsaw.Result.Bottom[1].dDepthToMachine)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
|
||||
OptionalParameters.dDepthToMachine = SideEdge2.dElevation / 2 + BeamData.CUT_EXTRA_MIN
|
||||
OptionalParameters.sSideToMachine = 'Start'
|
||||
OptionalParameters.dLengthToMachine = Blade.Result.Side[2].dBladeMarkLength
|
||||
OptionalParameters.dLengthToMachine = Blade.Result.Side[2].dToolMarkLength
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge2, OptionalParameters)
|
||||
Mortising.dAreaToMachine = 0
|
||||
Chainsaw.AddResult( Mortising)
|
||||
|
||||
-- lavorando dai due lati non c'è materiale residuo - si può eliminare la lavorazione del fondo
|
||||
@@ -492,6 +509,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
OptionalParameters.bOppositeToolDirection = true
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge1, OptionalParameters)
|
||||
Mortising.dAreaToMachine = Mortising.dDepthToMachine * ( Mortising.dEdgeLength - Chainsaw.Result.Bottom[1].dDepthToMachine)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
|
||||
-- ancora materiale residuo - si lavora da entrambi i lati
|
||||
@@ -503,12 +521,14 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
OptionalParameters.dMaxElev = Blade.Result.Side[1].dResidualDepth + BeamData.CUT_EXTRA
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge1, OptionalParameters)
|
||||
Mortising.dAreaToMachine = Mortising.dDepthToMachine * ( Mortising.dEdgeLength - Chainsaw.Result.Bottom[1].dDepthToMachine)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
|
||||
OptionalParameters.dDepthToMachine = SideEdge2.dElevation / 2 + BeamData.CUT_EXTRA_MIN
|
||||
OptionalParameters.dMaxElev = Blade.Result.Side[2].dResidualDepth + BeamData.CUT_EXTRA
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge2, OptionalParameters)
|
||||
Mortising.dAreaToMachine = 0
|
||||
Chainsaw.AddResult( Mortising)
|
||||
|
||||
-- lavorando dai due lati non c'è materiale residuo - si può disabilitare la lavorazione del fondo
|
||||
@@ -526,22 +546,24 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
OptionalParameters.bExtendWithCornerRadius = true
|
||||
|
||||
-- si lavora solamente l'impronta lama sul lato opposto
|
||||
if ( Blade.Result.Opposite[1].dResidualDepth < 10 * GEO.EPS_SMALL and OppositeEdge1.dLength > 3 * Blade.Result.Opposite[1].dBladeMarkLength - 10 * GEO.EPS_SMALL) and
|
||||
( Blade.Result.Opposite[2].dResidualDepth < 10 * GEO.EPS_SMALL and OppositeEdge2.dLength > 3 * Blade.Result.Opposite[2].dBladeMarkLength - 10 * GEO.EPS_SMALL) then
|
||||
if ( Blade.Result.Opposite[1].dResidualDepth < 10 * GEO.EPS_SMALL and OppositeEdge1.dLength > 3 * Blade.Result.Opposite[1].dToolMarkLength - 10 * GEO.EPS_SMALL) and
|
||||
( Blade.Result.Opposite[2].dResidualDepth < 10 * GEO.EPS_SMALL and OppositeEdge2.dLength > 3 * Blade.Result.Opposite[2].dToolMarkLength - 10 * GEO.EPS_SMALL) then
|
||||
|
||||
OptionalParameters.dLengthToMachine = max(
|
||||
Blade.Result.Opposite[1].dBladeMarkLength,
|
||||
Blade.Result.Opposite[2].dBladeMarkLength
|
||||
Blade.Result.Opposite[1].dToolMarkLength,
|
||||
Blade.Result.Opposite[2].dToolMarkLength
|
||||
)
|
||||
OptionalParameters.dDepthToMachine = OppositeEdge1.dElevation + BeamData.CUT_EXTRA
|
||||
OptionalParameters.sSideToMachine = 'Start'
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, OppositeEdge1, OptionalParameters)
|
||||
Mortising.dAreaToMachine = Mortising.dDepthToMachine * Mortising.dEdgeLength
|
||||
Chainsaw.AddResult( Mortising)
|
||||
|
||||
OptionalParameters.sSideToMachine = 'End'
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, OppositeEdge1, OptionalParameters)
|
||||
Mortising.dAreaToMachine = 0
|
||||
Chainsaw.AddResult( Mortising)
|
||||
|
||||
-- se lavorando solo da un lato rimane materiale residuo, si lavora da entrambi
|
||||
@@ -553,28 +575,32 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
|
||||
OptionalParameters.dDepthToMachine = OppositeEdge1.dElevation / 2 + BeamData.CUT_EXTRA_MIN
|
||||
OptionalParameters.sSideToMachine = 'Start'
|
||||
OptionalParameters.dLengthToMachine = Blade.Result.Opposite[1].dBladeMarkLength
|
||||
OptionalParameters.dLengthToMachine = Blade.Result.Opposite[1].dToolMarkLength
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, OppositeEdge1, OptionalParameters)
|
||||
Mortising.dAreaToMachine = Mortising.dDepthToMachine * Mortising.dEdgeLength
|
||||
Chainsaw.AddResult( Mortising)
|
||||
|
||||
OptionalParameters.sSideToMachine = 'End'
|
||||
OptionalParameters.dLengthToMachine = Blade.Result.Opposite[1].dBladeMarkLength
|
||||
OptionalParameters.dLengthToMachine = Blade.Result.Opposite[1].dToolMarkLength
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, OppositeEdge1, OptionalParameters)
|
||||
Mortising.dAreaToMachine = 0
|
||||
Chainsaw.AddResult( Mortising)
|
||||
|
||||
OptionalParameters.dDepthToMachine = OppositeEdge2.dElevation / 2 + BeamData.CUT_EXTRA_MIN
|
||||
OptionalParameters.sSideToMachine = 'Start'
|
||||
OptionalParameters.dLengthToMachine = Blade.Result.Opposite[2].dBladeMarkLength
|
||||
OptionalParameters.dLengthToMachine = Blade.Result.Opposite[2].dToolMarkLength
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, OppositeEdge2, OptionalParameters)
|
||||
Mortising.dAreaToMachine = Mortising.dDepthToMachine * Mortising.dEdgeLength
|
||||
Chainsaw.AddResult( Mortising)
|
||||
|
||||
OptionalParameters.sSideToMachine = 'End'
|
||||
OptionalParameters.dLengthToMachine = Blade.Result.Opposite[2].dBladeMarkLength
|
||||
OptionalParameters.dLengthToMachine = Blade.Result.Opposite[2].dToolMarkLength
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, OppositeEdge2, OptionalParameters)
|
||||
Mortising.dAreaToMachine = 0
|
||||
Chainsaw.AddResult( Mortising)
|
||||
end
|
||||
|
||||
@@ -608,6 +634,9 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
-- sega a catena - lavorazioni raggruppate in unica lista
|
||||
Chainsaw.Result.Sorted = MergeResults( Chainsaw.Result)
|
||||
|
||||
-- sega a catena - calcolo area lavorata
|
||||
local dAreaToMachineChainsaw = GetTotalAreaToMachine( Chainsaw.Result.Sorted)
|
||||
|
||||
-- sega a catena - aggiunta eventuali lavorazioni splittate
|
||||
if bIsSplitFeature then
|
||||
Chainsaw.Result.Sorted = MachiningLib.GetSplitMachinings( Chainsaw.Result.Sorted, FeatureSplittingPoints, Part)
|
||||
@@ -631,36 +660,25 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
|
||||
-- aggiunta lavorazioni per tutti gli utensili
|
||||
local bAreAllMachiningsAdded = true
|
||||
local dFinalCompletionPercentage = 100
|
||||
if bAddMachining then
|
||||
bAreAllMachiningsAdded = AddMachinings( Proc, Result)
|
||||
end
|
||||
|
||||
-- calcolo risultati
|
||||
Strategy.Result.dCompletionPercentage = max( dAreaToMachineBlade, dAreaToMachineChainsaw) / LongFace.dArea * 100
|
||||
Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( Strategy.Result.dCompletionPercentage)
|
||||
if #Result > 0 then
|
||||
if Mortising.dCompletionPercentage > 100 - 10 * GEO.EPS_SMALL then
|
||||
if Strategy.Result.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 = Mortising.dCompletionPercentage
|
||||
end
|
||||
Strategy.Result.nQuality = FeatureLib.GetStrategyQuality( Result)
|
||||
local dTimeToMachine = FeatureLib.GetStrategyTimeToMachine( Result)
|
||||
Strategy.Result.dMRR = ( dFeatureVolume / dTimeToMachine) / pow( 10, 6)
|
||||
else
|
||||
Strategy.Result.sStatus = 'Not-Applicable'
|
||||
Strategy.Result = FeatureLib.GetStrategyResultNotApplicable()
|
||||
end
|
||||
Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( dFinalCompletionPercentage)
|
||||
Strategy.Result.nQuality = 0.5 * TOOLS[Cutting.nToolIndex].nQuality + 0.5 * TOOLS[Mortising.nToolIndex].nQuality
|
||||
local MRRParametersBlade = {
|
||||
dStep = TOOLS[Cutting.nToolIndex].dThickness,
|
||||
dSideStep = min( TOOLS[Cutting.nToolIndex].dSideStep, SideEdge1.dLength),
|
||||
dFeed = TOOLS[Cutting.nToolIndex].Feeds.dFeed}
|
||||
local MRRParametersChainsaw = {
|
||||
dStep = min( TOOLS[Mortising.nToolIndex].dStep, SideEdge1.dLength),
|
||||
dSideStep = TOOLS[Mortising.nToolIndex].dThickness,
|
||||
dFeed = TOOLS[Mortising.nToolIndex].Feeds.dFeed}
|
||||
local dMRRBlade = MachiningLib.GetToolMRR( MRRParametersBlade)
|
||||
local dMRRChainsaw = MachiningLib.GetToolMRR( MRRParametersChainsaw)
|
||||
Strategy.Result.dMRR = ( dMRRBlade + dMRRChainsaw) / 2
|
||||
|
||||
return bAreAllMachiningsAdded, Strategy.Result
|
||||
end
|
||||
|
||||
@@ -89,6 +89,18 @@ function Chainsaw.AddResult( Mortising)
|
||||
end
|
||||
|
||||
|
||||
local function GetTotalAreaToMachine( Machinings)
|
||||
local dTotalAreaToMachine = 0
|
||||
|
||||
for i = 1, #Machinings do
|
||||
local Machining = Machinings[i]
|
||||
dTotalAreaToMachine = dTotalAreaToMachine + Machining.dAreaToMachine
|
||||
end
|
||||
|
||||
return dTotalAreaToMachine
|
||||
end
|
||||
|
||||
|
||||
function STR0004.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
-- carico parametri da default e li aggiorno con quelli passati dal chiamante (potrebbero non essere congruenti)
|
||||
local StrategyLib = {}
|
||||
@@ -119,6 +131,9 @@ function STR0004.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
if MachiningLib.CanExtendAfterTail( Strategy.Parameters.sCanDamageNextPiece, Part) then
|
||||
dExtendAfterTail = 10000
|
||||
end
|
||||
|
||||
-- volume della feature
|
||||
local dFeatureVolume = FeatureLib.GetFeatureVolume( Proc, Part)
|
||||
|
||||
-- eventuali punti di spezzatura
|
||||
local FeatureSplittingPoints = FeatureLib.GetFeatureSplittingPoints( Proc, Part)
|
||||
@@ -167,8 +182,10 @@ function STR0004.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
|
||||
if BottomEdge.bIsStartOpen then
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge1, OptionalParameters)
|
||||
Mortising.dAreaToMachine = Mortising.dDepthToMachine * ( Mortising.dEdgeLength - Chainsaw.Result.Bottom[1].dDepthToMachine)
|
||||
elseif BottomEdge.bIsEndOpen then
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge2, OptionalParameters)
|
||||
Mortising.dAreaToMachine = Mortising.dDepthToMachine * ( Mortising.dEdgeLength - Chainsaw.Result.Bottom[1].dDepthToMachine)
|
||||
end
|
||||
|
||||
Chainsaw.AddResult( Mortising)
|
||||
@@ -188,6 +205,7 @@ function STR0004.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
OptionalParameters.bOppositeToolDirection = true
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge1, OptionalParameters)
|
||||
Mortising.dAreaToMachine = Mortising.dDepthToMachine * ( Mortising.dEdgeLength - Chainsaw.Result.Bottom[1].dDepthToMachine)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
|
||||
-- ancora materiale residuo - si lavora da entrambi i lati
|
||||
@@ -199,11 +217,13 @@ function STR0004.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
OptionalParameters.dDepthToMachine = SideEdge1.dElevation / 2 + BeamData.CUT_EXTRA_MIN
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge1, OptionalParameters)
|
||||
Mortising.dAreaToMachine = Mortising.dDepthToMachine * ( Mortising.dEdgeLength - Chainsaw.Result.Bottom[1].dDepthToMachine)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
|
||||
OptionalParameters.dDepthToMachine = SideEdge2.dElevation / 2 + BeamData.CUT_EXTRA_MIN
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge2, OptionalParameters)
|
||||
Mortising.dAreaToMachine = Mortising.dDepthToMachine * ( Mortising.dEdgeLength - Chainsaw.Result.Bottom[1].dDepthToMachine)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
|
||||
-- lavorando dai due lati non c'è materiale residuo - si può disabilitare la lavorazione del fondo
|
||||
@@ -266,13 +286,13 @@ function STR0004.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
-- TODO aggiungere ordinamento per utensile
|
||||
table.sort( Chainsaw.Result.Sorted, SortMachiningsBySegment)
|
||||
|
||||
-- calcolo area lavorata
|
||||
local dTotalAreaToMachine = GetTotalAreaToMachine( Chainsaw.Result.Sorted)
|
||||
|
||||
-- aggiunta lavorazioni
|
||||
local nIsApplicableCount = 0
|
||||
local dFinalCompletionPercentage = 100
|
||||
local bAreAllMachiningsAdded = true
|
||||
for i = 1, #Chainsaw.Result.Sorted do
|
||||
if Chainsaw.Result.Sorted[i].bIsApplicable then
|
||||
nIsApplicableCount = nIsApplicableCount + 1
|
||||
if bAddMachining then
|
||||
local bIsMachiningAdded = MachiningLib.AddMachinings( Proc, Chainsaw.Result.Sorted[i])
|
||||
if not bIsMachiningAdded then
|
||||
@@ -284,25 +304,20 @@ function STR0004.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
end
|
||||
|
||||
-- calcolo risultati
|
||||
if nIsApplicableCount > 0 then
|
||||
Strategy.Result.dCompletionPercentage = dTotalAreaToMachine / LongFace.dArea * 100
|
||||
Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( Strategy.Result.dCompletionPercentage)
|
||||
if #Chainsaw.Result.Sorted > 0 then
|
||||
if Mortising.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 = Mortising.dCompletionPercentage
|
||||
end
|
||||
Strategy.Result.nQuality = FeatureLib.GetStrategyQuality( Chainsaw.Result.Sorted)
|
||||
local dTimeToMachine = FeatureLib.GetStrategyTimeToMachine( Chainsaw.Result.Sorted)
|
||||
Strategy.Result.dMRR = ( dFeatureVolume / dTimeToMachine) / pow( 10, 6)
|
||||
else
|
||||
Strategy.Result.sStatus = 'Not-Applicable'
|
||||
Strategy.Result = FeatureLib.GetStrategyResultNotApplicable()
|
||||
end
|
||||
Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( dFinalCompletionPercentage)
|
||||
Strategy.Result.nQuality = TOOLS[Mortising.nToolIndex].nQuality
|
||||
local MRRParametersChainsaw = {
|
||||
dStep = min( TOOLS[Mortising.nToolIndex].dStep, SideEdge1.dLength),
|
||||
dSideStep = TOOLS[Mortising.nToolIndex].dThickness,
|
||||
dFeed = TOOLS[Mortising.nToolIndex].Feeds.dFeed}
|
||||
local dMRRChainsaw = MachiningLib.GetToolMRR( MRRParametersChainsaw)
|
||||
Strategy.Result.dMRR = dMRRChainsaw
|
||||
|
||||
return bAreAllMachiningsAdded, Strategy.Result
|
||||
end
|
||||
|
||||
@@ -224,9 +224,9 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters)
|
||||
if bFinishWithMill then
|
||||
for i = 1, #LongFaces do
|
||||
local dDepthToMachineMill = BottomFace.MainEdges.LongEdges[i].dElevation - dMillingOffsetFromSide
|
||||
local dBladeMarkLength = max( Cutting1.dBladeMarkLength, Cutting2.dBladeMarkLength)
|
||||
local dToolMarkLength = max( Cutting1.dToolMarkLength, Cutting2.dToolMarkLength)
|
||||
local OptionalParametersFaceByMill = { bIsSplitFeature = bIsSplitFeature, dExtendAfterTail = dExtendAfterTail,
|
||||
dRadialStepSpan = dBladeMarkLength, dDepthToMachine = dDepthToMachineMill
|
||||
dRadialStepSpan = dToolMarkLength, dDepthToMachine = dDepthToMachineMill
|
||||
}
|
||||
local Milling = FaceByMill.Make( Proc, Part, BottomFace, BottomFace.MainEdges.LongEdges[i], OptionalParametersFaceByMill)
|
||||
Milling.nInternalSortingPriority = 2
|
||||
@@ -242,9 +242,7 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters)
|
||||
end
|
||||
end
|
||||
|
||||
-- calcolo qualità e completamento
|
||||
Result.nQuality = FeatureLib.GetStrategyQuality( Machinings)
|
||||
-- per il completamento serve la lista di lavorazioni che comprende le non applicabili
|
||||
-- calcolo completamento, serve la lista di lavorazioni che comprende le non applicabili
|
||||
Result.dCompletionPercentage = GetStrategyCompletionPercentage( CalculatedMachinings)
|
||||
Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( Result.dCompletionPercentage)
|
||||
|
||||
@@ -256,8 +254,9 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters)
|
||||
-- ordinamento
|
||||
table.sort( Machinings, SortMachiningsBySegment)
|
||||
|
||||
-- calcolo MRR e esito strategia
|
||||
-- calcolo risultati
|
||||
if Cutting1.bIsApplicable or Cutting2.bIsApplicable then
|
||||
Result.nQuality = FeatureLib.GetStrategyQuality( Machinings)
|
||||
local dTimeToMachine = FeatureLib.GetStrategyTimeToMachine( Machinings)
|
||||
Result.dMRR = ( dFeatureVolume / dTimeToMachine) / pow( 10, 6)
|
||||
if Result.dCompletionPercentage > 100 - 10 * GEO.EPS_SMALL then
|
||||
|
||||
@@ -176,7 +176,7 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
Cutting.idProc = Proc.id
|
||||
Cutting.dResidualDepth = EdgeToMachine.dElevation
|
||||
Cutting.dCompletionPercentage = 0
|
||||
Cutting.dBladeMarkLength = 0
|
||||
Cutting.dToolMarkLength = 0
|
||||
Cutting.sEdgeType = EdgeToMachine.sType
|
||||
Cutting.nFeatureSegment = 1
|
||||
|
||||
@@ -323,8 +323,6 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
end
|
||||
-- completamento
|
||||
Cutting.dCompletionPercentage = ( 1 - Cutting.dResidualDepth / Cutting.dDepthToMachine) * 100
|
||||
-- area lavorata
|
||||
Cutting.dAreaToMachine = Cutting.dDepthToMachine * Cutting.dEdgeLength
|
||||
-- step verticale e offset longitudinale
|
||||
Cutting.Steps = MachiningLib.GetMachiningSteps( dPocketHeight, TOOLS[Cutting.nToolIndex].dThickness)
|
||||
Cutting.Steps.nStepType = MCH_MILL_ST.ONEWAY
|
||||
@@ -375,12 +373,14 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
Cutting.dLengthToMachineAllStepsWithLeadInOut = MachiningLib.GetLengthToMachineAllStepsWithLeadInOut( Cutting)
|
||||
-- lunghezza impronta lama
|
||||
if Cutting.bIsStartClosed and Cutting.bIsEndClosed then
|
||||
Cutting.dBladeMarkLength = abs( min( Cutting.LeadIn.dStartAddLength, Cutting.LeadOut.dEndAddLength))
|
||||
Cutting.dToolMarkLength = abs( min( Cutting.LeadIn.dStartAddLength, Cutting.LeadOut.dEndAddLength))
|
||||
elseif Cutting.bIsStartClosed then
|
||||
Cutting.dBladeMarkLength = abs( Cutting.LeadIn.dStartAddLength)
|
||||
Cutting.dToolMarkLength = abs( Cutting.LeadIn.dStartAddLength)
|
||||
elseif Cutting.bIsEndClosed then
|
||||
Cutting.dBladeMarkLength = abs( Cutting.LeadOut.dEndAddLength)
|
||||
Cutting.dToolMarkLength = abs( Cutting.LeadOut.dEndAddLength)
|
||||
end
|
||||
-- area lavorata
|
||||
Cutting.dAreaToMachine = min( EdgeToMachine.dElevation, Cutting.dDepthToMachine) * ( min( Cutting.dEdgeLength, Cutting.dLengthToMachine + 2 * Cutting.dToolMarkLength))
|
||||
-- geometria
|
||||
Cutting.Geometry = {{Cutting.idProc, FaceToMachine.id}}
|
||||
-- note utente
|
||||
|
||||
@@ -161,8 +161,6 @@ function FACEBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
|
||||
end
|
||||
-- completamento
|
||||
Mortising.dCompletionPercentage = ( 1 - Mortising.dResidualDepth / Mortising.dDepthToMachine) * 100
|
||||
-- area lavorata
|
||||
Mortising.dAreaToMachine = Mortising.dDepthToMachine * dLengthToMachine
|
||||
-- massima elevazione
|
||||
if dCustomMaxElev < Mortising.dDepthToMachine - 10 * GEO.EPS_SMALL then
|
||||
Mortising.dMaxElev = max( dCustomMaxElev, dCustomMaxElev - Mortising.dLongitudinalOffset)
|
||||
@@ -218,6 +216,8 @@ function FACEBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
|
||||
Mortising.dLengthToMachine = Mortising.dEdgeLength + Mortising.LeadIn.dStartAddLength + Mortising.LeadOut.dEndAddLength
|
||||
Mortising.dLengthOnX = abs( dLengthToMachine * EdgeToMachine.vtN:getY())
|
||||
Mortising.dLengthToMachineAllStepsWithLeadInOut = MachiningLib.GetLengthToMachineAllStepsWithLeadInOut( Mortising)
|
||||
-- area lavorata
|
||||
Mortising.dAreaToMachine = min( EdgeToMachine.dElevation, Mortising.dDepthToMachine) * ( min( Mortising.dEdgeLength, Mortising.dLengthToMachine + TOOLS[Mortising.nToolIndex].dDiameter))
|
||||
-- geometria
|
||||
Mortising.Geometry = {{Proc.id, FaceToMachine.id}}
|
||||
-- nome operazione
|
||||
|
||||
@@ -174,7 +174,7 @@ function FACEBYMILL.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPara
|
||||
Milling.idProc = Proc.id
|
||||
Milling.dResidualDepth = EdgeToMachine.dElevation
|
||||
Milling.dCompletionPercentage = 0
|
||||
Milling.dBladeMarkLength = 0
|
||||
Milling.dToolMarkLength = 0
|
||||
Milling.sEdgeType = EdgeToMachine.sType
|
||||
Milling.nFeatureSegment = 1
|
||||
|
||||
@@ -324,8 +324,6 @@ function FACEBYMILL.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPara
|
||||
end
|
||||
-- completamento
|
||||
Milling.dCompletionPercentage = ( 1 - Milling.dResidualDepth / Milling.dDepthToMachine) * 100
|
||||
-- area lavorata
|
||||
Milling.dAreaToMachine = Milling.dDepthToMachine * Milling.dEdgeLength
|
||||
-- step verticale e offset longitudinale
|
||||
if OptionalParameters.dPocketHeight then
|
||||
Milling.Steps = MachiningLib.GetMachiningSteps( dPocketHeight, TOOLS[Milling.nToolIndex].dMaxMaterial)
|
||||
@@ -384,12 +382,14 @@ function FACEBYMILL.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPara
|
||||
Milling.dLengthToMachineAllStepsWithLeadInOut = MachiningLib.GetLengthToMachineAllStepsWithLeadInOut( Milling)
|
||||
-- lunghezza impronta lama
|
||||
if Milling.bIsStartClosed and Milling.bIsEndClosed then
|
||||
Milling.dBladeMarkLength = abs( min( Milling.LeadIn.dStartAddLength, Milling.LeadOut.dEndAddLength))
|
||||
Milling.dToolMarkLength = abs( min( Milling.LeadIn.dStartAddLength, Milling.LeadOut.dEndAddLength))
|
||||
elseif Milling.bIsStartClosed then
|
||||
Milling.dBladeMarkLength = abs( Milling.LeadIn.dStartAddLength)
|
||||
Milling.dToolMarkLength = abs( Milling.LeadIn.dStartAddLength)
|
||||
elseif Milling.bIsEndClosed then
|
||||
Milling.dBladeMarkLength = abs( Milling.LeadOut.dEndAddLength)
|
||||
Milling.dToolMarkLength = abs( Milling.LeadOut.dEndAddLength)
|
||||
end
|
||||
-- area lavorata
|
||||
Milling.dAreaToMachine = min( EdgeToMachine.dElevation, Milling.dDepthToMachine) * ( min( Milling.dEdgeLength, Milling.dLengthToMachine + 2 * Milling.dToolMarkLength))
|
||||
-- geometria
|
||||
Milling.Geometry = {{Milling.idProc, FaceToMachine.id}}
|
||||
-- note utente
|
||||
|
||||
Reference in New Issue
Block a user