DataBeam :
- aggiunta gestione smussi su tagli coincidenti con testa e coda della trave - correzione nei tagli su pezzi grandi (lato di accesso e dicecut) - correzione in LapJoint per riconoscimento caso 3facce con lavorazione speciale.
This commit is contained in:
+126
-1
@@ -1,4 +1,4 @@
|
||||
-- ProcessSplit.lua by Egaltech s.r.l. 2020/02/29
|
||||
-- ProcessSplit.lua by Egaltech s.r.l. 2020/06/16
|
||||
-- Gestione calcolo tagli di separazione per Travi
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
@@ -20,11 +20,136 @@ function ProcessSplit.Identify( Proc)
|
||||
return ( Proc.Grp == 2 and Proc.Prc == 350)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- verifica curva per smusso (-1=errore curva, 0=estrusione non va bene, 1=ok)
|
||||
local function VerifyCurveForChamfer( AuxId)
|
||||
if not AuxId then
|
||||
return -2
|
||||
end
|
||||
if ( EgtGetType( AuxId) & GDB_FY.GEO_CURVE) == 0 then
|
||||
return -1
|
||||
end
|
||||
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
||||
-- va bene solo se direzione estrusione orizzontale
|
||||
if abs( vtExtr:getZ()) > 0.1 then
|
||||
return 0
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- lavorazione smussi
|
||||
local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- verifico che lo smusso sia richiesto
|
||||
local dDepth = EgtGetInfo( nOriId, 'Q06', 'd') or 0
|
||||
if dDepth < 0.1 then return true end
|
||||
-- ingombro del grezzo
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- recupero e verifico le entità curva associate (max 2)
|
||||
local sVal = EgtGetInfo( nOriId, 'AUXID')
|
||||
local vsAuxId = EgtSplitString( sVal)
|
||||
local AuxId, Aux2Id
|
||||
if vsAuxId and #vsAuxId >=1 then
|
||||
AuxId = tonumber( vsAuxId[1])
|
||||
end
|
||||
if vsAuxId and #vsAuxId >=2 then
|
||||
Aux2Id = tonumber( vsAuxId[2])
|
||||
end
|
||||
if AuxId then AuxId = AuxId + nOriId end
|
||||
if Aux2Id then Aux2Id = Aux2Id + nOriId end
|
||||
local nRes = VerifyCurveForChamfer( AuxId)
|
||||
if nRes == 0 and Aux2Id then
|
||||
AuxId = Aux2Id
|
||||
nRes = VerifyCurveForChamfer( AuxId)
|
||||
end
|
||||
if nRes == -2 then
|
||||
return true
|
||||
end
|
||||
if nRes == -1 then
|
||||
local sErr = 'Error : missing profile geometry'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
if nRes == 0 then
|
||||
local sWarn = 'Warning : skipped not horizontal chamfer'
|
||||
EgtOutLog( sWarn)
|
||||
return true
|
||||
end
|
||||
-- recupero i dati della curva e del profilo
|
||||
local dWidth = abs( EgtCurveThickness( AuxId))
|
||||
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
||||
-- eseguo lo smusso solo se feature larga come la trave
|
||||
if dWidth < b3Raw:getDimY() - 1 then
|
||||
local sWarn = 'Warning : skipped chamfer (feature smaller than beam)'
|
||||
EgtOutLog( sWarn)
|
||||
return true, sWarn
|
||||
end
|
||||
local dExtra = 2
|
||||
-- recupero la lavorazione
|
||||
local sMilling = ML.FindMilling( 'Mark')
|
||||
if not sMilling then
|
||||
local sErr = 'Error : milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- Inserisco la lavorazione del lato standard
|
||||
local sName1 = 'SJN_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMch1Id = EgtAddMachining( sName1, sMilling)
|
||||
if not nMch1Id then
|
||||
local sErr = 'Error adding machining ' .. sName1 .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
-- assegno affondamento e offset radiale
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth + dExtra)
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
|
||||
-- assegno lato di lavoro
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
||||
-- eseguo
|
||||
if not EgtApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchId, false)
|
||||
return false, sErr
|
||||
end
|
||||
-- Inserisco la lavorazione del lato opposto
|
||||
local sName2 = 'SJN_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMch2Id = EgtAddMachining( sName2, sMilling)
|
||||
if not nMch2Id then
|
||||
local sErr = 'Error adding machining ' .. sName2 .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
-- inverto direzione utensile
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
-- assegno affondamento e offset radiale
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth + dExtra)
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
|
||||
-- assegno lato di lavoro
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||
-- eseguo
|
||||
if not EgtApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchId, false)
|
||||
return false, sErr
|
||||
end
|
||||
return true, nil
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
|
||||
-- ingombro del grezzo
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- inserimento smussi
|
||||
local nOriId = EgtGetInfo( Proc.Id, 'ORI', 'i')
|
||||
if nOriId then
|
||||
local bOkc, sErrC = MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if not bOkc then return bOkc, sErrC end
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
local sCutting = ML.FindCutting( EgtIf( bSplit, 'SplitSide', 'TailSide'))
|
||||
if not sCutting then
|
||||
|
||||
Reference in New Issue
Block a user