Files
DataBeam/LuaLibs/ProcessDecor.lua
T
DarioS b51487f5af DataBeam :
- modifiche per ottimizzazione con più teste
- modifiche per compilazione.
2022-05-09 20:42:45 +02:00

82 lines
2.7 KiB
Lua

-- ProcessDecor.lua by Egaltech s.r.l. 2018/04/18
-- Gestione calcolo decoro per Travi
-- Tabella per definizione modulo
local ProcessDecor = {}
-- Include
require( 'EgtBase')
EgtOutLog( ' ProcessDecor started', 1)
-- Dati
local BD = require( 'BeamData')
local ML = require( 'MachiningLib')
---------------------------------------------------------------------
-- Riconoscimento della feature
function ProcessDecor.Identify( Proc)
return ( ( Proc.Grp == 0 or Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 959)
end
---------------------------------------------------------------------
-- Classificazione della feature
function ProcessDecor.Classify( Proc)
-- recupero i dati della decorazione
local vtExtr = EgtCurveExtrusion( Proc.Id, GDB_RT.GLOB)
-- verifico sia una decorazione
if not vtExtr then
return false
end
-- verifico se la decorazione è lavorabile solo da sotto
local bDown = (( vtExtr:getZ() < -0.1))
return true, bDown
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessDecor.Make( Proc, nPhase, nRawId, nPartId)
-- recupero i dati della decorazione
local vtExtr = EgtCurveExtrusion( Proc.Id, GDB_RT.GLOB)
-- verifico che la decorazione non sia orientata verso il basso (-5 deg)
if vtExtr:getZ() < - 0.1 then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Decor from bottom impossible'
EgtOutLog( sErr)
return false, sErr
end
-- recupero la lavorazione
local sToFind = EgtGetInfo( Proc.Id, 'P15')
local sMilling = ML.FindMilling( sToFind)
if not sMilling then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- inserisco la lavorazione di fresatura
local sName = 'Decor_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sName, sMilling)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, -1}})
-- imposto posizione braccio porta testa
if vtExtr:getY() <= 0 then
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
else
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
return true
end
---------------------------------------------------------------------
return ProcessDecor