- Calcolo automatiso SIDESTEP portato a 1/3 del diametro

- Migliorato calcolo percentuale lavorata
- Gestione topologia Rabbet-2-Through
- Varie migliorie calcoli svuotature da applicare
This commit is contained in:
andrea.villa
2024-06-05 10:36:06 +02:00
parent 9a8c0386d9
commit 285f3bc78d
3 changed files with 204 additions and 113 deletions
+1 -1
View File
@@ -147,7 +147,7 @@ function BeamExec.GetToolsFromDB()
Tool.dSideDepth = EgtGetValInNotes( Tool.sUserNotes, 'SIDEDEPTH') or 0 -- se non settato nell'utensile, dico che non ha massimo affondamento laterale
Tool.bIsTMill = Tool.dSideDepth > 0
Tool.dStep = EgtGetValInNotes( Tool.sUserNotes, 'STEP') or ( Tool.dMaxMaterial / 3) -- se non settato nell'utensile, considero metà del tagliente
Tool.dSideStep = EgtGetValInNotes( Tool.sUserNotes, 'SIDESTEP') or floor( Tool.dDiameter / 2) -- se non settato nell'utensile, considero metà del diametro
Tool.dSideStep = EgtGetValInNotes( Tool.sUserNotes, 'SIDESTEP') or floor( Tool.dDiameter / 3) -- se non settato nell'utensile, considero metà del diametro
Tool.bIsPen = abs( Tool.dSpeed) < 5
-- recupero parametri propri delle lame
elseif sToolFamily == 'SAWBLADE' then
+1 -1
View File
@@ -273,7 +273,7 @@ function MachiningLib.FindChainSaw( Proc, ToolSearchParameters)
dBestToolResidualDepth = dCurrentResidualDepth
end
-- se entrambi incompleti
elseif dBestToolResidualDepth > 0 and dCurrentResidualDepth > 0 then
elseif dBestToolResidualDepth > 0 and dCurrentResidualDepth > 0 then
--scelgo quello che lavora di più
if dCurrentResidualDepth > dBestToolResidualDepth then
nBestToolIndex = i
+202 -111
View File
@@ -3,6 +3,18 @@
-- Svuotatura tasca
-- Feature tipo LapJpint
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
-- TODO
-- 1 - Controllare lavorazioni in caso di feature lunga spezzata
-- 2 - Inserire antischeggia (fresa o lama)
-- 3 - Modalità svuotatura con fresa grande e spigoli con fresa piccola
-- 4 - Smusso a V
-- 5 - Finitura con motosega (se la fresa non completa)
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
-- carico librerie
local BeamLib = require( 'BeamLib')
local BeamData = require( 'BeamData')
@@ -29,37 +41,27 @@ end
-------------------------------------------------------------------------------------------------------------
local function CalcMachinedPercentage( Proc, Machining)
local dPercentage = 0
local dBottomElevation = Proc.MainFaces.BottomFace.dElevation
local dBottomPercentage = ( dBottomElevation - Machining[1].ToolInfo.dResidualDepth) / dBottomElevation
local dBottomPercentageLeft = 1 - dBottomPercentage
-- se non ci sono lavorazioni esco subito
if Machining.sTypeMachining == 'None' then
dPercentage = 0
-- Tunnel-4-Through, Groove-3-Through
elseif Proc.Topology.sName == 'Tunnel-4-Through' or Proc.Topology.sName == 'Groove-3-Through' or Proc.Topology.sName == 'Rabbet-2-Through' then
local TunnelAddedFacesElevation = Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Faces[1].dElevation
local dSide1Prercentage = ( ( TunnelAddedFacesElevation * 2) - Machining[2].ToolInfo.dResidualDepth) / ( TunnelAddedFacesElevation * 2)
local dSide2Prercentage = ( ( TunnelAddedFacesElevation * 2) - Machining[3].ToolInfo.dResidualDepth) / ( TunnelAddedFacesElevation * 2)
if Machining.sTypeMachining == 'Bottom' then
dPercentage = dBottomPercentage
elseif Machining.sTypeMachining == 'Side1' then
dPercentage = dSide1Prercentage
elseif Machining.sTypeMachining == 'Side2' then
dPercentage = dSide2Prercentage
elseif Machining.sTypeMachining == 'Bottom-Side1-Side2' then
dPercentage = dBottomPercentage + ( dBottomPercentageLeft * ( dSide1Prercentage + dSide2Prercentage))
elseif Machining.sTypeMachining == 'Bottom-Side1' then
dPercentage = dBottomPercentage + ( dBottomPercentageLeft * dSide1Prercentage)
elseif Machining.sTypeMachining == 'Bottom-Side2' then
dPercentage = dBottomPercentage + ( dBottomPercentageLeft * dSide2Prercentage)
elseif Machining.sTypeMachining == 'Side1-Side2' then
dPercentage = dSide1Prercentage + dSide2Prercentage
end
-- Groove-4-Blind, Groove-3-Blind, Rabbet-2-Through
elseif Proc.Topology.sName == 'Tunnel-4-Blind' or Proc.Topology.sName == 'Groove-3-Blind' then
-- 'Tunnel-4-Blind' : bottom e longface
-- 'Groove-3-Blind' : bottom, longface e sideface
return 0
end
local dPercentage = 0
if Machining[1].bIsApplicable then
dPercentage = ( Machining[1].dElevation - Machining[1].ToolInfo.dResidualDepth) / Machining[1].dElevation
end
if Machining[2].bIsApplicable then
local dAbsPercentage = ( Machining[2].dElevation - Machining[2].ToolInfo.dResidualDepth) / Machining[2].dElevation
dPercentage = dPercentage + ( 1 - dPercentage) * dAbsPercentage
end
if Machining[3].bIsApplicable then
local dAbsPercentage = ( Machining[3].dElevation - Machining[3].ToolInfo.dResidualDepth) / Machining[3].dElevation
dPercentage = dPercentage + ( 1 - dPercentage) * dAbsPercentage
end
if Machining[4].bIsApplicable then
local dAbsPercentage = ( Machining[4].dElevation - Machining[4].ToolInfo.dResidualDepth) / Machining[4].dElevation
dPercentage = dPercentage + ( 1 - dPercentage) * dAbsPercentage
end
return dPercentage * 100
@@ -96,6 +98,12 @@ local function GetBestPocketingStrategy( Proc)
local dFaceWidth = Proc.MainFaces.BottomFace.MainEdges.SideEdges[1].dLength
ToolSearchParameters.sType = 'MILL_NOTIP'
ToolSearchParameters.dMaxToolDiameter = dFaceWidth
elseif Proc.Topology.sName == 'Groove-3-Blind' then
ToolSearchParameters.sType = 'MILL_NOTIP'
ToolSearchParameters.dMaxToolDiameter = Strategy.Parameters.dMaxCornerRadius * 2
elseif Proc.Topology.sName == 'Rabbet-2-Through' then
ToolSearchParameters.sType = 'MILL_NOTIP'
ToolSearchParameters.dMaxToolDiameter = 9999
else
return nil
end
@@ -106,6 +114,31 @@ local function GetBestPocketingStrategy( Proc)
if Proc.Topology.sName ~= 'Tunnel-4-Through' then
ToolSearchParameters.dElevation = Proc.MainFaces.BottomFace.dElevation
ToolSearchParameters.vtToolDirection = Proc.MainFaces.BottomFace.vtN
Milling.idFaceToMachine = Proc.MainFaces.BottomFace.id
Milling.idProc = Proc.id
Milling.vtFaceNormal = Proc.MainFaces.BottomFace.vtN
Milling.dElevation = Proc.MainFaces.BottomFace.dElevation
Milling.ToolInfo = {}
Milling.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
if Milling.ToolInfo.nToolIndex then
Milling.bIsApplicable = true
local ParametersMRR = {}
ParametersMRR.nToolIndex = Milling.ToolInfo.nToolIndex
Milling.dMRR = MachiningLib.GetToolMRR( ParametersMRR)
end
end
table.insert( Machining, Milling)
-- caso speciale 'Rabbet-2-Through' seconda faccia principale
Milling = {}
Milling.bIsApplicable = false
if Proc.Topology.sName == 'Rabbet-2-Through' then
ToolSearchParameters.dElevation = Proc.MainFaces.LongFaces[1].dElevation
ToolSearchParameters.vtToolDirection = Proc.MainFaces.LongFaces[1].vtN
Milling.vtFaceNormal = Proc.MainFaces.LongFaces[1].vtN
Milling.idFaceToMachine = Proc.MainFaces.LongFaces[1].id
Milling.idProc = Proc.id
Milling.dElevation = Proc.MainFaces.LongFaces[1].dElevation
Milling.ToolInfo = {}
Milling.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
if Milling.ToolInfo.nToolIndex then
@@ -121,12 +154,20 @@ local function GetBestPocketingStrategy( Proc)
Milling = {}
Milling.bIsApplicable = false
if Proc.Topology.sName ~= 'Pocket-5-Blind' then
if Proc.Topology.sName == 'Groove-4-Blind' then
ToolSearchParameters.dElevation = Proc.MainFaces.SideFaces[1].dElevation
ToolSearchParameters.vtToolDirection = Proc.MainFaces.SideFaces[1].vtN
else
if Proc.Topology.sName == 'Groove-4-Blind' or Proc.Topology.sName == 'Groove-3-Blind' then
ToolSearchParameters.dElevation = Proc.MainFaces.LongFaces[1].dElevation
ToolSearchParameters.vtToolDirection = Proc.MainFaces.LongFaces[1].vtN
Milling.vtFaceNormal = Proc.MainFaces.LongFaces[1].vtN
Milling.idFaceToMachine = Proc.MainFaces.LongFaces[1].id
Milling.idProc = Proc.id
Milling.dElevation = Proc.MainFaces.LongFaces[1].dElevation
else -- 'Tunnel-4-Through', 'Groove-3-Through', 'Rabbet-2-Through'
ToolSearchParameters.dElevation = ( Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Faces[1].dElevation * 2) + BeamData.MILL_OVERLAP
ToolSearchParameters.vtToolDirection = Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Faces[1].vtN
Milling.vtFaceNormal = Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Faces[1].vtN
Milling.idFaceToMachine = Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Faces[1].id
Milling.idProc = Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.id
Milling.dElevation = ( Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Faces[1].dElevation * 2) + BeamData.MILL_OVERLAP
end
Milling.ToolInfo = {}
Milling.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
@@ -142,9 +183,23 @@ local function GetBestPocketingStrategy( Proc)
-- cerco utensile per lavorare di fianco 2
Milling = {}
Milling.bIsApplicable = false
if Proc.Topology.sName == 'Tunnel-4-Through' or Proc.Topology.sName == 'Groove-3-Through' then
ToolSearchParameters.dElevation = ( Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Faces[1].dElevation * 2) + BeamData.MILL_OVERLAP
ToolSearchParameters.vtToolDirection = -Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Faces[1].vtN
if Proc.Topology.sName ~= 'Pocket-5-Blind' and Proc.Topology.sName ~= 'Groove-4-Blind' then
if Proc.Topology.sName == 'Tunnel-4-Through' or Proc.Topology.sName == 'Groove-3-Through' or Proc.Topology.sName == 'Rabbet-2-Through' then
ToolSearchParameters.dElevation = ( Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Faces[1].dElevation * 2) + BeamData.MILL_OVERLAP
ToolSearchParameters.vtToolDirection = -Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Faces[1].vtN
Milling.vtFaceNormal = -Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Faces[1].vtN
Milling.idFaceToMachine = Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Faces[1].id
Milling.idProc = Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.id
Milling.dElevation = ( Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Faces[1].dElevation * 2) + BeamData.MILL_OVERLAP
Milling.bInvertTool = true
else -- 'Groove-3-Blind'
ToolSearchParameters.dElevation = Proc.MainFaces.SideFaces[1].dElevation
ToolSearchParameters.vtToolDirection = Proc.MainFaces.SideFaces[1].vtN
Milling.vtFaceNormal = Proc.MainFaces.SideFaces[1].vtN
Milling.idFaceToMachine = Proc.MainFaces.SideFaces[1].id
Milling.idProc = Proc.id
Milling.dElevation = Proc.MainFaces.SideFaces[1].dElevation
end
Milling.ToolInfo = {}
Milling.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
if Milling.ToolInfo.nToolIndex then
@@ -163,70 +218,90 @@ local function GetBestPocketingStrategy( Proc)
Strategy.Result.sStatus = 'Completed'
Strategy.Result.nCompletionIndex = FeatureData.GetFeatureCompletionIndex( 100)
Strategy.Result.dMRR = Machining[1].dMRR
Machining[1].ToolInfo.dResidualDepth = 0
Machining[2].bIsApplicable = false
Machining[3].bIsApplicable = false
Machining[4].bIsApplicable = false
return Machining
-- se la 2 completa tutto
elseif Machining[2].bIsApplicable and Machining[2].ToolInfo.dResidualDepth < 10 * GEO.EPS_SMALL then
Machining.sTypeMachining = 'Side1'
-- caso speciale 'Rabbet-2-Through' che ha la sweconda faccia come se fosse una seconda bottom
elseif Proc.Topology.sName == 'Rabbet-2-Through' and Machining[2].bIsApplicable and Machining[2].ToolInfo.dResidualDepth < 10 * GEO.EPS_SMALL then
Machining.sTypeMachining = 'Bottom2'
Strategy.Result.sStatus = 'Completed'
Strategy.Result.nCompletionIndex = FeatureData.GetFeatureCompletionIndex( 100)
Strategy.Result.dMRR = Machining[2].dMRR
Machining[2].ToolInfo.dResidualDepth = 0
Machining[1].bIsApplicable = false
Machining[3].bIsApplicable = false
Machining[4].bIsApplicable = false
return Machining
-- se la 3 completa tutto
elseif Machining[3].bIsApplicable and Machining[2].ToolInfo.dResidualDepth < 10 * GEO.EPS_SMALL then
Machining.sTypeMachining = 'Side2'
elseif Machining[3].bIsApplicable and Machining[3].ToolInfo.dResidualDepth < 10 * GEO.EPS_SMALL then
Machining.sTypeMachining = 'Side1'
Strategy.Result.sStatus = 'Completed'
Strategy.Result.nCompletionIndex = FeatureData.GetFeatureCompletionIndex( 100)
Strategy.Result.dMRR = Machining[3].dMRR
if Proc.MainFaces.TunnelAddedFaces then
Machining[3].ToolInfo.dResidualDepth = -( Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Faces[1].dElevation + BeamData.MILL_OVERLAP)
else
Machining[3].ToolInfo.dResidualDepth = 0
end
Machining[1].bIsApplicable = false
Machining[2].bIsApplicable = false
Machining[4].bIsApplicable = false
return Machining
-- se 2+3 completa tutto
elseif Machining[2].bIsApplicable and Machining[3].bIsApplicable and
Machining[2].ToolInfo.dResidualDepth < Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Faces[1].dElevation + BeamData.MILL_OVERLAP/2 and
Machining[3].ToolInfo.dResidualDepth < Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Faces[1].dElevation + BeamData.MILL_OVERLAP/2 then
Machining.sTypeMachining = 'Side1-Side2'
-- se la 4 completa tutto
elseif Machining[4].bIsApplicable and Machining[4].ToolInfo.dResidualDepth < 10 * GEO.EPS_SMALL then
Machining.sTypeMachining = 'Side2'
Strategy.Result.sStatus = 'Completed'
Strategy.Result.nCompletionIndex = FeatureData.GetFeatureCompletionIndex( 100)
Strategy.Result.dMRR = ( Machining[2].dMRR + Machining[3].dMRR) / 2
Strategy.Result.dMRR = Machining[4].dMRR
if Proc.MainFaces.TunnelAddedFaces then
Machining[4].ToolInfo.dResidualDepth = -( Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Faces[1].dElevation + BeamData.MILL_OVERLAP)
else
Machining[4].ToolInfo.dResidualDepth = 0
end
Machining[1].bIsApplicable = false
Machining[2].bIsApplicable = false
Machining[3].bIsApplicable = false
return Machining
-- se tunnel 2+3 completa tutto
elseif Proc.MainFaces.TunnelAddedFaces and Machining[2].bIsApplicable and Machining[3].bIsApplicable and
Machining[3].ToolInfo.dResidualDepth + Machining[4].ToolInfo.dResidualDepth < (Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Faces[1].dElevation * 2) + BeamData.MILL_OVERLAP then
Machining.sTypeMachining = 'Side1-Side2'
Strategy.Result.sStatus = 'Completed'
Machining[3].ToolInfo.dResidualDepth = Machining[3].ToolInfo.dResidualDepth - Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Faces[1].dElevation
Machining[4].ToolInfo.dResidualDepth = -Machining[3].ToolInfo.dResidualDepth + BeamData.MILL_OVERLAP
Strategy.Result.nCompletionIndex = FeatureData.GetFeatureCompletionIndex( 100)
Strategy.Result.dMRR = ( Machining[3].dMRR + Machining[4].dMRR) / 2
Machining[1].bIsApplicable = false
Machining[2].bIsApplicable = false
return Machining
end
Strategy.Result.sStatus = 'Not-Completed'
if Machining[1].bIsApplicable then
if Machining[2].bIsApplicable then
if Machining[3].bIsApplicable then
Machining.sTypeMachining = 'Bottom-Side1-Side2'
Strategy.Result.dMRR = ( Machining[1].dMRR + Machining[2].dMRR + Machining[3].dMRR) / 3
else
Machining.sTypeMachining = 'Bottom-Side1'
Strategy.Result.dMRR = ( Machining[1].dMRR + Machining[2].dMRR) / 2
end
else
if Machining[3].bIsApplicable then
Machining.sTypeMachining = 'Bottom-Side2'
Strategy.Result.dMRR = ( Machining[1].dMRR + Machining[3].dMRR) / 2
else
Machining.sTypeMachining = 'Bottom'
Strategy.Result.dMRR = Machining[1].dMRR
end
end
else
if Machining[2].bIsApplicable then
if Machining[3].bIsApplicable then
Machining.sTypeMachining = 'Side1-Side2'
Strategy.Result.dMRR = ( Machining[2].dMRR + Machining[3].dMRR) / 2
else
Machining.sTypeMachining = 'Side1'
Strategy.Result.dMRR = Machining[2].dMRR
end
else
if Machining[3].bIsApplicable then
Machining.sTypeMachining = 'Side2'
Strategy.Result.dMRR = Machining[3].dMRR
else
Machining.sTypeMachining = 'None'
Strategy.Result.dMRR = 0
end
end
Machining.sTypeMachining = 'Bottom'
Strategy.Result.dMRR = Machining[1].dMRR
end
if Machining[2].bIsApplicable then
Machining.sTypeMachining = EgtIf( Machining.sTypeMachining == 'None', 'Bottom2', Machining.sTypeMachining .. '-Bottom2')
Strategy.Result.dMRR = Machining[1].dMRR
end
if Machining[3].bIsApplicable then
if Proc.MainFaces.TunnelAddedFaces then
Machining[3].ToolInfo.dResidualDepth = Machining[3].ToolInfo.dResidualDepth - Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Faces[1].dElevation
end
Machining.sTypeMachining = EgtIf( Machining.sTypeMachining == 'None', 'Side1', Machining.sTypeMachining .. '-Side1')
Strategy.Result.dMRR = Machining[1].dMRR
end
if Machining[4].bIsApplicable then
if Proc.MainFaces.TunnelAddedFaces then
Machining[4].ToolInfo.dResidualDepth = Machining[4].ToolInfo.dResidualDepth - Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Faces[1].dElevation
end
Machining.sTypeMachining = EgtIf( Machining.sTypeMachining == 'None', 'Side2', Machining.sTypeMachining .. '-Side2')
Strategy.Result.dMRR = Machining[1].dMRR
end
local dMachinedPrercentage = CalcMachinedPercentage( Proc, Machining)
Strategy.Result.nCompletionIndex = FeatureData.GetFeatureCompletionIndex( dMachinedPrercentage)
Strategy.Result.sInfo = 'Machining not complete, left ' .. tostring( 100-dMachinedPrercentage) .. '%'
@@ -340,42 +415,58 @@ function STR0002.Make( bAddMachining, Proc, Part, CustomParameters)
-- eseguo inserimento in modo da ordinare da X- a X+
table.insert( vAddId, EgtIf( BeamData.RIGHT_LOAD, 1+i, EgtIf( bStartLeft, 1, 2)), AddId)
end
-- setto i parametri di base comuni
Pocketing.nType = MCH_OY.POCKETING
Pocketing.nSubType = EgtIf( Proc.Topology.sName == 'Pocket-5-Blind', MCH_POCK_SUB.SPIRALOUT, MCH_POCK_SUB.SPIRALIN)
Pocketing.LeadIn.nType = MCH_POCK_LI.ZIGZAG
Pocketing.idProc = Proc.id
-- si applicano le lavorazioni
for i = 1, #vAddId do
Pocketing.nToolIndex = ToolInfo.nToolIndex
Pocketing.nType = MCH_OY.POCKETING
Pocketing.Steps.dStep = TOOLS[ToolInfo.nToolIndex].dStep
Pocketing.sDepth = min( 0, -ToolInfo.dResidualDepth)
Pocketing.Steps.dSideStep = TOOLS[ToolInfo.nToolIndex].dSideStep
Pocketing.nSubType = MCH_POCK_SUB.SPIRALOUT
Pocketing.LeadIn.nType = MCH_POCK_LI.ZIGZAG
Pocketing.LeadIn.dTangentDistance = TOOLS[ToolInfo.nToolIndex].dDiameter/2
Pocketing.LeadIn.dElevation = TOOLS[ToolInfo.nToolIndex].dDiameter/2
-- TODO settare parametro per indicare qual è lo spezzone che deve essere fatto dopo il taglio di separazione
for j=1, Proc.nFct do
local vtNSplitFace
_, vtNSplitFace = EgtSurfTmFacetCenter( vAddId[i], j - 1, GDB_ID.ROOT)
if vtNSplitFace and AreSameVectorExact( vtNSplitFace, Proc.MainFaces.BottomFace.vtN) then
Pocketing.idFaceToMachine = j - 1
Pocketing.idProc = vAddId[i]
bApplyMachiningOK, Strategy.Result.sInfo = MachiningLib.AddNewMachining( Pocketing)
break
for j = 1, #Strategy.Machining do
if Strategy.Machining[i].bIsApplicable then
Pocketing.Steps.dStep = TOOLS[Strategy.Machining[j].ToolInfo.nToolIndex].dStep
Pocketing.Steps.dSideStep = TOOLS[Strategy.Machining[j].ToolInfo.nToolIndex].dSideStep
Pocketing.nToolIndex = Strategy.Machining[j].ToolInfo.nToolIndex
Pocketing.LeadIn.dTangentDistance = TOOLS[Strategy.Machining[j].ToolInfo.nToolIndex].dDiameter/2
Pocketing.LeadIn.dElevation = TOOLS[Strategy.Machining[j].ToolInfo.nToolIndex].dDiameter/2
Pocketing.sDepth = -Strategy.Machining[j].ToolInfo.dResidualDepth
if j == 4 then
Pocketing.bToolInvert = true
end
-- TODO settare parametro per indicare qual è lo spezzone che deve essere fatto dopo il taglio di separazione
for k=1, Proc.nFct do
local vtNSplitFace
_, vtNSplitFace = EgtSurfTmFacetCenter( vAddId[i], k - 1, GDB_ID.ROOT)
if vtNSplitFace and AreSameVectorExact( vtNSplitFace, Strategy.Machining[j].vtFaceNormal) then
Pocketing.idFaceToMachine = k - 1
Pocketing.idProc = vAddId[i]
bApplyMachiningOK, Strategy.Result.sInfo = MachiningLib.AddNewMachining( Pocketing)
break
end
end
end
end
end
else
Pocketing.nToolIndex = Strategy.Machining[1].ToolInfo.nToolIndex
Pocketing.nType = MCH_OY.POCKETING
Pocketing.Steps.dStep = TOOLS[Strategy.Machining[1].ToolInfo.nToolIndex].dStep
Pocketing.sDepth = min( 0, -Strategy.Machining[1].ToolInfo.dResidualDepth)
Pocketing.Steps.dSideStep = TOOLS[Strategy.Machining[1].ToolInfo.nToolIndex].dSideStep
Pocketing.nSubType = MCH_POCK_SUB.SPIRALOUT
Pocketing.nSubType = EgtIf( Proc.Topology.sName == 'Pocket-5-Blind', MCH_POCK_SUB.SPIRALOUT, MCH_POCK_SUB.SPIRALIN)
Pocketing.LeadIn.nType = MCH_POCK_LI.ZIGZAG
Pocketing.LeadIn.dTangentDistance = TOOLS[Strategy.Machining[1].ToolInfo.nToolIndex].dDiameter/2
Pocketing.LeadIn.dElevation = TOOLS[Strategy.Machining[1].ToolInfo.nToolIndex].dDiameter/2
Pocketing.idFaceToMachine = Proc.MainFaces.BottomFace.id
Pocketing.idProc = Proc.id
bApplyMachiningOK, Strategy.Result.sInfo = MachiningLib.AddNewMachining( Pocketing)
for i = 1, #Strategy.Machining do
if Strategy.Machining[i].bIsApplicable then
Pocketing.Steps.dStep = TOOLS[Strategy.Machining[i].ToolInfo.nToolIndex].dStep
Pocketing.Steps.dSideStep = TOOLS[Strategy.Machining[i].ToolInfo.nToolIndex].dSideStep
Pocketing.nToolIndex = Strategy.Machining[i].ToolInfo.nToolIndex
Pocketing.LeadIn.dTangentDistance = TOOLS[Strategy.Machining[i].ToolInfo.nToolIndex].dDiameter/2
Pocketing.LeadIn.dElevation = TOOLS[Strategy.Machining[i].ToolInfo.nToolIndex].dDiameter/2
Pocketing.sDepth = -Strategy.Machining[i].ToolInfo.dResidualDepth
if i == 4 and Strategy.Machining[i].bInvertTool then
Pocketing.bToolInvert = true
end
Pocketing.idProc = Strategy.Machining[i].idProc
Pocketing.idFaceToMachine = Strategy.Machining[i].idFaceToMachine
bApplyMachiningOK, Strategy.Result.sInfo = MachiningLib.AddNewMachining( Pocketing)
end
end
end
else
bApplyMachiningOK = false