|
|
|
@@ -15,224 +15,130 @@ local STR0013 = {}
|
|
|
|
|
local Strategy = {}
|
|
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
|
|
|
function GetDrillingStrategy( Proc, Part)
|
|
|
|
|
local function GetDrillingWithMillStrategy( Proc, Part)
|
|
|
|
|
local ToolSearchParameters = {}
|
|
|
|
|
local Machining = {}
|
|
|
|
|
local Milling = { ToolInfo = {}}
|
|
|
|
|
local Milling2 = { ToolInfo = {}}
|
|
|
|
|
|
|
|
|
|
-- se lavorazione orizzontale
|
|
|
|
|
if Proc.FeatureInfo.bIsDrillHorizontal then
|
|
|
|
|
local bDouble = false
|
|
|
|
|
local Drilling = MachiningLib.InitMachiningParameters( MCH_MY.DRILLING)
|
|
|
|
|
Drilling.bIsApplicable = false
|
|
|
|
|
-- si cerca fresa con direzione standard
|
|
|
|
|
ToolSearchParameters = {}
|
|
|
|
|
ToolSearchParameters.dElevation = Proc.FeatureInfo.dDrillLen + BeamData.MILL_OVERLAP
|
|
|
|
|
ToolSearchParameters.vtToolDirection = Proc.FeatureInfo.vtDrillExtrusion
|
|
|
|
|
ToolSearchParameters.dMaxToolDiameter = Proc.FeatureInfo.dDrillDiam + Strategy.Parameters.dDiameterTolerance
|
|
|
|
|
ToolSearchParameters.sType = 'MILL_STD'
|
|
|
|
|
ToolSearchParameters.sMillShape = 'STANDARD'
|
|
|
|
|
Milling.vtToolDirection = -Proc.FeatureInfo.vtDrillExtrusion
|
|
|
|
|
Milling.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
|
|
|
|
|
|
|
|
|
|
-- se foro aperto, si cerca anche fresa con direzione invertita
|
|
|
|
|
if Proc.FeatureInfo.bIsDrillOpen then
|
|
|
|
|
ToolSearchParameters = {}
|
|
|
|
|
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
|
|
|
|
|
Drilling.nType = MCH_MY.DRILLING
|
|
|
|
|
Drilling.nToolIndex = Drilling.ToolInfo.nToolIndex
|
|
|
|
|
Drilling.Geometry = {{ Proc.FeatureInfo.idAddAuxGeom, 0}}
|
|
|
|
|
Drilling.dStep = TOOLS[Drilling.ToolInfo.nToolIndex].dStep
|
|
|
|
|
-- 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
|
|
|
|
|
ToolSearchParameters.vtToolDirection = -Proc.FeatureInfo.vtDrillExtrusion
|
|
|
|
|
ToolSearchParameters.dMaxToolDiameter = Proc.FeatureInfo.dDrillDiam + Strategy.Parameters.dDiameterTolerance
|
|
|
|
|
ToolSearchParameters.sType = 'MILL_STD'
|
|
|
|
|
ToolSearchParameters.sMillShape = 'STANDARD'
|
|
|
|
|
Milling2.vtToolDirection = -Proc.FeatureInfo.vtDrillExtrusion
|
|
|
|
|
Milling2.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local bDouble = false
|
|
|
|
|
-- se ho trovato entrambi gli utensili e non è forzato da eseguire solo da un lato e una punta lo fa completo, si fa foratura in doppio
|
|
|
|
|
if Milling.ToolInfo.nToolIndex and Milling2.ToolInfo.nToolIndex and
|
|
|
|
|
not ( Strategy.Parameters.sDrillingMode == 'PREFER_ONE' and ( Milling.ToolInfo.dResidualDepth < 0 or Milling2.ToolInfo.dResidualDepth < 0)) then
|
|
|
|
|
|
|
|
|
|
bDouble = true
|
|
|
|
|
-- se entrambe le punte lavorano più della metà del foro, si cerca un altro utensile che possa lavorare fino alla metà del foro
|
|
|
|
|
-- è possibile che si possa trovare fresa più corta che lavora a sufficienza
|
|
|
|
|
if Milling.ToolInfo.dResidualDepth < ( Proc.FeatureInfo.dDrillLen - BeamData.MILL_OVERLAP) / 2 and
|
|
|
|
|
Milling2.ToolInfo.dResidualDepth < ( Proc.FeatureInfo.dDrillLen - BeamData.MILL_OVERLAP) / 2 then
|
|
|
|
|
|
|
|
|
|
-- voto
|
|
|
|
|
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)
|
|
|
|
|
Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( 'Drill')
|
|
|
|
|
Strategy.Result.sInfo = ''
|
|
|
|
|
else
|
|
|
|
|
Strategy.Result.sStatus = 'Not-Completed'
|
|
|
|
|
local dMachinedLen = EgtIf( bDouble, Machining[1].sDepth * 2, Proc.FeatureInfo.dDrillLen)
|
|
|
|
|
local dMachinedPrercentage = 100 * ( dMachinedLen / Proc.FeatureInfo.dDrillLen)
|
|
|
|
|
Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( dMachinedPrercentage)
|
|
|
|
|
Strategy.Result.sInfo = 'Machining not complete, left ' .. tostring( 100 - ceil( dMachinedPrercentage)) .. '%'
|
|
|
|
|
Strategy.Result.dMRR = MachiningLib.GetToolMRR( Machining[1].ToolInfo or Machining[2].ToolInfo)
|
|
|
|
|
Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( 'Drill')
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- se lavorazione verticale
|
|
|
|
|
else
|
|
|
|
|
-- si cerca utensile 1
|
|
|
|
|
local Drilling = MachiningLib.InitMachiningParameters( MCH_MY.DRILLING)
|
|
|
|
|
ToolSearchParameters = {}
|
|
|
|
|
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)
|
|
|
|
|
Drilling2.ToolInfo = {}
|
|
|
|
|
if Proc.FeatureInfo.bIsDrillOpen then
|
|
|
|
|
ToolSearchParameters = {}
|
|
|
|
|
ToolSearchParameters.dElevation = Proc.FeatureInfo.dDrillLen + BeamData.MILL_OVERLAP
|
|
|
|
|
ToolSearchParameters.dElevation = ( Proc.FeatureInfo.dDrillLen + BeamData.MILL_OVERLAP) / 2
|
|
|
|
|
ToolSearchParameters.vtToolDirection = Proc.FeatureInfo.vtDrillExtrusion
|
|
|
|
|
ToolSearchParameters.dMaxToolDiameter = Proc.FeatureInfo.dDrillDiam + Strategy.Parameters.dDiameterTolerance
|
|
|
|
|
local HalfMilling = {}
|
|
|
|
|
HalfMilling.ToolInfo = {}
|
|
|
|
|
HalfMilling.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
|
|
|
|
|
|
|
|
|
|
ToolSearchParameters.vtToolDirection = -Proc.FeatureInfo.vtDrillExtrusion
|
|
|
|
|
ToolSearchParameters.dDiameterTolerance = Strategy.Parameters.dDiameterTolerance
|
|
|
|
|
Drilling2.ToolInfo = MachiningLib.FindDrill( Proc, ToolSearchParameters)
|
|
|
|
|
end
|
|
|
|
|
local HalfMilling2 = {}
|
|
|
|
|
HalfMilling2.ToolInfo = {}
|
|
|
|
|
HalfMilling2.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
|
|
|
|
|
|
|
|
|
|
-- 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.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 - dExtraDrill
|
|
|
|
|
table.insert( Machining, Drilling)
|
|
|
|
|
|
|
|
|
|
Drilling2.nType = MCH_MY.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
|
|
|
|
|
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'
|
|
|
|
|
Strategy.Result.nCompletionIndex = 5
|
|
|
|
|
Strategy.Result.dMRR = MachiningLib.GetToolMRR( Machining[1].ToolInfo)
|
|
|
|
|
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 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 = 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'
|
|
|
|
|
Strategy.Result.nCompletionIndex = 5
|
|
|
|
|
Strategy.Result.dMRR = MachiningLib.GetToolMRR( Machining[1].ToolInfo)
|
|
|
|
|
Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( 'Drill')
|
|
|
|
|
Strategy.Result.sInfo = ''
|
|
|
|
|
-- se possono lavorare entrambi
|
|
|
|
|
elseif Drilling.ToolInfo.nToolIndex and Drilling2.ToolInfo.nToolIndex then
|
|
|
|
|
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 = 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'
|
|
|
|
|
local dMachinedLen = Machining[1].sDepth + Machining[2].sDepth
|
|
|
|
|
local dMachinedPrercentage = 100 * ( dMachinedLen / Proc.FeatureInfo.dDrillLen)
|
|
|
|
|
Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( dMachinedPrercentage)
|
|
|
|
|
Strategy.Result.sInfo = 'Machining not complete, left ' .. tostring( 100 - ceil( dMachinedPrercentage)) .. '%'
|
|
|
|
|
else
|
|
|
|
|
Strategy.Result.sStatus = 'Completed'
|
|
|
|
|
Strategy.Result.nCompletionIndex = 5
|
|
|
|
|
Strategy.Result.sInfo = ''
|
|
|
|
|
-- se entrambi gli utensili lavorano in modo completo fino alla metà del foro, li sostituisco a qeulli trovati in precedenza
|
|
|
|
|
if HalfMilling.ToolInfo.dResidualDepth < 0 and HalfMilling2.ToolInfo.dResidualDepth < 0 then
|
|
|
|
|
if Milling.ToolInfo.nToolIndex ~= HalfMilling.ToolInfo.nToolIndex then
|
|
|
|
|
Milling.ToolInfo.nToolIndex, Milling.ToolInfo.dResidualDepth = HalfMilling.ToolInfo.nToolIndex, HalfMilling.ToolInfo.dResidualDepth
|
|
|
|
|
end
|
|
|
|
|
if Milling2.ToolInfo.nToolIndex ~= HalfMilling2.ToolInfo.nToolIndex then
|
|
|
|
|
Milling2.ToolInfo.nToolIndex, Milling2.ToolInfo.dResidualDepth = HalfMilling2.ToolInfo.nToolIndex, HalfMilling2.ToolInfo.dResidualDepth
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- voto
|
|
|
|
|
Strategy.Result.dMRR = MachiningLib.GetToolMRR( Machining[1].ToolInfo)
|
|
|
|
|
Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( 'Drill')
|
|
|
|
|
-- se utensile 1 non completo
|
|
|
|
|
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'
|
|
|
|
|
local dMachinedLen = Machining[1].sDepth
|
|
|
|
|
local dMachinedPrercentage = 100 * ( dMachinedLen / Proc.FeatureInfo.dDrillLen)
|
|
|
|
|
Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( dMachinedPrercentage)
|
|
|
|
|
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')
|
|
|
|
|
-- se utensile 2 non completo
|
|
|
|
|
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 = 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'
|
|
|
|
|
local dMachinedLen = Machining[1].sDepth
|
|
|
|
|
local dMachinedPrercentage = 100 * ( dMachinedLen / Proc.FeatureInfo.dDrillLen)
|
|
|
|
|
Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( dMachinedPrercentage)
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
local dResidual = Proc.FeatureInfo.dDrillLen
|
|
|
|
|
-- aggiunta lavorazioni a lista
|
|
|
|
|
-- se foro doppio
|
|
|
|
|
if bDouble then
|
|
|
|
|
dResidual = Milling.ToolInfo.dResidualDepth + Milling2.ToolInfo.dResidualDepth
|
|
|
|
|
Strategy.Result.dMRR = ( MachiningLib.GetToolMRR( Milling.ToolInfo) + MachiningLib.GetToolMRR( Milling2.ToolInfo)) / 2
|
|
|
|
|
local dExtraDrill = ( Proc.FeatureInfo.dDrillLen - BeamData.MILL_OVERLAP - ( Milling.ToolInfo.dResidualDepth + Milling2.ToolInfo.dResidualDepth)) / 2
|
|
|
|
|
Milling.sDepth = Proc.FeatureInfo.dDrillLen - Drilling.ToolInfo.dResidualDepth - dExtraDrill
|
|
|
|
|
table.insert( Machining, Milling)
|
|
|
|
|
Milling2.sDepth = Proc.FeatureInfo.dDrillLen - Drilling.ToolInfo.dResidualDepth - dExtraDrill
|
|
|
|
|
table.insert( Machining, Milling2)
|
|
|
|
|
-- altrimenti singolo
|
|
|
|
|
else
|
|
|
|
|
local BestMilling
|
|
|
|
|
if not Milling.ToolInfo.nToolIndex then
|
|
|
|
|
BestMilling = Milling2
|
|
|
|
|
elseif not Milling2.ToolInfo.nToolIndex then
|
|
|
|
|
BestMilling = Milling
|
|
|
|
|
else
|
|
|
|
|
if Milling.ToolInfo.dResidualDepth < 0 then
|
|
|
|
|
BestMilling = Milling
|
|
|
|
|
elseif Milling2.ToolInfo.dResidualDepth < 0 then
|
|
|
|
|
BestMilling = Milling2
|
|
|
|
|
else
|
|
|
|
|
BestMilling = EgtIf( Milling.ToolInfo.dResidualDepth < Milling2.ToolInfo.dResidualDepth, Milling, Milling2)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if BestMilling.ToolInfo.nToolIndex then
|
|
|
|
|
dResidual = BestMilling.ToolInfo.dResidualDepth
|
|
|
|
|
if dResidual < 0 then
|
|
|
|
|
BestMilling.sDepth = Proc.FeatureInfo.dDrillLen + EgtIf( Proc.FeatureInfo.bIsDrillOpen, MILL_OVERLAP, 0)
|
|
|
|
|
else
|
|
|
|
|
BestMilling.sDepth = Proc.FeatureInfo.dDrillLen - BestMilling.ToolInfo.dResidualDepth
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
Strategy.Result.dMRR = MachiningLib.GetToolMRR( BestMilling.ToolInfo)
|
|
|
|
|
table.insert( Machining, BestMilling)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- se c'è almeno una lavorazione, si calcola voto
|
|
|
|
|
if #Machining > 0 then
|
|
|
|
|
if dResidual < 0 then
|
|
|
|
|
Strategy.Result.sStatus = 'Completed'
|
|
|
|
|
Strategy.Result.nCompletionIndex = 5
|
|
|
|
|
Strategy.Result.sInfo = ''
|
|
|
|
|
Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( 'Mill')
|
|
|
|
|
else
|
|
|
|
|
Strategy.Result.sStatus = 'Not-Completed'
|
|
|
|
|
local dResidualPrercentage = 100 * ( dResidual / Proc.FeatureInfo.dDrillLen)
|
|
|
|
|
Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( 100 - dResidualPrercentage)
|
|
|
|
|
Strategy.Result.sInfo = 'Machining not complete, left ' .. tostring( ceil( dResidualPrercentage)) .. '%'
|
|
|
|
|
Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( 'Mill')
|
|
|
|
|
end
|
|
|
|
|
-- se son state trovate frese compatibili
|
|
|
|
|
else
|
|
|
|
|
local sMessage = 'Mill not found'
|
|
|
|
|
Strategy.Result = FeatureLib.GetStrategyResultNotApplicable( sMessage)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return Machining, Strategy.Result
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@@ -248,12 +154,41 @@ function STR0013.Make( bAddMachining, Proc, Part, CustomParameters)
|
|
|
|
|
|
|
|
|
|
local bAreAllMachiningsAdded
|
|
|
|
|
|
|
|
|
|
Strategy.Machinings, Strategy.Result = GetDrillingStrategy( Proc, Part)
|
|
|
|
|
Strategy.Machinings, Strategy.Result = GetDrillingWithMillStrategy( Proc, Part)
|
|
|
|
|
|
|
|
|
|
if bAddMachining and Strategy.Result.sStatus ~= 'Not-Applicable' then
|
|
|
|
|
-- aggiunge lavorazione
|
|
|
|
|
for j = 1, #Strategy.Machinings do
|
|
|
|
|
bAreAllMachiningsAdded = MachiningLib.AddMachinings( Proc, Strategy.Machinings[j])
|
|
|
|
|
local MachiningToAdd
|
|
|
|
|
local nIndexTool = Strategy.Machinings[j].ToolInfo.nToolIndex
|
|
|
|
|
-- se fresa più grande del diametro foro si fa foratura con fresa (se ammesso)
|
|
|
|
|
if TOOLS[nIndexTool].dDiameter >= Proc.FeatureInfo.dDrillDiam and Strategy.Parameters.bUseMillAsDrill then
|
|
|
|
|
MachiningToAdd = MachiningLib.InitMachiningParameters( MCH_MY.DRILLING)
|
|
|
|
|
MachiningToAdd = BeamLib.MergeTables( MachiningToAdd, Strategy.Machinings[j])
|
|
|
|
|
MachiningToAdd.Steps.dStep = TOOLS[nIndexTool].dStep / 3
|
|
|
|
|
-- se diametro foro più grande della fresa, ma non oltre il doppio del diametro, si fa contornatura a spirale
|
|
|
|
|
elseif Proc.FeatureInfo.dDrillDiam < ( TOOLS[nIndexTool].dDiameter * 0.75) * 2 then
|
|
|
|
|
MachiningToAdd = MachiningLib.InitMachiningParameters( MCH_MY.MILLING)
|
|
|
|
|
MachiningToAdd = BeamLib.MergeTables( MachiningToAdd, Strategy.Machinings[j])
|
|
|
|
|
-- il diametro deve essere almeno 1mm più grande del foro, altrimenti la macchina non riesce ad interpolare
|
|
|
|
|
MachiningToAdd.dRadialOffset = min( 0, Proc.FeatureInfo.dDrillDiam - ( TOOLS[nIndexTool].dDiameter + 1))
|
|
|
|
|
MachiningToAdd.nSubType = MCH_MILL_ST.SPIRAL
|
|
|
|
|
MachiningToAdd.Steps.dStep = TOOLS[nIndexTool].dStep
|
|
|
|
|
-- se diametro foro più grande del doppio del diametro fresa, si fa svuotatura
|
|
|
|
|
else
|
|
|
|
|
MachiningToAdd = MachiningLib.InitMachiningParameters( MCH_MY.POCKETING)
|
|
|
|
|
MachiningToAdd = BeamLib.MergeTables( MachiningToAdd, Strategy.Machinings[j])
|
|
|
|
|
MachiningToAdd.Steps.dStep = TOOLS[nIndexTool].dStep
|
|
|
|
|
MachiningToAdd.Steps.dSideStep = TOOLS[nIndexTool].dSideStep
|
|
|
|
|
MachiningToAdd.nSubType = MCH_POCK_SUB.SPIRALOUT
|
|
|
|
|
MachiningToAdd.LeadIn.nType = MCH_POCK_LI.HELIX
|
|
|
|
|
MachiningToAdd.LeadIn.dTangentDistance = TOOLS[nIndexTool].dDiameter / 2
|
|
|
|
|
MachiningToAdd.LeadIn.dElevation = MachiningToAdd.Steps.dStep / 2
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
MachiningToAdd.nToolIndex = nIndexTool
|
|
|
|
|
MachiningToAdd.Geometry = {{ Proc.FeatureInfo.idAddAuxGeom, -1}}
|
|
|
|
|
bAreAllMachiningsAdded = MachiningLib.AddMachinings( Proc, MachiningToAdd)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|