Prima versiomne funzionante tastatura. Manca disattivazione finale
This commit is contained in:
+50
-11
@@ -9,39 +9,78 @@ require( 'EgtBase')
|
||||
local BL = require( 'BeamLib')
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function GetProbingMachining( Machinings, nHead)
|
||||
local function GetProbingMachining( Machinings, sHead)
|
||||
local sProbeMachining
|
||||
|
||||
for i = 1, #Machinings do
|
||||
if EgtEndsWith( Machinings[i], '_H2') then
|
||||
if EgtEndsWith( Machinings[i], sHead) then
|
||||
sProbeMachining = Machinings[i]
|
||||
break
|
||||
return sProbeMachining
|
||||
end
|
||||
end
|
||||
|
||||
sProbeMachining = Machinings[1]
|
||||
return sProbeMachining
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MoveProbePointToRawFaces( ptProbe, vtProbe, nPartId)
|
||||
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
-- si porta linea di tastatura su grezzo
|
||||
if AreSameVectorApprox( vtProbe, Z_AX()) then
|
||||
ptProbe[3] = b3Solid:getMax():getZ()
|
||||
elseif AreSameVectorApprox( vtProbe, -Z_AX()) then
|
||||
ptProbe[3] = b3Solid:getMin():getZ()
|
||||
elseif AreSameVectorApprox( vtProbe, Y_AX()) then
|
||||
ptProbe[2] = b3Solid:getMax():getY()
|
||||
elseif AreSameVectorApprox( vtProbe, -Y_AX()) then
|
||||
ptProbe[2] = b3Solid:getMin():getY()
|
||||
end
|
||||
return ptProbe
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessProbing.Make( Proc, nRawId, nPartId, Info)
|
||||
function ProcessProbing.Make( Proc, nPartId, Info)
|
||||
local bOk, sErr
|
||||
|
||||
-- per eseguire tastatura servono tutti i dati, altriemnti impossibile
|
||||
if Info.vtProbe and Info.ptProbe and Info.sType then
|
||||
Info.ptProbe = MoveProbePointToRawFaces( Info.ptProbe, Info.vtProbe, nPartId)
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
local nIdLine = EgtLinePVL( nAddGrpId, Info.ptProbe, Info.vtProbe, 10) -- TODO lunghezza da portare fuori come parametro
|
||||
local nIdLine = EgtLinePVL( nAddGrpId, Info.ptProbe, Info.vtProbe, 10, GDB_RT.GLOB) -- TODO lunghezza da portare fuori come parametro
|
||||
local Machinings = GetMachinings( MCH_MY.PROBING, Info.sType)
|
||||
local Probing = GetProbingMachining( Machinings, Info.nHead)
|
||||
-- se c'è la linea e la lavorazione, applico
|
||||
if Probing and nIdLine then
|
||||
-- se c'è almeno una lavorazione, allora devo fare tastatura
|
||||
if Machinings and #Machinings > 0 then
|
||||
local sProbing = GetProbingMachining( Machinings, Info.sHead)
|
||||
-- se c'è la linea e la lavorazione, applico
|
||||
if sProbing and nIdLine then
|
||||
local sName = 'DtMtProbe_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchFId = EgtAddMachining( sName, sProbing.Name)
|
||||
-- si inverte la direzione della linea, deve essere entrante, oppostaa vettore estrusione
|
||||
EgtInvertCurve( nIdLine)
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ nIdLine, -1}})
|
||||
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sErr
|
||||
end
|
||||
else
|
||||
bOk = false
|
||||
sErr = 'Error on probing'
|
||||
end
|
||||
-- altrimenti tastatura non richiesta, esco
|
||||
else
|
||||
return true
|
||||
end
|
||||
else
|
||||
bOk = true
|
||||
bOk = false
|
||||
sErr = 'Error on probing'
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user