DataBeam :

- modifiche per ottimizzazione con più teste
- modifiche per compilazione.
This commit is contained in:
DarioS
2022-05-09 20:42:45 +02:00
parent 6e0c482dab
commit b51487f5af
40 changed files with 740 additions and 464 deletions
+41 -52
View File
@@ -489,19 +489,19 @@ local function VerifyChainSaw( dMinDim, dMaxDim)
end
---------------------------------------------------------------------
local function VerifyPocket( dDiam, dDepth, dMaxTotLen, sMchFindMaster)
local function VerifyPocket( dDiam, dDepth, dMaxTotLen, sMchFindMaster, bPocketUp, bPocketDown)
-- tipo di svuotatura
local sMchFind = EgtIf( sMchFindMaster and #sMchFindMaster > 0, sMchFindMaster, 'Pocket')
-- ricerca della svuotatura
local sPocketing
if dDepth then
sPocketing = ML.FindPocketing( sMchFind, dDiam, dDepth, dMaxTotLen) or
sPocketing, _, _, bPocketDown = ML.FindPocketing( sMchFind, dDiam, dDepth, dMaxTotLen) or
ML.FindPocketing( sMchFind, dDiam, 0.8 * dDepth, dMaxTotLen) or
ML.FindPocketing( sMchFind, dDiam, 0.6 * dDepth, dMaxTotLen) or
ML.FindPocketing( sMchFind, dDiam, 0.4 * dDepth, dMaxTotLen) or
ML.FindPocketing( sMchFind, dDiam, 0, dMaxTotLen)
else
sPocketing = ML.FindPocketing( sMchFind, dDiam, 0, dMaxTotLen)
sPocketing, _, _, bPocketDown = ML.FindPocketing( sMchFind, dDiam, 0, dMaxTotLen)
end
if not sPocketing then
return false
@@ -516,7 +516,7 @@ local function VerifyPocket( dDiam, dDepth, dMaxTotLen, sMchFindMaster)
dMaxDepth = TI.dMaxDepth or dMaxDepth
bUsePocketing = true
end
return bUsePocketing, sPocketing, dMaxDepth, dToolDiam
return bUsePocketing, sPocketing, dMaxDepth, dToolDiam, bPocketDown
end
---------------------------------------------------------------------
@@ -971,7 +971,7 @@ local function MakeOneFaceByMill( Proc)
-- dichiaro non si generano sfridi per VMill
EgtSetMachiningParam( MCH_MP.USERNOTES, 'VMRS=0;')
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -1019,7 +1019,7 @@ local function DoMill( Proc, sName, sMilling, offset, nFacInd, nFac2Ind, vtN)
-- dichiaro non si generano sfridi per VMill
EgtSetMachiningParam( MCH_MP.USERNOTES, 'VMRS=0;')
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -1034,11 +1034,7 @@ local function MakeTwoFacesByMill( Proc, bDownHead)
assert( ( Proc.Fct == 2), 'Error : MakeTwoFacesByMill in LapJoint with ' .. tostring( Proc.Fct) .. ' faces')
-- recupero la lavorazione
local sMilling
if Q_USE_MILL and Q_USE_MILL == 1 then
sMilling = ML.FindMilling( 'LongSmallCut' .. EgtIf( bDownHead, '_H2', ''))
else
sMilling = ML.FindMilling( 'BirdsMouth' .. EgtIf( bDownHead, '_H2', ''))
end
sMilling = ML.FindMilling( EgtIf( Q_USE_MILL and Q_USE_MILL == 1, 'LongSmallCut', 'BirdsMouth'), nil , nil, nil, nil, not bDownHead, bDownHead)
if not sMilling then
local sErr = 'Error : LongSmallCut & BirdsMouth not found in library'
EgtOutLog( sErr)
@@ -1283,7 +1279,7 @@ local function MakeByMill( Proc, tFData, dCollSic, bSpecialApp, sMillMaster)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, EgtIf( bOpenStart, 0, - dTDiam / 2))
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
_, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -1557,7 +1553,7 @@ local function DoClean( sName, sMilling, nIdPath, vtN, dMaxElev, dMachDepth, dEx
local sUserNotes = 'VMRS=0;MaxElev=' .. EgtNumToString( ( dMaxElev + dMachDepth), 1) .. ';'
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if EgtApplyMachining( true, false) then
if ML.ApplyMachining( true, false) then
_, sMyWarn = EgtGetMachMgrWarning( 0)
if EgtIsMachiningEmpty() then
EgtSetOperationMode( nMchId, false)
@@ -1574,7 +1570,7 @@ end
---------------------------------------------------------------------
local function MakeRoundCleanCorner( Proc, nFacInd, dDiam, bMillDown, bDoubleSide)
-- recupero la lavorazione senza considerare l'elevazione
local sMilling = ML.FindMilling( 'SmallToolContour' .. EgtIf( bMillDown and not bDoubleSide, '_H2', ''))
local sMilling = ML.FindMilling( 'SmallToolContour', nil, nil, nil, nil, not ( bMillDown and not bDoubleSide), bMillDown and not bDoubleSide)
if not sMilling then
local sMyWarn = 'Warning : SmallToolContour not found in library'
EgtOutLog( sMyWarn)
@@ -1695,7 +1691,7 @@ local function MakeRoundCleanContour( Proc, nFacInd, dDiam, bMillDown,
dDepth, bOneShot)
-- recupero la lavorazione senza considerare l'elevazione perché viene calcolata l'elevazione utile
local sMilling = ML.FindMilling( 'SmallToolContour' .. EgtIf( bMillDown and not bDoubleSide, '_H2', ''))
local sMilling = ML.FindMilling( 'SmallToolContour', nil, nil, nil, nil, not ( bMillDown and not bDoubleSide), bMillDown and not bDoubleSide)
if not sMilling then
local sMyWarn = 'Warning : SmallToolContour not found in library'
EgtOutLog( sMyWarn)
@@ -1711,7 +1707,7 @@ local function MakeRoundCleanContour( Proc, nFacInd, dDiam, bMillDown,
dTMaxDepth = TI.dMaxDepth or dTMaxDepth
end
local sMillingDn = ML.FindMilling( 'SmallToolContour' .. EgtIf( bMillDown and bDoubleSide, '_H2', ''))
local sMillingDn = ML.FindMilling( 'SmallToolContour', nil, nil, nil, nil, not ( bMillDown and bDoubleSide), bMillDown and bDoubleSide)
if not sMillingDn then
local sMyWarn = 'Warning : Opposite SmallToolContour not found in library'
EgtOutLog( sMyWarn)
@@ -2141,7 +2137,7 @@ local function MakeDrillOnCorner( Proc, nFacInd, dDiam, bSpecialMach)
-- Note utente con dichiarazione nessuna generazione sfridi per Vmill e massima elevazione (coincide con affondamento)
local sUserNotes = 'VMRS=0;MaxElev=' .. EgtNumToString( dDepth, 1) .. ';'
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -2407,7 +2403,7 @@ local function MakeChamfer( Proc, vtOrtho, nSurfInt)
-- EgtSetMachiningParam( MCH_MP.INVERT, true)
-- end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return -1, sErr
@@ -2526,7 +2522,7 @@ local function MakeByMillAsSaw( Proc, tFData, nBottomFace, sMillingOnSide, dSawD
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- tolgo eventuale step
EgtSetMachiningParam( MCH_MP.STEP, 0)
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -2596,7 +2592,7 @@ local function DoHeadChainSaw( Proc, sName, sSawing, tFData, nFaceUse, nFacAdj,
local sNotes = 'MaxElev=' .. EgtNumToString( tFData.dFacElev, 2) .. ';'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
if EgtGetOutstrokeInfo() then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
@@ -2605,7 +2601,7 @@ local function DoHeadChainSaw( Proc, sName, sSawing, tFData, nFaceUse, nFacAdj,
-- impostazione alternativa angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, GetChainSawBlockedAxis( 2))
EgtSetMachiningParam( MCH_MP.INITANGS, GetChainSawInitAngs( vtN, tFData.rfFac:getVersZ()))
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -2688,7 +2684,7 @@ local function DoSideChainSaw( Proc, sName, sSawing, tFData, vtN, vtOrtho, nLong
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
if EgtGetOutstrokeInfo() then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
@@ -2697,7 +2693,7 @@ local function DoSideChainSaw( Proc, sName, sSawing, tFData, vtN, vtOrtho, nLong
-- impostazione alternativa angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, GetChainSawBlockedAxis( 2))
EgtSetMachiningParam( MCH_MP.INITANGS, GetChainSawInitAngs( vtN, vtOrtho))
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -2946,7 +2942,7 @@ end
---------------------------------------------------------------------
local function MakeAntiSplintBySaw( Proc, nFacet, vtN, nFacInd, bReduceDepth, bMillDown)
-- Recupero la lavorazione di lama
local sCutting = ML.FindCutting( 'HeadSide' .. EgtIf( bMillDown, '_H2', ''))
local sCutting = ML.FindCutting( 'HeadSide', not bMillDown, bMillDown)
if not sCutting then
local sErr = 'Error : HeadSide (cutting) not found in library'
EgtOutLog( sErr)
@@ -3061,10 +3057,10 @@ local function DoPocketing( sName, sPocketing, sMchFind, vtN, nPathInt, nFaceIdx
end
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
-- provo ad allargare leggermente la tasca
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local bOk, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -3166,7 +3162,7 @@ local function DoHeadCut( Proc, sName, sMilling, nMchFId, dElev, nSideFace, tvtN
-- imposto elevazione e dichiaro non si generano sfridi per VMill
local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -3302,7 +3298,7 @@ local function MachineByMill( Proc, tvtN, nBaseFace, nSideFace, ptPs, tDimAndRef
end
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -3381,7 +3377,7 @@ local function MakeByPockets( Proc, bOrthoFacesMaster, bMillDown)
local bMakePocket, sPocketing, dMaxDepth, dDiamTool = VerifyPocket( dDimMin, dDepth / 2, nil, sMchFind)
local bMakePocketDn, sPocketingDn, dMaxDepthDn
if bMillDown then
bMakePocketDn, sPocketingDn, dMaxDepthDn = VerifyPocket( dDimMin, dDepth / 2, nil, sMchFind .. '_H2')
bMakePocketDn, sPocketingDn, dMaxDepthDn = VerifyPocket( dDimMin, dDepth / 2, nil, sMchFind .. '_H2', false, true)
-- se è negativo inverto il versore e la faccia
if vtOrtho:getZ() < 0 then
vtOrtho = -vtOrtho
@@ -3634,7 +3630,7 @@ local function ManageAntiSplintBySaw( Proc, bIsU, vtN, nFacInd, sWarn, bMillDown
EgtSetMachiningParam( MCH_MP.SCC, nPrevSCC)
end
-- rieseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nIdMach, false)
return false, false, sErr
@@ -3788,7 +3784,7 @@ local function MakeAntiSplintByMill( Proc, pPaths, nPathInt, vtN1,
local sUserNotes = 'VMRS=0;MaxElev=' .. EgtNumToString( ( dMaxElev + dMachDepth), 1) .. ';'
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if EgtApplyMachining( true, false) then
if ML.ApplyMachining( true, false) then
_, sMyWarn2 = EgtGetMachMgrWarning( 0)
if EgtIsMachiningEmpty() then
EgtSetOperationMode( nMchId, false)
@@ -3835,9 +3831,9 @@ local function ManageAntiSplintByMill( Proc, nFacInd, bMillDown, bDoubleSide,
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', ''))
sMilling = ML.FindMilling( 'AntiSplintMillCut', dCheckDepth, nil, nil, nil, not ( bMillDown and not bDoubleSide), bMillDown and not bDoubleSide) or
ML.FindMilling( 'AntiSplintMillCut', 2/3 * dCheckDepth, nil, nil, nil, not ( bMillDown and not bDoubleSide), bMillDown and not bDoubleSide) or
ML.FindMilling( 'AntiSplintMillCut', nil, nil, nil, nil, not ( bMillDown and not bDoubleSide), bMillDown and not bDoubleSide)
if sMilling then
@@ -4042,7 +4038,7 @@ local function DoSideMill( Proc, sName, sMilling, tFData, dMaxMat, dToolDiam, bH
local nSCC = EgtIf( ( tFData.vtN:getY() > 0.5 or ( bHeadDir and tFData.vtN:getZ() > 0.5 ) or ( not bHeadDir and tFData.vtN:getZ() < -0.5)), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -4062,7 +4058,7 @@ local function DoSideMill( Proc, sName, sMilling, tFData, dMaxMat, dToolDiam, bH
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( nWorkSide == MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT))
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( nSCC == MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP))
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFNId, false)
return false, sErr
@@ -4184,10 +4180,10 @@ local function MakeSpecialThreeFaces( Proc, tFData)
local sNotes = 'MaxElev=' .. EgtNumToString( tFData.dFacElev2, 1) .. ';'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
-- provo ad allargare leggermente la tasca
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -4256,7 +4252,7 @@ local function MakeByChainsaw( Proc, dDimMin, dDimMax, dDepth, vtOrtho, nLongFac
EgtOutLog( sWarn)
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
if EgtGetOutstrokeInfo() then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
@@ -4264,7 +4260,7 @@ local function MakeByChainsaw( Proc, dDimMin, dDimMax, dDepth, vtOrtho, nLongFac
end
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, GetChainSawBlockedAxis( 2))
EgtSetMachiningParam( MCH_MP.INITANGS, GetChainSawInitAngs( vtN, vtOrtho))
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -4432,7 +4428,7 @@ local function MakeSidePocketings( Proc, tFData, dCollSic, bSpecialMillOnSide,
-- eseguo
bOk, sWarn, sStat = MakeByChainOrSaw( Proc, tFData, dDimMin, dDimMax, vtOrtho, nLongFaceId, bOrthoFaces, nBottomFace, nSurfInt)
if not bOk and sStat == 'MNF' then
_, sPocketing = VerifyPocket( dDiam, tFData.dFacElev + dCollSic, nil, sMchFind)
_, sPocketing = VerifyPocket( dDiam, tFData.dFacElev + dCollSic, nil, sMchFind, bMillUp, bMillDown)
if sPocketing then
sWarn = ''
else
@@ -4565,12 +4561,8 @@ local function MakePocketingOrMilling( Proc, tFData, bSinglePart)
dMaxTotLen = BD.GetBottomToolMaxTotLen( tFData.vtN)
end
-- ricerca lavorazione
local sPocketing
local _, sMyPocketing, dMyTMaxDepth, _ = VerifyPocket( dDiam, tFData.dFacElev + dCollSic, dMaxTotLen, sMchFind .. EgtIf( bMillDown, '_H2', ''))
if not sMyPocketing and bMillUp then
_, sMyPocketing, dMyTMaxDepth, _ = VerifyPocket( dDiam, tFData.dFacElev + dCollSic, dMaxTotLen, sMchFind)
bMillDown = false
end
local sPocketing, sMyPocketing, dMyTMaxDepth
_, sMyPocketing, dMyTMaxDepth, _, bMillDown = VerifyPocket( dDiam, tFData.dFacElev + dCollSic, dMaxTotLen, sMchFind .. EgtIf( bMillDown, '_H2', ''), bMillUp, bMillDown)
--local sMyPocketing, dMyTDiam, dMyTMaxDepth = ML.FindPocketing( sMchFind .. EgtIf( bMillDown, '_H2', ''), dDiam, dFacElev + dCollSic, dMaxTotLen)
--if not sMyPocketing then
-- sMyPocketing, dMyTDiam, dMyTMaxDepth = ML.FindPocketing( sMchFind .. EgtIf( bMillDown, '_H2', ''), dDiam, nil, dMaxTotLen)
@@ -4638,11 +4630,8 @@ local function MakePocketingOrMilling( Proc, tFData, bSinglePart)
( Proc.TotBox and Proc.TotBox:getDimX() > BD.MIN_LEN_LAMELLO) or
( not Proc.TotBox and Proc.Box:getDimX() > BD.MIN_LEN_LAMELLO)) then
-- recupero la lavorazione
if BD.DOWN_HEAD and tFData.vtN:getZ() < BD.NZ_MINA then
sMillingOnSide = ML.FindMilling( 'SideMillAsBlade_H2')
else
sMillingOnSide = ML.FindMilling( 'SideMillAsBlade')
end
local bDownhead = BD.DOWN_HEAD and tFData.vtN:getZ() < BD.NZ_MINA
sMillingOnSide = ML.FindMilling( 'SideMillAsBlade_H2', nil, nil, nil, nil, not bDownhead, bDownhead)
if sMillingOnSide then
-- recupero i dati dell'utensile