- in STR0003 modifiche per contemplare la restituzione dei risultati del calcolo al di fuori della strategia

This commit is contained in:
luca.mazzoleni
2024-05-28 13:07:16 +02:00
parent c7687419a6
commit b2a8279eb5
2 changed files with 66 additions and 63 deletions
+1 -1
View File
@@ -99,7 +99,7 @@ function STR0002.Make( bAddMachining, Proc, Part, CustomParameters)
local dNewRest = Proc.b3Box:getDimX()
-- creo primo spezzone sulla sinistra
if bStartLeft then
local AddId = EgtCopyGlob( Proc.iod, nAddGrpId) or GDB_ID.NULL
local AddId = EgtCopyGlob( Proc.id, nAddGrpId) or GDB_ID.NULL
dNewMinX = max( ( Proc.b3Box:getMin():getX() + TOOLS[ToolInfo.nToolIndex].dDiameter * 2), Part.b3Solid:getMin():getX() + BeamData.LONGCUT_ENDLEN)
local ptOn = Point3d( dNewMinX, 0, 0)
dNewRest = abs( dNewMaxX - dNewMinX)
+65 -62
View File
@@ -243,6 +243,7 @@ function Blade.CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachine)
Cutting.bCanApply = true
Cutting.sMessage = ''
Cutting.idProc = Proc.id
local dResidualDepth = 0
local dPocketHeight = 0
if Proc.Topology.sFamily == 'Tunnel' then
@@ -269,7 +270,7 @@ function Blade.CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachine)
Cutting.sMessage = 'Feature '.. Proc.idFeature .. ' : strategy ' .. Strategy.sName .. ' not applicable - saw blade not found'
Cutting.bCanApply = false
EgtOutLog( Cutting.sMessage)
return Cutting
return Cutting, EdgeToMachine.dElevation
end
-- verifica dimensioni tasca compatibili
@@ -278,7 +279,7 @@ function Blade.CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachine)
Cutting.sMessage = 'Feature '.. Proc.idFeature .. ' : strategy ' .. Strategy.sName .. ' not applicable - pocket too narrow for saw blade thickness'
Cutting.bCanApply = false
EgtOutLog( Cutting.sMessage)
return Cutting
return Cutting, EdgeToMachine.dElevation
end
if #( Proc.MainFaces.SideFaces) > 1 then
-- se tasca più stretta della lama la strategia non è applicabile
@@ -286,7 +287,7 @@ function Blade.CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachine)
Cutting.sMessage = 'Feature '.. Proc.idFeature .. ' : strategy ' .. Strategy.sName .. ' not applicable - pocket too narrow for saw blade diameter'
Cutting.bCanApply = false
EgtOutLog( Cutting.sMessage)
return Cutting
return Cutting, EdgeToMachine.dElevation
end
end
@@ -323,6 +324,7 @@ function Blade.CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachine)
end
else
Cutting.dDepthToMachine = TOOLS[Cutting.nToolIndex].dMaxDepth - 1
dResidualDepth = EdgeToMachine.dElevation - Cutting.dDepthToMachine
if EdgeToMachine.dElevation > -10 * GEO.EPS_SMALL then
Cutting.dRadialOffset = EdgeToMachine.dElevation - Cutting.dDepthToMachine
else
@@ -387,7 +389,7 @@ function Blade.CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachine)
EgtOutLog( sDamageNextPieceMessage)
end
return Cutting
return Cutting, dResidualDepth
end
@@ -420,9 +422,9 @@ function Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachi
Mortising.bCanApply = true
Mortising.sMessage = ''
Mortising.idProc = Proc.id
local bNeedToMachineOtherSide = false
-- OneSide | OneSideAndExtend | BothSides | BothSidesAndExtend
local sMortisingType
local dResidualDepth = 0
local dPocketHeight = 0
if Proc.Topology.sFamily == 'Tunnel' then
@@ -478,7 +480,7 @@ function Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachi
Mortising.sMessage = 'Feature '.. Proc.idFeature .. ' : strategy ' .. Strategy.sName .. ' not applicable - chainsaw not found'
Mortising.bCanApply = false
EgtOutLog( Mortising.sMessage)
return Mortising, false
return Mortising, EdgeToMachine.dElevation
end
-- verifica dimensioni tasca compatibili
@@ -487,7 +489,7 @@ function Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachi
Mortising.sMessage = 'Feature '.. Proc.idFeature .. ' : strategy ' .. Strategy.sName .. ' not applicable - pocket too narrow for chainsaw thickness'
Mortising.bCanApply = false
EgtOutLog( Mortising.sMessage)
return Mortising, false
return Mortising, EdgeToMachine.dElevation
end
if #( Proc.MainFaces.SideFaces) > 1 then
-- se tasca più stretta della sega a catena la strategia non è applicabile
@@ -495,7 +497,7 @@ function Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachi
Mortising.sMessage = 'Feature '.. Proc.idFeature .. ' : strategy ' .. Strategy.sName .. ' not applicable - pocket too narrow for chainsaw width'
Mortising.bCanApply = false
EgtOutLog( Mortising.sMessage)
return Mortising, false
return Mortising, EdgeToMachine.dElevation
end
end
@@ -519,10 +521,8 @@ function Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachi
Mortising.dDepthToMachine = abs( EdgeToMachine.dElevation) + TOOLS[Mortising.nToolIndex].dCornerRadius + BeamData.CUT_EXTRA_MIN
elseif sMortisingType == 'BothSides' then
Mortising.dDepthToMachine = abs( EdgeToMachine.dElevation) / 2
bNeedToMachineOtherSide = true
elseif sMortisingType == 'BothSidesAndExtend' then
Mortising.dDepthToMachine = abs( EdgeToMachine.dElevation) / 2 + TOOLS[Mortising.nToolIndex].dCornerRadius + BeamData.CUT_EXTRA_MIN
bNeedToMachineOtherSide = true
end
if TOOLS[Mortising.nToolIndex].dMaxMat > Mortising.dDepthToMachine - 10 * GEO.EPS_SMALL then
if EdgeToMachine.dElevation > -10 * GEO.EPS_SMALL then
@@ -532,6 +532,7 @@ function Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachi
end
else
Mortising.dDepthToMachine = TOOLS[Mortising.nToolIndex].dMaxMat - 1
dResidualDepth = EdgeToMachine.dElevation - Mortising.dDepthToMachine
if EdgeToMachine.dElevation > -10 * GEO.EPS_SMALL then
Mortising.dLongitudinalOffset = EdgeToMachine.dElevation - Mortising.dDepthToMachine
else
@@ -583,7 +584,7 @@ function Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachi
EgtOutLog( sDamageNextPieceMessage)
end
return Mortising, bNeedToMachineOtherSide
return Mortising, dResidualDepth
end
@@ -607,25 +608,19 @@ end
function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
-- TODO da implementare gestione feature lunghe e spezzatura
-- carico parametri da default e li aggiorno con quelli passati dal chiamante (potrebbero non essere congruenti)
local StrategyLib = {}
StrategyLib.Config = require( 'STR0003\\STR0003Config')
Strategy.sName = StrategyLib.Config.sStrategyId
CustomParameters = BeamLib.GetUpdateCustomParameters( CustomParameters, StrategyLib.Config.Parameters)
Strategy.Parameters = BeamLib.LoadCustomParametersInStrategy( CustomParameters)
Strategy.RatingResult = {}
Strategy.Saw = {}
Strategy.Chainsaw = {}
Strategy.Result = {}
Blade.Result = {}
Chainsaw.Result = {}
local b3Raw = EgtGetRawPartBBox( Part.idRaw)
-- TODO implementare gestione lapjoint lunghe
if Proc.IsSplittedLapJoint then
local sErr = 'Feature '.. Proc.idFeature .. ' : strategy ' .. Strategy.sName .. ' not implemented for long lapjoint'
EgtOutLog( sErr)
return false, sErr
end
local dResidualDepth = 0
if not IsTopologyOk( Proc) then
local sErr = 'Feature '.. Proc.idFeature .. ' : strategy ' .. Strategy.sName .. ' not implemented'
@@ -643,53 +638,53 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
-- 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 = Blade.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1])
Cutting, dResidualDepth = Blade.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1])
Blade.Result[#Blade.Result].sType = 'Tunnel'
else
Cutting = Blade.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge)
Cutting, dResidualDepth = Blade.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge)
Blade.Result[#Blade.Result].sType = 'Bottom'
end
local bIsCuttingOk = false
if bAddMachining and Cutting.CanApply then
bIsCuttingOk, Cutting.Message = Blade.ApplyAllSteps( Cutting, b3Raw)
Blade.Result[#Blade.Result].bCanApply = Cutting.bCanApply
Blade.Result[#Blade.Result].sMessage = Cutting.sMessage
if bAddMachining and Cutting.bCanApply then
Blade.Result[#Blade.Result].bIsApplyOk, Blade.Result[#Blade.Result].sApplyMessage = Blade.AddMachiningAllSteps( Cutting, b3Raw)
end
if not bIsCuttingOk then
return bIsCuttingOk, Cutting.Message
end
local dBottomDepthToMachine = Cutting.RadialOffset
local dBottomDepthToMachine = dResidualDepth
-- lato opposto del tunnel
if Proc.Topology.sFamily == 'Tunnel' then
table.insert( Blade.Result, {})
Cutting = Blade.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2])
bIsCuttingOk = false
if bAddMachining and Cutting.CanApply then
bIsCuttingOk, Cutting.Message = Blade.ApplyAllSteps( Cutting, b3Raw)
end
if not bIsCuttingOk then
return bIsCuttingOk, Cutting.Message
Blade.Result[#Blade.Result].sType = 'Tunnel'
Blade.Result[#Blade.Result].bCanApply = Cutting.bCanApply
Blade.Result[#Blade.Result].sMessage = Cutting.sMessage
if bAddMachining and Cutting.bCanApply then
Blade.Result[#Blade.Result].bIsApplyOk, Blade.Result[#Blade.Result].sApplyMessage = Blade.AddMachiningAllSteps( Cutting, b3Raw)
end
else
-- se la lama non è arrivata sul fondo e c'è almeno un lato aperto va lavorato
if Cutting.RadialOffset > 10 * GEO.EPS_SMALL then
if dResidualDepth > 10 * GEO.EPS_SMALL then
table.insert( Blade.Result, {})
-- eventuale lavorazione di lama - lato della tasca da cui inizia la lavorazione
if Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.IsStartOpen then
Cutting = Blade.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1])
bIsCuttingOk = false
if bAddMachining and Cutting.CanApply then
bIsCuttingOk, Cutting.Message = Blade.ApplyAllSteps( Cutting, b3Raw)
end
if not bIsCuttingOk then
return bIsCuttingOk, Cutting.Message
Blade.Result[#Blade.Result].sType = 'Side'
Blade.Result[#Blade.Result].bCanApply = Cutting.bCanApply
Blade.Result[#Blade.Result].sMessage = Cutting.sMessage
if bAddMachining and Cutting.bCanApply then
Blade.Result[#Blade.Result].bIsApplyOk, Blade.Result[#Blade.Result].sApplyMessage = Blade.AddMachiningAllSteps( Cutting, b3Raw)
end
end
-- eventuale lavorazione di lama - lato della tasca in cui finisce la lavorazione
if Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.IsEndOpen then
Cutting = Blade.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces, Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2])
bIsCuttingOk = false
if bAddMachining and Cutting.CanApply then
bIsCuttingOk, Cutting.Message = Blade.ApplyAllSteps( Cutting, b3Raw)
end
if not bIsCuttingOk then
return bIsCuttingOk, Cutting.Message
Blade.Result[#Blade.Result].sType = 'Side'
Blade.Result[#Blade.Result].bCanApply = Cutting.bCanApply
Blade.Result[#Blade.Result].sMessage = Cutting.sMessage
if bAddMachining and Cutting.bCanApply then
Blade.Result[#Blade.Result].bIsApplyOk, Blade.Result[#Blade.Result].sApplyMessage = Blade.AddMachiningAllSteps( Cutting, b3Raw)
end
end
-- la lama è arrivata sul fondo e tasca passante, non servono ulteriori lavorazioni
@@ -699,30 +694,38 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
end
if Strategy.Parameters.bApplyOnlyBlade then
return bIsCuttingOk, Cutting.Message
-- TODO da rivedere
Strategy.Result.sInfo = Cutting.Message
Strategy.Result.bIsApplyOk = true
if dResidualDepth > 10 * GEO.EPS_SMALL then
Strategy.Result.sStatus = 'Not-Completed'
else
Strategy.Result.sStatus = 'Completed'
end
return Strategy.Result
end
-- sega a catena
-- parametri lavorazione con sega a catena - fondo della tasca o tunnel
local Mortising = {}
local bNeedToMachineOtherSide = false
local dResidualDepth = 0
if Proc.Topology == 'Tunnel' then
Mortising, bNeedToMachineOtherSide = Chainsaw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1])
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)
-- si lavora solo quanto non lavorato dalla lama
Mortising.MaxElev = dBottomDepthToMachine + BeamData.CUT_EXTRA
end
local bIsMortisingOk = false
if bAddMachining and Mortising.CanApply then
bIsMortisingOk, Mortising.Message = Chainsaw.ApplyAllSteps( Mortising, b3Raw)
if bAddMachining and Mortising.bCanApply then
bIsMortisingOk, Mortising.Message = Chainsaw.AddMachiningAllSteps( Mortising, b3Raw)
end
-- lato opposto del tunnel
if Proc.Topology == 'Tunnel' and bNeedToMachineOtherSide then
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 bAddMachining and Mortising.CanApply then
bIsMortisingOk, Mortising.Message = Chainsaw.ApplyAllSteps( Mortising, b3Raw)
if bAddMachining and Mortising.bCanApply then
bIsMortisingOk, Mortising.Message = Chainsaw.AddMachiningAllSteps( Mortising, b3Raw)
end
if not bIsMortisingOk then
return bIsMortisingOk, Mortising.Message
@@ -734,8 +737,8 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
if Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.IsStartOpen then
Mortising = Chainsaw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1])
bIsMortisingOk = false
if bAddMachining and Mortising.CanApply then
bIsMortisingOk, Mortising.Message = Chainsaw.ApplyAllSteps( Mortising, b3Raw)
if bAddMachining and Mortising.bCanApply then
bIsMortisingOk, Mortising.Message = Chainsaw.AddMachiningAllSteps( Mortising, b3Raw)
end
if not bIsMortisingOk then
return bIsMortisingOk, Mortising.Message
@@ -745,8 +748,8 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
if Proc.MainFaces.LongFace[1].MainEdges.BottomEdge.IsEndOpen then
Mortising = Chainsaw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].Edges.SideEdges[2])
bIsMortisingOk = false
if bAddMachining and Mortising.CanApply then
bIsMortisingOk, Mortising.Message = Chainsaw.ApplyAllSteps( Mortising, b3Raw)
if bAddMachining and Mortising.bCanApply then
bIsMortisingOk, Mortising.Message = Chainsaw.AddMachiningAllSteps( Mortising, b3Raw)
end
if not bIsMortisingOk then
return bIsMortisingOk, Mortising.Message