Compare commits

..

4 Commits

Author SHA1 Message Date
andrea.villa 7a64a68167 Corretto controllo esistenza lavorazione saltate 2024-12-02 08:53:25 +01:00
andrea.villa 2e086f9f42 Merge branch 'develop' into MachiningMultiDrill 2024-11-28 12:40:45 +01:00
andrea.villa c7e8c63f37 - Gestione Aggregati con forature multiple
- Aggiunto nuovo tipo di lavorazione: MultiDrill
- Aggiunto parametro USE_MULTI_DRILL da mettere nel BeamData per abilitare la gestione
2024-11-28 12:01:30 +01:00
andrea.villa 2311ab4614 Raggruppamento fori simili in un'unica lavorazione 2024-11-27 09:23:36 +01:00
36 changed files with 915 additions and 4581 deletions
+8 -135
View File
@@ -101,21 +101,6 @@ local function WriteTimeToLogFile( dTime)
hFile:close() hFile:close()
end end
-- Funzioni per riportare stato lavorazione o pezzo in nge
local function WriteErrToNge( nProcId, sErr, sMsg, sRot, sCutId, sTaskId)
EgtSetInfo( nProcId, 'STATUS.ERR', sErr)
EgtSetInfo( nProcId, 'STATUS.MSG', sMsg)
EgtSetInfo( nProcId, 'STATUS.ROT', sRot)
EgtSetInfo( nProcId, 'CUTID', sCutId)
EgtSetInfo( nProcId, 'TASKID', sTaskId)
end
local function WriteFallToNge( nPartId, sErr, sMsg, sCutId, sFall)
EgtSetInfo( nPartId, 'STATUS.ERR', sErr)
EgtSetInfo( nPartId, 'STATUS.MSG', sMsg)
EgtSetInfo( nPartId, 'CUTID', sCutId)
EgtSetInfo( nPartId, 'STATUS.FALL', sFall)
end
-- Funzione per gestire visualizzazione dopo errore -- Funzione per gestire visualizzazione dopo errore
local function PostErrView( nErr, sMsg) local function PostErrView( nErr, sMsg)
if nErr ~= 0 and ( BEAM.FLAG == 1 or BEAM.FLAG == 2) then if nErr ~= 0 and ( BEAM.FLAG == 1 or BEAM.FLAG == 2) then
@@ -137,31 +122,13 @@ end
-- Funzione per aggiornare dati ausiliari -- Funzione per aggiornare dati ausiliari
local function UpdateAuxData( sAuxFile) local function UpdateAuxData( sAuxFile)
local bModif = false local bModif = false
local BtlInfoId = EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL
-- Se definito LOAD90, aggiorno -- Se definito LOAD90, aggiorno
local sLoad90 = EgtGetStringFromIni( 'AuxData', 'LOAD90', '', sAuxFile) local sLoad90 = EgtGetStringFromIni( 'AuxData', 'LOAD90', '', sAuxFile)
if sLoad90 ~= '' then if sLoad90 ~= '' then
local BtlInfoId = EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL
EgtSetInfo( BtlInfoId, 'LOAD90', sLoad90) EgtSetInfo( BtlInfoId, 'LOAD90', sLoad90)
bModif = true bModif = true
end end
-- Se definito UNLOAD, aggiorno
local sUnload = EgtGetStringFromIni( 'AuxData', 'UNLOAD', '', sAuxFile)
if sUnload ~= '' then
EgtSetInfo( BtlInfoId, 'UNLOAD', sUnload)
bModif = true
end
-- Se definito PROJID, aggiorno
local sProjId = EgtGetStringFromIni( 'AuxData', 'PROJID', '', sAuxFile)
if sProjId ~= '' then
EgtSetInfo( BtlInfoId, 'PROJECTNUMBER', sProjId)
bModif = true
end
-- Se definito PRODID, aggiorno
local sProdId = EgtGetStringFromIni( 'AuxData', 'PRODID', '', sAuxFile)
if sProdId ~= '' then
EgtSetInfo( BtlInfoId, 'PRODID', sProdId)
bModif = true
end
return bModif return bModif
end end
@@ -247,11 +214,7 @@ if bToProcess then
EgtEraseFile( sNgeFile) EgtEraseFile( sNgeFile)
-- eseguo import -- eseguo import
EgtNewFile() EgtNewFile()
local nBtlFlag = EIB_FL.TS3_POS + EIB_FL.USEUATTR if not EgtImportBtl( BEAM.FILE, EIB_FL.TS3_POS + EIB_FL.USEUATTR) then
if BD.USE_PART_OFFSET then
nBtlFlag = nBtlFlag + EIB_FL.PARTOFFSET
end
if not EgtImportBtl( BEAM.FILE, nBtlFlag) then
BEAM.ERR = 13 BEAM.ERR = 13
BEAM.MSG = 'Error importing BTL file : ' .. BEAM.FILE BEAM.MSG = 'Error importing BTL file : ' .. BEAM.FILE
WriteErrToLogFile( BEAM.ERR, BEAM.MSG) WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
@@ -391,7 +354,7 @@ if bToProcess then
end end
end end
-- Verifico sezione barra non troppo piccola -- Verifico sezione barra non troppo piccola
if dRawW < BD.MIN_WIDTH - 10 * GEO.EPS_SMALL or dRawH < BD.MIN_HEIGHT - 10 * GEO.EPS_SMALL then if dRawW < BD.MIN_WIDTH - 10 * GEO.EPS_SMALL or dRawH < BD.MIN_HEIGHT - 10 * GEO.EPS_SMALL then
local sOut = 'Sezione (' .. EgtNumToString( dRawW, 2) .. ' x ' .. EgtNumToString( dRawH, 2) .. ') ' .. local sOut = 'Sezione (' .. EgtNumToString( dRawW, 2) .. ' x ' .. EgtNumToString( dRawH, 2) .. ') ' ..
'sotto i limiti della macchina (' .. EgtNumToString( BD.MIN_WIDTH, 2) .. ' x ' .. EgtNumToString( BD.MIN_HEIGHT, 2) .. ')' 'sotto i limiti della macchina (' .. EgtNumToString( BD.MIN_WIDTH, 2) .. ' x ' .. EgtNumToString( BD.MIN_HEIGHT, 2) .. ')'
@@ -401,63 +364,6 @@ if bToProcess then
PostErrView( BEAM.ERR, BEAM.MSG) PostErrView( BEAM.ERR, BEAM.MSG)
return return
end end
-- Se presente offset da btl, verifico se offset uguale per tutti i pezzi
if BD.USE_PART_OFFSET then
vBeamErr = {}
local sPartOffset = EgtGetInfo( vBeam[1].Id, 'PARTOFFSET', 's') or ''
local vPartOffset = EgtSplitString( sPartOffset)
local dRotAng = EgtGetInfo( vBeam[1].Id, 'ROTATED_OK', 'd') or 0
for i = 2, #vBeam do
local sPartOffsetCurrent = EgtGetInfo( vBeam[i].Id, 'PARTOFFSET', 's') or ''
local vPartOffsetCurrent = EgtSplitString( sPartOffsetCurrent)
local dRotAngCurrent = EgtGetInfo( vBeam[i].Id, 'ROTATED_OK', 'd') or 0
local dRotAngDelta = abs( dRotAngCurrent - dRotAng)
if ( #vPartOffset == 5) and ( #vPartOffsetCurrent == 5) then
if dRotAngDelta < GEO.EPS_ANG_SMALL then
if ( vPartOffsetCurrent[2] ~= vPartOffsetCurrent[2])
or ( vPartOffsetCurrent[3] ~= vPartOffset[3])
or ( vPartOffsetCurrent[4] ~= vPartOffset[4])
or ( vPartOffsetCurrent[5] ~= vPartOffset[5]) then
table.insert( vBeamErr, i)
end
elseif dRotAngDelta - 180 < GEO.EPS_ANG_SMALL then
if ( vPartOffsetCurrent[2] ~= vPartOffsetCurrent[4])
or ( vPartOffsetCurrent[3] ~= vPartOffset[5])
or ( vPartOffsetCurrent[4] ~= vPartOffset[2])
or ( vPartOffsetCurrent[5] ~= vPartOffset[3]) then
table.insert( vBeamErr, i)
end
-- se pezzo ruotato di 90deg rispetto al principale, al momento si dà sempre errore
else
table.insert( vBeamErr, i)
end
else
if sPartOffsetCurrent ~= sPartOffset then
table.insert( vBeamErr, i)
end
end
end
if #vBeamErr > 0 then
local sOut = 'Part offset not consistent in beam(s) : '
for i = #vBeamErr, 1, -1 do
local sSeparator = ', '
if i == 1 then
sSeparator = ''
end
sOut = sOut .. vBeam[vBeamErr[i]].Name .. sSeparator
end
BEAM.ERR = 17
BEAM.MSG = sOut
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
PostErrView( BEAM.ERR, BEAM.MSG)
return
end
end
-- Lunghezza della barra -- Lunghezza della barra
local dRawL = ( EgtGetInfo( EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL, 'BARLEN', 'd') or 12000) + 0.1 local dRawL = ( EgtGetInfo( EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL, 'BARLEN', 'd') or 12000) + 0.1
@@ -495,9 +401,6 @@ if bToProcess then
BEAM.CUTID = Stats[i].CutId BEAM.CUTID = Stats[i].CutId
BEAM.TASKID = Stats[i].TaskId BEAM.TASKID = Stats[i].TaskId
WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID) WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
if Stats[i].ProcId then
WriteErrToNge( Stats[i].ProcId, BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
end
elseif Stats[i].Err > 0 then elseif Stats[i].Err > 0 then
nErrCnt = nErrCnt + 1 nErrCnt = nErrCnt + 1
sOutput = sOutput .. string.format( '[%d,%d] %s\n', Stats[i].CutId, Stats[i].TaskId, sMsg) sOutput = sOutput .. string.format( '[%d,%d] %s\n', Stats[i].CutId, Stats[i].TaskId, sMsg)
@@ -507,9 +410,6 @@ if bToProcess then
BEAM.CUTID = Stats[i].CutId BEAM.CUTID = Stats[i].CutId
BEAM.TASKID = Stats[i].TaskId BEAM.TASKID = Stats[i].TaskId
WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID) WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
if Stats[i].ProcId then
WriteErrToNge( Stats[i].ProcId, BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
end
elseif Stats[i].Err < 0 then elseif Stats[i].Err < 0 then
-- se segnalazione scarico pezzo standard, incompleto o a caduta -- se segnalazione scarico pezzo standard, incompleto o a caduta
if Stats[i].Err == -100 or Stats[i].Err == -101 or Stats[i].Err == -102 then if Stats[i].Err == -100 or Stats[i].Err == -101 or Stats[i].Err == -102 then
@@ -518,9 +418,6 @@ if bToProcess then
BEAM.CUTID = Stats[i].CutId BEAM.CUTID = Stats[i].CutId
BEAM.FALL = abs( Stats[i].Err + 100) BEAM.FALL = abs( Stats[i].Err + 100)
WriteFallToLogFile( BEAM.ERR, BEAM.MSG, BEAM.CUTID, BEAM.FALL) WriteFallToLogFile( BEAM.ERR, BEAM.MSG, BEAM.CUTID, BEAM.FALL)
if Stats[i].ProcId then
WriteFallToNge( Stats[i].PartId, BEAM.ERR, BEAM.MSG, BEAM.CUTID, BEAM.FALL)
end
-- altri avvertimenti -- altri avvertimenti
else else
nWarnCnt = nWarnCnt + 1 nWarnCnt = nWarnCnt + 1
@@ -531,9 +428,6 @@ if bToProcess then
BEAM.CUTID = Stats[i].CutId BEAM.CUTID = Stats[i].CutId
BEAM.TASKID = Stats[i].TaskId BEAM.TASKID = Stats[i].TaskId
WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID) WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
if Stats[i].ProcId then
WriteErrToNge( Stats[i].ProcId, BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
end
end end
end end
end end
@@ -549,56 +443,35 @@ if bToProcess then
PostWarnView( 19, sOutput) PostWarnView( 19, sOutput)
end end
-- Altrimenti carico il progetto salvato, rileggo gli errori da nge e riscrivo il log txt con gli stati precedenti -- Altrimenti carico il progetto salvato e dichiaro nessun errore
else else
EgtOutLog( ' +++ Loading Project already processed >>>') EgtOutLog( ' +++ Loading Project already processed >>>')
-- Carico il progetto già fatto -- Carico il progetto già fatto
EgtOpenFile( sNgeFile) EgtOpenFile( sNgeFile)
-- Riscrivo il log txt -- Dichiaro nessun errore
local nPartId = EgtGetFirstPart() local nPartId = EgtGetFirstPart()
while nPartId do while nPartId do
local nCutId = EgtGetInfo( nPartId, 'CUTID') local nCutId = EgtGetInfo( nPartId, 'CUTID')
if nCutId then if nCutId then
-- stato a livello di singola feature
local nProcId = EgtGetFirstInGroup( EgtGetFirstNameInGroup( nPartId, 'Processings') or GDB_ID.NULL) local nProcId = EgtGetFirstInGroup( EgtGetFirstNameInGroup( nPartId, 'Processings') or GDB_ID.NULL)
while nProcId do while nProcId do
local bIsFea = EgtExistsInfo( nProcId, 'GRP') and EgtExistsInfo( nProcId, 'PRC') local bIsFea = EgtExistsInfo( nProcId, 'GRP') and EgtExistsInfo( nProcId, 'PRC')
local nTaskId = EgtGetInfo( nProcId, 'TASKID') local nTaskId = EgtGetInfo( nProcId, 'TASKID')
local sErr = EgtGetInfo( nProcId, 'STATUS.ERR') or 0
local sMsg = EgtGetInfo( nProcId, 'STATUS.MSG') or '---'
local sRot = EgtGetInfo( nProcId, 'STATUS.ROT') or 0
if bIsFea and nTaskId then if bIsFea and nTaskId then
BEAM.ERR = sErr BEAM.ERR = 0
BEAM.MSG = sMsg BEAM.MSG = '---'
BEAM.ROT = sRot BEAM.ROT = 0
BEAM.CUTID = nCutId BEAM.CUTID = nCutId
BEAM.TASKID = nTaskId BEAM.TASKID = nTaskId
WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID) WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
end end
nProcId = EgtGetNext( nProcId) nProcId = EgtGetNext( nProcId)
end end
-- stato a livello di pezzo
local sErr = EgtGetInfo( nPartId, 'STATUS.ERR') or 0
if sErr == -100 or sErr == -101 or sErr == -102 then
local sMsg = EgtGetInfo( nPartId, 'STATUS.MSG') or '---'
local sFall = EgtGetInfo( nPartId, 'STATUS.FALL') or 0
BEAM.ERR = sErr
BEAM.MSG = sMsg
BEAM.CUTID = nCutId
BEAM.FALL = sFall
WriteFallToLogFile( BEAM.ERR, BEAM.MSG, BEAM.CUTID, BEAM.FALL)
end
end end
nPartId = EgtGetNextPart( nPartId) nPartId = EgtGetNextPart( nPartId)
end end
-- Aggiorno eventuali dati ausiliari -- Aggiorno eventuali dati ausiliari
UpdateAuxData( sBtmFile) UpdateAuxData( sBtmFile)
-- Anche se non è da riprocessare, imposto nome file CN.
-- Se file TS7 importato da altro PC, 'BEAM.FILE' è cambiato da un PC all'altro. Di conseguenza si deve aggiornare nome file che si andrà a generare.
local _, sName, _ = EgtSplitPath( BEAM.FILE)
EgtSetInfo( EgtGetLastMachGroup(), 'NcName', sName .. '.cnc')
-- Passo in modalità lavora -- Passo in modalità lavora
EgtSetCurrMachGroup( EgtGetLastMachGroup()) EgtSetCurrMachGroup( EgtGetLastMachGroup())
-- Se necessario eseguo aggiornamento con setup corrente e ricalcolo delle lavorazioni -- Se necessario eseguo aggiornamento con setup corrente e ricalcolo delle lavorazioni
-1
View File
@@ -45,7 +45,6 @@ REM Compilazione 32 e 64 bit
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessText.lua -s LuaLibs\ProcessText.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessText.lua -s LuaLibs\ProcessText.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessTyroleanDovetail.lua -s LuaLibs\ProcessTyroleanDovetail.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessTyroleanDovetail.lua -s LuaLibs\ProcessTyroleanDovetail.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessVariant.lua -s LuaLibs\ProcessVariant.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessVariant.lua -s LuaLibs\ProcessVariant.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProbing.lua -s LuaLibs\ProcessProbing.lua
\EgtProg\Dll32\luac54 -o bin\BatchProcess.lua -s BatchProcess.lua \EgtProg\Dll32\luac54 -o bin\BatchProcess.lua -s BatchProcess.lua
\EgtProg\Dll32\luac54 -o bin\BatchProcessNew.lua -s BatchProcessNew.lua \EgtProg\Dll32\luac54 -o bin\BatchProcessNew.lua -s BatchProcessNew.lua
\EgtProg\Dll32\luac54 -o bin\GetBeamData.lua -s GetBeamData.lua \EgtProg\Dll32\luac54 -o bin\GetBeamData.lua -s GetBeamData.lua
+105 -328
View File
@@ -108,7 +108,6 @@ _G.package.loaded.ProcessScarfJoint = nil
_G.package.loaded.ProcessSimpleScarf = nil _G.package.loaded.ProcessSimpleScarf = nil
_G.package.loaded.ProcessStepJoint = nil _G.package.loaded.ProcessStepJoint = nil
_G.package.loaded.ProcessStepJointNotch = nil _G.package.loaded.ProcessStepJointNotch = nil
_G.package.loaded.ProcessProbing = nil
_G.package.loaded.ProcessProfFront = nil _G.package.loaded.ProcessProfFront = nil
_G.package.loaded.ProcessProfConcave = nil _G.package.loaded.ProcessProfConcave = nil
_G.package.loaded.ProcessProfConvex = nil _G.package.loaded.ProcessProfConvex = nil
@@ -304,7 +303,7 @@ local function NeedTopologyFeature( Proc)
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT, bCreatePreDrill) local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
local dRawW = b3Raw:getDimY() local dRawW = b3Raw:getDimY()
local dRawH = b3Raw:getDimZ() local dRawH = b3Raw:getDimZ()
-- recupero le feature -- recupero le feature
@@ -363,9 +362,9 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT, bCreatePreD
-- se foro -- se foro
if Drill.Identify( Proc) then if Drill.Identify( Proc) then
-- assegno diametro e facce di ingresso e uscita (dati tabelle sempre per riferimento) -- assegno diametro e facce di ingresso e uscita (dati tabelle sempre per riferimento)
Proc.Diam, Proc.Len, Proc.Fcs, Proc.Fce = Drill.GetData( Proc, b3Raw) Proc.Diam, Proc.Len, Proc.Fcs, Proc.Fce, Proc.vtDrillDir = Drill.GetData( Proc, b3Raw)
-- verifico se devo inserire i prefori -- verifico se devo inserire i prefori
if Drill.IsPredrillNeeded( Proc) and bCreatePreDrill then if Drill.IsPredrillNeeded( Proc) then
local bAddProc, PredrillProc= Drill.AddPredrillFromDrillProc( Proc) local bAddProc, PredrillProc= Drill.AddPredrillFromDrillProc( Proc)
if bAddProc then if bAddProc then
table.insert( vProc, PredrillProc) table.insert( vProc, PredrillProc)
@@ -392,12 +391,11 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT, bCreatePreD
Proc2.Tail = Drill.IsTailFeature( Proc2, b3Raw, dCurrOvmH) Proc2.Tail = Drill.IsTailFeature( Proc2, b3Raw, dCurrOvmH)
Proc2.Fcs = Proc.Fce Proc2.Fcs = Proc.Fce
Proc2.Fce = Proc.Fcs Proc2.Fce = Proc.Fcs
Proc2.vtDrillDir = -Proc.vtDrillDir
Proc2.CutId = Proc.CutId Proc2.CutId = Proc.CutId
Proc2.TaskId = Proc.TaskId Proc2.TaskId = Proc.TaskId
Proc2.AdjId = Proc.AdjId Proc2.AdjId = Proc.AdjId
Proc2.MainId = Proc.MainId Proc2.MainId = Proc.MainId
-- recupero l'elenco delle facce della parte interessate dalla feature
Proc2.AffectedFaces = BL.GetProcessAffectedFaces( Proc2)
table.insert( vProc, Proc2) table.insert( vProc, Proc2)
-- verifico se devo inserire i prefori -- verifico se devo inserire i prefori
if Drill.IsPredrillNeeded( Proc2) then if Drill.IsPredrillNeeded( Proc2) then
@@ -442,8 +440,8 @@ local function CalcHeadTailMachBeforeIntersDrillings( vProc, b3Raw)
local b3TailBox local b3TailBox
for i = 1, #vProc do for i = 1, #vProc do
local Proc = vProc[i] local Proc = vProc[i]
if Proc.Box and not Proc.Box:isEmpty() then if Proc.Box and not Proc.Box:isEmpty() then
if Proc.Fct == 1 and BL.IsFeatureCuttingEntireSection( Proc.Box, b3Raw:getDimY(), b3Raw:getDimZ()) and ( Proc.Head or Proc.Tail) and Proc.Prc ~= 350 then if Proc.Fct == 1 and BL.IsFeatureCuttingEntireSection( Proc.Box, b3Raw:getDimY(), b3Raw:getDimZ()) and ( Proc.Head or Proc.Tail) and Proc.Prc ~= 340 and Proc.Prc ~= 350 then
if Proc.Head and Proc.Box:getCenter():getX() < dHeadX then if Proc.Head and Proc.Box:getCenter():getX() < dHeadX then
dHeadX = Proc.Box:getCenter():getX() dHeadX = Proc.Box:getCenter():getX()
nHeadId = Proc.Id nHeadId = Proc.Id
@@ -467,7 +465,6 @@ end
local function AnalyzeHeadFeatures( b3Solid, vProc, dRawW, dRawH) local function AnalyzeHeadFeatures( b3Solid, vProc, dRawW, dRawH)
local nReplacedFeatureId = nil local nReplacedFeatureId = nil
local bHeadFinishingNeeded = true local bHeadFinishingNeeded = true
local nCuttingFeatureId = nil
for i = 1, #vProc do for i = 1, #vProc do
local Proc = vProc[i] local Proc = vProc[i]
-- controllo se esiste già una feature taglio di testa -- controllo se esiste già una feature taglio di testa
@@ -482,19 +479,15 @@ local function AnalyzeHeadFeatures( b3Solid, vProc, dRawW, dRawH)
if Proc.Head and Proc.Id ~= nReplacedFeatureId and Proc.Prc ~= 340 then if Proc.Head and Proc.Id ~= nReplacedFeatureId and Proc.Prc ~= 340 then
-- controllo se la feature taglia l'intera sezione; in caso positivo la finitura non è necessaria -- controllo se la feature taglia l'intera sezione; in caso positivo la finitura non è necessaria
bHeadFinishingNeeded = not BL.IsFeatureCuttingEntireSection( Proc.Box, dRawW, dRawH) bHeadFinishingNeeded = not BL.IsFeatureCuttingEntireSection( Proc.Box, dRawW, dRawH)
if not bHeadFinishingNeeded and ( ( Proc.Grp == 1 or Proc.Grp == 2) and Proc.Prc == 10) and ( Proc.Flg > 0) then
nCuttingFeatureId = Proc.Id
end
end end
end end
return bHeadFinishingNeeded, nReplacedFeatureId, nCuttingFeatureId return bHeadFinishingNeeded, nReplacedFeatureId
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
local function AnalyzeTailFeatures( b3Solid, vProc, dRawW, dRawH) local function AnalyzeTailFeatures( b3Solid, vProc, dRawW, dRawH)
local nReplacedFeatureId = nil local nReplacedFeatureId = nil
local bTailFinishingNeeded = true local bTailFinishingNeeded = true
local nCuttingFeatureId = nil
for i = 1, #vProc do for i = 1, #vProc do
local Proc = vProc[i] local Proc = vProc[i]
-- controllo se esistè già una feature taglio di coda -- controllo se esistè già una feature taglio di coda
@@ -509,12 +502,9 @@ local function AnalyzeTailFeatures( b3Solid, vProc, dRawW, dRawH)
if Proc.Tail and Proc.Id ~= nReplacedFeatureId and Proc.Prc ~= 350 then if Proc.Tail and Proc.Id ~= nReplacedFeatureId and Proc.Prc ~= 350 then
-- controllo se la feature taglia l'intera sezione; in caso positivo la finitura non è necessaria -- controllo se la feature taglia l'intera sezione; in caso positivo la finitura non è necessaria
bTailFinishingNeeded = not BL.IsFeatureCuttingEntireSection( Proc.Box, dRawW, dRawH) bTailFinishingNeeded = not BL.IsFeatureCuttingEntireSection( Proc.Box, dRawW, dRawH)
if not bTailFinishingNeeded and ( ( Proc.Grp == 1 or Proc.Grp == 2) and Proc.Prc == 10) and ( Proc.Flg > 0) then
nCuttingFeatureId = Proc.Id
end
end end
end end
return bTailFinishingNeeded, nReplacedFeatureId, nCuttingFeatureId return bTailFinishingNeeded, nReplacedFeatureId
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
@@ -576,6 +566,11 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, vBeam, b
-- salvo nota con lunghezza grezzo -- salvo nota con lunghezza grezzo
-- Recupero l'identificativo del gruppo di lavoro corrente -- Recupero l'identificativo del gruppo di lavoro corrente
local nMGrpId = EgtGetCurrMachGroup() local nMGrpId = EgtGetCurrMachGroup()
-- Lunghezza della barra
local dBarLen = EgtGetInfo( nMGrpId, 'BARLEN', 'd')
if not dBarLen then
EgtSetInfo( nMGrpId, 'BARLEN', dRawL)
end
-- Area tavola -- Area tavola
local b3Tab = EgtGetTableArea() local b3Tab = EgtGetTableArea()
@@ -587,18 +582,6 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, vBeam, b
-- Impostazione dell'attrezzaggio di default -- Impostazione dell'attrezzaggio di default
EgtImportSetup() EgtImportSetup()
-- se pretagli di coda sono attivi, aumento di 10mm la lunghezza del grezzo per fare effettivamente tagliare del materiale.
-- Altrimenti le lavorazioni pensano di essere nel vuoto e si muovono in rapido
if BD.PRECUT_TAIL and VerifyBigSectionCut( dRawW, dRawH) then
dRawL = dRawL + 10
end
-- Lunghezza della barra
local dBarLen = EgtGetInfo( nMGrpId, 'BARLEN', 'd')
if not dBarLen then
EgtSetInfo( nMGrpId, 'BARLEN', dRawL)
end
-- Inserimento dei pezzi con il loro grezzo -- Inserimento dei pezzi con il loro grezzo
local Cnt = 0 local Cnt = 0
local Len = dRawL local Len = dRawL
@@ -615,26 +598,6 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, vBeam, b
local b3Part = EgtGetBBoxGlob( Pz or GDB_ID.NULL, GDB_BB.EXACT) local b3Part = EgtGetBBoxGlob( Pz or GDB_ID.NULL, GDB_BB.EXACT)
local b3Solid = vBeam[i].Box local b3Solid = vBeam[i].Box
if b3Part:isEmpty() or b3Solid:isEmpty() then break end if b3Part:isEmpty() or b3Solid:isEmpty() then break end
-- creo o pulisco gruppo geometrie aggiuntive
if not BL.CreateOrEmptyAddGroup( Pz) then
local sOut = 'Error creating Additional Group in Part ' .. tostring( Pz)
return false, sOut
end
-- analizzo le features per valutare l'esistenza di feature head/tail che renderebbero inutili le rispettive finiture o di tagli di testa/coda sostituiti da cui leggere il parametro Q05
local vProc = CollectFeatures( Pz, b3Solid, 0)
local bSFinishingNeeded, nReplacedHeadCutFeatureId, nHeadCuttingFeatureId = AnalyzeHeadFeatures( b3Solid, vProc, dRawW, dRawH)
local bEFinishingNeeded, nReplacedTailCutFeatureId, nTailCuttingFeatureId = AnalyzeTailFeatures( b3Solid, vProc, dRawW, dRawH)
-- Scrivo gli id delle facce di taglio custom: serviranno dopo per calcolare l'elevazione rispetto a queste
if nHeadCuttingFeatureId then
EgtSetInfo( vBeam[i].Id, 'HEADCUTFEATUREID', nHeadCuttingFeatureId)
else
EgtRemoveInfo( vBeam[i].Id, 'HEADCUTFEATUREID')
end
if nTailCuttingFeatureId then
EgtSetInfo( vBeam[i].Id, 'TAILCUTFEATUREID', nTailCuttingFeatureId)
else
EgtRemoveInfo( vBeam[i].Id, 'TAILCUTFEATUREID')
end
if bBigSectionCut then if bBigSectionCut then
-- lascio in coda solo il materiale necessario; il resto verrà tolto nell'head cut successivo -- lascio in coda solo il materiale necessario; il resto verrà tolto nell'head cut successivo
local lastB3Solid = nil local lastB3Solid = nil
@@ -647,6 +610,9 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, vBeam, b
dOffset = dOvmMid dOffset = dOvmMid
end end
end end
-- analizzo le features per valutare l'esistenza di feature head/tail che renderebbero inutili le rispettive finiture o di tagli di testa/coda sostituiti da cui leggere il parametro Q05
local vProc = CollectFeatures( Pz, b3Solid, 0)
local bSFinishingNeeded, nReplacedHeadCutFeatureId = AnalyzeHeadFeatures( b3Solid, vProc, dRawW, dRawH)
local iSQ05Value = nil local iSQ05Value = nil
if nReplacedHeadCutFeatureId then if nReplacedHeadCutFeatureId then
iSQ05Value = EgtGetInfo( nReplacedHeadCutFeatureId, 'Q05', 'i') iSQ05Value = EgtGetInfo( nReplacedHeadCutFeatureId, 'Q05', 'i')
@@ -656,6 +622,7 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, vBeam, b
else else
DeltaSMin = BD.OVM_BLADE_HBEAM DeltaSMin = BD.OVM_BLADE_HBEAM
end end
local bEFinishingNeeded, nReplacedTailCutFeatureId = AnalyzeTailFeatures( b3Solid, vProc, dRawW, dRawH)
local iEQ05Value = nil local iEQ05Value = nil
if nReplacedTailCutFeatureId then if nReplacedTailCutFeatureId then
iEQ05Value = EgtGetInfo( nReplacedTailCutFeatureId, 'Q05', 'i') iEQ05Value = EgtGetInfo( nReplacedTailCutFeatureId, 'Q05', 'i')
@@ -693,7 +660,11 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, vBeam, b
-- assegno ordine in lavorazione -- assegno ordine in lavorazione
Cnt = Cnt + 1 Cnt = Cnt + 1
EgtSetInfo( nRaw, 'ORD', Cnt) EgtSetInfo( nRaw, 'ORD', Cnt)
-- creo o pulisco gruppo geometrie aggiuntive
if not BL.CreateOrEmptyAddGroup( Pz) then
local sOut = 'Error creating Additional Group in Part ' .. tostring( Pz)
return false, sOut
end
-- aggiungo faccia per taglio iniziale al pezzo -- aggiungo faccia per taglio iniziale al pezzo
BL.AddPartStartFace( Pz, b3Solid) BL.AddPartStartFace( Pz, b3Solid)
-- se sovramateriale di testa, lo notifico -- se sovramateriale di testa, lo notifico
@@ -807,121 +778,7 @@ local function PrintFeatures( vProc, b3Raw)
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
-- mi assicuro che i tagli di testa e coda troncanti (usati per ridurre i percorsi utensile in testa e coda) siano sempre fatti per primi local function OrderFeatures( vProc, b3Raw)
local function ReorderTruncatingCuts( vProc, nPartId)
if not nPartId or #vProc == 0 then return end
local nHeadCuttingFeatureId = EgtGetInfo( nPartId, 'HEADCUTFEATUREID', 'i')
local nTailCuttingFeatureId = EgtGetInfo( nPartId, 'TAILCUTFEATUREID', 'i')
-- tagli di testa
-- 1: si trovano gli indici del taglio di testa e del rispettivo taglio troncante
local nHeadCutIndex, nHeadCuttingFeatureIndex
for index, value in ipairs( vProc) do
if value.Prc == 340 then
nHeadCutIndex = index
end
if value.Id == nHeadCuttingFeatureId then
nHeadCuttingFeatureIndex = index
end
end
-- 2: se non c'è il taglio di testa, il taglio troncante è il primo. Se c'è il taglio di testa, il taglio troncante lo deve seguire.
if not nHeadCutIndex and nHeadCuttingFeatureIndex then
local HeadCuttingFeature = vProc[ nHeadCuttingFeatureIndex]
table.remove( vProc, nHeadCuttingFeatureIndex)
table.insert( vProc, 1, HeadCuttingFeature)
elseif nHeadCutIndex and nHeadCuttingFeatureIndex then
if abs( nHeadCutIndex - nHeadCuttingFeatureIndex) ~= 1 then
local HeadCut = vProc[ nHeadCutIndex]
local HeadCuttingFeature = vProc[ nHeadCuttingFeatureIndex]
table.remove( vProc, nHeadCutIndex)
-- rimuovere il primo potrebbe aver cambiato l'indice del secondo
if nHeadCutIndex < nHeadCuttingFeatureIndex then
nHeadCuttingFeatureIndex = nHeadCuttingFeatureIndex - 1
end
table.remove( vProc, nHeadCuttingFeatureIndex)
table.insert( vProc, nHeadCutIndex, HeadCut)
table.insert( vProc, nHeadCutIndex + 1, HeadCuttingFeature)
end
end
-- tagli di coda
-- 1: si trovano gli indici del taglio di coda e del rispettivo taglio troncante
local nTailCutIndex, nTailCuttingFeatureIndex
for index, value in ipairs( vProc) do
if value.Prc == 350 then
nTailCutIndex = index
end
if value.Id == nTailCuttingFeatureId then
nTailCuttingFeatureIndex = index
end
end
-- 2: il taglio di coda c'è sempre. Il taglio troncante lo deve seguire.
if nTailCutIndex and nTailCuttingFeatureIndex then
if abs( nTailCutIndex - nTailCuttingFeatureIndex) ~= 1 then
local TailCut = vProc[ nTailCutIndex]
local TailCuttingFeature = vProc[ nTailCuttingFeatureIndex]
table.remove( vProc, nTailCutIndex)
-- rimuovere il primo potrebbe aver cambiato l'indice del secondo
if nTailCutIndex < nTailCuttingFeatureIndex then
nTailCuttingFeatureIndex = nTailCuttingFeatureIndex - 1
end
table.remove( vProc, nTailCuttingFeatureIndex)
table.insert( vProc, nTailCutIndex, TailCut)
table.insert( vProc, nTailCutIndex + 1, TailCuttingFeature)
end
end
return true
end
-------------------------------------------------------------------------------------------------------------
-- mi assicuro che vengano rispettate le dipendenze tra le feature
local function ReorderFeatureWithDependency( vProc)
-- si riordina considerando le dipendenze con alcuni limiti:
-- * se ci sono dipendenze incrociate il risultato finale non è controllato ( A->B e B->C e C->A)
-- * se ci sono dipendenze opposte va in errore ( A->B e B->A)
-- si sistemano le feature da lavorare prima
local i = 1
local nMaxIter = ( #vProc * #vProc) + 1
local nIter = 0
while i <= #vProc do
nIter = nIter + 1
if nIter > nMaxIter then
error( "UNEXPECTED ERROR ON DEPENDENCY")
end
-- si controllano solo i fori
if Drill.Identify( vProc[i]) and vProc[i].Dependency and vProc[i].Dependency.ExecBefore and vProc[i].Dependency.ExecBefore.Id then
local nRefId = vProc[i].Dependency.ExecBefore.Id
local nRefIndex
for j = 1, #vProc do
if i ~= j and vProc[j].Id == nRefId then
nRefIndex = j
break
end
end
-- se il processo deve stare prima, ma ora è dopo
if nRefIndex and nRefIndex < i then
table.insert( vProc, nRefIndex, table.remove( vProc, i))
i = max( nRefIndex - 1, 1)
end
end
i = i + 1
end
end
-------------------------------------------------------------------------------------------------------------
local function OrderFeatures( vProc, b3Raw, nPartId)
local dDrillPenalty = EgtIf( BD.PRESS_ROLLER, 200, 100) local dDrillPenalty = EgtIf( BD.PRESS_ROLLER, 200, 100)
local dSmallDrillRange = EgtIf( b3Raw:getDimX() < BD.LEN_SHORT_PART, BD.DRILL_RANGE_SP or 200, BD.DRILL_RANGE or 600) local dSmallDrillRange = EgtIf( b3Raw:getDimX() < BD.LEN_SHORT_PART, BD.DRILL_RANGE_SP or 200, BD.DRILL_RANGE or 600)
@@ -1042,12 +899,12 @@ local function OrderFeatures( vProc, b3Raw, nPartId)
if abs( B2.Box:getDimX() - b3Raw:getDimX()) < 0.2 * b3Raw:getDimX() then if abs( B2.Box:getDimX() - b3Raw:getDimX()) < 0.2 * b3Raw:getDimX() then
return not ( B1.Tail or B2.Box:getMin():getX() + 20 > B1.Box:getCenter():getX()) return not ( B1.Tail or B2.Box:getMin():getX() + 20 > B1.Box:getCenter():getX())
end end
-- se primo è foro e l'altro no, lo penalizzo (a patto che il foro non attraversi nessuna feature) -- se primo è foro e l'altro no, lo penalizzo
if Drill.Identify(B1) and not B1.Dependency and not Drill.Identify(B2) then if Drill.Identify(B1) and not Drill.Identify(B2) then
return ( B1.Box:getCenter():getX() > B2.Box:getMax():getX() + dDrillPenalty) return ( B1.Box:getCenter():getX() > B2.Box:getMax():getX() + dDrillPenalty)
end end
-- se primo è altro e secondo è foro, lo premio (a patto che il foro non attraversi nessuna feature) -- se primo è altro e secondo è foro, lo premio
if not Drill.Identify(B1) and not B2.Dependency and Drill.Identify(B2) then if not Drill.Identify(B1) and Drill.Identify(B2) then
return ( B1.Box:getMax():getX() + dDrillPenalty > B2.Box:getCenter():getX()) return ( B1.Box:getMax():getX() + dDrillPenalty > B2.Box:getCenter():getX())
end end
-- se prima è mortasa coda di rondine sul fianco e secondo taglio longitudinale, la coda di rondine va sempre prima -- se prima è mortasa coda di rondine sul fianco e secondo taglio longitudinale, la coda di rondine va sempre prima
@@ -1240,11 +1097,6 @@ local function OrderFeatures( vProc, b3Raw, nPartId)
end end
end end
end end
ReorderTruncatingCuts( vProc, nPartId)
-- si riverificano feature con dipendenze
ReorderFeatureWithDependency( vProc)
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
@@ -1268,7 +1120,7 @@ local function ClassifyFeatures( vProc, b3Raw, Stats)
end end
-- se senza geometria (già disabilitato) -- se senza geometria (già disabilitato)
if Proc.Flg == 0 and not Proc.Double then if Proc.Flg == 0 and not Proc.Double and not Proc.bGrouped then
bOk = false bOk = false
-- se intestatura -- se intestatura
elseif Hcut.Identify( Proc) then elseif Hcut.Identify( Proc) then
@@ -1385,7 +1237,7 @@ local function ClassifyFeatures( vProc, b3Raw, Stats)
Proc.Flg = 0 Proc.Flg = 0
Proc.Down = true Proc.Down = true
bAllOk = false bAllOk = false
table.insert( Stats, {Err = 1, Msg='Error : impossible to machine by orientation', CutId=Proc.CutId, TaskId=Proc.TaskId, ProcId = Proc.Id}) table.insert( Stats, {Err = 1, Msg='Error : impossible to machine by orientation', CutId=Proc.CutId, TaskId=Proc.TaskId})
-- gestione feature di coda da lavorare ribaltata -- gestione feature di coda da lavorare ribaltata
elseif Proc.Tail and bDown then elseif Proc.Tail and bDown then
Proc.Down = true Proc.Down = true
@@ -1406,12 +1258,12 @@ local function ClassifyFeatures( vProc, b3Raw, Stats)
elseif Proc.Flg == 0 then elseif Proc.Flg == 0 then
bAllOk = false bAllOk = false
Proc.ErrMsg = 'Error : out of the part' Proc.ErrMsg = 'Error : out of the part'
table.insert( Stats, {Err = 1, Msg=Proc.ErrMsg, CutId=Proc.CutId, TaskId=Proc.TaskId, ProcId = Proc.Id}) table.insert( Stats, {Err = 1, Msg=Proc.ErrMsg, CutId=Proc.CutId, TaskId=Proc.TaskId})
else else
Proc.Flg = 0 Proc.Flg = 0
bAllOk = false bAllOk = false
if not Proc.ErrMsg then Proc.ErrMsg = 'Error : impossible to machine' end if not Proc.ErrMsg then Proc.ErrMsg = 'Error : impossible to machine' end
table.insert( Stats, {Err = 1, Msg=Proc.ErrMsg, CutId=Proc.CutId, TaskId=Proc.TaskId, ProcId = Proc.Id}) table.insert( Stats, {Err = 1, Msg=Proc.ErrMsg, CutId=Proc.CutId, TaskId=Proc.TaskId})
end end
end end
-- se necessario ribaltamento, assegno intestatura alla fase ribaltata -- se necessario ribaltamento, assegno intestatura alla fase ribaltata
@@ -1501,7 +1353,8 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
-- se foratura ( 3/4-040-X) -- se foratura ( 3/4-040-X)
elseif Drill.Identify( Proc) then elseif Drill.Identify( Proc) then
-- esecuzione foratura -- esecuzione foratura
bOk, sErr = Drill.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) local bUseMultiDrill = BD.USE_MULTI_DRILL
bOk, sErr = Drill.Make( Proc, nPhase, nRawId, nPartId, bUseMultiDrill)
-- se giunzione francese ( 1/2-035-X) -- se giunzione francese ( 1/2-035-X)
elseif FrenchRidgeLap.Identify( Proc) then elseif FrenchRidgeLap.Identify( Proc) then
-- esecuzione giunzione francese -- esecuzione giunzione francese
@@ -1973,7 +1826,7 @@ local function VerifyDrillMirrored( Proc, vProc, b3Raw)
sDrilling, sType, dMaxDepth = ML.FindDrilling( dDiam, 0, true, false, true) sDrilling, sType, dMaxDepth = ML.FindDrilling( dDiam, 0, true, false, true)
dMachiningDepth = dMaxDepth or dMachiningDepth dMachiningDepth = dMaxDepth or dMachiningDepth
end end
if not sDrilling or not EgtMdbSetCurrMachining( sDrilling) then if not sDrilling or ( sType ~= 'Drill' and sType ~= 'Pocket') or not EgtMdbSetCurrMachining( sDrilling) then
return return
end end
local dDrillingStep = EgtMdbGetCurrMachiningParam( MCH_MP.STEP) local dDrillingStep = EgtMdbGetCurrMachiningParam( MCH_MP.STEP)
@@ -1991,16 +1844,11 @@ local function VerifyDrillMirrored( Proc, vProc, b3Raw)
end end
local dToolDoubleDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM, 'd') local dToolDoubleDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM, 'd')
local dToolDoubleMaxDepth = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) local dToolDoubleMaxDepth = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
if ( sType == 'Pocket_AT' or sType == 'Pocket') then
dToolDoubleMaxDepth = EgtTdbGetCurrToolMaxDepth()
end
dMachiningDepth = min( dMachiningDepth, dToolDoubleMaxDepth) dMachiningDepth = min( dMachiningDepth, dToolDoubleMaxDepth)
-- recupero la lunghezza della parte inclinata della punta -- recupero la lunghezza della parte inclinata della punta
local dToolDoubleTipLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) - EgtTdbGetCurrToolParam( MCH_TP.LEN) local dToolDoubleTipLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) - EgtTdbGetCurrToolParam( MCH_TP.LEN)
-- se foratura splittata, verifico che la distanza minima tra le due punte sia rispettata -- se foratura splittata, verifico che la distanza minima tra le due punte sia rispettata
local dTipDistance = 2 * dDrillingStep - dToolTipLength - dToolDoubleTipLength if abs( Proc.Flg) == 2 and not ( ( ( 2 * dDrillingStep - dToolTipLength - dToolDoubleTipLength) - MIRROR_DRILLINGS_MIN_DISTANCE) > 10 * GEO.EPS_SMALL) then
if abs( Proc.Flg) == 2 and not ( ( dTipDistance - MIRROR_DRILLINGS_MIN_DISTANCE) > 10 * GEO.EPS_SMALL) then
EgtOutLog( 'Double drilling skipped, tip distance too small ( ' .. dTipDistance .. ' mm) ')
return return
end end
-- verifico se in doppio -- verifico se in doppio
@@ -2012,16 +1860,10 @@ local function VerifyDrillMirrored( Proc, vProc, b3Raw)
( BD.DOWN_HEAD and AreOppositeVectorApprox( vtExtr, Y_AX())) then ( BD.DOWN_HEAD and AreOppositeVectorApprox( vtExtr, Y_AX())) then
Proc.Double = 2 Proc.Double = 2
Proc.MachDepthDouble = dMachiningDepth Proc.MachDepthDouble = dMachiningDepth
Proc.MirrorId = ProcToDisable.Id
Proc.MirrorCutId = ProcToDisable.CutId
Proc.MirrorTaskId = ProcToDisable.TaskId
DisableOtherDrilling( ProcToDisable, vProc) DisableOtherDrilling( ProcToDisable, vProc)
elseif BD.DOWN_HEAD and AreSameVectorApprox( vtExtr, Z_AX()) then elseif BD.DOWN_HEAD and AreSameVectorApprox( vtExtr, Z_AX()) then
Proc.Double = 3 Proc.Double = 3
Proc.MachDepthDouble = dMachiningDepth Proc.MachDepthDouble = dMachiningDepth
Proc.MirrorId = ProcToDisable.Id
Proc.MirrorCutId = ProcToDisable.CutId
Proc.MirrorTaskId = ProcToDisable.TaskId
DisableOtherDrilling( ProcToDisable, vProc) DisableOtherDrilling( ProcToDisable, vProc)
end end
end end
@@ -2089,18 +1931,14 @@ local function SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeInt
if vDistHead and #vDistHead > 0 then if vDistHead and #vDistHead > 0 then
-- verifico che il foro sia di testa -- verifico che il foro sia di testa
if ( bOpen or ( not bOpen and vtExtr:getX() > 0 and vProc[i].Fcs ~= 0) or ( not bOpen and vtExtr:getX() < 0 and vProc[i].Fce ~= 0)) then if ( bOpen or ( not bOpen and vtExtr:getX() > 0 and vProc[i].Fcs ~= 0) or ( not bOpen and vtExtr:getX() < 0 and vProc[i].Fce ~= 0)) then
if vProc[i].Dependency and vProc[i].Dependency.ExecAfter and vProc[i].Dependency.ExecAfter.Id == vMachineBeforeIntersectingDrillings.Head.Id then vProc[i].MachineAfterHeadCutId = vMachineBeforeIntersectingDrillings.Head.Id
vProc[i].MachineAfterHeadCutId = vMachineBeforeIntersectingDrillings.Head.Id
end
vProc[i].Head = true vProc[i].Head = true
end end
-- se esiste intersezione tra il foro e la feature di coda -- se esiste intersezione tra il foro e la feature di coda
elseif vDistTail and #vDistTail > 0 then elseif vDistTail and #vDistTail > 0 then
-- verifico che il foro sia di coda -- verifico che il foro sia di coda
if ( bOpen or ( not bOpen and vtExtr:getX() < 0 and vProc[i].Fcs ~= 0) or ( not bOpen and vtExtr:getX() > 0 and vProc[i].Fce ~= 0)) then if ( bOpen or ( not bOpen and vtExtr:getX() < 0 and vProc[i].Fcs ~= 0) or ( not bOpen and vtExtr:getX() > 0 and vProc[i].Fce ~= 0)) then
if vProc[i].Dependency and vProc[i].Dependency.ExecAfter and vProc[i].Dependency.ExecAfter.Id == vMachineBeforeIntersectingDrillings.Tail.Id then vProc[i].MachineAfterTailCutId = vMachineBeforeIntersectingDrillings.Tail.Id
vProc[i].MachineAfterTailCutId = vMachineBeforeIntersectingDrillings.Tail.Id
end
vProc[i].Tail = true vProc[i].Tail = true
end end
end end
@@ -2108,7 +1946,6 @@ local function SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeInt
end end
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
local function AreDrillingsMirrored( Proc, ProcMirror, b3Raw) local function AreDrillingsMirrored( Proc, ProcMirror, b3Raw)
if Proc.Id == ProcMirror.Id then return false end if Proc.Id == ProcMirror.Id then return false end
@@ -2174,101 +2011,59 @@ local function AreDrillingsMirrored( Proc, ProcMirror, b3Raw)
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
function GetFeatureInfoAndDependency( vProc, b3Raw, nPartId) function GetFeatureInfoAndDependency( vProc, b3Raw)
if vProc and #vProc > 0 and nPartId then -- ciclo tutte le feature
-- recupero ID per tagli troncanti testa e coda for i = 1, #vProc do
local nHeadCuttingFeatureId = EgtGetInfo( nPartId, 'HEADCUTFEATUREID', 'i') or 0 local Proc = vProc[i]
local nTailCuttingFeatureId = EgtGetInfo( nPartId, 'TAILCUTFEATUREID', 'i') or 0 -- calcolo topologia della feature
-- ciclo tutte le feature if NeedTopologyFeature( Proc) then
for i = 1, #vProc do Topology.Classify( Proc, b3Raw)
local Proc = vProc[i] -- se non richiesto, setto 'SPECIAL'
-- calcolo topologia della feature else
if NeedTopologyFeature( Proc) then Proc.Topology = 'SPECIAL'
Topology.Classify( Proc, b3Raw) Proc.TopologyLongName = Proc.Topology
-- se non richiesto, setto 'SPECIAL' end
else -- controllo la feature con tutte le altre per recuperare le dipendenze
Proc.Topology = 'SPECIAL' for j = 1, #vProc do
Proc.TopologyLongName = Proc.Topology local ProcB = vProc[j]
end -- se non è la stessa feature
-- controllo la feature con tutte le altre per recuperare le dipendenze if Proc.Id ~= ProcB.Id then
for j = 1, #vProc do -- verifico se feature tipo LapJoint è attraversata da almeno un foro
-- non si controlla feature con sé stessa if ( Proc.Topology == 'Pocket' or Proc.Topology == 'Tunnel' or Proc.Topology == 'Groove' or Mortise.Identify( Proc)) and Drill.Identify( ProcB) and Overlaps( Proc.Box, ProcB.Box) then
if i ~= j then Proc.PassedByHole = true
local ProcB = vProc[j] ProcB.Dependency = {}
-- verifico se feature tipo LapJoint è attraversata da almeno un foro ProcB.Dependency.ExecBefore = Proc
if ( Proc.Topology == 'Pocket' or Proc.Topology == 'Tunnel' or Proc.Topology == 'Groove' or Mortise.Identify( Proc)) and Drill.Identify( ProcB) and Overlaps( Proc.Box, ProcB.Box) then end
-- se foro in coda non setto la dipendenza -- verifico se feature tipo LapJoint è attraversata da almeno una mortasa a coda di rondine
if not ProcB.AffectedFaces.Left then if ( Proc.Topology == 'Pocket' or Proc.Topology == 'Tunnel' or Proc.Topology == 'Groove') and DtMortise.SideIdentify( ProcB) and Overlaps( Proc.Box, ProcB.Box) then
Proc.PassedByHole = true Proc.PassedByDtMortise = true
ProcB.Dependency = {} end
ProcB.Dependency.ExecBefore = Proc -- se tenone è attraversato da foro allora il foro deve essere fatto prima
if Tenon.Identify( Proc) and Drill.Identify( ProcB) and Overlaps( Proc.Box, ProcB.Box) then
Proc.PassedByHole = true
end
-- verifiche per specchiature
if BD.DOWN_HEAD or BD.TWO_EQUAL_HEADS then
-- forature
if BD.DOUBLE_HEAD_DRILLING and Drill.Identify( Proc) and Drill.Identify( ProcB) and not Proc.Mirror then
if AreDrillingsMirrored( Proc, ProcB, b3Raw) then
Proc.Mirror = ProcB
end end
end end
-- verifico se feature tipo LapJoint è attraversata da almeno una mortasa a coda di rondine end
if ( Proc.Topology == 'Pocket' or Proc.Topology == 'Tunnel' or Proc.Topology == 'Groove') -- raggruppamento fori appartenenti allo stesso spezzone di trave
and DtMortise.SideIdentify( ProcB) and Overlaps( Proc.Box, ProcB.Box) and DtMortise.IsDeeper( ProcB, b3Raw) then if Drill.Identify( Proc) and Proc.Flg ~= 0 and Drill.Identify( ProcB) and ProcB.Flg ~= 0 then
Proc.PassedByDtMortise = true local dDrillRange = EgtIf( b3Raw:getDimX() < BD.LEN_SHORT_PART, BD.DRILL_RANGE_SP or BD.LONGCUT_ENDLEN/3, BD.DRILL_RANGE or BD.LONGCUT_ENDLEN)
end local nXSegmentProc = ceil( ( Proc.Box:getCenter():getX() - b3Raw:getMin():getX()) / dDrillRange)
-- se tenone è attraversato da foro allora il foro deve essere fatto prima local nXSegmentProcB = ceil( ( ProcB.Box:getCenter():getX() - b3Raw:getMin():getX()) / dDrillRange)
if Tenon.Identify( Proc) and Drill.Identify( ProcB) and Overlaps( Proc.Box, ProcB.Box) then -- se fanno parte dello stesso spezzone, scrivo info geometria nella prima e disattivo la seconda
Proc.PassedByHole = true if nXSegmentProc == nXSegmentProcB and Proc.Diam == ProcB.Diam and AreSameVectorApprox( Proc.vtDrillDir, ProcB.vtDrillDir) then
end if not Proc.OtherGeometries then
-- se taglio attraversato da foro, si definisce precedenza in base ad angolo Proc.OtherGeometries = {}
if Drill.Identify( Proc) and ( Cut.Identify( ProcB) or ProcB.Prc == 340 or ProcB.Proc == 350) and Overlaps( Proc.Box, ProcB.Box) then
-- recupero e verifico l'entità foro
local DrillAuxId = ( EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0) + Proc.Id
local vtDrillExtr = EgtCurveExtrusion( DrillAuxId, GDB_RT.GLOB)
local bOpen = ( Proc.Fce ~= 0) and ( Proc.Fce ~= Proc.Fcs)
local ptCut, vtCutN = EgtSurfTmFacetCenter( ProcB.Id, 0, GDB_ID.ROOT)
local dMaxAngleDrillOnCut = BD.MAX_ANGLE_DRILL_CUT or 10
if ( GetAngle( vtDrillExtr, vtCutN) > dMaxAngleDrillOnCut) and not ( ProcB.Prc == 340 or ProcB.Proc == 350) then
if bOpen and GetAngle( -vtDrillExtr, vtCutN) < dMaxAngleDrillOnCut then
ProcB.Dependency = {}
ProcB.Dependency.ExecBefore = Proc
Proc.Dependency = {}
Proc.Dependency.ExecAfter = ProcB
else
Proc.Dependency = {}
Proc.Dependency.ExecBefore = ProcB
ProcB.Dependency = {}
ProcB.Dependency.ExecAfter = Proc
end
else
ProcB.Dependency = {}
ProcB.Dependency.ExecBefore = Proc
Proc.Dependency = {}
Proc.Dependency.ExecAfter = ProcB
end end
end table.insert( Proc.OtherGeometries, ProcB)
-- verifiche per specchiature ProcB.Flg = 0
if BD.DOWN_HEAD or BD.TWO_EQUAL_HEADS then ProcB.bGrouped = true
-- forature
if BD.DOUBLE_HEAD_DRILLING and Drill.Identify( Proc) and Drill.Identify( ProcB) and not Proc.Mirror then
if AreDrillingsMirrored( Proc, ProcB, b3Raw) then
Proc.Mirror = ProcB
end
end
end
-- verifiche per tagli troncanti testa e coda: devono sempre essere subito dopo il taglio di testa e il taglio di coda, rispettivamente
if Proc.Prc == 340 and ProcB == nHeadCuttingFeatureId then
Proc.Dependency = {}
Proc.Dependency.ExecBefore = ProcB
elseif Proc == nHeadCuttingFeatureId and ProcB.Prc == 340 then
ProcB.Dependency = {}
ProcB.Dependency.ExecBefore = Proc
elseif Proc.Prc == 350 and ProcB == nTailCuttingFeatureId then
Proc.Dependency = {}
Proc.Dependency.ExecBefore = ProcB
elseif Proc == nTailCuttingFeatureId and ProcB.Prc == 350 then
ProcB.Dependency = {}
ProcB.Dependency.ExecBefore = Proc
end
-- se una feature deve essere lavorata prima dei tagli troncanti, si setta che non esiste taglio troncante
if Proc.Dependency and Proc.Dependency.ExecBefore and Proc.Dependency.ExecBefore.Id == nHeadCuttingFeatureId then
-- EgtRemoveInfo( nPartId, 'HEADCUTFEATUREID')
end
if Proc.Dependency and Proc.Dependency.ExecBefore and Proc.Dependency.ExecBefore.Id == nTailCuttingFeatureId then
-- EgtRemoveInfo( nPartId, 'TAILCUTFEATUREID')
end end
end end
end end
@@ -2283,13 +2078,13 @@ function BeamExec.ProcessFeatures()
end end
-- costanti per doppio -- costanti per doppio
MIRROR_DRILLINGS_MIN_DISTANCE = 40 MIRROR_DRILLINGS_MIN_DISTANCE = 40
MIRROR_POCKETS_MIN_DISTANCE = EgtIf( BD.DOWN_HEAD, 35, 50) MIRROR_POCKETS_MIN_DISTANCE = 50
-- verifica se possibile rotazione di 90 gradi -- verifica se possibile rotazione di 90 gradi
BD.ROT90 = BD.ROT90 and Verify90DegRotation( EgtGetFirstRawPart()) BD.ROT90 = BD.ROT90 and Verify90DegRotation( EgtGetFirstRawPart())
-- ciclo sui pezzi -- ciclo sui pezzi
local nTotErr = 0 local nTotErr = 0
local Stats = {} local Stats = {}
local nOrd = 1 local nOrd = 1
local nRawId = EgtGetFirstRawPart() local nRawId = EgtGetFirstRawPart()
while nRawId do while nRawId do
-- verifico che il grezzo contenga pezzi oppure sia abbastanza lungo da essere scaricato coi carrelli -- verifico che il grezzo contenga pezzi oppure sia abbastanza lungo da essere scaricato coi carrelli
@@ -2311,9 +2106,9 @@ function BeamExec.ProcessFeatures()
local dCurrOvmH = EgtGetInfo( nRawId, 'HOVM', 'd') or 0 local dCurrOvmH = EgtGetInfo( nRawId, 'HOVM', 'd') or 0
local dCurrOvmT = EgtGetInfo( nRawId, 'TOVM', 'd') or 0 local dCurrOvmT = EgtGetInfo( nRawId, 'TOVM', 'd') or 0
-- recupero le feature di lavorazione della trave -- recupero le feature di lavorazione della trave
local vProc = CollectFeatures( nPartId, b3Raw, dCurrOvmH, dCurrOvmT, true) local vProc = CollectFeatures( nPartId, b3Raw, dCurrOvmH, dCurrOvmT)
-- recupero informazioni ausiliarie feature e dipendenze tra feature stesse -- recupero informazioni ausiliarie feature e dipendenze tra feature stesse
GetFeatureInfoAndDependency( vProc, b3Raw, nPartId) GetFeatureInfoAndDependency( vProc, b3Raw)
-- verifica presenza forature influenzate da lavorazioni di testa o coda -- verifica presenza forature influenzate da lavorazioni di testa o coda
if BD.IMPROVE_HEAD_TAIL_DRILLINGS then if BD.IMPROVE_HEAD_TAIL_DRILLINGS then
@@ -2325,7 +2120,7 @@ function BeamExec.ProcessFeatures()
SetMirroredFeatures( vProc, b3Raw) SetMirroredFeatures( vProc, b3Raw)
end end
-- le ordino lungo X -- le ordino lungo X
OrderFeatures( vProc, b3Raw, nPartId) OrderFeatures( vProc, b3Raw)
-- le classifico -- le classifico
local bAllOk, bSomeDown, bSomeSide, bSplitRot = ClassifyFeatures( vProc, b3Raw, Stats) local bAllOk, bSomeDown, bSomeSide, bSplitRot = ClassifyFeatures( vProc, b3Raw, Stats)
if not bAllOk then if not bAllOk then
@@ -2389,19 +2184,13 @@ function BeamExec.ProcessFeatures()
end end
if not bOk then if not bOk then
nTotErr = nTotErr + 1 nTotErr = nTotErr + 1
table.insert( Stats, {Err=1, Msg=sMsg, Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId, ProcId = Proc.Id, PartId = nPartId}) table.insert( Stats, {Err=1, Msg=sMsg, Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId})
if Proc.Double == 2 or Proc.Double == 3 then
table.insert( Stats, {Err=1, Msg=sMsg, Rot=-2, CutId=Proc.MirrorCutId, TaskId=Proc.MirrorTaskId, ProcId = Proc.MirrorId, PartId = nPartId})
end
elseif sMsg and #sMsg > 0 then elseif sMsg and #sMsg > 0 then
table.insert( Stats, {Err=-1, Msg=sMsg, Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId, ProcId = Proc.Id, PartId = nPartId}) table.insert( Stats, {Err=-1, Msg=sMsg, Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId})
if Proc.Double == 2 or Proc.Double == 3 then
table.insert( Stats, {Err=-1, Msg=sMsg, Rot=-2, CutId=Proc.MirrorCutId, TaskId=Proc.MirrorTaskId, ProcId = Proc.MirrorId, PartId = nPartId})
end
else else
table.insert( Stats, {Err=0, Msg='', Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId, ProcId = Proc.Id, PartId = nPartId}) table.insert( Stats, {Err=0, Msg='', Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId})
if Proc.Double == 2 or Proc.Double == 3 then if Proc.Double == 2 or Proc.Double == 3 then
table.insert( Stats, {Err=0, Msg='', Rot=-2, CutId=Proc.MirrorCutId, TaskId=Proc.MirrorTaskId, ProcId = Proc.MirrorId, PartId = nPartId}) table.insert( Stats, {Err=0, Msg='', Rot=-2, CutId=Proc.MirrorCutId, TaskId=Proc.MirrorTaskId})
end end
end end
-- se è taglio di separazione, verifico se ha già aggiunto una nuova fase oppure se è da creare -- se è taglio di separazione, verifico se ha già aggiunto una nuova fase oppure se è da creare
@@ -2485,19 +2274,13 @@ function BeamExec.ProcessFeatures()
end end
if not bOk then if not bOk then
nTotErr = nTotErr + 1 nTotErr = nTotErr + 1
table.insert( Stats, {Err=1, Msg=sMsg, Rot=-1, CutId=Proc.CutId, TaskId=Proc.TaskId, ProcId = Proc.Id, PartId = nPartId}) table.insert( Stats, {Err=1, Msg=sMsg, Rot=-1, CutId=Proc.CutId, TaskId=Proc.TaskId})
if Proc.Double == 2 or Proc.Double == 3 then
table.insert( Stats, {Err=1, Msg=sMsg, Rot=-1, CutId=Proc.MirrorCutId, TaskId=Proc.MirrorTaskId, ProcId = Proc.MirrorId, PartId = nPartId})
end
elseif sMsg and #sMsg > 0 then elseif sMsg and #sMsg > 0 then
table.insert( Stats, {Err=-1, Msg=sMsg, Rot=-1, CutId=Proc.CutId, TaskId=Proc.TaskId, ProcId = Proc.Id, PartId = nPartId}) table.insert( Stats, {Err=-1, Msg=sMsg, Rot=-1, CutId=Proc.CutId, TaskId=Proc.TaskId})
if Proc.Double == 2 or Proc.Double == 3 then
table.insert( Stats, {Err=-1, Msg=sMsg, Rot=-1, CutId=Proc.MirrorCutId, TaskId=Proc.MirrorTaskId, ProcId = Proc.MirrorId, PartId = nPartId})
end
else else
table.insert( Stats, {Err=0, Msg='', Rot=-1, CutId=Proc.CutId, TaskId=Proc.TaskId, ProcId = Proc.Id, PartId = nPartId}) table.insert( Stats, {Err=0, Msg='', Rot=-1, CutId=Proc.CutId, TaskId=Proc.TaskId})
if Proc.Double == 2 or Proc.Double == 3 then if Proc.Double == 2 or Proc.Double == 3 then
table.insert( Stats, {Err=0, Msg='', Rot=-1, CutId=Proc.MirrorCutId, TaskId=Proc.MirrorTaskId, ProcId = Proc.MirrorId, PartId = nPartId}) table.insert( Stats, {Err=0, Msg='', Rot=-1, CutId=Proc.MirrorCutId, TaskId=Proc.MirrorTaskId})
end end
end end
if bOk then nSideMchOk = nSideMchOk + 1 end if bOk then nSideMchOk = nSideMchOk + 1 end
@@ -2569,19 +2352,13 @@ function BeamExec.ProcessFeatures()
end end
if not bOk then if not bOk then
nTotErr = nTotErr + 1 nTotErr = nTotErr + 1
table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId, ProcId = Proc.Id, PartId = nPartId}) table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
if Proc.Double == 2 or Proc.Double == 3 then
table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=Proc.MirrorCutId, TaskId=Proc.MirrorTaskId, ProcId = Proc.MirrorId, PartId = nPartId})
end
elseif sMsg and #sMsg > 0 then elseif sMsg and #sMsg > 0 then
table.insert( Stats, {Err=-1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId, ProcId = Proc.Id, PartId = nPartId}) table.insert( Stats, {Err=-1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
if Proc.Double == 2 or Proc.Double == 3 then
table.insert( Stats, {Err=-1, Msg=sMsg, Rot=0, CutId=Proc.MirrorCutId, TaskId=Proc.MirrorTaskId, ProcId = Proc.MirrorId, PartId = nPartId})
end
else else
table.insert( Stats, {Err=0, Msg='', Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId, ProcId = Proc.Id, PartId = nPartId}) table.insert( Stats, {Err=0, Msg='', Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
if Proc.Double == 2 or Proc.Double == 3 then if Proc.Double == 2 or Proc.Double == 3 then
table.insert( Stats, {Err=0, Msg='', Rot=0, CutId=Proc.MirrorCutId, TaskId=Proc.MirrorTaskId, ProcId = Proc.MirrorId, PartId = nPartId}) table.insert( Stats, {Err=0, Msg='', Rot=0, CutId=Proc.MirrorCutId, TaskId=Proc.MirrorTaskId})
end end
end end
-- se era taglio di separazione, aggiungo nuova fase -- se era taglio di separazione, aggiungo nuova fase
+13 -164
View File
@@ -551,7 +551,7 @@ function BeamLib.GetFaceWithMostAdj( Proc, nPartId, bCompare3Fc, dCosSideAng)
local nAddGrpId = BeamLib.GetAddGroup( nPartId) local nAddGrpId = BeamLib.GetAddGroup( nPartId)
if not nAddGrpId then if not nAddGrpId then
EgtOutLog( 'Error : missing AddGroup') EgtOutLog( 'Error : missing AddGroup')
return 0, 0, 0, 0 return 0, 0, 0
end end
-- verifico eventuale intersezione tra la faccia i-1 esima e la proiezione dell'altra sulla stessa -- verifico eventuale intersezione tra la faccia i-1 esima e la proiezione dell'altra sulla stessa
local nShadowFacetId = EgtCopySurfTmFacet( nSurfId, j - 1, nAddGrpId) local nShadowFacetId = EgtCopySurfTmFacet( nSurfId, j - 1, nAddGrpId)
@@ -642,7 +642,7 @@ function BeamLib.GetFaceWithMostAdj( Proc, nPartId, bCompare3Fc, dCosSideAng)
-- premio quella che non è sottosquadra e che ha la X minore -- premio quella che non è sottosquadra e che ha la X minore
local bDiffSmall = true local bDiffSmall = true
for i = 1, #dtElev do for i = 1, #dtElev do
if ( dtElev[i] > dMinElev + 5 or dtElev[i] > 80) and dMinElev < 0.85 * dtElev[i] then if dtElev[i] > dMinElev + 5 or dtElev[i] > 80 then
bDiffSmall = false bDiffSmall = false
end end
end end
@@ -698,19 +698,17 @@ function BeamLib.GetFaceHvRefDim( nSurfId, nFacet, b3Raw)
local b3HV = EgtSurfTmGetFacetBBoxRef( nSurfId, nFacet, GDB_BB.STANDARD, frHV) local b3HV = EgtSurfTmGetFacetBBoxRef( nSurfId, nFacet, GDB_BB.STANDARD, frHV)
local dDimH = b3HV:getDimX() local dDimH = b3HV:getDimX()
local dDimV = b3HV:getDimY() local dDimV = b3HV:getDimY()
-- Si mantiene rettangolo minimo perchè in alcuni casi andava in collisione. Lascio il calcolo in caso si debba ripristinare.
-- se definito grezzo (o solido), applico eventuali limiti -- se definito grezzo (o solido), applico eventuali limiti
-- if b3Raw then if b3Raw then
-- local dCoeffY = abs( frHV:getVersX():getY()) local dCoeffY = abs( frHV:getVersX():getY())
-- if dCoeffY > GEO.EPS_SMALL then if dCoeffY > GEO.EPS_SMALL then
-- dDimH = min( dDimH, b3Raw:getDimY() / dCoeffY) dDimH = min( dDimH, b3Raw:getDimY() / dCoeffY)
-- end end
-- local dCoeffZ = abs( frHV:getVersY():getZ()) local dCoeffZ = abs( frHV:getVersY():getZ())
-- if dCoeffZ > GEO.EPS_SMALL then if dCoeffZ > GEO.EPS_SMALL then
-- dDimV = min( dDimV, b3Raw:getDimZ() / dCoeffZ) dDimV = min( dDimV, b3Raw:getDimZ() / dCoeffZ)
-- end end
-- end end
-- restituisco i valori calcolati -- restituisco i valori calcolati
return frHV, dDimH, dDimV return frHV, dDimH, dDimV
end end
@@ -883,25 +881,6 @@ function BeamLib.GetBlockedAxis( sMachining, sBlockedAxis, b3Raw, vtTool, vtOut)
return '' return ''
end end
---------------------------------------------------------------------
function BeamLib.GetAuxDir( sMachining, sBlockedAxis, b3Raw, vtTool, vtOut)
-- informazioni sull'utensile della lavorazione
local nToolType, sHead
if EgtMdbSetCurrMachining( sMachining) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
nToolType = EgtTdbGetCurrToolParam( MCH_TP.TYPE)
sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
end
end
-- se presente funzione specifica nella macchina, la richiamo
if BD.GetAuxDir then
return BD.GetAuxDir( sHead, nToolType, sBlockedAxis, b3Raw, vtTool, vtOut)
end
-- niente
return nil
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Trova l'Ind (0 based) della faccia meglio orientata come l'asse vtAx. Restituisce anche vtN e ptC della faccia stessa. La faccia di indice (0 based) fctExclude non viene considerata nella ricerca. -- Trova l'Ind (0 based) della faccia meglio orientata come l'asse vtAx. Restituisce anche vtN e ptC della faccia stessa. La faccia di indice (0 based) fctExclude non viene considerata nella ricerca.
function BeamLib.FindFaceBestOrientedAsAxis( Proc, vtAx, fctExclude) function BeamLib.FindFaceBestOrientedAsAxis( Proc, vtAx, fctExclude)
@@ -920,27 +899,6 @@ function BeamLib.FindFaceBestOrientedAsAxis( Proc, vtAx, fctExclude)
return nFaceIndMax, ptC, vtN return nFaceIndMax, ptC, vtN
end end
---------------------------------------------------------------------
function BeamLib.GetEdgeToMachineFromVector( nSurfId, nFacet, vtOrtho)
local _, EdgesEgt = EgtSurfTmGetFacetOutlineInfo( nSurfId, nFacet, GDB_ID.ROOT)
local nEdgeIndMax = 0
local dMaxComp = - GEO.INFINITO
for i = 1, #EdgesEgt do
local vtN = EdgesEgt[i].Norm
if EdgesEgt[i].Open then
vtN = -vtN
end
local dComp = vtN * vtOrtho
if dComp > dMaxComp then
nEdgeIndMax = i -1
dMaxComp = dComp
end
end
return nEdgeIndMax
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function BeamLib.GetTunnelDimension( Proc, nPartId) function BeamLib.GetTunnelDimension( Proc, nPartId)
-- sono necessarie almeno due facce -- sono necessarie almeno due facce
@@ -1177,31 +1135,6 @@ function BeamLib.Is3EdgesApprox( Proc, nFacet, nAddGrpId)
return bResult return bResult
end end
-------------------------------------------------------------------------------------------------------------
function BeamLib.IsPointOnBoxLimits( ptPoint, b3Solid)
local dTol = 500 * GEO.EPS_SMALL
local dMinX = b3Solid:getMin():getX()
local dMinY = b3Solid:getMin():getY()
local dMinZ = b3Solid:getMin():getZ()
local dMaxX = b3Solid:getMax():getX()
local dMaxY = b3Solid:getMax():getY()
local dMaxZ = b3Solid:getMax():getZ()
-- Check di ogni piano limite
if abs( ptPoint:getX() - dMinX) < dTol then return true, "Left" end
if abs( ptPoint:getX() - dMaxX) < dTol then return true, "Right" end
if abs( ptPoint:getY() - dMinY) < dTol then return true, "Front" end
if abs( ptPoint:getY() - dMaxY) < dTol then return true, "Back" end
if abs( ptPoint:getZ() - dMinZ) < dTol then return true, "Bottom" end
if abs( ptPoint:getZ() - dMaxZ) < dTol then return true, "Top" end
return false
end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
-- restituisce le facce della parte interessate dalla feature Proc -- restituisce le facce della parte interessate dalla feature Proc
function BeamLib.GetProcessAffectedFaces( Proc) function BeamLib.GetProcessAffectedFaces( Proc)
@@ -1235,7 +1168,7 @@ end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
-- restituisce vero se la feature con box b3Proc taglia l'intera sezione della barra, rappresentata dalle sue dimensioni W e H -- restituisce vero se la feature con box b3Proc taglia l'intera sezione della barra, rappresentata dalle sue dimensioni W e H
function BeamLib.IsFeatureCuttingEntireSection( b3Proc, dRawW, dRawH) function BeamLib.IsFeatureCuttingEntireSection( b3Proc, dRawW, dRawH)
return ( b3Proc:getDimY() > ( dRawW - 500 * GEO.EPS_SMALL) and b3Proc:getDimZ() > ( dRawH - 500 * GEO.EPS_SMALL)) return ((abs(b3Proc:getDimY() - dRawW) < 10 * GEO.EPS_SMALL or b3Proc:getDimY() > dRawW) and (abs(b3Proc:getDimZ() - dRawH) < 10 * GEO.EPS_SMALL or b3Proc:getDimZ() > dRawH))
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
@@ -1402,89 +1335,5 @@ function BeamLib.IsCutNeeded( Proc, b3Raw, dOvmHead, dOvmTail)
return true return true
end end
-------------------------------------------------------------------------------------------------------------
function BeamLib.GetToolFromMachining( sMachiningName)
local Tool = {}
if EgtMdbSetCurrMachining( sMachiningName) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
Tool.Name = EgtTdbGetCurrToolParam( MCH_TP.NAME)
Tool.IsCCW = ( EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0)
Tool.Type = EgtTdbGetCurrToolParam( MCH_TP.TYPE)
Tool.Diameter = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or 0
Tool.HeadType = {}
Tool.PreferredSide = {}
if BD.GetSetupInfo then
Tool.HeadType = BD.GetSetupInfo( EgtTdbGetCurrToolParam( MCH_TP.HEAD)).HeadType
Tool.PreferredSide = BD.GetSetupInfo( EgtTdbGetCurrToolParam( MCH_TP.HEAD)).PreferredSide
end
-- lama
if Tool.Type == MCH_TY.SAW_STD or Tool.Type == MCH_TY.SAW_FLAT then
Tool.Thickness = EgtTdbGetCurrToolParam(MCH_TP.THICK) or 0
Tool.MaxDepth = EgtTdbGetCurrToolMaxDepth() or 0
Tool.SideStep = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDESTEP', 'd')
-- sega a catena
elseif Tool.Type == MCH_TY.MORTISE_STD then
Tool.Length = EgtTdbGetCurrToolParam( MCH_TP.LEN) or 0
Tool.MaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or 0
Tool.Width = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or 0
Tool.Thickness = EgtTdbGetCurrToolParam( MCH_TP.THICK) or 0
Tool.CornerRadius = EgtTdbGetCurrToolParam( MCH_TP.CORNRAD) or 0
-- fresa (TODO al momento aggiunte solo le informazioni che servono)
elseif Tool.Type == MCH_TY.MILL_STD or MCH_TY.MILL_NOTIP then
if BD.GetSetupInfo then
Tool.IsOnAggregate = BD.GetSetupInfo( EgtTdbGetCurrToolParam( MCH_TP.HEAD)).bToolOnAggregate
else
Tool.IsOnAggregate = false
end
Tool.StemDiameter = EgtTdbGetCurrToolParam( MCH_TP.STEMDIAM) or 0
Tool.MaxDepth = EgtTdbGetCurrToolMaxDepth() or 0
if Tool.StemDiameter > Tool.Diameter + GEO.EPS_SMALL then
Tool.MaxDepth = Tool.MaxDepth - BD.COLL_SIC
end
-- altri utensili al momento non previsti
else
error( 'Wrong tool type')
end
end
end
return Tool
end
-------------------------------------------------------------------------------------------------------------
--- copia una tabella lua in modo ricorsivo, ossia mantiene indipendenti anche tutte le sottotabelle
--- ATTENZIONE: in caso di modifiche vanno gestiti anche i tipi custom; sarebbe meglio metterla nel LuaLibs
function BeamLib.TableCopyDeep( OriginalTable)
-- controllo se oggetto passato è valido, altrimenti errore. Non deve mai succedere
if not OriginalTable then
error( "TableCopyDeep : can't copy nil object")
end
local CopiedTable = {}
for key, value in pairs( OriginalTable) do
if type( value) == "table" then
if isBBox3d( value) then
CopiedTable[ key] = BBox3d( value)
elseif isColor3d( value) then
CopiedTable[ key] = Color3d( value)
elseif isFrame3d( value) then
CopiedTable[ key] = Frame3d( value)
elseif isPoint3d( value) then
CopiedTable[ key] = Point3d( value)
elseif isQuaternion( value) then
CopiedTable[ key] = Quaternion( value)
elseif isVector3d( value) then
CopiedTable[ key] = Vector3d( value)
else
CopiedTable[ key] = BeamLib.TableCopyDeep( value)
end
else
CopiedTable[ key] = value
end
end
return CopiedTable
end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
return BeamLib return BeamLib
+3 -3
View File
@@ -407,7 +407,7 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl
local dNzLimDwnUp = BL.GetNzLimDownUp( BBoxRawPart) local dNzLimDwnUp = BL.GetNzLimDownUp( BBoxRawPart)
-- se non c'è testa da sotto e normali senza componenti in Y con faccia quasi verticale e trave non alta, uso per offset i limiti dei tagli di testa e coda -- se non c'è testa da sotto e normali senza componenti in Y con faccia quasi verticale e trave non alta, uso per offset i limiti dei tagli di testa e coda
if not BD.TURN and not BD.DOWN_HEAD and abs( vtNPlanes:getY()) < 0.1 and vtNPlanes:getZ() < 0.7071 and ( not vtNBond or abs( vtNBond:getY()) < 0.1) and BBoxRawPart:getDimZ() < BD.MIN_DIM_HBEAM then if not BD.DOWN_HEAD and abs( vtNPlanes:getY()) < 0.1 and vtNPlanes:getZ() < 0.7071 and ( not vtNBond or abs( vtNBond:getY()) < 0.1) and BBoxRawPart:getDimZ() < BD.MIN_DIM_HBEAM then
OffsetO = dOrthoMaxDim or BD.MAX_DIM_HTCUT OffsetO = dOrthoMaxDim or BD.MAX_DIM_HTCUT
end end
@@ -423,7 +423,7 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl
-- se piani non ortogonali, diminuisco la distanza di offset opportunamente -- se piani non ortogonali, diminuisco la distanza di offset opportunamente
local originalOffsetP = OffsetP local originalOffsetP = OffsetP
if not bGetOrtoPlanes then if not bGetOrtoPlanes then
local dCoeff = max( ( vtNPlanes ^ vtNBond):len(), 0.5) local dCoeff = ( vtNPlanes ^ vtNBond):len()
OffsetP = OffsetP * dCoeff OffsetP = OffsetP * dCoeff
OffsetO = OffsetO * dCoeff OffsetO = OffsetO * dCoeff
end end
@@ -566,7 +566,7 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl
end end
end end
return UltimateTable, OffsetP, OffsetO return UltimateTable
end end
---------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------
+1 -1
View File
@@ -30,7 +30,7 @@ local function ApplyPocket( Proc, nSurfId, nFacet, sPocketing, nInd, dMaxElev, v
-- imposto uso faccia -- imposto uso faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT) EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT)
-- imposto note utente -- imposto note utente
local sNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' local sNotes = ''
-- eventuale massima elevazione -- eventuale massima elevazione
if dMaxElev > 0.1 then if dMaxElev > 0.1 then
sNotes = EgtSetValInNotes( sNotes, 'MaxElev', EgtNumToString( dMaxElev, 2)) sNotes = EgtSetValInNotes( sNotes, 'MaxElev', EgtNumToString( dMaxElev, 2))
+18 -113
View File
@@ -46,7 +46,7 @@ local BD = require( 'BeamData')
local ML = require( 'MachiningLib') local ML = require( 'MachiningLib')
--------------------------------------------------------------------- ---------------------------------------------------------------------
function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert, sLeadInOutType, dActualElevation) function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert, bForceTangentLeadInOut)
EgtOutLog( 'FacesBySaw.MakeParallelOne', 3) EgtOutLog( 'FacesBySaw.MakeParallelOne', 3)
-- dati della faccia -- dati della faccia
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT) local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT)
@@ -68,28 +68,16 @@ function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimD
local dLiPerp = dDistX + dCutExtra + dCutSic local dLiPerp = dDistX + dCutExtra + dCutSic
local dLoTang = dLiTang local dLoTang = dLiTang
local dLoPerp = dLiPerp local dLoPerp = dLiPerp
local dLiCompLength = 0
local dLoCompLength = 0
-- lunghezza attacco/uscita tangenti -- lunghezza attacco/uscita tangenti
local dLi2Tang = dSawDiam / 2 + dCutSic local dLi2Tang = dSawDiam / 2 + dCutSic
local dLi2Perp = 0 local dLi2Perp = 0
local dLo2Tang = dLi2Tang local dLo2Tang = dLi2Tang
local dLo2Perp = dLi2Perp local dLo2Perp = dLi2Perp
local dLi2CompLength = 0
local dLo2CompLength = 0
-- scelgo l'attacco più conveniente -- scelgo l'attacco più conveniente
local bLioTang local bLioTang
local Ktp = 1.1 local Ktp = 1.1
if BD.KIOTP then Ktp = BD.KIOTP end if BD.KIOTP then Ktp = BD.KIOTP end
if ( sLeadInOutType == 'PerpendicularOutraw') then if bForceTangentLeadInOut or ( Ktp * dLi2Tang < dLiPerp) then
bLioTang = false
dLiCompLength = dActualElevation + EgtMdbGetGeneralParam( MCH_GP.SAFEZ)
dLoCompLength = dActualElevation + EgtMdbGetGeneralParam( MCH_GP.SAFEZ)
dLiTang = 1
dLoTang = 1
dLiPerp = 0
dLoPerp = 0
elseif ( sLeadInOutType ~= 'Perpendicular') and ( ( sLeadInOutType == 'Tangent') or ( Ktp * dLi2Tang < dLiPerp)) then
bLioTang = true bLioTang = true
dLiTang, dLiPerp, dLoTang, dLoPerp = dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp dLiTang, dLiPerp, dLoTang, dLoPerp = dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp
if BD.TURN then if BD.TURN then
@@ -148,11 +136,9 @@ function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimD
-- imposto attacco/uscita -- imposto attacco/uscita
EgtSetMachiningParam( MCH_MP.LITANG, dLiTang) EgtSetMachiningParam( MCH_MP.LITANG, dLiTang)
EgtSetMachiningParam( MCH_MP.LIPERP, dLiPerp) EgtSetMachiningParam( MCH_MP.LIPERP, dLiPerp)
EgtSetMachiningParam( MCH_MP.LICOMPLEN, dLiCompLength)
if BD.TURN and bLioTang then EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG) end if BD.TURN and bLioTang then EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG) end
EgtSetMachiningParam( MCH_MP.LOTANG, dLoTang) EgtSetMachiningParam( MCH_MP.LOTANG, dLoTang)
EgtSetMachiningParam( MCH_MP.LOPERP, dLoPerp) EgtSetMachiningParam( MCH_MP.LOPERP, dLoPerp)
EgtSetMachiningParam( MCH_MP.LOCOMPLEN, dLoCompLength)
-- imposto allungamenti iniziale e finale -- imposto allungamenti iniziale e finale
EgtSetMachiningParam( MCH_MP.STARTADDLEN, -dAccStart) EgtSetMachiningParam( MCH_MP.STARTADDLEN, -dAccStart)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, -dAccEnd) EgtSetMachiningParam( MCH_MP.ENDADDLEN, -dAccEnd)
@@ -170,16 +156,7 @@ function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimD
end end
local vtOut = EgtIf( vtN:getX() > 0, X_AX(), -X_AX()) local vtOut = EgtIf( vtN:getX() > 0, X_AX(), -X_AX())
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCutting, 'perpendicular', b3Raw, vtTool, vtOut)) EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCutting, 'perpendicular', b3Raw, vtTool, vtOut))
local sAuxDir, sInitAngs = BL.GetAuxDir( sCutting, 'perpendicular', b3Raw, vtTool, vtOut)
if sAuxDir then
sNotes = EgtSetValInNotes( sNotes, 'VtAuxDir', sAuxDir)
EgtSetMachiningParam( MCH_MP.INITANGS, sInitAngs)
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.STD)
end
-- eventuali note -- eventuali note
if ( sLeadInOutType == 'PerpendicularOutraw') then
sNotes = EgtSetValInNotes( sNotes, 'OutRaw', 3)
end
if sNotes and #sNotes > 0 then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end if sNotes and #sNotes > 0 then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
@@ -216,28 +193,7 @@ local function GetNameSolidFaceIncludingLine( b3Solid, ptP1Comp, ptP2Comp)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function AreSameOrOppositeDirApprox( vDir1, vDir2) function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert, bMaximizeVerticalDepth, bSpecialTangentLeadInOut, bForceTangentLeadInOut, Par5Alternative)
if abs( abs( vDir1) - abs( vDir2)) < 10 * GEO.EPS_SMALL then
return true
else
return false
end
end
---------------------------------------------------------------------
local function GetEdgeToMachineFromVector( nSurfId, nFacet, vtOrthO)
local _, EdgesEgt = EgtSurfTmGetFacetOutlineInfo( nSurfId, nFacet, GDB_ID.ROOT)
for i = 1, #EdgesEgt do
if AreOppositeVectorApprox( EdgesEgt[i].Norm, vtOrthO) then
return ( i - 1)
end
end
return nil
end
---------------------------------------------------------------------
function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert, bMaximizeVerticalDepth, bSpecialTangentLeadInOut, sLeadInOutType, Par5Alternative, dActualElevation, bForceClimbCut)
-- se lama con asse parallelo alla faccia, passo alla apposita funzione -- se lama con asse parallelo alla faccia, passo alla apposita funzione
if ( Par5 == MCH_MILL_FU.PARAL_DOWN or if ( Par5 == MCH_MILL_FU.PARAL_DOWN or
Par5 == MCH_MILL_FU.PARAL_TOP or Par5 == MCH_MILL_FU.PARAL_TOP or
@@ -245,7 +201,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
Par5 == MCH_MILL_FU.PARAL_BACK or Par5 == MCH_MILL_FU.PARAL_BACK or
Par5 == MCH_MILL_FU.PARAL_LEFT or Par5 == MCH_MILL_FU.PARAL_LEFT or
Par5 == MCH_MILL_FU.PARAL_RIGHT) then Par5 == MCH_MILL_FU.PARAL_RIGHT) then
return MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert, sLeadInOutType, dActualElevation) return MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert, bForceTangentLeadInOut)
end end
-- la lama ha asse perpendicolare alla faccia -- la lama ha asse perpendicolare alla faccia
EgtOutLog( 'FacesBySaw.MakeOne', 3) EgtOutLog( 'FacesBySaw.MakeOne', 3)
@@ -277,9 +233,8 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
if not dVzLimDwnUp then dVzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN, vtOrthO) end if not dVzLimDwnUp then dVzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN, vtOrthO) end
local bDownHead = ( dVzLimDwnUp and dVzLimDwnUp < - 1.5) local bDownHead = ( dVzLimDwnUp and dVzLimDwnUp < - 1.5)
local bDownUp = ( vtN:getZ() < dVzLimDwnUp) local bDownUp = ( vtN:getZ() < dVzLimDwnUp)
-- linea o bilinea di lavorazione
local ptP1, ptPm, ptP2, vtV1, vtV2, dLen, dWidth = EgtSurfTmFacetOppositeSide( nSurfId, nFacet, vtOrthO, GDB_ID.ROOT) local ptP1, ptPm, ptP2, vtV1, vtV2, dLen, dWidth = EgtSurfTmFacetOppositeSide( nSurfId, nFacet, vtOrthO, GDB_ID.ROOT)
if not dLen or dLen < 1.1 or not dWidth or dWidth < 1.1 then if not dLen or dLen < 1.1 or not dWidth or dWidth < 1.1 then
local sWarn = 'Face ' .. string.format( '%d,%d', nSurfId, nFacet) .. ' skipped : too small' local sWarn = 'Face ' .. string.format( '%d,%d', nSurfId, nFacet) .. ' skipped : too small'
EgtOutLog( sWarn, 1) EgtOutLog( sWarn, 1)
@@ -291,12 +246,6 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
return false return false
end end
local bIsSawCCW = ( EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0) local bIsSawCCW = ( EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0)
-- se settato nelle note lavorazione si lavora in discordanza
EgtMdbSetCurrMachining( sCutting)
local sMachiningNotes = EgtMdbGetCurrMachiningParam( MCH_MP.USERNOTES) or ''
if ( EgtGetValInNotes( sMachiningNotes, 'PATHINVERT', 'd') or 0) == 1 then
bIsSawCCW = not bIsSawCCW
end
local bInvert = bForceInvert local bInvert = bForceInvert
-- l'inversione può essere comandata da rotazione lama (direzione concorde, legata anche a DownUp) oppure da direzione Z del percorso (si preferisce lavorare dal basso verso l'alto per limitare le corse) -- l'inversione può essere comandata da rotazione lama (direzione concorde, legata anche a DownUp) oppure da direzione Z del percorso (si preferisce lavorare dal basso verso l'alto per limitare le corse)
-- se c'è disaccordo tra rotazione e direzione si cambia il lato di lavoro, se possibile. Se ciò non è possbile comanda la direzione. Se percorso orizzontale comanda la rotazione. -- se c'è disaccordo tra rotazione e direzione si cambia il lato di lavoro, se possibile. Se ciò non è possbile comanda la direzione. Se percorso orizzontale comanda la rotazione.
@@ -304,7 +253,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
if not BD.TURN or abs( ptP2:getY() - ptP1:getY()) < 250 then if not BD.TURN or abs( ptP2:getY() - ptP1:getY()) < 250 then
local bIsMachiningDownwards = ( ptP2:getZ() < ptP1:getZ() - 100 * GEO.EPS_SMALL) local bIsMachiningDownwards = ( ptP2:getZ() < ptP1:getZ() - 100 * GEO.EPS_SMALL)
local bIsMachiningUpwards = ( ptP2:getZ() > ptP1:getZ() + 100 * GEO.EPS_SMALL) local bIsMachiningUpwards = ( ptP2:getZ() > ptP1:getZ() + 100 * GEO.EPS_SMALL)
if ( bIsSawCCW ~= bDownUp) and ( bIsMachiningDownwards or not ( bIsMachiningDownwards or bIsMachiningUpwards) or bForceClimbCut) then if ( bIsSawCCW ~= bDownUp) and ( bIsMachiningDownwards or not ( bIsMachiningDownwards or bIsMachiningUpwards)) then
bInvert = true bInvert = true
elseif ( ( bIsSawCCW ~= bDownUp) ~= bIsMachiningDownwards) then elseif ( ( bIsSawCCW ~= bDownUp) ~= bIsMachiningDownwards) then
if Par5Alternative then if Par5Alternative then
@@ -418,7 +367,6 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
local dLenLi = sqrt( dLiTang * dLiTang + dLiPerp * dLiPerp) local dLenLi = sqrt( dLiTang * dLiTang + dLiPerp * dLiPerp)
local dLenLo = sqrt( dLoTang * dLoTang + dLoPerp * dLoPerp) local dLenLo = sqrt( dLoTang * dLoTang + dLoPerp * dLoPerp)
local dLiCompLength = 0 local dLiCompLength = 0
local dLoCompLength = 0
-- attacco tangente -- attacco tangente
local dLi2Tang = 0 local dLi2Tang = 0
local dLi2Perp = 0 local dLi2Perp = 0
@@ -440,7 +388,6 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
end end
local dLenLi2 = abs( dLi2Tang) local dLenLi2 = abs( dLi2Tang)
local dLenLo2 = abs( dLo2Tang) local dLenLo2 = abs( dLo2Tang)
local dBiLineaAddLength = 0
-- se il lato non lavorato della bilinea è aperto, setto entrata/uscita con la stessa direzione -- se il lato non lavorato della bilinea è aperto, setto entrata/uscita con la stessa direzione
if bIsBiLinea then if bIsBiLinea then
@@ -469,9 +416,8 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
local dDistPointToCenter = sqrt( dDistPtTang * dDistPtTang + dDistToCenter * dDistToCenter) local dDistPointToCenter = sqrt( dDistPtTang * dDistPtTang + dDistToCenter * dDistToCenter)
-- se distanza al punto è maggiore del raggio lama, significa che non ho già lavorato, quindi calcolo uscita opportunamente -- se distanza al punto è maggiore del raggio lama, significa che non ho già lavorato, quindi calcolo uscita opportunamente
if dDistPointToCenter > 0.5 * dSawDiam then if dDistPointToCenter > 0.5 * dSawDiam then
dBiLineaAddLength = dDistPointToCenter - ( 0.5 * dSawDiam)
dLoTang = -dAllEnd * dCosAlpha dLoTang = -dAllEnd * dCosAlpha
dLoPerp = dDist2 * dSinAlpha dLoPerp = dDist2 * dSinAlpha
end end
end end
end end
@@ -480,17 +426,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
local bLioTang local bLioTang
local Ktp = 1.1 local Ktp = 1.1
if BD.KIOTP then Ktp = BD.KIOTP end if BD.KIOTP then Ktp = BD.KIOTP end
if ( sLeadInOutType == 'PerpendicularOutraw') then if ( bForceTangentLeadInOut or ( not bDownUp or abs( vtTg:getY()) > 0.5) and
bLioTang = false
dLiCompLength = dActualElevation + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + dCutExtra
dLoCompLength = dActualElevation + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + dCutExtra
dLiTang = 1
dLoTang = 1
dLiPerp = 0
dLoPerp = 0
dLenLi = sqrt( dLiTang * dLiTang + dLiPerp * dLiPerp)
dLenLo = sqrt( dLoTang * dLoTang + dLoPerp * dLoPerp)
elseif ( sLeadInOutType ~= 'Perpendicular') and ( ( sLeadInOutType == 'Tangent') or ( not bDownUp or abs( vtTg:getY()) > 0.5) and
( not bDownHead or abs( vtTg:getZ()) < 0.51) and ( not bDownHead or abs( vtTg:getZ()) < 0.51) and
abs( vtTg:getX()) < 0.9848 and abs( vtTg:getX()) < 0.9848 and
( ( abs( vtTg:getZ()) < 0.17 and ( vtV1:getZ() < -0.5 or vtV2:getZ() < -0.5) and not bDownHead) or ( ( abs( vtTg:getZ()) < 0.17 and ( vtV1:getZ() < -0.5 or vtV2:getZ() < -0.5) and not bDownHead) or
@@ -513,23 +449,11 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
-- dLoPerp rimane invariato -- dLoPerp rimane invariato
end end
elseif BD.TURN then elseif BD.TURN then
bLioTang = 2
local dMove = dist( ptP1, ptP2)
dLiTang, dLiPerp = dLi2Tang, dLi2Perp dLiTang, dLiPerp = dLi2Tang, dLi2Perp
-- se angolo bilinea ottuso si segue bilinea per un tratto per tagliare completamente cubetto a forma di rombo dLoTang = -( dLiTang - dAccStart - dAccEnd + dMove)
if dCosAngleL1L2 > 0.707 and bIsBiLinea then dLoPerp = BD.COLL_SIC
-- calcolo uscita per prolungare solo della parte mancante per completare il taglio
if dBiLineaAddLength > 0 then
dLoTang = dLoTang * ( dBiLineaAddLength + BD.COLL_SIC) / 100
dLoPerp = dLoPerp * ( dBiLineaAddLength + BD.COLL_SIC) / 100
end
-- aggiungo componente perpendicolare a percorso per ritornare dal punto di ingresso, altrimenti l'uscita viene allungata fino dall'altra parte del grezzo
dLoCompLength = 100
-- se angolo bilinea oltre 45°, faccio movimento in retrazione
else
bLioTang = 2
local dMove = dist( ptP1, ptP2)
dLoTang = -( dLiTang - dAccStart - dAccEnd + dMove)
dLoPerp = BD.COLL_SIC
end
else else
bLioTang = true bLioTang = true
dLiTang, dLiPerp, dLoTang, dLoPerp, dLiCompLength = dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp, dLi2CompLength dLiTang, dLiPerp, dLoTang, dLoPerp, dLiCompLength = dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp, dLi2CompLength
@@ -602,20 +526,8 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
EgtSetMachiningGeometry( {{ nSurfId, nFacet}}) EgtSetMachiningGeometry( {{ nSurfId, nFacet}})
-- imposto uso faccia -- imposto uso faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- vtFaceUse non funziona correttamente in caso che il lato da lavorare sia a 45°. Potrebbe ritornare una trilinea, non gestibile. Quindi si setta l'EDGE local sNoteVtFaceUse = 'VtFaceUse=' .. EgtNumToString( vtOrthO:getX(),3) .. ',' .. EgtNumToString( vtOrthO:getY(),3) .. ',' .. EgtNumToString( vtOrthO:getZ(),3) .. ';'
local nEdgeFaceUse = GetEdgeToMachineFromVector( nSurfId, nFacet, vtOrthO) EgtSetMachiningParam( MCH_MP.USERNOTES, sNoteVtFaceUse)
if nEdgeFaceUse and ( AreSameOrOppositeDirApprox( vtOrthO:getX(), 0.707) or AreSameOrOppositeDirApprox( vtOrthO:getY(), 0.707) or AreSameOrOppositeDirApprox( vtOrthO:getZ(), 0.707)) then
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or ''
sUserNotes = EgtSetValInNotes( sUserNotes, 'EdgesFaceUse', EgtNumToString( nEdgeFaceUse))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
else
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or ''
sUserNotes = EgtSetValInNotes( sUserNotes, 'VtFaceUse', EgtNumToString( vtOrthO:getX(), 3) .. ',' .. EgtNumToString( vtOrthO:getY(), 3) .. ',' .. EgtNumToString( vtOrthO:getZ(), 3))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- imposto allungamenti iniziale e finale (in caso si utilizzi EDGE, non serve prolungare o accorciare)
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dAllStart - dAccStart)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dAllEnd - dAccEnd)
end
-- imposto posizione braccio porta testa -- imposto posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- imposto inversione e lato correzione -- imposto inversione e lato correzione
@@ -633,20 +545,13 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
if BD.TURN and bLioTang == 2 then EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG) end if BD.TURN and bLioTang == 2 then EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG) end
EgtSetMachiningParam( MCH_MP.LOTANG, dLoTang) EgtSetMachiningParam( MCH_MP.LOTANG, dLoTang)
EgtSetMachiningParam( MCH_MP.LOPERP, dLoPerp) EgtSetMachiningParam( MCH_MP.LOPERP, dLoPerp)
EgtSetMachiningParam( MCH_MP.LOCOMPLEN, dLoCompLength) -- imposto allungamenti iniziale e finale
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dAllStart - dAccStart)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dAllEnd - dAccEnd)
-- imposto angolo 3° asse rot -- imposto angolo 3° asse rot
local sBlockedAxis = EgtIf( bMaximizeVerticalDepth, 'parallel', 'perpendicular') local sBlockedAxis = EgtIf( bMaximizeVerticalDepth, 'parallel', 'perpendicular')
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCutting, sBlockedAxis, b3Raw, vtN, vtOrthO)) EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCutting, sBlockedAxis, b3Raw, vtN, vtOrthO))
local sAuxDir, sInitAngs = BL.GetAuxDir( sCutting, sBlockedAxis, b3Raw, vtN, vtOrthO)
if sAuxDir then
sNotes = EgtSetValInNotes( sNotes, 'VtAuxDir', sAuxDir)
EgtSetMachiningParam( MCH_MP.INITANGS, sInitAngs)
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.STD)
end
-- eventuali note -- eventuali note
if ( sLeadInOutType == 'PerpendicularOutraw') then
sNotes = EgtSetValInNotes( sNotes, 'OutRaw', 3)
end
if sNotes and #sNotes > 0 then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end if sNotes and #sNotes > 0 then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
@@ -716,7 +621,7 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
local bFaceOk = {} local bFaceOk = {}
bFaceOk[1] = ( vtN[1]:getZ() >= ( BD.CUT_VZ_MIN or BD.NZ_MINB) or abs( vtN[1]:getY()) < 0.174 or ( Proc.AffectedFaces.Left ~= Proc.AffectedFaces.Right and Proc.Face[1].Elevation < dMaxDepth - 10 * GEO.EPS_SMALL)) bFaceOk[1] = ( vtN[1]:getZ() >= ( BD.CUT_VZ_MIN or BD.NZ_MINB) or abs( vtN[1]:getY()) < 0.174 or ( Proc.AffectedFaces.Left ~= Proc.AffectedFaces.Right and Proc.Face[1].Elevation < dMaxDepth - 10 * GEO.EPS_SMALL))
bFaceOk[2] = ( vtN[2]:getZ() >= ( BD.CUT_VZ_MIN or BD.NZ_MINB) or abs( vtN[2]:getY()) < 0.174 or ( Proc.AffectedFaces.Left ~= Proc.AffectedFaces.Right and Proc.Face[2].Elevation < dMaxDepth - 10 * GEO.EPS_SMALL)) bFaceOk[2] = ( vtN[2]:getZ() >= ( BD.CUT_VZ_MIN or BD.NZ_MINB) or abs( vtN[2]:getY()) < 0.174 or ( Proc.AffectedFaces.Left ~= Proc.AffectedFaces.Right and Proc.Face[2].Elevation < dMaxDepth - 10 * GEO.EPS_SMALL))
if not bDownHead and not bFaceOk[1] and not bFaceOk[2] then if not bDownHead and ( not bFaceOk[1] or not bFaceOk[2]) then
local sErr = 'Error : TwoFacesBySaw from bottom impossible' local sErr = 'Error : TwoFacesBySaw from bottom impossible'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
+52 -75
View File
@@ -25,14 +25,11 @@ EgtOutLog( ' MachiningLib started', 1)
-- Dati -- Dati
local BD = require( 'BeamData') local BD = require( 'BeamData')
-- librerie lavorazioni caricate con pcall perchè potrebbero non esserci local Cuttings = require( 'CutData')
local Cuttings, Millings, Pocketings, Sawings, Drillings, Probing local Millings = require( 'MillingData')
if pcall( require, 'CutData') then Cuttings = require( 'CutData') end local Pocketings = require( 'PocketingData')
if pcall( require, 'MillingData') then Millings = require( 'MillingData') end local Sawings = require( 'SawingData')
if pcall( require, 'PocketingData') then Pocketings = require( 'PocketingData') end local Drillings = require( 'DrillData')
if pcall( require, 'SawingData') then Sawings = require( 'SawingData') end
if pcall( require, 'DrillData') then Drillings = require( 'DrillData') end
if pcall( require, 'ProbingData') then Probing = require( 'ProbingData') end
-- tipo di teste macchina -- tipo di teste macchina
local ONE_HEAD = 1 -- una testa (Fast, One, Turn1T) local ONE_HEAD = 1 -- una testa (Fast, One, Turn1T)
@@ -80,7 +77,7 @@ end
-- setta ultimi testa e utensile utilizzati se compatibili con ottimizzazione testa -- setta ultimi testa e utensile utilizzati se compatibili con ottimizzazione testa
local function ConfirmNextMachining() local function ConfirmNextMachining()
-- utensile corrente -- utensile corrente
local sToolUuid = EgtGetMachiningParam( MCH_MP.TUUID) local sToolUuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
local sToolName = EgtTdbGetToolFromUUID( sToolUuid or '') local sToolName = EgtTdbGetToolFromUUID( sToolUuid or '')
EgtTdbSetCurrTool( sToolName or '') EgtTdbSetCurrTool( sToolName or '')
-- testa dell'utensile corrente -- testa dell'utensile corrente
@@ -139,7 +136,6 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function VerifyMill( Machining, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bH2) function VerifyMill( Machining, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bH2)
if ( not dDepth or Machining.Tool.MaxMat > dDepth - GEO.EPS_SMALL) and if ( not dDepth or Machining.Tool.MaxMat > dDepth - GEO.EPS_SMALL) and
( Machining.Type ~= 'FloatingAggregate' or abs( Machining.Tool.MaxMat - dDepth) < 100 * GEO.EPS_SMALL) and
( not sTuuidMstr or sTuuidMstr == Machining.Tool.UUID) and ( not sTuuidMstr or sTuuidMstr == Machining.Tool.UUID) and
( not dMaxDiam or Machining.Tool.Diameter < dMaxDiam + GEO.EPS_SMALL) and ( not dMaxDiam or Machining.Tool.Diameter < dMaxDiam + GEO.EPS_SMALL) and
( not dMaxTotLen or Machining.Tool.TotalLength < dMaxTotLen + GEO.EPS_SMALL) then ( not dMaxTotLen or Machining.Tool.TotalLength < dMaxTotLen + GEO.EPS_SMALL) then
@@ -174,7 +170,7 @@ function VerifyTool( Machining, MachiningType, Params, bH2)
return VerifyDrillPocket( Machining, Params.Diam, Params.Depth, bH2) return VerifyDrillPocket( Machining, Params.Diam, Params.Depth, bH2)
end end
elseif MachiningType == MCH_MY.SAWING then elseif MachiningType == MCH_MY.SAWING then
return ( not Params.Depth or Machining.Tool.MaxMat > Params.Depth - GEO.EPS_SMALL), { H2 = bH2} return true, { H2 = bH2}
elseif MachiningType == MCH_MY.MILLING then elseif MachiningType == MCH_MY.MILLING then
return VerifyMill( Machining, Params.Depth, Params.TuuidMstr, Params.MaxDiam, Params.MaxTotLen, bH2) return VerifyMill( Machining, Params.Depth, Params.TuuidMstr, Params.MaxDiam, Params.MaxTotLen, bH2)
elseif MachiningType == MCH_MY.POCKETING then elseif MachiningType == MCH_MY.POCKETING then
@@ -188,32 +184,18 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function GetMachinings( MachiningType, sType) function GetMachinings( MachiningType, sType)
local Machinings = {} local Machinings
-- leggo le lavorazioni disponibili -- leggo le lavorazioni disponibili
if MachiningType == MCH_MY.DRILLING then if MachiningType == MCH_MY.DRILLING then
if Drillings and type( Drillings) == "table" then Machinings = Drillings
Machinings = Drillings
end
elseif MachiningType == MCH_MY.SAWING then elseif MachiningType == MCH_MY.SAWING then
if Cuttings and type( Cuttings) == "table" then Machinings = Cuttings
Machinings = Cuttings
end
elseif MachiningType == MCH_MY.MILLING then elseif MachiningType == MCH_MY.MILLING then
if Millings and type( Millings) == "table" then Machinings = Millings
Machinings = Millings
end
elseif MachiningType == MCH_MY.POCKETING then elseif MachiningType == MCH_MY.POCKETING then
if Pocketings and type( Pocketings) == "table" then Machinings = Pocketings
Machinings = Pocketings
end
elseif MachiningType == MCH_MY.MORTISING then elseif MachiningType == MCH_MY.MORTISING then
if Sawings and type( Sawings) == "table" then Machinings = Sawings
Machinings = Sawings
end
elseif MachiningType == MCH_MY.PROBING then
if Probing and type( Probing) == "table" then
Machinings = Probing
end
end end
-- scrivo i parametri utensile nella lavorazione -- scrivo i parametri utensile nella lavorazione
local validMachinings = {} local validMachinings = {}
@@ -226,34 +208,27 @@ function GetMachinings( MachiningType, sType)
if Machining.Tool.Name then if Machining.Tool.Name then
if EgtTdbSetCurrTool( Machining.Tool.Name) then if EgtTdbSetCurrTool( Machining.Tool.Name) then
table.insert( validMachinings, Machining) table.insert( validMachinings, Machining)
-- se non è tastatura, recupero dati utensile if ( MachiningType == MCH_MY.MILLING) or ( MachiningType == MCH_MY.POCKETING) or ( MachiningType == MCH_MY.DRILLING and EgtStartsWith( sType, 'Pocket')) then
if MachiningType ~= MCH_MY.PROBING then Machining.Tool.MaxMat = EgtTdbGetCurrToolMaxDepth()
-- caso speciale utensile su aggregato flottante else
if MachiningType == MCH_MY.MILLING and sType == 'FloatingAggregate' then Machining.Tool.MaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
local sNotes = EgtTdbGetCurrToolParam( MCH_TP.USERNOTES)
Machining.Tool.MaxMat = EgtGetValInNotes( sNotes, 'TOOL_OVERHANG', 'd') or -1
elseif ( MachiningType == MCH_MY.MILLING) or ( MachiningType == MCH_MY.POCKETING) or ( MachiningType == MCH_MY.DRILLING and EgtStartsWith( sType, 'Pocket')) then
Machining.Tool.MaxMat = EgtTdbGetCurrToolMaxDepth()
else
Machining.Tool.MaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
end
if MachiningType == MCH_MY.DRILLING then
if EgtStartsWith( Machining.Type, 'Drill') then
Machining.SubType = 'Drill'
elseif EgtStartsWith( Machining.Type, 'AngleDrill') then
Machining.SubType = 'AngleDrill'
elseif EgtStartsWith( Machining.Type, 'Pocket') then
Machining.SubType = 'DrillPocket'
elseif EgtStartsWith( Machining.Type, 'Predrill') then
Machining.SubType = 'Predrill'
end
end
Machining.Tool.Diameter = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
Machining.Tool.Length = EgtTdbGetCurrToolParam( MCH_TP.LEN)
Machining.Tool.TotalLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
Machining.Tool.ToolHolderDiameter = EgtTdbGetCurrToolThDiam()
Machining.Tool.ToolHolderLength = EgtTdbGetCurrToolThLength() or 72
end end
if MachiningType == MCH_MY.DRILLING then
if EgtStartsWith( Machining.Type, 'Drill') or EgtStartsWith( Machining.Type, 'MultiDrill') then
Machining.SubType = 'Drill'
elseif EgtStartsWith( Machining.Type, 'AngleDrill') then
Machining.SubType = 'AngleDrill'
elseif EgtStartsWith( Machining.Type, 'Pocket') then
Machining.SubType = 'DrillPocket'
elseif EgtStartsWith( Machining.Type, 'Predrill') then
Machining.SubType = 'Predrill'
end
end
Machining.Tool.Diameter = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
Machining.Tool.Length = EgtTdbGetCurrToolParam( MCH_TP.LEN)
Machining.Tool.TotalLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
Machining.Tool.ToolHolderDiameter = EgtTdbGetCurrToolThDiam()
Machining.Tool.ToolHolderLength = EgtTdbGetCurrToolThLength() or 72
end end
end end
end end
@@ -322,7 +297,7 @@ end
function ReturnParams( MachiningType, MachiningName, sType, ToolParams) function ReturnParams( MachiningType, MachiningName, sType, ToolParams)
if MachiningType == MCH_MY.DRILLING then if MachiningType == MCH_MY.DRILLING then
local _, sOrigType = EgtEndsWith( sType, '_H2') local _, sOrigType = EgtEndsWith( sType, '_H2')
return MachiningName, sType, EgtIf( sOrigType == 'Drill' or sOrigType == 'Drill_AT' or sOrigType == 'AngleDrill' or sOrigType == 'Predrill' , ToolParams.TMaxMat, ToolParams.TMaxDepth), ToolParams.MaxToolLength, ToolParams.ToolDiam, ToolParams.DiamTh, ToolParams.FreeLen return MachiningName, sType, EgtIf( sOrigType == 'Drill' or sOrigType == 'MultiDrill' or sOrigType == 'Drill_AT' or sOrigType == 'AngleDrill' or sOrigType == 'Predrill' , ToolParams.TMaxMat, ToolParams.TMaxDepth), ToolParams.MaxToolLength, ToolParams.ToolDiam, ToolParams.DiamTh, ToolParams.FreeLen
elseif MachiningType == MCH_MY.SAWING then elseif MachiningType == MCH_MY.SAWING then
return MachiningName, ToolParams.H2 return MachiningName, ToolParams.H2
elseif MachiningType == MCH_MY.MILLING then elseif MachiningType == MCH_MY.MILLING then
@@ -336,7 +311,6 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion) local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion)
local bOptimizeHeads = ( not sSortingCriterion or sSortingCriterion == '')
if bTopHead == nil and bDownHead == nil then if bTopHead == nil and bDownHead == nil then
bTopHead = true bTopHead = true
bDownHead = false bDownHead = false
@@ -368,21 +342,21 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead,
local ForStart = 1 local ForStart = 1
local ForEnd = #Machinings local ForEnd = #Machinings
local ForStep = 1 local ForStep = 1
-- le forature vanno scorse dal diametro maggiore al minore, a meno che non sia stato passato un ordinamento specifico -- le forature vanno scorse dal diametro maggiore al minore
if MachiningType == MCH_MY.DRILLING and ( not sSortingCriterion or sSortingCriterion == '') then if MachiningType == MCH_MY.DRILLING then
ForStart = #Machinings ForStart = #Machinings
ForEnd = 1 ForEnd = 1
ForStep = -1 ForStep = -1
end end
if bOptimizeHeads or MachineHeadType == ONE_HEAD or MachineHeadType == TWO_EQUAL_HEADS or ( MachineHeadType == TWO_UP_DOWN_HEADS and not bDownHead) then if ( BEAM and BEAM.BW) or MachineHeadType == ONE_HEAD or MachineHeadType == TWO_EQUAL_HEADS or ( MachineHeadType == TWO_UP_DOWN_HEADS and not bDownHead) then
_, sType = EgtEndsWith( sType, '_H2') _, sType = EgtEndsWith( sType, '_H2')
elseif not bOptimizeHeads and MachineHeadType == TWO_UP_DOWN_HEADS and not bTopHead and bDownHead then elseif not ( BEAM and BEAM.BW) and MachineHeadType == TWO_UP_DOWN_HEADS and not bTopHead and bDownHead then
if not EgtEndsWith( sType, '_H2') then if not EgtEndsWith( sType, '_H2') then
sType = sType .. '_H2' sType = sType .. '_H2'
end end
end end
local MachineHeadUse = MachineHeadType local MachineHeadUse = MachineHeadType
if not bOptimizeHeads and MachineHeadUse == TWO_EQUAL_HEADS then if not ( BEAM and BEAM.BW) and MachineHeadUse == TWO_EQUAL_HEADS then
MachineHeadUse = ONE_HEAD MachineHeadUse = ONE_HEAD
end end
if MachineHeadUse == TWO_UP_DOWN_HEADS and bTopHead and bDownHead then if MachineHeadUse == TWO_UP_DOWN_HEADS and bTopHead and bDownHead then
@@ -394,7 +368,7 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead,
for i = ForStart, ForEnd, ForStep do for i = ForStart, ForEnd, ForStep do
local Machining = Machinings[i] local Machining = Machinings[i]
local sMachiningType = Machining.Type local sMachiningType = Machining.Type
if bOptimizeHeads or MachineHeadUse == TWO_EQUAL_HEADS then if ( BEAM and BEAM.BW) or MachineHeadUse == TWO_EQUAL_HEADS then
_, sMachiningType = EgtEndsWith( Machining.Type, '_H2') _, sMachiningType = EgtEndsWith( Machining.Type, '_H2')
end end
-- recupero dati utensile -- recupero dati utensile
@@ -470,28 +444,31 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead,
end end
end end
local bH2, sOrigType = EgtEndsWith( sType, '_H2') local bH2, sOrigType = EgtEndsWith( sType, '_H2')
if not bOptimizeHeads and MachineHeadType == TWO_UP_DOWN_HEADS and bH2 and bTopHead then if ( not BEAM or not BEAM.BW) and MachineHeadType == TWO_UP_DOWN_HEADS and bH2 and bTopHead then
return FindMachining( MachiningType, sOrigType, Params, true, false) return FindMachining( MachiningType, sOrigType, Params, true, false)
end end
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function MachiningLib.FindCutting( sType, bTopHead, bDownHead, dDepth, sSortingCriterion) function MachiningLib.FindCutting( sType, bTopHead, bDownHead)
return FindMachining( MCH_MY.SAWING, sType, { Depth = dDepth}, bTopHead, bDownHead, nil, nil, sSortingCriterion) return FindMachining( MCH_MY.SAWING, sType, nil, bTopHead, bDownHead)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead, bExcludeH2, bAngleTransmission, bIsPredrill, bExcludeH3, sSortingCriterion) function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead, bExcludeH2, bAngleTransmission, bIsPredrill, bIsMultidrill)
local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5, sTypeMach local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5, sTypeMach
-- se la macchina ha gruppi a forare, si prova con quelli
if bIsMultidrill then
sTypeMach = 'MultiDrill'
-- se il foro è un predrill, cerco solo punte abilitate al Predrill -- se il foro è un predrill, cerco solo punte abilitate al Predrill
if bIsPredrill then elseif bIsPredrill then
sTypeMach = 'Predrill' sTypeMach = 'Predrill'
else else
sTypeMach = EgtIf( bAngleTransmission, 'Drill_AT', 'Drill') sTypeMach = EgtIf( bAngleTransmission, 'Drill_AT', 'Drill')
end end
MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, sTypeMach, { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion) MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, sTypeMach, { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead, bExcludeH2)
if ( not MachiningName or MachiningName == '') then if ( not MachiningName or MachiningName == '') then
MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, EgtIf( bAngleTransmission, 'Pocket_AT', 'Pocket'), { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion) MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, EgtIf( bAngleTransmission, 'Pocket_AT', 'Pocket'), { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead)
end end
if MachiningName and MachiningName ~= '' then if MachiningName and MachiningName ~= '' then
return MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 return MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5
@@ -507,8 +484,8 @@ function MachiningLib.FindAngleDrilling( dDiam, dDepth, bTopHead, bDownHead)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion) 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, sSortingCriterion) return FindMachining( MCH_MY.MILLING, sType, { Depth = dDepth, TuuidMstr = sTuuidMstr, MaxDiam = dMaxDiam, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead, bExcludeH2, bExcludeH3)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
+21 -55
View File
@@ -65,14 +65,11 @@ function ProcessCut.Classify( Proc, b3Raw)
end end
-- recupero i dati del taglio -- recupero i dati del taglio
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
-- calcolo le massime estensioni lineari orizzontale e verticale della faccia if vtN:getZ() <= - 0.5 and abs( vtN:getY()) > 0.1 or ( vtN:getZ() <= - 0.174 and abs( vtN:getY()) > 0.866) then
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw) -- calcolo le massime estensioni lineari orizzontale e verticale della faccia
if ( vtN:getZ() <= - 0.5 and abs( vtN:getY()) > 0.1) or local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
( vtN:getZ() <= - 0.174 and abs( vtN:getY()) > 0.866) or
( vtN:getZ() <= - 0.174 and abs( vtN:getZ()) * DimV > BD.MAX_DIM_DICE)
then
-- confronto queste estensioni con la massima dimensione del DiceCut (impossibile lavorare se entrambe maggiori) -- confronto queste estensioni con la massima dimensione del DiceCut (impossibile lavorare se entrambe maggiori)
if DimH > BD.MAX_DIM_DICE + 100 * GEO.EPS_SMALL and DimV > BD.MAX_DIM_DICE + 100 * GEO.EPS_SMALL then if DimH > BD.MAX_DIM_DICE and DimV > BD.MAX_DIM_DICE then
return true, true return true, true
end end
end end
@@ -93,9 +90,9 @@ function ProcessCut.Classify( Proc, b3Raw)
end end
end end
-- calcolo l'ingombro orizzontale della faccia -- calcolo l'ingombro orizzontale della faccia
_, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0) local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0)
-- confronto questo ingombro con il doppio della massima dimensione del DiceCut (impossibile lavorare sotto da sopra se più di 2 tagli oppure se tipo PF, taglio inclinato in Y e non taglio singolo orizzontale) -- confronto questo ingombro con il doppio della massima dimensione del DiceCut (impossibile lavorare sotto da sopra se più di 2 tagli oppure se tipo PF, taglio inclinato in Y e non taglio singolo orizzontale)
if DimH > 2 * BD.MAX_DIM_DICE or ( BD.C_SIMM and ( abs( vtN:getY()) > 0.1) and dMaxMat < DimH + BD.CUT_EXTRA) then if DimH > 2 * BD.MAX_DIM_DICE or ( BD.C_SIMM and abs( vtN:getY()) > 0.1 and dMaxMat < DimH + BD.CUT_EXTRA) then
return true, true return true, true
end end
end end
@@ -264,8 +261,7 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione con testa da sopra -- Applicazione della lavorazione con testa da sopra
local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, nLimitingSurf, sLeadInOutType) local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, nLimitingSurf, bForceTangentLeadInOut)
local sWarn
-- ingombro del grezzo -- ingombro del grezzo
b3Raw = b3Raw or EgtGetRawPartBBox( nRawId) b3Raw = b3Raw or EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo -- ingombro del pezzo
@@ -276,7 +272,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN) local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN)
local bDownCut = ( vtN:getZ() <= dNzLimDwnUp) local bDownCut = ( vtN:getZ() <= dNzLimDwnUp)
if bFromBottom == nil then if bFromBottom == nil then
bFromBottom = ( vtN:getZ() > 0.25 and ( b3Solid:getDimX() < BD.LEN_SHORT_PART and BL.IsSplittedPartPhase( nPhase)) and not Proc.AdvTail and vtN:getX() < 0 and abs( vtN:getY()) < 0.259) bFromBottom = ( vtN:getZ() > 0.25 and b3Solid:getDimX() < BD.LEN_SHORT_PART and not Proc.AdvTail and vtN:getX() < 0 and abs( vtN:getY()) < 0.259)
end end
local dMinFeatureLengthForLongCut = EgtIf( BD.C_SIMM, 590, 400) local dMinFeatureLengthForLongCut = EgtIf( BD.C_SIMM, 590, 400)
-- verifico se da considerare taglio lungo ( non da sotto, inclinato non più di 30deg, largo come la trave e abbastanza lungo) -- verifico se da considerare taglio lungo ( non da sotto, inclinato non più di 30deg, largo come la trave e abbastanza lungo)
@@ -377,21 +373,10 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
end end
-- verifico se necessari tagli supplementari o se presente superficie limitante -- verifico se necessari tagli supplementari o se presente superficie limitante
EgtOutLog( string.format( 'MaxDepth=%.1f MaxVertDepth=%.1f CutH=%.1f CutV=%.1f', dMaxDepth, dMaxVertDepth, dCutH, dCutV), 3) EgtOutLog( string.format( 'MaxDepth=%.1f MaxVertDepth=%.1f CutH=%.1f CutV=%.1f', dMaxDepth, dMaxVertDepth, dCutH, dCutV), 3)
-- se lungo, una faccia e rivolto sul retro verso l'alto si forzano i cubetti per evitare di rovinare il pezzo successivo
local bForceDicing = ( Proc.Fct == 1 and Proc.AffectedFaces.Left and bLongCut and vtN:getZ() > 10 * GEO.EPS_SMALL and vtN:getY() < 10 * GEO.EPS_SMALL)
local vCuts = {} local vCuts = {}
local dDicingOffsetP if not Proc.AdvTail and ( dCutH > dMaxDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC or dCutV > dMaxVertDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC) then
local dDicingOffsetO
if ( ( not Proc.AdvTail) or bForceDicing) and
( dCutH - 100 * GEO.EPS_SMALL > dMaxDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC or
dCutV - 100 * GEO.EPS_SMALL > dMaxVertDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC) then
local ptExtra, vtExtra local ptExtra, vtExtra
local bAutoCalcSurf = true local bAutoCalcSurf = true
if Proc.AdvTail then
-- do avviso che la lama può sbordare nel pezzo successivo
sWarn = 'Warning : Cut machining can damage next piece'
EgtOutLog( sWarn .. ' (process ' .. tostring( Proc.Id) .. ')')
end
if bFillAreaPiece or bFillTail then if bFillAreaPiece or bFillTail then
local ptMiddle = ( b3Solid:getMin() + b3Solid:getMax()) / 2 local ptMiddle = ( b3Solid:getMin() + b3Solid:getMax()) / 2
ptExtra = Point3d( b3Solid:getMin():getX() + 5*GEO.EPS_SMALL, ptMiddle:getY(), ptMiddle:getZ()) ptExtra = Point3d( b3Solid:getMin():getX() + 5*GEO.EPS_SMALL, ptMiddle:getY(), ptMiddle:getZ())
@@ -430,11 +415,11 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
end end
end end
-- se il taglio è più spesso della lama abilito il dicing, altrimenti no -- se il taglio è più spesso della lama abilito il dicing, altrimenti no
if ( dMaxElev > dSawThick) or bForceDicing then if dMaxElev > dSawThick then
vCuts, dDicingOffsetP = DC.GetDice( nAddGrpId, EgtIf( bForced, b3Raw, b3Solid), ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, dNewDiceDim) vCuts = DC.GetDice( nAddGrpId, EgtIf( bForced, b3Raw, b3Solid), ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, dNewDiceDim)
-- se taglio sborda in coda e non è stato inserito nessun taglio a cubetti, lo rilancio con le dimensioni customizzate -- se taglio sborda in coda e non è stato inserito nessun taglio a cubetti, lo rilancio con le dimensioni customizzate
if ( bFillTail or bCustDiceCut) and #vCuts == 0 then if ( bFillTail or bCustDiceCut) and #vCuts == 0 then
vCuts, dDicingOffsetP = DC.GetDice( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, Proc.Box:getDimY()) vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, Proc.Box:getDimY())
end end
end end
end end
@@ -603,17 +588,8 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
if ( i % 2 == 0) and ( Proc.Fct == 1) and bNoPerpCuts then if ( i % 2 == 0) and ( Proc.Fct == 1) and bNoPerpCuts then
vtOrthoOAlternative = - vtOrthoO vtOrthoOAlternative = - vtOrthoO
end end
local sLeadInOutTypeFbs = 'Calculated' bForceTangentLeadInOut = bForceTangentLeadInOut and ( ( i % 2) ~= 0)
if ( ( i % 2) ~= 0) then local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, sNotes, b3Raw, nil, nil, bSpecialTangentLeadInOut, bForceTangentLeadInOut, vtOrthoOAlternative)
if ( sLeadInOutType == 'Tangent') then
sLeadInOutTypeFbs = 'Tangent'
elseif ( sLeadInOutType == 'Perpendicular') then
sLeadInOutTypeFbs = 'Perpendicular'
elseif ( sLeadInOutType == 'PerpendicularOutraw') then
sLeadInOutTypeFbs = 'PerpendicularOutraw'
end
end
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, sNotes, b3Raw, nil, nil, bSpecialTangentLeadInOut, sLeadInOutTypeFbs, vtOrthoOAlternative, dDicingOffsetP)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
end end
end end
@@ -632,8 +608,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
local vtOrthoO local vtOrthoO
if bFromBottom and dCutV < dMaxDepth - BD.CUT_EXTRA and vtN:getZ() > 0 then if bFromBottom and dCutV < dMaxDepth - BD.CUT_EXTRA and vtN:getZ() > 0 then
vtOrthoO = -Z_AX() vtOrthoO = -Z_AX()
elseif ( bHorizCut and not bVertCutOk) and elseif bHorizCut and ( not bVertCutOk or b3Solid:getDimX() > BD.LEN_SHORT_PART or Proc.AdvTail or ( vtN:getX() > 0 and vtN:getZ() <= 0.708) or ( abs( vtN:getY()) < 0.1 and vtN:getZ() <= 0)) then
( not bVertCutOk or b3Solid:getDimX() > BD.LEN_SHORT_PART or Proc.AdvTail or ( vtN:getX() > 0 and vtN:getZ() <= 0.708) or ( abs( vtN:getY()) < 0.1 and vtN:getZ() <= 0)) then
vtOrthoO = Z_AX() vtOrthoO = Z_AX()
elseif b3Solid:getDimX() < BD.LEN_SHORT_PART and not Proc.AdvTail and abs( vtN:getY()) > 0.259 and elseif b3Solid:getDimX() < BD.LEN_SHORT_PART and not Proc.AdvTail and abs( vtN:getY()) > 0.259 and
vtN:getZ() > -0.174 and abs( vtN:getY()) > abs( vtN:getZ()) and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then vtN:getZ() > -0.174 and abs( vtN:getY()) > abs( vtN:getZ()) and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then
@@ -666,7 +641,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
end end
return true, sWarn return true
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
@@ -854,7 +829,7 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, dOvmTail, bUpdateIng, nLimitingSurf, sLeadInOutType) function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, dOvmTail, bUpdateIng, nLimitingSurf, bForceTangentLeadInOut)
-- sovramateriale di coda -- sovramateriale di coda
dOvmTail = dOvmTail or BD.OVM_MID dOvmTail = dOvmTail or BD.OVM_MID
-- ingombro del grezzo -- ingombro del grezzo
@@ -891,31 +866,22 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom,
return false, sErr return false, sErr
end end
local bNoDicing = false local bNoDicing = false
local sWarn
-- se taglio con testa da sopra -- se taglio con testa da sopra
if not bDownHead and not bDownTurn then if not bDownHead and not bDownTurn then
local bOk, sErr, bNoDicing2 = MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, nLimitingSurf, sLeadInOutType) local bOk, sErr, bNoDicing2 = MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, nLimitingSurf, bForceTangentLeadInOut)
bNoDicing = bNoDicing2 bNoDicing = bNoDicing2
if not bOk then if not bOk then return false, sErr end
return false, sErr
else
sWarn = sErr
end
-- altrimenti taglio con testa da sotto -- altrimenti taglio con testa da sotto
else else
local bOk, sErr = MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead) local bOk, sErr = MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
if not bOk then if not bOk then return false, sErr end
return false, sErr
else
sWarn = sErr
end
end end
-- Aggiornamento ingombro (se vero taglio o richiesto) -- Aggiornamento ingombro (se vero taglio o richiesto)
-- Se lascio il cordolo (bNoDicing) non aggiorno il grezzo perchè lo scarto rimane attaccato -- Se lascio il cordolo (bNoDicing) non aggiorno il grezzo perchè lo scarto rimane attaccato
if ( ProcessCut.Identify( Proc) or bUpdateIng) and not bNoDicing then if ( ProcessCut.Identify( Proc) or bUpdateIng) and not bNoDicing then
UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw) UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
end end
return true, sWarn return true
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
+7 -30
View File
@@ -475,36 +475,13 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- dati delle facce -- dati delle facce
local ptC = {} local ptC = {}
local vtN = {} local vtN = {}
local idFirstFace, idSecondFace ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
-- se ci sono più di due face (caso insolito), si prendono le facce più grandi
if Proc.Fct > 2 then
local Area = {}
-- si prendono le due più grandi, potrebbero essercene più di due
for i = 1, Proc.Fct do
local _, dL, dW = EgtSurfTmFacetMinAreaRectangle( Proc.Id, i - 1)
table.insert( Area, { nIndex = i-1, dArea = dL*dW})
end
-- ordina 'Area' in ordine decrescente
table.sort( Area, function( A, B)
return A.dArea > B.dArea
end
)
idFirstFace = Area[1].nIndex
idSecondFace = Area[2].nIndex
else
idFirstFace = 0
idSecondFace = 1
end
ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, idFirstFace, GDB_ID.ROOT)
ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, idSecondFace, GDB_ID.ROOT)
-- normale media per capire se taglio di testa o di coda -- normale media per capire se taglio di testa o di coda
local vtNm = ( vtN[1] + vtN[2]) ; vtNm:normalize() local vtNm = ( vtN[1] + vtN[2]) ; vtNm:normalize()
local bHead = ( vtNm:getX() > 0) local bHead = ( vtNm:getX() > 0)
-- angolo diedro per stabilire se taglio convesso -- angolo diedro per stabilire se taglio convesso
local bAdj, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, idFirstFace, idSecondFace, GDB_ID.ROOT) local bAdj, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT)
local bConvex = true local bConvex = true
local bOnY = true local bOnY = true
local ptPs = ( ptC[1] + ptC[2]) / 2 local ptPs = ( ptC[1] + ptC[2]) / 2
@@ -515,8 +492,8 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bConvex = ( dAng > 0) bConvex = ( dAng > 0)
end end
-- determino quale faccia è più grande -- determino quale faccia è più grande
local _, dB1, dH1 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, idFirstFace) local _, dB1, dH1 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0)
local _, dB2, dH2 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, idSecondFace) local _, dB2, dH2 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 1)
local nBigInd = EgtIf( dB1 * dH1 >= dB2 * dH2, 1, 2) local nBigInd = EgtIf( dB1 * dH1 >= dB2 * dH2, 1, 2)
local nSmaInd = 3 - nBigInd local nSmaInd = 3 - nBigInd
-- inserimento smussi -- inserimento smussi
@@ -583,8 +560,8 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end end
end end
local _, _, dDimV1 = BL.GetFaceHvRefDim( Proc.Id, idFirstFace, b3Raw) local _, _, dDimV1 = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
local _, _, dDimV2 = BL.GetFaceHvRefDim( Proc.Id, idSecondFace, b3Raw) local _, _, dDimV2 = BL.GetFaceHvRefDim( Proc.Id, 1, b3Raw)
local bFace1TooLongForBlade, bFace2TooLongForBlade = ( dDimV1 >= dMaxDepth), ( dDimV2 >= dMaxDepth) local bFace1TooLongForBlade, bFace2TooLongForBlade = ( dDimV1 >= dMaxDepth), ( dDimV2 >= dMaxDepth)
local dFace1Ang, dFace2Ang = vtN[1]:getZ(), vtN[2]:getZ() local dFace1Ang, dFace2Ang = vtN[1]:getZ(), vtN[2]:getZ()
if bFace1TooLongForBlade and dFace1Ang < ( BD.CUT_VZ_MIN or -0.484) or bFace2TooLongForBlade and dFace2Ang < ( BD.CUT_VZ_MIN or -0.484) then if bFace1TooLongForBlade and dFace1Ang < ( BD.CUT_VZ_MIN or -0.484) or bFace2TooLongForBlade and dFace2Ang < ( BD.CUT_VZ_MIN or -0.484) then
+87 -171
View File
@@ -37,7 +37,6 @@ EgtOutLog( ' ProcessDrill started', 1)
-- Dati -- Dati
local BD = require( 'BeamData') local BD = require( 'BeamData')
local ML = require( 'MachiningLib') local ML = require( 'MachiningLib')
local FreeContour = require( 'ProcessFreeContour')
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Riconoscimento della feature -- Riconoscimento della feature
@@ -103,8 +102,8 @@ end
function ProcessDrill.GetData( Proc, b3Raw) function ProcessDrill.GetData( Proc, b3Raw)
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
-- verifico se foro da adattare -- verifico se foro da adattare
local nNewAuxId
if EgtExistsInfo( Proc.Id, 'DiamUser') then if EgtExistsInfo( Proc.Id, 'DiamUser') then
local nNewAuxId
if AuxId then nNewAuxId = AuxId + Proc.Id end if AuxId then nNewAuxId = AuxId + Proc.Id end
if AuxId and EgtGetType( nNewAuxId) == GDB_TY.CRV_ARC and BD.USER_HOLE_DIAM and BD.USER_HOLE_DIAM > 1 then if AuxId and EgtGetType( nNewAuxId) == GDB_TY.CRV_ARC and BD.USER_HOLE_DIAM and BD.USER_HOLE_DIAM > 1 then
EgtModifyArcRadius( nNewAuxId, BD.USER_HOLE_DIAM / 2) EgtModifyArcRadius( nNewAuxId, BD.USER_HOLE_DIAM / 2)
@@ -116,7 +115,13 @@ function ProcessDrill.GetData( Proc, b3Raw)
-- recupero faccia di entrata e uscita -- recupero faccia di entrata e uscita
local nFcs = EgtGetInfo( Proc.Id, 'FCS', 'i') or 0 local nFcs = EgtGetInfo( Proc.Id, 'FCS', 'i') or 0
local nFce = EgtGetInfo( Proc.Id, 'FCE', 'i') or 0 local nFce = EgtGetInfo( Proc.Id, 'FCE', 'i') or 0
return dDiam, dLen, nFcs, nFce
local vtDrillDir
if AuxId then
nNewAuxId = AuxId + Proc.Id
vtDrillDir = EgtCurveExtrusion( nNewAuxId, GDB_RT.GLOB)
end
return dDiam, dLen, nFcs, nFce, vtDrillDir
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
@@ -135,8 +140,7 @@ function ProcessDrill.Split( Proc, b3Raw)
local bOpen = ( Proc.Fce ~= 0) and ( Proc.Fce ~= Proc.Fcs) local bOpen = ( Proc.Fce ~= 0) and ( Proc.Fce ~= Proc.Fcs)
-- recupero flag abilitazione split (0=auto,1=no) -- recupero flag abilitazione split (0=auto,1=no)
local bTrySplit = ( EgtGetInfo( Proc.Id, 'Q02', 'i') ~= 1) local bTrySplit = ( EgtGetInfo( Proc.Id, 'Q02', 'i') ~= 1)
local bOnlyContour = ( EgtGetInfo( Proc.Id, 'Q04', 'i') == 1) if not bTrySplit then
if ( not bTrySplit) or bOnlyContour then
return false return false
end end
-- restituisco se va fatto in doppio (solo fori orizzontali) -- restituisco se va fatto in doppio (solo fori orizzontali)
@@ -211,8 +215,7 @@ function ProcessDrill.AddPredrillFromDrillProc( Proc)
PredrillProc.MainId = Proc.MainId PredrillProc.MainId = Proc.MainId
PredrillProc.IsPredrill = true PredrillProc.IsPredrill = true
PredrillProc.IsPredrillOf = Proc.Id PredrillProc.IsPredrillOf = Proc.Id
-- recupero l'elenco delle facce della parte interessate dalla feature
PredrillProc.AffectedFaces = BL.GetProcessAffectedFaces( PredrillProc)
return true, PredrillProc return true, PredrillProc
end end
end end
@@ -315,39 +318,9 @@ local function GetHoleStartData( ptCen, vtExtr, b3Solid)
return nFac, CosB, vFaces return nFac, CosB, vFaces
end end
---------------------------------------------------------------------
local function GetSCC( Proc, vtExtr, b3Solid, bDrillAngTrasm, nPhase)
local nSCC = MCH_SCC.NONE
if bDrillAngTrasm then
nSCC = MCH_SCC.ADIR_NEAR
elseif BD.TURN == 2 then
nSCC = MCH_SCC.ADIR_ZP
elseif not BD.C_SIMM and not BD.TURN then
nSCC = MCH_SCC.ADIR_YM
if AreSameVectorApprox( vtExtr, Z_AX()) then
nSCC = MCH_SCC.ADIR_YM
elseif abs( vtExtr:getX()) < 0.1 then
local bNearTail = ( Proc.Box:getCenter():getX() < b3Solid:getCenter():getX() and Proc.Box:getCenter():getX() - b3Solid:getMin():getX() < 1000)
local bVeryShortPart = ( BD.LEN_VERY_SHORT_PART and b3Solid:getDimX() < BD.LEN_VERY_SHORT_PART)
nSCC = EgtIf( BL.IsPartFinalPhase( nPhase) or ( bNearTail and not bVeryShortPart), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
elseif vtExtr:getY() > 0.1 then
nSCC = MCH_SCC.ADIR_YP
end
else
nSCC = MCH_SCC.NONE
end
return nSCC
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, bUseMultiDrill)
-- Se forzato contorno foro forzo richiamo a FreeContour e uscita dalla funzione
if EgtGetInfo( Proc.Id, 'Q04', 'i') == 1 then
return FreeContour.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end
-- default per costanti -- default per costanti
BD.DRILL_VX_MAX_ANGLEDRILL = ( BD.DRILL_VX_MAX_ANGLEDRILL or 0.928) BD.DRILL_VX_MAX_ANGLEDRILL = ( BD.DRILL_VX_MAX_ANGLEDRILL or 0.928)
-- ingombro del pezzo -- ingombro del pezzo
@@ -386,11 +359,10 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
local nFac, CosB
-- se non già richiesta inversione e invertibile -- se non già richiesta inversione e invertibile
if not bToInvert and Proc.Flg == 1 and -vtExtr:getZ() >= BD.DRILL_VZ_MIN then if not bToInvert and Proc.Flg == 1 and -vtExtr:getZ() >= BD.DRILL_VZ_MIN then
-- se il foro è cieco o dalla faccia sotto o troppo inclinato all'inizio, lo inverto -- se il foro è cieco o dalla faccia sotto o troppo inclinato all'inizio, lo inverto
nFac, CosB, _ = GetHoleStartData( ptCen, vtExtr, b3Solid) local nFac, CosB, _ = GetHoleStartData( ptCen, vtExtr, b3Solid)
if Proc.Fcs == 0 or (( nFac == 2 or CosB > BD.DRILL_VX_MAX) and bOpen) then if Proc.Fcs == 0 or (( nFac == 2 or CosB > BD.DRILL_VX_MAX) and bOpen) then
bToInvert = true bToInvert = true
end end
@@ -421,29 +393,9 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
-- primo gruppo di controlli con lunghezza utensile pari a metà foro se passante -- primo gruppo di controlli con lunghezza utensile pari a metà foro se passante
-- recupero la lavorazione -- recupero la lavorazione
local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm, Proc.IsPredrill) local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm, Proc.IsPredrill, bUseMultiDrill)
local dMaxDepthOri
local vFaces
if sDrilling then
-- Determino la faccia di inizio del foro e dati correlati
nFac, CosB, vFaces = GetHoleStartData( ptCen, vtExtr, b3Solid)
-- Calcolo acciorciamento affondamento utile per evitare collisione portautensile con faccia
local TgA = CosB / sqrt( 1 - CosB * CosB)
local dSubL = ( dDiamTh / 2 + ( Proc.Diam - dToolDiam) / 2 + 4) * TgA
-- Per fori molto inclinati ( < 30 gradi) si usa la testa della macchina per l'accorciamento. Fast esclusa
if BD.C_SIMM and CosB > 0.866 then
dSubL = ( 190 / 2 + ( Proc.Diam - dToolDiam) / 2 + 4) * TgA - 116
end
dMaxDepthOri = dMaxDepth
dMaxDepth = min( dMaxDepth, max( dToolFreeLen - dSubL, 0))
-- se utensile scelto non arriva in fondo, cerco il più lungo
if dMaxDepth < GEO.EPS_SMALL * 10 then
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm, Proc.IsPredrill, nil, 'Longest')
end
end
if not sDrilling and dCheckDepth then if not sDrilling and dCheckDepth then
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm, Proc.IsPredrill) sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm, Proc.IsPredrill, bUseMultiDrill)
if sDrilling then dCheckDepth = nil end if sDrilling then dCheckDepth = nil end
end end
if not sDrilling then if not sDrilling then
@@ -536,44 +488,19 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- eventuale inversione foro in base al lato di lavoro e al lato testa dell'utensile scelto
-- se non già richiesta inversione e foro quasi orizzontale (15deg) passante
if not bToInvert and Proc.Flg == 1 and bOpen and abs( vtExtr:getZ()) < 0.259 and abs( vtExtr:getY()) > 0.966 then
local Tool = BL.GetToolFromMachining( sDrilling)
-- lato testa e lato di lavoro devono corrispondere
if Tool.PreferredSide then
if ( ( Tool.PreferredSide.bFront == true) and vtExtr:getY() > 10 * GEO.EPS_SMALL)
or ( ( Tool.PreferredSide.bBack == true) and vtExtr:getY() < - 10 * GEO.EPS_SMALL) then
ptCen = ptCen - vtExtr * dLen
vtExtr = - vtExtr
bToInvert = true
end
end
end
-- Determino la faccia di inizio del foro e dati correlati -- Determino la faccia di inizio del foro e dati correlati
nFac, CosB, vFaces = GetHoleStartData( ptCen, vtExtr, b3Solid) local nFac, CosB, vFaces = GetHoleStartData( ptCen, vtExtr, b3Solid)
-- Calcolo acciorciamento affondamento utile per evitare collisione portautensile con faccia -- Calcolo acciorciamento affondamento utile per evitare collisione portautensile con faccia
TgA = CosB / sqrt( 1 - CosB * CosB) local TgA = CosB / sqrt( 1 - CosB * CosB)
dSubL = ( dDiamTh / 2 + ( Proc.Diam - dToolDiam) / 2 + 4) * TgA local dSubL = ( dDiamTh / 2 + ( Proc.Diam - dToolDiam) / 2 + 4) * TgA
-- Per fori molto inclinati ( < 30 gradi) si usa la testa della macchina per l'accorciamento. Fast esclusa -- Per fori molto inclinati ( < 30 gradi) si usa la testa della macchina per l'accorciamento. Fast esclusa
if BD.C_SIMM and CosB > 0.866 then if BD.C_SIMM and CosB > 0.866 then
dSubL = ( 190 / 2 + ( Proc.Diam - dToolDiam) / 2 + 4) * TgA - 116 dSubL = ( 190 / 2 + ( Proc.Diam - dToolDiam) / 2 + 4) * TgA - 116
end end
dMaxDepthOri = dMaxDepth local dMaxDepthOri = dMaxDepth
dMaxDepth = min( dMaxDepth, max( dToolFreeLen - dSubL, 0)) dMaxDepth = min( dMaxDepth, max( dToolFreeLen - dSubL, 0))
-- Verifico inclinazione foro nei limiti -- Verifico inclinazione foro nei limiti
local bTryDrill = EgtIf( dMaxDepth > 0, ( CosB < BD.DRILL_VX_MAX), false) local bTryDrill = EgtIf( dMaxDepth > 0, ( CosB < BD.DRILL_VX_MAX), false)
-- se il foro deve essere eseguito dopo un taglio, potrebbe essere perchè il taglio crea una superficie perpendicolare
if Proc.Dependency and Proc.Dependency.ExecAfter then
local ptCut, vtCutN = EgtSurfTmFacetCenter( Proc.Dependency.ExecAfter.Id, 0, GDB_ID.ROOT)
local dMaxAngleDrillOnCut = BD.MAX_ANGLE_DRILL_CUT or 10
local dAngle = GetAngle( vtExtr, vtCutN)
CosB = cos( dAngle)
if dAngle < dMaxAngleDrillOnCut then
-- controllo di essere nei limiti
bTryDrill = true
end
end
if ( CosB > 0.8 * BD.DRILL_VX_MAX and CosB < BD.DRILL_VX_MAX_ANGLEDRILL) then if ( CosB > 0.8 * BD.DRILL_VX_MAX and CosB < BD.DRILL_VX_MAX_ANGLEDRILL) then
-- cerco le forature speciali AngleDrill -- cerco le forature speciali AngleDrill
local sDrilling3, sType3, dMaxDepth3 = ML.FindAngleDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown) local sDrilling3, sType3, dMaxDepth3 = ML.FindAngleDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown)
@@ -593,7 +520,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if bIntersectionOk then if bIntersectionOk then
local dHoleToCutDistance = vDistance[1] local dHoleToCutDistance = vDistance[1]
-- se il taglio accorcia realmente il foro -- se il taglio accorcia realmente il foro
if ( dHoleToCutDistance > 10 * GEO.EPS_SMALL or Proc.AffectedFaces.Right) and dHoleToCutDistance < dLen then if dHoleToCutDistance > 10 * GEO.EPS_SMALL and dHoleToCutDistance < dLen then
dMaxDepth = dMaxDepthOri dMaxDepth = dMaxDepthOri
dMaxElev = dLen - dHoleToCutDistance dMaxElev = dLen - dHoleToCutDistance
bTryDrill = true bTryDrill = true
@@ -613,7 +540,6 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
end end
end end
local dDepthOri = dDepth
-- se foro da saltare per eccessiva inclinazione -- se foro da saltare per eccessiva inclinazione
if not bTryDrill then if not bTryDrill then
sMyWarn = 'Warning in drill : too slant hole' sMyWarn = 'Warning in drill : too slant hole'
@@ -625,7 +551,6 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
dDepth = dMaxDepth dDepth = dMaxDepth
dMaxElev = dMaxDepth dMaxElev = dMaxDepth
end end
-- inserisco la lavorazione -- inserisco la lavorazione
local sName = EgtIf( EgtStartsWith( sType, 'Predrill'), 'Predrill_', 'Drill_') .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local sName = EgtIf( EgtStartsWith( sType, 'Predrill'), 'Predrill_', 'Drill_') .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sDrilling) local nMchId = EgtAddMachining( sName, sDrilling)
@@ -635,38 +560,54 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
return false, sErr return false, sErr
end end
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}}) if Proc.SkippedGeometries and #Proc.SkippedGeometries > 0 then
-- eventuali note utente EgtSetMachiningGeometry( Proc.SkippedGeometries)
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' Proc.SkippedGeometries = nil
elseif Proc.OtherGeometries and #Proc.OtherGeometries > 0 then
local HolesGeometries = {}
-- aggiungo foro principale
table.insert( HolesGeometries, { AuxId, -1})
-- aggiungo altre geometrie connesse
for i = 1, #Proc.OtherGeometries do
-- recupero geometria da lavorare
local OtherAuxId = Proc.OtherGeometries[i].Id + EgtGetInfo( Proc.OtherGeometries[i].Id, 'AUXID', 'i')
local Geometry = { OtherAuxId, -1}
table.insert( HolesGeometries, Geometry)
end
EgtSetMachiningGeometry( HolesGeometries)
else
EgtSetMachiningGeometry( {{ AuxId, -1}})
end
-- eventuale inversione -- eventuale inversione
if sType == 'Drill' or sType == 'Drill_H2' or sType == 'Drill_AT' or sType == 'AngleDrill' or sType == 'Predrill' then if sType == 'Drill' or sType == 'MultiDrill' or sType == 'Drill_H2' or sType == 'Drill_AT' or sType == 'AngleDrill' or sType == 'Predrill' then
EgtSetMachiningParam( MCH_MP.INVERT, bToInvert) EgtSetMachiningParam( MCH_MP.INVERT, bToInvert)
else else
EgtSetMachiningParam( MCH_MP.TOOLINVERT, bToInvert) EgtSetMachiningParam( MCH_MP.TOOLINVERT, bToInvert)
end end
-- imposto posizione braccio porta testa -- imposto posizione braccio porta testa
local nSCC = GetSCC( Proc, vtExtr, b3Solid, bDrillAngTrasm, nPhase) local nSCC = MCH_SCC.NONE
if bDrillAngTrasm or bUseMultiDrill then
nSCC = MCH_SCC.ADIR_NEAR
elseif not BD.C_SIMM and not BD.TURN then
nSCC = MCH_SCC.ADIR_YM
if AreSameVectorApprox( vtExtr, Z_AX()) then
nSCC = MCH_SCC.ADIR_YM
elseif abs( vtExtr:getX()) < 0.1 then
local bNearTail = ( Proc.Box:getCenter():getX() < b3Solid:getCenter():getX() and Proc.Box:getCenter():getX() - b3Solid:getMin():getX() < 1000)
local bVeryShortPart = ( BD.LEN_VERY_SHORT_PART and b3Solid:getDimX() < BD.LEN_VERY_SHORT_PART)
nSCC = EgtIf( BL.IsPartFinalPhase( nPhase) or ( bNearTail and not bVeryShortPart), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
elseif vtExtr:getY() > 0.1 then
nSCC = MCH_SCC.ADIR_YP
end
else
nSCC = MCH_SCC.NONE
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- imposto affondamento -- imposto affondamento
local dLastStepDepth if Proc.Double and Proc.Double > 0 and dDepth > Proc.MachDepthDouble + 10 * GEO.EPS_SMALL then
if Proc.Double and Proc.Double > 0 then sMyWarn = 'Warning in double head drilling : depth (' .. EgtNumToString( dDepth, 1) .. ') reduced to (' .. EgtNumToString( Proc.MachDepthDouble, 1) .. ') to match H2 max tool depth'
if ( sType == 'Pocket_AT' or sType == 'Pocket') then dDepth = Proc.MachDepthDouble
if bOpen then dMaxElev = Proc.MachDepthDouble
local dReduceDepth = MIRROR_POCKETS_MIN_DISTANCE / 2 + 10
dLastStepDepth = dDepth + dReduceDepth
dDepth = dDepth - dReduceDepth
if ( dLastStepDepth > dMaxDepth + 10 * GEO.EPS_SMALL) and ( dMaxDepth <= ( dLen / 2) - dReduceDepth) and ( dDepthOri ~= dDepth) then
dDepth = dMaxDepth
end
end
else
sUserNotes = EgtSetValInNotes( sUserNotes, 'LastStep', MIRROR_DRILLINGS_MIN_DISTANCE / 2 + 15)
end
if dDepth > Proc.MachDepthDouble + 10 * GEO.EPS_SMALL then
sMyWarn = 'Warning in double head drilling : depth (' .. EgtNumToString( dDepth, 1) .. ') reduced to (' .. EgtNumToString( Proc.MachDepthDouble, 1) .. ') to match H2 max tool depth'
dDepth = Proc.MachDepthDouble
dMaxElev = Proc.MachDepthDouble
end
end end
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- imposto il valore della distanza di sicurezza per l'attacco. Se il valore del db utensili è troppo basso lo alzo a 10. -- imposto il valore della distanza di sicurezza per l'attacco. Se il valore del db utensili è troppo basso lo alzo a 10.
@@ -674,19 +615,11 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local dMinStartPos = 10 local dMinStartPos = 10
local dStartPos = max( dMinStartPos, dToolDbStartPos) local dStartPos = max( dMinStartPos, dToolDbStartPos)
EgtSetMachiningParam( MCH_MP.STARTPOS, dStartPos) EgtSetMachiningParam( MCH_MP.STARTPOS, dStartPos)
-- dichiarazione nessuna generazione sfridi per Vmill -- Note utente con dichiarazione nessuna generazione sfridi per Vmill
sUserNotes = EgtSetValInNotes( sUserNotes, 'VMRS', 0) local sUserNotes = EgtSetVal( 'VMRS', 0) .. ';'
-- aggiungo alle note massima elevazione (coincide con affondamento) -- aggiungo alle note massima elevazione (coincide con affondamento)
local dCustomMaxElev if dMaxElev then
if Proc.dCustomMaxElev and type( Proc.dCustomMaxElev) == "number" and Proc.dCustomMaxElev > 10 * GEO.EPS_SMALL then sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dMaxElev, 1))
dCustomMaxElev = Proc.dCustomMaxElev
end
if dMaxElev or dCustomMaxElev then
if dCustomMaxElev then
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dCustomMaxElev, 1))
else
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dMaxElev, 1))
end
end end
-- se foro passante, aggiungo questa qualifica alle note -- se foro passante, aggiungo questa qualifica alle note
if ( sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill') and bOpen then if ( sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill') and bOpen then
@@ -694,6 +627,16 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
-- se lavorazione in doppio -- se lavorazione in doppio
if Proc.Double and Proc.Double > 0 then if Proc.Double and Proc.Double > 0 then
-- calcolo gli step reali
local dStep = EgtGetMachiningParam( MCH_MP.STEP)
local nNumStep = ceil( dDepth/dStep)
local dRealStep = dDepth / nNumStep
-- Se nel penultimo step le punte si trovano più vicine del minimo ( MinDistX1X2 + Puntina centraggio H1 + puntina centraggio H2) ricalcolo facendo uno step in meno
if ( ( dLen / 2) - ( dRealStep * (nNumStep - 1))) * 2 < ( 40 + 10 + 10) then
dRealStep = ceil( dDepth / (nNumStep - 1))
EgtSetMachiningParam( MCH_MP.STEP, dRealStep)
sMyWarn ='Warning in drill-double : step changed to ' .. tostring(dRealStep) .. 'mm'
end
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double) sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double)
if Proc.Double ~= Proc.PrevDouble then if Proc.Double ~= Proc.PrevDouble then
sUserNotes = EgtSetValInNotes( sUserNotes, 'StartZmax', 2) sUserNotes = EgtSetValInNotes( sUserNotes, 'StartZmax', 2)
@@ -703,13 +646,25 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- eseguo -- eseguo
local bOk = ML.ApplyMachining( true, false) local bOk = ML.ApplyMachining( true, false)
if not bOk and bDownDrill and bOpen and abs( Proc.Flg) == 1 then if not bOk and bDownDrill and bOpen and abs( Proc.Flg) == 1 then
if sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill' then if sType == 'Drill' or sType == 'MultiDrill' or sType == 'Drill_H2' or sType == 'AngleDrill' then
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
else else
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
end end
bOk = ML.ApplyMachining( true, false) bOk = ML.ApplyMachining( true, false)
end end
-- in caso di fori raggruppati, mi faccio restituire gli eventuali fori saltati
local SkippedGeometries = {}
SkippedGeometries = EgtGetMachiningSkippedGeometry()
if SkippedGeometries and #SkippedGeometries > 0 and bUseMultiDrill then
if #SkippedGeometries == #Proc.OtherGeometries + 1 then
EgtRemoveOperation( nMchId)
end
Proc.SkippedGeometries = SkippedGeometries
ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, false)
end
if not bOk then if not bOk then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
@@ -720,51 +675,12 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sWarn return false, sWarn
else else
-- se DrillPocket passante in doppio si fa lavorazione aggiuntiva dell'ultimo step
if Proc.Double and Proc.Double > 0 and ( sType == 'Pocket_AT' or sType == 'Pocket') and bOpen then
if dLastStepDepth > dMaxDepth + 10 * GEO.EPS_SMALL then
sMyWarn = 'Warning in drill pocket last step: depth (' .. EgtNumToString( dLastStepDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
return false, sMyWarn
end
local idMachiningLastStep = EgtCopyMachining( EgtIf( EgtStartsWith( sType, 'Predrill'), 'Predrill_', 'Drill_') .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)), sName)
EgtSetCurrMachining( idMachiningLastStep)
local dMaxElevLastStep = dLastStepDepth - dDepth
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dMaxElevLastStep, 1))
EgtSetMachiningParam( MCH_MP.DEPTH, dLastStepDepth)
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', '')
sUserNotes = EgtSetValInNotes( sUserNotes, 'StartZmax', '')
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
local bOkLastStep = ML.ApplyMachining( true, false)
if not bOkLastStep and bDownDrill and bOpen and abs( Proc.Flg) == 1 then
if sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill' then
EgtSetMachiningParam( MCH_MP.INVERT, true)
else
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
end
bOkLastStep = ML.ApplyMachining( true, false)
end
if not bOkLastStep then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
local _, sWarnLastStep = EgtGetMachMgrWarning( 0)
if not bOkLastStep then
sWarnLastStep = 'Drillpocket double : incomplete, last step missing'
end
local sPreviousWarn = sMyWarn or sWarn
if sWarnLastStep then
if not sPreviousWarn then sPreviousWarn = '' end
sMyWarn = EgtIf( #sPreviousWarn > 0, sPreviousWarn .. '\n' .. sWarnLastStep, sWarnLastStep)
end
end
end
return true, ( sMyWarn or sWarn) return true, ( sMyWarn or sWarn)
end end
end end
return true, sMyWarn return true, sMyWarn
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
return ProcessDrill return ProcessDrill
+113 -305
View File
@@ -20,7 +20,6 @@ local ProcessDtMortise = {}
require( 'EgtBase') require( 'EgtBase')
local BL = require( 'BeamLib') local BL = require( 'BeamLib')
local Cut = require( 'ProcessCut') local Cut = require( 'ProcessCut')
local Probe = require( 'ProcessProbing')
EgtOutLog( ' ProcessDtMortise started', 1) EgtOutLog( ' ProcessDtMortise started', 1)
@@ -51,23 +50,6 @@ function ProcessDtMortise.FrontIdentify( Proc)
return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 56) return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 56)
end end
---------------------------------------------------------------------
-- Riconoscimento della feature profonda, non sulla faccia della trave
function ProcessDtMortise.IsDeeper( Proc, b3Raw)
-- recupero i dati della curva di contorno della faccia di fondo
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if not AuxId then return false end
AuxId = AuxId + Proc.Id
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
if ( AreSameVectorApprox( vtExtr, -Y_AX()) and Proc.Box:getMin():getY() > b3Raw:getMin():getY() + 100 * GEO.EPS_SMALL) or
( AreSameVectorApprox( vtExtr, Y_AX()) and Proc.Box:getMax():getY() < b3Raw:getMax():getY() - 100 * GEO.EPS_SMALL) or
( AreSameVectorApprox( vtExtr, -Z_AX()) and Proc.Box:getMin():getZ() > b3Raw:getMin():getZ() + 100 * GEO.EPS_SMALL) or
( AreSameVectorApprox( vtExtr, Z_AX()) and Proc.Box:getMax():getZ() < b3Raw:getMax():getZ() - 100 * GEO.EPS_SMALL) then
return true
end
return false
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Verifica se feature di coda -- Verifica se feature di coda
function ProcessDtMortise.IsTailFeature( Proc, b3Raw) function ProcessDtMortise.IsTailFeature( Proc, b3Raw)
@@ -121,7 +103,7 @@ function ProcessDtMortise.GetCutPlane( Proc)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function CalcPathAtHeight( nProcId, AuxId, nAddGrpId, dHeight, dSideAng, b3Solid) local function CalcTopPath( nProcId, AuxId, nAddGrpId, dAltMort, dSideAng, b3Solid)
-- copio la curva di base -- copio la curva di base
local NewAuxId = EgtCopyGlob( AuxId, nAddGrpId) local NewAuxId = EgtCopyGlob( AuxId, nAddGrpId)
if not NewAuxId then return end if not NewAuxId then return end
@@ -129,18 +111,16 @@ local function CalcPathAtHeight( nProcId, AuxId, nAddGrpId, dHeight, dSideAng, b
EgtAddCurveCompoLineTg( NewAuxId, 100, false) EgtAddCurveCompoLineTg( NewAuxId, 100, false)
EgtAddCurveCompoLineTg( NewAuxId, 100, true) EgtAddCurveCompoLineTg( NewAuxId, 100, true)
EgtMergeCurvesInCurveCompo( NewAuxId) EgtMergeCurvesInCurveCompo( NewAuxId)
local dOffset = dHeight * tan( dSideAng) -- eseguo traslazione e offset per portarla sul top
local vtMove = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) * ( dAltMort - 10 * GEO.EPS_SMALL)
EgtMove( NewAuxId, vtMove, GDB_RT.GLOB)
local dOffset = dAltMort * tan( dSideAng)
if not EgtOffsetCurve( NewAuxId, dOffset) then return end if not EgtOffsetCurve( NewAuxId, dOffset) then return end
-- la limito entro la trave -- la limito entro la trave
local refBox = Frame3d( b3Solid:getMin()) local refBox = Frame3d( b3Solid:getMin())
local vtBoxDiag = b3Solid:getMax() - b3Solid:getMin() local vtBoxDiag = b3Solid:getMax() - b3Solid:getMin()
local nCount local nCount
NewAuxId, nCount = EgtTrimFlatCurveWithBox( NewAuxId, refBox, vtBoxDiag, true, true, GDB_RT.GLOB) NewAuxId, nCount = EgtTrimFlatCurveWithBox( NewAuxId, refBox, vtBoxDiag, true, true, GDB_RT.GLOB)
-- per ogni curva creata, eseguo traslazione e offset per portarla sul top
local vtMove = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) * ( dHeight - 10 * GEO.EPS_SMALL)
for i = 1, nCount do
EgtMove( NewAuxId + i - 1, vtMove, GDB_RT.GLOB)
end
-- se divisa in più parti, le unisco congiungendole con segmenti -- se divisa in più parti, le unisco congiungendole con segmenti
if nCount > 1 then if nCount > 1 then
if EgtGetType( NewAuxId) ~= GDB_TY.CRV_COMPO then if EgtGetType( NewAuxId) ~= GDB_TY.CRV_COMPO then
@@ -149,30 +129,13 @@ local function CalcPathAtHeight( nProcId, AuxId, nAddGrpId, dHeight, dSideAng, b
for i = 2, nCount do for i = 2, nCount do
local CrvId = NewAuxId + i - 1 local CrvId = NewAuxId + i - 1
local ptStart = EgtSP( CrvId) local ptStart = EgtSP( CrvId)
EgtAddCurveCompoLine( NewAuxId, ptStart) EgtAddCurveCompoLine( NewAuxId, ptStart)
EgtAddCurveCompoCurve( NewAuxId, CrvId) EgtAddCurveCompoCurve( NewAuxId, CrvId)
end end
end end
return NewAuxId return NewAuxId
end end
---------------------------------------------------------------------
local function GetVerticalSteps( dMachiningDepth, dStep )
local MachiningSteps = {}
MachiningSteps.StepLength = 0
if dMachiningDepth <= 0 then
MachiningSteps.Count = 0
return MachiningSteps
end
MachiningSteps.Count = ceil( (dMachiningDepth - 10 * GEO.EPS_SMALL) / dStep )
MachiningSteps.StepLength = dMachiningDepth / MachiningSteps.Count
return MachiningSteps
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- verifica che il box includa il punto in XY -- verifica che il box includa il punto in XY
function EnclosesPoint( b3Box, ptP) function EnclosesPoint( b3Box, ptP)
@@ -191,8 +154,6 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local sWarn
bMakeAntiSplitPath = true
-- ingombro del pezzo -- ingombro del pezzo
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then if not b3Solid then
@@ -229,10 +190,9 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
local b3DtMrt = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, rfDtMrt) local b3DtMrt = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, rfDtMrt)
local dAltMort = b3DtMrt:getDimZ() local dAltMort = b3DtMrt:getDimZ()
-- verifico se di tipo pocket o se antischeggia disabilitato -- verifico se di tipo pocket
local bPocket = ( EgtGetInfo( Proc.Id, 'P05', 'i') == 1) local bPocket = ( EgtGetInfo( Proc.Id, 'P05', 'i') == 1)
local bDisableAntiSplint = ( EgtGetInfo( Proc.Id, 'Q01', 'i') or 0) == 1 if bPocket then bMakeAntiSplitPath = false end
if bPocket or bDisableAntiSplint then bMakeAntiSplitPath = false end
-- verifico se frontale -- verifico se frontale
local bFront = ( Proc.Prc == 56) local bFront = ( Proc.Prc == 56)
-- se mortasa di fronte, eseguo il taglio della faccia -- se mortasa di fronte, eseguo il taglio della faccia
@@ -313,9 +273,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local dToolDiam = 100 local dToolDiam = 100
local dMaxMat = 30 local dMaxMat = 30
local dSideAng = 0 local dSideAng = 0
local sHeadTool = 'H1'
local bCW = true local bCW = true
local bMillOnAggregate = sMchExt == '_AT'
if EgtMdbSetCurrMachining( sMilling) then if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
@@ -323,73 +281,24 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
dToolDiam = max( dToolDiam, 10) dToolDiam = max( dToolDiam, 10)
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
dSideAng = EgtTdbGetCurrToolParam( MCH_TP.SIDEANG) or dSideAng dSideAng = EgtTdbGetCurrToolParam( MCH_TP.SIDEANG) or dSideAng
sHeadTool = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
local dSpeed = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) or 0 local dSpeed = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) or 0
bCW = ( dSpeed >= 0) bCW = ( dSpeed >= 0)
end end
end end
local bMultipleZPasses = false -- verifico che la profondità non superi il massimo materiale dell'utensile
-- se necessario, cerco un utensile più lungo
if dAltMort > dMaxMat + 10 * GEO.EPS_SMALL then if dAltMort > dMaxMat + 10 * GEO.EPS_SMALL then
-- recupero la lavorazione : prima ricerca per sola tipologia local sErr = 'Error : DtMortise Depth bigger than Tool Cutting edge'
sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, nil, nil, bMillUp, bMillDown, bExcludeH2, nil, 'Longest') EgtOutLog( sErr)
if not sMilling and bMillUp then return false, sErr
sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown, bExcludeH2, nil, 'Longest')
end
if not sMilling then
local sErr = 'Milling not found in library : Error on DtMortise ' .. tostring( Proc.Id)
EgtOutLog( sErr)
return false, sErr
end
-- recupero la lavorazione : seconda ricerca con tipologia e diametro massimo
sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown, bExcludeH2, nil, 'Longest')
if not sMilling and bMillUp then
sMilling = ML.FindMilling( sMillType, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown, bExcludeH2, nil, 'Longest')
sMchExt = ''
end
if not sMilling then
local sErr = 'Radius too small : Error on DtMortise ' .. tostring( Proc.Id)
EgtOutLog( sErr)
return false, sErr
end
if not sMilling then
local sErr = 'Error : DtMortise Depth bigger than Tool Cutting edge'
EgtOutLog( sErr)
return false, sErr
end
-- riassegno dati utensile
dToolDiam = 100
dMaxMat = 30
dSideAng = 0
bCW = true
bMillOnAggregate = sMchExt == '_AT'
if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
dToolDiam = max( dToolDiam, 10)
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
dSideAng = EgtTdbGetCurrToolParam( MCH_TP.SIDEANG) or dSideAng
local dSpeed = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) or 0
bCW = ( dSpeed >= 0)
end
end
bMultipleZPasses = true
end end
-- tastatura se richiesta
local Info = { vtProbe = vtExtr, ptProbe = ptBC, sType = 'DTMortise', sHead = sHeadTool}
local bProbeExecuted, sErr = Probe.Make( Proc, nPartId, Info)
-- se con tasca, la lavoro (mai in doppio) -- se con tasca, la lavoro (mai in doppio)
if bPocket then if bPocket then
-- recupero il contorno della tasca (seconda curva ausiliaria) -- recupero il contorno della tasca (seconda curva ausiliaria)
local vAuxId = EgtGetInfo( Proc.Id, 'AUXID', 'vi') local sVal = EgtGetInfo( Proc.Id, 'AUXID')
local vsAuxId = EgtSplitString( sVal)
local Aux2Id local Aux2Id
if vAuxId and #vAuxId >=2 then if vsAuxId and #vsAuxId >=2 then
Aux2Id = vAuxId[2] Aux2Id = tonumber( vsAuxId[2])
end end
if Aux2Id then Aux2Id = Aux2Id + Proc.Id end if Aux2Id then Aux2Id = Aux2Id + Proc.Id end
if not Aux2Id or ( EgtGetType( Aux2Id) & GDB_FY.GEO_CURVE) == 0 then if not Aux2Id or ( EgtGetType( Aux2Id) & GDB_FY.GEO_CURVE) == 0 then
@@ -425,9 +334,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ Aux2Id, -1}}) EgtSetMachiningGeometry( {{ Aux2Id, -1}})
-- dichiaro non si generano sfridi per VMill -- dichiaro non si generano sfridi per VMill
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;'
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dMaxMat - 0.1, 1))
sUserNotes = EgtSetValInNotes( sUserNotes, 'VMRS', 0)
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
@@ -438,20 +345,11 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
-- eventuale calcolo SCC -- eventuale calcolo SCC
local nSCC local nSCC
if BD.TURN then if BD.TURN and not bPocket then
if not bPocket then if abs( vtAx:getY()) > abs( vtAx:getZ()) then
if abs( vtAx:getY()) > abs( vtAx:getZ()) then nSCC = EgtIf( vtAx:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
nSCC = EgtIf( vtAx:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM) else
else nSCC = EgtIf( vtAx:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
nSCC = EgtIf( vtAx:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
end
end
-- se aggregato e rivolto verso Z-, si accede da lato aperto
elseif bMillOnAggregate and AreSameVectorApprox( vtExtr, -Z_AX()) then
if Proc.AffectedFaces.Back then
nSCC = MCH_SCC.ADIR_YP
elseif Proc.AffectedFaces.Front then
nSCC = MCH_SCC.ADIR_YM
end end
end end
-- flag di mirror precedente aggiornabile localmente -- flag di mirror precedente aggiornabile localmente
@@ -466,103 +364,93 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
return false, sErr return false, sErr
end end
-- calcolo il percorso top mortise -- calcolo il percorso top mortise
local nAuxId1 = CalcPathAtHeight( Proc.Id, AuxId, nAddGrpId, dAltMort, dSideAng, b3Solid) local nAuxId1 = CalcTopPath( Proc.Id, AuxId, nAddGrpId, dAltMort, dSideAng, b3Solid)
-- se esiste il percorso -- se esiste il percorso
if nAuxId1 then if nAuxId1 then
if EgtCurveIsFlat( nAuxId1) then -- creo percorso sulla parte alta della mortasa
-- creo percorso sulla parte alta della mortasa local dToolRadDelta = dAltMort * tan( dSideAng)
local dToolRadDelta = dAltMort * tan( dSideAng) local dTopDiam = dToolDiam + 2 * dToolRadDelta
local dTopDiam = dToolDiam + 2 * dToolRadDelta -- recupero punto iniziale e finale del percorso
-- recupero punto iniziale e finale del percorso local ptStart = EgtSP( nAuxId1, GDB_RT.GLOB)
local ptStart = EgtSP( nAuxId1, GDB_RT.GLOB) local ptEnd = EgtEP( nAuxId1, GDB_RT.GLOB)
local ptEnd = EgtEP( nAuxId1, GDB_RT.GLOB) if ptStart and ptEnd then
if ptStart and ptEnd then local nId1
local nId1 -- se richiesti due segmenti di linea
-- se richiesti due segmenti di linea if not bMakeAsByArc then
if not bMakeAsByArc then -- determino il punto comune dei due segmenti
-- determino il punto comune dei due segmenti local vtDelta = ( ptEnd - ptStart) / 4
local vtDelta = ( ptEnd - ptStart) / 4 vtDelta:rotate( vtExtr, -90)
vtDelta:rotate( vtExtr, -90) local ptMid = ( ptStart + ptEnd) / 2 + vtDelta
local ptMid = ( ptStart + ptEnd) / 2 + vtDelta -- creo la spezzata formata dai due segmenti
-- creo la spezzata formata dai due segmenti nId1 = EgtCurveCompoFromPoints( nAddGrpId, { ptStart, ptMid, ptEnd}, GDB_RT.GLOB)
nId1 = EgtCurveCompoFromPoints( nAddGrpId, { ptStart, ptMid, ptEnd}, GDB_RT.GLOB) -- altrimenti richiesto arco
-- altrimenti richiesto arco
else
-- direzione del segmento
local vtDir = ptEnd - ptStart ;
local dLen = vtDir:len()
vtDir:normalize()
-- direzioni tangenti iniziale e finale
local vtStart = EgtSV( nAuxId1, GDB_RT.GLOB)
local vtEnd = EgtEV( nAuxId1, GDB_RT.GLOB)
-- angoli
local dAngStart = acos( vtStart * vtDir)
local dAngEnd = acos( vtEnd * vtDir)
local dMaxAng = min( 30, dAngStart, dAngEnd)
if dLen < dTopDiam then
dMaxAng = min( dMaxAng, asin( dLen / dTopDiam))
end
local vtTg = vtDir ; vtTg:rotate( vtExtr, -dMaxAng)
-- creo l'arco
nId1 = EgtArc2PV( nAddGrpId, ptStart, ptEnd, vtTg, GDB_RT.GLOB)
end
if not nId1 then
local sErr = 'Wrong geometry : Error on DtMortise '
EgtOutLog( sErr)
return false, sErr
end
EgtModifyCurveExtrusion( nId1, vtExtr, GDB_RT.GLOB)
-- inserisco la lavorazione di contornatura anti splint
local sNameF = 'DtMtAS_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sNameF, sMilling)
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nId1, -1}})
-- setto affondamento pari all'altezza della mortsasa
EgtSetMachiningParam( MCH_MP.DEPTH, dAltMort)
-- setto offset radiale con aggiunto un ulteriore allargamento di 1mm
EgtSetMachiningParam( MCH_MP.OFFSR, dToolRadDelta - 1)
-- antischeggia sempre con una passata
if bMultipleZPasses then
EgtSetMachiningParam( MCH_MP.STEP, 0)
end
-- sistemo il lato e la direzione di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT))
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, false, true))
-- se necessario, imposto SCC
if nSCC then
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
end
-- dichiaro non si generano sfridi per VMill
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or ''
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dAltMort, 1))
sUserNotes = EgtSetValInNotes( sUserNotes, 'VMRS', 0)
-- se lavorazione in doppio
if Proc.Double and Proc.Double > 0 then
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double)
if Proc.Double ~= nMyPrevDouble then
nMyPrevDouble = Proc.Double
sUserNotes = EgtSetValInNotes( sUserNotes, 'StartZmax', 2)
end
end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
else else
local sErr = 'Wrong geometry : Error on DtMortise ' .. tostring( Proc.Id) -- direzione del segmento
local vtDir = ptEnd - ptStart ;
local dLen = vtDir:len()
vtDir:normalize()
-- direzioni tangenti iniziale e finale
local vtStart = EgtSV( nAuxId1, GDB_RT.GLOB)
local vtEnd = EgtEV( nAuxId1, GDB_RT.GLOB)
-- angoli
local dAngStart = acos( vtStart * vtDir)
local dAngEnd = acos( vtEnd * vtDir)
local dMaxAng = min( 30, dAngStart, dAngEnd)
if dLen < dTopDiam then
dMaxAng = min( dMaxAng, asin( dLen / dTopDiam))
end
local vtTg = vtDir ; vtTg:rotate( vtExtr, -dMaxAng)
-- creo l'arco
nId1 = EgtArc2PV( nAddGrpId, ptStart, ptEnd, vtTg, GDB_RT.GLOB)
end
if not nId1 then
local sErr = 'Wrong geometry : Error on DtMortise '
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
EgtModifyCurveExtrusion( nId1, vtExtr, GDB_RT.GLOB)
-- inserisco la lavorazione di contornatura anti splint
local sNameF = 'DtMtAS_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sNameF, sMilling)
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nId1, -1}})
-- setto affondamento pari all'altezza della mortsasa
EgtSetMachiningParam( MCH_MP.DEPTH, dAltMort)
-- setto offset radiale con aggiunto un ulteriore allargamento di 1mm
EgtSetMachiningParam( MCH_MP.OFFSR, dToolRadDelta - 1)
-- sistemo il lato e la direzione di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT))
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, false, true))
-- se necessario, imposto SCC
if nSCC then
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
end
-- dichiaro non si generano sfridi per VMill
local sUserNotes = 'MaxElev='.. EgtNumToString( dAltMort, 1) .. '; VMRS=0;'
-- se lavorazione in doppio
if Proc.Double and Proc.Double > 0 then
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double)
if Proc.Double ~= nMyPrevDouble then
nMyPrevDouble = Proc.Double
sUserNotes = EgtSetValInNotes( sUserNotes, 'StartZmax', 2)
end
end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
else else
sWarn = 'Warning : skipped DoveTail mortise antisplint' local sErr = 'Wrong geometry : Error on DtMortise ' .. tostring( Proc.Id)
EgtOutLog( sErr)
return false, sErr
end end
else else
local sErr = 'Wrong geometry : Error on DtMortise ' .. tostring( Proc.Id) local sErr = 'Wrong geometry : Error on DtMortise ' .. tostring( Proc.Id)
@@ -578,23 +466,6 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local nPass = ceil( dDist / ( 1.9 * dToolDiam)) local nPass = ceil( dDist / ( 1.9 * dToolDiam))
local dStep = 0 local dStep = 0
if nPass > 1 then dStep = max( ( dDist - 2 * dToolDiam) / ( 2 * nPass - 2), 0.25 * dToolDiam) end if nPass > 1 then dStep = max( ( dDist - 2 * dToolDiam) / ( 2 * nPass - 2), 0.25 * dToolDiam) end
local dVerticalStep = 0
if bMultipleZPasses then
local dToolVerticalStep = 0
if EgtMdbSetCurrMachining( sMilling) then
dToolVerticalStep = EgtMdbGetCurrMachiningParam( MCH_MP.STEP) or 0
end
if dToolVerticalStep < 10 * GEO.EPS_SMALL then
dToolVerticalStep = dMaxMat / 3
else
dToolVerticalStep = min( dToolVerticalStep, dMaxMat / 3)
end
local VerticalSteps = GetVerticalSteps( dAltMort, dToolVerticalStep)
dVerticalStep = VerticalSteps.StepLength
nPass = VerticalSteps.Count
end
for i = nPass, 1, -1 do for i = nPass, 1, -1 do
-- inserisco la lavorazione di contornatura -- inserisco la lavorazione di contornatura
local sNameF = 'DtMt_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nPass) local sNameF = 'DtMt_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nPass)
@@ -605,80 +476,27 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
return false, sErr return false, sErr
end end
-- aggiungo geometria -- aggiungo geometria
local GeomId = AuxId EgtSetMachiningGeometry( {{ AuxId, -1}})
if ( i > 1) and bMultipleZPasses then
local dCurrentHeight = dAltMort - ( ( nPass - i + 1) * dVerticalStep)
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
local b3MortiseNoPocket = EgtGetBBoxGlob( AuxId, GDB_BB.STANDARD)
GeomId = CalcPathAtHeight( Proc.Id, AuxId, nAddGrpId, dCurrentHeight, dSideAng, b3MortiseNoPocket)
if not GeomId then
local sErr = 'Wrong geometry : Error on DtMortise ' .. tostring( Proc.Id)
EgtOutLog( sErr)
return false, sErr
end
end
EgtSetMachiningGeometry( {{ GeomId, -1}})
-- imposto offset -- imposto offset
local dOffs = ( i - 1) * dStep local dOffs = ( i - 1) * dStep
if bMultipleZPasses then
if i > 1 then
dOffs = 1
else
dOffs = 0
end
end
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs) EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
-- in caso di passate in Z già calcolate lo step deve essere nullo per garantire passate singole
if bMultipleZPasses then
EgtSetMachiningParam( MCH_MP.STEP, 0)
end
-- sistemo il lato e la direzione di lavoro -- sistemo il lato e la direzione di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT)) EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT))
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, false, true)) EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, false, true))
local ptS = EgtSP( AuxId, GDB_ID.ROOT)
local ptE = EgtEP( AuxId, GDB_ID.ROOT)
-- in presenza di pocket imposto dati ingresso e uscita -- in presenza di pocket imposto dati ingresso e uscita
if bPocket then if bPocket then
-- recupero il contorno della tasca (seconda curva ausiliaria)
local vAuxId = EgtGetInfo( Proc.Id, 'AUXID', 'vi')
-- si prende il centro del percorso da svuotare ( non si controlla che sia presente perchè già verificata in precedenza)
local ptPocketCenter = EgtGP( Proc.Id + vAuxId[2], GDB_ID.ROOT)
-- calcolo componente tangente e lineare di ingresso
local vtS = EgtSV( Proc.Id + vAuxId[1], GDB_ID.ROOT) -- vettore entrante percorso
local vtOffS = EgtSV( Proc.Id + vAuxId[1], GDB_ID.ROOT) ; vtOffS:rotate( vtExtr, 90) -- vettore da punto iniziale a centro utensile
local vtStartToCenter = ptPocketCenter - ( ptS + ( vtOffS * ( dToolDiam/2))) -- vettore da centro utensilenel punto iniziale e centro del percorso da svuotare
local dLenStartToCenter = vtStartToCenter:len() -- distanza da centro utensile a centro del percorso da svuotare
local dStartTangComp = abs( vtStartToCenter * vtS) -- prodotto scalare tra vettore entrante e vettore tra centro utensilee percordo da svuotare (componente tangente)
local dStartPerpComp = sqrt( dLenStartToCenter^2 - dStartTangComp^2) -- pitagora tra componente tangente e la lunghezza tra i due centri
-- calcolo componente tangente e lineare di uscita
local vtE = EgtEV( Proc.Id + vAuxId[1], GDB_ID.ROOT)
local vtOffE = EgtEV( Proc.Id + vAuxId[1], GDB_ID.ROOT) ; vtOffE:rotate( vtExtr, 90)
local vtEndToCenter = ptPocketCenter - ( ptE + ( vtOffE * ( dToolDiam/2)))
local dLenEndToCenter = vtEndToCenter:len()
local dEndTangComp = abs( vtEndToCenter * vtE)
local dEndPerpComp = sqrt( dLenEndToCenter^2 - dEndTangComp^2)
EgtSetMachiningParam( MCH_MP.STARTPOS, 5) EgtSetMachiningParam( MCH_MP.STARTPOS, 5)
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.TANGENT) EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.TANGENT)
EgtSetMachiningParam( MCH_MP.LITANG, dStartTangComp) EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.AS_LI)
EgtSetMachiningParam( MCH_MP.LIPERP, dStartPerpComp) EgtSetMachiningParam( MCH_MP.STARTADDLEN, 5)
EgtSetMachiningParam( MCH_MP.LIELEV, 0)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LI.TANGENT)
EgtSetMachiningParam( MCH_MP.LOTANG, dEndTangComp)
EgtSetMachiningParam( MCH_MP.LOPERP, dEndPerpComp)
EgtSetMachiningParam( MCH_MP.LOELEV, 0)
EgtSetMachiningParam( MCH_MP.STARTADDLEN, 0)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, 0) EgtSetMachiningParam( MCH_MP.ENDADDLEN, 0)
EgtSetMachiningParam( MCH_MP.LITANG, dToolDiam / 2)
EgtSetMachiningParam( MCH_MP.LIPERP, 5)
EgtSetMachiningParam( MCH_MP.LIELEV, 0)
-- altrimenti verifico se sono bilanciati ingresso e uscita, per evitare inizio o fine nel legno -- altrimenti verifico se sono bilanciati ingresso e uscita, per evitare inizio o fine nel legno
else else
local ptS = EgtSP( AuxId, GDB_ID.ROOT)
local ptE = EgtEP( AuxId, GDB_ID.ROOT)
local dDistS = abs( ( ptS - rfDtMrt:getOrigin()) * rfDtMrt:getVersX()) local dDistS = abs( ( ptS - rfDtMrt:getOrigin()) * rfDtMrt:getVersX())
local dDistE = abs( ( ptE - rfDtMrt:getOrigin()) * rfDtMrt:getVersX()) local dDistE = abs( ( ptE - rfDtMrt:getOrigin()) * rfDtMrt:getVersX())
local dIni, dFin = EgtCurveDomain( AuxId) local dIni, dFin = EgtCurveDomain( AuxId)
@@ -694,17 +512,11 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
end end
-- se necessario, imposto SCC -- se necessario, imposto SCC
if nSCC then if nSCC then
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
end end
-- dichiaro massima elevazione e assenza sfridi per VMill -- dichiaro massima elevazione e assenza sfridi per VMill
local dMaxElev = dMaxMat local sUserNotes = EgtSetVal( 'MaxElev', EgtNumToString( dMaxMat - 0.1, 1)) .. ';' .. EgtSetVal( 'VMRS', 0) .. ';'
if bMultipleZPasses then
dMaxElev = dVerticalStep
end
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or ''
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dMaxElev - 0.1, 1))
sUserNotes = EgtSetValInNotes( sUserNotes, 'VMRS', 0)
-- in presenza di pocket dichiaro che non sto entrando e uscendo nel grezzo -- in presenza di pocket dichiaro che non sto entrando e uscendo nel grezzo
if bPocket then if bPocket then
sUserNotes = EgtSetValInNotes( sUserNotes, 'OutRaw', 3) sUserNotes = EgtSetValInNotes( sUserNotes, 'OutRaw', 3)
@@ -717,10 +529,6 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
sUserNotes = EgtSetValInNotes( sUserNotes, 'StartZmax', 2) sUserNotes = EgtSetValInNotes( sUserNotes, 'StartZmax', 2)
end end
end end
-- se c'è stata tastatura, si disattiva sull'ultima lavorazione
if bProbeExecuted and i == 1 then
sUserNotes = EgtSetValInNotes( sUserNotes, 'END-PROBE', true)
end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
@@ -729,7 +537,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
return false, sErr return false, sErr
end end
end end
return true, sWarn return true
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
+14 -150
View File
@@ -46,9 +46,9 @@ local function VerifyOrientation( Proc, vtN, b3Raw)
-- se macchina Fast, pezzo stretto e inclinazione laterale non eccessiva, accetto fino a -27deg -- se macchina Fast, pezzo stretto e inclinazione laterale non eccessiva, accetto fino a -27deg
elseif ( not BD.C_SIMM) and abs( vtN:getY()) < 0.5 and b3Raw:getDimY() < 150.1 then elseif ( not BD.C_SIMM) and abs( vtN:getY()) < 0.5 and b3Raw:getDimY() < 150.1 then
return ( vtN:getZ() >= -0.454) return ( vtN:getZ() >= -0.454)
-- altrimenti accetto fino a -23.5deg -- altrimenti accetto fino a -21deg
else else
return ( vtN:getZ() >= -0.399) return ( vtN:getZ() >= -0.359)
end end
-- se trave medio-bassa -- se trave medio-bassa
elseif b3Raw:getDimZ() < 281 then elseif b3Raw:getDimZ() < 281 then
@@ -64,14 +64,14 @@ local function VerifyOrientation( Proc, vtN, b3Raw)
-- se tenone praticamente in asse, accetto fino a -22 deg -- se tenone praticamente in asse, accetto fino a -22 deg
if abs( vtN:getY()) < 0.088 then if abs( vtN:getY()) < 0.088 then
return ( vtN:getZ() >= -0.375) return ( vtN:getZ() >= -0.375)
-- altrimenti, accetto fino a -12.5 deg -- altrimenti, accetto fino a -10 deg
else else
return ( vtN:getZ() >= -0.216) return ( vtN:getZ() >= -0.174)
end end
-- altrimenti -- altrimenti
else else
-- accetto fino a -12.5 deg -- accetto fino a -5deg
return ( vtN:getZ() >= -0.216) return ( vtN:getZ() >= -0.088)
end end
end end
@@ -109,9 +109,8 @@ local function ApplyPocket( Proc, sPocketing, nStep, dSurfStep, nIdSurf, vtExtr)
-- imposto uso faccia -- imposto uso faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT) EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT)
if dSurfStep > 0 then if dSurfStep > 0 then
local sNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or ''
-- imposto elevazione -- imposto elevazione
sNotes = EgtSetValInNotes( sNotes, 'MaxElev', EgtNumToString( dSurfStep, 2)) local sNotes = 'MaxElev=' .. EgtNumToString( dSurfStep, 2) .. ';'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
end end
-- imposto posizione braccio porta testa -- imposto posizione braccio porta testa
@@ -210,20 +209,7 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId} Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc) CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
local bFromBottom = ( b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getZ() > 0.25)
-- se esiste grezzo successivo non serve tagliare dal basso
local bFromBottom
local dTotalLength = 0
local nNextRawId = EgtGetNextRawPart( nRawId)
while nNextRawId do
dTotalLength = dTotalLength + EgtGetRawPartBBox( nNextRawId):getDimX()
nNextRawId = EgtGetNextRawPart( nNextRawId)
end
if dTotalLength > BD.MinRaw and not Proc.Tail then
bFromBottom = false
else
bFromBottom = ( b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getZ() > 0.25)
end
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom) local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
end end
@@ -250,32 +236,11 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCW = ( dSpeed >= 0) bCW = ( dSpeed >= 0)
end end
end end
-- se necessario, cerco un utensile più lungo -- verifico che l'altezza non superi il massimo materiale dell'utensile
if dDtTenH > dMaxMat + 10 * GEO.EPS_SMALL then if dDtTenH > dMaxMat + 10 * GEO.EPS_SMALL then
sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown and not bMillUp, '_H2', ''), nil, nil, nil, nil, bMillUp, bMillDown, nil, nil, 'Longest') local sErr = 'Error : DtTenon Height bigger than Tool Cutting edge'
if not sMilling then EgtOutLog( sErr)
local sErr = 'Error : milling not found in library' return false, sErr
EgtOutLog( sErr)
return false, sErr
end
if not sMilling then
local sErr = 'Error : DtTenon Height bigger than Tool Cutting edge'
EgtOutLog( sErr)
return false, sErr
end
-- riassegno dati utensile
dTDiam = 50
dMaxMat = 30
bCW = true
if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dTDiam
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
local dSpeed = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) or 0
bCW = ( dSpeed >= 0)
end
end
end end
-- calcolo distanza massima della curva dal punto più lontano della base tenone Dt (facet 0) -- calcolo distanza massima della curva dal punto più lontano della base tenone Dt (facet 0)
local dMaxDist local dMaxDist
@@ -323,8 +288,7 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- sistemo i parametri -- sistemo i parametri
local dOffs = ( i - 1) * dStep local dOffs = ( i - 1) * dStep
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs) EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' local sUserNotes = EgtSetVal( 'MaxElev', EgtNumToString( dDtTenH, 1)) .. ';'
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dDtTenH, 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- sistemo il lato e la direzione di lavoro -- sistemo il lato e la direzione di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT)) EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT))
@@ -367,108 +331,8 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
BL.UpdateTCING( nRawId, dOffs) BL.UpdateTCING( nRawId, dOffs)
end end
end end
-- si controllano le ultime 5 facce della feature
local nIndFace = -1
for i = 1, 5 do
if abs( vtExtr * EgtSurfTmFacetNormVersor( Proc.Id, Proc.Fct-i, GDB_ID.ROOT)) < GEO.EPS_ANG_SMALL then
nIndFace = Proc.Fct-i
end
end
-- controllo se serve passaggio di finitura in caso il tenone non cominci dal bordo della trave (P14 > 0)
if nIndFace > 0 then
-- verifico se almeno uno dei punti iniziale e finale della curva giace in uno dei piani limite del pezzo, quindi se è un lato aperto
local bOpen = false
local ptIni = EgtSP( AuxId, GDB_RT.GLOB)
local ptFin = EgtEP( AuxId, GDB_RT.GLOB)
if ( abs( ptIni:getX() - b3Solid:getMax():getX()) < 100 * GEO.EPS_SMALL or abs( ptFin:getX() - b3Solid:getMax():getX()) < 100 * GEO.EPS_SMALL) or
( abs( ptIni:getX() - b3Solid:getMin():getX()) < 100 * GEO.EPS_SMALL or abs( ptFin:getX() - b3Solid:getMin():getX()) < 100 * GEO.EPS_SMALL) or
( abs( ptIni:getY() - b3Solid:getMax():getY()) < 100 * GEO.EPS_SMALL or abs( ptFin:getY() - b3Solid:getMax():getY()) < 100 * GEO.EPS_SMALL) or
( abs( ptIni:getY() - b3Solid:getMin():getY()) < 100 * GEO.EPS_SMALL or abs( ptFin:getY() - b3Solid:getMin():getY()) < 100 * GEO.EPS_SMALL) or
( abs( ptIni:getZ() - b3Solid:getMax():getZ()) < 100 * GEO.EPS_SMALL or abs( ptFin:getZ() - b3Solid:getMax():getZ()) < 100 * GEO.EPS_SMALL) or
( abs( ptIni:getZ() - b3Solid:getMin():getZ()) < 100 * GEO.EPS_SMALL or abs( ptFin:getZ() - b3Solid:getMin():getZ()) < 100 * GEO.EPS_SMALL) then
bOpen = true
end
-- se entrambi i punti non sono sul limite pezzo
if not bOpen then
-- recupero la lavorazione
sMillType = 'Tenon'
sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown and not bMillUp, '_H2', ''), nil, nil, nil, nil, bMillUp, bMillDown)
if not sMilling then
local sErr = 'Error : milling to finish the tenon not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati dell'utensile
if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dTDiam
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
local dSpeed = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) or 0
bCW = ( dSpeed >= 0)
end
-- inserisco la passata finale della lavorazione
local sNameF = 'TenF_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sNameF, sMilling)
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, nIndFace}})
-- sistemo i parametri
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH')
-- sistemo il lato e la direzione di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT))
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false))
EgtSetMachiningParam( MCH_MP.LITANG, 0.7 * dTDiam)
EgtSetMachiningParam( MCH_MP.LIPERP, 20)
EgtSetMachiningParam( MCH_MP.LOTANG, 0.7 * dTDiam)
EgtSetMachiningParam( MCH_MP.LOPERP, 20)
local nFaceUse
if vtExtr:getX() > -GEO.EPS_SMALL then
nFaceUse = MCH_MILL_FU.PARAL_LEFT
else
nFaceUse = MCH_MILL_FU.PARAL_RIGHT
end
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- imposto elevazione
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or ''
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dDtTenH, 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE
if BD.TURN then
if abs( vtAx:getY()) > abs( vtAx:getZ()) then
nSCC = EgtIf( vtAx:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
else
nSCC = EgtIf( vtAx:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
end
elseif not BD.C_SIMM then
nSCC = MCH_SCC.ADIR_YM
if abs( vtExtr:getY()) > 0.088 then
nSCC = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
end
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
end
end
return true return true
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
return ProcessDtTenon return ProcessDtTenon
+18 -89
View File
@@ -29,13 +29,10 @@ local ML = require( 'MachiningLib')
local Q_DIM_STRIP = 'Q01' -- d local Q_DIM_STRIP = 'Q01' -- d
local Q_DEPTH_CHAMFER = 'Q02' -- d local Q_DEPTH_CHAMFER = 'Q02' -- d
local Q_OVERMAT_FOR_FINISH = 'Q03' -- d local Q_OVERMAT_FOR_FINISH = 'Q03' -- d
local Q_ONLY_CONTOUR = 'Q04' -- i, valido solo per drill
local Q_ONLY_CHAMFER = 'Q00' -- i local Q_ONLY_CHAMFER = 'Q00' -- i
local Q_RADIAL_OFFSET = 'Q06' -- d, valido solo per pocket local Q_RADIAL_OFFSET = 'Q06' -- d, valido solo per pocket
local Q_IGNORE_LASER_PROBLEMS = 'Q07' local Q_IGNORE_LASER_PROBLEMS = 'Q07'
local Q_FORCE_CLAMPABLE_AREA = 'Q08' local Q_FORCE_CLAMPABLE_AREA = 'Q08'
local Q_INVERT_LAST_PATH = 'Q09'
local Q_MAX_ELEVATION = 'Q10' -- d
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Riconoscimento della feature -- Riconoscimento della feature
@@ -186,8 +183,6 @@ local function VerifyChamfer( Proc, AuxId, nRawId, bMakeVertCham, bDownHead)
EgtOutLog( sErr) EgtOutLog( sErr)
return -1, 0, sErr return -1, 0, sErr
end end
else
sMilling = ''
end end
return nChamfer, dDepth, sMilling return nChamfer, dDepth, sMilling
@@ -239,7 +234,6 @@ end
local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead) local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- recupero l'ingombro del grezzo di appartenenza -- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
local bContourFromDrill = EgtGetInfo( Proc.Id, Q_ONLY_CONTOUR, 'i') == 1
-- ingombro del pezzo -- ingombro del pezzo
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box') local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD) local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
@@ -264,7 +258,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- verifico se in testa o coda -- verifico se in testa o coda
local bHead = Proc.Head local bHead = Proc.Head
-- verifico i parametri Q per profondità smusso e per eseguirlo in esclusiva -- verifico i parametri Q per profondità smusso e per eseguirlo in esclusiva
local nChamfer, dDepthCham, sChamfer = VerifyChamfer( Proc, AuxId, nRawId, true, nil) local nChamfer, dDepthCham, sChamfer = VerifyChamfer( Proc, AuxId, nRawId, true)
-- recupero la lavorazione -- recupero la lavorazione
local bTopHead = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.1) local bTopHead = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.1)
local bDownHead = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1) local bDownHead = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1)
@@ -476,9 +470,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
-- posizione braccio porta testa -- posizione braccio porta testa
local nSCC = MCH_SCC.NONE local nSCC = MCH_SCC.NONE
if BD.TURN == 2 then if not BD.C_SIMM then
nSCC = MCH_SCC.ADIR_ZP
elseif not BD.C_SIMM then
if Proc.Head then if Proc.Head then
nSCC = MCH_SCC.ADIR_XP nSCC = MCH_SCC.ADIR_XP
elseif Proc.Tail then elseif Proc.Tail then
@@ -546,9 +538,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
-- posizione braccio porta testa -- posizione braccio porta testa
local nSCC = MCH_SCC.NONE local nSCC = MCH_SCC.NONE
if BD.TURN == 2 then if not BD.C_SIMM then
nSCC = MCH_SCC.ADIR_ZP
elseif not BD.C_SIMM then
if Proc.Head then if Proc.Head then
nSCC = MCH_SCC.ADIR_XP nSCC = MCH_SCC.ADIR_XP
elseif Proc.Tail then elseif Proc.Tail then
@@ -598,8 +588,6 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
end end
end end
-- eventuale inversione ultimo segmento
local bInvertLastPath = ( ( EgtGetInfo( Proc.Id, Q_INVERT_LAST_PATH, 'd') or 0) == 1)
-- eseguo -- eseguo
for i = 1, nStep do for i = 1, nStep do
for j = 1, nDouble do for j = 1, nDouble do
@@ -636,95 +624,44 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- eventuale elevazione forzata
local dCustomMaxElev = EgtGetInfo( Proc.Id, Q_MAX_ELEVATION, 'd')
if dCustomMaxElev and dCustomMaxElev < 1 then dCustomMaxElev = nil end
if dCustomMaxElev then
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or ''
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dCustomMaxElev, 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
end
-- assegno affondamento -- assegno affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
end end
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}}) EgtSetMachiningGeometry( {{ AuxId, -1}})
-- eventuale accorciamento di testa -- eventuale accorciamento di testa
local dStartAddLen, dEndAddLen, dWorkSide, bToolInvert, bInvert
if ( j == 1 and i > 1) or ( j == 2 and i < nStep) then if ( j == 1 and i > 1) or ( j == 2 and i < nStep) then
dStartAddLen = EgtIf( j == 1, - ( i - 1) * dStep, - ( nStep - i) * dStep) local dStartAddLen = EgtIf( j == 1, - ( i - 1) * dStep, - ( nStep - i) * dStep)
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dStartAddLen)
else else
dStartAddLen = EgtIf( j == 1, dStartAddSpec, dEndAddSpec) EgtSetMachiningParam( MCH_MP.STARTADDLEN, EgtIf( j == 1, dStartAddSpec, dEndAddSpec))
end end
-- eventuale accorciamento di coda -- eventuale accorciamento di coda
if ( j == 1 and i < nStep) or ( j == 2 and i > 1) then if ( j == 1 and i < nStep) or ( j == 2 and i > 1) then
dEndAddLen = EgtIf( j == 1, - ( nStep - i) * dStep, - ( i - 1) * dStep) local dEndAddLen = EgtIf( j == 1, - ( nStep - i) * dStep, - ( i - 1) * dStep)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
else else
dEndAddLen = EgtIf( j == 1, dEndAddSpec, dStartAddSpec) EgtSetMachiningParam( MCH_MP.ENDADDLEN, EgtIf( j == 1, dEndAddSpec, dStartAddSpec))
end end
-- se estrusione da sotto, inverto direzione fresa -- se estrusione da sotto, inverto direzione fresa
if ( j == 1 and bToolInv) or ( j == 2 and not bToolInv) then if ( j == 1 and bToolInv) or ( j == 2 and not bToolInv) then
bToolInvert = true EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
else
bToolInvert = false
end end
-- se seconda passata, inverto direzione di lavoro -- se seconda passata, inverto direzione di lavoro
if j == 2 then if j == 2 then
bInvert = true EgtSetMachiningParam( MCH_MP.INVERT, true)
else
bInvert = false
end end
-- assegno lato di lavoro -- assegno lato di lavoro
if bContourFromDrill then if Proc.Grp == 0 then
dWorkSide = MCH_MILL_WS.LEFT EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.CENTER)
elseif Proc.Grp == 0 then
dWorkSide = MCH_MILL_WS.CENTER
elseif ( Proc.Grp == 3 and not bToolInv) or ( Proc.Grp == 4 and bToolInv) or ( Proc.Grp == 1 and bToolInv) or ( Proc.Grp == 2 and bToolInv) then elseif ( Proc.Grp == 3 and not bToolInv) or ( Proc.Grp == 4 and bToolInv) or ( Proc.Grp == 1 and bToolInv) or ( Proc.Grp == 2 and bToolInv) then
dWorkSide = MCH_MILL_WS.LEFT EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
elseif ( Proc.Grp == 3 and bToolInv) or ( Proc.Grp == 4 and not bToolInv) or ( Proc.Grp == 1 and not bToolInv) or ( Proc.Grp == 2 and not bToolInv) then elseif ( Proc.Grp == 3 and bToolInv) or ( Proc.Grp == 4 and not bToolInv) or ( Proc.Grp == 1 and not bToolInv) or ( Proc.Grp == 2 and not bToolInv) then
dWorkSide = MCH_MILL_WS.RIGHT EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
end end
-- se ultimo step da invertire
if i == nStep and bInvertLastPath then
-- se profilo orizzontale
if abs( vtExtr:getZ()) < 10 * GEO.EPS_SMALL then
dStartAddLen, dEndAddLen = dEndAddLen, dStartAddLen
bInvert = not( bInvert)
bToolInvert = not( bToolInvert)
else
dStartAddLen, dEndAddLen = dEndAddLen, dStartAddLen
bInvert = not( bInvert)
if dWorkSide == MCH_MILL_WS.LEFT then
dWorkSide = MCH_MILL_WS.RIGHT
elseif dWorkSide == MCH_MILL_WS.RIGHT then
dWorkSide = MCH_MILL_WS.LEFT
end
end
end
-- setto i valori
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dStartAddLen)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
EgtSetMachiningParam( MCH_MP.TOOLINVERT, bToolInvert)
EgtSetMachiningParam( MCH_MP.INVERT, bInvert)
EgtSetMachiningParam( MCH_MP.WORKSIDE, dWorkSide)
-- setto valori specifici se lavorazione nel pieno del solo contorno di un foro
if bContourFromDrill then
local dWorkStep = max( ( EgtGetMachiningParam( MCH_MP.STEP) or 0) * 0.75, dToolDiam)
EgtSetMachiningParam( MCH_MP.STEP, dWorkStep)
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.GLIDE)
EgtSetMachiningParam( MCH_MP.LIELEV, dWorkStep)
EgtSetMachiningParam( MCH_MP.LITANG, dWorkStep)
end
-- posizione braccio porta testa -- posizione braccio porta testa
local nSCC = MCH_SCC.NONE local nSCC = MCH_SCC.NONE
if BD.TURN == 2 then if not BD.C_SIMM then
nSCC = MCH_SCC.ADIR_ZP
elseif not BD.C_SIMM then
if Proc.Head then if Proc.Head then
nSCC = MCH_SCC.ADIR_XP nSCC = MCH_SCC.ADIR_XP
elseif Proc.Tail then elseif Proc.Tail then
@@ -855,9 +792,7 @@ local function MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra) EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
-- posizione braccio porta testa -- posizione braccio porta testa
local nSCC = MCH_SCC.NONE local nSCC = MCH_SCC.NONE
if BD.TURN == 2 then if not BD.C_SIMM then
nSCC = MCH_SCC.ADIR_ZP
elseif not BD.C_SIMM then
if Proc.Head then if Proc.Head then
nSCC = MCH_SCC.ADIR_XP nSCC = MCH_SCC.ADIR_XP
elseif Proc.Tail then elseif Proc.Tail then
@@ -920,9 +855,7 @@ local function MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- imposto elevazione -- imposto elevazione
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxDepth, 1) .. ';')
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dMaxDepth, 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- imposto eventuale offset radiale, se impostato dall'utente -- imposto eventuale offset radiale, se impostato dall'utente
local dRadialOffset = EgtGetInfo( Proc.Id, Q_RADIAL_OFFSET, 'd') or 0 local dRadialOffset = EgtGetInfo( Proc.Id, Q_RADIAL_OFFSET, 'd') or 0
if abs( dRadialOffset) > 10 * GEO.EPS_SMALL then if abs( dRadialOffset) > 10 * GEO.EPS_SMALL then
@@ -1018,10 +951,6 @@ function ProcessFreeContour.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
Q_DEPTH_CHAMFER = 'Q01' Q_DEPTH_CHAMFER = 'Q01'
Q_DIM_STRIP = 'Q02' Q_DIM_STRIP = 'Q02'
end end
if Proc.Prc == 40 then
Q_DIM_STRIP = ''
Q_OVERMAT_FOR_FINISH = ''
end
-- recupero la tipologia -- recupero la tipologia
local bPocket = ( EgtGetInfo( Proc.Id, 'PCKT', 'i') == 1) local bPocket = ( EgtGetInfo( Proc.Id, 'PCKT', 'i') == 1)
-- se svuotatura -- se svuotatura
+21 -146
View File
@@ -159,115 +159,9 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
return true, nil return true, nil
end end
---------------------------------------------------------------------
-- smussi in testa
local function MakeHeadChamfer( idProc, nPartId)
local dDepthHeadChamfer = EgtGetInfo( idProc, 'Q08', 'd') or 0
-- se non attivo esco subito
if dDepthHeadChamfer < 100 * GEO.EPS_SMALL then
return
end
-- recupero gruppo per geometria aggiuntiva
local AddGrpId = BL.GetAddGroup( nPartId)
if not AddGrpId then
local sErr = 'Error on process StartFace impossible to find AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- recupero la lavorazione
local sMilling = ML.FindMilling( 'Mark')
if not sMilling then
local sErr = 'Error : milling not found in library'
EgtOutLog( sErr)
return false, sErr
end
local nLoopId, nLoopCnt = EgtExtractSurfTmFacetLoops( idProc, 0, AddGrpId)
if not nLoopId or nLoopCnt > 1 then
local sErr = 'Error MakeHeadChamfer : too many loops'
EgtOutLog( sErr)
return false, sErr
end
-- setto direzione estrusione corretta
EgtModifyCurveExtrusion( nLoopId, X_AX())
EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.RIGHT))
local dQ09Value = EgtGetInfo( idProc, 'Q09', 'd')
if not dQ09Value then
dQ09Value = 0.1
end
local bChamferedEdge = dQ09Value > 0
dQ09Value = EgtIf( bChamferedEdge, max( dQ09Value, 0.1), min( dQ09Value, -0.1))
local nIdFirstEntity, nEntityCnt = EgtExplodeCurveCompo( nLoopId)
local p3MidPoint = EgtMP( nIdFirstEntity, GDB_ID.GRID)
for i = 0, nEntityCnt - 1 do
if EgtCurveLength( nIdFirstEntity + i) - 10 < abs( dQ09Value) * 2 then
local sErr = 'Error MakeHeadChamfer : Q09 too high'
EgtOutLog( sErr)
return false, sErr
end
end
-- creo raccordo o fillet
for i = 0, nEntityCnt - 1 do
local idFirst = nIdFirstEntity + i
local idSecond = EgtIf( i == nEntityCnt - 1, nIdFirstEntity, idFirst + 1)
local ptEndPointFirst = EgtEP( idFirst, GDB_ID.GRID) - ( abs( dQ09Value) * EgtEV( idFirst, GDB_ID.GRID))
local ptStartPointSecond = EgtSP( idSecond, GDB_ID.GRID) + ( abs( dQ09Value) * EgtEV( idSecond, GDB_ID.GRID))
if bChamferedEdge then
EgtCurveChamfer( AddGrpId, idFirst, ptEndPointFirst, idSecond, ptStartPointSecond, abs( dQ09Value), true, GDB_RT.GRID)
else
EgtCurveFillet( AddGrpId, idFirst, ptEndPointFirst, idSecond, ptStartPointSecond, abs( dQ09Value), true, GDB_RT.GRID)
end
end
EgtSelectPathObjs( nIdFirstEntity, true)
local idGeom, idGeomCnt = EgtCurveCompoByChain( AddGrpId, GDB_ID.SEL, {0,0,0}, true)
if not idGeom or idGeomCnt > 1 then
local sErr = 'Error MakeHeadChamfer : too many loops'
EgtOutLog( sErr)
return false, sErr
end
EgtChangeClosedCurveStartPoint( idGeom, p3MidPoint, GDB_RT.GRID)
-- reimposto la griglia
EgtSetGridFrame()
-- Inserisco la lavorazione del lato standard
local dExtra = 2
local sName1 = 'HeadCham_' .. ( EgtGetName( idProc) or tostring( idProc))
local nMch1Id = EgtAddMachining( sName1, sMilling)
if not nMch1Id then
local sErr = 'Error adding machining ' .. sName1 .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ idGeom, -1}})
-- assegno affondamento e offset radiale
EgtSetMachiningParam( MCH_MP.DEPTH, dDepthHeadChamfer + dExtra)
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch1Id, false)
return false, sErr
end
return true, nil
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- tagli verticali aggiuntivi -- tagli verticali aggiuntivi
local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw, dOffsetBetweenCuts) local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw)
local nVerticalCuts = ceil( Proc.Face[1].WidthTrimmed / ( BD.MAX_LEN_DICE)) - 1 local nVerticalCuts = ceil( Proc.Face[1].WidthTrimmed / ( BD.MAX_LEN_DICE)) - 1
local dVerticalSliceHeight = Proc.Face[1].WidthTrimmed / ( nVerticalCuts + 1) local dVerticalSliceHeight = Proc.Face[1].WidthTrimmed / ( nVerticalCuts + 1)
-- recupero il diametro dell'utensile -- recupero il diametro dell'utensile
@@ -283,8 +177,8 @@ local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw, dOffsetBe
for j = nVerticalCuts, 1, -1 do for j = nVerticalCuts, 1, -1 do
local nFaceUse = MCH_MILL_FU.PARAL_FRONT local nFaceUse = MCH_MILL_FU.PARAL_FRONT
local dVerticalCutOffset = dVerticalSliceHeight * -j local dVerticalCutOffset = dVerticalSliceHeight * -j
local sLeadInOutType = 'PerpendicularOutraw' local bForceTangentLeadInOut = BD.PRESS_ROLLER and not BD.DOWN_HEAD
bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, '', b3Raw, nil, nil, nil, sLeadInOutType, nil, dOffsetBetweenCuts) bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, '', b3Raw, nil, nil, nil, bForceTangentLeadInOut)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
end end
@@ -346,8 +240,8 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCut
for j = nHorizontalCuts, 1, -1 do for j = nHorizontalCuts, 1, -1 do
local nFaceUse = MCH_MILL_FU.PARAL_DOWN local nFaceUse = MCH_MILL_FU.PARAL_DOWN
local dHorizontalCutOffset = dHorizontalSliceHeight * -j local dHorizontalCutOffset = dHorizontalSliceHeight * -j
local sLeadInOutType = 'PerpendicularOutraw' local bForceTangentLeadInOut = BD.PRESS_ROLLER
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dHorizontalCutOffset, 0, 0, '', b3Raw, nil, nil, nil, sLeadInOutType, nil, dOffsetBetweenCuts) local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dHorizontalCutOffset, 0, 0, '', b3Raw, nil, nil, nil, bForceTangentLeadInOut)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
end end
-- se necessario taglio verticale doppio, eseguo l'opposto -- se necessario taglio verticale doppio, eseguo l'opposto
@@ -390,7 +284,7 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCut
local dCutOffset = ( i - 1) * dOffsetBetweenCuts local dCutOffset = ( i - 1) * dOffsetBetweenCuts
-- se trave larga effettuo tagli verticali aggiuntivi -- se trave larga effettuo tagli verticali aggiuntivi
if HeadCutType.bNeedVerticalAddedCuts then if HeadCutType.bNeedVerticalAddedCuts then
local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw, dOffsetBetweenCuts) local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
end end
if i == 1 and HeadCutType.sType =='Precut' then if i == 1 and HeadCutType.sType =='Precut' then
@@ -446,7 +340,7 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCut
end end
-- se trave larga effettuo tagli verticali aggiuntivi -- se trave larga effettuo tagli verticali aggiuntivi
if HeadCutType.bNeedVerticalAddedCuts then if HeadCutType.bNeedVerticalAddedCuts then
local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw, dOffsetBetweenCuts) local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
end end
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, MCH_MILL_FU.ORTHO_DOWN, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw) local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, MCH_MILL_FU.ORTHO_DOWN, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw)
@@ -471,15 +365,7 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
-- eventuali informazioni sul tipo di finitura -- eventuali informazioni sul tipo di finitura
local nQ05 = EgtGetInfo( nOriId or GDB_ID.NULL, 'Q05', 'i') or 0 local nQ05 = EgtGetInfo( nOriId or GDB_ID.NULL, 'Q05', 'i') or 0
-- recupero la lavorazione -- recupero la lavorazione
-- TODO questa parte andrà cambiata quando si gestiranno i volumi liberi in cui girare da mlse local sCutting = ML.FindCutting( 'HeadSide')
local dMinWidthForBigBlade = 300
local dMaxHeightForBigBlade = 300
local sCutting
if b3Raw:getDimY() > dMinWidthForBigBlade and b3Raw:getDimZ() < dMaxHeightForBigBlade then
sCutting = ML.FindCutting( 'HeadSide', nil, nil, nil, 'Longest')
else
sCutting = ML.FindCutting( 'HeadSide')
end
if not sCutting then if not sCutting then
local sErr = 'Error : cutting not found in library' local sErr = 'Error : cutting not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -512,23 +398,17 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
dSawThick2 = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick2 dSawThick2 = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick2
end end
end end
-- determino se lo spessore del materiale da rimuovere è eccessivo e quindi vanno fatti più tagli con offset
local nCuts = max( ceil( dOvmHead / (( BD.MAX_LEN_SCRAP_START or BD.MAX_LEN_SCRAP) + 0.5)), 1)
local dOffsL = dOvmHead / nCuts
-- caratteristiche taglio -- caratteristiche taglio
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM)) local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM))
local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and
( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dMaxDepth2) - 2 * BD.CUT_EXTRA + 10 * GEO.EPS_SMALL) ( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dMaxDepth2) - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bHorizCut = ( ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA) local bHorizCut = ( ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA)
local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL) and local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
( b3Raw:getDimY() < 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
-- verifico necessità di tagli aggiuntivi orizzontali o verticali -- verifico necessità di tagli aggiuntivi orizzontali o verticali
local dMinOvmHeadForAddeddCuts = 10.123 local dMinOvmHeadForAddeddCuts = 10.123
local bNeedVerticalAddedCuts = ( Proc.Face[1].WidthTrimmed > BD.MAX_LEN_DICE) and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) local bNeedVerticalAddedCuts = ( Proc.Face[1].WidthTrimmed > BD.MAX_LEN_DICE) and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL)
local bNeedHorizontalAddedCuts = ( Proc.Face[1].HeightTrimmed > ( BD.MIN_HEIGHT_ADDED_CUTS or BD.MAX_LEN_DICE)) and local bNeedHorizontalAddedCuts = ( Proc.Face[1].HeightTrimmed > ( BD.MIN_HEIGHT_ADDED_CUTS or BD.MAX_LEN_DICE)) and not bBigSectionCut and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL)
not bBigSectionCut and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) and
dOffsL < BD.MAX_DIM_DICE
-- dati lavorazioni sopra e sotto -- dati lavorazioni sopra e sotto
local Cutting1Data = { sCutting = sCutting, dSawDiam = dSawDiam, dMaxDepth = dMaxDepth, dSawThick = dSawThick, dMaxVertDepth = dMaxVertDepth} local Cutting1Data = { sCutting = sCutting, dSawDiam = dSawDiam, dMaxDepth = dMaxDepth, dSawThick = dSawThick, dMaxVertDepth = dMaxVertDepth}
local Cutting2Data = { sCutting = sCutting2, dSawDiam = dSawDiam2, dMaxDepth = dMaxDepth2, dSawThick = dSawThick2} local Cutting2Data = { sCutting = sCutting2, dSawDiam = dSawDiam2, dMaxDepth = dMaxDepth2, dSawThick = dSawThick2}
@@ -540,6 +420,9 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
if not bNeedHCut and AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Raw:getMax():getX()) < 10 * GEO.EPS_SMALL then if not bNeedHCut and AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Raw:getMax():getX()) < 10 * GEO.EPS_SMALL then
return true return true
end end
-- determino se lo spessore del materiale da rimuovere è eccessivo e quindi vanno fatti più tagli con offset
local nCuts = max( ceil( dOvmHead / (( BD.MAX_LEN_SCRAP_START or BD.MAX_LEN_SCRAP) + 0.5)), 1)
local dOffsL = dOvmHead / nCuts
-- se taglio per sezioni alte e larghe -- se taglio per sezioni alte e larghe
if bBigSectionCut then if bBigSectionCut then
if dOvmHead > 0 then if dOvmHead > 0 then
@@ -604,16 +487,18 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
if AreSameVectorApprox( X_AX(), vtNLimitingSurf) then EgtInvertSurf( nLimitingSurf) end if AreSameVectorApprox( X_AX(), vtNLimitingSurf) then EgtInvertSurf( nLimitingSurf) end
end end
-- tagli verticali -- tagli verticali
bOk, sErr = AddVerticalPreCuts( AddProc, sCutting, 0, b3Raw, dOffsL) bOk, sErr = AddVerticalPreCuts( AddProc, sCutting, 0, b3Raw)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
-- tagli a cubetti con eventuale superficie limitante -- tagli a cubetti con eventuale superficie limitante
local sLeadInOutType = 'PerpendicularOutraw' bOk, sErr = Cut.Make( AddProc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, nil, nil, nLimitingSurf)
bOk, sErr = Cut.Make( AddProc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, nil, nil, nLimitingSurf, sLeadInOutType)
end end
-- tagli aggiuntivi non necessari -- tagli aggiuntivi non necessari
else else
local sLeadInOutType = 'PerpendicularOutraw' local bForceTangentLeadInOut = false
bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, nil, nil, nil, sLeadInOutType) if BD.PRESS_ROLLER then
bForceTangentLeadInOut = true
end
bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, nil, nil, nil, bForceTangentLeadInOut)
end end
return bOk, sErr return bOk, sErr
end end
@@ -639,16 +524,6 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
local bOk, sErr = MakeStandardCuts( Proc, b3Raw, nCuts, dOffsL, HeadCutType, Cutting1Data, Cutting2Data, nil, dOvmHead) local bOk, sErr = MakeStandardCuts( Proc, b3Raw, nCuts, dOffsL, HeadCutType, Cutting1Data, Cutting2Data, nil, dOvmHead)
-- alla fine del taglio si aggiungono gli smussi in testa
local _, sErrHeadChamfer = MakeHeadChamfer( nOriId or Proc.Id, nPartId)
if sErr then
sErr = sErr..'\n'..sErrHeadChamfer
else
sErr = sErrHeadChamfer
end
return bOk, sErr return bOk, sErr
end end
+253 -1725
View File
File diff suppressed because it is too large Load Diff
+5 -7
View File
@@ -483,10 +483,9 @@ local function MakeByPocketing( Proc, nPhase, nRawId, nPartId)
EgtOutLog( sWarn) EgtOutLog( sWarn)
end end
-- imposto elevazione e dichiaro non si generano sfridi per VMill -- imposto elevazione e dichiaro non si generano sfridi per VMill
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' local sNotes = 'MaxElev=' .. EgtNumToString( dFacElev, 1) .. ';'
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dFacElev, 1)) sNotes = sNotes .. 'VMRS=0;'
sUserNotes = EgtSetValInNotes( sUserNotes, 'VMRS', 0) EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
-- provo ad allargare leggermente la tasca -- provo ad allargare leggermente la tasca
@@ -1426,9 +1425,8 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- eventuale nota utente per disabilitare controllo ingresso e uscita in grezzo -- eventuale nota utente per disabilitare controllo ingresso e uscita in grezzo
if k < nO then if k < nO then
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' local sNotes = 'OutRaw=3;'
sUserNotes = EgtSetValInNotes( sUserNotes, 'OutRaw', 3) EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- aumento ingresso su spezzoni per evitare collisione durante approccio pezzo -- aumento ingresso su spezzoni per evitare collisione durante approccio pezzo
if bFront then if bFront then
-- se invertito si allunga ingresso su tutti tranne su ultimo -- se invertito si allunga ingresso su tutti tranne su ultimo
+50 -173
View File
@@ -226,10 +226,9 @@ local function MakeByPocketing( Proc, nPhase, nRawId, nPartId, nSide, nFacInd, d
EgtOutLog( sWarn) EgtOutLog( sWarn)
end end
-- imposto elevazione e dichiaro non si generano sfridi per VMill -- imposto elevazione e dichiaro non si generano sfridi per VMill
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' local sNotes = 'MaxElev=' .. EgtNumToString( dFacElev, 1) .. ';'
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dFacElev, 1)) sNotes = sNotes .. 'VMRS=0;'
sUserNotes = EgtSetValInNotes( sUserNotes, 'VMRS', 0) EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
-- provo ad allargare leggermente la tasca -- provo ad allargare leggermente la tasca
@@ -287,11 +286,9 @@ local function CalcBladeUse( bUseBlade, bDown_Head, nSide, vtN1, vtN2, bConvex,
end end
end end
else else
--if ( vtN1 and vtN1:getZ() >= EgtIf( dCustomAngle, dCustomAngle, -0.5)) and ( not vtN2 or vtN2:getZ() >= -0.5) then if ( vtN1 and vtN1:getZ() >= EgtIf( dCustomAngle, dCustomAngle, -0.5)) and ( not vtN2 or vtN2:getZ() >= -0.5) then
-- bCanUseBlade = true bCanUseBlade = true
--end end
-- viene abilitata sempre lama da sotto
bCanUseBlade = true
end end
end end
end end
@@ -320,7 +317,7 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster, nUseSideToolMaster, nUseConventionalMilling) function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster, nUseSideToolMaster)
-- recupero l'ingombro del grezzo di appartenenza -- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
@@ -426,22 +423,12 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- analisi del taglio -- analisi del taglio
local vOrd = {} local vOrd = {}
local vFaceUse = {} local vFaceUse = {}
local bIsMachDownUp = false
if nSide == 1 or ( nSide == -1 and ( BD.DOWN_HEAD or BD.TURN)) then if nSide == 1 or ( nSide == -1 and ( BD.DOWN_HEAD or BD.TURN)) then
vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1}) vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1})
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)} vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
elseif nSide == -1 then elseif nSide == -1 then
vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1}) vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1})
local vtFaceUse1, vtFaceUse2 vFaceUse = { BL.GetNearestParalOpposite( ptC[1] - ptM), BL.GetNearestParalOpposite( ptC[2] - ptM)}
if bCanUseBlade and not BD.DOWN_HEAD then
bIsMachDownUp = true
vtFaceUse1 = BL.GetOrtupOpposite( BL.GetNearestOrthoOpposite( ptC[1] - ptM))
vtFaceUse2 = BL.GetOrtupOpposite( BL.GetNearestOrthoOpposite( ptC[2] - ptM))
else
vtFaceUse1 = BL.GetNearestParalOpposite( ptC[1] - ptM)
vtFaceUse2 = BL.GetNearestParalOpposite( ptC[2] - ptM)
end
vFaceUse = { vtFaceUse1, vtFaceUse2}
else else
local bFront = ( ( vtN[1]:getY() + vtN[2]:getY()) < 0) local bFront = ( ( vtN[1]:getY() + vtN[2]:getY()) < 0)
if bFront then if bFront then
@@ -455,7 +442,6 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
local vWidth = {} local vWidth = {}
_, _, vWidth[1] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[1]) _, _, vWidth[1] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[1])
_, _, vWidth[2] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[2]) _, _, vWidth[2] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[2])
local vElevation = { vWidth[2], vWidth[1]}
-- Se da sopra o ( da tutte i lati con testa da sotto) e taglio di lama e lunghezza facce maggiore del parametro lunghezza minima -- Se da sopra o ( da tutte i lati con testa da sotto) e taglio di lama e lunghezza facce maggiore del parametro lunghezza minima
if ( bCanUseUnderBlade or bCanUseBlade) and bUseBlade and Proc.Box:getDimX() > dLimMinPiece - 1 then if ( bCanUseUnderBlade or bCanUseBlade) and bUseBlade and Proc.Box:getDimX() > dLimMinPiece - 1 then
@@ -864,7 +850,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- imposto la direzione di lavoro per avere scarico del truciolo ottimale -- imposto la direzione di lavoro per avere scarico del truciolo ottimale
local nWorkSide, bInvert local nWorkSide, bInvert
if ( not bIsTopBladeCurrent and abs( nSide) ~= 0) or ( bCanUseBlade and bCanUseUnderBlade and nSide == -1) then if ( not bIsTopBladeCurrent and abs( nSide) ~= 0) or ( bCanUseBlade and bCanUseUnderBlade and nSide == -1) then
if bIsCurrentBladeCCW and not bIsMachDownUp then if bIsCurrentBladeCCW then
nWorkSide = MCH_MILL_WS.LEFT nWorkSide = MCH_MILL_WS.LEFT
bInvert = true bInvert = true
dSal, dEal = dEal, dSal dSal, dEal = dEal, dSal
@@ -873,7 +859,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
bInvert = false bInvert = false
end end
else else
if bIsCurrentBladeCCW and not bIsMachDownUp then if bIsCurrentBladeCCW then
nWorkSide = MCH_MILL_WS.LEFT nWorkSide = MCH_MILL_WS.LEFT
bInvert = false bInvert = false
else else
@@ -1080,11 +1066,6 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
if nSide == -1 and BD.DOWN_HEAD then if nSide == -1 and BD.DOWN_HEAD then
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal) EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
elseif nSide == -1 and not BD.DOWN_HEAD and bIsMachDownUp then
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( EgtGetMachiningParam( MCH_MP.INVERT), false, true))
dOffset = 5
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
else else
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal) EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)
@@ -1132,17 +1113,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
elseif ( nSide ~= -1 or BD.DOWN_HEAD or BD.TURN) and nUseMillOnSide == 0 then elseif ( nSide ~= -1 or BD.DOWN_HEAD or BD.TURN) and nUseMillOnSide == 0 then
-- determino la massima elevazione -- determino la massima elevazione
local dElev = 0 local dElev = 0
local dFacElev1 = BL.GetFaceElevation( Proc, tFaceLong[1], b3Solid)
-- calcolo l'elevazione della faccia principale local dFacElev2 = BL.GetFaceElevation( Proc, tFaceLong[2], b3Solid)
local dFacElev1 = BL.GetFaceElevation( Proc, tFaceLong[vOrd[1]], b3Solid)
local dFacElev2 = BL.GetFaceElevation( Proc, tFaceLong[vOrd[2]], b3Solid)
local bFacesSwapped = false
if bInt and not bConvex and dFacElev1 - 10* GEO.EPS_SMALL > dFacElev2 then
vOrd[1], vOrd[2] = vOrd[2], vOrd[1]
dFacElev1, dFacElev2 = dFacElev2, dFacElev1
bFacesSwapped = true
end
-- se facce concave e a 90 gradi, prendo l'elevazione minima -- se facce concave e a 90 gradi, prendo l'elevazione minima
if bOrtho then if bOrtho then
dElev = min( dFacElev1, dFacElev2) dElev = min( dFacElev1, dFacElev2)
@@ -1151,7 +1123,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end end
-- recupero la lavorazione -- recupero la lavorazione
local sMilling local sMilling
local bDownHead = ( BD.DOWN_HEAD and ( nSide == -1 or AreSameVectorApprox( vtN[vOrd[1]], -Z_AX()))) local bDownHead = ( nSide == -1 and BD.DOWN_HEAD)
sMilling = ML.FindMilling( 'Long2Cut', dElev, nil, nil, nil, not bDownHead, bDownHead) sMilling = ML.FindMilling( 'Long2Cut', dElev, nil, nil, nil, not bDownHead, bDownHead)
if not sMilling then if not sMilling then
@@ -1183,10 +1155,10 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- se chiuso e corto, applico svuotatura con fresa opportuna -- se chiuso e corto, applico svuotatura con fresa opportuna
if nFaceLimit == 3 and Proc.Box:getDimX() < 2 * dToolDiam then if nFaceLimit == 3 and Proc.Box:getDimX() < 2 * dToolDiam then
-- svuotatura della prima faccia longitudinale -- svuotatura della prima faccia longitudinale
local bOk, sErr = MakeByPocketing( Proc, nPhase, nRawId, nPartId, nSide, tFaceLong[vOrd[1]], dFacElev1) local bOk, sErr = MakeByPocketing( Proc, nPhase, nRawId, nPartId, nSide, tFaceLong[1], dFacElev1)
-- svuotatura della seconda faccia longitudinale -- svuotatura della seconda faccia longitudinale
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
return MakeByPocketing( Proc, nPhase, nRawId, nPartId, nSide, tFaceLong[vOrd[2]], dFacElev2) return MakeByPocketing( Proc, nPhase, nRawId, nPartId, nSide, tFaceLong[2], dFacElev2)
end end
-- determino gli estremi -- determino gli estremi
local dStartDist = 0 local dStartDist = 0
@@ -1277,35 +1249,29 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
local dLimitAngle = -0.5 - 20 * GEO.EPS_SMALL local dLimitAngle = -0.5 - 20 * GEO.EPS_SMALL
-- se facce ortogonali (concave), mantengo la lavorazione di testa sulla faccia più grande purchè non superi di 30 gradi il sottosquadra -- se facce ortogonali (concave), mantengo la lavorazione di testa sulla faccia più grande purchè non superi di 30 gradi il sottosquadra
if bOrtho then if bOrtho then
if bDownHead and AreSameVectorApprox( vtN[vOrd[1]], -Z_AX()) then if vtN[vOrd[1]]:getZ() > 0.001 and vtN[vOrd[2]]:getZ() > 0.001 then
nFin = 1 if vtN[vOrd[1]]:getZ() >= vtN[vOrd[2]]:getZ() then
else nFin = 1
local vtN1 = vtN[vOrd[1]]
local vtN2 = vtN[vOrd[2]]
if vtN1:getZ() > 0.001 and vtN2:getZ() > 0.001 then
if vtN1:getZ() >= vtN2:getZ() then
nFin = 1
else
nIni = 2
end
else else
if vtN1:getZ() < dLimitAngle then nIni = 2
nIni = 2 end
elseif vtN2:getZ() < dLimitAngle then else
nFin = 1 if vtN[vOrd[1]]:getZ() < dLimitAngle then
else nIni = 2
if vtN1:getZ() >= vtN2:getZ() then elseif vtN[vOrd[2]]:getZ() < dLimitAngle then
if vtN1:getZ() < dLimitAngle then nFin = 1
nIni = 2 else
else if vtN[vOrd[1]]:getZ() >= vtN[vOrd[2]]:getZ() then
nFin = 1 if vtN[vOrd[2]]:getZ() < dLimitAngle then
end nFin = 1
else else
if vtN1:getZ() < dLimitAngle then nIni = 2
nIni = 2 end
else else
nFin = 1 if vtN[vOrd[1]]:getZ() < dLimitAngle then
end nIni = 2
else
nFin = 1
end end
end end
end end
@@ -1322,14 +1288,13 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end end
-- ciclo sulle parti -- ciclo sulle parti
local nM = 0 local nM = 0
local bInverted = false
for j = 1, nC do for j = 1, nC do
-- su entrambe le facce -- su entrambe le facce
for i = nIni, nFin do for i = nIni, nFin do
-- valore sovrapposizione tra passate con fresa di fianco -- valore sovrapposizione tra passate con fresa di fianco
local dOverLapExtend = 2 local dOverLapExtend = 2
-- Verifico se da fare di fianco perchè normale troppo verso il basso (minore di -30deg) -- Verifico se da fare di fianco perchè normale troppo verso il basso (minore di -30deg)
local bSide = ( vtN[vOrd[i]]:getZ() < dLimitAngle and not ( bDownHead or ( nSide == -1 and ( BD.DOWN_HEAD or BD.TURN)))) local bSide = ( vtN[vOrd[i]]:getZ() < dLimitAngle and not ( nSide == -1 and ( BD.DOWN_HEAD or BD.TURN)))
-- Limitazioni della lavorazione -- Limitazioni della lavorazione
local nPos = EgtIf( i == 1, j, nC - j + 1) local nPos = EgtIf( i == 1, j, nC - j + 1)
local dSal = EgtIf( nPos == 1, - EgtIf( i == nIni, dStartDist, dEndDist), - EgtIf( i == nIni, dStartAccDist, dEndAccDist) - ( nPos - 2) * dC + EgtIf( bSide, dOverLapExtend, 0)) local dSal = EgtIf( nPos == 1, - EgtIf( i == nIni, dStartDist, dEndDist), - EgtIf( i == nIni, dStartAccDist, dEndAccDist) - ( nPos - 2) * dC + EgtIf( bSide, dOverLapExtend, 0))
@@ -1346,11 +1311,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
if nSide == 1 or nSide == -1 then if nSide == 1 or nSide == -1 then
local bFromYM = (( vtN[vOrd[i]]:getY() < 0 and bConvex) or ( vtN[vOrd[i]]:getY() > 0 and not bConvex)) local bFromYM = (( vtN[vOrd[i]]:getY() < 0 and bConvex) or ( vtN[vOrd[i]]:getY() > 0 and not bConvex))
nSCC = EgtIf( bFromYM, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP) nSCC = EgtIf( bFromYM, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)
if BD.TURN == 2 and not bFromYM then
nSCC = EgtIf( nSide == -1, MCH_SCC.ADIR_ZM, MCH_SCC.ADIR_ZP)
end
else else
local bFromZM = (( vtN[vOrd[i]]:getZ() < 10 * GEO.EPS_ANG_SMALL and bConvex) or ( vtN[vOrd[i]]:getZ() > - 10 * GEO.EPS_ANG_SMALL and not bConvex)) local bFromZM = (( vtN[vOrd[i]]:getZ() < 0 and bConvex) or ( vtN[vOrd[i]]:getZ() > 0 and not bConvex))
nSCC = EgtIf( bFromZM, MCH_SCC.ADIR_ZM, MCH_SCC.ADIR_ZP) nSCC = EgtIf( bFromZM, MCH_SCC.ADIR_ZM, MCH_SCC.ADIR_ZP)
end end
end end
@@ -1363,24 +1325,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
local dStep = 0 local dStep = 0
local dAgg = EgtIf( bConvex, 2 * BD.CUT_EXTRA, BD.CUT_EXTRA) local dAgg = EgtIf( bConvex, 2 * BD.CUT_EXTRA, BD.CUT_EXTRA)
local dLargh = vWidth[vOrd[i]] local dLargh = vWidth[vOrd[i]]
-- controllo se lavorazione completa if not bSide and dLargh > 0.8 * dToolDiam then
local dMachDepth = vElevation[vOrd[i]]
if dMachDepth > dMaxDepth - 10 * GEO.EPS_ANG_SMALL then
-- verifico se posso lavorare la faccia 2
local nOtherFace = EgtIf( i == 1, 2, 1)
if Proc.Fct == 2 and 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)) nO = ceil( dLargh / ( 0.6 * dToolDiam))
if nO > 1 then if nO > 1 then
dStep = dLargh / nO dStep = dLargh / nO
@@ -1396,19 +1341,15 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
local dMySal, dMyEal = dSal, dEal
if bFacesSwapped then
dMySal, dMyEal = dMyEal, dMySal
end
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, tFaceLong[vOrd[i]]}}) EgtSetMachiningGeometry( {{ Proc.Id, tFaceLong[vOrd[i]]}})
-- limito opportunamente la lavorazione -- limito opportunamente la lavorazione
if ( nSide == -1 and BD.DOWN_HEAD) then if ( nSide == -1 and BD.DOWN_HEAD) then
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dMyEal) EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dMySal) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
else else
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dMySal) EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dMyEal) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)
end end
-- imposto posizione braccio porta testa per non ingombrare agli estremi -- imposto posizione braccio porta testa per non ingombrare agli estremi
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
@@ -1417,30 +1358,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
--EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( bSide, BL.GetParallelOpposite( vFaceUse[vOrd[i]]), vFaceUse[vOrd[i]])) --EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( bSide, BL.GetParallelOpposite( vFaceUse[vOrd[i]]), vFaceUse[vOrd[i]]))
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( bSide, MCH_MILL_FU.PARAL_DOWN, vFaceUse[vOrd[i]])) EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( bSide, MCH_MILL_FU.PARAL_DOWN, vFaceUse[vOrd[i]]))
-- imposto lato di lavoro e inversione -- imposto lato di lavoro e inversione
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bIsMachDownUp, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bSide, true, false)) EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bSide, true, false))
-- si aggiusta la direzione di lavoro in base a rotazione utensile e preferenza utente (nUseConventionalMilling da fuori o Q14)
EgtMdbSetCurrMachining( sMilling)
local bIsCurrentToolCCW = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0
if nUseConventionalMilling == nil then
nUseConventionalMilling = EgtGetInfo( Proc.Id, 'Q14', 'd') or 0
end
local bUseConventionalMilling = false
if nUseConventionalMilling == 1 or ( nUseConventionalMilling == 2 and vtN[vOrd[i]]:getX() < 0.1 and Proc.AffectedFaces.Bottom) then
bUseConventionalMilling = true
end
if bIsCurrentToolCCW ~= bUseConventionalMilling then
local dCurrStartAddLen = EgtGetMachiningParam( MCH_MP.STARTADDLEN)
local dCurrEndAddLen = EgtGetMachiningParam( MCH_MP.ENDADDLEN)
local bCurrInvert = EgtGetMachiningParam( MCH_MP.INVERT)
local nCurrWorkside = EgtGetMachiningParam( MCH_MP.WORKSIDE)
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dCurrEndAddLen)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dCurrStartAddLen)
EgtSetMachiningParam( MCH_MP.INVERT, not bCurrInvert)
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( nCurrWorkside == MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT))
end
-- imposto offset radiale (nullo se concavo o di lato) -- imposto offset radiale (nullo se concavo o di lato)
local dOffsR = EgtIf( k < nO, ( nO - k) * dStep, EgtIf( bConvex, - BD.CUT_EXTRA, 0)) local dOffsR = EgtIf( k < nO, ( nO - k) * dStep, EgtIf( bConvex, - BD.CUT_EXTRA, 0))
if bSide then dOffsR = 0 end if bSide then dOffsR = 0 end
@@ -1474,7 +1393,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end end
end end
end end
if not Proc.bMoveAfterSplit and not bConvex and Proc.AffectedFaces.Left and Proc.DistanceToNextPart < ( dToolDiam / 2 + 5) then if not Proc.bMoveAfterSplit and not bEndFixed and not bConvex then
-- recupero gruppo per geometria addizionale -- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId) local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then if not nAddGrpId then
@@ -1483,8 +1402,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
return false, sErr return false, sErr
end end
local AddId = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL local AddId = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
local AddProc = { Id = AddId, Grp = 0, Prc = 12, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, local AddProc = { Id = AddId, Grp = 0, Prc = 12, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, PartId = Proc.PartId, bMoveAfterSplit = true}
PartId = Proc.PartId, TaskId = Proc.TaskId, CutId = Proc.CutId, bMoveAfterSplit = true}
Topology.Classify( AddProc, b3Raw) Topology.Classify( AddProc, b3Raw)
table.insert( AddedIds, AddProc) table.insert( AddedIds, AddProc)
end end
@@ -1507,8 +1425,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
sMilling = ML.FindMilling( sMchType) sMilling = ML.FindMilling( sMchType)
sPrefix = 'L2CS_' sPrefix = 'L2CS_'
nExtendMach = nUseMillOnSide nExtendMach = nUseMillOnSide
if nUseMillOnSide == 2 then if nUseMillOnSide == 2 then
bRemoveToolRadius = true bRemoveToolRadius = true
end end
-- se testa da sotto -- se testa da sotto
if nSide ~= 1 and BD.DOWN_HEAD then if nSide ~= 1 and BD.DOWN_HEAD then
@@ -1586,12 +1504,6 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- calcolo l'elevazione della faccia principale -- calcolo l'elevazione della faccia principale
local dFacElev1 = BL.GetFaceElevation( Proc, tFaceLong[vOrd[1]], b3Solid) local dFacElev1 = BL.GetFaceElevation( Proc, tFaceLong[vOrd[1]], b3Solid)
local dFacElev2 = BL.GetFaceElevation( Proc, tFaceLong[vOrd[2]], b3Solid) local dFacElev2 = BL.GetFaceElevation( Proc, tFaceLong[vOrd[2]], b3Solid)
local bFacesSwapped = false
if bInt and not bConvex and dFacElev1 - 10* GEO.EPS_SMALL > dFacElev2 then
vOrd[1], vOrd[2] = vOrd[2], vOrd[1]
dFacElev1, dFacElev2 = dFacElev2, dFacElev1
bFacesSwapped = true
end
-- se fresa di fianco o da sotto calcolo quanto l'utensile può andare vicino al limite se l'elevazione della faccia è minore del raggio utensile -- se fresa di fianco o da sotto calcolo quanto l'utensile può andare vicino al limite se l'elevazione della faccia è minore del raggio utensile
if nUseMillOnSide <= 1 or nSide == -1 then if nUseMillOnSide <= 1 or nSide == -1 then
local dFacElev = max( dFacElev1, dFacElev2) local dFacElev = max( dFacElev1, dFacElev2)
@@ -1690,11 +1602,6 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
dEndAccDist = 0 dEndAccDist = 0
end end
end end
if Proc.bMoveAfterSplit then
nC = 1
dStartDist = Proc.Box:getDimX() - ( dToolDiam / 2 + 5)
dEndDist = - ( dToolDiam / 2 + 5)
end
-- ciclo sulle parti -- ciclo sulle parti
local nM = 0 local nM = 0
for j = 1, nC do for j = 1, nC do
@@ -1777,7 +1684,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
local ptC3 = EgtSurfTmFacetCenter( Proc.Id, tFaceLong[vOrd[i]], GDB_ID.ROOT) local ptC3 = EgtSurfTmFacetCenter( Proc.Id, tFaceLong[vOrd[i]], GDB_ID.ROOT)
local ptDir = ptC3 - ptM ; ptDir:normalize() local ptDir = ptC3 - ptM ; ptDir:normalize()
-- se concave e dal versore Z della faccia (> -20°) o convesso e versore Z ( > -30°) decido se eseguire la lavoraione con la testa da sopra o da sotto -- se concave e dal versore Z della faccia (> -20°) o convesso e versore Z ( > -30°) decido se eseguire la lavoraione con la testa da sopra o da sotto
if ( not bConvex and vtN[vOrd[i]]:getZ() > -0.9397 and ptDir:getZ() > -0.017) or if ( not bConvex and vtN[vOrd[i]]:getZ() > -0.9397 and ptDir:getZ() > 0) or
( bConvex and vtN[vOrd[i]]:getZ() > -0.866 and ptDir:getZ() > 0) then ( bConvex and vtN[vOrd[i]]:getZ() > -0.866 and ptDir:getZ() > 0) then
sNameF = sPrefix .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM) sNameF = sPrefix .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM)
nMchFId = EgtAddMachining( sNameF, sMilling) nMchFId = EgtAddMachining( sNameF, sMilling)
@@ -1885,39 +1792,9 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse[vOrd[i]]) EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse[vOrd[i]])
end end
end end
if bFacesSwapped then
local dCurrStartAddLen = EgtGetMachiningParam( MCH_MP.STARTADDLEN)
local dCurrEndAddLen = EgtGetMachiningParam( MCH_MP.ENDADDLEN)
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dCurrEndAddLen)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dCurrStartAddLen)
end
-- imposto lato di lavoro e inversione -- imposto lato di lavoro e inversione
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bIsMachDownUp, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
-- si aggiusta la direzione di lavoro in base a rotazione utensile e preferenza utente (nUseConventionalMilling da fuori o Q14)
EgtMdbSetCurrMachining( sMilling)
local bIsCurrentToolCCW = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0
if nUseConventionalMilling == nil then
nUseConventionalMilling = EgtGetInfo( Proc.Id, 'Q14', 'd') or 0
end
local bUseConventionalMilling = false
if nUseConventionalMilling == 1 or ( nUseConventionalMilling == 2 and vtN[vOrd[i]]:getX() < 0.1 and Proc.AffectedFaces.Bottom) then
bUseConventionalMilling = true
end
if bIsCurrentToolCCW ~= bUseConventionalMilling then
local dCurrStartAddLen = EgtGetMachiningParam( MCH_MP.STARTADDLEN)
local dCurrEndAddLen = EgtGetMachiningParam( MCH_MP.ENDADDLEN)
local bCurrInvert = EgtGetMachiningParam( MCH_MP.INVERT)
local nCurrWorkside = EgtGetMachiningParam( MCH_MP.WORKSIDE)
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dCurrEndAddLen)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dCurrStartAddLen)
EgtSetMachiningParam( MCH_MP.INVERT, not bCurrInvert)
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( nCurrWorkside == MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT))
end
-- calcolo la componente dNz non in base alla classificazione della feature (sopra, sotto, fianchi) ma alla componente maggiore -- calcolo la componente dNz non in base alla classificazione della feature (sopra, sotto, fianchi) ma alla componente maggiore
-- local dNz = EgtIf( nSide == 0, vtN[vOrd[i]]:getY(), vtN[vOrd[i]]:getZ()) -- local dNz = EgtIf( nSide == 0, vtN[vOrd[i]]:getY(), vtN[vOrd[i]]:getZ())
-- local dNz = EgtIf( abs(vtN[vOrd[i]]:getY()) >= abs(vtN[vOrd[i]]:getZ()), vtN[vOrd[i]]:getY(), vtN[vOrd[i]]:getZ()) -- local dNz = EgtIf( abs(vtN[vOrd[i]]:getY()) >= abs(vtN[vOrd[i]]:getZ()), vtN[vOrd[i]]:getY(), vtN[vOrd[i]]:getZ())
+8 -85
View File
@@ -128,9 +128,8 @@ end
local nFaceUse = BL.GetNearestParalOpposite( vtN) local nFaceUse = BL.GetNearestParalOpposite( vtN)
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- applico il parametro plunge, che setta la lavorazione per affondare solamente, senza lavorare tutto il contorno; 1: solo lato iniziale, 2: solo lato finale, 3: entrambi -- applico il parametro plunge, che setta la lavorazione per affondare solamente, senza lavorare tutto il contorno; 1: solo lato iniziale, 2: solo lato finale, 3: entrambi
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' local sNotes = 'Plunge=3;'
sUserNotes = EgtSetValInNotes( sUserNotes, 'Plunge' , 3) EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- imposto angolo 3° asse rot -- imposto angolo 3° asse rot
local vtOrtho = BL.GetVersRef( nFaceUse) local vtOrtho = BL.GetVersRef( nFaceUse)
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sMortising, 'perpendicular')) EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sMortising, 'perpendicular'))
@@ -353,69 +352,6 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bModif and not bOpenBtm then if not bModif and not bOpenBtm then
BL.SetOpenSide( AuxId, b3Solid) BL.SetOpenSide( AuxId, b3Solid)
end end
-- recupero il raggio minimo della mortasa
local dMaxDiam = 1000
local nSt, nEnd = EgtCurveDomain( AuxId)
for i = nSt, nEnd - 1 do
local dRad = EgtCurveCompoRadius( AuxId, i)
-- se è un raggio, setto ed esco subito. Tutti i raggi sono uguali nella mortasa
if dRad > 0 then
dMaxDiam = dRad * 2
break
end
end
-- caso speciale feature trimmata diversamente in/out: si ricostruisce la curva non trimmata
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- estrazione loop trimesh: se 1 contorno ha il fondo, se due contorni è passante.
-- se passante si deve discriminare se i due contorni sono uguali (passante standard, trimmata allo stesso modo in/out) oppure se un contorno è diverso dall'altro (e quindi non è trimmata in egual modo in/out)
-- se più di 2 contorni si rimane nel caso standard
local idCurve1, nIdCount = EgtExtractSurfTmLoops( Proc.Id, nAddGrpId)
if nIdCount == 2 then
local idCurve2 = idCurve1 + 1
local dCurveLength1 = EgtCurveLength( idCurve1)
local dCurveLength2 = EgtCurveLength( idCurve2)
if abs( dCurveLength1 - dCurveLength2) > 100 * GEO.EPS_SMALL then
-- riferimento curva ausiliaria
local frAuxId = Frame3d( EgtGP( AuxId, GDB_RT.GLOB), vtExtr)
-- box dei due contorni nel riferimento della faccia di fondo
local b3Curve1 = EgtGetBBoxRef( idCurve1, GDB_BB.STANDARD, frAuxId)
local b3Curve2 = EgtGetBBoxRef( idCurve2, GDB_BB.STANDARD, frAuxId)
-- per creare la curva non trimmata si creerà un piano di intersezione con la trimesh appena sopra al contorno più vicino a AuxId, ossia a ptOffset
local ptOffset = b3Curve1:getMax()
if b3Curve1:getMin():getZ() > b3Curve2:getMin():getZ() + 10 * GEO.EPS_SMALL then
ptOffset = b3Curve2:getMax()
end
-- ptOffset si sposta appena sopra per garantire l'intersezione
ptOffset = ptOffset + Vector3d( 0, 0, 100 * GEO.EPS_SMALL)
local ptOffsetGlob = Point3d( ptOffset)
ptOffsetGlob:toGlob( frAuxId)
EgtErase( { idCurve1, idCurve2} )
-- intersezione piano a ptOffset con la trimesh: si ottiene la curva originale non trimmata
local nFirstId, nPnt, nCrv, nSrf = EgtPlaneSurfTmInters( ptOffsetGlob, frAuxId:getVersZ(), Proc.Id, nAddGrpId, GDB_RT.GLOB)
if nPnt == 0 and nCrv == 1 and nSrf == 0 then
EgtCloseCurveCompo( nFirstId)
local vtMove = -frAuxId:getVersZ() * ptOffset:getZ()
EgtMove( nFirstId, vtMove, GDB_RT.GLOB)
EgtErase( AuxId)
EgtChangeId( nFirstId, AuxId)
else
if nFirstId then
for nId = nFirstId, nFirstId + nPnt + nCrv + nSrf - 1 do
EgtErase( nId)
end
end
end
end
end
if bOpenBtm then if bOpenBtm then
-- creo superficie chiusa -- creo superficie chiusa
local nFlat = EgtSurfTmByFlatContour( EgtGetParent( AuxId), AuxId, 0.05) local nFlat = EgtSurfTmByFlatContour( EgtGetParent( AuxId), AuxId, 0.05)
@@ -499,10 +435,6 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
-- determino larghezza della mortasa -- determino larghezza della mortasa
if dL < dW then dL, dW = dW, dL end if dL < dW then dL, dW = dW, dL end
-- si prende il minimo tra larghezza mortasa e il raggio minimo impostato da parametro
dMaxDiam = min( dW, dMaxDiam)
-- abilitazione lavorazione da sotto -- abilitazione lavorazione da sotto
local bPockUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259) local bPockUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259)
local bPockDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174) local bPockDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174)
@@ -581,16 +513,16 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
local sPocketing local sPocketing
if Proc.Prc ~= 53 then if Proc.Prc ~= 53 then
sPocketing = ProcessMortise.VerifyMortiseOrPocket( Proc, dMaxDiam, dMorH, nil, sPockType..sMchExt, bPockDown, bExcludeH2) sPocketing = ProcessMortise.VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt, bPockDown, bExcludeH2)
if not sPocketing and bPockUp then if not sPocketing and bPockUp then
sPocketing = ProcessMortise.VerifyMortiseOrPocket( Proc, dMaxDiam, dMorH, nil, sPockType..sMchExt, _, bExcludeH2) sPocketing = ProcessMortise.VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt, _, bExcludeH2)
end end
end end
if not sPocketing then if not sPocketing then
sPockType = 'Pocket' sPockType = 'Pocket'
sPocketing = ProcessMortise.VerifyMortiseOrPocket( Proc, dMaxDiam, dMorH, nil, sPockType..sMchExt, bPockDown, bExcludeH2) sPocketing = ProcessMortise.VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt, bPockDown, bExcludeH2)
if not sPocketing and bPockUp then if not sPocketing and bPockUp then
sPocketing = ProcessMortise.VerifyMortiseOrPocket( Proc, dMaxDiam, dMorH, nil, sPockType..sMchExt, _, bExcludeH2) sPocketing = ProcessMortise.VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt, _, bExcludeH2)
end end
end end
if not sPocketing then if not sPocketing then
@@ -611,7 +543,6 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bCW = ( dSpeed >= 0) bCW = ( dSpeed >= 0)
end end
end end
-- inserisco la lavorazione di svuotatura -- inserisco la lavorazione di svuotatura
local sName = 'Mort_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local sName = 'Mort_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sName, sPocketing) local nMchFId = EgtAddMachining( sName, sPocketing)
@@ -631,11 +562,6 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN) EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN)
end end
-- se diametro utensile esattamente uguale a larghezza tasca, e tasca tonda, si setta un offset radiale negativo
if Proc.Fct > 6 and abs( dMillDiam - dW) < 100 * GEO.EPS_SMALL then
EgtSetMachiningParam( MCH_MP.OFFSR, - 50 * GEO.EPS_SMALL)
end
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}}) EgtSetMachiningGeometry( {{ AuxId, -1}})
-- sistemo la direzione di lavoro -- sistemo la direzione di lavoro
@@ -693,8 +619,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
end end
-- imposto elevazione -- imposto elevazione
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' local sUserNotes = 'MaxElev=' .. EgtNumToString( dMorH, 1) .. ';'
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dMorH, 1))
-- se lavorazione in doppio -- se lavorazione in doppio
if Proc.Double and Proc.Double > 0 then if Proc.Double and Proc.Double > 0 then
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double) sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double)
@@ -754,9 +679,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- setto profondità -- setto profondità
EgtSetMachiningParam( MCH_MP.DEPTH, -nDepthMin+BD.CUT_EXTRA) EgtSetMachiningParam( MCH_MP.DEPTH, -nDepthMin+BD.CUT_EXTRA)
-- imposto elevazione -- imposto elevazione
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( (-nDepthMin+BD.CUT_EXTRA), 1) .. ';')
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( (-nDepthMin+BD.CUT_EXTRA), 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
-103
View File
@@ -1,103 +0,0 @@
-- ProcessSplit.lua by Egaltech s.r.l. 2025/06/20
-- Gestione tastatura
-- Tabella per definizione modulo
local ProcessProbing = {}
-- Include
require( 'EgtBase')
local BL = require( 'BeamLib')
-- Dati
local ML = require( 'MachiningLib')
---------------------------------------------------------------------
local function GetProbingMachining( Machinings, sHead)
local sProbeMachining, sHeadTool
-- TODO questa associazione "testa utensile"-"testa tastatore" dovrebbe essere spostata nella macchina.
-- Non è detto che se testa utensile inizia con "H2" allora bisogna prendere lavorazione con "_H2"
-- se la testa utilizzata dalla lavorazione inizia con H2, dovrebbe essere la seconda testa
if EgtStartsWith( sHead, 'H2') then
sHeadTool = '_H2'
else
sHeadTool = '_H1'
end
for i = 1, #Machinings do
if EgtEndsWith( Machinings[i].Name, sHeadTool) then
sProbeMachining = Machinings[i]
return sProbeMachining
end
end
sProbeMachining = Machinings[1]
return sProbeMachining
end
---------------------------------------------------------------------
local function MoveProbePointToRawFaces( ptProbe, vtProbe, nPartId)
local b3BoxPart = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
-- si porta linea di tastatura su grezzo
if AreSameVectorApprox( vtProbe, Z_AX()) then
ptProbe[3] = b3BoxPart:getMax():getZ()
elseif AreSameVectorApprox( vtProbe, -Z_AX()) then
ptProbe[3] = b3BoxPart:getMin():getZ()
elseif AreSameVectorApprox( vtProbe, Y_AX()) then
ptProbe[2] = b3BoxPart:getMax():getY()
elseif AreSameVectorApprox( vtProbe, -Y_AX()) then
ptProbe[2] = b3BoxPart:getMin():getY()
end
return ptProbe
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessProbing.Make( Proc, nPartId, Info)
local bOk, sErr
-- per eseguire tastatura servono tutti i dati, altriemnti impossibile
if Info.vtProbe and Info.ptProbe and Info.sType then
Info.ptProbe = MoveProbePointToRawFaces( Info.ptProbe, Info.vtProbe, nPartId)
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
local nIdLine = EgtLinePVL( nAddGrpId, Info.ptProbe, Info.vtProbe, 10, GDB_RT.GLOB) -- TODO lunghezza da portare fuori come parametro
local Machinings = GetMachinings( MCH_MY.PROBING, Info.sType)
-- se c'è almeno una lavorazione, allora devo fare tastatura
if Machinings and #Machinings > 0 then
local sProbing = GetProbingMachining( Machinings, Info.sHead)
-- se c'è la linea e la lavorazione, applico
if sProbing and nIdLine then
local sName = 'DtMtProbe_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sName, sProbing.Name)
-- si inverte la direzione della linea, deve essere entrante, oppostaa vettore estrusione
EgtInvertCurve( nIdLine)
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nIdLine, -1}})
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
else
bOk = true
end
else
bOk = false
sErr = 'Error on probing'
end
-- altrimenti tastatura non richiesta, esco
else
return true
end
else
bOk = false
sErr = 'Error on probing'
end
return bOk, sErr
end
---------------------------------------------------------------------
return ProcessProbing
+10 -87
View File
@@ -206,36 +206,6 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
return nChamfer, dDepth, sMilling, sMilling2 return nChamfer, dDepth, sMilling, sMilling2
end end
---------------------------------------------------------------------
function VerifyOtherMillCanFinish( dDepthProfile, nSide)
local dToolMaxDepthFinish
-- abilitazione lavorazione da sotto
local sMillType = 'Prof_end'
local sMillingFinish, _, _, _ = ML.FindMilling( sMillType, nil, nil, nil, nil, true, nil, nil, nil)
if not sMillingFinish then
return false
end
-- Recupero i dati dell'utensile
if EgtMdbSetCurrMachining( sMillingFinish) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid)) then
dToolMaxDepthFinish = EgtTdbGetCurrToolMaxDepth()
end
else
return false
end
local bDouble = ( dDepthProfile + BD.CUT_EXTRA > dToolMaxDepthFinish)
-- 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 < dToolMaxDepthFinish * 2) then
return true, sMillingFinish, bDouble
end
return false
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
@@ -274,7 +244,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if vtN:getZ() > 0.1 then if vtN:getZ() > 0.1 then
nSide = 1 nSide = 1
elseif vtN:getZ() < -0.1 then elseif vtN:getZ() < -0.1 then
nSide = -1 nSide = -1
end end
-- abilitazione lavorazione da sotto -- abilitazione lavorazione da sotto
local bMillDown = ( BD.DOWN_HEAD and nSide == -1) local bMillDown = ( BD.DOWN_HEAD and nSide == -1)
@@ -498,21 +468,16 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
end end
end end
-- se configurata fresa di finitura
local bUseOtherMillOnFinish, sFinishMilling, bDoubleFinishMill = VerifyOtherMillCanFinish( dProfDepth, nSide)
-- se il chamfer non è esclusivo continuo con le altre lavorazioni -- se il chamfer non è esclusivo continuo con le altre lavorazioni
if nChamfer < 2 then if nChamfer < 2 then
-- verifico se necessario lavorare in doppio -- verifico se necessario lavorare in doppio
local bDouble = ( dProfDepth + BD.CUT_EXTRA - 100 * GEO.EPS_SMALL > dToolMaxDepth) local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP) local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
-- se lavorazione da due parti, aggiungo la seconda -- se lavorazione da due parti, aggiungo la seconda
local sMillingDown local sMillingDown
if bDouble then if bDouble then
if nSide == 0 then if nSide == 0 then
if BD.DOWN_HEAD then if BD.DOWN_HEAD then
-- recupero la lavorazione -- recupero la lavorazione
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true) sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
if not sMillingDown then if not sMillingDown then
@@ -572,6 +537,10 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
bFinish = true bFinish = true
end end
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
@@ -598,7 +567,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
nMchId = nMch2Id nMchId = nMch2Id
end end
-- se abilitata, aggiungo lavorazione di finitura -- se abilitata, aggiungo lavorazione di finitura
if bFinish and not bUseOtherMillOnFinish then if bFinish then
-- inserisco la lavorazione -- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
@@ -670,13 +639,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
end end
-- posizione braccio porta testa -- posizione braccio porta testa
local nSCC = MCH_SCC.ADIR_NONE EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
if BD.TURN == 2 then
nSCC = MCH_SCC.ADIR_ZP
else
nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale -- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local ptSP, ptEp local ptSP, ptEp
local bFinish local bFinish
@@ -713,7 +676,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
nMchId = nMch2Id nMchId = nMch2Id
end end
-- se abilitata, aggiungo lavorazione di finitura -- se abilitata, aggiungo lavorazione di finitura
if bFinish and not bUseOtherMillOnFinish then if bFinish then
-- inserisco la lavorazione -- inserisco la lavorazione
local sNewName = 'Prof_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local sNewName = 'Prof_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
@@ -769,46 +732,6 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
return false, sErr return false, sErr
end end
end end
-- se finitura con fresa piccola
if bFinish and bUseOtherMillOnFinish then
local sDepthFinishMill = EgtIf( bDoubleFinishMill, ( dProfDepth+ BD.MILL_OVERLAP ) / 2, dProfDepth + BD.CUT_EXTRA)
local sMachName = 'Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
nMchId = EgtAddMachining( sMachName, sFinishMilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sMachName .. '-' .. sFinishMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, sDepthFinishMill)
-- 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 bDoubleFinishMill then
local sNewName = 'FinB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
-- ottengo l'inversione e setto il contrario
local bInvertMode = EgtGetMachiningParam( MCH_MP.INVERT)
EgtSetMachiningParam( MCH_MP.INVERT, not bInvertMode)
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
end
end
end
end end
-- aggiorno ingombro testa o coda per presa -- aggiorno ingombro testa o coda per presa
if nSide ~= 1 then -- se feature di fianco o da sotto if nSide ~= 1 then -- se feature di fianco o da sotto
+3 -7
View File
@@ -453,7 +453,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
end end
-- verifico se necessario lavorare in doppio -- verifico se necessario lavorare in doppio
local bDouble = ( dProfDepth + BD.CUT_EXTRA - 100 * GEO.EPS_SMALL > dToolMaxDepth) local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP) local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
-- se lavorazione da due parti, aggiungo la seconda -- se lavorazione da due parti, aggiungo la seconda
local sMillingDown local sMillingDown
@@ -666,9 +666,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
else else
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTUP_TOP) EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTUP_TOP)
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( (dToolMaxDepth/2), 1))
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( (dToolMaxDepth/2), 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
end end
EgtSetMachiningParam( MCH_MP.INVERT, false) EgtSetMachiningParam( MCH_MP.INVERT, false)
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH') EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH')
@@ -718,9 +716,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH') EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH')
EgtSetMachiningParam( MCH_MP.STEP, 0) EgtSetMachiningParam( MCH_MP.STEP, 0)
EgtSetMachiningParam( MCH_MP.OFFSR, 0) EgtSetMachiningParam( MCH_MP.OFFSR, 0)
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1))
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dWidth, 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
if BD.TURN then if BD.TURN then
local nSCC = GetSccForTurn( vtN) local nSCC = GetSccForTurn( vtN)
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
+3 -7
View File
@@ -453,7 +453,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
end end
-- verifico se necessario lavorare in doppio -- verifico se necessario lavorare in doppio
local bDouble = ( dProfDepth + BD.CUT_EXTRA - 100 * GEO.EPS_SMALL > dToolMaxDepth) local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP) local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
-- se lavorazione da due parti, aggiungo la seconda -- se lavorazione da due parti, aggiungo la seconda
local sMillingDown local sMillingDown
@@ -666,9 +666,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
else else
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTUP_TOP) EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTUP_TOP)
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( (dToolMaxDepth/2), 1))
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( (dToolMaxDepth/2), 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
end end
EgtSetMachiningParam( MCH_MP.INVERT, false) EgtSetMachiningParam( MCH_MP.INVERT, false)
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH') EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH')
@@ -718,9 +716,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH') EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH')
EgtSetMachiningParam( MCH_MP.STEP, 0) EgtSetMachiningParam( MCH_MP.STEP, 0)
EgtSetMachiningParam( MCH_MP.OFFSR, 0) EgtSetMachiningParam( MCH_MP.OFFSR, 0)
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1))
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dWidth, 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
if BD.TURN then if BD.TURN then
local nSCC = GetSccForTurn( vtN) local nSCC = GetSccForTurn( vtN)
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
+1 -3
View File
@@ -602,9 +602,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH') EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH')
EgtSetMachiningParam( MCH_MP.STEP, 0) EgtSetMachiningParam( MCH_MP.STEP, 0)
EgtSetMachiningParam( MCH_MP.OFFSR, 0) EgtSetMachiningParam( MCH_MP.OFFSR, 0)
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1))
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dWidth, 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- imposto tipo uso faccia -- imposto tipo uso faccia
local nFaceUse = MCH_MILL_FU.PARAL_DOWN local nFaceUse = MCH_MILL_FU.PARAL_DOWN
if nSide == -1 then if nSide == -1 then
+2 -6
View File
@@ -657,9 +657,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH') EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH')
EgtSetMachiningParam( MCH_MP.STEP, 0) EgtSetMachiningParam( MCH_MP.STEP, 0)
EgtSetMachiningParam( MCH_MP.OFFSR, 0) EgtSetMachiningParam( MCH_MP.OFFSR, 0)
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dElev, 1))
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dElev, 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- imposto posizione braccio -- imposto posizione braccio
local nSCC = MCH_SCC.ADIR_YM local nSCC = MCH_SCC.ADIR_YM
if nSide == 0 then if nSide == 0 then
@@ -699,9 +697,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH') EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH')
EgtSetMachiningParam( MCH_MP.STEP, 0) EgtSetMachiningParam( MCH_MP.STEP, 0)
EgtSetMachiningParam( MCH_MP.OFFSR, 0) EgtSetMachiningParam( MCH_MP.OFFSR, 0)
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dElev, 1))
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dElev, 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- imposto posizione braccio -- imposto posizione braccio
local nSCC = MCH_SCC.ADIR_YM local nSCC = MCH_SCC.ADIR_YM
if nSide == 0 then if nSide == 0 then
+5 -9
View File
@@ -50,7 +50,6 @@ end
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
local nForceUseBladeOnNotContinueFace = EgtGetInfo( Proc.Id, 'Q04', 'i') or 0 local nForceUseBladeOnNotContinueFace = EgtGetInfo( Proc.Id, 'Q04', 'i') or 0
local bUseMill = ( EgtGetInfo( Proc.Id, 'Q05', 'i') or 0) == 1
-- recupero l'ingombro del grezzo di appartenenza -- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo -- ingombro del pezzo
@@ -140,9 +139,6 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
if BL.IsCutNeeded( CutProc, b3Raw, dOvmHead) then if BL.IsCutNeeded( CutProc, b3Raw, dOvmHead) then
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, false) local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, false)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
elseif bUseMill then
Proc.bForceMill = true
return LapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
elseif nForceUseBladeOnNotContinueFace > 0 then elseif nForceUseBladeOnNotContinueFace > 0 then
EgtSurfTmRemoveFacet( Proc.Id, vFaceOrd[1] - 1) EgtSurfTmRemoveFacet( Proc.Id, vFaceOrd[1] - 1)
Proc.Fct = Proc.Fct - 1 Proc.Fct = Proc.Fct - 1
@@ -173,18 +169,18 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
-- calcolo riferimenti per facce inclinate -- calcolo riferimenti per facce inclinate
local vtRef = Vector3d( vtN[vFaceOrd[3]]) local vtRef = Vector3d( vtN[vFaceOrd[3]])
local vtRef2 = Vector3d( vtN[vFaceOrd[2]]) local vtRef2 = EgtIf( bHead, X_AX(), -X_AX())
-- eseguo -- eseguo
for i = 1, #vCuts do for i = 1, #vCuts do
local vtOrtho local nOrthoOpposite
if i % 2 == 1 then if i % 2 == 1 then
vtOrtho = vtRef nOrthoOpposite = BL.GetNearestOrthoOpposite( vtRef)
else else
vtOrtho = vtRef2 nOrthoOpposite = BL.GetNearestOrthoOpposite( vtRef2)
end end
-- lavoro la faccia -- lavoro la faccia
for j = 1, #vCuts[i] do for j = 1, #vCuts[i] do
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrtho, dVzLimDwnUp, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, nOrthoOpposite, dVzLimDwnUp, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then if not bOk then
return bOk, sErr return bOk, sErr
end end
-2
View File
@@ -239,8 +239,6 @@ function ProcessRoundArch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
elseif AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then elseif AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then
nSCC = MCH_SCC.ADIR_YP nSCC = MCH_SCC.ADIR_YP
end end
elseif BD.TURN == 2 then
nSCC = MCH_SCC.ADIR_ZP
elseif BD.TURN then elseif BD.TURN then
if vtN:getZ() > 0.707 then if vtN:getZ() > 0.707 then
nSCC = MCH_SCC.ADIR_ZP nSCC = MCH_SCC.ADIR_ZP
+22 -40
View File
@@ -196,33 +196,27 @@ local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Soli
end end
end end
-- se non ho intersezione con la faccia tappo posso fare il taglio sul fianco -- controllo per eseguire solo un taglio ottimizzato
if not nGoodFace1 or nGoodFace1 == 0 then local bExecJustOneCut = false
-- controllo per eseguire solo un taglio ottimizzato local dDiceFaceDim = GEO.INFINITO
local bExecJustOneCut = false if ( i % 2) == 0 then
local dDiceFaceDim = GEO.INFINITO for cont = 1, #vCuts[i] do
if ( i % 2) == 0 then local _, dDiceFaceH, dDiceFaceV = BL.GetFaceHvRefDim( vCuts[i][cont], 0)
for cont = 1, #vCuts[i] do -- se feature verso Z, si ammette anche lavorazione in doppio
local _, dDiceFaceH, dDiceFaceV = BL.GetFaceHvRefDim( vCuts[i][cont], 0) if AreSameVectorApprox( vtRef, Z_AX()) then
-- se feature verso Z, si ammette anche lavorazione in doppio if dMaxDepth * 2 > dDiceFaceH + BD.CUT_EXTRA then
if AreSameVectorApprox( vtRef, Z_AX()) then bExecJustOneCut = true
if dMaxDepth * 2 > dDiceFaceH + BD.CUT_EXTRA then dDiceFaceDim = dDiceFaceH
bExecJustOneCut = true break
dDiceFaceDim = dDiceFaceH end
break elseif AreSameVectorApprox( vtRef, Y_AX()) or AreSameVectorApprox( vtRef, -Y_AX()) then
end if dMaxDepth > dDiceFaceV + BD.CUT_EXTRA then
elseif AreSameVectorApprox( vtRef, Y_AX()) or AreSameVectorApprox( vtRef, -Y_AX()) then bExecJustOneCut = true
if dMaxDepth > dDiceFaceV + BD.CUT_EXTRA then dDiceFaceDim = dDiceFaceV
bExecJustOneCut = true break
dDiceFaceDim = dDiceFaceV
break
end
end end
end end
end end
-- se c'è intersezione non ci deve essere ExtraCut
else
dExtraCut = 0
end end
-- se si può fare, faccio unico taglio parallelo -- se si può fare, faccio unico taglio parallelo
if bExecJustOneCut then if bExecJustOneCut then
@@ -449,7 +443,7 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa
if not nGoodFace1 or nGoodFace1 == 0 then if not nGoodFace1 or nGoodFace1 == 0 then
-- inserisco la lavorazione -- inserisco la lavorazione
local vtRef2 = EgtIf( abs(vtRef:getZ()) < GEO.EPS_SMALL, Z_AX(), EgtIf( bHead, Y_AX(), -Y_AX())) local vtRef2 = EgtIf( abs(vtRef:getZ()) < GEO.EPS_SMALL, Z_AX(), EgtIf( bHead, Y_AX(), -Y_AX()))
bOkd, sErrD = Fbs.MakeOne( nFace4, nGoodFace4 - 1, sCutting, dSawDiam, vtRef2, nil, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) bOkd, sErrD = Fbs.MakeOne( nFace4, nGoodFace4 - 1, sCutting, dSawDiam, vtRef2, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOkd then return bOkd, sErrD end if not bOkd then return bOkd, sErrD end
-- lavoro la faccia opposta (definita dal parametro P11) -- lavoro la faccia opposta (definita dal parametro P11)
if vFaceOrd[3] ~= 0 then if vFaceOrd[3] ~= 0 then
@@ -528,20 +522,10 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa
else else
dDiamMax = EgtIf( abs( frMor:getVersX():getY()) < abs( frMor:getVersY():getY()), dL, dW) dDiamMax = EgtIf( abs( frMor:getVersX():getY()) < abs( frMor:getVersY():getY()), dL, dW)
end end
-- determino la distanza tra le due facce inclinate per determinare elevazione -- determino la distanza tra le due facce inclinate
local dDistFaces local dDistFaces
if vFaceOrd[4] ~= 0 then if vFaceOrd[4] ~= 0 then
local nElevationFace1 = 0 dDistFaces = abs((ptC[vFaceOrd[2]]-ptC[vFaceOrd[4]])*vtN[vFaceOrd[2]])
-- controllo estensione faccia 1
if vFaceOrd[1] ~= 0 then
frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( Proc.Id, vFaceOrd[1]-1, GDB_ID.ROOT)
if abs(vtRef:getY()) > 0.866 then
nElevationFace1 = EgtIf( abs( frMor:getVersX():getZ()) < abs( frMor:getVersY():getY()), dL, dW)
else
nElevationFace1 = EgtIf( abs( frMor:getVersX():getY()) < abs( frMor:getVersY():getY()), dL, dW)
end
end
dDistFaces = max( abs((ptC[vFaceOrd[2]]-ptC[vFaceOrd[4]])*vtN[vFaceOrd[2]]), nElevationFace1)
end end
-- recupero la lavorazione. considerando l dimensione del lato e l'affondamento -- recupero la lavorazione. considerando l dimensione del lato e l'affondamento
local sPocketing local sPocketing
@@ -578,9 +562,7 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa
EgtSetMachiningGeometry( {{ Proc.Id, vFaceOrd[2]-1}}) EgtSetMachiningGeometry( {{ Proc.Id, vFaceOrd[2]-1}})
-- imposto elevazione -- imposto elevazione
if dDistFaces then if dDistFaces then
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dDistFaces, 1) .. ';')
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dDistFaces, 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
end end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
+20 -173
View File
@@ -167,108 +167,6 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmTail)
return true, nil return true, nil
end end
---------------------------------------------------------------------
-- smussi in coda
local function MakeTailChamfer( idProc, nPartId, dDepthTailChamfer)
-- recupero gruppo per geometria aggiuntiva
local AddGrpId = BL.GetAddGroup( nPartId)
if not AddGrpId then
local sErr = 'Error on process StartFace impossible to find AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- recupero la lavorazione
local sMilling = ML.FindMilling( 'Mark')
if not sMilling then
local sErr = 'Error : milling not found in library'
EgtOutLog( sErr)
return false, sErr
end
local nLoopId, nLoopCnt = EgtExtractSurfTmFacetLoops( idProc, 0, AddGrpId)
if not nLoopId or nLoopCnt > 1 then
local sErr = 'Error MakeHeadChamfer : too many loops'
EgtOutLog( sErr)
return false, sErr
end
-- setto direzione estrusione corretta
EgtModifyCurveExtrusion( nLoopId, -X_AX())
EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.LEFT))
local dQ09Value = EgtGetInfo( idProc, 'Q09', 'd')
if not dQ09Value then
dQ09Value = 0.1
end
local bChamferedEdge = dQ09Value > 0
dQ09Value = EgtIf( bChamferedEdge, max( dQ09Value, 0.1), min( dQ09Value, -0.1))
local nIdFirstEntity, nEntityCnt = EgtExplodeCurveCompo( nLoopId)
local p3MidPoint = EgtMP( nIdFirstEntity, GDB_ID.GRID)
for i = 0, nEntityCnt - 1 do
if EgtCurveLength( nIdFirstEntity + i) - 10 < abs( dQ09Value) * 2 then
local sErr = 'Error MakeTailChamfer : Q09 too high'
EgtOutLog( sErr)
return false, sErr
end
end
-- creo raccordo o fillet
for i = 0, nEntityCnt - 1 do
local idFirst = nIdFirstEntity + i
local idSecond = EgtIf( i == nEntityCnt - 1, nIdFirstEntity, idFirst + 1)
local ptEndPointFirst = EgtEP( idFirst, GDB_ID.GRID) - ( abs( dQ09Value) * EgtEV( idFirst, GDB_ID.GRID))
local ptStartPointSecond = EgtSP( idSecond, GDB_ID.GRID) + ( abs( dQ09Value) * EgtEV( idSecond, GDB_ID.GRID))
if bChamferedEdge then
EgtCurveChamfer( AddGrpId, idFirst, ptEndPointFirst, idSecond, ptStartPointSecond, abs( dQ09Value), true, GDB_RT.GRID)
else
EgtCurveFillet( AddGrpId, idFirst, ptEndPointFirst, idSecond, ptStartPointSecond, abs( dQ09Value), true, GDB_RT.GRID)
end
end
EgtSelectPathObjs( nIdFirstEntity, true)
local idGeom, idGeomCnt = EgtCurveCompoByChain( AddGrpId, GDB_ID.SEL, {0,0,0}, true)
if not idGeom or idGeomCnt > 1 then
local sErr = 'Error MakeTailChamfer : too many loops'
EgtOutLog( sErr)
return false, sErr
end
EgtChangeClosedCurveStartPoint( idGeom, p3MidPoint, GDB_RT.GRID)
-- reimposto la griglia
EgtSetGridFrame()
-- Inserisco la lavorazione del lato standard
local dExtra = 2
local sName1 = 'TailCham_' .. ( EgtGetName( idProc) or tostring( idProc))
local nMch1Id = EgtAddMachining( sName1, sMilling)
if not nMch1Id then
local sErr = 'Error adding machining ' .. sName1 .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ idGeom, -1}})
-- assegno affondamento e offset radiale
EgtSetMachiningParam( MCH_MP.DEPTH, dDepthTailChamfer + dExtra)
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch1Id, false)
return false, sErr
end
return true, nil
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- lavorazione con sega a catena per sezioni alte e larghe -- lavorazione con sega a catena per sezioni alte e larghe
local function MakeCutByChainSaw( nSurfId, sSawing, nFaceUse, dDepth, sNotes, dRadialOffset, bExtendStartEnd, bInvert) local function MakeCutByChainSaw( nSurfId, sSawing, nFaceUse, dDepth, sNotes, dRadialOffset, bExtendStartEnd, bInvert)
@@ -310,10 +208,6 @@ local function MakeCutByChainSaw( nSurfId, sSawing, nFaceUse, dDepth, sNotes, dR
local vtN = EgtSurfTmFacetNormVersor( nSurfId, 0, GDB_ID.ROOT) local vtN = EgtSurfTmFacetNormVersor( nSurfId, 0, GDB_ID.ROOT)
local vtOrtho = BL.GetVersRef( nFaceUse) local vtOrtho = BL.GetVersRef( nFaceUse)
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1)) EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1))
-- se il taglio è un precut, sto 10mm più all'interno per essere sicuro di tagliare effettivamente qualcosa
if BD.PRECUT_TAIL and sNotes and sNotes:find( 'Precut;') then
dRadialOffset = dRadialOffset - 10
end
-- imposto offset radiale per mantenere il materiale in coda per la finitura -- imposto offset radiale per mantenere il materiale in coda per la finitura
EgtSetMachiningParam( MCH_MP.OFFSR, dRadialOffset) EgtSetMachiningParam( MCH_MP.OFFSR, dRadialOffset)
-- imposto eventuale allungamento percorso iniziale -- imposto eventuale allungamento percorso iniziale
@@ -442,7 +336,7 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- tagli verticali aggiuntivi -- tagli verticali aggiuntivi
local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw, sNotes, dOffsetBetweenCuts) local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw, sNotes)
local nVerticalCuts = ceil( Proc.Face[1].WidthTrimmed / ( BD.MAX_LEN_DICE)) - 1 local nVerticalCuts = ceil( Proc.Face[1].WidthTrimmed / ( BD.MAX_LEN_DICE)) - 1
local dVerticalSliceHeight = Proc.Face[1].WidthTrimmed / ( nVerticalCuts + 1) local dVerticalSliceHeight = Proc.Face[1].WidthTrimmed / ( nVerticalCuts + 1)
-- recupero il diametro dell'utensile -- recupero il diametro dell'utensile
@@ -458,8 +352,8 @@ local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw, sNotes, d
for j = nVerticalCuts, 1, -1 do for j = nVerticalCuts, 1, -1 do
local nFaceUse = MCH_MILL_FU.PARAL_FRONT local nFaceUse = MCH_MILL_FU.PARAL_FRONT
local dVerticalCutOffset = dVerticalSliceHeight * -j local dVerticalCutOffset = dVerticalSliceHeight * -j
local sLeadInOutType = 'PerpendicularOutraw' local bForceTangentLeadInOut = BD.PRESS_ROLLER and not BD.DOWN_HEAD
bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, sNotes, b3Raw, nil, nil, nil, sLeadInOutType, nil, dOffsetBetweenCuts) bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, sNotes, b3Raw, nil, nil, nil, bForceTangentLeadInOut)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
end end
@@ -480,7 +374,7 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, TailCut
local dCutExtra = 0 local dCutExtra = 0
local dAccStart = 0 local dAccStart = 0
local dAccEnd = 0 local dAccEnd = 0
if TailCutType.bBigSectionCut and BD.C_SIMM and b3Raw:getDimZ() > BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL then if TailCutType.bBigSectionCut and BD.C_SIMM then
-- qui arrivano sezioni molto grandi su macchine tipo PF con materiale da asportare inferiore allo spessore lama -- qui arrivano sezioni molto grandi su macchine tipo PF con materiale da asportare inferiore allo spessore lama
local dSawRad = Cutting1Data.dSawDiam / 2 local dSawRad = Cutting1Data.dSawDiam / 2
dCutExtra = - ( b3Raw:getDimY() - dSawRad) dCutExtra = - ( b3Raw:getDimY() - dSawRad)
@@ -528,8 +422,8 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, TailCut
for j = nHorizontalCuts, 1, -1 do for j = nHorizontalCuts, 1, -1 do
local nFaceUse = MCH_MILL_FU.PARAL_DOWN local nFaceUse = MCH_MILL_FU.PARAL_DOWN
local dHorizontalCutOffset = dHorizontalSliceHeight * -j local dHorizontalCutOffset = dHorizontalSliceHeight * -j
local sLeadInOutType = 'PerpendicularOutraw' local bForceTangentLeadInOut = BD.PRESS_ROLLER
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0 , Cutting1Data.sCutting, Cutting1Data.dSawDiam, nFaceUse, nil, -0.1 - dCutXOffset, BD.CUT_SIC, dHorizontalCutOffset, 0, 0, 'Precut;', b3Raw, nil, nil, nil, sLeadInOutType, nil, dOffsetBetweenCuts) local bOk, sErr = Fbs.MakeOne( Proc.Id, 0 , Cutting1Data.sCutting, Cutting1Data.dSawDiam, nFaceUse, nil, -0.1 - dCutXOffset, BD.CUT_SIC, dHorizontalCutOffset, 0, 0, 'Precut;', b3Raw, nil, nil, nil, bForceTangentLeadInOut)
if not bOk then return false, sErr end if not bOk then return false, sErr end
end end
-- se necessario taglio verticale doppio, eseguo l'opposto -- se necessario taglio verticale doppio, eseguo l'opposto
@@ -578,7 +472,7 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, TailCut
-- se trave larga effettuo tagli verticali aggiuntivi -- se trave larga effettuo tagli verticali aggiuntivi
if TailCutType.bNeedVerticalAddedCuts then if TailCutType.bNeedVerticalAddedCuts then
local sSpecNotes = EgtIf( TailCutType.bSplit, 'Presplit;', 'Precut;') local sSpecNotes = EgtIf( TailCutType.bSplit, 'Presplit;', 'Precut;')
local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw, sSpecNotes, dOffsetBetweenCuts) local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw, sSpecNotes)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
end end
if i == 1 and TailCutType.sType =='Precut' then if i == 1 and TailCutType.sType =='Precut' then
@@ -647,7 +541,7 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, TailCut
-- se trave larga effettuo tagli verticali aggiuntivi -- se trave larga effettuo tagli verticali aggiuntivi
if TailCutType.bNeedVerticalAddedCuts then if TailCutType.bNeedVerticalAddedCuts then
local sSpecNotes = EgtIf( TailCutType.bSplit, 'Presplit;', 'Precut;') local sSpecNotes = EgtIf( TailCutType.bSplit, 'Presplit;', 'Precut;')
local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw, sSpecNotes, dOffsetBetweenCuts) local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw, sSpecNotes)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
end end
local sNotes local sNotes
@@ -679,15 +573,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
if not bOkc then return bOkc, sErrC end if not bOkc then return bOkc, sErrC end
end end
-- recupero la lavorazione -- recupero la lavorazione
-- TODO questa parte andrà cambiata quando si gestiranno i volumi liberi in cui girare da mlse local sCutting = ML.FindCutting( 'TailSide')
local dMinWidthForBigBlade = 300
local dMaxHeightForBigBlade = 300
local sCutting
if b3Raw:getDimY() > dMinWidthForBigBlade and b3Raw:getDimZ() < dMaxHeightForBigBlade then
sCutting = ML.FindCutting( 'TailSide', nil, nil, nil, 'Longest')
else
sCutting = ML.FindCutting( 'TailSide')
end
if not sCutting then if not sCutting then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -737,11 +623,10 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
-- caratteristiche taglio -- caratteristiche taglio
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dSawMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM)) local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dSawMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM))
local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and
( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dSawMaxDepth2) - 2 * BD.CUT_EXTRA + 10 * GEO.EPS_SMALL) ( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dSawMaxDepth2) - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bHorizCut = ( ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and ( b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA)) local bHorizCut = ( ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and ( b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA))
local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL) and local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
( b3Raw:getDimY() < 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
-- dati geometrici del taglio -- dati geometrici del taglio
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
-- separazione solo se esiste grezzo successivo con pezzi o scaricabile -- separazione solo se esiste grezzo successivo con pezzi o scaricabile
@@ -767,10 +652,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
-- determino la necessità di tagli aggiuntivi -- determino la necessità di tagli aggiuntivi
local dMinTailScrapForAdditionalCuts = 10.123 local dMinTailScrapForAdditionalCuts = 10.123
local bNeedVerticalAddedCuts = not bSplit and ( Proc.Face[1].WidthTrimmed > BD.MAX_LEN_DICE) and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) local bNeedVerticalAddedCuts = not bSplit and ( Proc.Face[1].WidthTrimmed > BD.MAX_LEN_DICE) and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL)
local bNeedHorizontalAddedCuts = not bSplit and not bBigSectionCut and local bNeedHorizontalAddedCuts = not bSplit and ( Proc.Face[1].HeightTrimmed > ( BD.MIN_HEIGHT_ADDED_CUTS or BD.MAX_LEN_DICE)) and not bBigSectionCut and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL)
( Proc.Face[1].HeightTrimmed > ( BD.MIN_HEIGHT_ADDED_CUTS or BD.MAX_LEN_DICE) + 100 * GEO.EPS_SMALL) and
( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) and
dOffsL < BD.MAX_DIM_DICE
-- dati lavorazioni sopra e sotto -- dati lavorazioni sopra e sotto
local Cutting1Data = { sCutting = sCutting, dSawDiam = dSawDiam, dMaxDepth = dSawMaxDepth, dSawThick = dSawThick, dMaxVertDepth = dMaxVertDepth} local Cutting1Data = { sCutting = sCutting, dSawDiam = dSawDiam, dMaxDepth = dSawMaxDepth, dSawThick = dSawThick, dMaxVertDepth = dMaxVertDepth}
local Cutting2Data = { sCutting = sCutting2, dSawDiam = dSawDiam2, dMaxDepth = dSawMaxDepth2, dSawThick = dSawThick2} local Cutting2Data = { sCutting = sCutting2, dSawDiam = dSawDiam2, dMaxDepth = dSawMaxDepth2, dSawThick = dSawThick2}
@@ -834,7 +716,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
-- determinazione materiale da asportare -- determinazione materiale da asportare
local dSawThickCheck = dSawThick local dSawThickCheck = dSawThick
if dSawThick2 > 0 and bDoubleHorizCut then if dSawThick2 > 0 and bDoubleHorizCut then
dSawThickCheck = max( min( dSawThick, dSawThick2), dOvmTail) dSawThickCheck = min( dSawThick, dSawThick2)
end end
local dMaxElev = 0 local dMaxElev = 0
if vtN:getX() > 0 then if vtN:getX() > 0 then
@@ -877,16 +759,18 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
if AreOppositeVectorApprox( X_AX(), vtNLimitingSurf) then EgtInvertSurf( nLimitingSurf) end if AreOppositeVectorApprox( X_AX(), vtNLimitingSurf) then EgtInvertSurf( nLimitingSurf) end
end end
-- tagli verticali -- tagli verticali
bOk, sErr = AddVerticalPreCuts( AddProc, sCutting, 0, b3Raw, sNotes, dOffsL) bOk, sErr = AddVerticalPreCuts( AddProc, sCutting, 0, b3Raw, sNotes)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
-- tagli a cubetti con eventuale superficie limitante -- tagli a cubetti con eventuale superficie limitante
local sLeadInOutType = 'PerpendicularOutraw' bOk, sErr = Cut.Make( AddProc, nNewPhase, nRawId, nPartId, dMaxElev, nil, false, true, b3Raw, sNotes, dCurrOvmT, nil, nLimitingSurf)
bOk, sErr = Cut.Make( AddProc, nNewPhase, nRawId, nPartId, dMaxElev, nil, false, true, b3Raw, sNotes, dCurrOvmT, nil, nLimitingSurf, sLeadInOutType)
end end
-- tagli aggiuntivi non necessari -- tagli aggiuntivi non necessari
else else
local sLeadInOutType = 'PerpendicularOutraw' local bForceTangentLeadInOut = false
bOk, sErr = Cut.Make( Proc, nNewPhase, nRawId, nPartId, dMaxElev, nil, false, true, b3Raw, sNotes, dCurrOvmT, nil, nil, sLeadInOutType) if BD.PRESS_ROLLER then
bForceTangentLeadInOut = true
end
bOk, sErr = Cut.Make( Proc, nNewPhase, nRawId, nPartId, dMaxElev, nil, false, true, b3Raw, sNotes, dCurrOvmT, nil, nil, bForceTangentLeadInOut)
end end
if sNotesFinal then if sNotesFinal then
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotesFinal) EgtSetMachiningParam( MCH_MP.USERNOTES, sNotesFinal)
@@ -925,43 +809,6 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
local bOk, sErr = MakeStandardCuts( Proc, b3Raw, nCuts, dOffsL, TailCutType, Cutting1Data, Cutting2Data, nil, dLenEndRaw) local bOk, sErr = MakeStandardCuts( Proc, b3Raw, nCuts, dOffsL, TailCutType, Cutting1Data, Cutting2Data, nil, dLenEndRaw)
-- se smussi in coda da aggiungere
local dDepthTailChamfer = EgtGetInfo( nOriId or Proc.Id, 'Q08', 'd') or 0
if dDepthTailChamfer > 100 * GEO.EPS_SMALL then
-- creo subito nuova fase qui, a meno che non sia stata già creata
if nNewPhase == 0 then
BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET)
nNewPhase = EgtGetCurrPhase()
local nDispId = EgtGetPhaseDisposition( nNewPhase)
if sDownOrSideOrStd == 'down' then
EgtRotateRawPart( nRawId, X_AX(), 180)
EgtSetInfo( nDispId, 'TYPE', 'MID2')
EgtSetInfo( nDispId, 'ROT', -2)
elseif sDownOrSideOrStd == 'side' then
if bPreMove then EgtMoveRawPart( nRawId, vtMove) end
EgtRotateRawPart( nRawId, X_AX(), EgtIf( BD.RIGHT_LOAD, -90, 90))
if not bPreMove then EgtMoveRawPart( nRawId, vtMove) end
EgtSetInfo( nDispId, 'TYPE', 'MID2')
EgtSetInfo( nDispId, 'ROT', -1)
else
EgtSetInfo( nDispId, 'TYPE', 'END')
end
EgtSetInfo( nDispId, 'ORD', nOrd)
-- se grezzo successivo senza pezzi e finale, va tolto
local nNextRawId = EgtGetNextRawPart( nRawId)
if nNextRawId and EgtGetPartInRawPartCount( nNextRawId) == 0 and EgtGetRawPartBBox( nNextRawId):getDimX() < BD.MinRaw then
EgtRemoveRawPartFromCurrPhase( nNextRawId)
end
end
-- alla fine del taglio si aggiungono gli smussi in testa
local _, sErrHeadChamfer = MakeTailChamfer( nOriId or Proc.Id, nPartId, dDepthTailChamfer)
if sErr then
sErr = sErr..'\n'..sErrHeadChamfer
else
sErr = sErrHeadChamfer
end
end
return bOk, sErr, nNewPhase return bOk, sErr, nNewPhase
end end
+34 -154
View File
@@ -140,112 +140,6 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
return true return true
end end
---------------------------------------------------------------------
local function MakePocket( Proc, nPartId, ptPs, vtN, nFaceRef, nDiffWidth, sMchFind, nUseRoughTool, tBHx)
-- calcolo il elevazione dal punto medio
local dElev
local dLenIn, dLedOut = BL.GetPointDirDepth( nPartId, ptPs, vtN[nFaceRef])
if dLenIn > 0 then
dElev = dLenIn
elseif dLedOut then
dElev = dLedOut
end
local dCollSic = 2 * BD.COLL_SIC
local sTuuidMstr
-- calcolo il diametro utensile
local dDiamTool
if nUseRoughTool == 1 then
-- se feature passante prendo utensile più grande possibile
if ( Proc.AffectedFaces.Top and Proc.AffectedFaces.Bottom) or ( Proc.AffectedFaces.Front and Proc.AffectedFaces.Back) then
dDiamTool = nil
else
dDiamTool = max( 80, min( tBHx[nFaceRef][1], tBHx[nFaceRef][2]))
end
else
-- se non uso truciolatore prendo il valore dalle dimensioni minime delle facce
dDiamTool = min( tBHx[nFaceRef][1], tBHx[nFaceRef][2])
end
-- abilitazione lavorazione da sotto (testa da sotto e direzione normale sotto -30deg)
local bTopHead = ( BD.DOWN_HEAD and vtN[nFaceRef]:getZ() > -0.1)
local bDownHead = ( BD.DOWN_HEAD and vtN[nFaceRef]:getZ() < 0.1)
-- recupero la lavorazione
local sPocketing, _, _, bDownHead = ML.FindPocketing( sMchFind.. EgtIf( bDownHead, '_H2', ''), dDiamTool, dElev + dCollSic, nil, bTopHead, bDownHead)
if not sPocketing then
local sErr = 'Error : pocketing not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- recupero il diametro dell'utensile
if EgtMdbSetCurrMachining( sPocketing) then
sTuuidMstr = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuidMstr) or '') then
dDiamTool = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dDiamTool
end
end
-- inserisco la lavorazione di svuotatura
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. 'F' .. tostring( nFaceRef - 1)
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, (nFaceRef-1)}})
-- imposto uso faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT)
-- imposto posizione braccio porta testa
if vtN[nFaceRef]:getY() < GEO.EPS_SMALL then
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
else
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end
-- La tasca ha sempre almeno un lato aperto, imposto opportuno attacco
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN)
-- imposto elevazione
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or ''
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dElev, 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
if not ML.ApplyMachining( true, false) then
-- provo ad allargare leggermente la tasca
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
return true, '', sTuuidMstr
end
---------------------------------------------------------------------
local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, ptC, vtN, nBigInd, nSmaInd, ptPs, tBHx, b3Raw, nDiffWidth, nUseRoughTool, dAng)
local sMchFind = 'Pocket'
-- se feature é larga come trave imposto openpocket
if nDiffWidth == 0 then
sMchFind = 'OpenPocket'
-- altrimenti se non è passante disabilito il truciolatore
else
nUseRoughTool = 0
end
-- applico la svuotatura
local bOk, sErr, sTuuidMstr = MakePocket( Proc, nPartId, ptPs, vtN, nBigInd, nDiffWidth, sMchFind, nUseRoughTool, tBHx)
if not bOk then
return bOk, sErr
end
-- se angolo tra le facce maggiore di 90, inserisco la contornatura o svuotatura del lato più corto
if dAng > -90 then
-- applico la svuotatura
local bOk, sErr = MakePocket( Proc, nPartId, ptPs, vtN, nSmaInd, nDiffWidth, sMchFind, nUseRoughTool, tBHx)
if not bOk then
return bOk, sErr
end
end
return true
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione al caso due facce -- Applicazione della lavorazione al caso due facce
local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead) local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
@@ -262,7 +156,6 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
return false, sErr return false, sErr
end end
-- dati delle facce -- dati delle facce
local tBHx = {}
local ptC = {} local ptC = {}
local vtN = {} local vtN = {}
ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
@@ -290,13 +183,11 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
-- recupero i dati dell'utensile -- recupero i dati dell'utensile
local dSawDiam = 400 local dSawDiam = 400
local dSawThick = 2
local dMaxDepth = 0 local dMaxDepth = 0
if EgtMdbSetCurrMachining( sCutting) then if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end end
end end
@@ -348,58 +239,47 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
vtRef[2] = vtN[2] ^ vtTg vtRef[2] = vtN[2] ^ vtTg
if vtRef[2] * vtN[1] < 0 then vtRef[2] = - vtRef[2] end if vtRef[2] * vtN[1] < 0 then vtRef[2] = - vtRef[2] end
-- determino quale faccia è più grande -- determino quale faccia è più grande
local rfFac1, dB1, dH1 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0) local _, dB1, dH1 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0)
local rfFac2, dB2, dH2 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 1) local _, dB2, dH2 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 1)
local nBigInd = EgtIf( dB1 * dH1 >= dB2 * dH2, 1, 2) local nBigInd = EgtIf( dB1 * dH1 >= dB2 * dH2, 1, 2)
local nSmaInd = 3 - nBigInd local nSmaInd = 3 - nBigInd
tBHx[1] = {dH1, dV1, rfFac1} -- calcolo extra taglio
tBHx[2] = {dH2, dV2, rfFac2} local dCutExtra = dExtraUp
local nUseRoughTool = EgtGetInfo( Proc.Id, 'Q02', 'i') if dAng < -90.5 and dAng > -179.5 then
if nUseRoughTool == 1 and dAng < -0.1 and dAng > -90 then dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp
local bOk, sErr = MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, ptC, vtN, nBigInd, nSmaInd, ptPs, tBHx, b3Raw, 0, nUseRoughTool, dAng) end
-- verifico se necessari tagli supplementari
local vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
--DC.PrintOrderCut( vCuts)
if #vCuts > 0 then
-- sistemo posizione nel DB e nome
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end
end
-- eseguo
for i = 1, #vCuts do
-- assegno il modo di tagliare
local vtOrthO = EgtIf( ( i % 2) == 1, vtRef[nSmaInd], vtRef[nBigInd])
-- lavoro la faccia
for j = 1, #vCuts[i] do
local dLocCutExtra = EgtIf( j == #vCuts[i], dCutExtra - dExtraUp, dCutExtra)
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthO, nil, dLocCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then
return bOk, sErr
end
end
end
-- altrimenti, tagli diretti delle facce
else
local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, EgtIf( bHead, 'HeadSide', 'TailSide'))
if not bOk then if not bOk then
return bOk, sErr return bOk, sErr
end end
else
-- calcolo extra taglio
local dCutExtra = dExtraUp
if dAng < -90.5 and dAng > -179.5 then
dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp
end
-- verifico se necessari tagli supplementari
local vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
--DC.PrintOrderCut( vCuts)
if #vCuts > 0 then
-- sistemo posizione nel DB e nome
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end
end
-- eseguo
for i = 1, #vCuts do
-- assegno il modo di tagliare
local vtOrthO = EgtIf( ( i % 2) == 1, vtRef[nSmaInd], vtRef[nBigInd])
-- lavoro la faccia
for j = 1, #vCuts[i] do
local dLocCutExtra = EgtIf( j == #vCuts[i], dCutExtra - dExtraUp, dCutExtra)
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthO, nil, dLocCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then
return bOk, sErr
end
end
end
-- altrimenti, tagli diretti delle facce
else
local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, EgtIf( bHead, 'HeadSide', 'TailSide'))
if not bOk then
return bOk, sErr
end
end
end end
end end
-- eventuale segnalazione ingombro di testa o coda -- eventuale segnalazione ingombro di testa o coda
if Proc.Head then if Proc.Head then
local dOffs = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX() local dOffs = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()
+6 -16
View File
@@ -13,7 +13,6 @@ local Fbs = require( 'FacesBySaw')
local DC = require( 'DiceCut') local DC = require( 'DiceCut')
local Cut = require( 'ProcessCut') local Cut = require( 'ProcessCut')
local Topology = require( 'FeatureTopology') local Topology = require( 'FeatureTopology')
local LapJoint = require( 'ProcessLapJoint')
EgtOutLog( ' ProcessStepJointNotch started', 1) EgtOutLog( ' ProcessStepJointNotch started', 1)
@@ -50,7 +49,7 @@ function ProcessStepJointNotch.Classify( Proc)
-- numero delle facce -- numero delle facce
local nFacetCnt = EgtSurfTmFacetCount( Proc.Id) local nFacetCnt = EgtSurfTmFacetCount( Proc.Id)
-- gestisco solo 2 o 4 facce -- gestisco solo 2 o 4 facce
if nFacetCnt ~= 2 and nFacetCnt ~= 3 and nFacetCnt ~= 4 and nFacetCnt ~= 6 and nFacetCnt ~= 8 then if nFacetCnt ~= 2 and nFacetCnt ~= 4 and nFacetCnt ~= 6 and nFacetCnt ~= 8 then
return false, false return false, false
end end
-- verifico le normali delle facce -- verifico le normali delle facce
@@ -133,12 +132,7 @@ local function MakePocket( Proc, nPartId, ptPs, vtN, nFaceRef, nDiffWidth, sMchF
-- calcolo il diametro utensile -- calcolo il diametro utensile
local dDiamTool local dDiamTool
if nUseRoughTool == 1 then if nUseRoughTool == 1 then
-- se feature passante prendo utensile più grande possibile dDiamTool = max( 80, min( tBHx[nFaceRef][1], tBHx[nFaceRef][2]))
if ( Proc.AffectedFaces.Top and Proc.AffectedFaces.Bottom) or ( Proc.AffectedFaces.Front and Proc.AffectedFaces.Back) then
dDiamTool = nil
else
dDiamTool = max( 80, min( tBHx[nFaceRef][1], tBHx[nFaceRef][2]))
end
else else
-- se non uso truciolatore prendo il valore dalle dimensioni minime delle facce -- se non uso truciolatore prendo il valore dalle dimensioni minime delle facce
dDiamTool = min( tBHx[nFaceRef][1], tBHx[nFaceRef][2]) dDiamTool = min( tBHx[nFaceRef][1], tBHx[nFaceRef][2])
@@ -181,9 +175,8 @@ local function MakePocket( Proc, nPartId, ptPs, vtN, nFaceRef, nDiffWidth, sMchF
-- La tasca ha sempre almeno un lato aperto, imposto opportuno attacco -- La tasca ha sempre almeno un lato aperto, imposto opportuno attacco
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN) EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN)
-- imposto elevazione -- imposto elevazione
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';'
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dElev, 1)) EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
-- provo ad allargare leggermente la tasca -- provo ad allargare leggermente la tasca
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1) EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
@@ -290,8 +283,8 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, ptC, vtN,
-- setto a 0 eventuali offset -- setto a 0 eventuali offset
EgtSetMachiningParam( MCH_MP.OFFSR, 0) EgtSetMachiningParam( MCH_MP.OFFSR, 0)
-- applico gli allungamenti o accorciamenti considerando che la lavorazione è invertita -- applico gli allungamenti o accorciamenti considerando che la lavorazione è invertita
EgtSetMachiningParam( MCH_MP.STARTADDLEN, EgtIf( bOpenStart, dTDiam / 2 + 10, - dTDiam / 2)) EgtSetMachiningParam( MCH_MP.STARTADDLEN, EgtIf( bOpenStart, dTDiam / 2, - dTDiam / 2))
EgtSetMachiningParam( MCH_MP.ENDADDLEN, EgtIf( bOpenEnd, dTDiam / 2 + 10, - dTDiam / 2)) EgtSetMachiningParam( MCH_MP.ENDADDLEN, EgtIf( bOpenEnd, dTDiam / 2, - dTDiam / 2))
-- attacchi e uscite lineari con parte tg nulla -- attacchi e uscite lineari con parte tg nulla
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.LINEAR) EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.LINEAR)
EgtSetMachiningParam( MCH_MP.LITANG, 0) EgtSetMachiningParam( MCH_MP.LITANG, 0)
@@ -585,9 +578,6 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessStepJointNotch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) function ProcessStepJointNotch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
if Proc.Fct == 3 then
return LapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
-- esecuzione eventuale smusso -- esecuzione eventuale smusso
-- ottengo anche il flag che indica che la feature è larga come la trave -- ottengo anche il flag che indica che la feature è larga come la trave
local bOkc, sErrC, nDiffWidth = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) local bOkc, sErrC, nDiffWidth = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
+4 -7
View File
@@ -236,9 +236,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno affondamento e offset radiale -- assegno affondamento e offset radiale
EgtSetMachiningParam( MCH_MP.DEPTH, -dTenH + dDepth + dExtra) EgtSetMachiningParam( MCH_MP.DEPTH, -dTenH + dDepth + dExtra)
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra) EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dDepth + dExtra, 1) .. ';')
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dDepth + dExtra, 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- assegno lato di lavoro -- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo -- eseguo
@@ -311,8 +309,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}}) EgtSetMachiningGeometry( {{ AuxId, -1}})
-- sistemo i parametri -- sistemo i parametri
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' local sUserNotes = EgtSetVal( 'MaxElev', EgtNumToString( dTenH - 100 * GEO.EPS_SMALL, 1)) .. ';'
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dTenH - 100 * GEO.EPS_SMALL, 1))
if i < nPass then sUserNotes = EgtSetValInNotes( sUserNotes, 'OutRaw', 3) end if i < nPass then sUserNotes = EgtSetValInNotes( sUserNotes, 'OutRaw', 3) end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
@@ -324,9 +321,9 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- se contorno aperto, cambio parametri di attacco/uscita -- se contorno aperto, cambio parametri di attacco/uscita
if not bClosed then if not bClosed then
EgtSetMachiningParam( MCH_MP.LITANG, 0.7 * dMillDiam) EgtSetMachiningParam( MCH_MP.LITANG, 0.7 * dMillDiam)
EgtSetMachiningParam( MCH_MP.LIPERP, 20) EgtSetMachiningParam( MCH_MP.LIPERP, 0)
EgtSetMachiningParam( MCH_MP.LOTANG, 0.7 * dMillDiam) EgtSetMachiningParam( MCH_MP.LOTANG, 0.7 * dMillDiam)
EgtSetMachiningParam( MCH_MP.LOPERP, 20) EgtSetMachiningParam( MCH_MP.LOPERP, 0)
end end
-- imposto posizione braccio porta testa -- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE local nSCC = MCH_SCC.NONE
+4 -4
View File
@@ -451,12 +451,12 @@ local function MakeMillCut( Proc, i, j, k, sMilling, nFacInd, TabNAD, rfFac, dOf
EgtSetMachiningParam( MCH_MP.STARTADDLEN, ( dToolDiam * 0.75)) EgtSetMachiningParam( MCH_MP.STARTADDLEN, ( dToolDiam * 0.75))
EgtSetMachiningParam( MCH_MP.ENDADDLEN, ( dToolDiam * 0.75)) EgtSetMachiningParam( MCH_MP.ENDADDLEN, ( dToolDiam * 0.75))
-- Note utente con dichiarazione nessuna generazione sfridi per Vmill solo in ultima passata in Z locale -- Note utente con dichiarazione nessuna generazione sfridi per Vmill solo in ultima passata in Z locale
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' local sUserNotes
if i < nStep then if i < nStep then
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dStep, 1)) sUserNotes = 'MaxElev=' .. EgtNumToString( dStep, 1) .. ';'
else else
sUserNotes = EgtSetValInNotes( sUserNotes, 'VMRS', 0) sUserNotes = 'VMRS=0;'
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dStep, 1)) sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( dStep, 1) .. ';'
end end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
+1 -3
View File
@@ -142,9 +142,7 @@ local function MakePocket( Proc, nRawId, b3Raw, nPartId)
end end
EgtSetMachiningParam( MCH_MP.DEPTH, min( 0, dMaxDepth - vDepth[i])) EgtSetMachiningParam( MCH_MP.DEPTH, min( 0, dMaxDepth - vDepth[i]))
-- imposto elevazione -- imposto elevazione
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxDepth, 1) .. ';')
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dMaxDepth, 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
-201
View File
@@ -1,206 +1,5 @@
==== Beam Update Log ==== ==== Beam Update Log ====
Versione 3.1e1 (05/05/2026)
- Modif : in LapJoint migliorate slot con sega a catena
- Fixed : in DrillPocket in doppio eliminata lavorazione aggiuntiva in caso di utensile non abbastanza lungo
Versione 3.1d2 (10/04/2026)
- Added : in StepJoint aggiunto Q02=1 per forzare fresa
- Added : in DtMortise aggiunto Q01=1 per disabilitare antischeggia
- Fixed : in LapJoint correzione a antischeggia con fresa in caso di feature spezzata
Versione 3.1d1 (08/04/2026)
- Added : le forature vengono accorciate con massima elevazione anche in presenza di tagli di testa
- Modif : nelle slot con lama verticali si lavora sempre in concordanza
- Fixed : in DtMortise correzione a lavorazione antischeggia
- Fixed : in LapJoint, se lavorazione vuota, si disattiva sempre; in Q02 si lavora sempre prima il lato sotto.
Versione 3.1c2 (18/03/2026)
- Added : in LapJoint (solo L030) aggiunto Q02 per fare solo contorno per forme a "C" e tunnel; Q17 spessore di eventuale codolo
- Modif : per LapJoint e simili il Q06 per antischeggia ora contempla il valore 3 per scegliere la strategia in automatico (lama o fresa)
- Modif : in LapJoint migliorie nella lavorazione delle tasche aperte
- Modif : in LongDoubleCut e LapJoint lunghe migliorata scelta fresa in caso di tasca che guarda verso il basso
- Fixed : in forature in doppio con svuotatura corretto ultimo step
- Fixed : in split correzione in caso di materiale di coda molto sottile e testa sotto
- Fixed : in LongDoubleCut e LapJoint lunghe eliminata passate finale dopo taglio di coda se non è presente un grezzo successivo
Versione 3.1c1 (04/03/2026)
- Fixed : correzione in ordinamento (fori vs tagli)
- Fixed : in drilling rimosso preforo duplicato
Versione 3.1b1 (26/02/2026)
- Added : in LapJoint lunghe gestito Q14 per lavorare discorde
- Added : in forature ora sono possibili le DrillPocket in doppio (ultimo step fatto dalla testa principale)
- Added : in FreeContour (contornatura) aggiunta Q10 per forzare massima elevazione
- Modif : in LongDoubleCut e LapJoint lunghe migliorata la scelta della faccia da lavorare e altre migliorie
- Modif : in LapJoint migliorie alle svuotature
- Modif : in LapJoint lunghe, negli spezzoni successivi al primo, le svuotature considerano l'area svuotata precedente
- Fixed : in forature in doppio si garantisce l'ultimo step per evitare collisioni delle punte o finecorsa
- Fixed : in mortasa a coda di rondine tagliata corretti ingresso uscita in caso di svuotatura
- Fixed : in tagli di testa e coda corretti smussi con P08 e P09
Versione 2.7l3 (23/12/2025)
- Modif : nei fori che attraversano un taglio si decide la precedenza in base all'angolo tra foro e taglio stesso
- Fixed : corretto precut in caso di sega a catena
Versione 2.7l2 (16/12/2025)
- Added : in LapJoint pulizia spigoli con fresa a V su tasche non passanti
Versione 2.7l1 (10/12/2025)
- Added : in LapJoint aggiunta gestione fresatura con aggregato flottante (Q specifica)
- Modif : in LapJoint modfifiche alla lavorazione spigoli su faccia frontale o posteriore
- Modif : in LapJoint lunghe, la spezzatura ora considera se è presente del grezzo dietro
Versione 2.7k1 (25/11/2025)
- Added : in tagli di testa e coda aggiunti smussi con possibilità di raccordare o smussare spigoli
- Added : in Lapjoint aggiunto Q14 per settare lavorazione discorde se longitudinale su faccia sotto
- Modif : migliorati i tagli
- Modif : migliorata lavorazione mortasa a coda di rondine
- Fixed : in Lapjoint alcune svuotature forzate a spirale
Versione 2.7j2 (30/10/2025)
- Fixed : in DoubleCut gestito il caso in cui si ha una terza faccia piccola da non lavorare
Versione 2.7j1 (28/10/2025)
- Modif : migliorato ordinamento feature
- Modif : in mortasa si considera ora il raggio minimo impostato da parametro P
- Modif : migliorie in tenone a coda di rondine
- Fixed : in mortasa corretto percorso errato in caso di diametro utensile uguale a larghezza tasca
- Fixed : in profilo cambered (103) gestito correttamente inverti in lavorazione
Versione 2.7i2 (30/09/2025)
- Modif : migliorie a mortasa e tenone a coda di rondine
- Modif : migliorie a LongDoubleCut
- Modif : migliorie ai tagli
Versione 2.7i1 (03/09/2025)
- Added : in Tenone a coda di rondine aggiunto passaggio di finitura in caso di P14 > 0
- Modif : in LapJoint migliorata la scelta lama in caso di due facce e altre piccole correzioni
Versione 2.7h3 (26/08/2025)
- Added : in LapJoint, se possibile, si ricalcola l'elevazione in caso di feature troncanti testa/coda
- Modif : eventuali feature troncanti testa/coda sono fatte sempre subito dopo i rispettivi tagli di testa/coda
Versione 2.7h2 (19/08/2025)
- Modif : migliorata ottimizzazione teste
- Modif : migliorate forature in doppio
- Modif : in LapJoint migliorate lavorazioni lama + sega a catena
- Modif : in LapJoint migliorata spezzatura per feature lunghe rispetto al pezzo
- Modif : in LapJoint tipo BirdsMouth migliorata lavorazione faccia inclinata
- Modif : in StepJointNotch, se 3 facce si riconduce a LapJoint
Versione 2.7h1 (05/08/2025)
- Fixed : in Mortise migliorata la lavorazione in caso di feature trimmata
- Modif : in LapJoint, riduzione massimo materiale lama per lavorazioni antischeggia di lama con direzione verticale
- Modif : in LapJoint migliorie alla lavorazione tipo BlockHaus
- Modif : nei profili si usa il tipo lavorazione Prof_end per la finitura
Versione 2.7g5 (14/07/2025)
- Fixed : in tagli di testa e coda corretti attacchi
Versione 2.7g4 (11/07/2025)
- Fixed : in LapJoint 2 facce correzione nella scelta lama da sotto
Versione 2.7g3 (11/07/2025)
- Fixed : in RidgeLap corretta scelta del lato da lavorare
Versione 2.7g2 (10/07/2025)
- Fixed : in LapJoint correzione per caso in cui la sega a catena lavorava la tasca in modo errato
Versione 2.7g1 (08/07/2025)
- Added : in LapJoint, aggiunti smussi anche se lavorazione con truciolatore
- Added : per profilo caudato aggiunta finitura con fresa piccola
- Added : gestione tastatura
- Modif : nei tagli di testa e coda, compresi quelli di spezzatura, la lama evita di arretrare se non necessario
- Modif : in LongDoubleCut migliorie varie
- Modif : in RidgeLap migliorie varie
- Modif : nelle forature che attraversano un taglio ora si considera la profondità già lavorata
- Fixed : in LongDoubleCut corretta lavorazione aggiunta erroneamente dopo separazione
Versione 2.7f3 (19/06/2025)
- Modif : in StepJointNotch corretta distanza attacco in/out
Versione 2.7f2 (18/06/2025)
- Modif : in LongDoubleCut aggiunto messaggio feature non completa se utensile non arriva sul fondo
- Modif : in StepJointNotch, se si forza truciolatore, si prende utensile più grande
- Fixed : in LapJoint, piccola correzione calcolo sovrapposizione trimesh per svuotatura
- Fixed : in LapJoint, per sovrapposizione in spezzatura, corretto caso tipo Tunnel
Versione 2.7f1 (03/06/2025)
- Modif : in tenone coda di rondine modificato angolo limite tenone per lavorazione in sottosquadro
- Modif : migliorie per lavorazioni su aggregato
Versione 2.7e2 (23/05/2025)
- Modif : in tagli di lama migliorie alla scelta del lato da lavorare
- Modif : in mortasa coda di rondine migliorati i percorsi
- Modif : in tenone coda di rondine migliorate le lavorazioni da sotto
- Fixed : in Scarf Joint correzione alla scelta faccia da lavorare
Versione 2.7e1 (05/05/2025)
- Modif : in LapJoint se tunnel verticale lavorato solo da sopra e l'utensile non arriva, si restituisce warning
- Fixed : in taglio di separazione si riduce percorso di taglio solo se il pezzo è effettivamente alto
- Fixed : in foratura corretto caso in cui non si sceglieva l'utensile più lungo disponibile
- Fixed : In BatchProcess (Ts7) corretta generazione in caso di progetto senza ricalcolo
Versione 2.7d3 (22/04/2025)
- Fixed : in LapJoint corretta gestione errata Q04
Versione 2.7d2 (17/04/2025)
- Added : in scanalatura aggiunta Q03 per forzare fresa
- Modif : in slot con lama + sega a catena abilitata lavorazione da sotto per macchine con testa sopra
- Modif : nei tagli modifche in caso di tagli di coda anticipati
- Modif : in lavorazioni tipo tacca ma 3 facce migliorata la scelta faccia
Versione 2.7d1 (04/04/2025)
- Fixed : in PreDrill piccola correzione
- Fixed : nei tagli varie correzioni
- Fixed : in HeadCut e Split corretto calcolo lunghezza extra di taglio
Versione 2.7c2 (24/03/2025)
- Fixed : in BatchProcess (Ts7) riabilitata modifica barra erroneamente rimossa
Versione 2.7c1 (17/03/2025)
- Modif : in HeadCut e Split, per decidere se fare doppio taglio verticale, si controlla anche il massimo possibile e non solo il minimo
- Modif : in LapJoint migliorato controllo per decidere se feature di coda
- Modif : nei tagli, se taglio rivolto verso il basso e non possibile tagliare di fianco, si fa in fase ribaltata
- Fixed : in BatchProcess (Ts7) corretta restituzione stato feature erroneamente segnalata verde
- Fixed : corretta restituzione stato feature lavorata in doppio
Versione 2.7b3 (03/03/2025)
- Modif : in forature passanti orizzontali fatte da un solo lato, si inverte il lato di lavoro in base all'utensile scelto
- Modif : in LapJoint in lavorazione tipo BH permessa U passante non parallela agli assi principali; attacchi migliorati
- Modif : in LapJoint le feature di coda con pezzo lungo vengono spostate sempre dopo separazione
- Fixed : in macchine tipo Turn piccoli miglioramenti ai tagli di lama
Versione 2.7b2 (05/02/2025)
- Modif : si consentono DrillPocket in doppio solo se foro non passante
Versione 2.7b1 (04/02/2025)
- Modif : in tagli di testa e coda l'utilizzo delle lame grandi (es: 1000 su 15003TMAX) è limitato ai pezzi più bassi di 300 mm e più larghi di 300 mm
Versione 2.7a2 (23/01/2025)
- Added : in RidgeLap aggiunta Q05 per usare la fresa tipo LapJoint
- Fixed : in BatchProcess (Ts7) piccola correzione
- Fixed : in ScarfJoint, in caso di taglio dal lato, aggiunta estensione oltre il bordo
Versione 2.7a1 (21/01/2025)
- Added : in FreeContour aggiunta Q09 per inversione ultima lavorazione
- Modif : in Cut, si taglia dal basso solo se il pezzo piccolo è già staccato dalla barra
- Modif : in BatchProcess (Ts7) aggiunta scrittura id progetto e produzione in Btm
Versione 2.6l2 (07/01/2025)
- Added : in LapJoint abiitata SideMillAsBlade anche da sotto e varie migliorie
- Modif : in LapJoint L030 aggiunto Q03=4 per lavorare con fresa evitando tasche aperte testa/coda
- Modif : in LapJoint modifiche per gestione fresa a disco su aggregato
- Modif : in fresature con lama o simili aggiunta la possibilità di invertire il senso di percorrenza calcolato in automatico
- Modif : migliorie all'ordinamento
- Fixed : in LapJoint la Q per forzare lavorazione di lato funziona solo se la feature è aperta davnti o dietro
Versione 2.6l1 (11/12/2024)
- Added : aggiunta gestione slot e tagli di lama con lame molto grandi
- Modif : in lama + motosega aggiunta gestione slot aperte con lato obliquo
- Modif : modificata retrazione per tenoni aperti
Versione 2.6k2 (28/11/2024) Versione 2.6k2 (28/11/2024)
- Modif : nei tagli migliorati i casi in cui si inverte l'SCC per facilitare la caduta del legno - Modif : nei tagli migliorati i casi in cui si inverte l'SCC per facilitare la caduta del legno
- Modif : nei tagli migliorato controllo rimozione del primo cubetto molto piccolo - Modif : nei tagli migliorato controllo rimozione del primo cubetto molto piccolo
+3 -3
View File
@@ -1,6 +1,6 @@
-- Version.lua by Egaltech s.r.l. 2026/02/09 -- Version.lua by Egaltech s.r.l. 2024/01/30
-- Gestione della versione di Beam -- Gestione della versione di Beam
NAME = 'Beam' NAME = 'Beam'
VERSION = '3.1e1' VERSION = '2.6k2'
MIN_EXE = '3.1b1' MIN_EXE = '2.6e5'