|
|
|
@@ -14,16 +14,13 @@ local FeatureLib = require( 'FeatureLib')
|
|
|
|
|
local STR0011 = {}
|
|
|
|
|
local Strategy = {}
|
|
|
|
|
|
|
|
|
|
-- TODO Da fare completamente gestione foratura doppia con 2 teste
|
|
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
|
|
|
function GetDrillingStrategy( Proc, Part)
|
|
|
|
|
local ToolSearchParameters = {}
|
|
|
|
|
local Machining = {}
|
|
|
|
|
|
|
|
|
|
-- TODO SISTEMARE!! Gestione foratura doppia con 2 teste da fare
|
|
|
|
|
-- TODO se non trova foratura, cercare tra le frese
|
|
|
|
|
-- TODO se foratura non completa, provare a cercare tra le frese
|
|
|
|
|
|
|
|
|
|
-- se lavorazione orizzontale
|
|
|
|
|
if Proc.FeatureInfo.bIsDrillHorizontal then
|
|
|
|
|
local bDouble = false
|
|
|
|
@@ -33,6 +30,7 @@ function GetDrillingStrategy( Proc, Part)
|
|
|
|
|
ToolSearchParameters.dElevation = Proc.FeatureInfo.dDrillLen + BeamData.MILL_OVERLAP
|
|
|
|
|
ToolSearchParameters.vtToolDirection = Proc.FeatureInfo.vtDrillExtrusion
|
|
|
|
|
ToolSearchParameters.dToolDiameter = Proc.FeatureInfo.dDrillDiam
|
|
|
|
|
ToolSearchParameters.dDiameterTolerance = Strategy.Parameters.dDiameterTolerance
|
|
|
|
|
Drilling.ToolInfo = {}
|
|
|
|
|
Drilling.ToolInfo = MachiningLib.FindDrill( Proc, ToolSearchParameters)
|
|
|
|
|
if Drilling.ToolInfo.nToolIndex then
|
|
|
|
@@ -40,26 +38,30 @@ function GetDrillingStrategy( Proc, Part)
|
|
|
|
|
Drilling.nToolIndex = Drilling.ToolInfo.nToolIndex
|
|
|
|
|
Drilling.Geometry = {{ Proc.FeatureInfo.idAddAuxGeom, 0}}
|
|
|
|
|
Drilling.dStep = TOOLS[Drilling.ToolInfo.nToolIndex].dStep
|
|
|
|
|
-- se lavorazione non completa
|
|
|
|
|
if Drilling.ToolInfo.dResidualDepth > 10 * GEO.EPS_SMALL then
|
|
|
|
|
-- se lavorazione non completa o se si deve forare dai due lati
|
|
|
|
|
if Proc.FeatureInfo.bIsDrillOpen and
|
|
|
|
|
( Drilling.ToolInfo.dResidualDepth > 10 * GEO.EPS_SMALL or Strategy.Parameters.sDrillingMode == 'FORCE_TWO' or Strategy.Parameters.sDrillingMode == 'AUTO') then
|
|
|
|
|
bDouble = true
|
|
|
|
|
local dHalfDrill = ( Proc.FeatureInfo.dDrillLen + BeamData.MILL_OVERLAP) / 2
|
|
|
|
|
Drilling.sDepth = min( dHalfDrill, Proc.FeatureInfo.dDrillLen - Drilling.ToolInfo.dResidualDepth)
|
|
|
|
|
Drilling.vtFaceNormal = Proc.FeatureInfo.vtDrillExtrusion
|
|
|
|
|
Drilling.bInvert = false
|
|
|
|
|
Drilling.vtToolDirection = Proc.FeatureInfo.vtDrillExtrusion
|
|
|
|
|
table.insert( Machining, Drilling)
|
|
|
|
|
local Drilling2 = BeamLib.TableCopyDeep( Drilling)
|
|
|
|
|
Drilling2.bInvert = true
|
|
|
|
|
Drilling2.vtToolDirection = -Proc.FeatureInfo.vtDrillExtrusion
|
|
|
|
|
table.insert( Machining, Drilling2)
|
|
|
|
|
else
|
|
|
|
|
Drilling.sDepth = 'TH'
|
|
|
|
|
Drilling.vtFaceNormal = Proc.FeatureInfo.vtDrillExtrusion
|
|
|
|
|
Drilling.bInvert = false
|
|
|
|
|
Drilling.vtToolDirection = Proc.FeatureInfo.vtDrillExtrusion
|
|
|
|
|
table.insert( Machining, Drilling)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- voto
|
|
|
|
|
if Drilling.ToolInfo.dResidualDepth < 0 or Proc.FeatureInfo.dDrillLen / 2 > Drilling.ToolInfo.dResidualDepth then
|
|
|
|
|
if Drilling.ToolInfo.dResidualDepth < 0 or ( Proc.FeatureInfo.dDrillLen + BeamData.MILL_OVERLAP) / 2 > Drilling.ToolInfo.dResidualDepth then
|
|
|
|
|
Strategy.Result.sStatus = 'Completed'
|
|
|
|
|
Strategy.Result.nCompletionIndex = 5
|
|
|
|
|
Strategy.Result.dMRR = MachiningLib.GetToolMRR( Machining[1].ToolInfo or Machining[2].ToolInfo)
|
|
|
|
@@ -83,22 +85,54 @@ function GetDrillingStrategy( Proc, Part)
|
|
|
|
|
ToolSearchParameters.dElevation = Proc.FeatureInfo.dDrillLen + BeamData.MILL_OVERLAP
|
|
|
|
|
ToolSearchParameters.vtToolDirection = Proc.FeatureInfo.vtDrillExtrusion
|
|
|
|
|
ToolSearchParameters.dToolDiameter = Proc.FeatureInfo.dDrillDiam
|
|
|
|
|
ToolSearchParameters.dDiameterTolerance = Strategy.Parameters.dDiameterTolerance
|
|
|
|
|
Drilling.ToolInfo = {}
|
|
|
|
|
Drilling.ToolInfo = MachiningLib.FindDrill( Proc, ToolSearchParameters)
|
|
|
|
|
-- si cerca utensile 2
|
|
|
|
|
local Drilling2 = MachiningLib.InitMachiningParameters( MCH_MY.DRILLING)
|
|
|
|
|
ToolSearchParameters = {}
|
|
|
|
|
ToolSearchParameters.dElevation = Proc.FeatureInfo.dDrillLen + BeamData.MILL_OVERLAP
|
|
|
|
|
ToolSearchParameters.vtToolDirection = -Proc.FeatureInfo.vtDrillExtrusion
|
|
|
|
|
Drilling2.ToolInfo = {}
|
|
|
|
|
Drilling2.ToolInfo = MachiningLib.FindDrill( Proc, ToolSearchParameters)
|
|
|
|
|
if Proc.FeatureInfo.bIsDrillOpen then
|
|
|
|
|
ToolSearchParameters = {}
|
|
|
|
|
ToolSearchParameters.dElevation = Proc.FeatureInfo.dDrillLen + BeamData.MILL_OVERLAP
|
|
|
|
|
ToolSearchParameters.vtToolDirection = -Proc.FeatureInfo.vtDrillExtrusion
|
|
|
|
|
ToolSearchParameters.dDiameterTolerance = Strategy.Parameters.dDiameterTolerance
|
|
|
|
|
Drilling2.ToolInfo = MachiningLib.FindDrill( Proc, ToolSearchParameters)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- se possono lavorare entrambi e si deve fare lavorazione doppia e si riesce a completare
|
|
|
|
|
if Drilling.ToolInfo.nToolIndex and Drilling2.ToolInfo.nToolIndex and
|
|
|
|
|
( Strategy.Parameters.sDrillingMode == 'FORCE_TWO' or Strategy.Parameters.sDrillingMode == 'AUTO') and
|
|
|
|
|
Drilling.ToolInfo.dResidualDepth + Drilling2.ToolInfo.dResidualDepth < Proc.FeatureInfo.dDrillLen then
|
|
|
|
|
|
|
|
|
|
local dExtraDrill = ( Proc.FeatureInfo.dDrillLen - BeamData.MILL_OVERLAP - ( Drilling.ToolInfo.dResidualDepth + Drilling2.ToolInfo.dResidualDepth)) / 2
|
|
|
|
|
Drilling.nToolIndex = Drilling.ToolInfo.nToolIndex
|
|
|
|
|
Drilling.Geometry = {{ Proc.FeatureInfo.idAddAuxGeom, 0}}
|
|
|
|
|
Drilling.vtToolDirection = Proc.FeatureInfo.vtDrillExtrusion
|
|
|
|
|
Drilling.sDepth = Proc.FeatureInfo.dDrillLen - Drilling.ToolInfo.dResidualDepth - dExtraDrill
|
|
|
|
|
table.insert( Machining, Drilling)
|
|
|
|
|
|
|
|
|
|
Drilling2.nToolIndex = Drilling2.ToolInfo.nToolIndex
|
|
|
|
|
Drilling2.Geometry = {{ Proc.FeatureInfo.idAddAuxGeom, 0}}
|
|
|
|
|
Drilling2.bInvert = true
|
|
|
|
|
Drilling2.vtToolDirection = -Proc.FeatureInfo.vtDrillExtrusion
|
|
|
|
|
Drilling2.sDepth = Proc.FeatureInfo.dDrillLen - Drilling2.ToolInfo.dResidualDepth - dExtraDrill
|
|
|
|
|
table.insert( Machining, Drilling2)
|
|
|
|
|
|
|
|
|
|
-- voto
|
|
|
|
|
Strategy.Result.sStatus = 'Completed'
|
|
|
|
|
Strategy.Result.nCompletionIndex = 5
|
|
|
|
|
Strategy.Result.sInfo = ''
|
|
|
|
|
Strategy.Result.dMRR = MachiningLib.GetToolMRR( Machining[1].ToolInfo)
|
|
|
|
|
Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( 'Drill')
|
|
|
|
|
|
|
|
|
|
-- se utensile 1 esegue completamente
|
|
|
|
|
if Drilling.ToolInfo.nToolIndex and Drilling.ToolInfo.dResidualDepth < 10 * GEO.EPS_SMALL then
|
|
|
|
|
elseif Drilling.ToolInfo.nToolIndex and Drilling.ToolInfo.dResidualDepth < 10 * GEO.EPS_SMALL and
|
|
|
|
|
( Strategy.Parameters.sDrillingMode == 'PREFER_ONE' or ( not Drilling2.ToolInfo.nToolIndex and Strategy.Parameters.sDrillingMode == 'AUTO') or not Proc.FeatureInfo.bIsDrillOpen) then
|
|
|
|
|
Drilling.sDepth = 'TH'
|
|
|
|
|
Drilling.nType = MCH_MY.DRILLING
|
|
|
|
|
Drilling.nToolIndex = Drilling.ToolInfo.nToolIndex
|
|
|
|
|
Drilling.Geometry = {{ Proc.FeatureInfo.idAddAuxGeom, 0}}
|
|
|
|
|
Drilling.vtToolDirection = Proc.FeatureInfo.vtDrillExtrusion
|
|
|
|
|
table.insert( Machining, Drilling)
|
|
|
|
|
-- voto
|
|
|
|
|
Strategy.Result.sStatus = 'Completed'
|
|
|
|
@@ -107,12 +141,13 @@ function GetDrillingStrategy( Proc, Part)
|
|
|
|
|
Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( 'Drill')
|
|
|
|
|
Strategy.Result.sInfo = ''
|
|
|
|
|
-- se utensile 2 esegue completamente
|
|
|
|
|
elseif Drilling2.ToolInfo.nToolIndex and Drilling2.ToolInfo.dResidualDepth < 10 * GEO.EPS_SMALL then
|
|
|
|
|
elseif Drilling2.ToolInfo.nToolIndex and Drilling2.ToolInfo.dResidualDepth < 10 * GEO.EPS_SMALL and
|
|
|
|
|
( Strategy.Parameters.sDrillingMode == 'PREFER_ONE' or ( not Drilling.ToolInfo.nToolIndex and Strategy.Parameters.sDrillingMode == 'AUTO')) then
|
|
|
|
|
Drilling2.sDepth = 'TH'
|
|
|
|
|
Drilling2.nType = MCH_MY.DRILLING
|
|
|
|
|
Drilling2.nToolIndex = Drilling.ToolInfo.nToolIndex
|
|
|
|
|
Drilling2.nToolIndex = Drilling2.ToolInfo.nToolIndex
|
|
|
|
|
Drilling2.Geometry = {{ Proc.FeatureInfo.idAddAuxGeom, 0}}
|
|
|
|
|
Drilling2.bInvert = true
|
|
|
|
|
Drilling2.vtToolDirection = -Proc.FeatureInfo.vtDrillExtrusion
|
|
|
|
|
table.insert( Machining, Drilling2)
|
|
|
|
|
-- voto
|
|
|
|
|
Strategy.Result.sStatus = 'Completed'
|
|
|
|
@@ -125,12 +160,15 @@ function GetDrillingStrategy( Proc, Part)
|
|
|
|
|
Drilling.nType = MCH_MY.DRILLING
|
|
|
|
|
Drilling.nToolIndex = Drilling.ToolInfo.nToolIndex
|
|
|
|
|
Drilling.Geometry = {{ Proc.FeatureInfo.idAddAuxGeom, 0}}
|
|
|
|
|
Drilling.vtToolDirection = Proc.FeatureInfo.vtDrillExtrusion
|
|
|
|
|
Drilling.sDepth = Proc.FeatureInfo.dDrillLen - Drilling.ToolInfo.dResidualDepth
|
|
|
|
|
table.insert( Machining, Drilling)
|
|
|
|
|
|
|
|
|
|
Drilling2.nType = MCH_MY.DRILLING
|
|
|
|
|
Drilling2.nToolIndex = Drilling.ToolInfo.nToolIndex
|
|
|
|
|
Drilling2.nToolIndex = Drilling2.ToolInfo.nToolIndex
|
|
|
|
|
Drilling2.Geometry = {{ Proc.FeatureInfo.idAddAuxGeom, 0}}
|
|
|
|
|
Drilling2.bInvert = true
|
|
|
|
|
Drilling2.vtToolDirection = -Proc.FeatureInfo.vtDrillExtrusion
|
|
|
|
|
Drilling2.sDepth = Proc.FeatureInfo.dDrillLen - Drilling2.ToolInfo.dResidualDepth
|
|
|
|
|
table.insert( Machining, Drilling2)
|
|
|
|
|
if Drilling.ToolInfo.dResidualDepth + Drilling2.ToolInfo.dResidualDepth < Proc.FeatureInfo.dDrillLen then
|
|
|
|
|
Strategy.Result.sStatus = 'Not-Completed'
|
|
|
|
@@ -147,11 +185,13 @@ function GetDrillingStrategy( Proc, Part)
|
|
|
|
|
Strategy.Result.dMRR = MachiningLib.GetToolMRR( Machining[1].ToolInfo)
|
|
|
|
|
Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( 'Drill')
|
|
|
|
|
-- se utensile 1 non completo
|
|
|
|
|
elseif Drilling.ToolInfo.nToolIndex then
|
|
|
|
|
elseif Drilling.ToolInfo.nToolIndex and ( Strategy.Parameters.sDrillingMode ~= 'FORCE_TWO' or Proc.FeatureInfo.bIsDrillOpen) then
|
|
|
|
|
Drilling.sDepth = Proc.FeatureInfo.dDrillLen - Drilling.ToolInfo.dResidualDepth
|
|
|
|
|
Drilling.nType = MCH_MY.DRILLING
|
|
|
|
|
Drilling.nToolIndex = Drilling.ToolInfo.nToolIndex
|
|
|
|
|
Drilling.Geometry = {{ Proc.FeatureInfo.idAddAuxGeom, 0}}
|
|
|
|
|
Drilling.vtToolDirection = Proc.FeatureInfo.vtDrillExtrusion
|
|
|
|
|
Drilling.sDepth = Proc.FeatureInfo.dDrillLen - Drilling.ToolInfo.dResidualDepth
|
|
|
|
|
table.insert( Machining, Drilling)
|
|
|
|
|
-- voto
|
|
|
|
|
Strategy.Result.sStatus = 'Not-Completed'
|
|
|
|
@@ -162,12 +202,13 @@ function GetDrillingStrategy( Proc, Part)
|
|
|
|
|
Strategy.Result.dMRR = MachiningLib.GetToolMRR( Machining[1].ToolInfo)
|
|
|
|
|
Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( 'Drill')
|
|
|
|
|
-- se utensile 2 non completo
|
|
|
|
|
elseif Drilling2.ToolInfo.nToolIndex then
|
|
|
|
|
elseif Drilling2.ToolInfo.nToolIndex and Strategy.Parameters.sDrillingMode ~= 'FORCE_TWO' then
|
|
|
|
|
Drilling2.sDepth = Proc.FeatureInfo.dDrillLen - Drilling2.ToolInfo.dResidualDepth
|
|
|
|
|
Drilling2.nType = MCH_MY.DRILLING
|
|
|
|
|
Drilling2.nToolIndex = Drilling.ToolInfo.nToolIndex
|
|
|
|
|
Drilling2.nToolIndex = Drilling2.ToolInfo.nToolIndex
|
|
|
|
|
Drilling2.Geometry = {{ Proc.FeatureInfo.idAddAuxGeom, 0}}
|
|
|
|
|
Drilling2.bInvert = true
|
|
|
|
|
Drilling2.vtToolDirection = -Proc.FeatureInfo.vtDrillExtrusion
|
|
|
|
|
Drilling2.sDepth = Proc.FeatureInfo.dDrillLen - Drilling2.ToolInfo.dResidualDepth
|
|
|
|
|
table.insert( Machining, Drilling2)
|
|
|
|
|
-- voto
|
|
|
|
|
Strategy.Result.sStatus = 'Not-Completed'
|
|
|
|
@@ -177,6 +218,16 @@ function GetDrillingStrategy( Proc, Part)
|
|
|
|
|
Strategy.Result.sInfo = 'Machining not complete, left ' .. tostring( 100 - ceil( dMachinedPrercentage)) .. '%'
|
|
|
|
|
Strategy.Result.dMRR = MachiningLib.GetToolMRR( Machining[1].ToolInfo)
|
|
|
|
|
Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( 'Drill')
|
|
|
|
|
else
|
|
|
|
|
local sMessage
|
|
|
|
|
-- se non sono state trovate punte
|
|
|
|
|
if not Drilling.ToolInfo.nToolIndex and not Drilling2.ToolInfo.nToolIndex then
|
|
|
|
|
sMessage = 'Drillbit not found'
|
|
|
|
|
-- se son state trovate delle punte, ma non è stato possibile forare da entrambe le parti
|
|
|
|
|
elseif Strategy.Parameters.sDrillingMode == 'FORCE_TWO' then
|
|
|
|
|
sMessage = "Not possible to force machining from both sides. Please change drilling mode to AUTO"
|
|
|
|
|
end
|
|
|
|
|
Strategy.Result = FeatureLib.GetStrategyResultNotApplicable( sMessage)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return Machining, Strategy.Result
|
|
|
|
@@ -199,6 +250,7 @@ function STR0011.Make( bAddMachining, Proc, Part, CustomParameters)
|
|
|
|
|
if bAddMachining and Strategy.Result.sStatus ~= 'Not-Applicable' then
|
|
|
|
|
-- aggiunge lavorazione
|
|
|
|
|
for j = 1, #Strategy.Machinings do
|
|
|
|
|
Strategy.Machinings[j].Steps.dStep = TOOLS[Strategy.Machinings[j].ToolInfo.nToolIndex].dStep
|
|
|
|
|
bAreAllMachiningsAdded = MachiningLib.AddMachinings( Proc, Strategy.Machinings[j])
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|