Compare commits

...

7 Commits

4 changed files with 158 additions and 37 deletions
+8 -7
View File
@@ -331,6 +331,7 @@ end
---------------------------------------------------------------------
local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion)
local bOptimizeHeads = BEAM and BEAM.BW and ( not sSortingCriterion or sSortingCriterion == '')
if bTopHead == nil and bDownHead == nil then
bTopHead = true
bDownHead = false
@@ -368,15 +369,15 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead,
ForEnd = 1
ForStep = -1
end
if ( BEAM and BEAM.BW) or MachineHeadType == ONE_HEAD or MachineHeadType == TWO_EQUAL_HEADS or ( MachineHeadType == TWO_UP_DOWN_HEADS and not bDownHead) then
if bOptimizeHeads or MachineHeadType == ONE_HEAD or MachineHeadType == TWO_EQUAL_HEADS or ( MachineHeadType == TWO_UP_DOWN_HEADS and not bDownHead) then
_, sType = EgtEndsWith( sType, '_H2')
elseif not ( BEAM and BEAM.BW) and MachineHeadType == TWO_UP_DOWN_HEADS and not bTopHead and bDownHead then
elseif not bOptimizeHeads and MachineHeadType == TWO_UP_DOWN_HEADS and not bTopHead and bDownHead then
if not EgtEndsWith( sType, '_H2') then
sType = sType .. '_H2'
end
end
local MachineHeadUse = MachineHeadType
if not ( BEAM and BEAM.BW) and MachineHeadUse == TWO_EQUAL_HEADS then
if not bOptimizeHeads and MachineHeadUse == TWO_EQUAL_HEADS then
MachineHeadUse = ONE_HEAD
end
if MachineHeadUse == TWO_UP_DOWN_HEADS and bTopHead and bDownHead then
@@ -388,7 +389,7 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead,
for i = ForStart, ForEnd, ForStep do
local Machining = Machinings[i]
local sMachiningType = Machining.Type
if ( BEAM and BEAM.BW) or MachineHeadUse == TWO_EQUAL_HEADS then
if bOptimizeHeads or MachineHeadUse == TWO_EQUAL_HEADS then
_, sMachiningType = EgtEndsWith( Machining.Type, '_H2')
end
-- recupero dati utensile
@@ -464,7 +465,7 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead,
end
end
local bH2, sOrigType = EgtEndsWith( sType, '_H2')
if ( not BEAM or not BEAM.BW) and MachineHeadType == TWO_UP_DOWN_HEADS and bH2 and bTopHead then
if not bOptimizeHeads and MachineHeadType == TWO_UP_DOWN_HEADS and bH2 and bTopHead then
return FindMachining( MachiningType, sOrigType, Params, true, false)
end
end
@@ -501,8 +502,8 @@ function MachiningLib.FindAngleDrilling( dDiam, dDepth, bTopHead, bDownHead)
end
---------------------------------------------------------------------
function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bTopHead, bDownHead, bExcludeH2, bExcludeH3)
return FindMachining( MCH_MY.MILLING, sType, { Depth = dDepth, TuuidMstr = sTuuidMstr, MaxDiam = dMaxDiam, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead, bExcludeH2, bExcludeH3)
function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion)
return FindMachining( MCH_MY.MILLING, sType, { Depth = dDepth, TuuidMstr = sTuuidMstr, MaxDiam = dMaxDiam, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion)
end
---------------------------------------------------------------------
+49 -20
View File
@@ -3094,14 +3094,18 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
return false, sErr
end
local bGoFromHead = true
-- se la lunghezza utensile non riesce ad arrivare sul fondo assegno la possibilità di lavorare di fianco (se possibile)
if dElev > dMaxDepth + 10 * GEO.EPS_SMALL then
local bNoRotation = EgtGetInfo( Proc.Id, Q_NO_ROTATION, 'i')
-- se forzata no rotazione, si entra dal lato se possibile
if bNoRotation and ( Proc.Fct == 4) and ( Proc.Topology == 'Groove') then
local bAttackFromSide = ( ( EgtGetInfo( Proc.Id, Q_NO_ROTATION, 'i') or 0) == 1)
and ( Proc.Fct == 4) and ( Proc.Topology == 'Groove')
-- se normale lungo Z è da sopra: si tenta attacco laterale se richiesto
if AreSameOrOppositeVectorApprox( Proc.Face[ nFacInd + 1].VtN, Z_AX()) then
if bAttackFromSide then
bGoFromHead = false
end
elseif dElev > dMaxDepth + 10 * GEO.EPS_SMALL then
if bAttackFromSide then
bGoFromHead = false
-- continuo di testa se fessura con tre facce o non è tunnel
else
-- continuo di testa se fessura con tre facce o non è tunnel
bGoFromHead = (( bIs3Faces and dMaxElev) or not bOrthoFaces)
end
end
@@ -3208,8 +3212,8 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
vtRef = -vtRef
end
if not ( Proc.Topology == 'Tunnel') then
dDimMin = min( Proc.Face[ nFacInd - 1].Width, Proc.Face[ nFacInd - 1].Height)
dDimMax = min( Proc.Face[ nFacAdj - 1].Width, Proc.Face[ nFacAdj - 1].Height)
dDimMin = min( Proc.Face[ nFacInd + 1].Width, Proc.Face[ nFacInd + 1].Height)
dDimMax = min( Proc.Face[ nFacAdj + 1].Width, Proc.Face[ nFacAdj + 1].Height)
nLundIdFace = nFacAdj
local nFaceZ
if not vtRef then
@@ -3254,37 +3258,62 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
-- imposto offset radiale
local dOffs = ( i - 1) * dStep
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
local dMachiningDepth = dDepth
if Proc.Topology == 'Tunnel' then
-- se possibile aumento l'affondamento pari al raggio corner + 1
if dMaxMat2 > ( dDepth + dSawCornerRad2 + 1) then
EgtSetMachiningParam( MCH_MP.DEPTH, (dDepth + dSawCornerRad2 + 1))
dMachiningDepth = ( dDepth + dSawCornerRad2 + 1)
-- se massimo affondamento supera altezza fessura, uso massimo affondamento
elseif dMaxMat2 > (dDepth + 1) then
EgtSetMachiningParam( MCH_MP.DEPTH, (dMaxMat2 - 1))
elseif dMaxMat2 > ( dDepth + 1) then
dMachiningDepth = (dMaxMat2 - 1)
-- se massimo affondamento utensile inferiore fessura, setto affondamento ed emetto warning
elseif dMaxMat2 < dDepth then
EgtSetMachiningParam( MCH_MP.DEPTH, dMaxMat2)
dMachiningDepth = dMaxMat2
sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
end
EgtSetMachiningParam( MCH_MP.DEPTH, dMachiningDepth)
else
-- se possibile si lavora tutta la profondità
if dMaxMat2 > (dDepth - 100 * GEO.EPS_SMALL) then
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
dMachiningDepth = dDepth
-- in alternativa si arriva al massimo materiale
else
EgtSetMachiningParam( MCH_MP.DEPTH, dMaxMat2)
dMachiningDepth = dMaxMat2
sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
end
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSawWidth / 2 + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + EgtMdbGetGeneralParam( MCH_GP.SAFEAGGRBOTTZ))
EgtSetMachiningParam( MCH_MP.ENDADDLEN, - dSawWidth / 2)
EgtSetMachiningParam( MCH_MP.DEPTH, dMachiningDepth)
local dStartAddLen = dSawWidth / 2 + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + EgtMdbGetGeneralParam( MCH_GP.SAFEAGGRBOTTZ)
local dEndAddLen = - dSawWidth / 2
if vtRef:getZ() > 10 * GEO.EPS_SMALL then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MORTISE_WS.LEFT)
EgtSetMachiningParam( MCH_MP.INVERT, true)
end
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dStartAddLen)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
end
-- considero estremi inizio/fine chiusi
-- imposto massima elevazione
-- in caso di attacco esterno si setta in modo da fare un primo step adeguato per evitare finecorsa
-- si riduce la feed opportunamente
if not ( Proc.Topology == 'Tunnel') then
local dLongitudinalStep = EgtGetMachiningParam( MCH_MP.STEP)
dElev = dLongitudinalStep + 0.1
local dMachiningStep = EgtGetMachiningParam( MCH_MP.STEP) or 0
-- TODO qui sostituire con valore preciso da GetSetupInfo
if BD.C_SIMM then
dMachiningStep = 165
if vtRef:getZ() < - 10 * GEO.EPS_SMALL then
dMachiningStep = 250
end
end
local dActualStep = ( dMachiningDepth - dMachiningStep) / ( 2 + 1)
dElev = dMachiningDepth - dMachiningStep + dActualStep - 0.1
if dActualStep < 0 then
dActualStep = 1
dElev = 2
end
EgtSetMachiningParam( MCH_MP.STEP, dActualStep)
local dFeed = EgtGetMachiningParam( MCH_MP.FEED) / 2
EgtSetMachiningParam( MCH_MP.FEED, dFeed)
end
local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';'
if not ( Proc.Topology == 'Tunnel') then
+14 -2
View File
@@ -1306,6 +1306,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end
-- ciclo sulle parti
local nM = 0
local bInverted = false
for j = 1, nC do
-- su entrambe le facce
for i = nIni, nFin do
@@ -1349,8 +1350,19 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- controllo se lavorazione completa
local dMachDepth = vElevation[vOrd[i]]
if dMachDepth > dMaxDepth - 10 * GEO.EPS_ANG_SMALL then
sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
-- verifico se posso lavorare la faccia 2
local nOtherFace = EgtIf( i == 1, 2, 1)
if j == 1 and vtN[vOrd[nOtherFace]]:getZ() > dLimitAngle and vWidth[vOrd[i]] < dMaxDepth then
vOrd[1], vOrd[2] = vOrd[2], vOrd[1]
dLargh = vWidth[vOrd[i]]
dSal, dEal = dEal, dSal
bInverted = true
else
sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
end
elseif bInverted then
dSal, dEal = dEal, dSal
end
if not bSide and dLargh > 0.8 * dToolDiam then
nO = ceil( dLargh / ( 0.6 * dToolDiam))
+87 -8
View File
@@ -33,6 +33,7 @@ local sEnableExtraBladeUpperFace = 'Q02' -- i
local sDepthChamferMill = 'Q03' -- d
local sOverMaterialForFinish = 'Q04' -- d
local sPreemptiveChamfer = 'Q05' -- i
local bUseSmallMill = 'Q06' -- i
-- abilitazioni extra
local dMakeAntiSplintOnHead = 1 -- valore impronta antischeggia, per disattivare settare = nil o = 0
@@ -206,6 +207,41 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
return nChamfer, dDepth, sMilling, sMilling2
end
---------------------------------------------------------------------
function VerifySmallMillCanFinish( dDiamCurrentTool, dDepthProfile, nSide)
local dToolMaxDepthSmall, dToolDiamSmall
-- abilitazione lavorazione da sotto
local sMillType = 'Prof'
local sMillingSmall, _, _, bH2Small = ML.FindMilling( sMillType, nil, nil, nil, nil, true, nil, nil, nil, 'Smallest')
if not sMillingSmall then
return false
end
-- Recupero i dati dell'utensile
if EgtMdbSetCurrMachining( sMillingSmall) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid)) then
dToolMaxDepthSmall = EgtTdbGetCurrToolMaxDepth()
dToolDiamSmall = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
-- se non ci sono almeno 5mm di differenza si fa con utensile standard
if dDiamCurrentTool - 5 < dToolDiamSmall then
return false
end
end
else
return false
end
local bDouble = ( dDepthProfile + BD.CUT_EXTRA > dToolMaxDepthSmall)
-- se lavorazione in doppio richiesta, si verifica se richiesta testa sotto
if bDouble and nSide == 0 then
return false -- TODO macchine con BD.DOWN_HEAD potrebbero lavorare in doppio in questo caso!
end
if not bDouble or ( dDepthProfile + BD.MILL_OVERLAP < dToolMaxDepthSmall * 2) then
return true, sMillingSmall, bDouble
end
return false
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
@@ -244,7 +280,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if vtN:getZ() > 0.1 then
nSide = 1
elseif vtN:getZ() < -0.1 then
nSide = -1
nSide = -1
end
-- abilitazione lavorazione da sotto
local bMillDown = ( BD.DOWN_HEAD and nSide == -1)
@@ -468,6 +504,15 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end
end
end
local bUseSmallMillOnFinish = EgtGetInfo( Proc.Id, bUseSmallMill, 'i') == 1
local sMillingSmall, bDoubleSmall
-- se serve fresa più piccola per finitura
if bUseSmallMillOnFinish then
bUseSmallMillOnFinish, sMillingSmall, bDoubleSmall = VerifySmallMillCanFinish( dMillDiam, dProfDepth, nSide)
end
-- se il chamfer non è esclusivo continuo con le altre lavorazioni
if nChamfer < 2 then
-- verifico se necessario lavorare in doppio
@@ -477,7 +522,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local sMillingDown
if bDouble then
if nSide == 0 then
if BD.DOWN_HEAD then
if BD.DOWN_HEAD then
-- recupero la lavorazione
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
if not sMillingDown then
@@ -537,10 +582,6 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
bFinish = true
end
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
@@ -567,7 +608,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
nMchId = nMch2Id
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
if bFinish and not bUseSmallMillOnFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
@@ -682,7 +723,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
nMchId = nMch2Id
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
if bFinish and not bUseSmallMillOnFinish then
-- inserisco la lavorazione
local sNewName = 'Prof_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
@@ -738,6 +779,44 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
return false, sErr
end
end
-- se finitura con fresa piccola
if bFinish and bUseSmallMillOnFinish then
local sDepthSmall = EgtIf( bDoubleSmall, ( dProfDepth+ BD.MILL_OVERLAP ) / 2, dProfDepth + BD.CUT_EXTRA)
local sMachName = 'Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
nMchId = EgtAddMachining( sMachName, sMillingSmall)
if not nMchId then
local sErr = 'Error adding machining ' .. sMachName .. '-' .. sMillingSmall
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, sDepthSmall)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
end
if bDoubleSmall then
local sNewName = 'FinB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
end
end
end
end
-- aggiorno ingombro testa o coda per presa
if nSide ~= 1 then -- se feature di fianco o da sotto