DataBeam :
- aggiunta gestione feature 138 in coda su pezzo piccolo - in LapJoint se richiesto truciolatore da Q e non fattibile, si dà errore.
This commit is contained in:
+112
-22
@@ -1,4 +1,4 @@
|
||||
-- ProcessLapJoint.lua by Egaltech s.r.l. 2020/07/31
|
||||
-- ProcessLapJoint.lua by Egaltech s.r.l. 2020/08/04
|
||||
-- Gestione calcolo mezzo-legno per Travi
|
||||
-- 2019/10/08 Agg. gestione OpenPocket.
|
||||
|
||||
@@ -620,6 +620,28 @@ local function MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId)
|
||||
end
|
||||
-- verifico il numero di facce della tacca
|
||||
assert( ( Proc.Fct == 2), 'Error : MakeTwoFacesByMill in LapJoint with ' .. tostring( Proc.Fct) .. ' faces')
|
||||
-- predispongo lavorazione
|
||||
local sMilling
|
||||
-- verifico il parametro Q per uso fresa
|
||||
local nUseRM = EgtGetInfo( Proc.Id, sUseMill, 'i')
|
||||
if nUseRM and nUseRM == 1 then
|
||||
sMilling = ML.FindMilling( 'LongSmallCut')
|
||||
else
|
||||
sMilling = ML.FindMilling( 'BirdsMouth')
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
local dTDiam = 0
|
||||
if not sMilling then
|
||||
local sErr = 'Error : milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
else
|
||||
-- recupero i dati dell'utensile
|
||||
if EgtMdbSetCurrMachining( sMilling) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dTDiam
|
||||
end
|
||||
end
|
||||
-- dati delle facce
|
||||
local ptC = {}
|
||||
local vtN = {}
|
||||
@@ -672,16 +694,56 @@ local function MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId)
|
||||
nFacInd = 1
|
||||
end
|
||||
local nOthInd = 1 - nFacInd
|
||||
-- recupero la lavorazione
|
||||
local sMilling = ML.FindMilling( 'BirdsMouth')
|
||||
if not sMilling then
|
||||
local sErr = 'Error : milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
local sName
|
||||
local nMchFId
|
||||
local nFaceUse
|
||||
-- se forzato uso fresa controllo se posso fare in una o più passate
|
||||
if nUseRM and nUseRM == 1 then
|
||||
-- prendo la larghezza della faccia
|
||||
local _, pPt1, pPt2 = EgtSurfTmFacetsContact( Proc.Id, nFacInd, nOthInd, GDB_ID.ROOT)
|
||||
local dDistPoint = dist( pPt1, pPt2)
|
||||
local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
local dWidth = EgtIf( abs( dDistPoint - dH) < abs( dDistPoint - dV), dV, dH)
|
||||
-- se larghezza faccia maggiore diametro utensile aggiungo una lavorazione
|
||||
if dTDiam > 0 and dWidth > dTDiam then
|
||||
-- inserisco la lavorazione di fresatura
|
||||
sName = 'Mill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_1'
|
||||
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, nFacInd}})
|
||||
-- imposto uso faccia e lato correzione
|
||||
nFaceUse = BL.GetNearestOrthoOpposite( vtN[nOthInd+1])
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
||||
-- imposto lato di correzione
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||
-- tolgo l'inversione
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, false)
|
||||
-- aggiungo offset laterale
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR , (dTDiam/2))
|
||||
-- imposto posizione braccio porta testa
|
||||
if vtN[nFacInd+1]:getY() < GEO.EPS_SMALL then
|
||||
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
|
||||
else
|
||||
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
|
||||
end
|
||||
-- dichiaro non si generano sfridi per VMill
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, 'VMRS=0;')
|
||||
-- eseguo
|
||||
if not EgtApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
-- inserisco la lavorazione di fresatura
|
||||
local sName = 'Mill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchFId = EgtAddMachining( sName, sMilling)
|
||||
sName = 'Mill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
nMchFId = EgtAddMachining( sName, sMilling)
|
||||
if not nMchFId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
@@ -690,10 +752,12 @@ local function MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId)
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ Proc.Id, nFacInd}})
|
||||
-- imposto uso faccia e lato correzione
|
||||
local nFaceUse = BL.GetNearestOrthoOpposite( vtN[nOthInd+1])
|
||||
nFaceUse = BL.GetNearestOrthoOpposite( vtN[nOthInd+1])
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
||||
-- imposto lato di correzione
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||
-- tolgo l'inversione
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, false)
|
||||
-- imposto posizione braccio porta testa
|
||||
if vtN[nFacInd+1]:getY() < GEO.EPS_SMALL then
|
||||
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
|
||||
@@ -2372,10 +2436,16 @@ local function CheckPocketTool( sMchFind, dDiam, dElev)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function CheckDiamToolByFaces( Proc, nFacInd, dH, dV, bIsU, bIsL, dElev)
|
||||
local function CheckDiamToolByFaces( Proc, nFacInd, dH, dV, bIsU, bIsL, dElev, nUseRoughTool)
|
||||
local dMaxDimFace = max( dH, dV)
|
||||
-- verifico che diametro utensile prende con la openpocket con la massima dimensione faccia
|
||||
local bUseMaxTool, dMaxDiam = CheckPocketTool( 'OpenPocket', dMaxDimFace, dElev)
|
||||
local bUseMaxTool, dMaxDiam
|
||||
-- se è forzato l'uso del truciolatore non passo l'altezza di elevazione
|
||||
if nUseRoughTool and nUseRoughTool == 1 then
|
||||
bUseMaxTool, dMaxDiam = CheckPocketTool( 'OpenPocket', dMaxDimFace)
|
||||
else
|
||||
bUseMaxTool, dMaxDiam = CheckPocketTool( 'OpenPocket', dMaxDimFace, dElev)
|
||||
end
|
||||
-- se non trovato utensile esco
|
||||
if not bUseMaxTool then
|
||||
return false
|
||||
@@ -2444,7 +2514,7 @@ local function CheckDiamToolByFaces( Proc, nFacInd, dH, dV, bIsU, bIsL, dElev)
|
||||
end
|
||||
-- per essere accettabile, il diametro massimo deve essere minore della larghezza della faccia
|
||||
if dMaxDiam < dLargeVal + 20 * GEO.EPS_SMALL then
|
||||
return dMaxDiam, 'OpenPocket', 1, dMaxDiam
|
||||
return dMaxDiam, 'OpenPocket', nUseRoughTool, dMaxDiam
|
||||
else
|
||||
return false, '', 0, dMaxDiam
|
||||
end
|
||||
@@ -3077,7 +3147,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, bSinglePart)
|
||||
local bOk, sErr = MakePreCuts( Proc, nPhase, nRawId, nPartId, b3Raw, nChamfer)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
-- imposto altezza aggiuntiva di elevazione
|
||||
local dCollSic = 8 * BD.COLL_SIC
|
||||
if abs( vtN:getX()) > 0.996 or abs( vtN:getY()) > 0.996 or abs( vtN:getZ()) > 0.996 then
|
||||
dCollSic = 0
|
||||
@@ -3090,20 +3160,32 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, bSinglePart)
|
||||
local nUseRoughTool = EgtIf( bSinglePart, 0, 1)
|
||||
local dDiam = min( dH, dV)
|
||||
local dDiamMax
|
||||
local nUseRT
|
||||
-- 04/08/2020 su richiesta di Fabio Squaratti, se settato parametro uso truciolatore (parametro Q), non si devono prendere altre frese,
|
||||
-- piuttosto si da errore con il truciolatore.
|
||||
-- Sicuramente questa opzione si scontra facilmente con altre interpretazioni dello stasso parametro Q
|
||||
-- per tornare comportamento precedente settare bNewCheck = false
|
||||
local bNewCheck = true
|
||||
-- se processo 20 e non sto usando il truciolatore
|
||||
if bNewCheck and Proc.Prc == 20 and nUseRoughTool == 0 then
|
||||
-- verifico se forzato uso truciolatore
|
||||
nUseRT = EgtGetInfo( Proc.Id, sUseRoughTool, 'i')
|
||||
if nUseRT and nUseRT ~= 0 then
|
||||
sMchFind = 'OpenPocket'
|
||||
nUseRoughTool = 1
|
||||
end
|
||||
end
|
||||
-- verifico dalla forma se non posso prendere utensile grande
|
||||
if ( Proc.Fct == 3 and bIsU) or ( Proc.Fct == 2 and bIsL) or Proc.Fct == 1 then
|
||||
--verifico dimensioni con facce adiacenti
|
||||
dDiam, sMchFind, nUseRoughTool, dDiamMax = CheckDiamToolByFaces( Proc, nFacInd, dH, dV, bIsU, bIsL, ( dFacElev + dCollSic))
|
||||
if not dDiam then
|
||||
--ottengo un diametro utensile opportuno
|
||||
dDiam, sMchFind, nUseRoughTool, dDiamMax = CheckDiamToolByFaces( Proc, nFacInd, dH, dV, bIsU, bIsL, ( dFacElev + dCollSic), nUseRoughTool)
|
||||
if not dDiam and nUseRoughTool == 0 then
|
||||
sMchFind = 'Pocket'
|
||||
nUseRoughTool = 0
|
||||
dDiam = min( dH, dV)
|
||||
end
|
||||
end
|
||||
-- se processo 20 e non sto usando il truciolatore
|
||||
if Proc.Prc == 20 and nUseRoughTool == 0 then
|
||||
-- verifico se forzato uso truciolatore
|
||||
local nUseRT = EgtGetInfo( Proc.Id, sUseRoughTool, 'i')
|
||||
if nUseRT and nUseRT ~= 0 then
|
||||
sMchFind = 'OpenPocket'
|
||||
nUseRoughTool = 1
|
||||
@@ -3113,9 +3195,17 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, bSinglePart)
|
||||
end
|
||||
end
|
||||
--EgtOutLog( 'Mortise Find Diam =' .. EgtNumToString( dDiam))
|
||||
local sPocketing = ML.FindPocketing( sMchFind, dDiam, dFacElev + dCollSic)
|
||||
local sPocketing
|
||||
if nUseRoughTool == 1 then
|
||||
sMyPocketing, dMyTDiam, dMyTMaxDepth = ML.FindPocketing( sMchFind, dDiam)
|
||||
if sMyPocketing and dMyTMaxDepth > 0.8 * dFacElev + dCollSic then
|
||||
sPocketing = sMyPocketing
|
||||
end
|
||||
else
|
||||
sPocketing = ML.FindPocketing( sMchFind, dDiam, dFacElev + dCollSic)
|
||||
end
|
||||
-- se non trovata verifico affondamento
|
||||
if not sPocketing then
|
||||
if not sPocketing and nUseRoughTool == 0 then
|
||||
local sMyPocketing, dMyTDiam, dMyTMaxDepth = ML.FindPocketing( sMchFind, dDiam)
|
||||
if sMyPocketing and dMyTMaxDepth > 0.8 * dFacElev + dCollSic then
|
||||
sPocketing = sMyPocketing
|
||||
|
||||
Reference in New Issue
Block a user