DataBeam :

- aggiunti anti scheggia di Filippo prima versione.
This commit is contained in:
DarioS
2021-07-15 09:51:36 +02:00
parent 6c95b78e80
commit 406e032226
2 changed files with 552 additions and 153 deletions
+26 -3
View File
@@ -1,4 +1,4 @@
-- BeamLib.lua by Egaltech s.r.l. 2021/07/08
-- BeamLib.lua by Egaltech s.r.l. 2021/07/15
-- Libreria globale per Travi
-- 2020/07/28 Corretto calcolo attacchi e uscite di lame per non uscire dalla faccia sotto.
-- 2020/08/18 Aggiunto a GetNearestParalOpposite e GetNearestOrthoOpposite parametro opzionale vtNorm.
@@ -13,6 +13,7 @@
-- 2021/06/27 Aggiunta funzione GetOtherFaceElevation.
-- 2021/07/01 In GetNearestOrthoOpposite premio direzioni destra/sinistra.
-- 2021/07/08 Modifiche in MakeOneFaceBySaw per gestione taglio con due segmenti.
-- 2021/07/15 Aggiunta GetFaceElevationFromPointDir.
-- Tabella per definizione modulo
local BeamLib = {}
@@ -426,7 +427,7 @@ function BeamLib.GetFaceElevation( nSurfId, nFac, nPartId)
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFac, GDB_ID.ROOT)
if not ptC or not vtN then return 0 end
-- riferimento OCS della faccia per ricavare elevazione rispetto alla faccia della superficie
local frOCS = Frame3d( ptC, vtN) ;
local frOCS = Frame3d( ptC, vtN)
local b3Box = EgtGetBBoxRef( nSurfId, GDB_BB.STANDARD, frOCS)
local dElev = b3Box:getMax():getZ()
-- se definito identificativo di pezzo
@@ -457,7 +458,7 @@ function BeamLib.GetOtherFaceElevation( nSurfId, nOtherSurfId, nOtherFac, nPartI
local ptC, vtN = EgtSurfTmFacetCenter( nOtherSurfId, nOtherFac, GDB_ID.ROOT)
if not ptC or not vtN then return 0 end
-- riferimento OCS della faccia per ricavare elevazione rispetto alla faccia della superficie
local frOCS = Frame3d( ptC, vtN) ;
local frOCS = Frame3d( ptC, vtN)
local b3Box = EgtGetBBoxRef( nSurfId, GDB_BB.STANDARD, frOCS)
local dElev = b3Box:getMax():getZ()
-- se definito identificativo di pezzo
@@ -471,6 +472,28 @@ function BeamLib.GetOtherFaceElevation( nSurfId, nOtherSurfId, nOtherFac, nPartI
return dElev
end
---------------------------------------------------------------------
function BeamLib.GetFaceElevationFromPointDir( nSurfId, nPartId, ptC, vtN, nIdGeomMaster)
if not ptC or not vtN then return 0 end
-- riferimento OCS della faccia per ricavare elevazione rispetto alla faccia della superficie
local frOCS = Frame3d( ptC, vtN)
local b3Box = EgtGetBBoxRef( nSurfId, GDB_BB.STANDARD, frOCS)
local dElev = b3Box:getMax():getZ()
-- se definito identificativo di pezzo
if nPartId then
-- se superficie con più facce
if EgtSurfTmFacetCount( nSurfId) > 1 then
_, dElev = BeamLib.GetPointDirDepth( nPartId, ptC, vtN)
else
local b3Solid = EgtGetBBoxRef( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD, frOCS)
if b3Solid and b3Solid:getMax():getZ() > dElev then
dElev = b3Solid:getMax():getZ()
end
end
end
return dElev
end
---------------------------------------------------------------------
function BeamLib.GetFaceWithMostAdj( nSurfId, nPartId, bCompare3Fc, dCosSideAng)
-- recupero il numero di facce
+526 -150
View File
@@ -1,4 +1,4 @@
-- ProcessLapJoint.lua by Egaltech s.r.l. 2021/07/02
-- ProcessLapJoint.lua by Egaltech s.r.l. 2021/07/15
-- Gestione calcolo mezzo-legno per Travi
-- 2019/10/08 Agg. gestione OpenPocket.
-- 2021/01/24 Con sega a catena ora sempre impostato asse A.
@@ -19,6 +19,7 @@
-- 2021/06/21 Nel caso precedente si fa la terza svuotatura anche se è possibile fare una sola delle prime due (altra da sotto).
-- 2021/06/21 Gestione ripresa spigoli o contorno con fresa più piccola ( diametro < 3/4 utensile svuotatura) attivata da parametro Q.
-- 2021/07/02 Migliorie e correzioni su svuotature e pulitura spigoli.
-- 2021/07/15 Aggiunti anctischeggia con fresa.
-- Tabella per definizione modulo
local ProcessLapJoint = {}
@@ -115,8 +116,10 @@ local function AssignQIdent( Proc)
Q_DEPTH_CHAMFER = 'Q07' -- d
elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 32 then
Q_SIDE_ROUGH_TOOL = 'Q01' -- i
Q_CONTOUR_SMALL_TOOL = 'Q02' -- i
Q_ANTISPLINT_TYPE = 'Q06' -- i
elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 34 then
Q_CONTOUR_SMALL_TOOL = 'Q01' -- i
Q_ANTISPLINT_TYPE = 'Q06' -- i
end
-- le altre features gestite non hanno parametri Q
@@ -1134,19 +1137,21 @@ local function ChooseCorner( Proc, nFacInd)
end
---------------------------------------------------------------------
local function ChooseBlindContour( Proc, nFacInd)
local function ChooseContour( Proc, nFacInd, bVerifyCorner)
-- Recupero le adiacenze della faccia principale
local vAdj = EgtSurfTmFacetAdjacencies( Proc.Id, nFacInd)[1]
-- Verifico che ci siano facce adiacenti consecutive (sicuramente con angolo)
local bCorner = false
for i = 1, #vAdj do
local j = EgtIf( i > 1, i - 1, #vAdj)
if vAdj[i] >= 0 and vAdj[j] >= 0 then
bCorner = true
break
-- Se richiesto, verifico che ci siano facce adiacenti consecutive (sicuramente con angolo)
if bVerifyCorner then
local bCorner = false
for i = 1, #vAdj do
local j = EgtIf( i > 1, i - 1, #vAdj)
if vAdj[i] >= 0 and vAdj[j] >= 0 then
bCorner = true
break
end
end
if not bCorner then return {} end
end
if not bCorner then return {} end
-- Cerco le facce adiacenti con angolo convesso
local tFacAdjMain = {}
for i = 1, #vAdj do
@@ -1353,16 +1358,16 @@ local function SetOpenSide( nPathInt, vtOrtho, b3Solid, nAddGrpId, nStartPoint)
end
end
end
return false
end
---------------------------------------------------------------------
local function MakeRoundCleanCorner( Proc, nPhase, nRawId, nPartId, b3Raw,
nFacInd, nAddGrpId, dDiam)
nFacInd, nAddGrpId, dDiam, bMillDown, bDoubleSide)
-- recupero la lavorazione senza considerare l'elevazione
local sMilling = ML.FindMilling( 'SmallToolContour')
local sMilling = ML.FindMilling( 'SmallToolContour' .. EgtIf( bMillDown and not bDoubleSide, '_H2', ''))
if not sMilling then
local sMyWarn = 'Warning : SmallToolContour not found in library'
EgtOutLog( sMyWarn)
@@ -1386,7 +1391,7 @@ local function MakeRoundCleanCorner( Proc, nPhase, nRawId, nPartId, b3Raw,
end
-- ottengo gli angoli dove applicare il percorso con fresa più piccola
local dMaxLen, nIdLine, tFacAdj = ChooseCorner( Proc, nFacInd)
local _, _, tFacAdj = ChooseCorner( Proc, nFacInd)
-- se non trovato nessun angolo interno valido esco
if #tFacAdj == 0 then
return true
@@ -1395,7 +1400,7 @@ local function MakeRoundCleanCorner( Proc, nPhase, nRawId, nPartId, b3Raw,
-- recupero la normale della faccia di fondo
local vtN1 = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
-- se fresatura da sotto salto la lavorazione
if vtN1:getZ() < BD.DRILL_VZ_MIN then
if vtN1:getZ() < BD.DRILL_VZ_MIN and not bMillDown then
local sErr = 'Error : milling from bottom '
EgtOutLog( sErr)
return false, sErr
@@ -1480,6 +1485,8 @@ local function MakeRoundCleanCorner( Proc, nPhase, nRawId, nPartId, b3Raw,
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- imposto lato di lavoro sinistro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE
if not BD.C_SIMM then
@@ -1535,12 +1542,12 @@ end
---------------------------------------------------------------------
local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw,
nFacInd, nAddGrpId, dDiam, nFunction, bDoubleSide,
vtOrtho, nPathInt, nSurfInt, b3Solid, dDepth,
bOneShot)
nFacInd, nAddGrpId, dDiam, nFunction, bMillDown,
bDoubleSide, vtOrtho, nPathInt, nSurfInt, b3Solid,
dDepth, bOneShot)
-- recupero la lavorazione senza considerare l'elevazione perché viene calcolata l'elevazione utile
local sMilling = ML.FindMilling( 'SmallToolContour')
local sMilling = ML.FindMilling( 'SmallToolContour' .. EgtIf( bMillDown and not bDoubleSide, '_H2', ''))
if not sMilling then
local sMyWarn = 'Warning : SmallToolContour not found in library'
EgtOutLog( sMyWarn)
@@ -1556,6 +1563,21 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw,
dTMaxDepth = EgtTdbGetCurrToolMaxDepth() or dTMaxDepth
end
local sMillingDn = ML.FindMilling( 'SmallToolContour' .. EgtIf( bMillDown and bDoubleSide, '_H2', ''))
if not sMillingDn then
local sMyWarn = 'Warning : Opposite SmallToolContour not found in library'
EgtOutLog( sMyWarn)
return true, sMyWarn
end
-- recupero i dati dell'utensile testa da sotto
local dTDiamDn = 50
local dTMaxDepthDn = 0
if EgtMdbSetCurrMachining( sMillingDn) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
dTDiamDn = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dTDiamDn
dTMaxDepthDn = EgtTdbGetCurrToolMaxDepth() or dTMaxDepthDn
end
-- se il diametro trovato non è minore dei 3/4 del diametro utilizzato in precedenza, esco
if dTDiam > ( 0.75 * dDiam) then
local sMyWarn = 'Warning : tool diameter not enough small'
@@ -1567,11 +1589,12 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw,
local nFirstId, nNumId
local dMaxElev
local dCollSic = 0
local dExtraDepth = 0
-- se non ho la faccia aggiunta
if not nPathInt then
-- cerco gli angoli dove applicare il percorso con fresa piú piccola e i lati in comune
local tFacAdjMain = ChooseBlindContour( Proc, nFacInd)
local tFacAdjMain = ChooseContour( Proc, nFacInd, true)
-- se non trovato nessun angolo interno da pulire esco
if #tFacAdjMain == 0 then
return true
@@ -1579,7 +1602,7 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw,
-- normale alla faccia di fondo
vtN1 = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
-- se fresatura da sotto salto la lavorazione
if vtN1:getZ() < BD.DRILL_VZ_MIN then
if vtN1:getZ() < BD.DRILL_VZ_MIN and not bMillDown then
local sErr = 'Error : milling from bottom'
EgtOutLog( sErr)
return false, sErr
@@ -1633,7 +1656,25 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw,
dCollSic = CalcCollisionSafety( vtOrtho)
-- calcolo elevazione dalla faccia trasversale aggiunta
local dSurfIntElev = BL.GetOtherFaceElevation( Proc.Id, nSurfInt, 0)
dMaxElev = dSurfIntElev
if bDoubleSide then
dMaxElev = dSurfIntElev
else
dMaxElev = dDepth
-- se la precedente svuotatura è stata fatta completamente in una sola volta
-- valuto di nuovo se devo fare due passate o una sola
if bOneShot then
-- se non è possibile svuotare completamente da una sola parte
if dTMaxDepth <= ( dMaxElev + BD.CUT_EXTRA + dCollSic) then
bDoubleSide = true
dMaxElev = BL.GetOtherFaceElevation( Proc.Id, nSurfInt, 0)
else
dExtraDepth = dMaxElev - BL.GetOtherFaceElevation( Proc.Id, nSurfInt, 0)
end
-- altrimenti non è stata fatta completamente calcolo la distanza tra faccia aggiunta e profondità superficie
else
dExtraDepth = dMaxElev - BL.GetOtherFaceElevation( Proc.Id, nSurfInt, 0)
end
end
-- normale alla faccia aggiunta
vtN1 = Vector3d( vtOrtho)
-- imposto i lati aperti
@@ -1659,6 +1700,8 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw,
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nIdPath, -1}})
-- imposto lato di lavoro sinistro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- inversione direzione utensile
local bInvertMach = false
if nPathInt then
@@ -1708,7 +1751,7 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw,
if ( dMaxElev + dCollSic) > dTMaxDepth then
dMachDepth = dTMaxDepth - ( dMaxElev + dCollSic)
end
EgtSetMachiningParam( MCH_MP.DEPTH, dMachDepth)
EgtSetMachiningParam( MCH_MP.DEPTH, dMachDepth + dExtraDepth)
-- setto se devo invertire il percorso
local bInvert = CheckToInvert( nIdPath, true)
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bInvertMach, not bInvert, bInvert))
@@ -1729,6 +1772,11 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw,
end
-- se devo applicare la contornatura anche sul lato opposto
if bDoubleSide then
if bMillDown then
sMilling = sMillingDn
dTDiam = dTDiamDn
dTMaxDepth = dTMaxDepthDn
end
sName = 'CleanOppo_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
@@ -1737,6 +1785,8 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw,
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nIdPath, -1}})
-- imposto lato di lavoro sinistro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- imposto direzione utensile opposta
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
-- imposto posizione braccio porta testa
@@ -1795,9 +1845,9 @@ end
---------------------------------------------------------------------
local function MakeRoundCleanCornerOrContour( Proc, nPhase, nRawId, nPartId, b3Raw,
nFacInd, nAddGrpId, dDiam, nFunction, bDoubleSide,
vtOrtho, nPathInt, nSurfInt, b3Solid, dDepth,
bOneShot)
nFacInd, nAddGrpId, dDiam, nFunction, bMillDown,
bDoubleSide, vtOrtho, nPathInt, nSurfInt, b3Solid,
dDepth, bOneShot)
-- se modalitá pulitura spigoli e lavorazione di lato forzo a fare il contorno
if nFunction == 2 and nPathInt then
@@ -1806,13 +1856,13 @@ local function MakeRoundCleanCornerOrContour( Proc, nPhase, nRawId, nPartId, b3R
-- se richiesta pulitura del contorno
if nFunction == 1 then
return MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw,
nFacInd, nAddGrpId, dDiam, nFunction, bDoubleSide,
vtOrtho, nPathInt, nSurfInt, b3Solid, dDepth,
bOneShot)
nFacInd, nAddGrpId, dDiam, nFunction, bMillDown,
bDoubleSide, vtOrtho, nPathInt, nSurfInt, b3Solid,
dDepth, bOneShot)
-- se richiesta pulitura dei soli corner
elseif nFunction == 2 then
return MakeRoundCleanCorner( Proc, nPhase, nRawId, nPartId, b3Raw,
nFacInd, nAddGrpId, dDiam)
nFacInd, nAddGrpId, dDiam, bMillDown, bDoubleSide)
-- altri casi non previsti
else
return true
@@ -1832,7 +1882,7 @@ local function MakeSharpCleanCorner( Proc, nPhase, nRawId, nPartId, b3Raw, nFacI
local dMaxDepth = 0
-- cerco l'angolo di riferimento dove applicare il percorso di pulitura, altrimenti esco
local dMaxLen, nIdLine, tFacAdj = ChooseCorner( Proc, nFacInd)
local _, nIdLine, tFacAdj = ChooseCorner( Proc, nFacInd)
if #tFacAdj == 0 then
return true
end
@@ -1845,7 +1895,7 @@ local function MakeSharpCleanCorner( Proc, nPhase, nRawId, nPartId, b3Raw, nFacI
local nIdIniPoint
local nIdEndPoint
if ptLocP1 and ptLocP2 then
if dist( ptLocP1, tFacAdj[nIdLine][4]) < GEO.EPS_SMALL or dist( ptLocP2, tFacAdj[nIdLine][4]) < GEO.EPS_SMALL then
if dist( ptLocP1, tFacAdj[nIdLine][4]) < GEO.EPS_SMALL or dist( ptLocP2, tFacAdj[nIdLine][4]) < GEO.EPS_SMALL then
nIdEndPoint = 4
nIdIniPoint = 5
elseif dist( ptLocP1, tFacAdj[nIdLine][5]) < GEO.EPS_SMALL or dist( ptLocP2, tFacAdj[nIdLine][5]) < GEO.EPS_SMALL then
@@ -2843,9 +2893,9 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
end
---------------------------------------------------------------------
local function MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw, nFacInd, bReduceDepth)
local function MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw, nFacInd, bReduceDepth, bMillDown)
-- Recupero la lavorazione di lama
local sCutting = ML.FindCutting( 'HeadSide')
local sCutting = ML.FindCutting( 'HeadSide' .. EgtIf( bMillDown, '_H2', ''))
if not sCutting then
local sErr = 'Error : HeadSide (cutting) not found in library'
EgtOutLog( sErr)
@@ -3207,8 +3257,9 @@ local function GetUShapeWidth( Proc, nFacInd)
end
---------------------------------------------------------------------
local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMchFindMaster, bIs3Faces, b3Solid, bOrthoFacesMaster)
local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMchFindMaster, bIs3Faces, b3Solid, bOrthoFacesMaster, bMillDown)
local nFirstMachId
local bOrthoFaces
local sWarn
local sMchFind = 'Pocket'
@@ -3245,8 +3296,19 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
end
-- se smusso non è esclusivo
if nChamfer < 2 then
-- ricalcolo se è lavorabile da sotto
bMillDown = BD.DOWN_HEAD and abs( vtOrtho:getZ()) >= 0.707
-- verifico se può essere fatto con svuotatura
local bMakePocket, sPocketing, dMaxDepth, dDiamTool = VerifyPocket( Proc, dDimMin, dDepth / 2, nil, sMchFind)
local bMakePocketDn, sPocketingDn, dMaxDepthDn, dDiamToolDn
if bMillDown then
bMakePocketDn, sPocketingDn, dMaxDepthDn, dDiamToolDn = VerifyPocket( Proc, dDimMin, dDepth / 2, nil, sMchFind..'_H2')
-- se è negativo inverto il versore e la faccia
if vtOrtho:getZ() < 0 then
vtOrtho = -vtOrtho
EgtInvertSurf( nSurfInt)
end
end
if bMakePocket then
-- gestione svuotatura da un solo lato o anche dal lato opposto (se non verticale)
-- estraggo il contorno dalla superfice per evitare i problemi con la svuotatura
@@ -3273,7 +3335,7 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
else
-- se direzione verso la verticale setto max affondamento possibile ed
-- emetto messaggio di warning perché non lavorabile interamente
if abs( vtOrtho:getZ()) >= 0.707 then
if abs( vtOrtho:getZ()) >= 0.707 and not BD.DOWN_HEAD then
dMachDepth = dMaxDepth - ( dDepth / 2) - dCollSic
dElev = dMaxDepth
sWarn = 'Warning : elevation bigger than max tool depth'
@@ -3316,11 +3378,15 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
EgtOutLog( sErr)
return -1, sErr
end
-- prendo l'id della prima lavorazione inserita
if not nFirstMachId then
nFirstMachId = nMchFId
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nPathInt, -1}})
-- verifico se devo invertire direzione utensile (in caso di direzione verso la verticale)
local bInvertMach
if vtOrtho:getZ() < BD.NZ_MINA and abs(vtOrtho:getZ()) >= 0.707 then
if vtOrtho:getZ() < BD.NZ_MINA and abs(vtOrtho:getZ()) >= 0.707 and not BD.DOWN_HEAD then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
bInvertMach = true
-- altrimenti se da fare in una sola volta e direzionato verso Y+ lo inverto per lavorarlo davanti
@@ -3366,23 +3432,46 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
end
-- se posso applicare la svuotatura sul lato opposto
if bDoubleSide then
-- se anche lavorando dal lato opposto non riesco a svuotare completamente la fessura
-- setto i parametri affondamento ed emetto warning
if 2 * dMaxDepth < dDepth + 2 * BD.CUT_EXTRA + 2 * dCollSic then
dMachDepth = dMaxDepth - ( dDepth / 2) - dCollSic
dElev = dMaxDepth
bComplete = false
sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
-- se ho la lavorazione da sotto ricalcolo in base a questa lavorazione
if bMakePocketDn then
-- sPocketing = sPocketingDn
-- dMaxDepth = dMaxDepthDn
-- dDiamTool = dDiamToolDn
-- se l'altezza utensile riesce a lavorare completamente da due parti
if dMaxDepthDn > ( dDepth / 2) + dCollSic + BD.CUT_EXTRA_MIN then
dMachDepth = BD.CUT_EXTRA_MIN
dElev = ( dDepth / 2) + BD.CUT_EXTRA_MIN
-- altrimenti non si riesce in due passate, limito la profondità e setto l'elevazione
else
dMachDepth = dMaxDepthDn - ( dDepth / 2) - dCollSic
dElev = dMaxDepthDn
bComplete = false
sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
end
else
-- se anche lavorando dal lato opposto non riesco a svuotare completamente la fessura
-- setto i parametri affondamento ed emetto warning
if dMaxDepth < ( dDepth / 2) + BD.CUT_EXTRA + dCollSic then
dMachDepth = dMaxDepth - (dDepth / 2) - dCollSic
dElev = dMaxDepth
bComplete = false
sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
end
end
-- inserisco la lavorazione di svuotatura
local sName = 'PockOppo_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sName, sPocketing)
local nMchFId = EgtAddMachining( sName, EgtIf( bMakePocketDn, sPocketingDn, sPocketing))
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
local sErr = 'Error adding machining ' .. sName .. '-' .. EgtIf( bMakePocketDn, sPocketingDn, sPocketing)
EgtOutLog( sErr)
return -1, sErr
end
-- prendo l'id della prima lavorazione inserita
if not nFirstMachId then
nFirstMachId = nMchFId
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nPathInt, -1}})
-- imposto direzione utensile opposta
@@ -3443,6 +3532,10 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
EgtOutLog( sErr)
return -1, sErr
end
-- prendo l'id della prima lavorazione inserita
if not nFirstMachId then
nFirstMachId = nMchFId
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, nFacInd}})
-- imposto posizione braccio porta testa
@@ -3482,16 +3575,16 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
end
end
end
return 1, sWarn, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot
return 1, sWarn, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot, bMillDown, nFirstMachId
end
end
end
return 0, sWarn, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot, bOrthoFaces
return 0, sWarn, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot, bMillDown, nFirstMachId, bOrthoFaces
end
---------------------------------------------------------------------
local function ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtN, nFacet, nFacInd, sWarn, bReduceDepth)
local function ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtN, nFacet, nFacInd, sWarn, bMillDown, bReduceDepth)
local bMadeASbyBld = false
local nNumFac = EgtIf( bIsU, 2, 1)
@@ -3516,11 +3609,11 @@ local function ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtN, nFacet, nFacInd, s
local dSawThick = 0
local dMaxDepth = 200
local bAdj, dAng, dExtraOffs, sWarn2, nIdMach
bMadeASbyBld, sWarn2, nIdMach, dSawThick, dMaxDepth, bAdj, dAng, dExtraOffs = MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw, nFacInd, bReduceDepth)
bMadeASbyBld, sWarn2, nIdMach, dSawThick, dMaxDepth, bAdj, dAng, dExtraOffs = MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw, nFacInd, bReduceDepth, bMillDown)
if not bMadeASbyBld then return bMadeASbyBld, false, sWarn2 end
if sWarn2 then
if not sWarn then sWarn = '' end
sWarn = sWarn .. '\n' .. sWarn2
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2)
end
-- se antischeggia veramente inserito perchè necessario
if nIdMach then
@@ -3592,91 +3685,362 @@ local function ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtN, nFacet, nFacInd, s
end
---------------------------------------------------------------------
local function ManageAntiSplintByDrill( Proc, b3Raw, bIsU, vtN, vtN1, nFacet, nFacInd, sWarn)
local function MakePathsOnExtremPoints( nAddGrpId, nIdPath, pPaths, dTDiam)
local bMadeASbyBld = false
local nNumFac = EgtIf( bIsU, 2, 1)
-- va eseguito sulle facce diverse dalla principale
local nPrevSCC = nil
for nFacet = 0, nNumFac do
if nFacet ~= nFacInd then
-- lavoro
local dSawThick = 0
local dMaxDepth = 200
local bAdj, dAng, dExtraOffs, sWarn2, nIdMach
bMadeASbyBld, sWarn2, nIdMach, dSawThick, dMaxDepth, bAdj, dAng, dExtraOffs = MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw, nFacInd, bReduceDepth)
if not bMadeASbyBld then return bMadeASbyBld, false, sWarn2 end
if sWarn2 then
if not sWarn then sWarn = '' end
sWarn = sWarn .. '\n' .. sWarn2
local dLength = 2
if not nIdPath then return pPaths end
-- prendo i punti iniziali e finali del percorso e i versori direzione
local ptIni = EgtSP( nIdPath, GDB_RT.GLOB)
local ptEnd = EgtEP( nIdPath, GDB_RT.GLOB)
-- se distanza tra i punti è <= del diametro utensile esco
if dist( ptIni, ptEnd) <= dTDiam then return pPaths end
-- prendo i versori iniziali e finali
local vtIni = EgtSV( nIdPath, GDB_RT.GLOB)
local vtEnd = EgtEV( nIdPath, GDB_RT.GLOB)
local ptIniP = ptIni
local ptEndP = ptIniP + (vtIni * dLength)
local nAuxId = EgtLine( nAddGrpId, ptIniP, ptEndP, GDB_RT.GLOB)
table.insert( pPaths, { nAuxId, 1, ptIniP})
ptIniP = ptEnd
ptEndP = ptEnd - ( vtEnd * dLength)
nAuxId = EgtLine( nAddGrpId, ptIniP, ptEndP, GDB_RT.GLOB)
table.insert( pPaths, { nAuxId, 2, ptIniP})
return pPaths
end
---------------------------------------------------------------------
local function MakeAntiSplintByMill( Proc, nPartId, pPaths, nPathInt, vtN1,
bDoubleSide, bOppoSide, sMilling, nPhase, sMyWarn,
dMaxElevMaster, dExtraDepth, dCollSic, dMaxDepth, nFirstMachId)
local sMyWarn2
-- assegno lavorazioni ad ogni percorso
for i = 1, #pPaths do
local nIdPath = pPaths[i][1]
local nSide = pPaths[i][2]
-- modifico versore direzione
EgtModifyCurveExtrusion( nIdPath, vtN1, GDB_RT.GLOB)
local sName
if bOppoSide then
sName = 'AntiSplintOppo_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
else
sName = 'AntiSplint_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
end
local nMchId = EgtAddMachining( sName, sMilling)
if nMchId then
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nIdPath, -1}})
if ( bOppoSide and nSide == 1) or ( not bOppoSide and nSide == 2) then
-- imposto lato di lavoro destro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
else
-- imposto lato di lavoro sinistro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
end
-- se antischeggia veramente inserito perchè necessario
if nIdMach then
-- verifico se da invertire
local nSCC
if bOppoSide then
-- imposto direzione utensile opposta
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
-- imposto posizione braccio porta testa
nSCC = MCH_SCC.ADIR_YM
if not BD.C_SIMM then
if AreSameVectorApprox( vtN1, Z_AX()) then
nSCC = MCH_SCC.ADIR_YM
elseif abs( vtN1:getX()) < 0.1 then
nSCC = EgtIf( BL.IsPartFinalPhase( nPhase), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
elseif vtN1:getY() < GEO.EPS_SMALL then
nSCC = MCH_SCC.ADIR_YP
else
nSCC = MCH_SCC.ADIR_YM
end
end
else
local bInvertMach = false
local dDepth = 0
if bIsU then
if abs(vtN:getZ()) > 0.63 or abs(vtN:getY()) > 0.63 then
-- if abs(vtN:getZ()) > 0.7 or abs(vtN:getY()) > 0.7 then
-- prendo il vettore normale alla faccia
local _, vtNFc = EgtSurfTmFacetCenter( Proc.Id, nFacet, GDB_ID.ROOT)
-- se superficie principale parallela al piano XZ
if nPrefSide == 0 then
-- se facce inclinate \\ allora mandrino a destra (per essere verso l'alto)
if vtNFc:getX() * vtNFc:getZ() > 0 then
nPrefSide = 2
-- altrimenti facce inclinate // quindi mandrino a sinistra (per essere ancora verso l'alto)
else
nPrefSide = 1
end
end
-- se faccia verso X+ e mandrino verso sinistra
if vtNFc:getX() > 0 and nPrefSide == 1 then
-- se angolo interno e circa -90
if abs( dAng + 90) < 5 then
bInvertMach = true
end
-- se faccia verso X- e mandrino verso destra
elseif vtNFc:getX() < 0 and nPrefSide == 2 then
-- se angolo interno e circa -90
if abs( dAng + 90) < 5 then
bInvertMach = true
end
end
if not nPathInt then
-- imposto posizione braccio porta testa
nSCC = MCH_SCC.ADIR_YM
if vtN1:getY() > 100 * GEO.EPS_ZERO then
nSCC = MCH_SCC.ADIR_YP
end
end
-- eseguo inversione
if bInvertMach then
local bToolInvert = EgtGetMachiningParam( MCH_MP.TOOLINVERT)
local nWS = EgtGetMachiningParam( MCH_MP.WORKSIDE)
local nInvWS = EgtIf( nWS == MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT)
local nFaceUse = EgtGetMachiningParam( MCH_MP.FACEUSE)
local bOrtUp = ( nFaceUse >= MCH_MILL_FU.ORTUP_DOWN and nFaceUse <= MCH_MILL_FU.ORTUP_RIGHT)
if not bOrtUp then
-- assegno i parametri invertiti
EgtSetMachiningParam( MCH_MP.WORKSIDE, nInvWS)
EgtSetMachiningParam( MCH_MP.TOOLINVERT, not bToolInvert)
-- setto l'offset pari allo spessore lama
EgtSetMachiningParam( MCH_MP.OFFSL, -dSawThick)
end
end
-- posizione del braccio : se primo taglio la recupero, altrimenti la imposto
if not nPrevSCC then
nPrevSCC = EgtGetMachiningParam( MCH_MP.SCC)
else
EgtSetMachiningParam( MCH_MP.SCC, nPrevSCC)
end
-- rieseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nIdMach, false)
return false, false, sErr
-- verifico se devo invertire direzione utensile (in caso di direzione verso la verticale)
if vtN1:getZ() < BD.NZ_MINA and abs(vtN1:getZ()) >= 0.707 then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
bInvertMach = true
-- altrimenti se da fare in una sola volta e direzionato verso Y+ lo inverto per lavorarlo davanti
elseif not bDoubleSide and vtN1:getY() > GEO.EPS_SMALL then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
bInvertMach = true
end
-- imposto posizione braccio porta testa
nSCC = MCH_SCC.NONE
if not BD.C_SIMM then
if AreSameOrOppositeVectorApprox( vtN1, Z_AX()) then
nSCC = MCH_SCC.ADIR_YM
elseif abs( vtN1:getX()) < 0.1 then
nSCC = EgtIf( BL.IsPartFinalPhase( nPhase), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
elseif vtN1:getY() < GEO.EPS_SMALL then
nSCC = EgtIf( bInvertMach, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
else
nSCC = EgtIf( bInvertMach, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)
end
end
end
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- parametri attacco
EgtSetMachiningParam( MCH_MP.LEADINTYPE, 1)
-- allungo inizio
EgtSetMachiningParam( MCH_MP.STARTADDLEN, 2)
EgtSetMachiningParam( MCH_MP.LITANG, 10)
EgtSetMachiningParam( MCH_MP.LIPERP, -5)
-- parametri uscita
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, 0)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, 0)
local dMachDepth = 0
local dExtraElev = 0
if bDoubleSide then
dExtraElev = BL.GetFaceElevationFromPointDir( Proc.Id, nPartId, pPaths[i][3], EgtIf( bOppoSide, -vtN1, vtN1)) - dMaxElevMaster
end
local dMaxElev = dMaxElevMaster + dExtraElev
if ( dMaxElev + BD.CUT_EXTRA + dCollSic) > dMaxDepth then
dMachDepth = dMaxDepth - ( dMaxElev + dCollSic)
end
-- setto se devo invertire il percorso
local bInvert = CheckToInvert( nIdPath, true)
if bOppoSide then
EgtSetMachiningParam( MCH_MP.DEPTH, dMachDepth)
EgtSetMachiningParam( MCH_MP.INVERT, bInvert)
else
EgtSetMachiningParam( MCH_MP.DEPTH, (dMachDepth+dExtraDepth))
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bInvertMach, not bInvert, bInvert))
end
-- Note utente con dichiarazione nessuna generazione sfridi per Vmill
local sUserNotes = 'VMRS=0;'
-- aggiungo alle note massima elevazione
sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( ( dMaxElev + dMachDepth), 1) .. ';'
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if EgtApplyMachining( true, false) then
_, sMyWarn2 = EgtGetMachMgrWarning( 0)
if EgtIsMachiningEmpty() then
EgtSetOperationMode( nMchId, false)
else
-- se ho la lavorazione di svuotatura riloco la lavorazione antischeggia prima di questa
if nFirstMachId then
EgtRelocateGlob( nMchId, nFirstMachId, GDB_IN.BEFORE)
end
end
-- altrimenti lavorazione non applicata
else
_, sMyWarn2 = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
end
-- altrimenti non è stata inserita lavorazione
else
sMyWarn2 = 'warning adding machining ' .. sName .. '-' .. sMilling
end
end
return bMadeASbyBld, true, sWarn
if sMyWarn2 and #sMyWarn2 > 0 then
sMyWarn = sMyWarn .. '\n' .. sMyWarn2
end
return sMyWarn
end
---------------------------------------------------------------------
local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw,
nFacInd, nAddGrpId, bMillDown, dDiam, bDoubleSide,
vtOrtho, nPathInt, nSurfInt, b3Solid, dDepth,
bOneShot, nFirstMachId)
local sMyWarn = ''
local pPaths = {}
local nAuxId
local sMilling
-- recupero la lavorazione tenendo conto dell'elevazione
local dCheckDepth
if bDoubleSide then
dCheckDepth = 0.5 * dDepth
else
if not nPathInt then
dCheckDepth = BL.GetFaceElevation( Proc.Id, nFacInd)
else
dCheckDepth = dDepth
end
end
sMilling = ML.FindMilling( 'AntiSplintMillCut' .. EgtIf( bMillDown and not bDoubleSide, '_H2', ''), dCheckDepth) or
ML.FindMilling( 'AntiSplintMillCut' .. EgtIf( bMillDown and not bDoubleSide , '_H2', ''), 2/3 * dCheckDepth) or
ML.FindMilling( 'AntiSplintMillCut' .. EgtIf( bMillDown and not bDoubleSide , '_H2', ''))
if sMilling then
local vtN1
local nFirstId, nNumId
local dMaxElevMaster
local dExtraDepth = 0
local dCollSic
local ptMidDist
-- recupero i dati dell'utensile
local dTDiam = 50
local dMaxDepth = 0
if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dTDiam
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
-- se non ho la faccia aggiunta
if not nPathInt then
-- ottengo i percorsi da cui estrapolare il percorso di antischeggia
local tFacAdjMain = ChooseContour( Proc, nFacInd, false)
local tPaths = {}
-- se non trovato nessun angolo interno valido esco
if #tFacAdjMain == 0 then
return true, sMyWarn
end
-- prendo il primo versore
_, vtN1 = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
dCollSic = CalcCollisionSafety( vtN1) or 0
-- se direzione tende verso una delle alle 3 direzioni azzero l'altezza extra
if abs( vtN1:getX()) > 0.7 or abs( vtN1:getY()) > 0.7 or abs( vtN1:getZ()) > 0.7 then dCollSic = 0 end
-- se fresatura da sotto salto la lavorazione
if vtN1:getZ() < BD.DRILL_VZ_MIN and not bMillDown then
local sErr = 'Error : milling from bottom '
EgtOutLog( sErr)
return false, sErr
end
local ptIniPath
local nMaxLen = 0
dMaxElevMaster = BL.GetFaceElevation( Proc.Id, nFacInd)
-- ciclo tutta la tabella
for i = 1, #tFacAdjMain do
-- le 2 facce di contatto devono essere perpendicolari o non sottosquadra rispetto alla faccia di fondo
local ptP1, ptP2, dAng
ptP1 = tFacAdjMain[i][3]
ptP2 = tFacAdjMain[i][4]
dAng = tFacAdjMain[i][5]
if ( dAng < 0 and 180 + dAng >= 90 - 10 * GEO.EPS_SMALL) then
-- creo la linea da P1 a P2
nAuxId = EgtLine( nAddGrpId, ptP1, ptP2, GDB_RT.GLOB)
table.insert( tPaths, nAuxId)
-- prendo la lunghezza massima e il puto medio
if tFacAdjMain[i][2] > nMaxLen then
ptIniPath = ptP1
nMaxLen = tFacAdjMain[i][2]
ptMidDist = ( ptP1 + ptP2) / 2
end
end
end
-- cotruisco il/i percorso/i
nFirstId, nNumId = EgtCurveCompoByReorder( nAddGrpId, tPaths, ptIniPath, true, GDB_RT.GLOB)
local bOkPath = true
for i = 1, nNumId do
local nIdPath = nFirstId + i - 1
if EgtCurveIsClosed( nIdPath) then
bOkPath = false
end
end
-- se ho un percorso chiuso cancello tutto
if not bOkPath then
for i = 1, nNumId do
local nIdPath = nFirstId + i - 1
EgtErase(nIdPath)
end
else
-- creo percorsi antisplint dagli estremi dei percorsi di contorno trovati
for i = 1, nNumId do
local nIdPath = nFirstId + i - 1
pPaths = MakePathsOnExtremPoints( nAddGrpId, nIdPath, pPaths, dTDiam)
end
end
-- alrimenti ho la faccia aggiunta
else
dCollSic = CalcCollisionSafety( vtOrtho)
nFirstId = EgtCopyGlob( nPathInt, nAddGrpId)
nNumId = 1
-- calcolo elevazione dalla faccia trasversale aggiunta
if bDoubleSide then
dMaxElevMaster = 0.5 * dDepth
else
dMaxElevMaster = dDepth
-- se la precedente svuotatura è stata fatta completamente in una sola volta
-- valuto di nuovo se devo fare due passate o una sola
if bOneShot then
-- se non è possibile svuotare completamente da una sola parte
if dMaxDepth <= ( dMaxElevMaster + BD.CUT_EXTRA + dCollSic) then
bDoubleSide = true
dMaxElevMaster = BL.GetOtherFaceElevation( Proc.Id, nSurfInt, 0)
else
dExtraDepth = dMaxElevMaster - BL.GetOtherFaceElevation( Proc.Id, nSurfInt, 0)
end
-- altrimenti non è stata fatta completamente calcolo la distanza tra faccia aggiunta e profondità superficie
else
dExtraDepth = dMaxElevMaster - BL.GetOtherFaceElevation( Proc.Id, nSurfInt, 0)
end
end
vtN1 = Vector3d(vtOrtho)
local bOkPath = SetOpenSide( nFirstId, vtOrtho, b3Solid, nAddGrpId, 2)
-- se non ho un percorso chiuso estraggo i percorsi
if bOkPath then
-- creo percorsi antisplint dagli estremi dei percorsi di contorno trovati
pPaths = MakePathsOnExtremPoints( nAddGrpId, nFirstId, pPaths, dTDiam)
end
EgtErase(nFirstId)
end
if #pPaths > 0 then
sMyWarn = MakeAntiSplintByMill( Proc, nPartId, pPaths, nPathInt, vtN1,
bDoubleSide, false, sMilling, nPhase, sMyWarn,
dMaxElevMaster, dExtraDepth, dCollSic, dMaxDepth, nFirstMachId)
if bDoubleSide then
if bMillDown then
local sMillingDn = ML.FindMilling( 'AntiSplintMillCut_H2', dCheckDepth) or
ML.FindMilling( 'AntiSplintMillCut_H2', 2/3 * dCheckDepth) or
ML.FindMilling( 'AntiSplintMillCut_H2')
sMilling = sMillingDn
-- controllo dati lavorazione
if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dTDiam
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- se lavorazione valida
if sMilling then
sMyWarn = MakeAntiSplintByMill( Proc, nPartId, pPaths, nPathInt, vtN1,
bDoubleSide, true, sMilling, nPhase, sMyWarn,
dMaxElevMaster, dExtraDepth, dCollSic, dMaxDepth, nFirstMachId)
else
sMyWarn = 'warning in process ' .. tostring( Proc.Id) .. ' clean corner milling/tool not found in library'
end
end
-- altrimenti non c'è il percorso
else
sMyWarn = 'warning in process ' .. tostring( Proc.Id) .. ' impossible make clean corner path'
end
-- altrimenti non è stata trovata lavorazione
else
sMyWarn = 'warning in process ' .. tostring( Proc.Id) .. ' clean corner milling/tool not found in library'
end
if #sMyWarn > 0 then
EgtOutLog( sMyWarn)
end
return true, sMyWarn
end
---------------------------------------------------------------------
@@ -4203,6 +4567,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
if Proc.Prc == 16 and bForceUseBlade and Proc.Fct == 3 and bIsU then
sPocketing = nil
end
-- leggo parametro Q
local nQAntisplintResult = EgtGetInfo( Proc.Id, Q_ANTISPLINT_TYPE, 'i') or 0
-- se non trova una svuotatura adatta
if not sPocketing then
-- se forma a L provo con contornatura
@@ -4240,8 +4606,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
if Proc.Fct == 3 and bIsU then
-- lavoro con svuotature (singola o doppia contrapposta)
local sMyMchFind = 'Pocket'
nOk, sErr, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, _, _, _, _, _,
bOrthoFaces = MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMyMchFind, true, b3Solid)
nOk, sErr, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, _, _, _, _, _, _, _,
bOrthoFaces = MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMyMchFind, true, b3Solid, nil, bMillDown)
-- se lavorazione non idonee ( asse della feature troppo inclinato e impossibile lavorare completamente da due parti)
if nOk == -2 then
if not sMchFind then
@@ -4298,9 +4664,9 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
-- 2021.04.27 esegue antischeggia di lama se forma U o L con feature passante in Y o Z
local bMadeASbyBld = false
local bPassThrou = ( Proc.Box:getDimY() > b3Raw:getDimY() - 1 or Proc.Box:getDimZ() > b3Raw:getDimZ() - 1)
if nChamfer < 2 and EgtGetInfo( Proc.Id, Q_ANTISPLINT_TYPE, 'i') == 1 and (( bIsU or bIsL) and bPassThrou) then
if nChamfer < 2 and nQAntisplintResult == 1 and (( bIsU or bIsL) and bPassThrou) then
local bOk
bMadeASbyBld, bOk, sWarn = ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtN, nFacet, nFacInd, sWarn, true)
bMadeASbyBld, bOk, sWarn = ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtN, nFacet, nFacInd, sWarn, bMillDown, true)
if not bOk then return false, sWarn end
end
-- in base al flag interno e al numero di facce e se ha forma ad U: provo prima la svuotatura sul fianco e
@@ -4310,9 +4676,9 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
-- lavoro con svuotature (singola o doppia contrapposta)
local sMyMchFind = 'Pocket'
local dDiamTool = 100
local nPathInt, nSurfInt, bOneShot
nOk, sErr, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot,
bOrthoFaces = MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMyMchFind, true, b3Solid)
local nPathInt, nSurfInt, bOneShot, nFirstMachId
nOk, sErr, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot, bMillDown, nFirstMachId,
bOrthoFaces = MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMyMchFind, true, b3Solid, nil, bMillDown)
if nOk == -2 then
if not sMchFind then
sMchFind = sMchFindBackUp
@@ -4330,20 +4696,25 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
elseif nOk > 0 then
bTryWithBlades = false
sWarn = sErr
-- se ho antischeggia con fori le inserisco
-- if nChamfer < 2 and EgtGetInfo( Proc.Id, Q_ANTISPLINT_TYPE, 'i') == 2 and (( bIsU or bIsL) and bPassThrou) then
-- local bOk
-- bMadeASbyBld, bOk, sWarn = ManageAntiSplintByDrill( Proc, b3Raw, bIsU, vtOrtho, vtN, nFacet, nFacInd, sWarn)
-- if not bOk then return false, sWarn end
-- end
-- se ho antischeggia con fresa le inserisco
-- if nChamfer < 2 and nQAntisplintResult == 2 and ( bIsU or bIsL) then
if nChamfer < 2 and nQAntisplintResult == 2 then
local bOk, sWarn2 = ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw,
nFacInd, nAddGrpId, bMillDown, dDiamTool, bDoubleSide,
vtOrtho, nPathInt, nSurfInt, b3Solid, dDepth,
bOneShot, nFirstMachId)
if sWarn2 then
if not sWarn then sWarn = '' end
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2)
end
end
-- se abilitato dal parametro Q inserisco pulitura spigoli o contorno con fresa più piccola
local nContourSmallTool = EgtGetInfo( Proc.Id, Q_CONTOUR_SMALL_TOOL, 'i') or 0
if nContourSmallTool > 0 then
local bOk, sWarn2
bOk, sWarn2 = MakeRoundCleanCornerOrContour( Proc, nPhase, nRawId, nPartId, b3Raw,
nFacInd, nAddGrpId, dDiamTool, nContourSmallTool, bDoubleSide,
vtOrtho, nPathInt, nSurfInt, b3Solid, dDepth,
bOneShot)
local bOk, sWarn2 = MakeRoundCleanCornerOrContour( Proc, nPhase, nRawId, nPartId, b3Raw,
nFacInd, nAddGrpId, dDiamTool, nContourSmallTool, bMillDown,
bDoubleSide, vtOrtho, nPathInt, nSurfInt, b3Solid,
dDepth, bOneShotm)
if not bOk then return false, sWarn2 end
if sWarn2 then
if not sWarn then sWarn = '' end
@@ -4387,7 +4758,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
if nContourSmallTool > 0 then
local bOk, sWarn2
bOk, sWarn2 = MakeRoundCleanCornerOrContour( Proc, nPhase, nRawId, nPartId, b3Raw,
nFacInd, nAddGrpId, 100, nContourSmallTool)
nFacInd, nAddGrpId, 100, nContourSmallTool, bMillDown)
if not bOk then return false, sWarn2 end
if sWarn2 then
if not sWarn then sWarn = '' end
@@ -4419,12 +4790,17 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
-- 2021.04.27 esegue antischeggia di lama se forma U o L con feature passante in Y o Z
local bMadeASbyBld = false
local bPassThrou = ( Proc.Box:getDimY() > b3Raw:getDimY() - 1 or Proc.Box:getDimZ() > b3Raw:getDimZ() - 1)
if nChamfer < 2 and EgtGetInfo( Proc.Id, Q_ANTISPLINT_TYPE, 'i') == 1 and (( bIsU or bIsL) and bPassThrou) then
if nChamfer < 2 and nQAntisplintResult == 1 and (( bIsU or bIsL) and bPassThrou) then
local bOk
bMadeASbyBld, bOk, sWarn = ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtN, nFacet, nFacInd, sWarn)
bMadeASbyBld, bOk, sWarn = ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtN, nFacet, nFacInd, sWarn, bMillDown)
if not bOk then return false, sWarn end
end
if nChamfer < 2 and nQAntisplintResult == 2 then
local bOk, sWarn2
bOk, sWarn2 = ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw,
nFacInd, nAddGrpId, bMillDown)
if not bOk then return false, sWarn2 end
end
-- se smusso non esclusivo
if nChamfer < 2 then
-- eseguo la svuotatura della faccia principale, mi restituisce id utensile, il diametro utensile per il foro opzionale
@@ -4500,7 +4876,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
elseif nContourSmallTool > 0 then
local bOk, sWarn2
bOk, sWarn2 = MakeRoundCleanCornerOrContour( Proc, nPhase, nRawId, nPartId, b3Raw,
nFacInd, nAddGrpId, dDiamTool, nContourSmallTool)
nFacInd, nAddGrpId, dDiamTool, nContourSmallTool, bMillDown)
if not bOk then return false, sWarn2 end
if sWarn2 then
if not sWarn then sWarn = '' end