Compare commits
6 Commits
Ticket#906
...
Ticket#909
| Author | SHA1 | Date | |
|---|---|---|---|
| 58ea436132 | |||
| c8b5f9ca27 | |||
| 33d70bdbf4 | |||
| 6ffb0da24d | |||
| 04abd401f6 | |||
| 5b1fb41c43 |
@@ -3,6 +3,7 @@
|
||||
-- 2022/05/07 ES Profonde modifiche per scelta ottimale lavorazioni in macchine con più teste.
|
||||
-- 2022/07/27 Aggiunta la gestione del tipo di foratura "AngleDrill" per fori molto inclinati
|
||||
-- 2022/11/02 Modificata scelta utensile ottimizzata. Ora se c'è un utensile più grande disponibile si dà preferenza a quello.
|
||||
-- 2022/11/25 Per FindMilling implementata la possibilità di escludere la testa H3 dalla ricerca utensile.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local MachiningLib = {}
|
||||
@@ -108,8 +109,9 @@ local function SetCurrMachiningAndTool( sMachName)
|
||||
local sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
|
||||
local nHead = tonumber( sHead:sub( 2, #sHead))
|
||||
local bH2 = ( nHead >= 21 and nHead <= 29)
|
||||
local bH3 = ( nHead >= 31 and nHead <= 39)
|
||||
local bFixed = ( vFixedHeads[nHead])
|
||||
return bActive, sTool, bH2, bFixed
|
||||
return bActive, sTool, bH2, bFixed, bH3
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
@@ -222,7 +224,7 @@ function ReturnParams( MachiningType, MachiningName, sType, ToolParams)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead)
|
||||
local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead, bExcludeH3)
|
||||
if bTopHead == nil and bDownHead == nil then
|
||||
bTopHead = true
|
||||
bDownHead = false
|
||||
@@ -273,8 +275,8 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead)
|
||||
_, sMachiningType = EgtEndsWith( Machining.Type, '_H2')
|
||||
end
|
||||
-- recupero dati utensile
|
||||
local bToolActive, sToolName, bH2, bFixed = SetCurrMachiningAndTool( Machining.Name)
|
||||
if Machining.On and sMachiningType == sType and bToolActive then
|
||||
local bToolActive, sToolName, bH2, bFixed, bH3 = SetCurrMachiningAndTool( Machining.Name)
|
||||
if Machining.On and sMachiningType == sType and bToolActive and ( not bH3 or bH3 == not bExcludeH3) then
|
||||
local bOk, ToolParams = VerifyTool( MachiningType, sType, Params, bH2)
|
||||
if bOk then
|
||||
if MachineHeadUse == ONE_HEAD then
|
||||
@@ -384,8 +386,8 @@ function MachiningLib.FindAngleDrilling( dDiam, dDepth, bTopHead, bDownHead)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bTopHead, bDownHead)
|
||||
return FindMachining( MCH_MY.MILLING, sType, { Depth = dDepth, TuuidMstr = sTuuidMstr, MaxDiam = dMaxDiam, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead)
|
||||
function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bTopHead, bDownHead, bExcludeH3)
|
||||
return FindMachining( MCH_MY.MILLING, sType, { Depth = dDepth, TuuidMstr = sTuuidMstr, MaxDiam = dMaxDiam, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead, bExcludeH3)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
-- 2022/09/21 In MakeByMill aggiunto messaggio per elevazione non raggiunta.
|
||||
-- 2022/11/03 In MakeByMill migliorata gestione lavorazione con fresa su testa da sotto.
|
||||
-- 2022/11/09 Aggiunta la gestione della chiamata della FreeContour da parte della SimpleScarf.
|
||||
-- 2022/11/24 In MakeByMill aggiunta la lavorazione sopra/sotto nel caso di testa sotto
|
||||
-- In MakeByMill se BeamData forza lettura codolo da Q questo viene sempre fatto indipendentemente dalle dimensioni della feature
|
||||
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
@@ -313,8 +315,8 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
local bStripOnSide = false
|
||||
if bCross then
|
||||
-- se chiamata da SimpleScarf il codolo è sempre attivo
|
||||
if dDimStrip > 10 * GEO.EPS_SMALL and ( nStep > 1 or ( bDown and b3Aux:getDimX() > 0.5 * b3Raw:getDimX()) or Proc.Prc == 70) then
|
||||
-- se forzata da parametro Q il codolo è sempre attivo
|
||||
if dDimStrip > 10 * GEO.EPS_SMALL and ( BD.DIM_STRIP < 0 or nStep > 1 or ( bDown and b3Aux:getDimX() > 0.5 * b3Raw:getDimX())) then
|
||||
-- devo lasciare un codolo
|
||||
local dExtraCham = EgtIf( nChamfer > 0, 2, 0)
|
||||
dDepth = EgtIf( Proc.Prc == 70, dDepth - dDimStrip - dDepthCham - dExtraCham, dDepth - dDimStrip)
|
||||
@@ -326,9 +328,9 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
local bIsDepthReduced = false
|
||||
-- se parametro beamdata forza codolo in centro e lavorazione orizzontale e se larghezza trave è sufficientemente larga
|
||||
-- se chiamata da SimpleScarf il codolo è sempre attivo
|
||||
-- se forzata da parametro Q il codolo è sempre attivo
|
||||
local dDepthWork = dDepth
|
||||
if BD.DIM_TO_CENTER_STRIP and BD.DIM_TO_CENTER_STRIP > 10 * GEO.EPS_SMALL and ( nStep > 1 or Proc.Prc == 70) and
|
||||
if BD.DIM_TO_CENTER_STRIP and BD.DIM_TO_CENTER_STRIP > 10 * GEO.EPS_SMALL and ( BD.DIM_STRIP < 0 or nStep > 1) and
|
||||
bCanDouble and b3Raw:getDimY() > BD.DIM_TO_CENTER_STRIP - 0.1 then
|
||||
nDouble = 2
|
||||
dDepth = min( ( b3Raw:getDimY() - dDimStrip) * 0.5, dMaxDepth)
|
||||
@@ -372,15 +374,19 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if nSide == 0 then
|
||||
if BD.DOWN_HEAD then
|
||||
-- recupero la lavorazione
|
||||
_, _, sChamferDown = VerifyChamfer( Proc, AuxId, nRawId, true, true)
|
||||
if not sChamferDown then
|
||||
local nChamferDown
|
||||
nChamferDown, _, sChamferDown = VerifyChamfer( Proc, AuxId, nRawId, true, true)
|
||||
if nChamferDown < 0 then
|
||||
sWarn = 'Warning : chamfer from bottom not found in library'
|
||||
sChamferDown = nil
|
||||
EgtOutLog( sWarn)
|
||||
end
|
||||
end
|
||||
_, _, sChamferUp = VerifyChamfer( Proc, AuxId, nRawId, true, false)
|
||||
if not sChamferUp then
|
||||
sWarn = 'Warning : milling not found in library'
|
||||
local nChamferUp
|
||||
nChamferUp, _, sChamferUp = VerifyChamfer( Proc, AuxId, nRawId, true, false)
|
||||
if nChamferUp < 0 then
|
||||
sWarn = 'Warning : chamfer from bottom not found in library'
|
||||
sChamferUp = nil
|
||||
EgtOutLog( sWarn)
|
||||
end
|
||||
end
|
||||
@@ -429,7 +435,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
end
|
||||
if nSide == 0 then
|
||||
bDoubleCham = BD.DOWN_HEAD
|
||||
bDoubleCham = EgtIf( sChamferDown and BD.DOWN_HEAD, true, false)
|
||||
else
|
||||
bDoubleCham = true
|
||||
end
|
||||
@@ -545,6 +551,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
-- verifico se devo fare sgrossatura più finitura
|
||||
local dOffsetPar = EgtGetInfo( Proc.Id, Q_OVERMAT_FOR_FINISH, 'i') or 0
|
||||
-- nel caso di lavorazioni sopra/sotto cerco lavorazioni specifiche
|
||||
local sMillingDown, sMillingUp
|
||||
if nDouble > 1 and bCanDouble then
|
||||
if nSide == 0 then
|
||||
@@ -552,16 +559,20 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- recupero la lavorazione
|
||||
sMillingDown = ML.FindMilling( 'FreeContour_H2', nil, nil, nil, nil, false, true)
|
||||
if not sMillingDown then
|
||||
sWarn = 'Warning : milling from bottom not found in library'
|
||||
nDouble = 1
|
||||
dDepth = min( dOriDepth, dMaxDepth)
|
||||
sWarn = 'Warning in process ' .. tostring( Proc.Id) .. ' (Free Contour) : milling from bottom not found in library' .. '\n' ..
|
||||
'; depth (' .. EgtNumToString( dOriDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
|
||||
EgtOutLog( sWarn)
|
||||
elseif sMillingDown and not bDownHead then
|
||||
bToolInv = true
|
||||
sMilling = sMillingDown
|
||||
end
|
||||
end
|
||||
if EgtEndsWith( sMilling, '_H2') then
|
||||
sMillingUp = ML.FindMilling( 'FreeContour', nil, nil, nil, nil, true, false)
|
||||
if not sMillingUp then
|
||||
sWarn = 'Warning : milling not found in library'
|
||||
EgtOutLog( sWarn)
|
||||
end
|
||||
sMillingUp = ML.FindMilling( 'FreeContour', nil, nil, nil, nil, true, false)
|
||||
if not sMillingUp then
|
||||
sWarn = 'Warning : milling not found in library'
|
||||
EgtOutLog( sWarn)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -591,8 +602,10 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
sName = 'Free_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
if EgtEndsWith( sMilling, '_H2') then
|
||||
nMchId = EgtAddMachining( sName, EgtIf( j == 2 and nSide == 0, sMillingUp, sMilling))
|
||||
else
|
||||
elseif sMillingDown then
|
||||
nMchId = EgtAddMachining( sName, EgtIf( j == 2 and nSide == 0, sMillingDown, sMilling))
|
||||
else
|
||||
nMchId = EgtAddMachining( sName, sMilling)
|
||||
end
|
||||
if not nMchId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
-- 2022/07/14 Aggiunta limitazione lavorazione a sinistra anche se il grezzo successivo non ha lavorazioni (finale barra) ma è abbastanza lungo da poter essere riutilizzato (BD.MinRaw).
|
||||
-- 2022/09/23 Modificato l'angolo per l'abilitazione della lama da sotto: ora interviene anche per facce verticali.
|
||||
-- 2022/11/04 Aggiunto passaggio parametro bDownHead (Testa da Sotto) nelle chiamate a MakeSideFace.
|
||||
-- 2022/11/28 Correzioni varie per attacco, pulizia spigoli, utilizzo H3
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessLongCut = {}
|
||||
@@ -860,7 +861,8 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
||||
-- recupero la lavorazione
|
||||
local bDownHead = ( nSide == - 1)
|
||||
sMchType = EgtIf( bDownHead, 'Long2Cut_H2', 'Long2Cut')
|
||||
local sMilling = ML.FindMilling( sMchType, dElev, nil, nil, nil, not bDownHead, bDownHead)
|
||||
local bExcludeH3 = bLarghAsFace and abs( nSide) ~= 1
|
||||
local sMilling = ML.FindMilling( sMchType, dElev, nil, nil, nil, not bDownHead, bDownHead, bExcludeH3)
|
||||
if not sMilling then
|
||||
local sErr = 'Error : milling '..sMchType..' not found in library'
|
||||
EgtOutLog( sErr)
|
||||
@@ -885,11 +887,22 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
||||
if bLimXmin and bLimXmax and Proc.Box:getDimX() < 2 * dToolDiam then
|
||||
return MakeByPocketing( Proc, nPhase, nRawId, nPartId)
|
||||
end
|
||||
-- determino l'utilizzo della faccia
|
||||
local nFaceUse = EgtIf( abs( vtN:getY()) > 0.01, MCH_MILL_FU.ORTHO_DOWN, EgtIf( bFront, MCH_MILL_FU.ORTHO_FRONT, MCH_MILL_FU.ORTHO_BACK))
|
||||
-- determino il lato di attacco (0:xMin, 1:xMax)
|
||||
local nStartSide = 0
|
||||
if nFaceUse == MCH_MILL_FU.ORTHO_DOWN and not bFront then
|
||||
nStartSide = 1
|
||||
elseif nFaceUse ~= MCH_MILL_FU.ORTHO_DOWN then
|
||||
if ( bFront and nSide == -1) or ( not bFront and nSide == 1) then
|
||||
nStartSide = 1
|
||||
end
|
||||
end
|
||||
-- determino gli estremi
|
||||
local dStartDist = 0
|
||||
local dStartAccDist = BD.LONGCUT_ENDLEN
|
||||
local bStartFixed = true
|
||||
if ( bLimXmin and bFront) or ( bLimXmax and not bFront) then
|
||||
if ( bLimXmin and nStartSide == 0) or ( bLimXmax and nStartSide == 1) then
|
||||
dStartDist = dToolDiam / 2
|
||||
dStartAccDist = BD.LONGCUT_MAXLEN
|
||||
bStartFixed = false
|
||||
@@ -897,7 +910,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
||||
local dEndDist = 0
|
||||
local dEndAccDist = BD.LONGCUT_ENDLEN
|
||||
local bEndFixed = true
|
||||
if ( bLimXmin and not bFront) or ( bLimXmax and bFront) then
|
||||
if ( bLimXmin and nStartSide == 1) or ( bLimXmax and nStartSide == 0) then
|
||||
dEndDist = dToolDiam / 2
|
||||
dEndAccDist = BD.LONGCUT_MAXLEN
|
||||
bEndFixed = false
|
||||
@@ -962,8 +975,6 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
||||
dEndAccDist = 0
|
||||
end
|
||||
end
|
||||
-- determino l'utilizzo della faccia
|
||||
local nFaceUse = EgtIf( abs( vtN:getY()) > 0.01, MCH_MILL_FU.ORTHO_DOWN, EgtIf( bFront, MCH_MILL_FU.ORTHO_FRONT, MCH_MILL_FU.ORTHO_BACK))
|
||||
-- si percorre il lato basso della faccia
|
||||
local nM = 0
|
||||
local nCountMilHead = 0
|
||||
@@ -994,6 +1005,22 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- correggo l'attacco se necessario
|
||||
if i == 1 and not bStartFixed then
|
||||
if nO == 1 or EgtGetMachiningParam( MCH_MP.LITANG) ~= 0 then
|
||||
EgtSetMachiningParam( MCH_MP.LIELEV, 0)
|
||||
EgtSetMachiningParam( MCH_MP.LITANG, 0)
|
||||
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.LINEAR)
|
||||
EgtSetMachiningParam( MCH_MP.LIPERP, dWidth + BD.CUT_EXTRA + BD.CUT_SIC or 20)
|
||||
end
|
||||
elseif i == nC and not bEndFixed then
|
||||
if nO == 1 or EgtGetMachiningParam( MCH_MP.LOTANG) ~= 0 then
|
||||
EgtSetMachiningParam( MCH_MP.LOELEV, 0)
|
||||
EgtSetMachiningParam( MCH_MP.LOTANG, 0)
|
||||
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LI.LINEAR)
|
||||
EgtSetMachiningParam( MCH_MP.LOPERP, dWidth + BD.CUT_EXTRA + BD.CUT_SIC or 20)
|
||||
end
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ Proc.Id, 0}})
|
||||
-- limito opportunamente la lavorazione
|
||||
@@ -1022,7 +1049,11 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
||||
end
|
||||
-- eventuale lavorazione della faccia limitante l'inizio
|
||||
if i == 1 and not bStartFixed then
|
||||
local vtIni = EgtIf( bFront, X_AX(), -X_AX())
|
||||
-- per il lato sotto il vettore è opposto
|
||||
local vtIni = EgtIf( bFront, X_AX(), -X_AX())
|
||||
if nSide == -1 then
|
||||
vtIni = -1 * vtIni
|
||||
end
|
||||
for j = 1, Proc.Fct - 1 do
|
||||
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, j, GDB_ID.ROOT)
|
||||
if vtIni * vtN > 0 and nCountMilHead < 2 then
|
||||
@@ -1039,7 +1070,11 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
||||
|
||||
-- eventuale lavorazione della faccia limitante la fine
|
||||
if not bEndFixed then
|
||||
local vtFin = EgtIf( bFront, -X_AX(), X_AX())
|
||||
-- per il lato sotto il vettore è opposto
|
||||
local vtFin = EgtIf( bFront, -X_AX(), X_AX())
|
||||
if nSide == -1 then
|
||||
vtFin = -1 * vtFin
|
||||
end
|
||||
for j = 1, Proc.Fct - 1 do
|
||||
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, j, GDB_ID.ROOT)
|
||||
if vtFin * vtN > 0 and nCountMilHead < 2 then
|
||||
|
||||
Reference in New Issue
Block a user