DataBeam :

- aggiunta gestione lavorazione speciale Blockhaus su FAST
- piccola correzione a Split.
This commit is contained in:
Dario Sassi
2021-03-18 11:35:47 +00:00
parent 1b8b079e54
commit 74915620c7
3 changed files with 136 additions and 22 deletions
+77 -11
View File
@@ -1,4 +1,4 @@
-- ProcessLapJoint.lua by Egaltech s.r.l. 2021/03/04
-- ProcessLapJoint.lua by Egaltech s.r.l. 2021/03/16
-- Gestione calcolo mezzo-legno per Travi
-- 2019/10/08 Agg. gestione OpenPocket.
-- 2021/01/24 Con sega a catena ora sempre impostato asse A.
@@ -261,9 +261,11 @@ end
local function VerifyIfByBHSideMill( Proc)
local bUseBHSideMill = false
local bHead = true
local bHeadDir = true
local sMilling
local dMaxMat = 10
-- se non feature BlockHausHalfLap e non abilitato parametro Q per lavorarlo di fianco esco
local dToolDiam = 0
-- se non feature BlockHausHalfLap o non abilitato parametro Q per lavorarlo di fianco esco
local nUseSideTool = EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') or 0
if Proc.Prc ~= 37 and nUseSideTool == 0 then
return false
@@ -282,6 +284,7 @@ local function VerifyIfByBHSideMill( Proc)
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolLength = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dToolLength
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
end
@@ -295,14 +298,20 @@ local function VerifyIfByBHSideMill( Proc)
local dMaxXF = Proc.Box:getMax():getX()
local dMinT = b3Solid:getMin():getX()
local dMaxT = b3Solid:getMax():getX()
-- determino se è più vicino alla testa o al bordo
bHead = ( dMaxT - dMinXF) < ( dMaxXF - dMinT)
-- determino se è più vicino alla testa o al bordo (con offset per evitare problemi a metà)
bHeadDir = ( dMaxT - dMinXF) < ( dMaxXF - dMinT) + 50
bHead = bHeadDir
-- determino se è compatibile con il massimo affondamento dell'utensile
bUseBHSideMill = EgtIf( bHead, (dMaxT - dMinXF), (dMaxXF - dMinT)) < dMaxDepth
bUseBHSideMill = EgtIf( bHead, ( dMaxT - dMinXF), ( dMaxXF - dMinT)) < dMaxDepth
-- se diametro maggiore della testa
if BD.HEAD_DIM_FOR_BH and dToolDiam > BD.HEAD_DIM_FOR_BH then
bHead = true
bUseBHSideMill = true
end
end
end
end
return bUseBHSideMill, bHead, sMilling, dMaxMat
return bUseBHSideMill, bHead, bHeadDir, sMilling, dMaxMat, dToolDiam
end
---------------------------------------------------------------------
@@ -468,8 +477,9 @@ function ProcessLapJoint.IsTailFeature( Proc, b3Raw)
-- in base al tipo di feature attribuisco il significato dei parametri Q
AssignQIdent( Proc)
-- se può essere fatto con utensile tipo lama
local bUseBHSideMill, bHead = VerifyIfByBHSideMill( Proc)
local bUseBHSideMill, bHead, bHeadDir = VerifyIfByBHSideMill( Proc)
if bUseBHSideMill then
Proc.HeadDir = bHeadDir
return not bHead
end
-- verifico se è in coda
@@ -601,7 +611,7 @@ function ProcessLapJoint.Classify( Proc, b3Raw)
else
local rfFac, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
-- se può essere fatto con utensile tipo lama
local bUseBHSideMill, _, _, dMaxMat = VerifyIfByBHSideMill( Proc)
local bUseBHSideMill, _, _, _, dMaxMat = VerifyIfByBHSideMill( Proc)
if bUseBHSideMill and ( dMaxMat <= dV + 15 * GEO.EPS_SMALL) then
return true, false
-- altrimenti controllo se deve essere ruotato con le altre lavorazioni
@@ -3143,10 +3153,21 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
-- verifico se due facce o L con una o due facce di terminazione
local bIsL = ( Proc.Fct == 2 or TestElleShape3( Proc) or TestElleShape4( Proc) == 2)
-- se fattibile con fresa BH di fianco e spessore utensile inferiore alla larghezza faccia
local bMakeBySideMill, bHead, sMilling, dMaxMat = VerifyIfByBHSideMill( Proc)
local bMakeBySideMill, bHead, bHeadDir, sMilling, dMaxMat, dToolDiam = VerifyIfByBHSideMill( Proc)
if bMakeBySideMill and ( dMaxMat <= dV + 15 * GEO.EPS_SMALL) then
-- se smusso non è esclusivo
if nChamfer < 2 then
-- recupero la larghezza della faccia perpendicolarmente alle altre 2
local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, EgtIf( nFacInd == 0, 1, 0), GDB_ID.ROOT)
local vtX = vtN2 ^ vtN
local frRef = Frame3d( ptC, ptC + 100 * vtX, ptC + 100 * vtN2)
local b3Ref = EgtSurfTmGetFacetBBoxRef( Proc.Id, nFacInd, GDB_BB.STANDARD, frRef)
if b3Ref then
dV = b3Ref:getDimY()
dH = b3Ref:getDimX()
end
-- se lavorazione da sotto e lunga, va divisa in due metà
local bDouble = ( vtN:getZ() < -0.5 and dH > ( BD.MAX_LEN_BH_FROM_BOTTOM or 200))
-- inserisco la lavorazione di fresatura
local sName = 'BHMill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sName, sMilling)
@@ -3155,26 +3176,71 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
EgtOutLog( sErr)
return false, sErr
end
sName = EgtGetName( nMchFId)
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, nFacInd}})
-- imposto uso del lato faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( bHead, MCH_MILL_FU.PARAL_LEFT, MCH_MILL_FU.PARAL_RIGHT))
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( bHeadDir, MCH_MILL_FU.PARAL_LEFT, MCH_MILL_FU.PARAL_RIGHT))
-- calcolo step effettivo ed elevazione
local dVcalc = dV - dMaxMat
local dStep = EgtMdbGetCurrMachiningParam( MCH_MP.STEP) or dMaxMat
local nStep = ceil( dVcalc / dStep)
dStep = dVcalc / nStep
if vtN:getZ() < - 0.5 and ( nStep % 2) == 0 then
nStep = nStep + 1
end
dStep = dVcalc / nStep + 0.1
EgtSetMachiningParam( MCH_MP.STEP, dStep)
-- imposto elevazione e dichiaro non si generano sfridi per VMill
local sNotes = 'MaxElev=' .. EgtNumToString( dVcalc + dStep, 2) .. ';'
sNotes = sNotes .. 'VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- attacchi e uscite
if vtN:getZ() > -0.5 then
EgtSetMachiningParam( MCH_MP.LITANG, 0)
EgtSetMachiningParam( MCH_MP.LIPERP, dFacElev + BD.CUT_SIC)
else
EgtSetMachiningParam( MCH_MP.LITANG, dToolDiam / 2 + BD.CUT_SIC)
EgtSetMachiningParam( MCH_MP.LIPERP, 0)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.LINEAR)
EgtSetMachiningParam( MCH_MP.LOTANG, 0)
EgtSetMachiningParam( MCH_MP.LOPERP, dFacElev + BD.COLL_SIC)
if bDouble then
EgtSetMachiningParam( MCH_MP.ENDADDLEN, - dH / 2)
end
end
-- tipo passate multiple
local nStepType = EgtIf( ( Proc.HeadDir and vtN:getY() < -0.5) or ( not Proc.HeadDir and vtN:getY() > 0.5), MCH_MILL_ST.ONEWAY, MCH_MILL_ST.ZIGZAG)
EgtSetMachiningParam( MCH_MP.STEPTYPE, nStepType)
-- imposto posizione braccio porta testa
local nSCC = EgtIf( ( vtN:getY() > 0.5 or ( bHeadDir and vtN:getZ() > 0.5 ) or ( not bHeadDir and vtN:getZ() < -0.5)), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
-- se divisa in due metà
if bDouble then
local nMchFNId = EgtCopyMachining( sName .. '_2', sName)
if not nMchFNId then
local sErr = 'Error copying machining ' .. sName
EgtOutLog( sErr)
return false, sErr
end
-- inverto direzione e lato di lavoro e direzione ausiliaria
local bInvert = EgtGetMachiningParam( MCH_MP.INVERT)
EgtSetMachiningParam( MCH_MP.INVERT, not bInvert)
local nWorkSide = EgtGetMachiningParam( MCH_MP.WORKSIDE)
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( nWorkSide == MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT))
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( nSCC == MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP))
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFNId, false)
return false, sErr
end
end
end
-- altrimenti lavoro con svuotatura
else