|
|
|
@@ -21,6 +21,11 @@
|
|
|
|
|
-- 2023/04/17 Sistemata gestione parametri Q, eliminando quello non usato di forzatura lama e abilitandoli anche per DoubleCut.
|
|
|
|
|
-- Lavorazione CleanCorner sempre forzata con lato di lavoro in centro.
|
|
|
|
|
-- 2023/05/25 Funzioni EgtAddMachining sostituite da WM.AddMachining in modo da trascrivere le priorità da btl alle lavorazioni.
|
|
|
|
|
-- 2023/06/30 Aggiunta lettura delle note esistenti dalle lavorazioni per evitare di sovrascriverle.
|
|
|
|
|
-- 2023/07/10 In MakeSideGrooveByMill si impedisce ora di lavorare una groove se la testa deve scendere sotto al limite superiore del grezzo.
|
|
|
|
|
-- 2023/07/25 Aggiunte passate laterali per SideGroove, se specificato SIDESTEP nelle note utensile.
|
|
|
|
|
-- 2023/08/01 Migliorato controllo testa sotto al grezzo in SieGroove.
|
|
|
|
|
-- 2023/08/07 Controllo testa sotto al grezzo in SideGroove escluso se richiesto il move after.
|
|
|
|
|
|
|
|
|
|
-- Tabella per definizione modulo
|
|
|
|
|
local WPL = {}
|
|
|
|
@@ -811,7 +816,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
|
|
|
|
|
-- riordino le facce
|
|
|
|
|
nNewProcLoc = ReorderFacesFromTab( nNewProcLoc, vFace)
|
|
|
|
|
-- acquisisco il numero della faccia
|
|
|
|
|
nFacCnt = EgtSurfTmFacetCount( nNewProcLoc)
|
|
|
|
|
local nFacCnt = EgtSurfTmFacetCount( nNewProcLoc)
|
|
|
|
|
nFacInd = nFacCnt - 1
|
|
|
|
|
else
|
|
|
|
|
local sErr = 'Cannot make local bottom surface'
|
|
|
|
@@ -1013,10 +1018,13 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.DEPTH, 0)
|
|
|
|
|
-- forzo lato correzione a centrato
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.CENTER)
|
|
|
|
|
-- leggo eventuali note esistenti della lavorazione
|
|
|
|
|
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
|
|
|
|
|
-- Note utente con dichiarazione nessuna generazione sfridi per Vmill
|
|
|
|
|
local sUserNotes = 'VMRS=0;'
|
|
|
|
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'VMRS', 0)
|
|
|
|
|
-- aggiungo alle note massima elevazione
|
|
|
|
|
sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( 0.0, 1) .. ';'
|
|
|
|
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( 0.0, 1))
|
|
|
|
|
-- scrivo le note della lavorazione
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
|
|
|
|
if not EgtApplyMachining( true, false) then
|
|
|
|
|
local _, sErr = EgtGetLastMachMgrError()
|
|
|
|
@@ -1302,13 +1310,16 @@ local function MakeByChainSaw( Proc, nFacet, nRawId, b3Raw, dElev, dH, dV)
|
|
|
|
|
-- se necessario, limito l'affondamento
|
|
|
|
|
if dElev > dMaxDepth + 10 * GEO.EPS_SMALL then
|
|
|
|
|
sWarn = 'Warning in LapJoint : elevation (' .. EgtNumToString( dElev, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
|
|
|
|
|
dDepth = dMaxDepth - dElev
|
|
|
|
|
local dDepth = dMaxDepth - dElev
|
|
|
|
|
EgtOutLog( sWarn)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH '..EgtNumToString( dDepth, 1))
|
|
|
|
|
end
|
|
|
|
|
-- leggo eventuali note esistenti della lavorazione
|
|
|
|
|
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
|
|
|
|
|
-- imposto elevazione
|
|
|
|
|
local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 2) .. ';'
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
|
|
|
|
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dElev, 2))
|
|
|
|
|
-- scrivo le note della lavorazione
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
|
|
|
|
-- eseguo
|
|
|
|
|
if not EgtApplyMachining( true, false) then
|
|
|
|
|
local _, sErr = EgtGetLastMachMgrError()
|
|
|
|
@@ -1436,6 +1447,8 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
return false, sErr
|
|
|
|
|
end
|
|
|
|
|
local dGrooveMinZ = max( b3Raw:getMin():getZ(), Proc.Box:getMin():getZ())
|
|
|
|
|
local dRawMaxZ = b3Raw:getMax():getZ()
|
|
|
|
|
-- recupero i dati dell'utensile
|
|
|
|
|
local dMillDiam = 20
|
|
|
|
|
local dMillLen = 10
|
|
|
|
@@ -1444,6 +1457,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
|
|
|
|
local dMillDiamTh = 999
|
|
|
|
|
local dMillDiamThStem = 0
|
|
|
|
|
local dMillLenTh = 0
|
|
|
|
|
local dSideStep = 0
|
|
|
|
|
if EgtMdbSetCurrMachining( sMilling) then
|
|
|
|
|
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
|
|
|
|
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
|
|
|
@@ -1454,6 +1468,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
|
|
|
|
dMillDiamTh = EgtTdbGetCurrToolThDiam() or dMillDiamTh
|
|
|
|
|
dMillDiamThStem = EgtTdbGetCurrToolParam( MCH_TP.STEMDIAM) or dMillDiamThStem
|
|
|
|
|
dMillLenTh = EgtTdbGetCurrToolThLength() or dMillLenTh
|
|
|
|
|
dSideStep = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDESTEP', 'd') or dSideStep
|
|
|
|
|
if ( EgtTdbGetCurrToolParam( MCH_TP.TYPE) & MCH_TF.SAWBLADE) ~= 0 then
|
|
|
|
|
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dMaxMat
|
|
|
|
|
if not dMaxDepthOnSide or dMaxDepthOnSide < 0.1 then
|
|
|
|
@@ -1465,8 +1480,6 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
|
|
|
|
dMaxDepthOnSide = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd')
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
local dGrooveMinZ = max( b3Raw:getMin():getZ(), Proc.Box:getMin():getZ())
|
|
|
|
|
local dRawMaxZ = b3Raw:getMax():getZ()
|
|
|
|
|
-- se riesco a lavorare il sottosquadro senza arrivare alla parte larga del portautensile uso la sidedepth o il diametro stretto del portautensile come diametro del gambo
|
|
|
|
|
if ( dMillTotLen - dMillLenTh) > ( abs( dRawMaxZ - dGrooveMinZ) + 1) then
|
|
|
|
|
if dMaxDepthOnSide and dMaxDepthOnSide > 0 then
|
|
|
|
@@ -1478,7 +1491,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- se profondità ribasso è maggiore della capacità di sottosquadro dell'utensile
|
|
|
|
|
if ( not bEnablePreMill and bMachFromDn) and ( dElev >= ( 0.5 * ( dMillDiam - dMillDiamTh))) then
|
|
|
|
|
if ( not bEnablePreMill and bMachFromDn) and ( dElev > 0.5 * ( dMillDiam - dMillDiamTh) - 10 * GEO.EPS_SMALL) then
|
|
|
|
|
local sErr = 'Error : Side Elevation (' .. dElev .. ') bigger than max tool side depth (' .. ( 0.5 * ( dMillDiam - dMillDiamTh)) ..')'
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
return false, sErr
|
|
|
|
@@ -1490,7 +1503,20 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
|
|
|
|
return false, sErr
|
|
|
|
|
end
|
|
|
|
|
if Proc.Fct == 2 and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + 100 * GEO.EPS_SMALL and dMaxMat > dThick + 10 * GEO.EPS_SMALL then
|
|
|
|
|
local sErr = 'Error : Tool thickness is too big'
|
|
|
|
|
local sErr = 'Error : Tool thickness is too big'
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
return false, sErr
|
|
|
|
|
end
|
|
|
|
|
-- dimensioni della testa
|
|
|
|
|
local dHeadMaxWidth = 250
|
|
|
|
|
local dHeadMinWidth = 160
|
|
|
|
|
local dHeadMinWidthHeight = 30
|
|
|
|
|
-- se la testa scende sotto al limite superiore del grezzo e non c'è sufficiente capacità di sottosquadro
|
|
|
|
|
-- controllo disattivato se move after
|
|
|
|
|
if WD.SIDEMILL_BEFORE and not ( bEnablePreMill or bAsEnablePreMill) and
|
|
|
|
|
( ( dMillTotLen < ( abs( dRawMaxZ - dGrooveMinZ) + 10 * GEO.EPS_SMALL) and ( dElev > 0.5 * ( dMillDiam - dHeadMinWidth) - 10 * GEO.EPS_SMALL)) or
|
|
|
|
|
( dMillTotLen + dHeadMinWidthHeight < ( abs( dRawMaxZ - dGrooveMinZ) + 10 * GEO.EPS_SMALL) and ( dElev > 0.5 * ( dMillDiam - dHeadMaxWidth) - 10 * GEO.EPS_SMALL))) then
|
|
|
|
|
local sErr = 'Error : Tool too short, head will collide with rawpart'
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
return false, sErr
|
|
|
|
|
end
|
|
|
|
@@ -1732,7 +1758,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- inserisco la lavorazione di fresatura
|
|
|
|
|
local sNameGorge = 'Gorge_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. tostring( nFacet) .. '_' .. tostring( nNm)
|
|
|
|
|
local sNameGorge = 'Gorge_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. tostring( nFacet)
|
|
|
|
|
local nMchFId = WM.AddMachining( Proc, sNameGorge, sMillingGorge)
|
|
|
|
|
if not nMchFId then
|
|
|
|
|
local sErr = 'Error adding machining ' .. sNameGorge .. '-' .. sMillingGorge
|
|
|
|
@@ -1748,7 +1774,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
|
|
|
|
end
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
|
|
|
|
-- imposto modo di lavorare la faccia
|
|
|
|
|
local nFaceUse = WL.GetNearestParalOpposite( Z_AX(), vtN)
|
|
|
|
|
local nFaceUse = WL.GetNearestParalOpposite( Z_AX())
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
|
|
|
|
-- imposto elevazione e step
|
|
|
|
|
local dStep = EgtGetMachiningParam( MCH_MP.STEP)
|
|
|
|
@@ -1783,7 +1809,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
|
|
|
|
for i = 1, nNumStep - 1 do
|
|
|
|
|
nNm = nNm + 1
|
|
|
|
|
-- inserisco la lavorazione di taglio sfrido gorge
|
|
|
|
|
local sNameGorge = 'GorgeCut_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. tostring( nFacet) .. '_' .. tostring( nNm)
|
|
|
|
|
local sNameGorge = 'GorgeCut_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. tostring( nFacet) .. '_' .. tostring( nNm)
|
|
|
|
|
local nMchFId = WM.AddMachining( Proc, sNameGorge, sCuttingGorge)
|
|
|
|
|
if not nMchFId then
|
|
|
|
|
local sErr = 'Error adding machining ' .. sNameGorge .. '-' .. sCuttingGorge
|
|
|
|
@@ -1841,121 +1867,147 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
|
|
|
|
|
|
|
|
|
local dStepOri
|
|
|
|
|
if not bExcludeSideMill then
|
|
|
|
|
-- inserisco la lavorazione di ribasso o gola
|
|
|
|
|
local sName = EgtIf( bEnablePreMill ~= nil, 'SideMill_', 'Mill_') .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
|
|
|
|
local nMchFId = WM.AddMachining( Proc, sName, sMilling)
|
|
|
|
|
if not nMchFId then
|
|
|
|
|
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
return false, sErr
|
|
|
|
|
local nSideStep = 1
|
|
|
|
|
if dSideStep > 0 and not ( bEnablePreMill or bAsEnablePreMill) and nModifyLeadInOut < 1 then
|
|
|
|
|
nSideStep = ceil( dElev / dSideStep)
|
|
|
|
|
dSideStep = max( dElev / nSideStep, 0)
|
|
|
|
|
end
|
|
|
|
|
EgtSetInfo( nMchFId, 'Part', Proc.PartId)
|
|
|
|
|
-- se ho abilitato la lavorazione di lama per garantire passaggio utensile, setto la nota per spostare la fresatura dopo i tagli di lama
|
|
|
|
|
if bEnablePreMill or bAsEnablePreMill then
|
|
|
|
|
EgtSetInfo( nMchFId, 'MOVE_AFTER', 1)
|
|
|
|
|
end
|
|
|
|
|
-- aggiungo geometria
|
|
|
|
|
EgtSetMachiningGeometry( {{ Proc.Id, nFacet}})
|
|
|
|
|
-- imposto posizione braccio porta testa
|
|
|
|
|
local nSCC = MCH_SCC.ADIR_NEAR
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
|
|
|
|
-- imposto modo di lavorare la faccia
|
|
|
|
|
local nFaceUse = WL.GetNearestParalOpposite( Z_AX(), vtN)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
|
|
|
|
-- imposto elevazione e step
|
|
|
|
|
local dStep = EgtGetMachiningParam( MCH_MP.STEP)
|
|
|
|
|
dStepOri = dStep
|
|
|
|
|
if dStep < GEO.EPS_SMALL then dStep = 0.75 * dMaxMat end
|
|
|
|
|
local nStep = ceil( ( dThick - dMaxMat) / dStep)
|
|
|
|
|
dStep = max( ( dThick - dMaxMat) / max( nStep, 1), 0)
|
|
|
|
|
local dMaxElev = max( ( nStep + 1) * dStep - GEO.EPS_SMALL, 0)
|
|
|
|
|
if nSinglePass and nSinglePass > 0 then
|
|
|
|
|
dStep = 0
|
|
|
|
|
if nSinglePass == 1 then
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.DEPTH, dMaxMat)
|
|
|
|
|
for i = 1, nSideStep do
|
|
|
|
|
-- inserisco la lavorazione di ribasso o gola
|
|
|
|
|
local sName = EgtIf( bEnablePreMill ~= nil, 'SideMill_', 'Mill_') .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
|
|
|
|
local nMchFId = WM.AddMachining( Proc, sName, sMilling)
|
|
|
|
|
if not nMchFId then
|
|
|
|
|
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
return false, sErr
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if bUpwardMilling then
|
|
|
|
|
dStep = -dStep
|
|
|
|
|
end
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.STEP, dStep)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxElev, 3) .. ';')
|
|
|
|
|
-- setto il lato di lavoro standard
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
|
|
|
|
-- modifico ingressi e uscita
|
|
|
|
|
-- se ho inserito il pretaglio modifico
|
|
|
|
|
if bEnablePreMill or bAsEnablePreMill then
|
|
|
|
|
if nModifyLeadInOut > 0 then
|
|
|
|
|
-- Confronto il raggio fresa con l'elevazione dalla normale per vedere se devo modificare l'uscita
|
|
|
|
|
if dElev > ( 0.5 * dMillDiam) then
|
|
|
|
|
if nModifyLeadInOut == 1 then
|
|
|
|
|
-- setto il tipo di passo a una via
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.STEPTYPE, MCH_MILL_ST.ONEWAY)
|
|
|
|
|
-- modifico il tipo di uscita
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG)
|
|
|
|
|
EgtSetInfo( nMchFId, 'Part', Proc.PartId)
|
|
|
|
|
-- se ho abilitato la lavorazione di lama per garantire passaggio utensile, setto la nota per spostare la fresatura dopo i tagli di lama
|
|
|
|
|
if bEnablePreMill or bAsEnablePreMill then
|
|
|
|
|
EgtSetInfo( nMchFId, 'MOVE_AFTER', 1)
|
|
|
|
|
end
|
|
|
|
|
-- aggiungo geometria
|
|
|
|
|
EgtSetMachiningGeometry( {{ Proc.Id, nFacet}})
|
|
|
|
|
-- imposto posizione braccio porta testa
|
|
|
|
|
local nSCC = MCH_SCC.ADIR_NEAR
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
|
|
|
|
-- imposto modo di lavorare la faccia
|
|
|
|
|
local nFaceUse = WL.GetNearestParalOpposite( Z_AX())
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
|
|
|
|
-- imposto elevazione e step
|
|
|
|
|
local dStep = EgtGetMachiningParam( MCH_MP.STEP)
|
|
|
|
|
dStepOri = dStep
|
|
|
|
|
if dStep < GEO.EPS_SMALL then dStep = 0.75 * dMaxMat end
|
|
|
|
|
local nStep = ceil( ( dThick - dMaxMat) / dStep)
|
|
|
|
|
dStep = max( ( dThick - dMaxMat) / max( nStep, 1), 0)
|
|
|
|
|
local dMaxElev = max( ( nStep + 1) * dStep - GEO.EPS_SMALL, 0)
|
|
|
|
|
if nSinglePass and nSinglePass > 0 then
|
|
|
|
|
dStep = 0
|
|
|
|
|
if nSinglePass == 1 then
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.DEPTH, dMaxMat)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if bUpwardMilling then
|
|
|
|
|
dStep = -dStep
|
|
|
|
|
end
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.STEP, dStep)
|
|
|
|
|
-- leggo eventuali note esistenti della lavorazione
|
|
|
|
|
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
|
|
|
|
|
-- aggiungo alle note massima elevazione
|
|
|
|
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dMaxElev, 3))
|
|
|
|
|
-- scrivo le note della lavorazione
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
|
|
|
|
-- setto il lato di lavoro standard
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
|
|
|
|
-- setto offset radiale per gestire le eventuali passate in orizzontale
|
|
|
|
|
local dRadialOffset = dSideStep * ( nSideStep - i)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.OFFSR, dRadialOffset)
|
|
|
|
|
-- modifico ingressi e uscita
|
|
|
|
|
-- se ho inserito il pretaglio modifico
|
|
|
|
|
if bEnablePreMill or bAsEnablePreMill then
|
|
|
|
|
if nModifyLeadInOut > 0 then
|
|
|
|
|
-- Confronto il raggio fresa con l'elevazione dalla normale per vedere se devo modificare l'uscita
|
|
|
|
|
if dElev > ( 0.5 * dMillDiam) then
|
|
|
|
|
if nModifyLeadInOut == 1 then
|
|
|
|
|
-- setto il tipo di passo a una via
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.STEPTYPE, MCH_MILL_ST.ONEWAY)
|
|
|
|
|
-- modifico il tipo di uscita
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LIPERP, 0)
|
|
|
|
|
-- modifico dati supplementari uscita
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LOPERP, 0.5)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LOTANG, -( dLongGorge + dExtraLongIni + dExtraLongEnd))
|
|
|
|
|
else
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LIPERP, dElev)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LOPERP, dElev)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- setto allungamenti iniziali e finali
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtraLongIni)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtraLongEnd)
|
|
|
|
|
if bInvertMach then
|
|
|
|
|
-- setto il lato di lavoro invertito
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.INVERT, false)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
-- setto allungamenti iniziali e finali
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtraLongIni)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtraLongEnd)
|
|
|
|
|
-- Confronto il raggio fresa con l'elevazione dalla normale per vedere se devo modificare l'uscita
|
|
|
|
|
if dElev > ( 0.5 * dMillDiam) then
|
|
|
|
|
-- setto allungamenti perpendicolari
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LIPERP, 0)
|
|
|
|
|
-- modifico dati supplementari uscita
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LOPERP, 0.5)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LOTANG, -( dLongGorge + dExtraLongIni + dExtraLongEnd))
|
|
|
|
|
else
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LIPERP, dElev)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LOPERP, dElev)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LOPERP, 0)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- se richiesto, setto la nota per spostare la lavorazione alla fine
|
|
|
|
|
if not WD.SIDEMILL_BEFORE then
|
|
|
|
|
EgtSetInfo( nMchFId, 'MOVE_AFTER', 1)
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
if nModifyLeadInOut > 0 then
|
|
|
|
|
-- Confronto il raggio fresa con l'elevazione dalla normale per vedere se devo modificare l'uscita
|
|
|
|
|
if dElev > ( 0.5 * dMillDiam) then
|
|
|
|
|
-- setto il tipo di passo a una via
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.STEPTYPE, 1)
|
|
|
|
|
end
|
|
|
|
|
if bInvertMach then
|
|
|
|
|
-- setto il lato di lavoro invertito
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.INVERT, false)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- setto allungamenti iniziali e finali
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtraLongIni)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtraLongEnd)
|
|
|
|
|
if bInvertMach then
|
|
|
|
|
-- setto il lato di lavoro invertito
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.INVERT, false)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
|
|
|
|
-- se ho passate orizzontali riduco l'eventuale allungamento settato dall'utente
|
|
|
|
|
local dLiPerp = EgtGetMachiningParam( MCH_MP.LIPERP)
|
|
|
|
|
local dLoPerp = EgtGetMachiningParam( MCH_MP.LOPERP)
|
|
|
|
|
if dLiPerp > 0 then
|
|
|
|
|
dLiPerp = dLiPerp - dRadialOffset
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
-- setto allungamenti iniziali e finali
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtraLongIni)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtraLongEnd)
|
|
|
|
|
-- Confronto il raggio fresa con l'elevazione dalla normale per vedere se devo modificare l'uscita
|
|
|
|
|
if dElev > ( 0.5 * dMillDiam) then
|
|
|
|
|
-- setto allungamenti perpendicolari
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LIPERP, 0)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LOPERP, 0)
|
|
|
|
|
if dLoPerp > 0 then
|
|
|
|
|
dLoPerp = dLoPerp - dRadialOffset
|
|
|
|
|
end
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LIPERP, dLiPerp)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LOPERP, dLoPerp)
|
|
|
|
|
-- se richiesto, setto la nota per spostare la lavorazione alla fine
|
|
|
|
|
if not WD.SIDEMILL_BEFORE then
|
|
|
|
|
EgtSetInfo( nMchFId, 'MOVE_AFTER', 1)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- se richiesto, setto la nota per spostare la lavorazione alla fine
|
|
|
|
|
if not WD.SIDEMILL_BEFORE then
|
|
|
|
|
EgtSetInfo( nMchFId, 'MOVE_AFTER', 1)
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
if nModifyLeadInOut > 0 then
|
|
|
|
|
-- Confronto il raggio fresa con l'elevazione dalla normale per vedere se devo modificare l'uscita
|
|
|
|
|
if dElev > ( 0.5 * dMillDiam) then
|
|
|
|
|
-- setto il tipo di passo a una via
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.STEPTYPE, 1)
|
|
|
|
|
end
|
|
|
|
|
if bInvertMach then
|
|
|
|
|
-- setto il lato di lavoro invertito
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.INVERT, false)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- setto allungamenti iniziali e finali
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtraLongIni)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtraLongEnd)
|
|
|
|
|
-- se richiesto, setto la nota per spostare la lavorazione alla fine
|
|
|
|
|
if not WD.SIDEMILL_BEFORE then
|
|
|
|
|
EgtSetInfo( nMchFId, 'MOVE_AFTER', 1)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- eseguo
|
|
|
|
|
if not EgtApplyMachining( true, false) then
|
|
|
|
|
-- provo a invertire posizione braccio porta testa
|
|
|
|
|
nSCC = MCH_SCC.ADIR_FAR
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
|
|
|
|
-- eseguo
|
|
|
|
|
if not EgtApplyMachining( true, false) then
|
|
|
|
|
local _, sErr = EgtGetLastMachMgrError()
|
|
|
|
|
EgtSetOperationMode( nMchFId, false)
|
|
|
|
|
return false, sErr
|
|
|
|
|
-- provo a invertire posizione braccio porta testa
|
|
|
|
|
nSCC = MCH_SCC.ADIR_FAR
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
|
|
|
|
if not EgtApplyMachining( true, false) then
|
|
|
|
|
local _, sErr = EgtGetLastMachMgrError()
|
|
|
|
|
EgtSetOperationMode( nMchFId, false)
|
|
|
|
|
return false, sErr
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
@@ -1999,7 +2051,12 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
|
|
|
|
dStepOtherFace = -dStepOtherFace
|
|
|
|
|
end
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.STEP, dStepOtherFace)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxElev, 3) .. ';')
|
|
|
|
|
-- leggo eventuali note esistenti della lavorazione
|
|
|
|
|
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
|
|
|
|
|
-- aggiungo alle note massima elevazione
|
|
|
|
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dMaxElev, 3))
|
|
|
|
|
-- scrivo le note della lavorazione
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
|
|
|
|
if bMachFromDn then
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.DEPTH, dDepthOtherFace)
|
|
|
|
@@ -2184,8 +2241,12 @@ local function MakeByPocketing( Proc, nFacet, nRawId, b3Raw, bCheckQPar)
|
|
|
|
|
EgtOutLog( sWarn)
|
|
|
|
|
end
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
|
|
|
|
-- leggo eventuali note della lavorazione
|
|
|
|
|
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
|
|
|
|
|
-- imposto elevazione
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( min( dElev, dMaxDepth), 1) .. ';')
|
|
|
|
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( min( dElev, dMaxDepth), 1))
|
|
|
|
|
-- scrivo le note della lavorazione
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
|
|
|
|
-- eseguo
|
|
|
|
|
if not EgtApplyMachining( true, false) then
|
|
|
|
|
local _, sErr = EgtGetLastMachMgrError()
|
|
|
|
@@ -2605,8 +2666,12 @@ local function MakeMoreFaces( Proc, nRawId, b3Raw)
|
|
|
|
|
return MakeSideGrooveByMill( Proc, nFacInd, nRawId, b3Raw, EgtIf( dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, nil, nil, bLikeAsMakeFirstGroove, nSinglePass)
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
-- fresatura (se definita)
|
|
|
|
|
local sMilling = WM.FindMilling( 'SideGroove', nil, nil, nil, nil, min( dH, dV))
|
|
|
|
|
-- fresatura (se definita); se disponibile, cerco di usare un utensile che non lavori al limite della capacità di sottosquadro
|
|
|
|
|
local sMilling = WM.FindMilling( 'SideGroove', nil, nil, nil, nil, min( dH, dV), nil, 1.2 * dSideElev)
|
|
|
|
|
-- se non ho trovato un utensile un po' più grande del sottosquadro richiesto, passo alla ricerca standard
|
|
|
|
|
if not sMilling then
|
|
|
|
|
sMilling = WM.FindMilling( 'SideGroove', nil, nil, nil, nil, min( dH, dV), nil, dSideElev)
|
|
|
|
|
end
|
|
|
|
|
-- recupero i dati dell'utensile
|
|
|
|
|
local dMaxMat = 1000
|
|
|
|
|
local dMaxDepthOnSide = 0
|
|
|
|
@@ -2614,7 +2679,7 @@ local function MakeMoreFaces( Proc, nRawId, b3Raw)
|
|
|
|
|
if sMilling and EgtMdbSetCurrMachining( sMilling) then
|
|
|
|
|
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
|
|
|
|
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
|
|
|
|
local dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
|
|
|
|
|
local dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or 0
|
|
|
|
|
bIsBlade = EgtTdbGetCurrToolParam( MCH_TP.TYPE) & MCH_TF.SAWBLADE ~= 0
|
|
|
|
|
if bIsBlade then
|
|
|
|
|
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dMaxMat
|
|
|
|
@@ -2629,12 +2694,12 @@ local function MakeMoreFaces( Proc, nRawId, b3Raw)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if sMilling and dElev < dMaxDepthOnSide then
|
|
|
|
|
return MakeSideGrooveByMill( Proc, nFacInd, nRawId, b3Raw, sMilling)
|
|
|
|
|
-- altrimenti sega a catena
|
|
|
|
|
else
|
|
|
|
|
return MakeByChainSaw( Proc, nFacInd, nRawId, b3Raw, dElev, dH, dV)
|
|
|
|
|
end
|
|
|
|
|
if sMilling and dElev < dMaxDepthOnSide then
|
|
|
|
|
return MakeSideGrooveByMill( Proc, nFacInd, nRawId, b3Raw, sMilling)
|
|
|
|
|
-- altrimenti sega a catena
|
|
|
|
|
else
|
|
|
|
|
return MakeByChainSaw( Proc, nFacInd, nRawId, b3Raw, dElev, dH, dV)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
local nFacet = EgtIf( bPckt or vtN:getZ() >= WD.NZ_MINA, nFacInd, nFacInd2)
|
|
|
|
|