- versione definitiva

This commit is contained in:
luca.bacis
2022-01-14 12:14:38 +01:00
parent 1627c13eb4
commit eba1423f65
+27 -47
View File
@@ -239,18 +239,11 @@ end
---------------------------------------------------------------------
local function GetToolInfoForMachining( sMachiningName)
local toolInfo = { sTuuid = nil,
dLength = nil,
dDiam = nil,
dThDiam = nil,
dMaxMat = nil,
dMaxDepth = nil,
dSideDepth = nil,
dCornerRad = nil,
dThick = nil }
if EgtMdbSetCurrMachining( sMachiningName) then
local toolInfo = { sTuuid = nil, dLength = nil, dDiam = nil,
dThDiam = nil, dMaxMat = nil, dMaxDepth = nil,
dSideDepth = nil, dCornerRad = nil, dThick = nil }
toolInfo.sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( toolInfo.sTuuid) or '') then
toolInfo.dLength = EgtTdbGetCurrToolParam( MCH_TP.LEN)
@@ -662,7 +655,7 @@ end
-- Verifica se feature di testa
function ProcessLapJoint.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
if not InitGlob( Proc) then
return false
return false
end
-- se una sola faccia
if Proc.Fct == 1 then
@@ -1535,7 +1528,7 @@ local function MakeRoundCleanCorner( Proc, nFacInd, dDiam, bMillDown, bDoubleSid
local dTrimDist = dLen1 - dMinDist
-- se arretramento valido
if dTrimDist > 100 * GEO.EPS_SMALL then
EgtTrimExtendCurveByLen( nAuxId , -dTrimDist, ptApPoint , GDB_RT.GLOB)
EgtTrimExtendCurveByLen( nAuxId , -dTrimDist, ptApPoint, GDB_RT.GLOB)
end
table.insert( pAuxId, nAuxId)
-- se il punto finale corrisponde con il punto comune, uso l'altro
@@ -1546,7 +1539,7 @@ local function MakeRoundCleanCorner( Proc, nFacInd, dDiam, bMillDown, bDoubleSid
dTrimDist = dLen2 - dMinDist
-- se arretramento valido
if dTrimDist > 100 * GEO.EPS_SMALL then
EgtTrimExtendCurveByLen( nAuxId , -dTrimDist, ptApPoint , GDB_RT.GLOB)
EgtTrimExtendCurveByLen( nAuxId , -dTrimDist, ptApPoint, GDB_RT.GLOB)
end
table.insert( pAuxId, nAuxId)
-- trasformo in percorso
@@ -1777,7 +1770,7 @@ local function MakeRoundCleanContour( Proc, nFacInd, dDiam, bMillDown,
for i = 1, nNumId do
local nIdPath = nFirstId + i - 1
local sName = 'Clean_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling)
local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
sMyWarn = 'Warning : impossible add machining ' .. sName .. '-' .. sMilling
goto continue
@@ -2354,8 +2347,8 @@ local function ExtractExternalPaths( nPathInt, nNumIdAux, vtOrtho)
-- ciclo sui percorsi per trovare i punti non coincidenti (se percorso non chiuso)
for j = 2, #tPathLoc do
-- prendo i punti del percorso successivo
local pAddIni = EgtSP( tPathLoc[j], GDB_RT.GLOB)
local pAddEnd = EgtEP( tPathLoc[j], GDB_RT.GLOB)
local pAddIni = EgtSP( tPathLoc[j], GDB_RT.GLOB)
local pAddEnd = EgtEP( tPathLoc[j], GDB_RT.GLOB)
-- se consecutivi
if AreSamePointApprox( pEndLoc, pAddIni) then
pEndLoc = pAddEnd
@@ -2368,8 +2361,8 @@ local function ExtractExternalPaths( nPathInt, nNumIdAux, vtOrtho)
-- controllo eventuali percorsi scartati
for j = 1, #tNoMatch do
-- prendo i punti del percorso successivo
local pAddIni = EgtSP( tNoMatch[j], GDB_RT.GLOB)
local pAddEnd = EgtEP( tNoMatch[j], GDB_RT.GLOB)
local pAddIni = EgtSP( tNoMatch[j], GDB_RT.GLOB)
local pAddEnd = EgtEP( tNoMatch[j], GDB_RT.GLOB)
-- se consecutivi
if AreSamePointApprox( pEndLoc, pAddIni) then
pEndLoc = pAddEnd
@@ -2655,7 +2648,7 @@ local function MakeByMillAsSaw( Proc, nFacInd,
end
end
-- in base all'elevazione calcolo l'impronta della lama
local dUsedBladeLen = sqrt( ((dSawDiam / 2)*(dSawDiam / 2)) - ( ( (dSawDiam / 2) - dElev) * ( (dSawDiam / 2) - dElev)))
local dUsedBladeLen = sqrt( ((dSawDiam / 2) * (dSawDiam / 2)) - ( ( (dSawDiam / 2) - dElev) * ( (dSawDiam / 2) - dElev)))
-- 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
@@ -2678,7 +2671,7 @@ local function MakeByChainOrSaw( Proc, nFacInd,
local dDistToNextPiece = EgtGetInfo( _nRawId, 'BDST', 'd') or 5.4
if bIs3Faces then
-- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa
local nFacInd1, dFacElev1, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( Proc.Id, _nPartId, bIs3Faces)
local nFacInd1, _, nFacInd2, _ = BL.GetFaceWithMostAdj( Proc.Id, _nPartId, bIs3Faces)
if not nFacInd1 or nFacInd1 < 0 then
if nFacInd1 == -1 then
bOrthoFaces = nFacInd2
@@ -3061,7 +3054,7 @@ local function MakeAntiSplintBySaw( Proc, nFacet, vtN, nFacInd, bReduceDepth, bM
local ptPm = (ptP1 + ptP2) / 2
-- ottengo il boundingBox e prendo le dimensioni lungo la normale (Z locale) che rappresenta l'elevazione della faccia
-- laterale sul punto medio della linea in comune
local frFc = Frame3d( ptPm, vtN) ;
local frFc = Frame3d( ptPm, vtN)
local b3BoxLoc = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frFc)
local dDepth = b3BoxLoc:getDimZ() or 0
-- recupero i dati dell'utensile
@@ -4150,7 +4143,6 @@ local function ManageAntiSplintByMill( Proc, nFacInd, bMillDown, bDoubleSide,
end
if #pPaths > 0 then
sMyWarn = MakeAntiSplintByMill( Proc, pPaths, nPathInt, vtN1,
bDoubleSide, false, sMilling, sMyWarn,
dMaxElevMaster, dExtraDepth, dCollSic, dMaxDepth, nFirstMachId)
@@ -4322,11 +4314,9 @@ local function MakeSpecialThreeFaces( Proc)
local dCollSic2 = 2 * BD.COLL_SIC
if abs( vtN:getX()) > 0.7 or abs( vtN:getY()) > 0.7 or abs( vtN:getZ()) > 0.7 then dCollSic = 0 end
if abs( vtN2:getX()) > 0.7 or abs( vtN2:getY()) > 0.7 or abs( vtN2:getZ()) > 0.7 then dCollSic2 = 0 end
local sPocketing
local nPockFace
sPocketing = ML.FindPocketing( sMchFind, dDiam2, dFacElev2 + dCollSic2)
nPockFace = nFacInd2
local sPocketing = ML.FindPocketing( sMchFind, dDiam2, dFacElev2 + dCollSic2)
local nPockFace = nFacInd2
-- se non trova una svuotatura adatta provo ad assegnarla all'altra faccia
if not sPocketing then
dDiam, dDiam2 = dDiam2, dDiam
@@ -4621,8 +4611,8 @@ local function MakeSidePocketings( Proc, nFacInd, rfFac, dH, dV, vtN, dFacElev,
-- se ho antischeggia con fresa le inserisco
if _nChamfer < 2 and Q_ANTISPLINT_TYPE == 2 then
local _, sWarn2 = ManageAntiSplintByMill( Proc, nFacInd, bMillDown, bDoubleSide,
vtOrtho, nPathInt, nSurfInt, dDepth,
bOneShot, nFirstMachId)
vtOrtho, nPathInt, nSurfInt, dDepth,
bOneShot, nFirstMachId)
sWarn = FormatWarning(sWarn, sWarn2)
end
-- se abilitato dal parametro Q inserisco pulitura spigoli o contorno con fresa più piccola
@@ -4801,9 +4791,9 @@ local function MakePocketingOrMilling( Proc, nFacInd, nFacInd2, bSinglePart, dFa
end
-- ricerca lavorazione
local sPocketing
local _, sMyPocketing, dMyTMaxDepth, dMyTDiam = VerifyPocket( Proc, dDiam, dFacElev + dCollSic, dMaxTotLen, sMchFind .. EgtIf( bMillDown, '_H2', ''))
local _, sMyPocketing, dMyTMaxDepth, _ = VerifyPocket( Proc, dDiam, dFacElev + dCollSic, dMaxTotLen, sMchFind .. EgtIf( bMillDown, '_H2', ''))
if not sMyPocketing and bMillUp then
_, sMyPocketing, dMyTMaxDepth, dMyTDiam = VerifyPocket( Proc, dDiam, dFacElev + dCollSic, dMaxTotLen, sMchFind)
_, sMyPocketing, dMyTMaxDepth, _ = VerifyPocket( Proc, dDiam, dFacElev + dCollSic, dMaxTotLen, sMchFind)
bMillDown = false
end
--local sMyPocketing, dMyTDiam, dMyTMaxDepth = ML.FindPocketing( sMchFind .. EgtIf( bMillDown, '_H2', ''), dDiam, dFacElev + dCollSic, dMaxTotLen)
@@ -4984,9 +4974,8 @@ local function MakePocketingOrMilling( Proc, nFacInd, nFacInd2, bSinglePart, dFa
local rfFac2, dH2, dV2 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, vAdj[i], GDB_ID.ROOT)
_, tvtNx[2] = EgtSurfTmFacetCenter( Proc.Id, vAdj[i], GDB_ID.ROOT)
tDimAndRef[2] = {dH2, dV2, rfFac2}
local ptPs = ( ptP1 + ptP2) / 2
local bOk, sWarn2
bOk, sWarn2 = MachineByMill( Proc, tvtNx, nFacInd, vAdj[i], ptPs, tDimAndRef,
local ptPs = ( ptP1 + ptP2) / 2
local bOk, sWarn2 = MachineByMill( Proc, tvtNx, nFacInd, vAdj[i], ptPs, tDimAndRef,
EgtIf( ( Proc.Fct == 3 and bIsU), 0, 2), nUseRoughTool, dAng, sPocketing, sTuuidPk, dFacElev)
if not bOk then return bOk, sWarn2 end
sWarn = FormatWarning(sWarn, sWarn2)
@@ -5291,19 +5280,9 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
if abs( b3Fac1:getDimX() - b3Fac2:getDimX()) < 50 then
-- leggo i parametri Q per utilizzare la fresa di fianco e/o lama
return Long2Cut.Make( Proc, _nPhase, _nRawId, _nPartId, Q_ANTISPLINT_TYPE == 1, Q_SIDE_ROUGH_TOOL)
elseif b3Fac1:getDimX() < 1 then
elseif b3Fac1:getDimX() < 1 or b3Fac2:getDimX() < 1 then
-- la faccia 0 deve essere quella lunga
EgtSurfTmSwapFacets( Proc.Id, 0, 1)
if bUseBlade then
if nForceUseBladeOnNotContinueFace and nForceUseBladeOnNotContinueFace > 0 then
return LongCut.Make( Proc, _nPhase, _nRawId, _nPartId, bUseBlade, nForceUseBladeOnNotContinueFace)
else
return Fbs.MakeTwo( Proc, _nPhase, _nRawId, _nPartId, _dOvmHead, 'HeadSide')
end
else
return LongCut.Make( Proc, _nPhase, _nRawId, _nPartId)
end
elseif b3Fac2:getDimX() < 1 then
if b3Fac1:getDimX() < 1 then EgtSurfTmSwapFacets( Proc.Id, 0, 1) end
if bUseBlade then
if nForceUseBladeOnNotContinueFace and nForceUseBladeOnNotContinueFace > 0 then
return LongCut.Make( Proc, _nPhase, _nRawId, _nPartId, bUseBlade, nForceUseBladeOnNotContinueFace)
@@ -5373,7 +5352,8 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
local vtN = {}
_, vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
_, vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
local vtNm = ( vtN[1] + vtN[2]) ; vtNm:normalize()
local vtNm = ( vtN[1] + vtN[2])
vtNm:normalize()
bDownHead = ( vtNm:getZ() < -0.5)
end
-- determino l'angolo tra le facce