Compare commits
200 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6a86f7798e | |||
| 6a6a194df6 | |||
| dcd600af01 | |||
| 854fafddf2 | |||
| ef6cbc35df | |||
| 2887591da4 | |||
| 3d75344652 | |||
| 1952c937b0 | |||
| 99baaa6320 | |||
| 3ac752861b | |||
| d690906180 | |||
| 1bf70aaf27 | |||
| e5a2a7e5a9 | |||
| b726fbc2cc | |||
| 0771665282 | |||
| 6ba42d19e9 | |||
| 374021ad13 | |||
| dfe405f3b0 | |||
| bd7885d245 | |||
| 1c19c48e55 | |||
| 9a40887d05 | |||
| 02e1bc7881 | |||
| 5791bea4b5 | |||
| 5b39d1a4ac | |||
| 62e00e8854 | |||
| 349f0cb879 | |||
| a53a6f3e63 | |||
| 4f2ffec3ab | |||
| b1dd887899 | |||
| b325ebcd32 | |||
| f17411326b | |||
| 4752ffcfb4 | |||
| dbf17d942c | |||
| 72020a8874 | |||
| 5d422b6edc | |||
| d2b3c32b61 | |||
| b4b3df0f5e | |||
| fdd114a8cd | |||
| d5e47c06fa | |||
| abc61f53ba | |||
| 6e7c4ffda1 | |||
| bfaa85bbf2 | |||
| 5c9e199c5a | |||
| 09127ce576 | |||
| 87cd31bef7 | |||
| 32fdaf5096 | |||
| 2ea09e3ebc | |||
| ce8072ad1b | |||
| 896c0296a4 | |||
| 88fd8d525c | |||
| 01c5037d77 | |||
| 34e7befc10 | |||
| 846d96b967 | |||
| cfd3379c98 | |||
| 6f06755539 | |||
| a0af959c9f | |||
| f397b66e26 | |||
| 31782b904e | |||
| 93fe741f84 | |||
| ba2158a909 | |||
| 6e0758218c | |||
| 401108ce56 | |||
| b7973541e4 | |||
| bf1e9065ae | |||
| 1faa9e2075 | |||
| ceef5b78f3 | |||
| 66e2bd6e45 | |||
| 0508f12673 | |||
| 2bbfe1f3ce | |||
| 4a67fdeeff | |||
| 1c86ed925a | |||
| 3f8540b3df | |||
| c92327641c | |||
| 499e49f4f6 | |||
| 099e81cbfd | |||
| 0f38de8f58 | |||
| d5e30baf06 | |||
| 4531434e79 | |||
| e56074f662 | |||
| 5866566ebe | |||
| c4272d917e | |||
| 52a10eeb9f | |||
| 1d5689c007 | |||
| f402590534 | |||
| b3289195f4 | |||
| f0a07554b2 | |||
| 1ed45a8569 | |||
| 43482f5a6d | |||
| e66831d223 | |||
| 548bc7bc6c | |||
| 3f7a2c016d | |||
| 3763338bb3 | |||
| 767acf2579 | |||
| 4da70c0d3c | |||
| d939e07fd3 | |||
| 67bf77fe19 | |||
| 384d72eb13 | |||
| 22541cfc9b | |||
| 1dac9716e7 | |||
| 68464cf5b1 | |||
| 78bf456326 | |||
| cb4d597369 | |||
| 7bcd159db0 | |||
| abed970b7a | |||
| 96760ac284 | |||
| 392040f8d6 | |||
| 56dc61a9d6 | |||
| ea5e62222c | |||
| 3b098e1541 | |||
| 354cbe85b9 | |||
| 25779abb81 | |||
| 1a4baaf1be | |||
| 20fccb24af | |||
| aa94102b28 | |||
| a2d89cd98d | |||
| 6e2e976675 | |||
| db5ae17d63 | |||
| 3e9da2724b | |||
| a1946a4a41 | |||
| 87cb7480be | |||
| 9563735770 | |||
| d1218915f7 | |||
| 19c7a54aa7 | |||
| 7bbed3cb8a | |||
| 25f599a1fa | |||
| c0970c52ff | |||
| 61590f611d | |||
| f8011493f2 | |||
| a76bd31fe4 | |||
| 07a80248dc | |||
| 89838c6f28 | |||
| 764c80824a | |||
| 37da3ba714 | |||
| a1a74390c0 | |||
| c04e97a01d | |||
| 111c541f8b | |||
| 760563e0f8 | |||
| 15c80a8628 | |||
| 29a2ec8bae | |||
| e1d58a1d70 | |||
| da7d2a7159 | |||
| d1ca35e29d | |||
| e92ba3e740 | |||
| a84fb0608f | |||
| f9bb10bf6e | |||
| fea5cfd8ed | |||
| 31172238d8 | |||
| f29816c693 | |||
| 164e0474fa | |||
| 732e6c0390 | |||
| 5340c6a92c | |||
| 9edd6aec23 | |||
| 7c67b24b37 | |||
| 64ca535056 | |||
| 3b998e5fba | |||
| 47ec893959 | |||
| 79e97c9e1f | |||
| 18ae1a71cc | |||
| 007288b9c9 | |||
| efc9a89bf5 | |||
| eca052bd67 | |||
| 8b999fad88 | |||
| 11b6a8716e | |||
| 4bcf2c8068 | |||
| 93f9df0d5f | |||
| 9f014c70f7 | |||
| b2fdd27130 | |||
| 6a2a87b91f | |||
| 61e5ce6359 | |||
| fa276949a2 | |||
| d24a86bcdd | |||
| 5524fbf0cb | |||
| afb33aa7c6 | |||
| 924313a0ea | |||
| 9d812ab33a | |||
| 3c7c22ae7c | |||
| b9c9cc5167 | |||
| 756d58b3e4 | |||
| 4a5c213de6 | |||
| d0cecd6a0d | |||
| 3326f8ef4e | |||
| 5e6dfe320f | |||
| a4c3b74434 | |||
| 46a299b83d | |||
| e6bd4e7e94 | |||
| 5ff950015e | |||
| 57ed0d934f | |||
| 5b5ce504b1 | |||
| f2027d03a3 | |||
| 5ee62cfee2 | |||
| 3ca0ab1692 | |||
| 51e1425921 | |||
| b0abe6d088 | |||
| be49385bb0 | |||
| 4e079f6708 | |||
| 6550ddd456 | |||
| 68ad658bc5 | |||
| 5bb7fdd634 | |||
| 30c449bfad | |||
| 1236d196ba |
@@ -20,3 +20,4 @@
|
|||||||
/bin/LuaLibs/*.lua
|
/bin/LuaLibs/*.lua
|
||||||
/bin/Images/*.png
|
/bin/Images/*.png
|
||||||
.vscode/settings.json
|
.vscode/settings.json
|
||||||
|
bin/Images/.placeholder
|
||||||
|
|||||||
+4
-4
@@ -24,14 +24,14 @@ variables:
|
|||||||
$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 $FileName
|
lua54 -o bin\$FileName -s $FileName
|
||||||
echo "lua54 -o bin\$FileName $FileName"
|
echo "lua54 -o bin\$FileName -s $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 LuaLibs\$FileName
|
lua54 -o bin\LuaLibs\$FileName -s LuaLibs\$FileName
|
||||||
echo "lua54 -o bin\LuaLibs\$FileName LuaLibs\$FileName"
|
echo "lua54 -o bin\LuaLibs\$FileName -s LuaLibs\$FileName"
|
||||||
}
|
}
|
||||||
|
|
||||||
# helper copia SORGENTI verso cartella di rete X:\ dei SORGENTI
|
# helper copia SORGENTI verso cartella di rete X:\ dei SORGENTI
|
||||||
|
|||||||
+19
-4
@@ -14,6 +14,7 @@
|
|||||||
-- 2022/05/02 Consentito allargamento area disponibile per grezzi su tavola da WallData.
|
-- 2022/05/02 Consentito allargamento area disponibile per grezzi su tavola da WallData.
|
||||||
-- 2023/04/09 Aggiunta gestione flag per taglio feature con outline (da WD.CUT_WITH_OUTLINE).
|
-- 2023/04/09 Aggiunta gestione flag per taglio feature con outline (da WD.CUT_WITH_OUTLINE).
|
||||||
-- 2023/04/17 Aggiunta gestione flag per rotazione grezzo di 180deg (da WD.RAWPART_ROT).
|
-- 2023/04/17 Aggiunta gestione flag per rotazione grezzo di 180deg (da WD.RAWPART_ROT).
|
||||||
|
-- 2024/02/20 Tolleranza su altezza pannello in grezzo portata a 0.1 mm.
|
||||||
|
|
||||||
-- Intestazioni
|
-- Intestazioni
|
||||||
require( 'EgtBase')
|
require( 'EgtBase')
|
||||||
@@ -232,6 +233,9 @@ if bToProcess then
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
dExtraW = 10
|
dExtraW = 10
|
||||||
|
if WD.DEFAULT_RAW_NO_EXTRA_WIDTH then
|
||||||
|
dExtraW = 0
|
||||||
|
end
|
||||||
dRawW = dRawW + dExtraW
|
dRawW = dRawW + dExtraW
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -276,6 +280,11 @@ if bToProcess then
|
|||||||
-- Ne recupero la posizione
|
-- Ne recupero la posizione
|
||||||
for i = 1, #vWall do
|
for i = 1, #vWall do
|
||||||
local PosX = EgtGetInfo( vWall[i].Id, 'POSX', 'd')
|
local PosX = EgtGetInfo( vWall[i].Id, 'POSX', 'd')
|
||||||
|
local PosZ = EgtGetInfo( vWall[i].Id, 'POSZ', 'd')
|
||||||
|
if bProj and WD.DEFAULT_RAW_NO_EXTRA_WIDTH and #vWall == 1 then
|
||||||
|
PosX = 0
|
||||||
|
PosZ = 0
|
||||||
|
end
|
||||||
vWall[i].PosX = PosX + min( dExtraL, 1200)
|
vWall[i].PosX = PosX + min( dExtraL, 1200)
|
||||||
if WD.USE_POSY then
|
if WD.USE_POSY then
|
||||||
local PosY = EgtGetInfo( vWall[i].Id, 'POSY', 'd')
|
local PosY = EgtGetInfo( vWall[i].Id, 'POSY', 'd')
|
||||||
@@ -283,7 +292,6 @@ if bToProcess then
|
|||||||
else
|
else
|
||||||
vWall[i].PosY = 0
|
vWall[i].PosY = 0
|
||||||
end
|
end
|
||||||
local PosZ = EgtGetInfo( vWall[i].Id, 'POSZ', 'd')
|
|
||||||
vWall[i].PosZ = PosZ + dExtraW / 2
|
vWall[i].PosZ = PosZ + dExtraW / 2
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -348,7 +356,7 @@ if bToProcess then
|
|||||||
local vWallErr = {}
|
local vWallErr = {}
|
||||||
for i = 2, #vWall do
|
for i = 2, #vWall do
|
||||||
local dDimH = vWall[i].Box:getDimZ() + vWall[i].PosY
|
local dDimH = vWall[i].Box:getDimZ() + vWall[i].PosY
|
||||||
if abs( dDimH - dRawH) > 10 * GEO.EPS_SMALL then
|
if abs( dDimH - dRawH) > 100 * GEO.EPS_SMALL then
|
||||||
table.insert( vWallErr, i)
|
table.insert( vWallErr, i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -364,6 +372,12 @@ if bToProcess then
|
|||||||
PostErrView( WALL.ERR, WALL.MSG)
|
PostErrView( WALL.ERR, WALL.MSG)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- se impostato flag apposito, in vista il grezzo è uguale al pezzo
|
||||||
|
if bProj and WD.DEFAULT_RAW_NO_EXTRA_WIDTH and #vWall == 1 then
|
||||||
|
dRawL = vWall[1].Box:getDimX()
|
||||||
|
dRawW = vWall[1].Box:getDimY()
|
||||||
|
end
|
||||||
|
|
||||||
-- Verifico dimensioni massime grezzo
|
-- Verifico dimensioni massime grezzo
|
||||||
if dRawL > WD.MAX_LENGTH + 10 * GEO.EPS_SMALL or dRawW > WD.MAX_WIDTH + 10 * GEO.EPS_SMALL or dRawH > WD.MAX_HEIGHT + 10 * GEO.EPS_SMALL then
|
if dRawL > WD.MAX_LENGTH + 10 * GEO.EPS_SMALL or dRawW > WD.MAX_WIDTH + 10 * GEO.EPS_SMALL or dRawH > WD.MAX_HEIGHT + 10 * GEO.EPS_SMALL then
|
||||||
@@ -497,7 +511,7 @@ else
|
|||||||
-- Passo in modalità lavora
|
-- Passo in modalità lavora
|
||||||
EgtSetCurrMachGroup( EgtGetLastMachGroup())
|
EgtSetCurrMachGroup( EgtGetLastMachGroup())
|
||||||
-- Se necessario eseguo aggiornamento con ricalcolo delle lavorazioni
|
-- Se necessario eseguo aggiornamento con ricalcolo delle lavorazioni
|
||||||
if bToRecalc then
|
if bToRecalc or WALL.FLAG == 3 or WALL.FLAG == 4 then
|
||||||
EgtOutLog( ' +++ Recalculating all dispositions and machinings >>>')
|
EgtOutLog( ' +++ Recalculating all dispositions and machinings >>>')
|
||||||
EgtImportSetup()
|
EgtImportSetup()
|
||||||
EgtApplyAllMachinings()
|
EgtApplyAllMachinings()
|
||||||
@@ -561,7 +575,8 @@ if ( WALL.FLAG == 0 and ( bToProcess or bToRecalc)) or WALL.FLAG == 3 or WALL.F
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- *** Genero programma CN *** ( se richiesto)
|
-- *** Genero programma CN *** ( se richiesto)
|
||||||
if WALL.FLAG == 0 or WALL.FLAG == 4 then
|
local bIsGenerationEnabled = ( EgtVerifyKeyOption( 110) == false)
|
||||||
|
if bIsGenerationEnabled and ( WALL.FLAG == 0 or WALL.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
-6
@@ -275,11 +275,15 @@ if bToProcess then
|
|||||||
dMinY = ( WD.MINRAWY_HOR_DRILL or 2800)
|
dMinY = ( WD.MINRAWY_HOR_DRILL or 2800)
|
||||||
end
|
end
|
||||||
-- Assegno dimensioni del pannello
|
-- Assegno dimensioni del pannello
|
||||||
dPanelLen = vWall[1].Box:getDimX() + 20
|
local dExtraW = 10
|
||||||
dPanelWidth = math.max( vWall[1].Box:getDimY() + 20, dMinY)
|
if WD.DEFAULT_RAW_NO_EXTRA_WIDTH then
|
||||||
|
dExtraW = 0
|
||||||
|
end
|
||||||
|
dPanelLen = vWall[1].Box:getDimX() + 2 * dExtraW
|
||||||
|
dPanelWidth = math.max( vWall[1].Box:getDimY() + 2 * dExtraW, dMinY)
|
||||||
-- Assegno posizione prima ed unica parete
|
-- Assegno posizione prima ed unica parete
|
||||||
vWall[1].PosX = 10
|
vWall[1].PosX = dExtraW
|
||||||
vWall[1].PosZ = 10
|
vWall[1].PosZ = dExtraW
|
||||||
vWall[1].Rot = 0
|
vWall[1].Rot = 0
|
||||||
vWall[1].Flip = 0
|
vWall[1].Flip = 0
|
||||||
end
|
end
|
||||||
@@ -545,7 +549,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 then
|
if bToRecalc or WALL.FLAG == 3 or WALL.FLAG == 4 then
|
||||||
EgtOutLog( ' +++ Recalculating all dispositions and machinings >>>')
|
EgtOutLog( ' +++ Recalculating all dispositions and machinings >>>')
|
||||||
EgtImportSetup()
|
EgtImportSetup()
|
||||||
EgtApplyAllMachinings()
|
EgtApplyAllMachinings()
|
||||||
@@ -609,7 +613,8 @@ if ( WALL.FLAG == 0 and ( bToProcess or bToRecalc)) or WALL.FLAG == 3 or WALL.F
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- *** Genero programma CN *** ( se richiesto)
|
-- *** Genero programma CN *** ( se richiesto)
|
||||||
if WALL.FLAG == 0 or WALL.FLAG == 4 then
|
local bIsGenerationEnabled = ( EgtVerifyKeyOption( 110) == false)
|
||||||
|
if bIsGenerationEnabled and ( WALL.FLAG == 0 or WALL.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
|
||||||
|
|||||||
+26
-25
@@ -1,30 +1,31 @@
|
|||||||
|
|
||||||
REM Compilazione degli script Wall Egaltech 2023.09.26
|
REM Compilazione degli script Wall Egaltech 2024.03.24
|
||||||
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 e 64 bit
|
||||||
|
|
||||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WallExec.lua LuaLibs\WallExec.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\Squaring.lua -s LuaLibs\Squaring.lua
|
||||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WallLib.lua LuaLibs\WallLib.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WallExec.lua -s LuaLibs\WallExec.lua
|
||||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WMachiningLib.lua LuaLibs\WMachiningLib.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WallLib.lua -s LuaLibs\WallLib.lua
|
||||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WProcessCut.lua LuaLibs\WProcessCut.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WMachiningLib.lua -s LuaLibs\WMachiningLib.lua
|
||||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WProcessDoubleCut.lua LuaLibs\WProcessDoubleCut.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WProcessCut.lua -s LuaLibs\WProcessCut.lua
|
||||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WProcessDrill.lua LuaLibs\WProcessDrill.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WProcessDoubleCut.lua -s LuaLibs\WProcessDoubleCut.lua
|
||||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WProcessDtMortise.lua LuaLibs\WProcessDtMortise.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WProcessDrill.lua -s LuaLibs\WProcessDrill.lua
|
||||||
REM \EgtProg\Dll32\luac54 -o bin\LuaLibs\WFeatureTopology.lua LuaLibs\WFeatureTopology.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WProcessDtMortise.lua -s LuaLibs\WProcessDtMortise.lua
|
||||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WProcessFreeContour.lua LuaLibs\WProcessFreeContour.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WFeatureTopology.lua -s LuaLibs\WFeatureTopology.lua
|
||||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WProcessLapJoint.lua LuaLibs\WProcessLapJoint.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WProcessFreeContour.lua -s LuaLibs\WProcessFreeContour.lua
|
||||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WProcessMark.lua LuaLibs\WProcessMark.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WProcessLapJoint.lua -s LuaLibs\WProcessLapJoint.lua
|
||||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WProcessMortise.lua LuaLibs\WProcessMortise.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WProcessMark.lua -s LuaLibs\WProcessMark.lua
|
||||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WProcessSawCut.lua LuaLibs\WProcessSawCut.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WProcessMortise.lua -s LuaLibs\WProcessMortise.lua
|
||||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WProcessText.lua LuaLibs\WProcessText.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WProcessSawCut.lua -s LuaLibs\WProcessSawCut.lua
|
||||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WProcessVariant.lua LuaLibs\WProcessVariant.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WProcessText.lua -s LuaLibs\WProcessText.lua
|
||||||
\EgtProg\Dll32\luac54 -o bin\BatchProcess.lua BatchProcess.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WProcessVariant.lua -s LuaLibs\WProcessVariant.lua
|
||||||
\EgtProg\Dll32\luac54 -o bin\BatchProcessNew.lua BatchProcessNew.lua
|
\EgtProg\Dll32\luac54 -o bin\BatchProcess.lua -s BatchProcess.lua
|
||||||
\EgtProg\Dll32\luac54 -o bin\GetWallData.lua GetWallData.lua
|
\EgtProg\Dll32\luac54 -o bin\BatchProcessNew.lua -s BatchProcessNew.lua
|
||||||
\EgtProg\Dll32\luac54 -o bin\NestFlipAndRotate.lua NestFlipAndRotate.lua
|
\EgtProg\Dll32\luac54 -o bin\GetWallData.lua -s GetWallData.lua
|
||||||
\EgtProg\Dll32\luac54 -o bin\NestProcess.lua NestProcess.lua
|
\EgtProg\Dll32\luac54 -o bin\NestFlipAndRotate.lua -s NestFlipAndRotate.lua
|
||||||
\EgtProg\Dll32\luac54 -o bin\Overturn.lua Overturn.lua
|
\EgtProg\Dll32\luac54 -o bin\NestProcess.lua -s NestProcess.lua
|
||||||
\EgtProg\Dll32\luac54 -o bin\Process.lua Process.lua
|
\EgtProg\Dll32\luac54 -o bin\Overturn.lua -s Overturn.lua
|
||||||
\EgtProg\Dll32\luac54 -o bin\Rotate.lua Rotate.lua
|
\EgtProg\Dll32\luac54 -o bin\Process.lua -s Process.lua
|
||||||
\EgtProg\Dll32\luac54 -o bin\Version.lua Version.lua
|
\EgtProg\Dll32\luac54 -o bin\Rotate.lua -s Rotate.lua
|
||||||
|
\EgtProg\Dll32\luac54 -o bin\Version.lua -s Version.lua
|
||||||
|
|||||||
@@ -0,0 +1,491 @@
|
|||||||
|
-- Squaring.lua by Egaltech s.r.l. 2024/10/15
|
||||||
|
-- Libreria squadratura pareti
|
||||||
|
|
||||||
|
-- Tabella per definizione modulo
|
||||||
|
local Squaring = {}
|
||||||
|
|
||||||
|
-- Include
|
||||||
|
require( 'EgtBase')
|
||||||
|
|
||||||
|
EgtOutLog( ' Squaring started', 1)
|
||||||
|
|
||||||
|
-- Dati
|
||||||
|
local WD = require( 'WallData')
|
||||||
|
local WM = require( 'WMachiningLib')
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
local function IsToolOk( Tool, dRawPartHeight)
|
||||||
|
local bIsToolOk = false
|
||||||
|
local bToolExists = false
|
||||||
|
local bToolCanReachDepth = false
|
||||||
|
local dMaxOvermaterial = 0
|
||||||
|
if type( WD.SQUARING_MAX_OVERMATERIAL) == "number" then
|
||||||
|
dMaxOvermaterial = WD.SQUARING_MAX_OVERMATERIAL
|
||||||
|
end
|
||||||
|
|
||||||
|
bToolExists = ( next( Tool) ~= nil)
|
||||||
|
if bToolExists then
|
||||||
|
if Tool.nType == MCH_TY.MILL_NOTIP then
|
||||||
|
bToolCanReachDepth = ( Tool.dThickness > dMaxOvermaterial - 10 * GEO.EPS_SMALL)
|
||||||
|
and ( Tool.dSideDepth > dRawPartHeight - 10 * GEO.EPS_SMALL)
|
||||||
|
else
|
||||||
|
bToolCanReachDepth = Tool.dMaxDepth > dRawPartHeight - 10 * GEO.EPS_SMALL
|
||||||
|
end
|
||||||
|
end
|
||||||
|
bIsToolOk = bToolExists and bToolCanReachDepth
|
||||||
|
|
||||||
|
return bIsToolOk
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
function Squaring.GetTools()
|
||||||
|
-- TODO vedere se questo valore è coerente sulle diverse macchine
|
||||||
|
local dHeadEncumberance = 130
|
||||||
|
|
||||||
|
local Tool = {}
|
||||||
|
local SquaringTools = {}
|
||||||
|
SquaringTools.Blade = {}
|
||||||
|
SquaringTools.Diskmill = {}
|
||||||
|
SquaringTools.Mill = {}
|
||||||
|
SquaringTools.Blade.H1 = {}
|
||||||
|
SquaringTools.Blade.H2 = {}
|
||||||
|
SquaringTools.Blade.H7 = {}
|
||||||
|
SquaringTools.Diskmill.H1 = {}
|
||||||
|
SquaringTools.Diskmill.H7 = {}
|
||||||
|
SquaringTools.Mill.H1 = {}
|
||||||
|
SquaringTools.Mill.H7 = {}
|
||||||
|
|
||||||
|
Tool.sName = EgtTdbGetFirstTool( MCH_TF.SAWBLADE + MCH_TF.MILL + MCH_TF.MORTISE)
|
||||||
|
while Tool.sName ~= '' do
|
||||||
|
EgtTdbSetCurrTool( Tool.sName)
|
||||||
|
local bIsToolLoadedOnSetup = EgtFindToolInCurrSetup( Tool.sName)
|
||||||
|
local bIsSquaringTool = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SQUARING', 'b') or false
|
||||||
|
|
||||||
|
Tool.nType = EgtTdbGetCurrToolParam( MCH_TP.TYPE)
|
||||||
|
Tool.dDiameter = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
|
||||||
|
Tool.dMaxMaterial = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
|
||||||
|
Tool.dThickness = EgtIf( ( Tool.nType == MCH_TY.SAW_FLAT or Tool.nType == MCH_TY.SAW_STD), EgtTdbGetCurrToolParam( MCH_TP.THICK), Tool.dMaxMaterial)
|
||||||
|
Tool.dMaxDepth = EgtTdbGetCurrToolMaxDepth() or Tool.dMaxMaterial
|
||||||
|
Tool.sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
|
||||||
|
Tool.bIsCcw = EgtTdbGetCurrToolParam( MCH_TP.SPEED) < 0
|
||||||
|
Tool.dFeed = EgtTdbGetCurrToolParam( MCH_TP.FEED)
|
||||||
|
Tool.dStartFeed = EgtTdbGetCurrToolParam( MCH_TP.STARTFEED)
|
||||||
|
Tool.dEndFeed = EgtTdbGetCurrToolParam( MCH_TP.ENDFEED)
|
||||||
|
Tool.dTipFeed = EgtTdbGetCurrToolParam( MCH_TP.TIPFEED)
|
||||||
|
Tool.dMinFeed = EgtTdbGetCurrToolParam( MCH_TP.MINFEED)
|
||||||
|
Tool.dStep = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'STEP', 'd') or EgtIf( ( Tool.nType == MCH_TY.SAW_FLAT or Tool.nType == MCH_TY.SAW_STD), ( Tool.dDiameter / 3), ( Tool.dMaxMaterial / 3))
|
||||||
|
Tool.dSideStep = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDESTEP', 'd') or ( Tool.dDiameter / 3)
|
||||||
|
Tool.dSideDepth = Tool.dDiameter / 2 - dHeadEncumberance
|
||||||
|
|
||||||
|
if bIsToolLoadedOnSetup and Tool.nType and bIsSquaringTool then
|
||||||
|
-- lame
|
||||||
|
if Tool.nType == MCH_TY.SAW_FLAT or Tool.nType == MCH_TY.SAW_STD then
|
||||||
|
SquaringTools.Blade[Tool.sHead] = Tool
|
||||||
|
Tool.bIsPathCw = Tool.bIsCcw
|
||||||
|
Tool.dSideStep = Tool.dStep
|
||||||
|
Tool.dStep = Tool.dThickness
|
||||||
|
-- frese standard
|
||||||
|
elseif Tool.nType == MCH_TY.MILL_STD then
|
||||||
|
SquaringTools.Mill[Tool.sHead] = Tool
|
||||||
|
Tool.bIsPathCw = not Tool.bIsCcw
|
||||||
|
-- truciolatori
|
||||||
|
elseif Tool.nType == MCH_TY.MILL_NOTIP then
|
||||||
|
SquaringTools.Diskmill[Tool.sHead] = Tool
|
||||||
|
Tool.bIsPathCw = Tool.bIsCcw
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Tool = {}
|
||||||
|
Tool.sName = EgtTdbGetNextTool( MCH_TF.SAWBLADE + MCH_TF.MILL + MCH_TF.MORTISE)
|
||||||
|
end
|
||||||
|
|
||||||
|
return SquaringTools
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
function Squaring.AreToolsOk( sSquaringTool, SquaringTools, dRawPartHeight)
|
||||||
|
local bAreToolsOk = false
|
||||||
|
|
||||||
|
if sSquaringTool == 'DoubleDiskmill' then
|
||||||
|
bAreToolsOk = ( IsToolOk( SquaringTools.Blade.H2, dRawPartHeight)
|
||||||
|
and IsToolOk( SquaringTools.Diskmill.H1, dRawPartHeight)
|
||||||
|
and IsToolOk( SquaringTools.Diskmill.H7, dRawPartHeight))
|
||||||
|
elseif sSquaringTool == 'DoubleDiskmillAndBlade' then
|
||||||
|
bAreToolsOk = ( IsToolOk( SquaringTools.Blade.H2, dRawPartHeight)
|
||||||
|
and ( IsToolOk( SquaringTools.Diskmill.H1, dRawPartHeight) or IsToolOk( SquaringTools.Diskmill.H7, dRawPartHeight)))
|
||||||
|
elseif sSquaringTool == 'DoubleBlade' then
|
||||||
|
bAreToolsOk = ( IsToolOk( SquaringTools.Blade.H2, dRawPartHeight)
|
||||||
|
and ( IsToolOk( SquaringTools.Blade.H1, dRawPartHeight) or IsToolOk( SquaringTools.Blade.H7, dRawPartHeight)))
|
||||||
|
elseif sSquaringTool == 'Diskmill' then
|
||||||
|
bAreToolsOk = IsToolOk( SquaringTools.Diskmill.H1, dRawPartHeight) or IsToolOk( SquaringTools.Diskmill.H7, dRawPartHeight)
|
||||||
|
elseif sSquaringTool == 'Blade' then
|
||||||
|
bAreToolsOk = IsToolOk( SquaringTools.Blade.H2, dRawPartHeight)
|
||||||
|
elseif sSquaringTool == 'DoubleMill' then
|
||||||
|
bAreToolsOk = IsToolOk( SquaringTools.Mill.H1, dRawPartHeight) and IsToolOk( SquaringTools.Mill.H7, dRawPartHeight)
|
||||||
|
elseif sSquaringTool == 'Mill' then
|
||||||
|
bAreToolsOk = IsToolOk( SquaringTools.Mill.H1, dRawPartHeight) or IsToolOk( SquaringTools.Mill.H7, dRawPartHeight)
|
||||||
|
else
|
||||||
|
error( 'Squaring Tool not recognized')
|
||||||
|
end
|
||||||
|
|
||||||
|
return bAreToolsOk
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
function Squaring.CalculateParameters( sSquaringTool, SquaringTools, RawPart, vPart)
|
||||||
|
local SquaringParameters = {}
|
||||||
|
local sOrigCorner = EgtGetInfo( RawPart.nId, 'ORIGCORNER')
|
||||||
|
local bShrinkToParts = ( WD.SQUARING_TYPE == 2)
|
||||||
|
local bSquaringStartsOnReference = ( type( WD.SQUARING_STARTS_ON_REFERENCE) == "boolean") and ( WD.SQUARING_STARTS_ON_REFERENCE == true)
|
||||||
|
local dOffsetXY = 0
|
||||||
|
local dExtendZ = 0
|
||||||
|
if type( WD.SQUARING_OFFSET_XY) == "number" and ( WD.SQUARING_TYPE < 2) then
|
||||||
|
dOffsetXY = WD.SQUARING_OFFSET_XY
|
||||||
|
end
|
||||||
|
if type( WD.SQUARING_EXTEND_Z) == "number" then
|
||||||
|
dExtendZ = WD.SQUARING_EXTEND_Z
|
||||||
|
end
|
||||||
|
|
||||||
|
local Front = { sSide = 'Front'}
|
||||||
|
local Right = { sSide = 'Right'}
|
||||||
|
local Back = { sSide = 'Back'}
|
||||||
|
local Left = { sSide = 'Left'}
|
||||||
|
local b3Squaring = BBox3d( RawPart.b3)
|
||||||
|
-- se squadratura sui pezzi invece che sul master panel, si costruisce il box minimo che contiene tutti i pezzi
|
||||||
|
if bShrinkToParts then
|
||||||
|
b3Squaring = BBox3d( vPart[1].Box:getCenter())
|
||||||
|
for i = 1, #vPart do
|
||||||
|
b3Squaring:Add( vPart[i].Box)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local dDimX = b3Squaring:getDimX()
|
||||||
|
local dDimY = b3Squaring:getDimY()
|
||||||
|
local pt1 = b3Squaring:getMin() + Point3d( -dOffsetXY, -dOffsetXY, -dExtendZ)
|
||||||
|
local pt2 = pt1 + Point3d( dDimX + 2 * dOffsetXY, 0, 0)
|
||||||
|
local pt3 = pt2 + Point3d( 0, dDimY + 2 * dOffsetXY,0 )
|
||||||
|
local pt4 = pt3 + Point3d( -dDimX - 2 * dOffsetXY, 0, 0)
|
||||||
|
b3Squaring:Add( pt1)
|
||||||
|
b3Squaring:Add( pt2)
|
||||||
|
b3Squaring:Add( pt3)
|
||||||
|
b3Squaring:Add( pt4)
|
||||||
|
Front.nId = EgtLine( RawPart.nId, pt1, pt2, GDB_RT.GLOB)
|
||||||
|
Right.nId = EgtLine( RawPart.nId, pt2, pt3, GDB_RT.GLOB)
|
||||||
|
Back.nId = EgtLine( RawPart.nId, pt3, pt4, GDB_RT.GLOB)
|
||||||
|
Left.nId = EgtLine( RawPart.nId, pt4, pt1, GDB_RT.GLOB)
|
||||||
|
if not ( sSquaringTool == 'DoubleMill') and not ( sSquaringTool == 'Mill') then
|
||||||
|
EgtModifyCurveExtrusion( Front.nId, -Y_AX(), GDB_RT.GLOB)
|
||||||
|
EgtModifyCurveExtrusion( Right.nId, X_AX(), GDB_RT.GLOB)
|
||||||
|
EgtModifyCurveExtrusion( Back.nId, Y_AX(), GDB_RT.GLOB)
|
||||||
|
EgtModifyCurveExtrusion( Left.nId, -X_AX(), GDB_RT.GLOB)
|
||||||
|
end
|
||||||
|
EgtSetName( Front.nId, 'SquaringGeometry')
|
||||||
|
EgtSetName( Right.nId, 'SquaringGeometry')
|
||||||
|
EgtSetName( Back.nId, 'SquaringGeometry')
|
||||||
|
EgtSetName( Left.nId, 'SquaringGeometry')
|
||||||
|
|
||||||
|
-- in base al caso si assegna l'utensile al lato
|
||||||
|
if sSquaringTool == 'DoubleDiskmill' then
|
||||||
|
Left.Tool = SquaringTools.Diskmill.H1
|
||||||
|
Right.Tool = SquaringTools.Blade.H2
|
||||||
|
Front.Tool = SquaringTools.Diskmill.H1
|
||||||
|
Front.ToolDouble = SquaringTools.Diskmill.H7
|
||||||
|
Front.sSide = 'Front+Back'
|
||||||
|
elseif sSquaringTool == 'DoubleDiskmillAndBlade' then
|
||||||
|
Left.Tool = SquaringTools.Diskmill.H1 or SquaringTools.Diskmill.H7
|
||||||
|
Right.Tool = SquaringTools.Blade.H2
|
||||||
|
Front.Tool = SquaringTools.Blade.H2
|
||||||
|
Front.ToolDouble = SquaringTools.Diskmill.H1 or SquaringTools.Diskmill.H7
|
||||||
|
Front.sSide = 'Front+Back'
|
||||||
|
elseif sSquaringTool == 'DoubleBlade' then
|
||||||
|
Left.Tool = SquaringTools.Blade.H2
|
||||||
|
Right.Tool = SquaringTools.Blade.H2
|
||||||
|
Front.Tool = SquaringTools.Blade.H2
|
||||||
|
Front.ToolDouble = SquaringTools.Blade.H1 or SquaringTools.Blade.H7
|
||||||
|
Front.sSide = 'Front+Back'
|
||||||
|
elseif sSquaringTool == 'Diskmill' then
|
||||||
|
Left.Tool = SquaringTools.Diskmill.H1 or SquaringTools.Diskmill.H7
|
||||||
|
Back.Tool = SquaringTools.Diskmill.H1 or SquaringTools.Diskmill.H7
|
||||||
|
Right.Tool = SquaringTools.Blade.H2
|
||||||
|
Front.Tool = SquaringTools.Diskmill.H1 or SquaringTools.Diskmill.H7
|
||||||
|
elseif sSquaringTool == 'Blade' then
|
||||||
|
Left.Tool = SquaringTools.Blade.H2
|
||||||
|
Back.Tool = SquaringTools.Blade.H2
|
||||||
|
Right.Tool = SquaringTools.Blade.H2
|
||||||
|
Front.Tool = SquaringTools.Blade.H2
|
||||||
|
elseif sSquaringTool == 'DoubleMill' then
|
||||||
|
Left.Tool = SquaringTools.Mill.H1
|
||||||
|
Right.Tool = SquaringTools.Mill.H1
|
||||||
|
Front.Tool = SquaringTools.Mill.H1
|
||||||
|
Front.ToolDouble = SquaringTools.Mill.H7
|
||||||
|
Front.sSide = 'Front+Back'
|
||||||
|
elseif sSquaringTool == 'Mill' then
|
||||||
|
Left.Tool = SquaringTools.Mill.H1 or SquaringTools.Mill.H7
|
||||||
|
Back.Tool = SquaringTools.Mill.H1 or SquaringTools.Mill.H7
|
||||||
|
Right.Tool = SquaringTools.Mill.H1 or SquaringTools.Mill.H7
|
||||||
|
Front.Tool = SquaringTools.Mill.H1 or SquaringTools.Mill.H7
|
||||||
|
end
|
||||||
|
|
||||||
|
-- l'ordinamento delle linee dipende dal verso di percorrenza e, se attivato, dal riferimento utilizzato
|
||||||
|
-- con doppio l'ordine cambia
|
||||||
|
-- lato lungo lavorato in doppio
|
||||||
|
if not Back.Tool then
|
||||||
|
for i = 1, 3 do
|
||||||
|
SquaringParameters[i] = {}
|
||||||
|
end
|
||||||
|
if Front.Tool.bIsPathCw then
|
||||||
|
if bSquaringStartsOnReference and ( sOrigCorner == 'BL' or sOrigCorner == 'BM') then
|
||||||
|
SquaringParameters[1] = Front
|
||||||
|
SquaringParameters[2] = Left
|
||||||
|
SquaringParameters[3] = Right
|
||||||
|
elseif bSquaringStartsOnReference and ( sOrigCorner == 'TR' or sOrigCorner == 'TN') then
|
||||||
|
SquaringParameters[1] = Right
|
||||||
|
SquaringParameters[2] = Front
|
||||||
|
SquaringParameters[3] = Left
|
||||||
|
elseif bSquaringStartsOnReference and ( sOrigCorner == 'BR' or sOrigCorner == 'BN') then
|
||||||
|
SquaringParameters[1] = Right
|
||||||
|
SquaringParameters[2] = Front
|
||||||
|
SquaringParameters[3] = Left
|
||||||
|
elseif bSquaringStartsOnReference and ( sOrigCorner == 'TL' or sOrigCorner == 'TM') then
|
||||||
|
SquaringParameters[1] = Left
|
||||||
|
SquaringParameters[2] = Front
|
||||||
|
SquaringParameters[3] = Right
|
||||||
|
else
|
||||||
|
SquaringParameters[1] = Right
|
||||||
|
SquaringParameters[2] = Front
|
||||||
|
SquaringParameters[3] = Left
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if bSquaringStartsOnReference and ( sOrigCorner == 'BL' or sOrigCorner == 'BM') then
|
||||||
|
SquaringParameters[1] = Left
|
||||||
|
SquaringParameters[2] = Front
|
||||||
|
SquaringParameters[3] = Right
|
||||||
|
elseif bSquaringStartsOnReference and ( sOrigCorner == 'TR' or sOrigCorner == 'TN') then
|
||||||
|
SquaringParameters[1] = Front
|
||||||
|
SquaringParameters[2] = Right
|
||||||
|
SquaringParameters[3] = Left
|
||||||
|
elseif bSquaringStartsOnReference and ( sOrigCorner == 'BR' or sOrigCorner == 'BN') then
|
||||||
|
SquaringParameters[1] = Front
|
||||||
|
SquaringParameters[2] = Right
|
||||||
|
SquaringParameters[3] = Left
|
||||||
|
elseif bSquaringStartsOnReference and ( sOrigCorner == 'TL' or sOrigCorner == 'TM') then
|
||||||
|
SquaringParameters[1] = Left
|
||||||
|
SquaringParameters[2] = Front
|
||||||
|
SquaringParameters[3] = Right
|
||||||
|
else
|
||||||
|
SquaringParameters[1] = Left
|
||||||
|
SquaringParameters[2] = Front
|
||||||
|
SquaringParameters[3] = Right
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- doppio non attivo
|
||||||
|
else
|
||||||
|
for i = 1, 4 do
|
||||||
|
SquaringParameters[i] = {}
|
||||||
|
end
|
||||||
|
if Front.Tool.bIsPathCw then
|
||||||
|
if bSquaringStartsOnReference and ( sOrigCorner == 'BL' or sOrigCorner == 'BM') then
|
||||||
|
SquaringParameters[1] = Front
|
||||||
|
SquaringParameters[2] = Left
|
||||||
|
SquaringParameters[3] = Back
|
||||||
|
SquaringParameters[4] = Right
|
||||||
|
elseif bSquaringStartsOnReference and ( sOrigCorner == 'TR' or sOrigCorner == 'TN') then
|
||||||
|
SquaringParameters[1] = Back
|
||||||
|
SquaringParameters[2] = Right
|
||||||
|
SquaringParameters[3] = Front
|
||||||
|
SquaringParameters[4] = Left
|
||||||
|
elseif bSquaringStartsOnReference and ( sOrigCorner == 'BR' or sOrigCorner == 'BN') then
|
||||||
|
SquaringParameters[1] = Right
|
||||||
|
SquaringParameters[2] = Front
|
||||||
|
SquaringParameters[3] = Left
|
||||||
|
SquaringParameters[4] = Back
|
||||||
|
else
|
||||||
|
SquaringParameters[1] = Left
|
||||||
|
SquaringParameters[2] = Back
|
||||||
|
SquaringParameters[3] = Right
|
||||||
|
SquaringParameters[4] = Front
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if bSquaringStartsOnReference and ( sOrigCorner == 'TL' or sOrigCorner == 'TM') then
|
||||||
|
SquaringParameters[1] = Back
|
||||||
|
SquaringParameters[2] = Left
|
||||||
|
SquaringParameters[3] = Front
|
||||||
|
SquaringParameters[4] = Right
|
||||||
|
elseif bSquaringStartsOnReference and ( sOrigCorner == 'TR' or sOrigCorner == 'TN') then
|
||||||
|
SquaringParameters[1] = Right
|
||||||
|
SquaringParameters[2] = Back
|
||||||
|
SquaringParameters[3] = Left
|
||||||
|
SquaringParameters[4] = Front
|
||||||
|
elseif bSquaringStartsOnReference and ( sOrigCorner == 'BR' or sOrigCorner == 'BN') then
|
||||||
|
SquaringParameters[1] = Front
|
||||||
|
SquaringParameters[2] = Right
|
||||||
|
SquaringParameters[3] = Back
|
||||||
|
SquaringParameters[4] = Left
|
||||||
|
else
|
||||||
|
SquaringParameters[1] = Left
|
||||||
|
SquaringParameters[2] = Front
|
||||||
|
SquaringParameters[3] = Right
|
||||||
|
SquaringParameters[4] = Back
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return SquaringParameters, b3Squaring
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
function Squaring.AddMachinings( SquaringParameters, b3Squaring, nFirstOperationId)
|
||||||
|
local nNotOkCount = 0
|
||||||
|
local sMsgTotal = ''
|
||||||
|
local dSquaringHeight = b3Squaring:getDimZ()
|
||||||
|
local dExtendPath = 0
|
||||||
|
local dMaxOvermaterial = 0
|
||||||
|
if type( WD.SQUARING_MAX_OVERMATERIAL) == "number" then
|
||||||
|
dMaxOvermaterial = WD.SQUARING_MAX_OVERMATERIAL
|
||||||
|
end
|
||||||
|
local bUseZigZagStep = ( type( WD.SQUARING_USE_ZIGZAG) == "boolean") and ( WD.SQUARING_USE_ZIGZAG == true)
|
||||||
|
|
||||||
|
for i = 1, #SquaringParameters do
|
||||||
|
local dToolRadius = SquaringParameters[i].Tool.dDiameter / 2
|
||||||
|
local vtExtr = EgtCurveExtrusion( SquaringParameters[i].nId, GDB_RT.GLOB)
|
||||||
|
local bIsVerticalMilling = false
|
||||||
|
if AreSameVectorApprox( vtExtr, Z_AX()) then
|
||||||
|
bIsVerticalMilling = true
|
||||||
|
end
|
||||||
|
-- calcolo step laterale
|
||||||
|
local MachiningSteps = { nCount = 1, dStep = 0}
|
||||||
|
if not bIsVerticalMilling then
|
||||||
|
MachiningSteps = WM.GetMachiningSteps( dSquaringHeight, SquaringParameters[i].Tool.dSideStep)
|
||||||
|
end
|
||||||
|
|
||||||
|
for j = 1, MachiningSteps.nCount do
|
||||||
|
local nOperationId = EgtCreateMachining( 'SQUARING_' .. SquaringParameters[i].sSide, MCH_OY.MILLING, SquaringParameters[i].Tool.sName)
|
||||||
|
-- geometria
|
||||||
|
EgtSetMachiningGeometry( SquaringParameters[i].nId)
|
||||||
|
-- profondità di lavoro
|
||||||
|
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 0)
|
||||||
|
-- workside e inversione
|
||||||
|
if SquaringParameters[i].Tool.bIsPathCw then
|
||||||
|
if SquaringParameters[i].Tool.nType == MCH_TY.MILL_STD then
|
||||||
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||||
|
else
|
||||||
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
||||||
|
end
|
||||||
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
|
else
|
||||||
|
if SquaringParameters[i].Tool.nType == MCH_TY.MILL_STD then
|
||||||
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
||||||
|
else
|
||||||
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||||
|
end
|
||||||
|
EgtSetMachiningParam( MCH_MP.INVERT, false)
|
||||||
|
end
|
||||||
|
-- distanza di sicurezza
|
||||||
|
if bIsVerticalMilling then
|
||||||
|
EgtSetMachiningParam( MCH_MP.STARTPOS, WD.CUT_SIC + dSquaringHeight)
|
||||||
|
else
|
||||||
|
EgtSetMachiningParam( MCH_MP.STARTPOS, WD.CUT_SIC)
|
||||||
|
end
|
||||||
|
-- overlap
|
||||||
|
EgtSetMachiningParam( MCH_MP.OVERL, 0)
|
||||||
|
-- tipo di step
|
||||||
|
if bIsVerticalMilling and bUseZigZagStep then
|
||||||
|
EgtSetMachiningParam( MCH_MP.STEPTYPE, MCH_MILL_ST.ZIGZAG)
|
||||||
|
else
|
||||||
|
EgtSetMachiningParam( MCH_MP.STEPTYPE, MCH_MILL_ST.ONEWAY)
|
||||||
|
end
|
||||||
|
-- step
|
||||||
|
if bIsVerticalMilling then
|
||||||
|
EgtSetMachiningParam( MCH_MP.STEP, SquaringParameters[i].Tool.dStep)
|
||||||
|
else
|
||||||
|
EgtSetMachiningParam( MCH_MP.STEP, 0)
|
||||||
|
end
|
||||||
|
-- offset radiale
|
||||||
|
local dRadialOffset = 0
|
||||||
|
if not bIsVerticalMilling then
|
||||||
|
dRadialOffset = ( MachiningSteps.nCount - j) * MachiningSteps.dStep
|
||||||
|
end
|
||||||
|
EgtSetMachiningParam( MCH_MP.OFFSR, dRadialOffset)
|
||||||
|
-- offset longitudinale
|
||||||
|
EgtSetMachiningParam( MCH_MP.OFFSL, 0)
|
||||||
|
-- inversione utensile
|
||||||
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, false)
|
||||||
|
-- faceuse
|
||||||
|
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.NONE)
|
||||||
|
-- angoli suggeriti
|
||||||
|
EgtSetMachiningParam( MCH_MP.INITANGS, '')
|
||||||
|
-- asse bloccato
|
||||||
|
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, '')
|
||||||
|
-- SCC
|
||||||
|
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.NONE)
|
||||||
|
-- calcolo estensione percorso
|
||||||
|
if bIsVerticalMilling then
|
||||||
|
-- per utensili che lavorano di fianco, si deve partire fuori dall'altezza del grezzo
|
||||||
|
dExtendPath = dMaxOvermaterial + dToolRadius + WD.COLL_SIC
|
||||||
|
else
|
||||||
|
-- si calcola l'impronta utensile per uscire quanto basta a garantire il maxOvermaterial, con una distanza di sicurezza
|
||||||
|
dExtendPath = dMaxOvermaterial + WD.COLL_SIC + dToolRadius - ( dToolRadius - sqrt( dToolRadius * dToolRadius - ( ( dToolRadius - dSquaringHeight) * ( dToolRadius - dSquaringHeight))))
|
||||||
|
end
|
||||||
|
-- approccio
|
||||||
|
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.LINEAR)
|
||||||
|
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtendPath)
|
||||||
|
EgtSetMachiningParam( MCH_MP.LITANG, 0)
|
||||||
|
if bIsVerticalMilling then
|
||||||
|
EgtSetMachiningParam( MCH_MP.LIPERP, 0)
|
||||||
|
else
|
||||||
|
-- per utensili che lavorano di fianco, si deve partire fuori dall'altezza del grezzo
|
||||||
|
EgtSetMachiningParam( MCH_MP.LIPERP, WD.CUT_SIC + dSquaringHeight)
|
||||||
|
end
|
||||||
|
EgtSetMachiningParam( MCH_MP.LIELEV, 0)
|
||||||
|
EgtSetMachiningParam( MCH_MP.LICOMPLEN, 0)
|
||||||
|
-- retrazione
|
||||||
|
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.LINEAR)
|
||||||
|
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtendPath)
|
||||||
|
EgtSetMachiningParam( MCH_MP.LOTANG, 0)
|
||||||
|
if bIsVerticalMilling then
|
||||||
|
EgtSetMachiningParam( MCH_MP.LOPERP, 0)
|
||||||
|
else
|
||||||
|
-- per utensili che lavorano di fianco, si deve partire fuori dall'altezza del grezzo
|
||||||
|
EgtSetMachiningParam( MCH_MP.LOPERP, WD.CUT_SIC + dSquaringHeight)
|
||||||
|
end
|
||||||
|
EgtSetMachiningParam( MCH_MP.LOELEV, 0)
|
||||||
|
EgtSetMachiningParam( MCH_MP.LOCOMPLEN, 0)
|
||||||
|
-- note utente
|
||||||
|
local sUserNotes = ''
|
||||||
|
sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
|
||||||
|
if SquaringParameters[i].ToolDouble then
|
||||||
|
local dYMirrorAx
|
||||||
|
local b3Tab = EgtGetTableArea()
|
||||||
|
dYMirrorAx = b3Squaring:getCenter():getY() - b3Tab:getMin():getY()
|
||||||
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', 2)
|
||||||
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'MirrorAx', dYMirrorAx)
|
||||||
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'TOOLDOUBLE', SquaringParameters[i].ToolDouble.sName)
|
||||||
|
end
|
||||||
|
if not bIsVerticalMilling then
|
||||||
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', 0)
|
||||||
|
end
|
||||||
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
||||||
|
|
||||||
|
local bOk = EgtApplyMachining( true, false)
|
||||||
|
EgtRelocateGlob( nOperationId, nFirstOperationId, GDB_IN.BEFORE)
|
||||||
|
if not bOk then
|
||||||
|
local _, sMsg = EgtGetLastMachMgrError()
|
||||||
|
nNotOkCount = nNotOkCount + 1
|
||||||
|
sMsgTotal = sMsgTotal ..'\n' .. ( sMsg or '')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return ( nNotOkCount < 1), sMsgTotal
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
function Squaring.AddScrapRemoval( nFirstOperationId)
|
||||||
|
-- pulizia sfridi alla prima lavorazione dopo la squadratura
|
||||||
|
EgtSetCurrMachining( nFirstOperationId)
|
||||||
|
local sMachiningNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
|
||||||
|
sMachiningNotes = sMachiningNotes .. 'ScrapRemove=1;'
|
||||||
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sMachiningNotes)
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
return Squaring
|
||||||
@@ -0,0 +1,253 @@
|
|||||||
|
-- WFeatureTopology.lua by Egaltech s.r.l. 2023/06/23
|
||||||
|
-- Libreria per classificazione topologica feature pareti
|
||||||
|
-- 2023/12/11 Modifiche varie per allineamento con Beam.
|
||||||
|
|
||||||
|
-- Tabella per definizione modulo
|
||||||
|
local WFeatureTopology = {}
|
||||||
|
|
||||||
|
-- Include
|
||||||
|
require( 'EgtBase')
|
||||||
|
|
||||||
|
-- Carico le librerie
|
||||||
|
local WL = require( 'WallLib')
|
||||||
|
|
||||||
|
EgtOutLog( ' WFeatureTopology started', 1)
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
-- restituisce la matrice delle adiacenze di Proc dove i e j sono le facce e a(ij) è l'angolo tra di esse; 0 se nessuna adiacenza
|
||||||
|
local function GetAdjacencyMatrix( Proc)
|
||||||
|
local vAdj = {}
|
||||||
|
for i = 1, Proc.Fct do
|
||||||
|
vAdj[i] = {}
|
||||||
|
for j = 1, Proc.Fct do
|
||||||
|
if i == j then
|
||||||
|
vAdj[i][j] = 0
|
||||||
|
else
|
||||||
|
_, _, _, vAdj[i][j] = EgtSurfTmFacetsContact( Proc.Id, i - 1, j - 1, GDB_ID.ROOT)
|
||||||
|
if not vAdj[i][j] then vAdj[i][j] = 0 end
|
||||||
|
end
|
||||||
|
j = j + 1
|
||||||
|
end
|
||||||
|
i = i + 1
|
||||||
|
end
|
||||||
|
return vAdj
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
-- restituisce gli id delle facce di Proc che hanno il numero di adiacenze nAdj
|
||||||
|
function WFeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, nAdj)
|
||||||
|
local vAdj = GetAdjacencyMatrix( Proc)
|
||||||
|
local vFacesWithGivenAdj = {}
|
||||||
|
for i = 1, Proc.Fct do
|
||||||
|
local nAdjCount = 0
|
||||||
|
for j = 1, Proc.Fct 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( Proc)
|
||||||
|
local vAdj = GetAdjacencyMatrix( Proc)
|
||||||
|
local bAllConcave, bAllRight = true, true
|
||||||
|
for i = 1, Proc.Fct do
|
||||||
|
for j = 1, Proc.Fct 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 Proc.Fct < 2 or ( Proc.Fct == 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 WL.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, bIsThrough)
|
||||||
|
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' or sFamily == 'Tunnel' or ( sFamily == 'Groove' and bIsThrough) 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 WFeatureTopology.Classify( Proc, b3Raw)
|
||||||
|
|
||||||
|
if not Proc.AffectedFaces then Proc.AffectedFaces = WL.GetProcessAffectedFaces( Proc) end
|
||||||
|
if not Proc.Box or Proc.Box:isEmpty() then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local bRecognized = false
|
||||||
|
local sFamily
|
||||||
|
local bIsThrough
|
||||||
|
local bAllRightAngles
|
||||||
|
local bIsParallel
|
||||||
|
local sLongName = ''
|
||||||
|
|
||||||
|
-- SE NON HA TUTTE LE FACCE PIANE RITORNARE NIL!!
|
||||||
|
|
||||||
|
local bAllAnglesConcave
|
||||||
|
bAllAnglesConcave, bAllRightAngles = AreAllAnglesConcaveOrRight( Proc)
|
||||||
|
local vTriangularFaces = GetTriangularFaces( Proc)
|
||||||
|
local bIsAnyDimensionLongAsPart = IsAnyDimensionLongAsPart( Proc)
|
||||||
|
local vFacesWithOneAdj = WFeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, 1)
|
||||||
|
local vFacesWithTwoAdj = WFeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, 2)
|
||||||
|
local vFacesWithThreeAdj = WFeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, 3)
|
||||||
|
local vFacesWithFourAdj = WFeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, 4)
|
||||||
|
local dRawW, dRawH, dRawL = b3Raw:getDimY(), b3Raw:getDimZ(), b3Raw:getDimX()
|
||||||
|
local bIsFeatureCuttingEntireSection = WL.IsFeatureCuttingEntireSection( Proc.Box, dRawW, dRawH, dRawL)
|
||||||
|
|
||||||
|
if Proc.IsOutline then
|
||||||
|
sFamily = 'OUTLINE'
|
||||||
|
elseif Proc.Prc == 40 then
|
||||||
|
sFamily = 'DRILLING'
|
||||||
|
elseif 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
|
||||||
|
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
|
||||||
|
local vFacesParallelToPart = GetFacesParallelToPart( Proc, sFamily, bIsThrough)
|
||||||
|
bIsParallel = ( #vFacesParallelToPart == Proc.Fct)
|
||||||
|
|
||||||
|
if sFamily == 'OUTLINE' or sFamily == 'DRILLING' then
|
||||||
|
Proc.Topology = sFamily
|
||||||
|
Proc.TopologyLongName = sFamily
|
||||||
|
bRecognized = true
|
||||||
|
elseif sFamily then
|
||||||
|
sLongName = GetTopologyLongName( sFamily, bIsThrough, bAllRightAngles, bIsParallel, Proc.Fct)
|
||||||
|
Proc.Topology, Proc.IsThrough, Proc.AllRightAngles, Proc.IsParallel, Proc.TopologyLongName = sFamily, bIsThrough, bAllRightAngles, bIsParallel, sLongName
|
||||||
|
bRecognized = true
|
||||||
|
else
|
||||||
|
Proc.Topology = 'OTHER'
|
||||||
|
Proc.TopologyLongName = 'OTHER'
|
||||||
|
end
|
||||||
|
|
||||||
|
return bRecognized
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
return WFeatureTopology
|
||||||
@@ -3,8 +3,8 @@
|
|||||||
-- 2023/03/09 Piccola correzione alla SideDepth in FindMilling
|
-- 2023/03/09 Piccola correzione alla SideDepth in FindMilling
|
||||||
-- In FindMilling aggiunta gestione spessore e massimo materiale nel caso di lam
|
-- In FindMilling aggiunta gestione spessore e massimo materiale nel caso di lam
|
||||||
-- 2023/05/25 Aggiunta funzione AddMachining che incapsula EgtAddMachining trascrivendo le priorità btl dalle feature alle lavorazioni.
|
-- 2023/05/25 Aggiunta funzione AddMachining che incapsula EgtAddMachining trascrivendo le priorità btl dalle feature alle lavorazioni.
|
||||||
-- 2023/06/07 Alla funzione AddMachining aggiunta la scrittura dell'info ISOUTLINE alle lavorazioni.
|
|
||||||
-- 2023/10/18 In SetCurrMachiningAndTool sostituito controllo di utensile attivo con controllo utensile nel setup corrente.
|
-- 2023/10/18 In SetCurrMachiningAndTool sostituito controllo di utensile attivo con controllo utensile nel setup corrente.
|
||||||
|
-- 2023/11/14 Modifiche sostanziali per l'aggiunta delle lavorazioni in doppio e per il miglioramento nella gestione delle tasche.
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local WMachiningLib = {}
|
local WMachiningLib = {}
|
||||||
@@ -56,7 +56,7 @@ function WMachiningLib.FindCutting( sType, dDepth, nTool_ID)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
function WMachiningLib.FindMilling( sType, dDepth, sTuuid, nTool_ID, dMaxDiam, dMaxMat, bTipFeed, dMinSideElev)
|
function WMachiningLib.FindMilling( sType, dDepth, sTuuid, nTool_ID, dMaxDiam, dMaxMat, bTipFeed, dMinSideElev, sHead)
|
||||||
for i = 1, #Millings do
|
for i = 1, #Millings do
|
||||||
local Milling = Millings[i]
|
local Milling = Millings[i]
|
||||||
if Milling.On and Milling.Type == sType and SetCurrMachiningAndTool( Milling.Name) then
|
if Milling.On and Milling.Type == sType and SetCurrMachiningAndTool( Milling.Name) then
|
||||||
@@ -70,6 +70,7 @@ function WMachiningLib.FindMilling( sType, dDepth, sTuuid, nTool_ID, dMaxDiam, d
|
|||||||
local dTTipFeed = EgtTdbGetCurrToolParam( MCH_TP.TIPFEED)
|
local dTTipFeed = EgtTdbGetCurrToolParam( MCH_TP.TIPFEED)
|
||||||
local dTMaxDepthOnSide = EgtIf( bIsBlade, EgtTdbGetCurrToolParam( MCH_TP.MAXMAT), min( EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd') or 999, 0.5 * ( dTDiam - dTDiamTh)))
|
local dTMaxDepthOnSide = EgtIf( bIsBlade, EgtTdbGetCurrToolParam( MCH_TP.MAXMAT), min( EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd') or 999, 0.5 * ( dTDiam - dTDiamTh)))
|
||||||
local nMyTool_ID = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'Tool_ID', 'i')
|
local nMyTool_ID = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'Tool_ID', 'i')
|
||||||
|
local sMyHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
|
||||||
if nMchType == MCH_MY.MILLING and
|
if nMchType == MCH_MY.MILLING and
|
||||||
( not sTuuid or sTuuid == sMyTuuid) and
|
( not sTuuid or sTuuid == sMyTuuid) and
|
||||||
( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and
|
( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and
|
||||||
@@ -77,7 +78,8 @@ function WMachiningLib.FindMilling( sType, dDepth, sTuuid, nTool_ID, dMaxDiam, d
|
|||||||
( not dMaxMat or dTMaxMat < dMaxMat + GEO.EPS_SMALL) and
|
( not dMaxMat or dTMaxMat < dMaxMat + GEO.EPS_SMALL) and
|
||||||
( not bTipFeed or dTTipFeed > 1) and
|
( not bTipFeed or dTTipFeed > 1) and
|
||||||
( not dMinSideElev or dTMaxDepthOnSide > dMinSideElev - GEO.EPS_SMALL) and
|
( not dMinSideElev or dTMaxDepthOnSide > dMinSideElev - GEO.EPS_SMALL) and
|
||||||
( not nTool_ID or nTool_ID == 0 or nTool_ID == nMyTool_ID) then
|
( not nTool_ID or nTool_ID == 0 or nTool_ID == nMyTool_ID) and
|
||||||
|
( not sHead or sHead == sMyHead) then
|
||||||
return Milling.Name, dTMaxDepth, dTMaxMat, dTDiam
|
return Milling.Name, dTMaxDepth, dTMaxMat, dTDiam
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -100,18 +102,32 @@ function WMachiningLib.FindNailing( nType)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
function WMachiningLib.FindPocketing( sType, dMaxDiam, dDepth, nTool_ID)
|
function WMachiningLib.FindPocketing( sType, dMaxDiam, dDepth, nTool_ID, sHead, bExcludeNoTipFeed, dDistanceToNearestPart)
|
||||||
|
if not dMaxDiam then dMaxDiam = 999 end
|
||||||
for i = 1, #Pocketings do
|
for i = 1, #Pocketings do
|
||||||
local Pocketing = Pocketings[i]
|
local Pocketing = Pocketings[i]
|
||||||
if Pocketing.On and Pocketing.Type == sType and SetCurrMachiningAndTool( Pocketing.Name) then
|
if Pocketing.On and Pocketing.Type == sType and SetCurrMachiningAndTool( Pocketing.Name) then
|
||||||
local nMchType = EgtMdbGetCurrMachiningParam( MCH_MP.TYPE)
|
local nMchType = EgtMdbGetCurrMachiningParam( MCH_MP.TYPE)
|
||||||
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
|
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
|
||||||
local dTMaxDepth = EgtIf( WD.MILL_MAX_DEPTH_AS_MAT, EgtTdbGetCurrToolParam( MCH_TP.MAXMAT), EgtTdbGetCurrToolMaxDepth())
|
local dTMaxDepth = EgtIf( WD.MILL_MAX_DEPTH_AS_MAT, EgtTdbGetCurrToolParam( MCH_TP.MAXMAT), EgtTdbGetCurrToolMaxDepth())
|
||||||
local nMyTool_ID = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'Tool_ID', 'i')
|
local nMyTool_ID = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'Tool_ID', 'i')
|
||||||
|
local sMyHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
|
||||||
|
local bHasTipFeed = ( EgtTdbGetCurrToolParam( MCH_TP.TIPFEED) ~= 0)
|
||||||
|
-- attacco con rampa molto lunga e step basso, utilizzabile anche con frese che non lavorano di testa
|
||||||
|
local bIsSpecialLeadIn = ( EgtMdbGetCurrMachiningParam( MCH_MP.LEADINTYPE) == MCH_POCK_LI.ZIGZAG or MCH_POCK_LI.HELIX) and
|
||||||
|
( ( EgtMdbGetCurrMachiningParam( MCH_MP.LITANG) or 0) > dTDiam - 1 - 10 * GEO.EPS_SMALL) and
|
||||||
|
( ( EgtMdbGetCurrMachiningParam( MCH_MP.LIELEV) or 999) <= 2)
|
||||||
|
local bIsSpiralOut = EgtMdbGetCurrMachiningParam( MCH_MP.SUBTYPE) == MCH_POCK_SUB.SPIRALOUT
|
||||||
|
-- se ho un altro pezzo troppo vicino riduco il diametro massimo utensile
|
||||||
|
if dDistanceToNearestPart then
|
||||||
|
dMaxDiam = min( dMaxDiam, EgtIf( bIsSpiralOut, dDistanceToNearestPart * 2 + 5, dDistanceToNearestPart + 5))
|
||||||
|
end
|
||||||
if nMchType == MCH_MY.POCKETING and
|
if nMchType == MCH_MY.POCKETING and
|
||||||
( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and
|
( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and
|
||||||
( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and
|
( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and
|
||||||
( not nTool_ID or nTool_ID == 0 or nTool_ID == nMyTool_ID) then
|
( not nTool_ID or nTool_ID == 0 or nTool_ID == nMyTool_ID) and
|
||||||
|
( not sHead or sHead == sMyHead) and
|
||||||
|
( not bExcludeNoTipFeed or bHasTipFeed or bIsSpecialLeadIn) then
|
||||||
return Pocketing.Name, dTDiam, dTMaxDepth
|
return Pocketing.Name, dTDiam, dTMaxDepth
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -183,8 +199,8 @@ function WMachiningLib.FindSurfacing( sType)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- incapsulo EgtAddMachining e trascrivo alcune informazioni utili nelle note dell'operazione
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
-- incapsulo EgtAddMachining e trascrivo alcune informazioni utili nelle note dell'operazione
|
||||||
function WMachiningLib.AddMachining( Proc, sName, sMachining)
|
function WMachiningLib.AddMachining( Proc, sName, sMachining)
|
||||||
local nMchId, sFinalName = EgtAddMachining( sName, sMachining)
|
local nMchId, sFinalName = EgtAddMachining( sName, sMachining)
|
||||||
if type( Proc) == 'table' then
|
if type( Proc) == 'table' then
|
||||||
@@ -195,5 +211,72 @@ function WMachiningLib.AddMachining( Proc, sName, sMachining)
|
|||||||
return nMchId, sFinalName
|
return nMchId, sFinalName
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
-- verifica se utensile sToolMasterName e gemello sToolDoubleName sono compatibili con la specchiatura
|
||||||
|
function WMachiningLib.IsToolDoubleOk( sToolMasterName, sToolDoubleName)
|
||||||
|
local bIsToolDoubleOk = false
|
||||||
|
-- dimensioni utensile master
|
||||||
|
EgtTdbSetCurrTool( sToolMasterName)
|
||||||
|
local bIsBlade = ( EgtTdbGetCurrToolParam( MCH_TP.TYPE) & MCH_TF.SAWBLADE ~= 0) or false
|
||||||
|
local dTMaxMat = EgtIf( bIsBlade, EgtTdbGetCurrToolParam( MCH_TP.THICK), EgtTdbGetCurrToolParam( MCH_TP.MAXMAT))
|
||||||
|
local dTMaxDepth = EgtIf( WD.MILL_MAX_DEPTH_AS_MAT, dTMaxMat, EgtTdbGetCurrToolMaxDepth())
|
||||||
|
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
|
||||||
|
local dTDiamTh = EgtTdbGetCurrToolThDiam() or 0
|
||||||
|
local bHasTipFeed = EgtTdbGetCurrToolParam( MCH_TP.TIPFEED) ~= 0
|
||||||
|
local dTMaxDepthOnSide = EgtIf( bIsBlade, EgtTdbGetCurrToolParam( MCH_TP.MAXMAT), min( EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd') or 999, 0.5 * ( dTDiam - dTDiamTh)))
|
||||||
|
local bIsPrimaryHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD) == 'H1'
|
||||||
|
-- dimensioni utensile double
|
||||||
|
EgtTdbSetCurrTool( sToolDoubleName)
|
||||||
|
local bIsBladeDouble = ( EgtTdbGetCurrToolParam( MCH_TP.TYPE) & MCH_TF.SAWBLADE ~= 0) or false
|
||||||
|
local dTMaxMatDouble = EgtIf( bIsBladeDouble, EgtTdbGetCurrToolParam( MCH_TP.THICK), EgtTdbGetCurrToolParam( MCH_TP.MAXMAT))
|
||||||
|
local dTMaxDepthDouble = EgtIf( WD.MILL_MAX_DEPTH_AS_MAT, dTMaxMatDouble, EgtTdbGetCurrToolMaxDepth())
|
||||||
|
local dTDiamDouble = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
|
||||||
|
local dTDiamThDouble = EgtTdbGetCurrToolThDiam() or 0
|
||||||
|
local bHasTipFeedDouble = EgtTdbGetCurrToolParam( MCH_TP.TIPFEED) ~= 0
|
||||||
|
local dTMaxDepthOnSideDouble = EgtIf( bIsBladeDouble, EgtTdbGetCurrToolParam( MCH_TP.MAXMAT), min( EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd') or 999, 0.5 * ( dTDiamDouble - dTDiamThDouble)))
|
||||||
|
-- controllo che siano uguali ( permetto una leggera differenza di lunghezza)
|
||||||
|
local dMaxLengthDifference = 6.5
|
||||||
|
bIsToolDoubleOk = bIsPrimaryHead and
|
||||||
|
( bIsBlade == bIsBladeDouble) and
|
||||||
|
( dTMaxMatDouble > dTMaxMat - 100 * GEO.EPS_SMALL) and
|
||||||
|
( dTMaxDepthDouble > dTMaxDepth - dMaxLengthDifference) and
|
||||||
|
( abs( dTDiam - dTDiamDouble) < 100 * GEO.EPS_SMALL) and
|
||||||
|
( abs( dTDiamTh - dTDiamThDouble) < 100 * GEO.EPS_SMALL) and
|
||||||
|
( bHasTipFeed == bHasTipFeedDouble) and
|
||||||
|
( abs( dTMaxDepthOnSide - dTMaxDepthOnSideDouble) < GEO.EPS_SMALL) and
|
||||||
|
EgtFindToolInCurrSetup( sToolDoubleName)
|
||||||
|
return bIsToolDoubleOk
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
-- verifica se la lavorazione sMachining è adatta alla specchiatura
|
||||||
|
function WMachiningLib.IsMachiningOkForDouble( sMachining)
|
||||||
|
local bDoubleOk = false
|
||||||
|
if sMachining and EgtMdbSetCurrMachining( sMachining) then
|
||||||
|
-- recupero l'utensile della lavorazione
|
||||||
|
local sToolMasterName = EgtMdbGetCurrMachiningParam( MCH_MP.TOOL)
|
||||||
|
if EgtTdbSetCurrTool( sToolMasterName or '') then
|
||||||
|
-- cerco eventuale utensile in doppio
|
||||||
|
local sToolDoubleName = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'DOUBLE', 's')
|
||||||
|
if sToolDoubleName and EgtTdbSetCurrTool( sToolDoubleName) then
|
||||||
|
bDoubleOk = WMachiningLib.IsToolDoubleOk( sToolMasterName, sToolDoubleName)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return bDoubleOk
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
function WMachiningLib.GetMachiningSteps( dMachiningDepth, dStep)
|
||||||
|
local MachiningSteps = {}
|
||||||
|
MachiningSteps.dStep = 0
|
||||||
|
MachiningSteps.nCount = ceil( ( dMachiningDepth - 10 * GEO.EPS_SMALL) / dStep)
|
||||||
|
if MachiningSteps.nCount > 1 then
|
||||||
|
MachiningSteps.dStep = ( dMachiningDepth - dStep) / ( MachiningSteps.nCount - 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
return MachiningSteps
|
||||||
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
return WMachiningLib
|
return WMachiningLib
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
-- WProcessDoubleCut.lua by Egaltech s.r.l. 2023/04/17
|
-- WProcessDoubleCut.lua by Egaltech s.r.l. 2023/04/17
|
||||||
-- Gestione calcolo doppi tagli di lama per Pareti
|
-- Gestione calcolo doppi tagli di lama per Pareti
|
||||||
-- 2023/04/17 Quando si chiama LapJoint si trasforma il Gruppo da 1 a 3 e da 2 a 4.
|
-- 2023/04/17 Quando si chiama LapJoint si trasforma il Gruppo da 1 a 3 e da 2 a 4.
|
||||||
|
-- 2023/11/14 Aggiunta funzione IdentifyStrict per il riconoscimento della sola feature L011.
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local WPDC = {}
|
local WPDC = {}
|
||||||
@@ -24,6 +25,12 @@ function WPDC.Identify( Proc)
|
|||||||
( Proc.Grp == 0 and Proc.Prc == 12))
|
( Proc.Grp == 0 and Proc.Prc == 12))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
-- Riconoscimento della sola feature L011
|
||||||
|
function WPDC.IdentifyStrict( Proc)
|
||||||
|
return ( Proc.Grp == 1 or Proc.Grp == 2) and Proc.Prc == 11
|
||||||
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
-- Classificazione della feature
|
-- Classificazione della feature
|
||||||
function WPDC.Classify( Proc, b3Raw)
|
function WPDC.Classify( Proc, b3Raw)
|
||||||
@@ -59,9 +66,8 @@ function WPDC.Make( Proc, nRawId, b3Raw)
|
|||||||
-- se singola faccia, passo a quella lavorazione
|
-- se singola faccia, passo a quella lavorazione
|
||||||
if Proc.Fct == 1 then return Cut.Make( Proc, nRawId, b3Raw) end
|
if Proc.Fct == 1 then return Cut.Make( Proc, nRawId, b3Raw) end
|
||||||
-- altrimenti due facce e passo alla LapJoint
|
-- altrimenti due facce e passo alla LapJoint
|
||||||
local LapProc = { PartId = Proc.PartId, Id = Proc.Id, Grp = Proc.Grp + 2, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
Proc.Grp = Proc.Grp + 2
|
||||||
Diam = Proc.Diam, Fcs = Proc.Fcs, Fce = Proc.Fce, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
return LapJoint.Make( Proc, nRawId, b3Raw)
|
||||||
return LapJoint.Make( LapProc, nRawId, b3Raw)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|||||||
+97
-25
@@ -9,6 +9,7 @@
|
|||||||
-- 2022/02/22 ES Aggiunta gestione prefori.
|
-- 2022/02/22 ES Aggiunta gestione prefori.
|
||||||
-- 2022/03/08 DS Vanno accettati fori orizzontali sul bordo anche senza foratori orizzontali speciali.
|
-- 2022/03/08 DS Vanno accettati fori orizzontali sul bordo anche senza foratori orizzontali speciali.
|
||||||
-- 2023/05/25 Funzioni EgtAddMachining sostituite da WM.AddMachining in modo da trascrivere le priorità da btl alle lavorazioni.
|
-- 2023/05/25 Funzioni EgtAddMachining sostituite da WM.AddMachining in modo da trascrivere le priorità da btl alle lavorazioni.
|
||||||
|
-- 2023/11/14 Aggiunta gestione forature in doppio.
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local WPD = {}
|
local WPD = {}
|
||||||
@@ -55,7 +56,7 @@ end
|
|||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
-- Classificazione della feature
|
-- Classificazione della feature
|
||||||
function WPD.Classify( Proc, b3Raw)
|
function WPD.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
|
||||||
@@ -156,6 +157,41 @@ function WPD.RotateClassify( Proc)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
local function IsToolDoubleOk( sToolMasterName, sToolDoubleName)
|
||||||
|
local bIsToolDoubleOk = false
|
||||||
|
-- dimensioni utensile master
|
||||||
|
EgtTdbSetCurrTool( sToolMasterName)
|
||||||
|
local dTMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
|
||||||
|
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
|
||||||
|
-- dimensioni utensile double
|
||||||
|
EgtTdbSetCurrTool( sToolDoubleName)
|
||||||
|
local dTMaxMatDouble = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
|
||||||
|
local dTDiamDouble = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
|
||||||
|
-- controllo che siano uguali
|
||||||
|
bIsToolDoubleOk = ( dTMaxMatDouble > dTMaxMat - 100 * GEO.EPS_SMALL) and
|
||||||
|
( abs( dTDiam - dTDiamDouble) < 100 * GEO.EPS_SMALL) and
|
||||||
|
EgtFindToolInCurrSetup( sToolDoubleName)
|
||||||
|
return bIsToolDoubleOk
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
local function IsMachiningOkForDouble( sMachining)
|
||||||
|
local bDoubleOk = false
|
||||||
|
if sMachining and EgtMdbSetCurrMachining( sMachining) then
|
||||||
|
-- recupero l'utensile della lavorazione
|
||||||
|
local sToolMasterName = EgtMdbGetCurrMachiningParam( MCH_MP.TOOL)
|
||||||
|
if EgtTdbSetCurrTool( sToolMasterName or '') then
|
||||||
|
-- cerco eventuale utensile in doppio
|
||||||
|
local sToolDoubleName = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'DOUBLE', 's')
|
||||||
|
if sToolDoubleName and EgtTdbSetCurrTool( sToolDoubleName) then
|
||||||
|
bDoubleOk = IsToolDoubleOk( sToolMasterName, sToolDoubleName)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return bDoubleOk
|
||||||
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
local function IsHorizLongDrill( Proc)
|
local function IsHorizLongDrill( Proc)
|
||||||
-- recupero e verifico l'entità foro
|
-- recupero e verifico l'entità foro
|
||||||
@@ -263,10 +299,21 @@ function WPD.Make( Proc, nRawId, b3Raw)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local bUseDLenToFindDrilling = true
|
||||||
local sDrilling, nType = WM.FindDrilling( dDiam, dLen, sHead)
|
local sDrilling, nType = WM.FindDrilling( dDiam, dLen, sHead)
|
||||||
if not sDrilling then
|
if not sDrilling then
|
||||||
|
bUseDLenToFindDrilling = false
|
||||||
sDrilling, nType = WM.FindDrilling( dDiam, nil, sHead)
|
sDrilling, nType = WM.FindDrilling( dDiam, nil, sHead)
|
||||||
end
|
end
|
||||||
|
-- se Proc è settata per essere specchiata cerco la lavorazione adatta e verifico possa essere effettivamente specchiata
|
||||||
|
if Proc.Double and Proc.Double == 2 then
|
||||||
|
local sDrillingBackup = sDrilling
|
||||||
|
sDrilling = WM.FindDrilling( dDiam, EgtIf( bUseDLenToFindDrilling, dLen, nil), 'H1')
|
||||||
|
if not IsMachiningOkForDouble( sDrilling) then
|
||||||
|
Proc.Double = 0
|
||||||
|
sDrilling = sDrillingBackup
|
||||||
|
end
|
||||||
|
end
|
||||||
if sHead and not sDrilling then
|
if sHead and not sDrilling then
|
||||||
sDrilling, nType = WM.FindDrilling( dDiam, dLen)
|
sDrilling, nType = WM.FindDrilling( dDiam, dLen)
|
||||||
if not sDrilling then
|
if not sDrilling then
|
||||||
@@ -277,32 +324,41 @@ function WPD.Make( Proc, nRawId, b3Raw)
|
|||||||
local bAngledContourDrill = false
|
local bAngledContourDrill = false
|
||||||
local nAngledContourDrillId = GDB_ID.NULL
|
local nAngledContourDrillId = GDB_ID.NULL
|
||||||
local dReduceDepth = 0
|
local dReduceDepth = 0
|
||||||
|
local bUseTabs = false
|
||||||
-- se trovata svuotatura, verifico se richiesta invece contornatura
|
-- se trovata svuotatura, verifico se richiesta invece contornatura
|
||||||
if nType == 'Pocket' then
|
if nType == 'Pocket' then
|
||||||
-- recupero eventuale flag per fare sola contornatura
|
-- recupero eventuale flag per fare sola contornatura
|
||||||
local nContourOnly = ( EgtGetInfo( Proc.Id, sContourOnly, 'i') or 0)
|
local nContourOnly = ( EgtGetInfo( Proc.Id, sContourOnly, 'i') or 0)
|
||||||
if nContourOnly == 1 then
|
if nContourOnly == 1 then
|
||||||
-- imposto riduzione profondita' per evitare distacco pezzo interno
|
-- se passante
|
||||||
dReduceDepth = 5
|
if Proc.Fcs > 0 and Proc.Fce > 0 then
|
||||||
-- se inclinato e passante
|
-- se inclinato
|
||||||
if abs( vtExtr:getZ()) >= WD.DRILL_VZ_MIN and abs( vtExtr:getZ()) < 0.999 and Proc.Fcs > 0 and Proc.Fce > 0 then
|
if abs( vtExtr:getZ()) >= WD.DRILL_VZ_MIN and abs( vtExtr:getZ()) < 0.999 then
|
||||||
-- gruppo ausiliario per preforo
|
-- gruppo ausiliario per preforo
|
||||||
local nAddGrpId = WL.GetAddGroup( Proc.PartId)
|
local nAddGrpId = WL.GetAddGroup( Proc.PartId)
|
||||||
-- ricavo contorno inferiore della superficie
|
-- ricavo contorno inferiore della superficie
|
||||||
local nAngledCircleId, nAngledCircleCnt = EgtExtractSurfTmLoops( Proc.Id, nAddGrpId)
|
local nAngledCircleId, nAngledCircleCnt = EgtExtractSurfTmLoops( Proc.Id, nAddGrpId)
|
||||||
local dMinZ = 10000
|
local dMinZ = 10000
|
||||||
local nMinCircleId = GDB_ID.NULL
|
local nMinCircleId = GDB_ID.NULL
|
||||||
for Circleindex = 1, nAngledCircleCnt do
|
for Circleindex = 1, nAngledCircleCnt do
|
||||||
local b3Circle = EgtGetBBoxGlob( nAngledCircleId + Circleindex -1, GDB_BB.EXACT)
|
local b3Circle = EgtGetBBoxGlob( nAngledCircleId + Circleindex -1, GDB_BB.EXACT)
|
||||||
if b3Circle:getMin():getZ() < dMinZ then
|
if b3Circle:getMin():getZ() < dMinZ then
|
||||||
nMinCircleId = nAngledCircleId + Circleindex -1
|
nMinCircleId = nAngledCircleId + Circleindex -1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
-- estrudo
|
||||||
|
EgtModifyCurveExtrusion( nMinCircleId, vtExtr, GDB_RT.GLOB)
|
||||||
|
EgtModifyCurveThickness( nMinCircleId, dLen)
|
||||||
|
bAngledContourDrill = true
|
||||||
|
nAngledContourDrillId = nMinCircleId
|
||||||
|
-- se non inclinato e abbastanza grande uso i tab
|
||||||
|
-- TODO se si risolve il problema dei tabs non funzionanti sotto ai 200 mm rimuovere il check sul diametro
|
||||||
|
elseif dDiam > 100 - 10 * GEO.EPS_SMALL then
|
||||||
|
bUseTabs = true
|
||||||
|
-- se non inclinato e piccolo non arrivo sul fondo
|
||||||
|
else
|
||||||
|
dReduceDepth = 5
|
||||||
end
|
end
|
||||||
-- estrudo
|
|
||||||
EgtModifyCurveExtrusion( nMinCircleId, vtExtr, GDB_RT.GLOB)
|
|
||||||
EgtModifyCurveThickness( nMinCircleId, dLen)
|
|
||||||
bAngledContourDrill = true
|
|
||||||
nAngledContourDrillId = nMinCircleId
|
|
||||||
end
|
end
|
||||||
sDrilling = WM.FindMilling( 'FreeContour', dLen, nil, nil, nil, nil, true)
|
sDrilling = WM.FindMilling( 'FreeContour', dLen, nil, nil, nil, nil, true)
|
||||||
if sDrilling then
|
if sDrilling then
|
||||||
@@ -447,22 +503,38 @@ function WPD.Make( Proc, nRawId, b3Raw)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||||
-- Note utente
|
-- leggo eventuali note esistenti della lavorazione
|
||||||
local sUserNotes = ''
|
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
|
||||||
-- se foratura o svuotatura, dichiarazione nessuna generazione sfridi per Vmill
|
-- se foratura o svuotatura, dichiarazione nessuna generazione sfridi per Vmill
|
||||||
if nType == 'Drill' or nType == 'Pocket' then
|
if nType == 'Drill' or nType == 'Pocket' then
|
||||||
sUserNotes = 'VMRS=0;'
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'VMRS', 0)
|
||||||
end
|
end
|
||||||
-- se foratura
|
-- se foratura
|
||||||
if nType == 'Drill' then
|
if nType == 'Drill' then
|
||||||
-- aggiungo alle note massima elevazione (coincide con affondamento)
|
-- aggiungo alle note massima elevazione (coincide con affondamento)
|
||||||
sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( dDepth, 1) .. ';'
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dDepth, 1))
|
||||||
-- se foro passante, aggiungo questa qualifica alle note
|
-- se foro passante, aggiungo questa qualifica alle note
|
||||||
if bOpen then
|
if bOpen then
|
||||||
sUserNotes = sUserNotes .. 'Open=1;'
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'Open', 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
-- se lavorazione in doppio aggiungo le rispettive note
|
||||||
|
if Proc.Double and Proc.Double == 2 then
|
||||||
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double)
|
||||||
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'MirrorAx', Proc.MirrorAx)
|
||||||
|
end
|
||||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
||||||
|
if bUseTabs then
|
||||||
|
local dStep = EgtGetMachiningParam( MCH_MP.STEP)
|
||||||
|
EgtSetMachiningParam( MCH_MP.STEPTYPE, MCH_MILL_ST.ONEWAY)
|
||||||
|
EgtSetMachiningParam( MCH_MP.LEAVETAB, true)
|
||||||
|
EgtSetMachiningParam( MCH_MP.TABHEIGHT, EgtClamp( dStep, 0.15 * dDepth, 0.25 * dDepth ))
|
||||||
|
EgtSetMachiningParam( MCH_MP.TABLEN, EgtClamp( 2 * dDiamT, 0.1 * dDiam, 0.2 * dDiam ))
|
||||||
|
EgtSetMachiningParam( MCH_MP.TABANGLE, 45)
|
||||||
|
EgtSetMachiningParam( MCH_MP.TABDIST, 100)
|
||||||
|
EgtSetMachiningParam( MCH_MP.TABMIN, 3)
|
||||||
|
EgtSetMachiningParam( MCH_MP.TABMAX, 3)
|
||||||
|
end
|
||||||
-- eseguo
|
-- eseguo
|
||||||
if not EgtApplyMachining( true, false) then
|
if not EgtApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
|
|||||||
+131
-140
@@ -1,4 +1,4 @@
|
|||||||
-- ProcessFreeContour.lua by Egaltech s.r.l. 2023/10/02
|
-- ProcessFreeContour.lua by Egaltech s.r.l. 2024/03/24
|
||||||
-- Gestione calcolo profilo libero per Pareti
|
-- Gestione calcolo profilo libero per Pareti
|
||||||
-- 2021/11/15 Penna e chiodature sono sempre riportate sulla faccia sopra anche se nel progetto sono sotto.
|
-- 2021/11/15 Penna e chiodature sono sempre riportate sulla faccia sopra anche se nel progetto sono sotto.
|
||||||
-- 2021/12/10 In taglio con lama aggiunta gestione SCC per testa Gearbox.
|
-- 2021/12/10 In taglio con lama aggiunta gestione SCC per testa Gearbox.
|
||||||
@@ -25,6 +25,10 @@
|
|||||||
-- 2023/09/21 In MakeByMill modificato SCC per correggere caso con lama su testa fresa.
|
-- 2023/09/21 In MakeByMill modificato SCC per correggere caso con lama su testa fresa.
|
||||||
-- 2023/09/26 In Is3EdgesApprox aggiunta cancellazione dei loop temporanei.
|
-- 2023/09/26 In Is3EdgesApprox aggiunta cancellazione dei loop temporanei.
|
||||||
-- 2023/10/02 Correzione a MakeCustomPath per calcolare correttamente puliture spigoli di tipo 2 (Clean 30) e 3 (Gola di Scarico).
|
-- 2023/10/02 Correzione a MakeCustomPath per calcolare correttamente puliture spigoli di tipo 2 (Clean 30) e 3 (Gola di Scarico).
|
||||||
|
-- 2023/11/14 Spostamento di alcune funzioni in WallLib.
|
||||||
|
-- Aggiunta dei FreeContour in doppio.
|
||||||
|
-- 2023/12/13 In MakeByPocket aggiunta la possibilità di svuotare tasche passanti.
|
||||||
|
-- 2024/03/24 Sostituite funzioni di Collision Detection (EgtCDe*) con quelle di verifica interferenza (EgtTest*).
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local WPF = {}
|
local WPF = {}
|
||||||
@@ -155,64 +159,6 @@ function WPF.FlipClassify( Proc, b3Raw)
|
|||||||
return nFlip0, nFlip1
|
return nFlip0, nFlip1
|
||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
local function TestElleShape3( nIdGeom, nNumFacet)
|
|
||||||
-- valida solo nel caso di tre facce
|
|
||||||
if nNumFacet ~= 3 then return false end
|
|
||||||
-- determino se L con una faccia terminale o U con tre facce
|
|
||||||
local bIsL = true
|
|
||||||
for i = 1, 3 do
|
|
||||||
local vFacAdj = EgtSurfTmFacetAdjacencies( nIdGeom, i - 1)[1]
|
|
||||||
-- le conto
|
|
||||||
local nCount = 0
|
|
||||||
for j = 1, #vFacAdj do
|
|
||||||
if vFacAdj[j] >= 0 then
|
|
||||||
nCount = nCount + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if nCount == 1 then
|
|
||||||
bIsL = false
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return bIsL
|
|
||||||
end
|
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
local function TestElleShape4( nIdGeom, nNumFacet)
|
|
||||||
-- valida solo nel caso di quattro facce
|
|
||||||
if nNumFacet ~= 4 then return false end
|
|
||||||
-- determino se L con due facce terminali o O
|
|
||||||
local nFac3Adj = 0
|
|
||||||
local dMinArea3 = GEO.INFINITO * GEO.INFINITO
|
|
||||||
local dMaxArea2 = 0
|
|
||||||
for i = 1, 4 do
|
|
||||||
local vFacAdj = EgtSurfTmFacetAdjacencies( nIdGeom, i - 1)[1]
|
|
||||||
-- le conto
|
|
||||||
local nCount = 0
|
|
||||||
for j = 1, #vFacAdj do
|
|
||||||
if vFacAdj[j] >= 0 then
|
|
||||||
nCount = nCount + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( nIdGeom, i - 1, GDB_ID.ROOT)
|
|
||||||
local dArea = dH * dV
|
|
||||||
if nCount == 2 then
|
|
||||||
dMaxArea2 = max( dMaxArea2, dArea)
|
|
||||||
elseif nCount == 3 then
|
|
||||||
dMinArea3 = min( dMinArea3, dArea)
|
|
||||||
nFac3Adj = nFac3Adj + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if nFac3Adj ~= 2 then return false end
|
|
||||||
-- verifico se L profonda oppure lunga
|
|
||||||
if dMinArea3 < dMaxArea2 then
|
|
||||||
return 1
|
|
||||||
else
|
|
||||||
return 2
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
local function VerifyCornerType( Proc)
|
local function VerifyCornerType( Proc)
|
||||||
-- Verifico il tipo di lavorazione su angolo :
|
-- Verifico il tipo di lavorazione su angolo :
|
||||||
@@ -229,6 +175,22 @@ local function IsPointOnRawLongEdges( ptCen, b3Raw)
|
|||||||
return ( abs( ptCen:getY() - b3Raw:getMin():getY()) < 0.1 or abs( ptCen:getY() - b3Raw:getMax():getY()) < 0.1)
|
return ( abs( ptCen:getY() - b3Raw:getMin():getY()) < 0.1 or abs( ptCen:getY() - b3Raw:getMax():getY()) < 0.1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
local function IsFaceOutsideSquaring( Proc, Face, b3Squaring)
|
||||||
|
-- faccia esterna al box di squadratura
|
||||||
|
if b3Squaring then
|
||||||
|
local b3SquaringReduced = BBox3d( b3Squaring)
|
||||||
|
b3SquaringReduced:expand( -0.1)
|
||||||
|
local b3Face = EgtSurfTmGetFacetBBoxGlob( Proc.Id, Face.Fac, GDB_BB.STANDARD)
|
||||||
|
if not OverlapsXY( b3SquaringReduced, b3Face) then
|
||||||
|
EgtOutLog( 'Proc ' .. Proc.Id .. ': skipped face ' .. Face.Fac .. ' outside squaring' )
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
local function GetOtherRegions( nPartId)
|
local function GetOtherRegions( nPartId)
|
||||||
local vOthers = {}
|
local vOthers = {}
|
||||||
@@ -442,9 +404,12 @@ local function GetFacesData( Proc, bOpposite, bCalclForBlade, dToolDiam, dToolMa
|
|||||||
dLen = dLen - EgtIf( bCalclForBlade, dWhisk, 0)
|
dLen = dLen - EgtIf( bCalclForBlade, dWhisk, 0)
|
||||||
nType = nType + 2
|
nType = nType + 2
|
||||||
end
|
end
|
||||||
-- se lunghezza non significativa, non va inserito il taglio
|
-- se feature taglio esteremità o longitudinale ed è 1 faccia, non controllo lunghezza minima. Si controlla solo interferenza altri pezzi
|
||||||
if dLen < MIN_LEN_CUT then
|
if not( Proc.Prc == 10 and Proc.Fct == 1) then
|
||||||
nType = 4
|
-- se lunghezza non significativa, non va inserito il taglio
|
||||||
|
if dLen < MIN_LEN_CUT then
|
||||||
|
nType = 4
|
||||||
|
end
|
||||||
end
|
end
|
||||||
-- numero dei lati
|
-- numero dei lati
|
||||||
local nEdges = #(EgtSurfTmFacetAdjacencies( nNewProc, i - 1)[1])
|
local nEdges = #(EgtSurfTmFacetAdjacencies( nNewProc, i - 1)[1])
|
||||||
@@ -754,18 +719,17 @@ end
|
|||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
local function CalcInterference( nNewProc, vtExtr, ptCentr, dDiam1, dDiam2,
|
local function CalcInterference( nNewProc, vtExtr, ptCentr, dDiam1, dDiam2,
|
||||||
dTall1, dTall2, dDiam3, dTall3)
|
dTall1, dTall2, dDiam3, dTall3)
|
||||||
|
|
||||||
local ptCentrGrid1 = ptCentr + ( vtExtr * 0.01)
|
local ptCentrGrid1 = ptCentr + ( vtExtr * 0.01)
|
||||||
local frOriTool = Frame3d( ptCentrGrid1, vtExtr)
|
local frOriTool = Frame3d( ptCentrGrid1, vtExtr)
|
||||||
local bColl1 = EgtCDeConeSolid( frOriTool, dDiam1/2, dDiam2/2, dTall1, nNewProc, 0, GDB_RT.GLOB)
|
local bColl1 = EgtTestConeSurface( frOriTool, dDiam1/2, dDiam2/2, dTall1, nNewProc, 0, GDB_RT.GLOB)
|
||||||
if bColl1 then return true end
|
if bColl1 then return true end
|
||||||
local ptCentrGrid2 = ptCentr + ( vtExtr * ( dTall1 + 0.01))
|
local ptCentrGrid2 = ptCentr + ( vtExtr * ( dTall1 + 0.01))
|
||||||
frOriTool = Frame3d( ptCentrGrid2, vtExtr)
|
frOriTool = Frame3d( ptCentrGrid2, vtExtr)
|
||||||
local bColl2 = EgtCDeCylSolid( frOriTool, dDiam2/2, (dTall2-dTall1), nNewProc, 0, GDB_RT.GLOB)
|
local bColl2 = EgtTestCylSurface( frOriTool, dDiam2/2, (dTall2-dTall1), nNewProc, 0, GDB_RT.GLOB)
|
||||||
if bColl2 then return true end
|
if bColl2 then return true end
|
||||||
local ptCentrGrid3 = ptCentr + ( vtExtr * ( dTall2 + 0.01))
|
local ptCentrGrid3 = ptCentr + ( vtExtr * ( dTall2 + 0.01))
|
||||||
frOriTool = Frame3d( ptCentrGrid3, vtExtr)
|
frOriTool = Frame3d( ptCentrGrid3, vtExtr)
|
||||||
local bColl3 = EgtCDeCylSolid( frOriTool, dDiam3/2, (dTall3-dTall2), nNewProc, 0, GDB_RT.GLOB)
|
local bColl3 = EgtTestCylSurface( frOriTool, dDiam3/2, (dTall3-dTall2), nNewProc, 0, GDB_RT.GLOB)
|
||||||
if bColl3 then return true end
|
if bColl3 then return true end
|
||||||
-- restituisco risultato controllo collisioni
|
-- restituisco risultato controllo collisioni
|
||||||
return false
|
return false
|
||||||
@@ -813,9 +777,9 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
|
|||||||
-- creo superfice locale o esco
|
-- creo superfice locale o esco
|
||||||
local nSurfToAdd = MakeLocalSurf( tFacAdj[7], tFacAdj[8], tFacAdj[9], nAddGrpId)
|
local nSurfToAdd = MakeLocalSurf( tFacAdj[7], tFacAdj[8], tFacAdj[9], nAddGrpId)
|
||||||
if nSurfToAdd then
|
if nSurfToAdd then
|
||||||
local nFacCntPre = EgtSurfTmFacetCount( nNewProc)
|
local nFacCntPre = EgtSurfTmFacetCount( nNewProc.Id)
|
||||||
-- creo copia del percorso principale e gli aggiungo la nuova faccia
|
-- creo copia del percorso principale e gli aggiungo la nuova faccia
|
||||||
nNewProcLoc = EgtCopyGlob( nNewProc, nAddGrpId)
|
nNewProcLoc = EgtCopyGlob( nNewProc.Id, nAddGrpId)
|
||||||
nNewProcLoc = EgtSurfTmBySewing( nAddGrpId, {nNewProcLoc,nSurfToAdd} , true)
|
nNewProcLoc = EgtSurfTmBySewing( nAddGrpId, {nNewProcLoc,nSurfToAdd} , true)
|
||||||
-- riordino le facce
|
-- riordino le facce
|
||||||
ReorderFacesFromTab( nNewProcLoc, vFace)
|
ReorderFacesFromTab( nNewProcLoc, vFace)
|
||||||
@@ -826,7 +790,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
|
|||||||
return true, ''
|
return true, ''
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
nNewProcLoc = nNewProc
|
nNewProcLoc = nNewProc.Id
|
||||||
end
|
end
|
||||||
-- prendo il primo versore
|
-- prendo il primo versore
|
||||||
local _, vtN1 = EgtSurfTmFacetCenter( nNewProcLoc, nFacInd, GDB_ID.ROOT)
|
local _, vtN1 = EgtSurfTmFacetCenter( nNewProcLoc, nFacInd, GDB_ID.ROOT)
|
||||||
@@ -883,7 +847,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
|
|||||||
vtCheck:rotate( Z_AX(), dOffsAng)
|
vtCheck:rotate( Z_AX(), dOffsAng)
|
||||||
end
|
end
|
||||||
-- controllo se c'è collisione con le facce della superfice
|
-- controllo se c'è collisione con le facce della superfice
|
||||||
if nTypeConeCut == 1 and CalcInterference( nNewProc, vtCheck, tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), dDiam1, dDiam2,
|
if nTypeConeCut == 1 and CalcInterference( nNewProc.Id, vtCheck, tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), dDiam1, dDiam2,
|
||||||
dTall1, dTall2, dDiam3, dTall3) then
|
dTall1, dTall2, dDiam3, dTall3) then
|
||||||
local sErr = 'Collision detect from clean corner tool and surface'
|
local sErr = 'Collision detect from clean corner tool and surface'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
@@ -980,6 +944,8 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
|
|||||||
-- trasformo in percorso
|
-- trasformo in percorso
|
||||||
if #pAuxId > 0 then
|
if #pAuxId > 0 then
|
||||||
AuxId = EgtCurveCompo( nAddGrpId, pAuxId, true)
|
AuxId = EgtCurveCompo( nAddGrpId, pAuxId, true)
|
||||||
|
EgtSetInfo( AuxId, 'TASKID', nNewProc.TaskId)
|
||||||
|
EgtSetInfo( AuxId, 'CUTID', nNewProc.CutId)
|
||||||
end
|
end
|
||||||
-- se non c'é il percorso do errore
|
-- se non c'é il percorso do errore
|
||||||
if not AuxId then
|
if not AuxId then
|
||||||
@@ -994,8 +960,8 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
|
|||||||
EgtRotate( AuxId, tFacAdj[nIdEndPoint], Z_AX(), dOffsAng, GDB_RT.GLOB)
|
EgtRotate( AuxId, tFacAdj[nIdEndPoint], Z_AX(), dOffsAng, GDB_RT.GLOB)
|
||||||
end
|
end
|
||||||
-- inserisco la lavorazione
|
-- inserisco la lavorazione
|
||||||
local sName = 'Clean_' .. ( EgtGetName( nNewProc) or tostring( nNewProc))
|
local sName = 'Clean_' .. ( EgtGetName( nNewProc.Id) or tostring( nNewProc.Id))
|
||||||
local nMchId = WM.AddMachining( nNewProc, sName, sMilling)
|
local nMchId = WM.AddMachining( nNewProc.Id, sName, sMilling)
|
||||||
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)
|
||||||
@@ -1088,26 +1054,26 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
|
|||||||
-- verifico se ciclo chiuso
|
-- verifico se ciclo chiuso
|
||||||
local bClosed = ( abs( vFace[1].PrevAng) > 0.1)
|
local bClosed = ( abs( vFace[1].PrevAng) > 0.1)
|
||||||
-- copio la feature nel layer di appoggio
|
-- copio la feature nel layer di appoggio
|
||||||
local nNewProc
|
local nNewProc = { CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||||
if nMasterNewProc then
|
if nMasterNewProc then
|
||||||
nNewProc = nMasterNewProc
|
nNewProc.Id = nMasterNewProc
|
||||||
else
|
else
|
||||||
nNewProc = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
|
nNewProc.Id = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
|
||||||
end
|
end
|
||||||
local nFacCnt = EgtSurfTmFacetCount( nNewProc)
|
local nFacCnt = EgtSurfTmFacetCount( nNewProc.Id)
|
||||||
local nFacInd, dDepth, nSurfInt
|
local nFacInd, dDepth, nSurfInt
|
||||||
local bMakeLocSurf
|
local bMakeLocSurf
|
||||||
-- RIMUOVERE
|
-- RIMUOVERE
|
||||||
if false and nFacCnt <= 4 then
|
if false and nFacCnt <= 4 then
|
||||||
-- recupero profondità e faccia di fondo
|
-- recupero profondità e faccia di fondo
|
||||||
_, _, dDepth, _, _, nSurfInt = GetTunnelDimension( nNewProc, Proc.PartId, nAddGrpId, bClosed)
|
_, _, dDepth, _, _, nSurfInt = GetTunnelDimension( nNewProc.Id, Proc.PartId, nAddGrpId, bClosed)
|
||||||
if nSurfInt then
|
if nSurfInt then
|
||||||
-- aggiungo la faccia di fondo appena calcolata
|
-- aggiungo la faccia di fondo appena calcolata
|
||||||
nNewProc = EgtSurfTmBySewing( nAddGrpId, { nNewProc, nSurfInt}, true)
|
nNewProc.Id = EgtSurfTmBySewing( nAddGrpId, { nNewProc.Id, nSurfInt}, true)
|
||||||
-- riordino le facce
|
-- riordino le facce
|
||||||
ReorderFacesFromTab( nNewProc, vFace)
|
ReorderFacesFromTab( nNewProc.Id, vFace)
|
||||||
-- aggiorno numero di facce e assegno indice di quella di fondo (sempre ultima)
|
-- aggiorno numero di facce e assegno indice di quella di fondo (sempre ultima)
|
||||||
nFacCnt = EgtSurfTmFacetCount( nNewProc)
|
nFacCnt = EgtSurfTmFacetCount( nNewProc.Id)
|
||||||
nFacInd = nFacCnt - 1
|
nFacInd = nFacCnt - 1
|
||||||
else
|
else
|
||||||
return true
|
return true
|
||||||
@@ -1155,7 +1121,7 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
|
|||||||
ptLoc2 = vFace[k].PPrev
|
ptLoc2 = vFace[k].PPrev
|
||||||
end
|
end
|
||||||
-- ricavo i punti e l'angolo interno
|
-- ricavo i punti e l'angolo interno
|
||||||
local _, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( nNewProc, nFace1, nFace2, GDB_ID.ROOT)
|
local _, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( nNewProc.Id, nFace1, nFace2, GDB_ID.ROOT)
|
||||||
-- se punti validi e angolo è interno e non è quasi piatto e >= 90 creo istanza
|
-- se punti validi e angolo è interno e non è quasi piatto e >= 90 creo istanza
|
||||||
local tFacAdj = {}
|
local tFacAdj = {}
|
||||||
if ptP1 and ptP2 and dAng < 0 and dAng < -6 and dAng > EgtIf( nTypeConeCut == 1, -(90 + 10 * GEO.EPS_SMALL), -(180-dAngleSmall + 10 * GEO.EPS_SMALL)) then
|
if ptP1 and ptP2 and dAng < 0 and dAng < -6 and dAng > EgtIf( nTypeConeCut == 1, -(90 + 10 * GEO.EPS_SMALL), -(180-dAngleSmall + 10 * GEO.EPS_SMALL)) then
|
||||||
@@ -1193,8 +1159,8 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
|
|||||||
i = i + 1
|
i = i + 1
|
||||||
end
|
end
|
||||||
-- cancello la copia della superfice
|
-- cancello la copia della superfice
|
||||||
if nNewProc then
|
if nNewProc.Id then
|
||||||
EgtErase( nNewProc)
|
EgtErase( nNewProc.Id)
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@@ -1212,35 +1178,6 @@ local function GetMaxDepth( vtNz, dMillDiam, dDiamTh, dMaxDepth, dFreeLen)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
-- Funzione per determinare se la faccia ha lati molto corti (trascurabili) ed è quindi approssimabile ad una 3 facce
|
|
||||||
local function Is3EdgesApprox( Proc, nFacet, nAddGrpId)
|
|
||||||
nAddGrpId = nAddGrpId or WL.GetAddGroup( Proc.PartId)
|
|
||||||
-- recupero il contorno della faccia
|
|
||||||
local nContourId, nContourCnt = EgtExtractSurfTmFacetLoops( Proc.Id, nFacet, nAddGrpId)
|
|
||||||
if not nContourId then return false end
|
|
||||||
EgtMergeCurvesInCurveCompo( nContourId)
|
|
||||||
-- recupero il numero di lati del contorno
|
|
||||||
local _, nEntityCount = EgtCurveDomain( nContourId)
|
|
||||||
if not nEntityCount then return false end
|
|
||||||
-- se sono già tre, ho finito
|
|
||||||
if nEntityCount == 3 then return true end
|
|
||||||
-- rimuovo i lati molto corti dal conteggio totale
|
|
||||||
local nEdges = nEntityCount
|
|
||||||
for i = 1, nEntityCount do
|
|
||||||
local dLength = EgtCurveCompoLength( nContourId, i - 1)
|
|
||||||
if dLength < 15 then nEdges = nEdges - 1 end
|
|
||||||
end
|
|
||||||
-- verifico il numero significativo di lati
|
|
||||||
local bResult = ( nEdges == 3)
|
|
||||||
-- cancello tutti i contorni appena creati
|
|
||||||
EgtErase( EgtTableFill( nContourId, nContourCnt))
|
|
||||||
if bResult then
|
|
||||||
EgtOutLog( 'FreeContour : Face with ' .. tostring( nEntityCount) .. ' edges skipped (approx 3 edges)')
|
|
||||||
end
|
|
||||||
return bResult
|
|
||||||
end
|
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAddGrpId)
|
local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAddGrpId)
|
||||||
-- flag per fresature non passanti
|
-- flag per fresature non passanti
|
||||||
@@ -1263,7 +1200,7 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
|
|||||||
end
|
end
|
||||||
-- verifico se le facce hanno alcuni lati molto corti e possono quindi essere approssimate a 3 lati
|
-- verifico se le facce hanno alcuni lati molto corti e possono quindi essere approssimate a 3 lati
|
||||||
for currentFace = 1, #vFace do
|
for currentFace = 1, #vFace do
|
||||||
if Is3EdgesApprox( Proc, vFace[currentFace].Fac, nAddGrpId) then
|
if WL.Is3EdgesApprox( Proc, vFace[currentFace].Fac, nAddGrpId) then
|
||||||
vFace[currentFace].Is3EdgesApprox = true
|
vFace[currentFace].Is3EdgesApprox = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1369,6 +1306,8 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
|
|||||||
nSCC = EgtIf( abs( vFace[i].Norm:getX()) > abs( vFace[i].Norm:getY()), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_YP)
|
nSCC = EgtIf( abs( vFace[i].Norm:getX()) > abs( vFace[i].Norm:getY()), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_YP)
|
||||||
end
|
end
|
||||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||||
|
-- scrivo nell'operazione il vettore normale alla superfice che servirà per il doppio
|
||||||
|
EgtSetInfo( nMchId or GDB_ID.NULL, 'NORM_SUM', vFace[i].Norm)
|
||||||
-- eseguo
|
-- eseguo
|
||||||
if not EgtApplyMachining( true, false) then
|
if not EgtApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
@@ -1566,6 +1505,15 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
|
|||||||
-- posizione braccio porta testa
|
-- posizione braccio porta testa
|
||||||
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_XP)
|
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_XP)
|
||||||
end
|
end
|
||||||
|
--scrivo nell'operazione il vettore somma delle normali alle superfici che servirà per il doppio
|
||||||
|
local vtNSum = Vector3d( 0, 0, 0)
|
||||||
|
if Proc.Face and #Proc.Face > 0 then
|
||||||
|
for iGeom = 1, #vGeom do
|
||||||
|
local nFace = vGeom[iGeom][2]
|
||||||
|
vtNSum = vtNSum + Proc.Face[ nFace + 1].VtN
|
||||||
|
end
|
||||||
|
end
|
||||||
|
EgtSetInfo( nMchId or GDB_ID.NULL, 'NORM_SUM', vtNSum)
|
||||||
-- eseguo
|
-- eseguo
|
||||||
if not EgtApplyMachining( true, false) then
|
if not EgtApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
@@ -1628,6 +1576,8 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
|
|||||||
nSCC = EgtIf( abs( vFace[i].Norm:getX()) > abs( vFace[i].Norm:getY()), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_YP)
|
nSCC = EgtIf( abs( vFace[i].Norm:getX()) > abs( vFace[i].Norm:getY()), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_YP)
|
||||||
end
|
end
|
||||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||||
|
-- scrivo nell'operazione il vettore normale alla superfice che servirà per il doppio
|
||||||
|
EgtSetInfo( nMchId or GDB_ID.NULL, 'NORM_SUM', vFace[i].Norm)
|
||||||
-- eseguo
|
-- eseguo
|
||||||
if not EgtApplyMachining( true, false) then
|
if not EgtApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
@@ -1776,13 +1726,13 @@ local function AddSawings( sSawing, vFace, Proc, nRawId, b3Raw)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
local function AddCuts( sCutting, vFace, Proc, nRawId, b3Raw, dSawThick)
|
local function AddCuts( sCutting, vFace, Proc, nRawId, b3Raw, dSawThick, b3Squaring)
|
||||||
-- verifico se ciclo chiuso
|
-- verifico se ciclo chiuso
|
||||||
local bClosed = ( abs( vFace[1].PrevAng) > 0.1)
|
local bClosed = ( abs( vFace[1].PrevAng) > 0.1)
|
||||||
-- ciclo di inserimento dei tagli sulle facce del contorno in esame
|
-- ciclo di inserimento dei tagli sulle facce del contorno in esame
|
||||||
for i = 1, #vFace do
|
for i = 1, #vFace do
|
||||||
-- verifico se faccia da saltare, perchè macchina travi e faccia su bordo longitudinale esterno già finito
|
-- verifico se faccia da saltare, perchè macchina travi e faccia su bordo longitudinale esterno già finito oppure se faccia fuori dal box di squadratura
|
||||||
local bToSkip = ( WD.BEAM_MACHINE and IsPointOnRawLongEdges( vFace[i].Cen, b3Raw))
|
local bToSkip = ( WD.BEAM_MACHINE and IsPointOnRawLongEdges( vFace[i].Cen, b3Raw)) or IsFaceOutsideSquaring( Proc, vFace[i], b3Squaring)
|
||||||
-- se non è faccia da saltare, inserisco il taglio di lama
|
-- se non è faccia da saltare, inserisco il taglio di lama
|
||||||
if not bToSkip and vFace[i].Type ~= 4 then
|
if not bToSkip and vFace[i].Type ~= 4 then
|
||||||
-- indice del successivo
|
-- indice del successivo
|
||||||
@@ -1912,7 +1862,7 @@ local function AddCuts( sCutting, vFace, Proc, nRawId, b3Raw, dSawThick)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
local function MakeByCut( Proc, nRawId, b3Raw)
|
local function MakeByCut( Proc, nRawId, b3Raw, b3Squaring)
|
||||||
local sWarn = ''
|
local sWarn = ''
|
||||||
-- ingombro del pezzo
|
-- ingombro del pezzo
|
||||||
local Ls = EgtGetFirstNameInGroup( Proc.PartId, 'Box')
|
local Ls = EgtGetFirstNameInGroup( Proc.PartId, 'Box')
|
||||||
@@ -1958,9 +1908,9 @@ local function MakeByCut( Proc, nRawId, b3Raw)
|
|||||||
-- gruppo ausiliario
|
-- gruppo ausiliario
|
||||||
local nAddGrpId = WL.GetAddGroup( Proc.PartId)
|
local nAddGrpId = WL.GetAddGroup( Proc.PartId)
|
||||||
-- recupero i dati di tutte le facce
|
-- recupero i dati di tutte le facce
|
||||||
local vFace, dMaxWidth, nNewProc = GetFacesData( Proc, bOpposite, true, dSawDiam, dSawMaxDepth, dSawThick, nAddGrpId, b3Raw, nil)
|
local vFace, dMaxWidth, nNewProc = GetFacesData( Proc, bOpposite, true, dSawDiam, dSawMaxDepth, dSawThick, nAddGrpId, b3Raw)
|
||||||
-- inserimento dei tagli di lama
|
-- inserimento dei tagli di lama
|
||||||
local bCtOk, sCtErr = AddCuts( sCutting, vFace, Proc, nRawId, b3Raw, dSawThick)
|
local bCtOk, sCtErr = AddCuts( sCutting, vFace, Proc, nRawId, b3Raw, dSawThick, b3Squaring)
|
||||||
if not bCtOk then return bCtOk, sCtErr end
|
if not bCtOk then return bCtOk, sCtErr end
|
||||||
-- se richiesta solo lama, esco
|
-- se richiesta solo lama, esco
|
||||||
local nCntType = EgtGetInfo( Proc.Id, 'CNT_TYPE', 'i') or 0
|
local nCntType = EgtGetInfo( Proc.Id, 'CNT_TYPE', 'i') or 0
|
||||||
@@ -2174,7 +2124,7 @@ local function MakeByMill( Proc, nRawId, b3Raw)
|
|||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- se lamatura affondata speciale, setto attacco e stacco al centro
|
-- se lamatura affondata speciale (cliente 90480029), setto attacco e stacco al centro
|
||||||
local bIsRecessedCounterBore = ( Proc.Box:getMax():getZ() < b3Raw:getMax():getZ() + 10 * GEO.EPS_SMALL) and
|
local bIsRecessedCounterBore = ( Proc.Box:getMax():getZ() < b3Raw:getMax():getZ() + 10 * GEO.EPS_SMALL) and
|
||||||
( nTool_ID == WD.RECESSED_COUNTERBORE_TOOLID or 0) and
|
( nTool_ID == WD.RECESSED_COUNTERBORE_TOOLID or 0) and
|
||||||
( EgtCurveIsACircle( AuxId))
|
( EgtCurveIsACircle( AuxId))
|
||||||
@@ -2194,12 +2144,16 @@ local function MakeByMill( Proc, nRawId, b3Raw)
|
|||||||
EgtSetMachiningParam( MCH_MP.LOELEV, 0)
|
EgtSetMachiningParam( MCH_MP.LOELEV, 0)
|
||||||
-- imposto step
|
-- imposto step
|
||||||
local dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or 0
|
local dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or 0
|
||||||
local dStep = EgtGetMachiningParam( MCH_MP.STEP)
|
--
|
||||||
if dStep < GEO.EPS_SMALL then dStep = 0.75 * dMaxMat end
|
-- su richiesta del cliente 90480029 si usa sempre step unico a prescindere dalla geometria
|
||||||
local nStep = ceil( ( dDepth - dMaxMat) / dStep)
|
--
|
||||||
dStep = max( ( dDepth - dMaxMat) / max( nStep, 1), 0)
|
-- local dStep = EgtGetMachiningParam( MCH_MP.STEP)
|
||||||
local dMaxElev = max( ( nStep + 1) * dStep - GEO.EPS_SMALL, 0)
|
-- if dStep < GEO.EPS_SMALL then dStep = 0.75 * dMaxMat end
|
||||||
EgtSetMachiningParam( MCH_MP.STEP, dStep)
|
-- local nStep = ceil( ( dDepth - dMaxMat) / dStep)
|
||||||
|
-- dStep = max( ( dDepth - dMaxMat) / max( nStep, 1), 0)
|
||||||
|
-- local dMaxElev = max( ( nStep + 1) * dStep - GEO.EPS_SMALL, 0)
|
||||||
|
EgtSetMachiningParam( MCH_MP.STEP, dMaxMat)
|
||||||
|
local dMaxElev = dMaxMat
|
||||||
-- imposto elevazione e forzo attacco dal lato aperto
|
-- imposto elevazione e forzo attacco dal lato aperto
|
||||||
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxElev, 1) .. ';OutRaw=3;')
|
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxElev, 1) .. ';OutRaw=3;')
|
||||||
end
|
end
|
||||||
@@ -2424,6 +2378,7 @@ end
|
|||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
local function MakeByPocket( Proc, nRawId, b3Raw)
|
local function MakeByPocket( Proc, nRawId, b3Raw)
|
||||||
-- recupero e verifico l'entità curva
|
-- recupero e verifico l'entità curva
|
||||||
|
local nAddGrpId = WL.GetAddGroup( Proc.PartId)
|
||||||
local bOpposite = false
|
local bOpposite = false
|
||||||
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
|
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
|
||||||
local vtExtr
|
local vtExtr
|
||||||
@@ -2456,11 +2411,48 @@ local function MakeByPocket( Proc, nRawId, b3Raw)
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not nFacet then
|
-- se tasca verticale si permette la svuotatura anche se passante, lavorando la faccia di fondo aggiunta
|
||||||
return MakeByMill( Proc, nRawId, b3Raw)
|
local nProcTmWithAddedBottomSurfaceId
|
||||||
|
if not nFacet and not bPocketBotface and Proc.AffectedFaces.Top and Proc.AffectedFaces.Bottom and AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then
|
||||||
|
local nFirstLoopId, nLoopsCount = EgtExtractSurfTmLoops( Proc.Id, nAddGrpId)
|
||||||
|
local dMinZ = GEO.INFINITO
|
||||||
|
local nBottomLoopId = GDB_ID.NULL
|
||||||
|
for i = 1, nLoopsCount do
|
||||||
|
local nCurrentLoopId = nFirstLoopId + i - 1
|
||||||
|
local b3Loop = EgtGetBBoxGlob( nCurrentLoopId, GDB_BB.STANDARD)
|
||||||
|
local dCurrentZ = b3Loop:getMin():getZ()
|
||||||
|
if dCurrentZ < dMinZ then
|
||||||
|
dMinZ = dCurrentZ
|
||||||
|
nBottomLoopId = nCurrentLoopId
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local nAddedBottomSurface = EgtSurfTmByFlatContour( nAddGrpId, nBottomLoopId)
|
||||||
|
local vtNAddedBottomSurface = EgtSurfTmFacetNormVersor( nAddedBottomSurface, 0)
|
||||||
|
if AreOppositeVectorApprox( vtNAddedBottomSurface, Z_AX()) then EgtInvertSurf( nAddedBottomSurface) end
|
||||||
|
nProcTmWithAddedBottomSurfaceId = EgtSurfTmBySewing( nAddGrpId, { nAddedBottomSurface, Proc.Id}, false)
|
||||||
|
if nProcTmWithAddedBottomSurfaceId then
|
||||||
|
-- ricerco la faccia di fondo della trimesh (gli id potrebbero essere cambiati)
|
||||||
|
for i = 1, Proc.Fct do
|
||||||
|
local vtN = EgtSurfTmFacetNormVersor( nProcTmWithAddedBottomSurfaceId, i-1, GDB_ID.ROOT)
|
||||||
|
if abs( vtN * vtExtr) > 0.99 then
|
||||||
|
nFacet = i - 1
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- elimino le geometrie che non servono più
|
||||||
|
for i = 1, nLoopsCount do
|
||||||
|
EgtErase( nFirstLoopId + i - 1)
|
||||||
|
end
|
||||||
|
EgtErase( nAddedBottomSurface)
|
||||||
end
|
end
|
||||||
|
if not nFacet then
|
||||||
|
return MakeByMill( Proc, nRawId, b3Raw, b3Squaring)
|
||||||
|
end
|
||||||
|
-- se ho creato la faccia di fondo utilizzo quella
|
||||||
|
local nSurfId = nProcTmWithAddedBottomSurfaceId or Proc.Id
|
||||||
-- se la faccia di fondo ha confini aperti, devo lavorarla direttamente
|
-- se la faccia di fondo ha confini aperti, devo lavorarla direttamente
|
||||||
local vAdj = EgtSurfTmFacetAdjacencies( Proc.Id, nFacet)[1] or {}
|
local vAdj = EgtSurfTmFacetAdjacencies( nSurfId, nFacet)[1] or {}
|
||||||
for i = 1, #vAdj do
|
for i = 1, #vAdj do
|
||||||
if vAdj[i] == - 1 then
|
if vAdj[i] == - 1 then
|
||||||
bPocketBotface = true
|
bPocketBotface = true
|
||||||
@@ -2471,16 +2463,15 @@ local function MakeByPocket( Proc, nRawId, b3Raw)
|
|||||||
local dDepth = EgtIf( bPocketBotface, 0, abs( EgtCurveThickness( AuxId)))
|
local dDepth = EgtIf( bPocketBotface, 0, abs( EgtCurveThickness( AuxId)))
|
||||||
local dOriDepth = dDepth
|
local dOriDepth = dDepth
|
||||||
-- dati della faccia di fondo
|
-- dati della faccia di fondo
|
||||||
local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacet, GDB_ID.ROOT)
|
local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( nSurfId, nFacet, GDB_ID.ROOT)
|
||||||
local dDiam = min( dH, dV)
|
local dDiam = min( dH, dV)
|
||||||
local dElev = WL.GetFaceElevation( Proc.Id, nFacet, nRawId)
|
local dElev = WL.GetFaceElevation( nSurfId, nFacet, nRawId)
|
||||||
-- gruppo ausiliario
|
-- gruppo ausiliario
|
||||||
local nAddGrpId = WL.GetAddGroup( Proc.PartId)
|
|
||||||
local nNewProc, nNumFacet = RemoveBottomFaceAndReorder( Proc, nAddGrpId, nFacet)
|
local nNewProc, nNumFacet = RemoveBottomFaceAndReorder( Proc, nAddGrpId, nFacet)
|
||||||
-- se ho forma a L
|
-- se ho forma a L
|
||||||
local bIsL = ( nNumFacet == 2 or TestElleShape3( nNewProc, nNumFacet) or TestElleShape4( nNewProc, nNumFacet) == 2)
|
local bIsL = ( nNumFacet == 2 or WL.TestElleShape3( nNewProc, nNumFacet) or WL.TestElleShape4( nNewProc, nNumFacet) == 2)
|
||||||
-- verifico se U
|
-- verifico se U
|
||||||
local bIsU = ( nNumFacet == 3 and not TestElleShape3( nNewProc, nNumFacet))
|
local bIsU = ( nNumFacet == 3 and not WL.TestElleShape3( nNewProc, nNumFacet))
|
||||||
local dMiddleFacetLength = 0
|
local dMiddleFacetLength = 0
|
||||||
if bIsU then
|
if bIsU then
|
||||||
local _, dH2, dV2 = EgtSurfTmFacetMinAreaRectangle( nNewProc, 1, GDB_ID.ROOT)
|
local _, dH2, dV2 = EgtSurfTmFacetMinAreaRectangle( nNewProc, 1, GDB_ID.ROOT)
|
||||||
@@ -2514,7 +2505,7 @@ local function MakeByPocket( Proc, nRawId, b3Raw)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- inserisco la lavorazione di svuotatura
|
-- inserisco la lavorazione di svuotatura
|
||||||
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
local sName = 'Pock_' .. ( EgtGetName( nSurfId) or tostring( nSurfId))
|
||||||
local nMchFId = WM.AddMachining( Proc, sName, sPocketing)
|
local nMchFId = WM.AddMachining( Proc, sName, sPocketing)
|
||||||
if not nMchFId then
|
if not nMchFId then
|
||||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
|
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
|
||||||
@@ -2524,7 +2515,7 @@ local function MakeByPocket( Proc, nRawId, b3Raw)
|
|||||||
EgtSetInfo( nMchFId, 'Part', Proc.PartId)
|
EgtSetInfo( nMchFId, 'Part', Proc.PartId)
|
||||||
-- aggiungo geometria
|
-- aggiungo geometria
|
||||||
if bPocketBotface then
|
if bPocketBotface then
|
||||||
EgtSetMachiningGeometry( {{ Proc.Id, nFacet}})
|
EgtSetMachiningGeometry( {{ nSurfId, nFacet}})
|
||||||
else
|
else
|
||||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||||
end
|
end
|
||||||
@@ -2557,7 +2548,7 @@ local function MakeByPocket( Proc, nRawId, b3Raw)
|
|||||||
local bAppOk = EgtApplyMachining( true, false)
|
local bAppOk = EgtApplyMachining( true, false)
|
||||||
if not bAppOk and not bPocketBotface then
|
if not bAppOk and not bPocketBotface then
|
||||||
bPocketBotface = true
|
bPocketBotface = true
|
||||||
EgtSetMachiningGeometry( {{ Proc.Id, nFacet}})
|
EgtSetMachiningGeometry( {{ nSurfId, nFacet}})
|
||||||
dDepth = 0
|
dDepth = 0
|
||||||
local dThElev = dThDiam / 2 * sqrt( vtExtr:getX() * vtExtr:getX() + vtExtr:getY() * vtExtr:getY())
|
local dThElev = dThDiam / 2 * sqrt( vtExtr:getX() * vtExtr:getX() + vtExtr:getY() * vtExtr:getY())
|
||||||
if dElev + dThElev > dMaxDepth + 10 * GEO.EPS_SMALL then
|
if dElev + dThElev > dMaxDepth + 10 * GEO.EPS_SMALL then
|
||||||
@@ -2589,7 +2580,7 @@ local function MakeByPocket( Proc, nRawId, b3Raw)
|
|||||||
else
|
else
|
||||||
EgtErase( nNewProc)
|
EgtErase( nNewProc)
|
||||||
if nConeCut == 1 then
|
if nConeCut == 1 then
|
||||||
local sErr = 'Clean corner 60° not applid because thickness: ' .. EgtNumToString( dThick, 2) ..
|
local sErr = 'Clean corner 60° not applied because thickness: ' .. EgtNumToString( dThick, 2) ..
|
||||||
' is bigger than parameter MAX_CLEAN_CRN60: ' .. EgtNumToString( WD.MAX_CLEAN_CRN60 , 2)
|
' is bigger than parameter MAX_CLEAN_CRN60: ' .. EgtNumToString( WD.MAX_CLEAN_CRN60 , 2)
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
elseif nConeCut == 2 then
|
elseif nConeCut == 2 then
|
||||||
@@ -2603,7 +2594,7 @@ end
|
|||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
-- Applicazione della lavorazione
|
-- Applicazione della lavorazione
|
||||||
function WPF.Make( Proc, nRawId, b3Raw, vNLO)
|
function WPF.Make( Proc, nRawId, b3Raw, vNLO, b3Squaring)
|
||||||
-- recupero la tipologia (contorno o tasca)
|
-- recupero la tipologia (contorno o tasca)
|
||||||
local bPocket = ( EgtGetInfo( Proc.Id, 'PCKT', 'i') == 1)
|
local bPocket = ( EgtGetInfo( Proc.Id, 'PCKT', 'i') == 1)
|
||||||
-- se svuotatura
|
-- se svuotatura
|
||||||
@@ -2626,7 +2617,7 @@ function WPF.Make( Proc, nRawId, b3Raw, vNLO)
|
|||||||
return MakeByNail( Proc, nRawId, b3Raw, vNLO)
|
return MakeByNail( Proc, nRawId, b3Raw, vNLO)
|
||||||
-- altrimenti, taglio con lama e pulizia angoli con fresa
|
-- altrimenti, taglio con lama e pulizia angoli con fresa
|
||||||
else
|
else
|
||||||
return MakeByCut( Proc, nRawId, b3Raw)
|
return MakeByCut( Proc, nRawId, b3Raw, b3Squaring)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+417
-153
@@ -30,6 +30,11 @@
|
|||||||
-- 2023/09/21 Modifica controllo lavorabilità con tre facce tipo tunnel ma non ortogonali tra loro.
|
-- 2023/09/21 Modifica controllo lavorabilità con tre facce tipo tunnel ma non ortogonali tra loro.
|
||||||
-- 2023/09/21 In MakeByMill modificato SCC per correggere caso con lama su testa fresa.
|
-- 2023/09/21 In MakeByMill modificato SCC per correggere caso con lama su testa fresa.
|
||||||
-- 2023/10/02 Aggiunta segnalazione lavorazione tipo Side non trovata.
|
-- 2023/10/02 Aggiunta segnalazione lavorazione tipo Side non trovata.
|
||||||
|
-- 2023/11/14 Aggiunta tasche in doppio.
|
||||||
|
-- Miglioramenti sostanziali nella gestione delle tasche.
|
||||||
|
-- 2023/11/16 Fresature a salire estese a groove cieche.
|
||||||
|
-- 2024/02/20 Piccola correzione ai casi in cui si utilizza il SIDESTEP.
|
||||||
|
-- 2024/08/09 In MakeByMill, se fresa Side trovata ma non applicabile, si considera come se non trovata
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local WPL = {}
|
local WPL = {}
|
||||||
@@ -358,64 +363,6 @@ function WPL.FlipClassify( Proc)
|
|||||||
return nFlip0, nFlip1
|
return nFlip0, nFlip1
|
||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
local function TestElleShape3( nIdGeom, nNumFacet)
|
|
||||||
-- valida solo nel caso di tre facce
|
|
||||||
if nNumFacet ~= 3 then return false end
|
|
||||||
-- determino se L con una faccia terminale o U con tre facce
|
|
||||||
local bIsL = true
|
|
||||||
for i = 1, 3 do
|
|
||||||
local vFacAdj = EgtSurfTmFacetAdjacencies( nIdGeom, i - 1)[1]
|
|
||||||
-- le conto
|
|
||||||
local nCount = 0
|
|
||||||
for j = 1, #vFacAdj do
|
|
||||||
if vFacAdj[j] >= 0 then
|
|
||||||
nCount = nCount + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if nCount == 1 then
|
|
||||||
bIsL = false
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return bIsL
|
|
||||||
end
|
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
local function TestElleShape4( nIdGeom, nNumFacet)
|
|
||||||
-- valida solo nel caso di quattro facce
|
|
||||||
if nNumFacet ~= 4 then return false end
|
|
||||||
-- determino se L con due facce terminali o O
|
|
||||||
local nFac3Adj = 0
|
|
||||||
local dMinArea3 = GEO.INFINITO * GEO.INFINITO
|
|
||||||
local dMaxArea2 = 0
|
|
||||||
for i = 1, 4 do
|
|
||||||
local vFacAdj = EgtSurfTmFacetAdjacencies( nIdGeom, i - 1)[1]
|
|
||||||
-- le conto
|
|
||||||
local nCount = 0
|
|
||||||
for j = 1, #vFacAdj do
|
|
||||||
if vFacAdj[j] >= 0 then
|
|
||||||
nCount = nCount + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( nIdGeom, i - 1, GDB_ID.ROOT)
|
|
||||||
local dArea = dH * dV
|
|
||||||
if nCount == 2 then
|
|
||||||
dMaxArea2 = max( dMaxArea2, dArea)
|
|
||||||
elseif nCount == 3 then
|
|
||||||
dMinArea3 = min( dMinArea3, dArea)
|
|
||||||
nFac3Adj = nFac3Adj + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if nFac3Adj ~= 2 then return false end
|
|
||||||
-- verifico se L profonda oppure lunga
|
|
||||||
if dMinArea3 < dMaxArea2 then
|
|
||||||
return 1
|
|
||||||
else
|
|
||||||
return 2
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
local function GetOtherRegions( nPartId)
|
local function GetOtherRegions( nPartId)
|
||||||
local vOthers = {}
|
local vOthers = {}
|
||||||
@@ -813,9 +760,9 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
|
|||||||
-- creo superfice locale o esco
|
-- creo superfice locale o esco
|
||||||
local nSurfToAdd = MakeLocalSurf( tFacAdj[7], tFacAdj[8], tFacAdj[9], nAddGrpId)
|
local nSurfToAdd = MakeLocalSurf( tFacAdj[7], tFacAdj[8], tFacAdj[9], nAddGrpId)
|
||||||
if nSurfToAdd then
|
if nSurfToAdd then
|
||||||
local nFacCntPre = EgtSurfTmFacetCount( nNewProc)
|
local nFacCntPre = EgtSurfTmFacetCount( nNewProc.Id)
|
||||||
-- creo copia del percorso principale e gli aggiungo la nuova faccia
|
-- creo copia del percorso principale e gli aggiungo la nuova faccia
|
||||||
nNewProcLoc = EgtCopyGlob( nNewProc, nAddGrpId)
|
nNewProcLoc = EgtCopyGlob( nNewProc.Id, nAddGrpId)
|
||||||
nNewProcLoc = EgtSurfTmBySewing( nAddGrpId, {nNewProcLoc,nSurfToAdd} , true)
|
nNewProcLoc = EgtSurfTmBySewing( nAddGrpId, {nNewProcLoc,nSurfToAdd} , true)
|
||||||
-- riordino le facce
|
-- riordino le facce
|
||||||
nNewProcLoc = ReorderFacesFromTab( nNewProcLoc, vFace)
|
nNewProcLoc = ReorderFacesFromTab( nNewProcLoc, vFace)
|
||||||
@@ -828,7 +775,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
|
|||||||
return true, ''
|
return true, ''
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
nNewProcLoc = nNewProc
|
nNewProcLoc = nNewProc.Id
|
||||||
end
|
end
|
||||||
-- prendo il primo versore
|
-- prendo il primo versore
|
||||||
local _, vtN1 = EgtSurfTmFacetCenter( nNewProcLoc, nFacInd, GDB_ID.ROOT)
|
local _, vtN1 = EgtSurfTmFacetCenter( nNewProcLoc, nFacInd, GDB_ID.ROOT)
|
||||||
@@ -882,7 +829,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
|
|||||||
vtCheck:rotate( Z_AX(), dOffsAng)
|
vtCheck:rotate( Z_AX(), dOffsAng)
|
||||||
end
|
end
|
||||||
-- controllo se c'è collisione con le facce della superfice
|
-- controllo se c'è collisione con le facce della superfice
|
||||||
if nTypeConeCut == 1 and CalcInterference( nNewProc, vtCheck, tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), dDiam1, dDiam2,
|
if nTypeConeCut == 1 and CalcInterference( nNewProc.Id, vtCheck, tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), dDiam1, dDiam2,
|
||||||
dTall1, dTall2, dDiam3, dTall3) then
|
dTall1, dTall2, dDiam3, dTall3) then
|
||||||
local sErr = 'Collision detect from clean corner tool and surface'
|
local sErr = 'Collision detect from clean corner tool and surface'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
@@ -979,6 +926,8 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
|
|||||||
-- trasformo in percorso
|
-- trasformo in percorso
|
||||||
if #pAuxId > 0 then
|
if #pAuxId > 0 then
|
||||||
AuxId = EgtCurveCompo( nAddGrpId, pAuxId, true)
|
AuxId = EgtCurveCompo( nAddGrpId, pAuxId, true)
|
||||||
|
EgtSetInfo( AuxId, 'TASKID', nNewProc.TaskId)
|
||||||
|
EgtSetInfo( AuxId, 'CUTID', nNewProc.CutId)
|
||||||
end
|
end
|
||||||
-- se non c'é il percorso do errore
|
-- se non c'é il percorso do errore
|
||||||
if not AuxId then
|
if not AuxId then
|
||||||
@@ -993,8 +942,8 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
|
|||||||
EgtRotate( AuxId, tFacAdj[nIdEndPoint], Z_AX(), dOffsAng, GDB_RT.GLOB)
|
EgtRotate( AuxId, tFacAdj[nIdEndPoint], Z_AX(), dOffsAng, GDB_RT.GLOB)
|
||||||
end
|
end
|
||||||
-- inserisco la lavorazione
|
-- inserisco la lavorazione
|
||||||
local sName = 'Clean_' .. ( EgtGetName( nNewProc) or tostring( nNewProc))
|
local sName = 'Clean_' .. ( EgtGetName( nNewProc.Id) or tostring( nNewProc.Id))
|
||||||
local nMchId = WM.AddMachining( nNewProc, sName, sMilling)
|
local nMchId = WM.AddMachining( nNewProc.Id, sName, sMilling)
|
||||||
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)
|
||||||
@@ -1088,27 +1037,27 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- copio la feature nel layer di appoggio
|
-- copio la feature nel layer di appoggio
|
||||||
local nNewProc
|
local nNewProc = { CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||||
if nMasterNewProc then
|
if nMasterNewProc then
|
||||||
nNewProc = nMasterNewProc
|
nNewProc.Id = nMasterNewProc
|
||||||
else
|
else
|
||||||
nNewProc = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
|
nNewProc.Id = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
|
||||||
end
|
end
|
||||||
local nFacCnt = EgtSurfTmFacetCount( nNewProc)
|
local nFacCnt = EgtSurfTmFacetCount( nNewProc.Id)
|
||||||
local nFacInd, dDimMin, dDimMax, dDepth, nSurfInt
|
local nFacInd, dDimMin, dDimMax, dDepth, nSurfInt
|
||||||
local bMakeLocSurf
|
local bMakeLocSurf
|
||||||
-- RIMUOVERE
|
-- RIMUOVERE
|
||||||
if false and nFacCnt <= 4 then
|
if false and nFacCnt <= 4 then
|
||||||
-- ottengo le dimensioni apertura, la normale e la faccia inferiore
|
-- ottengo le dimensioni apertura, la normale e la faccia inferiore
|
||||||
dDimMin, dDimMax, dDepth, _, _, nSurfInt = GetTunnelDimension( nNewProc, Proc.PartId, nAddGrpId)
|
dDimMin, dDimMax, dDepth, _, _, nSurfInt = GetTunnelDimension( nNewProc.Id, Proc.PartId, nAddGrpId)
|
||||||
if nSurfInt then
|
if nSurfInt then
|
||||||
-- uso la dimensione minima anche nel caso che la cava sborda perchè la lavorazione potrebbe collidere con un pezzo limitrofo
|
-- uso la dimensione minima anche nel caso che la cava sborda perchè la lavorazione potrebbe collidere con un pezzo limitrofo
|
||||||
local dMinWidth = dDimMin
|
local dMinWidth = dDimMin
|
||||||
nNewProc = EgtSurfTmBySewing( nAddGrpId, {nNewProc,nSurfInt} , true)
|
nNewProc.Id = EgtSurfTmBySewing( nAddGrpId, {nNewProc.Id,nSurfInt} , true)
|
||||||
-- riordino le facce
|
-- riordino le facce
|
||||||
nNewProc = ReorderFacesFromTab( nNewProc, vFace)
|
nNewProc.Id = ReorderFacesFromTab( nNewProc.Id, vFace)
|
||||||
-- acquisisco il numero della faccia
|
-- acquisisco il numero della faccia
|
||||||
nFacCnt = EgtSurfTmFacetCount( nNewProc)
|
nFacCnt = EgtSurfTmFacetCount( nNewProc.Id)
|
||||||
nFacInd = nFacCnt - 1
|
nFacInd = nFacCnt - 1
|
||||||
else
|
else
|
||||||
local sErr = 'Error : cannot create base surface'
|
local sErr = 'Error : cannot create base surface'
|
||||||
@@ -1160,7 +1109,7 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
|
|||||||
ptLoc2 = vFace[k].PPrev
|
ptLoc2 = vFace[k].PPrev
|
||||||
end
|
end
|
||||||
-- ricavo i punti e l'angolo interno
|
-- ricavo i punti e l'angolo interno
|
||||||
local _, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( nNewProc, nFace1, nFace2, GDB_ID.ROOT)
|
local _, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( nNewProc.Id, nFace1, nFace2, GDB_ID.ROOT)
|
||||||
-- se punti validi e angolo è interno e non è quasi piatto e >= 90 creo istanza
|
-- se punti validi e angolo è interno e non è quasi piatto e >= 90 creo istanza
|
||||||
local tFacAdj = {}
|
local tFacAdj = {}
|
||||||
if ptP1 and ptP2 and dAng < 0 and dAng < -6 and dAng > EgtIf( nTypeConeCut == 1, -(90 + 10 * GEO.EPS_SMALL), -(180-dAngleSmall + 10 * GEO.EPS_SMALL)) then
|
if ptP1 and ptP2 and dAng < 0 and dAng < -6 and dAng > EgtIf( nTypeConeCut == 1, -(90 + 10 * GEO.EPS_SMALL), -(180-dAngleSmall + 10 * GEO.EPS_SMALL)) then
|
||||||
@@ -1198,8 +1147,8 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
|
|||||||
i = i + 1
|
i = i + 1
|
||||||
end
|
end
|
||||||
-- cancello la copia della superfice
|
-- cancello la copia della superfice
|
||||||
if nNewProc then
|
if nNewProc.Id then
|
||||||
EgtErase(nNewProc)
|
EgtErase( nNewProc.Id)
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@@ -1272,7 +1221,7 @@ local function MakeByChainSaw( Proc, nFacet, nRawId, b3Raw, dElev, dH, dV)
|
|||||||
local sStartAngs
|
local sStartAngs
|
||||||
if WD.GetChainSawStartAngs then
|
if WD.GetChainSawStartAngs then
|
||||||
local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, nFacAdj, GDB_ID.ROOT)
|
local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, nFacAdj, GDB_ID.ROOT)
|
||||||
sStartAngs = WD.GetChainSawStartAngs( vtN2)
|
sStartAngs = WD.GetChainSawStartAngs( vtN2, vtN, ptC)
|
||||||
end
|
end
|
||||||
-- Lati chiusi
|
-- Lati chiusi
|
||||||
local bOpenStart = false
|
local bOpenStart = false
|
||||||
@@ -1336,6 +1285,54 @@ local function MakeByChainSaw( Proc, nFacet, nRawId, b3Raw, dElev, dH, dV)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
-- restituisce true se la lavorazione potrebbe danneggiare le parti limitrofe
|
||||||
|
local function IsMachiningDamagingOtherParts( Proc, dMillDiameter, nRawId)
|
||||||
|
local bIsMachiningDamagingOtherParts = false
|
||||||
|
-- box da estendere in tutte le direzioni, compreso angolo cieco
|
||||||
|
local b3ProcExtended = EgtGetBBoxGlob( Proc.Id, GDB_BB.STANDARD)
|
||||||
|
-- punto minimo e massimo assoluti del box
|
||||||
|
local ptMin = b3ProcExtended:getMin()
|
||||||
|
local ptMax = b3ProcExtended:getMax()
|
||||||
|
-- estensione aggiunta ai box
|
||||||
|
local dBoxExtensionLength = dMillDiameter / 2 + 5
|
||||||
|
-- check box verso X-
|
||||||
|
if Proc.AffectedFaces.Left then
|
||||||
|
local vtMove = Vector3d( -dBoxExtensionLength, 0, 0)
|
||||||
|
ptMin:move( vtMove)
|
||||||
|
end
|
||||||
|
-- check box verso X+
|
||||||
|
if Proc.AffectedFaces.Right then
|
||||||
|
local vtMove = Vector3d( dBoxExtensionLength, 0, 0)
|
||||||
|
ptMax:move( vtMove)
|
||||||
|
end
|
||||||
|
-- check box verso Y-
|
||||||
|
if Proc.AffectedFaces.Front then
|
||||||
|
local vtMove = Vector3d( 0, -dBoxExtensionLength, 0)
|
||||||
|
ptMin:move( vtMove)
|
||||||
|
end
|
||||||
|
-- check box verso Y+
|
||||||
|
if Proc.AffectedFaces.Back then
|
||||||
|
local vtMove = Vector3d( 0, dBoxExtensionLength, 0)
|
||||||
|
ptMax:move( vtMove)
|
||||||
|
end
|
||||||
|
-- estendo il box in direzione X e Y e verifico se interseca altre parti
|
||||||
|
b3ProcExtended:Add( ptMin)
|
||||||
|
b3ProcExtended:Add( ptMax)
|
||||||
|
local nPartId = EgtGetFirstPartInRawPart( nRawId)
|
||||||
|
while nPartId do
|
||||||
|
local nBoxSolidId = EgtGetFirstNameInGroup( nPartId, 'Box')
|
||||||
|
local b3Solid = EgtGetBBoxGlob( nBoxSolidId or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||||
|
b3Solid:expand( - 10 * GEO.EPS_SMALL)
|
||||||
|
if ( nPartId ~= Proc.PartId) and OverlapsXY( b3ProcExtended, b3Solid) then
|
||||||
|
bIsMachiningDamagingOtherParts = true
|
||||||
|
end
|
||||||
|
nPartId = EgtGetNextPartInRawPart( nPartId)
|
||||||
|
end
|
||||||
|
|
||||||
|
return bIsMachiningDamagingOtherParts
|
||||||
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
local function MakeByMill( Proc, nFacet, nOthFac, nRawId, b3Raw, dSideDist)
|
local function MakeByMill( Proc, nFacet, nOthFac, nRawId, b3Raw, dSideDist)
|
||||||
-- dati della faccia e dell'altra
|
-- dati della faccia e dell'altra
|
||||||
@@ -1346,10 +1343,18 @@ local function MakeByMill( Proc, nFacet, nOthFac, nRawId, b3Raw, dSideDist)
|
|||||||
local _, vtRef = EgtSurfTmFacetCenter( Proc.Id, nOthFac, GDB_ID.ROOT)
|
local _, vtRef = EgtSurfTmFacetCenter( Proc.Id, nOthFac, GDB_ID.ROOT)
|
||||||
-- recupero la lavorazione
|
-- recupero la lavorazione
|
||||||
local sMilling = WM.FindMilling( 'Side')
|
local sMilling = WM.FindMilling( 'Side')
|
||||||
|
if Proc.Double and Proc.Double == 2 then
|
||||||
|
local sMillingBackup = sMilling
|
||||||
|
sMilling = WM.FindMilling( 'Side', nil, nil, nil, nil, nil, nil, nil, 'H1')
|
||||||
|
if not WM.IsMachiningOkForDouble( sMilling) then
|
||||||
|
Proc.Double = 0
|
||||||
|
sMilling = sMillingBackup
|
||||||
|
end
|
||||||
|
end
|
||||||
if not sMilling then
|
if not sMilling then
|
||||||
local sErr = 'Error : Side not found in library'
|
local sErr = 'Error : Side not found in library'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr, true
|
||||||
end
|
end
|
||||||
-- recupero i dati dell'utensile
|
-- recupero i dati dell'utensile
|
||||||
local dMillDiam = 20
|
local dMillDiam = 20
|
||||||
@@ -1370,13 +1375,13 @@ local function MakeByMill( Proc, nFacet, nOthFac, nRawId, b3Raw, dSideDist)
|
|||||||
if dMillDiam < dDiam or dMaxDepth < dElev then
|
if dMillDiam < dDiam or dMaxDepth < dElev then
|
||||||
local sErr = 'Error : Side Elevation too big'
|
local sErr = 'Error : Side Elevation too big'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr, true
|
||||||
end
|
end
|
||||||
local dMillExtra = dMillTotLen - dMillLen
|
local dMillExtra = dMillTotLen - dMillLen
|
||||||
if Proc.Box:getMin():getZ() - dMillExtra < b3Raw:getMin():getZ() - 10 * GEO.EPS_SMALL then
|
if Proc.Box:getMin():getZ() - dMillExtra < b3Raw:getMin():getZ() - 10 * GEO.EPS_SMALL then
|
||||||
local sErr = 'Error : Tool collide with table'
|
local sErr = 'Error : Tool collide with table'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr, true
|
||||||
end
|
end
|
||||||
-- inserisco la lavorazione di contornatura
|
-- inserisco la lavorazione di contornatura
|
||||||
local sName = 'Mill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
local sName = 'Mill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||||
@@ -1413,6 +1418,16 @@ local function MakeByMill( Proc, nFacet, nOthFac, nRawId, b3Raw, dSideDist)
|
|||||||
-- imposto modo di lavorare la faccia
|
-- imposto modo di lavorare la faccia
|
||||||
local nFaceUse = WL.GetNearestOrthoOpposite( vtRef, vtN)
|
local nFaceUse = WL.GetNearestOrthoOpposite( vtRef, vtN)
|
||||||
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
||||||
|
-- leggo eventuali note esistenti della lavorazione
|
||||||
|
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
|
||||||
|
-- se lavorazione in doppio aggiungo le rispettive note
|
||||||
|
if Proc.Double and Proc.Double == 2 then
|
||||||
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double)
|
||||||
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'MirrorAx', Proc.MirrorAx)
|
||||||
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'DeltaZ', Proc.MirrorDeltaZ)
|
||||||
|
end
|
||||||
|
-- scrivo le note della lavorazione
|
||||||
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
||||||
-- eseguo
|
-- eseguo
|
||||||
if not EgtApplyMachining( true, false) then
|
if not EgtApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
@@ -1423,13 +1438,21 @@ local function MakeByMill( Proc, nFacet, nOthFac, nRawId, b3Raw, dSideDist)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, dMaxDepthOnSide, bEnablePreMill, bMachFromDn, dAng, bAsEnablePreMill, nSinglePass, bExcludeFinishing)
|
local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, dMaxDepthOnSide, bEnablePreMill, bMachFromDn, dAng, bAsEnablePreMill, nSinglePass, bExcludeFinishing, bDoubleCustomMach)
|
||||||
local sWarn
|
local sWarn
|
||||||
-- dati della faccia principale (la più verticale)
|
-- dati della faccia principale (la più verticale)
|
||||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacet, GDB_ID.ROOT)
|
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacet, GDB_ID.ROOT)
|
||||||
local dElev = WL.GetFaceElevation( Proc.Id, nFacet, nRawId)
|
local dElev = WL.GetFaceElevation( Proc.Id, nFacet, nRawId)
|
||||||
-- dati della faccia più orizzontale
|
-- dati della faccia più orizzontale
|
||||||
local nOtherFacet = abs( nFacet - 1)
|
local nOtherFacet
|
||||||
|
local dMinZ = 1
|
||||||
|
for i = 1, Proc.Fct do
|
||||||
|
local dCurrentZ = Proc.Face[i].VtN:getZ()
|
||||||
|
if dCurrentZ < dMinZ then
|
||||||
|
nOtherFacet = Proc.Face[i].Id
|
||||||
|
dMinZ = dCurrentZ
|
||||||
|
end
|
||||||
|
end
|
||||||
local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, nOtherFacet, GDB_ID.ROOT)
|
local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, nOtherFacet, GDB_ID.ROOT)
|
||||||
local dElevOtherFacet = WL.GetFaceElevation( Proc.Id, nOtherFacet, nRawId)
|
local dElevOtherFacet = WL.GetFaceElevation( Proc.Id, nOtherFacet, nRawId)
|
||||||
-- se lap joint 2 facce dal basso e angolo negativo
|
-- se lap joint 2 facce dal basso e angolo negativo
|
||||||
@@ -1444,9 +1467,20 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
|||||||
-- se ho lavorazione custom
|
-- se ho lavorazione custom
|
||||||
if sCustomMach then
|
if sCustomMach then
|
||||||
sMilling = sCustomMach
|
sMilling = sCustomMach
|
||||||
|
-- se avevo stabilito che la customMach non era adatta al double, setto per non specchiare
|
||||||
|
if not bDoubleCustomMach then Proc.Double = 0 end
|
||||||
-- altrimenti la cerco
|
-- altrimenti la cerco
|
||||||
else
|
else
|
||||||
sMilling = WM.FindMilling( 'SideGroove', nil, nil, nil, nil, min( dH, dV))
|
sMilling = WM.FindMilling( 'SideGroove', nil, nil, nil, nil, min( dH, dV))
|
||||||
|
-- se Proc è settata per essere specchiata cerco la lavorazione adatta e verifico possa essere effettivamente specchiata
|
||||||
|
if Proc.Double and Proc.Double == 2 then
|
||||||
|
local sMillOnSideBackup = sMilling
|
||||||
|
sMilling = WM.FindMilling( 'SideGroove', nil, nil, nil, nil, min( dH, dV), nil, nil, 'H1')
|
||||||
|
if not WM.IsMachiningOkForDouble( sMilling) then
|
||||||
|
Proc.Double = 0
|
||||||
|
sMilling = sMillOnSideBackup
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if not sMilling then
|
if not sMilling then
|
||||||
local sErr = 'Error : SideGroove not found in library'
|
local sErr = 'Error : SideGroove not found in library'
|
||||||
@@ -1497,10 +1531,14 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- se profondità ribasso è maggiore della capacità di sottosquadro dell'utensile
|
-- se profondità ribasso è maggiore della capacità di sottosquadro dell'utensile
|
||||||
if ( not bEnablePreMill and bMachFromDn) and ( dElev > 0.5 * ( dMillDiam - dMillDiamTh) - 10 * GEO.EPS_SMALL) then
|
if ( dElev > 0.5 * ( dMillDiam - dMillDiamTh) - 10 * GEO.EPS_SMALL) then
|
||||||
local sErr = 'Error : Side Elevation (' .. dElev .. ') bigger than max tool side depth (' .. ( 0.5 * ( dMillDiam - dMillDiamTh)) ..')'
|
if ( not bEnablePreMill and ( bMachFromDn or Proc.Fct > 2)) then
|
||||||
EgtOutLog( sErr)
|
local sErr = 'Error : Side Elevation (' .. dElev .. ') bigger than max tool side depth (' .. ( 0.5 * ( dMillDiam - dMillDiamTh)) ..')'
|
||||||
return false, sErr
|
EgtOutLog( sErr)
|
||||||
|
return false, sErr
|
||||||
|
elseif Proc.Double then
|
||||||
|
Proc.Double = 0
|
||||||
|
end
|
||||||
end
|
end
|
||||||
local dMillExtra = dMillTotLen - dMillLen
|
local dMillExtra = dMillTotLen - dMillLen
|
||||||
if Proc.Box:getMin():getZ() - dMillExtra < b3Raw:getMin():getZ() - 10 * GEO.EPS_SMALL then
|
if Proc.Box:getMin():getZ() - dMillExtra < b3Raw:getMin():getZ() - 10 * GEO.EPS_SMALL then
|
||||||
@@ -1655,13 +1693,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
|||||||
dExtraLongEnd = 0
|
dExtraLongEnd = 0
|
||||||
end
|
end
|
||||||
-- se ho abilitato la lavorazione di fresatura per garantire passaggio gambo utensile, inserisco la lavorazione
|
-- se ho abilitato la lavorazione di fresatura per garantire passaggio gambo utensile, inserisco la lavorazione
|
||||||
local bThroughRaw = false
|
|
||||||
if bEnablePreMill then
|
if bEnablePreMill then
|
||||||
-- verifico se feature e' passante
|
|
||||||
if ((Proc.Box:getMin():getX() < ( b3Raw:getMin():getX() + 50)) and (Proc.Box:getMax():getX() > ( b3Raw:getMax():getX() - 50))) or
|
|
||||||
((Proc.Box:getMin():getY() < ( b3Raw:getMin():getY() + 50)) and (Proc.Box:getMax():getY() > ( b3Raw:getMax():getY() - 50))) then
|
|
||||||
bThroughRaw = true
|
|
||||||
end
|
|
||||||
|
|
||||||
-- recupero la lavorazione di taglio
|
-- recupero la lavorazione di taglio
|
||||||
local sCuttingGorge = WM.FindCutting( 'Standard')
|
local sCuttingGorge = WM.FindCutting( 'Standard')
|
||||||
@@ -1709,7 +1741,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
|||||||
local bSawInvertSE = false
|
local bSawInvertSE = false
|
||||||
|
|
||||||
-- se non passante, aggiungo fresatura area della fresa
|
-- se non passante, aggiungo fresatura area della fresa
|
||||||
if not bThroughRaw and nNumStep - 1 > 0 then
|
if not Proc.IsThrough and nNumStep - 1 > 0 then
|
||||||
local SquareId -- Id della composita da fresare
|
local SquareId -- Id della composita da fresare
|
||||||
local dSawShortening = sqrt( b3Raw:getDimZ() * ( dSawDiam - b3Raw:getDimZ())) -- da calcolare in base a raggio lama e spessore grezzo
|
local dSawShortening = sqrt( b3Raw:getDimZ() * ( dSawDiam - b3Raw:getDimZ())) -- da calcolare in base a raggio lama e spessore grezzo
|
||||||
-- gruppo ausiliario
|
-- gruppo ausiliario
|
||||||
@@ -1867,14 +1899,86 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
|||||||
|
|
||||||
-- se la groove è rivolta verso il basso (-85°) lavoro a salire con step negativo
|
-- se la groove è rivolta verso il basso (-85°) lavoro a salire con step negativo
|
||||||
local bUpwardMilling = false
|
local bUpwardMilling = false
|
||||||
if Proc.Fct == 2 and vtN2:getZ() < -0.996 then
|
if vtN2:getZ() < -0.996 then
|
||||||
bUpwardMilling = true
|
bUpwardMilling = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- step extra in caso di doppio con mix rabbet dal basso e dall'alto, per eliminare la lamina che potrebbe rimanere
|
||||||
|
if Proc.Double and Proc.Double == 2 and ( Proc.Topology == 'Rabbet' or Proc.Topology == 'Groove') and
|
||||||
|
not ( Proc.AffectedFaces.Bottom and Proc.Mirror.AffectedFaces.Bottom) and not ( Proc.AffectedFaces.Top and Proc.AffectedFaces.Bottom) then
|
||||||
|
-- determino a quale delle due feature applicare la lavorazione
|
||||||
|
local bProcVsMirrorToCopy = true
|
||||||
|
local nFacetToMachine = nFacet
|
||||||
|
if Proc.AffectedFaces.Bottom then
|
||||||
|
bProcVsMirrorToCopy = false
|
||||||
|
for i = 1, Proc.Mirror.Fct do
|
||||||
|
local vtNMirror = Proc.Mirror.Face[i].VtN
|
||||||
|
if AreOppositeVectorApprox( vtN, vtNMirror) then
|
||||||
|
nFacetToMachine = Proc.Mirror.Face[i].Id
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local nAddGrpId = WL.GetAddGroup( EgtIf( bProcVsMirrorToCopy, Proc.PartId, Proc.Mirror.PartId))
|
||||||
|
local nNewProc = EgtCopyGlob( EgtIf( bProcVsMirrorToCopy, Proc.Id, Proc.Mirror.Id), nAddGrpId) or GDB_ID.NULL
|
||||||
|
local NewProc = { Id = nNewProc, PartId = EgtIf( bProcVsMirrorToCopy, Proc.PartId, Proc.Mirror.PartId)}
|
||||||
|
-- lavorazione
|
||||||
|
local sName = 'PreSideMill_' .. EgtGetName( NewProc.Id) or tostring( NewProc.Id)
|
||||||
|
local nMchFId = WM.AddMachining( NewProc, sName, sMilling)
|
||||||
|
if not nMchFId then
|
||||||
|
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
EgtSetInfo( nMchFId, 'Part', NewProc.PartId)
|
||||||
|
-- aggiungo geometria
|
||||||
|
EgtSetMachiningGeometry( {{ NewProc.Id, nFacetToMachine}})
|
||||||
|
-- imposto posizione braccio porta testa
|
||||||
|
local nSCC = MCH_SCC.ADIR_NEAR
|
||||||
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||||
|
-- imposto modo di lavorare la faccia
|
||||||
|
local nFaceUse = WL.GetNearestParalOpposite( Z_AX())
|
||||||
|
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
||||||
|
-- imposto elevazione e step
|
||||||
|
local dDepth = 5
|
||||||
|
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||||
|
EgtSetMachiningParam( MCH_MP.STEP, dElev)
|
||||||
|
-- setto il lato di lavoro standard
|
||||||
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||||
|
-- setto allungamenti iniziali e finali
|
||||||
|
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtraLongIni)
|
||||||
|
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtraLongEnd)
|
||||||
|
-- Confronto il raggio fresa con l'elevazione dalla normale per vedere se devo modificare l'uscita
|
||||||
|
if dElev > ( 0.5 * dMillDiam) then
|
||||||
|
-- setto allungamenti perpendicolari
|
||||||
|
EgtSetMachiningParam( MCH_MP.LIPERP, 0)
|
||||||
|
EgtSetMachiningParam( MCH_MP.LOPERP, 0)
|
||||||
|
end
|
||||||
|
-- se richiesto, setto la nota per spostare la lavorazione alla fine
|
||||||
|
if not WD.SIDEMILL_BEFORE then
|
||||||
|
EgtSetInfo( nMchFId, 'MOVE_AFTER', 1)
|
||||||
|
end
|
||||||
|
-- eseguo
|
||||||
|
if not EgtApplyMachining( true, false) then
|
||||||
|
-- provo a invertire posizione braccio porta testa
|
||||||
|
nSCC = MCH_SCC.ADIR_FAR
|
||||||
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||||
|
if not EgtApplyMachining( true, false) then
|
||||||
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
|
EgtSetOperationMode( nMchFId, false)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- se faccio lo step extra e ho rimosso la lamina, in doppio lavorerò dal basso verso l'alto
|
||||||
|
bUpwardMilling = true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- lavorazione
|
||||||
local dStepOri
|
local dStepOri
|
||||||
if not bExcludeSideMill then
|
if not bExcludeSideMill then
|
||||||
local nSideStep = 1
|
local nSideStep = 1
|
||||||
if dSideStep > 0 and not ( bEnablePreMill or bAsEnablePreMill) and nModifyLeadInOut < 1 then
|
if dSideStep > 0 and not ( bEnablePreMill or bAsEnablePreMill) then
|
||||||
nSideStep = ceil( dElev / dSideStep)
|
nSideStep = ceil( dElev / dSideStep)
|
||||||
dSideStep = max( dElev / nSideStep, 0)
|
dSideStep = max( dElev / nSideStep, 0)
|
||||||
end
|
end
|
||||||
@@ -1907,6 +2011,10 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
|||||||
local nStep = ceil( ( dThick - dMaxMat) / dStep)
|
local nStep = ceil( ( dThick - dMaxMat) / dStep)
|
||||||
dStep = max( ( dThick - dMaxMat) / max( nStep, 1), 0)
|
dStep = max( ( dThick - dMaxMat) / max( nStep, 1), 0)
|
||||||
local dMaxElev = max( ( nStep + 1) * dStep - GEO.EPS_SMALL, 0)
|
local dMaxElev = max( ( nStep + 1) * dStep - GEO.EPS_SMALL, 0)
|
||||||
|
-- tasca aperta sopra non necessita di MaxElev
|
||||||
|
if Proc.Fct == 2 and Proc.AffectedFaces.Top then
|
||||||
|
dMaxElev = nil
|
||||||
|
end
|
||||||
if nSinglePass and nSinglePass > 0 then
|
if nSinglePass and nSinglePass > 0 then
|
||||||
dStep = 0
|
dStep = 0
|
||||||
if nSinglePass == 1 then
|
if nSinglePass == 1 then
|
||||||
@@ -1920,7 +2028,15 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
|||||||
-- leggo eventuali note esistenti della lavorazione
|
-- leggo eventuali note esistenti della lavorazione
|
||||||
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
|
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
|
||||||
-- aggiungo alle note massima elevazione
|
-- aggiungo alle note massima elevazione
|
||||||
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dMaxElev, 3))
|
if dMaxElev then
|
||||||
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dMaxElev, 3))
|
||||||
|
end
|
||||||
|
-- se lavorazione in doppio aggiungo le rispettive note
|
||||||
|
if Proc.Double and Proc.Double == 2 then
|
||||||
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double)
|
||||||
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'MirrorAx', Proc.MirrorAx)
|
||||||
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'DeltaZ', Proc.MirrorDeltaZ)
|
||||||
|
end
|
||||||
-- scrivo le note della lavorazione
|
-- scrivo le note della lavorazione
|
||||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
||||||
-- setto il lato di lavoro standard
|
-- setto il lato di lavoro standard
|
||||||
@@ -1988,15 +2104,9 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
|||||||
-- setto allungamenti iniziali e finali
|
-- setto allungamenti iniziali e finali
|
||||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtraLongIni)
|
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtraLongIni)
|
||||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtraLongEnd)
|
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtraLongEnd)
|
||||||
-- se ho passate orizzontali riduco l'eventuale allungamento settato dall'utente
|
-- tutte le passate partono dalla stessa distanza
|
||||||
local dLiPerp = EgtGetMachiningParam( MCH_MP.LIPERP)
|
local dLiPerp = dElev + WD.CUT_SIC - dRadialOffset
|
||||||
local dLoPerp = EgtGetMachiningParam( MCH_MP.LOPERP)
|
local dLoPerp = dElev + WD.CUT_SIC - dRadialOffset
|
||||||
if dLiPerp > 0 then
|
|
||||||
dLiPerp = dLiPerp - dRadialOffset
|
|
||||||
end
|
|
||||||
if dLoPerp > 0 then
|
|
||||||
dLoPerp = dLoPerp - dRadialOffset
|
|
||||||
end
|
|
||||||
EgtSetMachiningParam( MCH_MP.LIPERP, dLiPerp)
|
EgtSetMachiningParam( MCH_MP.LIPERP, dLiPerp)
|
||||||
EgtSetMachiningParam( MCH_MP.LOPERP, dLoPerp)
|
EgtSetMachiningParam( MCH_MP.LOPERP, dLoPerp)
|
||||||
-- se richiesto, setto la nota per spostare la lavorazione alla fine
|
-- se richiesto, setto la nota per spostare la lavorazione alla fine
|
||||||
@@ -2154,61 +2264,140 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
|||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
local function MakeByPocketing( Proc, nFacet, nRawId, b3Raw, bCheckQPar)
|
-- trova la migliore lavorazione tasca in base a diametro utensile, elevazione, doppio e eventuale interferenza di parti vicine
|
||||||
-- dati della faccia
|
-- se necessario forza la tasca a chiusa
|
||||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacet, GDB_ID.ROOT)
|
local function VerifyPocket( Proc, nFacet, dElev, nRawId)
|
||||||
local dElev = WL.GetFaceElevation( Proc.Id, nFacet, nRawId)
|
|
||||||
|
local bForceClosedPocket = false
|
||||||
|
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||||
|
-- verifico se la feature è sul bordo (non ci sono altri pezzi davanti alla tasca). Se è sul bordo, l'utensile potrà attaccare da fuori.
|
||||||
|
local bIsFeatureOnEdge = ( Proc.Topology == 'Groove' and Proc.Fct == 4 and Proc.DistanceToNearestParts.Front > b3Raw:getDimY())
|
||||||
|
|
||||||
|
-- trovo il massimo diametro utensile ammissibile per la tasca
|
||||||
local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacet, GDB_ID.ROOT)
|
local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacet, GDB_ID.ROOT)
|
||||||
local dDiam = min( dH, dV)
|
local dStartDiameter = min( dH, dV)
|
||||||
-- gruppo ausiliario
|
local dMaxDiameter = dStartDiameter
|
||||||
local nAddGrpId = WL.GetAddGroup( Proc.PartId)
|
-- se una sola faccia posso usare un utensile più grande della faccia
|
||||||
local nNewProc, nNumFacet = RemoveBottomFaceAndReorder( Proc, nAddGrpId, nFacet)
|
|
||||||
-- se una sola faccia
|
|
||||||
if Proc.Fct == 1 then
|
if Proc.Fct == 1 then
|
||||||
dDiam = 2 * dDiam
|
dMaxDiameter = 2 * dMaxDiameter
|
||||||
end
|
end
|
||||||
-- se forma ad L
|
-- se forma ad L posso usare un utensile più grande della faccia
|
||||||
local bIsL = ( Proc.Fct == 2 or TestElleShape3( Proc.Id, Proc.Fct) or TestElleShape4( Proc.Id, Proc.Fct) == 2)
|
local bIsL = ( Proc.Fct == 2 or WL.TestElleShape3( Proc.Id, Proc.Fct) or WL.TestElleShape4( Proc.Id, Proc.Fct) == 2)
|
||||||
if bIsL then
|
if bIsL then
|
||||||
dDiam = 2 * dDiam
|
dMaxDiameter = 2 * dMaxDiameter
|
||||||
end
|
end
|
||||||
-- se forma ad U
|
-- se forma ad U riduco il diametro se necessario
|
||||||
local bIsU = ( Proc.Fct == 3 and not TestElleShape3( Proc.Id, Proc.Fct))
|
local bIsU = ( Proc.Fct == 3 and not WL.TestElleShape3( Proc.Id, Proc.Fct))
|
||||||
if bIsU then
|
if bIsU then
|
||||||
local _, dH2, dV2 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacet, GDB_ID.ROOT)
|
|
||||||
-- prendo la linea di base
|
-- prendo la linea di base
|
||||||
local dMiddleFacetLength = 0
|
local dMiddleFacetLength = 0
|
||||||
if abs( dElev - dH2) < 1 and abs( dElev - dV2) > 1 then
|
if abs( dElev - dH) < 1 and abs( dElev - dV) > 1 then
|
||||||
dMiddleFacetLength = dV2
|
dMiddleFacetLength = dV
|
||||||
elseif abs( dElev - dV2) < 1 and abs( dElev - dH2) > 1 then
|
elseif abs( dElev - dV) < 1 and abs( dElev - dH) > 1 then
|
||||||
dMiddleFacetLength = dH2
|
dMiddleFacetLength = dH
|
||||||
end
|
end
|
||||||
if dMiddleFacetLength > dDiam then
|
if dMiddleFacetLength > dMaxDiameter then
|
||||||
dDiam = min( 2 * dDiam, dMiddleFacetLength)
|
dMaxDiameter = min( 2 * dMaxDiameter, dMiddleFacetLength)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- in presenza di angoli interni, limito secondo impostazione globale il diametro massimo utensile
|
-- in presenza di angoli interni, limito secondo impostazione globale il diametro massimo utensile
|
||||||
if Proc.Fct == 3 and bIsL then
|
if Proc.Fct == 3 and bIsL then
|
||||||
dDiam = min( dDiam, WD.MAXDIAM_POCK_CORNER or 1000)
|
dMaxDiameter = min( dMaxDiameter, WD.MAXDIAM_POCK_CORNER or 1000)
|
||||||
elseif Proc.Fct >= 4 then
|
elseif Proc.Fct >= 4 then
|
||||||
dDiam = min( dDiam, WD.MAXDIAM_POCK_CORNER or 1000)
|
dMaxDiameter = min( dMaxDiameter, WD.MAXDIAM_POCK_CORNER or 1000)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- verifico la distanza minima dalle parti vicine e nel caso il FindPocketing limiterà il diametro massimo dell'utensile
|
||||||
|
local dDistanceToNearestPart = GEO.INFINITO
|
||||||
|
if Proc.AffectedFaces.Front then
|
||||||
|
dDistanceToNearestPart = Proc.DistanceToNearestParts.Front
|
||||||
|
end
|
||||||
|
if Proc.AffectedFaces.Back then
|
||||||
|
dDistanceToNearestPart = min( dDistanceToNearestPart, Proc.DistanceToNearestParts.Back)
|
||||||
|
end
|
||||||
|
if Proc.AffectedFaces.Left then
|
||||||
|
dDistanceToNearestPart = min( dDistanceToNearestPart, Proc.DistanceToNearestParts.Left)
|
||||||
|
end
|
||||||
|
if Proc.AffectedFaces.Right then
|
||||||
|
dDistanceToNearestPart = min( dDistanceToNearestPart, Proc.DistanceToNearestParts.Right)
|
||||||
|
end
|
||||||
|
-- se la distanza è inferiore ad un valore minimo forzo la tasca chiusa per evitare che la ricerca utensile fallisca
|
||||||
|
local dMinToolDiameter = 25
|
||||||
|
if dDistanceToNearestPart < dMinToolDiameter / 2 - 10 * GEO.EPS_SMALL then
|
||||||
|
bForceClosedPocket = true
|
||||||
|
dDistanceToNearestPart = dMaxDiameter
|
||||||
|
end
|
||||||
|
|
||||||
|
local bExcludeNoTipFeed = ( Proc.Topology == 'Pocket')
|
||||||
-- recupero la lavorazione
|
-- recupero la lavorazione
|
||||||
local sPocketing = WM.FindPocketing( 'Pocket', dDiam, dElev)
|
local bUseDElevToFindPocketing = true
|
||||||
|
local sPocketing = WM.FindPocketing( 'Pocket', dMaxDiameter, dElev, nil, nil, bExcludeNoTipFeed, dDistanceToNearestPart)
|
||||||
|
-- se tasca troppo profonda cerco senza elevazione e limiterò la profondità
|
||||||
if not sPocketing then
|
if not sPocketing then
|
||||||
sPocketing = WM.FindPocketing( 'Pocket', dDiam)
|
bUseDElevToFindPocketing = false
|
||||||
if not sPocketing then
|
sPocketing = WM.FindPocketing( 'Pocket', dMaxDiameter, nil, nil, nil, bExcludeNoTipFeed, dDistanceToNearestPart)
|
||||||
local sErr = 'Error : pocketing not found in library'
|
|
||||||
EgtOutLog( sErr)
|
|
||||||
return false, sErr
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
-- recupero i dati dell'utensile
|
|
||||||
local dMillDiam = 20
|
local dMillDiam = 20
|
||||||
local dMaxDepth = 0
|
local dMaxDepth = 0
|
||||||
local dThDiam = 100
|
local dThDiam = 100
|
||||||
local sTuuid
|
local sTuuid
|
||||||
if EgtMdbSetCurrMachining( sPocketing) then
|
-- se lavorazione trovata verifico eventuale doppio, raccolgo i dati utensile e verifico collisioni dell'utensile con altre parti
|
||||||
|
if sPocketing then
|
||||||
|
-- se doppio cerco una lavorazione adatta
|
||||||
|
if Proc.Double and Proc.Double == 2 then
|
||||||
|
local sPocketingBackup = sPocketing
|
||||||
|
sPocketing = WM.FindPocketing( 'Pocket', dMaxDiameter, EgtIf( bUseDElevToFindPocketing, dElev, nil), nil, 'H1', true, dDistanceToNearestPart)
|
||||||
|
if not WM.IsMachiningOkForDouble( sPocketing) then
|
||||||
|
Proc.Double = 0
|
||||||
|
sPocketing = sPocketingBackup
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- recupero diametro utensile
|
||||||
|
if EgtMdbSetCurrMachining( sPocketing) then
|
||||||
|
sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||||
|
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||||
|
dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- verifico se la lavorazione (o il suo eventuale mirror) potrebbe danneggiare le parti limitrofe e devo quindi forzare una tasca chiusa
|
||||||
|
local bIsMachiningDamagingOtherParts = IsMachiningDamagingOtherParts( Proc, dMillDiam, nRawId)
|
||||||
|
if bIsMachiningDamagingOtherParts then
|
||||||
|
bForceClosedPocket = true
|
||||||
|
end
|
||||||
|
-- disattivo il doppio se devo forzare una tasca chiusa ma l'altra no
|
||||||
|
if Proc.Double and Proc.Double > 0 then
|
||||||
|
local bIsMirrorMachiningDamagingOtherParts = IsMachiningDamagingOtherParts( Proc.Mirror, dMillDiam, nRawId)
|
||||||
|
if bIsMachiningDamagingOtherParts ~= bIsMirrorMachiningDamagingOtherParts then
|
||||||
|
Proc.Double = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- altrimenti diametro utensile troppo piccolo: devo forzare tasca chiusa
|
||||||
|
else
|
||||||
|
bForceClosedPocket = true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- se tasca chiusa cerco lavorazione con diametro massimo pari a dimensione tasca e riverifico per eventuale doppio
|
||||||
|
if bForceClosedPocket then
|
||||||
|
dMaxDiameter = dStartDiameter
|
||||||
|
bUseDElevToFindPocketing = true
|
||||||
|
sPocketing = WM.FindPocketing( 'Pocket', dMaxDiameter, dElev, nil, nil, bExcludeNoTipFeed, dDistanceToNearestPart)
|
||||||
|
if not sPocketing then
|
||||||
|
bUseDElevToFindPocketing = false
|
||||||
|
sPocketing = WM.FindPocketing( 'Pocket', dMaxDiameter, nil, nil, nil, bExcludeNoTipFeed, dDistanceToNearestPart)
|
||||||
|
end
|
||||||
|
-- se doppio cerco una lavorazione adatta
|
||||||
|
if Proc.Double and Proc.Double == 2 then
|
||||||
|
local sPocketingBackup = sPocketing
|
||||||
|
sPocketing = WM.FindPocketing( 'Pocket', dMaxDiameter, EgtIf( bUseDElevToFindPocketing, dElev, nil), nil, 'H1', true, dDistanceToNearestPart)
|
||||||
|
if not WM.IsMachiningOkForDouble( sPocketing) then
|
||||||
|
Proc.Double = 0
|
||||||
|
sPocketing = sPocketingBackup
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- recupero dati utensile
|
||||||
|
if sPocketing and EgtMdbSetCurrMachining( sPocketing) then
|
||||||
sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||||
dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
|
dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
|
||||||
@@ -2216,6 +2405,25 @@ local function MakeByPocketing( Proc, nFacet, nRawId, b3Raw, bCheckQPar)
|
|||||||
dThDiam = EgtTdbGetCurrToolThDiam() or dThDiam
|
dThDiam = EgtTdbGetCurrToolThDiam() or dThDiam
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return sPocketing, bForceClosedPocket, bIsFeatureOnEdge, sTuuid, dMillDiam, dMaxDepth, dThDiam
|
||||||
|
end
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
local function MakeByPocketing( Proc, nFacet, nRawId, b3Raw, bCheckQPar)
|
||||||
|
-- dati della faccia
|
||||||
|
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacet, GDB_ID.ROOT)
|
||||||
|
local dElev = WL.GetFaceElevation( Proc.Id, nFacet, nRawId)
|
||||||
|
-- gruppo ausiliario
|
||||||
|
local nAddGrpId = WL.GetAddGroup( Proc.PartId)
|
||||||
|
local nNewProc = RemoveBottomFaceAndReorder( Proc, nAddGrpId, nFacet)
|
||||||
|
-- cerco lavorazione adatta e recupero i dati utensile
|
||||||
|
local sPocketing, bForceClosedPocket, bIsFeatureOnEdge, sTuuid, dMillDiam, dMaxDepth, dThDiam = VerifyPocket( Proc, nFacet, dElev, nRawId)
|
||||||
|
if not sPocketing then
|
||||||
|
local sErr = 'Error : pocketing not found in library'
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
|
||||||
-- inserisco la lavorazione di svuotatura
|
-- inserisco la lavorazione di svuotatura
|
||||||
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||||
local nMchFId = WM.AddMachining( Proc, sName, sPocketing)
|
local nMchFId = WM.AddMachining( Proc, sName, sPocketing)
|
||||||
@@ -2251,6 +2459,20 @@ local function MakeByPocketing( Proc, nFacet, nRawId, b3Raw, bCheckQPar)
|
|||||||
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
|
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
|
||||||
-- imposto elevazione
|
-- imposto elevazione
|
||||||
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( min( dElev, dMaxDepth), 1))
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( min( dElev, dMaxDepth), 1))
|
||||||
|
-- se lavorazione in doppio aggiungo le rispettive note
|
||||||
|
if Proc.Double and Proc.Double == 2 then
|
||||||
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double)
|
||||||
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'MirrorAx', Proc.MirrorAx)
|
||||||
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'DeltaZ', Proc.MirrorDeltaZ)
|
||||||
|
-- escludo ottimizzazioni e forzo attacco interno perchè la tasca specchiata potrebbe essere nel mezzo del pannello
|
||||||
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxOptSize', 0.1)
|
||||||
|
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALOUT)
|
||||||
|
end
|
||||||
|
-- setto eventuale nota per forzare tasca chiusa
|
||||||
|
if bForceClosedPocket then sUserNotes = EgtSetValInNotes( sUserNotes, 'Open', 0) end
|
||||||
|
-- setto eventuale nota per forzare attacco esterno, fino ad un certo spessore del grezzo
|
||||||
|
local dMaxRawThicknessToStartOut = 75
|
||||||
|
if bIsFeatureOnEdge and ( not Proc.Double or Proc.Double == 0) then sUserNotes = EgtSetValInNotes( sUserNotes, 'OpenMinSafe', dMaxRawThicknessToStartOut) end
|
||||||
-- scrivo le note della lavorazione
|
-- scrivo le note della lavorazione
|
||||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
||||||
-- eseguo
|
-- eseguo
|
||||||
@@ -2259,7 +2481,9 @@ local function MakeByPocketing( Proc, nFacet, nRawId, b3Raw, bCheckQPar)
|
|||||||
EgtSetOperationMode( nMchFId, false)
|
EgtSetOperationMode( nMchFId, false)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
|
|
||||||
-- verifica parametro Q per pulitura spigoli
|
-- verifica parametro Q per pulitura spigoli
|
||||||
|
local bIsU = ( Proc.Fct == 3 and not WL.TestElleShape3( Proc.Id, Proc.Fct))
|
||||||
if bCheckQPar and not ( bIsU and AreSameOrOppositeVectorApprox( vtN, Z_AX())) then
|
if bCheckQPar and not ( bIsU and AreSameOrOppositeVectorApprox( vtN, Z_AX())) then
|
||||||
-- lettura parametri (probabile/i parametro/i Q)
|
-- lettura parametri (probabile/i parametro/i Q)
|
||||||
local nConeCut = EvaluateQParam( Proc)
|
local nConeCut = EvaluateQParam( Proc)
|
||||||
@@ -2267,7 +2491,7 @@ local function MakeByPocketing( Proc, nFacet, nRawId, b3Raw, bCheckQPar)
|
|||||||
local vFace, dMaxWidth = GetFacesData( nNewProc, false, false, dMillDiam, dMaxDepth, (dMillDiam/2), nAddGrpId, Proc.PartId)
|
local vFace, dMaxWidth = GetFacesData( nNewProc, false, false, dMillDiam, dMaxDepth, (dMillDiam/2), nAddGrpId, Proc.PartId)
|
||||||
-- se abilitata la lavorazione corner con stop macchina
|
-- se abilitata la lavorazione corner con stop macchina
|
||||||
if nConeCut == 1 then
|
if nConeCut == 1 then
|
||||||
local bMcok, sMcErr = AddMillCorner( nConeCut, vFace, Proc, nRawId, b3Raw,
|
local bMcok, sMcErr = AddMillCorner( nConeCut, vFace, Proc, nRawId, b3Raw,
|
||||||
dMillDiam, nAddGrpId, dMaxWidth, nNewProc, dDepth)
|
dMillDiam, nAddGrpId, dMaxWidth, nNewProc, dDepth)
|
||||||
if not bMcok then return bMcok, sMcErr end
|
if not bMcok then return bMcok, sMcErr end
|
||||||
elseif nConeCut == 2 then
|
elseif nConeCut == 2 then
|
||||||
@@ -2383,7 +2607,18 @@ local function MakeTwoFaces( Proc, nRawId, b3Raw)
|
|||||||
dMinSideElev = dDimY[2]
|
dMinSideElev = dDimY[2]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local sMillOnSide, dTMaxDepth, dMaxMat, dDiam = WM.FindMilling( 'SideMill', nil, nil, nil, nil, dMaxThick, nil, dMinSideElev)
|
local sMillOnSide = WM.FindMilling( 'SideMill', nil, nil, nil, nil, dMaxThick, nil, dMinSideElev)
|
||||||
|
-- se Proc è settata per essere specchiata cerco la lavorazione adatta e verifico possa essere effettivamente specchiata
|
||||||
|
local bDoubleMillOnSide = false
|
||||||
|
if Proc.Double and Proc.Double == 2 then
|
||||||
|
local sMillOnSideBackup = sMillOnSide
|
||||||
|
sMillOnSide = WM.FindMilling( 'SideMill', nil, nil, nil, nil, dMaxThick, nil, dMinSideElev, 'H1')
|
||||||
|
if WM.IsMachiningOkForDouble( sMillOnSide) then
|
||||||
|
bDoubleMillOnSide = true
|
||||||
|
else
|
||||||
|
sMillOnSide = sMillOnSideBackup
|
||||||
|
end
|
||||||
|
end
|
||||||
local bEnableMillOnSide
|
local bEnableMillOnSide
|
||||||
if sMillOnSide and nUseMillOnSide >= 1 then
|
if sMillOnSide and nUseMillOnSide >= 1 then
|
||||||
dMaxZVers = 0.866
|
dMaxZVers = 0.866
|
||||||
@@ -2444,7 +2679,7 @@ local function MakeTwoFaces( Proc, nRawId, b3Raw)
|
|||||||
end
|
end
|
||||||
-- se posso eseguire la lavorazione per distanza inferiore utensile o lavorazione preceduta da sgossatura gola
|
-- se posso eseguire la lavorazione per distanza inferiore utensile o lavorazione preceduta da sgossatura gola
|
||||||
if bInsertMach then
|
if bInsertMach then
|
||||||
return MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng)
|
return MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, nil, nil, nil, bDoubleMillOnSide)
|
||||||
else
|
else
|
||||||
local sErr = 'Error feature not machinable (dimensions)'
|
local sErr = 'Error feature not machinable (dimensions)'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
@@ -2512,12 +2747,15 @@ local function MakeTwoFaces( Proc, nRawId, b3Raw)
|
|||||||
local bMachFromDn = false
|
local bMachFromDn = false
|
||||||
local bInsertMach
|
local bInsertMach
|
||||||
if dSideDist and dSideDist < dMaxDist then
|
if dSideDist and dSideDist < dMaxDist then
|
||||||
-- se abilitata SideMill
|
-- se abilitata SideMill oppure se la specchiata guarda in basso e quindi l'attacco deve essere a filo
|
||||||
if bEnableMillOnSide and dMaxDepthOnSide > 0 then
|
if ( bEnableMillOnSide and dMaxDepthOnSide > 0) or ( Proc.Double == 2 and Proc.MirrorDeltaZ and abs( Proc.MirrorDeltaZ) > GEO.EPS_SMALL) then
|
||||||
bLikeAsMakeFirstGroove = false
|
bLikeAsMakeFirstGroove = false
|
||||||
return MakeSideGrooveByMill( Proc, nFacetVert, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, bLikeAsMakeFirstGroove)
|
return MakeSideGrooveByMill( Proc, nFacetVert, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, bLikeAsMakeFirstGroove, nil, nil, bDoubleMillOnSide)
|
||||||
else
|
else
|
||||||
local bOk, sErr = MakeByMill( Proc, nFacet, 1 - nFacet, nRawId, b3Raw, dSideDist)
|
local bOk, sErr, bSideMachiningNotFound = MakeByMill( Proc, nFacet, 1 - nFacet, nRawId, b3Raw, dSideDist)
|
||||||
|
if not bOk and bSideMachiningNotFound then
|
||||||
|
bOk, sErr = MakeByPocketing( Proc, nFacet, nRawId, b3Raw)
|
||||||
|
end
|
||||||
-- se angolo ottuso riprendo il lato quasi verticale
|
-- se angolo ottuso riprendo il lato quasi verticale
|
||||||
if bOk and dAng and dAng > -90 + 10 * GEO.EPS_SMALL then
|
if bOk and dAng and dAng > -90 + 10 * GEO.EPS_SMALL then
|
||||||
local bOk2, sErr2 = MakeSideGrooveByMill( Proc, nFacetVert, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, false, nil, true)
|
local bOk2, sErr2 = MakeSideGrooveByMill( Proc, nFacetVert, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, false, nil, true)
|
||||||
@@ -2526,7 +2764,7 @@ local function MakeTwoFaces( Proc, nRawId, b3Raw)
|
|||||||
end
|
end
|
||||||
elseif bEnableMillOnSide and dMaxDepthOnSide > 0 then
|
elseif bEnableMillOnSide and dMaxDepthOnSide > 0 then
|
||||||
bLikeAsMakeFirstGroove = true
|
bLikeAsMakeFirstGroove = true
|
||||||
local bOk, sErr = MakeSideGrooveByMill( Proc, nFacetVert, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, bLikeAsMakeFirstGroove)
|
local bOk, sErr = MakeSideGrooveByMill( Proc, nFacetVert, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, bLikeAsMakeFirstGroove, nil, nil, bDoubleMillOnSide)
|
||||||
if bOk then return true end
|
if bOk then return true end
|
||||||
end
|
end
|
||||||
-- se non inclinate o capacità di taglio non sufficiente o non molto grandi (80mm), provo con contornatura o svuotatura
|
-- se non inclinate o capacità di taglio non sufficiente o non molto grandi (80mm), provo con contornatura o svuotatura
|
||||||
@@ -2621,25 +2859,38 @@ local function MakeMoreFaces( Proc, nRawId, b3Raw)
|
|||||||
end
|
end
|
||||||
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
|
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||||
local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
|
local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||||
local dMaxSlotThicknessForBlade = 25
|
local dMaxSlotThicknessForBlade = 19
|
||||||
local bIsSmallSlot = ( Proc.Fct == 3 and ( min( dH, dV) < dMaxSlotThicknessForBlade + 10 * GEO.EPS_SMALL) and vtN:getZ() > -0.01)
|
local bIsSmallSlot = ( Proc.Fct == 3 and ( min( dH, dV) < dMaxSlotThicknessForBlade - 10 * GEO.EPS_SMALL) and vtN:getZ() > -0.01)
|
||||||
-- se di fianco
|
-- se di fianco
|
||||||
if not bPckt and Proc.Fct >= 3 and ( ( vtN:getZ() < WD.NZ_MINA) or bIsSmallSlot) then
|
if not bPckt and Proc.Fct >= 3 and ( ( vtN:getZ() < WD.NZ_MINA) or bIsSmallSlot) then
|
||||||
-- recupero elevazione faccia in feature
|
-- recupero elevazione faccia in feature
|
||||||
local dSideElev = WL.GetFaceElevation( Proc.Id, nFacInd)
|
local dSideElev = WL.GetFaceElevation( Proc.Id, nFacInd)
|
||||||
-- se abilitata lavorazione ribasso con fresa di fianco e parametro Q03 abilitato
|
-- se abilitata lavorazione ribasso con fresa di fianco e parametro Q03 abilitato
|
||||||
local sMillOnSide, dTMaxDepth, dMaxMat, dDiam = WM.FindMilling( 'SideMill', nil, nil, nil, nil, min( dH, dV), nil, dSideElev)
|
local sMillOnSide, dTMaxDepth, dMaxMat, dDiam = WM.FindMilling( 'SideMill', nil, nil, nil, nil, min( dH, dV), nil, dSideElev)
|
||||||
|
-- se Proc è settata per essere specchiata cerco la lavorazione adatta e verifico possa essere effettivamente specchiata
|
||||||
|
local bDoubleMillOnSide = false
|
||||||
|
if Proc.Double and Proc.Double == 2 then
|
||||||
|
local sMillOnSideBackup = sMillOnSide
|
||||||
|
sMillOnSide = WM.FindMilling( 'SideMill', nil, nil, nil, nil, min( dH, dV), nil, dSideElev, 'H1')
|
||||||
|
if WM.IsMachiningOkForDouble( sMillOnSide) then
|
||||||
|
bDoubleMillOnSide = true
|
||||||
|
else
|
||||||
|
sMillOnSide = sMillOnSideBackup
|
||||||
|
end
|
||||||
|
end
|
||||||
local _, nUseMillOnSide = EvaluateQParam( Proc)
|
local _, nUseMillOnSide = EvaluateQParam( Proc)
|
||||||
-- se ho abilitata lavorazione di fresa di fianco
|
-- se ho abilitata lavorazione di fresa di fianco
|
||||||
if Proc.Fct >= 3 and sMillOnSide and nUseMillOnSide >= 1 and not bIsSmallSlot then
|
if Proc.Fct >= 3 and sMillOnSide and nUseMillOnSide >= 1 and not bIsSmallSlot then
|
||||||
-- cerco nei parametri utensili la nota di affondamento di fianco SIDEDEPTH
|
-- cerco nei parametri utensili la nota di affondamento di fianco SIDEDEPTH
|
||||||
local dMaxDepthOnSide = 0
|
local dMaxDepthOnSide = 999
|
||||||
local dMillDiam = 0
|
local dMillDiam = 0
|
||||||
|
local dMillDiamTh = EgtTdbGetCurrToolThDiam() or 60
|
||||||
if EgtMdbSetCurrMachining( sMillOnSide) then
|
if EgtMdbSetCurrMachining( sMillOnSide) 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
|
||||||
dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
|
dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
|
||||||
dMaxDepthOnSide = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd') or dMaxDepthOnSide
|
dMillDiamTh = EgtTdbGetCurrToolThDiam() or dMillDiamTh
|
||||||
|
dMaxDepthOnSide = min( EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd') or dMaxDepthOnSide, 0.5 * ( dMillDiam - dMillDiamTh))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local bMakeFirstGroove
|
local bMakeFirstGroove
|
||||||
@@ -2669,14 +2920,27 @@ local function MakeMoreFaces( Proc, nRawId, b3Raw)
|
|||||||
nSinglePass = 2
|
nSinglePass = 2
|
||||||
bMakeFirstGroove = false
|
bMakeFirstGroove = false
|
||||||
end
|
end
|
||||||
return MakeSideGrooveByMill( Proc, nFacInd, nRawId, b3Raw, EgtIf( dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, nil, nil, bLikeAsMakeFirstGroove, nSinglePass)
|
return MakeSideGrooveByMill( Proc, nFacInd, nRawId, b3Raw, EgtIf( dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, nil, nil, bLikeAsMakeFirstGroove, nSinglePass, nil, bDoubleMillOnSide)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- fresatura (se definita); se disponibile, cerco di usare un utensile che non lavori al limite della capacità di sottosquadro
|
-- fresatura (se definita); se disponibile, cerco di usare un utensile che non lavori al limite della capacità di sottosquadro
|
||||||
local sMilling = WM.FindMilling( 'SideGroove', nil, nil, nil, nil, min( dH, dV), nil, 1.2 * dSideElev)
|
local dSideElevMultiplier = 1.1
|
||||||
|
local sMilling = WM.FindMilling( 'SideGroove', nil, nil, nil, nil, min( dH, dV), nil, dSideElevMultiplier * dSideElev)
|
||||||
-- se non ho trovato un utensile un po' più grande del sottosquadro richiesto, passo alla ricerca standard
|
-- se non ho trovato un utensile un po' più grande del sottosquadro richiesto, passo alla ricerca standard
|
||||||
if not sMilling then
|
if not sMilling then
|
||||||
sMilling = WM.FindMilling( 'SideGroove', nil, nil, nil, nil, min( dH, dV), nil, dSideElev)
|
sMilling = WM.FindMilling( 'SideGroove', nil, nil, nil, nil, min( dH, dV), nil, dSideElev)
|
||||||
|
dSideElevMultiplier = 1
|
||||||
|
end
|
||||||
|
-- se Proc è settata per essere specchiata cerco la lavorazione adatta e verifico possa essere effettivamente specchiata
|
||||||
|
bDoubleMillOnSide = false
|
||||||
|
if Proc.Double and Proc.Double == 2 then
|
||||||
|
local sMillOnSideBackup = sMillOnSide
|
||||||
|
sMillOnSide = WM.FindMilling( 'SideGroove', nil, nil, nil, nil, min( dH, dV), nil, dSideElevMultiplier * dSideElev, 'H1')
|
||||||
|
if WM.IsMachiningOkForDouble( sMillOnSide) then
|
||||||
|
bDoubleMillOnSide = true
|
||||||
|
else
|
||||||
|
sMillOnSide = sMillOnSideBackup
|
||||||
|
end
|
||||||
end
|
end
|
||||||
-- recupero i dati dell'utensile
|
-- recupero i dati dell'utensile
|
||||||
local dMaxMat = 1000
|
local dMaxMat = 1000
|
||||||
@@ -2701,7 +2965,7 @@ local function MakeMoreFaces( Proc, nRawId, b3Raw)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if sMilling and dElev < dMaxDepthOnSide then
|
if sMilling and dElev < dMaxDepthOnSide then
|
||||||
return MakeSideGrooveByMill( Proc, nFacInd, nRawId, b3Raw, sMilling)
|
return MakeSideGrooveByMill( Proc, nFacInd, nRawId, b3Raw, sMilling, nil, nil, nil, nil, nil, nil, nil, bDoubleMillOnSide)
|
||||||
-- altrimenti sega a catena
|
-- altrimenti sega a catena
|
||||||
else
|
else
|
||||||
return MakeByChainSaw( Proc, nFacInd, nRawId, b3Raw, dElev, dH, dV)
|
return MakeByChainSaw( Proc, nFacInd, nRawId, b3Raw, dElev, dH, dV)
|
||||||
@@ -2715,7 +2979,7 @@ local function MakeMoreFaces( Proc, nRawId, b3Raw)
|
|||||||
else
|
else
|
||||||
local sErr = 'Side milling not possible'
|
local sErr = 'Side milling not possible'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return true, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
-- fessura verticale
|
-- fessura verticale
|
||||||
elseif Proc.Stype == 3 then
|
elseif Proc.Stype == 3 then
|
||||||
|
|||||||
@@ -29,7 +29,11 @@ function WPSC.Classify( Proc, b3Raw)
|
|||||||
if not AuxId then return false end
|
if not AuxId then return false end
|
||||||
AuxId = AuxId + Proc.Id
|
AuxId = AuxId + Proc.Id
|
||||||
local vtDir = EgtSV( AuxId, GDB_ID.ROOT)
|
local vtDir = EgtSV( AuxId, GDB_ID.ROOT)
|
||||||
return ( vtDir:getZ() > 0.5)
|
local vtDirZ = vtDir:getZ()
|
||||||
|
if Proc.IsThrough then
|
||||||
|
vtDirZ = abs( vtDir:getZ())
|
||||||
|
end
|
||||||
|
return ( vtDirZ > 0.5)
|
||||||
end
|
end
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
|||||||
+637
-21
@@ -1,10 +1,15 @@
|
|||||||
-- WallExec.lua by Egaltech s.r.l. 2023/10/16
|
-- WallExec.lua by Egaltech s.r.l. 2024/02/20
|
||||||
-- Libreria esecuzione lavorazioni per Pareti
|
-- Libreria esecuzione lavorazioni per Pareti
|
||||||
-- 2023/05/25 Aggiunto ordinamento in base a priorità da btl.
|
-- 2023/05/25 Aggiunto ordinamento in base a priorità da btl.
|
||||||
-- 2023/06/07 Nel caso di outline con priorità aggiunta la rimozione degli sfridi nella lavorazione successiva.
|
-- 2023/06/07 Nel caso di outline con priorità aggiunta la rimozione degli sfridi nella lavorazione successiva.
|
||||||
-- 2023/06/27 Aggiunte origini TN e BN.
|
-- 2023/06/27 Aggiunte origini TN e BN.
|
||||||
-- 2023/07/04 Se c'è funzione di macchina WD.GetOrigCorner si lascia scegliere posizione default a questa impostando 0 se non c'è 'REFPOS'.
|
-- 2023/07/04 Se c'è funzione di macchina WD.GetOrigCorner si lascia scegliere posizione default a questa impostando 0 se non c'è 'REFPOS'.
|
||||||
-- 2023/10/16 Aggiunta gestione Aree vietate (LockOut) per chiodature.
|
-- 2023/10/16 Aggiunta gestione Aree vietate (LockOut) per chiodature.
|
||||||
|
-- 2023/11/14 Modifiche sostanziali per l'aggiunta delle lavorazioni in doppio.
|
||||||
|
-- In Collect aggiunto il recupero preliminare di varie informazioni sulla feature.
|
||||||
|
-- 2023/12/11 In ClassifyTopology si passa ora anche l'Id del grezzo (allineamento Topology con Beam).
|
||||||
|
-- 2024/02/20 Aggiunta gestione DeltaX/Y/Z del pannello dall'origine da BTL.
|
||||||
|
-- 2024/08/30 Aggiunta nota altezza sottopezzo, per pareti a layer
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local WallExec = {}
|
local WallExec = {}
|
||||||
@@ -25,6 +30,7 @@ if WALL and WALL.NESTINGCORNERBL then WD.NESTING_CORNER = 'BL' end
|
|||||||
-- Carico le librerie
|
-- Carico le librerie
|
||||||
_G.package.loaded.WMachiningLib = nil
|
_G.package.loaded.WMachiningLib = nil
|
||||||
_G.package.loaded.WallLib = nil
|
_G.package.loaded.WallLib = nil
|
||||||
|
_G.package.loaded.WFeatureTopology = nil
|
||||||
_G.package.loaded.WProcessCut = nil
|
_G.package.loaded.WProcessCut = nil
|
||||||
_G.package.loaded.WProcessDoubleCut = nil
|
_G.package.loaded.WProcessDoubleCut = nil
|
||||||
_G.package.loaded.WProcessSawCut = nil
|
_G.package.loaded.WProcessSawCut = nil
|
||||||
@@ -38,6 +44,8 @@ _G.package.loaded.WProcessFreeContour = nil
|
|||||||
_G.package.loaded.WProcessVariant = nil
|
_G.package.loaded.WProcessVariant = nil
|
||||||
local WM = require( 'WMachiningLib')
|
local WM = require( 'WMachiningLib')
|
||||||
local WL = require( 'WallLib')
|
local WL = require( 'WallLib')
|
||||||
|
local Topology = require( 'WFeatureTopology')
|
||||||
|
local Squaring = require( 'Squaring')
|
||||||
local Cut = require( 'WProcessCut')
|
local Cut = require( 'WProcessCut')
|
||||||
local DoubleCut = require( 'WProcessDoubleCut')
|
local DoubleCut = require( 'WProcessDoubleCut')
|
||||||
local SawCut = require( 'WProcessSawCut')
|
local SawCut = require( 'WProcessSawCut')
|
||||||
@@ -50,7 +58,6 @@ local Text = require( 'WProcessText')
|
|||||||
local FreeContour = require( 'WProcessFreeContour')
|
local FreeContour = require( 'WProcessFreeContour')
|
||||||
local Variant = require( 'WProcessVariant')
|
local Variant = require( 'WProcessVariant')
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
-- *** Inserimento delle pareti nel pannello ***
|
-- *** Inserimento delle pareti nel pannello ***
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
@@ -75,33 +82,43 @@ function WallExec.ProcessWalls( dRawL, dRawW, dRawH, vWall, bMachGroupOk, bNewPr
|
|||||||
local OrigOnTab
|
local OrigOnTab
|
||||||
local nCorner
|
local nCorner
|
||||||
local sOrigCorner = WD.ORIG_CORNER or 'BR'
|
local sOrigCorner = WD.ORIG_CORNER or 'BR'
|
||||||
|
local BtlInfoId = EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL
|
||||||
if WD.GetOrigCorner then
|
if WD.GetOrigCorner then
|
||||||
sOrigCorner = WD.GetOrigCorner( EgtGetInfo( EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL, 'REFPOS', 'i') or 0)
|
sOrigCorner = WD.GetOrigCorner( EgtGetInfo( BtlInfoId, 'REFPOS', 'i') or 0)
|
||||||
end
|
end
|
||||||
|
-- offset da interfaccia
|
||||||
|
local dDeltaXFromBtl = EgtGetInfo( BtlInfoId, 'PANELDELTAY', 'd') or 0
|
||||||
|
local dDeltaYFromBtl = EgtGetInfo( BtlInfoId, 'PANELDELTAX', 'd') or 0
|
||||||
|
local dDeltaZFromBtl = EgtGetInfo( BtlInfoId, 'PANELDELTAZ', 'd') or 0
|
||||||
|
-- se da interfaccia arriva un valore > 0 si usa quello, altrimenti si legge da WallData (default 0)
|
||||||
|
local DeltaX = EgtIf( dDeltaXFromBtl > 0, dDeltaXFromBtl, WD.DELTA_X or 0)
|
||||||
|
local DeltaY = EgtIf( dDeltaYFromBtl > 0, dDeltaYFromBtl, WD.DELTA_Y or 0)
|
||||||
|
local DeltaZ = EgtIf( dDeltaZFromBtl > 0, dDeltaZFromBtl, WD.DELTA_Z or 0)
|
||||||
|
|
||||||
if sOrigCorner == 'TL' then
|
if sOrigCorner == 'TL' then
|
||||||
nCorner = MCH_CR.TL
|
nCorner = MCH_CR.TL
|
||||||
OrigOnTab = Point3d( 0 + abs( WD.DELTA_X or 0), b3Tab:getDimY() - abs( WD.DELTA_Y or 0), ( WD.DELTA_Z or 0))
|
OrigOnTab = Point3d( 0 + abs( DeltaX), b3Tab:getDimY() - abs( DeltaY), DeltaZ)
|
||||||
elseif sOrigCorner == 'BL' then
|
elseif sOrigCorner == 'BL' then
|
||||||
nCorner = MCH_CR.BL
|
nCorner = MCH_CR.BL
|
||||||
OrigOnTab = Point3d( 0 + abs( WD.DELTA_X or 0), abs( WD.DELTA_Y or 0), ( WD.DELTA_Z or 0))
|
OrigOnTab = Point3d( 0 + abs( DeltaX), abs( DeltaY), DeltaZ)
|
||||||
elseif sOrigCorner == 'TR' then
|
elseif sOrigCorner == 'TR' then
|
||||||
nCorner = MCH_CR.TR
|
nCorner = MCH_CR.TR
|
||||||
OrigOnTab = Point3d( b3Tab:getDimX() - abs( WD.DELTA_X or 0), b3Tab:getDimY() - abs( WD.DELTA_Y or 0), ( WD.DELTA_Z or 0))
|
OrigOnTab = Point3d( b3Tab:getDimX() - abs( DeltaX), b3Tab:getDimY() - abs( DeltaY), DeltaZ)
|
||||||
elseif sOrigCorner == 'BR' then
|
elseif sOrigCorner == 'BR' then
|
||||||
nCorner = MCH_CR.BR
|
nCorner = MCH_CR.BR
|
||||||
OrigOnTab = Point3d( b3Tab:getDimX() - abs( WD.DELTA_X or 0), abs( WD.DELTA_Y or 0), ( WD.DELTA_Z or 0))
|
OrigOnTab = Point3d( b3Tab:getDimX() - abs( DeltaX), abs( DeltaY), DeltaZ)
|
||||||
elseif sOrigCorner == 'TM' then
|
elseif sOrigCorner == 'TM' then
|
||||||
nCorner = MCH_CR.TR
|
nCorner = MCH_CR.TR
|
||||||
OrigOnTab = Point3d( WD.MID_REF - abs( WD.DELTA_X or 0), b3Tab:getDimY() - abs( WD.DELTA_Y or 0), ( WD.DELTA_Z or 0))
|
OrigOnTab = Point3d( WD.MID_REF - abs( DeltaX), b3Tab:getDimY() - abs( DeltaY), DeltaZ)
|
||||||
elseif sOrigCorner == 'BM' then
|
elseif sOrigCorner == 'BM' then
|
||||||
nCorner = MCH_CR.BR
|
nCorner = MCH_CR.BR
|
||||||
OrigOnTab = Point3d( WD.MID_REF - abs( WD.DELTA_X or 0), abs( WD.DELTA_Y or 0), ( WD.DELTA_Z or 0))
|
OrigOnTab = Point3d( WD.MID_REF - abs( DeltaX), abs( DeltaY), DeltaZ)
|
||||||
elseif sOrigCorner == 'TN' then
|
elseif sOrigCorner == 'TN' then
|
||||||
nCorner = MCH_CR.TL
|
nCorner = MCH_CR.TL
|
||||||
OrigOnTab = Point3d( WD.NEW_REF + abs( WD.DELTA_X or 0), b3Tab:getDimY() - abs( WD.DELTA_Y or 0), ( WD.DELTA_Z or 0))
|
OrigOnTab = Point3d( WD.NEW_REF + abs( DeltaX), b3Tab:getDimY() - abs( DeltaY), DeltaZ)
|
||||||
elseif sOrigCorner == 'BN' then
|
elseif sOrigCorner == 'BN' then
|
||||||
nCorner = MCH_CR.BL
|
nCorner = MCH_CR.BL
|
||||||
OrigOnTab = Point3d( WD.NEW_REF + abs( WD.DELTA_X or 0), abs( WD.DELTA_Y or 0), ( WD.DELTA_Z or 0))
|
OrigOnTab = Point3d( WD.NEW_REF + abs( DeltaX), abs( DeltaY), DeltaZ)
|
||||||
end
|
end
|
||||||
-- Impostazione dell'attrezzaggio di default
|
-- Impostazione dell'attrezzaggio di default
|
||||||
EgtImportSetup()
|
EgtImportSetup()
|
||||||
@@ -115,6 +132,7 @@ function WallExec.ProcessWalls( dRawL, dRawW, dRawH, vWall, bMachGroupOk, bNewPr
|
|||||||
nRaw = EgtAddRawPart( Point3d( 0, 0, 0), dRawL, dRawW, dRawH, WD.RAWCOL)
|
nRaw = EgtAddRawPart( Point3d( 0, 0, 0), dRawL, dRawW, dRawH, WD.RAWCOL)
|
||||||
end
|
end
|
||||||
EgtMoveToCornerRawPart( nRaw, OrigOnTab, nCorner)
|
EgtMoveToCornerRawPart( nRaw, OrigOnTab, nCorner)
|
||||||
|
EgtSetInfo( nRaw, 'ORIGCORNER', sOrigCorner)
|
||||||
EgtSetInfo( nRaw, 'ORD', 1)
|
EgtSetInfo( nRaw, 'ORD', 1)
|
||||||
-- Inserimento dei pezzi nel grezzo
|
-- Inserimento dei pezzi nel grezzo
|
||||||
for i = 1, #vWall do
|
for i = 1, #vWall do
|
||||||
@@ -149,6 +167,7 @@ function WallExec.ProcessWalls( dRawL, dRawW, dRawH, vWall, bMachGroupOk, bNewPr
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
local dPosH = EgtIf( vWall[i].PosY < 0.1, ( dRawH - PartHeight) / 2, vWall[i].PosY)
|
local dPosH = EgtIf( vWall[i].PosY < 0.1, ( dRawH - PartHeight) / 2, vWall[i].PosY)
|
||||||
|
EgtSetInfo( nRaw, 'SUBPIECE', dPosH)
|
||||||
ptPos = Point3d( dRawL - vWall[i].PosX - PartLen, vWall[i].PosZ, dPosH) + vtOffs
|
ptPos = Point3d( dRawL - vWall[i].PosX - PartLen, vWall[i].PosZ, dPosH) + vtOffs
|
||||||
end
|
end
|
||||||
EgtAddPartToRawPart( Pz, ptPos, nRaw)
|
EgtAddPartToRawPart( Pz, ptPos, nRaw)
|
||||||
@@ -159,7 +178,7 @@ end
|
|||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
-- *** Inserimento delle lavorazioni nelle pareti ***
|
-- *** Inserimento delle lavorazioni nelle pareti ***
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
function WallExec.CollectFeatures( PartId, b3Raw)
|
function WallExec.CollectFeatures( PartId, b3Raw, b3Squaring)
|
||||||
-- recupero le feature
|
-- recupero le feature
|
||||||
local vProc = {}
|
local vProc = {}
|
||||||
local LayerId = {}
|
local LayerId = {}
|
||||||
@@ -191,8 +210,31 @@ function WallExec.CollectFeatures( PartId, b3Raw)
|
|||||||
Proc.TaskId = nTaskId
|
Proc.TaskId = nTaskId
|
||||||
Proc.Box = EgtGetBBoxGlob( ProcId, GDB_BB.STANDARD)
|
Proc.Box = EgtGetBBoxGlob( ProcId, GDB_BB.STANDARD)
|
||||||
Proc.IsOutline = ( Proc.Prc == 251 or Proc.Prc == 252)
|
Proc.IsOutline = ( Proc.Prc == 251 or Proc.Prc == 252)
|
||||||
|
if b3Raw then
|
||||||
|
-- recupero l'elenco delle facce della parte interessate dalla feature
|
||||||
|
Proc.AffectedFaces = WL.GetProcessAffectedFaces( Proc)
|
||||||
|
-- recupero le distanze tra la feature e le altre parti più vicine
|
||||||
|
Proc.DistanceToNearestParts = WL.GetProcessDistanceToNearestParts( Proc)
|
||||||
|
-- recupero le distanze tra la feature e il grezzo
|
||||||
|
Proc.DistanceToRawPart = WL.GetProcessDistanceToRawPart( Proc, b3Raw)
|
||||||
|
-- recupero informazioni sulle facce della feature
|
||||||
|
Proc.Face = {}
|
||||||
|
if Proc.Fct < 50 then
|
||||||
|
for i = 1, Proc.Fct do
|
||||||
|
Proc.Face[i] = { Id = i - 1, VtN = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT ), Elevation = WL.GetFaceElevation( Proc.Id, i - 1, PartId)}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
if Proc.Box and not Proc.Box:isEmpty() then
|
if Proc.Box and not Proc.Box:isEmpty() then
|
||||||
table.insert( vProc, Proc)
|
table.insert( vProc, Proc)
|
||||||
|
-- se squadratura sui pezzi, si annullano le lavorazioni esterne al box di squadratura
|
||||||
|
if b3Squaring then
|
||||||
|
local b3SquaringReduced = BBox3d( b3Squaring)
|
||||||
|
b3SquaringReduced:expand( -0.1)
|
||||||
|
if not OverlapsXY( Proc.Box, b3SquaringReduced) then
|
||||||
|
Proc.Flag = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
-- se foro
|
-- se foro
|
||||||
if Drill.Identify( Proc) then
|
if Drill.Identify( Proc) then
|
||||||
-- assegno diametro e facce di ingresso e uscita (dati tabelle sempre per riferimento)
|
-- assegno diametro e facce di ingresso e uscita (dati tabelle sempre per riferimento)
|
||||||
@@ -291,20 +333,34 @@ local function ClassifyFeatures( vProc, b3Raw)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
local function ClassifyTopology( vProc, nRawId)
|
||||||
|
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||||
|
local nRecognized = 0
|
||||||
|
for i = 1, #vProc do
|
||||||
|
local Proc = vProc[i]
|
||||||
|
if Topology.Classify( Proc, b3Raw) then
|
||||||
|
nRecognized = nRecognized + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return nRecognized
|
||||||
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
local function PrintFeatures( vProc)
|
local function PrintFeatures( vProc)
|
||||||
EgtOutLog( ' *** Feature List ***')
|
EgtOutLog( ' *** Feature List ***')
|
||||||
for i = 1, #vProc do
|
for i = 1, #vProc do
|
||||||
local Proc = vProc[i]
|
local Proc = vProc[i]
|
||||||
local sOut = string.format( 'Part=%3d Proc=%3d Grp=%1d Prc=%3d TC=%2d/%d Flg=%2d Lo=%d Fcse=%1d,%1d Diam=%.2f Fct=%2d Dbl=%2d Dlt=%.1f Box=%s',
|
local sOut = string.format( 'Part=%3d Proc=%3d Grp=%1d Prc=%3d TC=%2d/%d Flg=%2d Lo=%d Fcse=%1d,%1d Diam=%.2f Fct=%2d Dbl=%2d Dlt=%.1f Box=%s TopoName=%s',
|
||||||
Proc.PartId, Proc.Id, Proc.Grp, Proc.Prc, Proc.TaskId, Proc.CutId,
|
Proc.PartId, Proc.Id, Proc.Grp, Proc.Prc, Proc.TaskId, Proc.CutId,
|
||||||
Proc.Flg, EgtIf( Proc.LockOut, 1, 0), Proc.Fcs, Proc.Fce, Proc.Diam, Proc.Fct, Proc.Double or 0, Proc.Delta or 0, tostring( Proc.Box))
|
Proc.Flg, EgtIf( Proc.LockOut, 1, 0), Proc.Fcs, Proc.Fce, Proc.Diam, Proc.Fct, Proc.Double or 0, Proc.Delta or 0, tostring( Proc.Box), Proc.TopologyLongName or '')
|
||||||
EgtOutLog( sOut)
|
EgtOutLog( sOut)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
local function AddFeatureMachining( Proc, nRawId, b3Raw, vNLO)
|
local function AddFeatureMachining( Proc, nRawId, b3Raw, vNLO, b3Squaring)
|
||||||
local bOk = true
|
local bOk = true
|
||||||
local sErr = ''
|
local sErr = ''
|
||||||
EgtOutLog( ' * Process ' .. tostring( Proc.Id) .. ' *', 1)
|
EgtOutLog( ' * Process ' .. tostring( Proc.Id) .. ' *', 1)
|
||||||
@@ -347,7 +403,7 @@ local function AddFeatureMachining( Proc, nRawId, b3Raw, vNLO)
|
|||||||
-- se contorno libero, outline o apertura ( 0/3/4-250/251/252-X)
|
-- se contorno libero, outline o apertura ( 0/3/4-250/251/252-X)
|
||||||
elseif FreeContour.Identify( Proc) then
|
elseif FreeContour.Identify( Proc) then
|
||||||
-- esecuzione contorno libero
|
-- esecuzione contorno libero
|
||||||
bOk, sErr = FreeContour.Make( Proc, nRawId, b3Raw, vNLO)
|
bOk, sErr = FreeContour.Make( Proc, nRawId, b3Raw, vNLO, b3Squaring)
|
||||||
-- se feature custom (Variant)
|
-- se feature custom (Variant)
|
||||||
elseif Variant.Identify( Proc) then
|
elseif Variant.Identify( Proc) then
|
||||||
-- esecuzione
|
-- esecuzione
|
||||||
@@ -579,6 +635,8 @@ local function SortMachinings( nPhase, PrevMch, nPartId, nPriority)
|
|||||||
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_MY.SURFFINISHING, nil, nil, 'MOVE_AFTER', false, nil, nil, nil, nPriority)
|
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_MY.SURFFINISHING, nil, nil, 'MOVE_AFTER', false, nil, nil, nil, nPriority)
|
||||||
-- Fresature per gole
|
-- Fresature per gole
|
||||||
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, { 'Gorge_'}, true, 'MOVE_AFTER', false, nil, nil, nil, nPriority)
|
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, { 'Gorge_'}, true, 'MOVE_AFTER', false, nil, nil, nil, nPriority)
|
||||||
|
-- Fresature da fare prima delle SideMill
|
||||||
|
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, { 'PreSideMill_'}, true, 'MOVE_AFTER', false, false, true, true, nPriority)
|
||||||
-- Fresature che sono rifiniture di spigoli
|
-- Fresature che sono rifiniture di spigoli
|
||||||
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, { 'SideMill_'}, true, 'MOVE_AFTER', false, false, true, true, nPriority)
|
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, { 'SideMill_'}, true, 'MOVE_AFTER', false, false, true, true, nPriority)
|
||||||
-- Fresature che sono puliture di spigoli
|
-- Fresature che sono puliture di spigoli
|
||||||
@@ -589,6 +647,8 @@ local function SortMachinings( nPhase, PrevMch, nPartId, nPriority)
|
|||||||
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.SAWING, nil, nil, nil, nil, nil, nil, nil, nPriority)
|
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.SAWING, nil, nil, nil, nil, nil, nil, nil, nPriority)
|
||||||
-- Qui rimozione sfridi (se ci sono lavorazioni successive)
|
-- Qui rimozione sfridi (se ci sono lavorazioni successive)
|
||||||
if not nPriority then
|
if not nPriority then
|
||||||
|
-- Fresature da fare prima delle SideMill
|
||||||
|
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, { 'PreSideMill_'}, true, 'MOVE_AFTER', true, false, true, true)
|
||||||
-- Fresature dei lapjoint che necessitano di gorge
|
-- Fresature dei lapjoint che necessitano di gorge
|
||||||
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, { 'SideMill_'}, true, 'MOVE_AFTER', true, false, true, true)
|
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, { 'SideMill_'}, true, 'MOVE_AFTER', true, false, true, true)
|
||||||
-- Tagli con sega a catena che vanno fatti dopo i tagli con lama
|
-- Tagli con sega a catena che vanno fatti dopo i tagli con lama
|
||||||
@@ -626,6 +686,452 @@ function InsertScrapRemoval( nPhase)
|
|||||||
EgtSetCurrMachining( nActiveMachiningId or GDB_ID.NULL)
|
EgtSetCurrMachining( nActiveMachiningId or GDB_ID.NULL)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
-- funzione per l'ordinamento delle features in doppio da accoppiare
|
||||||
|
-- ordinate prima in base alla X e poi alla Y
|
||||||
|
local function SortFeaturesForMirror( Proc1, Proc2)
|
||||||
|
-- tolleranza di ricerca
|
||||||
|
local TOL = EgtIf( Proc1.TopologyLongName == 'DRILLING', WD.DOUBLE_HEAD_DRILLING_TOLERANCE or 0.1 , WD.DOUBLE_HEAD_POCKET_TOLERANCE or 0.5)
|
||||||
|
-- recupero i centri dei box lungo X e Y
|
||||||
|
local Proc1X = Proc1.Box:getCenter():getX()
|
||||||
|
local Proc1Y = Proc1.Box:getCenter():getY()
|
||||||
|
local Proc2X = Proc2.Box:getCenter():getX()
|
||||||
|
local Proc2Y = Proc2.Box:getCenter():getY()
|
||||||
|
-- confronto per ordinamento
|
||||||
|
if Proc1X < Proc2X - TOL then
|
||||||
|
return true
|
||||||
|
elseif abs( Proc1X - Proc2X) < TOL then
|
||||||
|
if Proc1Y < Proc2Y - TOL then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
-- funzione per l'ordinamento delle operazioni in doppio da accoppiare
|
||||||
|
-- ordinate prima in base alla X e poi alla Y
|
||||||
|
local function SortOperationsForMirror( nOper1, nOper2)
|
||||||
|
-- tolleranza di ricerca
|
||||||
|
local TOL = 0.1
|
||||||
|
-- recupero il box della prima operazione
|
||||||
|
local nClId1 = EgtGetFirstNameInGroup( nOper1, 'CL')
|
||||||
|
local ptMin1 = EgtGetInfo( nClId1, 'MMIN', 'p')
|
||||||
|
local ptMax1 = EgtGetInfo( nClId1, 'MMAX', 'p')
|
||||||
|
local b3Oper1 = BBox3d( ptMin1, ptMax1)
|
||||||
|
-- recupero il box delle seconda operazione
|
||||||
|
local nClId2 = EgtGetFirstNameInGroup( nOper2, 'CL')
|
||||||
|
local ptMin2 = EgtGetInfo( nClId2, 'MMIN', 'p')
|
||||||
|
local ptMax2 = EgtGetInfo( nClId2, 'MMAX', 'p')
|
||||||
|
local b3Oper2 = BBox3d( ptMin2, ptMax2)
|
||||||
|
-- recupero i centri dei box lungo X e Y
|
||||||
|
local dOper1X = b3Oper1:getCenter():getX()
|
||||||
|
local dOper1Y = b3Oper1:getCenter():getY()
|
||||||
|
local dOper2X = b3Oper2:getCenter():getX()
|
||||||
|
local dOper2Y = b3Oper2:getCenter():getY()
|
||||||
|
-- confronto per ordinamento
|
||||||
|
if dOper1X < dOper2X - TOL then
|
||||||
|
return true
|
||||||
|
elseif abs( dOper1X - dOper2X) < TOL then
|
||||||
|
if dOper1Y < dOper2Y - TOL then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
-- Controlla in vProc la presenza di feature da lavorare in doppio e, se trovate, ne setta i parametri
|
||||||
|
local function SetMirroredFeatures( vProc, b3Raw)
|
||||||
|
-- interasse minimo
|
||||||
|
local dMinimumDistanceMirroredFeatures = 780
|
||||||
|
-- inizializzazione array tasche e forature
|
||||||
|
local vPockets = {}
|
||||||
|
local vDrillings = {}
|
||||||
|
|
||||||
|
-- raccolgo le feature compatibili con doppio
|
||||||
|
for i = 1, #vProc do
|
||||||
|
local Proc = vProc[i]
|
||||||
|
if Proc.Flg ~= 0 then
|
||||||
|
-- raccolgo le tasche compatibili
|
||||||
|
if WD.DOUBLE_HEAD_POCKET and
|
||||||
|
(
|
||||||
|
( Proc.TopologyLongName == 'Rabbet-Through-RightAngles-Parallel-2' and Proc.AffectedFaces.Left and Proc.AffectedFaces.Right) or
|
||||||
|
( Proc.TopologyLongName == 'Groove-Through-RightAngles-Parallel-3' and ( not Proc.AffectedFaces.Bottom and Proc.AffectedFaces.Left and Proc.AffectedFaces.Right)) or
|
||||||
|
( Proc.TopologyLongName == 'Groove-Blind-RightAngles-Parallel-3') or
|
||||||
|
( Proc.TopologyLongName == 'Groove-Blind-RightAngles-Parallel-4') or
|
||||||
|
( Proc.TopologyLongName == 'Pocket-Blind-RightAngles-Parallel-5' and not Proc.AffectedFaces.Bottom)
|
||||||
|
) then
|
||||||
|
table.insert( vPockets, Proc)
|
||||||
|
-- raccolgo i fori verticali e aperti verso Z+
|
||||||
|
elseif WD.DOUBLE_HEAD_DRILLING and Proc.TopologyLongName == 'DRILLING' then
|
||||||
|
-- recupero e verifico la geometria del foro
|
||||||
|
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
|
||||||
|
if AuxId then AuxId = AuxId + Proc.Id end
|
||||||
|
if not AuxId or EgtGetType( AuxId) ~= GDB_TY.CRV_ARC then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
||||||
|
if Proc.AffectedFaces.Top and AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then
|
||||||
|
table.insert( vDrillings, Proc)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- ordinamento delle feature raccolte secondo X e poi Y crescente
|
||||||
|
table.sort( vPockets, SortFeaturesForMirror)
|
||||||
|
table.sort( vDrillings, SortFeaturesForMirror)
|
||||||
|
|
||||||
|
-- accoppio le tasche
|
||||||
|
local nCurrentPocket = 1
|
||||||
|
while nCurrentPocket <= #vPockets do
|
||||||
|
local Proc = vPockets[nCurrentPocket]
|
||||||
|
if Proc.Flg ~= 0 then
|
||||||
|
local b3Proc = EgtGetBBoxGlob( Proc.Id, GDB_BB.STANDARD)
|
||||||
|
-- cerco evenutale specchiata
|
||||||
|
local nCurrentMirrorPocket = nCurrentPocket + 1
|
||||||
|
while nCurrentMirrorPocket <= #vPockets do
|
||||||
|
local ProcMirror = vPockets[nCurrentMirrorPocket]
|
||||||
|
local b3ProcMirror = EgtGetBBoxGlob( ProcMirror.Id, GDB_BB.STANDARD)
|
||||||
|
-- feature non disattivata e diversa da nCurrentPocket
|
||||||
|
local bIsMirrorIdOk = ( Proc.Id ~= ProcMirror.Id and ProcMirror.Flg ~= 0)
|
||||||
|
-- feature mirror della stessa classe topologica
|
||||||
|
local bIsMirrorTopologyOk = ( Proc.TopologyLongName == ProcMirror.TopologyLongName)
|
||||||
|
-- determino se di fianco o in mezzo al singolo pannello
|
||||||
|
local bLapVsTop = Proc.AffectedFaces.Front and
|
||||||
|
(
|
||||||
|
Proc.TopologyLongName == 'Rabbet-Through-RightAngles-Parallel-2' or
|
||||||
|
Proc.TopologyLongName == 'Groove-Through-RightAngles-Parallel-3' or
|
||||||
|
Proc.TopologyLongName == 'Groove-Blind-RightAngles-Parallel-3' or
|
||||||
|
Proc.TopologyLongName == 'Groove-Blind-RightAngles-Parallel-4' or
|
||||||
|
Proc.TopologyLongName == 'Pocket-Blind-RightAngles-Parallel-5'
|
||||||
|
)
|
||||||
|
-- se di fianco, determino se è l'ultima parte prima della fine del grezzo
|
||||||
|
local bIsFeatureOnEdge, bIsMirrorFeatureOnEdge = false, false
|
||||||
|
if bLapVsTop then
|
||||||
|
bIsFeatureOnEdge = Proc.DistanceToNearestParts.Front > b3Raw:getDimY()
|
||||||
|
bIsMirrorFeatureOnEdge = ProcMirror.DistanceToNearestParts.Back > b3Raw:getDimY()
|
||||||
|
end
|
||||||
|
-- se di fianco, si sceglie se le feature sono compatibili con il doppio e nel caso che tipo di lavorazione fare
|
||||||
|
-- -1: no doppio, 0: nessuna preferenza, 1: pocket, 2: side (scambio faccia principale)
|
||||||
|
local nDoubleType = 0
|
||||||
|
local bAllowSideOnMirror = ( ProcMirror.DistanceToRawPart.Back - Proc.DistanceToRawPart.Front < 1 + 10 * GEO.EPS_SMALL) or ( not WD.SIDEMILL_BEFORE and ( not Proc.AffectedFaces.Top or not ProcMirror.AffectedFaces.Top))
|
||||||
|
if bLapVsTop and ( Proc.AffectedFaces.Top or Proc.AffectedFaces.Bottom) then
|
||||||
|
-- side
|
||||||
|
if bIsFeatureOnEdge and bIsMirrorFeatureOnEdge then
|
||||||
|
if not ( Proc.AffectedFaces.Top and ProcMirror.AffectedFaces.Top) then
|
||||||
|
nDoubleType = 2
|
||||||
|
end
|
||||||
|
-- no doppio
|
||||||
|
elseif Proc.AffectedFaces.Bottom or ProcMirror.AffectedFaces.Bottom then
|
||||||
|
nDoubleType = -1
|
||||||
|
-- tasca
|
||||||
|
else
|
||||||
|
nDoubleType = 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- corrispondenza nella posizione delle feature. Se di fianco il lato master è sempre quello verso l'operatore, se sopra nessun vincolo
|
||||||
|
local bIsMirrorSideOk = ( bLapVsTop and ProcMirror.AffectedFaces.Back and bIsFeatureOnEdge and bIsMirrorFeatureOnEdge and bAllowSideOnMirror) or
|
||||||
|
Proc.TopologyLongName == 'Groove-Through-RightAngles-Parallel-3' and Proc.AffectedFaces.Top and ProcMirror.AffectedFaces.Top or
|
||||||
|
Proc.TopologyLongName == 'Groove-Blind-RightAngles-Parallel-4' and Proc.AffectedFaces.Top and Proc.AffectedFaces.Left and ProcMirror.AffectedFaces.Top and ProcMirror.AffectedFaces.Left or
|
||||||
|
Proc.TopologyLongName == 'Groove-Blind-RightAngles-Parallel-4' and Proc.AffectedFaces.Top and Proc.AffectedFaces.Right and ProcMirror.AffectedFaces.Top and ProcMirror.AffectedFaces.Right or
|
||||||
|
Proc.TopologyLongName == 'Pocket-Blind-RightAngles-Parallel-5' and Proc.AffectedFaces.Top and ProcMirror.AffectedFaces.Top
|
||||||
|
-- box delle stesse dimensioni
|
||||||
|
local bIsMirrorFeatureSameDimension = abs( b3Proc:getDimX() - b3ProcMirror:getDimX()) < ( WD.DOUBLE_HEAD_POCKET_TOLERANCE or 0.5) and
|
||||||
|
abs( b3Proc:getDimY() - b3ProcMirror:getDimY()) < ( WD.DOUBLE_HEAD_POCKET_TOLERANCE or 0.5) and
|
||||||
|
abs( b3Proc:getDimZ() - b3ProcMirror:getDimZ()) < ( WD.DOUBLE_HEAD_POCKET_TOLERANCE or 0.5)
|
||||||
|
-- box allineati in X
|
||||||
|
local bIsMirrorBoxXAligned = abs( Proc.Box:getCenter():getX() - ProcMirror.Box:getCenter():getX()) < ( WD.DOUBLE_HEAD_POCKET_TOLERANCE or 0.5)
|
||||||
|
-- box che non si intersecano
|
||||||
|
local bIsNotMirrorBoxOverlapping = not OverlapsXY( b3Proc, b3ProcMirror)
|
||||||
|
-- distanza minima tra le feature
|
||||||
|
local dYMinDistance = max( b3Proc:getMin():getY(), b3ProcMirror:getMin():getY()) - min( b3Proc:getMax():getY(), b3ProcMirror:getMax():getY())
|
||||||
|
local bIsMirrorFeatureDistanceOk = dYMinDistance > dMinimumDistanceMirroredFeatures + 10 * GEO.EPS_SMALL
|
||||||
|
-- se tutte vere le condizioni, calcolo i parametri da passare alle lavorazioni
|
||||||
|
if nDoubleType > -1 and bIsMirrorIdOk and bIsMirrorTopologyOk and bIsMirrorSideOk and bIsMirrorFeatureSameDimension and bIsMirrorBoxXAligned and bIsNotMirrorBoxOverlapping and bIsMirrorFeatureDistanceOk then
|
||||||
|
local dYMirrorAx
|
||||||
|
local b3Tab = EgtGetTableArea()
|
||||||
|
local ptOnMirrorAx = ( Proc.Box:getCenter() + ProcMirror.Box:getCenter()) / 2
|
||||||
|
dYMirrorAx = ptOnMirrorAx:getY() - b3Tab:getMin():getY()
|
||||||
|
local dDeltaZ = ProcMirror.Box:getMax():getZ() - Proc.Box:getMax():getZ()
|
||||||
|
-- forzo side o pocket, se necessario
|
||||||
|
if nDoubleType == 1 then
|
||||||
|
EgtSetInfo( Proc.Id, 'PCKT', 1)
|
||||||
|
EgtSetInfo( ProcMirror.Id, 'PCKT', 1)
|
||||||
|
elseif nDoubleType == 2 then
|
||||||
|
Proc.Stype = 2
|
||||||
|
ProcMirror.Stype = 2
|
||||||
|
end
|
||||||
|
-- scrivo i parametri nella lavorazione
|
||||||
|
-- 2: specchiatura in Y
|
||||||
|
Proc.Double = 2
|
||||||
|
Proc.Mirror = ProcMirror
|
||||||
|
-- posizione Y dell'asse di specchiatura
|
||||||
|
Proc.MirrorAx = dYMirrorAx
|
||||||
|
-- Offset Z tra le feature
|
||||||
|
Proc.MirrorDeltaZ = dDeltaZ
|
||||||
|
|
||||||
|
-- rimuovo dalla lista le pocket già assegnate
|
||||||
|
local ProcMirrorOldId = ProcMirror.Id
|
||||||
|
table.remove( vPockets, nCurrentPocket)
|
||||||
|
-- avendo rimosso un elemento dall'array, potrebbe essere cambiato l'elemento nCurrentMirrorPocket
|
||||||
|
if nCurrentMirrorPocket > #vPockets or ( vPockets[nCurrentMirrorPocket].Id ~= ProcMirrorOldId) then nCurrentMirrorPocket = nCurrentMirrorPocket - 1 end
|
||||||
|
table.remove( vPockets, nCurrentMirrorPocket)
|
||||||
|
nCurrentPocket = 0
|
||||||
|
break
|
||||||
|
end
|
||||||
|
nCurrentMirrorPocket = nCurrentMirrorPocket + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
nCurrentPocket = nCurrentPocket + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
-- accoppio le forature
|
||||||
|
local nCurrentDrilling = 1
|
||||||
|
while nCurrentDrilling <= #vDrillings do
|
||||||
|
local Proc = vDrillings[nCurrentDrilling]
|
||||||
|
if Proc.Flg ~= 0 then
|
||||||
|
local b3Proc = EgtGetBBoxGlob( Proc.Id, GDB_BB.STANDARD)
|
||||||
|
-- cerco evenutale specchiata
|
||||||
|
local nCurrentMirrorDrilling = nCurrentDrilling + 1
|
||||||
|
while nCurrentMirrorDrilling <= #vDrillings do
|
||||||
|
local ProcMirror = vDrillings[nCurrentMirrorDrilling]
|
||||||
|
local b3ProcMirror = EgtGetBBoxGlob( ProcMirror.Id, GDB_BB.STANDARD)
|
||||||
|
-- feature non disattivata e diversa da nCurrentDrilling
|
||||||
|
local bIsMirrorIdOk = ( Proc.Id ~= ProcMirror.Id and ProcMirror.Flg ~= 0)
|
||||||
|
-- box delle stesse dimensioni
|
||||||
|
local bIsMirrorFeatureSameDimension = abs( b3Proc:getDimX() - b3ProcMirror:getDimX()) < ( WD.DOUBLE_HEAD_DRILLING_TOLERANCE or 0.1) and
|
||||||
|
abs( b3Proc:getDimY() - b3ProcMirror:getDimY()) < ( WD.DOUBLE_HEAD_DRILLING_TOLERANCE or 0.1) and
|
||||||
|
abs( b3Proc:getDimZ() - b3ProcMirror:getDimZ()) < ( WD.DOUBLE_HEAD_DRILLING_TOLERANCE or 0.1)
|
||||||
|
-- box allineati in X
|
||||||
|
local bIsMirrorBoxXAligned = abs( Proc.Box:getCenter():getX() - ProcMirror.Box:getCenter():getX()) < ( WD.DOUBLE_HEAD_DRILLING_TOLERANCE or 0.1)
|
||||||
|
-- box che non si intersecano
|
||||||
|
local bIsNotMirrorBoxOverlapping = not OverlapsXY( b3Proc, b3ProcMirror)
|
||||||
|
-- distanza minima tra le feature
|
||||||
|
local dYMinDistance = max( b3Proc:getMin():getY(), b3ProcMirror:getMin():getY()) - min( b3Proc:getMax():getY(), b3ProcMirror:getMax():getY())
|
||||||
|
local bIsMirrorFeatureDistanceOk = dYMinDistance > dMinimumDistanceMirroredFeatures + 10 * GEO.EPS_SMALL
|
||||||
|
-- se tutte vere le condizioni, calcolo i parametri da passare alle lavorazioni
|
||||||
|
if bIsMirrorIdOk and bIsMirrorFeatureSameDimension and bIsMirrorBoxXAligned and bIsNotMirrorBoxOverlapping and bIsMirrorFeatureDistanceOk then
|
||||||
|
local dYMirrorAx
|
||||||
|
local b3Tab = EgtGetTableArea()
|
||||||
|
local ptOnMirrorAx = ( Proc.Box:getCenter() + ProcMirror.Box:getCenter()) / 2
|
||||||
|
dYMirrorAx = ptOnMirrorAx:getY() - b3Tab:getMin():getY()
|
||||||
|
-- scrivo i parametri nella lavorazione
|
||||||
|
-- 2: specchiatura in Y
|
||||||
|
Proc.Double = 2
|
||||||
|
Proc.Mirror = ProcMirror
|
||||||
|
-- posizione Y dell'asse di specchiatura
|
||||||
|
Proc.MirrorAx = dYMirrorAx
|
||||||
|
|
||||||
|
-- rimuovo dalla lista le forature già assegnate
|
||||||
|
local ProcMirrorOldId = ProcMirror.Id
|
||||||
|
table.remove( vDrillings, nCurrentDrilling)
|
||||||
|
-- avendo rimosso un elemento dall'array, potrebbe essere cambiato l'elemento nCurrentMirrorDrilling
|
||||||
|
if nCurrentMirrorDrilling > #vDrillings or ( vDrillings[nCurrentMirrorDrilling].Id ~= ProcMirrorOldId) then nCurrentMirrorDrilling = nCurrentMirrorDrilling - 1 end
|
||||||
|
table.remove( vDrillings, nCurrentMirrorDrilling)
|
||||||
|
nCurrentDrilling = 0
|
||||||
|
break
|
||||||
|
end
|
||||||
|
nCurrentMirrorDrilling = nCurrentMirrorDrilling + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
nCurrentDrilling = nCurrentDrilling + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
-- verifico e imposto le fresature da specchiare
|
||||||
|
local function SetMirroredOperations()
|
||||||
|
-- interasse minimo
|
||||||
|
local dMinimumDistanceMirroredOperations = 780
|
||||||
|
-- inzializzazione array
|
||||||
|
local vMillings = {}
|
||||||
|
|
||||||
|
-- raccolgo le fresature non già fatte in doppio
|
||||||
|
if WD.DOUBLE_HEAD_MILLCORNER then
|
||||||
|
local nOperId = EgtGetNextOperation( EgtGetPhaseDisposition( 1))
|
||||||
|
while nOperId do
|
||||||
|
EgtSetCurrMachining( nOperId)
|
||||||
|
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
|
||||||
|
local bIsDouble = ( EgtGetValInNotes( sUserNotes, 'DOUBLE', 'i') or 0) > 0
|
||||||
|
if EgtGetOperationMode( nOperId) and not EgtIsMachiningEmpty( nOperId) and not bIsDouble and EgtGetOperationType( nOperId) == MCH_OY.MILLING then
|
||||||
|
table.insert( vMillings, nOperId)
|
||||||
|
end
|
||||||
|
nOperId = EgtGetNextOperation( nOperId)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- ordinamento delle operazioni raccolte secondo X e poi Y crescente
|
||||||
|
table.sort( vMillings, SortOperationsForMirror)
|
||||||
|
|
||||||
|
-- accoppio le fresature
|
||||||
|
local nCurrentMilling = 1
|
||||||
|
while nCurrentMilling <= #vMillings do
|
||||||
|
local nOperIdMaster = vMillings[nCurrentMilling]
|
||||||
|
EgtSetCurrMachining( nOperIdMaster)
|
||||||
|
local sMachining = EgtGetMachiningParam( MCH_MP.NAME, 's')
|
||||||
|
local nClId = EgtGetFirstNameInGroup( nOperIdMaster, 'CL')
|
||||||
|
local nPathId = EgtGetFirstInGroup( nClId or GDB_ID.NULL)
|
||||||
|
-- vettore direzione utensile e somma normali facce per lavorazione master
|
||||||
|
local vtTool = EgtGetInfo( nPathId, 'EXTR', 'v')
|
||||||
|
local vtNormSum = EgtGetInfo( nOperIdMaster, 'NORM_SUM', 'v')
|
||||||
|
local ptMin = EgtGetInfo( nClId, 'MMIN', 'p')
|
||||||
|
local ptMax = EgtGetInfo( nClId, 'MMAX', 'p')
|
||||||
|
-- box percorso lavorazione master
|
||||||
|
local b3Operation = BBox3d( ptMin, ptMax)
|
||||||
|
-- lavorazione master adatta alla specchiatura
|
||||||
|
local bIsMachiningOk = WM.IsMachiningOkForDouble( sMachining)
|
||||||
|
if bIsMachiningOk then
|
||||||
|
-- recupero la distanza tra centro di rotazione e punta dell'utensile per aumentare o ridurre l'interasse minimo
|
||||||
|
local dTipToPivot, dTipToPivotDouble = 999, 999
|
||||||
|
local dToolMasterTotLength, dToolMasterTotLengthDouble = 999, 999
|
||||||
|
local sToolMasterName = ''
|
||||||
|
if EgtMdbSetCurrMachining( sMachining) then
|
||||||
|
-- recupero l'utensile della lavorazione e il suo doppio
|
||||||
|
sToolMasterName = EgtMdbGetCurrMachiningParam( MCH_MP.TOOL)
|
||||||
|
if EgtTdbSetCurrTool( sToolMasterName or '') then
|
||||||
|
dToolMasterTotLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) or dToolMasterTotLength
|
||||||
|
local sToolDoubleName = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'DOUBLE', 's')
|
||||||
|
if sToolDoubleName and EgtTdbSetCurrTool( sToolDoubleName) then
|
||||||
|
dToolMasterTotLengthDouble = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) or dToolMasterTotLengthDouble
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if WD.HEAD_PIVOT_MAIN and WD.HEAD_PIVOT_SECONDARY then
|
||||||
|
dTipToPivot = dToolMasterTotLength + WD.HEAD_PIVOT_MAIN
|
||||||
|
dTipToPivotDouble = dToolMasterTotLengthDouble + WD.HEAD_PIVOT_SECONDARY
|
||||||
|
else
|
||||||
|
local sOut = 'Error : HEAD_PIVOT_MAIN or HEAD_PIVOT_SECONDARY missing in WallData'
|
||||||
|
return false, sOut
|
||||||
|
end
|
||||||
|
-- cerco eventuale specchiata
|
||||||
|
local nCurrentMirrorMilling = nCurrentMilling + 1
|
||||||
|
while nCurrentMirrorMilling <= #vMillings do
|
||||||
|
local nOperIdMirror = vMillings[nCurrentMirrorMilling]
|
||||||
|
EgtSetCurrMachining( nOperIdMirror)
|
||||||
|
local nClIdMirror = EgtGetFirstNameInGroup( nOperIdMirror, 'CL')
|
||||||
|
local nPathIdMirror = EgtGetFirstInGroup( nClIdMirror or GDB_ID.NULL)
|
||||||
|
-- vettore direzione utensile e somma normali facce per lavorazione mirror
|
||||||
|
local vtToolMirror = EgtGetInfo( nPathIdMirror, 'EXTR', 'v')
|
||||||
|
local vtNormSumMirror = EgtGetInfo( nOperIdMirror, 'NORM_SUM', 'v')
|
||||||
|
local ptMinMirror = EgtGetInfo( nClIdMirror, 'MMIN', 'p')
|
||||||
|
local ptMaxMirror = EgtGetInfo( nClIdMirror, 'MMAX', 'p')
|
||||||
|
-- box percorso lavorazione mirror
|
||||||
|
local b3OperationMirror = BBox3d( ptMinMirror, ptMaxMirror)
|
||||||
|
-- utensile originale lavorazione specchiata
|
||||||
|
local sOriginalMirrorToolName = EgtGetMachiningParam( MCH_MP.TOOL)
|
||||||
|
local bIsOriginalMirrorToolSameSize = WM.IsToolDoubleOk( sToolMasterName, sOriginalMirrorToolName)
|
||||||
|
-- lavorazione mirror adatta alla specchiatura
|
||||||
|
local bIsMirrorMachiningOk = nOperIdMaster ~= nOperIdMirror
|
||||||
|
-- lavorazione master più a sinistra
|
||||||
|
local bIsMirrorSideOk = ( b3OperationMirror:getCenter():getY() - b3Operation:getCenter():getY()) > ( WD.DOUBLE_HEAD_POCKET_TOLERANCE or 0.5)
|
||||||
|
-- box delle stesse dimensioni
|
||||||
|
local bIsMirrorOperationSameDimension = abs( b3Operation:getDimX() - b3OperationMirror:getDimX()) < ( WD.DOUBLE_HEAD_POCKET_TOLERANCE or 0.5) and
|
||||||
|
abs( b3Operation:getDimY() - b3OperationMirror:getDimY()) < ( WD.DOUBLE_HEAD_POCKET_TOLERANCE or 0.5) and
|
||||||
|
abs( b3Operation:getDimZ() - b3OperationMirror:getDimZ()) < ( WD.DOUBLE_HEAD_POCKET_TOLERANCE or 0.5)
|
||||||
|
-- box allineati in X
|
||||||
|
local bIsMirrorBoxXAligned = abs( b3Operation:getCenter():getX() - b3OperationMirror:getCenter():getX()) < ( WD.DOUBLE_HEAD_POCKET_TOLERANCE or 0.5) and
|
||||||
|
abs( b3Operation:getCenter():getX() - b3OperationMirror:getCenter():getX()) < ( WD.DOUBLE_HEAD_POCKET_TOLERANCE or 0.5)
|
||||||
|
-- box che non si intersecano
|
||||||
|
local bIsNotMirrorBoxOverlapping = not OverlapsXY( b3Operation, b3OperationMirror)
|
||||||
|
-- distanza minima tra le feature
|
||||||
|
local dTipToPivotProjectionOnY = dTipToPivot * vtTool:getY()
|
||||||
|
local dTipToPivotProjectionOnYDouble = dTipToPivotDouble * vtToolMirror:getY()
|
||||||
|
local dYMinDistance = max( b3Operation:getMin():getY(), b3OperationMirror:getMin():getY()) - min( b3Operation:getMax():getY(), b3OperationMirror:getMax():getY())
|
||||||
|
local bIsMirrorOperationDistanceOk = dYMinDistance > dMinimumDistanceMirroredOperations + dTipToPivotProjectionOnY - dTipToPivotProjectionOnYDouble + 10 * GEO.EPS_SMALL
|
||||||
|
-- vettori utensile e somma normali facce specchiati
|
||||||
|
local vtToolMirrored = Vector3d( vtTool)
|
||||||
|
vtToolMirrored:mirror( Y_AX())
|
||||||
|
local bIsMirrorVectorOk = false
|
||||||
|
if AreSameVectorApprox( vtToolMirrored, vtToolMirror) then
|
||||||
|
if AreSameVectorApprox(vtTool, vtToolMirror) then
|
||||||
|
if vtNormSum and vtNormSumMirror then
|
||||||
|
local vtNormSumMirrored = Vector3d( vtNormSum)
|
||||||
|
vtNormSumMirrored:mirror( Y_AX())
|
||||||
|
bIsMirrorVectorOk = AreSameVectorApprox( vtNormSumMirrored, vtNormSumMirror)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
bIsMirrorVectorOk = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- se condizioni corrette, scrivo le note e cancello la specchiata
|
||||||
|
if bIsOriginalMirrorToolSameSize and bIsMirrorMachiningOk and bIsMirrorSideOk and bIsMirrorOperationSameDimension and bIsMirrorBoxXAligned and bIsNotMirrorBoxOverlapping and bIsMirrorOperationDistanceOk and bIsMirrorVectorOk then
|
||||||
|
-- calcolo asse di specchiatura
|
||||||
|
local dYMirrorAx
|
||||||
|
local b3Tab = EgtGetTableArea()
|
||||||
|
local ptOnMirrorAx = ( b3Operation:getCenter() + b3OperationMirror:getCenter()) / 2
|
||||||
|
dYMirrorAx = ptOnMirrorAx:getY() - b3Tab:getMin():getY()
|
||||||
|
EgtSetCurrMachining( nOperIdMaster)
|
||||||
|
-- leggo note esistenti
|
||||||
|
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
|
||||||
|
-- aggiungo note per doppio
|
||||||
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', 2)
|
||||||
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'MirrorAx', dYMirrorAx)
|
||||||
|
-- scrivo le note della lavorazione
|
||||||
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
||||||
|
-- cancello l'operazione specchiata
|
||||||
|
EgtRemoveOperation( nOperIdMirror)
|
||||||
|
-- rimuovo dalla lista le fresature già assegnate
|
||||||
|
local nCurrentMirrorMillingOldId = nCurrentMirrorMilling
|
||||||
|
table.remove( vMillings, nCurrentMilling)
|
||||||
|
-- avendo rimosso un elemento dall'array, potrebbe essere cambiato l'elemento nCurrentMirrorPocket
|
||||||
|
if nCurrentMirrorMilling > #vMillings or ( vMillings[nCurrentMirrorMilling] ~= nCurrentMirrorMillingOldId) then nCurrentMirrorMilling = nCurrentMirrorMilling - 1 end
|
||||||
|
table.remove( vMillings, nCurrentMirrorMilling)
|
||||||
|
nCurrentMilling = 0
|
||||||
|
break
|
||||||
|
end
|
||||||
|
nCurrentMirrorMilling = nCurrentMirrorMilling + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
nCurrentMilling = nCurrentMilling + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
local function CalculateSquaring( sSquaringTool, RawPart, vPart)
|
||||||
|
local dRawPartHeight = RawPart.b3:getDimZ()
|
||||||
|
local bOk
|
||||||
|
local sMsg = ''
|
||||||
|
local SquaringTools = {}
|
||||||
|
local SquaringParameters = {}
|
||||||
|
local b3Squaring
|
||||||
|
|
||||||
|
SquaringTools = Squaring.GetTools()
|
||||||
|
bOk = Squaring.AreToolsOk( sSquaringTool, SquaringTools, dRawPartHeight)
|
||||||
|
if not bOk then
|
||||||
|
sMsg = 'Squaring failed: cannot find matching tools'
|
||||||
|
return false, {}, nil, sMsg
|
||||||
|
end
|
||||||
|
|
||||||
|
SquaringParameters, b3Squaring = Squaring.CalculateParameters( sSquaringTool, SquaringTools, RawPart, vPart)
|
||||||
|
if not SquaringParameters or next( SquaringParameters) == nil then
|
||||||
|
sMsg = 'Squaring failed: cannot calculate parameters'
|
||||||
|
return false, {}, nil, sMsg
|
||||||
|
end
|
||||||
|
|
||||||
|
return true, SquaringParameters, b3Squaring, sMsg
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
local function AddSquaring( SquaringParameters, b3Squaring)
|
||||||
|
local nFirstOperationId = EgtGetNextOperation( EgtGetPhaseDisposition( 1))
|
||||||
|
local bOk
|
||||||
|
local sMsg = ''
|
||||||
|
local OperationsId = {}
|
||||||
|
|
||||||
|
bOk, sMsg, OperationsId = Squaring.AddMachinings( SquaringParameters, b3Squaring, nFirstOperationId)
|
||||||
|
if not bOk then
|
||||||
|
for i = 1, #OperationsId do
|
||||||
|
EgtRemoveOperation( i)
|
||||||
|
end
|
||||||
|
sMsg = 'Squaring failed: cannot apply machinings'
|
||||||
|
return false, sMsg
|
||||||
|
end
|
||||||
|
|
||||||
|
Squaring.AddScrapRemoval( nFirstOperationId)
|
||||||
|
|
||||||
|
return true, sMsg
|
||||||
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
function WallExec.ProcessFeatures()
|
function WallExec.ProcessFeatures()
|
||||||
-- errori e stato
|
-- errori e stato
|
||||||
@@ -643,13 +1149,61 @@ function WallExec.ProcessFeatures()
|
|||||||
table.insert( vPart, {Id=nPartId, Box=b3Solid})
|
table.insert( vPart, {Id=nPartId, Box=b3Solid})
|
||||||
nPartId = EgtGetNextPartInRawPart( nPartId)
|
nPartId = EgtGetNextPartInRawPart( nPartId)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- calcolo i parametri della squadratura, se richiesta
|
||||||
|
local SquaringParameters = {}
|
||||||
|
local b3Squaring
|
||||||
|
if WD.SQUARING_TYPE and WD.SQUARING_TYPE > 0 then
|
||||||
|
local RawPart = { nId = nRawId, b3 = b3Raw}
|
||||||
|
local bOk, sMsg
|
||||||
|
if type( WD.SQUARING_TOOL) ~= "number" then
|
||||||
|
WD.SQUARING_TOOL = 0
|
||||||
|
end
|
||||||
|
|
||||||
|
if WD.SQUARING_TOOL == 0 or WD.SQUARING_TOOL == 1 then
|
||||||
|
bOk, SquaringParameters, b3Squaring, sMsg = CalculateSquaring( 'DoubleDiskmill', RawPart, vPart)
|
||||||
|
end
|
||||||
|
if not bOk and ( WD.SQUARING_TOOL == 0 or WD.SQUARING_TOOL == 2) then
|
||||||
|
-- attualmente non gestito, va modificata la configurazione macchina e non si sa se sia gestito in macchina (PLC)
|
||||||
|
bOk = false
|
||||||
|
sMsg = 'Squaring not possible : double blade + diskmill not supported'
|
||||||
|
--SquaringParameters, b3Squaring, sMsg = CalculateSquaring( 'DoubleDiskmillAndBlade', RawPart)
|
||||||
|
end
|
||||||
|
if not bOk and ( WD.SQUARING_TOOL == 0 or WD.SQUARING_TOOL == 3) then
|
||||||
|
bOk, SquaringParameters, b3Squaring, sMsg = CalculateSquaring( 'DoubleBlade', RawPart, vPart)
|
||||||
|
end
|
||||||
|
if not bOk and ( WD.SQUARING_TOOL == 0 or WD.SQUARING_TOOL == 4) then
|
||||||
|
bOk, SquaringParameters, b3Squaring, sMsg = CalculateSquaring( 'Diskmill', RawPart, vPart)
|
||||||
|
end
|
||||||
|
if not bOk and ( WD.SQUARING_TOOL == 0 or WD.SQUARING_TOOL == 5) then
|
||||||
|
bOk, SquaringParameters, b3Squaring, sMsg = CalculateSquaring( 'Blade', RawPart, vPart)
|
||||||
|
end
|
||||||
|
if not bOk and ( WD.SQUARING_TOOL == 0 or WD.SQUARING_TOOL == 6) then
|
||||||
|
bOk, SquaringParameters, b3Squaring, sMsg = CalculateSquaring( 'DoubleMill', RawPart, vPart)
|
||||||
|
end
|
||||||
|
if not bOk and ( WD.SQUARING_TOOL == 0 or WD.SQUARING_TOOL == 7) then
|
||||||
|
bOk, SquaringParameters, b3Squaring, sMsg = CalculateSquaring( 'Mill', RawPart, vPart)
|
||||||
|
end
|
||||||
|
|
||||||
|
if not bOk then
|
||||||
|
nTotErr = nTotErr + 1
|
||||||
|
table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=0, TaskId=0})
|
||||||
|
elseif sMsg and #sMsg > 0 then
|
||||||
|
table.insert( Stats, {Err=-1, Msg=sMsg, Rot=0, CutId=0, TaskId=0})
|
||||||
|
else
|
||||||
|
table.insert( Stats, {Err=0, Msg='', Rot=0, CutId=0, TaskId=0})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- raccolgo l'elenco delle feature da lavorare, ciclando sui pezzi
|
-- raccolgo l'elenco delle feature da lavorare, ciclando sui pezzi
|
||||||
local vProc = {}
|
local vProc = {}
|
||||||
for i = 1, #vPart do
|
for i = 1, #vPart do
|
||||||
-- recupero le feature di lavorazione della parete
|
-- recupero le feature di lavorazione della parete
|
||||||
local vPartProc = WallExec.CollectFeatures( vPart[i].Id, b3Raw)
|
local vPartProc = WallExec.CollectFeatures( vPart[i].Id, b3Raw, b3Squaring)
|
||||||
vProc = EgtJoinTables( vProc, vPartProc)
|
vProc = EgtJoinTables( vProc, vPartProc)
|
||||||
end
|
end
|
||||||
|
-- classifico topologicamente le feature
|
||||||
|
ClassifyTopology( vProc, nRawId)
|
||||||
-- classifico le feature
|
-- classifico le feature
|
||||||
ClassifyFeatures( vProc, b3Raw)
|
ClassifyFeatures( vProc, b3Raw)
|
||||||
-- recupero l'elenco delle aree vietate alle chiodature
|
-- recupero l'elenco delle aree vietate alle chiodature
|
||||||
@@ -659,6 +1213,9 @@ function WallExec.ProcessFeatures()
|
|||||||
if #vNLO == 0 and WD.FindFeaturesInDouble then
|
if #vNLO == 0 and WD.FindFeaturesInDouble then
|
||||||
WD.FindFeaturesInDouble( vProc, b3Raw)
|
WD.FindFeaturesInDouble( vProc, b3Raw)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
SetMirroredFeatures( vProc, b3Raw)
|
||||||
|
|
||||||
-- debug
|
-- debug
|
||||||
if EgtGetDebugLevel() >= 1 then
|
if EgtGetDebugLevel() >= 1 then
|
||||||
PrintFeatures( vProc)
|
PrintFeatures( vProc)
|
||||||
@@ -669,7 +1226,7 @@ function WallExec.ProcessFeatures()
|
|||||||
-- creo la lavorazione
|
-- creo la lavorazione
|
||||||
local Proc = vProc[i]
|
local Proc = vProc[i]
|
||||||
if Proc.Flg ~= 0 then
|
if Proc.Flg ~= 0 then
|
||||||
local bOk, sMsg = AddFeatureMachining( Proc, nRawId, b3Raw, vNLO)
|
local bOk, sMsg = AddFeatureMachining( Proc, nRawId, b3Raw, vNLO, b3Squaring)
|
||||||
if not bOk then
|
if not bOk then
|
||||||
nTotErr = nTotErr + 1
|
nTotErr = nTotErr + 1
|
||||||
table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
||||||
@@ -678,12 +1235,59 @@ function WallExec.ProcessFeatures()
|
|||||||
else
|
else
|
||||||
table.insert( Stats, {Err=0, Msg='', Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
table.insert( Stats, {Err=0, Msg='', Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
||||||
end
|
end
|
||||||
elseif not Proc.Double and not Proc.LockOut then
|
elseif not Proc.Double and not Proc.LockOut then
|
||||||
local sMsg = 'Feature not machinable by orientation'
|
local sMsg = 'Feature not machinable by orientation'
|
||||||
table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
EgtOutLog( ' *** End AddMachinings ***', 1)
|
EgtOutLog( ' *** End AddMachinings ***', 1)
|
||||||
|
|
||||||
|
-- setto quali sono le lavorazioni da disattivare perchè specchiate di lavorazioni in doppio
|
||||||
|
local vProcToDisable = {}
|
||||||
|
for i = 1, #vProc do
|
||||||
|
local Proc = vProc[i]
|
||||||
|
if Proc.Double and Proc.Double > 0 then
|
||||||
|
for j = 1, #vProc do
|
||||||
|
local ProcMirror = vProc[j]
|
||||||
|
if Proc.Mirror.Id == ProcMirror.Id then
|
||||||
|
-- per i fori l'operazione si basa sulla geometria ausiliaria
|
||||||
|
if Proc.TopologyLongName == 'DRILLING' then
|
||||||
|
local AuxId = EgtGetInfo( ProcMirror.Id, 'AUXID', 'i') or 0
|
||||||
|
if AuxId then AuxId = AuxId + ProcMirror.Id end
|
||||||
|
table.insert( vProcToDisable, AuxId)
|
||||||
|
-- per tutte le altre lavorazioni si usa la geometria della feature
|
||||||
|
else
|
||||||
|
table.insert( vProcToDisable, ProcMirror.Id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- cancello le operazioni legate a lavorazioni specchiate
|
||||||
|
local nOperId = EgtGetNextOperation( EgtGetPhaseDisposition( 1))
|
||||||
|
while nOperId do
|
||||||
|
EgtSetCurrMachining( nOperId)
|
||||||
|
local nOperationProcIds = EgtGetMachiningGeometry()
|
||||||
|
local nCurrentOperId = nOperId
|
||||||
|
if #nOperationProcIds > 0 then
|
||||||
|
local nOperationProcId = nOperationProcIds[1][1]
|
||||||
|
for i = 1, #vProcToDisable do
|
||||||
|
local ProcId = vProcToDisable[i]
|
||||||
|
if nOperationProcId == ProcId then
|
||||||
|
nOperId = EgtGetNextOperation( nOperId)
|
||||||
|
EgtRemoveOperation( nCurrentOperId)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if nCurrentOperId == nOperId then
|
||||||
|
nOperId = EgtGetNextOperation( nOperId)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
SetMirroredOperations()
|
||||||
|
|
||||||
-- se macchina pareti
|
-- se macchina pareti
|
||||||
if not WD.BEAM_MACHINE then
|
if not WD.BEAM_MACHINE then
|
||||||
-- riordino le lavorazioni tra tutti i pezzi
|
-- riordino le lavorazioni tra tutti i pezzi
|
||||||
@@ -695,7 +1299,7 @@ function WallExec.ProcessFeatures()
|
|||||||
local nGetPriorityFromBtl = WD.BTL_PRIORITY or 0
|
local nGetPriorityFromBtl = WD.BTL_PRIORITY or 0
|
||||||
if nGetPriorityFromBtl > 0 then
|
if nGetPriorityFromBtl > 0 then
|
||||||
local vPriority = {}
|
local vPriority = {}
|
||||||
local nOperId = EgtGetNextOperation( PrevMch)
|
nOperId = EgtGetNextOperation( PrevMch)
|
||||||
local nCurrentPriorityId = 1
|
local nCurrentPriorityId = 1
|
||||||
while nOperId do
|
while nOperId do
|
||||||
local nPriority = EgtGetInfo( nOperId or GDB_ID.NULL, 'PRIORITY', 'i')
|
local nPriority = EgtGetInfo( nOperId or GDB_ID.NULL, 'PRIORITY', 'i')
|
||||||
@@ -722,7 +1326,19 @@ function WallExec.ProcessFeatures()
|
|||||||
end
|
end
|
||||||
-- ordinamento standard
|
-- ordinamento standard
|
||||||
SortMachinings( nPhase, PrevMch)
|
SortMachinings( nPhase, PrevMch)
|
||||||
|
-- squadratura, se richiesta
|
||||||
|
if SquaringParameters and next( SquaringParameters) ~= nil then
|
||||||
|
local bOk, sMsg = AddSquaring( SquaringParameters, b3Squaring)
|
||||||
|
|
||||||
|
if not bOk then
|
||||||
|
nTotErr = nTotErr + 1
|
||||||
|
table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=0, TaskId=0})
|
||||||
|
elseif sMsg and #sMsg > 0 then
|
||||||
|
table.insert( Stats, {Err=-1, Msg=sMsg, Rot=0, CutId=0, TaskId=0})
|
||||||
|
else
|
||||||
|
table.insert( Stats, {Err=0, Msg='', Rot=0, CutId=0, TaskId=0})
|
||||||
|
end
|
||||||
|
end
|
||||||
-- Aggiornamento finale di tutto
|
-- Aggiornamento finale di tutto
|
||||||
if nGetPriorityFromBtl > 0 then
|
if nGetPriorityFromBtl > 0 then
|
||||||
InsertScrapRemoval( nPhase)
|
InsertScrapRemoval( nPhase)
|
||||||
|
|||||||
+218
-1
@@ -1,5 +1,8 @@
|
|||||||
-- WallLib.lua by Egaltech s.r.l. 2023/10/16
|
-- WallLib.lua by Egaltech s.r.l. 2023/10/16
|
||||||
-- Libreria globale per Pareti
|
-- Libreria globale per Pareti
|
||||||
|
-- 2023/06/26 Spostata qui Is3EdgesApprox da FreeContour. Ora cerca autonomamente il gruppo se non viene passato.
|
||||||
|
-- 2023/11/14 Aggiunte funzioni GetProcessAffectedFaces, GetProcessDistanceToNearestParts, GetProcessDistanceToRawPart.
|
||||||
|
-- 2023/12/11 Aggiunta funzione IsFeatureCuttingEntireSection (allineamento Topology con Beam).
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local WallLib = {}
|
local WallLib = {}
|
||||||
@@ -316,6 +319,213 @@ function WallLib.GetNearestOrthoOpposite( vtRef, vtNorm)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
function WallLib.TestElleShape3( nIdGeom, nNumFacet)
|
||||||
|
-- valida solo nel caso di tre facce
|
||||||
|
if nNumFacet ~= 3 then return false end
|
||||||
|
-- determino se L con una faccia terminale o U con tre facce
|
||||||
|
local bIsL = true
|
||||||
|
for i = 1, 3 do
|
||||||
|
local vFacAdj = EgtSurfTmFacetAdjacencies( nIdGeom, i - 1)[1]
|
||||||
|
-- le conto
|
||||||
|
local nCount = 0
|
||||||
|
for j = 1, #vFacAdj do
|
||||||
|
if vFacAdj[j] >= 0 then
|
||||||
|
nCount = nCount + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if nCount == 1 then
|
||||||
|
bIsL = false
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return bIsL
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
function WallLib.TestElleShape4( nIdGeom, nNumFacet)
|
||||||
|
-- valida solo nel caso di quattro facce
|
||||||
|
if nNumFacet ~= 4 then return false end
|
||||||
|
-- determino se L con due facce terminali o O
|
||||||
|
local nFac3Adj = 0
|
||||||
|
local dMinArea3 = GEO.INFINITO * GEO.INFINITO
|
||||||
|
local dMaxArea2 = 0
|
||||||
|
for i = 1, 4 do
|
||||||
|
local vFacAdj = EgtSurfTmFacetAdjacencies( nIdGeom, i - 1)[1]
|
||||||
|
-- le conto
|
||||||
|
local nCount = 0
|
||||||
|
for j = 1, #vFacAdj do
|
||||||
|
if vFacAdj[j] >= 0 then
|
||||||
|
nCount = nCount + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( nIdGeom, i - 1, GDB_ID.ROOT)
|
||||||
|
local dArea = dH * dV
|
||||||
|
if nCount == 2 then
|
||||||
|
dMaxArea2 = max( dMaxArea2, dArea)
|
||||||
|
elseif nCount == 3 then
|
||||||
|
dMinArea3 = min( dMinArea3, dArea)
|
||||||
|
nFac3Adj = nFac3Adj + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if nFac3Adj ~= 2 then return false end
|
||||||
|
-- verifico se L profonda oppure lunga
|
||||||
|
if dMinArea3 < dMaxArea2 then
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
return 2
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
-- Funzione per determinare se la faccia ha lati molto corti (trascurabili) ed è quindi approssimabile ad una 3 facce
|
||||||
|
function WallLib.Is3EdgesApprox( Proc, nFacet, nAddGrpId)
|
||||||
|
nAddGrpId = nAddGrpId or WallLib.GetAddGroup( Proc.PartId)
|
||||||
|
-- recupero il contorno della faccia
|
||||||
|
local nContourId, nContourCnt = EgtExtractSurfTmFacetLoops( Proc.Id, nFacet, nAddGrpId)
|
||||||
|
if not nContourId then return false end
|
||||||
|
EgtMergeCurvesInCurveCompo( nContourId)
|
||||||
|
-- recupero il numero di lati del contorno
|
||||||
|
local _, nEntityCount = EgtCurveDomain( nContourId)
|
||||||
|
if not nEntityCount then return false end
|
||||||
|
-- se sono già tre, ho finito
|
||||||
|
if nEntityCount == 3 then return true end
|
||||||
|
-- rimuovo i lati molto corti dal conteggio totale
|
||||||
|
local nEdges = nEntityCount
|
||||||
|
for i = 1, nEntityCount do
|
||||||
|
local dLength = EgtCurveCompoLength( nContourId, i - 1)
|
||||||
|
if dLength < 15 then nEdges = nEdges - 1 end
|
||||||
|
end
|
||||||
|
-- verifico il numero significativo di lati
|
||||||
|
local bResult = ( nEdges == 3)
|
||||||
|
-- cancello tutti i contorni appena creati
|
||||||
|
EgtErase( EgtTableFill( nContourId, nContourCnt))
|
||||||
|
if bResult then
|
||||||
|
EgtOutLog( 'FreeContour : Face with ' .. tostring( nEntityCount) .. ' edges skipped (approx 3 edges)')
|
||||||
|
end
|
||||||
|
return bResult
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
-- restituisce le facce della parte interessate dalla feature Proc
|
||||||
|
function WallLib.GetProcessAffectedFaces( Proc)
|
||||||
|
local nBoxSolidId = EgtGetFirstNameInGroup( Proc.PartId or GDB_ID.NULL, 'Box')
|
||||||
|
local b3Part = EgtGetBBoxGlob( nBoxSolidId, GDB_BB.STANDARD)
|
||||||
|
local vtFacesAffected = { Top = false, Bottom = false, Front = false, Back = false, Left = false, Right = false}
|
||||||
|
if Proc.Box and not Proc.Box:isEmpty() then
|
||||||
|
if Proc.Box:getMax():getZ() > b3Part:getMax():getZ() - 500 * GEO.EPS_SMALL then
|
||||||
|
vtFacesAffected.Top = true
|
||||||
|
end
|
||||||
|
if Proc.Box:getMin():getZ() < b3Part:getMin():getZ() + 500 * GEO.EPS_SMALL then
|
||||||
|
vtFacesAffected.Bottom = true
|
||||||
|
end
|
||||||
|
if Proc.Box:getMin():getY() < b3Part:getMin():getY() + 500 * GEO.EPS_SMALL then
|
||||||
|
vtFacesAffected.Front = true
|
||||||
|
end
|
||||||
|
if Proc.Box:getMax():getY() > b3Part:getMax():getY() - 500 * GEO.EPS_SMALL then
|
||||||
|
vtFacesAffected.Back = true
|
||||||
|
end
|
||||||
|
if Proc.Box:getMin():getX() < b3Part:getMin():getX() + 500 * GEO.EPS_SMALL then
|
||||||
|
vtFacesAffected.Left = true
|
||||||
|
end
|
||||||
|
if Proc.Box:getMax():getX() > b3Part:getMax():getX() - 500 * GEO.EPS_SMALL then
|
||||||
|
vtFacesAffected.Right = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return vtFacesAffected
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
-- restituisce le distanze XY tra la feature Proc e le altre parti più vicine, secondo le direzioni Y-/Y+/X-/X+
|
||||||
|
function WallLib.GetProcessDistanceToNearestParts( Proc)
|
||||||
|
local b3Proc = Proc.Box
|
||||||
|
local ptMinProc = b3Proc:getMin()
|
||||||
|
local ptMaxProc = b3Proc:getMax()
|
||||||
|
local vtDistances = { Front = 0, Back = 0, Left = 0, Right = 0}
|
||||||
|
if Proc.AffectedFaces.Front then
|
||||||
|
vtDistances.Front = GEO.INFINITO
|
||||||
|
end
|
||||||
|
if Proc.AffectedFaces.Back then
|
||||||
|
vtDistances.Back = GEO.INFINITO
|
||||||
|
end
|
||||||
|
if Proc.AffectedFaces.Left then
|
||||||
|
vtDistances.Left = GEO.INFINITO
|
||||||
|
end
|
||||||
|
if Proc.AffectedFaces.Right then
|
||||||
|
vtDistances.Right = GEO.INFINITO
|
||||||
|
end
|
||||||
|
local nRawId = EgtGetFirstRawPart()
|
||||||
|
local nPartId = EgtGetFirstPartInRawPart( nRawId)
|
||||||
|
while nPartId do
|
||||||
|
if Proc.PartId ~= nPartId then
|
||||||
|
local nBoxSolidId = EgtGetFirstNameInGroup( nPartId, 'Box')
|
||||||
|
local b3Solid = EgtGetBBoxGlob( nBoxSolidId or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||||
|
b3Solid:expand( - 10 * GEO.EPS_SMALL)
|
||||||
|
local ptMinPart = b3Solid:getMin()
|
||||||
|
local ptMaxPart = b3Solid:getMax()
|
||||||
|
if Proc.AffectedFaces.Front then
|
||||||
|
if OverlapsXY( b3Proc, b3Solid) then
|
||||||
|
vtDistances.Front = 0
|
||||||
|
elseif OverlapsX( b3Proc, b3Solid) then
|
||||||
|
if ptMaxPart:getY() < ptMinProc:getY() + 100 * GEO.EPS_SMALL then
|
||||||
|
vtDistances.Front = min( vtDistances.Front, max( 0, ptMinProc:getY() - ptMaxPart:getY()))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if Proc.AffectedFaces.Back then
|
||||||
|
if OverlapsXY( b3Proc, b3Solid) then
|
||||||
|
vtDistances.Back = 0
|
||||||
|
elseif OverlapsX( b3Proc, b3Solid) then
|
||||||
|
if ptMaxProc:getY() < ptMinPart:getY() + 100 * GEO.EPS_SMALL then
|
||||||
|
vtDistances.Back = min( vtDistances.Back, max( 0, ptMinPart:getY() - ptMaxProc:getY()))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if Proc.AffectedFaces.Left then
|
||||||
|
if OverlapsXY( b3Proc, b3Solid) then
|
||||||
|
vtDistances.Left = 0
|
||||||
|
elseif OverlapsY( b3Proc, b3Solid) then
|
||||||
|
if ptMaxPart:getX() < ptMinProc:getX() + 100 * GEO.EPS_SMALL then
|
||||||
|
vtDistances.Left = min( vtDistances.Left, max( 0, ptMinProc:getX() - ptMaxPart:getX()))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if Proc.AffectedFaces.Right then
|
||||||
|
if OverlapsXY( b3Proc, b3Solid) then
|
||||||
|
vtDistances.Right = 0
|
||||||
|
elseif OverlapsY( b3Proc, b3Solid) then
|
||||||
|
if ptMaxProc:getX() < ptMinPart:getX() + 100 * GEO.EPS_SMALL then
|
||||||
|
vtDistances.Right = min( vtDistances.Right, max( 0, ptMinPart:getX() - ptMaxProc:getX()))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
nPartId = EgtGetNextPartInRawPart( nPartId)
|
||||||
|
end
|
||||||
|
|
||||||
|
return vtDistances
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
-- restituisce le distanze XY tra la feature Proc e il termine del grezzo, secondo le direzioni Y-/Y+/X-/X+
|
||||||
|
function WallLib.GetProcessDistanceToRawPart( Proc, b3Raw)
|
||||||
|
local b3Proc = Proc.Box
|
||||||
|
local ptMinProc = b3Proc:getMin()
|
||||||
|
local ptMaxProc = b3Proc:getMax()
|
||||||
|
local ptMinRaw = b3Raw:getMin()
|
||||||
|
local ptMaxRaw = b3Raw:getMax()
|
||||||
|
local vtDistances = { Front = GEO.INFINITO, Back = GEO.INFINITO, Left = GEO.INFINITO, Right = GEO.INFINITO}
|
||||||
|
if EnclosesXY( b3Raw, b3Proc) then
|
||||||
|
vtDistances.Front = max( 0, ptMinProc:getY() - ptMinRaw:getY())
|
||||||
|
vtDistances.Back = max( 0, ptMaxRaw:getY() - ptMaxProc:getY())
|
||||||
|
vtDistances.Left = max( 0, ptMinProc:getX() - ptMinRaw:getX())
|
||||||
|
vtDistances.Right = max( 0, ptMaxRaw:getX() - ptMaxProc:getX())
|
||||||
|
end
|
||||||
|
|
||||||
|
return vtDistances
|
||||||
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
function WallLib.GetNailLockOutAreas( vProc)
|
function WallLib.GetNailLockOutAreas( vProc)
|
||||||
local vNLO = {}
|
local vNLO = {}
|
||||||
@@ -325,7 +535,7 @@ function WallLib.GetNailLockOutAreas( vProc)
|
|||||||
if AuxId then AuxId = AuxId + vProc[i].Id end
|
if AuxId then AuxId = AuxId + vProc[i].Id end
|
||||||
if AuxId then
|
if AuxId then
|
||||||
local nAddGrpId = WallLib.GetAddGroup( vProc[i].PartId)
|
local nAddGrpId = WallLib.GetAddGroup( vProc[i].PartId)
|
||||||
local nSfrId = EgtSurfFlatRegion( nAddGrpId, {AuxId})
|
local nSfrId = EgtSurfFlatRegion( nAddGrpId, {AuxId})
|
||||||
if nSfrId then
|
if nSfrId then
|
||||||
table.insert( vNLO, nSfrId)
|
table.insert( vNLO, nSfrId)
|
||||||
end
|
end
|
||||||
@@ -335,5 +545,12 @@ function WallLib.GetNailLockOutAreas( vProc)
|
|||||||
return vNLO
|
return vNLO
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
-- restituisce vero se la feature con box b3Proc taglia l'intera sezione della parete, rappresentata dalle sue dimensioni W, H e L
|
||||||
|
function WallLib.IsFeatureCuttingEntireSection( b3Proc, dRawW, dRawH, dRawL)
|
||||||
|
return ( ( ( abs( b3Proc:getDimY() - dRawW) < 10 * GEO.EPS_SMALL or b3Proc:getDimY() > dRawW) or ( abs( b3Proc:getDimX() - dRawL) < 10 * GEO.EPS_SMALL or b3Proc:getDimX() > dRawL)) and (abs(b3Proc:getDimZ() - dRawH) < 10 * GEO.EPS_SMALL or b3Proc:getDimZ() > dRawH))
|
||||||
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
return WallLib
|
return WallLib
|
||||||
|
|||||||
@@ -157,9 +157,9 @@ local bManualRot = EgtGetInfo( NFAR.PARTID, "MANUALROT", 'b')
|
|||||||
|
|
||||||
-- FLIP
|
-- FLIP
|
||||||
local FlipFeatureStates, bLapJoints = ClassifyFlip( vPartProc, b3Part)
|
local FlipFeatureStates, bLapJoints = ClassifyFlip( vPartProc, b3Part)
|
||||||
|
local bFlip
|
||||||
|
|
||||||
if not bManualFlip then
|
if not bManualFlip then
|
||||||
local bFlip
|
|
||||||
-- analizzo stati flip delle feature
|
-- analizzo stati flip delle feature
|
||||||
local nFlip0Min = 100
|
local nFlip0Min = 100
|
||||||
local nFlip0Cnt = 0
|
local nFlip0Cnt = 0
|
||||||
@@ -440,7 +440,7 @@ if not bManualRot then
|
|||||||
-- setto info nel pezzo
|
-- setto info nel pezzo
|
||||||
if nRotate > 0 then
|
if nRotate > 0 then
|
||||||
local nPartRot = EgtGetInfo( NFAR.PARTID, "ROTATED", 'i') or 0
|
local nPartRot = EgtGetInfo( NFAR.PARTID, "ROTATED", 'i') or 0
|
||||||
local nTotRot = nPartRot - nRotate
|
local nTotRot = nPartRot - EgtIf( bFlip, -nRotate, nRotate)
|
||||||
nTotRot = EgtIf( nTotRot < 0, nTotRot + 360, nTotRot)
|
nTotRot = EgtIf( nTotRot < 0, nTotRot + 360, nTotRot)
|
||||||
EgtSetInfo( NFAR.PARTID, "ROTATED", nTotRot)
|
EgtSetInfo( NFAR.PARTID, "ROTATED", nTotRot)
|
||||||
EgtSetInfo( NFAR.PARTID, "FLIPROTMODIFIED", 1)
|
EgtSetInfo( NFAR.PARTID, "FLIPROTMODIFIED", 1)
|
||||||
|
|||||||
+47
-41
@@ -19,7 +19,7 @@ NEST.MACH_AREA_OTHER_DIAM = 200
|
|||||||
NEST.MACH_AREA_IGNORE_3rdFACE = 1 -- 0
|
NEST.MACH_AREA_IGNORE_3rdFACE = 1 -- 0
|
||||||
|
|
||||||
|
|
||||||
local sLog = 'NestProcess : ' .. NEST.FILE .. ', ' .. NEST.MACHINE .. ', ' .. LEN["1"] .. ', ' .. WIDTH["1"]
|
local sLog = 'NestProcess : ' .. NEST.FILE .. ', ' .. NEST.MACHINE .. ', ' .. LEN[1] .. ', ' .. WIDTH[1]
|
||||||
EgtOutLog( sLog)
|
EgtOutLog( sLog)
|
||||||
|
|
||||||
-- Cancello file di log specifico
|
-- Cancello file di log specifico
|
||||||
@@ -1128,9 +1128,10 @@ local function ClassifyAngles( nPartId, RawPart, sRefOrig, bLockedRot, dMinSheet
|
|||||||
if nRotate >= 360 then
|
if nRotate >= 360 then
|
||||||
nRotate = nRotate - 360
|
nRotate = nRotate - 360
|
||||||
end
|
end
|
||||||
if nRotate > 0 then
|
if nRotate > 0 then
|
||||||
|
local bPartFlip = ( ( EgtGetInfo( nPartId, "INVERTED", 'i') or 0) == 180)
|
||||||
local nPartRot = EgtGetInfo( nPartId, "ROTATED", 'i') or 0
|
local nPartRot = EgtGetInfo( nPartId, "ROTATED", 'i') or 0
|
||||||
local nTotRot = nPartRot - nRotate
|
local nTotRot = nPartRot - EgtIf( bPartFlip, -nRotate, nRotate)
|
||||||
nTotRot = EgtIf( nTotRot < 0, nTotRot + 360, nTotRot)
|
nTotRot = EgtIf( nTotRot < 0, nTotRot + 360, nTotRot)
|
||||||
EgtSetInfo( nPartId, "ROTATED", nTotRot)
|
EgtSetInfo( nPartId, "ROTATED", nTotRot)
|
||||||
EgtSetInfo( nPartId, "MODIFIEDFORNEST", 1)
|
EgtSetInfo( nPartId, "MODIFIEDFORNEST", 1)
|
||||||
@@ -1325,8 +1326,9 @@ local function ComputeRestrictedZones( RawParts)
|
|||||||
bOnOppositeSide = true
|
bOnOppositeSide = true
|
||||||
-- aggiorno le info di rotazione
|
-- aggiorno le info di rotazione
|
||||||
if res.nRotate > 0 then
|
if res.nRotate > 0 then
|
||||||
|
local bPartFlip = ( ( EgtGetInfo( AngleClassification[nInd].PartId, "INVERTED", 'i') or 0) == 180)
|
||||||
local nPartRot = EgtGetInfo( AngleClassification[nInd].PartId, "ROTATED", 'i') or 0
|
local nPartRot = EgtGetInfo( AngleClassification[nInd].PartId, "ROTATED", 'i') or 0
|
||||||
local nTotRot = nPartRot - res.nRotate
|
local nTotRot = nPartRot - EgtIf( bPartFlip, -res.nRotate, res.nRotate)
|
||||||
nTotRot = EgtIf( nTotRot < 0, nTotRot + 360, nTotRot)
|
nTotRot = EgtIf( nTotRot < 0, nTotRot + 360, nTotRot)
|
||||||
EgtSetInfo( AngleClassification[nInd].PartId, "ROTATED", nTotRot)
|
EgtSetInfo( AngleClassification[nInd].PartId, "ROTATED", nTotRot)
|
||||||
EgtSetInfo( AngleClassification[nInd].PartId, "MODIFIEDFORNEST", 1)
|
EgtSetInfo( AngleClassification[nInd].PartId, "MODIFIEDFORNEST", 1)
|
||||||
@@ -1507,7 +1509,6 @@ local function AddParts(RawParts, vPartsDoneManually)
|
|||||||
bRotNest = false
|
bRotNest = false
|
||||||
elseif EgtExistsInfo( nPartId, "NestRot") then
|
elseif EgtExistsInfo( nPartId, "NestRot") then
|
||||||
nStepRotNest = EgtGetInfo( nPartId, "NestStepRot", 'i')
|
nStepRotNest = EgtGetInfo( nPartId, "NestStepRot", 'i')
|
||||||
nRotate = EgtGetInfo( nPartId, "NestRot", 'i')
|
|
||||||
bRotNest = EgtGetInfo( nPartId, "NestAllowRot", 'b')
|
bRotNest = EgtGetInfo( nPartId, "NestAllowRot", 'b')
|
||||||
-- verifico se rotazione è valida (pezzo è contenuto nel grezzo)
|
-- verifico se rotazione è valida (pezzo è contenuto nel grezzo)
|
||||||
local bValidRotationInRaw = b3Part:getDimX() < RawParts[1].Len - 2 * NEST.KERF + GEO.EPS_SMALL and b3Part:getDimY() < dRawMaxWidth - 2 * NEST.KERF + GEO.EPS_SMALL
|
local bValidRotationInRaw = b3Part:getDimX() < RawParts[1].Len - 2 * NEST.KERF + GEO.EPS_SMALL and b3Part:getDimY() < dRawMaxWidth - 2 * NEST.KERF + GEO.EPS_SMALL
|
||||||
@@ -1628,7 +1629,7 @@ local function AddParts(RawParts, vPartsDoneManually)
|
|||||||
if bOnEdge or bOnAngle then
|
if bOnEdge or bOnAngle then
|
||||||
local nBoxLayerId = EgtGetFirstNameInGroup( nPartId, "Box")
|
local nBoxLayerId = EgtGetFirstNameInGroup( nPartId, "Box")
|
||||||
local nBoxId = EgtGetFirstNameInGroup( nBoxLayerId, "Box")
|
local nBoxId = EgtGetFirstNameInGroup( nBoxLayerId, "Box")
|
||||||
local b3Part = EgtGetBBoxGlob(nBoxId, GDB_BB.STANDARD)
|
local b3Part = EgtGetBBoxGlob(nBoxId, GDB_BB.STANDARD)
|
||||||
|
|
||||||
-- punto di riferimento sul pezzo
|
-- punto di riferimento sul pezzo
|
||||||
local ptRef
|
local ptRef
|
||||||
@@ -1806,40 +1807,39 @@ if bNestingOk then
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- aggiungo pezzi nestati a mano
|
-- aggiungo pezzi nestati a mano
|
||||||
nPartCount = 0
|
nPartCount = 0
|
||||||
for nInd = 1, #vDoneManually do
|
for nInd = 1, #vDoneManually do
|
||||||
if vDoneManually[nInd].SheetId == nId then
|
if vDoneManually[nInd].SheetId == nId then
|
||||||
vDoneManually[nInd].Done = 1
|
vDoneManually[nInd].Done = 1
|
||||||
for nInd2 = 1, #(vDoneManually[nInd].Parts) do
|
for nInd2 = 1, #(vDoneManually[nInd].Parts) do
|
||||||
nPartCount = nPartCount + 1
|
nPartCount = nPartCount + 1
|
||||||
local nPartDuploId = EgtDuploNew( vDoneManually[nInd].Parts[nInd2].Id)
|
local nPartDuploId = EgtDuploNew( vDoneManually[nInd].Parts[nInd2].Id)
|
||||||
|
|
||||||
-- aggiungo le curve corrispondenti alle aree di lavorazione del pezzo
|
-- aggiungo le curve corrispondenti alle aree di lavorazione del pezzo
|
||||||
local sToolOutlines = EgtGetInfo( vDoneManually[nInd].Parts[nInd2].Id, "ToolOutlines", 's')
|
local sToolOutlines = EgtGetInfo( vDoneManually[nInd].Parts[nInd2].Id, "ToolOutlines", 's')
|
||||||
if sToolOutlines then
|
if sToolOutlines then
|
||||||
-- recupero o creo il gruppo per gli outlines
|
-- recupero o creo il gruppo per gli outlines
|
||||||
local nToolOutlinesGrp = EgtGetFirstNameInGroup( nPartDuploId, "ToolOutlines")
|
local nToolOutlinesGrp = EgtGetFirstNameInGroup( nPartDuploId, "ToolOutlines")
|
||||||
if not nToolOutlinesGrp then
|
if not nToolOutlinesGrp then
|
||||||
nToolOutlinesGrp = EgtGroup( nPartDuploId)
|
nToolOutlinesGrp = EgtGroup( nPartDuploId)
|
||||||
EgtSetName( nToolOutlinesGrp, "ToolOutlines")
|
EgtSetName( nToolOutlinesGrp, "ToolOutlines")
|
||||||
EgtSetStatus( nToolOutlinesGrp, GDB_ST.ON)
|
EgtSetStatus( nToolOutlinesGrp, GDB_ST.ON)
|
||||||
end
|
end
|
||||||
|
|
||||||
for str in string.gmatch(sToolOutlines, "([^"..",".."]+)") do
|
for str in string.gmatch(sToolOutlines, "([^"..",".."]+)") do
|
||||||
EgtCopyGlob( tonumber(str), nToolOutlinesGrp)
|
EgtCopyGlob( tonumber(str), nToolOutlinesGrp)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- applico flip, rotazione e traslazione pezzo e box da nesting
|
||||||
|
EgtSetInfo( nMachGroup, "PART" .. nPartCount, nPartDuploId .. "," .. EgtNumToString( vDoneManually[nInd].Parts[nInd2].posX, 3) .. "," .. EgtNumToString( vDoneManually[nInd].Parts[nInd2].posY, 3) .. "," .. 0 .."," .. 0)
|
||||||
|
EgtSetInfo( nPartDuploId, "POSX", vDoneManually[nInd].Parts[nInd2].posX)
|
||||||
|
EgtSetInfo( nPartDuploId, "POSY", vDoneManually[nInd].Parts[nInd2].posY)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- applico flip, rotazione e traslazione pezzo e box da nesting
|
|
||||||
EgtSetInfo( nMachGroup, "PART" .. nPartCount, nPartDuploId .. "," .. EgtNumToString( vDoneManually[nInd].Parts[nInd2].posX, 3) .. "," .. EgtNumToString( vDoneManually[nInd].Parts[nInd2].posY, 3) .. "," .. 0 .."," .. 0)
|
|
||||||
EgtSetInfo( nPartDuploId, "POSX", vDoneManually[nInd].Parts[nInd2].posX)
|
|
||||||
EgtSetInfo( nPartDuploId, "POSY", vDoneManually[nInd].Parts[nInd2].posY)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
-- altrimenti pezzo
|
-- altrimenti pezzo
|
||||||
else
|
else
|
||||||
@@ -1884,15 +1884,21 @@ if bNestingOk then
|
|||||||
EgtSetInfo( nPartDuploId, "POSX", ptPos:getX() + dXCorr)
|
EgtSetInfo( nPartDuploId, "POSX", ptPos:getX() + dXCorr)
|
||||||
EgtSetInfo( nPartDuploId, "POSY", ptPos:getY() + dYCorr)
|
EgtSetInfo( nPartDuploId, "POSY", ptPos:getY() + dYCorr)
|
||||||
|
|
||||||
local nPartRot = EgtGetInfo( nId, "ROTATED", 'i') or 0
|
local nPartFlip = EgtGetInfo( nId, "INVERTED", 'i') or 0
|
||||||
local nTotRot = dAngRot - nPartRot
|
|
||||||
nTotRot = EgtIf( nTotRot < 0, nTotRot + 360, nTotRot)
|
|
||||||
EgtSetInfo( nPartDuploId, "ROT", nTotRot)
|
|
||||||
|
|
||||||
local nPartFlip = EgtGetInfo( nId, "INVERTED", 'i')
|
|
||||||
nPartFlip = EgtIf( nPartFlip == 180, 1, 0)
|
nPartFlip = EgtIf( nPartFlip == 180, 1, 0)
|
||||||
local nTotFlip = EgtIf( nPartFlip ~= nFlag, 180, 0)
|
local nTotFlip = EgtIf( nPartFlip ~= nFlag, 180, 0)
|
||||||
EgtSetInfo( nPartDuploId, "FLIP", nTotFlip)
|
EgtSetInfo( nPartDuploId, "FLIP", nTotFlip)
|
||||||
|
|
||||||
|
local bPartFlip = ( nTotFlip == 180)
|
||||||
|
local nPartRot = EgtGetInfo( nId, "ROTATED", 'i') or 0
|
||||||
|
local nTotRot = nPartRot - EgtIf( bPartFlip, -dAngRot, dAngRot)
|
||||||
|
if nTotRot < 0 then
|
||||||
|
nTotRot = nTotRot + 360
|
||||||
|
elseif nTotRot >= 360 then
|
||||||
|
nTotRot = nTotRot - 360
|
||||||
|
end
|
||||||
|
EgtSetInfo( nPartDuploId, "ROT", nTotRot)
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,79 @@
|
|||||||
==== Wall Update Log ====
|
==== Wall Update Log ====
|
||||||
|
|
||||||
|
Versione 2.6k3 (27/11/2024)
|
||||||
|
- Modif : migliorato calcolo approccio e retrazione in Sidemill/Sidegroove
|
||||||
|
|
||||||
|
Versione 2.6k2 (19/11/2024)
|
||||||
|
- Modif : in Nesting riportata allo stato precedente la tolleranza posizionamento pannelli sul bordo
|
||||||
|
|
||||||
|
Versione 2.6k1 (14/11/2024)
|
||||||
|
- Added : aggiunta squadratura master panel
|
||||||
|
- Modif : L010 si inseriscono con lama anche se il percorso è breve
|
||||||
|
- Fixed : in Nesting corretto errore in posizionamento pannelli che devono stare necessariamente sul bordo della tavola
|
||||||
|
|
||||||
|
Versione 2.6j2 (04/11/2024)
|
||||||
|
- Modif : Modificato limite dimensione tasca per utilizzo lama come SideGroove
|
||||||
|
|
||||||
|
Versione 2.6j1 (29/10/2024)
|
||||||
|
- Fixed : in Nesting e Flip/Rot corretto problema in rotazione pezzi che causava ribaltamenti non voluti nella copia grezzo
|
||||||
|
|
||||||
|
Versione 2.6i2 (30/09/2024)
|
||||||
|
- Modif : aggiunta nota altezza sottopezzo, per pareti a layer
|
||||||
|
|
||||||
|
Versione 2.6i1 (25/09/2024)
|
||||||
|
- Fixed : in NestProcess correzione in lettura array per cambio dll di lettura
|
||||||
|
|
||||||
|
Versione 2.6h2 (28/08/2024)
|
||||||
|
- Modif : Aggiunto controllo licenza/chiave per abilitazione generazione PartProgram
|
||||||
|
- Fixed : in FreeContour corretto caso in cui si chiedevano informazioni sulla faccia non presenti.
|
||||||
|
|
||||||
|
Versione 2.6h1 (20/08/2024)
|
||||||
|
- Modif : in LapJoint, se fresa Side trovata ma non applicabile, si considera come se non trovata
|
||||||
|
- Modif : in Collect analisi facce limitata a feature che ne hanno meno di 50
|
||||||
|
- Modif : aggiunti nuovi parametri alla chiamata della funzione GetChainSawStartAngs da WallData della macchina
|
||||||
|
|
||||||
|
Versione 2.6g2 (19/07/2024)
|
||||||
|
- Modif : in BatchProcess e BatchProcessNew si forza ricalcolo ogni volta che si è in situazione di CHECK o CHECK + GENERATE
|
||||||
|
|
||||||
|
Versione 2.6g1 (17/07/2024)
|
||||||
|
- Modif : in ProcessDrill, se foro verticale passante e diametro inferiore a 100 mm, riduzione affondamento di 5 mm sostituito con tab
|
||||||
|
- Fixed : correzioni a utilizzo DEFAULT_RAW_NO_EXTRA_WIDTH
|
||||||
|
|
||||||
|
Versione 2.6f1 (21/06/2024)
|
||||||
|
- Added : in BatchProcess e BatchProcessNew aggiunto DEFAULT_RAW_NO_EXTRA_WIDTH per eliminare il sovramateriale grezzo in vista
|
||||||
|
|
||||||
|
Versione 2.6e2 (24/05/2024)
|
||||||
|
- Modif : in LapJoint se non si trova una lavorazione di tipo side si cerca una pocketing
|
||||||
|
- Fixed : in BatchProcessNew se generazione non abilitata si salta questa fase invece di restituire errore
|
||||||
|
- Fixed : piccoli errori in LapJoint e DoubleCut.
|
||||||
|
|
||||||
|
Versione 2.6e1 (03/03/5/2024)
|
||||||
|
- Fixed : correzione per assegnazione a SawCut di flag passante (bIsThrough).
|
||||||
|
|
||||||
|
Versione 2.6c3 (26/03/2024)
|
||||||
|
- Modif : modifica per richiamare le nuove funzioni di Test interferenza solidi superfici nel controllo validità lavorazione pulizia spigoli interni
|
||||||
|
- Modif : in compilazione vengono eliminate le info di debug
|
||||||
|
- Fixed : in processSawCut si ignora verso vettore se taglio passante.
|
||||||
|
|
||||||
|
Versione 2.6b2 (21/02/2024)
|
||||||
|
- Added : aggiunta gestione spostamento pannello rispetto a origine da dato BTL di TS3v7.
|
||||||
|
|
||||||
|
Versione 2.6b1 (20/02/2024)
|
||||||
|
- Modif : In BatchProcess tolleranza su altezza pannello in grezzo portata a 0.1 mm
|
||||||
|
- Fixed : in LapJoint piccola correzione ai casi in cui si utilizza il SIDESTEP.
|
||||||
|
|
||||||
|
Versione 2.5l2 (21/12/2023)
|
||||||
|
- Fixed : in FreeContour -> MakeByPocket corretto un bug che provocava la cancellazione della feature dopo averla lavorata
|
||||||
|
|
||||||
|
Versione 2.5l1 (13/12/2023)
|
||||||
|
- Modif : modifiche a WallExec, WallLib, FeatureTopology per allineamento Topology con Beam
|
||||||
|
- Modif : in FreeContour -> MakeByPocket aggiunta la possibilità di svuotare tasche passanti
|
||||||
|
- Modif : in FreeContour -> MakeByPocket in tasche speciali cliente 90480029 forzato step unico
|
||||||
|
|
||||||
|
Versione 2.5k1 (14/11/2023)
|
||||||
|
- Added : aggiunte lavorazioni in doppio.
|
||||||
|
- Modif : miglioramenti vari alla lavorazione tasche, in particolare in presenza di pezzi vicini.
|
||||||
|
|
||||||
Versione 2.5j3 (23/10/2023)
|
Versione 2.5j3 (23/10/2023)
|
||||||
- Added : aggiunta gestione aree vietate per chiodature (LockOut for Nail)
|
- Added : aggiunta gestione aree vietate per chiodature (LockOut for Nail)
|
||||||
- Modif : in FreeContour conversione automatica di facce non fattibili con lama per limiti di orientamento in facce da fare con fresa.
|
- Modif : in FreeContour conversione automatica di facce non fattibili con lama per limiti di orientamento in facce da fare con fresa.
|
||||||
|
|||||||
+3
-3
@@ -1,6 +1,6 @@
|
|||||||
-- Version.lua by Egalware s.r.l. 2023/10/11
|
-- Version.lua by Egalware s.r.l. 2024/08/20
|
||||||
-- Gestione della versione di Wall
|
-- Gestione della versione di Wall
|
||||||
|
|
||||||
NAME = 'Wall'
|
NAME = 'Wall'
|
||||||
VERSION = '2.5j3'
|
VERSION = '2.6k3'
|
||||||
MIN_EXE = '2.5b3'
|
MIN_EXE = '2.6k1'
|
||||||
|
|||||||
Reference in New Issue
Block a user