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:
Dario Sassi
2020-08-17 18:14:10 +00:00
parent 8c9d3d3ce1
commit a28fb4c546
2 changed files with 175 additions and 29 deletions
+63 -7
View File
@@ -1,4 +1,4 @@
-- ProcessDovetail.lua by Egaltech s.r.l. 2020/08/03
-- ProcessDovetail.lua by Egaltech s.r.l. 2020/08/04
-- Gestione calcolo giunzione coda di rondine
-- Tabella per definizione modulo
@@ -219,6 +219,41 @@ local function VerifyIfRoughMill( dLargeFace, vtN, bCalcElev, dAngOnSide)
return false
end
---------------------------------------------------------------------
local function AddFaceToSurf( Proc, nPartId, b3Solid)
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
local nNewProc = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
-- punto medio sulla faccia
local ptN = Point3d( b3Solid:getMin():getX(), ( b3Solid:getMin():getY() + b3Solid:getMax():getY())/2, ( b3Solid:getMin():getZ() + b3Solid:getMax():getZ())/2)
-- creo superficie intermedia
local nSurfInt = EgtSurfTmPlaneInBBox( nAddGrpId, ptN, -X_AX(), b3Solid, GDB_ID.ROOT)
-- se esiste la superfice aggiunta, la ritaglio la superficie con le facce
if nSurfInt then
-- inverto la normale
EgtInvertSurf( nSurfInt)
for i = 1, Proc.Fct do
local ptN, vtN = EgtSurfTmFacetCenter( Proc.Id, i - 1, GDB_ID.ROOT)
EgtCutSurfTmPlane( nSurfInt, ptN, -vtN, false, GDB_ID.ROOT)
end
-- unisco la nuova superfice
if nSurfInt then
local bOk = EgtSurfTmAdd( nNewProc, nSurfInt)
if bOk then
EgtErase( nSurfInt)
Proc.Id = nNewProc
Proc.Fct = EgtSurfTmFacetCount( nNewProc)
end
end
end
end
---------------------------------------------------------------------
-- Verifica se feature di testa
function ProcessDovetail.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
@@ -265,11 +300,21 @@ end
---------------------------------------------------------------------
-- Verifica se feature di coda
function ProcessDovetail.IsTailFeature( Proc, b3Raw)
-- recupero identificativo del pezzo
local nPartId = EgtGetParent( EgtGetParent( Proc.Id) or GDB_ID.NULL)
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
-- se una sola faccia
if Proc.Fct == 1 then
local _, vtN0 = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
if vtN0:getX() < -0.1 then
return true
-- controllo se il pezzo + piccolo e serve la lavorazione prima del taglio di separazione
if b3Solid:getDimX() > BD.LEN_SHORT_PART then
return true
else
-- aggiungo faccia
AddFaceToSurf( Proc, nPartId, b3Solid)
return false
end
end
end
-- verifico se è in coda
@@ -280,13 +325,17 @@ function ProcessDovetail.IsTailFeature( Proc, b3Raw)
if Proc.Box:getDimX() > min( BD.MAX_LEN_HTFEA, 0.6 * b3Raw:getDimX()) then
return false
end
-- recupero identificativo del pezzo
local nPartId = EgtGetParent( EgtGetParent( Proc.Id) or GDB_ID.NULL)
-- se due facce e interessa veramente la coda, allora di coda
if Proc.Fct <= 2 then
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
if Proc.Box:getMin():getX() < b3Solid:getMin():getX() + 1. then
return true
-- controllo se il pezzo + piccolo e serve la lavorazione prima del taglio di separazione
if b3Solid:getDimX() > BD.LEN_SHORT_PART then
return true
else
-- aggiungo faccia
AddFaceToSurf( Proc, nPartId, b3Solid)
return false
end
end
end
-- deve avere la normale principale diretta verso la coda
@@ -299,7 +348,14 @@ function ProcessDovetail.IsTailFeature( Proc, b3Raw)
if vtN:getX() > -0.499 then
return false
else
return true
-- controllo se il pezzo + piccolo e serve la lavorazione prima del taglio di separazione
if b3Solid:getDimX() > BD.LEN_SHORT_PART then
return true
else
-- aggiungo faccia
AddFaceToSurf( Proc, nPartId, b3Solid)
return false
end
end
end
+112 -22
View File
@@ -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