DataBeam :

- migliorie e correzioni varie.
This commit is contained in:
Dario Sassi
2019-04-15 06:35:45 +00:00
parent 055968ca9f
commit 03e256a2f2
6 changed files with 167 additions and 43 deletions
+95 -5
View File
@@ -1,4 +1,4 @@
-- ProcessFreeContour.lua by Egaltech s.r.l. 2019/02/23
-- ProcessFreeContour.lua by Egaltech s.r.l. 2019/04/13
-- Gestione calcolo profilo libero per Travi
-- Tabella per definizione modulo
@@ -13,6 +13,7 @@ EgtOutLog( ' ProcessFreeContour started', 1)
-- Dati
local BD = require( 'BeamData')
local Millings = require( 'MillingData')
local Pocketings = require( 'PocketingData')
---------------------------------------------------------------------
-- Riconoscimento della feature
@@ -88,8 +89,7 @@ local function FindMilling( sType)
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessFreeContour.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId)
-- recupero e verifico l'entità curva
@@ -104,7 +104,7 @@ function ProcessFreeContour.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
local dDepth = abs( EgtCurveThickness( AuxId))
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
local bToolInv = ( vtExtr:getZ() < -0.1)
-- recupero la lavorazione
-- recupero la lavorazione
local nMill, sMilling = FindMilling( 'FreeContour')
if not sMilling then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
@@ -212,7 +212,97 @@ function ProcessFreeContour.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
BL.UpdateTCING( nRawId, Proc.Box:getMax():getX() - b3Raw:getMin():getX())
end
return true
end
end
---------------------------------------------------------------------
local function FindPocketing( sType)
for i = 1, #Pocketings do
local Pocketing = Pocketings[i]
if Pocketing.Type == sType then
return i, Pocketing.Name
end
end
return 0
end
---------------------------------------------------------------------
local function MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- recupero e verifico l'entità curva
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
if AuxId then AuxId = AuxId + Proc.Id end
if not AuxId or ( EgtGetType( AuxId) & 256) == 0 then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing profile geometry'
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati della curva e del profilo
local dDepth = abs( EgtCurveThickness( AuxId))
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
--local bToolInv = ( vtExtr:getZ() < -0.1)
-- recupero la lavorazione
local nMill, sPocketing = FindPocketing( 'Mortise')
if not sPocketing then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' pocketing not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati dell'utensile
local dMillDiam = 20
local dMaxDepth = 0
if EgtMdbSetCurrMachining( sPocketing) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- inserisco la lavorazione di svuotatura
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sName, sPocketing)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -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
-- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente
if dDepth > dMaxDepth + 10 * GEO.EPS_SMALL then
dDepth = dMaxDepth
local sWarn = 'Warning in process ' .. tostring( Proc.Id) .. ' : elevation bigger than max tool depth'
EgtOutLog( sWarn)
end
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- imposto elevazione
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxDepth, 1) .. ';')
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
return true
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessFreeContour.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- recupero la tipologia
local bPocket = ( EgtGetInfo( Proc.Id, 'PCKT', 'i') == 1)
-- se svuotatura
if bPocket then
return MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- altrimenti contornatura
else
return MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
end
---------------------------------------------------------------------
return ProcessFreeContour