Compare commits

..

44 Commits

Author SHA1 Message Date
luca.bacis 9611b30a66 - minors and spacings 2022-01-28 16:01:09 +01:00
luca.bacis 037530ac73 - comment 2022-01-28 12:05:47 +01:00
luca.bacis 09b24de561 - fix concatenamento stringa nil 2022-01-28 11:44:37 +01:00
luca.bacis 8cb5c8e19a - versione definitiva 2022-01-28 08:40:26 +01:00
luca.bacis 1dc3f2594b - merge manuale da master 2022-01-27 14:47:30 +01:00
luca.bacis 1ee2c75d06 Merge remote-tracking branch 'remotes/origin/master' into lapjoint 2022-01-27 14:47:08 +01:00
luca.bacis 2893ab0f02 - minors 2022-01-27 08:51:16 +01:00
luca.bacis 4e7e24f740 - aggiunto parametro dSawCornerRad a DoSideChainSaw 2022-01-25 17:41:27 +01:00
luca.bacis c46cec0538 - aggiunte funzioni DoClean, DoPocketing + ottimizzazioni varie 2022-01-25 16:33:24 +01:00
luca.bacis 95e3577ba3 - ottimizzazioni 2022-01-24 17:51:36 +01:00
luca.bacis 0c79fe6c7e - minors 2022-01-21 12:55:18 +01:00
luca.bacis 0cecac7911 - minors 2022-01-21 12:16:45 +01:00
luca.bacis b43f8275e5 - minors 2022-01-21 11:27:48 +01:00
luca.bacis d59b0feea5 - Merge branch 'master' into lapjoint 2022-01-20 16:36:00 +01:00
luca.bacis 83502accaf - ottimizzazioni 2022-01-20 15:06:10 +01:00
luca.bacis 83d255e28f - Ottimizzazioni varie 2022-01-20 09:49:05 +01:00
luca.bacis 31ee94c060 - aggiunte funzioni DoHeadChainSaw, DoSideChainSaw e DoHeadCut 2022-01-19 17:28:29 +01:00
luca.bacis d286f02c0f - merge dal master branch 2022-01-19 11:47:44 +01:00
luca.bacis 5bcfaad5d3 - Merge con master branch 2022-01-19 10:34:12 +01:00
luca.bacis 257bbf3595 - aggiunta funzione DoPocket() 2022-01-19 10:19:55 +01:00
luca.bacis 0700bf6678 - Aggiunto GetFacetsData() e funzioni accessorie 2022-01-18 17:37:26 +01:00
luca.bacis aec6ebf72e - commenti / minors 2022-01-14 17:38:54 +01:00
luca.bacis 079eecbbca - corretta mancanza parametro dFaceElev2 a MakePocketingOrMilling() 2022-01-14 14:47:49 +01:00
luca.bacis eba1423f65 - versione definitiva 2022-01-14 12:14:38 +01:00
luca.bacis 1627c13eb4 - commenti 2022-01-13 17:10:14 +01:00
luca.bacis ea4f41615b - piccola correzione di un refuso in MakeBySideMill 2022-01-13 16:55:12 +01:00
luca.bacis 54a2f65000 - Ottimizzazioni 2022-01-13 14:57:24 +01:00
luca.bacis 78f7ba6d20 - Ottimizzazioni 2022-01-12 17:27:41 +01:00
luca.bacis b72cf7364b Merge remote-tracking branch 'origin/master' into lapjoint 2022-01-11 17:20:18 +01:00
luca.bacis 7536fb16bc - Ottimizzazioni 2022-01-11 17:19:44 +01:00
luca.bacis ef8be31a53 - ottimizzazioni 2022-01-10 17:12:30 +01:00
luca.bacis f022405749 - Inizio divisione lavorazioni per numero di facce 2022-01-10 12:41:43 +01:00
luca.bacis 62ca34a757 - Prime ottimizzazioni con alcune variabili rese globali 2022-01-10 10:03:36 +01:00
luca.bacis 050c129d1e - Ottimizzazioni 2021-12-29 09:13:12 +01:00
luca.bacis 36c3b4a354 - commenti 2021-12-23 10:27:12 +01:00
luca.bacis 7647cd3a45 - ottimizzazioni 2021-12-22 15:29:25 +01:00
luca.bacis 065c3b499a - semplificazioni varie 2021-12-21 15:11:33 +01:00
luca.bacis 77d4f23bdd - modifiche varie 2021-12-20 17:53:53 +01:00
luca.bacis 9f320e4934 - WIP 2021-12-20 09:56:59 +01:00
luca.bacis 409f62de52 - Split funzione "MakeMoreFaces";
- Nuova funzione "MakeSpecialThreeFaces" con controllo ortogonalità (non OK)
2021-12-17 12:08:29 +01:00
luca.bacis 4757b1596b Test caso special3faces 2021-12-15 16:19:54 +01:00
luca.bacis bde8e81240 - lettura parametri Q solo all'inizio 2021-12-14 12:03:14 +01:00
luca.bacis 486083e6ff Merge branch 'master' into lapjoint 2021-12-14 10:25:54 +01:00
luca.bacis 1af9f64d11 - abilitazione debug e correzione typo 2021-12-14 09:47:35 +01:00
52 changed files with 4569 additions and 12344 deletions
-6
View File
@@ -16,9 +16,3 @@
/bin /bin
/obj /obj
/.vs /.vs
/32/*.lua
/32/LuaLibs/*.lua
/32/Images/*.png
/64/*.lua
/64/LuaLibs/*.lua
/64/Images/*.png
-119
View File
@@ -1,119 +0,0 @@
variables:
VERS_MAIN: '1.0'
APP_NAME: 'Beam'
NEW_REL: ''
NET_SHARE_R: '\\10.74.82.201\Artifacts\EGT_SRV\EgtTech'
NET_USER: '10.74.82.50\Server'
NET_SHARE_Z: '\\10.74.82.200\Artifacts'
NET_USERQ: 'steamw\egalware'
#Note compilazione LUA:
# lua53 -o 32\$FileName -s $FileName: -o = output, -s = NON include i debug symbols
# helper compilazione LUA a 32 bit
.LuaCompile32: &LuaCompile32
- |
Set-Alias lua53 C:\Tools\Lua32\luac53
echo "Copia file *.ini"
$FileList = Get-ChildItem("*.ini")
ForEach ($File in $FileList) {
$FileName = Split-Path $File -leaf
Copy-Item -Path $FileName -Destination 32\$FileName
echo "Copy-Item -Path $FileName -Destination 32\$FileName"
}
echo "Compilazione file *.lua 32bit"
$FileList = Get-ChildItem("*.lua")
ForEach ($File in $FileList) {
$FileName = Split-Path $File -leaf
lua53 -o 32\$FileName $FileName
echo "lua53 -o 32\$FileName $FileName"
}
$FileList = Get-ChildItem("LuaLibs\*.lua")
ForEach ($File in $FileList) {
$FileName = Split-Path $File -leaf
lua53 -o 32\LuaLibs\$FileName LuaLibs\$FileName
echo "lua53 -o 32\LuaLibs\$FileName LuaLibs\$FileName"
}
# Copy-Item -Path $FileName -Destination 32\$FileName
# echo "Copy-Item -Path $FileName -Destination 32\$FileName"
# helper compilazione LUA a 64 bit
.LuaCompile64: &LuaCompile64
- |
Set-Alias lua53 C:\Tools\Lua64\luac53
echo "Copia file *.ini"
$FileList = Get-ChildItem("*.ini")
ForEach ($File in $FileList) {
$FileName = Split-Path $File -leaf
Copy-Item -Path $FileName -Destination 64\$FileName
echo "Copy-Item -Path $FileName -Destination 64\$FileName"
}
echo "Compilazione file *.lua 64bit"
$FileList = Get-ChildItem("*.lua")
ForEach ($File in $FileList) {
$FileName = Split-Path $File -leaf
lua53 -o 64\$FileName $FileName
echo "lua53 -o 64\$FileName $FileName"
}
$FileList = Get-ChildItem("LuaLibs\*.lua")
ForEach ($File in $FileList) {
$FileName = Split-Path $File -leaf
lua53 -o 64\LuaLibs\$FileName LuaLibs\$FileName
echo "lua53 -o 64\LuaLibs\$FileName LuaLibs\$FileName"
}
# Copy-Item -Path $FileName -Destination 64\$FileName
# echo "Copy-Item -Path $FileName -Destination 64\$FileName"
# helper copia SORGENTI verso cartella di rete R:\ dei SORGENTI
.CodeReplicaR: &CodeReplicaR
- |
net use R: /delete
net use R: $env:NET_SHARE_R /u:$env:NET_USERQ $ZDRIVE_PASSWD
ROBOCOPY . R:\EgtData\$env:APP_NAME /MIR /XF .git* /XD .git
SLEEP 2
net use R: /delete
# helper copia script verso cartella di rete R:\ delle cartelle 32 e 64
.ReplicaR: &ReplicaR
- |
net use R: /delete
net use R: $env:NET_SHARE_R /u:$env:NET_USERQ $ZDRIVE_PASSWD
ROBOCOPY /MIR 32 R:\EgtData\$env:APP_NAME\32
ROBOCOPY /MIR 64 R:\EgtData\$env:APP_NAME\64
ROBOCOPY /MIR Images R:\EgtData\$env:APP_NAME\32\Images
ROBOCOPY /MIR Images R:\EgtData\$env:APP_NAME\64\Images
SLEEP 2
net use R: /delete
# helper copia script verso cartella di rete R:\ delle cartelle 32 e 64
.ReplicaZ: &ReplicaZ
- |
net use Z: /delete
net use Z: $env:NET_SHARE_Z /u:$env:NET_USERQ $ZDRIVE_PASSWD
ROBOCOPY /MIR 32 Z:\EgtData\$env:APP_NAME\32
ROBOCOPY /MIR 64 Z:\EgtData\$env:APP_NAME\64
ROBOCOPY /MIR Images Z:\EgtData\$env:APP_NAME\32\Images
ROBOCOPY /MIR Images Z:\EgtData\$env:APP_NAME\64\Images
SLEEP 2
net use Z: /delete
stages:
- build
LuaCompile:build:
stage: build
only:
- main
- master
tags:
- win
script:
- *LuaCompile32
- *LuaCompile64
- *CodeReplicaR
- *ReplicaR
- *ReplicaZ
View File
View File
View File
View File
+6 -21
View File
@@ -1,4 +1,4 @@
-- BatchProcess.lua by Egaltech s.r.l. 2022/04/28 -- BatchProcess.lua by Egaltech s.r.l. 2021/08/04
-- Gestione calcolo batch disposizione e lavorazioni per Travi -- Gestione calcolo batch disposizione e lavorazioni per Travi
-- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3. -- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3.
-- 2019/07/16 Aggiunta gestione modalità oltre 10 per impostazione macchina e uscita. -- 2019/07/16 Aggiunta gestione modalità oltre 10 per impostazione macchina e uscita.
@@ -22,7 +22,6 @@
-- 2021/02/25 Aggiunta gestione tipo scarico (standard, lav. incomplete, a caduta). -- 2021/02/25 Aggiunta gestione tipo scarico (standard, lav. incomplete, a caduta).
-- 2021/06/16 Se disponibile si aggiunge la versione dell'eseguibile alle info del programma CN. -- 2021/06/16 Se disponibile si aggiunge la versione dell'eseguibile alle info del programma CN.
-- 2021/08/04 Direzione vista simulazione da BD.SIMUL_VIEW_DIR se esiste. -- 2021/08/04 Direzione vista simulazione da BD.SIMUL_VIEW_DIR se esiste.
-- 2022/04/28 In info generazione aggiunta indicazione se 64bit.
-- Intestazioni -- Intestazioni
require( 'EgtBase') require( 'EgtBase')
@@ -42,7 +41,7 @@ if BEAM.FLAG == 0 then
elseif BEAM.FLAG == 1 then elseif BEAM.FLAG == 1 then
sFlag = 'MODIFY' sFlag = 'MODIFY'
elseif BEAM.FLAG == 2 then elseif BEAM.FLAG == 2 then
sFlag = 'SIMULATE' sFlag = 'SIMULATE'
elseif BEAM.FLAG == 3 then elseif BEAM.FLAG == 3 then
sFlag = 'CHECK' sFlag = 'CHECK'
elseif BEAM.FLAG == 4 then elseif BEAM.FLAG == 4 then
@@ -117,7 +116,8 @@ local function UpdateAuxData( sAuxFile)
end end
-- Imposto direttorio libreria specializzata per Travi -- Imposto direttorio libreria specializzata per Travi
EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua') local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
-- Impostazione della macchina corrente -- Impostazione della macchina corrente
EgtResetCurrMachGroup() EgtResetCurrMachGroup()
@@ -469,20 +469,6 @@ end
-- *** Eseguo simulazione con verifica collisione in cieco *** -- *** Eseguo simulazione con verifica collisione in cieco ***
if ( BEAM.FLAG == 0 and ( bToProcess or bToRecalc)) or BEAM.FLAG == 3 or BEAM.FLAG == 4 then if ( BEAM.FLAG == 0 and ( bToProcess or bToRecalc)) or BEAM.FLAG == 3 or BEAM.FLAG == 4 then
EgtOutLog( ' +++ Simulating with collision check >>>') EgtOutLog( ' +++ Simulating with collision check >>>')
-- verifico setup
local bSetUpOk, SetUpErrors = EgtVerifyCurrSetup()
if not bSetUpOk then
local sToolsList = ""
for ToolIndex = 1, #SetUpErrors do
sToolsList = sToolsList .. SetUpErrors[ToolIndex]
if ToolIndex ~= #SetUpErrors then
sToolsList = sToolsList .. ", "
end
end
WriteErrToLogFile( 19, 'Error in setup: tool/s ' .. sToolsList .. ' not found', 0, 0, 0)
return
end
-- lancio simulazione
local bSimOk, nErr, sErr = EgtSimulate() local bSimOk, nErr, sErr = EgtSimulate()
if not bSimOk then if not bSimOk then
if nErr == MCH_SHE.INIT then if nErr == MCH_SHE.INIT then
@@ -521,11 +507,10 @@ end
-- *** Genero programma CN *** ( se richiesto) -- *** Genero programma CN *** ( se richiesto)
if BEAM.FLAG == 0 or BEAM.FLAG == 4 then if BEAM.FLAG == 0 or BEAM.FLAG == 4 then
EgtOutLog( ' +++ Generating NC part program >>>') EgtOutLog( ' +++ Generating NC part program >>>')
local sInfo = 'EgtCAM5' .. EgtIf( EgtIs64bit(), ' 64bit', '') local sInfo = 'EgtCAM5 - '
if EgtGetExeVersion then if EgtGetExeVersion then
sInfo = sInfo .. ' ver.' .. EgtGetExeVersion() sInfo = 'EgtCAM5 ver.' .. EgtGetExeVersion() .. ' - '
end end
sInfo = sInfo .. ' - '
if not EgtGenerate( '', sInfo .. sNgeFile) then if not EgtGenerate( '', sInfo .. sNgeFile) then
BEAM.ERR = 20 BEAM.ERR = 20
local _, sName, _ = EgtSplitPath( BEAM.FILE) local _, sName, _ = EgtSplitPath( BEAM.FILE)
+49 -72
View File
@@ -1,4 +1,4 @@
-- BatchProcessNew.lua by Egaltech s.r.l. 2022/08/01 -- BatchProcessNew.lua by Egaltech s.r.l. 2022/01/07
-- Gestione calcolo batch disposizione e lavorazioni per Travi -- Gestione calcolo batch disposizione e lavorazioni per Travi
-- 2021/01/07 Per nuova interfaccia Egt. -- 2021/01/07 Per nuova interfaccia Egt.
-- 2021/01/15 CREATE_BAR ora FLAG = 6 (prima 5). -- 2021/01/15 CREATE_BAR ora FLAG = 6 (prima 5).
@@ -8,10 +8,6 @@
-- 2021/06/16 Se disponibile si aggiunge la versione dell'eseguibile alle info del programma CN. -- 2021/06/16 Se disponibile si aggiunge la versione dell'eseguibile alle info del programma CN.
-- 2021/08/04 Direzione vista simulazione da BD.SIMUL_VIEW_DIR se esiste. -- 2021/08/04 Direzione vista simulazione da BD.SIMUL_VIEW_DIR se esiste.
-- 2022/01/07 Per CUTID/TASKID senza ToProcess si verificano anche eventuali Duplo. -- 2022/01/07 Per CUTID/TASKID senza ToProcess si verificano anche eventuali Duplo.
-- 2022/02/09 Aggiornato come Wall per gestione errori e verifica attrezzaggio utensili.
-- 2022/04/28 In info generazione aggiunta indicazione se 64bit.
-- 2022/07/24 Modifica per cancellare lavorazioni con ricalcolo e barra già definita.
-- 2022/08/01 Tolleranza su sezione portata a 0.1 mm (100 * GEO.EPS_SMALL).
-- Intestazioni -- Intestazioni
require( 'EgtBase') require( 'EgtBase')
@@ -31,7 +27,7 @@ if BEAM.FLAG == 0 then
elseif BEAM.FLAG == 1 then elseif BEAM.FLAG == 1 then
sFlag = 'MODIFY' sFlag = 'MODIFY'
elseif BEAM.FLAG == 2 then elseif BEAM.FLAG == 2 then
sFlag = 'SIMULATE' sFlag = 'SIMULATE'
elseif BEAM.FLAG == 3 then elseif BEAM.FLAG == 3 then
sFlag = 'CHECK' sFlag = 'CHECK'
elseif BEAM.FLAG == 4 then elseif BEAM.FLAG == 4 then
@@ -114,7 +110,8 @@ local function ResetMachGroup( vBeam)
end end
-- Imposto direttorio libreria specializzata per Travi -- Imposto direttorio libreria specializzata per Travi
EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua') local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
-- Se necessario, impostazione della macchina corrente -- Se necessario, impostazione della macchina corrente
local sMachine = BEAM.MACHINE local sMachine = BEAM.MACHINE
@@ -196,7 +193,7 @@ if bToProcess then
return return
end end
-- Faccio copia del file originale -- Faccio copia del file originale
EgtCopyFile( BEAM.FILE, sOriFile) EgtCopyFile( BEAM.FILE, sDir..sTitle..'.ori'..sExt)
-- Aggiorno eventuali dati ausiliari -- Aggiorno eventuali dati ausiliari
--UpdateAuxData( sBtmFile) --UpdateAuxData( sBtmFile)
@@ -289,10 +286,11 @@ if bToProcess then
table.insert( vBeam, { Id = nPartId, PosX = dPosX, Name = ( EgtGetName( nPartId) or ( 'Id=' .. tonumber( nPartId)))}) table.insert( vBeam, { Id = nPartId, PosX = dPosX, Name = ( EgtGetName( nPartId) or ( 'Id=' .. tonumber( nPartId)))})
end end
if #vBeam == 0 then if #vBeam == 0 then
BEAM.ERR = 14 --BEAM.ERR = 14
BEAM.MSG = 'Error : no beams in the project' --BEAM.MSG = 'Error : no beams in the project'
WriteErrToLogFile( BEAM.ERR, BEAM.MSG) --WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
return --return
EgtOutLog( 'Travi non trovate', 1)
else else
local sOut = '' local sOut = ''
for i = 1, #vBeam do for i = 1, #vBeam do
@@ -335,8 +333,8 @@ if bToProcess then
for i = 2, #vBeam do for i = 2, #vBeam do
local dDimW = vBeam[i].Box:getDimY() local dDimW = vBeam[i].Box:getDimY()
local dDimH = vBeam[i].Box:getDimZ() local dDimH = vBeam[i].Box:getDimZ()
if ( abs( dDimW - dRawW) > 100 * GEO.EPS_SMALL or abs( dDimH - dRawH) > 100 * GEO.EPS_SMALL) and if ( abs( dDimW - dRawW) > 10 * GEO.EPS_SMALL or abs( dDimH - dRawH) > 10 * GEO.EPS_SMALL) and
( abs( dDimH - dRawW) > 100 * GEO.EPS_SMALL or abs( dDimW - dRawH) > 100 * GEO.EPS_SMALL) then ( abs( dDimH - dRawW) > 10 * GEO.EPS_SMALL or abs( dDimW - dRawH) > 10 * GEO.EPS_SMALL) then
table.insert( vBeamErr, i) table.insert( vBeamErr, i)
end end
end end
@@ -425,20 +423,17 @@ if bToProcess then
-- box del pezzo -- box 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)
-- se nel grezzo c'è un pezzo -- creo o pulisco gruppo geometrie aggiuntive
if nPartId then if nPartId then
-- creo o pulisco gruppo geometrie aggiuntive
BL.CreateOrEmptyAddGroup( nPartId) BL.CreateOrEmptyAddGroup( nPartId)
-- aggiungo faccia per taglio iniziale al pezzo
BL.AddPartStartFace( nPartId, b3Solid)
-- aggiungo faccia per taglio finale al pezzo
BL.AddPartEndFace( nPartId, b3Solid)
end end
-- aggiungo faccia per taglio iniziale al pezzo
BL.AddPartStartFace( nPartId, b3Solid)
-- aggiungo faccia per taglio finale al pezzo
BL.AddPartEndFace( nPartId, b3Solid)
-- passo al successivo grezzo -- passo al successivo grezzo
nRawId = EgtGetNextRawPart( nRawId) nRawId = EgtGetNextRawPart( nRawId)
end end
-- elimino le lavorazioni
EgtRemoveAllOperations()
end end
-- Se richiesta solo barra, esco -- Se richiesta solo barra, esco
@@ -460,16 +455,13 @@ if bToProcess then
-- Abilito Vmill -- Abilito Vmill
EgtSetInfo( EgtGetCurrMachGroup(), 'Vm', '1') EgtSetInfo( EgtGetCurrMachGroup(), 'Vm', '1')
-- Aggiorno Setup utensili
EgtImportSetup()
-- Lavoro le features -- Lavoro le features
local bPfOk, Stats = BE.ProcessFeatures() local bPfOk, Stats = BE.ProcessFeatures()
local sOutput = '' local sOutput = ''
for i = 1, #Stats do for i = 1, #Stats do
local sMsg = Stats[i].Msg local sMsg = Stats[i].Msg
sMsg = string.gsub( sMsg or '', '\n', ' ', 10) sMsg = string.gsub( sMsg, '\n', ' ', 10)
sMsg = string.gsub( sMsg or '', '\r', ' ', 10) sMsg = string.gsub( sMsg, '\r', ' ', 10)
if Stats[i].Err == 0 then if Stats[i].Err == 0 then
BEAM.ERR = 0 BEAM.ERR = 0
BEAM.MSG = '---' BEAM.MSG = '---'
@@ -527,33 +519,33 @@ else
-- Carico il progetto già fatto -- Carico il progetto già fatto
EgtOpenFile( sNgeFile) EgtOpenFile( sNgeFile)
-- Dichiaro nessun errore -- Dichiaro nessun errore
--local nPartId = EgtGetFirstPart() local nPartId = EgtGetFirstPart()
--while nPartId do while nPartId do
-- local vDup = EgtDuploList( nPartId) local vDup = EgtDuploList( nPartId)
-- if not vDup or #vDup == 0 then if not vDup or #vDup == 0 then
-- vDup = { nPartId} vDup = { nPartId}
-- end end
-- for i = 1, #vDup do for i = 1, #vDup do
-- local nCutId = EgtGetInfo( vDup[i], 'CUTID', 'i') local nCutId = EgtGetInfo( vDup[i], 'CUTID', 'i')
-- if nCutId then if nCutId then
-- local nProcId = EgtGetFirstInGroup( EgtGetFirstNameInGroup( vDup[i], 'Processings') or GDB_ID.NULL) local nProcId = EgtGetFirstInGroup( EgtGetFirstNameInGroup( vDup[i], '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', 'i') local nTaskId = EgtGetInfo( nProcId, 'TASKID', 'i')
-- if bIsFea and nTaskId then if bIsFea and nTaskId then
-- BEAM.ERR = 0 BEAM.ERR = 0
-- BEAM.MSG = '---' BEAM.MSG = '---'
-- BEAM.ROT = 0 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
-- end end
-- end end
-- nPartId = EgtGetNextPart( nPartId) nPartId = EgtGetNextPart( nPartId)
--end end
-- Aggiorno eventuali dati ausiliari -- Aggiorno eventuali dati ausiliari
--UpdateAuxData( sBtmFile) --UpdateAuxData( sBtmFile)
-- Passo in modalità lavora -- Passo in modalità lavora
@@ -573,20 +565,6 @@ end
-- *** Eseguo simulazione con verifica collisione in cieco *** -- *** Eseguo simulazione con verifica collisione in cieco ***
if ( BEAM.FLAG == 0 and ( bToProcess or bToRecalc)) or BEAM.FLAG == 3 or BEAM.FLAG == 4 then if ( BEAM.FLAG == 0 and ( bToProcess or bToRecalc)) or BEAM.FLAG == 3 or BEAM.FLAG == 4 then
EgtOutLog( ' +++ Simulating with collision check >>>') EgtOutLog( ' +++ Simulating with collision check >>>')
-- verifico setup
local bSetUpOk, SetUpErrors = EgtVerifyCurrSetup()
if not bSetUpOk then
local sToolsList = ""
for ToolIndex = 1, #SetUpErrors do
sToolsList = sToolsList .. SetUpErrors[ToolIndex]
if ToolIndex ~= #SetUpErrors then
sToolsList = sToolsList .. ", "
end
end
WriteErrToLogFile( 19, 'Error in setup: tool/s ' .. sToolsList .. ' not found', 0, 0, 0)
return
end
-- lancio simulazione
local bSimOk, nErr, sErr = EgtSimulate() local bSimOk, nErr, sErr = EgtSimulate()
if not bSimOk then if not bSimOk then
if nErr == MCH_SHE.INIT then if nErr == MCH_SHE.INIT then
@@ -625,11 +603,10 @@ end
-- *** Genero programma CN *** ( se richiesto) -- *** Genero programma CN *** ( se richiesto)
if BEAM.FLAG == 0 or BEAM.FLAG == 4 then if BEAM.FLAG == 0 or BEAM.FLAG == 4 then
EgtOutLog( ' +++ Generating NC part program >>>') EgtOutLog( ' +++ Generating NC part program >>>')
local sInfo = 'EgtCAM5' .. EgtIf( EgtIs64bit(), ' 64bit', '') local sInfo = 'EgtCAM5 - '
if EgtGetExeVersion then if EgtGetExeVersion then
sInfo = sInfo .. ' ver.' .. EgtGetExeVersion() sInfo = 'EgtCAM5 ver.' .. EgtGetExeVersion() .. ' - '
end end
sInfo = sInfo .. ' - '
if not EgtGenerate( '', sInfo .. sNgeFile) then if not EgtGenerate( '', sInfo .. sNgeFile) then
BEAM.ERR = 20 BEAM.ERR = 20
local _, sName, _ = EgtSplitPath( BEAM.FILE) local _, sName, _ = EgtSplitPath( BEAM.FILE)
@@ -654,7 +631,7 @@ local Ttot = EgtGetInfo( EgtGetCurrMachGroup(), 'Ttot', 'd')
local sTime = 'Total Time = ' .. EgtNumToString( Ttot, 1) local sTime = 'Total Time = ' .. EgtNumToString( Ttot, 1)
EgtOutLog( sTime) EgtOutLog( sTime)
-- Se modifica o simula, imposto la vista ISO 3d opportuna -- Imposto la vista ISO 3d, se richiesto
if BEAM.FLAG == 1 or BEAM.FLAG == 2 then if BEAM.FLAG == 1 or BEAM.FLAG == 2 then
local vView = { SCE_VD.ISO_NW, SCE_VD.ISO_SW, SCE_VD.ISO_NE, SCE_VD.ISO_SE} local vView = { SCE_VD.ISO_NW, SCE_VD.ISO_SW, SCE_VD.ISO_NE, SCE_VD.ISO_SE}
local nV = min( max( BD.SIMUL_VIEW_DIR or 2, 1), 4) local nV = min( max( BD.SIMUL_VIEW_DIR or 2, 1), 4)
-103
View File
@@ -1,103 +0,0 @@
REM Compilazione degli script Beam Egaltech 2022.05.09
REM Per togliere info di debug aggiungere flag -s prima del nome del file di input
REM Compilazione 32 bit
\EgtProg\Dll32\luac53 -o 32\LuaLibs\BeamExec.lua LuaLibs\BeamExec.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\BeamLib.lua LuaLibs\BeamLib.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\DiceCut.lua LuaLibs\DiceCut.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\FaceByPocket.lua LuaLibs\FaceByPocket.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\FacesBySaw.lua LuaLibs\FacesBySaw.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\MachiningLib.lua LuaLibs\MachiningLib.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessBlockHausFront.lua LuaLibs\ProcessBlockHausFront.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessChamfer.lua LuaLibs\ProcessChamfer.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessCut.lua LuaLibs\ProcessCut.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDecor.lua LuaLibs\ProcessDecor.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDoubleCut.lua LuaLibs\ProcessDoubleCut.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDovetail.lua LuaLibs\ProcessDovetail.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDrill.lua LuaLibs\ProcessDrill.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDtMortise.lua LuaLibs\ProcessDtMortise.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDtTenon.lua LuaLibs\ProcessDtTenon.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessFreeContour.lua LuaLibs\ProcessFreeContour.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessFrenchRidgeLap.lua LuaLibs\ProcessFrenchRidgeLap.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessHeadCut.lua LuaLibs\ProcessHeadCut.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLapJoint.lua LuaLibs\ProcessLapJoint.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLapJointNew.lua LuaLibs\ProcessLapJointNew.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLongCut.lua LuaLibs\ProcessLongCut.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLongDoubleCut.lua LuaLibs\ProcessLongDoubleCut.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessMark.lua LuaLibs\ProcessMark.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessMortise.lua LuaLibs\ProcessMortise.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfCamb.lua LuaLibs\ProcessProfCamb.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfConcave.lua LuaLibs\ProcessProfConcave.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfConvex.lua LuaLibs\ProcessProfConvex.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfFront.lua LuaLibs\ProcessProfFront.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfHead.lua LuaLibs\ProcessProfHead.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessRidgeLap.lua LuaLibs\ProcessRidgeLap.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessRoundArch.lua LuaLibs\ProcessRoundArch.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessSawCut.lua LuaLibs\ProcessSawCut.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessScarfJoint.lua LuaLibs\ProcessScarfJoint.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessSimpleScarf.lua LuaLibs\ProcessSimpleScarf.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessSplit.lua LuaLibs\ProcessSplit.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessStepJoint.lua LuaLibs\ProcessStepJoint.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessStepJointNotch.lua LuaLibs\ProcessStepJointNotch.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessTenon.lua LuaLibs\ProcessTenon.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessText.lua LuaLibs\ProcessText.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessTyroleanDovetail.lua LuaLibs\ProcessTyroleanDovetail.lua
\EgtProg\Dll32\luac53 -o 32\BatchProcess.lua BatchProcess.lua
\EgtProg\Dll32\luac53 -o 32\BatchProcessNew.lua BatchProcessNew.lua
\EgtProg\Dll32\luac53 -o 32\GetBeamData.lua GetBeamData.lua
\EgtProg\Dll32\luac53 -o 32\NestProcess.lua NestProcess.lua
\EgtProg\Dll32\luac53 -o 32\Process.lua Process.lua
\EgtProg\Dll32\luac53 -o 32\Rotate.lua Rotate.lua
\EgtProg\Dll32\luac53 -o 32\Swap.lua Swap.lua
REM Compilazione 64 bit
\EgtProg\Dll64\luac53 -o 64\LuaLibs\BeamExec.lua LuaLibs\BeamExec.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\BeamLib.lua LuaLibs\BeamLib.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\DiceCut.lua LuaLibs\DiceCut.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\FaceByPocket.lua LuaLibs\FaceByPocket.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\FacesBySaw.lua LuaLibs\FacesBySaw.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\MachiningLib.lua LuaLibs\MachiningLib.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessBlockHausFront.lua LuaLibs\ProcessBlockHausFront.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessChamfer.lua LuaLibs\ProcessChamfer.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessCut.lua LuaLibs\ProcessCut.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDecor.lua LuaLibs\ProcessDecor.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDoubleCut.lua LuaLibs\ProcessDoubleCut.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDovetail.lua LuaLibs\ProcessDovetail.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDrill.lua LuaLibs\ProcessDrill.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDtMortise.lua LuaLibs\ProcessDtMortise.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDtTenon.lua LuaLibs\ProcessDtTenon.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessFreeContour.lua LuaLibs\ProcessFreeContour.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessFrenchRidgeLap.lua LuaLibs\ProcessFrenchRidgeLap.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessHeadCut.lua LuaLibs\ProcessHeadCut.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessLapJoint.lua LuaLibs\ProcessLapJoint.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessLapJointNew.lua LuaLibs\ProcessLapJointNew.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessLongCut.lua LuaLibs\ProcessLongCut.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessLongDoubleCut.lua LuaLibs\ProcessLongDoubleCut.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessMark.lua LuaLibs\ProcessMark.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessMortise.lua LuaLibs\ProcessMortise.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfCamb.lua LuaLibs\ProcessProfCamb.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfConcave.lua LuaLibs\ProcessProfConcave.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfConvex.lua LuaLibs\ProcessProfConvex.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfFront.lua LuaLibs\ProcessProfFront.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfHead.lua LuaLibs\ProcessProfHead.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessRidgeLap.lua LuaLibs\ProcessRidgeLap.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessRoundArch.lua LuaLibs\ProcessRoundArch.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessSawCut.lua LuaLibs\ProcessSawCut.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessScarfJoint.lua LuaLibs\ProcessScarfJoint.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessSimpleScarf.lua LuaLibs\ProcessSimpleScarf.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessSplit.lua LuaLibs\ProcessSplit.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessStepJoint.lua LuaLibs\ProcessStepJoint.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessStepJointNotch.lua LuaLibs\ProcessStepJointNotch.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessTenon.lua LuaLibs\ProcessTenon.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessText.lua LuaLibs\ProcessText.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessTyroleanDovetail.lua LuaLibs\ProcessTyroleanDovetail.lua
\EgtProg\Dll64\luac53 -o 64\BatchProcess.lua BatchProcess.lua
\EgtProg\Dll64\luac53 -o 64\BatchProcessNew.lua BatchProcessNew.lua
\EgtProg\Dll64\luac53 -o 64\GetBeamData.lua GetBeamData.lua
\EgtProg\Dll64\luac53 -o 64\NestProcess.lua NestProcess.lua
\EgtProg\Dll64\luac53 -o 64\Process.lua Process.lua
\EgtProg\Dll64\luac53 -o 64\Rotate.lua Rotate.lua
\EgtProg\Dll64\luac53 -o 64\Swap.lua Swap.lua
-44
View File
@@ -1,44 +0,0 @@
-- GetWallData.lua by Egaltech s.r.l. 2022/06/28
-- Recupero dati da file WallData.lua di macchina
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
-- Per test
--GWD = {}
--GWD.MACHINE = 'Essetre-90480019_MW'
local sLog = 'GetBeamData : ' .. GWD.MACHINE
EgtOutLog( sLog)
-- Imposto direttorio libreria specializzata per Travi
EgtAddToPackagePath( GWD.BASEDIR .. '\\LuaLibs\\?.lua')
-- Verifico che la macchina corrente sia abilitata per la lavorazione delle Travi
local sMachDir = EgtGetCurrMachineDir()
if not EgtExistsFile( sMachDir .. '\\Beam\\BeamData.lua') then
GWD.ERR = 12
GWD.MSG = 'Error not configured for beam machine : ' .. GWD.MACHINE
WriteErrToLogFile( GWD.ERR, GWD.MSG)
PostErrView( GWD.ERR, GWD.MSG)
return
end
-- Elimino direttori altre macchine e imposto direttorio macchina corrente per ricerca librerie
EgtRemoveBaseMachineDirFromPackagePath()
EgtAddToPackagePath( sMachDir .. '\\Beam\\?.lua')
-- Carico i dati globali
_G.package.loaded.BeamData = nil
local BD = require( 'BeamData')
-- Assegno valori di interesse
GWD.SIMUL_VIEW_DIR = BD.SIMUL_VIEW_DIR
GWD.OVM_MID = BD.OVM_MID
-- Tutto ok
GWD.ERR = 0
EgtOutLog( ' +++ GetWallData completed')
+193 -485
View File
@@ -1,4 +1,4 @@
-- BeamExec.lua by Egaltech s.r.l. 2022/08/18 -- BeamExec.lua by Egaltech s.r.l. 2021/12/20
-- Libreria esecuzione lavorazioni per Travi -- Libreria esecuzione lavorazioni per Travi
-- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3. -- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3.
-- 2019/09/04 Corretto controllo feature di testa e coda con sovramateriale di testa elevato. -- 2019/09/04 Corretto controllo feature di testa e coda con sovramateriale di testa elevato.
@@ -25,16 +25,6 @@
-- 2021/11/27 House mortise sempre prima di (dt)mortise, house tenon sempre dopo (dt)tenon. -- 2021/11/27 House mortise sempre prima di (dt)mortise, house tenon sempre dopo (dt)tenon.
-- 2021/12/15 Corretta CompareFeature (risultato deve essere simmetrico scambiando le feature). -- 2021/12/15 Corretta CompareFeature (risultato deve essere simmetrico scambiando le feature).
-- 2021/12/20 Ulteriore correzione a CompareFeature (caso con entrambe senza geometria). -- 2021/12/20 Ulteriore correzione a CompareFeature (caso con entrambe senza geometria).
-- 2022/05/04 Nell'ordinamento quando si confrontano i box delle feature aggiunta verifica preliminare della loro validità.
-- 2022/05/31 Aggiunta gestione sovramateriale per sezioni alte e larghe e informazione di eventuale creazione nuova fase dalla AddFeatureMachining.
-- 2022/06/10 Per sezioni alte e larghe modificata la gestione del sovramateriale per considerare la presenza di feature preesistenti ed
-- eventuale parametro Q05, che determinano la presenza o meno della finitura.
-- Create le funzioni AnalyzeHeadFeatures e AnalyzeTailFeatures. Spostate più in alto le funzioni CollectFeatures, isHeadFeature e isTailFeature.
-- 2022/07/01 Aggiunta la gestione delle forature migliorate in presenza di feature testa/coda ad 1 faccia che tagliano tutta la sezione,
-- controllata tramite il parametro IMPROVE_HEAD_TAIL_DRILLINGS da BeamData. Attivata di default.
-- 2022/08/01 Tolleranza su sezione portata a 0.1 mm (100 * GEO.EPS_SMALL).
-- 2022/08/08 Modifica per macchine senza BD.MAX_WIDTH2 e BD.MAX_HEIGHT2.
-- 2022/08/18 Aggiunta gestione macchine con testa da sotto con lama da sotto disabilitata.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local BeamExec = {} local BeamExec = {}
@@ -89,7 +79,7 @@ _G.package.loaded.ProcessTyroleanDovetail = nil
_G.package.loaded.ProcessDovetail = nil _G.package.loaded.ProcessDovetail = nil
_G.package.loaded.ProcessFreeContour = nil _G.package.loaded.ProcessFreeContour = nil
_G.package.loaded.ProcessDecor = nil _G.package.loaded.ProcessDecor = nil
local ML = require( 'MachiningLib') local BM = require( 'MachiningLib')
local BL = require( 'BeamLib') local BL = require( 'BeamLib')
local DC = require( 'DiceCut') local DC = require( 'DiceCut')
local Fbs = require( 'FacesBySaw') local Fbs = require( 'FacesBySaw')
@@ -131,300 +121,11 @@ EgtOutLog( ' BeamExec started', 1)
EgtMdbSetGeneralParam( MCH_GP.MAXDEPTHSAFE, BD.COLL_SIC) EgtMdbSetGeneralParam( MCH_GP.MAXDEPTHSAFE, BD.COLL_SIC)
EgtMdbSave() EgtMdbSave()
-------------------------------------------------------------------------------------------------------------
local function IsHeadFeature( Proc, b3Raw, dCurrOvmH)
-- feature sempre di testa o coda per il gruppo
if Proc.Grp == 1 or Proc.Grp == 2 then
return ( Proc.Box:getCenter():getX() > b3Raw:getCenter():getX() - 0.5 * dCurrOvmH)
end
-- feature sempre di testa o coda nonostante il gruppo
if ( Proc.Grp == 3 or Proc.Grp == 4) and
( Proc.Prc == 38 or Proc.Prc == 51 or Proc.Prc == 56 or Proc.Prc == 100 or Proc.Prc == 101 or Proc.Prc == 102 or Proc.Prc == 103 or Proc.Prc == 106) then
return ( Proc.Box:getCenter():getX() > b3Raw:getCenter():getX() - 0.5 * dCurrOvmH)
end
-- gestioni speciali
if LapJoint.Identify( Proc) then
return LapJoint.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end
if Drill.Identify( Proc) then
return Drill.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end
if RoundArch.Identify( Proc) then
return RoundArch.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end
if Dovetail.Identify( Proc) then
return Dovetail.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end
if FreeContour.Identify( Proc) then
return FreeContour.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end
-- non è di testa
return false
end
-------------------------------------------------------------------------------------------------------------
local function IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT)
-- lunghezza di riferimento per spostare le feature di coda appena prima
local dAdvTailLen = BD.LEN_VERY_SHORT_PART or BD.LEN_SHORT_PART
-- feature sempre di testa o coda per il gruppo (se non troppo lunga)
if Proc.Grp == 1 or Proc.Grp == 2 then
-- se abilitato avanzamento lavorazione feature di coda e pezzo corto (quindi a caduta) e feature in coda
if BD.ADVANCE_TAIL_CUT and b3Raw:getDimX() < dAdvTailLen and Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH then
-- se taglio, lo avanzo
if Proc.Prc == 10 then
return false, true
end
end
-- standard
return ( Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH and Proc.Box:getDimX() < BD.MAX_LEN_HTFEA)
end
-- feature sempre di testa o coda nonostante il gruppo
if ( Proc.Grp == 3 or Proc.Grp == 4) and
( Proc.Prc == 38 or Proc.Prc == 51 or Proc.Prc == 56 or Proc.Prc == 100 or Proc.Prc == 101 or Proc.Prc == 102 or Proc.Prc == 103 or Proc.Prc == 106) then
-- se abilitato avanzamento lavorazione feature di coda e pezzo corto (quindi a caduta) e feature in coda
if BD.ADVANCE_TAIL_CUT and b3Raw:getDimX() < dAdvTailLen and Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH then
-- se profilo front solo con smusso, lo avanzo
if Proc.Prc == 100 and ProfFront.OnlyChamfer( Proc) then
return false, true
end
-- se profilo concavo solo con smusso, lo avanzo
if Proc.Prc == 101 and ProfConcave.OnlyChamfer( Proc) then
return false, true
end
-- se profilo convesso solo con smusso, lo avanzo
if Proc.Prc == 102 and ProfConvex.OnlyChamfer( Proc) then
return false, true
end
-- se profilo caudato solo con smusso, lo avanzo
if Proc.Prc == 103 and ProfCamb.OnlyChamfer( Proc) then
return false, true
end
-- se profilo head solo con smusso, lo avanzo
if Proc.Prc == 106 and ProfHead.OnlyChamfer( Proc) then
return false, true
end
end
-- standard
return ( Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH)
end
-- gestioni speciali
if LapJoint.Identify( Proc) then
return LapJoint.IsTailFeature( Proc, b3Raw)
end
if Drill.Identify( Proc) then
return Drill.IsTailFeature( Proc, b3Raw, dCurrOvmT)
end
if DtMortise.Identify( Proc) then
return DtMortise.IsTailFeature( Proc, b3Raw)
end
if RoundArch.Identify( Proc) then
return RoundArch.IsTailFeature( Proc, b3Raw)
end
if Dovetail.Identify( Proc) then
return Dovetail.IsTailFeature( Proc, b3Raw)
end
if FreeContour.Identify( Proc) then
return FreeContour.IsTailFeature( Proc, b3Raw)
end
-- non è di coda
return false
end
-------------------------------------------------------------------------------------------------------------
-- restituisce vero se la feature con box b3Proc taglia l'intera sezione della barra, rappresentata dalle sue dimensioni W e H
local function IsFeatureCuttingEntireSection( b3Proc, dRawW, dRawH)
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
-------------------------------------------------------------------------------------------------------------
local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
local dRawW = b3Raw:getDimY()
local dRawH = b3Raw:getDimZ()
-- recupero le feature
local vProc = {}
local LayerId = {}
LayerId[1] = BL.GetAddGroup( PartId)
LayerId[2] = EgtGetFirstNameInGroup( PartId or GDB_ID.NULL, 'Processings')
local nMachineBeforeIntersectingDrillingsIdHead, dMachineBeforeIntersectingDrillingsXHead, nMachineBeforeIntersectingDrillingsIdTail, dMachineBeforeIntersectingDrillingsXTail = nil, GEO.INFINITO, nil, -GEO.INFINITO
local b3MachineBeforeIntersectingDrillingsBoxHead, b3MachineBeforeIntersectingDrillingsBoxTail = nil, nil
for nInd = 1, 2 do
local ProcId = EgtGetFirstInGroup( LayerId[nInd] or GDB_ID.NULL)
while ProcId do
local nEntType = EgtGetType( ProcId)
if nEntType == GDB_TY.SRF_MESH or nEntType == GDB_TY.EXT_TEXT or
nEntType == GDB_TY.CRV_LINE or nEntType == GDB_TY.CRV_ARC or nEntType == GDB_TY.CRV_BEZ or nEntType == GDB_TY.CRV_COMPO then
local nGrp = EgtGetInfo( ProcId, 'GRP', 'i')
local nPrc = EgtGetInfo( ProcId, 'PRC', 'i')
local nDo = EgtGetInfo( ProcId, 'DO', 'i') or 1
local nCutId = EgtGetInfo( EgtGetParent( EgtGetParent( ProcId)), 'CUTID', 'i') or 0
local nTaskId = EgtGetInfo( ProcId, 'TASKID', 'i') or 0
if nGrp and nPrc and nDo == 1 then
local Proc = {}
Proc.Id = ProcId
Proc.Grp = nGrp
Proc.Prc = nPrc
Proc.Flg = 1
Proc.Fct = EgtSurfTmFacetCount( ProcId) or 0
Proc.Diam = 0
Proc.Fcs = 0
Proc.Fce = 0
Proc.CutId = nCutId
Proc.TaskId = nTaskId
Proc.Box = EgtGetBBoxGlob( ProcId, GDB_BB.STANDARD)
if Proc.Box and not Proc.Box:isEmpty() then
Proc.Head = IsHeadFeature( Proc, b3Raw, dCurrOvmH)
Proc.Tail, Proc.AdvTail = IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT)
if Proc.Fct == 1 and IsFeatureCuttingEntireSection( Proc.Box , dRawW, dRawH) and ( Proc.Head or Proc.Tail) and Proc.Prc ~= 340 and Proc.Prc ~= 350 then
if Proc.Head and Proc.Box:getCenter():getX() < dMachineBeforeIntersectingDrillingsXHead then
dMachineBeforeIntersectingDrillingsXHead = Proc.Box:getCenter():getX()
nMachineBeforeIntersectingDrillingsIdHead = Proc.Id
b3MachineBeforeIntersectingDrillingsBoxHead = Proc.Box
elseif Proc.Tail and Proc.Box:getCenter():getX() > dMachineBeforeIntersectingDrillingsXTail then
dMachineBeforeIntersectingDrillingsXTail = Proc.Box:getCenter():getX()
nMachineBeforeIntersectingDrillingsIdTail = Proc.Id
b3MachineBeforeIntersectingDrillingsBoxTail = Proc.Box
end
end
table.insert( vProc, Proc)
-- se foro
if Drill.Identify( Proc) then
-- assegno diametro e facce di ingresso e uscita (dati tabelle sempre per riferimento)
Proc.Diam, Proc.Fcs, Proc.Fce = Drill.GetData( Proc, b3Raw)
-- verifico se necessaria seconda lavorazione da parte opposta per foro più lungo della punta
if Drill.Split( Proc, b3Raw) then
-- aggiorno flags prima parte foro (dati tabelle sempre per riferimento)
Proc.Flg = 2
Proc.Head = Drill.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
Proc.Tail = Drill.IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT)
-- definisco dati seconda parte
local Proc2 = {}
Proc2.Id = ProcId
Proc2.Grp = nGrp
Proc2.Prc = nPrc
Proc2.Flg = -2
Proc2.Box = BBox3d( Proc.Box)
Proc2.Fct = Proc.Fct
Proc2.Diam = Proc.Diam
Proc2.Head = Drill.IsHeadFeature( Proc2, b3Raw, dCurrOvmH)
Proc2.Tail = Drill.IsTailFeature( Proc2, b3Raw, dCurrOvmH)
Proc2.Fcs = Proc.Fce
Proc2.Fce = Proc.Fcs
Proc2.CutId = Proc.CutId
Proc2.TaskId = Proc.TaskId
table.insert( vProc, Proc2)
end
-- se BlockHaus HalfLap
elseif Proc.Prc == 37 then
local nFacInd = BL.GetFaceWithMostAdj( Proc.Id, PartId)
if nFacInd then
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
if vtN then
Proc.vtN = Vector3d( vtN)
end
end
end
else
Proc.Head = false
Proc.Tail = false
Proc.Flg = 0
table.insert( vProc, Proc)
EgtOutLog( ' Feature ' .. tostring( Proc.Id) .. ' is empty (no geometry)')
end
end
end
ProcId = EgtGetNext( ProcId)
end
end
local vMachineBeforeIntersectingDrillings = {
Head = { Id = nMachineBeforeIntersectingDrillingsIdHead, Box = b3MachineBeforeIntersectingDrillingsBoxHead},
Tail = { Id = nMachineBeforeIntersectingDrillingsIdTail, Box = b3MachineBeforeIntersectingDrillingsBoxTail}
}
return vProc, vMachineBeforeIntersectingDrillings
end
-------------------------------------------------------------------------------------------------------------
local function AnalyzeHeadFeatures( b3Solid, vProc, dRawW, dRawH)
local nReplacedFeatureId = nil
local bHeadFinishingNeeded = true
for i = 1, #vProc do
local Proc = vProc[i]
-- controllo se esiste già una feature taglio di testa
if not nReplacedFeatureId then
if ( Proc.Grp == 1 or Proc.Grp == 2) and Proc.Prc == 10 then
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
if ptC and vtN and AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL then
nReplacedFeatureId = Proc.Id
end
end
end
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
bHeadFinishingNeeded = not IsFeatureCuttingEntireSection( Proc.Box, dRawW, dRawH)
end
end
return bHeadFinishingNeeded, nReplacedFeatureId
end
-------------------------------------------------------------------------------------------------------------
local function AnalyzeTailFeatures( b3Solid, vProc, dRawW, dRawH)
local nReplacedFeatureId = nil
local bTailFinishingNeeded = true
for i = 1, #vProc do
local Proc = vProc[i]
-- controllo se esistè già una feature taglio di coda
if not nReplacedFeatureId then
if ( Proc.Grp == 1 or Proc.Grp == 2) and Proc.Prc == 10 then
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
if ptC and vtN and AreSameVectorApprox( vtN, -X_AX()) and abs( ptC:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL then
nReplacedFeatureId = Proc.Id
end
end
end
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
bTailFinishingNeeded = not IsFeatureCuttingEntireSection( Proc.Box, dRawW, dRawH)
end
end
return bTailFinishingNeeded, nReplacedFeatureId
end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
-- *** Inserimento delle travi nel grezzo *** -- *** Inserimento delle travi nel grezzo ***
-------------------------------------------------------------------------------------------------------------
local function VerifyBigSectionCut( dRawW, dRawH)
-- lama principale
local sCutting = ML.FindCutting( 'TailSide')
local dMaxDepth = 50
if EgtMdbSetCurrMachining( sCutting or '') then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid or '') or '') then
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
-- eventuale lama su testa sotto
local sCutting2 = ML.FindCutting( 'TailSide_H2', false, true)
local dMaxDepth2 = 0
if sCutting2 and EgtMdbSetCurrMachining( sCutting2) then
local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
end
end
-- verifiche
local dDimYRef = EgtIf( dRawH < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM))
local bBigSectionCut = ( dRawW > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and
( dRawH > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dMaxDepth2) - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
return bBigSectionCut
end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroupOk) function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroupOk)
-- default per nuove costanti qualora non definite
BD.OVM_BLADE_HBEAM = ( BD.OVM_BLADE_HBEAM or 11)
BD.OVM_CHAIN_HBEAM = ( BD.OVM_CHAIN_HBEAM or 8)
-- Determinazione minimo grezzo scaricabile -- Determinazione minimo grezzo scaricabile
BeamExec.CalcMinUnloadableRaw( dRawW, dRawH) BeamExec.CalcMinUnloadableRaw( dRawW, dRawH)
@@ -455,10 +156,7 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroup
local Len = dRawL local Len = dRawL
local nPrevRaw, dPrevDelta local nPrevRaw, dPrevDelta
local DeltaS = dOvmHead local DeltaS = dOvmHead
local DeltaSMin = 0
local DeltaE = BD.OVM_MID local DeltaE = BD.OVM_MID
-- controllo sezione larga e alta per considerare taglio con sega a catena
local bBigSectionCut = VerifyBigSectionCut( dRawW, dRawH)
for i = 1, #vBeam do for i = 1, #vBeam do
-- assegno identificativo pezzo -- assegno identificativo pezzo
local Pz = vBeam[i].Id local Pz = vBeam[i].Id
@@ -466,49 +164,18 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroup
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
if bBigSectionCut then
-- lascio in coda solo il materiale necessario; il resto verrà tolto nell'head cut successivo
local lastB3Solid = nil
local dOffset = dOvmHead
if i > 1 then
lastB3Solid = vBeam[i-1].Box
dOffset = vBeam[i].PosX - vBeam[i-1].PosX - lastB3Solid:getDimX()
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
if nReplacedHeadCutFeatureId then
iSQ05Value = EgtGetInfo( nReplacedHeadCutFeatureId, 'Q05', 'i')
end
if ( dOffset <= BD.OVM_CHAIN_HBEAM and iSQ05Value == 0) or not bSFinishingNeeded then
DeltaSMin = 0
else
DeltaSMin = BD.OVM_BLADE_HBEAM
end
local bEFinishingNeeded, nReplacedTailCutFeatureId = AnalyzeTailFeatures( b3Solid, vProc, dRawW, dRawH)
local iEQ05Value = nil
if nReplacedTailCutFeatureId then
iEQ05Value = EgtGetInfo( nReplacedTailCutFeatureId, 'Q05', 'i')
end
if iEQ05Value == 0 or not bEFinishingNeeded then
DeltaE = BD.OVM_CHAIN_HBEAM
else
DeltaE = BD.OVM_CHAIN_HBEAM + BD.OVM_BLADE_HBEAM
end
end
EgtOutLog( 'PartSez=' .. EgtNumToString( b3Part:getDimY(), 1) .. 'x' .. EgtNumToString( b3Part:getDimZ(), 1), 3) EgtOutLog( 'PartSez=' .. EgtNumToString( b3Part:getDimY(), 1) .. 'x' .. EgtNumToString( b3Part:getDimZ(), 1), 3)
-- se sezione compatibile e lunghezza disponibile sufficiente -- se sezione compatibile e lunghezza disponibile sufficiente
local PartLen = b3Solid:getDimX() local PartLen = b3Solid:getDimX()
local PartWidth = b3Solid:getDimY() local PartWidth = b3Solid:getDimY()
local PartHeight = b3Solid:getDimZ() local PartHeight = b3Solid:getDimZ()
local NextLen = Len - DeltaS - PartLen - DeltaE local NextLen = Len - DeltaS - PartLen - DeltaE
if (( abs( PartWidth - dRawW) < 100 * GEO.EPS_SMALL and abs( PartHeight - dRawH) < 100 * GEO.EPS_SMALL) or if (( abs( PartWidth - dRawW) < 10 * GEO.EPS_SMALL and abs( PartHeight - dRawH) < 10 * GEO.EPS_SMALL) or
( abs( PartHeight - dRawW) < 100 * GEO.EPS_SMALL and abs( PartWidth - dRawH) < 100 * GEO.EPS_SMALL)) and ( abs( PartHeight - dRawW) < 10 * GEO.EPS_SMALL and abs( PartWidth - dRawH) < 10 * GEO.EPS_SMALL)) and
NextLen + DeltaE >= 0 then NextLen + DeltaE >= 0 then
-- eventuale sovramateriale di testa -- eventuale sovramateriale di testa
if i > 1 and vBeam[i].PosX then if vBeam[i].PosX then
DeltaS = max( vBeam[i].PosX - ( dRawL - Len), DeltaSMin) DeltaS = max( vBeam[i].PosX - ( dRawL - Len), 0)
end end
-- dimensioni del grezzo -- dimensioni del grezzo
local CrawLen = min( PartLen + DeltaS + DeltaE, Len) local CrawLen = min( PartLen + DeltaS + DeltaE, Len)
@@ -534,16 +201,13 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroup
EgtSetInfo( nPrevRaw, 'BDST', DeltaS + dPrevDelta) EgtSetInfo( nPrevRaw, 'BDST', DeltaS + dPrevDelta)
end end
end end
if DeltaE > 0.09 then
EgtSetInfo( nRaw, 'TOVM', DeltaE)
end
-- aggiungo faccia per taglio finale al pezzo -- aggiungo faccia per taglio finale al pezzo
BL.AddPartEndFace( Pz, b3Solid) BL.AddPartEndFace( Pz, b3Solid)
-- inserisco il pezzo nel grezzo -- inserisco il pezzo nel grezzo
EgtDeselectPartObjs( Pz) EgtDeselectPartObjs( Pz)
local ptPos = b3Part:getMin() - b3Solid:getMin() + Vector3d( Delta, ( dRawW - PartWidth) / 2, ( dRawH - PartHeight) / 2) local ptPos = b3Part:getMin() - b3Solid:getMin() + Vector3d( Delta, ( dRawW - PartWidth) / 2, ( dRawH - PartHeight) / 2)
EgtAddPartToRawPart( Pz, ptPos, nRaw) EgtAddPartToRawPart( Pz, ptPos, nRaw)
if abs( PartWidth - dRawW) > 100 * GEO.EPS_SMALL then if abs( PartWidth - dRawW) > 10 * GEO.EPS_SMALL then
-- rotazione attorno a centro geometria complessiva del pezzo -- rotazione attorno a centro geometria complessiva del pezzo
EgtRotatePartInRawPart( Pz, X_AX(), 90) EgtRotatePartInRawPart( Pz, X_AX(), 90)
-- correggo per eccentricità solido rispetto a geometria complessiva del pezzo -- correggo per eccentricità solido rispetto a geometria complessiva del pezzo
@@ -557,9 +221,6 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroup
-- aggiorno grezzo precedente -- aggiorno grezzo precedente
nPrevRaw = nRaw nPrevRaw = nRaw
dPrevDelta = Delta dPrevDelta = Delta
else
local sOut = 'Error: part L(' .. EgtNumToString( PartLen, 1) .. ') too big for raw part L(' .. EgtNumToString( Len - 0.1, 1) .. ')'
return false, sOut
end end
-- se rimasto troppo poco grezzo, esco -- se rimasto troppo poco grezzo, esco
--if Len < BD.MinRaw then break end --if Len < BD.MinRaw then break end
@@ -610,12 +271,73 @@ local function Verify90DegRotation( nRawId)
local dRawW = EgtGetRawPartBBox( nRawId):getDimY() local dRawW = EgtGetRawPartBBox( nRawId):getDimY()
local dRawH = EgtGetRawPartBBox( nRawId):getDimZ() local dRawH = EgtGetRawPartBBox( nRawId):getDimZ()
-- verifica dell'altezza rispetto alla massima larghezza -- verifica dell'altezza rispetto alla massima larghezza
if not BD.MAX_WIDTH2 or not BD.MAX_HEIGHT2 then return ( dRawH < BD.MAX_WIDTH + 10 * GEO.EPS_SMALL and dRawW < BD.MAX_HEIGHT + 10 * GEO.EPS_SMALL) or
return ( dRawH < BD.MAX_WIDTH + 10 * GEO.EPS_SMALL and dRawW < BD.MAX_HEIGHT + 10 * GEO.EPS_SMALL) ( dRawH < BD.MAX_WIDTH2 + 10 * GEO.EPS_SMALL and dRawW < BD.MAX_HEIGHT2 + 10 * GEO.EPS_SMALL)
else end
return ( dRawH < BD.MAX_WIDTH + 10 * GEO.EPS_SMALL and dRawW < BD.MAX_HEIGHT + 10 * GEO.EPS_SMALL) or
( dRawH < BD.MAX_WIDTH2 + 10 * GEO.EPS_SMALL and dRawW < BD.MAX_HEIGHT2 + 10 * GEO.EPS_SMALL) -------------------------------------------------------------------------------------------------------------
local function IsHeadFeature( Proc, b3Raw, dCurrOvmH)
-- feature sempre di testa o coda per il gruppo
if Proc.Grp == 1 or Proc.Grp == 2 then
return ( Proc.Box:getCenter():getX() > b3Raw:getCenter():getX() - 0.5 * dCurrOvmH)
end end
-- feature sempre di testa o coda nonostante il gruppo
if ( Proc.Grp == 3 or Proc.Grp == 4) and
( Proc.Prc == 38 or Proc.Prc == 51 or Proc.Prc == 56 or Proc.Prc == 100 or Proc.Prc == 101 or Proc.Prc == 102 or Proc.Prc == 103 or Proc.Prc == 106) then
return ( Proc.Box:getCenter():getX() > b3Raw:getCenter():getX() - 0.5 * dCurrOvmH)
end
-- gestioni speciali
if LapJoint.Identify( Proc) then
return LapJoint.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end
if Drill.Identify( Proc) then
return Drill.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end
if RoundArch.Identify( Proc) then
return RoundArch.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end
if Dovetail.Identify( Proc) then
return Dovetail.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end
if FreeContour.Identify( Proc) then
return FreeContour.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end
-- non è di testa
return false
end
-------------------------------------------------------------------------------------------------------------
local function IsTailFeature( Proc, b3Raw, dCurrOvmH)
-- feature sempre di testa o coda per il gruppo (se non troppo lunga)
if Proc.Grp == 1 or Proc.Grp == 2 then
return ( Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH and Proc.Box:getDimX() < BD.MAX_LEN_HTFEA)
end
-- feature sempre di testa o coda nonostante il gruppo
if ( Proc.Grp == 3 or Proc.Grp == 4) and
( Proc.Prc == 38 or Proc.Prc == 51 or Proc.Prc == 56 or Proc.Prc == 100 or Proc.Prc == 101 or Proc.Prc == 102 or Proc.Prc == 103 or Proc.Prc == 106) then
return ( Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH)
end
-- gestioni speciali
if LapJoint.Identify( Proc) then
return LapJoint.IsTailFeature( Proc, b3Raw)
end
if Drill.Identify( Proc) then
return Drill.IsTailFeature( Proc, b3Raw)
end
if DtMortise.Identify( Proc) then
return DtMortise.IsTailFeature( Proc, b3Raw)
end
if RoundArch.Identify( Proc) then
return RoundArch.IsTailFeature( Proc, b3Raw)
end
if Dovetail.Identify( Proc) then
return Dovetail.IsTailFeature( Proc, b3Raw)
end
if FreeContour.Identify( Proc) then
return FreeContour.IsTailFeature( Proc, b3Raw)
end
-- non è di coda
return false
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
@@ -625,8 +347,7 @@ local function PrintFeatures( vProc, b3Raw)
local Proc = vProc[i] local Proc = vProc[i]
local sOut = string.format( ' Id=%3d Grp=%1d Prc=%3d TC=%2d/%d Flg=%2d Down=%s Side=%s Head=%s Tail=%s Fcse=%1d,%1d Diam=%.2f Fct=%2d Box=%s', local sOut = string.format( ' Id=%3d Grp=%1d Prc=%3d TC=%2d/%d Flg=%2d Down=%s Side=%s Head=%s Tail=%s Fcse=%1d,%1d Diam=%.2f Fct=%2d Box=%s',
Proc.Id, Proc.Grp, Proc.Prc, Proc.TaskId, Proc.CutId, Proc.Id, Proc.Grp, Proc.Prc, Proc.TaskId, Proc.CutId,
Proc.Flg, EgtIf( Proc.Down, 'T', 'F'), EgtIf( Proc.Side, 'T', 'F'), Proc.Flg, EgtIf( Proc.Down, 'T', 'F'), EgtIf( Proc.Side, 'T', 'F'), EgtIf( Proc.Head, 'T', 'F'), EgtIf( Proc.Tail, 'T', 'F'),
EgtIf( Proc.Head, 'T', 'F'), EgtIf( Proc.Tail, 'T', EgtIf( Proc.AdvTail, 'A', 'F')),
Proc.Fcs, Proc.Fce, Proc.Diam, Proc.Fct, tostring( Proc.Box)) Proc.Fcs, Proc.Fce, Proc.Diam, Proc.Fct, tostring( Proc.Box))
-- info speciali per Block Haus Half Lap -- info speciali per Block Haus Half Lap
if Proc.Prc == 37 then if Proc.Prc == 37 then
@@ -637,6 +358,93 @@ local function PrintFeatures( vProc, b3Raw)
end end
end end
-------------------------------------------------------------------------------------------------------------
local function CollectFeatures( PartId, b3Raw, dCurrOvmH)
-- recupero le feature
local vProc = {}
local LayerId = {}
LayerId[1] = BL.GetAddGroup( PartId)
LayerId[2] = EgtGetFirstNameInGroup( PartId or GDB_ID.NULL, 'Processings')
for nInd = 1, 2 do
local ProcId = EgtGetFirstInGroup( LayerId[nInd] or GDB_ID.NULL)
while ProcId do
local nEntType = EgtGetType( ProcId)
if nEntType == GDB_TY.SRF_MESH or nEntType == GDB_TY.EXT_TEXT or
nEntType == GDB_TY.CRV_LINE or nEntType == GDB_TY.CRV_ARC or nEntType == GDB_TY.CRV_BEZ or nEntType == GDB_TY.CRV_COMPO then
local nGrp = EgtGetInfo( ProcId, 'GRP', 'i')
local nPrc = EgtGetInfo( ProcId, 'PRC', 'i')
local nDo = EgtGetInfo( ProcId, 'DO', 'i') or 1
local nCutId = EgtGetInfo( EgtGetParent( EgtGetParent( ProcId)), 'CUTID', 'i') or 0
local nTaskId = EgtGetInfo( ProcId, 'TASKID', 'i') or 0
if nGrp and nPrc and nDo == 1 then
local Proc = {}
Proc.Id = ProcId
Proc.Grp = nGrp
Proc.Prc = nPrc
Proc.Flg = 1
Proc.Fct = EgtSurfTmFacetCount( ProcId) or 0
Proc.Diam = 0
Proc.Fcs = 0
Proc.Fce = 0
Proc.CutId = nCutId
Proc.TaskId = nTaskId
Proc.Box = EgtGetBBoxGlob( ProcId, GDB_BB.STANDARD)
if Proc.Box and not Proc.Box:isEmpty() then
Proc.Head = IsHeadFeature( Proc, b3Raw, dCurrOvmH)
Proc.Tail = IsTailFeature( Proc, b3Raw, dCurrOvmH)
table.insert( vProc, Proc)
-- se foro
if Drill.Identify( Proc) then
-- assegno diametro e facce di ingresso e uscita (dati tabelle sempre per riferimento)
Proc.Diam, Proc.Fcs, Proc.Fce = Drill.GetData( Proc, b3Raw)
-- verifico se necessaria seconda lavorazione da parte opposta per foro più lungo della punta
if Drill.Split( Proc, b3Raw) then
-- aggiorno flags prima parte foro (dati tabelle sempre per riferimento)
Proc.Flg = 2
Proc.Head = IsHeadFeature( Proc, b3Raw, dCurrOvmH)
Proc.Tail = IsTailFeature( Proc, b3Raw, dCurrOvmH)
-- definisco dati seconda parte
local Proc2 = {}
Proc2.Id = ProcId
Proc2.Grp = nGrp
Proc2.Prc = nPrc
Proc2.Flg = -2
Proc2.Box = BBox3d( Proc.Box)
Proc2.Fct = Proc.Fct
Proc2.Diam = Proc.Diam
Proc2.Head = Drill.IsHeadFeature( Proc2, b3Raw, dCurrOvmH)
Proc2.Tail = Drill.IsTailFeature( Proc2, b3Raw)
Proc2.Fcs = Proc.Fce
Proc2.Fce = Proc.Fcs
Proc2.CutId = Proc.CutId
Proc2.TaskId = Proc.TaskId
table.insert( vProc, Proc2)
end
-- se BlockHaus HalfLap
elseif Proc.Prc == 37 then
local nFacInd = BL.GetFaceWithMostAdj( Proc.Id, PartId)
if nFacInd then
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
if vtN then
Proc.vtN = Vector3d( vtN)
end
end
end
else
Proc.Head = false
Proc.Tail = false
Proc.Flg = 0
table.insert( vProc, Proc)
EgtOutLog( ' Feature ' .. tostring( Proc.Id) .. ' is empty (no geometry)')
end
end
end
ProcId = EgtGetNext( ProcId)
end
end
return vProc
end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
local function OrderFeatures( vProc, b3Raw) local function OrderFeatures( vProc, b3Raw)
@@ -703,14 +511,6 @@ local function OrderFeatures( vProc, b3Raw)
if B2.Tail and ( Split.Identify( B1) or not B1.Tail) then if B2.Tail and ( Split.Identify( B1) or not B1.Tail) then
return true return true
end end
-- se primo è feature di coda anticipata e l'altro non è feature di coda
if B1.AdvTail and ( not Split.Identify( B2) or not B2.Tail) then
return false
end
-- se secondo è feature di coda anticipata e l'altro non è feature di coda
if B2.AdvTail and ( not Split.Identify( B1) or not B1.Tail) then
return true
end
-- se primo è scasso o mortasa di coda e secondo no, sempre dopo -- se primo è scasso o mortasa di coda e secondo no, sempre dopo
if B1.Tail and ( LapJoint.Identify( B1) or Mortise.Identify( B1) or DtMortise.Identify( B1)) and if B1.Tail and ( LapJoint.Identify( B1) or Mortise.Identify( B1) or DtMortise.Identify( B1)) and
not ( B2.Tail and ( LapJoint.Identify( B2) or Mortise.Identify( B2) or DtMortise.Identify( B2))) then not ( B2.Tail and ( LapJoint.Identify( B2) or Mortise.Identify( B2) or DtMortise.Identify( B2))) then
@@ -723,13 +523,9 @@ local function OrderFeatures( vProc, b3Raw)
end end
-- se primo è taglio longitudinale completo o altra lav. lunga, dopo tutte le altre feature non di coda -- se primo è taglio longitudinale completo o altra lav. lunga, dopo tutte le altre feature non di coda
if abs( B1.Box:getDimX() - b3Raw:getDimX()) < 0.2 * b3Raw:getDimX() then if abs( B1.Box:getDimX() - b3Raw:getDimX()) < 0.2 * b3Raw:getDimX() then
-- se anche l'altra è lunga, faccio prima quello piccolo in YZ -- se anche l'altra è lunga, faccio prima quello a Zmax
if abs( B2.Box:getDimX() - b3Raw:getDimX()) < 0.2 * b3Raw:getDimX() then if abs( B2.Box:getDimX() - b3Raw:getDimX()) < 0.2 * b3Raw:getDimX() then
if abs( B1.Box:getDimY() * B1.Box:getDimZ() - B2.Box:getDimY() * B2.Box:getDimZ()) < 10 then return B1.Box:getMax():getZ() > B2.Box:getMax():getZ()
return B1.Id < B2.Id
else
return B1.Box:getDimY() * B1.Box:getDimZ() < B2.Box:getDimY() * B2.Box:getDimZ()
end
else else
return B2.Tail or B1.Box:getMin():getX() + 20 > B2.Box:getCenter():getX() return B2.Tail or B1.Box:getMin():getX() + 20 > B2.Box:getCenter():getX()
end end
@@ -813,13 +609,10 @@ local function OrderFeatures( vProc, b3Raw)
end end
for i = 1, #vProc do for i = 1, #vProc do
local ProcI = vProc[i] local ProcI = vProc[i]
if ProcI.Prc == 40 and if ProcI.Prc == 40 then
ProcI.Box and not ProcI.Box:isEmpty() then
for j = i + 1, #vProc do for j = i + 1, #vProc do
local ProcJ = vProc[j] local ProcJ = vProc[j]
if ProcJ.Prc == 40 and if ProcJ.Prc == 40 and ProcJ.Head == ProcI.Head and ProcJ.Tail == ProcI.Tail and
ProcJ.Box and not ProcJ.Box:isEmpty() and
ProcJ.Head == ProcI.Head and ProcJ.Tail == ProcI.Tail and
abs( ProcJ.Diam - ProcI.Diam) < 1.0 and abs( ProcJ.Box:getCenter():getX() - ProcI.Box:getCenter():getX()) < dDrillRange then abs( ProcJ.Diam - ProcI.Diam) < 1.0 and abs( ProcJ.Box:getCenter():getX() - ProcI.Box:getCenter():getX()) < dDrillRange then
if j > i + 1 then if j > i + 1 then
local ProcK = vProc[i+1] local ProcK = vProc[i+1]
@@ -853,12 +646,10 @@ local function OrderFeatures( vProc, b3Raw)
local dMarkRange = 300 local dMarkRange = 300
for i = 1, #vProc do for i = 1, #vProc do
local ProcI = vProc[i] local ProcI = vProc[i]
if ( ProcI.Prc == 60 or ProcI.Prc == 61 or ProcI.Prc == 959) and if ProcI.Prc == 60 or ProcI.Prc == 61 or ProcI.Prc == 959 then
ProcI.Box and not ProcI.Box:isEmpty() then
for j = i + 1, #vProc do for j = i + 1, #vProc do
local ProcJ = vProc[j] local ProcJ = vProc[j]
if ( ProcJ.Prc == 60 or ProcJ.Prc == 61 or ProcJ.Prc == 959) and if ( ProcJ.Prc == 60 or ProcJ.Prc == 61 or ProcJ.Prc == 959) and
ProcJ.Box and not ProcJ.Box:isEmpty() and
ProcJ.Head == ProcI.Head and ProcJ.Tail == ProcI.Tail and ProcJ.Head == ProcI.Head and ProcJ.Tail == ProcI.Tail and
abs( ProcJ.Box:getCenter():getX() - ProcI.Box:getCenter():getX()) < dMarkRange then abs( ProcJ.Box:getCenter():getX() - ProcI.Box:getCenter():getX()) < dMarkRange then
if j > i + 1 then if j > i + 1 then
@@ -873,13 +664,10 @@ local function OrderFeatures( vProc, b3Raw)
local dBHHLRange = 100 local dBHHLRange = 100
for i = 1, #vProc do for i = 1, #vProc do
local ProcI = vProc[i] local ProcI = vProc[i]
if ProcI.Prc == 37 and if ProcI.Prc == 37 then
ProcI.Box and not ProcI.Box:isEmpty() then
for j = i + 1, #vProc do for j = i + 1, #vProc do
local ProcJ = vProc[j] local ProcJ = vProc[j]
if ProcJ.Prc == 37 and if ProcJ.Prc == 37 and abs( ProcI.Box:getCenter():getX() - ProcJ.Box:getCenter():getX()) < dBHHLRange then
ProcJ.Box and not ProcJ.Box:isEmpty() and
abs( ProcI.Box:getCenter():getX() - ProcJ.Box:getCenter():getX()) < dBHHLRange then
if ProcI.HeadDir then if ProcI.HeadDir then
if ProcJ.vtN:getY() < -0.5 then if ProcJ.vtN:getY() < -0.5 then
table.insert( vProc, i, table.remove( vProc, j)) table.insert( vProc, i, table.remove( vProc, j))
@@ -917,18 +705,12 @@ local function ClassifyFeatures( vProc, b3Raw, Stats)
local bSplitRot = false local bSplitRot = false
local nHeading local nHeading
local nSplitting local nSplitting
local vMachineBeforeIntersectingDrillingsId = {}
for i = 1, #vProc do for i = 1, #vProc do
local Proc = vProc[i] local Proc = vProc[i]
local bOk = true local bOk = true
local bDown = false local bDown = false
local bSide = false local bSide = false
local bDownSideOnHeadOk = false local bDownSideOnHeadOk = false
if Proc.MachineBeforeIntersectingDrillings then
table.Insert ( vMachineBeforeIntersectingDrillingsId, Proc.Id)
end
-- se senza geometria (già disabilitato -- se senza geometria (già disabilitato
if Proc.Flg == 0 then if Proc.Flg == 0 then
bOk = false bOk = false
@@ -1090,10 +872,10 @@ local function ClassifyFeatures( vProc, b3Raw, Stats)
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut, b3Raw, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dCurrOvmT) local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut, b3Raw)
local bOk = true local bOk = true
local sErr = '' local sErr = ''
local nNewPhase = -1 local bNewPhase = false
EgtOutLog( ' * Process ' .. tostring( Proc.Id) .. ' *', 1) EgtOutLog( ' * Process ' .. tostring( Proc.Id) .. ' *', 1)
-- se intestatura ( 1-340-X ) -- se intestatura ( 1-340-X )
if Hcut.Identify( Proc) then if Hcut.Identify( Proc) then
@@ -1102,11 +884,13 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
-- se separazione ( 2-350-X ) -- se separazione ( 2-350-X )
elseif Split.Identify( Proc) then elseif Split.Identify( Proc) then
-- esecuzione separazione o eliminazione grezzo residuo -- esecuzione separazione o eliminazione grezzo residuo
bOk, sErr, nNewPhase = Split.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dCurrOvmT) bOk, sErr = Split.Make( Proc, nPhase, nRawId, nPartId)
-- richiedo il passaggio alla seconda fase di lavorazione di questa trave
bNewPhase = true
-- se taglio ( 1/2-010-X) -- se taglio ( 1/2-010-X)
elseif Cut.Identify( Proc) then elseif Cut.Identify( Proc) then
-- esecuzione taglio -- esecuzione taglio
bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, nil, nil, nil, nil, nil, dCurrOvmT) bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- se doppio taglio ( 1/2-011-X) -- se doppio taglio ( 1/2-011-X)
elseif DoubleCut.Identify( Proc) then elseif DoubleCut.Identify( Proc) then
-- esecuzione doppio taglio -- esecuzione doppio taglio
@@ -1127,7 +911,7 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
-- se taglio con lama ( 0/3/4-013-X) -- se taglio con lama ( 0/3/4-013-X)
elseif SawCut.Identify( Proc) then elseif SawCut.Identify( Proc) then
-- esecuzione taglio -- esecuzione taglio
bOk, sErr = SawCut.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, dCurrOvmT) bOk, sErr = SawCut.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- se mezzo-legno di testa ( 1/2-030-X) -- se mezzo-legno di testa ( 1/2-030-X)
elseif RidgeLap.Identify( Proc) then elseif RidgeLap.Identify( Proc) then
-- esecuzione mezzo-legno di testa -- esecuzione mezzo-legno di testa
@@ -1149,11 +933,11 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
-- 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
bOk, sErr = FrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, dCurrOvmT) bOk, sErr = FrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- se block house front ( 3/4-038-X) -- se block house front ( 3/4-038-X)
elseif BlockHausFront.Identify( Proc) then elseif BlockHausFront.Identify( Proc) then
-- esecuzione giunzione francese -- esecuzione giunzione francese
bOk, sErr = BlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, dCurrOvmT) bOk, sErr = BlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- se tenone ( 1/2-050-X) -- se tenone ( 1/2-050-X)
elseif Tenon.Identify( Proc) then elseif Tenon.Identify( Proc) then
-- esecuzione tenone -- esecuzione tenone
@@ -1181,11 +965,11 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
-- se giunto Gerber ( 1/2-071-X) -- se giunto Gerber ( 1/2-071-X)
elseif ScarfJoint.Identify( Proc) then elseif ScarfJoint.Identify( Proc) then
-- esecuzione giunto Gerber -- esecuzione giunto Gerber
bOk, sErr = ScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, dCurrOvmT) bOk, sErr = ScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- se giunto Gerber ( 1/2-070-X) -- se giunto Gerber ( 1/2-070-X)
elseif Scarf.Identify( Proc) then elseif Scarf.Identify( Proc) then
-- esecuzione giunto Gerber -- esecuzione giunto Gerber
bOk, sErr = Scarf.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, dCurrOvmT) bOk, sErr = Scarf.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- se giunto a gradino ( 1/2-080-X) -- se giunto a gradino ( 1/2-080-X)
elseif StepJoint.Identify( Proc) then elseif StepJoint.Identify( Proc) then
-- esecuzione giunto a gradino -- esecuzione giunto a gradino
@@ -1220,10 +1004,10 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
bOk, sErr = ProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) bOk, sErr = ProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- se incastro tirolo ( 1/2/3/4-136-X) -- se incastro tirolo ( 1/2/3/4-136-X)
elseif TyroleanDovetail.Identify( Proc) then elseif TyroleanDovetail.Identify( Proc) then
bOk, sErr = TyroleanDovetail.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, dCurrOvmT) bOk, sErr = TyroleanDovetail.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- se giunto coda di rondine ( 1/2/3/4-138-X) -- se giunto coda di rondine ( 1/2/3/4-138-X)
elseif Dovetail.Identify( Proc) then elseif Dovetail.Identify( Proc) then
bOk, sErr = Dovetail.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, dCurrOvmT) bOk, sErr = Dovetail.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- se contorno libero ( 0/3/4-250-X) -- se contorno libero ( 0/3/4-250-X)
elseif FreeContour.Identify( Proc) then elseif FreeContour.Identify( Proc) then
-- esecuzione contorno -- esecuzione contorno
@@ -1238,7 +1022,7 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
EgtOutLog( sErr) EgtOutLog( sErr)
bOk = false bOk = false
end end
return bOk, sErr, nNewPhase return bOk, sErr, bNewPhase
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
@@ -1345,68 +1129,8 @@ local function MoveDrillsOnTenon( vProc)
end end
end end
-------------------------------------------------------------------------------------------------------------
-- verifica se ci sono forature da lavorare dopo tagli di testa o coda e nel caso le classifica come Head o Tail e gli assegna l'Id della rispettiva feature di taglio
local function SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeIntersectingDrillings)
for i = 1, #vProc do
if Drill.Identify( vProc[i]) then
-- recupero e verifico l'entità foro
local AuxId = EgtGetInfo( vProc[i].Id, 'AUXID', 'i')
if AuxId then AuxId = AuxId + vProc[i].Id end
if not AuxId or EgtGetType( AuxId) ~= GDB_TY.CRV_ARC then
return false
end
-- recupero il vettore estrusione
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
local bOpen = ( vProc[i].Fcs ~= 0 and vProc[i].Fce ~= 0)
local ptCen = EgtCP( AuxId, GDB_RT.GLOB)
local vDistHead, vDistTail
-- check intersezione con feature di testa
if vMachineBeforeIntersectingDrillings.Head.Id then
-- verifico che ci sia intersezione tra la feature foro e la feature taglio di testa
local bIntersectionWithHead =
vMachineBeforeIntersectingDrillings.Head.Box and vProc[i].Box:getMin():getX() < vMachineBeforeIntersectingDrillings.Head.Box:getMax():getX() + 100 * GEO.EPS_SMALL and
vMachineBeforeIntersectingDrillings.Head.Box:getMin():getX() < vProc[i].Box:getMax():getX() + 100 * GEO.EPS_SMALL
-- verifico che ci sia intersezione tra la direzione di estrusione e la faccia della feature taglio di testa
if bIntersectionWithHead then
_, _, vDistHead = EgtLineSurfTmInters( ptCen, -vtExtr, vMachineBeforeIntersectingDrillings.Head.Id, GDB_RT.GLOB)
end
end
-- check intersezione con feature di coda
if vMachineBeforeIntersectingDrillings.Tail.Id then
-- verifico che ci sia intersezione tra la feature foro e la feature taglio di coda
local bIntersectionWithTail =
vMachineBeforeIntersectingDrillings.Tail.Box and vProc[i].Box:getMin():getX() < vMachineBeforeIntersectingDrillings.Tail.Box:getMax():getX() + 100 * GEO.EPS_SMALL and
vMachineBeforeIntersectingDrillings.Tail.Box:getMin():getX() < vProc[i].Box:getMax():getX() + 100 * GEO.EPS_SMALL
-- verifico che ci sia intersezione tra la direzione di estrusione e la faccia della feature taglio di coda
if bIntersectionWithTail then
_, _, vDistTail = EgtLineSurfTmInters( ptCen, -vtExtr, vMachineBeforeIntersectingDrillings.Tail.Id, GDB_RT.GLOB)
end
end
-- se esiste intersezione tra il foro e la feature di testa
if vDistHead and #vDistHead > 0 then
-- 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
vProc[i].MachineAfterHeadCutId = vMachineBeforeIntersectingDrillings.Head.Id
vProc[i].Head = true
end
-- se esiste intersezione tra il foro e la feature di coda
elseif vDistTail and #vDistTail > 0 then
-- 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
vProc[i].MachineAfterTailCutId = vMachineBeforeIntersectingDrillings.Tail.Id
vProc[i].Tail = true
end
end
end
end
end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
function BeamExec.ProcessFeatures() function BeamExec.ProcessFeatures()
if BD.IMPROVE_HEAD_TAIL_DRILLINGS == nil then
BD.IMPROVE_HEAD_TAIL_DRILLINGS = true
end
-- 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
@@ -1432,13 +1156,8 @@ function BeamExec.ProcessFeatures()
-- ingombro del grezzo e sovramateriale di testa -- ingombro del grezzo e sovramateriale di testa
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
local dCurrOvmH = EgtGetInfo( nRawId, 'HOVM', 'd') or 0 local dCurrOvmH = EgtGetInfo( nRawId, 'HOVM', '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, vMachineBeforeIntersectingDrillings = CollectFeatures( nPartId, b3Raw, dCurrOvmH, dCurrOvmT) local vProc = CollectFeatures( nPartId, b3Raw, dCurrOvmH)
-- verifica presenza forature influenzate da lavorazioni di testa o coda
if BD.IMPROVE_HEAD_TAIL_DRILLINGS then
SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeIntersectingDrillings)
end
-- le ordino lungo X -- le ordino lungo X
OrderFeatures( vProc, b3Raw) OrderFeatures( vProc, b3Raw)
-- le classifico -- le classifico
@@ -1457,11 +1176,8 @@ function BeamExec.ProcessFeatures()
SetCutsOnFrontMortises( vProc) SetCutsOnFrontMortises( vProc)
-- eventuale spostamento fori sui tenoni -- eventuale spostamento fori sui tenoni
MoveDrillsOnTenon( vProc) MoveDrillsOnTenon( vProc)
-- identifico la condizione di lavorazione, in base a bSomeDown e bSomeSide
local sDownOrSideOrStd = 'STD'
-- se richiesto ribaltamento (oppure rotazione) -- se richiesto ribaltamento (oppure rotazione)
if ( bSomeDown or bSomeSide) and not BD.DOWN_HEAD and not BD.TURN then if ( bSomeDown or bSomeSide) and not BD.DOWN_HEAD then
sDownOrSideOrStd = 'DOWN'
-- ribalto le travi della fase corrente -- ribalto le travi della fase corrente
local nRId = nRawId local nRId = nRawId
while nRId do while nRId do
@@ -1474,7 +1190,7 @@ function BeamExec.ProcessFeatures()
-- creo la lavorazione -- creo la lavorazione
local Proc = vProc[i] local Proc = vProc[i]
if Proc.Flg ~= 0 and Proc.Down then if Proc.Flg ~= 0 and Proc.Down then
local bOk, sMsg, nNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut, b3Raw, nOrd, sDownOrSideOrStd, nil, nil, dCurrOvmT) local bOk, sMsg, bNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut, b3Raw)
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}) table.insert( Stats, {Err=1, Msg=sMsg, Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId})
@@ -1483,10 +1199,8 @@ function BeamExec.ProcessFeatures()
else else
table.insert( Stats, {Err=0, Msg='', Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId}) table.insert( Stats, {Err=0, Msg='', Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId})
end end
-- se è taglio di separazione, verifico se ha già aggiunto una nuova fase oppure se è da creare -- se era taglio di separazione, aggiungo nuova fase
if nNewPhase > 0 then if bNewPhase then
nPhase = nNewPhase
elseif nNewPhase == 0 then
BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET) BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET)
EgtRotateRawPart( nRawId, X_AX(), 180) EgtRotateRawPart( nRawId, X_AX(), 180)
-- se grezzo successivo senza pezzi e finale, va tolto -- se grezzo successivo senza pezzi e finale, va tolto
@@ -1523,8 +1237,7 @@ function BeamExec.ProcessFeatures()
EgtSetInfo( nDispId, 'ORD', nOrd) EgtSetInfo( nDispId, 'ORD', nOrd)
end end
-- se richiesta rotazione -- se richiesta rotazione
if bSomeSide and not BD.DOWN_HEAD and not BD.TURN then if bSomeSide and not BD.DOWN_HEAD then
sDownOrSideOrStd = 'SIDE'
-- vettore movimento grezzi per rotazione di 90deg -- vettore movimento grezzi per rotazione di 90deg
local dDeltaYZ = EgtGetRawPartBBox( nRawId):getDimY() - EgtGetRawPartBBox( nRawId):getDimZ() local dDeltaYZ = EgtGetRawPartBBox( nRawId):getDimY() - EgtGetRawPartBBox( nRawId):getDimZ()
local vtMove = Vector3d( 0, dDeltaYZ / 2, dDeltaYZ / 2) local vtMove = Vector3d( 0, dDeltaYZ / 2, dDeltaYZ / 2)
@@ -1544,7 +1257,7 @@ function BeamExec.ProcessFeatures()
-- creo la lavorazione -- creo la lavorazione
local Proc = vProc[i] local Proc = vProc[i]
if Proc.Flg ~= 0 and Proc.Side then if Proc.Flg ~= 0 and Proc.Side then
local bOk, sMsg, nNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dCurrOvmT) local bOk, sMsg, bNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw)
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}) table.insert( Stats, {Err=1, Msg=sMsg, Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId})
@@ -1555,9 +1268,7 @@ function BeamExec.ProcessFeatures()
end end
if bOk then nSideMchOk = nSideMchOk + 1 end if bOk then nSideMchOk = nSideMchOk + 1 end
-- se era taglio di separazione, aggiungo nuova fase -- se era taglio di separazione, aggiungo nuova fase
if nNewPhase > 0 then if bNewPhase then
nPhase = nNewPhase
elseif nNewPhase == 0 then
BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET) BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET)
if bPreMove then EgtMoveRawPart( nRawId, vtMove) end if bPreMove then EgtMoveRawPart( nRawId, vtMove) end
EgtRotateRawPart( nRawId, X_AX(), EgtIf( BD.RIGHT_LOAD, -90, 90)) EgtRotateRawPart( nRawId, X_AX(), EgtIf( BD.RIGHT_LOAD, -90, 90))
@@ -1596,13 +1307,12 @@ function BeamExec.ProcessFeatures()
EgtSetInfo( nDispId, 'TYPE', EgtIf( not bSplitRot, 'MID', 'END2')) EgtSetInfo( nDispId, 'TYPE', EgtIf( not bSplitRot, 'MID', 'END2'))
EgtSetInfo( nDispId, 'ORD', nOrd) EgtSetInfo( nDispId, 'ORD', nOrd)
end end
sDownOrSideOrStd = 'STD'
-- inserisco le lavorazioni non ribaltate della trave -- inserisco le lavorazioni non ribaltate della trave
for i = 1, #vProc do for i = 1, #vProc do
-- creo la lavorazione -- creo la lavorazione
local Proc = vProc[i] local Proc = vProc[i]
if Proc.Flg ~= 0 and ( not ( Proc.Down or Proc.Side) or BD.DOWN_HEAD or BD.TURN) then if Proc.Flg ~= 0 and ( not ( Proc.Down or Proc.Side) or BD.DOWN_HEAD) then
local bOk, sMsg, nNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw, nOrd, sDownOrSideOrStd, nil, nil, dCurrOvmT) local bOk, sMsg, bNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw)
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}) table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
@@ -1612,9 +1322,7 @@ function BeamExec.ProcessFeatures()
table.insert( Stats, {Err=0, Msg='', Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId}) table.insert( Stats, {Err=0, Msg='', Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
end end
-- se era taglio di separazione, aggiungo nuova fase -- se era taglio di separazione, aggiungo nuova fase
if nNewPhase > 0 then if bNewPhase then
nPhase = nNewPhase
elseif nNewPhase == 0 then
BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET) BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET)
-- se grezzo successivo senza pezzi e finale, va tolto -- se grezzo successivo senza pezzi e finale, va tolto
local nNextRawId = EgtGetNextRawPart( nRawId) local nNextRawId = EgtGetNextRawPart( nRawId)
+38 -144
View File
@@ -1,4 +1,4 @@
-- BeamLib.lua by Egaltech s.r.l. 2022/07/12 -- BeamLib.lua by Egaltech s.r.l. 2022/01/11
-- Libreria globale per Travi -- Libreria globale per Travi
-- 2020/07/28 Corretto calcolo attacchi e uscite di lame per non uscire dalla faccia sotto. -- 2020/07/28 Corretto calcolo attacchi e uscite di lame per non uscire dalla faccia sotto.
-- 2020/08/18 Aggiunto a GetNearestParalOpposite e GetNearestOrthoOpposite parametro opzionale vtNorm. -- 2020/08/18 Aggiunto a GetNearestParalOpposite e GetNearestOrthoOpposite parametro opzionale vtNorm.
@@ -9,13 +9,6 @@
-- 2021/07/15 Aggiunta GetFaceElevationFromPointDir. -- 2021/07/15 Aggiunta GetFaceElevationFromPointDir.
-- 2021/09/12 Aggiustamenti in GetNearestParalOpposite e GetNearestOrthoOpposite. -- 2021/09/12 Aggiustamenti in GetNearestParalOpposite e GetNearestOrthoOpposite.
-- 2022/01/11 In GetNearest*Opposite ridotto vantaggio XY rispetto a Z da 1 -> 0.9 a 1 -> 0.99. -- 2022/01/11 In GetNearest*Opposite ridotto vantaggio XY rispetto a Z da 1 -> 0.9 a 1 -> 0.99.
-- 2022/04/05 Modifiche a GetNzLimDownUp per FAST.
-- 2022/05/03 Ulteriore limitazione a GetNzLimDownUp per FAST.
-- 2022/05/18 Correzioni e migliorie a PutStartNearestToEdge.
-- 2022/06/25 Rese globali le funzioni GetChainSawBlockedAxis e GetChainSawInitAngs prima in ProcessLapJpoint.
-- 2022/07/12 A GetFaceHvRefDim aggiunta possibilità di confronto e limitazione dimensioni con grezzo/pezzo (conta solo la sezione).
-- 2022/07/26 Aggiunta la funzione FindFaceBestOrientedAsAxis, precedentemente in ProcessLapJoint
-- 2022/07/26 Alla funzione FindFaceBestOrientedAsAxis aggiunta la possibilità di escludere una faccia dalla ricerca
-- Tabella per definizione modulo -- Tabella per definizione modulo
local BeamLib = {} local BeamLib = {}
@@ -193,42 +186,40 @@ function BeamLib.PutStartOnLonger( nCrvId)
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
function BeamLib.PutStartNearestToEdge( nCrvId, b3Raw, dMaxDist, bDown) function BeamLib.PutStartNearestToEdge( nCrvId, b3Raw, bDown)
-- verifico che la curva sia chiusa -- verifico che la curva sia chiusa
if not EgtCurveIsClosed( nCrvId) then return false end if not EgtCurveIsClosed( nCrvId) then return false end
-- recupero il versore normale al piano di lavoro o estrusione -- recupero il versore normale al piano di lavoro o estrusione
local vtN = EgtCurveExtrusion( nCrvId, GDB_ID.ROOT) local vtN = EgtCurveExtrusion( nCrvId, GDB_ID.ROOT)
-- coefficienti per riportare la distanza nel piano di lavoro -- coefficienti per riportare la distanza nel piano di lavoro
local dCoeffY = 0 local dCoeffX = 1 / ( sqrt( 1 - vtN:getX() * vtN:getX()))
if abs( vtN:getY()) < 0.999 then dCoeffY= 1 / ( sqrt( 1 - vtN:getY() * vtN:getY())) end local dCoeffY = 1 / ( sqrt( 1 - vtN:getY() * vtN:getY()))
local dCoeffZ = 0 local dCoeffZ = 1 / ( sqrt( 1 - vtN:getZ() * vtN:getZ()))
if abs( vtN:getZ()) < 0.999 then dCoeffZ = 1 / ( sqrt( 1 - vtN:getZ() * vtN:getZ())) end
-- cerco l'estremo più vicino al box e lo imposto come inizio (se da sotto escludo Zmax e viceversa) -- cerco l'estremo più vicino al box e lo imposto come inizio (se da sotto escludo Zmax e viceversa)
local dUopt = 0 local dUopt = 0
local dDopt = GEO.INFINITO local dDopt = GEO.INFINITO
local dZopt = GEO.INFINITO
local dUi, dUf = EgtCurveDomain( nCrvId) local dUi, dUf = EgtCurveDomain( nCrvId)
for dU = dUi, dUf, 0.5 do for dU = dUi, dUf, 0.5 do
local ptP = EgtUP( nCrvId, dU, GDB_ID.ROOT) local ptP = EgtUP( nCrvId, dU, GDB_ID.ROOT)
local vtDp = EgtUV( nCrvId, dU, -1, GDB_ID.ROOT) if ptP then
local vtDs = EgtUV( nCrvId, dU, 1, GDB_ID.ROOT)
local bTg = ( vtDp and vtDs and vtDp * vtDs > 0.96)
if ptP and bTg then
local vtMin = ptP - b3Raw:getMin() local vtMin = ptP - b3Raw:getMin()
local vtMax = ptP - b3Raw:getMax() local vtMax = ptP - b3Raw:getMax()
local dD = abs( vtMin:getY()) * dCoeffY local dD = abs( vtMin:getX()) * dCoeffX
dD = min( abs( vtMax:getX()) * dCoeffX, dD)
dD = min( abs( vtMin:getY()) * dCoeffY, dD)
dD = min( abs( vtMax:getY()) * dCoeffY, dD) dD = min( abs( vtMax:getY()) * dCoeffY, dD)
dD = min( abs( vtMin:getZ()) * dCoeffZ, dD) if bDown then
dD = min( abs( vtMax:getZ()) * dCoeffZ, dD) dD = min( abs( vtMin:getZ()) * dCoeffZ, dD)
local dZ = abs( EgtIf( bDown, vtMin:getZ(), vtMax:getZ())) * dCoeffZ else
if dD < dMaxDist and dZ < dZopt + GEO.EPS_SMALL then dD = min( abs( vtMax:getZ()) * dCoeffZ, dD)
dUopt = dU end
if dD < dDopt + GEO.EPS_SMALL then
dDopt = dD dDopt = dD
dZopt = dZ dUopt = dU
end end
end end
end end
if abs( dUopt - dUi) > GEO.EPS_ZERO and abs( dUopt - dUf) > GEO.EPS_ZERO then if abs( dUopt - dUi) > GEO.EPS_ZERO then
EgtChangeClosedCurveStart( nCrvId, dUopt) EgtChangeClosedCurveStart( nCrvId, dUopt)
end end
return true return true
@@ -273,8 +264,8 @@ function BeamLib.GetNearestParalOpposite( vtRef, vtNorm)
vtMyRef:normalize() vtMyRef:normalize()
end end
-- se prevalente una componente orizzontale (con piccolissimo vantaggio) -- se prevalente una componente orizzontale (con piccolissimo vantaggio)
if abs( vtMyRef:getX()) > 0.95 * abs( vtMyRef:getZ()) or abs( vtMyRef:getY()) > 0.95 * abs( vtMyRef:getZ()) then if abs( vtMyRef:getX()) > 0.99 * abs( vtMyRef:getZ()) or abs( vtMyRef:getY()) > 0.99 * abs( vtMyRef:getZ()) then
if abs( vtMyRef:getX()) > 0.95 * abs( vtMyRef:getY()) then if abs( vtMyRef:getX()) > abs( vtMyRef:getY()) - GEO.EPS_SMALL then
if vtMyRef:getX() > -GEO.EPS_SMALL then if vtMyRef:getX() > -GEO.EPS_SMALL then
return MCH_MILL_FU.PARAL_LEFT return MCH_MILL_FU.PARAL_LEFT
else else
@@ -307,9 +298,9 @@ function BeamLib.GetNearestOrthoOpposite( vtRef, vtNorm)
vtMyRef:normalize() vtMyRef:normalize()
end end
-- se prevalente una componente orizzontale (con piccolissimo vantaggio) -- se prevalente una componente orizzontale (con piccolissimo vantaggio)
if abs( vtMyRef:getX()) > 0.95 * abs( vtMyRef:getZ()) or abs( vtMyRef:getY()) > 0.95 * abs( vtMyRef:getZ()) then if abs( vtMyRef:getX()) > 0.99 * abs( vtMyRef:getZ()) or abs( vtMyRef:getY()) > 0.99 * abs( vtMyRef:getZ()) then
-- se prevale la componente destra/sinistra -- se prevale la componente destra/sinistra (con piccolo vantaggio)
if abs( vtMyRef:getX()) > 0.95 * abs( vtMyRef:getY()) then if abs( vtMyRef:getX()) > 0.9 * abs( vtMyRef:getY()) then
if vtMyRef:getX() > -GEO.EPS_SMALL then if vtMyRef:getX() > -GEO.EPS_SMALL then
return MCH_MILL_FU.ORTHO_LEFT return MCH_MILL_FU.ORTHO_LEFT
else else
@@ -371,17 +362,17 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function BeamLib.GetVersRef( nOrthoOpposite) function BeamLib.GetVersRef( nOrthoOpposite)
if nOrthoOpposite == MCH_MILL_FU.ORTHO_LEFT or nOrthoOpposite == MCH_MILL_FU.ORTUP_LEFT or nOrthoOpposite == MCH_MILL_FU.PARAL_LEFT then if nOrthoOpposite == MCH_MILL_FU.ORTHO_LEFT then
return X_AX() return X_AX()
elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_RIGHT or nOrthoOpposite == MCH_MILL_FU.ORTUP_RIGHT or nOrthoOpposite == MCH_MILL_FU.PARAL_RIGHT then elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_RIGHT then
return -X_AX() return -X_AX()
elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_FRONT or nOrthoOpposite == MCH_MILL_FU.ORTUP_FRONT or nOrthoOpposite == MCH_MILL_FU.PARAL_FRONT then elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_FRONT then
return Y_AX() return Y_AX()
elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_BACK or nOrthoOpposite == MCH_MILL_FU.ORTUP_BACK or nOrthoOpposite == MCH_MILL_FU.PARAL_BACK then elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_BACK then
return -Y_AX() return -Y_AX()
elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_DOWN or nOrthoOpposite == MCH_MILL_FU.ORTUP_DOWN or nOrthoOpposite == MCH_MILL_FU.PARAL_DOWN then elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_DOWN then
return Z_AX() return Z_AX()
elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_TOP or nOrthoOpposite == MCH_MILL_FU.ORTUP_TOP or nOrthoOpposite == MCH_MILL_FU.PARAL_TOP then elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_TOP then
return -Z_AX() return -Z_AX()
end end
return nil return nil
@@ -412,7 +403,7 @@ function BeamLib.GetBoxFaceNorm( b3Box, ptP, vtV)
local dNzDotV = vtNz * vtV local dNzDotV = vtNz * vtV
if dNxDotV > dNyDotV and dNxDotV > dNzDotV then if dNxDotV > dNyDotV and dNxDotV > dNzDotV then
return vtNx return vtNx
elseif dNyDotV > dNzDotV then elseif dNyDotV > dNzDotV and dNyDotV > dNxDotV then
return vtNy return vtNy
else else
return vtNz return vtNz
@@ -653,7 +644,7 @@ function BeamLib.GetFaceWithMostAdj( nSurfId, nPartId, bCompare3Fc, dCosSideAng)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function BeamLib.GetFaceHvRefDim( nSurfId, nFacet, b3Raw) function BeamLib.GetFaceHvRefDim( nSurfId, nFacet)
-- recupero centro e normale della faccia -- recupero centro e normale della faccia
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT) local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT)
if not ptC or not vtN then return end if not ptC or not vtN then return end
@@ -664,21 +655,8 @@ function BeamLib.GetFaceHvRefDim( nSurfId, nFacet, b3Raw)
end end
-- determino l'ingombro in questo riferimento -- determino l'ingombro in questo riferimento
local b3HV = EgtSurfTmGetFacetBBoxRef( nSurfId, nFacet, GDB_BB.STANDARD, frHV) local b3HV = EgtSurfTmGetFacetBBoxRef( nSurfId, nFacet, GDB_BB.STANDARD, frHV)
local dDimH = b3HV:getDimX()
local dDimV = b3HV:getDimY()
-- se definito grezzo (o solido), applico eventuali limiti
if b3Raw then
local dCoeffY = abs( frHV:getVersX():getY())
if dCoeffY > GEO.EPS_SMALL then
dDimH = min( dDimH, b3Raw:getDimY() / dCoeffY)
end
local dCoeffZ = abs( frHV:getVersY():getZ())
if dCoeffZ > GEO.EPS_SMALL then
dDimV = min( dDimV, b3Raw:getDimZ() / dCoeffZ)
end
end
-- restituisco i valori calcolati -- restituisco i valori calcolati
return frHV, dDimH, dDimV return frHV, b3HV:getDimX(), b3HV:getDimY()
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
@@ -701,51 +679,15 @@ function BeamLib.UpdateTCING( nRawId, dTCI)
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
function BeamLib.GetNzLimDownUp( b3Raw, vtN, vtOrtho) function BeamLib.GetNzLimDownUp( b3Raw, bFromTop)
if BD.C_SIMM or BD.TURN then if not BD.C_SIMM then
return -0.484 if bFromTop then
else return EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM, -0.609, -0.383)
if vtOrtho and vtOrtho:getZ() > 0.35 then
-- N_HorAng < 15° or N_HorAng > 55°
if vtN and ( abs( vtN:getY()) < 0.259 or abs( vtN:getY()) > 0.819) then
return -0.708
-- N_HorAng > 50°
elseif vtN and abs( vtN:getY()) > 0.766 then
return -0.383
else
return EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM, -0.609, -0.383)
end
else else
-- N_HorAng > 60° return EgtIf( b3Raw:getDimZ() < 200, -0.5, -0.258)
if vtN and ( abs( vtN:getY()) > 0.866) then
return -0.708
else
if b3Raw:getDimZ() < 120 then
return -0.708
elseif b3Raw:getDimZ() < 200 then
-- N_HorAng < 15° or N_HorAng > 55°
if vtN and ( abs( vtN:getY()) < 0.259 or abs( vtN:getY()) > 0.819) then
return -0.5
else
return -0.383
end
elseif b3Raw:getDimZ() < BD.MIN_DIM_HBEAM then
-- N_HorAng < 10°
if vtN and ( abs( vtN:getY()) < 0.174) then
return -0.5
else
return -0.24
end
else
-- N_HorAng < 10°
if vtN and ( abs( vtN:getY()) < 0.174) then
return -0.383
else
return -0.174
end
end
end
end end
else
return -0.484
end end
end end
@@ -766,53 +708,5 @@ function BeamLib.GetPhaseType( nPhase)
return ( EgtGetInfo( EgtGetPhaseDisposition( nPhase) or GDB_ID.NULL, 'TYPE') or '') return ( EgtGetInfo( EgtGetPhaseDisposition( nPhase) or GDB_ID.NULL, 'TYPE') or '')
end end
---------------------------------------------------------------------
function BeamLib.GetChainSawBlockedAxis( nInd)
if BD.GetChainSawBlockedAxis then
return BD.GetChainSawBlockedAxis( nInd)
else
if nInd == 1 then
return EgtIf( BD.C_SIMM, 'A=90', 'A=90')
else
return EgtIf( BD.C_SIMM, 'A=0', 'A=0')
end
end
end
---------------------------------------------------------------------
function BeamLib.GetChainSawInitAngs( vtN, vtO, nInd)
if BD.GetChainSawInitAngs then
return BD.GetChainSawInitAngs( vtN, vtO, nInd)
else
if BD.C_SIMM then
return EgtIf( vtN:getY() > 0, 'C=180', 'C=-180')
else
if nInd == 1 then
return ''
else
return EgtIf( vtN:getY() > 0, 'C=180', 'C=-180')
end
end
end
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.
function BeamLib.FindFaceBestOrientedAsAxis( Proc, vtAx, fctExclude)
local nFaceIndMax = 0
local dMaxComp = 0
fctExclude = fctExclude or -1
for i = 1, Proc.Fct do
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT)
local dComp = abs( vtN * vtAx)
if dComp > dMaxComp and i ~= fctExclude + 1 then
nFaceIndMax = i -1
dMaxComp = dComp
end
end
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFaceIndMax, GDB_ID.ROOT)
return nFaceIndMax, ptC, vtN
end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
return BeamLib return BeamLib
+2 -8
View File
@@ -1,4 +1,4 @@
-- DiceCut.lua by Egaltech s.r.l. 2022/02/18 -- DiceCut.lua by Egaltech s.r.l. 2021/09/10
-- Gestione dei piano paralleli nei tagli lunghi: equidistanziamento dei piani paralleli -- Gestione dei piano paralleli nei tagli lunghi: equidistanziamento dei piani paralleli
-- Tabella per definizione modulo -- Tabella per definizione modulo
@@ -474,7 +474,7 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl
if vtNInner:getZ() > -0.0175 or vtNInner:getZ() < dNzLimDwnUp or abs( vtNInner:getY()) > 0.8 then if vtNInner:getZ() > -0.0175 or vtNInner:getZ() < dNzLimDwnUp or abs( vtNInner:getY()) > 0.8 then
vtO:rotate( vtNInner, 90) vtO:rotate( vtNInner, 90)
-- se diretto troppo ortogonalmente all'asse trave e taglio non da sotto, lo ruoto ulteriormente -- se diretto troppo ortogonalmente all'asse trave e taglio non da sotto, lo ruoto ulteriormente
if ( abs( vtO:getY()) > 3 * abs( vtO:getX()) or BBoxRawPart:getDimZ() > 620) and vtNInner:getZ() > dNzLimDwnUp then if abs( vtO:getY()) > 3 * abs( vtO:getX()) and vtNInner:getZ() > dNzLimDwnUp then
vtO:rotate( vtNInner, 90) vtO:rotate( vtNInner, 90)
-- se faccia principale verso il basso (almeno -3deg), lo inverto per iniziare da sopra -- se faccia principale verso il basso (almeno -3deg), lo inverto per iniziare da sopra
if vtNInner:getZ() < -0.05 then if vtNInner:getZ() < -0.05 then
@@ -550,12 +550,6 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl
-- Se esiste la superficie limitante (nFacet == 2) verifica se il taglio più esterno è superfluo e quindi viene eliminato -- Se esiste la superficie limitante (nFacet == 2) verifica se il taglio più esterno è superfluo e quindi viene eliminato
if not bGetOrtoPlanes then if not bGetOrtoPlanes then
VerifyFirstOrthoCut( UltimateTable, originalOffsetP, BBoxRawPart, dNzLimDwnUp) VerifyFirstOrthoCut( UltimateTable, originalOffsetP, BBoxRawPart, dNzLimDwnUp)
-- se rimangono due sole facce, devono coincidere con le originali e quindi sono superflue
if #UltimateTable == 2 and #UltimateTable[1] == 1 and #UltimateTable[2] == 1 then
EgtErase( UltimateTable[1][1])
EgtErase( UltimateTable[2][1])
UltimateTable = {}
end
end end
return UltimateTable return UltimateTable
-101
View File
@@ -1,101 +0,0 @@
-- FaceByPocket.lua by Egaltech s.r.l. 2022/05/82
-- Gestione svuotatura di feature con una faccia
-- Tabella per definizione modulo
local FaceByPocket = {}
-- Include
require( 'EgtBase')
local BL = require( 'BeamLib')
EgtOutLog( ' FaceByPocket started', 1)
-- Dati
local BD = require( 'BeamData')
local ML = require( 'MachiningLib')
---------------------------------------------------------------------
local function ApplyPocket( Proc, nSurfId, nFacet, sPocketing, nInd, dMaxElev, vtN)
-- inserisco la lavorazione di svuotatura
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. nInd
local nMchFId = EgtAddMachining( sName, sPocketing)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nSurfId, nFacet}})
-- imposto uso faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT)
if dMaxElev > 0.1 then
-- imposto elevazione
local sNotes = 'MaxElev=' .. EgtNumToString( dMaxElev, 2) .. ';'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
end
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE
if not BD.C_SIMM and not BD.TURN then
nSCC = EgtIf( vtN:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
return true
end
---------------------------------------------------------------------
function FaceByPocket.Make( Proc, nSurfId, nFacet, sPocketing, nPartId, b3Solid)
local bOk = true
local sErr
-- 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
-- recupero i dati dell'utensile
local dStep = 30
local dMaxDepth = 100
if EgtMdbSetCurrMachining( sPocketing) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
dStep = EgtMdbGetCurrMachiningParam( MCH_MP.STEP) or dStep
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- dati della faccia
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT)
local dElev = BL.GetFaceElevation( nSurfId, nFacet, nPartId)
-- determino numero e valore degli step di lavorazione
local nSurfStep = ceil( dElev / dMaxDepth)
local dSurfStep = dElev / nSurfStep
-- copio superfice al passo superfice e vi applico la lavorazione
for i = nSurfStep, 2, -1 do
local ptOn = ptC + ( dSurfStep * ( i - 1)) * vtN
local nAddIdTmp = EgtSurfTmPlaneInBBox( nAddGrpId, ptOn, vtN, b3Solid, GDB_RT.GLOB)
if nAddIdTmp then
EgtSetName( nAddIdTmp, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( nAddIdTmp, 'TASKID', Proc.TaskId)
-- aggiungo lavorazione
bOk, sErr = ApplyPocket( Proc, nAddIdTmp, 0, sPocketing, i, dSurfStep, vtN)
if not bOk then
return false, sErr
end
end
end
-- faccio ultima superfice
bOk, sErr = ApplyPocket( Proc, nSurfId, nFacet, sPocketing, 1, EgtIf( nSurfStep > 1, dSurfStep, 0), vtN)
if not bOk then
return false, sErr
end
return true
end
return FaceByPocket
+58 -150
View File
@@ -1,4 +1,4 @@
-- FacesBySaw.lua by Egaltech s.r.l. 2022/06/29 -- FacesBySaw.lua by Egaltech s.r.l. 2021/11/26
-- Gestione taglio con lama di feature con una o due facce -- Gestione taglio con lama di feature con una o due facce
-- 2021/01/06 Cambiato limite per attacco Tg con lama e CalcLeadInOutGeom rinominata in CalcLeadInOutPerpGeom. -- 2021/01/06 Cambiato limite per attacco Tg con lama e CalcLeadInOutGeom rinominata in CalcLeadInOutPerpGeom.
-- 2021/02/03 In taglio lama si accettano anche due lati con deviazione minore di 20deg. -- 2021/02/03 In taglio lama si accettano anche due lati con deviazione minore di 20deg.
@@ -10,8 +10,6 @@
-- 2021/08/03 In MakeOneFaceBySaw mgliorata gestione tagli con normale verso il basso e da sopra. -- 2021/08/03 In MakeOneFaceBySaw mgliorata gestione tagli con normale verso il basso e da sopra.
-- 2021/08/31 DS Aggiunta gestione nessun limite direzione da sotto per testa da sotto. -- 2021/08/31 DS Aggiunta gestione nessun limite direzione da sotto per testa da sotto.
-- 2021/11/26 DS Spostate qui MakeOneFaceBySaw (ora MakeOne), CalcLeadInOutPerpGeom e CalcLeadInOutTangGeom. -- 2021/11/26 DS Spostate qui MakeOneFaceBySaw (ora MakeOne), CalcLeadInOutPerpGeom e CalcLeadInOutTangGeom.
-- 2022/04/12 DS Aggiunta gestione speciale cubetti con fresa da sotto.
-- 2022/06/29 DS In MakeTwo modificato controllo facce dirette verso il basso.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local FacesBySaw = {} local FacesBySaw = {}
@@ -41,8 +39,6 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
nOrthoOpposite = Par5 nOrthoOpposite = Par5
vtOrthO = BL.GetVersRef( Par5) vtOrthO = BL.GetVersRef( Par5)
end end
-- verifico se testa da sotto
local bDownHead = ( dVzLimDwnUp and dVzLimDwnUp < - 1.5)
-- linea o bilinea di lavorazione (qui uso nOrthoOpposite per ripetere esattamente il calcolo del Mach) -- linea o bilinea di lavorazione (qui uso nOrthoOpposite per ripetere esattamente il calcolo del Mach)
local ptP1, ptPm, ptP2, vtV1, vtV2, dLen, dWidth = EgtSurfTmFacetOppositeSide( nSurfId, nFacet, BL.GetVersRef( nOrthoOpposite), GDB_ID.ROOT) local ptP1, ptPm, ptP2, vtV1, vtV2, dLen, dWidth = EgtSurfTmFacetOppositeSide( nSurfId, nFacet, BL.GetVersRef( nOrthoOpposite), 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
@@ -87,7 +83,8 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
end end
end end
-- verifico se lavorazione con lama sotto e testa sopra -- verifico se lavorazione con lama sotto e testa sopra
if not dVzLimDwnUp then dVzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN, vtOrthO) end local bFromTop = ( nOrthoOpposite == MCH_MILL_FU.ORTHO_DOWN)
if not dVzLimDwnUp then dVzLimDwnUp = BL.GetNzLimDownUp( b3Raw, bFromTop) end
local bDownUp = ( vtN:getZ() < dVzLimDwnUp) local bDownUp = ( vtN:getZ() < dVzLimDwnUp)
local nFaceUse = nOrthoOpposite local nFaceUse = nOrthoOpposite
if bDownUp then nFaceUse = BL.GetOrtupOpposite( nOrthoOpposite) end if bDownUp then nFaceUse = BL.GetOrtupOpposite( nOrthoOpposite) end
@@ -130,39 +127,30 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
local dLenLi2 = abs( dLi2Tang) local dLenLi2 = abs( dLi2Tang)
local dLenLo2 = abs( dLo2Tang) local dLenLo2 = abs( dLo2Tang)
-- scelgo l'attacco più conveniente (se non taglio praticamente longitudinale) -- scelgo l'attacco più conveniente (se non taglio praticamente longitudinale)
local bTurnTang
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 ( not bDownUp or abs( vtTg:getY()) > 0.5) and if ( not bDownUp or abs( vtTg:getY()) > 0.5) and abs( vtTg:getX()) < 0.9848 and
( not bDownHead or abs( vtTg:getZ()) < 0.51) and ( ( abs( vtTg:getZ()) < 0.17 and ( vtV1:getZ() < -0.5 or vtV2:getZ() < -0.5)) or
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.51 and b3Box:getDimZ() > 300 and BD.C_SIMM and BD.MAX_HEIGHT > 450) or ( abs( vtTg:getZ()) < 0.51 and b3Box:getDimZ() > 300 and BD.C_SIMM and BD.MAX_HEIGHT > 450) or
( Ktp * dLenLi2 < dLenLi and Ktp * dLenLo2 < dLenLo) or Ktp * ( dLenLi2 + dLenLo2) < ( dLenLi + dLenLo)) then ( Ktp * dLenLi2 < dLenLi and Ktp * dLenLo2 < dLenLo) or Ktp * ( dLenLi2 + dLenLo2) < ( dLenLi + dLenLo)) then
dLiTang, dLiPerp, dLoTang, dLoPerp = dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp dLiTang, dLiPerp, dLoTang, dLoPerp = dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp
if BD.TURN then
bTurnTang = true
dLoTang = -( dLiTang + dAllStart - dAccStart + dAllEnd - dAccEnd + dLen)
dLoPerp = BD.COLL_SIC
end
end end
-- posizione braccio -- posizione braccio
EgtOutLog( 'vtN=' .. tostring( vtN) .. ' vtRef=' .. tostring( vtRef) .. ' vtOut=' .. tostring( vtOut) .. ' vtAux=' .. tostring( vtAux), 3) EgtOutLog( 'vtN=' .. tostring( vtN) .. ' vtRef=' .. tostring( vtRef) .. ' vtOut=' .. tostring( vtOut) .. ' vtAux=' .. tostring( vtAux), 3)
local nSCC = MCH_SCC.NONE local nSCC = MCH_SCC.NONE
if not BD.TURN then --if not BD.C_SIMM or vtRef:getZ() < 0.866 or abs( vtTg:getZ()) > 0.02 then
if abs( vtAux:getX()) > abs( vtAux:getY()) - GEO.EPS_SMALL then if abs( vtAux:getX()) > abs( vtAux:getY()) - GEO.EPS_SMALL then
nSCC = EgtIf( ( vtAux:getX() > -GEO.EPS_SMALL), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM) nSCC = EgtIf( ( vtAux:getX() > -GEO.EPS_SMALL), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
else else
nSCC = EgtIf( ( vtAux:getY() > -GEO.EPS_SMALL), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM) nSCC = EgtIf( ( vtAux:getY() > -GEO.EPS_SMALL), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
end end
else --end
local vtTest = EgtIf( bTurnTang, EgtIf( bInvert, vtTg, -vtTg), vtOut) -- per macchine PF se possibile preferisco tenere la testa più davanti
if abs( vtTest:getY()) > abs( vtTest:getZ()) then --if BD.C_SIMM and abs( vtTg:getZ()) < 0.01 and abs( vtTg:getX()) < 0.5 then
nSCC = EgtIf( vtTest:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM) -- if nSCC == MCH_SCC.ADIR_YP then
else -- nSCC = MCH_SCC.ADIR_YM
nSCC = EgtIf( vtTest:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM) -- end
end --end
end
-- inserisco la lavorazione di taglio -- inserisco la lavorazione di taglio
local sName = 'Cut_' .. ( EgtGetName( nSurfId) or tostring( nSurfId)) .. '_' .. tostring( nFacet + 1) local sName = 'Cut_' .. ( EgtGetName( nSurfId) or tostring( nSurfId)) .. '_' .. tostring( nFacet + 1)
local nMchFId = EgtAddMachining( sName, sCutting) local nMchFId = EgtAddMachining( sName, sCutting)
@@ -188,7 +176,6 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
-- 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)
if bTurnTang 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)
-- imposto allungamenti iniziale e finale -- imposto allungamenti iniziale e finale
@@ -197,7 +184,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
-- eventuali note -- eventuali note
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 EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -230,6 +217,15 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
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)
ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT) ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
-- verifico non siano orientate verso il basso
local bFaceOk = {}
bFaceOk[1] = ( vtN[1]:getZ() >= BD.NZ_MINB)
bFaceOk[2] = ( vtN[2]:getZ() >= BD.NZ_MINB)
if not bDownHead and not bFaceOk[1] and not bFaceOk[2] then
local sErr = 'Error : TwoFacesBySaw from bottom impossible'
EgtOutLog( sErr)
return false, sErr
end
-- recupero dati su giunzione tra facce -- recupero dati su giunzione tra facce
local bTouch, ptT1, ptT2, dAngT = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT) local bTouch, ptT1, ptT2, dAngT = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT)
if not bTouch then if not bTouch then
@@ -237,64 +233,44 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
local ptM = ( ptT1 + ptT2) / 2
local vtTg = ptT2 - ptT1 ;
local bConvex = ( dAngT > 0)
-- verifico non siano orientate troppo verso il basso e molto sbandate (oltre 10 deg)
local bFaceOk = {}
bFaceOk[1] = ( vtN[1]:getZ() >= BD.NZ_MINB or abs( vtN[1]:getY()) < 0.174)
bFaceOk[2] = ( vtN[2]:getZ() >= BD.NZ_MINB or abs( vtN[2]:getY()) < 0.174)
if not bDownHead and not bFaceOk[1] and not bFaceOk[2] then
local sErr = 'Error : TwoFacesBySaw from bottom impossible'
EgtOutLog( sErr)
return false, sErr
end
-- calcolo direzione di lavoro -- calcolo direzione di lavoro
local vtRef = {} local vtRef = {}
local vtTg = ptT2 - ptT1 ;
vtRef[1] = vtN[1] ^ vtTg vtRef[1] = vtN[1] ^ vtTg
if vtRef[1] * vtN[2] < 0 then vtRef[1] = - vtRef[1] end if vtRef[1] * vtN[2] < 0 then vtRef[1] = - vtRef[1] end
vtRef[1]:normalize() vtRef[1]:normalize()
if abs( vtRef[1]:getZ()) < 0.577 and abs( abs( vtRef[1]:getX()) - abs( vtRef[1]:getY())) < 0.1 then
vtRef[1] = ptC[1] - ptM
vtRef[1]:normalize()
end
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
vtRef[2]:normalize() vtRef[2]:normalize()
if abs( vtRef[2]:getZ()) < 0.577 and abs( abs( vtRef[2]:getX()) - abs( vtRef[2]:getY())) < 0.1 then
vtRef[2] = ptC[2] - ptM
vtRef[2]:normalize()
end
-- determino quale faccia è più grande -- determino quale faccia è più grande
local dSqDim1 = ( ptC[1] - ptM):sqlen() local ptPs = ( ptT1 + ptT2) / 2
local dSqDim2 = ( ptC[2] - ptM):sqlen() local dSqDim1 = ( ptC[1] - ptPs):sqlen()
local dSqDim2 = ( ptC[2] - ptPs):sqlen()
local nBigInd = EgtIf( dSqDim1 > dSqDim2 - 1., 1, 2) local nBigInd = EgtIf( dSqDim1 > dSqDim2 - 1., 1, 2)
local nSmaInd = 3 - nBigInd local nSmaInd = 3 - nBigInd
local nUpInd = EgtIf( vtN[1]:getZ() > vtN[2]:getZ() - GEO.EPS_SMALL, 1, 2) local nUpInd = EgtIf( vtN[1]:getZ() > vtN[2]:getZ() - GEO.EPS_SMALL, 1, 2)
local nOtInd = 3 - nUpInd local nOtInd = 3 - nUpInd
-- metto in relazione la scelta facce con il confronto del versore Z con la scelta in base alla grandezza faccia -- metto in relazione la scelta facce con il confronto del versore Z con la scelta in base alla grandezza faccia
-- se la faccia più grande è messa secondaria e il suo versore Z non è troppo negativo -- se la faccia più grande è messa secondaria e il suo versore Z non è negativo
if nOtInd == nBigInd and vtN[nBigInd]:getZ() > -0.5 and vtN[nSmaInd]:getZ() < 0.966 then if nOtInd == nBigInd and vtN[nBigInd]:getZ() > -5 * GEO.EPS_SMALL and vtN[nSmaInd]:getZ() < 0.866 then
nUpInd = nBigInd
nOtInd = nSmaInd nOtInd = nSmaInd
nUpInd = nBigInd
end end
-- recupero la lavorazione -- recupero la lavorazione
local sCutting = ML.FindCutting( sCutType, nil, bDownHead) local sCutting = ML.FindCutting( sCutType)
if not sCutting then if not sCutting then
local sErr = 'Error : cutting not found in library' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- recupero i dati dell'utensile -- recupero i dati dell'utensile
local dSawDiam = 400 local dSawDiam = 400
local dSawThick = 5 local dSawThick = 5
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 dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end end
end end
-- calcolo extra taglio -- calcolo extra taglio
@@ -307,113 +283,45 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
if bDownHead then if bDownHead then
dNzLimDwnUp = - 2 dNzLimDwnUp = - 2
end end
-- 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
-- verifico se necessari tagli supplementari -- verifico se necessari tagli supplementari
local vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[nUpInd], vtN[nUpInd], false, ptC[nOtInd], vtN[nOtInd]) local vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[nUpInd], vtN[nUpInd], false, ptC[nOtInd], vtN[nOtInd])
--DC.PrintOrderCut( vCuts) --DC.PrintOrderCut( vCuts)
if #vCuts > 0 then if #vCuts > 0 then
-- sistemo posizione nel DB, nome e info -- 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
-- sistemo posizione nel DB e nome
for i = 1, #vCuts do for i = 1, #vCuts do
for j = 1, #vCuts[i] do for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end end
end end
-- con testa da sopra -- eseguo
if not bDownHead or BD.TURN then for i = 1, #vCuts do
-- eseguo -- assegno il modo di tagliare
for i = 1, #vCuts do local vtOrthO = EgtIf( ( i % 2) == 1, vtRef[nOtInd], vtRef[nUpInd])
-- assegno il modo di tagliare -- lavoro la faccia
local vtOrthO = EgtIf( ( i % 2) == 1, vtRef[nOtInd], vtRef[nUpInd]) for j = 1, #vCuts[i] do
-- lavoro la faccia -- se FAST, pezzo alto e ultimo taglio verticale -> allungo uscita per consentire eventuale rotazione B sul posto
for j = 1, #vCuts[i] do local dAccEnd = 0
-- se FAST, pezzo alto e ultimo taglio verticale -> allungo uscita per consentire eventuale rotazione B sul posto if not BD.C_SIMM and BD.MAX_HEIGHT_ROT_B_ABOVE and b3Raw:getDimZ() > BD.MAX_HEIGHT_ROT_B_ABOVE and vtOrthO:getZ() > 0.866 and j == #vCuts[i] then
local dAccEnd = 0 dAccEnd = - ( dSawDiam / 2 + BD.CUT_SIC)
if not BD.C_SIMM and BD.MAX_HEIGHT_ROT_B_ABOVE and b3Raw:getDimZ() > BD.MAX_HEIGHT_ROT_B_ABOVE and vtOrthO:getZ() > 0.866 and j == #vCuts[i] then
dAccEnd = - ( dSawDiam / 2 + BD.CUT_SIC)
end
local bOk, sErr = FacesBySaw.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthO, dNzLimDwnUp, dCutExtra, BD.CUT_SIC, 0, 0, dAccEnd, nil, b3Raw)
if not bOk then
return bOk, sErr
end
end end
end local bOk, sErr = FacesBySaw.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthO, dNzLimDwnUp, dCutExtra, BD.CUT_SIC, 0, 0, dAccEnd, nil, b3Raw)
-- altrimenti con testa da sotto if not bOk then
else return bOk, sErr
-- eseguo (facendo di seguito i due tagli di ogni singolo cubetto)
for i = 1, #vCuts, 2 do
-- determino il modo di tagliare dei perpendicolari
local vtOrthoO_1 = Vector3d( vtN[nUpInd])
-- determino il modo di tagliare dei paralleli
local vtOrthoO_2
local bNoPerpCuts_2 = false
local vtO
if #vCuts[i] > 0 then
vtO = EgtSurfTmFacetNormVersor( vCuts[i][1], 0, GDB_ID.ROOT)
elseif vCuts[i+2] and #vCuts[i+2] > 0 then
-- lunghezza faccia nell'eventuale direzione ortogonale
local asseX = EgtSurfTmFacetNormVersor( vCuts[i+2][1], 0, GDB_ID.ROOT)
local asseY = asseX ^ vtN[nUpInd]
local Frame = Frame3d( ptC, ptC + asseX, ptC + asseY)
local b3Fac = EgtGetBBoxRef( vCuts[i+1][1], GDB_BB.STANDARD, Frame)
-- se lunghezza inferiore al limite, accetto la direzione
if b3Fac:getDimX() < dMaxDepth - BD.CUT_EXTRA then
vtO = asseX
else
bNoPerpCuts_2 = true
end
else
bNoPerpCuts_2 = true
end
if vtO then
vtOrthoO_2 = Vector3d( vtO)
else
if bHorizCut then
vtOrthoO_2 = -Z_AX()
elseif vtN:getY() > -0.02 then
if not Proc.Head then
vtOrthoO_2 = -Y_AX()
else
vtOrthoO_2 = Y_AX()
end
else
vtOrthoO_2 = -Y_AX()
end
end
-- lavoro le coppie di facce del singolo cubetto
for j = 1, max( #vCuts[i], #vCuts[i+1]) do
-- extra taglio per perpendicolari
local dExtraCut_1 = -0.1
-- extra taglio per paralleli
local dExtraCut_2 = -0.1
-- se non ci sono tagli ortogonali devo affondare
if bNoPerpCuts_2 then
dExtraCut_2 = BD.CUT_EXTRA
end
-- taglio perpendicolare (limite Vz Down Up messo a -2 per non farlo mai intervenire)
if vCuts[i][j] then
local bOk, sErr = FacesBySaw.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO_1, -2, dExtraCut_1, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then
return bOk, sErr
end
end
-- taglio parallelo (limite Vz Down Up messo a -2 per non farlo mai intervenire)
if vCuts[i+1][j] then
local bOk, sErr = FacesBySaw.MakeOne( vCuts[i+1][j], 0, sCutting, dSawDiam, vtOrthoO_2, -2, dExtraCut_2, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then
return bOk, sErr
end
end
end end
end end
end end
else else
nUpInd = EgtIf( vtN[1]:getZ() > vtN[2]:getZ() - GEO.EPS_SMALL, 1, 2)
nOtInd = 3 - nUpInd
-- se prima faccia lavorata è da sotto scambio le facce -- se prima faccia lavorata è da sotto scambio le facce
if vtN[nOtInd]:getZ() < -0.5 then if vtN[nOtInd]:getZ() < -0.5 then
nUpInd, nOtInd = nOtInd, nUpInd nUpInd, nOtInd = nOtInd, nUpInd
@@ -635,4 +543,4 @@ function FacesBySaw.CalcLeadInOutTangGeom( ptP1, ptP2, vtN, dRad, vtRef, dCutExt
return dLiTang, dLiPerp, dLoTang, dLoPerp return dLiTang, dLiPerp, dLoTang, dLoPerp
end end
return FacesBySaw return FacesBySaw
+84 -348
View File
@@ -1,7 +1,5 @@
-- MachiningLib.lua by Egaltech s.r.l. 2022/05/07 -- MachiningLib.lua by Egaltech s.r.l. 2021/04/14
-- Libreria ricerca lavorazioni per Travi -- Libreria ricerca lavorazioni per Travi
-- 2022/05/07 ES Profonde modifiche per scelta ottimale lavorazioni in macchine con più teste.
-- 2022/07/27 Aggiunta la gestione del tipo di foratura "AngleDrill" per fori molto inclinati
-- Tabella per definizione modulo -- Tabella per definizione modulo
local MachiningLib = {} local MachiningLib = {}
@@ -19,83 +17,6 @@ local Pocketings = require( 'PocketingData')
local Sawings = require( 'SawingData') local Sawings = require( 'SawingData')
local Drillings = require( 'DrillData') local Drillings = require( 'DrillData')
-- tipo di teste macchina
local ONE_HEAD = 1 -- una testa (Fast, One, Turn1T)
local TWO_EQUAL_HEADS = 2 -- due teste uguali (PF, Turn)
local TWO_UP_DOWN_HEADS = 3 -- due teste una sopra l'altra sotto (PF1250)
local MachineHeadType = 0
-- testa correntementa attiva, e utensili correnti per ogni testa
local nActiveHead = 0
local H1_TOOL = ''
local H2_TOOL = ''
-- testa e utensile della lavorazione restituita ma non ancora confermata
local nNextMachHead = 0
local H1_NEXT_TOOL = ''
local H2_NEXT_TOOL = ''
-- teste con utensili fissi
local vFixedHeads = {}
---------------------------------------------------------------------
-- funzione che imposta il tipo di macchina corrente
local function SetCurrMachineHeadType()
-- se già inizializzato, esco
if MachineHeadType and MachineHeadType >= 1 and MachineHeadType <= 3 then return end
-- altrimenti, lo imposto
if BD.DOWN_HEAD then
MachineHeadType = TWO_UP_DOWN_HEADS
elseif BD.TWO_EQUAL_HEADS then
MachineHeadType = TWO_EQUAL_HEADS
else
MachineHeadType = ONE_HEAD
end
-- imposto eventuali teste con utensili fissi
if BD.C_SIMM then
vFixedHeads = { [31] = true}
elseif BD.TURN then
vFixedHeads = { [12] = true, [22] = true}
else -- FAST
vFixedHeads = { [2] = true}
end
end
---------------------------------------------------------------------
-- funzione che conferma e rende attivi testa e utensile ipotizzati
local function ConfirmNextMachining()
-- se non definita testa successiva, esco
if not nNextMachHead or nNextMachHead < 1 or nNextMachHead > 2 then return end
-- altrimenti, la confermo come attiva
nActiveHead = nNextMachHead
if nNextMachHead == 1 then
H1_TOOL = H1_NEXT_TOOL
elseif nNextMachHead == 2 then
H2_TOOL = H2_NEXT_TOOL
end
-- reset prossima testa
nNextMachHead = 0
H1_NEXT_TOOL = ''
H2_NEXT_TOOL = ''
end
---------------------------------------------------------------------
-- funzione che traccia testa e utensile ipotizzati
local function SetNextMachining( sToolName, nHead, bFixed)
if nHead < 1 or nHead > 2 then return end
if bFixed then
nNextMachHead = 0
H1_NEXT_TOOL = ''
H2_NEXT_TOOL = ''
end
nNextMachHead = nHead
if nHead == 1 then
H1_NEXT_TOOL = sToolName
elseif nHead == 2 then
H2_NEXT_TOOL = sToolName
end
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function SetCurrMachiningAndTool( sMachName) local function SetCurrMachiningAndTool( sMachName)
if not EgtMdbSetCurrMachining( sMachName) then return false end if not EgtMdbSetCurrMachining( sMachName) then return false end
@@ -103,291 +24,106 @@ local function SetCurrMachiningAndTool( sMachName)
local sTool = EgtTdbGetToolFromUUID( sTuuid) local sTool = EgtTdbGetToolFromUUID( sTuuid)
if not sTool then return false end if not sTool then return false end
if not EgtTdbSetCurrTool( sTool) then return false end if not EgtTdbSetCurrTool( sTool) then return false end
local bActive = EgtTdbGetCurrToolParam( MCH_TP.ACTIVE) return EgtTdbGetCurrToolParam( MCH_TP.ACTIVE)
local sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
local nHead = tonumber( sHead:sub( 2, #sHead))
local bH2 = ( nHead >= 21 and nHead <= 29)
local bFixed = ( vFixedHeads[nHead])
return bActive, sTool, bH2, bFixed
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function VerifyDrill( dDiam, dDepth, bH2) function MachiningLib.FindCutting( sType)
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) for i = 1, #Cuttings do
local dTMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) local Cutting = Cuttings[i]
local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) if Cutting.On and Cutting.Type == sType and SetCurrMachiningAndTool( Cutting.Name) then
local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) return Cutting.Name
local dDiamTh = EgtTdbGetCurrToolThDiam()
local dLenTh = 72
if EgtTdbGetCurrToolThLength then dLenTh = EgtTdbGetCurrToolThLength() end
local dFreeLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) - dLenTh - EgtMdbGetGeneralParam( MCH_GP.MAXDEPTHSAFE)
if dTDiam < dDiam + 10 * GEO.EPS_SMALL and
dTDiam > dDiam - BD.DRILL_TOL - 10 * GEO.EPS_SMALL and
( not dDepth or dTMaxMat > dDepth - GEO.EPS_SMALL) then
return true, { TMaxMat = dTMaxMat, MaxToolLength = dMaxToolLength, ToolDiam = dToolDiam, DiamTh = dDiamTh, FreeLen = dFreeLen, H2 = bH2}
end
end
---------------------------------------------------------------------
function VerifyDrillPocket( dDiam, dDepth, bH2)
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dDiamTh = EgtTdbGetCurrToolThDiam()
local dFreeLen = dTMaxDepth
if dTDiam < dDiam - 10 * GEO.EPS_SMALL and
( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) then
return true, { TMaxDepth = dTMaxDepth, MaxToolLength = dMaxToolLength, ToolDiam = dToolDiam, DiamTh = dDiamTh, FreeLen = dFreeLen, H2 = bH2}
end
end
---------------------------------------------------------------------
function VerifyMill( dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bH2)
local sTuuid = EgtGetMachiningParam( MCH_MP.TUUID)
local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
if ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and
( not sTuuidMstr or sTuuidMstr == sTuuid) and
( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and
( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) then
return true, { TMaxDepth = dTMaxDepth, TDiam = dTDiam, H2 = bH2}
end
end
---------------------------------------------------------------------
function VerifyPocket( dMaxDiam, dDepth, dMaxTotLen, bH2)
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
if ( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and
( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and
( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) then
return true, { TDiam = dTDiam, TMaxDepth = dTMaxDepth, H2 = bH2}
end
end
---------------------------------------------------------------------
function VerifyTool( MachiningType, sType, Params, bH2)
if MachiningType == MCH_MY.DRILLING then
if EgtStartsWith( sType, 'Drill') or EgtStartsWith( sType, 'AngleDrill') then
return VerifyDrill( Params.Diam, Params.Depth, bH2)
elseif EgtStartsWith( sType, 'Pocket') then
return VerifyDrillPocket( Params.Diam, Params.Depth, bH2)
end
elseif MachiningType == MCH_MY.SAWING then
return true, { H2 = bH2}
elseif MachiningType == MCH_MY.MILLING then
return VerifyMill( Params.Depth, Params.TuuidMstr, Params.MaxDiam, Params.MaxTotLen, bH2)
elseif MachiningType == MCH_MY.POCKETING then
return VerifyPocket( Params.MaxDiam, Params.Depth, Params.MaxTotLen, bH2)
elseif MachiningType == MCH_MY.MORTISING then
return true, { H2 = bH2}
else
return false
end
end
---------------------------------------------------------------------
function GetMachinings( MachiningType)
if MachiningType == MCH_MY.DRILLING then
return Drillings
elseif MachiningType == MCH_MY.SAWING then
return Cuttings
elseif MachiningType == MCH_MY.MILLING then
return Millings
elseif MachiningType == MCH_MY.POCKETING then
return Pocketings
elseif MachiningType == MCH_MY.MORTISING then
return Sawings
end
end
---------------------------------------------------------------------
function ReturnParams( MachiningType, MachiningName, sType, ToolParams)
if MachiningType == MCH_MY.DRILLING then
local _, sOrigType = EgtEndsWith( sType, '_H2')
return MachiningName, sType, EgtIf( sOrigType == 'Drill' or sOrigType == 'AngleDrill' , ToolParams.TMaxMat, ToolParams.TMaxDepth), ToolParams.MaxToolLength, ToolParams.ToolDiam, ToolParams.DiamTh, ToolParams.FreeLen
elseif MachiningType == MCH_MY.SAWING then
return MachiningName, ToolParams.H2
elseif MachiningType == MCH_MY.MILLING then
return MachiningName, ToolParams.TMaxDepth, ToolParams.TDiam, ToolParams.H2
elseif MachiningType == MCH_MY.POCKETING then
return MachiningName, ToolParams.TDiam, ToolParams.TMaxDepth, ToolParams.H2
elseif MachiningType == MCH_MY.MORTISING then
return MachiningName
end
end
---------------------------------------------------------------------
local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead)
if bTopHead == nil and bDownHead == nil then
bTopHead = true
bDownHead = false
elseif bTopHead == nil then
bTopHead = not bDownHead
elseif bDownHead == nil then
bDownHead = not bTopHead
end
SetCurrMachineHeadType()
-- verifico se testa attiva va bene
local sH1Mach = ''
local sH1Tool = ''
local sH1Param
local sH2Mach = ''
local sH2Tool = ''
local sH2Param
-- ricerca sulle forature, dal diametro maggiore al minore
local Machinings = GetMachinings( MachiningType)
local ForStart = 1
local ForEnd = #Machinings
local ForStep = 1
if MachiningType == MCH_MY.DRILLING then
ForStart = #Machinings
ForEnd = 1
ForStep = -1
end
if ( BEAM and BEAM.BW) or MachineHeadType == ONE_HEAD or MachineHeadType == TWO_EQUAL_HEADS or ( MachineHeadType == TWO_UP_DOWN_HEADS and not bDownHead) then
_, sType = EgtEndsWith( sType, '_H2')
elseif ( not BEAM or not BEAM.BW) and MachineHeadType == TWO_UP_DOWN_HEADS and bDownHead then
if not EgtEndsWith( sType, '_H2') then
sType = sType .. '_H2'
end end
end end
local MachineHeadUse = MachineHeadType end
if not BEAM or not BEAM.BW then
MachineHeadUse = ONE_HEAD ---------------------------------------------------------------------
end function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen)
if BEAM and BEAM.BW and MachineHeadUse == TWO_UP_DOWN_HEADS and bTopHead and bDownHead then for i = 1, #Millings do
-- se posso usare entrambe le teste, la gestisco come una macchina a due teste da sopra local Milling = Millings[i]
MachineHeadUse = TWO_EQUAL_HEADS if Milling.On and Milling.Type == sType and SetCurrMachiningAndTool( Milling.Name) then
end local sTuuid = EgtGetMachiningParam( MCH_MP.TUUID)
for i = ForStart, ForEnd, ForStep do local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
local Machining = Machinings[i] local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local sMachiningType = Machining.Type local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
if BEAM and BEAM.BW then if ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and
_, sMachiningType = EgtEndsWith( Machining.Type, '_H2') ( not sTuuidMstr or sTuuidMstr == sTuuid) and
end ( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and
-- recupero dati utensile ( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) then
local bToolActive, sToolName, bH2, bFixed = SetCurrMachiningAndTool( Machining.Name) return Milling.Name, dTMaxDepth, dTDiam
if Machining.On and sMachiningType == sType and bToolActive then
local bOk, ToolParams = VerifyTool( MachiningType, sType, Params, bH2)
if bOk then
if MachineHeadUse == ONE_HEAD then
SetNextMachining( sToolName, 1, bFixed)
return ReturnParams(MachiningType, Machining.Name, Machining.Type, ToolParams)
elseif MachineHeadUse == TWO_EQUAL_HEADS then
-- se nessuna testa attiva, prendo la prima lavorazione disponibile
if nActiveHead == 0 then
SetNextMachining( sToolName, EgtIf( bH2, 2, 1), bFixed)
return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams)
-- verifico se posso usare lo stesso utensile della testa attiva
elseif ( nActiveHead == 1 and not bH2 and sToolName == H1_TOOL) or ( nActiveHead == 2 and bH2 and sToolName == H2_TOOL) then
SetNextMachining( sToolName, nActiveHead, bFixed)
return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams)
else
-- segno le lavorazioni disponibili per entrambe le teste
if bH2 then
if not sH2Mach or sH2Mach == '' then
sH2Mach = Machining.Name
sH2Tool = sToolName
sH2Param = ToolParams
end
else
if not sH1Mach or sH1Mach == '' then
sH1Mach = Machining.Name
sH1Tool = sToolName
sH1Param = ToolParams
end
end
end
elseif MachineHeadUse == TWO_UP_DOWN_HEADS then
if bTopHead and not bH2 then
SetNextMachining( sToolName, 1, bFixed)
return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams)
elseif bDownHead and bH2 then
SetNextMachining( sToolName, 2, bFixed)
return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams)
end
end
end end
end end
end end
if MachineHeadUse == TWO_EQUAL_HEADS then end
-- verifico se cambiare testa o cambiare utensile su quella corrente
if nActiveHead == 1 then ---------------------------------------------------------------------
if sH2Mach ~= "" then function MachiningLib.FindPocketing( sType, dMaxDiam, dDepth, dMaxTotLen)
SetNextMachining( sH2Tool, 2, bFixed) for i = 1, #Pocketings do
return ReturnParams( MachiningType, sH2Mach, sType, sH2Param) local Pocketing = Pocketings[i]
--return sH2Mach, sH2Param.Type, sH2Param.TMaxMat, sH2Param.MaxToolLength, sH2Param.ToolDiam, sH2Param.DiamTh, sH2Param.FreeLen if Pocketing.On and Pocketing.Type == sType and SetCurrMachiningAndTool( Pocketing.Name) then
elseif sH1Mach ~= "" then local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
SetNextMachining( sH1Tool, 1, bFixed) local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
return ReturnParams( MachiningType, sH1Mach, sType, sH1Param) local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
--return sH1Mach, sH1Param.Type, sH1Param.TMaxMat, sH1Param.MaxToolLength, sH1Param.ToolDiam, sH1Param.DiamTh, sH1Param.FreeLen if ( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and
end ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and
elseif nActiveHead == 2 then ( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) then
if sH1Mach ~= "" then return Pocketing.Name, dTDiam, dTMaxDepth
SetNextMachining( sH1Tool, 1, bFixed)
return ReturnParams( MachiningType, sH1Mach, sType, sH1Param)
--return sH1Mach, sH1Param.Type, sH1Param.TMaxMat, sH1Param.MaxToolLength, sH1Param.ToolDiam, sH1Param.DiamTh, sH1Param.FreeLen
elseif sH2Mach ~= "" then
SetNextMachining( sH2Tool, 2, bFixed)
return ReturnParams( MachiningType, sH2Mach, sType, sH2Param)
--return sH2Mach, sH2Param.Type, sH2Param.TMaxMat, sH2Param.MaxToolLength, sH2Param.ToolDiam, sH2Param.DiamTh, sH2Param.FreeLen
end end
end end
end end
local bH2, sOrigType = EgtEndsWith( sType, '_H2')
if ( not BEAM or not BEAM.BW) and MachineHeadType == TWO_UP_DOWN_HEADS and bH2 and bTopHead then
return FindMachining( MachiningType, sOrigType, Params, true, false)
end
end
---------------------------------------------------------------------
function MachiningLib.FindCutting( sType, bTopHead, bDownHead)
return FindMachining( MCH_MY.SAWING, sType, nil, bTopHead, bDownHead)
end
---------------------------------------------------------------------
function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead)
local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, 'Drill', { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead)
if not MachiningName or MachiningName == '' then
MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, 'Pocket', { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead)
end
if MachiningName and MachiningName ~= '' then
return MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5
end
end
---------------------------------------------------------------------
function MachiningLib.FindAngleDrilling( dDiam, dDepth, bTopHead, bDownHead)
local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, 'AngleDrill', { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead)
if MachiningName and MachiningName ~= '' then
return MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5
end
end
---------------------------------------------------------------------
function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bTopHead, bDownHead)
return FindMachining( MCH_MY.MILLING, sType, { Depth = dDepth, TuuidMstr = sTuuidMstr, MaxDiam = dMaxDiam, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead)
end
---------------------------------------------------------------------
function MachiningLib.FindPocketing( sType, dMaxDiam, dDepth, dMaxTotLen, bTopHead, bDownHead)
return FindMachining( MCH_MY.POCKETING, sType, { MaxDiam = dMaxDiam, Depth = dDepth, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function MachiningLib.FindSawing( sType) function MachiningLib.FindSawing( sType)
return FindMachining( MCH_MY.MORTISING, sType) for i = 1, #Sawings do
local Sawing = Sawings[i]
if Sawing.On and Sawing.Type == sType and SetCurrMachiningAndTool( Sawing.Name) then
return Sawing.Name
end
end
end end
------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------
function MachiningLib.ApplyMachining( bRecalc, bApplyPost) function MachiningLib.FindDrilling( dDiam, dDepth, bDown)
local bResult = EgtApplyMachining( bRecalc, bApplyPost) -- ricerca sulle forature, dal diametro maggiore al minore
if bResult then ConfirmNextMachining() end local sDrType = 'Drill' .. EgtIf( bDown, '_H2', '')
return bResult for i = #Drillings, 1, -1 do
local Drilling = Drillings[i]
if Drilling.On and Drilling.Type == sDrType and SetCurrMachiningAndTool( Drilling.Name) then
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dDiamTh = EgtTdbGetCurrToolThDiam()
local dLenTh = 72
if EgtTdbGetCurrToolThLength then dLenTh = EgtTdbGetCurrToolThLength() end
local dFreeLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) - dLenTh - EgtMdbGetGeneralParam( MCH_GP.MAXDEPTHSAFE)
if dTDiam < dDiam + 10 * GEO.EPS_SMALL and dTDiam > dDiam - BD.DRILL_TOL - 10 * GEO.EPS_SMALL then
if not dDepth or dTMaxMat > dDepth - GEO.EPS_SMALL then
return Drilling.Name, Drilling.Type, dTMaxMat, dMaxToolLength, dToolDiam, dDiamTh, dFreeLen
end
end
end
end
-- ricerca sulle svuotature, dal diametro maggiore al minore
local sPkType = 'Pocket' .. EgtIf( bDown, '_H2', '')
for i = #Drillings, 1, -1 do
local Drilling = Drillings[i]
if Drilling.On and Drilling.Type == sPkType and SetCurrMachiningAndTool( Drilling.Name) then
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dDiamTh = EgtTdbGetCurrToolThDiam()
local dFreeLen = dTMaxDepth
if dTDiam < dDiam - 10 * GEO.EPS_SMALL then
if not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL then
return Drilling.Name, Drilling.Type, dTMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dFreeLen
end
end
end
end
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
+7 -10
View File
@@ -1,6 +1,5 @@
-- ProcessBlockHausFront.lua by Egaltech s.r.l. 2020/08/03 -- ProcessBlockHausFront.lua by Egaltech s.r.l. 2020/08/03
-- Gestione calcolo giunzione block house in testa -- Gestione calcolo giunzione block house in testa
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessBlockHausFront = {} local ProcessBlockHausFront = {}
@@ -44,10 +43,7 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail) function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
if not dOvmTail then
dOvmTail = BD.OVM_MID
end
-- 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
@@ -129,7 +125,7 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dO
-- 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
local sErr = 'Error : missing AddGroup' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -145,7 +141,7 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dO
bCut = false bCut = false
end end
-- se di coda e coincide con taglio di separazione, non va fatto -- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
bCut = false bCut = false
end end
-- se va fatto, inserisco la lavorazione -- se va fatto, inserisco la lavorazione
@@ -170,14 +166,15 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dO
-- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti -- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
local vCuts = {} local vCuts = {}
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]]) vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
elseif vFaceOrd[3] ~= 0 then elseif vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true) vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
end end
if #vCuts > 0 then if #vCuts > 0 then
-- sistemo posizione nel DB e nome -- sistemo posizione nel DB e nome
for i = 1, #vCuts do for i = 1, #vCuts do
for j = 1, #vCuts[i] do for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end end
@@ -236,7 +233,7 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dO
bCut = false bCut = false
end end
-- se di coda e coincide con taglio di separazione, non va fatto -- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
bCut = false bCut = false
end end
-- se va fatto, inserisco la lavorazione -- se va fatto, inserisco la lavorazione
+2 -2
View File
@@ -75,7 +75,7 @@ function ProcessChamfer.Make( Proc, nPhase, nRawId, nPartId)
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}}) EgtSetMachiningGeometry( {{ AuxId, -1}})
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -178,7 +178,7 @@ function ProcessChamfer.Make( Proc, nPhase, nRawId, nPartId)
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, 0}}) EgtSetMachiningGeometry( {{ Proc.Id, 0}})
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
+120 -148
View File
@@ -1,4 +1,4 @@
-- ProcessCut.lua by Egaltech s.r.l. 2022/07/28 -- ProcessCut.lua by Egaltech s.r.l. 2022/01/26
-- Gestione calcolo singoli tagli di lama per Travi -- Gestione calcolo singoli tagli di lama per Travi
-- 2021/05/18 I due tagli con testa da sotto di un cubetto sono fatti di seguito. -- 2021/05/18 I due tagli con testa da sotto di un cubetto sono fatti di seguito.
-- 2021/06/06 Correzioni per tagli con testa da sotto. -- 2021/06/06 Correzioni per tagli con testa da sotto.
@@ -6,15 +6,6 @@
-- 2021/09/19 Tagli da sotto non sbiechi favorita posizione da sopra di testa. -- 2021/09/19 Tagli da sotto non sbiechi favorita posizione da sopra di testa.
-- 2021/10/06 Piccola correzione a tagli di cubetti con testa da sotto. -- 2021/10/06 Piccola correzione a tagli di cubetti con testa da sotto.
-- 2022/01/26 Taglio da sotto orizzontale deve avere direzione di riferimento ortogonale -Z. -- 2022/01/26 Taglio da sotto orizzontale deve avere direzione di riferimento ortogonale -Z.
-- 2022/02/02 Modifiche per tagli di coda spostati prima come lavorazione su pezzi a caduta.
-- 2022/02/06 Correzioni per tagli di coda spostati prima.
-- 2022/05/31 Alcune modifiche per utilizzare la ProcessCut.Make in ProcessSplit e ProcessHeadCut, per le sezioni alte e larghe.
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe).
-- 2022/06/28 Modificata determinazione taglio bFromBottom in MakeFromTop.
-- 2022/07/18 Se Q04=1, aggiunto LongCut anche dal lato per macchine tipo PF1250.
-- 2022/08/12 I tagli di lama inclinati in coda ora partono dal centro e non dall'esterno.
-- 2022/08/24 Disabilitato il dicing per i tagli meno spessi della lama.
-- 2022/08/25 In caso di AdvTail con taglio lungo Y la profondità di lavorazione è opportunamente diminuita.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessCut = {} local ProcessCut = {}
@@ -41,28 +32,26 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Classificazione della feature -- Classificazione della feature
function ProcessCut.Classify( Proc, b3Raw) function ProcessCut.Classify( Proc, b3Raw)
-- se PF con testa da sotto o TURN, ammessa qualunque orientazione -- se PF con testa da sotto, ammessa qualunque orientazione
if ( BD.C_SIMM and BD.DOWN_HEAD) or BD.TURN then if BD.C_SIMM and BD.DOWN_HEAD then
return true return true
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)
if vtN:getZ() <= - 0.5 and abs( vtN:getY()) > 0.1 or ( vtN:getZ() <= - 0.174 and abs( vtN:getY()) > 0.866) then if vtN:getZ() <= - 0.5 and abs( vtN:getY()) > 0.1 or ( vtN:getZ() <= - 0.174 and abs( vtN:getY()) > 0.866) then
-- calcolo le massime estensioni lineari orizzontale e verticale della faccia local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0)
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw) if DimH > BD.MAX_DIM_DICE then
-- confronto queste estensioni con la massima dimensione del DiceCut (impossibile lavorare se entrambe maggiori)
if DimH > BD.MAX_DIM_DICE and DimV > BD.MAX_DIM_DICE then
return true, true return true, true
end end
end end
-- se è un taglio da sotto, lo verifico -- verifico se c'è un taglio da sotto e se è nei limiti
local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw) local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw)
local bDownCut = ( vtN:getZ() <= dNzLimDwnUp) local bDownCut = ( vtN:getZ() <= dNzLimDwnUp)
if bDownCut then if bDownCut then
-- calcolo l'ingombro orizzontale della faccia
local _, 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) -- confronto anche qua la distanza maggiore della faccia con la massima distanza del DiceCut
if DimH > 2 * BD.MAX_DIM_DICE then -- e se il rapporto supera il 2 (implica che genera 3 tagli) dichiaro impossibile la lavorazione
if DimH and BD.MAX_DIM_DICE and abs( BD.MAX_DIM_DICE) > 20 * GEO.EPS_SMALL and abs( DimH / BD.MAX_DIM_DICE) > 2 then
return true, true return true, true
end end
end end
@@ -167,7 +156,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- 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
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -190,7 +179,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro -- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -203,7 +192,7 @@ end
local function UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw) local function UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
-- eventuale segnalazione ingombro di testa o coda (se non chiamata da altre feature) -- eventuale segnalazione ingombro di testa o coda (se non chiamata da altre feature)
local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ()) local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ())
if Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then if ProcessCut.Identify( Proc) and Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then
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()
if vtN:getZ() > 0.5 then if vtN:getZ() > 0.5 then
@@ -230,35 +219,33 @@ 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) local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut)
-- ingombro del grezzo -- ingombro del grezzo
b3Raw = b3Raw or EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo -- ingombro del pezzo
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then
local sErr = 'Error : part box not found'
EgtOutLog( sErr)
return false, sErr
end
-- 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)
-- limiti di taglio (se molto di lato e inclinati sono permessi fino a -45deg) -- limiti di taglio (se molto di lato e inclinati sono permessi fino a -45deg)
local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN) local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw)
if not BD.C_SIMM and abs( vtN:getX()) < 0.5 then dNzLimDwnUp = -0.707 end
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 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 vtN:getX() < 0))
end end
-- 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)
local bLongCut = ( not bDownCut and vtN:getZ() > 0.865 and local bLongCut = ( not bDownCut and vtN:getZ() > 0.865 and
Proc.Box:getDimY() > b3Solid:getDimY() - 10 * GEO.EPS_SMALL and Proc.Box:getDimY() > b3Solid:getDimY() - 10 * GEO.EPS_SMALL and
( Proc.Box:getDimX() > 0.75 * b3Solid:getDimX() or Proc.Box:getDimX() > 600.000)) ( Proc.Box:getDimX() > 0.75 * b3Solid:getDimX() or Proc.Box:getDimX() > 600.000))
-- verifico se da considerare taglio lungo dal lato, solo per macchine tipo PF1250, inclinato non più di 30deg
local bLongCutFromSide = ( not bDownCut and ( BD.C_SIMM and BD.DOWN_HEAD and ( vtN:getY() > 0.865 or vtN:getY() < -0.865) and
Proc.Box:getDimZ() > b3Solid:getDimZ() - 10 * GEO.EPS_SMALL) and
( Proc.Box:getDimX() > 0.75 * b3Solid:getDimX() or Proc.Box:getDimX() > 600.000))
-- se taglio lungo e Q04 = 1 allora lancio il processo dell'L10 -- se taglio lungo e Q04 = 1 allora lancio il processo dell'L10
local bNoDicing = EgtGetInfo( Proc.Id, 'Q04', 'i') == 1 if bLongCut and EgtGetInfo( Proc.Id, 'Q04', 'i') == 1 then
if bNoDicing then return LongCut.Make( Proc, nPhase, nRawId, nPartId, true)
if bLongCut then
return LongCut.Make( Proc, nPhase, nRawId, nPartId, true)
elseif bLongCutFromSide then
return LongCut.Make( Proc, nPhase, nRawId, nPartId, false, 2)
end
end end
-- se pezzo ancora attaccato alla trave, per non rovinare quello successivo -- se pezzo ancora attaccato alla trave, per non rovinare quello successivo
local bFillAreaPiece local bFillAreaPiece
@@ -306,7 +293,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
end end
end end
-- se vero taglio, eventuale inserimento smussi -- se vero taglio, eventuale inserimento smussi
if ProcessCut.Identify( Proc) then if Proc.Prc == 10 then
local bOkc, sErrC = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) local bOkc, sErrC = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
if not bOkc then return bOkc, sErrC end if not bOkc then return bOkc, sErrC end
end end
@@ -324,21 +311,13 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
end end
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0) local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
-- determino la direzione di taglio preferenziale -- determino la direzione di taglio preferenziale
local frFac, dCutH, dCutV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw) local _, dCutH, dCutV = BL.GetFaceHvRefDim( Proc.Id, 0)
local bHorizCut = ( dCutV < dMaxVertDepth - BD.CUT_EXTRA and not bDownCut) or local bHorizCut = ( dCutV < dMaxVertDepth - BD.CUT_EXTRA and not bDownCut)
( dCutV < 0.8 * dMaxVertDepth - BD.CUT_EXTRA and b3Solid:getDimZ() < 0.8 * dMaxVertDepth - BD.CUT_EXTRA)
local bVertCutOk = ( dCutH < dMaxDepth - BD.CUT_EXTRA) local bVertCutOk = ( dCutH < dMaxDepth - BD.CUT_EXTRA)
-- 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
-- verifico se necessari tagli supplementari -- verifico se necessari tagli supplementari
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)
local vCuts = {} local vCuts = {}
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 if dCutH > dMaxDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC or dCutV > dMaxVertDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC then
local ptExtra, vtExtra local ptExtra, vtExtra
local bAutoCalcSurf = true local bAutoCalcSurf = true
if bFillAreaPiece or bFillTail then if bFillAreaPiece or bFillTail then
@@ -347,13 +326,10 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
vtExtra = X_AX() vtExtra = X_AX()
bAutoCalcSurf = false bAutoCalcSurf = false
end end
-- se il taglio è più spesso della lama abilito il dicing, altrimenti no vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA)
if Proc.Box:getDimX() >= dSawThick then -- se taglio sborda in coda e non è stato inserito nessun taglio a cubetti, lo rilancio con le dimensioni customizzate
vCuts = DC.GetDice( nAddGrpId, EgtIf( bForced, b3Raw, b3Solid), ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA) if ( bFillTail or bCustDiceCut) and #vCuts == 0 then
-- se taglio sborda in coda e non è stato inserito nessun taglio a cubetti, lo rilancio con le dimensioni customizzate vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, Proc.Box:getDimY())
if ( bFillTail or bCustDiceCut) and #vCuts == 0 then
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, Proc.Box:getDimY())
end
end end
end end
-- se il ProcessCut viene lanciato dal ProcessSawCut e non ci sono tagli a cubetti, esco -- se il ProcessCut viene lanciato dal ProcessSawCut e non ci sono tagli a cubetti, esco
@@ -362,10 +338,18 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
end end
--DC.PrintOrderCut( vCuts) --DC.PrintOrderCut( vCuts)
if #vCuts > 0 then if #vCuts > 0 then
-- 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
-- sistemo posizione nel DB e nome -- sistemo posizione nel DB e nome
local bOrthInv = false local bOrthInv = false
for i = 1, #vCuts do for i = 1, #vCuts do
for j = 1, #vCuts[i] do for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
if ( i % 2) == 1 then if ( i % 2) == 1 then
@@ -409,12 +393,14 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
else else
if bHorizCut then if bHorizCut then
vtOrthoO = Z_AX() vtOrthoO = Z_AX()
else elseif vtN:getY() > -0.02 then
if vtN:getZ() < dNzLimDwnUp then if not Proc.Head then
vtOrthoO = EgtIf( vtN:getY() > -0.02, -Y_AX(), Y_AX()) vtOrthoO = -Y_AX()
else else
vtOrthoO = EgtIf( vtN:getY() > 0.02, Y_AX(), -Y_AX()) vtOrthoO = Y_AX()
end end
else
vtOrthoO = -Y_AX()
end end
end end
end end
@@ -432,7 +418,9 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
if not BD.C_SIMM and abs( vtN:getY()) > 0.05 then dVzLimDwnUp = -0.707 end if not BD.C_SIMM and abs( vtN:getY()) > 0.05 then dVzLimDwnUp = -0.707 end
end end
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtNewOrthoO, dVzLimDwnUp, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtNewOrthoO, dVzLimDwnUp, BD.CUT_EXTRA, 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
-- tutti gli altri casi vengono saltati -- tutti gli altri casi vengono saltati
-- caso generale -- caso generale
@@ -454,55 +442,46 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
end end
local dVzLimDwnUp = dNzLimDwnUp local dVzLimDwnUp = dNzLimDwnUp
if not BD.C_SIMM and vtN:getZ() > 0.707 then dVzLimDwnUp = -0.708 end if not BD.C_SIMM and vtN:getZ() > 0.707 then dVzLimDwnUp = -0.708 end
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, sNotes, b3Raw) local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, 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
end end
end end
-- altrimenti tagli diretti della faccia -- altrimenti tagli diretti della faccia
else else
-- impostazioni
local dVzLimDwnUp = dNzLimDwnUp
local dCutExtra = BD.CUT_EXTRA
if Proc.AdvTail then
if bHorizCut then dVzLimDwnUp = -0.01 end
dCutExtra = -BD.ADVANCE_TAIL_OFFS
end
-- lavoro la faccia -- lavoro la faccia
local vtOrthoO local vtOrthoO
if bFromBottom and dCutV < dMaxVertDepth - BD.CUT_EXTRA and vtN:getZ() > 0 then if bFromBottom and dCutV < dMaxVertDepth - BD.CUT_EXTRA and vtN:getZ() > 0 then
vtOrthoO = -Z_AX() vtOrthoO = -Z_AX()
elseif bHorizCut and ( not bVertCutOk or b3Solid:getDimX() > BD.LEN_SHORT_PART or Proc.AdvTail or vtN:getX() > 0 or ( abs( vtN:getY()) < 0.1 and vtN:getZ() <= 0)) then elseif bHorizCut and ( not bVertCutOk or b3Solid:getDimX() > BD.LEN_SHORT_PART or vtN:getX() > 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 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
if Proc.Head then if Proc.Head then
vtOrthoO = X_AX() vtOrthoO = X_AX()
else else
vtOrthoO = -X_AX() vtOrthoO = -X_AX()
end end
elseif vtN:getZ() < dVzLimDwnUp and abs( vtN:getY()) > 0.259 and abs( vtN:getY()) > abs( vtN:getZ()) and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then elseif vtN:getZ() < dNzLimDwnUp and abs( vtN:getY()) > 0.259 and abs( vtN:getY()) > abs( vtN:getZ()) and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then
if Proc.Head then if Proc.Head then
vtOrthoO = X_AX() vtOrthoO = X_AX()
else else
vtOrthoO = -X_AX() vtOrthoO = -X_AX()
end end
elseif Proc.Head then
vtOrthoO = EgtIf( vtN:getY() > -0.02, -Y_AX(), Y_AX())
else else
if vtN:getZ() < dVzLimDwnUp or Proc.Head or Proc.Tail then vtOrthoO = EgtIf( vtN:getY() > 0.02, Y_AX(), -Y_AX())
vtOrthoO = EgtIf( vtN:getY() > -0.02, -Y_AX(), Y_AX())
else
vtOrthoO = EgtIf( vtN:getY() > 0.02, Y_AX(), -Y_AX())
end
-- se è una lavorazione da anticipare diminuisco la profondità del taglio per evitare collisioni con l'albero della lama
if Proc.AdvTail then
local _, dH = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
dCutExtra = min( -BD.ADVANCE_TAIL_OFFS, -dH + dMaxDepth)
end
end end
-- taglio -- taglio
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, dNzLimDwnUp, BD.CUT_EXTRA, 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
-- Aggiornamento ingombro
UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
return true return true
end end
@@ -512,11 +491,17 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
-- ingombro del grezzo -- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo -- ingombro del pezzo
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then
local sErr = 'Error : part box not found'
EgtOutLog( sErr)
return false, sErr
end
-- 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)
-- se vero taglio, eventuale inserimento smussi -- se vero taglio, eventuale inserimento smussi
if ProcessCut.Identify( Proc) then if Proc.Prc == 10 then
local bOkc, sErrC = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) local bOkc, sErrC = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
if not bOkc then return bOkc, sErrC end if not bOkc then return bOkc, sErrC end
end end
@@ -534,19 +519,12 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
local dMaxVertDepth = dMaxDepth local dMaxVertDepth = dMaxDepth
-- determino la direzione di taglio preferenziale -- determino la direzione di taglio preferenziale
local frFac, dCutH, dCutV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw) local _, dCutH, dCutV = BL.GetFaceHvRefDim( Proc.Id, 0)
local bHorizCut = ( dCutV < dMaxVertDepth - BD.CUT_EXTRA) or Proc.AdvTail local bHorizCut = ( dCutV < dMaxVertDepth - BD.CUT_EXTRA)
-- 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
-- verifico se necessari tagli supplementari -- verifico se necessari tagli supplementari
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)
local vCuts = {} local vCuts = {}
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 if dCutH > dMaxDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC or dCutV > dMaxVertDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC then
local ptExtra, vtExtra local ptExtra, vtExtra
local bAutoCalcSurf = true local bAutoCalcSurf = true
if bFillAreaPiece or bFillTail then if bFillAreaPiece or bFillTail then
@@ -555,14 +533,22 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
vtExtra = X_AX() vtExtra = X_AX()
bAutoCalcSurf = false bAutoCalcSurf = false
end end
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, nil ,true) vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, nil ,true)
end end
--DC.PrintOrderCut( vCuts) --DC.PrintOrderCut( vCuts)
if #vCuts > 0 then if #vCuts > 0 then
-- 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
-- sistemo posizione nel DB e nome -- sistemo posizione nel DB e nome
local bOrthInv = false local bOrthInv = false
for i = 1, #vCuts do for i = 1, #vCuts do
for j = 1, #vCuts[i] do for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
if ( i % 2) == 1 then if ( i % 2) == 1 then
@@ -641,7 +627,9 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
-- taglio parallelo (limite Vz Down Up messo a -2 per non farlo mai intervenire) -- taglio parallelo (limite Vz Down Up messo a -2 per non farlo mai intervenire)
if vCuts[i+1][j] then if vCuts[i+1][j] then
local bOk, sErr = Fbs.MakeOne( vCuts[i+1][j], 0, sCutting, dSawDiam, vtOrthoO_2, -2, dExtraCut_2, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) local bOk, sErr = Fbs.MakeOne( vCuts[i+1][j], 0, sCutting, dSawDiam, vtOrthoO_2, -2, dExtraCut_2, 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
end end
end end
@@ -649,9 +637,9 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
else else
-- lavoro la faccia -- lavoro la faccia
local vtOrthoO local vtOrthoO
if bHorizCut and ( b3Solid:getDimX() > BD.LEN_SHORT_PART or Proc.AdvTail or vtN:getX() > 0) then if bHorizCut and ( b3Solid:getDimX() > BD.LEN_SHORT_PART or vtN:getX() > 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 vtN:getZ() > -0.174 and abs( vtN:getY()) > abs( vtN:getZ()) and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then elseif b3Solid:getDimX() < BD.LEN_SHORT_PART 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
if Proc.Head then if Proc.Head then
vtOrthoO = X_AX() vtOrthoO = X_AX()
else else
@@ -677,79 +665,63 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
end end
-- taglio (limite Vz Down Up messo a -2 per non farlo mai intervenire) -- taglio (limite Vz Down Up messo a -2 per non farlo mai intervenire)
local dCutExtra = BD.CUT_EXTRA local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, vtOrthoO, -2, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if Proc.AdvTail then if not bOk then
dCutExtra = min( -BD.ADVANCE_TAIL_OFFS, dMaxVertDepth - dCutV) return bOk, sErr
end end
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, vtOrthoO, -2, dCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then return bOk, sErr end
end end
-- Aggiornamento ingombro
UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
return true return true
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, dOvmTail, bUpdateIng) function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut)
-- sovramateriale di coda
dOvmTail = dOvmTail or BD.OVM_MID
-- ingombro del grezzo -- ingombro del grezzo
b3Raw = b3Raw or EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then
local sErr = 'Error : part box not found'
EgtOutLog( sErr)
return false, sErr
end
-- 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)
-- se taglio di testa -- se taglio di testa
if not bForced then if Proc.Head then
if Proc.Head then -- se coincide con il taglio di separazione precedente, non va fatto
-- se coincide con il taglio di separazione precedente, non va fatto if AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Raw:getMax():getX() + dOvmHead) < 10 * GEO.EPS_SMALL then
if AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Raw:getMax():getX() + dOvmHead) < 10 * GEO.EPS_SMALL then return true
return true
end
-- altrimenti taglio di coda
else
-- se coincide con taglio di separazione, non va fatto
if AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
return true
end
end end
-- se coincide con un taglio frontale non va fatto -- altrimenti taglio di coda
if Proc.CutFront then else
-- se coincide con taglio di separazione, non va fatto
if AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
return true return true
end end
end end
-- se coincide con un taglio frontale non va fatto
if Proc.CutFront then
return true
end
-- abilitazione lavorazione da sotto (testa da sotto e direzione normale sotto -20deg e sbandato oltre 1deg oppure sezione larga o pezzo corto) -- abilitazione lavorazione da sotto (testa da sotto e direzione normale sotto -20deg e sbandato oltre 1deg oppure sezione larga o pezzo corto)
local bTopHead = ( BD.DOWN_HEAD and vtN:getZ() > -0.342)
local bDownHead = ( BD.DOWN_HEAD and vtN:getZ() < -0.341 and local bDownHead = ( BD.DOWN_HEAD and vtN:getZ() < -0.341 and
( abs( vtN:getY()) > 0.017 or b3Raw:getDimY() > 2 * ( BD.MAX_DIM_HTCUT - BD.CUT_EXTRA_MIN) or b3Raw:getDimX() < BD.LEN_SHORT_PART)) ( abs( vtN:getY()) > 0.017 or b3Raw:getDimY() > 2 * ( BD.MAX_DIM_HTCUT - BD.CUT_EXTRA_MIN) or b3Raw:getDimX() < BD.LEN_SHORT_PART))
local bDownTurn = ( BD.TURN and vtN:getZ() < -0.017)
local bTopHead = ( BD.DOWN_HEAD and ( vtN:getZ() > -0.342 or not bDownHead))
-- recupero la lavorazione -- recupero la lavorazione
local sCutType = EgtIf( Proc.Head, 'HeadSide', 'TailSide') local sCutType = EgtIf( Proc.Head, 'HeadSide', 'TailSide')
local sCutting local sCutting = ML.FindCutting( sCutType .. EgtIf( bDownHead, '_H2', ''))
sCutting, bDownHead = ML.FindCutting( sCutType, bTopHead, bDownHead) if not sCutting and bTopHead then
sCutting = ML.FindCutting( sCutType)
bDownHead = false
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)
return false, sErr return false, sErr
end end
-- se taglio con testa da sopra -- se taglio con testa da sopra
if not bDownHead and not bDownTurn then if not bDownHead then
local bOk, sErr = MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes) return MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut)
if not bOk then return false, 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, bFromBottom, bCustDiceCut) return MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut)
if not bOk then return false, sErr end
end end
-- Aggiornamento ingombro (se vero taglio o richiesto)
if ProcessCut.Identify( Proc) or bUpdateIng then
UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
end
return true
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
+1 -1
View File
@@ -69,7 +69,7 @@ function ProcessDecor.Make( Proc, nPhase, nRawId, nPartId)
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
+91 -55
View File
@@ -1,4 +1,4 @@
-- ProcessDoubleCut.lua by Egaltech s.r.l. 2022/07/11 -- ProcessDoubleCut.lua by Egaltech s.r.l. 2021/11/25
-- Gestione calcolo doppi tagli di lama per Travi -- Gestione calcolo doppi tagli di lama per Travi
-- Tabella per definizione modulo -- Tabella per definizione modulo
@@ -28,70 +28,54 @@ end
function ProcessDoubleCut.Classify( Proc, b3Raw) function ProcessDoubleCut.Classify( Proc, b3Raw)
--se una faccia, uso la classificazione dei tagli singoli --se una faccia, uso la classificazione dei tagli singoli
if Proc.Fct == 1 then return Cut.Classify( Proc, b3Raw) end if Proc.Fct == 1 then return Cut.Classify( Proc, b3Raw) end
-- se PF con testa da sotto o TURN, ammessa qualunque orientazione -- se PF con testa da sotto, ammessa qualunque orientazione
if ( BD.C_SIMM and BD.DOWN_HEAD) or BD.TURN then if BD.C_SIMM and BD.DOWN_HEAD then
return true return true
end end
-- determino se convesso o concavo -- limite per facce da sotto
local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw)
-- verifico se convesso
local bAdj, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT) local bAdj, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT)
local bConvex = ( not bAdj or ( dAng > 0)) local bConvex = ( not bAdj or ( dAng > 0))
-- se convesso
if bConvex then if bConvex then
-- recupero i dati di ogni singola faccia -- recupero i dati di ogni singola faccia
for i = 1, 2 do for i = 1, 2 do
local nFac = i - 1 local nFac = i - 1
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFac, GDB_ID.ROOT) local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFac, GDB_ID.ROOT)
if ( vtN:getZ() <= - 0.5 and abs( vtN:getY()) > 0.1) or ( vtN:getZ() <= - 0.174 and abs( vtN:getY()) > 0.866) then if ( vtN:getZ() <= - 0.5 and abs( vtN:getY()) > 0.1) or ( vtN:getZ() <= - 0.174 and abs( vtN:getY()) > 0.866) then
-- calcolo la massima estensione orizzontale lineare della faccia local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, nFac)
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, nFac, b3Raw) if DimH > BD.MAX_DIM_DICE then
-- confronto questa estensione con la massima dimensione del DiceCut (impossibile lavorare se maggiore)
if DimH > BD.MAX_DIM_DICE and DimV > BD.MAX_DIM_DICE then
return true, true return true, true
end end
end end
local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN)
local bDownCut = ( vtN:getZ() <= dNzLimDwnUp) local bDownCut = ( vtN:getZ() <= dNzLimDwnUp)
if bDownCut then if bDownCut then
-- calcolo l'ingombro orizzontale della faccia
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, nFac) local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, nFac)
-- confronto questo ingombro con il doppio della massima dimensione del DiceCut (impossibile lavorare sotto da sopra se più di 2 tagli) -- confronto anche qua la distanza maggiore della faccia con la massima distanza del DiceCut
if DimH > 2 * BD.MAX_DIM_DICE then -- e se il rapporto supera il 2 (implica che genera 3 tagli) dichiaro impossibile la lavorazione
if DimH and BD.MAX_DIM_DICE and abs( BD.MAX_DIM_DICE) > 20 * GEO.EPS_SMALL and abs( DimH / BD.MAX_DIM_DICE) > 2 then
return true, true return true, true
end end
end end
end end
return true, false return true, false
-- altrimenti concavo, verifico le normali delle facce per tagli da sotto
else
local ptC = {}
local vtN = {}
ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
local vtX = vtN[1] ^ vtN[2] ; vtX:normalize()
local vtY = { vtX ^ vtN[1], - vtX ^ vtN[2]}
for i = 1, 2 do
local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN[i], vtY[i])
local bDownCut = ( vtN[i]:getZ() <= dNzLimDwnUp)
if bDownCut then
-- dimensione della faccia perpendicolarmente alla linea di intersezione tra le facce
local frRef = Frame3d( ptC[i], ptC[i] + 100 * vtX, ptC[i] + 100 * vtY[i])
local b3Ref = EgtSurfTmGetFacetBBoxRef( Proc.Id, i-1, GDB_BB.STANDARD, frRef)
-- dimensione dell'altra faccia perpendicolarmente alla linea di intersezione tra le facce
local frRef2 = Frame3d( ptC[3-i], ptC[3-i] + 100 * vtX, ptC[3-i] + 100 * vtY[3-1])
local b3Ref2 = EgtSurfTmGetFacetBBoxRef( Proc.Id, 2-i, GDB_BB.STANDARD, frRef2)
-- se faccia grande
if b3Ref:getDimY() > BD.MAX_DIM_DICE then
-- se altra faccia piccola
if b3Ref2:getDimY() < BD.MAX_DIM_DICE then
return true, true
else
return false
end
end
end
end
return true, false
end end
-- altrimenti concavo, verifico le normali delle facce per tagli da sotto
for i = 1, 2 do
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, i-1, GDB_ID.ROOT)
local bDownCut = ( vtN:getZ() <= dNzLimDwnUp)
if bDownCut then
-- dimensione della faccia perpendicolare alla linea di intersezione tra le facce
local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, 2-i, GDB_ID.ROOT)
local vtX = vtN2 ^ vtN
local frRef = Frame3d( ptC, ptC + 100 * vtX, ptC + 100 * vtN2)
local b3Ref = EgtSurfTmGetFacetBBoxRef( Proc.Id, i-1, GDB_BB.STANDARD, frRef)
if b3Ref:getDimY() > BD.MAX_DIM_DICE then
return true, true
end
end
end
return true, false
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
@@ -135,7 +119,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
local sMillingDw = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true) local sMillingDw = ML.FindMilling( 'Mark_H2')
if bVert and not sMillingDw then if bVert and not sMillingDw then
local sErr = 'Error : milling (Mark_H2) not found in library' local sErr = 'Error : milling (Mark_H2) not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -157,7 +141,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- 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
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -180,7 +164,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro -- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -192,7 +176,7 @@ end
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- se singola faccia, passo a quella lavorazione -- se singola faccia, passo a quella lavorazione
if Proc.Fct == 1 then return Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, nil, bForced, b3Raw, sNotes, dOvmTail, true) end if Proc.Fct == 1 then return Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) end
-- ingombro del grezzo -- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo -- ingombro del pezzo
@@ -251,9 +235,9 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetInfo( AddId, 'TASKID', Proc.TaskId) EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
local b3Add = EgtGetBBoxGlob( AddId, GDB_BB.STANDARD) local b3Add = EgtGetBBoxGlob( AddId, GDB_BB.STANDARD)
-- applico lavorazione -- applico lavorazione
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Add, Fct = 1, Flg = Proc.Flg, local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = 10, Box = b3Add, Fct = 1, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId} Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, nil, nil, bForced, b3Raw, sNotes, dOvmTail, true) local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
end end
-- creo piano di taglio coincidente con la seconda faccia e lo lavoro -- creo piano di taglio coincidente con la seconda faccia e lo lavoro
@@ -263,18 +247,70 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetInfo( AddId, 'TASKID', Proc.TaskId) EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
local b3Add = EgtGetBBoxGlob( AddId, GDB_BB.STANDARD) local b3Add = EgtGetBBoxGlob( AddId, GDB_BB.STANDARD)
-- applico lavorazione -- applico lavorazione
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Add, Fct = 1, Flg = Proc.Flg, local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = 10, Box = b3Add, Fct = 1, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId} Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, nil, nil, bForced, b3Raw, sNotes, dOvmTail, true) local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
end end
-- altrimenti concavo -- altrimenti concavo
else else
-- eseguo -- abilitazione lavorazione da sotto (testa da sotto e direzione normale sotto -30deg)
local bTopHead = ( BD.DOWN_HEAD and vtNm:getZ() > -0.5)
local bDownHead = ( BD.DOWN_HEAD and vtNm:getZ() < -0.5)
-- recupero la lavorazione
local sCutType = EgtIf( bHead, 'HeadSide', 'TailSide') local sCutType = EgtIf( bHead, 'HeadSide', 'TailSide')
local bDownHead = ( BD.DOWN_HEAD and vtNm:getZ() < BD.NZ_MINB) local sCutting = ML.FindCutting( sCutType .. EgtIf( bDownHead, '_H2', ''))
local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType, false, bDownHead) if not sCutting and bTopHead then
if not bOk then return bOk, sErr end sCutting = ML.FindCutting( sCutType)
bDownHead = false
end
if not sCutting then
local sErr = 'Error : cutting not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati dell'utensile
local dSawDiam = 400
local dMaxDepth = 0
if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
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
-- aggiorno nome e info
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
-- determino il modo di tagliare
local vtOrthOpp = vtN[nBigInd]
local vtNorm = vtN[nSmaInd]
if ( i % 2) ~= 1 then vtOrthOpp, vtNorm = vtNorm, vtOrthOpp end
-- lavoro la faccia
for j = 1, #vCuts[i] do
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthOpp, EgtIf( bDownHead, -2, nil), 0, 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, sCutType .. EgtIf( bDownHead, '_H2', ''), false, bDownHead)
if not bOk then
return bOk, sErr
end
end
-- segnalazione ingombro di testa o coda -- segnalazione ingombro di testa o coda
if Proc.Head then if Proc.Head then
-- intersezioni con linee a metà altezza appena dentro dal davanti e dal dietro -- intersezioni con linee a metà altezza appena dentro dal davanti e dal dietro
+13 -16
View File
@@ -1,6 +1,5 @@
-- ProcessDovetail.lua by Egaltech s.r.l. 2021/02/04 -- ProcessDovetail.lua by Egaltech s.r.l. 2021/02/04
-- Gestione calcolo giunzione coda di rondine -- Gestione calcolo giunzione coda di rondine
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessDovetail = {} local ProcessDovetail = {}
@@ -227,7 +226,7 @@ local function AddFaceToSurf( Proc, nPartId, b3Solid)
-- 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
local sErr = 'Error : missing AddGroup' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -593,7 +592,7 @@ local function MachChainFacesByBlade( Proc, nCFaceSide, nCFaceInt1, nCFaceInt2,
EgtSetMachiningParam( MCH_MP.STARTADDLEN, 50) EgtSetMachiningParam( MCH_MP.STARTADDLEN, 50)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, 50) EgtSetMachiningParam( MCH_MP.ENDADDLEN, 50)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -657,7 +656,7 @@ local function MakeByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3So
-- 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
local sErr = 'Error : missing AddGroup' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -837,7 +836,7 @@ local function MakeMillCut( Proc, i, j, k, sMilling,
end end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -1222,7 +1221,7 @@ local function Make2Faces( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
local nSCC = MCH_SCC.ADIR_YP local nSCC = MCH_SCC.ADIR_YP
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -1381,7 +1380,7 @@ local function Make2Faces( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, dOvmTail) local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid)
-- recupero la geometria ausiliaria -- recupero la geometria ausiliaria
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
@@ -1390,7 +1389,7 @@ local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
-- recupero il centro e la normale della faccia ausiliaria -- recupero il centro e la normale della faccia ausiliaria
local ptC, vtN = EgtSurfTmFacetCenter( AuxId, 0, GDB_ID.ROOT) local ptC, vtN = EgtSurfTmFacetCenter( AuxId, 0, GDB_ID.ROOT)
if not vtN then if not vtN then
local sErr = 'Error : wrong Normal of AuxSurface' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' wrong Normal of AuxSurface'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -1399,7 +1398,7 @@ local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
-- recupero la lavorazione per la geometria ausiliaria -- recupero la lavorazione per la geometria ausiliaria
local sCutting = ML.FindCutting( 'HeadSide') local sCutting = ML.FindCutting( 'HeadSide')
if not sCutting then if not sCutting then
local sErr = 'Error : cutting not found in library' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -1416,7 +1415,7 @@ local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
-- 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
local sErr = 'Error : missing AddGroup' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -1428,7 +1427,7 @@ local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
return true return true
end end
-- verifico se coincide con taglio di coda -- verifico se coincide con taglio di coda
if not bHead and AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then if not bHead and AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
return true return true
end end
-- inserisco la lavorazione -- inserisco la lavorazione
@@ -1711,9 +1710,7 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail) function ProcessDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- sovramateriale di coda
dOvmTail = dOvmTail or BD.OVM_MID
-- recupero l'ingombro del grezzo di appartenenza -- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- in base al tipo di feature attribuisco il significato dei parametri Q -- in base al tipo di feature attribuisco il significato dei parametri Q
@@ -1738,7 +1735,7 @@ function ProcessDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail
-- se ha due facce ( allora è di testa o coda) -- se ha due facce ( allora è di testa o coda)
if Proc.Fct == 2 then if Proc.Fct == 2 then
-- eventuale taglio di testa o coda -- eventuale taglio di testa o coda
local bAuxOk, sAuxErr = MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, dOvmTail) local bAuxOk, sAuxErr = MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid)
if not bAuxOk then return bAuxOk, sAuxErr end if not bAuxOk then return bAuxOk, sAuxErr end
-- lavorazione della feature -- lavorazione della feature
local bOk, sErr = Make2Faces( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, bForceUseRough) local bOk, sErr = Make2Faces( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, bForceUseRough)
@@ -1746,7 +1743,7 @@ function ProcessDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail
-- se ha 3 facce ed è di testa o coda -- se ha 3 facce ed è di testa o coda
elseif Proc.Fct == 3 and ( Proc.Head or Proc.Tail) then elseif Proc.Fct == 3 and ( Proc.Head or Proc.Tail) then
-- eventuale taglio di testa o coda -- eventuale taglio di testa o coda
local bAuxOk, sAuxErr = MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, dOvmTail) local bAuxOk, sAuxErr = MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid)
if not bAuxOk then return bAuxOk, sAuxErr end if not bAuxOk then return bAuxOk, sAuxErr end
-- lavorazione della feature -- lavorazione della feature
if bForceUseRough then if bForceUseRough then
+100 -155
View File
@@ -1,18 +1,9 @@
-- ProcessDrill.lua by Egaltech s.r.l. 2022/08/18 -- ProcessDrill.lua by Egaltech s.r.l. 2021/10/29
-- Gestione calcolo forature per Travi -- Gestione calcolo forature per Travi
-- 2021/04/14 DS Corretta gestione Invert con testa da sotto. Migliorato calcolo ingombro portautensile. -- 2021/04/14 DS Corretta gestione Invert con testa da sotto. Migliorato calcolo ingombro portautensile.
-- 2021/05/03 DS Su macchina con testa da sotto aggiunta possibilità di fare fori verticali metà sopra e l'altra sotto. -- 2021/05/03 DS Su macchina con testa da sotto aggiunta possibilità di fare fori verticali metà sopra e l'altra sotto.
-- 2021/09/19 DS Si premia il più possibile ricerca punta con adeguato affondamento. -- 2021/09/19 DS Si premia il più possibile ricerca punta con adeguato affondamento.
-- 2021/10/29 DS MaxElev anche su fori con svuotatura. -- 2021/10/29 DS MaxElev anche su fori con svuotatura.
-- 2022/03/26 DS Correzioni per fori testa-fianco nel piano.
-- 2022/03/29 DS Corretta assegnazione fori molto inclinati fianco/coda a coda.
-- 2022/04/21 DS Corretto riconoscimento fori di coda.
-- 2022/06/22 Nel riconoscimento fori di coda si utilizza ora il reale sovramateriale di coda (dOvmTail) invece di BD.OVM_MID.
-- 2022/07/01 Aggiunta gestione allungamento percorsi fori in caso di materiale già rimosso da lavorazioni precedenti
-- 2022/07/07 Aggiunta la gestione delle forature migliorate in presenza di feature testa/coda che tagliano tutta la sezione; gli Id delle feature sono nelle proprietà MachineAfterHeadCutId e MachineAfterTailCutId.
-- 2022/07/12 Aggiunto un valore minimo (10) per la distanza di sicurezza.
-- 2022/07/27 Aggiunta la gestione del tipo di foratura "AngleDrill" per fori molto inclinati
-- 2022/08/18 Aggiunta gestione macchine con testa da sotto e punta disabilitata.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessDrill = {} local ProcessDrill = {}
@@ -61,11 +52,9 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Verifica se feature di coda -- Verifica se feature di coda
function ProcessDrill.IsTailFeature( Proc, b3Raw, dOvmTail) function ProcessDrill.IsTailFeature( Proc, b3Raw)
-- sovramateriale di coda
dOvmTail = dOvmTail or BD.OVM_MID
-- verifico se è in coda -- verifico se è in coda
if Proc.Box:getMin():getX() > b3Raw:getMin():getX() + dOvmTail + BD.MAX_DIST_HTFEA then if Proc.Box:getMin():getX() > b3Raw:getMin():getX() + BD.OVM_MID + BD.MAX_DIST_HTFEA then
return false return false
end end
-- recupero e verifico l'entità foro -- recupero e verifico l'entità foro
@@ -76,8 +65,8 @@ function ProcessDrill.IsTailFeature( Proc, b3Raw, dOvmTail)
end end
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
-- se entrata principale -- se entrata principale
local nFcs = EgtGetInfo( Proc.Id, 'FCS', 'i') or 0 if Proc.Flg == 2 or ( Proc.Flg == 1 and vtExtr:getZ() >= BD.DRILL_VZ_MIN) then
if ( Proc.Flg == 2 or ( Proc.Flg == 1 and vtExtr:getZ() >= BD.DRILL_VZ_MIN)) and ( nFcs == 5 or nFcs == 6 or abs( vtExtr:getX()) < BD.DRILL_VX_MAX) then local nFcs = EgtGetInfo( Proc.Id, 'FCS', 'i') or 0
return ( ( nFcs == 5 or nFcs == 6) and vtExtr:getX() < -0.5) return ( ( nFcs == 5 or nFcs == 6) and vtExtr:getX() < -0.5)
-- altrimenti entrata opposta -- altrimenti entrata opposta
else else
@@ -128,7 +117,7 @@ function ProcessDrill.Split( Proc, b3Raw)
local bHoriz = ( abs( vtExtr:getZ()) < abs( BD.DRILL_VZ_MIN) and local bHoriz = ( abs( vtExtr:getZ()) < abs( BD.DRILL_VZ_MIN) and
( abs( vtExtr:getY()) * b3Raw:getDimZ() > abs( vtExtr:getZ()) * b3Raw:getDimY() or Proc.Fce == 5 or Proc.Fce == 6)) ( abs( vtExtr:getY()) * b3Raw:getDimZ() > abs( vtExtr:getZ()) * b3Raw:getDimY() or Proc.Fce == 5 or Proc.Fce == 6))
local bSlant = ( abs( vtExtr:getX()) > BD.DRILL_VX_MAX) local bSlant = ( abs( vtExtr:getX()) > BD.DRILL_VX_MAX)
return ( bOpen and ( bHoriz or BD.ROT90 or BD.DOWN_HEAD or BD.TURN) and not bSlant) return ( bOpen and ( bHoriz or BD.ROT90 or BD.DOWN_HEAD) and not bSlant)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
@@ -157,56 +146,22 @@ function ProcessDrill.Classify( Proc, b3Raw)
return false, false, false return false, false, false
end end
local bOpen = ( Proc.Fce ~= 0) local bOpen = ( Proc.Fce ~= 0)
local bFaceDown = ( ptCen:getZ() < b3Raw:getMin():getZ() + 2 and (( not Proc.Head and not Proc.Tail) or (( BD.ROT90 or BD.DOWN_HEAD or BD.TURN) and ( Proc.Flg == 2 or Proc.Flg == -2)))) local bFaceDown = ( ptCen:getZ() < b3Raw:getMin():getZ() + 2 and (( not Proc.Head and not Proc.Tail) or (( BD.ROT90 or BD.DOWN_HEAD) and ( Proc.Flg == 2 or Proc.Flg == -2))))
-- verifico se il foro è sotto e quindi va spostato o sopra o sul fianco -- verifico se il foro è sotto e quindi va spostato o sopra o sul fianco
if (( vtExtr:getZ() < BD.DRILL_VZ_MIN or bFaceDown) and ( not bOpen or Proc.Flg ~= 1)) then if (( vtExtr:getZ() < BD.DRILL_VZ_MIN or bFaceDown) and ( not bOpen or Proc.Flg ~= 1)) then
if not bOpen then if not bOpen then
return true, true, false return true, true, false
else else
return true, not ( BD.ROT90 or BD.DOWN_HEAD or BD.TURN), ( BD.ROT90 or BD.DOWN_HEAD or BD.TURN) return true, not ( BD.ROT90 or BD.DOWN_HEAD), ( BD.ROT90 or BD.DOWN_HEAD)
end end
else else
return true, false, false return true, false, false
end end
end end
---------------------------------------------------------------------
-- Funzione per riconoscimento faccia inizio foro e dati correlati
-- Indice faccia :1=Front, 2=Bottom, 3=Back, 4=Top, 5=Left, 6=Right
local function GetHoleStartData( ptCen, vtExtr, b3Solid)
-- Facce della trave
local vFaces = { { Dist = -b3Solid:getMin():getY(), Norm = -Y_AX()},
{ Dist = -b3Solid:getMin():getZ(), Norm = -Z_AX()},
{ Dist = b3Solid:getMax():getY(), Norm = Y_AX()},
{ Dist = b3Solid:getMax():getZ(), Norm = Z_AX()},
{ Dist = -b3Solid:getMin():getX(), Norm = -X_AX()},
{ Dist = b3Solid:getMax():getX(), Norm = X_AX()}}
-- Ricerca della faccia di inizio
local nFac = 0
local dCosMin = 0.0871
for i = 1, 6 do
if ( ptCen - ORIG()) * vFaces[i].Norm - vFaces[i].Dist > -2 then
local dCos = vtExtr * vFaces[i].Norm
if dCos > dCosMin then
nFac = i
dCosMin = dCos
if dCos > 0.7072 then break end
end
end
end
-- Coseno angolo dalla faccia
local CosB = 0
if nFac ~= 0 then
CosB = sqrt( 1 - sqr( vtExtr * vFaces[nFac].Norm))
end
return nFac, CosB, vFaces
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
-- default per costanti
BD.DRILL_VX_MAX_ANGLEDRILL = ( BD.DRILL_VX_MAX_ANGLEDRILL or 0.928)
-- 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
@@ -225,34 +180,19 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
-- recupero i dati del foro -- recupero i dati del foro
local dDiam = 2 * EgtArcRadius( AuxId) local dDiam = 2 * EgtArcRadius( AuxId)
local dLen = abs( EgtCurveThickness( AuxId)) local dLen = abs( EgtCurveThickness( AuxId))
local ptCen = EgtCP( AuxId, GDB_RT.GLOB)
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
if Proc.Flg == -2 then if Proc.Flg == -2 then vtExtr = - vtExtr end
ptCen = ptCen - vtExtr * dLen
vtExtr = - vtExtr
end
local bOpen = ( Proc.Fcs ~= 0 and Proc.Fce ~= 0) local bOpen = ( Proc.Fcs ~= 0 and Proc.Fce ~= 0)
-- verifico possibilità di foratura da sotto
local bDownDrill = ( BD.DOWN_HEAD and ML.FindDrilling( dDiam, nil, false, true))
-- verifico che il foro non sia fattibile solo da sotto -- verifico che il foro non sia fattibile solo da sotto
local bToInvert = ( vtExtr:getZ() < BD.DRILL_VZ_MIN and not bDownDrill) local bToInvert = ( vtExtr:getZ() < BD.DRILL_VZ_MIN) and not BD.DOWN_HEAD
if bToInvert and ( not bOpen or Proc.Flg ~= 1) then if bToInvert and ( not bOpen or Proc.Flg ~= 1) then
local sErr = 'Error : drilling from bottom impossible' local sErr = 'Error : drilling from bottom impossible'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- se non già richiesta inversione e invertibile -- se il foro è cieco all'inizio, lo inverto
if not bToInvert and Proc.Flg == 1 and ( -vtExtr:getZ() >= BD.DRILL_VZ_MIN or bDownDrill) then if Proc.Fcs == 0 then bToInvert = true end
-- se il foro è cieco o troppo inclinato all'inizio, lo inverto if bToInvert then vtExtr = - vtExtr end
local _, CosB, _ = GetHoleStartData( ptCen, vtExtr, b3Solid)
if Proc.Fcs == 0 or ( CosB > BD.DRILL_VX_MAX and bOpen) then
bToInvert = true
end
end
if bToInvert then
ptCen = ptCen - vtExtr * dLen
vtExtr = - vtExtr
end
-- se foro è splittato ed è la parte opposta, inverto -- se foro è splittato ed è la parte opposta, inverto
if Proc.Flg == -2 then bToInvert = true end if Proc.Flg == -2 then bToInvert = true end
-- profondità geometrica del foro -- profondità geometrica del foro
@@ -265,13 +205,20 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
local dCheckDepth2 = dDepth2 local dCheckDepth2 = dDepth2
local nErrorCode = 0 local nErrorCode = 0
-- abilitazione foratura da sotto -- abilitazione foratura da sotto
local bDrillDown = ( bDownDrill and ( Proc.Down or vtExtr:getZ() < -0.1 or vtExtr:getZ() < 0.259)) local bDrillDown = ( BD.DOWN_HEAD and ( Proc.Down or vtExtr:getZ() < -0.1 or vtExtr:getZ() < 0.259))
local bDrillUp = ( bDownDrill and vtExtr:getZ() > -0.5) local bDrillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259)
-- 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) local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillDown)
if not sDrilling and bDrillUp then
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth)
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) sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillDown)
if sDrilling then dCheckDepth = nil end
end
if not sDrilling and bDrillUp and dCheckDepth then
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0)
if sDrilling then dCheckDepth = nil end if sDrilling then dCheckDepth = nil end
end end
if not sDrilling then if not sDrilling then
@@ -285,7 +232,10 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
nErrorCode = 2 nErrorCode = 2
-- rifaccio ricerca lavorazione senza specificare la profondità (dovrebbe trovare l'utensile più corto) -- rifaccio ricerca lavorazione senza specificare la profondità (dovrebbe trovare l'utensile più corto)
else else
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown) sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillDown)
if not sDrilling and bDrillUp then
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0)
end
if not sDrilling then if not sDrilling then
nErrorCode = 1 nErrorCode = 1
elseif dMaxToolLength > ( BD.MAX_TOOL_LEN_FOR_HOR_MACH or 300) and abs( vtExtr:getZ()) < ( BD.DRILL_VZ_MIN_LONG_TOOL or cos(10)) then elseif dMaxToolLength > ( BD.MAX_TOOL_LEN_FOR_HOR_MACH or 300) and abs( vtExtr:getZ()) < ( BD.DRILL_VZ_MIN_LONG_TOOL or cos(10)) then
@@ -297,9 +247,16 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
-- recupero la lavorazione -- recupero la lavorazione
local sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 local sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2
if dDepth2 > dDepth + BD.DRILL_OVERLAP then if dDepth2 > dDepth + BD.DRILL_OVERLAP then
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, dCheckDepth2, bDrillUp, bDrillDown) sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, dCheckDepth2, bDrillDown)
if not sDrilling2 and bDrillUp then
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, dCheckDepth2)
end
if not sDrilling2 and dCheckDepth2 then if not sDrilling2 and dCheckDepth2 then
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown) sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0, bDrillDown)
if sDrilling2 then dCheckDepth2 = nil end
end
if not sDrilling2 and bDrillUp and dCheckDepth2 then
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0)
if sDrilling2 then dCheckDepth2 = nil end if sDrilling2 then dCheckDepth2 = nil end
end end
if not sDrilling2 then if not sDrilling2 then
@@ -313,7 +270,10 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
nErrorCode = 2 nErrorCode = 2
-- rifaccio ricerca lavorazione senza specificare la profondità (dovrebbe trovare l'utensile più corto) -- rifaccio ricerca lavorazione senza specificare la profondità (dovrebbe trovare l'utensile più corto)
else else
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown) sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0, bDrillDown)
if not sDrilling2 and bDrillUp then
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0)
end
if not sDrilling2 then if not sDrilling2 then
nErrorCode = 1 nErrorCode = 1
elseif dMaxToolLength2 > ( BD.MAX_TOOL_LEN_FOR_HOR_MACH or 300) and abs( vtExtr:getZ()) < ( BD.DRILL_VZ_MIN_LONG_TOOL or cos(10)) then elseif dMaxToolLength2 > ( BD.MAX_TOOL_LEN_FOR_HOR_MACH or 300) and abs( vtExtr:getZ()) < ( BD.DRILL_VZ_MIN_LONG_TOOL or cos(10)) then
@@ -328,7 +288,6 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
local bCommonCompare = BD.MAX_TOOL_LEN_BACK_HOR_MACH and bOpen and abs(vtExtr:getX()) < 0.5 and abs(vtExtr:getZ()) < 0.5 local bCommonCompare = BD.MAX_TOOL_LEN_BACK_HOR_MACH and bOpen and abs(vtExtr:getX()) < 0.5 and abs(vtExtr:getZ()) < 0.5
if nErrorCode == 0 and not bToInvert and bCommonCompare and vtExtr:getY() > 0.866 and Proc.Flg == 1 and dMaxToolLength > BD.MAX_TOOL_LEN_BACK_HOR_MACH then if nErrorCode == 0 and not bToInvert and bCommonCompare and vtExtr:getY() > 0.866 and Proc.Flg == 1 and dMaxToolLength > BD.MAX_TOOL_LEN_BACK_HOR_MACH then
bToInvert = true bToInvert = true
ptCen = ptCen - vtExtr * dLen
vtExtr = - vtExtr vtExtr = - vtExtr
--------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -347,9 +306,8 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
dToolFreeLen = dToolFreeLen2 dToolFreeLen = dToolFreeLen2
dDepth = dDepth2 dDepth = dDepth2
if vtExtr:getY() > 0 then if vtExtr:getY() > 0 then
bToInvert = true bToInvert = true
ptCen = ptCen - vtExtr * dLen vtExtr = - vtExtr
vtExtr = - vtExtr
end end
-- se sono al secondo mezzo foro con utensile che supera la lunghezza di riferimento non lo eseguo -- se sono al secondo mezzo foro con utensile che supera la lunghezza di riferimento non lo eseguo
elseif nErrorCode == 0 and bCommonCompare and abs(vtExtr:getY()) > 0.866 and Proc.Flg == -2 and dMaxToolLength2 > BD.MAX_TOOL_LEN_BACK_HOR_MACH then elseif nErrorCode == 0 and bCommonCompare and abs(vtExtr:getY()) > 0.866 and Proc.Flg == -2 and dMaxToolLength2 > BD.MAX_TOOL_LEN_BACK_HOR_MACH then
@@ -364,64 +322,52 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- Determino la faccia di inizio del foro e dati correlati local dSubL1 = 0
local nFac, CosB, vFaces = GetHoleStartData( ptCen, vtExtr, b3Solid) local dSubL2 = 0
-- Calcolo acciorciamento affondamento utile per evitare collisione portautensile con faccia local dSubL3 = 0
local TgA = CosB / sqrt( 1 - CosB * CosB) local dDeltaRad = ( Proc.Diam - dToolDiam) / 2
local dSubL = ( dDiamTh / 2 + ( Proc.Diam - dToolDiam) / 2 + 2) * TgA -- se foro non su testa o coda e inclinato, limito il massimo affondamento
local dMaxDepthOri = dMaxDepth local bInMid = false
dMaxDepth = min( dMaxDepth, dToolFreeLen - dSubL) local bInvertFcse = ( bToInvert and Proc.Flg ~= -2)
-- Verifico inclinazione foro nei limiti if ( not bInvertFcse and Proc.Fcs ~= 5 and Proc.Fcs ~= 6) or ( bInvertFcse and Proc.Fce ~= 5 and Proc.Fce ~= 6) then
local bTryDrill = ( CosB < BD.DRILL_VX_MAX) bInMid = true
if ( CosB > 0.8 * BD.DRILL_VX_MAX and CosB < BD.DRILL_VX_MAX_ANGLEDRILL) then local CosB = abs( vtExtr:getX())
-- cerco le forature speciali AngleDrill if CosB < BD.DRILL_VX_MAX then
local sDrilling3, sType3, dMaxDepth3 = ML.FindAngleDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown) local TgA = CosB / sqrt( 1 - CosB * CosB)
if sDrilling3 then dSubL1 = ( dDiamTh / 2 + dDeltaRad + 2) * TgA
sDrilling = sDrilling3 else
sType = sType3 dMaxDepth = 0
dMaxDepth = dMaxDepth3
bTryDrill = true
end end
end end
-- aggiusto affondamento e MaxElev -- se foro davanti o dietro e inclinato, limito il massimo affondamento
local dMaxElev if dMaxDepth > 0 and abs( vtExtr:getY()) > abs( vtExtr:getZ()) then
local sMyWarn local CosB = abs( vtExtr:getZ())
-- se c'è un taglio precedente di testa o coda in cui il foro "entra" devo ricalcolare i dati della foratura if bInMid then
if (( Proc.MachineAfterHeadCutId and vtExtr:getX() > 0) or ( Proc.MachineAfterTailCutId and vtExtr:getX() < 0)) then CosB = sqrt( vtExtr:getZ() * vtExtr:getZ() + vtExtr:getX() * vtExtr:getX())
local bIntersectionOk, _, vDistance = EgtLineSurfTmInters( ptCen, -vtExtr, Proc.MachineAfterHeadCutId or Proc.MachineAfterTailCutId, GDB_RT.GLOB) end
if bIntersectionOk then if CosB < BD.DRILL_VX_MAX then
local dHoleToCutDistance = vDistance[1] local TgA = CosB / sqrt( 1 - CosB * CosB)
-- se il taglio accorcia realmente il foro dSubL2 = ( dDiamTh / 2 + dDeltaRad + 2) * TgA
if dHoleToCutDistance > 10 * GEO.EPS_SMALL and dHoleToCutDistance < dLen then else
dMaxDepth = dMaxDepthOri dMaxDepth = 0
dMaxElev = dLen - dHoleToCutDistance
bTryDrill = true
local dToolAddLength = dLen - dMaxElev
-- se l'utensile è comunque troppo corto lavoro il massimo possibile
if dDepth - dToolAddLength > dMaxDepth + 10 * GEO.EPS_SMALL then
sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth - dToolAddLength, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
dDepth = dLen
else
-- se è un foro splittato cerco comunque di arrivare alla massima profondità possibile, evitando di sfondare dall'altro lato.
if Proc.Flg == 2 or Proc.Flg == -2 then
dDepth = dLen - 10
end
-- se non lavoro la massima lunghezza disponibile devo correggere MaxElev
dMaxElev = dMaxElev - dLen + dDepth
end
end
end end
end end
-- se foro da saltare per eccessiva inclinazione -- se foro sopra o sotto e inclinato, limito il massimo affondamento
if not bTryDrill then if dMaxDepth > 0 and abs( vtExtr:getZ()) > abs( vtExtr:getY()) then
sMyWarn = 'Warning in drill : too slant hole' local CosB = abs( vtExtr:getY())
dDepth = 0 if bInMid then
return true, sMyWarn CosB = sqrt( vtExtr:getY() * vtExtr:getY() + vtExtr:getX() * vtExtr:getX())
-- se non ridotto e affondamento richiesto supera il consentito end
elseif not dMaxElev and dDepth > dMaxDepth + 10 * GEO.EPS_SMALL then if CosB < BD.DRILL_VX_MAX then
sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')' local TgA = CosB / sqrt( 1 - CosB * CosB)
dDepth = dMaxDepth dSubL3 = ( dDiamTh / 2 + dDeltaRad + 2) * TgA
dMaxElev = dMaxDepth else
dMaxDepth = 0
end
end
local dSubL = max( dSubL1, dSubL2, dSubL3)
if dMaxDepth > 0 then
dMaxDepth = min( dMaxDepth, dToolFreeLen - dSubL)
end end
-- inserisco la lavorazione -- inserisco la lavorazione
local sName = 'Drill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local sName = 'Drill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
@@ -434,14 +380,14 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}}) EgtSetMachiningGeometry( {{ AuxId, -1}})
-- eventuale inversione -- eventuale inversione
if sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill' then if sType == 'Drill' or sType == 'Drill_H2' 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 = MCH_SCC.NONE local nSCC = MCH_SCC.NONE
if not BD.C_SIMM and not BD.TURN then if not BD.C_SIMM then
nSCC = MCH_SCC.ADIR_YM nSCC = MCH_SCC.ADIR_YM
if AreSameVectorApprox( vtExtr, Z_AX()) then if AreSameVectorApprox( vtExtr, Z_AX()) then
nSCC = MCH_SCC.ADIR_YM nSCC = MCH_SCC.ADIR_YM
@@ -456,21 +402,20 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
nSCC = MCH_SCC.NONE nSCC = MCH_SCC.NONE
end end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- imposto affondamento -- aggiusto l'affondamento
local sMyWarn
if dDepth > dMaxDepth + 10 * GEO.EPS_SMALL then
sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
dDepth = dMaxDepth
EgtOutLog( sMyWarn)
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.
local dToolDbStartPos = EgtGetMachiningParam( MCH_MP.STARTPOS)
local dMinStartPos = 10
local dStartPos = max( dMinStartPos, dToolDbStartPos)
EgtSetMachiningParam( MCH_MP.STARTPOS, dStartPos)
-- Note utente con dichiarazione nessuna generazione sfridi per Vmill -- Note utente con dichiarazione nessuna generazione sfridi per Vmill
local sUserNotes = 'VMRS=0;' local sUserNotes = 'VMRS=0;'
-- aggiungo alle note massima elevazione (coincide con affondamento) -- aggiungo alle note massima elevazione (coincide con affondamento)
if dMaxElev then sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( dDepth, 1) .. ';'
sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( dMaxElev, 1) .. ';'
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') and bOpen then
sUserNotes = sUserNotes .. 'Open=1;' sUserNotes = sUserNotes .. 'Open=1;'
end end
-- se lavorazione in doppio -- se lavorazione in doppio
@@ -481,14 +426,14 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
end end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
local bOk = ML.ApplyMachining( true, false) local bOk = EgtApplyMachining( true, false)
if not bOk and bDownDrill then if not bOk and BD.DOWN_HEAD then
if sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill' then if sType == 'Drill' or sType == 'Drill_H2' 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 = EgtApplyMachining( true, false)
end end
if not bOk then if not bOk then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
+22 -80
View File
@@ -1,12 +1,10 @@
-- ProcessDtMortise.lua by Egaltech s.r.l. 2022/08/18 -- ProcessDtMortise.lua by Egaltech s.r.l. 2021/12/01
-- Gestione calcolo mortase a coda di rondine per Travi -- Gestione calcolo mortase a coda di rondine per Travi
-- 2021/04/08 Aggiunto controllo massimo materiale lavorabile dalla fresa. -- 2021/04/08 Aggiunto controllo massimo materiale lavorabile dalla fresa.
-- 2021/04/08 Miglioria scelta lavorazione in presenza di testa da sotto. -- 2021/04/08 Miglioria scelta lavorazione in presenza di testa da sotto.
-- 2021/06/28 Aggiunta gestione attacco e uscita con pocket. -- 2021/06/28 Aggiunta gestione attacco e uscita con pocket.
-- 2021/07/20 Aggiunta gestione rinvio angolare su FAST. -- 2021/07/20 Aggiunta gestione rinvio angolare su FAST.
-- 2021/12/01 Se frontale aggiungo taglio con Grp e Proc di vero taglio (per aggiornare ingombro di testa /coda). -- 2021/12/01 Se frontale aggiungo taglio con Grp e Proc di vero taglio (per aggiornare ingombro di testa /coda).
-- 2022/06/01 Modifiche per evitare di entrare nel legno con mortase parziali.
-- 2022/08/18 Migliorato calcolo dello step.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessDtMortise = {} local ProcessDtMortise = {}
@@ -61,10 +59,6 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Classificazione della feature -- Classificazione della feature
function ProcessDtMortise.Classify( Proc) function ProcessDtMortise.Classify( Proc)
-- se PF con testa da sotto o TURN, ammessa qualunque orientazione
if ( BD.C_SIMM and BD.DOWN_HEAD) or BD.TURN then
return true
end
-- recupero i dati della curva di contorno della faccia di fondo -- recupero i dati della curva di contorno della faccia di fondo
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if not AuxId then return false end if not AuxId then return false end
@@ -97,9 +91,8 @@ local function CalcTopPath( nProcId, AuxId, nAddGrpId, dAltMort, dSideAng, b3Sol
local NewAuxId = EgtCopyGlob( AuxId, nAddGrpId) local NewAuxId = EgtCopyGlob( AuxId, nAddGrpId)
if not NewAuxId then return end if not NewAuxId then return end
-- ne allungo gli estremi -- ne allungo gli estremi
EgtAddCurveCompoLineTg( NewAuxId, 100, false) EgtExtendCurveStartByLen( NewAuxId, 100)
EgtAddCurveCompoLineTg( NewAuxId, 100, true) EgtExtendCurveEndByLen( NewAuxId, 100)
EgtMergeCurvesInCurveCompo( NewAuxId)
-- eseguo traslazione e offset per portarla sul top -- eseguo traslazione e offset per portarla sul top
local vtMove = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) * ( dAltMort - 10 * GEO.EPS_SMALL) local vtMove = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) * ( dAltMort - 10 * GEO.EPS_SMALL)
EgtMove( NewAuxId, vtMove, GDB_RT.GLOB) EgtMove( NewAuxId, vtMove, GDB_RT.GLOB)
@@ -125,21 +118,6 @@ local function CalcTopPath( nProcId, AuxId, nAddGrpId, dAltMort, dSideAng, b3Sol
return NewAuxId return NewAuxId
end end
---------------------------------------------------------------------
-- verifica che il box includa il punto in XY
function EnclosesPoint( b3Box, ptP)
if b3Box[2][1] < ptP[1] - GEO.EPS_SMALL or b3Box[1][1] > ptP[1] + GEO.EPS_SMALL then
return false
end
if b3Box[2][2] < ptP[2] - GEO.EPS_SMALL or b3Box[1][2] > ptP[2] + GEO.EPS_SMALL then
return false
end
if b3Box[2][3] < ptP[3] - GEO.EPS_SMALL or b3Box[1][3] > ptP[3] + GEO.EPS_SMALL then
return false
end
return true
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
@@ -163,18 +141,15 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local ptBC = EgtGP( AuxId, GDB_RT.GLOB) local ptBC = EgtGP( AuxId, GDB_RT.GLOB)
-- verifico che la mortasa non sia orientata verso il basso (-5 deg) o che ci sia una testa da sotto o un rinvio angolare -- verifico che la mortasa non sia orientata verso il basso (-5 deg) o che ci sia una testa da sotto o un rinvio angolare
local bFaceDown = ( vtExtr:getZ() < -0.1) local bFaceDown = ( vtExtr:getZ() < -0.1)
if bFaceDown and not BD.DOWN_HEAD and not BD.TURN and not BD.ANG_TRASM then if bFaceDown and not BD.DOWN_HEAD and not BD.ANG_TRASM then
local sErr = 'Machining from bottom impossible : Error on DtMortise ' .. tostring( Proc.Id) local sErr = 'Machining from bottom impossible : Error on DtMortise ' .. tostring( Proc.Id)
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- determino l'altezza della mortasa (0=faccia di fondo) -- determino l'altezza della mortasa (0=faccia di fondo)
local rfDtMrt, dLenMrt, dWidthMrt = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0, GDB_RT.GLOB) local rfDtMrt = Frame3d( ptBC, vtExtr)
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()
-- ne determino l'asse (valido se non pocket)
local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB)
vtAx:normalize()
-- verifico se di tipo pocket -- verifico se di tipo pocket
local bPocket = ( EgtGetInfo( Proc.Id, 'P05', 'i') == 1) local bPocket = ( EgtGetInfo( Proc.Id, 'P05', 'i') == 1)
if bPocket then bMakeAntiSplitPath = false end if bPocket then bMakeAntiSplitPath = false end
@@ -226,9 +201,9 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
sMchExt = '_AT' sMchExt = '_AT'
end end
-- recupero la lavorazione : prima ricerca per sola tipologia -- recupero la lavorazione : prima ricerca per sola tipologia
local sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, nil, nil, bMillUp, bMillDown) local sMilling = ML.FindMilling( sMillType..sMchExt)
if not sMilling and bMillUp then if not sMilling and bMillUp then
sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown) sMilling = ML.FindMilling( sMillType)
end end
if not sMilling then if not sMilling then
local sErr = 'Milling not found in library : Error on DtMortise ' .. tostring( Proc.Id) local sErr = 'Milling not found in library : Error on DtMortise ' .. tostring( Proc.Id)
@@ -236,9 +211,9 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
return false, sErr return false, sErr
end end
-- recupero la lavorazione : seconda ricerca con tipologia e diametro massimo -- recupero la lavorazione : seconda ricerca con tipologia e diametro massimo
sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown) sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, 2 * dMinRad)
if not sMilling and bMillUp then if not sMilling and bMillUp then
sMilling = ML.FindMilling( sMillType, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown) sMilling = ML.FindMilling( sMillType, nil, nil, 2 * dMinRad)
sMchExt = '' sMchExt = ''
end end
if not sMilling then if not sMilling then
@@ -285,14 +260,14 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
-- recupero la lavorazione -- recupero la lavorazione
local sPocketing local sPocketing
sPocketing = ML.FindPocketing( 'Mortise'..sMchExt, dToolDiam, nil, nil, bMillUp, bMillDown) sPocketing = ML.FindPocketing( 'Mortise'..sMchExt, dToolDiam)
if not sPocketing and bMillUp then if not sPocketing and bMillUp then
sPocketing = ML.FindPocketing( 'Mortise', dToolDiam, nil, nil, bMillUp, bMillDown) sPocketing = ML.FindPocketing( 'Mortise', dToolDiam)
end end
if not sPocketing then if not sPocketing then
sPocketing = ML.FindPocketing( 'Pocket'..sMchExt, dToolDiam, nil, nil, bMillUp, bMillDown) sPocketing = ML.FindPocketing( 'Pocket'..sMchExt, dToolDiam)
if not sPocketing and bMillUp then if not sPocketing and bMillUp then
sPocketing = ML.FindPocketing( 'Pocket', dToolDiam, nil, nil, bMillUp, bMillDown) sPocketing = ML.FindPocketing( 'Pocket', dToolDiam)
end end
end end
if not sPocketing then if not sPocketing then
@@ -314,27 +289,18 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;' local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
end end
end end
-- eventuale calcolo SCC
local nSCC
if BD.TURN and not bPocket 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
end
-- se parametro interno abilitato e il percorso non è chiuso, aggiungo percorso e lavorazione antischeggia -- se parametro interno abilitato e il percorso non è chiuso, aggiungo percorso e lavorazione antischeggia
if bMakeAntiSplitPath and not EgtCurveIsClosed( AuxId) then if bMakeAntiSplitPath and not EgtCurveIsClosed( AuxId) 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
local sErr = 'Error : missing AddGroup' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -379,7 +345,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
nId1 = EgtArc2PV( nAddGrpId, ptStart, ptEnd, vtTg, GDB_RT.GLOB) nId1 = EgtArc2PV( nAddGrpId, ptStart, ptEnd, vtTg, GDB_RT.GLOB)
end end
if not nId1 then if not nId1 then
local sErr = 'Wrong geometry : Error on DtMortise ' local sErr = 'Wrong geometry : Error on DtMortise ' .. tostring( Proc.Id)
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -401,15 +367,11 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- 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))
-- se necessario, imposto SCC
if nSCC then
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
end
-- dichiaro non si generano sfridi per VMill -- dichiaro non si generano sfridi per VMill
local sUserNotes = 'MaxElev='.. EgtNumToString( dAltMort, 1) .. '; VMRS=0;' local sUserNotes = 'MaxElev='.. EgtNumToString( dAltMort, 1) .. '; VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -427,12 +389,13 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
-- verifico se necessarie più passate (distanza all'imbocco ortogonale all'asse) -- verifico se necessarie più passate (distanza all'imbocco ortogonale all'asse)
local vtDiff = EgtEP( AuxId, GDB_RT.GLOB) - EgtSP( AuxId, GDB_RT.GLOB) local vtDiff = EgtEP( AuxId, GDB_RT.GLOB) - EgtSP( AuxId, GDB_RT.GLOB)
local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB)
vtAx:normalize()
local vtOrtDiff = vtDiff - vtDiff * vtAx * vtAx local vtOrtDiff = vtDiff - vtDiff * vtAx * vtAx
local dDist = min( vtOrtDiff:len(), dWidthMrt) local dDist = vtOrtDiff:len()
-- calcolo le passate -- calcolo le passate
local nPass = ceil( dDist / ( 1.9 * dToolDiam)) local nPass = ceil( dDist / ( 1.9 * dToolDiam))
local dStep = 0 local dStep = ( dDist - 0.95 * dToolDiam) / ( 2 * nPass)
if nPass > 1 then dStep = max( ( dDist - 2 * dToolDiam) / ( 2 * nPass - 2), 0.25 * dToolDiam) 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)
@@ -460,33 +423,12 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.LITANG, dToolDiam / 2) EgtSetMachiningParam( MCH_MP.LITANG, dToolDiam / 2)
EgtSetMachiningParam( MCH_MP.LIPERP, 5) EgtSetMachiningParam( MCH_MP.LIPERP, 5)
EgtSetMachiningParam( MCH_MP.LIELEV, 0) EgtSetMachiningParam( MCH_MP.LIELEV, 0)
-- altrimenti verifico se sono bilanciati ingresso e uscita, per evitare inizio o fine nel legno
else
local ptS = EgtSP( AuxId, GDB_ID.ROOT)
local ptE = EgtEP( AuxId, GDB_ID.ROOT)
local dDistS = abs( ( ptS - rfDtMrt:getOrigin()) * rfDtMrt:getVersX())
local dDistE = abs( ( ptE - rfDtMrt:getOrigin()) * rfDtMrt:getVersX())
local dIni, dFin = EgtCurveDomain( AuxId)
local nCrvCnt = dFin - dIni - 1
if abs( dDistS - dDistE) > 20 then
local b3Test = BBox3d( b3Solid)
b3Test:expand( -5)
if dDistS < dDistE and EnclosesPoint( b3Test, ptS) and EgtCurveCompoAngCenter( AuxId, 0) == 0 then
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dDistE - dDistS)
elseif dDistE < dDistS and EnclosesPoint( b3Test, ptE) and EgtCurveCompoAngCenter( AuxId, nCrvCnt) == 0 then
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dDistS - dDistE)
end
end
end
-- se necessario, imposto SCC
if nSCC then
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
end end
-- dichiaro non si generano sfridi per VMill -- dichiaro non si generano sfridi per VMill
local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;' local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
+18 -34
View File
@@ -1,7 +1,6 @@
-- ProcessTenon.lua by Egaltech s.r.l. 2022/06/07 -- ProcessTenon.lua by Egaltech s.r.l. 2021/12/22
-- Gestione calcolo tenone a coda di rondine per Travi -- Gestione calcolo tenone a coda di rondine per Travi
-- 2021/04/08 Aggiunto controllo massimo materiale lavorabile dalla fresa. -- 2021/04/08 Aggiunto controllo massimo materiale lavorabile dalla fresa.
-- 2022/04/14 Aumentati un poco i limiti di orientamento verso il basso per FAST e PF.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessDtTenon = {} local ProcessDtTenon = {}
@@ -20,41 +19,32 @@ local ML = require( 'MachiningLib')
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function VerifyOrientation( Proc, vtN, b3Raw) local function VerifyOrientation( Proc, vtN, b3Raw)
-- se PF con testa da sotto o TURN, ammessa qualunque orientazione -- se PF con testa da sotto, ammessa qualunque orientazione
if ( BD.C_SIMM and BD.DOWN_HEAD) or BD.TURN then if BD.C_SIMM and BD.DOWN_HEAD then
return true return true
end end
-- se trave molto bassa -- se trave molto bassa
if b3Raw:getDimZ() < 121 then if b3Raw:getDimZ() <= 120 then
-- se tenone praticamente in asse, accetto fino a -45 deg -- se tenone praticamente in asse, accetto fino a -45 deg
if abs( vtN:getY()) < 0.088 then if abs( vtN:getY()) < 0.04 then
return ( vtN:getZ() >= -0.7072) return ( vtN:getZ() >= -0.7072)
-- altrimenti accetto fino a -30deg -- altrimenti accetto fino a -30deg
else else
return ( vtN:getZ() >= -0.51) return ( vtN:getZ() >= -0.51)
end end
-- se trave bassa -- se trave bassa
elseif b3Raw:getDimZ() < 201 then elseif b3Raw:getDimZ() <= 200 then
-- se tenone praticamente in asse, accetto fino a -30 deg -- se tenone praticamente in asse, accetto fino a -30 deg
if abs( vtN:getY()) < 0.088 then if abs( vtN:getY()) < 0.04 then
return ( vtN:getZ() >= -0.51) return ( vtN:getZ() >= -0.51)
-- altrimenti accetto fino a -21deg -- altrimenti accetto fino a -20deg
else else
return ( vtN:getZ() >= -0.359) return ( vtN:getZ() >= -0.343)
end
-- se trave medio-bassa
elseif b3Raw:getDimZ() < 281 then
-- se tenone praticamente in asse, accetto fino a -25 deg
if abs( vtN:getY()) < 0.088 then
return ( vtN:getZ() >= -0.422)
-- altrimenti, accetto fino a -15 deg
else
return ( vtN:getZ() >= -0.259)
end end
-- se trave media -- se trave media
elseif b3Raw:getDimZ() < 351 then elseif b3Raw:getDimZ() <= 350 then
-- 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.04 then
return ( vtN:getZ() >= -0.375) return ( vtN:getZ() >= -0.375)
-- altrimenti, accetto fino a -10 deg -- altrimenti, accetto fino a -10 deg
else else
@@ -112,7 +102,7 @@ local function ApplyPocket( Proc, sPocketing, nStep, dSurfStep, nIdSurf, vtExtr)
end end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -160,9 +150,6 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3) EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3)
-- porto inizio curva a Zmax -- porto inizio curva a Zmax
BL.PutStartOnTop( AuxId) BL.PutStartOnTop( AuxId)
-- ne determino l'asse
local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB)
vtAx:normalize()
-- se tenone inclinato o non esattamente alle estremità, necessario taglio di lama sulla testa -- se tenone inclinato o non esattamente alle estremità, necessario taglio di lama sulla testa
if not AreSameOrOppositeVectorApprox( vtN, X_AX()) or if not AreSameOrOppositeVectorApprox( vtN, X_AX()) or
( Proc.Box:getMax():getX() < b3Raw:getMax():getX() - dOvmHead - 100 * GEO.EPS_SMALL and ( Proc.Box:getMax():getX() < b3Raw:getMax():getX() - dOvmHead - 100 * GEO.EPS_SMALL and
@@ -235,7 +222,10 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174) local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174)
-- recupero la lavorazione -- recupero la lavorazione
local sMillType = 'DtTenon' local sMillType = 'DtTenon'
local sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', ''), nil, nil, nil, nil, bMillUp, bMillDown) local sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', ''))
if not sMilling and bMillUp then
sMilling = ML.FindMilling( sMillType)
end
if not sMilling then if not sMilling then
local sErr = 'Error : milling not found in library' local sErr = 'Error : milling not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -305,13 +295,7 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false)) EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false))
-- imposto posizione braccio porta testa -- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE local nSCC = MCH_SCC.NONE
if BD.TURN then if not BD.C_SIMM 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 nSCC = MCH_SCC.ADIR_YM
if abs( vtExtr:getY()) > 0.088 then if abs( vtExtr:getY()) > 0.088 then
nSCC = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP) nSCC = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
@@ -319,7 +303,7 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchRId, false) EgtSetOperationMode( nMchRId, false)
return false, sErr return false, sErr
+9 -90
View File
@@ -1,6 +1,5 @@
-- ProcessFreeContour.lua by Egaltech s.r.l. 2021/10/07 -- ProcessFreeContour.lua by Egaltech s.r.l. 2021/10/07
-- Gestione calcolo profilo libero per Travi -- Gestione calcolo profilo libero per Travi
-- 2022/08/23 Aggiunta la funzione MakeByMark per la gestione del caso P13=10
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessFreeContour = {} local ProcessFreeContour = {}
@@ -234,16 +233,14 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
local dDepth = abs( EgtCurveThickness( AuxId)) local dDepth = abs( EgtCurveThickness( AuxId))
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
local b3Aux = EgtGetBBoxGlob( AuxId, GDB_BB.STANDARD) local b3Aux = EgtGetBBoxGlob( AuxId, GDB_BB.STANDARD)
local bToolInv = ( vtExtr:getZ() < -0.1 and b3Aux:getDimZ() > b3Raw:getDimZ() - 5) local bToolInv = ( vtExtr:getZ() < -0.1)
local bDown = ( b3Aux:getMin():getZ() < b3Raw:getMin():getZ() + 5) local bDown = ( b3Aux:getMin():getZ() < b3Raw:getMin():getZ() + 5)
-- 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) 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 sMilling = ML.FindMilling( 'FreeContour')
local bDownHead = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1)
local sMilling = ML.FindMilling( 'FreeContour', nil, nil, nil, nil, bTopHead, bDownHead)
if not sMilling then if not sMilling then
local sErr = 'Error : FreeContour not found in library' local sErr = 'Error : FreeContour not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -421,7 +418,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -482,7 +479,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -584,7 +581,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetMachiningParam( MCH_MP.OFFSR, dDepthCham) EgtSetMachiningParam( MCH_MP.OFFSR, dDepthCham)
end end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -603,7 +600,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, 0) EgtSetMachiningParam( MCH_MP.STEP, 0)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false) EgtSetOperationMode( nMch2Id, false)
return false, sErr return false, sErr
@@ -683,79 +680,9 @@ local function MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- imposto elevazione -- imposto elevazione
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxDepth, 1) .. ';') EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxDepth, 1) .. ';')
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
return true
end
---------------------------------------------------------------------
local function MakeByMark( Proc, nRawId, b3Raw, nPartId)
-- ingombro del pezzo
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then
local sErr = 'Error : part box not found'
EgtOutLog( sErr)
return false, sErr
end
-- recupero e verifico l'entità curva
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
if AuxId then AuxId = AuxId + Proc.Id end
if not AuxId or ( EgtGetType( AuxId) & GDB_FY.GEO_CURVE) == 0 then
local sErr = 'Error : missing profile geometry'
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati della curva e del profilo
local dDepth = abs( EgtCurveThickness( AuxId))
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
local bToolInv = ( vtExtr:getZ() < -0.1 and b3Aux:getDimZ() > b3Raw:getDimZ() - 5)
-- verifico che la marcatura non sia orientata verso il basso (-5 deg)
if vtExtr:getZ() < - 0.1 and not BD.DOWN_HEAD and not BD.TURN then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Mark from bottom impossible'
EgtOutLog( sErr)
return false, sErr
end
-- abilitazione lavorazione da sotto
local bMillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259)
local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174)
-- recupero la lavorazione
local sMillType = 'Text'
--local sMchExt = EgtIf( bMillDown, '_H2', '')
local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown)
if not sMilling then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- inserisco la lavorazione
local sName = 'FreeMark_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
EgtSetInfo( nMchId, 'Part', Proc.PartId)
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- se estrusione da sotto, inverto direzione fresa
if bToolInv then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
end
-- posizione braccio porta testa
local nSCC = MCH_SCC.ADIR_ZP
if AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then
nSCC = EgtIf( Proc.Box:getDimX() >= Proc.Box:getDimY(), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_XP)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
end end
return true return true
@@ -771,15 +698,7 @@ function ProcessFreeContour.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
return MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead) return MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- altrimenti contornatura -- altrimenti contornatura
else else
-- recupero il tipo di lavorazione return MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
local nCntType = EgtGetInfo( Proc.Id, 'CNT_TYPE', 'i') or 0
-- se marcatura
if nCntType == 10 then
return MakeByMark( Proc, nRawId, b3Raw, nPartId)
-- se fresatura
else
return MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
end end
end end
+13 -15
View File
@@ -1,6 +1,5 @@
-- ProcessFrenchRidgeLap.lua by Egaltech s.r.l. 2020/02/11 -- ProcessFrenchRidgeLap.lua by Egaltech s.r.l. 2020/02/11
-- Gestione calcolo giunzione francese -- Gestione calcolo giunzione francese
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessFrenchRidgeLap = {} local ProcessFrenchRidgeLap = {}
@@ -39,9 +38,7 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessFrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail) function ProcessFrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- sovramateriale di coda
dOvmTail = dOvmTail or BD.OVM_MID
-- 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
@@ -120,24 +117,25 @@ function ProcessFrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dO
local dFinalExtraTrim = 0.1 local dFinalExtraTrim = 0.1
local dMiddleExtraTrim = 0.3 local dMiddleExtraTrim = 0.3
local dNullExtraTrim = 0 local dNullExtraTrim = 0
-- 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
-- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti -- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
local vCuts = {} local vCuts = {}
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]]) vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
elseif vFaceOrd[3] ~= 0 then elseif vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true) vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
end end
if #vCuts > 0 then if #vCuts > 0 then
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- sistemo posizione nel DB e nome -- sistemo posizione nel DB e nome
for i = 1, #vCuts do for i = 1, #vCuts do
for j = 1, #vCuts[i] do for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end end
@@ -194,7 +192,7 @@ function ProcessFrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dO
bCut = false bCut = false
end end
-- se di coda e coincide con taglio di separazione, non va fatto -- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
bCut = false bCut = false
end end
-- se va fatto, inserisco la lavorazione -- se va fatto, inserisco la lavorazione
@@ -214,7 +212,7 @@ function ProcessFrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dO
bCut = false bCut = false
end end
-- se di coda e coincide con taglio di separazione, non va fatto -- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
bCut = false bCut = false
end end
-- se va fatto, inserisco la lavorazione -- se va fatto, inserisco la lavorazione
+22 -57
View File
@@ -1,8 +1,5 @@
-- ProcessSplit.lua by Egaltech s.r.l. 2022/08/18 -- ProcessSplit.lua by Egaltech s.r.l. 2022/01/25
-- Gestione calcolo tagli di testa per Travi -- Gestione calcolo tagli di testa per Travi
-- 2022/05/31 Aggiunta gestione sezioni alte e larghe con taglio di tipo diceCut.
-- 2022/06/10 Per sezioni alte e larghe aggiunta gestione finitura in base a sovramateriale e a parametro Q05 dell' eventuale lavorazione sostituita.
-- 2022/08/18 Aggiunta gestione macchine con testa da sotto con lama da sotto disabilitata.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessHeadCut = {} local ProcessHeadCut = {}
@@ -11,8 +8,6 @@ local ProcessHeadCut = {}
require( 'EgtBase') require( 'EgtBase')
local BL = require( 'BeamLib') local BL = require( 'BeamLib')
local Fbs = require( 'FacesBySaw') local Fbs = require( 'FacesBySaw')
local Cut = require( 'ProcessCut')
local Pocket = require( 'FaceByPocket')
EgtOutLog( ' ProcessHeadCut started', 1) EgtOutLog( ' ProcessHeadCut started', 1)
@@ -114,7 +109,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
-- 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
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -137,7 +132,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro -- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -174,25 +169,11 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
end end
end end
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0) local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
-- recupero la eventuale lavorazione con lama da sotto
local sCutting2 = ML.FindCutting( 'HeadSide_H2', false, true)
-- recupero i dati della eventuale seconda lama
local dSawDiam2 = 0
local dMaxDepth2 = 0
if sCutting2 and EgtMdbSetCurrMachining( sCutting2) then
local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2
dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
end
end
-- 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 bHorizCut = ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA)
local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, BD.MAX_DIM_HTCUT_HBEAM)
( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dMaxDepth2) - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) local bDoubleHorizCut = ( BD.DOWN_HEAD and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bHorizCut = ( not bBigSectionCut and ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA) local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bBigSectionCut and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bDoubleCut = ( not bBigSectionCut and not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 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)
-- se non obbligatorio e coincide con inizio grezzo, non va fatto -- se non obbligatorio e coincide con inizio grezzo, non va fatto
@@ -202,33 +183,8 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
-- determino se più tagli con offset -- determino se più tagli con offset
local nCuts = max( ceil( dOvmHead / ( BD.MAX_LEN_SCRAP_START or BD.MAX_LEN_SCRAP)), 1) local nCuts = max( ceil( dOvmHead / ( BD.MAX_LEN_SCRAP_START or BD.MAX_LEN_SCRAP)), 1)
local dOffsL = dOvmHead / nCuts local dOffsL = dOvmHead / nCuts
-- se taglio per sezioni alte e larghe
if bBigSectionCut then
if dOvmHead > 0 then
-- se finitura con lama
if not nOriId or EgtGetInfo( nOriId, 'Q05', 'i') == 1 or EgtGetInfo( nOriId, 'Q05', 'i') == 0 then
local bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, dCurrOvmT)
if not bOk then return bOk, sErr end
-- se finitura con truciolatore
elseif EgtGetInfo( nOriId, 'Q05', 'i') == 2 then
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then
local sErr = 'Error : part box not found'
EgtOutLog( sErr)
return false, sErr
end
local sPocketing = ML.FindPocketing( 'OpenPocket', nil, 0)
if not sPocketing then
local sErr = 'Error : pocketing not found in library'
EgtOutLog( sErr)
return false, sErr
end
local bOk, sErr = Pocket.Make( Proc, Proc.Id, 0, sPocketing, nPartId, b3Solid)
if not bOk then return bOk, sErr end
end
end
-- se tagli standard -- se tagli standard
elseif not bDoubleHorizCut then if not bDoubleHorizCut then
-- flag di lavorazione faccia -- flag di lavorazione faccia
local nOrthoOpposite = EgtIf( bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_FRONT) local nOrthoOpposite = EgtIf( bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_FRONT)
-- calcolo extra taglio ed accorciamento -- calcolo extra taglio ed accorciamento
@@ -263,12 +219,23 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
end end
-- altrimenti necessari tagli da sopra e sotto con testa opportuna -- altrimenti necessari tagli da sopra e sotto con testa opportuna
else else
-- verifico esistenza della lavorazione con lama da sotto -- recupero la lavorazione con lama da sotto
local sCutting2 = ML.FindCutting( 'HeadSide_H2')
if not sCutting2 then if not sCutting2 then
local sErr = 'Error : cutting H2 not found in library' local sErr = 'Error : cutting H2 not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- recupero i dati della seconda lama
local dSawDiam2 = 400
local dMaxDepth2 = 50
if EgtMdbSetCurrMachining( sCutting2) then
local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2
dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
end
end
-- verifico che le due lame riescano a lavorare la sezione -- verifico che le due lame riescano a lavorare la sezione
local dDimZ = b3Raw:getDimZ() local dDimZ = b3Raw:getDimZ()
local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ
@@ -281,18 +248,16 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN
local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN
local dAccStart = 0 local dAccStart = 0
local dVzLimDwnUp
if BD.TURN then dVzLimDwnUp = -2 end
-- eseguo i tagli da sotto necessari -- eseguo i tagli da sotto necessari
for i = nCuts, 1, -1 do for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsL local dCutOffset = ( i - 1) * dOffsL
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw) local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, nil, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw)
if not bOk then return false, sErr end if not bOk then return false, sErr end
end end
-- eseguo i tagli da sopra necessari -- eseguo i tagli da sopra necessari
for i = nCuts, 1, -1 do for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsL local dCutOffset = ( i - 1) * dOffsL
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_DOWN, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw) local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_DOWN, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw)
if not bOk then return false, sErr end if not bOk then return false, sErr end
end end
end end
+2398 -3058
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+393 -179
View File
@@ -1,4 +1,4 @@
-- ProcessLongCut.lua by Egaltech s.r.l. 2022/03/07 -- ProcessLongCut.lua by Egaltech s.r.l. 2021/11/08
-- Gestione calcolo taglio longitudinale per Travi -- Gestione calcolo taglio longitudinale per Travi
-- 2021/02/03 Corretto FaceUse con fresa orizzontale su taglio orizzontale. -- 2021/02/03 Corretto FaceUse con fresa orizzontale su taglio orizzontale.
-- 2021/05/18 Possibile taglio con lama anche di fianco su macchina con testa da sotto. -- 2021/05/18 Possibile taglio con lama anche di fianco su macchina con testa da sotto.
@@ -9,8 +9,6 @@
-- 2021/10/29 Aggiunta opzione tipo lavorazione 'LongCut'. -- 2021/10/29 Aggiunta opzione tipo lavorazione 'LongCut'.
-- 2021/11/04 Migliorata gestione sicurezza aggiuntiva in fresate di fianco (distinzione tra larga come tutta la faccia o meno). -- 2021/11/04 Migliorata gestione sicurezza aggiuntiva in fresate di fianco (distinzione tra larga come tutta la faccia o meno).
-- 2021/11/08 Se con lama e flag BD.USE_LONGCUT si lavora in direzione contraria allo standard. -- 2021/11/08 Se con lama e flag BD.USE_LONGCUT si lavora in direzione contraria allo standard.
-- 2022/03/07 Razionalizzata gestione casi con fresa di fianco. Aggiunta gestione Long2Cut anche con testa sotto.
-- 2022/07/14 Aggiunta limitazione lavorazione a sinistra anche se il grezzo successivo non ha lavorazioni (finale barra) ma è abbastanza lungo da poter essere riutilizzato (BD.MinRaw).
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessLongCut = {} local ProcessLongCut = {}
@@ -100,7 +98,7 @@ local function MakeSideFace( nId, nFac, nSide, sMilling, dToolDiam, bForcedLim,
EgtSetMachiningParam( MCH_MP.LOPERP, 0) EgtSetMachiningParam( MCH_MP.LOPERP, 0)
EgtSetMachiningParam( MCH_MP.LOTANG, dToolDiam / 2 + 30) EgtSetMachiningParam( MCH_MP.LOTANG, dToolDiam / 2 + 30)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -115,7 +113,7 @@ local function MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw, nFacInd, bReduceDe
if sMasterCutting and #sMasterCutting > 0 then if sMasterCutting and #sMasterCutting > 0 then
sCutting = sMasterCutting sCutting = sMasterCutting
else else
sCutting = ML.FindCutting( 'HeadSide', not bMillDown, bMillDown) sCutting = ML.FindCutting( 'HeadSide' .. EgtIf( bMillDown, '_H2', ''))
end end
if not sCutting then if not sCutting then
local sErr = 'Error : HeadSide (cutting) not found in library' local sErr = 'Error : HeadSide (cutting) not found in library'
@@ -262,7 +260,7 @@ local function ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtN, nFacet, nFacInd, s
EgtSetMachiningParam( MCH_MP.SCC, nPrevSCC) EgtSetMachiningParam( MCH_MP.SCC, nPrevSCC)
end end
-- rieseguo -- rieseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nIdMach, false) EgtSetOperationMode( nIdMach, false)
return false, false, sErr return false, false, sErr
@@ -321,10 +319,10 @@ local function MakeByPocketing( Proc, nPhase, nRawId, nPartId)
sNotes = sNotes .. 'VMRS=0;' sNotes = sNotes .. 'VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( 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)
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -356,37 +354,34 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
bLimXmax = true bLimXmax = true
end end
end end
-- Verifico lato di lavorazione (limite di lato a 45deg per FAST e 36deg per PF) -- Verifico lato di lavorazione (limite di lato a 45deg per pinze che schiacciano)
-- 14.07.2021 su richieste di alcuni clienti, se taglio di lato (assegnazione +/- 2) fare lo stesso con la lama lasciando il cordone centrale
local nSide = 1 local nSide = 1
if vtN:getZ() < - 0.5 then if vtN:getZ() < - 0.5 then
nSide = -1 nSide = -1
elseif vtN:getY() < - EgtIf( BD.C_SIMM, 0.588, 0.7072) then elseif vtN:getY() < -0.7072 then
nSide = -2 nSide = -2
elseif vtN:getY() > EgtIf( BD.C_SIMM, 0.588, 0.7072) then elseif vtN:getY() > 0.7072 then
nSide = 2 nSide = 2
end end
-- Verifico se largo come faccia -- Verifico se largo come faccia
local bLarghAsFace = false local bLarghAsFace = false
if nSide == 1 or nSide == -1 then if nSide == 1 or nSide == -1 then
bLarghAsFace = ( Proc.Box:getDimY() > b3Solid:getDimY() - 20) bLarghAsFace = ( Proc.Box:getDimY() > b3Solid:getDimY() - 10)
else else
bLarghAsFace = ( Proc.Box:getDimZ() > b3Solid:getDimZ() - 20) bLarghAsFace = ( Proc.Box:getDimZ() > b3Solid:getDimZ() - 10)
end end
-- Determino se parte da sopra
local bTopStart = ( Proc.Box:getMax():getZ() > b3Solid:getMax():getZ() - 20)
-- Determino se parte da sotto
local bBottomStart = ( Proc.Box:getMin():getZ() < b3Solid:getMin():getZ() + 20)
-- determino se lavorazione da davanti o da dietro -- determino se lavorazione da davanti o da dietro
local bFront = ( vtN:getY() < 0) local bFront = ( vtN:getY() < 0)
-- ottengo la distanza tra la fine del pezzo e il pezzo successivo -- ottengo la distanza tra la fine del pezzo e il pezzo successivo
local dDistToNextPiece = EgtGetInfo( nRawId, 'BDST', 'd') or BD.OVM_MID local dDistToNextPiece = EgtGetInfo( nRawId, 'BDST', 'd') or 5.4
local bForcedLim local bForcedLim
local sWarn local sWarn
---------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------
-- 2020/09/15 Fabio Squaratti: se sono attivi entrambe i Q05 (lavorare con lama) e Q07 (lavorare con fresa di fianco anche da sopra) -- 2020/09/15 Fabio Squaratti: se sono attivi entrambe i Q05 (lavorare con lama) e Q07 (lavorare con fresa di fianco anche da sopra)
-- allora vince il Q7, cioè si utilizza la fresa di fianco ( per i tagli da sopra) -- allora vince il Q7, cioè si utilizza la fresa di fianco ( per i tagli da sopra)
-- 2020/09/17 Fabio Squaratti: se lavorazione con fresa di fianco e se ci sono delle facce terminali, l'utensile deve arrivare -- 2020/09/17 Fabio Squaratti: se lavorazione con fresa di fianco e se ci sono delle facce laterali, l'utensile deve arrivare
-- fino al punto più vicino della faccia terminale (prima l'arretramento era sempre del raggio utensile). -- fino al punto più vicino della faccia laterale (prima l'arretramento era sempre del rggio utensile).
-- Questo viene fatto se Q07=1 o fresa da sotto -- Questo viene fatto se Q07=1 o fresa da sotto
---------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------
local nUseBlade = EgtIf( bCustUseBlade, 1, EgtGetInfo( Proc.Id, 'Q05', 'i') or 0) local nUseBlade = EgtIf( bCustUseBlade, 1, EgtGetInfo( Proc.Id, 'Q05', 'i') or 0)
@@ -474,7 +469,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
local dMaxDepthDn = 0 local dMaxDepthDn = 0
-- recupero la lavorazione -- recupero la lavorazione
if bCanUseUnderBlade then if bCanUseUnderBlade then
sCuttingDn = ML.FindCutting( 'HeadSide_H2', false, true) sCuttingDn = ML.FindCutting( 'HeadSide_H2')
if not sCuttingDn then if not sCuttingDn then
local sErr = 'Error : sawing HeadSide_H2 not found in library' local sErr = 'Error : sawing HeadSide_H2 not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -508,9 +503,8 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
end end
end end
end end
local nNextRawId = EgtGetNextRawPart( nRawId) -- se la fine (a sinistra) non è limitata e ho un pezzo successivo meno distante di metà raggio. setto la fine come limitata
-- se la fine (a sinistra) non è limitata e ho un pezzo successivo meno distante di metà raggio, oppure se grezzo finale della barra di lunghezza sufficiente, setto la fine come limitata if ( bCanUseBlade or bCanUseUnderBlade) and ( dDistToNextPiece < dToolDiam/2 or dDistToNextPiece < dToolDiamDn/2) and not bLimXmin then
if ((( bCanUseBlade or bCanUseUnderBlade) and ( dDistToNextPiece < dToolDiam/2 or dDistToNextPiece < dToolDiamDn/2)) or (nNextRawId and EgtGetPartInRawPartCount( nNextRawId) <= 0 and EgtGetRawPartBBox( nNextRawId):getDimX() >= BD.MinRaw)) and not bLimXmin then
if bForceUseBladeOnNotThruFace then if bForceUseBladeOnNotThruFace then
bForcedLim = true bForcedLim = true
bLimXmin = true bLimXmin = true
@@ -670,7 +664,12 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
-- determino la massima elevazione -- determino la massima elevazione
local dElev = BL.GetFaceElevation( Proc.Id, 0, nPartId) local dElev = BL.GetFaceElevation( Proc.Id, 0, nPartId)
-- recupero la lavorazione -- recupero la lavorazione
local sMilling = ML.FindMilling( 'Long2Cut_H2', dElev, nil, nil, nil, not bCanUseUnderBlade, bCanUseUnderBlade) local sMilling
if bCanUseUnderBlade then
sMilling = ML.FindMilling( 'Long2Cut_H2', dElev)
else
sMilling = ML.FindMilling( 'Long2Cut', dElev)
end
if not sMilling then if not sMilling then
local sErr = 'Error : milling Long2Cut (_H2) not found in library' local sErr = 'Error : milling Long2Cut (_H2) not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -757,6 +756,31 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
dAddExtraPerp = Proc.Box:getMin():getZ() - b3Solid:getMin():getZ() dAddExtraPerp = Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()
end end
dLioPerp = dLioPerp + dAddExtraPerp dLioPerp = dLioPerp + dAddExtraPerp
-------------------------------------------------------------------------------------------------------
-- disabilito questo calcolo dell'attacco perpendicolare perchè in alcune condizioni genera extra corsa
-------------------------------------------------------------------------------------------------------
--[[
-- parametri di attacco/uscita
local nOrthoOpposite = nFaceUse2
local b3Box = BBox3d( b3Raw)
b3Box:expand( BD.CUT_SIC)
-- linea o bilinea di lavorazione (qui uso nOrthoOpposite per ripetere esattamente il calcolo del Mach)
local ptP1, ptPm, ptP2, vtV1, vtV2, dLen, dWidth2 = EgtSurfTmFacetOppositeSide( Proc.Id, 0, BL.GetVersRef( nOrthoOpposite), GDB_ID.ROOT)
vtV1 = - vtV1
local bInvert = ( ptP2:getZ() < ptP1:getZ() - 100 * GEO.EPS_SMALL)
if bInvert then
ptP1, ptP2 = ptP2, ptP1
vtV1, vtV2 = vtV2, vtV1
end
local vtTg = ptP2 - ptP1 ; vtTg:normalize()
-- Versore di riferimento
local vtRef = Vector3d( vtTg)
local dCutExtra = 0
vtRef:rotate( vtN, EgtIf( bInvert, -90, 90))
local ptP1act = ptP1
local ptP2act = ptP2
_, dLioPerp, _, _ = Fbs.CalcLeadInOutPerpGeom( ptP1act, ptP2act, vtV1, vtV2, vtN, dToolDiam/2, vtRef, dCutExtra, b3Box)
]]--
end end
-- inserisco le parti di lavorazione -- inserisco le parti di lavorazione
nM = nM + 1 nM = nM + 1
@@ -798,6 +822,16 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
if ( not bFront and k == 1) or ( bFront and k == 2) then if ( not bFront and k == 1) or ( bFront and k == 2) then
dSal, dEal = dEal, dSal dSal, dEal = dEal, dSal
end end
-- se faccia da sotto inverto direzione utensile e profondità
-- if nSide == -1 then
-- if k == 1 and abs( vtN:getY()) > 0.01 and abs( vtN:getY()) <= 0.866 and abs( vtN:getY()) > 0.707 then
-- -- imposto lato di correzione
-- EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- else
-- EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
-- EgtSetMachiningParam( MCH_MP.DEPTH, dThick)
-- end
-- end
if bCanUseBlade and bCanUseUnderBlade then if bCanUseBlade and bCanUseUnderBlade then
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
@@ -843,24 +877,21 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
-- 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)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
end end
end end
end end
-- se non è sotto e non uso fresa di fianco: lavorazione Long2Cut -- se non è sotto e non uso fresa di fianco: lavorazione Long2Cut
elseif ( nSide ~= - 1 or BD.DOWN_HEAD) and nUseMillOnSide == 0 then elseif nSide ~= - 1 and nUseMillOnSide == 0 then
-- determino la massima elevazione -- determino la massima elevazione
local dElev = BL.GetFaceElevation( Proc.Id, 0, nPartId) local dElev = BL.GetFaceElevation( Proc.Id, 0, nPartId)
-- recupero la lavorazione -- recupero la lavorazione
local bDownHead = ( nSide == - 1) local sMilling = ML.FindMilling( 'Long2Cut', dElev)
sMchType = EgtIf( bDownHead, 'Long2Cut_H2', 'Long2Cut')
local sMilling = ML.FindMilling( sMchType, dElev, nil, nil, nil, not bDownHead, bDownHead)
if not sMilling then if not sMilling then
local sErr = 'Error : milling '..sMchType..' not found in library' local sErr = 'Error : milling Long2Cut not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -1012,7 +1043,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
local dDepth = min( 0, dMaxDepth - dElev ) local dDepth = min( 0, dMaxDepth - dElev )
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -1050,9 +1081,9 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
nCountMilHead = nCountMilHead + 1 nCountMilHead = nCountMilHead + 1
end end
end end
-- altrimenti è da sotto ( lavorazione Long2CutDown) o abilitata lavorazione con fresa di fianco ( lavorazione Long2CutSide)
-- altrimenti è con fresa di fianco (Long2CutSide) o da sotto (Long2CutDown)
else else
-- da Analisi con Fabio Squaratti 15/09/2020
-- variabile che indica se ripassare sul raggio rimasto dalla lavorazione di fianco -- variabile che indica se ripassare sul raggio rimasto dalla lavorazione di fianco
local bRemoveToolRadius local bRemoveToolRadius
-- se nExtendMach = 0 la lavorazione rimane arretrata dalla fine della faccia del raggio utensile -- se nExtendMach = 0 la lavorazione rimane arretrata dalla fine della faccia del raggio utensile
@@ -1060,12 +1091,12 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
-- se nExtendMach = 2 la lavorazione viene estesa ma arretra per non segnare il pezzo successivo (se non ha facce limite) -- se nExtendMach = 2 la lavorazione viene estesa ma arretra per non segnare il pezzo successivo (se non ha facce limite)
local nExtendMach local nExtendMach
-- recupero la lavorazione -- recupero la lavorazione
local sMchType, sMchTypeDn local sMilling
local sMilling, sMillingDn local sMillingDn
local sPrefix, sPrefixDn local sPrefix
local sPrefixDn
if nSide ~= - 1 then if nSide ~= - 1 then
sMchType = 'Long2CutSide' sMilling = ML.FindMilling( 'Long2CutSide')
sMilling = ML.FindMilling( sMchType)
sPrefix = 'L2CS_' sPrefix = 'L2CS_'
nExtendMach = nUseMillOnSide nExtendMach = nUseMillOnSide
if nUseMillOnSide == 2 then if nUseMillOnSide == 2 then
@@ -1073,33 +1104,30 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
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
sMchTypeDn = 'Long2CutSide_H2' sMillingDn = ML.FindMilling( 'Long2CutSide_H2')
sMillingDn = ML.FindMilling( sMchTypeDn, nil, nil, nil, nil, false, true)
sPrefixDn = 'L2CSH2_' sPrefixDn = 'L2CSH2_'
end end
-- lavorazione da sotto -- lavorazione da sotto
else else
sMchType = 'Long2CutDown' sMilling = ML.FindMilling( 'Long2CutDown')
sMilling = ML.FindMilling( sMchType)
sPrefix = 'L2CD_' sPrefix = 'L2CD_'
nExtendMach = 1 nExtendMach = 1
if nUseMillOnSide ~= 1 then if nUseMillOnSide ~= 1 then
nExtendMach = 2 -- arretro il minimo indispensabile per non segnare il pezzo successivo (se non ha facce limite) nExtendMach = 2 -- arretro il minimo indispensabile per non segnare il pezzo successivo (se non ha facce limite)
end end
-- se testa da sotto -- se testa da sotto
if BD.DOWN_HEAD then if BD.DOWN_HEAD then
sMchTypeDn = 'Long2CutDown_H2' sMillingDn = ML.FindMilling( 'Long2CutDown_H2')
sMillingDn = ML.FindMilling( sMchTypeDn, nil, nil, nil, nil, false, true)
sPrefixDn = 'L2CDH2_' sPrefixDn = 'L2CDH2_'
end end
end end
if not sMilling and ( nSide == 1 or not BD.DOWN_HEAD) then if not sMilling then
local sErr = 'Error : milling '..sMchType..' not found in library' local sErr = 'Error : milling Long2CutSide or Long2CutDown not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
if not sMilling and not sMillingDn then if nSide ~= 1 and BD.DOWN_HEAD and not sMillingDn then
local sErr = 'Error : milling '..sMchType..' and '..sMchTypeDn..' not found in library' local sErr = 'Error : milling Long2CutSide_H2 or Long2CutDown_H2 not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -1109,7 +1137,9 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
local dMaxDepth = 0 local dMaxDepth = 0
local dThDiam = 0 local dThDiam = 0
local dThLen = 0 local dThLen = 0
if sMilling and EgtMdbSetCurrMachining( sMilling) then local dExtraForSafety = EgtIf( BD.DOWN_HEAD, 8.5, 6.5) -- corrisponde al doppio valore di sicurezza dell'mlpe + 0.5
-- local dExtraForSafetyDn = 8.5 -- 8.5 -- corrisponde al doppio valore di sicurezza dell'mlpe + 0.5
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
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
@@ -1125,7 +1155,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
local dMaxDepthDn = 0 local dMaxDepthDn = 0
local dThDiamDn = 0 local dThDiamDn = 0
local dThLenDn = 0 local dThLenDn = 0
if sMillingDn and EgtMdbSetCurrMachining( sMillingDn) then if nSide ~= 1 and BD.DOWN_HEAD and EgtMdbSetCurrMachining( sMillingDn) 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
dToolDiamDn = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiamDn dToolDiamDn = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiamDn
@@ -1135,17 +1165,19 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
dThLenDn = EgtTdbGetCurrToolThLength() or dThLenDn dThLenDn = EgtTdbGetCurrToolThLength() or dThLenDn
end end
end end
-- distanza dalle eventuali facce estreme
local dDistToEnd = dToolDiam / 2 local dDistToEnd = dToolDiam / 2
local dDistToEndDn = dToolDiamDn / 2 local dDistToEndDn = dToolDiamDn / 2
-- calcolo l'elevazione della faccia principale -- calcolo l'elevazione della faccia principale
local dFacElev = BL.GetFaceElevation( Proc.Id, 0, nPartId) local dFacElev = BL.GetFaceElevation( Proc.Id, 0, nPartId)
-- se fresa di fianco o da sotto calcolo quanto l'utensile può andare vicino all'estremo con 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) and dFacElev < dToolDiam / 2 then if nUseMillOnSide <= 1 or nSide == -1 then
dDistToEnd = sqrt( dFacElev * ( dToolDiam - dFacElev)) if dFacElev < dDistToEnd then
end dDistToEnd = sqrt( ( ( dToolDiam / 2) * ( dToolDiam / 2)) - ( ( dToolDiam / 2 - dFacElev) * (dToolDiam / 2 - dFacElev)))
if nUseMillOnSide <= 1 and dFacElev < dToolDiamDn / 2 then end
dDistToEndDn = sqrt( dFacElev * ( dToolDiamDn - dFacElev)) if dFacElev < dDistToEndDn then
dDistToEndDn = sqrt( ( ( dToolDiamDn / 2) * ( dToolDiamDn / 2)) - ( ( dToolDiamDn / 2 - dFacElev) * (dToolDiamDn / 2 - dFacElev)))
end
end end
-- se la fine è già limitata allora setto per arretrare del raggio utensile -- se la fine è già limitata allora setto per arretrare del raggio utensile
if bLimXmin then if bLimXmin then
@@ -1220,134 +1252,123 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
dEndAccDist = 0 dEndAccDist = 0
end end
end end
-- verifico se posso farlo da una sola parte o se necessario da due parti -- verifico se posso farlo da due parti opposte o da solo una parte
local dMaxDepthZ = dMaxDepth local dCollSic
local dMaxDepthDnZ = dMaxDepthDn local dCollSicMin
local CosA = abs( vtN:getZ()) local dCollSicDn
if CosA >= 0.05 then local dCollSicMinDn
local SinA = sqrt( 1 - CosA * CosA) local dDepth
local dRad = dThDiam / 2 - dToolDiam / 2 + BD.COLL_SIC local dDepthDn
dMaxDepthZ = dMaxDepthZ - ( dRad * CosA / SinA) local dDepth2
if sMillingDn then local dDepth2Dn
local dRadDn = dThDiamDn / 2 - dToolDiamDn / 2 local nPass = 1
dMaxDepthDnZ = dMaxDepthDnZ - ( dRadDn * CosA / SinA) local dNz = EgtIf( abs(nSide) == 1, vtN:getY(), vtN:getZ())
local dNzMin = EgtIf( abs(vtN:getY()) >= abs(vtN:getZ()), vtN:getY(), vtN:getZ())
-- se faccia da sopra e angolo 45° o faccia da sotto e angolo 40° (con singola testa ) o faccia non da sopra e testa da sotto
-- permette di eseguire due lavorazioni opposte
if ( nSide == 1 and abs(vtN:getY()) <= 0.7072) or ( nSide == -1 and not BD.DOWN_HEAD and abs(vtN:getY()) < 0.6428) or ( nSide ~= 1 and BD.DOWN_HEAD) then
-- verifico massimo affondamento (tengo conto dell'inclinazione utensile e della pinza con estremità conica)
-- 08/09/2020 tolti i 3mm ( per la ghiera smussata) perchè nella verifica collisione vine creato un cilindro non smussato che rileva la collisione
local dSicOnRad
local dSicOnLegth
if ( abs(nSide) == 1 and abs(vtN:getZ()) >= abs(vtN:getY())) or ( abs(nSide) == 2 and abs(vtN:getY()) >= abs(vtN:getZ())) then
dSicOnRad = ( dThDiam + dExtraForSafety - dToolDiam) / 2
dSicOnLegth = 0
else
dSicOnRad = ( dThDiam - dToolDiam) / 2
dSicOnLegth = dExtraForSafety / 2
end end
end dCollSicMin = max( BD.COLL_SIC, ( dThDiam - dToolDiam) / 2 * abs( EgtIf( abs(vtN:getY()) >= abs(vtN:getZ()), vtN:getZ(), vtN:getY()) / dNzMin))
local dMaxDepthY = dMaxDepth if bLarghAsFace then
local dMaxDepthDnY = dMaxDepthDn dCollSic = max( BD.COLL_SIC, dSicOnRad * abs( EgtIf( abs(vtN:getY()) >= abs(vtN:getZ()), vtN:getZ(), vtN:getY()) / dNzMin) + dSicOnLegth)
local SinA = abs( vtN:getZ()) else
if SinA >= 0.05 then dCollSic = max( BD.COLL_SIC, dSicOnRad * EgtIf( abs(dNz) < GEO.EPS_SMALL, 1, abs( EgtIf( abs(nSide) == 1, vtN:getZ(), vtN:getY()) / dNz)) + dSicOnLegth)
local CosA = sqrt( 1 - SinA * SinA)
local dRad = dThDiam / 2 - dToolDiam / 2 + BD.COLL_SIC
dMaxDepthY = dMaxDepthY - ( dRad * CosA / SinA)
if sMillingDn then
local dRadDn = dThDiamDn / 2 - dToolDiamDn / 2
dMaxDepthDnY = dMaxDepthDnY - ( dRadDn * CosA / SinA)
end end
end if nSide ~= 1 and BD.DOWN_HEAD then
local nPass = 0 local dSicOnRadDn
local vdMaxD = { 0, 0} local dSicOnLegthDn
local vnHead = { 0, 0} if ( abs(nSide) == 1 and abs(vtN:getZ()) >= abs(vtN:getY())) or ( abs(nSide) == 2 and abs(vtN:getY()) >= abs(vtN:getZ())) then
-- con testa da sopra dSicOnRadDn = ( dThDiamDn + dExtraForSafety - dToolDiamDn) / 2
if nSide == 1 or ( sMilling and abs( nSide) == 2 and ( bTopStart or abs( vtN:getY()) < 0.866)) or not sMillingDn then dSicOnLegthDn = 0
vnHead = { 1, 1}
-- se faccia sopra
if nSide == 1 then
vdMaxD[1] = EgtIf( bLarghAsFace, dMaxDepthY, dMaxDepthZ)
if dWidth + dAgg <= vdMaxD[1] then
nPass = 1
else else
nPass = 2 dSicOnRadDn = ( dThDiamDn - dToolDiamDn) / 2
dAgg = BD.CUT_EXTRA_MIN dSicOnLegthDn = dExtraForSafety / 2
vdMaxD[2] = dMaxDepthY
end end
-- se altrimenti faccia sotto dCollSicMinDn = max( BD.COLL_SIC, ( dThDiamDn - dToolDiamDn) / 2 * abs( EgtIf( abs(vtN:getY()) >= abs(vtN:getZ()), vtN:getZ(), vtN:getY()) / dNzMin))
elseif nSide == -1 then if bLarghAsFace then
if dWidth + dAgg <= dMaxDepthY or abs( vtN:getY()) > EgtIf( BD.C_SIMM, 0.588, 0.7072) then dCollSicDn = max( BD.COLL_SIC, dSicOnRadDn * abs( EgtIf( abs(vtN:getY()) >= abs(vtN:getZ()), vtN:getZ(), vtN:getY()) / dNzMin) + dSicOnLegthDn)
nPass = 1
vdMaxD[1] = dMaxDepthY
else else
dCollSicDn = max( BD.COLL_SIC, dSicOnRadDn * EgtIf( abs(dNz) < GEO.EPS_SMALL, 1, abs( EgtIf( abs(nSide) == 1, vtN:getZ(), vtN:getY()) / dNz)) + dSicOnLegthDn)
end
if dWidth + dAgg > dMaxDepth - dCollSic then
nPass = 2 nPass = 2
vdMaxD[1] = dMaxDepthY dAgg = 1
local dDelta = b3Solid:getDimY() - Proc.Box:getDimY() if ( 0.5 * dWidth) + dAgg > dMaxDepth - dCollSic then
if bLarghAsFace then sWarn = 'Warning in LongCut : depth is bigger than max tool depth'
vdMaxD[2] = min( dMaxDepthY, dMaxDepth - dDelta * abs( vtN:getZ()) - BD.COLL_SIC)
else
vdMaxD[2] = min( dMaxDepthZ, dToolLength - 5 - dDelta / abs( vtN:getZ()) - BD.COLL_SIC)
end end
if vdMaxD[2] < 0 then nPass = 1 end
if nPass == 2 then dAgg = BD.CUT_EXTRA_MIN end
end end
-- altrimenti faccia di fianco if nPass == 1 and dWidth + dAgg > dMaxDepthDn - dCollSicDn then
else
nPass = 1
local dDelta = b3Solid:getMax():getZ() - Proc.Box:getMax():getZ()
if abs( vtN:getY()) < 0.866 then
vdMaxD[1] = dMaxDepthY
elseif bTopStart then
vdMaxD[1] = min( dMaxDepthZ, dMaxDepth - dDelta * abs( vtN:getY()) - BD.COLL_SIC)
else
vdMaxD[1] = min( dMaxDepthY, dToolLength - 5 - dDelta * abs( vtN:getY()) - BD.COLL_SIC)
end
if vdMaxD[1] < 0 then nPass = 0 end
end
-- eventuale errore per lavorazione saltata
if nPass == 0 then
local sErr = 'Error in '..sMchType..' : impossible machining'
EgtOutLog( sErr)
return false, sErr
end
-- eventuale avviso per lavorazione incompleta
if dWidth + nPass * dAgg > vdMaxD[1] + vdMaxD[2] then
sWarn = 'Warning in '..sMchType..' : depth is bigger than max tool depth'
end
-- con testa da sotto
else
vnHead = { 2, 2}
-- se faccia sotto
if nSide == -1 then
vdMaxD[1] = EgtIf( bLarghAsFace, dMaxDepthDnY, dMaxDepthDnZ)
if dWidth + dAgg <= vdMaxD[1] then
nPass = 1
else
nPass = 2 nPass = 2
dAgg = BD.CUT_EXTRA_MIN dAgg = 1
vdMaxD[2] = dMaxDepthDnY if ( 0.5 * dWidth) + dAgg > dMaxDepthDn - dCollSicDn then
sWarn = 'Warning in LongCut_2 : depth is bigger than max tool depth'
end
end end
-- altrimenti faccia di fianco
else else
nPass = 1 if dWidth + dAgg > dMaxDepth - dCollSic then
local dDelta = Proc.Box:getMin():getZ() - b3Solid:getMin():getZ() nPass = 2
if bBottomStart then dAgg = 1
vdMaxD[1] = min( dMaxDepthDnZ, dMaxDepthDn - dDelta * abs( vtN:getY()) - BD.COLL_SIC) if ( 0.5 * dWidth) + dAgg > dMaxDepth - dCollSic then
else sWarn = 'Warning in LongCut : depth is bigger than max tool depth'
vdMaxD[1] = min( dMaxDepthDnY, dToolLengthDn - 5 - dDelta * abs( vtN:getY()) - BD.COLL_SIC) end
end end
if vdMaxD[1] < 0 then nPass = 0 end
end end
-- eventuale errore per lavorazione saltata else
if nPass == 0 then -- verifico massimo affondamento (tengo conto dell'inclinazione utensile e della pinza con estremità conica)
local sErr = 'Error in '..sMchType..' : impossible machining' -- 08/09/2020 tolti i 3mm ( per la ghiera smussata) perchè nella verifica collisione vine creato un cilindro non smussato che rileva la collisione
EgtOutLog( sErr) local dSicOnRad
return false, sErr local dSicOnLegth
if ( abs(nSide) == 1 and abs(vtN:getZ()) >= abs(vtN:getY())) or ( abs(nSide) == 2 and abs(vtN:getY()) >= abs(vtN:getZ())) then
dSicOnRad = ( dThDiam + dExtraForSafety - dToolDiam) / 2
dSicOnLegth = 0
else
dSicOnRad = ( dThDiam - dToolDiam) / 2
dSicOnLegth = dExtraForSafety / 2
end end
-- eventuale avviso per lavorazione incompleta dCollSicMin = max( BD.COLL_SIC, ( dThDiam - dToolDiam) / 2 * abs( EgtIf( abs(vtN:getY()) >= abs(vtN:getZ()), vtN:getZ(), vtN:getY()) / dNzMin))
if dWidth + nPass * dAgg > vdMaxD[1] + vdMaxD[2] then -- dCollSic = max( BD.COLL_SIC, dSicOnRad * EgtIf( abs(dNz) < GEO.EPS_SMALL, 1, abs( EgtIf( abs(nSide) == 1, vtN:getY(), vtN:getZ()) / dNz)) + dSicOnLegth)
sWarn = 'Warning in '..sMchType..' : depth is bigger than max tool depth' dCollSic = max( BD.COLL_SIC, dSicOnRad * abs( EgtIf( abs(vtN:getY()) >= abs(vtN:getZ()), vtN:getZ(), vtN:getY()) / dNzMin) + dSicOnLegth)
if dWidth + dAgg > dMaxDepth - dCollSic then
sWarn = 'Warning in LongCut : depth is bigger than max tool depth'
end
end
-- profondità prima passata
dDepth = min( dMaxDepth - dCollSicMin, dWidth + dAgg)
-- profondità seconda passata
dDepth2 = dWidth + dAgg - dDepth
if not BD.DOWN_HEAD then
if nPass == 2 and dDepth2 < dAgg then
dDepth = min( dMaxDepth - dCollSicMin, dWidth + dAgg) / 2
dDepth2 = dWidth + dAgg - dDepth
end
end
if nSide ~= 1 and BD.DOWN_HEAD then
dDepthDn = min( dMaxDepthDn - dCollSicMinDn, dWidth + dAgg)
dDepth2Dn = dWidth + dAgg - EgtIf( abs(nSide) == 2, dDepth, dDepthDn)
if nPass == 2 and dDepth2Dn < dAgg then
dDepthDn = min( dMaxDepthDn - dCollSicMinDn, dWidth + dAgg) / 2
dDepth2Dn = dWidth + dAgg - EgtIf( abs(nSide) == 2, dDepth, dDepthDn)
end end
end end
-- profondità passate
local vdDepth = {}
vdDepth[1] = min( dWidth + dAgg, vdMaxD[1])
vdDepth[2] = min( dWidth + dAgg - vdDepth[1], vdMaxD[2])
-- ciclo sulle parti -- ciclo sulle parti
local nM = 0 local nM = 0
local bMakeMillHeadEnd local bMakeMillHeadEnd
local bMakeMillHeadStart local bMakeMillHeadStart
local dLioPerp1 = dFacElev + BD.COLL_SIC local dLioPerp1 = dFacElev + BD.COLL_SIC
local dLioPerp2 = dWidth * EgtIf( abs( vtN:getZ()) < GEO.EPS_SMALL, 1, sqrt( 1 - vtN:getZ() * vtN:getZ()) / abs( vtN:getZ())) + BD.COLL_SIC -- local dLioPerp2 = dWidth + BD.COLL_SIC
local dLioPerp2 = dWidth * EgtIf( abs(dNz) < GEO.EPS_SMALL, 1, sqrt( 1 - dNz * dNz) / abs( dNz)) + BD.COLL_SIC
-- valore sovrapposizione tra passate -- valore sovrapposizione tra passate
local dOverLapExtend = 2 * BD.CUT_EXTRA_MIN local dOverLapExtend = 2
for j = 1, nC do for j = 1, nC do
-- Limitazioni della lavorazione -- Limitazioni della lavorazione
local nPos = EgtIf( bFront, j, nC - j + 1) local nPos = EgtIf( bFront, j, nC - j + 1)
@@ -1355,7 +1376,11 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
local dEal = EgtIf( nPos == nC, -dStartDist, -dStartAccDist - ( nC - nPos - 1) * dC + dOverLapExtend) local dEal = EgtIf( nPos == nC, -dStartDist, -dStartAccDist - ( nC - nPos - 1) * dC + dOverLapExtend)
-- Posizione braccio portatesta -- Posizione braccio portatesta
local nSCC local nSCC
local dExtraElev_1st = 0
local dExtraElevDn_1st = 0
for k = 1, nPass do for k = 1, nPass do
-- if EgtIf( k == 1, bFront, not bFront) then
if bFront then if bFront then
nSCC = EgtIf( ( BD.C_SIMM or j == 1 or j == nC - 1), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP) nSCC = EgtIf( ( BD.C_SIMM or j == 1 or j == nC - 1), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
else else
@@ -1363,19 +1388,31 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
end end
-- inserisco le parti di lavorazione -- inserisco le parti di lavorazione
nM = nM + 1 nM = nM + 1
local sNameF = EgtIf( vnHead[k] ~= 2, sPrefix, sPrefixDn) .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM) local sNameF
local nMchFId = EgtAddMachining( sNameF, EgtIf( vnHead[k] ~= 2, sMilling, sMillingDn)) local nMchFId
if not nMchFId then if BD.DOWN_HEAD and k == 2 and nSide ~= 1 then
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sMillingDn sNameF = sPrefixDn .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM)
EgtOutLog( sErr) nMchFId = EgtAddMachining( sNameF, sMillingDn)
return false, sErr if not nMchFId then
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sMillingDn
EgtOutLog( sErr)
return false, sErr
end
else
sNameF = sPrefix .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM)
nMchFId = EgtAddMachining( sNameF, sMilling)
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
end end
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, 0}}) EgtSetMachiningGeometry( {{ Proc.Id, 0}})
-- 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)
-- imposto uso faccia -- imposto uso faccia
local nUseFace = EgtIf( vnHead[k] ~= 2, MCH_MILL_FU.PARAL_DOWN, MCH_MILL_FU.PARAL_TOP) local nUseFace = MCH_MILL_FU.PARAL_DOWN
if AreSameOrOppositeVectorApprox( vtN, Z_AX()) then nUseFace = MCH_MILL_FU.PARAL_BACK end if AreSameOrOppositeVectorApprox( vtN, Z_AX()) then nUseFace = MCH_MILL_FU.PARAL_BACK end
EgtSetMachiningParam( MCH_MP.FACEUSE, nUseFace) EgtSetMachiningParam( MCH_MP.FACEUSE, nUseFace)
-- imposto lato di lavoro e inversione -- imposto lato di lavoro e inversione
@@ -1392,17 +1429,194 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal) EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)
-- assegno affondamento -- assegno affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, vdDepth[k]) local dExtraElev = 0
-- assegno attacco perpendicolare local dExtraElevDn = 0
if not BD.DOWN_HEAD then
-- se prima lavorazione non da sotto o seconda lavorazione da sotto e componente Y <= 60° e > 0
if ( ( k == 1 and nSide ~= -1) or ( k == 2 and nSide == -1)) and abs(vtN:getY()) <= 0.866 and abs(vtN:getY()) > GEO.EPS_SMALL then
-- verifico se può collidere in base alle dimensione del portapezzo
local dDistToolTh = (dToolLength - EgtIf( k == 1, dDepth, ( dDepth2 + dExtraElev_1st)) - dThLen) / abs(vtN:getZ())
local dDistRadTh = dDistToolTh * abs(vtN:getY())
local dDistSurf = EgtIf( bFront, b3Solid:getMax():getY() - Proc.Box:getMax():getY(), Proc.Box:getMin():getY() - b3Solid:getMin():getY())
-- raggio portautensile e raggio utensile allora calcolo un arretramento profondità
if dDistSurf > dDistToolTh and dDistRadTh < (( dThDiam - dToolDiam) / 2) then
-- se devo premiare extra sicurezza su lunghezza utensile
if abs(vtN:getY()) > abs(vtN:getZ()) then
dExtraElev = ((( dThDiam - dToolDiam) / 2) - dDistRadTh) * abs(vtN:getZ()) / abs(vtN:getY()) + ( 0.5 * dExtraForSafety) / abs(vtN:getY())
-- altrimenti premio extra sicurezza su raggio utensile
else
dExtraElev = ((( dThDiam + dExtraForSafety - dToolDiam) / 2) - dDistRadTh) * abs(vtN:getZ()) / abs(vtN:getY())
end
elseif abs(dDistSurf) > GEO.EPS_SMALL then
if nSide ~= -1 then
dDistSurf = b3Solid:getMax():getZ() - Proc.Box:getMax():getZ()
else
dDistSurf = Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()
end
if dDistSurf * abs(vtN:getZ()) > (( dThDiam + dToolDiam) * 0.5) then
dExtraElev = dDistSurf * abs(vtN:getY())
end
end
-- altrimenti prima lavorazione di fianco con componente Z negativa
elseif k == 1 and abs(nSide) == 2 and vtN:getZ() > -0.866 and vtN:getZ() < - GEO.EPS_SMALL then
-- verifico se può collidere in base alle dimensione del portapezzo
local dDistToolTh = (dToolLength - dDepth - dThLen) / abs(vtN:getY())
local dDistRadTh = dDistToolTh * abs(vtN:getZ())
local dDistSurf = b3Solid:getMax():getZ() - Proc.Box:getMax():getZ()
-- raggio portautensile e raggio utensile allora calcolo un arretramento profondità
if dDistSurf > dDistToolTh and dDistRadTh < (( dThDiam - dToolDiam) / 2) then
-- se devo premiare extra sicurezza su lunghezza utensile
if abs(vtN:getY()) > abs(vtN:getZ()) then
dExtraElev = ((( dThDiam - dToolDiam) / 2) - dDistRadTh) * abs(vtN:getY()) / abs(vtN:getZ()) + ( 0.5 * dExtraForSafety) / abs(vtN:getZ())
-- altrimenti premio extra sicurezza su raggio utensile
else
dExtraElev = ((( dThDiam + dExtraForSafety - dToolDiam) / 2) - dDistRadTh) * abs(vtN:getY()) / abs(vtN:getZ())
end
elseif abs( dDistSurf) < GEO.EPS_SMALL then
if bFront then
dDistSurf = Proc.Box:getMin():getY() - b3Solid:getMin():getY()
else
dDistSurf = b3Solid:getMax():getY() - Proc.Box:getMax():getY()
end
if dDistSurf * abs(vtN:getY()) > (( dThDiam + dToolDiam) * 0.5) then
dExtraElev = dDistSurf * abs(vtN:getZ())
end
end
end
-- altrimenti con testa da sotto
else
-- se prima lavorazione non da sotto e componente y <= 60° e > 0
if ( k == 1 and nSide ~= -1) and abs(vtN:getY()) <= 0.866 and abs(vtN:getY()) > GEO.EPS_SMALL then
-- verifico se può collidere in base alle dimensione del portapezzo
local dDistToolTh = (dToolLength - dDepth - dThLen) / abs(vtN:getZ())
local dDistRadTh = dDistToolTh * abs(vtN:getY())
local dDistSurf = EgtIf( bFront, b3Solid:getMax():getY() - Proc.Box:getMax():getY(), Proc.Box:getMin():getY() - b3Solid:getMin():getY())
-- raggio portautensile e raggio utensile allora calcolo un arretramento profondità
if dDistSurf > dDistToolTh and dDistRadTh < (( dThDiam - dToolDiam) * 0.5) then
-- se devo premiare extra sicurezza su lunghezza utensile
if abs(vtN:getZ()) > abs(vtN:getY()) then
dExtraElev = ((( dThDiam - dToolDiam) * 0.5) - dDistRadTh) * abs(vtN:getZ()) / abs(vtN:getY()) + ( 0.5 * dExtraForSafety) / abs(vtN:getY())
-- altrimenti premio extra sicurezza su raggio utensile
else
dExtraElev = ((( dThDiam + dExtraForSafety - dToolDiam) * 0.5) - dDistRadTh) * abs(vtN:getZ()) / abs(vtN:getY())
end
elseif abs(dDistSurf) < GEO.EPS_SMALL then
dDistSurf = b3Solid:getMax():getZ() - Proc.Box:getMax():getZ()
if dDistSurf * vtN:getZ() > (( dThDiam + dToolDiam) * 0.5) then
dExtraElev = dDistSurf * abs(vtN:getY())
end
end
-- se seconda lavorazione sopra e componente Z > 0
elseif k == 2 and nSide == 1 and vtN:getZ() > GEO.EPS_SMALL then
local dDistToolTh = (dToolLength - ( dDepth2 + dExtraElev_1st) - dThLen) / abs(vtN:getY())
local dDistRadTh = dDistToolTh * abs(vtN:getZ())
local dDistSurf = Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()
-- raggio portautensile e raggio utensile allora calcolo un arretramento profondità
if dDistSurf > dDistToolTh and dDistRadTh < (( dThDiam - dToolDiam) * 0.5) then
-- premio extra sicurezza su lunghezza utensile
if abs(vtN:getZ()) > abs(vtN:getY()) then
dExtraElev = ((( dThDiam - dToolDiam) * 0.5) - dDistRadTh) * abs(vtN:getY()) / abs(vtN:getZ()) + ( 0.5 * dExtraForSafety) / vtN:getZ()
-- altrimenti premio extra sicurezza su raggio utensile
else
dExtraElev = ((( dThDiam + dExtraForSafety - dToolDiam) * 0.5) - dDistRadTh) * abs(vtN:getY()) / abs(vtN:getZ())
end
end
-- se prima lavorazione di fianco e componente Z > 0
elseif k == 1 and abs(nSide) == 2 and vtN:getZ() < GEO.EPS_SMALL then
local dDistToolTh = (dToolLength - dDepth - dThLen) / abs(vtN:getY())
local dDistRadTh = dDistToolTh * abs(vtN:getZ())
local dDistSurf = b3Solid:getMax():getZ() - Proc.Box:getMax():getZ()
-- raggio portautensile e raggio utensile allora calcolo un arretramento profondità
if dDistSurf > dDistToolTh and dDistRadTh < (( dThDiam - dToolDiam) * 0.5) then
-- se devo premiare extra sicurezza su lunghezza utensile
if abs(vtN:getY()) > abs(vtN:getZ()) then
dExtraElev = (dDistSurf - dDistToolTh + ( 0.5 * dExtraForSafety)) / abs(vtN:getY())
-- altrimenti premio extra sicurezza su raggio utensile
else
dExtraElev = (( dThDiam - dToolDiam) * 0.5) * abs(vtN:getY()) / abs(vtN:getZ()) - (dToolLength - dDepth - dThLen) + ( 0.5 * dExtraForSafety) / abs(vtN:getZ())
end
elseif abs(dDistSurf) < GEO.EPS_SMALL then
if bFront then
dDistSurf = Proc.Box:getMin():getY() - b3Solid:getMin():getY()
else
dDistSurf = b3Solid:getMax():getY() - Proc.Box:getMax():getY()
end
if dDistSurf * abs(vtN:getY()) > (( dThDiam + dToolDiam) * 0.5) then
dExtraElev = dDistSurf * abs(vtN:getZ())
end
end
-- se seconda lavorazione di fianco e componente Z > 0
elseif k == 2 and abs(nSide) == 2 and vtN:getZ() > GEO.EPS_SMALL then
local dDistToolThDn = (dToolLengthDn - ( dDepth2Dn + dExtraElevDn_1st) - dThLenDn) / abs(vtN:getY())
local dDistRadThDn = dDistToolThDn * abs(vtN:getZ())
local dDistSurfDn = Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()
-- raggio portautensile e raggio utensile allora calcolo un arretramento profondità
if dDistSurfDn > dDistToolThDn and dDistRadThDn < (( dThDiamDn - dToolDiamDn) * 0.5) then
-- se devo premiare extra sicurezza su lunghezza utensile
if abs(vtN:getY()) > abs(vtN:getZ()) then
dExtraElevDn = ((( dThDiamDn - dToolDiamDn) * 0.5) - dDistRadThDn) * abs(vtN:getY()) / abs(vtN:getZ()) + ( 0.5 * dExtraForSafety) / vtN:getZ()
-- altrimenti premio extra sicurezza su raggio utensile
else
dExtraElevDn = ((( dThDiamDn + dExtraForSafety - dToolDiamDn) * 0.5) - dDistRadThDn) * abs(vtN:getY()) / abs(vtN:getZ())
end
elseif abs(dDistSurfDn) < GEO.EPS_SMALL then
if bFront then
dDistSurfDn = Proc.Box:getMin():getY() - b3Solid:getMin():getY()
else
dDistSurfDn = b3Solid:getMax():getY() - Proc.Box:getMax():getY()
end
if dDistSurfDn * abs(vtN:getY()) > (( dThDiamDn + dToolDiamDn) * 0.5) then
dExtraElevDn = dDistSurfDn * abs(vtN:getZ())
end
end
-- se seconda lavorazione da sotto a componente Y < 60° e Y > 0
elseif ( k == 2 and nSide == -1) and abs(vtN:getY()) <= 0.866 and abs(vtN:getY()) > GEO.EPS_SMALL then
-- verifico se può collidere in base alle dimensione del portapezzo
local dDistToolThDn = (dToolLengthDn - ( dDepth2Dn + dExtraElevDn_1st) - dThLenDn) / abs(vtN:getY())
local dDistRadThDn = dDistToolThDn * abs(vtN:getZ())
local dDistSurfDn = EgtIf( bFront, b3Solid:getMax():getY() - Proc.Box:getMax():getY(), Proc.Box:getMin():getY() - b3Solid:getMin():getY())
-- raggio portautensile e raggio utensile allora calcolo un arretramento profondità
if dDistSurfDn > dDistToolThDn and dDistRadThDn < (( dThDiamDn - dToolDiamDn) * 0.5) then
-- se devo premiare extra sicurezza su lunghezza utensile
if abs(vtN:getZ()) > abs(vtN:getY()) then
dExtraElevDn = ((( dThDiamDn - dToolDiamDn) * 0.5) - dDistRadThDn) * abs(vtN:getY()) / abs(vtN:getZ()) + ( 0.5 * dExtraForSafety) / abs(vtN:getY())
-- altrimenti premio extra sicurezza su raggio utensile
else
dExtraElevDn = ((( dThDiamDn + dExtraForSafety - dToolDiamDn) * 0.5) - dDistRadThDn) * abs(vtN:getY()) / abs(vtN:getZ())
end
elseif abs(dDistSurfDn) < GEO.EPS_SMALL then
dDistSurfDn = Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()
if dDistSurfDn * abs(vtN:getZ()) > (( dThDiamDn + dToolDiamDn) * 0.5) then
dExtraElevDn = dDistSurfDn * abs(vtN:getY())
end
end
end
end
if BD.DOWN_HEAD and k == 2 and nSide ~= 1 then
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth2Dn - dExtraElevDn)
dExtraElevDn_1st = dExtraElevDn
if dExtraElevDn > 0 and sWarn and #sWarn < 1 then
sWarn = 'Warning in LongCut_2 : depth is bigger than max tool depth'
end
else
EgtSetMachiningParam( MCH_MP.DEPTH, EgtIf( k == 1, dDepth, dDepth2) - dExtraElev)
dExtraElev_1st = dExtraElev
if dExtraElev > 0 and sWarn and #sWarn < 1 then
sWarn = 'Warning in LongCut : depth is bigger than max tool depth'
end
end
-- assegbo attacco perpendicolare
EgtSetMachiningParam( MCH_MP.LIPERP, dLioPerp1) EgtSetMachiningParam( MCH_MP.LIPERP, dLioPerp1)
EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp1) EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp1)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
-- se feature orientata su faccia da sotto provo a cambiare l'attacco -- se feature orientata su faccia da sotto provo a cambiare l'attacco
if nSide == -1 then if nSide == -1 then
EgtSetMachiningParam( MCH_MP.LIPERP, min( dLioPerp1, dLioPerp2)) EgtSetMachiningParam( MCH_MP.LIPERP, min( dLioPerp1, dLioPerp2))
EgtSetMachiningParam( MCH_MP.LOPERP, min( dLioPerp1, dLioPerp2)) EgtSetMachiningParam( MCH_MP.LOPERP, min( dLioPerp1, dLioPerp2))
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
-- esco se non sono nella seconda lavorazione o non nella faccia da sotto -- esco se non sono nella seconda lavorazione o non nella faccia da sotto
+163 -156
View File
@@ -1,14 +1,9 @@
-- ProcessLongDoubleCut.lua by Egaltech s.r.l. 2022/06/29 -- ProcessLongDoubleCut.lua by Egaltech s.r.l. 2021/11/08
-- Gestione calcolo doppio taglio longitudinale per Travi -- Gestione calcolo doppio taglio longitudinale per Travi
-- 2021/05/18 Possibile taglio con lama anche di fianco su macchina con testa da sotto. -- 2021/05/18 Possibile taglio con lama anche di fianco su macchina con testa da sotto.
-- 2021/06/29 Corretta gestione caso equivalente a due smussi. -- 2021/06/29 Corretta gestione caso equivalente a due smussi.
-- 2021/10/29 Aggiunta opzione tipo lavorazione 'LongCut'. -- 2021/10/29 Aggiunta opzione tipo lavorazione 'LongCut'.
-- 2021/11/08 Se con lama e flag BD.USE_LONGCUT si lavora in direzione contraria allo standard. -- 2021/11/08 Se con lama e flag BD.USE_LONGCUT si lavora in direzione contraria allo standard.
-- 2022/02/08 Sistemate lunghezze fresature quando due sole.
-- 2022/02/15 Sistemati commenti.
-- 2022/03/20 Tolta da scelta milling tipo Long2CutDown controllo max diametro fresa.
-- 2022/05/27 Corretto ordine per casi sui lati.
-- 2022/06/29 Corretto calcolo lunghezza attacco/uscita perpendicolare per lavorazioni di fianco.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessLong2Cut = {} local ProcessLong2Cut = {}
@@ -146,7 +141,7 @@ local function MakeSideFace( nId, nFac, nSide, sMilling, dToolDiam, nL2CSide)
EgtSetMachiningParam( MCH_MP.STARTPOS, 80) EgtSetMachiningParam( MCH_MP.STARTPOS, 80)
end end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -157,9 +152,8 @@ end
-- Applicazione della lavorazione -- Applicazione della lavorazione
local function MakeByPocketing( Proc, nPhase, nRawId, nPartId, nSide, nFacInd, dFacElev) local function MakeByPocketing( Proc, nPhase, nRawId, nPartId, nSide, nFacInd, dFacElev)
-- cerco la svuotatura opportuna -- cerco la svuotatura opportuna
local bDownHead = nSide ~=1 and BD.DOWN_HEAD local sPockType = EgtIf( nSide ~=1 and BD.DOWN_HEAD, 'OpenPocket_H2', 'OpenPocket')
local sPockType = EgtIf( bDownHead, 'OpenPocket_H2', 'OpenPocket') local sPocketing = ML.FindPocketing( sPockType, Proc.Box:getDimX())
local sPocketing = ML.FindPocketing( sPockType, Proc.Box:getDimX(), nil, nil, not bDownHead, bDownHead)
if not sPocketing then if not sPocketing then
local sErr = 'Error : OpenPocket not found in library' local sErr = 'Error : OpenPocket not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -200,10 +194,10 @@ local function MakeByPocketing( Proc, nPhase, nRawId, nPartId, nSide, nFacInd, d
sNotes = sNotes .. 'VMRS=0;' sNotes = sNotes .. 'VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( 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)
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -256,7 +250,7 @@ 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)) or ( vtN2 and vtN2:getZ() >= -0.5) then
bCanUseBlade = true bCanUseBlade = true
end end
end end
@@ -296,9 +290,9 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- verifico posizione (+1=sopra, -1=sotto, 0=sui lati) -- verifico posizione (+1=sopra, -1=sotto, 0=sui lati)
local nSide = 0 local nSide = 0
if vtN[1]:getZ() > 0.0175 and vtN[2]:getZ() > 0.0175 then if vtN[1]:getZ() > -10 * GEO.EPS_SMALL and vtN[2]:getZ() > -10 * GEO.EPS_SMALL then
nSide = 1 nSide = 1
elseif vtN[1]:getZ() < -0.0175 and vtN[2]:getZ() < -0.0175 then elseif vtN[1]:getZ() < 10 * GEO.EPS_SMALL and vtN[2]:getZ() < 10 * GEO.EPS_SMALL then
nSide = -1 nSide = -1
end end
@@ -307,21 +301,39 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
local bConvex local bConvex
local bOrtho local bOrtho
local ptM local ptM
local ptRef = ( ptC[1] + ptC[2]) / 2
if bInt then if bInt then
bConvex = ( dAng >= 0) bConvex = ( dAng >= 0)
bOrtho = ( abs( dAng + 90) < 1) bOrtho = ( abs( dAng + 90) < 1)
ptM = ( ptP1 + ptP2) / 2 ptM = ( ptP1 + ptP2) / 2
else else
ptM = ptRef bConvex = true
local vtM1 = ptC[1] - ptM ; vtM1:normalize()
local vtM2 = ptC[2] - ptM ; vtM2:normalize()
bConvex = ( vtM1 * vtN[1] > 0 and vtM2 * vtN[2] > 0)
bOrtho = false bOrtho = false
dAng = acos( vtN[1] * vtN[2]) dAng = acos( vtN[1] * vtN[2])
-- se facce contrapposte e quindi concavo, angolo sempre negativo ptM = ( ptC[1] + ptC[2]) / 2
if not bConvex and dAng > 0 then dAng = -dAng end
end end
local ptRef = ( ptC[1] + ptC[2]) / 2
-- analisi del taglio
local vOrd = {}
local vFaceUse = {}
if nSide == 1 or ( nSide == -1 and BD.DOWN_HEAD) then
vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1})
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
elseif nSide == -1 then
vOrd = EgtIf( ptC[1]:getY() < ptM:getY(), { 1, 2}, { 2, 1})
vFaceUse = { BL.GetNearestParalOpposite( ptC[1] - ptM), BL.GetNearestParalOpposite( ptC[2] - ptM)}
else
local bFront = ( vtN[1]:getY() < 0)
if bFront then
vOrd = EgtIf( ptC[1]:getZ() < ptM:getZ(), { 1, 2}, { 2, 1})
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
else
vOrd = EgtIf( ptC[1]:getZ() < ptM:getZ(), { 2, 1}, { 1, 2})
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
end
end
local vWidth = {}
_, _, vWidth[1] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[1])
_, _, vWidth[2] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[2])
-- ottengo la distanza tra la fine del pezzo e il pezzo successivo -- ottengo la distanza tra la fine del pezzo e il pezzo successivo
local dDistToNextPiece = EgtGetInfo( nRawId, 'BDST', 'd') or 5.4 local dDistToNextPiece = EgtGetInfo( nRawId, 'BDST', 'd') or 5.4
@@ -353,41 +365,23 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- verifico se posso usare lame -- verifico se posso usare lame
local bCanUseBlade, bCanUseUnderBlade = CalcBladeUse( bUseBlade, BD.DOWN_HEAD, nSide, vtN[1], vtN[2], bConvex) local bCanUseBlade, bCanUseUnderBlade = CalcBladeUse( bUseBlade, BD.DOWN_HEAD, nSide, vtN[1], vtN[2], bConvex)
-- introduco messaggi di errore in caso sia settata la lama ma impossibile utilizzarla -- introduco messaggi di errore in caso sia settata la lama ma impossibile utilizzarla
-- se si toglie questa parte il processo continua utilizzando però la fresa ma per il vincolo del parametro Q non è possibile -- se si toglie questa parte il processo continua utilizzandi però la fresa ma per il vincolo del parametro Q non è possibile
if bUseBlade and not BD.DOWN_HEAD and not bCanUseBlade then if bUseBlade and not BD.DOWN_HEAD and not bCanUseBlade then
local sErr = 'Error, impossible use blade on too negative face' local sErr = 'Error, impossible use blade on too negative face'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
-- elseif bUseBlade and not bCanUseBlade then
-- local sErr = 'Error, impossible use blade'
-- EgtOutLog( sErr)
-- return false, sErr
elseif bUseBlade and BD.DOWN_HEAD and not bCanUseBlade and not bCanUseUnderBlade then elseif bUseBlade and BD.DOWN_HEAD and not bCanUseBlade and not bCanUseUnderBlade then
local sErr = 'Error, impossible use blade' local sErr = 'Error, impossible use blade'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- analisi del taglio
local vOrd = {}
local vFaceUse = {}
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})
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
elseif nSide == -1 then
vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1})
vFaceUse = { BL.GetNearestParalOpposite( ptC[1] - ptM), BL.GetNearestParalOpposite( ptC[2] - ptM)}
else
local bFront = ( vtN[1]:getY() < 0 or vtN[2]:getY() < 0)
if bFront then
vOrd = EgtIf( ptC[1]:getZ() < ptRef:getZ(), { 1, 2}, { 2, 1})
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
else
vOrd = EgtIf( ptC[1]:getZ() < ptRef:getZ(), { 2, 1}, { 1, 2})
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
end
end
local vWidth = {}
_, _, vWidth[1] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[1])
_, _, vWidth[2] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[2])
-- Se senza facce limitanti, da sopra o ( da tutte i lati con testa da sotto) e taglio di lama e lunghezza facce maggiore del parametro lunghezza minima -- Se senza facce limitanti, da sopra o ( da tutte i lati con testa da sotto) e taglio di lama e lunghezza facce maggiore del parametro lunghezza minima
-- if nFaceLimit == 0 and ( nSide == 1 or ( abs(nSide) >= 0 and BD.DOWN_HEAD)) and bUseBlade and Proc.Box:getDimX() > dLimMinPiece - 1 then
if nFaceLimit == 0 and ( bCanUseUnderBlade or bCanUseBlade) and bUseBlade and Proc.Box:getDimX() > dLimMinPiece - 1 then if nFaceLimit == 0 and ( bCanUseUnderBlade or bCanUseBlade) and bUseBlade and Proc.Box:getDimX() > dLimMinPiece - 1 then
local sCutting local sCutting
@@ -400,7 +394,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
local dMaxDepthDn = 0 local dMaxDepthDn = 0
-- recupero la lavorazione -- recupero la lavorazione
if bCanUseUnderBlade then if bCanUseUnderBlade then
sCuttingDn = ML.FindCutting( 'HeadSide_H2', false, true) sCuttingDn = ML.FindCutting( 'HeadSide_H2')
if not sCuttingDn then if not sCuttingDn then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' sawing underneath not found in library' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' sawing underneath not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -509,7 +503,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
dC = dCDn dC = dCDn
end end
-- uso codolo piccolo -- disabilitato la selezione del codolo, prende sempre quello più piccolo. Non cancellare quello disabiliato in caso di ripristino
-- local dDimStrip = EgtIf( nSide ~= 0, BD.DIM_STRIP_SMALL, BD.DIM_STRIP)
local dDimStrip = BD.DIM_STRIP_SMALL * EgtIf( nSide == -1, -1, 1) local dDimStrip = BD.DIM_STRIP_SMALL * EgtIf( nSide == -1, -1, 1)
local nM = 0 local nM = 0
-- se convesso lavoro ogni faccia in due metà lasciando attaccata la parte centrale -- se convesso lavoro ogni faccia in due metà lasciando attaccata la parte centrale
@@ -577,6 +572,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
local nMchFId local nMchFId
local sCuttingName local sCuttingName
local bMachDown local bMachDown
-- if ( k == 1 and bCanUseBlade) or ( k == 2 and ( bCanUseBlade and not bCanUseUnderBlade)) then
if bCanUseBlade and not bCanUseUnderBlade then if bCanUseBlade and not bCanUseUnderBlade then
sNameF = 'L2C_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM) sNameF = 'L2C_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM)
nMchFId = EgtAddMachining( sNameF, sCutting) nMchFId = EgtAddMachining( sNameF, sCutting)
@@ -584,6 +580,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- setto le variabili delle distanze dagli estremi -- setto le variabili delle distanze dagli estremi
dEndAccDist = dEndAccDistUp dEndAccDist = dEndAccDistUp
dStartAccDist = dStartAccDistUp dStartAccDist = dStartAccDistUp
-- elseif ( k == 2 and bCanUseUnderBlade) or ( k == 1 and ( bCanUseUnderBlade and not bCanUseBlade)) then
elseif bCanUseUnderBlade and not bCanUseBlade then elseif bCanUseUnderBlade and not bCanUseBlade then
sNameF = 'L2CD_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM) sNameF = 'L2CD_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM)
nMchFId = EgtAddMachining( sNameF, sCuttingDn) nMchFId = EgtAddMachining( sNameF, sCuttingDn)
@@ -680,6 +677,15 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
dSal, dEal = dEal, dSal dSal, dEal = dEal, dSal
end end
if bCanUseBlade and bCanUseUnderBlade then if bCanUseBlade and bCanUseUnderBlade then
-- if bCanUseBlade and nSide == -1 then
-- EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- else
-- EgtSetMachiningParam( MCH_MP.INVERT, true)
-- EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- dSal, dEal = dEal, dSal
-- end
-- -- imposto uso della faccia
-- EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse2, nFaceUse))
if bCanUseBlade and nSide == -1 then if bCanUseBlade and nSide == -1 then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- imposto uso della faccia -- imposto uso della faccia
@@ -723,7 +729,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- 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)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -762,7 +768,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- se faccia da sotto e Z centro faccia è minore del centro altra faccia, segno il limite angolare da passare -- se faccia da sotto e Z centro faccia è minore del centro altra faccia, segno il limite angolare da passare
-- dovrebbe essere il limite angolare della testa 1 in sottosquadra -- dovrebbe essere il limite angolare della testa 1 in sottosquadra
if nSide == -1 and not BD.DOWN_HEAD then if nSide == -1 and not BD.DOWN_HEAD then
if ptC[vOrd[j]]:getZ() < ptC[vOrd[OthFace]]:getZ() - 1. then if ptC[vOrd[j]]:getZ() < ptC[vOrd[OthFace]]:getZ() then
dSinLimit = -0.0157 dSinLimit = -0.0157
else else
dSinLimit = -0.5 dSinLimit = -0.5
@@ -852,7 +858,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- determino e imposto l'utilizzo della faccia -- determino e imposto l'utilizzo della faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse[vOrd[j]]) EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse[vOrd[j]])
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -860,9 +866,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end end
end end
end end
-- se non è sotto e non uso fresa di fianco: lavorazione Long2Cut -- se non è sotto e non uso fresa di fianco: lavorazione Long2Cut
elseif ( nSide ~= -1 or BD.DOWN_HEAD or BD.TURN) and nUseMillOnSide == 0 then elseif ( ( nSide ~= -1 or BD.DOWN_HEAD) or ( nSide == -1 and BD.DOWN_HEAD)) and nUseMillOnSide == 0 then
-- determino la massima elevazione -- determino la massima elevazione
local dElev = 0 local dElev = 0
local dFacElev1 = BL.GetFaceElevation( Proc.Id, tFaceLong[1], nPartId) local dFacElev1 = BL.GetFaceElevation( Proc.Id, tFaceLong[1], nPartId)
@@ -876,8 +881,11 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end end
-- recupero la lavorazione -- recupero la lavorazione
local sMilling local sMilling
local bDownHead = ( nSide == -1 and BD.DOWN_HEAD) if nSide == -1 and BD.DOWN_HEAD then
sMilling = ML.FindMilling( 'Long2Cut', dElev, nil, nil, nil, not bDownHead, bDownHead) sMilling = ML.FindMilling( 'Long2Cut_H2', dElev)
else
sMilling = ML.FindMilling( 'Long2Cut', dElev)
end
if not sMilling then if not sMilling then
local sErr = 'Error : Long2Cut not found in library' local sErr = 'Error : Long2Cut not found in library'
@@ -900,10 +908,10 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end end
end end
-- se ho un pezzo successivo più distante di metà raggio : setto la fine come limitata -- se la fine (a sinistra) non è limitata e ho un pezzo successivo più distante da metà raggio. setto la fine come limitata
if dDistToNextPiece < dToolDiam/2 then if dDistToNextPiece < dToolDiam/2 and nFaceLimit < 2 then
bForcedLim = true bForcedLim = true
nFaceLimit = nFaceLimit | 2 nFaceLimit = nFaceLimit + 2
end end
-- 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
@@ -939,10 +947,10 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
local nIncStep = 2 local nIncStep = 2
if bStartFixed and bEndFixed then if bStartFixed and bEndFixed then
dC = ( dLen - dStartAccDist - dEndAccDist) / nC dC = ( dLen - dStartAccDist - dEndAccDist) / nC
-- se distanza rimanente è < della metà del minimo della distanza estremi allora aggiungo un solo passo in più -- se distanza rimanente è < della metà del minimo della distanza estremi allora aggiungo un passo in più
local dMinDist = EgtIf( min( dStartAccDist, dEndAccDist) / 2 > 300 , 300, min( dStartAccDist, dEndAccDist) / 2) local dMinDist = EgtIf( min( dStartAccDist, dEndAccDist) / 2 > 300 , 300, min( dStartAccDist, dEndAccDist) / 2)
if dC < dMinDist then if dC < dMinDist then
dC = dLen / ( nC + 1) dC = dLen / ( nC + 2)
dStartAccDist = dC dStartAccDist = dC
dEndAccDist = dC dEndAccDist = dC
nIncStep = 1 nIncStep = 1
@@ -1024,10 +1032,6 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end end
end end
end end
if nIni == 2 then
dStartDist, dEndDist = dEndDist, dStartDist
dStartAccDist, dEndAccDist = dEndAccDist, dStartAccDist
end
-- ciclo sulle parti -- ciclo sulle parti
local nM = 0 local nM = 0
for j = 1, nC do for j = 1, nC do
@@ -1036,7 +1040,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- 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 ( nSide == -1 and ( BD.DOWN_HEAD or BD.TURN))) local bSide = ( vtN[vOrd[i]]:getZ() < dLimitAngle and not ( nSide == -1 and BD.DOWN_HEAD))
-- 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))
@@ -1044,17 +1048,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- Posizione braccio portatesta -- Posizione braccio portatesta
local nSCC = MCH_SCC.NONE local nSCC = MCH_SCC.NONE
if not BD.C_SIMM then if not BD.C_SIMM then
if not BD.TURN then nSCC = EgtIf( ( j == 1 or j == nC - 1), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
nSCC = EgtIf( ( j == 1 or j == nC - 1), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
else
if nSide == 1 then
nSCC = EgtIf( vtN[vOrd[i]]:getY() < -0.5, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)
elseif nSide == -1 then
nSCC = EgtIf( vtN[vOrd[i]]:getY() < 0, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)
else
nSCC = MCH_SCC.ADIR_ZP
end
end
end end
if bSide and not bConvex then if bSide and not bConvex then
dSal, dEal = dEal, dSal dSal, dEal = dEal, dSal
@@ -1116,7 +1110,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
EgtSetMachiningParam( MCH_MP.STARTPOS, 80) EgtSetMachiningParam( MCH_MP.STARTPOS, 80)
end end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -1132,8 +1126,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end end
end end
end end
-- altrimenti è sotto : lavorazione Long2CutDown
-- altrimenti lavorazione di fianco : Long2CutSide o Long2CutDown
else else
-- da Analisi con Fabio Squaratti 15/09/2020 -- da Analisi con Fabio Squaratti 15/09/2020
-- variabile che indica se ripassare sul raggio rimasto dalla lavorazione di fianco -- variabile che indica se ripassare sul raggio rimasto dalla lavorazione di fianco
@@ -1143,27 +1136,26 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- se nExtendMach = 2 la lavorazione viene estesa ma arretra per non segnare il pezzo successivo (se non ha facce limite) -- se nExtendMach = 2 la lavorazione viene estesa ma arretra per non segnare il pezzo successivo (se non ha facce limite)
local nExtendMach local nExtendMach
-- recupero la lavorazione -- recupero la lavorazione
local sMchType, sMchTypeDn local sMilling
local sMilling, sMillingDn local sMillingDn
local sPrefix, sPrefixDn local sPrefix
local sPrefixDn
if nSide ~= - 1 then if nSide ~= - 1 then
sMchType = 'Long2CutSide' sMilling = ML.FindMilling( 'Long2CutSide')
sMilling = ML.FindMilling( sMchType)
sPrefix = 'L2CS_' sPrefix = 'L2CS_'
nExtendMach = nUseMillOnSide nExtendMach = nUseMillOnSide
if nUseMillOnSide == 2 then if nUseMillOnSide == 2 then
bRemoveToolRadius = true bRemoveToolRadius = true
-- nExtendMach = 0 -- arretro la lavorazione del raggio utensile (se non ha facce limite)
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
sMchTypeDn = 'Long2CutSide_H2' sMillingDn = ML.FindMilling( 'Long2CutSide_H2')
sMillingDn = ML.FindMilling( sMchTypeDn, nil, nil, nil, nil, false, true)
sPrefixDn = 'L2CSH2_' sPrefixDn = 'L2CSH2_'
end end
-- lavorazione da sotto -- lavorazione da sotto
else else
sMchType = 'Long2CutDown' sMilling = ML.FindMilling( 'Long2CutDown', nil, nil, EgtIf( nUseMillOnSide > 0, 150, 50))
sMilling = ML.FindMilling( sMchType)
sPrefix = 'L2CD_' sPrefix = 'L2CD_'
nExtendMach = 1 nExtendMach = 1
if nUseMillOnSide ~= 1 then if nUseMillOnSide ~= 1 then
@@ -1171,18 +1163,17 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end end
-- se testa da sotto -- se testa da sotto
if BD.DOWN_HEAD then if BD.DOWN_HEAD then
sMchTypeDn = 'Long2CutDown_H2' sMillingDn = ML.FindMilling( 'Long2CutDown_H2')
sMillingDn = ML.FindMilling( sMchTypeDn, nil, nil, nil, nil, false, true)
sPrefixDn = 'L2CDH2_' sPrefixDn = 'L2CDH2_'
end end
end end
if not sMilling and ( nSide == 1 or not BD.DOWN_HEAD) then if not sMilling then
local sErr = 'Error : milling '..sMchType..' not found in library' local sErr = 'Error : Long2CutSide or Long2CutDown not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
if not sMilling and not sMillingDn then if nSide ~= 1 and BD.DOWN_HEAD and not sMillingDn then
local sErr = 'Error : milling '..sMchType..' and '..sMchTypeDn..' not found in library' local sErr = 'Error : Long2CutSide_H2 or Long2CutDown_H2 not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -1272,43 +1263,20 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
local nC = ceil( ( dLen - dStartAccDist - dEndAccDist) / BD.LONGCUT_MAXLEN) local nC = ceil( ( dLen - dStartAccDist - dEndAccDist) / BD.LONGCUT_MAXLEN)
local dC = 0 local dC = 0
if nC > 0 then if nC > 0 then
local nIncStep = 2
if bStartFixed and bEndFixed then if bStartFixed and bEndFixed then
dC = ( dLen - dStartAccDist - dEndAccDist) / nC dC = ( dLen - dStartAccDist - dEndAccDist) / nC
-- se distanza rimanente è < della metà del minimo della distanza estremi allora aggiungo un solo passo in più
local dMinDist = EgtIf( min( dStartAccDist, dEndAccDist) / 2 > 300 , 300, min( dStartAccDist, dEndAccDist) / 2)
if dC < dMinDist then
dC = dLen / ( nC + 1)
dStartAccDist = dC
dEndAccDist = dC
nIncStep = 1
elseif dC < min( dStartAccDist, dEndAccDist) then
dC = dLen / ( nC + 2)
dStartAccDist = dC
dEndAccDist = dC
end
elseif bStartFixed then elseif bStartFixed then
dC = ( dLen - dStartAccDist) / ( nC + 1) dC = ( dLen - dStartAccDist) / ( nC + 1)
dEndAccDist = dC dEndAccDist = dC
if dC < dStartAccDist then
dC = dLen / ( nC + 2)
dStartAccDist = dC
dEndAccDist = dC
end
elseif bEndFixed then elseif bEndFixed then
dC = ( dLen - dEndAccDist) / ( nC + 1) dC = ( dLen - dEndAccDist) / ( nC + 1)
dStartAccDist = dC dStartAccDist = dC
if dC < dEndAccDist then
dC = dLen / ( nC + 2)
dStartAccDist = dC
dEndAccDist = dC
end
else else
dC = dLen / ( nC + 2) dC = dLen / ( nC + 2)
dStartAccDist = dC dStartAccDist = dC
dEndAccDist = dC dEndAccDist = dC
end end
nC = nC + nIncStep nC = nC + 2
else else
if dLen > min( dStartAccDist, dEndAccDist) then if dLen > min( dStartAccDist, dEndAccDist) then
nC = 2 nC = 2
@@ -1409,7 +1377,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
if BD.DOWN_HEAD and nSide ~= 1 then if BD.DOWN_HEAD and nSide ~= 1 then
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 d a sopra o da sotto
if ( not bConvex and vtN[vOrd[i]]:getZ() > -0.9397 and ptDir:getZ() > 0) 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)
@@ -1449,41 +1417,64 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- se fresa di fianco e non da sotto -- se fresa di fianco e non da sotto
if nUseMillOnSide > 0 and nSide ~= -1 then if nUseMillOnSide > 0 and nSide ~= -1 then
if bConvex then -- se faccia da sopra o di fianco
local vFaceUse2 if nSide >= 0 then
-- se da sopra if bConvex then
if nSide == 1 then local vFaceUse2
if vtN[vOrd[i]]:getZ() > 0.866 then -- se da sopra
vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 1, 2)], vtN[EgtIf(vOrd[i] == 1, 2, 1)]) if nSide == 1 then
EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse2) if vtN[vOrd[i]]:getZ() > 0.866 then
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal) vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 1, 2)], vtN[EgtIf(vOrd[i] == 1, 2, 1)])
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal) EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse2)
-- EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_TOP)
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
else
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN)
end
-- altrimenti è di fianco
else else
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN) if vtN[vOrd[i]]:getY() > 0.866 then
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_TOP)
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
else
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN)
end
end end
-- altrimenti è di fianco -- se concavo
else else
if vtN[vOrd[i]]:getY() > 0.866 then local vFaceUse2
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_TOP) -- se da sopra
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal) if nSide == 1 then
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal) -- vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)])
vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)], vtN[EgtIf(vOrd[i] == 1, 1, 2)])
-- altrimenti è di fianco
else else
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN) vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)])
end end
EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse2)
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
end end
-- se concavo -- questa parte non viene mai eseguita
else -- se faccia da sotto
local vFaceUse2 -- else
-- se da sopra -- if bConvex then
if nSide == 1 then -- EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN)
vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)], vtN[EgtIf(vOrd[i] == 1, 1, 2)]) -- if vtN[vOrd[i]]:getZ() >= 0 then
-- altrimenti è di fianco -- EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
else -- EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)]) -- end
end -- else
EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse2) -- -- lascio lo stesso le lavorazioni anche se viene intercettato l'errore
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal) -- local vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)])
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal) -- EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse2)
-- if vtN[vOrd[i]]:getZ() < 0 then
-- EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
-- EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
-- end
-- end
end end
else else
-- se con fresa di fianco -- se con fresa di fianco
@@ -1501,6 +1492,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end end
else else
-- lascio lo stesso le lavorazioni anche se viene intercettato l'errore -- lascio lo stesso le lavorazioni anche se viene intercettato l'errore
-- local vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)])
local vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)], vtN[EgtIf(vOrd[i] == 1, 1, 2)]) local vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)], vtN[EgtIf(vOrd[i] == 1, 1, 2)])
EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse2) EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse2)
if vtN[vOrd[i]]:getZ() < 0 then if vtN[vOrd[i]]:getZ() < 0 then
@@ -1526,11 +1518,14 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- 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())
local dNz = EgtIf( abs(nSide) == 1, vtN[vOrd[i]]:getY(), vtN[vOrd[i]]:getZ()) local dNz = EgtIf( abs(nSide) == 1, vtN[vOrd[i]]:getY(), vtN[vOrd[i]]:getZ())
local dNzMin = EgtIf( abs(vtN[vOrd[i]]:getY()) >= abs(vtN[vOrd[i]]:getZ()), vtN[vOrd[i]]:getY(), vtN[vOrd[i]]:getZ()) local dNzMin = EgtIf( abs(vtN[vOrd[i]]:getY()) >= abs(vtN[vOrd[i]]:getZ()), vtN[vOrd[i]]:getY(), vtN[vOrd[i]]:getZ())
local dLioPerp1, dLioPerp2
-- nel caso concavo, devo impostare la lunghezza di attacco ortogonale -- nel caso concavo, devo impostare la lunghezza di attacco ortogonale
if not bConvex then if not bConvex then
local dLioPerp = EgtIf( i == 1, dFacElev1, dFacElev2) + BD.COLL_SIC dLioPerp1 = EgtIf( i == 1, dFacElev1, dFacElev2)
EgtSetMachiningParam( MCH_MP.LIPERP, dLioPerp) -- dLioPerp1 = vWidth[vOrd[i]] * EgtIf( abs(dNz) < GEO.EPS_SMALL, 1, sqrt( 1 - dNz * dNz) / abs( dNz)) + BD.COLL_SIC
EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp) dLioPerp2 = vWidth[ EgtIf( vOrd[i] == 1, 2,1)] + BD.COLL_SIC
EgtSetMachiningParam( MCH_MP.LIPERP, max( dLioPerp1, dLioPerp2))
EgtSetMachiningParam( MCH_MP.LOPERP, max( dLioPerp1, dLioPerp2))
end end
-- verifico massimo affondamento (tengo conto dell'inclinazione utensile e della pinza con estremità conica) -- verifico massimo affondamento (tengo conto dell'inclinazione utensile e della pinza con estremità conica)
-- 08/09/2020 tolti i 3mm ( per la ghiera smussata) perchè nella verifica collisione vine creato un cilindro non smussato che rileva la collisione -- 08/09/2020 tolti i 3mm ( per la ghiera smussata) perchè nella verifica collisione vine creato un cilindro non smussato che rileva la collisione
@@ -1558,11 +1553,23 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
dDepth2 = vWidth[vOrd[i]] + dAgg - dDepth dDepth2 = vWidth[vOrd[i]] + dAgg - dDepth
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth - dExtraElev) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth - dExtraElev)
end end
-- EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() -- se feature orientata su faccia da sotto e concave provo a cambiare l'attacco
EgtSetOperationMode( nMchFId, false) if nSide == -1 and not bConvex then
return false, sErr EgtSetMachiningParam( MCH_MP.LIPERP, dLioPerp1)
EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp1)
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
else
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end end
-- se facce principali convesse, eventuale lavorazione della faccia limitante l'inizio (a destra) -- se facce principali convesse, eventuale lavorazione della faccia limitante l'inizio (a destra)
if bConvex and j == 1 and not bStartFixed and bRemoveToolRadius then if bConvex and j == 1 and not bStartFixed and bRemoveToolRadius then
+9 -6
View File
@@ -1,4 +1,4 @@
-- ProcessMark.lua by Egaltech s.r.l. 2022/06/07 -- ProcessMark.lua by Egaltech s.r.l. 2021/05/03
-- Gestione calcolo marcatura per Travi -- Gestione calcolo marcatura per Travi
-- 2020/05/28 Tipo di lavorazione passato da Mark a Text. -- 2020/05/28 Tipo di lavorazione passato da Mark a Text.
-- 2021/05/03 Aggiunta gestione testa da sotto. -- 2021/05/03 Aggiunta gestione testa da sotto.
@@ -60,7 +60,7 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId)
return false, sErr return false, sErr
end end
-- verifico che la marcatura non sia orientata verso il basso (-5 deg) -- verifico che la marcatura non sia orientata verso il basso (-5 deg)
if vtExtr:getZ() < - 0.1 and not BD.DOWN_HEAD and not BD.TURN then if vtExtr:getZ() < - 0.1 and not BD.DOWN_HEAD then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Mark from bottom impossible' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Mark from bottom impossible'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
@@ -70,8 +70,11 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId)
local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174) local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174)
-- recupero la lavorazione -- recupero la lavorazione
local sMillType = 'Text' local sMillType = 'Text'
--local sMchExt = EgtIf( bMillDown, '_H2', '') local sMchExt = EgtIf( bMillDown, '_H2', '')
local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown) local sMilling = ML.FindMilling( sMillType..sMchExt)
if not sMilling and bMillUp then
sMilling = ML.FindMilling( sMillType)
end
if not sMilling then if not sMilling then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -94,7 +97,7 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId)
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -118,7 +121,7 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId)
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchF2Id, false) EgtSetOperationMode( nMchF2Id, false)
return false, sErr return false, sErr
+14 -183
View File
@@ -2,8 +2,6 @@
-- Gestione calcolo mortase per Travi -- Gestione calcolo mortase per Travi
-- 2021/07/20 Aggiunta gestione rinvio angolare su FAST. -- 2021/07/20 Aggiunta gestione rinvio angolare su FAST.
-- 2021/12/01 Se frontale aggiungo taglio con Grp e Proc di vero taglio (per aggiornare ingombro di testa /coda). -- 2021/12/01 Se frontale aggiungo taglio con Grp e Proc di vero taglio (per aggiornare ingombro di testa /coda).
-- 2022/07/26 Aggiunta gestione del parametro P04=1 per la pulizia degli angoli con mortasatrice (sega a catena) specifica
-- 2022/07/29 Nella pulitura angoli aggiunto il check dimensioni tasca vs utensile. Corretta direzione utensile per mortasa frontale.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessMortise = {} local ProcessMortise = {}
@@ -81,155 +79,6 @@ function ProcessMortise.GetCutPlane( Proc)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Aggiunge la lavorazione di pulizia angoli
local function AddCleanCornersMachining( nProcId, sMortising, nWorkFaceInd, vtN, dDepth)
-- aggiungo la lavorazione
local sName = 'Mort_' .. ( EgtGetName( nProcId) or tostring( nProcId)) .. '_CleanCorners1'
local nMchFId = EgtAddMachining( sName, sMortising)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMortising
EgtOutLog( sErr)
return false, sErr
end
-- imposto geometria
EgtSetMachiningGeometry( {{ nProcId, nWorkFaceInd}})
-- imposto lato di lavoro e inversione
local vtFaceN = EgtSurfTmFacetNormVersor( nProcId, nWorkFaceInd, GDB_ID.ROOT)
local bInvert = ( vtFaceN:getZ() < -GEO.EPS_SMALL or vtFaceN:getY() > GEO.EPS_SMALL)
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bInvert, MCH_MORTISE_WS.LEFT, MCH_MORTISE_WS.RIGHT))
EgtSetMachiningParam( MCH_MP.INVERT, bInvert)
-- se richiesto, imposto affondamento
if dDepth then
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
end
-- imposto uso del lato faccia
local nFaceUse = BL.GetNearestParalOpposite( vtN)
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
sNotes = 'Plunge=3;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- imposto angolo 3° asse rot
local vtOrtho = BL.GetVersRef( nFaceUse)
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1))
-- calcolo la lavorazione
if not ML.ApplyMachining( true, false) then
if EgtGetOutstrokeInfo() then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
-- impostazione alternativa angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2))
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
if EgtIsMachiningEmpty() then
_, sWarn = EgtGetMachMgrWarning( 0)
EgtSetOperationMode( nMchFId, false)
return false, sWarn
end
return true, sWarn
end
---------------------------------------------------------------------
-- Pulizia angoli nel caso sia settato il parametro P04=1
local function CleanCorners( Proc, dMorH, vtN, bDoubleDir, AuxId)
-- verifico se è attiva la pulizia e se l'orientamento della feature è adeguato
local bCleanCorners = ( EgtGetInfo( Proc.Id, 'P04', 'i') == 1 and
( AreSameOrOppositeVectorApprox( vtN, X_AX()) or
AreSameOrOppositeVectorApprox( vtN, Y_AX()) or
AreSameOrOppositeVectorApprox( vtN, Z_AX())))
if not bCleanCorners then
EgtOutLog( 'Warning: mortising not aligned with XYZ axes, corner cleaning skipped')
return
end
-- cerco la lavorazione adatta
local sMortisingCleanCorners = ML.FindSawing( 'Mortising')
if not sMortisingCleanCorners then
EgtOutLog( 'Warning: mortising tool not found, corner cleaning skipped')
return
end
-- recupero i dati dell'utensile
local dSawWidth = 50
local dSawThick = 12
local dMaxDepth = 200
if EgtMdbSetCurrMachining( sMortisingCleanCorners) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dSawWidth = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawWidth
dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- se l'utensile non arriva in fondo, riduco l'affondamento
local sWarn
local dDepth
local bUseDoubleDir
if bDoubleDir then
if ( 2 * dMorH + dSawWidth / 2) > dMaxDepth + 10 * GEO.EPS_SMALL then
bUseDoubleDir = true
if ( dMorH + dSawWidth / 2) > dMaxDepth + 10 * GEO.EPS_SMALL then
dDepth = dMaxDepth
sWarn = 'Warning in corner cleaning with mortise: elevation (' .. EgtNumToString( dMorH + dSawWidth / 2, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
EgtOutLog( sWarn)
else
dDepth = dMorH + dSawWidth / 2
end
else
dDepth = 2 * dMorH + dSawWidth / 2
end
else
if dMorH > dMaxDepth + 10 * GEO.EPS_SMALL then
dDepth = dMaxDepth
sWarn = 'Warning in corner cleaning with mortise: elevation (' .. EgtNumToString( dMorH, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
EgtOutLog( sWarn)
end
end
-- verifico se la tasca ha dimensioni sufficienti per l'utensile
local nFlat = EgtSurfTmByFlatContour( EgtGetParent( AuxId), AuxId, 0.05)
local frMor, dMortiseWidth, dMortiseThick = EgtSurfTmFacetMinAreaRectangle( nFlat, 0, GDB_ID.ROOT)
if abs( frMor:getVersX() * X_AX()) < abs( frMor:getVersY() * X_AX()) then
dMortiseWidth, dMortiseThick = dMortiseThick, dMortiseWidth
end
EgtErase( nFlat)
if dSawWidth >= dMortiseWidth + 10 * GEO.EPS_SMALL or dSawThick >= dMortiseThick + 10 * GEO.EPS_SMALL then
sWarn = 'warning in corner cleaning with mortise: pocket too small'
EgtOutLog( sWarn)
return true, sWarn
end
-- cerco le due facce migliori da lavorare
local nWorkFaceInd, nWorkFaceInd2
if AreSameOrOppositeVectorApprox( vtN, X_AX()) then
nWorkFaceInd, _, _ = BL.FindFaceBestOrientedAsAxis( Proc, vtN ^ Y_AX())
nWorkFaceInd2, _, _ = BL.FindFaceBestOrientedAsAxis( Proc, vtN ^ Y_AX(), nWorkFaceInd)
else
nWorkFaceInd, _, _ = BL.FindFaceBestOrientedAsAxis( Proc, vtN ^ X_AX())
nWorkFaceInd2, _, _ = BL.FindFaceBestOrientedAsAxis( Proc, vtN ^ X_AX(), nWorkFaceInd)
end
-- lavoro la prima faccia
local bOk1, sErr = AddCleanCornersMachining( Proc.Id, sMortisingCleanCorners, nWorkFaceInd, vtN, dDepth)
-- lavoro la seconda faccia
local bOk2, sErr2 = AddCleanCornersMachining( Proc.Id, sMortisingCleanCorners, nWorkFaceInd2, vtN, dDepth)
if sErr2 then sErr = ( sErr or '') .. EgtIf( sErr, '\n', '') .. sErr2 end
-- se richiesto di lavorare dall'altra parte
if bUseDoubleDir then
local bOk3, sErr3 = AddCleanCornersMachining( Proc.Id, sMortisingCleanCorners, nWorkFaceInd, -vtN, dDepth)
if sErr3 then sErr = ( sErr or '') .. EgtIf( sErr, '\n', '') .. sErr3 end
local bOk4, sErr4 = AddCleanCornersMachining( Proc.Id, sMortisingCleanCorners, nWorkFaceInd2, -vtN, dDepth)
if sErr4 then sErr = ( sErr or '') .. EgtIf( sErr, '\n', '') .. sErr4 end
end
if not bOk1 or not bOk2 or not bOk3 or not bOk4 then
return false, sErr
end
return true, sWarn
end
---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- ingombro del pezzo -- ingombro del pezzo
@@ -308,7 +157,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local dMove = bxMin:getZ()-bxMax:getZ() local dMove = bxMin:getZ()-bxMax:getZ()
-- se il percorso ausiliario è esterno al grezzo, lo riavvicino -- se il percorso ausiliario è esterno al grezzo, lo riavvicino
if abs( dMove) > GEO.EPS_SMALL then if abs( dMove) > GEO.EPS_SMALL then
AuxId = EgtCopyGlob( AuxId, BL.GetAddGroup( nPartId)) AuxId = EgtCopyGlob( AuxId, BL.GetAddGroup(nPartId))
EgtMove( AuxId, Vector3d(0,0,-dMove)) EgtMove( AuxId, Vector3d(0,0,-dMove))
EgtMove( nFlat, Vector3d(0,0,-dMove)) EgtMove( nFlat, Vector3d(0,0,-dMove))
frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( nFlat, 0, GDB_ID.ROOT) frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( nFlat, 0, GDB_ID.ROOT)
@@ -323,8 +172,8 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3) EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3)
-- Se mortasa chiusa -- Se mortasa chiusa
if not bOpenBtm then if not bOpenBtm then
-- verifico che la mortasa non sia orientata verso il basso (limite -5 deg) o che ci sia una testa da sotto o un rinvio angolare o macchina Turn -- verifico che la mortasa non sia orientata verso il basso (limite -5 deg) o che ci sia una testa da sotto o un rinvio angolare
if vtN:getZ() < -0.1 and not BD.DOWN_HEAD and not BD.ANG_TRASM and not BD.TURN then if vtN:getZ() < -0.1 and not BD.DOWN_HEAD and not BD.ANG_TRASM then
local sErr = 'Error : Mortise from bottom impossible' local sErr = 'Error : Mortise from bottom impossible'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
@@ -349,7 +198,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- 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
local sErr = 'Error : missing AddGroup' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -387,14 +236,14 @@ 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 = ML.FindPocketing( sPockType..sMchExt, dW, nil, nil, not bPockDown, bPockDown) sPocketing = ML.FindPocketing( sPockType..sMchExt, dW)
if not sPocketing and bPockUp then if not sPocketing and bPockUp then
sPocketing = ML.FindPocketing( sPockType, dW) sPocketing = ML.FindPocketing( sPockType, dW)
end end
end end
if not sPocketing then if not sPocketing then
sPockType = 'Pocket' sPockType = 'Pocket'
sPocketing = ML.FindPocketing( sPockType..sMchExt, dW, nil, nil, not bPockDown, bPockDown) sPocketing = ML.FindPocketing( sPockType..sMchExt, dW)
if not sPocketing and bPockUp then if not sPocketing and bPockUp then
sPocketing = ML.FindPocketing( sPockType, dW) sPocketing = ML.FindPocketing( sPockType, dW)
end end
@@ -437,12 +286,8 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local nSCC = MCH_SCC.NONE local nSCC = MCH_SCC.NONE
if bPockAngTrasm then if bPockAngTrasm then
nSCC = MCH_SCC.ADIR_NEAR nSCC = MCH_SCC.ADIR_NEAR
elseif not BD.C_SIMM then elseif not BD.C_SIMM then
if abs( vtN:getX()) < GEO.EPS_SMALL and abs( vtN:getY()) < GEO.EPS_SMALL then if vtN:getY() < GEO.EPS_SMALL then
nSCC = MCH_SCC.ADIR_YM
elseif abs( vtN:getX()) < GEO.EPS_SMALL then
nSCC = MCH_SCC.ADIR_XP
elseif vtN:getY() < GEO.EPS_SMALL then
nSCC = EgtIf( bRevertSide, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM) nSCC = EgtIf( bRevertSide, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
else else
nSCC = EgtIf( bRevertSide, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP) nSCC = EgtIf( bRevertSide, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)
@@ -476,7 +321,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- imposto elevazione -- imposto elevazione
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMorH, 1) .. ';') EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMorH, 1) .. ';')
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -501,19 +346,11 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- sistemo la direzione di lavoro -- sistemo la direzione di lavoro
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false)) EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false))
-- imposto posizione braccio porta testa -- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE if vtN:getY() < GEO.EPS_SMALL then
if not BD.C_SIMM then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
if abs( vtN:getX()) < GEO.EPS_SMALL and abs( vtN:getY()) < GEO.EPS_SMALL then else
nSCC = MCH_SCC.ADIR_YM EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
elseif abs( vtN:getX()) < GEO.EPS_SMALL then
nSCC = MCH_SCC.ADIR_XP
elseif vtN:getY() < GEO.EPS_SMALL then
nSCC = MCH_SCC.ADIR_YP
else
nSCC = MCH_SCC.ADIR_YM
end
end end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- se altezza mortasa differente da altezza massima lavorabile -- se altezza mortasa differente da altezza massima lavorabile
if abs( dMorH - dMaxDepth) > GEO.EPS_SMALL then if abs( dMorH - dMaxDepth) > GEO.EPS_SMALL then
nDepthMin = -dMorH nDepthMin = -dMorH
@@ -525,18 +362,12 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- imposto elevazione -- imposto elevazione
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( (-nDepthMin+BD.CUT_EXTRA), 1) .. ';') EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( (-nDepthMin+BD.CUT_EXTRA), 1) .. ';')
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
end end
end end
-- verifico se necessaria la pulizia degli angoli ( tenone ad angoli non raggiati) e applico nel caso
local _, sWarn2 = CleanCorners( Proc, dMorH, vtN, bOpenBtm and not bForceOneSide, AuxId)
if sWarn2 then
if not sWarn then sWarn = '' end
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2)
end
return true, sWarn return true, sWarn
end end
+111 -169
View File
@@ -1,13 +1,10 @@
-- ProcessProfCamb.lua by Egaltech s.r.l. 2022/05/28 -- ProcessProfCamb.lua by Egaltech s.r.l. 2022/01/26
-- Gestione calcolo profilo caudato per Travi -- Gestione calcolo profilo caudato per Travi
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto. -- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto.
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra. -- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
-- 2021/10/12 Estesa gestione di testa da sotto, se presente. -- 2021/10/12 Estesa gestione di testa da sotto, se presente.
-- 2021/10/12 Portato a 30deg l'angolo limite per fare l'antischeggia. -- 2021/10/12 Portato a 30deg l'angolo limite per fare l'antischeggia.
-- 2022/01/26 Migliorato controllo lavorazione con fresa su testa da sotto. -- 2022/01/26 Migliorato controllo lavorazione con fresa su testa da sotto.
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessProfCamb = {} local ProcessProfCamb = {}
@@ -16,7 +13,6 @@ local ProcessProfCamb = {}
require( 'EgtBase') require( 'EgtBase')
local BL = require( 'BeamLib') local BL = require( 'BeamLib')
local Fbs = require( 'FacesBySaw') local Fbs = require( 'FacesBySaw')
local Fbp = require( 'FaceByPocket')
local Cut = require( 'ProcessCut') local Cut = require( 'ProcessCut')
EgtOutLog( ' ProcessProfCamb started', 1) EgtOutLog( ' ProcessProfCamb started', 1)
@@ -66,12 +62,6 @@ function ProcessProfCamb.Classify( Proc, b3Raw)
end end
end end
---------------------------------------------------------------------
-- Verifico se richiesto il solo smusso
function ProcessProfCamb.OnlyChamfer( Proc)
return (( EgtGetInfo( Proc.Id, sDepthChamferMill, 'd') or 0) > 0.1 and EgtGetInfo( Proc.Id, sPreemptiveChamfer, 'i') == 1)
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function GetSawCutData( AuxId, vtNF) local function GetSawCutData( AuxId, vtNF)
-- comincio con la normale a 45deg -- comincio con la normale a 45deg
@@ -138,7 +128,7 @@ local function ModifySideAndInvert( Proc, bHead, bForceInvert, nCutLengthMach)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, nCutLengthMach) EgtSetMachiningParam( MCH_MP.ENDADDLEN, nCutLengthMach)
end end
-- riapplico la lavorazione -- riapplico la lavorazione
ML.ApplyMachining( true, false) EgtApplyMachining( true, false)
end end
end end
end end
@@ -150,12 +140,12 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- verifico che lo smusso sia richiesto -- verifico che lo smusso sia richiesto
local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0 local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0
if dDepth > 0.1 then if dDepth > 0 then
nChamfer = 1 nChamfer = 1
end end
-- verifico se posso fare solo lo smusso -- verifico se posso fare solo lo smusso
if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then
if nChamfer == 1 then if dDepth > 0 then
nChamfer = nChamfer + 1 nChamfer = nChamfer + 1
-- altrimenti se non ho l'affondamento esco -- altrimenti se non ho l'affondamento esco
else else
@@ -184,15 +174,19 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
-- recupero la lavorazione -- recupero la lavorazione
local sMilling, sMilling2 local sMilling, sMilling2
if nChamfer > 0 then if nChamfer > 0 then
local bDownHead = BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 and BD.DH_MAX_TOP and ( Proc.Box:getMax():getZ() - b3Raw:getMax():getZ()) < BD.DH_MAX_TOP if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 and BD.DH_MAX_TOP and ( Proc.Box:getMax():getZ() - b3Raw:getMax():getZ()) < BD.DH_MAX_TOP then
sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, true, bDownHead) sMilling = ML.FindMilling( 'Mark_H2')
if not sMilling then sMilling = ML.FindMilling( 'Mark') end
else
sMilling = ML.FindMilling( 'Mark')
end
if not sMilling then if not sMilling then
local sErr = 'Error : chamfer not found in library' local sErr = 'Error : chamfer not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
return -1, 0, sErr return -1, 0, sErr
end end
if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then
sMilling2 = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true) sMilling2 = ML.FindMilling( 'Mark_H2')
if not sMilling2 then if not sMilling2 then
local sErr = 'Error : chamfer2 not found in library' local sErr = 'Error : chamfer2 not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -207,7 +201,6 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local sWarn
-- ingombro del grezzo -- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo -- ingombro del pezzo
@@ -279,43 +272,28 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bMakeAs = true bMakeAs = true
end end
end end
-- se smusso non è esclusivo, aggiungo sgrossatura -- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama
if nChamfer < 2 then if nChamfer < 2 then
-- aggiungo piano di sgrossatura e lo lavoro -- aggiungo taglio di lama di sgrossatura e lo lavoro
local ptStart, vtNP = GetSawCutData( AuxId, vtNF) local ptStart, vtNP = GetSawCutData( AuxId, vtNF)
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB) local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( AddId, 'TASKID', Proc.TaskId) EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura -- applico la lavorazione
if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
-- recupero la lavorazione Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local sPockType = 'OpenPocket' local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, true, false) if not bOk then return bOk, sErr end
if not sPocketing then
local sErr = 'Error : pocketing '..sPockType..' not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- eseguo le svuotature necessarie
local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid)
if not bOk then
return false, sErr
end
-- altrimenti applico taglio di lama
else
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}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then
return false, sErr
end
end
end end
-- leggo anticipatamente i parametri utensile fresa per dare un valore opportuno all'elevazione della lama -- leggo anticipatamente i parametri utensile fresa per dare un valore opportuno all'elevazione della lama
-- recupero la lavorazione di fresatura -- recupero la lavorazione di fresatura
local sMillType = 'Prof' local sMillType = 'Prof'
sMilling, _, _, bMillDown = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bMillDown) sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', ''))
if not sMilling and bMillDown then
sMilling = ML.FindMilling( sMillType)
bMillDown = false
end
if not sMilling then if not sMilling then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -334,7 +312,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if ( nSide ~= -1 or bMillDown) and nLastFacet and EgtGetInfo( Proc.Id, sEnableExtraBladeUpperFace, 'i') == 1 then if ( nSide ~= -1 or bMillDown) and nLastFacet and EgtGetInfo( Proc.Id, sEnableExtraBladeUpperFace, 'i') == 1 then
-- recupero la lavorazione -- recupero la lavorazione
local sCutType = 'HeadSide' local sCutType = 'HeadSide'
local sCutting = ML.FindCutting( sCutType, not bMillDown, bMillDown) local sCutting = ML.FindCutting( sCutType .. EgtIf( bMillDown, '_H2', ''))
-- se richiesto taglio con lama da sotto e non trovato non posso utilizzare quello da sopra -- se richiesto taglio con lama da sotto e non trovato non posso utilizzare quello da sopra
if not sCutting then if not sCutting then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' sawing not found in library' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' sawing not found in library'
@@ -405,7 +383,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa -- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -452,7 +430,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa -- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -466,124 +444,9 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- 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 > dToolMaxDepth) local bDouble = ( nSide ~= 0 and 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 -- inserisco la lavorazione
local sMillingDown
if bDouble then
if nSide == 0 then
if BD.DOWN_HEAD then
-- recupero la lavorazione
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
if not sMillingDown then
sWarn = 'Warning : milling from bottom not found in library'
EgtOutLog( sWarn)
bDouble = false
end
else
sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')'
EgtOutLog( sWarn)
bDouble = false
end
end
end
-- se orizzontale o trovata lavorazione per doppio verticale
if bDouble then
-- inserisco la lavorazione
local sName
if bMakeAs then
sName = 'ProfB_As_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
else
sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
end
local nMchId = EgtAddMachining( sName, EgtIf( BD.DOWN_HEAD and nSide == 0, sMillingDown, sMilling))
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- se lavorazione da sopra e da sotto
if ( nSide == 0) then
if vtExtr:getZ() > 0.1 then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
end
-- altrimenti lavorazione davanti e dietro
else
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
if ( bHead and vtExtr:getY() > 0.1) or
( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
end
end
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local bFinish
local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
bFinish = true
end
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione
ModifySideAndInvert( Proc, bHead)
end
-- se devo fare l'antischeggia in testa
if bMakeAs then
local sNewName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
-- copio lavorazione per ingresso antischeggia (la copia è la lavorazione finale)
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
-- rendo corrente la precedente, la inverto e modifico il parametri di uscita
EgtSetCurrMachining( nMchId)
local dCrvLen = EgtCurveLength( AuxId)
if dCrvLen > abs(dMakeAntiSplintOnHead) then
ModifySideAndInvert( Proc, bHead, true, ( abs(dMakeAntiSplintOnHead) - dCrvLen))
end
-- rendo corrente la copia (cioè la lavorazione completa)
EgtSetCurrMachining( nMch2Id)
nMchId = nMch2Id
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- inserisco la prima lavorazione
local sName local sName
if bMakeAs then if bMakeAs then
sName = 'Prof_As_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) sName = 'Prof_As_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
@@ -646,7 +509,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bFinish = true bFinish = true
end end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -684,13 +547,92 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false) EgtSetOperationMode( nMch2Id, false)
return false, sErr return false, sErr
end end
end end
end end
-- se lavorazione da due parti, aggiungo la seconda
if bDouble then
-- inserisco la lavorazione
local sName
if bMakeAs then
sName = 'ProfB_As_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
else
sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
end
local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- sempre lavorazione da sopra o da sotto
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
if ( bHead and vtExtr:getY() > 0.1) or
( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
end
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione
ModifySideAndInvert( Proc, bHead)
end
-- se devo fare l'antischeggia in testa
if bMakeAs then
local sNewName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
-- copio lavorazione per ingresso antischeggia (la copia è la lavorazione finale)
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
-- rendo corrente la precedente, la inverto e modifico il parametri di uscita
EgtSetCurrMachining( nMchId)
local dCrvLen = EgtCurveLength( AuxId)
if dCrvLen > abs(dMakeAntiSplintOnHead) then
ModifySideAndInvert( Proc, bHead, true, ( abs(dMakeAntiSplintOnHead) - dCrvLen))
end
-- rendo corrente la copia (cioè la lavorazione completa)
EgtSetCurrMachining( nMch2Id)
nMchId = nMch2Id
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- se non da sotto e parametro Q abilitato, inserisco lavorazione finitura angolo -- se non da sotto e parametro Q abilitato, inserisco lavorazione finitura angolo
if ( nSide ~= -1 or bMillDown) and EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') == 1 then if ( nSide ~= -1 or bMillDown) and EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') == 1 then
sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
@@ -721,7 +663,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchVId, false) EgtSetOperationMode( nMchVId, false)
return false, sErr return false, sErr
@@ -743,7 +685,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX()) BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX())
end end
end end
return true, sWarn return true
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
+92 -164
View File
@@ -1,10 +1,7 @@
-- ProcessProfConcave.lua by Egaltech s.r.l. 2022/05/28 -- ProcessProfConcave.lua by Egaltech s.r.l. 2021/06/28
-- Gestione calcolo profilo concavo per Travi -- Gestione calcolo profilo concavo per Travi
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto. -- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto.
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra. -- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessProfConcave = {} local ProcessProfConcave = {}
@@ -12,7 +9,6 @@ local ProcessProfConcave = {}
-- Include -- Include
require( 'EgtBase') require( 'EgtBase')
local BL = require( 'BeamLib') local BL = require( 'BeamLib')
local Fbp = require( 'FaceByPocket')
local Cut = require( 'ProcessCut') local Cut = require( 'ProcessCut')
EgtOutLog( ' ProcessProfConcave started', 1) EgtOutLog( ' ProcessProfConcave started', 1)
@@ -59,12 +55,6 @@ function ProcessProfConcave.Classify( Proc, b3Raw)
end end
end end
---------------------------------------------------------------------
-- Verifico se richiesto il solo smusso
function ProcessProfConcave.OnlyChamfer( Proc)
return (( EgtGetInfo( Proc.Id, sDepthChamferMill, 'd') or 0) > 0.1 and EgtGetInfo( Proc.Id, sPreemptiveChamfer, 'i') == 1)
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function GetSawCutData( AuxId, vtN) local function GetSawCutData( AuxId, vtN)
-- comincio con la normale a 45deg -- comincio con la normale a 45deg
@@ -92,8 +82,8 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
-- confronto il punto iniziale e finale della lavorazione con il box della feature -- confronto il punto iniziale e finale della lavorazione con il box della feature
-- e se è vicino alla parte esterna della trave inverto la lavorazione -- e se è vicino alla parte esterna della trave inverto la lavorazione
local ptSP = EgtGetMachiningStartPoint() ptSP = EgtGetMachiningStartPoint()
local ptEp = EgtGetMachiningEndPoint() ptEp = EgtGetMachiningEndPoint()
local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE) local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE)
if nMachMode == 1 and ptSP and ptEp then if nMachMode == 1 and ptSP and ptEp then
if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) < if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) <
@@ -126,7 +116,7 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
end end
-- riapplico la lavorazione -- riapplico la lavorazione
ML.ApplyMachining( true, false) EgtApplyMachining( true, false)
end end
end end
@@ -137,12 +127,12 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- verifico che lo smusso sia richiesto -- verifico che lo smusso sia richiesto
local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0 local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0
if dDepth > 0.1 then if dDepth > 0 then
nChamfer = 1 nChamfer = 1
end end
-- verifico se posso fare solo lo smusso -- verifico se posso fare solo lo smusso
if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then
if nChamfer == 1 then if dDepth > 0 then
nChamfer = nChamfer + 1 nChamfer = nChamfer + 1
-- altrimenti se non ho l'affondamento esco -- altrimenti se non ho l'affondamento esco
else else
@@ -174,7 +164,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
sMilling = ML.FindMilling( 'Mark') sMilling = ML.FindMilling( 'Mark')
if not sMilling then if not sMilling then
if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 then if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 then
sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true) sMilling = ML.FindMilling( 'Mark_H2')
end end
if not sMilling then if not sMilling then
local sErr = 'Error : chamfer not found in library' local sErr = 'Error : chamfer not found in library'
@@ -183,7 +173,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
end end
end end
if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then
sMilling2 = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true) sMilling2 = ML.FindMilling( 'Mark_H2')
if not sMilling2 then if not sMilling2 then
local sErr = 'Error : chamfer2 not found in library' local sErr = 'Error : chamfer2 not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -198,7 +188,6 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local sWarn
-- ingombro del grezzo -- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo -- ingombro del pezzo
@@ -260,38 +249,19 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if nChamfer < 0 then if nChamfer < 0 then
return false, sChamfer return false, sChamfer
end end
-- se smusso non è esclusivo, aggiungo sgrossatura -- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama
if nChamfer < 2 then if nChamfer < 2 then
-- aggiungo piano di sgrossatura e lo lavoro -- aggiungo taglio di lama di sgrossatura e lo lavoro
local ptStart, vtNP = GetSawCutData( AuxId, vtN) local ptStart, vtNP = GetSawCutData( AuxId, vtN)
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB) local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( AddId, 'TASKID', Proc.TaskId) EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura -- applico la lavorazione
if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
-- recupero la lavorazione Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local sPockType = 'OpenPocket' local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, true, false) if not bOk then return bOk, sErr end
if not sPocketing then
local sErr = 'Error : pocketing '..sPockType..' not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- eseguo le svuotature necessarie
local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid)
if not bOk then
return false, sErr
end
-- altrimenti applico taglio di lama
else
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}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then
return false, sErr
end
end
end end
end end
-- se devo inserire il chamfer -- se devo inserire il chamfer
@@ -351,7 +321,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa -- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -401,7 +371,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa -- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -434,111 +404,9 @@ 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 > dToolMaxDepth) local bDouble = ( nSide ~= 0 and 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 -- inserisco la lavorazione
local sMillingDown
if bDouble then
if nSide == 0 then
if BD.DOWN_HEAD then
-- recupero la lavorazione
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
if not sMillingDown then
sWarn = 'Warning : milling from bottom not found in library'
EgtOutLog( sWarn)
bDouble = false
end
elseif not BD.TURN then
sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')'
EgtOutLog( sWarn)
bDouble = false
end
end
end
-- se orizzontale o trovata lavorazione per doppio verticale
if bDouble then
-- inserisco la lavorazione
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, EgtIf( BD.DOWN_HEAD and nSide == 0, sMillingDown, sMilling))
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- resetto il flag inversione percorso
bFlagInvert = false
-- se lavorazione da sopra e da sotto
if ( nSide == 0) then
if vtExtr:getZ() > 0.1 then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = true
end
-- altrimenti lavorazione davanti e dietro
else
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
if ( bHead and vtExtr:getY() > 0.1) or
( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = true
end
end
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa
local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
if BD.TURN then nSCC = MCH_SCC.ADIR_ZP end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local bFinish
local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
bFinish = true
end
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- inserisco la prima lavorazione
local sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling) local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then if not nMchId then
@@ -590,10 +458,9 @@ function ProcessProfConcave.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 = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM) EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
if BD.TURN then nSCC = MCH_SCC.ADIR_ZP 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 bFinish local bFinish
local dOriOffset = 0 local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0 local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
@@ -603,7 +470,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bFinish = true bFinish = true
end end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -617,7 +484,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if bFinish 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))
if not nMch2Id then if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -627,17 +494,80 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false) EgtSetOperationMode( nMch2Id, false)
return false, sErr return false, sErr
end end
end end
end end
-- se lavorazione da due parti, aggiungo la seconda
if bDouble then
-- inserisco la lavorazione
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- resetto il flag inversione percorso
bFlagInvert = false
-- sempre lavorazione da sopra o da sotto
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
if ( bHead and vtExtr:getY() > 0.1) or
( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto -- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
-- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela) -- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bLastTrim and if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bLastTrim and
( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD or BD.TURN))) then ( nSide ~= -1 or ( nSide == -1 and EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1)) then
sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchVId = EgtAddMachining( sName, sMilling) local nMchVId = EgtAddMachining( sName, sMilling)
if not nMchVId then if not nMchVId then
@@ -663,9 +593,8 @@ 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)
if BD.TURN then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchVId, false) EgtSetOperationMode( nMchVId, false)
return false, sErr return false, sErr
@@ -674,7 +603,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto -- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
-- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela) -- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bFirstTrim and if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bFirstTrim and
( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD or BD.TURN))) then ( nSide ~= -1 or ( nSide == -1 and EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1)) then
sName = 'ProfV2_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) sName = 'ProfV2_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchV2Id = EgtAddMachining( sName, sMilling) local nMchV2Id = EgtAddMachining( sName, sMilling)
if not nMchV2Id then if not nMchV2Id then
@@ -697,9 +626,8 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.STEP, 0) EgtSetMachiningParam( MCH_MP.STEP, 0)
EgtSetMachiningParam( MCH_MP.OFFSR, 0) EgtSetMachiningParam( MCH_MP.OFFSR, 0)
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1)) EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1))
if BD.TURN then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchV2Id, false) EgtSetOperationMode( nMchV2Id, false)
return false, sErr return false, sErr
@@ -721,7 +649,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX()) BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX())
end end
end end
return true, sWarn return true
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
+92 -165
View File
@@ -1,10 +1,7 @@
-- ProcessProfConvex.lua by Egaltech s.r.l. 2022/05/28 -- ProcessProfConvex.lua by Egaltech s.r.l. 2021/06/28
-- Gestione calcolo profilo convesso per Travi -- Gestione calcolo profilo convesso per Travi
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto. -- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto.
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra. -- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessProfConvex = {} local ProcessProfConvex = {}
@@ -12,7 +9,6 @@ local ProcessProfConvex = {}
-- Include -- Include
require( 'EgtBase') require( 'EgtBase')
local BL = require( 'BeamLib') local BL = require( 'BeamLib')
local Fbp = require( 'FaceByPocket')
local Cut = require( 'ProcessCut') local Cut = require( 'ProcessCut')
EgtOutLog( ' ProcessProfConvex started', 1) EgtOutLog( ' ProcessProfConvex started', 1)
@@ -59,12 +55,6 @@ function ProcessProfConvex.Classify( Proc, b3Raw)
end end
end end
---------------------------------------------------------------------
-- Verifico se richiesto il solo smusso
function ProcessProfConvex.OnlyChamfer( Proc)
return (( EgtGetInfo( Proc.Id, sDepthChamferMill, 'd') or 0) > 0.1 and EgtGetInfo( Proc.Id, sPreemptiveChamfer, 'i') == 1)
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function GetSawCutData( AuxId, vtN) local function GetSawCutData( AuxId, vtN)
-- comincio con la normale a 45deg -- comincio con la normale a 45deg
@@ -92,8 +82,8 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
-- confronto il punto iniziale e finale della lavorazione con il box della feature -- confronto il punto iniziale e finale della lavorazione con il box della feature
-- e se è vicino alla parte esterna della trave inverto la lavorazione -- e se è vicino alla parte esterna della trave inverto la lavorazione
local ptSP = EgtGetMachiningStartPoint() ptSP = EgtGetMachiningStartPoint()
local ptEp = EgtGetMachiningEndPoint() ptEp = EgtGetMachiningEndPoint()
local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE) local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE)
if nMachMode == 1 and ptSP and ptEp then if nMachMode == 1 and ptSP and ptEp then
if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) < if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) <
@@ -126,7 +116,7 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
end end
-- riapplico la lavorazione -- riapplico la lavorazione
ML.ApplyMachining( true, false) EgtApplyMachining( true, false)
end end
end end
@@ -137,12 +127,12 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- verifico che lo smusso sia richiesto -- verifico che lo smusso sia richiesto
local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0 local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0
if dDepth > 0.1 then if dDepth > 0 then
nChamfer = 1 nChamfer = 1
end end
-- verifico se posso fare solo lo smusso -- verifico se posso fare solo lo smusso
if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then
if nChamfer == 1 then if dDepth > 0 then
nChamfer = nChamfer + 1 nChamfer = nChamfer + 1
-- altrimenti se non ho l'affondamento esco -- altrimenti se non ho l'affondamento esco
else else
@@ -174,7 +164,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
sMilling = ML.FindMilling( 'Mark') sMilling = ML.FindMilling( 'Mark')
if not sMilling then if not sMilling then
if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 then if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 then
sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true) sMilling = ML.FindMilling( 'Mark_H2')
end end
if not sMilling then if not sMilling then
local sErr = 'Error : chamfer not found in library' local sErr = 'Error : chamfer not found in library'
@@ -183,7 +173,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
end end
end end
if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then
sMilling2 = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true) sMilling2 = ML.FindMilling( 'Mark_H2')
if not sMilling2 then if not sMilling2 then
local sErr = 'Error : chamfer2 not found in library' local sErr = 'Error : chamfer2 not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -198,7 +188,6 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local sWarn
-- ingombro del grezzo -- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo -- ingombro del pezzo
@@ -260,38 +249,19 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if nChamfer < 0 then if nChamfer < 0 then
return false, sChamfer return false, sChamfer
end end
-- se smusso non è esclusivo, aggiungo sgrossatura -- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama
if nChamfer < 2 then if nChamfer < 2 then
-- aggiungo piano di sgrossatura e lo lavoro -- aggiungo taglio di lama di sgrossatura e lo lavoro
local ptStart, vtNP = GetSawCutData( AuxId, vtN) local ptStart, vtNP = GetSawCutData( AuxId, vtN)
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB) local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( AddId, 'TASKID', Proc.TaskId) EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura -- applico la lavorazione
if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
-- recupero la lavorazione Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local sPockType = 'OpenPocket' local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, true, false) if not bOk then return bOk, sErr end
if not sPocketing then
local sErr = 'Error : pocketing '..sPockType..' not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- eseguo le svuotature necessarie
local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid)
if not bOk then
return false, sErr
end
-- altrimenti applico taglio di lama
else
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}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then
return false, sErr
end
end
end end
end end
-- se devo inserire il chamfer -- se devo inserire il chamfer
@@ -351,7 +321,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa -- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -401,7 +371,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa -- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -434,111 +404,9 @@ 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 > dToolMaxDepth) local bDouble = ( nSide ~= 0 and 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 -- inserisco la lavorazione
local sMillingDown
if bDouble then
if nSide == 0 then
if BD.DOWN_HEAD then
-- recupero la lavorazione
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
if not sMillingDown then
sWarn = 'Warning : milling from bottom not found in library'
EgtOutLog( sWarn)
bDouble = false
end
elseif not BD.TURN then
sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')'
EgtOutLog( sWarn)
bDouble = false
end
end
end
-- se orizzontale o trovata lavorazione per doppio verticale
if bDouble then
-- inserisco la lavorazione
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, EgtIf( BD.DOWN_HEAD and nSide == 0, sMillingDown, sMilling))
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- resetto il flag inversione percorso
bFlagInvert = false
-- se lavorazione da sopra e da sotto
if ( nSide == 0) then
if vtExtr:getZ() > 0.1 then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = true
end
-- altrimenti lavorazione davanti e dietro
else
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
if ( bHead and vtExtr:getY() > 0.1) or
( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = true
end
end
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa
local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
if BD.TURN then nSCC = MCH_SCC.ADIR_ZP end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local bFinish
local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
bFinish = true
end
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- inserisco la prima lavorazione
local sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling) local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then if not nMchId then
@@ -590,10 +458,9 @@ function ProcessProfConvex.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 = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM) EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
if BD.TURN then nSCC = MCH_SCC.ADIR_ZP 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 bFinish local bFinish
local dOriOffset = 0 local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0 local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
@@ -603,7 +470,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bFinish = true bFinish = true
end end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -627,17 +494,80 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false) EgtSetOperationMode( nMch2Id, false)
return false, sErr return false, sErr
end end
end end
end end
-- se lavorazione da due parti, aggiungo la seconda
if bDouble then
-- inserisco la lavorazione
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- resetto il flag inversione percorso
bFlagInvert = false
-- sempre lavorazione da sopra o da sotto
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
if ( bHead and vtExtr:getY() > 0.1) or
( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto -- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
-- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela) -- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bLastTrim and if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bLastTrim and
( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD or BD.TURN))) then ( nSide ~= -1 or ( nSide == -1 and EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1)) then
sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchVId = EgtAddMachining( sName, sMilling) local nMchVId = EgtAddMachining( sName, sMilling)
if not nMchVId then if not nMchVId then
@@ -663,9 +593,8 @@ 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)
if BD.TURN then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchVId, false) EgtSetOperationMode( nMchVId, false)
return false, sErr return false, sErr
@@ -674,7 +603,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto -- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
-- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela) -- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bFirstTrim and if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bFirstTrim and
( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD or BD.TURN))) then ( nSide ~= -1 or ( nSide == -1 and EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1)) then
sName = 'ProfV2_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) sName = 'ProfV2_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchV2Id = EgtAddMachining( sName, sMilling) local nMchV2Id = EgtAddMachining( sName, sMilling)
if not nMchV2Id then if not nMchV2Id then
@@ -697,9 +626,8 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.STEP, 0) EgtSetMachiningParam( MCH_MP.STEP, 0)
EgtSetMachiningParam( MCH_MP.OFFSR, 0) EgtSetMachiningParam( MCH_MP.OFFSR, 0)
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1)) EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1))
if BD.TURN then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchV2Id, false) EgtSetOperationMode( nMchV2Id, false)
return false, sErr return false, sErr
@@ -707,13 +635,12 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
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
if bHead then if bHead then
BL.UpdateHCING( nRawId, b3Raw:getMax():getX() - dCurrOvmH - Proc.Box:getMin():getX()) BL.UpdateHCING( nRawId, b3Raw:getMax():getX() - dCurrOvmH - Proc.Box:getMin():getX())
else else
BL.UpdateTCING( nRawId, Proc.Box:getMax():getX() - b3Solid:getMin():getX()) BL.UpdateTCING( nRawId, Proc.Box:getMax():getX() - b3Solid:getMin():getX())
end end
-- altrimenti feature da sopra
else else
if bHead then if bHead then
BL.UpdateHCING( nRawId, b3Raw:getMax():getX() - dCurrOvmH - Proc.Box:getMax():getX()) BL.UpdateHCING( nRawId, b3Raw:getMax():getX() - dCurrOvmH - Proc.Box:getMax():getX())
@@ -721,7 +648,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX()) BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX())
end end
end end
return true, sWarn return true
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
+83 -150
View File
@@ -1,10 +1,7 @@
-- ProcessProfFront.lua by Egaltech s.r.l. 2022/05/28 -- ProcessProfFront.lua by Egaltech s.r.l. 2021/06/28
-- Gestione calcolo profilo frontale per Travi -- Gestione calcolo profilo frontale per Travi
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto. -- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto.
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra. -- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessProfFront = {} local ProcessProfFront = {}
@@ -12,7 +9,6 @@ local ProcessProfFront = {}
-- Include -- Include
require( 'EgtBase') require( 'EgtBase')
local BL = require( 'BeamLib') local BL = require( 'BeamLib')
local Fbp = require( 'FaceByPocket')
local Cut = require( 'ProcessCut') local Cut = require( 'ProcessCut')
EgtOutLog( ' ProcessProfFront started', 1) EgtOutLog( ' ProcessProfFront started', 1)
@@ -59,12 +55,6 @@ function ProcessProfFront.Classify( Proc, b3Raw)
end end
end end
---------------------------------------------------------------------
-- Verifico se richiesto il solo smusso
function ProcessProfFront.OnlyChamfer( Proc)
return (( EgtGetInfo( Proc.Id, sDepthChamferMill, 'd') or 0) > 0.1 and EgtGetInfo( Proc.Id, sPreemptiveChamfer, 'i') == 1)
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function GetSawCutData( AuxId, vtN) local function GetSawCutData( AuxId, vtN)
local vtNP = Vector3d( vtN) local vtNP = Vector3d( vtN)
@@ -97,7 +87,7 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam)
local bInvertMode = EgtGetMachiningParam( MCH_MP.INVERT) local bInvertMode = EgtGetMachiningParam( MCH_MP.INVERT)
EgtSetMachiningParam( MCH_MP.INVERT, not bInvertMode) EgtSetMachiningParam( MCH_MP.INVERT, not bInvertMode)
-- riapplico la lavorazione -- riapplico la lavorazione
ML.ApplyMachining( true, false) EgtApplyMachining( true, false)
end end
end end
end end
@@ -109,12 +99,12 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- verifico che lo smusso sia richiesto -- verifico che lo smusso sia richiesto
local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0 local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0
if dDepth > 0.1 then if dDepth > 0 then
nChamfer = 1 nChamfer = 1
end end
-- verifico se posso fare solo lo smusso -- verifico se posso fare solo lo smusso
if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then
if nChamfer == 1 then if dDepth > 0 then
nChamfer = nChamfer + 1 nChamfer = nChamfer + 1
-- altrimenti se non ho l'affondamento esco -- altrimenti se non ho l'affondamento esco
else else
@@ -146,7 +136,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
sMilling = ML.FindMilling( 'Mark') sMilling = ML.FindMilling( 'Mark')
if not sMilling then if not sMilling then
if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 then if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 then
sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true) sMilling = ML.FindMilling( 'Mark_H2')
end end
if not sMilling then if not sMilling then
local sErr = 'Error : chamfer not found in library' local sErr = 'Error : chamfer not found in library'
@@ -155,7 +145,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
end end
end end
if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then
sMilling2 = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true) sMilling2 = ML.FindMilling( 'Mark_H2')
if not sMilling2 then if not sMilling2 then
local sErr = 'Error : chamfer2 not found in library' local sErr = 'Error : chamfer2 not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -170,7 +160,6 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local sWarn
-- ingombro del grezzo -- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo -- ingombro del pezzo
@@ -231,38 +220,19 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if nChamfer < 0 then if nChamfer < 0 then
return false, sChamfer return false, sChamfer
end end
-- se smusso non è esclusivo, aggiungo sgrossatura -- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama
if nChamfer < 2 then if nChamfer < 2 then
-- aggiungo piano di sgrossatura e lo lavoro -- aggiungo taglio di lama di sgrossatura e lo lavoro
local ptStart, vtNP = GetSawCutData( AuxId, vtN) local ptStart, vtNP = GetSawCutData( AuxId, vtN)
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB) local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( AddId, 'TASKID', Proc.TaskId) EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura -- applico la lavorazione
if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
-- recupero la lavorazione Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local sPockType = 'OpenPocket' local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, true, false) if not bOk then return bOk, sErr end
if not sPocketing then
local sErr = 'Error : pocketing '..sPockType..' not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- eseguo le svuotature necessarie
local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid)
if not bOk then
return false, sErr
end
-- altrimenti applico taglio di lama
else
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}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then
return false, sErr
end
end
end end
end end
-- se devo inserire il chamfer -- se devo inserire il chamfer
@@ -312,7 +282,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa -- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -360,7 +330,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa -- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -393,104 +363,8 @@ function ProcessProfFront.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 > dToolMaxDepth) local bDouble = ( nSide ~= 0 and 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
local sMillingDown
if bDouble then
if nSide == 0 then
if BD.DOWN_HEAD then
-- recupero la lavorazione
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
if not sMillingDown then
sWarn = 'Warning : milling from bottom not found in library'
EgtOutLog( sWarn)
bDouble = false
end
else
sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')'
EgtOutLog( sWarn)
bDouble = false
end
end
end
-- se orizzontale o trovata lavorazione per doppio verticale
if bDouble then
-- inserisco la lavorazione
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, EgtIf( BD.DOWN_HEAD and nSide == 0, sMillingDown, sMilling))
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- se lavorazione da sopra e da sotto
if ( nSide == 0) then
if vtExtr:getZ() > 0.1 then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
end
-- altrimenti lavorazione davanti e dietro
else
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
if ( bHead and vtExtr:getY() > 0.1) or
( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
end
end
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local bFinish
local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
bFinish = true
end
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam)
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- inserisco la lavorazione -- inserisco la lavorazione
local sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling) local nMchId = EgtAddMachining( sName, sMilling)
@@ -539,6 +413,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa -- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- 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 bFinish local bFinish
local dOriOffset = 0 local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0 local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
@@ -548,7 +423,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bFinish = true bFinish = true
end end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -572,17 +447,77 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false) EgtSetOperationMode( nMch2Id, false)
return false, sErr return false, sErr
end end
end end
end end
-- se lavorazione da due parti, aggiungo la seconda
if bDouble then
-- inserisco la lavorazione
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- sempre lavorazione da sopra o da sotto
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
if ( bHead and vtExtr:getY() > 0.1) or
( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
end
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam)
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto -- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
-- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela) -- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bFirstTrim and if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bFirstTrim and
( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD))) then ( nSide ~= -1 or ( nSide == -1 and EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1)) then
-- se non da sotto, inserisco lavorazione finitura angolo -- se non da sotto, inserisco lavorazione finitura angolo
--if nSide ~= -1 then --if nSide ~= -1 then
sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
@@ -605,9 +540,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1)) EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1))
-- 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
nFaceUse = EgtIf( vtN:getX() > 0.1, MCH_MILL_FU.PARAL_LEFT, MCH_MILL_FU.PARAL_RIGHT)
elseif nSide ~= 1 then
nFaceUse = EgtIf( vtN:getY() > 0.1, MCH_MILL_FU.PARAL_FRONT, MCH_MILL_FU.PARAL_BACK) nFaceUse = EgtIf( vtN:getY() > 0.1, MCH_MILL_FU.PARAL_FRONT, MCH_MILL_FU.PARAL_BACK)
end end
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
@@ -618,7 +551,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchVId, false) EgtSetOperationMode( nMchVId, false)
return false, sErr return false, sErr
@@ -647,7 +580,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- BL.UpdateTCING( nRawId, Proc.Box:getMax():getX() - b3Solid:getMin():getX()) -- BL.UpdateTCING( nRawId, Proc.Box:getMax():getX() - b3Solid:getMin():getX())
-- end -- end
--end --end
return true, sWarn return true
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
+98 -154
View File
@@ -1,11 +1,8 @@
-- ProcessProfHead.lua by Egaltech s.r.l. 2022/05/28 -- ProcessProfHead.lua by Egaltech s.r.l. 2021/10/12
-- Gestione calcolo profilo di testa per Travi -- Gestione calcolo profilo di testa per Travi
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa sotto. -- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa sotto.
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra. -- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
-- 2021/10/12 Estesa gestione di testa da sotto, se presente. -- 2021/10/12 Estesa gestione di testa da sotto, se presente.
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessProfHead = {} local ProcessProfHead = {}
@@ -13,7 +10,6 @@ local ProcessProfHead = {}
-- Include -- Include
require( 'EgtBase') require( 'EgtBase')
local BL = require( 'BeamLib') local BL = require( 'BeamLib')
local Fbp = require( 'FaceByPocket')
local Cut = require( 'ProcessCut') local Cut = require( 'ProcessCut')
EgtOutLog( ' ProcessProfHead started', 1) EgtOutLog( ' ProcessProfHead started', 1)
@@ -60,12 +56,6 @@ function ProcessProfHead.Classify( Proc, b3Raw)
end end
end end
---------------------------------------------------------------------
-- Verifico se richiesto il solo smusso
function ProcessProfHead.OnlyChamfer( Proc)
return (( EgtGetInfo( Proc.Id, sDepthChamferMill, 'd') or 0) > 0.1 and EgtGetInfo( Proc.Id, sPreemptiveChamfer, 'i') == 1)
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function GetSawCutData( AuxId, vtN) local function GetSawCutData( AuxId, vtN)
-- assegno la normale -- assegno la normale
@@ -85,8 +75,8 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
-- confronto il punto iniziale e finale della lavorazione con il box della feature -- confronto il punto iniziale e finale della lavorazione con il box della feature
-- e se è vicino alla parte esterna della trave inverto la lavorazione -- e se è vicino alla parte esterna della trave inverto la lavorazione
local ptSP = EgtGetMachiningStartPoint() ptSP = EgtGetMachiningStartPoint()
local ptEp = EgtGetMachiningEndPoint() ptEp = EgtGetMachiningEndPoint()
local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE) local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE)
if nMachMode == 1 and ptSP and ptEp then if nMachMode == 1 and ptSP and ptEp then
if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) < if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) <
@@ -119,7 +109,7 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
end end
-- riapplico la lavorazione -- riapplico la lavorazione
ML.ApplyMachining( true, false) EgtApplyMachining( true, false)
end end
end end
@@ -130,12 +120,12 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- verifico che lo smusso sia richiesto -- verifico che lo smusso sia richiesto
local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0 local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0
if dDepth > 0.1 then if dDepth > 0 then
nChamfer = 1 nChamfer = 1
end end
-- verifico se posso fare solo lo smusso -- verifico se posso fare solo lo smusso
if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then
if nChamfer == 1 then if dDepth > 0 then
nChamfer = nChamfer + 1 nChamfer = nChamfer + 1
-- altrimenti se non ho l'affondamento esco -- altrimenti se non ho l'affondamento esco
else else
@@ -164,15 +154,19 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
-- recupero la lavorazione -- recupero la lavorazione
local sMilling, sMilling2 local sMilling, sMilling2
if nChamfer > 0 then if nChamfer > 0 then
local bDownHead = BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 and BD.DH_MAX_TOP and ( Proc.Box:getMax():getZ() - b3Raw:getMax():getZ()) < BD.DH_MAX_TOP if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 and BD.DH_MAX_TOP and ( Proc.Box:getMax():getZ() - b3Raw:getMax():getZ()) < BD.DH_MAX_TOP then
sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, true, bDownHead) sMilling = ML.FindMilling( 'Mark_H2')
if not sMilling then sMilling = ML.FindMilling( 'Mark') end
else
sMilling = ML.FindMilling( 'Mark')
end
if not sMilling then if not sMilling then
local sErr = 'Error : chamfer not found in library' local sErr = 'Error : chamfer not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
return -1, 0, sErr return -1, 0, sErr
end end
if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then
sMilling2 = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true) sMilling2 = ML.FindMilling( 'Mark_H2')
if not sMilling2 then if not sMilling2 then
local sErr = 'Error : chamfer2 not found in library' local sErr = 'Error : chamfer2 not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -262,38 +256,19 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if nChamfer < 0 then if nChamfer < 0 then
return false, sChamfer return false, sChamfer
end end
-- se smusso non è esclusivo, aggiungo sgrossatura -- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama
if nChamfer < 2 then if nChamfer < 2 then
-- aggiungo piano di sgrossatura e lo lavoro -- aggiungo taglio di lama di sgrossatura e lo lavoro
local ptStart, vtNP = GetSawCutData( AuxId, vtN) local ptStart, vtNP = GetSawCutData( AuxId, vtN)
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB) local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( AddId, 'TASKID', Proc.TaskId) EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura -- applico la lavorazione
if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
-- recupero la lavorazione Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local sPockType = 'OpenPocket' local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, true, false) if not bOk then return bOk, sErr end
if not sPocketing then
local sErr = 'Error : pocketing '..sPockType..' not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- eseguo le svuotature necessarie
local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid)
if not bOk then
return false, sErr
end
-- altrimenti applico taglio di lama
else
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}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then
return false, sErr
end
end
end end
end end
-- se devo inserire il chamfer -- se devo inserire il chamfer
@@ -353,7 +328,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa -- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -405,7 +380,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa -- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -421,7 +396,10 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if nChamfer < 2 then if nChamfer < 2 then
-- recupero la lavorazione -- recupero la lavorazione
local sMillType = 'Prof' local sMillType = 'Prof'
local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bMillDown) local sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', ''))
if not sMilling then
sMilling = ML.FindMilling( sMillType)
end
if not sMilling then if not sMilling then
local sErr = 'Error : milling not found in library' local sErr = 'Error : milling not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -440,108 +418,9 @@ function ProcessProfHead.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 > dToolMaxDepth) local bDouble = ( nSide ~= 0 and 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 -- inserisco la lavorazione
local sMillingDown
if bDouble then
if nSide == 0 then
if BD.DOWN_HEAD then
-- recupero la lavorazione
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
if not sMillingDown then
sWarn = 'Warning : milling from bottom not found in library'
EgtOutLog( sWarn)
bDouble = false
end
else
sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')'
EgtOutLog( sWarn)
bDouble = false
end
end
end
-- se orizzontale o trovata lavorazione per doppio verticale
if bDouble then
-- inserisco la lavorazione
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, EgtIf( BD.DOWN_HEAD and nSide == 0, sMillingDown, sMilling))
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- resetto il flag inversione percorso
bFlagInvert = false
-- se lavorazione da sopra e da sotto
if ( nSide == 0) then
if vtExtr:getZ() > 0.1 then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
end
-- altrimenti lavorazione davanti e dietro
else
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
if ( bHead and vtExtr:getY() > 0.1) or
( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
end
end
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local bFinish
local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
bFinish = true
end
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni,
dLenLst, ( #vAngs > 0 and vAngs[1] == 0), ( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2)), bFlagInvert, dOffsetPar)
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- inserisco la prima lavorazione
local sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling) local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then if not nMchId then
@@ -595,6 +474,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa -- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- 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 bFinish local bFinish
local dOriOffset = 0 local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0 local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
@@ -604,7 +484,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bFinish = true bFinish = true
end end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -629,13 +509,77 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false) EgtSetOperationMode( nMch2Id, false)
return false, sErr return false, sErr
end end
end end
end end
-- se lavorazione da due parti, aggiungo la seconda
if bDouble then
-- inserisco la lavorazione
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- resetto il flag inversione percorso
bFlagInvert = false
-- sempre lavorazione da sopra o da sotto
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
if ( bHead and vtExtr:getY() > 0.1) or
( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni,
dLenLst, ( #vAngs > 0 and vAngs[1] == 0), ( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2)), bFlagInvert, dOffsetPar)
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto -- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
-- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela) -- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and #vAngs > 0 then if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and #vAngs > 0 then
@@ -674,7 +618,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchV2Id, false) EgtSetOperationMode( nMchV2Id, false)
return false, sErr return false, sErr
@@ -714,7 +658,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchVId, false) EgtSetOperationMode( nMchVId, false)
return false, sErr return false, sErr
@@ -737,7 +681,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX()) BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX())
end end
end end
return true, sWarn return true
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
+10 -9
View File
@@ -97,7 +97,7 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- determino se da lavorare con testa da sotto -- determino se da lavorare con testa da sotto
local bDownHead = ( BD.DOWN_HEAD and vtN[vFaceOrd[3]]:getZ() < -0.1) local bDownHead = ( BD.DOWN_HEAD and vtN[vFaceOrd[3]]:getZ() < -0.1)
-- recupero la lavorazione -- recupero la lavorazione
local sCutting = ML.FindCutting( 'HeadSide', not bDownHead, bDownHead) local sCutting = ML.FindCutting( 'HeadSide' .. EgtIf( bDownHead, '_H2', ''))
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)
@@ -137,22 +137,23 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
end end
end end
-- 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
-- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti -- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
local vCuts = {} local vCuts = {}
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]]) vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
end end
if #vCuts > 0 then if #vCuts > 0 then
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- sistemo posizione nel DB e nome -- sistemo posizione nel DB e nome
for i = 1, #vCuts do for i = 1, #vCuts do
for j = 1, #vCuts[i] do for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end end
+1 -1
View File
@@ -230,7 +230,7 @@ function ProcessRoundArch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
+5 -11
View File
@@ -1,6 +1,5 @@
-- ProcessSawCut.lua by Egaltech s.r.l. 2022/03/07 -- ProcessSawCut.lua by Egaltech s.r.l. 2021/01/15
-- Gestione calcolo taglio di lama per Travi -- Gestione calcolo taglio di lama per Travi
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessSawCut = {} local ProcessSawCut = {}
@@ -32,14 +31,12 @@ function ProcessSawCut.Classify( Proc, b3Raw)
if not AuxId then return false end if not AuxId then return false end
AuxId = AuxId + Proc.Id AuxId = AuxId + Proc.Id
local vtDir = EgtSV( AuxId, GDB_ID.ROOT) local vtDir = EgtSV( AuxId, GDB_ID.ROOT)
return true, ( vtDir:getZ() <= - 0.5) return true, ( vtDir:getZ() <= - 0.088)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail) function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- sovramateriale di coda
dOvmTail = dOvmTail or BD.OVM_MID
-- ingombro del grezzo -- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo -- ingombro del pezzo
@@ -74,7 +71,7 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
-- altrimenti taglio di coda -- altrimenti taglio di coda
else else
-- se coincide con taglio di separazione, non va fatto -- se coincide con taglio di separazione, non va fatto
if AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then if AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
return true return true
end end
end end
@@ -184,9 +181,6 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
for i = 1, nC do for i = 1, nC do
-- Posizione braccio portatesta -- Posizione braccio portatesta
local nSCC = EgtIf( ( BD.C_SIMM or i == 1 or i == nC - 1), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM) local nSCC = EgtIf( ( BD.C_SIMM or i == 1 or i == nC - 1), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
if abs( vtDir:getY()) > 0.5 then
nSCC = EgtIf( vtDir:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
end
-- ciclo sulle passate -- ciclo sulle passate
local dOffset = dWidth - dDepth ; local dOffset = dWidth - dDepth ;
local dLioTang = 0 local dLioTang = 0
@@ -225,7 +219,7 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
-- imposto uso della faccia -- imposto uso della faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
+15 -29
View File
@@ -1,8 +1,6 @@
-- ProcessScarfJoint.lua by Egaltech s.r.l. 2022/07/12 -- ProcessScarfJoint.lua by Egaltech s.r.l. 2021/06/28
-- Gestione calcolo giunto Gerber per Travi -- Gestione calcolo giunto Gerber per Travi
-- 2021/06/28 Aggiunto extra-taglio alle lamate orizzontali. -- 2021/06/28 Aggiunto extra-taglio alle lamate orizzontali.
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- 2022/07/12 Aggiunta gestione PF1250 e TURN.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessScarfJoint = {} local ProcessScarfJoint = {}
@@ -28,10 +26,6 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Classificazione della feature -- Classificazione della feature
function ProcessScarfJoint.Classify( Proc) function ProcessScarfJoint.Classify( Proc)
-- se PF con testa da sotto o TURN, ammessa qualunque orientazione
if ( BD.C_SIMM and BD.DOWN_HEAD) or BD.TURN then
return true
end
-- verifico le normali delle facce -- verifico le normali delle facce
local nFacetCnt = EgtSurfTmFacetCount( Proc.Id) local nFacetCnt = EgtSurfTmFacetCount( Proc.Id)
for i = 1, nFacetCnt do for i = 1, nFacetCnt do
@@ -98,7 +92,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- 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
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -121,7 +115,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro -- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -132,10 +126,10 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Solid, ptC, vtN, Proc, vtRef, bHead, sCutting, dSawDiam, b3Raw, dNewDiceDim) local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Solid, ptC, vtN, Proc, vtRef, bHead, sCutting, dSawDiam, b3Raw, dNewDiceDim)
local vCuts = {}
local bOk = true local bOk = true
local sErr = '' local sErr = ''
local vCuts = {}
if nGoodFace1 and nGoodFace4 and nGoodFace1 > 0 and nGoodFace4 > 0 then if nGoodFace1 and nGoodFace4 and nGoodFace1 > 0 and nGoodFace4 > 0 then
-- lavoro solo la faccia inclinata perché la faccia tappo completa la lavoro successivamente -- lavoro solo la faccia inclinata perché la faccia tappo completa la lavoro successivamente
-- questo evita di lavorare due volte la faccia tappo -- questo evita di lavorare due volte la faccia tappo
@@ -144,8 +138,6 @@ local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Soli
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[4]], vtN[vFaceOrd[4]], true, nil, nil, nil, dNewDiceDim) vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[4]], vtN[vFaceOrd[4]], true, nil, nil, nil, dNewDiceDim)
end end
local dVzLimDwnUp = EgtIf( vtRef:getZ() < -0.017, -2, nil)
if #vCuts > 0 then if #vCuts > 0 then
-- sistemo posizione nel DB e nome -- sistemo posizione nel DB e nome
for i = 1, #vCuts do for i = 1, #vCuts do
@@ -181,7 +173,7 @@ local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Soli
local dExtraCut = EgtIf( i % 2 == 1, 0, BD.CUT_EXTRA) local dExtraCut = EgtIf( i % 2 == 1, 0, BD.CUT_EXTRA)
-- lavoro la faccia -- lavoro la faccia
for j = 1, #vCuts[i] do for j = 1, #vCuts[i] do
bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, nil, dExtraCut, 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
end end
@@ -189,14 +181,14 @@ local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Soli
if vFaceOrd[1] ~= 0 then if vFaceOrd[1] ~= 0 then
-- inserisco la lavorazione -- inserisco la lavorazione
local vtOrthoO = Vector3d( vtRef) local vtOrthoO = Vector3d( vtRef)
bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[1] - 1, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[1] - 1, sCutting, dSawDiam, vtOrthoO, nil, 0, 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
-- 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
-- inserisco la lavorazione -- inserisco la lavorazione
local vtOrthoO = Vector3d( vtRef) local vtOrthoO = Vector3d( vtRef)
local bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[3] - 1, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) local bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[3] - 1, sCutting, dSawDiam, vtOrthoO, nil, 0, 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
end end
@@ -206,9 +198,7 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail) function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- sovramateriale di coda
dOvmTail = dOvmTail or BD.OVM_MID
-- 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
@@ -297,12 +287,8 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa
local bOkc, sErrC = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) local bOkc, sErrC = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
if not bOkc then return bOkc, sErrC end if not bOkc then return bOkc, sErrC end
-- abilitazione lavorazione da sotto (testa da sotto e direzione normale sotto -20deg)
local bDownHead = ( BD.DOWN_HEAD and vtRef:getZ() < -0.01)
local bTopHead = ( BD.DOWN_HEAD and ( vtRef:getZ() > -0.01 or not bDownHead))
-- recupero la lavorazione -- recupero la lavorazione
local sCutting = ML.FindCutting( 'HeadSide', bTopHead, bDownHead) local sCutting = ML.FindCutting( 'HeadSide')
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)
@@ -415,7 +401,7 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa
bCut = false bCut = false
end end
-- se di coda e coincide con taglio di separazione, non va fatto -- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[5]], - X_AX()) and abs( ptC[vFaceOrd[5]]:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then if not bHead and AreSameVectorApprox( vtN[vFaceOrd[5]], - X_AX()) and abs( ptC[vFaceOrd[5]]:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
bCut = false bCut = false
end end
-- se va fatto, inserisco la lavorazione -- se va fatto, inserisco la lavorazione
@@ -452,9 +438,9 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa
-- 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
if dDistFaces then if dDistFaces then
sPocketing = ML.FindPocketing( 'OpenPocket', dDiamMax, dDistFaces, nil, bTopHead, bDownHead) sPocketing = ML.FindPocketing( 'OpenPocket', dDiamMax, dDistFaces)
else else
sPocketing = ML.FindPocketing( 'OpenPocket', dDiamMax, nil, nil, bTopHead, bDownHead) sPocketing = ML.FindPocketing( 'OpenPocket', dDiamMax)
end end
if not sPocketing then if not sPocketing then
@@ -487,7 +473,7 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dDistFaces, 1) .. ';') EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dDistFaces, 1) .. ';')
end end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -500,20 +486,20 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa
if abs( vtRef:getZ()) > 0.1 then if abs( vtRef:getZ()) > 0.1 then
local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD) local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD)
if b3Fac1 then dHCI = b3Raw:getMax():getX() - dOvmHead - b3Fac1:getMin():getX() end if b3Fac1 then dHCI = b3Raw:getMax():getX() - dOvmHead - b3Fac1:getMin():getX() end
dHCI = 0.75 * dHCI
else else
dHCI = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX() dHCI = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()
end end
dHCI = 0.75 * dHCI
BL.UpdateHCING( nRawId, dHCI) BL.UpdateHCING( nRawId, dHCI)
elseif Proc.Tail then elseif Proc.Tail then
local dTCI = 0 local dTCI = 0
if abs( vtRef:getZ()) > 0.1 then if abs( vtRef:getZ()) > 0.1 then
local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD) local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD)
if b3Fac1 then dTCI = b3Fac1:getMax():getX() - b3Solid:getMin():getX() end if b3Fac1 then dTCI = b3Fac1:getMax():getX() - b3Solid:getMin():getX() end
dTCI = 0.75 * dTCI
else else
dTCI = Proc.Box:getMax():getX() - b3Solid:getMin():getX() dTCI = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
end end
dTCI = 0.75 * dTCI
BL.UpdateTCING( nRawId, dTCI) BL.UpdateTCING( nRawId, dTCI)
end end
+18 -21
View File
@@ -1,7 +1,5 @@
-- ProcessSimpleScarf.lua by Egaltech s.r.l. 2020/06/04 -- ProcessSimpleScarf.lua by Egaltech s.r.l. 2020/06/04
-- Gestione calcolo giunto Gerber per Travi -- Gestione calcolo giunto Gerber per Travi
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- 2022/08/09 Ora se la feature ha meno di due facce viene richiamata la normale Cut.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessSimpleScarf = {} local ProcessSimpleScarf = {}
@@ -11,7 +9,6 @@ require( 'EgtBase')
local BL = require( 'BeamLib') local BL = require( 'BeamLib')
local Fbs = require( 'FacesBySaw') local Fbs = require( 'FacesBySaw')
local DC = require( 'DiceCut') local DC = require( 'DiceCut')
local Cut = require( 'ProcessCut')
EgtOutLog( ' ProcessSimpleScarf started', 1) EgtOutLog( ' ProcessSimpleScarf started', 1)
@@ -94,7 +91,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- 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
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -117,7 +114,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro -- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -127,9 +124,7 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail) function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- sovramateriale di coda
dOvmTail = dOvmTail or BD.OVM_MID
-- 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,11 +135,12 @@ function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmT
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- se ci sono meno di due facce si riduce a una normale Cut -- verifico che ci siano almeno due facce (altrimenti non è da lavorare)
local nFacetCnt = EgtSurfTmFacetCount( Proc.Id) local nFacetCnt = EgtSurfTmFacetCount( Proc.Id)
if nFacetCnt < 2 then if nFacetCnt < 2 then
local bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, nil, nil, nil, nil, dOvmTail) local sErr = 'Error : number of faces not enough'
return bOk, sErr EgtOutLog( sErr)
return false, sErr
end end
-- dati delle facce -- dati delle facce
local ptC = {} local ptC = {}
@@ -212,7 +208,7 @@ function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmT
bCut = false bCut = false
end end
-- se di coda e coincide con taglio di separazione, non va fatto -- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
bCut = false bCut = false
end end
-- se va fatto, inserisco la lavorazione -- se va fatto, inserisco la lavorazione
@@ -222,24 +218,25 @@ function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmT
if not bOk then return bOk, sNameOrErr end if not bOk then return bOk, sNameOrErr end
end end
end end
-- 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
-- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti -- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
local vCuts = {} local vCuts = {}
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]]) vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
elseif vFaceOrd[3] ~= 0 then elseif vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true) vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
end end
if #vCuts > 0 then if #vCuts > 0 then
-- 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
-- sistemo posizione nel DB e nome -- sistemo posizione nel DB e nome
for i = 1, #vCuts do for i = 1, #vCuts do
for j = 1, #vCuts[i] do for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end end
+24 -226
View File
@@ -1,8 +1,5 @@
-- ProcessSplit.lua by Egaltech s.r.l. 2022/08/18 -- ProcessSplit.lua by Egaltech s.r.l. 2022/01/25
-- Gestione calcolo tagli di separazione per Travi -- Gestione calcolo tagli di separazione per Travi
-- 2022/05/31 Aggiunta gestione sezioni alte e larghe con taglio con sega a catena seguito da rifinitura con lama (aggiunta funzione MakeSplitByChainSaw); gestione eventuale creazione nuova fase dall'interno della Make.
-- 2022/06/10 Per sezioni alte e larghe aggiunta gestione finitura in base a sovramateriale e a parametro Q05 dell' eventuale lavorazione sostituita.
-- 2022/08/18 Aggiunta gestione macchine con testa da sotto con lama da sotto disabilitata.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessSplit = {} local ProcessSplit = {}
@@ -11,8 +8,6 @@ local ProcessSplit = {}
require( 'EgtBase') require( 'EgtBase')
local BL = require( 'BeamLib') local BL = require( 'BeamLib')
local Fbs = require( 'FacesBySaw') local Fbs = require( 'FacesBySaw')
local Cut = require( 'ProcessCut')
local Pocket = require( 'FaceByPocket')
EgtOutLog( ' ProcessSplit started', 1) EgtOutLog( ' ProcessSplit started', 1)
@@ -114,7 +109,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
-- 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
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -137,7 +132,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro -- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -145,97 +140,9 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
return true, nil return true, nil
end end
---------------------------------------------------------------------
-- lavorazione con sega a catena per sezioni alte e larghe
local function MakeSplitByChainSaw( nSurfId, nFaceUse, dDepth, sNotes, dOffs)
-- Recupero i dati dell'utensile
local sSawing = ML.FindSawing( 'Sawing')
local dMaxMat = 0
local dSawCornerRad = 0
local dSawThick = 0
-- se non trova una lavorazione di sawing esco
if not sSawing then
local sErr = 'Error : Sawing not found in library'
EgtOutLog( sErr)
return false, sErr, 'MNF'
else
-- recupero i dati dell'utensile
if EgtMdbSetCurrMachining( sSawing) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick
dSawCornerRad = EgtTdbGetCurrToolParam( MCH_TP.CORNRAD) or dSawCornerRad
end
end
end
-- inserisco la lavorazione di sawing
local sName = 'Csaw_' .. ( EgtGetName( nSurfId) or tostring( nSurfId)) .. '_1'
local nMchFId = EgtAddMachining( sName, sSawing)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sSawing
EgtOutLog( sErr)
return false, sErr
end
sName = EgtGetOperationName( nMchFId)
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nSurfId, 0}})
-- imposto uso del lato faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- imposto angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1))
local _, vtN = EgtSurfTmFacetCenter( nSurfId, 0, GDB_ID.ROOT)
local vtOrtho = BL.GetVersRef( nFaceUse)
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1))
-- imposto offset radiale per mantenere il materiale in coda per la finitura
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
-- imposto allungamento percorso iniziale e finale a zero
EgtSetMachiningParam( MCH_MP.STARTADDLEN, 0)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, 0)
-- faccio in modo che l'attacco della lama sia dal lato opposto rispetto al corpo macchina
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
if dMaxMat >= dDepth then
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- se massimo affondamento utensile inferiore fessura, setto affondamento ed emetto warning
else
EgtSetMachiningParam( MCH_MP.DEPTH, dMaxMat)
sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
end
-- eventuali note
if sNotes and #sNotes > 0 then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end
-- eseguo
if not ML.ApplyMachining( true, false) then
if EgtGetOutstrokeInfo() then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
-- impostazione alternativa angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2))
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
if EgtIsMachiningEmpty() then
_, sWarn = EgtGetMachMgrWarning( 0)
EgtSetOperationMode( nMchFId, false)
return false, sWarn
end
--end
return true, sName, nMchFId
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dOvmTail) function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
-- impostazione default a variabili aggiunte
if not BD.OVM_CHAIN_HBEAM then BD.OVM_CHAIN_HBEAM = 8 end
if not BD.C_SIMM_ENC then BD.C_SIMM_ENC = 180 end
-- ingombro del grezzo -- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- inserimento smussi -- inserimento smussi
@@ -262,25 +169,11 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
end end
end end
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0) local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
-- recupero la eventuale lavorazione con lama da sotto
local sCutting2 = ML.FindCutting( 'TailSide_H2', false, true)
-- recupero i dati della eventuale seconda lama
local dSawDiam2 = 0
local dMaxDepth2 = 0
if sCutting2 and EgtMdbSetCurrMachining( sCutting2) then
local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2
dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
end
end
-- 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 bHorizCut = ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA)
local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, BD.MAX_DIM_HTCUT_HBEAM)
( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dMaxDepth2) - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) local bDoubleHorizCut = ( BD.DOWN_HEAD and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bHorizCut = ( not bBigSectionCut and ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and ( b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA)) local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bBigSectionCut and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bDoubleCut = ( not bBigSectionCut and not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 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)
-- flag di lavorazione faccia -- flag di lavorazione faccia
@@ -302,111 +195,8 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
b3Raw:Add( b3NextRaw) b3Raw:Add( b3NextRaw)
end end
end end
-- se taglio per pezzi alti e larghi
local nNewPhase = 0
if bBigSectionCut then
local bFinishingNeeded = false
if bSplit then
-- recupero lunghezza massima di lavoro della sega a catena
local sSawing = ML.FindSawing( 'Sawing')
local dMaxMat = 0
local dTlen = 0
if EgtMdbSetCurrMachining( sSawing or '') then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
dTLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dTLen
end
end
-- assegno offset in lunghezza
local dOffs = 0
if dOvmTail > BD.OVM_CHAIN_HBEAM then
dOffs = dOvmTail - BD.OVM_CHAIN_HBEAM
bFinishingNeeded = true
end
-- se pezzo non troppo alto, taglio singolo da sopra
if b3Raw:getDimZ() < dMaxMat - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL then
local cutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN
sNotesSplit = 'Split;'
bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_TOP, cutDepth, sNotesSplit, dOffs)
if not bOk then return bOk, sErr, nNewPhase end
-- se pezzo non troppo largo, taglio singolo da davanti
elseif b3Raw:getDimY() + BD.CUT_EXTRA_MIN < min( dMaxMat, dTLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then
local cutDepth = b3Raw:getDimY() + BD.CUT_EXTRA_MIN
sNotesSplit = 'Split;'
bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_FRONT, cutDepth, sNotesSplit, dOffs)
if not bOk then return bOk, sErr, nNewPhase end
-- altrimenti tagli dai due fianchi (dietro e davanti)
else
local cutDepth = 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN
local sNotesSplit = 'Presplit;'
local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_BACK, cutDepth, sNotesSplit, dOffs)
if not bOk then return bOk, sErr, nNewPhase end
sNotesSplit = 'Split;'
bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_FRONT, cutDepth, sNotesSplit, dOffs)
if not bOk then return bOk, sErr, nNewPhase end
end
-- se necessaria finitura, creo nuova fase
if bFinishingNeeded then
BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET)
nNewPhase = EgtGetCurrPhase()
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
end
-- se è necessaria la finitura
if bFinishingNeeded or not bSplit then
local sNotes, sNotesFinal
-- se non c'è separazione va aggiunta la nota Cut per l'ultimo taglio e Precut per i tagli precedenti
if not bSplit then
sNotes = 'Precut;'
sNotesFinal = 'Cut;'
end
-- se finitura con lama
if not nOriId or EgtGetInfo( nOriId, 'Q05', 'i') == 1 or EgtGetInfo( nOriId, 'Q05', 'i') == 0 or not bSplit then
local bOk, sErr = Cut.Make( Proc, nNewPhase, nRawId, nPartId, dLenEndRaw, nil, false, true, b3Raw, sNotes, dCurrOvmT)
if not bOk then return bOk, sErr, nNewPhase end
-- se finitura con truciolatore
elseif EgtGetInfo( nOriId, 'Q05', 'i') == 2 then
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then
local sErr = 'Error : part box not found'
EgtOutLog( sErr)
return false, sErr
end
local sPocketing = ML.FindPocketing( 'OpenPocket', nil, 0)
if not sPocketing then
local sErr = 'Error : pocketing not found in library'
EgtOutLog( sErr)
return false, sErr
end
local bOk, sErr = Pocket.Make( Proc, Proc.Id, 0, sPocketing, nPartId, b3Solid)
if not bOk then return bOk, sErr, nNewPhase end
end
if sNotesFinal then
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotesFinal)
end
end
-- se tagli standard -- se tagli standard
elseif not bDoubleHorizCut then if not bDoubleHorizCut then
-- calcolo extra taglio ed accorciamento -- calcolo extra taglio ed accorciamento
local dCutExtra = 0 local dCutExtra = 0
local dAccStart = 0 local dAccStart = 0
@@ -446,12 +236,23 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
end end
-- altrimenti necessari tagli da sopra e sotto con testa opportuna -- altrimenti necessari tagli da sopra e sotto con testa opportuna
else else
-- verifico esistenza della lavorazione con lama da sotto -- recupero la lavorazione con lama da sotto
local sCutting2 = ML.FindCutting( 'TailSide_H2')
if not sCutting2 then if not sCutting2 then
local sErr = 'Error : cutting H2 not found in library' local sErr = 'Error : cutting H2 not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- recupero i dati della seconda lama
local dSawDiam2 = 400
local dMaxDepth2 = 50
if EgtMdbSetCurrMachining( sCutting2) then
local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2
dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
end
end
-- verifico che le due lame riescano a lavorare la sezione -- verifico che le due lame riescano a lavorare la sezione
local dDimZ = b3Raw:getDimZ() local dDimZ = b3Raw:getDimZ()
local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ
@@ -464,14 +265,11 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN
local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN
local dAccStart = 0 local dAccStart = 0
-- limiti da sotto
local dVzLimDwnUp
if BD.TURN then dVzLimDwnUp = -2 end
-- eseguo i tagli da sotto necessari -- eseguo i tagli da sotto necessari
for i = nCuts, 1, -1 do for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsL local dCutOffset = ( i - 1) * dOffsL
local sNotes = EgtIf( bSplit, 'Presplit;', 'Precut;') local sNotes = EgtIf( bSplit, 'Presplit;', 'Precut;')
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw) local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, nil, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw)
if not bOk then return false, sErr end if not bOk then return false, sErr end
end end
-- eseguo i tagli da sopra necessari -- eseguo i tagli da sopra necessari
@@ -483,11 +281,11 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
else else
sNotes = EgtIf( i == 1, 'Cut;', 'Precut;') sNotes = EgtIf( i == 1, 'Cut;', 'Precut;')
end end
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_DOWN, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw) local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_DOWN, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw)
if not bOk then return false, sErr end if not bOk then return false, sErr end
end end
end end
return true, nil, nNewPhase return true
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
+26 -14
View File
@@ -83,8 +83,11 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- recupero la lavorazione -- recupero la lavorazione
local sMillType = 'Mark' local sMillType = 'Mark'
local bDownHead = ( BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1) local bDownHead = ( BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1)
local sMilling local sMilling = ML.FindMilling( sMillType .. EgtIf( bDownHead, '_H2', ''))
sMilling, _, _, bDownHead = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bDownHead) if not sMilling and bDownHead then
sMilling = ML.FindMilling( sMillType)
bDownHead = false
end
if not sMilling then if not sMilling then
local sErr = 'Error : milling not found in library' local sErr = 'Error : milling not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -106,7 +109,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- 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
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -129,7 +132,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro -- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -188,15 +191,15 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end end
end end
-- 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
-- se convesso, lo tratto come due tagli singoli -- se convesso, lo tratto come due tagli singoli
if bConvex then if bConvex then
-- 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
-- lavoro per prima la faccia più diretta in alto -- lavoro per prima la faccia più diretta in alto
local vOrd = { 1, 2} local vOrd = { 1, 2}
if vtN[2]:getZ() > vtN[1]:getZ() then if vtN[2]:getZ() > vtN[1]:getZ() then
@@ -244,12 +247,20 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp
end end
-- verifico se necessari tagli supplementari -- verifico se necessari tagli supplementari
local vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd]) local vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
--DC.PrintOrderCut( vCuts) --DC.PrintOrderCut( vCuts)
if #vCuts > 0 then if #vCuts > 0 then
-- 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
-- sistemo posizione nel DB e nome -- sistemo posizione nel DB e nome
for i = 1, #vCuts do for i = 1, #vCuts do
for j = 1, #vCuts[i] do for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end end
@@ -372,6 +383,7 @@ local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end end
end end
-- Taglio la faccia 2
-- 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
@@ -379,7 +391,6 @@ local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- Taglio la faccia 2
-- creo piano di taglio coincidente con la faccia 2 e lo lavoro -- creo piano di taglio coincidente con la faccia 2 e lo lavoro
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptC[3], vtN[3], b3Solid, GDB_RT.GLOB) local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptC[3], vtN[3], b3Solid, GDB_RT.GLOB)
if AddId then if AddId then
@@ -398,12 +409,13 @@ local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp
end end
-- verifico se necessari tagli supplementari -- verifico se necessari tagli supplementari
local vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd]) local vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
--DC.PrintOrderCut( vCuts) --DC.PrintOrderCut( vCuts)
if #vCuts > 0 then if #vCuts > 0 then
-- sistemo posizione nel DB e nome -- sistemo posizione nel DB e nome
for i = 1, #vCuts do for i = 1, #vCuts do
for j = 1, #vCuts[i] do for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end end
+33 -19
View File
@@ -57,8 +57,11 @@ local function MachineByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Solid,
local bDownHead = ( BD.DOWN_HEAD and vtN[nBigInd]:getZ() < -0.5) local bDownHead = ( BD.DOWN_HEAD and vtN[nBigInd]:getZ() < -0.5)
-- recupero la lavorazione -- recupero la lavorazione
local sCutType = 'HeadSide' local sCutType = 'HeadSide'
local sCutting local sCutting = ML.FindCutting( sCutType .. EgtIf( bDownHead, '_H2', ''))
sCutting, bDownHead = ML.FindCutting( sCutType, bTopHead, bDownHead) if not sCutting and bTopHead then
sCutting = ML.FindCutting( sCutType)
bDownHead = false
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)
@@ -81,20 +84,21 @@ local function MachineByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Solid,
if dAng < -90.5 and dAng > -179.5 then if dAng < -90.5 and dAng > -179.5 then
dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp
end end
-- 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
-- verifico se necessari tagli supplementari -- verifico se necessari tagli supplementari
local vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd]) local vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
--DC.PrintOrderCut( vCuts) --DC.PrintOrderCut( vCuts)
if #vCuts > 0 then if #vCuts > 0 then
-- 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
-- sistemo posizione nel DB e nome -- sistemo posizione nel DB e nome
for i = 1, #vCuts do for i = 1, #vCuts do
for j = 1, #vCuts[i] do for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end end
@@ -158,7 +162,11 @@ local function MakePocket( Proc, nPartId, ptPs, vtN, nFaceRef, nDiffWidth, sMchF
local bTopHead = ( BD.DOWN_HEAD and vtN[nFaceRef]:getZ() > -0.1) local bTopHead = ( BD.DOWN_HEAD and vtN[nFaceRef]:getZ() > -0.1)
local bDownHead = ( BD.DOWN_HEAD and vtN[nFaceRef]:getZ() < 0.1) local bDownHead = ( BD.DOWN_HEAD and vtN[nFaceRef]:getZ() < 0.1)
-- recupero la lavorazione -- recupero la lavorazione
local sPocketing, _, _, bDownHead = ML.FindPocketing( sMchFind.. EgtIf( bDownHead, '_H2', ''), dDiamTool, dElev + dCollSic, nil, bTopHead, bDownHead) local sPocketing = ML.FindPocketing( sMchFind.. EgtIf( bDownHead, '_H2', ''), dDiamTool, dElev + dCollSic)
if not sPocketing and bTopHead then
sPocketing = ML.FindPocketing( sMchFind, dDiamTool, dElev + dCollSic)
bDownHead = false
end
if not sPocketing then if not sPocketing then
local sErr = 'Error : pocketing not found in library' local sErr = 'Error : pocketing not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -194,10 +202,10 @@ local function MakePocket( Proc, nPartId, ptPs, vtN, nFaceRef, nDiffWidth, sMchF
-- imposto elevazione -- imposto elevazione
local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';' local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( 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)
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -263,7 +271,10 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, ptC, vtN,
-- scelta lavorazione -- scelta lavorazione
local sMilling local sMilling
local sTypeMill = EgtIf( nUseRoughTool > 0, 'Long2Cut', 'LongSmallCut') local sTypeMill = EgtIf( nUseRoughTool > 0, 'Long2Cut', 'LongSmallCut')
sMilling = ML.FindMilling( sTypeMill, nil, sTuuidMstr, nil, nil, bTopHead, bDownHead) sMilling = ML.FindMilling( sTypeMill .. EgtIf( bDownHead, '_H2', ''), nil, sTuuidMstr)
if not sMilling and bTopHead then
sMilling = ML.FindMilling( sTypeMill, nil, sTuuidMstr)
end
if not sMilling then if not sMilling then
local sErr = 'Error : milling not found in library' local sErr = 'Error : milling not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -308,7 +319,7 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, ptC, vtN,
EgtSetMachiningParam( MCH_MP.LIPERP, 20) EgtSetMachiningParam( MCH_MP.LIPERP, 20)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.AS_LI) EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.AS_LI)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -523,8 +534,11 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- recupero la lavorazione -- recupero la lavorazione
local sMillType = 'Mark' local sMillType = 'Mark'
local bDownHead = ( BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1) local bDownHead = ( BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1)
local sMilling local sMilling = ML.FindMilling( sMillType .. EgtIf( bDownHead, '_H2', ''))
sMilling, _, _, bDownHead = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bDownHead) if not sMilling and bDownHead then
sMilling = ML.FindMilling( sMillType)
bDownHead = false
end
if not sMilling then if not sMilling then
local sErr = 'Error : milling not found in library' local sErr = 'Error : milling not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -547,7 +561,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- 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
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -572,7 +586,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro -- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
+82 -33
View File
@@ -1,9 +1,6 @@
-- ProcessTenon.lua by Egaltech s.r.l. 2022/05/28 -- ProcessTenon.lua by Egaltech s.r.l. 2021/10/04
-- Gestione calcolo tenone per Travi -- Gestione calcolo tenone per Travi
-- 2021/10/04 Corretto calcolo HCING per pezzi piccoli. -- 2021/10/04 Corretto calcolo HCING per pezzi piccoli.
-- 2022/02/15 Aggiornata VerifyOrientation per macchine con testa da sotto.
-- 2022/05/18 Migliorata gestione attacco.
-- 2022/05/28 Spostato calcolo svuotatura in modulo di libreria.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessTenon = {} local ProcessTenon = {}
@@ -11,7 +8,6 @@ local ProcessTenon = {}
-- Include -- Include
require( 'EgtBase') require( 'EgtBase')
local BL = require( 'BeamLib') local BL = require( 'BeamLib')
local Fbp = require( 'FaceByPocket')
local Cut = require( 'ProcessCut') local Cut = require( 'ProcessCut')
EgtOutLog( ' ProcessTenon started', 1) EgtOutLog( ' ProcessTenon started', 1)
@@ -23,10 +19,6 @@ local ML = require( 'MachiningLib')
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function VerifyOrientation( Proc, vtN, b3Raw) local function VerifyOrientation( Proc, vtN, b3Raw)
-- se PF con testa da sotto, ammessa qualunque orientazione
if BD.C_SIMM and BD.DOWN_HEAD then
return true
end
-- se trave molto bassa -- se trave molto bassa
if b3Raw:getDimZ() <= 120 then if b3Raw:getDimZ() <= 120 then
-- se tenone praticamente in asse, accetto fino a -45 deg -- se tenone praticamente in asse, accetto fino a -45 deg
@@ -81,6 +73,41 @@ function ProcessTenon.Classify( Proc, b3Raw)
return true, bDown return true, bDown
end end
---------------------------------------------------------------------
local function ApplyPocket( Proc, sPocketing, nStep, dSurfStep, nIdSurf, vtExtr)
-- inserisco la lavorazione di svuotatura
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. nStep
local nMchFId = EgtAddMachining( sName, sPocketing)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nIdSurf, -1}})
-- imposto uso faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT)
if dSurfStep > 0 then
-- imposto elevazione
local sNotes = 'MaxElev=' .. EgtNumToString( dSurfStep, 2) .. ';'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
end
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE
if not BD.C_SIMM then
nSCC = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
return true
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
@@ -128,6 +155,8 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- abilitazione lavorazione da sotto -- abilitazione lavorazione da sotto
local bMillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259) local bMillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259)
local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1) local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1)
-- porto inizio curva il più possibile sul bordo
BL.PutStartNearestToEdge( AuxId, b3Solid, bMillDown and not bShortPart)
-- se vero tenone inclinato o non esattamente alle estremità, necessario taglio di lama sulla testa -- se vero tenone inclinato o non esattamente alle estremità, necessario taglio di lama sulla testa
if Proc.Prc ~= 52 and if Proc.Prc ~= 52 and
( not AreSameOrOppositeVectorApprox( vtN, X_AX()) or ( not AreSameOrOppositeVectorApprox( vtN, X_AX()) or
@@ -147,16 +176,43 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetInfo( AddId, 'TASKID', Proc.TaskId) EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- se pezzo piccolo, in coda, con piano inclinato verso il basso e macchina con testa da sotto applico svuotatura -- se pezzo piccolo, in coda, con piano inclinato verso il basso e macchina con testa da sotto applico svuotatura
if bShortPart and vtExtr:getX() < 0 and vtExtr:getZ() < -0.09 and BD.DOWN_HEAD then if bShortPart and vtExtr:getX() < 0 and vtExtr:getZ() < -0.09 and BD.DOWN_HEAD then
-- recupero la lavorazione
local sPockType = EgtIf( bMillDown, 'OpenPocket_H2', 'OpenPocket') local sPockType = EgtIf( bMillDown, 'OpenPocket_H2', 'OpenPocket')
local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, not bMillDown, bMillDown) local sPocketing = ML.FindPocketing( sPockType)
if not sPocketing then local dMaxDepth = 100
local sErr = 'Error : pocketing '..sPockType..' not found in library' local dStep = 30
EgtOutLog( sErr) local nSurfStep
-- acquisisco i dati necessari dall'utensile
if EgtMdbSetCurrMachining( sPocketing) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
dStep = EgtMdbGetCurrMachiningParam( MCH_MP.STEP) or dStep
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- acquisisco elevazione
local dElev = BL.GetFaceElevation( AddId, 0, nPartId)
nSurfStep = ceil( dElev / dMaxDepth)
dSurfStep = dElev / nSurfStep
local bOk = true
local sErr
-- copio superfice al passo superfice e ci applico la lavorazione
for i = nSurfStep, 2, -1 do
local nAddIdTmp = EgtSurfTmPlaneInBBox( nAddGrpId, ptC+((dSurfStep*(i-1))*vtN), vtN, b3Solid, GDB_RT.GLOB)
if nAddIdTmp then
EgtSetName( nAddIdTmp, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( nAddIdTmp, 'TASKID', Proc.TaskId)
-- aggiungo lavorazione
bOk, sErr = ApplyPocket( Proc, sPocketing, i, (dSurfStep + 0), nAddIdTmp, vtExtr)
if not bOk then
break
end
end
end
if not bOk then
return false, sErr return false, sErr
end end
-- eseguo le svuotature necessarie -- faccio ultima superfice
local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid) bOk, sErr = ApplyPocket( Proc, sPocketing, 1, EgtIf( nSurfStep > 1, ( dSurfStep + 0), 0), AddId, vtExtr)
if not bOk then if not bOk then
return false, sErr return false, sErr
end end
@@ -167,17 +223,16 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId} Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bFromBottom = ( bShortPart and vtExtr:getZ() > 0.25) local bFromBottom = ( bShortPart and vtExtr:getZ() > 0.25)
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 if not bOk then return bOk, sErr end
return false, sErr
end
end end
end end
end end
-- recupero la lavorazione -- recupero la lavorazione
local sMillType = 'Tenon' local sMillType = 'Tenon'
local sMilling, _, _, bH2 = ML.FindMilling( sMillType, dTenH, nil, nil, nil, bMillUp, bMillDown) local sCurrType = sMillType .. EgtIf( bMillDown, '_H2', '')
if not sMilling then local sMilling = ML.FindMilling( sCurrType, dTenH) or ML.FindMilling( sCurrType)
sMilling, _, _, bH2 = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown) if not sMilling and bMillUp then
sMilling = ML.FindMilling( sMillType, dTenH) or ML.FindMilling( sMillType)
end end
if not sMilling then if not sMilling then
local sErr = 'Error : milling not found in library' local sErr = 'Error : milling not found in library'
@@ -197,13 +252,6 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCW = ( dSpeed >= 0) bCW = ( dSpeed >= 0)
end end
end end
-- massimo numero di passate e coefficiente di sovrapposizione ta passate
local MAX_PASS = 6
local OVERLAP_COEFF = 0.7
-- porto inizio curva il più possibile sul bordo in alto o in basso
local dMaxDist = OVERLAP_COEFF * dMillDiam * MAX_PASS
local bMyShortPart = ( bShortPart and abs( vtN:getX()) < 0.999 and abs( vtN:getY()) < 0.259)
BL.PutStartNearestToEdge( AuxId, b3Solid, dMaxDist, bH2 ~= bMyShortPart)
-- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente -- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente
local sWarn local sWarn
local dDepth = 0 local dDepth = 0
@@ -214,8 +262,9 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtOutLog( sWarn .. ' (process ' .. tostring( Proc.Id) .. ')') EgtOutLog( sWarn .. ' (process ' .. tostring( Proc.Id) .. ')')
end end
-- determino il numero di passate concentriche (max 6) -- determino il numero di passate concentriche (max 6)
local nPass = min( ceil( dPockL / ( OVERLAP_COEFF * dMillDiam)), MAX_PASS) local MAX_PASS = 6
local dStep = min( dPockL, OVERLAP_COEFF * dMillDiam * MAX_PASS) / nPass local nPass = min( ceil( dPockL / ( 0.7 * dMillDiam)), MAX_PASS)
local dStep = min( dPockL, 0.7 * dMillDiam * MAX_PASS) / nPass
for i = nPass, 1, -1 do for i = nPass, 1, -1 do
-- inserisco la passata finale della lavorazione -- inserisco la passata finale della lavorazione
local sNameF = 'TenF_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local sNameF = 'TenF_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
@@ -244,7 +293,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
-- imposto posizione braccio porta testa -- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE local nSCC = MCH_SCC.NONE
if not BD.C_SIMM and not BD.TURN then if not BD.C_SIMM then
nSCC = MCH_SCC.ADIR_YM nSCC = MCH_SCC.ADIR_YM
if abs( vtExtr:getY()) > 0.088 then if abs( vtExtr:getY()) > 0.088 then
nSCC = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP) nSCC = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
@@ -252,7 +301,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
+7 -4
View File
@@ -46,7 +46,7 @@ function ProcessText.Make( Proc, nPhase, nRawId, nPartId)
return false, sErr return false, sErr
end end
-- verifico che il testo non sia orientato verso il basso (-5 deg) -- verifico che il testo non sia orientato verso il basso (-5 deg)
if vtN:getZ() < - 0.1 and not BD.DOWN_HEAD and not BD.TURN then if vtN:getZ() < - 0.1 and not BD.DOWN_HEAD then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Text from bottom impossible' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Text from bottom impossible'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
@@ -56,8 +56,11 @@ function ProcessText.Make( Proc, nPhase, nRawId, nPartId)
local bMillDown = ( BD.DOWN_HEAD and vtN:getZ() < 0.174) local bMillDown = ( BD.DOWN_HEAD and vtN:getZ() < 0.174)
-- recupero la lavorazione -- recupero la lavorazione
local sMillType = 'Text' local sMillType = 'Text'
--local sMchExt = EgtIf( bMillDown, '_H2', '') local sMchExt = EgtIf( bMillDown, '_H2', '')
local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown) local sMilling = ML.FindMilling( sMillType..sMchExt)
if not sMilling and bMillUp then
sMilling = ML.FindMilling( sMillType)
end
if not sMilling then if not sMilling then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -80,7 +83,7 @@ function ProcessText.Make( Proc, nPhase, nRawId, nPartId)
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
+13 -20
View File
@@ -1,6 +1,5 @@
-- ProcessTyroleanDovetail.lua by Egaltech s.r.l. 2022/03/21 -- ProcessTyroleanDovetail.lua by Egaltech s.r.l. 2020/10/14
-- Gestione calcolo giunzione tirolese -- Gestione calcolo giunzione tirolese
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessTyroleanDovetail = {} local ProcessTyroleanDovetail = {}
@@ -117,12 +116,7 @@ function ProcessTyroleanDovetail.Classify( Proc, b3Raw)
-- considerazioni: al momento non è possibile sapere se ci sono due rastremature o una quindi se è rivolta verso il basso -- considerazioni: al momento non è possibile sapere se ci sono due rastremature o una quindi se è rivolta verso il basso
-- viene dato errore, altrimenti si potrebbe imporre la rotazione di 180 (ovviamente con una sola rastrematura rivolta verso il basso) -- viene dato errore, altrimenti si potrebbe imporre la rotazione di 180 (ovviamente con una sola rastrematura rivolta verso il basso)
if abs(vtN:getZ()) > abs(vtN:getX()) and abs(vtN:getZ()) > abs(vtN:getY()) and vtN:getZ() < -0.5 then if abs(vtN:getZ()) > abs(vtN:getX()) and abs(vtN:getZ()) > abs(vtN:getY()) and vtN:getZ() < -0.5 then
-- se con due facce e corto è fattibile return false
if nFacetCnt < 3 and Proc.Box:getDimX() <= BD.GetMaxLenRidgeLapFromBottom( b3Raw:getDimZ()) then
return true
else
return false
end
end end
end end
end end
@@ -142,7 +136,7 @@ local function EvaluateQParam( Proc, sDephtCham)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nFacetCnt, dOvmTail) local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nFacetCnt)
-- dati delle facce -- dati delle facce
local ptC = {} local ptC = {}
@@ -209,7 +203,7 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw,
-- 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
local sErr = 'Error : missing AddGroup' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -225,7 +219,7 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw,
bCut = false bCut = false
end end
-- se di coda e coincide con taglio di separazione, non va fatto -- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
bCut = false bCut = false
end end
-- se va fatto, inserisco la lavorazione -- se va fatto, inserisco la lavorazione
@@ -257,14 +251,15 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw,
-- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti -- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
local vCuts = {} local vCuts = {}
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]]) vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
elseif vFaceOrd[3] ~= 0 then elseif vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true) vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
end end
if #vCuts > 0 then if #vCuts > 0 then
-- sistemo posizione nel DB e nome -- sistemo posizione nel DB e nome
for i = 1, #vCuts do for i = 1, #vCuts do
for j = 1, #vCuts[i] do for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end end
@@ -323,7 +318,7 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw,
bCut = false bCut = false
end end
-- se di coda e coincide con taglio di separazione, non va fatto -- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
bCut = false bCut = false
end end
-- se va fatto, inserisco la lavorazione -- se va fatto, inserisco la lavorazione
@@ -457,7 +452,7 @@ local function MakeMillCut( Proc, i, j, k, sMilling, nFacInd, TabNAD, rfFac, dOf
end end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -477,7 +472,7 @@ local function MakeMachByMill( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b
-- 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
local sErr = 'Error : missing AddGroup' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -672,9 +667,7 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessTyroleanDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail) function ProcessTyroleanDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- sovramateriale di coda
dOvmTail = dOvmTail or BD.OVM_MID
-- recupero l'ingombro del grezzo di appartenenza -- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- in base al tipo di feature attribuisco il significato dei parametri Q -- in base al tipo di feature attribuisco il significato dei parametri Q
@@ -696,7 +689,7 @@ function ProcessTyroleanDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead,
end end
-- se ho due facce allora è di testa -- se ho due facce allora è di testa
if nFacetCnt == 2 then if nFacetCnt == 2 then
local bOk, sErr = MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nFacetCnt, dOvmTail) local bOk, sErr = MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nFacetCnt)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
else else
local bOk, sErr = MakeMachByMill( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nFacetCnt) local bOk, sErr = MakeMachByMill( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nFacetCnt)
+32 -142
View File
@@ -1,5 +1,5 @@
-- BeamNestProcess.lua by Egaltech s.r.l. 2021/06/14 -- BeamNestProcess.lua by Egaltech s.r.l. 2021/06/14
-- Gestione nesting automatico travi -- Gestione nesting automatico pareti
-- Intestazioni -- Intestazioni
require( 'EgtBase') require( 'EgtBase')
@@ -114,24 +114,9 @@ local function NewMachGroupName()
return nMaxMachGroup + 1 return nMaxMachGroup + 1
end end
local function TotRawCount(Raws)
local nTotRaws = 0
for RawIndex = 1, #Raws do
nTotRaws = nTotRaws + Raws[RawIndex].Count
end
return nTotRaws
end
local function TotPartLen(Parts)
local nTotPartLen = 0
for PartIndex = 1, #Parts do
nTotPartLen = nTotPartLen + ( Parts[PartIndex].Len * Parts[PartIndex].Cnt)
end
return nTotPartLen
end
-- Imposto direttorio libreria specializzata per Travi -- Imposto direttorio libreria specializzata per Travi
EgtAddToPackagePath( NEST.BASEDIR .. '\\LuaLibs\\?.lua') local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
-- Imposto la macchina corrente e verifico sia abilitata per la lavorazione delle Travi -- Imposto la macchina corrente e verifico sia abilitata per la lavorazione delle Travi
EgtSetCurrMachine( NEST.MACHINE) EgtSetCurrMachine( NEST.MACHINE)
@@ -148,22 +133,21 @@ end
EgtRemoveBaseMachineDirFromPackagePath() EgtRemoveBaseMachineDirFromPackagePath()
EgtAddToPackagePath( sMachDir .. '\\Beam\\?.lua') EgtAddToPackagePath( sMachDir .. '\\Beam\\?.lua')
---- Carico le librerie
--_G.package.loaded.WallExec = nil
--local WE = require( 'BeamExec')
--_G.package.loaded.WallLib = nil
--local WL = require( 'BeamLib')
--_G.package.loaded.WProcessLapJoint = nil
--local LapJoint = require( 'WProcessLapJoint')
-- Inizializzo contatori errori e avvisi -- Inizializzo contatori errori e avvisi
local nErrCnt = 0 local nErrCnt = 0
local nWarnCnt = 0 local nWarnCnt = 0
-- Grezzi -- Grezzi
-- lista dei grezzi local Raws = { LenToFill = LEN["1"], StartGap = NEST.STARTOFFSET, MidGap = NEST.OFFSET, EndGap = 0, SortType = -1, Count = QTY["1"]}
local Raws = {} local nTotRaws = Raws.Count
-- creo tabella dei grezzi
for nIndex, nLen in pairs( LEN) do
table.insert(Raws, {LenToFill = nLen, StartGap = NEST.STARTOFFSET, MidGap = NEST.OFFSET, EndGap = 0, SortType = -1})
end
for nIndex, nQty in pairs( QTY) do
Raws[tonumber(nIndex)].Count = nQty
end
--local nTotRaws = Raws.Count
-- Pezzi -- Pezzi
local Parts = {} local Parts = {}
@@ -172,143 +156,50 @@ local Parts = {}
for nPartId, nCount in pairs( PART) do for nPartId, nCount in pairs( PART) do
-- recupero lunghezza pezzo -- recupero lunghezza pezzo
local Len = EgtGetInfo( nPartId, "L", 'd') local Len = EgtGetInfo( nPartId, "L", 'd')
local DispLen = EgtIf( Len <= 1000, 2000, 0) --EgtIf( Len <= 2000, max( 2000, 6000 - Len), 0) local DispLen = EgtIf( Len < 1000, 2000, 0)
table.insert( Parts, {Id = nPartId, Len = Len, DispLen = DispLen, Cnt = nCount}) table.insert( Parts, {Id = nPartId, Len = Len, DispLen = DispLen, Cnt = nCount})
end end
-- lunghezza totale pezzi
local dTotPartLen = TotPartLen( Parts)
-- calcolo media delle barre necessarie
local NeededRawsForType = {}
for RawIndex = 1, #Raws do
NeededRawsForType[RawIndex] = min( ceil( dTotPartLen / Raws[RawIndex].LenToFill), Raws[RawIndex].Count)
end
local RawQtySum = 0
for NeededRawIndex = 1, #NeededRawsForType do
RawQtySum = RawQtySum + NeededRawsForType[NeededRawIndex]
end
local MediumRawQty = ceil( RawQtySum / #NeededRawsForType)
if MediumRawQty > 1 then
MediumRawQty = MediumRawQty - 1
end
-- recupero pezzi piu' corti di mille
local ShortList = {}
local LongList = {}
for PartIndex = 1, #Parts do
if Parts[PartIndex].Len <= 1000 then
table.insert( ShortList, Parts[PartIndex])
else
table.insert( LongList, Parts[PartIndex])
end
end
-- numero di pezzi piccoli per barra
local ShortCount = 0
for ShortIndex = 1, #ShortList do
ShortCount = ShortCount + ShortList[ShortIndex].Cnt
end
local ShortForRaw = floor( ShortCount / MediumRawQty)
local ExtraShortForRaw = fmod( ShortCount, MediumRawQty)
-- creo lista pezzi corti singoli
local SingleShortList = {}
for ShortIndex = 1, #ShortList do
for ShortCount = 1, ShortList[ShortIndex].Cnt do
table.insert( SingleShortList, {Id = ShortList[ShortIndex].Id, Len = ShortList[ShortIndex].Len, DispLen = ShortList[ShortIndex].DispLen, Cnt = 1})
end
end
-- li divido per le barre previste
local RawsShortList = {}
local RawIndex = 0
local ShortRawIndex = 0
for ShortIndex = 1, #SingleShortList do
if ShortRawIndex > 0 then
table.insert( RawsShortList[RawIndex], SingleShortList[ShortIndex])
ShortRawIndex = ShortRawIndex - 1
else
table.insert( RawsShortList, {SingleShortList[ShortIndex]})
RawIndex = RawIndex + 1
ShortRawIndex = ShortForRaw + EgtIf( RawIndex <= ExtraShortForRaw, 1, 0) - 1
end
end
-- Ciclo fino ad esaurimento pezzi o barre -- Ciclo fino ad esaurimento pezzi o barre
local nRawTot = 0 local nRawTot = 0
local dTime = 0 local dTime = 0
local nCycle = 1 while Raws.Count > 0 and PartsToFill( Parts) > 0 do
while TotRawCount( Raws) > 0 and PartsToFill( Parts) > 0 do -- Eseguo ottimizzazione per una barra e visualizzo il risultato
local Res = ExecMaximumFilling( Raws, Parts)
-- creo lista pezzi con pezzi lunghi e pezzi corti di questo Cycle
local PartsToNest = {}
for PartIndex = 1, #LongList do
table.insert( PartsToNest, LongList[PartIndex])
end
for CycleIndex = 1, #RawsShortList do
if CycleIndex <= nCycle then
for PartIndex = 1, #RawsShortList[CycleIndex] do
table.insert( PartsToNest, RawsShortList[CycleIndex][PartIndex])
end
end
end
-- se non ci sono pezzi da nestare, esco
if PartsToFill( PartsToNest) <= 0 then
break
end
-- Eseguo ottimizzazione per ogni lunghezza di barra
local Results = {}
for RawIndex = 1, #Raws do
if Raws[RawIndex].Count > 0 then
Results[RawIndex] = ExecMaximumFilling( Raws[RawIndex], PartsToNest)
else
Results[RawIndex] = { FillRatio = 0.001, LenToFill = 1000}
end
end
-- verifico quale e' quella con meno scarto
local nMinWasteRawIndex = GDB_ID.NULL
local dMinWaste = 100000
for ResultIndex = 1, #Results do
if Results[ResultIndex] then
local dWaste = (1 - Results[ResultIndex].FillRatio) * Raws[ResultIndex].LenToFill
if dWaste < dMinWaste then
dMinWaste = dWaste
nMinWasteRawIndex = ResultIndex
end
end
end
-- verifico se ci sono pezzi -- verifico se ci sono pezzi
if nMinWasteRawIndex > 0 and Results[nMinWasteRawIndex] and Results[nMinWasteRawIndex].DiffParts > 0 then if Res.DiffParts > 0 then
-- creo gruppo di lavorazione -- creo gruppo di lavorazione
local MachGroupName = NewMachGroupName() local MachGroupName = NewMachGroupName()
nMachGroup = EgtAddMachGroup( MachGroupName) nMachGroup = EgtAddMachGroup( MachGroupName)
EgtSetInfo( nMachGroup, "BARLEN", Raws[nMinWasteRawIndex].LenToFill) EgtSetInfo( nMachGroup, "BARLEN", Raws.LenToFill)
EgtSetInfo( nMachGroup, "MATERIAL", NEST.MATERIAL) EgtSetInfo( nMachGroup, "MATERIAL", NEST.MATERIAL)
EgtSetInfo( nMachGroup, "AUTONEST", 1) EgtSetInfo( nMachGroup, "AUTONEST", 1)
-- scrivo dati per variabili P di comunicazione con la macchina in gruppo di lavorazione -- scrivo dati per variabili P di comunicazione con la macchina in gruppo di lavorazione
EgtSetInfo( nMachGroup, "PRODID", NEST.PRODID) EgtSetInfo( nMachGroup, "PRODID", NEST.PRODID)
EgtSetInfo( nMachGroup, "PATTID", nMachGroup) EgtSetInfo( nMachGroup, "PATTID", nMachGroup)
-- Disegno i pezzi -- Disegno i pezzi
local CurrX = Raws[nMinWasteRawIndex].StartGap local CurrX = Raws.StartGap
local nInfoIndex = 1 local nInfoIndex = 1
for i = 1, Results[nMinWasteRawIndex].DiffParts do for i = 1, Res.DiffParts do
local PartIndex = Results[nMinWasteRawIndex].Data[i].Id local PartIndex = Res.Data[i].Id
local PartId = PartsToNest[PartIndex].Id local PartId = Parts[PartIndex].Id
local dLen = PartsToNest[PartIndex].Len local dLen = Parts[PartIndex].Len
for j = 1, Results[nMinWasteRawIndex].Data[i].Count do for j = 1, Res.Data[i].Count do
-- creo pezzo copia -- creo pezzo copia
local nPartDuploId = EgtDuploNew( PartId) local nPartDuploId = EgtDuploNew( PartId)
EgtSetInfo( nMachGroup, "PART" .. nInfoIndex, nPartDuploId .. "," .. CurrX) EgtSetInfo( nMachGroup, "PART" .. nInfoIndex, nPartDuploId .. "," .. CurrX)
CurrX = CurrX + dLen + Raws[nMinWasteRawIndex].MidGap CurrX = CurrX + dLen + Raws.MidGap
nInfoIndex = nInfoIndex + 1 nInfoIndex = nInfoIndex + 1
end end
end end
nRawTot = nRawTot + 1 nRawTot = nRawTot + 1
-- Aggiorno per prossima iterazione
Raws[nMinWasteRawIndex].Count = Raws[nMinWasteRawIndex].Count - 1
for i = 1, Results[nMinWasteRawIndex].DiffParts do
local PartId = Results[nMinWasteRawIndex].Data[i].Id
PartsToNest[PartId].Cnt = PartsToNest[PartId].Cnt - Results[nMinWasteRawIndex].Data[i].Count
end
end end
nCycle = nCycle + 1 -- Aggiorno per prossima iterazione
Raws.Count = Raws.Count - 1
for i = 1, Res.DiffParts do
local PartId = Res.Data[i].Id
Parts[PartId].Cnt = Parts[PartId].Cnt - Res.Data[i].Count
end
end end
-- creo grezzi per ogni gruppo di lavorazione -- creo grezzi per ogni gruppo di lavorazione
@@ -317,7 +208,6 @@ _G.BEAM = {}
BEAM.FILE = NEST.FILE BEAM.FILE = NEST.FILE
BEAM.MACHINE = NEST.MACHINE BEAM.MACHINE = NEST.MACHINE
BEAM.FLAG = 6 -- CREATE_PANEL BEAM.FLAG = 6 -- CREATE_PANEL
BEAM.BASEDIR = NEST.BASEDIR
nMachGroup = EgtGetFirstMachGroup() nMachGroup = EgtGetFirstMachGroup()
while nMachGroup do while nMachGroup do
local nNextMachGroup = EgtGetNextMachGroup( nMachGroup) local nNextMachGroup = EgtGetNextMachGroup( nMachGroup)
+2 -1
View File
@@ -11,7 +11,8 @@ _ENV = EgtProtectGlobal()
EgtEnableDebug( false) EgtEnableDebug( false)
-- Imposto direttorio libreria specializzata per Travi -- Imposto direttorio libreria specializzata per Travi
EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua') local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
-- Verifico che la macchina corrente sia abilitata per la lavorazione delle Travi -- Verifico che la macchina corrente sia abilitata per la lavorazione delle Travi
local sMachDir = EgtGetCurrMachineDir() local sMachDir = EgtGetCurrMachineDir()