Compare commits

..

10 Commits

Author SHA1 Message Date
luca.mazzoleni 624a188481 Merge branch 'develop' into BugFix/ProcessLapJointThreeFacesLOpenPocket 2022-08-26 12:44:09 +02:00
luca.mazzoleni d3c2787f81 Merge branch 'develop' into BugFix/ProcessLapJointThreeFacesLOpenPocket 2022-08-23 08:54:45 +02:00
luca.mazzoleni 93b4adfdec Merge branch 'develop' into BugFix/ProcessLapJointThreeFacesLOpenPocket 2022-08-12 09:58:54 +02:00
luca.mazzoleni 1d672af81e Merge branch 'develop' into BugFix/ProcessLapJointThreeFacesLOpenPocket 2022-08-12 09:34:38 +02:00
luca.mazzoleni 8a79a7838e Merge branch 'BugFix/ScarfOneFaceReduceToCut' into BugFix/ProcessLapJointThreeFacesLOpenPocket 2022-08-09 10:28:00 +02:00
luca.mazzoleni 172fc5180a Merge branch 'develop' into BugFix/ProcessLapJointThreeFacesLOpenPocket 2022-07-29 10:07:59 +02:00
luca.mazzoleni 6064a19a2c Merge branch 'develop' into BugFix/ProcessLapJointThreeFacesLOpenPocket 2022-07-25 15:34:53 +02:00
luca.mazzoleni 5cc85a8735 Merge branch 'develop' into BugFix/ProcessLapJointThreeFacesLOpenPocket 2022-07-25 11:17:30 +02:00
luca.mazzoleni 7af9a9affb BugFix/ProcessLapJointThreeFacesLOpenPocket:
modificata ProcessLapJoint -> SetOpenSide ma attendere il check della lavorazione C++
2022-07-19 15:10:25 +02:00
luca.mazzoleni e26a42dfd9 Merge branch 'develop' into BugFix/ProcessLapJointThreeFacesLOpenPocket 2022-07-19 11:09:12 +02:00
54 changed files with 8657 additions and 13934 deletions
+7 -6
View File
@@ -13,11 +13,12 @@
/Debug64 /Debug64
/Release64 /Release64
/ipch /ipch
/bin
/obj /obj
/.vs /.vs
/bin/*.lua /32/*.lua
/bin/*.ini /32/LuaLibs/*.lua
/bin/LuaLibs/*.lua /32/Images/*.png
/bin/Images/*.png /64/*.lua
.vscode/settings.json /64/LuaLibs/*.lua
bin/Images/.placeholder /64/Images/*.png
+67 -31
View File
@@ -2,67 +2,101 @@ variables:
VERS_MAIN: '1.0' VERS_MAIN: '1.0'
APP_NAME: 'Beam' APP_NAME: 'Beam'
NEW_REL: '' NEW_REL: ''
NET_SHARE_X: '\\10.74.82.201\EgwTech' NET_SHARE_R: '\\10.74.82.201\Artifacts\EGT_SRV\EgtTech'
NET_SHARE_Z: '\\10.74.82.201\Artifacts' NET_USER: '10.74.82.50\Server'
NET_SHARE_Z: '\\10.74.82.200\Artifacts'
NET_USERQ: 'steamw\egalware' NET_USERQ: 'steamw\egalware'
#Note compilazione LUA: #Note compilazione LUA:
# lua54 -o bin\$FileName -s $FileName: -o = output, -s = NON include i debug symbols # lua53 -o 32\$FileName -s $FileName: -o = output, -s = NON include i debug symbols
# helper compilazione LUA a 32 e 64 bit # helper compilazione LUA a 32 bit
.LuaCompile: &LuaCompile .LuaCompile32: &LuaCompile32
- | - |
Set-Alias lua54 C:\Tools\Lua32\luac54 Set-Alias lua53 C:\Tools\Lua32\luac53
echo "Copia file *.ini" echo "Copia file *.ini"
$FileList = Get-ChildItem("*.ini") $FileList = Get-ChildItem("*.ini")
ForEach ($File in $FileList) { ForEach ($File in $FileList) {
$FileName = Split-Path $File -leaf $FileName = Split-Path $File -leaf
Copy-Item -Path $FileName -Destination bin\$FileName Copy-Item -Path $FileName -Destination 32\$FileName
echo "Copy-Item -Path $FileName -Destination bin\$FileName" echo "Copy-Item -Path $FileName -Destination 32\$FileName"
} }
echo "Compilazione file *.lua 32/64bit" echo "Compilazione file *.lua 32bit"
$FileList = Get-ChildItem("*.lua") $FileList = Get-ChildItem("*.lua")
ForEach ($File in $FileList) { ForEach ($File in $FileList) {
$FileName = Split-Path $File -leaf $FileName = Split-Path $File -leaf
lua54 -o bin\$FileName -s $FileName lua53 -o 32\$FileName $FileName
echo "lua54 -o bin\$FileName -s $FileName" echo "lua53 -o 32\$FileName $FileName"
} }
$FileList = Get-ChildItem("LuaLibs\*.lua") $FileList = Get-ChildItem("LuaLibs\*.lua")
ForEach ($File in $FileList) { ForEach ($File in $FileList) {
$FileName = Split-Path $File -leaf $FileName = Split-Path $File -leaf
lua54 -o bin\LuaLibs\$FileName -s LuaLibs\$FileName lua53 -o 32\LuaLibs\$FileName LuaLibs\$FileName
echo "lua54 -o bin\LuaLibs\$FileName -s LuaLibs\$FileName" echo "lua53 -o 32\LuaLibs\$FileName LuaLibs\$FileName"
} }
# helper copia SORGENTI verso cartella di rete X:\ dei SORGENTI
# 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 .CodeReplicaR: &CodeReplicaR
- | - |
net use X: /delete 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 SLEEP 2
net use X: $env:NET_SHARE_X /u:$env:NET_USERQ $ZDRIVE_PASSWD net use R: /delete
ROBOCOPY . X:\EgtData\$env:APP_NAME /MIR /XF .git* /XD .git
SLEEP 2
net use X: /delete
# helper copia script verso cartella di rete X:\ delle cartelle bin # helper copia script verso cartella di rete R:\ delle cartelle 32 e 64
.ReplicaR: &ReplicaR .ReplicaR: &ReplicaR
- | - |
net use X: /delete 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 SLEEP 2
net use X: $env:NET_SHARE_X /u:$env:NET_USERQ $ZDRIVE_PASSWD net use R: /delete
ROBOCOPY /MIR bin X:\EgtData\$env:APP_NAME\bin
ROBOCOPY /MIR Images X:\EgtData\$env:APP_NAME\bin\Images
SLEEP 2
net use X: /delete
# helper copia script verso cartella di rete Z:\ delle cartelle bin # helper copia script verso cartella di rete R:\ delle cartelle 32 e 64
.ReplicaZ: &ReplicaZ .ReplicaZ: &ReplicaZ
- | - |
net use Z: /delete net use Z: /delete
SLEEP 2
net use Z: $env:NET_SHARE_Z /u:$env:NET_USERQ $ZDRIVE_PASSWD net use Z: $env:NET_SHARE_Z /u:$env:NET_USERQ $ZDRIVE_PASSWD
ROBOCOPY /MIR bin Z:\EgtData\$env:APP_NAME\bin ROBOCOPY /MIR 32 Z:\EgtData\$env:APP_NAME\32
ROBOCOPY /MIR Images Z:\EgtData\$env:APP_NAME\bin\Images 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 SLEEP 2
net use Z: /delete net use Z: /delete
@@ -77,7 +111,9 @@ LuaCompile:build:
tags: tags:
- win - win
script: script:
- *LuaCompile - *LuaCompile32
- *LuaCompile64
- *CodeReplicaR - *CodeReplicaR
- *ReplicaR - *ReplicaR
- *ReplicaZ - *ReplicaZ
View File
View File
View File
+20 -168
View File
@@ -1,4 +1,4 @@
-- BatchProcess.lua by Egaltech s.r.l. 2022/05/10 -- BatchProcess.lua by Egaltech s.r.l. 2022/04/28
-- 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.
@@ -23,8 +23,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/04/28 In info generazione aggiunta indicazione se 64bit. -- 2022/04/28 In info generazione aggiunta indicazione se 64bit.
-- 2023/05/03 Tolleranza su sezione portata a 0.1 mm (100 * GEO.EPS_SMALL).
-- 2022/05/10 Dopo aver fatto rotazioni e inversioni dei pezzi cambio chiave Info relative.
-- Intestazioni -- Intestazioni
require( 'EgtBase') require( 'EgtBase')
@@ -59,23 +57,9 @@ end
local sLog = 'BatchProcess : ' .. BEAM.FILE .. ', ' .. BEAM.MACHINE .. ', ' .. sFlag local sLog = 'BatchProcess : ' .. BEAM.FILE .. ', ' .. BEAM.MACHINE .. ', ' .. sFlag
EgtOutLog( sLog) EgtOutLog( sLog)
local sLogFile = EgtChangePathExtension( BEAM.FILE, '.txt')
-- in caso sia richiesta generazione senza check, verifico prima che il file log specifico non contenga errori: se sì, forzo il check
if BEAM.FLAG == 0 then
local hLogFile = io.open( sLogFile, 'r')
if hLogFile then
for line in hLogFile:lines() do
if EgtStartsWith( line, 'ERR') and tonumber( EgtSplitString( line, '=')[2] or 0) > 0 then
BEAM.FLAG = 4
break
end
end
hLogFile:close()
end
end
-- Cancello file di log specifico -- Cancello file di log specifico
EgtEraseFile( sLogFile) local sLogFile = EgtChangePathExtension( BEAM.FILE, '.txt')
EgtEraseFile( sLogFile)
-- Funzioni per scrittura su file di log specifico -- Funzioni per scrittura su file di log specifico
local function WriteErrToLogFile( nErr, sMsg, nRot, nCutId, nTaskId) local function WriteErrToLogFile( nErr, sMsg, nRot, nCutId, nTaskId)
@@ -101,21 +85,6 @@ local function WriteTimeToLogFile( dTime)
hFile:close() hFile:close()
end end
-- Funzioni per riportare stato lavorazione o pezzo in nge
local function WriteErrToNge( nProcId, sErr, sMsg, sRot, sCutId, sTaskId)
EgtSetInfo( nProcId, 'STATUS.ERR', sErr)
EgtSetInfo( nProcId, 'STATUS.MSG', sMsg)
EgtSetInfo( nProcId, 'STATUS.ROT', sRot)
EgtSetInfo( nProcId, 'CUTID', sCutId)
EgtSetInfo( nProcId, 'TASKID', sTaskId)
end
local function WriteFallToNge( nPartId, sErr, sMsg, sCutId, sFall)
EgtSetInfo( nPartId, 'STATUS.ERR', sErr)
EgtSetInfo( nPartId, 'STATUS.MSG', sMsg)
EgtSetInfo( nPartId, 'CUTID', sCutId)
EgtSetInfo( nPartId, 'STATUS.FALL', sFall)
end
-- Funzione per gestire visualizzazione dopo errore -- Funzione per gestire visualizzazione dopo errore
local function PostErrView( nErr, sMsg) local function PostErrView( nErr, sMsg)
if nErr ~= 0 and ( BEAM.FLAG == 1 or BEAM.FLAG == 2) then if nErr ~= 0 and ( BEAM.FLAG == 1 or BEAM.FLAG == 2) then
@@ -137,31 +106,13 @@ end
-- Funzione per aggiornare dati ausiliari -- Funzione per aggiornare dati ausiliari
local function UpdateAuxData( sAuxFile) local function UpdateAuxData( sAuxFile)
local bModif = false local bModif = false
local BtlInfoId = EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL
-- Se definito LOAD90, aggiorno -- Se definito LOAD90, aggiorno
local sLoad90 = EgtGetStringFromIni( 'AuxData', 'LOAD90', '', sAuxFile) local sLoad90 = EgtGetStringFromIni( 'AuxData', 'LOAD90', '', sAuxFile)
if sLoad90 ~= '' then if sLoad90 ~= '' then
local BtlInfoId = EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL
EgtSetInfo( BtlInfoId, 'LOAD90', sLoad90) EgtSetInfo( BtlInfoId, 'LOAD90', sLoad90)
bModif = true bModif = true
end end
-- Se definito UNLOAD, aggiorno
local sUnload = EgtGetStringFromIni( 'AuxData', 'UNLOAD', '', sAuxFile)
if sUnload ~= '' then
EgtSetInfo( BtlInfoId, 'UNLOAD', sUnload)
bModif = true
end
-- Se definito PROJID, aggiorno
local sProjId = EgtGetStringFromIni( 'AuxData', 'PROJID', '', sAuxFile)
if sProjId ~= '' then
EgtSetInfo( BtlInfoId, 'PROJECTNUMBER', sProjId)
bModif = true
end
-- Se definito PRODID, aggiorno
local sProdId = EgtGetStringFromIni( 'AuxData', 'PRODID', '', sAuxFile)
if sProdId ~= '' then
EgtSetInfo( BtlInfoId, 'PRODID', sProdId)
bModif = true
end
return bModif return bModif
end end
@@ -247,11 +198,7 @@ if bToProcess then
EgtEraseFile( sNgeFile) EgtEraseFile( sNgeFile)
-- eseguo import -- eseguo import
EgtNewFile() EgtNewFile()
local nBtlFlag = EIB_FL.TS3_POS + EIB_FL.USEUATTR if not EgtImportBtl( BEAM.FILE, EIB_FL.TS3_POS + EIB_FL.USEUATTR) then
if BD.USE_PART_OFFSET then
nBtlFlag = nBtlFlag + EIB_FL.PARTOFFSET
end
if not EgtImportBtl( BEAM.FILE, nBtlFlag) then
BEAM.ERR = 13 BEAM.ERR = 13
BEAM.MSG = 'Error importing BTL file : ' .. BEAM.FILE BEAM.MSG = 'Error importing BTL file : ' .. BEAM.FILE
WriteErrToLogFile( BEAM.ERR, BEAM.MSG) WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
@@ -319,26 +266,22 @@ if bToProcess then
vBeam[i].PosX = PosX vBeam[i].PosX = PosX
end end
-- Se non già eseguite, applico eventuali rotazioni e inversioni testa-coda -- Eseguo eventuali rotazioni e inversioni testa-coda
for i = 1, #vBeam do for i = 1, #vBeam do
local b3Solid = vBeam[i].Box local b3Solid = vBeam[i].Box
-- rotazione -- rotazione
local dRotAng = EgtGetInfo( vBeam[i].Id, 'ROTATED', 'd') or 0 local dRotAng = EgtGetInfo( vBeam[i].Id, 'ROTATED', 'd')
if abs( dRotAng) > GEO.EPS_ANG_SMALL then if dRotAng and abs( dRotAng) > GEO.EPS_ANG_SMALL then
local ptRotCen = b3Solid:getCenter() local ptRotCen = b3Solid:getCenter()
EgtRotate( vBeam[i].Id, ptRotCen, X_AX(), dRotAng, GDB_RT.GLOB) EgtRotate( vBeam[i].Id, ptRotCen, X_AX(), dRotAng, GDB_RT.GLOB)
b3Solid:rotate( ptRotCen, X_AX(), dRotAng) b3Solid:rotate( ptRotCen, X_AX(), dRotAng)
end end
EgtRemoveInfo( vBeam[i].Id, 'ROTATED')
EgtSetInfo( vBeam[i].Id, 'ROTATED_OK', dRotAng)
-- inversione -- inversione
local dInvAng = 180 - ( EgtGetInfo( vBeam[i].Id, 'INVERTED', 'd') or 0) local dInvAng = 180 - ( EgtGetInfo( vBeam[i].Id, 'INVERTED', 'd') or 0)
if abs( dInvAng) > GEO.EPS_ANG_SMALL then if abs( dInvAng) > GEO.EPS_ANG_SMALL then
local ptInvCen = b3Solid:getCenter() local ptInvCen = b3Solid:getCenter()
EgtRotate( vBeam[i].Id, ptInvCen, Z_AX(), dInvAng, GDB_RT.GLOB) EgtRotate( vBeam[i].Id, ptInvCen, Z_AX(), dInvAng, GDB_RT.GLOB)
end end
EgtRemoveInfo( vBeam[i].Id, 'INVERTED')
EgtSetInfo( vBeam[i].Id, 'INVERTED_OK', 180 - dInvAng)
end end
-- Ne verifico le dimensioni -- Ne verifico le dimensioni
@@ -348,8 +291,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
@@ -391,7 +334,7 @@ if bToProcess then
end end
end end
-- Verifico sezione barra non troppo piccola -- Verifico sezione barra non troppo piccola
if dRawW < BD.MIN_WIDTH - 10 * GEO.EPS_SMALL or dRawH < BD.MIN_HEIGHT - 10 * GEO.EPS_SMALL then if dRawW < BD.MIN_WIDTH - 10 * GEO.EPS_SMALL or dRawH < BD.MIN_HEIGHT - 10 * GEO.EPS_SMALL then
local sOut = 'Sezione (' .. EgtNumToString( dRawW, 2) .. ' x ' .. EgtNumToString( dRawH, 2) .. ') ' .. local sOut = 'Sezione (' .. EgtNumToString( dRawW, 2) .. ' x ' .. EgtNumToString( dRawH, 2) .. ') ' ..
'sotto i limiti della macchina (' .. EgtNumToString( BD.MIN_WIDTH, 2) .. ' x ' .. EgtNumToString( BD.MIN_HEIGHT, 2) .. ')' 'sotto i limiti della macchina (' .. EgtNumToString( BD.MIN_WIDTH, 2) .. ' x ' .. EgtNumToString( BD.MIN_HEIGHT, 2) .. ')'
@@ -401,63 +344,6 @@ if bToProcess then
PostErrView( BEAM.ERR, BEAM.MSG) PostErrView( BEAM.ERR, BEAM.MSG)
return return
end end
-- Se presente offset da btl, verifico se offset uguale per tutti i pezzi
if BD.USE_PART_OFFSET then
vBeamErr = {}
local sPartOffset = EgtGetInfo( vBeam[1].Id, 'PARTOFFSET', 's') or ''
local vPartOffset = EgtSplitString( sPartOffset)
local dRotAng = EgtGetInfo( vBeam[1].Id, 'ROTATED_OK', 'd') or 0
for i = 2, #vBeam do
local sPartOffsetCurrent = EgtGetInfo( vBeam[i].Id, 'PARTOFFSET', 's') or ''
local vPartOffsetCurrent = EgtSplitString( sPartOffsetCurrent)
local dRotAngCurrent = EgtGetInfo( vBeam[i].Id, 'ROTATED_OK', 'd') or 0
local dRotAngDelta = abs( dRotAngCurrent - dRotAng)
if ( #vPartOffset == 5) and ( #vPartOffsetCurrent == 5) then
if dRotAngDelta < GEO.EPS_ANG_SMALL then
if ( vPartOffsetCurrent[2] ~= vPartOffsetCurrent[2])
or ( vPartOffsetCurrent[3] ~= vPartOffset[3])
or ( vPartOffsetCurrent[4] ~= vPartOffset[4])
or ( vPartOffsetCurrent[5] ~= vPartOffset[5]) then
table.insert( vBeamErr, i)
end
elseif dRotAngDelta - 180 < GEO.EPS_ANG_SMALL then
if ( vPartOffsetCurrent[2] ~= vPartOffsetCurrent[4])
or ( vPartOffsetCurrent[3] ~= vPartOffset[5])
or ( vPartOffsetCurrent[4] ~= vPartOffset[2])
or ( vPartOffsetCurrent[5] ~= vPartOffset[3]) then
table.insert( vBeamErr, i)
end
-- se pezzo ruotato di 90deg rispetto al principale, al momento si dà sempre errore
else
table.insert( vBeamErr, i)
end
else
if sPartOffsetCurrent ~= sPartOffset then
table.insert( vBeamErr, i)
end
end
end
if #vBeamErr > 0 then
local sOut = 'Part offset not consistent in beam(s) : '
for i = #vBeamErr, 1, -1 do
local sSeparator = ', '
if i == 1 then
sSeparator = ''
end
sOut = sOut .. vBeam[vBeamErr[i]].Name .. sSeparator
end
BEAM.ERR = 17
BEAM.MSG = sOut
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
PostErrView( BEAM.ERR, BEAM.MSG)
return
end
end
-- Lunghezza della barra -- Lunghezza della barra
local dRawL = ( EgtGetInfo( EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL, 'BARLEN', 'd') or 12000) + 0.1 local dRawL = ( EgtGetInfo( EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL, 'BARLEN', 'd') or 12000) + 0.1
@@ -465,7 +351,7 @@ if bToProcess then
local dOvmHead = vBeam[1].PosX or 0 local dOvmHead = vBeam[1].PosX or 0
-- Sistemo le travi nel grezzo -- Sistemo le travi nel grezzo
local bPbOk, sPbErr = BE.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, nil, vBeam) local bPbOk, sPbErr = BE.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam)
if not bPbOk then if not bPbOk then
BEAM.ERR = 18 BEAM.ERR = 18
BEAM.MSG = sPbErr BEAM.MSG = sPbErr
@@ -495,9 +381,6 @@ if bToProcess then
BEAM.CUTID = Stats[i].CutId BEAM.CUTID = Stats[i].CutId
BEAM.TASKID = Stats[i].TaskId BEAM.TASKID = Stats[i].TaskId
WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID) WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
if Stats[i].ProcId then
WriteErrToNge( Stats[i].ProcId, BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
end
elseif Stats[i].Err > 0 then elseif Stats[i].Err > 0 then
nErrCnt = nErrCnt + 1 nErrCnt = nErrCnt + 1
sOutput = sOutput .. string.format( '[%d,%d] %s\n', Stats[i].CutId, Stats[i].TaskId, sMsg) sOutput = sOutput .. string.format( '[%d,%d] %s\n', Stats[i].CutId, Stats[i].TaskId, sMsg)
@@ -507,9 +390,6 @@ if bToProcess then
BEAM.CUTID = Stats[i].CutId BEAM.CUTID = Stats[i].CutId
BEAM.TASKID = Stats[i].TaskId BEAM.TASKID = Stats[i].TaskId
WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID) WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
if Stats[i].ProcId then
WriteErrToNge( Stats[i].ProcId, BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
end
elseif Stats[i].Err < 0 then elseif Stats[i].Err < 0 then
-- se segnalazione scarico pezzo standard, incompleto o a caduta -- se segnalazione scarico pezzo standard, incompleto o a caduta
if Stats[i].Err == -100 or Stats[i].Err == -101 or Stats[i].Err == -102 then if Stats[i].Err == -100 or Stats[i].Err == -101 or Stats[i].Err == -102 then
@@ -518,9 +398,6 @@ if bToProcess then
BEAM.CUTID = Stats[i].CutId BEAM.CUTID = Stats[i].CutId
BEAM.FALL = abs( Stats[i].Err + 100) BEAM.FALL = abs( Stats[i].Err + 100)
WriteFallToLogFile( BEAM.ERR, BEAM.MSG, BEAM.CUTID, BEAM.FALL) WriteFallToLogFile( BEAM.ERR, BEAM.MSG, BEAM.CUTID, BEAM.FALL)
if Stats[i].ProcId then
WriteFallToNge( Stats[i].PartId, BEAM.ERR, BEAM.MSG, BEAM.CUTID, BEAM.FALL)
end
-- altri avvertimenti -- altri avvertimenti
else else
nWarnCnt = nWarnCnt + 1 nWarnCnt = nWarnCnt + 1
@@ -531,9 +408,6 @@ if bToProcess then
BEAM.CUTID = Stats[i].CutId BEAM.CUTID = Stats[i].CutId
BEAM.TASKID = Stats[i].TaskId BEAM.TASKID = Stats[i].TaskId
WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID) WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
if Stats[i].ProcId then
WriteErrToNge( Stats[i].ProcId, BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
end
end end
end end
end end
@@ -549,60 +423,39 @@ if bToProcess then
PostWarnView( 19, sOutput) PostWarnView( 19, sOutput)
end end
-- Altrimenti carico il progetto salvato, rileggo gli errori da nge e riscrivo il log txt con gli stati precedenti -- Altrimenti carico il progetto salvato e dichiaro nessun errore
else else
EgtOutLog( ' +++ Loading Project already processed >>>') EgtOutLog( ' +++ Loading Project already processed >>>')
-- Carico il progetto già fatto -- Carico il progetto già fatto
EgtOpenFile( sNgeFile) EgtOpenFile( sNgeFile)
-- Riscrivo il log txt -- Dichiaro nessun errore
local nPartId = EgtGetFirstPart() local nPartId = EgtGetFirstPart()
while nPartId do while nPartId do
local nCutId = EgtGetInfo( nPartId, 'CUTID') local nCutId = EgtGetInfo( nPartId, 'CUTID')
if nCutId then if nCutId then
-- stato a livello di singola feature
local nProcId = EgtGetFirstInGroup( EgtGetFirstNameInGroup( nPartId, 'Processings') or GDB_ID.NULL) local nProcId = EgtGetFirstInGroup( EgtGetFirstNameInGroup( nPartId, 'Processings') or GDB_ID.NULL)
while nProcId do while nProcId do
local bIsFea = EgtExistsInfo( nProcId, 'GRP') and EgtExistsInfo( nProcId, 'PRC') local bIsFea = EgtExistsInfo( nProcId, 'GRP') and EgtExistsInfo( nProcId, 'PRC')
local nTaskId = EgtGetInfo( nProcId, 'TASKID') local nTaskId = EgtGetInfo( nProcId, 'TASKID')
local sErr = EgtGetInfo( nProcId, 'STATUS.ERR') or 0
local sMsg = EgtGetInfo( nProcId, 'STATUS.MSG') or '---'
local sRot = EgtGetInfo( nProcId, 'STATUS.ROT') or 0
if bIsFea and nTaskId then if bIsFea and nTaskId then
BEAM.ERR = sErr BEAM.ERR = 0
BEAM.MSG = sMsg BEAM.MSG = '---'
BEAM.ROT = sRot BEAM.ROT = 0
BEAM.CUTID = nCutId BEAM.CUTID = nCutId
BEAM.TASKID = nTaskId BEAM.TASKID = nTaskId
WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID) WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
end end
nProcId = EgtGetNext( nProcId) nProcId = EgtGetNext( nProcId)
end end
-- stato a livello di pezzo
local sErr = EgtGetInfo( nPartId, 'STATUS.ERR') or 0
if sErr == -100 or sErr == -101 or sErr == -102 then
local sMsg = EgtGetInfo( nPartId, 'STATUS.MSG') or '---'
local sFall = EgtGetInfo( nPartId, 'STATUS.FALL') or 0
BEAM.ERR = sErr
BEAM.MSG = sMsg
BEAM.CUTID = nCutId
BEAM.FALL = sFall
WriteFallToLogFile( BEAM.ERR, BEAM.MSG, BEAM.CUTID, BEAM.FALL)
end
end end
nPartId = EgtGetNextPart( nPartId) nPartId = EgtGetNextPart( nPartId)
end end
-- Aggiorno eventuali dati ausiliari -- Aggiorno eventuali dati ausiliari
UpdateAuxData( sBtmFile) UpdateAuxData( sBtmFile)
-- Anche se non è da riprocessare, imposto nome file CN.
-- Se file TS7 importato da altro PC, 'BEAM.FILE' è cambiato da un PC all'altro. Di conseguenza si deve aggiornare nome file che si andrà a generare.
local _, sName, _ = EgtSplitPath( BEAM.FILE)
EgtSetInfo( EgtGetLastMachGroup(), 'NcName', sName .. '.cnc')
-- Passo in modalità lavora -- Passo in modalità lavora
EgtSetCurrMachGroup( EgtGetLastMachGroup()) EgtSetCurrMachGroup( EgtGetLastMachGroup())
-- Se necessario eseguo aggiornamento con setup corrente e ricalcolo delle lavorazioni -- Se necessario eseguo aggiornamento con setup corrente e ricalcolo delle lavorazioni
if bToRecalc or BEAM.FLAG == 3 or BEAM.FLAG == 4 then if bToRecalc then
EgtOutLog( ' +++ Recalculating all dispositions and machinings >>>') EgtOutLog( ' +++ Recalculating all dispositions and machinings >>>')
EgtImportSetup() EgtImportSetup()
EgtApplyAllMachinings() EgtApplyAllMachinings()
@@ -643,7 +496,7 @@ if ( BEAM.FLAG == 0 and ( bToProcess or bToRecalc)) or BEAM.FLAG == 3 or BEAM.F
BEAM.MSG = 'Axis outstroke ' .. sErr BEAM.MSG = 'Axis outstroke ' .. sErr
elseif nErr == MCH_SHE.SPECIAL then elseif nErr == MCH_SHE.SPECIAL then
BEAM.ERR = 24 BEAM.ERR = 24
BEAM.MSG = 'Special error ' .. sErr BEAM.MSG = 'Clamp move error ' .. sErr
else else
BEAM.ERR = 25 BEAM.ERR = 25
BEAM.MSG = 'General failure (contact supplier)' BEAM.MSG = 'General failure (contact supplier)'
@@ -666,8 +519,7 @@ if ( BEAM.FLAG == 0 and ( bToProcess or bToRecalc)) or BEAM.FLAG == 3 or BEAM.F
end end
-- *** Genero programma CN *** ( se richiesto) -- *** Genero programma CN *** ( se richiesto)
local bIsGenerationEnabled = ( EgtVerifyKeyOption( 110) == false) if BEAM.FLAG == 0 or BEAM.FLAG == 4 then
if bIsGenerationEnabled and ( 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' .. EgtIf( EgtIs64bit(), ' 64bit', '')
if EgtGetExeVersion then if EgtGetExeVersion then
+11 -29
View File
@@ -1,4 +1,4 @@
-- BatchProcessNew.lua by Egaltech s.r.l. 2024/01/10 -- BatchProcessNew.lua by Egaltech s.r.l. 2022/08/01
-- 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).
@@ -12,7 +12,6 @@
-- 2022/04/28 In info generazione aggiunta indicazione se 64bit. -- 2022/04/28 In info generazione aggiunta indicazione se 64bit.
-- 2022/07/24 Modifica per cancellare lavorazioni con ricalcolo e barra già definita. -- 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). -- 2022/08/01 Tolleranza su sezione portata a 0.1 mm (100 * GEO.EPS_SMALL).
-- 2024/01/10 Modifiche per centrare i pezzi in Y sulla tavola (come in BeamExec).
-- Intestazioni -- Intestazioni
require( 'EgtBase') require( 'EgtBase')
@@ -45,23 +44,9 @@ end
local sLog = 'BatchProcess : ' .. BEAM.FILE .. ', ' .. BEAM.MACHINE .. ', ' .. sFlag local sLog = 'BatchProcess : ' .. BEAM.FILE .. ', ' .. BEAM.MACHINE .. ', ' .. sFlag
EgtOutLog( sLog) EgtOutLog( sLog)
local sLogFile = EgtChangePathExtension( BEAM.FILE, '.txt')
-- in caso sia richiesta generazione senza check, verifico prima che il file log specifico non contenga errori: se sì, forzo il check
if BEAM.FLAG == 0 then
local hLogFile = io.open( sLogFile, 'r')
if hLogFile then
for line in hLogFile:lines() do
if EgtStartsWith( line, 'ERR') and tonumber( EgtSplitString( line, '=')[2] or 0) > 0 then
BEAM.FLAG = 4
break
end
end
hLogFile:close()
end
end
-- Cancello file di log specifico -- Cancello file di log specifico
EgtEraseFile( sLogFile) local sLogFile = EgtChangePathExtension( BEAM.FILE, '.txt')
EgtEraseFile( sLogFile)
-- Funzioni per scrittura su file di log specifico -- Funzioni per scrittura su file di log specifico
local function WriteErrToLogFile( nErr, sMsg, nRot, nCutId, nTaskId) local function WriteErrToLogFile( nErr, sMsg, nRot, nCutId, nTaskId)
@@ -224,7 +209,10 @@ if bToProcess then
EgtSetCurrMachGroup() EgtSetCurrMachGroup()
-- Area tavola -- Area tavola
local b3Tab = EgtGetTableArea() local b3Tab = EgtGetTableArea()
-- Sezione del grezzo -- Calcolo posizione estremo TR o BR della tavola rispetto a sua origine in BL
BD.OriXR = Point3d( b3Tab:getDimX(), EgtIf( BD.RIGHT_LOAD, 0, b3Tab:getDimY()), 0)
BD.PosXR = EgtIf( BD.RIGHT_LOAD, MCH_CR.BR, MCH_CR.TR)
-- Calcolo minimo grezzo scaricabile
local nRawId = EgtGetFirstRawPart() local nRawId = EgtGetFirstRawPart()
if not nRawId then if not nRawId then
BEAM.ERR = 14 BEAM.ERR = 14
@@ -234,11 +222,6 @@ if bToProcess then
return return
end end
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- Calcolo posizione estremo TR o BR della tavola rispetto a sua origine in BL
local dPosY = EgtIf( BD.CENTER_BEAM, ( b3Tab:getDimY() + b3Raw:getDimY() * EgtIf( BD.RIGHT_LOAD, -1, 1)) / 2, EgtIf( BD.RIGHT_LOAD, 0, b3Tab:getDimY()))
BD.OriXR = Point3d( b3Tab:getDimX(), dPosY, 0)
BD.PosXR = EgtIf( BD.RIGHT_LOAD, MCH_CR.BR, MCH_CR.TR)
-- Calcolo minimo grezzo scaricabile
BE.CalcMinUnloadableRaw( b3Raw:getDimY(), b3Raw:getDimZ()) BE.CalcMinUnloadableRaw( b3Raw:getDimY(), b3Raw:getDimZ())
-- altrimenti devo recuperare i pezzi per creare la barra -- altrimenti devo recuperare i pezzi per creare la barra
else else
@@ -419,7 +402,7 @@ if bToProcess then
end end
-- Sistemo le travi nel grezzo -- Sistemo le travi nel grezzo
local bPbOk, sPbErr = BE.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, nil, vBeam, BEAM.FLAG == 6) local bPbOk, sPbErr = BE.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, BEAM.FLAG == 6)
if not bPbOk then if not bPbOk then
BEAM.ERR = 18 BEAM.ERR = 18
BEAM.MSG = sPbErr BEAM.MSG = sPbErr
@@ -576,7 +559,7 @@ else
-- Passo in modalità lavora -- Passo in modalità lavora
EgtSetCurrMachGroup( EgtGetLastMachGroup()) EgtSetCurrMachGroup( EgtGetLastMachGroup())
-- Se necessario eseguo aggiornamento con setup corrente e ricalcolo delle lavorazioni -- Se necessario eseguo aggiornamento con setup corrente e ricalcolo delle lavorazioni
if bToRecalc or BEAM.FLAG == 3 or BEAM.FLAG == 4 then if bToRecalc then
EgtOutLog( ' +++ Recalculating all dispositions and machinings >>>') EgtOutLog( ' +++ Recalculating all dispositions and machinings >>>')
EgtImportSetup() EgtImportSetup()
EgtApplyAllMachinings() EgtApplyAllMachinings()
@@ -617,7 +600,7 @@ if ( BEAM.FLAG == 0 and ( bToProcess or bToRecalc)) or BEAM.FLAG == 3 or BEAM.F
BEAM.MSG = 'Axis outstroke ' .. sErr BEAM.MSG = 'Axis outstroke ' .. sErr
elseif nErr == MCH_SHE.SPECIAL then elseif nErr == MCH_SHE.SPECIAL then
BEAM.ERR = 24 BEAM.ERR = 24
BEAM.MSG = 'Special error ' .. sErr BEAM.MSG = 'Clamp move error ' .. sErr
else else
BEAM.ERR = 25 BEAM.ERR = 25
BEAM.MSG = 'General failure (contact supplier)' BEAM.MSG = 'General failure (contact supplier)'
@@ -640,8 +623,7 @@ if ( BEAM.FLAG == 0 and ( bToProcess or bToRecalc)) or BEAM.FLAG == 3 or BEAM.F
end end
-- *** Genero programma CN *** ( se richiesto) -- *** Genero programma CN *** ( se richiesto)
local bIsGenerationEnabled = ( EgtVerifyKeyOption( 110) == false) if BEAM.FLAG == 0 or BEAM.FLAG == 4 then
if bIsGenerationEnabled and ( 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' .. EgtIf( EgtIs64bit(), ' 64bit', '')
if EgtGetExeVersion then if EgtGetExeVersion then
+99 -52
View File
@@ -1,56 +1,103 @@
REM Compilazione degli script Beam Egaltech 2023.11.08 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 Per togliere info di debug aggiungere flag -s prima del nome del file di input
REM Compilazione 32 e 64 bit REM Compilazione 32 bit
\EgtProg\Dll32\luac54 -o bin\LuaLibs\BeamExec.lua -s LuaLibs\BeamExec.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\BeamExec.lua LuaLibs\BeamExec.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\BeamLib.lua -s LuaLibs\BeamLib.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\BeamLib.lua LuaLibs\BeamLib.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\DiceCut.lua -s LuaLibs\DiceCut.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\DiceCut.lua LuaLibs\DiceCut.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\FaceByPocket.lua -s LuaLibs\FaceByPocket.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\FaceByPocket.lua LuaLibs\FaceByPocket.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\FacesBySaw.lua -s LuaLibs\FacesBySaw.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\FacesBySaw.lua LuaLibs\FacesBySaw.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\FeatureTopology.lua -s LuaLibs\FeatureTopology.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\MachiningLib.lua LuaLibs\MachiningLib.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\MachiningLib.lua -s LuaLibs\MachiningLib.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessBlockHausFront.lua LuaLibs\ProcessBlockHausFront.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessBlockHausFront.lua -s LuaLibs\ProcessBlockHausFront.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessChamfer.lua LuaLibs\ProcessChamfer.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessChamfer.lua -s LuaLibs\ProcessChamfer.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessCut.lua LuaLibs\ProcessCut.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessCut.lua -s LuaLibs\ProcessCut.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDecor.lua LuaLibs\ProcessDecor.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDecor.lua -s LuaLibs\ProcessDecor.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDoubleCut.lua LuaLibs\ProcessDoubleCut.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDoubleCut.lua -s LuaLibs\ProcessDoubleCut.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDovetail.lua LuaLibs\ProcessDovetail.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDovetail.lua -s LuaLibs\ProcessDovetail.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDrill.lua LuaLibs\ProcessDrill.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDrill.lua -s LuaLibs\ProcessDrill.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDtMortise.lua LuaLibs\ProcessDtMortise.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDtMortise.lua -s LuaLibs\ProcessDtMortise.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDtTenon.lua LuaLibs\ProcessDtTenon.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDtTenon.lua -s LuaLibs\ProcessDtTenon.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessFreeContour.lua LuaLibs\ProcessFreeContour.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessFreeContour.lua -s LuaLibs\ProcessFreeContour.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessFrenchRidgeLap.lua LuaLibs\ProcessFrenchRidgeLap.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessFrenchRidgeLap.lua -s LuaLibs\ProcessFrenchRidgeLap.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessHeadCut.lua LuaLibs\ProcessHeadCut.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessHeadCut.lua -s LuaLibs\ProcessHeadCut.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLapJoint.lua LuaLibs\ProcessLapJoint.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessLapJoint.lua -s LuaLibs\ProcessLapJoint.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLapJointNew.lua LuaLibs\ProcessLapJointNew.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessLongCut.lua -s LuaLibs\ProcessLongCut.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLongCut.lua LuaLibs\ProcessLongCut.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessLongDoubleCut.lua -s LuaLibs\ProcessLongDoubleCut.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLongDoubleCut.lua LuaLibs\ProcessLongDoubleCut.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessMark.lua -s LuaLibs\ProcessMark.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessMark.lua LuaLibs\ProcessMark.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessMortise.lua -s LuaLibs\ProcessMortise.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessMortise.lua LuaLibs\ProcessMortise.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfCamb.lua -s LuaLibs\ProcessProfCamb.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfCamb.lua LuaLibs\ProcessProfCamb.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfConcave.lua -s LuaLibs\ProcessProfConcave.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfConcave.lua LuaLibs\ProcessProfConcave.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfConvex.lua -s LuaLibs\ProcessProfConvex.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfConvex.lua LuaLibs\ProcessProfConvex.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfFront.lua -s LuaLibs\ProcessProfFront.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfFront.lua LuaLibs\ProcessProfFront.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfHead.lua -s LuaLibs\ProcessProfHead.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfHead.lua LuaLibs\ProcessProfHead.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessRidgeLap.lua -s LuaLibs\ProcessRidgeLap.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessRidgeLap.lua LuaLibs\ProcessRidgeLap.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessRoundArch.lua -s LuaLibs\ProcessRoundArch.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessRoundArch.lua LuaLibs\ProcessRoundArch.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessSawCut.lua -s LuaLibs\ProcessSawCut.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessSawCut.lua LuaLibs\ProcessSawCut.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessScarfJoint.lua -s LuaLibs\ProcessScarfJoint.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessScarfJoint.lua LuaLibs\ProcessScarfJoint.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessSimpleScarf.lua -s LuaLibs\ProcessSimpleScarf.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessSimpleScarf.lua LuaLibs\ProcessSimpleScarf.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessSplit.lua -s LuaLibs\ProcessSplit.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessSplit.lua LuaLibs\ProcessSplit.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessStepJoint.lua -s LuaLibs\ProcessStepJoint.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessStepJoint.lua LuaLibs\ProcessStepJoint.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessStepJointNotch.lua -s LuaLibs\ProcessStepJointNotch.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessStepJointNotch.lua LuaLibs\ProcessStepJointNotch.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessTenon.lua -s LuaLibs\ProcessTenon.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessTenon.lua LuaLibs\ProcessTenon.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessText.lua -s LuaLibs\ProcessText.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessText.lua LuaLibs\ProcessText.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessTyroleanDovetail.lua -s LuaLibs\ProcessTyroleanDovetail.lua \EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessTyroleanDovetail.lua LuaLibs\ProcessTyroleanDovetail.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessVariant.lua -s LuaLibs\ProcessVariant.lua \EgtProg\Dll32\luac53 -o 32\BatchProcess.lua BatchProcess.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProbing.lua -s LuaLibs\ProcessProbing.lua \EgtProg\Dll32\luac53 -o 32\BatchProcessNew.lua BatchProcessNew.lua
\EgtProg\Dll32\luac54 -o bin\BatchProcess.lua -s BatchProcess.lua \EgtProg\Dll32\luac53 -o 32\GetBeamData.lua GetBeamData.lua
\EgtProg\Dll32\luac54 -o bin\BatchProcessNew.lua -s BatchProcessNew.lua \EgtProg\Dll32\luac53 -o 32\NestProcess.lua NestProcess.lua
\EgtProg\Dll32\luac54 -o bin\GetBeamData.lua -s GetBeamData.lua \EgtProg\Dll32\luac53 -o 32\Process.lua Process.lua
\EgtProg\Dll32\luac54 -o bin\NestProcess.lua -s NestProcess.lua \EgtProg\Dll32\luac53 -o 32\Rotate.lua Rotate.lua
\EgtProg\Dll32\luac54 -o bin\Process.lua -s Process.lua \EgtProg\Dll32\luac53 -o 32\Swap.lua Swap.lua
\EgtProg\Dll32\luac54 -o bin\Rotate.lua -s Rotate.lua
\EgtProg\Dll32\luac54 -o bin\Swap.lua -s Swap.lua REM Compilazione 64 bit
\EgtProg\Dll32\luac54 -o bin\Version.lua -s Version.lua
\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
+1 -1
View File
@@ -41,4 +41,4 @@ GWD.OVM_MID = BD.OVM_MID
-- Tutto ok -- Tutto ok
GWD.ERR = 0 GWD.ERR = 0
EgtOutLog( ' +++ GetBeamData completed') EgtOutLog( ' +++ GetWallData completed')
+112 -1086
View File
File diff suppressed because it is too large Load Diff
+110 -782
View File
File diff suppressed because it is too large Load Diff
+17 -25
View File
@@ -1,4 +1,4 @@
-- DiceCut.lua by Egaltech s.r.l. 2024/01/23 -- DiceCut.lua by Egaltech s.r.l. 2022/02/18
-- 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
@@ -144,8 +144,8 @@ local function GetOrtoCutCenter( FacetId, ptC, vtN, vtO, dOffsetEff, dNzLimDwnUp
EgtErase( IdAuxLocal) EgtErase( IdAuxLocal)
EgtSetGridFrame(Frame3d()) EgtSetGridFrame(Frame3d())
-- riferimento intrinseco -- riferimento intrinseco
local asseX = Vector3d( vtO) local asseX = vtO
local asseY = vtN ^ asseX local asseY = asseX ^ vtN
local Frame = Frame3d( ptC, ptC + asseX, ptC + asseY) local Frame = Frame3d( ptC, ptC + asseX, ptC + asseY)
-- ingombro della faccia secondo questo riferimento -- ingombro della faccia secondo questo riferimento
local Box = EgtGetBBoxRef( FacetId, GDB_BB.STANDARD, Frame) local Box = EgtGetBBoxRef( FacetId, GDB_BB.STANDARD, Frame)
@@ -160,11 +160,12 @@ local function GetOrtoCutCenter( FacetId, ptC, vtN, vtO, dOffsetEff, dNzLimDwnUp
end end
local N = ceil( dLen / dOffsetEff) local N = ceil( dLen / dOffsetEff)
local dOffsetRel = ( dLen / N) + 10 * GEO.EPS_SMALL local dOffsetRel = dLen / N
local dCopyPlane local dCopyPlane
local dCenOffs = ( Box:getMax():getX() + Box:getMin():getX()) / 2 local dCenOffs = ( Box:getMax():getX() + Box:getMin():getX()) / 2
if dLen <= dOffsetRel then if dLen <= dOffsetRel then
--dOffsetRel = 0
dCopyPlane = 1 dCopyPlane = 1
elseif dLen <= 2 * dOffsetRel then elseif dLen <= 2 * dOffsetRel then
dOffsetRel = dOffsetEff dOffsetRel = dOffsetEff
@@ -176,7 +177,8 @@ local function GetOrtoCutCenter( FacetId, ptC, vtN, vtO, dOffsetEff, dNzLimDwnUp
dCopyPlane = 0.5 dCopyPlane = 0.5
end end
end end
return dOffsetRel, dCopyPlane, dCenOffs, ptS return dOffsetRel, dCopyPlane, dCenOffs, ptS
end end
@@ -275,15 +277,12 @@ local function VerifyFirstOrthoCut( CutTable, OffsetP, BBoxRawPart, dNzLimDwnUp)
-- normale alla faccia ortogonale -- normale alla faccia ortogonale
local _, vtO = EgtSurfTmFacetCenter( CutOId, 0, GDB_ID.ROOT) local _, vtO = EgtSurfTmFacetCenter( CutOId, 0, GDB_ID.ROOT)
vtO = vtO - vtO * vtN1 * vtN1 ; vtO:normalize() vtO = vtO - vtO * vtN1 * vtN1 ; vtO:normalize()
local dMaxElev = EgtSurfTmFacetElevationInBBox( CutOId, 0, BBoxRawPart, true, GDB_ID.ROOT)
-- calcolo lunghezza prima semi-faccia -- calcolo lunghezza prima semi-faccia
local asseX1 = vtO local asseX1 = vtO
local asseY1 = vtN1 ^ asseX1 local asseY1 = vtN1 ^ asseX1
local Frame1 = Frame3d( ptC1, ptC1+asseX1, ptC1+asseY1) local Frame1 = Frame3d( ptC1, ptC1+asseX1, ptC1+asseY1)
local Box1 = EgtGetBBoxRef( Cut1Id, GDB_BB.STANDARD, Frame1) local Box1 = EgtGetBBoxRef( Cut1Id, GDB_BB.STANDARD, Frame1)
local x1 = Box1:getDimX() local x1 = Box1:getDimX()
-- prendo il massimo tra la lugnhezza della faccia parallela e l'elevazione della corrispondente ortogonale
x1 = max( x1, dMaxElev)
-- calcolo lunghezza seconda semi-faccia -- calcolo lunghezza seconda semi-faccia
local asseX2 = vtO local asseX2 = vtO
local asseY2 = vtN2 ^ asseX2 local asseY2 = vtN2 ^ asseX2
@@ -378,13 +377,12 @@ end
-- ptCBond*: il punto centrale della superfice limitante (se non esistono altre superfici può essere omesso) -- ptCBond*: il punto centrale della superfice limitante (se non esistono altre superfici può essere omesso)
-- vtNBond*: il versore normale della superfice limitante (se non esistono altre superfici può essere omesso) -- vtNBond*: il versore normale della superfice limitante (se non esistono altre superfici può essere omesso)
-- dOrthoMaxDim : massima profondità taglio se faccia singola perpendicolare facce laterali trave -- dOrthoMaxDim : massima profondità taglio se faccia singola perpendicolare facce laterali trave
-- dCustMaxDimDice: dimensione massima customizzata, sostituisce il parametro BD.MAX_DIM_DICE (se negativa qualunque, se positiva deve stare nel MAX) -- dCustMaxDimDice: dimensione massima customizzata, sostituisce il parametro BD.MAX_DIM_DICE
-- bDownHead : taglio con testa da sotto -- bDownHead : taglio con testa da sotto
---------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------
function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPlanes, ptCBond, vtNBond, dOrthoMaxDim, dCustMaxDimDice, bDownHead) function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPlanes, ptCBond, vtNBond, dOrthoMaxDim, dCustMaxDimDice, bDownHead)
local dMaxDimDice = BD.MAX_DIM_DICE local dMaxDimDice = EgtIf( dCustMaxDimDice and dCustMaxDimDice < BD.MAX_DIM_DICE, dCustMaxDimDice, BD.MAX_DIM_DICE)
if dCustMaxDimDice and dCustMaxDimDice < BD.MAX_DIM_DICE then dMaxDimDice = abs( dCustMaxDimDice) end
local dTolerance = 0 -- distanza di sicurezza per i tagli ortogonali local dTolerance = 0 -- distanza di sicurezza per i tagli ortogonali
local OffsetP = dMaxDimDice -- distanza tra i piani paralleli local OffsetP = dMaxDimDice -- distanza tra i piani paralleli
local StepP = 100 -- numero massimo di piani paralleli da generare local StepP = 100 -- numero massimo di piani paralleli da generare
@@ -399,7 +397,7 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl
end end
local dElevP = DistanzaMassima( nParent, ptCPlanes, vtNPlanes, ptCBond, vtNBond, BBoxRawPart, TBoxPoint) local dElevP = DistanzaMassima( nParent, ptCPlanes, vtNPlanes, ptCBond, vtNBond, BBoxRawPart, TBoxPoint)
local dElevO local dElevO
if ptCBond and vtNBond and not AreOppositeVectorApprox( vtNBond, vtNPlanes) then if ptCBond and vtNBond then
dElevO = DistanzaMassima( nParent, ptCBond, vtNBond, ptCPlanes, vtNPlanes, BBoxRawPart, TBoxPoint) dElevO = DistanzaMassima( nParent, ptCBond, vtNBond, ptCPlanes, vtNPlanes, BBoxRawPart, TBoxPoint)
end end
@@ -407,7 +405,7 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl
local dNzLimDwnUp = BL.GetNzLimDownUp( BBoxRawPart) local dNzLimDwnUp = BL.GetNzLimDownUp( BBoxRawPart)
-- se non c'è testa da sotto e normali senza componenti in Y con faccia quasi verticale e trave non alta, uso per offset i limiti dei tagli di testa e coda -- se non c'è testa da sotto e normali senza componenti in Y con faccia quasi verticale e trave non alta, uso per offset i limiti dei tagli di testa e coda
if not BD.TURN and not BD.DOWN_HEAD and abs( vtNPlanes:getY()) < 0.1 and vtNPlanes:getZ() < 0.7071 and ( not vtNBond or abs( vtNBond:getY()) < 0.1) and BBoxRawPart:getDimZ() < BD.MIN_DIM_HBEAM then if not BD.DOWN_HEAD and abs( vtNPlanes:getY()) < 0.1 and vtNPlanes:getZ() < 0.7071 and ( not vtNBond or abs( vtNBond:getY()) < 0.1) and BBoxRawPart:getDimZ() < BD.MIN_DIM_HBEAM then
OffsetO = dOrthoMaxDim or BD.MAX_DIM_HTCUT OffsetO = dOrthoMaxDim or BD.MAX_DIM_HTCUT
end end
@@ -423,7 +421,7 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl
-- se piani non ortogonali, diminuisco la distanza di offset opportunamente -- se piani non ortogonali, diminuisco la distanza di offset opportunamente
local originalOffsetP = OffsetP local originalOffsetP = OffsetP
if not bGetOrtoPlanes then if not bGetOrtoPlanes then
local dCoeff = max( ( vtNPlanes ^ vtNBond):len(), 0.5) local dCoeff = ( vtNPlanes ^ vtNBond):len()
OffsetP = OffsetP * dCoeff OffsetP = OffsetP * dCoeff
OffsetO = OffsetO * dCoeff OffsetO = OffsetO * dCoeff
end end
@@ -433,7 +431,7 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl
if dElevO then if dElevO then
local m = ceil( dElevO / OffsetO) local m = ceil( dElevO / OffsetO)
OffsetO = dElevO / m OffsetO = dElevO / m
end end
-- elenco di tutte le superfici generate dai tagli -- elenco di tutte le superfici generate dai tagli
local TabFUCHSIA = {} local TabFUCHSIA = {}
@@ -476,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()) > 4 * abs( vtO:getX()) or BBoxRawPart:getDimZ() > 620) and vtNInner:getZ() > dNzLimDwnUp then if ( abs( vtO:getY()) > 3 * abs( vtO:getX()) or BBoxRawPart:getDimZ() > 620) 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
@@ -484,9 +482,9 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl
end end
else else
if vtNInner:getX() > -0.017 then if vtNInner:getX() > -0.017 then
if vtO:getX() < -0.001 then vtO = -vtO end if vtO:getX() < 0 then vtO = - vtO end
else else
if vtO:getX() > 0.001 then vtO = -vtO end if vtO:getX() > 0 then vtO = - vtO end
end end
end end
end end
@@ -498,12 +496,6 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl
if bDownHead and vtO:getZ() > 0.05 then if bDownHead and vtO:getZ() > 0.05 then
vtO = -vtO vtO = -vtO
end end
-- per macchina TURN
if BD.TURN then
if vtO:getY() > 0.707 then
vtO = -vtO
end
end
-- calcolo le dimensioni dell'offset e dove posizionare la prima faccia: -- calcolo le dimensioni dell'offset e dove posizionare la prima faccia:
-- CopyPlane: 0 => crea la prima faccia direttamente sul punto passato -- CopyPlane: 0 => crea la prima faccia direttamente sul punto passato
-- CopyPlane: 1 => crea la prima faccia e tutte le altre con l'offset passato -- CopyPlane: 1 => crea la prima faccia e tutte le altre con l'offset passato
@@ -566,7 +558,7 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl
end end
end end
return UltimateTable, OffsetP, OffsetO return UltimateTable
end end
---------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------
+9 -16
View File
@@ -1,6 +1,5 @@
-- FaceByPocket.lua by Egaltech s.r.l. 2023/04/04 -- FaceByPocket.lua by Egaltech s.r.l. 2022/05/82
-- Gestione svuotatura di feature con una faccia -- Gestione svuotatura di feature con una faccia
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local FaceByPocket = {} local FaceByPocket = {}
@@ -16,7 +15,7 @@ local BD = require( 'BeamData')
local ML = require( 'MachiningLib') local ML = require( 'MachiningLib')
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function ApplyPocket( Proc, nSurfId, nFacet, sPocketing, nInd, dMaxElev, vtN, dOpenMinSafe) local function ApplyPocket( Proc, nSurfId, nFacet, sPocketing, nInd, dMaxElev, vtN)
-- inserisco la lavorazione di svuotatura -- inserisco la lavorazione di svuotatura
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. nInd local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. nInd
@@ -29,17 +28,11 @@ local function ApplyPocket( Proc, nSurfId, nFacet, sPocketing, nInd, dMaxElev, v
EgtSetMachiningGeometry( {{ nSurfId, nFacet}}) EgtSetMachiningGeometry( {{ nSurfId, nFacet}})
-- imposto uso faccia -- imposto uso faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT) EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT)
-- imposto note utente
local sNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or ''
-- eventuale massima elevazione
if dMaxElev > 0.1 then if dMaxElev > 0.1 then
sNotes = EgtSetValInNotes( sNotes, 'MaxElev', EgtNumToString( dMaxElev, 2)) -- imposto elevazione
local sNotes = 'MaxElev=' .. EgtNumToString( dMaxElev, 2) .. ';'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
end end
-- eventuale minima distanza di sicurezza di attacco su lati aperti
if dOpenMinSafe then
sNotes = EgtSetValInNotes( sNotes, 'OpenMinSafe', dOpenMinSafe)
end
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- 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 and not BD.TURN then
@@ -57,7 +50,7 @@ local function ApplyPocket( Proc, nSurfId, nFacet, sPocketing, nInd, dMaxElev, v
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function FaceByPocket.Make( Proc, nSurfId, nFacet, sPocketing, nPartId, b3Solid, dOpenMinSafe) function FaceByPocket.Make( Proc, nSurfId, nFacet, sPocketing, nPartId, b3Solid)
local bOk = true local bOk = true
local sErr local sErr
-- recupero gruppo per geometria addizionale -- recupero gruppo per geometria addizionale
@@ -79,7 +72,7 @@ function FaceByPocket.Make( Proc, nSurfId, nFacet, sPocketing, nPartId, b3Solid,
end end
-- dati della faccia -- dati della faccia
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT) local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT)
local dElev = BL.GetFaceElevation( nSurfId, nFacet, b3Solid) local dElev = BL.GetFaceElevation( nSurfId, nFacet, nPartId)
-- determino numero e valore degli step di lavorazione -- determino numero e valore degli step di lavorazione
local nSurfStep = ceil( dElev / dMaxDepth) local nSurfStep = ceil( dElev / dMaxDepth)
local dSurfStep = dElev / nSurfStep local dSurfStep = dElev / nSurfStep
@@ -91,14 +84,14 @@ function FaceByPocket.Make( Proc, nSurfId, nFacet, sPocketing, nPartId, b3Solid,
EgtSetName( nAddIdTmp, 'AddCut_' .. tostring( Proc.Id)) EgtSetName( nAddIdTmp, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( nAddIdTmp, 'TASKID', Proc.TaskId) EgtSetInfo( nAddIdTmp, 'TASKID', Proc.TaskId)
-- aggiungo lavorazione -- aggiungo lavorazione
bOk, sErr = ApplyPocket( Proc, nAddIdTmp, 0, sPocketing, i, dSurfStep, vtN, dOpenMinSafe) bOk, sErr = ApplyPocket( Proc, nAddIdTmp, 0, sPocketing, i, dSurfStep, vtN)
if not bOk then if not bOk then
return false, sErr return false, sErr
end end
end end
end end
-- faccio ultima superfice -- faccio ultima superfice
bOk, sErr = ApplyPocket( Proc, nSurfId, nFacet, sPocketing, 1, EgtIf( nSurfStep > 1, dSurfStep, 0), vtN, dOpenMinSafe) bOk, sErr = ApplyPocket( Proc, nSurfId, nFacet, sPocketing, 1, EgtIf( nSurfStep > 1, dSurfStep, 0), vtN)
if not bOk then if not bOk then
return false, sErr return false, sErr
end end
+257 -649
View File
File diff suppressed because it is too large Load Diff
-247
View File
@@ -1,247 +0,0 @@
-- FeatureTopology.lua by Egaltech s.r.l. 2023/09/12
-- Libreria per classificazione topologica feature travi
-- 2023/09/26 Aggiunte topologie Strip e Cut.
-- 2023/09/27 Modificata GetFacesParallelToPart per tunnel, pocket e groove 3 lati
-- 2023/10/16 In GetFacesParallelToPart rimossa Pocket e aggiunto Rabbet al check solo direzione principale
-- 2023/11/03 In Classify ora si settano le AffectedFaces nella Proc, se non già presenti.
-- Aggiunta groove 2 facce, differenziata da rabbet.
-- 2024/03/04 Feature senza topologia, calcolato in BeamExec
-- 2024/05/06 A topologia Cut aggiunta IsThrough = true
-- Tabella per definizione modulo
local FeatureTopology = {}
-- Include
require( 'EgtBase')
-- Carico le librerie
local BL = require( 'BeamLib')
EgtOutLog( ' FeatureTopology started', 1)
---------------------------------------------------------------------
-- restituisce gli id delle facce di Proc che hanno il numero di adiacenze nAdj
function FeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, vAdj, nAdj)
if not vAdj then vAdj = BL.GetAdjacencyMatrix( Proc) end
local nFct = #( vAdj or {})
local vFacesWithGivenAdj = {}
for i = 1, nFct do
local nAdjCount = 0
for j = 1, nFct do
if vAdj[i][j] and vAdj[i][j] ~= 0 then
nAdjCount = nAdjCount + 1
end
end
if nAdjCount == nAdj then
table.insert( vFacesWithGivenAdj, i - 1)
end
end
return vFacesWithGivenAdj
end
---------------------------------------------------------------------
-- restituisce true se Proc ha tutti gli angoli concavi (bAllConcave) e, nei casi in cui ha senso, se questi sono esattamente 90 deg (bAllRight)
local function AreAllAnglesConcaveOrRight( vAdj)
local bAllConcave, bAllRight = true, true
local nFct = #( vAdj or {})
for i = 1, nFct do
for j = 1, nFct do
-- se trovo un angolo convesso restituisco falso e esco subito
if vAdj[i][j] and vAdj[i][j] > 0 then
bAllConcave = false
bAllRight = false
break
elseif vAdj[i][j] and vAdj[i][j] ~= 0 and vAdj[i][j] + 90 > 500 * GEO.EPS_ANG_SMALL then
bAllRight = false
end
end
end
-- se 1 faccia oppure 2 facce con angolo convesso non ha senso ritornare valori per bAllRight
if nFct < 2 or ( nFct == 2 and vAdj[1][2] > 0) then
return bAllConcave
else
return bAllConcave, bAllRight
end
end
---------------------------------------------------------------------
-- restituisce true se almeno una delle dimensioni della feature è maggiore o uguale ad una delle dimensioni principali del pezzo (tolleranza 1 mm)
local function IsAnyDimensionLongAsPart( Proc)
local bResult = false
local nBoxSolidId = EgtGetFirstNameInGroup( Proc.PartId or GDB_ID.NULL, 'Box')
local b3Solid = EgtGetBBoxGlob( nBoxSolidId, GDB_BB.STANDARD)
if Proc.Box:getDimX() > b3Solid:getDimX() - 1000 * GEO.EPS_SMALL or
Proc.Box:getDimY() > b3Solid:getDimY() - 1000 * GEO.EPS_SMALL or
Proc.Box:getDimZ() > b3Solid:getDimZ() - 1000 * GEO.EPS_SMALL then
bResult = true
end
return bResult
end
---------------------------------------------------------------------
-- retituisce un vettore con gli indici (0 based) delle facce triangolari (o quasi) di Proc
local function GetTriangularFaces( Proc)
local vTriangularFaces = {}
for i = 1, Proc.Fct do
if BL.Is3EdgesApprox( Proc, i - 1) then
table.insert( vTriangularFaces, i - 1)
end
end
return vTriangularFaces
end
---------------------------------------------------------------------
-- restituisce un vettore contenente gli indici delle facce di Proc parallele ad una delle direzioni principali; il check varia in base alla famiglia topologica
local function GetFacesParallelToPart( Proc, sFamily)
local vFacesParallelToPart = {}
for i = 0, Proc.Fct - 1 do
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i, GDB_ID.ROOT)
if sFamily == 'Rabbet' or sFamily == 'Bevel' or sFamily == 'DoubleBevel' or sFamily == 'Strip' then
local vTriangularFaces = GetTriangularFaces( Proc)
local bIsTriangularFace = false
-- verifico se la faccia è triangolare
for j = 1, #vTriangularFaces do
if i == vTriangularFaces[j] then
bIsTriangularFace = true
end
end
-- se faccia triangolare deve avere la normale parallela ad una direzione principale
if bIsTriangularFace then
if AreSameOrOppositeVectorApprox( vtN, X_AX()) or AreSameOrOppositeVectorApprox( vtN, Y_AX()) or AreSameOrOppositeVectorApprox( vtN, Z_AX()) then
table.insert( vFacesParallelToPart, i)
end
-- altrimenti deve avere una componente della normale nulla
else
if abs( vtN:getX()) < 10 * GEO.EPS_SMALL or abs( vtN:getY()) < 10 * GEO.EPS_SMALL or abs( vtN:getZ()) < 10 * GEO.EPS_SMALL then
table.insert( vFacesParallelToPart, i)
end
end
else
-- la normale deve essere parallela ad una direzione principale
if AreSameOrOppositeVectorApprox( vtN, X_AX()) or AreSameOrOppositeVectorApprox( vtN, Y_AX()) or AreSameOrOppositeVectorApprox( vtN, Z_AX()) then
table.insert( vFacesParallelToPart, i)
end
end
end
return vFacesParallelToPart
end
---------------------------------------------------------------------
-- restituisce una stringa con il nome esteso della topologia della feature
-- *famiglia-passante-angoli tutti concavi a 90deg-facce tutte parallele alle dimensioni principali-numero di facce*
local function GetTopologyLongName( sFamily, bIsThrough, bAllRightAngles, bIsParallel, nNumberOfFaces)
-- feature passante o cieca
local sThrough = '_'
if bIsThrough ~= nil then sThrough = EgtIf( bIsThrough, 'Through', 'Blind') end
-- tutti gli angoli della feature sono retti oppure no
local sAllRightAngles = '_'
if bAllRightAngles ~= nil then sAllRightAngles = EgtIf( bAllRightAngles, 'RightAngles', 'NotRightAngles') end
-- tutte le dimensioni della feature sono parallele agli assi principali del pezzo oppure no
local sParallel = '_'
if bIsParallel ~= nil then sParallel = EgtIf( bIsParallel, 'Parallel', 'NotParallel') end
local sLongName = sFamily .. '-' .. sThrough .. '-' .. sAllRightAngles .. '-' .. sParallel .. '-' .. nNumberOfFaces
return sLongName
end
---------------------------------------------------------------------
-- riconosce se Proc è una delle topologie standard e, in caso positivo, ne scrive le caratteristiche in campi specifici della Proc stessa restituendo true
function FeatureTopology.Classify( Proc, b3Raw)
-- la feature deve avere geometria
if not Proc.Box or Proc.Box:isEmpty() then
return false
end
-- se già calcolato, esco
if Proc.Topology then
return true
end
-- calcoli
if not Proc.AffectedFaces then
Proc.AffectedFaces = BL.GetProcessAffectedFaces( Proc)
end
if not Proc.Face then
Proc.Face = BL.GetFacetsInfo( Proc, b3Raw)
end
local vAdj = Proc.AdjacencyMatrix or BL.GetAdjacencyMatrix( Proc)
local bAllAnglesConcave, bAllRightAngles = AreAllAnglesConcaveOrRight( vAdj)
local vTriangularFaces = GetTriangularFaces( Proc)
local bIsAnyDimensionLongAsPart = IsAnyDimensionLongAsPart( Proc)
local vFacesWithOneAdj = FeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, vAdj, 1)
local vFacesWithTwoAdj = FeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, vAdj, 2)
local vFacesWithThreeAdj = FeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, vAdj, 3)
local vFacesWithFourAdj = FeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, vAdj, 4)
local dRawW = b3Raw:getDimY()
local dRawH = b3Raw:getDimZ()
local bIsFeatureCuttingEntireSection = BL.IsFeatureCuttingEntireSection( Proc.Box, dRawW, dRawH)
-- assegnazione tipologia
local sFamily
local bIsThrough
if Proc.Fct == 1 and bIsAnyDimensionLongAsPart and bIsFeatureCuttingEntireSection then
sFamily = 'Cut'
bIsThrough = true
elseif Proc.Fct == 1 and bIsAnyDimensionLongAsPart then
sFamily = 'Bevel'
bIsThrough = true
elseif Proc.Fct == 2 and bAllAnglesConcave and #vTriangularFaces == 1 then
sFamily = 'Bevel'
bIsThrough = false
elseif Proc.Fct == 2 and bAllAnglesConcave and ( Proc.AffectedFaces.Left or Proc.AffectedFaces.Right) and ( Proc.AffectedFaces.Front or Proc.AffectedFaces.Back) then
sFamily = 'Rabbet'
bIsThrough = true
-- birdsmouth
elseif Proc.Fct == 2 and bAllAnglesConcave then
sFamily = 'Groove'
bIsThrough = true
elseif Proc.Fct == 2 and not bAllAnglesConcave and bIsAnyDimensionLongAsPart then
sFamily = 'DoubleBevel'
bIsThrough = true
elseif Proc.Fct == 3 and bAllAnglesConcave and #vFacesWithTwoAdj == 1 and #vTriangularFaces == 2 then
sFamily = 'Bevel'
bIsThrough = false
elseif Proc.Fct == 3 and bAllAnglesConcave and #vFacesWithTwoAdj == 1 and bIsAnyDimensionLongAsPart then
sFamily = 'Groove'
bIsThrough = true
elseif Proc.Fct == 3 and bAllAnglesConcave and #vFacesWithTwoAdj == 3 then
sFamily = 'Groove'
bIsThrough = false
elseif Proc.Fct == 4 and bAllAnglesConcave and #vFacesWithThreeAdj == 2 then
sFamily = 'Groove'
bIsThrough = false
elseif Proc.Fct == 4 and bAllAnglesConcave and #vFacesWithTwoAdj == 4 and bIsAnyDimensionLongAsPart then
sFamily = 'Tunnel'
bIsThrough = true
elseif Proc.Fct >= 4 and #vFacesWithOneAdj == 2 and bIsAnyDimensionLongAsPart then
sFamily = 'Strip'
bIsThrough = true
elseif Proc.Fct == 5 and bAllAnglesConcave and #vFacesWithFourAdj == 1 then
sFamily = 'Pocket'
bIsThrough = false
end
-- verifico se facce parallele a quelle della trave
local vFacesParallelToPart = GetFacesParallelToPart( Proc, sFamily)
local bIsParallel = ( #vFacesParallelToPart == Proc.Fct)
-- assegnazioni
if sFamily then
Proc.Topology = sFamily
Proc.TopologyLongName = GetTopologyLongName( sFamily, bIsThrough, bAllRightAngles, bIsParallel, Proc.Fct)
Proc.IsThrough = bIsThrough
Proc.AllRightAngles = bAllRightAngles
Proc.IsParallel = bIsParallel
Proc.vAdj = vAdj
return true
else
Proc.Topology = 'OTHER'
Proc.TopologyLongName = Proc.Topology
return false
end
end
-------------------------------------------------------------------------------------------------------------
return FeatureTopology
+149 -288
View File
@@ -1,19 +1,7 @@
-- MachiningLib.lua by Egaltech s.r.l. 2023/11/06 -- MachiningLib.lua by Egaltech s.r.l. 2022/05/07
-- 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/05/07 ES Profonde modifiche per scelta ottimale lavorazioni in macchine con più teste.
-- 2022/07/27 Aggiunta la gestione del tipo di foratura "AngleDrill" per fori molto inclinati -- 2022/07/27 Aggiunta la gestione del tipo di foratura "AngleDrill" per fori molto inclinati
-- 2022/11/02 Modificata scelta utensile ottimizzata. Ora se c'è un utensile più grande disponibile si dà preferenza a quello.
-- 2022/11/25 Per FindMilling implementata la possibilità di escludere la testa H3 dalla ricerca utensile.
-- 2022/12/28 Per FindMilling e FindDrilling possibilità di escludere la testa H2 dalla ricerca utensile.
-- 2023/01/31 Per FindPocketing implementata la possibilità di escludere le teste H2 o H3 dalla ricerca utensile.
-- 2023/07/28 Aggiunta gestione del tipo di foratura "Drill_AT".
-- 2023/11/06 Migliorie e correzioni alle forature con AngularTransmission ("_AT").
-- 2024/01/18 In FindSawing aggiunto il parametro opzionale dDepth.
-- 2024/01/19 In FindSawing aggiunto parametro opzionale bConsiderCSimmEncumberance per considerare l'ingombro dell'asse C nel massimo materiale (default false).
-- 2024/01/23 Nella GetMachinings vengono ora raccolti i parametri utensile necessari per i VerifyTool, scritti direttamente nella tabella Machining.Tool.
-- Le lavorazioni possono essere ora ordinate per dimensioni utensile (Longest, Shortest, Biggest, Smallest) se passato l'apposito parametro SortingCriterion in FindMachining. Al momento implementato solo per FindSawing.
-- 2024/03/01 In VerifyPocketing implementato l'ordinamento per dimensioni utensile.
-- 2024/03/13 Aggiunta gestione Predrill
-- Tabella per definizione modulo -- Tabella per definizione modulo
local MachiningLib = {} local MachiningLib = {}
@@ -25,14 +13,11 @@ EgtOutLog( ' MachiningLib started', 1)
-- Dati -- Dati
local BD = require( 'BeamData') local BD = require( 'BeamData')
-- librerie lavorazioni caricate con pcall perchè potrebbero non esserci local Cuttings = require( 'CutData')
local Cuttings, Millings, Pocketings, Sawings, Drillings, Probing local Millings = require( 'MillingData')
if pcall( require, 'CutData') then Cuttings = require( 'CutData') end local Pocketings = require( 'PocketingData')
if pcall( require, 'MillingData') then Millings = require( 'MillingData') end local Sawings = require( 'SawingData')
if pcall( require, 'PocketingData') then Pocketings = require( 'PocketingData') end local Drillings = require( 'DrillData')
if pcall( require, 'SawingData') then Sawings = require( 'SawingData') end
if pcall( require, 'DrillData') then Drillings = require( 'DrillData') end
if pcall( require, 'ProbingData') then Probing = require( 'ProbingData') end
-- tipo di teste macchina -- tipo di teste macchina
local ONE_HEAD = 1 -- una testa (Fast, One, Turn1T) local ONE_HEAD = 1 -- una testa (Fast, One, Turn1T)
@@ -77,252 +62,153 @@ local function SetCurrMachineHeadType()
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- setta ultimi testa e utensile utilizzati se compatibili con ottimizzazione testa -- funzione che conferma e rende attivi testa e utensile ipotizzati
local function ConfirmNextMachining() local function ConfirmNextMachining()
-- utensile corrente -- se non definita testa successiva, esco
local sToolUuid = EgtGetMachiningParam( MCH_MP.TUUID) if not nNextMachHead or nNextMachHead < 1 or nNextMachHead > 2 then return end
local sToolName = EgtTdbGetToolFromUUID( sToolUuid or '') -- altrimenti, la confermo come attiva
EgtTdbSetCurrTool( sToolName or '') nActiveHead = nNextMachHead
-- testa dell'utensile corrente if nNextMachHead == 1 then
local sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD) H1_TOOL = H1_NEXT_TOOL
local nHead = tonumber( sHead:sub( 2, #sHead)) + 0 elseif nNextMachHead == 2 then
H2_TOOL = H2_NEXT_TOOL
if ( nHead < 10 and nHead >= 30) or vFixedHeads[nHead] then
-- testa che non richiede ottimizzazione
return
elseif nHead >= 20 then
nHead = 2
elseif nHead >= 10 then
nHead = 1
end
-- se la testa richiede ottimizzazione, confermo testa attiva
nActiveHead = nHead
if nActiveHead == 1 then
H1_TOOL = sToolName
elseif nActiveHead == 2 then
H2_TOOL = sToolName
end end
-- reset prossima testa
nNextMachHead = 0
H1_NEXT_TOOL = ''
H2_NEXT_TOOL = ''
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function SetCurrMachiningAndTool( Machining) -- funzione che traccia testa e utensile ipotizzati
EgtMdbSetCurrMachining( Machining.Name) local function SetNextMachining( sToolName, nHead, bFixed)
EgtTdbSetCurrTool( Machining.Tool.Name) if nHead < 1 or nHead > 2 then return end
local bActive = EgtFindToolInCurrSetup( Machining.Tool.Name) 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)
if not EgtMdbSetCurrMachining( sMachName) then return false end
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
local sTool = EgtTdbGetToolFromUUID( sTuuid)
if not sTool then return false end
if not EgtTdbSetCurrTool( sTool) then return false end
local bActive = EgtTdbGetCurrToolParam( MCH_TP.ACTIVE)
local sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD) local sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
local nHead = tonumber( sHead:sub( 2, #sHead)) local nHead = tonumber( sHead:sub( 2, #sHead))
local bH2 = ( nHead >= 21 and nHead <= 29) local bH2 = ( nHead >= 21 and nHead <= 29)
local bH3 = ( nHead >= 31 and nHead <= 39)
local bFixed = ( vFixedHeads[nHead]) local bFixed = ( vFixedHeads[nHead])
return bActive, Machining.Tool.Name, bH2, bFixed, bH3 return bActive, sTool, bH2, bFixed
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function VerifyDrill( Machining, dDiam, dDepth, bH2) function VerifyDrill( dDiam, dDepth, bH2)
local dFreeLen = Machining.Tool.Length - Machining.Tool.ToolHolderLength - EgtMdbGetGeneralParam( MCH_GP.MAXDEPTHSAFE) local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
if Machining.Tool.Diameter < dDiam + 10 * GEO.EPS_SMALL and local dTMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
Machining.Tool.Diameter > dDiam - BD.DRILL_TOL - 10 * GEO.EPS_SMALL and local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
( not dDepth or Machining.Tool.MaxMat > dDepth - GEO.EPS_SMALL) then local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
return true, { TMaxMat = Machining.Tool.MaxMat, MaxToolLength = Machining.Tool.TotalLength, ToolDiam = Machining.Tool.Diameter, DiamTh = Machining.Tool.ToolHolderDiameter, FreeLen = dFreeLen, H2 = bH2} 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
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function VerifyDrillPocket( Machining, dDiam, dDepth, bH2) function VerifyDrillPocket( dDiam, dDepth, bH2)
if Machining.Tool.Diameter < dDiam - 10 * GEO.EPS_SMALL and local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
( not dDepth or Machining.Tool.MaxMat > dDepth - GEO.EPS_SMALL) then local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
return true, { TMaxDepth = Machining.Tool.MaxMat, MaxToolLength = Machining.Tool.TotalLength, ToolDiam = Machining.Tool.Diameter, DiamTh = Machining.Tool.ToolHolderDiameter, FreeLen = Machining.Tool.MaxMat, H2 = bH2} 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
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function VerifyMill( Machining, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bH2) function VerifyMill( dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bH2)
if ( not dDepth or Machining.Tool.MaxMat > dDepth - GEO.EPS_SMALL) and local sTuuid = EgtGetMachiningParam( MCH_MP.TUUID)
( Machining.Type ~= 'FloatingAggregate' or abs( Machining.Tool.MaxMat - dDepth) < 100 * GEO.EPS_SMALL) and local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
( not sTuuidMstr or sTuuidMstr == Machining.Tool.UUID) and local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
( not dMaxDiam or Machining.Tool.Diameter < dMaxDiam + GEO.EPS_SMALL) and local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
( not dMaxTotLen or Machining.Tool.TotalLength < dMaxTotLen + GEO.EPS_SMALL) then if ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and
return true, { TMaxDepth = Machining.Tool.MaxMat, TDiam = Machining.Tool.Diameter, H2 = bH2} ( 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
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function VerifyPocket( Machining, dMaxDiam, dDepth, dMaxTotLen, bH2) function VerifyPocket( dMaxDiam, dDepth, dMaxTotLen, bH2)
if ( not dMaxDiam or Machining.Tool.Diameter < dMaxDiam + GEO.EPS_SMALL) and local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
( not dDepth or Machining.Tool.MaxMat > dDepth - GEO.EPS_SMALL) and local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
( not dMaxTotLen or Machining.Tool.TotalLength < dMaxTotLen + GEO.EPS_SMALL) then local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
return true, { TDiam = Machining.Tool.Diameter, TMaxDepth = Machining.Tool.MaxMat, H2 = bH2} 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
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function VerifyChainSaw( Machining, dDepth, CSimmEncumberance, bH2) function VerifyTool( MachiningType, sType, Params, bH2)
-- riduco il massimo materiale dell'ingombro asse C. Se non richiesto, arriverà un valore di CSimmEncumberance nullo
Machining.Tool.MaxMat = min( Machining.Tool.MaxMat, Machining.Tool.TotalLength - CSimmEncumberance)
if not dDepth or Machining.Tool.MaxMat > dDepth - GEO.EPS_SMALL then
return true, { H2 = bH2}
end
end
---------------------------------------------------------------------
function VerifyTool( Machining, MachiningType, Params, bH2)
if MachiningType == MCH_MY.DRILLING then if MachiningType == MCH_MY.DRILLING then
if Machining.SubType == 'Drill' or Machining.SubType == 'AngleDrill' or Machining.SubType == 'Predrill' then if EgtStartsWith( sType, 'Drill') or EgtStartsWith( sType, 'AngleDrill') then
return VerifyDrill( Machining, Params.Diam, Params.Depth, bH2) return VerifyDrill( Params.Diam, Params.Depth, bH2)
elseif Machining.SubType == 'DrillPocket' then elseif EgtStartsWith( sType, 'Pocket') then
return VerifyDrillPocket( Machining, Params.Diam, Params.Depth, bH2) return VerifyDrillPocket( Params.Diam, Params.Depth, bH2)
end end
elseif MachiningType == MCH_MY.SAWING then elseif MachiningType == MCH_MY.SAWING then
return ( not Params.Depth or Machining.Tool.MaxMat > Params.Depth - GEO.EPS_SMALL), { H2 = bH2} return true, { H2 = bH2}
elseif MachiningType == MCH_MY.MILLING then elseif MachiningType == MCH_MY.MILLING then
return VerifyMill( Machining, Params.Depth, Params.TuuidMstr, Params.MaxDiam, Params.MaxTotLen, bH2) return VerifyMill( Params.Depth, Params.TuuidMstr, Params.MaxDiam, Params.MaxTotLen, bH2)
elseif MachiningType == MCH_MY.POCKETING then elseif MachiningType == MCH_MY.POCKETING then
return VerifyPocket( Machining, Params.MaxDiam, Params.Depth, Params.MaxTotLen, bH2) return VerifyPocket( Params.MaxDiam, Params.Depth, Params.MaxTotLen, bH2)
elseif MachiningType == MCH_MY.MORTISING then elseif MachiningType == MCH_MY.MORTISING then
return VerifyChainSaw( Machining, Params.Depth, Params.CSimmEncumberance, bH2) return true, { H2 = bH2}
else else
return false return false
end end
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function GetMachinings( MachiningType, sType) function GetMachinings( MachiningType)
local Machinings = {}
-- leggo le lavorazioni disponibili
if MachiningType == MCH_MY.DRILLING then if MachiningType == MCH_MY.DRILLING then
if Drillings and type( Drillings) == "table" then return Drillings
Machinings = Drillings
end
elseif MachiningType == MCH_MY.SAWING then elseif MachiningType == MCH_MY.SAWING then
if Cuttings and type( Cuttings) == "table" then return Cuttings
Machinings = Cuttings
end
elseif MachiningType == MCH_MY.MILLING then elseif MachiningType == MCH_MY.MILLING then
if Millings and type( Millings) == "table" then return Millings
Machinings = Millings
end
elseif MachiningType == MCH_MY.POCKETING then elseif MachiningType == MCH_MY.POCKETING then
if Pocketings and type( Pocketings) == "table" then return Pocketings
Machinings = Pocketings
end
elseif MachiningType == MCH_MY.MORTISING then elseif MachiningType == MCH_MY.MORTISING then
if Sawings and type( Sawings) == "table" then return Sawings
Machinings = Sawings
end
elseif MachiningType == MCH_MY.PROBING then
if Probing and type( Probing) == "table" then
Machinings = Probing
end
end end
-- scrivo i parametri utensile nella lavorazione
local validMachinings = {}
for i = 1, #Machinings do
local Machining = Machinings[i]
if EgtMdbSetCurrMachining( Machining.Name) then
Machining.Tool = {}
Machining.Tool.UUID = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
Machining.Tool.Name = EgtTdbGetToolFromUUID( Machining.Tool.UUID)
if Machining.Tool.Name then
if EgtTdbSetCurrTool( Machining.Tool.Name) then
table.insert( validMachinings, Machining)
-- se non è tastatura, recupero dati utensile
if MachiningType ~= MCH_MY.PROBING then
-- caso speciale utensile su aggregato flottante
if MachiningType == MCH_MY.MILLING and sType == 'FloatingAggregate' then
local sNotes = EgtTdbGetCurrToolParam( MCH_TP.USERNOTES)
Machining.Tool.MaxMat = EgtGetValInNotes( sNotes, 'TOOL_OVERHANG', 'd') or -1
elseif ( MachiningType == MCH_MY.MILLING) or ( MachiningType == MCH_MY.POCKETING) or ( MachiningType == MCH_MY.DRILLING and EgtStartsWith( sType, 'Pocket')) then
Machining.Tool.MaxMat = EgtTdbGetCurrToolMaxDepth()
else
Machining.Tool.MaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
end
if MachiningType == MCH_MY.DRILLING then
if EgtStartsWith( Machining.Type, 'Drill') then
Machining.SubType = 'Drill'
elseif EgtStartsWith( Machining.Type, 'AngleDrill') then
Machining.SubType = 'AngleDrill'
elseif EgtStartsWith( Machining.Type, 'Pocket') then
Machining.SubType = 'DrillPocket'
elseif EgtStartsWith( Machining.Type, 'Predrill') then
Machining.SubType = 'Predrill'
end
end
Machining.Tool.Diameter = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
Machining.Tool.Length = EgtTdbGetCurrToolParam( MCH_TP.LEN)
Machining.Tool.TotalLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
Machining.Tool.ToolHolderDiameter = EgtTdbGetCurrToolThDiam()
Machining.Tool.ToolHolderLength = EgtTdbGetCurrToolThLength() or 72
end
end
end
end
end
-- ritorno la lista delle sole lavorazioni valide
return validMachinings
end
---------------------------------------------------------------------
---restituisce la lista delle lavorazioni ordinata secondo il criterio *sCriterion*
---@param Machinings table lista della lavorazioni da riordinare
---@param sCriterion string criterio di ordinamento ('Longest', 'Shortest', 'Biggest', 'Smallest')
function ReorderMachinings( Machinings, sCriterion)
-- funzioni di ordinamento
local function SortMachiningsByLongestTool( Machining1, Machining2)
if Machining1.Tool.MaxMat > Machining2.Tool.MaxMat + 10 * GEO.EPS_SMALL then
return true
else
return false
end
end
local function SortMachiningsByShortestTool( Machining1, Machining2)
if Machining1.Tool.MaxMat < Machining2.Tool.MaxMat - 10 * GEO.EPS_SMALL then
return true
else
return false
end
end
local function SortMachiningsByBiggestTool( Machining1, Machining2)
if Machining1.Tool.Diameter > Machining2.Tool.Diameter + 10 * GEO.EPS_SMALL then
return true
else
return false
end
end
local function SortMachiningsBySmallestTool( Machining1, Machining2)
if Machining1.Tool.Diameter < Machining2.Tool.Diameter - 10 * GEO.EPS_SMALL then
return true
else
return false
end
end
-- ordinamento in base al criterio
-- ordine di default, ossia quello che arriva dal database
if not sCriterion then
return
-- prima gli utensili più lunghi
elseif sCriterion == 'Longest' then
table.sort( Machinings, SortMachiningsByLongestTool)
-- prima gli utensili più corti
elseif sCriterion == 'Shortest' then
table.sort( Machinings, SortMachiningsByShortestTool)
-- prima gli utensili con diametro più grande
elseif sCriterion == 'Biggest' then
table.sort( Machinings, SortMachiningsByBiggestTool)
-- prima gli utensili con diametro più piccolo
elseif sCriterion == 'Smallest' then
table.sort( Machinings, SortMachiningsBySmallestTool)
end
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function ReturnParams( MachiningType, MachiningName, sType, ToolParams) function ReturnParams( MachiningType, MachiningName, sType, ToolParams)
if MachiningType == MCH_MY.DRILLING then if MachiningType == MCH_MY.DRILLING then
local _, sOrigType = EgtEndsWith( sType, '_H2') local _, sOrigType = EgtEndsWith( sType, '_H2')
return MachiningName, sType, EgtIf( sOrigType == 'Drill' or sOrigType == 'Drill_AT' or sOrigType == 'AngleDrill' or sOrigType == 'Predrill' , ToolParams.TMaxMat, ToolParams.TMaxDepth), ToolParams.MaxToolLength, ToolParams.ToolDiam, ToolParams.DiamTh, ToolParams.FreeLen return MachiningName, sType, EgtIf( sOrigType == 'Drill' or sOrigType == 'AngleDrill' , ToolParams.TMaxMat, ToolParams.TMaxDepth), ToolParams.MaxToolLength, ToolParams.ToolDiam, ToolParams.DiamTh, ToolParams.FreeLen
elseif MachiningType == MCH_MY.SAWING then elseif MachiningType == MCH_MY.SAWING then
return MachiningName, ToolParams.H2 return MachiningName, ToolParams.H2
elseif MachiningType == MCH_MY.MILLING then elseif MachiningType == MCH_MY.MILLING then
@@ -335,8 +221,7 @@ function ReturnParams( MachiningType, MachiningName, sType, ToolParams)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion) local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead)
local bOptimizeHeads = ( not sSortingCriterion or sSortingCriterion == '')
if bTopHead == nil and bDownHead == nil then if bTopHead == nil and bDownHead == nil then
bTopHead = true bTopHead = true
bDownHead = false bDownHead = false
@@ -345,17 +230,7 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead,
elseif bDownHead == nil then elseif bDownHead == nil then
bDownHead = not bTopHead bDownHead = not bTopHead
end end
if bExcludeH2 == nil then
bExcludeH2 = false
end
if bExcludeH3 == nil then
bExcludeH3 = false
end
SetCurrMachineHeadType() SetCurrMachineHeadType()
-- verifico se non richiesta testa sopra e macchina ha solo teste sopra
if not bTopHead and MachineHeadType ~= TWO_UP_DOWN_HEADS and not BD.TURN then
return nil
end
-- verifico se testa attiva va bene -- verifico se testa attiva va bene
local sH1Mach = '' local sH1Mach = ''
local sH1Tool = '' local sH1Tool = ''
@@ -363,76 +238,76 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead,
local sH2Mach = '' local sH2Mach = ''
local sH2Tool = '' local sH2Tool = ''
local sH2Param local sH2Param
local Machinings = GetMachinings( MachiningType, sType) -- ricerca sulle forature, dal diametro maggiore al minore
ReorderMachinings( Machinings, sSortingCriterion) local Machinings = GetMachinings( MachiningType)
local ForStart = 1 local ForStart = 1
local ForEnd = #Machinings local ForEnd = #Machinings
local ForStep = 1 local ForStep = 1
-- le forature vanno scorse dal diametro maggiore al minore, a meno che non sia stato passato un ordinamento specifico if MachiningType == MCH_MY.DRILLING then
if MachiningType == MCH_MY.DRILLING and ( not sSortingCriterion or sSortingCriterion == '') then
ForStart = #Machinings ForStart = #Machinings
ForEnd = 1 ForEnd = 1
ForStep = -1 ForStep = -1
end end
if bOptimizeHeads or MachineHeadType == ONE_HEAD or MachineHeadType == TWO_EQUAL_HEADS or ( MachineHeadType == TWO_UP_DOWN_HEADS and not bDownHead) then if ( BEAM and BEAM.BW) or MachineHeadType == ONE_HEAD or MachineHeadType == TWO_EQUAL_HEADS or ( MachineHeadType == TWO_UP_DOWN_HEADS and not bDownHead) then
_, sType = EgtEndsWith( sType, '_H2') _, sType = EgtEndsWith( sType, '_H2')
elseif not bOptimizeHeads and MachineHeadType == TWO_UP_DOWN_HEADS and not bTopHead and bDownHead then elseif ( not BEAM or not BEAM.BW) and MachineHeadType == TWO_UP_DOWN_HEADS and bDownHead then
if not EgtEndsWith( sType, '_H2') then if not EgtEndsWith( sType, '_H2') then
sType = sType .. '_H2' sType = sType .. '_H2'
end end
end end
local MachineHeadUse = MachineHeadType local MachineHeadUse = MachineHeadType
if not bOptimizeHeads and MachineHeadUse == TWO_EQUAL_HEADS then if not BEAM or not BEAM.BW then
MachineHeadUse = ONE_HEAD MachineHeadUse = ONE_HEAD
end end
if MachineHeadUse == TWO_UP_DOWN_HEADS and bTopHead and bDownHead then if BEAM and BEAM.BW and MachineHeadUse == TWO_UP_DOWN_HEADS and bTopHead and bDownHead then
-- se posso usare entrambe le teste, la gestisco come una macchina a due teste da sopra -- se posso usare entrambe le teste, la gestisco come una macchina a due teste da sopra
MachineHeadUse = TWO_EQUAL_HEADS MachineHeadUse = TWO_EQUAL_HEADS
end end
-- variabile che definisce quando un utensile ha un diametro sostanzialmente più grande di un altro
local dBiggerToolTolerance = 1.25
for i = ForStart, ForEnd, ForStep do for i = ForStart, ForEnd, ForStep do
local Machining = Machinings[i] local Machining = Machinings[i]
local sMachiningType = Machining.Type local sMachiningType = Machining.Type
if bOptimizeHeads or MachineHeadUse == TWO_EQUAL_HEADS then if BEAM and BEAM.BW then
_, sMachiningType = EgtEndsWith( Machining.Type, '_H2') _, sMachiningType = EgtEndsWith( Machining.Type, '_H2')
end end
-- recupero dati utensile -- recupero dati utensile
local bToolActive, sToolName, bH2, bFixed, bH3 = SetCurrMachiningAndTool( Machining) local bToolActive, sToolName, bH2, bFixed = SetCurrMachiningAndTool( Machining.Name)
if Machining.On and sMachiningType == sType and bToolActive and ( not bH2 or bH2 == not bExcludeH2) and ( not bH3 or bH3 == not bExcludeH3) then if Machining.On and sMachiningType == sType and bToolActive then
local bOk, ToolParams = VerifyTool( Machining, MachiningType, Params, bH2) local bOk, ToolParams = VerifyTool( MachiningType, sType, Params, bH2)
if bOk then if bOk then
if MachineHeadUse == ONE_HEAD then if MachineHeadUse == ONE_HEAD then
SetNextMachining( sToolName, 1, bFixed)
return ReturnParams(MachiningType, Machining.Name, Machining.Type, ToolParams) return ReturnParams(MachiningType, Machining.Name, Machining.Type, ToolParams)
elseif MachineHeadUse == TWO_EQUAL_HEADS then elseif MachineHeadUse == TWO_EQUAL_HEADS then
-- se nessuna testa attiva, prendo la prima lavorazione disponibile -- se nessuna testa attiva, prendo la prima lavorazione disponibile
if nActiveHead == 0 then if nActiveHead == 0 then
SetNextMachining( sToolName, EgtIf( bH2, 2, 1), bFixed)
return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams) return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams)
-- verifico se posso usare lo stesso utensile della testa attiva -- 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 elseif ( nActiveHead == 1 and not bH2 and sToolName == H1_TOOL) or ( nActiveHead == 2 and bH2 and sToolName == H2_TOOL) then
-- se l'utensile sulla testa attiva è molto più piccolo rispetto a quelli salvati non lo scelgo, a meno che non siano entrambi grandi (truciolatori) SetNextMachining( sToolName, nActiveHead, bFixed)
if ( not sH1Param or not sH1Param.TDiam or ( sH1Param.TDiam < 75 and ToolParams.TDiam < 75 and sH1Param.TDiam < dBiggerToolTolerance * ToolParams.TDiam)) and ( not sH2Param or not sH2Param.TDiam or ( sH2Param.TDiam < 75 and ToolParams.TDiam < 75 and sH2Param.TDiam < 1.25 * ToolParams.TDiam)) then return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams)
return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams)
end
end
-- 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 else
if not sH1Mach or sH1Mach == '' then -- segno le lavorazioni disponibili per entrambe le teste
sH1Mach = Machining.Name if bH2 then
sH1Tool = sToolName if not sH2Mach or sH2Mach == '' then
sH1Param = ToolParams 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
end end
elseif MachineHeadUse == TWO_UP_DOWN_HEADS then elseif MachineHeadUse == TWO_UP_DOWN_HEADS then
if bTopHead and not bH2 then if bTopHead and not bH2 then
SetNextMachining( sToolName, 1, bFixed)
return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams) return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams)
elseif bDownHead and bH2 then elseif bDownHead and bH2 then
SetNextMachining( sToolName, 2, bFixed)
return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams) return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams)
end end
end end
@@ -440,58 +315,45 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead,
end end
end end
if MachineHeadUse == TWO_EQUAL_HEADS then if MachineHeadUse == TWO_EQUAL_HEADS then
-- se entrambi gli utensili sono piccoli (no truciolatori) e uno dei due è molto più grande dell'altro scelgo quello senza fare altre analisi
if sH1Mach ~= "" and sH1Param.TDiam and sH2Mach ~= "" and sH2Param.TDiam then
if sH1Param.TDiam < 75 or sH2Param.TDiam < 75 then
if sH1Param.TDiam > dBiggerToolTolerance * sH2Param.TDiam then
return ReturnParams( MachiningType, sH1Mach, sType, sH1Param)
elseif sH2Param.TDiam > dBiggerToolTolerance * sH1Param.TDiam then
return ReturnParams( MachiningType, sH2Mach, sType, sH2Param)
end
end
end
-- verifico se cambiare testa o cambiare utensile su quella corrente -- verifico se cambiare testa o cambiare utensile su quella corrente
if nActiveHead == 1 then if nActiveHead == 1 then
if sH2Mach ~= "" then if sH2Mach ~= "" then
SetNextMachining( sH2Tool, 2, bFixed)
return ReturnParams( MachiningType, sH2Mach, sType, sH2Param) return ReturnParams( MachiningType, sH2Mach, sType, sH2Param)
--return sH2Mach, sH2Param.Type, sH2Param.TMaxMat, sH2Param.MaxToolLength, sH2Param.ToolDiam, sH2Param.DiamTh, sH2Param.FreeLen --return sH2Mach, sH2Param.Type, sH2Param.TMaxMat, sH2Param.MaxToolLength, sH2Param.ToolDiam, sH2Param.DiamTh, sH2Param.FreeLen
elseif sH1Mach ~= "" then elseif sH1Mach ~= "" then
SetNextMachining( sH1Tool, 1, bFixed)
return ReturnParams( MachiningType, sH1Mach, sType, sH1Param) return ReturnParams( MachiningType, sH1Mach, sType, sH1Param)
--return sH1Mach, sH1Param.Type, sH1Param.TMaxMat, sH1Param.MaxToolLength, sH1Param.ToolDiam, sH1Param.DiamTh, sH1Param.FreeLen --return sH1Mach, sH1Param.Type, sH1Param.TMaxMat, sH1Param.MaxToolLength, sH1Param.ToolDiam, sH1Param.DiamTh, sH1Param.FreeLen
end end
elseif nActiveHead == 2 then elseif nActiveHead == 2 then
if sH1Mach ~= "" then if sH1Mach ~= "" then
SetNextMachining( sH1Tool, 1, bFixed)
return ReturnParams( MachiningType, sH1Mach, sType, sH1Param) return ReturnParams( MachiningType, sH1Mach, sType, sH1Param)
--return sH1Mach, sH1Param.Type, sH1Param.TMaxMat, sH1Param.MaxToolLength, sH1Param.ToolDiam, sH1Param.DiamTh, sH1Param.FreeLen --return sH1Mach, sH1Param.Type, sH1Param.TMaxMat, sH1Param.MaxToolLength, sH1Param.ToolDiam, sH1Param.DiamTh, sH1Param.FreeLen
elseif sH2Mach ~= "" then elseif sH2Mach ~= "" then
SetNextMachining( sH2Tool, 2, bFixed)
return ReturnParams( MachiningType, sH2Mach, sType, sH2Param) return ReturnParams( MachiningType, sH2Mach, sType, sH2Param)
--return sH2Mach, sH2Param.Type, sH2Param.TMaxMat, sH2Param.MaxToolLength, sH2Param.ToolDiam, sH2Param.DiamTh, sH2Param.FreeLen --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') local bH2, sOrigType = EgtEndsWith( sType, '_H2')
if not bOptimizeHeads and MachineHeadType == TWO_UP_DOWN_HEADS and bH2 and bTopHead then if ( not BEAM or not BEAM.BW) and MachineHeadType == TWO_UP_DOWN_HEADS and bH2 and bTopHead then
return FindMachining( MachiningType, sOrigType, Params, true, false) return FindMachining( MachiningType, sOrigType, Params, true, false)
end end
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function MachiningLib.FindCutting( sType, bTopHead, bDownHead, dDepth, sSortingCriterion) function MachiningLib.FindCutting( sType, bTopHead, bDownHead)
return FindMachining( MCH_MY.SAWING, sType, { Depth = dDepth}, bTopHead, bDownHead, nil, nil, sSortingCriterion) return FindMachining( MCH_MY.SAWING, sType, nil, bTopHead, bDownHead)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead, bExcludeH2, bAngleTransmission, bIsPredrill, bExcludeH3, sSortingCriterion) function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead)
local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5, sTypeMach local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, 'Drill', { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead)
-- se il foro è un predrill, cerco solo punte abilitate al Predrill if not MachiningName or MachiningName == '' then
if bIsPredrill then MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, 'Pocket', { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead)
sTypeMach = 'Predrill'
else
sTypeMach = EgtIf( bAngleTransmission, 'Drill_AT', 'Drill')
end
MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, sTypeMach, { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion)
if ( not MachiningName or MachiningName == '') then
MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, EgtIf( bAngleTransmission, 'Pocket_AT', 'Pocket'), { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion)
end end
if MachiningName and MachiningName ~= '' then if MachiningName and MachiningName ~= '' then
return MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 return MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5
@@ -507,19 +369,18 @@ function MachiningLib.FindAngleDrilling( dDiam, dDepth, bTopHead, bDownHead)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion) function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bTopHead, bDownHead)
return FindMachining( MCH_MY.MILLING, sType, { Depth = dDepth, TuuidMstr = sTuuidMstr, MaxDiam = dMaxDiam, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion) return FindMachining( MCH_MY.MILLING, sType, { Depth = dDepth, TuuidMstr = sTuuidMstr, MaxDiam = dMaxDiam, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function MachiningLib.FindPocketing( sType, dMaxDiam, dDepth, dMaxTotLen, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion) function MachiningLib.FindPocketing( sType, dMaxDiam, dDepth, dMaxTotLen, bTopHead, bDownHead)
return FindMachining( MCH_MY.POCKETING, sType, { MaxDiam = dMaxDiam, Depth = dDepth, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion) return FindMachining( MCH_MY.POCKETING, sType, { MaxDiam = dMaxDiam, Depth = dDepth, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function MachiningLib.FindSawing( sType, dDepth, bConsiderCSimmEncumberance, sSortingCriterion) function MachiningLib.FindSawing( sType)
if not BD.C_SIMM_ENC then BD.C_SIMM_ENC = EgtIf( BD.C_SIMM, 180, 90) end return FindMachining( MCH_MY.MORTISING, sType)
return FindMachining( MCH_MY.MORTISING, sType, { Depth = dDepth, CSimmEncumberance = EgtIf( bConsiderCSimmEncumberance, BD.C_SIMM_ENC, 0)}, nil, nil, nil, nil, sSortingCriterion)
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
+2 -4
View File
@@ -151,8 +151,7 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dO
-- se va fatto, inserisco la lavorazione -- se va fatto, inserisco la lavorazione
if bCut then if bCut then
local CutProc = { Id = AuxId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, local CutProc = { Id = AuxId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId} Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead) local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
-- se taglio applicato setto la nota al gruppo Mach per non doverla lavorare una seconda volta -- se taglio applicato setto la nota al gruppo Mach per non doverla lavorare una seconda volta
if bOk then if bOk then
@@ -243,8 +242,7 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dO
-- se va fatto, inserisco la lavorazione -- se va fatto, inserisco la lavorazione
if bCut then if bCut then
local CutProc = { Id = AuxId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, local CutProc = { Id = AuxId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId} Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead) local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
-- se taglio applicato setto la nota al gruppo Mach per non doverla lavorare una seconda volta -- se taglio applicato setto la nota al gruppo Mach per non doverla lavorare una seconda volta
if bOk then if bOk then
+97 -263
View File
@@ -1,4 +1,4 @@
-- ProcessCut.lua by Egaltech s.r.l. 2023/08/01 -- ProcessCut.lua by Egaltech s.r.l. 2022/07/28
-- 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.
@@ -14,18 +14,7 @@
-- 2022/07/18 Se Q04=1, aggiunto LongCut anche dal lato per macchine tipo PF1250. -- 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/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/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. -- 2022/08/25 In caso di AdvTail con taglio lungo Y la profondità di lavorazione è opportunamente diminuita.
-- 2022/08/30 Modificata la condizione che determina l'utilizzo della testa da sotto. Ora controlla se la trave è più grande del doppio della massima larghezza del cubetto.
-- 2022/09/23 Corretta la condizione per cui è richiesto l'aggiornamento del grezzo.
-- 2023/01/26 Migliorata la direzione di lavoro della lama in alcuni casi in cui il truciolo veniva scaricato dal lato errato.
-- 2023/06/19 Aggiunti tagli speciali per evitare il rischio che il cubetto rimanga appoggiato al motore.
-- 2023/08/01 Correzione su offset per taglio doppio di lato.
-- 2023/08/01 In caso di pezzi alti su macchina tipo PF i tagli doppi di lato non vengono usati, si usa il metodo standard.
-- 2023/09/12 In MakeFromTop abbassato a 590 mm il limite per convertire in LongCut.
-- 2023/10/27 In MakeFromTop corretto massimo materiale in caso di lavorazione da sotto.
-- 2023/12/07 Correzione in Classify in scelta ribaltamento trave quando si è in condizioni downUp.
-- 2024/01/18 Gestita superficie limitante opzionale da passare a diceCut.
-- 2024/05/10 In MakeFromTop ricalcolo direzione di lavorazione su facce a cubetti
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessCut = {} local ProcessCut = {}
@@ -46,14 +35,7 @@ local ML = require( 'MachiningLib')
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Riconoscimento della feature -- Riconoscimento della feature
function ProcessCut.Identify( Proc) function ProcessCut.Identify( Proc)
-- se richiesto si forza fresatura return ( ( Proc.Grp == 1 or Proc.Grp == 2) and Proc.Prc == 10)
Proc.bForceMill = ( ( ( Proc.Grp == 1 or Proc.Grp == 2) and Proc.Prc == 10) and ( ( EgtGetInfo( Proc.Id, 'Q07', 'd') or 0) == 1))
if Proc.bForceMill then
return false
else
return ( ( Proc.Grp == 1 or Proc.Grp == 2) and Proc.Prc == 10)
end
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
@@ -65,14 +47,11 @@ function ProcessCut.Classify( Proc, b3Raw)
end end
-- recupero i dati del taglio -- recupero i dati del taglio
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
-- calcolo le massime estensioni lineari orizzontale e verticale della faccia if vtN:getZ() <= - 0.5 and abs( vtN:getY()) > 0.1 or ( vtN:getZ() <= - 0.174 and abs( vtN:getY()) > 0.866) then
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw) -- calcolo le massime estensioni lineari orizzontale e verticale della faccia
if ( vtN:getZ() <= - 0.5 and abs( vtN:getY()) > 0.1) or local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
( vtN:getZ() <= - 0.174 and abs( vtN:getY()) > 0.866) or
( vtN:getZ() <= - 0.174 and abs( vtN:getZ()) * DimV > BD.MAX_DIM_DICE)
then
-- confronto queste estensioni con la massima dimensione del DiceCut (impossibile lavorare se entrambe maggiori) -- confronto queste estensioni con la massima dimensione del DiceCut (impossibile lavorare se entrambe maggiori)
if DimH > BD.MAX_DIM_DICE + 100 * GEO.EPS_SMALL and DimV > BD.MAX_DIM_DICE + 100 * GEO.EPS_SMALL then if DimH > BD.MAX_DIM_DICE and DimV > BD.MAX_DIM_DICE then
return true, true return true, true
end end
end end
@@ -80,22 +59,10 @@ function ProcessCut.Classify( Proc, b3Raw)
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
-- recupero i dati della lama
local sCutType = EgtIf( Proc.Head, 'HeadSide', 'TailSide')
local sCutting = ML.FindCutting( sCutType, true, false)
local dMaxDepth = 0
local dMaxMat = 0
if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
end
end
-- calcolo l'ingombro orizzontale della faccia -- calcolo l'ingombro orizzontale della faccia
_, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0) local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0)
-- confronto questo ingombro con il doppio della massima dimensione del DiceCut (impossibile lavorare sotto da sopra se più di 2 tagli oppure se tipo PF, taglio inclinato in Y e non taglio singolo orizzontale) -- confronto questo ingombro con il doppio della massima dimensione del DiceCut (impossibile lavorare sotto da sopra se più di 2 tagli)
if DimH > 2 * BD.MAX_DIM_DICE or ( BD.C_SIMM and ( abs( vtN:getY()) > 0.1) and dMaxMat < DimH + BD.CUT_EXTRA) then if DimH > 2 * BD.MAX_DIM_DICE then
return true, true return true, true
end end
end end
@@ -202,7 +169,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch1Id, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
end end
-- Inserisco la lavorazione del lato opposto -- Inserisco la lavorazione del lato opposto
@@ -225,7 +192,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
end end
return true, nil return true, nil
@@ -236,14 +203,13 @@ 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())
local dMinZ = max( BD.MIN_HEIGHT, 0.35 * b3Raw:getDimZ()) if Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then
if Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinZ 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
dOffs = dOffs - 0.6 * Proc.Box:getDimX() dOffs = dOffs - 0.6 * Proc.Box:getDimX()
elseif vtN:getZ() < -0.5 then elseif vtN:getZ() < -0.5 then
dOffs = dOffs - EgtIf( BD.PRESS_ROLLER, 0.4, 0.2) * Proc.Box:getDimX() dOffs = dOffs - 0.2 * Proc.Box:getDimX()
elseif ( abs( vtN:getY()) > 0.9 and vtN:getZ() > 0.2) then elseif ( abs( vtN:getY()) > 0.9 and vtN:getZ() > 0.2) then
dOffs = dOffs - 0.3 * Proc.Box:getDimX() dOffs = dOffs - 0.3 * Proc.Box:getDimX()
end end
@@ -253,7 +219,7 @@ local function UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
if vtN:getZ() > 0.5 then if vtN:getZ() > 0.5 then
dOffs = dOffs - 0.6 * Proc.Box:getDimX() dOffs = dOffs - 0.6 * Proc.Box:getDimX()
elseif vtN:getZ() < -0.5 then elseif vtN:getZ() < -0.5 then
dOffs = dOffs - EgtIf( BD.PRESS_ROLLER, 0.4, 0.2) * Proc.Box:getDimX() dOffs = dOffs - 0.2 * Proc.Box:getDimX()
elseif ( abs( vtN:getY()) > 0.9 and vtN:getZ() > 0.2) then elseif ( abs( vtN:getY()) > 0.9 and vtN:getZ() > 0.2) then
dOffs = dOffs - 0.3 * Proc.Box:getDimX() dOffs = dOffs - 0.3 * Proc.Box:getDimX()
end end
@@ -264,8 +230,7 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione con testa da sopra -- Applicazione della lavorazione con testa da sopra
local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, nLimitingSurf, sLeadInOutType) local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes)
local sWarn
-- ingombro del grezzo -- ingombro del grezzo
b3Raw = b3Raw or EgtGetRawPartBBox( nRawId) b3Raw = b3Raw or EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo -- ingombro del pezzo
@@ -276,29 +241,24 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN) local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN)
local bDownCut = ( vtN:getZ() <= dNzLimDwnUp) local bDownCut = ( vtN:getZ() <= dNzLimDwnUp)
if bFromBottom == nil then if bFromBottom == nil then
bFromBottom = ( vtN:getZ() > 0.25 and ( b3Solid:getDimX() < BD.LEN_SHORT_PART and BL.IsSplittedPartPhase( nPhase)) and not Proc.AdvTail and vtN:getX() < 0 and abs( vtN:getY()) < 0.259) bFromBottom = ( vtN:getZ() > 0.25 and b3Solid:getDimX() < BD.LEN_SHORT_PART and not Proc.AdvTail and vtN:getX() < 0 and abs( vtN:getY()) < 0.259)
end end
local dMinFeatureLengthForLongCut = EgtIf( BD.C_SIMM, 590, 400)
-- 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() > dMinFeatureLengthForLongCut)) ( 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 -- 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 ( abs(vtN:getY()) > 0.865) and 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:getDimZ() > b3Solid:getDimZ() - 10 * GEO.EPS_SMALL) and
( Proc.Box:getDimX() > 0.75 * b3Solid:getDimX() or Proc.Box:getDimX() > dMinFeatureLengthForLongCut)) ( 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 local bNoDicing = EgtGetInfo( Proc.Id, 'Q04', 'i') == 1
if bNoDicing then if bNoDicing then
if bLongCut then if bLongCut then
local bOk, sErr = LongCut.Make( Proc, nPhase, nRawId, nPartId, true) return LongCut.Make( Proc, nPhase, nRawId, nPartId, true)
return bOk, sErr, bNoDicing
elseif bLongCutFromSide then elseif bLongCutFromSide then
local bOk, sErr = LongCut.Make( Proc, nPhase, nRawId, nPartId, false, 2) return LongCut.Make( Proc, nPhase, nRawId, nPartId, false, 2)
return bOk, sErr, bNoDicing
end end
-- se non passa dal LongCut rimetto a false perchè ha fatto un taglio standard
bNoDicing = false
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
@@ -318,9 +278,9 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
-- se la faccia occupa tutta la trave in X e Z o occupa sicuramente la faccia in Z e almeno 3/4 della faccia in X e sborda in X, -- se la faccia occupa tutta la trave in X e Z o occupa sicuramente la faccia in Z e almeno 3/4 della faccia in X e sborda in X,
if ( ( abs( Proc.Box:getMin():getX() - b3Solid:getMin():getX()) < 10*GEO.EPS_SMALL and abs( Proc.Box:getMax():getX() - b3Solid:getMax():getX()) < 10*GEO.EPS_SMALL) or if ( ( abs( Proc.Box:getMin():getX() - b3Solid:getMin():getX()) < 10*GEO.EPS_SMALL and abs( Proc.Box:getMax():getX() - b3Solid:getMax():getX()) < 10*GEO.EPS_SMALL) or
( ( abs( Proc.Box:getMin():getX() - b3Solid:getMin():getX()) < 10*GEO.EPS_SMALL or abs( Proc.Box:getMax():getX() - b3Solid:getMax():getX()) < 10*GEO.EPS_SMALL) and ( ( abs( Proc.Box:getMin():getX() - b3Solid:getMin():getX()) < 10*GEO.EPS_SMALL or abs( Proc.Box:getMax():getX() - b3Solid:getMax():getX()) < 10*GEO.EPS_SMALL) and
Proc.Box:getDimX() > 0.90 * b3Solid:getDimX())) and Proc.Box:getDimX() > 0.75 * b3Solid:getDimX())) and
abs( Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()) < 10*GEO.EPS_SMALL and abs( Proc.Box:getMax():getZ() - b3Solid:getMax():getZ()) < 10*GEO.EPS_SMALL then abs( Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()) < 10*GEO.EPS_SMALL and abs( Proc.Box:getMax():getZ() - b3Solid:getMax():getZ()) < 10*GEO.EPS_SMALL then
local sErr = 'Error : Impossible to machine by orientation (on side A)' local sErr = 'Error : Impossible to machine by orientation (on side)'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -338,7 +298,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
-- se la faccia termina davanti o dietro la trave e arriva in coda e non interessa la faccia inferiore, forzo il taglio a cubetti a partire dal davanti -- se la faccia termina davanti o dietro la trave e arriva in coda e non interessa la faccia inferiore, forzo il taglio a cubetti a partire dal davanti
if ( abs( Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()) < 10*GEO.EPS_SMALL or abs( Proc.Box:getMax():getZ() - b3Solid:getMax():getZ()) < 10*GEO.EPS_SMALL) and if ( abs( Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()) < 10*GEO.EPS_SMALL or abs( Proc.Box:getMax():getZ() - b3Solid:getMax():getZ()) < 10*GEO.EPS_SMALL) and
abs( Proc.Box:getMin():getX() - b3Solid:getMin():getX()) < 10*GEO.EPS_SMALL then abs( Proc.Box:getMin():getX() - b3Solid:getMin():getX()) < 10*GEO.EPS_SMALL then
local sErr = 'Error : Impossible to machine by orientation (on side B)' local sErr = 'Error : Impossible to machine by orientation (on side)'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -375,66 +335,24 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- verifico se necessari tagli supplementari o se presente superficie limitante -- 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)
-- se lungo, una faccia e rivolto sul retro verso l'alto si forzano i cubetti per evitare di rovinare il pezzo successivo
local bForceDicing = ( Proc.Fct == 1 and Proc.AffectedFaces.Left and bLongCut and vtN:getZ() > 10 * GEO.EPS_SMALL and vtN:getY() < 10 * GEO.EPS_SMALL)
local vCuts = {} local vCuts = {}
local dDicingOffsetP if not Proc.AdvTail and ( dCutH > dMaxDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC or dCutV > dMaxVertDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC) then
local dDicingOffsetO
if ( ( not Proc.AdvTail) or bForceDicing) and
( dCutH - 100 * GEO.EPS_SMALL > dMaxDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC or
dCutV - 100 * GEO.EPS_SMALL > dMaxVertDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC) then
local ptExtra, vtExtra local ptExtra, vtExtra
local bAutoCalcSurf = true local bAutoCalcSurf = true
if Proc.AdvTail then
-- do avviso che la lama può sbordare nel pezzo successivo
sWarn = 'Warning : Cut machining can damage next piece'
EgtOutLog( sWarn .. ' (process ' .. tostring( Proc.Id) .. ')')
end
if bFillAreaPiece or bFillTail then if bFillAreaPiece or bFillTail then
local ptMiddle = ( b3Solid:getMin() + b3Solid:getMax()) / 2 local ptMiddle = ( b3Solid:getMin() + b3Solid:getMax()) / 2
ptExtra = Point3d( b3Solid:getMin():getX() + 5*GEO.EPS_SMALL, ptMiddle:getY(), ptMiddle:getZ()) ptExtra = Point3d( b3Solid:getMin():getX() + 5*GEO.EPS_SMALL, ptMiddle:getY(), ptMiddle:getZ())
vtExtra = X_AX() vtExtra = X_AX()
bAutoCalcSurf = false bAutoCalcSurf = false
-- superficie limitante
elseif nLimitingSurf then
ptExtra, vtExtra = EgtSurfTmFacetCenter( nLimitingSurf, 0, GDB_ID.ROOT)
end
-- verifico elevazione max del materiale tagliato
local dMaxElev
if vtN:getX() > 0 then
if bForced then
dMaxElev = b3Raw:getMax():getX() - Proc.Box:getMin():getX()
else
dMaxElev = b3Solid:getMax():getX() - Proc.Box:getMin():getX()
end
else
if bForced then
dMaxElev = Proc.Box:getMax():getX() - b3Raw:getMin():getX()
else
dMaxElev = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
end
end
-- per macchina TURN (ma non OikosX) aggiusto massima dimensione cubetto
local dNewDiceDim
if BD.TURN and BD.TURN ~= 2 then
local dDimRef = GEO.INFINITO
if abs( vtN:getZ()) < 0.003 then
dDimRef = b3Raw:getDimZ()
elseif abs( vtN:getY()) < 0.003 then
dDimRef = b3Raw:getDimY()
end
if dDimRef + BD.CUT_EXTRA < dMaxDepth then
dNewDiceDim = - ( dMaxDepth - BD.CUT_EXTRA)
end
end end
-- se il taglio è più spesso della lama abilito il dicing, altrimenti no -- se il taglio è più spesso della lama abilito il dicing, altrimenti no
if ( dMaxElev > dSawThick) or bForceDicing then if Proc.Box:getDimX() >= dSawThick then
vCuts, dDicingOffsetP = DC.GetDice( nAddGrpId, EgtIf( bForced, b3Raw, b3Solid), ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, dNewDiceDim) vCuts = DC.GetDice( nAddGrpId, EgtIf( bForced, b3Raw, b3Solid), ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA)
-- se taglio sborda in coda e non è stato inserito nessun taglio a cubetti, lo rilancio con le dimensioni customizzate -- se taglio sborda in coda e non è stato inserito nessun taglio a cubetti, lo rilancio con le dimensioni customizzate
if ( bFillTail or bCustDiceCut) and #vCuts == 0 then if ( bFillTail or bCustDiceCut) and #vCuts == 0 then
vCuts, dDicingOffsetP = DC.GetDice( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, Proc.Box:getDimY()) vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, Proc.Box:getDimY())
end end
end end
end end
@@ -442,19 +360,6 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
if bCustDiceCut and #vCuts == 0 then if bCustDiceCut and #vCuts == 0 then
return false, -1 return false, -1
end end
-- per caso speciale in cui c'è il rischio che il cubetto rimanga appoggiato sul motore, faccio solo i tagli perpendicolari seguiti da due tagli verticali laterali
local bDangerousReliefCut = false
-- verifico che i tagli perpendicolari siano perpendicolari al lato più vicino a Z
local nFirstPerpendicularCut = ( #vCuts > 0 and ( vCuts[1][1] or vCuts[3][1]))
if nFirstPerpendicularCut then
local frFace = BL.GetFaceHvRefDim( Proc.Id, 0)
local vtTemp = EgtSurfTmFacetNormVersor( nFirstPerpendicularCut, 0, GDB_ID.ROOT) ^ frFace:getVersX()
if not ( vtTemp:isSmall()) and not ( bDownCut or bFromBottom) and not bLongCut and ( not BD.C_SIMM or b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL) then
bDangerousReliefCut = true
end
end
--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
@@ -465,8 +370,8 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
if ( i % 2) == 1 then if ( i % 2) == 1 then
local vtO = EgtSurfTmFacetNormVersor( vCuts[i][j], 0, GDB_ID.ROOT) local vtO = EgtSurfTmFacetNormVersor( vCuts[i][j], 0, GDB_ID.ROOT)
if ( vtN:getY() > 0.766 and vtO:getY() < -0.05) or if ( vtN:getY() > 0.707 and vtO:getY() < -0.05) or
( vtN:getY() < -0.766 and vtO:getY() > 0.05) then ( vtN:getY() < -0.707 and vtO:getY() > 0.05) then
EgtInvertSurf( vCuts[i][j]) EgtInvertSurf( vCuts[i][j])
bOrthInv = true bOrthInv = true
end end
@@ -502,15 +407,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
if vtO then if vtO then
vtOrthoO = Vector3d( vtO) * EgtIf( bOrthInv, -1, 1) vtOrthoO = Vector3d( vtO) * EgtIf( bOrthInv, -1, 1)
else else
-- ricalcolo tipo taglio perché "bHorizCut" è calcolato sulla feature, mentre il cubetto potrebbe essere lavorato in un altro modo if bHorizCut then
local _, dLen, dWidth = BL.GetFaceHvRefDim( vCuts[i][1], 0, b3Raw)
local bCutDirection = bHorizCut
-- se bisogna tagliare di fianco ma la lunghezza faccia è più del massimo materiale, forzo lavorazione da sopra
if not bHorizCut and dLen > dMaxDepth then
bCutDirection = true
end
if bCutDirection then
vtOrthoO = Z_AX() vtOrthoO = Z_AX()
else else
if vtN:getZ() < dNzLimDwnUp then if vtN:getZ() < dNzLimDwnUp then
@@ -521,101 +418,44 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
end end
end end
end end
local dDiceFaceMaxH = 0 -- lavoro la faccia
local dDiceFaceMinH = GEO.INFINITO for j = 1, #vCuts[i] do
if ( i % 2) == 0 and bDangerousReliefCut then -- se taglio dal basso
for j = 1, #vCuts[i] do if bDownCut then
local _, dDiceFaceH, dDiceFaceV = BL.GetFaceHvRefDim( vCuts[i][j], 0) -- se strato pari composto da 1 o 2 elementi
dDiceFaceMaxH = max( dDiceFaceMaxH, dDiceFaceH) if ( i % 2) == 0 and #vCuts[i] <= 2 then
-- calcolo lato orizzontale minore ipotizzando sia un trapezio -- il primo elemento prende la direzione prevista, il secondo quella opposta
local dDiceFaceH2 = ( 2 * EgtSurfArea( vCuts[i][j]) ) / dDiceFaceV - dDiceFaceH local vtNewOrthoO = Vector3d( vtOrthoO)
dDiceFaceMinH = min( dDiceFaceMinH, dDiceFaceH2)
end
end
-- caso speciale con rischio cubetto sul motore
if ( i % 2) == 0 and bDangerousReliefCut and ( dMaxDepth > dDiceFaceMaxH - 0.5 * dDiceFaceMinH + BD.CUT_EXTRA_MIN) then
local bDoubleCut = false
local dCutExtra = BD.CUT_EXTRA
if dMaxDepth < dDiceFaceMaxH + BD.CUT_EXTRA then
bDoubleCut = true
dCutExtra = - 0.5 * dDiceFaceMinH + BD.CUT_EXTRA_MIN
end
local nSurfToCut = EgtSurfTmBySewing( nAddGrpId, vCuts[i], false)
local nFaceUseCut1, nFaceUseCut2 = MCH_MILL_FU.ORTHO_BACK, MCH_MILL_FU.ORTHO_FRONT
if Proc.Tail then
nFaceUseCut1, nFaceUseCut2 = nFaceUseCut2, nFaceUseCut1
end
if bDoubleCut then
local bOk, sErr = Fbs.MakeOne( nSurfToCut, 0, sCutting, dSawDiam, nFaceUseCut1, nil, dCutExtra, BD.CUT_SIC, 0, 0, 0, '', b3Raw, true)
if not bOk then return false, sErr end
end
local bOk2, sErr2 = Fbs.MakeOne( nSurfToCut, 0, sCutting, dSawDiam, nFaceUseCut2, nil, dCutExtra, BD.CUT_SIC, 0, 0, 0, '', b3Raw)
if not bOk2 then return false, sErr2 end
-- caso standard
else
-- lavoro la faccia
for j = 1, #vCuts[i] do
-- se taglio dal basso
if bDownCut then
-- se strato pari composto da 1 o 2 elementi
if ( i % 2) == 0 and #vCuts[i] <= 2 then
-- il primo elemento prende la direzione prevista, il secondo quella opposta
local vtNewOrthoO = Vector3d( vtOrthoO)
local dVzLimDwnUp = dNzLimDwnUp
if j ~= 1 then
vtNewOrthoO = -vtOrthoO
if BD.GetNzLimDownUp then
dVzLimDwnUp = BD.GetNzLimDownUp( b3Raw, vtN, V_NULL(), true)
elseif not BD.C_SIMM and not BD.TURN and abs( vtN:getY()) > 0.05 then
dVzLimDwnUp = -0.708
end
end
local bSpecialTangentLeadInOut = ( i % 2 == 0) and ( Proc.AffectedFaces.Left or Proc.AffectedFaces.Right)
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtNewOrthoO, dVzLimDwnUp, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, 0, nil, b3Raw, nil, nil, bSpecialTangentLeadInOut)
if not bOk then return bOk, sErr end
end
-- tutti gli altri casi vengono saltati
-- caso generale
else
-- in generale sta sollevato di pochissimo
local dExtraCut = -0.1
-- se tagli paralleli
if ( i % 2) == 0 then
-- se non ci sono tagli ortogonali devo affondare
if bNoPerpCuts then
dExtraCut = BD.CUT_EXTRA
-- se altrimenti tagli ortogonali invertiti, devo approfondire dello spessore lama
elseif bOrthInv then
dExtraCut = dSawThick
-- se ultimo taglio, devo affondare
elseif j == #vCuts[i] then
dExtraCut = BD.CUT_EXTRA
end
end
local dVzLimDwnUp = dNzLimDwnUp local dVzLimDwnUp = dNzLimDwnUp
if BD.GetNzLimDownUp then if j ~= 1 then
dVzLimDwnUp = BD.GetNzLimDownUp( b3Raw, vtN, V_NULL(), true) vtNewOrthoO = -vtOrthoO
elseif not BD.C_SIMM and not BD.TURN and vtN:getZ() > 0.707 then if not BD.C_SIMM and abs( vtN:getY()) > 0.05 then dVzLimDwnUp = -0.707 end
dVzLimDwnUp = -0.708
end end
local bSpecialTangentLeadInOut = ( i % 2 == 0) and ( Proc.AffectedFaces.Left or Proc.AffectedFaces.Right) 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 vtOrthoOAlternative
if ( i % 2 == 0) and ( Proc.Fct == 1) and bNoPerpCuts then
vtOrthoOAlternative = - vtOrthoO
end
local sLeadInOutTypeFbs = 'Calculated'
if ( ( i % 2) ~= 0) then
if ( sLeadInOutType == 'Tangent') then
sLeadInOutTypeFbs = 'Tangent'
elseif ( sLeadInOutType == 'Perpendicular') then
sLeadInOutTypeFbs = 'Perpendicular'
elseif ( sLeadInOutType == 'PerpendicularOutraw') then
sLeadInOutTypeFbs = 'PerpendicularOutraw'
end
end
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, sNotes, b3Raw, nil, nil, bSpecialTangentLeadInOut, sLeadInOutTypeFbs, vtOrthoOAlternative, dDicingOffsetP)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
end end
-- tutti gli altri casi vengono saltati
-- caso generale
else
-- in generale sta sollevato di pochissimo
local dExtraCut = -0.1
-- se tagli paralleli
if ( i % 2) == 0 then
-- se non ci sono tagli ortogonali devo affondare
if bNoPerpCuts then
dExtraCut = BD.CUT_EXTRA
-- se altrimenti tagli ortogonali invertiti, devo approfondire dello spessore lama
elseif bOrthInv then
dExtraCut = dSawThick
-- se ultimo taglio, devo affondare
elseif j == #vCuts[i] then
dExtraCut = BD.CUT_EXTRA
end
end
local dVzLimDwnUp = dNzLimDwnUp
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)
if not bOk then return bOk, sErr end
end end
end end
end end
@@ -630,10 +470,9 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
end end
-- lavoro la faccia -- lavoro la faccia
local vtOrthoO local vtOrthoO
if bFromBottom and dCutV < dMaxDepth - 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) and 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
( not bVertCutOk or b3Solid:getDimX() > BD.LEN_SHORT_PART or Proc.AdvTail or ( vtN:getX() > 0 and vtN:getZ() <= 0.708) or ( abs( vtN:getY()) < 0.1 and vtN:getZ() <= 0)) then
vtOrthoO = Z_AX() vtOrthoO = Z_AX()
elseif b3Solid:getDimX() < BD.LEN_SHORT_PART and not Proc.AdvTail and abs( vtN:getY()) > 0.259 and elseif b3Solid:getDimX() < BD.LEN_SHORT_PART and not Proc.AdvTail and abs( vtN:getY()) > 0.259 and
vtN:getZ() > -0.174 and abs( vtN:getY()) > abs( vtN:getZ()) and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then vtN:getZ() > -0.174 and abs( vtN:getY()) > abs( vtN:getZ()) and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then
@@ -649,10 +488,8 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
vtOrthoO = -X_AX() vtOrthoO = -X_AX()
end end
else else
if vtN:getZ() < dVzLimDwnUp or Proc.Tail or ( Proc.Head and abs( vtN:getY()) > 0.01) then 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())
elseif Proc.Head then
vtOrthoO = EgtIf( vtN:getY() > -0.02, Y_AX(), -Y_AX())
else else
vtOrthoO = EgtIf( vtN:getY() > 0.02, Y_AX(), -Y_AX()) vtOrthoO = EgtIf( vtN:getY() > 0.02, Y_AX(), -Y_AX())
end end
@@ -666,7 +503,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
end end
return true, sWarn return true
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
@@ -796,16 +633,14 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
-- taglio perpendicolare (limite Vz Down Up messo a -2 per non farlo mai intervenire) -- taglio perpendicolare (limite Vz Down Up messo a -2 per non farlo mai intervenire)
if vCuts[i][j] then if vCuts[i][j] then
local bSpecialTangentLeadInOut = ( i % 2 == 0) and ( Proc.AffectedFaces.Left or Proc.AffectedFaces.Right) local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO_1, -2, dExtraCut_1, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO_1, -2, dExtraCut_1, BD.CUT_SIC, 0, 0, 0, nil, b3Raw, nil, nil, bSpecialTangentLeadInOut)
if not bOk then if not bOk then
return bOk, sErr return bOk, sErr
end end
end end
-- 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 bSpecialTangentLeadInOut = ( i % 2 == 0) and ( Proc.AffectedFaces.Left or Proc.AffectedFaces.Right) 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, nil, nil, bSpecialTangentLeadInOut)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
end end
end end
@@ -854,7 +689,7 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, dOvmTail, bUpdateIng, nLimitingSurf, sLeadInOutType) function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, dOvmTail, bUpdateIng)
-- sovramateriale di coda -- sovramateriale di coda
dOvmTail = dOvmTail or BD.OVM_MID dOvmTail = dOvmTail or BD.OVM_MID
-- ingombro del grezzo -- ingombro del grezzo
@@ -870,52 +705,51 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom,
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 not bForced then
if not BL.IsCutNeeded( Proc, b3Raw, dOvmHead, dOvmTail) then if Proc.Head then
-- 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
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
-- se coincide con un taglio frontale non va fatto
if Proc.CutFront then
return true return true
end end
end end
-- abilitazione lavorazione da sotto (testa da sotto e direzione normale sotto -20deg e sbandato oltre 1deg oppure sezione più larga di 2 cubetti 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 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_DICE - 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 bDownTurn = ( BD.TURN and vtN:getZ() < -0.017)
local bTopHead = ( BD.DOWN_HEAD and ( vtN:getZ() > -0.342 or not bDownHead)) 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
local bH2 sCutting, bDownHead = ML.FindCutting( sCutType, bTopHead, bDownHead)
sCutting, bH2 = ML.FindCutting( sCutType, bTopHead, bDownHead)
bDownHead = bH2 and bDownHead
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
local bNoDicing = false
local sWarn
-- se taglio con testa da sopra -- se taglio con testa da sopra
if not bDownHead and not bDownTurn then if not bDownHead and not bDownTurn then
local bOk, sErr, bNoDicing2 = MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, nLimitingSurf, sLeadInOutType) local bOk, sErr = MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes)
bNoDicing = bNoDicing2 if not bOk then return false, sErr end
if not bOk then
return false, sErr
else
sWarn = sErr
end
-- altrimenti taglio con testa da sotto -- altrimenti taglio con testa da sotto
else else
local bOk, sErr = MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead) local bOk, sErr = MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut)
if not bOk then if not bOk then return false, sErr end
return false, sErr
else
sWarn = sErr
end
end end
-- Aggiornamento ingombro (se vero taglio o richiesto) -- Aggiornamento ingombro (se vero taglio o richiesto)
-- Se lascio il cordolo (bNoDicing) non aggiorno il grezzo perchè lo scarto rimane attaccato if ProcessCut.Identify( Proc) or bUpdateIng then
if ( ProcessCut.Identify( Proc) or bUpdateIng) and not bNoDicing then
UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw) UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
end end
return true, sWarn return true
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
+13 -332
View File
@@ -1,8 +1,5 @@
-- ProcessDoubleCut.lua by Egaltech s.r.l. 2023/03/22 -- ProcessDoubleCut.lua by Egaltech s.r.l. 2022/07/11
-- Gestione calcolo doppi tagli di lama per Travi -- Gestione calcolo doppi tagli di lama per Travi
-- 2022/08/29 Implementata la fresatura dal lato per tagli problematici per PF1250.
-- 2023/03/22 Eliminata SetOpenSide locale, si usa quella di libreria.
-- 2023/12/07 Correzione in Classify in scelta ribaltamento trave quando si è in condizioni downUp
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessDoubleCut = {} local ProcessDoubleCut = {}
@@ -55,22 +52,10 @@ function ProcessDoubleCut.Classify( Proc, b3Raw)
local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN) local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN)
local bDownCut = ( vtN:getZ() <= dNzLimDwnUp) local bDownCut = ( vtN:getZ() <= dNzLimDwnUp)
if bDownCut then if bDownCut then
-- recupero i dati della lama
local sCutType = EgtIf( Proc.Head, 'HeadSide', 'TailSide')
local sCutting = ML.FindCutting( sCutType, true, false)
local dMaxDepth = 0
local dMaxMat = 0
if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
end
end
-- calcolo l'ingombro orizzontale della faccia -- calcolo l'ingombro orizzontale della faccia
local _, DimH = 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 oppure se tipo PF, taglio inclinato in Y e non taglio singolo orizzontale) -- confronto questo ingombro con il doppio della massima dimensione del DiceCut (impossibile lavorare sotto da sopra se più di 2 tagli)
if DimH > 2 * BD.MAX_DIM_DICE or ( BD.C_SIMM and abs( vtN:getY()) > 0.1 and dMaxMat < DimH + BD.CUT_EXTRA) then if DimH > 2 * BD.MAX_DIM_DICE then
return true, true return true, true
end end
end end
@@ -174,7 +159,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch1Id, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
end end
-- Inserisco la lavorazione del lato opposto -- Inserisco la lavorazione del lato opposto
@@ -197,266 +182,12 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
end end
return true return true
end end
---------------------------------------------------------------------
local function VerifyPocket( Proc, dDiam, dDepth, dMaxTotLen, sMchFindMaster, bPocketDown)
-- tipo di svuotatura
local sMchFind = EgtIf( sMchFindMaster and #sMchFindMaster > 0, sMchFindMaster, 'Pocket')
-- ricerca della svuotatura
local sPocketing
if dDepth then
sPocketing = ML.FindPocketing( sMchFind, dDiam, dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or
ML.FindPocketing( sMchFind, dDiam, 0.8 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or
ML.FindPocketing( sMchFind, dDiam, 0.6 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or
ML.FindPocketing( sMchFind, dDiam, 0.4 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or
ML.FindPocketing( sMchFind, dDiam, 0, dMaxTotLen)
else
sPocketing = ML.FindPocketing( sMchFind, dDiam, 0, dMaxTotLen)
end
if not sPocketing then
return false
end
-- recupero i dati dell'utensile
local bUsePocketing = false
local dMaxDepth = 0
local dToolDiam = 0
if EgtMdbSetCurrMachining( sPocketing) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
bUsePocketing = true
end
return bUsePocketing, sPocketing, dMaxDepth, dToolDiam
end
---------------------------------------------------------------------
local function MakeBySidePocket( Proc, nPhase, nRawId, nPartId, nAddGrpId, b3Solid)
local nFirstMachId
local sWarn
local sMchFind = 'OpenPocket'
local dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt
local bBadMach = false
-- ottengo le dimensioni del tunnel
dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = BL.GetTunnelDimension( Proc, nPartId)
-- posso utilizzare utensile con diametro doppio della dimensione minima
dDimMin = min( 2 * dDimMin, BD.MAXDIAM_POCK_CORNER)
local nPathInt
-- verifico se è presente la testa da sotto e se è necessario usarla
bMillDown = ( BD.DOWN_HEAD == true and abs( vtOrtho:getZ()) >= 0.707)
-- cerco l'utensile di svuotatura per la testa sopra
local bMakePocket, sPocketing, dMaxDepth, dDiamTool = VerifyPocket( Proc, dDimMin, dDepth / 2, nil, sMchFind)
local bMakePocketDn, sPocketingDn, dMaxDepthDn, dDiamToolDn
-- cerco anche l'utensile per la testa sotto, nel caso servisse
if bMillDown then
bMakePocketDn, sPocketingDn, dMaxDepthDn, dDiamToolDn = VerifyPocket( Proc, dDimMin, dDepth / 2, nil, sMchFind, true)
-- se è negativo inverto il versore e la faccia
if vtOrtho:getZ() < 0 then
vtOrtho = -vtOrtho
EgtInvertSurf( nSurfInt)
end
end
if bMakePocket then
-- gestione svuotatura da un solo lato o anche dal lato opposto (se non verticale)
-- estraggo il contorno dalla superfice per evitare i problemi con la svuotatura
-- e assegno l'estrusione
nPathInt = EgtExtractSurfTmLoops( nSurfInt, nAddGrpId)
EgtModifyCurveExtrusion( nPathInt, vtOrtho, GDB_RT.GLOB)
BL.SetOpenSide( nPathInt, b3Solid)
-- variabili per parametri lavorazione
local dMachDepth
local dElev = 0
local bDoubleSide
local bOneShot
local bComplete = true
-- imposto altezza aggiuntiva di elevazione
local dCollSic = BL.CalcCollisionSafety( vtOrtho)
-- se possibile svuotare completamente da una sola parte
if dMaxDepth > ( dDepth + BD.CUT_EXTRA + dCollSic) then
dMachDepth = ( dDepth / 2) + BD.CUT_EXTRA
dElev = dDepth + BD.CUT_EXTRA
bOneShot = true
else
-- se direzione verso la verticale setto max affondamento possibile ed
-- emetto messaggio di warning perché non lavorabile interamente
if abs( vtOrtho:getZ()) >= 0.707 and not BD.DOWN_HEAD then
dMachDepth = dMaxDepth - ( dDepth / 2) - dCollSic
dElev = dMaxDepth
sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
bComplete = false
-- altrimenti setto il flag per fare la svuotatura da due parti
else
-- se l'altezza utensile riesce a lavorare completamente da due parti
if dMaxDepth > ( dDepth / 2) + dCollSic + BD.CUT_EXTRA_MIN then
dMachDepth = BD.CUT_EXTRA_MIN
dElev = ( dDepth / 2) + BD.CUT_EXTRA_MIN
-- altrimenti non si riesce in due passate, limito la profondità e setto l'elevazione
else
dMachDepth = dMaxDepth - ( dDepth / 2) - dCollSic
dElev = dMaxDepth
-- se molto inclinato rispetto alla normale della faccia di riferimento, lavorazione non idonea per probabili collisioni
local vtRef = Y_AX()
if abs( vtOrtho:getX()) > abs( vtOrtho:getY()) and abs( vtOrtho:getX()) > abs( vtOrtho:getZ()) then
vtRef = X_AX()
elseif abs( vtOrtho:getZ()) > abs( vtOrtho:getX()) and abs( vtOrtho:getZ()) > abs( vtOrtho:getY()) then
vtRef = Z_AX()
end
if abs( vtOrtho * vtRef) < 0.5 then
bBadMach = true
end
end
bDoubleSide = true
end
end
-- inserisco la lavorazione di svuotatura
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sName, sPocketing)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
EgtOutLog( sErr)
return -1, sErr
end
-- prendo l'id della prima lavorazione inserita
if not nFirstMachId then
nFirstMachId = nMchFId
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nPathInt, -1}})
-- verifico se devo invertire direzione utensile (in caso di direzione verso la verticale)
local bInvertMach
if vtOrtho:getZ() < BD.NZ_MINA and abs(vtOrtho:getZ()) >= 0.707 and not BD.DOWN_HEAD then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
bInvertMach = true
-- altrimenti se da fare in una sola volta e direzionato verso Y+ lo inverto per lavorarlo davanti
elseif not bDoubleSide and vtOrtho:getY() > GEO.EPS_SMALL and not ( -(vtOrtho:getZ()) < BD.NZ_MINA) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
bInvertMach = true
end
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE
if not BD.C_SIMM then
if AreSameOrOppositeVectorApprox( vtOrtho, Z_AX()) then
nSCC = MCH_SCC.ADIR_YM
elseif abs( vtOrtho:getX()) < 0.1 then
nSCC = EgtIf( BL.IsPartFinalPhase( nPhase), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
elseif vtOrtho:getY() < GEO.EPS_SMALL then
nSCC = EgtIf( bInvertMach, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
else
nSCC = EgtIf( bInvertMach, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)
end
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN)
-- inverto il percorso di lavorazione per lavorare sinistro
EgtSetMachiningParam( MCH_MP.INVERT, true)
-- imposto affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dMachDepth)
-- imposto elevazione e dichiaro non si generano sfridi per VMill
local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';'
sNotes = sNotes .. 'VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- eseguo
if not ML.ApplyMachining( true, false) then
-- provo ad allargare leggermente la tasca
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return -1, sErr
end
end
-- se posso applicare la svuotatura sul lato opposto
if bDoubleSide then
-- se ho la lavorazione da sotto ricalcolo in base a questa lavorazione
if bMakePocketDn then
-- sPocketing = sPocketingDn
-- dMaxDepth = dMaxDepthDn
-- dDiamTool = dDiamToolDn
-- se l'altezza utensile riesce a lavorare completamente da due parti
if dMaxDepthDn > ( dDepth / 2) + dCollSic + BD.CUT_EXTRA_MIN then
dMachDepth = BD.CUT_EXTRA_MIN
dElev = ( dDepth / 2) + BD.CUT_EXTRA_MIN
-- altrimenti non si riesce in due passate, limito la profondità e setto l'elevazione
else
dMachDepth = dMaxDepthDn - ( dDepth / 2) - dCollSic
dElev = dMaxDepthDn
bComplete = false
sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
end
else
-- se anche lavorando dal lato opposto non riesco a svuotare completamente la fessura
-- setto i parametri affondamento ed emetto warning
if dMaxDepth < ( dDepth / 2) + BD.CUT_EXTRA + dCollSic then
dMachDepth = dMaxDepth - (dDepth / 2) - dCollSic
dElev = dMaxDepth
bComplete = false
sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
end
end
-- inserisco la lavorazione di svuotatura
local sName = 'PockOppo_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sName, EgtIf( bMakePocketDn, sPocketingDn, sPocketing))
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. EgtIf( bMakePocketDn, sPocketingDn, sPocketing)
EgtOutLog( sErr)
return -1, sErr
end
-- prendo l'id della prima lavorazione inserita
if not nFirstMachId then
nFirstMachId = nMchFId
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nPathInt, -1}})
-- imposto direzione utensile opposta
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE
if not BD.C_SIMM then
if AreSameVectorApprox( vtOrtho, Z_AX()) then
nSCC = MCH_SCC.ADIR_YM
elseif abs( vtOrtho:getX()) < 0.1 then
nSCC = EgtIf( BL.IsPartFinalPhase( nPhase), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
elseif vtOrtho:getY() < GEO.EPS_SMALL then
nSCC = MCH_SCC.ADIR_YP
else
nSCC = MCH_SCC.ADIR_YM
end
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN)
-- inverto il percorso di lavorazione per lavorare sinistro
EgtSetMachiningParam( MCH_MP.INVERT, true)
-- imposo affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dMachDepth)
-- imposto elevazione e dichiaro non si generano sfridi per VMill
local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';'
sNotes = sNotes .. 'VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- eseguo
if not ML.ApplyMachining( true, false) then
-- provo ad allargare leggermente la tasca
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return -1, sErr
end
end
end
return 1, sWarn, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot, bMillDown, nFirstMachId
end
return 0, sWarn, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot, bMillDown, nFirstMachId, bOrthoFaces
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
@@ -475,36 +206,13 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- dati delle facce -- dati delle facce
local ptC = {} local ptC = {}
local vtN = {} local vtN = {}
local idFirstFace, idSecondFace ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
-- se ci sono più di due face (caso insolito), si prendono le facce più grandi
if Proc.Fct > 2 then
local Area = {}
-- si prendono le due più grandi, potrebbero essercene più di due
for i = 1, Proc.Fct do
local _, dL, dW = EgtSurfTmFacetMinAreaRectangle( Proc.Id, i - 1)
table.insert( Area, { nIndex = i-1, dArea = dL*dW})
end
-- ordina 'Area' in ordine decrescente
table.sort( Area, function( A, B)
return A.dArea > B.dArea
end
)
idFirstFace = Area[1].nIndex
idSecondFace = Area[2].nIndex
else
idFirstFace = 0
idSecondFace = 1
end
ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, idFirstFace, GDB_ID.ROOT)
ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, idSecondFace, GDB_ID.ROOT)
-- normale media per capire se taglio di testa o di coda -- normale media per capire se taglio di testa o di coda
local vtNm = ( vtN[1] + vtN[2]) ; vtNm:normalize() local vtNm = ( vtN[1] + vtN[2]) ; vtNm:normalize()
local bHead = ( vtNm:getX() > 0) local bHead = ( vtNm:getX() > 0)
-- angolo diedro per stabilire se taglio convesso -- angolo diedro per stabilire se taglio convesso
local bAdj, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, idFirstFace, idSecondFace, GDB_ID.ROOT) local bAdj, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT)
local bConvex = true local bConvex = true
local bOnY = true local bOnY = true
local ptPs = ( ptC[1] + ptC[2]) / 2 local ptPs = ( ptC[1] + ptC[2]) / 2
@@ -515,8 +223,8 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bConvex = ( dAng > 0) bConvex = ( dAng > 0)
end end
-- determino quale faccia è più grande -- determino quale faccia è più grande
local _, dB1, dH1 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, idFirstFace) local _, dB1, dH1 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0)
local _, dB2, dH2 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, idSecondFace) local _, dB2, dH2 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 1)
local nBigInd = EgtIf( dB1 * dH1 >= dB2 * dH2, 1, 2) local nBigInd = EgtIf( dB1 * dH1 >= dB2 * dH2, 1, 2)
local nSmaInd = 3 - nBigInd local nSmaInd = 3 - nBigInd
-- inserimento smussi -- inserimento smussi
@@ -544,8 +252,7 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
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 = Proc.Prc, Box = b3Add, Fct = 1, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId} Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
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, nil, nil, bForced, b3Raw, sNotes, dOvmTail, true)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
end end
@@ -557,8 +264,7 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
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 = Proc.Prc, Box = b3Add, Fct = 1, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId} Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
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, nil, nil, bForced, b3Raw, sNotes, dOvmTail, true)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
end end
@@ -567,31 +273,6 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- eseguo -- eseguo
local sCutType = EgtIf( bHead, 'HeadSide', 'TailSide') local sCutType = EgtIf( bHead, 'HeadSide', 'TailSide')
local bDownHead = ( BD.DOWN_HEAD and vtNm:getZ() < BD.NZ_MINB) local bDownHead = ( BD.DOWN_HEAD and vtNm:getZ() < BD.NZ_MINB)
-- per tutte le macchine tranne la Fast, controllo se ci sono tagli troppo inclinati e troppo profondi per la lama
-- in tal caso richiamo la lavorazione con fresa dal lato
if BD.C_SIMM and not bDownHead then
local sCutting = ML.FindCutting( sCutType, nil, bDownHead)
if not sCutting then
local sErr = 'Error : cutting not found in library'
EgtOutLog( sErr)
return false, sErr
end
local dMaxDepth = 0
if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
local _, _, dDimV1 = BL.GetFaceHvRefDim( Proc.Id, idFirstFace, b3Raw)
local _, _, dDimV2 = BL.GetFaceHvRefDim( Proc.Id, idSecondFace, b3Raw)
local bFace1TooLongForBlade, bFace2TooLongForBlade = ( dDimV1 >= dMaxDepth), ( dDimV2 >= dMaxDepth)
local dFace1Ang, dFace2Ang = vtN[1]:getZ(), vtN[2]:getZ()
if bFace1TooLongForBlade and dFace1Ang < ( BD.CUT_VZ_MIN or -0.484) or bFace2TooLongForBlade and dFace2Ang < ( BD.CUT_VZ_MIN or -0.484) then
local bOk, sErr = MakeBySidePocket( Proc, nPhase, nRawId, nPartId, nAddGrpId, b3Solid)
return bOk, sErr
end
end
local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType, false, bDownHead) local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType, false, bDownHead)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
-- segnalazione ingombro di testa o coda -- segnalazione ingombro di testa o coda
+8 -10
View File
@@ -1,7 +1,6 @@
-- 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) -- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- 2023/09/26 Modificata chiamata a GetFaceWithMostAdj.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessDovetail = {} local ProcessDovetail = {}
@@ -281,7 +280,7 @@ function ProcessDovetail.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end end
-- deve avere la normale principale diretta verso la testa -- deve avere la normale principale diretta verso la testa
local nPartId = EgtGetParent( EgtGetParent( Proc.Id) or GDB_ID.NULL) local nPartId = EgtGetParent( EgtGetParent( Proc.Id) or GDB_ID.NULL)
local nFacInd, dElev, nFacInd2, dElev2 = BL.GetFaceWithMostAdj( Proc, nPartId) local nFacInd, dElev, nFacInd2, dElev2 = BL.GetFaceWithMostAdj( Proc.Id, nPartId)
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT) local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
if vtN:getZ() < BD.NZ_MINA and nFacInd2 then if vtN:getZ() < BD.NZ_MINA and nFacInd2 then
ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT) ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT)
@@ -342,7 +341,7 @@ function ProcessDovetail.IsTailFeature( Proc, b3Raw)
end end
end end
-- deve avere la normale principale diretta verso la coda -- deve avere la normale principale diretta verso la coda
local nFacInd, dElev, nFacInd2, dElev2 = BL.GetFaceWithMostAdj( Proc, nPartId) local nFacInd, dElev, nFacInd2, dElev2 = BL.GetFaceWithMostAdj( Proc.Id, nPartId)
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT) local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
if vtN:getZ() < BD.NZ_MINA and nFacInd2 then if vtN:getZ() < BD.NZ_MINA and nFacInd2 then
ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT) ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT)
@@ -934,10 +933,10 @@ local function MachSideFaces( Proc, nPartId, b3Raw, nFacetCnt, bForceUseRough,
end end
else else
-- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa -- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa
nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc, nPartId, false, sin(dSideAngle)) nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc.Id, nPartId, false, sin(dSideAngle))
if not nFacInd or nFacInd < 0 then if not nFacInd or nFacInd < 0 then
-- provo eliminando i sottosquadra -- provo eliminando i sottosquadra
nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc, nPartId, false, -2) nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc.Id, nPartId, false, -2)
if not nFacInd or nFacInd < 0 then if not nFacInd or nFacInd < 0 then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' MachSideFaces could not find reference face' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' MachSideFaces could not find reference face'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -1190,14 +1189,14 @@ local function Make2Faces( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
return MakeByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid) return MakeByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid)
-- altrimenti provo con il truciolatore -- altrimenti provo con il truciolatore
else else
local sName = 'Mill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
-- se non ho la lavorazione esco -- se non ho la lavorazione esco
if not sMilling then if not sMilling then
local sErr = 'Error, machining or tool not found ' .. sName local sErr = 'Error, machining or tool not found ' .. sName .. '-' .. sMilling
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- inserisco la lavorazione di fresatura -- inserisco la lavorazione di fresatura
local sName = 'Mill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sName, sMilling) local nMchFId = EgtAddMachining( sName, sMilling)
if not nMchFId then if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
@@ -1433,8 +1432,7 @@ local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
return true return true
end end
-- inserisco la lavorazione -- inserisco la lavorazione
local CutProc = { Id = AuxId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, Head = Proc.Head, Tail = Proc.Tail, PartId = Proc.PartId} local CutProc = { Id = AuxId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, Head = Proc.Head, Tail = Proc.Tail}
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead) 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
-- imposto la nota nel gruppo aggiuntivo di lavorazione per evitare di tagliare una seconda volta -- imposto la nota nel gruppo aggiuntivo di lavorazione per evitare di tagliare una seconda volta
@@ -1685,7 +1683,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
end end
-- determino il massimo affondamento con l'utensile -- determino il massimo affondamento con l'utensile
local sMchFind = 'Long2Cut' local sMchFind = 'Long2Cut'
local sMilling = ML.FindMilling( sMchFind) sMilling = ML.FindMilling( sMchFind)
if not sMilling then if not sMilling then
local sErr = 'Milling not found in library : Error on Dovetail ' .. tostring( Proc.Id) local sErr = 'Milling not found in library : Error on Dovetail ' .. tostring( Proc.Id)
EgtOutLog( sErr) EgtOutLog( sErr)
+60 -319
View File
@@ -1,4 +1,4 @@
-- ProcessDrill.lua by Egaltech s.r.l. 2023/11/06 -- ProcessDrill.lua by Egaltech s.r.l. 2022/08/18
-- 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.
@@ -13,17 +13,6 @@
-- 2022/07/12 Aggiunto un valore minimo (10) per la distanza di sicurezza. -- 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/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. -- 2022/08/18 Aggiunta gestione macchine con testa da sotto e punta disabilitata.
-- 2022/10/25 Nella funzione Split aggiunto il controllo che le facce di ingresso e uscita siano differenti (potrebbe succedere per fori molto corti). Modifica importatore in futuro.
-- 2022/11/23 Aggiunta la gestione dei fori con angolo < 30 gradi, per i quali si usa la testa della macchina per accorciare l'utile di lavoro.
-- 2022/12/28 Implementata gestione forature in doppio
-- 2023/05/11 Se lavorazione in doppio e precedente no oppure di tipo diverso, forzo risalita a Zmax.
-- 2023/07/28 Aggiunta gestione rinvio 90deg solo per forature da sotto esattamente verticali.
-- 2023/09/26 Se errore in applicazione lavorazione si inverte e riprova solo se foratura singola su foro aperto.
-- 2023/11/06 Migliorata gestione dei fori con AngularTransmission.
-- 2024/03/13 Aggiunta gestione Predrill
-- 2024/03/18 Per Predrill corretta direzione estrusione per fori con direzione verso il basso
-- 2024/09/04 Gestione dipendenza foro-tasca in caso di fase con pezzo ribaltato
-- 2024/09/10 In GetData corretta gestione modifica diametro foro
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessDrill = {} local ProcessDrill = {}
@@ -37,7 +26,6 @@ EgtOutLog( ' ProcessDrill started', 1)
-- Dati -- Dati
local BD = require( 'BeamData') local BD = require( 'BeamData')
local ML = require( 'MachiningLib') local ML = require( 'MachiningLib')
local FreeContour = require( 'ProcessFreeContour')
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Riconoscimento della feature -- Riconoscimento della feature
@@ -101,22 +89,20 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Recupero dati foro e adattamento se speciale -- Recupero dati foro e adattamento se speciale
function ProcessDrill.GetData( Proc, b3Raw) function ProcessDrill.GetData( Proc, b3Raw)
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
-- verifico se foro da adattare -- verifico se foro da adattare
if EgtExistsInfo( Proc.Id, 'DiamUser') then if EgtExistsInfo( Proc.Id, 'DiamUser') then
local nNewAuxId local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if AuxId then nNewAuxId = AuxId + Proc.Id end if AuxId then AuxId = AuxId + Proc.Id end
if AuxId and EgtGetType( nNewAuxId) == GDB_TY.CRV_ARC and BD.USER_HOLE_DIAM and BD.USER_HOLE_DIAM > 1 then if AuxId and EgtGetType( AuxId) == GDB_TY.CRV_ARC and BD.USER_HOLE_DIAM and BD.USER_HOLE_DIAM > 1 then
EgtModifyArcRadius( nNewAuxId, BD.USER_HOLE_DIAM / 2) EgtModifyArcRadius( AuxId, BD.USER_HOLE_DIAM / 2)
end end
end end
-- recupero diametro e lunghezza -- recupero diametro
local dDiam = EgtGetInfo( Proc.Id, 'P12', 'd') or 0 local dDiam = EgtGetInfo( Proc.Id, 'P12', 'd') or 0
local dLen = abs( EgtCurveThickness( Proc.Id + AuxId)) or 0
-- recupero faccia di entrata e uscita -- recupero faccia di entrata e uscita
local nFcs = EgtGetInfo( Proc.Id, 'FCS', 'i') or 0 local nFcs = EgtGetInfo( Proc.Id, 'FCS', 'i') or 0
local nFce = EgtGetInfo( Proc.Id, 'FCE', 'i') or 0 local nFce = EgtGetInfo( Proc.Id, 'FCE', 'i') or 0
return dDiam, dLen, nFcs, nFce return dDiam, nFcs, nFce
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
@@ -132,94 +118,22 @@ function ProcessDrill.Split( Proc, b3Raw)
local dDiam = 2 * EgtArcRadius( AuxId) local dDiam = 2 * EgtArcRadius( AuxId)
local dLen = abs( EgtCurveThickness( AuxId)) local dLen = abs( EgtCurveThickness( AuxId))
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
local bOpen = ( Proc.Fce ~= 0) and ( Proc.Fce ~= Proc.Fcs) local bOpen = ( Proc.Fce ~= 0)
-- recupero flag abilitazione split (0=auto,1=no) -- recupero flag abilitazione split (0=auto,1=no)
local bTrySplit = ( EgtGetInfo( Proc.Id, 'Q02', 'i') ~= 1) local bTrySplit = ( EgtGetInfo( Proc.Id, 'Q02', 'i') ~= 1)
local bOnlyContour = ( EgtGetInfo( Proc.Id, 'Q04', 'i') == 1) if not bTrySplit then
if ( not bTrySplit) or bOnlyContour then
return false return false
end end
-- restituisco se va fatto in doppio (solo fori orizzontali) -- restituisco se va fatto in doppio (solo fori orizzontali)
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 bAngTransm = ( BD.ANG_TRASM and ML.FindDrilling( dDiam, nil, nil, nil, nil, true) and AreSameOrOppositeVectorApprox( vtExtr, Z_AX()))
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 or bAngTransm) and not bSlant) return ( bOpen and ( bHoriz or BD.ROT90 or BD.DOWN_HEAD or BD.TURN) and not bSlant)
end
---------------------------------------------------------------------
-- Verifica se bisogna aggiungere un preforo
function ProcessDrill.IsPredrillNeeded( Proc)
local dDepthPredrill = EgtGetInfo( Proc.Id, 'Q03', 'i')
-- se non c'è la Q oppure se zero, allora non è da fare
if not dDepthPredrill or dDepthPredrill <= 0 then
return false
-- altrimenti Predrill da fare
else
return true
end
end
---------------------------------------------------------------------
-- Aggiunge il preforo alla feature passata
function ProcessDrill.AddPredrillFromDrillProc( Proc)
local dDepthPredrill = EgtGetInfo( Proc.Id, 'Q03', 'i')
-- foro più corto del preforo, allora è il foro che diventa il preforo stesso
if Proc.Len <= dDepthPredrill then
Proc.IsPredrill = true
Proc.IsPredrillOf = Proc.Id
return false
-- altrimenti creo un nuovo process
else
-- recupero gruppo per geometria aggiuntiva
local nAddGrpId = BL.GetAddGroup( Proc.PartId)
-- recupero e verifico l'entità foro
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
local ptCen = EgtCP( Proc.Id + AuxId, GDB_RT.GLOB)
local vtExtr = EgtCurveExtrusion( Proc.Id + AuxId, GDB_RT.GLOB)
-- copio foro originale
local nPreHoleId = EgtCopyGlob( Proc.Id, nAddGrpId)
local nPreHoleAux = EgtCopyGlob( Proc.Id + AuxId, nAddGrpId)
-- se foro invertito sposto geometria dall'altro lato del foro e inverto direzione estrusione
if Proc.Flg == -2 then
local vsExtr = -vtExtr * Proc.Len
EgtMove( nPreHoleAux, vsExtr, GDB_RT.GLOB)
EgtModifyCurveExtrusion( nPreHoleAux, -vtExtr, GDB_RT.GLOB)
end
EgtModifyCurveThickness( nPreHoleAux, -dDepthPredrill)
local PredrillProc = {}
-- definisco dati seconda parte
PredrillProc.PartId = Proc.PartId
PredrillProc.Id = nPreHoleId
PredrillProc.Grp = Proc.Grp
PredrillProc.Prc = Proc.Prc
PredrillProc.Flg = 1
PredrillProc.Box = Proc.Box
PredrillProc.Fct = Proc.Fct
PredrillProc.Diam = Proc.Diam
PredrillProc.Len = dDepthPredrill
PredrillProc.Head = Proc.Head
PredrillProc.Tail = Proc.Tail
PredrillProc.Fcs = Proc.Fcs
PredrillProc.Fce = 0 -- il preforo è sempre chiuso, non ha faccia di uscita
PredrillProc.CutId = Proc.CutId
PredrillProc.TaskId = Proc.TaskId
PredrillProc.AdjId = Proc.AdjId
PredrillProc.MainId = Proc.MainId
PredrillProc.IsPredrill = true
PredrillProc.IsPredrillOf = Proc.Id
-- recupero l'elenco delle facce della parte interessate dalla feature
PredrillProc.AffectedFaces = BL.GetProcessAffectedFaces( PredrillProc)
return true, PredrillProc
end
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Classificazione della feature -- Classificazione della feature
function ProcessDrill.Classify( Proc, b3Raw, sDownOrSideOrStd) function ProcessDrill.Classify( Proc, b3Raw)
-- recupero e verifico l'entità foro -- recupero e verifico l'entità foro
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0 local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
if AuxId then AuxId = AuxId + Proc.Id end if AuxId then AuxId = AuxId + Proc.Id end
@@ -238,45 +152,18 @@ function ProcessDrill.Classify( Proc, b3Raw, sDownOrSideOrStd)
ptCen = ptCen + vtExtr * dLen ptCen = ptCen + vtExtr * dLen
end end
end end
-- verifico se foro annegato nel pezzo e quindi non lavorabile
if Proc.Fcs == 0 and Proc.Fce == 0 then
return false, false, false
end
-- verifico se troppo inclinato e quindi non lavorabile -- verifico se troppo inclinato e quindi non lavorabile
if not ( Proc.Fcs == 5 or Proc.Fcs == 6 or Proc.Fce == 5 or Proc.Fce == 6) and abs( vtExtr:getX()) > BD.DRILL_VX_MAX then if not ( Proc.Fcs == 5 or Proc.Fcs == 6 or Proc.Fce == 5 or Proc.Fce == 6) and abs( vtExtr:getX()) > BD.DRILL_VX_MAX then
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 abs( 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 or BD.TURN) and ( Proc.Flg == 2 or Proc.Flg == -2))))
local bAngTransm = ( BD.ANG_TRASM and ML.FindDrilling( dDiam, nil, nil, nil, nil, true) and AreSameOrOppositeVectorApprox( vtExtr, Z_AX()))
-- se ci sono delle dipendenze da altre feature da rispettare
if sDownOrSideOrStd then
if sDownOrSideOrStd == 'DOWN' then
-- se foro fatto in doppio entrambe le forature (valore assoluto) devono essere sopra al valore limite, se foro singolo deve essere sopra al valore limite se ribaltato
if ( abs( Proc.Flg) == 2 and ( abs( vtExtr:getZ()) < - BD.DRILL_VZ_MIN) or ( abs( Proc.Flg) ~= 2 and vtExtr:getZ() < - BD.DRILL_VZ_MIN)) then
-- in doppio non cambio di fase al foro perchè devo garantire il lato master su H1
if not( Proc.Double) or Proc.Double == 0 then
Proc.Down = true
Proc.Side = false
end
return true
end
end
return false
end
-- 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
-- se da sotto e presente rinvio angolare verifico se c'è opportuna lavorazione return true, true, false
if bAngTransm then
return true, false, false
else
return true, true, false
end
else else
return true, not ( BD.ROT90 or BD.DOWN_HEAD or BD.TURN or bAngTransm), ( BD.ROT90 or BD.DOWN_HEAD or BD.TURN) return true, not ( BD.ROT90 or BD.DOWN_HEAD or BD.TURN), ( BD.ROT90 or BD.DOWN_HEAD or BD.TURN)
end end
else else
return true, false, false return true, false, false
@@ -315,39 +202,9 @@ local function GetHoleStartData( ptCen, vtExtr, b3Solid)
return nFac, CosB, vFaces return nFac, CosB, vFaces
end end
---------------------------------------------------------------------
local function GetSCC( Proc, vtExtr, b3Solid, bDrillAngTrasm, nPhase)
local nSCC = MCH_SCC.NONE
if bDrillAngTrasm then
nSCC = MCH_SCC.ADIR_NEAR
elseif BD.TURN == 2 then
nSCC = MCH_SCC.ADIR_ZP
elseif not BD.C_SIMM and not BD.TURN then
nSCC = MCH_SCC.ADIR_YM
if AreSameVectorApprox( vtExtr, Z_AX()) then
nSCC = MCH_SCC.ADIR_YM
elseif abs( vtExtr:getX()) < 0.1 then
local bNearTail = ( Proc.Box:getCenter():getX() < b3Solid:getCenter():getX() and Proc.Box:getCenter():getX() - b3Solid:getMin():getX() < 1000)
local bVeryShortPart = ( BD.LEN_VERY_SHORT_PART and b3Solid:getDimX() < BD.LEN_VERY_SHORT_PART)
nSCC = EgtIf( BL.IsPartFinalPhase( nPhase) or ( bNearTail and not bVeryShortPart), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
elseif vtExtr:getY() > 0.1 then
nSCC = MCH_SCC.ADIR_YP
end
else
nSCC = MCH_SCC.NONE
end
return nSCC
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
-- Se forzato contorno foro forzo richiamo a FreeContour e uscita dalla funzione
if EgtGetInfo( Proc.Id, 'Q04', 'i') == 1 then
return FreeContour.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end
-- default per costanti -- default per costanti
BD.DRILL_VX_MAX_ANGLEDRILL = ( BD.DRILL_VX_MAX_ANGLEDRILL or 0.928) BD.DRILL_VX_MAX_ANGLEDRILL = ( BD.DRILL_VX_MAX_ANGLEDRILL or 0.928)
-- ingombro del pezzo -- ingombro del pezzo
@@ -376,22 +233,19 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end 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 -- verifico possibilità di foratura da sotto
local bDownDrill = ( BD.TURN or ( BD.DOWN_HEAD and ML.FindDrilling( dDiam, nil, false, true))) local bDownDrill = ( BD.DOWN_HEAD and ML.FindDrilling( dDiam, nil, false, true))
-- se presente rinvio angolare
local bDrillAngTrasm = ( BD.ANG_TRASM and ML.FindDrilling( dDiam, nil, nil, nil, nil, true) and AreOppositeVectorApprox( vtExtr, Z_AX()))
-- 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 and not bDrillAngTrasm) local bToInvert = ( vtExtr:getZ() < BD.DRILL_VZ_MIN and not bDownDrill)
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
local nFac, CosB
-- se non già richiesta inversione e invertibile -- se non già richiesta inversione e invertibile
if not bToInvert and Proc.Flg == 1 and -vtExtr:getZ() >= BD.DRILL_VZ_MIN then if not bToInvert and Proc.Flg == 1 and ( -vtExtr:getZ() >= BD.DRILL_VZ_MIN or bDownDrill) then
-- se il foro è cieco o dalla faccia sotto o troppo inclinato all'inizio, lo inverto -- se il foro è cieco o troppo inclinato all'inizio, lo inverto
nFac, CosB, _ = GetHoleStartData( ptCen, vtExtr, b3Solid) local _, CosB, _ = GetHoleStartData( ptCen, vtExtr, b3Solid)
if Proc.Fcs == 0 or (( nFac == 2 or CosB > BD.DRILL_VX_MAX) and bOpen) then if Proc.Fcs == 0 or ( CosB > BD.DRILL_VX_MAX and bOpen) then
bToInvert = true bToInvert = true
end end
end end
@@ -412,38 +266,12 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
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 = ( bDownDrill and ( Proc.Down or vtExtr:getZ() < -0.1 or vtExtr:getZ() < 0.259))
local bDrillUp = ( bDownDrill and vtExtr:getZ() > -0.421) local bDrillUp = ( bDownDrill and vtExtr:getZ() > -0.5)
local bExcludeH2 = false
if Proc.Double and Proc.Double > 0 then
-- bMillUp = true
bDrillDown = false
bExcludeH2 = true
end
-- primo gruppo di controlli con lunghezza utensile pari a metà foro se passante -- primo gruppo di controlli con lunghezza utensile pari a metà foro se passante
-- recupero la lavorazione -- recupero la lavorazione
local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm, Proc.IsPredrill) local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown)
local dMaxDepthOri
local vFaces
if sDrilling then
-- Determino la faccia di inizio del foro e dati correlati
nFac, CosB, vFaces = GetHoleStartData( ptCen, vtExtr, b3Solid)
-- Calcolo acciorciamento affondamento utile per evitare collisione portautensile con faccia
local TgA = CosB / sqrt( 1 - CosB * CosB)
local dSubL = ( dDiamTh / 2 + ( Proc.Diam - dToolDiam) / 2 + 4) * TgA
-- Per fori molto inclinati ( < 30 gradi) si usa la testa della macchina per l'accorciamento. Fast esclusa
if BD.C_SIMM and CosB > 0.866 then
dSubL = ( 190 / 2 + ( Proc.Diam - dToolDiam) / 2 + 4) * TgA - 116
end
dMaxDepthOri = dMaxDepth
dMaxDepth = min( dMaxDepth, max( dToolFreeLen - dSubL, 0))
-- se utensile scelto non arriva in fondo, cerco il più lungo
if dMaxDepth < GEO.EPS_SMALL * 10 then
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm, Proc.IsPredrill, nil, 'Longest')
end
end
if not sDrilling and dCheckDepth then if not sDrilling and dCheckDepth then
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm, Proc.IsPredrill) sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown)
if sDrilling then dCheckDepth = nil end if sDrilling then dCheckDepth = nil end
end end
if not sDrilling then if not sDrilling then
@@ -536,44 +364,15 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- eventuale inversione foro in base al lato di lavoro e al lato testa dell'utensile scelto
-- se non già richiesta inversione e foro quasi orizzontale (15deg) passante
if not bToInvert and Proc.Flg == 1 and bOpen and abs( vtExtr:getZ()) < 0.259 and abs( vtExtr:getY()) > 0.966 then
local Tool = BL.GetToolFromMachining( sDrilling)
-- lato testa e lato di lavoro devono corrispondere
if Tool.PreferredSide then
if ( ( Tool.PreferredSide.bFront == true) and vtExtr:getY() > 10 * GEO.EPS_SMALL)
or ( ( Tool.PreferredSide.bBack == true) and vtExtr:getY() < - 10 * GEO.EPS_SMALL) then
ptCen = ptCen - vtExtr * dLen
vtExtr = - vtExtr
bToInvert = true
end
end
end
-- Determino la faccia di inizio del foro e dati correlati -- Determino la faccia di inizio del foro e dati correlati
nFac, CosB, vFaces = GetHoleStartData( ptCen, vtExtr, b3Solid) local nFac, CosB, vFaces = GetHoleStartData( ptCen, vtExtr, b3Solid)
-- Calcolo acciorciamento affondamento utile per evitare collisione portautensile con faccia -- Calcolo acciorciamento affondamento utile per evitare collisione portautensile con faccia
TgA = CosB / sqrt( 1 - CosB * CosB) local TgA = CosB / sqrt( 1 - CosB * CosB)
dSubL = ( dDiamTh / 2 + ( Proc.Diam - dToolDiam) / 2 + 4) * TgA local dSubL = ( dDiamTh / 2 + ( Proc.Diam - dToolDiam) / 2 + 2) * TgA
-- Per fori molto inclinati ( < 30 gradi) si usa la testa della macchina per l'accorciamento. Fast esclusa local dMaxDepthOri = dMaxDepth
if BD.C_SIMM and CosB > 0.866 then dMaxDepth = min( dMaxDepth, dToolFreeLen - dSubL)
dSubL = ( 190 / 2 + ( Proc.Diam - dToolDiam) / 2 + 4) * TgA - 116
end
dMaxDepthOri = dMaxDepth
dMaxDepth = min( dMaxDepth, max( dToolFreeLen - dSubL, 0))
-- Verifico inclinazione foro nei limiti -- Verifico inclinazione foro nei limiti
local bTryDrill = EgtIf( dMaxDepth > 0, ( CosB < BD.DRILL_VX_MAX), false) local bTryDrill = ( CosB < BD.DRILL_VX_MAX)
-- se il foro deve essere eseguito dopo un taglio, potrebbe essere perchè il taglio crea una superficie perpendicolare
if Proc.Dependency and Proc.Dependency.ExecAfter then
local ptCut, vtCutN = EgtSurfTmFacetCenter( Proc.Dependency.ExecAfter.Id, 0, GDB_ID.ROOT)
local dMaxAngleDrillOnCut = BD.MAX_ANGLE_DRILL_CUT or 10
local dAngle = GetAngle( vtExtr, vtCutN)
CosB = cos( dAngle)
if dAngle < dMaxAngleDrillOnCut then
-- controllo di essere nei limiti
bTryDrill = true
end
end
if ( CosB > 0.8 * BD.DRILL_VX_MAX and CosB < BD.DRILL_VX_MAX_ANGLEDRILL) then if ( CosB > 0.8 * BD.DRILL_VX_MAX and CosB < BD.DRILL_VX_MAX_ANGLEDRILL) then
-- cerco le forature speciali AngleDrill -- cerco le forature speciali AngleDrill
local sDrilling3, sType3, dMaxDepth3 = ML.FindAngleDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown) local sDrilling3, sType3, dMaxDepth3 = ML.FindAngleDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown)
@@ -588,12 +387,12 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local dMaxElev local dMaxElev
local sMyWarn local sMyWarn
-- se c'è un taglio precedente di testa o coda in cui il foro "entra" devo ricalcolare i dati della foratura -- se c'è un taglio precedente di testa o coda in cui il foro "entra" devo ricalcolare i dati della foratura
if ( not Proc.Double or Proc.Double == 0) and(( Proc.MachineAfterHeadCutId and vtExtr:getX() > 0) or ( Proc.MachineAfterTailCutId and vtExtr:getX() < 0)) then if (( Proc.MachineAfterHeadCutId and vtExtr:getX() > 0) or ( Proc.MachineAfterTailCutId and vtExtr:getX() < 0)) then
local bIntersectionOk, _, vDistance = EgtLineSurfTmInters( ptCen, -vtExtr, Proc.MachineAfterHeadCutId or Proc.MachineAfterTailCutId, GDB_RT.GLOB) local bIntersectionOk, _, vDistance = EgtLineSurfTmInters( ptCen, -vtExtr, Proc.MachineAfterHeadCutId or Proc.MachineAfterTailCutId, GDB_RT.GLOB)
if bIntersectionOk then if bIntersectionOk then
local dHoleToCutDistance = vDistance[1] local dHoleToCutDistance = vDistance[1]
-- se il taglio accorcia realmente il foro -- se il taglio accorcia realmente il foro
if ( dHoleToCutDistance > 10 * GEO.EPS_SMALL or Proc.AffectedFaces.Right) and dHoleToCutDistance < dLen then if dHoleToCutDistance > 10 * GEO.EPS_SMALL and dHoleToCutDistance < dLen then
dMaxDepth = dMaxDepthOri dMaxDepth = dMaxDepthOri
dMaxElev = dLen - dHoleToCutDistance dMaxElev = dLen - dHoleToCutDistance
bTryDrill = true bTryDrill = true
@@ -613,7 +412,6 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
end end
end end
local dDepthOri = dDepth
-- se foro da saltare per eccessiva inclinazione -- se foro da saltare per eccessiva inclinazione
if not bTryDrill then if not bTryDrill then
sMyWarn = 'Warning in drill : too slant hole' sMyWarn = 'Warning in drill : too slant hole'
@@ -625,9 +423,8 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
dDepth = dMaxDepth dDepth = dMaxDepth
dMaxElev = dMaxDepth dMaxElev = dMaxDepth
end end
-- inserisco la lavorazione -- inserisco la lavorazione
local sName = EgtIf( EgtStartsWith( sType, 'Predrill'), 'Predrill_', 'Drill_') .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local sName = 'Drill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sDrilling) local nMchId = EgtAddMachining( sName, sDrilling)
if not nMchId then if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sDrilling local sErr = 'Error adding machining ' .. sName .. '-' .. sDrilling
@@ -636,73 +433,56 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}}) EgtSetMachiningGeometry( {{ AuxId, -1}})
-- eventuali note utente
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or ''
-- eventuale inversione -- eventuale inversione
if sType == 'Drill' or sType == 'Drill_H2' or sType == 'Drill_AT' or sType == 'AngleDrill' or sType == 'Predrill' then if sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill' then
EgtSetMachiningParam( MCH_MP.INVERT, bToInvert) EgtSetMachiningParam( MCH_MP.INVERT, bToInvert)
else else
EgtSetMachiningParam( MCH_MP.TOOLINVERT, bToInvert) EgtSetMachiningParam( MCH_MP.TOOLINVERT, bToInvert)
end end
-- imposto posizione braccio porta testa -- imposto posizione braccio porta testa
local nSCC = GetSCC( Proc, vtExtr, b3Solid, bDrillAngTrasm, nPhase) local nSCC = MCH_SCC.NONE
if not BD.C_SIMM and not BD.TURN then
nSCC = MCH_SCC.ADIR_YM
if AreSameVectorApprox( vtExtr, Z_AX()) then
nSCC = MCH_SCC.ADIR_YM
elseif abs( vtExtr:getX()) < 0.1 then
local bNearTail = ( Proc.Box:getCenter():getX() < b3Solid:getCenter():getX() and Proc.Box:getCenter():getX() - b3Solid:getMin():getX() < 1000)
local bVeryShortPart = ( BD.LEN_VERY_SHORT_PART and b3Solid:getDimX() < BD.LEN_VERY_SHORT_PART)
nSCC = EgtIf( BL.IsPartFinalPhase( nPhase) or ( bNearTail and not bVeryShortPart), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
elseif vtExtr:getY() > 0.1 then
nSCC = MCH_SCC.ADIR_YP
end
else
nSCC = MCH_SCC.NONE
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- imposto affondamento -- imposto affondamento
local dLastStepDepth
if Proc.Double and Proc.Double > 0 then
if ( sType == 'Pocket_AT' or sType == 'Pocket') then
if bOpen then
local dReduceDepth = MIRROR_POCKETS_MIN_DISTANCE / 2 + 10
dLastStepDepth = dDepth + dReduceDepth
dDepth = dDepth - dReduceDepth
if ( dLastStepDepth > dMaxDepth + 10 * GEO.EPS_SMALL) and ( dMaxDepth <= ( dLen / 2) - dReduceDepth) and ( dDepthOri ~= dDepth) then
dDepth = dMaxDepth
end
end
else
sUserNotes = EgtSetValInNotes( sUserNotes, 'LastStep', MIRROR_DRILLINGS_MIN_DISTANCE / 2 + 15)
end
if dDepth > Proc.MachDepthDouble + 10 * GEO.EPS_SMALL then
sMyWarn = 'Warning in double head drilling : depth (' .. EgtNumToString( dDepth, 1) .. ') reduced to (' .. EgtNumToString( Proc.MachDepthDouble, 1) .. ') to match H2 max tool depth'
dDepth = Proc.MachDepthDouble
dMaxElev = Proc.MachDepthDouble
end
end
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- imposto il valore della distanza di sicurezza per l'attacco. Se il valore del db utensili è troppo basso lo alzo a 10. -- imposto il valore della distanza di sicurezza per l'attacco. Se il valore del db utensili è troppo basso lo alzo a 10.
local dToolDbStartPos = EgtGetMachiningParam( MCH_MP.STARTPOS) local dToolDbStartPos = EgtGetMachiningParam( MCH_MP.STARTPOS)
local dMinStartPos = 10 local dMinStartPos = 10
local dStartPos = max( dMinStartPos, dToolDbStartPos) local dStartPos = max( dMinStartPos, dToolDbStartPos)
EgtSetMachiningParam( MCH_MP.STARTPOS, dStartPos) EgtSetMachiningParam( MCH_MP.STARTPOS, dStartPos)
-- dichiarazione nessuna generazione sfridi per Vmill -- Note utente con dichiarazione nessuna generazione sfridi per Vmill
sUserNotes = EgtSetValInNotes( sUserNotes, 'VMRS', 0) local sUserNotes = 'VMRS=0;'
-- aggiungo alle note massima elevazione (coincide con affondamento) -- aggiungo alle note massima elevazione (coincide con affondamento)
local dCustomMaxElev if dMaxElev then
if Proc.dCustomMaxElev and type( Proc.dCustomMaxElev) == "number" and Proc.dCustomMaxElev > 10 * GEO.EPS_SMALL then sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( dMaxElev, 1) .. ';'
dCustomMaxElev = Proc.dCustomMaxElev
end
if dMaxElev or dCustomMaxElev then
if dCustomMaxElev then
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dCustomMaxElev, 1))
else
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dMaxElev, 1))
end
end end
-- se foro passante, aggiungo questa qualifica alle note -- se foro passante, aggiungo questa qualifica alle note
if ( sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill') and bOpen then if ( sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill') and bOpen then
sUserNotes = EgtSetValInNotes( sUserNotes, 'Open', 1) sUserNotes = sUserNotes .. 'Open=1;'
end end
-- se lavorazione in doppio -- se lavorazione in doppio
if Proc.Double and Proc.Double > 0 then if EgtExistsInfo( Proc.Id, 'MAIN') then
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double) sUserNotes = sUserNotes .. 'Double;'
if Proc.Double ~= Proc.PrevDouble then elseif EgtExistsInfo( Proc.Id, 'DOU') then
sUserNotes = EgtSetValInNotes( sUserNotes, 'StartZmax', 2) sUserNotes = sUserNotes .. 'Main;'
end
end end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
local bOk = ML.ApplyMachining( true, false) local bOk = ML.ApplyMachining( true, false)
if not bOk and bDownDrill and bOpen and abs( Proc.Flg) == 1 then if not bOk and bDownDrill then
if sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill' then if sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill' then
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
else else
@@ -712,7 +492,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
if not bOk then if not bOk then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
else else
local _, sWarn = EgtGetMachMgrWarning( 0) local _, sWarn = EgtGetMachMgrWarning( 0)
@@ -720,45 +500,6 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sWarn return false, sWarn
else else
-- se DrillPocket passante in doppio si fa lavorazione aggiuntiva dell'ultimo step
if Proc.Double and Proc.Double > 0 and ( sType == 'Pocket_AT' or sType == 'Pocket') and bOpen then
if dLastStepDepth > dMaxDepth + 10 * GEO.EPS_SMALL then
sMyWarn = 'Warning in drill pocket last step: depth (' .. EgtNumToString( dLastStepDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
return false, sMyWarn
end
local idMachiningLastStep = EgtCopyMachining( EgtIf( EgtStartsWith( sType, 'Predrill'), 'Predrill_', 'Drill_') .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)), sName)
EgtSetCurrMachining( idMachiningLastStep)
local dMaxElevLastStep = dLastStepDepth - dDepth
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dMaxElevLastStep, 1))
EgtSetMachiningParam( MCH_MP.DEPTH, dLastStepDepth)
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', '')
sUserNotes = EgtSetValInNotes( sUserNotes, 'StartZmax', '')
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
local bOkLastStep = ML.ApplyMachining( true, false)
if not bOkLastStep and bDownDrill and bOpen and abs( Proc.Flg) == 1 then
if sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill' then
EgtSetMachiningParam( MCH_MP.INVERT, true)
else
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
end
bOkLastStep = ML.ApplyMachining( true, false)
end
if not bOkLastStep then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
local _, sWarnLastStep = EgtGetMachMgrWarning( 0)
if not bOkLastStep then
sWarnLastStep = 'Drillpocket double : incomplete, last step missing'
end
local sPreviousWarn = sMyWarn or sWarn
if sWarnLastStep then
if not sPreviousWarn then sPreviousWarn = '' end
sMyWarn = EgtIf( #sPreviousWarn > 0, sPreviousWarn .. '\n' .. sWarnLastStep, sWarnLastStep)
end
end
end
return true, ( sMyWarn or sWarn) return true, ( sMyWarn or sWarn)
end end
end end
+117 -354
View File
@@ -1,4 +1,4 @@
-- ProcessDtMortise.lua by Egaltech s.r.l. 2023/05/11 -- ProcessDtMortise.lua by Egaltech s.r.l. 2022/08/18
-- 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.
@@ -7,11 +7,6 @@
-- 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/06/01 Modifiche per evitare di entrare nel legno con mortase parziali.
-- 2022/08/18 Migliorato calcolo dello step. -- 2022/08/18 Migliorato calcolo dello step.
-- 2022/09/29 Aggiunto riconoscimento della sola feature laterale.
-- 2022/12/28 Aggiunta gestione lavorazione in doppio.
-- 2023/03/06 Aggiunta forzatura ingresso fuori dal grezzo con pocket.
-- 2023/03/28 Corretto calcolo larghezza mortasa quando più larga che lunga.
-- 2023/05/11 Se lavorazione in doppio e precedente no oppure di tipo diverso, forzo risalita a Zmax.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessDtMortise = {} local ProcessDtMortise = {}
@@ -20,7 +15,6 @@ local ProcessDtMortise = {}
require( 'EgtBase') require( 'EgtBase')
local BL = require( 'BeamLib') local BL = require( 'BeamLib')
local Cut = require( 'ProcessCut') local Cut = require( 'ProcessCut')
local Probe = require( 'ProcessProbing')
EgtOutLog( ' ProcessDtMortise started', 1) EgtOutLog( ' ProcessDtMortise started', 1)
@@ -39,35 +33,12 @@ function ProcessDtMortise.Identify( Proc)
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 56)) (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 56))
end end
---------------------------------------------------------------------
-- Riconoscimento della sola feature laterale
function ProcessDtMortise.SideIdentify( Proc)
return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 55)
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Riconoscimento della sola feature frontale -- Riconoscimento della sola feature frontale
function ProcessDtMortise.FrontIdentify( Proc) function ProcessDtMortise.FrontIdentify( Proc)
return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 56) return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 56)
end end
---------------------------------------------------------------------
-- Riconoscimento della feature profonda, non sulla faccia della trave
function ProcessDtMortise.IsDeeper( Proc, b3Raw)
-- recupero i dati della curva di contorno della faccia di fondo
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if not AuxId then return false end
AuxId = AuxId + Proc.Id
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
if ( AreSameVectorApprox( vtExtr, -Y_AX()) and Proc.Box:getMin():getY() > b3Raw:getMin():getY() + 100 * GEO.EPS_SMALL) or
( AreSameVectorApprox( vtExtr, Y_AX()) and Proc.Box:getMax():getY() < b3Raw:getMax():getY() - 100 * GEO.EPS_SMALL) or
( AreSameVectorApprox( vtExtr, -Z_AX()) and Proc.Box:getMin():getZ() > b3Raw:getMin():getZ() + 100 * GEO.EPS_SMALL) or
( AreSameVectorApprox( vtExtr, Z_AX()) and Proc.Box:getMax():getZ() < b3Raw:getMax():getZ() - 100 * GEO.EPS_SMALL) then
return true
end
return false
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Verifica se feature di coda -- Verifica se feature di coda
function ProcessDtMortise.IsTailFeature( Proc, b3Raw) function ProcessDtMortise.IsTailFeature( Proc, b3Raw)
@@ -121,7 +92,7 @@ function ProcessDtMortise.GetCutPlane( Proc)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function CalcPathAtHeight( nProcId, AuxId, nAddGrpId, dHeight, dSideAng, b3Solid) local function CalcTopPath( nProcId, AuxId, nAddGrpId, dAltMort, dSideAng, b3Solid)
-- copio la curva di base -- copio la curva di base
local NewAuxId = EgtCopyGlob( AuxId, nAddGrpId) local NewAuxId = EgtCopyGlob( AuxId, nAddGrpId)
if not NewAuxId then return end if not NewAuxId then return end
@@ -129,18 +100,16 @@ local function CalcPathAtHeight( nProcId, AuxId, nAddGrpId, dHeight, dSideAng, b
EgtAddCurveCompoLineTg( NewAuxId, 100, false) EgtAddCurveCompoLineTg( NewAuxId, 100, false)
EgtAddCurveCompoLineTg( NewAuxId, 100, true) EgtAddCurveCompoLineTg( NewAuxId, 100, true)
EgtMergeCurvesInCurveCompo( NewAuxId) EgtMergeCurvesInCurveCompo( NewAuxId)
local dOffset = dHeight * tan( dSideAng) -- eseguo traslazione e offset per portarla sul top
local vtMove = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) * ( dAltMort - 10 * GEO.EPS_SMALL)
EgtMove( NewAuxId, vtMove, GDB_RT.GLOB)
local dOffset = dAltMort * tan( dSideAng)
if not EgtOffsetCurve( NewAuxId, dOffset) then return end if not EgtOffsetCurve( NewAuxId, dOffset) then return end
-- la limito entro la trave -- la limito entro la trave
local refBox = Frame3d( b3Solid:getMin()) local refBox = Frame3d( b3Solid:getMin())
local vtBoxDiag = b3Solid:getMax() - b3Solid:getMin() local vtBoxDiag = b3Solid:getMax() - b3Solid:getMin()
local nCount local nCount
NewAuxId, nCount = EgtTrimFlatCurveWithBox( NewAuxId, refBox, vtBoxDiag, true, true, GDB_RT.GLOB) NewAuxId, nCount = EgtTrimFlatCurveWithBox( NewAuxId, refBox, vtBoxDiag, true, true, GDB_RT.GLOB)
-- per ogni curva creata, eseguo traslazione e offset per portarla sul top
local vtMove = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) * ( dHeight - 10 * GEO.EPS_SMALL)
for i = 1, nCount do
EgtMove( NewAuxId + i - 1, vtMove, GDB_RT.GLOB)
end
-- se divisa in più parti, le unisco congiungendole con segmenti -- se divisa in più parti, le unisco congiungendole con segmenti
if nCount > 1 then if nCount > 1 then
if EgtGetType( NewAuxId) ~= GDB_TY.CRV_COMPO then if EgtGetType( NewAuxId) ~= GDB_TY.CRV_COMPO then
@@ -149,30 +118,13 @@ local function CalcPathAtHeight( nProcId, AuxId, nAddGrpId, dHeight, dSideAng, b
for i = 2, nCount do for i = 2, nCount do
local CrvId = NewAuxId + i - 1 local CrvId = NewAuxId + i - 1
local ptStart = EgtSP( CrvId) local ptStart = EgtSP( CrvId)
EgtAddCurveCompoLine( NewAuxId, ptStart) EgtAddCurveCompoLine( NewAuxId, ptStart)
EgtAddCurveCompoCurve( NewAuxId, CrvId) EgtAddCurveCompoCurve( NewAuxId, CrvId)
end end
end end
return NewAuxId return NewAuxId
end end
---------------------------------------------------------------------
local function GetVerticalSteps( dMachiningDepth, dStep )
local MachiningSteps = {}
MachiningSteps.StepLength = 0
if dMachiningDepth <= 0 then
MachiningSteps.Count = 0
return MachiningSteps
end
MachiningSteps.Count = ceil( (dMachiningDepth - 10 * GEO.EPS_SMALL) / dStep )
MachiningSteps.StepLength = dMachiningDepth / MachiningSteps.Count
return MachiningSteps
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- verifica che il box includa il punto in XY -- verifica che il box includa il punto in XY
function EnclosesPoint( b3Box, ptP) function EnclosesPoint( b3Box, ptP)
@@ -191,8 +143,6 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local sWarn
bMakeAntiSplitPath = true
-- ingombro del pezzo -- ingombro del pezzo
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then if not b3Solid then
@@ -218,21 +168,16 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- ne determino l'asse
local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB)
vtAx:normalize()
-- 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, dLenMrt, dWidthMrt = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0, GDB_RT.GLOB)
if abs( rfDtMrt:getVersY() * vtAx) > abs( rfDtMrt:getVersX() * vtAx) then
rfDtMrt:rotate( rfDtMrt:getOrigin(), rfDtMrt:getVersZ(), 90)
dLenMrt, dWidthMrt = dWidthMrt, dLenMrt
end
local b3DtMrt = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, rfDtMrt) local b3DtMrt = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, rfDtMrt)
local dAltMort = b3DtMrt:getDimZ() local dAltMort = b3DtMrt:getDimZ()
-- verifico se di tipo pocket o se antischeggia disabilitato -- 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
local bPocket = ( EgtGetInfo( Proc.Id, 'P05', 'i') == 1) local bPocket = ( EgtGetInfo( Proc.Id, 'P05', 'i') == 1)
local bDisableAntiSplint = ( EgtGetInfo( Proc.Id, 'Q01', 'i') or 0) == 1 if bPocket then bMakeAntiSplitPath = false end
if bPocket or bDisableAntiSplint then bMakeAntiSplitPath = false end
-- verifico se frontale -- verifico se frontale
local bFront = ( Proc.Prc == 56) local bFront = ( Proc.Prc == 56)
-- se mortasa di fronte, eseguo il taglio della faccia -- se mortasa di fronte, eseguo il taglio della faccia
@@ -250,8 +195,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptCutC, vtCutN, b3Solid, GDB_RT.GLOB) local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptCutC, vtCutN, b3Solid, GDB_RT.GLOB)
local b3Cut = EgtGetBBoxGlob( AddId or GDB_ID.NULL, GDB_BB.STANDARD) local b3Cut = EgtGetBBoxGlob( AddId or GDB_ID.NULL, GDB_BB.STANDARD)
local CutProc = { Id = AddId, Grp = Proc.Grp - 2, Prc = 10, Box = b3Cut, Fct = 1, Flg = Proc.Flg, local CutProc = { Id = AddId, Grp = Proc.Grp - 2, Prc = 10, Box = b3Cut, Fct = 1, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId} Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
local bFromBottom = ( b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getZ() > 0.25) local bFromBottom = ( b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getZ() > 0.25)
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH, bFromBottom) local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH, bFromBottom)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
@@ -281,17 +225,10 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
elseif bMillAngTrasm then elseif bMillAngTrasm then
sMchExt = '_AT' sMchExt = '_AT'
end end
local bExcludeH2 = false
if Proc.Double and Proc.Double > 0 then
bMillUp = true
bMillDown = false
bExcludeH2 = true
sMchExt = ''
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, bExcludeH2) local sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, nil, nil, bMillUp, bMillDown)
if not sMilling and bMillUp then if not sMilling and bMillUp then
sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown, bExcludeH2) sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown)
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)
@@ -299,9 +236,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, bExcludeH2) sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown)
if not sMilling and bMillUp then if not sMilling and bMillUp then
sMilling = ML.FindMilling( sMillType, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown, bExcludeH2) sMilling = ML.FindMilling( sMillType, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown)
sMchExt = '' sMchExt = ''
end end
if not sMilling then if not sMilling then
@@ -313,9 +250,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local dToolDiam = 100 local dToolDiam = 100
local dMaxMat = 30 local dMaxMat = 30
local dSideAng = 0 local dSideAng = 0
local sHeadTool = 'H1'
local bCW = true local bCW = true
local bMillOnAggregate = sMchExt == '_AT'
if EgtMdbSetCurrMachining( sMilling) then if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
@@ -323,73 +258,24 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
dToolDiam = max( dToolDiam, 10) dToolDiam = max( dToolDiam, 10)
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
dSideAng = EgtTdbGetCurrToolParam( MCH_TP.SIDEANG) or dSideAng dSideAng = EgtTdbGetCurrToolParam( MCH_TP.SIDEANG) or dSideAng
sHeadTool = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
local dSpeed = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) or 0 local dSpeed = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) or 0
bCW = ( dSpeed >= 0) bCW = ( dSpeed >= 0)
end end
end end
local bMultipleZPasses = false -- verifico che la profondità non superi il massimo materiale dell'utensile
-- se necessario, cerco un utensile più lungo
if dAltMort > dMaxMat + 10 * GEO.EPS_SMALL then if dAltMort > dMaxMat + 10 * GEO.EPS_SMALL then
-- recupero la lavorazione : prima ricerca per sola tipologia local sErr = 'Error : DtMortise Depth bigger than Tool Cutting edge'
sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, nil, nil, bMillUp, bMillDown, bExcludeH2, nil, 'Longest') EgtOutLog( sErr)
if not sMilling and bMillUp then return false, sErr
sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown, bExcludeH2, nil, 'Longest')
end
if not sMilling then
local sErr = 'Milling not found in library : Error on DtMortise ' .. tostring( Proc.Id)
EgtOutLog( sErr)
return false, sErr
end
-- recupero la lavorazione : seconda ricerca con tipologia e diametro massimo
sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown, bExcludeH2, nil, 'Longest')
if not sMilling and bMillUp then
sMilling = ML.FindMilling( sMillType, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown, bExcludeH2, nil, 'Longest')
sMchExt = ''
end
if not sMilling then
local sErr = 'Radius too small : Error on DtMortise ' .. tostring( Proc.Id)
EgtOutLog( sErr)
return false, sErr
end
if not sMilling then
local sErr = 'Error : DtMortise Depth bigger than Tool Cutting edge'
EgtOutLog( sErr)
return false, sErr
end
-- riassegno dati utensile
dToolDiam = 100
dMaxMat = 30
dSideAng = 0
bCW = true
bMillOnAggregate = sMchExt == '_AT'
if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
dToolDiam = max( dToolDiam, 10)
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
dSideAng = EgtTdbGetCurrToolParam( MCH_TP.SIDEANG) or dSideAng
local dSpeed = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) or 0
bCW = ( dSpeed >= 0)
end
end
bMultipleZPasses = true
end end
-- se con tasca, la lavoro
-- tastatura se richiesta
local Info = { vtProbe = vtExtr, ptProbe = ptBC, sType = 'DTMortise', sHead = sHeadTool}
local bProbeExecuted, sErr = Probe.Make( Proc, nPartId, Info)
-- se con tasca, la lavoro (mai in doppio)
if bPocket then if bPocket then
-- recupero il contorno della tasca (seconda curva ausiliaria) -- recupero il contorno della tasca (seconda curva ausiliaria)
local vAuxId = EgtGetInfo( Proc.Id, 'AUXID', 'vi') local sVal = EgtGetInfo( Proc.Id, 'AUXID')
local vsAuxId = EgtSplitString( sVal)
local Aux2Id local Aux2Id
if vAuxId and #vAuxId >=2 then if vsAuxId and #vsAuxId >=2 then
Aux2Id = vAuxId[2] Aux2Id = tonumber( vsAuxId[2])
end end
if Aux2Id then Aux2Id = Aux2Id + Proc.Id end if Aux2Id then Aux2Id = Aux2Id + Proc.Id end
if not Aux2Id or ( EgtGetType( Aux2Id) & GDB_FY.GEO_CURVE) == 0 then if not Aux2Id or ( EgtGetType( Aux2Id) & GDB_FY.GEO_CURVE) == 0 then
@@ -425,9 +311,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ Aux2Id, -1}}) EgtSetMachiningGeometry( {{ Aux2Id, -1}})
-- dichiaro non si generano sfridi per VMill -- dichiaro non si generano sfridi per VMill
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;'
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dMaxMat - 0.1, 1))
sUserNotes = EgtSetValInNotes( sUserNotes, 'VMRS', 0)
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
@@ -438,24 +322,13 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
-- eventuale calcolo SCC -- eventuale calcolo SCC
local nSCC local nSCC
if BD.TURN then if BD.TURN and not bPocket then
if not bPocket then if abs( vtAx:getY()) > abs( vtAx:getZ()) then
if abs( vtAx:getY()) > abs( vtAx:getZ()) then nSCC = EgtIf( vtAx:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
nSCC = EgtIf( vtAx:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM) else
else nSCC = EgtIf( vtAx:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
nSCC = EgtIf( vtAx:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
end
end
-- se aggregato e rivolto verso Z-, si accede da lato aperto
elseif bMillOnAggregate and AreSameVectorApprox( vtExtr, -Z_AX()) then
if Proc.AffectedFaces.Back then
nSCC = MCH_SCC.ADIR_YP
elseif Proc.AffectedFaces.Front then
nSCC = MCH_SCC.ADIR_YM
end end
end end
-- flag di mirror precedente aggiornabile localmente
local nMyPrevDouble = Proc.PrevDouble
-- 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
@@ -466,103 +339,85 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
return false, sErr return false, sErr
end end
-- calcolo il percorso top mortise -- calcolo il percorso top mortise
local nAuxId1 = CalcPathAtHeight( Proc.Id, AuxId, nAddGrpId, dAltMort, dSideAng, b3Solid) local nAuxId1 = CalcTopPath( Proc.Id, AuxId, nAddGrpId, dAltMort, dSideAng, b3Solid)
-- se esiste il percorso -- se esiste il percorso
if nAuxId1 then if nAuxId1 then
if EgtCurveIsFlat( nAuxId1) then -- creo percorso sulla parte alta della mortasa
-- creo percorso sulla parte alta della mortasa local dToolRadDelta = dAltMort * tan( dSideAng)
local dToolRadDelta = dAltMort * tan( dSideAng) local dTopDiam = dToolDiam + 2 * dToolRadDelta
local dTopDiam = dToolDiam + 2 * dToolRadDelta -- recupero punto iniziale e finale del percorso
-- recupero punto iniziale e finale del percorso local ptStart = EgtSP( nAuxId1, GDB_RT.GLOB)
local ptStart = EgtSP( nAuxId1, GDB_RT.GLOB) local ptEnd = EgtEP( nAuxId1, GDB_RT.GLOB)
local ptEnd = EgtEP( nAuxId1, GDB_RT.GLOB) if ptStart and ptEnd then
if ptStart and ptEnd then local nId1
local nId1 -- se richiesti due segmenti di linea
-- se richiesti due segmenti di linea if not bMakeAsByArc then
if not bMakeAsByArc then -- determino il punto comune dei due segmenti
-- determino il punto comune dei due segmenti local vtDelta = ( ptEnd - ptStart) / 4
local vtDelta = ( ptEnd - ptStart) / 4 vtDelta:rotate( vtExtr, -90)
vtDelta:rotate( vtExtr, -90) local ptMid = ( ptStart + ptEnd) / 2 + vtDelta
local ptMid = ( ptStart + ptEnd) / 2 + vtDelta -- creo la spezzata formata dai due segmenti
-- creo la spezzata formata dai due segmenti nId1 = EgtCurveCompoFromPoints( nAddGrpId, { ptStart, ptMid, ptEnd}, GDB_RT.GLOB)
nId1 = EgtCurveCompoFromPoints( nAddGrpId, { ptStart, ptMid, ptEnd}, GDB_RT.GLOB) -- altrimenti richiesto arco
-- altrimenti richiesto arco
else
-- direzione del segmento
local vtDir = ptEnd - ptStart ;
local dLen = vtDir:len()
vtDir:normalize()
-- direzioni tangenti iniziale e finale
local vtStart = EgtSV( nAuxId1, GDB_RT.GLOB)
local vtEnd = EgtEV( nAuxId1, GDB_RT.GLOB)
-- angoli
local dAngStart = acos( vtStart * vtDir)
local dAngEnd = acos( vtEnd * vtDir)
local dMaxAng = min( 30, dAngStart, dAngEnd)
if dLen < dTopDiam then
dMaxAng = min( dMaxAng, asin( dLen / dTopDiam))
end
local vtTg = vtDir ; vtTg:rotate( vtExtr, -dMaxAng)
-- creo l'arco
nId1 = EgtArc2PV( nAddGrpId, ptStart, ptEnd, vtTg, GDB_RT.GLOB)
end
if not nId1 then
local sErr = 'Wrong geometry : Error on DtMortise '
EgtOutLog( sErr)
return false, sErr
end
EgtModifyCurveExtrusion( nId1, vtExtr, GDB_RT.GLOB)
-- inserisco la lavorazione di contornatura anti splint
local sNameF = 'DtMtAS_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sNameF, sMilling)
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nId1, -1}})
-- setto affondamento pari all'altezza della mortsasa
EgtSetMachiningParam( MCH_MP.DEPTH, dAltMort)
-- setto offset radiale con aggiunto un ulteriore allargamento di 1mm
EgtSetMachiningParam( MCH_MP.OFFSR, dToolRadDelta - 1)
-- antischeggia sempre con una passata
if bMultipleZPasses then
EgtSetMachiningParam( MCH_MP.STEP, 0)
end
-- sistemo il lato e la direzione di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT))
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, false, true))
-- se necessario, imposto SCC
if nSCC then
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
end
-- dichiaro non si generano sfridi per VMill
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or ''
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dAltMort, 1))
sUserNotes = EgtSetValInNotes( sUserNotes, 'VMRS', 0)
-- se lavorazione in doppio
if Proc.Double and Proc.Double > 0 then
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double)
if Proc.Double ~= nMyPrevDouble then
nMyPrevDouble = Proc.Double
sUserNotes = EgtSetValInNotes( sUserNotes, 'StartZmax', 2)
end
end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
else else
local sErr = 'Wrong geometry : Error on DtMortise ' .. tostring( Proc.Id) -- direzione del segmento
local vtDir = ptEnd - ptStart ;
local dLen = vtDir:len()
vtDir:normalize()
-- direzioni tangenti iniziale e finale
local vtStart = EgtSV( nAuxId1, GDB_RT.GLOB)
local vtEnd = EgtEV( nAuxId1, GDB_RT.GLOB)
-- angoli
local dAngStart = acos( vtStart * vtDir)
local dAngEnd = acos( vtEnd * vtDir)
local dMaxAng = min( 30, dAngStart, dAngEnd)
if dLen < dTopDiam then
dMaxAng = min( dMaxAng, asin( dLen / dTopDiam))
end
local vtTg = vtDir ; vtTg:rotate( vtExtr, -dMaxAng)
-- creo l'arco
nId1 = EgtArc2PV( nAddGrpId, ptStart, ptEnd, vtTg, GDB_RT.GLOB)
end
if not nId1 then
local sErr = 'Wrong geometry : Error on DtMortise '
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
EgtModifyCurveExtrusion( nId1, vtExtr, GDB_RT.GLOB)
-- inserisco la lavorazione di contornatura anti splint
local sNameF = 'DtMtAS_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sNameF, sMilling)
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nId1, -1}})
-- setto affondamento pari all'altezza della mortsasa
EgtSetMachiningParam( MCH_MP.DEPTH, dAltMort)
-- setto offset radiale con aggiunto un ulteriore allargamento di 1mm
EgtSetMachiningParam( MCH_MP.OFFSR, dToolRadDelta - 1)
-- sistemo il lato e la direzione di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT))
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, false, true))
-- se necessario, imposto SCC
if nSCC then
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
end
-- dichiaro non si generano sfridi per VMill
local sUserNotes = 'MaxElev='.. EgtNumToString( dAltMort, 1) .. '; VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
else else
sWarn = 'Warning : skipped DoveTail mortise antisplint' local sErr = 'Wrong geometry : Error on DtMortise ' .. tostring( Proc.Id)
EgtOutLog( sErr)
return false, sErr
end end
else else
local sErr = 'Wrong geometry : Error on DtMortise ' .. tostring( Proc.Id) local sErr = 'Wrong geometry : Error on DtMortise ' .. tostring( Proc.Id)
@@ -578,23 +433,6 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local nPass = ceil( dDist / ( 1.9 * dToolDiam)) local nPass = ceil( dDist / ( 1.9 * dToolDiam))
local dStep = 0 local dStep = 0
if nPass > 1 then dStep = max( ( dDist - 2 * dToolDiam) / ( 2 * nPass - 2), 0.25 * dToolDiam) end if nPass > 1 then dStep = max( ( dDist - 2 * dToolDiam) / ( 2 * nPass - 2), 0.25 * dToolDiam) end
local dVerticalStep = 0
if bMultipleZPasses then
local dToolVerticalStep = 0
if EgtMdbSetCurrMachining( sMilling) then
dToolVerticalStep = EgtMdbGetCurrMachiningParam( MCH_MP.STEP) or 0
end
if dToolVerticalStep < 10 * GEO.EPS_SMALL then
dToolVerticalStep = dMaxMat / 3
else
dToolVerticalStep = min( dToolVerticalStep, dMaxMat / 3)
end
local VerticalSteps = GetVerticalSteps( dAltMort, dToolVerticalStep)
dVerticalStep = VerticalSteps.StepLength
nPass = VerticalSteps.Count
end
for i = nPass, 1, -1 do for i = nPass, 1, -1 do
-- inserisco la lavorazione di contornatura -- inserisco la lavorazione di contornatura
local sNameF = 'DtMt_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nPass) local sNameF = 'DtMt_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nPass)
@@ -605,80 +443,27 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
return false, sErr return false, sErr
end end
-- aggiungo geometria -- aggiungo geometria
local GeomId = AuxId EgtSetMachiningGeometry( {{ AuxId, -1}})
if ( i > 1) and bMultipleZPasses then
local dCurrentHeight = dAltMort - ( ( nPass - i + 1) * dVerticalStep)
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
local b3MortiseNoPocket = EgtGetBBoxGlob( AuxId, GDB_BB.STANDARD)
GeomId = CalcPathAtHeight( Proc.Id, AuxId, nAddGrpId, dCurrentHeight, dSideAng, b3MortiseNoPocket)
if not GeomId then
local sErr = 'Wrong geometry : Error on DtMortise ' .. tostring( Proc.Id)
EgtOutLog( sErr)
return false, sErr
end
end
EgtSetMachiningGeometry( {{ GeomId, -1}})
-- imposto offset -- imposto offset
local dOffs = ( i - 1) * dStep local dOffs = ( i - 1) * dStep
if bMultipleZPasses then
if i > 1 then
dOffs = 1
else
dOffs = 0
end
end
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs) EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
-- in caso di passate in Z già calcolate lo step deve essere nullo per garantire passate singole
if bMultipleZPasses then
EgtSetMachiningParam( MCH_MP.STEP, 0)
end
-- sistemo il lato e la direzione di lavoro -- sistemo il lato e la direzione di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT)) EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT))
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, false, true)) EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, false, true))
local ptS = EgtSP( AuxId, GDB_ID.ROOT)
local ptE = EgtEP( AuxId, GDB_ID.ROOT)
-- in presenza di pocket imposto dati ingresso e uscita -- in presenza di pocket imposto dati ingresso e uscita
if bPocket then if bPocket then
-- recupero il contorno della tasca (seconda curva ausiliaria)
local vAuxId = EgtGetInfo( Proc.Id, 'AUXID', 'vi')
-- si prende il centro del percorso da svuotare ( non si controlla che sia presente perchè già verificata in precedenza)
local ptPocketCenter = EgtGP( Proc.Id + vAuxId[2], GDB_ID.ROOT)
-- calcolo componente tangente e lineare di ingresso
local vtS = EgtSV( Proc.Id + vAuxId[1], GDB_ID.ROOT) -- vettore entrante percorso
local vtOffS = EgtSV( Proc.Id + vAuxId[1], GDB_ID.ROOT) ; vtOffS:rotate( vtExtr, 90) -- vettore da punto iniziale a centro utensile
local vtStartToCenter = ptPocketCenter - ( ptS + ( vtOffS * ( dToolDiam/2))) -- vettore da centro utensilenel punto iniziale e centro del percorso da svuotare
local dLenStartToCenter = vtStartToCenter:len() -- distanza da centro utensile a centro del percorso da svuotare
local dStartTangComp = abs( vtStartToCenter * vtS) -- prodotto scalare tra vettore entrante e vettore tra centro utensilee percordo da svuotare (componente tangente)
local dStartPerpComp = sqrt( dLenStartToCenter^2 - dStartTangComp^2) -- pitagora tra componente tangente e la lunghezza tra i due centri
-- calcolo componente tangente e lineare di uscita
local vtE = EgtEV( Proc.Id + vAuxId[1], GDB_ID.ROOT)
local vtOffE = EgtEV( Proc.Id + vAuxId[1], GDB_ID.ROOT) ; vtOffE:rotate( vtExtr, 90)
local vtEndToCenter = ptPocketCenter - ( ptE + ( vtOffE * ( dToolDiam/2)))
local dLenEndToCenter = vtEndToCenter:len()
local dEndTangComp = abs( vtEndToCenter * vtE)
local dEndPerpComp = sqrt( dLenEndToCenter^2 - dEndTangComp^2)
EgtSetMachiningParam( MCH_MP.STARTPOS, 5) EgtSetMachiningParam( MCH_MP.STARTPOS, 5)
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.TANGENT) EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.TANGENT)
EgtSetMachiningParam( MCH_MP.LITANG, dStartTangComp) EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.AS_LI)
EgtSetMachiningParam( MCH_MP.LIPERP, dStartPerpComp) EgtSetMachiningParam( MCH_MP.STARTADDLEN, 5)
EgtSetMachiningParam( MCH_MP.LIELEV, 0)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LI.TANGENT)
EgtSetMachiningParam( MCH_MP.LOTANG, dEndTangComp)
EgtSetMachiningParam( MCH_MP.LOPERP, dEndPerpComp)
EgtSetMachiningParam( MCH_MP.LOELEV, 0)
EgtSetMachiningParam( MCH_MP.STARTADDLEN, 0)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, 0) EgtSetMachiningParam( MCH_MP.ENDADDLEN, 0)
EgtSetMachiningParam( MCH_MP.LITANG, dToolDiam / 2)
EgtSetMachiningParam( MCH_MP.LIPERP, 5)
EgtSetMachiningParam( MCH_MP.LIELEV, 0)
-- altrimenti verifico se sono bilanciati ingresso e uscita, per evitare inizio o fine nel legno -- altrimenti verifico se sono bilanciati ingresso e uscita, per evitare inizio o fine nel legno
else else
local ptS = EgtSP( AuxId, GDB_ID.ROOT)
local ptE = EgtEP( AuxId, GDB_ID.ROOT)
local dDistS = abs( ( ptS - rfDtMrt:getOrigin()) * rfDtMrt:getVersX()) local dDistS = abs( ( ptS - rfDtMrt:getOrigin()) * rfDtMrt:getVersX())
local dDistE = abs( ( ptE - rfDtMrt:getOrigin()) * rfDtMrt:getVersX()) local dDistE = abs( ( ptE - rfDtMrt:getOrigin()) * rfDtMrt:getVersX())
local dIni, dFin = EgtCurveDomain( AuxId) local dIni, dFin = EgtCurveDomain( AuxId)
@@ -694,33 +479,11 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
end end
-- se necessario, imposto SCC -- se necessario, imposto SCC
if nSCC then if nSCC then
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
end end
-- dichiaro massima elevazione e assenza sfridi per VMill -- dichiaro non si generano sfridi per VMill
local dMaxElev = dMaxMat local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;'
if bMultipleZPasses then
dMaxElev = dVerticalStep
end
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or ''
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dMaxElev - 0.1, 1))
sUserNotes = EgtSetValInNotes( sUserNotes, 'VMRS', 0)
-- in presenza di pocket dichiaro che non sto entrando e uscendo nel grezzo
if bPocket then
sUserNotes = EgtSetValInNotes( sUserNotes, 'OutRaw', 3)
end
-- se lavorazione in doppio
if Proc.Double and Proc.Double > 0 then
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double)
if Proc.Double ~= nMyPrevDouble then
nMyPrevDouble = Proc.Double
sUserNotes = EgtSetValInNotes( sUserNotes, 'StartZmax', 2)
end
end
-- se c'è stata tastatura, si disattiva sull'ultima lavorazione
if bProbeExecuted and i == 1 then
sUserNotes = EgtSetValInNotes( sUserNotes, 'END-PROBE', true)
end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
@@ -729,7 +492,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
return false, sErr return false, sErr
end end
end end
return true, sWarn return true
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
+74 -200
View File
@@ -1,11 +1,7 @@
-- ProcessTenon.lua by Egaltech s.r.l. 2023/03/28 -- ProcessTenon.lua by Egaltech s.r.l. 2022/06/07
-- 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. -- 2022/04/14 Aumentati un poco i limiti di orientamento verso il basso per FAST e PF.
-- 2023/02/08 Aumentato il range per cui i tenoni vengono lavorati in sottosquadro.
-- 2023/03/27 Migliorate condizioni scelta pretaglio con lama o fresa; gestione unificata con ProcessTenon.
-- 2023/03/28 Corretta gestione faccia di base quando divisa in più parti per distanza massima da lavorare.
-- 2024/02/29 Aumentato numero passaggi CR su tenone. Massimo 8
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessDtTenon = {} local ProcessDtTenon = {}
@@ -13,7 +9,6 @@ local ProcessDtTenon = {}
-- 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)
@@ -43,17 +38,14 @@ local function VerifyOrientation( Proc, vtN, b3Raw)
-- 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.088 then
return ( vtN:getZ() >= -0.51) return ( vtN:getZ() >= -0.51)
-- se macchina Fast, pezzo stretto e inclinazione laterale non eccessiva, accetto fino a -27deg -- altrimenti accetto fino a -21deg
elseif ( not BD.C_SIMM) and abs( vtN:getY()) < 0.5 and b3Raw:getDimY() < 150.1 then
return ( vtN:getZ() >= -0.454)
-- altrimenti accetto fino a -23.5deg
else else
return ( vtN:getZ() >= -0.399) return ( vtN:getZ() >= -0.359)
end end
-- se trave medio-bassa -- se trave medio-bassa
elseif b3Raw:getDimZ() < 281 then elseif b3Raw:getDimZ() < 281 then
-- se tenone praticamente in asse oppure pezzo stretto e inclinazione laterale non eccessiva, accetto fino a -25 deg -- se tenone praticamente in asse, accetto fino a -25 deg
if abs( vtN:getY()) < 0.088 or ( abs( vtN:getY()) < 0.5 and b3Raw:getDimY() < 150.1) then if abs( vtN:getY()) < 0.088 then
return ( vtN:getZ() >= -0.422) return ( vtN:getZ() >= -0.422)
-- altrimenti, accetto fino a -15 deg -- altrimenti, accetto fino a -15 deg
else else
@@ -64,14 +56,14 @@ local function VerifyOrientation( Proc, vtN, b3Raw)
-- se tenone praticamente in asse, accetto fino a -22 deg -- se tenone praticamente in asse, accetto fino a -22 deg
if abs( vtN:getY()) < 0.088 then if abs( vtN:getY()) < 0.088 then
return ( vtN:getZ() >= -0.375) return ( vtN:getZ() >= -0.375)
-- altrimenti, accetto fino a -12.5 deg -- altrimenti, accetto fino a -10 deg
else else
return ( vtN:getZ() >= -0.216) return ( vtN:getZ() >= -0.174)
end end
-- altrimenti -- altrimenti
else else
-- accetto fino a -12.5 deg -- accetto fino a -5deg
return ( vtN:getZ() >= -0.216) return ( vtN:getZ() >= -0.088)
end end
end end
@@ -109,9 +101,8 @@ local function ApplyPocket( Proc, sPocketing, nStep, dSurfStep, nIdSurf, vtExtr)
-- imposto uso faccia -- imposto uso faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT) EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT)
if dSurfStep > 0 then if dSurfStep > 0 then
local sNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or ''
-- imposto elevazione -- imposto elevazione
sNotes = EgtSetValInNotes( sNotes, 'MaxElev', EgtNumToString( dSurfStep, 2)) local sNotes = 'MaxElev=' .. EgtNumToString( dSurfStep, 2) .. ';'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
end end
-- imposto posizione braccio porta testa -- imposto posizione braccio porta testa
@@ -172,9 +163,6 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- ne determino l'asse -- ne determino l'asse
local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB) local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB)
vtAx:normalize() vtAx:normalize()
-- abilitazione lavorazione da sotto
local bMillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259)
local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174)
-- 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
@@ -191,47 +179,63 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
if AddId then if AddId then
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( AddId, 'TASKID', Proc.TaskId) EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- solo per macchine tipo PF e simili: se pezzo piccolo, in coda, piano inclinato attorno a Z e inclinato verso il basso applico svuotatura -- se pezzo piccolo, in coda e piano inclinato attorno a Z applico svuotatura
if b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getX() < 0 and abs( vtExtr:getY()) > 0.173 and vtExtr:getZ() < -0.1 and BD.C_SIMM then if b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getX() < 0 and abs( vtExtr:getY()) > 0.173 then
-- recupero la lavorazione local sPocketing = ML.FindPocketing( 'OpenPocket')
local sPocketing = ML.FindPocketing( 'OpenPocket', nil, nil, nil, not bMillDown, bMillDown) local dMaxDepth = 100
if not sPocketing then local dStep = 30
local sErr = 'Error : pocketing '..sPockType..' not found in library' local nSurfStep
EgtOutLog( sErr) -- 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
-- altrimenti applico taglio di lama -- altrimenti applico taglio di lama
else else
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId} Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc) local bFromBottom = ( b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getZ() > 0.25)
-- se esiste grezzo successivo non serve tagliare dal basso
local bFromBottom
local dTotalLength = 0
local nNextRawId = EgtGetNextRawPart( nRawId)
while nNextRawId do
dTotalLength = dTotalLength + EgtGetRawPartBBox( nNextRawId):getDimX()
nNextRawId = EgtGetNextRawPart( nNextRawId)
end
if dTotalLength > BD.MinRaw and not Proc.Tail then
bFromBottom = false
else
bFromBottom = ( b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getZ() > 0.25)
end
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom) local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
end end
end end
end 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 -- recupero la lavorazione
local sMillType = 'DtTenon' local sMillType = 'DtTenon'
local sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown and not bMillUp, '_H2', ''), nil, nil, nil, nil, bMillUp, bMillDown) local sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', ''), nil, nil, nil, nil, bMillUp, bMillDown)
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)
@@ -250,63 +254,35 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCW = ( dSpeed >= 0) bCW = ( dSpeed >= 0)
end end
end end
-- se necessario, cerco un utensile più lungo -- verifico che l'altezza non superi il massimo materiale dell'utensile
if dDtTenH > dMaxMat + 10 * GEO.EPS_SMALL then if dDtTenH > dMaxMat + 10 * GEO.EPS_SMALL then
sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown and not bMillUp, '_H2', ''), nil, nil, nil, nil, bMillUp, bMillDown, nil, nil, 'Longest') local sErr = 'Error : DtTenon Height bigger than Tool Cutting edge'
if not sMilling then EgtOutLog( sErr)
local sErr = 'Error : milling not found in library' return false, sErr
EgtOutLog( sErr)
return false, sErr
end
if not sMilling then
local sErr = 'Error : DtTenon Height bigger than Tool Cutting edge'
EgtOutLog( sErr)
return false, sErr
end
-- riassegno dati utensile
dTDiam = 50
dMaxMat = 30
bCW = true
if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dTDiam
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
local dSpeed = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) or 0
bCW = ( dSpeed >= 0)
end
end
end end
-- calcolo distanza massima della curva dal punto più lontano della base tenone Dt (facet 0) -- calcolo distanza massima della curva dal punto più lontano della base tenone Dt (facet 0)
local dMaxDist local dMaxDist = 0
for i = 0, Proc.Fct - 1 do local nLoopId, nLoopCnt = EgtExtractSurfTmFacetLoops( Proc.Id, 0, EgtGetParent( Proc.Id))
local ptFC, vtFN = EgtSurfTmFacetCenter( Proc.Id, i, GDB_ID.ROOT) if nLoopId then
if not AreSameVectorApprox( vtFN, vtN) or abs( ( ptFC - ptBC) * vtN) > 100 * GEO.EPS_SMALL then local dUmin, dUmax = EgtCurveDomain( nLoopId)
break for dU = dUmin, dUmax do
end local ptP = EgtUP( nLoopId, dU, GDB_ID.ROOT)
local nLoopId, nLoopCnt = EgtExtractSurfTmFacetLoops( Proc.Id, i, EgtGetParent( Proc.Id)) local ptNear = EgtNP( AuxId, ptP, GDB_ID.ROOT)
if nLoopId then local dDist = dist( ptP, ptNear)
local dUmin, dUmax = EgtCurveDomain( nLoopId) if dDist > dMaxDist then
for dU = dUmin, dUmax do dMaxDist = dDist
local ptP = EgtUP( nLoopId, dU, GDB_ID.ROOT)
local ptNear = EgtNP( AuxId, ptP, GDB_ID.ROOT)
local dDist = dist( ptP, ptNear)
if not dMaxDist or dDist > dMaxDist then
dMaxDist = dDist
end
end
for j = 1, nLoopCnt do
EgtErase( nLoopId + j - 1)
end end
end end
end for i = 1, nLoopCnt do
if not dMaxDist then EgtErase( nLoopId + i - 1)
end
else
local b3DtAux = EgtGetBBoxRef( AuxId, GDB_BB.STANDARD, frDtTen) local b3DtAux = EgtGetBBoxRef( AuxId, GDB_BB.STANDARD, frDtTen)
dMaxDist = 2 * ( b3DtTen:getRadius() - b3DtAux:getRadius()) dMaxDist = 2 * ( b3DtTen:getRadius() - b3DtAux:getRadius())
end end
EgtOutLog( 'MaxDist=' .. EgtNumToString( dMaxDist, 3), 3) EgtOutLog( 'MaxDist=' .. EgtNumToString( dMaxDist, 3), 3)
-- Cicli di lavorazione (max 8) -- Cicli di lavorazione (max 6)
local MAX_PASS = 8 local MAX_PASS = 6
local nStep = min( ceil( dMaxDist / ( 0.7 * dTDiam)), MAX_PASS) local nStep = min( ceil( dMaxDist / ( 0.7 * dTDiam)), MAX_PASS)
local dStep = min( dMaxDist, 0.7 * dTDiam * MAX_PASS) / nStep local dStep = min( dMaxDist, 0.7 * dTDiam * MAX_PASS) / nStep
for i = nStep, 1, -1 do for i = nStep, 1, -1 do
@@ -323,9 +299,7 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- sistemo i parametri -- sistemo i parametri
local dOffs = ( i - 1) * dStep local dOffs = ( i - 1) * dStep
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs) EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dDtTenH, 1) .. ';')
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dDtTenH, 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- sistemo il lato e la direzione di lavoro -- sistemo il lato e la direzione di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT)) EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT))
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false)) EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false))
@@ -367,108 +341,8 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
BL.UpdateTCING( nRawId, dOffs) BL.UpdateTCING( nRawId, dOffs)
end end
end end
-- si controllano le ultime 5 facce della feature
local nIndFace = -1
for i = 1, 5 do
if abs( vtExtr * EgtSurfTmFacetNormVersor( Proc.Id, Proc.Fct-i, GDB_ID.ROOT)) < GEO.EPS_ANG_SMALL then
nIndFace = Proc.Fct-i
end
end
-- controllo se serve passaggio di finitura in caso il tenone non cominci dal bordo della trave (P14 > 0)
if nIndFace > 0 then
-- verifico se almeno uno dei punti iniziale e finale della curva giace in uno dei piani limite del pezzo, quindi se è un lato aperto
local bOpen = false
local ptIni = EgtSP( AuxId, GDB_RT.GLOB)
local ptFin = EgtEP( AuxId, GDB_RT.GLOB)
if ( abs( ptIni:getX() - b3Solid:getMax():getX()) < 100 * GEO.EPS_SMALL or abs( ptFin:getX() - b3Solid:getMax():getX()) < 100 * GEO.EPS_SMALL) or
( abs( ptIni:getX() - b3Solid:getMin():getX()) < 100 * GEO.EPS_SMALL or abs( ptFin:getX() - b3Solid:getMin():getX()) < 100 * GEO.EPS_SMALL) or
( abs( ptIni:getY() - b3Solid:getMax():getY()) < 100 * GEO.EPS_SMALL or abs( ptFin:getY() - b3Solid:getMax():getY()) < 100 * GEO.EPS_SMALL) or
( abs( ptIni:getY() - b3Solid:getMin():getY()) < 100 * GEO.EPS_SMALL or abs( ptFin:getY() - b3Solid:getMin():getY()) < 100 * GEO.EPS_SMALL) or
( abs( ptIni:getZ() - b3Solid:getMax():getZ()) < 100 * GEO.EPS_SMALL or abs( ptFin:getZ() - b3Solid:getMax():getZ()) < 100 * GEO.EPS_SMALL) or
( abs( ptIni:getZ() - b3Solid:getMin():getZ()) < 100 * GEO.EPS_SMALL or abs( ptFin:getZ() - b3Solid:getMin():getZ()) < 100 * GEO.EPS_SMALL) then
bOpen = true
end
-- se entrambi i punti non sono sul limite pezzo
if not bOpen then
-- recupero la lavorazione
sMillType = 'Tenon'
sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown and not bMillUp, '_H2', ''), nil, nil, nil, nil, bMillUp, bMillDown)
if not sMilling then
local sErr = 'Error : milling to finish the tenon not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati dell'utensile
if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dTDiam
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
local dSpeed = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) or 0
bCW = ( dSpeed >= 0)
end
-- inserisco la passata finale della lavorazione
local sNameF = 'TenF_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sNameF, sMilling)
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, nIndFace}})
-- sistemo i parametri
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH')
-- sistemo il lato e la direzione di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT))
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false))
EgtSetMachiningParam( MCH_MP.LITANG, 0.7 * dTDiam)
EgtSetMachiningParam( MCH_MP.LIPERP, 20)
EgtSetMachiningParam( MCH_MP.LOTANG, 0.7 * dTDiam)
EgtSetMachiningParam( MCH_MP.LOPERP, 20)
local nFaceUse
if vtExtr:getX() > -GEO.EPS_SMALL then
nFaceUse = MCH_MILL_FU.PARAL_LEFT
else
nFaceUse = MCH_MILL_FU.PARAL_RIGHT
end
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- imposto elevazione
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or ''
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dDtTenH, 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE
if BD.TURN then
if abs( vtAx:getY()) > abs( vtAx:getZ()) then
nSCC = EgtIf( vtAx:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
else
nSCC = EgtIf( vtAx:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
end
elseif not BD.C_SIMM then
nSCC = MCH_SCC.ADIR_YM
if abs( vtExtr:getY()) > 0.088 then
nSCC = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
end
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
end
end
return true return true
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
return ProcessDtTenon return ProcessDtTenon
+54 -312
View File
@@ -1,16 +1,6 @@
-- ProcessFreeContour.lua by Egaltech s.r.l. 2023/03/03 -- 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 -- 2022/08/23 Aggiunta la funzione MakeByMark per la gestione del caso P13=10
-- 2022/09/21 In MakeByMill aggiunto messaggio per elevazione non raggiunta.
-- 2022/11/03 In MakeByMill migliorata gestione lavorazione con fresa su testa da sotto.
-- 2022/11/09 Aggiunta la gestione della chiamata della FreeContour da parte della SimpleScarf.
-- 2022/11/24 In MakeByMill aggiunta la lavorazione sopra/sotto nel caso di testa sotto
-- In MakeByMill se BeamData forza lettura codolo da Q questo viene sempre fatto indipendentemente dalle dimensioni della feature
-- 2023/03/03 Corretta MakeByMark ( non definiti b3Raw e b3Aux ).
-- 2023/06/21 In CalcSpecialAdd modificato l'angolo minimo da 5 a 15 deg.
-- 2023/07/28 In MakeByPocket aggiunta Q06 per specificare un eventuale offset radiale del contorno.
-- 2024/03/05 In MakebyPocket aggiunta lavorazione di smusso
-- In MakeByMill eliminata doppia lavorazione smusso se contorno non passante
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessFreeContour = {} local ProcessFreeContour = {}
@@ -29,20 +19,13 @@ local ML = require( 'MachiningLib')
local Q_DIM_STRIP = 'Q01' -- d local Q_DIM_STRIP = 'Q01' -- d
local Q_DEPTH_CHAMFER = 'Q02' -- d local Q_DEPTH_CHAMFER = 'Q02' -- d
local Q_OVERMAT_FOR_FINISH = 'Q03' -- d local Q_OVERMAT_FOR_FINISH = 'Q03' -- d
local Q_ONLY_CONTOUR = 'Q04' -- i, valido solo per drill
local Q_ONLY_CHAMFER = 'Q00' -- i local Q_ONLY_CHAMFER = 'Q00' -- i
local Q_RADIAL_OFFSET = 'Q06' -- d, valido solo per pocket
local Q_IGNORE_LASER_PROBLEMS = 'Q07'
local Q_FORCE_CLAMPABLE_AREA = 'Q08'
local Q_INVERT_LAST_PATH = 'Q09'
local Q_MAX_ELEVATION = 'Q10' -- d
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Riconoscimento della feature -- Riconoscimento della feature
function ProcessFreeContour.Identify( Proc) function ProcessFreeContour.Identify( Proc)
return ( ( Proc.Grp == 0 or Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 250) return ( ( Proc.Grp == 0 or Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 250)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Verifica se feature di testa -- Verifica se feature di testa
function ProcessFreeContour.IsHeadFeature( Proc, b3Raw, dCurrOvmH) function ProcessFreeContour.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
@@ -104,8 +87,6 @@ end
function ProcessFreeContour.Classify( Proc, b3Raw) function ProcessFreeContour.Classify( Proc, b3Raw)
-- verifico se di tipo pocket -- verifico se di tipo pocket
local bPocket = ( EgtGetInfo( Proc.Id, 'PCKT', 'i') == 1) local bPocket = ( EgtGetInfo( Proc.Id, 'PCKT', 'i') == 1)
-- verifico se forzata esecuzione anche se di testa e ribaltata o ruotata (lettura laser)
local bDownSideOnHeadOk = ( EgtGetInfo( Proc.Id, Q_IGNORE_LASER_PROBLEMS, 'd') or 0) == 1
-- recupero la curva associata -- recupero la curva associata
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
@@ -114,29 +95,29 @@ function ProcessFreeContour.Classify( Proc, b3Raw)
-- se tasca -- se tasca
if bPocket then if bPocket then
local bDown = ( vtN:getZ() < - 0.5) local bDown = ( vtN:getZ() < - 0.5)
return true, bDown, false, bDownSideOnHeadOk return true, bDown, false
-- se altrimenti profilo orizzontale -- se altrimenti profilo orizzontale
elseif abs( vtN:getZ()) < 0.5 then elseif abs( vtN:getZ()) < 0.5 then
return true, false, false, bDownSideOnHeadOk return true, false, false
-- se altrimenti profilo verticale che non interessa tutta la sezione -- se altrimenti profilo verticale che non interessa tutta la sezione
elseif Proc.Box:getDimZ() < 0.9 * b3Raw:getDimZ() then elseif Proc.Box:getDimZ() < 0.9 * b3Raw:getDimZ() then
local bDown = ( vtN:getZ() < - 0.5) local bDown = ( vtN:getZ() < - 0.5)
return true, bDown, false, bDownSideOnHeadOk return true, bDown, false
-- altrimenti è profilo verticale che interessa tutta la sezione -- altrimenti è profilo verticale che interessa tutta la sezione
else else
-- recupero la massima capacità di lavoro dell'utensile da utilizzare -- recupero la massima capacità di lavoro dell'utensile da utilizzare
local sMilling, dMaxDepth = ML.FindMilling( 'FreeContour') local sMilling, dMaxDepth = ML.FindMilling( 'FreeContour')
if not sMilling then dMaxDepth = 0 end if not sMilling then dMaxDepth = 0 end
if Proc.Box:getDimZ() > dMaxDepth and BD.ROT90 then if Proc.Box:getDimZ() > dMaxDepth and BD.ROT90 then
return true, false, true, bDownSideOnHeadOk return true, false, true
else else
return true, false, false, bDownSideOnHeadOk return true, false, false
end end
end end
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function VerifyChamfer( Proc, AuxId, nRawId, bMakeVertCham, bDownHead) local function VerifyChamfer( Proc, AuxId, nRawId, bMakeVertCham)
local nChamfer = 0 local nChamfer = 0
-- ingombro del grezzo -- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
@@ -176,18 +157,12 @@ local function VerifyChamfer( Proc, AuxId, nRawId, bMakeVertCham, bDownHead)
-- recupero la lavorazione -- recupero la lavorazione
local sMilling local sMilling
if nChamfer > 0 then if nChamfer > 0 then
if bDownHead then sMilling = ML.FindMilling( 'Mark')
sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true)
else
sMilling = ML.FindMilling( 'Mark')
end
if not sMilling then if not sMilling then
local sErr = 'Error : Mark not found in library' local sErr = 'Error : Mark not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
return -1, 0, sErr return -1, 0, sErr
end end
else
sMilling = ''
end end
return nChamfer, dDepth, sMilling return nChamfer, dDepth, sMilling
@@ -221,8 +196,8 @@ local function CalcSpecialAdd( nCrv, bStartVsEnd, dToolDiam)
-- tangenti prima e dopo il punto interno -- tangenti prima e dopo il punto interno
local vtPrev = EgtUV( nCrv, nIn, -1) local vtPrev = EgtUV( nCrv, nIn, -1)
local vtNext = EgtUV( nCrv, nIn, 1) local vtNext = EgtUV( nCrv, nIn, 1)
-- se c'è perdita di tangenza (delta angolare oltre i 15 gradi) -- se c'è perdita di tangenza (delta angolare oltre i 5 gradi)
if vtPrev * vtNext < 0.966 then if vtPrev * vtNext < 0.996 then
-- lunghezza del tratto -- lunghezza del tratto
local ptP0 = EgtUP( nCrv, nOut) local ptP0 = EgtUP( nCrv, nOut)
local ptP1 = EgtUP( nCrv, nIn) local ptP1 = EgtUP( nCrv, nIn)
@@ -239,7 +214,6 @@ end
local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead) local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- recupero l'ingombro del grezzo di appartenenza -- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
local bContourFromDrill = EgtGetInfo( Proc.Id, Q_ONLY_CONTOUR, 'i') == 1
-- ingombro del pezzo -- ingombro del pezzo
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box') local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD) local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
@@ -260,22 +234,21 @@ 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 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, nil) local nChamfer, dDepthCham, sChamfer = VerifyChamfer( Proc, AuxId, nRawId, true)
-- recupero la lavorazione -- recupero la lavorazione
local bTopHead = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.1) local bTopHead = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.1)
local bDownHead = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1) local bDownHead = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1)
local sMilling, _, _, bH2 = ML.FindMilling( 'FreeContour', nil, nil, nil, nil, bTopHead, bDownHead) 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)
return false, sErr return false, sErr
end end
bDownHead = ( bDownHead and bH2)
local bToolInv = ( not bDownHead and vtExtr:getZ() < -0.1 and b3Aux:getDimZ() > b3Raw:getDimZ() - 5)
-- recupero i dati dell'utensile -- recupero i dati dell'utensile
local dToolDiam = 10 local dToolDiam = 10
local dMaxDepth = 0 local dMaxDepth = 0
@@ -306,18 +279,16 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
local bCross = false local bCross = false
if abs( vtExtr:getX()) < 0.707 then if abs( vtExtr:getX()) < 0.707 then
if abs( vtExtr:getY()) > abs( vtExtr:getZ()) then if abs( vtExtr:getY()) > abs( vtExtr:getZ()) then
-- se è passante
if b3Aux:getDimY() > b3Raw:getDimY() - 1.0 then if b3Aux:getDimY() > b3Raw:getDimY() - 1.0 then
bCross = true bCross = true
dDepth = min( dDepth, b3Raw:getDimY() / abs( vtExtr:getY())) dDepth = min( dDepth, b3Raw:getDimY() / abs( vtExtr:getY()))
end end
if bDown then if bDown then
nSide = -1 nSide = -1
else else
nSide = 1 nSide = 1
end end
else else
-- se è passante
if b3Aux:getDimZ() > b3Raw:getDimZ() - 1.0 then if b3Aux:getDimZ() > b3Raw:getDimZ() - 1.0 then
bCross = true bCross = true
dDepth = min( dDepth, b3Raw:getDimZ() / abs( vtExtr:getZ())) dDepth = min( dDepth, b3Raw:getDimZ() / abs( vtExtr:getZ()))
@@ -326,29 +297,24 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
local dOriDepth = dDepth local dOriDepth = dDepth
local nDouble = 1 local nDouble = 1
local bCanDouble = ( abs( vtExtr:getY()) > abs( vtExtr:getZ()) and bCross) or ( BD.DOWN_HEAD and bCross) local bCanDouble = ( abs( vtExtr:getY()) > abs( vtExtr:getZ()) and bCross)
local dDimStrip = BD.DIM_STRIP local dDimStrip = BD.DIM_STRIP
if dDimStrip < 0 then if dDimStrip < 0 then
dDimStrip = EgtGetInfo( Proc.Id, Q_DIM_STRIP, 'd') or 0 dDimStrip = EgtGetInfo( Proc.Id, Q_DIM_STRIP, 'd') or 0
end end
local bStripOnSide = false local bStripOnSide = false
if bCross then if bCross then
-- se forzata da parametro Q il codolo è sempre attivo if dDimStrip > 10 * GEO.EPS_SMALL and ( nStep > 1 or ( bDown and b3Aux:getDimX() > 0.5 * b3Raw:getDimX())) then
if dDimStrip > 10 * GEO.EPS_SMALL and ( BD.DIM_STRIP < 0 or nStep > 1 or ( bDown and b3Aux:getDimX() > 0.5 * b3Raw:getDimX())) then
-- devo lasciare un codolo -- devo lasciare un codolo
local dExtraCham = EgtIf( nChamfer > 0, 2, 0) dDepth = dDepth - dDimStrip
dDepth = EgtIf( Proc.Prc == 70, dDepth - dDimStrip - dDepthCham - dExtraCham, dDepth - dDimStrip)
bStripOnSide = true bStripOnSide = true
else else
-- devo affondare un poco oltre -- devo affondare un poco oltre
dDepth = dDepth + BD.CUT_EXTRA dDepth = dDepth + BD.CUT_EXTRA
end end
end end
local bIsDepthReduced = false
-- se parametro beamdata forza codolo in centro e lavorazione orizzontale e se larghezza trave è sufficientemente larga -- se parametro beamdata forza codolo in centro e lavorazione orizzontale e se larghezza trave è sufficientemente larga
-- se forzata da parametro Q il codolo è sempre attivo if BD.DIM_TO_CENTER_STRIP and BD.DIM_TO_CENTER_STRIP > 10 * GEO.EPS_SMALL and nStep > 1 and
local dDepthWork = dDepth
if BD.DIM_TO_CENTER_STRIP and BD.DIM_TO_CENTER_STRIP > 10 * GEO.EPS_SMALL and ( BD.DIM_STRIP < 0 or nStep > 1) and
bCanDouble and b3Raw:getDimY() > BD.DIM_TO_CENTER_STRIP - 0.1 then bCanDouble and b3Raw:getDimY() > BD.DIM_TO_CENTER_STRIP - 0.1 then
nDouble = 2 nDouble = 2
dDepth = min( ( b3Raw:getDimY() - dDimStrip) * 0.5, dMaxDepth) dDepth = min( ( b3Raw:getDimY() - dDimStrip) * 0.5, dMaxDepth)
@@ -357,23 +323,12 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
if dDepth > dMaxDepth then if dDepth > dMaxDepth then
if bCanDouble then if bCanDouble then
nDouble = 2 nDouble = 2
dDepthWork = 0.5 * dDepth dDepth = min( 0.5 * dDepth, dMaxDepth)
dDepth = min( dDepthWork, dMaxDepth)
if dDepth < dDepthWork - 10 * GEO.EPS_SMALL then
bIsDepthReduced = true
end
else else
dDepth = dMaxDepth dDepth = dMaxDepth
bIsDepthReduced = true
end end
end end
end end
local sWarn = ''
-- se ho ridotto l'altezza emetto warning
if bIsDepthReduced then
sWarn = 'Warning in process ' .. tostring( Proc.Id) .. ' (Free Contour) : depth (' .. EgtNumToString( dDepthWork, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
EgtOutLog( sWarn)
end
-- se utensile orizzontale verso Y+, non in doppio e codolo da lasciare, devo invertire per lavorare sempre da Y- -- se utensile orizzontale verso Y+, non in doppio e codolo da lasciare, devo invertire per lavorare sempre da Y-
if vtExtr:getY() > 0.707 and nDouble == 1 and bStripOnSide then if vtExtr:getY() > 0.707 and nDouble == 1 and bStripOnSide then
bToolInv = true bToolInv = true
@@ -384,37 +339,14 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
local dEndAddSpec = 0 local dEndAddSpec = 0
if Proc.Grp ~= 0 then dEndAddSpec = CalcSpecialAdd( AuxId, false, dToolDiam) end if Proc.Grp ~= 0 then dEndAddSpec = CalcSpecialAdd( AuxId, false, dToolDiam) end
-- se devo inserire il chamfer -- se devo inserire il chamfer
if nChamfer > 0 and Proc.Grp ~= 0 and dOriDepth > dDepthCham and Proc.Prc ~= 70 then if nChamfer > 0 and Proc.Grp ~= 0 and dOriDepth > dDepthCham then
local bDoubleCham = false local bDoubleCham = false
local dExtra = 2 local dExtra = 2
local sChamferDown, sChamferUp
if nDouble > 1 and bCanDouble then
if nSide == 0 then
if BD.DOWN_HEAD then
-- recupero la lavorazione
local nChamferDown
nChamferDown, _, sChamferDown = VerifyChamfer( Proc, AuxId, nRawId, true, true)
if nChamferDown < 0 then
sWarn = 'Warning : chamfer from bottom not found in library'
sChamferDown = nil
EgtOutLog( sWarn)
end
end
local nChamferUp
nChamferUp, _, sChamferUp = VerifyChamfer( Proc, AuxId, nRawId, true, false)
if nChamferUp < 0 then
sWarn = 'Warning : chamfer from bottom not found in library'
sChamferUp = nil
EgtOutLog( sWarn)
end
end
end
-- eseguo -- eseguo
for i = 1, nStep do for i = 1, nStep do
-- inserisco la lavorazione -- inserisco la lavorazione
local sNameCh = 'Cham_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local sNameCh = 'Cham_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local sChamferSide1 = EgtIf( bDownHead, sChamferDown, sChamfer) local nMchId = EgtAddMachining( sNameCh, sChamfer)
local nMchId = EgtAddMachining( sNameCh, sChamferSide1)
if not nMchId then if not nMchId then
local sErr = 'Error adding machining ' .. sNameCh .. '-' .. sChamfer local sErr = 'Error adding machining ' .. sNameCh .. '-' .. sChamfer
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -423,12 +355,15 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}}) EgtSetMachiningGeometry( {{ AuxId, -1}})
-- se lavorazione da sopra o da sotto -- se lavorazione da sopra o da sotto
if nSide ~= 0 then
bDoubleCham = true
end
if Proc.Grp == 3 then if Proc.Grp == 3 then
if not bToolInv then if not bToolInv then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
else else
if not bDownHead and vtExtr:getZ() < 0 then if vtExtr:getZ() < 0 then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
@@ -443,7 +378,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
else else
if not bDownHead and vtExtr:getZ() < 0 then if vtExtr:getZ() < 0 then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
@@ -452,11 +387,6 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
end end
end end
if nSide == 0 then
bDoubleCham = EgtIf( sChamferDown and BD.DOWN_HEAD, true, false) and bCanDouble
else
bDoubleCham = bCanDouble
end
-- assegno affondamento e offset radiale -- assegno affondamento e offset radiale
EgtSetMachiningParam( MCH_MP.DEPTH, dDepthCham + dExtra) EgtSetMachiningParam( MCH_MP.DEPTH, dDepthCham + dExtra)
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra) EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
@@ -476,9 +406,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
-- posizione braccio porta testa -- posizione braccio porta testa
local nSCC = MCH_SCC.NONE local nSCC = MCH_SCC.NONE
if BD.TURN == 2 then if not BD.C_SIMM then
nSCC = MCH_SCC.ADIR_ZP
elseif not BD.C_SIMM then
if Proc.Head then if Proc.Head then
nSCC = MCH_SCC.ADIR_XP nSCC = MCH_SCC.ADIR_XP
elseif Proc.Tail then elseif Proc.Tail then
@@ -498,19 +426,12 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
end end
-- se lavorazione da due parti, aggiungo la seconda -- se lavorazione da due parti, aggiungo la seconda
if bDoubleCham then if bDoubleCham then
-- inserisco la lavorazione -- inserisco la lavorazione
local sName = 'ChamB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local sName = 'ChamB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local sChamferSide2 local nMchId = EgtAddMachining( sName, sChamfer)
if EgtEndsWith( sChamferSide1, 'H2') then
sChamferSide2 = sChamferUp
elseif nSide == 0 then
sChamferSide2 = sChamferDown
else
sChamferSide2 = sChamfer
end
nMchId = EgtAddMachining( sName, sChamferSide2)
if not nMchId then if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sChamfer local sErr = 'Error adding machining ' .. sName .. '-' .. sChamfer
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -546,9 +467,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
-- posizione braccio porta testa -- posizione braccio porta testa
local nSCC = MCH_SCC.NONE local nSCC = MCH_SCC.NONE
if BD.TURN == 2 then if not BD.C_SIMM then
nSCC = MCH_SCC.ADIR_ZP
elseif not BD.C_SIMM then
if Proc.Head then if Proc.Head then
nSCC = MCH_SCC.ADIR_XP nSCC = MCH_SCC.ADIR_XP
elseif Proc.Tail then elseif Proc.Tail then
@@ -573,33 +492,6 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
-- verifico se devo fare sgrossatura più finitura -- verifico se devo fare sgrossatura più finitura
local dOffsetPar = EgtGetInfo( Proc.Id, Q_OVERMAT_FOR_FINISH, 'i') or 0 local dOffsetPar = EgtGetInfo( Proc.Id, Q_OVERMAT_FOR_FINISH, 'i') or 0
-- nel caso di lavorazioni sopra/sotto cerco lavorazioni specifiche
local sMillingDown, sMillingUp
if nDouble > 1 and bCanDouble then
if nSide == 0 then
if BD.DOWN_HEAD then
-- recupero la lavorazione
sMillingDown = ML.FindMilling( 'FreeContour_H2', nil, nil, nil, nil, false, true)
if not sMillingDown then
nDouble = 1
dDepth = min( dOriDepth, dMaxDepth)
sWarn = 'Warning in process ' .. tostring( Proc.Id) .. ' (Free Contour) : milling from bottom not found in library' .. '\n' ..
'; depth (' .. EgtNumToString( dOriDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
EgtOutLog( sWarn)
elseif sMillingDown and not bDownHead then
bToolInv = true
sMilling = sMillingDown
end
end
sMillingUp = ML.FindMilling( 'FreeContour', nil, nil, nil, nil, true, false)
if not sMillingUp then
sWarn = 'Warning : milling not found in library'
EgtOutLog( sWarn)
end
end
end
-- eventuale inversione ultimo segmento
local bInvertLastPath = ( ( EgtGetInfo( Proc.Id, Q_INVERT_LAST_PATH, 'd') or 0) == 1)
-- eseguo -- eseguo
for i = 1, nStep do for i = 1, nStep do
for j = 1, nDouble do for j = 1, nDouble do
@@ -624,107 +516,50 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
else else
-- inserisco la lavorazione -- inserisco la lavorazione
sName = 'Free_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) sName = 'Free_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
if EgtEndsWith( sMilling, '_H2') then nMchId = EgtAddMachining( sName, sMilling)
nMchId = EgtAddMachining( sName, EgtIf( j == 2 and nSide == 0, sMillingUp, sMilling))
elseif sMillingDown then
nMchId = EgtAddMachining( sName, EgtIf( j == 2 and nSide == 0, sMillingDown, sMilling))
else
nMchId = EgtAddMachining( sName, sMilling)
end
if not nMchId then if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- eventuale elevazione forzata
local dCustomMaxElev = EgtGetInfo( Proc.Id, Q_MAX_ELEVATION, 'd')
if dCustomMaxElev and dCustomMaxElev < 1 then dCustomMaxElev = nil end
if dCustomMaxElev then
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or ''
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dCustomMaxElev, 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
end
-- assegno affondamento -- assegno affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
end end
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}}) EgtSetMachiningGeometry( {{ AuxId, -1}})
-- eventuale accorciamento di testa -- eventuale accorciamento di testa
local dStartAddLen, dEndAddLen, dWorkSide, bToolInvert, bInvert
if ( j == 1 and i > 1) or ( j == 2 and i < nStep) then if ( j == 1 and i > 1) or ( j == 2 and i < nStep) then
dStartAddLen = EgtIf( j == 1, - ( i - 1) * dStep, - ( nStep - i) * dStep) local dStartAddLen = EgtIf( j == 1, - ( i - 1) * dStep, - ( nStep - i) * dStep)
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dStartAddLen)
else else
dStartAddLen = EgtIf( j == 1, dStartAddSpec, dEndAddSpec) EgtSetMachiningParam( MCH_MP.STARTADDLEN, EgtIf( j == 1, dStartAddSpec, dEndAddSpec))
end end
-- eventuale accorciamento di coda -- eventuale accorciamento di coda
if ( j == 1 and i < nStep) or ( j == 2 and i > 1) then if ( j == 1 and i < nStep) or ( j == 2 and i > 1) then
dEndAddLen = EgtIf( j == 1, - ( nStep - i) * dStep, - ( i - 1) * dStep) local dEndAddLen = EgtIf( j == 1, - ( nStep - i) * dStep, - ( i - 1) * dStep)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
else else
dEndAddLen = EgtIf( j == 1, dEndAddSpec, dStartAddSpec) EgtSetMachiningParam( MCH_MP.ENDADDLEN, EgtIf( j == 1, dEndAddSpec, dStartAddSpec))
end end
-- se estrusione da sotto, inverto direzione fresa -- se estrusione da sotto, inverto direzione fresa
if ( j == 1 and bToolInv) or ( j == 2 and not bToolInv) then if ( j == 1 and bToolInv) or ( j == 2 and not bToolInv) then
bToolInvert = true EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
else
bToolInvert = false
end end
-- se seconda passata, inverto direzione di lavoro -- se seconda passata, inverto direzione di lavoro
if j == 2 then if j == 2 then
bInvert = true EgtSetMachiningParam( MCH_MP.INVERT, true)
else
bInvert = false
end end
-- assegno lato di lavoro -- assegno lato di lavoro
if bContourFromDrill then if Proc.Grp == 0 then
dWorkSide = MCH_MILL_WS.LEFT EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.CENTER)
elseif Proc.Grp == 0 then elseif ( Proc.Grp == 3 and not bToolInv) or ( Proc.Grp == 4 and bToolInv) then
dWorkSide = MCH_MILL_WS.CENTER EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
elseif ( Proc.Grp == 3 and not bToolInv) or ( Proc.Grp == 4 and bToolInv) or ( Proc.Grp == 1 and bToolInv) or ( Proc.Grp == 2 and bToolInv) then elseif ( Proc.Grp == 3 and bToolInv) or ( Proc.Grp == 4 and not bToolInv) then
dWorkSide = MCH_MILL_WS.LEFT EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
elseif ( Proc.Grp == 3 and bToolInv) or ( Proc.Grp == 4 and not bToolInv) or ( Proc.Grp == 1 and not bToolInv) or ( Proc.Grp == 2 and not bToolInv) then
dWorkSide = MCH_MILL_WS.RIGHT
end end
-- se ultimo step da invertire
if i == nStep and bInvertLastPath then
-- se profilo orizzontale
if abs( vtExtr:getZ()) < 10 * GEO.EPS_SMALL then
dStartAddLen, dEndAddLen = dEndAddLen, dStartAddLen
bInvert = not( bInvert)
bToolInvert = not( bToolInvert)
else
dStartAddLen, dEndAddLen = dEndAddLen, dStartAddLen
bInvert = not( bInvert)
if dWorkSide == MCH_MILL_WS.LEFT then
dWorkSide = MCH_MILL_WS.RIGHT
elseif dWorkSide == MCH_MILL_WS.RIGHT then
dWorkSide = MCH_MILL_WS.LEFT
end
end
end
-- setto i valori
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dStartAddLen)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
EgtSetMachiningParam( MCH_MP.TOOLINVERT, bToolInvert)
EgtSetMachiningParam( MCH_MP.INVERT, bInvert)
EgtSetMachiningParam( MCH_MP.WORKSIDE, dWorkSide)
-- setto valori specifici se lavorazione nel pieno del solo contorno di un foro
if bContourFromDrill then
local dWorkStep = max( ( EgtGetMachiningParam( MCH_MP.STEP) or 0) * 0.75, dToolDiam)
EgtSetMachiningParam( MCH_MP.STEP, dWorkStep)
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.GLIDE)
EgtSetMachiningParam( MCH_MP.LIELEV, dWorkStep)
EgtSetMachiningParam( MCH_MP.LITANG, dWorkStep)
end
-- posizione braccio porta testa -- posizione braccio porta testa
local nSCC = MCH_SCC.NONE local nSCC = MCH_SCC.NONE
if BD.TURN == 2 then if not BD.C_SIMM then
nSCC = MCH_SCC.ADIR_ZP
elseif not BD.C_SIMM then
if Proc.Head then if Proc.Head then
nSCC = MCH_SCC.ADIR_XP nSCC = MCH_SCC.ADIR_XP
elseif Proc.Tail then elseif Proc.Tail then
@@ -779,14 +614,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
-- eventuale segnalazione ingombro di testa o coda -- eventuale segnalazione ingombro di testa o coda
local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ()) local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ())
local dMinZ = max( BD.MIN_HEIGHT, 0.35 * b3Raw:getDimZ()) if Proc.Box:getDimZ() > 0.75 * b3Raw:getDimZ() and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then
local bRawPartHas90Rotation = ( ( EgtGetInfo( nRawId, 'ROTATE90', 'd') or 0) == 1)
-- eventuale forzatura area feature pinzabile
local bForceClampableArea = ( ( EgtGetInfo( Proc.Id, Q_FORCE_CLAMPABLE_AREA, 'd') or 0) == 1)
-- se la feature è passante top/down oppure se è passante e si ruota di 90deg considero sempre non pinzabile; in alternativa si valuta in base all'ingombro
if not bForceClampableArea and ( ( Proc.Box:getDimZ() > 0.75 * b3Raw:getDimZ() and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinZ) or
( Proc.AffectedFaces.Top and Proc.AffectedFaces.Bottom and ( AreSameOrOppositeVectorApprox( vtExtr, Z_AX()))) or
( Proc.AffectedFaces.Front and Proc.AffectedFaces.Back and bRawPartHas90Rotation)) 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()
BL.UpdateHCING( nRawId, dOffs) BL.UpdateHCING( nRawId, dOffs)
@@ -795,8 +623,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
BL.UpdateTCING( nRawId, dOffs) BL.UpdateTCING( nRawId, dOffs)
end end
end end
return true
return true, sWarn
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
@@ -812,74 +639,8 @@ local function MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- recupero i dati della curva e del profilo -- recupero i dati della curva e del profilo
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 bDownHead = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1) --local bToolInv = ( vtExtr:getZ() < -0.1)
local bToolInv = ( not bDownHead and vtExtr:getZ() < -0.1 and b3Aux:getDimZ() > b3Raw:getDimZ() - 5) -- recupero la lavorazione
local dExtra = 2
-- verifico se servono gli smussi. Se lavorazione principale di svuotatura significa che è solo da un lato
-- generalmente sono lavorazioni non molto lunghe, quindi non si gestistono gli step
-- verifico i parametri Q per profondità smusso e per eseguirlo in esclusiva
local nChamfer, dDepthCham, sChamfer = VerifyChamfer( Proc, AuxId, nRawId, true)
-- se devo inserire il chamfer
if nChamfer > 0 and Proc.Grp ~= 0 and dDepth > dDepthCham and Proc.Prc ~= 70 then
-- inserisco la lavorazione
local sNameCh = 'Cham_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sNameCh, sChamfer)
if not nMchId then
local sErr = 'Error adding machining ' .. sNameCh .. '-' .. sChamfer
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- se lavorazione da sopra o da sotto
if Proc.Grp == 3 then
if not bToolInv then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
EgtSetMachiningParam( MCH_MP.INVERT, true)
else
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
EgtSetMachiningParam( MCH_MP.INVERT, true)
end
end
if Proc.Grp == 4 then
if not bToolInv then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
EgtSetMachiningParam( MCH_MP.INVERT, true)
else
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
end
end
-- assegno affondamento e offset radiale
EgtSetMachiningParam( MCH_MP.DEPTH, dDepthCham + dExtra)
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
-- posizione braccio porta testa
local nSCC = MCH_SCC.NONE
if BD.TURN == 2 then
nSCC = MCH_SCC.ADIR_ZP
elseif not BD.C_SIMM then
if Proc.Head then
nSCC = MCH_SCC.ADIR_XP
elseif Proc.Tail then
nSCC = MCH_SCC.ADIR_XM
elseif AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then
nSCC = MCH_SCC.ADIR_YP
elseif vtExtr:getY() > -0.01 then
nSCC = MCH_SCC.ADIR_YP
else
nSCC = MCH_SCC.ADIR_YM
end
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
end
end
-- recupero la lavorazione di svuotatura
local sPocketing = ML.FindPocketing( 'Pocket', nil, dDepth) local sPocketing = ML.FindPocketing( 'Pocket', nil, dDepth)
if not sPocketing then if not sPocketing then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' pocketing not found in library' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' pocketing not found in library'
@@ -920,14 +681,7 @@ local function MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- imposto elevazione -- imposto elevazione
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxDepth, 1) .. ';')
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dMaxDepth, 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- imposto eventuale offset radiale, se impostato dall'utente
local dRadialOffset = EgtGetInfo( Proc.Id, Q_RADIAL_OFFSET, 'd') or 0
if abs( dRadialOffset) > 10 * GEO.EPS_SMALL then
EgtSetMachiningParam( MCH_MP.OFFSR, -dRadialOffset)
end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
@@ -938,9 +692,7 @@ local function MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function MakeByMark( Proc, nRawId, nPartId) local function MakeByMark( Proc, nRawId, b3Raw, nPartId)
-- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo -- ingombro del pezzo
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box') local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD) local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
@@ -960,7 +712,6 @@ local function MakeByMark( Proc, nRawId, nPartId)
-- recupero i dati della curva e del profilo -- recupero i dati della curva e del profilo
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 bToolInv = ( vtExtr:getZ() < -0.1 and b3Aux:getDimZ() > b3Raw:getDimZ() - 5) local bToolInv = ( vtExtr:getZ() < -0.1 and b3Aux:getDimZ() > b3Raw:getDimZ() - 5)
-- 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 and not BD.TURN then
@@ -1013,15 +764,6 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessFreeContour.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) function ProcessFreeContour.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- riassegno Q nel caso la funzione sia richiamata da un'altra make
if Proc.Prc == 70 then
Q_DEPTH_CHAMFER = 'Q01'
Q_DIM_STRIP = 'Q02'
end
if Proc.Prc == 40 then
Q_DIM_STRIP = ''
Q_OVERMAT_FOR_FINISH = ''
end
-- recupero la tipologia -- recupero la tipologia
local bPocket = ( EgtGetInfo( Proc.Id, 'PCKT', 'i') == 1) local bPocket = ( EgtGetInfo( Proc.Id, 'PCKT', 'i') == 1)
-- se svuotatura -- se svuotatura
@@ -1033,7 +775,7 @@ function ProcessFreeContour.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
local nCntType = EgtGetInfo( Proc.Id, 'CNT_TYPE', 'i') or 0 local nCntType = EgtGetInfo( Proc.Id, 'CNT_TYPE', 'i') or 0
-- se marcatura -- se marcatura
if nCntType == 10 then if nCntType == 10 then
return MakeByMark( Proc, nRawId, nPartId) return MakeByMark( Proc, nRawId, b3Raw, nPartId)
-- se fresatura -- se fresatura
else else
return MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead) return MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
+86 -439
View File
@@ -1,16 +1,8 @@
-- ProcessSplit.lua by Egaltech s.r.l. 2022/09/26 -- ProcessSplit.lua by Egaltech s.r.l. 2022/08/18
-- 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/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/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. -- 2022/08/18 Aggiunta gestione macchine con testa da sotto con lama da sotto disabilitata.
-- 2022/09/08 Migliorato verso di lavorazione in caso di DoubleCut
-- 2022/11/02 Corretti accorciamenti per DoubleCut
-- 2022/11/10 Corrette finiture lama per BigSection con trave alta
-- 2023/04/20 Per travi alte aggiunti tagli orizzontali per ridurre le dimensioni degli scarti
-- 2023/08/02 Corretto calcolo allungamenti/accorciamenti pezzi alti per contemplare anche taglio singolo
-- 2023/10/17 Corretto calcolo allungamenti/accorciamenti per evitare lunghezze del percorso negative
-- 2024/01/18 Gestiti tagli verticali aggiuntivi per travi larghe.
-- 2024/01/22 Nei tagli verticali aggiuntivi si usa ora BD.MAX_LEN_DICE come dimensione (era BD.MAX_DIM_DICE).
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessHeadCut = {} local ProcessHeadCut = {}
@@ -21,8 +13,6 @@ local BL = require( 'BeamLib')
local Fbs = require( 'FacesBySaw') local Fbs = require( 'FacesBySaw')
local Cut = require( 'ProcessCut') local Cut = require( 'ProcessCut')
local Pocket = require( 'FaceByPocket') local Pocket = require( 'FaceByPocket')
local Topology = require( 'FeatureTopology')
local Split = require( 'ProcessSplit')
EgtOutLog( ' ProcessHeadCut started', 1) EgtOutLog( ' ProcessHeadCut started', 1)
@@ -30,10 +20,6 @@ EgtOutLog( ' ProcessHeadCut started', 1)
local BD = require( 'BeamData') local BD = require( 'BeamData')
local ML = require( 'MachiningLib') local ML = require( 'MachiningLib')
if BD.PRECUT_HEAD == nil then
BD.PRECUT_HEAD = true
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Riconoscimento della feature -- Riconoscimento della feature
function ProcessHeadCut.Identify( Proc) function ProcessHeadCut.Identify( Proc)
@@ -130,7 +116,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch1Id, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
end end
-- Inserisco la lavorazione del lato opposto -- Inserisco la lavorazione del lato opposto
@@ -153,310 +139,12 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch1Id, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
end end
return true, nil return true, nil
end end
---------------------------------------------------------------------
-- smussi in testa
local function MakeHeadChamfer( idProc, nPartId)
local dDepthHeadChamfer = EgtGetInfo( idProc, 'Q08', 'd') or 0
-- se non attivo esco subito
if dDepthHeadChamfer < 100 * GEO.EPS_SMALL then
return
end
-- recupero gruppo per geometria aggiuntiva
local AddGrpId = BL.GetAddGroup( nPartId)
if not AddGrpId then
local sErr = 'Error on process StartFace impossible to find AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- recupero la lavorazione
local sMilling = ML.FindMilling( 'Mark')
if not sMilling then
local sErr = 'Error : milling not found in library'
EgtOutLog( sErr)
return false, sErr
end
local nLoopId, nLoopCnt = EgtExtractSurfTmFacetLoops( idProc, 0, AddGrpId)
if not nLoopId or nLoopCnt > 1 then
local sErr = 'Error MakeHeadChamfer : too many loops'
EgtOutLog( sErr)
return false, sErr
end
-- setto direzione estrusione corretta
EgtModifyCurveExtrusion( nLoopId, X_AX())
EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.RIGHT))
local dQ09Value = EgtGetInfo( idProc, 'Q09', 'd')
if not dQ09Value then
dQ09Value = 0.1
end
local bChamferedEdge = dQ09Value > 0
dQ09Value = EgtIf( bChamferedEdge, max( dQ09Value, 0.1), min( dQ09Value, -0.1))
local nIdFirstEntity, nEntityCnt = EgtExplodeCurveCompo( nLoopId)
local p3MidPoint = EgtMP( nIdFirstEntity, GDB_ID.GRID)
for i = 0, nEntityCnt - 1 do
if EgtCurveLength( nIdFirstEntity + i) - 10 < abs( dQ09Value) * 2 then
local sErr = 'Error MakeHeadChamfer : Q09 too high'
EgtOutLog( sErr)
return false, sErr
end
end
-- creo raccordo o fillet
for i = 0, nEntityCnt - 1 do
local idFirst = nIdFirstEntity + i
local idSecond = EgtIf( i == nEntityCnt - 1, nIdFirstEntity, idFirst + 1)
local ptEndPointFirst = EgtEP( idFirst, GDB_ID.GRID) - ( abs( dQ09Value) * EgtEV( idFirst, GDB_ID.GRID))
local ptStartPointSecond = EgtSP( idSecond, GDB_ID.GRID) + ( abs( dQ09Value) * EgtEV( idSecond, GDB_ID.GRID))
if bChamferedEdge then
EgtCurveChamfer( AddGrpId, idFirst, ptEndPointFirst, idSecond, ptStartPointSecond, abs( dQ09Value), true, GDB_RT.GRID)
else
EgtCurveFillet( AddGrpId, idFirst, ptEndPointFirst, idSecond, ptStartPointSecond, abs( dQ09Value), true, GDB_RT.GRID)
end
end
EgtSelectPathObjs( nIdFirstEntity, true)
local idGeom, idGeomCnt = EgtCurveCompoByChain( AddGrpId, GDB_ID.SEL, {0,0,0}, true)
if not idGeom or idGeomCnt > 1 then
local sErr = 'Error MakeHeadChamfer : too many loops'
EgtOutLog( sErr)
return false, sErr
end
EgtChangeClosedCurveStartPoint( idGeom, p3MidPoint, GDB_RT.GRID)
-- reimposto la griglia
EgtSetGridFrame()
-- Inserisco la lavorazione del lato standard
local dExtra = 2
local sName1 = 'HeadCham_' .. ( EgtGetName( idProc) or tostring( idProc))
local nMch1Id = EgtAddMachining( sName1, sMilling)
if not nMch1Id then
local sErr = 'Error adding machining ' .. sName1 .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ idGeom, -1}})
-- assegno affondamento e offset radiale
EgtSetMachiningParam( MCH_MP.DEPTH, dDepthHeadChamfer + dExtra)
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch1Id, false)
return false, sErr
end
return true, nil
end
---------------------------------------------------------------------
-- tagli verticali aggiuntivi
local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw, dOffsetBetweenCuts)
local nVerticalCuts = ceil( Proc.Face[1].WidthTrimmed / ( BD.MAX_LEN_DICE)) - 1
local dVerticalSliceHeight = Proc.Face[1].WidthTrimmed / ( nVerticalCuts + 1)
-- recupero il diametro dell'utensile
local dSawDiam = 400
if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
end
end
local bOk, sErr
-- tagli orizzontali
for j = nVerticalCuts, 1, -1 do
local nFaceUse = MCH_MILL_FU.PARAL_FRONT
local dVerticalCutOffset = dVerticalSliceHeight * -j
local sLeadInOutType = 'PerpendicularOutraw'
bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, '', b3Raw, nil, nil, nil, sLeadInOutType, nil, dOffsetBetweenCuts)
if not bOk then return bOk, sErr end
end
return bOk, sErr
end
---------------------------------------------------------------------
-- tagli standard
local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCutType, Cutting1Data, Cutting2Data, dStartOffset, dOvmHead)
local PrecutType = { bBigSectionCut = HeadCutType.bBigSectionCut, bHorizCut = HeadCutType.bHorizCut, bDoubleHorizCut = HeadCutType.bDoubleHorizCut, bDoubleCut = HeadCutType.bDoubleCut, sType = 'Precut', bNeedVerticalAddedCuts = false, bNeedHorizontalAddedCuts = false}
if not HeadCutType.bDoubleHorizCut then
-- flag di lavorazione faccia
local nOrthoOpposite = EgtIf( HeadCutType.bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_FRONT)
-- calcolo extra taglio ed accorciamento
local dCutExtra = 0
local dAccStart = 0
local dAccEnd = 0
if b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL or b3Raw:getDimY() < 2 * BD.MAX_DIM_HTCUT_HBEAM + 10 * GEO.EPS_SMALL then
dCutExtra = EgtIf( HeadCutType.bDoubleCut, - 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN, BD.CUT_EXTRA)
else
dCutExtra = - ( b3Raw:getDimY() - Cutting1Data.dMaxDepth)
local dSawRad = Cutting1Data.dSawDiam / 2
-- distanza in Y tra il centro della lama e l'intersezione tra la lama stessa e la massima Z della trave, + extra
-- se taglio doppio l'intersezione sarà in mezzeria, se taglio singolo sarà all'estremo opposto della trave
local dKL = dSawRad - Cutting1Data.dMaxDepth + EgtIf( HeadCutType.bDoubleCut, b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN, b3Raw:getDimY() + BD.CUT_EXTRA)
-- lunghezza minima del percorso di lavorazione, in caso accorciamento porti a lunghezza negativa
local dMinSawingLength = 5
if BD.C_SIMM then
dAccEnd = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0))
-- non posso comunque accorciare più della dimensione della geometria, quindi in caso allungo entrata
if dAccEnd > b3Raw:getDimZ() - 100 * GEO.EPS_SMALL then
dAccStart = b3Raw:getDimZ() - dAccEnd - dMinSawingLength
end
else
dAccStart = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0))
-- non posso comunque accorciare più della dimensione della geometria, quindi in caso allungo uscita
if dAccStart > b3Raw:getDimZ() - 100 * GEO.EPS_SMALL then
dAccEnd = b3Raw:getDimZ() - dAccStart - dMinSawingLength
end
end
end
-- per travi alte faccio dei tagli orizzontali aggiuntivi
if HeadCutType.bNeedHorizontalAddedCuts then
-- taglio a zero (con lama) per evitare problemi con grezzo più lungo del previsto. Se BigSection il pretaglio è già stato fatto.
if not ( HeadCutType.bBigSectionCut) and BD.PRECUT_HEAD then
dStartOffset = dOvmHead
local bOkPrecut, sErrPrecut = MakeStandardCuts( Proc, b3Raw, 1, 0, PrecutType, Cutting1Data, Cutting2Data, dStartOffset)
if not bOkPrecut then
return false, sErrPrecut
end
end
local nHorizontalCuts = ceil( Proc.Face[1].HeightTrimmed / BD.MAX_DIM_DICE) - 1
local dHorizontalSliceHeight = Proc.Face[1].HeightTrimmed / ( nHorizontalCuts + 1)
for i = nCuts, 1, -1 do
local dCutXOffset = ( i - 1) * dOffsetBetweenCuts
-- tagli orizzontali
for j = nHorizontalCuts, 1, -1 do
local nFaceUse = MCH_MILL_FU.PARAL_DOWN
local dHorizontalCutOffset = dHorizontalSliceHeight * -j
local sLeadInOutType = 'PerpendicularOutraw'
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dHorizontalCutOffset, 0, 0, '', b3Raw, nil, nil, nil, sLeadInOutType, nil, dOffsetBetweenCuts)
if not bOk then return bOk, sErr end
end
-- se necessario taglio verticale doppio, eseguo l'opposto
if HeadCutType.bDoubleCut then
-- gli accorciamenti vanno invertiti per il taglio opposto
local dAccStartDoubleCut, dAccEndDoubleCut = dAccEnd, dAccStart
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, MCH_MILL_FU.ORTHO_BACK, nil, dCutExtra, BD.CUT_SIC, dCutXOffset, dAccStartDoubleCut, dAccEndDoubleCut, '', b3Raw, true)
if not bOk then return false, sErr end
end
-- taglio verticale
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutXOffset, dAccStart, dAccEnd, '', b3Raw, true)
if not bOk then return bOk, sErr end
end
return true, sWarn
end
-- taglio a zero (con lama) per evitare problemi con grezzo più lungo del previsto. Se BigSection il pretaglio è già stato fatto.
if not ( HeadCutType.bBigSectionCut) and BD.PRECUT_HEAD and HeadCutType.bNeedVerticalAddedCuts then
dStartOffset = dOvmHead
local bOkPrecut, sErrPrecut = MakeStandardCuts( Proc, b3Raw, 1, 0, PrecutType, Cutting1Data, Cutting2Data, dStartOffset)
if not bOkPrecut then
return false, sErrPrecut
end
end
-- se necessari tagli in doppio, eseguo gli opposti
if HeadCutType.bDoubleCut then
-- gli accorciamenti vanno invertiti per il taglio opposto
local dAccStartDoubleCut, dAccEndDoubleCut = dAccEnd, dAccStart
for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsetBetweenCuts
if i == 1 and HeadCutType.sType =='Precut' then
dCutOffset = dStartOffset
end
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, MCH_MILL_FU.ORTHO_BACK, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStartDoubleCut, dAccEndDoubleCut, '', b3Raw, true)
if not bOk then return false, sErr end
end
end
-- eseguo i tagli necessari
for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsetBetweenCuts
-- se trave larga effettuo tagli verticali aggiuntivi
if HeadCutType.bNeedVerticalAddedCuts then
local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw, dOffsetBetweenCuts)
if not bOk then return bOk, sErr end
end
if i == 1 and HeadCutType.sType =='Precut' then
dCutOffset = dStartOffset
end
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, '', b3Raw, true)
if not bOk then return false, sErr end
end
-- altrimenti necessari tagli da sopra e sotto con testa opportuna
else
-- verifico esistenza della lavorazione con lama da sotto
if not Cutting2Data.sCutting then
local sErr = 'Error : cutting H2 not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- verifico che le due lame riescano a lavorare la sezione
local dDimZ = b3Raw:getDimZ()
local dExtra = Cutting1Data.dMaxVertDepth + Cutting2Data.dMaxDepth - dDimZ
if ( dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0) and not HeadCutType.bBigSectionCut then
local sErr = 'Error : section too big for head cut'
EgtOutLog( sErr)
return false, sErr
end
-- calcolo extra taglio ed accorciamento
local dCutExtra = -Cutting2Data.dMaxDepth + dExtra / 2 + BD.CUT_EXTRA_MIN
local dCutExtra2 = -Cutting1Data.dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN
local dAccStart = 0
local dVzLimDwnUp
if BD.TURN then dVzLimDwnUp = -2 end
-- taglio a zero (con lama) per evitare problemi con grezzo più lungo del previsto. Se BigSection il pretaglio è già stato fatto.
if not ( HeadCutType.bBigSectionCut) and BD.PRECUT_HEAD and HeadCutType.bNeedVerticalAddedCuts then
dStartOffset = dOvmHead
local bOkPrecut, sErrPrecut = MakeStandardCuts( Proc, b3Raw, 1, 0, PrecutType, Cutting1Data, Cutting2Data, dStartOffset)
if not bOkPrecut then
return false, sErrPrecut
end
end
-- eseguo i tagli da sotto necessari
for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsetBetweenCuts
if i == 1 and HeadCutType.sType =='Precut' then
dCutOffset = dStartOffset
end
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting2Data.sCutting, Cutting2Data.dSawDiam, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw, nil, true)
if not bOk then return false, sErr end
end
-- eseguo i tagli da sopra necessari
for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsetBetweenCuts
if i == 1 and HeadCutType.sType =='Precut' then
dCutOffset = dStartOffset
end
-- se trave larga effettuo tagli verticali aggiuntivi
if HeadCutType.bNeedVerticalAddedCuts then
local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw, dOffsetBetweenCuts)
if not bOk then return bOk, sErr end
end
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, MCH_MILL_FU.ORTHO_DOWN, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw)
if not bOk then return false, sErr end
end
end
return true
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut) function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut)
@@ -468,18 +156,8 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
local bOkc, sErrC = MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead) local bOkc, sErrC = MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
if not bOkc then return bOkc, sErrC end if not bOkc then return bOkc, sErrC end
end end
-- eventuali informazioni sul tipo di finitura
local nQ05 = EgtGetInfo( nOriId or GDB_ID.NULL, 'Q05', 'i') or 0
-- recupero la lavorazione -- recupero la lavorazione
-- TODO questa parte andrà cambiata quando si gestiranno i volumi liberi in cui girare da mlse local sCutting = ML.FindCutting( 'HeadSide')
local dMinWidthForBigBlade = 300
local dMaxHeightForBigBlade = 300
local sCutting
if b3Raw:getDimY() > dMinWidthForBigBlade and b3Raw:getDimZ() < dMaxHeightForBigBlade then
sCutting = ML.FindCutting( 'HeadSide', nil, nil, nil, 'Longest')
else
sCutting = ML.FindCutting( 'HeadSide')
end
if not sCutting then if not sCutting then
local sErr = 'Error : cutting not found in library' local sErr = 'Error : cutting not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -488,13 +166,11 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
-- recupero i dati dell'utensile -- recupero i dati dell'utensile
local dSawDiam = 400 local dSawDiam = 400
local dMaxDepth = 50 local dMaxDepth = 50
local dSawThick = 2
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
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
dSawThick = EgtTdbGetCurrToolParam(MCH_TP.THICK) or dSawThick
end end
end end
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0) local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
@@ -503,122 +179,38 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
-- recupero i dati della eventuale seconda lama -- recupero i dati della eventuale seconda lama
local dSawDiam2 = 0 local dSawDiam2 = 0
local dMaxDepth2 = 0 local dMaxDepth2 = 0
local dSawThick2 = 0
if sCutting2 and EgtMdbSetCurrMachining( sCutting2) then if sCutting2 and EgtMdbSetCurrMachining( sCutting2) then
local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2 dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2
dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2 dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
dSawThick2 = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick2
end end
end end
-- determino se lo spessore del materiale da rimuovere è eccessivo e quindi vanno fatti più tagli con offset
local nCuts = max( ceil( dOvmHead / (( BD.MAX_LEN_SCRAP_START or BD.MAX_LEN_SCRAP) + 0.5)), 1)
local dOffsL = dOvmHead / nCuts
-- caratteristiche taglio -- caratteristiche taglio
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM)) local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM))
local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and
( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dMaxDepth2) - 2 * BD.CUT_EXTRA + 10 * GEO.EPS_SMALL) ( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dMaxDepth2) - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bHorizCut = ( ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA) local bHorizCut = ( not bBigSectionCut and ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA)
local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bBigSectionCut and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL) and local bDoubleCut = ( not bBigSectionCut and not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
( b3Raw:getDimY() < 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
-- verifico necessità di tagli aggiuntivi orizzontali o verticali
local dMinOvmHeadForAddeddCuts = 10.123
local bNeedVerticalAddedCuts = ( Proc.Face[1].WidthTrimmed > BD.MAX_LEN_DICE) and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL)
local bNeedHorizontalAddedCuts = ( Proc.Face[1].HeightTrimmed > ( BD.MIN_HEIGHT_ADDED_CUTS or BD.MAX_LEN_DICE)) and
not bBigSectionCut and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) and
dOffsL < BD.MAX_DIM_DICE
-- dati lavorazioni sopra e sotto
local Cutting1Data = { sCutting = sCutting, dSawDiam = dSawDiam, dMaxDepth = dMaxDepth, dSawThick = dSawThick, dMaxVertDepth = dMaxVertDepth}
local Cutting2Data = { sCutting = sCutting2, dSawDiam = dSawDiam2, dMaxDepth = dMaxDepth2, dSawThick = dSawThick2}
-- dati sul taglio di testa da effettuare
local HeadCutType = { bBigSectionCut = bBigSectionCut, bHorizCut = bHorizCut, bDoubleHorizCut = bDoubleHorizCut, bDoubleCut = bDoubleCut, bNeedVerticalAddedCuts = bNeedVerticalAddedCuts, bNeedHorizontalAddedCuts = bNeedHorizontalAddedCuts}
-- 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
if not bNeedHCut and AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Raw:getMax():getX()) < 10 * GEO.EPS_SMALL then if not bNeedHCut and AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Raw:getMax():getX()) < 10 * GEO.EPS_SMALL then
return true return true
end end
-- determino se più tagli con offset
local nCuts = max( ceil( dOvmHead / ( BD.MAX_LEN_SCRAP_START or BD.MAX_LEN_SCRAP)), 1)
local dOffsL = dOvmHead / nCuts
-- se taglio per sezioni alte e larghe -- se taglio per sezioni alte e larghe
if bBigSectionCut then if bBigSectionCut then
if dOvmHead > 0 then if dOvmHead > 0 then
-- se finitura con lama -- se finitura con lama
if nQ05 < 2 then if not nOriId or EgtGetInfo( nOriId, 'Q05', 'i') == 1 or EgtGetInfo( nOriId, 'Q05', 'i') == 0 then
local dSawThickCheck = dSawThick local bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, dCurrOvmT)
if dSawThick2 > 0 and bDoubleHorizCut then if not bOk then return bOk, sErr end
dSawThickCheck = min( dSawThick, dSawThick2)
end
local dMaxElev = 0
if vtN:getX() > 0 then
dMaxElev = b3Raw:getMax():getX() - Proc.Box:getMin():getX()
else
dMaxElev = Proc.Box:getMax():getX() - b3Raw:getMin():getX()
end
-- taglio a zero (con sega a catena o mix catena + lama) per evitare problemi con grezzo più lungo del previsto
if BD.PRECUT_HEAD then
-- recupero dati utensile della sega a catena più lunga a disposizione
local sSawing = ML.FindSawing( 'SawingForSplitting', nil, nil, 'Longest')
if not sSawing then
sSawing = ML.FindSawing( 'Sawing', nil, nil, 'Longest')
end
local dChainSawMaxMat = 0
local dChainSawLen = 0
if EgtMdbSetCurrMachining( sSawing or '') then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dChainSawMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dChainSawMaxMat
dChainSawLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dChainSawLen
end
end
local SawingData = { sSawing = sSawing, dChainSawMaxMat = dChainSawMaxMat, dChainSawLen = dChainSawLen, bInvert = true}
local dOffset = dOvmHead
local bOkPrecut, sErrPrecut = Split.MakeBigSectionSplitting( Proc, b3Raw, dOffset, SawingData, Cutting2Data)
if not bOkPrecut then
return false, sErrPrecut
end
end
-- controllo se è necessario un taglio con dicing o si deve proseguire ai casi standard
if dMaxElev > dSawThickCheck then
local bOk, sErr
-- se trave larga effettuo tagli verticali aggiuntivi
if bNeedVerticalAddedCuts then
-- ad ogni offset di taglio dovrò fare prima i tagli verticali e poi i cubetti
for i = nCuts, 1, -1 do
local nAddGrpId = BL.GetAddGroup( Proc.PartId)
-- faccia di taglio all'offset corrente
local AddId = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
local AddProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, PartId = Proc.PartId}
Topology.Classify( AddProc, b3Raw)
local dCutOffset = ( i - 1) * dOffsL
local vtMove = Vector3d( dCutOffset, 0, 0)
EgtMove( AddId, vtMove, GDB_RT.GLOB)
-- eventuale faccia di taglio all'offset precedente, per limitare il dicing e evitare di tagliare i cubetti nel vuoto
local nLimitingSurf
if nCuts > 1 then
nLimitingSurf = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
local dLastCutOffset = i * dOffsL
local vtMoveLimitingSurf = Vector3d( dLastCutOffset - 10 * GEO.EPS_SMALL, 0, 0)
EgtMove( nLimitingSurf, vtMoveLimitingSurf, GDB_RT.GLOB)
local vtNLimitingSurf = EgtSurfTmFacetNormVersor( nLimitingSurf, 0, GDB_ID.ROOT)
if AreSameVectorApprox( X_AX(), vtNLimitingSurf) then EgtInvertSurf( nLimitingSurf) end
end
-- tagli verticali
bOk, sErr = AddVerticalPreCuts( AddProc, sCutting, 0, b3Raw, dOffsL)
if not bOk then return bOk, sErr end
-- tagli a cubetti con eventuale superficie limitante
local sLeadInOutType = 'PerpendicularOutraw'
bOk, sErr = Cut.Make( AddProc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, nil, nil, nLimitingSurf, sLeadInOutType)
end
-- tagli aggiuntivi non necessari
else
local sLeadInOutType = 'PerpendicularOutraw'
bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, nil, nil, nil, sLeadInOutType)
end
return bOk, sErr
end
-- se finitura con truciolatore -- se finitura con truciolatore
elseif nQ05 == 2 then elseif EgtGetInfo( nOriId, 'Q05', 'i') == 2 then
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
local sErr = 'Error : part box not found' local sErr = 'Error : part box not found'
@@ -632,25 +224,80 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
return false, sErr return false, sErr
end end
local bOk, sErr = Pocket.Make( Proc, Proc.Id, 0, sPocketing, nPartId, b3Solid) local bOk, sErr = Pocket.Make( Proc, Proc.Id, 0, sPocketing, nPartId, b3Solid)
return bOk, sErr if not bOk then return bOk, sErr end
end end
end end
end -- se tagli standard
elseif not bDoubleHorizCut then
local bOk, sErr = MakeStandardCuts( Proc, b3Raw, nCuts, dOffsL, HeadCutType, Cutting1Data, Cutting2Data, nil, dOvmHead) -- flag di lavorazione faccia
local nOrthoOpposite = EgtIf( bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_FRONT)
-- calcolo extra taglio ed accorciamento
-- alla fine del taglio si aggiungono gli smussi in testa local dCutExtra = 0
local _, sErrHeadChamfer = MakeHeadChamfer( nOriId or Proc.Id, nPartId) local dAccStart = 0
if sErr then local dAccEnd = 0
sErr = sErr..'\n'..sErrHeadChamfer if b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL or b3Raw:getDimY() < 2 * BD.MAX_DIM_HTCUT_HBEAM + 10 * GEO.EPS_SMALL then
dCutExtra = EgtIf( bDoubleCut, - 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN, BD.CUT_EXTRA)
else
dCutExtra = - ( b3Raw:getDimY() - dMaxDepth)
local dSawRad = dSawDiam / 2
local dKL = dSawRad - dMaxDepth + b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN
if BD.C_SIMM then
dAccEnd = sqrt( dSawRad * dSawRad - dKL * dKL)
else
dAccStart = sqrt( dSawRad * dSawRad - dKL * dKL)
end
end
-- se necessari tagli in doppio, eseguo gli opposti
if bDoubleCut then
for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsL
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_BACK, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, '', b3Raw)
if not bOk then return false, sErr end
end
end
-- eseguo i tagli necessari
for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsL
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, '', b3Raw)
if not bOk then return false, sErr end
end
-- altrimenti necessari tagli da sopra e sotto con testa opportuna
else else
sErr = sErrHeadChamfer -- verifico esistenza della lavorazione con lama da sotto
if not sCutting2 then
local sErr = 'Error : cutting H2 not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- verifico che le due lame riescano a lavorare la sezione
local dDimZ = b3Raw:getDimZ()
local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ
if dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0 then
local sErr = 'Error : section too big for head cut'
EgtOutLog( sErr)
return false, sErr
end
-- calcolo extra taglio ed accorciamento
local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN
local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN
local dAccStart = 0
local dVzLimDwnUp
if BD.TURN then dVzLimDwnUp = -2 end
-- eseguo i tagli da sotto necessari
for i = nCuts, 1, -1 do
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)
if not bOk then return false, sErr end
end
-- eseguo i tagli da sopra necessari
for i = nCuts, 1, -1 do
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)
if not bOk then return false, sErr end
end
end end
return true
end
return bOk, sErr
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
return ProcessHeadCut return ProcessHeadCut
+940 -4096
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+221 -664
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+26 -31
View File
@@ -1,9 +1,7 @@
-- ProcessMark.lua by Egaltech s.r.l. 2022/12/05 -- ProcessMark.lua by Egaltech s.r.l. 2022/06/07
-- 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.
-- 2022/12/05 Aggiunta gestione tipo di lavorazione Text_AT.
-- 2024/09/04 In Make gestione di più geometrie ausiliarie ( ora si lavora anche il testo, oltre che alle linee di marcatura)
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessMark = {} local ProcessMark = {}
@@ -39,18 +37,15 @@ function ProcessMark.Classify( Proc)
end end
-- verifico se la marcatura è lavorabile solo da sotto -- verifico se la marcatura è lavorabile solo da sotto
local bDown = (( vtN:getZ() < -0.1)) local bDown = (( vtN:getZ() < -0.1))
-- se da sotto e presente rinvio angolare verifico se c'è opportuna lavorazione
if bDown and BD.ANG_TRASM then
if ML.FindMilling( 'Text_AT') then
bDown = false
end
end
return true, bDown return true, bDown
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessMark.Make( Proc, nPhase, nRawId, nPartId) function ProcessMark.Make( Proc, nPhase, nRawId, nPartId)
-- recupero eventuale geometria ausiliaria
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if AuxId then AuxId = AuxId + Proc.Id end
-- recupero i dati della marcatura -- recupero i dati della marcatura
local vtExtr local vtExtr
if EgtGetType( Proc.Id) ~= GDB_TY.EXT_TEXT then if EgtGetType( Proc.Id) ~= GDB_TY.EXT_TEXT then
@@ -60,25 +55,25 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId)
end end
-- verifico sia una curva/testo -- verifico sia una curva/testo
if not vtExtr then if not vtExtr then
local sErr = 'Error : Mark with geometry type not accepted' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Mark with geometry type not accepted'
EgtOutLog( sErr) EgtOutLog( sErr)
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.ANG_TRASM and not BD.TURN then if vtExtr:getZ() < - 0.1 and not BD.DOWN_HEAD and not BD.TURN then
local sErr = 'Error : 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
end end
-- 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.174) local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174)
local bMillAngTrasm = ( BD.ANG_TRASM and vtExtr:getZ() < -0.1)
-- recupero la lavorazione -- recupero la lavorazione
local sMillType = EgtIf( not bMillAngTrasm, 'Text', 'Text_AT') local sMillType = 'Text'
--local sMchExt = EgtIf( bMillDown, '_H2', '')
local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown) local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown)
if not sMilling then if not sMilling then
local sErr = 'Error : milling not found in library' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -93,46 +88,46 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId)
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, -1}}) EgtSetMachiningGeometry( {{ Proc.Id, -1}})
-- imposto posizione braccio porta testa -- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE if vtExtr:getY() <= 0 then
if bMillAngTrasm then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
nSCC = MCH_SCC.ADIR_NEAR
else else
nSCC = EgtIf( vtExtr:getY() <= 0, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP) EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
end end
-- si verifica se ci sono altre geometrie da lavorare -- eventuale lavorazione su seconda geometria
local AdditionalGeometries = EgtSplitString( EgtGetInfo( Proc.Id, 'AUXID', 's')) or {} if AuxId then
for i = 1, #AdditionalGeometries do
local AuxId = Proc.Id + AdditionalGeometries[i]
-- inserisco la lavorazione di fresatura -- inserisco la lavorazione di fresatura
local nOtherMachiningId = EgtAddMachining( sName, sMilling) local sName2 = 'Decor2_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
if not nOtherMachiningId then local nMchF2Id = EgtAddMachining( sName, sMilling)
sName = 'Decor' .. '_' .. tostring( i) .. '_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) if not nMchF2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling local sErr = 'Error adding machining ' .. sName2 .. '-' .. sMilling
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}}) EgtSetMachiningGeometry( {{ AuxId, -1}})
-- imposto posizione braccio porta testa -- imposto posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, nSCC) if vtExtr:getY() <= 0 then
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
else
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nOtherMachiningId, false) EgtSetOperationMode( nMchF2Id, false)
return false, sErr return false, sErr
end end
-- se geometria a X maggiore, la sposto prima -- se geometria a X maggiore, la sposto prima
local ptS1 = EgtSP( Proc.Id, GDB_ID.ROOT) local ptS1 = EgtSP( Proc.Id, GDB_ID.ROOT)
local ptS2 = EgtSP( AuxId, GDB_ID.ROOT) local ptS2 = EgtSP( AuxId, GDB_ID.ROOT)
if ptS2:getX() > ptS1:getX() then if ptS2:getX() > ptS1:getX() then
EgtRelocateGlob( nOtherMachiningId, nMchFId, GDB_IN.BEFORE) EgtRelocateGlob( nMchF2Id, nMchFId, GDB_IN.BEFORE)
end end
end end
return true return true
+70 -305
View File
@@ -1,21 +1,9 @@
-- ProcessMortise.lua by Egaltech s.r.l. 2023/08/10 -- ProcessMortise.lua by Egaltech s.r.l. 2021/12/01
-- 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/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. -- 2022/07/29 Nella pulitura angoli aggiunto il check dimensioni tasca vs utensile. Corretta direzione utensile per mortasa frontale.
-- 2022/09/27 Migliorata la scelta utensile. Se c'è almeno una lavorazione 'mortise' si cerca di usare quelle, riducendo l'elevazione se necessario.
-- Se non c'è nemmeno una lavorazione 'mortise' si passa alle pocket.
-- 2022/12/12 Migliorato controllo necessità CleanCorners.
-- 2023/01/31 Aggiunta gestione lavorazione in doppio.
-- 2023/01/31 Creata la funzione ConvertToClosedCurve (parte della ProcessMortise.Make) e spostata in BeamLib.
-- 2023/05/11 Se lavorazione in doppio e precedente no oppure di tipo diverso, forzo risalita a Zmax.
-- 2023/06/27 Esclusa la ricerca lati aperti per le mortase passanti, per le quali il contorno finisce sulla faccia e il riconoscimento sbaglia.
-- 2023/07/21 Correzioni per mortise passanti con curva Aux che guarda in basso.
-- 2023/08/10 Modificata scelta SCC per tasche in Y+/- in coda o quasi.
-- 2024/01/18 Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile.
-- 2024/02/28 Forzata SPIRAL_IN se c'è anche un solo lato aperto
-- 2024/03/05 Aggiunta possibilità di inserire lavorazione di smusso
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessMortise = {} local ProcessMortise = {}
@@ -31,9 +19,6 @@ EgtOutLog( ' ProcessMortise started', 1)
local BD = require( 'BeamData') local BD = require( 'BeamData')
local ML = require( 'MachiningLib') local ML = require( 'MachiningLib')
-- variabili assegnazione parametri Q
local Q_DEPTH_CHAMFER = 'Q02' -- d
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Riconoscimento della feature -- Riconoscimento della feature
function ProcessMortise.Identify( Proc) function ProcessMortise.Identify( Proc)
@@ -48,13 +33,6 @@ function ProcessMortise.FrontIdentify( Proc)
return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 51) return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 51)
end end
---------------------------------------------------------------------
-- Riconoscimento delle sole feature laterali
function ProcessMortise.SideIdentify( Proc)
return ( (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 50) or
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 53))
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Classificazione della feature: decide se la feature è in una posizione che per lavorala -- Classificazione della feature: decide se la feature è in una posizione che per lavorala
-- deve essere ribaltata o no -- deve essere ribaltata o no
@@ -128,12 +106,11 @@ end
local nFaceUse = BL.GetNearestParalOpposite( vtN) local nFaceUse = BL.GetNearestParalOpposite( vtN)
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- applico il parametro plunge, che setta la lavorazione per affondare solamente, senza lavorare tutto il contorno; 1: solo lato iniziale, 2: solo lato finale, 3: entrambi -- applico il parametro plunge, che setta la lavorazione per affondare solamente, senza lavorare tutto il contorno; 1: solo lato iniziale, 2: solo lato finale, 3: entrambi
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' sNotes = 'Plunge=3;'
sUserNotes = EgtSetValInNotes( sUserNotes, 'Plunge' , 3) EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- imposto angolo 3° asse rot -- imposto angolo 3° asse rot
local vtOrtho = BL.GetVersRef( nFaceUse) local vtOrtho = BL.GetVersRef( nFaceUse)
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sMortising, 'perpendicular')) EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1)) EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1))
-- calcolo la lavorazione -- calcolo la lavorazione
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
@@ -143,7 +120,7 @@ end
return false, sErr return false, sErr
end end
-- impostazione alternativa angolo 3° asse rot -- impostazione alternativa angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sMortising, 'parallel')) EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2)) EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2))
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
@@ -162,21 +139,20 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Pulizia angoli nel caso sia settato il parametro P04=1 -- Pulizia angoli nel caso sia settato il parametro P04=1
local function CleanCorners( Proc, dMorH, vtN, bDoubleDir, AuxId) local function CleanCorners( Proc, dMorH, vtN, bDoubleDir, AuxId)
-- verifico se l'orientamento della feature è adeguato -- verifico se è attiva la pulizia e se l'orientamento della feature è adeguato
local bCleanCorners = ( AreSameOrOppositeVectorApprox( vtN, X_AX()) or local bCleanCorners = ( EgtGetInfo( Proc.Id, 'P04', 'i') == 1 and
AreSameOrOppositeVectorApprox( vtN, Y_AX()) or ( AreSameOrOppositeVectorApprox( vtN, X_AX()) or
AreSameOrOppositeVectorApprox( vtN, Z_AX())) AreSameOrOppositeVectorApprox( vtN, Y_AX()) or
AreSameOrOppositeVectorApprox( vtN, Z_AX())))
if not bCleanCorners then if not bCleanCorners then
local sWarn = 'Warning: mortising not aligned with XYZ axes, corner cleaning skipped' EgtOutLog( 'Warning: mortising not aligned with XYZ axes, corner cleaning skipped')
EgtOutLog( sWarn) return
return true, sWarn
end end
-- cerco la lavorazione adatta -- cerco la lavorazione adatta
local sMortisingCleanCorners = ML.FindSawing( 'Mortising') local sMortisingCleanCorners = ML.FindSawing( 'Mortising')
if not sMortisingCleanCorners then if not sMortisingCleanCorners then
local sWarn = 'Warning: mortising tool not found, corner cleaning skipped' EgtOutLog( 'Warning: mortising tool not found, corner cleaning skipped')
EgtOutLog( sWarn) return
return true, sWarn
end end
-- recupero i dati dell'utensile -- recupero i dati dell'utensile
local dSawWidth = 50 local dSawWidth = 50
@@ -253,65 +229,7 @@ local function CleanCorners( Proc, dMorH, vtN, bDoubleDir, AuxId)
return true, sWarn return true, sWarn
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function ProcessMortise.VerifyMortiseOrPocket( Proc, dDiam, dDepth, dMaxTotLen, sType, bPocketDown, bExcludeH2)
-- ricerca della svuotatura
local sPocketing
if dDepth then
sPocketing = ML.FindPocketing( sType, dDiam, dDepth, dMaxTotLen, not bPocketDown, bPocketDown, bExcludeH2) or
ML.FindPocketing( sType, dDiam, 0.8 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown, bExcludeH2) or
ML.FindPocketing( sType, dDiam, 0.6 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown, bExcludeH2) or
ML.FindPocketing( sType, dDiam, 0.4 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown, bExcludeH2) or
ML.FindPocketing( sType, dDiam, 0, dMaxTotLen, bExcludeH2)
else
sPocketing = ML.FindPocketing( sType, dDiam, 0, dMaxTotLen, bExcludeH2)
end
if not sPocketing then
return nil
end
-- recupero i dati dell'utensile
local dMaxDepth = 0
local dToolDiam = 0
if EgtMdbSetCurrMachining( sPocketing) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
return sPocketing, dMaxDepth, dToolDiam
end
---------------------------------------------------------------------
local function VerifyChamfer( Proc, AuxId, nRawId, bMakeVertCham, bDownHead)
local nChamfer = 0
-- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId)
-- verifico che lo smusso sia richiesto
local dDepth = EgtGetInfo( Proc.Id, Q_DEPTH_CHAMFER, 'd') or 0
if dDepth > 0 then
nChamfer = 1
end
-- recupero la lavorazione
local sMilling
if nChamfer > 0 then
if bDownHead then
sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true)
else
sMilling = ML.FindMilling( 'Mark')
end
if not sMilling then
local sErr = 'Error : Mark not found in library'
EgtOutLog( sErr)
return -1, 0, sErr
end
end
return nChamfer, dDepth, sMilling
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
@@ -333,6 +251,36 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- recupero versore estrusione della curva supplementare
local vtExtr = EgtCurveExtrusion( AuxId, GDB_ID.ROOT)
-- Se curva di contorno aperta
if not EgtCurveIsClosed( AuxId) then
local NewId, nCount = EgtExtractSurfTmFacetLoops( Proc.Id, 0, EgtGetParent( Proc.Id))
if NewId then
-- elimino eventuali loop interni (non dovrebbero comunque esserci)
for i = 1, nCount - 1 do
EgtErase( NewId + i)
end
-- sostituisco il loop esterno alla curva originale
EgtModifyCurveExtrusion( NewId, vtExtr, GDB_ID.ROOT)
EgtRelocate( NewId, AuxId, GDB_IN.AFTER)
EgtErase( AuxId)
EgtChangeId( NewId, AuxId)
-- sistemo i lati aperti
local vFacAdj = EgtSurfTmFacetAdjacencies( Proc.Id, 0)[1]
if vFacAdj then
local sOpen = ''
for i = 1, #vFacAdj do
if vFacAdj[i] < 0 then
sOpen = sOpen .. EgtIf( #sOpen > 0, ',', '') .. tostring( i - 1)
end
end
if #sOpen > 0 then
EgtSetInfo( AuxId, 'OPEN', sOpen)
end
end
end
end
-- verifico se frontale -- verifico se frontale
local bFront = ( Proc.Prc == 51) local bFront = ( Proc.Prc == 51)
-- recupero i dati della faccia di fondo -- recupero i dati della faccia di fondo
@@ -343,79 +291,8 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
ptC = frMor:getOrigin() ptC = frMor:getOrigin()
vtN = frMor:getVersZ() vtN = frMor:getVersZ()
end end
-- recupero versore estrusione della curva supplementare
local vtExtr = EgtCurveExtrusion( AuxId, GDB_ID.ROOT)
-- Confronto le direzioni dei 2 versori : se diverse la faccia 0 non è il fondo => mortasa passante -- Confronto le direzioni dei 2 versori : se diverse la faccia 0 non è il fondo => mortasa passante
local bOpenBtm = not AreSameVectorApprox( vtExtr, vtN) local bOpenBtm = not AreSameVectorApprox( vtExtr, vtN)
-- se curva di contorno aperta la rendo chiusa
local _, bModif = BL.ConvertToClosedCurve( Proc, AuxId)
-- se la mortasa passante il contorno è sulla faccia della trave e il riconoscimento lati aperti non è corretto
if not bModif and not bOpenBtm then
BL.SetOpenSide( AuxId, b3Solid)
end
-- recupero il raggio minimo della mortasa
local dMaxDiam = 1000
local nSt, nEnd = EgtCurveDomain( AuxId)
for i = nSt, nEnd - 1 do
local dRad = EgtCurveCompoRadius( AuxId, i)
-- se è un raggio, setto ed esco subito. Tutti i raggi sono uguali nella mortasa
if dRad > 0 then
dMaxDiam = dRad * 2
break
end
end
-- caso speciale feature trimmata diversamente in/out: si ricostruisce la curva non trimmata
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- estrazione loop trimesh: se 1 contorno ha il fondo, se due contorni è passante.
-- se passante si deve discriminare se i due contorni sono uguali (passante standard, trimmata allo stesso modo in/out) oppure se un contorno è diverso dall'altro (e quindi non è trimmata in egual modo in/out)
-- se più di 2 contorni si rimane nel caso standard
local idCurve1, nIdCount = EgtExtractSurfTmLoops( Proc.Id, nAddGrpId)
if nIdCount == 2 then
local idCurve2 = idCurve1 + 1
local dCurveLength1 = EgtCurveLength( idCurve1)
local dCurveLength2 = EgtCurveLength( idCurve2)
if abs( dCurveLength1 - dCurveLength2) > 100 * GEO.EPS_SMALL then
-- riferimento curva ausiliaria
local frAuxId = Frame3d( EgtGP( AuxId, GDB_RT.GLOB), vtExtr)
-- box dei due contorni nel riferimento della faccia di fondo
local b3Curve1 = EgtGetBBoxRef( idCurve1, GDB_BB.STANDARD, frAuxId)
local b3Curve2 = EgtGetBBoxRef( idCurve2, GDB_BB.STANDARD, frAuxId)
-- per creare la curva non trimmata si creerà un piano di intersezione con la trimesh appena sopra al contorno più vicino a AuxId, ossia a ptOffset
local ptOffset = b3Curve1:getMax()
if b3Curve1:getMin():getZ() > b3Curve2:getMin():getZ() + 10 * GEO.EPS_SMALL then
ptOffset = b3Curve2:getMax()
end
-- ptOffset si sposta appena sopra per garantire l'intersezione
ptOffset = ptOffset + Vector3d( 0, 0, 100 * GEO.EPS_SMALL)
local ptOffsetGlob = Point3d( ptOffset)
ptOffsetGlob:toGlob( frAuxId)
EgtErase( { idCurve1, idCurve2} )
-- intersezione piano a ptOffset con la trimesh: si ottiene la curva originale non trimmata
local nFirstId, nPnt, nCrv, nSrf = EgtPlaneSurfTmInters( ptOffsetGlob, frAuxId:getVersZ(), Proc.Id, nAddGrpId, GDB_RT.GLOB)
if nPnt == 0 and nCrv == 1 and nSrf == 0 then
EgtCloseCurveCompo( nFirstId)
local vtMove = -frAuxId:getVersZ() * ptOffset:getZ()
EgtMove( nFirstId, vtMove, GDB_RT.GLOB)
EgtErase( AuxId)
EgtChangeId( nFirstId, AuxId)
else
if nFirstId then
for nId = nFirstId, nFirstId + nPnt + nCrv + nSrf - 1 do
EgtErase( nId)
end
end
end
end
end
if bOpenBtm then if bOpenBtm then
-- creo superficie chiusa -- creo superficie chiusa
local nFlat = EgtSurfTmByFlatContour( EgtGetParent( AuxId), AuxId, 0.05) local nFlat = EgtSurfTmByFlatContour( EgtGetParent( AuxId), AuxId, 0.05)
@@ -432,10 +309,8 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- 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))
local vtMove = Vector3d(0,0,dMove) EgtMove( AuxId, Vector3d(0,0,-dMove))
vtMove:toGlob(frMor) EgtMove( nFlat, Vector3d(0,0,-dMove))
EgtMove( AuxId, vtMove, GDB_RT.GLOB)
EgtMove( nFlat, vtMove, GDB_RT.GLOB)
frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( nFlat, 0, GDB_ID.ROOT) frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( nFlat, 0, GDB_ID.ROOT)
ptC = frMor:getOrigin() ptC = frMor:getOrigin()
vtN = frMor:getVersZ() vtN = frMor:getVersZ()
@@ -481,8 +356,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptCutC, vtCutN, b3Solid, GDB_RT.GLOB) local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptCutC, vtCutN, b3Solid, GDB_RT.GLOB)
local b3Cut = EgtGetBBoxGlob( AddId or GDB_ID.NULL, GDB_BB.STANDARD) local b3Cut = EgtGetBBoxGlob( AddId or GDB_ID.NULL, GDB_BB.STANDARD)
local CutProc = { Id = AddId, Grp = Proc.Grp - 2, Prc = 10, Box = b3Cut, Fct = 1, Flg = Proc.Flg, local CutProc = { Id = AddId, Grp = Proc.Grp - 2, Prc = 10, Box = b3Cut, Fct = 1, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId} Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
local bFromBottom = ( b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getZ() > 0.25) local bFromBottom = ( b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getZ() > 0.25)
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH, bFromBottom) local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH, bFromBottom)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
@@ -499,71 +373,10 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
-- determino larghezza della mortasa -- determino larghezza della mortasa
if dL < dW then dL, dW = dW, dL end if dL < dW then dL, dW = dW, dL end
-- si prende il minimo tra larghezza mortasa e il raggio minimo impostato da parametro
dMaxDiam = min( dW, dMaxDiam)
-- abilitazione lavorazione da sotto -- abilitazione lavorazione da sotto
local bPockUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259) local bPockUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259)
local bPockDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174) local bPockDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174)
local bPockAngTrasm = ( BD.ANG_TRASM and vtExtr:getZ() < -0.1) local bPockAngTrasm = ( BD.ANG_TRASM and vtExtr:getZ() < -0.1)
-- recupero i dati della curva e del profilo
local dDepth = dMorH
local bDownHead = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1)
local bToolInv = ( not bDownHead and vtExtr:getZ() < -0.1 and Proc.Box:getDimZ() > b3Solid:getDimZ() - 5)
local dExtra = 2
-- verifico se servono gli smussi. Se lavorazione principale di svuotatura significa che è solo da un lato
-- generalmente sono lavorazioni non molto lunghe, quindi non si gestistono gli step
-- verifico i parametri Q per profondità smusso e per eseguirlo in esclusiva
local nChamfer, dDepthCham, sChamfer = VerifyChamfer( Proc, AuxId, nRawId, true)
-- se devo inserire il chamfer
if nChamfer > 0 and Proc.Grp ~= 0 and dDepth > dDepthCham then
-- inserisco la lavorazione
local sNameCh = 'Cham_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sNameCh, sChamfer)
if not nMchId then
local sErr = 'Error adding machining ' .. sNameCh .. '-' .. sChamfer
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
if not bToolInv then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
EgtSetMachiningParam( MCH_MP.INVERT, true)
else
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
EgtSetMachiningParam( MCH_MP.INVERT, true)
end
-- assegno affondamento e offset radiale
EgtSetMachiningParam( MCH_MP.DEPTH, dDepthCham + dExtra - dMorH)
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
-- posizione braccio porta testa
local nSCC = MCH_SCC.NONE
if not BD.C_SIMM then
if Proc.Head then
nSCC = MCH_SCC.ADIR_XP
elseif Proc.Tail then
nSCC = MCH_SCC.ADIR_XM
elseif AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then
nSCC = MCH_SCC.ADIR_YP
elseif vtExtr:getY() > -0.01 then
nSCC = MCH_SCC.ADIR_YP
else
nSCC = MCH_SCC.ADIR_YM
end
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
end
end
-- recupero la lavorazione -- recupero la lavorazione
local sPockType = 'Mortise' local sPockType = 'Mortise'
local sMchExt = '' local sMchExt = ''
@@ -572,25 +385,18 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
elseif bPockAngTrasm then elseif bPockAngTrasm then
sMchExt = '_AT' sMchExt = '_AT'
end end
local bExcludeH2 = false
if Proc.Double and Proc.Double > 0 then
bPockUp = false
bPockDown = false
bExcludeH2 = true
sMchExt = ''
end
local sPocketing local sPocketing
if Proc.Prc ~= 53 then if Proc.Prc ~= 53 then
sPocketing = ProcessMortise.VerifyMortiseOrPocket( Proc, dMaxDiam, dMorH, nil, sPockType..sMchExt, bPockDown, bExcludeH2) sPocketing = ML.FindPocketing( sPockType..sMchExt, dW, nil, nil, not bPockDown, bPockDown)
if not sPocketing and bPockUp then if not sPocketing and bPockUp then
sPocketing = ProcessMortise.VerifyMortiseOrPocket( Proc, dMaxDiam, dMorH, nil, sPockType..sMchExt, _, bExcludeH2) sPocketing = ML.FindPocketing( sPockType, dW)
end end
end end
if not sPocketing then if not sPocketing then
sPockType = 'Pocket' sPockType = 'Pocket'
sPocketing = ProcessMortise.VerifyMortiseOrPocket( Proc, dMaxDiam, dMorH, nil, sPockType..sMchExt, bPockDown, bExcludeH2) sPocketing = ML.FindPocketing( sPockType..sMchExt, dW, nil, nil, not bPockDown, bPockDown)
if not sPocketing and bPockUp then if not sPocketing and bPockUp then
sPocketing = ProcessMortise.VerifyMortiseOrPocket( Proc, dMaxDiam, dMorH, nil, sPockType..sMchExt, _, bExcludeH2) sPocketing = ML.FindPocketing( sPockType, dW)
end end
end end
if not sPocketing then if not sPocketing then
@@ -611,7 +417,6 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bCW = ( dSpeed >= 0) bCW = ( dSpeed >= 0)
end end
end end
-- inserisco la lavorazione di svuotatura -- inserisco la lavorazione di svuotatura
local sName = 'Mort_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local sName = 'Mort_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sName, sPocketing) local nMchFId = EgtAddMachining( sName, sPocketing)
@@ -620,22 +425,10 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- verifico se invertire direzione utensile -- verifico se invertire versore estrusione geometria
if bRevertSide then if bRevertSide then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtModifyCurveExtrusion( AuxId, -vtExtr, GDB_ID.ROOT)
end end
-- se ho anche solo un lato aperto, forzo SPIRAL-IN
local vOpen = EgtGetInfo( AuxId, 'OPEN', 'vi')
if vOpen and #vOpen > 0 then
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN)
end
-- se diametro utensile esattamente uguale a larghezza tasca, e tasca tonda, si setta un offset radiale negativo
if Proc.Fct > 6 and abs( dMillDiam - dW) < 100 * GEO.EPS_SMALL then
EgtSetMachiningParam( MCH_MP.OFFSR, - 50 * GEO.EPS_SMALL)
end
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}}) EgtSetMachiningGeometry( {{ AuxId, -1}})
-- sistemo la direzione di lavoro -- sistemo la direzione di lavoro
@@ -644,14 +437,11 @@ 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 and not BD.TURN then elseif not BD.C_SIMM then
if AreSameOrOppositeVectorApprox( vtN, Z_AX()) then if abs( vtN:getX()) < GEO.EPS_SMALL and abs( vtN:getY()) < GEO.EPS_SMALL then
nSCC = MCH_SCC.ADIR_YM nSCC = MCH_SCC.ADIR_YM
elseif abs( vtN:getX()) < 0.1 then elseif abs( vtN:getX()) < GEO.EPS_SMALL then
local bNearTail = ( Proc.Box:getMax():getX() < b3Solid:getCenter():getX() and nSCC = MCH_SCC.ADIR_XP
Proc.Box:getMax():getX() - b3Solid:getMin():getX() < 1000)
local bVeryShortPart = ( BD.LEN_VERY_SHORT_PART and b3Solid:getDimX() < BD.LEN_VERY_SHORT_PART)
nSCC = EgtIf( BL.IsPartFinalPhase( EgtGetCurrPhase()) or ( bNearTail and not bVeryShortPart), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
elseif vtN:getY() < GEO.EPS_SMALL then 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
@@ -678,31 +468,13 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
dMorH = dMaxDepth dMorH = dMaxDepth
EgtOutLog( sWarn .. ' (process ' .. tostring( Proc.Id) .. ')') EgtOutLog( sWarn .. ' (process ' .. tostring( Proc.Id) .. ')')
else else
-- se passante e lavorabile da due lati if bOpenBtm and not bForceOneSide then -- se mortasa passante setto metà profondità
if bOpenBtm and not bForceOneSide then
-- imposto metà profondità
nDepthMin = -dMorH nDepthMin = -dMorH
EgtSetMachiningParam( MCH_MP.DEPTH, nDepthMin) EgtSetMachiningParam( MCH_MP.DEPTH, nDepthMin)
-- se altrimenti passante ma lavorabile solo da un lato
elseif bOpenBtm and bForceOneSide then
if bRevertSide then
EgtSetMachiningParam( MCH_MP.DEPTH, min( dMorH + BD.CUT_EXTRA, dMaxDepth))
else
EgtSetMachiningParam( MCH_MP.DEPTH, min( BD.CUT_EXTRA, dMaxDepth - dMorH))
end
end end
end end
-- imposto elevazione -- imposto elevazione
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMorH, 1) .. ';')
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dMorH, 1))
-- se lavorazione in doppio
if Proc.Double and Proc.Double > 0 then
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double)
if Proc.Double ~= Proc.PrevDouble then
sUserNotes = EgtSetValInNotes( sUserNotes, 'StartZmax', 2)
end
end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
@@ -721,7 +493,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
return false, sErr return false, sErr
end end
-- faccio la copia e la metto nel layer dedicato alle geometrie aggiunte -- faccio la copia e la metto nel layer dedicato alle geometrie aggiunte
local AuxId_oppo = EgtCopyGlob( AuxId, BL.GetAddGroup(nPartId)) local AuxId_oppo = EgtCopyGlob( AuxId, BL.GetAddGroup(nPartId))
-- inverto la direzione estrusione di questa -- inverto la direzione estrusione di questa
EgtModifyCurveExtrusion( AuxId_oppo, - vtExtr, GDB_ID.ROOT) EgtModifyCurveExtrusion( AuxId_oppo, - vtExtr, GDB_ID.ROOT)
-- aggiungo geometria -- aggiungo geometria
@@ -730,14 +502,11 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
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 not BD.C_SIMM and not BD.TURN then if not BD.C_SIMM then
if AreSameOrOppositeVectorApprox( vtN, Z_AX()) then if abs( vtN:getX()) < GEO.EPS_SMALL and abs( vtN:getY()) < GEO.EPS_SMALL then
nSCC = MCH_SCC.ADIR_YM nSCC = MCH_SCC.ADIR_YM
elseif abs( vtN:getX()) < 0.1 then elseif abs( vtN:getX()) < GEO.EPS_SMALL then
local bNearTail = ( Proc.Box:getMax():getX() < b3Solid:getCenter():getX() and nSCC = MCH_SCC.ADIR_XP
Proc.Box:getMax():getX() - b3Solid:getMin():getX() < 1000)
local bVeryShortPart = ( BD.LEN_VERY_SHORT_PART and b3Solid:getDimX() < BD.LEN_VERY_SHORT_PART)
nSCC = EgtIf( BL.IsPartFinalPhase( EgtGetCurrPhase()) or ( bNearTail and not bVeryShortPart), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
elseif vtN:getY() < GEO.EPS_SMALL then elseif vtN:getY() < GEO.EPS_SMALL then
nSCC = MCH_SCC.ADIR_YP nSCC = MCH_SCC.ADIR_YP
else else
@@ -754,9 +523,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- setto profondità -- setto profondità
EgtSetMachiningParam( MCH_MP.DEPTH, -nDepthMin+BD.CUT_EXTRA) EgtSetMachiningParam( MCH_MP.DEPTH, -nDepthMin+BD.CUT_EXTRA)
-- imposto elevazione -- imposto elevazione
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( (-nDepthMin+BD.CUT_EXTRA), 1) .. ';')
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( (-nDepthMin+BD.CUT_EXTRA), 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
@@ -765,12 +532,10 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
end end
-- verifico se necessaria la pulizia degli angoli ( tenone ad angoli non raggiati) e applico nel caso -- verifico se necessaria la pulizia degli angoli ( tenone ad angoli non raggiati) e applico nel caso
if ( EgtGetInfo( Proc.Id, 'P04', 'i') == 1) then local _, sWarn2 = CleanCorners( Proc, dMorH, vtN, bOpenBtm and not bForceOneSide, AuxId)
local _, sWarn2 = CleanCorners( Proc, dMorH, vtN, bOpenBtm and not bForceOneSide, AuxId) if sWarn2 then
if sWarn2 then if not sWarn then sWarn = '' end
if not sWarn then sWarn = '' end sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2)
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2)
end
end end
return true, sWarn return true, sWarn
-103
View File
@@ -1,103 +0,0 @@
-- ProcessSplit.lua by Egaltech s.r.l. 2025/06/20
-- Gestione tastatura
-- Tabella per definizione modulo
local ProcessProbing = {}
-- Include
require( 'EgtBase')
local BL = require( 'BeamLib')
-- Dati
local ML = require( 'MachiningLib')
---------------------------------------------------------------------
local function GetProbingMachining( Machinings, sHead)
local sProbeMachining, sHeadTool
-- TODO questa associazione "testa utensile"-"testa tastatore" dovrebbe essere spostata nella macchina.
-- Non è detto che se testa utensile inizia con "H2" allora bisogna prendere lavorazione con "_H2"
-- se la testa utilizzata dalla lavorazione inizia con H2, dovrebbe essere la seconda testa
if EgtStartsWith( sHead, 'H2') then
sHeadTool = '_H2'
else
sHeadTool = '_H1'
end
for i = 1, #Machinings do
if EgtEndsWith( Machinings[i].Name, sHeadTool) then
sProbeMachining = Machinings[i]
return sProbeMachining
end
end
sProbeMachining = Machinings[1]
return sProbeMachining
end
---------------------------------------------------------------------
local function MoveProbePointToRawFaces( ptProbe, vtProbe, nPartId)
local b3BoxPart = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
-- si porta linea di tastatura su grezzo
if AreSameVectorApprox( vtProbe, Z_AX()) then
ptProbe[3] = b3BoxPart:getMax():getZ()
elseif AreSameVectorApprox( vtProbe, -Z_AX()) then
ptProbe[3] = b3BoxPart:getMin():getZ()
elseif AreSameVectorApprox( vtProbe, Y_AX()) then
ptProbe[2] = b3BoxPart:getMax():getY()
elseif AreSameVectorApprox( vtProbe, -Y_AX()) then
ptProbe[2] = b3BoxPart:getMin():getY()
end
return ptProbe
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessProbing.Make( Proc, nPartId, Info)
local bOk, sErr
-- per eseguire tastatura servono tutti i dati, altriemnti impossibile
if Info.vtProbe and Info.ptProbe and Info.sType then
Info.ptProbe = MoveProbePointToRawFaces( Info.ptProbe, Info.vtProbe, nPartId)
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
local nIdLine = EgtLinePVL( nAddGrpId, Info.ptProbe, Info.vtProbe, 10, GDB_RT.GLOB) -- TODO lunghezza da portare fuori come parametro
local Machinings = GetMachinings( MCH_MY.PROBING, Info.sType)
-- se c'è almeno una lavorazione, allora devo fare tastatura
if Machinings and #Machinings > 0 then
local sProbing = GetProbingMachining( Machinings, Info.sHead)
-- se c'è la linea e la lavorazione, applico
if sProbing and nIdLine then
local sName = 'DtMtProbe_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sName, sProbing.Name)
-- si inverte la direzione della linea, deve essere entrante, oppostaa vettore estrusione
EgtInvertCurve( nIdLine)
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nIdLine, -1}})
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
else
bOk = true
end
else
bOk = false
sErr = 'Error on probing'
end
-- altrimenti tastatura non richiesta, esco
else
return true
end
else
bOk = false
sErr = 'Error on probing'
end
return bOk, sErr
end
---------------------------------------------------------------------
return ProcessProbing
+14 -96
View File
@@ -1,4 +1,4 @@
-- ProcessProfCamb.lua by Egaltech s.r.l. 2022/11/03 -- ProcessProfCamb.lua by Egaltech s.r.l. 2022/05/28
-- 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.
@@ -8,8 +8,6 @@
-- 2022/02/02 Aggiunta funzione OnlyChamfer. -- 2022/02/02 Aggiunta funzione OnlyChamfer.
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto. -- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria. -- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
-- 2022/11/03 Correzione per riconoscimento testa da sotto su fresatura.
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessProfCamb = {} local ProcessProfCamb = {}
@@ -206,36 +204,6 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
return nChamfer, dDepth, sMilling, sMilling2 return nChamfer, dDepth, sMilling, sMilling2
end end
---------------------------------------------------------------------
function VerifyOtherMillCanFinish( dDepthProfile, nSide)
local dToolMaxDepthFinish
-- abilitazione lavorazione da sotto
local sMillType = 'Prof_end'
local sMillingFinish, _, _, _ = ML.FindMilling( sMillType, nil, nil, nil, nil, true, nil, nil, nil)
if not sMillingFinish then
return false
end
-- Recupero i dati dell'utensile
if EgtMdbSetCurrMachining( sMillingFinish) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid)) then
dToolMaxDepthFinish = EgtTdbGetCurrToolMaxDepth()
end
else
return false
end
local bDouble = ( dDepthProfile + BD.CUT_EXTRA > dToolMaxDepthFinish)
-- se lavorazione in doppio richiesta, si verifica se richiesta testa sotto
if bDouble and nSide == 0 then
return false -- TODO macchine con BD.DOWN_HEAD potrebbero lavorare in doppio in questo caso!
end
if not bDouble or ( dDepthProfile + BD.MILL_OVERLAP < dToolMaxDepthFinish * 2) then
return true, sMillingFinish, bDouble
end
return false
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
@@ -274,7 +242,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if vtN:getZ() > 0.1 then if vtN:getZ() > 0.1 then
nSide = 1 nSide = 1
elseif vtN:getZ() < -0.1 then elseif vtN:getZ() < -0.1 then
nSide = -1 nSide = -1
end end
-- abilitazione lavorazione da sotto -- abilitazione lavorazione da sotto
local bMillDown = ( BD.DOWN_HEAD and nSide == -1) local bMillDown = ( BD.DOWN_HEAD and nSide == -1)
@@ -316,7 +284,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- aggiungo piano di sgrossatura e lo lavoro -- aggiungo piano 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, b3Solid) > 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 -- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
@@ -337,8 +305,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- altrimenti applico taglio di lama -- altrimenti applico taglio di lama
else else
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId} Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH) local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then if not bOk then
return false, sErr return false, sErr
@@ -348,14 +315,12 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- 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'
local bH2 sMilling, _, _, bMillDown = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bMillDown)
sMilling, _, _, bH2 = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bMillDown)
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)
return false, sErr return false, sErr
end end
bMillDown = ( bMillDown and bH2)
-- Recupero i dati dell'utensile -- Recupero i dati dell'utensile
if EgtMdbSetCurrMachining( sMilling) then if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
@@ -498,21 +463,16 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
end end
end end
-- se configurata fresa di finitura
local bUseOtherMillOnFinish, sFinishMilling, bDoubleFinishMill = VerifyOtherMillCanFinish( dProfDepth, nSide)
-- se il chamfer non è esclusivo continuo con le altre lavorazioni -- se il chamfer non è esclusivo continuo con le altre lavorazioni
if nChamfer < 2 then if nChamfer < 2 then
-- verifico se necessario lavorare in doppio -- verifico se necessario lavorare in doppio
local bDouble = ( dProfDepth + BD.CUT_EXTRA - 100 * GEO.EPS_SMALL > dToolMaxDepth) local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP) local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
-- se lavorazione da due parti, aggiungo la seconda -- se lavorazione da due parti, aggiungo la seconda
local sMillingDown local sMillingDown
if bDouble then if bDouble then
if nSide == 0 then if nSide == 0 then
if BD.DOWN_HEAD then if BD.DOWN_HEAD then
-- recupero la lavorazione -- recupero la lavorazione
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true) sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
if not sMillingDown then if not sMillingDown then
@@ -572,6 +532,10 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
bFinish = true bFinish = true
end end
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
@@ -598,7 +562,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
nMchId = nMch2Id nMchId = nMch2Id
end end
-- se abilitata, aggiungo lavorazione di finitura -- se abilitata, aggiungo lavorazione di finitura
if bFinish and not bUseOtherMillOnFinish then if bFinish then
-- inserisco la lavorazione -- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
@@ -670,13 +634,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
end end
-- posizione braccio porta testa -- posizione braccio porta testa
local nSCC = MCH_SCC.ADIR_NONE EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
if BD.TURN == 2 then
nSCC = MCH_SCC.ADIR_ZP
else
nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale -- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local ptSP, ptEp local ptSP, ptEp
local bFinish local bFinish
@@ -713,7 +671,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
nMchId = nMch2Id nMchId = nMch2Id
end end
-- se abilitata, aggiungo lavorazione di finitura -- se abilitata, aggiungo lavorazione di finitura
if bFinish and not bUseOtherMillOnFinish then if bFinish then
-- inserisco la lavorazione -- inserisco la lavorazione
local sNewName = 'Prof_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local sNewName = 'Prof_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
@@ -769,46 +727,6 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
return false, sErr return false, sErr
end end
end end
-- se finitura con fresa piccola
if bFinish and bUseOtherMillOnFinish then
local sDepthFinishMill = EgtIf( bDoubleFinishMill, ( dProfDepth+ BD.MILL_OVERLAP ) / 2, dProfDepth + BD.CUT_EXTRA)
local sMachName = 'Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
nMchId = EgtAddMachining( sMachName, sFinishMilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sMachName .. '-' .. sFinishMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, sDepthFinishMill)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
end
if bDoubleFinishMill then
local sNewName = 'FinB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
-- ottengo l'inversione e setto il contrario
local bInvertMode = EgtGetMachiningParam( MCH_MP.INVERT)
EgtSetMachiningParam( MCH_MP.INVERT, not bInvertMode)
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
end
end
end
end end
-- aggiorno ingombro testa o coda per presa -- aggiorno ingombro testa o coda per presa
if nSide ~= 1 then -- se feature di fianco o da sotto if nSide ~= 1 then -- se feature di fianco o da sotto
+41 -68
View File
@@ -1,13 +1,10 @@
-- ProcessProfConcave.lua by Egaltech s.r.l. 2023/07/31 -- ProcessProfConcave.lua by Egaltech s.r.l. 2022/05/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/02/02 Aggiunta funzione OnlyChamfer.
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto. -- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria. -- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
-- 2023/05/25 Sistemazione SCC per TURN.
-- 2023/07/31 Correzione e semplificazione di ModifySideInvertLead per invert.
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessProfConcave = {} local ProcessProfConcave = {}
@@ -91,7 +88,7 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
bFirstTrim, bLastTrim, dOffsetPar) bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
-- 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
@@ -99,9 +96,6 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
local ptEp = EgtGetMachiningEndPoint() local 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
-- recupero flag inversione direzione di lavorazione
local bInvertMode = EgtGetMachiningParam( MCH_MP.INVERT)
-- verifico se da aggiustare
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()) <
abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptEp:getX()) then abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptEp:getX()) then
-- ottengo il lato lavoro e lo inverto -- ottengo il lato lavoro e lo inverto
@@ -109,14 +103,9 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
if nSideWork > 0 then if nSideWork > 0 then
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( nSideWork == MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)) EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( nSideWork == MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT))
end end
-- imposto il contrario dell'inversione trovata -- ottengo l'inversione e setto il contrario
bInvertMode = not bInvertMode local bInvertMode = EgtGetMachiningParam( MCH_MP.INVERT)
EgtSetMachiningParam( MCH_MP.INVERT, bInvertMode) EgtSetMachiningParam( MCH_MP.INVERT, not bInvertMode)
end
-- se lavorazione invertita rispetto a geometria, scambio dati di inizio e fine
if bInvertMode then
dLenIni, dLenLst = dLenLst, dLenIni
bFirstTrim, bLastTrim = bLastTrim, bFirstTrim
end end
-- modifico attacco e uscita -- modifico attacco e uscita
if dLenIni and dLenLst then if dLenIni and dLenLst then
@@ -130,6 +119,9 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
if bLastTrim and dLenLst < dToolDiam / 2 + ( 20 * GEO.EPS_SMALL) then if bLastTrim and dLenLst < dToolDiam / 2 + ( 20 * GEO.EPS_SMALL) then
dEndAddLen = dToolDiam / 2 - dLenLst + dOffsetPar + 1 dEndAddLen = dToolDiam / 2 - dLenLst + dOffsetPar + 1
end end
if bFlagInvert then
dStartAddLen, dEndAddLen = dEndAddLen, dStartAddLen
end
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dStartAddLen) EgtSetMachiningParam( MCH_MP.STARTADDLEN, dStartAddLen)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
end end
@@ -203,25 +195,6 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
return nChamfer, dDepth, sMilling, sMilling2 return nChamfer, dDepth, sMilling, sMilling2
end end
---------------------------------------------------------------------
function GetSccForTurn( vtN, sType)
local nSCC
if abs( vtN:getZ()) > abs( vtN:getY()) then
if sType == 'V' then
nSCC = EgtIf( vtN:getZ() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_ZM)
else
nSCC = EgtIf( vtN:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
end
else
if sType == 'V' then
nSCC = EgtIf( vtN:getY() > 0, MCH_SCC.ADIR_ZM, MCH_SCC.ADIR_ZP)
else
nSCC = EgtIf( vtN:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
end
end
return nSCC
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
@@ -254,6 +227,8 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- acquisisco informazioni sulle facce estreme -- acquisisco informazioni sulle facce estreme
local _, _, dLenIni = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFirstFacet, GDB_ID.ROOT) local _, _, dLenIni = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFirstFacet, GDB_ID.ROOT)
local _, _, dLenLst = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nLastFacet, GDB_ID.ROOT) local _, _, dLenLst = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nLastFacet, GDB_ID.ROOT)
-- flag percorso invertito
local bFlagInvert = false
-- verifico se in testa o coda -- verifico se in testa o coda
local bHead = ( vtN:getX() > 0) local bHead = ( vtN:getX() > 0)
EgtOutLog( 'vtN=' .. tostring( vtN), 3) EgtOutLog( 'vtN=' .. tostring( vtN), 3)
@@ -290,7 +265,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- aggiungo piano di sgrossatura e lo lavoro -- aggiungo piano 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, b3Solid) > 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 -- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
@@ -311,8 +286,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- altrimenti applico taglio di lama -- altrimenti applico taglio di lama
else else
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId} Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH) local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then if not bOk then
return false, sErr return false, sErr
@@ -350,6 +324,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
( not bHead and vtExtr:getY() > 0.1) then ( not bHead and vtExtr:getY() > 0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end end
-- altrimenti lavorazione dal davanti o dal dietro -- altrimenti lavorazione dal davanti o dal dietro
else else
@@ -358,12 +333,14 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if vtExtr:getZ() < 0 then if vtExtr:getZ() < 0 then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end end
-- se lavorazione a destra da dietro o sinistra di fronte, inverto -- se lavorazione a destra da dietro o sinistra di fronte, inverto
if ( bHead and vtN:getY() > 0.1) or if ( bHead and vtN:getY() > 0.1) or
( not bHead and vtN:getY() < -0.1) then ( not bHead and vtN:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end end
end end
-- assegno affondamento e offset radiale -- assegno affondamento e offset radiale
@@ -381,7 +358,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
else else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione -- della feature inverto il punto di inizio della lavorazione
ModifySideInvertLead( Proc, bHead, dToolDiam + ( 2 * dExtra), dLenIni, dLenLst, bFirstTrim, bLastTrim, dExtra) ModifySideInvertLead( Proc, bHead, dToolDiam + ( 2 * dExtra), dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dExtra)
end end
-- se lavorazione da due parti, aggiungo la seconda -- se lavorazione da due parti, aggiungo la seconda
if bDoubleCham then if bDoubleCham then
@@ -396,6 +373,8 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}}) EgtSetMachiningGeometry( {{ AuxId, -1}})
-- resetto il flag inversione percorso
bFlagInvert = false
-- se lavorazione da sopra o da sotto -- se lavorazione da sopra o da sotto
if nSide ~= 0 then if nSide ~= 0 then
-- se lavorazione a destra di fronte o sinistra da dietro, inverto -- se lavorazione a destra di fronte o sinistra da dietro, inverto
@@ -403,6 +382,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
( not bHead and vtExtr:getY() < -0.1) then ( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end end
else else
-- se lavorazione a destra di fronte o sinistra da dietro, inverto -- se lavorazione a destra di fronte o sinistra da dietro, inverto
@@ -410,6 +390,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
( not bHead and vtN:getY() < -0.1) then ( not bHead and vtN:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end end
end end
-- assegno affondamento e offset radiale -- assegno affondamento e offset radiale
@@ -427,7 +408,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
else else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione -- della feature inverto il punto di inizio della lavorazione
ModifySideInvertLead( Proc, bHead, dToolDiam + ( 2 * dExtra), dLenIni, dLenLst, bFirstTrim, bLastTrim, dExtra) ModifySideInvertLead( Proc, bHead, dToolDiam + ( 2 * dExtra), dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dExtra)
end end
end end
end end
@@ -453,7 +434,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
end end
-- verifico se necessario lavorare in doppio -- verifico se necessario lavorare in doppio
local bDouble = ( dProfDepth + BD.CUT_EXTRA - 100 * GEO.EPS_SMALL > dToolMaxDepth) local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP) local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
-- se lavorazione da due parti, aggiungo la seconda -- se lavorazione da due parti, aggiungo la seconda
local sMillingDown local sMillingDown
@@ -486,11 +467,14 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}}) EgtSetMachiningGeometry( {{ AuxId, -1}})
-- resetto il flag inversione percorso
bFlagInvert = false
-- se lavorazione da sopra e da sotto -- se lavorazione da sopra e da sotto
if ( nSide == 0) then if ( nSide == 0) then
if vtExtr:getZ() > 0.1 then if vtExtr:getZ() > 0.1 then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = true
end end
-- altrimenti lavorazione davanti e dietro -- altrimenti lavorazione davanti e dietro
else else
@@ -499,13 +483,14 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
( not bHead and vtExtr:getY() < -0.1) then ( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = true
end end
end end
-- imposto l'affondamento -- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa -- posizione braccio porta testa
local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM) local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
if BD.TURN then nSCC = GetSccForTurn( vtN) end if BD.TURN then nSCC = MCH_SCC.ADIR_ZP end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) 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 bFinish local bFinish
@@ -529,7 +514,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno -- 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 -- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita -- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, dOffsetPar) ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
end end
-- se abilitata, aggiungo lavorazione di finitura -- se abilitata, aggiungo lavorazione di finitura
if bFinish then if bFinish then
@@ -563,6 +548,8 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}}) EgtSetMachiningGeometry( {{ AuxId, -1}})
-- resetto il flag inversione percorso
bFlagInvert = false
-- se lavorazione da sopra o da sotto -- se lavorazione da sopra o da sotto
if nSide ~= 0 then if nSide ~= 0 then
if not bDouble and nSide == -1 then if not bDouble and nSide == -1 then
@@ -571,6 +558,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
( not bHead and vtExtr:getY() < -0.1) then ( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end end
else else
-- se lavorazione a destra di fronte o sinistra da dietro, inverto -- se lavorazione a destra di fronte o sinistra da dietro, inverto
@@ -578,6 +566,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
( not bHead and vtExtr:getY() > 0.1) then ( not bHead and vtExtr:getY() > 0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end end
end end
-- altrimenti lavorazione dal davanti o dal dietro -- altrimenti lavorazione dal davanti o dal dietro
@@ -586,12 +575,14 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if vtExtr:getZ() < 0 then if vtExtr:getZ() < 0 then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end end
-- se lavorazione a destra da dietro o sinistra di fronte, inverto -- se lavorazione a destra da dietro o sinistra di fronte, inverto
if ( bHead and vtN:getY() > 0.1) or if ( bHead and vtN:getY() > 0.1) or
( not bHead and vtN:getY() < -0.1) then ( not bHead and vtN:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end end
end end
-- se in doppio, imposto l'affondamento -- se in doppio, imposto l'affondamento
@@ -600,7 +591,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
-- posizione braccio porta testa -- posizione braccio porta testa
local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM) local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
if BD.TURN then nSCC = GetSccForTurn( vtN) end if BD.TURN then nSCC = MCH_SCC.ADIR_ZP end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) 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 bFinish local bFinish
@@ -620,7 +611,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno -- 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 -- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita -- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, dOffsetPar) ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
end end
-- se abilitata, aggiungo lavorazione di finitura -- se abilitata, aggiungo lavorazione di finitura
if bFinish then if bFinish then
@@ -665,27 +656,14 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_BACK) EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_BACK)
else else
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTUP_TOP) EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTUP_TOP)
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, 1)
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( (dToolMaxDepth/2), 1))
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( (dToolMaxDepth/2), 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
end end
EgtSetMachiningParam( MCH_MP.INVERT, false) EgtSetMachiningParam( MCH_MP.INVERT, false)
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH') EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH')
EgtSetMachiningParam( MCH_MP.STEP, 0) EgtSetMachiningParam( MCH_MP.STEP, 0)
EgtSetMachiningParam( MCH_MP.OFFSR, 0) EgtSetMachiningParam( MCH_MP.OFFSR, 0)
if BD.TURN then if BD.TURN then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) end
local nSCC = GetSccForTurn( vtN, 'V')
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- modifico attacco e uscita per forzare risalita
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dToolDiam / 2)
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.TANGENT)
EgtSetMachiningParam( MCH_MP.LITANG, 20)
EgtSetMachiningParam( MCH_MP.LIPERP, 20)
EgtSetMachiningParam( MCH_MP.LIELEV, 20)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dToolDiam / 2)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.AS_LI)
end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
@@ -718,13 +696,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)
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1))
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dWidth, 1)) if BD.TURN then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
if BD.TURN then
local nSCC = GetSccForTurn( vtN)
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
+41 -68
View File
@@ -1,13 +1,10 @@
-- ProcessProfConvex.lua by Egaltech s.r.l. 2023/07/31 -- ProcessProfConvex.lua by Egaltech s.r.l. 2022/05/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/02/02 Aggiunta funzione OnlyChamfer.
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto. -- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria. -- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
-- 2023/05/25 Sistemazione SCC per TURN.
-- 2023/07/31 Correzione e semplificazione di ModifySideInvertLead per invert.
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessProfConvex = {} local ProcessProfConvex = {}
@@ -91,7 +88,7 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
bFirstTrim, bLastTrim, dOffsetPar) bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
-- 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
@@ -99,9 +96,6 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
local ptEp = EgtGetMachiningEndPoint() local 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
-- recupero flag inversione direzione di lavorazione
local bInvertMode = EgtGetMachiningParam( MCH_MP.INVERT)
-- verifico se da aggiustare
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()) <
abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptEp:getX()) then abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptEp:getX()) then
-- ottengo il lato lavoro e lo inverto -- ottengo il lato lavoro e lo inverto
@@ -109,14 +103,9 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
if nSideWork > 0 then if nSideWork > 0 then
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( nSideWork == MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)) EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( nSideWork == MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT))
end end
-- imposto il contrario dell'inversione trovata -- ottengo l'inversione e setto il contrario
bInvertMode = not bInvertMode local bInvertMode = EgtGetMachiningParam( MCH_MP.INVERT)
EgtSetMachiningParam( MCH_MP.INVERT, bInvertMode) EgtSetMachiningParam( MCH_MP.INVERT, not bInvertMode)
end
-- se lavorazione invertita rispetto a geometria, scambio dati di inizio e fine
if bInvertMode then
dLenIni, dLenLst = dLenLst, dLenIni
bFirstTrim, bLastTrim = bLastTrim, bFirstTrim
end end
-- modifico attacco e uscita -- modifico attacco e uscita
if dLenIni and dLenLst then if dLenIni and dLenLst then
@@ -130,6 +119,9 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
if bLastTrim and dLenLst < dToolDiam / 2 + ( 20 * GEO.EPS_SMALL) then if bLastTrim and dLenLst < dToolDiam / 2 + ( 20 * GEO.EPS_SMALL) then
dEndAddLen = dToolDiam / 2 - dLenLst + dOffsetPar + 1 dEndAddLen = dToolDiam / 2 - dLenLst + dOffsetPar + 1
end end
if bFlagInvert then
dStartAddLen, dEndAddLen = dEndAddLen, dStartAddLen
end
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dStartAddLen) EgtSetMachiningParam( MCH_MP.STARTADDLEN, dStartAddLen)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
end end
@@ -203,25 +195,6 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
return nChamfer, dDepth, sMilling, sMilling2 return nChamfer, dDepth, sMilling, sMilling2
end end
---------------------------------------------------------------------
function GetSccForTurn( vtN, sType)
local nSCC
if abs( vtN:getZ()) > abs( vtN:getY()) then
if sType == 'V' then
nSCC = EgtIf( vtN:getZ() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_ZM)
else
nSCC = EgtIf( vtN:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
end
else
if sType == 'V' then
nSCC = EgtIf( vtN:getY() > 0, MCH_SCC.ADIR_ZM, MCH_SCC.ADIR_ZP)
else
nSCC = EgtIf( vtN:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
end
end
return nSCC
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
@@ -254,6 +227,8 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- acquisisco informazioni sulle facce estreme -- acquisisco informazioni sulle facce estreme
local _, _, dLenIni = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFirstFacet, GDB_ID.ROOT) local _, _, dLenIni = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFirstFacet, GDB_ID.ROOT)
local _, _, dLenLst = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nLastFacet, GDB_ID.ROOT) local _, _, dLenLst = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nLastFacet, GDB_ID.ROOT)
-- flag percorso invertito
local bFlagInvert = false
-- verifico se in testa o coda -- verifico se in testa o coda
local bHead = ( vtN:getX() > 0) local bHead = ( vtN:getX() > 0)
EgtOutLog( 'vtN=' .. tostring( vtN), 3) EgtOutLog( 'vtN=' .. tostring( vtN), 3)
@@ -290,7 +265,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- aggiungo piano di sgrossatura e lo lavoro -- aggiungo piano 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, b3Solid) > 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 -- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
@@ -311,8 +286,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- altrimenti applico taglio di lama -- altrimenti applico taglio di lama
else else
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId} Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH) local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then if not bOk then
return false, sErr return false, sErr
@@ -350,6 +324,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
( not bHead and vtExtr:getY() > 0.1) then ( not bHead and vtExtr:getY() > 0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end end
-- altrimenti lavorazione dal davanti o dal dietro -- altrimenti lavorazione dal davanti o dal dietro
else else
@@ -358,12 +333,14 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if vtExtr:getZ() < 0 then if vtExtr:getZ() < 0 then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end end
-- se lavorazione a destra da dietro o sinistra di fronte, inverto -- se lavorazione a destra da dietro o sinistra di fronte, inverto
if ( bHead and vtN:getY() > 0.1) or if ( bHead and vtN:getY() > 0.1) or
( not bHead and vtN:getY() < -0.1) then ( not bHead and vtN:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end end
end end
-- assegno affondamento e offset radiale -- assegno affondamento e offset radiale
@@ -381,7 +358,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
else else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione -- della feature inverto il punto di inizio della lavorazione
ModifySideInvertLead( Proc, bHead, dToolDiam + ( 2 * dExtra), dLenIni, dLenLst, bFirstTrim, bLastTrim, dExtra) ModifySideInvertLead( Proc, bHead, dToolDiam + ( 2 * dExtra), dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dExtra)
end end
-- se lavorazione da due parti, aggiungo la seconda -- se lavorazione da due parti, aggiungo la seconda
if bDoubleCham then if bDoubleCham then
@@ -396,6 +373,8 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}}) EgtSetMachiningGeometry( {{ AuxId, -1}})
-- resetto il flag inversione percorso
bFlagInvert = false
-- se lavorazione da sopra o da sotto -- se lavorazione da sopra o da sotto
if nSide ~= 0 then if nSide ~= 0 then
-- se lavorazione a destra di fronte o sinistra da dietro, inverto -- se lavorazione a destra di fronte o sinistra da dietro, inverto
@@ -403,6 +382,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
( not bHead and vtExtr:getY() < -0.1) then ( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end end
else else
-- se lavorazione a destra di fronte o sinistra da dietro, inverto -- se lavorazione a destra di fronte o sinistra da dietro, inverto
@@ -410,6 +390,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
( not bHead and vtN:getY() < -0.1) then ( not bHead and vtN:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end end
end end
-- assegno affondamento e offset radiale -- assegno affondamento e offset radiale
@@ -427,7 +408,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
else else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione -- della feature inverto il punto di inizio della lavorazione
ModifySideInvertLead( Proc, bHead, dToolDiam + ( 2 * dExtra), dLenIni, dLenLst, bFirstTrim, bLastTrim, dExtra) ModifySideInvertLead( Proc, bHead, dToolDiam + ( 2 * dExtra), dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dExtra)
end end
end end
end end
@@ -453,7 +434,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
end end
-- verifico se necessario lavorare in doppio -- verifico se necessario lavorare in doppio
local bDouble = ( dProfDepth + BD.CUT_EXTRA - 100 * GEO.EPS_SMALL > dToolMaxDepth) local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP) local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
-- se lavorazione da due parti, aggiungo la seconda -- se lavorazione da due parti, aggiungo la seconda
local sMillingDown local sMillingDown
@@ -486,11 +467,14 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}}) EgtSetMachiningGeometry( {{ AuxId, -1}})
-- resetto il flag inversione percorso
bFlagInvert = false
-- se lavorazione da sopra e da sotto -- se lavorazione da sopra e da sotto
if ( nSide == 0) then if ( nSide == 0) then
if vtExtr:getZ() > 0.1 then if vtExtr:getZ() > 0.1 then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = true
end end
-- altrimenti lavorazione davanti e dietro -- altrimenti lavorazione davanti e dietro
else else
@@ -499,13 +483,14 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
( not bHead and vtExtr:getY() < -0.1) then ( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = true
end end
end end
-- imposto l'affondamento -- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa -- posizione braccio porta testa
local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM) local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
if BD.TURN then nSCC = GetSccForTurn( vtN) end if BD.TURN then nSCC = MCH_SCC.ADIR_ZP end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) 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 bFinish local bFinish
@@ -529,7 +514,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno -- 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 -- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita -- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, dOffsetPar) ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
end end
-- se abilitata, aggiungo lavorazione di finitura -- se abilitata, aggiungo lavorazione di finitura
if bFinish then if bFinish then
@@ -563,6 +548,8 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}}) EgtSetMachiningGeometry( {{ AuxId, -1}})
-- resetto il flag inversione percorso
bFlagInvert = false
-- se lavorazione da sopra o da sotto -- se lavorazione da sopra o da sotto
if nSide ~= 0 then if nSide ~= 0 then
if not bDouble and nSide == -1 then if not bDouble and nSide == -1 then
@@ -571,6 +558,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
( not bHead and vtExtr:getY() < -0.1) then ( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end end
else else
-- se lavorazione a destra di fronte o sinistra da dietro, inverto -- se lavorazione a destra di fronte o sinistra da dietro, inverto
@@ -578,6 +566,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
( not bHead and vtExtr:getY() > 0.1) then ( not bHead and vtExtr:getY() > 0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end end
end end
-- altrimenti lavorazione dal davanti o dal dietro -- altrimenti lavorazione dal davanti o dal dietro
@@ -586,12 +575,14 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if vtExtr:getZ() < 0 then if vtExtr:getZ() < 0 then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end end
-- se lavorazione a destra da dietro o sinistra di fronte, inverto -- se lavorazione a destra da dietro o sinistra di fronte, inverto
if ( bHead and vtN:getY() > 0.1) or if ( bHead and vtN:getY() > 0.1) or
( not bHead and vtN:getY() < -0.1) then ( not bHead and vtN:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end end
end end
-- se in doppio, imposto l'affondamento -- se in doppio, imposto l'affondamento
@@ -600,7 +591,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
-- posizione braccio porta testa -- posizione braccio porta testa
local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM) local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
if BD.TURN then nSCC = GetSccForTurn( vtN) end if BD.TURN then nSCC = MCH_SCC.ADIR_ZP end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) 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 bFinish local bFinish
@@ -620,7 +611,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno -- 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 -- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita -- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, dOffsetPar) ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
end end
-- se abilitata, aggiungo lavorazione di finitura -- se abilitata, aggiungo lavorazione di finitura
if bFinish then if bFinish then
@@ -665,27 +656,14 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_BACK) EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_BACK)
else else
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTUP_TOP) EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTUP_TOP)
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, 1)
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( (dToolMaxDepth/2), 1))
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( (dToolMaxDepth/2), 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
end end
EgtSetMachiningParam( MCH_MP.INVERT, false) EgtSetMachiningParam( MCH_MP.INVERT, false)
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH') EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH')
EgtSetMachiningParam( MCH_MP.STEP, 0) EgtSetMachiningParam( MCH_MP.STEP, 0)
EgtSetMachiningParam( MCH_MP.OFFSR, 0) EgtSetMachiningParam( MCH_MP.OFFSR, 0)
if BD.TURN then if BD.TURN then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) end
local nSCC = GetSccForTurn( vtN, 'V')
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- modifico attacco e uscita per forzare risalita
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dToolDiam / 2)
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.TANGENT)
EgtSetMachiningParam( MCH_MP.LITANG, 20)
EgtSetMachiningParam( MCH_MP.LIPERP, 20)
EgtSetMachiningParam( MCH_MP.LIELEV, 20)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dToolDiam / 2)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.AS_LI)
end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
@@ -718,13 +696,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)
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1))
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dWidth, 1)) if BD.TURN then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
if BD.TURN then
local nSCC = GetSccForTurn( vtN)
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
+7 -9
View File
@@ -5,7 +5,6 @@
-- 2022/02/02 Aggiunta funzione OnlyChamfer. -- 2022/02/02 Aggiunta funzione OnlyChamfer.
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto. -- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria. -- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessProfFront = {} local ProcessProfFront = {}
@@ -237,7 +236,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- aggiungo piano di sgrossatura e lo lavoro -- aggiungo piano 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, b3Solid) > 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 -- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
@@ -258,8 +257,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- altrimenti applico taglio di lama -- altrimenti applico taglio di lama
else else
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId} Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH) local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then if not bOk then
return false, sErr return false, sErr
@@ -467,7 +465,8 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
return false, sErr return false, sErr
else else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione -- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam) ModifySideInvertLead( Proc, bHead, dToolDiam)
end end
-- se abilitata, aggiungo lavorazione di finitura -- se abilitata, aggiungo lavorazione di finitura
@@ -555,7 +554,8 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
return false, sErr return false, sErr
else else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione -- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam) ModifySideInvertLead( Proc, bHead, dToolDiam)
end end
-- se abilitata, aggiungo lavorazione di finitura -- se abilitata, aggiungo lavorazione di finitura
@@ -602,9 +602,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH') EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH')
EgtSetMachiningParam( MCH_MP.STEP, 0) EgtSetMachiningParam( MCH_MP.STEP, 0)
EgtSetMachiningParam( MCH_MP.OFFSR, 0) EgtSetMachiningParam( MCH_MP.OFFSR, 0)
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1))
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dWidth, 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- imposto tipo uso faccia -- imposto tipo uso faccia
local nFaceUse = MCH_MILL_FU.PARAL_DOWN local nFaceUse = MCH_MILL_FU.PARAL_DOWN
if nSide == -1 then if nSide == -1 then
+33 -28
View File
@@ -1,4 +1,4 @@
-- ProcessProfHead.lua by Egaltech s.r.l. 2023/07/31 -- ProcessProfHead.lua by Egaltech s.r.l. 2022/05/28
-- 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.
@@ -6,8 +6,6 @@
-- 2022/02/02 Aggiunta funzione OnlyChamfer. -- 2022/02/02 Aggiunta funzione OnlyChamfer.
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto. -- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria. -- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
-- 2023/07/31 Correzione e semplificazione di ModifySideInvertLead per invert.
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessProfHead = {} local ProcessProfHead = {}
@@ -83,7 +81,7 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
bFirstTrim, bLastTrim, dOffsetPar) bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
-- 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
@@ -91,9 +89,6 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
local ptEp = EgtGetMachiningEndPoint() local 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
-- recupero flag inversione direzione di lavorazione
local bInvertMode = EgtGetMachiningParam( MCH_MP.INVERT)
-- verifico se da aggiustare
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()) <
abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptEp:getX()) then abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptEp:getX()) then
-- ottengo il lato lavoro e lo inverto -- ottengo il lato lavoro e lo inverto
@@ -101,14 +96,9 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
if nSideWork > 0 then if nSideWork > 0 then
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( nSideWork == MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)) EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( nSideWork == MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT))
end end
-- imposto il contrario dell'inversione trovata -- ottengo l'inversione e setto il contrario
bInvertMode = not bInvertMode local bInvertMode = EgtGetMachiningParam( MCH_MP.INVERT)
EgtSetMachiningParam( MCH_MP.INVERT, bInvertMode) EgtSetMachiningParam( MCH_MP.INVERT, not bInvertMode)
end
-- se lavorazione invertita rispetto a geometria, scambio dati di inizio e fine
if bInvertMode then
dLenIni, dLenLst = dLenLst, dLenIni
bFirstTrim, bLastTrim = bLastTrim, bFirstTrim
end end
-- modifico attacco e uscita -- modifico attacco e uscita
if dLenIni and dLenLst then if dLenIni and dLenLst then
@@ -122,6 +112,9 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
if bLastTrim and dLenLst < dToolDiam / 2 + ( 20 * GEO.EPS_SMALL) then if bLastTrim and dLenLst < dToolDiam / 2 + ( 20 * GEO.EPS_SMALL) then
dEndAddLen = dToolDiam / 2 - dLenLst + dOffsetPar + 1 dEndAddLen = dToolDiam / 2 - dLenLst + dOffsetPar + 1
end end
if bFlagInvert then
dStartAddLen, dEndAddLen = dEndAddLen, dStartAddLen
end
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dStartAddLen) EgtSetMachiningParam( MCH_MP.STARTADDLEN, dStartAddLen)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
end end
@@ -231,6 +224,8 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- acquisisco informazioni sulle facce estreme -- acquisisco informazioni sulle facce estreme
local _, _, dLenIni = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFirstFacet, GDB_ID.ROOT) local _, _, dLenIni = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFirstFacet, GDB_ID.ROOT)
local _, _, dLenLst = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nLastFacet, GDB_ID.ROOT) local _, _, dLenLst = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nLastFacet, GDB_ID.ROOT)
-- flag percorso invertito
local bFlagInvert = false
-- verifico se in testa o coda -- verifico se in testa o coda
local bHead = ( vtN:getX() > 0) local bHead = ( vtN:getX() > 0)
EgtOutLog( 'vtN=' .. tostring( vtN), 3) EgtOutLog( 'vtN=' .. tostring( vtN), 3)
@@ -272,7 +267,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- aggiungo piano di sgrossatura e lo lavoro -- aggiungo piano 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, b3Solid) > 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 -- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
@@ -293,8 +288,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- altrimenti applico taglio di lama -- altrimenti applico taglio di lama
else else
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId} Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH) local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then if not bOk then
return false, sErr return false, sErr
@@ -332,6 +326,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
( not bHead and vtExtr:getY() > 0.1) then ( not bHead and vtExtr:getY() > 0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end end
-- altrimenti lavorazione dal davanti o dal dietro -- altrimenti lavorazione dal davanti o dal dietro
else else
@@ -340,12 +335,14 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if vtExtr:getZ() < 0 then if vtExtr:getZ() < 0 then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end end
-- se lavorazione a destra da dietro o sinistra di fronte, inverto -- se lavorazione a destra da dietro o sinistra di fronte, inverto
if ( bHead and vtN:getY() > 0.1) or if ( bHead and vtN:getY() > 0.1) or
( not bHead and vtN:getY() < -0.1) then ( not bHead and vtN:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end end
end end
-- assegno affondamento e offset radiale -- assegno affondamento e offset radiale
@@ -364,7 +361,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione -- della feature inverto il punto di inizio della lavorazione
ModifySideInvertLead( Proc, bHead, dToolDiam + ( 2 * dExtra), dLenIni, ModifySideInvertLead( Proc, bHead, dToolDiam + ( 2 * dExtra), dLenIni,
dLenLst, ( #vAngs > 0 and vAngs[1] == 0), ( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2)), dExtra) dLenLst, ( #vAngs > 0 and vAngs[1] == 0), ( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2)), bFlagInvert, dExtra)
end end
-- se lavorazione da due parti, aggiungo la seconda -- se lavorazione da due parti, aggiungo la seconda
if bDoubleCham then if bDoubleCham then
@@ -379,6 +376,8 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}}) EgtSetMachiningGeometry( {{ AuxId, -1}})
-- resetto il flag inversione percorso
bFlagInvert = false
-- se lavorazione da sopra o da sotto -- se lavorazione da sopra o da sotto
if nSide ~= 0 then if nSide ~= 0 then
-- se lavorazione a destra di fronte o sinistra da dietro, inverto -- se lavorazione a destra di fronte o sinistra da dietro, inverto
@@ -386,6 +385,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
( not bHead and vtExtr:getY() < -0.1) then ( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end end
-- altrimenti lavorazione dal davanti o dal dietro -- altrimenti lavorazione dal davanti o dal dietro
else else
@@ -394,6 +394,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
( not bHead and vtN:getY() < -0.1) then ( not bHead and vtN:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end end
end end
-- assegno affondamento e offset radiale -- assegno affondamento e offset radiale
@@ -412,7 +413,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno -- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione -- della feature inverto il punto di inizio della lavorazione
ModifySideInvertLead( Proc, bHead, dToolDiam + ( 2 * dExtra), dLenIni, ModifySideInvertLead( Proc, bHead, dToolDiam + ( 2 * dExtra), dLenIni,
dLenLst, ( #vAngs > 0 and vAngs[1] == 0), ( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2)), dExtra) dLenLst, ( #vAngs > 0 and vAngs[1] == 0), ( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2)), bFlagInvert, dExtra)
end end
end end
end end
@@ -472,6 +473,8 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}}) EgtSetMachiningGeometry( {{ AuxId, -1}})
-- resetto il flag inversione percorso
bFlagInvert = false
-- se lavorazione da sopra e da sotto -- se lavorazione da sopra e da sotto
if ( nSide == 0) then if ( nSide == 0) then
if vtExtr:getZ() > 0.1 then if vtExtr:getZ() > 0.1 then
@@ -514,7 +517,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco -- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita -- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni,
dLenLst, ( #vAngs > 0 and vAngs[1] == 0), ( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2)), dOffsetPar) dLenLst, ( #vAngs > 0 and vAngs[1] == 0), ( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2)), bFlagInvert, dOffsetPar)
end end
-- se abilitata, aggiungo lavorazione di finitura -- se abilitata, aggiungo lavorazione di finitura
if bFinish then if bFinish then
@@ -548,6 +551,8 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}}) EgtSetMachiningGeometry( {{ AuxId, -1}})
-- resetto il flag inversione percorso
bFlagInvert = false
-- se lavorazione da sopra o da sotto -- se lavorazione da sopra o da sotto
if nSide ~= 0 then if nSide ~= 0 then
if not bDouble and nSide == -1 then if not bDouble and nSide == -1 then
@@ -556,6 +561,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
( not bHead and vtExtr:getY() < -0.1) then ( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end end
else else
-- se lavorazione a destra di fronte o sinistra da dietro, inverto -- se lavorazione a destra di fronte o sinistra da dietro, inverto
@@ -563,6 +569,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
( not bHead and vtExtr:getY() > 0.1) then ( not bHead and vtExtr:getY() > 0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end end
end end
-- altrimenti lavorazione dal davanti o dal dietro -- altrimenti lavorazione dal davanti o dal dietro
@@ -571,12 +578,14 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if vtExtr:getZ() < 0 then if vtExtr:getZ() < 0 then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end end
-- se lavorazione a destra da dietro o sinistra di fronte, inverto -- se lavorazione a destra da dietro o sinistra di fronte, inverto
if ( bHead and vtN:getY() > 0.1) or if ( bHead and vtN:getY() > 0.1) or
( not bHead and vtN:getY() < -0.1) then ( not bHead and vtN:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end end
end end
-- se in doppio, imposto l'affondamento -- se in doppio, imposto l'affondamento
@@ -604,7 +613,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco -- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita -- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni,
dLenLst, ( #vAngs > 0 and vAngs[1] == 0), ( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2)), dOffsetPar) dLenLst, ( #vAngs > 0 and vAngs[1] == 0), ( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2)), bFlagInvert, dOffsetPar)
end end
-- se abilitata, aggiungo lavorazione di finitura -- se abilitata, aggiungo lavorazione di finitura
if bFinish then if bFinish then
@@ -657,9 +666,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH') EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH')
EgtSetMachiningParam( MCH_MP.STEP, 0) EgtSetMachiningParam( MCH_MP.STEP, 0)
EgtSetMachiningParam( MCH_MP.OFFSR, 0) EgtSetMachiningParam( MCH_MP.OFFSR, 0)
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dElev, 1))
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dElev, 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- imposto posizione braccio -- imposto posizione braccio
local nSCC = MCH_SCC.ADIR_YM local nSCC = MCH_SCC.ADIR_YM
if nSide == 0 then if nSide == 0 then
@@ -699,9 +706,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH') EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH')
EgtSetMachiningParam( MCH_MP.STEP, 0) EgtSetMachiningParam( MCH_MP.STEP, 0)
EgtSetMachiningParam( MCH_MP.OFFSR, 0) EgtSetMachiningParam( MCH_MP.OFFSR, 0)
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dElev, 1))
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dElev, 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- imposto posizione braccio -- imposto posizione braccio
local nSCC = MCH_SCC.ADIR_YM local nSCC = MCH_SCC.ADIR_YM
if nSide == 0 then if nSide == 0 then
+15 -39
View File
@@ -1,4 +1,4 @@
-- ProcessRidgeLap.lua by Egaltech s.r.l. 2023/08/10 -- ProcessRidgeLap.lua by Egaltech s.r.l. 2021/09/10
-- Gestione calcolo mezzolegno di testa per Travi -- Gestione calcolo mezzolegno di testa per Travi
-- Tabella per definizione modulo -- Tabella per definizione modulo
@@ -10,7 +10,6 @@ local BL = require( 'BeamLib')
local Fbs = require( 'FacesBySaw') local Fbs = require( 'FacesBySaw')
local Cut = require( 'ProcessCut') local Cut = require( 'ProcessCut')
local DC = require( 'DiceCut') local DC = require( 'DiceCut')
local LapJoint = require( 'ProcessLapJoint')
EgtOutLog( ' ProcessRidgeLap started', 1) EgtOutLog( ' ProcessRidgeLap started', 1)
@@ -27,8 +26,8 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Classificazione della feature -- Classificazione della feature
function ProcessRidgeLap.Classify( Proc, b3Raw) function ProcessRidgeLap.Classify( Proc, b3Raw)
-- se PF con testa da sotto oppure 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, false return true, false
end end
-- Se più corta del limite si può fare anche da sotto -- Se più corta del limite si può fare anche da sotto
@@ -49,8 +48,6 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
local nForceUseBladeOnNotContinueFace = EgtGetInfo( Proc.Id, 'Q04', 'i') or 0
local bUseMill = ( EgtGetInfo( Proc.Id, 'Q05', 'i') or 0) == 1
-- recupero l'ingombro del grezzo di appartenenza -- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo -- ingombro del pezzo
@@ -135,20 +132,9 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- applico taglio di lama -- applico taglio di lama
local b3Cut = EgtGetBBoxGlob( AddId or GDB_ID.NULL, GDB_BB.STANDARD) local b3Cut = EgtGetBBoxGlob( AddId or GDB_ID.NULL, GDB_BB.STANDARD)
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Cut, Fct = 1, Flg = Proc.Flg, local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Cut, Fct = 1, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId} Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc) local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, false)
if BL.IsCutNeeded( CutProc, b3Raw, dOvmHead) then if not bOk then return bOk, sErr end
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, false)
if not bOk then return bOk, sErr end
elseif bUseMill then
Proc.bForceMill = true
return LapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
elseif nForceUseBladeOnNotContinueFace > 0 then
EgtSurfTmRemoveFacet( Proc.Id, vFaceOrd[1] - 1)
Proc.Fct = Proc.Fct - 1
Proc.Face = BL.GetFacetsInfo( Proc, b3Raw)
return LapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
end end
end end
-- recupero gruppo per geometria addizionale -- recupero gruppo per geometria addizionale
@@ -173,18 +159,18 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
-- calcolo riferimenti per facce inclinate -- calcolo riferimenti per facce inclinate
local vtRef = Vector3d( vtN[vFaceOrd[3]]) local vtRef = Vector3d( vtN[vFaceOrd[3]])
local vtRef2 = Vector3d( vtN[vFaceOrd[2]]) local vtRef2 = EgtIf( bHead, X_AX(), -X_AX())
-- eseguo -- eseguo
for i = 1, #vCuts do for i = 1, #vCuts do
local vtOrtho local nOrthoOpposite
if i % 2 == 1 then if i % 2 == 1 then
vtOrtho = vtRef nOrthoOpposite = BL.GetNearestOrthoOpposite( vtRef)
else else
vtOrtho = vtRef2 nOrthoOpposite = BL.GetNearestOrthoOpposite( vtRef2)
end end
-- lavoro la faccia -- lavoro la faccia
for j = 1, #vCuts[i] do for j = 1, #vCuts[i] do
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrtho, dVzLimDwnUp, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, nOrthoOpposite, dVzLimDwnUp, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then if not bOk then
return bOk, sErr return bOk, sErr
end end
@@ -209,30 +195,20 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- aggiornamento ingombro di testa o coda -- aggiornamento ingombro di testa o coda
if Proc.Head then if Proc.Head then
local dHCI = 0 local dHCI = 0
if vtN[vFaceOrd[3]]:getZ() > 0.1 then if abs( vtN[vFaceOrd[3]]: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
else else
-- se feature inclinata, si va oltre ingombro del box. Si considera metà dell'ingombro della faccia inclinata dHCI = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()
if vtN[vFaceOrd[2]] and vtN[vFaceOrd[2]]:getZ() > 0 then
dHCI = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX() - ( vtN[vFaceOrd[2]]:getZ() * b3Raw:getDimZ())
else
dHCI = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()
end
end end
BL.UpdateHCING( nRawId, dHCI) BL.UpdateHCING( nRawId, dHCI)
elseif Proc.Tail then elseif Proc.Tail then
local dTCI = 0 local dTCI = 0
if vtN[vFaceOrd[3]]:getZ() > 0.1 then if abs( vtN[vFaceOrd[3]]: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
else else
-- se feature inclinata, si va oltre ingombro del box. Si considera metà dell'ingombro della faccia inclinata dTCI = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
if vtN[vFaceOrd[2]] and vtN[vFaceOrd[2]]:getZ() > 0 then
dTCI = Proc.Box:getMax():getX() - b3Solid:getMin():getX() - ( vtN[vFaceOrd[2]]:getZ() * b3Raw:getDimZ())
else
dTCI = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
end
end end
BL.UpdateTCING( nRawId, dTCI) BL.UpdateTCING( nRawId, dTCI)
end end
+17 -41
View File
@@ -1,4 +1,4 @@
-- ProcessRoundArch.lua by Egaltech s.r.l. 2023/12/07 -- ProcessRoundArch.lua by Egaltech s.r.l. 2021/01/29
-- Gestione calcolo archi per Travi -- Gestione calcolo archi per Travi
-- Tabella per definizione modulo -- Tabella per definizione modulo
@@ -93,8 +93,6 @@ function ProcessRoundArch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- normale alla superficie nel mezzo
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, Proc.Fct // 2, GDB_RT.GLOB)
-- recupero e verifico l'entità curva -- recupero e verifico l'entità curva
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if AuxId then AuxId = AuxId + Proc.Id end if AuxId then AuxId = AuxId + Proc.Id end
@@ -118,13 +116,10 @@ function ProcessRoundArch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
-- recupero i dati dell'utensile -- recupero i dati dell'utensile
local dMaxDepth = 0 local dMaxDepth = 0
local bCW = true
if EgtMdbSetCurrMachining( sMilling) then if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
local dSpeed = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) or 0
bCW = ( dSpeed >= 0)
end end
end end
-- ne verifico la lunghezza per eventuale spezzatura e lavorazione in doppio -- ne verifico la lunghezza per eventuale spezzatura e lavorazione in doppio
@@ -183,10 +178,6 @@ function ProcessRoundArch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
end end
end end
-- se lavorazione in doppio senza codolo, aggiungo sovrapposizione
if nDouble == 2 and dDimStrip < 10 * GEO.EPS_SMALL then
dDepth = dDepth + BD.MILL_OVERLAP / 2
end
-- se utensile orizzontale verso Y+, non in doppio e codolo da lasciare, devo invertire per lavorare sempre da Y- -- se utensile orizzontale verso Y+, non in doppio e codolo da lasciare, devo invertire per lavorare sempre da Y-
if vtExtr:getY() > 0.707 and nDouble == 1 and bStripOnSide then if vtExtr:getY() > 0.707 and nDouble == 1 and bStripOnSide then
bToolInv = true bToolInv = true
@@ -195,7 +186,7 @@ function ProcessRoundArch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
for i = 1, nStep do for i = 1, nStep do
for j = 1, nDouble do for j = 1, nDouble do
-- inserisco la lavorazione -- inserisco la lavorazione
local sName = 'Arch_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local sName = 'Free_' .. ( 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
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
@@ -219,40 +210,25 @@ function ProcessRoundArch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
end end
-- se seconda passata, inverto direzione di lavoro -- se seconda passata, inverto direzione di lavoro
if ( j == 1 and not bToolInv) or ( j == 2 and bToolInv) then if j == 2 then
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false)) EgtSetMachiningParam( MCH_MP.INVERT, true)
else
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, false, true))
end end
-- assegno affondamento -- assegno affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- assegno lato di lavoro (per avere lavorazione climb) -- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT)) if bToolInv then
-- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
local nSCC = MCH_SCC.NONE else
if not BD.C_SIMM and not BD.TURN then EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
nSCC = MCH_SCC.ADIR_XP end
if Proc.Head then -- posizione braccio porta testa
nSCC = MCH_SCC.ADIR_XP if Proc.Head then
elseif Proc.Tail then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_XP)
nSCC = MCH_SCC.ADIR_XM elseif Proc.Tail then
elseif AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_XM)
nSCC = MCH_SCC.ADIR_YP elseif AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then
end EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
elseif BD.TURN == 2 then
nSCC = MCH_SCC.ADIR_ZP
elseif BD.TURN then
if vtN:getZ() > 0.707 then
nSCC = MCH_SCC.ADIR_ZP
elseif vtN:getZ() < -0.707 then
nSCC = MCH_SCC.ADIR_ZM
elseif vtN:getY() > 0.707 then
nSCC = MCH_SCC.ADIR_YP
elseif vtN:getY() < -0.707 then
nSCC = MCH_SCC.ADIR_YM
end
end end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
+4 -13
View File
@@ -1,8 +1,6 @@
-- ProcessSawCut.lua by Egaltech s.r.l. 2022/12/19 -- ProcessSawCut.lua by Egaltech s.r.l. 2022/03/07
-- 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). -- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- 2022/12/19 Aggiunta gestione testa da sotto.
-- 2024/01/18 Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessSawCut = {} local ProcessSawCut = {}
@@ -82,12 +80,8 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
end end
-- recupero flag per inizio e fine interni -- recupero flag per inizio e fine interni
local bInside = (( EgtGetInfo( Proc.Id, 'Q01', 'i') or 0) ~= 0) local bInside = (( EgtGetInfo( Proc.Id, 'Q01', 'i') or 0) ~= 0)
-- abilitazione lavorazione da sotto
local bDownHead = ( BD.DOWN_HEAD and vtDir:getZ() < -0.341)
local bTopHead = ( BD.DOWN_HEAD and ( vtDir:getZ() > -0.342 or not bDownHead))
-- recupero la lavorazione -- recupero la lavorazione
local sCutting local sCutting = ML.FindCutting( 'HeadSide')
sCutting, bDownHead = ML.FindCutting( 'HeadSide', bTopHead, bDownHead)
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)
@@ -107,7 +101,7 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
end end
-- determino se lavorazione da davanti o da dietro e se da sotto -- determino se lavorazione da davanti o da dietro e se da sotto
local bFront = ( vtDir ^ vtN):getX() > 0 local bFront = ( vtDir ^ vtN):getX() > 0
local bDownUp = ( not bDownHead and vtN:getZ() < -0.259) local bDownUp = ( vtN:getZ() < -0.259)
local bFillAreaPiece local bFillAreaPiece
-- se non da sotto -- se non da sotto
if not bDownUp then if not bDownUp then
@@ -230,9 +224,6 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- imposto uso della faccia -- imposto uso della faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- imposto angolo 3° asse rot
local vtOut = EgtIf( vtN:getX() > 0, X_AX(), -X_AX())
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCutting, 'perpendicular', b3Raw, vtN, vtOut))
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
+27 -123
View File
@@ -1,10 +1,8 @@
-- ProcessScarfJoint.lua by Egaltech s.r.l. 2022/09/30 -- ProcessScarfJoint.lua by Egaltech s.r.l. 2022/07/12
-- 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/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. -- 2022/07/12 Aggiunta gestione PF1250 e TURN.
-- 2023/02/14 Gestite le rotazioni di 90 deg nell'aggiornamento del grezzo.
-- 2024/09/03 In ApplyDiceCut, se possibile, i tagli paralleli sono fatti con un unico passaggio di fianco.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessScarfJoint = {} local ProcessScarfJoint = {}
@@ -102,7 +100,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch1Id, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
end end
-- Inserisco la lavorazione del lato opposto -- Inserisco la lavorazione del lato opposto
@@ -125,7 +123,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
end end
return true return true
@@ -135,9 +133,7 @@ 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 bOk = true local bOk = true
local bOk2 = true
local sErr = '' local sErr = ''
local sErr2 = ''
local vCuts = {} local vCuts = {}
if nGoodFace1 and nGoodFace4 and nGoodFace1 > 0 and nGoodFace4 > 0 then if nGoodFace1 and nGoodFace4 and nGoodFace1 > 0 and nGoodFace4 > 0 then
@@ -177,85 +173,16 @@ local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Soli
if vtO then if vtO then
vtOrthoO = Vector3d( vtO) vtOrthoO = Vector3d( vtO)
else else
if vtN[vFaceOrd[4]]:getZ() < 0.1 then vtOrthoO = Y_AX()
vtOrthoO = Z_AX()
else
vtOrthoO = Y_AX()
end
end end
end end
end end
-- extra taglio -- extra taglio
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
local dMaxDepth = 0 for j = 1, #vCuts[i] do
if EgtMdbSetCurrMachining( sCutting) then bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) if not bOk then return bOk, sErr end
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- se non ho intersezione con la faccia tappo posso fare il taglio sul fianco
if not nGoodFace1 or nGoodFace1 == 0 then
-- controllo per eseguire solo un taglio ottimizzato
local bExecJustOneCut = false
local dDiceFaceDim = GEO.INFINITO
if ( i % 2) == 0 then
for cont = 1, #vCuts[i] do
local _, dDiceFaceH, dDiceFaceV = BL.GetFaceHvRefDim( vCuts[i][cont], 0)
-- se feature verso Z, si ammette anche lavorazione in doppio
if AreSameVectorApprox( vtRef, Z_AX()) then
if dMaxDepth * 2 > dDiceFaceH + BD.CUT_EXTRA then
bExecJustOneCut = true
dDiceFaceDim = dDiceFaceH
break
end
elseif AreSameVectorApprox( vtRef, Y_AX()) or AreSameVectorApprox( vtRef, -Y_AX()) then
if dMaxDepth > dDiceFaceV + BD.CUT_EXTRA then
bExecJustOneCut = true
dDiceFaceDim = dDiceFaceV
break
end
end
end
end
-- se c'è intersezione non ci deve essere ExtraCut
else
dExtraCut = 0
end
-- se si può fare, faccio unico taglio parallelo
if bExecJustOneCut then
local bDoubleCut = false
local dCutExtra = BD.CUT_EXTRA
if dMaxDepth < dDiceFaceDim then
bDoubleCut = true
end
local nSurfToCut = EgtSurfTmBySewing( nAddGrpId, vCuts[i], false)
local nFaceUseCut1, nFaceUseCut2
-- se feature rivolta verso alto setto direzione taglio davanti e dietro
if AreSameVectorApprox( vtRef, Z_AX()) then
nFaceUseCut1, nFaceUseCut2 = MCH_MILL_FU.ORTHO_BACK, MCH_MILL_FU.ORTHO_FRONT
-- altrimenti taglio da sopra
else
nFaceUseCut2 = MCH_MILL_FU.ORTHO_DOWN
end
if Proc.Tail and AreSameVectorApprox( vtRef, Z_AX()) then
nFaceUseCut1, nFaceUseCut2 = nFaceUseCut2, nFaceUseCut1
end
if bDoubleCut then
bOk, sErr = Fbs.MakeOne( nSurfToCut, 0, sCutting, dSawDiam, nFaceUseCut1, nil, dCutExtra, BD.CUT_SIC, 0, 0, 0, '', b3Raw, true)
if not bOk then return false, sErr end
end
bOk2, sErr2 = Fbs.MakeOne( nSurfToCut, 0, sCutting, dSawDiam, nFaceUseCut2, nil, dCutExtra, BD.CUT_SIC, 0, 0, 0, '', b3Raw)
if not bOk2 then return false, sErr2 end
else
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)
if not bOk then return bOk, sErr end
end
end end
end end
-- lavoro la faccia interna in ogni caso -- lavoro la faccia interna in ogni caso
@@ -269,7 +196,7 @@ local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Soli
if vFaceOrd[3] ~= 0 then if vFaceOrd[3] ~= 0 then
-- inserisco la lavorazione -- inserisco la lavorazione
local vtOrthoO = Vector3d( vtRef) local vtOrthoO = Vector3d( vtRef)
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, dVzLimDwnUp, 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
@@ -383,12 +310,10 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa
end end
-- recupero i dati dell'utensile -- recupero i dati dell'utensile
local dSawDiam = 400 local dSawDiam = 400
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
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end end
end end
@@ -421,6 +346,7 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end 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
nGoodFace1 = EgtSurfTmFacetCount( nFace1) nGoodFace1 = EgtSurfTmFacetCount( nFace1)
nGoodFace4 = EgtSurfTmFacetCount( nFace4) nGoodFace4 = EgtSurfTmFacetCount( nFace4)
@@ -430,27 +356,21 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa
nGoodFace1 = EgtSurfTmFacetCount( nFace1) nGoodFace1 = EgtSurfTmFacetCount( nFace1)
end end
-- per macchina TURN aggiusto massima dimensione cubetto local bOkd, sErrD, vCuts = ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Solid, ptC, vtN, Proc, vtRef, bHead, sCutting, dSawDiam, b3Raw)
local dNewDiceDim
if BD.TURN and nGoodFace4 and nGoodFace4 > 0 then
local dDimRef = EgtIf( abs( vtN[vFaceOrd[4]]:getZ()) < 0.1, b3Raw:getDimZ(), b3Raw:getDimY())
if dDimRef + BD.CUT_EXTRA < dMaxDepth then
dNewDiceDim = - ( dMaxDepth - BD.CUT_EXTRA)
end
end
local bOkd, sErrD, vCuts = ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Solid, ptC, vtN, Proc, vtRef, bHead, sCutting, dSawDiam, b3Raw, dNewDiceDim)
if not bOkd then return bOkd, sErrD end if not bOkd then return bOkd, sErrD end
if #vCuts == 0 then if #vCuts == 0 then
-- se ho la faccia intermedia, per prima cosa verifico se ho intersezione con la faccia tappo -- se ho la faccia intermedia, per prima cosa verifico se ho intersezione con la faccia tappo
if nGoodFace4 ~= 0 then if nGoodFace4 ~= 0 then
-- taglio sulla faccia interna
if vFaceOrd[1] ~= 0 then
-- inserisco la lavorazione
local vtOrthoO = Vector3d( vtRef)
bOkd, sErrD = Fbs.MakeOne( Proc.Id, vFaceOrd[1] - 1, sCutting, dSawDiam, vtOrthoO, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOkd then return bOkd, sErrD end
end
-- se non ho intersezione con la faccia tappo posso fare il taglio sul fianco -- se non ho intersezione con la faccia tappo posso fare il taglio sul fianco
if not nGoodFace1 or nGoodFace1 == 0 then if not nGoodFace1 or nGoodFace1 == 0 then
-- inserisco la lavorazione
local vtRef2 = EgtIf( abs(vtRef:getZ()) < GEO.EPS_SMALL, Z_AX(), EgtIf( bHead, Y_AX(), -Y_AX()))
bOkd, sErrD = Fbs.MakeOne( nFace4, nGoodFace4 - 1, sCutting, dSawDiam, vtRef2, nil, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOkd then return bOkd, sErrD end
-- lavoro la faccia opposta (definita dal parametro P11) -- lavoro la faccia opposta (definita dal parametro P11)
if vFaceOrd[3] ~= 0 then if vFaceOrd[3] ~= 0 then
-- inserisco la lavorazione -- inserisco la lavorazione
@@ -458,20 +378,16 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa
bOkd, sErrD = Fbs.MakeOne( Proc.Id, vFaceOrd[3] - 1, sCutting, dSawDiam, vtOrthoO, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) bOkd, sErrD = Fbs.MakeOne( Proc.Id, vFaceOrd[3] - 1, sCutting, dSawDiam, vtOrthoO, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOkd then return bOkd, sErrD end if not bOkd then return bOkd, sErrD end
end end
-- altrimenti se ho intersezione forzo il DiceCut ad essere eseguito con distanze più piccole -- inserisco la lavorazione
else local vtRef2 = EgtIf( abs(vtRef:getZ()) < GEO.EPS_SMALL, Z_AX(), EgtIf( bHead, Y_AX(), -Y_AX()))
bOkd, sErrD = Fbs.MakeOne( nFace4, nGoodFace4 - 1, sCutting, dSawDiam, vtRef2, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOkd then return bOkd, sErrD end
else -- altrimenti se ho intersezione forzo il DiceCut ad essere eseguito con distanze più piccole
-- definisco la nuova dimensione massima del dice cut -- definisco la nuova dimensione massima del dice cut
local dNewDiceDim = EgtIf( abs(vtRef:getZ()) < GEO.EPS_SMALL, b3Raw:getDimZ(), b3Raw:getDimY()) local dNewDiceDim = EgtIf( abs(vtRef:getZ()) < GEO.EPS_SMALL, b3Raw:getDimZ(), b3Raw:getDimY())
bOkd, sErrD = ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Solid, ptC, vtN, Proc, vtRef, bHead, sCutting, dSawDiam, b3Raw, dNewDiceDim) bOkd, sErrD = ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Solid, ptC, vtN, Proc, vtRef, bHead, sCutting, dSawDiam, b3Raw, dNewDiceDim)
if not bOkd then return bOkd, sErrD end if not bOkd then return bOkd, sErrD end
end end
-- taglio sulla faccia interna
if vFaceOrd[1] ~= 0 then
-- inserisco la lavorazione
local vtOrthoO = Vector3d( vtRef)
bOkd, sErrD = Fbs.MakeOne( Proc.Id, vFaceOrd[1] - 1, sCutting, dSawDiam, vtOrthoO, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOkd then return bOkd, sErrD end
end
else else
-- taglio sulla faccia interna -- taglio sulla faccia interna
if vFaceOrd[1] ~= 0 then if vFaceOrd[1] ~= 0 then
@@ -528,20 +444,10 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa
else else
dDiamMax = EgtIf( abs( frMor:getVersX():getY()) < abs( frMor:getVersY():getY()), dL, dW) dDiamMax = EgtIf( abs( frMor:getVersX():getY()) < abs( frMor:getVersY():getY()), dL, dW)
end end
-- determino la distanza tra le due facce inclinate per determinare elevazione -- determino la distanza tra le due facce inclinate
local dDistFaces local dDistFaces
if vFaceOrd[4] ~= 0 then if vFaceOrd[4] ~= 0 then
local nElevationFace1 = 0 dDistFaces = abs((ptC[vFaceOrd[2]]-ptC[vFaceOrd[4]])*vtN[vFaceOrd[2]])
-- controllo estensione faccia 1
if vFaceOrd[1] ~= 0 then
frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( Proc.Id, vFaceOrd[1]-1, GDB_ID.ROOT)
if abs(vtRef:getY()) > 0.866 then
nElevationFace1 = EgtIf( abs( frMor:getVersX():getZ()) < abs( frMor:getVersY():getY()), dL, dW)
else
nElevationFace1 = EgtIf( abs( frMor:getVersX():getY()) < abs( frMor:getVersY():getY()), dL, dW)
end
end
dDistFaces = max( abs((ptC[vFaceOrd[2]]-ptC[vFaceOrd[4]])*vtN[vFaceOrd[2]]), nElevationFace1)
end end
-- recupero la lavorazione. considerando l dimensione del lato e l'affondamento -- recupero la lavorazione. considerando l dimensione del lato e l'affondamento
local sPocketing local sPocketing
@@ -578,9 +484,7 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa
EgtSetMachiningGeometry( {{ Proc.Id, vFaceOrd[2]-1}}) EgtSetMachiningGeometry( {{ Proc.Id, vFaceOrd[2]-1}})
-- imposto elevazione -- imposto elevazione
if dDistFaces then if dDistFaces then
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dDistFaces, 1) .. ';')
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dDistFaces, 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
end end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
@@ -593,7 +497,7 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa
-- aggiornamento ingombro di testa o coda -- aggiornamento ingombro di testa o coda
if Proc.Head then if Proc.Head then
local dHCI = 0 local dHCI = 0
if abs( vtRef:getZ()) > 0.1 and not BD.ROT90 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 dHCI = 0.75 * dHCI
@@ -603,7 +507,7 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa
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 and not BD.ROT90 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 dTCI = 0.75 * dTCI
+107 -122
View File
@@ -2,9 +2,6 @@
-- 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/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. -- 2022/08/09 Ora se la feature ha meno di due facce viene richiamata la normale Cut.
-- 2022/11/09 Aggiunta gestione parametro Q04 per forzare utilizzo fresa di lato e lavorare come FreeContour.
-- 2023/02/14 Gestite le rotazioni di 90 deg nell'aggiornamento del grezzo.
-- 2024/08/05 Se assimilabile ad un taglio (1 faccia) si considerare area non pinzabile testa/coda
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessSimpleScarf = {} local ProcessSimpleScarf = {}
@@ -15,7 +12,6 @@ local BL = require( 'BeamLib')
local Fbs = require( 'FacesBySaw') local Fbs = require( 'FacesBySaw')
local DC = require( 'DiceCut') local DC = require( 'DiceCut')
local Cut = require( 'ProcessCut') local Cut = require( 'ProcessCut')
local FreeContour = require( 'ProcessFreeContour')
EgtOutLog( ' ProcessSimpleScarf started', 1) EgtOutLog( ' ProcessSimpleScarf started', 1)
@@ -32,13 +28,11 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Classificazione della feature -- Classificazione della feature
function ProcessSimpleScarf.Classify( Proc) function ProcessSimpleScarf.Classify( Proc)
-- se forzato utilizzo fresa non ruoto la trave
local bForceSideMill = ( EgtGetInfo( Proc.Id, 'Q04', 'd') or 0) > 0
-- 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
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i-1, GDB_ID.ROOT) local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i-1, GDB_ID.ROOT)
if vtN:getZ() < - 0.5 and Proc.Box:getDimX() / abs( vtN:getZ()) > BD.MAX_DIM_DICE and not bForceSideMill then if vtN:getZ() < - 0.5 and Proc.Box:getDimX() / abs( vtN:getZ()) > BD.MAX_DIM_DICE then
return true, true return true, true
end end
end end
@@ -102,7 +96,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch1Id, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
end end
-- Inserisco la lavorazione del lato opposto -- Inserisco la lavorazione del lato opposto
@@ -125,7 +119,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
end end
return true return true
@@ -149,7 +143,7 @@ function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmT
-- se ci sono meno di due facce si riduce a una normale Cut -- se ci sono meno di due facce si riduce a una normale Cut
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, true) local bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, nil, nil, nil, nil, dOvmTail)
return bOk, sErr return bOk, sErr
end end
-- dati delle facce -- dati delle facce
@@ -194,132 +188,123 @@ function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmT
-- inserimento smussi -- inserimento smussi
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
-- se forzato utilizzo fresa richiamo la freecontour -- recupero la lavorazione
local bForceSideMill = EgtGetInfo( Proc.Id, 'Q04', 'd') == 1 or local sCutting = ML.FindCutting( 'HeadSide')
( EgtGetInfo( Proc.Id, 'Q04', 'd') == 2 and abs( vtN[vFaceOrd[3]]:getY()) < 0.1) or if not sCutting then
( EgtGetInfo( Proc.Id, 'Q04', 'd') == 3 and abs( vtN[vFaceOrd[3]]:getY()) < 0.1 and vtN[vFaceOrd[3]]:getZ() < 0.1) local sErr = 'Error : cutting not found in library'
if bForceSideMill then EgtOutLog( sErr)
bOk, sErr = FreeContour.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) return false, sErr
if not bOk then return bOk, sErr end end
else -- recupero i dati dell'utensile
-- recupero la lavorazione local dSawDiam = 400
local sCutting = ML.FindCutting( 'HeadSide') if EgtMdbSetCurrMachining( sCutting) then
if not sCutting then local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
local sErr = 'Error : cutting not found in library' if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
EgtOutLog( sErr) dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
return false, sErr
end end
-- recupero i dati dell'utensile end
local dSawDiam = 400 -- taglio sulla faccia esterna
if EgtMdbSetCurrMachining( sCutting) then if vFaceOrd[1] ~= 0 then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) -- in generale va fatto
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then local bCut = true
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam -- se di testa e coincide con inizio grezzo, non va fatto
if bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMax():getX() + dOvmHead) < 10 * GEO.EPS_SMALL then
bCut = false
end
-- 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
bCut = false
end
-- se va fatto, inserisco la lavorazione
if bCut then
local vtOrthoO = Vector3d( vtRef)
local bOk, sNameOrErr = Fbs.MakeOne( Proc.Id, vFaceOrd[1] - 1, sCutting, dSawDiam, vtOrthoO, nil, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then return bOk, sNameOrErr 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
local vCuts = {}
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]])
elseif vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
end
if #vCuts > 0 then
-- sistemo posizione nel DB e nome
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end end
end end
-- taglio sulla faccia esterna -- calcolo secondo riferimento per testa o coda
if vFaceOrd[1] ~= 0 then local vtRef2 = EgtIf( bHead, X_AX(), -X_AX())
-- in generale va fatto -- eseguo
local bCut = true for i = 1, #vCuts do
-- se di testa e coincide con inizio grezzo, non va fatto local vtOrthoO
if bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMax():getX() + dOvmHead) < 10 * GEO.EPS_SMALL then if i % 2 == 1 then
bCut = false vtOrthoO = Vector3d( vtRef)
end else
-- se di coda e coincide con taglio di separazione, non va fatto if #vCuts[i-1] > 0 then
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 vtOrthoO = Vector3d( EgtIf( vtRef2, vtRef2, vtRef))
bCut = false
end
-- se va fatto, inserisco la lavorazione
if bCut then
local vtOrthoO = Vector3d( vtRef)
local bOk, sNameOrErr = Fbs.MakeOne( Proc.Id, vFaceOrd[1] - 1, sCutting, dSawDiam, vtOrthoO, nil, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then return bOk, sNameOrErr 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
local vCuts = {}
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]])
elseif vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
end
if #vCuts > 0 then
-- sistemo posizione nel DB e nome
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end
end
-- calcolo secondo riferimento per testa o coda
local vtRef2 = EgtIf( bHead, X_AX(), -X_AX())
-- eseguo
for i = 1, #vCuts do
local vtOrthoO
if i % 2 == 1 then
vtOrthoO = Vector3d( vtRef)
else else
if #vCuts[i-1] > 0 then local vtO
vtOrthoO = Vector3d( EgtIf( vtRef2, vtRef2, vtRef)) for j = 1, #vCuts[i-1] do
_, vtO = EgtSurfTmFacetCenter( vCuts[i-1][j], 0, GDB_ID.ROOT)
break
end
if vtO then
vtOrthoO = Vector3d( vtO)
else else
local vtO vtOrthoO = Y_AX()
for j = 1, #vCuts[i-1] do
_, vtO = EgtSurfTmFacetCenter( vCuts[i-1][j], 0, GDB_ID.ROOT)
break
end
if vtO then
vtOrthoO = Vector3d( vtO)
else
vtOrthoO = Y_AX()
end
end
end
-- lavoro la faccia
for j = 1, #vCuts[i] do
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then
return bOk, sErr
end end
end end
end end
else -- lavoro la faccia
-- taglio sulla faccia interna for j = 1, #vCuts[i] do
local bIntCut = false local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if vFaceOrd[2] ~= 0 then if not bOk then
-- inserisco la lavorazione return bOk, sErr
local nOrthoOpposite = BL.GetNearestOrthoOpposite( vtRef)
local bOk, sNameOrErr = Fbs.MakeOne( Proc.Id, vFaceOrd[2] - 1, sCutting, dSawDiam, nOrthoOpposite, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then return bOk, sNameOrErr end
if #sNameOrErr > 0 then bIntCut = true end
end
-- taglio sulla faccia intermedia
if vFaceOrd[3] ~= 0 then
-- calcolo secondo testa o coda
local vtRef2 = EgtIf( bHead, X_AX(), -X_AX())
-- se non ho il taglio sulla faccia interna
if not bIntCut then
local frHV, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, vFaceOrd[3] - 1)
if DimV > DimH then
vtRef2 = Vector3d( frHV:getVersX())
end
end end
-- inserisco la lavorazione
local bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[3] - 1, sCutting, dSawDiam, vtRef2, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then return bOk, sErr end
end end
end end
else
-- taglio sulla faccia interna
local bIntCut = false
if vFaceOrd[2] ~= 0 then
-- inserisco la lavorazione
local nOrthoOpposite = BL.GetNearestOrthoOpposite( vtRef)
local bOk, sNameOrErr = Fbs.MakeOne( Proc.Id, vFaceOrd[2] - 1, sCutting, dSawDiam, nOrthoOpposite, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then return bOk, sNameOrErr end
if #sNameOrErr > 0 then bIntCut = true end
end
-- taglio sulla faccia intermedia
if vFaceOrd[3] ~= 0 then
-- calcolo secondo testa o coda
local vtRef2 = EgtIf( bHead, X_AX(), -X_AX())
-- se non ho il taglio sulla faccia interna
if not bIntCut then
local frHV, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, vFaceOrd[3] - 1)
if DimV > DimH then
vtRef2 = Vector3d( frHV:getVersX())
end
end
-- inserisco la lavorazione
local bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[3] - 1, sCutting, dSawDiam, vtRef2, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then return bOk, sErr end
end
end end
-- aggiornamento ingombro di testa o coda -- aggiornamento ingombro di testa o coda
if Proc.Head then if Proc.Head then
local dHCI = 0 local dHCI = 0
if abs( vtRef:getZ()) > 0.1 and not BD.ROT90 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
else else
@@ -328,7 +313,7 @@ function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmT
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 and not BD.ROT90 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
else else
+156 -631
View File
@@ -1,25 +1,8 @@
-- ProcessSplit.lua by Egaltech s.r.l. 2023/05/09 -- ProcessSplit.lua by Egaltech s.r.l. 2022/08/18
-- 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/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/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. -- 2022/08/18 Aggiunta gestione macchine con testa da sotto con lama da sotto disabilitata.
-- 2022/09/08 Migliorato verso di lavorazione in caso di DoubleCut
-- 2022/11/02 Corretti accorciamenti per DoubleCut
-- 2022/11/10 Corrette finiture lama per BigSection con trave alta
-- 2022/11/16 Correzioni per travi larghe
-- 2022/11/30 Correzione per tagli su grandi sezioni (dopo taglio con sega a catena senza finitura aggiungeva uno split con lama).
-- 2023/04/04 Modifiche per travi con sezioni molto grandi e materiale inferiore allo spessore lama.
-- 2023/04/20 Per travi alte aggiunti tagli orizzontali per ridurre le dimensioni degli scarti.
-- 2023/05/09 Aggiunta richiesta risalita preliminare a Zmax per tagli da sopra su macchine PF e ONE.
-- 2023/06/13 Corrette note Precut e Cut per tagli aggiuntivi orizzontali.
-- 2023/08/02 Corretto calcolo allungamenti/accorciamenti pezzi alti per contemplare anche taglio singolo.
-- 2023/10/17 Corretto calcolo allungamenti/accorciamenti per evitare lunghezze del percorso negative.
-- 2024/01/18 Gestita lama con aggregato con asse bloccato per massimizzare capacità di taglio verticale, se da sotto
-- Implementato split per pezzi molto alti con mix sega a catena + lama
-- Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile.
-- 2024/01/22 Nei tagli verticali aggiuntivi si usa ora BD.MAX_LEN_DICE come dimensione (era BD.MAX_DIM_DICE).
-- 2024/01/23 Nello split con sega a catena ora si cerca di preferenza una lavorazione di tipo 'SawingForSplitting'. Se non trovata si cerca il tipo 'Sawing' come in precedenza.
-- In split con sega a catena aggiunta estensione start/end del percorso se utensile lungo, per evitare collisioni con il pezzo durante rotazione.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessSplit = {} local ProcessSplit = {}
@@ -30,7 +13,6 @@ local BL = require( 'BeamLib')
local Fbs = require( 'FacesBySaw') local Fbs = require( 'FacesBySaw')
local Cut = require( 'ProcessCut') local Cut = require( 'ProcessCut')
local Pocket = require( 'FaceByPocket') local Pocket = require( 'FaceByPocket')
local Topology = require( 'FeatureTopology')
EgtOutLog( ' ProcessSplit started', 1) EgtOutLog( ' ProcessSplit started', 1)
@@ -38,10 +20,6 @@ EgtOutLog( ' ProcessSplit started', 1)
local BD = require( 'BeamData') local BD = require( 'BeamData')
local ML = require( 'MachiningLib') local ML = require( 'MachiningLib')
if BD.PRECUT_TAIL == nil then
BD.PRECUT_TAIL = true
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Riconoscimento della feature -- Riconoscimento della feature
function ProcessSplit.Identify( Proc) function ProcessSplit.Identify( Proc)
@@ -67,7 +45,7 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- lavorazione smussi -- lavorazione smussi
local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmTail) local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
-- verifico che lo smusso sia richiesto -- verifico che lo smusso sia richiesto
local dDepth = EgtGetInfo( nOriId, 'Q06', 'd') or 0 local dDepth = EgtGetInfo( nOriId, 'Q06', 'd') or 0
if dDepth < 0.1 then return true end if dDepth < 0.1 then return true end
@@ -138,7 +116,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmTail)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch1Id, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
end end
-- Inserisco la lavorazione del lato opposto -- Inserisco la lavorazione del lato opposto
@@ -161,118 +139,17 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmTail)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch1Id, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
end end
return true, nil return true, nil
end end
---------------------------------------------------------------------
-- smussi in coda
local function MakeTailChamfer( idProc, nPartId, dDepthTailChamfer)
-- recupero gruppo per geometria aggiuntiva
local AddGrpId = BL.GetAddGroup( nPartId)
if not AddGrpId then
local sErr = 'Error on process StartFace impossible to find AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- recupero la lavorazione
local sMilling = ML.FindMilling( 'Mark')
if not sMilling then
local sErr = 'Error : milling not found in library'
EgtOutLog( sErr)
return false, sErr
end
local nLoopId, nLoopCnt = EgtExtractSurfTmFacetLoops( idProc, 0, AddGrpId)
if not nLoopId or nLoopCnt > 1 then
local sErr = 'Error MakeHeadChamfer : too many loops'
EgtOutLog( sErr)
return false, sErr
end
-- setto direzione estrusione corretta
EgtModifyCurveExtrusion( nLoopId, -X_AX())
EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.LEFT))
local dQ09Value = EgtGetInfo( idProc, 'Q09', 'd')
if not dQ09Value then
dQ09Value = 0.1
end
local bChamferedEdge = dQ09Value > 0
dQ09Value = EgtIf( bChamferedEdge, max( dQ09Value, 0.1), min( dQ09Value, -0.1))
local nIdFirstEntity, nEntityCnt = EgtExplodeCurveCompo( nLoopId)
local p3MidPoint = EgtMP( nIdFirstEntity, GDB_ID.GRID)
for i = 0, nEntityCnt - 1 do
if EgtCurveLength( nIdFirstEntity + i) - 10 < abs( dQ09Value) * 2 then
local sErr = 'Error MakeTailChamfer : Q09 too high'
EgtOutLog( sErr)
return false, sErr
end
end
-- creo raccordo o fillet
for i = 0, nEntityCnt - 1 do
local idFirst = nIdFirstEntity + i
local idSecond = EgtIf( i == nEntityCnt - 1, nIdFirstEntity, idFirst + 1)
local ptEndPointFirst = EgtEP( idFirst, GDB_ID.GRID) - ( abs( dQ09Value) * EgtEV( idFirst, GDB_ID.GRID))
local ptStartPointSecond = EgtSP( idSecond, GDB_ID.GRID) + ( abs( dQ09Value) * EgtEV( idSecond, GDB_ID.GRID))
if bChamferedEdge then
EgtCurveChamfer( AddGrpId, idFirst, ptEndPointFirst, idSecond, ptStartPointSecond, abs( dQ09Value), true, GDB_RT.GRID)
else
EgtCurveFillet( AddGrpId, idFirst, ptEndPointFirst, idSecond, ptStartPointSecond, abs( dQ09Value), true, GDB_RT.GRID)
end
end
EgtSelectPathObjs( nIdFirstEntity, true)
local idGeom, idGeomCnt = EgtCurveCompoByChain( AddGrpId, GDB_ID.SEL, {0,0,0}, true)
if not idGeom or idGeomCnt > 1 then
local sErr = 'Error MakeTailChamfer : too many loops'
EgtOutLog( sErr)
return false, sErr
end
EgtChangeClosedCurveStartPoint( idGeom, p3MidPoint, GDB_RT.GRID)
-- reimposto la griglia
EgtSetGridFrame()
-- Inserisco la lavorazione del lato standard
local dExtra = 2
local sName1 = 'TailCham_' .. ( EgtGetName( idProc) or tostring( idProc))
local nMch1Id = EgtAddMachining( sName1, sMilling)
if not nMch1Id then
local sErr = 'Error adding machining ' .. sName1 .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ idGeom, -1}})
-- assegno affondamento e offset radiale
EgtSetMachiningParam( MCH_MP.DEPTH, dDepthTailChamfer + dExtra)
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch1Id, false)
return false, sErr
end
return true, nil
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- lavorazione con sega a catena per sezioni alte e larghe -- lavorazione con sega a catena per sezioni alte e larghe
local function MakeCutByChainSaw( nSurfId, sSawing, nFaceUse, dDepth, sNotes, dRadialOffset, bExtendStartEnd, bInvert) local function MakeSplitByChainSaw( nSurfId, nFaceUse, dDepth, sNotes, dOffs)
-- Recupero i dati dell'utensile -- Recupero i dati dell'utensile
local sSawing = ML.FindSawing( 'Sawing')
local dMaxMat = 0 local dMaxMat = 0
local dSawCornerRad = 0 local dSawCornerRad = 0
local dSawThick = 0 local dSawThick = 0
@@ -306,34 +183,18 @@ local function MakeCutByChainSaw( nSurfId, sSawing, nFaceUse, dDepth, sNotes, dR
-- imposto uso del lato faccia -- imposto uso del lato faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- imposto angolo 3° asse rot -- imposto angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sSawing, 'perpendicular')) EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1))
local vtN = EgtSurfTmFacetNormVersor( nSurfId, 0, GDB_ID.ROOT) local _, vtN = EgtSurfTmFacetCenter( nSurfId, 0, GDB_ID.ROOT)
local vtOrtho = BL.GetVersRef( nFaceUse) local vtOrtho = BL.GetVersRef( nFaceUse)
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1)) EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1))
-- se il taglio è un precut, sto 10mm più all'interno per essere sicuro di tagliare effettivamente qualcosa
if BD.PRECUT_TAIL and sNotes and sNotes:find( 'Precut;') then
dRadialOffset = dRadialOffset - 10
end
-- imposto offset radiale per mantenere il materiale in coda per la finitura -- imposto offset radiale per mantenere il materiale in coda per la finitura
EgtSetMachiningParam( MCH_MP.OFFSR, dRadialOffset) EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
-- imposto eventuale allungamento percorso iniziale -- imposto allungamento percorso iniziale e finale a zero
local dStartAddLen = 0 EgtSetMachiningParam( MCH_MP.STARTADDLEN, 0)
local dEndAddLen = 0 EgtSetMachiningParam( MCH_MP.ENDADDLEN, 0)
if bExtendStartEnd then
dStartAddLen = 100
dEndAddLen = 100
end
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dStartAddLen)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
-- faccio in modo che l'attacco della lama sia dal lato opposto rispetto al corpo macchina -- faccio in modo che l'attacco della lama sia dal lato opposto rispetto al corpo macchina
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
if bInvert and bInvert == true then EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
EgtSetMachiningParam( MCH_MP.INVERT, true)
else
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
EgtSetMachiningParam( MCH_MP.INVERT, false)
end
if dMaxMat >= dDepth then if dMaxMat >= dDepth then
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- se massimo affondamento utensile inferiore fessura, setto affondamento ed emetto warning -- se massimo affondamento utensile inferiore fessura, setto affondamento ed emetto warning
@@ -352,7 +213,7 @@ local function MakeCutByChainSaw( nSurfId, sSawing, nFaceUse, dDepth, sNotes, dR
return false, sErr return false, sErr
end end
-- impostazione alternativa angolo 3° asse rot -- impostazione alternativa angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sSawing, 'parallel')) EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2)) EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2))
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
@@ -369,325 +230,22 @@ local function MakeCutByChainSaw( nSurfId, sSawing, nFaceUse, dDepth, sNotes, dR
return true, sName, nMchFId return true, sName, nMchFId
end end
---------------------------------------------------------------------
-- split per sezioni grandi con sega a catena o mix catena + lama
function ProcessSplit.MakeBigSectionSplitting( Proc, b3Raw, dOffset, SawingData, Cutting2Data)
local sNotes = ''
if SawingData.bSplit ~= nil then
sNotes = 'Precut;'
end
local bigSectionSplitType
-- se pezzo non troppo alto, taglio singolo da sopra
if b3Raw:getDimZ() + BD.CUT_EXTRA_MIN < SawingData.dChainSawMaxMat + 10 * GEO.EPS_SMALL then
bigSectionSplitType = "single horizontal"
-- se pezzo non troppo largo, taglio singolo da davanti
elseif b3Raw:getDimY() + BD.CUT_EXTRA_MIN < min( SawingData.dChainSawMaxMat, SawingData.dChainSawLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then
bigSectionSplitType = "single vertical"
-- se pezzo non troppo largo, tagli dai due fianchi (dietro e davanti)
elseif 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN < min( SawingData.dChainSawMaxMat, SawingData.dChainSawLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then
bigSectionSplitType = "double vertical"
-- altrimenti taglio con sega a catena da sopra e con lama da sotto
elseif BD.DOWN_HEAD and ( b3Raw:getDimZ() + BD.CUT_EXTRA_MIN < Cutting2Data.dMaxDepth + SawingData.dChainSawMaxMat + 10 * GEO.EPS_SMALL) then
bigSectionSplitType = "double horizontal"
end
-- in base alle scelte precedenti, applico le lavorazioni
if bigSectionSplitType == "single horizontal" then
local dCutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN
local sNotesSplit = EgtIf( SawingData.bSplit, 'Split;', sNotes)
-- verifico se sega a catena lunga e devo quindi estendere ingresso e uscita perchè è probabile che non riesca a ruotare sopra al pezzo
local bExtendStartEnd
local dMinLengthLongChainSaw = 630
if SawingData.dChainSawLen > dMinLengthLongChainSaw - 10 * GEO.EPS_SMALL then
bExtendStartEnd = true
end
local bOk, sErr = MakeCutByChainSaw( Proc.Id, SawingData.sSawing, MCH_MILL_FU.PARAL_TOP, dCutDepth, sNotesSplit, dOffset, bExtendStartEnd, SawingData.bInvert)
if not bOk then return bOk, sErr end
elseif bigSectionSplitType == "single vertical" then
local dCutDepth = b3Raw:getDimY() + BD.CUT_EXTRA_MIN
local sNotesSplit = EgtIf( SawingData.bSplit, 'Split;', sNotes)
local bOk, sErr = MakeCutByChainSaw( Proc.Id, SawingData.sSawing, MCH_MILL_FU.PARAL_FRONT, dCutDepth, sNotesSplit, dOffset, nil, SawingData.bInvert)
if not bOk then return bOk, sErr end
elseif bigSectionSplitType == "double vertical" then
local dCutDepth = 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN
local sNotesSplit = EgtIf( SawingData.bSplit, 'Presplit;', sNotes)
local bOk, sErr = MakeCutByChainSaw( Proc.Id, SawingData.sSawing, MCH_MILL_FU.PARAL_BACK, dCutDepth, sNotesSplit, dOffset, nil, SawingData.bInvert)
if not bOk then return bOk, sErr end
sNotesSplit = EgtIf( SawingData.bSplit, 'Split;', sNotes)
bOk, sErr = MakeCutByChainSaw( Proc.Id, SawingData.sSawing, MCH_MILL_FU.PARAL_FRONT, dCutDepth, sNotesSplit, dOffset, nil, SawingData.bInvert)
if not bOk then return bOk, sErr end
elseif bigSectionSplitType == "double horizontal" then
-- sega a catena da sopra
local dChainSawCutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN - Cutting2Data.dMaxDepth
local sNotesSplit = EgtIf( SawingData.bSplit, 'Presplit;', sNotes)
local bOk, sErr = MakeCutByChainSaw( Proc.Id, SawingData.sSawing, MCH_MILL_FU.PARAL_TOP, dChainSawCutDepth, sNotesSplit, dOffset, nil, SawingData.bInvert)
if not bOk then return bOk, sErr end
-- lama da sotto
local dCutExtra = -dChainSawCutDepth + BD.CUT_EXTRA_MIN
local dVzLimDwnUp
if BD.TURN then dVzLimDwnUp = -2 end
local sNotes = EgtIf( SawingData.bSplit, 'Split;', sNotes)
local bMaximizeVerticalDepth = true
bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting2Data.sCutting, Cutting2Data.dSawDiam, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dOffset, 0, 0, sNotes, b3Raw, nil, bMaximizeVerticalDepth)
if not bOk then return false, sErr end
-- se è comunque troppo grande per essere separato, esco
else
local sErr = 'Error : section too big for splitting'
EgtOutLog( sErr)
return false, sErr, -1
end
return true
end
---------------------------------------------------------------------
-- tagli verticali aggiuntivi
local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw, sNotes, dOffsetBetweenCuts)
local nVerticalCuts = ceil( Proc.Face[1].WidthTrimmed / ( BD.MAX_LEN_DICE)) - 1
local dVerticalSliceHeight = Proc.Face[1].WidthTrimmed / ( nVerticalCuts + 1)
-- recupero il diametro dell'utensile
local dSawDiam = 400
if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
end
end
local bOk, sErr
-- tagli verticali
for j = nVerticalCuts, 1, -1 do
local nFaceUse = MCH_MILL_FU.PARAL_FRONT
local dVerticalCutOffset = dVerticalSliceHeight * -j
local sLeadInOutType = 'PerpendicularOutraw'
bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, sNotes, b3Raw, nil, nil, nil, sLeadInOutType, nil, dOffsetBetweenCuts)
if not bOk then return bOk, sErr end
end
return bOk, sErr
end
---------------------------------------------------------------------
-- tagli standard
local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, TailCutType, Cutting1Data, Cutting2Data, dStartOffset, dLenEndRaw)
if not TailCutType.sType then
TailCutType.sType = ''
end
local PrecutType = { bBigSectionCut = TailCutType.bBigSectionCut, bHorizCut = TailCutType.bHorizCut, bDoubleHorizCut = TailCutType.bDoubleHorizCut, bDoubleCut = TailCutType.bDoubleCut, bSplit = TailCutType.bSplit, sType = 'Precut', bNeedVerticalAddedCuts = false, bNeedHorizontalAddedCuts = false}
if not TailCutType.bDoubleHorizCut then
-- flag di lavorazione faccia
local nOrthoOpposite = EgtIf( TailCutType.bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_BACK)
-- calcolo extra taglio ed accorciamento
local dCutExtra = 0
local dAccStart = 0
local dAccEnd = 0
if TailCutType.bBigSectionCut and BD.C_SIMM and b3Raw:getDimZ() > BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL then
-- qui arrivano sezioni molto grandi su macchine tipo PF con materiale da asportare inferiore allo spessore lama
local dSawRad = Cutting1Data.dSawDiam / 2
dCutExtra = - ( b3Raw:getDimY() - dSawRad)
dAccEnd = dSawRad
elseif b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL or b3Raw:getDimY() < 2 * BD.MAX_DIM_HTCUT_HBEAM + 10 * GEO.EPS_SMALL then
dCutExtra = EgtIf( TailCutType.bDoubleCut, - 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN, BD.CUT_EXTRA)
else
dCutExtra = - ( b3Raw:getDimY() - Cutting1Data.dMaxDepth)
local dSawRad = Cutting1Data.dSawDiam / 2
-- distanza in Y tra il centro della lama e l'intersezione tra la lama stessa e la massima Z della trave, + extra
-- se taglio doppio l'intersezione sarà in mezzeria, se taglio singolo sarà all'estremo opposto della trave
local dKL = dSawRad - Cutting1Data.dMaxDepth + EgtIf( TailCutType.bDoubleCut, b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN, b3Raw:getDimY() + BD.CUT_EXTRA)
-- lunghezza minima del percorso di lavorazione, in caso accorciamento porti a lunghezza negativa
local dMinSawingLength = 5
if BD.C_SIMM then
dAccEnd = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0))
-- non posso comunque accorciare più della dimensione della geometria, quindi in caso allungo entrata
if dAccEnd > b3Raw:getDimZ() - 100 * GEO.EPS_SMALL then
dAccStart = b3Raw:getDimZ() - dAccEnd - dMinSawingLength
end
else
dAccStart = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0))
-- non posso comunque accorciare più della dimensione della geometria, quindi in caso allungo uscita
if dAccStart > b3Raw:getDimZ() - 100 * GEO.EPS_SMALL then
dAccEnd = b3Raw:getDimZ() - dAccStart - dMinSawingLength
end
end
end
-- per travi alte faccio faccio dei tagli orizzontali aggiuntivi
if TailCutType.bNeedHorizontalAddedCuts then
-- taglio a zero (con lama) per evitare problemi con grezzo più lungo del previsto. Se BigSection il pretaglio è già stato fatto.
if not TailCutType.bBigSectionCut and BD.PRECUT_TAIL then
dStartOffset = dLenEndRaw
local bOkPrecut, sErrPrecut = MakeStandardCuts( Proc, b3Raw, 1, 0, PrecutType, Cutting1Data, Cutting2Data, dStartOffset)
if not bOkPrecut then
return false, sErrPrecut
end
end
local nHorizontalCuts = ceil ( Proc.Face[1].HeightTrimmed / BD.MAX_DIM_DICE) - 1
local dHorizontalSliceHeight = Proc.Face[1].HeightTrimmed / ( nHorizontalCuts + 1)
for i = nCuts, 1, -1 do
local dCutXOffset = ( i - 1) * dOffsetBetweenCuts
-- tagli orizzontali
for j = nHorizontalCuts, 1, -1 do
local nFaceUse = MCH_MILL_FU.PARAL_DOWN
local dHorizontalCutOffset = dHorizontalSliceHeight * -j
local sLeadInOutType = 'PerpendicularOutraw'
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0 , Cutting1Data.sCutting, Cutting1Data.dSawDiam, nFaceUse, nil, -0.1 - dCutXOffset, BD.CUT_SIC, dHorizontalCutOffset, 0, 0, 'Precut;', b3Raw, nil, nil, nil, sLeadInOutType, nil, dOffsetBetweenCuts)
if not bOk then return false, sErr end
end
-- se necessario taglio verticale doppio, eseguo l'opposto
if TailCutType.bDoubleCut then
-- gli accorciamenti vanno invertiti per il taglio opposto
local dAccStartDoubleCut, dAccEndDoubleCut = dAccEnd, dAccStart
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, MCH_MILL_FU.ORTHO_FRONT, nil, dCutExtra, BD.CUT_SIC, dCutXOffset, dAccStartDoubleCut, dAccEndDoubleCut, 'Precut;', b3Raw, true)
if not bOk then return false, sErr end
end
-- taglio verticale
local sInfo = 'Precut'
if i == 1 and TailCutType.sType ~= 'Precut' then
sInfo = 'Cut'
end
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutXOffset, dAccStart, dAccEnd, sInfo, b3Raw, true)
if not bOk then return false, sErr end
end
return true, sWarn
end
-- taglio a zero (con lama) per evitare problemi con grezzo più lungo del previsto. Se BigSection il pretaglio è già stato fatto.
if not TailCutType.bBigSectionCut and BD.PRECUT_TAIL and TailCutType.bNeedVerticalAddedCuts then
dStartOffset = dLenEndRaw
local bOkPrecut, sErrPrecut = MakeStandardCuts( Proc, b3Raw, 1, 0, PrecutType, Cutting1Data, Cutting2Data, dStartOffset)
if not bOkPrecut then
return false, sErrPrecut
end
end
-- se necessari tagli in doppio, eseguo gli opposti
if TailCutType.bDoubleCut then
-- gli accorciamenti vanno invertiti per il taglio opposto
local dAccStartDoubleCut, dAccEndDoubleCut = dAccEnd, dAccStart
for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsetBetweenCuts
if i == 1 and TailCutType.sType =='Precut' then
dCutOffset = dStartOffset
end
local sNotes = EgtIf( TailCutType.bSplit, 'Presplit;', 'Precut;')
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, MCH_MILL_FU.ORTHO_FRONT, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStartDoubleCut, dAccEndDoubleCut, sNotes, b3Raw, true)
if not bOk then return false, sErr end
end
end
-- eseguo i tagli necessari
for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsetBetweenCuts
-- se trave larga effettuo tagli verticali aggiuntivi
if TailCutType.bNeedVerticalAddedCuts then
local sSpecNotes = EgtIf( TailCutType.bSplit, 'Presplit;', 'Precut;')
local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw, sSpecNotes, dOffsetBetweenCuts)
if not bOk then return bOk, sErr end
end
if i == 1 and TailCutType.sType =='Precut' then
dCutOffset = dStartOffset
end
local sNotes
if TailCutType.bSplit then
sNotes = EgtIf( i == 1, 'Split;', 'Presplit;')
else
sNotes = EgtIf( i == 1 and TailCutType.sType ~= 'Precut', 'Cut;', 'Precut;')
end
-- se primo taglio da sopra e PF o ONE richiedo risalita preliminare a Zmax
if i == nCuts and TailCutType.bHorizCut and BD.C_SIMM and not BD.DOWN_HEAD then
sNotes = EgtSetValInNotes( sNotes, 'StartZmax', 2)
end
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, true)
if not bOk then return false, sErr end
end
-- altrimenti necessari tagli da sopra e sotto con testa opportuna
else
-- verifico esistenza della lavorazione con lama da sotto
if not Cutting2Data.sCutting then
local sErr = 'Error : cutting H2 not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- verifico che le due lame riescano a lavorare la sezione
local dDimZ = b3Raw:getDimZ()
local dExtra = Cutting1Data.dMaxVertDepth + Cutting2Data.dMaxDepth - dDimZ
if ( dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0) and not TailCutType.bBigSectionCut then
local sErr = 'Error : section too big for tail cut'
EgtOutLog( sErr)
return false, sErr
end
-- calcolo extra taglio ed accorciamento
local dCutExtra = -Cutting2Data.dMaxDepth + dExtra / 2 + BD.CUT_EXTRA_MIN
local dCutExtra2 = -Cutting1Data.dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN
local dAccStart = 0
-- limiti da sotto
local dVzLimDwnUp
if BD.TURN then dVzLimDwnUp = -2 end
-- taglio a zero (con lama) per evitare problemi con grezzo più lungo del previsto. Se BigSection il pretaglio è già stato fatto.
if not TailCutType.bBigSectionCut and BD.PRECUT_TAIL and TailCutType.bNeedVerticalAddedCuts then
dStartOffset = dLenEndRaw
local bOkPrecut, sErrPrecut = MakeStandardCuts( Proc, b3Raw, 1, 0, PrecutType, Cutting1Data, Cutting2Data, dStartOffset)
if not bOkPrecut then
return false, sErrPrecut
end
end
-- eseguo i tagli da sotto necessari
for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsetBetweenCuts
if i == 1 and TailCutType.sType =='Precut' then
dCutOffset = dStartOffset
end
local sNotes = EgtIf( TailCutType.bSplit, 'Presplit;', 'Precut;')
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting2Data.sCutting, Cutting2Data.dSawDiam, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw, nil, true)
if not bOk then return false, sErr end
end
-- eseguo i tagli da sopra necessari
for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsetBetweenCuts
if i == 1 and TailCutType.sType =='Precut' then
dCutOffset = dStartOffset
end
-- se trave larga effettuo tagli verticali aggiuntivi
if TailCutType.bNeedVerticalAddedCuts then
local sSpecNotes = EgtIf( TailCutType.bSplit, 'Presplit;', 'Precut;')
local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw, sSpecNotes, dOffsetBetweenCuts)
if not bOk then return bOk, sErr end
end
local sNotes
if TailCutType.bSplit then
sNotes = EgtIf( i == 1, 'Split;', 'Presplit;')
else
sNotes = EgtIf( i == 1 and TailCutType.sType ~= 'Precut', 'Cut;', 'Precut;')
end
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, MCH_MILL_FU.ORTHO_DOWN, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw)
if not bOk then return false, sErr end
end
end
return true
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, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dOvmTail)
-- impostazione default a variabili aggiunte -- impostazione default a variabili aggiunte
if not BD.OVM_CHAIN_HBEAM then BD.OVM_CHAIN_HBEAM = 8 end if not BD.OVM_CHAIN_HBEAM then BD.OVM_CHAIN_HBEAM = 8 end
if not BD.C_SIMM_ENC then BD.C_SIMM_ENC = EgtIf( BD.C_SIMM, 180, 90) 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
local nOriId = EgtGetInfo( Proc.Id, 'ORI', 'i') local nOriId = EgtGetInfo( Proc.Id, 'ORI', 'i')
if nOriId then if nOriId then
local bOkc, sErrC = MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmTail) local bOkc, sErrC = MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
if not bOkc then return bOkc, sErrC end if not bOkc then return bOkc, sErrC end
end end
-- recupero la lavorazione -- recupero la lavorazione
-- TODO questa parte andrà cambiata quando si gestiranno i volumi liberi in cui girare da mlse local sCutting = ML.FindCutting( 'TailSide')
local dMinWidthForBigBlade = 300
local dMaxHeightForBigBlade = 300
local sCutting
if b3Raw:getDimY() > dMinWidthForBigBlade and b3Raw:getDimZ() < dMaxHeightForBigBlade then
sCutting = ML.FindCutting( 'TailSide', nil, nil, nil, 'Longest')
else
sCutting = ML.FindCutting( 'TailSide')
end
if not sCutting then if not sCutting then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -695,112 +253,104 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
end end
-- recupero i dati dell'utensile -- recupero i dati dell'utensile
local dSawDiam = 400 local dSawDiam = 400
local dSawMaxDepth = 50 local dMaxDepth = 50
local dSawThick = 2
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
dSawMaxDepth = EgtTdbGetCurrToolMaxDepth() or dSawMaxDepth dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
dSawThick = EgtTdbGetCurrToolParam(MCH_TP.THICK) or dSawThick
end end
end end
local dMaxVertDepth = dSawMaxDepth - ( BD.DECR_VERT_CUT or 0) local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
-- recupero la eventuale lavorazione con lama da sotto -- recupero la eventuale lavorazione con lama da sotto
local sCutting2 = ML.FindCutting( 'TailSide_H2', false, true) local sCutting2 = ML.FindCutting( 'TailSide_H2', false, true)
-- recupero i dati della eventuale seconda lama -- recupero i dati della eventuale seconda lama
local dSawDiam2 = 0 local dSawDiam2 = 0
local dSawMaxDepth2 = 0 local dMaxDepth2 = 0
local dSawThick2 = 0
if sCutting2 and EgtMdbSetCurrMachining( sCutting2) then if sCutting2 and EgtMdbSetCurrMachining( sCutting2) then
local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2 dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2
dSawMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dSawMaxDepth2 dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
dSawThick2 = EgtTdbGetCurrToolParam(MCH_TP.THICK) or dSawThick2
end
end
-- recupero dati utensile della sega a catena più lunga a disposizione
local sSawing = ML.FindSawing( 'SawingForSplitting', nil, nil, 'Longest')
if not sSawing then
sSawing = ML.FindSawing( 'Sawing', nil, nil, 'Longest')
end
local dChainSawMaxMat = 0
local dChainSawLen = 0
if EgtMdbSetCurrMachining( sSawing or '') then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dChainSawMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dChainSawMaxMat
dChainSawLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dChainSawLen
end end
end end
-- caratteristiche taglio -- caratteristiche taglio
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dSawMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM)) local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM))
local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and
( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dSawMaxDepth2) - 2 * BD.CUT_EXTRA + 10 * GEO.EPS_SMALL) ( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dMaxDepth2) - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bHorizCut = ( ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and ( b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA)) local bHorizCut = ( not bBigSectionCut and ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and ( b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA))
local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bBigSectionCut and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL) and local bDoubleCut = ( not bBigSectionCut and not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
( b3Raw:getDimY() < 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
-- dati geometrici del taglio -- dati geometrici del taglio
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
-- flag di lavorazione faccia
local nOrthoOpposite = EgtIf( bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_BACK)
-- separazione solo se esiste grezzo successivo con pezzi o scaricabile -- separazione solo se esiste grezzo successivo con pezzi o scaricabile
local nNextRawId = EgtGetNextRawPart( nRawId) local nNextRawId = EgtGetNextRawPart( nRawId)
local bSplit = ( nNextRawId and ( EgtGetPartInRawPartCount( nNextRawId) > 0 or EgtGetRawPartBBox( nNextRawId):getDimX() >= BD.MinRaw)) local bSplit = ( nNextRawId and ( EgtGetPartInRawPartCount( nNextRawId) > 0 or EgtGetRawPartBBox( nNextRawId):getDimX() >= BD.MinRaw))
-- determino se più tagli con offset -- determino se più tagli con offset
local dLenEndRaw = dOvmTail
local nCuts = 1 local nCuts = 1
local dOffsL = 0 local dOffsL = 0
if not bSplit then if not bSplit then
-- cerco grezzo successivo che sia nella fase -- cerco grezzo successivo che sia nella fase
if nNextRawId and EgtVerifyRawPartPhase( nNextRawId, nPhase) then if nNextRawId and EgtVerifyRawPartPhase( nNextRawId, nPhase) then
local b3NextRaw = EgtGetRawPartBBox( nNextRawId) local b3NextRaw = EgtGetRawPartBBox( nNextRawId)
dLenEndRaw = ptC:getX() - b3NextRaw:getMin():getX() local dLenEndRaw = ptC:getX() - b3NextRaw:getMin():getX()
nCuts = ceil( dLenEndRaw / ( EgtIf( bBigSectionCut, BD.MAX_DIM_DICE - 0.1, BD.MAX_LEN_SCRAP + 0.5))) nCuts = ceil( dLenEndRaw / BD.MAX_LEN_SCRAP)
dOffsL = dLenEndRaw / nCuts dOffsL = dLenEndRaw / nCuts
-- aggiorno ingombro del grezzo corrente con quello del successivo -- aggiorno ingombro del grezzo corrente con quello del successivo
b3Raw:Add( b3NextRaw) b3Raw:Add( b3NextRaw)
else
dLenEndRaw = min( dOvmTail, abs( ptC:getX() - b3Raw:getMin():getX()))
end end
end end
-- determino la necessità di tagli aggiuntivi
local dMinTailScrapForAdditionalCuts = 10.123
local bNeedVerticalAddedCuts = not bSplit and ( Proc.Face[1].WidthTrimmed > BD.MAX_LEN_DICE) and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL)
local bNeedHorizontalAddedCuts = not bSplit and not bBigSectionCut and
( Proc.Face[1].HeightTrimmed > ( BD.MIN_HEIGHT_ADDED_CUTS or BD.MAX_LEN_DICE) + 100 * GEO.EPS_SMALL) and
( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) and
dOffsL < BD.MAX_DIM_DICE
-- dati lavorazioni sopra e sotto
local Cutting1Data = { sCutting = sCutting, dSawDiam = dSawDiam, dMaxDepth = dSawMaxDepth, dSawThick = dSawThick, dMaxVertDepth = dMaxVertDepth}
local Cutting2Data = { sCutting = sCutting2, dSawDiam = dSawDiam2, dMaxDepth = dSawMaxDepth2, dSawThick = dSawThick2}
local SawingData = { sSawing = sSawing, dChainSawMaxMat = dChainSawMaxMat, dChainSawLen = dChainSawLen, bSplit = bSplit or false}
-- dati sul taglio di coda da effettuare
local TailCutType = { bBigSectionCut = bBigSectionCut, bHorizCut = bHorizCut, bDoubleHorizCut = bDoubleHorizCut, bDoubleCut = bDoubleCut, bSplit = bSplit, bNeedVerticalAddedCuts = bNeedVerticalAddedCuts, bNeedHorizontalAddedCuts = bNeedHorizontalAddedCuts}
-- se taglio per pezzi alti e larghi -- se taglio per pezzi alti e larghi
local nNewPhase = 0 local nNewPhase = 0
if bBigSectionCut then if bBigSectionCut then
local bFinishingNeeded = false local bFinishingNeeded = false
if bSplit then if bSplit then
-- assegno offset in lunghezza -- recupero lunghezza massima di lavoro della sega a catena
local dTailOffset = 0 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 if dOvmTail > BD.OVM_CHAIN_HBEAM then
dTailOffset = dOvmTail - BD.OVM_CHAIN_HBEAM dOffs = dOvmTail - BD.OVM_CHAIN_HBEAM
bFinishingNeeded = true bFinishingNeeded = true
end end
-- split per grande sezione -- se pezzo non troppo alto, taglio singolo da sopra
local bOk, sErr, nNewPhase2 = ProcessSplit.MakeBigSectionSplitting( Proc, b3Raw, dTailOffset, SawingData, Cutting2Data) if b3Raw:getDimZ() < dMaxMat - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL then
if nNewPhase2 then local cutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN
nNewPhase = nNewPhase2 sNotesSplit = 'Split;'
end bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_TOP, cutDepth, sNotesSplit, dOffs)
if not bOk then if not bOk then return bOk, sErr, nNewPhase end
return bOk, sErr, nNewPhase -- 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 end
-- se necessaria finitura, creo nuova fase -- se necessaria finitura, creo nuova fase
if bFinishingNeeded then if bFinishingNeeded then
BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET) BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET)
nNewPhase = EgtGetCurrPhase() nNewPhase = EgtGetCurrPhase()
local nDispId = EgtGetPhaseDisposition( nNewPhase) nDispId = EgtGetPhaseDisposition( nNewPhase)
if sDownOrSideOrStd == 'down' then if sDownOrSideOrStd == 'down' then
EgtRotateRawPart( nRawId, X_AX(), 180) EgtRotateRawPart( nRawId, X_AX(), 180)
EgtSetInfo( nDispId, 'TYPE', 'MID2') EgtSetInfo( nDispId, 'TYPE', 'MID2')
@@ -830,140 +380,115 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
sNotes = 'Precut;' sNotes = 'Precut;'
sNotesFinal = 'Cut;' sNotesFinal = 'Cut;'
end end
local nQ05 = EgtGetInfo( nOriId or GDB_ID.NULL, 'Q05', 'i') or 0
-- determinazione materiale da asportare
local dSawThickCheck = dSawThick
if dSawThick2 > 0 and bDoubleHorizCut then
dSawThickCheck = max( min( dSawThick, dSawThick2), dOvmTail)
end
local dMaxElev = 0
if vtN:getX() > 0 then
dMaxElev = b3Raw:getMax():getX() - Proc.Box:getMin():getX()
else
dMaxElev = Proc.Box:getMax():getX() - b3Raw:getMin():getX()
end
-- taglio a zero (con sega a catena o mix catena + lama) per evitare problemi con grezzo più lungo del previsto
if BD.PRECUT_TAIL and not bSplit then
local dTailOffset = dLenEndRaw
local bOkPrecut, sErrPrecut = ProcessSplit.MakeBigSectionSplitting( Proc, b3Raw, dTailOffset, SawingData, Cutting2Data)
if not bOkPrecut then
return false, sErrPrecut
end
end
-- se finitura con lama -- se finitura con lama
if nQ05 < 2 or ( not bSplit and dMaxElev > dSawThickCheck) then if not nOriId or EgtGetInfo( nOriId, 'Q05', 'i') == 1 or EgtGetInfo( nOriId, 'Q05', 'i') == 0 or not bSplit then
-- controllo se è necessario un taglio con dicing o si deve proseguire ai casi standard local bOk, sErr = Cut.Make( Proc, nNewPhase, nRawId, nPartId, dLenEndRaw, nil, false, true, b3Raw, sNotes, dCurrOvmT)
if bSplit or dMaxElev > dSawThickCheck then if not bOk then return bOk, sErr, nNewPhase end
local bOk, sErr
if bNeedVerticalAddedCuts then
-- ad ogni offset di taglio dovrò fare prima i tagli verticali e poi i cubetti
for i = nCuts, 1, -1 do
local nAddGrpId = BL.GetAddGroup( Proc.PartId)
-- faccia di taglio all'offset corrente
local AddId = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
local AddProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, PartId = Proc.PartId}
Topology.Classify( AddProc, b3Raw)
local dCutOffset = ( i - 1) * dOffsL
local vtMoveSurf = Vector3d( -dCutOffset, 0, 0)
EgtMove( AddId, vtMoveSurf, GDB_RT.GLOB)
-- eventuale faccia di taglio all'offset precedente, per limitare il dicing e evitare di tagliare i cubetti nel vuoto
local nLimitingSurf
if nCuts > 1 then
nLimitingSurf = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
local dLastCutOffset = i * dOffsL
local vtMoveLimitingSurf = Vector3d( -dLastCutOffset + 10 * GEO.EPS_SMALL, 0, 0)
EgtMove( nLimitingSurf, vtMoveLimitingSurf, GDB_RT.GLOB)
local vtNLimitingSurf = EgtSurfTmFacetNormVersor( nLimitingSurf, 0, GDB_ID.ROOT)
if AreOppositeVectorApprox( X_AX(), vtNLimitingSurf) then EgtInvertSurf( nLimitingSurf) end
end
-- tagli verticali
bOk, sErr = AddVerticalPreCuts( AddProc, sCutting, 0, b3Raw, sNotes, dOffsL)
if not bOk then return bOk, sErr end
-- tagli a cubetti con eventuale superficie limitante
local sLeadInOutType = 'PerpendicularOutraw'
bOk, sErr = Cut.Make( AddProc, nNewPhase, nRawId, nPartId, dMaxElev, nil, false, true, b3Raw, sNotes, dCurrOvmT, nil, nLimitingSurf, sLeadInOutType)
end
-- tagli aggiuntivi non necessari
else
local sLeadInOutType = 'PerpendicularOutraw'
bOk, sErr = Cut.Make( Proc, nNewPhase, nRawId, nPartId, dMaxElev, nil, false, true, b3Raw, sNotes, dCurrOvmT, nil, nil, sLeadInOutType)
end
if sNotesFinal then
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotesFinal)
end
return bOk, sErr, nNewPhase
end
-- se finitura con truciolatore -- se finitura con truciolatore
elseif nQ05 == 2 then elseif EgtGetInfo( nOriId, 'Q05', 'i') == 2 then
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
local sErr = 'Error : part box not found' local sErr = 'Error : part box not found'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
local sPocketing, dTDiam = ML.FindPocketing( 'OpenPocket', nil, 0) local sPocketing = ML.FindPocketing( 'OpenPocket', nil, 0)
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)
return false, sErr return false, sErr
end end
local dOpenMinSafe local bOk, sErr = Pocket.Make( Proc, Proc.Id, 0, sPocketing, nPartId, b3Solid)
if BD.C_SIMM and b3Raw:getDimZ() > 600 then if not bOk then return bOk, sErr, nNewPhase end
dOpenMinSafe = 230 - dTDiam / 2 end
end if sNotesFinal then
local bOk, sErr = Pocket.Make( Proc, Proc.Id, 0, sPocketing, nPartId, b3Solid, dOpenMinSafe) EgtSetMachiningParam( MCH_MP.USERNOTES, sNotesFinal)
if sNotesFinal then
local sNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) .. sNotesFinal
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
end
return bOk, sErr, nNewPhase
end end
else
return true, nil, nNewPhase
end end
end -- se tagli standard
elseif not bDoubleHorizCut then
local bOk, sErr = MakeStandardCuts( Proc, b3Raw, nCuts, dOffsL, TailCutType, Cutting1Data, Cutting2Data, nil, dLenEndRaw) -- calcolo extra taglio ed accorciamento
local dCutExtra = 0
-- se smussi in coda da aggiungere local dAccStart = 0
local dDepthTailChamfer = EgtGetInfo( nOriId or Proc.Id, 'Q08', 'd') or 0 local dAccEnd = 0
if dDepthTailChamfer > 100 * GEO.EPS_SMALL then if b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL or b3Raw:getDimY() < 2 * BD.MAX_DIM_HTCUT_HBEAM + 10 * GEO.EPS_SMALL then
-- creo subito nuova fase qui, a meno che non sia stata già creata dCutExtra = EgtIf( bDoubleCut, - 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN, BD.CUT_EXTRA)
if nNewPhase == 0 then else
BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET) dCutExtra = - ( b3Raw:getDimY() - dMaxDepth)
nNewPhase = EgtGetCurrPhase() local dSawRad = dSawDiam / 2
local nDispId = EgtGetPhaseDisposition( nNewPhase) local dKL = dSawRad - dMaxDepth + b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN
if sDownOrSideOrStd == 'down' then if BD.C_SIMM then
EgtRotateRawPart( nRawId, X_AX(), 180) dAccEnd = sqrt( dSawRad * dSawRad - dKL * dKL)
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 else
EgtSetInfo( nDispId, 'TYPE', 'END') dAccStart = sqrt( dSawRad * dSawRad - dKL * dKL)
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 end
-- alla fine del taglio si aggiungono gli smussi in testa -- se necessari tagli in doppio, eseguo gli opposti
local _, sErrHeadChamfer = MakeTailChamfer( nOriId or Proc.Id, nPartId, dDepthTailChamfer) if bDoubleCut then
if sErr then for i = nCuts, 1, -1 do
sErr = sErr..'\n'..sErrHeadChamfer local dCutOffset = ( i - 1) * dOffsL
else local sNotes = EgtIf( bSplit, 'Presplit;', 'Precut;')
sErr = sErrHeadChamfer local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_FRONT, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw)
if not bOk then return false, sErr end
end
end
-- eseguo i tagli necessari
for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsL
local sNotes
if bSplit then
sNotes = EgtIf( i == 1, 'Split;', 'Presplit;')
else
sNotes = EgtIf( i == 1, 'Cut;', 'Precut;')
end
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw)
if not bOk then return false, sErr end
end
-- altrimenti necessari tagli da sopra e sotto con testa opportuna
else
-- verifico esistenza della lavorazione con lama da sotto
if not sCutting2 then
local sErr = 'Error : cutting H2 not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- verifico che le due lame riescano a lavorare la sezione
local dDimZ = b3Raw:getDimZ()
local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ
if dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0 then
local sErr = 'Error : section too big for tail cut'
EgtOutLog( sErr)
return false, sErr
end
-- calcolo extra taglio ed accorciamento
local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN
local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN
local dAccStart = 0
-- limiti da sotto
local dVzLimDwnUp
if BD.TURN then dVzLimDwnUp = -2 end
-- eseguo i tagli da sotto necessari
for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsL
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)
if not bOk then return false, sErr end
end
-- eseguo i tagli da sopra necessari
for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsL
local sNotes
if bSplit then
sNotes = EgtIf( i == 1, 'Split;', 'Presplit;')
else
sNotes = EgtIf( i == 1, 'Cut;', 'Precut;')
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)
if not bOk then return false, sErr end
end end
end end
return true, nil, nNewPhase
return bOk, sErr, nNewPhase end
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
return ProcessSplit return ProcessSplit
+50 -182
View File
@@ -1,7 +1,5 @@
-- ProcessStepJoint.lua by Egaltech s.r.l. 2022/11/03 -- ProcessStepJoint.lua by Egaltech s.r.l. 2022/01/26
-- Gestione calcolo giunto a gradino per Travi -- Gestione calcolo giunto a gradino per Travi
-- 2022/11/03 Correzione per riconoscimento testa da sotto su fresatura.
-- 2023/02/14 Gestite le rotazioni di 90 deg nell'aggiornamento del grezzo.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessStepJoint = {} local ProcessStepJoint = {}
@@ -85,14 +83,13 @@ 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, bH2 local sMilling
sMilling, _, _, bH2 = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bDownHead) sMilling, _, _, bDownHead = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bDownHead)
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)
return false, sErr return false, sErr
end end
bDownHead = ( bDownHead and bH2)
-- Inserisco la lavorazione del lato standard -- Inserisco la lavorazione del lato standard
local sName1 = 'SJN_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local sName1 = 'SJN_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch1Id = EgtAddMachining( sName1, sMilling) local nMch1Id = EgtAddMachining( sName1, sMilling)
@@ -111,7 +108,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch1Id, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
end end
-- Inserisco la lavorazione del lato opposto -- Inserisco la lavorazione del lato opposto
@@ -134,118 +131,12 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
end end
return true return true
end end
---------------------------------------------------------------------
local function MakePocket( Proc, nPartId, ptPs, vtN, nFaceRef, nDiffWidth, sMchFind, nUseRoughTool, tBHx)
-- calcolo il elevazione dal punto medio
local dElev
local dLenIn, dLedOut = BL.GetPointDirDepth( nPartId, ptPs, vtN[nFaceRef])
if dLenIn > 0 then
dElev = dLenIn
elseif dLedOut then
dElev = dLedOut
end
local dCollSic = 2 * BD.COLL_SIC
local sTuuidMstr
-- calcolo il diametro utensile
local dDiamTool
if nUseRoughTool == 1 then
-- se feature passante prendo utensile più grande possibile
if ( Proc.AffectedFaces.Top and Proc.AffectedFaces.Bottom) or ( Proc.AffectedFaces.Front and Proc.AffectedFaces.Back) then
dDiamTool = nil
else
dDiamTool = max( 80, min( tBHx[nFaceRef][1], tBHx[nFaceRef][2]))
end
else
-- se non uso truciolatore prendo il valore dalle dimensioni minime delle facce
dDiamTool = min( tBHx[nFaceRef][1], tBHx[nFaceRef][2])
end
-- abilitazione lavorazione da sotto (testa da sotto e direzione normale sotto -30deg)
local bTopHead = ( BD.DOWN_HEAD and vtN[nFaceRef]:getZ() > -0.1)
local bDownHead = ( BD.DOWN_HEAD and vtN[nFaceRef]:getZ() < 0.1)
-- recupero la lavorazione
local sPocketing, _, _, bDownHead = ML.FindPocketing( sMchFind.. EgtIf( bDownHead, '_H2', ''), dDiamTool, dElev + dCollSic, nil, bTopHead, bDownHead)
if not sPocketing then
local sErr = 'Error : pocketing not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- recupero il diametro dell'utensile
if EgtMdbSetCurrMachining( sPocketing) then
sTuuidMstr = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuidMstr) or '') then
dDiamTool = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dDiamTool
end
end
-- inserisco la lavorazione di svuotatura
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. 'F' .. tostring( nFaceRef - 1)
local nMchFId = EgtAddMachining( sName, sPocketing)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, (nFaceRef-1)}})
-- imposto uso faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT)
-- imposto posizione braccio porta testa
if vtN[nFaceRef]:getY() < GEO.EPS_SMALL then
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
else
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end
-- La tasca ha sempre almeno un lato aperto, imposto opportuno attacco
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN)
-- imposto elevazione
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or ''
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dElev, 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
if not ML.ApplyMachining( true, false) then
-- provo ad allargare leggermente la tasca
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
return true, '', sTuuidMstr
end
---------------------------------------------------------------------
local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, ptC, vtN, nBigInd, nSmaInd, ptPs, tBHx, b3Raw, nDiffWidth, nUseRoughTool, dAng)
local sMchFind = 'Pocket'
-- se feature é larga come trave imposto openpocket
if nDiffWidth == 0 then
sMchFind = 'OpenPocket'
-- altrimenti se non è passante disabilito il truciolatore
else
nUseRoughTool = 0
end
-- applico la svuotatura
local bOk, sErr, sTuuidMstr = MakePocket( Proc, nPartId, ptPs, vtN, nBigInd, nDiffWidth, sMchFind, nUseRoughTool, tBHx)
if not bOk then
return bOk, sErr
end
-- se angolo tra le facce maggiore di 90, inserisco la contornatura o svuotatura del lato più corto
if dAng > -90 then
-- applico la svuotatura
local bOk, sErr = MakePocket( Proc, nPartId, ptPs, vtN, nSmaInd, nDiffWidth, sMchFind, nUseRoughTool, tBHx)
if not bOk then
return bOk, sErr
end
end
return true
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione al caso due facce -- Applicazione della lavorazione al caso due facce
local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead) local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
@@ -262,7 +153,6 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
return false, sErr return false, sErr
end end
-- dati delle facce -- dati delle facce
local tBHx = {}
local ptC = {} local ptC = {}
local vtN = {} local vtN = {}
ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
@@ -290,13 +180,11 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
-- recupero i dati dell'utensile -- recupero i dati dell'utensile
local dSawDiam = 400 local dSawDiam = 400
local dSawThick = 2
local dMaxDepth = 0 local dMaxDepth = 0
if EgtMdbSetCurrMachining( sCutting) then if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end end
end end
@@ -321,8 +209,7 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetInfo( AddId, 'TASKID', Proc.TaskId) EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- applico lavorazione -- applico lavorazione
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId} Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead) 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
@@ -333,8 +220,7 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetInfo( AddId, 'TASKID', Proc.TaskId) EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- applico lavorazione -- applico lavorazione
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId} Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead) 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
@@ -348,58 +234,47 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
vtRef[2] = vtN[2] ^ vtTg vtRef[2] = vtN[2] ^ vtTg
if vtRef[2] * vtN[1] < 0 then vtRef[2] = - vtRef[2] end if vtRef[2] * vtN[1] < 0 then vtRef[2] = - vtRef[2] end
-- determino quale faccia è più grande -- determino quale faccia è più grande
local rfFac1, dB1, dH1 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0) local _, dB1, dH1 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0)
local rfFac2, dB2, dH2 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 1) local _, dB2, dH2 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 1)
local nBigInd = EgtIf( dB1 * dH1 >= dB2 * dH2, 1, 2) local nBigInd = EgtIf( dB1 * dH1 >= dB2 * dH2, 1, 2)
local nSmaInd = 3 - nBigInd local nSmaInd = 3 - nBigInd
tBHx[1] = {dH1, dV1, rfFac1} -- calcolo extra taglio
tBHx[2] = {dH2, dV2, rfFac2} local dCutExtra = dExtraUp
local nUseRoughTool = EgtGetInfo( Proc.Id, 'Q02', 'i') if dAng < -90.5 and dAng > -179.5 then
if nUseRoughTool == 1 and dAng < -0.1 and dAng > -90 then dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp
local bOk, sErr = MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, ptC, vtN, nBigInd, nSmaInd, ptPs, tBHx, b3Raw, 0, nUseRoughTool, dAng) end
-- verifico se necessari tagli supplementari
local vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
--DC.PrintOrderCut( vCuts)
if #vCuts > 0 then
-- sistemo posizione nel DB e nome
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end
end
-- eseguo
for i = 1, #vCuts do
-- assegno il modo di tagliare
local vtOrthO = EgtIf( ( i % 2) == 1, vtRef[nSmaInd], vtRef[nBigInd])
-- lavoro la faccia
for j = 1, #vCuts[i] do
local dLocCutExtra = EgtIf( j == #vCuts[i], dCutExtra - dExtraUp, dCutExtra)
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthO, nil, dLocCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then
return bOk, sErr
end
end
end
-- altrimenti, tagli diretti delle facce
else
local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, EgtIf( bHead, 'HeadSide', 'TailSide'))
if not bOk then if not bOk then
return bOk, sErr return bOk, sErr
end end
else
-- calcolo extra taglio
local dCutExtra = dExtraUp
if dAng < -90.5 and dAng > -179.5 then
dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp
end
-- verifico se necessari tagli supplementari
local vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
--DC.PrintOrderCut( vCuts)
if #vCuts > 0 then
-- sistemo posizione nel DB e nome
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end
end
-- eseguo
for i = 1, #vCuts do
-- assegno il modo di tagliare
local vtOrthO = EgtIf( ( i % 2) == 1, vtRef[nSmaInd], vtRef[nBigInd])
-- lavoro la faccia
for j = 1, #vCuts[i] do
local dLocCutExtra = EgtIf( j == #vCuts[i], dCutExtra - dExtraUp, dCutExtra)
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthO, nil, dLocCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then
return bOk, sErr
end
end
end
-- altrimenti, tagli diretti delle facce
else
local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, EgtIf( bHead, 'HeadSide', 'TailSide'))
if not bOk then
return bOk, sErr
end
end
end end
end end
-- eventuale segnalazione ingombro di testa o coda -- eventuale segnalazione ingombro di testa o coda
if Proc.Head then if Proc.Head then
local dOffs = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX() local dOffs = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()
@@ -442,12 +317,10 @@ local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
if bAdj12 then if bAdj12 then
if dAng12 < 0 then if dAng12 < 0 then
EgtSurfTmSwapFacets( Proc.Id, 0, 2) EgtSurfTmSwapFacets( Proc.Id, 0, 2)
Proc.Face = BL.GetFacetsInfo( Proc, b3Raw)
end end
elseif bAdj20 then elseif bAdj20 then
if dAng20 < 0 then if dAng20 < 0 then
EgtSurfTmSwapFacets( Proc.Id, 1, 2) EgtSurfTmSwapFacets( Proc.Id, 1, 2)
Proc.Face = BL.GetFacetsInfo( Proc, b3Raw)
end end
end end
-- dati delle facce -- dati delle facce
@@ -514,8 +387,7 @@ local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetInfo( AddId, 'TASKID', Proc.TaskId) EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- applico lavorazione -- applico lavorazione
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId} Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead) 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
@@ -559,22 +431,18 @@ local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- Eventuale segnalazione ingombro di testa o coda -- Eventuale segnalazione ingombro di testa o coda
if Proc.Head then if Proc.Head then
local dOffs = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX() local dOffs = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()
if not BD.ROT90 then if vtNm:getZ() > 0.5 then
if vtNm:getZ() > 0.5 then dOffs = 0.5 * dOffs
dOffs = 0.5 * dOffs elseif abs( vtNm:getZ()) > 0.35 then
elseif abs( vtNm:getZ()) > 0.35 then dOffs = 0.75 * dOffs
dOffs = 0.75 * dOffs
end
end end
BL.UpdateHCING( nRawId, dOffs) BL.UpdateHCING( nRawId, dOffs)
elseif Proc.Tail then elseif Proc.Tail then
local dOffs = Proc.Box:getMax():getX() - b3Solid:getMin():getX() local dOffs = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
if not BD.ROT90 then if vtNm:getZ() > 0.5 then
if vtNm:getZ() > 0.5 then dOffs = 0.5 * dOffs
dOffs = 0.5 * dOffs elseif abs( vtNm:getZ()) > 0.35 then
elseif abs( vtNm:getZ()) > 0.35 then dOffs = 0.75 * dOffs
dOffs = 0.75 * dOffs
end
end end
BL.UpdateTCING( nRawId, dOffs) BL.UpdateTCING( nRawId, dOffs)
end end
+55 -59
View File
@@ -1,7 +1,5 @@
-- ProcessStepJointNotch.lua by Egaltech s.r.l. 2022/11/03 -- ProcessStepJointNotch.lua by Egaltech s.r.l. 2022/01/25
-- Gestione calcolo tacca a gradino per Travi -- Gestione calcolo tacca a gradino per Travi
-- 2022/11/03 Correzione per riconoscimento testa da sotto su fresatura.
-- 2024/06/28 In MakeFourFaces aggiunta copia del parametro PartId sulla nuova Proc
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessStepJointNotch = {} local ProcessStepJointNotch = {}
@@ -12,8 +10,6 @@ local BL = require( 'BeamLib')
local Fbs = require( 'FacesBySaw') local Fbs = require( 'FacesBySaw')
local DC = require( 'DiceCut') local DC = require( 'DiceCut')
local Cut = require( 'ProcessCut') local Cut = require( 'ProcessCut')
local Topology = require( 'FeatureTopology')
local LapJoint = require( 'ProcessLapJoint')
EgtOutLog( ' ProcessStepJointNotch started', 1) EgtOutLog( ' ProcessStepJointNotch started', 1)
@@ -27,30 +23,13 @@ function ProcessStepJointNotch.Identify( Proc)
return ( ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 80) return ( ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 80)
end end
---------------------------------------------------------------------
-- Verifica se feature di testa
function ProcessStepJointNotch.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
return false
end
---------------------------------------------------------------------
-- Verifica se feature di coda
function ProcessStepJointNotch.IsTailFeature( Proc, b3Raw)
-- recupero box del pezzo
local nPartId = EgtGetParent( EgtGetParent( Proc.Id) or GDB_ID.NULL)
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
-- verifico se è in coda
local dEndDist = Proc.Box:getMin():getX() - b3Solid:getMin():getX()
return ( dEndDist < BD.MAX_DIST_HTFEA)
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Classificazione della feature -- Classificazione della feature
function ProcessStepJointNotch.Classify( Proc) function ProcessStepJointNotch.Classify( Proc)
-- numero delle facce -- numero delle facce
local nFacetCnt = EgtSurfTmFacetCount( Proc.Id) local nFacetCnt = EgtSurfTmFacetCount( Proc.Id)
-- gestisco solo 2 o 4 facce -- gestisco solo 2 o 4 facce
if nFacetCnt ~= 2 and nFacetCnt ~= 3 and nFacetCnt ~= 4 and nFacetCnt ~= 6 and nFacetCnt ~= 8 then if nFacetCnt ~= 2 and nFacetCnt ~= 4 and nFacetCnt ~= 6 and nFacetCnt ~= 8 then
return false, false return false, false
end end
-- verifico le normali delle facce -- verifico le normali delle facce
@@ -109,10 +88,47 @@ local function MachineByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Solid,
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- tagli delle facce -- verifico se necessari tagli supplementari
local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHead, '_H2', ''), nil, bDownHead) local vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
if not bOk then --DC.PrintOrderCut( vCuts)
return bOk, sErr if #vCuts > 0 then
-- sistemo posizione nel DB e nome
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end
end
-- eseguo
for i = 1, #vCuts do
-- determino il modo di tagliare
local k, l = nBigInd, nSmaInd
if ( i % 2) == 1 then
k, l = l, k
end
local nOrthoOpposite
if bOnY then
local bFront = ( ptC[k]:getY() < ptPs:getY())
nOrthoOpposite = EgtIf( bFront, MCH_MILL_FU.ORTHO_BACK, MCH_MILL_FU.ORTHO_FRONT)
else
local bOver = ( vtN[nBigInd]:getZ() > -0.1)
nOrthoOpposite = EgtIf( bOver, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_TOP)
end
-- lavoro la faccia
for j = 1, #vCuts[i] do
local dLocCutExtra = EgtIf( j == #vCuts[i], dCutExtra - dExtraUp, dCutExtra)
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, nOrthoOpposite, EgtIf( bDownHead, -2, nil), dLocCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then
return bOk, sErr
end
end
end
-- altrimenti, tagli diretti delle facce
else
local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHead, '_H2', ''), nil, bDownHead)
if not bOk then
return bOk, sErr
end
end end
return true return true
end end
@@ -133,12 +149,7 @@ local function MakePocket( Proc, nPartId, ptPs, vtN, nFaceRef, nDiffWidth, sMchF
-- calcolo il diametro utensile -- calcolo il diametro utensile
local dDiamTool local dDiamTool
if nUseRoughTool == 1 then if nUseRoughTool == 1 then
-- se feature passante prendo utensile più grande possibile dDiamTool = max( 80, min( tBHx[nFaceRef][1], tBHx[nFaceRef][2]))
if ( Proc.AffectedFaces.Top and Proc.AffectedFaces.Bottom) or ( Proc.AffectedFaces.Front and Proc.AffectedFaces.Back) then
dDiamTool = nil
else
dDiamTool = max( 80, min( tBHx[nFaceRef][1], tBHx[nFaceRef][2]))
end
else else
-- se non uso truciolatore prendo il valore dalle dimensioni minime delle facce -- se non uso truciolatore prendo il valore dalle dimensioni minime delle facce
dDiamTool = min( tBHx[nFaceRef][1], tBHx[nFaceRef][2]) dDiamTool = min( tBHx[nFaceRef][1], tBHx[nFaceRef][2])
@@ -181,9 +192,8 @@ local function MakePocket( Proc, nPartId, ptPs, vtN, nFaceRef, nDiffWidth, sMchF
-- La tasca ha sempre almeno un lato aperto, imposto opportuno attacco -- La tasca ha sempre almeno un lato aperto, imposto opportuno attacco
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN) EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN)
-- imposto elevazione -- imposto elevazione
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';'
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dElev, 1)) EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
-- provo ad allargare leggermente la tasca -- provo ad allargare leggermente la tasca
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1) EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
@@ -290,8 +300,8 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, ptC, vtN,
-- setto a 0 eventuali offset -- setto a 0 eventuali offset
EgtSetMachiningParam( MCH_MP.OFFSR, 0) EgtSetMachiningParam( MCH_MP.OFFSR, 0)
-- applico gli allungamenti o accorciamenti considerando che la lavorazione è invertita -- applico gli allungamenti o accorciamenti considerando che la lavorazione è invertita
EgtSetMachiningParam( MCH_MP.STARTADDLEN, EgtIf( bOpenStart, dTDiam / 2 + 10, - dTDiam / 2)) EgtSetMachiningParam( MCH_MP.STARTADDLEN, EgtIf( bOpenStart, dTDiam / 2, - dTDiam / 2))
EgtSetMachiningParam( MCH_MP.ENDADDLEN, EgtIf( bOpenEnd, dTDiam / 2 + 10, - dTDiam / 2)) EgtSetMachiningParam( MCH_MP.ENDADDLEN, EgtIf( bOpenEnd, dTDiam / 2, - dTDiam / 2))
-- attacchi e uscite lineari con parte tg nulla -- attacchi e uscite lineari con parte tg nulla
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.LINEAR) EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.LINEAR)
EgtSetMachiningParam( MCH_MP.LITANG, 0) EgtSetMachiningParam( MCH_MP.LITANG, 0)
@@ -392,9 +402,7 @@ local function MakeFourFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, nDiffWidt
EgtSurfTmSwapFacets( AddId, 1, 3) EgtSurfTmSwapFacets( AddId, 1, 3)
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
-- applico lavorazione -- applico lavorazione
local NewProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, PartId = Proc.PartId} local NewProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg}
local b3Raw = EgtGetRawPartBBox( nRawId)
Topology.Classify( NewProc, b3Raw)
local bOk, sErr = MakeTwoFaces( NewProc, nPhase, nRawId, nPartId, dOvmHead, nDiffWidth) local bOk, sErr = MakeTwoFaces( NewProc, nPhase, nRawId, nPartId, dOvmHead, nDiffWidth)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
end end
@@ -489,7 +497,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
end end
-- se diretta verso Z -- se diretta verso Z
elseif abs( vtExtr:getZ()) > 0.99 and not ( BD.DOWN_HEAD or nTypePos == 0) then elseif abs( vtExtr:getZ()) > 0.99 then
-- se diretta verso Z+ -- se diretta verso Z+
if vtExtr:getZ() > 0 then if vtExtr:getZ() > 0 then
-- se sborda verso Z+ abilito solo la lavorazione della parte normale -- se sborda verso Z+ abilito solo la lavorazione della parte normale
@@ -514,15 +522,14 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
local dExtra = 2 local dExtra = 2
-- recupero la lavorazione -- recupero la lavorazione
local sMillType = 'Mark' local sMillType = 'Mark'
local bDownHead = BD.DOWN_HEAD and vtExtr:getZ() < GEO.EPS_SMALL local bDownHead = ( BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1)
local sMilling, bH2 local sMilling
sMilling, _, _, bH2 = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bDownHead) sMilling, _, _, bDownHead = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bDownHead)
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)
return false, sErr return false, sErr
end end
bDownHead = ( bDownHead and bH2)
if bExeNormal then if bExeNormal then
-- Inserisco la lavorazione del lato standard -- Inserisco la lavorazione del lato standard
local sName1 = 'SJN_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local sName1 = 'SJN_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
@@ -542,19 +549,11 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch1Id, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
end end
end end
if bExeOpposite then if bExeOpposite then
bDownHead = BD.DOWN_HEAD and vtExtr:getZ() > - GEO.EPS_SMALL
sMilling, _, _, bH2 = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bDownHead)
if not sMilling then
local sErr = 'Error : milling not found in library'
EgtOutLog( sErr)
return false, sErr
end
bDownHead = ( bDownHead and bH2)
-- Inserisco la lavorazione del lato opposto -- Inserisco la lavorazione del lato opposto
local sName2 = 'SJN_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local sName2 = 'SJN_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtAddMachining( sName2, sMilling) local nMch2Id = EgtAddMachining( sName2, sMilling)
@@ -575,7 +574,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
end end
end end
@@ -585,9 +584,6 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessStepJointNotch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) function ProcessStepJointNotch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
if Proc.Fct == 3 then
return LapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
-- esecuzione eventuale smusso -- esecuzione eventuale smusso
-- ottengo anche il flag che indica che la feature è larga come la trave -- ottengo anche il flag che indica che la feature è larga come la trave
local bOkc, sErrC, nDiffWidth = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) local bOkc, sErrC, nDiffWidth = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
+24 -116
View File
@@ -1,16 +1,9 @@
-- ProcessTenon.lua by Egaltech s.r.l. 2023/09/26 -- ProcessTenon.lua by Egaltech s.r.l. 2022/05/28
-- 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/02/15 Aggiornata VerifyOrientation per macchine con testa da sotto.
-- 2022/05/18 Migliorata gestione attacco. -- 2022/05/18 Migliorata gestione attacco.
-- 2022/05/28 Spostato calcolo svuotatura in modulo di libreria. -- 2022/05/28 Spostato calcolo svuotatura in modulo di libreria.
-- 2022/09/20 Migliorato il calcolo delle passate laterali; ora considera la reale distanza tra contorno del tenone e estremi della faccia
-- 2022/11/03 Corretto uso di bH2 (da sotto solo se anche bMillDown vero).
-- 2022/12/12 Su macchine con rulli pressori e pinze separate si riduce di meno l'ingombro con tenoni inclinati.
-- 2022/12/20 Aggiunta gestione smusso. Migliorata scelta tra sopra e sotto per il punto di inizio. In VerifyOrientation aggiunta trave medio alta.
-- 2023/01/20 Modificata scelta lato di attacco per pezzo piccolo su macchine con pinza speciale (pinza 5).
-- 2023/03/27 Migliorate condizioni scelta pretaglio con lama o fresa; gestione unificata con ProcessDtTenon. Migliorato calcolo altezza tenone.
-- 2023/09/26 Per macchina TURN si assegna SCC per privilegiare accesso dal lato corto della trave.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessTenon = {} local ProcessTenon = {}
@@ -36,8 +29,8 @@ local function VerifyOrientation( Proc, vtN, b3Raw)
end end
-- se trave molto bassa -- se trave molto bassa
if b3Raw:getDimZ() <= 120 then if b3Raw:getDimZ() <= 120 then
-- se non testa PF e tenone praticamente in asse, accetto fino a -45 deg -- se tenone praticamente in asse, accetto fino a -45 deg
if not BD.C_SIMM and abs( vtN:getY()) < 0.04 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
@@ -61,15 +54,6 @@ local function VerifyOrientation( Proc, vtN, b3Raw)
else else
return ( vtN:getZ() >= -0.174) return ( vtN:getZ() >= -0.174)
end end
-- se trave medio alta
elseif b3Raw:getDimZ() <= 400 then
-- se tenone praticamente in asse, accetto fino a -15 deg
if abs( vtN:getY()) < 0.04 then
return ( vtN:getZ() >= -0.259)
-- altrimenti, accetto fino a -5 deg
else
return ( vtN:getZ() >= -0.088)
end
-- altrimenti -- altrimenti
else else
-- accetto fino a -5deg -- accetto fino a -5deg
@@ -130,38 +114,17 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
-- determino altezza del tenone -- determino altezza del tenone
local frTen = Frame3d( ptBC, vtExtr) local frTen = Frame3d( ptBC, vtExtr)
local b3Ten = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frTen) local b3Ten = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frTen)
local dTenH = b3Ten:getMax():getZ() local dTenH = b3Ten:getDimZ()
-- assegno centro e normale della faccia top -- assegno centro e normale della faccia top
local vtN = vtExtr local vtN = vtExtr
local ptC = ptBC + vtN * dTenH local ptC = ptBC + vtN * dTenH
EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3) EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3)
-- determino larghezza svuotatura per calcolare il numero di passate laterali -- determino larghezza massima di svuotatura
-- ricavo i contorni della faccia principale local b3Aux = EgtGetBBoxRef( AuxId, GDB_BB.STANDARD, frTen)
local nLoopId, nLoopCnt = EgtExtractSurfTmFacetLoops( Proc.Id, 0, EgtGetParent( Proc.Id)) local dPockX = max( b3Ten:getMax():getX() - b3Aux:getMax():getX(), b3Aux:getMin():getX() - b3Ten:getMin():getX())
local dPockL = 0 local dPockY = max( b3Ten:getMax():getY() - b3Aux:getMax():getY(), b3Aux:getMin():getY() - b3Ten:getMin():getY())
-- ricavo la massima distanza tra gli estremi della faccia e la curva del tenone local dPockL = sqrt( dPockX * dPockX + dPockY * dPockY)
if nLoopId then
local dUmin, dUmax = EgtCurveDomain( nLoopId)
for dU = dUmin, dUmax do
local ptP = EgtUP( nLoopId, dU, GDB_ID.ROOT)
local ptNear = EgtNP( AuxId, ptP, GDB_ID.ROOT)
local dDist = dist( ptP, ptNear)
if dDist > dPockL then
dPockL = dDist
end
end
-- cancello i contorni dopo averli analizzati
for i = 1, nLoopCnt do
EgtErase( nLoopId + i - 1)
end
else
-- se il metodo sopra non funziona uso il metodo semplice (distanza tra gli angoli retti della curva tenone e faccia principale)
local b3Aux = EgtGetBBoxRef( AuxId, GDB_BB.STANDARD, frTen)
local dPockX = max( b3Ten:getMax():getX() - b3Aux:getMax():getX(), b3Aux:getMin():getX() - b3Ten:getMin():getX())
local dPockY = max( b3Ten:getMax():getY() - b3Aux:getMax():getY(), b3Aux:getMin():getY() - b3Ten:getMin():getY())
dPockL = sqrt( dPockX * dPockX + dPockY * dPockY)
end
-- 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)
@@ -182,10 +145,11 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
if AddId then if AddId then
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( AddId, 'TASKID', Proc.TaskId) EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- solo per macchine tipo PF e simili: se pezzo piccolo, in coda, piano inclinato attorno a Z e inclinato verso il basso applico svuotatura -- se pezzo piccolo, in coda, con piano inclinato verso il basso e macchina con testa da sotto applico svuotatura
if b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getX() < 0 and abs( vtExtr:getY()) > 0.173 and vtExtr:getZ() < -0.1 and BD.C_SIMM then if bShortPart and vtExtr:getX() < 0 and vtExtr:getZ() < -0.09 and BD.DOWN_HEAD then
-- recupero la lavorazione -- recupero la lavorazione
local sPocketing = ML.FindPocketing( 'OpenPocket', nil, nil, nil, not bMillDown, bMillDown) local sPockType = EgtIf( bMillDown, 'OpenPocket_H2', 'OpenPocket')
local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, not bMillDown, bMillDown)
if not sPocketing then if not sPocketing then
local sErr = 'Error : pocketing '..sPockType..' not found in library' local sErr = 'Error : pocketing '..sPockType..' not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -200,8 +164,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
else else
local b3Cut = EgtGetBBoxGlob( AddId or GDB_ID.NULL, GDB_BB.STANDARD) local b3Cut = EgtGetBBoxGlob( AddId or GDB_ID.NULL, GDB_BB.STANDARD)
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Cut, Fct = 1, Flg = Proc.Flg, local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Cut, Fct = 1, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId} Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
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
@@ -210,45 +173,6 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
end end
end end
-- se vero tenone e richiesto, eseguo lo smusso
if Proc.Prc ~= 52 and EgtGetInfo( Proc.Id, 'P05', 'i') == 1 then
-- profondità smusso
local dDepth = EgtGetInfo( Proc.Id, 'Q01', 'd') or 0
if dDepth > 0.1 then
local dExtra = 2
-- recupero la lavorazione
local sMilling = ML.FindMilling( 'Mark', nil, nil, nil, nil, bMillUp, bMillDown)
if not sMilling then
local sErr = 'Error : milling (Mark) not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- Inserisco la lavorazione
local sName1 = 'TenC_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch1Id = EgtAddMachining( sName1, sMilling)
if not nMch1Id then
local sErr = 'Error adding machining ' .. sName1 .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- assegno affondamento e offset radiale
EgtSetMachiningParam( MCH_MP.DEPTH, -dTenH + dDepth + dExtra)
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or ''
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dDepth + dExtra, 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch1Id, false)
return false, sErr
end
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 sMilling, _, _, bH2 = ML.FindMilling( sMillType, dTenH, nil, nil, nil, bMillUp, bMillDown)
@@ -276,17 +200,10 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- massimo numero di passate e coefficiente di sovrapposizione ta passate -- massimo numero di passate e coefficiente di sovrapposizione ta passate
local MAX_PASS = 6 local MAX_PASS = 6
local OVERLAP_COEFF = 0.7 local OVERLAP_COEFF = 0.7
-- porto inizio curva il più possibile sul bordo in alto, in basso o di lato a seconda delle necessità -- porto inizio curva il più possibile sul bordo in alto o in basso
local dMaxDist = OVERLAP_COEFF * dMillDiam * MAX_PASS local dMaxDist = OVERLAP_COEFF * dMillDiam * MAX_PASS
local nNearSide = 3 local bMyShortPart = ( bShortPart and abs( vtN:getX()) < 0.999 and abs( vtN:getY()) < 0.259)
local bMyShortPart = ( bShortPart and vtN:getX() < 0 and abs( vtN:getX()) < 0.999 and abs( vtN:getY()) < 0.259) BL.PutStartNearestToEdge( AuxId, b3Solid, dMaxDist, bH2 ~= bMyShortPart)
if bH2 and bMillDown then
nNearSide = EgtIf( bMyShortPart and vtN:getZ() < -0.018, 3, -3)
else
nNearSide = EgtIf( bMyShortPart and vtN:getZ() > 0.018, -3, 3)
end
if bMyShortPart and BD.CLAMP5 then nNearSide = -2 end
BL.PutStartNearestToEdge( AuxId, b3Solid, dMaxDist, nNearSide)
-- 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
@@ -311,10 +228,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}}) EgtSetMachiningGeometry( {{ AuxId, -1}})
-- sistemo i parametri -- sistemo i parametri
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dTenH - 100 * GEO.EPS_SMALL, 1) .. ';')
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dTenH - 100 * GEO.EPS_SMALL, 1))
if i < nPass then sUserNotes = EgtSetValInNotes( sUserNotes, 'OutRaw', 3) end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
local dOffset = ( i - 1) * dStep local dOffset = ( i - 1) * dStep
EgtSetMachiningParam( MCH_MP.OFFSR, dOffset) EgtSetMachiningParam( MCH_MP.OFFSR, dOffset)
@@ -324,19 +238,13 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- se contorno aperto, cambio parametri di attacco/uscita -- se contorno aperto, cambio parametri di attacco/uscita
if not bClosed then if not bClosed then
EgtSetMachiningParam( MCH_MP.LITANG, 0.7 * dMillDiam) EgtSetMachiningParam( MCH_MP.LITANG, 0.7 * dMillDiam)
EgtSetMachiningParam( MCH_MP.LIPERP, 20) EgtSetMachiningParam( MCH_MP.LIPERP, 0)
EgtSetMachiningParam( MCH_MP.LOTANG, 0.7 * dMillDiam) EgtSetMachiningParam( MCH_MP.LOTANG, 0.7 * dMillDiam)
EgtSetMachiningParam( MCH_MP.LOPERP, 20) EgtSetMachiningParam( MCH_MP.LOPERP, 0)
end end
-- imposto posizione braccio porta testa -- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE local nSCC = MCH_SCC.NONE
if BD.TURN then if not BD.C_SIMM and not BD.TURN then
if b3Solid:getDimY() >= b3Solid:getDimZ() then
nSCC = MCH_SCC.ADIR_ZP
else
nSCC = MCH_SCC.ADIR_YM
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)
@@ -356,7 +264,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
local dOffs = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX() local dOffs = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()
local dDelta = 0 local dDelta = 0
if abs( vtN:getY()) < 0.1 and vtN:getZ() > 0.5 then if abs( vtN:getY()) < 0.1 and vtN:getZ() > 0.5 then
dDelta = - EgtIf( BD.PRESS_ROLLER, 0.7, 0.5) * dOffs dDelta = - 0.5 * dOffs
end end
if bShortPart and b3Raw:getDimZ() < BD.VICE_MINH and abs( vtN:getZ()) > 0.575 then if bShortPart and b3Raw:getDimZ() < BD.VICE_MINH and abs( vtN:getZ()) > 0.575 then
local b3Base = EgtSurfTmGetFacetBBoxGlob( Proc.Id, 0, GDB_BB.STANDARD) local b3Base = EgtSurfTmGetFacetBBoxGlob( Proc.Id, 0, GDB_BB.STANDARD)
@@ -367,7 +275,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
elseif Proc.Tail then elseif Proc.Tail then
local dOffs = Proc.Box:getMax():getX() - b3Solid:getMin():getX() local dOffs = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
if abs( vtN:getY()) < 0.1 and vtN:getZ() > 0.5 then if abs( vtN:getY()) < 0.1 and vtN:getZ() > 0.5 then
dOffs = EgtIf( BD.PRESS_ROLLER, 0.3, 0.5) * dOffs dOffs = 0.5 * dOffs
end end
BL.UpdateTCING( nRawId, dOffs) BL.UpdateTCING( nRawId, dOffs)
end end
+10 -19
View File
@@ -1,7 +1,6 @@
-- ProcessText.lua by Egaltech s.r.l. 2022/12/05 -- ProcessText.lua by Egaltech s.r.l. 2021/05/03
-- Gestione calcolo testi per Travi -- Gestione calcolo testi per Travi
-- 2021/05/03 Aggiunta gestione testa da sotto. -- 2021/05/03 Aggiunta gestione testa da sotto.
-- 2022/12/05 Aggiunta gestione tipo di lavorazione Text_AT.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessText = {} local ProcessText = {}
@@ -32,12 +31,6 @@ function ProcessText.Classify( Proc)
end end
-- verifico se il testo è lavorabile solo da sotto -- verifico se il testo è lavorabile solo da sotto
local bDown = (( vtN:getZ() < -0.1)) local bDown = (( vtN:getZ() < -0.1))
-- se da sotto e presente rinvio angolare verifico se c'è opportuna lavorazione
if bDown and BD.ANG_TRASM then
if ML.FindMilling( 'Text_AT') then
bDown = false
end
end
return true, bDown return true, bDown
end end
@@ -48,25 +41,25 @@ function ProcessText.Make( Proc, nPhase, nRawId, nPartId)
local vtN = EgtTextNormVersor( Proc.Id, GDB_ID.ROOT) local vtN = EgtTextNormVersor( Proc.Id, GDB_ID.ROOT)
-- verifico sia un testo -- verifico sia un testo
if not vtN then if not vtN then
local sErr = 'Error : Text with geometry type not accepted' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Text with geometry type not accepted'
EgtOutLog( sErr) EgtOutLog( sErr)
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.ANG_TRASM and not BD.TURN then if vtN:getZ() < - 0.1 and not BD.DOWN_HEAD and not BD.TURN then
local sErr = 'Error : 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
end end
-- abilitazione lavorazione da sotto -- abilitazione lavorazione da sotto
local bMillUp = ( BD.DOWN_HEAD and vtN:getZ() > -0.259) local bMillUp = ( BD.DOWN_HEAD and vtN:getZ() > -0.259)
local bMillDown = ( BD.DOWN_HEAD and vtN:getZ() < 0.174) local bMillDown = ( BD.DOWN_HEAD and vtN:getZ() < 0.174)
local bMillAngTrasm = ( BD.ANG_TRASM and vtN:getZ() < -0.1)
-- recupero la lavorazione -- recupero la lavorazione
local sMillType = EgtIf( not bMillAngTrasm, 'Text', 'Text_AT') local sMillType = 'Text'
--local sMchExt = EgtIf( bMillDown, '_H2', '')
local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown) local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown)
if not sMilling then if not sMilling then
local sErr = 'Error : milling not found in library' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -81,13 +74,11 @@ function ProcessText.Make( Proc, nPhase, nRawId, nPartId)
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, -1}}) EgtSetMachiningGeometry( {{ Proc.Id, -1}})
-- imposto posizione braccio porta testa -- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE if vtN:getY() <= 0 then
if bMillAngTrasm then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
nSCC = MCH_SCC.ADIR_NEAR
else else
nSCC = EgtIf( vtN:getY() <= 0, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP) EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
+8 -11
View File
@@ -1,7 +1,6 @@
-- ProcessTyroleanDovetail.lua by Egaltech s.r.l. 2022/03/21 -- ProcessTyroleanDovetail.lua by Egaltech s.r.l. 2022/03/21
-- 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) -- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- 2023/09/26 Modificata chiamata a GetFaceWithMostAdj.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessTyroleanDovetail = {} local ProcessTyroleanDovetail = {}
@@ -232,8 +231,7 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw,
-- se va fatto, inserisco la lavorazione -- se va fatto, inserisco la lavorazione
if bCut then if bCut then
local CutProc = { Id = AuxId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, local CutProc = { Id = AuxId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId} Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead) local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
-- se taglio applicato setto la nota al gruppo Mach per non doverla lavorare una seconda volta -- se taglio applicato setto la nota al gruppo Mach per non doverla lavorare una seconda volta
if bOk then if bOk then
@@ -331,8 +329,7 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw,
-- se va fatto, inserisco la lavorazione -- se va fatto, inserisco la lavorazione
if bCut then if bCut then
local CutProc = { Id = AuxId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, local CutProc = { Id = AuxId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId} Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead) local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
-- se taglio applicato setto la nota al gruppo Mach per non doverla lavorare una seconda volta -- se taglio applicato setto la nota al gruppo Mach per non doverla lavorare una seconda volta
if bOk then if bOk then
@@ -451,12 +448,12 @@ local function MakeMillCut( Proc, i, j, k, sMilling, nFacInd, TabNAD, rfFac, dOf
EgtSetMachiningParam( MCH_MP.STARTADDLEN, ( dToolDiam * 0.75)) EgtSetMachiningParam( MCH_MP.STARTADDLEN, ( dToolDiam * 0.75))
EgtSetMachiningParam( MCH_MP.ENDADDLEN, ( dToolDiam * 0.75)) EgtSetMachiningParam( MCH_MP.ENDADDLEN, ( dToolDiam * 0.75))
-- Note utente con dichiarazione nessuna generazione sfridi per Vmill solo in ultima passata in Z locale -- Note utente con dichiarazione nessuna generazione sfridi per Vmill solo in ultima passata in Z locale
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' local sUserNotes
if i < nStep then if i < nStep then
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dStep, 1)) sUserNotes = 'MaxElev=' .. EgtNumToString( dStep, 1) .. ';'
else else
sUserNotes = EgtSetValInNotes( sUserNotes, 'VMRS', 0) sUserNotes = 'VMRS=0;'
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dStep, 1)) sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( dStep, 1) .. ';'
end end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
@@ -513,10 +510,10 @@ local function MakeMachByMill( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b
dStepmach = dMaxMat * 0.5 dStepmach = dMaxMat * 0.5
end end
-- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa -- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa
local nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc, nPartId, false, sin(dSideAngle)) local nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc.Id, nPartId, false, sin(dSideAngle))
if not nFacInd or nFacInd < 0 then if not nFacInd or nFacInd < 0 then
-- provo eliminando i sottosquadra -- provo eliminando i sottosquadra
nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc, nPartId, false, -2) nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc.Id, nPartId, false, -2)
if not nFacInd or nFacInd < 0 then if not nFacInd or nFacInd < 0 then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' MakeMachByMill could not find reference face' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' MakeMachByMill could not find reference face'
EgtOutLog( sErr) EgtOutLog( sErr)
-172
View File
@@ -1,172 +0,0 @@
-- ProcessVariant.lua by Egaltech s.r.l. 2023/11/08
-- Gestione calcolo Feature Custom (Variant) per Travi
-- 2023/11/08 Creazione modulo.
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
-- Tabella per definizione modulo
local ProcessVariant = {}
-- Include
require( 'EgtBase')
local BL = require( 'BeamLib')
EgtOutLog( ' ProcessVariant started', 1)
-- Dati
local BD = require( 'BeamData')
local ML = require( 'MachiningLib')
---------------------------------------------------------------------
-- Riconoscimento della feature
function ProcessVariant.Identify( Proc)
return (( Proc.Grp == 0 or Proc.Grp == 1 or Proc.Grp == 2 or Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 900)
end
---------------------------------------------------------------------
-- Classificazione della feature: decide se la feature è in una posizione lavorabile
local function ClassifyPocket( Proc, b3Raw)
-- recupero gli indici delle facce da lavorare
local vFace = EgtGetInfo( Proc.Id, 'Faces', 'vi')
if not vFace or #vFace == 0 then
local sErr = 'Error : missing Faces for Pocketing'
EgtOutLog( sErr)
return false
end
-- recupero le normali di tutte le facce e verifico siano uguali
local vtN
for i = 1, #vFace do
local vtNf = EgtSurfTmFacetNormVersor( Proc.Id, vFace[i], GDB_ID.ROOT)
if not vtN then
vtN = vtNf
else
if not AreSameVectorApprox( vtN, vtNf) then
local sErr = 'Error : Faces for Pocketing with different orientation'
EgtOutLog( sErr)
return false
end
end
end
local bDown = ( vtN:getZ() < - 0.5)
-- se da sotto e presente rinvio angolare verifico se c'è opportuna lavorazione
if bDown and BD.ANG_TRASM then
local dMaxDiam = EgtGetInfo( Proc.Id, 'MaxDiam', 'd')
if ML.FindPocketing( 'Pocket_AT', dMaxDiam) then
bDown = false
end
end
return true, bDown, false
end
---------------------------------------------------------------------
function ProcessVariant.Classify( Proc, b3Raw)
-- recupero il codice identificativo e il tipo di lavorazione
local sCode = EgtGetInfo( Proc.Id, 'DES')
local sType = EgtGetInfo( Proc.Id, 'Type')
-- gestione in base al tipo
if sType == 'Pocket' then
return ClassifyPocket( Proc, b3Raw)
else
return false
end
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
local function MakePocket( Proc, nRawId, b3Raw, nPartId)
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
-- recupero gli indici delle facce da lavorare
local vFace = EgtGetInfo( Proc.Id, 'Faces', 'vi')
if not vFace or #vFace == 0 then
local sErr = 'Error : missing Faces for Pocketing'
EgtOutLog( sErr)
return false
end
-- recupero i dati delle facce (le normali sono identiche)
local dTotDepth = 0
local vDepth = {}
for i = 1, #vFace do
vDepth[i] = BL.GetFaceElevation( Proc, vFace[1], b3Solid)
dTotDepth = max( dTotDepth, vDepth[i])
end
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, vFace[1], GDB_ID.ROOT)
-- recupero eventuale massimo diametro impostato
local dMaxDiam = EgtGetInfo( Proc.Id, 'MaxDiam', 'd')
-- abilitazione lavorazione da sotto
local bMillUp = ( BD.DOWN_HEAD and vtN:getZ() > -0.259)
local bMillDown = ( BD.DOWN_HEAD and vtN:getZ() < 0.174)
local bMillAngTrasm = ( BD.ANG_TRASM and vtN:getZ() < -0.5)
-- recupero la lavorazione
local sPockType = EgtIf( not bMillAngTrasm, 'Pocket', 'Pocket_AT')
local sPocketing = ML.FindPocketing( sPockType, dMaxDiam, dTotDepth)
if not sPocketing then
sPocketing = ML.FindPocketing( sPockType, dMaxDiam, dTotDepth / 2)
if not sPocketing then
local sErr = 'Error : pocketing not found in library'
EgtOutLog( sErr)
return false, sErr
end
end
-- recupero i dati dell'utensile
local dMillDiam = 20
local dMaxDepth = 0
if EgtMdbSetCurrMachining( sPocketing) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- se elevazione superiore a massimo affondamento della fresa, segnalo
local sWarn
if dTotDepth > dMaxDepth + 10 * GEO.EPS_SMALL then
sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
end
-- lavoro ogni faccia
for i = 1, #vFace do
-- inserisco la lavorazione di svuotatura
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( i)
local nMchFId = EgtAddMachining( sName, sPocketing)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, vFace[i]}})
-- imposto posizione braccio porta testa
if vtN:getY() <= 0 then
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
else
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end
EgtSetMachiningParam( MCH_MP.DEPTH, min( 0, dMaxDepth - vDepth[i]))
-- imposto elevazione
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or ''
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dMaxDepth, 1))
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
return true, sWarn
end
---------------------------------------------------------------------
function ProcessVariant.Make( Proc, nRawId, b3Raw, nPartId)
-- recupero il codice identificativo e il tipo di lavorazione
local sCode = EgtGetInfo( Proc.Id, 'DES')
local sType = EgtGetInfo( Proc.Id, 'Type')
-- gestione in base al tipo
if sType == 'Pocket' then
return MakePocket( Proc, nRawId, b3Raw, nPartId)
else
return false, 'Variant Type non recognized for machining'
end
end
---------------------------------------------------------------------
return ProcessVariant
+123 -259
View File
@@ -1,8 +1,5 @@
-- BeamNestProcess.lua by Egaltech s.r.l. 2023/01/15 -- BeamNestProcess.lua by Egaltech s.r.l. 2021/06/14
-- Gestione nesting automatico travi -- Gestione nesting automatico travi
-- 2022/10/05 Piccole modifiche per far funzionare correttamente i compilati.
-- 2022/10/06 Corretto bug che moltiplicava i pezzi se erano presenti più grezzi della stessa sezione.
-- 2023/01/15 Piccole correzioni.
-- Intestazioni -- Intestazioni
require( 'EgtBase') require( 'EgtBase')
@@ -15,12 +12,9 @@ EgtEnableDebug( false)
--NEST.MACHINE = 'Essetre-90480019_MW' --NEST.MACHINE = 'Essetre-90480019_MW'
--NEST.FLAG = 3 --NEST.FLAG = 3
local sLog = ' +++ BeamNestProcess : ' .. NEST.FILE .. ', ' .. NEST.MACHINE .. ', ' .. LEN[1] local sLog = ' +++ BeamNestProcess : ' .. NEST.FILE .. ', ' .. NEST.MACHINE .. ', ' .. LEN["1"]
EgtOutLog( sLog) EgtOutLog( sLog)
-- flag per abilitare statistiche in log
local bLogStat = false
-- Cancello file di log specifico -- Cancello file di log specifico
local sLogFile = EgtChangePathExtension( NEST.FILE, '.txt') local sLogFile = EgtChangePathExtension( NEST.FILE, '.txt')
EgtEraseFile( sLogFile) EgtEraseFile( sLogFile)
@@ -91,9 +85,9 @@ local function ExecMaximumFilling( Raw, Parts)
EgtMaxFillerAddPart( i, Parts[i].Len, Parts[i].DispLen or Parts[i].Len, Parts[i].Cnt or 1) EgtMaxFillerAddPart( i, Parts[i].Len, Parts[i].DispLen or Parts[i].Len, Parts[i].Cnt or 1)
end end
-- Eseguo l'ottimizzazione -- Eseguo l'ottimizzazione
--EgtStartCounter() EgtStartCounter()
EgtMaxFillerCompute( Raw.LenToFill, Raw.StartGap, Raw.MidGap, Raw.EndGap, Raw.SortType) EgtMaxFillerCompute( Raw.LenToFill, Raw.StartGap, Raw.MidGap, Raw.EndGap, Raw.SortType)
--local dTime = EgtStopCounter() local dTime = EgtStopCounter()
-- Recupero i risultati -- Recupero i risultati
local nFilledParts, nDiffParts, dTotFillRatio = EgtMaxFillerGetResults() local nFilledParts, nDiffParts, dTotFillRatio = EgtMaxFillerGetResults()
local OneRes = {} local OneRes = {}
@@ -101,8 +95,7 @@ local function ExecMaximumFilling( Raw, Parts)
local nPartId, nCount = EgtMaxFillerGetOneResult( i) local nPartId, nCount = EgtMaxFillerGetOneResult( i)
table.insert( OneRes, { Id=nPartId, Count=nCount}) table.insert( OneRes, { Id=nPartId, Count=nCount})
end end
--return { FilledParts=nFilledParts, DiffParts=nDiffParts, FillRatio=dTotFillRatio, Time=dTime, Data=OneRes} return { FilledParts=nFilledParts, DiffParts=nDiffParts, FillRatio=dTotFillRatio, Time=dTime, Data=OneRes}
return { FilledParts=nFilledParts, DiffParts=nDiffParts, FillRatio=dTotFillRatio, Data=OneRes}
end end
-- Funzione per trovare nome MachGroup -- Funzione per trovare nome MachGroup
@@ -160,37 +153,27 @@ local nErrCnt = 0
local nWarnCnt = 0 local nWarnCnt = 0
-- Grezzi -- Grezzi
-- lista dei grezzi
local Raws = {} local Raws = {}
-- creo tabella dei grezzi -- creo tabella dei grezzi
for nIndex, nLen in pairs( LEN) do for nIndex, nLen in pairs( LEN) do
Raws[tonumber(nIndex)] = {LenToFill = nLen, StartGap = NEST.STARTOFFSET, MidGap = NEST.OFFSET, EndGap = 0, SortType = -1} table.insert(Raws, {LenToFill = nLen, StartGap = NEST.STARTOFFSET, MidGap = NEST.OFFSET, EndGap = 0, SortType = -1})
end end
for nIndex, nQty in pairs( QTY) do for nIndex, nQty in pairs( QTY) do
Raws[tonumber(nIndex)].Count = nQty Raws[tonumber(nIndex)].Count = nQty
end end
-- cerco il grezzo con la lunghezza maggiore, epurata dello start gap
local maxRawLenToFillNoStartGap = 0 --local nTotRaws = Raws.Count
for RawIndex = 1, #Raws do
if Raws[RawIndex].Count > 0 then
maxRawLenToFillNoStartGap = max( maxRawLenToFillNoStartGap, Raws[RawIndex].LenToFill - Raws[RawIndex].StartGap)
end
end
-- Pezzi -- Pezzi
local Parts = {} local Parts = {}
-- ciclo su pezzi per aggiungerli al nesting -- ciclo su pezzi per aggiungerli al nesting
local dTotLen = 0
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) --EgtIf( Len <= 2000, max( 2000, 6000 - Len), 0)
-- aggiungo il pezzo solo se ci sta nel grezzo più lungo a disposizione table.insert( Parts, {Id = nPartId, Len = Len, DispLen = DispLen, Cnt = nCount})
if Len < maxRawLenToFillNoStartGap then
for nCntIndex = 1 , nCount do
table.insert( Parts, {Id = nPartId, Len = Len, DispLen = DispLen, Cnt = 1})
dTotLen = dTotLen + Len
end
end
end end
-- lunghezza totale pezzi -- lunghezza totale pezzi
@@ -208,247 +191,128 @@ local MediumRawQty = ceil( RawQtySum / #NeededRawsForType)
if MediumRawQty > 1 then if MediumRawQty > 1 then
MediumRawQty = MediumRawQty - 1 MediumRawQty = MediumRawQty - 1
end end
-- recupero pezzi piu' corti di mille
-- lista dei risultati local ShortList = {}
local ResultList = {} local LongList = {}
local BestResult = nil for PartIndex = 1, #Parts do
local BestResultIndex = nil if Parts[PartIndex].Len <= 1000 then
-- riordino lista pezzi per lunghezza table.insert( ShortList, Parts[PartIndex])
table.sort( Parts, function( B1, B2) return B1.Len < B2.Len end) else
table.insert( LongList, Parts[PartIndex])
local function NestSolutionByIndex( Index)
-- creo copia lista raw
local TempRaws = {}
for TempRawIndex = 1, #Raws do
table.insert(TempRaws, {LenToFill = Raws[TempRawIndex].LenToFill, StartGap = Raws[TempRawIndex].StartGap, MidGap = Raws[TempRawIndex].MidGap, EndGap = Raws[TempRawIndex].EndGap, SortType = Raws[TempRawIndex].SortType, Count = Raws[TempRawIndex].Count})
end end
end
-- recupero pezzi corti -- numero di pezzi piccoli per barra
local ShortList = {} local ShortCount = 0
local LongList = {} for ShortIndex = 1, #ShortList do
ShortCount = ShortCount + ShortList[ShortIndex].Cnt
for PartIndex = 1, #Parts do end
if PartIndex <= Index then local ShortForRaw = floor( ShortCount / MediumRawQty)
table.insert( ShortList, Parts[PartIndex]) local ExtraShortForRaw = fmod( ShortCount, MediumRawQty)
else -- creo lista pezzi corti singoli
table.insert( LongList, Parts[PartIndex]) local SingleShortList = {}
end for ShortIndex = 1, #ShortList do
Parts[PartIndex].Cnt = 1 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
-- numero di pezzi piccoli per barra end
local ShortCount = Index -- li divido per le barre previste
local ShortForRaw = floor( ShortCount / MediumRawQty) local RawsShortList = {}
local ExtraShortForRaw = 0 local RawIndex = 0
if MediumRawQty > 0 then local ShortRawIndex = 0
ExtraShortForRaw = fmod( ShortCount, MediumRawQty) for ShortIndex = 1, #SingleShortList do
end if ShortRawIndex > 0 then
-- creo lista pezzi corti singoli table.insert( RawsShortList[RawIndex], SingleShortList[ShortIndex])
local SingleShortList = {} ShortRawIndex = ShortRawIndex - 1
for ShortIndex = 1, #ShortList do else
for ShortCount = 1, ShortList[ShortIndex].Cnt do table.insert( RawsShortList, {SingleShortList[ShortIndex]})
table.insert( SingleShortList, {Id = ShortList[ShortIndex].Id, Len = ShortList[ShortIndex].Len, DispLen = ShortList[ShortIndex].DispLen, Cnt = 1}) RawIndex = RawIndex + 1
end ShortRawIndex = ShortForRaw + EgtIf( RawIndex <= ExtraShortForRaw, 1, 0) - 1
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
local dTotPartInRawLen = 0
local nRawTot = 0
local dRawTotLen = 0
local dTime = 0
local nCycle = 1
local CurrResult = {}
while TotRawCount( TempRaws) > 0 and PartsToFill( Parts) > 0 do
-- creo lista 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, #TempRaws do
if TempRaws[RawIndex].Count > 0 then
Results[RawIndex] = ExecMaximumFilling( TempRaws[RawIndex], PartsToNest)
else
Results[RawIndex] = { FillRatio = 0.001, LenToFill = 1000, DiffParts = 0}
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) * TempRaws[ResultIndex].LenToFill
if Results[ResultIndex].DiffParts > 0 and dWaste < dMinWaste then
dMinWaste = dWaste
nMinWasteRawIndex = ResultIndex
end
end
end
-- verifico se ci sono pezzi
if nMinWasteRawIndex > 0 and Results[nMinWasteRawIndex] and Results[nMinWasteRawIndex].DiffParts > 0 then
-- riporto barra e pezzi nel risultato corrente
local CurrBar = { BarLen = TempRaws[nMinWasteRawIndex].LenToFill, Parts = {}}
local CurrX = TempRaws[nMinWasteRawIndex].StartGap
local nInfoIndex = 1
for i = 1, Results[nMinWasteRawIndex].DiffParts do
local PartIndex = Results[nMinWasteRawIndex].Data[i].Id
local PartId = PartsToNest[PartIndex].Id
local dLen = PartsToNest[PartIndex].Len
for j = 1, Results[nMinWasteRawIndex].Data[i].Count do
-- creo pezzo copia
CurrPart = { Index = nInfoIndex, PartId = PartId, PosX = CurrX}
table.insert( CurrBar.Parts, CurrPart)
CurrX = CurrX + dLen + TempRaws[nMinWasteRawIndex].MidGap
nInfoIndex = nInfoIndex + 1
end
end
table.insert( CurrResult, CurrBar)
dTotPartInRawLen = dTotPartInRawLen + ( Results[nMinWasteRawIndex].FillRatio * TempRaws[nMinWasteRawIndex].LenToFill)
nRawTot = nRawTot + 1
dRawTotLen = dRawTotLen + TempRaws[nMinWasteRawIndex].LenToFill
-- Aggiorno per prossima iterazione
TempRaws[nMinWasteRawIndex].Count = TempRaws[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
else
-- se non sono riuscito ad inserire alcun pezzo esco dal ciclo perche' non ci sono pezzi inseribili
break
end
nCycle = nCycle + 1
end
-- riporto risultato in lista
ResultList[Index] = dTotPartInRawLen
if not BestResult or not BestResultIndex or
( dTotPartInRawLen > ResultList[BestResultIndex] + 0.02 or ( abs( dTotPartInRawLen - ResultList[BestResultIndex]) < 0.02 and dRawTotLen < BestResult.RawTotLen - 0.02)) then
BestResult = CurrResult
BestResult.RawTotLen = dRawTotLen
BestResultIndex = Index
end end
end end
local CycleCount = 0 -- Ciclo fino ad esaurimento pezzi o barre
local nRawTot = 0
local MinTime = 10 + pow( 3, ceil( log10( #Parts)) - 1) local dTime = 0
if bLogStat then EgtOutLog('MinTime: ' .. MinTime ) end local nCycle = 1
local MaxTime = 30 + pow( 7, ceil( log10( #Parts)) - 1) while TotRawCount( Raws) > 0 and PartsToFill( Parts) > 0 do
if bLogStat then EgtOutLog('MaxTime: ' .. MaxTime ) end
local TargetRatio = 0.98
local dTargetRatioLen = TargetRatio * dTotLen
if bLogStat then EgtOutLog('TargetRatioLen: ' .. dTargetRatioLen ) end
local CurrTime = 0
local function NestSolutionFromSP( StartingPoint, OscillationStep)
-- ciclo sulle possibilita' da un punto di origine con uno step fisso
local CurrResultIndex = StartingPoint
NestSolutionByIndex( StartingPoint)
if OscillationStep == 0 then return end
local CycleIndex = 1
local nOutOfBoundary = 0
while nOutOfBoundary ~= 3 do
CurrTime = EgtStopCounter() / 1000
if bLogStat then EgtOutLog('CurrTime: ' .. CurrTime ) end
if bLogStat then EgtOutLog('BestRatio: ' .. dTotLen / BestResult.RawTotLen ) end
-- se e' passato il tempo massimo, o e' passato il tempo minimo, ha inserito tutti i pezzi e la percentuale di utilizzo del materiale e' maggiore della soglia
if CurrTime > MaxTime or ( CurrTime > MinTime and ResultList[BestResultIndex] > dTotLen - 0.1 and ( dTotLen / BestResult.RawTotLen ) >= TargetRatio) then
if bLogStat then EgtOutLog('Brake') end
break
end
local bCurrOutOfBoundary = false
if CurrResultIndex < 0 then
bCurrOutOfBoundary = true
if nOutOfBoundary == 2 then
nOutOfBoundary = 3
else
nOutOfBoundary = 1
end
end
if CurrResultIndex > #Parts then
bCurrOutOfBoundary = true
if nOutOfBoundary == 1 then
nOutOfBoundary = 3
else
nOutOfBoundary = 2
end
end
if not bCurrOutOfBoundary and not ResultList[CurrResultIndex] then
NestSolutionByIndex( CurrResultIndex)
if bLogStat then EgtOutLog('CurrResultIndex: ' .. CurrResultIndex ) end
if bLogStat then EgtOutLog('Result: ' .. ResultList[CurrResultIndex]) end
CycleCount = CycleCount + 1
end
CurrResultIndex = StartingPoint + EgtIf( CycleIndex % 2 == 0, (CycleIndex / 2) * OscillationStep, -( ( CycleIndex + 1) / 2) * OscillationStep )
CycleIndex = CycleIndex + 1
end
end
-- lancio calcolo -- creo lista pezzi con pezzi lunghi e pezzi corti di questo Cycle
EgtStartCounter() local PartsToNest = {}
local StartingResult = floor( #Parts * 0.3) for PartIndex = 1, #LongList do
if bLogStat then EgtOutLog('StartingResult: ' .. StartingResult ) end table.insert( PartsToNest, LongList[PartIndex])
--local Step = floor( #Parts / 10) * floor( log10( #Parts))
local nDividendo = pow( 10, floor( log10( #Parts)) - 1)
nDividendo = EgtIf( nDividendo ~= 1, nDividendo, 10)
local Step = floor( #Parts / nDividendo) * floor( log10( #Parts))
if bLogStat then EgtOutLog('Step: ' .. Step ) end
NestSolutionFromSP( StartingResult, Step)
if Step > 1 then
NestSolutionFromSP( StartingResult, 1)
end
-- creo gruppi di lavorazione per risultato
for MachGroupIndex = 1, #BestResult do
local CurrMachGroup = BestResult[ MachGroupIndex]
-- creo gruppo di lavorazione
local MachGroupName = NewMachGroupName()
nMachGroup = EgtAddMachGroup( MachGroupName)
EgtSetInfo( nMachGroup, "BARLEN", CurrMachGroup.BarLen)
EgtSetInfo( nMachGroup, "MATERIAL", NEST.MATERIAL)
EgtSetInfo( nMachGroup, "AUTONEST", 1)
-- scrivo dati per variabili P di comunicazione con la macchina in gruppo di lavorazione
EgtSetInfo( nMachGroup, "PRODID", NEST.PRODID)
EgtSetInfo( nMachGroup, "PATTID", nMachGroup)
-- Disegno i pezzi
for i = 1, #CurrMachGroup.Parts do
local CurrPart = CurrMachGroup.Parts[ i]
-- creo pezzo copia
local nPartDuploId = EgtDuploNew( CurrPart.PartId)
EgtSetInfo( nMachGroup, "PART" .. CurrPart.Index, nPartDuploId .. "," .. CurrPart.PosX)
end 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
if nMinWasteRawIndex > 0 and Results[nMinWasteRawIndex] and Results[nMinWasteRawIndex].DiffParts > 0 then
-- creo gruppo di lavorazione
local MachGroupName = NewMachGroupName()
nMachGroup = EgtAddMachGroup( MachGroupName)
EgtSetInfo( nMachGroup, "BARLEN", Raws[nMinWasteRawIndex].LenToFill)
EgtSetInfo( nMachGroup, "MATERIAL", NEST.MATERIAL)
EgtSetInfo( nMachGroup, "AUTONEST", 1)
-- scrivo dati per variabili P di comunicazione con la macchina in gruppo di lavorazione
EgtSetInfo( nMachGroup, "PRODID", NEST.PRODID)
EgtSetInfo( nMachGroup, "PATTID", nMachGroup)
-- Disegno i pezzi
local CurrX = Raws[nMinWasteRawIndex].StartGap
local nInfoIndex = 1
for i = 1, Results[nMinWasteRawIndex].DiffParts do
local PartIndex = Results[nMinWasteRawIndex].Data[i].Id
local PartId = PartsToNest[PartIndex].Id
local dLen = PartsToNest[PartIndex].Len
for j = 1, Results[nMinWasteRawIndex].Data[i].Count do
-- creo pezzo copia
local nPartDuploId = EgtDuploNew( PartId)
EgtSetInfo( nMachGroup, "PART" .. nInfoIndex, nPartDuploId .. "," .. CurrX)
CurrX = CurrX + dLen + Raws[nMinWasteRawIndex].MidGap
nInfoIndex = nInfoIndex + 1
end
end
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
nCycle = nCycle + 1
end end
-- creo grezzi per ogni gruppo di lavorazione -- creo grezzi per ogni gruppo di lavorazione
local nRawCnt = 0 local nRawCnt = 0
local nRawTot = ResultList[BestResultIndex]
_G.BEAM = {} _G.BEAM = {}
BEAM.FILE = NEST.FILE BEAM.FILE = NEST.FILE
BEAM.MACHINE = NEST.MACHINE BEAM.MACHINE = NEST.MACHINE
@@ -461,7 +325,7 @@ while nMachGroup do
if EgtGetInfo( nMachGroup, "AUTONEST",'i') == 1 then if EgtGetInfo( nMachGroup, "AUTONEST",'i') == 1 then
EgtRemoveInfo( nMachGroup, "AUTONEST") EgtRemoveInfo( nMachGroup, "AUTONEST")
EgtSetInfo( nMachGroup, "UPDATEUI", 1) EgtSetInfo( nMachGroup, "UPDATEUI", 1)
local bOk, sErr = pcall( dofile, BEAM.BASEDIR .. "\\BatchProcessNew.lua") local bOk, sErr = pcall( dofile, EgtGetSourceDir() .. "BatchProcessNew.lua")
if not bOk then if not bOk then
EgtOutLog( 'Error in BatchProcessNew.lua call (' .. ( sErr or '') ..')') EgtOutLog( 'Error in BatchProcessNew.lua call (' .. ( sErr or '') ..')')
end end
+19 -39
View File
@@ -62,7 +62,7 @@ local function MyProcessInputData()
end end
end end
if not bFound then if not bFound then
table.insert( vBeam, { Ind = #vBeam + 1, Id = nPartId, Name = ( EgtGetName( nPartId) or ( 'Id=' .. tonumber( nPartId)))}) table.insert( vBeam, { Id = nPartId, Name = ( EgtGetName( nPartId) or ( 'Id=' .. tonumber( nPartId)))})
end end
end end
nId = EgtGetNextSelectedObj() nId = EgtGetNextSelectedObj()
@@ -115,6 +115,17 @@ local function MyProcessInputData()
end end
EgtDeselectAll() EgtDeselectAll()
-- Le ordino in senso di lunghezza crescente
table.sort( vBeam, function( B1, B2) return B1.Box:getDimX() < B2.Box:getDimX() end)
do
local sOut = ''
for i = 1, #vBeam do
sOut = sOut .. vBeam[i].Name .. ', '
end
sOut = sOut:sub( 1, -3)
EgtOutLog( 'Travi ordinate : ' .. sOut, 1)
end
return true return true
end end
@@ -133,16 +144,13 @@ local function MyProcessBeams()
end end
dTotLen = dTotLen + max( vBeam[#vBeam].Box:getDimX(), BD.MinRaw) dTotLen = dTotLen + max( vBeam[#vBeam].Box:getDimX(), BD.MinRaw)
local dAddLen = BD.OVM_HEAD + ( #vBeam - 1) * BD.OVM_MID local dAddLen = BD.OVM_HEAD + ( #vBeam - 1) * BD.OVM_MID
EgtOutLog( 'Ltot : '..EgtNumToString( dTotLen, 1) .. ' Lagg : '..EgtNumToString( dAddLen, 1)..' MinUnloadRaw : '.. EgtNumToString( BD.MinRaw + BD.OVM_MID, 1), 1) EgtOutLog( 'Ltot : ' .. EgtNumToString( dTotLen, 1) .. ' Lagg : '.. EgtNumToString( dAddLen, 1), 1)
-- Richiedo lunghezza del grezzo, sovramateriale di testa, forzatura verticale e ordinamento automatico secondo la lunghezza -- Richiedo lunghezza del grezzo e sovramateriale di testa
local vsVal = EgtDialogBox( 'Lavora Travi' .. ' (Ltot='..EgtNumToString( dTotLen + dAddLen + 0.5, 0).. local vsVal = EgtDialogBox( 'Lavora Travi' .. ' (Ltot='.. EgtNumToString( dTotLen + dAddLen + 0.5, 0) .. ', Lmax=' .. EgtNumToString( BD.MAX_RAW, 0) .. ')',
', Lmax='..EgtNumToString( BD.MAX_RAW, 0)..',MinUlr='..EgtNumToString( BD.MinRaw + BD.OVM_MID, 0)..')',
{'Lunghezza grezzo', EgtNumToString( BD.STD_RAW, 0)}, {'Lunghezza grezzo', EgtNumToString( BD.STD_RAW, 0)},
{'Sovramateriale di testa', EgtNumToString( BD.OVM_HEAD, 0)}, {'Sovramateriale di testa', EgtNumToString( BD.OVM_HEAD, 0)},
{'Offset intermedio', EgtNumToString( BD.OVM_MID, 0)}, {'Forza sezione verticale', ' CB:true,*false'})
{'Forza sezione verticale', ' CB:true,*false'},
{'Ordina per lunghezza', ' CB:true,*false'})
if not vsVal then if not vsVal then
EgtDraw() EgtDraw()
return return
@@ -165,17 +173,9 @@ local function MyProcessBeams()
EgtDraw() EgtDraw()
return false return false
end end
local dOvmMid = EgtEvalNumExpr( vsVal[3])
if not dOvmMid then
local sOut = 'Offset intermedio : ' .. vsVal[3]
EgtOutLog( sOut)
EgtOutBox( sOut, 'Lavora Travi', 'WARNING')
EgtDraw()
return false
end
-- Sistemo sezione barra con travi -- Sistemo sezione barra con travi
local bVert = ( vsVal[4] == 'true') local bVert = ( vsVal[3] == 'true')
if bVert then if bVert then
if dRawW > dRawH then dRawW, dRawH = dRawH, dRawW end if dRawW > dRawH then dRawW, dRawH = dRawH, dRawW end
end end
@@ -214,28 +214,8 @@ local function MyProcessBeams()
return false return false
end end
-- Se richiesto, ordino le travi in senso di lunghezza crescente
local bOrd = ( vsVal[5] == 'true')
if bOrd then
table.sort( vBeam, function( B1, B2)
if abs( B1.Box:getDimX() - B2.Box:getDimX()) < 1 then
return B1.Ind < B2.Ind
else
return B1.Box:getDimX() < B2.Box:getDimX()
end
end)
end
do
local sOut = ''
for i = 1, #vBeam do
sOut = sOut .. vBeam[i].Name .. ', '
end
sOut = sOut:sub( 1, -3)
EgtOutLog( 'Travi ordinate : ' .. sOut, 1)
end
-- Sistemo le travi nel grezzo -- Sistemo le travi nel grezzo
local bOk, sErr = BE.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, vBeam) local bOk, sErr = BE.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam)
if not bOk then if not bOk then
EgtOutLog( sErr) EgtOutLog( sErr)
EgtOutBox( sErr, 'Lavora Travi', 'ERROR') EgtOutBox( sErr, 'Lavora Travi', 'ERROR')
-513
View File
@@ -1,513 +0,0 @@
==== Beam Update Log ====
Versione 3.1e1 (05/05/2026)
- Modif : in LapJoint migliorate slot con sega a catena
- Fixed : in DrillPocket in doppio eliminata lavorazione aggiuntiva in caso di utensile non abbastanza lungo
Versione 3.1d2 (10/04/2026)
- Added : in StepJoint aggiunto Q02=1 per forzare fresa
- Added : in DtMortise aggiunto Q01=1 per disabilitare antischeggia
- Fixed : in LapJoint correzione a antischeggia con fresa in caso di feature spezzata
Versione 3.1d1 (08/04/2026)
- Added : le forature vengono accorciate con massima elevazione anche in presenza di tagli di testa
- Modif : nelle slot con lama verticali si lavora sempre in concordanza
- Fixed : in DtMortise correzione a lavorazione antischeggia
- Fixed : in LapJoint, se lavorazione vuota, si disattiva sempre; in Q02 si lavora sempre prima il lato sotto.
Versione 3.1c2 (18/03/2026)
- Added : in LapJoint (solo L030) aggiunto Q02 per fare solo contorno per forme a "C" e tunnel; Q17 spessore di eventuale codolo
- Modif : per LapJoint e simili il Q06 per antischeggia ora contempla il valore 3 per scegliere la strategia in automatico (lama o fresa)
- Modif : in LapJoint migliorie nella lavorazione delle tasche aperte
- Modif : in LongDoubleCut e LapJoint lunghe migliorata scelta fresa in caso di tasca che guarda verso il basso
- Fixed : in forature in doppio con svuotatura corretto ultimo step
- Fixed : in split correzione in caso di materiale di coda molto sottile e testa sotto
- Fixed : in LongDoubleCut e LapJoint lunghe eliminata passate finale dopo taglio di coda se non è presente un grezzo successivo
Versione 3.1c1 (04/03/2026)
- Fixed : correzione in ordinamento (fori vs tagli)
- Fixed : in drilling rimosso preforo duplicato
Versione 3.1b1 (26/02/2026)
- Added : in LapJoint lunghe gestito Q14 per lavorare discorde
- Added : in forature ora sono possibili le DrillPocket in doppio (ultimo step fatto dalla testa principale)
- Added : in FreeContour (contornatura) aggiunta Q10 per forzare massima elevazione
- Modif : in LongDoubleCut e LapJoint lunghe migliorata la scelta della faccia da lavorare e altre migliorie
- Modif : in LapJoint migliorie alle svuotature
- Modif : in LapJoint lunghe, negli spezzoni successivi al primo, le svuotature considerano l'area svuotata precedente
- Fixed : in forature in doppio si garantisce l'ultimo step per evitare collisioni delle punte o finecorsa
- Fixed : in mortasa a coda di rondine tagliata corretti ingresso uscita in caso di svuotatura
- Fixed : in tagli di testa e coda corretti smussi con P08 e P09
Versione 2.7l3 (23/12/2025)
- Modif : nei fori che attraversano un taglio si decide la precedenza in base all'angolo tra foro e taglio stesso
- Fixed : corretto precut in caso di sega a catena
Versione 2.7l2 (16/12/2025)
- Added : in LapJoint pulizia spigoli con fresa a V su tasche non passanti
Versione 2.7l1 (10/12/2025)
- Added : in LapJoint aggiunta gestione fresatura con aggregato flottante (Q specifica)
- Modif : in LapJoint modfifiche alla lavorazione spigoli su faccia frontale o posteriore
- Modif : in LapJoint lunghe, la spezzatura ora considera se è presente del grezzo dietro
Versione 2.7k1 (25/11/2025)
- Added : in tagli di testa e coda aggiunti smussi con possibilità di raccordare o smussare spigoli
- Added : in Lapjoint aggiunto Q14 per settare lavorazione discorde se longitudinale su faccia sotto
- Modif : migliorati i tagli
- Modif : migliorata lavorazione mortasa a coda di rondine
- Fixed : in Lapjoint alcune svuotature forzate a spirale
Versione 2.7j2 (30/10/2025)
- Fixed : in DoubleCut gestito il caso in cui si ha una terza faccia piccola da non lavorare
Versione 2.7j1 (28/10/2025)
- Modif : migliorato ordinamento feature
- Modif : in mortasa si considera ora il raggio minimo impostato da parametro P
- Modif : migliorie in tenone a coda di rondine
- Fixed : in mortasa corretto percorso errato in caso di diametro utensile uguale a larghezza tasca
- Fixed : in profilo cambered (103) gestito correttamente inverti in lavorazione
Versione 2.7i2 (30/09/2025)
- Modif : migliorie a mortasa e tenone a coda di rondine
- Modif : migliorie a LongDoubleCut
- Modif : migliorie ai tagli
Versione 2.7i1 (03/09/2025)
- Added : in Tenone a coda di rondine aggiunto passaggio di finitura in caso di P14 > 0
- Modif : in LapJoint migliorata la scelta lama in caso di due facce e altre piccole correzioni
Versione 2.7h3 (26/08/2025)
- Added : in LapJoint, se possibile, si ricalcola l'elevazione in caso di feature troncanti testa/coda
- Modif : eventuali feature troncanti testa/coda sono fatte sempre subito dopo i rispettivi tagli di testa/coda
Versione 2.7h2 (19/08/2025)
- Modif : migliorata ottimizzazione teste
- Modif : migliorate forature in doppio
- Modif : in LapJoint migliorate lavorazioni lama + sega a catena
- Modif : in LapJoint migliorata spezzatura per feature lunghe rispetto al pezzo
- Modif : in LapJoint tipo BirdsMouth migliorata lavorazione faccia inclinata
- Modif : in StepJointNotch, se 3 facce si riconduce a LapJoint
Versione 2.7h1 (05/08/2025)
- Fixed : in Mortise migliorata la lavorazione in caso di feature trimmata
- Modif : in LapJoint, riduzione massimo materiale lama per lavorazioni antischeggia di lama con direzione verticale
- Modif : in LapJoint migliorie alla lavorazione tipo BlockHaus
- Modif : nei profili si usa il tipo lavorazione Prof_end per la finitura
Versione 2.7g5 (14/07/2025)
- Fixed : in tagli di testa e coda corretti attacchi
Versione 2.7g4 (11/07/2025)
- Fixed : in LapJoint 2 facce correzione nella scelta lama da sotto
Versione 2.7g3 (11/07/2025)
- Fixed : in RidgeLap corretta scelta del lato da lavorare
Versione 2.7g2 (10/07/2025)
- Fixed : in LapJoint correzione per caso in cui la sega a catena lavorava la tasca in modo errato
Versione 2.7g1 (08/07/2025)
- Added : in LapJoint, aggiunti smussi anche se lavorazione con truciolatore
- Added : per profilo caudato aggiunta finitura con fresa piccola
- Added : gestione tastatura
- Modif : nei tagli di testa e coda, compresi quelli di spezzatura, la lama evita di arretrare se non necessario
- Modif : in LongDoubleCut migliorie varie
- Modif : in RidgeLap migliorie varie
- Modif : nelle forature che attraversano un taglio ora si considera la profondità già lavorata
- Fixed : in LongDoubleCut corretta lavorazione aggiunta erroneamente dopo separazione
Versione 2.7f3 (19/06/2025)
- Modif : in StepJointNotch corretta distanza attacco in/out
Versione 2.7f2 (18/06/2025)
- Modif : in LongDoubleCut aggiunto messaggio feature non completa se utensile non arriva sul fondo
- Modif : in StepJointNotch, se si forza truciolatore, si prende utensile più grande
- Fixed : in LapJoint, piccola correzione calcolo sovrapposizione trimesh per svuotatura
- Fixed : in LapJoint, per sovrapposizione in spezzatura, corretto caso tipo Tunnel
Versione 2.7f1 (03/06/2025)
- Modif : in tenone coda di rondine modificato angolo limite tenone per lavorazione in sottosquadro
- Modif : migliorie per lavorazioni su aggregato
Versione 2.7e2 (23/05/2025)
- Modif : in tagli di lama migliorie alla scelta del lato da lavorare
- Modif : in mortasa coda di rondine migliorati i percorsi
- Modif : in tenone coda di rondine migliorate le lavorazioni da sotto
- Fixed : in Scarf Joint correzione alla scelta faccia da lavorare
Versione 2.7e1 (05/05/2025)
- Modif : in LapJoint se tunnel verticale lavorato solo da sopra e l'utensile non arriva, si restituisce warning
- Fixed : in taglio di separazione si riduce percorso di taglio solo se il pezzo è effettivamente alto
- Fixed : in foratura corretto caso in cui non si sceglieva l'utensile più lungo disponibile
- Fixed : In BatchProcess (Ts7) corretta generazione in caso di progetto senza ricalcolo
Versione 2.7d3 (22/04/2025)
- Fixed : in LapJoint corretta gestione errata Q04
Versione 2.7d2 (17/04/2025)
- Added : in scanalatura aggiunta Q03 per forzare fresa
- Modif : in slot con lama + sega a catena abilitata lavorazione da sotto per macchine con testa sopra
- Modif : nei tagli modifche in caso di tagli di coda anticipati
- Modif : in lavorazioni tipo tacca ma 3 facce migliorata la scelta faccia
Versione 2.7d1 (04/04/2025)
- Fixed : in PreDrill piccola correzione
- Fixed : nei tagli varie correzioni
- Fixed : in HeadCut e Split corretto calcolo lunghezza extra di taglio
Versione 2.7c2 (24/03/2025)
- Fixed : in BatchProcess (Ts7) riabilitata modifica barra erroneamente rimossa
Versione 2.7c1 (17/03/2025)
- Modif : in HeadCut e Split, per decidere se fare doppio taglio verticale, si controlla anche il massimo possibile e non solo il minimo
- Modif : in LapJoint migliorato controllo per decidere se feature di coda
- Modif : nei tagli, se taglio rivolto verso il basso e non possibile tagliare di fianco, si fa in fase ribaltata
- Fixed : in BatchProcess (Ts7) corretta restituzione stato feature erroneamente segnalata verde
- Fixed : corretta restituzione stato feature lavorata in doppio
Versione 2.7b3 (03/03/2025)
- Modif : in forature passanti orizzontali fatte da un solo lato, si inverte il lato di lavoro in base all'utensile scelto
- Modif : in LapJoint in lavorazione tipo BH permessa U passante non parallela agli assi principali; attacchi migliorati
- Modif : in LapJoint le feature di coda con pezzo lungo vengono spostate sempre dopo separazione
- Fixed : in macchine tipo Turn piccoli miglioramenti ai tagli di lama
Versione 2.7b2 (05/02/2025)
- Modif : si consentono DrillPocket in doppio solo se foro non passante
Versione 2.7b1 (04/02/2025)
- Modif : in tagli di testa e coda l'utilizzo delle lame grandi (es: 1000 su 15003TMAX) è limitato ai pezzi più bassi di 300 mm e più larghi di 300 mm
Versione 2.7a2 (23/01/2025)
- Added : in RidgeLap aggiunta Q05 per usare la fresa tipo LapJoint
- Fixed : in BatchProcess (Ts7) piccola correzione
- Fixed : in ScarfJoint, in caso di taglio dal lato, aggiunta estensione oltre il bordo
Versione 2.7a1 (21/01/2025)
- Added : in FreeContour aggiunta Q09 per inversione ultima lavorazione
- Modif : in Cut, si taglia dal basso solo se il pezzo piccolo è già staccato dalla barra
- Modif : in BatchProcess (Ts7) aggiunta scrittura id progetto e produzione in Btm
Versione 2.6l2 (07/01/2025)
- Added : in LapJoint abiitata SideMillAsBlade anche da sotto e varie migliorie
- Modif : in LapJoint L030 aggiunto Q03=4 per lavorare con fresa evitando tasche aperte testa/coda
- Modif : in LapJoint modifiche per gestione fresa a disco su aggregato
- Modif : in fresature con lama o simili aggiunta la possibilità di invertire il senso di percorrenza calcolato in automatico
- Modif : migliorie all'ordinamento
- Fixed : in LapJoint la Q per forzare lavorazione di lato funziona solo se la feature è aperta davnti o dietro
Versione 2.6l1 (11/12/2024)
- Added : aggiunta gestione slot e tagli di lama con lame molto grandi
- Modif : in lama + motosega aggiunta gestione slot aperte con lato obliquo
- Modif : modificata retrazione per tenoni aperti
Versione 2.6k2 (28/11/2024)
- Modif : nei tagli migliorati i casi in cui si inverte l'SCC per facilitare la caduta del legno
- Modif : nei tagli migliorato controllo rimozione del primo cubetto molto piccolo
- Modif : nei tagli migliorati i casi con bilinea
- Fixed : in lapjoint corretto un caso in cui si sbagliava a calcolare la dimensione della tasca
Versione 2.6k1 (15/11/2024)
- Modif : in macchine tipo Fast lunghezza minima feature per considerare taglio lungo portata a 400 mm
- Modif : in tacche si applica svuotatura anche nel caso di elevazione non raggiunta
- Modif : in forature in doppio, se necessario, si aumenta lo step per evitare collisione tra le punte durante lavorazione
- Fixed : in L010 correzione in utilizzo Q07 (forzatura frese)
- Fixed : in coda di rondine corretto bug che causava un blocco anomalo del programma
Versione 2.6j4 (06/11/2024)
- Fixed : corretto caso in cui i fori passanti fatti con due teste finiviano nella rotazione sbagliata, provocando un errore di chariot collision
Versione 2.6j3 (18/10/2024)
- Modif : nei tagli orizzontali si inverte SCC per evitare problemi di cubetti incastrati
- Modif : modifiche in ordinamento fori che intersecano tenoni
- Fixed : corretto caso con fori sul tenone spostati in coda nella fase errata
Versione 2.6j2 (17/10/2024)
- Fixed : in forature con precedenza corretto caso in cui il foro veniva ripetuto in rotazioni diverse
Versione 2.6j1 (10/10/2024)
- Modif : se la macchina è tipo BlockHaus, i LapJoint vengono fatti prima del taglio di separazione
- Modif : se tenone di coda è attraversato da foro allora anche il foro sarà di coda
- Modif : migliorato ordinamento per tenoni con foro secante
- Modif : in FreeContour migliorato pinzaggio
- Modif : in LapJoint miglioramenti vari alla lavorazione delle facce oblique
- Modif : In RidgeLap l'ingombro testa coda considera inclinazione feature per pinzaggio
- Added : in FreeContour aggiunta Q08 per forzare come pinzabile l'area della feature e Q07 per ignorare possibili problemi di lettura laser
- Added : in tagli aggiunta Q07 per forzare uso fresa
Versione 2.6i3 (08/10/2024)
- Modif : In RidgeLap, ingombro testa coda considera inclinazione feature per pinzaggio.
Versione 2.6i2 (13/09/2024)
- Modif : in FacesBySaw si invertono gli accorciamenti solo se l'inversione del percorso non è forzata dall'esterno; adeguati HeadCut e Split
- Modif : in nesting correzione in lettura array per cambio dll di lettura
- Modif : in BatchProcess e New, in caso sia richiesta generazione senza check, verifico prima che il file log specifico non contenga errori: se sì, forzo il check
- Modif : in FacesBySaw per settare il FaceUse si usa il versore nelle UserNotes
- Modif : in HeadCut, Split modifiche ai tagli aggiuntivi orizzontali e verticali; disattivati attacchi tangenziali per tagli aggiuntivi verticali in PF1250
- Fixed : in ProcessDrill In GetData corretta gestione modifica diametro foro
Versione 2.6i1 (09/09/2024)
- Added : refactoring e modifiche a HeadCut e Split per introduzione pretagli a zero sul grezzo, per evitare problemi con pezzi non lunghi quanto ci si aspetta
- Added : in Mark, gestita la lavorazione del testo
- Modif : gestione dipendenza foro-tasca in caso di fase con pezzo ribaltato
- Modif : in Headcut e Split aggiunta gestione parametro MIN_HEIGHT_ADDED_CUTS da BeamData per scegliere l'altezza minima per cui devono essere aggiunti i tagli orizzontali supplementari
- Modif : se Lapjoint attraversata da L055, la lapjoint viene fatta prima
- Modif : in ScarfJoint, in dicing, tagli paralleli fatti con unico passaggio di fianco per evitare che il cubetto rimanga appoggiato al motore
- Fixed : corretto caso di groove lunga passante a 3 facce che non veniva lavorata
- Fixed : in FacesBySaw -> MakeOne corretta gestione lato di lavoro quando il percorso è orizzontale
Versione 2.6h2 (26/08/2024)
- Added : in BatchProcess e New si verifica l'abilitazione alla generazione con EgtVerifyKeyOption
- Modif : in FacesBySaw introdotti attacchi tangenziali solo da un lato, limitati a facce con Z negative
- Modif : in LapJoint -> tunnel lo smusso funziona anche se è forzata la sega a catena
- Modif : in LapJoint -> svuotatura, se l'utente ha definito un'elevazione custom si lavora sempre la faccia standard
- Modif : in FacesBySaw -> MakeOne aggiunta la possibilità di passare una direzione di lavoro alternativa per poter rispettare contemporaneamente la direzione di lavoro concorde e la direzione di taglio.
Versione 2.6h1 (20/08/2024)
- Modif : in SimpleScarf, se assimilabile a un taglio, si considera area non pinzabile
- Modif : in LapJoint gestito smusso nel caso Groove-Blind-RightAngles-Parallel-4
- Modif : varie modifiche ai tagli di lama per evitare chiusura rulli pneumatici e finecorsa
- Modif : in BatchProcessNew, se presente flag apposito in EgtCam5, si evita la generazione
Versione 2.6g4 (19/07/2024)
- Modif : in BatchProcess e BatchProcessNew si forza ricalcolo ogni volta che si è in situazione di CHECK o CHECK + GENERATE
Versione 2.6g3 (07/07/2024)
- Added : aggiunta possibilità di funzione GetNzLimDownUp specifica per ogni macchina
- Modif : anche nel taglio a cubetti si chiama GetNzLimDownUp di macchina, se presente, per decidere limite orientamento lama verso il basso
- Modif : in BeamExec inserito controllo massimo numero di facce per lanciare GetFacetsInfo
- Fixed : in LapJoint corretto typo in nome variabile che provocava mancata impostazione asse bloccato
Versione 2.6g2 (04/07/2024)
- Modif : le lavorazioni BlockHaus, se vicine alla coda, vengono spostate dopo il taglio di separazione
Versione 2.6g1 (01/07/2024)
- Modif : in LongDoubleCut gestita correttamente SCC per lama
- Modif : in MachiningLib miglioramenti a scelta testa ottimizzata
- Modif : in ProcessDtTenon correzione in scelta testa
- Modif : In LapJoint -> VerifySideMillAsSaw modificato criterio ricerca utensile in base a normale della faccia
- Fixed : in MakeAntiSplintBySaw se non si trova adiacenza tra le facce si restituisce errore
- Fixed : In StepJointNotch, MakeFourFaces corretta copia feature con PartId mancante
Versione 2.6f2 (17/06/2024)
- Modif : correzione a tagli a cubetti (ripristinata versione pre 2.6f1)
Versione 2.6f1 (06/06/2024)
- Added : Q04 (tipo longcut) abilitato anche in RidgeLap (T30), se riconducibile a 2 facce
- Modif : migliorie al taglio a cubetti
- Modif : in LapJoint -> MakePocket abilitata Q per forzare massima elevazione
- Fixed : correzione a SCC per lama da sotto con aggregato
- Fixed : correzioni a ottimizzazione teste per macchine con teste sopra/sotto
Versione 2.6e5 (27/05/2024)
- Modif : in LapJoint corretto typo in lavorazione lamello che impediva il funzionamento corretto.
Versione 2.6e4 (20/05/2024)
- Modif : in SawPlusChain le lavorazioni di sega a catena aggiuntive (side) si fermano in mezzeria se tasca passante
- Modif : in SawPlusChain il tunnel con sega a catena viene fatto da un solo lato se possibile
Versione 2.6e3 (14/05/2024)
- Modif : in SawPlusChain aggiunta gestione lavorazioni aggiuntive lati aperti e tunnel
- Fixed : in Cut -> MakeFromTop ricalcolo direzione di lavorazione su facce a cubetti.
Versione 2.6e2 (10/05/2024)
- Modif : in FeatureTopology aggiunta proprietà IsTrough = true anche a Cut
- Modif : LongCut : se non trova fresa per pulizia, da messaggio di warning anziché di errore
- Fixed : LongCut : allungamento percorso ingresso per evitare collisioni durante approccio pezzo quando si setta OutRaw.
Versione 2.6e1 (03/05/2024)
- Modif : in LapJoint Groove verso il basso lavorata di preferenza dal lato
- Modif : in LapJoint -> SideMillAsSaw gestito anche rabbet passante
- Fixed : in BeamExec box della feature aggiornato dopo rotazione
- Fixed : in BeamExec GetProcessAffectedFaces e GetFacetsInfo rilanciati dopo rotazione
- Fixed : In LapJoint -> MakeMoreLongFaces corretto calcolo divisione in parti per evitare problemi di ceil con interi perfetti
Versione 2.6d2 (11/04/2024)
- Added : in LapJoint aggiunta strategia per fare tasche con lama + sega a catena, attivata da Q11
Versione 2.6d1 (08/04/2024)
- Fixed : in Long2Cut corretto nome passato alla BL.GetBlockedAxis
- Fixed : in MakeTwo rimossa gestione calcolo differente su ultima passata in caso di macchina FAST
- Fixed : in LapJoint -> ForceSideMill escluso caso 4 facce senza possibilità di ingresso lungo Y.
Versione 2.6c4 (18/03/2024)
- Fixed : correzioni a gestione prefori.
Versione 2.6c3 (15/03/2024)
- Added : Aggiunta gestione prefori
- Fixed : in LapJoint correzione a calcolo ingombro per feature basse e lunghe dalla testa.
Versione 2.6c2 (12/03/2024)
- Added : in Mortase Aggiunta possibilità di inserire lavorazione di smusso
- Added : in FreeContour aggiunto smusso se lav. di svuotatura
- Added : in BeamExec creata funzione calcolo dipendenze tra feature
- Added : In BeamExec -> CollectFeatures si scrive ora Width e Height della faccia sia trimmate con il grezzo che intere
- Added : implementate le lavorazioni in doppio per fori specchiati non passanti e DrillPocket
- Modif : in LapJoint migliorata ricerca pocket (VerifyPocket)
- Modif : implementato attacco esterno se tasca 4 facce sulla coda ma nessun pezzo successivo
- Modif : rimossi simboli di debug da compile
- Fixed : In FreeContour corretto caso di smusso non passante
Versione 2.6c1 (29/02/2024)
- Modif : in FacesBySaw e LapJoint migliorato calcolo area non pinzabile in testa HCING e coda TCING
- Modif : vari miglioramenti all'ordinamento delle lavorazioni
- Modif : in Mortise forzata SPIRAL_IN se c'è almeno un lato aperto
- Modif : in tenone a coda di rondine aumentato a 8 il numero massimo di passate (era 6)
- Modif : in lapjoint a due facce migliorata la scelta della lama da sotto
- Fixed : in LapJoint corretto bug che impediva l'esecuzione della lavorazion con antischeggia attivo
Versione 2.6b1 (14/02/2024)
- Fixed : corretto bug in Split in cui si chiamava la EgtSurfTmFacetNormVersor senza riferimento
- Fixed : in L20 corretta gestione 2 facce
- Modif : modifiche per limiti pinzaggio con pinze con fronte verticale (ONE, PF) anzichè inclinato (FAST) quindi parametro BD.VICE_MINH grande
- Modif : nei tagli con sega a catena ora si considera l'ingombro della testa per il calcolo della massima profondità
- Modif : in LapJoint ora i rabbet lungo X che guardano in basso sono sempre fatti con fresatura di lato per evitare di ruotare.
Versione 2.6a1 (24/01/2024)
- Added : in HeadCut e Split aggiunti tagli verticali addizionali per travi di larghezza elevata
- Added : in Split gestita separazione con sega a catena + lama
- Added : in MachiningLib è ora possibile riordinare le lavorazioni in base a lunghezza e dimensione utensile
- Added : modifiche per poter impostare offset intermedio anche se lanciato da EgtCam5
- Modif : nelle lavorazioni si gestiscono ora seghe a catena multiple
- Modif : in split con sega a catena ora si cerca di preferenza una lavorazione di tipo 'SawingForSplitting'. Se non trovata si cerca il tipo 'Sawing' come in precedenza
- Modif : in split con sega a catena aggiunta estensione start/end del percorso se utensile lungo, per evitare collisioni con il pezzo durante rotazione
- Modif : implementata funzione GetBlockedAxis per gestire l'asse bloccato per sega a catena e lama
- Modif : in DiceCut corretto calcolo cubetti con superficie limitante parallela e opposta a quella di base
Versione 2.5l3 (08/01/2023)
- Modif : modifiche per centrare i pezzi in Y sulla tavola (da flag BeamData.CENTER_BEAM)
- Modif : resi più veloci i calcoli di FeatureTopology
- Modif : migliorato calcolo attacco/uscite lame in FacesBySaw.
Versione 2.5l2 (20/12/2023)
- Modif : in Cut e DoubleCut modifica in scelta ribaltamento trave quando si è in condizioni downUp
- Modif : migliorato e esteso il funzionamento di SideMillAsSaw
- Modif : in LapJoint con più facce, nelle OpenPocket, ammesso utensile con diametro fino a 3 volte la dimensione della tasca (era 2)
- Modif : in RoundArch aggiunta gestione senso di rotazione fresa per lavorare sempre in concordanza
- Fixed : correzione a GetFaceWithMostAdj per calcoli con facce che fanno ombra
Versione 2.5l1 (01/12/2023)
- Added : in LongDoubleCut aggiunta Q05 per utilizzo lama anche in feature cieche conme per LongCut
- Modif : Migliorato e velocizzato il calcolo elevazione (EgtSurfTmFacetElevationInBBox)
- Fixed : in MakeTwo di FacesBySaw raffinamento calcolo vtRef per casi dubbi.
Versione 2.5k3 (28/11/2023)
- Added : in Long2Cut gestite lavorazioni lama con Q05 come in LongCut.
Versione 2.5k2 (06/11/2023)
- Added : in LapJoint, per L020, gestita lavorazione speciale gradino scala con fresatura + lama, attivata con Q09
- Fixed : in ProcessSplit si imposta l'ingombro asse C correttamente anche per teste con asse rotante C con un solo braccio.
Versione 2.5k1 (02/11/2023)
- Modif : in LapJoint gestito caso groove due facce >90° con fresa, se forzato da parametro Q
- Modif : in LongCut e LongDoubleCut migliorata spezzatura taglio passante con due spezzoni
- Modif : nei tagli di lama migliorata gestione con percorso bilinea
- Modif : in LapJoint 2 facce longitudinali si usa taglio di lama solo se si taglia completamente, altrimenti fresa.
Versione 2.5j1 (23/10/2023)
- Added : in Process (lancio da EgtCAM5 quindi uso praticamente solo interno) aggiunta possibilità di tenere ordine pezzi in barra come da selezione
- Modif : in Topology aggiunti casi al check solo direzione principale
- Modif : nella ricerca lavorazione da usare controllo di utensile attivo sostituito con controllo utensile presente nel setup corrente
- Fixed : piccola correzione a Classify di FeatureTopology per casi senza geometria
- Fixed : in HeadCut e Split corretto calcolo allungamenti/accorciamenti per evitare lunghezze del percorso negative
- Fixed : in Lapjoint -> MakePocket aggiunto messaggio in caso si rovini il pezzo successivo.
Versione 2.5i2 (27/09/2023)
- Added : aggiunto riconoscimento sottosquadro da facce non adiacenti
- Modif : in lavorazione tenoni per Turn si assegna SCC per privilegiare accesso dal lato corto della trave.
- Fixed : in LapJoint corretto caso tunnel lungo non lavorato correttamente
- Fixed : in foratura quando errore in applicazione lavorazione si inverte e riprova solo se singola su foro aperto
Versione 2.5i1 (12/09/2023)
- Modif : in Cut abbassato a 590 mm il limite per convertire in LongCut [Ticket #1448]
- Fixed : in LapJoint gestito correttamente il ritorno nil di GetUShapeWidth [Ticket #1354].
Versione 2.5h2 (11/08/2023)
- Modif : in LapJoint e Mortise modificata posizione braccio per FAST quando vicino alla coda della trave
- Fixed : corrette forature con aggregato quando lato aperto
- Fixed : in RidgeLap corretto ingombro lavorazione in testa e coda quando rivolta verso il basso.
Versione 2.5h1 (07/08/2023)
- Fixed : tagli doppi di lato non effettuati se macchina tipo PF e pezzo alto [Ticket #1400]
- Fixed : in split e headcut corretto calcolo allungamenti/accorciamenti pezzi alti per contemplare anche taglio singolo [Ticket #1227]
- Fixed : in lapjoint piccola correzione al calcolo della distanza di sicurezza in base al gambo dell'utensile [Ticket #1227]
- Fixed : in Lapjoint corretto incremento della profondità pari al raggio utensile per tunnel con sega a catena [Ticket #1212]
Versione 2.5g3 (01/08/2023)
- Added : aggiunta gestione tasche chiuse ad orientamento verticale con rinvio angolare [Ticket #1333]
- Modif : in LongCut ammesso uso lama da sotto fino a Norm +3deg in verticale
- Fixed : in Cut correzione calcolo offset per taglio doppio di lato [Ticket #1400].
Versione 2.5g2 (31/07/2023)
- Added : in FreeContour, solo se pocket, aggiunta Q06 per specificare un eventuale offset radiale del contorno [Ticket #1334]
- Added : aggiunta gestione forature verticali con rinvio angolare [Ticket #1332]
- Fixed : corretta gestione antischeggia con lama su LapJoint [Ticket #1351]
- Fixed : in ProfConvex, ProfConcave e ProfHead corretto e semplificato ModifySideInvertLead per invert [Ticket #1330]
- Fixed : corretto il funzionamento delle mortase in doppio [Ticket #1404].
Versione 2.5g1 (05/07/2023)
- Modif : in DiceCut modificata scelta tagli ortogonali quando liberi (esteso caso di verticali ammessi)
- Modif : in LapJoint estesi casi riconoscimento in coda basato su lunghezza
- Fixed : nelle mortase passanti escluso il riconoscimento lati aperti che portava a lavorazioni errate [Ticket #1342]
- Fixed : in LapJoint impedito l'uso del truciolatore se la tasca è chiusa [Ticket #1361]
- Fixed : migliorato controllo fattibilità taglio di fianco con cubetti.
Versione 2.5f4 (21/06/2023)
- Added : aggiunti tagli speciali per evitare il rischio che il cubetto rimanga appoggiato al motore [Ticket #1004, #1214]
- Fixed : corretto attacco speciale in FreeContour [Ticket #1250]
Versione 2.5f3 (16/06/2023)
- Fixed : correzione scelta di approccio lama in casi speciali
- Fixed : correzione a tagli aggiuntivi orizzontali negli split.
Versione 2.5f2 (12/06/2023)
- Fixed : in LapJoint corretto il recupero dati utensile che, in alcune funzioni, puntava all'utensile errato
- Fixed : In BeamLib -> ChangeOrOpenStart corretta ricerca segmento più lungo.
Versione 2.5f1 (08/05/2023)
- Modif : in Process (esecuzione manuale da Cam5) ordinamento travi di lunghezza praticamente uguale dipende da ordine di selezione
- Modif : in LapJoint limiti su svuotature tasche a L 4 facce come per L 3 facce
- Modif : in LapJoint su svuotature aggiunto recupero UserNotes da libreria per MaxOptSize.
- Fixed : in LongDoubleCut corretta scelta SCC (orientamento braccio testa) per macchine TURN nel caso di concavi
Versione 2.5e5 (26/05/2023)
- Modif : riconoscimento fori da sotto anche dalla faccia di ingresso
- Modif : in foratura se TURN aggiunta possibilità di forare da sotto.
- Fixed : correzioni a Profili Concavo e Convesso per TURN
- Fixed : correzione a foratura per ignorare fori annegati nel pezzo
Versione 2.5e4 (23/05/2023)
- Modif : in LongCut migliorato calcolo e verifica affondamento per lavorazione con lama con codolo in mezzo
- Fixed : correzione SCC lama per macchina Turn [Ticket #1258]
Versione 2.5e3 (11/05/2023)
- Modif : in taglio di separazione aggiunta richiesta risalita preliminare a Zmax quando da sopra su macchine PF e ONE
- Fixed : in lavorazioni in doppio correzione riconoscimento per possibile lavorazione in doppio di tasche che si toccano sul fondo
- Fixed : in lavorazioni in doppio con lavorazione precedente differente forzata risalita a Zmax per vitare problemi di riposizionamento [Ticket #1062]
Versione 2.5e2 (04/05/2023)
- Modif : Piccola modifica a SCC per LongCut derivanti da Cut
Versione 2.5e1 (03/05/2023)
- Modif : in TS3v7 tolleranza su quote sezione portata a 0.1 mm
- Fixed : Corretto SCC in caso di asse utensile allineato con Z [Ticket #1232]
Versione 2.5d2 (20/04/2023)
- Added : nei tagli di testa e coda, nel caso di travi alte, aggiunti tagli orizzontali per diminuire la dimensione degli sfridi [Ticket #1175, #1185]
- Modif : unificata gestione lato testa per tagli longitudinali [Ticket #1167].
Versione 2.5d1 (06/04/23)
- Added : in svuotatura aggiunta possibilità di impostare una distanza di sicurezza minima su attacco da lato aperto
- Modif : in split per travi con sezioni molto grandi e materiale inferiore allo spessore lama, miglioramenti volti ad evitare collisioni prevedibili
- Modif : in taglio con lama piccola miglioria nella scelta della direzione di approccio per pezzi corti
- Fixed : in LapJoint correzione al calcolo della distanza di collisione nel caso in cui il gambo sia più piccolo dell'utensile [Ticket #1150]
- Fixed : corretto ordinamento per fori di coda da lasciare in coda
- Fixed : correzione per gestire la lama principale sulla testa secondaria quando questa non è una testa da sotto [Ticket #1161]
- Fixed : modifiche a Split per travi con sezioni molto grandi e materiale inferiore allo spessore lama.
Versione 2.5c8 (30/03/23)
- Modif : nei tenoni (standard e coda di rondine) migliorate e unificate condizioni scelta pretaglio con lama o fresa [Ticket #1131]
- Modif : le mortase a coda di rondine sono ora anticipate a prima dei tagli longitudinali indipendentemente dalla sovrapposizione in Y
- Modif : modificato l'ingombro dei tagli inclinati per macchine con trascinatori tipo PF
- Fixed : nelle mortase a coda di rondine corretto calcolo larghezza della mortasa per derivare numero e step passate [Ticket #1126, #1143]
- Fixed : nei tenoni a coda di rondine corretto calcolo distanza lato da lavorare quando la faccia di base è divisa in più parti.
-6
View File
@@ -1,6 +0,0 @@
-- Version.lua by Egaltech s.r.l. 2026/02/09
-- Gestione della versione di Beam
NAME = 'Beam'
VERSION = '3.1e1'
MIN_EXE = '3.1b1'