Compare commits
384 Commits
2.5i2
...
Ticket#2003
| Author | SHA1 | Date | |
|---|---|---|---|
| c5a8b852d9 | |||
| 69514074a9 | |||
| 4685b6bde6 | |||
| 3a063bd2cf | |||
| 710a1fe070 | |||
| d818492d67 | |||
| e55e33c40a | |||
| 8cadb25261 | |||
| 2622b58cad | |||
| b5be932955 | |||
| 44ac2f8c2a | |||
| 0b928e987f | |||
| c213c3f059 | |||
| 330698b6aa | |||
| eb1ef693c4 | |||
| 862751c84a | |||
| e5a30c38d3 | |||
| e83d8db1cc | |||
| 9de88ffe84 | |||
| ffaf33c62e | |||
| 8c0389582b | |||
| ebe3d79c11 | |||
| f8c40739da | |||
| fa5aac926e | |||
| 749cd1e2bb | |||
| 587aaaafce | |||
| 2cfa7caba7 | |||
| fc0fba5bd3 | |||
| 94159f88f3 | |||
| 4961d2d528 | |||
| 7b22f5cc47 | |||
| 5047d5b652 | |||
| 7f9b880ff7 | |||
| 7e457a22b0 | |||
| 3c080e2b1a | |||
| 9d3edbfb54 | |||
| adf465c5e2 | |||
| 23f695fd56 | |||
| 52f347def1 | |||
| 028688b88a | |||
| cde5b137ae | |||
| d0cf5887d3 | |||
| afc4c6aaff | |||
| caa1875309 | |||
| 2e2c2188ce | |||
| 0acd75bece | |||
| db691cefe4 | |||
| d0ecd175c2 | |||
| 7e6d4189ef | |||
| abbc200504 | |||
| 9e4597b739 | |||
| d84d146701 | |||
| 00ff8818da | |||
| d5c582f890 | |||
| bc8b0490b7 | |||
| 5aad9dcbf2 | |||
| 8a582f512f | |||
| 1fde2e5fec | |||
| 7a89501cc9 | |||
| 89acdcc8f8 | |||
| f7c082e5b1 | |||
| 938c46b9d8 | |||
| 917bf5ec4b | |||
| 27d4ab3309 | |||
| 0ece2d91f4 | |||
| e08b53d5cf | |||
| a330b2fd7f | |||
| acdd4e10fb | |||
| ee6afb65c1 | |||
| ea9db1631b | |||
| 6513e75408 | |||
| 0e7d878f10 | |||
| 8bd0e5d145 | |||
| d8ecfc8463 | |||
| e52a9c66b6 | |||
| f3785f8644 | |||
| 350aaabbbe | |||
| 4eb3b38dd4 | |||
| e9534b4eee | |||
| da061a05e5 | |||
| ba432f5029 | |||
| 812397a047 | |||
| cbb42ec088 | |||
| 0c802464e1 | |||
| 498c65b006 | |||
| d81a0e8fbd | |||
| 47fde315a3 | |||
| 3ac61219c9 | |||
| bad0018381 | |||
| 48261c36d8 | |||
| 4f9093b1d2 | |||
| 52830876e9 | |||
| 4513833fb3 | |||
| 26cc812ed1 | |||
| cc3ff75ea2 | |||
| b150c75e96 | |||
| cc3b0da9e5 | |||
| 6c8e3017d0 | |||
| 8613072ea2 | |||
| a89ad10f0b | |||
| 91e0214243 | |||
| f01790e725 | |||
| 648fa1d9bf | |||
| 33be9ccaf0 | |||
| 1b6c1721c5 | |||
| d6c08628fb | |||
| ce68e29112 | |||
| e936f90086 | |||
| 6c62ec1fe4 | |||
| 481cebb207 | |||
| 126e3f6f92 | |||
| 21349b690b | |||
| 93f9af85e7 | |||
| 366a93dedf | |||
| 3e83035483 | |||
| efb805cf98 | |||
| 1572648a7e | |||
| 3dea3d9be2 | |||
| 0af620ba76 | |||
| 1fc7aeba75 | |||
| 6711a2c166 | |||
| 6a4a53ccd6 | |||
| acdf228d52 | |||
| 769c73765d | |||
| ec48260d73 | |||
| 06461550c3 | |||
| f45bcd7651 | |||
| 05fe546e38 | |||
| 63c5d39112 | |||
| f8e56d8f49 | |||
| b07f2f6b19 | |||
| eefd8ba037 | |||
| 076178db2c | |||
| 3699daf998 | |||
| 617058cdda | |||
| d7a517160d | |||
| 139579dbef | |||
| 72033c8b9f | |||
| cc30f3aeb9 | |||
| 969f4cb6a0 | |||
| c05e58a61e | |||
| 37026c548d | |||
| bfaeb8e414 | |||
| 3bd780d005 | |||
| 1ffa11b2c1 | |||
| 3548d8593a | |||
| 0eac98ecaa | |||
| a950807979 | |||
| 7676693f66 | |||
| e03896cfef | |||
| b5094daa43 | |||
| 5f1aaac719 | |||
| 57d696e2fc | |||
| 99c0ada098 | |||
| a828ca9804 | |||
| 88baf851ee | |||
| 1e094aac56 | |||
| 51b5c7ac80 | |||
| e3f8783c18 | |||
| d0015d8252 | |||
| 5ebdda4abd | |||
| 436dcf69ea | |||
| b7b9ea2065 | |||
| 8b1d3a0efb | |||
| 3d0adbdd39 | |||
| 8b51f9dca8 | |||
| f589464063 | |||
| fc7150f9b0 | |||
| 5c83095891 | |||
| fe76f4b859 | |||
| 1d2eb24903 | |||
| 0bb90513b5 | |||
| 2fa68977bf | |||
| 092ad0cb4c | |||
| 3953d079c1 | |||
| ddcea6524c | |||
| fe78df8c26 | |||
| 7a70f623d9 | |||
| b8ac0ef249 | |||
| f456ea3c2a | |||
| 8732c2fc66 | |||
| 6a135228b8 | |||
| 653557a23d | |||
| 036ea8bcc8 | |||
| b620aef7b8 | |||
| 58eb8df247 | |||
| 38ab9d4a40 | |||
| 4b7c533ae3 | |||
| d54c9c98d7 | |||
| d0d5ff3917 | |||
| afb72bcf48 | |||
| 0d6566e2cc | |||
| db5503f828 | |||
| 0cfa1207ec | |||
| d415034d1c | |||
| 06964c5a34 | |||
| 68921b5df5 | |||
| 7801a50ae0 | |||
| c418f5b92a | |||
| 3aa7979be4 | |||
| 4fdf3ebdfa | |||
| e25ad8e4a4 | |||
| d5a45917ec | |||
| eb401d2695 | |||
| 604ffc6a35 | |||
| 43da69863d | |||
| f7b484d6bf | |||
| 4a8576bcb2 | |||
| a2854beb8d | |||
| aa9f7c577c | |||
| 6fb5c3803f | |||
| 7d11c76bef | |||
| 8f8dc23096 | |||
| 2e2c897b47 | |||
| 2c98483de0 | |||
| 8660ae3742 | |||
| 3c0d1c9593 | |||
| 005bb0a384 | |||
| 897fa66d33 | |||
| 3069366ef2 | |||
| ec485c1c62 | |||
| 4acaab29f7 | |||
| 9b35408ef9 | |||
| d420e630ce | |||
| 8a9e198c43 | |||
| d1f1429eb5 | |||
| 9184fa23ac | |||
| 0950eac628 | |||
| 1f730989b3 | |||
| 63169a3859 | |||
| f59dac3029 | |||
| 5a089a737c | |||
| 2ed2e28e8a | |||
| 21144825dc | |||
| 2aba85f3c9 | |||
| 301cc10022 | |||
| 63a3d62807 | |||
| c3b3a8e09a | |||
| 23c31aa0be | |||
| 4ba4ddb698 | |||
| 4a408e3f61 | |||
| c3c767b839 | |||
| 0400878279 | |||
| 418fb4e284 | |||
| 337e13dbde | |||
| 8d80f389d3 | |||
| 91608ce3f0 | |||
| dbf0d3cf01 | |||
| e5bab7f1ab | |||
| b8fb6816a6 | |||
| ffb7580a65 | |||
| 6255b4c1cb | |||
| 3ae3bcf1d3 | |||
| a01733defd | |||
| ba9df21ab1 | |||
| 6a58e94af0 | |||
| eb93769055 | |||
| 0acffe8d52 | |||
| f2c28f3810 | |||
| 0a830c7f4b | |||
| 0778516765 | |||
| 334d8d369e | |||
| 4a6b3accb1 | |||
| e22db4a989 | |||
| 6021a50136 | |||
| 748a6e295a | |||
| 2bd563293c | |||
| cc099fb54c | |||
| 22c74c3252 | |||
| 3acebbd892 | |||
| bc04b680d4 | |||
| 6e8cd5f3bb | |||
| 91aa9d049f | |||
| 5f7f988552 | |||
| 7d65813c32 | |||
| 42d68d968d | |||
| 01f0182ef5 | |||
| e0f27b9abe | |||
| c8b29241ca | |||
| b0dea42f31 | |||
| a9462e189c | |||
| 27ee10d1ec | |||
| d73f535a55 | |||
| 5ae487cb20 | |||
| a3dcabf860 | |||
| 7b854c87c0 | |||
| d2fc60b7f1 | |||
| 286816e8e9 | |||
| 01fbcbbd01 | |||
| d1c014e20c | |||
| 92a924dde1 | |||
| d033fee929 | |||
| 1070910b8c | |||
| 306b5b6dff | |||
| d2a6d7e75c | |||
| 6309092689 | |||
| 2ec0d8162e | |||
| 60919c595d | |||
| 0638e3c6f3 | |||
| de80902a86 | |||
| 9fbd4a5156 | |||
| 6bd2e5ffb4 | |||
| f89129d2e8 | |||
| e0e2f630d2 | |||
| 1664513c8f | |||
| c701d4132f | |||
| a9052c1d72 | |||
| 593fdcfc24 | |||
| b9c8921cb2 | |||
| b3bb386ec7 | |||
| c69f80a903 | |||
| d8de7467b0 | |||
| 42c043fcd7 | |||
| 344467a500 | |||
| e82a8c9c1f | |||
| 85585c0b80 | |||
| 24e853ff92 | |||
| 0bcdf65656 | |||
| 1e442c7a01 | |||
| 24e38cdad5 | |||
| a239a096cd | |||
| 737abe7d30 | |||
| b7b701f9d2 | |||
| 5974edf8b1 | |||
| 7fcf169b6b | |||
| f30558db04 | |||
| cb17b9737e | |||
| 5315b63163 | |||
| a87c9f5789 | |||
| 1dc4efa397 | |||
| 50917a61b2 | |||
| a843ef2e25 | |||
| fc3f6f22ac | |||
| 84bc8d7bd7 | |||
| 7c7fa26b8d | |||
| 54fcc27c49 | |||
| a5a8a0e98b | |||
| 27df151d3d | |||
| 34b4867a0d | |||
| 2bf15f2958 | |||
| bfa26e7610 | |||
| 398ea82d2b | |||
| 6f8c94705b | |||
| a77d0b2652 | |||
| 6c14b873f9 | |||
| 15d85e174b | |||
| a2ba993709 | |||
| e90a4db38c | |||
| 5820ccb455 | |||
| 57fa9bb8b3 | |||
| 3fe16f87b7 | |||
| 15af95a77e | |||
| a9e378c468 | |||
| a524a60a41 | |||
| fdb897ec68 | |||
| 4e4a1eca4d | |||
| 03bf116341 | |||
| 82d9d4dfde | |||
| d39148a9e8 | |||
| a7e0c5a33d | |||
| 8ddf1f260a | |||
| 8671415d5e | |||
| e496feff2c | |||
| 73431c52ca | |||
| 5420bc5165 | |||
| 3ccc382d5b | |||
| 29af699ad5 | |||
| 5865192e23 | |||
| 374d99ffd9 | |||
| a31c026430 | |||
| 982b07ad32 | |||
| 869683c99a | |||
| f147f77133 | |||
| 9c5b23d15d | |||
| 62b1c186f7 | |||
| 55f4effbb6 | |||
| 70b9f9fe89 | |||
| 2ff160f555 | |||
| 7ff3a8eba6 | |||
| 59934d0fdf | |||
| df99424632 | |||
| 61b1375c00 | |||
| 07c76f60c8 | |||
| 2c88c295c8 |
+4
-4
@@ -24,14 +24,14 @@ variables:
|
||||
$FileList = Get-ChildItem("*.lua")
|
||||
ForEach ($File in $FileList) {
|
||||
$FileName = Split-Path $File -leaf
|
||||
lua54 -o bin\$FileName $FileName
|
||||
echo "lua54 -o bin\$FileName $FileName"
|
||||
lua54 -o bin\$FileName -s $FileName
|
||||
echo "lua54 -o bin\$FileName -s $FileName"
|
||||
}
|
||||
$FileList = Get-ChildItem("LuaLibs\*.lua")
|
||||
ForEach ($File in $FileList) {
|
||||
$FileName = Split-Path $File -leaf
|
||||
lua54 -o bin\LuaLibs\$FileName LuaLibs\$FileName
|
||||
echo "lua54 -o bin\LuaLibs\$FileName LuaLibs\$FileName"
|
||||
lua54 -o bin\LuaLibs\$FileName -s LuaLibs\$FileName
|
||||
echo "lua54 -o bin\LuaLibs\$FileName -s LuaLibs\$FileName"
|
||||
}
|
||||
|
||||
# helper copia SORGENTI verso cartella di rete X:\ dei SORGENTI
|
||||
|
||||
+4
-3
@@ -357,7 +357,7 @@ if bToProcess then
|
||||
local dOvmHead = vBeam[1].PosX or 0
|
||||
|
||||
-- Sistemo le travi nel grezzo
|
||||
local bPbOk, sPbErr = BE.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam)
|
||||
local bPbOk, sPbErr = BE.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, nil, vBeam)
|
||||
if not bPbOk then
|
||||
BEAM.ERR = 18
|
||||
BEAM.MSG = sPbErr
|
||||
@@ -461,7 +461,7 @@ else
|
||||
-- Passo in modalità lavora
|
||||
EgtSetCurrMachGroup( EgtGetLastMachGroup())
|
||||
-- Se necessario eseguo aggiornamento con setup corrente e ricalcolo delle lavorazioni
|
||||
if bToRecalc then
|
||||
if bToRecalc or BEAM.FLAG == 3 or BEAM.FLAG == 4 then
|
||||
EgtOutLog( ' +++ Recalculating all dispositions and machinings >>>')
|
||||
EgtImportSetup()
|
||||
EgtApplyAllMachinings()
|
||||
@@ -525,7 +525,8 @@ if ( BEAM.FLAG == 0 and ( bToProcess or bToRecalc)) or BEAM.FLAG == 3 or BEAM.F
|
||||
end
|
||||
|
||||
-- *** Genero programma CN *** ( se richiesto)
|
||||
if BEAM.FLAG == 0 or BEAM.FLAG == 4 then
|
||||
local bIsGenerationEnabled = ( EgtVerifyKeyOption( 110) == false)
|
||||
if bIsGenerationEnabled and ( BEAM.FLAG == 0 or BEAM.FLAG == 4) then
|
||||
EgtOutLog( ' +++ Generating NC part program >>>')
|
||||
local sInfo = 'EgtCAM5' .. EgtIf( EgtIs64bit(), ' 64bit', '')
|
||||
if EgtGetExeVersion then
|
||||
|
||||
+12
-8
@@ -1,4 +1,4 @@
|
||||
-- BatchProcessNew.lua by Egaltech s.r.l. 2022/08/01
|
||||
-- BatchProcessNew.lua by Egaltech s.r.l. 2024/01/10
|
||||
-- Gestione calcolo batch disposizione e lavorazioni per Travi
|
||||
-- 2021/01/07 Per nuova interfaccia Egt.
|
||||
-- 2021/01/15 CREATE_BAR ora FLAG = 6 (prima 5).
|
||||
@@ -12,6 +12,7 @@
|
||||
-- 2022/04/28 In info generazione aggiunta indicazione se 64bit.
|
||||
-- 2022/07/24 Modifica per cancellare lavorazioni con ricalcolo e barra già definita.
|
||||
-- 2022/08/01 Tolleranza su sezione portata a 0.1 mm (100 * GEO.EPS_SMALL).
|
||||
-- 2024/01/10 Modifiche per centrare i pezzi in Y sulla tavola (come in BeamExec).
|
||||
|
||||
-- Intestazioni
|
||||
require( 'EgtBase')
|
||||
@@ -209,10 +210,7 @@ if bToProcess then
|
||||
EgtSetCurrMachGroup()
|
||||
-- Area tavola
|
||||
local b3Tab = EgtGetTableArea()
|
||||
-- Calcolo posizione estremo TR o BR della tavola rispetto a sua origine in BL
|
||||
BD.OriXR = Point3d( b3Tab:getDimX(), EgtIf( BD.RIGHT_LOAD, 0, b3Tab:getDimY()), 0)
|
||||
BD.PosXR = EgtIf( BD.RIGHT_LOAD, MCH_CR.BR, MCH_CR.TR)
|
||||
-- Calcolo minimo grezzo scaricabile
|
||||
-- Sezione del grezzo
|
||||
local nRawId = EgtGetFirstRawPart()
|
||||
if not nRawId then
|
||||
BEAM.ERR = 14
|
||||
@@ -222,6 +220,11 @@ if bToProcess then
|
||||
return
|
||||
end
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- Calcolo posizione estremo TR o BR della tavola rispetto a sua origine in BL
|
||||
local dPosY = EgtIf( BD.CENTER_BEAM, ( b3Tab:getDimY() + b3Raw:getDimY() * EgtIf( BD.RIGHT_LOAD, -1, 1)) / 2, EgtIf( BD.RIGHT_LOAD, 0, b3Tab:getDimY()))
|
||||
BD.OriXR = Point3d( b3Tab:getDimX(), dPosY, 0)
|
||||
BD.PosXR = EgtIf( BD.RIGHT_LOAD, MCH_CR.BR, MCH_CR.TR)
|
||||
-- Calcolo minimo grezzo scaricabile
|
||||
BE.CalcMinUnloadableRaw( b3Raw:getDimY(), b3Raw:getDimZ())
|
||||
-- altrimenti devo recuperare i pezzi per creare la barra
|
||||
else
|
||||
@@ -402,7 +405,7 @@ if bToProcess then
|
||||
end
|
||||
|
||||
-- Sistemo le travi nel grezzo
|
||||
local bPbOk, sPbErr = BE.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, BEAM.FLAG == 6)
|
||||
local bPbOk, sPbErr = BE.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, nil, vBeam, BEAM.FLAG == 6)
|
||||
if not bPbOk then
|
||||
BEAM.ERR = 18
|
||||
BEAM.MSG = sPbErr
|
||||
@@ -559,7 +562,7 @@ else
|
||||
-- Passo in modalità lavora
|
||||
EgtSetCurrMachGroup( EgtGetLastMachGroup())
|
||||
-- Se necessario eseguo aggiornamento con setup corrente e ricalcolo delle lavorazioni
|
||||
if bToRecalc then
|
||||
if bToRecalc or BEAM.FLAG == 3 or BEAM.FLAG == 4 then
|
||||
EgtOutLog( ' +++ Recalculating all dispositions and machinings >>>')
|
||||
EgtImportSetup()
|
||||
EgtApplyAllMachinings()
|
||||
@@ -623,7 +626,8 @@ if ( BEAM.FLAG == 0 and ( bToProcess or bToRecalc)) or BEAM.FLAG == 3 or BEAM.F
|
||||
end
|
||||
|
||||
-- *** Genero programma CN *** ( se richiesto)
|
||||
if BEAM.FLAG == 0 or BEAM.FLAG == 4 then
|
||||
local bIsGenerationEnabled = ( EgtVerifyKeyOption( 110) == false)
|
||||
if bIsGenerationEnabled and ( BEAM.FLAG == 0 or BEAM.FLAG == 4) then
|
||||
EgtOutLog( ' +++ Generating NC part program >>>')
|
||||
local sInfo = 'EgtCAM5' .. EgtIf( EgtIs64bit(), ' 64bit', '')
|
||||
if EgtGetExeVersion then
|
||||
|
||||
+50
-49
@@ -1,54 +1,55 @@
|
||||
|
||||
REM Compilazione degli script Beam Egaltech 2023.09.26
|
||||
REM Compilazione degli script Beam Egaltech 2023.11.08
|
||||
REM Per togliere info di debug aggiungere flag -s prima del nome del file di input
|
||||
|
||||
REM Compilazione 32 e 64 bit
|
||||
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\BeamExec.lua LuaLibs\BeamExec.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\BeamLib.lua LuaLibs\BeamLib.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\DiceCut.lua LuaLibs\DiceCut.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\FaceByPocket.lua LuaLibs\FaceByPocket.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\FacesBySaw.lua LuaLibs\FacesBySaw.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\FeatureTopology.lua LuaLibs\FeatureTopology.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\MachiningLib.lua LuaLibs\MachiningLib.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessBlockHausFront.lua LuaLibs\ProcessBlockHausFront.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessChamfer.lua LuaLibs\ProcessChamfer.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessCut.lua LuaLibs\ProcessCut.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDecor.lua LuaLibs\ProcessDecor.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDoubleCut.lua LuaLibs\ProcessDoubleCut.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDovetail.lua LuaLibs\ProcessDovetail.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDrill.lua LuaLibs\ProcessDrill.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDtMortise.lua LuaLibs\ProcessDtMortise.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDtTenon.lua LuaLibs\ProcessDtTenon.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessFreeContour.lua LuaLibs\ProcessFreeContour.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessFrenchRidgeLap.lua LuaLibs\ProcessFrenchRidgeLap.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessHeadCut.lua LuaLibs\ProcessHeadCut.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessLapJoint.lua LuaLibs\ProcessLapJoint.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessLongCut.lua LuaLibs\ProcessLongCut.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessLongDoubleCut.lua LuaLibs\ProcessLongDoubleCut.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessMark.lua LuaLibs\ProcessMark.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessMortise.lua LuaLibs\ProcessMortise.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfCamb.lua LuaLibs\ProcessProfCamb.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfConcave.lua LuaLibs\ProcessProfConcave.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfConvex.lua LuaLibs\ProcessProfConvex.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfFront.lua LuaLibs\ProcessProfFront.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfHead.lua LuaLibs\ProcessProfHead.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessRidgeLap.lua LuaLibs\ProcessRidgeLap.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessRoundArch.lua LuaLibs\ProcessRoundArch.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessSawCut.lua LuaLibs\ProcessSawCut.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessScarfJoint.lua LuaLibs\ProcessScarfJoint.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessSimpleScarf.lua LuaLibs\ProcessSimpleScarf.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessSplit.lua LuaLibs\ProcessSplit.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessStepJoint.lua LuaLibs\ProcessStepJoint.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessStepJointNotch.lua LuaLibs\ProcessStepJointNotch.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessTenon.lua LuaLibs\ProcessTenon.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessText.lua LuaLibs\ProcessText.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessTyroleanDovetail.lua LuaLibs\ProcessTyroleanDovetail.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\BatchProcess.lua BatchProcess.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\BatchProcessNew.lua BatchProcessNew.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\GetBeamData.lua GetBeamData.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\NestProcess.lua NestProcess.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\Process.lua Process.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\Rotate.lua Rotate.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\Swap.lua Swap.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\Version.lua Version.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\BeamExec.lua -s LuaLibs\BeamExec.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\BeamLib.lua -s LuaLibs\BeamLib.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\DiceCut.lua -s LuaLibs\DiceCut.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\FaceByPocket.lua -s LuaLibs\FaceByPocket.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\FacesBySaw.lua -s LuaLibs\FacesBySaw.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\FeatureTopology.lua -s LuaLibs\FeatureTopology.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\MachiningLib.lua -s LuaLibs\MachiningLib.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessBlockHausFront.lua -s LuaLibs\ProcessBlockHausFront.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessChamfer.lua -s LuaLibs\ProcessChamfer.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessCut.lua -s LuaLibs\ProcessCut.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDecor.lua -s LuaLibs\ProcessDecor.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDoubleCut.lua -s LuaLibs\ProcessDoubleCut.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDovetail.lua -s LuaLibs\ProcessDovetail.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDrill.lua -s LuaLibs\ProcessDrill.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDtMortise.lua -s LuaLibs\ProcessDtMortise.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDtTenon.lua -s LuaLibs\ProcessDtTenon.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessFreeContour.lua -s LuaLibs\ProcessFreeContour.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessFrenchRidgeLap.lua -s LuaLibs\ProcessFrenchRidgeLap.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessHeadCut.lua -s LuaLibs\ProcessHeadCut.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessLapJoint.lua -s LuaLibs\ProcessLapJoint.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessLongCut.lua -s LuaLibs\ProcessLongCut.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessLongDoubleCut.lua -s LuaLibs\ProcessLongDoubleCut.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessMark.lua -s LuaLibs\ProcessMark.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessMortise.lua -s LuaLibs\ProcessMortise.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfCamb.lua -s LuaLibs\ProcessProfCamb.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfConcave.lua -s LuaLibs\ProcessProfConcave.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfConvex.lua -s LuaLibs\ProcessProfConvex.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfFront.lua -s LuaLibs\ProcessProfFront.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfHead.lua -s LuaLibs\ProcessProfHead.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessRidgeLap.lua -s LuaLibs\ProcessRidgeLap.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessRoundArch.lua -s LuaLibs\ProcessRoundArch.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessSawCut.lua -s LuaLibs\ProcessSawCut.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessScarfJoint.lua -s LuaLibs\ProcessScarfJoint.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessSimpleScarf.lua -s LuaLibs\ProcessSimpleScarf.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessSplit.lua -s LuaLibs\ProcessSplit.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessStepJoint.lua -s LuaLibs\ProcessStepJoint.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessStepJointNotch.lua -s LuaLibs\ProcessStepJointNotch.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessTenon.lua -s LuaLibs\ProcessTenon.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessText.lua -s LuaLibs\ProcessText.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessTyroleanDovetail.lua -s LuaLibs\ProcessTyroleanDovetail.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessVariant.lua -s LuaLibs\ProcessVariant.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\BatchProcess.lua -s BatchProcess.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\BatchProcessNew.lua -s BatchProcessNew.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\GetBeamData.lua -s GetBeamData.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\NestProcess.lua -s NestProcess.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\Process.lua -s Process.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\Rotate.lua -s Rotate.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\Swap.lua -s Swap.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\Version.lua -s Version.lua
|
||||
|
||||
+373
-97
@@ -1,4 +1,4 @@
|
||||
-- BeamExec.lua by Egaltech s.r.l. 2023/03/31
|
||||
-- BeamExec.lua by Egaltech s.r.l. 2023/12/26
|
||||
-- Libreria esecuzione lavorazioni per Travi
|
||||
-- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3.
|
||||
-- 2019/09/04 Corretto controllo feature di testa e coda con sovramateriale di testa elevato.
|
||||
@@ -47,8 +47,22 @@
|
||||
-- 2023/03/31 Corretto ordinamento per fori di coda da lasciare in coda.
|
||||
-- 2023/07/31 Corretto errore nelle mortase in doppio.
|
||||
-- 2023/09/13 Aggiunta ClassifyTopology per la classificazione topologica delle feature. In CollectFeatures aggiunta la raccolta preliminare di alcune informazioni.
|
||||
-- 2022/09/26 Funzione IsFeatureCuttingEntireSection spostata in BeamLib
|
||||
-- 2022/09/26 In ClassifyTopology aggiunto passaggio del parametro nRawId
|
||||
-- 2023/09/26 Funzione IsFeatureCuttingEntireSection spostata in BeamLib
|
||||
-- 2023/09/26 In ClassifyTopology aggiunto passaggio del parametro nRawId
|
||||
-- 2023/10/24 Aggiunta scrittura parametro BARLEN nelle info del mach group
|
||||
-- 2023/11/08 Aggiunta gestione processi Variant.
|
||||
-- 2023/11/30 Migliorato il calcolo elevazione con l'utilizzo della nuova funzione EgtSurfTmFacetElevationInBBox.
|
||||
-- 2023/12/26 Modifiche per centrare i pezzi in Y sulla tavola.
|
||||
-- 2024/02/26 Migliorata 'CompareFeatures' per ordine lavorazioni
|
||||
-- Migliorata 'CompareFeatures' per ordine forature
|
||||
-- 2024/02/19 In Collect aggiunta la scrittura nella Proc di Width e Height delle facce.
|
||||
-- 2024/02/29 Migliorata 'CompareFeatures' per ordine forature
|
||||
-- 2024/03/04 Creata funzione calcolo dipendenze tra feature con calcolo topologia.
|
||||
-- 2024/03/07 Implementate le lavorazioni in doppio per fori specchiati non passanti e DrillPocket.
|
||||
-- 2024/03/11 In CollectFeatures si scrive ora Width e Height della faccia sia trimmate con il grezzo che intere.
|
||||
-- 2024/03/13 In CollectFeatures si scrive lunghezza foro su Proc e si controla se serve Predrill
|
||||
-- In OrderFeature, preforo sempre prima del foro
|
||||
-- 2024/04/11 In CollectFeatures aggiunta lettura info PRID, scritta in Proc.FeatureId
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local BeamExec = {}
|
||||
@@ -103,6 +117,7 @@ _G.package.loaded.ProcessTyroleanDovetail = nil
|
||||
_G.package.loaded.ProcessDovetail = nil
|
||||
_G.package.loaded.ProcessFreeContour = nil
|
||||
_G.package.loaded.ProcessDecor = nil
|
||||
_G.package.loaded.ProcessVariant = nil
|
||||
local ML = require( 'MachiningLib')
|
||||
local BL = require( 'BeamLib')
|
||||
local Topology = require( 'FeatureTopology')
|
||||
@@ -141,6 +156,7 @@ local TyroleanDovetail = require( 'ProcessTyroleanDovetail')
|
||||
local Dovetail = require( 'ProcessDovetail')
|
||||
local FreeContour = require( 'ProcessFreeContour')
|
||||
local Decor = require( 'ProcessDecor')
|
||||
local Variant = require( 'ProcessVariant')
|
||||
|
||||
EgtOutLog( ' BeamExec started', 1)
|
||||
EgtMdbSetGeneralParam( MCH_GP.MAXDEPTHSAFE, BD.COLL_SIC)
|
||||
@@ -251,6 +267,40 @@ local function IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT)
|
||||
return false
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function NeedTopologyFeature( Proc)
|
||||
-- richiedono calcolo topologia
|
||||
if Cut.Identify( Proc) then
|
||||
return true
|
||||
end
|
||||
if DoubleCut.Identify( Proc) then
|
||||
return true
|
||||
end
|
||||
if LongCut.Identify( Proc) then
|
||||
return true
|
||||
end
|
||||
if Long2Cut.Identify( Proc) then
|
||||
return true
|
||||
end
|
||||
if SawCut.Identify( Proc) then
|
||||
return true
|
||||
end
|
||||
if RidgeLap.Identify( Proc) then
|
||||
return true
|
||||
end
|
||||
if LapJoint.Identify( Proc) then
|
||||
return true
|
||||
end
|
||||
if FrenchRidgeLap.Identify( Proc) then
|
||||
return true
|
||||
end
|
||||
if Chamfer.Identify( Proc) then
|
||||
return true
|
||||
end
|
||||
-- tutte le altre non richiedono calcolo topologia
|
||||
return false
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
|
||||
local dRawW = b3Raw:getDimY()
|
||||
@@ -260,8 +310,6 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
|
||||
local LayerId = {}
|
||||
LayerId[1] = BL.GetAddGroup( PartId)
|
||||
LayerId[2] = EgtGetFirstNameInGroup( PartId or GDB_ID.NULL, 'Processings')
|
||||
local nMachineBeforeIntersectingDrillingsIdHead, dMachineBeforeIntersectingDrillingsXHead, nMachineBeforeIntersectingDrillingsIdTail, dMachineBeforeIntersectingDrillingsXTail = nil, GEO.INFINITO, nil, -GEO.INFINITO
|
||||
local b3MachineBeforeIntersectingDrillingsBoxHead, b3MachineBeforeIntersectingDrillingsBoxTail = nil, nil
|
||||
for nInd = 1, 2 do
|
||||
local ProcId = EgtGetFirstInGroup( LayerId[nInd] or GDB_ID.NULL)
|
||||
while ProcId do
|
||||
@@ -276,6 +324,7 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
|
||||
-- leggo se ci sono feature collegate
|
||||
local nAddAdjId = EgtGetInfo( ProcId, 'ADJID', 'i')
|
||||
local nAddMainId = EgtGetInfo( ProcId, 'MAINID', 'i')
|
||||
local nFeatureId = EgtGetInfo( ProcId, 'PRID', 'i')
|
||||
if nGrp and nPrc and nDo == 1 then
|
||||
local Proc = {}
|
||||
Proc.PartId = PartId
|
||||
@@ -289,6 +338,7 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
|
||||
Proc.Fce = 0
|
||||
Proc.CutId = nCutId
|
||||
Proc.TaskId = nTaskId
|
||||
Proc.FeatureId = nFeatureId or Proc.TaskId
|
||||
-- se ci sono feature collegate ne scrivo il riferimento nella Proc
|
||||
if nAddAdjId then
|
||||
Proc.AdjId = Proc.Id + nAddAdjId
|
||||
@@ -300,30 +350,25 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
|
||||
-- recupero l'elenco delle facce della parte interessate dalla feature
|
||||
Proc.AffectedFaces = BL.GetProcessAffectedFaces( Proc)
|
||||
-- recupero informazioni sulle facce della feature
|
||||
Proc.Face = {}
|
||||
for i = 1, Proc.Fct do
|
||||
Proc.Face[i] = { Id = i - 1, VtN = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT ), Elevation = BL.GetFaceElevation( Proc.Id, i - 1, PartId)}
|
||||
if not Proc.Face then
|
||||
Proc.Face = BL.GetFacetsInfo( Proc, b3Raw)
|
||||
end
|
||||
end
|
||||
if Proc.Box and not Proc.Box:isEmpty() then
|
||||
if Proc.Box and not Proc.Box:isEmpty() then
|
||||
Proc.Head = IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||
Proc.Tail, Proc.AdvTail = IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT)
|
||||
if Proc.Fct == 1 and BL.IsFeatureCuttingEntireSection( Proc.Box, dRawW, dRawH) and ( Proc.Head or Proc.Tail) and Proc.Prc ~= 340 and Proc.Prc ~= 350 then
|
||||
if Proc.Head and Proc.Box:getCenter():getX() < dMachineBeforeIntersectingDrillingsXHead then
|
||||
dMachineBeforeIntersectingDrillingsXHead = Proc.Box:getCenter():getX()
|
||||
nMachineBeforeIntersectingDrillingsIdHead = Proc.Id
|
||||
b3MachineBeforeIntersectingDrillingsBoxHead = Proc.Box
|
||||
elseif Proc.Tail and Proc.Box:getCenter():getX() > dMachineBeforeIntersectingDrillingsXTail then
|
||||
dMachineBeforeIntersectingDrillingsXTail = Proc.Box:getCenter():getX()
|
||||
nMachineBeforeIntersectingDrillingsIdTail = Proc.Id
|
||||
b3MachineBeforeIntersectingDrillingsBoxTail = Proc.Box
|
||||
end
|
||||
end
|
||||
table.insert( vProc, Proc)
|
||||
-- se foro
|
||||
if Drill.Identify( Proc) then
|
||||
-- assegno diametro e facce di ingresso e uscita (dati tabelle sempre per riferimento)
|
||||
Proc.Diam, Proc.Fcs, Proc.Fce = Drill.GetData( Proc, b3Raw)
|
||||
Proc.Diam, Proc.Len, Proc.Fcs, Proc.Fce = Drill.GetData( Proc, b3Raw)
|
||||
-- verifico se devo inserire i prefori
|
||||
if Drill.IsPredrillNeeded( Proc) then
|
||||
local bAddProc, PredrillProc= Drill.AddPredrillFromDrillProc( Proc)
|
||||
if bAddProc then
|
||||
table.insert( vProc, PredrillProc)
|
||||
end
|
||||
end
|
||||
-- verifico se necessaria seconda lavorazione da parte opposta per foro più lungo della punta
|
||||
if Drill.Split( Proc, b3Raw) then
|
||||
-- aggiorno flags prima parte foro (dati tabelle sempre per riferimento)
|
||||
@@ -340,6 +385,7 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
|
||||
Proc2.Box = BBox3d( Proc.Box)
|
||||
Proc2.Fct = Proc.Fct
|
||||
Proc2.Diam = Proc.Diam
|
||||
Proc2.Len = Proc.Len
|
||||
Proc2.Head = Drill.IsHeadFeature( Proc2, b3Raw, dCurrOvmH)
|
||||
Proc2.Tail = Drill.IsTailFeature( Proc2, b3Raw, dCurrOvmH)
|
||||
Proc2.Fcs = Proc.Fce
|
||||
@@ -349,6 +395,13 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
|
||||
Proc2.AdjId = Proc.AdjId
|
||||
Proc2.MainId = Proc.MainId
|
||||
table.insert( vProc, Proc2)
|
||||
-- verifico se devo inserire i prefori
|
||||
if Drill.IsPredrillNeeded( Proc2) then
|
||||
local bAddProc, PredrillProc= Drill.AddPredrillFromDrillProc( Proc2)
|
||||
if bAddProc then
|
||||
table.insert( vProc, PredrillProc)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se BlockHaus HalfLap
|
||||
elseif Proc.Prc == 37 then
|
||||
@@ -372,11 +425,38 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
|
||||
ProcId = EgtGetNext( ProcId)
|
||||
end
|
||||
end
|
||||
local vMachineBeforeIntersectingDrillings = {
|
||||
Head = { Id = nMachineBeforeIntersectingDrillingsIdHead, Box = b3MachineBeforeIntersectingDrillingsBoxHead},
|
||||
Tail = { Id = nMachineBeforeIntersectingDrillingsIdTail, Box = b3MachineBeforeIntersectingDrillingsBoxTail}
|
||||
return vProc
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function CalcHeadTailMachBeforeIntersDrillings( vProc, b3Raw)
|
||||
local nHeadId
|
||||
local dHeadX = GEO.INFINITO
|
||||
local nTailId
|
||||
local dTailX = -GEO.INFINITO
|
||||
local b3HeadBox
|
||||
local b3TailBox
|
||||
for i = 1, #vProc do
|
||||
local Proc = vProc[i]
|
||||
if Proc.Box and not Proc.Box:isEmpty() then
|
||||
if Proc.Fct == 1 and BL.IsFeatureCuttingEntireSection( Proc.Box, b3Raw:getDimY(), b3Raw:getDimZ()) and ( Proc.Head or Proc.Tail) and Proc.Prc ~= 340 and Proc.Prc ~= 350 then
|
||||
if Proc.Head and Proc.Box:getCenter():getX() < dHeadX then
|
||||
dHeadX = Proc.Box:getCenter():getX()
|
||||
nHeadId = Proc.Id
|
||||
b3HeadBox = Proc.Box
|
||||
elseif Proc.Tail and Proc.Box:getCenter():getX() > dTailX then
|
||||
dTailX = Proc.Box:getCenter():getX()
|
||||
nTailId = Proc.Id
|
||||
b3TailBox = Proc.Box
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local vMachBeforeIntersDrillings = {
|
||||
Head = { Id = nHeadId, Box = b3HeadBox},
|
||||
Tail = { Id = nTailId, Box = b3TailBox}
|
||||
}
|
||||
return vProc, vMachineBeforeIntersectingDrillings
|
||||
return vMachBeforeIntersDrillings
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
@@ -456,12 +536,15 @@ local function VerifyBigSectionCut( dRawW, dRawH)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroupOk)
|
||||
function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, vBeam, bMachGroupOk)
|
||||
|
||||
-- default per nuove costanti qualora non definite
|
||||
BD.OVM_BLADE_HBEAM = ( BD.OVM_BLADE_HBEAM or 11)
|
||||
BD.OVM_CHAIN_HBEAM = ( BD.OVM_CHAIN_HBEAM or 8)
|
||||
|
||||
|
||||
-- sovramateriale intermedio nullo se non definito
|
||||
dOvmMid = ( dOvmMid or 0)
|
||||
|
||||
-- Determinazione minimo grezzo scaricabile
|
||||
BeamExec.CalcMinUnloadableRaw( dRawW, dRawH)
|
||||
|
||||
@@ -478,10 +561,20 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroup
|
||||
-- Impostazione della tavola
|
||||
EgtSetTable( 'Tab')
|
||||
|
||||
-- salvo nota con lunghezza grezzo
|
||||
-- Recupero l'identificativo del gruppo di lavoro corrente
|
||||
local nMGrpId = EgtGetCurrMachGroup()
|
||||
-- Lunghezza della barra
|
||||
local dBarLen = EgtGetInfo( nMGrpId, 'BARLEN', 'd')
|
||||
if not dBarLen then
|
||||
EgtSetInfo( nMGrpId, 'BARLEN', dRawL)
|
||||
end
|
||||
|
||||
-- Area tavola
|
||||
local b3Tab = EgtGetTableArea()
|
||||
-- Calcolo posizione estremo TR/BR della tavola rispetto a sua origine in BL
|
||||
BD.OriXR = Point3d( b3Tab:getDimX(), EgtIf( BD.RIGHT_LOAD, 0, b3Tab:getDimY()), 0)
|
||||
local dPosY = EgtIf( BD.CENTER_BEAM, ( b3Tab:getDimY() + dRawW * EgtIf( BD.RIGHT_LOAD, -1, 1)) / 2, EgtIf( BD.RIGHT_LOAD, 0, b3Tab:getDimY()))
|
||||
BD.OriXR = Point3d( b3Tab:getDimX(), dPosY, 0)
|
||||
BD.PosXR = EgtIf( BD.RIGHT_LOAD, MCH_CR.BR, MCH_CR.TR)
|
||||
|
||||
-- Impostazione dell'attrezzaggio di default
|
||||
@@ -508,8 +601,12 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroup
|
||||
local lastB3Solid = nil
|
||||
local dOffset = dOvmHead
|
||||
if i > 1 then
|
||||
lastB3Solid = vBeam[i-1].Box
|
||||
dOffset = vBeam[i].PosX - vBeam[i-1].PosX - lastB3Solid:getDimX()
|
||||
if vBeam[i].PosX then
|
||||
lastB3Solid = vBeam[i-1].Box
|
||||
dOffset = vBeam[i].PosX - vBeam[i-1].PosX - lastB3Solid:getDimX()
|
||||
else
|
||||
dOffset = dOvmMid
|
||||
end
|
||||
end
|
||||
-- analizzo le features per valutare l'esistenza di feature head/tail che renderebbero inutili le rispettive finiture o di tagli di testa/coda sostituiti da cui leggere il parametro Q05
|
||||
local vProc = CollectFeatures( Pz, b3Solid, 0)
|
||||
@@ -544,8 +641,12 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroup
|
||||
( abs( PartHeight - dRawW) < 100 * GEO.EPS_SMALL and abs( PartWidth - dRawH) < 100 * GEO.EPS_SMALL)) and
|
||||
NextLen + DeltaE >= 0 then
|
||||
-- eventuale sovramateriale di testa
|
||||
if i > 1 and vBeam[i].PosX then
|
||||
DeltaS = max( vBeam[i].PosX - ( dRawL - Len), DeltaSMin)
|
||||
if i > 1 then
|
||||
if vBeam[i].PosX then
|
||||
DeltaS = max( vBeam[i].PosX - ( dRawL - Len), DeltaSMin)
|
||||
else
|
||||
DeltaS = max( dOvmMid - DeltaE, 0)
|
||||
end
|
||||
end
|
||||
-- dimensioni del grezzo
|
||||
local CrawLen = min( PartLen + DeltaS + DeltaE, Len)
|
||||
@@ -703,10 +804,18 @@ local function OrderFeatures( vProc, b3Raw)
|
||||
if Hcut.Identify( B2) then
|
||||
return false
|
||||
end
|
||||
-- se uno di testa e non l'altro, privilegio quello di testa
|
||||
if B1.Head ~= B2.Head then
|
||||
-- se uno di testa e non l'altro, privilegio quello di testa (a meno che non siano dei fori)
|
||||
if B1.Head ~= B2.Head and not Drill.Identify(B1) and not Drill.Identify(B2) then
|
||||
return B1.Head
|
||||
end
|
||||
-- se entrambi di testa e intersecano stesse facce e primo è scasso a due facce e secondo è un profilo caudato, lo scasso è una riduzione e va fatto prima
|
||||
if ( ( B1.Head and B2.Head) or ( B1.Tail and B2.Tail)) and B1.Topology == 'Rabbet' and ( ProfCamb.Identify( B2) or ProfConcave.Identify( B2) or ProfConvex.Identify( B2)) then
|
||||
return true
|
||||
end
|
||||
-- se entrambi di testa e intersecano stesse facce e primo è un profilo caudato e secondo è scasso a due facce, lo scasso è una riduzione e va lasciato dopo
|
||||
if ( ( B1.Head and B2.Head) or ( B1.Tail and B2.Tail)) and B2.Topology == 'Rabbet' and ( ProfCamb.Identify( B1) or ProfConcave.Identify( B1) or ProfConvex.Identify( B1)) then
|
||||
return false
|
||||
end
|
||||
-- se entrambi di testa e primo è scasso o mortasa e secondo no va messo dopo
|
||||
if B1.Head and B2.Head and ( LapJoint.Identify( B1) or Mortise.Identify( B1) or DtMortise.Identify( B1)) and
|
||||
not ( LapJoint.Identify( B2) or Mortise.Identify( B2) or DtMortise.Identify( B2)) then
|
||||
@@ -725,6 +834,26 @@ local function OrderFeatures( vProc, b3Raw)
|
||||
if B2.AdvTail and ( not Split.Identify( B1) or not B1.Tail) then
|
||||
return true
|
||||
end
|
||||
-- se primo è foro e secondo è un ribasso, il foro va sempre prima a meno che il ribasso non sia di testa
|
||||
if Drill.Identify(B1) and ( LapJoint.Identify(B2) or Mortise.Identify(B2)) and B2.PassedByHole and
|
||||
B1.Box:getCenter():getX() > B2.Box:getMin():getX() and B1.Box:getCenter():getX() < B2.Box:getMax():getX() then
|
||||
return true
|
||||
end
|
||||
-- se primo è un ribasso e secondo è un foro, il ribasso va sempre dopo a meno che il ribasso non sia di testa
|
||||
if ( LapJoint.Identify(B1) or Mortise.Identify(B1))and B1.PassedByHole and Drill.Identify(B2) and
|
||||
B2.Box:getCenter():getX() > B1.Box:getMin():getX() and B2.Box:getCenter():getX() < B1.Box:getMax():getX() then
|
||||
return false
|
||||
end
|
||||
-- se primo è ribasso e secondo è una mortasa a coda di rondine, il ribasso va sempre prima a meno che la mortasa a coda di rondine non sia di testa
|
||||
if LapJoint.Identify(B1) and B1.PassedByDtMortise and DtMortise.SideIdentify(B2) and
|
||||
B2.Box:getCenter():getX() > B1.Box:getMin():getX() and B2.Box:getCenter():getX() < B1.Box:getMax():getX() then
|
||||
return true
|
||||
end
|
||||
-- se primo è mortasa a coda di rondine e secondo è ribasso, la mortasa a coda di rondine va sempre dopo a meno che la mortasa a coda di rondine non sia di testa
|
||||
if DtMortise.SideIdentify(B1) and LapJoint.Identify(B2) and B2.PassedByDtMortise and
|
||||
B1.Box:getCenter():getX() > B2.Box:getMin():getX() and B1.Box:getCenter():getX() < B2.Box:getMax():getX() then
|
||||
return false
|
||||
end
|
||||
-- se primo è feature di coda e l'altro è separazione o non è feature di coda
|
||||
if B1.Tail and ( Split.Identify( B2) or not B2.Tail) then
|
||||
return false
|
||||
@@ -735,14 +864,22 @@ local function OrderFeatures( vProc, b3Raw)
|
||||
end
|
||||
-- se primo è scasso o mortasa di coda e secondo no, sempre dopo
|
||||
if B1.Tail and ( LapJoint.Identify( B1) or Mortise.Identify( B1) or DtMortise.Identify( B1)) and
|
||||
not ( B2.Tail and ( LapJoint.Identify( B2) or Mortise.Identify( B2) or DtMortise.Identify( B2))) then
|
||||
not B2.Tail and ( ( LapJoint.Identify( B2) or Mortise.Identify( B2) or DtMortise.Identify( B2))) then
|
||||
return false
|
||||
end
|
||||
-- se secondo è scasso o mortasa di coda e primo no, va lasciato dopo
|
||||
if B2.Tail and ( LapJoint.Identify( B2) or Mortise.Identify( B2) or DtMortise.Identify( B2)) and
|
||||
not ( B1.Tail and ( LapJoint.Identify( B1) or Mortise.Identify( B1) or DtMortise.Identify( B1))) then
|
||||
not B1.Tail and ( ( LapJoint.Identify( B1) or Mortise.Identify( B1) or DtMortise.Identify( B1))) then
|
||||
return true
|
||||
end
|
||||
-- se entrambi di coda e il primo è una feature taglio di lama e il secondo no, feature taglio lama sempre prima
|
||||
if B1.Tail and B2.Tail and ( Cut.Identify( B1) or DoubleCut.Identify( B1)) and ( not Cut.Identify( B2) and not DoubleCut.Identify( B2)) then
|
||||
return true
|
||||
end
|
||||
-- se entrambi di coda e il secondo è una feature taglio di lama e il primo no, feature taglio lama sempre prima
|
||||
if B1.Tail and B2.Tail and ( Cut.Identify( B2) or DoubleCut.Identify( B2)) and ( not Cut.Identify( B1) and not DoubleCut.Identify( B1)) then
|
||||
return false
|
||||
end
|
||||
-- se primo è taglio longitudinale completo o altra lav. lunga, dopo tutte le altre feature non di coda
|
||||
if abs( B1.Box:getDimX() - b3Raw:getDimX()) < 0.2 * b3Raw:getDimX() then
|
||||
-- se anche l'altra è lunga, faccio prima quello piccolo in YZ
|
||||
@@ -760,22 +897,12 @@ local function OrderFeatures( vProc, b3Raw)
|
||||
if abs( B2.Box:getDimX() - b3Raw:getDimX()) < 0.2 * b3Raw:getDimX() then
|
||||
return not ( B1.Tail or B2.Box:getMin():getX() + 20 > B1.Box:getCenter():getX())
|
||||
end
|
||||
-- se primo è foro e secondo è un ribasso, il foro va sempre prima
|
||||
if Drill.Identify(B1) and ( LapJoint.Identify(B2) or Mortise.Identify(B2)) and
|
||||
B1.Box:getCenter():getX() > B2.Box:getMin():getX() and B1.Box:getCenter():getX() < B2.Box:getMax():getX() then
|
||||
return true
|
||||
end
|
||||
-- se primo è un ribasso e secondo è un foro, il ribasso va sempre dopo
|
||||
if (LapJoint.Identify(B1) or Mortise.Identify(B1)) and Drill.Identify(B2) and
|
||||
B2.Box:getCenter():getX() > B1.Box:getMin():getX() and B2.Box:getCenter():getX() < B1.Box:getMax():getX() then
|
||||
return false
|
||||
end
|
||||
-- se primo è foro e l'altro no, lo penalizzo
|
||||
if B1.Prc == 40 and B2.Prc ~= 40 then
|
||||
if Drill.Identify(B1) and not Drill.Identify(B2) then
|
||||
return ( B1.Box:getCenter():getX() > B2.Box:getMax():getX() + dDrillPenalty)
|
||||
end
|
||||
-- se primo è altro e secondo è foro, lo premio
|
||||
if B1.Prc ~= 40 and B2.Prc == 40 then
|
||||
if not Drill.Identify(B1) and Drill.Identify(B2) then
|
||||
return ( B1.Box:getMax():getX() + dDrillPenalty > B2.Box:getCenter():getX())
|
||||
end
|
||||
-- se prima è mortasa coda di rondine sul fianco e secondo taglio longitudinale, la coda di rondine va sempre prima
|
||||
@@ -805,7 +932,11 @@ local function OrderFeatures( vProc, b3Raw)
|
||||
end
|
||||
-- se entrambi fori con posizione praticamente uguale ordino secondo diametro e faccia di inizio (Fcs)
|
||||
if B1.Prc == 40 and B2.Prc == 40 and abs( B1.Box:getCenter():getX() - B2.Box:getCenter():getX()) < dSmallDrillRange then
|
||||
if abs( B1.Diam - B2.Diam) < 1.0 then
|
||||
if B1.IsPredrill and not B2.IsPredrill then
|
||||
return true
|
||||
elseif not B1.IsPredrill and B2.IsPredrill then
|
||||
return false
|
||||
elseif abs( B1.Diam - B2.Diam) < 1.0 then
|
||||
if B1.Fcs == B2.Fcs then
|
||||
if abs( B1.Box:getCenter():getX() - B2.Box:getCenter():getX()) < 1.0 then
|
||||
if abs( B1.Box:getCenter():getY() - B2.Box:getCenter():getY()) < 1.0 then
|
||||
@@ -1093,6 +1224,9 @@ local function ClassifyFeatures( vProc, b3Raw, Stats)
|
||||
-- se decorazione
|
||||
elseif Decor.Identify( Proc) then
|
||||
bOk, bDown = Decor.Classify( Proc)
|
||||
-- se Variant
|
||||
elseif Variant.Identify( Proc) then
|
||||
bOk, bDown = Variant.Classify( Proc, b3Raw)
|
||||
end
|
||||
-- assegno risultato
|
||||
if bOk then
|
||||
@@ -1146,25 +1280,12 @@ local function ClassifyFeatures( vProc, b3Raw, Stats)
|
||||
return bAllOk, bSomeDown, bSomeSide, bSplitRot
|
||||
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 AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut, b3Raw, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dCurrOvmT)
|
||||
local bOk = true
|
||||
local sErr = ''
|
||||
local nNewPhase = -1
|
||||
local AddedIds
|
||||
EgtOutLog( ' * Process ' .. tostring( Proc.Id) .. ' *', 1)
|
||||
-- se intestatura ( 1-340-X )
|
||||
if Hcut.Identify( Proc) then
|
||||
@@ -1190,7 +1311,7 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
|
||||
elseif Long2Cut.Identify( Proc) then
|
||||
-- se due facce longitudinali, eseguo doppio taglio longitudinale
|
||||
if Long2Cut.GetLongFacesCount( Proc) == 2 then
|
||||
bOk, sErr = Long2Cut.Make( Proc, nPhase, nRawId, nPartId)
|
||||
bOk, sErr, _, AddedIds = Long2Cut.Make( Proc, nPhase, nRawId, nPartId)
|
||||
-- altrimenti eseguo singolo taglio longitudinale
|
||||
else
|
||||
bOk, sErr = LongCut.Make( Proc, nPhase, nRawId, nPartId)
|
||||
@@ -1208,7 +1329,7 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
|
||||
-- o se rivestimento ( 3/4-034-X) o se mezzolegno chalet ( 4-037-X) o se tasca ( 4-039-X) o se taglio triangolato ( 4-120-X)
|
||||
elseif LapJoint.Identify( Proc) then
|
||||
-- esecuzione mezzo-legno o scanalatura
|
||||
bOk, sErr = LapJoint.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
bOk, sErr, _, AddedIds = LapJoint.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- se smusso ( 3/4-036-X)
|
||||
elseif Chamfer.Identify( Proc) then
|
||||
-- esecuzione smusso
|
||||
@@ -1303,13 +1424,17 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
|
||||
elseif Decor.Identify( Proc) then
|
||||
-- esecuzione decorazione
|
||||
bOk, sErr = Decor.Make( Proc, nPhase, nRawId, nPartId)
|
||||
-- se Variant
|
||||
elseif Variant.Identify( Proc) then
|
||||
-- esecuzione variante custom
|
||||
bOk, sErr = Variant.Make( Proc, nPhase, nRawId, nPartId)
|
||||
-- altrimenti feature sconosciuta
|
||||
else
|
||||
sErr = 'Error on process ' .. tostring( Proc.Id) .. ' unknown type (' .. tonumber( Proc.Grp) .. '-' .. tonumber( Proc.Prc) .. ')'
|
||||
EgtOutLog( sErr)
|
||||
bOk = false
|
||||
end
|
||||
return bOk, sErr, ( nNewPhase or -1)
|
||||
return bOk, sErr, ( nNewPhase or -1), AddedIds
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
@@ -1456,30 +1581,29 @@ local function CheckMirrorPocket( Proc, ProcMirror, b3Raw, AuxId)
|
||||
return false
|
||||
end
|
||||
end
|
||||
-- devono avere il centro allineato, essere equidistanti dalla mezzaria trave e non essere troppo vicine
|
||||
-- devono avere il centro allineato, essere equidistanti dalla mezzeria trave e non essere troppo vicine
|
||||
local vtDisplacement = ptBC - ptBCMirror
|
||||
local ptCenRaw = b3Raw:getCenter()
|
||||
local dMinimumDistanceMirroredFeatures = 50
|
||||
if AreSameOrOppositeVectorApprox( vtExtr, Y_AX()) then
|
||||
local dYMinDistance = max( b3Proc:getMin():getY(), b3ProcMirror:getMin():getY()) - min( b3Proc:getMax():getY(), b3ProcMirror:getMax():getY())
|
||||
if not ( abs( vtDisplacement:getX()) < 500 * GEO.EPS_SMALL and abs( vtDisplacement:getZ()) < 500 * GEO.EPS_SMALL and
|
||||
if not ( abs( vtDisplacement:getX()) < 500 * GEO.EPS_SMALL and abs( vtDisplacement:getZ()) < 500 * GEO.EPS_SMALL and
|
||||
( abs( ptBC:getY() - ptCenRaw:getY()) - abs( ptBCMirror:getY() - ptCenRaw:getY())) < 500 * GEO.EPS_SMALL and
|
||||
dYMinDistance > dMinimumDistanceMirroredFeatures + 10 * GEO.EPS_SMALL) then
|
||||
dYMinDistance > MIRROR_POCKETS_MIN_DISTANCE + 10 * GEO.EPS_SMALL) then
|
||||
return false
|
||||
end
|
||||
elseif AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then
|
||||
local dZMinDistance = max( b3Proc:getMin():getZ(), b3ProcMirror:getMin():getZ()) - min( b3Proc:getMax():getZ(), b3ProcMirror:getMax():getZ())
|
||||
if not ( abs( vtDisplacement:getX()) < 500 * GEO.EPS_SMALL and abs( vtDisplacement:getY()) < 500 * GEO.EPS_SMALL and
|
||||
if not ( abs( vtDisplacement:getX()) < 500 * GEO.EPS_SMALL and abs( vtDisplacement:getY()) < 500 * GEO.EPS_SMALL and
|
||||
( abs( ptBC:getZ() - ptCenRaw:getZ()) - abs( ptBCMirror:getZ() - ptCenRaw:getZ())) < 500 * GEO.EPS_SMALL and
|
||||
dZMinDistance > dMinimumDistanceMirroredFeatures + 10 * GEO.EPS_SMALL) then
|
||||
dZMinDistance > MIRROR_POCKETS_MIN_DISTANCE + 10 * GEO.EPS_SMALL) then
|
||||
return false
|
||||
end
|
||||
else
|
||||
return false
|
||||
end
|
||||
-- devono avere box con le stesse dimensioni
|
||||
if not ( abs( b3DtMrt:getDimX() - b3DtMrtMirror:getDimX()) < 500 * GEO.EPS_SMALL and
|
||||
abs( b3DtMrt:getDimY() - b3DtMrtMirror:getDimY()) < 500 * GEO.EPS_SMALL and
|
||||
if not ( abs( b3DtMrt:getDimX() - b3DtMrtMirror:getDimX()) < 500 * GEO.EPS_SMALL and
|
||||
abs( b3DtMrt:getDimY() - b3DtMrtMirror:getDimY()) < 500 * GEO.EPS_SMALL and
|
||||
abs( b3DtMrt:getDimZ() - b3DtMrtMirror:getDimZ()) < 500 * GEO.EPS_SMALL) then
|
||||
return false
|
||||
end
|
||||
@@ -1544,7 +1668,7 @@ local function VerifyMortiseMirrored( Proc, vProc, b3Raw)
|
||||
end
|
||||
-- recupero eventuale utensile in doppio e suo diametro
|
||||
local sToolDoubleName = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'DOUBLE', 's')
|
||||
if not sToolDoubleName or not EgtTdbSetCurrTool( sToolDoubleName) or not EgtTdbGetCurrToolParam( MCH_TP.ACTIVE) then
|
||||
if not sToolDoubleName or not EgtTdbSetCurrTool( sToolDoubleName) or not EgtFindToolInCurrSetup( sToolDoubleName) then
|
||||
return
|
||||
end
|
||||
local dToolDoubleDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM, 'd')
|
||||
@@ -1613,7 +1737,7 @@ local function VerifyDtMortiseMirrored( Proc, vProc, b3Raw)
|
||||
end
|
||||
-- recupero eventuale utensile in doppio e suo diametro
|
||||
local sToolDoubleName = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'DOUBLE', 's')
|
||||
if not sToolDoubleName or not EgtTdbSetCurrTool( sToolDoubleName) or not EgtTdbGetCurrToolParam( MCH_TP.ACTIVE) then
|
||||
if not sToolDoubleName or not EgtTdbSetCurrTool( sToolDoubleName) or not EgtFindToolInCurrSetup( sToolDoubleName) then
|
||||
return
|
||||
end
|
||||
local dToolDoubleDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM, 'd')
|
||||
@@ -1671,18 +1795,21 @@ local function VerifyDrillMirrored( Proc, vProc, b3Raw)
|
||||
if not AuxId or EgtGetType( AuxId) ~= GDB_TY.CRV_ARC then
|
||||
return
|
||||
end
|
||||
-- verifico se foratura splittata oppure da specchiare
|
||||
local bIsDrillingOkForMirror = abs( Proc.Flg) == 2 or ( Proc.Mirror ~= nil)
|
||||
if not bIsDrillingOkForMirror then return end
|
||||
-- recupero direzione e dimensioni del foro
|
||||
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
||||
local dDiam = 2 * EgtArcRadius( AuxId)
|
||||
local dLen = abs( EgtCurveThickness( AuxId))
|
||||
local dMachiningDepth = dLen / 2 + BD.DRILL_OVERLAP
|
||||
local dMachiningDepth = EgtIf( abs( Proc.Flg) == 2, dLen / 2 + BD.DRILL_OVERLAP, dLen)
|
||||
-- recupero lavorazione adatta
|
||||
local sDrilling, sType, dMaxDepth = ML.FindDrilling( dDiam, dMachiningDepth, true, false, true)
|
||||
if not sDrilling then
|
||||
sDrilling, sType, dMaxDepth = ML.FindDrilling( dDiam, 0, true, false, true)
|
||||
dMachiningDepth = dMaxDepth or dMachiningDepth
|
||||
end
|
||||
if not sDrilling or sType ~= 'Drill' or not EgtMdbSetCurrMachining( sDrilling) then
|
||||
if not sDrilling or ( sType ~= 'Drill' and sType ~= 'Pocket') or not EgtMdbSetCurrMachining( sDrilling) then
|
||||
return
|
||||
end
|
||||
local dDrillingStep = EgtMdbGetCurrMachiningParam( MCH_MP.STEP)
|
||||
@@ -1690,33 +1817,37 @@ local function VerifyDrillMirrored( Proc, vProc, b3Raw)
|
||||
if not EgtTdbSetCurrTool( EgtMdbGetCurrMachiningParam( MCH_MP.TOOL) or '') then
|
||||
return
|
||||
end
|
||||
-- recupero la lunghezza della parte inclinata della punta
|
||||
-- recupero diametro utensile e lunghezza della parte inclinata della punta
|
||||
local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM, 'd')
|
||||
local dToolTipLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) - EgtTdbGetCurrToolParam( MCH_TP.LEN)
|
||||
-- recupero eventuale utensile in doppio, suo diametro e massima lavorazione
|
||||
local sToolDoubleName = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'DOUBLE', 's')
|
||||
if not sToolDoubleName or not EgtTdbSetCurrTool( sToolDoubleName) or not EgtTdbGetCurrToolParam( MCH_TP.ACTIVE) then
|
||||
if not sToolDoubleName or not EgtTdbSetCurrTool( sToolDoubleName) or not EgtFindToolInCurrSetup( sToolDoubleName) then
|
||||
return
|
||||
end
|
||||
local dToolDoubleDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM, 'd')
|
||||
local dToolDoubleMaxDepth = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
|
||||
dMachiningDepth = min( dMachiningDepth, dToolDoubleMaxDepth)
|
||||
-- recupero la lunghezza della parte inclinata della punta
|
||||
local dToolDoubleTipLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) - EgtTdbGetCurrToolParam( MCH_TP.LEN)
|
||||
-- se foratura splittata, verifico che la distanza minima tra le due punte sia rispettata
|
||||
if abs( Proc.Flg) == 2 and not ( ( ( 2 * dDrillingStep - dToolTipLength - dToolDoubleTipLength) - MIRROR_DRILLINGS_MIN_DISTANCE) > 10 * GEO.EPS_SMALL) then
|
||||
return
|
||||
end
|
||||
-- verifico se in doppio
|
||||
local dMinimumDistanceMirroredFeatures = 40
|
||||
dMachiningDepth = min( dMachiningDepth, dToolDoubleMaxDepth)
|
||||
if abs( Proc.Flg) == 2 and dToolDoubleDiam < dDiam + 10 * GEO.EPS_SMALL and dToolDoubleDiam > dDiam - BD.DRILL_TOL - 10 * GEO.EPS_SMALL and
|
||||
(( 2 * dDrillingStep - dToolTipLength - dToolDoubleTipLength) - dMinimumDistanceMirroredFeatures) > 10 * GEO.EPS_SMALL then
|
||||
if Proc.Fce ~= 0 then
|
||||
if ( abs( dToolDiam - dToolDoubleDiam) < 10 * GEO.EPS_SMALL) then
|
||||
if Proc.Fce ~= 0 or Proc.Mirror then
|
||||
if Proc.Flg == -2 then vtExtr = -vtExtr end
|
||||
local ProcToDisable = EgtIf( abs( Proc.Flg) == 2, Proc, Proc.Mirror)
|
||||
if ( not BD.DOWN_HEAD and AreSameVectorApprox( vtExtr, Y_AX())) or
|
||||
( BD.DOWN_HEAD and AreOppositeVectorApprox( vtExtr, Y_AX())) then
|
||||
Proc.Double = 2
|
||||
Proc.MachDepthDouble = dMachiningDepth
|
||||
DisableOtherDrilling( Proc, vProc)
|
||||
DisableOtherDrilling( ProcToDisable, vProc)
|
||||
elseif BD.DOWN_HEAD and AreSameVectorApprox( vtExtr, Z_AX()) then
|
||||
Proc.Double = 3
|
||||
Proc.MachDepthDouble = dMachiningDepth
|
||||
DisableOtherDrilling( Proc, vProc)
|
||||
DisableOtherDrilling( ProcToDisable, vProc)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1798,11 +1929,115 @@ local function SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeInt
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function AreDrillingsMirrored( Proc, ProcMirror, b3Raw)
|
||||
if Proc.Id == ProcMirror.Id then return false end
|
||||
|
||||
-- geometria ausiliaria foro principale
|
||||
AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
|
||||
if AuxId then AuxId = AuxId + Proc.Id end
|
||||
if not AuxId or EgtGetType( AuxId ) ~= GDB_TY.CRV_ARC then return false end
|
||||
-- geometria ausiliaria foro specchiato
|
||||
local AuxIdMirror = EgtGetInfo( ProcMirror.Id, 'AUXID', 'i')
|
||||
if AuxIdMirror then AuxIdMirror = AuxIdMirror + ProcMirror.Id end
|
||||
if not AuxIdMirror or EgtGetType( AuxIdMirror ) ~= GDB_TY.CRV_ARC then return false end
|
||||
-- dati del foro principale
|
||||
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
||||
local ptBC = EgtGP( AuxId, GDB_RT.GLOB)
|
||||
-- dati del foro specchiato
|
||||
local vtExtrMirror = EgtCurveExtrusion( AuxIdMirror, GDB_RT.GLOB)
|
||||
local ptBCMirror = EgtGP( AuxIdMirror, GDB_RT.GLOB)
|
||||
|
||||
-- direzione fori
|
||||
local nDouble
|
||||
if AreOppositeVectorApprox( vtExtr, vtExtrMirror) then
|
||||
-- fori lungo Y
|
||||
-- per macchine tipo PF il foro principale è sul lato back, per macchine tipo PF1250 è sul lato front
|
||||
if ( BD.TWO_EQUAL_HEADS and AreSameVectorApprox( vtExtr, Y_AX())) or
|
||||
( BD.DOWN_HEAD and AreOppositeVectorApprox( vtExtr, Y_AX())) then
|
||||
nDouble = 2
|
||||
-- fori lungo Z
|
||||
elseif BD.DOWN_HEAD and AreSameVectorApprox( vtExtr, Z_AX()) then
|
||||
nDouble = 3
|
||||
else
|
||||
return false
|
||||
end
|
||||
else
|
||||
return false
|
||||
end
|
||||
|
||||
-- centri allineati, equidistanti dalla mezzeria trave, non troppo vicini
|
||||
local vtDisplacement = ptBC - ptBCMirror
|
||||
local ptCenRaw = b3Raw:getCenter()
|
||||
if nDouble == 2 then
|
||||
local dYMinDistance = max( Proc.Box:getMin():getY(), ProcMirror.Box:getMin():getY()) - min( Proc.Box:getMax():getY(), ProcMirror.Box:getMax():getY())
|
||||
if not ( abs( vtDisplacement:getX()) < 100 * GEO.EPS_SMALL and abs( vtDisplacement:getZ()) < 100 * GEO.EPS_SMALL and
|
||||
( abs( ptBC:getY() - ptCenRaw:getY()) - abs( ptBCMirror:getY() - ptCenRaw:getY())) < 100 * GEO.EPS_SMALL and
|
||||
dYMinDistance > MIRROR_DRILLINGS_MIN_DISTANCE + 10 * GEO.EPS_SMALL) then
|
||||
return false
|
||||
end
|
||||
else
|
||||
local dZMinDistance = max( Proc.Box:getMin():getZ(), ProcMirror.Box:getMin():getZ()) - min( Proc.Box:getMax():getZ(), ProcMirror.Box:getMax():getZ())
|
||||
if not ( abs( vtDisplacement:getX()) < 100 * GEO.EPS_SMALL and abs( vtDisplacement:getY()) < 100 * GEO.EPS_SMALL and
|
||||
( abs( ptBC:getZ() - ptCenRaw:getZ()) - abs( ptBCMirror:getZ() - ptCenRaw:getZ())) < 100 * GEO.EPS_SMALL and
|
||||
dZMinDistance > MIRROR_DRILLINGS_MIN_DISTANCE + 10 * GEO.EPS_SMALL) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-- fori della stessa profondità
|
||||
if abs( Proc.Len - ProcMirror.Len) > 10 * GEO.EPS_SMALL then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function GetFeatureInfoAndDependency( vProc, b3Raw)
|
||||
-- ciclo tutte le feature
|
||||
for i = 1, #vProc do
|
||||
local Proc = vProc[i]
|
||||
-- calcolo topologia della feature
|
||||
if NeedTopologyFeature( Proc) then
|
||||
Topology.Classify( Proc, b3Raw)
|
||||
-- se non richiesto, setto 'SPECIAL'
|
||||
else
|
||||
Proc.Topology = 'SPECIAL'
|
||||
Proc.TopologyLongName = Proc.Topology
|
||||
end
|
||||
-- controllo la feature con tutte le altre per recuperare le dipendenze
|
||||
for j = 1, #vProc do
|
||||
local ProcB = vProc[j]
|
||||
-- verifico se feature tipo LapJoint è attraversata da almeno un foro
|
||||
if ( Proc.Topology == 'Pocket' or Proc.Topology == 'Tunnel' or Proc.Topology == 'Groove' or Mortise.Identify( Proc)) and Drill.Identify( ProcB) and Overlaps( Proc.Box, ProcB.Box) then
|
||||
Proc.PassedByHole = true
|
||||
end
|
||||
-- verifico se feature tipo LapJoint è attraversata da almeno una mortasa a coda di rondine
|
||||
if ( Proc.Topology == 'Pocket' or Proc.Topology == 'Tunnel' or Proc.Topology == 'Groove') and DtMortise.SideIdentify( ProcB) and Overlaps( Proc.Box, ProcB.Box) then
|
||||
Proc.PassedByDtMortise = true
|
||||
end
|
||||
-- verifiche per specchiature
|
||||
if BD.DOWN_HEAD or BD.TWO_EQUAL_HEADS then
|
||||
-- forature
|
||||
if BD.DOUBLE_HEAD_DRILLING and Drill.Identify( Proc) and Drill.Identify( ProcB) and not Proc.Mirror then
|
||||
if AreDrillingsMirrored( Proc, ProcB, b3Raw) then
|
||||
Proc.Mirror = ProcB
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamExec.ProcessFeatures()
|
||||
if BD.IMPROVE_HEAD_TAIL_DRILLINGS == nil then
|
||||
BD.IMPROVE_HEAD_TAIL_DRILLINGS = true
|
||||
end
|
||||
-- costanti per doppio
|
||||
MIRROR_DRILLINGS_MIN_DISTANCE = 40
|
||||
MIRROR_POCKETS_MIN_DISTANCE = 50
|
||||
-- verifica se possibile rotazione di 90 gradi
|
||||
BD.ROT90 = BD.ROT90 and Verify90DegRotation( EgtGetFirstRawPart())
|
||||
-- ciclo sui pezzi
|
||||
@@ -1830,17 +2065,19 @@ function BeamExec.ProcessFeatures()
|
||||
local dCurrOvmH = EgtGetInfo( nRawId, 'HOVM', 'd') or 0
|
||||
local dCurrOvmT = EgtGetInfo( nRawId, 'TOVM', 'd') or 0
|
||||
-- recupero le feature di lavorazione della trave
|
||||
local vProc, vMachineBeforeIntersectingDrillings = CollectFeatures( nPartId, b3Raw, dCurrOvmH, dCurrOvmT)
|
||||
local vProc = CollectFeatures( nPartId, b3Raw, dCurrOvmH, dCurrOvmT)
|
||||
-- recupero informazioni ausiliarie feature e dipendenze tra feature stesse
|
||||
GetFeatureInfoAndDependency( vProc, b3Raw)
|
||||
|
||||
-- verifica presenza forature influenzate da lavorazioni di testa o coda
|
||||
if BD.IMPROVE_HEAD_TAIL_DRILLINGS then
|
||||
SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeIntersectingDrillings)
|
||||
local vMachBeforeIntersDrillings = CalcHeadTailMachBeforeIntersDrillings( vProc, b3Raw)
|
||||
SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachBeforeIntersDrillings)
|
||||
end
|
||||
-- verifica presenza di feature specchiate per eventuali lavorazioni simultanee
|
||||
if BD.TWO_EQUAL_HEADS or BD.DOWN_HEAD then
|
||||
SetMirroredFeatures( vProc, b3Raw)
|
||||
end
|
||||
-- classifico topologicamente le feature
|
||||
ClassifyTopology( vProc, nRawId)
|
||||
-- le ordino lungo X
|
||||
OrderFeatures( vProc, b3Raw)
|
||||
-- le classifico
|
||||
@@ -1874,13 +2111,25 @@ function BeamExec.ProcessFeatures()
|
||||
-- flag feature precedente in doppio
|
||||
local nPrevDouble = 0
|
||||
-- inserisco le lavorazioni da lavorare ribaltate
|
||||
for i = 1, #vProc do
|
||||
local i = 1
|
||||
while i <= #vProc do
|
||||
-- creo la lavorazione
|
||||
local Proc = vProc[i]
|
||||
if Proc.Flg ~= 0 and Proc.Down then
|
||||
-- dato che ho ruotato, aggiorno alcune proprietà della feature
|
||||
Proc.Box = EgtGetBBoxGlob( Proc.Id, GDB_BB.STANDARD)
|
||||
Proc.Face = BL.GetFacetsInfo( Proc, b3Raw)
|
||||
Proc.AffectedFaces = BL.GetProcessAffectedFaces( Proc)
|
||||
Proc.DistanceToNextPart = BL.GetDistanceToNextPart( nRawId, nPhase)
|
||||
Proc.PrevDouble = nPrevDouble
|
||||
nPrevDouble = Proc.Double
|
||||
local bOk, sMsg, nNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut, b3Raw, nOrd, sDownOrSideOrStd, nil, nil, dCurrOvmT)
|
||||
local bOk, sMsg, nNewPhase, AddedIds = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut, b3Raw, nOrd, sDownOrSideOrStd, nil, nil, dCurrOvmT)
|
||||
-- lavorazioni da fare dopo separazione
|
||||
if AddedIds and #AddedIds > 0 then
|
||||
for j = 1, #AddedIds do
|
||||
table.insert( vProc, AddedIds[j])
|
||||
end
|
||||
end
|
||||
if not bOk then
|
||||
nTotErr = nTotErr + 1
|
||||
table.insert( Stats, {Err=1, Msg=sMsg, Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
||||
@@ -1910,6 +2159,7 @@ function BeamExec.ProcessFeatures()
|
||||
EgtSetInfo( nDispId, 'ROT', -2)
|
||||
end
|
||||
end
|
||||
i = i + 1
|
||||
end
|
||||
-- se separazione non ancora effettuata, aggiungo nuova fase con le travi in posizione standard
|
||||
if not bSplitRot then
|
||||
@@ -1951,13 +2201,25 @@ function BeamExec.ProcessFeatures()
|
||||
local nPrevDouble = 0
|
||||
-- inserisco le lavorazioni da lavorare ruotate
|
||||
local nSideMchOk = 0
|
||||
for i = 1, #vProc do
|
||||
local i = 1
|
||||
while i <= #vProc do
|
||||
-- creo la lavorazione
|
||||
local Proc = vProc[i]
|
||||
if Proc.Flg ~= 0 and Proc.Side then
|
||||
-- dato che ho ruotato, aggiorno alcune proprietà della feature
|
||||
Proc.Box = EgtGetBBoxGlob( Proc.Id, GDB_BB.STANDARD)
|
||||
Proc.Face = BL.GetFacetsInfo( Proc, b3Raw)
|
||||
Proc.AffectedFaces = BL.GetProcessAffectedFaces( Proc)
|
||||
Proc.DistanceToNextPart = BL.GetDistanceToNextPart( nRawId, nPhase)
|
||||
Proc.PrevDouble = nPrevDouble
|
||||
nPrevDouble = Proc.Double
|
||||
local bOk, sMsg, nNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dCurrOvmT)
|
||||
local bOk, sMsg, nNewPhase, AddedIds = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dCurrOvmT)
|
||||
-- lavorazioni da fare dopo separazione
|
||||
if AddedIds and #AddedIds > 0 then
|
||||
for j = 1, #AddedIds do
|
||||
table.insert( vProc, AddedIds[j])
|
||||
end
|
||||
end
|
||||
if not bOk then
|
||||
nTotErr = nTotErr + 1
|
||||
table.insert( Stats, {Err=1, Msg=sMsg, Rot=-1, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
||||
@@ -1990,6 +2252,7 @@ function BeamExec.ProcessFeatures()
|
||||
EgtSetInfo( nDispId, 'ROT', -1)
|
||||
end
|
||||
end
|
||||
i = i + 1
|
||||
end
|
||||
-- se non sono state inserite lavorazioni di fianco, elimino la fase perchè inutile e dannosa
|
||||
if nSideMchOk == 0 then
|
||||
@@ -2016,13 +2279,25 @@ function BeamExec.ProcessFeatures()
|
||||
-- flag feature precedente in doppio
|
||||
local nPrevDouble = 0
|
||||
-- inserisco le lavorazioni non ribaltate della trave
|
||||
for i = 1, #vProc do
|
||||
local i = 1
|
||||
while i <= #vProc do
|
||||
-- creo la lavorazione
|
||||
local Proc = vProc[i]
|
||||
if Proc.Flg ~= 0 and ( not ( Proc.Down or Proc.Side) or BD.DOWN_HEAD or BD.TURN) then
|
||||
-- dato che ho ruotato, aggiorno alcune proprietà della feature
|
||||
Proc.Box = EgtGetBBoxGlob( Proc.Id, GDB_BB.STANDARD)
|
||||
Proc.Face = BL.GetFacetsInfo( Proc, b3Raw)
|
||||
Proc.AffectedFaces = BL.GetProcessAffectedFaces( Proc)
|
||||
Proc.DistanceToNextPart = BL.GetDistanceToNextPart( nRawId, nPhase)
|
||||
Proc.PrevDouble = nPrevDouble
|
||||
nPrevDouble = Proc.Double
|
||||
local bOk, sMsg, nNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw, nOrd, sDownOrSideOrStd, nil, nil, dCurrOvmT)
|
||||
local bOk, sMsg, nNewPhase, AddedIds = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw, nOrd, sDownOrSideOrStd, nil, nil, dCurrOvmT)
|
||||
-- lavorazioni da fare dopo separazione
|
||||
if AddedIds and #AddedIds > 0 then
|
||||
for j = 1, #AddedIds do
|
||||
table.insert( vProc, AddedIds[j])
|
||||
end
|
||||
end
|
||||
if not bOk then
|
||||
nTotErr = nTotErr + 1
|
||||
table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
||||
@@ -2050,6 +2325,7 @@ function BeamExec.ProcessFeatures()
|
||||
EgtSetInfo( nDispId, 'ORD', nOrd)
|
||||
end
|
||||
end
|
||||
i = i + 1
|
||||
end
|
||||
EgtOutLog( ' *** End AddMachinings ***', 1)
|
||||
-- passo al grezzo successivo
|
||||
|
||||
+227
-73
@@ -1,4 +1,4 @@
|
||||
-- BeamLib.lua by Egaltech s.r.l. 2023/03/22
|
||||
-- BeamLib.lua by Egaltech s.r.l. 2023/12/15
|
||||
-- Libreria globale per Travi
|
||||
-- 2020/07/28 Corretto calcolo attacchi e uscite di lame per non uscire dalla faccia sotto.
|
||||
-- 2020/08/18 Aggiunto a GetNearestParalOpposite e GetNearestOrthoOpposite parametro opzionale vtNorm.
|
||||
@@ -26,6 +26,10 @@
|
||||
-- 2023/09/25 In GetFaceWithMostAdj aggiunta verifica sottosquadro anche per facce non adiacenti.
|
||||
-- 2023/09/26 In GetFaceWithMostAdj gestito primo parametro anche come Proc; gestito caso strip con facce tutte in sottosquadro.
|
||||
-- 2023/09/26 Spostata qui funzione IsFeatureCuttingEntireSection da BeamExec.
|
||||
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation. Se l'elevazione è già calcolata la recupera da Proc, altrimenti la calcola al momento.
|
||||
-- 2023/12/15 Correzione a GetFaceWithMostAdj per calcoli con facce che fanno ombra.
|
||||
-- 2024/01/08 Correzione a Is3EdgesApprox per casi in cui nAddGroup non esista ancora.
|
||||
-- 2024/01/18 Aggiunta funzione GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local BeamLib = {}
|
||||
@@ -440,54 +444,22 @@ function BeamLib.GetBoxFaceNorm( b3Box, ptP, vtV)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function BeamLib.GetFaceElevation( nSurfId, nFac, nPartId)
|
||||
-- centro e normale della faccia
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFac, GDB_ID.ROOT)
|
||||
if not ptC or not vtN then return 0 end
|
||||
-- riferimento OCS della faccia per ricavare elevazione rispetto alla faccia della superficie
|
||||
local frOCS = Frame3d( ptC, vtN)
|
||||
local b3Box = EgtGetBBoxRef( nSurfId, GDB_BB.STANDARD, frOCS)
|
||||
local dElev = b3Box:getMax():getZ()
|
||||
-- se definito identificativo di pezzo
|
||||
if nPartId then
|
||||
-- se superficie con più facce
|
||||
if EgtSurfTmFacetCount( nSurfId) > 1 then
|
||||
-- determino elevazione del centro faccia rispetto al box del pezzo
|
||||
local _, dCenElev = BeamLib.GetPointDirDepth( nPartId, ptC, vtN)
|
||||
if dCenElev and dCenElev > dElev then
|
||||
dElev = dCenElev
|
||||
end
|
||||
-- altrimenti superficie ad una sola faccia
|
||||
else
|
||||
-- determino elevazione box del pezzo rispetto alla faccia
|
||||
local b3Solid = EgtGetBBoxRef( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD, frOCS)
|
||||
local dSolidElev = b3Solid:getMax():getZ()
|
||||
if b3Solid and dSolidElev > dElev then
|
||||
dElev = dSolidElev
|
||||
end
|
||||
end
|
||||
function BeamLib.GetFaceElevation( procOrProcId, nFacet, b3Solid)
|
||||
local Proc, nProcId
|
||||
if type( procOrProcId) == "table" then
|
||||
Proc = procOrProcId
|
||||
nProcId = Proc.Id
|
||||
else
|
||||
nProcId = procOrProcId
|
||||
end
|
||||
local dElevation
|
||||
if not Proc or not Proc.Face or not Proc.Face[nFacet + 1].Elevation then
|
||||
dElevation = EgtSurfTmFacetElevationInBBox( nProcId, nFacet, b3Solid, true, GDB_ID.ROOT)
|
||||
else
|
||||
dElevation = Proc.Face[nFacet + 1].Elevation
|
||||
end
|
||||
return dElev
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function BeamLib.GetOtherFaceElevation( nSurfId, nOtherSurfId, nOtherFac, nPartId)
|
||||
-- centro e normale della faccia
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( nOtherSurfId, nOtherFac, GDB_ID.ROOT)
|
||||
if not ptC or not vtN then return 0 end
|
||||
-- riferimento OCS della faccia per ricavare elevazione rispetto alla faccia della superficie
|
||||
local frOCS = Frame3d( ptC, vtN)
|
||||
local b3Box = EgtGetBBoxRef( nSurfId, GDB_BB.STANDARD, frOCS)
|
||||
local dElev = b3Box:getMax():getZ()
|
||||
-- se definito identificativo di pezzo
|
||||
if nPartId then
|
||||
-- determino elevazione del centro faccia rispetto al box del pezzo
|
||||
local _, dCenElev = BeamLib.GetPointDirDepth( nPartId, ptC, vtN)
|
||||
if dCenElev and dCenElev > dElev then
|
||||
dElev = dCenElev
|
||||
end
|
||||
end
|
||||
return dElev
|
||||
return dElevation
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
@@ -515,6 +487,7 @@ end
|
||||
---------------------------------------------------------------------
|
||||
function BeamLib.GetFaceWithMostAdj( Proc, nPartId, bCompare3Fc, dCosSideAng)
|
||||
local nSurfId = Proc.Id
|
||||
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
-- verifica che la superficie non sia chiusa e quindi non lavorabile
|
||||
if EgtSurfIsClosed( nSurfId) then
|
||||
return
|
||||
@@ -590,14 +563,19 @@ function BeamLib.GetFaceWithMostAdj( Proc, nPartId, bCompare3Fc, dCosSideAng)
|
||||
local frOCSMaster = Frame3d( vPtC[i], vvtN[i])
|
||||
EgtScale( nShadowContourId, frOCSMaster, 1, 1, 0, GDB_RT.GLOB)
|
||||
EgtModifyCurveExtrusion( nShadowContourId, vvtN[i], GDB_RT.GLOB)
|
||||
local nShadowSurfFlatId
|
||||
-- se non troppo ortogonale (almeno 0.5deg di delta)
|
||||
local dResV = vvtN[i] * vvtN[j]
|
||||
EgtOffsetCurve( nShadowContourId, EgtIf( dResV > GEO.EPS_SMALL, - 50, 50) * GEO.EPS_SMALL)
|
||||
local nShadowSurfFlatId = EgtSurfFlatRegion( nAddGrpId, nShadowContourId)
|
||||
local bShadowSurfIsExternal = EgtSurfFrTestExternal( nMasterSurfFlatId, nShadowSurfFlatId)
|
||||
if not bShadowSurfIsExternal then
|
||||
bUcut = true
|
||||
if abs( dResV) > 0.087 then
|
||||
EgtOffsetCurve( nShadowContourId, EgtIf( dResV > GEO.EPS_SMALL, - 50, 50) * GEO.EPS_SMALL)
|
||||
local nShadowSurfFlatId = EgtSurfFlatRegion( nAddGrpId, nShadowContourId)
|
||||
local bShadowSurfIsExternal = EgtSurfFrTestExternal( nMasterSurfFlatId, nShadowSurfFlatId)
|
||||
if not bShadowSurfIsExternal then
|
||||
bUcut = true
|
||||
end
|
||||
EgtErase( nShadowSurfFlatId)
|
||||
end
|
||||
EgtErase( { nMasterSurfFlatId, nShadowSurfFlatId})
|
||||
EgtErase( nMasterSurfFlatId)
|
||||
end
|
||||
EgtErase( { nMasterContourId, nShadowContourId, nShadowFacetId})
|
||||
end
|
||||
@@ -645,7 +623,7 @@ function BeamLib.GetFaceWithMostAdj( Proc, nPartId, bCompare3Fc, dCosSideAng)
|
||||
local dMinElev, dMinElev2 = GEO.INFINITO, GEO.INFINITO
|
||||
local dtElev = {}
|
||||
for i = 1, #nFacInd do
|
||||
local dElev = BeamLib.GetFaceElevation( nSurfId, nFacInd[i], nPartId)
|
||||
local dElev = BeamLib.GetFaceElevation( Proc, nFacInd[i], b3Solid)
|
||||
table.insert( dtElev, dElev)
|
||||
if dElev < dMinElev then
|
||||
if dMinElev < dMinElev2 then
|
||||
@@ -700,6 +678,13 @@ function BeamLib.GetFaceWithMostAdj( Proc, nPartId, bCompare3Fc, dCosSideAng)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
--- ritorna il riferimento di tipo OCS della faccia *nFacet* della trimesh *nSurfId* e le dimensioni orizzontale e verticale, eventualmente limitate dal grezzo *b3Raw*
|
||||
---@param nSurfId integer Id della trimesh
|
||||
---@param nFacet integer Indice 0-based della faccia della trimesh di cui restituire le informazioni
|
||||
---@param b3Raw? BBox3d Eventuale box del grezzo per limitare le dimensioni
|
||||
---@return Frame3d frHv riferimento faccia OCS
|
||||
---@return number dDimH dimensione orizzontale OCS
|
||||
---@return number dDmiV dimensione verticale OCS
|
||||
function BeamLib.GetFaceHvRefDim( nSurfId, nFacet, b3Raw)
|
||||
-- recupero centro e normale della faccia
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT)
|
||||
@@ -749,7 +734,9 @@ end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.GetNzLimDownUp( b3Raw, vtN, vtOrtho)
|
||||
if BD.C_SIMM then
|
||||
if BD.GetNzLimDownUp then
|
||||
return BD.GetNzLimDownUp( b3Raw, vtN, vtOrtho)
|
||||
elseif BD.C_SIMM then
|
||||
return -0.484
|
||||
elseif BD.TURN then
|
||||
return -2
|
||||
@@ -778,13 +765,20 @@ function BeamLib.GetNzLimDownUp( b3Raw, vtN, vtOrtho)
|
||||
else
|
||||
return -0.383
|
||||
end
|
||||
elseif b3Raw:getDimZ() < BD.MIN_DIM_HBEAM then
|
||||
elseif b3Raw:getDimZ() < 300 then
|
||||
-- N_HorAng < 10°
|
||||
if vtN and ( abs( vtN:getY()) < 0.174) then
|
||||
return -0.5
|
||||
else
|
||||
return -0.259
|
||||
end
|
||||
elseif b3Raw:getDimZ() < BD.MIN_DIM_HBEAM then
|
||||
-- N_HorAng < 10°
|
||||
if vtN and ( abs( vtN:getY()) < 0.174) then
|
||||
return -0.342
|
||||
else
|
||||
return -0.259
|
||||
end
|
||||
else
|
||||
-- N_HorAng < 10°
|
||||
if vtN and ( abs( vtN:getY()) < 0.174) then
|
||||
@@ -822,28 +816,16 @@ function BeamLib.GetDistanceToNextPart( nRawId, nPhase)
|
||||
-- se segue una parte rimanente riutilizzabile, modifico opportunamente questa distanza
|
||||
if not BeamLib.IsSplittedPartPhase( nPhase) then
|
||||
local nNextRawId = EgtGetNextRawPart( nRawId)
|
||||
if nNextRawId and
|
||||
EgtGetPartInRawPartCount( nNextRawId) <= 0 and
|
||||
EgtGetRawPartBBox( nNextRawId):getDimX() >= BD.MinRaw then
|
||||
if nNextRawId and
|
||||
EgtGetPartInRawPartCount( nNextRawId) <= 0 and
|
||||
EgtGetRawPartBBox( nNextRawId):getDimX() >= BD.MinRaw then
|
||||
|
||||
dDistToNextPiece = BD.OVM_MID
|
||||
end
|
||||
end
|
||||
return dDistToNextPiece
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function BeamLib.GetChainSawBlockedAxis( nInd)
|
||||
if BD.GetChainSawBlockedAxis then
|
||||
return BD.GetChainSawBlockedAxis( nInd)
|
||||
else
|
||||
if nInd == 1 then
|
||||
return EgtIf( BD.C_SIMM, 'A=90', 'A=90')
|
||||
else
|
||||
return EgtIf( BD.C_SIMM, 'A=0', 'A=0')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function BeamLib.GetChainSawInitAngs( vtN, vtO, nInd)
|
||||
if BD.GetChainSawInitAngs then
|
||||
@@ -861,6 +843,44 @@ function BeamLib.GetChainSawInitAngs( vtN, vtO, nInd)
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
---
|
||||
---@param sMachining string nome della lavorazione di cui bloccare l'asse
|
||||
---@param sBlockedAxis string rappresenta lo stato desiderato dell'asse bloccato, parallelo o perpendicolare all'asse rotante da cui dipende (*parallel* o *perpendicular*)
|
||||
---@param b3Raw? BBox3d
|
||||
---@param vtTool? Vector3d
|
||||
---@param vtOut? Vector3d
|
||||
---@return string # testo contenente il valore dell'asse rotante bloccato da scrivere nel parametro *MCH_MP.BLOCKEDAXIS* della lavorazione (es: 'A2=90')
|
||||
function BeamLib.GetBlockedAxis( sMachining, sBlockedAxis, b3Raw, vtTool, vtOut)
|
||||
-- informazioni sull'utensile della lavorazione
|
||||
local nToolType, sHead
|
||||
if EgtMdbSetCurrMachining( sMachining) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
nToolType = EgtTdbGetCurrToolParam( MCH_TP.TYPE)
|
||||
sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
|
||||
end
|
||||
end
|
||||
-- se presente funzione specifica nella macchina, la richiamo
|
||||
if BD.GetBlockedAxis then
|
||||
return BD.GetBlockedAxis( sHead, nToolType, sBlockedAxis, b3Raw, vtTool, vtOut) or ''
|
||||
-- sezione mantenuta per retrocompatibilità con GetChainSawBlockedAxis
|
||||
elseif nToolType == MCH_TY.MORTISE_STD then
|
||||
local nInd = EgtIf( sBlockedAxis == 'parallel', 0, 1)
|
||||
if BD.GetChainSawBlockedAxis then
|
||||
return BD.GetChainSawBlockedAxis( nInd)
|
||||
else
|
||||
if nInd == 1 then
|
||||
return EgtIf( BD.C_SIMM, 'A=90', 'A=90')
|
||||
else
|
||||
return EgtIf( BD.C_SIMM, 'A=0', 'A=0')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return ''
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Trova l'Ind (0 based) della faccia meglio orientata come l'asse vtAx. Restituisce anche vtN e ptC della faccia stessa. La faccia di indice (0 based) fctExclude non viene considerata nella ricerca.
|
||||
function BeamLib.FindFaceBestOrientedAsAxis( Proc, vtAx, fctExclude)
|
||||
@@ -1089,6 +1109,10 @@ end
|
||||
-- Funzione per determinare se la faccia ha lati molto corti (trascurabili) ed è quindi approssimabile ad una 3 facce
|
||||
function BeamLib.Is3EdgesApprox( Proc, nFacet, nAddGrpId)
|
||||
nAddGrpId = nAddGrpId or BeamLib.GetAddGroup( Proc.PartId)
|
||||
if not nAddGrpId then
|
||||
local nEdges = #(EgtSurfTmFacetAdjacencies( Proc.Id, nFacet)[1])
|
||||
return ( nEdges == 3)
|
||||
end
|
||||
local bResult = false
|
||||
local nContourId, nContourCnt = EgtExtractSurfTmFacetLoops( Proc.Id, nFacet, nAddGrpId)
|
||||
if not nContourId then return false end
|
||||
@@ -1148,4 +1172,134 @@ function BeamLib.IsFeatureCuttingEntireSection( b3Proc, dRawW, dRawH)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
return BeamLib
|
||||
function BeamLib.GetAdjacentFaces( Proc, nFacet)
|
||||
local AdjacentFaces = {}
|
||||
local vFaceAdjacencies = EgtSurfTmFacetAdjacencies( Proc.Id, nFacet)[1]
|
||||
for i = 1, #vFaceAdjacencies do
|
||||
if vFaceAdjacencies[i] > -1 then
|
||||
local _, ptP1, ptP2 = EgtSurfTmFacetsContact( Proc.Id, nFacet, vFaceAdjacencies[i], GDB_ID.ROOT)
|
||||
local dLen = dist( ptP1, ptP2)
|
||||
table.insert( AdjacentFaces, { Id = vFaceAdjacencies[i], LengthOnMainFace = dLen})
|
||||
end
|
||||
end
|
||||
|
||||
return AdjacentFaces
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.GetFacetsInfo( Proc, b3Raw)
|
||||
|
||||
if Proc.Fct > 20 then
|
||||
return nil
|
||||
end
|
||||
|
||||
local Face = {}
|
||||
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( Proc.PartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
local vAdj
|
||||
if Proc.AdjacencyMatrix then
|
||||
vAdj = Proc.AdjacencyMatrix
|
||||
else
|
||||
vAdj = BeamLib.GetAdjacencyMatrix( Proc)
|
||||
end
|
||||
|
||||
for i = 1, Proc.Fct do
|
||||
Face[i] = {}
|
||||
Face[i].Id = i - 1
|
||||
Face[i].PtCenter, Face[i].VtN = EgtSurfTmFacetCenter( Proc.Id, i - 1, GDB_ID.ROOT)
|
||||
if Proc.Fct < 10 then
|
||||
local frHV, dFaceWidthTrimmed, dFaceHeightTrimmed = BeamLib.GetFaceHvRefDim( Proc.Id, i - 1, b3Raw)
|
||||
-- frame OCS faccia
|
||||
Face[i].FrameHV = frHV
|
||||
-- larghezza OCS faccia trimmata con grezzo
|
||||
Face[i].WidthTrimmed = dFaceWidthTrimmed
|
||||
-- altezza OCS faccia trimmata con grezzo
|
||||
Face[i].HeightTrimmed = dFaceHeightTrimmed
|
||||
local _, dFaceWidth, dFaceHeight = BeamLib.GetFaceHvRefDim( Proc.Id, i - 1)
|
||||
-- larghezza OCS faccia
|
||||
Face[i].Width = dFaceWidth
|
||||
-- altezza OCS faccia
|
||||
Face[i].Height = dFaceHeight
|
||||
-- elevazione calcolata rispetto al box della parte
|
||||
Face[i].Elevation = EgtSurfTmFacetElevationInBBox( Proc.Id, i - 1, b3Solid, true, GDB_ID.ROOT)
|
||||
-- area della faccia
|
||||
-- TODO qui sarebbe meglio l'area vera e non quella del rettangolo minimo
|
||||
local _, dLongEdgeDimension, dShortEdgeDimension = EgtSurfTmFacetMinAreaRectangle( Proc.Id, i - 1, GDB_ID.ROOT)
|
||||
Face[i].Area = dShortEdgeDimension * dLongEdgeDimension
|
||||
-- adiacenze della faccia
|
||||
-- TODO chiamarle in modo che si capisca che sono solo gli id e non l'intero oggetto faccia
|
||||
Face[i].Adjacencies = {}
|
||||
for j = 1, Proc.Fct do
|
||||
if vAdj[i][j] and vAdj[i][j] ~= 0 and ( i ~= j) then
|
||||
table.insert( Face[i].Adjacencies, j - 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return Face
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- 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
|
||||
function BeamLib.GetAdjacencyMatrix( Proc)
|
||||
local vAdj = {}
|
||||
-- essendo la matrice simmetrica a diagonale nulla, ne calcolo solo la metà superiore
|
||||
for i = 1, Proc.Fct do
|
||||
vAdj[i] = {}
|
||||
for j = i + 1, Proc.Fct do
|
||||
_, _, _, 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
|
||||
end
|
||||
-- riempio di conseguenza il resto della matrice
|
||||
for i = 1, Proc.Fct do
|
||||
vAdj[i][i] = 0
|
||||
for j = i + 1, Proc.Fct do
|
||||
vAdj[j][i] = vAdj[i][j]
|
||||
end
|
||||
end
|
||||
return vAdj
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.GetMachiningSteps( dMachiningDepth, dStep)
|
||||
|
||||
local MachiningSteps = {}
|
||||
MachiningSteps.StepLength = 0
|
||||
MachiningSteps.Count = ceil( ( dMachiningDepth - 10 * GEO.EPS_SMALL) / dStep)
|
||||
if MachiningSteps.Count > 1 then
|
||||
MachiningSteps.StepLength = ( dMachiningDepth - dStep) / ( MachiningSteps.Count - 1)
|
||||
end
|
||||
|
||||
return MachiningSteps
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.IsCutNeeded( Proc, b3Raw, dOvmHead, dOvmTail)
|
||||
if not dOvmTail then
|
||||
dOvmTail = BD.OVM_MID
|
||||
end
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
|
||||
if Proc.Head then
|
||||
-- se coincide con il taglio di separazione precedente, non va fatto
|
||||
if AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Raw:getMax():getX() + dOvmHead) < 10 * GEO.EPS_SMALL then
|
||||
return false
|
||||
end
|
||||
-- altrimenti taglio di coda
|
||||
else
|
||||
-- se coincide con taglio di separazione, non va fatto
|
||||
if AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
|
||||
return false
|
||||
end
|
||||
end
|
||||
-- se coincide con un taglio frontale non va fatto
|
||||
if Proc.CutFront then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
return BeamLib
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
-- DiceCut.lua by Egaltech s.r.l. 2023/06/29
|
||||
-- DiceCut.lua by Egaltech s.r.l. 2024/01/23
|
||||
-- Gestione dei piano paralleli nei tagli lunghi: equidistanziamento dei piani paralleli
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
@@ -396,7 +396,7 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl
|
||||
end
|
||||
local dElevP = DistanzaMassima( nParent, ptCPlanes, vtNPlanes, ptCBond, vtNBond, BBoxRawPart, TBoxPoint)
|
||||
local dElevO
|
||||
if ptCBond and vtNBond then
|
||||
if ptCBond and vtNBond and not AreOppositeVectorApprox( vtNBond, vtNPlanes) then
|
||||
dElevO = DistanzaMassima( nParent, ptCBond, vtNBond, ptCPlanes, vtNPlanes, BBoxRawPart, TBoxPoint)
|
||||
end
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
-- FaceByPocket.lua by Egaltech s.r.l. 2023/04/04
|
||||
-- Gestione svuotatura di feature con una faccia
|
||||
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local FaceByPocket = {}
|
||||
@@ -78,7 +79,7 @@ function FaceByPocket.Make( Proc, nSurfId, nFacet, sPocketing, nPartId, b3Solid,
|
||||
end
|
||||
-- dati della faccia
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT)
|
||||
local dElev = BL.GetFaceElevation( nSurfId, nFacet, nPartId)
|
||||
local dElev = BL.GetFaceElevation( nSurfId, nFacet, b3Solid)
|
||||
-- determino numero e valore degli step di lavorazione
|
||||
local nSurfStep = ceil( dElev / dMaxDepth)
|
||||
local dSurfStep = dElev / nSurfStep
|
||||
|
||||
+362
-231
@@ -1,4 +1,4 @@
|
||||
-- FacesBySaw.lua by Egaltech s.r.l. 2023/09/26
|
||||
-- FacesBySaw.lua by Egaltech s.r.l. 2024/01/07
|
||||
-- Gestione taglio con lama di feature con una o due facce
|
||||
-- 2021/01/06 Cambiato limite per attacco Tg con lama e CalcLeadInOutGeom rinominata in CalcLeadInOutPerpGeom.
|
||||
-- 2021/02/03 In taglio lama si accettano anche due lati con deviazione minore di 20deg.
|
||||
@@ -18,6 +18,17 @@
|
||||
-- 2023/05/18 Imposto in ogni caso dVzLimDwnUp prima anche di bDownHead.
|
||||
-- 2023/06/14 Aggiunta MakeParallelOne e tolti parametri nForceWorkSide, nForceSCC da MakeOne.
|
||||
-- 2023/09/26 Piccola modifica per Turn su bInvert di MakeOne.
|
||||
-- 2023/10/24 In MakeOne migliorata gestione taglio con percorso bilinea. Aggiunta funzione GetNameSolidFaceIncludingLine.
|
||||
-- 2023/11/14 In MakeOne migliorato calcolo scelta soluzione per macchina TURN
|
||||
-- 2023/11/28 In MakeTwo raffinamento calcolo vtRef per casi dubbi.
|
||||
-- 2023/12/06 In CalcLeadInOutPerpGeom gestito caso in cui la geometria della feature esce dal grezzo.
|
||||
-- 2023/12/30 Modifiche in CalcLeadInOutPerpGeom e CalcLeadInOutTangGeom con uso di EgtCAvToolPosBox.
|
||||
-- 2024/01/07 Modifiche per OikosX (BD.TURN == 2).
|
||||
-- 2024/01/18 Gestita lama con aggregato con asse bloccato per massimizzare capacità di taglio verticale, se da sotto.
|
||||
-- Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile.
|
||||
-- 2024/02/22 Migliorato calcolo area non pinzabile in testa HCING e coda TCING
|
||||
-- 2024/03/27 In MakeTwo rimossa gestione calcolo differente su ultima passata in caso di macchina FAST
|
||||
-- 2024/06/18 In MakeOne in caso di inversione del percorso, si scambia anche accorciamento start con end
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local FacesBySaw = {}
|
||||
@@ -34,7 +45,8 @@ local BD = require( 'BeamData')
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert)
|
||||
function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert, bForceTangentLeadInOut)
|
||||
EgtOutLog( 'FacesBySaw.MakeParallelOne', 3)
|
||||
-- dati della faccia
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT)
|
||||
-- accetto solo facce perpendicolari all'asse X della trave
|
||||
@@ -64,7 +76,7 @@ function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimD
|
||||
local bLioTang
|
||||
local Ktp = 1.1
|
||||
if BD.KIOTP then Ktp = BD.KIOTP end
|
||||
if Ktp * dLi2Tang < dLiPerp then
|
||||
if bForceTangentLeadInOut or ( Ktp * dLi2Tang < dLiPerp) then
|
||||
bLioTang = true
|
||||
dLiTang, dLiPerp, dLoTang, dLoPerp = dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp
|
||||
if BD.TURN then
|
||||
@@ -129,6 +141,20 @@ function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimD
|
||||
-- imposto allungamenti iniziale e finale
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, -dAccStart)
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, -dAccEnd)
|
||||
-- imposto angolo 3° asse rot
|
||||
local bDownHead = ( dVzLimDwnUp and dVzLimDwnUp < - 1.5)
|
||||
local vtTool
|
||||
if nFaceUse == MCH_MILL_FU.PARAL_FRONT then
|
||||
vtTool = Y_AX()
|
||||
elseif nFaceUse == MCH_MILL_FU.PARAL_BACK then
|
||||
vtTool = -Y_AX()
|
||||
elseif nFaceUse == MCH_MILL_FU.PARAL_DOWN then
|
||||
vtTool = Z_AX()
|
||||
else
|
||||
vtTool = -Z_AX()
|
||||
end
|
||||
local vtOut = EgtIf( vtN:getX() > 0, X_AX(), -X_AX())
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCutting, 'perpendicular', b3Raw, vtTool, vtOut))
|
||||
-- eventuali note
|
||||
if sNotes and #sNotes > 0 then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end
|
||||
-- eseguo
|
||||
@@ -141,7 +167,32 @@ function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimD
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert)
|
||||
local function GetNameSolidFaceIncludingLine( b3Solid, ptP1Comp, ptP2Comp)
|
||||
-- se aperto su faccia fronte
|
||||
if abs( b3Solid:getMin():getY() - ptP1Comp:getY()) < 100 * GEO.EPS_SMALL and abs( b3Solid:getMin():getY() - ptP2Comp:getY()) < 100 * GEO.EPS_SMALL then
|
||||
return true, 'Front'
|
||||
-- se aperto su faccia sopra
|
||||
elseif abs( b3Solid:getMax():getY() - ptP1Comp:getY()) < 100 * GEO.EPS_SMALL and abs( b3Solid:getMax():getY() - ptP2Comp:getY()) < 100 * GEO.EPS_SMALL then
|
||||
return true, 'Back'
|
||||
-- se aperto su faccia retro
|
||||
elseif abs( b3Solid:getMin():getZ() - ptP1Comp:getZ()) < 100 * GEO.EPS_SMALL and abs( b3Solid:getMin():getZ() - ptP2Comp:getZ()) < 100 * GEO.EPS_SMALL then
|
||||
return true, 'Bottom'
|
||||
-- se aperto su faccia sotto
|
||||
elseif abs( b3Solid:getMax():getZ() - ptP1Comp:getZ()) < 100 * GEO.EPS_SMALL and abs( b3Solid:getMax():getZ() - ptP2Comp:getZ()) < 100 * GEO.EPS_SMALL then
|
||||
return true, 'Top'
|
||||
-- se aperto su faccia sinistra
|
||||
elseif abs( b3Solid:getMin():getX() - ptP1Comp:getX()) < 100 * GEO.EPS_SMALL and abs( b3Solid:getMin():getX() - ptP2Comp:getX()) < 100 * GEO.EPS_SMALL then
|
||||
return true, 'Left'
|
||||
-- se aperto su faccia destra
|
||||
elseif abs( b3Solid:getMax():getX() - ptP1Comp:getX()) < 100 * GEO.EPS_SMALL and abs( b3Solid:getMax():getX() - ptP2Comp:getX()) < 100 * GEO.EPS_SMALL then
|
||||
return true, 'Right'
|
||||
end
|
||||
-- se non è sul bordo del solido
|
||||
return false
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert, bMaximizeVerticalDepth, bSpecialTangentLeadInOut, bForceTangentLeadInOut, Par5Alternative)
|
||||
-- se lama con asse parallelo alla faccia, passo alla apposita funzione
|
||||
if ( Par5 == MCH_MILL_FU.PARAL_DOWN or
|
||||
Par5 == MCH_MILL_FU.PARAL_TOP or
|
||||
@@ -149,14 +200,17 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
||||
Par5 == MCH_MILL_FU.PARAL_BACK or
|
||||
Par5 == MCH_MILL_FU.PARAL_LEFT or
|
||||
Par5 == MCH_MILL_FU.PARAL_RIGHT) then
|
||||
return MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert)
|
||||
return MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert, bForceTangentLeadInOut)
|
||||
end
|
||||
-- la lama ha asse perpendicolare alla faccia
|
||||
EgtOutLog( 'FacesBySaw.MakeOne', 3)
|
||||
-- dati della faccia
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT)
|
||||
-- risolvo parametro ambiguo
|
||||
local nOrthoOpposite
|
||||
local vtOrthO
|
||||
local nOrthoOppositeAlternative
|
||||
local vtOrthOAlternative
|
||||
if isVector3d( Par5) then
|
||||
nOrthoOpposite = BL.GetNearestOrthoOpposite( Par5, vtN)
|
||||
vtOrthO = Vector3d( Par5)
|
||||
@@ -164,6 +218,16 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
||||
nOrthoOpposite = Par5
|
||||
vtOrthO = BL.GetVersRef( Par5)
|
||||
end
|
||||
if Par5Alternative then
|
||||
if isVector3d( Par5Alternative) then
|
||||
nOrthoOppositeAlternative = BL.GetNearestOrthoOpposite( Par5Alternative, vtN)
|
||||
vtOrthOAlternative = Vector3d( Par5Alternative)
|
||||
else
|
||||
nOrthoOppositeAlternative = Par5Alternative
|
||||
vtOrthOAlternative = BL.GetVersRef( Par5Alternative)
|
||||
end
|
||||
end
|
||||
EgtOutLog( 'VtOrthO='..tostring( vtOrthO)..' FaceUse='..tostring( nOrthoOpposite), 3)
|
||||
-- verifico se testa da sotto oppure se lavorazione sotto con testa da sopra
|
||||
if not dVzLimDwnUp then dVzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN, vtOrthO) end
|
||||
local bDownHead = ( dVzLimDwnUp and dVzLimDwnUp < - 1.5)
|
||||
@@ -182,13 +246,34 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
||||
end
|
||||
local bIsSawCCW = ( EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0)
|
||||
local bInvert = bForceInvert
|
||||
-- se la lama ruota in senso antiorario inverto la direzione di lavorazione, per avere rotazione lama opposta a avanzamento
|
||||
-- l'inversione può essere comandata da rotazione lama (direzione concorde, legata anche a DownUp) oppure da direzione Z del percorso (si preferisce lavorare dal basso verso l'alto per limitare le corse)
|
||||
-- se c'è disaccordo tra rotazione e direzione si cambia il lato di lavoro, se possibile. Se ciò non è possbile comanda la direzione.
|
||||
if bInvert == nil then
|
||||
if not BD.TURN or abs( ptP2:getY() - ptP1:getY()) < 250 then
|
||||
if bIsSawCCW ~= bDownUp then
|
||||
bInvert = ( ptP2:getZ() < ptP1:getZ() + 100 * GEO.EPS_SMALL)
|
||||
local bIsMachiningDownwards = ( ptP2:getZ() < ptP1:getZ() - 100 * GEO.EPS_SMALL)
|
||||
local bIsMachiningUpwards = ( ptP2:getZ() > ptP1:getZ() + 100 * GEO.EPS_SMALL)
|
||||
if ( bIsSawCCW ~= bDownUp) and bIsMachiningDownwards then
|
||||
bInvert = true
|
||||
elseif ( ( bIsSawCCW ~= bDownUp) ~= bIsMachiningDownwards) then
|
||||
if Par5Alternative then
|
||||
bInvert = true
|
||||
nOrthoOpposite = nOrthoOppositeAlternative
|
||||
vtOrthO = vtOrthOAlternative
|
||||
-- avendo riassegnato la direzione di lavoro, i dati della linea vanno ricalcolati
|
||||
ptP1, ptPm, ptP2, vtV1, vtV2, dLen, dWidth = EgtSurfTmFacetOppositeSide( nSurfId, nFacet, BL.GetVersRef( nOrthoOpposite), GDB_ID.ROOT)
|
||||
if not dLen or dLen < 1.1 or not dWidth or dWidth < 1.1 then
|
||||
local sWarn = 'Face ' .. string.format( '%d,%d', nSurfId, nFacet) .. ' skipped : too small'
|
||||
EgtOutLog( sWarn, 1)
|
||||
return true, ''
|
||||
end
|
||||
vtV1 = - vtV1
|
||||
elseif bIsMachiningDownwards or not bIsMachiningUpwards then
|
||||
bInvert = true
|
||||
else
|
||||
bInvert = false
|
||||
end
|
||||
else
|
||||
bInvert = ( ptP2:getZ() < ptP1:getZ() - 100 * GEO.EPS_SMALL)
|
||||
bInvert = false
|
||||
end
|
||||
else
|
||||
local vtTmp = ptP2 - ptP1 ; vtTmp:normalize()
|
||||
@@ -198,21 +283,33 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
||||
if bInvert then
|
||||
ptP1, ptP2 = ptP2, ptP1
|
||||
vtV1, vtV2 = vtV2, vtV1
|
||||
dAccStart, dAccEnd = dAccEnd, dAccStart
|
||||
end
|
||||
local vtTg = ptP2 - ptP1 ; vtTg:normalize()
|
||||
local dAllStart = 0
|
||||
local dAllEnd = 0
|
||||
local bIsBiLinea = false
|
||||
local dCosAngleL1L2 = 0
|
||||
local dDist1 = dist( ptP1, ptPm)
|
||||
local dDist2 = dist( ptP2, ptPm)
|
||||
-- verifico se la bilinea si trova sul bordo del solido, quindi è una geometria aperta
|
||||
local nIdSolid = EgtGetParent( EgtGetParent( nSurfId))
|
||||
-- recupero ingombro del pezzo
|
||||
local Ls = EgtGetFirstNameInGroup( nIdSolid, 'Box')
|
||||
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
-- controllo se le linee sono sul bordo della trave, quindi aperte
|
||||
local bIsL1OnFace = GetNameSolidFaceIncludingLine( b3Solid, ptP1, ptPm)
|
||||
local bIsL2OnFace = GetNameSolidFaceIncludingLine( b3Solid, ptPm, ptP2)
|
||||
-- se bilinea, scarto la parte più allineata con la direzione ortogonale (se deviazione angolare oltre 20 deg o lunghezza minore di dSawDiam/2 * cos( 20/2)) ma maggiore di un minimo
|
||||
if ( ( ptPm - ptP1) - ( ptPm - ptP1) * vtTg * vtTg):len() > 100 * GEO.EPS_SMALL then
|
||||
bIsBiLinea = true
|
||||
local vtTg1 = ptPm - ptP1 ; vtTg1:normalize()
|
||||
local vtTg2 = ptP2 - ptPm ; vtTg2:normalize()
|
||||
local dDist1 = dist( ptP1, ptPm)
|
||||
local dDist2 = dist( ptP2, ptPm)
|
||||
local dCosMax = 0.951 -- cos( 18°)
|
||||
local dLenMin = 30
|
||||
local dLenMax = max( 0.5 * dSawDiam * 0.17365 + 1, 2 * dLenMin)
|
||||
--if vtTg1 * vtTg2 < dCosMax or ( dDist1 < dLenMax and dDist1 > dLenMin) or ( dDist2 < dLenMax and dDist2 > dLenMin) then
|
||||
if vtTg1 * vtTg2 < dCosMax then
|
||||
dCosAngleL1L2 = vtTg1 * vtTg2
|
||||
if dCosAngleL1L2 < dCosMax then
|
||||
local dOrtho1 = abs( vtTg1 * vtOrthO)
|
||||
local dOrtho2 = abs( vtTg2 * vtOrthO)
|
||||
if dOrtho1 < dOrtho2 or ( abs( dOrtho1 - dOrtho2) < 0.1 and dDist1 > 4 * dDist2) then
|
||||
@@ -259,14 +356,68 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
||||
-- parametri di attacco/uscita
|
||||
local b3Box = BBox3d( b3Raw)
|
||||
b3Box:expand( dCutSic)
|
||||
local ptPa1 = ptP1 + dAccStart * vtTg
|
||||
local ptPa2 = ptP2 + dAccEnd * vtTg
|
||||
-- attacco perpendicolare
|
||||
local dLiTang, dLiPerp, dLoTang, dLoPerp, vtLio = FacesBySaw.CalcLeadInOutPerpGeom( ptP1, ptP2, vtV1, vtV2, vtN, dSawDiam/2, vtRef, dCutExtra, b3Box)
|
||||
local dLiTang, dLiPerp, dLoTang, dLoPerp, vtLio = FacesBySaw.CalcLeadInOutPerpGeom( ptPa1, ptPa2, vtV1, vtV2, vtN, dSawDiam / 2, vtRef, dCutExtra, b3Box)
|
||||
local dLenLi = sqrt( dLiTang * dLiTang + dLiPerp * dLiPerp)
|
||||
local dLenLo = sqrt( dLoTang * dLoTang + dLoPerp * dLoPerp)
|
||||
local dLiCompLength = 0
|
||||
-- attacco tangente
|
||||
local dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp = FacesBySaw.CalcLeadInOutTangGeom( ptP1, ptP2, vtN, dSawDiam/2, vtRef, dCutExtra, b3Box)
|
||||
local dLi2Tang = 0
|
||||
local dLi2Perp = 0
|
||||
local dLo2Tang = 0
|
||||
local dLo2Perp = 0
|
||||
local dLi2CompLength = 0
|
||||
|
||||
-- si predilige un attacco tangenziale (con calcolo automatico di quanto uscire) se faccia che guarda in giù, non troppo orientata verso X e linea non troppo inclinata in X
|
||||
-- non si fa se macchina tipo PF e pezzo alto perchè la lama, uscendo da sopra, toccherebbe la traversa
|
||||
-- TODO si potranno togliere i limiti sulle normali quando si implementerà un modo per calcolare Lead In / Out correttamente in tutti i casi
|
||||
--
|
||||
if bSpecialTangentLeadInOut and not bIsBiLinea and ( vtN:getZ() < - 0.087) and ( abs( vtN:getX()) < 0.258) and ( abs( vtTg:getX()) < 0.1736) and ( abs( vtN:getY()) < 0.5 or ( BD.MAX_DIM_HTCUT_HBEAM > 0 or ( b3Raw:getDimZ() < 420))) then
|
||||
dLi2Tang = 0
|
||||
dLi2Perp = BD.CUT_EXTRA
|
||||
dLi2CompLength = dLen + dSawDiam / 2 + BD.COLL_SIC
|
||||
dLo2Tang = dSawDiam / 2
|
||||
else
|
||||
dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp = FacesBySaw.CalcLeadInOutTangGeom( ptPa1, ptPa2, vtN, dSawDiam / 2, vtRef, dCutExtra, b3Box)
|
||||
end
|
||||
local dLenLi2 = abs( dLi2Tang)
|
||||
local dLenLo2 = abs( dLo2Tang)
|
||||
|
||||
-- se il lato non lavorato della bilinea è aperto, setto entrata/uscita con la stessa direzione
|
||||
if bIsBiLinea then
|
||||
-- angolo tra le due linee
|
||||
local dCosAlpha = dCosAngleL1L2
|
||||
local dSinAlpha = sqrt( max( 1 - dCosAlpha * dCosAlpha, 0))
|
||||
-- se ho accorciato ingresso, setto componente tangente e perpendicolare sul percorso di entrata
|
||||
if abs( dAllStart) > 100 * GEO.EPS_SMALL and bIsL1OnFace then
|
||||
-- controllo prima che il secondo lato non sia già incluso nella lavorazione del primo
|
||||
local dDistPtTang = dCosAlpha * dDist1
|
||||
local dDistPtPerp = dSinAlpha * dDist1
|
||||
local dDistToCenter = 0.5 * dSawDiam - dDistPtPerp
|
||||
local dDistPointToCenter = sqrt( dDistPtTang * dDistPtTang + dDistToCenter * dDistToCenter)
|
||||
-- se distanza al punto è maggiore del raggio lama, significa che non ho già lavorato, quindi calcolo entrata opportunamente
|
||||
if dDistPointToCenter > 0.5 * dSawDiam then
|
||||
dLiTang = -dAllStart * dCosAlpha
|
||||
dLiPerp = dDist1 * dSinAlpha
|
||||
end
|
||||
end
|
||||
-- se ho accorciato uscita, setto componente tangente e perpendicolare sul percorso di uscita
|
||||
if abs( dAllEnd) > 100 * GEO.EPS_SMALL and bIsL2OnFace then
|
||||
-- controllo prima che il secondo lato non sia già incluso nella lavorazione del primo
|
||||
local dDistPtTang = dCosAlpha * dDist2
|
||||
local dDistPtPerp = dSinAlpha * dDist2
|
||||
local dDistToCenter = 0.5 * dSawDiam - dDistPtPerp
|
||||
local dDistPointToCenter = sqrt( dDistPtTang * dDistPtTang + dDistToCenter * dDistToCenter)
|
||||
-- se distanza al punto è maggiore del raggio lama, significa che non ho già lavorato, quindi calcolo uscita opportunamente
|
||||
if dDistPointToCenter > 0.5 * dSawDiam then
|
||||
dLoTang = -dAllEnd * dCosAlpha
|
||||
dLoPerp = dDist2 * dSinAlpha
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- scelgo l'attacco più conveniente (se non taglio praticamente longitudinale)
|
||||
local bLioTang
|
||||
local Ktp = 1.1
|
||||
@@ -276,30 +427,60 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
||||
abs( vtTg:getX()) < 0.9848 and
|
||||
( ( abs( vtTg:getZ()) < 0.17 and ( vtV1:getZ() < -0.5 or vtV2:getZ() < -0.5) and not bDownHead) or
|
||||
( abs( vtTg:getZ()) < 0.51 and b3Box:getDimZ() > 300 and BD.C_SIMM and BD.MAX_HEIGHT > 450 and b3Box:getDimX() > BD.LEN_SHORT_PART) or
|
||||
( abs( vtTg:getZ()) < 0.51 and ( dLenLi2 + dLenLo2) < ( dLenLi + dLenLo)) or Ktp * ( dLenLi2 + dLenLo2) < ( dLenLi + dLenLo)) then
|
||||
bLioTang = true
|
||||
dLiTang, dLiPerp, dLoTang, dLoPerp = dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp
|
||||
if BD.TURN then
|
||||
( abs( vtTg:getZ()) < 0.51 and ( dLenLi2 + dLenLo2) < ( dLenLi + dLenLo)) or
|
||||
Ktp * ( dLenLi2 + dLenLo2) < ( dLenLi + dLenLo) or
|
||||
( BD.TURN == 2 and vtRef:getZ() < -0.1)) then
|
||||
if BD.TURN == 2 then
|
||||
if vtTg:getY() < -0.1 then
|
||||
bLioTang = 1
|
||||
local dMove = dist( ptP1, ptP2)
|
||||
dLiTang = -( dLi2Tang - dAccStart - dAccEnd + dMove)
|
||||
-- dLiPerp rimane invariato
|
||||
dLoTang, dLoPerp = dLo2Tang, dLo2Perp
|
||||
else
|
||||
bLioTang = 2
|
||||
local dMove = dist( ptP1, ptP2)
|
||||
dLiTang, dLiPerp = dLi2Tang, dLi2Perp
|
||||
dLoTang = -( dLiTang - dAccStart - dAccEnd + dMove)
|
||||
-- dLoPerp rimane invariato
|
||||
end
|
||||
elseif BD.TURN then
|
||||
bLioTang = 2
|
||||
local dMove = dist( ptP1, ptP2)
|
||||
dLoTang = -( dLiTang + dAllStart - dAccStart + dAllEnd - dAccEnd + dMove)
|
||||
dLiTang, dLiPerp = dLi2Tang, dLi2Perp
|
||||
dLoTang = -( dLiTang - dAccStart - dAccEnd + dMove)
|
||||
dLoPerp = BD.COLL_SIC
|
||||
else
|
||||
bLioTang = true
|
||||
dLiTang, dLiPerp, dLoTang, dLoPerp, dLiCompLength = dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp, dLi2CompLength
|
||||
end
|
||||
end
|
||||
-- posizione braccio
|
||||
EgtOutLog( 'vtN=' .. tostring( vtN) .. ' vtRef=' .. tostring( vtRef) .. ' vtOut=' .. tostring( vtOut) .. ' vtAux=' .. tostring( vtAux), 3)
|
||||
local nSCC = MCH_SCC.NONE
|
||||
if not BD.TURN then
|
||||
if abs( vtAux:getX()) > abs( vtAux:getY()) - GEO.EPS_SMALL then
|
||||
-- per ora aggregato usato in verticale solo in split e headcut; Fast non influenzata
|
||||
if BD.C_SIMM and bMaximizeVerticalDepth then
|
||||
nSCC = MCH_SCC.ADIR_ZM
|
||||
elseif abs( vtAux:getX()) > abs( vtAux:getY()) - GEO.EPS_SMALL then
|
||||
nSCC = EgtIf( ( vtAux:getX() > -GEO.EPS_SMALL), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
||||
else
|
||||
nSCC = EgtIf( ( vtAux:getY() > -GEO.EPS_SMALL), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
||||
end
|
||||
else
|
||||
if bLioTang then
|
||||
--local vtTest = EgtIf( bInvert, vtTg, -vtTg)
|
||||
if BD.TURN == 2 then
|
||||
if vtOrthO:getZ() > -0.01 then
|
||||
nSCC = MCH_SCC.ADIR_ZP
|
||||
else
|
||||
nSCC = MCH_SCC.ADIR_ZM
|
||||
end
|
||||
elseif bLioTang then
|
||||
local vtTest = -vtTg
|
||||
if abs( vtTest:getY()) > abs( vtTest:getZ()) then
|
||||
nSCC = EgtIf( vtTest:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
||||
-- calcolo direzione risultante da versore utensile e direzione di lavorazione inverso
|
||||
-- se la risultante tende verso Y positiva, scelgo soluzione dietro
|
||||
local vtRes = vtTest + vtAux ; vtRes:normalize()
|
||||
nSCC = EgtIf( vtRes:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
||||
else
|
||||
nSCC = EgtIf( vtTest:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
|
||||
end
|
||||
@@ -341,14 +522,19 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
||||
-- offset longitudinale
|
||||
EgtSetMachiningParam( MCH_MP.OFFSL, EgtIf( bDownUp, -dCutOffset, dCutOffset))
|
||||
-- imposto attacco/uscita
|
||||
if BD.TURN and bLioTang == 1 then EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.TG_PERP) end
|
||||
EgtSetMachiningParam( MCH_MP.LITANG, dLiTang)
|
||||
EgtSetMachiningParam( MCH_MP.LIPERP, dLiPerp)
|
||||
if BD.TURN and bLioTang then EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG) end
|
||||
EgtSetMachiningParam( MCH_MP.LICOMPLEN, dLiCompLength)
|
||||
if BD.TURN and bLioTang == 2 then EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG) end
|
||||
EgtSetMachiningParam( MCH_MP.LOTANG, dLoTang)
|
||||
EgtSetMachiningParam( MCH_MP.LOPERP, dLoPerp)
|
||||
-- imposto allungamenti iniziale e finale
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dAllStart - dAccStart)
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dAllEnd - dAccEnd)
|
||||
-- imposto angolo 3° asse rot
|
||||
local sBlockedAxis = EgtIf( bMaximizeVerticalDepth, 'parallel', 'perpendicular')
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCutting, sBlockedAxis, b3Raw, vtN, vtOrthO))
|
||||
-- eventuali note
|
||||
if sNotes and #sNotes > 0 then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end
|
||||
-- eseguo
|
||||
@@ -362,6 +548,7 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType, bUpdateIng, bDownHead)
|
||||
EgtOutLog( 'FacesBySaw.MakeTwo', 3)
|
||||
-- bUpdateIng : parametro opzionale con default true
|
||||
if bUpdateIng == nil then bUpdateIng = true end
|
||||
-- recupero l'ingombro del grezzo di appartenenza
|
||||
@@ -380,59 +567,6 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- dati delle facce
|
||||
local ptC = {}
|
||||
local vtN = {}
|
||||
ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
|
||||
-- recupero dati su giunzione tra facce
|
||||
local bTouch, ptT1, ptT2, dAngT = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT)
|
||||
if not bTouch then
|
||||
local sErr = 'Error : TwoFacesBySaw faces not touching'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
local ptM = ( ptT1 + ptT2) / 2
|
||||
local vtTg = ptT2 - ptT1 ; vtTg:normalize()
|
||||
local bConvex = ( dAngT > 0)
|
||||
-- verifico non siano orientate troppo verso il basso e molto sbandate (oltre 10 deg)
|
||||
local bFaceOk = {}
|
||||
bFaceOk[1] = ( vtN[1]:getZ() >= BD.NZ_MINB or abs( vtN[1]:getY()) < 0.174)
|
||||
bFaceOk[2] = ( vtN[2]:getZ() >= BD.NZ_MINB or abs( vtN[2]:getY()) < 0.174)
|
||||
if not bDownHead and not bFaceOk[1] and not bFaceOk[2] then
|
||||
local sErr = 'Error : TwoFacesBySaw from bottom impossible'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- calcolo direzione di lavoro
|
||||
local vtRef = {}
|
||||
vtRef[1] = vtN[1] ^ vtTg
|
||||
if vtRef[1] * vtN[2] < 0 then vtRef[1] = - vtRef[1] end
|
||||
vtRef[1]:normalize()
|
||||
if abs( vtTg:getZ()) < 0.708 and abs( vtRef[1]:getZ()) < 0.577 and abs( abs( vtRef[1]:getX()) - abs( vtRef[1]:getY())) < 0.1 then
|
||||
vtRef[1] = ptC[1] - ptM
|
||||
vtRef[1]:normalize()
|
||||
end
|
||||
vtRef[2] = vtN[2] ^ vtTg
|
||||
if vtRef[2] * vtN[1] < 0 then vtRef[2] = - vtRef[2] end
|
||||
vtRef[2]:normalize()
|
||||
if abs( vtTg:getZ()) < 0.708 and abs( vtRef[2]:getZ()) < 0.577 and abs( abs( vtRef[2]:getX()) - abs( vtRef[2]:getY())) < 0.1 then
|
||||
vtRef[2] = ptC[2] - ptM
|
||||
vtRef[2]:normalize()
|
||||
end
|
||||
-- determino quale faccia è più grande
|
||||
local dSqDim1 = ( ptC[1] - ptM):sqlen()
|
||||
local dSqDim2 = ( ptC[2] - ptM):sqlen()
|
||||
local nBigInd = EgtIf( dSqDim1 > dSqDim2 - 1., 1, 2)
|
||||
local nSmaInd = 3 - nBigInd
|
||||
local nUpInd = EgtIf( vtN[1]:getZ() > vtN[2]:getZ() - GEO.EPS_SMALL, 1, 2)
|
||||
local nOtInd = 3 - nUpInd
|
||||
-- metto in relazione la scelta facce con il confronto del versore Z con la scelta in base alla grandezza faccia
|
||||
-- se la faccia più grande è messa secondaria e il suo versore Z non è troppo negativo
|
||||
if nOtInd == nBigInd and (( vtN[nBigInd]:getZ() > -0.5 and vtN[nSmaInd]:getZ() < 0.966) or bDownHead) then
|
||||
nUpInd = nBigInd
|
||||
nOtInd = nSmaInd
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
local sCutting = ML.FindCutting( sCutType, nil, bDownHead)
|
||||
if not sCutting then
|
||||
@@ -452,6 +586,59 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
end
|
||||
-- dati delle facce
|
||||
local ptC = {}
|
||||
local vtN = {}
|
||||
ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
|
||||
-- recupero dati su giunzione tra facce
|
||||
local bTouch, ptT1, ptT2, dAngT = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT)
|
||||
if not bTouch then
|
||||
local sErr = 'Error : TwoFacesBySaw faces not touching'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
local ptM = ( ptT1 + ptT2) / 2
|
||||
local vtTg = ptT2 - ptT1 ; vtTg:normalize()
|
||||
local bConvex = ( dAngT > 0)
|
||||
-- verifico non siano orientate troppo verso il basso e molto sbandate (oltre 10 deg), oppure in testa o in coda e non troppo distanti dal grezzo esterno
|
||||
local bFaceOk = {}
|
||||
bFaceOk[1] = ( vtN[1]:getZ() >= BD.NZ_MINB or abs( vtN[1]:getY()) < 0.174 or ( Proc.AffectedFaces.Left ~= Proc.AffectedFaces.Right and Proc.Face[1].Elevation < dMaxDepth - 10 * GEO.EPS_SMALL))
|
||||
bFaceOk[2] = ( vtN[2]:getZ() >= BD.NZ_MINB or abs( vtN[2]:getY()) < 0.174 or ( Proc.AffectedFaces.Left ~= Proc.AffectedFaces.Right and Proc.Face[2].Elevation < dMaxDepth - 10 * GEO.EPS_SMALL))
|
||||
if not bDownHead and ( not bFaceOk[1] or not bFaceOk[2]) then
|
||||
local sErr = 'Error : TwoFacesBySaw from bottom impossible'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- calcolo direzione di lavoro
|
||||
local vtRef = {}
|
||||
vtRef[1] = vtN[1] ^ vtTg
|
||||
if vtRef[1] * vtN[2] < 0 then vtRef[1] = - vtRef[1] end
|
||||
vtRef[1]:normalize()
|
||||
if abs( vtTg:getZ()) < 0.708 and abs( vtRef[1]:getZ()) < 0.577 and abs( abs( vtRef[1]:getX()) - abs( vtRef[1]:getY())) < 0.05 then
|
||||
vtRef[1] = ptC[1] - ptM
|
||||
vtRef[1]:normalize()
|
||||
end
|
||||
vtRef[2] = vtN[2] ^ vtTg
|
||||
if vtRef[2] * vtN[1] < 0 then vtRef[2] = - vtRef[2] end
|
||||
vtRef[2]:normalize()
|
||||
if abs( vtTg:getZ()) < 0.708 and abs( vtRef[2]:getZ()) < 0.577 and abs( abs( vtRef[2]:getX()) - abs( vtRef[2]:getY())) < 0.05 then
|
||||
vtRef[2] = ptC[2] - ptM
|
||||
vtRef[2]:normalize()
|
||||
end
|
||||
-- determino quale faccia è più grande
|
||||
local dSqDim1 = ( ptC[1] - ptM):sqlen()
|
||||
local dSqDim2 = ( ptC[2] - ptM):sqlen()
|
||||
local nBigInd = EgtIf( dSqDim1 > dSqDim2 - 1., 1, 2)
|
||||
local nSmaInd = 3 - nBigInd
|
||||
local nUpInd = EgtIf( vtN[1]:getZ() > vtN[2]:getZ() - GEO.EPS_SMALL, 1, 2)
|
||||
local nOtInd = 3 - nUpInd
|
||||
-- metto in relazione la scelta facce con il confronto del versore Z con la scelta in base alla grandezza faccia
|
||||
-- se la faccia più grande è messa secondaria e il suo versore Z non è troppo negativo
|
||||
if nOtInd == nBigInd and (( vtN[nBigInd]:getZ() > -0.5 and vtN[nSmaInd]:getZ() < 0.966) or bDownHead) then
|
||||
nUpInd = nBigInd
|
||||
nOtInd = nSmaInd
|
||||
end
|
||||
-- calcolo extra taglio
|
||||
local dCutExtra = 0
|
||||
if dAngT < -91 and dAngT > -179 then
|
||||
@@ -488,12 +675,8 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
|
||||
local vtOrthO = EgtIf( ( i % 2) == 1, vtRef[nOtInd], vtRef[nUpInd])
|
||||
-- lavoro la faccia
|
||||
for j = 1, #vCuts[i] do
|
||||
-- se FAST, pezzo alto e ultimo taglio verticale -> allungo uscita per consentire eventuale rotazione B sul posto
|
||||
local dAccEnd = 0
|
||||
if not BD.C_SIMM and BD.MAX_HEIGHT_ROT_B_ABOVE and b3Raw:getDimZ() > BD.MAX_HEIGHT_ROT_B_ABOVE and vtOrthO:getZ() > 0.866 and j == #vCuts[i] then
|
||||
dAccEnd = - ( dSawDiam / 2 + BD.CUT_SIC)
|
||||
end
|
||||
local bOk, sErr = FacesBySaw.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthO, dNzLimDwnUp, dCutExtra, BD.CUT_SIC, 0, 0, dAccEnd, nil, b3Raw)
|
||||
local bSpecialTangentLeadInOut = ( i % 2 == 0) and ( Proc.AffectedFaces.Left or Proc.AffectedFaces.Right)
|
||||
local bOk, sErr = FacesBySaw.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthO, dNzLimDwnUp, dCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw, nil, nil, bSpecialTangentLeadInOut)
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
@@ -553,14 +736,16 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
|
||||
end
|
||||
-- taglio perpendicolare (limite Vz Down Up messo a -2 per non farlo mai intervenire)
|
||||
if vCuts[i][j] then
|
||||
local bOk, sErr = FacesBySaw.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO_1, -2, dExtraCut_1, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
local bSpecialTangentLeadInOut = ( i % 2 == 0) and ( Proc.AffectedFaces.Left or Proc.AffectedFaces.Right)
|
||||
local bOk, sErr = FacesBySaw.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO_1, -2, dExtraCut_1, BD.CUT_SIC, 0, 0, 0, nil, b3Raw, nil, nil, bSpecialTangentLeadInOut)
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
end
|
||||
-- taglio parallelo (limite Vz Down Up messo a -2 per non farlo mai intervenire)
|
||||
if vCuts[i+1][j] then
|
||||
local bOk, sErr = FacesBySaw.MakeOne( vCuts[i+1][j], 0, sCutting, dSawDiam, vtOrthoO_2, -2, dExtraCut_2, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
local bSpecialTangentLeadInOut = ( ( i + 1) % 2 == 0) and ( Proc.AffectedFaces.Left or Proc.AffectedFaces.Right)
|
||||
local bOk, sErr = FacesBySaw.MakeOne( vCuts[i+1][j], 0, sCutting, dSawDiam, vtOrthoO_2, -2, dExtraCut_2, BD.CUT_SIC, 0, 0, 0, nil, b3Raw, nil, nil, bSpecialTangentLeadInOut)
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
@@ -584,13 +769,44 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
|
||||
end
|
||||
-- eventuale segnalazione ingombro di testa o coda
|
||||
local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ())
|
||||
if bUpdateIng and Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng and
|
||||
not ( abs( vtN[nBigInd]:getX()) < 0.05 and vtN[nBigInd]:getY() < 0 and Proc.Box:getDimX() > 500 and Proc.Box:getDimY() < 40) then
|
||||
local dMinZ = max( BD.MIN_HEIGHT, 0.35 * b3Raw:getDimZ())
|
||||
-- calcolo punto massimo in Z fino a dove considerare il pinzaggio. Minimo tra pinzaggio massimo e altezza pezzo
|
||||
local dMaxHZ = b3Raw:getMin():getZ() + min( BD.VICE_MAXH or BD.MAX_HEIGHT, b3Raw:getDimZ())
|
||||
-- punto massimo in Z considerando anche la Z della feature
|
||||
local dMaxHZFeat = min( dMaxHZ, Proc.Box:getMax():getZ())
|
||||
-- dimensione Z del pinzaggio (differenza massima Z pinzabile e box feature)
|
||||
local dDeltaZClamp = ( ( dMaxHZ - b3Raw:getMin():getZ()) - max( 0, dMaxHZFeat - Proc.Box:getMin():getZ()))
|
||||
-- se pinzaggio minimo è come il massimo (oppure come l'altezza massima del pezzo) significa che è verticale
|
||||
local bIsVertClamps = BD.VICE_MINH > BD.MAX_HEIGHT - 100 * GEO.EPS_SMALL
|
||||
|
||||
-- condizioni per limitare pinzaggio testa/coda
|
||||
-- se dimensione del box della feature maggiore di metà pinzaggio minimo o metà spessore pezzo
|
||||
bUpdateIng = bUpdateIng and Proc.Box:getDimZ() > dMinHIng
|
||||
-- se la feature si trova più in basso del minimo pinzabile in Z o il 35% dello spessore pezzo
|
||||
bUpdateIng = bUpdateIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinZ
|
||||
-- riportata condizione, ma poco chiara
|
||||
bUpdateIng = bUpdateIng and not ( abs( vtN[nBigInd]:getX()) < 0.05 and vtN[nBigInd]:getY() < 0 and Proc.Box:getDimX() > 500 and Proc.Box:getDimY() < 40)
|
||||
-- se feature è al di sotto del pinzaggio massimo
|
||||
bUpdateIng = bUpdateIng and Proc.Box:getMin():getZ() < dMaxHZ
|
||||
-- se ho le morse verticali, o se la feature è in centro o verso alto, controllo se non prendo abbastanza.
|
||||
if bIsVertClamps or ( Proc.Box:getMin():getZ() - b3Raw:getMin():getZ()) > BD.MIN_HEIGHT then
|
||||
bUpdateIng = bUpdateIng and dDeltaZClamp < BD.VICE_MINH
|
||||
end
|
||||
|
||||
if bUpdateIng then
|
||||
if Proc.Head then
|
||||
local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX()
|
||||
-- se pinze a 45° e pinza abbastanza materiale, compenso comunque, ma solo inclinazione morse
|
||||
if not bIsVertClamps and dDeltaZClamp > BD.VICE_MINH and BD.VICE_MAXH then
|
||||
dOffs = min( dOffs, BD.VICE_MAXH - BD.VICE_MINH)
|
||||
end
|
||||
BL.UpdateHCING( nRawId, dOffs)
|
||||
elseif Proc.Tail then
|
||||
local dOffs = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
|
||||
-- se pinze a 45° e pinza abbastanza materiale, compenso comunque, ma solo inclinazione morse
|
||||
if not bIsVertClamps and dDeltaZClamp > BD.VICE_MINH and BD.VICE_MAXH then
|
||||
dOffs = min( dOffs, BD.VICE_MAXH - BD.VICE_MINH)
|
||||
end
|
||||
BL.UpdateTCING( nRawId, dOffs)
|
||||
elseif Proc.Box:getCenter():getX() > b3Solid:getCenter():getX() then
|
||||
local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX()
|
||||
@@ -614,97 +830,49 @@ function FacesBySaw.CalcLeadInOutPerpGeom( ptP1, ptP2, vtV1, vtV2, vtN, dRad, vt
|
||||
-- Sistema di riferimento intrinseco al taglio
|
||||
local vtX = vtTg ^ vtN
|
||||
local frFace = Frame3d( ptP1, vtX, vtTg, vtN)
|
||||
EgtOutLog( 'Vref=' .. tostring( vtRef) .. ' V1=' .. tostring( vtV1) .. ' V2=' .. tostring( vtV2), 3)
|
||||
local bRight = ( vtX * vtRef > 0)
|
||||
EgtOutLog( 'LioPerp --> Vref=' .. tostring( vtRef) .. ' V1=' .. tostring( vtV1) .. ' V2=' .. tostring( vtV2), 3)
|
||||
|
||||
-- Versore di attacco e uscita
|
||||
local dCos1 = vtV1 * vtRef
|
||||
local dCos2 = vtV2 * vtRef
|
||||
local vtLio
|
||||
if abs( dCos1 - dCos2) < 0.001 then
|
||||
if abs( vtV1:getZ()) < abs( vtV2:getZ()) then
|
||||
vtLio = vtV1
|
||||
else
|
||||
vtLio = vtV2
|
||||
end
|
||||
vtLio = EgtIf( abs( vtV1:getZ()) < abs( vtV2:getZ()), vtV1, vtV2)
|
||||
elseif dCos1 > dCos2 then
|
||||
vtLio = vtV1
|
||||
else
|
||||
vtLio = vtV2
|
||||
end
|
||||
local bRight = ( vtX * vtLio > 0)
|
||||
-- Versore di attacco e uscita nel riferimento intrinseco al taglio
|
||||
local vtLioL = Vector3d( vtLio) ; vtLioL:toLoc( frFace)
|
||||
-- Spostamento punti per effetto dell'extra o della deficienza di taglio
|
||||
ptP1 = ptP1 + vtX * ( EgtIf( bRight, - dCutExtra, dCutExtra))
|
||||
ptP2 = ptP2 + vtX * ( EgtIf( bRight, - dCutExtra, dCutExtra))
|
||||
-- Non va considerata l'uscita dalla faccia sotto, pertanto va abbassata
|
||||
-- 2021/02/26 Abilito anche uscita sotto
|
||||
local b3MyBox = BBox3d( b3Box) ; --b3MyBox:Add( b3MyBox:getMin() - 1000 * Z_AX())
|
||||
-- Attacco
|
||||
local dLiTang = 10000
|
||||
local dLiPerp = 10000
|
||||
local bLiOk, _, vLiPar = EgtLineBoxInters( ptP1, vtLio, b3MyBox)
|
||||
if bLiOk and #vLiPar > 0 then
|
||||
-- con la prima faccia di uscita
|
||||
local dLen = vLiPar[#vLiPar]
|
||||
local ptInt = ptP1 + vtLio * dLen
|
||||
local vtFN = BL.GetBoxFaceNorm( b3MyBox, ptInt, vtLio)
|
||||
EgtOutLog( 'LiFaceNorm=' .. tostring( vtFN), 3)
|
||||
local dAddLen = dRad * ( sqrt( 1 - ( vtN * vtFN) * ( vtN * vtFN)) - abs( vtX * vtFN)) / ( vtLio * vtFN)
|
||||
local dLiLen = dLen + dAddLen
|
||||
EgtOutLog( 'LeadIn Dist=' .. EgtNumToString( dLiLen), 3)
|
||||
dLiTang = - dLiLen * vtLioL:getY()
|
||||
dLiPerp = EgtIf( bRight, dLiLen, - dLiLen) * vtLioL:getX()
|
||||
-- verifico se miglioro calcolando con faccia successiva
|
||||
local b3Mod = BBox3d( b3MyBox) ; b3Mod:Add( ptInt + 1000 * vtFN)
|
||||
local bLiOk2, _, vLiPar2 = EgtLineBoxInters( ptP1, vtLio, b3Mod)
|
||||
if bLiOk2 and #vLiPar2 > 0 then
|
||||
local dLen2 = vLiPar2[#vLiPar2]
|
||||
local vtFN2 = BL.GetBoxFaceNorm( b3Mod, ptP1 + vtLio * dLen2, vtLio)
|
||||
EgtOutLog( 'LiFaceNorm2=' .. tostring( vtFN2), 3)
|
||||
local dAddLen2 = dRad * ( sqrt( 1 - ( vtN * vtFN2) * ( vtN * vtFN2)) - abs( vtX * vtFN2)) / ( vtLio * vtFN2)
|
||||
local dLiLen2 = dLen2 + dAddLen2
|
||||
EgtOutLog( 'LeadIn Dist2=' .. EgtNumToString( dLiLen2), 3)
|
||||
local dLiTang2 = - dLiLen2 * vtLioL:getY()
|
||||
local dLiPerp2 = EgtIf( bRight, dLiLen2, - dLiLen2) * vtLioL:getX()
|
||||
if dLiLen2 < dLiLen then
|
||||
dLiTang = dLiTang2
|
||||
dLiPerp = dLiPerp2
|
||||
end
|
||||
end
|
||||
end
|
||||
-- Lunghezza di uscita
|
||||
local dLoTang = 10000
|
||||
local dLoPerp = 10000
|
||||
local bLoOk, _, vLoPar = EgtLineBoxInters( ptP2, vtLio, b3MyBox)
|
||||
if bLoOk and #vLoPar > 0 then
|
||||
-- con la prima faccia di uscita
|
||||
local dLen = vLoPar[#vLoPar]
|
||||
local ptInt = ptP2 + vtLio * dLen
|
||||
local vtFN = BL.GetBoxFaceNorm( b3MyBox, ptInt, vtLio)
|
||||
EgtOutLog( 'LoFaceNorm=' .. tostring( vtFN), 3)
|
||||
local dAddLen = dRad * ( sqrt( 1 - ( vtN * vtFN) * ( vtN * vtFN)) - abs( vtX * vtFN)) / ( vtLio * vtFN)
|
||||
local dLoLen = dLen + dAddLen
|
||||
EgtOutLog( 'LeadOut Dist=' .. EgtNumToString( dLoLen), 3)
|
||||
dLoTang = dLoLen * vtLioL:getY()
|
||||
dLoPerp = EgtIf( bRight, dLoLen, - dLoLen) * vtLioL:getX()
|
||||
-- verifico se miglioro calcolando con faccia successiva
|
||||
local b3Mod = BBox3d( b3MyBox) ; b3Mod:Add( ptInt + 1000 * vtFN)
|
||||
local bLoOk2, _, vLoPar2 = EgtLineBoxInters( ptP2, vtLio, b3Mod)
|
||||
if bLoOk2 and #vLoPar2 > 0 then
|
||||
local dLen2 = vLoPar2[#vLoPar2]
|
||||
local vtFN2 = BL.GetBoxFaceNorm( b3Mod, ptP2 + vtLio * dLen2, vtLio)
|
||||
EgtOutLog( 'LoFaceNorm2=' .. tostring( vtFN2), 3)
|
||||
local dAddLen2 = dRad * ( sqrt( 1 - ( vtN * vtFN2) * ( vtN * vtFN2)) - abs( vtX * vtFN2)) / ( vtLio * vtFN2)
|
||||
local dLoLen2 = dLen2 + dAddLen2
|
||||
EgtOutLog( 'LeadOut Dist2=' .. EgtNumToString( dLoLen2), 3)
|
||||
local dLoTang2 = dLoLen2 * vtLioL:getY()
|
||||
local dLoPerp2 = EgtIf( bRight, dLoLen2, - dLoLen2) * vtLioL:getX()
|
||||
if dLoLen2 < dLoLen then
|
||||
dLoTang = dLoTang2
|
||||
dLoPerp = dLoPerp2
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Centro lama a inizio fine percorso
|
||||
local dOffs = ( -dCutExtra + dRad) * EgtIf( bRight, 1, -1)
|
||||
local ptCen1 = ptP1 + dOffs * vtX
|
||||
local ptCen2 = ptP2 + dOffs * vtX
|
||||
|
||||
-- Box del pezzo espansi ortogonalmente alle tre direzioni canoniche X, Y e Z
|
||||
local b3BoxX = BBox3d( b3Box) ; b3BoxX:expand( 0, 1000, 1000)
|
||||
local b3BoxY = BBox3d( b3Box) ; b3BoxY:expand( 1000, 0, 1000)
|
||||
local b3BoxZ = BBox3d( b3Box) ; b3BoxZ:expand( 1000, 1000, 0)
|
||||
|
||||
-- Calcolo elevazione dei due centri
|
||||
local dSawThick = 6
|
||||
EgtCAvSetSawTool( dSawThick, 2 * dRad, dSawThick, 0, 0)
|
||||
local dElev1 = min( EgtCAvToolPosBox( ptCen1 + dSawThick * vtN, vtN, b3BoxX, vtLio),
|
||||
EgtCAvToolPosBox( ptCen1 + dSawThick * vtN, vtN, b3BoxY, vtLio),
|
||||
EgtCAvToolPosBox( ptCen1 + dSawThick * vtN, vtN, b3BoxZ, vtLio))
|
||||
EgtOutLog( 'Elev1=' .. EgtNumToString( dElev1), 3)
|
||||
local dLiTang = -dElev1 * vtLioL:getY()
|
||||
local dLiPerp = EgtIf( bRight, dElev1, -dElev1) * vtLioL:getX()
|
||||
local dElev2 = min( EgtCAvToolPosBox( ptCen2 + dSawThick * vtN, vtN, b3BoxX, vtLio),
|
||||
EgtCAvToolPosBox( ptCen2 + dSawThick * vtN, vtN, b3BoxY, vtLio),
|
||||
EgtCAvToolPosBox( ptCen2 + dSawThick * vtN, vtN, b3BoxZ, vtLio))
|
||||
EgtOutLog( 'Elev2=' .. EgtNumToString( dElev2), 3)
|
||||
local dLoTang = dElev2 * vtLioL:getY()
|
||||
local dLoPerp = EgtIf( bRight, dElev2, -dElev2) * vtLioL:getX()
|
||||
|
||||
return dLiTang, dLiPerp, dLoTang, dLoPerp, vtLio
|
||||
end
|
||||
|
||||
@@ -716,72 +884,35 @@ function FacesBySaw.CalcLeadInOutTangGeom( ptP1, ptP2, vtN, dRad, vtRef, dCutExt
|
||||
-- Sistema di riferimento intrinseco al taglio
|
||||
local vtX = vtTg ^ vtN
|
||||
local frFace = Frame3d( ptP1, vtX, vtTg, vtN)
|
||||
if ( vtX * vtRef < 0) then
|
||||
vtX = - vtX
|
||||
end
|
||||
EgtOutLog( 'Vref=' .. tostring( vtRef) .. ' V1=' .. tostring( vtV1) .. ' V2=' .. tostring( vtV2), 3)
|
||||
-- Spostamento punti per effetto dell'extra o della deficienza di taglio
|
||||
ptP1 = ptP1 - vtX * dCutExtra
|
||||
ptP2 = ptP2 - vtX * dCutExtra
|
||||
-- Non va considerata l'uscita dalla faccia sotto, pertanto va abbassata
|
||||
-- 2021/02/26 Abilito anche uscita sotto
|
||||
local b3MyBox = BBox3d( b3Box) ; --b3MyBox:Add( b3MyBox:getMin() - 1000 * Z_AX())
|
||||
-- Attacco
|
||||
local dLiTang = 10000
|
||||
local bRight = ( vtX * vtRef > 0)
|
||||
EgtOutLog( 'LioTang --> Vref=' .. tostring( vtRef), 3)
|
||||
|
||||
-- Centro lama a inizio fine percorso
|
||||
local dOffs = ( -dCutExtra + dRad) * EgtIf( bRight, 1, -1)
|
||||
local ptCen1 = ptP1 + dOffs * vtX
|
||||
local ptCen2 = ptP2 + dOffs * vtX
|
||||
|
||||
-- Box del pezzo espansi ortogonalmente alle tre direzioni canoniche X, Y e Z
|
||||
local b3BoxX = BBox3d( b3Box) ; b3BoxX:expand( 0, 1000, 1000)
|
||||
local b3BoxY = BBox3d( b3Box) ; b3BoxY:expand( 1000, 0, 1000)
|
||||
local b3BoxZ = BBox3d( b3Box) ; b3BoxZ:expand( 1000, 1000, 0)
|
||||
|
||||
-- Calcolo elevazione dei due centri
|
||||
local dSawThick = 6
|
||||
EgtCAvSetSawTool( dSawThick, 2 * dRad, dSawThick, 0, 0)
|
||||
local dElev1 = min( EgtCAvToolPosBox( ptCen1 + dSawThick * vtN, vtN, b3BoxX, -vtTg),
|
||||
EgtCAvToolPosBox( ptCen1 + dSawThick * vtN, vtN, b3BoxY, -vtTg),
|
||||
EgtCAvToolPosBox( ptCen1 + dSawThick * vtN, vtN, b3BoxZ, -vtTg))
|
||||
EgtOutLog( 'Elev1=' .. EgtNumToString( dElev1), 3)
|
||||
local dLiTang = dElev1
|
||||
local dLiPerp = 0
|
||||
local bLiOk, _, vLiPar = EgtLineBoxInters( ptP1, vtTg, b3MyBox)
|
||||
if bLiOk and #vLiPar > 0 then
|
||||
local dLen = vLiPar[1]
|
||||
local ptInt = ptP1 + vtTg * dLen
|
||||
local vtFN = BL.GetBoxFaceNorm( b3MyBox, ptInt, -vtTg)
|
||||
EgtOutLog( 'LiFaceNorm=' .. tostring( vtFN), 3)
|
||||
local dAddLen = dRad * ( sqrt( 1 - ( vtN * vtFN) * ( vtN * vtFN)) - ( vtX * vtFN)) / ( vtTg * vtFN)
|
||||
local dLiLen = dLen + dAddLen
|
||||
EgtOutLog( 'LeadIn Dist=' .. EgtNumToString( dLiLen), 3)
|
||||
dLiTang = - dLiLen
|
||||
-- verifico se miglioro calcolando con faccia successiva
|
||||
local b3Mod = BBox3d( b3MyBox) ; b3Mod:Add( ptInt + 1000 * vtFN)
|
||||
local bLiOk2, _, vLiPar2 = EgtLineBoxInters( ptP1, vtTg, b3Mod)
|
||||
if bLiOk2 and #vLiPar2 > 0 then
|
||||
local dLen2 = vLiPar2[1]
|
||||
local vtFN2 = BL.GetBoxFaceNorm( b3Mod, ptP1 + vtTg * dLen2, -vtTg)
|
||||
EgtOutLog( 'LiFaceNorm2=' .. tostring( vtFN2), 3)
|
||||
local dAddLen2 = dRad * ( sqrt( 1 - ( vtN * vtFN2) * ( vtN * vtFN2)) - ( vtX * vtFN2)) / ( vtTg * vtFN2)
|
||||
local dLiLen2 = dLen2 + dAddLen2
|
||||
EgtOutLog( 'LeadIn Dist2=' .. EgtNumToString( dLiLen2), 3)
|
||||
if -dLiLen2 < -dLiLen then
|
||||
dLiTang = - dLiLen2
|
||||
end
|
||||
end
|
||||
end
|
||||
-- Lunghezza di uscita
|
||||
local dLoTang = 10000
|
||||
local dElev2 = min( EgtCAvToolPosBox( ptCen2 + dSawThick * vtN, vtN, b3BoxX, vtTg),
|
||||
EgtCAvToolPosBox( ptCen2 + dSawThick * vtN, vtN, b3BoxY, vtTg),
|
||||
EgtCAvToolPosBox( ptCen2 + dSawThick * vtN, vtN, b3BoxZ, vtTg))
|
||||
EgtOutLog( 'Elev2=' .. EgtNumToString( dElev2), 3)
|
||||
local dLoTang = dElev2
|
||||
local dLoPerp = 0
|
||||
local bLoOk, _, vLoPar = EgtLineBoxInters( ptP2, vtTg, b3MyBox)
|
||||
if bLoOk and #vLoPar > 0 then
|
||||
local dLen = vLoPar[#vLoPar]
|
||||
local ptInt = ptP2 + vtTg * dLen
|
||||
local vtFN = BL.GetBoxFaceNorm( b3MyBox, ptInt, vtTg)
|
||||
EgtOutLog( 'LoFaceNorm=' .. tostring( vtFN), 3)
|
||||
local dAddLen = dRad * ( sqrt( 1 - ( vtN * vtFN) * ( vtN * vtFN)) - ( vtX * vtFN)) / ( vtTg * vtFN)
|
||||
local dLoLen = dLen + dAddLen
|
||||
EgtOutLog( 'LeadOut Dist=' .. EgtNumToString( dLoLen), 3)
|
||||
dLoTang = dLoLen
|
||||
-- verifico se miglioro calcolando con faccia successiva
|
||||
local b3Mod = BBox3d( b3MyBox) ; b3Mod:Add( ptInt + 1000 * vtFN)
|
||||
local bLoOk2, _, vLoPar2 = EgtLineBoxInters( ptP2, vtTg, b3Mod)
|
||||
if bLoOk2 and #vLoPar2 > 0 then
|
||||
local dLen2 = vLoPar2[#vLoPar2]
|
||||
local vtFN2 = BL.GetBoxFaceNorm( b3Mod, ptP2 + vtTg * dLen2, vtTg)
|
||||
EgtOutLog( 'LoFaceNorm2=' .. tostring( vtFN2), 3)
|
||||
local dAddLen2 = dRad * ( sqrt( 1 - ( vtN * vtFN2) * ( vtN * vtFN2)) - ( vtX * vtFN2)) / ( vtTg * vtFN2)
|
||||
local dLoLen2 = dLen2 + dAddLen2
|
||||
EgtOutLog( 'LeadOut Dist2=' .. EgtNumToString( dLoLen2), 3)
|
||||
if dLoLen2 < dLoLen then
|
||||
dLoTang = dLoLen2
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return dLiTang, dLiPerp, dLoTang, dLoPerp
|
||||
end
|
||||
|
||||
|
||||
+65
-63
@@ -2,6 +2,11 @@
|
||||
-- Libreria per classificazione topologica feature travi
|
||||
-- 2023/09/26 Aggiunte topologie Strip e Cut.
|
||||
-- 2023/09/27 Modificata GetFacesParallelToPart per tunnel, pocket e groove 3 lati
|
||||
-- 2023/10/16 In GetFacesParallelToPart rimossa Pocket e aggiunto Rabbet al check solo direzione principale
|
||||
-- 2023/11/03 In Classify ora si settano le AffectedFaces nella Proc, se non già presenti.
|
||||
-- Aggiunta groove 2 facce, differenziata da rabbet.
|
||||
-- 2024/03/04 Feature senza topologia, calcolato in BeamExec
|
||||
-- 2024/05/06 A topologia Cut aggiunta IsThrough = true
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local FeatureTopology = {}
|
||||
@@ -14,34 +19,15 @@ local BL = require( 'BeamLib')
|
||||
|
||||
EgtOutLog( ' FeatureTopology 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 FeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, nAdj)
|
||||
local vAdj = GetAdjacencyMatrix( Proc)
|
||||
function FeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, vAdj, nAdj)
|
||||
if not vAdj then vAdj = BL.GetAdjacencyMatrix( Proc) end
|
||||
local nFct = #( vAdj or {})
|
||||
local vFacesWithGivenAdj = {}
|
||||
for i = 1, Proc.Fct do
|
||||
for i = 1, nFct do
|
||||
local nAdjCount = 0
|
||||
for j = 1, Proc.Fct do
|
||||
for j = 1, nFct do
|
||||
if vAdj[i][j] and vAdj[i][j] ~= 0 then
|
||||
nAdjCount = nAdjCount + 1
|
||||
end
|
||||
@@ -55,11 +41,11 @@ 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 function AreAllAnglesConcaveOrRight( vAdj)
|
||||
local bAllConcave, bAllRight = true, true
|
||||
for i = 1, Proc.Fct do
|
||||
for j = 1, Proc.Fct do
|
||||
local nFct = #( vAdj or {})
|
||||
for i = 1, nFct do
|
||||
for j = 1, nFct do
|
||||
-- se trovo un angolo convesso restituisco falso e esco subito
|
||||
if vAdj[i][j] and vAdj[i][j] > 0 then
|
||||
bAllConcave = false
|
||||
@@ -71,7 +57,7 @@ local function AreAllAnglesConcaveOrRight( Proc)
|
||||
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
|
||||
if nFct < 2 or ( nFct == 2 and vAdj[1][2] > 0) then
|
||||
return bAllConcave
|
||||
else
|
||||
return bAllConcave, bAllRight
|
||||
@@ -110,7 +96,7 @@ local function GetFacesParallelToPart( Proc, sFamily)
|
||||
local vFacesParallelToPart = {}
|
||||
for i = 0, Proc.Fct - 1 do
|
||||
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i, GDB_ID.ROOT)
|
||||
if sFamily == 'Bevel' or sFamily == 'DoubleBevel' or sFamily == 'Strip' or sFamily == 'Tunnel' or sFamily == 'Pocket' or ( sFamily == 'Groove' and Proc.IsThrough == true) then
|
||||
if sFamily == 'Rabbet' or sFamily == 'Bevel' or sFamily == 'DoubleBevel' or sFamily == 'Strip' then
|
||||
local vTriangularFaces = GetTriangularFaces( Proc)
|
||||
local bIsTriangularFace = false
|
||||
-- verifico se la faccia è triangolare
|
||||
@@ -161,42 +147,56 @@ end
|
||||
---------------------------------------------------------------------
|
||||
-- riconosce se Proc è una delle topologie standard e, in caso positivo, ne scrive le caratteristiche in campi specifici della Proc stessa restituendo true
|
||||
function FeatureTopology.Classify( Proc, b3Raw)
|
||||
local bRecognized = false
|
||||
local sFamily
|
||||
local bIsThrough
|
||||
local bAllRightAngles
|
||||
local bIsParallel
|
||||
local sLongName = ''
|
||||
|
||||
-- SE NON HA TUTTE LE FACCE PIANE RITORNARE NIL!!
|
||||
-- la feature deve avere geometria
|
||||
if not Proc.Box or Proc.Box:isEmpty() then
|
||||
return false
|
||||
end
|
||||
|
||||
local bAllAnglesConcave
|
||||
bAllAnglesConcave, bAllRightAngles = AreAllAnglesConcaveOrRight( Proc)
|
||||
-- se già calcolato, esco
|
||||
if Proc.Topology then
|
||||
return true
|
||||
end
|
||||
|
||||
-- calcoli
|
||||
if not Proc.AffectedFaces then
|
||||
Proc.AffectedFaces = BL.GetProcessAffectedFaces( Proc)
|
||||
end
|
||||
if not Proc.Face then
|
||||
Proc.Face = BL.GetFacetsInfo( Proc, b3Raw)
|
||||
end
|
||||
|
||||
local vAdj = Proc.AdjacencyMatrix or BL.GetAdjacencyMatrix( Proc)
|
||||
local bAllAnglesConcave, bAllRightAngles = AreAllAnglesConcaveOrRight( vAdj)
|
||||
local vTriangularFaces = GetTriangularFaces( Proc)
|
||||
local bIsAnyDimensionLongAsPart = IsAnyDimensionLongAsPart( Proc)
|
||||
local vFacesWithOneAdj = FeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, 1)
|
||||
local vFacesWithTwoAdj = FeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, 2)
|
||||
local vFacesWithThreeAdj = FeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, 3)
|
||||
local vFacesWithFourAdj = FeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, 4)
|
||||
local dRawW, dRawH = b3Raw:getDimY(), b3Raw:getDimZ()
|
||||
local vFacesWithOneAdj = FeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, vAdj, 1)
|
||||
local vFacesWithTwoAdj = FeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, vAdj, 2)
|
||||
local vFacesWithThreeAdj = FeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, vAdj, 3)
|
||||
local vFacesWithFourAdj = FeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, vAdj, 4)
|
||||
local dRawW = b3Raw:getDimY()
|
||||
local dRawH = b3Raw:getDimZ()
|
||||
local bIsFeatureCuttingEntireSection = BL.IsFeatureCuttingEntireSection( Proc.Box, dRawW, dRawH)
|
||||
|
||||
if Proc.IsOutline then
|
||||
sFamily = 'OUTLINE'
|
||||
elseif Proc.Prc == 40 then
|
||||
sFamily = 'DRILLING'
|
||||
bIsThrough = true
|
||||
elseif Proc.Fct == 1 and bIsAnyDimensionLongAsPart and bIsFeatureCuttingEntireSection then
|
||||
-- assegnazione tipologia
|
||||
local sFamily
|
||||
local bIsThrough
|
||||
if Proc.Fct == 1 and bIsAnyDimensionLongAsPart and bIsFeatureCuttingEntireSection then
|
||||
sFamily = 'Cut'
|
||||
bIsThrough = true
|
||||
elseif Proc.Fct == 1 and bIsAnyDimensionLongAsPart then
|
||||
sFamily = 'Bevel'
|
||||
bIsThrough = true
|
||||
elseif Proc.Fct == 2 and bAllAnglesConcave and #vTriangularFaces == 1 then
|
||||
sFamily = 'Bevel'
|
||||
bIsThrough = false
|
||||
elseif Proc.Fct == 2 and bAllAnglesConcave then
|
||||
elseif Proc.Fct == 2 and bAllAnglesConcave and ( Proc.AffectedFaces.Left or Proc.AffectedFaces.Right) and ( Proc.AffectedFaces.Front or Proc.AffectedFaces.Back) then
|
||||
sFamily = 'Rabbet'
|
||||
bIsThrough = true
|
||||
-- birdsmouth
|
||||
elseif Proc.Fct == 2 and bAllAnglesConcave then
|
||||
sFamily = 'Groove'
|
||||
bIsThrough = true
|
||||
elseif Proc.Fct == 2 and not bAllAnglesConcave and bIsAnyDimensionLongAsPart then
|
||||
sFamily = 'DoubleBevel'
|
||||
bIsThrough = true
|
||||
@@ -222,23 +222,25 @@ function FeatureTopology.Classify( Proc, b3Raw)
|
||||
sFamily = 'Pocket'
|
||||
bIsThrough = false
|
||||
end
|
||||
local vFacesParallelToPart = GetFacesParallelToPart( Proc, sFamily)
|
||||
bIsParallel = ( #vFacesParallelToPart == Proc.Fct)
|
||||
|
||||
if sFamily == 'OUTLINE' or sFamily == 'DRILLING' then
|
||||
-- verifico se facce parallele a quelle della trave
|
||||
local vFacesParallelToPart = GetFacesParallelToPart( Proc, sFamily)
|
||||
local bIsParallel = ( #vFacesParallelToPart == Proc.Fct)
|
||||
|
||||
-- assegnazioni
|
||||
if sFamily then
|
||||
Proc.Topology = sFamily
|
||||
Proc.TopologyLongName = 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
|
||||
Proc.TopologyLongName = GetTopologyLongName( sFamily, bIsThrough, bAllRightAngles, bIsParallel, Proc.Fct)
|
||||
Proc.IsThrough = bIsThrough
|
||||
Proc.AllRightAngles = bAllRightAngles
|
||||
Proc.IsParallel = bIsParallel
|
||||
Proc.vAdj = vAdj
|
||||
return true
|
||||
else
|
||||
Proc.Topology = 'OTHER'
|
||||
Proc.TopologyLongName = 'OTHER'
|
||||
Proc.TopologyLongName = Proc.Topology
|
||||
return false
|
||||
end
|
||||
|
||||
return bRecognized
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
+214
-131
@@ -1,4 +1,4 @@
|
||||
-- MachiningLib.lua by Egaltech s.r.l. 2022/05/07
|
||||
-- MachiningLib.lua by Egaltech s.r.l. 2023/11/06
|
||||
-- Libreria ricerca lavorazioni per Travi
|
||||
-- 2022/05/07 ES Profonde modifiche per scelta ottimale lavorazioni in macchine con più teste.
|
||||
-- 2022/07/27 Aggiunta la gestione del tipo di foratura "AngleDrill" per fori molto inclinati
|
||||
@@ -7,6 +7,13 @@
|
||||
-- 2022/12/28 Per FindMilling e FindDrilling possibilità di escludere la testa H2 dalla ricerca utensile.
|
||||
-- 2023/01/31 Per FindPocketing implementata la possibilità di escludere le teste H2 o H3 dalla ricerca utensile.
|
||||
-- 2023/07/28 Aggiunta gestione del tipo di foratura "Drill_AT".
|
||||
-- 2023/11/06 Migliorie e correzioni alle forature con AngularTransmission ("_AT").
|
||||
-- 2024/01/18 In FindSawing aggiunto il parametro opzionale dDepth.
|
||||
-- 2024/01/19 In FindSawing aggiunto parametro opzionale bConsiderCSimmEncumberance per considerare l'ingombro dell'asse C nel massimo materiale (default false).
|
||||
-- 2024/01/23 Nella GetMachinings vengono ora raccolti i parametri utensile necessari per i VerifyTool, scritti direttamente nella tabella Machining.Tool.
|
||||
-- Le lavorazioni possono essere ora ordinate per dimensioni utensile (Longest, Shortest, Biggest, Smallest) se passato l'apposito parametro SortingCriterion in FindMachining. Al momento implementato solo per FindSawing.
|
||||
-- 2024/03/01 In VerifyPocketing implementato l'ordinamento per dimensioni utensile.
|
||||
-- 2024/03/13 Aggiunta gestione Predrill
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local MachiningLib = {}
|
||||
@@ -67,154 +74,230 @@ local function SetCurrMachineHeadType()
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- funzione che conferma e rende attivi testa e utensile ipotizzati
|
||||
-- setta ultimi testa e utensile utilizzati se compatibili con ottimizzazione testa
|
||||
local function ConfirmNextMachining()
|
||||
-- se non definita testa successiva, esco
|
||||
if not nNextMachHead or nNextMachHead < 1 or nNextMachHead > 2 then return end
|
||||
-- altrimenti, la confermo come attiva
|
||||
nActiveHead = nNextMachHead
|
||||
if nNextMachHead == 1 then
|
||||
H1_TOOL = H1_NEXT_TOOL
|
||||
elseif nNextMachHead == 2 then
|
||||
H2_TOOL = H2_NEXT_TOOL
|
||||
-- utensile corrente
|
||||
local sToolUuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
local sToolName = EgtTdbGetToolFromUUID( sToolUuid or '')
|
||||
EgtTdbSetCurrTool( sToolName or '')
|
||||
-- testa dell'utensile corrente
|
||||
local sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
|
||||
local nHead = tonumber( sHead:sub( 2, #sHead)) + 0
|
||||
|
||||
if ( nHead < 10 and nHead >= 30) or vFixedHeads[nHead] then
|
||||
-- testa che non richiede ottimizzazione
|
||||
return
|
||||
elseif nHead >= 20 then
|
||||
nHead = 2
|
||||
elseif nHead >= 10 then
|
||||
nHead = 1
|
||||
end
|
||||
|
||||
-- se la testa richiede ottimizzazione, confermo testa attiva
|
||||
nActiveHead = nHead
|
||||
if nActiveHead == 1 then
|
||||
H1_TOOL = sToolName
|
||||
elseif nActiveHead == 2 then
|
||||
H2_TOOL = sToolName
|
||||
end
|
||||
-- reset prossima testa
|
||||
nNextMachHead = 0
|
||||
H1_NEXT_TOOL = ''
|
||||
H2_NEXT_TOOL = ''
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- funzione che traccia testa e utensile ipotizzati
|
||||
local function SetNextMachining( sToolName, nHead, bFixed)
|
||||
if nHead < 1 or nHead > 2 then return end
|
||||
if bFixed then
|
||||
nNextMachHead = 0
|
||||
H1_NEXT_TOOL = ''
|
||||
H2_NEXT_TOOL = ''
|
||||
end
|
||||
nNextMachHead = nHead
|
||||
if nHead == 1 then
|
||||
H1_NEXT_TOOL = sToolName
|
||||
elseif nHead == 2 then
|
||||
H2_NEXT_TOOL = sToolName
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function SetCurrMachiningAndTool( sMachName)
|
||||
if not EgtMdbSetCurrMachining( sMachName) then return false end
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
local sTool = EgtTdbGetToolFromUUID( sTuuid)
|
||||
if not sTool then return false end
|
||||
if not EgtTdbSetCurrTool( sTool) then return false end
|
||||
local bActive = EgtTdbGetCurrToolParam( MCH_TP.ACTIVE)
|
||||
local function SetCurrMachiningAndTool( Machining)
|
||||
EgtMdbSetCurrMachining( Machining.Name)
|
||||
EgtTdbSetCurrTool( Machining.Tool.Name)
|
||||
local bActive = EgtFindToolInCurrSetup( Machining.Tool.Name)
|
||||
local sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
|
||||
local nHead = tonumber( sHead:sub( 2, #sHead))
|
||||
local bH2 = ( nHead >= 21 and nHead <= 29)
|
||||
local bH3 = ( nHead >= 31 and nHead <= 39)
|
||||
local bH3 = ( nHead >= 31 and nHead <= 39)
|
||||
local bFixed = ( vFixedHeads[nHead])
|
||||
return bActive, sTool, bH2, bFixed, bH3
|
||||
return bActive, Machining.Tool.Name, bH2, bFixed, bH3
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function VerifyDrill( dDiam, dDepth, bH2)
|
||||
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
|
||||
local dTMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
|
||||
local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
|
||||
local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
|
||||
local dDiamTh = EgtTdbGetCurrToolThDiam()
|
||||
local dLenTh = 72
|
||||
if EgtTdbGetCurrToolThLength then dLenTh = EgtTdbGetCurrToolThLength() end
|
||||
local dFreeLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) - dLenTh - EgtMdbGetGeneralParam( MCH_GP.MAXDEPTHSAFE)
|
||||
if dTDiam < dDiam + 10 * GEO.EPS_SMALL and
|
||||
dTDiam > dDiam - BD.DRILL_TOL - 10 * GEO.EPS_SMALL and
|
||||
( not dDepth or dTMaxMat > dDepth - GEO.EPS_SMALL) then
|
||||
return true, { TMaxMat = dTMaxMat, MaxToolLength = dMaxToolLength, ToolDiam = dToolDiam, DiamTh = dDiamTh, FreeLen = dFreeLen, H2 = bH2}
|
||||
function VerifyDrill( Machining, dDiam, dDepth, bH2)
|
||||
local dFreeLen = Machining.Tool.Length - Machining.Tool.ToolHolderLength - EgtMdbGetGeneralParam( MCH_GP.MAXDEPTHSAFE)
|
||||
if Machining.Tool.Diameter < dDiam + 10 * GEO.EPS_SMALL and
|
||||
Machining.Tool.Diameter > dDiam - BD.DRILL_TOL - 10 * GEO.EPS_SMALL and
|
||||
( not dDepth or Machining.Tool.MaxMat > dDepth - GEO.EPS_SMALL) then
|
||||
return true, { TMaxMat = Machining.Tool.MaxMat, MaxToolLength = Machining.Tool.TotalLength, ToolDiam = Machining.Tool.Diameter, DiamTh = Machining.Tool.ToolHolderDiameter, FreeLen = dFreeLen, H2 = bH2}
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function VerifyDrillPocket( dDiam, dDepth, bH2)
|
||||
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
|
||||
local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
|
||||
local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
|
||||
local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
|
||||
local dDiamTh = EgtTdbGetCurrToolThDiam()
|
||||
local dFreeLen = dTMaxDepth
|
||||
if dTDiam < dDiam - 10 * GEO.EPS_SMALL and
|
||||
( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) then
|
||||
return true, { TMaxDepth = dTMaxDepth, MaxToolLength = dMaxToolLength, ToolDiam = dToolDiam, DiamTh = dDiamTh, FreeLen = dFreeLen, H2 = bH2}
|
||||
function VerifyDrillPocket( Machining, dDiam, dDepth, bH2)
|
||||
if Machining.Tool.Diameter < dDiam - 10 * GEO.EPS_SMALL and
|
||||
( not dDepth or Machining.Tool.MaxMat > dDepth - GEO.EPS_SMALL) then
|
||||
return true, { TMaxDepth = Machining.Tool.MaxMat, MaxToolLength = Machining.Tool.TotalLength, ToolDiam = Machining.Tool.Diameter, DiamTh = Machining.Tool.ToolHolderDiameter, FreeLen = Machining.Tool.MaxMat, H2 = bH2}
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function VerifyMill( dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bH2)
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
|
||||
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
|
||||
local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
|
||||
if ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and
|
||||
( not sTuuidMstr or sTuuidMstr == sTuuid) and
|
||||
( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and
|
||||
( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) then
|
||||
return true, { TMaxDepth = dTMaxDepth, TDiam = dTDiam, H2 = bH2}
|
||||
function VerifyMill( Machining, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bH2)
|
||||
if ( not dDepth or Machining.Tool.MaxMat > dDepth - GEO.EPS_SMALL) and
|
||||
( not sTuuidMstr or sTuuidMstr == Machining.Tool.UUID) and
|
||||
( not dMaxDiam or Machining.Tool.Diameter < dMaxDiam + GEO.EPS_SMALL) and
|
||||
( not dMaxTotLen or Machining.Tool.TotalLength < dMaxTotLen + GEO.EPS_SMALL) then
|
||||
return true, { TMaxDepth = Machining.Tool.MaxMat, TDiam = Machining.Tool.Diameter, H2 = bH2}
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function VerifyPocket( dMaxDiam, dDepth, dMaxTotLen, bH2)
|
||||
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
|
||||
local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
|
||||
local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
|
||||
if ( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and
|
||||
( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and
|
||||
( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) then
|
||||
return true, { TDiam = dTDiam, TMaxDepth = dTMaxDepth, H2 = bH2}
|
||||
function VerifyPocket( Machining, dMaxDiam, dDepth, dMaxTotLen, bH2)
|
||||
if ( not dMaxDiam or Machining.Tool.Diameter < dMaxDiam + GEO.EPS_SMALL) and
|
||||
( not dDepth or Machining.Tool.MaxMat > dDepth - GEO.EPS_SMALL) and
|
||||
( not dMaxTotLen or Machining.Tool.TotalLength < dMaxTotLen + GEO.EPS_SMALL) then
|
||||
return true, { TDiam = Machining.Tool.Diameter, TMaxDepth = Machining.Tool.MaxMat, H2 = bH2}
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function VerifyTool( MachiningType, sType, Params, bH2)
|
||||
function VerifyChainSaw( Machining, dDepth, CSimmEncumberance, bH2)
|
||||
-- riduco il massimo materiale dell'ingombro asse C. Se non richiesto, arriverà un valore di CSimmEncumberance nullo
|
||||
Machining.Tool.MaxMat = min( Machining.Tool.MaxMat, Machining.Tool.TotalLength - CSimmEncumberance)
|
||||
if not dDepth or Machining.Tool.MaxMat > dDepth - GEO.EPS_SMALL then
|
||||
return true, { H2 = bH2}
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function VerifyTool( Machining, MachiningType, Params, bH2)
|
||||
if MachiningType == MCH_MY.DRILLING then
|
||||
if EgtStartsWith( sType, 'Drill') or EgtStartsWith( sType, 'Drill_AT') or EgtStartsWith( sType, 'AngleDrill') then
|
||||
return VerifyDrill( Params.Diam, Params.Depth, bH2)
|
||||
elseif EgtStartsWith( sType, 'Pocket') then
|
||||
return VerifyDrillPocket( Params.Diam, Params.Depth, bH2)
|
||||
if Machining.SubType == 'Drill' or Machining.SubType == 'AngleDrill' or Machining.SubType == 'Predrill' then
|
||||
return VerifyDrill( Machining, Params.Diam, Params.Depth, bH2)
|
||||
elseif Machining.SubType == 'DrillPocket' then
|
||||
return VerifyDrillPocket( Machining, Params.Diam, Params.Depth, bH2)
|
||||
end
|
||||
elseif MachiningType == MCH_MY.SAWING then
|
||||
return true, { H2 = bH2}
|
||||
elseif MachiningType == MCH_MY.MILLING then
|
||||
return VerifyMill( Params.Depth, Params.TuuidMstr, Params.MaxDiam, Params.MaxTotLen, bH2)
|
||||
return VerifyMill( Machining, Params.Depth, Params.TuuidMstr, Params.MaxDiam, Params.MaxTotLen, bH2)
|
||||
elseif MachiningType == MCH_MY.POCKETING then
|
||||
return VerifyPocket( Params.MaxDiam, Params.Depth, Params.MaxTotLen, bH2)
|
||||
return VerifyPocket( Machining, Params.MaxDiam, Params.Depth, Params.MaxTotLen, bH2)
|
||||
elseif MachiningType == MCH_MY.MORTISING then
|
||||
return true, { H2 = bH2}
|
||||
return VerifyChainSaw( Machining, Params.Depth, Params.CSimmEncumberance, bH2)
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function GetMachinings( MachiningType)
|
||||
function GetMachinings( MachiningType, sType)
|
||||
local Machinings
|
||||
-- leggo le lavorazioni disponibili
|
||||
if MachiningType == MCH_MY.DRILLING then
|
||||
return Drillings
|
||||
Machinings = Drillings
|
||||
elseif MachiningType == MCH_MY.SAWING then
|
||||
return Cuttings
|
||||
Machinings = Cuttings
|
||||
elseif MachiningType == MCH_MY.MILLING then
|
||||
return Millings
|
||||
Machinings = Millings
|
||||
elseif MachiningType == MCH_MY.POCKETING then
|
||||
return Pocketings
|
||||
Machinings = Pocketings
|
||||
elseif MachiningType == MCH_MY.MORTISING then
|
||||
return Sawings
|
||||
Machinings = Sawings
|
||||
end
|
||||
-- scrivo i parametri utensile nella lavorazione
|
||||
local validMachinings = {}
|
||||
for i = 1, #Machinings do
|
||||
local Machining = Machinings[i]
|
||||
if EgtMdbSetCurrMachining( Machining.Name) then
|
||||
Machining.Tool = {}
|
||||
Machining.Tool.UUID = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
Machining.Tool.Name = EgtTdbGetToolFromUUID( Machining.Tool.UUID)
|
||||
if Machining.Tool.Name then
|
||||
if EgtTdbSetCurrTool( Machining.Tool.Name) then
|
||||
table.insert( validMachinings, Machining)
|
||||
if ( MachiningType == MCH_MY.MILLING) or ( MachiningType == MCH_MY.POCKETING) or ( MachiningType == MCH_MY.DRILLING and EgtStartsWith( sType, 'Pocket')) then
|
||||
Machining.Tool.MaxMat = EgtTdbGetCurrToolMaxDepth()
|
||||
else
|
||||
Machining.Tool.MaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
|
||||
end
|
||||
if MachiningType == MCH_MY.DRILLING then
|
||||
if EgtStartsWith( Machining.Type, 'Drill') then
|
||||
Machining.SubType = 'Drill'
|
||||
elseif EgtStartsWith( Machining.Type, 'AngleDrill') then
|
||||
Machining.SubType = 'AngleDrill'
|
||||
elseif EgtStartsWith( Machining.Type, 'Pocket') then
|
||||
Machining.SubType = 'DrillPocket'
|
||||
elseif EgtStartsWith( Machining.Type, 'Predrill') then
|
||||
Machining.SubType = 'Predrill'
|
||||
end
|
||||
end
|
||||
Machining.Tool.Diameter = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
|
||||
Machining.Tool.Length = EgtTdbGetCurrToolParam( MCH_TP.LEN)
|
||||
Machining.Tool.TotalLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
|
||||
Machining.Tool.ToolHolderDiameter = EgtTdbGetCurrToolThDiam()
|
||||
Machining.Tool.ToolHolderLength = EgtTdbGetCurrToolThLength() or 72
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- ritorno la lista delle sole lavorazioni valide
|
||||
return validMachinings
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
---restituisce la lista delle lavorazioni ordinata secondo il criterio *sCriterion*
|
||||
---@param Machinings table lista della lavorazioni da riordinare
|
||||
---@param sCriterion string criterio di ordinamento ('Longest', 'Shortest', 'Biggest', 'Smallest')
|
||||
function ReorderMachinings( Machinings, sCriterion)
|
||||
|
||||
-- funzioni di ordinamento
|
||||
local function SortMachiningsByLongestTool( Machining1, Machining2)
|
||||
if Machining1.Tool.MaxMat > Machining2.Tool.MaxMat + 10 * GEO.EPS_SMALL then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
local function SortMachiningsByShortestTool( Machining1, Machining2)
|
||||
if Machining1.Tool.MaxMat < Machining2.Tool.MaxMat - 10 * GEO.EPS_SMALL then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
local function SortMachiningsByBiggestTool( Machining1, Machining2)
|
||||
if Machining1.Tool.Diameter > Machining2.Tool.Diameter + 10 * GEO.EPS_SMALL then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
local function SortMachiningsBySmallestTool( Machining1, Machining2)
|
||||
if Machining1.Tool.Diameter < Machining2.Tool.Diameter - 10 * GEO.EPS_SMALL then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-- ordinamento in base al criterio
|
||||
-- ordine di default, ossia quello che arriva dal database
|
||||
if not sCriterion then
|
||||
return
|
||||
-- prima gli utensili più lunghi
|
||||
elseif sCriterion == 'Longest' then
|
||||
table.sort( Machinings, SortMachiningsByLongestTool)
|
||||
-- prima gli utensili più corti
|
||||
elseif sCriterion == 'Shortest' then
|
||||
table.sort( Machinings, SortMachiningsByShortestTool)
|
||||
-- prima gli utensili con diametro più grande
|
||||
elseif sCriterion == 'Biggest' then
|
||||
table.sort( Machinings, SortMachiningsByBiggestTool)
|
||||
-- prima gli utensili con diametro più piccolo
|
||||
elseif sCriterion == 'Smallest' then
|
||||
table.sort( Machinings, SortMachiningsBySmallestTool)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function ReturnParams( MachiningType, MachiningName, sType, ToolParams)
|
||||
if MachiningType == MCH_MY.DRILLING then
|
||||
local _, sOrigType = EgtEndsWith( sType, '_H2')
|
||||
return MachiningName, sType, EgtIf( sOrigType == 'Drill' or sOrigType == 'Drill_AT' or sOrigType == 'AngleDrill' , ToolParams.TMaxMat, ToolParams.TMaxDepth), ToolParams.MaxToolLength, ToolParams.ToolDiam, ToolParams.DiamTh, ToolParams.FreeLen
|
||||
return MachiningName, sType, EgtIf( sOrigType == 'Drill' or sOrigType == 'Drill_AT' or sOrigType == 'AngleDrill' or sOrigType == 'Predrill' , ToolParams.TMaxMat, ToolParams.TMaxDepth), ToolParams.MaxToolLength, ToolParams.ToolDiam, ToolParams.DiamTh, ToolParams.FreeLen
|
||||
elseif MachiningType == MCH_MY.SAWING then
|
||||
return MachiningName, ToolParams.H2
|
||||
elseif MachiningType == MCH_MY.MILLING then
|
||||
@@ -227,7 +310,7 @@ function ReturnParams( MachiningType, MachiningName, sType, ToolParams)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead, bExcludeH2, bExcludeH3)
|
||||
local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion)
|
||||
if bTopHead == nil and bDownHead == nil then
|
||||
bTopHead = true
|
||||
bDownHead = false
|
||||
@@ -254,11 +337,12 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead,
|
||||
local sH2Mach = ''
|
||||
local sH2Tool = ''
|
||||
local sH2Param
|
||||
-- ricerca sulle forature, dal diametro maggiore al minore
|
||||
local Machinings = GetMachinings( MachiningType)
|
||||
local Machinings = GetMachinings( MachiningType, sType)
|
||||
ReorderMachinings( Machinings, sSortingCriterion)
|
||||
local ForStart = 1
|
||||
local ForEnd = #Machinings
|
||||
local ForStep = 1
|
||||
-- le forature vanno scorse dal diametro maggiore al minore
|
||||
if MachiningType == MCH_MY.DRILLING then
|
||||
ForStart = #Machinings
|
||||
ForEnd = 1
|
||||
@@ -266,16 +350,16 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead,
|
||||
end
|
||||
if ( BEAM and BEAM.BW) or MachineHeadType == ONE_HEAD or MachineHeadType == TWO_EQUAL_HEADS or ( MachineHeadType == TWO_UP_DOWN_HEADS and not bDownHead) then
|
||||
_, sType = EgtEndsWith( sType, '_H2')
|
||||
elseif ( not BEAM or not BEAM.BW) and MachineHeadType == TWO_UP_DOWN_HEADS and bDownHead then
|
||||
elseif not ( BEAM and BEAM.BW) and MachineHeadType == TWO_UP_DOWN_HEADS and not bTopHead and bDownHead then
|
||||
if not EgtEndsWith( sType, '_H2') then
|
||||
sType = sType .. '_H2'
|
||||
end
|
||||
end
|
||||
local MachineHeadUse = MachineHeadType
|
||||
if not BEAM or not BEAM.BW then
|
||||
if not ( BEAM and BEAM.BW) and MachineHeadUse == TWO_EQUAL_HEADS then
|
||||
MachineHeadUse = ONE_HEAD
|
||||
end
|
||||
if BEAM and BEAM.BW and MachineHeadUse == TWO_UP_DOWN_HEADS and bTopHead and bDownHead then
|
||||
if MachineHeadUse == TWO_UP_DOWN_HEADS and bTopHead and bDownHead then
|
||||
-- se posso usare entrambe le teste, la gestisco come una macchina a due teste da sopra
|
||||
MachineHeadUse = TWO_EQUAL_HEADS
|
||||
end
|
||||
@@ -284,27 +368,24 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead,
|
||||
for i = ForStart, ForEnd, ForStep do
|
||||
local Machining = Machinings[i]
|
||||
local sMachiningType = Machining.Type
|
||||
if BEAM and BEAM.BW then
|
||||
if ( BEAM and BEAM.BW) or MachineHeadUse == TWO_EQUAL_HEADS then
|
||||
_, sMachiningType = EgtEndsWith( Machining.Type, '_H2')
|
||||
end
|
||||
-- recupero dati utensile
|
||||
local bToolActive, sToolName, bH2, bFixed, bH3 = SetCurrMachiningAndTool( Machining.Name)
|
||||
local bToolActive, sToolName, bH2, bFixed, bH3 = SetCurrMachiningAndTool( Machining)
|
||||
if Machining.On and sMachiningType == sType and bToolActive and ( not bH2 or bH2 == not bExcludeH2) and ( not bH3 or bH3 == not bExcludeH3) then
|
||||
local bOk, ToolParams = VerifyTool( MachiningType, sType, Params, bH2)
|
||||
local bOk, ToolParams = VerifyTool( Machining, MachiningType, Params, bH2)
|
||||
if bOk then
|
||||
if MachineHeadUse == ONE_HEAD then
|
||||
SetNextMachining( sToolName, 1, bFixed)
|
||||
return ReturnParams(MachiningType, Machining.Name, Machining.Type, ToolParams)
|
||||
elseif MachineHeadUse == TWO_EQUAL_HEADS then
|
||||
-- se nessuna testa attiva, prendo la prima lavorazione disponibile
|
||||
if nActiveHead == 0 then
|
||||
SetNextMachining( sToolName, EgtIf( bH2, 2, 1), bFixed)
|
||||
return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams)
|
||||
-- verifico se posso usare lo stesso utensile della testa attiva
|
||||
elseif ( nActiveHead == 1 and not bH2 and sToolName == H1_TOOL) or ( nActiveHead == 2 and bH2 and sToolName == H2_TOOL) then
|
||||
-- se l'utensile sulla testa attiva è molto più piccolo rispetto a quelli salvati non lo scelgo
|
||||
if ( not sH1Param or not sH1Param.TDiam or sH1Param.TDiam < dBiggerToolTolerance * ToolParams.TDiam) and ( not sH2Param or not sH2Param.TDiam or sH2Param.TDiam < 1.25 * ToolParams.TDiam) then
|
||||
SetNextMachining( sToolName, nActiveHead, bFixed)
|
||||
-- se l'utensile sulla testa attiva è molto più piccolo rispetto a quelli salvati non lo scelgo, a meno che non siano entrambi grandi (truciolatori)
|
||||
if ( not sH1Param or not sH1Param.TDiam or ( sH1Param.TDiam < 75 and ToolParams.TDiam < 75 and sH1Param.TDiam < dBiggerToolTolerance * ToolParams.TDiam)) and ( not sH2Param or not sH2Param.TDiam or ( sH2Param.TDiam < 75 and ToolParams.TDiam < 75 and sH2Param.TDiam < 1.25 * ToolParams.TDiam)) then
|
||||
return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams)
|
||||
end
|
||||
end
|
||||
@@ -324,10 +405,8 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead,
|
||||
end
|
||||
elseif MachineHeadUse == TWO_UP_DOWN_HEADS then
|
||||
if bTopHead and not bH2 then
|
||||
SetNextMachining( sToolName, 1, bFixed)
|
||||
return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams)
|
||||
elseif bDownHead and bH2 then
|
||||
SetNextMachining( sToolName, 2, bFixed)
|
||||
return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams)
|
||||
end
|
||||
end
|
||||
@@ -335,34 +414,30 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead,
|
||||
end
|
||||
end
|
||||
if MachineHeadUse == TWO_EQUAL_HEADS then
|
||||
-- se uno dei due utensili è molto più grande dell'altro scelgo quello senza fare altre analisi
|
||||
-- se entrambi gli utensili sono piccoli (no truciolatori) e uno dei due è molto più grande dell'altro scelgo quello senza fare altre analisi
|
||||
if sH1Mach ~= "" and sH1Param.TDiam and sH2Mach ~= "" and sH2Param.TDiam then
|
||||
if sH1Param.TDiam > dBiggerToolTolerance * sH2Param.TDiam then
|
||||
SetNextMachining( sH1Tool, 1, bFixed)
|
||||
return ReturnParams( MachiningType, sH1Mach, sType, sH1Param)
|
||||
elseif sH2Param.TDiam > dBiggerToolTolerance * sH1Param.TDiam then
|
||||
SetNextMachining( sH2Tool, 2, bFixed)
|
||||
return ReturnParams( MachiningType, sH2Mach, sType, sH2Param)
|
||||
if sH1Param.TDiam < 75 or sH2Param.TDiam < 75 then
|
||||
if sH1Param.TDiam > dBiggerToolTolerance * sH2Param.TDiam then
|
||||
return ReturnParams( MachiningType, sH1Mach, sType, sH1Param)
|
||||
elseif sH2Param.TDiam > dBiggerToolTolerance * sH1Param.TDiam then
|
||||
return ReturnParams( MachiningType, sH2Mach, sType, sH2Param)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- verifico se cambiare testa o cambiare utensile su quella corrente
|
||||
if nActiveHead == 1 then
|
||||
if sH2Mach ~= "" then
|
||||
SetNextMachining( sH2Tool, 2, bFixed)
|
||||
return ReturnParams( MachiningType, sH2Mach, sType, sH2Param)
|
||||
--return sH2Mach, sH2Param.Type, sH2Param.TMaxMat, sH2Param.MaxToolLength, sH2Param.ToolDiam, sH2Param.DiamTh, sH2Param.FreeLen
|
||||
elseif sH1Mach ~= "" then
|
||||
SetNextMachining( sH1Tool, 1, bFixed)
|
||||
return ReturnParams( MachiningType, sH1Mach, sType, sH1Param)
|
||||
--return sH1Mach, sH1Param.Type, sH1Param.TMaxMat, sH1Param.MaxToolLength, sH1Param.ToolDiam, sH1Param.DiamTh, sH1Param.FreeLen
|
||||
end
|
||||
elseif nActiveHead == 2 then
|
||||
if sH1Mach ~= "" then
|
||||
SetNextMachining( sH1Tool, 1, bFixed)
|
||||
return ReturnParams( MachiningType, sH1Mach, sType, sH1Param)
|
||||
--return sH1Mach, sH1Param.Type, sH1Param.TMaxMat, sH1Param.MaxToolLength, sH1Param.ToolDiam, sH1Param.DiamTh, sH1Param.FreeLen
|
||||
elseif sH2Mach ~= "" then
|
||||
SetNextMachining( sH2Tool, 2, bFixed)
|
||||
return ReturnParams( MachiningType, sH2Mach, sType, sH2Param)
|
||||
--return sH2Mach, sH2Param.Type, sH2Param.TMaxMat, sH2Param.MaxToolLength, sH2Param.ToolDiam, sH2Param.DiamTh, sH2Param.FreeLen
|
||||
end
|
||||
@@ -380,10 +455,17 @@ function MachiningLib.FindCutting( sType, bTopHead, bDownHead)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead, bExcludeH2, bAngleTransmission)
|
||||
local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, EgtIf( bAngleTransmission, 'Drill_AT', 'Drill'), { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead, bExcludeH2)
|
||||
if ( not MachiningName or MachiningName == '') and not bAngleTransmission then
|
||||
MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, 'Pocket', { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead)
|
||||
function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead, bExcludeH2, bAngleTransmission, bIsPredrill)
|
||||
local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5, sTypeMach
|
||||
-- se il foro è un predrill, cerco solo punte abilitate al Predrill
|
||||
if bIsPredrill then
|
||||
sTypeMach = 'Predrill'
|
||||
else
|
||||
sTypeMach = EgtIf( bAngleTransmission, 'Drill_AT', 'Drill')
|
||||
end
|
||||
MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, sTypeMach, { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead, bExcludeH2)
|
||||
if ( not MachiningName or MachiningName == '') then
|
||||
MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, EgtIf( bAngleTransmission, 'Pocket_AT', 'Pocket'), { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead)
|
||||
end
|
||||
if MachiningName and MachiningName ~= '' then
|
||||
return MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5
|
||||
@@ -404,13 +486,14 @@ function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotL
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function MachiningLib.FindPocketing( sType, dMaxDiam, dDepth, dMaxTotLen, bTopHead, bDownHead, bExcludeH2, bExcludeH3)
|
||||
return FindMachining( MCH_MY.POCKETING, sType, { MaxDiam = dMaxDiam, Depth = dDepth, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead, bExcludeH2, bExcludeH3)
|
||||
function MachiningLib.FindPocketing( sType, dMaxDiam, dDepth, dMaxTotLen, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion)
|
||||
return FindMachining( MCH_MY.POCKETING, sType, { MaxDiam = dMaxDiam, Depth = dDepth, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function MachiningLib.FindSawing( sType)
|
||||
return FindMachining( MCH_MY.MORTISING, sType)
|
||||
function MachiningLib.FindSawing( sType, dDepth, bConsiderCSimmEncumberance, sSortingCriterion)
|
||||
if not BD.C_SIMM_ENC then BD.C_SIMM_ENC = EgtIf( BD.C_SIMM, 180, 90) end
|
||||
return FindMachining( MCH_MY.MORTISING, sType, { Depth = dDepth, CSimmEncumberance = EgtIf( bConsiderCSimmEncumberance, BD.C_SIMM_ENC, 0)}, nil, nil, nil, nil, sSortingCriterion)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -151,7 +151,8 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dO
|
||||
-- se va fatto, inserisco la lavorazione
|
||||
if bCut then
|
||||
local CutProc = { Id = AuxId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- se taglio applicato setto la nota al gruppo Mach per non doverla lavorare una seconda volta
|
||||
if bOk then
|
||||
@@ -242,7 +243,8 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dO
|
||||
-- se va fatto, inserisco la lavorazione
|
||||
if bCut then
|
||||
local CutProc = { Id = AuxId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- se taglio applicato setto la nota al gruppo Mach per non doverla lavorare una seconda volta
|
||||
if bOk then
|
||||
|
||||
+63
-32
@@ -22,6 +22,10 @@
|
||||
-- 2023/08/01 Correzione su offset per taglio doppio di lato.
|
||||
-- 2023/08/01 In caso di pezzi alti su macchina tipo PF i tagli doppi di lato non vengono usati, si usa il metodo standard.
|
||||
-- 2023/09/12 In MakeFromTop abbassato a 590 mm il limite per convertire in LongCut.
|
||||
-- 2023/10/27 In MakeFromTop corretto massimo materiale in caso di lavorazione da sotto.
|
||||
-- 2023/12/07 Correzione in Classify in scelta ribaltamento trave quando si è in condizioni downUp.
|
||||
-- 2024/01/18 Gestita superficie limitante opzionale da passare a diceCut.
|
||||
-- 2024/05/10 In MakeFromTop ricalcolo direzione di lavorazione su facce a cubetti
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessCut = {}
|
||||
@@ -66,10 +70,22 @@ function ProcessCut.Classify( Proc, b3Raw)
|
||||
local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw)
|
||||
local bDownCut = ( vtN:getZ() <= dNzLimDwnUp)
|
||||
if bDownCut then
|
||||
-- recupero i dati della lama
|
||||
local sCutType = EgtIf( Proc.Head, 'HeadSide', 'TailSide')
|
||||
local sCutting = ML.FindCutting( sCutType, true, false)
|
||||
local dMaxDepth = 0
|
||||
local dMaxMat = 0
|
||||
if EgtMdbSetCurrMachining( sCutting) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
|
||||
end
|
||||
end
|
||||
-- calcolo l'ingombro orizzontale della faccia
|
||||
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0)
|
||||
-- confronto questo ingombro con il doppio della massima dimensione del DiceCut (impossibile lavorare sotto da sopra se più di 2 tagli)
|
||||
if DimH > 2 * BD.MAX_DIM_DICE then
|
||||
-- confronto questo ingombro con il doppio della massima dimensione del DiceCut (impossibile lavorare sotto da sopra se più di 2 tagli oppure se tipo PF, taglio inclinato in Y e non taglio singolo orizzontale)
|
||||
if DimH > 2 * BD.MAX_DIM_DICE or ( BD.C_SIMM and abs( vtN:getY()) > 0.1 and dMaxMat < DimH + BD.CUT_EXTRA) then
|
||||
return true, true
|
||||
end
|
||||
end
|
||||
@@ -210,7 +226,8 @@ end
|
||||
local function UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
|
||||
-- eventuale segnalazione ingombro di testa o coda (se non chiamata da altre feature)
|
||||
local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ())
|
||||
if Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then
|
||||
local dMinZ = max( BD.MIN_HEIGHT, 0.35 * b3Raw:getDimZ())
|
||||
if Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinZ then
|
||||
if Proc.Head then
|
||||
local dOffs = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()
|
||||
if vtN:getZ() > 0.5 then
|
||||
@@ -237,7 +254,7 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione con testa da sopra
|
||||
local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes)
|
||||
local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, nLimitingSurf)
|
||||
-- ingombro del grezzo
|
||||
b3Raw = b3Raw or EgtGetRawPartBBox( nRawId)
|
||||
-- ingombro del pezzo
|
||||
@@ -347,7 +364,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- verifico se necessari tagli supplementari
|
||||
-- verifico se necessari tagli supplementari o se presente superficie limitante
|
||||
EgtOutLog( string.format( 'MaxDepth=%.1f MaxVertDepth=%.1f CutH=%.1f CutV=%.1f', dMaxDepth, dMaxVertDepth, dCutH, dCutV), 3)
|
||||
local vCuts = {}
|
||||
if not Proc.AdvTail and ( dCutH > dMaxDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC or dCutV > dMaxVertDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC) then
|
||||
@@ -358,6 +375,9 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
ptExtra = Point3d( b3Solid:getMin():getX() + 5*GEO.EPS_SMALL, ptMiddle:getY(), ptMiddle:getZ())
|
||||
vtExtra = X_AX()
|
||||
bAutoCalcSurf = false
|
||||
-- superficie limitante
|
||||
elseif nLimitingSurf then
|
||||
ptExtra, vtExtra = EgtSurfTmFacetCenter( nLimitingSurf, 0, GDB_ID.ROOT)
|
||||
end
|
||||
-- verifico elevazione max del materiale tagliato
|
||||
local dMaxElev
|
||||
@@ -374,9 +394,9 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
dMaxElev = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
|
||||
end
|
||||
end
|
||||
-- per macchina TURN aggiusto massima dimensione cubetto
|
||||
-- per macchina TURN (ma non OikosX) aggiusto massima dimensione cubetto
|
||||
local dNewDiceDim
|
||||
if BD.TURN then
|
||||
if BD.TURN and BD.TURN ~= 2 then
|
||||
local dDimRef = GEO.INFINITO
|
||||
if abs( vtN:getZ()) < 0.003 then
|
||||
dDimRef = b3Raw:getDimZ()
|
||||
@@ -460,7 +480,15 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
if vtO then
|
||||
vtOrthoO = Vector3d( vtO) * EgtIf( bOrthInv, -1, 1)
|
||||
else
|
||||
if bHorizCut then
|
||||
-- ricalcolo tipo taglio perché "bHorizCut" è calcolato sulla feature, mentre il cubetto potrebbe essere lavorato in un altro modo
|
||||
local _, dLen, dWidth = BL.GetFaceHvRefDim( vCuts[i][1], 0, b3Raw)
|
||||
local bCutDirection = bHorizCut
|
||||
-- se bisogna tagliare di fianco ma la lunghezza faccia è più del massimo materiale, forzo lavorazione da sopra
|
||||
if not bHorizCut and dLen > dMaxDepth then
|
||||
bCutDirection = true
|
||||
end
|
||||
|
||||
if bCutDirection then
|
||||
vtOrthoO = Z_AX()
|
||||
else
|
||||
if vtN:getZ() < dNzLimDwnUp then
|
||||
@@ -514,9 +542,14 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
local dVzLimDwnUp = dNzLimDwnUp
|
||||
if j ~= 1 then
|
||||
vtNewOrthoO = -vtOrthoO
|
||||
if not BD.C_SIMM and not BD.TURN and abs( vtN:getY()) > 0.05 then dVzLimDwnUp = -0.708 end
|
||||
if BD.GetNzLimDownUp then
|
||||
dVzLimDwnUp = BD.GetNzLimDownUp( b3Raw, vtN, V_NULL(), true)
|
||||
elseif not BD.C_SIMM and not BD.TURN and abs( vtN:getY()) > 0.05 then
|
||||
dVzLimDwnUp = -0.708
|
||||
end
|
||||
end
|
||||
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtNewOrthoO, dVzLimDwnUp, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
local bSpecialTangentLeadInOut = ( i % 2 == 0) and ( Proc.AffectedFaces.Left or Proc.AffectedFaces.Right)
|
||||
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtNewOrthoO, dVzLimDwnUp, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, 0, nil, b3Raw, nil, nil, bSpecialTangentLeadInOut)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
-- tutti gli altri casi vengono saltati
|
||||
@@ -538,8 +571,17 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
end
|
||||
end
|
||||
local dVzLimDwnUp = dNzLimDwnUp
|
||||
if not BD.C_SIMM and not BD.TURN and vtN:getZ() > 0.707 then dVzLimDwnUp = -0.708 end
|
||||
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, sNotes, b3Raw)
|
||||
if BD.GetNzLimDownUp then
|
||||
dVzLimDwnUp = BD.GetNzLimDownUp( b3Raw, vtN, V_NULL(), true)
|
||||
elseif not BD.C_SIMM and not BD.TURN and vtN:getZ() > 0.707 then
|
||||
dVzLimDwnUp = -0.708
|
||||
end
|
||||
local bSpecialTangentLeadInOut = ( i % 2 == 0) and ( Proc.AffectedFaces.Left or Proc.AffectedFaces.Right)
|
||||
local vtOrthoOAlternative
|
||||
if ( i % 2 == 0) and ( Proc.Fct == 1) and bNoPerpCuts then
|
||||
vtOrthoOAlternative = - vtOrthoO
|
||||
end
|
||||
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, sNotes, b3Raw, nil, nil, bSpecialTangentLeadInOut, nil, vtOrthoOAlternative)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
end
|
||||
@@ -556,7 +598,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
end
|
||||
-- lavoro la faccia
|
||||
local vtOrthoO
|
||||
if bFromBottom and dCutV < dMaxVertDepth - BD.CUT_EXTRA and vtN:getZ() > 0 then
|
||||
if bFromBottom and dCutV < dMaxDepth - BD.CUT_EXTRA and vtN:getZ() > 0 then
|
||||
vtOrthoO = -Z_AX()
|
||||
elseif bHorizCut and ( not bVertCutOk or b3Solid:getDimX() > BD.LEN_SHORT_PART or Proc.AdvTail or ( vtN:getX() > 0 and vtN:getZ() <= 0.708) or ( abs( vtN:getY()) < 0.1 and vtN:getZ() <= 0)) then
|
||||
vtOrthoO = Z_AX()
|
||||
@@ -721,14 +763,16 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
-- taglio perpendicolare (limite Vz Down Up messo a -2 per non farlo mai intervenire)
|
||||
if vCuts[i][j] then
|
||||
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO_1, -2, dExtraCut_1, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
local bSpecialTangentLeadInOut = ( i % 2 == 0) and ( Proc.AffectedFaces.Left or Proc.AffectedFaces.Right)
|
||||
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO_1, -2, dExtraCut_1, BD.CUT_SIC, 0, 0, 0, nil, b3Raw, nil, nil, bSpecialTangentLeadInOut)
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
end
|
||||
-- taglio parallelo (limite Vz Down Up messo a -2 per non farlo mai intervenire)
|
||||
if vCuts[i+1][j] then
|
||||
local bOk, sErr = Fbs.MakeOne( vCuts[i+1][j], 0, sCutting, dSawDiam, vtOrthoO_2, -2, dExtraCut_2, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
local bSpecialTangentLeadInOut = ( i % 2 == 0) and ( Proc.AffectedFaces.Left or Proc.AffectedFaces.Right)
|
||||
local bOk, sErr = Fbs.MakeOne( vCuts[i+1][j], 0, sCutting, dSawDiam, vtOrthoO_2, -2, dExtraCut_2, BD.CUT_SIC, 0, 0, 0, nil, b3Raw, nil, nil, bSpecialTangentLeadInOut)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
end
|
||||
@@ -777,7 +821,7 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, dOvmTail, bUpdateIng)
|
||||
function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, dOvmTail, bUpdateIng, nLimitingSurf)
|
||||
-- sovramateriale di coda
|
||||
dOvmTail = dOvmTail or BD.OVM_MID
|
||||
-- ingombro del grezzo
|
||||
@@ -793,20 +837,7 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom,
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
-- se taglio di testa
|
||||
if not bForced then
|
||||
if Proc.Head then
|
||||
-- se coincide con il taglio di separazione precedente, non va fatto
|
||||
if AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Raw:getMax():getX() + dOvmHead) < 10 * GEO.EPS_SMALL then
|
||||
return true
|
||||
end
|
||||
-- altrimenti taglio di coda
|
||||
else
|
||||
-- se coincide con taglio di separazione, non va fatto
|
||||
if AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
|
||||
return true
|
||||
end
|
||||
end
|
||||
-- se coincide con un taglio frontale non va fatto
|
||||
if Proc.CutFront then
|
||||
if not BL.IsCutNeeded( Proc, b3Raw, dOvmHead, dOvmTail) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
@@ -829,12 +860,12 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom,
|
||||
local bNoDicing = false
|
||||
-- se taglio con testa da sopra
|
||||
if not bDownHead and not bDownTurn then
|
||||
local bOk, sErr, bNoDicing2 = MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes)
|
||||
local bOk, sErr, bNoDicing2 = MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, nLimitingSurf)
|
||||
bNoDicing = bNoDicing2
|
||||
if not bOk then return false, sErr end
|
||||
-- altrimenti taglio con testa da sotto
|
||||
else
|
||||
local bOk, sErr = MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut)
|
||||
local bOk, sErr = MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
-- Aggiornamento ingombro (se vero taglio o richiesto)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
-- Gestione calcolo doppi tagli di lama per Travi
|
||||
-- 2022/08/29 Implementata la fresatura dal lato per tagli problematici per PF1250.
|
||||
-- 2023/03/22 Eliminata SetOpenSide locale, si usa quella di libreria.
|
||||
-- 2023/12/07 Correzione in Classify in scelta ribaltamento trave quando si è in condizioni downUp
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessDoubleCut = {}
|
||||
@@ -54,10 +55,22 @@ function ProcessDoubleCut.Classify( Proc, b3Raw)
|
||||
local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN)
|
||||
local bDownCut = ( vtN:getZ() <= dNzLimDwnUp)
|
||||
if bDownCut then
|
||||
-- recupero i dati della lama
|
||||
local sCutType = EgtIf( Proc.Head, 'HeadSide', 'TailSide')
|
||||
local sCutting = ML.FindCutting( sCutType, true, false)
|
||||
local dMaxDepth = 0
|
||||
local dMaxMat = 0
|
||||
if EgtMdbSetCurrMachining( sCutting) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
|
||||
end
|
||||
end
|
||||
-- calcolo l'ingombro orizzontale della faccia
|
||||
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, nFac)
|
||||
-- confronto questo ingombro con il doppio della massima dimensione del DiceCut (impossibile lavorare sotto da sopra se più di 2 tagli)
|
||||
if DimH > 2 * BD.MAX_DIM_DICE then
|
||||
local _, DimH = BL.GetFaceHvRefDim( Proc.Id, nFac)
|
||||
-- confronto questo ingombro con il doppio della massima dimensione del DiceCut (impossibile lavorare sotto da sopra se più di 2 tagli oppure se tipo PF, taglio inclinato in Y e non taglio singolo orizzontale)
|
||||
if DimH > 2 * BD.MAX_DIM_DICE or ( BD.C_SIMM and abs( vtN:getY()) > 0.1 and dMaxMat < DimH + BD.CUT_EXTRA) then
|
||||
return true, true
|
||||
end
|
||||
end
|
||||
@@ -508,7 +521,8 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local b3Add = EgtGetBBoxGlob( AddId, GDB_BB.STANDARD)
|
||||
-- applico lavorazione
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Add, Fct = 1, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, nil, nil, bForced, b3Raw, sNotes, dOvmTail, true)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
@@ -520,7 +534,8 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local b3Add = EgtGetBBoxGlob( AddId, GDB_BB.STANDARD)
|
||||
-- applico lavorazione
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Add, Fct = 1, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, nil, nil, bForced, b3Raw, sNotes, dOvmTail, true)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
|
||||
@@ -1433,7 +1433,8 @@ local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
|
||||
return true
|
||||
end
|
||||
-- inserisco la lavorazione
|
||||
local CutProc = { Id = AuxId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, Head = Proc.Head, Tail = Proc.Tail}
|
||||
local CutProc = { Id = AuxId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, Head = Proc.Head, Tail = Proc.Tail, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if not bOk then return bOk, sErr end
|
||||
-- imposto la nota nel gruppo aggiuntivo di lavorazione per evitare di tagliare una seconda volta
|
||||
@@ -1684,7 +1685,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
|
||||
end
|
||||
-- determino il massimo affondamento con l'utensile
|
||||
local sMchFind = 'Long2Cut'
|
||||
sMilling = ML.FindMilling( sMchFind)
|
||||
local sMilling = ML.FindMilling( sMchFind)
|
||||
if not sMilling then
|
||||
local sErr = 'Milling not found in library : Error on Dovetail ' .. tostring( Proc.Id)
|
||||
EgtOutLog( sErr)
|
||||
|
||||
+89
-14
@@ -1,4 +1,4 @@
|
||||
-- ProcessDrill.lua by Egaltech s.r.l. 2023/09/26
|
||||
-- ProcessDrill.lua by Egaltech s.r.l. 2023/11/06
|
||||
-- Gestione calcolo forature per Travi
|
||||
-- 2021/04/14 DS Corretta gestione Invert con testa da sotto. Migliorato calcolo ingombro portautensile.
|
||||
-- 2021/05/03 DS Su macchina con testa da sotto aggiunta possibilità di fare fori verticali metà sopra e l'altra sotto.
|
||||
@@ -19,6 +19,9 @@
|
||||
-- 2023/05/11 Se lavorazione in doppio e precedente no oppure di tipo diverso, forzo risalita a Zmax.
|
||||
-- 2023/07/28 Aggiunta gestione rinvio 90deg solo per forature da sotto esattamente verticali.
|
||||
-- 2023/09/26 Se errore in applicazione lavorazione si inverte e riprova solo se foratura singola su foro aperto.
|
||||
-- 2023/11/06 Migliorata gestione dei fori con AngularTransmission.
|
||||
-- 2024/03/13 Aggiunta gestione Predrill
|
||||
-- 2024/03/18 Per Predrill corretta direzione estrusione per fori con direzione verso il basso
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessDrill = {}
|
||||
@@ -95,20 +98,21 @@ end
|
||||
---------------------------------------------------------------------
|
||||
-- Recupero dati foro e adattamento se speciale
|
||||
function ProcessDrill.GetData( Proc, b3Raw)
|
||||
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
|
||||
-- verifico se foro da adattare
|
||||
if EgtExistsInfo( Proc.Id, 'DiamUser') then
|
||||
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
|
||||
if AuxId then AuxId = AuxId + Proc.Id end
|
||||
if AuxId and EgtGetType( AuxId) == GDB_TY.CRV_ARC and BD.USER_HOLE_DIAM and BD.USER_HOLE_DIAM > 1 then
|
||||
EgtModifyArcRadius( AuxId, BD.USER_HOLE_DIAM / 2)
|
||||
end
|
||||
end
|
||||
-- recupero diametro
|
||||
-- recupero diametro e lunghezza
|
||||
local dDiam = EgtGetInfo( Proc.Id, 'P12', 'd') or 0
|
||||
local dLen = abs( EgtCurveThickness( Proc.Id + AuxId)) or 0
|
||||
-- recupero faccia di entrata e uscita
|
||||
local nFcs = EgtGetInfo( Proc.Id, 'FCS', 'i') or 0
|
||||
local nFce = EgtGetInfo( Proc.Id, 'FCE', 'i') or 0
|
||||
return dDiam, nFcs, nFce
|
||||
return dDiam, dLen, nFcs, nFce
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
@@ -133,8 +137,78 @@ function ProcessDrill.Split( Proc, b3Raw)
|
||||
-- restituisco se va fatto in doppio (solo fori orizzontali)
|
||||
local bHoriz = ( abs( vtExtr:getZ()) < abs( BD.DRILL_VZ_MIN) and
|
||||
( abs( vtExtr:getY()) * b3Raw:getDimZ() > abs( vtExtr:getZ()) * b3Raw:getDimY() or Proc.Fce == 5 or Proc.Fce == 6))
|
||||
local bAngTransm = ( BD.ANG_TRASM and ML.FindDrilling( dDiam, nil, nil, nil, nil, true) and AreSameOrOppositeVectorApprox( vtExtr, Z_AX()))
|
||||
local bSlant = ( abs( vtExtr:getX()) > BD.DRILL_VX_MAX)
|
||||
return ( bOpen and ( bHoriz or BD.ROT90 or BD.DOWN_HEAD or BD.TURN) and not bSlant)
|
||||
return ( bOpen and ( bHoriz or BD.ROT90 or BD.DOWN_HEAD or BD.TURN or bAngTransm) and not bSlant)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Verifica se bisogna aggiungere un preforo
|
||||
function ProcessDrill.IsPredrillNeeded( Proc)
|
||||
local dDepthPredrill = EgtGetInfo( Proc.Id, 'Q03', 'i')
|
||||
-- se non c'è la Q oppure se zero, allora non è da fare
|
||||
if not dDepthPredrill or dDepthPredrill <= 0 then
|
||||
return false
|
||||
-- altrimenti Predrill da fare
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Aggiunge il preforo alla feature passata
|
||||
function ProcessDrill.AddPredrillFromDrillProc( Proc)
|
||||
local dDepthPredrill = EgtGetInfo( Proc.Id, 'Q03', 'i')
|
||||
-- foro più corto del preforo, allora è il foro che diventa il preforo stesso
|
||||
if Proc.Len <= dDepthPredrill then
|
||||
Proc.IsPredrill = true
|
||||
Proc.IsPredrillOf = Proc.Id
|
||||
return false
|
||||
-- altrimenti creo un nuovo process
|
||||
else
|
||||
-- recupero gruppo per geometria aggiuntiva
|
||||
local nAddGrpId = BL.GetAddGroup( Proc.PartId)
|
||||
-- recupero e verifico l'entità foro
|
||||
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
|
||||
local ptCen = EgtCP( Proc.Id + AuxId, GDB_RT.GLOB)
|
||||
local vtExtr = EgtCurveExtrusion( Proc.Id + AuxId, GDB_RT.GLOB)
|
||||
|
||||
-- copio foro originale
|
||||
local nPreHoleId = EgtCopyGlob( Proc.Id, nAddGrpId)
|
||||
local nPreHoleAux = EgtCopyGlob( Proc.Id + AuxId, nAddGrpId)
|
||||
|
||||
-- se foro invertito sposto geometria dall'altro lato del foro e inverto direzione estrusione
|
||||
if Proc.Flg == -2 then
|
||||
local vsExtr = -vtExtr * Proc.Len
|
||||
EgtMove( nPreHoleAux, vsExtr, GDB_RT.GLOB)
|
||||
EgtModifyCurveExtrusion( nPreHoleAux, -vtExtr, GDB_RT.GLOB)
|
||||
end
|
||||
EgtModifyCurveThickness( nPreHoleAux, -dDepthPredrill)
|
||||
|
||||
local PredrillProc = {}
|
||||
-- definisco dati seconda parte
|
||||
PredrillProc.PartId = Proc.PartId
|
||||
PredrillProc.Id = nPreHoleId
|
||||
PredrillProc.Grp = Proc.Grp
|
||||
PredrillProc.Prc = Proc.Prc
|
||||
PredrillProc.Flg = 1
|
||||
PredrillProc.Box = Proc.Box
|
||||
PredrillProc.Fct = Proc.Fct
|
||||
PredrillProc.Diam = Proc.Diam
|
||||
PredrillProc.Len = dDepthPredrill
|
||||
PredrillProc.Head = Proc.Head
|
||||
PredrillProc.Tail = Proc.Tail
|
||||
PredrillProc.Fcs = Proc.Fcs
|
||||
PredrillProc.Fce = 0 -- il preforo è sempre chiuso, non ha faccia di uscita
|
||||
PredrillProc.CutId = Proc.CutId
|
||||
PredrillProc.TaskId = Proc.TaskId
|
||||
PredrillProc.AdjId = Proc.AdjId
|
||||
PredrillProc.MainId = Proc.MainId
|
||||
PredrillProc.IsPredrill = true
|
||||
PredrillProc.IsPredrillOf = Proc.Id
|
||||
|
||||
return true, PredrillProc
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
@@ -168,17 +242,18 @@ function ProcessDrill.Classify( Proc, b3Raw)
|
||||
end
|
||||
local bOpen = ( Proc.Fce ~= 0)
|
||||
local bFaceDown = ( ptCen:getZ() < b3Raw:getMin():getZ() + 2 and (( not Proc.Head and not Proc.Tail) or (( BD.ROT90 or BD.DOWN_HEAD or BD.TURN) and abs( Proc.Flg) == 2)))
|
||||
local bAngTransm = ( BD.ANG_TRASM and ML.FindDrilling( dDiam, nil, nil, nil, nil, true) and AreSameOrOppositeVectorApprox( vtExtr, Z_AX()))
|
||||
-- verifico se il foro è sotto e quindi va spostato o sopra o sul fianco
|
||||
if (( vtExtr:getZ() < BD.DRILL_VZ_MIN or bFaceDown) and ( not bOpen or Proc.Flg ~= 1)) then
|
||||
if not bOpen then
|
||||
-- se da sotto e presente rinvio angolare verifico se c'è opportuna lavorazione
|
||||
if BD.ANG_TRASM and ML.FindDrilling( dDiam, nil, nil, nil, nil, true) and AreOppositeVectorApprox( vtExtr, Z_AX()) then
|
||||
if bAngTransm then
|
||||
return true, false, false
|
||||
else
|
||||
return true, true, false
|
||||
end
|
||||
else
|
||||
return true, not ( BD.ROT90 or BD.DOWN_HEAD or BD.TURN), ( BD.ROT90 or BD.DOWN_HEAD or BD.TURN)
|
||||
return true, not ( BD.ROT90 or BD.DOWN_HEAD or BD.TURN or bAngTransm), ( BD.ROT90 or BD.DOWN_HEAD or BD.TURN)
|
||||
end
|
||||
else
|
||||
return true, false, false
|
||||
@@ -250,9 +325,9 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
||||
-- verifico possibilità di foratura da sotto
|
||||
local bDownDrill = ( BD.TURN or ( BD.DOWN_HEAD and ML.FindDrilling( dDiam, nil, false, true)))
|
||||
-- se presente rinvio angolare
|
||||
local bDrillAngTrasm = ( BD.ANG_TRASM and AreOppositeVectorApprox( vtExtr, Z_AX()) and not bOpen)
|
||||
local bDrillAngTrasm = ( BD.ANG_TRASM and ML.FindDrilling( dDiam, nil, nil, nil, nil, true) and AreOppositeVectorApprox( vtExtr, Z_AX()))
|
||||
-- verifico che il foro non sia fattibile solo da sotto
|
||||
local bToInvert = ( vtExtr:getZ() < BD.DRILL_VZ_MIN and not bDownDrill) and not bDrillAngTrasm
|
||||
local bToInvert = ( vtExtr:getZ() < BD.DRILL_VZ_MIN and not bDownDrill and not bDrillAngTrasm)
|
||||
if bToInvert and ( not bOpen or Proc.Flg ~= 1) then
|
||||
local sErr = 'Error : drilling from bottom impossible'
|
||||
EgtOutLog( sErr)
|
||||
@@ -286,15 +361,15 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
||||
local bDrillUp = ( bDownDrill and vtExtr:getZ() > -0.421)
|
||||
local bExcludeH2 = false
|
||||
if Proc.Double and Proc.Double > 0 then
|
||||
bMillUp = true
|
||||
-- bMillUp = true
|
||||
bDrillDown = false
|
||||
bExcludeH2 = true
|
||||
end
|
||||
-- primo gruppo di controlli con lunghezza utensile pari a metà foro se passante
|
||||
-- recupero la lavorazione
|
||||
local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm)
|
||||
local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm, Proc.IsPredrill)
|
||||
if not sDrilling and dCheckDepth then
|
||||
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm)
|
||||
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm, Proc.IsPredrill)
|
||||
if sDrilling then dCheckDepth = nil end
|
||||
end
|
||||
if not sDrilling then
|
||||
@@ -451,7 +526,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
||||
dMaxElev = dMaxDepth
|
||||
end
|
||||
-- inserisco la lavorazione
|
||||
local sName = 'Drill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local sName = EgtIf( EgtStartsWith( sType, 'Predrill'), 'Predrill_', 'Drill_') .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchId = EgtAddMachining( sName, sDrilling)
|
||||
if not nMchId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sDrilling
|
||||
@@ -461,7 +536,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
-- eventuale inversione
|
||||
if sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill' then
|
||||
if sType == 'Drill' or sType == 'Drill_H2' or sType == 'Drill_AT' or sType == 'AngleDrill' or sType == 'Predrill' then
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, bToInvert)
|
||||
else
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, bToInvert)
|
||||
|
||||
@@ -210,7 +210,8 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptCutC, vtCutN, b3Solid, GDB_RT.GLOB)
|
||||
local b3Cut = EgtGetBBoxGlob( AddId or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp - 2, Prc = 10, Box = b3Cut, Fct = 1, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bFromBottom = ( b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getZ() > 0.25)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH, bFromBottom)
|
||||
if not bOk then return bOk, sErr end
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
-- 2023/02/08 Aumentato il range per cui i tenoni vengono lavorati in sottosquadro.
|
||||
-- 2023/03/27 Migliorate condizioni scelta pretaglio con lama o fresa; gestione unificata con ProcessTenon.
|
||||
-- 2023/03/28 Corretta gestione faccia di base quando divisa in più parti per distanza massima da lavorare.
|
||||
-- 2024/02/29 Aumentato numero passaggi CR su tenone. Massimo 8
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessDtTenon = {}
|
||||
@@ -206,7 +207,8 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- altrimenti applico taglio di lama
|
||||
else
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bFromBottom = ( b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getZ() > 0.25)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom)
|
||||
if not bOk then return bOk, sErr end
|
||||
@@ -215,7 +217,7 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
local sMillType = 'DtTenon'
|
||||
local sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', ''), nil, nil, nil, nil, bMillUp, bMillDown)
|
||||
local sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown and not bMillUp, '_H2', ''), nil, nil, nil, nil, bMillUp, bMillDown)
|
||||
if not sMilling then
|
||||
local sErr = 'Error : milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
@@ -268,8 +270,8 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
dMaxDist = 2 * ( b3DtTen:getRadius() - b3DtAux:getRadius())
|
||||
end
|
||||
EgtOutLog( 'MaxDist=' .. EgtNumToString( dMaxDist, 3), 3)
|
||||
-- Cicli di lavorazione (max 6)
|
||||
local MAX_PASS = 6
|
||||
-- Cicli di lavorazione (max 8)
|
||||
local MAX_PASS = 8
|
||||
local nStep = min( ceil( dMaxDist / ( 0.7 * dTDiam)), MAX_PASS)
|
||||
local dStep = min( dMaxDist, 0.7 * dTDiam * MAX_PASS) / nStep
|
||||
for i = nStep, 1, -1 do
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
-- 2023/03/03 Corretta MakeByMark ( non definiti b3Raw e b3Aux ).
|
||||
-- 2023/06/21 In CalcSpecialAdd modificato l'angolo minimo da 5 a 15 deg.
|
||||
-- 2023/07/28 In MakeByPocket aggiunta Q06 per specificare un eventuale offset radiale del contorno.
|
||||
-- 2024/03/05 In MakebyPocket aggiunta lavorazione di smusso
|
||||
-- In MakeByMill eliminata doppia lavorazione smusso se contorno non passante
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessFreeContour = {}
|
||||
@@ -35,6 +37,7 @@ local Q_RADIAL_OFFSET = 'Q06' -- d, valido solo per pocket
|
||||
function ProcessFreeContour.Identify( Proc)
|
||||
return ( ( Proc.Grp == 0 or Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 250)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Verifica se feature di testa
|
||||
function ProcessFreeContour.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||
@@ -293,16 +296,18 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local bCross = false
|
||||
if abs( vtExtr:getX()) < 0.707 then
|
||||
if abs( vtExtr:getY()) > abs( vtExtr:getZ()) then
|
||||
-- se è passante
|
||||
if b3Aux:getDimY() > b3Raw:getDimY() - 1.0 then
|
||||
bCross = true
|
||||
dDepth = min( dDepth, b3Raw:getDimY() / abs( vtExtr:getY()))
|
||||
end
|
||||
if bDown then
|
||||
nSide = -1
|
||||
nSide = -1
|
||||
else
|
||||
nSide = 1
|
||||
nSide = 1
|
||||
end
|
||||
else
|
||||
-- se è passante
|
||||
if b3Aux:getDimZ() > b3Raw:getDimZ() - 1.0 then
|
||||
bCross = true
|
||||
dDepth = min( dDepth, b3Raw:getDimZ() / abs( vtExtr:getZ()))
|
||||
@@ -372,28 +377,28 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if nChamfer > 0 and Proc.Grp ~= 0 and dOriDepth > dDepthCham and Proc.Prc ~= 70 then
|
||||
local bDoubleCham = false
|
||||
local dExtra = 2
|
||||
local sChamferDown, sChamferUp
|
||||
if nDouble > 1 and bCanDouble then
|
||||
if nSide == 0 then
|
||||
if BD.DOWN_HEAD then
|
||||
-- recupero la lavorazione
|
||||
local nChamferDown
|
||||
nChamferDown, _, sChamferDown = VerifyChamfer( Proc, AuxId, nRawId, true, true)
|
||||
if nChamferDown < 0 then
|
||||
local sChamferDown, sChamferUp
|
||||
if nDouble > 1 and bCanDouble then
|
||||
if nSide == 0 then
|
||||
if BD.DOWN_HEAD then
|
||||
-- recupero la lavorazione
|
||||
local nChamferDown
|
||||
nChamferDown, _, sChamferDown = VerifyChamfer( Proc, AuxId, nRawId, true, true)
|
||||
if nChamferDown < 0 then
|
||||
sWarn = 'Warning : chamfer from bottom not found in library'
|
||||
sChamferDown = nil
|
||||
EgtOutLog( sWarn)
|
||||
end
|
||||
end
|
||||
local nChamferUp
|
||||
nChamferUp, _, sChamferUp = VerifyChamfer( Proc, AuxId, nRawId, true, false)
|
||||
if nChamferUp < 0 then
|
||||
sWarn = 'Warning : chamfer from bottom not found in library'
|
||||
sChamferDown = nil
|
||||
sChamferUp = nil
|
||||
EgtOutLog( sWarn)
|
||||
end
|
||||
end
|
||||
local nChamferUp
|
||||
nChamferUp, _, sChamferUp = VerifyChamfer( Proc, AuxId, nRawId, true, false)
|
||||
if nChamferUp < 0 then
|
||||
sWarn = 'Warning : chamfer from bottom not found in library'
|
||||
sChamferUp = nil
|
||||
EgtOutLog( sWarn)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- eseguo
|
||||
for i = 1, nStep do
|
||||
-- inserisco la lavorazione
|
||||
@@ -438,9 +443,9 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
end
|
||||
if nSide == 0 then
|
||||
bDoubleCham = EgtIf( sChamferDown and BD.DOWN_HEAD, true, false)
|
||||
bDoubleCham = EgtIf( sChamferDown and BD.DOWN_HEAD, true, false) and bCanDouble
|
||||
else
|
||||
bDoubleCham = true
|
||||
bDoubleCham = bCanDouble
|
||||
end
|
||||
-- assegno affondamento e offset radiale
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepthCham + dExtra)
|
||||
@@ -707,7 +712,8 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
-- eventuale segnalazione ingombro di testa o coda
|
||||
local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ())
|
||||
if Proc.Box:getDimZ() > 0.75 * b3Raw:getDimZ() and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then
|
||||
local dMinZ = max( BD.MIN_HEIGHT, 0.35 * b3Raw:getDimZ())
|
||||
if Proc.Box:getDimZ() > 0.75 * b3Raw:getDimZ() and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinZ then
|
||||
if Proc.Head then
|
||||
local dOffs = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()
|
||||
BL.UpdateHCING( nRawId, dOffs)
|
||||
@@ -732,8 +738,72 @@ local function MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- recupero i dati della curva e del profilo
|
||||
local dDepth = abs( EgtCurveThickness( AuxId))
|
||||
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
||||
--local bToolInv = ( vtExtr:getZ() < -0.1)
|
||||
-- recupero la lavorazione
|
||||
local bDownHead = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1)
|
||||
local bToolInv = ( not bDownHead and vtExtr:getZ() < -0.1 and b3Aux:getDimZ() > b3Raw:getDimZ() - 5)
|
||||
local dExtra = 2
|
||||
|
||||
-- verifico se servono gli smussi. Se lavorazione principale di svuotatura significa che è solo da un lato
|
||||
-- generalmente sono lavorazioni non molto lunghe, quindi non si gestistono gli step
|
||||
-- verifico i parametri Q per profondità smusso e per eseguirlo in esclusiva
|
||||
local nChamfer, dDepthCham, sChamfer = VerifyChamfer( Proc, AuxId, nRawId, true)
|
||||
-- se devo inserire il chamfer
|
||||
if nChamfer > 0 and Proc.Grp ~= 0 and dDepth > dDepthCham and Proc.Prc ~= 70 then
|
||||
-- inserisco la lavorazione
|
||||
local sNameCh = 'Cham_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchId = EgtAddMachining( sNameCh, sChamfer)
|
||||
if not nMchId then
|
||||
local sErr = 'Error adding machining ' .. sNameCh .. '-' .. sChamfer
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
-- se lavorazione da sopra o da sotto
|
||||
if Proc.Grp == 3 then
|
||||
if not bToolInv then
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
else
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
end
|
||||
end
|
||||
if Proc.Grp == 4 then
|
||||
if not bToolInv then
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
else
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||
end
|
||||
end
|
||||
-- assegno affondamento e offset radiale
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepthCham + dExtra)
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
|
||||
-- posizione braccio porta testa
|
||||
local nSCC = MCH_SCC.NONE
|
||||
if not BD.C_SIMM then
|
||||
if Proc.Head then
|
||||
nSCC = MCH_SCC.ADIR_XP
|
||||
elseif Proc.Tail then
|
||||
nSCC = MCH_SCC.ADIR_XM
|
||||
elseif AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then
|
||||
nSCC = MCH_SCC.ADIR_YP
|
||||
elseif vtExtr:getY() > -0.01 then
|
||||
nSCC = MCH_SCC.ADIR_YP
|
||||
else
|
||||
nSCC = MCH_SCC.ADIR_YM
|
||||
end
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchId, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
|
||||
-- recupero la lavorazione di svuotatura
|
||||
local sPocketing = ML.FindPocketing( 'Pocket', nil, dDepth)
|
||||
if not sPocketing then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' pocketing not found in library'
|
||||
|
||||
+95
-11
@@ -8,6 +8,9 @@
|
||||
-- 2022/11/10 Corrette finiture lama per BigSection con trave alta
|
||||
-- 2023/04/20 Per travi alte aggiunti tagli orizzontali per ridurre le dimensioni degli scarti
|
||||
-- 2023/08/02 Corretto calcolo allungamenti/accorciamenti pezzi alti per contemplare anche taglio singolo
|
||||
-- 2023/10/17 Corretto calcolo allungamenti/accorciamenti per evitare lunghezze del percorso negative
|
||||
-- 2024/01/18 Gestiti tagli verticali aggiuntivi per travi larghe.
|
||||
-- 2024/01/22 Nei tagli verticali aggiuntivi si usa ora BD.MAX_LEN_DICE come dimensione (era BD.MAX_DIM_DICE).
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessHeadCut = {}
|
||||
@@ -18,6 +21,7 @@ local BL = require( 'BeamLib')
|
||||
local Fbs = require( 'FacesBySaw')
|
||||
local Cut = require( 'ProcessCut')
|
||||
local Pocket = require( 'FaceByPocket')
|
||||
local Topology = require( 'FeatureTopology')
|
||||
|
||||
EgtOutLog( ' ProcessHeadCut started', 1)
|
||||
|
||||
@@ -150,6 +154,32 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
return true, nil
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- tagli verticali aggiuntivi
|
||||
local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw )
|
||||
local _, dimH = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
|
||||
local nVerticalCuts = ceil( dimH / ( BD.MAX_LEN_DICE)) - 1
|
||||
local dVerticalSliceHeight = dimH / ( nVerticalCuts + 1)
|
||||
-- recupero il diametro dell'utensile
|
||||
local dSawDiam = 400
|
||||
if EgtMdbSetCurrMachining( sCutting) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
|
||||
end
|
||||
end
|
||||
local bOk, sErr
|
||||
-- tagli orizzontali
|
||||
for j = nVerticalCuts, 1, -1 do
|
||||
local nFaceUse = MCH_MILL_FU.PARAL_FRONT
|
||||
local dVerticalCutOffset = dVerticalSliceHeight * -j
|
||||
local bForceTangentLeadInOut = BD.PRESS_ROLLER
|
||||
bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, '', b3Raw, nil, nil, nil, bForceTangentLeadInOut)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
return bOk, sErr
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut)
|
||||
@@ -161,6 +191,8 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
|
||||
local bOkc, sErrC = MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if not bOkc then return bOkc, sErrC end
|
||||
end
|
||||
-- eventuali informazioni sul tipo di finitura
|
||||
local nQ05 = EgtGetInfo( nOriId or GDB_ID.NULL, 'Q05', 'i') or 0
|
||||
-- recupero la lavorazione
|
||||
local sCutting = ML.FindCutting( 'HeadSide')
|
||||
if not sCutting then
|
||||
@@ -208,15 +240,16 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
|
||||
if not bNeedHCut and AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Raw:getMax():getX()) < 10 * GEO.EPS_SMALL then
|
||||
return true
|
||||
end
|
||||
-- determino se più tagli con offset
|
||||
-- determino se lo spessore del materiale da rimuovere è eccessivo e quindi vanno fatti più tagli con offset
|
||||
local nCuts = max( ceil( dOvmHead / (( BD.MAX_LEN_SCRAP_START or BD.MAX_LEN_SCRAP) + 0.5)), 1)
|
||||
local dOffsL = dOvmHead / nCuts
|
||||
local _, dimH, dimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
|
||||
local dMinOvmHeadForAddeddCuts = 10.123
|
||||
-- se taglio per sezioni alte e larghe
|
||||
if bBigSectionCut then
|
||||
if dOvmHead > 0 then
|
||||
local nQ05 = EgtGetInfo( nOriId or GDB_ID.NULL, 'Q05', 'i') or 0
|
||||
-- se finitura con lama
|
||||
if nQ05 == 1 or nQ05 == 0 then
|
||||
if nQ05 < 2 then
|
||||
local dSawThickCheck = dSawThick
|
||||
if dSawThick2 > 0 and bDoubleHorizCut then
|
||||
dSawThickCheck = min( dSawThick, dSawThick2)
|
||||
@@ -229,7 +262,39 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
|
||||
end
|
||||
-- controllo se è necessario un taglio con dicing o si deve proseguire ai casi standard
|
||||
if dMaxElev > dSawThickCheck then
|
||||
local bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, dCurrOvmT)
|
||||
local bOk, sErr
|
||||
-- se trave larga effettuo tagli verticali aggiuntivi
|
||||
if ( dimH > BD.MAX_LEN_DICE) and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) then
|
||||
-- ad ogni offset di taglio dovrò fare prima i tagli verticali e poi i cubetti
|
||||
for i = nCuts, 1, -1 do
|
||||
local nAddGrpId = BL.GetAddGroup( Proc.PartId)
|
||||
-- faccia di taglio all'offset corrente
|
||||
local AddId = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
|
||||
local AddProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, PartId = Proc.PartId}
|
||||
Topology.Classify( AddProc, b3Raw)
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
local vtMove = Vector3d( dCutOffset, 0, 0)
|
||||
EgtMove( AddId, vtMove, GDB_RT.GLOB)
|
||||
-- eventuale faccia di taglio all'offset precedente, per limitare il dicing e evitare di tagliare i cubetti nel vuoto
|
||||
local nLimitingSurf
|
||||
if nCuts > 1 then
|
||||
nLimitingSurf = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
|
||||
local dLastCutOffset = i * dOffsL
|
||||
local vtMoveLimitingSurf = Vector3d( dLastCutOffset - 10 * GEO.EPS_SMALL, 0, 0)
|
||||
EgtMove( nLimitingSurf, vtMoveLimitingSurf, GDB_RT.GLOB)
|
||||
local vtNLimitingSurf = EgtSurfTmFacetNormVersor( nLimitingSurf, 0, GDB_ID.ROOT)
|
||||
if AreSameVectorApprox( X_AX(), vtNLimitingSurf) then EgtInvertSurf( nLimitingSurf) end
|
||||
end
|
||||
-- tagli verticali
|
||||
bOk, sErr = AddVerticalPreCuts( AddProc, sCutting, 0, b3Raw)
|
||||
if not bOk then return bOk, sErr end
|
||||
-- tagli a cubetti con eventuale superficie limitante
|
||||
bOk, sErr = Cut.Make( AddProc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, dCurrOvmT, nil, nLimitingSurf)
|
||||
end
|
||||
-- tagli aggiuntivi non necessari
|
||||
else
|
||||
bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, dCurrOvmT)
|
||||
end
|
||||
return bOk, sErr
|
||||
end
|
||||
-- se finitura con truciolatore
|
||||
@@ -267,17 +332,25 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
|
||||
-- distanza in Y tra il centro della lama e l'intersezione tra la lama stessa e la massima Z della trave, + extra
|
||||
-- se taglio doppio l'intersezione sarà in mezzeria, se taglio singolo sarà all'estremo opposto della trave
|
||||
local dKL = dSawRad - dMaxDepth + EgtIf( bDoubleCut, b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN, b3Raw:getDimY() + BD.CUT_EXTRA)
|
||||
-- lunghezza minima del percorso di lavorazione, in caso accorciamento porti a lunghezza negativa
|
||||
local dMinSawingLength = 5
|
||||
if BD.C_SIMM then
|
||||
dAccEnd = sqrt( dSawRad * dSawRad - dKL * dKL)
|
||||
dAccEnd = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0))
|
||||
-- non posso comunque accorciare più della dimensione della geometria, quindi in caso allungo entrata
|
||||
if dAccEnd > b3Raw:getDimZ() - 100 * GEO.EPS_SMALL then
|
||||
dAccStart = b3Raw:getDimZ() - dAccEnd - dMinSawingLength
|
||||
end
|
||||
else
|
||||
dAccStart = sqrt( dSawRad * dSawRad - dKL * dKL)
|
||||
dAccStart = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0))
|
||||
-- non posso comunque accorciare più della dimensione della geometria, quindi in caso allungo uscita
|
||||
if dAccStart > b3Raw:getDimZ() - 100 * GEO.EPS_SMALL then
|
||||
dAccEnd = b3Raw:getDimZ() - dAccStart - dMinSawingLength
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- per travi alte faccio dei tagli orizzontali aggiuntivi
|
||||
local _, _, dimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
|
||||
local dMinOvmHeadForHorizontalCuts = 10.123
|
||||
local bAreHorizontalCutsNeeded = ( dimV > BD.MAX_LEN_DICE) and not bBigSectionCut and ( dOvmHead > dMinOvmHeadForHorizontalCuts - 10 * GEO.EPS_SMALL)
|
||||
local bAreHorizontalCutsNeeded = ( dimV > BD.MAX_LEN_DICE) and not bBigSectionCut and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL)
|
||||
if bAreHorizontalCutsNeeded then
|
||||
local nHorizontalCuts = ceil( dimV / BD.MAX_DIM_DICE) - 1
|
||||
local dHorizontalSliceHeight = dimV / ( nHorizontalCuts + 1)
|
||||
@@ -287,7 +360,8 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
|
||||
for j = nHorizontalCuts, 1, -1 do
|
||||
local nFaceUse = MCH_MILL_FU.PARAL_DOWN
|
||||
local dHorizontalCutOffset = dHorizontalSliceHeight * -j
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dHorizontalCutOffset, 0, 0, '', b3Raw)
|
||||
local bForceTangentLeadInOut = BD.PRESS_ROLLER
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dHorizontalCutOffset, 0, 0, '', b3Raw, nil, nil, nil, bForceTangentLeadInOut)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
-- se necessario taglio verticale doppio, eseguo l'opposto
|
||||
@@ -317,6 +391,11 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
|
||||
-- eseguo i tagli necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
-- se trave larga effettuo tagli verticali aggiuntivi
|
||||
if ( dimH > BD.MAX_LEN_DICE) and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) then
|
||||
local bOk, sErr = AddVerticalPreCuts( Proc, sCutting, dCutOffset, b3Raw)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, '', b3Raw)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
@@ -345,12 +424,17 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
|
||||
-- eseguo i tagli da sotto necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw)
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw, nil, true)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
-- eseguo i tagli da sopra necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
-- se trave larga effettuo tagli verticali aggiuntivi
|
||||
if ( dimH > BD.MAX_LEN_DICE) and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) then
|
||||
local bOk, sErr = AddVerticalPreCuts( Proc, sCutting, dCutOffset, b3Raw)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_DOWN, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
|
||||
+1717
-131
File diff suppressed because it is too large
Load Diff
+100
-56
@@ -30,6 +30,12 @@
|
||||
-- 2023/05/19 Migliorato calcolo e verifica affondamento per lavorazione con lama con codolo in mezzo.
|
||||
-- 2023/08/01 Ammesso uso lama da sotto fino a N +3deg in verticale.
|
||||
-- 2023/09/26 Modificata chiamata a GetFaceWithMostAdj.
|
||||
-- 2023/10/24 Migliorata spezzatura taglio passante con due spezzoni
|
||||
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
|
||||
-- 2024/01/18 Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile.
|
||||
-- 2024/01/22 Implementata gestione seghe a catena multiple.
|
||||
-- 2024/05/09 In Make, allungamento percorso ingresso per evitare collisioni durante approccio pezzo quando si setta OutRaw=3
|
||||
-- In Make, se non trova fresa per pulizia, da messaggio di warning anziché di errore
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessLongCut = {}
|
||||
@@ -289,7 +295,7 @@ local function MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw, nFacInd, bReduceDe
|
||||
-- laterale sul punto medio della linea in comune
|
||||
local frFc = Frame3d( ptPm, vtN) ;
|
||||
local b3BoxLoc = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frFc)
|
||||
dDepth = b3BoxLoc:getDimZ() or 0
|
||||
local dDepth = b3BoxLoc:getDimZ() or 0
|
||||
-- recupero i dati dell'utensile
|
||||
local dSawDiam = 400
|
||||
local dSawThick = 0
|
||||
@@ -497,11 +503,16 @@ end
|
||||
-- lavorazione faccia laterale con sega a catena
|
||||
local function MakeSideFaceByChainSaw( nSurfId, dDepth, dOffs, dSal, dEal, bShortenStart, bShortenEnd)
|
||||
-- Recupero i dati dell'utensile
|
||||
local sSawing = ML.FindSawing( 'Sawing')
|
||||
local sSawing = ML.FindSawing( 'Sawing', dDepth, true)
|
||||
-- se non trovo alcuna sega a catena lunga a sufficienza, accetto di non arrivare sul fondo
|
||||
if not sSawing then
|
||||
sSawing = ML.FindSawing( 'Sawing', nil, nil, 'Longest')
|
||||
end
|
||||
local dMaxMat = 0
|
||||
local dSawCornerRad = 0
|
||||
local dSawThick = 0
|
||||
local dSawDiameter = 0
|
||||
local sWarn
|
||||
-- se non trova una lavorazione di sawing esco
|
||||
if not sSawing then
|
||||
local sErr = 'Error : Sawing not found in library'
|
||||
@@ -532,7 +543,7 @@ local function MakeSideFaceByChainSaw( nSurfId, dDepth, dOffs, dSal, dEal, bShor
|
||||
local nFaceUse = MCH_MILL_FU.PARAL_DOWN
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
||||
-- imposto angolo 3° asse rot
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1))
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sSawing, 'perpendicular'))
|
||||
local vtN = EgtSurfTmFacetNormVersor( nSurfId, 0, GDB_ID.ROOT)
|
||||
local vtOrtho = BL.GetVersRef( nFaceUse)
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1))
|
||||
@@ -570,7 +581,7 @@ local function MakeSideFaceByChainSaw( nSurfId, dDepth, dOffs, dSal, dEal, bShor
|
||||
return false, sErr
|
||||
end
|
||||
-- impostazione alternativa angolo 3° asse rot
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2))
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sSawing, 'parallel'))
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2))
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
@@ -593,6 +604,11 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
||||
-- recupero l'ingombro del grezzo di appartenenza
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
|
||||
-- recupero lunghezza grezzo totale da info sulla macchinata
|
||||
local dBarLen = EgtGetInfo( EgtGetCurrMachGroup(), 'BARLEN', 'd')
|
||||
local dOvmHead = b3Raw:getMax():getX() - b3Solid:getMax():getX()
|
||||
|
||||
-- dati della faccia
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
local _, dLen, dWidth = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0, GDB_ID.ROOT)
|
||||
@@ -649,6 +665,8 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
||||
-- leggo il parametro Q05 solo se è una vera longcut L010
|
||||
elseif ProcessLongCut.Identify( Proc) then
|
||||
nUseBlade = EgtGetInfo( Proc.Id, 'Q05', 'i') or 0
|
||||
-- funzionamento Q05 --
|
||||
-- 0: fresa; 1: lama solo se feature passante, faccia verso l'alto; 2: lama solo se feature passante, qualunque orientamento faccia; 3: lama con feature sia cieca che passante, faccia verso l'alto, lavorazione non rovina pezzo successivo; 4: lama con feature sia cieca che passante, qualunque orientamento faccia, lavorazione non rovina pezzo successivo
|
||||
end
|
||||
local bForceUseBladeOnNotThruFace
|
||||
if nCustForceUseBladeOnNCF then
|
||||
@@ -951,61 +969,60 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
||||
if bForceUseBladeOnNotThruFace and ( bLimXmin or bLimXmax) then
|
||||
local nCountMilHead = 0
|
||||
-- determino la massima elevazione
|
||||
local dElev = BL.GetFaceElevation( Proc.Id, 0, nPartId)
|
||||
local dElev = BL.GetFaceElevation( Proc, 0, b3Solid)
|
||||
-- recupero la lavorazione
|
||||
local sMilling = ML.FindMilling( 'Long2Cut_H2', dElev, nil, nil, nil, not bCanUseUnderBlade, bCanUseUnderBlade)
|
||||
if not sMilling then
|
||||
local sErr = 'Error : milling Long2Cut (_H2) not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- recupero i dati dell'utensile
|
||||
local dToolDiam = 0
|
||||
local dMaxDepth = 0
|
||||
if EgtMdbSetCurrMachining( sMilling) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
if sMilling then
|
||||
-- recupero i dati dell'utensile
|
||||
local dToolDiam = 0
|
||||
local dMaxDepth = 0
|
||||
if EgtMdbSetCurrMachining( sMilling) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se ho facce di chiusura, per prima cosa faccio antischeggia
|
||||
-- come richiesto da Fabio Squaratti il 03/09/2021
|
||||
if ( bLimXmin and not bForcedLim) or bLimXmax then
|
||||
local bOk, nFacet
|
||||
bMadeASbyBld, bOk, sWarn = ManageAntiSplintBySaw( Proc, b3Raw, (( bLimXmin and not bForcedLim) and bLimXmax), vtN, nFacet, 0, sWarn, bCanUseUnderBlade, nil, sCutting)
|
||||
if not bOk then return false, sWarn end
|
||||
end
|
||||
-- eventuale lavorazione della faccia limitante l'inizio
|
||||
if not bStartFixed then
|
||||
local vtIni = -X_AX()
|
||||
for j = 1, Proc.Fct - 1 do
|
||||
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, j, GDB_ID.ROOT)
|
||||
if vtIni * vtN > 0 and nCountMilHead < 2 then
|
||||
MakeSideFace( Proc.Id, j, nSide, sMilling, dToolDiam, nil, max(dStartDistUp,dStartDistDn), bCanUseUnderBlade)
|
||||
-- se ho facce di chiusura, per prima cosa faccio antischeggia
|
||||
-- come richiesto da Fabio Squaratti il 03/09/2021
|
||||
if ( bLimXmin and not bForcedLim) or bLimXmax then
|
||||
local bMadeASbyBld, bOk, nFacet
|
||||
bMadeASbyBld, bOk, sWarn = ManageAntiSplintBySaw( Proc, b3Raw, (( bLimXmin and not bForcedLim) and bLimXmax), vtN, nFacet, 0, sWarn, bCanUseUnderBlade, nil, sCutting)
|
||||
if not bOk then return false, sWarn end
|
||||
end
|
||||
-- eventuale lavorazione della faccia limitante l'inizio
|
||||
if not bStartFixed then
|
||||
local vtIni = -X_AX()
|
||||
for j = 1, Proc.Fct - 1 do
|
||||
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, j, GDB_ID.ROOT)
|
||||
if vtIni * vtN > 0 and nCountMilHead < 2 then
|
||||
MakeSideFace( Proc.Id, j, nSide, sMilling, dToolDiam, nil, max(dStartDistUp,dStartDistDn), bCanUseUnderBlade)
|
||||
nCountMilHead = nCountMilHead + 1
|
||||
end
|
||||
end
|
||||
if bForcedLim and nCountMilHead < 1 then
|
||||
MakeSideFace( Proc.Id, 0, nSide, sMilling, dToolDiam, bForcedLim, max(dStartDistUp,dStartDistDn), bCanUseUnderBlade)
|
||||
nCountMilHead = nCountMilHead + 1
|
||||
end
|
||||
end
|
||||
if bForcedLim and nCountMilHead < 1 then
|
||||
MakeSideFace( Proc.Id, 0, nSide, sMilling, dToolDiam, bForcedLim, max(dStartDistUp,dStartDistDn), bCanUseUnderBlade)
|
||||
nCountMilHead = nCountMilHead + 1
|
||||
end
|
||||
end
|
||||
|
||||
-- eventuale lavorazione della faccia limitante la fine
|
||||
if not bEndFixed then
|
||||
local vtFin = X_AX()
|
||||
for j = 1, Proc.Fct - 1 do
|
||||
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, j, GDB_ID.ROOT)
|
||||
if vtFin * vtN > 0 and nCountMilHead < 2 then
|
||||
MakeSideFace( Proc.Id, j, nSide, sMilling, dToolDiam, nil, max(dEndDistUp,dEndDistDn), bCanUseUnderBlade)
|
||||
-- eventuale lavorazione della faccia limitante la fine
|
||||
if not bEndFixed then
|
||||
local vtFin = X_AX()
|
||||
for j = 1, Proc.Fct - 1 do
|
||||
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, j, GDB_ID.ROOT)
|
||||
if vtFin * vtN > 0 and nCountMilHead < 2 then
|
||||
MakeSideFace( Proc.Id, j, nSide, sMilling, dToolDiam, nil, max(dEndDistUp,dEndDistDn), bCanUseUnderBlade)
|
||||
nCountMilHead = nCountMilHead + 1
|
||||
end
|
||||
end
|
||||
if bForcedLim and nCountMilHead < 2 then
|
||||
MakeSideFace( Proc.Id, 0, nSide, sMilling, dToolDiam, bForcedLim, max(dEndDistUp,dEndDistDn), bCanUseUnderBlade)
|
||||
nCountMilHead = nCountMilHead + 1
|
||||
end
|
||||
end
|
||||
if bForcedLim and nCountMilHead < 2 then
|
||||
MakeSideFace( Proc.Id, 0, nSide, sMilling, dToolDiam, bForcedLim, max(dEndDistUp,dEndDistDn), bCanUseUnderBlade)
|
||||
nCountMilHead = nCountMilHead + 1
|
||||
end
|
||||
else
|
||||
sWarn = 'Warning: milling Long2Cut (_H2) not found in library'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1169,6 +1186,9 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
||||
EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp)
|
||||
-- imposto posizione braccio porta testa
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
-- imposto angolo 3° asse rot
|
||||
local vtOut = EgtIf( vtN:getX() > 0, X_AX(), -X_AX())
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( EgtIf( bIsTopBladeCurrent, sCutting, sCuttingDn), 'perpendicular', b3Raw, vtN, vtOut))
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
@@ -1197,11 +1217,10 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
||||
if not bChainSawOk then return false, sErr end
|
||||
end
|
||||
end
|
||||
|
||||
-- se non è sotto e non uso fresa di fianco: lavorazione Long2Cut
|
||||
elseif ( nSide ~= - 1 or BD.DOWN_HEAD) and nUseMillOnSide == 0 then
|
||||
-- determino la massima elevazione
|
||||
local dElev = BL.GetFaceElevation( Proc.Id, 0, nPartId)
|
||||
local dElev = BL.GetFaceElevation( Proc, 0, b3Solid)
|
||||
-- recupero la lavorazione
|
||||
local bDownHead = ( nSide == - 1)
|
||||
sMchType = EgtIf( bDownHead, 'Long2Cut_H2', 'Long2Cut')
|
||||
@@ -1311,8 +1330,18 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
||||
dEndAccDist = min( dEndAccDist, dLen/2)
|
||||
dStartAccDist = dLen - dEndAccDist
|
||||
else
|
||||
dStartAccDist = dLen/2
|
||||
dEndAccDist = dStartAccDist
|
||||
-- se c'è del grezzo aggiuntivo e, considerando il grezzo mi resta abbastanza materiale per pinzare, allora faccio spezzatura asimmetrica
|
||||
if BD.MIN_CLAMPING_LEN and ( dBarLen - dLen) > dOvmHead + 100 * GEO.EPS_SMALL and ( dBarLen - dStartAccDist > BD.MIN_CLAMPING_LEN) then
|
||||
dStartAccDist = dBarLen/2
|
||||
dEndAccDist = dLen - dStartAccDist
|
||||
-- se sono sul fronte, la spezzatura assimmetrica è inversa
|
||||
if Proc.AffectedFaces.Front then
|
||||
dStartAccDist, dEndAccDist = dEndAccDist, dStartAccDist
|
||||
end
|
||||
else
|
||||
dStartAccDist = dLen/2
|
||||
dEndAccDist = dStartAccDist
|
||||
end
|
||||
end
|
||||
else
|
||||
nC = 1
|
||||
@@ -1361,9 +1390,9 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ Proc.Id, 0}})
|
||||
|
||||
-- inverto se utensile antiorario per garantire senso di percorrenza migliore
|
||||
local bInvert = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) > 0
|
||||
-- setto workside e eventuale inversione
|
||||
local bInvert
|
||||
if bInvert then
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
@@ -1398,6 +1427,21 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
||||
if k < nO then
|
||||
local sNotes = 'OutRaw=3;'
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
|
||||
-- aumento ingresso su spezzoni per evitare collisione durante approccio pezzo
|
||||
if bFront then
|
||||
-- se invertito si allunga ingresso su tutti tranne su ultimo
|
||||
if bInvert and i ~= nC then
|
||||
EgtSetMachiningParam( MCH_MP.LIPERP, ( nO - k) * dStep + 10)
|
||||
-- se non invertito si allunga solo il primo
|
||||
elseif not bInvert and i == 1 then
|
||||
EgtSetMachiningParam( MCH_MP.LIPERP, ( nO - k) * dStep + 10)
|
||||
end
|
||||
else
|
||||
-- se invertito si allunga ingresso su tutti
|
||||
if bInvert then
|
||||
EgtSetMachiningParam( MCH_MP.LIPERP, ( nO - k) * dStep + 10)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
@@ -1535,7 +1579,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
||||
local dDistToEnd = dToolDiam / 2
|
||||
local dDistToEndDn = dToolDiamDn / 2
|
||||
-- calcolo l'elevazione della faccia principale
|
||||
local dFacElev = BL.GetFaceElevation( Proc.Id, 0, nPartId)
|
||||
local dFacElev = BL.GetFaceElevation( Proc, 0, b3Solid)
|
||||
-- se fresa di fianco o da sotto calcolo quanto l'utensile può andare vicino all'estremo con l'elevazione della faccia minore del raggio utensile
|
||||
if ( nUseMillOnSide <= 1 or nSide == -1) and dFacElev < dToolDiam / 2 then
|
||||
dDistToEnd = sqrt( dFacElev * ( dToolDiam - dFacElev))
|
||||
|
||||
@@ -18,6 +18,12 @@
|
||||
-- 2023/03/06 Correzione per i casi con lavorazione limitata.
|
||||
-- 2023/03/23 Correzione per caso con doppia lama da sotto.
|
||||
-- 2023/06/07 Sistemazione SCC per macchina TURN
|
||||
-- 2023/10/24 Migliorata spezzatura taglio passante con due spezzoni
|
||||
-- 2023/10/25 Se effettivamente un taglio longitudinale e lama non taglia completamente, limito la lavorazione. Altrimenti esco.
|
||||
-- 2023/11/24 Aggiunta Q05 per utilizzo lama anche in feature cieche conme per LongCut.
|
||||
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
|
||||
-- 2024/01/18 Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile.
|
||||
-- 2024/03/21 Corretto parametro passato a funzione BL.GetBlockedAxis. Ora tiene in considerazione anche testa sotto
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessLong2Cut = {}
|
||||
@@ -31,6 +37,7 @@ EgtOutLog( ' ProcessLongDoubleCut started', 1)
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local ML = require( 'MachiningLib')
|
||||
local Topology = require( 'FeatureTopology')
|
||||
|
||||
local dLimMinPiece = BD.LEN_SHORT_PART or 1000
|
||||
|
||||
@@ -311,12 +318,20 @@ end
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster, nUseSideToolMaster)
|
||||
|
||||
-- recupero l'ingombro del grezzo di appartenenza
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
-- carico i dati delle face già inserite nelle opportune tabelle
|
||||
local nFaceLimit, tFaceLong, ptC, vtN = IdentifyFaces( Proc)
|
||||
local dLen = Proc.Box:getDimX()
|
||||
|
||||
-- inizializzazione tabella con eventuali lavorazioni create a posteriori da ritornare al chiamante
|
||||
local AddedIds = {}
|
||||
|
||||
-- recupero lunghezza grezzo totale da info sulla macchinata
|
||||
local dBarLen = EgtGetInfo( EgtGetCurrMachGroup(), 'BARLEN', 'd')
|
||||
local dOvmHead = b3Raw:getMax():getX() - b3Solid:getMax():getX()
|
||||
|
||||
-- verifico posizione (+1=sopra, -1=sotto, 0=sui lati)
|
||||
local nSide = 0
|
||||
if vtN[1]:getZ() > 0.0175 and vtN[2]:getZ() > 0.0175 then
|
||||
@@ -360,11 +375,28 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
----------------------------------------------------------------------------------------------------------------------------------------
|
||||
local bUseBlade
|
||||
local nUseMillOnSide
|
||||
local bForceUseBladeOnNotThruFace
|
||||
-- se presenti utilizzo i parametri dell'eventuale lua "padre"
|
||||
if bForcedBladeMaster ~= nil then
|
||||
bUseBlade = bForcedBladeMaster
|
||||
else
|
||||
bUseBlade = EgtGetInfo( Proc.Id, 'Q01', 'i') == 1
|
||||
local nUseBlade = EgtGetInfo( Proc.Id, 'Q05', 'i')
|
||||
-- funzionamento Q05 --
|
||||
-- 0: fresa; 1: lama solo se feature passante, faccia verso l'alto; 2: lama solo se feature passante, qualunque orientamento faccia; 3: lama con feature sia cieca che passante, faccia verso l'alto, lavorazione non rovina pezzo successivo; 4: lama con feature sia cieca che passante, qualunque orientamento faccia, lavorazione non rovina pezzo successivo
|
||||
-- feature passante
|
||||
if nFaceLimit == 0 then
|
||||
if nUseBlade == 2 or nUseBlade == 4 or
|
||||
( nSide == 1 and ( nUseBlade == 1 or nUseBlade == 3)) then
|
||||
bUseBlade = true
|
||||
end
|
||||
-- feature cieca
|
||||
else
|
||||
if nUseBlade == 4 or
|
||||
( nSide == 1 and ( nUseBlade == 3)) then
|
||||
bUseBlade = true
|
||||
bForceUseBladeOnNotThruFace = true
|
||||
end
|
||||
end
|
||||
end
|
||||
if nUseSideToolMaster ~= nil then
|
||||
nUseMillOnSide = nUseSideToolMaster
|
||||
@@ -411,8 +443,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
_, _, vWidth[1] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[1])
|
||||
_, _, vWidth[2] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[2])
|
||||
|
||||
-- Se senza facce limitanti, da sopra o ( da tutte i lati con testa da sotto) e taglio di lama e lunghezza facce maggiore del parametro lunghezza minima
|
||||
if nFaceLimit == 0 and ( bCanUseUnderBlade or bCanUseBlade) and bUseBlade and Proc.Box:getDimX() > dLimMinPiece - 1 then
|
||||
-- Se da sopra o ( da tutte i lati con testa da sotto) e taglio di lama e lunghezza facce maggiore del parametro lunghezza minima
|
||||
if ( bCanUseUnderBlade or bCanUseBlade) and bUseBlade and Proc.Box:getDimX() > dLimMinPiece - 1 then
|
||||
|
||||
local sCutting
|
||||
local dToolDiam = 0
|
||||
@@ -458,23 +490,36 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se la distanza dal pezzo successivo è inferiore della metà lama, do un warning
|
||||
if ( bCanUseBlade or bCanUseUnderBlade) and ( dDistToNextPiece < dToolDiam/2 or dDistToNextPiece < dToolDiamDn/2) then
|
||||
sWarn = 'Warning : Cut machining can damage next piece'
|
||||
EgtOutLog( sWarn)
|
||||
-- se la fine (a sinistra) non è limitata e ho un pezzo successivo o grezzo riutilizzabile meno distante di metà raggio, setto la fine come limitata
|
||||
if (( bCanUseBlade or bCanUseUnderBlade) and ( dDistToNextPiece < dToolDiam/2 or dDistToNextPiece < dToolDiamDn/2)) and nFaceLimit < 2 then
|
||||
if bForceUseBladeOnNotThruFace then
|
||||
nFaceLimit = nFaceLimit | 2
|
||||
bForcedLim = true
|
||||
else
|
||||
sWarn = 'Warning on saw cut : Cut machining can damage next piece'
|
||||
EgtOutLog( sWarn)
|
||||
end
|
||||
end
|
||||
-- determino gli estremi
|
||||
local dStartAccDist
|
||||
local dEndAccDist
|
||||
local bStartFixed
|
||||
local bEndFixed
|
||||
local dStartDist
|
||||
local dEndDist
|
||||
local dStartDistUp = 0
|
||||
local dEndDistUp = 0
|
||||
local dStartDistDn = 0
|
||||
local dEndDistDn = 0
|
||||
local dStartAccDistUp = BD.LONGCUT_ENDLEN
|
||||
local dEndAccDistUp = BD.LONGCUT_ENDLEN
|
||||
local dStartAccDistDn = BD.LONGCUT_ENDLEN
|
||||
local dEndAccDistDn = BD.LONGCUT_ENDLEN
|
||||
local nC
|
||||
local dC
|
||||
|
||||
local dC
|
||||
local nCUp
|
||||
local dCUp
|
||||
|
||||
-- determino numero di parti
|
||||
if bCanUseBlade then
|
||||
nCUp = ceil( ( dLen - dStartAccDistUp - dEndAccDistUp) / BD.LONGCUT_MAXLEN)
|
||||
@@ -562,7 +607,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
local nFaceUse
|
||||
local nFaceUse
|
||||
local nFaceUse2
|
||||
-- se ho solo lama da sotto
|
||||
if bCanUseUnderBlade and not bCanUseBlade then
|
||||
@@ -590,8 +635,47 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
elseif vtN[vOrd[j]]:getZ() < -0.707 then
|
||||
nFaceSide = -1
|
||||
end
|
||||
-- ricavo box della faccia
|
||||
-- ricavo informazioni della faccia
|
||||
local b3Fac = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vOrd[j]-1, GDB_BB.STANDARD)
|
||||
-- determino accorciamenti se lavorazione cieca
|
||||
if bForceUseBladeOnNotThruFace then
|
||||
if bCanUseBlade then
|
||||
bStartFixed = true
|
||||
-- limitato a destra
|
||||
if ( nFaceLimit & 1) ~= 0 then
|
||||
local dRadius = dToolDiam / 2
|
||||
local dCat1 = dRadius - dOffset
|
||||
dStartDistUp = sqrt( ( dRadius * dRadius) - (dCat1 * dCat1))
|
||||
bStartFixed = false
|
||||
end
|
||||
bEndFixed = true
|
||||
-- limitato a sinistra
|
||||
if ( nFaceLimit & 2) ~= 0 then
|
||||
local dRadius = dToolDiam / 2
|
||||
local dCat1 = dRadius - dOffset
|
||||
dEndDistUp = sqrt( ( dRadius * dRadius) - (dCat1 * dCat1))
|
||||
bEndFixed = false
|
||||
end
|
||||
end
|
||||
if bCanUseUnderBlade then
|
||||
bStartFixed = true
|
||||
-- limitato a destra
|
||||
if ( nFaceLimit & 1) ~= 0 then
|
||||
local dRadius = dToolDiamDn / 2
|
||||
local dCat1 = dRadius - dOffset
|
||||
dStartDistDn = sqrt( ( dRadius * dRadius) - (dCat1 * dCat1))
|
||||
bStartFixed = false
|
||||
end
|
||||
bEndFixed = true
|
||||
-- limitato a sinistra
|
||||
if ( nFaceLimit & 2) ~= 0 then
|
||||
local dRadius = dToolDiamDn / 2
|
||||
local dCat1 = dRadius - dOffset
|
||||
dEndDistDn = sqrt( ( dRadius * dRadius) - (dCat1 * dCat1))
|
||||
bEndFixed = false
|
||||
end
|
||||
end
|
||||
end
|
||||
-- ciclo sulle passate
|
||||
for k = 1, 2 do
|
||||
local dLioPerp = ( vWidth[vOrd[j]] - dDimStrip) / 2 + BD.CUT_SIC
|
||||
@@ -608,6 +692,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
-- setto le variabili delle distanze dagli estremi
|
||||
dEndAccDist = dEndAccDistUp
|
||||
dStartAccDist = dStartAccDistUp
|
||||
dStartDist = dStartDistUp
|
||||
dEndDist = dEndDistUp
|
||||
elseif bCanUseUnderBlade and not bCanUseBlade then
|
||||
sNameF = 'L2CD_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM)
|
||||
nMchFId = EgtAddMachining( sNameF, sCuttingDn)
|
||||
@@ -615,6 +701,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
-- setto le variabili delle distanze dagli estremi
|
||||
dEndAccDist = dEndAccDistDn
|
||||
dStartAccDist = dStartAccDistDn
|
||||
dStartDist = dStartDistDn
|
||||
dEndDist = dEndDistDn
|
||||
bMachDown = true
|
||||
-- entrambe le possibilità di lama
|
||||
else
|
||||
@@ -627,6 +715,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
-- setto le variabili delle distanze dagli estremi
|
||||
dEndAccDist = dEndAccDistDn
|
||||
dStartAccDist = dStartAccDistDn
|
||||
dStartDist = dStartDistDn
|
||||
dEndDist = dEndDistDn
|
||||
bMachDown = true
|
||||
-- se di fronte e prima faccia o dietro e seconda faccia, sta lavorando quella più in basso in Z (posizione)
|
||||
elseif ( ( bFront and j == 1) or ( not bFront and j == 2)) and k == 2 then
|
||||
@@ -636,6 +726,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
-- setto le variabili delle distanze dagli estremi
|
||||
dEndAccDist = dEndAccDistDn
|
||||
dStartAccDist = dStartAccDistDn
|
||||
dStartDist = dStartDistDn
|
||||
dEndDist = dEndDistDn
|
||||
bMachDown = true
|
||||
-- se di fronte e seconda faccia o dietro e prima faccia, sta lavorando la faccia più in alto in Z (posizione)
|
||||
elseif ( ( bFront and j == 2) or ( not bFront and j == 1)) and k == 1 then
|
||||
@@ -645,6 +737,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
-- setto le variabili delle distanze dagli estremi
|
||||
dEndAccDist = dEndAccDistUp
|
||||
dStartAccDist = dStartAccDistUp
|
||||
dStartDist = dStartDistUp
|
||||
dEndDist = dEndDistUp
|
||||
-- se di fronte e seconda faccia o dietro e prima faccia, sta lavorando la faccia più in alto in Z (posizione)
|
||||
elseif ( ( bFront and j == 2) or ( not bFront and j == 1)) and k == 2 then
|
||||
sNameF = 'L2C_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM)
|
||||
@@ -653,6 +747,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
-- setto le variabili delle distanze dagli estremi
|
||||
dEndAccDist = dEndAccDistUp
|
||||
dStartAccDist = dStartAccDistUp
|
||||
dStartDist = dStartDistUp
|
||||
dEndDist = dEndDistUp
|
||||
end
|
||||
end
|
||||
if not nMchFId then
|
||||
@@ -700,8 +796,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
|
||||
-- settaggio di workside, uso faccia e eventuale inversione
|
||||
-- limito opportunamente la lavorazione
|
||||
local dSalInner, dSalOuter = - dEndAccDist - ( i - 2) * dC, 0
|
||||
local dEalInner, dEalOuter = - dStartAccDist - ( nC - i - 1) * dC, 0
|
||||
local dSalInner, dSalOuter = - dEndAccDist - ( i - 2) * dC, -dEndDist
|
||||
local dEalInner, dEalOuter = - dStartAccDist - ( nC - i - 1) * dC, -dStartDist
|
||||
local dSal = EgtIf( i == 1, dSalOuter, dSalInner)
|
||||
local dEal = EgtIf( i == nC, dEalOuter, dEalInner)
|
||||
if ( bFront and k == 1) or ( not bFront and k == 2) then
|
||||
@@ -742,11 +838,13 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
|
||||
-- recupero alcune informazioni utili dalla lavorazione attuale
|
||||
local bIsCurrentBladeCCW
|
||||
local sCuttingNameMach
|
||||
if bIsTopBladeCurrent then
|
||||
EgtMdbSetCurrMachining( sCutting)
|
||||
sCuttingNameMach = sCutting
|
||||
else
|
||||
EgtMdbSetCurrMachining( sCuttingDn)
|
||||
sCuttingNameMach = sCuttingDn
|
||||
end
|
||||
EgtMdbSetCurrMachining( sCuttingNameMach)
|
||||
bIsCurrentBladeCCW = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0
|
||||
|
||||
-- imposto la direzione di lavoro per avere scarico del truciolo ottimale
|
||||
@@ -787,6 +885,9 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp)
|
||||
-- imposto posizione braccio porta testa per non ingombrare agli estremi
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
-- imposto angolo 3° asse rot
|
||||
local vtOut = EgtIf( vtN[vOrd[j]]:getX() > 0, X_AX(), -X_AX())
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCuttingNameMach, 'perpendicular', b3Raw, vtN, vtOut))
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
@@ -809,6 +910,43 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
end
|
||||
end
|
||||
end
|
||||
-- eventuali puliture impronta lama
|
||||
for j = 1, #vOrd do
|
||||
if bForceUseBladeOnNotThruFace then
|
||||
-- determino la massima elevazione
|
||||
local dElev = 0
|
||||
local dFacElev1 = BL.GetFaceElevation( Proc, tFaceLong[1], b3Solid)
|
||||
local dFacElev2 = BL.GetFaceElevation( Proc, tFaceLong[2], b3Solid)
|
||||
dElev = max( dFacElev1, dFacElev2)
|
||||
-- recupero la lavorazione
|
||||
local sMilling
|
||||
local bDownHead = ( nSide == -1 and BD.DOWN_HEAD)
|
||||
sMilling = ML.FindMilling( 'Long2Cut', dElev, nil, nil, nil, not bDownHead, bDownHead)
|
||||
if not sMilling then
|
||||
local sErr = 'Error : Long2Cut not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- recupero i dati dell'utensile
|
||||
local dToolDiam = 0
|
||||
local dMaxDepth = 0
|
||||
if EgtMdbSetCurrMachining( sMilling) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
end
|
||||
-- eventuale lavorazione della faccia limitante l'inizio (a destra)
|
||||
if not bStartFixed then
|
||||
MakeSideFace( Proc.Id, tFaceLong[vOrd[j]], 1, j, sMilling, dToolDiam, nSide, bIsAnyFaceUpsideDown)
|
||||
end
|
||||
-- eventuale lavorazione della faccia limitante la fine (a sinistra)
|
||||
if not bEndFixed then
|
||||
MakeSideFace( Proc.Id, tFaceLong[vOrd[j]], -1, j, sMilling, dToolDiam, nSide, bIsAnyFaceUpsideDown)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- altrimenti concavo
|
||||
else
|
||||
-- si percorrono i lati alto e basso della faccia
|
||||
@@ -840,6 +978,22 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- se effettivamente un taglio longitudinale e lama non taglia completamente, limito la lavorazione. Altrimenti esco.
|
||||
local dCheckDepth = 0
|
||||
if bCanUseBlade then
|
||||
dCheckDepth = dMaxDepth
|
||||
elseif bCanUseUnderBlade then
|
||||
dCheckDepth = dMaxDepthDn
|
||||
end
|
||||
if vWidth[vOrd[j]] + 100 * GEO.EPS_SMALL > dCheckDepth then
|
||||
if not( ProcessLong2Cut.Identify( Proc)) then
|
||||
return false
|
||||
else
|
||||
local sWarn2 = 'Warning in ' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. ' : elevation (' .. EgtNumToString( vWidth[vOrd[j]], 1) .. ') bigger than max saw depth (' .. EgtNumToString( dCheckDepth, 1) .. ')'
|
||||
if not sWarn then sWarn = '' end
|
||||
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2)
|
||||
end
|
||||
end
|
||||
-- se lama da sotto verifico se la componente Y della profondità di taglio supera la capacità della lama
|
||||
if nSide <= 0 and bCanUseUnderBlade then
|
||||
if ( vWidth[vOrd[j]] / 2) > dMaxDepthDn then
|
||||
@@ -851,16 +1005,27 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
-- ciclo sulle passate
|
||||
local dOffset
|
||||
local dLioPerp
|
||||
|
||||
if j == 1 then -- il primo taglio lo faccio completo se angolo interno maggiore di 90
|
||||
local dMinOffsBigFace = max( vWidth[vOrd[j]] - dCheckDepth, 0)
|
||||
-- se la faccia è più grande del massimo materiale lama, allora limito lavorazione
|
||||
if dMinOffsBigFace > 0 then
|
||||
dOffset = dMinOffsBigFace
|
||||
-- se angolo interno inferiore di 90° calcolo l'arretramento della lama + un piccolo delta di 0.3
|
||||
if dAng < - ( 90 + 10 * GEO.EPS_SMALL) then
|
||||
elseif dAng < - ( 90 + 10 * GEO.EPS_SMALL) then
|
||||
dOffset = 0.3 + ((dToolThick* vtN[vOrd[1]]) * vtN[vOrd[2]] * vtN[vOrd[2]]):len()
|
||||
else
|
||||
dOffset = 0
|
||||
end
|
||||
dLioPerp = vWidth[vOrd[j]] + BD.CUT_SIC
|
||||
else -- il secondo ridotto della distanza minima e della componente spessore della lama
|
||||
dOffset = dDimStrip + ((dToolThick* vtN[vOrd[1]]) - (dToolThick* vtN[vOrd[1]]) * vtN[vOrd[2]] * vtN[vOrd[2]]):len()
|
||||
local dMinOffsBigFace = max( vWidth[vOrd[j]] - dCheckDepth, 0)
|
||||
-- se la faccia è più grande del massimo materiale lama, allora limito lavorazione
|
||||
if dMinOffsBigFace > 0 then
|
||||
dOffset = dMinOffsBigFace
|
||||
else
|
||||
dOffset = dDimStrip + ((dToolThick* vtN[vOrd[1]]) - (dToolThick* vtN[vOrd[1]]) * vtN[vOrd[2]] * vtN[vOrd[2]]):len()
|
||||
end
|
||||
dLioPerp = vWidth[vOrd[j]] - dOffset + BD.CUT_SIC
|
||||
end
|
||||
local dLioTang = 0
|
||||
@@ -913,9 +1078,27 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
EgtSetMachiningParam( MCH_MP.LOTANG, dLioTang)
|
||||
EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp)
|
||||
-- imposto posizione braccio porta testa per non ingombrare agli estremi
|
||||
local ptP1LineToMachine, _, ptP2LineToMachine = EgtSurfTmFacetOppositeSide( Proc.Id, vOrd[j] - 1, BL.GetVersRef( vFaceUse[vOrd[j]]), GDB_ID.ROOT)
|
||||
local vtTg = ptP2LineToMachine - ptP1LineToMachine ; vtTg:normalize()
|
||||
local bIsMachiningInverted = EgtGetMachiningParam( MCH_MP.INVERT)
|
||||
if bIsMachiningInverted then
|
||||
vtTg = -vtTg
|
||||
end
|
||||
if BD.C_SIMM then
|
||||
if abs( vtN[vOrd[j]]:getX()) < GEO.EPS_SMALL then
|
||||
nSCC = EgtIf( ( vtTg:getX() > GEO.EPS_SMALL), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
|
||||
else
|
||||
nSCC = MCH_SCC.NONE
|
||||
end
|
||||
else
|
||||
nSCC = EgtIf( ( i == 1 or i == nC - 1), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
-- determino e imposto l'utilizzo della faccia
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse[vOrd[j]])
|
||||
-- imposto angolo 3° asse rot
|
||||
local vtOut = EgtIf( vtN[vOrd[j]]:getX() > 0, X_AX(), -X_AX())
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( EgtIf( bCanUseUnderBlade, sCuttingDn, sCutting), 'perpendicular', b3Raw, vtN, vtOut))
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
@@ -930,9 +1113,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
elseif ( nSide ~= -1 or BD.DOWN_HEAD or BD.TURN) and nUseMillOnSide == 0 then
|
||||
-- determino la massima elevazione
|
||||
local dElev = 0
|
||||
local dFacElev1 = BL.GetFaceElevation( Proc.Id, tFaceLong[1], nPartId)
|
||||
local dFacElev2 = BL.GetFaceElevation( Proc.Id, tFaceLong[2], nPartId)
|
||||
-- 03/12/2020
|
||||
local dFacElev1 = BL.GetFaceElevation( Proc, tFaceLong[1], b3Solid)
|
||||
local dFacElev2 = BL.GetFaceElevation( Proc, tFaceLong[2], b3Solid)
|
||||
-- se facce concave e a 90 gradi, prendo l'elevazione minima
|
||||
if bOrtho then
|
||||
dElev = min( dFacElev1, dFacElev2)
|
||||
@@ -1048,8 +1230,14 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
dEndAccDist = min( dEndAccDist, dLen/2)
|
||||
dStartAccDist = dLen - dEndAccDist
|
||||
else
|
||||
dStartAccDist = dLen/2
|
||||
dEndAccDist = dStartAccDist
|
||||
-- se c'è del grezzo aggiuntivo e, considerando il grezzo mi resta abbastanza materiale per pinzare, allora faccio spezzatura asimmetrica
|
||||
if BD.MIN_CLAMPING_LEN and ( dBarLen - dLen) > dOvmHead + 100 * GEO.EPS_SMALL and ( dBarLen - dStartAccDist > BD.MIN_CLAMPING_LEN) then
|
||||
dStartAccDist = dBarLen/2
|
||||
dEndAccDist = dLen - dStartAccDist
|
||||
else
|
||||
dStartAccDist = dLen/2
|
||||
dEndAccDist = dStartAccDist
|
||||
end
|
||||
end
|
||||
else
|
||||
nC = 1
|
||||
@@ -1089,6 +1277,11 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
end
|
||||
end
|
||||
end
|
||||
if Proc.bMoveAfterSplit then
|
||||
nC = 1
|
||||
dStartDist = Proc.Box:getDimX() - ( dToolDiam / 2 + 5)
|
||||
dEndDist = - ( dToolDiam / 2 + 5)
|
||||
end
|
||||
if nIni == 2 then
|
||||
dStartDist, dEndDist = dEndDist, dStartDist
|
||||
dStartAccDist, dEndAccDist = dEndAccDist, dStartAccDist
|
||||
@@ -1200,6 +1393,19 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
end
|
||||
end
|
||||
end
|
||||
if not Proc.MoveAfterSplit and not bEndFixed and not bConvex then
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error : missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
local AddId = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
|
||||
local AddProc = { Id = AddId, Grp = 0, Prc = 12, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, PartId = Proc.PartId, bMoveAfterSplit = true}
|
||||
Topology.Classify( AddProc, b3Raw)
|
||||
table.insert( AddedIds, AddProc)
|
||||
end
|
||||
|
||||
-- altrimenti lavorazione di fianco : Long2CutSide o Long2CutDown
|
||||
else
|
||||
@@ -1296,8 +1502,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
local dDistToEnd = dToolDiam / 2
|
||||
local dDistToEndDn = dToolDiamDn / 2
|
||||
-- calcolo l'elevazione della faccia principale
|
||||
local dFacElev1 = BL.GetFaceElevation( Proc.Id, tFaceLong[vOrd[1]], nPartId)
|
||||
local dFacElev2 = BL.GetFaceElevation( Proc.Id, tFaceLong[vOrd[2]], nPartId)
|
||||
local dFacElev1 = BL.GetFaceElevation( Proc, tFaceLong[vOrd[1]], b3Solid)
|
||||
local dFacElev2 = BL.GetFaceElevation( Proc, tFaceLong[vOrd[2]], b3Solid)
|
||||
-- se fresa di fianco o da sotto calcolo quanto l'utensile può andare vicino al limite se l'elevazione della faccia è minore del raggio utensile
|
||||
if nUseMillOnSide <= 1 or nSide == -1 then
|
||||
local dFacElev = max( dFacElev1, dFacElev2)
|
||||
@@ -1615,7 +1821,6 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
sWarn = 'Warning in LongDoubleCut : depth (' .. EgtNumToString( vWidth[vOrd[i]] + dAgg, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepthDn - dCollSic, 1) .. ')'
|
||||
end
|
||||
dDepth = min( dMaxDepthDn - dCollSic, vWidth[vOrd[i]] + dAgg)
|
||||
dDepth2 = vWidth[vOrd[i]] + dAgg - dDepth
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth - dExtraElev)
|
||||
else
|
||||
dCollSic = max( BD.COLL_SIC, ( dThDiam - dToolDiam) / 2 * EgtIf( abs(dNz) < GEO.EPS_SMALL, 1, abs( EgtIf( abs(vtN[vOrd[i]]:getY()) >= abs(vtN[vOrd[i]]:getZ()), vtN[vOrd[i]]:getZ(), vtN[vOrd[i]]:getY()) / dNz)))
|
||||
@@ -1623,7 +1828,6 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
sWarn = 'Warning in LongDoubleCut : depth (' .. EgtNumToString( vWidth[vOrd[i]] + dAgg, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth - dCollSic, 1) .. ')'
|
||||
end
|
||||
dDepth = min( dMaxDepth - dCollSic, vWidth[vOrd[i]] + dAgg)
|
||||
dDepth2 = vWidth[vOrd[i]] + dAgg - dDepth
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth - dExtraElev)
|
||||
end
|
||||
-- eseguo
|
||||
@@ -1644,8 +1848,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
end
|
||||
end
|
||||
|
||||
return true, sWarn
|
||||
end
|
||||
return true, sWarn, nil, AddedIds
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
return ProcessLong2Cut
|
||||
|
||||
+105
-5
@@ -13,6 +13,9 @@
|
||||
-- 2023/06/27 Esclusa la ricerca lati aperti per le mortase passanti, per le quali il contorno finisce sulla faccia e il riconoscimento sbaglia.
|
||||
-- 2023/07/21 Correzioni per mortise passanti con curva Aux che guarda in basso.
|
||||
-- 2023/08/10 Modificata scelta SCC per tasche in Y+/- in coda o quasi.
|
||||
-- 2024/01/18 Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile.
|
||||
-- 2024/02/28 Forzata SPIRAL_IN se c'è anche un solo lato aperto
|
||||
-- 2024/03/05 Aggiunta possibilità di inserire lavorazione di smusso
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessMortise = {}
|
||||
@@ -28,6 +31,9 @@ EgtOutLog( ' ProcessMortise started', 1)
|
||||
local BD = require( 'BeamData')
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
-- variabili assegnazione parametri Q
|
||||
local Q_DEPTH_CHAMFER = 'Q02' -- d
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
function ProcessMortise.Identify( Proc)
|
||||
@@ -122,11 +128,11 @@ end
|
||||
local nFaceUse = BL.GetNearestParalOpposite( vtN)
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
||||
-- applico il parametro plunge, che setta la lavorazione per affondare solamente, senza lavorare tutto il contorno; 1: solo lato iniziale, 2: solo lato finale, 3: entrambi
|
||||
sNotes = 'Plunge=3;'
|
||||
local sNotes = 'Plunge=3;'
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
|
||||
-- imposto angolo 3° asse rot
|
||||
local vtOrtho = BL.GetVersRef( nFaceUse)
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1))
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sMortising, 'perpendicular'))
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1))
|
||||
-- calcolo la lavorazione
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
@@ -136,7 +142,7 @@ end
|
||||
return false, sErr
|
||||
end
|
||||
-- impostazione alternativa angolo 3° asse rot
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2))
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sMortising, 'parallel'))
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2))
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
@@ -275,7 +281,36 @@ function ProcessMortise.VerifyMortiseOrPocket( Proc, dDiam, dDepth, dMaxTotLen,
|
||||
return sPocketing, dMaxDepth, dToolDiam
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
---------------------------------------------------------------------
|
||||
local function VerifyChamfer( Proc, AuxId, nRawId, bMakeVertCham, bDownHead)
|
||||
local nChamfer = 0
|
||||
-- ingombro del grezzo
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- verifico che lo smusso sia richiesto
|
||||
local dDepth = EgtGetInfo( Proc.Id, Q_DEPTH_CHAMFER, 'd') or 0
|
||||
if dDepth > 0 then
|
||||
nChamfer = 1
|
||||
end
|
||||
|
||||
-- recupero la lavorazione
|
||||
local sMilling
|
||||
if nChamfer > 0 then
|
||||
if bDownHead then
|
||||
sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true)
|
||||
else
|
||||
sMilling = ML.FindMilling( 'Mark')
|
||||
end
|
||||
if not sMilling then
|
||||
local sErr = 'Error : Mark not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return -1, 0, sErr
|
||||
end
|
||||
end
|
||||
|
||||
return nChamfer, dDepth, sMilling
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- ingombro del pezzo
|
||||
@@ -382,7 +417,8 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptCutC, vtCutN, b3Solid, GDB_RT.GLOB)
|
||||
local b3Cut = EgtGetBBoxGlob( AddId or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp - 2, Prc = 10, Box = b3Cut, Fct = 1, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bFromBottom = ( b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getZ() > 0.25)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH, bFromBottom)
|
||||
if not bOk then return bOk, sErr end
|
||||
@@ -403,6 +439,63 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
local bPockUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259)
|
||||
local bPockDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174)
|
||||
local bPockAngTrasm = ( BD.ANG_TRASM and vtExtr:getZ() < -0.1)
|
||||
|
||||
-- recupero i dati della curva e del profilo
|
||||
local dDepth = dMorH
|
||||
local bDownHead = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1)
|
||||
local bToolInv = ( not bDownHead and vtExtr:getZ() < -0.1 and Proc.Box:getDimZ() > b3Solid:getDimZ() - 5)
|
||||
local dExtra = 2
|
||||
|
||||
-- verifico se servono gli smussi. Se lavorazione principale di svuotatura significa che è solo da un lato
|
||||
-- generalmente sono lavorazioni non molto lunghe, quindi non si gestistono gli step
|
||||
-- verifico i parametri Q per profondità smusso e per eseguirlo in esclusiva
|
||||
local nChamfer, dDepthCham, sChamfer = VerifyChamfer( Proc, AuxId, nRawId, true)
|
||||
-- se devo inserire il chamfer
|
||||
if nChamfer > 0 and Proc.Grp ~= 0 and dDepth > dDepthCham then
|
||||
-- inserisco la lavorazione
|
||||
local sNameCh = 'Cham_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchId = EgtAddMachining( sNameCh, sChamfer)
|
||||
if not nMchId then
|
||||
local sErr = 'Error adding machining ' .. sNameCh .. '-' .. sChamfer
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
if not bToolInv then
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
else
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
end
|
||||
-- assegno affondamento e offset radiale
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepthCham + dExtra - dMorH)
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
|
||||
-- posizione braccio porta testa
|
||||
local nSCC = MCH_SCC.NONE
|
||||
if not BD.C_SIMM then
|
||||
if Proc.Head then
|
||||
nSCC = MCH_SCC.ADIR_XP
|
||||
elseif Proc.Tail then
|
||||
nSCC = MCH_SCC.ADIR_XM
|
||||
elseif AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then
|
||||
nSCC = MCH_SCC.ADIR_YP
|
||||
elseif vtExtr:getY() > -0.01 then
|
||||
nSCC = MCH_SCC.ADIR_YP
|
||||
else
|
||||
nSCC = MCH_SCC.ADIR_YM
|
||||
end
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchId, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
|
||||
-- recupero la lavorazione
|
||||
local sPockType = 'Mortise'
|
||||
local sMchExt = ''
|
||||
@@ -462,6 +555,13 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if bRevertSide then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
end
|
||||
|
||||
-- se ho anche solo un lato aperto, forzo SPIRAL-IN
|
||||
local vOpen = EgtGetInfo( AuxId, 'OPEN', 'vi')
|
||||
if vOpen and #vOpen > 0 then
|
||||
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN)
|
||||
end
|
||||
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
-- sistemo la direzione di lavoro
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
|
||||
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
|
||||
-- 2022/11/03 Correzione per riconoscimento testa da sotto su fresatura.
|
||||
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessProfCamb = {}
|
||||
@@ -285,7 +286,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- aggiungo piano di sgrossatura e lo lavoro
|
||||
local ptStart, vtNP = GetSawCutData( AuxId, vtNF)
|
||||
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
|
||||
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
|
||||
if AddId and BL.GetFaceElevation( AddId, 0, b3Solid) > 20.0 then
|
||||
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
|
||||
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
|
||||
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
|
||||
@@ -306,7 +307,8 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- altrimenti applico taglio di lama
|
||||
else
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if not bOk then
|
||||
return false, sErr
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
|
||||
-- 2023/05/25 Sistemazione SCC per TURN.
|
||||
-- 2023/07/31 Correzione e semplificazione di ModifySideInvertLead per invert.
|
||||
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessProfConcave = {}
|
||||
@@ -289,7 +290,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- aggiungo piano di sgrossatura e lo lavoro
|
||||
local ptStart, vtNP = GetSawCutData( AuxId, vtN)
|
||||
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
|
||||
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
|
||||
if AddId and BL.GetFaceElevation( AddId, 0, b3Solid) > 20.0 then
|
||||
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
|
||||
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
|
||||
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
|
||||
@@ -310,7 +311,8 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- altrimenti applico taglio di lama
|
||||
else
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if not bOk then
|
||||
return false, sErr
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
|
||||
-- 2023/05/25 Sistemazione SCC per TURN.
|
||||
-- 2023/07/31 Correzione e semplificazione di ModifySideInvertLead per invert.
|
||||
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessProfConvex = {}
|
||||
@@ -289,7 +290,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- aggiungo piano di sgrossatura e lo lavoro
|
||||
local ptStart, vtNP = GetSawCutData( AuxId, vtN)
|
||||
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
|
||||
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
|
||||
if AddId and BL.GetFaceElevation( AddId, 0, b3Solid) > 20.0 then
|
||||
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
|
||||
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
|
||||
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
|
||||
@@ -310,7 +311,8 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- altrimenti applico taglio di lama
|
||||
else
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if not bOk then
|
||||
return false, sErr
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
|
||||
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
|
||||
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
|
||||
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessProfFront = {}
|
||||
@@ -236,7 +237,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- aggiungo piano di sgrossatura e lo lavoro
|
||||
local ptStart, vtNP = GetSawCutData( AuxId, vtN)
|
||||
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
|
||||
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
|
||||
if AddId and BL.GetFaceElevation( AddId, 0, b3Solid) > 20.0 then
|
||||
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
|
||||
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
|
||||
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
|
||||
@@ -257,7 +258,8 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- altrimenti applico taglio di lama
|
||||
else
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if not bOk then
|
||||
return false, sErr
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
|
||||
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
|
||||
-- 2023/07/31 Correzione e semplificazione di ModifySideInvertLead per invert.
|
||||
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessProfHead = {}
|
||||
@@ -271,7 +272,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- aggiungo piano di sgrossatura e lo lavoro
|
||||
local ptStart, vtNP = GetSawCutData( AuxId, vtN)
|
||||
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
|
||||
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
|
||||
if AddId and BL.GetFaceElevation( AddId, 0, b3Solid) > 20.0 then
|
||||
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
|
||||
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
|
||||
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
|
||||
@@ -292,7 +293,8 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- altrimenti applico taglio di lama
|
||||
else
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if not bOk then
|
||||
return false, sErr
|
||||
|
||||
@@ -10,6 +10,7 @@ local BL = require( 'BeamLib')
|
||||
local Fbs = require( 'FacesBySaw')
|
||||
local Cut = require( 'ProcessCut')
|
||||
local DC = require( 'DiceCut')
|
||||
local LapJoint = require( 'ProcessLapJoint')
|
||||
|
||||
EgtOutLog( ' ProcessRidgeLap started', 1)
|
||||
|
||||
@@ -48,6 +49,7 @@ end
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local nForceUseBladeOnNotContinueFace = EgtGetInfo( Proc.Id, 'Q04', 'i') or 0
|
||||
-- recupero l'ingombro del grezzo di appartenenza
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- ingombro del pezzo
|
||||
@@ -132,9 +134,17 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- applico taglio di lama
|
||||
local b3Cut = EgtGetBBoxGlob( AddId or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Cut, Fct = 1, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, false)
|
||||
if not bOk then return bOk, sErr end
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
if BL.IsCutNeeded( CutProc, b3Raw, dOvmHead) then
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, false)
|
||||
if not bOk then return bOk, sErr end
|
||||
elseif nForceUseBladeOnNotContinueFace > 0 then
|
||||
EgtSurfTmRemoveFacet( Proc.Id, vFaceOrd[1] - 1)
|
||||
Proc.Fct = Proc.Fct - 1
|
||||
Proc.Face = BL.GetFacetsInfo( Proc, b3Raw)
|
||||
return LapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- recupero gruppo per geometria addizionale
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- ProcessRoundArch.lua by Egaltech s.r.l. 2023/05/18
|
||||
-- ProcessRoundArch.lua by Egaltech s.r.l. 2023/12/07
|
||||
-- Gestione calcolo archi per Travi
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
@@ -118,10 +118,13 @@ function ProcessRoundArch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
-- recupero i dati dell'utensile
|
||||
local dMaxDepth = 0
|
||||
local bCW = true
|
||||
if EgtMdbSetCurrMachining( sMilling) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
local dSpeed = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) or 0
|
||||
bCW = ( dSpeed >= 0)
|
||||
end
|
||||
end
|
||||
-- ne verifico la lunghezza per eventuale spezzatura e lavorazione in doppio
|
||||
@@ -180,6 +183,10 @@ function ProcessRoundArch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se lavorazione in doppio senza codolo, aggiungo sovrapposizione
|
||||
if nDouble == 2 and dDimStrip < 10 * GEO.EPS_SMALL then
|
||||
dDepth = dDepth + BD.MILL_OVERLAP / 2
|
||||
end
|
||||
-- se utensile orizzontale verso Y+, non in doppio e codolo da lasciare, devo invertire per lavorare sempre da Y-
|
||||
if vtExtr:getY() > 0.707 and nDouble == 1 and bStripOnSide then
|
||||
bToolInv = true
|
||||
@@ -188,7 +195,7 @@ function ProcessRoundArch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
for i = 1, nStep do
|
||||
for j = 1, nDouble do
|
||||
-- inserisco la lavorazione
|
||||
local sName = 'Free_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local sName = 'Arch_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchId = EgtAddMachining( sName, sMilling)
|
||||
if not nMchId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
@@ -212,20 +219,19 @@ function ProcessRoundArch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
end
|
||||
-- se seconda passata, inverto direzione di lavoro
|
||||
if j == 2 then
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
if ( j == 1 and not bToolInv) or ( j == 2 and bToolInv) then
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false))
|
||||
else
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, false, true))
|
||||
end
|
||||
-- assegno affondamento
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||
-- assegno lato di lavoro
|
||||
if bToolInv then
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||
else
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
||||
end
|
||||
-- assegno lato di lavoro (per avere lavorazione climb)
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT))
|
||||
-- posizione braccio porta testa
|
||||
local nSCC = MCH_SCC.NONE
|
||||
if not BD.C_SIMM and not BD.TURN then
|
||||
nSCC = MCH_SCC.ADIR_XP
|
||||
if Proc.Head then
|
||||
nSCC = MCH_SCC.ADIR_XP
|
||||
elseif Proc.Tail then
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
-- Gestione calcolo taglio di lama per Travi
|
||||
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe).
|
||||
-- 2022/12/19 Aggiunta gestione testa da sotto.
|
||||
-- 2024/01/18 Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessSawCut = {}
|
||||
@@ -229,6 +230,9 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
-- imposto uso della faccia
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
||||
-- imposto angolo 3° asse rot
|
||||
local vtOut = EgtIf( vtN:getX() > 0, X_AX(), -X_AX())
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCutting, 'perpendicular', b3Raw, vtN, vtOut))
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
|
||||
-- 2022/07/12 Aggiunta gestione PF1250 e TURN.
|
||||
-- 2023/02/14 Gestite le rotazioni di 90 deg nell'aggiornamento del grezzo.
|
||||
-- 2024/09/03 In ApplyDiceCut, se possibile, i tagli paralleli sono fatti con un unico passaggio di fianco.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessScarfJoint = {}
|
||||
@@ -134,7 +135,9 @@ end
|
||||
local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Solid, ptC, vtN, Proc, vtRef, bHead, sCutting, dSawDiam, b3Raw, dNewDiceDim)
|
||||
|
||||
local bOk = true
|
||||
local bOk2 = true
|
||||
local sErr = ''
|
||||
local sErr2 = ''
|
||||
|
||||
local vCuts = {}
|
||||
if nGoodFace1 and nGoodFace4 and nGoodFace1 > 0 and nGoodFace4 > 0 then
|
||||
@@ -185,9 +188,49 @@ local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Soli
|
||||
-- extra taglio
|
||||
local dExtraCut = EgtIf( i % 2 == 1, 0, BD.CUT_EXTRA)
|
||||
-- lavoro la faccia
|
||||
for j = 1, #vCuts[i] do
|
||||
bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
if not bOk then return bOk, sErr end
|
||||
local dMaxDepth = 0
|
||||
if EgtMdbSetCurrMachining( sCutting) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
end
|
||||
|
||||
local dDiceFaceMaxH = 0
|
||||
local dDiceFaceMinH = GEO.INFINITO
|
||||
if ( i % 2) == 0 then
|
||||
for cont = 1, #vCuts[i] do
|
||||
local _, dDiceFaceH, dDiceFaceV = BL.GetFaceHvRefDim( vCuts[i][cont], 0)
|
||||
dDiceFaceMaxH = max( dDiceFaceMaxH, dDiceFaceH)
|
||||
-- calcolo lato orizzontale minore ipotizzando sia un trapezio
|
||||
local dDiceFaceH2 = ( 2 * EgtSurfArea( vCuts[i][cont]) ) / dDiceFaceV - dDiceFaceH
|
||||
dDiceFaceMinH = min( dDiceFaceMinH, dDiceFaceH2)
|
||||
end
|
||||
end
|
||||
-- se si può fare, faccio unico taglio parallelo
|
||||
if ( i % 2) == 0 and ( dMaxDepth > dDiceFaceMaxH - 0.5 * dDiceFaceMinH + BD.CUT_EXTRA_MIN) then
|
||||
local bDoubleCut = false
|
||||
local dCutExtra = BD.CUT_EXTRA
|
||||
if dMaxDepth < dDiceFaceMaxH + BD.CUT_EXTRA then
|
||||
bDoubleCut = true
|
||||
dCutExtra = - 0.5 * dDiceFaceMinH + BD.CUT_EXTRA_MIN
|
||||
end
|
||||
local nSurfToCut = EgtSurfTmBySewing( nAddGrpId, vCuts[i], false)
|
||||
local nFaceUseCut1, nFaceUseCut2 = MCH_MILL_FU.ORTHO_BACK, MCH_MILL_FU.ORTHO_FRONT
|
||||
if Proc.Tail then
|
||||
nFaceUseCut1, nFaceUseCut2 = nFaceUseCut2, nFaceUseCut1
|
||||
end
|
||||
if bDoubleCut then
|
||||
bOk, sErr = Fbs.MakeOne( nSurfToCut, 0, sCutting, dSawDiam, nFaceUseCut1, nil, dCutExtra, BD.CUT_SIC, 0, 0, 0, '', b3Raw, true)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
bOk2, sErr2 = Fbs.MakeOne( nSurfToCut, 0, sCutting, dSawDiam, nFaceUseCut2, nil, dCutExtra, BD.CUT_SIC, 0, 0, 0, '', b3Raw)
|
||||
if not bOk2 then return false, sErr2 end
|
||||
else
|
||||
for j = 1, #vCuts[i] do
|
||||
bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- lavoro la faccia interna in ogni caso
|
||||
@@ -201,7 +244,7 @@ local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Soli
|
||||
if vFaceOrd[3] ~= 0 then
|
||||
-- inserisco la lavorazione
|
||||
local vtOrthoO = Vector3d( vtRef)
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[3] - 1, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[3] - 1, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
-- 2022/08/09 Ora se la feature ha meno di due facce viene richiamata la normale Cut.
|
||||
-- 2022/11/09 Aggiunta gestione parametro Q04 per forzare utilizzo fresa di lato e lavorare come FreeContour.
|
||||
-- 2023/02/14 Gestite le rotazioni di 90 deg nell'aggiornamento del grezzo.
|
||||
-- 2024/08/05 Se assimilabile ad un taglio (1 faccia) si considerare area non pinzabile testa/coda
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessSimpleScarf = {}
|
||||
@@ -148,7 +149,7 @@ function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmT
|
||||
-- se ci sono meno di due facce si riduce a una normale Cut
|
||||
local nFacetCnt = EgtSurfTmFacetCount( Proc.Id)
|
||||
if nFacetCnt < 2 then
|
||||
local bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, nil, nil, nil, nil, dOvmTail)
|
||||
local bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, nil, nil, nil, nil, dOvmTail, true)
|
||||
return bOk, sErr
|
||||
end
|
||||
-- dati delle facce
|
||||
|
||||
+187
-57
@@ -13,6 +13,13 @@
|
||||
-- 2023/05/09 Aggiunta richiesta risalita preliminare a Zmax per tagli da sopra su macchine PF e ONE.
|
||||
-- 2023/06/13 Corrette note Precut e Cut per tagli aggiuntivi orizzontali.
|
||||
-- 2023/08/02 Corretto calcolo allungamenti/accorciamenti pezzi alti per contemplare anche taglio singolo.
|
||||
-- 2023/10/17 Corretto calcolo allungamenti/accorciamenti per evitare lunghezze del percorso negative.
|
||||
-- 2024/01/18 Gestita lama con aggregato con asse bloccato per massimizzare capacità di taglio verticale, se da sotto
|
||||
-- Implementato split per pezzi molto alti con mix sega a catena + lama
|
||||
-- Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile.
|
||||
-- 2024/01/22 Nei tagli verticali aggiuntivi si usa ora BD.MAX_LEN_DICE come dimensione (era BD.MAX_DIM_DICE).
|
||||
-- 2024/01/23 Nello split con sega a catena ora si cerca di preferenza una lavorazione di tipo 'SawingForSplitting'. Se non trovata si cerca il tipo 'Sawing' come in precedenza.
|
||||
-- In split con sega a catena aggiunta estensione start/end del percorso se utensile lungo, per evitare collisioni con il pezzo durante rotazione.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessSplit = {}
|
||||
@@ -23,6 +30,7 @@ local BL = require( 'BeamLib')
|
||||
local Fbs = require( 'FacesBySaw')
|
||||
local Cut = require( 'ProcessCut')
|
||||
local Pocket = require( 'FaceByPocket')
|
||||
local Topology = require( 'FeatureTopology')
|
||||
|
||||
EgtOutLog( ' ProcessSplit started', 1)
|
||||
|
||||
@@ -157,9 +165,8 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- lavorazione con sega a catena per sezioni alte e larghe
|
||||
local function MakeSplitByChainSaw( nSurfId, nFaceUse, dDepth, sNotes, dOffs)
|
||||
local function MakeSplitByChainSaw( nSurfId, sSawing, nFaceUse, dDepth, sNotes, dOffs, bExtendStartEnd)
|
||||
-- Recupero i dati dell'utensile
|
||||
local sSawing = ML.FindSawing( 'Sawing')
|
||||
local dMaxMat = 0
|
||||
local dSawCornerRad = 0
|
||||
local dSawThick = 0
|
||||
@@ -193,15 +200,21 @@ local function MakeSplitByChainSaw( nSurfId, nFaceUse, dDepth, sNotes, dOffs)
|
||||
-- imposto uso del lato faccia
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
||||
-- imposto angolo 3° asse rot
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1))
|
||||
local _, vtN = EgtSurfTmFacetCenter( nSurfId, 0, GDB_ID.ROOT)
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sSawing, 'perpendicular'))
|
||||
local vtN = EgtSurfTmFacetNormVersor( nSurfId, 0, GDB_ID.ROOT)
|
||||
local vtOrtho = BL.GetVersRef( nFaceUse)
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1))
|
||||
-- imposto offset radiale per mantenere il materiale in coda per la finitura
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
|
||||
-- imposto allungamento percorso iniziale e finale a zero
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, 0)
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, 0)
|
||||
-- imposto eventuale allungamento percorso iniziale
|
||||
local dStartAddLen = 0
|
||||
local dEndAddLen = 0
|
||||
if bExtendStartEnd then
|
||||
dStartAddLen = 100
|
||||
dEndAddLen = 100
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dStartAddLen)
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
|
||||
-- faccio in modo che l'attacco della lama sia dal lato opposto rispetto al corpo macchina
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||
@@ -223,7 +236,7 @@ local function MakeSplitByChainSaw( nSurfId, nFaceUse, dDepth, sNotes, dOffs)
|
||||
return false, sErr
|
||||
end
|
||||
-- impostazione alternativa angolo 3° asse rot
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2))
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sSawing, 'parallel'))
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2))
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
@@ -240,12 +253,38 @@ local function MakeSplitByChainSaw( nSurfId, nFaceUse, dDepth, sNotes, dOffs)
|
||||
return true, sName, nMchFId
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- tagli verticali aggiuntivi
|
||||
local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw, sNotes)
|
||||
local _, dimH = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
|
||||
local nVerticalCuts = ceil( dimH / ( BD.MAX_LEN_DICE)) - 1
|
||||
local dVerticalSliceHeight = dimH / ( nVerticalCuts + 1)
|
||||
-- recupero il diametro dell'utensile
|
||||
local dSawDiam = 400
|
||||
if EgtMdbSetCurrMachining( sCutting) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
|
||||
end
|
||||
end
|
||||
local bOk, sErr
|
||||
-- tagli verticali
|
||||
for j = nVerticalCuts, 1, -1 do
|
||||
local nFaceUse = MCH_MILL_FU.PARAL_FRONT
|
||||
local dVerticalCutOffset = dVerticalSliceHeight * -j
|
||||
local bForceTangentLeadInOut = BD.PRESS_ROLLER
|
||||
bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, sNotes, b3Raw, nil, nil, nil, bForceTangentLeadInOut)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
return bOk, sErr
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dOvmTail)
|
||||
-- impostazione default a variabili aggiunte
|
||||
if not BD.OVM_CHAIN_HBEAM then BD.OVM_CHAIN_HBEAM = 8 end
|
||||
if not BD.C_SIMM_ENC then BD.C_SIMM_ENC = 180 end
|
||||
if not BD.C_SIMM_ENC then BD.C_SIMM_ENC = EgtIf( BD.C_SIMM, 180, 90) end
|
||||
-- ingombro del grezzo
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- inserimento smussi
|
||||
@@ -263,35 +302,35 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
||||
end
|
||||
-- recupero i dati dell'utensile
|
||||
local dSawDiam = 400
|
||||
local dMaxDepth = 50
|
||||
local dSawMaxDepth = 50
|
||||
local dSawThick = 2
|
||||
if EgtMdbSetCurrMachining( sCutting) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
dSawMaxDepth = EgtTdbGetCurrToolMaxDepth() or dSawMaxDepth
|
||||
dSawThick = EgtTdbGetCurrToolParam(MCH_TP.THICK) or dSawThick
|
||||
end
|
||||
end
|
||||
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
|
||||
local dMaxVertDepth = dSawMaxDepth - ( BD.DECR_VERT_CUT or 0)
|
||||
-- recupero la eventuale lavorazione con lama da sotto
|
||||
local sCutting2 = ML.FindCutting( 'TailSide_H2', false, true)
|
||||
-- recupero i dati della eventuale seconda lama
|
||||
local dSawDiam2 = 0
|
||||
local dMaxDepth2 = 0
|
||||
local dSawMaxDepth2 = 0
|
||||
local dSawThick2 = 0
|
||||
if sCutting2 and EgtMdbSetCurrMachining( sCutting2) then
|
||||
local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
|
||||
dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2
|
||||
dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
|
||||
dSawMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dSawMaxDepth2
|
||||
dSawThick2 = EgtTdbGetCurrToolParam(MCH_TP.THICK) or dSawThick2
|
||||
end
|
||||
end
|
||||
-- caratteristiche taglio
|
||||
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM))
|
||||
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dSawMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM))
|
||||
local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and
|
||||
( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dMaxDepth2) - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
|
||||
( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dSawMaxDepth2) - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
|
||||
local bHorizCut = ( ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and ( b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA))
|
||||
local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
|
||||
local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
|
||||
@@ -306,12 +345,14 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
||||
local dLenEndRaw = dOvmTail
|
||||
local nCuts = 1
|
||||
local dOffsL = 0
|
||||
local _, dimH, dimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
|
||||
local dMinTailScrapForAdditionalCuts = 10.123
|
||||
if not bSplit then
|
||||
-- cerco grezzo successivo che sia nella fase
|
||||
if nNextRawId and EgtVerifyRawPartPhase( nNextRawId, nPhase) then
|
||||
local b3NextRaw = EgtGetRawPartBBox( nNextRawId)
|
||||
dLenEndRaw = ptC:getX() - b3NextRaw:getMin():getX()
|
||||
nCuts = ceil( dLenEndRaw / ( BD.MAX_LEN_SCRAP + 0.5))
|
||||
nCuts = ceil( dLenEndRaw / ( EgtIf( bBigSectionCut, BD.MAX_DIM_DICE - 0.1, BD.MAX_LEN_SCRAP + 0.5)))
|
||||
dOffsL = dLenEndRaw / nCuts
|
||||
-- aggiorno ingombro del grezzo corrente con quello del successivo
|
||||
b3Raw:Add( b3NextRaw)
|
||||
@@ -322,56 +363,93 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
||||
if bBigSectionCut then
|
||||
local bFinishingNeeded = false
|
||||
if bSplit then
|
||||
-- recupero lunghezza massima di lavoro della sega a catena
|
||||
local sSawing = ML.FindSawing( 'Sawing')
|
||||
local dMaxMat = 0
|
||||
local dTlen = 0
|
||||
-- recupero dati utensile della sega a catena più lunga a disposizione
|
||||
local sSawing = ML.FindSawing( 'SawingForSplitting', nil, nil, 'Longest')
|
||||
if not sSawing then
|
||||
sSawing = ML.FindSawing( 'Sawing', nil, nil, 'Longest')
|
||||
end
|
||||
local dChainSawMaxMat = 0
|
||||
local dChainSawLen = 0
|
||||
if EgtMdbSetCurrMachining( sSawing or '') then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
|
||||
dTLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dTLen
|
||||
dChainSawMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dChainSawMaxMat
|
||||
dChainSawLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dChainSawLen
|
||||
end
|
||||
end
|
||||
|
||||
local bigSectionSplitType
|
||||
-- se pezzo non troppo alto, taglio singolo da sopra
|
||||
if b3Raw:getDimZ() + BD.CUT_EXTRA_MIN < dChainSawMaxMat + 10 * GEO.EPS_SMALL then
|
||||
bigSectionSplitType = "single horizontal"
|
||||
-- se pezzo non troppo largo, taglio singolo da davanti
|
||||
elseif b3Raw:getDimY() + BD.CUT_EXTRA_MIN < min( dChainSawMaxMat, dChainSawLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then
|
||||
bigSectionSplitType = "single vertical"
|
||||
-- se pezzo non troppo largo, tagli dai due fianchi (dietro e davanti)
|
||||
elseif 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN < min( dChainSawMaxMat, dChainSawLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then
|
||||
bigSectionSplitType = "double vertical"
|
||||
-- altrimenti taglio con sega a catena da sopra e con lama da sotto
|
||||
elseif BD.DOWN_HEAD and ( b3Raw:getDimZ() + BD.CUT_EXTRA_MIN < dSawMaxDepth2 + dChainSawMaxMat + 10 * GEO.EPS_SMALL) then
|
||||
bigSectionSplitType = "double horizontal"
|
||||
end
|
||||
|
||||
-- assegno offset in lunghezza
|
||||
local dOffs = 0
|
||||
if dOvmTail > BD.OVM_CHAIN_HBEAM then
|
||||
dOffs = dOvmTail - BD.OVM_CHAIN_HBEAM
|
||||
bFinishingNeeded = true
|
||||
end
|
||||
-- se pezzo non troppo alto, taglio singolo da sopra
|
||||
if b3Raw:getDimZ() < dMaxMat - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL then
|
||||
local cutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN
|
||||
sNotesSplit = 'Split;'
|
||||
bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_TOP, cutDepth, sNotesSplit, dOffs)
|
||||
if not bOk then return bOk, sErr, nNewPhase end
|
||||
-- se pezzo non troppo largo, taglio singolo da davanti
|
||||
elseif b3Raw:getDimY() + BD.CUT_EXTRA_MIN < min( dMaxMat, dTLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then
|
||||
local cutDepth = b3Raw:getDimY() + BD.CUT_EXTRA_MIN
|
||||
sNotesSplit = 'Split;'
|
||||
bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_FRONT, cutDepth, sNotesSplit, dOffs)
|
||||
if not bOk then return bOk, sErr, nNewPhase end
|
||||
-- altrimenti tagli dai due fianchi (dietro e davanti)
|
||||
else
|
||||
local cutDepth = 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN
|
||||
-- se la sega a catena non può completare lo split esco
|
||||
if cutDepth >= min( dMaxMat, dTLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then
|
||||
sErr = 'Error : section too big for splitting'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr, -1
|
||||
|
||||
-- in base alle scelte precedenti, applico le lavorazioni
|
||||
if bigSectionSplitType == "single horizontal" then
|
||||
local dCutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN
|
||||
local sNotesSplit = 'Split;'
|
||||
-- verifico se sega a catena lunga e devo quindi estendere ingresso e uscita perchè è probabile che non riesca a ruotare sopra al pezzo
|
||||
local bExtendStartEnd
|
||||
local dMinLengthLongChainSaw = 630
|
||||
if dChainSawLen > dMinLengthLongChainSaw - 10 * GEO.EPS_SMALL then
|
||||
bExtendStartEnd = true
|
||||
end
|
||||
local bOk, sErr = MakeSplitByChainSaw( Proc.Id, sSawing, MCH_MILL_FU.PARAL_TOP, dCutDepth, sNotesSplit, dOffs, bExtendStartEnd)
|
||||
if not bOk then return bOk, sErr, nNewPhase end
|
||||
elseif bigSectionSplitType == "single vertical" then
|
||||
local dCutDepth = b3Raw:getDimY() + BD.CUT_EXTRA_MIN
|
||||
local sNotesSplit = 'Split;'
|
||||
local bOk, sErr = MakeSplitByChainSaw( Proc.Id, sSawing, MCH_MILL_FU.PARAL_FRONT, dCutDepth, sNotesSplit, dOffs)
|
||||
if not bOk then return bOk, sErr, nNewPhase end
|
||||
elseif bigSectionSplitType == "double vertical" then
|
||||
local dCutDepth = 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN
|
||||
local sNotesSplit = 'Presplit;'
|
||||
local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_BACK, cutDepth, sNotesSplit, dOffs)
|
||||
local bOk, sErr = MakeSplitByChainSaw( Proc.Id, sSawing, MCH_MILL_FU.PARAL_BACK, dCutDepth, sNotesSplit, dOffs)
|
||||
if not bOk then return bOk, sErr, nNewPhase end
|
||||
sNotesSplit = 'Split;'
|
||||
bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_FRONT, cutDepth, sNotesSplit, dOffs)
|
||||
bOk, sErr = MakeSplitByChainSaw( Proc.Id, sSawing, MCH_MILL_FU.PARAL_FRONT, dCutDepth, sNotesSplit, dOffs)
|
||||
if not bOk then return bOk, sErr, nNewPhase end
|
||||
elseif bigSectionSplitType == "double horizontal" then
|
||||
-- sega a catena da sopra
|
||||
local dChainSawCutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN - dSawMaxDepth2
|
||||
local sNotesSplit = 'Presplit;'
|
||||
local bOk, sErr = MakeSplitByChainSaw( Proc.Id, sSawing, MCH_MILL_FU.PARAL_TOP, dChainSawCutDepth, sNotesSplit, dOffs)
|
||||
if not bOk then return bOk, sErr, nNewPhase end
|
||||
-- lama da sotto
|
||||
local dCutExtra = -dChainSawCutDepth + BD.CUT_EXTRA_MIN
|
||||
local dVzLimDwnUp
|
||||
if BD.TURN then dVzLimDwnUp = -2 end
|
||||
local sNotes = 'Split;'
|
||||
local bMaximizeVerticalDepth = true
|
||||
bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dOffs, 0, 0, sNotes, b3Raw, nil, bMaximizeVerticalDepth)
|
||||
if not bOk then return false, sErr end
|
||||
-- se è comunque troppo grande per essere separato, esco
|
||||
else
|
||||
local sErr = 'Error : section too big for splitting'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr, -1
|
||||
end
|
||||
-- se necessaria finitura, creo nuova fase
|
||||
if bFinishingNeeded then
|
||||
BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET)
|
||||
nNewPhase = EgtGetCurrPhase()
|
||||
nDispId = EgtGetPhaseDisposition( nNewPhase)
|
||||
local nDispId = EgtGetPhaseDisposition( nNewPhase)
|
||||
if sDownOrSideOrStd == 'down' then
|
||||
EgtRotateRawPart( nRawId, X_AX(), 180)
|
||||
EgtSetInfo( nDispId, 'TYPE', 'MID2')
|
||||
@@ -414,10 +492,41 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
||||
dMaxElev = Proc.Box:getMax():getX() - b3Raw:getMin():getX()
|
||||
end
|
||||
-- se finitura con lama
|
||||
if nQ05 == 1 or nQ05 == 0 or ( not bSplit and dMaxElev > dSawThickCheck) then
|
||||
if nQ05 < 2 or ( not bSplit and dMaxElev > dSawThickCheck) then
|
||||
-- controllo se è necessario un taglio con dicing o si deve proseguire ai casi standard
|
||||
if bSplit or dMaxElev > dSawThickCheck then
|
||||
local bOk, sErr = Cut.Make( Proc, nNewPhase, nRawId, nPartId, dMaxElev, nil, false, true, b3Raw, sNotes, dCurrOvmT)
|
||||
local bOk, sErr
|
||||
if not bSplit and ( dimH > BD.MAX_LEN_DICE) and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) then
|
||||
-- ad ogni offset di taglio dovrò fare prima i tagli verticali e poi i cubetti
|
||||
for i = nCuts, 1, -1 do
|
||||
local nAddGrpId = BL.GetAddGroup( Proc.PartId)
|
||||
-- faccia di taglio all'offset corrente
|
||||
local AddId = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
|
||||
local AddProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, PartId = Proc.PartId}
|
||||
Topology.Classify( AddProc, b3Raw)
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
local vtMoveSurf = Vector3d( -dCutOffset, 0, 0)
|
||||
EgtMove( AddId, vtMoveSurf, GDB_RT.GLOB)
|
||||
-- eventuale faccia di taglio all'offset precedente, per limitare il dicing e evitare di tagliare i cubetti nel vuoto
|
||||
local nLimitingSurf
|
||||
if nCuts > 1 then
|
||||
nLimitingSurf = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
|
||||
local dLastCutOffset = i * dOffsL
|
||||
local vtMoveLimitingSurf = Vector3d( -dLastCutOffset + 10 * GEO.EPS_SMALL, 0, 0)
|
||||
EgtMove( nLimitingSurf, vtMoveLimitingSurf, GDB_RT.GLOB)
|
||||
local vtNLimitingSurf = EgtSurfTmFacetNormVersor( nLimitingSurf, 0, GDB_ID.ROOT)
|
||||
if AreOppositeVectorApprox( X_AX(), vtNLimitingSurf) then EgtInvertSurf( nLimitingSurf) end
|
||||
end
|
||||
-- tagli verticali
|
||||
bOk, sErr = AddVerticalPreCuts( AddProc, sCutting, 0, b3Raw, sNotes)
|
||||
if not bOk then return bOk, sErr end
|
||||
-- tagli a cubetti con eventuale superficie limitante
|
||||
bOk, sErr = Cut.Make( AddProc, nNewPhase, nRawId, nPartId, dMaxElev, nil, false, true, b3Raw, sNotes, dCurrOvmT, nil, nLimitingSurf)
|
||||
end
|
||||
-- tagli aggiuntivi non necessari
|
||||
else
|
||||
bOk, sErr = Cut.Make( Proc, nNewPhase, nRawId, nPartId, dMaxElev, nil, false, true, b3Raw, sNotes, dCurrOvmT)
|
||||
end
|
||||
if sNotesFinal then
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotesFinal)
|
||||
end
|
||||
@@ -466,22 +575,30 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
||||
elseif b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL or b3Raw:getDimY() < 2 * BD.MAX_DIM_HTCUT_HBEAM + 10 * GEO.EPS_SMALL then
|
||||
dCutExtra = EgtIf( bDoubleCut, - 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN, BD.CUT_EXTRA)
|
||||
else
|
||||
dCutExtra = - ( b3Raw:getDimY() - dMaxDepth)
|
||||
dCutExtra = - ( b3Raw:getDimY() - dSawMaxDepth)
|
||||
local dSawRad = dSawDiam / 2
|
||||
-- distanza in Y tra il centro della lama e l'intersezione tra la lama stessa e la massima Z della trave, + extra
|
||||
-- se taglio doppio l'intersezione sarà in mezzeria, se taglio singolo sarà all'estremo opposto della trave
|
||||
local dKL = dSawRad - dMaxDepth + EgtIf( bDoubleCut, b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN, b3Raw:getDimY() + BD.CUT_EXTRA)
|
||||
local dKL = dSawRad - dSawMaxDepth + EgtIf( bDoubleCut, b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN, b3Raw:getDimY() + BD.CUT_EXTRA)
|
||||
-- lunghezza minima del percorso di lavorazione, in caso accorciamento porti a lunghezza negativa
|
||||
local dMinSawingLength = 5
|
||||
if BD.C_SIMM then
|
||||
dAccEnd = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0))
|
||||
-- non posso comunque accorciare più della dimensione della geometria, quindi in caso allungo entrata
|
||||
if dAccEnd > b3Raw:getDimZ() - 100 * GEO.EPS_SMALL then
|
||||
dAccStart = b3Raw:getDimZ() - dAccEnd - dMinSawingLength
|
||||
end
|
||||
else
|
||||
dAccStart = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0))
|
||||
-- non posso comunque accorciare più della dimensione della geometria, quindi in caso allungo uscita
|
||||
if dAccStart > b3Raw:getDimZ() - 100 * GEO.EPS_SMALL then
|
||||
dAccEnd = b3Raw:getDimZ() - dAccStart - dMinSawingLength
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- per travi alte faccio faccio dei tagli orizzontali aggiuntivi
|
||||
local _, _, dimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
|
||||
local dMinTailScrapForHorizontalCuts = 10.123
|
||||
local bAreHorizontalCutsNeeded = not bSplit and ( dimV > BD.MAX_LEN_DICE) and not bBigSectionCut and ( dLenEndRaw > dMinTailScrapForHorizontalCuts - 10 * GEO.EPS_SMALL)
|
||||
local bAreHorizontalCutsNeeded = not bSplit and ( dimV > BD.MAX_LEN_DICE) and not bBigSectionCut and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL)
|
||||
if bAreHorizontalCutsNeeded then
|
||||
local nHorizontalCuts = ceil ( dimV / BD.MAX_DIM_DICE) - 1
|
||||
local dHorizontalSliceHeight = dimV / ( nHorizontalCuts + 1)
|
||||
@@ -491,7 +608,8 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
||||
for j = nHorizontalCuts, 1, -1 do
|
||||
local nFaceUse = MCH_MILL_FU.PARAL_DOWN
|
||||
local dHorizontalCutOffset = dHorizontalSliceHeight * -j
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0 , sCutting, dSawDiam, nFaceUse, nil, -0.1 - dCutXOffset, BD.CUT_SIC, dHorizontalCutOffset, 0, 0, 'Precut;', b3Raw)
|
||||
local bForceTangentLeadInOut = BD.PRESS_ROLLER
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0 , sCutting, dSawDiam, nFaceUse, nil, -0.1 - dCutXOffset, BD.CUT_SIC, dHorizontalCutOffset, 0, 0, 'Precut;', b3Raw, nil, nil, nil, bForceTangentLeadInOut)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
-- se necessario taglio verticale doppio, eseguo l'opposto
|
||||
@@ -524,6 +642,12 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
||||
-- eseguo i tagli necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
-- se trave larga effettuo tagli verticali aggiuntivi
|
||||
if not bSplit and ( dimH > BD.MAX_LEN_DICE) and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) then
|
||||
local sSpecNotes = EgtIf( bSplit, 'Presplit;', 'Precut;')
|
||||
local bOk, sErr = AddVerticalPreCuts( Proc, sCutting, dCutOffset, b3Raw, sSpecNotes)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
local sNotes
|
||||
if bSplit then
|
||||
sNotes = EgtIf( i == 1, 'Split;', 'Presplit;')
|
||||
@@ -547,14 +671,14 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
||||
end
|
||||
-- verifico che le due lame riescano a lavorare la sezione
|
||||
local dDimZ = b3Raw:getDimZ()
|
||||
local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ
|
||||
local dExtra = dMaxVertDepth + dSawMaxDepth2 - dDimZ
|
||||
if ( dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0) and not bBigSectionCut then
|
||||
local sErr = 'Error : section too big for tail cut'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- calcolo extra taglio ed accorciamento
|
||||
local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN
|
||||
local dCutExtra = -dSawMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN
|
||||
local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN
|
||||
local dAccStart = 0
|
||||
-- limiti da sotto
|
||||
@@ -564,12 +688,18 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
local sNotes = EgtIf( bSplit, 'Presplit;', 'Precut;')
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw)
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw, nil, true)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
-- eseguo i tagli da sopra necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
-- se trave larga effettuo tagli verticali aggiuntivi
|
||||
if not bSplit and ( dimH > BD.MAX_LEN_DICE) and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) then
|
||||
local sSpecNotes = EgtIf( bSplit, 'Presplit;', 'Precut;')
|
||||
local bOk, sErr = AddVerticalPreCuts( Proc, sCutting, dCutOffset, b3Raw, sSpecNotes)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
local sNotes
|
||||
if bSplit then
|
||||
sNotes = EgtIf( i == 1, 'Split;', 'Presplit;')
|
||||
|
||||
@@ -212,7 +212,8 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
|
||||
-- applico lavorazione
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
@@ -223,7 +224,8 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
|
||||
-- applico lavorazione
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
@@ -320,10 +322,12 @@ local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if bAdj12 then
|
||||
if dAng12 < 0 then
|
||||
EgtSurfTmSwapFacets( Proc.Id, 0, 2)
|
||||
Proc.Face = BL.GetFacetsInfo( Proc, b3Raw)
|
||||
end
|
||||
elseif bAdj20 then
|
||||
if dAng20 < 0 then
|
||||
EgtSurfTmSwapFacets( Proc.Id, 1, 2)
|
||||
Proc.Face = BL.GetFacetsInfo( Proc, b3Raw)
|
||||
end
|
||||
end
|
||||
-- dati delle facce
|
||||
@@ -390,7 +394,8 @@ local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
|
||||
-- applico lavorazione
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
-- ProcessStepJointNotch.lua by Egaltech s.r.l. 2022/11/03
|
||||
-- Gestione calcolo tacca a gradino per Travi
|
||||
-- 2022/11/03 Correzione per riconoscimento testa da sotto su fresatura.
|
||||
-- 2024/06/28 In MakeFourFaces aggiunta copia del parametro PartId sulla nuova Proc
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessStepJointNotch = {}
|
||||
@@ -11,6 +12,7 @@ local BL = require( 'BeamLib')
|
||||
local Fbs = require( 'FacesBySaw')
|
||||
local DC = require( 'DiceCut')
|
||||
local Cut = require( 'ProcessCut')
|
||||
local Topology = require( 'FeatureTopology')
|
||||
|
||||
EgtOutLog( ' ProcessStepJointNotch started', 1)
|
||||
|
||||
@@ -383,7 +385,9 @@ local function MakeFourFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, nDiffWidt
|
||||
EgtSurfTmSwapFacets( AddId, 1, 3)
|
||||
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
|
||||
-- applico lavorazione
|
||||
local NewProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg}
|
||||
local NewProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, PartId = Proc.PartId}
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
Topology.Classify( NewProc, b3Raw)
|
||||
local bOk, sErr = MakeTwoFaces( NewProc, nPhase, nRawId, nPartId, dOvmHead, nDiffWidth)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
@@ -478,7 +482,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
end
|
||||
-- se diretta verso Z
|
||||
elseif abs( vtExtr:getZ()) > 0.99 then
|
||||
elseif abs( vtExtr:getZ()) > 0.99 and not ( BD.DOWN_HEAD or nTypePos == 0) then
|
||||
-- se diretta verso Z+
|
||||
if vtExtr:getZ() > 0 then
|
||||
-- se sborda verso Z+ abilito solo la lavorazione della parte normale
|
||||
@@ -503,7 +507,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local dExtra = 2
|
||||
-- recupero la lavorazione
|
||||
local sMillType = 'Mark'
|
||||
local bDownHead = ( BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1)
|
||||
local bDownHead = BD.DOWN_HEAD and vtExtr:getZ() < GEO.EPS_SMALL
|
||||
local sMilling, bH2
|
||||
sMilling, _, _, bH2 = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bDownHead)
|
||||
if not sMilling then
|
||||
@@ -536,6 +540,14 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
end
|
||||
if bExeOpposite then
|
||||
bDownHead = BD.DOWN_HEAD and vtExtr:getZ() > - GEO.EPS_SMALL
|
||||
sMilling, _, _, bH2 = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bDownHead)
|
||||
if not sMilling then
|
||||
local sErr = 'Error : milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
bDownHead = ( bDownHead and bH2)
|
||||
-- Inserisco la lavorazione del lato opposto
|
||||
local sName2 = 'SJN_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMch2Id = EgtAddMachining( sName2, sMilling)
|
||||
|
||||
@@ -200,7 +200,8 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
else
|
||||
local b3Cut = EgtGetBBoxGlob( AddId or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Cut, Fct = 1, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bFromBottom = ( bShortPart and vtExtr:getZ() > 0.25)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom)
|
||||
if not bOk then
|
||||
|
||||
@@ -232,7 +232,8 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw,
|
||||
-- se va fatto, inserisco la lavorazione
|
||||
if bCut then
|
||||
local CutProc = { Id = AuxId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- se taglio applicato setto la nota al gruppo Mach per non doverla lavorare una seconda volta
|
||||
if bOk then
|
||||
@@ -330,7 +331,8 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw,
|
||||
-- se va fatto, inserisco la lavorazione
|
||||
if bCut then
|
||||
local CutProc = { Id = AuxId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- se taglio applicato setto la nota al gruppo Mach per non doverla lavorare una seconda volta
|
||||
if bOk then
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
-- ProcessVariant.lua by Egaltech s.r.l. 2023/11/08
|
||||
-- Gestione calcolo Feature Custom (Variant) per Travi
|
||||
-- 2023/11/08 Creazione modulo.
|
||||
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessVariant = {}
|
||||
|
||||
-- Include
|
||||
require( 'EgtBase')
|
||||
local BL = require( 'BeamLib')
|
||||
|
||||
EgtOutLog( ' ProcessVariant started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
function ProcessVariant.Identify( Proc)
|
||||
return (( Proc.Grp == 0 or Proc.Grp == 1 or Proc.Grp == 2 or Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 900)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Classificazione della feature: decide se la feature è in una posizione lavorabile
|
||||
local function ClassifyPocket( Proc, b3Raw)
|
||||
-- recupero gli indici delle facce da lavorare
|
||||
local vFace = EgtGetInfo( Proc.Id, 'Faces', 'vi')
|
||||
if not vFace or #vFace == 0 then
|
||||
local sErr = 'Error : missing Faces for Pocketing'
|
||||
EgtOutLog( sErr)
|
||||
return false
|
||||
end
|
||||
-- recupero le normali di tutte le facce e verifico siano uguali
|
||||
local vtN
|
||||
for i = 1, #vFace do
|
||||
local vtNf = EgtSurfTmFacetNormVersor( Proc.Id, vFace[i], GDB_ID.ROOT)
|
||||
if not vtN then
|
||||
vtN = vtNf
|
||||
else
|
||||
if not AreSameVectorApprox( vtN, vtNf) then
|
||||
local sErr = 'Error : Faces for Pocketing with different orientation'
|
||||
EgtOutLog( sErr)
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
local bDown = ( vtN:getZ() < - 0.5)
|
||||
-- se da sotto e presente rinvio angolare verifico se c'è opportuna lavorazione
|
||||
if bDown and BD.ANG_TRASM then
|
||||
local dMaxDiam = EgtGetInfo( Proc.Id, 'MaxDiam', 'd')
|
||||
if ML.FindPocketing( 'Pocket_AT', dMaxDiam) then
|
||||
bDown = false
|
||||
end
|
||||
end
|
||||
return true, bDown, false
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function ProcessVariant.Classify( Proc, b3Raw)
|
||||
-- recupero il codice identificativo e il tipo di lavorazione
|
||||
local sCode = EgtGetInfo( Proc.Id, 'DES')
|
||||
local sType = EgtGetInfo( Proc.Id, 'Type')
|
||||
-- gestione in base al tipo
|
||||
if sType == 'Pocket' then
|
||||
return ClassifyPocket( Proc, b3Raw)
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
local function MakePocket( Proc, nRawId, b3Raw, nPartId)
|
||||
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
-- recupero gli indici delle facce da lavorare
|
||||
local vFace = EgtGetInfo( Proc.Id, 'Faces', 'vi')
|
||||
if not vFace or #vFace == 0 then
|
||||
local sErr = 'Error : missing Faces for Pocketing'
|
||||
EgtOutLog( sErr)
|
||||
return false
|
||||
end
|
||||
-- recupero i dati delle facce (le normali sono identiche)
|
||||
local dTotDepth = 0
|
||||
local vDepth = {}
|
||||
for i = 1, #vFace do
|
||||
vDepth[i] = BL.GetFaceElevation( Proc, vFace[1], b3Solid)
|
||||
dTotDepth = max( dTotDepth, vDepth[i])
|
||||
end
|
||||
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, vFace[1], GDB_ID.ROOT)
|
||||
-- recupero eventuale massimo diametro impostato
|
||||
local dMaxDiam = EgtGetInfo( Proc.Id, 'MaxDiam', 'd')
|
||||
-- abilitazione lavorazione da sotto
|
||||
local bMillUp = ( BD.DOWN_HEAD and vtN:getZ() > -0.259)
|
||||
local bMillDown = ( BD.DOWN_HEAD and vtN:getZ() < 0.174)
|
||||
local bMillAngTrasm = ( BD.ANG_TRASM and vtN:getZ() < -0.5)
|
||||
-- recupero la lavorazione
|
||||
local sPockType = EgtIf( not bMillAngTrasm, 'Pocket', 'Pocket_AT')
|
||||
local sPocketing = ML.FindPocketing( sPockType, dMaxDiam, dTotDepth)
|
||||
if not sPocketing then
|
||||
sPocketing = ML.FindPocketing( sPockType, dMaxDiam, dTotDepth / 2)
|
||||
if not sPocketing then
|
||||
local sErr = 'Error : pocketing not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
-- recupero i dati dell'utensile
|
||||
local dMillDiam = 20
|
||||
local dMaxDepth = 0
|
||||
if EgtMdbSetCurrMachining( sPocketing) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
end
|
||||
-- se elevazione superiore a massimo affondamento della fresa, segnalo
|
||||
local sWarn
|
||||
if dTotDepth > dMaxDepth + 10 * GEO.EPS_SMALL then
|
||||
sWarn = 'Warning : elevation bigger than max tool depth'
|
||||
EgtOutLog( sWarn)
|
||||
end
|
||||
-- lavoro ogni faccia
|
||||
for i = 1, #vFace do
|
||||
-- inserisco la lavorazione di svuotatura
|
||||
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( i)
|
||||
local nMchFId = EgtAddMachining( sName, sPocketing)
|
||||
if not nMchFId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ Proc.Id, vFace[i]}})
|
||||
-- imposto posizione braccio porta testa
|
||||
if vtN:getY() <= 0 then
|
||||
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
|
||||
else
|
||||
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, min( 0, dMaxDepth - vDepth[i]))
|
||||
-- imposto elevazione
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxDepth, 1) .. ';')
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
return true, sWarn
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function ProcessVariant.Make( Proc, nRawId, b3Raw, nPartId)
|
||||
-- recupero il codice identificativo e il tipo di lavorazione
|
||||
local sCode = EgtGetInfo( Proc.Id, 'DES')
|
||||
local sType = EgtGetInfo( Proc.Id, 'Type')
|
||||
-- gestione in base al tipo
|
||||
if sType == 'Pocket' then
|
||||
return MakePocket( Proc, nRawId, b3Raw, nPartId)
|
||||
else
|
||||
return false, 'Variant Type non recognized for machining'
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
return ProcessVariant
|
||||
+35
-22
@@ -115,23 +115,6 @@ local function MyProcessInputData()
|
||||
end
|
||||
EgtDeselectAll()
|
||||
|
||||
-- Le ordino in senso di lunghezza crescente
|
||||
table.sort( vBeam, function( B1, B2)
|
||||
if abs( B1.Box:getDimX() - B2.Box:getDimX()) < 1 then
|
||||
return B1.Ind < B2.Ind
|
||||
else
|
||||
return B1.Box:getDimX() < B2.Box:getDimX()
|
||||
end
|
||||
end)
|
||||
do
|
||||
local sOut = ''
|
||||
for i = 1, #vBeam do
|
||||
sOut = sOut .. vBeam[i].Name .. ', '
|
||||
end
|
||||
sOut = sOut:sub( 1, -3)
|
||||
EgtOutLog( 'Travi ordinate : ' .. sOut, 1)
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -152,12 +135,14 @@ local function MyProcessBeams()
|
||||
local dAddLen = BD.OVM_HEAD + ( #vBeam - 1) * BD.OVM_MID
|
||||
EgtOutLog( 'Ltot : '..EgtNumToString( dTotLen, 1) .. ' Lagg : '..EgtNumToString( dAddLen, 1)..' MinUnloadRaw : '.. EgtNumToString( BD.MinRaw + BD.OVM_MID, 1), 1)
|
||||
|
||||
-- Richiedo lunghezza del grezzo e sovramateriale di testa
|
||||
-- Richiedo lunghezza del grezzo, sovramateriale di testa, forzatura verticale e ordinamento automatico secondo la lunghezza
|
||||
local vsVal = EgtDialogBox( 'Lavora Travi' .. ' (Ltot='..EgtNumToString( dTotLen + dAddLen + 0.5, 0)..
|
||||
', Lmax='..EgtNumToString( BD.MAX_RAW, 0)..',MinUlr='..EgtNumToString( BD.MinRaw + BD.OVM_MID, 0)..')',
|
||||
{'Lunghezza grezzo', EgtNumToString( BD.STD_RAW, 0)},
|
||||
{'Sovramateriale di testa', EgtNumToString( BD.OVM_HEAD, 0)},
|
||||
{'Forza sezione verticale', ' CB:true,*false'})
|
||||
{'Offset intermedio', EgtNumToString( BD.OVM_MID, 0)},
|
||||
{'Forza sezione verticale', ' CB:true,*false'},
|
||||
{'Ordina per lunghezza', ' CB:true,*false'})
|
||||
if not vsVal then
|
||||
EgtDraw()
|
||||
return
|
||||
@@ -180,9 +165,17 @@ local function MyProcessBeams()
|
||||
EgtDraw()
|
||||
return false
|
||||
end
|
||||
|
||||
local dOvmMid = EgtEvalNumExpr( vsVal[3])
|
||||
if not dOvmMid then
|
||||
local sOut = 'Offset intermedio : ' .. vsVal[3]
|
||||
EgtOutLog( sOut)
|
||||
EgtOutBox( sOut, 'Lavora Travi', 'WARNING')
|
||||
EgtDraw()
|
||||
return false
|
||||
end
|
||||
|
||||
-- Sistemo sezione barra con travi
|
||||
local bVert = ( vsVal[3] == 'true')
|
||||
local bVert = ( vsVal[4] == 'true')
|
||||
if bVert then
|
||||
if dRawW > dRawH then dRawW, dRawH = dRawH, dRawW end
|
||||
end
|
||||
@@ -221,8 +214,28 @@ local function MyProcessBeams()
|
||||
return false
|
||||
end
|
||||
|
||||
-- Se richiesto, ordino le travi in senso di lunghezza crescente
|
||||
local bOrd = ( vsVal[5] == 'true')
|
||||
if bOrd then
|
||||
table.sort( vBeam, function( B1, B2)
|
||||
if abs( B1.Box:getDimX() - B2.Box:getDimX()) < 1 then
|
||||
return B1.Ind < B2.Ind
|
||||
else
|
||||
return B1.Box:getDimX() < B2.Box:getDimX()
|
||||
end
|
||||
end)
|
||||
end
|
||||
do
|
||||
local sOut = ''
|
||||
for i = 1, #vBeam do
|
||||
sOut = sOut .. vBeam[i].Name .. ', '
|
||||
end
|
||||
sOut = sOut:sub( 1, -3)
|
||||
EgtOutLog( 'Travi ordinate : ' .. sOut, 1)
|
||||
end
|
||||
|
||||
-- Sistemo le travi nel grezzo
|
||||
local bOk, sErr = BE.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam)
|
||||
local bOk, sErr = BE.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, vBeam)
|
||||
if not bOk then
|
||||
EgtOutLog( sErr)
|
||||
EgtOutBox( sErr, 'Lavora Travi', 'ERROR')
|
||||
|
||||
+161
-5
@@ -1,19 +1,175 @@
|
||||
==== Beam Update Log ====
|
||||
|
||||
Versione 2.6h2 (26/08/2024)
|
||||
- Added : in BatchProcess e New si verifica l'abilitazione alla generazione con EgtVerifyKeyOption
|
||||
- Modif : in FacesBySaw introdotti attacchi tangenziali solo da un lato, limitati a facce con Z negative
|
||||
- Modif : in LapJoint -> tunnel lo smusso funziona anche se è forzata la sega a catena
|
||||
- Modif : in LapJoint -> svuotatura, se l'utente ha definito un'elevazione custom si lavora sempre la faccia standard
|
||||
- Modif : in FacesBySaw -> MakeOne aggiunta la possibilità di passare una direzione di lavoro alternativa per poter rispettare contemporaneamente la direzione di lavoro concorde e la direzione di taglio.
|
||||
|
||||
Versione 2.6h1 (20/08/2024)
|
||||
- Modif : in SimpleScarf, se assimilabile a un taglio, si considera area non pinzabile
|
||||
- Modif : in LapJoint gestito smusso nel caso Groove-Blind-RightAngles-Parallel-4
|
||||
- Modif : varie modifiche ai tagli di lama per evitare chiusura rulli pneumatici e finecorsa
|
||||
- Modif : in BatchProcessNew, se presente flag apposito in EgtCam5, si evita la generazione
|
||||
|
||||
Versione 2.6g4 (19/07/2024)
|
||||
- Modif : in BatchProcess e BatchProcessNew si forza ricalcolo ogni volta che si è in situazione di CHECK o CHECK + GENERATE
|
||||
|
||||
Versione 2.6g3 (07/07/2024)
|
||||
- Added : aggiunta possibilità di funzione GetNzLimDownUp specifica per ogni macchina
|
||||
- Modif : anche nel taglio a cubetti si chiama GetNzLimDownUp di macchina, se presente, per decidere limite orientamento lama verso il basso
|
||||
- Modif : in BeamExec inserito controllo massimo numero di facce per lanciare GetFacetsInfo
|
||||
- Fixed : in LapJoint corretto typo in nome variabile che provocava mancata impostazione asse bloccato
|
||||
|
||||
Versione 2.6g2 (04/07/2024)
|
||||
- Modif : le lavorazioni BlockHaus, se vicine alla coda, vengono spostate dopo il taglio di separazione
|
||||
|
||||
Versione 2.6g1 (01/07/2024)
|
||||
- Modif : in LongDoubleCut gestita correttamente SCC per lama
|
||||
- Modif : in MachiningLib miglioramenti a scelta testa ottimizzata
|
||||
- Modif : in ProcessDtTenon correzione in scelta testa
|
||||
- Modif : In LapJoint -> VerifySideMillAsSaw modificato criterio ricerca utensile in base a normale della faccia
|
||||
- Fixed : in MakeAntiSplintBySaw se non si trova adiacenza tra le facce si restituisce errore
|
||||
- Fixed : In StepJointNotch, MakeFourFaces corretta copia feature con PartId mancante
|
||||
|
||||
Versione 2.6f2 (17/06/2024)
|
||||
- Modif : correzione a tagli a cubetti (ripristinata versione pre 2.6f1)
|
||||
|
||||
Versione 2.6f1 (06/06/2024)
|
||||
- Added : Q04 (tipo longcut) abilitato anche in RidgeLap (T30), se riconducibile a 2 facce
|
||||
- Modif : migliorie al taglio a cubetti
|
||||
- Modif : in LapJoint -> MakePocket abilitata Q per forzare massima elevazione
|
||||
- Fixed : correzione a SCC per lama da sotto con aggregato
|
||||
- Fixed : correzioni a ottimizzazione teste per macchine con teste sopra/sotto
|
||||
|
||||
Versione 2.6e5 (27/05/2024)
|
||||
- Modif : in LapJoint corretto typo in lavorazione lamello che impediva il funzionamento corretto.
|
||||
|
||||
Versione 2.6e4 (20/05/2024)
|
||||
- Modif : in SawPlusChain le lavorazioni di sega a catena aggiuntive (side) si fermano in mezzeria se tasca passante
|
||||
- Modif : in SawPlusChain il tunnel con sega a catena viene fatto da un solo lato se possibile
|
||||
|
||||
Versione 2.6e3 (14/05/2024)
|
||||
- Modif : in SawPlusChain aggiunta gestione lavorazioni aggiuntive lati aperti e tunnel
|
||||
- Fixed : in Cut -> MakeFromTop ricalcolo direzione di lavorazione su facce a cubetti.
|
||||
|
||||
Versione 2.6e2 (10/05/2024)
|
||||
- Modif : in FeatureTopology aggiunta proprietà IsTrough = true anche a Cut
|
||||
- Modif : LongCut : se non trova fresa per pulizia, da messaggio di warning anziché di errore
|
||||
- Fixed : LongCut : allungamento percorso ingresso per evitare collisioni durante approccio pezzo quando si setta OutRaw.
|
||||
|
||||
Versione 2.6e1 (03/05/2024)
|
||||
- Modif : in LapJoint Groove verso il basso lavorata di preferenza dal lato
|
||||
- Modif : in LapJoint -> SideMillAsSaw gestito anche rabbet passante
|
||||
- Fixed : in BeamExec box della feature aggiornato dopo rotazione
|
||||
- Fixed : in BeamExec GetProcessAffectedFaces e GetFacetsInfo rilanciati dopo rotazione
|
||||
- Fixed : In LapJoint -> MakeMoreLongFaces corretto calcolo divisione in parti per evitare problemi di ceil con interi perfetti
|
||||
|
||||
Versione 2.6d2 (11/04/2024)
|
||||
- Added : in LapJoint aggiunta strategia per fare tasche con lama + sega a catena, attivata da Q11
|
||||
|
||||
Versione 2.6d1 (08/04/2024)
|
||||
- Fixed : in Long2Cut corretto nome passato alla BL.GetBlockedAxis
|
||||
- Fixed : in MakeTwo rimossa gestione calcolo differente su ultima passata in caso di macchina FAST
|
||||
- Fixed : in LapJoint -> ForceSideMill escluso caso 4 facce senza possibilità di ingresso lungo Y.
|
||||
|
||||
Versione 2.6c4 (18/03/2024)
|
||||
- Fixed : correzioni a gestione prefori.
|
||||
|
||||
Versione 2.6c3 (15/03/2024)
|
||||
- Added : Aggiunta gestione prefori
|
||||
- Fixed : in LapJoint correzione a calcolo ingombro per feature basse e lunghe dalla testa.
|
||||
|
||||
Versione 2.6c2 (12/03/2024)
|
||||
- Added : in Mortase Aggiunta possibilità di inserire lavorazione di smusso
|
||||
- Added : in FreeContour aggiunto smusso se lav. di svuotatura
|
||||
- Added : in BeamExec creata funzione calcolo dipendenze tra feature
|
||||
- Added : In BeamExec -> CollectFeatures si scrive ora Width e Height della faccia sia trimmate con il grezzo che intere
|
||||
- Added : implementate le lavorazioni in doppio per fori specchiati non passanti e DrillPocket
|
||||
- Modif : in LapJoint migliorata ricerca pocket (VerifyPocket)
|
||||
- Modif : implementato attacco esterno se tasca 4 facce sulla coda ma nessun pezzo successivo
|
||||
- Modif : rimossi simboli di debug da compile
|
||||
- Fixed : In FreeContour corretto caso di smusso non passante
|
||||
|
||||
Versione 2.6c1 (29/02/2024)
|
||||
- Modif : in FacesBySaw e LapJoint migliorato calcolo area non pinzabile in testa HCING e coda TCING
|
||||
- Modif : vari miglioramenti all'ordinamento delle lavorazioni
|
||||
- Modif : in Mortise forzata SPIRAL_IN se c'è almeno un lato aperto
|
||||
- Modif : in tenone a coda di rondine aumentato a 8 il numero massimo di passate (era 6)
|
||||
- Modif : in lapjoint a due facce migliorata la scelta della lama da sotto
|
||||
- Fixed : in LapJoint corretto bug che impediva l'esecuzione della lavorazion con antischeggia attivo
|
||||
|
||||
Versione 2.6b1 (14/02/2024)
|
||||
- Fixed : corretto bug in Split in cui si chiamava la EgtSurfTmFacetNormVersor senza riferimento
|
||||
- Fixed : in L20 corretta gestione 2 facce
|
||||
- Modif : modifiche per limiti pinzaggio con pinze con fronte verticale (ONE, PF) anzichè inclinato (FAST) quindi parametro BD.VICE_MINH grande
|
||||
- Modif : nei tagli con sega a catena ora si considera l'ingombro della testa per il calcolo della massima profondità
|
||||
- Modif : in LapJoint ora i rabbet lungo X che guardano in basso sono sempre fatti con fresatura di lato per evitare di ruotare.
|
||||
|
||||
Versione 2.6a1 (24/01/2024)
|
||||
- Added : in HeadCut e Split aggiunti tagli verticali addizionali per travi di larghezza elevata
|
||||
- Added : in Split gestita separazione con sega a catena + lama
|
||||
- Added : in MachiningLib è ora possibile riordinare le lavorazioni in base a lunghezza e dimensione utensile
|
||||
- Added : modifiche per poter impostare offset intermedio anche se lanciato da EgtCam5
|
||||
- Modif : nelle lavorazioni si gestiscono ora seghe a catena multiple
|
||||
- Modif : in split con sega a catena ora si cerca di preferenza una lavorazione di tipo 'SawingForSplitting'. Se non trovata si cerca il tipo 'Sawing' come in precedenza
|
||||
- Modif : in split con sega a catena aggiunta estensione start/end del percorso se utensile lungo, per evitare collisioni con il pezzo durante rotazione
|
||||
- Modif : implementata funzione GetBlockedAxis per gestire l'asse bloccato per sega a catena e lama
|
||||
- Modif : in DiceCut corretto calcolo cubetti con superficie limitante parallela e opposta a quella di base
|
||||
|
||||
Versione 2.5l3 (08/01/2023)
|
||||
- Modif : modifiche per centrare i pezzi in Y sulla tavola (da flag BeamData.CENTER_BEAM)
|
||||
- Modif : resi più veloci i calcoli di FeatureTopology
|
||||
- Modif : migliorato calcolo attacco/uscite lame in FacesBySaw.
|
||||
|
||||
Versione 2.5l2 (20/12/2023)
|
||||
- Modif : in Cut e DoubleCut modifica in scelta ribaltamento trave quando si è in condizioni downUp
|
||||
- Modif : migliorato e esteso il funzionamento di SideMillAsSaw
|
||||
- Modif : in LapJoint con più facce, nelle OpenPocket, ammesso utensile con diametro fino a 3 volte la dimensione della tasca (era 2)
|
||||
- Modif : in RoundArch aggiunta gestione senso di rotazione fresa per lavorare sempre in concordanza
|
||||
- Fixed : correzione a GetFaceWithMostAdj per calcoli con facce che fanno ombra
|
||||
|
||||
Versione 2.5l1 (01/12/2023)
|
||||
- Added : in LongDoubleCut aggiunta Q05 per utilizzo lama anche in feature cieche conme per LongCut
|
||||
- Modif : Migliorato e velocizzato il calcolo elevazione (EgtSurfTmFacetElevationInBBox)
|
||||
- Fixed : in MakeTwo di FacesBySaw raffinamento calcolo vtRef per casi dubbi.
|
||||
|
||||
Versione 2.5k3 (28/11/2023)
|
||||
- Added : in Long2Cut gestite lavorazioni lama con Q05 come in LongCut.
|
||||
|
||||
Versione 2.5k2 (06/11/2023)
|
||||
- Added : in LapJoint, per L020, gestita lavorazione speciale gradino scala con fresatura + lama, attivata con Q09
|
||||
- Fixed : in ProcessSplit si imposta l'ingombro asse C correttamente anche per teste con asse rotante C con un solo braccio.
|
||||
|
||||
Versione 2.5k1 (02/11/2023)
|
||||
- Modif : in LapJoint gestito caso groove due facce >90° con fresa, se forzato da parametro Q
|
||||
- Modif : in LongCut e LongDoubleCut migliorata spezzatura taglio passante con due spezzoni
|
||||
- Modif : nei tagli di lama migliorata gestione con percorso bilinea
|
||||
- Modif : in LapJoint 2 facce longitudinali si usa taglio di lama solo se si taglia completamente, altrimenti fresa.
|
||||
|
||||
Versione 2.5j1 (23/10/2023)
|
||||
- Added : in Process (lancio da EgtCAM5 quindi uso praticamente solo interno) aggiunta possibilità di tenere ordine pezzi in barra come da selezione
|
||||
- Modif : in Topology aggiunti casi al check solo direzione principale
|
||||
- Modif : nella ricerca lavorazione da usare controllo di utensile attivo sostituito con controllo utensile presente nel setup corrente
|
||||
- Fixed : piccola correzione a Classify di FeatureTopology per casi senza geometria
|
||||
- Fixed : in HeadCut e Split corretto calcolo allungamenti/accorciamenti per evitare lunghezze del percorso negative
|
||||
- Fixed : in Lapjoint -> MakePocket aggiunto messaggio in caso si rovini il pezzo successivo.
|
||||
|
||||
Versione 2.5i2 (27/09/2023)
|
||||
- Added : aggiunto riconoscimento sottosquadro da facce non adiacenti
|
||||
- Modif : in lavorazione tenoni per Turn si assegna SCC per privilegiare accesso dal lato corto della trave.
|
||||
- Fixed : in LapJoint corretto caso tunnel lungo non lavorato correttamente
|
||||
- Fixed : in foratura quando errore in applicazione lavorazione si inverte e riprova solo se singola su foro aperto
|
||||
- Modif : in lavorazione tenoni per Turn si assegna SCC per privilegiare accesso dal lato corto della trave.
|
||||
|
||||
Versione 2.5i1 (12/09/2023)
|
||||
- Fixed : in LapJoint gestito correttamente il ritorno nil di GetUShapeWidth [Ticket #1354]
|
||||
- Modif : in Cut abbassato a 590 mm il limite per convertire in LongCut [Ticket #1448].
|
||||
- Modif : in Cut abbassato a 590 mm il limite per convertire in LongCut [Ticket #1448]
|
||||
- Fixed : in LapJoint gestito correttamente il ritorno nil di GetUShapeWidth [Ticket #1354].
|
||||
|
||||
Versione 2.5h2 (11/08/2023)
|
||||
- Modif : in LapJoint e Mortise modificata posizione braccio per FAST quando vicino alla coda della trave
|
||||
- Fixed : corrette forature con aggregato quando lato aperto
|
||||
- Fixed : in RidgeLap corretto ingombro lavorazione in testa e coda quando rivolta verso il basso
|
||||
- Modif : in LapJoint e Mortise modificata posizione braccio per FAST quando vicino alla coda della trave.
|
||||
- Fixed : in RidgeLap corretto ingombro lavorazione in testa e coda quando rivolta verso il basso.
|
||||
|
||||
Versione 2.5h1 (07/08/2023)
|
||||
- Fixed : tagli doppi di lato non effettuati se macchina tipo PF e pezzo alto [Ticket #1400]
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
-- Version.lua by Egaltech s.r.l. 2023/09/26
|
||||
-- Version.lua by Egaltech s.r.l. 2024/01/30
|
||||
-- Gestione della versione di Beam
|
||||
|
||||
NAME = 'Beam'
|
||||
VERSION = '2.5i2'
|
||||
MIN_EXE = '2.5c1'
|
||||
VERSION = '2.6h2'
|
||||
MIN_EXE = '2.6h1'
|
||||
|
||||
Reference in New Issue
Block a user