105 lines
4.1 KiB
Lua
105 lines
4.1 KiB
Lua
-- Strategia: STR0002
|
|
-- Descrizione
|
|
-- Svuotatura tasca
|
|
-- Feature:
|
|
-- Slot
|
|
-- FrontSlot
|
|
-- IsRidgeLap
|
|
-- IsLapJoint
|
|
-- IsNotchRabbet
|
|
-- IsNotch
|
|
-- IsPocket
|
|
-- Topology: 'Pocket-5-Blind'
|
|
|
|
-- carico librerie
|
|
local BeamLib = require( 'BeamLib')
|
|
local BeamData = require( 'BeamData')
|
|
local MachLib = require( 'MachiningLib')
|
|
local FeatureData = require( 'FeatureData')
|
|
|
|
-- Tabella per definizione modulo
|
|
local STR0002 = {}
|
|
local Strategy = {}
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
local function IsTopologyOk( Proc)
|
|
if Proc.Topology.sName == 'Pocket-5-Blind' then
|
|
return true
|
|
else
|
|
return false
|
|
end
|
|
end
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
function STR0002.Make( AddMachining, Proc, Part, CustomParameters)
|
|
-- carico parametri de default e li aggiorno con quelli passati dal chiamante (potrebbero non essere congruenti)
|
|
local StrategyLib = {}
|
|
StrategyLib.Config = require( 'STR0002\\STR0002Config')
|
|
Strategy.sName = StrategyLib.Config.sStrategyId
|
|
CustomParameters = BeamLib.GetUpdateCustomParameters( CustomParameters, StrategyLib.Config.Parameters)
|
|
Strategy.Parameters = BeamLib.LoadCustomParametersInStrategy( CustomParameters)
|
|
Strategy.RatingResult = {}
|
|
|
|
if not IsTopologyOk( Proc) then
|
|
local sErr = 'Feature '.. Proc.idFeature .. ' : strategy ' .. Strategy.Config.sStrategyId .. ' not implemented'
|
|
EgtOutLog( sErr)
|
|
return false, sErr
|
|
end
|
|
|
|
local ToolInfo = {}
|
|
|
|
-- serve utensile che possa lavorare di testa
|
|
local sMillType = 'MILL_STD'
|
|
local sMillShape = 'STANDARD'
|
|
local dMaxToolDiameter = min( Strategy.Parameters.dMaxCornerRadius * 2, Proc.MainFaces.BottomFace.dHeight, Proc.MainFaces.BottomFace.dWidth)
|
|
local dElevation = Proc.MainFaces.BottomFace.dElevation
|
|
|
|
-- cerco utensile
|
|
ToolInfo = MachLib.FindMill( Proc, sMillType, sMillShape, dMaxToolDiameter, dElevation, Proc.MainFaces.BottomFace.vtN)
|
|
|
|
|
|
|
|
|
|
if ToolInfo.idTool and TOOLS[ToolInfo.idTool].sName then
|
|
if ToolInfo.dMaxMatReduction < 0 then
|
|
Strategy.RatingResult.sStatus = 'Not-Completed'
|
|
else
|
|
Strategy.RatingResult.sStatus = 'Completed'
|
|
end
|
|
Strategy.RatingResult.dCompletionIndex = min( 100, ( ( dElevation + ToolInfo.dMaxMatReduction) / dElevation) * 100)
|
|
Strategy.RatingResult.dRating = FeatureData.GetFeatureRating( 'Mill', Strategy.RatingResult.dCompletionIndex)
|
|
Strategy.RatingResult.sInfo = ''
|
|
|
|
-- se richiesto applico lavorazione
|
|
if AddMachining then
|
|
-- TODO gestione spezzatura da completare
|
|
-- le lunghezza richiede spezzatura
|
|
if ( Proc.b3Box:getDimX() > BeamData.LONGCUT_MAXLEN) or ( Proc.b3Box:getDimX() > 0.7 * Part.b3Solid:getDimX() and Proc.b3Box:getDimX() > BeamData.LONGCUT_ENDLEN) then
|
|
|
|
else
|
|
EgtCreateMachining( 'Svuotatura', MCH_OY.POCKETING, TOOLS[ToolInfo.idTool].sName)
|
|
EgtSetMachiningParam( MCH_MP.STEP, TOOLS[ToolInfo.idTool].dStep)
|
|
EgtSetMachiningParam( MCH_MP.DEPTH, min( 0, ToolInfo.dMaxMatReduction))
|
|
EgtSetMachiningParam( MCH_MP.SIDESTEP, TOOLS[ToolInfo.idTool].dSideStep)
|
|
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALOUT)
|
|
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_POCK_LI.ZIGZAG)
|
|
EgtSetMachiningParam( MCH_MP.LITANG, TOOLS[ToolInfo.idTool].dDiameter/2)
|
|
EgtSetMachiningParam( MCH_MP.LIELEV, TOOLS[ToolInfo.idTool].dDiameter/2)
|
|
EgtSetMachiningGeometry( {{ Proc.Id, Proc.MainFaces.BottomFace.Id}})
|
|
EgtApplyMachining( true, true)
|
|
end
|
|
end
|
|
else
|
|
Strategy.RatingResult.sStatus = 'Not-Applicable'
|
|
Strategy.RatingResult.dCompletionIndex = 0
|
|
Strategy.RatingResult.dRating = 0
|
|
Strategy.RatingResult.sInfo = 'Mill not found'
|
|
end
|
|
|
|
|
|
return Strategy.RatingResult
|
|
end
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
|
|
return STR0002 |