Files
databeamnew/Strategies/STR0002/STR0002.lua
T
2024-05-14 11:47:53 +02:00

87 lines
3.2 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 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
-- TODO fare calcolo per decidere se spezzare
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
-- TODO cercare utensile appropriato
ToolInfo = MachLib.FindMill( Proc, sMillType, sMillShape, dMaxToolDiameter, dElevation, Proc.MainFaces.BottomFace.vtN)
if 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 = ''
else
Strategy.RatingResult.sStatus = 'Not-Applicable'
Strategy.RatingResult.dCompletionIndex = 0
Strategy.RatingResult.dRating = FeatureData.GetFeatureRating( 'None', Strategy.RatingResult.dCompletionIndex)
Strategy.RatingResult.sInfo = 'Mill not found'
end
-- se richiesto applico lavorazione
if AddMachining then
EgtCreateMachining( 'Svuotatura', MCH_OY.POCKETING, TOOLS[ToolInfo.idTool].sName)
end
return Strategy.RatingResult
end
-------------------------------------------------------------------------------------------------------------
return STR0002