90 lines
2.7 KiB
Lua
90 lines
2.7 KiB
Lua
-- BLADETOWASTE.lua by Egalware s.r.l. 2025/01/08
|
|
-- Libreria di supporto a strategie con funzioni comune a strategie diverse.
|
|
|
|
-- Tabella per definizione modulo
|
|
local BLADETOWASTE = {}
|
|
|
|
-- Include
|
|
require( 'EgtBase')
|
|
|
|
-- Carico i dati globali
|
|
local BeamData = require( 'BeamData')
|
|
local FeatureLib = require( 'FeatureLib')
|
|
local MachiningLib = require( 'MachiningLib')
|
|
-- strategie di base
|
|
local FaceByBlade = require('FACEBYBLADE')
|
|
|
|
EgtOutLog( ' BLADETOWASTE started', 1)
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
|
|
function BLADETOWASTE.Make( Proc, Part, OptionalParameters)
|
|
local Result = {}
|
|
|
|
-- parametri opzionali e default
|
|
local nToolIndex = OptionalParameters.nToolIndex
|
|
local bDropWholeWaste = OptionalParameters.bDropWholeWaste or false
|
|
local dMaxWasteVolume = OptionalParameters.dMaxWasteVolume or 0
|
|
local dMaxWasteLength = OptionalParameters.dMaxWasteLength or 0
|
|
|
|
local dFeatureVolume = FeatureLib.GetFeatureVolume( Proc, Part)
|
|
local dFeatureMaxDimension = max( Proc.b3Box:getDimX(), Proc.b3Box:getDimY())
|
|
local bIsFeatureSmall = dFeatureVolume < dMaxWasteVolume + 10 * GEO.EPS_SMALL
|
|
and dFeatureMaxDimension < dMaxWasteLength + 10 * GEO.EPS_SMALL
|
|
|
|
if Proc.nFct == 1 and ( bIsFeatureSmall or bDropWholeWaste) then
|
|
local EdgeToMachine = {}
|
|
-- ricerca utensile
|
|
if not nToolIndex then
|
|
local ToolSearchParameters = {}
|
|
for i = 1, #Proc.Faces[1].Edges do
|
|
if ( i == 1) or Proc.Faces[1].Edges[i].dElevation < EdgeToMachine.dElevation - 10 * GEO.EPS_SMALL then
|
|
EdgeToMachine = Proc.Faces[1].Edges[i]
|
|
end
|
|
end
|
|
ToolSearchParameters.dElevation = EdgeToMachine.dElevation
|
|
ToolSearchParameters.vtToolDirection = EdgeToMachine.vtN
|
|
ToolSearchParameters.bAllowTopHead = true
|
|
-- TODO bisognerà implementare anche la lama da sotto
|
|
ToolSearchParameters.bAllowBottomHead = false
|
|
ToolSearchParameters.bForceLongcutBlade = false
|
|
local ToolInfo = MachiningLib.FindBlade( Proc, ToolSearchParameters)
|
|
nToolIndex = ToolInfo.nToolIndex
|
|
end
|
|
|
|
local OptionalParametersFaceByBlade = { dDepthToMachine = EdgeToMachine.dElevation + BeamData.CUT_EXTRA}
|
|
local Cutting = FaceByBlade.Make( Proc, Part, Proc.Faces[1], EdgeToMachine, OptionalParametersFaceByBlade)
|
|
table.insert( Result, Cutting)
|
|
|
|
-- restituire tabella contenente lavorazioni, già con cloni se necessari
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Result
|
|
end
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
|
|
return BLADETOWASTE |