Files
databeamnew/Strategies/STR0002/STR0002.lua
T

79 lines
2.6 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')
-- Tabella per definizione modulo
local STR0002 = {}
local Strategy = {}
-------------------------------------------------------------------------------------------------------------
local function IsTopologyOk( Proc)
if Proc.Topology.Name == '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.Name = StrategyLib.Config.StrategyId
CustomParameters = BeamLib.GetUpdateCustomParameters( CustomParameters, StrategyLib.Config.Parameters)
Strategy.Parameters = BeamLib.LoadCustomParametersInStrategy( CustomParameters)
if not IsTopologyOk( Proc) then
local sErr = 'Feature '.. Proc.FeatureId .. ' : strategy ' .. Strategy.Config.StrategyId .. ' not implemented'
EgtOutLog( sErr)
return false, sErr
end
-- TODO fare calcolo per decidere se spezzare
local Tool = {}
-- serve utensile che possa lavorare di testa
local sTypeMill = 'MILL_STD'
local dMaxToolDiameter = min( Strategy.Parameters.MaxCornerRadius * 2, Proc.MainFaces.BottomFace.Height, Proc.MainFaces.BottomFace.Width)
-- TODO cercare utensile appropriato
-- Tool = MachLib.FindMill( sTypeMill, dMaxToolDiameter)
if Tool then
Strategy.RatingResult.Status = 'Completed'
Strategy.RatingResult.Rating = FeatureData.GetFeatureRating( 'Mill', 100)
Strategy.RatingResult.CompletionIndex = 5
Strategy.RatingResult.Info = ''
else
Strategy.RatingResult.Status = 'Not-Applicable'
Strategy.RatingResult.Rating = FeatureData.GetFeatureRating( 'None', 0)
Strategy.RatingResult.CompletionIndex = 0
Strategy.RatingResult.Info = 'Mill not found'
end
-- se richiesto applico lavorazione
if AddMachining then
EgtCreateMachining( 'Svuotatura', MCH_OY.POCKETING, 'Fresa25x130')
end
return Strategy.RatingResult
end
-------------------------------------------------------------------------------------------------------------
return STR0002