DataBeam :
- TyroleanDovetail ammessa anche da sotto se con 2 facce, di estremità e corta - migliorato riconoscimento Blockhaus di estremità parziali.
This commit is contained in:
+82
-89
@@ -352,113 +352,98 @@ local function VerifyPocket( Proc, dDiam, dDepth, dMaxTotLen, sMchFindMaster)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function VerifyBHSideMill( Proc, bMasterIsU, bMasterIsL, bSinglePart, bPrevBhSideMill)
|
||||
local function VerifyBHSideMill( Proc, bIsU, bIsL, bSinglePart, bPrevBhSideMill)
|
||||
|
||||
local bUseBHSideMill = false
|
||||
local bHead = true
|
||||
local bHeadDir = true
|
||||
local sMilling
|
||||
local dThickTool = 0
|
||||
local dToolDiam = 0
|
||||
-- 22/09/2021 Su richiesta di Alessandro Sola, si toglie la richiesta di presenza del parametro Q per poter applicare
|
||||
-- la lavorazione su più features( che non hanno questo parametro Q), quindi questa lavorazione viene verificata se è abilitato il parametro utensile
|
||||
-- che ooviamente tramite la lavorazione è abbinata alla lista lavorazioni con BHSideMill.
|
||||
-- Al fine di mantenere il funzionamento precedente (purtroppo non sono stati descritti i motivi del confrontare il parametro Q)
|
||||
-- si elude il controllo del Q solo se la variabile del Beamdata BD.BH_MACHINE segnala che non è una macchina tipo BH (ha la fresa blockhaus al posto della lama)
|
||||
|
||||
-- se non feature BlockHausHalfLap o non abilitato parametro Q per lavorarlo di fianco esco
|
||||
-- se non feature BlockHausHalfLap e non abilitato parametro Q per lavorarlo di fianco e non macchina BH esco
|
||||
local nUseSideTool = EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') or 0
|
||||
if Proc.Prc ~= 37 and nUseSideTool == 0 and not BD.BH_MACHINE then
|
||||
return false
|
||||
end
|
||||
-- verifico se U
|
||||
local bIsU
|
||||
local bIsL
|
||||
|
||||
if bMasterIsU ~= nil then
|
||||
bIsU = bMasterIsU
|
||||
else
|
||||
bIsU = ( Proc.Fct == 3 and not TestElleShape3( Proc))
|
||||
end
|
||||
if bMasterIsL ~= nil then
|
||||
bIsL = bMasterIsL
|
||||
else
|
||||
-- verifico se due facce o L con una o due facce di terminazione
|
||||
bIsL = ( Proc.Fct == 2 or TestElleShape3( Proc) or TestElleShape4( Proc) == 2)
|
||||
end
|
||||
-- recupero l'ingombro della trave
|
||||
local nPartId = EgtGetParent( EgtGetParent( Proc.Id) or GDB_ID.NULL)
|
||||
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
if not b3Solid then
|
||||
return false
|
||||
end
|
||||
|
||||
-- verifico se la funzione è lanciata da IsTailFeature o Classify
|
||||
if bSinglePart == nil then
|
||||
-- se lunghezza non richiede spezzatura setto la variabile bSinglePart per non fare con fresa BH
|
||||
-- perchè deve avere almeno 2 facce
|
||||
-- se lunghezza non richiede spezzatura setto la variabile bSinglePart
|
||||
if not( ( Proc.Box:getDimX() > BD.LONGCUT_MAXLEN) or
|
||||
( Proc.Box:getDimX() > 0.8 * b3Solid:getDimX() and Proc.Box:getDimX() > BD.LONGCUT_ENDLEN)) then
|
||||
bSinglePart = true
|
||||
end
|
||||
end
|
||||
-- ad oggi 22/09/2021 la lavorazione BH non va bene se le facce di chiusura non sono perpendicolari a X, quindi
|
||||
-- se non sono perpendicolari non si applica la lavorazione BH
|
||||
|
||||
-- determino se U o L(anche con 1 o 2 facce di terminazione)
|
||||
bIsU = ( bIsU or ( Proc.Fct == 3 and not TestElleShape3( Proc)))
|
||||
bIsL = ( bIsL or ( Proc.Fct == 2 or TestElleShape3( Proc) or TestElleShape4( Proc) == 2))
|
||||
|
||||
-- la lavorazione BH non va bene se le facce di chiusura non sono perpendicolari a X
|
||||
if bIsU or bIsL then
|
||||
local bExit = false
|
||||
for i = 1, Proc.Fct do
|
||||
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, i-1, GDB_ID.ROOT)
|
||||
if abs(vtN:getX()) > 0.001 and abs(vtN:getX()) < 0.999962 then
|
||||
bExit = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if bExit then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-- se forma a U o L verifico che
|
||||
-- se U e lunghezza non richiede spezzatura
|
||||
if ( bIsU or bIsL or ( Proc.Fct == 1 and not bSinglePart) ) and Proc.Box:getDimX() <= BD.LONGCUT_MAXLEN then
|
||||
-- se faccia singola di un passo multiplo e risultato precedente non applicato, riporto il risultato del passo precedente
|
||||
if ( bIsU or bIsL or ( Proc.Fct == 1 and not bSinglePart) ) and bPrevBhSideMill ~= nil and not bPrevBhSideMill then
|
||||
return false
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
sMilling = ML.FindMilling( 'BHSideMill')
|
||||
if sMilling then
|
||||
-- recupero i dati dell'utensile
|
||||
local dToolLength = 0
|
||||
local dMaxDepth = 0
|
||||
if EgtMdbSetCurrMachining( sMilling) then
|
||||
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
|
||||
dThickTool = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dThickTool
|
||||
end
|
||||
end
|
||||
-- verifico se la feature è abbastanza vicino a testa/coda da permettere la lavorazione con questo utensile
|
||||
if b3Solid then
|
||||
local dMinXF = Proc.Box:getMin():getX()
|
||||
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 (con offset per evitare problemi a metà)
|
||||
bHeadDir = ( dMaxT - dMinXF) < ( dMaxXF - dMinT) + 50
|
||||
bHead = bHeadDir
|
||||
-- determino se è compatibile con il massimo affondamento dell'utensile
|
||||
-- nota F.M il 22/09/2021: non sarebbe meglio utilizzare lo spessore lama invece della massima lavorazione?
|
||||
-- questo perchè Alessandro ha settato il parametro Max Material a 80 con spessore lama 42
|
||||
-- se invece il Max material viene usato per definire fino a che affondamento (lungo l'asse utensile)
|
||||
-- può arrivare prima di collidere con la testa allora si può utilizzare il 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
|
||||
if abs( vtN:getX()) > 0.001 and abs( vtN:getX()) < 0.999962 then
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- se non U o L o singola faccia di multipla, non accettata
|
||||
if not ( ( bIsU or bIsL or ( Proc.Fct == 1 and not bSinglePart)) and Proc.Box:getDimX() <= BD.LONGCUT_MAXLEN) then
|
||||
return false
|
||||
end
|
||||
|
||||
-- se risultato precedente di passo multiplo negativo, riporto il risultato del passo precedente
|
||||
if bPrevBhSideMill ~= nil and not bPrevBhSideMill then
|
||||
return false
|
||||
end
|
||||
|
||||
-- recupero la lavorazione
|
||||
local sMilling = ML.FindMilling( 'BHSideMill')
|
||||
if not sMilling then
|
||||
return false
|
||||
end
|
||||
|
||||
-- recupero i dati dell'utensile
|
||||
local dToolLength = 0
|
||||
local dToolDiam = 0
|
||||
local dMaxDepth = 0
|
||||
local dThickTool = 0
|
||||
if EgtMdbSetCurrMachining( sMilling) then
|
||||
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
|
||||
dThickTool = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dThickTool
|
||||
end
|
||||
end
|
||||
|
||||
-- verifico se abbastanza larga (oppure L) rispetto all'utensile
|
||||
if Proc.Box:getDimX() < dThickTool - 15 * GEO.EPS_SMALL and not bIsL then
|
||||
return false
|
||||
end
|
||||
|
||||
-- limiti longitudinali
|
||||
local dMinXF = Proc.Box:getMin():getX()
|
||||
local dMaxXF = Proc.Box:getMax():getX()
|
||||
local dMinT = b3Solid:getMin():getX()
|
||||
local dMaxT = b3Solid:getMax():getX()
|
||||
|
||||
-- determino se è più vicino alla testa o alla coda (con offset per evitare problemi a metà)
|
||||
local bHeadDir = ( dMaxT - dMinXF) < ( dMaxXF - dMinT) + 50
|
||||
local bHead = bHeadDir
|
||||
|
||||
-- verifico se raggiungibile con la testa senza collisioni
|
||||
local bUseBHSideMill = EgtIf( bHead, ( dMaxT - dMinXF), ( dMaxXF - dMinT)) < dMaxDepth
|
||||
-- se diametro utensile maggiore della testa
|
||||
if BD.HEAD_DIM_FOR_BH and dToolDiam > BD.HEAD_DIM_FOR_BH then
|
||||
bHead = true
|
||||
bUseBHSideMill = true
|
||||
end
|
||||
|
||||
return bUseBHSideMill, bHead, bHeadDir, sMilling, dThickTool, dToolDiam
|
||||
end
|
||||
|
||||
@@ -680,6 +665,11 @@ function ProcessLapJoint.Classify( Proc, b3Raw)
|
||||
return true, false
|
||||
-- se 2 facce
|
||||
elseif Proc.Fct == 2 then
|
||||
-- se può essere fatto con utensile tipo lama
|
||||
local bUseBHSideMill = VerifyBHSideMill( Proc)
|
||||
if bUseBHSideMill then
|
||||
return true, false
|
||||
end
|
||||
-- dati delle facce
|
||||
local ptC = {}
|
||||
local vtN = {}
|
||||
@@ -770,8 +760,8 @@ function ProcessLapJoint.Classify( Proc, b3Raw)
|
||||
rfFac:rotate( rfFac:getOrigin(), rfFac:getVersZ(), 90)
|
||||
end
|
||||
-- se può essere fatto con utensile tipo lama
|
||||
local bUseBHSideMill, _, _, _, dMaxMat = VerifyBHSideMill( Proc)
|
||||
if bUseBHSideMill and ( dMaxMat <= dV + 15 * GEO.EPS_SMALL) then
|
||||
local bUseBHSideMill = VerifyBHSideMill( Proc)
|
||||
if bUseBHSideMill then
|
||||
return true, false
|
||||
-- altrimenti controllo se deve essere ruotato con le altre lavorazioni
|
||||
else
|
||||
@@ -4552,7 +4542,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
||||
if bPrevBhSideMill == nil then
|
||||
bPrevBhSideMill = bMakeBySideMill
|
||||
end
|
||||
if bMakeBySideMill and ( dMaxMat <= dV + 15 * GEO.EPS_SMALL) then
|
||||
if bMakeBySideMill then
|
||||
-- se smusso non è esclusivo
|
||||
if nChamfer < 2 then
|
||||
-- se lavorazione da sotto e lunga, va divisa in due metà
|
||||
@@ -5556,8 +5546,11 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local bDownHead = TestTwoFacesDownHead( Proc)
|
||||
-- determino l'angolo tra le facce
|
||||
local bAdj, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT)
|
||||
-- se con BH
|
||||
if VerifyBHSideMill( Proc) then
|
||||
return MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, true)
|
||||
-- se ortogonali e non forzata lama, con fresa
|
||||
if not bUseBlade and bAdj and abs( dAng + 90) < 1 then
|
||||
elseif not bUseBlade and bAdj and abs( dAng + 90) < 1 then
|
||||
-- se piccole
|
||||
if Proc.Box:getDimX() < MAX_MILL_LIN and ( Proc.Box:getDimZ() < MAX_MILL_LIN or Proc.Box:getDimY() < MAX_MILL_LIN) then
|
||||
return MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId, bDownHead)
|
||||
|
||||
Reference in New Issue
Block a user