DataBeam :
- varie correzioni e migliorie.
This commit is contained in:
+146
-106
@@ -1,4 +1,4 @@
|
||||
-- ProcessLapJoint.lua by Egaltech s.r.l. 2020/03/17
|
||||
-- ProcessLapJoint.lua by Egaltech s.r.l. 2020/03/19
|
||||
-- Gestione calcolo mezzo-legno per Travi
|
||||
-- 2019/10/08 Agg. gestione OpenPocket.
|
||||
|
||||
@@ -54,6 +54,20 @@ end
|
||||
---------------------------------------------------------------------
|
||||
local function AssignQValues( Proc)
|
||||
|
||||
-- reset delle variabili assegnazione parametri Q
|
||||
sForceUseBlade = ''
|
||||
sDepthChamferMill = ''
|
||||
sPreemptiveChamfer = ''
|
||||
sUseMill = ''
|
||||
sUseRoughTool = ''
|
||||
sUseRoughToolWithBAxis90 = ''
|
||||
sUseRoughToolWithBAxis0 = ''
|
||||
sInsertBoreOnCorner = ''
|
||||
sMakeContourWithSmallTool = ''
|
||||
sMakeOnlyContourOrFullPocket = ''
|
||||
sMakeBySideRoughTool = ''
|
||||
sAntisplintMode = ''
|
||||
|
||||
if ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 16 then
|
||||
sForceUseBlade = 'Q01' -- i
|
||||
sDepthChamferMill = 'Q04' -- d
|
||||
@@ -76,8 +90,8 @@ local function AssignQValues( Proc)
|
||||
sDepthChamferMill = 'Q07' -- d
|
||||
elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 32 then
|
||||
sMakeBySideRoughTool = 'Q01' -- i
|
||||
-- le altre features gestite non hanno parametri Q nei parametri globali
|
||||
end
|
||||
-- le altre features gestite non hanno parametri Q nei parametri globali
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
@@ -788,6 +802,12 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, nFacInd, rfFac, dH, dV
|
||||
end
|
||||
-- imposto uso faccia
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
||||
-- imposto posizione braccio porta testa
|
||||
local nSCC = MCH_SCC.ADIR_YM
|
||||
if rfFac:getVersZ():getY() > 100 * GEO.EPS_ZERO then
|
||||
nSCC = MCH_SCC.ADIR_YP
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
-- imposto accorciamento iniziale/finale per estremi aperti/chiusi
|
||||
if bSpecialApp then
|
||||
-- applico gli allungamenti o accorciamenti considerando che la lavorazione è invertita
|
||||
@@ -825,7 +845,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, nFacInd, rfFac, dH, dV
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function ChoseCorner( Proc, nFacInd)
|
||||
local function ChooseCorner( Proc, nFacInd)
|
||||
-- Recupero le facce adiacenti alla principale
|
||||
local vAdj = EgtSurfTmFacetAdjacencies( Proc.Id, nFacInd)[1]
|
||||
local tFacAdj = {}
|
||||
@@ -879,7 +899,7 @@ local function MakeCleanCorner( Proc, nPhase, nRawId, nPartId, b3Raw, nFacInd, n
|
||||
local dMaxDepth = 0
|
||||
|
||||
-- ottengo l'angolo di riferimento dove applicare il percorso di pulitura
|
||||
local dMaxLen, nIdLine, tFacAdj = ChoseCorner( Proc, nFacInd)
|
||||
local dMaxLen, nIdLine, tFacAdj = ChooseCorner( Proc, nFacInd)
|
||||
-- prendo il primo versore
|
||||
local _, vtN1 = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
local _, vtN2 = EgtSurfTmFacetCenter( Proc.Id, tFacAdj[nIdLine][1], GDB_ID.ROOT)
|
||||
@@ -1036,7 +1056,7 @@ end
|
||||
local function MakeDrillOnCorner( Proc, nPhase, nRawId, nPartId, b3Raw, nFacInd, nAddGrpId, dDiam, bSpecialMach)
|
||||
local sMyWarn
|
||||
-- ottengo l'angolo dove applicare il foro
|
||||
local dMaxLen, nIdLine, tFacAdj = ChoseCorner( Proc, nFacInd)
|
||||
local dMaxLen, nIdLine, tFacAdj = ChooseCorner( Proc, nFacInd)
|
||||
if not tFacAdj then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' geometry not found for drilling'
|
||||
EgtOutLog( sErr)
|
||||
@@ -1417,7 +1437,7 @@ local function EvaluateQParam( Proc, nRawId, bMakeVertCham, sDephtCham, sOnlyCha
|
||||
end
|
||||
end
|
||||
-- verifico se devo usare lama invece della sega-catena
|
||||
if EgtGetInfo( Proc.Id, sUseBlade, 'i') == 1 then
|
||||
if #sUseBlade == 0 or EgtGetInfo( Proc.Id, sUseBlade, 'i') == 1 then
|
||||
bForceUseBlade = true
|
||||
end
|
||||
|
||||
@@ -1425,11 +1445,11 @@ local function EvaluateQParam( Proc, nRawId, bMakeVertCham, sDephtCham, sOnlyCha
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MakePocket( Proc, nPartId, ptPs, vtN, nFaceRef, nDiffWidth, sMchFind, nUseRoughTool, tBHx, sMasterPocket)
|
||||
local function MakePocket( Proc, nPartId, ptPs, tvtN, nFaceRef, sMchFind, nUseRoughTool, sMasterPocket, dPrevFaceElev, tDimAndRef, dAng)
|
||||
|
||||
-- calcolo il elevazione dal punto medio
|
||||
-- calcolo l'elevazione dal punto medio
|
||||
local dElev
|
||||
local dLenIn, dLedOut = BL.GetPointDirDepth( nPartId, ptPs, vtN[2])
|
||||
local dLenIn, dLedOut = BL.GetPointDirDepth( nPartId, ptPs, tvtN[2])
|
||||
if dLenIn > 0 then
|
||||
dElev = dLenIn
|
||||
elseif dLedOut then
|
||||
@@ -1438,11 +1458,15 @@ local function MakePocket( Proc, nPartId, ptPs, vtN, nFaceRef, nDiffWidth, sMchF
|
||||
local dCollSic = 2 * BD.COLL_SIC
|
||||
-- calcolo il diametro utensile
|
||||
local dDiamTool
|
||||
if nUseRoughTool == 1 then
|
||||
dDiamTool = max( 80, min( tBHx[2][1], tBHx[2][2]))
|
||||
else
|
||||
if nUseRoughTool == 1 and tDimAndRef then
|
||||
dDiamTool = max( 80, min( tDimAndRef[2][1], tDimAndRef[2][2]))
|
||||
elseif tDimAndRef then
|
||||
-- se non uso truciolatore prendo il valore dalle dimensioni minime delle facce
|
||||
dDiamTool = min( tBHx[2][1], tBHx[2][2])
|
||||
dDiamTool = min( tDimAndRef[2][1], tDimAndRef[2][2])
|
||||
end
|
||||
-- se ho lavorazione precedente ricalcolo grossolanamente l'elevazione
|
||||
if dPrevFaceElev and dPrevFaceElev > 0 and dAng then
|
||||
dElev = dElev + ( sqrt( ( dElev * dElev) - ( dPrevFaceElev * dPrevFaceElev)) * sin(dAng))
|
||||
end
|
||||
local sPocketing
|
||||
if sMasterPocket then
|
||||
@@ -1455,6 +1479,16 @@ local function MakePocket( Proc, nPartId, ptPs, vtN, nFaceRef, nDiffWidth, sMchF
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
dDiamTool = 20
|
||||
local dMaxDepth = 0
|
||||
local sTuuidPk
|
||||
if EgtMdbSetCurrMachining( sPocketing) then
|
||||
sTuuidPk = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuidPk) or '') then
|
||||
dMaxDepth = ( EgtTdbGetCurrToolMaxDepth() or dMaxDepth)
|
||||
dDiamTool = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
|
||||
end
|
||||
end
|
||||
-- inserisco la lavorazione di svuotatura
|
||||
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. 'F' .. tostring( nFaceRef)
|
||||
local nMchFId = EgtAddMachining( sName, sPocketing)
|
||||
@@ -1468,7 +1502,7 @@ local function MakePocket( Proc, nPartId, ptPs, vtN, nFaceRef, nDiffWidth, sMchF
|
||||
-- imposto uso faccia
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT)
|
||||
-- imposto posizione braccio porta testa
|
||||
if vtN[2]:getY() < GEO.EPS_SMALL then
|
||||
if tvtN[2]:getY() < GEO.EPS_SMALL then
|
||||
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
|
||||
else
|
||||
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
|
||||
@@ -1477,8 +1511,17 @@ local function MakePocket( Proc, nPartId, ptPs, vtN, nFaceRef, nDiffWidth, sMchF
|
||||
if sMchFind == 'OpenPocket' and nUseRoughTool == 0 then
|
||||
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN)
|
||||
end
|
||||
-- imposto elevazione
|
||||
-- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente
|
||||
local sWarn
|
||||
if dElev > dMaxDepth + 10 * GEO.EPS_SMALL then
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dMaxDepth - dElev)
|
||||
dElev = dMaxDepth
|
||||
sWarn = 'Warning in process ' .. tostring( Proc.Id) .. ' : elevation bigger than max tool depth'
|
||||
EgtOutLog( sWarn)
|
||||
end
|
||||
-- imposto elevazione e dichiaro non si generano sfridi per VMill
|
||||
local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';'
|
||||
sNotes = sNotes .. 'VMRS=0;'
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
|
||||
if not EgtApplyMachining( true, false) then
|
||||
-- provo ad allargare leggermente la tasca
|
||||
@@ -1489,27 +1532,31 @@ local function MakePocket( Proc, nPartId, ptPs, vtN, nFaceRef, nDiffWidth, sMchF
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
return true
|
||||
return true, sWarn, sTuuidPk, dDiamTool
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, ptC, vtN, nBaseFace, nSideFace, ptPs, tBHx, b3Raw, nDiffWidth, nUseRoughTool, dAng, sPocketing)
|
||||
local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, tvtN, nBaseFace, nSideFace, ptPs, tDimAndRef,
|
||||
b3Raw, nDiffWidth, nUseRoughTool, dAng, sPocketing, sTuuidPk, dPrevFaceElev)
|
||||
|
||||
local sMchFind = 'Pocket'
|
||||
-- se feature non larga come trave provo a verificare se sborda da un lato o è completamente dentro la faccia del trave
|
||||
if nDiffWidth ~= 1 then sMchFind = 'OpenPocket' end
|
||||
-- se feature non passante disabilito eventuale sgrossatore
|
||||
if nDiffWidth ~= 0 then nUseRoughTool = 0 end
|
||||
local dAngLimit = 30
|
||||
|
||||
-- se feature é larga come trave imposto openpocket
|
||||
if nDiffWidth == 0 then
|
||||
sMchFind = 'OpenPocket'
|
||||
-- altrimenti non è passante disabilito il truciolatore e amplio il limite angolare
|
||||
-- per la differenza di lunghezza tra il truciolatore e la fresa più lunga
|
||||
else
|
||||
nUseRoughTool = 0
|
||||
dAngLimit = 40
|
||||
end
|
||||
-- se angolo tra le facce maggiore di 90, inserisco la contornatura o svuotatura del lato più corto
|
||||
if ( 180 + dAng) > 90.1 then
|
||||
-- se la normale della faccia corta si discosta dalla trave di più di 45° utilizzo la svutatura altrimenti la contornatura
|
||||
if abs( vtN[2]:getX()) < 0.707 then -- se si discosta di più di 45° applico svuotatura
|
||||
if abs( tvtN[2]:getX()) < cos(dAngLimit) then -- se si discosta di più di 30° applico svuotatura
|
||||
-- applico la svuotatura
|
||||
local bOk, sErr = MakePocket( Proc, nPartId, ptPs, vtN, nSideFace, nDiffWidth, sMchFind, nUseRoughTool, tBHx, sPocketing)
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
return MakePocket( Proc, nPartId, ptPs, tvtN, nSideFace, sMchFind, nUseRoughTool, sPocketing, dPrevFaceElev, tDimAndRef, dAng)
|
||||
-- altrimenti contornatura
|
||||
else
|
||||
local bOpenStart = false
|
||||
@@ -1536,7 +1583,12 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, ptC, vtN,
|
||||
end
|
||||
end
|
||||
end
|
||||
local sMilling = ML.FindMilling( 'LongSmallCut')
|
||||
local sMilling
|
||||
if nUseRoughTool > 0 then
|
||||
sMilling = ML.FindMilling( 'Long2Cut', nil, sTuuidPk)
|
||||
else
|
||||
sMilling = ML.FindMilling( 'LongSmallCut', nil, sTuuidPk)
|
||||
end
|
||||
if not sMilling then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
@@ -1551,7 +1603,7 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, ptC, vtN,
|
||||
end
|
||||
end
|
||||
-- Calcolo uso faccia
|
||||
local nFaceUse = BL.GetNearestParalOpposite( tBHx[1][3]:getVersZ())
|
||||
local nFaceUse = BL.GetNearestParalOpposite( tDimAndRef[1][3]:getVersZ())
|
||||
-- inserisco la lavorazione di fresatura
|
||||
local sName = 'Mill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchFId = EgtAddMachining( sName, sMilling)
|
||||
@@ -1564,9 +1616,35 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, ptC, vtN,
|
||||
EgtSetMachiningGeometry( {{ Proc.Id, (nSideFace)}})
|
||||
-- imposto uso faccia
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
||||
-- applico gli allungamenti o accorciamenti considerando che la lavorazione è invertita
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, EgtIf( bOpenStart, dTDiam / 2, - dTDiam / 2))
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, EgtIf( bOpenEnd, dTDiam / 2, - dTDiam / 2))
|
||||
-- setto inversione del percorso
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
-- setto a 0 eventuali offset
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, 0)
|
||||
-- calcolo elevazione per allungamenti attacchi con fianchi chiusi
|
||||
local dElev
|
||||
local dLenIn, dLedOut = BL.GetPointDirDepth( nPartId, ptPs, tvtN[2])
|
||||
if dLenIn > 0 then
|
||||
dElev = dLenIn
|
||||
elseif dLedOut then
|
||||
dElev = dLedOut
|
||||
end
|
||||
-- applico gli allungamenti o accorciamenti
|
||||
if bOpenStart then
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dTDiam / 2)
|
||||
else
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, -dTDiam / 2)
|
||||
if dElev > 0 then
|
||||
EgtSetMachiningParam( MCH_MP.LIPERP, dElev)
|
||||
end
|
||||
end
|
||||
if bOpenEnd then
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dTDiam / 2)
|
||||
else
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, -dTDiam / 2)
|
||||
if dElev > 0 then
|
||||
EgtSetMachiningParam( MCH_MP.LOPERP, dElev)
|
||||
end
|
||||
end
|
||||
-- eseguo
|
||||
if not EgtApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
@@ -1692,7 +1770,7 @@ local function SetOpenSide( nPathInt, vtOrtho, b3Solid, nAddGrpId, bStartPoint)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MakeByPocket( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMchFindMaster, b3FacesUsed, b3Solid, bOrthoFacesMaster)
|
||||
local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMchFindMaster, b3FacesUsed, b3Solid, bOrthoFacesMaster)
|
||||
|
||||
local bOrthoFaces
|
||||
local sWarn
|
||||
@@ -1708,7 +1786,7 @@ local function MakeByPocket( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham
|
||||
if nFacInd == -1 then
|
||||
bOrthoFaces = nFacInd2
|
||||
else
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' MakeByPocket could not find reference face'
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' MakeByPockets could not find reference face'
|
||||
EgtOutLog( sErr)
|
||||
return -1, sErr
|
||||
end
|
||||
@@ -2007,8 +2085,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId)
|
||||
-- se è un tunnel provo a vedere se è possibile lavorarlo di con la svuotatura o con la sega catena
|
||||
if bClosedOrthoFaces then
|
||||
local bTryWithBlades = true
|
||||
-- lavoro fessura con svuotatura
|
||||
local nOk, sErr, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace = MakeByPocket( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, 'Pocket', false, b3Solid, bClosedOrthoFaces)
|
||||
-- lavoro fessura con svuotature (singola o doppia contrapposta)
|
||||
local nOk, sErr, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace = MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, 'Pocket', false, b3Solid, bClosedOrthoFaces)
|
||||
if nOk < 0 then
|
||||
return false, sErr
|
||||
elseif nOk > 0 then
|
||||
@@ -2234,7 +2312,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId)
|
||||
end
|
||||
-- se abilitato dal parametro Q inserisco foro sullo spigolo
|
||||
if EgtGetInfo( Proc.Id, sInsertBoreOnCorner, 'i') == 1 then
|
||||
local bOk, sWarn = MakeDrillOnCorner( Proc, nPhase, nRawId, nPartId, b3Raw, 0, nAddGrpId, dDiamTool, true)
|
||||
local bOk
|
||||
bOk, sWarn = MakeDrillOnCorner( Proc, nPhase, nRawId, nPartId, b3Raw, 0, nAddGrpId, dDiamTool, true)
|
||||
if not bOk then return false, sWarn end
|
||||
end
|
||||
-- altrimenti lavorazione di svuotatura o contornatura
|
||||
@@ -2259,8 +2338,13 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
local nUseRoughTool = 0
|
||||
local sMchFind = 'Pocket'
|
||||
if Proc.Fct < 3 or bIsU then sMchFind = 'OpenPocket' end
|
||||
if Proc.Fct < 3 or bIsU then
|
||||
sMchFind = 'OpenPocket'
|
||||
-- abilito il truciolatore
|
||||
nUseRoughTool = 1
|
||||
end
|
||||
local dDiam = min( dH, dV)
|
||||
local dCollSic = 2 * BD.COLL_SIC
|
||||
if abs( vtN:getX()) > 0.996 or abs( vtN:getY()) > 0.996 or abs( vtN:getZ()) > 0.996 then dCollSic = 0 end
|
||||
@@ -2279,7 +2363,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId)
|
||||
-- se non è possibile allora provo in seguito con lama o segacatena
|
||||
-- o passare subito dalla lavorazione con lama/sega catena
|
||||
if bTrySidePocketAtFirst and Proc.Fct == 3 and bIsU then
|
||||
nOk, sErr = MakeByPocket( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, 'OpenPocket', true, b3Solid)
|
||||
nOk, sErr = MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, 'OpenPocket', true, b3Solid)
|
||||
if nOk < 0 then
|
||||
return false, sErr
|
||||
elseif nOk > 0 then
|
||||
@@ -2320,60 +2404,16 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- recupero i dati dell'utensile: utilizzo il diametro utensile per il foro opzionale
|
||||
local dMaxDepth = 0
|
||||
local dDiamTool = 20
|
||||
if EgtMdbSetCurrMachining( sPocketing) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dMaxDepth = ( EgtTdbGetCurrToolMaxDepth() or dMaxDepth)
|
||||
dDiamTool = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
|
||||
end
|
||||
end
|
||||
-- inserisco la lavorazione di svuotatura
|
||||
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchFId = EgtAddMachining( sName, sPocketing)
|
||||
if not nMchFId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ Proc.Id, nFacInd}})
|
||||
-- imposto uso faccia
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT)
|
||||
-- imposto posizione braccio porta testa
|
||||
if vtN:getY() < GEO.EPS_SMALL then
|
||||
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
|
||||
else
|
||||
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
|
||||
end
|
||||
-- se tasca aperta, imposto opportuno attacco
|
||||
if sMchFind == 'OpenPocket' then
|
||||
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN)
|
||||
end
|
||||
-- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente
|
||||
if dFacElev > dMaxDepth + 10 * GEO.EPS_SMALL then
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dMaxDepth - dFacElev)
|
||||
dFacElev = dMaxDepth
|
||||
sWarn = 'Warning in process ' .. tostring( Proc.Id) .. ' : elevation bigger than max tool depth'
|
||||
EgtOutLog( sWarn)
|
||||
end
|
||||
-- imposto elevazione e dichiaro non si generano sfridi per VMill
|
||||
local sNotes = 'MaxElev=' .. EgtNumToString( dFacElev, 1) .. ';'
|
||||
sNotes = sNotes .. '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)
|
||||
if not EgtApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
-- se ho più di 3 facce e non di forma ad u e non sono stati inseriti antischeggia di lama
|
||||
|
||||
-- eseguo la svuotatura della faccia principale, mi restituisce id utensile, il diametro utensile per il foro opzionale
|
||||
local tvtNx = {}
|
||||
tvtNx[2] = vtN
|
||||
local bOk
|
||||
bOk, sWarn, sTuuidPk, dDiamTool = MakePocket( Proc, nPartId, ptC, tvtNx, nFacInd, sMchFind, nUseRoughTool, sPocketing, dFacElev)
|
||||
if not bOk then return false, sWarn end
|
||||
|
||||
-- se ho più di 3 facce e non di forma ad u oppure ho 3 facce e di forma ad u
|
||||
-- e non sono stati inseriti antischeggia di lama
|
||||
-- controllo se c'è una faccia non ortogonale alla principale e la lavoro con una contornatura o svuotatura
|
||||
if ( ( Proc.Fct > 3 and not bIsU) or ( Proc.Fct == 3 and bIsU)) and not bMadeASbyBld then
|
||||
-- Recupero le facce adiacenti alla principale
|
||||
@@ -2385,34 +2425,34 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId)
|
||||
end
|
||||
-- Cerco una faccia adiacente alla principale con angolo > 90
|
||||
local nFacAdj
|
||||
local tBHx = {}
|
||||
local ptCx = {}
|
||||
local vtNx = {}
|
||||
ptCx[1], vtNx[1] = ptC, vtN
|
||||
tBHx[1] = {dH, dV, rfFac}
|
||||
local tDimAndRef = {}
|
||||
tvtNx = {}
|
||||
tvtNx[1] = vtN
|
||||
tDimAndRef[1] = {dH, dV, rfFac}
|
||||
for i = 1, #vAdj do
|
||||
if vAdj[i] >= 0 then
|
||||
local bAdj, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, nFacInd, vAdj[i], GDB_ID.ROOT)
|
||||
if bAdj and dAng < 0 and 180 + dAng > 90.1 then
|
||||
local rfFac2, dH2, dV2 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, vAdj[i], GDB_ID.ROOT)
|
||||
local ptC2, vtN2 = EgtSurfTmFacetCenter( Proc.Id, vAdj[i], GDB_ID.ROOT)
|
||||
ptCx[2], vtNx[2] = ptC2, vtN2
|
||||
tBHx[2] = {dH2, dV2, rfFac2}
|
||||
_, tvtNx[2] = EgtSurfTmFacetCenter( Proc.Id, vAdj[i], GDB_ID.ROOT)
|
||||
tDimAndRef[2] = {dH2, dV2, rfFac2}
|
||||
local ptPs = ( ptP1 + ptP2) / 2
|
||||
local bOk, sErr = MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, ptCx, vtNx, nFacInd, vAdj[i], ptPs, tBHx, b3Raw, 2, 0, dAng, sPocketing)
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
local bOk
|
||||
bOk, sWarn = MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, tvtNx, nFacInd, vAdj[i], ptPs, tDimAndRef,
|
||||
b3Raw, EgtIf( ( Proc.Fct == 3 and bIsU), 0, 2), nUseRoughTool, dAng, sPocketing, sTuuidPk, dFacElev)
|
||||
if not bOk then return bOk, sWarn end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se abilitato dal parametro Q inserisco foro sullo spigolo
|
||||
if EgtGetInfo( Proc.Id, sInsertBoreOnCorner, 'i') == 1 then
|
||||
local bOk, sWarn = MakeDrillOnCorner( Proc, nPhase, nRawId, nPartId, b3Raw, nFacInd, nAddGrpId, dDiamTool)
|
||||
local bOk
|
||||
bOk, sWarn = MakeDrillOnCorner( Proc, nPhase, nRawId, nPartId, b3Raw, nFacInd, nAddGrpId, dDiamTool)
|
||||
if not bOk then return false, sWarn end
|
||||
elseif EgtGetInfo( Proc.Id, sInsertBoreOnCorner, 'i') == 2 then
|
||||
local bOk, sWarn = MakeCleanCorner( Proc, nPhase, nRawId, nPartId, b3Raw, nFacInd, nAddGrpId, dDiamTool)
|
||||
local bOk
|
||||
bOk, sWarn = MakeCleanCorner( Proc, nPhase, nRawId, nPartId, b3Raw, nFacInd, nAddGrpId, dDiamTool)
|
||||
if not bOk then return false, sWarn end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user