|
|
|
@@ -155,18 +155,22 @@ local bTrySidePocketAtFirst = true
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
-- Riconoscimento della feature
|
|
|
|
|
function ProcessLapJoint.Identify( Proc)
|
|
|
|
|
return ( (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 16) or
|
|
|
|
|
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 17) or
|
|
|
|
|
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 20) or
|
|
|
|
|
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 25) or
|
|
|
|
|
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 30) or
|
|
|
|
|
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 32) or
|
|
|
|
|
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 33) or
|
|
|
|
|
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 34) or
|
|
|
|
|
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 90) or
|
|
|
|
|
( Proc.Grp == 4 and Proc.Prc == 37) or
|
|
|
|
|
( Proc.Grp == 4 and Proc.Prc == 39) or
|
|
|
|
|
( Proc.Grp == 4 and Proc.Prc == 120))
|
|
|
|
|
if Proc.bForceMill then
|
|
|
|
|
return true
|
|
|
|
|
else
|
|
|
|
|
return ( (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 16) or
|
|
|
|
|
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 17) or
|
|
|
|
|
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 20) or
|
|
|
|
|
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 25) or
|
|
|
|
|
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 30) or
|
|
|
|
|
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 32) or
|
|
|
|
|
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 33) or
|
|
|
|
|
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 34) or
|
|
|
|
|
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 90) or
|
|
|
|
|
( Proc.Grp == 4 and Proc.Prc == 37) or
|
|
|
|
|
( Proc.Grp == 4 and Proc.Prc == 39) or
|
|
|
|
|
( Proc.Grp == 4 and Proc.Prc == 120))
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
@@ -986,8 +990,11 @@ local function MakeOneFaceByMill( Proc, nPhase, nRawId, nPartId)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( bUp, MCH_MILL_FU.ORTHO_RIGHT, MCH_MILL_FU.PARAL_RIGHT))
|
|
|
|
|
end
|
|
|
|
|
-- imposto lato di correzione
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
|
|
|
|
if not bUp then EgtSetMachiningParam( MCH_MP.INVERT, true) end
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
|
|
|
|
if not bUp then
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
|
|
|
|
end
|
|
|
|
|
-- imposto posizione braccio porta testa
|
|
|
|
|
if vtN:getY() < GEO.EPS_SMALL then
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
|
|
|
|
@@ -3472,6 +3479,7 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, tvtN, nBas
|
|
|
|
|
|
|
|
|
|
local sMchFind = 'Pocket'
|
|
|
|
|
local dAngLimit = 40
|
|
|
|
|
local sWarn
|
|
|
|
|
|
|
|
|
|
-- se feature é larga come trave imposto openpocket
|
|
|
|
|
if nDiffWidth == 0 then
|
|
|
|
@@ -3485,6 +3493,15 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, tvtN, nBas
|
|
|
|
|
-- calcolo l'angolo dalla verticale dall'angolo tra le due facce, perchè la feature potrebbe essere ruotata sulla Z locale della
|
|
|
|
|
-- faccia principale e quindi la componente X del versore della faccia potrebbe dare un valore non coerente
|
|
|
|
|
local dDiffFromSqAng = dAng + 90
|
|
|
|
|
-- informazioni sul lato da lavorare
|
|
|
|
|
local Edges = BL.GetEdgesInfo( Proc, Proc.Face[nSideFace + 1])
|
|
|
|
|
local EdgeToMachine = {}
|
|
|
|
|
for i = 1, #Edges do
|
|
|
|
|
local CurrentEdge = Edges[i]
|
|
|
|
|
if CurrentEdge.AdjacentFaceId == nBaseFace then
|
|
|
|
|
EdgeToMachine = CurrentEdge
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- se l'angolo dalla verticale si discosta di più dell'angolo limite impostato, utilizzo la svuotatura
|
|
|
|
|
if cos( dDiffFromSqAng) < cos( dAngLimit) then
|
|
|
|
|
-- applico la svuotatura
|
|
|
|
@@ -3510,14 +3527,28 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, tvtN, nBas
|
|
|
|
|
end
|
|
|
|
|
-- aggiungo geometria
|
|
|
|
|
EgtSetMachiningGeometry( {{ Proc.Id, nSideFace}})
|
|
|
|
|
-- imposto uso faccia
|
|
|
|
|
local nFaceUse = BL.GetNearestOrthoOpposite(tvtN[1])
|
|
|
|
|
-- imposto vettore direzione e faceUse
|
|
|
|
|
local vtFaceUse = EdgeToMachine.ToolDirection
|
|
|
|
|
local sUserNotes = ''
|
|
|
|
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'VtFaceUse', EgtNumToString( vtFaceUse:getX(),3) .. ',' .. EgtNumToString( vtFaceUse:getY(),3) .. ',' .. EgtNumToString( vtFaceUse:getZ(),3))
|
|
|
|
|
local nFaceUse = BL.GetNearestOrthoOpposite( vtFaceUse)
|
|
|
|
|
-- aggiusto i parametri
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH')
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.OFFSR, 0)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.INVERT, false)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, 1)
|
|
|
|
|
-- imposto allungamenti iniziale e finale
|
|
|
|
|
if EdgeToMachine.IsStartOpen then
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dDiamTool / 2)
|
|
|
|
|
else
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.STARTADDLEN, -dDiamTool / 2)
|
|
|
|
|
end
|
|
|
|
|
if EdgeToMachine.IsEndOpen then
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dDiamTool / 2)
|
|
|
|
|
else
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.ENDADDLEN, -dDiamTool / 2)
|
|
|
|
|
end
|
|
|
|
|
-- imposto posizione braccio porta testa
|
|
|
|
|
if tvtN[2]:getY() < GEO.EPS_SMALL then
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
|
|
|
|
@@ -3525,9 +3556,9 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, tvtN, nBas
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
|
|
|
|
|
end
|
|
|
|
|
-- imposto elevazione e dichiaro non si generano sfridi per VMill
|
|
|
|
|
local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';'
|
|
|
|
|
sNotes = sNotes .. 'VMRS=0;'
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
|
|
|
|
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dElev, 1))
|
|
|
|
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'VMRS', 0)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
|
|
|
|
if not ML.ApplyMachining( true, false) then
|
|
|
|
|
local _, sErr = EgtGetLastMachMgrError()
|
|
|
|
|
EgtSetOperationMode( nMchId, false)
|
|
|
|
@@ -3547,36 +3578,27 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, tvtN, nBas
|
|
|
|
|
bOpenStart = true
|
|
|
|
|
bOpenEnd = true
|
|
|
|
|
else
|
|
|
|
|
local vAdj2 = EgtSurfTmFacetAdjacencies( Proc.Id, (nBaseFace))[1]
|
|
|
|
|
for j = 1, #vAdj2 do
|
|
|
|
|
if vAdj2[j] == (nSideFace) then
|
|
|
|
|
-- Se non esiste faccia adiacente a lato precedente -> inizio aperto
|
|
|
|
|
local i = EgtIf( j > 1, j - 1, #vAdj2)
|
|
|
|
|
while vAdj2[i] == (nSideFace) do
|
|
|
|
|
i = EgtIf( i > 1, i - 1, #vAdj2)
|
|
|
|
|
end
|
|
|
|
|
bOpenStart = ( vAdj2[i] < 0)
|
|
|
|
|
-- Se non esiste faccia adiacente a lato successivo -> fine aperto
|
|
|
|
|
local k = EgtIf( j < #vAdj2, j + 1, 1)
|
|
|
|
|
while vAdj2[k] == (nSideFace) do
|
|
|
|
|
k = EgtIf( k < #vAdj2, k + 1, 1)
|
|
|
|
|
end
|
|
|
|
|
bOpenEnd = ( vAdj2[k] < 0)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
bOpenStart = EdgeToMachine.IsStartOpen
|
|
|
|
|
bOpenEnd = EdgeToMachine.IsEndOpen
|
|
|
|
|
end
|
|
|
|
|
local sMilling
|
|
|
|
|
if nUseRoughTool > 0 then
|
|
|
|
|
sMilling = ML.FindMilling( 'Long2Cut', nil, sTuuidPk)
|
|
|
|
|
if not sMilling then sMilling = ML.FindMilling( 'Long2Cut') end
|
|
|
|
|
if not sMilling then sMilling = ML.FindMilling( 'LongSmallCut', nil, sTuuidPk) end
|
|
|
|
|
else
|
|
|
|
|
sMilling = ML.FindMilling( 'LongSmallCut', nil, sTuuidPk)
|
|
|
|
|
if not sMilling then sMilling = ML.FindMilling( 'LongSmallCut') end
|
|
|
|
|
if not sMilling then sMilling = ML.FindMilling( 'Long2Cut', nil, sTuuidPk) end
|
|
|
|
|
end
|
|
|
|
|
if not sMilling then
|
|
|
|
|
local sErr = 'Error : Long2Cut & LongSmallCut not found in library'
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
return false, sErr
|
|
|
|
|
sMilling = ML.FindMilling( 'LongSmallCut')
|
|
|
|
|
if not sMilling then sMilling = ML.FindMilling( 'Long2Cut') end
|
|
|
|
|
if not sMilling then
|
|
|
|
|
local sErr = 'Error : Long2Cut & LongSmallCut not found in library'
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
return false, sErr
|
|
|
|
|
else
|
|
|
|
|
sWarn = 'Warning : lapjoint chamfer angle machined with different tool'
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- recupero i dati dell'utensile
|
|
|
|
|
local dTDiam = 50
|
|
|
|
@@ -3602,7 +3624,11 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, tvtN, nBas
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
|
|
|
|
-- sistemazione inversione del percorso
|
|
|
|
|
local nWrkSide = EgtGetMachiningParam( MCH_MP.WORKSIDE)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.INVERT, ( nWrkSide ~= MCH_MILL_WS.RIGHT))
|
|
|
|
|
local bInvert = nWrkSide ~= MCH_MILL_WS.RIGHT
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.INVERT, bInvert)
|
|
|
|
|
if bInvert then
|
|
|
|
|
bOpenStart, bOpenEnd = bOpenEnd, bOpenStart
|
|
|
|
|
end
|
|
|
|
|
-- setto a 0 eventuali offset
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.OFFSR, 0)
|
|
|
|
|
-- calcolo elevazione per allungamenti attacchi con fianchi chiusi
|
|
|
|
@@ -3625,7 +3651,11 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, tvtN, nBas
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LITANG, 0)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LOTANG, 0)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LIPERP, dElev)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LOPERP, dElev)
|
|
|
|
|
if bOpenEnd then
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LOPERP, 0)
|
|
|
|
|
else
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LOPERP, dElev)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if bOpenEnd then
|
|
|
|
@@ -3638,8 +3668,12 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, tvtN, nBas
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LI.LINEAR)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LITANG, 0)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LOTANG, 0)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LIPERP, dElev)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LOPERP, dElev)
|
|
|
|
|
if bOpenStart then
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LIPERP, 0)
|
|
|
|
|
else
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LIPERP, dElev)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- eseguo
|
|
|
|
@@ -3650,7 +3684,8 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, tvtN, nBas
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return true
|
|
|
|
|
|
|
|
|
|
return true, sWarn
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
@@ -7241,7 +7276,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|
|
|
|
-- in base al tipo di feature attribuisco il significato dei parametri Q
|
|
|
|
|
AssignQIdent( Proc)
|
|
|
|
|
-- se non forzate frese, uso la lama
|
|
|
|
|
local bUseBlade = EgtIf( Proc.Prc == 90, false, EgtGetInfo( Proc.Id, Q_USE_ROUGH_TOOL, 'i') ~= 1 and EgtGetInfo( Proc.Id, Q_USE_MILL, 'i') ~= 1)
|
|
|
|
|
local bUseBlade = EgtIf( Proc.Prc == 90 or Proc.bForceMill, false, EgtGetInfo( Proc.Id, Q_USE_ROUGH_TOOL, 'i') ~= 1 and EgtGetInfo( Proc.Id, Q_USE_MILL, 'i') ~= 1)
|
|
|
|
|
local nForceUseBladeOnNotContinueFace
|
|
|
|
|
-- se ho attivo la lama e ho la feature 30, verifico i parametri Q propri della feature
|
|
|
|
|
if bUseBlade then
|
|
|
|
|