|
|
|
@@ -14,6 +14,8 @@ local STR0003 = {}
|
|
|
|
|
local Strategy = {}
|
|
|
|
|
local Blade = {}
|
|
|
|
|
local Chainsaw = {}
|
|
|
|
|
Blade.Result = {}
|
|
|
|
|
Chainsaw.Result = {}
|
|
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
@@ -52,6 +54,18 @@ local function GetCompletionPercentage( Proc, Result)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local function AddResult( Machining, Result)
|
|
|
|
|
table.insert( Result, {})
|
|
|
|
|
Result[#Result].bCanApply = Machining.bCanApply
|
|
|
|
|
Result[#Result].sMessage = Machining.sMessage
|
|
|
|
|
Result[#Result].dDepthMachined = Machining.dDepthToMachine
|
|
|
|
|
Result[#Result].bIsApplyOk = Machining.bIsApplyOk
|
|
|
|
|
Result[#Result].sApplyMessage = Machining.sApplyMessage
|
|
|
|
|
|
|
|
|
|
return Result
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local function CalculateLeadInOut( Machining, EdgeToMachine)
|
|
|
|
|
-- TODO implementare le funzioni di Tool Collision Avoidance (vedi wiki e FacesBysaw -> CalcLeadInOutPerpGeom)
|
|
|
|
|
|
|
|
|
@@ -127,15 +141,19 @@ local function AddNewMachining( Machining, Part)
|
|
|
|
|
-- impostazione parametri lavorazione
|
|
|
|
|
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
|
|
|
|
|
EgtSetMachiningGeometry( Machining.Geometry)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.DEPTH, Machining.Depth or 0)
|
|
|
|
|
if type( Machining.dDepth) == 'number' then
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.DEPTH, Machining.dDepth)
|
|
|
|
|
elseif type( Machining.dDepth) == 'string' then
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.DEPTH_STR, Machining.dDepth)
|
|
|
|
|
end
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.FACEUSE, Machining.nFaceuse)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.SCC, Machining.nSCC)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.SCC, Machining.nSCC or MCH_SCC.STD)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.INVERT, Machining.bInvert)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, Machining.nWorkside)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, Machining.bToolInvert)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.OFFSR, Machining.dRadialOffset)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.OFFSL, Machining.dLongitudinalOffset)
|
|
|
|
|
if Machining.Type ~= MCH_OY.MORTISING then
|
|
|
|
|
if Machining.nType ~= MCH_OY.MORTISING then
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LEADINTYPE, Machining.LeadIn.nType)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, Machining.LeadOut.nType)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LITANG, Machining.LeadIn.dTangentDistance)
|
|
|
|
@@ -277,6 +295,8 @@ function Blade.CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachine)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- parametri della lavorazione
|
|
|
|
|
-- profondità (parametro DEPTH) non usata
|
|
|
|
|
Cutting.dDepth = 0
|
|
|
|
|
-- inizio e fine aperti o chiusi
|
|
|
|
|
Cutting.bIsStartClosed = not EdgeToMachine.bIsStartOpen
|
|
|
|
|
Cutting.bIsEndClosed = not EdgeToMachine.bIsEndOpen
|
|
|
|
@@ -298,7 +318,7 @@ function Blade.CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachine)
|
|
|
|
|
else
|
|
|
|
|
Cutting.bToolInvert = false
|
|
|
|
|
end
|
|
|
|
|
-- profondità e offset radiale
|
|
|
|
|
-- profondità da lavorare e offset radiale
|
|
|
|
|
if TOOLS[Cutting.nToolIndex].dMaxDepth > abs( EdgeToMachine.dElevation) - 10 * GEO.EPS_SMALL then
|
|
|
|
|
-- TODO la depth dovrebbe essere quella del machining
|
|
|
|
|
Cutting.dDepthToMachine = abs( EdgeToMachine.dElevation)
|
|
|
|
@@ -322,7 +342,7 @@ function Blade.CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachine)
|
|
|
|
|
end
|
|
|
|
|
-- step verticale e offset longitudinale
|
|
|
|
|
Cutting.Steps = MachiningLib.GetMachiningSteps( dPocketHeight, TOOLS[Cutting.nToolIndex].dThickness)
|
|
|
|
|
Cutting.Steps.StepType = MCH_MILL_ST.ONEWAY
|
|
|
|
|
Cutting.Steps.nStepType = MCH_MILL_ST.ONEWAY
|
|
|
|
|
Cutting.dMaxElev = Cutting.Steps.dStepLength * Cutting.Steps.nCount - 10 * GEO.EPS_SMALL
|
|
|
|
|
if Cutting.bToolInvert and Cutting.Steps.nCount > 1 then
|
|
|
|
|
Cutting.dLongitudinalOffset = - dPocketHeight
|
|
|
|
@@ -378,6 +398,11 @@ function Blade.CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachine)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Blade.AddResult( Cutting)
|
|
|
|
|
AddResult( Cutting, Blade.Result)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Blade.AddMachiningAllSteps( Cutting, Part)
|
|
|
|
|
local bIsCuttingOk = false
|
|
|
|
|
local sCuttingApplyMessage = ''
|
|
|
|
@@ -414,7 +439,7 @@ function Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachi
|
|
|
|
|
|
|
|
|
|
local dPocketHeight = 0
|
|
|
|
|
if Proc.Topology.sFamily == 'Tunnel' then
|
|
|
|
|
dPocketHeight = Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.dHeight
|
|
|
|
|
dPocketHeight = Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Faces[1].dHeight
|
|
|
|
|
else
|
|
|
|
|
if FaceToMachine.Type == 'Long' then
|
|
|
|
|
dPocketHeight = Proc.MainFaces.BottomFace.MainEdges.SideEdges[1].dLength
|
|
|
|
@@ -488,6 +513,8 @@ function Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachi
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- parametri della lavorazione
|
|
|
|
|
-- profondità (parametro DEPTH) non usata
|
|
|
|
|
Mortising.dDepth = 'TH'
|
|
|
|
|
-- inizio e fine aperti o chiusi
|
|
|
|
|
Mortising.bIsStartClosed = not EdgeToMachine.bIsStartOpen
|
|
|
|
|
Mortising.bIsEndClosed = not EdgeToMachine.bIsEndOpen
|
|
|
|
@@ -510,14 +537,14 @@ function Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachi
|
|
|
|
|
elseif sMortisingType == 'BothSidesAndExtend' then
|
|
|
|
|
Mortising.dDepthToMachine = abs( EdgeToMachine.dElevation) / 2 + TOOLS[Mortising.nToolIndex].dCornerRadius + BeamData.CUT_EXTRA_MIN
|
|
|
|
|
end
|
|
|
|
|
if TOOLS[Mortising.nToolIndex].dMaxMat > Mortising.dDepthToMachine - 10 * GEO.EPS_SMALL then
|
|
|
|
|
if TOOLS[Mortising.nToolIndex].dMaxMaterial > Mortising.dDepthToMachine - 10 * GEO.EPS_SMALL then
|
|
|
|
|
if EdgeToMachine.dElevation > -10 * GEO.EPS_SMALL then
|
|
|
|
|
Mortising.dLongitudinalOffset = 0
|
|
|
|
|
else
|
|
|
|
|
Mortising.dLongitudinalOffset = abs( EdgeToMachine.dElevation) - Mortising.dDepthToMachine
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
Mortising.dDepthToMachine = TOOLS[Mortising.nToolIndex].dMaxMat - 1
|
|
|
|
|
Mortising.dDepthToMachine = TOOLS[Mortising.nToolIndex].dMaxMaterial - 1
|
|
|
|
|
dResidualDepth = abs( EdgeToMachine.dElevation) - Mortising.dDepthToMachine
|
|
|
|
|
if EdgeToMachine.dElevation > -10 * GEO.EPS_SMALL then
|
|
|
|
|
Mortising.dLongitudinalOffset = EdgeToMachine.dElevation - Mortising.dDepthToMachine
|
|
|
|
@@ -533,6 +560,13 @@ function Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachi
|
|
|
|
|
Mortising.dStartSafetyLength = EdgeToMachine.dElevation
|
|
|
|
|
-- overlap
|
|
|
|
|
Mortising.dOverlap = 0
|
|
|
|
|
-- step
|
|
|
|
|
Mortising.Steps = {}
|
|
|
|
|
if Strategy.Parameters.bUseZigZagMortising then
|
|
|
|
|
Mortising.Steps.nStepType = MCH_MILL_ST.ZIGZAG
|
|
|
|
|
else
|
|
|
|
|
Mortising.Steps.nStepType = MCH_MILL_ST.ONEWAY
|
|
|
|
|
end
|
|
|
|
|
-- faceuse
|
|
|
|
|
if EdgeToMachine.dElevation > - 10 * GEO.EPS_SMALL then
|
|
|
|
|
Mortising.nFaceuse = BeamLib.GetNearestParalOpposite( EdgeToMachine.vtToolDirection)
|
|
|
|
@@ -574,6 +608,11 @@ function Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachi
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Chainsaw.AddResult( Mortising)
|
|
|
|
|
AddResult( Mortising, Chainsaw.Result)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Chainsaw.AddMachiningAllSteps( Mortising, Part)
|
|
|
|
|
local bIsMortisingOk = false
|
|
|
|
|
local sMortisingApplyMessage = ''
|
|
|
|
@@ -603,14 +642,14 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
|
|
|
|
Strategy.Parameters = BeamLib.LoadCustomParametersInStrategy( CustomParameters)
|
|
|
|
|
Strategy.Result = {}
|
|
|
|
|
Strategy.Result.sInfo = ''
|
|
|
|
|
Blade.Result = {}
|
|
|
|
|
Chainsaw.Result = {}
|
|
|
|
|
|
|
|
|
|
local dResidualDepth = 0
|
|
|
|
|
|
|
|
|
|
if not IsTopologyOk( Proc) then
|
|
|
|
|
local sErr = 'Feature '.. Proc.idFeature .. ' : strategy ' .. Strategy.sName .. ' not implemented'
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
Strategy.Result.sStatus = 'Not-Applicable'
|
|
|
|
|
Strategy.Result.sInfo = 'Topology'
|
|
|
|
|
return false, Strategy.Result
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@@ -619,59 +658,49 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
|
|
|
|
if Proc.AffectedFaces.Bottom and ( Proc.Fct > 3 or not Proc.AffectedFaces.Top) then
|
|
|
|
|
local sErr = 'Feature '.. Proc.idFeature .. ' : strategy ' .. Strategy.sName .. ' not applicable - pocket on bottom face'
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
Strategy.Result.sStatus = 'Not-Applicable'
|
|
|
|
|
Strategy.Result.sInfo = 'Direction'
|
|
|
|
|
return false, Strategy.Result
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- lama
|
|
|
|
|
-- lavorazione di lama - fondo della tasca o fino a massimo materiale se tunnel
|
|
|
|
|
table.insert( Blade.Result, {})
|
|
|
|
|
local Cutting = {}
|
|
|
|
|
if Proc.Topology.sFamily == 'Tunnel' then
|
|
|
|
|
Cutting, dResidualDepth = Blade.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1])
|
|
|
|
|
else
|
|
|
|
|
Cutting, dResidualDepth = Blade.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge)
|
|
|
|
|
end
|
|
|
|
|
Blade.Result[#Blade.Result].bCanApply = Cutting.bCanApply
|
|
|
|
|
Blade.Result[#Blade.Result].sMessage = Cutting.sMessage
|
|
|
|
|
Blade.Result[#Blade.Result].dDepthMachined = Cutting.dDepthToMachine
|
|
|
|
|
if bAddMachining and Cutting.bCanApply then
|
|
|
|
|
Blade.Result[#Blade.Result].bIsApplyOk, Blade.Result[#Blade.Result].sApplyMessage = Blade.AddMachiningAllSteps( Cutting, Part)
|
|
|
|
|
Cutting.bIsApplyOk, Cutting.sApplyMessage = Blade.AddMachiningAllSteps( Cutting, Part)
|
|
|
|
|
end
|
|
|
|
|
Blade.AddResult( Cutting)
|
|
|
|
|
local dBottomDepthToMachine = dResidualDepth
|
|
|
|
|
-- lato opposto del tunnel
|
|
|
|
|
if Proc.Topology.sFamily == 'Tunnel' then
|
|
|
|
|
Cutting, dResidualDepth = Blade.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2])
|
|
|
|
|
table.insert( Blade.Result, {})
|
|
|
|
|
Blade.Result[#Blade.Result].bCanApply = Cutting.bCanApply
|
|
|
|
|
Blade.Result[#Blade.Result].sMessage = Cutting.sMessage
|
|
|
|
|
Blade.Result[#Blade.Result].dDepthMachined = Cutting.dDepthToMachine
|
|
|
|
|
if bAddMachining and Cutting.bCanApply then
|
|
|
|
|
Blade.Result[#Blade.Result].bIsApplyOk, Blade.Result[#Blade.Result].sApplyMessage = Blade.AddMachiningAllSteps( Cutting, Part)
|
|
|
|
|
Cutting.bIsApplyOk, Cutting.sApplyMessage = Blade.AddMachiningAllSteps( Cutting, Part)
|
|
|
|
|
end
|
|
|
|
|
Blade.AddResult( Cutting)
|
|
|
|
|
else
|
|
|
|
|
-- se la lama non è arrivata sul fondo e c'è almeno un lato aperto va lavorato
|
|
|
|
|
if dResidualDepth > 10 * GEO.EPS_SMALL then
|
|
|
|
|
-- eventuale lavorazione di lama - lato della tasca da cui inizia la lavorazione
|
|
|
|
|
if Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsStartOpen then
|
|
|
|
|
Cutting, dResidualDepth = Blade.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1])
|
|
|
|
|
table.insert( Blade.Result, {})
|
|
|
|
|
Blade.Result[#Blade.Result].bCanApply = Cutting.bCanApply
|
|
|
|
|
Blade.Result[#Blade.Result].sMessage = Cutting.sMessage
|
|
|
|
|
Blade.Result[#Blade.Result].dDepthMachined = Cutting.dDepthToMachine
|
|
|
|
|
if bAddMachining and Cutting.bCanApply then
|
|
|
|
|
Blade.Result[#Blade.Result].bIsApplyOk, Blade.Result[#Blade.Result].sApplyMessage = Blade.AddMachiningAllSteps( Cutting, Part)
|
|
|
|
|
Cutting.bIsApplyOk, Cutting.sApplyMessage = Blade.AddMachiningAllSteps( Cutting, Part)
|
|
|
|
|
end
|
|
|
|
|
Blade.AddResult( Cutting)
|
|
|
|
|
end
|
|
|
|
|
-- eventuale lavorazione di lama - lato della tasca in cui finisce la lavorazione
|
|
|
|
|
if Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsEndOpen then
|
|
|
|
|
Cutting, dResidualDepth = Blade.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2])
|
|
|
|
|
table.insert( Blade.Result, {})
|
|
|
|
|
Blade.Result[#Blade.Result].bCanApply = Cutting.bCanApply
|
|
|
|
|
Blade.Result[#Blade.Result].sMessage = Cutting.sMessage
|
|
|
|
|
Blade.Result[#Blade.Result].dDepthMachined = Cutting.dDepthToMachine
|
|
|
|
|
if bAddMachining and Cutting.bCanApply then
|
|
|
|
|
Blade.Result[#Blade.Result].bIsApplyOk, Blade.Result[#Blade.Result].sApplyMessage = Blade.AddMachiningAllSteps( Cutting, Part)
|
|
|
|
|
Cutting.bIsApplyOk, Cutting.sApplyMessage = Blade.AddMachiningAllSteps( Cutting, Part)
|
|
|
|
|
end
|
|
|
|
|
Blade.AddResult( Cutting)
|
|
|
|
|
end
|
|
|
|
|
-- la lama è arrivata sul fondo e tasca passante, non servono ulteriori lavorazioni
|
|
|
|
|
elseif #( Proc.MainFaces.SideFaces) == 0 then
|
|
|
|
@@ -680,6 +709,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- TODO da migliorare / refactoring in funzione
|
|
|
|
|
if not Strategy.Parameters.bFinishWithChainSaw then
|
|
|
|
|
local nCanApplyCount = 0
|
|
|
|
|
local nApplyOkCount = 0
|
|
|
|
@@ -709,11 +739,10 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
|
|
|
|
end
|
|
|
|
|
Strategy.Result.nCompletionIndex = FeatureData.GetFeatureCompletionIndex( dCompletionPercentage)
|
|
|
|
|
Strategy.Result.nQuality = FeatureData.GetFeatureQuality( 'Blade')
|
|
|
|
|
local MrrParameters = { dStep = TOOLS[Cutting.nToolIndex].dThickness,
|
|
|
|
|
dSideStep = min( TOOLS[Cutting.nToolIndex].dSideStep,
|
|
|
|
|
Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1].dLength),
|
|
|
|
|
local MRRParameters = { dStep = TOOLS[Cutting.nToolIndex].dThickness,
|
|
|
|
|
dSideStep = min( TOOLS[Cutting.nToolIndex].dSideStep, Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1].dLength),
|
|
|
|
|
dFeed = TOOLS[Cutting.nToolIndex].Feeds.dFeed}
|
|
|
|
|
Strategy.Result.dMRR = MachiningLib.GetToolMRR( MrrParameters)
|
|
|
|
|
Strategy.Result.dMRR = MachiningLib.GetToolMRR( MRRParameters)
|
|
|
|
|
|
|
|
|
|
return bAreAllApplyOk, Strategy.Result
|
|
|
|
|
end
|
|
|
|
@@ -721,61 +750,81 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
|
|
|
|
-- sega a catena
|
|
|
|
|
-- parametri lavorazione con sega a catena - fondo della tasca o tunnel
|
|
|
|
|
local Mortising = {}
|
|
|
|
|
if Proc.Topology == 'Tunnel' then
|
|
|
|
|
if Proc.Topology.sFamily == 'Tunnel' then
|
|
|
|
|
Mortising, dResidualDepth = Chainsaw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1])
|
|
|
|
|
else
|
|
|
|
|
Mortising = Chainsaw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge)
|
|
|
|
|
Mortising, dResidualDepth = Chainsaw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge)
|
|
|
|
|
-- si lavora solo quanto non lavorato dalla lama
|
|
|
|
|
Mortising.MaxElev = dBottomDepthToMachine + BeamData.CUT_EXTRA
|
|
|
|
|
end
|
|
|
|
|
local bIsMortisingOk = false
|
|
|
|
|
if bAddMachining and Mortising.bCanApply then
|
|
|
|
|
bIsMortisingOk, Mortising.Message = Chainsaw.AddMachiningAllSteps( Mortising, Part)
|
|
|
|
|
Mortising.bIsApplyOk, Mortising.sApplyMessage = Chainsaw.AddMachiningAllSteps( Mortising, Part)
|
|
|
|
|
end
|
|
|
|
|
Chainsaw.AddResult( Mortising)
|
|
|
|
|
-- lato opposto del tunnel
|
|
|
|
|
if Proc.Topology == 'Tunnel' and ( dResidualDepth > 10 * GEO.EPS_SMALL) then
|
|
|
|
|
Mortising = Chainsaw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2])
|
|
|
|
|
bIsMortisingOk = false
|
|
|
|
|
if Proc.Topology.sFamily == 'Tunnel' and ( dResidualDepth > 10 * GEO.EPS_SMALL) then
|
|
|
|
|
Mortising, dResidualDepth = Chainsaw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2])
|
|
|
|
|
if bAddMachining and Mortising.bCanApply then
|
|
|
|
|
bIsMortisingOk, Mortising.Message = Chainsaw.AddMachiningAllSteps( Mortising, Part)
|
|
|
|
|
end
|
|
|
|
|
if not bIsMortisingOk then
|
|
|
|
|
return bIsMortisingOk, Mortising.Message
|
|
|
|
|
Mortising.bIsApplyOk, Mortising.sApplyMessage = Chainsaw.AddMachiningAllSteps( Mortising, Part)
|
|
|
|
|
end
|
|
|
|
|
Chainsaw.AddResult( Mortising)
|
|
|
|
|
else
|
|
|
|
|
-- se la sega a catena non è arrivata sul fondo e c'è almeno un lato aperto va lavorato
|
|
|
|
|
if Mortising.LongitudinalOffset > 10 * GEO.EPS_SMALL then
|
|
|
|
|
if Mortising.dLongitudinalOffset > 10 * GEO.EPS_SMALL then
|
|
|
|
|
-- eventuale lavorazione di sega a catena - lato della tasca da cui inizia la lavorazione
|
|
|
|
|
if Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsStartOpen then
|
|
|
|
|
Mortising = Chainsaw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1])
|
|
|
|
|
bIsMortisingOk = false
|
|
|
|
|
Mortising, dResidualDepth = Chainsaw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1])
|
|
|
|
|
if bAddMachining and Mortising.bCanApply then
|
|
|
|
|
bIsMortisingOk, Mortising.Message = Chainsaw.AddMachiningAllSteps( Mortising, Part)
|
|
|
|
|
end
|
|
|
|
|
if not bIsMortisingOk then
|
|
|
|
|
return bIsMortisingOk, Mortising.Message
|
|
|
|
|
Mortising.bIsApplyOk, Mortising.sApplyMessage = Chainsaw.AddMachiningAllSteps( Mortising, Part)
|
|
|
|
|
end
|
|
|
|
|
Chainsaw.AddResult( Mortising)
|
|
|
|
|
end
|
|
|
|
|
-- eventuale lavorazione di sega a catena - lato della tasca in cui finisce la lavorazione
|
|
|
|
|
if Proc.MainFaces.LongFace[1].MainEdges.BottomEdge.bIsEndOpen then
|
|
|
|
|
Mortising = Chainsaw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].Edges.SideEdges[2])
|
|
|
|
|
bIsMortisingOk = false
|
|
|
|
|
Mortising, dResidualDepth = Chainsaw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2])
|
|
|
|
|
if bAddMachining and Mortising.bCanApply then
|
|
|
|
|
bIsMortisingOk, Mortising.Message = Chainsaw.AddMachiningAllSteps( Mortising, Part)
|
|
|
|
|
end
|
|
|
|
|
if not bIsMortisingOk then
|
|
|
|
|
return bIsMortisingOk, Mortising.Message
|
|
|
|
|
Mortising.bIsApplyOk, Mortising.sApplyMessage = Chainsaw.AddMachiningAllSteps( Mortising, Part)
|
|
|
|
|
end
|
|
|
|
|
Chainsaw.AddResult( Mortising)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local sFinalMessage = ''
|
|
|
|
|
if #Cutting.Message > 0 or #Mortising.Message > 0 then
|
|
|
|
|
sFinalMessage = Cutting.Message .. '\n' .. Mortising.Message
|
|
|
|
|
-- TODO da migliorare / refactoring in funzione
|
|
|
|
|
local nCanApplyCount = 0
|
|
|
|
|
local nApplyOkCount = 0
|
|
|
|
|
local bAreAllApplyOk
|
|
|
|
|
local dCompletionPercentage = 0
|
|
|
|
|
for i = 1, #Chainsaw.Result do
|
|
|
|
|
Strategy.Result.sInfo = Strategy.Result.sInfo .. '\n' .. Chainsaw.Result[i].sMessage .. '\n' .. ( Chainsaw.Result[i].sApplyMessage or '')
|
|
|
|
|
if Chainsaw.Result[i].bCanApply then
|
|
|
|
|
nCanApplyCount = nCanApplyCount + 1
|
|
|
|
|
end
|
|
|
|
|
if Chainsaw.Result[i].bIsApplyOk then
|
|
|
|
|
nApplyOkCount = nApplyOkCount + 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return bIsMortisingOk, sFinalMessage
|
|
|
|
|
if bAddMachining then
|
|
|
|
|
bAreAllApplyOk = ( nApplyOkCount == #Chainsaw.Result)
|
|
|
|
|
end
|
|
|
|
|
if nCanApplyCount == 0 then
|
|
|
|
|
Strategy.Result.sStatus = 'Not-Applicable'
|
|
|
|
|
else
|
|
|
|
|
dCompletionPercentage = GetCompletionPercentage( Proc, Chainsaw.Result)
|
|
|
|
|
if ( nCanApplyCount == #Chainsaw.Result) and dCompletionPercentage > 99 + 10 * GEO.EPS_SMALL then
|
|
|
|
|
Strategy.Result.sStatus = 'Completed'
|
|
|
|
|
else
|
|
|
|
|
Strategy.Result.sStatus = 'Not-Completed'
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
Strategy.Result.nCompletionIndex = FeatureData.GetFeatureCompletionIndex( dCompletionPercentage)
|
|
|
|
|
Strategy.Result.nQuality = FeatureData.GetFeatureQuality( 'Chainsaw')
|
|
|
|
|
local MRRParameters = { dStep = TOOLS[Cutting.nToolIndex].dThickness,
|
|
|
|
|
dSideStep = min( TOOLS[Cutting.nToolIndex].dSideStep, Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1].dLength),
|
|
|
|
|
dFeed = TOOLS[Cutting.nToolIndex].Feeds.dFeed}
|
|
|
|
|
Strategy.Result.dMRR = MachiningLib.GetToolMRR( MRRParameters)
|
|
|
|
|
|
|
|
|
|
return bAreAllApplyOk, Strategy.Result
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
|
|
|