- ottimizzazioni

This commit is contained in:
luca.bacis
2022-01-24 17:51:36 +01:00
parent 0c79fe6c7e
commit 95e3577ba3
+63 -80
View File
@@ -32,7 +32,7 @@
-- 2021/11/02 In svuotatura con lati aperti diametro fresa non superiore al doppio del lato piccolo.
-- 2021/11/15 Quando si usa sega a catena uso Q10 come massima elevazione.
-- 2021/11/22 Corretta segnalazione warning su foro di L20 e L25.
-- 2021/12/17 Lettura parametri Q solo all'inizio.
-- 2021/12/17 Lettura parametri Q una volta sola all'inizio.
-- 2022/01/13 Estrapolazione da MakeMoreFaces() di MakeTwoFaces() e MakeThreeFaces(), e varie ottimizzazioni.
-- 2022/01/19 Cambiata % lunghezza pezzo per spezzatura. Tolta correzione spessore fresa a disco con superficie da lavorare verso Z-.
@@ -213,7 +213,7 @@ local function InitGlob( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtOutLog( sErr)
return false, sErr
end
if not _b3Solid then
local sErr = 'Error : part box not found'
EgtOutLog( sErr)
@@ -271,7 +271,7 @@ end
local function GetFacetsData( nProcId)
local tFData = {}
local nFacInd, dFacElev, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( nProcId, _nPartId)
if nFacInd then
if nFacInd then
tFData = UpdateFacet1Data( nProcId, tFData, nFacInd, dFacElev)
tFData = UpdateFacet2Data( nProcId, tFData, nFacInd2, dFacElev2)
if tFData.nFacInd == -1 and tFData.nFacInd2 and tFData.nFacInd2 == true then
@@ -286,7 +286,7 @@ local function SwapFacetsData( tFData)
if tFData then
tFData.nFacInd, tFData.nFacInd2 = tFData.nFacInd2, tFData.nFacInd
tFData.dFacElev, tFData.dFacElev2 = tFData.dFacElev2, tFData.dFacElev
tFData.ptC, tFData.ptC2 = tFData.ptC2, tFData.ptC
tFData.ptC, tFData.ptC2 = tFData.ptC2, tFData.ptC
tFData.vtN, tFData.vtN2 = tFData.vtN2, tFData.vtN
tFData.rfFac, tFData.rfFac2 = tFData.rfFac2, tFData.rfFac
tFData.dH, tFData.dH2 = tFData.dH2, tFData.dH
@@ -382,9 +382,9 @@ local function TestElleShape4( Proc)
local vFacAdj = GetValidFacetAdjacencies( Proc.Id, i - 1)
local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, i - 1, GDB_ID.ROOT)
local dArea = dH * dV
if #vFacAdj == 2 then
if #vFacAdj == 2 then
dMaxArea2 = max( dMaxArea2, dArea)
elseif #vFacAdj == 3 then
elseif #vFacAdj == 3 then
dMinArea3 = min( dMinArea3, dArea)
nFac3Adj = nFac3Adj + 1
end
@@ -519,7 +519,7 @@ end
---------------------------------------------------------------------
local function VerifyBHSideMill( Proc, bSinglePart, bPrevBhSideMill)
local bUseBHSideMill = false
local bHead = true
local bHeadDir = true
@@ -562,7 +562,7 @@ local function VerifyBHSideMill( Proc, bSinglePart, bPrevBhSideMill)
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
@@ -587,8 +587,8 @@ local function VerifyBHSideMill( Proc, bSinglePart, bPrevBhSideMill)
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()
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
@@ -927,7 +927,7 @@ end
-- Lavorazione con fresa
---------------------------------------------------------------------
local function MakeOneFaceByMill( Proc)
-- verifico il numero di facce della tacca
assert( ( Proc.Fct == 1), 'Error : MakeOneFaceByMill in LapJoint with ' .. tostring( Proc.Fct) .. ' faces')
-- dati della faccia
@@ -1544,7 +1544,7 @@ local function MakeRoundCleanCorner( Proc, nFacInd, dDiam, bMillDown, bDoubleSid
for i = 1, #tFacAdj do
local pAuxId = {}
-- le 2 facce di contatto devono essere perpendicolari e non sottosquadra rispetto alla faccia di fondo
local _, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, nFacInd, tFacAdj[i][1], GDB_ID.ROOT)
local _, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, nFacInd, tFacAdj[i][1], GDB_ID.ROOT)
local _, ptP1x, ptP2x, dAngx = EgtSurfTmFacetsContact( Proc.Id, nFacInd, tFacAdj[i][2], GDB_ID.ROOT)
if dAng >= 0 or dAng < -90 - 10 * GEO.EPS_SMALL or dAngx >= 0 or dAngx < -90 - 10 * GEO.EPS_SMALL then
goto continue
@@ -1932,7 +1932,7 @@ local function MakeRoundCleanContour( Proc, nFacInd, dDiam, bMillDown,
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dTDiam * 0.75)
-- setto massimo affondamento possibile
local dMachDepth = 0
if ( dMaxElev + dCollSic) > dTMaxDepth then
if ( dMaxElev + dCollSic) > dTMaxDepth then
dMachDepth = dTMaxDepth - ( dMaxElev + dCollSic)
end
EgtSetMachiningParam( MCH_MP.DEPTH, dMachDepth)
@@ -1965,9 +1965,10 @@ local function MakeRoundCleanContour( Proc, nFacInd, dDiam, bMillDown,
end
---------------------------------------------------------------------
local function MakeRoundCleanCornerOrContour( Proc, nFacInd, dDiam, nFunction, bMillDown,
local function MakeRoundCleanCornerOrContour( Proc, nFacInd, dDiam, bMillDown,
bDoubleSide, vtOrtho, nPathInt, nSurfInt,
dDepth, bOneShot)
local nFunction = Q_CONTOUR_SMALL_TOOL
-- se modalitá pulitura spigoli e lavorazione di lato forzo a fare il contorno
if nFunction == 2 and nPathInt then
nFunction = 1
@@ -2002,7 +2003,7 @@ local function MakeSharpCleanCorner( Proc, nFacInd, dDiam)
if #tFacAdj == 0 then
return true
end
-- prendo il primo versore
-- prendo i versori
local vtN1 = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, tFacAdj[nIdLine][1], GDB_ID.ROOT)
local vtN3 = EgtSurfTmFacetNormVersor( Proc.Id, tFacAdj[nIdLine][2], GDB_ID.ROOT)
@@ -2030,7 +2031,7 @@ local function MakeSharpCleanCorner( Proc, nFacInd, dDiam)
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati dell'utensile ( temporaneo, per compensare errore nella lavorazione)
-- recupero i dati dell'utensile (temporaneo, per compensare errore nella lavorazione)
local TI = GetToolInfoForMachining( sMilling)
if TI then
dMaxDepth = TI.dMaxMat or dMaxDepth
@@ -2038,7 +2039,7 @@ local function MakeSharpCleanCorner( Proc, nFacInd, dDiam)
-- l'altezza di taglio del tagliente corrisponde al raggio del raccordo che si riesce a coprire
-- quindi confronto l'elevazione con il raggio utensile utilizzato per la svuotatura
if dMaxDepth < ( dDiam * 0.5) - 100 * GEO.EPS_SMALL then
sMyWarn = 'Warning : skip clean corner (the cut heigth is smaller to machine the corner radius)'
sMyWarn = 'Warning : skip clean corner (the cut heigth is too small to machine the corner radius)'
EgtOutLog( sMyWarn)
return false, sMyWarn
end
@@ -2051,10 +2052,10 @@ local function MakeSharpCleanCorner( Proc, nFacInd, dDiam)
ptApPoint = ptLocP1
end
nAuxId = EgtLine( _nAddGrpId, tFacAdj[nIdLine][nIdEndPoint], ptApPoint, GDB_RT.GLOB)
dLenTrimExt = dist( tFacAdj[nIdLine][nIdEndPoint], ptApPoint) - (( dDiam / 2) + 2)
dLenTrimExt = dist( tFacAdj[nIdLine][nIdEndPoint], ptApPoint) - ( ( dDiam / 2) + 2)
-- se la distanza dei due punti della linea è maggiore dal raggio fresa + delta, trimmo al raggio fresa + delta
if dLenTrimExt > 10 * GEO.EPS_SMALL then
EgtTrimExtendCurveByLen( nAuxId , -dLenTrimExt, ptApPoint , GDB_RT.GLOB)
EgtTrimExtendCurveByLen( nAuxId, -dLenTrimExt, ptApPoint, GDB_RT.GLOB)
-- prendo il nuovo punto finale
ptApPoint = EgtEP( nAuxId, GDB_RT.GLOB)
end
@@ -2074,10 +2075,10 @@ local function MakeSharpCleanCorner( Proc, nFacInd, dDiam)
ptApPoint = ptLocP1
end
nAuxId = EgtLine( _nAddGrpId, tFacAdj[nIdLine][nIdEndPoint], ptApPoint, GDB_RT.GLOB)
dLenTrimExt = dist( tFacAdj[nIdLine][nIdEndPoint], ptApPoint) - (( dDiam / 2) + 2)
dLenTrimExt = dist( tFacAdj[nIdLine][nIdEndPoint], ptApPoint) - ( ( dDiam / 2) + 2)
-- se la distanza dei due punti della linea è maggiore dal raggio fresa + delta, trimmo al raggio fresa + delta
if dLenTrimExt > 10 * GEO.EPS_SMALL then
EgtTrimExtendCurveByLen( nAuxId , -dLenTrimExt, ptApPoint , GDB_RT.GLOB)
EgtTrimExtendCurveByLen( nAuxId, -dLenTrimExt, ptApPoint, GDB_RT.GLOB)
-- prendo il nuovo punto finale
ptApPoint = EgtEP( nAuxId, GDB_RT.GLOB)
end
@@ -2183,7 +2184,7 @@ local function MakeDrillOnCorner( Proc, nFacInd, dDiam, bSpecialMach)
end
vtExtr:normalize()
-- se foratura da sotto salto la lavorazione
if vtExtr:getZ() < BD.DRILL_VZ_MIN then
if vtExtr:getZ() < BD.DRILL_VZ_MIN then
local sErr = 'Error : drilling from bottom impossible'
EgtOutLog( sErr)
return false, sErr
@@ -2566,15 +2567,6 @@ local function MakeByMillAsSaw( Proc, tFData, nBottomFace, sMillingOnSide, dSawD
local sWarn
-- ottengo la distanza tra la fine del pezzo e il pezzo successivo
local dDistToNextPiece = EgtGetInfo( _nRawId, 'BDST', 'd') or 5.
-- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa
-- local nFacInd1, _, _, _ = BL.GetFaceWithMostAdj( Proc.Id, _nPartId, true)
-- if not nFacInd1 or nFacInd1 < 0 then
-- if not nFacInd1 == -1 then
-- local sErr = 'Error : MakeByMillAsSaw could not find reference face'
-- EgtOutLog( sErr)
-- return false, sErr
-- end
-- end
-- Recupero le facce adiacenti alla principale (solo quelle esistenti)
local vAdj = GetValidFacetAdjacencies( Proc.Id, tFData.nFacInd)
if not vAdj or #vAdj == 0 then
@@ -2608,7 +2600,7 @@ local function MakeByMillAsSaw( Proc, tFData, nBottomFace, sMillingOnSide, dSawD
-- Determino se estremi aperti o chiusi
local bOpenStart = false
local bOpenEnd = false
-- se non ho la faccia di fondo ( che comporta essere una fessura) verifico se ho lati aperti
-- se non ho la faccia di fondo (che comporta essere una fessura) verifico se ho lati aperti
if not nBottomFace then
local vAdj2 = EgtSurfTmFacetAdjacencies( Proc.Id, nFacAdj)[1]
EgtOutLog( 'Adj2=' .. table.concat( vAdj2, ' ,'), 3)
@@ -2620,20 +2612,12 @@ local function MakeByMillAsSaw( Proc, tFData, nBottomFace, sMillingOnSide, dSawD
i = EgtIf( i > 1, i - 1, #vAdj2)
end
bOpenStart = ( vAdj2[i] < 0)
-- se è chiusa acquisisco vettore faccia tappo
if not bOpenStart and vAdj2[i] >= 0 then
_, vtNS = EgtSurfTmFacetCenter( Proc.Id, vAdj2[i], GDB_ID.ROOT)
end
-- Se non esiste faccia adiacente a lato successivo -> fine aperto
local k = EgtIf( j < #vAdj2, j + 1, 1)
while vAdj2[k] == tFData.nFacInd do
k = EgtIf( k < #vAdj2, k + 1, 1)
end
bOpenEnd = ( vAdj2[k] < 0)
-- se è chiusa acquisisco vettore faccia tappo
if not bOpenEnd and vAdj2[k] >= 0 then
_, vtNE = EgtSurfTmFacetCenter( Proc.Id, vAdj2[k], GDB_ID.ROOT)
end
end
end
end
@@ -2684,7 +2668,7 @@ local function MakeByMillAsSaw( Proc, tFData, nBottomFace, sMillingOnSide, dSawD
end
end
-- in base all'elevazione calcolo l'impronta della lama
local dUsedBladeLen = sqrt( ( (dSawDiam / 2) * (dSawDiam / 2)) - ( ( (dSawDiam / 2) - tFData.dFacElev) * ( (dSawDiam / 2) - tFData.dFacElev)))
local dUsedBladeLen = sqrt( ( ( dSawDiam / 2) * ( dSawDiam / 2)) - ( ( ( dSawDiam / 2) - tFData.dFacElev) * ( ( dSawDiam / 2) - tFData.dFacElev)))
-- controllo direzione taglio e se il minimo della feature sborda in coda
if abs( vtN:getX()) < GEO.EPS_SMALL and abs( _b3Solid:getMin():getX() - Proc.Box:getMin():getX()) < 100 * GEO.EPS_SMALL and dDistToNextPiece < dUsedBladeLen then
-- do avviso che la lama può sbordare nel pezzo successivo
@@ -2752,7 +2736,7 @@ local function DoHeadChainSaw( Proc, sName, sSawing, tFData, nFacAdj, vtNE, vtNS
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
-- se necessario, limito l'affondamento
if tFData.dFacElev > dMaxDepth + 10 * GEO.EPS_SMALL then
sWarn = 'Warning in LapJoint : elevation (' .. EgtNumToString( tFData.dFacElev, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
local sWarn = 'Warning in LapJoint : elevation (' .. EgtNumToString( tFData.dFacElev, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
local dDepth = dMaxDepth - tFData.dFacElev
EgtOutLog( sWarn)
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH ' .. EgtNumToString( dDepth, 1))
@@ -2777,7 +2761,7 @@ local function DoHeadChainSaw( Proc, sName, sSawing, tFData, nFacAdj, vtNE, vtNS
end
end
if EgtIsMachiningEmpty() then
_, sWarn = EgtGetMachMgrWarning( 0)
local _, sWarn = EgtGetMachMgrWarning( 0)
EgtSetOperationMode( nMchFId, false)
return false, sWarn
end
@@ -2787,7 +2771,7 @@ local function DoHeadChainSaw( Proc, sName, sSawing, tFData, nFacAdj, vtNE, vtNS
end
---------------------------------------------------------------------
local function DoSideChainSaw( Proc, sName, sSawing2, tFData, vtN, vtOrtho,
local function DoSideChainSaw( Proc, sName, sSawing2, tFData, vtN, vtOrtho, nLundIdFace,
dDimMin, dSawThick2, dMaxMat2, bOpenStart, bOpenEnd)
-- Verifico se necessarie più passate
local nStep = ceil( ( dDimMin - 10 * GEO.EPS_SMALL) / dSawThick2)
@@ -2839,7 +2823,7 @@ local function DoSideChainSaw( Proc, sName, sSawing2, tFData, vtN, vtOrtho,
end
EgtSetMachiningParam( MCH_MP.DEPTH, dBoxDepth)
if dBoxDepth > dMaxMat2 then
sWarn = 'Warning : elevation bigger than max tool depth'
local sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
end
-- sistemo inizio e fine
@@ -2856,7 +2840,7 @@ local function DoSideChainSaw( Proc, sName, sSawing2, tFData, vtN, vtOrtho,
-- se massimo affondamento utensile inferiore fessura, setto affondamento ed emetto warning
elseif dMaxMat2 < dDepth then
EgtSetMachiningParam( MCH_MP.DEPTH, dMaxMat2)
sWarn = 'Warning : elevation bigger than max tool depth'
local sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
end
end
@@ -2881,7 +2865,7 @@ local function DoSideChainSaw( Proc, sName, sSawing2, tFData, vtN, vtOrtho,
end
end
if EgtIsMachiningEmpty() then
_, sWarn = EgtGetMachMgrWarning( 0)
local _, sWarn = EgtGetMachMgrWarning( 0)
EgtSetOperationMode( nMchFId, false)
return false, sWarn
end
@@ -2891,7 +2875,7 @@ local function DoSideChainSaw( Proc, sName, sSawing2, tFData, vtN, vtOrtho,
end
---------------------------------------------------------------------
local function MakeByChainOrSaw( Proc, tFData, dDimMin, dDimMax, vtOrtho,
local function MakeByChainOrSaw( Proc, tFData, dDimMin, dDimMax, vtOrtho, nLundIdFace,
bOrthoFacesMaster, nBottomFace, nSurfInt)
local bIs3Faces = Proc.Fct == 3
local bOrthoFaces
@@ -2936,13 +2920,13 @@ local function MakeByChainOrSaw( Proc, tFData, dDimMin, dDimMax, vtOrtho,
local nFacAdj
local dMaxLen = 0
for i = 1, #vAdj do
local _, ptP1, ptP2, _ = EgtSurfTmFacetsContact( Proc.Id, tFData.nFacInd, vAdj[i], GDB_ID.ROOT)
local dLen = dist( ptP1, ptP2)
if dLen > dMaxLen then
nFacAdj = vAdj[i]
dMaxLen = dLen
EgtOutLog( string.format( 'Adjac=%d Len=%.3f H=%.3f V=%.3f', vAdj[i], dLen, tFData.dH, tFData.dV), 3)
end
local _, ptP1, ptP2, _ = EgtSurfTmFacetsContact( Proc.Id, tFData.nFacInd, vAdj[i], GDB_ID.ROOT)
local dLen = dist( ptP1, ptP2)
if dLen > dMaxLen then
nFacAdj = vAdj[i]
dMaxLen = dLen
EgtOutLog( string.format( 'Adjac=%d Len=%.3f H=%.3f V=%.3f', vAdj[i], dLen, tFData.dH, tFData.dV), 3)
end
end
if not nFacAdj then
local sErr = 'Error : long adjacent face not found'
@@ -2958,7 +2942,7 @@ local function MakeByChainOrSaw( Proc, tFData, dDimMin, dDimMax, vtOrtho,
local bOpenStart = false
local bOpenEnd = false
local vtNS, vtNE
-- se non ho la faccia di fondo ( che comporta essere una fessura) verifico se ho lati aperti
-- se non ho la faccia di fondo (che comporta essere una fessura) verifico se ho lati aperti
if not nBottomFace then
local vAdj2 = EgtSurfTmFacetAdjacencies( Proc.Id, nFacAdj)[1]
EgtOutLog( 'Adj2=' .. table.concat( vAdj2, ' ,'), 3)
@@ -2996,7 +2980,7 @@ local function MakeByChainOrSaw( Proc, tFData, dDimMin, dDimMax, vtOrtho,
dSawMaxDepth = TI.dMaxDepth or dSawMaxDepth
end
end
-- se lavorazione sulle teste e altezza trave supera il limite ( che causa collisione con la forcella) e direzione taglio lungo la Z
-- se lavorazione sulle teste e altezza trave supera il limite (che causa collisione con la forcella) e direzione taglio lungo la Z
-- e limite profondità BeamData è maggiore del taglio massimo lama, assegno il massimo affondamento pari al limite profondità del BeamData
if bOpenStart and bOpenEnd and _bForceUseBlade and ( Proc.Head or Proc.Tail) and abs( tFData.rfFac:getVersY():getY()) > 0.866 and
_b3Solid:getDimZ() > BD.MIN_DIM_HBEAM and dSawMaxDepth > BD.MAX_DIM_HTCUT_HBEAM then
@@ -3084,9 +3068,9 @@ local function MakeByChainOrSaw( Proc, tFData, dDimMin, dDimMax, vtOrtho,
-- altrimenti segacatena di fianco
else
-- verifico se posso farlo con la sega-catena
local bMakeChainSaw, sSawing2, dMaxMat2, dSawCornerRad2, dSawThick2 = VerifyChainSaw( dDimMin, dDimMax)
local bMakeChainSaw, sSawing2, dMaxMat2, _, dSawThick2 = VerifyChainSaw( dDimMin, dDimMax)
if bMakeChainSaw then
local bOk, sErr = DoSideChainSaw(Proc, sName, sSawing2, tFData, vtN, vtOrtho, dDimMin, dSawThick2, dMaxMat2, bOpenStart, bOpenEnd)
local bOk, sErr = DoSideChainSaw(Proc, sName, sSawing2, tFData, vtN, vtOrtho, nLundIdFace, dDimMin, dSawThick2, dMaxMat2, bOpenStart, bOpenEnd)
if not bOk then
return false, sErr
end
@@ -3245,6 +3229,7 @@ local function MakePocket( Proc, ptPs, tvtN, nFaceRef, sMchFind, nUseRoughTool,
-- imposto elevazione e dichiaro non si generano sfridi per VMill
local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
-- provo ad allargare leggermente la tasca
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
@@ -3264,7 +3249,7 @@ local function DoHeadCut( Proc, nMchFId, sTuuidPk, dDiamTool, dElev, nSideFace,
EgtOutLog( sErr)
return false, sErr
end
-- recupero la lavorazione
local sMilling = ML.FindMilling( 'Long2Cut', dElev, sTuuidPk)
if not sMilling then
@@ -3314,7 +3299,7 @@ local function MachineByMill( Proc, tvtN, nBaseFace, nSideFace, ptPs, tDimAndRef
if ( 180 + dAng) > 90.1 then
local sMchFind = 'Pocket'
local dAngLimit = 40
-- se feature é larga come trave imposto openpocket
if nDiffWidth == 0 then
sMchFind = 'OpenPocket'
@@ -3461,7 +3446,7 @@ local function GetUShapeWidth( Proc, nFacInd)
end
---------------------------------------------------------------------
local function DoPocket( sName, sPocketing, sMchFind, vtN, nPathInt, nFaceIdx, dMachDepth, sNotes, bInvert)
local function DoPocketing( sName, sPocketing, sMchFind, vtN, nPathInt, nFaceIdx, dMachDepth, sNotes, bInvert, bEvaluateOppositeVector)
-- inserisco la lavorazione di svuotatura
local nMchFId = EgtAddMachining( sName, sPocketing)
if not nMchFId then
@@ -3477,7 +3462,7 @@ local function DoPocket( sName, sPocketing, sMchFind, vtN, nPathInt, nFaceIdx, d
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE
if not BD.C_SIMM then
if AreSameOrOppositeVectorApprox( vtN, Z_AX()) then
if EgtIf( bEvaluateOppositeVector, AreSameOrOppositeVectorApprox( vtN, Z_AX()), AreSameVectorApprox( vtN, Z_AX())) then
nSCC = MCH_SCC.ADIR_YM
elseif abs( vtN:getX()) < 0.1 then
nSCC = EgtIf( BL.IsPartFinalPhase( _nPhase), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
@@ -3520,7 +3505,7 @@ local function MakeByPockets( Proc, bOrthoFacesMaster, bMillDown)
local dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt
local bBadMach = false
local bIs3Faces = Proc.Fct == 3
if bIs3Faces then
-- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa
local nFacInd, _, nFacInd2, _ = BL.GetFaceWithMostAdj( Proc.Id, _nPartId, bIs3Faces)
@@ -3635,7 +3620,7 @@ local function MakeByPockets( Proc, bOrthoFacesMaster, bMillDown)
bInvert = true
end
-- eseguo svuotatura
local bOk, sErr, nMchFId = DoPocket( sName, sPocketing, sMchFind, vtOrtho, nPathInt, -1, dMachDepth, sNotes, bInvert)
local bOk, sErr, nMchFId = DoPocketing( sName, sPocketing, sMchFind, vtOrtho, nPathInt, -1, dMachDepth, sNotes, bInvert, true)
if not bOk then
return -1, sErr
end
@@ -3678,7 +3663,7 @@ local function MakeByPockets( Proc, bOrthoFacesMaster, bMillDown)
-- imposto elevazione e dichiaro non si generano sfridi per VMill
local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';VMRS=0;'
-- eseguo svuotatura in direzione invertita
local bOk, sErr, nMchFId = DoPocket( sName, sPocketing, sMchFind, vtOrtho, nPathInt, -1, dMachDepth, sNotes, true)
local bOk, sErr, nMchFId = DoPocketing( sName, sPocketing, sMchFind, vtOrtho, nPathInt, -1, dMachDepth, sNotes, true, false)
if not bOk then
return -1, sErr
end
@@ -3711,7 +3696,7 @@ local function MakeByPockets( Proc, bOrthoFacesMaster, bMillDown)
-- inserisco la lavorazione di svuotatura
local sName = EgtIf( bDoubleSide, 'Pock3rd_', 'Pock2nd_') .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
-- eseguo svuotatura
local bOk, sErr, nMchFId = DoPocket( sName, sPocketing, sMchFind, vtN, Proc.Id, nFacInd, dDepth, 'VMRS=0;', false)
local bOk, sErr, nMchFId = DoPocketing( sName, sPocketing, sMchFind, vtN, Proc.Id, nFacInd, dDepth, 'VMRS=0;', false, true)
if not bOk then
return -1, sErr
end
@@ -4067,11 +4052,10 @@ local function ManageAntiSplintByMill( Proc, nFacInd, bMillDown, bDoubleSide,
-- 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 punto medio
-- prendo la lunghezza massima e il punto iniziale
if tFacAdjMain[i][2] > nMaxLen then
ptIniPath = ptP1
nMaxLen = tFacAdjMain[i][2]
ptMidDist = ( ptP1 + ptP2) / 2
end
end
end
@@ -4423,7 +4407,7 @@ local function MakeByChainsaw( Proc, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdF
-- se massimo affondamento utensile inferiore fessura, setto affondamento ed emetto warning
elseif dMaxMat < dDepth then
EgtSetMachiningParam( MCH_MP.DEPTH, dMaxMat)
sWarn = 'Warning : elevation bigger than max tool depth'
local sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
end
-- eseguo
@@ -4442,7 +4426,7 @@ local function MakeByChainsaw( Proc, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdF
end
end
if EgtIsMachiningEmpty() then
_, sWarn = EgtGetMachMgrWarning( 0)
local _, sWarn = EgtGetMachMgrWarning( 0)
EgtSetOperationMode( nMchFId, false)
return false, sWarn
end
@@ -4457,7 +4441,7 @@ local function MakeSidePocketings( Proc, tFData, dCollSic, bSpecialMillOnSide,
nBottomFace, sMillingOnSide, dToolDiamOnSide, dThickMillOnSide,
bSinglePart, bIsU, bIsL, dDiam, bMillDown, bMillUp, sMchFind, sMchFindBackUp)
local bTryWithBlades = true
local nOk, bOk, sStat, sErr, dDimMin, dDimMax, dDepth, vtOrtho, bOrthoFaces, nSurfInt
local nOk, bOk, sWarn, sStat, sErr, dDimMin, dDimMax, dDepth, vtOrtho, bOrthoFaces, nSurfInt, sPocketing, nLundIdFace
if bSpecialMillOnSide then
-- eseguo
bOk, sWarn = MakeByMillAsSaw( Proc, tFData, nBottomFace, sMillingOnSide, dToolDiamOnSide, dThickMillOnSide)
@@ -4473,9 +4457,8 @@ local function MakeSidePocketings( Proc, tFData, dCollSic, bSpecialMillOnSide,
if tFData.vtN:getZ() < BD.NZ_MINA and BD.DOWN_HEAD and tFData.nFacInd2 then
tFData = SwapFacetsData( tFData)
end
-- eseguo (come 3 faces)
bOk, sWarn, sStat = MakeByChainOrSaw( Proc, tFData, dDimMin, dDimMax, vtOrtho,
bOrthoFaces, nBottomFace, nSurfInt)
-- eseguo
bOk, sWarn, sStat = MakeByChainOrSaw( Proc, tFData, dDimMin, dDimMax, vtOrtho, nil, bOrthoFaces, nBottomFace, nSurfInt)
if not bOk then
-- in base al flag interno e al numero di facce e se ha forma ad U: provo prima la svuotatura sul fianco e
-- se non è possibile allora provo in seguito con lama o segacatena
@@ -4583,7 +4566,7 @@ local function MakeSidePocketings( Proc, tFData, dCollSic, bSpecialMillOnSide,
end
-- se abilitato dal parametro Q inserisco pulitura spigoli o contorno con fresa più piccola
if Q_CONTOUR_SMALL_TOOL > 0 then
local bOk, sWarn2 = MakeRoundCleanCornerOrContour( Proc, tFData.nFacInd, dDiamTool, Q_CONTOUR_SMALL_TOOL, bMillDown,
local bOk, sWarn2 = MakeRoundCleanCornerOrContour( Proc, tFData.nFacInd, dDiamTool, bMillDown,
bDoubleSide, vtOrtho, nPathInt, nSurfInt, dDepth, bOneShotm)
if not bOk then return 1, false, sWarn2 end
sWarn = FormatWarning( sWarn, sWarn2)
@@ -4602,8 +4585,8 @@ local function MakeSidePocketings( Proc, tFData, dCollSic, bSpecialMillOnSide,
if tFData.vtN:getZ() < BD.NZ_MINA and BD.DOWN_HEAD and tFData.nFacInd2 then
tFData = SwapFacetsData( tFData)
end
-- eseguo (non 3 faces)
bOk, sWarn, sStat = MakeByChainOrSaw( Proc, tFData, dDimMin, dDimMax, vtOrtho, bOrthoFaces, nBottomFace, nSurfInt)
-- eseguo
bOk, sWarn, sStat = MakeByChainOrSaw( Proc, tFData, dDimMin, dDimMax, vtOrtho, nLundIdFace, bOrthoFaces, nBottomFace, nSurfInt)
if not bOk and sStat == 'MNF' then
_, sPocketing = VerifyPocket( dDiam, tFData.dFacElev + dCollSic, nil, sMchFind)
if sPocketing then
@@ -4616,7 +4599,7 @@ local function MakeSidePocketings( Proc, tFData, dCollSic, bSpecialMillOnSide,
else
-- se abilitato dal parametro Q inserisco pulitura spigoli o contorno con fresa più piccola
if Q_CONTOUR_SMALL_TOOL > 0 then
local bOk, sWarn2 = MakeRoundCleanCornerOrContour( Proc, tFData.nFacInd, 100, Q_CONTOUR_SMALL_TOOL, bMillDown)
local bOk, sWarn2 = MakeRoundCleanCornerOrContour( Proc, tFData.nFacInd, 100, bMillDown)
if not bOk then return 1, false, sWarn2 end
sWarn = FormatWarning( sWarn, sWarn2)
end
@@ -4942,7 +4925,7 @@ local function MakePocketingOrMilling( Proc, tFData, bSinglePart)
sWarn = FormatWarning( sWarn, sWarn2)
-- altrimenti se abilitato dal parametro Q inserisco pulitura spigoli o contorno con fresa più piccola
elseif Q_CONTOUR_SMALL_TOOL > 0 then
local bOk, sWarn2 = MakeRoundCleanCornerOrContour( Proc, tFData.nFacInd, dDiamTool, Q_CONTOUR_SMALL_TOOL, bMillDown)
local bOk, sWarn2 = MakeRoundCleanCornerOrContour( Proc, tFData.nFacInd, dDiamTool, bMillDown)
if not bOk then return false, sWarn2 end
sWarn = FormatWarning( sWarn, sWarn2)
end