eb479dc5ee
- in processo FreeContour ora viene gestita la scelta utensile di BTL - aggiunta gestione processo Variant (custom) - aggiunta gestione lavorazioni di superficie - anche in forature, svuotature e superfici fatte di lato sui fianchi si imposta il flag di esecuzione dopo i tagli dei contorni (MOVE_AFTER).
116 lines
3.8 KiB
Lua
116 lines
3.8 KiB
Lua
-- WProcessVariant.lua by Egaltech s.r.l. 2021/08/27
|
|
-- Gestione calcolo Feature Custom (Variant) per Pareti
|
|
|
|
-- Tabella per definizione modulo
|
|
local WPV = {}
|
|
|
|
-- Include
|
|
require( 'EgtBase')
|
|
local WL = require( 'WallLib')
|
|
|
|
EgtOutLog( ' WProcessVariant started', 1)
|
|
|
|
-- Dati
|
|
local WD = require( 'WallData')
|
|
local WM = require( 'WMachiningLib')
|
|
|
|
---------------------------------------------------------------------
|
|
-- Riconoscimento della feature
|
|
function WPV.Identify( Proc)
|
|
return (( Proc.Grp == 0 or Proc.Grp == 1 or Proc.Grp == 2 or Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 900)
|
|
end
|
|
|
|
---------------------------------------------------------------------
|
|
-- Classificazione della feature: decide se la feature è in una posizione lavorabile
|
|
local function ClassifyCode_1( Proc, b3Raw)
|
|
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
|
|
if AuxId then
|
|
AuxId = AuxId + Proc.Id
|
|
end
|
|
if not AuxId or ( EgtGetType( AuxId) & GDB_FY.GEO_CURVE) == 0 then
|
|
local sErr = 'Error : missing containement geometry'
|
|
EgtOutLog( sErr)
|
|
return false
|
|
end
|
|
local vtExtr = EgtCurveExtrusion( AuxId or GDB_ID.NULL, GDB_ID.ROOT)
|
|
return ( vtExtr:getZ() > -0.01)
|
|
end
|
|
|
|
---------------------------------------------------------------------
|
|
function WPV.Classify( Proc, b3Raw)
|
|
-- recupero il codice identificativo
|
|
local sCode = EgtGetInfo( Proc.Id, 'DES')
|
|
-- gestione in base al codice
|
|
if sCode == '1' then
|
|
return ClassifyCode_1( Proc, b3Raw)
|
|
else
|
|
return false
|
|
end
|
|
end
|
|
|
|
---------------------------------------------------------------------
|
|
-- Applicazione della lavorazione
|
|
local function MakeCode_1( Proc, nRawId, b3Raw)
|
|
-- recupero e verifico l'entità curva associata
|
|
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
|
|
if AuxId then
|
|
AuxId = AuxId + Proc.Id
|
|
end
|
|
if not AuxId or ( EgtGetType( AuxId) & GDB_FY.GEO_CURVE) == 0 then
|
|
local sErr = 'Error : missing containement geometry'
|
|
EgtOutLog( sErr)
|
|
return false, sErr
|
|
end
|
|
local vtExtr = EgtCurveExtrusion( AuxId or GDB_ID.NULL, GDB_ID.ROOT)
|
|
-- recupero la lavorazione
|
|
local sSurfFin = WM.FindSurfacing( 'Finishing')
|
|
if not sSurfFin then
|
|
local sErr = 'Error : surface finishing not found in library'
|
|
EgtOutLog( sErr)
|
|
return false, sErr
|
|
end
|
|
-- inserisco la lavorazione di finitura superficie
|
|
local sName = 'SurfFin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
|
local nMchFId = EgtAddMachining( sName, sSurfFin)
|
|
if not nMchFId then
|
|
local sErr = 'Error adding machining ' .. sName .. '-' .. sSurfFin
|
|
EgtOutLog( sErr)
|
|
return false, sErr
|
|
end
|
|
EgtSetInfo( nMchFId, 'Part', Proc.PartId)
|
|
-- se lavorazione di fianco setto la nota per spostarla dopo i tagli di lama
|
|
if vtExtr:getZ() < WD.NZ_MINA then
|
|
EgtSetInfo( nMchFId, 'MOVE_AFTER', 1)
|
|
end
|
|
-- aggiungo geometria
|
|
EgtSetMachiningGeometry( {{ Proc.Id, -1},{AuxId, -1}})
|
|
-- imposto posizione braccio porta testa
|
|
local nSCC = MCH_SCC.ADIR_ZP
|
|
if AreSameVectorApprox( vtExtr, Z_AX()) then
|
|
nSCC = EgtIf( Proc.Box:getDimX() >= Proc.Box:getDimY(), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_XP)
|
|
end
|
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
|
-- eseguo
|
|
if not EgtApplyMachining( true, false) then
|
|
local _, sErr = EgtGetLastMachMgrError()
|
|
EgtSetOperationMode( nMchFId, false)
|
|
return false, sErr
|
|
end
|
|
return true
|
|
end
|
|
|
|
---------------------------------------------------------------------
|
|
function WPV.Make( Proc, nRawId, b3Raw)
|
|
-- recupero il codice identificativo
|
|
local sCode = EgtGetInfo( Proc.Id, 'DES')
|
|
-- gestione in base al codice
|
|
if sCode == '1' then
|
|
return MakeCode_1( Proc, nRawId, b3Raw)
|
|
else
|
|
return false, 'Feature Id Code non recognized for machining'
|
|
end
|
|
end
|
|
|
|
---------------------------------------------------------------------
|
|
return WPV
|