Compare commits
444 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a1ca23acc9 | |||
| 19d8be5c9e | |||
| 41a05b4199 | |||
| ab48827689 | |||
| a859f170aa | |||
| 06f7fdb385 | |||
| 36d0e0c198 | |||
| e1dc521fe5 | |||
| 30fc2ab1a4 | |||
| dacf2c5860 | |||
| abb7735f9d | |||
| 2fb4338d50 | |||
| b0150f5b03 | |||
| 5802f26bbf | |||
| 3be500974a | |||
| 199c327151 | |||
| 5b6ed18a8e | |||
| f34367da55 | |||
| 6665209c66 | |||
| ea7e9dedac | |||
| b7b8f30a8c | |||
| 9ea1c502e8 | |||
| 4a4c5e7349 | |||
| 2c1831a678 | |||
| 5c4b609a56 | |||
| 295f8059c4 | |||
| b375b56f21 | |||
| 4a5d097256 | |||
| 9acb252f1b | |||
| 70505bcf29 | |||
| 35337836a5 | |||
| 12bfe2ac27 | |||
| 3ec2618f9b | |||
| b0e307d89d | |||
| 834a1261c5 | |||
| 0eea92b13d | |||
| 29f1af5216 | |||
| b18f7da20a | |||
| e9a82086e3 | |||
| d09069ad78 | |||
| 00078c65c1 | |||
| 303a69cbb3 | |||
| c762706e89 | |||
| 73f90eefe5 | |||
| 4951a4c5c2 | |||
| 688d43e463 | |||
| 300dea8f2c | |||
| ad6c7ef6af | |||
| bc33759c14 | |||
| 36cf8f6de8 | |||
| e6837d160b | |||
| 6c81ad1f1b | |||
| 5cde095b8e | |||
| 76381e27f7 | |||
| 73a970bc20 | |||
| bf6b888d27 | |||
| 4768c065ef | |||
| 133720bc34 | |||
| bad5b4aaa4 | |||
| 21768ed542 | |||
| e80e4e8a5d | |||
| 5f47ce88da | |||
| 8370ef5b3a | |||
| c6566478e6 | |||
| 84d16b12a9 | |||
| 43900018dd | |||
| d6249a1f0f | |||
| 0954e86cc9 | |||
| 79b210def9 | |||
| acdceeb97f | |||
| 641aa5807d | |||
| f3c0987bc1 | |||
| 676815c32b | |||
| bcde9ae19c | |||
| 5004bc97b6 | |||
| c9cefa618e | |||
| dedf1366e6 | |||
| d72943e20b | |||
| 915f8973db | |||
| 6ee0d46ff5 | |||
| a4d06ff6c6 | |||
| bf9d0d2b8f | |||
| 0443133557 | |||
| 5c8f7dee7c | |||
| dabd2d2681 | |||
| 8bdde9e2bf | |||
| 2eccd38463 | |||
| 952190d792 | |||
| 9b32d12934 | |||
| a339d49066 | |||
| 3d58080915 | |||
| 2ef7e457c1 | |||
| 44a36c4acd | |||
| 7a602639ba | |||
| 260b8f36bb | |||
| 397251e9a3 | |||
| 0e0c78edf4 | |||
| 187a211491 | |||
| 5e9ff056c2 | |||
| 1f0905a34a | |||
| dbbdd9f0df | |||
| df1cb76993 | |||
| 6ee6ebd9be | |||
| 868161df0b | |||
| 240f2959fc | |||
| 5e5a4461ac | |||
| 4eec2dcf19 | |||
| c457ff9acf | |||
| 5f9fc0b975 | |||
| 51261d1231 | |||
| 7f807d6114 | |||
| cbccd14b64 | |||
| ac58afc627 | |||
| 1d68e47bdf | |||
| 1d802852bd | |||
| 01386ce711 | |||
| 4c4ae7bb6f | |||
| b66bd700f4 | |||
| 1c93a079bd | |||
| 000454139d | |||
| b460b2c7a4 | |||
| 65c344bb30 | |||
| 587f4c61e2 | |||
| cc63560b19 | |||
| d6813e4efa | |||
| 18ebaf8a16 | |||
| 60c489f70b | |||
| 270bca6bcc | |||
| 8ae94c1de6 | |||
| 3ec836ad9a | |||
| 479a28afb8 | |||
| 9cfccc29d6 | |||
| c344493daf | |||
| 9f68bbfeaf | |||
| 60a3731aa3 | |||
| 8c1b8cb346 | |||
| 3236f8bf73 | |||
| 47f716b3c1 | |||
| 81a12d2e98 | |||
| 3376f50024 | |||
| e3a42ec170 | |||
| d88dea71d8 | |||
| 5942332de8 | |||
| 64020f1f8d | |||
| 4578d461e0 | |||
| c9d25b6ee9 | |||
| 3be734753a | |||
| f0c1c37bc5 | |||
| 8949a511ee | |||
| e7619caaaf | |||
| ec69624941 | |||
| aba419a16e | |||
| 7db7ff1226 | |||
| 40dd008318 | |||
| 30f1a156d6 | |||
| 5e581096aa | |||
| 376f85d1f9 | |||
| 2124c7a25a | |||
| ef37486f34 | |||
| 711e6832c1 | |||
| 6eb3cd6429 | |||
| 091d710014 | |||
| 3f3e4db7f4 | |||
| dc2ea77a42 | |||
| 13c03ff601 | |||
| 9f73a85cd8 | |||
| 61f69ad50a | |||
| 19edc158c7 | |||
| 16c3d8467d | |||
| df75f1c760 | |||
| 23afe7b256 | |||
| d5ebc24bf5 | |||
| dd21a0ec16 | |||
| 041706a04d | |||
| 58c7d86f6b | |||
| 641bf33e4b | |||
| 3af41a8d4d | |||
| 9ec91b1409 | |||
| 79153f9051 | |||
| d486caa1a9 | |||
| e07dfbe0f3 | |||
| 33668827f7 | |||
| 8abea3a099 | |||
| 1ff8907b96 | |||
| 274ad495bc | |||
| 660d25ffc7 | |||
| b51737173e | |||
| fc8dff216d | |||
| 5792c3111d | |||
| cdfbd188fa | |||
| 77cec328a6 | |||
| 4e98d2a2a4 | |||
| f4d9224d8d | |||
| 40c277b95d | |||
| afef9c54fe | |||
| 83048f2f52 | |||
| 04e487f782 | |||
| 8dce03138e | |||
| ee1c67b006 | |||
| 62e2cc8375 | |||
| c78bc69dd1 | |||
| 2db0d38ccb | |||
| 89fb2101bf | |||
| 40f5c67bf5 | |||
| b6de243461 | |||
| cc5d1f3e52 | |||
| 8491922f6d | |||
| aede7c527f | |||
| bab5cb6fd4 | |||
| de6ffa3d73 | |||
| 4c4ac340fb | |||
| bf454d6c0f | |||
| abfbc2184f | |||
| 4bbef85875 | |||
| 09b7496b9d | |||
| 24bc868527 | |||
| 8e8caf511a | |||
| 73cac99934 | |||
| 533575b916 | |||
| 5532174bf6 | |||
| cdab041283 | |||
| e303f8205d | |||
| 9aaaa5c1b1 | |||
| 6ae3f987af | |||
| f03d4c08af | |||
| 90b1215f31 | |||
| 2e25eb86e3 | |||
| 0a1c80d764 | |||
| 1077d19eea | |||
| 1ac895439b | |||
| d74091d7f3 | |||
| 0d8ac98869 | |||
| 8b231d7fd3 | |||
| 36bff56509 | |||
| 29eb50649d | |||
| bd503764ed | |||
| ad63364303 | |||
| 261f4115f4 | |||
| d945e92272 | |||
| 58dd72c963 | |||
| d4ed2d651f | |||
| 82d80616f1 | |||
| 05be6f1d89 | |||
| 0487b0ac9a | |||
| 580ff476e2 | |||
| ce3b623c14 | |||
| 4d57cc7c5b | |||
| fb57f47258 | |||
| dc301910e1 | |||
| 1a1a5192ee | |||
| 2561f79c39 | |||
| 123a983c75 | |||
| b9ceef6f31 | |||
| 39b72e3ab9 | |||
| 750ddd2c05 | |||
| 279a83b1f4 | |||
| e6704addb0 | |||
| 890b2a36e6 | |||
| 4468e24bb9 | |||
| ae4cd29853 | |||
| 72e653fe4b | |||
| 478288b018 | |||
| 14d2d14ba4 | |||
| f3d54fd124 | |||
| a357faeabe | |||
| bbd04a33a2 | |||
| 4b531271af | |||
| 8bde91b13c | |||
| b21cc7a85b | |||
| c40f03e8a4 | |||
| 59bfbd3bbe | |||
| 7beee74638 | |||
| 6eef34f1ef | |||
| 0738cde565 | |||
| 4be2686584 | |||
| 4bd7ad4263 | |||
| 1a2675ed56 | |||
| aa8fd354d9 | |||
| 89b968f0d1 | |||
| d5fdf37c9c | |||
| ab67c86657 | |||
| ca9fa091cc | |||
| 60a00a81fa | |||
| bd870c8ac6 | |||
| 623fd30a6c | |||
| 4c239cf6a7 | |||
| bc6886394e | |||
| b4369e92ff | |||
| aeef0a7180 | |||
| 6271975662 | |||
| 8709ea7646 | |||
| a9be5bf51e | |||
| 2f329961ba | |||
| 1e71fd5c9f | |||
| 5d6140fac3 | |||
| 6b27b7f0f8 | |||
| a1b140c15e | |||
| e91ee09ac9 | |||
| 07e07028a4 | |||
| 2523475a06 | |||
| 3c5faceedf | |||
| 6adea859ce | |||
| 6996c5617e | |||
| 8dddb4cc35 | |||
| 0c6b36ed49 | |||
| 10f6830cad | |||
| ab5dfef3eb | |||
| 4cb7dce121 | |||
| 0ec9661d9a | |||
| 75a4b30d18 | |||
| b60c76e64b | |||
| 8e037e0943 | |||
| 966d3a794a | |||
| b9c2a2e1b9 | |||
| cb70e2a47d | |||
| c7b5570dd8 | |||
| 4445ce4f11 | |||
| 527bb52aba | |||
| 0d5e2737e4 | |||
| e513a43ae9 | |||
| 8a58bf0fa6 | |||
| dc781d06ba | |||
| 02e26c362f | |||
| 63d9d24e30 | |||
| 4789452523 | |||
| 46c5088c28 | |||
| 1b6f8b3be4 | |||
| 857a410416 | |||
| 77c7e42e42 | |||
| f3e04bccb3 | |||
| b3ca865b42 | |||
| c140cd03ec | |||
| cc24b3b3ae | |||
| b614b85652 | |||
| b3cbb4753d | |||
| 9f8e024b35 | |||
| 0ab2e88d77 | |||
| 58e631d899 | |||
| 5ca0809cea | |||
| 58ea436132 | |||
| c8b5f9ca27 | |||
| 33d70bdbf4 | |||
| 6ffb0da24d | |||
| 04abd401f6 | |||
| 5b1fb41c43 | |||
| 8baf4ad2d6 | |||
| 3e27651e4c | |||
| 2c5de2516d | |||
| 07dad8f8c2 | |||
| b48fe0da34 | |||
| 640f77b5f5 | |||
| 14afb25783 | |||
| 5bc4e6f24f | |||
| ea40658bd3 | |||
| ec1a8e711d | |||
| 18826b5302 | |||
| a0b55b8628 | |||
| 6e0d6c7ea7 | |||
| c3786e0a96 | |||
| 07a66eb132 | |||
| b3fcdcdd6b | |||
| 86c225305f | |||
| 0c5c1dcfe5 | |||
| af8532970c | |||
| 6fb843e4cf | |||
| c654bbcd19 | |||
| f0ebd5c206 | |||
| 0e3e6b6174 | |||
| 6487fc3836 | |||
| 59b716daa6 | |||
| 98fcfd9bc1 | |||
| 9177fb3c4c | |||
| 7e21b84bb9 | |||
| fb6dbebdd4 | |||
| 111f11cf92 | |||
| 607efa3bef | |||
| b79e180da2 | |||
| 00c0db39d7 | |||
| 8dc1c63b65 | |||
| 3ca4bdde77 | |||
| af643b1ba5 | |||
| a9061ecf51 | |||
| 07d3f5ffa8 | |||
| d49cb93e36 | |||
| c7a9213a2c | |||
| f620269f31 | |||
| d9f06eb07d | |||
| 182639772d | |||
| b2a1fc823d | |||
| d5f5eaa844 | |||
| ba51a86239 | |||
| 26077bcfdf | |||
| 4dbec60558 | |||
| 3bd16304c5 | |||
| 950f7d1992 | |||
| bc8fffd075 | |||
| 3669787621 | |||
| 0c9945a457 | |||
| 8a693a38cc | |||
| e6c173e5a1 | |||
| bd822e9153 | |||
| cf7322229d | |||
| 706d9efa9d | |||
| 4fdafa34c5 | |||
| 66541894ea | |||
| 1198a34cd2 | |||
| 41412b6cca | |||
| 9588ee0def | |||
| bef986e453 | |||
| 4ad4638582 | |||
| 5b334d8fa7 | |||
| edb0f70a27 | |||
| 808f92fa36 | |||
| 6407057400 | |||
| 2f63cd84e3 | |||
| 798696a5a6 | |||
| 8a3b9d4706 | |||
| 0fdc2b8d15 | |||
| 9915cd2d42 | |||
| 432a8a9347 | |||
| cc6d21baf6 | |||
| bc5d904680 | |||
| 58905b88ba | |||
| 68f40aed58 | |||
| d91c31974e | |||
| a217b95c35 | |||
| 05aae0b8f3 | |||
| 629dfc1341 | |||
| e9cb756dc9 | |||
| 9b888a0a59 | |||
| b141a512bb | |||
| d13f108dad | |||
| 7762692597 | |||
| 04b0650f96 | |||
| 8b31881abb | |||
| 055d8bd4d3 | |||
| b0e10cee87 | |||
| a9e43984a2 | |||
| 1e93303981 | |||
| 7fec3d6584 | |||
| e61cc2ba08 | |||
| 516a56c8b5 | |||
| 2482338a12 | |||
| 0528ac4a31 |
+6
-7
@@ -13,12 +13,11 @@
|
|||||||
/Debug64
|
/Debug64
|
||||||
/Release64
|
/Release64
|
||||||
/ipch
|
/ipch
|
||||||
/bin
|
|
||||||
/obj
|
/obj
|
||||||
/.vs
|
/.vs
|
||||||
/32/*.lua
|
/bin/*.lua
|
||||||
/32/LuaLibs/*.lua
|
/bin/*.ini
|
||||||
/32/Images/*.png
|
/bin/LuaLibs/*.lua
|
||||||
/64/*.lua
|
/bin/Images/*.png
|
||||||
/64/LuaLibs/*.lua
|
.vscode/settings.json
|
||||||
/64/Images/*.png
|
bin/Images/.placeholder
|
||||||
|
|||||||
+31
-67
@@ -2,101 +2,67 @@ variables:
|
|||||||
VERS_MAIN: '1.0'
|
VERS_MAIN: '1.0'
|
||||||
APP_NAME: 'Beam'
|
APP_NAME: 'Beam'
|
||||||
NEW_REL: ''
|
NEW_REL: ''
|
||||||
NET_SHARE_R: '\\10.74.82.201\Artifacts\EGT_SRV\EgtTech'
|
NET_SHARE_X: '\\10.74.82.201\EgwTech'
|
||||||
NET_USER: '10.74.82.50\Server'
|
NET_SHARE_Z: '\\10.74.82.201\Artifacts'
|
||||||
NET_SHARE_Z: '\\10.74.82.200\Artifacts'
|
|
||||||
NET_USERQ: 'steamw\egalware'
|
NET_USERQ: 'steamw\egalware'
|
||||||
|
|
||||||
#Note compilazione LUA:
|
#Note compilazione LUA:
|
||||||
# lua53 -o 32\$FileName -s $FileName: -o = output, -s = NON include i debug symbols
|
# lua54 -o bin\$FileName -s $FileName: -o = output, -s = NON include i debug symbols
|
||||||
|
|
||||||
# helper compilazione LUA a 32 bit
|
# helper compilazione LUA a 32 e 64 bit
|
||||||
.LuaCompile32: &LuaCompile32
|
.LuaCompile: &LuaCompile
|
||||||
- |
|
- |
|
||||||
Set-Alias lua53 C:\Tools\Lua32\luac53
|
Set-Alias lua54 C:\Tools\Lua32\luac54
|
||||||
echo "Copia file *.ini"
|
echo "Copia file *.ini"
|
||||||
$FileList = Get-ChildItem("*.ini")
|
$FileList = Get-ChildItem("*.ini")
|
||||||
ForEach ($File in $FileList) {
|
ForEach ($File in $FileList) {
|
||||||
$FileName = Split-Path $File -leaf
|
$FileName = Split-Path $File -leaf
|
||||||
Copy-Item -Path $FileName -Destination 32\$FileName
|
Copy-Item -Path $FileName -Destination bin\$FileName
|
||||||
echo "Copy-Item -Path $FileName -Destination 32\$FileName"
|
echo "Copy-Item -Path $FileName -Destination bin\$FileName"
|
||||||
}
|
}
|
||||||
echo "Compilazione file *.lua 32bit"
|
echo "Compilazione file *.lua 32/64bit"
|
||||||
$FileList = Get-ChildItem("*.lua")
|
$FileList = Get-ChildItem("*.lua")
|
||||||
ForEach ($File in $FileList) {
|
ForEach ($File in $FileList) {
|
||||||
$FileName = Split-Path $File -leaf
|
$FileName = Split-Path $File -leaf
|
||||||
lua53 -o 32\$FileName $FileName
|
lua54 -o bin\$FileName $FileName
|
||||||
echo "lua53 -o 32\$FileName $FileName"
|
echo "lua54 -o bin\$FileName $FileName"
|
||||||
}
|
}
|
||||||
$FileList = Get-ChildItem("LuaLibs\*.lua")
|
$FileList = Get-ChildItem("LuaLibs\*.lua")
|
||||||
ForEach ($File in $FileList) {
|
ForEach ($File in $FileList) {
|
||||||
$FileName = Split-Path $File -leaf
|
$FileName = Split-Path $File -leaf
|
||||||
lua53 -o 32\LuaLibs\$FileName LuaLibs\$FileName
|
lua54 -o bin\LuaLibs\$FileName LuaLibs\$FileName
|
||||||
echo "lua53 -o 32\LuaLibs\$FileName LuaLibs\$FileName"
|
echo "lua54 -o bin\LuaLibs\$FileName LuaLibs\$FileName"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# helper copia SORGENTI verso cartella di rete X:\ dei SORGENTI
|
||||||
# Copy-Item -Path $FileName -Destination 32\$FileName
|
|
||||||
# echo "Copy-Item -Path $FileName -Destination 32\$FileName"
|
|
||||||
|
|
||||||
# helper compilazione LUA a 64 bit
|
|
||||||
.LuaCompile64: &LuaCompile64
|
|
||||||
- |
|
|
||||||
Set-Alias lua53 C:\Tools\Lua64\luac53
|
|
||||||
echo "Copia file *.ini"
|
|
||||||
$FileList = Get-ChildItem("*.ini")
|
|
||||||
ForEach ($File in $FileList) {
|
|
||||||
$FileName = Split-Path $File -leaf
|
|
||||||
Copy-Item -Path $FileName -Destination 64\$FileName
|
|
||||||
echo "Copy-Item -Path $FileName -Destination 64\$FileName"
|
|
||||||
}
|
|
||||||
echo "Compilazione file *.lua 64bit"
|
|
||||||
$FileList = Get-ChildItem("*.lua")
|
|
||||||
ForEach ($File in $FileList) {
|
|
||||||
$FileName = Split-Path $File -leaf
|
|
||||||
lua53 -o 64\$FileName $FileName
|
|
||||||
echo "lua53 -o 64\$FileName $FileName"
|
|
||||||
}
|
|
||||||
$FileList = Get-ChildItem("LuaLibs\*.lua")
|
|
||||||
ForEach ($File in $FileList) {
|
|
||||||
$FileName = Split-Path $File -leaf
|
|
||||||
lua53 -o 64\LuaLibs\$FileName LuaLibs\$FileName
|
|
||||||
echo "lua53 -o 64\LuaLibs\$FileName LuaLibs\$FileName"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Copy-Item -Path $FileName -Destination 64\$FileName
|
|
||||||
# echo "Copy-Item -Path $FileName -Destination 64\$FileName"
|
|
||||||
# helper copia SORGENTI verso cartella di rete R:\ dei SORGENTI
|
|
||||||
.CodeReplicaR: &CodeReplicaR
|
.CodeReplicaR: &CodeReplicaR
|
||||||
- |
|
- |
|
||||||
net use R: /delete
|
net use X: /delete
|
||||||
net use R: $env:NET_SHARE_R /u:$env:NET_USERQ $ZDRIVE_PASSWD
|
|
||||||
ROBOCOPY . R:\EgtData\$env:APP_NAME /MIR /XF .git* /XD .git
|
|
||||||
SLEEP 2
|
SLEEP 2
|
||||||
net use R: /delete
|
net use X: $env:NET_SHARE_X /u:$env:NET_USERQ $ZDRIVE_PASSWD
|
||||||
|
ROBOCOPY . X:\EgtData\$env:APP_NAME /MIR /XF .git* /XD .git
|
||||||
|
SLEEP 2
|
||||||
|
net use X: /delete
|
||||||
|
|
||||||
# helper copia script verso cartella di rete R:\ delle cartelle 32 e 64
|
# helper copia script verso cartella di rete X:\ delle cartelle bin
|
||||||
.ReplicaR: &ReplicaR
|
.ReplicaR: &ReplicaR
|
||||||
- |
|
- |
|
||||||
net use R: /delete
|
net use X: /delete
|
||||||
net use R: $env:NET_SHARE_R /u:$env:NET_USERQ $ZDRIVE_PASSWD
|
|
||||||
ROBOCOPY /MIR 32 R:\EgtData\$env:APP_NAME\32
|
|
||||||
ROBOCOPY /MIR 64 R:\EgtData\$env:APP_NAME\64
|
|
||||||
ROBOCOPY /MIR Images R:\EgtData\$env:APP_NAME\32\Images
|
|
||||||
ROBOCOPY /MIR Images R:\EgtData\$env:APP_NAME\64\Images
|
|
||||||
SLEEP 2
|
SLEEP 2
|
||||||
net use R: /delete
|
net use X: $env:NET_SHARE_X /u:$env:NET_USERQ $ZDRIVE_PASSWD
|
||||||
|
ROBOCOPY /MIR bin X:\EgtData\$env:APP_NAME\bin
|
||||||
|
ROBOCOPY /MIR Images X:\EgtData\$env:APP_NAME\bin\Images
|
||||||
|
SLEEP 2
|
||||||
|
net use X: /delete
|
||||||
|
|
||||||
# helper copia script verso cartella di rete R:\ delle cartelle 32 e 64
|
# helper copia script verso cartella di rete Z:\ delle cartelle bin
|
||||||
.ReplicaZ: &ReplicaZ
|
.ReplicaZ: &ReplicaZ
|
||||||
- |
|
- |
|
||||||
net use Z: /delete
|
net use Z: /delete
|
||||||
|
SLEEP 2
|
||||||
net use Z: $env:NET_SHARE_Z /u:$env:NET_USERQ $ZDRIVE_PASSWD
|
net use Z: $env:NET_SHARE_Z /u:$env:NET_USERQ $ZDRIVE_PASSWD
|
||||||
ROBOCOPY /MIR 32 Z:\EgtData\$env:APP_NAME\32
|
ROBOCOPY /MIR bin Z:\EgtData\$env:APP_NAME\bin
|
||||||
ROBOCOPY /MIR 64 Z:\EgtData\$env:APP_NAME\64
|
ROBOCOPY /MIR Images Z:\EgtData\$env:APP_NAME\bin\Images
|
||||||
ROBOCOPY /MIR Images Z:\EgtData\$env:APP_NAME\32\Images
|
|
||||||
ROBOCOPY /MIR Images Z:\EgtData\$env:APP_NAME\64\Images
|
|
||||||
SLEEP 2
|
SLEEP 2
|
||||||
net use Z: /delete
|
net use Z: /delete
|
||||||
|
|
||||||
@@ -111,9 +77,7 @@ LuaCompile:build:
|
|||||||
tags:
|
tags:
|
||||||
- win
|
- win
|
||||||
script:
|
script:
|
||||||
- *LuaCompile32
|
- *LuaCompile
|
||||||
- *LuaCompile64
|
|
||||||
- *CodeReplicaR
|
- *CodeReplicaR
|
||||||
- *ReplicaR
|
- *ReplicaR
|
||||||
- *ReplicaZ
|
- *ReplicaZ
|
||||||
|
|
||||||
|
|||||||
+13
-7
@@ -1,4 +1,4 @@
|
|||||||
-- BatchProcess.lua by Egaltech s.r.l. 2022/04/28
|
-- BatchProcess.lua by Egaltech s.r.l. 2022/05/10
|
||||||
-- Gestione calcolo batch disposizione e lavorazioni per Travi
|
-- Gestione calcolo batch disposizione e lavorazioni per Travi
|
||||||
-- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3.
|
-- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3.
|
||||||
-- 2019/07/16 Aggiunta gestione modalità oltre 10 per impostazione macchina e uscita.
|
-- 2019/07/16 Aggiunta gestione modalità oltre 10 per impostazione macchina e uscita.
|
||||||
@@ -23,6 +23,8 @@
|
|||||||
-- 2021/06/16 Se disponibile si aggiunge la versione dell'eseguibile alle info del programma CN.
|
-- 2021/06/16 Se disponibile si aggiunge la versione dell'eseguibile alle info del programma CN.
|
||||||
-- 2021/08/04 Direzione vista simulazione da BD.SIMUL_VIEW_DIR se esiste.
|
-- 2021/08/04 Direzione vista simulazione da BD.SIMUL_VIEW_DIR se esiste.
|
||||||
-- 2022/04/28 In info generazione aggiunta indicazione se 64bit.
|
-- 2022/04/28 In info generazione aggiunta indicazione se 64bit.
|
||||||
|
-- 2023/05/03 Tolleranza su sezione portata a 0.1 mm (100 * GEO.EPS_SMALL).
|
||||||
|
-- 2022/05/10 Dopo aver fatto rotazioni e inversioni dei pezzi cambio chiave Info relative.
|
||||||
|
|
||||||
-- Intestazioni
|
-- Intestazioni
|
||||||
require( 'EgtBase')
|
require( 'EgtBase')
|
||||||
@@ -266,22 +268,26 @@ if bToProcess then
|
|||||||
vBeam[i].PosX = PosX
|
vBeam[i].PosX = PosX
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Eseguo eventuali rotazioni e inversioni testa-coda
|
-- Se non già eseguite, applico eventuali rotazioni e inversioni testa-coda
|
||||||
for i = 1, #vBeam do
|
for i = 1, #vBeam do
|
||||||
local b3Solid = vBeam[i].Box
|
local b3Solid = vBeam[i].Box
|
||||||
-- rotazione
|
-- rotazione
|
||||||
local dRotAng = EgtGetInfo( vBeam[i].Id, 'ROTATED', 'd')
|
local dRotAng = EgtGetInfo( vBeam[i].Id, 'ROTATED', 'd') or 0
|
||||||
if dRotAng and abs( dRotAng) > GEO.EPS_ANG_SMALL then
|
if abs( dRotAng) > GEO.EPS_ANG_SMALL then
|
||||||
local ptRotCen = b3Solid:getCenter()
|
local ptRotCen = b3Solid:getCenter()
|
||||||
EgtRotate( vBeam[i].Id, ptRotCen, X_AX(), dRotAng, GDB_RT.GLOB)
|
EgtRotate( vBeam[i].Id, ptRotCen, X_AX(), dRotAng, GDB_RT.GLOB)
|
||||||
b3Solid:rotate( ptRotCen, X_AX(), dRotAng)
|
b3Solid:rotate( ptRotCen, X_AX(), dRotAng)
|
||||||
end
|
end
|
||||||
|
EgtRemoveInfo( vBeam[i].Id, 'ROTATED')
|
||||||
|
EgtSetInfo( vBeam[i].Id, 'ROTATED_OK', dRotAng)
|
||||||
-- inversione
|
-- inversione
|
||||||
local dInvAng = 180 - ( EgtGetInfo( vBeam[i].Id, 'INVERTED', 'd') or 0)
|
local dInvAng = 180 - ( EgtGetInfo( vBeam[i].Id, 'INVERTED', 'd') or 0)
|
||||||
if abs( dInvAng) > GEO.EPS_ANG_SMALL then
|
if abs( dInvAng) > GEO.EPS_ANG_SMALL then
|
||||||
local ptInvCen = b3Solid:getCenter()
|
local ptInvCen = b3Solid:getCenter()
|
||||||
EgtRotate( vBeam[i].Id, ptInvCen, Z_AX(), dInvAng, GDB_RT.GLOB)
|
EgtRotate( vBeam[i].Id, ptInvCen, Z_AX(), dInvAng, GDB_RT.GLOB)
|
||||||
end
|
end
|
||||||
|
EgtRemoveInfo( vBeam[i].Id, 'INVERTED')
|
||||||
|
EgtSetInfo( vBeam[i].Id, 'INVERTED_OK', 180 - dInvAng)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Ne verifico le dimensioni
|
-- Ne verifico le dimensioni
|
||||||
@@ -291,8 +297,8 @@ if bToProcess then
|
|||||||
for i = 2, #vBeam do
|
for i = 2, #vBeam do
|
||||||
local dDimW = vBeam[i].Box:getDimY()
|
local dDimW = vBeam[i].Box:getDimY()
|
||||||
local dDimH = vBeam[i].Box:getDimZ()
|
local dDimH = vBeam[i].Box:getDimZ()
|
||||||
if ( abs( dDimW - dRawW) > 10 * GEO.EPS_SMALL or abs( dDimH - dRawH) > 10 * GEO.EPS_SMALL) and
|
if ( abs( dDimW - dRawW) > 100 * GEO.EPS_SMALL or abs( dDimH - dRawH) > 100 * GEO.EPS_SMALL) and
|
||||||
( abs( dDimH - dRawW) > 10 * GEO.EPS_SMALL or abs( dDimW - dRawH) > 10 * GEO.EPS_SMALL) then
|
( abs( dDimH - dRawW) > 100 * GEO.EPS_SMALL or abs( dDimW - dRawH) > 100 * GEO.EPS_SMALL) then
|
||||||
table.insert( vBeamErr, i)
|
table.insert( vBeamErr, i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -496,7 +502,7 @@ if ( BEAM.FLAG == 0 and ( bToProcess or bToRecalc)) or BEAM.FLAG == 3 or BEAM.F
|
|||||||
BEAM.MSG = 'Axis outstroke ' .. sErr
|
BEAM.MSG = 'Axis outstroke ' .. sErr
|
||||||
elseif nErr == MCH_SHE.SPECIAL then
|
elseif nErr == MCH_SHE.SPECIAL then
|
||||||
BEAM.ERR = 24
|
BEAM.ERR = 24
|
||||||
BEAM.MSG = 'Clamp move error ' .. sErr
|
BEAM.MSG = 'Special error ' .. sErr
|
||||||
else
|
else
|
||||||
BEAM.ERR = 25
|
BEAM.ERR = 25
|
||||||
BEAM.MSG = 'General failure (contact supplier)'
|
BEAM.MSG = 'General failure (contact supplier)'
|
||||||
|
|||||||
+1
-1
@@ -600,7 +600,7 @@ if ( BEAM.FLAG == 0 and ( bToProcess or bToRecalc)) or BEAM.FLAG == 3 or BEAM.F
|
|||||||
BEAM.MSG = 'Axis outstroke ' .. sErr
|
BEAM.MSG = 'Axis outstroke ' .. sErr
|
||||||
elseif nErr == MCH_SHE.SPECIAL then
|
elseif nErr == MCH_SHE.SPECIAL then
|
||||||
BEAM.ERR = 24
|
BEAM.ERR = 24
|
||||||
BEAM.MSG = 'Clamp move error ' .. sErr
|
BEAM.MSG = 'Special error ' .. sErr
|
||||||
else
|
else
|
||||||
BEAM.ERR = 25
|
BEAM.ERR = 25
|
||||||
BEAM.MSG = 'General failure (contact supplier)'
|
BEAM.MSG = 'General failure (contact supplier)'
|
||||||
|
|||||||
+49
-99
@@ -1,103 +1,53 @@
|
|||||||
|
|
||||||
REM Compilazione degli script Beam Egaltech 2022.05.09
|
REM Compilazione degli script Beam Egaltech 2023.02.27
|
||||||
REM Per togliere info di debug aggiungere flag -s prima del nome del file di input
|
REM Per togliere info di debug aggiungere flag -s prima del nome del file di input
|
||||||
|
|
||||||
REM Compilazione 32 bit
|
REM Compilazione 32 e 64 bit
|
||||||
|
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\BeamExec.lua LuaLibs\BeamExec.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\BeamExec.lua LuaLibs\BeamExec.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\BeamLib.lua LuaLibs\BeamLib.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\BeamLib.lua LuaLibs\BeamLib.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\DiceCut.lua LuaLibs\DiceCut.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\DiceCut.lua LuaLibs\DiceCut.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\FaceByPocket.lua LuaLibs\FaceByPocket.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\FaceByPocket.lua LuaLibs\FaceByPocket.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\FacesBySaw.lua LuaLibs\FacesBySaw.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\FacesBySaw.lua LuaLibs\FacesBySaw.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\MachiningLib.lua LuaLibs\MachiningLib.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\MachiningLib.lua LuaLibs\MachiningLib.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessBlockHausFront.lua LuaLibs\ProcessBlockHausFront.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessBlockHausFront.lua LuaLibs\ProcessBlockHausFront.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessChamfer.lua LuaLibs\ProcessChamfer.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessChamfer.lua LuaLibs\ProcessChamfer.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessCut.lua LuaLibs\ProcessCut.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessCut.lua LuaLibs\ProcessCut.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDecor.lua LuaLibs\ProcessDecor.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDecor.lua LuaLibs\ProcessDecor.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDoubleCut.lua LuaLibs\ProcessDoubleCut.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDoubleCut.lua LuaLibs\ProcessDoubleCut.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDovetail.lua LuaLibs\ProcessDovetail.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDovetail.lua LuaLibs\ProcessDovetail.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDrill.lua LuaLibs\ProcessDrill.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDrill.lua LuaLibs\ProcessDrill.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDtMortise.lua LuaLibs\ProcessDtMortise.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDtMortise.lua LuaLibs\ProcessDtMortise.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDtTenon.lua LuaLibs\ProcessDtTenon.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDtTenon.lua LuaLibs\ProcessDtTenon.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessFreeContour.lua LuaLibs\ProcessFreeContour.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessFreeContour.lua LuaLibs\ProcessFreeContour.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessFrenchRidgeLap.lua LuaLibs\ProcessFrenchRidgeLap.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessFrenchRidgeLap.lua LuaLibs\ProcessFrenchRidgeLap.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessHeadCut.lua LuaLibs\ProcessHeadCut.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessHeadCut.lua LuaLibs\ProcessHeadCut.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLapJoint.lua LuaLibs\ProcessLapJoint.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessLapJoint.lua LuaLibs\ProcessLapJoint.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLapJointNew.lua LuaLibs\ProcessLapJointNew.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessLongCut.lua LuaLibs\ProcessLongCut.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLongCut.lua LuaLibs\ProcessLongCut.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessLongDoubleCut.lua LuaLibs\ProcessLongDoubleCut.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLongDoubleCut.lua LuaLibs\ProcessLongDoubleCut.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessMark.lua LuaLibs\ProcessMark.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessMark.lua LuaLibs\ProcessMark.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessMortise.lua LuaLibs\ProcessMortise.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessMortise.lua LuaLibs\ProcessMortise.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfCamb.lua LuaLibs\ProcessProfCamb.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfCamb.lua LuaLibs\ProcessProfCamb.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfConcave.lua LuaLibs\ProcessProfConcave.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfConcave.lua LuaLibs\ProcessProfConcave.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfConvex.lua LuaLibs\ProcessProfConvex.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfConvex.lua LuaLibs\ProcessProfConvex.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfFront.lua LuaLibs\ProcessProfFront.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfFront.lua LuaLibs\ProcessProfFront.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfHead.lua LuaLibs\ProcessProfHead.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfHead.lua LuaLibs\ProcessProfHead.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessRidgeLap.lua LuaLibs\ProcessRidgeLap.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessRidgeLap.lua LuaLibs\ProcessRidgeLap.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessRoundArch.lua LuaLibs\ProcessRoundArch.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessRoundArch.lua LuaLibs\ProcessRoundArch.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessSawCut.lua LuaLibs\ProcessSawCut.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessSawCut.lua LuaLibs\ProcessSawCut.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessScarfJoint.lua LuaLibs\ProcessScarfJoint.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessScarfJoint.lua LuaLibs\ProcessScarfJoint.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessSimpleScarf.lua LuaLibs\ProcessSimpleScarf.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessSimpleScarf.lua LuaLibs\ProcessSimpleScarf.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessSplit.lua LuaLibs\ProcessSplit.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessSplit.lua LuaLibs\ProcessSplit.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessStepJoint.lua LuaLibs\ProcessStepJoint.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessStepJoint.lua LuaLibs\ProcessStepJoint.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessStepJointNotch.lua LuaLibs\ProcessStepJointNotch.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessStepJointNotch.lua LuaLibs\ProcessStepJointNotch.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessTenon.lua LuaLibs\ProcessTenon.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessTenon.lua LuaLibs\ProcessTenon.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessText.lua LuaLibs\ProcessText.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessText.lua LuaLibs\ProcessText.lua
|
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessTyroleanDovetail.lua LuaLibs\ProcessTyroleanDovetail.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessTyroleanDovetail.lua LuaLibs\ProcessTyroleanDovetail.lua
|
\EgtProg\Dll32\luac54 -o bin\BatchProcess.lua BatchProcess.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\BatchProcess.lua BatchProcess.lua
|
\EgtProg\Dll32\luac54 -o bin\BatchProcessNew.lua BatchProcessNew.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\BatchProcessNew.lua BatchProcessNew.lua
|
\EgtProg\Dll32\luac54 -o bin\GetBeamData.lua GetBeamData.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\GetBeamData.lua GetBeamData.lua
|
\EgtProg\Dll32\luac54 -o bin\NestProcess.lua NestProcess.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\NestProcess.lua NestProcess.lua
|
\EgtProg\Dll32\luac54 -o bin\Process.lua Process.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\Process.lua Process.lua
|
\EgtProg\Dll32\luac54 -o bin\Rotate.lua Rotate.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\Rotate.lua Rotate.lua
|
\EgtProg\Dll32\luac54 -o bin\Swap.lua Swap.lua
|
||||||
\EgtProg\Dll32\luac53 -o 32\Swap.lua Swap.lua
|
\EgtProg\Dll32\luac54 -o bin\Version.lua Version.lua
|
||||||
|
|
||||||
REM Compilazione 64 bit
|
|
||||||
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\BeamExec.lua LuaLibs\BeamExec.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\BeamLib.lua LuaLibs\BeamLib.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\DiceCut.lua LuaLibs\DiceCut.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\FaceByPocket.lua LuaLibs\FaceByPocket.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\FacesBySaw.lua LuaLibs\FacesBySaw.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\MachiningLib.lua LuaLibs\MachiningLib.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessBlockHausFront.lua LuaLibs\ProcessBlockHausFront.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessChamfer.lua LuaLibs\ProcessChamfer.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessCut.lua LuaLibs\ProcessCut.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDecor.lua LuaLibs\ProcessDecor.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDoubleCut.lua LuaLibs\ProcessDoubleCut.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDovetail.lua LuaLibs\ProcessDovetail.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDrill.lua LuaLibs\ProcessDrill.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDtMortise.lua LuaLibs\ProcessDtMortise.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDtTenon.lua LuaLibs\ProcessDtTenon.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessFreeContour.lua LuaLibs\ProcessFreeContour.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessFrenchRidgeLap.lua LuaLibs\ProcessFrenchRidgeLap.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessHeadCut.lua LuaLibs\ProcessHeadCut.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessLapJoint.lua LuaLibs\ProcessLapJoint.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessLapJointNew.lua LuaLibs\ProcessLapJointNew.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessLongCut.lua LuaLibs\ProcessLongCut.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessLongDoubleCut.lua LuaLibs\ProcessLongDoubleCut.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessMark.lua LuaLibs\ProcessMark.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessMortise.lua LuaLibs\ProcessMortise.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfCamb.lua LuaLibs\ProcessProfCamb.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfConcave.lua LuaLibs\ProcessProfConcave.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfConvex.lua LuaLibs\ProcessProfConvex.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfFront.lua LuaLibs\ProcessProfFront.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfHead.lua LuaLibs\ProcessProfHead.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessRidgeLap.lua LuaLibs\ProcessRidgeLap.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessRoundArch.lua LuaLibs\ProcessRoundArch.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessSawCut.lua LuaLibs\ProcessSawCut.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessScarfJoint.lua LuaLibs\ProcessScarfJoint.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessSimpleScarf.lua LuaLibs\ProcessSimpleScarf.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessSplit.lua LuaLibs\ProcessSplit.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessStepJoint.lua LuaLibs\ProcessStepJoint.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessStepJointNotch.lua LuaLibs\ProcessStepJointNotch.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessTenon.lua LuaLibs\ProcessTenon.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessText.lua LuaLibs\ProcessText.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessTyroleanDovetail.lua LuaLibs\ProcessTyroleanDovetail.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\BatchProcess.lua BatchProcess.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\BatchProcessNew.lua BatchProcessNew.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\GetBeamData.lua GetBeamData.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\NestProcess.lua NestProcess.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\Process.lua Process.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\Rotate.lua Rotate.lua
|
|
||||||
\EgtProg\Dll64\luac53 -o 64\Swap.lua Swap.lua
|
|
||||||
|
|||||||
+1
-1
@@ -41,4 +41,4 @@ GWD.OVM_MID = BD.OVM_MID
|
|||||||
-- Tutto ok
|
-- Tutto ok
|
||||||
GWD.ERR = 0
|
GWD.ERR = 0
|
||||||
|
|
||||||
EgtOutLog( ' +++ GetWallData completed')
|
EgtOutLog( ' +++ GetBeamData completed')
|
||||||
|
|||||||
+431
-33
@@ -1,4 +1,4 @@
|
|||||||
-- BeamExec.lua by Egaltech s.r.l. 2022/08/18
|
-- BeamExec.lua by Egaltech s.r.l. 2023/03/31
|
||||||
-- Libreria esecuzione lavorazioni per Travi
|
-- Libreria esecuzione lavorazioni per Travi
|
||||||
-- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3.
|
-- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3.
|
||||||
-- 2019/09/04 Corretto controllo feature di testa e coda con sovramateriale di testa elevato.
|
-- 2019/09/04 Corretto controllo feature di testa e coda con sovramateriale di testa elevato.
|
||||||
@@ -35,6 +35,17 @@
|
|||||||
-- 2022/08/01 Tolleranza su sezione portata a 0.1 mm (100 * GEO.EPS_SMALL).
|
-- 2022/08/01 Tolleranza su sezione portata a 0.1 mm (100 * GEO.EPS_SMALL).
|
||||||
-- 2022/08/08 Modifica per macchine senza BD.MAX_WIDTH2 e BD.MAX_HEIGHT2.
|
-- 2022/08/08 Modifica per macchine senza BD.MAX_WIDTH2 e BD.MAX_HEIGHT2.
|
||||||
-- 2022/08/18 Aggiunta gestione macchine con testa da sotto con lama da sotto disabilitata.
|
-- 2022/08/18 Aggiunta gestione macchine con testa da sotto con lama da sotto disabilitata.
|
||||||
|
-- 2022/09/28 I fori vengono sempre fatti prima delle tacche.
|
||||||
|
-- 2022/09/29 Aggiunta la ricerca di feature specchiate, al momento solo per DtMortise, con le relative funzioni.
|
||||||
|
-- 2022/12/23 Corrette rotazioni 90 deg per macchine con carico da destra.
|
||||||
|
-- 2022/12/28 Implementata gestione forature e code di rondine in doppio.
|
||||||
|
-- 2023/01/31 Implementata gestione mortase in doppio.
|
||||||
|
-- 2023/01/31 Nelle lavorazioni in doppio aggiunta la minima distanza tra le feature.
|
||||||
|
-- 2023/02/17 Ora le forature che intersecano le mortase sono sempre fatte prima della mortasa stessa.
|
||||||
|
-- 2023/02/17 Nelle tasche in doppio, la distanza minima ammessa tra le feature è stata portata a 50.
|
||||||
|
-- 2023/02/20 Ora le mortase a coda di rondine laterali sono sempre fatte prima dei tagli longitudinali.
|
||||||
|
-- 2023/03/31 Corretto ordinamento per fori di coda da lasciare in coda.
|
||||||
|
-- 2023/07/31 Corretto errore nelle mortase in doppio.
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local BeamExec = {}
|
local BeamExec = {}
|
||||||
@@ -149,6 +160,9 @@ local function IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
|||||||
if Drill.Identify( Proc) then
|
if Drill.Identify( Proc) then
|
||||||
return Drill.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
return Drill.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||||
end
|
end
|
||||||
|
if StJoNotch.Identify( Proc) then
|
||||||
|
return StJoNotch.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||||
|
end
|
||||||
if RoundArch.Identify( Proc) then
|
if RoundArch.Identify( Proc) then
|
||||||
return RoundArch.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
return RoundArch.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||||
end
|
end
|
||||||
@@ -214,6 +228,9 @@ local function IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT)
|
|||||||
if Drill.Identify( Proc) then
|
if Drill.Identify( Proc) then
|
||||||
return Drill.IsTailFeature( Proc, b3Raw, dCurrOvmT)
|
return Drill.IsTailFeature( Proc, b3Raw, dCurrOvmT)
|
||||||
end
|
end
|
||||||
|
if StJoNotch.Identify( Proc) then
|
||||||
|
return StJoNotch.IsTailFeature( Proc, b3Raw)
|
||||||
|
end
|
||||||
if DtMortise.Identify( Proc) then
|
if DtMortise.Identify( Proc) then
|
||||||
return DtMortise.IsTailFeature( Proc, b3Raw)
|
return DtMortise.IsTailFeature( Proc, b3Raw)
|
||||||
end
|
end
|
||||||
@@ -258,6 +275,9 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
|
|||||||
local nDo = EgtGetInfo( ProcId, 'DO', 'i') or 1
|
local nDo = EgtGetInfo( ProcId, 'DO', 'i') or 1
|
||||||
local nCutId = EgtGetInfo( EgtGetParent( EgtGetParent( ProcId)), 'CUTID', 'i') or 0
|
local nCutId = EgtGetInfo( EgtGetParent( EgtGetParent( ProcId)), 'CUTID', 'i') or 0
|
||||||
local nTaskId = EgtGetInfo( ProcId, 'TASKID', 'i') or 0
|
local nTaskId = EgtGetInfo( ProcId, 'TASKID', 'i') or 0
|
||||||
|
-- leggo se ci sono feature collegate
|
||||||
|
local nAddAdjId = EgtGetInfo( ProcId, 'ADJID', 'i')
|
||||||
|
local nAddMainId = EgtGetInfo( ProcId, 'MAINID', 'i')
|
||||||
if nGrp and nPrc and nDo == 1 then
|
if nGrp and nPrc and nDo == 1 then
|
||||||
local Proc = {}
|
local Proc = {}
|
||||||
Proc.Id = ProcId
|
Proc.Id = ProcId
|
||||||
@@ -270,6 +290,12 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
|
|||||||
Proc.Fce = 0
|
Proc.Fce = 0
|
||||||
Proc.CutId = nCutId
|
Proc.CutId = nCutId
|
||||||
Proc.TaskId = nTaskId
|
Proc.TaskId = nTaskId
|
||||||
|
-- se ci sono feature collegate ne scrivo il riferimento nella Proc
|
||||||
|
if nAddAdjId then
|
||||||
|
Proc.AdjId = Proc.Id + nAddAdjId
|
||||||
|
elseif nAddMainId then
|
||||||
|
Proc.MainId = Proc.Id + nAddMainId
|
||||||
|
end
|
||||||
Proc.Box = EgtGetBBoxGlob( ProcId, GDB_BB.STANDARD)
|
Proc.Box = EgtGetBBoxGlob( ProcId, GDB_BB.STANDARD)
|
||||||
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.Head = IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||||
@@ -311,6 +337,8 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
|
|||||||
Proc2.Fce = Proc.Fcs
|
Proc2.Fce = Proc.Fcs
|
||||||
Proc2.CutId = Proc.CutId
|
Proc2.CutId = Proc.CutId
|
||||||
Proc2.TaskId = Proc.TaskId
|
Proc2.TaskId = Proc.TaskId
|
||||||
|
Proc2.AdjId = Proc.AdjId
|
||||||
|
Proc2.MainId = Proc.MainId
|
||||||
table.insert( vProc, Proc2)
|
table.insert( vProc, Proc2)
|
||||||
end
|
end
|
||||||
-- se BlockHaus HalfLap
|
-- se BlockHaus HalfLap
|
||||||
@@ -641,7 +669,7 @@ end
|
|||||||
local function OrderFeatures( vProc, b3Raw)
|
local function OrderFeatures( vProc, b3Raw)
|
||||||
|
|
||||||
local dDrillPenalty = EgtIf( BD.PRESS_ROLLER, 200, 100)
|
local dDrillPenalty = EgtIf( BD.PRESS_ROLLER, 200, 100)
|
||||||
local dSmallDrillRange = EgtIf( b3Raw:getDimX() < BD.LEN_SHORT_PART, 200, 600)
|
local dSmallDrillRange = EgtIf( b3Raw:getDimX() < BD.LEN_SHORT_PART, BD.DRILL_RANGE_SP or 200, BD.DRILL_RANGE or 600)
|
||||||
|
|
||||||
-- funzione di confronto
|
-- funzione di confronto
|
||||||
-- secondo centro box in X (taglio di intestazione prima di altri tagli di testa e taglio di separazione però prima di altri tagli di coda)
|
-- secondo centro box in X (taglio di intestazione prima di altri tagli di testa e taglio di separazione però prima di altri tagli di coda)
|
||||||
@@ -670,21 +698,6 @@ local function OrderFeatures( vProc, b3Raw)
|
|||||||
if B1.Head ~= B2.Head then
|
if B1.Head ~= B2.Head then
|
||||||
return B1.Head
|
return B1.Head
|
||||||
end
|
end
|
||||||
-- se entrambi tenoni e si intersecano, metto prima tenone vero e poi base tenone
|
|
||||||
if ( Tenon.Identify( B1) or DtTenon.Identify( B1)) and ( Tenon.Identify( B2) or DtTenon.Identify( B2)) and
|
|
||||||
B1.Box:getMin():getX() < B2.Box:getMax():getX() + 100 * GEO.EPS_SMALL and B2.Box:getMin():getX() < B1.Box:getMax():getX() + 100 * GEO.EPS_SMALL then
|
|
||||||
return ( ( B1.Prc == 50 or B1.Prc == 55) and B2.Prc == 52)
|
|
||||||
end
|
|
||||||
-- se primo house mortise, secondo mortise e si intersecano, metto prima house mortise
|
|
||||||
if Mortise.Identify( B1) and B1.Prc == 53 and ( Mortise.Identify( B2) or DtMortise.Identify( B2)) and B2.Prc ~= 53 and
|
|
||||||
B1.Box:getMin():getX() < B2.Box:getMax():getX() + 100 * GEO.EPS_SMALL and B2.Box:getMin():getX() < B1.Box:getMax():getX() + 100 * GEO.EPS_SMALL then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
-- se primo mortise, secondo house mortise e si intersecano, metto prima house mortise
|
|
||||||
if ( Mortise.Identify( B1) or DtMortise.Identify( B1)) and B1.Prc ~= 53 and Mortise.Identify( B2) and B2.Prc == 53 and
|
|
||||||
B1.Box:getMin():getX() < B2.Box:getMax():getX() + 100 * GEO.EPS_SMALL and B2.Box:getMin():getX() < B1.Box:getMax():getX() + 100 * GEO.EPS_SMALL then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
-- se entrambi di testa e primo è scasso o mortasa e secondo no va messo dopo
|
-- 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
|
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
|
not ( LapJoint.Identify( B2) or Mortise.Identify( B2) or DtMortise.Identify( B2)) then
|
||||||
@@ -695,14 +708,6 @@ local function OrderFeatures( vProc, b3Raw)
|
|||||||
not ( LapJoint.Identify( B1) or Mortise.Identify( B1) or DtMortise.Identify( B1)) then
|
not ( LapJoint.Identify( B1) or Mortise.Identify( B1) or DtMortise.Identify( B1)) then
|
||||||
return true
|
return true
|
||||||
end
|
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
|
|
||||||
end
|
|
||||||
-- se secondo è feature di coda e l'altro è separazione o non è feature di coda
|
|
||||||
if B2.Tail and ( Split.Identify( B1) or not B1.Tail) then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
-- se primo è feature di coda anticipata e l'altro non è feature di coda
|
-- se primo è feature di coda anticipata e l'altro non è feature di coda
|
||||||
if B1.AdvTail and ( not Split.Identify( B2) or not B2.Tail) then
|
if B1.AdvTail and ( not Split.Identify( B2) or not B2.Tail) then
|
||||||
return false
|
return false
|
||||||
@@ -711,6 +716,14 @@ local function OrderFeatures( vProc, b3Raw)
|
|||||||
if B2.AdvTail and ( not Split.Identify( B1) or not B1.Tail) then
|
if B2.AdvTail and ( not Split.Identify( B1) or not B1.Tail) then
|
||||||
return true
|
return true
|
||||||
end
|
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
|
||||||
|
end
|
||||||
|
-- se secondo è feature di coda e l'altro è separazione o non è feature di coda
|
||||||
|
if B2.Tail and ( Split.Identify( B1) or not B1.Tail) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
-- se primo è scasso o mortasa di coda e secondo no, sempre dopo
|
-- se primo è scasso o mortasa di coda e secondo no, sempre dopo
|
||||||
if B1.Tail and ( LapJoint.Identify( B1) or Mortise.Identify( B1) or DtMortise.Identify( B1)) and
|
if B1.Tail and ( LapJoint.Identify( B1) or Mortise.Identify( B1) or DtMortise.Identify( B1)) and
|
||||||
not ( B2.Tail and ( LapJoint.Identify( B2) or Mortise.Identify( B2) or DtMortise.Identify( B2))) then
|
not ( B2.Tail and ( LapJoint.Identify( B2) or Mortise.Identify( B2) or DtMortise.Identify( B2))) then
|
||||||
@@ -738,6 +751,16 @@ local function OrderFeatures( vProc, b3Raw)
|
|||||||
if abs( B2.Box:getDimX() - b3Raw:getDimX()) < 0.2 * b3Raw:getDimX() then
|
if abs( B2.Box:getDimX() - b3Raw:getDimX()) < 0.2 * b3Raw:getDimX() then
|
||||||
return not ( B1.Tail or B2.Box:getMin():getX() + 20 > B1.Box:getCenter():getX())
|
return not ( B1.Tail or B2.Box:getMin():getX() + 20 > B1.Box:getCenter():getX())
|
||||||
end
|
end
|
||||||
|
-- se primo è foro e 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
|
-- se primo è foro e l'altro no, lo penalizzo
|
||||||
if B1.Prc == 40 and B2.Prc ~= 40 then
|
if B1.Prc == 40 and B2.Prc ~= 40 then
|
||||||
return ( B1.Box:getCenter():getX() > B2.Box:getMax():getX() + dDrillPenalty)
|
return ( B1.Box:getCenter():getX() > B2.Box:getMax():getX() + dDrillPenalty)
|
||||||
@@ -746,6 +769,31 @@ local function OrderFeatures( vProc, b3Raw)
|
|||||||
if B1.Prc ~= 40 and B2.Prc == 40 then
|
if B1.Prc ~= 40 and B2.Prc == 40 then
|
||||||
return ( B1.Box:getMax():getX() + dDrillPenalty > B2.Box:getCenter():getX())
|
return ( B1.Box:getMax():getX() + dDrillPenalty > B2.Box:getCenter():getX())
|
||||||
end
|
end
|
||||||
|
-- se prima è mortasa coda di rondine sul fianco e secondo taglio longitudinale, la coda di rondine va sempre prima
|
||||||
|
if DtMortise.SideIdentify(B1) and ( LongCut.Identify(B2) or Long2Cut.Identify(B2)) and
|
||||||
|
OverlapsX( B1.Box, B2.Box) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
-- se primo è taglio longitudinale e seconda è mortasa coda di rondine sul fianco, il taglio longitudinale va sempre dopo
|
||||||
|
if ( LongCut.Identify(B1) or Long2Cut.Identify(B1)) and DtMortise.SideIdentify(B2) and
|
||||||
|
OverlapsX( B1.Box, B2.Box) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
-- se entrambi tenoni e si intersecano, metto prima tenone vero e poi base tenone
|
||||||
|
if ( Tenon.Identify( B1) or DtTenon.Identify( B1)) and ( Tenon.Identify( B2) or DtTenon.Identify( B2)) and
|
||||||
|
B1.Box:getMin():getX() < B2.Box:getMax():getX() + 100 * GEO.EPS_SMALL and B2.Box:getMin():getX() < B1.Box:getMax():getX() + 100 * GEO.EPS_SMALL then
|
||||||
|
return ( ( B1.Prc == 50 or B1.Prc == 55) and B2.Prc == 52)
|
||||||
|
end
|
||||||
|
-- se primo house mortise, secondo mortise e si intersecano, metto prima house mortise
|
||||||
|
if Mortise.Identify( B1) and B1.Prc == 53 and ( Mortise.Identify( B2) or DtMortise.Identify( B2)) and B2.Prc ~= 53 and
|
||||||
|
B1.Box:getMin():getX() < B2.Box:getMax():getX() + 100 * GEO.EPS_SMALL and B2.Box:getMin():getX() < B1.Box:getMax():getX() + 100 * GEO.EPS_SMALL then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
-- se primo mortise, secondo house mortise e si intersecano, metto prima house mortise
|
||||||
|
if ( Mortise.Identify( B1) or DtMortise.Identify( B1)) and B1.Prc ~= 53 and Mortise.Identify( B2) and B2.Prc == 53 and
|
||||||
|
B1.Box:getMin():getX() < B2.Box:getMax():getX() + 100 * GEO.EPS_SMALL and B2.Box:getMin():getX() < B1.Box:getMax():getX() + 100 * GEO.EPS_SMALL then
|
||||||
|
return false
|
||||||
|
end
|
||||||
-- se entrambi fori con posizione praticamente uguale ordino secondo diametro e faccia di inizio (Fcs)
|
-- 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 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 abs( B1.Diam - B2.Diam) < 1.0 then
|
||||||
@@ -926,11 +974,11 @@ local function ClassifyFeatures( vProc, b3Raw, Stats)
|
|||||||
local bDownSideOnHeadOk = false
|
local bDownSideOnHeadOk = false
|
||||||
|
|
||||||
if Proc.MachineBeforeIntersectingDrillings then
|
if Proc.MachineBeforeIntersectingDrillings then
|
||||||
table.Insert ( vMachineBeforeIntersectingDrillingsId, Proc.Id)
|
table.insert( vMachineBeforeIntersectingDrillingsId, Proc.Id)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- se senza geometria (già disabilitato
|
-- se senza geometria (già disabilitato)
|
||||||
if Proc.Flg == 0 then
|
if Proc.Flg == 0 and not Proc.Double then
|
||||||
bOk = false
|
bOk = false
|
||||||
-- se intestatura
|
-- se intestatura
|
||||||
elseif Hcut.Identify( Proc) then
|
elseif Hcut.Identify( Proc) then
|
||||||
@@ -1238,7 +1286,7 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
|
|||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
bOk = false
|
bOk = false
|
||||||
end
|
end
|
||||||
return bOk, sErr, nNewPhase
|
return bOk, sErr, ( nNewPhase or -1)
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
@@ -1345,6 +1393,331 @@ local function MoveDrillsOnTenon( vProc)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
-- Controlla se la feature ProcMirror è la specchiata di Proc, per feature di tipo tasca o simile
|
||||||
|
local function CheckMirrorPocket( Proc, ProcMirror, b3Raw, AuxId)
|
||||||
|
|
||||||
|
-- recupero i dati geometrici della curva Proc
|
||||||
|
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
||||||
|
local ptBC = EgtGP( AuxId, GDB_RT.GLOB)
|
||||||
|
local rfDtMrt = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0, GDB_RT.GLOB)
|
||||||
|
local b3DtMrt = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, rfDtMrt)
|
||||||
|
local b3Proc = EgtGetBBoxGlob( Proc.Id, GDB_BB.STANDARD)
|
||||||
|
|
||||||
|
-- recupero e verifico l'entità curva ProcMirror
|
||||||
|
local AuxIdMirror = EgtGetInfo( ProcMirror.Id, 'AUXID', 'i')
|
||||||
|
if AuxIdMirror then AuxIdMirror = AuxIdMirror + ProcMirror.Id end
|
||||||
|
if not AuxIdMirror or ( EgtGetType( AuxIdMirror) & GDB_FY.GEO_CURVE) == 0 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
-- se Mortise, se curva di contorno aperta la rendo chiusa
|
||||||
|
if Mortise.SideIdentify( ProcMirror) then
|
||||||
|
BL.ConvertToClosedCurve( ProcMirror, AuxIdMirror)
|
||||||
|
end
|
||||||
|
-- recupero i dati geometrici della curva ProcMirror
|
||||||
|
local vtExtrMirror = EgtCurveExtrusion( AuxIdMirror, GDB_RT.GLOB)
|
||||||
|
local ptBCMirror = EgtGP( AuxIdMirror, GDB_RT.GLOB)
|
||||||
|
local b3DtMrtMirror = EgtGetBBoxRef( ProcMirror.Id, GDB_BB.STANDARD, rfDtMrt)
|
||||||
|
local b3ProcMirror = EgtGetBBoxGlob( ProcMirror.Id, GDB_BB.STANDARD)
|
||||||
|
|
||||||
|
-- verifico se le mortase sono specchiate :
|
||||||
|
-- devono avere estrusioni opposte
|
||||||
|
if not AreOppositeVectorApprox( vtExtr, vtExtrMirror) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
-- se di tipo Dt, devono avere l'asse allineato
|
||||||
|
if DtMortise.SideIdentify( Proc) or DtMortise.SideIdentify( ProcMirror) then
|
||||||
|
local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB)
|
||||||
|
local vtAxMirror = EgtEV( AuxIdMirror, GDB_RT.GLOB) - EgtSV( AuxIdMirror, GDB_RT.GLOB)
|
||||||
|
if not AreSameVectorApprox( vtAx, vtAxMirror) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- devono avere il centro allineato, essere equidistanti dalla mezzaria 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
|
||||||
|
( abs( ptBC:getY() - ptCenRaw:getY()) - abs( ptBCMirror:getY() - ptCenRaw:getY())) < 500 * GEO.EPS_SMALL and
|
||||||
|
dYMinDistance > dMinimumDistanceMirroredFeatures + 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
|
||||||
|
( abs( ptBC:getZ() - ptCenRaw:getZ()) - abs( ptBCMirror:getZ() - ptCenRaw:getZ())) < 500 * GEO.EPS_SMALL and
|
||||||
|
dZMinDistance > dMinimumDistanceMirroredFeatures + 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
|
||||||
|
abs( b3DtMrt:getDimZ() - b3DtMrtMirror:getDimZ()) < 500 * GEO.EPS_SMALL) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
-- Verifica se Proc (mortasa) è lavorabile in doppio e nel caso ne imposta i dati.
|
||||||
|
local function VerifyMortiseMirrored( Proc, vProc, b3Raw)
|
||||||
|
-- recupero e verifico l'entità curva
|
||||||
|
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
|
||||||
|
if AuxId then
|
||||||
|
AuxId = AuxId + Proc.Id
|
||||||
|
end
|
||||||
|
if not AuxId or ( EgtGetType( AuxId) & GDB_FY.GEO_CURVE) == 0 then
|
||||||
|
local sErr = 'Error : missing profile geometry'
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
-- recupero versore estrusione della curva supplementare
|
||||||
|
local vtExtr = EgtCurveExtrusion( AuxId, GDB_ID.ROOT)
|
||||||
|
-- Se curva di contorno aperta la converto in curva chiusa
|
||||||
|
BL.ConvertToClosedCurve( Proc, AuxId)
|
||||||
|
-- recupero i dati della faccia di fondo
|
||||||
|
local frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0, GDB_ID.ROOT)
|
||||||
|
-- determino larghezza della mortasa
|
||||||
|
if dL < dW then dL, dW = dW, dL end
|
||||||
|
local ptC = ORIG()
|
||||||
|
local vtN = V_NULL()
|
||||||
|
if frMor then
|
||||||
|
ptC = frMor:getOrigin()
|
||||||
|
vtN = frMor:getVersZ()
|
||||||
|
end
|
||||||
|
-- se mortasa passante esco
|
||||||
|
local bOpenBtm = not AreSameVectorApprox( vtExtr, vtN)
|
||||||
|
if bOpenBtm then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
-- determino altezza della mortasa
|
||||||
|
local b3Mor = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frMor)
|
||||||
|
local dMorH = b3Mor:getDimZ()
|
||||||
|
-- elevazione del punto centrale
|
||||||
|
local _, dCenElev = BL.GetPointDirDepth( nPartId, ptC, vtN)
|
||||||
|
dMorH = max( dMorH, dCenElev or 0)
|
||||||
|
-- recupero lavorazione adatta
|
||||||
|
local sPockType = 'Mortise'
|
||||||
|
local sPocketing
|
||||||
|
if Proc.Prc ~= 53 then
|
||||||
|
sPocketing = Mortise.VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType, false, true)
|
||||||
|
end
|
||||||
|
if not sPocketing then
|
||||||
|
sPockType = 'Pocket'
|
||||||
|
sPocketing = Mortise.VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType, false, true)
|
||||||
|
end
|
||||||
|
if not sPocketing or not EgtMdbSetCurrMachining( sPocketing) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
-- recupero il suo utensile
|
||||||
|
if not EgtTdbSetCurrTool( EgtMdbGetCurrMachiningParam( MCH_MP.TOOL) or '') then
|
||||||
|
return
|
||||||
|
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
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local dToolDoubleDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM, 'd')
|
||||||
|
-- verifico se possibile in doppio (diametro utensile e direzione feature)
|
||||||
|
if dToolDoubleDiam < dW + GEO.EPS_SMALL and ( AreSameOrOppositeVectorApprox( vtExtr, Y_AX()) or AreSameVectorApprox( vtExtr, Z_AX())) then
|
||||||
|
for i = 1, #vProc do
|
||||||
|
local ProcMirror = vProc[i]
|
||||||
|
if Mortise.SideIdentify( ProcMirror) and ProcMirror.Id ~= Proc.Id and ProcMirror.Flg ~= 0 then
|
||||||
|
if CheckMirrorPocket( Proc, ProcMirror, b3Raw, AuxId) then
|
||||||
|
if ( not BD.DOWN_HEAD and AreSameVectorApprox( vtExtr, Y_AX())) or
|
||||||
|
( BD.DOWN_HEAD and AreOppositeVectorApprox( vtExtr, Y_AX())) then
|
||||||
|
Proc.Double = 2
|
||||||
|
Proc.MirrorId = ProcMirror.Id
|
||||||
|
Proc.MirrorCutId = ProcMirror.CutId
|
||||||
|
Proc.MirrorTaskId = ProcMirror.TaskId
|
||||||
|
ProcMirror.Flg = 0
|
||||||
|
ProcMirror.Double = 0
|
||||||
|
elseif BD.DOWN_HEAD and AreSameVectorApprox( vtExtr, Z_AX()) then
|
||||||
|
Proc.Double = 3
|
||||||
|
Proc.MirrorId = ProcMirror.Id
|
||||||
|
Proc.MirrorCutId = ProcMirror.CutId
|
||||||
|
Proc.MirrorTaskId = ProcMirror.TaskId
|
||||||
|
ProcMirror.Flg = 0
|
||||||
|
ProcMirror.Double = 0
|
||||||
|
end
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
-- Verifica se Proc (mortasa a coda di rondine) è lavorabile in doppio e nel caso ne imposta i dati.
|
||||||
|
local function VerifyDtMortiseMirrored( Proc, vProc, b3Raw)
|
||||||
|
-- verifico se con tasca
|
||||||
|
local bPocket = ( EgtGetInfo( Proc.Id, 'P05', 'i') == 1)
|
||||||
|
if bPocket then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
-- recupero e verifico l'entità curva ausiliaria
|
||||||
|
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
|
||||||
|
if AuxId then AuxId = AuxId + Proc.Id end
|
||||||
|
if not AuxId or ( EgtGetType( AuxId) & GDB_FY.GEO_CURVE) == 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
||||||
|
-- recupero il raggio minimo della mortasa
|
||||||
|
local dMinRad = 1000
|
||||||
|
local nSt, nEnd = EgtCurveDomain( AuxId)
|
||||||
|
for i = nSt, nEnd - 1 do
|
||||||
|
local dRad = EgtCurveCompoRadius( AuxId, i)
|
||||||
|
if dRad > 0 and dRad < dMinRad then
|
||||||
|
dMinRad = dRad
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- recupero lavorazione adatta
|
||||||
|
local dMaxDiam = 2 * dMinRad
|
||||||
|
local sMilling = ML.FindMilling( 'DtMortise', nil, nil, dMaxDiam, nil, true, false, true)
|
||||||
|
if not sMilling or not EgtMdbSetCurrMachining( sMilling) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
-- recupero il suo utensile
|
||||||
|
if not EgtTdbSetCurrTool( EgtMdbGetCurrMachiningParam( MCH_MP.TOOL) or '') then
|
||||||
|
return
|
||||||
|
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
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local dToolDoubleDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM, 'd')
|
||||||
|
-- verifico se possibile in doppio (diametro utensile e direzione feature)
|
||||||
|
if dToolDoubleDiam < dMaxDiam + GEO.EPS_SMALL and ( AreSameOrOppositeVectorApprox( vtExtr, Y_AX()) or AreSameVectorApprox( vtExtr, Z_AX())) then
|
||||||
|
for i = 1, #vProc do
|
||||||
|
local ProcMirror = vProc[i]
|
||||||
|
if DtMortise.SideIdentify( ProcMirror) and ProcMirror.Id ~= Proc.Id and ProcMirror.Flg ~= 0 then
|
||||||
|
if CheckMirrorPocket( Proc, ProcMirror, b3Raw, AuxId) then
|
||||||
|
if ( not BD.DOWN_HEAD and AreSameVectorApprox( vtExtr, Y_AX())) or
|
||||||
|
( BD.DOWN_HEAD and AreOppositeVectorApprox( vtExtr, Y_AX())) then
|
||||||
|
Proc.Double = 2
|
||||||
|
Proc.MirrorId = ProcMirror.Id
|
||||||
|
Proc.MirrorCutId = ProcMirror.CutId
|
||||||
|
Proc.MirrorTaskId = ProcMirror.TaskId
|
||||||
|
ProcMirror.Flg = 0
|
||||||
|
ProcMirror.Double = 0
|
||||||
|
elseif BD.DOWN_HEAD and AreSameVectorApprox( vtExtr, Z_AX()) then
|
||||||
|
Proc.Double = 3
|
||||||
|
Proc.MirrorId = ProcMirror.Id
|
||||||
|
Proc.MirrorCutId = ProcMirror.CutId
|
||||||
|
Proc.MirrorTaskId = ProcMirror.TaskId
|
||||||
|
ProcMirror.Flg = 0
|
||||||
|
ProcMirror.Double = 0
|
||||||
|
end
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
-- Disabilita la foratura dall'altra parte dello stesso foro
|
||||||
|
local function DisableOtherDrilling( Proc, vProc)
|
||||||
|
local ProcMirror
|
||||||
|
for i = 1, #vProc do
|
||||||
|
if vProc[i].Id == Proc.Id and not vProc[i].Double then
|
||||||
|
ProcMirror = vProc[i]
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if ProcMirror then
|
||||||
|
ProcMirror.Flg = 0
|
||||||
|
ProcMirror.Double = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
-- Verifica se Proc (foratura) è lavorabile in doppio e nel caso ne restituisce la direzione di specchiatura.
|
||||||
|
local function VerifyDrillMirrored( Proc, vProc, b3Raw)
|
||||||
|
-- recupero e verifico l'entità foro
|
||||||
|
local 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
|
||||||
|
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
|
||||||
|
-- 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
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local dDrillingStep = EgtMdbGetCurrMachiningParam( MCH_MP.STEP)
|
||||||
|
-- recupero il suo utensile
|
||||||
|
if not EgtTdbSetCurrTool( EgtMdbGetCurrMachiningParam( MCH_MP.TOOL) or '') then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
-- recupero la lunghezza della parte inclinata della punta
|
||||||
|
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
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local dToolDoubleDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM, 'd')
|
||||||
|
local dToolDoubleMaxDepth = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
|
||||||
|
-- recupero la lunghezza della parte inclinata della punta
|
||||||
|
local dToolDoubleTipLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) - EgtTdbGetCurrToolParam( MCH_TP.LEN)
|
||||||
|
-- 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 Proc.Flg == -2 then vtExtr = -vtExtr end
|
||||||
|
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)
|
||||||
|
elseif BD.DOWN_HEAD and AreSameVectorApprox( vtExtr, Z_AX()) then
|
||||||
|
Proc.Double = 3
|
||||||
|
Proc.MachDepthDouble = dMachiningDepth
|
||||||
|
DisableOtherDrilling( Proc, vProc)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
-- Cerca in vProc la presenza di feature da lavorare in doppio. Se le trova scrive in Proc la direzione di specchiatura e l'utensile da utilizzare.
|
||||||
|
local function SetMirroredFeatures( vProc, b3Raw)
|
||||||
|
for i = 1, #vProc do
|
||||||
|
local Proc = vProc[i]
|
||||||
|
if Proc.Flg ~= 0 then
|
||||||
|
-- Proc.Double -> 0: nessuna specchiatura, 1: specchiatura X, 2: specchiatura Y, 3: specchiatura Z
|
||||||
|
-- Proc.MirrorId -> Id della feature mirrorata
|
||||||
|
if DtMortise.SideIdentify( Proc) and BD.DOUBLE_HEAD_DOVETAIL then
|
||||||
|
VerifyDtMortiseMirrored( Proc, vProc, b3Raw)
|
||||||
|
elseif Mortise.SideIdentify( Proc) and BD.DOUBLE_HEAD_MORTISE then
|
||||||
|
VerifyMortiseMirrored( Proc, vProc, b3Raw)
|
||||||
|
elseif Drill.Identify( Proc) and BD.DOUBLE_HEAD_DRILLING then
|
||||||
|
VerifyDrillMirrored( Proc, vProc, b3Raw)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
-- verifica se ci sono forature da lavorare dopo tagli di testa o coda e nel caso le classifica come Head o Tail e gli assegna l'Id della rispettiva feature di taglio
|
-- verifica se ci sono forature da lavorare dopo tagli di testa o coda e nel caso le classifica come Head o Tail e gli assegna l'Id della rispettiva feature di taglio
|
||||||
local function SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeIntersectingDrillings)
|
local function SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeIntersectingDrillings)
|
||||||
@@ -1439,6 +1812,10 @@ function BeamExec.ProcessFeatures()
|
|||||||
if BD.IMPROVE_HEAD_TAIL_DRILLINGS then
|
if BD.IMPROVE_HEAD_TAIL_DRILLINGS then
|
||||||
SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeIntersectingDrillings)
|
SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeIntersectingDrillings)
|
||||||
end
|
end
|
||||||
|
-- verifica presenza di feature specchiate per eventuali lavorazioni simultanee
|
||||||
|
if BD.TWO_EQUAL_HEADS or BD.DOWN_HEAD then
|
||||||
|
SetMirroredFeatures( vProc, b3Raw)
|
||||||
|
end
|
||||||
-- le ordino lungo X
|
-- le ordino lungo X
|
||||||
OrderFeatures( vProc, b3Raw)
|
OrderFeatures( vProc, b3Raw)
|
||||||
-- le classifico
|
-- le classifico
|
||||||
@@ -1469,11 +1846,15 @@ function BeamExec.ProcessFeatures()
|
|||||||
nRId = EgtGetNextRawPart( nRId)
|
nRId = EgtGetNextRawPart( nRId)
|
||||||
end
|
end
|
||||||
EgtSetInfo( nDispId, 'ROT', -2)
|
EgtSetInfo( nDispId, 'ROT', -2)
|
||||||
|
-- flag feature precedente in doppio
|
||||||
|
local nPrevDouble = 0
|
||||||
-- inserisco le lavorazioni da lavorare ribaltate
|
-- inserisco le lavorazioni da lavorare ribaltate
|
||||||
for i = 1, #vProc do
|
for i = 1, #vProc do
|
||||||
-- creo la lavorazione
|
-- creo la lavorazione
|
||||||
local Proc = vProc[i]
|
local Proc = vProc[i]
|
||||||
if Proc.Flg ~= 0 and Proc.Down then
|
if Proc.Flg ~= 0 and Proc.Down then
|
||||||
|
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 = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut, b3Raw, nOrd, sDownOrSideOrStd, nil, nil, dCurrOvmT)
|
||||||
if not bOk then
|
if not bOk then
|
||||||
nTotErr = nTotErr + 1
|
nTotErr = nTotErr + 1
|
||||||
@@ -1482,6 +1863,9 @@ function BeamExec.ProcessFeatures()
|
|||||||
table.insert( Stats, {Err=-1, Msg=sMsg, Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
table.insert( Stats, {Err=-1, Msg=sMsg, Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
||||||
else
|
else
|
||||||
table.insert( Stats, {Err=0, Msg='', Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
table.insert( Stats, {Err=0, Msg='', Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
||||||
|
if Proc.Double == 2 or Proc.Double == 3 then
|
||||||
|
table.insert( Stats, {Err=0, Msg='', Rot=-2, CutId=Proc.MirrorCutId, TaskId=Proc.MirrorTaskId})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
-- se è taglio di separazione, verifico se ha già aggiunto una nuova fase oppure se è da creare
|
-- se è taglio di separazione, verifico se ha già aggiunto una nuova fase oppure se è da creare
|
||||||
if nNewPhase > 0 then
|
if nNewPhase > 0 then
|
||||||
@@ -1527,7 +1911,7 @@ function BeamExec.ProcessFeatures()
|
|||||||
sDownOrSideOrStd = 'SIDE'
|
sDownOrSideOrStd = 'SIDE'
|
||||||
-- vettore movimento grezzi per rotazione di 90deg
|
-- vettore movimento grezzi per rotazione di 90deg
|
||||||
local dDeltaYZ = EgtGetRawPartBBox( nRawId):getDimY() - EgtGetRawPartBBox( nRawId):getDimZ()
|
local dDeltaYZ = EgtGetRawPartBBox( nRawId):getDimY() - EgtGetRawPartBBox( nRawId):getDimZ()
|
||||||
local vtMove = Vector3d( 0, dDeltaYZ / 2, dDeltaYZ / 2)
|
local vtMove = Vector3d( 0, dDeltaYZ / 2 * EgtIf( BD.RIGHT_LOAD, -1, 1), dDeltaYZ / 2)
|
||||||
local bPreMove = ( dDeltaYZ < 0)
|
local bPreMove = ( dDeltaYZ < 0)
|
||||||
-- ruoto le travi della fase corrente
|
-- ruoto le travi della fase corrente
|
||||||
local nRId = nRawId
|
local nRId = nRawId
|
||||||
@@ -1538,20 +1922,27 @@ function BeamExec.ProcessFeatures()
|
|||||||
nRId = EgtGetNextRawPart( nRId)
|
nRId = EgtGetNextRawPart( nRId)
|
||||||
end
|
end
|
||||||
EgtSetInfo( nDispId, 'ROT', -1)
|
EgtSetInfo( nDispId, 'ROT', -1)
|
||||||
|
-- flag feature precedente in doppio
|
||||||
|
local nPrevDouble = 0
|
||||||
-- inserisco le lavorazioni da lavorare ruotate
|
-- inserisco le lavorazioni da lavorare ruotate
|
||||||
local nSideMchOk = 0
|
local nSideMchOk = 0
|
||||||
for i = 1, #vProc do
|
for i = 1, #vProc do
|
||||||
-- creo la lavorazione
|
-- creo la lavorazione
|
||||||
local Proc = vProc[i]
|
local Proc = vProc[i]
|
||||||
if Proc.Flg ~= 0 and Proc.Side then
|
if Proc.Flg ~= 0 and Proc.Side then
|
||||||
|
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 = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dCurrOvmT)
|
||||||
if not bOk then
|
if not bOk then
|
||||||
nTotErr = nTotErr + 1
|
nTotErr = nTotErr + 1
|
||||||
table.insert( Stats, {Err=1, Msg=sMsg, Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
table.insert( Stats, {Err=1, Msg=sMsg, Rot=-1, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
||||||
elseif sMsg and #sMsg > 0 then
|
elseif sMsg and #sMsg > 0 then
|
||||||
table.insert( Stats, {Err=-1, Msg=sMsg, Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
table.insert( Stats, {Err=-1, Msg=sMsg, Rot=-1, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
||||||
else
|
else
|
||||||
table.insert( Stats, {Err=0, Msg='', Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
table.insert( Stats, {Err=0, Msg='', Rot=-1, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
||||||
|
if Proc.Double == 2 or Proc.Double == 3 then
|
||||||
|
table.insert( Stats, {Err=0, Msg='', Rot=-1, CutId=Proc.MirrorCutId, TaskId=Proc.MirrorTaskId})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if bOk then nSideMchOk = nSideMchOk + 1 end
|
if bOk then nSideMchOk = nSideMchOk + 1 end
|
||||||
-- se era taglio di separazione, aggiungo nuova fase
|
-- se era taglio di separazione, aggiungo nuova fase
|
||||||
@@ -1597,11 +1988,15 @@ function BeamExec.ProcessFeatures()
|
|||||||
EgtSetInfo( nDispId, 'ORD', nOrd)
|
EgtSetInfo( nDispId, 'ORD', nOrd)
|
||||||
end
|
end
|
||||||
sDownOrSideOrStd = 'STD'
|
sDownOrSideOrStd = 'STD'
|
||||||
|
-- flag feature precedente in doppio
|
||||||
|
local nPrevDouble = 0
|
||||||
-- inserisco le lavorazioni non ribaltate della trave
|
-- inserisco le lavorazioni non ribaltate della trave
|
||||||
for i = 1, #vProc do
|
for i = 1, #vProc do
|
||||||
-- creo la lavorazione
|
-- creo la lavorazione
|
||||||
local Proc = vProc[i]
|
local Proc = vProc[i]
|
||||||
if Proc.Flg ~= 0 and ( not ( Proc.Down or Proc.Side) or BD.DOWN_HEAD or BD.TURN) then
|
if Proc.Flg ~= 0 and ( not ( Proc.Down or Proc.Side) or BD.DOWN_HEAD or BD.TURN) then
|
||||||
|
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 = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw, nOrd, sDownOrSideOrStd, nil, nil, dCurrOvmT)
|
||||||
if not bOk then
|
if not bOk then
|
||||||
nTotErr = nTotErr + 1
|
nTotErr = nTotErr + 1
|
||||||
@@ -1610,6 +2005,9 @@ function BeamExec.ProcessFeatures()
|
|||||||
table.insert( Stats, {Err=-1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
table.insert( Stats, {Err=-1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
||||||
else
|
else
|
||||||
table.insert( Stats, {Err=0, Msg='', Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
table.insert( Stats, {Err=0, Msg='', Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
||||||
|
if Proc.Double == 2 or Proc.Double == 3 then
|
||||||
|
table.insert( Stats, {Err=0, Msg='', Rot=0, CutId=Proc.MirrorCutId, TaskId=Proc.MirrorTaskId})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
-- se era taglio di separazione, aggiungo nuova fase
|
-- se era taglio di separazione, aggiungo nuova fase
|
||||||
if nNewPhase > 0 then
|
if nNewPhase > 0 then
|
||||||
|
|||||||
+253
-9
@@ -1,4 +1,4 @@
|
|||||||
-- BeamLib.lua by Egaltech s.r.l. 2022/07/12
|
-- BeamLib.lua by Egaltech s.r.l. 2023/03/22
|
||||||
-- Libreria globale per Travi
|
-- Libreria globale per Travi
|
||||||
-- 2020/07/28 Corretto calcolo attacchi e uscite di lame per non uscire dalla faccia sotto.
|
-- 2020/07/28 Corretto calcolo attacchi e uscite di lame per non uscire dalla faccia sotto.
|
||||||
-- 2020/08/18 Aggiunto a GetNearestParalOpposite e GetNearestOrthoOpposite parametro opzionale vtNorm.
|
-- 2020/08/18 Aggiunto a GetNearestParalOpposite e GetNearestOrthoOpposite parametro opzionale vtNorm.
|
||||||
@@ -16,6 +16,12 @@
|
|||||||
-- 2022/07/12 A GetFaceHvRefDim aggiunta possibilità di confronto e limitazione dimensioni con grezzo/pezzo (conta solo la sezione).
|
-- 2022/07/12 A GetFaceHvRefDim aggiunta possibilità di confronto e limitazione dimensioni con grezzo/pezzo (conta solo la sezione).
|
||||||
-- 2022/07/26 Aggiunta la funzione FindFaceBestOrientedAsAxis, precedentemente in ProcessLapJoint
|
-- 2022/07/26 Aggiunta la funzione FindFaceBestOrientedAsAxis, precedentemente in ProcessLapJoint
|
||||||
-- 2022/07/26 Alla funzione FindFaceBestOrientedAsAxis aggiunta la possibilità di escludere una faccia dalla ricerca
|
-- 2022/07/26 Alla funzione FindFaceBestOrientedAsAxis aggiunta la possibilità di escludere una faccia dalla ricerca
|
||||||
|
-- 2022/09/01 Aggiunte le funzioni GetTunnelDimension, CalcCollisionSafety, SetOpenSide, precedentemente in ProcessLapJoint.
|
||||||
|
-- 2023/01/10 In GetFaceWithMostAdj aggiunta verifica che la feature abbia almeno una faccia aperta.
|
||||||
|
-- 2023/01/20 Modificata PutStartNearestToEdge per gestire lato preferito come Y+, Y-, z*, Z-. Aggiunta funzione GetDistanceToNextPart.
|
||||||
|
-- 2023/01/31 Aggiunta funzione ConvertToClosedCurve, precedentemente parte di ProcessMortise.Make
|
||||||
|
-- 2023/02/22 Modifiche a SetOpenSide, aggiunte ChangeOrOpenStart e CurveWithOnlyStraightLines.
|
||||||
|
-- 2023/06/12 In ChangeOrOpenStart corretta ricerca segmento più lungo.
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local BeamLib = {}
|
local BeamLib = {}
|
||||||
@@ -193,7 +199,8 @@ function BeamLib.PutStartOnLonger( nCrvId)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
function BeamLib.PutStartNearestToEdge( nCrvId, b3Raw, dMaxDist, bDown)
|
-- nNearSide : 2=Y+, -2=Y-, 3=Z+, -3=Z-
|
||||||
|
function BeamLib.PutStartNearestToEdge( nCrvId, b3Raw, dMaxDist, nNearSide)
|
||||||
-- verifico che la curva sia chiusa
|
-- verifico che la curva sia chiusa
|
||||||
if not EgtCurveIsClosed( nCrvId) then return false end
|
if not EgtCurveIsClosed( nCrvId) then return false end
|
||||||
-- recupero il versore normale al piano di lavoro o estrusione
|
-- recupero il versore normale al piano di lavoro o estrusione
|
||||||
@@ -206,7 +213,7 @@ function BeamLib.PutStartNearestToEdge( nCrvId, b3Raw, dMaxDist, bDown)
|
|||||||
-- cerco l'estremo più vicino al box e lo imposto come inizio (se da sotto escludo Zmax e viceversa)
|
-- cerco l'estremo più vicino al box e lo imposto come inizio (se da sotto escludo Zmax e viceversa)
|
||||||
local dUopt = 0
|
local dUopt = 0
|
||||||
local dDopt = GEO.INFINITO
|
local dDopt = GEO.INFINITO
|
||||||
local dZopt = GEO.INFINITO
|
local dSopt = GEO.INFINITO
|
||||||
local dUi, dUf = EgtCurveDomain( nCrvId)
|
local dUi, dUf = EgtCurveDomain( nCrvId)
|
||||||
for dU = dUi, dUf, 0.5 do
|
for dU = dUi, dUf, 0.5 do
|
||||||
local ptP = EgtUP( nCrvId, dU, GDB_ID.ROOT)
|
local ptP = EgtUP( nCrvId, dU, GDB_ID.ROOT)
|
||||||
@@ -220,11 +227,20 @@ function BeamLib.PutStartNearestToEdge( nCrvId, b3Raw, dMaxDist, bDown)
|
|||||||
dD = min( abs( vtMax:getY()) * dCoeffY, dD)
|
dD = min( abs( vtMax:getY()) * dCoeffY, dD)
|
||||||
dD = min( abs( vtMin:getZ()) * dCoeffZ, dD)
|
dD = min( abs( vtMin:getZ()) * dCoeffZ, dD)
|
||||||
dD = min( abs( vtMax:getZ()) * dCoeffZ, dD)
|
dD = min( abs( vtMax:getZ()) * dCoeffZ, dD)
|
||||||
local dZ = abs( EgtIf( bDown, vtMin:getZ(), vtMax:getZ())) * dCoeffZ
|
local dS
|
||||||
if dD < dMaxDist and dZ < dZopt + GEO.EPS_SMALL then
|
if nNearSide == -2 then
|
||||||
|
dS = abs( vtMin:getY() * dCoeffY)
|
||||||
|
elseif nNearSide == 2 then
|
||||||
|
dS = abs( vtMax:getY() * dCoeffY)
|
||||||
|
elseif nNearSide == -3 then
|
||||||
|
dS = abs( vtMin:getZ() * dCoeffZ)
|
||||||
|
else --nNearSide == 3
|
||||||
|
dS = abs( vtMax:getZ() * dCoeffZ)
|
||||||
|
end
|
||||||
|
if dD < dMaxDist and dS < dSopt + GEO.EPS_SMALL then
|
||||||
dUopt = dU
|
dUopt = dU
|
||||||
dDopt = dD
|
dDopt = dD
|
||||||
dZopt = dZ
|
dSopt = dS
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -307,7 +323,7 @@ function BeamLib.GetNearestOrthoOpposite( vtRef, vtNorm)
|
|||||||
vtMyRef:normalize()
|
vtMyRef:normalize()
|
||||||
end
|
end
|
||||||
-- se prevalente una componente orizzontale (con piccolissimo vantaggio)
|
-- se prevalente una componente orizzontale (con piccolissimo vantaggio)
|
||||||
if abs( vtMyRef:getX()) > 0.95 * abs( vtMyRef:getZ()) or abs( vtMyRef:getY()) > 0.95 * abs( vtMyRef:getZ()) then
|
if abs( vtMyRef:getX()) > 0.91 * abs( vtMyRef:getZ()) or abs( vtMyRef:getY()) > 0.91 * abs( vtMyRef:getZ()) then
|
||||||
-- se prevale la componente destra/sinistra
|
-- se prevale la componente destra/sinistra
|
||||||
if abs( vtMyRef:getX()) > 0.95 * abs( vtMyRef:getY()) then
|
if abs( vtMyRef:getX()) > 0.95 * abs( vtMyRef:getY()) then
|
||||||
if vtMyRef:getX() > -GEO.EPS_SMALL then
|
if vtMyRef:getX() > -GEO.EPS_SMALL then
|
||||||
@@ -494,6 +510,10 @@ end
|
|||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
function BeamLib.GetFaceWithMostAdj( nSurfId, nPartId, bCompare3Fc, dCosSideAng)
|
function BeamLib.GetFaceWithMostAdj( nSurfId, nPartId, bCompare3Fc, dCosSideAng)
|
||||||
|
-- verifica che la superficie non sia chiusa e quindi non lavorabile
|
||||||
|
if EgtSurfIsClosed( nSurfId) then
|
||||||
|
return
|
||||||
|
end
|
||||||
-- recupero il numero di facce
|
-- recupero il numero di facce
|
||||||
local nFacCnt = EgtSurfTmFacetCount( nSurfId)
|
local nFacCnt = EgtSurfTmFacetCount( nSurfId)
|
||||||
if not dCosSideAng then
|
if not dCosSideAng then
|
||||||
@@ -702,8 +722,10 @@ end
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
function BeamLib.GetNzLimDownUp( b3Raw, vtN, vtOrtho)
|
function BeamLib.GetNzLimDownUp( b3Raw, vtN, vtOrtho)
|
||||||
if BD.C_SIMM or BD.TURN then
|
if BD.C_SIMM then
|
||||||
return -0.484
|
return -0.484
|
||||||
|
elseif BD.TURN then
|
||||||
|
return -2
|
||||||
else
|
else
|
||||||
if vtOrtho and vtOrtho:getZ() > 0.35 then
|
if vtOrtho and vtOrtho:getZ() > 0.35 then
|
||||||
-- N_HorAng < 15° or N_HorAng > 55°
|
-- N_HorAng < 15° or N_HorAng > 55°
|
||||||
@@ -734,7 +756,7 @@ function BeamLib.GetNzLimDownUp( b3Raw, vtN, vtOrtho)
|
|||||||
if vtN and ( abs( vtN:getY()) < 0.174) then
|
if vtN and ( abs( vtN:getY()) < 0.174) then
|
||||||
return -0.5
|
return -0.5
|
||||||
else
|
else
|
||||||
return -0.24
|
return -0.259
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- N_HorAng < 10°
|
-- N_HorAng < 10°
|
||||||
@@ -766,6 +788,22 @@ function BeamLib.GetPhaseType( nPhase)
|
|||||||
return ( EgtGetInfo( EgtGetPhaseDisposition( nPhase) or GDB_ID.NULL, 'TYPE') or '')
|
return ( EgtGetInfo( EgtGetPhaseDisposition( nPhase) or GDB_ID.NULL, 'TYPE') or '')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
function BeamLib.GetDistanceToNextPart( nRawId, nPhase)
|
||||||
|
-- Recupero la distanza tra la fine del pezzo e il pezzo successivo
|
||||||
|
local dDistToNextPiece = EgtGetInfo( nRawId, 'BDST', 'd') or BD.OVM_MID
|
||||||
|
-- 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
|
||||||
|
dDistToNextPiece = BD.OVM_MID
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return dDistToNextPiece
|
||||||
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
function BeamLib.GetChainSawBlockedAxis( nInd)
|
function BeamLib.GetChainSawBlockedAxis( nInd)
|
||||||
if BD.GetChainSawBlockedAxis then
|
if BD.GetChainSawBlockedAxis then
|
||||||
@@ -814,5 +852,211 @@ function BeamLib.FindFaceBestOrientedAsAxis( Proc, vtAx, fctExclude)
|
|||||||
return nFaceIndMax, ptC, vtN
|
return nFaceIndMax, ptC, vtN
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
function BeamLib.GetTunnelDimension( Proc, nPartId)
|
||||||
|
-- sono necessarie almeno due facce
|
||||||
|
if Proc.Fct < 2 then return 0, 0, 0 end
|
||||||
|
-- recupero l'ingombro della trave
|
||||||
|
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||||
|
-- recupero centro e normale delle facce
|
||||||
|
local ptC = {}
|
||||||
|
local vtN = {}
|
||||||
|
for i = 1, Proc.Fct do
|
||||||
|
ptC[i], vtN[i] = EgtSurfTmFacetCenter( Proc.Id, i - 1, GDB_ID.ROOT)
|
||||||
|
end
|
||||||
|
-- calcolo l'orientamento del tunnel
|
||||||
|
local vtOrtho
|
||||||
|
local bAdj = EgtSurfTmFacetsContact( Proc.Id, 0, 1)
|
||||||
|
if bAdj then
|
||||||
|
vtOrtho = vtN[1] ^ vtN[2]
|
||||||
|
else
|
||||||
|
if Proc.Fct >= 3 then
|
||||||
|
vtOrtho = vtN[1] ^ vtN[3]
|
||||||
|
else
|
||||||
|
return 0, 0, 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- ottengo il boundingBox e prendo le dimensioni lungo la direzione (Z locale) che rappresenta la profondità della fessura
|
||||||
|
local frFc = Frame3d( ptC[1], vtOrtho) ;
|
||||||
|
local b3BoxLoc = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frFc)
|
||||||
|
local dDepth = b3BoxLoc:getDimZ()
|
||||||
|
-- recupero gruppo per geometria addizionale
|
||||||
|
local nAddGrpId = BeamLib.GetAddGroup( nPartId)
|
||||||
|
if not nAddGrpId then
|
||||||
|
EgtOutLog( 'Error : missing AddGroup')
|
||||||
|
return 0, 0, 0
|
||||||
|
end
|
||||||
|
-- centro del bounding box locale
|
||||||
|
local ptCen = b3BoxLoc:getCenter()
|
||||||
|
ptCen:toGlob( frFc)
|
||||||
|
-- creo superficie intermedia
|
||||||
|
local nSurfInt = EgtSurfTmPlaneInBBox( nAddGrpId, ptCen, vtOrtho, b3Solid, GDB_ID.ROOT)
|
||||||
|
if not nSurfInt then return 0, 0, 0 end
|
||||||
|
-- ritaglio la superficie con le facce della fessura
|
||||||
|
for i = 1, Proc.Fct do
|
||||||
|
EgtCutSurfTmPlane( nSurfInt, ptC[i], -vtN[i], false, GDB_ID.ROOT)
|
||||||
|
end
|
||||||
|
local frSurfInt, dDimMax, dDimMin = EgtSurfTmFacetMinAreaRectangle( nSurfInt, 0, GDB_ID.ROOT)
|
||||||
|
-- cerco la faccia con larghezza pari a dimensione massima della fessura
|
||||||
|
local nLongIdFace = 0
|
||||||
|
for i = 1, Proc.Fct do
|
||||||
|
if abs( vtN[i] * frSurfInt:getVersX()) < 0.5 then
|
||||||
|
nLongIdFace = i - 1
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return dDimMin, dDimMax, dDepth, vtOrtho, nLongIdFace, nSurfInt
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
function BeamLib.CalcCollisionSafety( vtDir)
|
||||||
|
local dCollSic = 10 * BD.COLL_SIC
|
||||||
|
if abs( vtDir:getX()) > 0.999 or abs( vtDir:getY()) > 0.999 or abs( vtDir:getZ()) > 0.999 then
|
||||||
|
dCollSic = 0
|
||||||
|
elseif abs( vtDir:getX()) > 0.996 or abs( vtDir:getY()) > 0.996 or abs( vtDir:getZ()) > 0.996 then
|
||||||
|
dCollSic = 1 * BD.COLL_SIC
|
||||||
|
elseif abs( vtDir:getX()) > 0.89 or abs( vtDir:getY()) > 0.89 or abs( vtDir:getZ()) > 0.89 then
|
||||||
|
dCollSic = 2.5 * BD.COLL_SIC
|
||||||
|
elseif abs( vtDir:getX()) > 0.86 or abs( vtDir:getY()) > 0.86 or abs( vtDir:getZ()) > 0.86 then
|
||||||
|
dCollSic = 4 * BD.COLL_SIC
|
||||||
|
elseif abs( vtDir:getX()) > 0.707 or abs( vtDir:getY()) > 0.707 or abs( vtDir:getZ()) > 0.707 then
|
||||||
|
dCollSic = 5.5 * BD.COLL_SIC
|
||||||
|
end
|
||||||
|
return dCollSic
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
function BeamLib.SetOpenSide( nPathInt, b3Solid)
|
||||||
|
-- fondo tra loro le curve compatibili
|
||||||
|
EgtMergeCurvesInCurveCompo( nPathInt)
|
||||||
|
-- vettore indici lati aperti
|
||||||
|
local vOpen = {}
|
||||||
|
-- ciclo sulle curve elementari della composita
|
||||||
|
local _, nNumEnt = EgtCurveDomain( nPathInt)
|
||||||
|
for i = 0, nNumEnt - 1 do
|
||||||
|
-- se segmento di retta
|
||||||
|
if EgtCurveCompoRadius( nPathInt, i) == -1 then
|
||||||
|
-- verifico se giace in uno dei piani limite del pezzo quindi se è un lato aperto
|
||||||
|
local ptIni = EgtUP( nPathInt, i, GDB_RT.GLOB)
|
||||||
|
local ptFin = EgtUP( nPathInt, i + 1, GDB_RT.GLOB)
|
||||||
|
if ( abs( ptIni:getX() - b3Solid:getMax():getX()) < 100 * GEO.EPS_SMALL and abs( ptFin:getX() - b3Solid:getMax():getX()) < 100 * GEO.EPS_SMALL) or
|
||||||
|
( abs( ptIni:getX() - b3Solid:getMin():getX()) < 100 * GEO.EPS_SMALL and abs( ptFin:getX() - b3Solid:getMin():getX()) < 100 * GEO.EPS_SMALL) or
|
||||||
|
( abs( ptIni:getY() - b3Solid:getMax():getY()) < 100 * GEO.EPS_SMALL and abs( ptFin:getY() - b3Solid:getMax():getY()) < 100 * GEO.EPS_SMALL) or
|
||||||
|
( abs( ptIni:getY() - b3Solid:getMin():getY()) < 100 * GEO.EPS_SMALL and abs( ptFin:getY() - b3Solid:getMin():getY()) < 100 * GEO.EPS_SMALL) or
|
||||||
|
( abs( ptIni:getZ() - b3Solid:getMax():getZ()) < 100 * GEO.EPS_SMALL and abs( ptFin:getZ() - b3Solid:getMax():getZ()) < 100 * GEO.EPS_SMALL) or
|
||||||
|
( abs( ptIni:getZ() - b3Solid:getMin():getZ()) < 100 * GEO.EPS_SMALL and abs( ptFin:getZ() - b3Solid:getMin():getZ()) < 100 * GEO.EPS_SMALL) then
|
||||||
|
-- aggiorno il vettore dei lati aperti
|
||||||
|
table.insert( vOpen, i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- assegno gli indici dei lati aperti
|
||||||
|
EgtSetInfo( nPathInt, 'OPEN', vOpen)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
function BeamLib.ChangeOrOpenStart( nPathInt, nStartPoint)
|
||||||
|
-- verifico richiesta
|
||||||
|
if nStartPoint ~= 1 and nStartPoint ~= 2 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
-- verifico che la curva sia chiusa
|
||||||
|
if not EgtCurveIsClosed( nPathInt) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
-- recupero l'indice del segmento aperto più lungo
|
||||||
|
local nMaxOpen, dMaxLen
|
||||||
|
local vOpen = EgtGetInfo( nPathInt or GDB_ID.NULL, 'OPEN', 'vi')
|
||||||
|
for i = 1, #( vOpen or {}) do
|
||||||
|
-- se primo o più lungo, lo salvo
|
||||||
|
local dLen = EgtCurveCompoLength( nPathInt, vOpen[i])
|
||||||
|
if not dMaxLen or dLen > dMaxLen then
|
||||||
|
dMaxLen = dLen
|
||||||
|
nMaxOpen = vOpen[i]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- se esiste tratto aperto
|
||||||
|
if nMaxOpen then
|
||||||
|
-- sposto il punto di inizio a metà del tratto aperto più lungo (la curva deve essere chiusa)
|
||||||
|
EgtChangeClosedCurveStart( nPathInt, nMaxOpen + 0.5)
|
||||||
|
-- aggiorno il vettore dei lati aperti
|
||||||
|
for i = 1, #vOpen do
|
||||||
|
vOpen[i] = vOpen[i] - nMaxOpen
|
||||||
|
end
|
||||||
|
table.insert( vOpen, #vOpen)
|
||||||
|
-- se devo eliminare gli estremi aperti
|
||||||
|
if nStartPoint == 2 then
|
||||||
|
-- elimino gli estremi
|
||||||
|
EgtRemoveCurveCompoCurve( nPathInt, true)
|
||||||
|
EgtRemoveCurveCompoCurve( nPathInt, false)
|
||||||
|
-- aggiorno il vettore dei lati aperti
|
||||||
|
table.remove( vOpen, 1)
|
||||||
|
table.remove( vOpen)
|
||||||
|
for i = 1, #vOpen do
|
||||||
|
vOpen[i] = vOpen[i] - 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- assegno gli indici modificati dei lati aperti
|
||||||
|
EgtSetInfo( nPathInt, 'OPEN', vOpen)
|
||||||
|
-- restituisco flag percorso aperto
|
||||||
|
return ( not EgtCurveIsClosed( nPathInt))
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
function BeamLib.ConvertToClosedCurve( Proc, AuxId)
|
||||||
|
local bCurveModified = false
|
||||||
|
if not EgtCurveIsClosed( AuxId) then
|
||||||
|
local NewId, nCount = EgtExtractSurfTmFacetLoops( Proc.Id, 0, EgtGetParent( Proc.Id))
|
||||||
|
if NewId then
|
||||||
|
-- elimino eventuali loop interni (non dovrebbero comunque esserci)
|
||||||
|
for i = 1, nCount - 1 do
|
||||||
|
EgtErase( NewId + i)
|
||||||
|
end
|
||||||
|
local vtExtr = EgtCurveExtrusion( AuxId, GDB_ID.ROOT)
|
||||||
|
-- sostituisco il loop esterno alla curva originale
|
||||||
|
EgtModifyCurveExtrusion( NewId, vtExtr, GDB_ID.ROOT)
|
||||||
|
EgtRelocate( NewId, AuxId, GDB_IN.AFTER)
|
||||||
|
EgtErase( AuxId)
|
||||||
|
EgtChangeId( NewId, AuxId)
|
||||||
|
bCurveModified = true
|
||||||
|
-- sistemo i lati aperti
|
||||||
|
local vFacAdj = EgtSurfTmFacetAdjacencies( Proc.Id, 0)[1]
|
||||||
|
if vFacAdj then
|
||||||
|
local vOpen = {}
|
||||||
|
for i = 1, #vFacAdj do
|
||||||
|
if vFacAdj[i] < 0 then
|
||||||
|
table.insert( vOpen, i - 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
EgtSetInfo( AuxId, 'OPEN', vOpen)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return true, bCurveModified
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
function BeamLib.CurveWithOnlyStraightLines( nPathInt)
|
||||||
|
-- verifico sia una retta oppure una curva composita
|
||||||
|
local nType = EgtGetType( nPathInt)
|
||||||
|
if nType == GDB_TY.CRV_LINE then
|
||||||
|
return true
|
||||||
|
elseif nType~= GDB_TY.CRV_COMPO then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
-- ciclo sulle curve elementari della composita
|
||||||
|
local _, nNumEnt = EgtCurveDomain( nPathInt)
|
||||||
|
for i = 0, nNumEnt - 1 do
|
||||||
|
-- se segmento di retta
|
||||||
|
if EgtCurveCompoRadius( nPathInt, i) ~= -1 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
return BeamLib
|
return BeamLib
|
||||||
|
|||||||
+17
-12
@@ -1,4 +1,4 @@
|
|||||||
-- DiceCut.lua by Egaltech s.r.l. 2022/02/18
|
-- DiceCut.lua by Egaltech s.r.l. 2023/06/29
|
||||||
-- Gestione dei piano paralleli nei tagli lunghi: equidistanziamento dei piani paralleli
|
-- Gestione dei piano paralleli nei tagli lunghi: equidistanziamento dei piani paralleli
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
@@ -144,8 +144,8 @@ local function GetOrtoCutCenter( FacetId, ptC, vtN, vtO, dOffsetEff, dNzLimDwnUp
|
|||||||
EgtErase( IdAuxLocal)
|
EgtErase( IdAuxLocal)
|
||||||
EgtSetGridFrame(Frame3d())
|
EgtSetGridFrame(Frame3d())
|
||||||
-- riferimento intrinseco
|
-- riferimento intrinseco
|
||||||
local asseX = vtO
|
local asseX = Vector3d( vtO)
|
||||||
local asseY = asseX ^ vtN
|
local asseY = vtN ^ asseX
|
||||||
local Frame = Frame3d( ptC, ptC + asseX, ptC + asseY)
|
local Frame = Frame3d( ptC, ptC + asseX, ptC + asseY)
|
||||||
-- ingombro della faccia secondo questo riferimento
|
-- ingombro della faccia secondo questo riferimento
|
||||||
local Box = EgtGetBBoxRef( FacetId, GDB_BB.STANDARD, Frame)
|
local Box = EgtGetBBoxRef( FacetId, GDB_BB.STANDARD, Frame)
|
||||||
@@ -160,12 +160,11 @@ local function GetOrtoCutCenter( FacetId, ptC, vtN, vtO, dOffsetEff, dNzLimDwnUp
|
|||||||
end
|
end
|
||||||
|
|
||||||
local N = ceil( dLen / dOffsetEff)
|
local N = ceil( dLen / dOffsetEff)
|
||||||
local dOffsetRel = dLen / N
|
local dOffsetRel = ( dLen / N) + 10 * GEO.EPS_SMALL
|
||||||
local dCopyPlane
|
local dCopyPlane
|
||||||
local dCenOffs = ( Box:getMax():getX() + Box:getMin():getX()) / 2
|
local dCenOffs = ( Box:getMax():getX() + Box:getMin():getX()) / 2
|
||||||
|
|
||||||
if dLen <= dOffsetRel then
|
if dLen <= dOffsetRel then
|
||||||
--dOffsetRel = 0
|
|
||||||
dCopyPlane = 1
|
dCopyPlane = 1
|
||||||
elseif dLen <= 2 * dOffsetRel then
|
elseif dLen <= 2 * dOffsetRel then
|
||||||
dOffsetRel = dOffsetEff
|
dOffsetRel = dOffsetEff
|
||||||
@@ -177,8 +176,7 @@ local function GetOrtoCutCenter( FacetId, ptC, vtN, vtO, dOffsetEff, dNzLimDwnUp
|
|||||||
dCopyPlane = 0.5
|
dCopyPlane = 0.5
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
return dOffsetRel, dCopyPlane, dCenOffs, ptS
|
return dOffsetRel, dCopyPlane, dCenOffs, ptS
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -377,12 +375,13 @@ end
|
|||||||
-- ptCBond*: il punto centrale della superfice limitante (se non esistono altre superfici può essere omesso)
|
-- ptCBond*: il punto centrale della superfice limitante (se non esistono altre superfici può essere omesso)
|
||||||
-- vtNBond*: il versore normale della superfice limitante (se non esistono altre superfici può essere omesso)
|
-- vtNBond*: il versore normale della superfice limitante (se non esistono altre superfici può essere omesso)
|
||||||
-- dOrthoMaxDim : massima profondità taglio se faccia singola perpendicolare facce laterali trave
|
-- dOrthoMaxDim : massima profondità taglio se faccia singola perpendicolare facce laterali trave
|
||||||
-- dCustMaxDimDice: dimensione massima customizzata, sostituisce il parametro BD.MAX_DIM_DICE
|
-- dCustMaxDimDice: dimensione massima customizzata, sostituisce il parametro BD.MAX_DIM_DICE (se negativa qualunque, se positiva deve stare nel MAX)
|
||||||
-- bDownHead : taglio con testa da sotto
|
-- bDownHead : taglio con testa da sotto
|
||||||
----------------------------------------------------------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPlanes, ptCBond, vtNBond, dOrthoMaxDim, dCustMaxDimDice, bDownHead)
|
function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPlanes, ptCBond, vtNBond, dOrthoMaxDim, dCustMaxDimDice, bDownHead)
|
||||||
|
|
||||||
local dMaxDimDice = EgtIf( dCustMaxDimDice and dCustMaxDimDice < BD.MAX_DIM_DICE, dCustMaxDimDice, BD.MAX_DIM_DICE)
|
local dMaxDimDice = BD.MAX_DIM_DICE
|
||||||
|
if dCustMaxDimDice and dCustMaxDimDice < BD.MAX_DIM_DICE then dMaxDimDice = abs( dCustMaxDimDice) end
|
||||||
local dTolerance = 0 -- distanza di sicurezza per i tagli ortogonali
|
local dTolerance = 0 -- distanza di sicurezza per i tagli ortogonali
|
||||||
local OffsetP = dMaxDimDice -- distanza tra i piani paralleli
|
local OffsetP = dMaxDimDice -- distanza tra i piani paralleli
|
||||||
local StepP = 100 -- numero massimo di piani paralleli da generare
|
local StepP = 100 -- numero massimo di piani paralleli da generare
|
||||||
@@ -474,7 +473,7 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl
|
|||||||
if vtNInner:getZ() > -0.0175 or vtNInner:getZ() < dNzLimDwnUp or abs( vtNInner:getY()) > 0.8 then
|
if vtNInner:getZ() > -0.0175 or vtNInner:getZ() < dNzLimDwnUp or abs( vtNInner:getY()) > 0.8 then
|
||||||
vtO:rotate( vtNInner, 90)
|
vtO:rotate( vtNInner, 90)
|
||||||
-- se diretto troppo ortogonalmente all'asse trave e taglio non da sotto, lo ruoto ulteriormente
|
-- se diretto troppo ortogonalmente all'asse trave e taglio non da sotto, lo ruoto ulteriormente
|
||||||
if ( abs( vtO:getY()) > 3 * abs( vtO:getX()) or BBoxRawPart:getDimZ() > 620) and vtNInner:getZ() > dNzLimDwnUp then
|
if ( abs( vtO:getY()) > 4 * abs( vtO:getX()) or BBoxRawPart:getDimZ() > 620) and vtNInner:getZ() > dNzLimDwnUp then
|
||||||
vtO:rotate( vtNInner, 90)
|
vtO:rotate( vtNInner, 90)
|
||||||
-- se faccia principale verso il basso (almeno -3deg), lo inverto per iniziare da sopra
|
-- se faccia principale verso il basso (almeno -3deg), lo inverto per iniziare da sopra
|
||||||
if vtNInner:getZ() < -0.05 then
|
if vtNInner:getZ() < -0.05 then
|
||||||
@@ -482,9 +481,9 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
if vtNInner:getX() > -0.017 then
|
if vtNInner:getX() > -0.017 then
|
||||||
if vtO:getX() < 0 then vtO = - vtO end
|
if vtO:getX() < -0.001 then vtO = -vtO end
|
||||||
else
|
else
|
||||||
if vtO:getX() > 0 then vtO = - vtO end
|
if vtO:getX() > 0.001 then vtO = -vtO end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -496,6 +495,12 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl
|
|||||||
if bDownHead and vtO:getZ() > 0.05 then
|
if bDownHead and vtO:getZ() > 0.05 then
|
||||||
vtO = -vtO
|
vtO = -vtO
|
||||||
end
|
end
|
||||||
|
-- per macchina TURN
|
||||||
|
if BD.TURN then
|
||||||
|
if vtO:getY() > 0.707 then
|
||||||
|
vtO = -vtO
|
||||||
|
end
|
||||||
|
end
|
||||||
-- calcolo le dimensioni dell'offset e dove posizionare la prima faccia:
|
-- calcolo le dimensioni dell'offset e dove posizionare la prima faccia:
|
||||||
-- CopyPlane: 0 => crea la prima faccia direttamente sul punto passato
|
-- CopyPlane: 0 => crea la prima faccia direttamente sul punto passato
|
||||||
-- CopyPlane: 1 => crea la prima faccia e tutte le altre con l'offset passato
|
-- CopyPlane: 1 => crea la prima faccia e tutte le altre con l'offset passato
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
-- FaceByPocket.lua by Egaltech s.r.l. 2022/05/82
|
-- FaceByPocket.lua by Egaltech s.r.l. 2023/04/04
|
||||||
-- Gestione svuotatura di feature con una faccia
|
-- Gestione svuotatura di feature con una faccia
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
@@ -15,7 +15,7 @@ local BD = require( 'BeamData')
|
|||||||
local ML = require( 'MachiningLib')
|
local ML = require( 'MachiningLib')
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
local function ApplyPocket( Proc, nSurfId, nFacet, sPocketing, nInd, dMaxElev, vtN)
|
local function ApplyPocket( Proc, nSurfId, nFacet, sPocketing, nInd, dMaxElev, vtN, dOpenMinSafe)
|
||||||
|
|
||||||
-- inserisco la lavorazione di svuotatura
|
-- inserisco la lavorazione di svuotatura
|
||||||
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. nInd
|
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. nInd
|
||||||
@@ -28,11 +28,17 @@ local function ApplyPocket( Proc, nSurfId, nFacet, sPocketing, nInd, dMaxElev, v
|
|||||||
EgtSetMachiningGeometry( {{ nSurfId, nFacet}})
|
EgtSetMachiningGeometry( {{ nSurfId, nFacet}})
|
||||||
-- imposto uso faccia
|
-- imposto uso faccia
|
||||||
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT)
|
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT)
|
||||||
|
-- imposto note utente
|
||||||
|
local sNotes = ''
|
||||||
|
-- eventuale massima elevazione
|
||||||
if dMaxElev > 0.1 then
|
if dMaxElev > 0.1 then
|
||||||
-- imposto elevazione
|
sNotes = EgtSetValInNotes( sNotes, 'MaxElev', EgtNumToString( dMaxElev, 2))
|
||||||
local sNotes = 'MaxElev=' .. EgtNumToString( dMaxElev, 2) .. ';'
|
|
||||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
|
|
||||||
end
|
end
|
||||||
|
-- eventuale minima distanza di sicurezza di attacco su lati aperti
|
||||||
|
if dOpenMinSafe then
|
||||||
|
sNotes = EgtSetValInNotes( sNotes, 'OpenMinSafe', dOpenMinSafe)
|
||||||
|
end
|
||||||
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
|
||||||
-- imposto posizione braccio porta testa
|
-- imposto posizione braccio porta testa
|
||||||
local nSCC = MCH_SCC.NONE
|
local nSCC = MCH_SCC.NONE
|
||||||
if not BD.C_SIMM and not BD.TURN then
|
if not BD.C_SIMM and not BD.TURN then
|
||||||
@@ -50,7 +56,7 @@ local function ApplyPocket( Proc, nSurfId, nFacet, sPocketing, nInd, dMaxElev, v
|
|||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
function FaceByPocket.Make( Proc, nSurfId, nFacet, sPocketing, nPartId, b3Solid)
|
function FaceByPocket.Make( Proc, nSurfId, nFacet, sPocketing, nPartId, b3Solid, dOpenMinSafe)
|
||||||
local bOk = true
|
local bOk = true
|
||||||
local sErr
|
local sErr
|
||||||
-- recupero gruppo per geometria addizionale
|
-- recupero gruppo per geometria addizionale
|
||||||
@@ -84,14 +90,14 @@ function FaceByPocket.Make( Proc, nSurfId, nFacet, sPocketing, nPartId, b3Solid)
|
|||||||
EgtSetName( nAddIdTmp, 'AddCut_' .. tostring( Proc.Id))
|
EgtSetName( nAddIdTmp, 'AddCut_' .. tostring( Proc.Id))
|
||||||
EgtSetInfo( nAddIdTmp, 'TASKID', Proc.TaskId)
|
EgtSetInfo( nAddIdTmp, 'TASKID', Proc.TaskId)
|
||||||
-- aggiungo lavorazione
|
-- aggiungo lavorazione
|
||||||
bOk, sErr = ApplyPocket( Proc, nAddIdTmp, 0, sPocketing, i, dSurfStep, vtN)
|
bOk, sErr = ApplyPocket( Proc, nAddIdTmp, 0, sPocketing, i, dSurfStep, vtN, dOpenMinSafe)
|
||||||
if not bOk then
|
if not bOk then
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- faccio ultima superfice
|
-- faccio ultima superfice
|
||||||
bOk, sErr = ApplyPocket( Proc, nSurfId, nFacet, sPocketing, 1, EgtIf( nSurfStep > 1, dSurfStep, 0), vtN)
|
bOk, sErr = ApplyPocket( Proc, nSurfId, nFacet, sPocketing, 1, EgtIf( nSurfStep > 1, dSurfStep, 0), vtN, dOpenMinSafe)
|
||||||
if not bOk then
|
if not bOk then
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
|
|||||||
+213
-64
@@ -1,4 +1,4 @@
|
|||||||
-- FacesBySaw.lua by Egaltech s.r.l. 2022/06/29
|
-- FacesBySaw.lua by Egaltech s.r.l. 2023/06/14
|
||||||
-- Gestione taglio con lama di feature con una o due facce
|
-- Gestione taglio con lama di feature con una o due facce
|
||||||
-- 2021/01/06 Cambiato limite per attacco Tg con lama e CalcLeadInOutGeom rinominata in CalcLeadInOutPerpGeom.
|
-- 2021/01/06 Cambiato limite per attacco Tg con lama e CalcLeadInOutGeom rinominata in CalcLeadInOutPerpGeom.
|
||||||
-- 2021/02/03 In taglio lama si accettano anche due lati con deviazione minore di 20deg.
|
-- 2021/02/03 In taglio lama si accettano anche due lati con deviazione minore di 20deg.
|
||||||
@@ -12,6 +12,11 @@
|
|||||||
-- 2021/11/26 DS Spostate qui MakeOneFaceBySaw (ora MakeOne), CalcLeadInOutPerpGeom e CalcLeadInOutTangGeom.
|
-- 2021/11/26 DS Spostate qui MakeOneFaceBySaw (ora MakeOne), CalcLeadInOutPerpGeom e CalcLeadInOutTangGeom.
|
||||||
-- 2022/04/12 DS Aggiunta gestione speciale cubetti con fresa da sotto.
|
-- 2022/04/12 DS Aggiunta gestione speciale cubetti con fresa da sotto.
|
||||||
-- 2022/06/29 DS In MakeTwo modificato controllo facce dirette verso il basso.
|
-- 2022/06/29 DS In MakeTwo modificato controllo facce dirette verso il basso.
|
||||||
|
-- 2022/09/08 In MakeOne aggiunto argomento bForceInvert per poter forzare l'inversione del percorso.
|
||||||
|
-- 2023/02/13 Migliorata la direzione di lavoro della lama in modo da essere tendenzialmente opposta all'avanzamento.
|
||||||
|
-- 2023/04/20 Alcune modifiche per gestire tagli con faceuse parallelo.
|
||||||
|
-- 2023/05/18 Imposto in ogni caso dVzLimDwnUp prima anche di bDownHead.
|
||||||
|
-- 2023/06/14 Aggiunta MakeParallelOne e tolti parametri nForceWorkSide, nForceSCC da MakeOne.
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local FacesBySaw = {}
|
local FacesBySaw = {}
|
||||||
@@ -28,7 +33,124 @@ local BD = require( 'BeamData')
|
|||||||
local ML = require( 'MachiningLib')
|
local ML = require( 'MachiningLib')
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw)
|
function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert)
|
||||||
|
-- dati della faccia
|
||||||
|
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT)
|
||||||
|
-- accetto solo facce perpendicolari all'asse X della trave
|
||||||
|
if not AreSameOrOppositeVectorApprox( vtN, X_AX()) then
|
||||||
|
EgtOutLog( 'Error : MakeParallelOne only for faces perpendicular to XAxis')
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
-- l'uso della faccia deve consentire una scelta robusta del percorso
|
||||||
|
if nFaceUse == MCH_MILL_FU.PARAL_LEFT or
|
||||||
|
nFaceUse == MCH_MILL_FU.PARAL_RIGHT then
|
||||||
|
EgtOutLog( 'Error : MakeParallelOne impossible with PARAL_LEFT or PARAL_RIGHT FaceUse')
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
-- distanza della faccia dall'estremo trave verso cui è rivolta
|
||||||
|
local dDistX = EgtIf( vtN:getX() > 0, b3Raw:getMax():getX() - ptC:getX(), ptC:getX() - b3Raw:getMin():getX())
|
||||||
|
-- lunghezza attacco/uscita perpendicolari
|
||||||
|
local dLiTang = 0
|
||||||
|
local dLiPerp = dDistX + dCutExtra + dCutSic
|
||||||
|
local dLoTang = dLiTang
|
||||||
|
local dLoPerp = dLiPerp
|
||||||
|
-- lunghezza attacco/uscita tangenti
|
||||||
|
local dLi2Tang = dSawDiam / 2 + dCutSic
|
||||||
|
local dLi2Perp = 0
|
||||||
|
local dLo2Tang = dLi2Tang
|
||||||
|
local dLo2Perp = dLi2Perp
|
||||||
|
-- scelgo l'attacco più conveniente
|
||||||
|
local bLioTang
|
||||||
|
local Ktp = 1.1
|
||||||
|
if BD.KIOTP then Ktp = BD.KIOTP end
|
||||||
|
if Ktp * dLi2Tang < dLiPerp then
|
||||||
|
bLioTang = true
|
||||||
|
dLiTang, dLiPerp, dLoTang, dLoPerp = dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp
|
||||||
|
if BD.TURN then
|
||||||
|
local dMove = EgtIf( nFaceUse == MCH_MILL_FU.PARAL_DOWN or nFaceUse == MCH_MILL_FU.PARAL_TOP, b3Raw:getDimY(), b3Raw:getDimZ())
|
||||||
|
dLoTang = -( dLiTang - dAccStart - dAccEnd + dMove)
|
||||||
|
dLoPerp = BD.COLL_SIC
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- verifico se la lama ruota in senso antiorario
|
||||||
|
if not EgtMdbSetCurrMachining( sCutting) then
|
||||||
|
return false
|
||||||
|
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
|
||||||
|
if bInvert == nil then
|
||||||
|
bInvert = ( not bIsSawCCW)
|
||||||
|
if not BD.TURN then
|
||||||
|
if bIsSawCCW then
|
||||||
|
bInvert = (( nFaceUse == MCH_MILL_FU.PARAL_FRONT and vtN:getX() > 0) or ( nFaceUse == MCH_MILL_FU.PARAL_BACK and vtN:getX() < 0))
|
||||||
|
else
|
||||||
|
bInvert = (( nFaceUse == MCH_MILL_FU.PARAL_FRONT and vtN:getX() < 0) or ( nFaceUse == MCH_MILL_FU.PARAL_BACK and vtN:getX() > 0))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local nWorkSide = EgtIf( bInvert, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT)
|
||||||
|
-- posizione braccio
|
||||||
|
local nSCC = MCH_SCC.NONE
|
||||||
|
if BD.TURN then
|
||||||
|
nSCC = EgtIf( nFaceUse == MCH_MILL_FU.PARAL_DOWN or nFaceUse == MCH_MILL_FU.PARAL_TOP, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_ZP)
|
||||||
|
else
|
||||||
|
nSCC = EgtIf( vtN:getX() > 0, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
||||||
|
end
|
||||||
|
-- inserisco la lavorazione di taglio
|
||||||
|
local sName = 'Cut_' .. ( EgtGetName( nSurfId) or tostring( nSurfId)) .. '_' .. tostring( nFacet + 1)
|
||||||
|
local nMchFId = EgtAddMachining( sName, sCutting)
|
||||||
|
if not nMchFId then
|
||||||
|
local sErr = 'Error adding machining ' .. sName .. '-' .. sCutting
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
sName = EgtGetOperationName( nMchFId)
|
||||||
|
-- aggiungo geometria
|
||||||
|
EgtSetMachiningGeometry( {{ nSurfId, nFacet}})
|
||||||
|
-- imposto uso faccia
|
||||||
|
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
||||||
|
-- imposto posizione braccio porta testa
|
||||||
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||||
|
-- imposto inversione e lato correzione
|
||||||
|
EgtSetMachiningParam( MCH_MP.INVERT, bInvert)
|
||||||
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, nWorkSide)
|
||||||
|
-- affondamento aggiuntivo
|
||||||
|
EgtSetMachiningParam( MCH_MP.OFFSR, -dCutExtra)
|
||||||
|
-- offset longitudinale
|
||||||
|
EgtSetMachiningParam( MCH_MP.OFFSL, EgtIf( bDownUp, -dCutOffset, dCutOffset))
|
||||||
|
-- imposto attacco/uscita
|
||||||
|
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.LOTANG, dLoTang)
|
||||||
|
EgtSetMachiningParam( MCH_MP.LOPERP, dLoPerp)
|
||||||
|
-- imposto allungamenti iniziale e finale
|
||||||
|
EgtSetMachiningParam( MCH_MP.STARTADDLEN, -dAccStart)
|
||||||
|
EgtSetMachiningParam( MCH_MP.ENDADDLEN, -dAccEnd)
|
||||||
|
-- eventuali note
|
||||||
|
if sNotes and #sNotes > 0 then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end
|
||||||
|
-- eseguo
|
||||||
|
if not ML.ApplyMachining( true, false) then
|
||||||
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
|
EgtSetOperationMode( nMchFId, false)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
return true, sName, nMchFId
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert)
|
||||||
|
-- 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
|
||||||
|
Par5 == MCH_MILL_FU.PARAL_FRONT or
|
||||||
|
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)
|
||||||
|
end
|
||||||
|
-- la lama ha asse perpendicolare alla faccia
|
||||||
-- dati della faccia
|
-- dati della faccia
|
||||||
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT)
|
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT)
|
||||||
-- risolvo parametro ambiguo
|
-- risolvo parametro ambiguo
|
||||||
@@ -41,8 +163,10 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
|||||||
nOrthoOpposite = Par5
|
nOrthoOpposite = Par5
|
||||||
vtOrthO = BL.GetVersRef( Par5)
|
vtOrthO = BL.GetVersRef( Par5)
|
||||||
end
|
end
|
||||||
-- verifico se testa da sotto
|
-- 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)
|
local bDownHead = ( dVzLimDwnUp and dVzLimDwnUp < - 1.5)
|
||||||
|
local bDownUp = ( vtN:getZ() < dVzLimDwnUp)
|
||||||
-- linea o bilinea di lavorazione (qui uso nOrthoOpposite per ripetere esattamente il calcolo del Mach)
|
-- linea o bilinea di lavorazione (qui uso nOrthoOpposite per ripetere esattamente il calcolo del Mach)
|
||||||
local ptP1, ptPm, ptP2, vtV1, vtV2, dLen, dWidth = EgtSurfTmFacetOppositeSide( nSurfId, nFacet, BL.GetVersRef( nOrthoOpposite), GDB_ID.ROOT)
|
local ptP1, ptPm, ptP2, vtV1, vtV2, dLen, dWidth = EgtSurfTmFacetOppositeSide( nSurfId, nFacet, BL.GetVersRef( nOrthoOpposite), GDB_ID.ROOT)
|
||||||
if not dLen or dLen < 1.1 or not dWidth or dWidth < 1.1 then
|
if not dLen or dLen < 1.1 or not dWidth or dWidth < 1.1 then
|
||||||
@@ -51,7 +175,25 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
|||||||
return true, ''
|
return true, ''
|
||||||
end
|
end
|
||||||
vtV1 = - vtV1
|
vtV1 = - vtV1
|
||||||
local bInvert = ( ptP2:getZ() < ptP1:getZ() - 100 * GEO.EPS_SMALL)
|
-- verifico se la lama ruota in senso antiorario
|
||||||
|
if not EgtMdbSetCurrMachining( sCutting) then
|
||||||
|
return false
|
||||||
|
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
|
||||||
|
if bInvert == nil then
|
||||||
|
if not BD.TURN then
|
||||||
|
if bIsSawCCW ~= bDownUp then
|
||||||
|
bInvert = ( ptP2:getZ() < ptP1:getZ() + 100 * GEO.EPS_SMALL)
|
||||||
|
else
|
||||||
|
bInvert = ( ptP2:getZ() < ptP1:getZ() - 100 * GEO.EPS_SMALL)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
local vtTmp = ptP2 - ptP1 ; vtTmp:normalize()
|
||||||
|
bInvert = ( ( vtOrthO:getX() > 0.1 and vtTmp:getX() < -0.1) or ( vtOrthO:getX() < -0.1 and vtTmp:getX() > 0.1))
|
||||||
|
end
|
||||||
|
end
|
||||||
if bInvert then
|
if bInvert then
|
||||||
ptP1, ptP2 = ptP2, ptP1
|
ptP1, ptP2 = ptP2, ptP1
|
||||||
vtV1, vtV2 = vtV2, vtV1
|
vtV1, vtV2 = vtV2, vtV1
|
||||||
@@ -86,9 +228,6 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
|||||||
vtTg = ptP2 - ptP1 ; vtTg:normalize()
|
vtTg = ptP2 - ptP1 ; vtTg:normalize()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- verifico se lavorazione con lama sotto e testa sopra
|
|
||||||
if not dVzLimDwnUp then dVzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN, vtOrthO) end
|
|
||||||
local bDownUp = ( vtN:getZ() < dVzLimDwnUp)
|
|
||||||
local nFaceUse = nOrthoOpposite
|
local nFaceUse = nOrthoOpposite
|
||||||
if bDownUp then nFaceUse = BL.GetOrtupOpposite( nOrthoOpposite) end
|
if bDownUp then nFaceUse = BL.GetOrtupOpposite( nOrthoOpposite) end
|
||||||
local bWsRight = ( bInvert ~= bDownUp)
|
local bWsRight = ( bInvert ~= bDownUp)
|
||||||
@@ -119,30 +258,29 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
|||||||
-- parametri di attacco/uscita
|
-- parametri di attacco/uscita
|
||||||
local b3Box = BBox3d( b3Raw)
|
local b3Box = BBox3d( b3Raw)
|
||||||
b3Box:expand( dCutSic)
|
b3Box:expand( dCutSic)
|
||||||
local ptP1act = ptP1 + vtN * dCutOffset
|
|
||||||
local ptP2act = ptP2 + vtN * dCutOffset
|
|
||||||
-- attacco perpendicolare
|
-- attacco perpendicolare
|
||||||
local dLiTang, dLiPerp, dLoTang, dLoPerp = FacesBySaw.CalcLeadInOutPerpGeom( ptP1act, ptP2act, vtV1, vtV2, vtN, dSawDiam/2, vtRef, dCutExtra, b3Box)
|
local dLiTang, dLiPerp, dLoTang, dLoPerp, vtLio = FacesBySaw.CalcLeadInOutPerpGeom( ptP1, ptP2, vtV1, vtV2, vtN, dSawDiam/2, vtRef, dCutExtra, b3Box)
|
||||||
local dLenLi = sqrt( dLiTang * dLiTang + dLiPerp * dLiPerp)
|
local dLenLi = sqrt( dLiTang * dLiTang + dLiPerp * dLiPerp)
|
||||||
local dLenLo = sqrt( dLoTang * dLoTang + dLoPerp * dLoPerp)
|
local dLenLo = sqrt( dLoTang * dLoTang + dLoPerp * dLoPerp)
|
||||||
-- attacco tangente
|
-- attacco tangente
|
||||||
local dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp = FacesBySaw.CalcLeadInOutTangGeom( ptP1act, ptP2act, vtN, dSawDiam/2, vtRef, dCutExtra, b3Box)
|
local dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp = FacesBySaw.CalcLeadInOutTangGeom( ptP1, ptP2, vtN, dSawDiam/2, vtRef, dCutExtra, b3Box)
|
||||||
local dLenLi2 = abs( dLi2Tang)
|
local dLenLi2 = abs( dLi2Tang)
|
||||||
local dLenLo2 = abs( dLo2Tang)
|
local dLenLo2 = abs( dLo2Tang)
|
||||||
-- scelgo l'attacco più conveniente (se non taglio praticamente longitudinale)
|
-- scelgo l'attacco più conveniente (se non taglio praticamente longitudinale)
|
||||||
local bTurnTang
|
local bLioTang
|
||||||
local Ktp = 1.1
|
local Ktp = 1.1
|
||||||
if BD.KIOTP then Ktp = BD.KIOTP end
|
if BD.KIOTP then Ktp = BD.KIOTP end
|
||||||
if ( not bDownUp or abs( vtTg:getY()) > 0.5) and
|
if ( not bDownUp or abs( vtTg:getY()) > 0.5) and
|
||||||
( not bDownHead or abs( vtTg:getZ()) < 0.51) and
|
( not bDownHead or abs( vtTg:getZ()) < 0.51) and
|
||||||
abs( vtTg:getX()) < 0.9848 and
|
abs( vtTg:getX()) < 0.9848 and
|
||||||
( ( abs( vtTg:getZ()) < 0.17 and ( vtV1:getZ() < -0.5 or vtV2:getZ() < -0.5) and not bDownHead) or
|
( ( abs( vtTg:getZ()) < 0.17 and ( vtV1:getZ() < -0.5 or vtV2:getZ() < -0.5) and not bDownHead) or
|
||||||
( abs( vtTg:getZ()) < 0.51 and b3Box:getDimZ() > 300 and BD.C_SIMM and BD.MAX_HEIGHT > 450) or
|
( abs( vtTg:getZ()) < 0.51 and b3Box:getDimZ() > 300 and BD.C_SIMM and BD.MAX_HEIGHT > 450 and b3Box:getDimX() > BD.LEN_SHORT_PART) or
|
||||||
( Ktp * dLenLi2 < dLenLi and Ktp * dLenLo2 < dLenLo) or Ktp * ( dLenLi2 + dLenLo2) < ( dLenLi + dLenLo)) then
|
( 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
|
dLiTang, dLiPerp, dLoTang, dLoPerp = dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp
|
||||||
if BD.TURN then
|
if BD.TURN then
|
||||||
bTurnTang = true
|
local dMove = dist( ptP1, ptP2)
|
||||||
dLoTang = -( dLiTang + dAllStart - dAccStart + dAllEnd - dAccEnd + dLen)
|
dLoTang = -( dLiTang + dAllStart - dAccStart + dAllEnd - dAccEnd + dMove)
|
||||||
dLoPerp = BD.COLL_SIC
|
dLoPerp = BD.COLL_SIC
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -156,11 +294,27 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
|||||||
nSCC = EgtIf( ( vtAux:getY() > -GEO.EPS_SMALL), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
nSCC = EgtIf( ( vtAux:getY() > -GEO.EPS_SMALL), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local vtTest = EgtIf( bTurnTang, EgtIf( bInvert, vtTg, -vtTg), vtOut)
|
if bLioTang then
|
||||||
if abs( vtTest:getY()) > abs( vtTest:getZ()) then
|
--local vtTest = EgtIf( bInvert, vtTg, -vtTg)
|
||||||
nSCC = EgtIf( vtTest:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
local vtTest = -vtTg
|
||||||
|
if abs( vtTest:getY()) > abs( vtTest:getZ()) then
|
||||||
|
nSCC = EgtIf( vtTest: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
|
||||||
else
|
else
|
||||||
nSCC = EgtIf( vtTest:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
|
local vtTest = vtOut -- vtLio
|
||||||
|
if abs( vtN:getY()) < 0.174 and abs( vtN:getZ()) < 0.174 then
|
||||||
|
if abs( vtTest:getY()) > abs( vtTest:getZ()) then
|
||||||
|
nSCC = EgtIf( vtTest: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
|
||||||
|
elseif abs( vtN:getZ()) < 0.174 then
|
||||||
|
nSCC = EgtIf( vtTest:getZ() > -0.017, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
|
||||||
|
else
|
||||||
|
nSCC = EgtIf( vtTest:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- inserisco la lavorazione di taglio
|
-- inserisco la lavorazione di taglio
|
||||||
@@ -188,7 +342,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
|||||||
-- imposto attacco/uscita
|
-- imposto attacco/uscita
|
||||||
EgtSetMachiningParam( MCH_MP.LITANG, dLiTang)
|
EgtSetMachiningParam( MCH_MP.LITANG, dLiTang)
|
||||||
EgtSetMachiningParam( MCH_MP.LIPERP, dLiPerp)
|
EgtSetMachiningParam( MCH_MP.LIPERP, dLiPerp)
|
||||||
if bTurnTang then EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG) end
|
if BD.TURN and bLioTang then EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG) end
|
||||||
EgtSetMachiningParam( MCH_MP.LOTANG, dLoTang)
|
EgtSetMachiningParam( MCH_MP.LOTANG, dLoTang)
|
||||||
EgtSetMachiningParam( MCH_MP.LOPERP, dLoPerp)
|
EgtSetMachiningParam( MCH_MP.LOPERP, dLoPerp)
|
||||||
-- imposto allungamenti iniziale e finale
|
-- imposto allungamenti iniziale e finale
|
||||||
@@ -238,7 +392,7 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
|
|||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
local ptM = ( ptT1 + ptT2) / 2
|
local ptM = ( ptT1 + ptT2) / 2
|
||||||
local vtTg = ptT2 - ptT1 ;
|
local vtTg = ptT2 - ptT1 ; vtTg:normalize()
|
||||||
local bConvex = ( dAngT > 0)
|
local bConvex = ( dAngT > 0)
|
||||||
-- verifico non siano orientate troppo verso il basso e molto sbandate (oltre 10 deg)
|
-- verifico non siano orientate troppo verso il basso e molto sbandate (oltre 10 deg)
|
||||||
local bFaceOk = {}
|
local bFaceOk = {}
|
||||||
@@ -254,14 +408,14 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
|
|||||||
vtRef[1] = vtN[1] ^ vtTg
|
vtRef[1] = vtN[1] ^ vtTg
|
||||||
if vtRef[1] * vtN[2] < 0 then vtRef[1] = - vtRef[1] end
|
if vtRef[1] * vtN[2] < 0 then vtRef[1] = - vtRef[1] end
|
||||||
vtRef[1]:normalize()
|
vtRef[1]:normalize()
|
||||||
if abs( vtRef[1]:getZ()) < 0.577 and abs( abs( vtRef[1]:getX()) - abs( vtRef[1]:getY())) < 0.1 then
|
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] = ptC[1] - ptM
|
||||||
vtRef[1]:normalize()
|
vtRef[1]:normalize()
|
||||||
end
|
end
|
||||||
vtRef[2] = vtN[2] ^ vtTg
|
vtRef[2] = vtN[2] ^ vtTg
|
||||||
if vtRef[2] * vtN[1] < 0 then vtRef[2] = - vtRef[2] end
|
if vtRef[2] * vtN[1] < 0 then vtRef[2] = - vtRef[2] end
|
||||||
vtRef[2]:normalize()
|
vtRef[2]:normalize()
|
||||||
if abs( vtRef[2]:getZ()) < 0.577 and abs( abs( vtRef[2]:getX()) - abs( vtRef[2]:getY())) < 0.1 then
|
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] = ptC[2] - ptM
|
||||||
vtRef[2]:normalize()
|
vtRef[2]:normalize()
|
||||||
end
|
end
|
||||||
@@ -274,7 +428,7 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
|
|||||||
local nOtInd = 3 - nUpInd
|
local nOtInd = 3 - nUpInd
|
||||||
-- metto in relazione la scelta facce con il confronto del versore Z con la scelta in base alla grandezza faccia
|
-- metto in relazione la scelta facce con il confronto del versore Z con la scelta in base alla grandezza faccia
|
||||||
-- se la faccia più grande è messa secondaria e il suo versore Z non è troppo negativo
|
-- se la faccia più grande è messa secondaria e il suo versore Z non è troppo negativo
|
||||||
if nOtInd == nBigInd and vtN[nBigInd]:getZ() > -0.5 and vtN[nSmaInd]:getZ() < 0.966 then
|
if nOtInd == nBigInd and (( vtN[nBigInd]:getZ() > -0.5 and vtN[nSmaInd]:getZ() < 0.966) or bDownHead) then
|
||||||
nUpInd = nBigInd
|
nUpInd = nBigInd
|
||||||
nOtInd = nSmaInd
|
nOtInd = nSmaInd
|
||||||
end
|
end
|
||||||
@@ -430,7 +584,7 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
|
|||||||
-- eventuale segnalazione ingombro di testa o coda
|
-- eventuale segnalazione ingombro di testa o coda
|
||||||
local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ())
|
local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ())
|
||||||
if bUpdateIng and Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng and
|
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) then
|
not ( abs( vtN[nBigInd]:getX()) < 0.05 and vtN[nBigInd]:getY() < 0 and Proc.Box:getDimX() > 500 and Proc.Box:getDimY() < 40) then
|
||||||
if Proc.Head then
|
if Proc.Head then
|
||||||
local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX()
|
local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX()
|
||||||
BL.UpdateHCING( nRawId, dOffs)
|
BL.UpdateHCING( nRawId, dOffs)
|
||||||
@@ -441,7 +595,7 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
|
|||||||
local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX()
|
local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX()
|
||||||
local dDist = b3Solid:getMax():getX() - Proc.Box:getMax():getX()
|
local dDist = b3Solid:getMax():getX() - Proc.Box:getMax():getX()
|
||||||
-- se concavo aumento la distanza (rimane una punta...)
|
-- se concavo aumento la distanza (rimane una punta...)
|
||||||
if dAngT < 0 then dDist = dDist + 10 end
|
--if dAngT < 0 then dDist = dDist + 10 end
|
||||||
BL.UpdateHCING( nRawId, dOffs, dDist)
|
BL.UpdateHCING( nRawId, dOffs, dDist)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -460,29 +614,24 @@ function FacesBySaw.CalcLeadInOutPerpGeom( ptP1, ptP2, vtV1, vtV2, vtN, dRad, vt
|
|||||||
local vtX = vtTg ^ vtN
|
local vtX = vtTg ^ vtN
|
||||||
local frFace = Frame3d( ptP1, vtX, vtTg, vtN)
|
local frFace = Frame3d( ptP1, vtX, vtTg, vtN)
|
||||||
EgtOutLog( 'Vref=' .. tostring( vtRef) .. ' V1=' .. tostring( vtV1) .. ' V2=' .. tostring( vtV2), 3)
|
EgtOutLog( 'Vref=' .. tostring( vtRef) .. ' V1=' .. tostring( vtV1) .. ' V2=' .. tostring( vtV2), 3)
|
||||||
-- Versori di attacco e uscita
|
-- Versore di attacco e uscita
|
||||||
local dCos1 = vtV1 * vtRef
|
local dCos1 = vtV1 * vtRef
|
||||||
local dCos2 = vtV2 * vtRef
|
local dCos2 = vtV2 * vtRef
|
||||||
local vtLi, vtLo
|
local vtLio
|
||||||
if abs( dCos1 - dCos2) < 0.001 then
|
if abs( dCos1 - dCos2) < 0.001 then
|
||||||
if abs( vtV1:getZ()) < abs( vtV2:getZ()) then
|
if abs( vtV1:getZ()) < abs( vtV2:getZ()) then
|
||||||
vtLi = vtV1
|
vtLio = vtV1
|
||||||
vtLo = vtV1
|
|
||||||
else
|
else
|
||||||
vtLi = vtV2
|
vtLio = vtV2
|
||||||
vtLo = vtV2
|
|
||||||
end
|
end
|
||||||
elseif dCos1 > dCos2 then
|
elseif dCos1 > dCos2 then
|
||||||
vtLi = vtV1
|
vtLio = vtV1
|
||||||
vtLo = vtV1
|
|
||||||
else
|
else
|
||||||
vtLi = vtV2
|
vtLio = vtV2
|
||||||
vtLo = vtV2
|
|
||||||
end
|
end
|
||||||
local bRight = ( vtX * vtLi > 0)
|
local bRight = ( vtX * vtLio > 0)
|
||||||
-- Versori di attacco e uscita nel riferimento intrinseco al taglio
|
-- Versore di attacco e uscita nel riferimento intrinseco al taglio
|
||||||
local vtLiL = Vector3d( vtLi) ; vtLiL:toLoc( frFace)
|
local vtLioL = Vector3d( vtLio) ; vtLioL:toLoc( frFace)
|
||||||
local vtLoL = Vector3d( vtLo) ; vtLoL:toLoc( frFace)
|
|
||||||
-- Spostamento punti per effetto dell'extra o della deficienza di taglio
|
-- Spostamento punti per effetto dell'extra o della deficienza di taglio
|
||||||
ptP1 = ptP1 + vtX * ( EgtIf( bRight, - dCutExtra, dCutExtra))
|
ptP1 = ptP1 + vtX * ( EgtIf( bRight, - dCutExtra, dCutExtra))
|
||||||
ptP2 = ptP2 + vtX * ( EgtIf( bRight, - dCutExtra, dCutExtra))
|
ptP2 = ptP2 + vtX * ( EgtIf( bRight, - dCutExtra, dCutExtra))
|
||||||
@@ -492,30 +641,30 @@ function FacesBySaw.CalcLeadInOutPerpGeom( ptP1, ptP2, vtV1, vtV2, vtN, dRad, vt
|
|||||||
-- Attacco
|
-- Attacco
|
||||||
local dLiTang = 10000
|
local dLiTang = 10000
|
||||||
local dLiPerp = 10000
|
local dLiPerp = 10000
|
||||||
local bLiOk, _, vLiPar = EgtLineBoxInters( ptP1, vtLi, b3MyBox)
|
local bLiOk, _, vLiPar = EgtLineBoxInters( ptP1, vtLio, b3MyBox)
|
||||||
if bLiOk and #vLiPar > 0 then
|
if bLiOk and #vLiPar > 0 then
|
||||||
-- con la prima faccia di uscita
|
-- con la prima faccia di uscita
|
||||||
local dLen = vLiPar[#vLiPar]
|
local dLen = vLiPar[#vLiPar]
|
||||||
local ptInt = ptP1 + vtLi * dLen
|
local ptInt = ptP1 + vtLio * dLen
|
||||||
local vtFN = BL.GetBoxFaceNorm( b3MyBox, ptInt, vtLi)
|
local vtFN = BL.GetBoxFaceNorm( b3MyBox, ptInt, vtLio)
|
||||||
EgtOutLog( 'LiFaceNorm=' .. tostring( vtFN), 3)
|
EgtOutLog( 'LiFaceNorm=' .. tostring( vtFN), 3)
|
||||||
local dAddLen = dRad * ( sqrt( 1 - ( vtN * vtFN) * ( vtN * vtFN)) - abs( vtX * vtFN)) / ( vtLi * vtFN)
|
local dAddLen = dRad * ( sqrt( 1 - ( vtN * vtFN) * ( vtN * vtFN)) - abs( vtX * vtFN)) / ( vtLio * vtFN)
|
||||||
local dLiLen = dLen + dAddLen
|
local dLiLen = dLen + dAddLen
|
||||||
EgtOutLog( 'LeadIn Dist=' .. EgtNumToString( dLiLen), 3)
|
EgtOutLog( 'LeadIn Dist=' .. EgtNumToString( dLiLen), 3)
|
||||||
dLiTang = - dLiLen * vtLiL:getY()
|
dLiTang = - dLiLen * vtLioL:getY()
|
||||||
dLiPerp = EgtIf( bRight, dLiLen, - dLiLen) * vtLiL:getX()
|
dLiPerp = EgtIf( bRight, dLiLen, - dLiLen) * vtLioL:getX()
|
||||||
-- verifico se miglioro calcolando con faccia successiva
|
-- verifico se miglioro calcolando con faccia successiva
|
||||||
local b3Mod = BBox3d( b3MyBox) ; b3Mod:Add( ptInt + 1000 * vtFN)
|
local b3Mod = BBox3d( b3MyBox) ; b3Mod:Add( ptInt + 1000 * vtFN)
|
||||||
local bLiOk2, _, vLiPar2 = EgtLineBoxInters( ptP1, vtLi, b3Mod)
|
local bLiOk2, _, vLiPar2 = EgtLineBoxInters( ptP1, vtLio, b3Mod)
|
||||||
if bLiOk2 and #vLiPar2 > 0 then
|
if bLiOk2 and #vLiPar2 > 0 then
|
||||||
local dLen2 = vLiPar2[#vLiPar2]
|
local dLen2 = vLiPar2[#vLiPar2]
|
||||||
local vtFN2 = BL.GetBoxFaceNorm( b3Mod, ptP1 + vtLi * dLen2, vtLi)
|
local vtFN2 = BL.GetBoxFaceNorm( b3Mod, ptP1 + vtLio * dLen2, vtLio)
|
||||||
EgtOutLog( 'LiFaceNorm2=' .. tostring( vtFN2), 3)
|
EgtOutLog( 'LiFaceNorm2=' .. tostring( vtFN2), 3)
|
||||||
local dAddLen2 = dRad * ( sqrt( 1 - ( vtN * vtFN2) * ( vtN * vtFN2)) - abs( vtX * vtFN2)) / ( vtLi * vtFN2)
|
local dAddLen2 = dRad * ( sqrt( 1 - ( vtN * vtFN2) * ( vtN * vtFN2)) - abs( vtX * vtFN2)) / ( vtLio * vtFN2)
|
||||||
local dLiLen2 = dLen2 + dAddLen2
|
local dLiLen2 = dLen2 + dAddLen2
|
||||||
EgtOutLog( 'LeadIn Dist2=' .. EgtNumToString( dLiLen2), 3)
|
EgtOutLog( 'LeadIn Dist2=' .. EgtNumToString( dLiLen2), 3)
|
||||||
local dLiTang2 = - dLiLen2 * vtLiL:getY()
|
local dLiTang2 = - dLiLen2 * vtLioL:getY()
|
||||||
local dLiPerp2 = EgtIf( bRight, dLiLen2, - dLiLen2) * vtLiL:getX()
|
local dLiPerp2 = EgtIf( bRight, dLiLen2, - dLiLen2) * vtLioL:getX()
|
||||||
if dLiLen2 < dLiLen then
|
if dLiLen2 < dLiLen then
|
||||||
dLiTang = dLiTang2
|
dLiTang = dLiTang2
|
||||||
dLiPerp = dLiPerp2
|
dLiPerp = dLiPerp2
|
||||||
@@ -525,37 +674,37 @@ function FacesBySaw.CalcLeadInOutPerpGeom( ptP1, ptP2, vtV1, vtV2, vtN, dRad, vt
|
|||||||
-- Lunghezza di uscita
|
-- Lunghezza di uscita
|
||||||
local dLoTang = 10000
|
local dLoTang = 10000
|
||||||
local dLoPerp = 10000
|
local dLoPerp = 10000
|
||||||
local bLoOk, _, vLoPar = EgtLineBoxInters( ptP2, vtLo, b3MyBox)
|
local bLoOk, _, vLoPar = EgtLineBoxInters( ptP2, vtLio, b3MyBox)
|
||||||
if bLoOk and #vLoPar > 0 then
|
if bLoOk and #vLoPar > 0 then
|
||||||
-- con la prima faccia di uscita
|
-- con la prima faccia di uscita
|
||||||
local dLen = vLoPar[#vLoPar]
|
local dLen = vLoPar[#vLoPar]
|
||||||
local ptInt = ptP2 + vtLo * dLen
|
local ptInt = ptP2 + vtLio * dLen
|
||||||
local vtFN = BL.GetBoxFaceNorm( b3MyBox, ptInt, vtLo)
|
local vtFN = BL.GetBoxFaceNorm( b3MyBox, ptInt, vtLio)
|
||||||
EgtOutLog( 'LoFaceNorm=' .. tostring( vtFN), 3)
|
EgtOutLog( 'LoFaceNorm=' .. tostring( vtFN), 3)
|
||||||
local dAddLen = dRad * ( sqrt( 1 - ( vtN * vtFN) * ( vtN * vtFN)) - abs( vtX * vtFN)) / ( vtLo * vtFN)
|
local dAddLen = dRad * ( sqrt( 1 - ( vtN * vtFN) * ( vtN * vtFN)) - abs( vtX * vtFN)) / ( vtLio * vtFN)
|
||||||
local dLoLen = dLen + dAddLen
|
local dLoLen = dLen + dAddLen
|
||||||
EgtOutLog( 'LeadOut Dist=' .. EgtNumToString( dLoLen), 3)
|
EgtOutLog( 'LeadOut Dist=' .. EgtNumToString( dLoLen), 3)
|
||||||
dLoTang = dLoLen * vtLoL:getY()
|
dLoTang = dLoLen * vtLioL:getY()
|
||||||
dLoPerp = EgtIf( bRight, dLoLen, - dLoLen) * vtLoL:getX()
|
dLoPerp = EgtIf( bRight, dLoLen, - dLoLen) * vtLioL:getX()
|
||||||
-- verifico se miglioro calcolando con faccia successiva
|
-- verifico se miglioro calcolando con faccia successiva
|
||||||
local b3Mod = BBox3d( b3MyBox) ; b3Mod:Add( ptInt + 1000 * vtFN)
|
local b3Mod = BBox3d( b3MyBox) ; b3Mod:Add( ptInt + 1000 * vtFN)
|
||||||
local bLoOk2, _, vLoPar2 = EgtLineBoxInters( ptP2, vtLo, b3Mod)
|
local bLoOk2, _, vLoPar2 = EgtLineBoxInters( ptP2, vtLio, b3Mod)
|
||||||
if bLoOk2 and #vLoPar2 > 0 then
|
if bLoOk2 and #vLoPar2 > 0 then
|
||||||
local dLen2 = vLoPar2[#vLoPar2]
|
local dLen2 = vLoPar2[#vLoPar2]
|
||||||
local vtFN2 = BL.GetBoxFaceNorm( b3Mod, ptP2 + vtLo * dLen2, vtLo)
|
local vtFN2 = BL.GetBoxFaceNorm( b3Mod, ptP2 + vtLio * dLen2, vtLio)
|
||||||
EgtOutLog( 'LoFaceNorm2=' .. tostring( vtFN2), 3)
|
EgtOutLog( 'LoFaceNorm2=' .. tostring( vtFN2), 3)
|
||||||
local dAddLen2 = dRad * ( sqrt( 1 - ( vtN * vtFN2) * ( vtN * vtFN2)) - abs( vtX * vtFN2)) / ( vtLo * vtFN2)
|
local dAddLen2 = dRad * ( sqrt( 1 - ( vtN * vtFN2) * ( vtN * vtFN2)) - abs( vtX * vtFN2)) / ( vtLio * vtFN2)
|
||||||
local dLoLen2 = dLen2 + dAddLen2
|
local dLoLen2 = dLen2 + dAddLen2
|
||||||
EgtOutLog( 'LeadOut Dist2=' .. EgtNumToString( dLoLen2), 3)
|
EgtOutLog( 'LeadOut Dist2=' .. EgtNumToString( dLoLen2), 3)
|
||||||
local dLoTang2 = dLoLen2 * vtLoL:getY()
|
local dLoTang2 = dLoLen2 * vtLioL:getY()
|
||||||
local dLoPerp2 = EgtIf( bRight, dLoLen2, - dLoLen2) * vtLoL:getX()
|
local dLoPerp2 = EgtIf( bRight, dLoLen2, - dLoLen2) * vtLioL:getX()
|
||||||
if dLoLen2 < dLoLen then
|
if dLoLen2 < dLoLen then
|
||||||
dLoTang = dLoTang2
|
dLoTang = dLoTang2
|
||||||
dLoPerp = dLoPerp2
|
dLoPerp = dLoPerp2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return dLiTang, dLiPerp, dLoTang, dLoPerp
|
return dLiTang, dLiPerp, dLoTang, dLoPerp, vtLio
|
||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|||||||
+65
-32
@@ -2,6 +2,12 @@
|
|||||||
-- Libreria ricerca lavorazioni per Travi
|
-- Libreria ricerca lavorazioni per Travi
|
||||||
-- 2022/05/07 ES Profonde modifiche per scelta ottimale lavorazioni in macchine con più teste.
|
-- 2022/05/07 ES Profonde modifiche per scelta ottimale lavorazioni in macchine con più teste.
|
||||||
-- 2022/07/27 Aggiunta la gestione del tipo di foratura "AngleDrill" per fori molto inclinati
|
-- 2022/07/27 Aggiunta la gestione del tipo di foratura "AngleDrill" per fori molto inclinati
|
||||||
|
-- 2022/11/02 Modificata scelta utensile ottimizzata. Ora se c'è un utensile più grande disponibile si dà preferenza a quello.
|
||||||
|
-- 2022/11/25 Per FindMilling implementata la possibilità di escludere la testa H3 dalla ricerca utensile.
|
||||||
|
-- 2022/12/28 Per FindMilling e FindDrilling possibilità di escludere la testa H2 dalla ricerca utensile.
|
||||||
|
-- 2023/01/31 Per FindPocketing implementata la possibilità di escludere le teste H2 o H3 dalla ricerca utensile.
|
||||||
|
-- 2023/03/13 Per FindPocketing implementata la scelta lavorazione da UUID dell'utensile.
|
||||||
|
-- 2023/07/28 Aggiunta gestione del tipo di foratura "Drill_AT".
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local MachiningLib = {}
|
local MachiningLib = {}
|
||||||
@@ -107,8 +113,9 @@ local function SetCurrMachiningAndTool( sMachName)
|
|||||||
local sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
|
local sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
|
||||||
local nHead = tonumber( sHead:sub( 2, #sHead))
|
local nHead = tonumber( sHead:sub( 2, #sHead))
|
||||||
local bH2 = ( nHead >= 21 and nHead <= 29)
|
local bH2 = ( nHead >= 21 and nHead <= 29)
|
||||||
|
local bH3 = ( nHead >= 31 and nHead <= 39)
|
||||||
local bFixed = ( vFixedHeads[nHead])
|
local bFixed = ( vFixedHeads[nHead])
|
||||||
return bActive, sTool, bH2, bFixed
|
return bActive, sTool, bH2, bFixed, bH3
|
||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
@@ -144,7 +151,7 @@ end
|
|||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
function VerifyMill( dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bH2)
|
function VerifyMill( dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bH2)
|
||||||
local sTuuid = EgtGetMachiningParam( MCH_MP.TUUID)
|
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||||
local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
|
local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
|
||||||
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
|
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
|
||||||
local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
|
local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
|
||||||
@@ -157,13 +164,15 @@ function VerifyMill( dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bH2)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
function VerifyPocket( dMaxDiam, dDepth, dMaxTotLen, bH2)
|
function VerifyPocket( dMaxDiam, dDepth, dMaxTotLen, sTuuidMstr, bH2)
|
||||||
|
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||||
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
|
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
|
||||||
local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
|
local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
|
||||||
local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
|
local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
|
||||||
if ( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and
|
if ( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and
|
||||||
( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and
|
( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and
|
||||||
( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) then
|
( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) and
|
||||||
|
( not sTuuidMstr or sTuuidMstr == sTuuid) then
|
||||||
return true, { TDiam = dTDiam, TMaxDepth = dTMaxDepth, H2 = bH2}
|
return true, { TDiam = dTDiam, TMaxDepth = dTMaxDepth, H2 = bH2}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -171,7 +180,7 @@ end
|
|||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
function VerifyTool( MachiningType, sType, Params, bH2)
|
function VerifyTool( MachiningType, sType, Params, bH2)
|
||||||
if MachiningType == MCH_MY.DRILLING then
|
if MachiningType == MCH_MY.DRILLING then
|
||||||
if EgtStartsWith( sType, 'Drill') or EgtStartsWith( sType, 'AngleDrill') then
|
if EgtStartsWith( sType, 'Drill') or EgtStartsWith( sType, 'Drill_AT') or EgtStartsWith( sType, 'AngleDrill') then
|
||||||
return VerifyDrill( Params.Diam, Params.Depth, bH2)
|
return VerifyDrill( Params.Diam, Params.Depth, bH2)
|
||||||
elseif EgtStartsWith( sType, 'Pocket') then
|
elseif EgtStartsWith( sType, 'Pocket') then
|
||||||
return VerifyDrillPocket( Params.Diam, Params.Depth, bH2)
|
return VerifyDrillPocket( Params.Diam, Params.Depth, bH2)
|
||||||
@@ -181,7 +190,7 @@ function VerifyTool( MachiningType, sType, Params, bH2)
|
|||||||
elseif MachiningType == MCH_MY.MILLING then
|
elseif MachiningType == MCH_MY.MILLING then
|
||||||
return VerifyMill( Params.Depth, Params.TuuidMstr, Params.MaxDiam, Params.MaxTotLen, bH2)
|
return VerifyMill( Params.Depth, Params.TuuidMstr, Params.MaxDiam, Params.MaxTotLen, bH2)
|
||||||
elseif MachiningType == MCH_MY.POCKETING then
|
elseif MachiningType == MCH_MY.POCKETING then
|
||||||
return VerifyPocket( Params.MaxDiam, Params.Depth, Params.MaxTotLen, bH2)
|
return VerifyPocket( Params.MaxDiam, Params.Depth, Params.MaxTotLen, Params.TuuidMstr, bH2)
|
||||||
elseif MachiningType == MCH_MY.MORTISING then
|
elseif MachiningType == MCH_MY.MORTISING then
|
||||||
return true, { H2 = bH2}
|
return true, { H2 = bH2}
|
||||||
else
|
else
|
||||||
@@ -208,7 +217,7 @@ end
|
|||||||
function ReturnParams( MachiningType, MachiningName, sType, ToolParams)
|
function ReturnParams( MachiningType, MachiningName, sType, ToolParams)
|
||||||
if MachiningType == MCH_MY.DRILLING then
|
if MachiningType == MCH_MY.DRILLING then
|
||||||
local _, sOrigType = EgtEndsWith( sType, '_H2')
|
local _, sOrigType = EgtEndsWith( sType, '_H2')
|
||||||
return MachiningName, sType, EgtIf( sOrigType == 'Drill' or sOrigType == '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' , ToolParams.TMaxMat, ToolParams.TMaxDepth), ToolParams.MaxToolLength, ToolParams.ToolDiam, ToolParams.DiamTh, ToolParams.FreeLen
|
||||||
elseif MachiningType == MCH_MY.SAWING then
|
elseif MachiningType == MCH_MY.SAWING then
|
||||||
return MachiningName, ToolParams.H2
|
return MachiningName, ToolParams.H2
|
||||||
elseif MachiningType == MCH_MY.MILLING then
|
elseif MachiningType == MCH_MY.MILLING then
|
||||||
@@ -221,7 +230,7 @@ function ReturnParams( MachiningType, MachiningName, sType, ToolParams)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead)
|
local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead, bExcludeH2, bExcludeH3)
|
||||||
if bTopHead == nil and bDownHead == nil then
|
if bTopHead == nil and bDownHead == nil then
|
||||||
bTopHead = true
|
bTopHead = true
|
||||||
bDownHead = false
|
bDownHead = false
|
||||||
@@ -230,7 +239,17 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead)
|
|||||||
elseif bDownHead == nil then
|
elseif bDownHead == nil then
|
||||||
bDownHead = not bTopHead
|
bDownHead = not bTopHead
|
||||||
end
|
end
|
||||||
|
if bExcludeH2 == nil then
|
||||||
|
bExcludeH2 = false
|
||||||
|
end
|
||||||
|
if bExcludeH3 == nil then
|
||||||
|
bExcludeH3 = false
|
||||||
|
end
|
||||||
SetCurrMachineHeadType()
|
SetCurrMachineHeadType()
|
||||||
|
-- verifico se non richiesta testa sopra e macchina ha solo teste sopra
|
||||||
|
if not bTopHead and MachineHeadType ~= TWO_UP_DOWN_HEADS and not BD.TURN then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
-- verifico se testa attiva va bene
|
-- verifico se testa attiva va bene
|
||||||
local sH1Mach = ''
|
local sH1Mach = ''
|
||||||
local sH1Tool = ''
|
local sH1Tool = ''
|
||||||
@@ -263,6 +282,8 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead)
|
|||||||
-- se posso usare entrambe le teste, la gestisco come una macchina a due teste da sopra
|
-- se posso usare entrambe le teste, la gestisco come una macchina a due teste da sopra
|
||||||
MachineHeadUse = TWO_EQUAL_HEADS
|
MachineHeadUse = TWO_EQUAL_HEADS
|
||||||
end
|
end
|
||||||
|
-- variabile che definisce quando un utensile ha un diametro sostanzialmente più grande di un altro
|
||||||
|
local dBiggerToolTolerance = 1.25
|
||||||
for i = ForStart, ForEnd, ForStep do
|
for i = ForStart, ForEnd, ForStep do
|
||||||
local Machining = Machinings[i]
|
local Machining = Machinings[i]
|
||||||
local sMachiningType = Machining.Type
|
local sMachiningType = Machining.Type
|
||||||
@@ -270,8 +291,8 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead)
|
|||||||
_, sMachiningType = EgtEndsWith( Machining.Type, '_H2')
|
_, sMachiningType = EgtEndsWith( Machining.Type, '_H2')
|
||||||
end
|
end
|
||||||
-- recupero dati utensile
|
-- recupero dati utensile
|
||||||
local bToolActive, sToolName, bH2, bFixed = SetCurrMachiningAndTool( Machining.Name)
|
local bToolActive, sToolName, bH2, bFixed, bH3 = SetCurrMachiningAndTool( Machining.Name)
|
||||||
if Machining.On and sMachiningType == sType and bToolActive then
|
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( MachiningType, sType, Params, bH2)
|
||||||
if bOk then
|
if bOk then
|
||||||
if MachineHeadUse == ONE_HEAD then
|
if MachineHeadUse == ONE_HEAD then
|
||||||
@@ -284,22 +305,24 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead)
|
|||||||
return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams)
|
return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams)
|
||||||
-- verifico se posso usare lo stesso utensile della testa attiva
|
-- verifico se posso usare lo stesso utensile della testa attiva
|
||||||
elseif ( nActiveHead == 1 and not bH2 and sToolName == H1_TOOL) or ( nActiveHead == 2 and bH2 and sToolName == H2_TOOL) then
|
elseif ( nActiveHead == 1 and not bH2 and sToolName == H1_TOOL) or ( nActiveHead == 2 and bH2 and sToolName == H2_TOOL) then
|
||||||
SetNextMachining( sToolName, nActiveHead, bFixed)
|
-- se l'utensile sulla testa attiva è molto più piccolo rispetto a quelli salvati non lo scelgo
|
||||||
return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams)
|
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)
|
||||||
|
return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- segno le lavorazioni disponibili per entrambe le teste
|
||||||
|
if bH2 then
|
||||||
|
if not sH2Mach or sH2Mach == '' then
|
||||||
|
sH2Mach = Machining.Name
|
||||||
|
sH2Tool = sToolName
|
||||||
|
sH2Param = ToolParams
|
||||||
|
end
|
||||||
else
|
else
|
||||||
-- segno le lavorazioni disponibili per entrambe le teste
|
if not sH1Mach or sH1Mach == '' then
|
||||||
if bH2 then
|
sH1Mach = Machining.Name
|
||||||
if not sH2Mach or sH2Mach == '' then
|
sH1Tool = sToolName
|
||||||
sH2Mach = Machining.Name
|
sH1Param = ToolParams
|
||||||
sH2Tool = sToolName
|
|
||||||
sH2Param = ToolParams
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if not sH1Mach or sH1Mach == '' then
|
|
||||||
sH1Mach = Machining.Name
|
|
||||||
sH1Tool = sToolName
|
|
||||||
sH1Param = ToolParams
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif MachineHeadUse == TWO_UP_DOWN_HEADS then
|
elseif MachineHeadUse == TWO_UP_DOWN_HEADS then
|
||||||
@@ -315,6 +338,16 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if MachineHeadUse == TWO_EQUAL_HEADS then
|
if MachineHeadUse == TWO_EQUAL_HEADS then
|
||||||
|
-- se uno dei due utensili è 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)
|
||||||
|
end
|
||||||
|
end
|
||||||
-- verifico se cambiare testa o cambiare utensile su quella corrente
|
-- verifico se cambiare testa o cambiare utensile su quella corrente
|
||||||
if nActiveHead == 1 then
|
if nActiveHead == 1 then
|
||||||
if sH2Mach ~= "" then
|
if sH2Mach ~= "" then
|
||||||
@@ -350,9 +383,9 @@ function MachiningLib.FindCutting( sType, bTopHead, bDownHead)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead)
|
function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead, bExcludeH2, bAngleTransmission)
|
||||||
local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, 'Drill', { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead)
|
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 == '' then
|
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)
|
MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, 'Pocket', { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead)
|
||||||
end
|
end
|
||||||
if MachiningName and MachiningName ~= '' then
|
if MachiningName and MachiningName ~= '' then
|
||||||
@@ -369,13 +402,13 @@ function MachiningLib.FindAngleDrilling( dDiam, dDepth, bTopHead, bDownHead)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bTopHead, bDownHead)
|
function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bTopHead, bDownHead, bExcludeH2, bExcludeH3)
|
||||||
return FindMachining( MCH_MY.MILLING, sType, { Depth = dDepth, TuuidMstr = sTuuidMstr, MaxDiam = dMaxDiam, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead)
|
return FindMachining( MCH_MY.MILLING, sType, { Depth = dDepth, TuuidMstr = sTuuidMstr, MaxDiam = dMaxDiam, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead, bExcludeH2, bExcludeH3)
|
||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
function MachiningLib.FindPocketing( sType, dMaxDiam, dDepth, dMaxTotLen, bTopHead, bDownHead)
|
function MachiningLib.FindPocketing( sType, dMaxDiam, dDepth, dMaxTotLen, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sTuuidMstr)
|
||||||
return FindMachining( MCH_MY.POCKETING, sType, { MaxDiam = dMaxDiam, Depth = dDepth, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead)
|
return FindMachining( MCH_MY.POCKETING, sType, { MaxDiam = dMaxDiam, Depth = dDepth, MaxTotLen = dMaxTotLen, TuuidMstr = sTuuidMstr}, bTopHead, bDownHead, bExcludeH2, bExcludeH3)
|
||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|||||||
+153
-60
@@ -1,4 +1,4 @@
|
|||||||
-- ProcessCut.lua by Egaltech s.r.l. 2022/07/28
|
-- ProcessCut.lua by Egaltech s.r.l. 2023/08/01
|
||||||
-- Gestione calcolo singoli tagli di lama per Travi
|
-- Gestione calcolo singoli tagli di lama per Travi
|
||||||
-- 2021/05/18 I due tagli con testa da sotto di un cubetto sono fatti di seguito.
|
-- 2021/05/18 I due tagli con testa da sotto di un cubetto sono fatti di seguito.
|
||||||
-- 2021/06/06 Correzioni per tagli con testa da sotto.
|
-- 2021/06/06 Correzioni per tagli con testa da sotto.
|
||||||
@@ -14,7 +14,14 @@
|
|||||||
-- 2022/07/18 Se Q04=1, aggiunto LongCut anche dal lato per macchine tipo PF1250.
|
-- 2022/07/18 Se Q04=1, aggiunto LongCut anche dal lato per macchine tipo PF1250.
|
||||||
-- 2022/08/12 I tagli di lama inclinati in coda ora partono dal centro e non dall'esterno.
|
-- 2022/08/12 I tagli di lama inclinati in coda ora partono dal centro e non dall'esterno.
|
||||||
-- 2022/08/24 Disabilitato il dicing per i tagli meno spessi della lama.
|
-- 2022/08/24 Disabilitato il dicing per i tagli meno spessi della lama.
|
||||||
-- 2022/08/25 In caso di AdvTail con taglio lungo Y la profondità di lavorazione è opportunamente diminuita.
|
-- 2022/08/25 In caso di AdvTail con taglio lungo Y la profondità di lavorazione è opportunamente diminuita.
|
||||||
|
-- 2022/08/30 Modificata la condizione che determina l'utilizzo della testa da sotto. Ora controlla se la trave è più grande del doppio della massima larghezza del cubetto.
|
||||||
|
-- 2022/09/23 Corretta la condizione per cui è richiesto l'aggiornamento del grezzo.
|
||||||
|
-- 2023/01/26 Migliorata la direzione di lavoro della lama in alcuni casi in cui il truciolo veniva scaricato dal lato errato.
|
||||||
|
-- 2023/06/19 Aggiunti tagli speciali per evitare il rischio che il cubetto rimanga appoggiato al motore.
|
||||||
|
-- 2023/08/01 Correzione su offset per taglio doppio di lato.
|
||||||
|
-- 2023/08/01 In caso di pezzi alti su macchina tipo PF i tagli doppi di lato non vengono usati, si usa il metodo standard.
|
||||||
|
-- 2023/09/12 In MakeFromTop abbassato a 590 mm il limite per convertire in LongCut.
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local ProcessCut = {}
|
local ProcessCut = {}
|
||||||
@@ -169,7 +176,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
EgtSetOperationMode( nMchId, false)
|
EgtSetOperationMode( nMch1Id, false)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
-- Inserisco la lavorazione del lato opposto
|
-- Inserisco la lavorazione del lato opposto
|
||||||
@@ -192,7 +199,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
EgtSetOperationMode( nMchId, false)
|
EgtSetOperationMode( nMch2Id, false)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
return true, nil
|
return true, nil
|
||||||
@@ -209,7 +216,7 @@ local function UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
|
|||||||
if vtN:getZ() > 0.5 then
|
if vtN:getZ() > 0.5 then
|
||||||
dOffs = dOffs - 0.6 * Proc.Box:getDimX()
|
dOffs = dOffs - 0.6 * Proc.Box:getDimX()
|
||||||
elseif vtN:getZ() < -0.5 then
|
elseif vtN:getZ() < -0.5 then
|
||||||
dOffs = dOffs - 0.2 * Proc.Box:getDimX()
|
dOffs = dOffs - EgtIf( BD.PRESS_ROLLER, 0.4, 0.2) * Proc.Box:getDimX()
|
||||||
elseif ( abs( vtN:getY()) > 0.9 and vtN:getZ() > 0.2) then
|
elseif ( abs( vtN:getY()) > 0.9 and vtN:getZ() > 0.2) then
|
||||||
dOffs = dOffs - 0.3 * Proc.Box:getDimX()
|
dOffs = dOffs - 0.3 * Proc.Box:getDimX()
|
||||||
end
|
end
|
||||||
@@ -219,7 +226,7 @@ local function UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
|
|||||||
if vtN:getZ() > 0.5 then
|
if vtN:getZ() > 0.5 then
|
||||||
dOffs = dOffs - 0.6 * Proc.Box:getDimX()
|
dOffs = dOffs - 0.6 * Proc.Box:getDimX()
|
||||||
elseif vtN:getZ() < -0.5 then
|
elseif vtN:getZ() < -0.5 then
|
||||||
dOffs = dOffs - 0.2 * Proc.Box:getDimX()
|
dOffs = dOffs - EgtIf( BD.PRESS_ROLLER, 0.4, 0.2) * Proc.Box:getDimX()
|
||||||
elseif ( abs( vtN:getY()) > 0.9 and vtN:getZ() > 0.2) then
|
elseif ( abs( vtN:getY()) > 0.9 and vtN:getZ() > 0.2) then
|
||||||
dOffs = dOffs - 0.3 * Proc.Box:getDimX()
|
dOffs = dOffs - 0.3 * Proc.Box:getDimX()
|
||||||
end
|
end
|
||||||
@@ -243,22 +250,27 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
|||||||
if bFromBottom == nil then
|
if bFromBottom == nil then
|
||||||
bFromBottom = ( vtN:getZ() > 0.25 and b3Solid:getDimX() < BD.LEN_SHORT_PART and not Proc.AdvTail and vtN:getX() < 0 and abs( vtN:getY()) < 0.259)
|
bFromBottom = ( vtN:getZ() > 0.25 and b3Solid:getDimX() < BD.LEN_SHORT_PART and not Proc.AdvTail and vtN:getX() < 0 and abs( vtN:getY()) < 0.259)
|
||||||
end
|
end
|
||||||
|
local dMinFeatureLengthForLongCut = 590.000
|
||||||
-- verifico se da considerare taglio lungo ( non da sotto, inclinato non più di 30deg, largo come la trave e abbastanza lungo)
|
-- verifico se da considerare taglio lungo ( non da sotto, inclinato non più di 30deg, largo come la trave e abbastanza lungo)
|
||||||
local bLongCut = ( not bDownCut and vtN:getZ() > 0.865 and
|
local bLongCut = ( not bDownCut and vtN:getZ() > 0.865 and
|
||||||
Proc.Box:getDimY() > b3Solid:getDimY() - 10 * GEO.EPS_SMALL and
|
Proc.Box:getDimY() > b3Solid:getDimY() - 10 * GEO.EPS_SMALL and
|
||||||
( Proc.Box:getDimX() > 0.75 * b3Solid:getDimX() or Proc.Box:getDimX() > 600.000))
|
( Proc.Box:getDimX() > 0.75 * b3Solid:getDimX() or Proc.Box:getDimX() > dMinFeatureLengthForLongCut))
|
||||||
-- verifico se da considerare taglio lungo dal lato, solo per macchine tipo PF1250, inclinato non più di 30deg
|
-- verifico se da considerare taglio lungo dal lato, solo per macchine tipo PF1250, inclinato non più di 30deg
|
||||||
local bLongCutFromSide = ( not bDownCut and ( BD.C_SIMM and BD.DOWN_HEAD and ( vtN:getY() > 0.865 or vtN:getY() < -0.865) and
|
local bLongCutFromSide = ( not bDownCut and ( BD.C_SIMM and BD.DOWN_HEAD and ( abs(vtN:getY()) > 0.865) and
|
||||||
Proc.Box:getDimZ() > b3Solid:getDimZ() - 10 * GEO.EPS_SMALL) and
|
Proc.Box:getDimZ() > b3Solid:getDimZ() - 10 * GEO.EPS_SMALL) and
|
||||||
( Proc.Box:getDimX() > 0.75 * b3Solid:getDimX() or Proc.Box:getDimX() > 600.000))
|
( Proc.Box:getDimX() > 0.75 * b3Solid:getDimX() or Proc.Box:getDimX() > dMinFeatureLengthForLongCut))
|
||||||
-- se taglio lungo e Q04 = 1 allora lancio il processo dell'L10
|
-- se taglio lungo e Q04 = 1 allora lancio il processo dell'L10
|
||||||
local bNoDicing = EgtGetInfo( Proc.Id, 'Q04', 'i') == 1
|
local bNoDicing = EgtGetInfo( Proc.Id, 'Q04', 'i') == 1
|
||||||
if bNoDicing then
|
if bNoDicing then
|
||||||
if bLongCut then
|
if bLongCut then
|
||||||
return LongCut.Make( Proc, nPhase, nRawId, nPartId, true)
|
local bOk, sErr = LongCut.Make( Proc, nPhase, nRawId, nPartId, true)
|
||||||
|
return bOk, sErr, bNoDicing
|
||||||
elseif bLongCutFromSide then
|
elseif bLongCutFromSide then
|
||||||
return LongCut.Make( Proc, nPhase, nRawId, nPartId, false, 2)
|
local bOk, sErr = LongCut.Make( Proc, nPhase, nRawId, nPartId, false, 2)
|
||||||
|
return bOk, sErr, bNoDicing
|
||||||
end
|
end
|
||||||
|
-- se non passa dal LongCut rimetto a false perchè ha fatto un taglio standard
|
||||||
|
bNoDicing = false
|
||||||
end
|
end
|
||||||
-- se pezzo ancora attaccato alla trave, per non rovinare quello successivo
|
-- se pezzo ancora attaccato alla trave, per non rovinare quello successivo
|
||||||
local bFillAreaPiece
|
local bFillAreaPiece
|
||||||
@@ -278,9 +290,9 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
|||||||
-- se la faccia occupa tutta la trave in X e Z o occupa sicuramente la faccia in Z e almeno 3/4 della faccia in X e sborda in X,
|
-- se la faccia occupa tutta la trave in X e Z o occupa sicuramente la faccia in Z e almeno 3/4 della faccia in X e sborda in X,
|
||||||
if ( ( abs( Proc.Box:getMin():getX() - b3Solid:getMin():getX()) < 10*GEO.EPS_SMALL and abs( Proc.Box:getMax():getX() - b3Solid:getMax():getX()) < 10*GEO.EPS_SMALL) or
|
if ( ( abs( Proc.Box:getMin():getX() - b3Solid:getMin():getX()) < 10*GEO.EPS_SMALL and abs( Proc.Box:getMax():getX() - b3Solid:getMax():getX()) < 10*GEO.EPS_SMALL) or
|
||||||
( ( abs( Proc.Box:getMin():getX() - b3Solid:getMin():getX()) < 10*GEO.EPS_SMALL or abs( Proc.Box:getMax():getX() - b3Solid:getMax():getX()) < 10*GEO.EPS_SMALL) and
|
( ( abs( Proc.Box:getMin():getX() - b3Solid:getMin():getX()) < 10*GEO.EPS_SMALL or abs( Proc.Box:getMax():getX() - b3Solid:getMax():getX()) < 10*GEO.EPS_SMALL) and
|
||||||
Proc.Box:getDimX() > 0.75 * b3Solid:getDimX())) and
|
Proc.Box:getDimX() > 0.90 * b3Solid:getDimX())) and
|
||||||
abs( Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()) < 10*GEO.EPS_SMALL and abs( Proc.Box:getMax():getZ() - b3Solid:getMax():getZ()) < 10*GEO.EPS_SMALL then
|
abs( Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()) < 10*GEO.EPS_SMALL and abs( Proc.Box:getMax():getZ() - b3Solid:getMax():getZ()) < 10*GEO.EPS_SMALL then
|
||||||
local sErr = 'Error : Impossible to machine by orientation (on side)'
|
local sErr = 'Error : Impossible to machine by orientation (on side A)'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
@@ -298,7 +310,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
|||||||
-- se la faccia termina davanti o dietro la trave e arriva in coda e non interessa la faccia inferiore, forzo il taglio a cubetti a partire dal davanti
|
-- se la faccia termina davanti o dietro la trave e arriva in coda e non interessa la faccia inferiore, forzo il taglio a cubetti a partire dal davanti
|
||||||
if ( abs( Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()) < 10*GEO.EPS_SMALL or abs( Proc.Box:getMax():getZ() - b3Solid:getMax():getZ()) < 10*GEO.EPS_SMALL) and
|
if ( abs( Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()) < 10*GEO.EPS_SMALL or abs( Proc.Box:getMax():getZ() - b3Solid:getMax():getZ()) < 10*GEO.EPS_SMALL) and
|
||||||
abs( Proc.Box:getMin():getX() - b3Solid:getMin():getX()) < 10*GEO.EPS_SMALL then
|
abs( Proc.Box:getMin():getX() - b3Solid:getMin():getX()) < 10*GEO.EPS_SMALL then
|
||||||
local sErr = 'Error : Impossible to machine by orientation (on side)'
|
local sErr = 'Error : Impossible to machine by orientation (on side B)'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
@@ -347,9 +359,37 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
|||||||
vtExtra = X_AX()
|
vtExtra = X_AX()
|
||||||
bAutoCalcSurf = false
|
bAutoCalcSurf = false
|
||||||
end
|
end
|
||||||
|
-- verifico elevazione max del materiale tagliato
|
||||||
|
local dMaxElev
|
||||||
|
if vtN:getX() > 0 then
|
||||||
|
if bForced then
|
||||||
|
dMaxElev = b3Raw:getMax():getX() - Proc.Box:getMin():getX()
|
||||||
|
else
|
||||||
|
dMaxElev = b3Solid:getMax():getX() - Proc.Box:getMin():getX()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if bForced then
|
||||||
|
dMaxElev = Proc.Box:getMax():getX() - b3Raw:getMin():getX()
|
||||||
|
else
|
||||||
|
dMaxElev = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- per macchina TURN aggiusto massima dimensione cubetto
|
||||||
|
local dNewDiceDim
|
||||||
|
if BD.TURN then
|
||||||
|
local dDimRef = GEO.INFINITO
|
||||||
|
if abs( vtN:getZ()) < 0.003 then
|
||||||
|
dDimRef = b3Raw:getDimZ()
|
||||||
|
elseif abs( vtN:getY()) < 0.003 then
|
||||||
|
dDimRef = b3Raw:getDimY()
|
||||||
|
end
|
||||||
|
if dDimRef + BD.CUT_EXTRA < dMaxDepth then
|
||||||
|
dNewDiceDim = - ( dMaxDepth - BD.CUT_EXTRA)
|
||||||
|
end
|
||||||
|
end
|
||||||
-- se il taglio è più spesso della lama abilito il dicing, altrimenti no
|
-- se il taglio è più spesso della lama abilito il dicing, altrimenti no
|
||||||
if Proc.Box:getDimX() >= dSawThick then
|
if dMaxElev > dSawThick then
|
||||||
vCuts = DC.GetDice( nAddGrpId, EgtIf( bForced, b3Raw, b3Solid), ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA)
|
vCuts = DC.GetDice( nAddGrpId, EgtIf( bForced, b3Raw, b3Solid), ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, dNewDiceDim)
|
||||||
-- se taglio sborda in coda e non è stato inserito nessun taglio a cubetti, lo rilancio con le dimensioni customizzate
|
-- se taglio sborda in coda e non è stato inserito nessun taglio a cubetti, lo rilancio con le dimensioni customizzate
|
||||||
if ( bFillTail or bCustDiceCut) and #vCuts == 0 then
|
if ( bFillTail or bCustDiceCut) and #vCuts == 0 then
|
||||||
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, Proc.Box:getDimY())
|
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, Proc.Box:getDimY())
|
||||||
@@ -360,6 +400,19 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
|||||||
if bCustDiceCut and #vCuts == 0 then
|
if bCustDiceCut and #vCuts == 0 then
|
||||||
return false, -1
|
return false, -1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- per caso speciale in cui c'è il rischio che il cubetto rimanga appoggiato sul motore, faccio solo i tagli perpendicolari seguiti da due tagli verticali laterali
|
||||||
|
local bDangerousReliefCut = false
|
||||||
|
-- verifico che i tagli perpendicolari siano perpendicolari al lato più vicino a Z
|
||||||
|
local nFirstPerpendicularCut = ( #vCuts > 0 and ( vCuts[1][1] or vCuts[3][1]))
|
||||||
|
if nFirstPerpendicularCut then
|
||||||
|
local frFace = BL.GetFaceHvRefDim( Proc.Id, 0)
|
||||||
|
local vtTemp = EgtSurfTmFacetNormVersor( nFirstPerpendicularCut, 0, GDB_ID.ROOT) ^ frFace:getVersX()
|
||||||
|
if not ( vtTemp:isSmall()) and not ( bDownCut or bFromBottom) and not bLongCut and ( not BD.C_SIMM or b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL) then
|
||||||
|
bDangerousReliefCut = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--DC.PrintOrderCut( vCuts)
|
--DC.PrintOrderCut( vCuts)
|
||||||
if #vCuts > 0 then
|
if #vCuts > 0 then
|
||||||
-- sistemo posizione nel DB e nome
|
-- sistemo posizione nel DB e nome
|
||||||
@@ -370,8 +423,8 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
|||||||
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
|
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
|
||||||
if ( i % 2) == 1 then
|
if ( i % 2) == 1 then
|
||||||
local vtO = EgtSurfTmFacetNormVersor( vCuts[i][j], 0, GDB_ID.ROOT)
|
local vtO = EgtSurfTmFacetNormVersor( vCuts[i][j], 0, GDB_ID.ROOT)
|
||||||
if ( vtN:getY() > 0.707 and vtO:getY() < -0.05) or
|
if ( vtN:getY() > 0.766 and vtO:getY() < -0.05) or
|
||||||
( vtN:getY() < -0.707 and vtO:getY() > 0.05) then
|
( vtN:getY() < -0.766 and vtO:getY() > 0.05) then
|
||||||
EgtInvertSurf( vCuts[i][j])
|
EgtInvertSurf( vCuts[i][j])
|
||||||
bOrthInv = true
|
bOrthInv = true
|
||||||
end
|
end
|
||||||
@@ -418,44 +471,77 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- lavoro la faccia
|
local dDiceFaceMaxH = 0
|
||||||
for j = 1, #vCuts[i] do
|
local dDiceFaceMinH = GEO.INFINITO
|
||||||
-- se taglio dal basso
|
if ( i % 2) == 0 and bDangerousReliefCut then
|
||||||
if bDownCut then
|
for j = 1, #vCuts[i] do
|
||||||
-- se strato pari composto da 1 o 2 elementi
|
local _, dDiceFaceH, dDiceFaceV = BL.GetFaceHvRefDim( vCuts[i][j], 0)
|
||||||
if ( i % 2) == 0 and #vCuts[i] <= 2 then
|
dDiceFaceMaxH = max( dDiceFaceMaxH, dDiceFaceH)
|
||||||
-- il primo elemento prende la direzione prevista, il secondo quella opposta
|
-- calcolo lato orizzontale minore ipotizzando sia un trapezio
|
||||||
local vtNewOrthoO = Vector3d( vtOrthoO)
|
local dDiceFaceH2 = ( 2 * EgtSurfArea( vCuts[i][j]) ) / dDiceFaceV - dDiceFaceH
|
||||||
local dVzLimDwnUp = dNzLimDwnUp
|
dDiceFaceMinH = min( dDiceFaceMinH, dDiceFaceH2)
|
||||||
if j ~= 1 then
|
end
|
||||||
vtNewOrthoO = -vtOrthoO
|
end
|
||||||
if not BD.C_SIMM and abs( vtN:getY()) > 0.05 then dVzLimDwnUp = -0.707 end
|
-- caso speciale con rischio cubetto sul motore
|
||||||
|
if ( i % 2) == 0 and bDangerousReliefCut and ( dMaxDepth > dDiceFaceMaxH - 0.5 * dDiceFaceMinH + BD.CUT_EXTRA_MIN) then
|
||||||
|
local bDoubleCut = false
|
||||||
|
local dCutExtra = BD.CUT_EXTRA
|
||||||
|
if dMaxDepth < dDiceFaceMaxH + BD.CUT_EXTRA then
|
||||||
|
bDoubleCut = true
|
||||||
|
dCutExtra = - 0.5 * dDiceFaceMinH + BD.CUT_EXTRA_MIN
|
||||||
|
end
|
||||||
|
local nSurfToCut = EgtSurfTmBySewing( nAddGrpId, vCuts[i], false)
|
||||||
|
local nFaceUseCut1, nFaceUseCut2 = MCH_MILL_FU.ORTHO_BACK, MCH_MILL_FU.ORTHO_FRONT
|
||||||
|
if Proc.Tail then
|
||||||
|
nFaceUseCut1, nFaceUseCut2 = nFaceUseCut2, nFaceUseCut1
|
||||||
|
end
|
||||||
|
if bDoubleCut then
|
||||||
|
local bOk, sErr = Fbs.MakeOne( nSurfToCut, 0, sCutting, dSawDiam, nFaceUseCut1, nil, dCutExtra, BD.CUT_SIC, 0, 0, 0, '', b3Raw, true)
|
||||||
|
if not bOk then return false, sErr end
|
||||||
|
end
|
||||||
|
local bOk2, sErr2 = Fbs.MakeOne( nSurfToCut, 0, sCutting, dSawDiam, nFaceUseCut2, nil, dCutExtra, BD.CUT_SIC, 0, 0, 0, '', b3Raw)
|
||||||
|
if not bOk2 then return false, sErr2 end
|
||||||
|
-- caso standard
|
||||||
|
else
|
||||||
|
-- lavoro la faccia
|
||||||
|
for j = 1, #vCuts[i] do
|
||||||
|
-- se taglio dal basso
|
||||||
|
if bDownCut then
|
||||||
|
-- se strato pari composto da 1 o 2 elementi
|
||||||
|
if ( i % 2) == 0 and #vCuts[i] <= 2 then
|
||||||
|
-- il primo elemento prende la direzione prevista, il secondo quella opposta
|
||||||
|
local vtNewOrthoO = Vector3d( vtOrthoO)
|
||||||
|
local dVzLimDwnUp = dNzLimDwnUp
|
||||||
|
if j ~= 1 then
|
||||||
|
vtNewOrthoO = -vtOrthoO
|
||||||
|
if 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)
|
||||||
|
if not bOk then return bOk, sErr end
|
||||||
end
|
end
|
||||||
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtNewOrthoO, dVzLimDwnUp, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
-- tutti gli altri casi vengono saltati
|
||||||
|
-- caso generale
|
||||||
|
else
|
||||||
|
-- in generale sta sollevato di pochissimo
|
||||||
|
local dExtraCut = -0.1
|
||||||
|
-- se tagli paralleli
|
||||||
|
if ( i % 2) == 0 then
|
||||||
|
-- se non ci sono tagli ortogonali devo affondare
|
||||||
|
if bNoPerpCuts then
|
||||||
|
dExtraCut = BD.CUT_EXTRA
|
||||||
|
-- se altrimenti tagli ortogonali invertiti, devo approfondire dello spessore lama
|
||||||
|
elseif bOrthInv then
|
||||||
|
dExtraCut = dSawThick
|
||||||
|
-- se ultimo taglio, devo affondare
|
||||||
|
elseif j == #vCuts[i] then
|
||||||
|
dExtraCut = BD.CUT_EXTRA
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local dVzLimDwnUp = dNzLimDwnUp
|
||||||
|
if not BD.C_SIMM and 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 not bOk then return bOk, sErr end
|
if not bOk then return bOk, sErr end
|
||||||
end
|
end
|
||||||
-- tutti gli altri casi vengono saltati
|
|
||||||
-- caso generale
|
|
||||||
else
|
|
||||||
-- in generale sta sollevato di pochissimo
|
|
||||||
local dExtraCut = -0.1
|
|
||||||
-- se tagli paralleli
|
|
||||||
if ( i % 2) == 0 then
|
|
||||||
-- se non ci sono tagli ortogonali devo affondare
|
|
||||||
if bNoPerpCuts then
|
|
||||||
dExtraCut = BD.CUT_EXTRA
|
|
||||||
-- se altrimenti tagli ortogonali invertiti, devo approfondire dello spessore lama
|
|
||||||
elseif bOrthInv then
|
|
||||||
dExtraCut = dSawThick
|
|
||||||
-- se ultimo taglio, devo affondare
|
|
||||||
elseif j == #vCuts[i] then
|
|
||||||
dExtraCut = BD.CUT_EXTRA
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local dVzLimDwnUp = dNzLimDwnUp
|
|
||||||
if not BD.C_SIMM and vtN:getZ() > 0.707 then dVzLimDwnUp = -0.708 end
|
|
||||||
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, sNotes, b3Raw)
|
|
||||||
if not bOk then return bOk, sErr end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -472,7 +558,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
|||||||
local vtOrthoO
|
local vtOrthoO
|
||||||
if bFromBottom and dCutV < dMaxVertDepth - BD.CUT_EXTRA and vtN:getZ() > 0 then
|
if bFromBottom and dCutV < dMaxVertDepth - BD.CUT_EXTRA and vtN:getZ() > 0 then
|
||||||
vtOrthoO = -Z_AX()
|
vtOrthoO = -Z_AX()
|
||||||
elseif bHorizCut and ( not bVertCutOk or b3Solid:getDimX() > BD.LEN_SHORT_PART or Proc.AdvTail or vtN:getX() > 0 or ( abs( vtN:getY()) < 0.1 and vtN:getZ() <= 0)) then
|
elseif bHorizCut and ( not bVertCutOk or b3Solid:getDimX() > BD.LEN_SHORT_PART or Proc.AdvTail or ( vtN:getX() > 0 and vtN:getZ() <= 0.708) or ( abs( vtN:getY()) < 0.1 and vtN:getZ() <= 0)) then
|
||||||
vtOrthoO = Z_AX()
|
vtOrthoO = Z_AX()
|
||||||
elseif b3Solid:getDimX() < BD.LEN_SHORT_PART and not Proc.AdvTail and abs( vtN:getY()) > 0.259 and
|
elseif b3Solid:getDimX() < BD.LEN_SHORT_PART and not Proc.AdvTail and abs( vtN:getY()) > 0.259 and
|
||||||
vtN:getZ() > -0.174 and abs( vtN:getY()) > abs( vtN:getZ()) and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then
|
vtN:getZ() > -0.174 and abs( vtN:getY()) > abs( vtN:getZ()) and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then
|
||||||
@@ -488,8 +574,10 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
|||||||
vtOrthoO = -X_AX()
|
vtOrthoO = -X_AX()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if vtN:getZ() < dVzLimDwnUp or Proc.Head or Proc.Tail then
|
if vtN:getZ() < dVzLimDwnUp or Proc.Tail or ( Proc.Head and abs( vtN:getY()) > 0.01) then
|
||||||
vtOrthoO = EgtIf( vtN:getY() > -0.02, -Y_AX(), Y_AX())
|
vtOrthoO = EgtIf( vtN:getY() > -0.02, -Y_AX(), Y_AX())
|
||||||
|
elseif Proc.Head then
|
||||||
|
vtOrthoO = EgtIf( vtN:getY() > -0.02, Y_AX(), -Y_AX())
|
||||||
else
|
else
|
||||||
vtOrthoO = EgtIf( vtN:getY() > 0.02, Y_AX(), -Y_AX())
|
vtOrthoO = EgtIf( vtN:getY() > 0.02, Y_AX(), -Y_AX())
|
||||||
end
|
end
|
||||||
@@ -722,23 +810,27 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom,
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- abilitazione lavorazione da sotto (testa da sotto e direzione normale sotto -20deg e sbandato oltre 1deg oppure sezione larga o pezzo corto)
|
-- abilitazione lavorazione da sotto (testa da sotto e direzione normale sotto -20deg e sbandato oltre 1deg oppure sezione più larga di 2 cubetti o pezzo corto)
|
||||||
local bDownHead = ( BD.DOWN_HEAD and vtN:getZ() < -0.341 and
|
local bDownHead = ( BD.DOWN_HEAD and vtN:getZ() < -0.341 and
|
||||||
( abs( vtN:getY()) > 0.017 or b3Raw:getDimY() > 2 * ( BD.MAX_DIM_HTCUT - BD.CUT_EXTRA_MIN) or b3Raw:getDimX() < BD.LEN_SHORT_PART))
|
( abs( vtN:getY()) > 0.017 or b3Raw:getDimY() > 2 * ( BD.MAX_DIM_DICE - BD.CUT_EXTRA_MIN) or b3Raw:getDimX() < BD.LEN_SHORT_PART))
|
||||||
local bDownTurn = ( BD.TURN and vtN:getZ() < -0.017)
|
local bDownTurn = ( BD.TURN and vtN:getZ() < -0.017)
|
||||||
local bTopHead = ( BD.DOWN_HEAD and ( vtN:getZ() > -0.342 or not bDownHead))
|
local bTopHead = ( BD.DOWN_HEAD and ( vtN:getZ() > -0.342 or not bDownHead))
|
||||||
-- recupero la lavorazione
|
-- recupero la lavorazione
|
||||||
local sCutType = EgtIf( Proc.Head, 'HeadSide', 'TailSide')
|
local sCutType = EgtIf( Proc.Head, 'HeadSide', 'TailSide')
|
||||||
local sCutting
|
local sCutting
|
||||||
sCutting, bDownHead = ML.FindCutting( sCutType, bTopHead, bDownHead)
|
local bH2
|
||||||
|
sCutting, bH2 = ML.FindCutting( sCutType, bTopHead, bDownHead)
|
||||||
|
bDownHead = bH2 and bDownHead
|
||||||
if not sCutting then
|
if not sCutting then
|
||||||
local sErr = 'Error : cutting not found in library'
|
local sErr = 'Error : cutting not found in library'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
|
local bNoDicing = false
|
||||||
-- se taglio con testa da sopra
|
-- se taglio con testa da sopra
|
||||||
if not bDownHead and not bDownTurn then
|
if not bDownHead and not bDownTurn then
|
||||||
local bOk, sErr = 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)
|
||||||
|
bNoDicing = bNoDicing2
|
||||||
if not bOk then return false, sErr end
|
if not bOk then return false, sErr end
|
||||||
-- altrimenti taglio con testa da sotto
|
-- altrimenti taglio con testa da sotto
|
||||||
else
|
else
|
||||||
@@ -746,7 +838,8 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom,
|
|||||||
if not bOk then return false, sErr end
|
if not bOk then return false, sErr end
|
||||||
end
|
end
|
||||||
-- Aggiornamento ingombro (se vero taglio o richiesto)
|
-- Aggiornamento ingombro (se vero taglio o richiesto)
|
||||||
if ProcessCut.Identify( Proc) or bUpdateIng then
|
-- Se lascio il cordolo (bNoDicing) non aggiorno il grezzo perchè lo scarto rimane attaccato
|
||||||
|
if ( ProcessCut.Identify( Proc) or bUpdateIng) and not bNoDicing then
|
||||||
UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
|
UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
-- ProcessDoubleCut.lua by Egaltech s.r.l. 2022/07/11
|
-- ProcessDoubleCut.lua by Egaltech s.r.l. 2023/03/22
|
||||||
-- Gestione calcolo doppi tagli di lama per Travi
|
-- Gestione calcolo doppi tagli di lama per Travi
|
||||||
|
-- 2022/08/29 Implementata la fresatura dal lato per tagli problematici per PF1250.
|
||||||
|
-- 2023/03/22 Eliminata SetOpenSide locale, si usa quella di libreria.
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local ProcessDoubleCut = {}
|
local ProcessDoubleCut = {}
|
||||||
@@ -159,7 +161,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
EgtSetOperationMode( nMchId, false)
|
EgtSetOperationMode( nMch1Id, false)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
-- Inserisco la lavorazione del lato opposto
|
-- Inserisco la lavorazione del lato opposto
|
||||||
@@ -182,12 +184,266 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
EgtSetOperationMode( nMchId, false)
|
EgtSetOperationMode( nMch2Id, false)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
local function VerifyPocket( Proc, dDiam, dDepth, dMaxTotLen, sMchFindMaster, bPocketDown)
|
||||||
|
-- tipo di svuotatura
|
||||||
|
local sMchFind = EgtIf( sMchFindMaster and #sMchFindMaster > 0, sMchFindMaster, 'Pocket')
|
||||||
|
-- ricerca della svuotatura
|
||||||
|
local sPocketing
|
||||||
|
if dDepth then
|
||||||
|
sPocketing = ML.FindPocketing( sMchFind, dDiam, dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or
|
||||||
|
ML.FindPocketing( sMchFind, dDiam, 0.8 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or
|
||||||
|
ML.FindPocketing( sMchFind, dDiam, 0.6 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or
|
||||||
|
ML.FindPocketing( sMchFind, dDiam, 0.4 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or
|
||||||
|
ML.FindPocketing( sMchFind, dDiam, 0, dMaxTotLen)
|
||||||
|
else
|
||||||
|
sPocketing = ML.FindPocketing( sMchFind, dDiam, 0, dMaxTotLen)
|
||||||
|
end
|
||||||
|
if not sPocketing then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
-- recupero i dati dell'utensile
|
||||||
|
local bUsePocketing = false
|
||||||
|
local dMaxDepth = 0
|
||||||
|
local dToolDiam = 0
|
||||||
|
if EgtMdbSetCurrMachining( sPocketing) then
|
||||||
|
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||||
|
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||||
|
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
|
||||||
|
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||||
|
end
|
||||||
|
bUsePocketing = true
|
||||||
|
end
|
||||||
|
return bUsePocketing, sPocketing, dMaxDepth, dToolDiam
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
local function MakeBySidePocket( Proc, nPhase, nRawId, nPartId, nAddGrpId, b3Solid)
|
||||||
|
local nFirstMachId
|
||||||
|
local sWarn
|
||||||
|
local sMchFind = 'OpenPocket'
|
||||||
|
local dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt
|
||||||
|
local bBadMach = false
|
||||||
|
-- ottengo le dimensioni del tunnel
|
||||||
|
dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = BL.GetTunnelDimension( Proc, nPartId)
|
||||||
|
-- posso utilizzare utensile con diametro doppio della dimensione minima
|
||||||
|
dDimMin = min( 2 * dDimMin, BD.MAXDIAM_POCK_CORNER)
|
||||||
|
local nPathInt
|
||||||
|
-- verifico se è presente la testa da sotto e se è necessario usarla
|
||||||
|
bMillDown = ( BD.DOWN_HEAD == true and abs( vtOrtho:getZ()) >= 0.707)
|
||||||
|
-- cerco l'utensile di svuotatura per la testa sopra
|
||||||
|
local bMakePocket, sPocketing, dMaxDepth, dDiamTool = VerifyPocket( Proc, dDimMin, dDepth / 2, nil, sMchFind)
|
||||||
|
local bMakePocketDn, sPocketingDn, dMaxDepthDn, dDiamToolDn
|
||||||
|
-- cerco anche l'utensile per la testa sotto, nel caso servisse
|
||||||
|
if bMillDown then
|
||||||
|
bMakePocketDn, sPocketingDn, dMaxDepthDn, dDiamToolDn = VerifyPocket( Proc, dDimMin, dDepth / 2, nil, sMchFind, true)
|
||||||
|
-- se è negativo inverto il versore e la faccia
|
||||||
|
if vtOrtho:getZ() < 0 then
|
||||||
|
vtOrtho = -vtOrtho
|
||||||
|
EgtInvertSurf( nSurfInt)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if bMakePocket then
|
||||||
|
-- gestione svuotatura da un solo lato o anche dal lato opposto (se non verticale)
|
||||||
|
-- estraggo il contorno dalla superfice per evitare i problemi con la svuotatura
|
||||||
|
-- e assegno l'estrusione
|
||||||
|
nPathInt = EgtExtractSurfTmLoops( nSurfInt, nAddGrpId)
|
||||||
|
EgtModifyCurveExtrusion( nPathInt, vtOrtho, GDB_RT.GLOB)
|
||||||
|
BL.SetOpenSide( nPathInt, b3Solid)
|
||||||
|
-- variabili per parametri lavorazione
|
||||||
|
local dMachDepth
|
||||||
|
local dElev = 0
|
||||||
|
local bDoubleSide
|
||||||
|
local bOneShot
|
||||||
|
local bComplete = true
|
||||||
|
-- imposto altezza aggiuntiva di elevazione
|
||||||
|
local dCollSic = BL.CalcCollisionSafety( vtOrtho)
|
||||||
|
-- se possibile svuotare completamente da una sola parte
|
||||||
|
if dMaxDepth > ( dDepth + BD.CUT_EXTRA + dCollSic) then
|
||||||
|
dMachDepth = ( dDepth / 2) + BD.CUT_EXTRA
|
||||||
|
dElev = dDepth + BD.CUT_EXTRA
|
||||||
|
bOneShot = true
|
||||||
|
else
|
||||||
|
-- se direzione verso la verticale setto max affondamento possibile ed
|
||||||
|
-- emetto messaggio di warning perché non lavorabile interamente
|
||||||
|
if abs( vtOrtho:getZ()) >= 0.707 and not BD.DOWN_HEAD then
|
||||||
|
dMachDepth = dMaxDepth - ( dDepth / 2) - dCollSic
|
||||||
|
dElev = dMaxDepth
|
||||||
|
sWarn = 'Warning : elevation bigger than max tool depth'
|
||||||
|
EgtOutLog( sWarn)
|
||||||
|
bComplete = false
|
||||||
|
-- altrimenti setto il flag per fare la svuotatura da due parti
|
||||||
|
else
|
||||||
|
-- se l'altezza utensile riesce a lavorare completamente da due parti
|
||||||
|
if dMaxDepth > ( dDepth / 2) + dCollSic + BD.CUT_EXTRA_MIN then
|
||||||
|
dMachDepth = BD.CUT_EXTRA_MIN
|
||||||
|
dElev = ( dDepth / 2) + BD.CUT_EXTRA_MIN
|
||||||
|
-- altrimenti non si riesce in due passate, limito la profondità e setto l'elevazione
|
||||||
|
else
|
||||||
|
dMachDepth = dMaxDepth - ( dDepth / 2) - dCollSic
|
||||||
|
dElev = dMaxDepth
|
||||||
|
-- se molto inclinato rispetto alla normale della faccia di riferimento, lavorazione non idonea per probabili collisioni
|
||||||
|
local vtRef = Y_AX()
|
||||||
|
if abs( vtOrtho:getX()) > abs( vtOrtho:getY()) and abs( vtOrtho:getX()) > abs( vtOrtho:getZ()) then
|
||||||
|
vtRef = X_AX()
|
||||||
|
elseif abs( vtOrtho:getZ()) > abs( vtOrtho:getX()) and abs( vtOrtho:getZ()) > abs( vtOrtho:getY()) then
|
||||||
|
vtRef = Z_AX()
|
||||||
|
end
|
||||||
|
if abs( vtOrtho * vtRef) < 0.5 then
|
||||||
|
bBadMach = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
bDoubleSide = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- inserisco la lavorazione di svuotatura
|
||||||
|
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||||
|
local nMchFId = EgtAddMachining( sName, sPocketing)
|
||||||
|
if not nMchFId then
|
||||||
|
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return -1, sErr
|
||||||
|
end
|
||||||
|
-- prendo l'id della prima lavorazione inserita
|
||||||
|
if not nFirstMachId then
|
||||||
|
nFirstMachId = nMchFId
|
||||||
|
end
|
||||||
|
-- aggiungo geometria
|
||||||
|
EgtSetMachiningGeometry( {{ nPathInt, -1}})
|
||||||
|
-- verifico se devo invertire direzione utensile (in caso di direzione verso la verticale)
|
||||||
|
local bInvertMach
|
||||||
|
if vtOrtho:getZ() < BD.NZ_MINA and abs(vtOrtho:getZ()) >= 0.707 and not BD.DOWN_HEAD then
|
||||||
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
|
bInvertMach = true
|
||||||
|
-- altrimenti se da fare in una sola volta e direzionato verso Y+ lo inverto per lavorarlo davanti
|
||||||
|
elseif not bDoubleSide and vtOrtho:getY() > GEO.EPS_SMALL and not ( -(vtOrtho:getZ()) < BD.NZ_MINA) then
|
||||||
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
|
bInvertMach = true
|
||||||
|
end
|
||||||
|
-- imposto posizione braccio porta testa
|
||||||
|
local nSCC = MCH_SCC.NONE
|
||||||
|
if not BD.C_SIMM then
|
||||||
|
if AreSameOrOppositeVectorApprox( vtOrtho, Z_AX()) then
|
||||||
|
nSCC = MCH_SCC.ADIR_YM
|
||||||
|
elseif abs( vtOrtho:getX()) < 0.1 then
|
||||||
|
nSCC = EgtIf( BL.IsPartFinalPhase( nPhase), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
|
||||||
|
elseif vtOrtho:getY() < GEO.EPS_SMALL then
|
||||||
|
nSCC = EgtIf( bInvertMach, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
||||||
|
else
|
||||||
|
nSCC = EgtIf( bInvertMach, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||||
|
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN)
|
||||||
|
-- inverto il percorso di lavorazione per lavorare sinistro
|
||||||
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
|
-- imposto affondamento
|
||||||
|
EgtSetMachiningParam( MCH_MP.DEPTH, dMachDepth)
|
||||||
|
-- imposto elevazione e dichiaro non si generano sfridi per VMill
|
||||||
|
local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';'
|
||||||
|
sNotes = sNotes .. 'VMRS=0;'
|
||||||
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
|
||||||
|
-- eseguo
|
||||||
|
if not ML.ApplyMachining( true, false) then
|
||||||
|
-- provo ad allargare leggermente la tasca
|
||||||
|
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
|
||||||
|
if not ML.ApplyMachining( true, false) then
|
||||||
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
|
EgtSetOperationMode( nMchFId, false)
|
||||||
|
return -1, sErr
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- se posso applicare la svuotatura sul lato opposto
|
||||||
|
if bDoubleSide then
|
||||||
|
-- se ho la lavorazione da sotto ricalcolo in base a questa lavorazione
|
||||||
|
if bMakePocketDn then
|
||||||
|
-- sPocketing = sPocketingDn
|
||||||
|
-- dMaxDepth = dMaxDepthDn
|
||||||
|
-- dDiamTool = dDiamToolDn
|
||||||
|
-- se l'altezza utensile riesce a lavorare completamente da due parti
|
||||||
|
if dMaxDepthDn > ( dDepth / 2) + dCollSic + BD.CUT_EXTRA_MIN then
|
||||||
|
dMachDepth = BD.CUT_EXTRA_MIN
|
||||||
|
dElev = ( dDepth / 2) + BD.CUT_EXTRA_MIN
|
||||||
|
-- altrimenti non si riesce in due passate, limito la profondità e setto l'elevazione
|
||||||
|
else
|
||||||
|
dMachDepth = dMaxDepthDn - ( dDepth / 2) - dCollSic
|
||||||
|
dElev = dMaxDepthDn
|
||||||
|
bComplete = false
|
||||||
|
sWarn = 'Warning : elevation bigger than max tool depth'
|
||||||
|
EgtOutLog( sWarn)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- se anche lavorando dal lato opposto non riesco a svuotare completamente la fessura
|
||||||
|
-- setto i parametri affondamento ed emetto warning
|
||||||
|
if dMaxDepth < ( dDepth / 2) + BD.CUT_EXTRA + dCollSic then
|
||||||
|
dMachDepth = dMaxDepth - (dDepth / 2) - dCollSic
|
||||||
|
dElev = dMaxDepth
|
||||||
|
bComplete = false
|
||||||
|
sWarn = 'Warning : elevation bigger than max tool depth'
|
||||||
|
EgtOutLog( sWarn)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- inserisco la lavorazione di svuotatura
|
||||||
|
local sName = 'PockOppo_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||||
|
local nMchFId = EgtAddMachining( sName, EgtIf( bMakePocketDn, sPocketingDn, sPocketing))
|
||||||
|
if not nMchFId then
|
||||||
|
local sErr = 'Error adding machining ' .. sName .. '-' .. EgtIf( bMakePocketDn, sPocketingDn, sPocketing)
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return -1, sErr
|
||||||
|
end
|
||||||
|
-- prendo l'id della prima lavorazione inserita
|
||||||
|
if not nFirstMachId then
|
||||||
|
nFirstMachId = nMchFId
|
||||||
|
end
|
||||||
|
-- aggiungo geometria
|
||||||
|
EgtSetMachiningGeometry( {{ nPathInt, -1}})
|
||||||
|
-- imposto direzione utensile opposta
|
||||||
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
|
-- imposto posizione braccio porta testa
|
||||||
|
local nSCC = MCH_SCC.NONE
|
||||||
|
if not BD.C_SIMM then
|
||||||
|
if AreSameVectorApprox( vtOrtho, Z_AX()) then
|
||||||
|
nSCC = MCH_SCC.ADIR_YM
|
||||||
|
elseif abs( vtOrtho:getX()) < 0.1 then
|
||||||
|
nSCC = EgtIf( BL.IsPartFinalPhase( nPhase), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
|
||||||
|
elseif vtOrtho:getY() < GEO.EPS_SMALL then
|
||||||
|
nSCC = MCH_SCC.ADIR_YP
|
||||||
|
else
|
||||||
|
nSCC = MCH_SCC.ADIR_YM
|
||||||
|
end
|
||||||
|
end
|
||||||
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||||
|
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN)
|
||||||
|
-- inverto il percorso di lavorazione per lavorare sinistro
|
||||||
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
|
-- imposo affondamento
|
||||||
|
EgtSetMachiningParam( MCH_MP.DEPTH, dMachDepth)
|
||||||
|
-- imposto elevazione e dichiaro non si generano sfridi per VMill
|
||||||
|
local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';'
|
||||||
|
sNotes = sNotes .. 'VMRS=0;'
|
||||||
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
|
||||||
|
-- eseguo
|
||||||
|
if not ML.ApplyMachining( true, false) then
|
||||||
|
-- provo ad allargare leggermente la tasca
|
||||||
|
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
|
||||||
|
if not ML.ApplyMachining( true, false) then
|
||||||
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
|
EgtSetOperationMode( nMchFId, false)
|
||||||
|
return -1, sErr
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return 1, sWarn, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot, bMillDown, nFirstMachId
|
||||||
|
end
|
||||||
|
return 0, sWarn, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot, bMillDown, nFirstMachId, bOrthoFaces
|
||||||
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
-- Applicazione della lavorazione
|
-- Applicazione della lavorazione
|
||||||
function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||||
@@ -273,6 +529,31 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
-- eseguo
|
-- eseguo
|
||||||
local sCutType = EgtIf( bHead, 'HeadSide', 'TailSide')
|
local sCutType = EgtIf( bHead, 'HeadSide', 'TailSide')
|
||||||
local bDownHead = ( BD.DOWN_HEAD and vtNm:getZ() < BD.NZ_MINB)
|
local bDownHead = ( BD.DOWN_HEAD and vtNm:getZ() < BD.NZ_MINB)
|
||||||
|
-- per tutte le macchine tranne la Fast, controllo se ci sono tagli troppo inclinati e troppo profondi per la lama
|
||||||
|
-- in tal caso richiamo la lavorazione con fresa dal lato
|
||||||
|
if BD.C_SIMM and not bDownHead then
|
||||||
|
local sCutting = ML.FindCutting( sCutType, nil, bDownHead)
|
||||||
|
if not sCutting then
|
||||||
|
local sErr = 'Error : cutting not found in library'
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
local dMaxDepth = 0
|
||||||
|
if EgtMdbSetCurrMachining( sCutting) then
|
||||||
|
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||||
|
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||||
|
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local _, _, dDimV1 = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
|
||||||
|
local _, _, dDimV2 = BL.GetFaceHvRefDim( Proc.Id, 1, b3Raw)
|
||||||
|
local bFace1TooLongForBlade, bFace2TooLongForBlade = ( dDimV1 >= dMaxDepth), ( dDimV2 >= dMaxDepth)
|
||||||
|
local dFace1Ang, dFace2Ang = vtN[1]:getZ(), vtN[2]:getZ()
|
||||||
|
if bFace1TooLongForBlade and dFace1Ang < ( BD.CUT_VZ_MIN or -0.484) or bFace2TooLongForBlade and dFace2Ang < ( BD.CUT_VZ_MIN or -0.484) then
|
||||||
|
local bOk, sErr = MakeBySidePocket( Proc, nPhase, nRawId, nPartId, nAddGrpId, b3Solid)
|
||||||
|
return bOk, sErr
|
||||||
|
end
|
||||||
|
end
|
||||||
local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType, false, bDownHead)
|
local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType, false, bDownHead)
|
||||||
if not bOk then return bOk, sErr end
|
if not bOk then return bOk, sErr end
|
||||||
-- segnalazione ingombro di testa o coda
|
-- segnalazione ingombro di testa o coda
|
||||||
|
|||||||
+58
-24
@@ -1,4 +1,4 @@
|
|||||||
-- ProcessDrill.lua by Egaltech s.r.l. 2022/08/18
|
-- ProcessDrill.lua by Egaltech s.r.l. 2023/05/11
|
||||||
-- Gestione calcolo forature per Travi
|
-- Gestione calcolo forature per Travi
|
||||||
-- 2021/04/14 DS Corretta gestione Invert con testa da sotto. Migliorato calcolo ingombro portautensile.
|
-- 2021/04/14 DS Corretta gestione Invert con testa da sotto. Migliorato calcolo ingombro portautensile.
|
||||||
-- 2021/05/03 DS Su macchina con testa da sotto aggiunta possibilità di fare fori verticali metà sopra e l'altra sotto.
|
-- 2021/05/03 DS Su macchina con testa da sotto aggiunta possibilità di fare fori verticali metà sopra e l'altra sotto.
|
||||||
@@ -13,6 +13,11 @@
|
|||||||
-- 2022/07/12 Aggiunto un valore minimo (10) per la distanza di sicurezza.
|
-- 2022/07/12 Aggiunto un valore minimo (10) per la distanza di sicurezza.
|
||||||
-- 2022/07/27 Aggiunta la gestione del tipo di foratura "AngleDrill" per fori molto inclinati
|
-- 2022/07/27 Aggiunta la gestione del tipo di foratura "AngleDrill" per fori molto inclinati
|
||||||
-- 2022/08/18 Aggiunta gestione macchine con testa da sotto e punta disabilitata.
|
-- 2022/08/18 Aggiunta gestione macchine con testa da sotto e punta disabilitata.
|
||||||
|
-- 2022/10/25 Nella funzione Split aggiunto il controllo che le facce di ingresso e uscita siano differenti (potrebbe succedere per fori molto corti). Modifica importatore in futuro.
|
||||||
|
-- 2022/11/23 Aggiunta la gestione dei fori con angolo < 30 gradi, per i quali si usa la testa della macchina per accorciare l'utile di lavoro.
|
||||||
|
-- 2022/12/28 Implementata gestione forature in doppio
|
||||||
|
-- 2023/05/11 Se lavorazione in doppio e precedente no oppure di tipo diverso, forzo risalita a Zmax.
|
||||||
|
-- 2023/07/28 Aggiunta gestione rinvio 90deg solo per forature da sotto esattamente verticali.
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local ProcessDrill = {}
|
local ProcessDrill = {}
|
||||||
@@ -118,7 +123,7 @@ function ProcessDrill.Split( Proc, b3Raw)
|
|||||||
local dDiam = 2 * EgtArcRadius( AuxId)
|
local dDiam = 2 * EgtArcRadius( AuxId)
|
||||||
local dLen = abs( EgtCurveThickness( AuxId))
|
local dLen = abs( EgtCurveThickness( AuxId))
|
||||||
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
||||||
local bOpen = ( Proc.Fce ~= 0)
|
local bOpen = ( Proc.Fce ~= 0) and ( Proc.Fce ~= Proc.Fcs)
|
||||||
-- recupero flag abilitazione split (0=auto,1=no)
|
-- recupero flag abilitazione split (0=auto,1=no)
|
||||||
local bTrySplit = ( EgtGetInfo( Proc.Id, 'Q02', 'i') ~= 1)
|
local bTrySplit = ( EgtGetInfo( Proc.Id, 'Q02', 'i') ~= 1)
|
||||||
if not bTrySplit then
|
if not bTrySplit then
|
||||||
@@ -152,6 +157,10 @@ function ProcessDrill.Classify( Proc, b3Raw)
|
|||||||
ptCen = ptCen + vtExtr * dLen
|
ptCen = ptCen + vtExtr * dLen
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
-- verifico se foro annegato nel pezzo e quindi non lavorabile
|
||||||
|
if Proc.Fcs == 0 and Proc.Fce == 0 then
|
||||||
|
return false, false, false
|
||||||
|
end
|
||||||
-- verifico se troppo inclinato e quindi non lavorabile
|
-- verifico se troppo inclinato e quindi non lavorabile
|
||||||
if not ( Proc.Fcs == 5 or Proc.Fcs == 6 or Proc.Fce == 5 or Proc.Fce == 6) and abs( vtExtr:getX()) > BD.DRILL_VX_MAX then
|
if not ( Proc.Fcs == 5 or Proc.Fcs == 6 or Proc.Fce == 5 or Proc.Fce == 6) and abs( vtExtr:getX()) > BD.DRILL_VX_MAX then
|
||||||
return false, false, false
|
return false, false, false
|
||||||
@@ -161,7 +170,12 @@ function ProcessDrill.Classify( Proc, b3Raw)
|
|||||||
-- verifico se il foro è sotto e quindi va spostato o sopra o sul fianco
|
-- verifico se il foro è sotto e quindi va spostato o sopra o sul fianco
|
||||||
if (( vtExtr:getZ() < BD.DRILL_VZ_MIN or bFaceDown) and ( not bOpen or Proc.Flg ~= 1)) then
|
if (( vtExtr:getZ() < BD.DRILL_VZ_MIN or bFaceDown) and ( not bOpen or Proc.Flg ~= 1)) then
|
||||||
if not bOpen then
|
if not bOpen then
|
||||||
return true, true, false
|
-- 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
|
||||||
|
return true, false, false
|
||||||
|
else
|
||||||
|
return true, true, false
|
||||||
|
end
|
||||||
else
|
else
|
||||||
return true, not ( BD.ROT90 or BD.DOWN_HEAD or BD.TURN), ( BD.ROT90 or BD.DOWN_HEAD or BD.TURN)
|
return true, not ( BD.ROT90 or BD.DOWN_HEAD or BD.TURN), ( BD.ROT90 or BD.DOWN_HEAD or BD.TURN)
|
||||||
end
|
end
|
||||||
@@ -233,19 +247,21 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
|||||||
end
|
end
|
||||||
local bOpen = ( Proc.Fcs ~= 0 and Proc.Fce ~= 0)
|
local bOpen = ( Proc.Fcs ~= 0 and Proc.Fce ~= 0)
|
||||||
-- verifico possibilità di foratura da sotto
|
-- verifico possibilità di foratura da sotto
|
||||||
local bDownDrill = ( BD.DOWN_HEAD and ML.FindDrilling( dDiam, nil, false, true))
|
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)
|
||||||
-- verifico che il foro non sia fattibile solo da sotto
|
-- verifico che il foro non sia fattibile solo da sotto
|
||||||
local bToInvert = ( vtExtr:getZ() < BD.DRILL_VZ_MIN and not bDownDrill)
|
local bToInvert = ( vtExtr:getZ() < BD.DRILL_VZ_MIN and not bDownDrill) and not bDrillAngTrasm
|
||||||
if bToInvert and ( not bOpen or Proc.Flg ~= 1) then
|
if bToInvert and ( not bOpen or Proc.Flg ~= 1) then
|
||||||
local sErr = 'Error : drilling from bottom impossible'
|
local sErr = 'Error : drilling from bottom impossible'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
-- se non già richiesta inversione e invertibile
|
-- se non già richiesta inversione e invertibile
|
||||||
if not bToInvert and Proc.Flg == 1 and ( -vtExtr:getZ() >= BD.DRILL_VZ_MIN or bDownDrill) then
|
if not bToInvert and Proc.Flg == 1 and -vtExtr:getZ() >= BD.DRILL_VZ_MIN then
|
||||||
-- se il foro è cieco o troppo inclinato all'inizio, lo inverto
|
-- se il foro è cieco o dalla faccia sotto o troppo inclinato all'inizio, lo inverto
|
||||||
local _, CosB, _ = GetHoleStartData( ptCen, vtExtr, b3Solid)
|
local nFac, CosB, _ = GetHoleStartData( ptCen, vtExtr, b3Solid)
|
||||||
if Proc.Fcs == 0 or ( CosB > BD.DRILL_VX_MAX and bOpen) then
|
if Proc.Fcs == 0 or (( nFac == 2 or CosB > BD.DRILL_VX_MAX) and bOpen) then
|
||||||
bToInvert = true
|
bToInvert = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -266,12 +282,18 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
|||||||
local nErrorCode = 0
|
local nErrorCode = 0
|
||||||
-- abilitazione foratura da sotto
|
-- abilitazione foratura da sotto
|
||||||
local bDrillDown = ( bDownDrill and ( Proc.Down or vtExtr:getZ() < -0.1 or vtExtr:getZ() < 0.259))
|
local bDrillDown = ( bDownDrill and ( Proc.Down or vtExtr:getZ() < -0.1 or vtExtr:getZ() < 0.259))
|
||||||
local bDrillUp = ( bDownDrill and vtExtr:getZ() > -0.5)
|
local bDrillUp = ( bDownDrill and vtExtr:getZ() > -0.421)
|
||||||
|
local bExcludeH2 = false
|
||||||
|
if Proc.Double and Proc.Double > 0 then
|
||||||
|
bMillUp = true
|
||||||
|
bDrillDown = false
|
||||||
|
bExcludeH2 = true
|
||||||
|
end
|
||||||
-- primo gruppo di controlli con lunghezza utensile pari a metà foro se passante
|
-- primo gruppo di controlli con lunghezza utensile pari a metà foro se passante
|
||||||
-- recupero la lavorazione
|
-- recupero la lavorazione
|
||||||
local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown)
|
local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm)
|
||||||
if not sDrilling and dCheckDepth then
|
if not sDrilling and dCheckDepth then
|
||||||
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown)
|
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm)
|
||||||
if sDrilling then dCheckDepth = nil end
|
if sDrilling then dCheckDepth = nil end
|
||||||
end
|
end
|
||||||
if not sDrilling then
|
if not sDrilling then
|
||||||
@@ -368,11 +390,15 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
|||||||
local nFac, CosB, vFaces = GetHoleStartData( ptCen, vtExtr, b3Solid)
|
local nFac, CosB, vFaces = GetHoleStartData( ptCen, vtExtr, b3Solid)
|
||||||
-- Calcolo acciorciamento affondamento utile per evitare collisione portautensile con faccia
|
-- Calcolo acciorciamento affondamento utile per evitare collisione portautensile con faccia
|
||||||
local TgA = CosB / sqrt( 1 - CosB * CosB)
|
local TgA = CosB / sqrt( 1 - CosB * CosB)
|
||||||
local dSubL = ( dDiamTh / 2 + ( Proc.Diam - dToolDiam) / 2 + 2) * TgA
|
local dSubL = ( dDiamTh / 2 + ( Proc.Diam - dToolDiam) / 2 + 4) * TgA
|
||||||
|
-- Per fori molto inclinati ( < 30 gradi) si usa la testa della macchina per l'accorciamento. Fast esclusa
|
||||||
|
if BD.C_SIMM and CosB > 0.866 then
|
||||||
|
dSubL = ( 190 / 2 + ( Proc.Diam - dToolDiam) / 2 + 4) * TgA - 116
|
||||||
|
end
|
||||||
local dMaxDepthOri = dMaxDepth
|
local dMaxDepthOri = dMaxDepth
|
||||||
dMaxDepth = min( dMaxDepth, dToolFreeLen - dSubL)
|
dMaxDepth = min( dMaxDepth, max( dToolFreeLen - dSubL, 0))
|
||||||
-- Verifico inclinazione foro nei limiti
|
-- Verifico inclinazione foro nei limiti
|
||||||
local bTryDrill = ( CosB < BD.DRILL_VX_MAX)
|
local bTryDrill = EgtIf( dMaxDepth > 0, ( CosB < BD.DRILL_VX_MAX), false)
|
||||||
if ( CosB > 0.8 * BD.DRILL_VX_MAX and CosB < BD.DRILL_VX_MAX_ANGLEDRILL) then
|
if ( CosB > 0.8 * BD.DRILL_VX_MAX and CosB < BD.DRILL_VX_MAX_ANGLEDRILL) then
|
||||||
-- cerco le forature speciali AngleDrill
|
-- cerco le forature speciali AngleDrill
|
||||||
local sDrilling3, sType3, dMaxDepth3 = ML.FindAngleDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown)
|
local sDrilling3, sType3, dMaxDepth3 = ML.FindAngleDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown)
|
||||||
@@ -387,7 +413,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
|||||||
local dMaxElev
|
local dMaxElev
|
||||||
local sMyWarn
|
local sMyWarn
|
||||||
-- se c'è un taglio precedente di testa o coda in cui il foro "entra" devo ricalcolare i dati della foratura
|
-- se c'è un taglio precedente di testa o coda in cui il foro "entra" devo ricalcolare i dati della foratura
|
||||||
if (( Proc.MachineAfterHeadCutId and vtExtr:getX() > 0) or ( Proc.MachineAfterTailCutId and vtExtr:getX() < 0)) then
|
if ( not Proc.Double or Proc.Double == 0) and(( Proc.MachineAfterHeadCutId and vtExtr:getX() > 0) or ( Proc.MachineAfterTailCutId and vtExtr:getX() < 0)) then
|
||||||
local bIntersectionOk, _, vDistance = EgtLineSurfTmInters( ptCen, -vtExtr, Proc.MachineAfterHeadCutId or Proc.MachineAfterTailCutId, GDB_RT.GLOB)
|
local bIntersectionOk, _, vDistance = EgtLineSurfTmInters( ptCen, -vtExtr, Proc.MachineAfterHeadCutId or Proc.MachineAfterTailCutId, GDB_RT.GLOB)
|
||||||
if bIntersectionOk then
|
if bIntersectionOk then
|
||||||
local dHoleToCutDistance = vDistance[1]
|
local dHoleToCutDistance = vDistance[1]
|
||||||
@@ -441,7 +467,9 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
|||||||
end
|
end
|
||||||
-- imposto posizione braccio porta testa
|
-- imposto posizione braccio porta testa
|
||||||
local nSCC = MCH_SCC.NONE
|
local nSCC = MCH_SCC.NONE
|
||||||
if not BD.C_SIMM and not BD.TURN then
|
if bDrillAngTrasm then
|
||||||
|
nSCC = MCH_SCC.ADIR_NEAR
|
||||||
|
elseif not BD.C_SIMM and not BD.TURN then
|
||||||
nSCC = MCH_SCC.ADIR_YM
|
nSCC = MCH_SCC.ADIR_YM
|
||||||
if AreSameVectorApprox( vtExtr, Z_AX()) then
|
if AreSameVectorApprox( vtExtr, Z_AX()) then
|
||||||
nSCC = MCH_SCC.ADIR_YM
|
nSCC = MCH_SCC.ADIR_YM
|
||||||
@@ -457,6 +485,11 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
|||||||
end
|
end
|
||||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||||
-- imposto affondamento
|
-- imposto affondamento
|
||||||
|
if Proc.Double and Proc.Double > 0 and dDepth > Proc.MachDepthDouble + 10 * GEO.EPS_SMALL then
|
||||||
|
sMyWarn = 'Warning in double head drilling : depth (' .. EgtNumToString( dDepth, 1) .. ') reduced to (' .. EgtNumToString( Proc.MachDepthDouble, 1) .. ') to match H2 max tool depth'
|
||||||
|
dDepth = Proc.MachDepthDouble
|
||||||
|
dMaxElev = Proc.MachDepthDouble
|
||||||
|
end
|
||||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||||
-- imposto il valore della distanza di sicurezza per l'attacco. Se il valore del db utensili è troppo basso lo alzo a 10.
|
-- imposto il valore della distanza di sicurezza per l'attacco. Se il valore del db utensili è troppo basso lo alzo a 10.
|
||||||
local dToolDbStartPos = EgtGetMachiningParam( MCH_MP.STARTPOS)
|
local dToolDbStartPos = EgtGetMachiningParam( MCH_MP.STARTPOS)
|
||||||
@@ -464,20 +497,21 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
|||||||
local dStartPos = max( dMinStartPos, dToolDbStartPos)
|
local dStartPos = max( dMinStartPos, dToolDbStartPos)
|
||||||
EgtSetMachiningParam( MCH_MP.STARTPOS, dStartPos)
|
EgtSetMachiningParam( MCH_MP.STARTPOS, dStartPos)
|
||||||
-- Note utente con dichiarazione nessuna generazione sfridi per Vmill
|
-- Note utente con dichiarazione nessuna generazione sfridi per Vmill
|
||||||
local sUserNotes = 'VMRS=0;'
|
local sUserNotes = EgtSetVal( 'VMRS', 0) .. ';'
|
||||||
-- aggiungo alle note massima elevazione (coincide con affondamento)
|
-- aggiungo alle note massima elevazione (coincide con affondamento)
|
||||||
if dMaxElev then
|
if dMaxElev then
|
||||||
sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( dMaxElev, 1) .. ';'
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dMaxElev, 1))
|
||||||
end
|
end
|
||||||
-- se foro passante, aggiungo questa qualifica alle note
|
-- se foro passante, aggiungo questa qualifica alle note
|
||||||
if ( sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill') and bOpen then
|
if ( sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill') and bOpen then
|
||||||
sUserNotes = sUserNotes .. 'Open=1;'
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'Open', 1)
|
||||||
end
|
end
|
||||||
-- se lavorazione in doppio
|
-- se lavorazione in doppio
|
||||||
if EgtExistsInfo( Proc.Id, 'MAIN') then
|
if Proc.Double and Proc.Double > 0 then
|
||||||
sUserNotes = sUserNotes .. 'Double;'
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double)
|
||||||
elseif EgtExistsInfo( Proc.Id, 'DOU') then
|
if Proc.Double ~= Proc.PrevDouble then
|
||||||
sUserNotes = sUserNotes .. 'Main;'
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'StartZmax', 2)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
||||||
-- eseguo
|
-- eseguo
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
-- ProcessDtMortise.lua by Egaltech s.r.l. 2022/08/18
|
-- ProcessDtMortise.lua by Egaltech s.r.l. 2023/05/11
|
||||||
-- Gestione calcolo mortase a coda di rondine per Travi
|
-- Gestione calcolo mortase a coda di rondine per Travi
|
||||||
-- 2021/04/08 Aggiunto controllo massimo materiale lavorabile dalla fresa.
|
-- 2021/04/08 Aggiunto controllo massimo materiale lavorabile dalla fresa.
|
||||||
-- 2021/04/08 Miglioria scelta lavorazione in presenza di testa da sotto.
|
-- 2021/04/08 Miglioria scelta lavorazione in presenza di testa da sotto.
|
||||||
@@ -7,6 +7,11 @@
|
|||||||
-- 2021/12/01 Se frontale aggiungo taglio con Grp e Proc di vero taglio (per aggiornare ingombro di testa /coda).
|
-- 2021/12/01 Se frontale aggiungo taglio con Grp e Proc di vero taglio (per aggiornare ingombro di testa /coda).
|
||||||
-- 2022/06/01 Modifiche per evitare di entrare nel legno con mortase parziali.
|
-- 2022/06/01 Modifiche per evitare di entrare nel legno con mortase parziali.
|
||||||
-- 2022/08/18 Migliorato calcolo dello step.
|
-- 2022/08/18 Migliorato calcolo dello step.
|
||||||
|
-- 2022/09/29 Aggiunto riconoscimento della sola feature laterale.
|
||||||
|
-- 2022/12/28 Aggiunta gestione lavorazione in doppio.
|
||||||
|
-- 2023/03/06 Aggiunta forzatura ingresso fuori dal grezzo con pocket.
|
||||||
|
-- 2023/03/28 Corretto calcolo larghezza mortasa quando più larga che lunga.
|
||||||
|
-- 2023/05/11 Se lavorazione in doppio e precedente no oppure di tipo diverso, forzo risalita a Zmax.
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local ProcessDtMortise = {}
|
local ProcessDtMortise = {}
|
||||||
@@ -33,6 +38,12 @@ function ProcessDtMortise.Identify( Proc)
|
|||||||
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 56))
|
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 56))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
-- Riconoscimento della sola feature laterale
|
||||||
|
function ProcessDtMortise.SideIdentify( Proc)
|
||||||
|
return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 55)
|
||||||
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
-- Riconoscimento della sola feature frontale
|
-- Riconoscimento della sola feature frontale
|
||||||
function ProcessDtMortise.FrontIdentify( Proc)
|
function ProcessDtMortise.FrontIdentify( Proc)
|
||||||
@@ -168,13 +179,17 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
-- determino l'altezza della mortasa (0=faccia di fondo)
|
-- ne determino l'asse
|
||||||
local rfDtMrt, dLenMrt, dWidthMrt = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0, GDB_RT.GLOB)
|
|
||||||
local b3DtMrt = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, rfDtMrt)
|
|
||||||
local dAltMort = b3DtMrt:getDimZ()
|
|
||||||
-- ne determino l'asse (valido se non pocket)
|
|
||||||
local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB)
|
local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB)
|
||||||
vtAx:normalize()
|
vtAx:normalize()
|
||||||
|
-- determino l'altezza della mortasa (0=faccia di fondo)
|
||||||
|
local rfDtMrt, dLenMrt, dWidthMrt = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0, GDB_RT.GLOB)
|
||||||
|
if abs( rfDtMrt:getVersY() * vtAx) > abs( rfDtMrt:getVersX() * vtAx) then
|
||||||
|
rfDtMrt:rotate( rfDtMrt:getOrigin(), rfDtMrt:getVersZ(), 90)
|
||||||
|
dLenMrt, dWidthMrt = dWidthMrt, dLenMrt
|
||||||
|
end
|
||||||
|
local b3DtMrt = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, rfDtMrt)
|
||||||
|
local dAltMort = b3DtMrt:getDimZ()
|
||||||
-- verifico se di tipo pocket
|
-- verifico se di tipo pocket
|
||||||
local bPocket = ( EgtGetInfo( Proc.Id, 'P05', 'i') == 1)
|
local bPocket = ( EgtGetInfo( Proc.Id, 'P05', 'i') == 1)
|
||||||
if bPocket then bMakeAntiSplitPath = false end
|
if bPocket then bMakeAntiSplitPath = false end
|
||||||
@@ -225,10 +240,17 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
elseif bMillAngTrasm then
|
elseif bMillAngTrasm then
|
||||||
sMchExt = '_AT'
|
sMchExt = '_AT'
|
||||||
end
|
end
|
||||||
|
local bExcludeH2 = false
|
||||||
|
if Proc.Double and Proc.Double > 0 then
|
||||||
|
bMillUp = true
|
||||||
|
bMillDown = false
|
||||||
|
bExcludeH2 = true
|
||||||
|
sMchExt = ''
|
||||||
|
end
|
||||||
-- recupero la lavorazione : prima ricerca per sola tipologia
|
-- recupero la lavorazione : prima ricerca per sola tipologia
|
||||||
local sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, nil, nil, bMillUp, bMillDown)
|
local sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, nil, nil, bMillUp, bMillDown, bExcludeH2)
|
||||||
if not sMilling and bMillUp then
|
if not sMilling and bMillUp then
|
||||||
sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown)
|
sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown, bExcludeH2)
|
||||||
end
|
end
|
||||||
if not sMilling then
|
if not sMilling then
|
||||||
local sErr = 'Milling not found in library : Error on DtMortise ' .. tostring( Proc.Id)
|
local sErr = 'Milling not found in library : Error on DtMortise ' .. tostring( Proc.Id)
|
||||||
@@ -236,9 +258,9 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
-- recupero la lavorazione : seconda ricerca con tipologia e diametro massimo
|
-- recupero la lavorazione : seconda ricerca con tipologia e diametro massimo
|
||||||
sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown)
|
sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown, bExcludeH2)
|
||||||
if not sMilling and bMillUp then
|
if not sMilling and bMillUp then
|
||||||
sMilling = ML.FindMilling( sMillType, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown)
|
sMilling = ML.FindMilling( sMillType, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown, bExcludeH2)
|
||||||
sMchExt = ''
|
sMchExt = ''
|
||||||
end
|
end
|
||||||
if not sMilling then
|
if not sMilling then
|
||||||
@@ -268,7 +290,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
-- se con tasca, la lavoro
|
-- se con tasca, la lavoro (mai in doppio)
|
||||||
if bPocket then
|
if bPocket then
|
||||||
-- recupero il contorno della tasca (seconda curva ausiliaria)
|
-- recupero il contorno della tasca (seconda curva ausiliaria)
|
||||||
local sVal = EgtGetInfo( Proc.Id, 'AUXID')
|
local sVal = EgtGetInfo( Proc.Id, 'AUXID')
|
||||||
@@ -329,6 +351,8 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
nSCC = EgtIf( vtAx:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
|
nSCC = EgtIf( vtAx:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
-- flag di mirror precedente aggiornabile localmente
|
||||||
|
local nMyPrevDouble = Proc.PrevDouble
|
||||||
-- se parametro interno abilitato e il percorso non è chiuso, aggiungo percorso e lavorazione antischeggia
|
-- se parametro interno abilitato e il percorso non è chiuso, aggiungo percorso e lavorazione antischeggia
|
||||||
if bMakeAntiSplitPath and not EgtCurveIsClosed( AuxId) then
|
if bMakeAntiSplitPath and not EgtCurveIsClosed( AuxId) then
|
||||||
-- recupero gruppo per geometria addizionale
|
-- recupero gruppo per geometria addizionale
|
||||||
@@ -407,6 +431,14 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
end
|
end
|
||||||
-- dichiaro non si generano sfridi per VMill
|
-- dichiaro non si generano sfridi per VMill
|
||||||
local sUserNotes = 'MaxElev='.. EgtNumToString( dAltMort, 1) .. '; VMRS=0;'
|
local sUserNotes = 'MaxElev='.. EgtNumToString( dAltMort, 1) .. '; VMRS=0;'
|
||||||
|
-- se lavorazione in doppio
|
||||||
|
if Proc.Double and Proc.Double > 0 then
|
||||||
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double)
|
||||||
|
if Proc.Double ~= nMyPrevDouble then
|
||||||
|
nMyPrevDouble = Proc.Double
|
||||||
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'StartZmax', 2)
|
||||||
|
end
|
||||||
|
end
|
||||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
@@ -482,8 +514,20 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
if nSCC then
|
if nSCC then
|
||||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||||
end
|
end
|
||||||
-- dichiaro non si generano sfridi per VMill
|
-- dichiaro massima elevazione e assenza sfridi per VMill
|
||||||
local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;'
|
local sUserNotes = EgtSetVal( 'MaxElev', EgtNumToString( dMaxMat - 0.1, 1)) .. ';' .. EgtSetVal( 'VMRS', 0) .. ';'
|
||||||
|
-- in presenza di pocket dichiaro che non sto entrando e uscendo nel grezzo
|
||||||
|
if bPocket then
|
||||||
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'OutRaw', 3)
|
||||||
|
end
|
||||||
|
-- se lavorazione in doppio
|
||||||
|
if Proc.Double and Proc.Double > 0 then
|
||||||
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double)
|
||||||
|
if Proc.Double ~= nMyPrevDouble then
|
||||||
|
nMyPrevDouble = Proc.Double
|
||||||
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'StartZmax', 2)
|
||||||
|
end
|
||||||
|
end
|
||||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
|
|||||||
+45
-57
@@ -1,7 +1,10 @@
|
|||||||
-- ProcessTenon.lua by Egaltech s.r.l. 2022/06/07
|
-- ProcessTenon.lua by Egaltech s.r.l. 2023/03/28
|
||||||
-- Gestione calcolo tenone a coda di rondine per Travi
|
-- Gestione calcolo tenone a coda di rondine per Travi
|
||||||
-- 2021/04/08 Aggiunto controllo massimo materiale lavorabile dalla fresa.
|
-- 2021/04/08 Aggiunto controllo massimo materiale lavorabile dalla fresa.
|
||||||
-- 2022/04/14 Aumentati un poco i limiti di orientamento verso il basso per FAST e PF.
|
-- 2022/04/14 Aumentati un poco i limiti di orientamento verso il basso per FAST e PF.
|
||||||
|
-- 2023/02/08 Aumentato il range per cui i tenoni vengono lavorati in sottosquadro.
|
||||||
|
-- 2023/03/27 Migliorate condizioni scelta pretaglio con lama o fresa; gestione unificata con ProcessTenon.
|
||||||
|
-- 2023/03/28 Corretta gestione faccia di base quando divisa in più parti per distanza massima da lavorare.
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local ProcessDtTenon = {}
|
local ProcessDtTenon = {}
|
||||||
@@ -9,6 +12,7 @@ local ProcessDtTenon = {}
|
|||||||
-- Include
|
-- Include
|
||||||
require( 'EgtBase')
|
require( 'EgtBase')
|
||||||
local BL = require( 'BeamLib')
|
local BL = require( 'BeamLib')
|
||||||
|
local Fbp = require( 'FaceByPocket')
|
||||||
local Cut = require( 'ProcessCut')
|
local Cut = require( 'ProcessCut')
|
||||||
|
|
||||||
EgtOutLog( ' ProcessTenon started', 1)
|
EgtOutLog( ' ProcessTenon started', 1)
|
||||||
@@ -38,14 +42,17 @@ local function VerifyOrientation( Proc, vtN, b3Raw)
|
|||||||
-- se tenone praticamente in asse, accetto fino a -30 deg
|
-- se tenone praticamente in asse, accetto fino a -30 deg
|
||||||
if abs( vtN:getY()) < 0.088 then
|
if abs( vtN:getY()) < 0.088 then
|
||||||
return ( vtN:getZ() >= -0.51)
|
return ( vtN:getZ() >= -0.51)
|
||||||
|
-- se macchina Fast, pezzo stretto e inclinazione laterale non eccessiva, accetto fino a -27deg
|
||||||
|
elseif ( not BD.C_SIMM) and abs( vtN:getY()) < 0.5 and b3Raw:getDimY() < 150.1 then
|
||||||
|
return ( vtN:getZ() >= -0.454)
|
||||||
-- altrimenti accetto fino a -21deg
|
-- altrimenti accetto fino a -21deg
|
||||||
else
|
else
|
||||||
return ( vtN:getZ() >= -0.359)
|
return ( vtN:getZ() >= -0.359)
|
||||||
end
|
end
|
||||||
-- se trave medio-bassa
|
-- se trave medio-bassa
|
||||||
elseif b3Raw:getDimZ() < 281 then
|
elseif b3Raw:getDimZ() < 281 then
|
||||||
-- se tenone praticamente in asse, accetto fino a -25 deg
|
-- se tenone praticamente in asse oppure pezzo stretto e inclinazione laterale non eccessiva, accetto fino a -25 deg
|
||||||
if abs( vtN:getY()) < 0.088 then
|
if abs( vtN:getY()) < 0.088 or ( abs( vtN:getY()) < 0.5 and b3Raw:getDimY() < 150.1) then
|
||||||
return ( vtN:getZ() >= -0.422)
|
return ( vtN:getZ() >= -0.422)
|
||||||
-- altrimenti, accetto fino a -15 deg
|
-- altrimenti, accetto fino a -15 deg
|
||||||
else
|
else
|
||||||
@@ -163,6 +170,9 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
-- ne determino l'asse
|
-- ne determino l'asse
|
||||||
local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB)
|
local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB)
|
||||||
vtAx:normalize()
|
vtAx:normalize()
|
||||||
|
-- abilitazione lavorazione da sotto
|
||||||
|
local bMillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259)
|
||||||
|
local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174)
|
||||||
-- se tenone inclinato o non esattamente alle estremità, necessario taglio di lama sulla testa
|
-- se tenone inclinato o non esattamente alle estremità, necessario taglio di lama sulla testa
|
||||||
if not AreSameOrOppositeVectorApprox( vtN, X_AX()) or
|
if not AreSameOrOppositeVectorApprox( vtN, X_AX()) or
|
||||||
( Proc.Box:getMax():getX() < b3Raw:getMax():getX() - dOvmHead - 100 * GEO.EPS_SMALL and
|
( Proc.Box:getMax():getX() < b3Raw:getMax():getX() - dOvmHead - 100 * GEO.EPS_SMALL and
|
||||||
@@ -179,44 +189,17 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
if AddId then
|
if AddId then
|
||||||
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
|
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
|
||||||
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
|
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
|
||||||
-- se pezzo piccolo, in coda e piano inclinato attorno a Z applico svuotatura
|
-- solo per macchine tipo PF e simili: se pezzo piccolo, in coda, piano inclinato attorno a Z e inclinato verso il basso applico svuotatura
|
||||||
if b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getX() < 0 and abs( vtExtr:getY()) > 0.173 then
|
if b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getX() < 0 and abs( vtExtr:getY()) > 0.173 and vtExtr:getZ() < -0.1 and BD.C_SIMM then
|
||||||
local sPocketing = ML.FindPocketing( 'OpenPocket')
|
-- recupero la lavorazione
|
||||||
local dMaxDepth = 100
|
local sPocketing = ML.FindPocketing( 'OpenPocket', nil, nil, nil, not bMillDown, bMillDown)
|
||||||
local dStep = 30
|
if not sPocketing then
|
||||||
local nSurfStep
|
local sErr = 'Error : pocketing '..sPockType..' not found in library'
|
||||||
-- acquisisco i dati necessari dall'utensile
|
EgtOutLog( sErr)
|
||||||
if EgtMdbSetCurrMachining( sPocketing) then
|
|
||||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
|
||||||
dStep = EgtMdbGetCurrMachiningParam( MCH_MP.STEP) or dStep
|
|
||||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
|
||||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- acquisisco elevazione
|
|
||||||
local dElev = BL.GetFaceElevation( AddId, 0, nPartId)
|
|
||||||
nSurfStep = ceil( dElev / dMaxDepth)
|
|
||||||
dSurfStep = dElev / nSurfStep
|
|
||||||
local bOk = true
|
|
||||||
local sErr
|
|
||||||
-- copio superfice al passo superfice e ci applico la lavorazione
|
|
||||||
for i = nSurfStep, 2, -1 do
|
|
||||||
local nAddIdTmp = EgtSurfTmPlaneInBBox( nAddGrpId, ptC+((dSurfStep*(i-1))*vtN), vtN, b3Solid, GDB_RT.GLOB)
|
|
||||||
if nAddIdTmp then
|
|
||||||
EgtSetName( nAddIdTmp, 'AddCut_' .. tostring( Proc.Id))
|
|
||||||
EgtSetInfo( nAddIdTmp, 'TASKID', Proc.TaskId)
|
|
||||||
-- aggiungo lavorazione
|
|
||||||
bOk, sErr = ApplyPocket( Proc, sPocketing, i, (dSurfStep + 0), nAddIdTmp, vtExtr)
|
|
||||||
if not bOk then
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if not bOk then
|
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
-- faccio ultima superfice
|
-- eseguo le svuotature necessarie
|
||||||
bOk, sErr = ApplyPocket( Proc, sPocketing, 1, EgtIf( nSurfStep > 1, ( dSurfStep + 0), 0), AddId, vtExtr)
|
local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid)
|
||||||
if not bOk then
|
if not bOk then
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
@@ -230,9 +213,6 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- abilitazione lavorazione da sotto
|
|
||||||
local bMillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259)
|
|
||||||
local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174)
|
|
||||||
-- recupero la lavorazione
|
-- recupero la lavorazione
|
||||||
local sMillType = 'DtTenon'
|
local sMillType = 'DtTenon'
|
||||||
local sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', ''), nil, nil, nil, nil, bMillUp, bMillDown)
|
local sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', ''), nil, nil, nil, nil, bMillUp, bMillDown)
|
||||||
@@ -261,22 +241,29 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
-- calcolo distanza massima della curva dal punto più lontano della base tenone Dt (facet 0)
|
-- calcolo distanza massima della curva dal punto più lontano della base tenone Dt (facet 0)
|
||||||
local dMaxDist = 0
|
local dMaxDist
|
||||||
local nLoopId, nLoopCnt = EgtExtractSurfTmFacetLoops( Proc.Id, 0, EgtGetParent( Proc.Id))
|
for i = 0, Proc.Fct - 1 do
|
||||||
if nLoopId then
|
local ptFC, vtFN = EgtSurfTmFacetCenter( Proc.Id, i, GDB_ID.ROOT)
|
||||||
local dUmin, dUmax = EgtCurveDomain( nLoopId)
|
if not AreSameVectorApprox( vtFN, vtN) or abs( ( ptFC - ptBC) * vtN) > 100 * GEO.EPS_SMALL then
|
||||||
for dU = dUmin, dUmax do
|
break
|
||||||
local ptP = EgtUP( nLoopId, dU, GDB_ID.ROOT)
|
end
|
||||||
local ptNear = EgtNP( AuxId, ptP, GDB_ID.ROOT)
|
local nLoopId, nLoopCnt = EgtExtractSurfTmFacetLoops( Proc.Id, i, EgtGetParent( Proc.Id))
|
||||||
local dDist = dist( ptP, ptNear)
|
if nLoopId then
|
||||||
if dDist > dMaxDist then
|
local dUmin, dUmax = EgtCurveDomain( nLoopId)
|
||||||
dMaxDist = dDist
|
for dU = dUmin, dUmax do
|
||||||
|
local ptP = EgtUP( nLoopId, dU, GDB_ID.ROOT)
|
||||||
|
local ptNear = EgtNP( AuxId, ptP, GDB_ID.ROOT)
|
||||||
|
local dDist = dist( ptP, ptNear)
|
||||||
|
if not dMaxDist or dDist > dMaxDist then
|
||||||
|
dMaxDist = dDist
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for j = 1, nLoopCnt do
|
||||||
|
EgtErase( nLoopId + j - 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for i = 1, nLoopCnt do
|
end
|
||||||
EgtErase( nLoopId + i - 1)
|
if not dMaxDist then
|
||||||
end
|
|
||||||
else
|
|
||||||
local b3DtAux = EgtGetBBoxRef( AuxId, GDB_BB.STANDARD, frDtTen)
|
local b3DtAux = EgtGetBBoxRef( AuxId, GDB_BB.STANDARD, frDtTen)
|
||||||
dMaxDist = 2 * ( b3DtTen:getRadius() - b3DtAux:getRadius())
|
dMaxDist = 2 * ( b3DtTen:getRadius() - b3DtAux:getRadius())
|
||||||
end
|
end
|
||||||
@@ -299,7 +286,8 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
-- sistemo i parametri
|
-- sistemo i parametri
|
||||||
local dOffs = ( i - 1) * dStep
|
local dOffs = ( i - 1) * dStep
|
||||||
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
|
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
|
||||||
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dDtTenH, 1) .. ';')
|
local sUserNotes = EgtSetVal( 'MaxElev', EgtNumToString( dDtTenH, 1)) .. ';'
|
||||||
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
||||||
-- sistemo il lato e la direzione di lavoro
|
-- sistemo il lato e la direzione di lavoro
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT))
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT))
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false))
|
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false))
|
||||||
|
|||||||
+133
-27
@@ -1,6 +1,14 @@
|
|||||||
-- ProcessFreeContour.lua by Egaltech s.r.l. 2021/10/07
|
-- ProcessFreeContour.lua by Egaltech s.r.l. 2023/03/03
|
||||||
-- Gestione calcolo profilo libero per Travi
|
-- Gestione calcolo profilo libero per Travi
|
||||||
-- 2022/08/23 Aggiunta la funzione MakeByMark per la gestione del caso P13=10
|
-- 2022/08/23 Aggiunta la funzione MakeByMark per la gestione del caso P13=10
|
||||||
|
-- 2022/09/21 In MakeByMill aggiunto messaggio per elevazione non raggiunta.
|
||||||
|
-- 2022/11/03 In MakeByMill migliorata gestione lavorazione con fresa su testa da sotto.
|
||||||
|
-- 2022/11/09 Aggiunta la gestione della chiamata della FreeContour da parte della SimpleScarf.
|
||||||
|
-- 2022/11/24 In MakeByMill aggiunta la lavorazione sopra/sotto nel caso di testa sotto
|
||||||
|
-- In MakeByMill se BeamData forza lettura codolo da Q questo viene sempre fatto indipendentemente dalle dimensioni della feature
|
||||||
|
-- 2023/03/03 Corretta MakeByMark ( non definiti b3Raw e b3Aux ).
|
||||||
|
-- 2023/06/21 In CalcSpecialAdd modificato l'angolo minimo da 5 a 15 deg.
|
||||||
|
-- 2023/07/28 In MakeByPocket aggiunta Q06 per specificare un eventuale offset radiale del contorno.
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local ProcessFreeContour = {}
|
local ProcessFreeContour = {}
|
||||||
@@ -20,6 +28,7 @@ local Q_DIM_STRIP = 'Q01' -- d
|
|||||||
local Q_DEPTH_CHAMFER = 'Q02' -- d
|
local Q_DEPTH_CHAMFER = 'Q02' -- d
|
||||||
local Q_OVERMAT_FOR_FINISH = 'Q03' -- d
|
local Q_OVERMAT_FOR_FINISH = 'Q03' -- d
|
||||||
local Q_ONLY_CHAMFER = 'Q00' -- i
|
local Q_ONLY_CHAMFER = 'Q00' -- i
|
||||||
|
local Q_RADIAL_OFFSET = 'Q06' -- d, valido solo per pocket
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
-- Riconoscimento della feature
|
-- Riconoscimento della feature
|
||||||
@@ -117,7 +126,7 @@ function ProcessFreeContour.Classify( Proc, b3Raw)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
local function VerifyChamfer( Proc, AuxId, nRawId, bMakeVertCham)
|
local function VerifyChamfer( Proc, AuxId, nRawId, bMakeVertCham, bDownHead)
|
||||||
local nChamfer = 0
|
local nChamfer = 0
|
||||||
-- ingombro del grezzo
|
-- ingombro del grezzo
|
||||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||||
@@ -157,7 +166,11 @@ local function VerifyChamfer( Proc, AuxId, nRawId, bMakeVertCham)
|
|||||||
-- recupero la lavorazione
|
-- recupero la lavorazione
|
||||||
local sMilling
|
local sMilling
|
||||||
if nChamfer > 0 then
|
if nChamfer > 0 then
|
||||||
sMilling = ML.FindMilling( 'Mark')
|
if bDownHead then
|
||||||
|
sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true)
|
||||||
|
else
|
||||||
|
sMilling = ML.FindMilling( 'Mark')
|
||||||
|
end
|
||||||
if not sMilling then
|
if not sMilling then
|
||||||
local sErr = 'Error : Mark not found in library'
|
local sErr = 'Error : Mark not found in library'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
@@ -196,8 +209,8 @@ local function CalcSpecialAdd( nCrv, bStartVsEnd, dToolDiam)
|
|||||||
-- tangenti prima e dopo il punto interno
|
-- tangenti prima e dopo il punto interno
|
||||||
local vtPrev = EgtUV( nCrv, nIn, -1)
|
local vtPrev = EgtUV( nCrv, nIn, -1)
|
||||||
local vtNext = EgtUV( nCrv, nIn, 1)
|
local vtNext = EgtUV( nCrv, nIn, 1)
|
||||||
-- se c'è perdita di tangenza (delta angolare oltre i 5 gradi)
|
-- se c'è perdita di tangenza (delta angolare oltre i 15 gradi)
|
||||||
if vtPrev * vtNext < 0.996 then
|
if vtPrev * vtNext < 0.966 then
|
||||||
-- lunghezza del tratto
|
-- lunghezza del tratto
|
||||||
local ptP0 = EgtUP( nCrv, nOut)
|
local ptP0 = EgtUP( nCrv, nOut)
|
||||||
local ptP1 = EgtUP( nCrv, nIn)
|
local ptP1 = EgtUP( nCrv, nIn)
|
||||||
@@ -234,7 +247,6 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
local dDepth = abs( EgtCurveThickness( AuxId))
|
local dDepth = abs( EgtCurveThickness( AuxId))
|
||||||
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
||||||
local b3Aux = EgtGetBBoxGlob( AuxId, GDB_BB.STANDARD)
|
local b3Aux = EgtGetBBoxGlob( AuxId, GDB_BB.STANDARD)
|
||||||
local bToolInv = ( vtExtr:getZ() < -0.1 and b3Aux:getDimZ() > b3Raw:getDimZ() - 5)
|
|
||||||
local bDown = ( b3Aux:getMin():getZ() < b3Raw:getMin():getZ() + 5)
|
local bDown = ( b3Aux:getMin():getZ() < b3Raw:getMin():getZ() + 5)
|
||||||
-- verifico se in testa o coda
|
-- verifico se in testa o coda
|
||||||
local bHead = Proc.Head
|
local bHead = Proc.Head
|
||||||
@@ -243,12 +255,14 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
-- recupero la lavorazione
|
-- recupero la lavorazione
|
||||||
local bTopHead = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.1)
|
local bTopHead = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.1)
|
||||||
local bDownHead = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1)
|
local bDownHead = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1)
|
||||||
local sMilling = ML.FindMilling( 'FreeContour', nil, nil, nil, nil, bTopHead, bDownHead)
|
local sMilling, _, _, bH2 = ML.FindMilling( 'FreeContour', nil, nil, nil, nil, bTopHead, bDownHead)
|
||||||
if not sMilling then
|
if not sMilling then
|
||||||
local sErr = 'Error : FreeContour not found in library'
|
local sErr = 'Error : FreeContour not found in library'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
|
bDownHead = ( bDownHead and bH2)
|
||||||
|
local bToolInv = ( not bDownHead and vtExtr:getZ() < -0.1 and b3Aux:getDimZ() > b3Raw:getDimZ() - 5)
|
||||||
-- recupero i dati dell'utensile
|
-- recupero i dati dell'utensile
|
||||||
local dToolDiam = 10
|
local dToolDiam = 10
|
||||||
local dMaxDepth = 0
|
local dMaxDepth = 0
|
||||||
@@ -297,24 +311,29 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
end
|
end
|
||||||
local dOriDepth = dDepth
|
local dOriDepth = dDepth
|
||||||
local nDouble = 1
|
local nDouble = 1
|
||||||
local bCanDouble = ( abs( vtExtr:getY()) > abs( vtExtr:getZ()) and bCross)
|
local bCanDouble = ( abs( vtExtr:getY()) > abs( vtExtr:getZ()) and bCross) or ( BD.DOWN_HEAD and bCross)
|
||||||
local dDimStrip = BD.DIM_STRIP
|
local dDimStrip = BD.DIM_STRIP
|
||||||
if dDimStrip < 0 then
|
if dDimStrip < 0 then
|
||||||
dDimStrip = EgtGetInfo( Proc.Id, Q_DIM_STRIP, 'd') or 0
|
dDimStrip = EgtGetInfo( Proc.Id, Q_DIM_STRIP, 'd') or 0
|
||||||
end
|
end
|
||||||
local bStripOnSide = false
|
local bStripOnSide = false
|
||||||
if bCross then
|
if bCross then
|
||||||
if dDimStrip > 10 * GEO.EPS_SMALL and ( nStep > 1 or ( bDown and b3Aux:getDimX() > 0.5 * b3Raw:getDimX())) then
|
-- se forzata da parametro Q il codolo è sempre attivo
|
||||||
|
if dDimStrip > 10 * GEO.EPS_SMALL and ( BD.DIM_STRIP < 0 or nStep > 1 or ( bDown and b3Aux:getDimX() > 0.5 * b3Raw:getDimX())) then
|
||||||
-- devo lasciare un codolo
|
-- devo lasciare un codolo
|
||||||
dDepth = dDepth - dDimStrip
|
local dExtraCham = EgtIf( nChamfer > 0, 2, 0)
|
||||||
|
dDepth = EgtIf( Proc.Prc == 70, dDepth - dDimStrip - dDepthCham - dExtraCham, dDepth - dDimStrip)
|
||||||
bStripOnSide = true
|
bStripOnSide = true
|
||||||
else
|
else
|
||||||
-- devo affondare un poco oltre
|
-- devo affondare un poco oltre
|
||||||
dDepth = dDepth + BD.CUT_EXTRA
|
dDepth = dDepth + BD.CUT_EXTRA
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local bIsDepthReduced = false
|
||||||
-- se parametro beamdata forza codolo in centro e lavorazione orizzontale e se larghezza trave è sufficientemente larga
|
-- se parametro beamdata forza codolo in centro e lavorazione orizzontale e se larghezza trave è sufficientemente larga
|
||||||
if BD.DIM_TO_CENTER_STRIP and BD.DIM_TO_CENTER_STRIP > 10 * GEO.EPS_SMALL and nStep > 1 and
|
-- se forzata da parametro Q il codolo è sempre attivo
|
||||||
|
local dDepthWork = dDepth
|
||||||
|
if BD.DIM_TO_CENTER_STRIP and BD.DIM_TO_CENTER_STRIP > 10 * GEO.EPS_SMALL and ( BD.DIM_STRIP < 0 or nStep > 1) and
|
||||||
bCanDouble and b3Raw:getDimY() > BD.DIM_TO_CENTER_STRIP - 0.1 then
|
bCanDouble and b3Raw:getDimY() > BD.DIM_TO_CENTER_STRIP - 0.1 then
|
||||||
nDouble = 2
|
nDouble = 2
|
||||||
dDepth = min( ( b3Raw:getDimY() - dDimStrip) * 0.5, dMaxDepth)
|
dDepth = min( ( b3Raw:getDimY() - dDimStrip) * 0.5, dMaxDepth)
|
||||||
@@ -323,12 +342,23 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
if dDepth > dMaxDepth then
|
if dDepth > dMaxDepth then
|
||||||
if bCanDouble then
|
if bCanDouble then
|
||||||
nDouble = 2
|
nDouble = 2
|
||||||
dDepth = min( 0.5 * dDepth, dMaxDepth)
|
dDepthWork = 0.5 * dDepth
|
||||||
|
dDepth = min( dDepthWork, dMaxDepth)
|
||||||
|
if dDepth < dDepthWork - 10 * GEO.EPS_SMALL then
|
||||||
|
bIsDepthReduced = true
|
||||||
|
end
|
||||||
else
|
else
|
||||||
dDepth = dMaxDepth
|
dDepth = dMaxDepth
|
||||||
|
bIsDepthReduced = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local sWarn = ''
|
||||||
|
-- se ho ridotto l'altezza emetto warning
|
||||||
|
if bIsDepthReduced then
|
||||||
|
sWarn = 'Warning in process ' .. tostring( Proc.Id) .. ' (Free Contour) : depth (' .. EgtNumToString( dDepthWork, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
|
||||||
|
EgtOutLog( sWarn)
|
||||||
|
end
|
||||||
-- se utensile orizzontale verso Y+, non in doppio e codolo da lasciare, devo invertire per lavorare sempre da Y-
|
-- se utensile orizzontale verso Y+, non in doppio e codolo da lasciare, devo invertire per lavorare sempre da Y-
|
||||||
if vtExtr:getY() > 0.707 and nDouble == 1 and bStripOnSide then
|
if vtExtr:getY() > 0.707 and nDouble == 1 and bStripOnSide then
|
||||||
bToolInv = true
|
bToolInv = true
|
||||||
@@ -339,14 +369,37 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
local dEndAddSpec = 0
|
local dEndAddSpec = 0
|
||||||
if Proc.Grp ~= 0 then dEndAddSpec = CalcSpecialAdd( AuxId, false, dToolDiam) end
|
if Proc.Grp ~= 0 then dEndAddSpec = CalcSpecialAdd( AuxId, false, dToolDiam) end
|
||||||
-- se devo inserire il chamfer
|
-- se devo inserire il chamfer
|
||||||
if nChamfer > 0 and Proc.Grp ~= 0 and dOriDepth > dDepthCham then
|
if nChamfer > 0 and Proc.Grp ~= 0 and dOriDepth > dDepthCham and Proc.Prc ~= 70 then
|
||||||
local bDoubleCham = false
|
local bDoubleCham = false
|
||||||
local dExtra = 2
|
local dExtra = 2
|
||||||
|
local sChamferDown, sChamferUp
|
||||||
|
if nDouble > 1 and bCanDouble then
|
||||||
|
if nSide == 0 then
|
||||||
|
if BD.DOWN_HEAD then
|
||||||
|
-- recupero la lavorazione
|
||||||
|
local nChamferDown
|
||||||
|
nChamferDown, _, sChamferDown = VerifyChamfer( Proc, AuxId, nRawId, true, true)
|
||||||
|
if nChamferDown < 0 then
|
||||||
|
sWarn = 'Warning : chamfer from bottom not found in library'
|
||||||
|
sChamferDown = nil
|
||||||
|
EgtOutLog( sWarn)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local nChamferUp
|
||||||
|
nChamferUp, _, sChamferUp = VerifyChamfer( Proc, AuxId, nRawId, true, false)
|
||||||
|
if nChamferUp < 0 then
|
||||||
|
sWarn = 'Warning : chamfer from bottom not found in library'
|
||||||
|
sChamferUp = nil
|
||||||
|
EgtOutLog( sWarn)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
-- eseguo
|
-- eseguo
|
||||||
for i = 1, nStep do
|
for i = 1, nStep do
|
||||||
-- inserisco la lavorazione
|
-- inserisco la lavorazione
|
||||||
local sNameCh = 'Cham_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
local sNameCh = 'Cham_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||||
local nMchId = EgtAddMachining( sNameCh, sChamfer)
|
local sChamferSide1 = EgtIf( bDownHead, sChamferDown, sChamfer)
|
||||||
|
local nMchId = EgtAddMachining( sNameCh, sChamferSide1)
|
||||||
if not nMchId then
|
if not nMchId then
|
||||||
local sErr = 'Error adding machining ' .. sNameCh .. '-' .. sChamfer
|
local sErr = 'Error adding machining ' .. sNameCh .. '-' .. sChamfer
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
@@ -355,15 +408,12 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
-- aggiungo geometria
|
-- aggiungo geometria
|
||||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||||
-- se lavorazione da sopra o da sotto
|
-- se lavorazione da sopra o da sotto
|
||||||
if nSide ~= 0 then
|
|
||||||
bDoubleCham = true
|
|
||||||
end
|
|
||||||
if Proc.Grp == 3 then
|
if Proc.Grp == 3 then
|
||||||
if not bToolInv then
|
if not bToolInv then
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
else
|
else
|
||||||
if vtExtr:getZ() < 0 then
|
if not bDownHead and vtExtr:getZ() < 0 then
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
@@ -378,7 +428,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
else
|
else
|
||||||
if vtExtr:getZ() < 0 then
|
if not bDownHead and vtExtr:getZ() < 0 then
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
@@ -387,6 +437,11 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if nSide == 0 then
|
||||||
|
bDoubleCham = EgtIf( sChamferDown and BD.DOWN_HEAD, true, false)
|
||||||
|
else
|
||||||
|
bDoubleCham = true
|
||||||
|
end
|
||||||
-- assegno affondamento e offset radiale
|
-- assegno affondamento e offset radiale
|
||||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepthCham + dExtra)
|
EgtSetMachiningParam( MCH_MP.DEPTH, dDepthCham + dExtra)
|
||||||
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
|
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
|
||||||
@@ -426,12 +481,19 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
EgtSetOperationMode( nMchId, false)
|
EgtSetOperationMode( nMchId, false)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
|
|
||||||
-- se lavorazione da due parti, aggiungo la seconda
|
-- se lavorazione da due parti, aggiungo la seconda
|
||||||
if bDoubleCham then
|
if bDoubleCham then
|
||||||
-- inserisco la lavorazione
|
-- inserisco la lavorazione
|
||||||
local sName = 'ChamB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
local sName = 'ChamB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||||
local nMchId = EgtAddMachining( sName, sChamfer)
|
local sChamferSide2
|
||||||
|
if EgtEndsWith( sChamferSide1, 'H2') then
|
||||||
|
sChamferSide2 = sChamferUp
|
||||||
|
elseif nSide == 0 then
|
||||||
|
sChamferSide2 = sChamferDown
|
||||||
|
else
|
||||||
|
sChamferSide2 = sChamfer
|
||||||
|
end
|
||||||
|
nMchId = EgtAddMachining( sName, sChamferSide2)
|
||||||
if not nMchId then
|
if not nMchId then
|
||||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sChamfer
|
local sErr = 'Error adding machining ' .. sName .. '-' .. sChamfer
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
@@ -492,6 +554,31 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
end
|
end
|
||||||
-- verifico se devo fare sgrossatura più finitura
|
-- verifico se devo fare sgrossatura più finitura
|
||||||
local dOffsetPar = EgtGetInfo( Proc.Id, Q_OVERMAT_FOR_FINISH, 'i') or 0
|
local dOffsetPar = EgtGetInfo( Proc.Id, Q_OVERMAT_FOR_FINISH, 'i') or 0
|
||||||
|
-- nel caso di lavorazioni sopra/sotto cerco lavorazioni specifiche
|
||||||
|
local sMillingDown, sMillingUp
|
||||||
|
if nDouble > 1 and bCanDouble then
|
||||||
|
if nSide == 0 then
|
||||||
|
if BD.DOWN_HEAD then
|
||||||
|
-- recupero la lavorazione
|
||||||
|
sMillingDown = ML.FindMilling( 'FreeContour_H2', nil, nil, nil, nil, false, true)
|
||||||
|
if not sMillingDown then
|
||||||
|
nDouble = 1
|
||||||
|
dDepth = min( dOriDepth, dMaxDepth)
|
||||||
|
sWarn = 'Warning in process ' .. tostring( Proc.Id) .. ' (Free Contour) : milling from bottom not found in library' .. '\n' ..
|
||||||
|
'; depth (' .. EgtNumToString( dOriDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
|
||||||
|
EgtOutLog( sWarn)
|
||||||
|
elseif sMillingDown and not bDownHead then
|
||||||
|
bToolInv = true
|
||||||
|
sMilling = sMillingDown
|
||||||
|
end
|
||||||
|
end
|
||||||
|
sMillingUp = ML.FindMilling( 'FreeContour', nil, nil, nil, nil, true, false)
|
||||||
|
if not sMillingUp then
|
||||||
|
sWarn = 'Warning : milling not found in library'
|
||||||
|
EgtOutLog( sWarn)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
-- eseguo
|
-- eseguo
|
||||||
for i = 1, nStep do
|
for i = 1, nStep do
|
||||||
for j = 1, nDouble do
|
for j = 1, nDouble do
|
||||||
@@ -516,7 +603,13 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
else
|
else
|
||||||
-- inserisco la lavorazione
|
-- inserisco la lavorazione
|
||||||
sName = 'Free_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
sName = 'Free_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||||
nMchId = EgtAddMachining( sName, sMilling)
|
if EgtEndsWith( sMilling, '_H2') then
|
||||||
|
nMchId = EgtAddMachining( sName, EgtIf( j == 2 and nSide == 0, sMillingUp, sMilling))
|
||||||
|
elseif sMillingDown then
|
||||||
|
nMchId = EgtAddMachining( sName, EgtIf( j == 2 and nSide == 0, sMillingDown, sMilling))
|
||||||
|
else
|
||||||
|
nMchId = EgtAddMachining( sName, sMilling)
|
||||||
|
end
|
||||||
if not nMchId then
|
if not nMchId then
|
||||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
@@ -552,9 +645,9 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
-- assegno lato di lavoro
|
-- assegno lato di lavoro
|
||||||
if Proc.Grp == 0 then
|
if Proc.Grp == 0 then
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.CENTER)
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.CENTER)
|
||||||
elseif ( Proc.Grp == 3 and not bToolInv) or ( Proc.Grp == 4 and bToolInv) then
|
elseif ( Proc.Grp == 3 and not bToolInv) or ( Proc.Grp == 4 and bToolInv) or ( Proc.Grp == 1 and bToolInv) or ( Proc.Grp == 2 and bToolInv) then
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||||
elseif ( Proc.Grp == 3 and bToolInv) or ( Proc.Grp == 4 and not bToolInv) then
|
elseif ( Proc.Grp == 3 and bToolInv) or ( Proc.Grp == 4 and not bToolInv) or ( Proc.Grp == 1 and not bToolInv) or ( Proc.Grp == 2 and not bToolInv) then
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
||||||
end
|
end
|
||||||
-- posizione braccio porta testa
|
-- posizione braccio porta testa
|
||||||
@@ -623,7 +716,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
BL.UpdateTCING( nRawId, dOffs)
|
BL.UpdateTCING( nRawId, dOffs)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return true
|
return true, sWarn
|
||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
@@ -682,6 +775,11 @@ local function MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||||
-- imposto elevazione
|
-- imposto elevazione
|
||||||
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxDepth, 1) .. ';')
|
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxDepth, 1) .. ';')
|
||||||
|
-- imposto eventuale offset radiale, se impostato dall'utente
|
||||||
|
local dRadialOffset = EgtGetInfo( Proc.Id, Q_RADIAL_OFFSET, 'd') or 0
|
||||||
|
if abs( dRadialOffset) > 10 * GEO.EPS_SMALL then
|
||||||
|
EgtSetMachiningParam( MCH_MP.OFFSR, -dRadialOffset)
|
||||||
|
end
|
||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
@@ -692,7 +790,9 @@ local function MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
local function MakeByMark( Proc, nRawId, b3Raw, nPartId)
|
local function MakeByMark( Proc, nRawId, nPartId)
|
||||||
|
-- ingombro del grezzo
|
||||||
|
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||||
-- ingombro del pezzo
|
-- ingombro del pezzo
|
||||||
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
|
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
|
||||||
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
|
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||||
@@ -712,6 +812,7 @@ local function MakeByMark( Proc, nRawId, b3Raw, nPartId)
|
|||||||
-- recupero i dati della curva e del profilo
|
-- recupero i dati della curva e del profilo
|
||||||
local dDepth = abs( EgtCurveThickness( AuxId))
|
local dDepth = abs( EgtCurveThickness( AuxId))
|
||||||
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
||||||
|
local b3Aux = EgtGetBBoxGlob( AuxId, GDB_BB.STANDARD)
|
||||||
local bToolInv = ( vtExtr:getZ() < -0.1 and b3Aux:getDimZ() > b3Raw:getDimZ() - 5)
|
local bToolInv = ( vtExtr:getZ() < -0.1 and b3Aux:getDimZ() > b3Raw:getDimZ() - 5)
|
||||||
-- verifico che la marcatura non sia orientata verso il basso (-5 deg)
|
-- verifico che la marcatura non sia orientata verso il basso (-5 deg)
|
||||||
if vtExtr:getZ() < - 0.1 and not BD.DOWN_HEAD and not BD.TURN then
|
if vtExtr:getZ() < - 0.1 and not BD.DOWN_HEAD and not BD.TURN then
|
||||||
@@ -764,6 +865,11 @@ end
|
|||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
-- Applicazione della lavorazione
|
-- Applicazione della lavorazione
|
||||||
function ProcessFreeContour.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
function ProcessFreeContour.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||||
|
-- riassegno Q nel caso la funzione sia richiamata da un'altra make
|
||||||
|
if Proc.Prc == 70 then
|
||||||
|
Q_DEPTH_CHAMFER = 'Q01'
|
||||||
|
Q_DIM_STRIP = 'Q02'
|
||||||
|
end
|
||||||
-- recupero la tipologia
|
-- recupero la tipologia
|
||||||
local bPocket = ( EgtGetInfo( Proc.Id, 'PCKT', 'i') == 1)
|
local bPocket = ( EgtGetInfo( Proc.Id, 'PCKT', 'i') == 1)
|
||||||
-- se svuotatura
|
-- se svuotatura
|
||||||
@@ -775,7 +881,7 @@ function ProcessFreeContour.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
local nCntType = EgtGetInfo( Proc.Id, 'CNT_TYPE', 'i') or 0
|
local nCntType = EgtGetInfo( Proc.Id, 'CNT_TYPE', 'i') or 0
|
||||||
-- se marcatura
|
-- se marcatura
|
||||||
if nCntType == 10 then
|
if nCntType == 10 then
|
||||||
return MakeByMark( Proc, nRawId, b3Raw, nPartId)
|
return MakeByMark( Proc, nRawId, nPartId)
|
||||||
-- se fresatura
|
-- se fresatura
|
||||||
else
|
else
|
||||||
return MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
return MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||||
|
|||||||
+76
-17
@@ -1,8 +1,13 @@
|
|||||||
-- ProcessSplit.lua by Egaltech s.r.l. 2022/08/18
|
-- ProcessSplit.lua by Egaltech s.r.l. 2022/09/26
|
||||||
-- Gestione calcolo tagli di testa per Travi
|
-- Gestione calcolo tagli di testa per Travi
|
||||||
-- 2022/05/31 Aggiunta gestione sezioni alte e larghe con taglio di tipo diceCut.
|
-- 2022/05/31 Aggiunta gestione sezioni alte e larghe con taglio di tipo diceCut.
|
||||||
-- 2022/06/10 Per sezioni alte e larghe aggiunta gestione finitura in base a sovramateriale e a parametro Q05 dell' eventuale lavorazione sostituita.
|
-- 2022/06/10 Per sezioni alte e larghe aggiunta gestione finitura in base a sovramateriale e a parametro Q05 dell' eventuale lavorazione sostituita.
|
||||||
-- 2022/08/18 Aggiunta gestione macchine con testa da sotto con lama da sotto disabilitata.
|
-- 2022/08/18 Aggiunta gestione macchine con testa da sotto con lama da sotto disabilitata.
|
||||||
|
-- 2022/09/08 Migliorato verso di lavorazione in caso di DoubleCut
|
||||||
|
-- 2022/11/02 Corretti accorciamenti per DoubleCut
|
||||||
|
-- 2022/11/10 Corrette finiture lama per BigSection con trave alta
|
||||||
|
-- 2023/04/20 Per travi alte aggiunti tagli orizzontali per ridurre le dimensioni degli scarti
|
||||||
|
-- 2023/08/02 Corretto calcolo allungamenti/accorciamenti pezzi alti per contemplare anche taglio singolo
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local ProcessHeadCut = {}
|
local ProcessHeadCut = {}
|
||||||
@@ -116,7 +121,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
EgtSetOperationMode( nMchId, false)
|
EgtSetOperationMode( nMch1Id, false)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
-- Inserisco la lavorazione del lato opposto
|
-- Inserisco la lavorazione del lato opposto
|
||||||
@@ -139,7 +144,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
EgtSetOperationMode( nMchId, false)
|
EgtSetOperationMode( nMch1Id, false)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
return true, nil
|
return true, nil
|
||||||
@@ -166,11 +171,13 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
|
|||||||
-- recupero i dati dell'utensile
|
-- recupero i dati dell'utensile
|
||||||
local dSawDiam = 400
|
local dSawDiam = 400
|
||||||
local dMaxDepth = 50
|
local dMaxDepth = 50
|
||||||
|
local dSawThick = 2
|
||||||
if EgtMdbSetCurrMachining( sCutting) then
|
if EgtMdbSetCurrMachining( sCutting) then
|
||||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||||
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
|
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
|
||||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||||
|
dSawThick = EgtTdbGetCurrToolParam(MCH_TP.THICK) or dSawThick
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
|
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
|
||||||
@@ -179,38 +186,54 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
|
|||||||
-- recupero i dati della eventuale seconda lama
|
-- recupero i dati della eventuale seconda lama
|
||||||
local dSawDiam2 = 0
|
local dSawDiam2 = 0
|
||||||
local dMaxDepth2 = 0
|
local dMaxDepth2 = 0
|
||||||
|
local dSawThick2 = 0
|
||||||
if sCutting2 and EgtMdbSetCurrMachining( sCutting2) then
|
if sCutting2 and EgtMdbSetCurrMachining( sCutting2) then
|
||||||
local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
|
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
|
||||||
dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2
|
dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2
|
||||||
dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
|
dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
|
||||||
|
dSawThick2 = EgtTdbGetCurrToolParam(MCH_TP.THICK) or dSawThick2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- caratteristiche taglio
|
-- caratteristiche taglio
|
||||||
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM))
|
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM))
|
||||||
local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and
|
local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and
|
||||||
( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dMaxDepth2) - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
|
( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dMaxDepth2) - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
|
||||||
local bHorizCut = ( not bBigSectionCut and ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA)
|
local 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 bBigSectionCut and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
|
local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
|
||||||
local bDoubleCut = ( not bBigSectionCut and not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
|
local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
|
||||||
-- dati geometrici del taglio
|
-- dati geometrici del taglio
|
||||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||||
-- se non obbligatorio e coincide con inizio grezzo, non va fatto
|
-- se non obbligatorio e coincide con inizio grezzo, non va fatto
|
||||||
if not bNeedHCut and AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Raw:getMax():getX()) < 10 * GEO.EPS_SMALL then
|
if not bNeedHCut and AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Raw:getMax():getX()) < 10 * GEO.EPS_SMALL then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
-- determino se più tagli con offset
|
-- determino se più tagli con offset
|
||||||
local nCuts = max( ceil( dOvmHead / ( BD.MAX_LEN_SCRAP_START or BD.MAX_LEN_SCRAP)), 1)
|
local nCuts = max( ceil( dOvmHead / (( BD.MAX_LEN_SCRAP_START or BD.MAX_LEN_SCRAP) + 0.5)), 1)
|
||||||
local dOffsL = dOvmHead / nCuts
|
local dOffsL = dOvmHead / nCuts
|
||||||
-- se taglio per sezioni alte e larghe
|
-- se taglio per sezioni alte e larghe
|
||||||
if bBigSectionCut then
|
if bBigSectionCut then
|
||||||
if dOvmHead > 0 then
|
if dOvmHead > 0 then
|
||||||
|
local nQ05 = EgtGetInfo( nOriId or GDB_ID.NULL, 'Q05', 'i') or 0
|
||||||
-- se finitura con lama
|
-- se finitura con lama
|
||||||
if not nOriId or EgtGetInfo( nOriId, 'Q05', 'i') == 1 or EgtGetInfo( nOriId, 'Q05', 'i') == 0 then
|
if nQ05 == 1 or nQ05 == 0 then
|
||||||
local bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, dCurrOvmT)
|
local dSawThickCheck = dSawThick
|
||||||
if not bOk then return bOk, sErr end
|
if dSawThick2 > 0 and bDoubleHorizCut then
|
||||||
|
dSawThickCheck = min( dSawThick, dSawThick2)
|
||||||
|
end
|
||||||
|
local dMaxElev = 0
|
||||||
|
if vtN:getX() > 0 then
|
||||||
|
dMaxElev = b3Raw:getMax():getX() - Proc.Box:getMin():getX()
|
||||||
|
else
|
||||||
|
dMaxElev = Proc.Box:getMax():getX() - b3Raw:getMin():getX()
|
||||||
|
end
|
||||||
|
-- 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)
|
||||||
|
return bOk, sErr
|
||||||
|
end
|
||||||
-- se finitura con truciolatore
|
-- se finitura con truciolatore
|
||||||
elseif EgtGetInfo( nOriId, 'Q05', 'i') == 2 then
|
elseif nQ05 == 2 then
|
||||||
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||||
if not b3Solid then
|
if not b3Solid then
|
||||||
local sErr = 'Error : part box not found'
|
local sErr = 'Error : part box not found'
|
||||||
@@ -224,11 +247,12 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
|
|||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
local bOk, sErr = Pocket.Make( Proc, Proc.Id, 0, sPocketing, nPartId, b3Solid)
|
local bOk, sErr = Pocket.Make( Proc, Proc.Id, 0, sPocketing, nPartId, b3Solid)
|
||||||
if not bOk then return bOk, sErr end
|
return bOk, sErr
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
-- se tagli standard
|
-- se tagli standard
|
||||||
elseif not bDoubleHorizCut then
|
if not bDoubleHorizCut then
|
||||||
-- flag di lavorazione faccia
|
-- flag di lavorazione faccia
|
||||||
local nOrthoOpposite = EgtIf( bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_FRONT)
|
local nOrthoOpposite = EgtIf( bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_FRONT)
|
||||||
-- calcolo extra taglio ed accorciamento
|
-- calcolo extra taglio ed accorciamento
|
||||||
@@ -240,18 +264,53 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
|
|||||||
else
|
else
|
||||||
dCutExtra = - ( b3Raw:getDimY() - dMaxDepth)
|
dCutExtra = - ( b3Raw:getDimY() - dMaxDepth)
|
||||||
local dSawRad = dSawDiam / 2
|
local dSawRad = dSawDiam / 2
|
||||||
local dKL = dSawRad - dMaxDepth + b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN
|
-- 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)
|
||||||
if BD.C_SIMM then
|
if BD.C_SIMM then
|
||||||
dAccEnd = sqrt( dSawRad * dSawRad - dKL * dKL)
|
dAccEnd = sqrt( dSawRad * dSawRad - dKL * dKL)
|
||||||
else
|
else
|
||||||
dAccStart = sqrt( dSawRad * dSawRad - dKL * dKL)
|
dAccStart = sqrt( dSawRad * dSawRad - dKL * dKL)
|
||||||
end
|
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)
|
||||||
|
if bAreHorizontalCutsNeeded then
|
||||||
|
local nHorizontalCuts = ceil( dimV / BD.MAX_DIM_DICE) - 1
|
||||||
|
local dHorizontalSliceHeight = dimV / ( nHorizontalCuts + 1)
|
||||||
|
for i = nCuts, 1, -1 do
|
||||||
|
local dCutXOffset = ( i - 1) * dOffsL
|
||||||
|
-- tagli orizzontali
|
||||||
|
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)
|
||||||
|
if not bOk then return bOk, sErr end
|
||||||
|
end
|
||||||
|
-- se necessario taglio verticale doppio, eseguo l'opposto
|
||||||
|
if bDoubleCut then
|
||||||
|
-- gli accorciamenti vanno invertiti per il taglio opposto
|
||||||
|
local dAccStartDoubleCut, dAccEndDoubleCut = dAccEnd, dAccStart
|
||||||
|
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_BACK, nil, dCutExtra, BD.CUT_SIC, dCutXOffset, dAccStartDoubleCut, dAccEndDoubleCut, '', b3Raw, true)
|
||||||
|
if not bOk then return false, sErr end
|
||||||
|
end
|
||||||
|
-- taglio verticale
|
||||||
|
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutXOffset, dAccStart, dAccEnd, '', b3Raw)
|
||||||
|
if not bOk then return bOk, sErr end
|
||||||
|
end
|
||||||
|
return true, sWarn
|
||||||
|
end
|
||||||
|
|
||||||
-- se necessari tagli in doppio, eseguo gli opposti
|
-- se necessari tagli in doppio, eseguo gli opposti
|
||||||
if bDoubleCut then
|
if bDoubleCut then
|
||||||
|
-- gli accorciamenti vanno invertiti per il taglio opposto
|
||||||
|
local dAccStartDoubleCut, dAccEndDoubleCut = dAccEnd, dAccStart
|
||||||
for i = nCuts, 1, -1 do
|
for i = nCuts, 1, -1 do
|
||||||
local dCutOffset = ( i - 1) * dOffsL
|
local dCutOffset = ( i - 1) * dOffsL
|
||||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_BACK, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, '', b3Raw)
|
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_BACK, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStartDoubleCut, dAccEndDoubleCut, '', b3Raw, true)
|
||||||
if not bOk then return false, sErr end
|
if not bOk then return false, sErr end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -272,7 +331,7 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
|
|||||||
-- verifico che le due lame riescano a lavorare la sezione
|
-- verifico che le due lame riescano a lavorare la sezione
|
||||||
local dDimZ = b3Raw:getDimZ()
|
local dDimZ = b3Raw:getDimZ()
|
||||||
local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ
|
local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ
|
||||||
if dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0 then
|
if ( dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0) and not bBigSectionCut then
|
||||||
local sErr = 'Error : section too big for head cut'
|
local sErr = 'Error : section too big for head cut'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
|
|||||||
+650
-565
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+563
-167
@@ -1,4 +1,4 @@
|
|||||||
-- ProcessLongCut.lua by Egaltech s.r.l. 2022/03/07
|
-- ProcessLongCut.lua by Egaltech s.r.l. 2023/08/01
|
||||||
-- Gestione calcolo taglio longitudinale per Travi
|
-- Gestione calcolo taglio longitudinale per Travi
|
||||||
-- 2021/02/03 Corretto FaceUse con fresa orizzontale su taglio orizzontale.
|
-- 2021/02/03 Corretto FaceUse con fresa orizzontale su taglio orizzontale.
|
||||||
-- 2021/05/18 Possibile taglio con lama anche di fianco su macchina con testa da sotto.
|
-- 2021/05/18 Possibile taglio con lama anche di fianco su macchina con testa da sotto.
|
||||||
@@ -11,6 +11,24 @@
|
|||||||
-- 2021/11/08 Se con lama e flag BD.USE_LONGCUT si lavora in direzione contraria allo standard.
|
-- 2021/11/08 Se con lama e flag BD.USE_LONGCUT si lavora in direzione contraria allo standard.
|
||||||
-- 2022/03/07 Razionalizzata gestione casi con fresa di fianco. Aggiunta gestione Long2Cut anche con testa sotto.
|
-- 2022/03/07 Razionalizzata gestione casi con fresa di fianco. Aggiunta gestione Long2Cut anche con testa sotto.
|
||||||
-- 2022/07/14 Aggiunta limitazione lavorazione a sinistra anche se il grezzo successivo non ha lavorazioni (finale barra) ma è abbastanza lungo da poter essere riutilizzato (BD.MinRaw).
|
-- 2022/07/14 Aggiunta limitazione lavorazione a sinistra anche se il grezzo successivo non ha lavorazioni (finale barra) ma è abbastanza lungo da poter essere riutilizzato (BD.MinRaw).
|
||||||
|
-- 2022/09/23 Modificato l'angolo per l'abilitazione della lama da sotto: ora interviene anche per facce verticali.
|
||||||
|
-- 2022/11/04 Aggiunto passaggio parametro bDownHead (Testa da Sotto) nelle chiamate a MakeSideFace.
|
||||||
|
-- 2022/11/28 Correzioni varie per attacco, pulizia spigoli, utilizzo H3.
|
||||||
|
-- 2022/11/30 Modifiche su SCC per TURN.
|
||||||
|
-- 2023/01/18 Aggiunta, se richiesta, una lavorazione ulteriore con sega a catena nei casi in cui la doppia lama non sia sufficiente.
|
||||||
|
-- 2023/01/26 Rimossa la pulitura della faccia laterale nel caso in cui la feature abbia almeno una faccia rivolta verso il basso.
|
||||||
|
-- 2023/01/27 In MakeSideFace il prolungamento di uscita è ora fissato a 10 mm.
|
||||||
|
-- 2023/01/27 In caso di lavorazione aggiuntiva con fresa a catena il taglio con lama da sotto viene effettuato a step.
|
||||||
|
-- 2023/02/15 Migliorato verso di avanzamento della lama.
|
||||||
|
-- 2023/02/21 Verso di avanzamento della lama migliorato anche con lama LC.
|
||||||
|
-- 2023/02/22 Nuova gestione del verso di avanzamento ottimale che contempla tutti i casi.
|
||||||
|
-- 2023/03/06 Correzione per i casi con lavorazione limitata.
|
||||||
|
-- 2023/03/15 Modifica alla lavorazione ulteriore con sega a catena per togliere il codolo e lasciare solo dei punti di supporto.
|
||||||
|
-- 2023/03/22 Correzione a SCC lama a seguito di modifiche alle direzioni dei tagli.
|
||||||
|
-- 2023/04/17 Gestione unificata SCC tramite funzione apposita GetSCC
|
||||||
|
-- 2023/05/03 Corretto SCC in caso di asse utensile allineato con Z.
|
||||||
|
-- 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.
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local ProcessLongCut = {}
|
local ProcessLongCut = {}
|
||||||
@@ -48,8 +66,149 @@ function ProcessLongCut.Classify( Proc)
|
|||||||
return true, false
|
return true, false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
-- Estrazione dell'UUID utensile di una lavorazione
|
||||||
|
function GetToolUUID( sMachining)
|
||||||
|
if EgtMdbSetCurrMachining( sMachining) then
|
||||||
|
local sToolUUID = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||||
|
return sToolUUID
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
-- Calcolo dei versori caratteristici della feature
|
||||||
|
function GetProcessSpecificVectors( Proc, nFacet, nFaceUse, bInvert, sMachining)
|
||||||
|
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacet, GDB_ID.ROOT)
|
||||||
|
local vtOrthO = BL.GetVersRef( nFaceUse)
|
||||||
|
local ptP1, ptPm, ptP2, vtV1, vtV2, dLen, dWidth = EgtSurfTmFacetOppositeSide( Proc.Id, nFacet, vtOrthO, GDB_ID.ROOT)
|
||||||
|
local vtTg = ptP2 - ptP1 ; vtTg:normalize()
|
||||||
|
local dAllStart = 0
|
||||||
|
local dAllEnd = 0
|
||||||
|
-- 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
|
||||||
|
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 dToolDiam = 400
|
||||||
|
if EgtMdbSetCurrMachining( sMachining) then
|
||||||
|
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||||
|
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||||
|
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local dLenMax = max( 0.5 * dToolDiam * 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
|
||||||
|
local dOrtho1 = abs( vtTg1 * vtOrthO)
|
||||||
|
local dOrtho2 = abs( vtTg2 * vtOrthO)
|
||||||
|
if dOrtho1 < dOrtho2 or ( abs( dOrtho1 - dOrtho2) < 0.1 and dDist1 > 4 * dDist2) then
|
||||||
|
if dDist1 > dLenMin or dDist1 > 0.5 * dDist2 then
|
||||||
|
ptP2 = Point3d( ptPm)
|
||||||
|
dAllEnd = - dDist2 - 10 * GEO.EPS_SMALL
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if dDist2 > dLenMin or dDist2 > 0.5 * dDist1 then
|
||||||
|
ptP1 = Point3d( ptPm)
|
||||||
|
dAllStart = - dDist1 - 10 * GEO.EPS_SMALL
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vtTg = ptP2 - ptP1 ; vtTg:normalize()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local bWsRight = ( bInvert)
|
||||||
|
-- Versore di riferimento
|
||||||
|
local vtRef = Vector3d( vtTg)
|
||||||
|
vtRef:rotate( vtN, 90)
|
||||||
|
-- Versore esterno
|
||||||
|
local vtOut = vtRef - vtRef * vtTg * vtTg ; vtOut:normalize()
|
||||||
|
-- Versore ausiliario (direzione braccio)
|
||||||
|
local vtAux = Vector3d( vtN:getX(), vtN:getY(), 0) ; vtAux:normalize()
|
||||||
|
vtAux:rotate( Z_AX(), EgtIf( bWsRight, 90, -90))
|
||||||
|
if vtAux:isSmall() then
|
||||||
|
vtAux = Vector3d( vtOut:getX(), vtOut:getY(), 0) ; vtAux:normalize()
|
||||||
|
else
|
||||||
|
if abs( vtAux * vtOut) < GEO.EPS_SMALL then
|
||||||
|
if abs( vtTg:getZ()) > 0.5 then
|
||||||
|
if vtAux * vtRef < 0 then
|
||||||
|
vtAux = - vtAux
|
||||||
|
end
|
||||||
|
elseif vtAux * vtTg > 0 then
|
||||||
|
vtAux = - vtAux
|
||||||
|
end
|
||||||
|
elseif vtAux * vtOut < 0 then
|
||||||
|
vtAux = - vtAux
|
||||||
|
end
|
||||||
|
end
|
||||||
|
EgtOutLog( 'vtN=' .. tostring( vtN) .. ' vtRef=' .. tostring( vtRef) .. ' vtOut=' .. tostring( vtOut) .. ' vtAux=' .. tostring( vtAux), 3)
|
||||||
|
return vtAux, vtRef, vtOut, vtTg
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
-- Calcolo posizione braccio
|
||||||
|
function ProcessLongCut.GetSCC( Proc, nFacet, sMachining, nFaceUse, bInvert, nCuttingStep, nC, bAreCuttingStepsTowardsHead, bIsTopBlade, bCustUseBlade)
|
||||||
|
local nSCC
|
||||||
|
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacet, GDB_ID.ROOT)
|
||||||
|
local sToolUUID = GetToolUUID( sMachining)
|
||||||
|
local bIsBlade
|
||||||
|
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sToolUUID) or '') then
|
||||||
|
bIsBlade = ( ( EgtTdbGetCurrToolParam( MCH_TP.TYPE) & MCH_TF.SAWBLADE) ~= 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- se Turn posiziono la testa per creare il minor ingombro possibile
|
||||||
|
if BD.TURN then
|
||||||
|
if nFaceUse == MCH_MILL_FU.ORTHO_DOWN or ( ( nFaceUse == MCH_MILL_FU.PARAL_FRONT or nFaceUse == MCH_MILL_FU.PARAL_BACK) and vtN:getZ() > -GEO.EPS_SMALL) then
|
||||||
|
nSCC = MCH_SCC.ADIR_ZP
|
||||||
|
elseif nFaceUse == MCH_MILL_FU.ORTHO_TOP or ( nFaceUse == MCH_MILL_FU.PARAL_FRONT or nFaceUse == MCH_MILL_FU.PARAL_BACK) then
|
||||||
|
nSCC = MCH_SCC.ADIR_ZM
|
||||||
|
elseif nFaceUse == MCH_MILL_FU.ORTHO_FRONT or ( ( nFaceUse == MCH_MILL_FU.PARAL_DOWN or nFaceUse == MCH_MILL_FU.PARAL_TOP) and vtN:getY() > -GEO.EPS_SMALL) then
|
||||||
|
nSCC = MCH_SCC.ADIR_YP
|
||||||
|
elseif nFaceUse == MCH_MILL_FU.ORTHO_BACK or ( nFaceUse == MCH_MILL_FU.PARAL_DOWN or nFaceUse == MCH_MILL_FU.PARAL_TOP) then
|
||||||
|
nSCC = MCH_SCC.ADIR_YM
|
||||||
|
end
|
||||||
|
-- se Fast e fresa con asse utensile diretto come Z posiziono l'aggregato in Ym per avere il minore ingombro possibile
|
||||||
|
elseif not BD.C_SIMM and not bIsBlade and AreSameVectorApprox( vtN, Z_AX()) then
|
||||||
|
nSCC = MCH_SCC.ADIR_YM
|
||||||
|
-- se Fast ( escluso caso speciale con taglio non passante e inclinato in X e escluso caso con lama esattamente diretta in Z) posiziono l'aggregato in X per ottimizzare il pinzaggio
|
||||||
|
elseif not BD.C_SIMM and ( not ( bCustUseBlade and abs(vtN:getX()) > 0.001) or not bIsBlade) and not ( bIsBlade and AreSameVectorApprox( vtN, Z_AX())) then
|
||||||
|
if bAreCuttingStepsTowardsHead then
|
||||||
|
nSCC = EgtIf( ( not ( nCuttingStep == 1 or nCuttingStep == nC - 1)), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
||||||
|
else
|
||||||
|
nSCC = EgtIf( ( not ( nCuttingStep == 1 or nCuttingStep == nC - 1)), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
|
||||||
|
end
|
||||||
|
-- per Fast ( caso speciale con taglio non passante e inclinato in X e caso lama diretta esattamente in Z)
|
||||||
|
elseif not BD.C_SIMM then
|
||||||
|
local vtAux = GetProcessSpecificVectors( Proc, nFacet, nFaceUse, bInvert, sMachining)
|
||||||
|
if bCustUseBlade then
|
||||||
|
nSCC = EgtIf( ( nFaceUse == MCH_MILL_FU.ORTHO_TOP or nFaceUse == MCH_MILL_FU.ORTHO_FRONT) and vtN:getY() > -GEO.EPS_SMALL, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
||||||
|
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
|
||||||
|
-- per PF o simili e lama con aggregato lo posiziono per stare il più lontano possibile dalla trave
|
||||||
|
elseif ( bIsBlade and bIsTopBlade) then
|
||||||
|
if abs( vtN:getX()) > 0.001 then
|
||||||
|
local vtAux = GetProcessSpecificVectors( Proc, nFacet, nFaceUse, bInvert, sMachining)
|
||||||
|
nSCC = EgtIf( ( vtAux:getY() > -GEO.EPS_SMALL), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
||||||
|
else
|
||||||
|
nSCC = MCH_SCC.ADIR_XP
|
||||||
|
end
|
||||||
|
-- per PF o simili e lama senza aggregato o fresa non do alcuna preferenza
|
||||||
|
else
|
||||||
|
nSCC = MCH_SCC.NONE
|
||||||
|
end
|
||||||
|
|
||||||
|
return nSCC
|
||||||
|
end
|
||||||
-----------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------
|
||||||
local function MakeSideFace( nId, nFac, nSide, sMilling, dToolDiam, bForcedLim, dDistToMachine, bUnderDir)
|
local function MakeSideFace( nId, nFac, nSide, sMilling, dToolDiam, bForcedLim, dDistToMachine, bUnderDir)
|
||||||
|
if ( not BD.DOWN_HEAD or not BD.TURN) and nSide == -1 then
|
||||||
|
EgtOutLog( 'LongCut : side face finishing skipped , down head required')
|
||||||
|
return true
|
||||||
|
end
|
||||||
-- inserisco la lavorazione
|
-- inserisco la lavorazione
|
||||||
local nM = 1
|
local nM = 1
|
||||||
local nP = 1
|
local nP = 1
|
||||||
@@ -97,8 +256,8 @@ local function MakeSideFace( nId, nFac, nSide, sMilling, dToolDiam, bForcedLim,
|
|||||||
-- attacco e uscita
|
-- attacco e uscita
|
||||||
EgtSetMachiningParam( MCH_MP.LIPERP, 0)
|
EgtSetMachiningParam( MCH_MP.LIPERP, 0)
|
||||||
EgtSetMachiningParam( MCH_MP.LITANG, dToolDiam / 2 + 30)
|
EgtSetMachiningParam( MCH_MP.LITANG, dToolDiam / 2 + 30)
|
||||||
EgtSetMachiningParam( MCH_MP.LOPERP, 0)
|
EgtSetMachiningParam( MCH_MP.LOPERP, 2)
|
||||||
EgtSetMachiningParam( MCH_MP.LOTANG, dToolDiam / 2 + 30)
|
EgtSetMachiningParam( MCH_MP.LOTANG, 10)
|
||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
@@ -333,6 +492,100 @@ local function MakeByPocketing( Proc, nPhase, nRawId, nPartId)
|
|||||||
return true, sWarn
|
return true, sWarn
|
||||||
end
|
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 dMaxMat = 0
|
||||||
|
local dSawCornerRad = 0
|
||||||
|
local dSawThick = 0
|
||||||
|
local dSawDiameter = 0
|
||||||
|
-- se non trova una lavorazione di sawing esco
|
||||||
|
if not sSawing then
|
||||||
|
local sErr = 'Error : Sawing not found in library'
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return false, sErr
|
||||||
|
else
|
||||||
|
if EgtMdbSetCurrMachining( sSawing) then
|
||||||
|
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||||
|
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||||
|
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
|
||||||
|
dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick
|
||||||
|
dSawCornerRad = EgtTdbGetCurrToolParam( MCH_TP.CORNRAD) or dSawCornerRad
|
||||||
|
dSawDiameter = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiameter
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- inserisco la lavorazione di sawing
|
||||||
|
local sName = 'Csaw_' .. ( EgtGetName( nSurfId) or tostring( nSurfId)) .. '_1'
|
||||||
|
local nMchFId = EgtAddMachining( sName, sSawing)
|
||||||
|
if not nMchFId then
|
||||||
|
local sErr = 'Error adding machining ' .. sName .. '-' .. sSawing
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
-- aggiungo geometria
|
||||||
|
EgtSetMachiningGeometry( {{ nSurfId, 0}})
|
||||||
|
-- imposto faceuse
|
||||||
|
local nFaceUse = MCH_MILL_FU.PARAL_DOWN
|
||||||
|
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
||||||
|
-- imposto angolo 3° asse rot
|
||||||
|
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1))
|
||||||
|
local vtN = EgtSurfTmFacetNormVersor( nSurfId, 0, GDB_ID.ROOT)
|
||||||
|
local vtOrtho = BL.GetVersRef( nFaceUse)
|
||||||
|
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1))
|
||||||
|
-- imposto eventuale sovramateriale
|
||||||
|
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
|
||||||
|
-- imposto tratti in cui la sega a catena non lavora per lasciare del materiale di supporto
|
||||||
|
local dSupportingWoodLength = 30
|
||||||
|
-- imposto allungamento percorso iniziale e finale
|
||||||
|
if bShortenStart then
|
||||||
|
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal - dSupportingWoodLength - dSawDiameter)
|
||||||
|
else
|
||||||
|
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
|
||||||
|
end
|
||||||
|
if bShortenEnd then
|
||||||
|
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal - dSupportingWoodLength - dSawDiameter)
|
||||||
|
else
|
||||||
|
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)
|
||||||
|
end
|
||||||
|
-- imposto il lato di lavorazione
|
||||||
|
local nWorkSide = MCH_MILL_WS.RIGHT
|
||||||
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, nWorkSide)
|
||||||
|
-- verifico se devo ridurre l'affondamento
|
||||||
|
if dMaxMat >= dDepth then
|
||||||
|
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||||
|
else
|
||||||
|
EgtSetMachiningParam( MCH_MP.DEPTH, dMaxMat)
|
||||||
|
sWarn = 'Warning : chainsaw elevation bigger than max tool depth'
|
||||||
|
EgtOutLog( sWarn)
|
||||||
|
end
|
||||||
|
-- eseguo
|
||||||
|
if not ML.ApplyMachining( true, false) then
|
||||||
|
if EgtGetOutstrokeInfo() then
|
||||||
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
|
EgtSetOperationMode( nMchFId, false)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
-- impostazione alternativa angolo 3° asse rot
|
||||||
|
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2))
|
||||||
|
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2))
|
||||||
|
if not ML.ApplyMachining( true, false) then
|
||||||
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
|
EgtSetOperationMode( nMchFId, false)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if EgtIsMachiningEmpty() then
|
||||||
|
_, sWarn = EgtGetMachMgrWarning( 0)
|
||||||
|
EgtSetOperationMode( nMchFId, false)
|
||||||
|
return false, sWarn
|
||||||
|
end
|
||||||
|
--end
|
||||||
|
return true, sWarn
|
||||||
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
-- Applicazione della lavorazione
|
-- Applicazione della lavorazione
|
||||||
function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCustForceUseBladeOnNCF)
|
function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCustForceUseBladeOnNCF)
|
||||||
@@ -376,10 +629,10 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
|||||||
local bTopStart = ( Proc.Box:getMax():getZ() > b3Solid:getMax():getZ() - 20)
|
local bTopStart = ( Proc.Box:getMax():getZ() > b3Solid:getMax():getZ() - 20)
|
||||||
-- Determino se parte da sotto
|
-- Determino se parte da sotto
|
||||||
local bBottomStart = ( Proc.Box:getMin():getZ() < b3Solid:getMin():getZ() + 20)
|
local bBottomStart = ( Proc.Box:getMin():getZ() < b3Solid:getMin():getZ() + 20)
|
||||||
-- determino se lavorazione da davanti o da dietro
|
-- Determino se lavorazione da davanti o da dietro
|
||||||
local bFront = ( vtN:getY() < 0)
|
local bFront = ( vtN:getY() < 0)
|
||||||
-- ottengo la distanza tra la fine del pezzo e il pezzo successivo
|
-- Ottengo la distanza tra la fine del pezzo e il pezzo successivo o grezzo utilizzabile e non ancora separato
|
||||||
local dDistToNextPiece = EgtGetInfo( nRawId, 'BDST', 'd') or BD.OVM_MID
|
local dDistToNextPiece = BL.GetDistanceToNextPart( nRawId, nPhase)
|
||||||
local bForcedLim
|
local bForcedLim
|
||||||
local sWarn
|
local sWarn
|
||||||
----------------------------------------------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -389,7 +642,13 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
|||||||
-- fino al punto più vicino della faccia terminale (prima l'arretramento era sempre del raggio utensile).
|
-- fino al punto più vicino della faccia terminale (prima l'arretramento era sempre del raggio utensile).
|
||||||
-- Questo viene fatto se Q07=1 o fresa da sotto
|
-- Questo viene fatto se Q07=1 o fresa da sotto
|
||||||
----------------------------------------------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------------------------------------------
|
||||||
local nUseBlade = EgtIf( bCustUseBlade, 1, EgtGetInfo( Proc.Id, 'Q05', 'i') or 0)
|
local nUseBlade = 0
|
||||||
|
if bCustUseBlade then
|
||||||
|
nUseBlade = 1
|
||||||
|
-- leggo il parametro Q05 solo se è una vera longcut L010
|
||||||
|
elseif ProcessLongCut.Identify( Proc) then
|
||||||
|
nUseBlade = EgtGetInfo( Proc.Id, 'Q05', 'i') or 0
|
||||||
|
end
|
||||||
local bForceUseBladeOnNotThruFace
|
local bForceUseBladeOnNotThruFace
|
||||||
if nCustForceUseBladeOnNCF then
|
if nCustForceUseBladeOnNCF then
|
||||||
bForceUseBladeOnNotThruFace = nCustForceUseBladeOnNCF > 2
|
bForceUseBladeOnNotThruFace = nCustForceUseBladeOnNCF > 2
|
||||||
@@ -436,8 +695,8 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
|||||||
if ( nSide == -1 or abs(nSide) == 2) and vtN:getZ() <= -0.5 then
|
if ( nSide == -1 or abs(nSide) == 2) and vtN:getZ() <= -0.5 then
|
||||||
bCanUseUnderBlade = true
|
bCanUseUnderBlade = true
|
||||||
end
|
end
|
||||||
-- se faccia da sotto o di lato ma con versore Z negativo abilito la lavorazione con lame mixate
|
-- se faccia da sotto o di lato ma con versore Z sotto l'orizzontale abilito la lavorazione con lame mixate (limite 3 deg verso alto)
|
||||||
if ( nSide == -1 or abs(nSide) == 2) and vtN:getZ() <= -0.0175 then
|
if ( nSide == -1 or abs(nSide) == 2) and vtN:getZ() <= 0.053 then
|
||||||
bCanUseUnderBlade = true
|
bCanUseUnderBlade = true
|
||||||
end
|
end
|
||||||
-- se faccia da sopra o di lato ma con versore Z negativo verifico che abbia un angolo compatibile (28deg) per non avere extracorsa
|
-- se faccia da sopra o di lato ma con versore Z negativo verifico che abbia un angolo compatibile (28deg) per non avere extracorsa
|
||||||
@@ -468,11 +727,12 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
|||||||
local dToolDiam = 0
|
local dToolDiam = 0
|
||||||
local dThick = 0
|
local dThick = 0
|
||||||
local dMaxDepth = 0
|
local dMaxDepth = 0
|
||||||
|
local dMaxVertDepth = 0
|
||||||
local sCuttingDn
|
local sCuttingDn
|
||||||
local dToolDiamDn = 0
|
local dToolDiamDn = 0
|
||||||
local dThickDn = 0
|
local dThickDn = 0
|
||||||
local dMaxDepthDn = 0
|
local dMaxDepthDn = 0
|
||||||
-- recupero la lavorazione
|
-- recupero eventuale lavorazione con lama su testa da sotto
|
||||||
if bCanUseUnderBlade then
|
if bCanUseUnderBlade then
|
||||||
sCuttingDn = ML.FindCutting( 'HeadSide_H2', false, true)
|
sCuttingDn = ML.FindCutting( 'HeadSide_H2', false, true)
|
||||||
if not sCuttingDn then
|
if not sCuttingDn then
|
||||||
@@ -490,6 +750,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
-- recupero eventuale lavorazione con lama
|
||||||
if bCanUseBlade then
|
if bCanUseBlade then
|
||||||
local sCutType = EgtIf( BD.USE_LONGCUT, 'LongCut', 'HeadSide')
|
local sCutType = EgtIf( BD.USE_LONGCUT, 'LongCut', 'HeadSide')
|
||||||
sCutting = ML.FindCutting( sCutType)
|
sCutting = ML.FindCutting( sCutType)
|
||||||
@@ -505,12 +766,12 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
|||||||
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
|
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
|
||||||
dThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dThick
|
dThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dThick
|
||||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||||
|
dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local nNextRawId = EgtGetNextRawPart( nRawId)
|
-- 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
|
||||||
-- se la fine (a sinistra) non è limitata e ho un pezzo successivo meno distante di metà raggio, oppure se grezzo finale della barra di lunghezza sufficiente, setto la fine come limitata
|
if (( bCanUseBlade or bCanUseUnderBlade) and ( dDistToNextPiece < dToolDiam/2 or dDistToNextPiece < dToolDiamDn/2)) and not bLimXmin then
|
||||||
if ((( bCanUseBlade or bCanUseUnderBlade) and ( dDistToNextPiece < dToolDiam/2 or dDistToNextPiece < dToolDiamDn/2)) or (nNextRawId and EgtGetPartInRawPartCount( nNextRawId) <= 0 and EgtGetRawPartBBox( nNextRawId):getDimX() >= BD.MinRaw)) and not bLimXmin then
|
|
||||||
if bForceUseBladeOnNotThruFace then
|
if bForceUseBladeOnNotThruFace then
|
||||||
bForcedLim = true
|
bForcedLim = true
|
||||||
bLimXmin = true
|
bLimXmin = true
|
||||||
@@ -638,8 +899,15 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
|||||||
nC = nCDn
|
nC = nCDn
|
||||||
dC = dCDn
|
dC = dCDn
|
||||||
end
|
end
|
||||||
|
|
||||||
local nFaceUse
|
-- nei casi in cui la doppia lama non sia sufficiente, se richiesto, attivo un'ulteriore lavorazione con sega a catena
|
||||||
|
-- solo per T010
|
||||||
|
local bFinishWithChainSaw = false
|
||||||
|
if ( Proc.Prc == 10 and not ProcessLongCut.Identify( Proc)) and bLarghAsFace and abs( nSide) == 2 and ( bCanUseBlade and bCanUseUnderBlade) and Proc.Fct == 1 then
|
||||||
|
bFinishWithChainSaw = EgtIf ( ( EgtGetInfo( Proc.Id, 'Q05', 'i') or 0) == 1, true, false)
|
||||||
|
end
|
||||||
|
|
||||||
|
local nFaceUse
|
||||||
local nFaceUse2
|
local nFaceUse2
|
||||||
-- se ho solo lama da sotto
|
-- se ho solo lama da sotto
|
||||||
if bCanUseUnderBlade and not bCanUseBlade then
|
if bCanUseUnderBlade and not bCanUseBlade then
|
||||||
@@ -653,14 +921,28 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
|||||||
end
|
end
|
||||||
-- si percorrono i lati alto e basso della faccia
|
-- si percorrono i lati alto e basso della faccia
|
||||||
-- calcolo quanto è l'affondamento del taglio
|
-- calcolo quanto è l'affondamento del taglio
|
||||||
local dOffset = ( dWidth + dDimStrip) / 2
|
local dMainMaxDepth = EgtIf( abs( vtN:getY()) < 1e-6, dMaxDepth, dMaxVertDepth)
|
||||||
|
local dOtherMaxDept = EgtIf( bCanUseUnderBlade, dMaxDepthDn, dMainMaxDepth)
|
||||||
|
local dCoeff = min( ( dWidth - dDimStrip) / ( dMainMaxDepth + dOtherMaxDept), 1)
|
||||||
|
local dOffsetTopBlade = dWidth - dCoeff * dMainMaxDepth
|
||||||
|
local dOffsetDownBlade = dWidth - dCoeff * dOtherMaxDept
|
||||||
|
local nStepDownBlade = 1
|
||||||
|
local dStepDownBlade = dOtherMaxDept
|
||||||
-- se lama da sotto verifico se la componente Y della profondità di taglio supera la capacità della lama
|
-- se lama da sotto verifico se la componente Y della profondità di taglio supera la capacità della lama
|
||||||
if ( nSide == -1 or abs(nSide) == 2) and bCanUseUnderBlade then
|
if ( nSide == -1 or abs(nSide) == 2) and bCanUseUnderBlade and ( dOffsetTopBlade - dDimStrip) > dOtherMaxDept then
|
||||||
if (( dWidth - dDimStrip) / 2) > dMaxDepthDn then
|
if bFinishWithChainSaw then
|
||||||
local sErr = 'Error : side depth is bigger than underneath blade cut depth'
|
local dHCutDownBlade = dWidth - dOffsetDownBlade
|
||||||
|
local dMaxStepDownBlade = 80
|
||||||
|
nStepDownBlade = ceil( dHCutDownBlade / dMaxStepDownBlade)
|
||||||
|
dStepDownBlade = dHCutDownBlade / nStepDownBlade
|
||||||
|
else
|
||||||
|
local dDelta = dWidth - dDimStrip - ( dMainMaxDepth + dOtherMaxDept)
|
||||||
|
local sErr = 'Error : side depth is bigger than total cut depth (Diff=' .. EgtNumToString( dDelta)..')'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
bFinishWithChainSaw = false
|
||||||
end
|
end
|
||||||
local nM = 0
|
local nM = 0
|
||||||
-- se abilitata la lavorazione di lama su faccia chiusa, aggiungo le eventuali lavorazioni di antischeggia
|
-- se abilitata la lavorazione di lama su faccia chiusa, aggiungo le eventuali lavorazioni di antischeggia
|
||||||
@@ -695,7 +977,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
|||||||
end
|
end
|
||||||
-- eventuale lavorazione della faccia limitante l'inizio
|
-- eventuale lavorazione della faccia limitante l'inizio
|
||||||
if not bStartFixed then
|
if not bStartFixed then
|
||||||
local vtIni = -X_AX()
|
local vtIni = -X_AX()
|
||||||
for j = 1, Proc.Fct - 1 do
|
for j = 1, Proc.Fct - 1 do
|
||||||
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, j, GDB_ID.ROOT)
|
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, j, GDB_ID.ROOT)
|
||||||
if vtIni * vtN > 0 and nCountMilHead < 2 then
|
if vtIni * vtN > 0 and nCountMilHead < 2 then
|
||||||
@@ -711,7 +993,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
|||||||
|
|
||||||
-- eventuale lavorazione della faccia limitante la fine
|
-- eventuale lavorazione della faccia limitante la fine
|
||||||
if not bEndFixed then
|
if not bEndFixed then
|
||||||
local vtFin = X_AX()
|
local vtFin = X_AX()
|
||||||
for j = 1, Proc.Fct - 1 do
|
for j = 1, Proc.Fct - 1 do
|
||||||
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, j, GDB_ID.ROOT)
|
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, j, GDB_ID.ROOT)
|
||||||
if vtFin * vtN > 0 and nCountMilHead < 2 then
|
if vtFin * vtN > 0 and nCountMilHead < 2 then
|
||||||
@@ -725,132 +1007,196 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- inserisco tagli di lama
|
-- inserisco tagli di lama
|
||||||
for i = 1, nC do
|
for i = 1, nC do
|
||||||
-- Posizione braccio portatesta
|
|
||||||
local nSCC = EgtIf( ( BD.C_SIMM or i == 1 or i == nC - 1), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
|
||||||
-- ciclo sulle passate
|
-- ciclo sulle passate
|
||||||
local dLioTang = 0
|
local dLioTang = 0
|
||||||
|
|
||||||
for k = 1, 2 do
|
for k = 1, 2 do
|
||||||
local dLioPerp = ( dWidth - dDimStrip) / 2 + BD.CUT_SIC ;
|
local nStep = 1
|
||||||
local bAddOpposite = true
|
if k == 2 then nStep = nStepDownBlade end
|
||||||
local dAddExtraPerp = 0
|
for Zstep = nStep, 1, -1 do
|
||||||
-- se faccia da sotto e angolo inferiore ai 12° o faccia di fianco e angolo inferiore a 15° (al di sotto di questo angolo
|
local dLioPerp = ( dWidth - dDimStrip) / 2 + BD.CUT_SIC
|
||||||
-- l'attacco lama si comporta in modo diverso) allora calcolo il valore perpendicolare con la funzione CalcLeadInOutPerpGeom
|
local bAddOpposite = true
|
||||||
if ( nSide == -1 and abs(vtN:getY()) >= 0.2079) or ( abs(nSide) == 2 and abs(vtN:getZ()) >= 0.2588) then
|
local dAddExtraPerp = 0
|
||||||
bAddOpposite = false
|
-- se faccia da sotto e angolo inferiore ai 12° o faccia di fianco e angolo inferiore a 15° (al di sotto di questo angolo
|
||||||
end
|
-- l'attacco lama si comporta in modo diverso) allora calcolo il valore perpendicolare con la funzione CalcLeadInOutPerpGeom
|
||||||
-- faccio in modo di calcolare il valore perpendicolare solo sulla faccia da sotto nel secondo passo o sulla faccia di fianco nel primo passo
|
if ( nSide == -1 and abs(vtN:getY()) >= 0.2079) or ( abs(nSide) == 2 and abs(vtN:getZ()) >= 0.2588) then
|
||||||
if nSide == 1 or ( nSide == -1 and k == 1) or ( abs(nSide) == 2 and k == 2) then
|
bAddOpposite = false
|
||||||
bAddOpposite = false
|
end
|
||||||
end
|
-- faccio in modo di calcolare il valore perpendicolare solo sulla faccia da sotto nel secondo passo o sulla faccia di fianco nel primo passo
|
||||||
if bAddOpposite then
|
if nSide == 1 or ( nSide == -1 and k == 1) or ( abs(nSide) == 2 and k == 2) then
|
||||||
-- controllo se devo aggiungere un extra all'attacco perpendicolare
|
bAddOpposite = false
|
||||||
if nSide == -1 then
|
end
|
||||||
if vtN:getY() > 0 then
|
if bAddOpposite then
|
||||||
dAddExtraPerp = Proc.Box:getMin():getY() - b3Solid:getMin():getY()
|
-- controllo se devo aggiungere un extra all'attacco perpendicolare
|
||||||
elseif vtN:getY() < 0 then
|
if nSide == -1 then
|
||||||
dAddExtraPerp = b3Solid:getMax():getY() - Proc.Box:getMax():getY()
|
if vtN:getY() > 0 then
|
||||||
|
dAddExtraPerp = Proc.Box:getMin():getY() - b3Solid:getMin():getY()
|
||||||
|
elseif vtN:getY() < 0 then
|
||||||
|
dAddExtraPerp = b3Solid:getMax():getY() - Proc.Box:getMax():getY()
|
||||||
|
end
|
||||||
|
elseif abs(nSide) == 2 then
|
||||||
|
dAddExtraPerp = Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()
|
||||||
end
|
end
|
||||||
elseif abs(nSide) == 2 then
|
dLioPerp = dLioPerp + dAddExtraPerp
|
||||||
dAddExtraPerp = Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()
|
|
||||||
end
|
end
|
||||||
dLioPerp = dLioPerp + dAddExtraPerp
|
-- inserisco le parti di lavorazione
|
||||||
end
|
nM = nM + 1
|
||||||
-- inserisco le parti di lavorazione
|
local sNameF
|
||||||
nM = nM + 1
|
local nMchFId
|
||||||
local sNameF
|
|
||||||
local nMchFId
|
|
||||||
|
|
||||||
if ( k == 1 and bCanUseBlade) or ( k == 2 and ( bCanUseBlade and not bCanUseUnderBlade)) then
|
if ( k == 1 and bCanUseBlade) or ( k == 2 and ( bCanUseBlade and not bCanUseUnderBlade)) then
|
||||||
sNameF = 'L2C_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM)
|
sNameF = 'L2C_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM)
|
||||||
nMchFId = EgtAddMachining( sNameF, sCutting)
|
nMchFId = EgtAddMachining( sNameF, sCutting)
|
||||||
if not nMchFId then
|
if not nMchFId then
|
||||||
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sCutting
|
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sCutting
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
|
end
|
||||||
|
-- setto le variabili delle distanze dagli estremi
|
||||||
|
dEndDist = dEndDistUp
|
||||||
|
dEndAccDist = dEndAccDistUp
|
||||||
|
dStartDist = dStartDistUp
|
||||||
|
dStartAccDist = dStartAccDistUp
|
||||||
|
elseif ( k == 2 and bCanUseUnderBlade) or ( k == 1 and ( bCanUseUnderBlade and not bCanUseBlade)) then
|
||||||
|
sNameF = 'L2CD_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM)
|
||||||
|
nMchFId = EgtAddMachining( sNameF, sCuttingDn)
|
||||||
|
if not nMchFId then
|
||||||
|
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sCuttingDn
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
-- setto le variabili delle distanze dagli estremi
|
||||||
|
dEndDist = dEndDistDn
|
||||||
|
dEndAccDist = dEndAccDistDn
|
||||||
|
dStartDist = dStartDistDn
|
||||||
|
dStartAccDist = dStartAccDistDn
|
||||||
end
|
end
|
||||||
-- setto le variabili delle distanze dagli estremi
|
-- aggiungo geometria
|
||||||
dEndDist = dEndDistUp
|
EgtSetMachiningGeometry( {{ Proc.Id, 0}})
|
||||||
dEndAccDist = dEndAccDistUp
|
|
||||||
dStartDist = dStartDistUp
|
-- settaggio di workside, uso faccia e eventuale inversione
|
||||||
dStartAccDist = dStartAccDistUp
|
-- limito opportunamente la lavorazione
|
||||||
elseif ( k == 2 and bCanUseUnderBlade) or ( k == 1 and ( bCanUseUnderBlade and not bCanUseBlade)) then
|
local dSalInner, dSalOuter = - dEndAccDist - ( i - 2) * dC, -dEndDist
|
||||||
sNameF = 'L2CD_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM)
|
local dEalInner, dEalOuter = - dStartAccDist - ( nC - i - 1) * dC, -dStartDist
|
||||||
nMchFId = EgtAddMachining( sNameF, sCuttingDn)
|
local dSal = EgtIf( i == 1, dSalOuter, dSalInner)
|
||||||
if not nMchFId then
|
local dEal = EgtIf( i == nC, dEalOuter, dEalInner)
|
||||||
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sCuttingDn
|
if ( bFront and k == 1) or ( not bFront and k == 2) then
|
||||||
EgtOutLog( sErr)
|
dSal, dEal = dEal, dSal
|
||||||
return false, sErr
|
|
||||||
end
|
end
|
||||||
-- setto le variabili delle distanze dagli estremi
|
|
||||||
dEndDist = dEndDistDn
|
-- verifico lama in uso e imposto uso faccia
|
||||||
dEndAccDist = dEndAccDistDn
|
local bIsTopBladeCurrent
|
||||||
dStartDist = dStartDistDn
|
local nFaceUseCurrent
|
||||||
dStartAccDist = dStartAccDistDn
|
if bCanUseBlade and bCanUseUnderBlade then
|
||||||
end
|
dSal, dEal = dEal, dSal
|
||||||
-- aggiungo geometria
|
if k == 1 then
|
||||||
EgtSetMachiningGeometry( {{ Proc.Id, 0}})
|
bIsTopBladeCurrent = true
|
||||||
-- limito opportunamente la lavorazione
|
nFaceUseCurrent = nFaceUse2
|
||||||
local dSal = EgtIf( i == nC, -dEndDist, - dEndAccDist - ( nC - i - 1) * dC)
|
else
|
||||||
local dEal = EgtIf( i == 1, -dStartDist, - dStartAccDist - ( i - 2) * dC)
|
bIsTopBladeCurrent = false
|
||||||
if ( not bFront and k == 1) or ( bFront and k == 2) then
|
nFaceUseCurrent = nFaceUse
|
||||||
dSal, dEal = dEal, dSal
|
end
|
||||||
end
|
elseif bCanUseUnderBlade then
|
||||||
|
if k == 1 then
|
||||||
if bCanUseBlade and bCanUseUnderBlade then
|
bIsTopBladeCurrent = false
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
nFaceUseCurrent = nFaceUse
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
else
|
||||||
dSal, dEal = dEal, dSal
|
bIsTopBladeCurrent = false
|
||||||
-- imposto uso della faccia
|
nFaceUseCurrent = nFaceUse2
|
||||||
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse2, nFaceUse))
|
end
|
||||||
elseif bCanUseBlade and BD.USE_LONGCUT then
|
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
|
||||||
dSal, dEal = dEal, dSal
|
|
||||||
-- imposto uso della faccia
|
|
||||||
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse2, nFaceUse))
|
|
||||||
elseif bCanUseUnderBlade then
|
|
||||||
if abs(nSide) ~= 2 then
|
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
|
||||||
end
|
|
||||||
-- imposto uso della faccia
|
|
||||||
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse, nFaceUse2))
|
|
||||||
else
|
|
||||||
-- imposto uso della faccia
|
|
||||||
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse, nFaceUse2))
|
|
||||||
end
|
|
||||||
|
|
||||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
|
|
||||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)
|
|
||||||
-- imposto offset radiale
|
|
||||||
EgtSetMachiningParam( MCH_MP.OFFSR, EgtIf( nSide == -1, -dOffset, dOffset))
|
|
||||||
-- imposto attacco/uscita
|
|
||||||
EgtSetMachiningParam( MCH_MP.LITANG, dLioTang)
|
|
||||||
EgtSetMachiningParam( MCH_MP.LIPERP, dLioPerp)
|
|
||||||
EgtSetMachiningParam( MCH_MP.LOTANG, dLioTang)
|
|
||||||
EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp)
|
|
||||||
-- se il flag uso lama custom abilitato (indica che questo script è lanciato dal ProcessCut)
|
|
||||||
-- controllo se componente X versore è maggiore di un valore limite cambio la direzione della forcella
|
|
||||||
if bCustUseBlade and abs(vtN:getX()) > 0.009 + 5 * GEO.EPS_SMALL then
|
|
||||||
if BD.USE_LONGCUT then
|
|
||||||
nSCC = EgtIf( ( bFront and k == 1) or ( not bFront and k == 2), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
|
||||||
else
|
else
|
||||||
nSCC = EgtIf( ( not bFront and k == 1) or ( bFront and k == 2), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
if k == 1 then
|
||||||
|
bIsTopBladeCurrent = true
|
||||||
|
nFaceUseCurrent = nFaceUse
|
||||||
|
else
|
||||||
|
bIsTopBladeCurrent = true
|
||||||
|
nFaceUseCurrent = nFaceUse2
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- recupero alcune informazioni utili dalla lavorazione attuale
|
||||||
|
local bIsCurrentBladeCCW
|
||||||
|
if bIsTopBladeCurrent then
|
||||||
|
EgtMdbSetCurrMachining( sCutting)
|
||||||
|
else
|
||||||
|
EgtMdbSetCurrMachining( sCuttingDn)
|
||||||
|
end
|
||||||
|
bIsCurrentBladeCCW = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0
|
||||||
|
|
||||||
|
-- imposto la direzione di lavoro per avere scarico del truciolo ottimale
|
||||||
|
local nWorkSide, bInvert
|
||||||
|
if not bIsTopBladeCurrent and abs( nSide) ~= 2 then
|
||||||
|
if bIsCurrentBladeCCW then
|
||||||
|
nWorkSide = MCH_MILL_WS.LEFT
|
||||||
|
bInvert = true
|
||||||
|
dSal, dEal = dEal, dSal
|
||||||
|
else
|
||||||
|
nWorkSide = MCH_MILL_WS.RIGHT
|
||||||
|
bInvert = false
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if bIsCurrentBladeCCW then
|
||||||
|
nWorkSide = MCH_MILL_WS.LEFT
|
||||||
|
bInvert = false
|
||||||
|
else
|
||||||
|
nWorkSide = MCH_MILL_WS.RIGHT
|
||||||
|
bInvert = true
|
||||||
|
dSal, dEal = dEal, dSal
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- step sempre positivi
|
||||||
|
local bAreCuttingStepsTowardsHead = true
|
||||||
|
-- calcolo SCC
|
||||||
|
local nSCC = ProcessLongCut.GetSCC( Proc, 0, EgtIf( bIsTopBladeCurrent, sCutting, sCuttingDn), nFaceUseCurrent, bInvert, i, nC, bAreCuttingStepsTowardsHead, bIsTopBladeCurrent, bCustUseBlade)
|
||||||
|
|
||||||
|
-- setto la lavorazione con i valori calcolati
|
||||||
|
EgtSetMachiningParam( MCH_MP.INVERT, bInvert)
|
||||||
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, nWorkSide)
|
||||||
|
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUseCurrent)
|
||||||
|
|
||||||
|
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
|
||||||
|
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)
|
||||||
|
-- imposto offset radiale
|
||||||
|
local dOffset = EgtIf( k == 1, dOffsetTopBlade, dOffsetDownBlade + dStepDownBlade * ( Zstep - 1))
|
||||||
|
EgtSetMachiningParam( MCH_MP.OFFSR, EgtIf( nSide == -1, -dOffset, dOffset))
|
||||||
|
-- imposto attacco/uscita
|
||||||
|
EgtSetMachiningParam( MCH_MP.LITANG, dLioTang)
|
||||||
|
EgtSetMachiningParam( MCH_MP.LIPERP, dLioPerp)
|
||||||
|
EgtSetMachiningParam( MCH_MP.LOTANG, dLioTang)
|
||||||
|
EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp)
|
||||||
|
-- imposto posizione braccio porta testa
|
||||||
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||||
|
-- eseguo
|
||||||
|
if not ML.ApplyMachining( true, false) then
|
||||||
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
|
EgtSetOperationMode( nMchFId, false)
|
||||||
|
return false, sErr
|
||||||
end
|
end
|
||||||
end
|
|
||||||
-- imposto posizione braccio porta testa per non ingombrare agli estremi
|
|
||||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
|
||||||
-- eseguo
|
|
||||||
if not ML.ApplyMachining( true, false) then
|
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
|
||||||
EgtSetOperationMode( nMchFId, false)
|
|
||||||
return false, sErr
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- se richiesto aggiungo la lavorazione con sega a catena
|
||||||
|
if bFinishWithChainSaw then
|
||||||
|
local dChainSawOverMaterial = 0
|
||||||
|
local dChainSawDepth = dOffsetDownBlade + BD.CUT_EXTRA
|
||||||
|
dEndDist = dEndDistUp
|
||||||
|
dEndAccDist = dEndAccDistUp
|
||||||
|
dStartDist = dStartDistUp
|
||||||
|
dStartAccDist = dStartAccDistUp
|
||||||
|
for i = nC, 1, -1 do
|
||||||
|
local bFirstCut = ( i == nC)
|
||||||
|
local bLastCut = ( i == 1)
|
||||||
|
local dSal = EgtIf( bFirstCut, -dEndDist, - dEndAccDist - ( nC - i - 1) * dC)
|
||||||
|
local dEal = EgtIf( bLastCut, -dStartDist, - dStartAccDist - ( i - 2) * dC)
|
||||||
|
local bShortenStartOrEnd = true
|
||||||
|
local bChainSawOk, sErr = MakeSideFaceByChainSaw( Proc.Id, dChainSawDepth, dChainSawOverMaterial, dSal, dEal, bShortenStartOrEnd, bShortenStartOrEnd)
|
||||||
|
if not bChainSawOk then return false, sErr end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- se non è sotto e non uso fresa di fianco: lavorazione Long2Cut
|
-- se non è sotto e non uso fresa di fianco: lavorazione Long2Cut
|
||||||
elseif ( nSide ~= - 1 or BD.DOWN_HEAD) and nUseMillOnSide == 0 then
|
elseif ( nSide ~= - 1 or BD.DOWN_HEAD) and nUseMillOnSide == 0 then
|
||||||
-- determino la massima elevazione
|
-- determino la massima elevazione
|
||||||
@@ -858,7 +1204,9 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
|||||||
-- recupero la lavorazione
|
-- recupero la lavorazione
|
||||||
local bDownHead = ( nSide == - 1)
|
local bDownHead = ( nSide == - 1)
|
||||||
sMchType = EgtIf( bDownHead, 'Long2Cut_H2', 'Long2Cut')
|
sMchType = EgtIf( bDownHead, 'Long2Cut_H2', 'Long2Cut')
|
||||||
local sMilling = ML.FindMilling( sMchType, dElev, nil, nil, nil, not bDownHead, bDownHead)
|
-- rimossa l'esclusione della terza testa a seguito di modifica della testa stessa che la rende utilizzabile in tutti i casi
|
||||||
|
--local bExcludeH3 = bLarghAsFace and abs( nSide) ~= 1
|
||||||
|
local sMilling = ML.FindMilling( sMchType, dElev, nil, nil, nil, not bDownHead, bDownHead, nil, bExcludeH3)
|
||||||
if not sMilling then
|
if not sMilling then
|
||||||
local sErr = 'Error : milling '..sMchType..' not found in library'
|
local sErr = 'Error : milling '..sMchType..' not found in library'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
@@ -874,7 +1222,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
|||||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- se la fine (a sinistra) non è limitata e ho un pezzo successivo meno distante di metà raggio. setto la fine come limitata
|
-- se la fine (a sinistra) non è limitata e ho un pezzo successivo o grezzo riutilizzabile meno distante di metà raggio, setto la fine come limitata
|
||||||
if dDistToNextPiece < dToolDiam/2 and not bLimXmin then
|
if dDistToNextPiece < dToolDiam/2 and not bLimXmin then
|
||||||
bForcedLim = true
|
bForcedLim = true
|
||||||
bLimXmin = true
|
bLimXmin = true
|
||||||
@@ -883,11 +1231,22 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
|||||||
if bLimXmin and bLimXmax and Proc.Box:getDimX() < 2 * dToolDiam then
|
if bLimXmin and bLimXmax and Proc.Box:getDimX() < 2 * dToolDiam then
|
||||||
return MakeByPocketing( Proc, nPhase, nRawId, nPartId)
|
return MakeByPocketing( Proc, nPhase, nRawId, nPartId)
|
||||||
end
|
end
|
||||||
|
-- determino l'utilizzo della faccia
|
||||||
|
local nFaceUse = EgtIf( abs( vtN:getY()) > 0.01, MCH_MILL_FU.ORTHO_DOWN, EgtIf( bFront, MCH_MILL_FU.ORTHO_FRONT, MCH_MILL_FU.ORTHO_BACK))
|
||||||
|
-- determino il lato di attacco (0:xMin, 1:xMax)
|
||||||
|
local nStartSide = 0
|
||||||
|
if nFaceUse == MCH_MILL_FU.ORTHO_DOWN and not bFront then
|
||||||
|
nStartSide = 1
|
||||||
|
elseif nFaceUse ~= MCH_MILL_FU.ORTHO_DOWN then
|
||||||
|
if ( bFront and nSide == -1) or ( not bFront and nSide == 1) then
|
||||||
|
nStartSide = 1
|
||||||
|
end
|
||||||
|
end
|
||||||
-- determino gli estremi
|
-- determino gli estremi
|
||||||
local dStartDist = 0
|
local dStartDist = 0
|
||||||
local dStartAccDist = BD.LONGCUT_ENDLEN
|
local dStartAccDist = BD.LONGCUT_ENDLEN
|
||||||
local bStartFixed = true
|
local bStartFixed = true
|
||||||
if ( bLimXmin and bFront) or ( bLimXmax and not bFront) then
|
if ( bLimXmin and nStartSide == 0) or ( bLimXmax and nStartSide == 1) then
|
||||||
dStartDist = dToolDiam / 2
|
dStartDist = dToolDiam / 2
|
||||||
dStartAccDist = BD.LONGCUT_MAXLEN
|
dStartAccDist = BD.LONGCUT_MAXLEN
|
||||||
bStartFixed = false
|
bStartFixed = false
|
||||||
@@ -895,7 +1254,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
|||||||
local dEndDist = 0
|
local dEndDist = 0
|
||||||
local dEndAccDist = BD.LONGCUT_ENDLEN
|
local dEndAccDist = BD.LONGCUT_ENDLEN
|
||||||
local bEndFixed = true
|
local bEndFixed = true
|
||||||
if ( bLimXmin and not bFront) or ( bLimXmax and bFront) then
|
if ( bLimXmin and nStartSide == 1) or ( bLimXmax and nStartSide == 0) then
|
||||||
dEndDist = dToolDiam / 2
|
dEndDist = dToolDiam / 2
|
||||||
dEndAccDist = BD.LONGCUT_MAXLEN
|
dEndAccDist = BD.LONGCUT_MAXLEN
|
||||||
bEndFixed = false
|
bEndFixed = false
|
||||||
@@ -960,19 +1319,10 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
|||||||
dEndAccDist = 0
|
dEndAccDist = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- determino l'utilizzo della faccia
|
|
||||||
local nFaceUse = EgtIf( abs( vtN:getY()) > 0.01, MCH_MILL_FU.ORTHO_DOWN, EgtIf( bFront, MCH_MILL_FU.ORTHO_FRONT, MCH_MILL_FU.ORTHO_BACK))
|
|
||||||
-- si percorre il lato basso della faccia
|
-- si percorre il lato basso della faccia
|
||||||
local nM = 0
|
local nM = 0
|
||||||
local nCountMilHead = 0
|
local nCountMilHead = 0
|
||||||
for i = 1, nC do
|
for i = 1, nC do
|
||||||
-- Posizione braccio portatesta
|
|
||||||
local nSCC
|
|
||||||
if bFront then
|
|
||||||
nSCC = EgtIf( ( BD.C_SIMM or i == 1 or i == nC - 1), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
|
|
||||||
else
|
|
||||||
nSCC = EgtIf( ( BD.C_SIMM or i == 1 or i == nC - 1), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
|
||||||
end
|
|
||||||
-- ciclo sulle passate
|
-- ciclo sulle passate
|
||||||
local nO = 1
|
local nO = 1
|
||||||
local dStep = 0
|
local dStep = 0
|
||||||
@@ -992,15 +1342,47 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
|||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
|
-- correggo l'attacco se necessario
|
||||||
|
if i == 1 and not bStartFixed then
|
||||||
|
if nO == 1 or EgtGetMachiningParam( MCH_MP.LITANG) ~= 0 then
|
||||||
|
EgtSetMachiningParam( MCH_MP.LIELEV, 0)
|
||||||
|
EgtSetMachiningParam( MCH_MP.LITANG, 0)
|
||||||
|
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.LINEAR)
|
||||||
|
EgtSetMachiningParam( MCH_MP.LIPERP, dWidth + BD.CUT_EXTRA + ( BD.CUT_SIC or 20))
|
||||||
|
end
|
||||||
|
elseif i == nC and not bEndFixed then
|
||||||
|
if nO == 1 or EgtGetMachiningParam( MCH_MP.LOTANG) ~= 0 then
|
||||||
|
EgtSetMachiningParam( MCH_MP.LOELEV, 0)
|
||||||
|
EgtSetMachiningParam( MCH_MP.LOTANG, 0)
|
||||||
|
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LI.LINEAR)
|
||||||
|
EgtSetMachiningParam( MCH_MP.LOPERP, dWidth + BD.CUT_EXTRA + ( BD.CUT_SIC or 20))
|
||||||
|
end
|
||||||
|
end
|
||||||
-- aggiungo geometria
|
-- aggiungo geometria
|
||||||
EgtSetMachiningGeometry( {{ Proc.Id, 0}})
|
EgtSetMachiningGeometry( {{ Proc.Id, 0}})
|
||||||
|
|
||||||
|
-- setto workside e eventuale inversione
|
||||||
|
local bInvert
|
||||||
|
if bInvert 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, false)
|
||||||
|
end
|
||||||
-- limito opportunamente la lavorazione
|
-- limito opportunamente la lavorazione
|
||||||
local dSal = EgtIf( i == 1, -dStartDist, - dStartAccDist - ( i - 2) * dC)
|
local dSal = EgtIf( i == 1, -dStartDist, - dStartAccDist - ( i - 2) * dC)
|
||||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
|
|
||||||
local dEal = EgtIf( i == nC, -dEndDist, - dEndAccDist - ( nC - i - 1) * dC)
|
local dEal = EgtIf( i == nC, -dEndDist, - dEndAccDist - ( nC - i - 1) * dC)
|
||||||
|
if bInvert then
|
||||||
|
dSal, dEal = dEal, dSal
|
||||||
|
end
|
||||||
|
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
|
||||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)
|
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)
|
||||||
-- imposto offset radiale
|
-- imposto offset radiale
|
||||||
EgtSetMachiningParam( MCH_MP.OFFSR, ( k - 1) * dStep - BD.CUT_EXTRA)
|
EgtSetMachiningParam( MCH_MP.OFFSR, ( k - 1) * dStep - BD.CUT_EXTRA)
|
||||||
|
-- Posizione braccio portatesta
|
||||||
|
local bAreCuttingStepsTowardsHead = ( nStartSide == 0)
|
||||||
|
local nSCC = ProcessLongCut.GetSCC( Proc, 0, sMilling, nFaceUse, bInvert, i, nC, bAreCuttingStepsTowardsHead, nil, nil)
|
||||||
-- imposto posizione braccio porta testa per non ingombrare agli estremi
|
-- imposto posizione braccio porta testa per non ingombrare agli estremi
|
||||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||||
-- imposto uso della faccia
|
-- imposto uso della faccia
|
||||||
@@ -1011,6 +1393,11 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
|||||||
end
|
end
|
||||||
local dDepth = min( 0, dMaxDepth - dElev )
|
local dDepth = min( 0, dMaxDepth - dElev )
|
||||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||||
|
-- eventuale nota utente per disabilitare controllo ingresso e uscita in grezzo
|
||||||
|
if k < nO then
|
||||||
|
local sNotes = 'OutRaw=3;'
|
||||||
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
|
||||||
|
end
|
||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
@@ -1020,16 +1407,20 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
|||||||
end
|
end
|
||||||
-- eventuale lavorazione della faccia limitante l'inizio
|
-- eventuale lavorazione della faccia limitante l'inizio
|
||||||
if i == 1 and not bStartFixed then
|
if i == 1 and not bStartFixed then
|
||||||
local vtIni = EgtIf( bFront, X_AX(), -X_AX())
|
-- per il lato sotto il vettore è opposto
|
||||||
|
local vtIni = EgtIf( bFront, X_AX(), -X_AX())
|
||||||
|
if nSide == -1 then
|
||||||
|
vtIni = -1 * vtIni
|
||||||
|
end
|
||||||
for j = 1, Proc.Fct - 1 do
|
for j = 1, Proc.Fct - 1 do
|
||||||
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, j, GDB_ID.ROOT)
|
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, j, GDB_ID.ROOT)
|
||||||
if vtIni * vtN > 0 and nCountMilHead < 2 then
|
if vtIni * vtN > 0 and nCountMilHead < 2 then
|
||||||
MakeSideFace( Proc.Id, j, nSide, sMilling, dToolDiam)
|
MakeSideFace( Proc.Id, j, nSide, sMilling, dToolDiam, nil, nil, bDownHead)
|
||||||
nCountMilHead = nCountMilHead + 1
|
nCountMilHead = nCountMilHead + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if bForcedLim and nCountMilHead < 1 then
|
if bForcedLim and nCountMilHead < 1 then
|
||||||
MakeSideFace( Proc.Id, 0, nSide, sMilling, dToolDiam, bForcedLim)
|
MakeSideFace( Proc.Id, 0, nSide, sMilling, dToolDiam, bForcedLim, nil, bDownHead)
|
||||||
nCountMilHead = nCountMilHead + 1
|
nCountMilHead = nCountMilHead + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1037,16 +1428,20 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
|||||||
|
|
||||||
-- eventuale lavorazione della faccia limitante la fine
|
-- eventuale lavorazione della faccia limitante la fine
|
||||||
if not bEndFixed then
|
if not bEndFixed then
|
||||||
local vtFin = EgtIf( bFront, -X_AX(), X_AX())
|
-- per il lato sotto il vettore è opposto
|
||||||
|
local vtFin = EgtIf( bFront, -X_AX(), X_AX())
|
||||||
|
if nSide == -1 then
|
||||||
|
vtFin = -1 * vtFin
|
||||||
|
end
|
||||||
for j = 1, Proc.Fct - 1 do
|
for j = 1, Proc.Fct - 1 do
|
||||||
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, j, GDB_ID.ROOT)
|
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, j, GDB_ID.ROOT)
|
||||||
if vtFin * vtN > 0 and nCountMilHead < 2 then
|
if vtFin * vtN > 0 and nCountMilHead < 2 then
|
||||||
MakeSideFace( Proc.Id, j, nSide, sMilling, dToolDiam)
|
MakeSideFace( Proc.Id, j, nSide, sMilling, dToolDiam, nil, nil, bDownHead)
|
||||||
nCountMilHead = nCountMilHead + 1
|
nCountMilHead = nCountMilHead + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if bForcedLim and nCountMilHead < 2 then
|
if bForcedLim and nCountMilHead < 2 then
|
||||||
MakeSideFace( Proc.Id, 0, nSide, sMilling, dToolDiam, bForcedLim)
|
MakeSideFace( Proc.Id, 0, nSide, sMilling, dToolDiam, bForcedLim, nil, bDownHead)
|
||||||
nCountMilHead = nCountMilHead + 1
|
nCountMilHead = nCountMilHead + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1068,8 +1463,8 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
|||||||
sMilling = ML.FindMilling( sMchType)
|
sMilling = ML.FindMilling( sMchType)
|
||||||
sPrefix = 'L2CS_'
|
sPrefix = 'L2CS_'
|
||||||
nExtendMach = nUseMillOnSide
|
nExtendMach = nUseMillOnSide
|
||||||
if nUseMillOnSide == 2 then
|
if nUseMillOnSide == 2 then
|
||||||
bRemoveToolRadius = true
|
bRemoveToolRadius = true
|
||||||
end
|
end
|
||||||
-- se testa da sotto
|
-- se testa da sotto
|
||||||
if nSide ~= 1 and BD.DOWN_HEAD then
|
if nSide ~= 1 and BD.DOWN_HEAD then
|
||||||
@@ -1354,13 +1749,8 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
|||||||
local dSal = EgtIf( nPos == 1, -dEndDist, -dEndAccDist - ( nPos - 2) * dC + dOverLapExtend)
|
local dSal = EgtIf( nPos == 1, -dEndDist, -dEndAccDist - ( nPos - 2) * dC + dOverLapExtend)
|
||||||
local dEal = EgtIf( nPos == nC, -dStartDist, -dStartAccDist - ( nC - nPos - 1) * dC + dOverLapExtend)
|
local dEal = EgtIf( nPos == nC, -dStartDist, -dStartAccDist - ( nC - nPos - 1) * dC + dOverLapExtend)
|
||||||
-- Posizione braccio portatesta
|
-- Posizione braccio portatesta
|
||||||
local nSCC
|
--local nSCC
|
||||||
for k = 1, nPass do
|
for k = 1, nPass do
|
||||||
if bFront then
|
|
||||||
nSCC = EgtIf( ( BD.C_SIMM or j == 1 or j == nC - 1), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
|
|
||||||
else
|
|
||||||
nSCC = EgtIf( ( BD.C_SIMM or j == 1 or j == nC - 1), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
|
||||||
end
|
|
||||||
-- inserisco le parti di lavorazione
|
-- inserisco le parti di lavorazione
|
||||||
nM = nM + 1
|
nM = nM + 1
|
||||||
local sNameF = EgtIf( vnHead[k] ~= 2, sPrefix, sPrefixDn) .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM)
|
local sNameF = EgtIf( vnHead[k] ~= 2, sPrefix, sPrefixDn) .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM)
|
||||||
@@ -1372,22 +1762,22 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
|||||||
end
|
end
|
||||||
-- aggiungo geometria
|
-- aggiungo geometria
|
||||||
EgtSetMachiningGeometry( {{ Proc.Id, 0}})
|
EgtSetMachiningGeometry( {{ Proc.Id, 0}})
|
||||||
-- imposto posizione braccio porta testa per non ingombrare agli estremi
|
|
||||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
|
||||||
-- imposto uso faccia
|
-- imposto uso faccia
|
||||||
local nUseFace = EgtIf( vnHead[k] ~= 2, MCH_MILL_FU.PARAL_DOWN, MCH_MILL_FU.PARAL_TOP)
|
local nFaceUse = EgtIf( vnHead[k] ~= 2, MCH_MILL_FU.PARAL_DOWN, MCH_MILL_FU.PARAL_TOP)
|
||||||
if AreSameOrOppositeVectorApprox( vtN, Z_AX()) then nUseFace = MCH_MILL_FU.PARAL_BACK end
|
if AreSameOrOppositeVectorApprox( vtN, Z_AX()) then nFaceUse = MCH_MILL_FU.PARAL_BACK end
|
||||||
EgtSetMachiningParam( MCH_MP.FACEUSE, nUseFace)
|
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
||||||
-- imposto lato di lavoro e inversione
|
-- imposto lato di lavoro e inversione
|
||||||
|
local bInvert
|
||||||
if k == 1 then
|
if k == 1 then
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
bInvert = true
|
||||||
else
|
else
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, false)
|
|
||||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
|
bInvert = false
|
||||||
dSal, dEal = dEal, dSal
|
dSal, dEal = dEal, dSal
|
||||||
end
|
end
|
||||||
|
EgtSetMachiningParam( MCH_MP.INVERT, bInvert)
|
||||||
-- limito opportunamente la lavorazione
|
-- limito opportunamente la lavorazione
|
||||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
|
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
|
||||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)
|
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)
|
||||||
@@ -1396,6 +1786,12 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
|||||||
-- assegno attacco perpendicolare
|
-- assegno attacco perpendicolare
|
||||||
EgtSetMachiningParam( MCH_MP.LIPERP, dLioPerp1)
|
EgtSetMachiningParam( MCH_MP.LIPERP, dLioPerp1)
|
||||||
EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp1)
|
EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp1)
|
||||||
|
-- step sempre negativi
|
||||||
|
local bAreCuttingStepsTowardsHead = false
|
||||||
|
-- calcolo SCC
|
||||||
|
local nSCC = ProcessLongCut.GetSCC( Proc, 0, EgtIf( vnHead[k] ~= 2, sMilling, sMillingDn), nFaceUse, bInvert, j, nC, bAreCuttingStepsTowardsHead, nil, nil)
|
||||||
|
-- imposto posizione braccio porta testa
|
||||||
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
-- se feature orientata su faccia da sotto provo a cambiare l'attacco
|
-- se feature orientata su faccia da sotto provo a cambiare l'attacco
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
-- ProcessLongDoubleCut.lua by Egaltech s.r.l. 2022/06/29
|
-- ProcessLongDoubleCut.lua by Egaltech s.r.l. 2023/06/07
|
||||||
-- Gestione calcolo doppio taglio longitudinale per Travi
|
-- Gestione calcolo doppio taglio longitudinale per Travi
|
||||||
-- 2021/05/18 Possibile taglio con lama anche di fianco su macchina con testa da sotto.
|
-- 2021/05/18 Possibile taglio con lama anche di fianco su macchina con testa da sotto.
|
||||||
-- 2021/06/29 Corretta gestione caso equivalente a due smussi.
|
-- 2021/06/29 Corretta gestione caso equivalente a due smussi.
|
||||||
@@ -9,6 +9,15 @@
|
|||||||
-- 2022/03/20 Tolta da scelta milling tipo Long2CutDown controllo max diametro fresa.
|
-- 2022/03/20 Tolta da scelta milling tipo Long2CutDown controllo max diametro fresa.
|
||||||
-- 2022/05/27 Corretto ordine per casi sui lati.
|
-- 2022/05/27 Corretto ordine per casi sui lati.
|
||||||
-- 2022/06/29 Corretto calcolo lunghezza attacco/uscita perpendicolare per lavorazioni di fianco.
|
-- 2022/06/29 Corretto calcolo lunghezza attacco/uscita perpendicolare per lavorazioni di fianco.
|
||||||
|
-- 2022/11/30 Modifiche su SCC per TURN.
|
||||||
|
-- 2023/01/26 Rimossa la pulitura della faccia laterale nel caso in cui la feature abbia almeno una faccia rivolta verso il basso.
|
||||||
|
-- 2023/01/27 In MakeSideFace il prolungamento di uscita è ora fissato a 10 mm.
|
||||||
|
-- 2023/02/15 Migliorato verso di avanzamento della lama.
|
||||||
|
-- 2023/02/21 Verso di avanzamento della lama migliorato anche con lama LC.
|
||||||
|
-- 2023/02/22 Nuova gestione del verso di avanzamento ottimale che contempla tutti i casi.
|
||||||
|
-- 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
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local ProcessLong2Cut = {}
|
local ProcessLong2Cut = {}
|
||||||
@@ -117,7 +126,11 @@ function ProcessLong2Cut.GetLongFacesCount( Proc)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
local function MakeSideFace( nId, nFac, nSide, sMilling, dToolDiam, nL2CSide)
|
local function MakeSideFace( nId, nFac, nSideLimitingFace, nInd, sMilling, dToolDiam, nL2CSide, bIsAnyFaceUpsideDown)
|
||||||
|
if ( not BD.DOWN_HEAD and not BD.TURN) and bIsAnyFaceUpsideDown then
|
||||||
|
EgtOutLog( 'Long2Cut : side face finishing skipped, down head required')
|
||||||
|
return true
|
||||||
|
end
|
||||||
-- inserisco la lavorazione
|
-- inserisco la lavorazione
|
||||||
local sNameF = 'L2C_' .. ( EgtGetName( nId) or tostring( nId)) .. '_' .. tostring( nFac)
|
local sNameF = 'L2C_' .. ( EgtGetName( nId) or tostring( nId)) .. '_' .. tostring( nFac)
|
||||||
local nMchFId = EgtAddMachining( sNameF, sMilling)
|
local nMchFId = EgtAddMachining( sNameF, sMilling)
|
||||||
@@ -129,18 +142,28 @@ local function MakeSideFace( nId, nFac, nSide, sMilling, dToolDiam, nL2CSide)
|
|||||||
-- aggiungo geometria
|
-- aggiungo geometria
|
||||||
EgtSetMachiningGeometry( {{ nId, nFac}})
|
EgtSetMachiningGeometry( {{ nId, nFac}})
|
||||||
-- lato di lavoro e inversione
|
-- lato di lavoro e inversione
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, false)
|
if BD.TURN and
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
( ( nSideLimitingFace == 1 and nInd == EgtIf( nL2CSide ~= -1, 2, 1)) or
|
||||||
|
( nSideLimitingFace == -1 and nInd == EgtIf( nL2CSide ~= -1, 1, 2))) then
|
||||||
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
||||||
|
else
|
||||||
|
EgtSetMachiningParam( MCH_MP.INVERT, false)
|
||||||
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||||
|
end
|
||||||
-- uso della faccia
|
-- uso della faccia
|
||||||
local nFaceUse = EgtIf( nSide == 1, MCH_MILL_FU.ORTHO_RIGHT, MCH_MILL_FU.ORTHO_LEFT)
|
local nFaceUse = EgtIf( nSideLimitingFace == 1, MCH_MILL_FU.ORTHO_RIGHT, MCH_MILL_FU.ORTHO_LEFT)
|
||||||
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
||||||
-- annullo offset radiale
|
-- annullo offset radiale
|
||||||
EgtSetMachiningParam( MCH_MP.OFFSR, 0)
|
EgtSetMachiningParam( MCH_MP.OFFSR, 0)
|
||||||
-- attacco e uscita
|
-- attacco e uscita
|
||||||
EgtSetMachiningParam( MCH_MP.LIPERP, 0)
|
EgtSetMachiningParam( MCH_MP.LIPERP, 0)
|
||||||
EgtSetMachiningParam( MCH_MP.LITANG, dToolDiam / 2 + 30)
|
EgtSetMachiningParam( MCH_MP.LITANG, dToolDiam / 2 + 30)
|
||||||
EgtSetMachiningParam( MCH_MP.LOPERP, 0)
|
EgtSetMachiningParam( MCH_MP.LOPERP, 5)
|
||||||
EgtSetMachiningParam( MCH_MP.LOTANG, dToolDiam / 2 + 30)
|
EgtSetMachiningParam( MCH_MP.LOTANG, 10)
|
||||||
|
if BD.TURN then
|
||||||
|
EgtSetMachiningParam( MCH_MP.LOELEV, 10)
|
||||||
|
end
|
||||||
-- se faccia di fianco e testa da sotto, aumento la sicurezza
|
-- se faccia di fianco e testa da sotto, aumento la sicurezza
|
||||||
if nL2CSide == 0 and BD.DOWN_HEAD then
|
if nL2CSide == 0 and BD.DOWN_HEAD then
|
||||||
EgtSetMachiningParam( MCH_MP.STARTPOS, 80)
|
EgtSetMachiningParam( MCH_MP.STARTPOS, 80)
|
||||||
@@ -301,6 +324,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
|||||||
elseif vtN[1]:getZ() < -0.0175 and vtN[2]:getZ() < -0.0175 then
|
elseif vtN[1]:getZ() < -0.0175 and vtN[2]:getZ() < -0.0175 then
|
||||||
nSide = -1
|
nSide = -1
|
||||||
end
|
end
|
||||||
|
local bIsAnyFaceUpsideDown = vtN[1]:getZ() < -0.0175 or vtN[2]:getZ() < -0.0175
|
||||||
|
|
||||||
-- angolo diedro per stabilire se taglio convesso
|
-- angolo diedro per stabilire se taglio convesso
|
||||||
local bInt, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, tFaceLong[1], tFaceLong[2], GDB_ID.ROOT)
|
local bInt, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, tFaceLong[1], tFaceLong[2], GDB_ID.ROOT)
|
||||||
@@ -324,7 +348,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- ottengo la distanza tra la fine del pezzo e il pezzo successivo
|
-- ottengo la distanza tra la fine del pezzo e il pezzo successivo
|
||||||
local dDistToNextPiece = EgtGetInfo( nRawId, 'BDST', 'd') or 5.4
|
local dDistToNextPiece = BL.GetDistanceToNextPart( nRawId, nPhase)
|
||||||
local bForcedLim
|
local bForcedLim
|
||||||
local sWarn
|
local sWarn
|
||||||
----------------------------------------------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -374,7 +398,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
|||||||
vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1})
|
vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1})
|
||||||
vFaceUse = { BL.GetNearestParalOpposite( ptC[1] - ptM), BL.GetNearestParalOpposite( ptC[2] - ptM)}
|
vFaceUse = { BL.GetNearestParalOpposite( ptC[1] - ptM), BL.GetNearestParalOpposite( ptC[2] - ptM)}
|
||||||
else
|
else
|
||||||
local bFront = ( vtN[1]:getY() < 0 or vtN[2]:getY() < 0)
|
local bFront = ( ( vtN[1]:getY() + vtN[2]:getY()) < 0)
|
||||||
if bFront then
|
if bFront then
|
||||||
vOrd = EgtIf( ptC[1]:getZ() < ptRef:getZ(), { 1, 2}, { 2, 1})
|
vOrd = EgtIf( ptC[1]:getZ() < ptRef:getZ(), { 1, 2}, { 2, 1})
|
||||||
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
|
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
|
||||||
@@ -519,7 +543,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
|||||||
-- Posizione braccio portatesta
|
-- Posizione braccio portatesta
|
||||||
local nSCC = MCH_SCC.NONE
|
local nSCC = MCH_SCC.NONE
|
||||||
if not BD.C_SIMM then
|
if not BD.C_SIMM then
|
||||||
nSCC = EgtIf( ( i == 1 or i == nC - 1), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
nSCC = EgtIf( ( i == 1 or i == nC - 1), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
|
||||||
end
|
end
|
||||||
local nCountToShift = 0
|
local nCountToShift = 0
|
||||||
local bChangeBlade
|
local bChangeBlade
|
||||||
@@ -673,46 +697,87 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
|||||||
end
|
end
|
||||||
-- aggiungo geometria
|
-- aggiungo geometria
|
||||||
EgtSetMachiningGeometry( {{ Proc.Id, vOrd[j]-1}})
|
EgtSetMachiningGeometry( {{ Proc.Id, vOrd[j]-1}})
|
||||||
|
|
||||||
|
-- settaggio di workside, uso faccia e eventuale inversione
|
||||||
-- limito opportunamente la lavorazione
|
-- limito opportunamente la lavorazione
|
||||||
local dSal = EgtIf( i == nC, 0, - dEndAccDist - ( nC - i - 1) * dC)
|
local dSalInner, dSalOuter = - dEndAccDist - ( i - 2) * dC, 0
|
||||||
local dEal = EgtIf( i == 1, 0, - dStartAccDist - ( i - 2) * dC)
|
local dEalInner, dEalOuter = - dStartAccDist - ( nC - i - 1) * dC, 0
|
||||||
if ( not bFront and k == 1) or ( bFront and k == 2) then
|
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
|
||||||
dSal, dEal = dEal, dSal
|
dSal, dEal = dEal, dSal
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- verifico lama in uso e imposto uso faccia
|
||||||
|
local bIsTopBladeCurrent = not bMachDown
|
||||||
|
local nFaceUseCurrent
|
||||||
if bCanUseBlade and bCanUseUnderBlade then
|
if bCanUseBlade and bCanUseUnderBlade then
|
||||||
if bCanUseBlade and nSide == -1 then
|
if nSide == -1 then
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
dSal, dEal = dEal, dSal
|
||||||
-- imposto uso della faccia
|
if k == 1 then
|
||||||
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse2, nFaceUse))
|
nFaceUseCurrent = nFaceUse2
|
||||||
|
else
|
||||||
|
nFaceUseCurrent = nFaceUse
|
||||||
|
end
|
||||||
else
|
else
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
if k == 1 then
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
nFaceUseCurrent = nFaceUse
|
||||||
-- imposto uso della faccia
|
else
|
||||||
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse, nFaceUse2))
|
nFaceUseCurrent = nFaceUse2
|
||||||
|
end
|
||||||
end
|
end
|
||||||
elseif bCanUseBlade and BD.USE_LONGCUT then
|
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
|
||||||
dSal, dEal = dEal, dSal
|
|
||||||
-- imposto uso della faccia
|
|
||||||
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse, nFaceUse2))
|
|
||||||
elseif bCanUseUnderBlade then
|
elseif bCanUseUnderBlade then
|
||||||
if nSide ~= 0 then
|
if k == 1 then
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
nFaceUseCurrent = nFaceUse
|
||||||
|
else
|
||||||
|
nFaceUseCurrent = nFaceUse2
|
||||||
end
|
end
|
||||||
-- imposto uso della faccia
|
|
||||||
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse, nFaceUse2))
|
|
||||||
else
|
else
|
||||||
if bCanUseBlade and nSide == -1 then
|
if k == 1 then
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
nFaceUseCurrent = nFaceUse
|
||||||
|
else
|
||||||
|
nFaceUseCurrent = nFaceUse2
|
||||||
end
|
end
|
||||||
-- imposto uso della faccia
|
|
||||||
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse, nFaceUse2))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- recupero alcune informazioni utili dalla lavorazione attuale
|
||||||
|
local bIsCurrentBladeCCW
|
||||||
|
if bIsTopBladeCurrent then
|
||||||
|
EgtMdbSetCurrMachining( sCutting)
|
||||||
|
else
|
||||||
|
EgtMdbSetCurrMachining( sCuttingDn)
|
||||||
|
end
|
||||||
|
bIsCurrentBladeCCW = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0
|
||||||
|
|
||||||
|
-- imposto la direzione di lavoro per avere scarico del truciolo ottimale
|
||||||
|
local nWorkSide, bInvert
|
||||||
|
if ( not bIsTopBladeCurrent and abs( nSide) ~= 0) or ( bCanUseBlade and bCanUseUnderBlade and nSide == -1) then
|
||||||
|
if bIsCurrentBladeCCW then
|
||||||
|
nWorkSide = MCH_MILL_WS.LEFT
|
||||||
|
bInvert = true
|
||||||
|
dSal, dEal = dEal, dSal
|
||||||
|
else
|
||||||
|
nWorkSide = MCH_MILL_WS.RIGHT
|
||||||
|
bInvert = false
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if bIsCurrentBladeCCW then
|
||||||
|
nWorkSide = MCH_MILL_WS.LEFT
|
||||||
|
bInvert = false
|
||||||
|
else
|
||||||
|
nWorkSide = MCH_MILL_WS.RIGHT
|
||||||
|
bInvert = true
|
||||||
|
dSal, dEal = dEal, dSal
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- setto la lavorazione con i valori calcolati
|
||||||
|
EgtSetMachiningParam( MCH_MP.INVERT, bInvert)
|
||||||
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, nWorkSide)
|
||||||
|
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUseCurrent)
|
||||||
|
|
||||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
|
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
|
||||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)
|
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)
|
||||||
|
|
||||||
-- imposto offset radiale
|
-- imposto offset radiale
|
||||||
EgtSetMachiningParam( MCH_MP.OFFSR, EgtIf( nSide == -1, -dOffset, dOffset))
|
EgtSetMachiningParam( MCH_MP.OFFSR, EgtIf( nSide == -1, -dOffset, dOffset))
|
||||||
-- imposto attacco/uscita
|
-- imposto attacco/uscita
|
||||||
@@ -1041,18 +1106,21 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
|||||||
local nPos = EgtIf( i == 1, j, nC - j + 1)
|
local nPos = EgtIf( i == 1, j, nC - j + 1)
|
||||||
local dSal = EgtIf( nPos == 1, - EgtIf( i == nIni, dStartDist, dEndDist), - EgtIf( i == nIni, dStartAccDist, dEndAccDist) - ( nPos - 2) * dC + EgtIf( bSide, dOverLapExtend, 0))
|
local dSal = EgtIf( nPos == 1, - EgtIf( i == nIni, dStartDist, dEndDist), - EgtIf( i == nIni, dStartAccDist, dEndAccDist) - ( nPos - 2) * dC + EgtIf( bSide, dOverLapExtend, 0))
|
||||||
local dEal = EgtIf( nPos == nC, - EgtIf( i == nIni, dEndDist, dStartDist), - EgtIf( i == nIni, dEndAccDist, dStartAccDist) - ( nC - nPos - 1) * dC + EgtIf( bSide, dOverLapExtend, 0))
|
local dEal = EgtIf( nPos == nC, - EgtIf( i == nIni, dEndDist, dStartDist), - EgtIf( i == nIni, dEndAccDist, dStartAccDist) - ( nC - nPos - 1) * dC + EgtIf( bSide, dOverLapExtend, 0))
|
||||||
|
if nSide == -1 then
|
||||||
|
dSal, dEal = dEal, dSal
|
||||||
|
end
|
||||||
-- Posizione braccio portatesta
|
-- Posizione braccio portatesta
|
||||||
local nSCC = MCH_SCC.NONE
|
local nSCC = MCH_SCC.NONE
|
||||||
if not BD.C_SIMM then
|
if not BD.C_SIMM then
|
||||||
if not BD.TURN then
|
if not BD.TURN then
|
||||||
nSCC = EgtIf( ( j == 1 or j == nC - 1), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
nSCC = EgtIf( ( j == 1 or j == nC - 1), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
||||||
else
|
else
|
||||||
if nSide == 1 then
|
if nSide == 1 or nSide == -1 then
|
||||||
nSCC = EgtIf( vtN[vOrd[i]]:getY() < -0.5, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)
|
local bFromYM = (( vtN[vOrd[i]]:getY() < 0 and bConvex) or ( vtN[vOrd[i]]:getY() > 0 and not bConvex))
|
||||||
elseif nSide == -1 then
|
nSCC = EgtIf( bFromYM, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)
|
||||||
nSCC = EgtIf( vtN[vOrd[i]]:getY() < 0, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)
|
|
||||||
else
|
else
|
||||||
nSCC = MCH_SCC.ADIR_ZP
|
local bFromZM = (( vtN[vOrd[i]]:getZ() < 0 and bConvex) or ( vtN[vOrd[i]]:getZ() > 0 and not bConvex))
|
||||||
|
nSCC = EgtIf( bFromZM, MCH_SCC.ADIR_ZM, MCH_SCC.ADIR_ZP)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1124,11 +1192,11 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
|||||||
end
|
end
|
||||||
-- se facce principali convesse, eventuale lavorazione della faccia limitante l'inizio (a destra)
|
-- se facce principali convesse, eventuale lavorazione della faccia limitante l'inizio (a destra)
|
||||||
if bConvex and j == 1 and not bStartFixed then
|
if bConvex and j == 1 and not bStartFixed then
|
||||||
MakeSideFace( Proc.Id, tFaceLong[vOrd[i]], 1, sMilling, dToolDiam, nSide)
|
MakeSideFace( Proc.Id, tFaceLong[vOrd[i]], 1, i, sMilling, dToolDiam, nSide, bIsAnyFaceUpsideDown)
|
||||||
end
|
end
|
||||||
-- se facce principali convesse, eventuale lavorazione della faccia limitante la fine (a sinistra)
|
-- se facce principali convesse, eventuale lavorazione della faccia limitante la fine (a sinistra)
|
||||||
if bConvex and j == nC and not bEndFixed then
|
if bConvex and j == nC and not bEndFixed then
|
||||||
MakeSideFace( Proc.Id, tFaceLong[vOrd[i]], -1, sMilling, dToolDiam, nSide)
|
MakeSideFace( Proc.Id, tFaceLong[vOrd[i]], -1, i, sMilling, dToolDiam, nSide, bIsAnyFaceUpsideDown)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1566,11 +1634,11 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
|||||||
end
|
end
|
||||||
-- se facce principali convesse, eventuale lavorazione della faccia limitante l'inizio (a destra)
|
-- se facce principali convesse, eventuale lavorazione della faccia limitante l'inizio (a destra)
|
||||||
if bConvex and j == 1 and not bStartFixed and bRemoveToolRadius then
|
if bConvex and j == 1 and not bStartFixed and bRemoveToolRadius then
|
||||||
MakeSideFace( Proc.Id, tFaceLong[vOrd[i]], 1, sMilling, dToolDiam)
|
MakeSideFace( Proc.Id, tFaceLong[vOrd[i]], 1, i, sMilling, dToolDiam)
|
||||||
end
|
end
|
||||||
-- se facce principali convesse, eventuale lavorazione della faccia limitante la fine (a sinistra)
|
-- se facce principali convesse, eventuale lavorazione della faccia limitante la fine (a sinistra)
|
||||||
if bConvex and j == nC and not bEndFixed and bRemoveToolRadius then
|
if bConvex and j == nC and not bEndFixed and bRemoveToolRadius then
|
||||||
MakeSideFace( Proc.Id, tFaceLong[vOrd[i]], -1, sMilling, dToolDiam)
|
MakeSideFace( Proc.Id, tFaceLong[vOrd[i]], -1, i, sMilling, dToolDiam)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+20
-15
@@ -1,7 +1,8 @@
|
|||||||
-- ProcessMark.lua by Egaltech s.r.l. 2022/06/07
|
-- ProcessMark.lua by Egaltech s.r.l. 2022/12/05
|
||||||
-- Gestione calcolo marcatura per Travi
|
-- Gestione calcolo marcatura per Travi
|
||||||
-- 2020/05/28 Tipo di lavorazione passato da Mark a Text.
|
-- 2020/05/28 Tipo di lavorazione passato da Mark a Text.
|
||||||
-- 2021/05/03 Aggiunta gestione testa da sotto.
|
-- 2021/05/03 Aggiunta gestione testa da sotto.
|
||||||
|
-- 2022/12/05 Aggiunta gestione tipo di lavorazione Text_AT.
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local ProcessMark = {}
|
local ProcessMark = {}
|
||||||
@@ -37,6 +38,12 @@ function ProcessMark.Classify( Proc)
|
|||||||
end
|
end
|
||||||
-- verifico se la marcatura è lavorabile solo da sotto
|
-- verifico se la marcatura è lavorabile solo da sotto
|
||||||
local bDown = (( vtN:getZ() < -0.1))
|
local bDown = (( vtN:getZ() < -0.1))
|
||||||
|
-- se da sotto e presente rinvio angolare verifico se c'è opportuna lavorazione
|
||||||
|
if bDown and BD.ANG_TRASM then
|
||||||
|
if ML.FindMilling( 'Text_AT') then
|
||||||
|
bDown = false
|
||||||
|
end
|
||||||
|
end
|
||||||
return true, bDown
|
return true, bDown
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -55,25 +62,25 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId)
|
|||||||
end
|
end
|
||||||
-- verifico sia una curva/testo
|
-- verifico sia una curva/testo
|
||||||
if not vtExtr then
|
if not vtExtr then
|
||||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Mark with geometry type not accepted'
|
local sErr = 'Error : Mark with geometry type not accepted'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
-- verifico che la marcatura non sia orientata verso il basso (-5 deg)
|
-- verifico che la marcatura non sia orientata verso il basso (-5 deg)
|
||||||
if vtExtr:getZ() < - 0.1 and not BD.DOWN_HEAD and not BD.TURN then
|
if vtExtr:getZ() < - 0.1 and not BD.DOWN_HEAD and not BD.ANG_TRASM and not BD.TURN then
|
||||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Mark from bottom impossible'
|
local sErr = 'Error : Mark from bottom impossible'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
-- abilitazione lavorazione da sotto
|
-- abilitazione lavorazione da sotto
|
||||||
local bMillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259)
|
local bMillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259)
|
||||||
local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174)
|
local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174)
|
||||||
|
local bMillAngTrasm = ( BD.ANG_TRASM and vtExtr:getZ() < -0.1)
|
||||||
-- recupero la lavorazione
|
-- recupero la lavorazione
|
||||||
local sMillType = 'Text'
|
local sMillType = EgtIf( not bMillAngTrasm, 'Text', 'Text_AT')
|
||||||
--local sMchExt = EgtIf( bMillDown, '_H2', '')
|
|
||||||
local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown)
|
local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown)
|
||||||
if not sMilling then
|
if not sMilling then
|
||||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
local sErr = 'Error : milling not found in library'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
@@ -88,11 +95,13 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId)
|
|||||||
-- aggiungo geometria
|
-- aggiungo geometria
|
||||||
EgtSetMachiningGeometry( {{ Proc.Id, -1}})
|
EgtSetMachiningGeometry( {{ Proc.Id, -1}})
|
||||||
-- imposto posizione braccio porta testa
|
-- imposto posizione braccio porta testa
|
||||||
if vtExtr:getY() <= 0 then
|
local nSCC = MCH_SCC.NONE
|
||||||
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
|
if bMillAngTrasm then
|
||||||
|
nSCC = MCH_SCC.ADIR_NEAR
|
||||||
else
|
else
|
||||||
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
|
nSCC = EgtIf( vtExtr:getY() <= 0, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)
|
||||||
end
|
end
|
||||||
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
@@ -112,11 +121,7 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId)
|
|||||||
-- aggiungo geometria
|
-- aggiungo geometria
|
||||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||||
-- imposto posizione braccio porta testa
|
-- imposto posizione braccio porta testa
|
||||||
if vtExtr:getY() <= 0 then
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||||
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
|
|
||||||
else
|
|
||||||
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
|
|
||||||
end
|
|
||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
|
|||||||
+121
-63
@@ -1,9 +1,18 @@
|
|||||||
-- ProcessMortise.lua by Egaltech s.r.l. 2021/12/01
|
-- ProcessMortise.lua by Egaltech s.r.l. 2023/08/10
|
||||||
-- Gestione calcolo mortase per Travi
|
-- Gestione calcolo mortase per Travi
|
||||||
-- 2021/07/20 Aggiunta gestione rinvio angolare su FAST.
|
-- 2021/07/20 Aggiunta gestione rinvio angolare su FAST.
|
||||||
-- 2021/12/01 Se frontale aggiungo taglio con Grp e Proc di vero taglio (per aggiornare ingombro di testa /coda).
|
-- 2021/12/01 Se frontale aggiungo taglio con Grp e Proc di vero taglio (per aggiornare ingombro di testa /coda).
|
||||||
-- 2022/07/26 Aggiunta gestione del parametro P04=1 per la pulizia degli angoli con mortasatrice (sega a catena) specifica
|
-- 2022/07/26 Aggiunta gestione del parametro P04=1 per la pulizia degli angoli con mortasatrice (sega a catena) specifica
|
||||||
-- 2022/07/29 Nella pulitura angoli aggiunto il check dimensioni tasca vs utensile. Corretta direzione utensile per mortasa frontale.
|
-- 2022/07/29 Nella pulitura angoli aggiunto il check dimensioni tasca vs utensile. Corretta direzione utensile per mortasa frontale.
|
||||||
|
-- 2022/09/27 Migliorata la scelta utensile. Se c'è almeno una lavorazione 'mortise' si cerca di usare quelle, riducendo l'elevazione se necessario.
|
||||||
|
-- Se non c'è nemmeno una lavorazione 'mortise' si passa alle pocket.
|
||||||
|
-- 2022/12/12 Migliorato controllo necessità CleanCorners.
|
||||||
|
-- 2023/01/31 Aggiunta gestione lavorazione in doppio.
|
||||||
|
-- 2023/01/31 Creata la funzione ConvertToClosedCurve (parte della ProcessMortise.Make) e spostata in BeamLib.
|
||||||
|
-- 2023/05/11 Se lavorazione in doppio e precedente no oppure di tipo diverso, forzo risalita a Zmax.
|
||||||
|
-- 2023/06/27 Esclusa la ricerca lati aperti per le mortase passanti, per le quali il contorno finisce sulla faccia e il riconoscimento sbaglia.
|
||||||
|
-- 2023/07/21 Correzioni per mortise passanti con curva Aux che guarda in basso.
|
||||||
|
-- 2023/08/10 Modificata scelta SCC per tasche in Y+/- in coda o quasi.
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local ProcessMortise = {}
|
local ProcessMortise = {}
|
||||||
@@ -33,6 +42,13 @@ function ProcessMortise.FrontIdentify( Proc)
|
|||||||
return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 51)
|
return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 51)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
-- Riconoscimento delle sole feature laterali
|
||||||
|
function ProcessMortise.SideIdentify( Proc)
|
||||||
|
return ( (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 50) or
|
||||||
|
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 53))
|
||||||
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
-- Classificazione della feature: decide se la feature è in una posizione che per lavorala
|
-- Classificazione della feature: decide se la feature è in una posizione che per lavorala
|
||||||
-- deve essere ribaltata o no
|
-- deve essere ribaltata o no
|
||||||
@@ -139,20 +155,21 @@ end
|
|||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
-- Pulizia angoli nel caso sia settato il parametro P04=1
|
-- Pulizia angoli nel caso sia settato il parametro P04=1
|
||||||
local function CleanCorners( Proc, dMorH, vtN, bDoubleDir, AuxId)
|
local function CleanCorners( Proc, dMorH, vtN, bDoubleDir, AuxId)
|
||||||
-- verifico se è attiva la pulizia e se l'orientamento della feature è adeguato
|
-- verifico se l'orientamento della feature è adeguato
|
||||||
local bCleanCorners = ( EgtGetInfo( Proc.Id, 'P04', 'i') == 1 and
|
local bCleanCorners = ( AreSameOrOppositeVectorApprox( vtN, X_AX()) or
|
||||||
( AreSameOrOppositeVectorApprox( vtN, X_AX()) or
|
AreSameOrOppositeVectorApprox( vtN, Y_AX()) or
|
||||||
AreSameOrOppositeVectorApprox( vtN, Y_AX()) or
|
AreSameOrOppositeVectorApprox( vtN, Z_AX()))
|
||||||
AreSameOrOppositeVectorApprox( vtN, Z_AX())))
|
|
||||||
if not bCleanCorners then
|
if not bCleanCorners then
|
||||||
EgtOutLog( 'Warning: mortising not aligned with XYZ axes, corner cleaning skipped')
|
local sWarn = 'Warning: mortising not aligned with XYZ axes, corner cleaning skipped'
|
||||||
return
|
EgtOutLog( sWarn)
|
||||||
|
return true, sWarn
|
||||||
end
|
end
|
||||||
-- cerco la lavorazione adatta
|
-- cerco la lavorazione adatta
|
||||||
local sMortisingCleanCorners = ML.FindSawing( 'Mortising')
|
local sMortisingCleanCorners = ML.FindSawing( 'Mortising')
|
||||||
if not sMortisingCleanCorners then
|
if not sMortisingCleanCorners then
|
||||||
EgtOutLog( 'Warning: mortising tool not found, corner cleaning skipped')
|
local sWarn = 'Warning: mortising tool not found, corner cleaning skipped'
|
||||||
return
|
EgtOutLog( sWarn)
|
||||||
|
return true, sWarn
|
||||||
end
|
end
|
||||||
-- recupero i dati dell'utensile
|
-- recupero i dati dell'utensile
|
||||||
local dSawWidth = 50
|
local dSawWidth = 50
|
||||||
@@ -229,6 +246,35 @@ local function CleanCorners( Proc, dMorH, vtN, bDoubleDir, AuxId)
|
|||||||
return true, sWarn
|
return true, sWarn
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
function ProcessMortise.VerifyMortiseOrPocket( Proc, dDiam, dDepth, dMaxTotLen, sType, bPocketDown, bExcludeH2)
|
||||||
|
-- ricerca della svuotatura
|
||||||
|
local sPocketing
|
||||||
|
if dDepth then
|
||||||
|
sPocketing = ML.FindPocketing( sType, dDiam, dDepth, dMaxTotLen, not bPocketDown, bPocketDown, bExcludeH2) or
|
||||||
|
ML.FindPocketing( sType, dDiam, 0.8 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown, bExcludeH2) or
|
||||||
|
ML.FindPocketing( sType, dDiam, 0.6 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown, bExcludeH2) or
|
||||||
|
ML.FindPocketing( sType, dDiam, 0.4 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown, bExcludeH2) or
|
||||||
|
ML.FindPocketing( sType, dDiam, 0, dMaxTotLen, bExcludeH2)
|
||||||
|
else
|
||||||
|
sPocketing = ML.FindPocketing( sType, dDiam, 0, dMaxTotLen, bExcludeH2)
|
||||||
|
end
|
||||||
|
if not sPocketing then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
-- recupero i dati dell'utensile
|
||||||
|
local dMaxDepth = 0
|
||||||
|
local dToolDiam = 0
|
||||||
|
if EgtMdbSetCurrMachining( sPocketing) then
|
||||||
|
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||||
|
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||||
|
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
|
||||||
|
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return sPocketing, dMaxDepth, dToolDiam
|
||||||
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
-- Applicazione della lavorazione
|
-- Applicazione della lavorazione
|
||||||
function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||||
@@ -251,36 +297,6 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
-- recupero versore estrusione della curva supplementare
|
|
||||||
local vtExtr = EgtCurveExtrusion( AuxId, GDB_ID.ROOT)
|
|
||||||
-- Se curva di contorno aperta
|
|
||||||
if not EgtCurveIsClosed( AuxId) then
|
|
||||||
local NewId, nCount = EgtExtractSurfTmFacetLoops( Proc.Id, 0, EgtGetParent( Proc.Id))
|
|
||||||
if NewId then
|
|
||||||
-- elimino eventuali loop interni (non dovrebbero comunque esserci)
|
|
||||||
for i = 1, nCount - 1 do
|
|
||||||
EgtErase( NewId + i)
|
|
||||||
end
|
|
||||||
-- sostituisco il loop esterno alla curva originale
|
|
||||||
EgtModifyCurveExtrusion( NewId, vtExtr, GDB_ID.ROOT)
|
|
||||||
EgtRelocate( NewId, AuxId, GDB_IN.AFTER)
|
|
||||||
EgtErase( AuxId)
|
|
||||||
EgtChangeId( NewId, AuxId)
|
|
||||||
-- sistemo i lati aperti
|
|
||||||
local vFacAdj = EgtSurfTmFacetAdjacencies( Proc.Id, 0)[1]
|
|
||||||
if vFacAdj then
|
|
||||||
local sOpen = ''
|
|
||||||
for i = 1, #vFacAdj do
|
|
||||||
if vFacAdj[i] < 0 then
|
|
||||||
sOpen = sOpen .. EgtIf( #sOpen > 0, ',', '') .. tostring( i - 1)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if #sOpen > 0 then
|
|
||||||
EgtSetInfo( AuxId, 'OPEN', sOpen)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- verifico se frontale
|
-- verifico se frontale
|
||||||
local bFront = ( Proc.Prc == 51)
|
local bFront = ( Proc.Prc == 51)
|
||||||
-- recupero i dati della faccia di fondo
|
-- recupero i dati della faccia di fondo
|
||||||
@@ -291,8 +307,16 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
ptC = frMor:getOrigin()
|
ptC = frMor:getOrigin()
|
||||||
vtN = frMor:getVersZ()
|
vtN = frMor:getVersZ()
|
||||||
end
|
end
|
||||||
|
-- recupero versore estrusione della curva supplementare
|
||||||
|
local vtExtr = EgtCurveExtrusion( AuxId, GDB_ID.ROOT)
|
||||||
-- Confronto le direzioni dei 2 versori : se diverse la faccia 0 non è il fondo => mortasa passante
|
-- Confronto le direzioni dei 2 versori : se diverse la faccia 0 non è il fondo => mortasa passante
|
||||||
local bOpenBtm = not AreSameVectorApprox( vtExtr, vtN)
|
local bOpenBtm = not AreSameVectorApprox( vtExtr, vtN)
|
||||||
|
-- se curva di contorno aperta la rendo chiusa
|
||||||
|
local _, bModif = BL.ConvertToClosedCurve( Proc, AuxId)
|
||||||
|
-- se la mortasa passante il contorno è sulla faccia della trave e il riconoscimento lati aperti non è corretto
|
||||||
|
if not bModif and not bOpenBtm then
|
||||||
|
BL.SetOpenSide( AuxId, b3Solid)
|
||||||
|
end
|
||||||
if bOpenBtm then
|
if bOpenBtm then
|
||||||
-- creo superficie chiusa
|
-- creo superficie chiusa
|
||||||
local nFlat = EgtSurfTmByFlatContour( EgtGetParent( AuxId), AuxId, 0.05)
|
local nFlat = EgtSurfTmByFlatContour( EgtGetParent( AuxId), AuxId, 0.05)
|
||||||
@@ -309,8 +333,10 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
-- se il percorso ausiliario è esterno al grezzo, lo riavvicino
|
-- se il percorso ausiliario è esterno al grezzo, lo riavvicino
|
||||||
if abs( dMove) > GEO.EPS_SMALL then
|
if abs( dMove) > GEO.EPS_SMALL then
|
||||||
AuxId = EgtCopyGlob( AuxId, BL.GetAddGroup( nPartId))
|
AuxId = EgtCopyGlob( AuxId, BL.GetAddGroup( nPartId))
|
||||||
EgtMove( AuxId, Vector3d(0,0,-dMove))
|
local vtMove = Vector3d(0,0,dMove)
|
||||||
EgtMove( nFlat, Vector3d(0,0,-dMove))
|
vtMove:toGlob(frMor)
|
||||||
|
EgtMove( AuxId, vtMove, GDB_RT.GLOB)
|
||||||
|
EgtMove( nFlat, vtMove, GDB_RT.GLOB)
|
||||||
frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( nFlat, 0, GDB_ID.ROOT)
|
frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( nFlat, 0, GDB_ID.ROOT)
|
||||||
ptC = frMor:getOrigin()
|
ptC = frMor:getOrigin()
|
||||||
vtN = frMor:getVersZ()
|
vtN = frMor:getVersZ()
|
||||||
@@ -385,18 +411,25 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
elseif bPockAngTrasm then
|
elseif bPockAngTrasm then
|
||||||
sMchExt = '_AT'
|
sMchExt = '_AT'
|
||||||
end
|
end
|
||||||
|
local bExcludeH2 = false
|
||||||
|
if Proc.Double and Proc.Double > 0 then
|
||||||
|
bPockUp = false
|
||||||
|
bPockDown = false
|
||||||
|
bExcludeH2 = true
|
||||||
|
sMchExt = ''
|
||||||
|
end
|
||||||
local sPocketing
|
local sPocketing
|
||||||
if Proc.Prc ~= 53 then
|
if Proc.Prc ~= 53 then
|
||||||
sPocketing = ML.FindPocketing( sPockType..sMchExt, dW, nil, nil, not bPockDown, bPockDown)
|
sPocketing = ProcessMortise.VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt, bPockDown, bExcludeH2)
|
||||||
if not sPocketing and bPockUp then
|
if not sPocketing and bPockUp then
|
||||||
sPocketing = ML.FindPocketing( sPockType, dW)
|
sPocketing = ProcessMortise.VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt, _, bExcludeH2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not sPocketing then
|
if not sPocketing then
|
||||||
sPockType = 'Pocket'
|
sPockType = 'Pocket'
|
||||||
sPocketing = ML.FindPocketing( sPockType..sMchExt, dW, nil, nil, not bPockDown, bPockDown)
|
sPocketing = ProcessMortise.VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt, bPockDown, bExcludeH2)
|
||||||
if not sPocketing and bPockUp then
|
if not sPocketing and bPockUp then
|
||||||
sPocketing = ML.FindPocketing( sPockType, dW)
|
sPocketing = ProcessMortise.VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt, _, bExcludeH2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not sPocketing then
|
if not sPocketing then
|
||||||
@@ -425,9 +458,9 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
-- verifico se invertire versore estrusione geometria
|
-- verifico se invertire direzione utensile
|
||||||
if bRevertSide then
|
if bRevertSide then
|
||||||
EgtModifyCurveExtrusion( AuxId, -vtExtr, GDB_ID.ROOT)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
end
|
end
|
||||||
-- aggiungo geometria
|
-- aggiungo geometria
|
||||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||||
@@ -437,11 +470,14 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
local nSCC = MCH_SCC.NONE
|
local nSCC = MCH_SCC.NONE
|
||||||
if bPockAngTrasm then
|
if bPockAngTrasm then
|
||||||
nSCC = MCH_SCC.ADIR_NEAR
|
nSCC = MCH_SCC.ADIR_NEAR
|
||||||
elseif not BD.C_SIMM then
|
elseif not BD.C_SIMM and not BD.TURN then
|
||||||
if abs( vtN:getX()) < GEO.EPS_SMALL and abs( vtN:getY()) < GEO.EPS_SMALL then
|
if AreSameOrOppositeVectorApprox( vtN, Z_AX()) then
|
||||||
nSCC = MCH_SCC.ADIR_YM
|
nSCC = MCH_SCC.ADIR_YM
|
||||||
elseif abs( vtN:getX()) < GEO.EPS_SMALL then
|
elseif abs( vtN:getX()) < 0.1 then
|
||||||
nSCC = MCH_SCC.ADIR_XP
|
local bNearTail = ( Proc.Box:getMax():getX() < b3Solid:getCenter():getX() and
|
||||||
|
Proc.Box:getMax():getX() - b3Solid:getMin():getX() < 1000)
|
||||||
|
local bVeryShortPart = ( BD.LEN_VERY_SHORT_PART and b3Solid:getDimX() < BD.LEN_VERY_SHORT_PART)
|
||||||
|
nSCC = EgtIf( BL.IsPartFinalPhase( EgtGetCurrPhase()) or ( bNearTail and not bVeryShortPart), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
|
||||||
elseif vtN:getY() < GEO.EPS_SMALL then
|
elseif vtN:getY() < GEO.EPS_SMALL then
|
||||||
nSCC = EgtIf( bRevertSide, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
nSCC = EgtIf( bRevertSide, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
||||||
else
|
else
|
||||||
@@ -468,13 +504,30 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
dMorH = dMaxDepth
|
dMorH = dMaxDepth
|
||||||
EgtOutLog( sWarn .. ' (process ' .. tostring( Proc.Id) .. ')')
|
EgtOutLog( sWarn .. ' (process ' .. tostring( Proc.Id) .. ')')
|
||||||
else
|
else
|
||||||
if bOpenBtm and not bForceOneSide then -- se mortasa passante setto metà profondità
|
-- se passante e lavorabile da due lati
|
||||||
|
if bOpenBtm and not bForceOneSide then
|
||||||
|
-- imposto metà profondità
|
||||||
nDepthMin = -dMorH
|
nDepthMin = -dMorH
|
||||||
EgtSetMachiningParam( MCH_MP.DEPTH, nDepthMin)
|
EgtSetMachiningParam( MCH_MP.DEPTH, nDepthMin)
|
||||||
|
-- se altrimenti passante ma lavorabile solo da un lato
|
||||||
|
elseif bOpenBtm and bForceOneSide then
|
||||||
|
if bRevertSide then
|
||||||
|
EgtSetMachiningParam( MCH_MP.DEPTH, min( dMorH + BD.CUT_EXTRA, dMaxDepth))
|
||||||
|
else
|
||||||
|
EgtSetMachiningParam( MCH_MP.DEPTH, min( BD.CUT_EXTRA, dMaxDepth - dMorH))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- imposto elevazione
|
-- imposto elevazione
|
||||||
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMorH, 1) .. ';')
|
local sUserNotes = 'MaxElev=' .. EgtNumToString( dMorH, 1) .. ';'
|
||||||
|
-- se lavorazione in doppio
|
||||||
|
if Proc.Double and Proc.Double > 0 then
|
||||||
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double)
|
||||||
|
if Proc.Double ~= Proc.PrevDouble then
|
||||||
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'StartZmax', 2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
@@ -493,7 +546,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
-- faccio la copia e la metto nel layer dedicato alle geometrie aggiunte
|
-- faccio la copia e la metto nel layer dedicato alle geometrie aggiunte
|
||||||
local AuxId_oppo = EgtCopyGlob( AuxId, BL.GetAddGroup(nPartId))
|
local AuxId_oppo = EgtCopyGlob( AuxId, BL.GetAddGroup(nPartId))
|
||||||
-- inverto la direzione estrusione di questa
|
-- inverto la direzione estrusione di questa
|
||||||
EgtModifyCurveExtrusion( AuxId_oppo, - vtExtr, GDB_ID.ROOT)
|
EgtModifyCurveExtrusion( AuxId_oppo, - vtExtr, GDB_ID.ROOT)
|
||||||
-- aggiungo geometria
|
-- aggiungo geometria
|
||||||
@@ -502,11 +555,14 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false))
|
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false))
|
||||||
-- imposto posizione braccio porta testa
|
-- imposto posizione braccio porta testa
|
||||||
local nSCC = MCH_SCC.NONE
|
local nSCC = MCH_SCC.NONE
|
||||||
if not BD.C_SIMM then
|
if not BD.C_SIMM and not BD.TURN then
|
||||||
if abs( vtN:getX()) < GEO.EPS_SMALL and abs( vtN:getY()) < GEO.EPS_SMALL then
|
if AreSameOrOppositeVectorApprox( vtN, Z_AX()) then
|
||||||
nSCC = MCH_SCC.ADIR_YM
|
nSCC = MCH_SCC.ADIR_YM
|
||||||
elseif abs( vtN:getX()) < GEO.EPS_SMALL then
|
elseif abs( vtN:getX()) < 0.1 then
|
||||||
nSCC = MCH_SCC.ADIR_XP
|
local bNearTail = ( Proc.Box:getMax():getX() < b3Solid:getCenter():getX() and
|
||||||
|
Proc.Box:getMax():getX() - b3Solid:getMin():getX() < 1000)
|
||||||
|
local bVeryShortPart = ( BD.LEN_VERY_SHORT_PART and b3Solid:getDimX() < BD.LEN_VERY_SHORT_PART)
|
||||||
|
nSCC = EgtIf( BL.IsPartFinalPhase( EgtGetCurrPhase()) or ( bNearTail and not bVeryShortPart), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
|
||||||
elseif vtN:getY() < GEO.EPS_SMALL then
|
elseif vtN:getY() < GEO.EPS_SMALL then
|
||||||
nSCC = MCH_SCC.ADIR_YP
|
nSCC = MCH_SCC.ADIR_YP
|
||||||
else
|
else
|
||||||
@@ -532,10 +588,12 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- verifico se necessaria la pulizia degli angoli ( tenone ad angoli non raggiati) e applico nel caso
|
-- verifico se necessaria la pulizia degli angoli ( tenone ad angoli non raggiati) e applico nel caso
|
||||||
local _, sWarn2 = CleanCorners( Proc, dMorH, vtN, bOpenBtm and not bForceOneSide, AuxId)
|
if ( EgtGetInfo( Proc.Id, 'P04', 'i') == 1) then
|
||||||
if sWarn2 then
|
local _, sWarn2 = CleanCorners( Proc, dMorH, vtN, bOpenBtm and not bForceOneSide, AuxId)
|
||||||
if not sWarn then sWarn = '' end
|
if sWarn2 then
|
||||||
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2)
|
if not sWarn then sWarn = '' end
|
||||||
|
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return true, sWarn
|
return true, sWarn
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
-- ProcessProfCamb.lua by Egaltech s.r.l. 2022/05/28
|
-- ProcessProfCamb.lua by Egaltech s.r.l. 2022/11/03
|
||||||
-- Gestione calcolo profilo caudato per Travi
|
-- Gestione calcolo profilo caudato per Travi
|
||||||
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto.
|
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto.
|
||||||
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
|
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
|
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
|
||||||
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
|
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
|
||||||
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
|
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
|
||||||
|
-- 2022/11/03 Correzione per riconoscimento testa da sotto su fresatura.
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local ProcessProfCamb = {}
|
local ProcessProfCamb = {}
|
||||||
@@ -315,12 +316,14 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
-- leggo anticipatamente i parametri utensile fresa per dare un valore opportuno all'elevazione della lama
|
-- leggo anticipatamente i parametri utensile fresa per dare un valore opportuno all'elevazione della lama
|
||||||
-- recupero la lavorazione di fresatura
|
-- recupero la lavorazione di fresatura
|
||||||
local sMillType = 'Prof'
|
local sMillType = 'Prof'
|
||||||
sMilling, _, _, bMillDown = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bMillDown)
|
local bH2
|
||||||
|
sMilling, _, _, bH2 = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bMillDown)
|
||||||
if not sMilling then
|
if not sMilling then
|
||||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
|
bMillDown = ( bMillDown and bH2)
|
||||||
-- Recupero i dati dell'utensile
|
-- Recupero i dati dell'utensile
|
||||||
if EgtMdbSetCurrMachining( sMilling) then
|
if EgtMdbSetCurrMachining( sMilling) then
|
||||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
-- ProcessProfConcave.lua by Egaltech s.r.l. 2022/05/28
|
-- ProcessProfConcave.lua by Egaltech s.r.l. 2023/07/31
|
||||||
-- Gestione calcolo profilo concavo per Travi
|
-- Gestione calcolo profilo concavo per Travi
|
||||||
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto.
|
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto.
|
||||||
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
|
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
|
||||||
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
|
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
|
||||||
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
|
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
|
||||||
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
|
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
|
||||||
|
-- 2023/05/25 Sistemazione SCC per TURN.
|
||||||
|
-- 2023/07/31 Correzione e semplificazione di ModifySideInvertLead per invert.
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local ProcessProfConcave = {}
|
local ProcessProfConcave = {}
|
||||||
@@ -88,7 +90,7 @@ end
|
|||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
|
local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
|
||||||
bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
|
bFirstTrim, bLastTrim, dOffsetPar)
|
||||||
|
|
||||||
-- confronto il punto iniziale e finale della lavorazione con il box della feature
|
-- confronto il punto iniziale e finale della lavorazione con il box della feature
|
||||||
-- e se è vicino alla parte esterna della trave inverto la lavorazione
|
-- e se è vicino alla parte esterna della trave inverto la lavorazione
|
||||||
@@ -96,6 +98,9 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
|
|||||||
local ptEp = EgtGetMachiningEndPoint()
|
local ptEp = EgtGetMachiningEndPoint()
|
||||||
local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE)
|
local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE)
|
||||||
if nMachMode == 1 and ptSP and ptEp then
|
if nMachMode == 1 and ptSP and ptEp then
|
||||||
|
-- recupero flag inversione direzione di lavorazione
|
||||||
|
local bInvertMode = EgtGetMachiningParam( MCH_MP.INVERT)
|
||||||
|
-- verifico se da aggiustare
|
||||||
if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) <
|
if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) <
|
||||||
abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptEp:getX()) then
|
abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptEp:getX()) then
|
||||||
-- ottengo il lato lavoro e lo inverto
|
-- ottengo il lato lavoro e lo inverto
|
||||||
@@ -103,9 +108,14 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
|
|||||||
if nSideWork > 0 then
|
if nSideWork > 0 then
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( nSideWork == MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT))
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( nSideWork == MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT))
|
||||||
end
|
end
|
||||||
-- ottengo l'inversione e setto il contrario
|
-- imposto il contrario dell'inversione trovata
|
||||||
local bInvertMode = EgtGetMachiningParam( MCH_MP.INVERT)
|
bInvertMode = not bInvertMode
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, not bInvertMode)
|
EgtSetMachiningParam( MCH_MP.INVERT, bInvertMode)
|
||||||
|
end
|
||||||
|
-- se lavorazione invertita rispetto a geometria, scambio dati di inizio e fine
|
||||||
|
if bInvertMode then
|
||||||
|
dLenIni, dLenLst = dLenLst, dLenIni
|
||||||
|
bFirstTrim, bLastTrim = bLastTrim, bFirstTrim
|
||||||
end
|
end
|
||||||
-- modifico attacco e uscita
|
-- modifico attacco e uscita
|
||||||
if dLenIni and dLenLst then
|
if dLenIni and dLenLst then
|
||||||
@@ -119,9 +129,6 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
|
|||||||
if bLastTrim and dLenLst < dToolDiam / 2 + ( 20 * GEO.EPS_SMALL) then
|
if bLastTrim and dLenLst < dToolDiam / 2 + ( 20 * GEO.EPS_SMALL) then
|
||||||
dEndAddLen = dToolDiam / 2 - dLenLst + dOffsetPar + 1
|
dEndAddLen = dToolDiam / 2 - dLenLst + dOffsetPar + 1
|
||||||
end
|
end
|
||||||
if bFlagInvert then
|
|
||||||
dStartAddLen, dEndAddLen = dEndAddLen, dStartAddLen
|
|
||||||
end
|
|
||||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dStartAddLen)
|
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dStartAddLen)
|
||||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
|
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
|
||||||
end
|
end
|
||||||
@@ -195,6 +202,25 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
|
|||||||
return nChamfer, dDepth, sMilling, sMilling2
|
return nChamfer, dDepth, sMilling, sMilling2
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
function GetSccForTurn( vtN, sType)
|
||||||
|
local nSCC
|
||||||
|
if abs( vtN:getZ()) > abs( vtN:getY()) then
|
||||||
|
if sType == 'V' then
|
||||||
|
nSCC = EgtIf( vtN:getZ() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_ZM)
|
||||||
|
else
|
||||||
|
nSCC = EgtIf( vtN:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if sType == 'V' then
|
||||||
|
nSCC = EgtIf( vtN:getY() > 0, MCH_SCC.ADIR_ZM, MCH_SCC.ADIR_ZP)
|
||||||
|
else
|
||||||
|
nSCC = EgtIf( vtN:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return nSCC
|
||||||
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
-- Applicazione della lavorazione
|
-- Applicazione della lavorazione
|
||||||
function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||||
@@ -227,8 +253,6 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
-- acquisisco informazioni sulle facce estreme
|
-- acquisisco informazioni sulle facce estreme
|
||||||
local _, _, dLenIni = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFirstFacet, GDB_ID.ROOT)
|
local _, _, dLenIni = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFirstFacet, GDB_ID.ROOT)
|
||||||
local _, _, dLenLst = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nLastFacet, GDB_ID.ROOT)
|
local _, _, dLenLst = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nLastFacet, GDB_ID.ROOT)
|
||||||
-- flag percorso invertito
|
|
||||||
local bFlagInvert = false
|
|
||||||
-- verifico se in testa o coda
|
-- verifico se in testa o coda
|
||||||
local bHead = ( vtN:getX() > 0)
|
local bHead = ( vtN:getX() > 0)
|
||||||
EgtOutLog( 'vtN=' .. tostring( vtN), 3)
|
EgtOutLog( 'vtN=' .. tostring( vtN), 3)
|
||||||
@@ -324,7 +348,6 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
( not bHead and vtExtr:getY() > 0.1) then
|
( not bHead and vtExtr:getY() > 0.1) then
|
||||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = not bFlagInvert
|
|
||||||
end
|
end
|
||||||
-- altrimenti lavorazione dal davanti o dal dietro
|
-- altrimenti lavorazione dal davanti o dal dietro
|
||||||
else
|
else
|
||||||
@@ -333,14 +356,12 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
if vtExtr:getZ() < 0 then
|
if vtExtr:getZ() < 0 then
|
||||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = not bFlagInvert
|
|
||||||
end
|
end
|
||||||
-- se lavorazione a destra da dietro o sinistra di fronte, inverto
|
-- se lavorazione a destra da dietro o sinistra di fronte, inverto
|
||||||
if ( bHead and vtN:getY() > 0.1) or
|
if ( bHead and vtN:getY() > 0.1) or
|
||||||
( not bHead and vtN:getY() < -0.1) then
|
( not bHead and vtN:getY() < -0.1) then
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = not bFlagInvert
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- assegno affondamento e offset radiale
|
-- assegno affondamento e offset radiale
|
||||||
@@ -358,7 +379,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
else
|
else
|
||||||
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
||||||
-- della feature inverto il punto di inizio della lavorazione
|
-- della feature inverto il punto di inizio della lavorazione
|
||||||
ModifySideInvertLead( Proc, bHead, dToolDiam + ( 2 * dExtra), dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dExtra)
|
ModifySideInvertLead( Proc, bHead, dToolDiam + ( 2 * dExtra), dLenIni, dLenLst, bFirstTrim, bLastTrim, dExtra)
|
||||||
end
|
end
|
||||||
-- se lavorazione da due parti, aggiungo la seconda
|
-- se lavorazione da due parti, aggiungo la seconda
|
||||||
if bDoubleCham then
|
if bDoubleCham then
|
||||||
@@ -373,8 +394,6 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
end
|
end
|
||||||
-- aggiungo geometria
|
-- aggiungo geometria
|
||||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||||
-- resetto il flag inversione percorso
|
|
||||||
bFlagInvert = false
|
|
||||||
-- se lavorazione da sopra o da sotto
|
-- se lavorazione da sopra o da sotto
|
||||||
if nSide ~= 0 then
|
if nSide ~= 0 then
|
||||||
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
||||||
@@ -382,7 +401,6 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
( not bHead and vtExtr:getY() < -0.1) then
|
( not bHead and vtExtr:getY() < -0.1) then
|
||||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = not bFlagInvert
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
||||||
@@ -390,7 +408,6 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
( not bHead and vtN:getY() < -0.1) then
|
( not bHead and vtN:getY() < -0.1) then
|
||||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = not bFlagInvert
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- assegno affondamento e offset radiale
|
-- assegno affondamento e offset radiale
|
||||||
@@ -408,7 +425,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
else
|
else
|
||||||
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
||||||
-- della feature inverto il punto di inizio della lavorazione
|
-- della feature inverto il punto di inizio della lavorazione
|
||||||
ModifySideInvertLead( Proc, bHead, dToolDiam + ( 2 * dExtra), dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dExtra)
|
ModifySideInvertLead( Proc, bHead, dToolDiam + ( 2 * dExtra), dLenIni, dLenLst, bFirstTrim, bLastTrim, dExtra)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -467,14 +484,11 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
end
|
end
|
||||||
-- aggiungo geometria
|
-- aggiungo geometria
|
||||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||||
-- resetto il flag inversione percorso
|
|
||||||
bFlagInvert = false
|
|
||||||
-- se lavorazione da sopra e da sotto
|
-- se lavorazione da sopra e da sotto
|
||||||
if ( nSide == 0) then
|
if ( nSide == 0) then
|
||||||
if vtExtr:getZ() > 0.1 then
|
if vtExtr:getZ() > 0.1 then
|
||||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = true
|
|
||||||
end
|
end
|
||||||
-- altrimenti lavorazione davanti e dietro
|
-- altrimenti lavorazione davanti e dietro
|
||||||
else
|
else
|
||||||
@@ -483,14 +497,13 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
( not bHead and vtExtr:getY() < -0.1) then
|
( not bHead and vtExtr:getY() < -0.1) then
|
||||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- imposto l'affondamento
|
-- imposto l'affondamento
|
||||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||||
-- posizione braccio porta testa
|
-- posizione braccio porta testa
|
||||||
local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
||||||
if BD.TURN then nSCC = MCH_SCC.ADIR_ZP end
|
if BD.TURN then nSCC = GetSccForTurn( vtN) end
|
||||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||||
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
|
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
|
||||||
local bFinish
|
local bFinish
|
||||||
@@ -514,7 +527,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
||||||
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
|
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
|
||||||
-- e uscita
|
-- e uscita
|
||||||
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
|
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, dOffsetPar)
|
||||||
end
|
end
|
||||||
-- se abilitata, aggiungo lavorazione di finitura
|
-- se abilitata, aggiungo lavorazione di finitura
|
||||||
if bFinish then
|
if bFinish then
|
||||||
@@ -548,8 +561,6 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
end
|
end
|
||||||
-- aggiungo geometria
|
-- aggiungo geometria
|
||||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||||
-- resetto il flag inversione percorso
|
|
||||||
bFlagInvert = false
|
|
||||||
-- se lavorazione da sopra o da sotto
|
-- se lavorazione da sopra o da sotto
|
||||||
if nSide ~= 0 then
|
if nSide ~= 0 then
|
||||||
if not bDouble and nSide == -1 then
|
if not bDouble and nSide == -1 then
|
||||||
@@ -558,7 +569,6 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
( not bHead and vtExtr:getY() < -0.1) then
|
( not bHead and vtExtr:getY() < -0.1) then
|
||||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = not bFlagInvert
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
||||||
@@ -566,7 +576,6 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
( not bHead and vtExtr:getY() > 0.1) then
|
( not bHead and vtExtr:getY() > 0.1) then
|
||||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = not bFlagInvert
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- altrimenti lavorazione dal davanti o dal dietro
|
-- altrimenti lavorazione dal davanti o dal dietro
|
||||||
@@ -575,14 +584,12 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
if vtExtr:getZ() < 0 then
|
if vtExtr:getZ() < 0 then
|
||||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = not bFlagInvert
|
|
||||||
end
|
end
|
||||||
-- se lavorazione a destra da dietro o sinistra di fronte, inverto
|
-- se lavorazione a destra da dietro o sinistra di fronte, inverto
|
||||||
if ( bHead and vtN:getY() > 0.1) or
|
if ( bHead and vtN:getY() > 0.1) or
|
||||||
( not bHead and vtN:getY() < -0.1) then
|
( not bHead and vtN:getY() < -0.1) then
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = not bFlagInvert
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- se in doppio, imposto l'affondamento
|
-- se in doppio, imposto l'affondamento
|
||||||
@@ -591,7 +598,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
end
|
end
|
||||||
-- posizione braccio porta testa
|
-- posizione braccio porta testa
|
||||||
local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
||||||
if BD.TURN then nSCC = MCH_SCC.ADIR_ZP end
|
if BD.TURN then nSCC = GetSccForTurn( vtN) end
|
||||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||||
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
|
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
|
||||||
local bFinish
|
local bFinish
|
||||||
@@ -611,7 +618,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
||||||
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
|
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
|
||||||
-- e uscita
|
-- e uscita
|
||||||
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
|
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, dOffsetPar)
|
||||||
end
|
end
|
||||||
-- se abilitata, aggiungo lavorazione di finitura
|
-- se abilitata, aggiungo lavorazione di finitura
|
||||||
if bFinish then
|
if bFinish then
|
||||||
@@ -656,14 +663,25 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_BACK)
|
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_BACK)
|
||||||
else
|
else
|
||||||
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTUP_TOP)
|
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTUP_TOP)
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, 1)
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||||
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( (dToolMaxDepth/2), 1))
|
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( (dToolMaxDepth/2), 1))
|
||||||
end
|
end
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, false)
|
EgtSetMachiningParam( MCH_MP.INVERT, false)
|
||||||
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH')
|
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH')
|
||||||
EgtSetMachiningParam( MCH_MP.STEP, 0)
|
EgtSetMachiningParam( MCH_MP.STEP, 0)
|
||||||
EgtSetMachiningParam( MCH_MP.OFFSR, 0)
|
EgtSetMachiningParam( MCH_MP.OFFSR, 0)
|
||||||
if BD.TURN then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) end
|
if BD.TURN then
|
||||||
|
local nSCC = GetSccForTurn( vtN, 'V')
|
||||||
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||||
|
-- modifico attacco e uscita per forzare risalita
|
||||||
|
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dToolDiam / 2)
|
||||||
|
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.TANGENT)
|
||||||
|
EgtSetMachiningParam( MCH_MP.LITANG, 20)
|
||||||
|
EgtSetMachiningParam( MCH_MP.LIPERP, 20)
|
||||||
|
EgtSetMachiningParam( MCH_MP.LIELEV, 20)
|
||||||
|
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dToolDiam / 2)
|
||||||
|
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.AS_LI)
|
||||||
|
end
|
||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
@@ -697,7 +715,10 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
EgtSetMachiningParam( MCH_MP.STEP, 0)
|
EgtSetMachiningParam( MCH_MP.STEP, 0)
|
||||||
EgtSetMachiningParam( MCH_MP.OFFSR, 0)
|
EgtSetMachiningParam( MCH_MP.OFFSR, 0)
|
||||||
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1))
|
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1))
|
||||||
if BD.TURN then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) end
|
if BD.TURN then
|
||||||
|
local nSCC = GetSccForTurn( vtN)
|
||||||
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||||
|
end
|
||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
-- ProcessProfConvex.lua by Egaltech s.r.l. 2022/05/28
|
-- ProcessProfConvex.lua by Egaltech s.r.l. 2023/07/31
|
||||||
-- Gestione calcolo profilo convesso per Travi
|
-- Gestione calcolo profilo convesso per Travi
|
||||||
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto.
|
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto.
|
||||||
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
|
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
|
||||||
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
|
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
|
||||||
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
|
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
|
||||||
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
|
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
|
||||||
|
-- 2023/05/25 Sistemazione SCC per TURN.
|
||||||
|
-- 2023/07/31 Correzione e semplificazione di ModifySideInvertLead per invert.
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local ProcessProfConvex = {}
|
local ProcessProfConvex = {}
|
||||||
@@ -88,7 +90,7 @@ end
|
|||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
|
local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
|
||||||
bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
|
bFirstTrim, bLastTrim, dOffsetPar)
|
||||||
|
|
||||||
-- confronto il punto iniziale e finale della lavorazione con il box della feature
|
-- confronto il punto iniziale e finale della lavorazione con il box della feature
|
||||||
-- e se è vicino alla parte esterna della trave inverto la lavorazione
|
-- e se è vicino alla parte esterna della trave inverto la lavorazione
|
||||||
@@ -96,6 +98,9 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
|
|||||||
local ptEp = EgtGetMachiningEndPoint()
|
local ptEp = EgtGetMachiningEndPoint()
|
||||||
local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE)
|
local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE)
|
||||||
if nMachMode == 1 and ptSP and ptEp then
|
if nMachMode == 1 and ptSP and ptEp then
|
||||||
|
-- recupero flag inversione direzione di lavorazione
|
||||||
|
local bInvertMode = EgtGetMachiningParam( MCH_MP.INVERT)
|
||||||
|
-- verifico se da aggiustare
|
||||||
if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) <
|
if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) <
|
||||||
abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptEp:getX()) then
|
abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptEp:getX()) then
|
||||||
-- ottengo il lato lavoro e lo inverto
|
-- ottengo il lato lavoro e lo inverto
|
||||||
@@ -103,9 +108,14 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
|
|||||||
if nSideWork > 0 then
|
if nSideWork > 0 then
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( nSideWork == MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT))
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( nSideWork == MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT))
|
||||||
end
|
end
|
||||||
-- ottengo l'inversione e setto il contrario
|
-- imposto il contrario dell'inversione trovata
|
||||||
local bInvertMode = EgtGetMachiningParam( MCH_MP.INVERT)
|
bInvertMode = not bInvertMode
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, not bInvertMode)
|
EgtSetMachiningParam( MCH_MP.INVERT, bInvertMode)
|
||||||
|
end
|
||||||
|
-- se lavorazione invertita rispetto a geometria, scambio dati di inizio e fine
|
||||||
|
if bInvertMode then
|
||||||
|
dLenIni, dLenLst = dLenLst, dLenIni
|
||||||
|
bFirstTrim, bLastTrim = bLastTrim, bFirstTrim
|
||||||
end
|
end
|
||||||
-- modifico attacco e uscita
|
-- modifico attacco e uscita
|
||||||
if dLenIni and dLenLst then
|
if dLenIni and dLenLst then
|
||||||
@@ -119,9 +129,6 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
|
|||||||
if bLastTrim and dLenLst < dToolDiam / 2 + ( 20 * GEO.EPS_SMALL) then
|
if bLastTrim and dLenLst < dToolDiam / 2 + ( 20 * GEO.EPS_SMALL) then
|
||||||
dEndAddLen = dToolDiam / 2 - dLenLst + dOffsetPar + 1
|
dEndAddLen = dToolDiam / 2 - dLenLst + dOffsetPar + 1
|
||||||
end
|
end
|
||||||
if bFlagInvert then
|
|
||||||
dStartAddLen, dEndAddLen = dEndAddLen, dStartAddLen
|
|
||||||
end
|
|
||||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dStartAddLen)
|
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dStartAddLen)
|
||||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
|
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
|
||||||
end
|
end
|
||||||
@@ -195,6 +202,25 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
|
|||||||
return nChamfer, dDepth, sMilling, sMilling2
|
return nChamfer, dDepth, sMilling, sMilling2
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
function GetSccForTurn( vtN, sType)
|
||||||
|
local nSCC
|
||||||
|
if abs( vtN:getZ()) > abs( vtN:getY()) then
|
||||||
|
if sType == 'V' then
|
||||||
|
nSCC = EgtIf( vtN:getZ() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_ZM)
|
||||||
|
else
|
||||||
|
nSCC = EgtIf( vtN:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if sType == 'V' then
|
||||||
|
nSCC = EgtIf( vtN:getY() > 0, MCH_SCC.ADIR_ZM, MCH_SCC.ADIR_ZP)
|
||||||
|
else
|
||||||
|
nSCC = EgtIf( vtN:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return nSCC
|
||||||
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
-- Applicazione della lavorazione
|
-- Applicazione della lavorazione
|
||||||
function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||||
@@ -227,8 +253,6 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
-- acquisisco informazioni sulle facce estreme
|
-- acquisisco informazioni sulle facce estreme
|
||||||
local _, _, dLenIni = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFirstFacet, GDB_ID.ROOT)
|
local _, _, dLenIni = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFirstFacet, GDB_ID.ROOT)
|
||||||
local _, _, dLenLst = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nLastFacet, GDB_ID.ROOT)
|
local _, _, dLenLst = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nLastFacet, GDB_ID.ROOT)
|
||||||
-- flag percorso invertito
|
|
||||||
local bFlagInvert = false
|
|
||||||
-- verifico se in testa o coda
|
-- verifico se in testa o coda
|
||||||
local bHead = ( vtN:getX() > 0)
|
local bHead = ( vtN:getX() > 0)
|
||||||
EgtOutLog( 'vtN=' .. tostring( vtN), 3)
|
EgtOutLog( 'vtN=' .. tostring( vtN), 3)
|
||||||
@@ -324,7 +348,6 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
( not bHead and vtExtr:getY() > 0.1) then
|
( not bHead and vtExtr:getY() > 0.1) then
|
||||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = not bFlagInvert
|
|
||||||
end
|
end
|
||||||
-- altrimenti lavorazione dal davanti o dal dietro
|
-- altrimenti lavorazione dal davanti o dal dietro
|
||||||
else
|
else
|
||||||
@@ -333,14 +356,12 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
if vtExtr:getZ() < 0 then
|
if vtExtr:getZ() < 0 then
|
||||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = not bFlagInvert
|
|
||||||
end
|
end
|
||||||
-- se lavorazione a destra da dietro o sinistra di fronte, inverto
|
-- se lavorazione a destra da dietro o sinistra di fronte, inverto
|
||||||
if ( bHead and vtN:getY() > 0.1) or
|
if ( bHead and vtN:getY() > 0.1) or
|
||||||
( not bHead and vtN:getY() < -0.1) then
|
( not bHead and vtN:getY() < -0.1) then
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = not bFlagInvert
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- assegno affondamento e offset radiale
|
-- assegno affondamento e offset radiale
|
||||||
@@ -358,7 +379,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
else
|
else
|
||||||
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
||||||
-- della feature inverto il punto di inizio della lavorazione
|
-- della feature inverto il punto di inizio della lavorazione
|
||||||
ModifySideInvertLead( Proc, bHead, dToolDiam + ( 2 * dExtra), dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dExtra)
|
ModifySideInvertLead( Proc, bHead, dToolDiam + ( 2 * dExtra), dLenIni, dLenLst, bFirstTrim, bLastTrim, dExtra)
|
||||||
end
|
end
|
||||||
-- se lavorazione da due parti, aggiungo la seconda
|
-- se lavorazione da due parti, aggiungo la seconda
|
||||||
if bDoubleCham then
|
if bDoubleCham then
|
||||||
@@ -373,8 +394,6 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
end
|
end
|
||||||
-- aggiungo geometria
|
-- aggiungo geometria
|
||||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||||
-- resetto il flag inversione percorso
|
|
||||||
bFlagInvert = false
|
|
||||||
-- se lavorazione da sopra o da sotto
|
-- se lavorazione da sopra o da sotto
|
||||||
if nSide ~= 0 then
|
if nSide ~= 0 then
|
||||||
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
||||||
@@ -382,7 +401,6 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
( not bHead and vtExtr:getY() < -0.1) then
|
( not bHead and vtExtr:getY() < -0.1) then
|
||||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = not bFlagInvert
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
||||||
@@ -390,7 +408,6 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
( not bHead and vtN:getY() < -0.1) then
|
( not bHead and vtN:getY() < -0.1) then
|
||||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = not bFlagInvert
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- assegno affondamento e offset radiale
|
-- assegno affondamento e offset radiale
|
||||||
@@ -408,7 +425,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
else
|
else
|
||||||
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
||||||
-- della feature inverto il punto di inizio della lavorazione
|
-- della feature inverto il punto di inizio della lavorazione
|
||||||
ModifySideInvertLead( Proc, bHead, dToolDiam + ( 2 * dExtra), dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dExtra)
|
ModifySideInvertLead( Proc, bHead, dToolDiam + ( 2 * dExtra), dLenIni, dLenLst, bFirstTrim, bLastTrim, dExtra)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -467,14 +484,11 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
end
|
end
|
||||||
-- aggiungo geometria
|
-- aggiungo geometria
|
||||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||||
-- resetto il flag inversione percorso
|
|
||||||
bFlagInvert = false
|
|
||||||
-- se lavorazione da sopra e da sotto
|
-- se lavorazione da sopra e da sotto
|
||||||
if ( nSide == 0) then
|
if ( nSide == 0) then
|
||||||
if vtExtr:getZ() > 0.1 then
|
if vtExtr:getZ() > 0.1 then
|
||||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = true
|
|
||||||
end
|
end
|
||||||
-- altrimenti lavorazione davanti e dietro
|
-- altrimenti lavorazione davanti e dietro
|
||||||
else
|
else
|
||||||
@@ -483,14 +497,13 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
( not bHead and vtExtr:getY() < -0.1) then
|
( not bHead and vtExtr:getY() < -0.1) then
|
||||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- imposto l'affondamento
|
-- imposto l'affondamento
|
||||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||||
-- posizione braccio porta testa
|
-- posizione braccio porta testa
|
||||||
local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
||||||
if BD.TURN then nSCC = MCH_SCC.ADIR_ZP end
|
if BD.TURN then nSCC = GetSccForTurn( vtN) end
|
||||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||||
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
|
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
|
||||||
local bFinish
|
local bFinish
|
||||||
@@ -514,7 +527,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
||||||
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
|
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
|
||||||
-- e uscita
|
-- e uscita
|
||||||
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
|
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, dOffsetPar)
|
||||||
end
|
end
|
||||||
-- se abilitata, aggiungo lavorazione di finitura
|
-- se abilitata, aggiungo lavorazione di finitura
|
||||||
if bFinish then
|
if bFinish then
|
||||||
@@ -548,8 +561,6 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
end
|
end
|
||||||
-- aggiungo geometria
|
-- aggiungo geometria
|
||||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||||
-- resetto il flag inversione percorso
|
|
||||||
bFlagInvert = false
|
|
||||||
-- se lavorazione da sopra o da sotto
|
-- se lavorazione da sopra o da sotto
|
||||||
if nSide ~= 0 then
|
if nSide ~= 0 then
|
||||||
if not bDouble and nSide == -1 then
|
if not bDouble and nSide == -1 then
|
||||||
@@ -558,7 +569,6 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
( not bHead and vtExtr:getY() < -0.1) then
|
( not bHead and vtExtr:getY() < -0.1) then
|
||||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = not bFlagInvert
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
||||||
@@ -566,7 +576,6 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
( not bHead and vtExtr:getY() > 0.1) then
|
( not bHead and vtExtr:getY() > 0.1) then
|
||||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = not bFlagInvert
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- altrimenti lavorazione dal davanti o dal dietro
|
-- altrimenti lavorazione dal davanti o dal dietro
|
||||||
@@ -575,14 +584,12 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
if vtExtr:getZ() < 0 then
|
if vtExtr:getZ() < 0 then
|
||||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = not bFlagInvert
|
|
||||||
end
|
end
|
||||||
-- se lavorazione a destra da dietro o sinistra di fronte, inverto
|
-- se lavorazione a destra da dietro o sinistra di fronte, inverto
|
||||||
if ( bHead and vtN:getY() > 0.1) or
|
if ( bHead and vtN:getY() > 0.1) or
|
||||||
( not bHead and vtN:getY() < -0.1) then
|
( not bHead and vtN:getY() < -0.1) then
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = not bFlagInvert
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- se in doppio, imposto l'affondamento
|
-- se in doppio, imposto l'affondamento
|
||||||
@@ -591,7 +598,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
end
|
end
|
||||||
-- posizione braccio porta testa
|
-- posizione braccio porta testa
|
||||||
local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
||||||
if BD.TURN then nSCC = MCH_SCC.ADIR_ZP end
|
if BD.TURN then nSCC = GetSccForTurn( vtN) end
|
||||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||||
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
|
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
|
||||||
local bFinish
|
local bFinish
|
||||||
@@ -611,7 +618,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
||||||
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
|
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
|
||||||
-- e uscita
|
-- e uscita
|
||||||
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
|
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, dOffsetPar)
|
||||||
end
|
end
|
||||||
-- se abilitata, aggiungo lavorazione di finitura
|
-- se abilitata, aggiungo lavorazione di finitura
|
||||||
if bFinish then
|
if bFinish then
|
||||||
@@ -656,14 +663,25 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_BACK)
|
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_BACK)
|
||||||
else
|
else
|
||||||
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTUP_TOP)
|
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTUP_TOP)
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, 1)
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||||
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( (dToolMaxDepth/2), 1))
|
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( (dToolMaxDepth/2), 1))
|
||||||
end
|
end
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, false)
|
EgtSetMachiningParam( MCH_MP.INVERT, false)
|
||||||
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH')
|
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH')
|
||||||
EgtSetMachiningParam( MCH_MP.STEP, 0)
|
EgtSetMachiningParam( MCH_MP.STEP, 0)
|
||||||
EgtSetMachiningParam( MCH_MP.OFFSR, 0)
|
EgtSetMachiningParam( MCH_MP.OFFSR, 0)
|
||||||
if BD.TURN then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) end
|
if BD.TURN then
|
||||||
|
local nSCC = GetSccForTurn( vtN, 'V')
|
||||||
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||||
|
-- modifico attacco e uscita per forzare risalita
|
||||||
|
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dToolDiam / 2)
|
||||||
|
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.TANGENT)
|
||||||
|
EgtSetMachiningParam( MCH_MP.LITANG, 20)
|
||||||
|
EgtSetMachiningParam( MCH_MP.LIPERP, 20)
|
||||||
|
EgtSetMachiningParam( MCH_MP.LIELEV, 20)
|
||||||
|
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dToolDiam / 2)
|
||||||
|
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.AS_LI)
|
||||||
|
end
|
||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
@@ -697,7 +715,10 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
EgtSetMachiningParam( MCH_MP.STEP, 0)
|
EgtSetMachiningParam( MCH_MP.STEP, 0)
|
||||||
EgtSetMachiningParam( MCH_MP.OFFSR, 0)
|
EgtSetMachiningParam( MCH_MP.OFFSR, 0)
|
||||||
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1))
|
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1))
|
||||||
if BD.TURN then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) end
|
if BD.TURN then
|
||||||
|
local nSCC = GetSccForTurn( vtN)
|
||||||
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||||
|
end
|
||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
|
|||||||
@@ -465,8 +465,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
return false, sErr
|
return false, sErr
|
||||||
else
|
else
|
||||||
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
||||||
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
|
-- della feature inverto il punto di inizio della lavorazione
|
||||||
-- e uscita
|
|
||||||
ModifySideInvertLead( Proc, bHead, dToolDiam)
|
ModifySideInvertLead( Proc, bHead, dToolDiam)
|
||||||
end
|
end
|
||||||
-- se abilitata, aggiungo lavorazione di finitura
|
-- se abilitata, aggiungo lavorazione di finitura
|
||||||
@@ -554,8 +553,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
return false, sErr
|
return false, sErr
|
||||||
else
|
else
|
||||||
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
||||||
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
|
-- della feature inverto il punto di inizio della lavorazione
|
||||||
-- e uscita
|
|
||||||
ModifySideInvertLead( Proc, bHead, dToolDiam)
|
ModifySideInvertLead( Proc, bHead, dToolDiam)
|
||||||
end
|
end
|
||||||
-- se abilitata, aggiungo lavorazione di finitura
|
-- se abilitata, aggiungo lavorazione di finitura
|
||||||
|
|||||||
+18
-29
@@ -1,4 +1,4 @@
|
|||||||
-- ProcessProfHead.lua by Egaltech s.r.l. 2022/05/28
|
-- ProcessProfHead.lua by Egaltech s.r.l. 2023/07/31
|
||||||
-- Gestione calcolo profilo di testa per Travi
|
-- Gestione calcolo profilo di testa per Travi
|
||||||
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa sotto.
|
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa sotto.
|
||||||
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
|
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
|
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
|
||||||
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
|
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
|
||||||
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
|
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
|
||||||
|
-- 2023/07/31 Correzione e semplificazione di ModifySideInvertLead per invert.
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local ProcessProfHead = {}
|
local ProcessProfHead = {}
|
||||||
@@ -81,7 +82,7 @@ end
|
|||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
|
local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
|
||||||
bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
|
bFirstTrim, bLastTrim, dOffsetPar)
|
||||||
|
|
||||||
-- confronto il punto iniziale e finale della lavorazione con il box della feature
|
-- confronto il punto iniziale e finale della lavorazione con il box della feature
|
||||||
-- e se è vicino alla parte esterna della trave inverto la lavorazione
|
-- e se è vicino alla parte esterna della trave inverto la lavorazione
|
||||||
@@ -89,6 +90,9 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
|
|||||||
local ptEp = EgtGetMachiningEndPoint()
|
local ptEp = EgtGetMachiningEndPoint()
|
||||||
local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE)
|
local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE)
|
||||||
if nMachMode == 1 and ptSP and ptEp then
|
if nMachMode == 1 and ptSP and ptEp then
|
||||||
|
-- recupero flag inversione direzione di lavorazione
|
||||||
|
local bInvertMode = EgtGetMachiningParam( MCH_MP.INVERT)
|
||||||
|
-- verifico se da aggiustare
|
||||||
if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) <
|
if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) <
|
||||||
abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptEp:getX()) then
|
abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptEp:getX()) then
|
||||||
-- ottengo il lato lavoro e lo inverto
|
-- ottengo il lato lavoro e lo inverto
|
||||||
@@ -96,9 +100,14 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
|
|||||||
if nSideWork > 0 then
|
if nSideWork > 0 then
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( nSideWork == MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT))
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( nSideWork == MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT))
|
||||||
end
|
end
|
||||||
-- ottengo l'inversione e setto il contrario
|
-- imposto il contrario dell'inversione trovata
|
||||||
local bInvertMode = EgtGetMachiningParam( MCH_MP.INVERT)
|
bInvertMode = not bInvertMode
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, not bInvertMode)
|
EgtSetMachiningParam( MCH_MP.INVERT, bInvertMode)
|
||||||
|
end
|
||||||
|
-- se lavorazione invertita rispetto a geometria, scambio dati di inizio e fine
|
||||||
|
if bInvertMode then
|
||||||
|
dLenIni, dLenLst = dLenLst, dLenIni
|
||||||
|
bFirstTrim, bLastTrim = bLastTrim, bFirstTrim
|
||||||
end
|
end
|
||||||
-- modifico attacco e uscita
|
-- modifico attacco e uscita
|
||||||
if dLenIni and dLenLst then
|
if dLenIni and dLenLst then
|
||||||
@@ -112,9 +121,6 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
|
|||||||
if bLastTrim and dLenLst < dToolDiam / 2 + ( 20 * GEO.EPS_SMALL) then
|
if bLastTrim and dLenLst < dToolDiam / 2 + ( 20 * GEO.EPS_SMALL) then
|
||||||
dEndAddLen = dToolDiam / 2 - dLenLst + dOffsetPar + 1
|
dEndAddLen = dToolDiam / 2 - dLenLst + dOffsetPar + 1
|
||||||
end
|
end
|
||||||
if bFlagInvert then
|
|
||||||
dStartAddLen, dEndAddLen = dEndAddLen, dStartAddLen
|
|
||||||
end
|
|
||||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dStartAddLen)
|
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dStartAddLen)
|
||||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
|
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
|
||||||
end
|
end
|
||||||
@@ -224,8 +230,6 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
-- acquisisco informazioni sulle facce estreme
|
-- acquisisco informazioni sulle facce estreme
|
||||||
local _, _, dLenIni = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFirstFacet, GDB_ID.ROOT)
|
local _, _, dLenIni = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFirstFacet, GDB_ID.ROOT)
|
||||||
local _, _, dLenLst = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nLastFacet, GDB_ID.ROOT)
|
local _, _, dLenLst = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nLastFacet, GDB_ID.ROOT)
|
||||||
-- flag percorso invertito
|
|
||||||
local bFlagInvert = false
|
|
||||||
-- verifico se in testa o coda
|
-- verifico se in testa o coda
|
||||||
local bHead = ( vtN:getX() > 0)
|
local bHead = ( vtN:getX() > 0)
|
||||||
EgtOutLog( 'vtN=' .. tostring( vtN), 3)
|
EgtOutLog( 'vtN=' .. tostring( vtN), 3)
|
||||||
@@ -326,7 +330,6 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
( not bHead and vtExtr:getY() > 0.1) then
|
( not bHead and vtExtr:getY() > 0.1) then
|
||||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = not bFlagInvert
|
|
||||||
end
|
end
|
||||||
-- altrimenti lavorazione dal davanti o dal dietro
|
-- altrimenti lavorazione dal davanti o dal dietro
|
||||||
else
|
else
|
||||||
@@ -335,14 +338,12 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
if vtExtr:getZ() < 0 then
|
if vtExtr:getZ() < 0 then
|
||||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = not bFlagInvert
|
|
||||||
end
|
end
|
||||||
-- se lavorazione a destra da dietro o sinistra di fronte, inverto
|
-- se lavorazione a destra da dietro o sinistra di fronte, inverto
|
||||||
if ( bHead and vtN:getY() > 0.1) or
|
if ( bHead and vtN:getY() > 0.1) or
|
||||||
( not bHead and vtN:getY() < -0.1) then
|
( not bHead and vtN:getY() < -0.1) then
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = not bFlagInvert
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- assegno affondamento e offset radiale
|
-- assegno affondamento e offset radiale
|
||||||
@@ -361,7 +362,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
||||||
-- della feature inverto il punto di inizio della lavorazione
|
-- della feature inverto il punto di inizio della lavorazione
|
||||||
ModifySideInvertLead( Proc, bHead, dToolDiam + ( 2 * dExtra), dLenIni,
|
ModifySideInvertLead( Proc, bHead, dToolDiam + ( 2 * dExtra), dLenIni,
|
||||||
dLenLst, ( #vAngs > 0 and vAngs[1] == 0), ( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2)), bFlagInvert, dExtra)
|
dLenLst, ( #vAngs > 0 and vAngs[1] == 0), ( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2)), dExtra)
|
||||||
end
|
end
|
||||||
-- se lavorazione da due parti, aggiungo la seconda
|
-- se lavorazione da due parti, aggiungo la seconda
|
||||||
if bDoubleCham then
|
if bDoubleCham then
|
||||||
@@ -376,8 +377,6 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
end
|
end
|
||||||
-- aggiungo geometria
|
-- aggiungo geometria
|
||||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||||
-- resetto il flag inversione percorso
|
|
||||||
bFlagInvert = false
|
|
||||||
-- se lavorazione da sopra o da sotto
|
-- se lavorazione da sopra o da sotto
|
||||||
if nSide ~= 0 then
|
if nSide ~= 0 then
|
||||||
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
||||||
@@ -385,7 +384,6 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
( not bHead and vtExtr:getY() < -0.1) then
|
( not bHead and vtExtr:getY() < -0.1) then
|
||||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = not bFlagInvert
|
|
||||||
end
|
end
|
||||||
-- altrimenti lavorazione dal davanti o dal dietro
|
-- altrimenti lavorazione dal davanti o dal dietro
|
||||||
else
|
else
|
||||||
@@ -394,7 +392,6 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
( not bHead and vtN:getY() < -0.1) then
|
( not bHead and vtN:getY() < -0.1) then
|
||||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = not bFlagInvert
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- assegno affondamento e offset radiale
|
-- assegno affondamento e offset radiale
|
||||||
@@ -413,7 +410,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
||||||
-- della feature inverto il punto di inizio della lavorazione
|
-- della feature inverto il punto di inizio della lavorazione
|
||||||
ModifySideInvertLead( Proc, bHead, dToolDiam + ( 2 * dExtra), dLenIni,
|
ModifySideInvertLead( Proc, bHead, dToolDiam + ( 2 * dExtra), dLenIni,
|
||||||
dLenLst, ( #vAngs > 0 and vAngs[1] == 0), ( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2)), bFlagInvert, dExtra)
|
dLenLst, ( #vAngs > 0 and vAngs[1] == 0), ( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2)), dExtra)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -473,8 +470,6 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
end
|
end
|
||||||
-- aggiungo geometria
|
-- aggiungo geometria
|
||||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||||
-- resetto il flag inversione percorso
|
|
||||||
bFlagInvert = false
|
|
||||||
-- se lavorazione da sopra e da sotto
|
-- se lavorazione da sopra e da sotto
|
||||||
if ( nSide == 0) then
|
if ( nSide == 0) then
|
||||||
if vtExtr:getZ() > 0.1 then
|
if vtExtr:getZ() > 0.1 then
|
||||||
@@ -517,7 +512,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
|
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
|
||||||
-- e uscita
|
-- e uscita
|
||||||
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni,
|
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni,
|
||||||
dLenLst, ( #vAngs > 0 and vAngs[1] == 0), ( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2)), bFlagInvert, dOffsetPar)
|
dLenLst, ( #vAngs > 0 and vAngs[1] == 0), ( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2)), dOffsetPar)
|
||||||
end
|
end
|
||||||
-- se abilitata, aggiungo lavorazione di finitura
|
-- se abilitata, aggiungo lavorazione di finitura
|
||||||
if bFinish then
|
if bFinish then
|
||||||
@@ -551,8 +546,6 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
end
|
end
|
||||||
-- aggiungo geometria
|
-- aggiungo geometria
|
||||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||||
-- resetto il flag inversione percorso
|
|
||||||
bFlagInvert = false
|
|
||||||
-- se lavorazione da sopra o da sotto
|
-- se lavorazione da sopra o da sotto
|
||||||
if nSide ~= 0 then
|
if nSide ~= 0 then
|
||||||
if not bDouble and nSide == -1 then
|
if not bDouble and nSide == -1 then
|
||||||
@@ -561,7 +554,6 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
( not bHead and vtExtr:getY() < -0.1) then
|
( not bHead and vtExtr:getY() < -0.1) then
|
||||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = not bFlagInvert
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
||||||
@@ -569,7 +561,6 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
( not bHead and vtExtr:getY() > 0.1) then
|
( not bHead and vtExtr:getY() > 0.1) then
|
||||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = not bFlagInvert
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- altrimenti lavorazione dal davanti o dal dietro
|
-- altrimenti lavorazione dal davanti o dal dietro
|
||||||
@@ -578,14 +569,12 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
if vtExtr:getZ() < 0 then
|
if vtExtr:getZ() < 0 then
|
||||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = not bFlagInvert
|
|
||||||
end
|
end
|
||||||
-- se lavorazione a destra da dietro o sinistra di fronte, inverto
|
-- se lavorazione a destra da dietro o sinistra di fronte, inverto
|
||||||
if ( bHead and vtN:getY() > 0.1) or
|
if ( bHead and vtN:getY() > 0.1) or
|
||||||
( not bHead and vtN:getY() < -0.1) then
|
( not bHead and vtN:getY() < -0.1) then
|
||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||||
bFlagInvert = not bFlagInvert
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- se in doppio, imposto l'affondamento
|
-- se in doppio, imposto l'affondamento
|
||||||
@@ -613,7 +602,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
|||||||
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
|
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
|
||||||
-- e uscita
|
-- e uscita
|
||||||
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni,
|
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni,
|
||||||
dLenLst, ( #vAngs > 0 and vAngs[1] == 0), ( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2)), bFlagInvert, dOffsetPar)
|
dLenLst, ( #vAngs > 0 and vAngs[1] == 0), ( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2)), dOffsetPar)
|
||||||
end
|
end
|
||||||
-- se abilitata, aggiungo lavorazione di finitura
|
-- se abilitata, aggiungo lavorazione di finitura
|
||||||
if bFinish then
|
if bFinish then
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
-- ProcessRidgeLap.lua by Egaltech s.r.l. 2021/09/10
|
-- ProcessRidgeLap.lua by Egaltech s.r.l. 2023/08/10
|
||||||
-- Gestione calcolo mezzolegno di testa per Travi
|
-- Gestione calcolo mezzolegno di testa per Travi
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
@@ -26,8 +26,8 @@ end
|
|||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
-- Classificazione della feature
|
-- Classificazione della feature
|
||||||
function ProcessRidgeLap.Classify( Proc, b3Raw)
|
function ProcessRidgeLap.Classify( Proc, b3Raw)
|
||||||
-- se PF con testa da sotto, ammessa qualunque orientazione
|
-- se PF con testa da sotto oppure TURN, ammessa qualunque orientazione
|
||||||
if BD.C_SIMM and BD.DOWN_HEAD then
|
if ( BD.C_SIMM and BD.DOWN_HEAD) or BD.TURN then
|
||||||
return true, false
|
return true, false
|
||||||
end
|
end
|
||||||
-- Se più corta del limite si può fare anche da sotto
|
-- Se più corta del limite si può fare anche da sotto
|
||||||
@@ -195,7 +195,7 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
-- aggiornamento ingombro di testa o coda
|
-- aggiornamento ingombro di testa o coda
|
||||||
if Proc.Head then
|
if Proc.Head then
|
||||||
local dHCI = 0
|
local dHCI = 0
|
||||||
if abs( vtN[vFaceOrd[3]]:getZ()) > 0.1 then
|
if vtN[vFaceOrd[3]]:getZ() > 0.1 then
|
||||||
local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD)
|
local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD)
|
||||||
if b3Fac1 then dHCI = b3Raw:getMax():getX() - dOvmHead - b3Fac1:getMin():getX() end
|
if b3Fac1 then dHCI = b3Raw:getMax():getX() - dOvmHead - b3Fac1:getMin():getX() end
|
||||||
else
|
else
|
||||||
@@ -204,7 +204,7 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
BL.UpdateHCING( nRawId, dHCI)
|
BL.UpdateHCING( nRawId, dHCI)
|
||||||
elseif Proc.Tail then
|
elseif Proc.Tail then
|
||||||
local dTCI = 0
|
local dTCI = 0
|
||||||
if abs( vtN[vFaceOrd[3]]:getZ()) > 0.1 then
|
if vtN[vFaceOrd[3]]:getZ() > 0.1 then
|
||||||
local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD)
|
local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD)
|
||||||
if b3Fac1 then dTCI = b3Fac1:getMax():getX() - b3Solid:getMin():getX() end
|
if b3Fac1 then dTCI = b3Fac1:getMax():getX() - b3Solid:getMin():getX() end
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
-- ProcessRoundArch.lua by Egaltech s.r.l. 2021/01/29
|
-- ProcessRoundArch.lua by Egaltech s.r.l. 2023/05/18
|
||||||
-- Gestione calcolo archi per Travi
|
-- Gestione calcolo archi per Travi
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
@@ -93,6 +93,8 @@ function ProcessRoundArch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
|
-- normale alla superficie nel mezzo
|
||||||
|
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, Proc.Fct // 2, GDB_RT.GLOB)
|
||||||
-- recupero e verifico l'entità curva
|
-- recupero e verifico l'entità curva
|
||||||
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
|
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
|
||||||
if AuxId then AuxId = AuxId + Proc.Id end
|
if AuxId then AuxId = AuxId + Proc.Id end
|
||||||
@@ -222,13 +224,27 @@ function ProcessRoundArch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
||||||
end
|
end
|
||||||
-- posizione braccio porta testa
|
-- posizione braccio porta testa
|
||||||
if Proc.Head then
|
local nSCC = MCH_SCC.NONE
|
||||||
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_XP)
|
if not BD.C_SIMM and not BD.TURN then
|
||||||
elseif Proc.Tail then
|
if Proc.Head then
|
||||||
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_XM)
|
nSCC = MCH_SCC.ADIR_XP
|
||||||
elseif AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then
|
elseif Proc.Tail then
|
||||||
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
|
nSCC = MCH_SCC.ADIR_XM
|
||||||
|
elseif AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then
|
||||||
|
nSCC = MCH_SCC.ADIR_YP
|
||||||
|
end
|
||||||
|
elseif BD.TURN then
|
||||||
|
if vtN:getZ() > 0.707 then
|
||||||
|
nSCC = MCH_SCC.ADIR_ZP
|
||||||
|
elseif vtN:getZ() < -0.707 then
|
||||||
|
nSCC = MCH_SCC.ADIR_ZM
|
||||||
|
elseif vtN:getY() > 0.707 then
|
||||||
|
nSCC = MCH_SCC.ADIR_YP
|
||||||
|
elseif vtN:getY() < -0.707 then
|
||||||
|
nSCC = MCH_SCC.ADIR_YM
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
-- ProcessSawCut.lua by Egaltech s.r.l. 2022/03/07
|
-- ProcessSawCut.lua by Egaltech s.r.l. 2022/12/19
|
||||||
-- Gestione calcolo taglio di lama per Travi
|
-- Gestione calcolo taglio di lama per Travi
|
||||||
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
|
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe).
|
||||||
|
-- 2022/12/19 Aggiunta gestione testa da sotto.
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local ProcessSawCut = {}
|
local ProcessSawCut = {}
|
||||||
@@ -80,8 +81,12 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
|
|||||||
end
|
end
|
||||||
-- recupero flag per inizio e fine interni
|
-- recupero flag per inizio e fine interni
|
||||||
local bInside = (( EgtGetInfo( Proc.Id, 'Q01', 'i') or 0) ~= 0)
|
local bInside = (( EgtGetInfo( Proc.Id, 'Q01', 'i') or 0) ~= 0)
|
||||||
|
-- abilitazione lavorazione da sotto
|
||||||
|
local bDownHead = ( BD.DOWN_HEAD and vtDir:getZ() < -0.341)
|
||||||
|
local bTopHead = ( BD.DOWN_HEAD and ( vtDir:getZ() > -0.342 or not bDownHead))
|
||||||
-- recupero la lavorazione
|
-- recupero la lavorazione
|
||||||
local sCutting = ML.FindCutting( 'HeadSide')
|
local sCutting
|
||||||
|
sCutting, bDownHead = ML.FindCutting( 'HeadSide', bTopHead, bDownHead)
|
||||||
if not sCutting then
|
if not sCutting then
|
||||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library'
|
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
@@ -101,7 +106,7 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
|
|||||||
end
|
end
|
||||||
-- determino se lavorazione da davanti o da dietro e se da sotto
|
-- determino se lavorazione da davanti o da dietro e se da sotto
|
||||||
local bFront = ( vtDir ^ vtN):getX() > 0
|
local bFront = ( vtDir ^ vtN):getX() > 0
|
||||||
local bDownUp = ( vtN:getZ() < -0.259)
|
local bDownUp = ( not bDownHead and vtN:getZ() < -0.259)
|
||||||
local bFillAreaPiece
|
local bFillAreaPiece
|
||||||
-- se non da sotto
|
-- se non da sotto
|
||||||
if not bDownUp then
|
if not bDownUp then
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
-- ProcessScarfJoint.lua by Egaltech s.r.l. 2022/07/12
|
-- ProcessScarfJoint.lua by Egaltech s.r.l. 2022/09/30
|
||||||
-- Gestione calcolo giunto Gerber per Travi
|
-- Gestione calcolo giunto Gerber per Travi
|
||||||
-- 2021/06/28 Aggiunto extra-taglio alle lamate orizzontali.
|
-- 2021/06/28 Aggiunto extra-taglio alle lamate orizzontali.
|
||||||
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
|
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
|
||||||
-- 2022/07/12 Aggiunta gestione PF1250 e TURN.
|
-- 2022/07/12 Aggiunta gestione PF1250 e TURN.
|
||||||
|
-- 2023/02/14 Gestite le rotazioni di 90 deg nell'aggiornamento del grezzo.
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local ProcessScarfJoint = {}
|
local ProcessScarfJoint = {}
|
||||||
@@ -100,7 +101,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
EgtSetOperationMode( nMchId, false)
|
EgtSetOperationMode( nMch1Id, false)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
-- Inserisco la lavorazione del lato opposto
|
-- Inserisco la lavorazione del lato opposto
|
||||||
@@ -123,7 +124,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
EgtSetOperationMode( nMchId, false)
|
EgtSetOperationMode( nMch2Id, false)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
@@ -173,7 +174,11 @@ local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Soli
|
|||||||
if vtO then
|
if vtO then
|
||||||
vtOrthoO = Vector3d( vtO)
|
vtOrthoO = Vector3d( vtO)
|
||||||
else
|
else
|
||||||
vtOrthoO = Y_AX()
|
if vtN[vFaceOrd[4]]:getZ() < 0.1 then
|
||||||
|
vtOrthoO = Z_AX()
|
||||||
|
else
|
||||||
|
vtOrthoO = Y_AX()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -310,10 +315,12 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa
|
|||||||
end
|
end
|
||||||
-- recupero i dati dell'utensile
|
-- recupero i dati dell'utensile
|
||||||
local dSawDiam = 400
|
local dSawDiam = 400
|
||||||
|
local dMaxDepth = 0
|
||||||
if EgtMdbSetCurrMachining( sCutting) then
|
if EgtMdbSetCurrMachining( sCutting) then
|
||||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||||
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
|
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
|
||||||
|
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -346,7 +353,6 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa
|
|||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
|
|
||||||
-- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
|
-- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
|
||||||
nGoodFace1 = EgtSurfTmFacetCount( nFace1)
|
nGoodFace1 = EgtSurfTmFacetCount( nFace1)
|
||||||
nGoodFace4 = EgtSurfTmFacetCount( nFace4)
|
nGoodFace4 = EgtSurfTmFacetCount( nFace4)
|
||||||
@@ -356,21 +362,27 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa
|
|||||||
nGoodFace1 = EgtSurfTmFacetCount( nFace1)
|
nGoodFace1 = EgtSurfTmFacetCount( nFace1)
|
||||||
end
|
end
|
||||||
|
|
||||||
local bOkd, sErrD, vCuts = ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Solid, ptC, vtN, Proc, vtRef, bHead, sCutting, dSawDiam, b3Raw)
|
-- per macchina TURN aggiusto massima dimensione cubetto
|
||||||
|
local dNewDiceDim
|
||||||
|
if BD.TURN and nGoodFace4 and nGoodFace4 > 0 then
|
||||||
|
local dDimRef = EgtIf( abs( vtN[vFaceOrd[4]]:getZ()) < 0.1, b3Raw:getDimZ(), b3Raw:getDimY())
|
||||||
|
if dDimRef + BD.CUT_EXTRA < dMaxDepth then
|
||||||
|
dNewDiceDim = - ( dMaxDepth - BD.CUT_EXTRA)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local bOkd, sErrD, vCuts = ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Solid, ptC, vtN, Proc, vtRef, bHead, sCutting, dSawDiam, b3Raw, dNewDiceDim)
|
||||||
if not bOkd then return bOkd, sErrD end
|
if not bOkd then return bOkd, sErrD end
|
||||||
|
|
||||||
if #vCuts == 0 then
|
if #vCuts == 0 then
|
||||||
-- se ho la faccia intermedia, per prima cosa verifico se ho intersezione con la faccia tappo
|
-- se ho la faccia intermedia, per prima cosa verifico se ho intersezione con la faccia tappo
|
||||||
if nGoodFace4 ~= 0 then
|
if nGoodFace4 ~= 0 then
|
||||||
-- taglio sulla faccia interna
|
|
||||||
if vFaceOrd[1] ~= 0 then
|
|
||||||
-- inserisco la lavorazione
|
|
||||||
local vtOrthoO = Vector3d( vtRef)
|
|
||||||
bOkd, sErrD = Fbs.MakeOne( Proc.Id, vFaceOrd[1] - 1, sCutting, dSawDiam, vtOrthoO, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
|
||||||
if not bOkd then return bOkd, sErrD end
|
|
||||||
end
|
|
||||||
-- se non ho intersezione con la faccia tappo posso fare il taglio sul fianco
|
-- se non ho intersezione con la faccia tappo posso fare il taglio sul fianco
|
||||||
if not nGoodFace1 or nGoodFace1 == 0 then
|
if not nGoodFace1 or nGoodFace1 == 0 then
|
||||||
|
-- inserisco la lavorazione
|
||||||
|
local vtRef2 = EgtIf( abs(vtRef:getZ()) < GEO.EPS_SMALL, Z_AX(), EgtIf( bHead, Y_AX(), -Y_AX()))
|
||||||
|
bOkd, sErrD = Fbs.MakeOne( nFace4, nGoodFace4 - 1, sCutting, dSawDiam, vtRef2, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||||
|
if not bOkd then return bOkd, sErrD end
|
||||||
-- lavoro la faccia opposta (definita dal parametro P11)
|
-- lavoro la faccia opposta (definita dal parametro P11)
|
||||||
if vFaceOrd[3] ~= 0 then
|
if vFaceOrd[3] ~= 0 then
|
||||||
-- inserisco la lavorazione
|
-- inserisco la lavorazione
|
||||||
@@ -378,16 +390,20 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa
|
|||||||
bOkd, sErrD = Fbs.MakeOne( Proc.Id, vFaceOrd[3] - 1, sCutting, dSawDiam, vtOrthoO, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
bOkd, sErrD = Fbs.MakeOne( Proc.Id, vFaceOrd[3] - 1, sCutting, dSawDiam, vtOrthoO, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||||
if not bOkd then return bOkd, sErrD end
|
if not bOkd then return bOkd, sErrD end
|
||||||
end
|
end
|
||||||
-- inserisco la lavorazione
|
-- altrimenti se ho intersezione forzo il DiceCut ad essere eseguito con distanze più piccole
|
||||||
local vtRef2 = EgtIf( abs(vtRef:getZ()) < GEO.EPS_SMALL, Z_AX(), EgtIf( bHead, Y_AX(), -Y_AX()))
|
else
|
||||||
bOkd, sErrD = Fbs.MakeOne( nFace4, nGoodFace4 - 1, sCutting, dSawDiam, vtRef2, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
|
||||||
if not bOkd then return bOkd, sErrD end
|
|
||||||
else -- altrimenti se ho intersezione forzo il DiceCut ad essere eseguito con distanze più piccole
|
|
||||||
-- definisco la nuova dimensione massima del dice cut
|
-- definisco la nuova dimensione massima del dice cut
|
||||||
local dNewDiceDim = EgtIf( abs(vtRef:getZ()) < GEO.EPS_SMALL, b3Raw:getDimZ(), b3Raw:getDimY())
|
local dNewDiceDim = EgtIf( abs(vtRef:getZ()) < GEO.EPS_SMALL, b3Raw:getDimZ(), b3Raw:getDimY())
|
||||||
bOkd, sErrD = ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Solid, ptC, vtN, Proc, vtRef, bHead, sCutting, dSawDiam, b3Raw, dNewDiceDim)
|
bOkd, sErrD = ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Solid, ptC, vtN, Proc, vtRef, bHead, sCutting, dSawDiam, b3Raw, dNewDiceDim)
|
||||||
if not bOkd then return bOkd, sErrD end
|
if not bOkd then return bOkd, sErrD end
|
||||||
end
|
end
|
||||||
|
-- taglio sulla faccia interna
|
||||||
|
if vFaceOrd[1] ~= 0 then
|
||||||
|
-- inserisco la lavorazione
|
||||||
|
local vtOrthoO = Vector3d( vtRef)
|
||||||
|
bOkd, sErrD = Fbs.MakeOne( Proc.Id, vFaceOrd[1] - 1, sCutting, dSawDiam, vtOrthoO, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||||
|
if not bOkd then return bOkd, sErrD end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
-- taglio sulla faccia interna
|
-- taglio sulla faccia interna
|
||||||
if vFaceOrd[1] ~= 0 then
|
if vFaceOrd[1] ~= 0 then
|
||||||
@@ -497,7 +513,7 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa
|
|||||||
-- aggiornamento ingombro di testa o coda
|
-- aggiornamento ingombro di testa o coda
|
||||||
if Proc.Head then
|
if Proc.Head then
|
||||||
local dHCI = 0
|
local dHCI = 0
|
||||||
if abs( vtRef:getZ()) > 0.1 then
|
if abs( vtRef:getZ()) > 0.1 and not BD.ROT90 then
|
||||||
local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD)
|
local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD)
|
||||||
if b3Fac1 then dHCI = b3Raw:getMax():getX() - dOvmHead - b3Fac1:getMin():getX() end
|
if b3Fac1 then dHCI = b3Raw:getMax():getX() - dOvmHead - b3Fac1:getMin():getX() end
|
||||||
dHCI = 0.75 * dHCI
|
dHCI = 0.75 * dHCI
|
||||||
@@ -507,7 +523,7 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa
|
|||||||
BL.UpdateHCING( nRawId, dHCI)
|
BL.UpdateHCING( nRawId, dHCI)
|
||||||
elseif Proc.Tail then
|
elseif Proc.Tail then
|
||||||
local dTCI = 0
|
local dTCI = 0
|
||||||
if abs( vtRef:getZ()) > 0.1 then
|
if abs( vtRef:getZ()) > 0.1 and not BD.ROT90 then
|
||||||
local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD)
|
local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD)
|
||||||
if b3Fac1 then dTCI = b3Fac1:getMax():getX() - b3Solid:getMin():getX() end
|
if b3Fac1 then dTCI = b3Fac1:getMax():getX() - b3Solid:getMin():getX() end
|
||||||
dTCI = 0.75 * dTCI
|
dTCI = 0.75 * dTCI
|
||||||
|
|||||||
+126
-112
@@ -2,6 +2,8 @@
|
|||||||
-- Gestione calcolo giunto Gerber per Travi
|
-- Gestione calcolo giunto Gerber per Travi
|
||||||
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
|
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
|
||||||
-- 2022/08/09 Ora se la feature ha meno di due facce viene richiamata la normale Cut.
|
-- 2022/08/09 Ora se la feature ha meno di due facce viene richiamata la normale Cut.
|
||||||
|
-- 2022/11/09 Aggiunta gestione parametro Q04 per forzare utilizzo fresa di lato e lavorare come FreeContour.
|
||||||
|
-- 2023/02/14 Gestite le rotazioni di 90 deg nell'aggiornamento del grezzo.
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local ProcessSimpleScarf = {}
|
local ProcessSimpleScarf = {}
|
||||||
@@ -12,6 +14,7 @@ local BL = require( 'BeamLib')
|
|||||||
local Fbs = require( 'FacesBySaw')
|
local Fbs = require( 'FacesBySaw')
|
||||||
local DC = require( 'DiceCut')
|
local DC = require( 'DiceCut')
|
||||||
local Cut = require( 'ProcessCut')
|
local Cut = require( 'ProcessCut')
|
||||||
|
local FreeContour = require( 'ProcessFreeContour')
|
||||||
|
|
||||||
EgtOutLog( ' ProcessSimpleScarf started', 1)
|
EgtOutLog( ' ProcessSimpleScarf started', 1)
|
||||||
|
|
||||||
@@ -28,11 +31,13 @@ end
|
|||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
-- Classificazione della feature
|
-- Classificazione della feature
|
||||||
function ProcessSimpleScarf.Classify( Proc)
|
function ProcessSimpleScarf.Classify( Proc)
|
||||||
|
-- se forzato utilizzo fresa non ruoto la trave
|
||||||
|
local bForceSideMill = ( EgtGetInfo( Proc.Id, 'Q04', 'd') or 0) > 0
|
||||||
-- verifico le normali delle facce
|
-- verifico le normali delle facce
|
||||||
local nFacetCnt = EgtSurfTmFacetCount( Proc.Id)
|
local nFacetCnt = EgtSurfTmFacetCount( Proc.Id)
|
||||||
for i = 1, nFacetCnt do
|
for i = 1, nFacetCnt do
|
||||||
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i-1, GDB_ID.ROOT)
|
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i-1, GDB_ID.ROOT)
|
||||||
if vtN:getZ() < - 0.5 and Proc.Box:getDimX() / abs( vtN:getZ()) > BD.MAX_DIM_DICE then
|
if vtN:getZ() < - 0.5 and Proc.Box:getDimX() / abs( vtN:getZ()) > BD.MAX_DIM_DICE and not bForceSideMill then
|
||||||
return true, true
|
return true, true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -96,7 +101,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
EgtSetOperationMode( nMchId, false)
|
EgtSetOperationMode( nMch1Id, false)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
-- Inserisco la lavorazione del lato opposto
|
-- Inserisco la lavorazione del lato opposto
|
||||||
@@ -119,7 +124,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
EgtSetOperationMode( nMchId, false)
|
EgtSetOperationMode( nMch2Id, false)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
@@ -188,123 +193,132 @@ function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmT
|
|||||||
-- inserimento smussi
|
-- inserimento smussi
|
||||||
local bOkc, sErrC = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
local bOkc, sErrC = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||||
if not bOkc then return bOkc, sErrC end
|
if not bOkc then return bOkc, sErrC end
|
||||||
-- recupero la lavorazione
|
-- se forzato utilizzo fresa richiamo la freecontour
|
||||||
local sCutting = ML.FindCutting( 'HeadSide')
|
local bForceSideMill = EgtGetInfo( Proc.Id, 'Q04', 'd') == 1 or
|
||||||
if not sCutting then
|
( EgtGetInfo( Proc.Id, 'Q04', 'd') == 2 and abs( vtN[vFaceOrd[3]]:getY()) < 0.1) or
|
||||||
local sErr = 'Error : cutting not found in library'
|
( EgtGetInfo( Proc.Id, 'Q04', 'd') == 3 and abs( vtN[vFaceOrd[3]]:getY()) < 0.1 and vtN[vFaceOrd[3]]:getZ() < 0.1)
|
||||||
EgtOutLog( sErr)
|
if bForceSideMill then
|
||||||
return false, sErr
|
bOk, sErr = FreeContour.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||||
end
|
if not bOk then return bOk, sErr end
|
||||||
-- recupero i dati 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
|
|
||||||
-- taglio sulla faccia esterna
|
|
||||||
if vFaceOrd[1] ~= 0 then
|
|
||||||
-- in generale va fatto
|
|
||||||
local bCut = true
|
|
||||||
-- se di testa e coincide con inizio grezzo, non va fatto
|
|
||||||
if bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMax():getX() + dOvmHead) < 10 * GEO.EPS_SMALL then
|
|
||||||
bCut = false
|
|
||||||
end
|
|
||||||
-- se di coda e coincide con taglio di separazione, non va fatto
|
|
||||||
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
|
|
||||||
bCut = false
|
|
||||||
end
|
|
||||||
-- se va fatto, inserisco la lavorazione
|
|
||||||
if bCut then
|
|
||||||
local vtOrthoO = Vector3d( vtRef)
|
|
||||||
local bOk, sNameOrErr = Fbs.MakeOne( Proc.Id, vFaceOrd[1] - 1, sCutting, dSawDiam, vtOrthoO, nil, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
|
||||||
if not bOk then return bOk, sNameOrErr end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- recupero gruppo per geometria addizionale
|
|
||||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
|
||||||
if not nAddGrpId then
|
|
||||||
local sErr = 'Error : missing AddGroup'
|
|
||||||
EgtOutLog( sErr)
|
|
||||||
return false, sErr
|
|
||||||
end
|
|
||||||
-- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
|
|
||||||
local vCuts = {}
|
|
||||||
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then
|
|
||||||
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
|
|
||||||
elseif vFaceOrd[3] ~= 0 then
|
|
||||||
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
|
|
||||||
end
|
|
||||||
if #vCuts > 0 then
|
|
||||||
-- sistemo posizione nel DB e nome
|
|
||||||
for i = 1, #vCuts do
|
|
||||||
for j = 1, #vCuts[i] do
|
|
||||||
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
|
|
||||||
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- calcolo secondo riferimento per testa o coda
|
|
||||||
local vtRef2 = EgtIf( bHead, X_AX(), -X_AX())
|
|
||||||
-- eseguo
|
|
||||||
for i = 1, #vCuts do
|
|
||||||
local vtOrthoO
|
|
||||||
if i % 2 == 1 then
|
|
||||||
vtOrthoO = Vector3d( vtRef)
|
|
||||||
else
|
|
||||||
if #vCuts[i-1] > 0 then
|
|
||||||
vtOrthoO = Vector3d( EgtIf( vtRef2, vtRef2, vtRef))
|
|
||||||
else
|
|
||||||
local vtO
|
|
||||||
for j = 1, #vCuts[i-1] do
|
|
||||||
_, vtO = EgtSurfTmFacetCenter( vCuts[i-1][j], 0, GDB_ID.ROOT)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
if vtO then
|
|
||||||
vtOrthoO = Vector3d( vtO)
|
|
||||||
else
|
|
||||||
vtOrthoO = Y_AX()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- lavoro la faccia
|
|
||||||
for j = 1, #vCuts[i] do
|
|
||||||
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
|
||||||
if not bOk then
|
|
||||||
return bOk, sErr
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
-- taglio sulla faccia interna
|
-- recupero la lavorazione
|
||||||
local bIntCut = false
|
local sCutting = ML.FindCutting( 'HeadSide')
|
||||||
if vFaceOrd[2] ~= 0 then
|
if not sCutting then
|
||||||
-- inserisco la lavorazione
|
local sErr = 'Error : cutting not found in library'
|
||||||
local nOrthoOpposite = BL.GetNearestOrthoOpposite( vtRef)
|
EgtOutLog( sErr)
|
||||||
local bOk, sNameOrErr = Fbs.MakeOne( Proc.Id, vFaceOrd[2] - 1, sCutting, dSawDiam, nOrthoOpposite, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
return false, sErr
|
||||||
if not bOk then return bOk, sNameOrErr end
|
|
||||||
if #sNameOrErr > 0 then bIntCut = true end
|
|
||||||
end
|
end
|
||||||
-- taglio sulla faccia intermedia
|
-- recupero i dati dell'utensile
|
||||||
if vFaceOrd[3] ~= 0 then
|
local dSawDiam = 400
|
||||||
-- calcolo secondo testa o coda
|
if EgtMdbSetCurrMachining( sCutting) then
|
||||||
local vtRef2 = EgtIf( bHead, X_AX(), -X_AX())
|
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||||
-- se non ho il taglio sulla faccia interna
|
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||||
if not bIntCut then
|
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
|
||||||
local frHV, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, vFaceOrd[3] - 1)
|
end
|
||||||
if DimV > DimH then
|
end
|
||||||
vtRef2 = Vector3d( frHV:getVersX())
|
-- taglio sulla faccia esterna
|
||||||
|
if vFaceOrd[1] ~= 0 then
|
||||||
|
-- in generale va fatto
|
||||||
|
local bCut = true
|
||||||
|
-- se di testa e coincide con inizio grezzo, non va fatto
|
||||||
|
if bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMax():getX() + dOvmHead) < 10 * GEO.EPS_SMALL then
|
||||||
|
bCut = false
|
||||||
|
end
|
||||||
|
-- se di coda e coincide con taglio di separazione, non va fatto
|
||||||
|
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
|
||||||
|
bCut = false
|
||||||
|
end
|
||||||
|
-- se va fatto, inserisco la lavorazione
|
||||||
|
if bCut then
|
||||||
|
local vtOrthoO = Vector3d( vtRef)
|
||||||
|
local bOk, sNameOrErr = Fbs.MakeOne( Proc.Id, vFaceOrd[1] - 1, sCutting, dSawDiam, vtOrthoO, nil, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||||
|
if not bOk then return bOk, sNameOrErr end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- recupero gruppo per geometria addizionale
|
||||||
|
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||||
|
if not nAddGrpId then
|
||||||
|
local sErr = 'Error : missing AddGroup'
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
-- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
|
||||||
|
local vCuts = {}
|
||||||
|
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then
|
||||||
|
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
|
||||||
|
elseif vFaceOrd[3] ~= 0 then
|
||||||
|
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
|
||||||
|
end
|
||||||
|
if #vCuts > 0 then
|
||||||
|
-- sistemo posizione nel DB e nome
|
||||||
|
for i = 1, #vCuts do
|
||||||
|
for j = 1, #vCuts[i] do
|
||||||
|
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
|
||||||
|
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- inserisco la lavorazione
|
-- calcolo secondo riferimento per testa o coda
|
||||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[3] - 1, sCutting, dSawDiam, vtRef2, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
local vtRef2 = EgtIf( bHead, X_AX(), -X_AX())
|
||||||
if not bOk then return bOk, sErr end
|
-- eseguo
|
||||||
|
for i = 1, #vCuts do
|
||||||
|
local vtOrthoO
|
||||||
|
if i % 2 == 1 then
|
||||||
|
vtOrthoO = Vector3d( vtRef)
|
||||||
|
else
|
||||||
|
if #vCuts[i-1] > 0 then
|
||||||
|
vtOrthoO = Vector3d( EgtIf( vtRef2, vtRef2, vtRef))
|
||||||
|
else
|
||||||
|
local vtO
|
||||||
|
for j = 1, #vCuts[i-1] do
|
||||||
|
_, vtO = EgtSurfTmFacetCenter( vCuts[i-1][j], 0, GDB_ID.ROOT)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
if vtO then
|
||||||
|
vtOrthoO = Vector3d( vtO)
|
||||||
|
else
|
||||||
|
vtOrthoO = Y_AX()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- lavoro la faccia
|
||||||
|
for j = 1, #vCuts[i] do
|
||||||
|
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||||
|
if not bOk then
|
||||||
|
return bOk, sErr
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- taglio sulla faccia interna
|
||||||
|
local bIntCut = false
|
||||||
|
if vFaceOrd[2] ~= 0 then
|
||||||
|
-- inserisco la lavorazione
|
||||||
|
local nOrthoOpposite = BL.GetNearestOrthoOpposite( vtRef)
|
||||||
|
local bOk, sNameOrErr = Fbs.MakeOne( Proc.Id, vFaceOrd[2] - 1, sCutting, dSawDiam, nOrthoOpposite, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||||
|
if not bOk then return bOk, sNameOrErr end
|
||||||
|
if #sNameOrErr > 0 then bIntCut = true end
|
||||||
|
end
|
||||||
|
-- taglio sulla faccia intermedia
|
||||||
|
if vFaceOrd[3] ~= 0 then
|
||||||
|
-- calcolo secondo testa o coda
|
||||||
|
local vtRef2 = EgtIf( bHead, X_AX(), -X_AX())
|
||||||
|
-- se non ho il taglio sulla faccia interna
|
||||||
|
if not bIntCut then
|
||||||
|
local frHV, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, vFaceOrd[3] - 1)
|
||||||
|
if DimV > DimH then
|
||||||
|
vtRef2 = Vector3d( frHV:getVersX())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- inserisco la lavorazione
|
||||||
|
local bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[3] - 1, sCutting, dSawDiam, vtRef2, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||||
|
if not bOk then return bOk, sErr end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- aggiornamento ingombro di testa o coda
|
-- aggiornamento ingombro di testa o coda
|
||||||
if Proc.Head then
|
if Proc.Head then
|
||||||
local dHCI = 0
|
local dHCI = 0
|
||||||
if abs( vtRef:getZ()) > 0.1 then
|
if abs( vtRef:getZ()) > 0.1 and not BD.ROT90 then
|
||||||
local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD)
|
local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD)
|
||||||
if b3Fac1 then dHCI = b3Raw:getMax():getX() - dOvmHead - b3Fac1:getMin():getX() end
|
if b3Fac1 then dHCI = b3Raw:getMax():getX() - dOvmHead - b3Fac1:getMin():getX() end
|
||||||
else
|
else
|
||||||
@@ -313,7 +327,7 @@ function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmT
|
|||||||
BL.UpdateHCING( nRawId, dHCI)
|
BL.UpdateHCING( nRawId, dHCI)
|
||||||
elseif Proc.Tail then
|
elseif Proc.Tail then
|
||||||
local dTCI = 0
|
local dTCI = 0
|
||||||
if abs( vtRef:getZ()) > 0.1 then
|
if abs( vtRef:getZ()) > 0.1 and not BD.ROT90 then
|
||||||
local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD)
|
local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD)
|
||||||
if b3Fac1 then dTCI = b3Fac1:getMax():getX() - b3Solid:getMin():getX() end
|
if b3Fac1 then dTCI = b3Fac1:getMax():getX() - b3Solid:getMin():getX() end
|
||||||
else
|
else
|
||||||
|
|||||||
+118
-25
@@ -1,8 +1,18 @@
|
|||||||
-- ProcessSplit.lua by Egaltech s.r.l. 2022/08/18
|
-- ProcessSplit.lua by Egaltech s.r.l. 2023/05/09
|
||||||
-- Gestione calcolo tagli di separazione per Travi
|
-- Gestione calcolo tagli di separazione per Travi
|
||||||
-- 2022/05/31 Aggiunta gestione sezioni alte e larghe con taglio con sega a catena seguito da rifinitura con lama (aggiunta funzione MakeSplitByChainSaw); gestione eventuale creazione nuova fase dall'interno della Make.
|
-- 2022/05/31 Aggiunta gestione sezioni alte e larghe con taglio con sega a catena seguito da rifinitura con lama (aggiunta funzione MakeSplitByChainSaw); gestione eventuale creazione nuova fase dall'interno della Make.
|
||||||
-- 2022/06/10 Per sezioni alte e larghe aggiunta gestione finitura in base a sovramateriale e a parametro Q05 dell' eventuale lavorazione sostituita.
|
-- 2022/06/10 Per sezioni alte e larghe aggiunta gestione finitura in base a sovramateriale e a parametro Q05 dell' eventuale lavorazione sostituita.
|
||||||
-- 2022/08/18 Aggiunta gestione macchine con testa da sotto con lama da sotto disabilitata.
|
-- 2022/08/18 Aggiunta gestione macchine con testa da sotto con lama da sotto disabilitata.
|
||||||
|
-- 2022/09/08 Migliorato verso di lavorazione in caso di DoubleCut
|
||||||
|
-- 2022/11/02 Corretti accorciamenti per DoubleCut
|
||||||
|
-- 2022/11/10 Corrette finiture lama per BigSection con trave alta
|
||||||
|
-- 2022/11/16 Correzioni per travi larghe
|
||||||
|
-- 2022/11/30 Correzione per tagli su grandi sezioni (dopo taglio con sega a catena senza finitura aggiungeva uno split con lama).
|
||||||
|
-- 2023/04/04 Modifiche per travi con sezioni molto grandi e materiale inferiore allo spessore lama.
|
||||||
|
-- 2023/04/20 Per travi alte aggiunti tagli orizzontali per ridurre le dimensioni degli scarti.
|
||||||
|
-- 2023/05/09 Aggiunta richiesta risalita preliminare a Zmax per tagli da sopra su macchine PF e ONE.
|
||||||
|
-- 2023/06/13 Corrette note Precut e Cut per tagli aggiuntivi orizzontali.
|
||||||
|
-- 2023/08/02 Corretto calcolo allungamenti/accorciamenti pezzi alti per contemplare anche taglio singolo.
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local ProcessSplit = {}
|
local ProcessSplit = {}
|
||||||
@@ -116,7 +126,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
EgtSetOperationMode( nMchId, false)
|
EgtSetOperationMode( nMch1Id, false)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
-- Inserisco la lavorazione del lato opposto
|
-- Inserisco la lavorazione del lato opposto
|
||||||
@@ -139,7 +149,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
EgtSetOperationMode( nMchId, false)
|
EgtSetOperationMode( nMch1Id, false)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
return true, nil
|
return true, nil
|
||||||
@@ -254,11 +264,13 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
|||||||
-- recupero i dati dell'utensile
|
-- recupero i dati dell'utensile
|
||||||
local dSawDiam = 400
|
local dSawDiam = 400
|
||||||
local dMaxDepth = 50
|
local dMaxDepth = 50
|
||||||
|
local dSawThick = 2
|
||||||
if EgtMdbSetCurrMachining( sCutting) then
|
if EgtMdbSetCurrMachining( sCutting) then
|
||||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||||
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
|
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
|
||||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||||
|
dSawThick = EgtTdbGetCurrToolParam(MCH_TP.THICK) or dSawThick
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
|
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
|
||||||
@@ -267,20 +279,22 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
|||||||
-- recupero i dati della eventuale seconda lama
|
-- recupero i dati della eventuale seconda lama
|
||||||
local dSawDiam2 = 0
|
local dSawDiam2 = 0
|
||||||
local dMaxDepth2 = 0
|
local dMaxDepth2 = 0
|
||||||
|
local dSawThick2 = 0
|
||||||
if sCutting2 and EgtMdbSetCurrMachining( sCutting2) then
|
if sCutting2 and EgtMdbSetCurrMachining( sCutting2) then
|
||||||
local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
|
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
|
||||||
dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2
|
dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2
|
||||||
dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
|
dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
|
||||||
|
dSawThick2 = EgtTdbGetCurrToolParam(MCH_TP.THICK) or dSawThick2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- caratteristiche taglio
|
-- caratteristiche taglio
|
||||||
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM))
|
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM))
|
||||||
local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and
|
local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and
|
||||||
( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dMaxDepth2) - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
|
( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dMaxDepth2) - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
|
||||||
local bHorizCut = ( not bBigSectionCut and ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and ( b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA))
|
local 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 bBigSectionCut and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
|
local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
|
||||||
local bDoubleCut = ( not bBigSectionCut and not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
|
local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
|
||||||
-- dati geometrici del taglio
|
-- dati geometrici del taglio
|
||||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||||
-- flag di lavorazione faccia
|
-- flag di lavorazione faccia
|
||||||
@@ -289,14 +303,15 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
|||||||
local nNextRawId = EgtGetNextRawPart( nRawId)
|
local nNextRawId = EgtGetNextRawPart( nRawId)
|
||||||
local bSplit = ( nNextRawId and ( EgtGetPartInRawPartCount( nNextRawId) > 0 or EgtGetRawPartBBox( nNextRawId):getDimX() >= BD.MinRaw))
|
local bSplit = ( nNextRawId and ( EgtGetPartInRawPartCount( nNextRawId) > 0 or EgtGetRawPartBBox( nNextRawId):getDimX() >= BD.MinRaw))
|
||||||
-- determino se più tagli con offset
|
-- determino se più tagli con offset
|
||||||
|
local dLenEndRaw = dOvmTail
|
||||||
local nCuts = 1
|
local nCuts = 1
|
||||||
local dOffsL = 0
|
local dOffsL = 0
|
||||||
if not bSplit then
|
if not bSplit then
|
||||||
-- cerco grezzo successivo che sia nella fase
|
-- cerco grezzo successivo che sia nella fase
|
||||||
if nNextRawId and EgtVerifyRawPartPhase( nNextRawId, nPhase) then
|
if nNextRawId and EgtVerifyRawPartPhase( nNextRawId, nPhase) then
|
||||||
local b3NextRaw = EgtGetRawPartBBox( nNextRawId)
|
local b3NextRaw = EgtGetRawPartBBox( nNextRawId)
|
||||||
local dLenEndRaw = ptC:getX() - b3NextRaw:getMin():getX()
|
dLenEndRaw = ptC:getX() - b3NextRaw:getMin():getX()
|
||||||
nCuts = ceil( dLenEndRaw / BD.MAX_LEN_SCRAP)
|
nCuts = ceil( dLenEndRaw / ( BD.MAX_LEN_SCRAP + 0.5))
|
||||||
dOffsL = dLenEndRaw / nCuts
|
dOffsL = dLenEndRaw / nCuts
|
||||||
-- aggiorno ingombro del grezzo corrente con quello del successivo
|
-- aggiorno ingombro del grezzo corrente con quello del successivo
|
||||||
b3Raw:Add( b3NextRaw)
|
b3Raw:Add( b3NextRaw)
|
||||||
@@ -339,6 +354,12 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
|||||||
-- altrimenti tagli dai due fianchi (dietro e davanti)
|
-- altrimenti tagli dai due fianchi (dietro e davanti)
|
||||||
else
|
else
|
||||||
local cutDepth = 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN
|
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
|
||||||
|
end
|
||||||
local sNotesSplit = 'Presplit;'
|
local sNotesSplit = 'Presplit;'
|
||||||
local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_BACK, cutDepth, sNotesSplit, dOffs)
|
local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_BACK, cutDepth, sNotesSplit, dOffs)
|
||||||
if not bOk then return bOk, sErr, nNewPhase end
|
if not bOk then return bOk, sErr, nNewPhase end
|
||||||
@@ -380,55 +401,123 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
|||||||
sNotes = 'Precut;'
|
sNotes = 'Precut;'
|
||||||
sNotesFinal = 'Cut;'
|
sNotesFinal = 'Cut;'
|
||||||
end
|
end
|
||||||
|
local nQ05 = EgtGetInfo( nOriId or GDB_ID.NULL, 'Q05', 'i') or 0
|
||||||
|
-- determinazione materiale da asportare
|
||||||
|
local dSawThickCheck = dSawThick
|
||||||
|
if dSawThick2 > 0 and bDoubleHorizCut then
|
||||||
|
dSawThickCheck = min( dSawThick, dSawThick2)
|
||||||
|
end
|
||||||
|
local dMaxElev = 0
|
||||||
|
if vtN:getX() > 0 then
|
||||||
|
dMaxElev = b3Raw:getMax():getX() - Proc.Box:getMin():getX()
|
||||||
|
else
|
||||||
|
dMaxElev = Proc.Box:getMax():getX() - b3Raw:getMin():getX()
|
||||||
|
end
|
||||||
-- se finitura con lama
|
-- se finitura con lama
|
||||||
if not nOriId or EgtGetInfo( nOriId, 'Q05', 'i') == 1 or EgtGetInfo( nOriId, 'Q05', 'i') == 0 or not bSplit then
|
if nQ05 == 1 or nQ05 == 0 or ( not bSplit and dMaxElev > dSawThickCheck) then
|
||||||
local bOk, sErr = Cut.Make( Proc, nNewPhase, nRawId, nPartId, dLenEndRaw, nil, false, true, b3Raw, sNotes, dCurrOvmT)
|
-- controllo se è necessario un taglio con dicing o si deve proseguire ai casi standard
|
||||||
if not bOk then return bOk, sErr, nNewPhase end
|
if bSplit or dMaxElev > dSawThickCheck then
|
||||||
|
local bOk, sErr = Cut.Make( Proc, nNewPhase, nRawId, nPartId, dMaxElev, nil, false, true, b3Raw, sNotes, dCurrOvmT)
|
||||||
|
if sNotesFinal then
|
||||||
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotesFinal)
|
||||||
|
end
|
||||||
|
return bOk, sErr, nNewPhase
|
||||||
|
end
|
||||||
-- se finitura con truciolatore
|
-- se finitura con truciolatore
|
||||||
elseif EgtGetInfo( nOriId, 'Q05', 'i') == 2 then
|
elseif nQ05 == 2 then
|
||||||
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||||
if not b3Solid then
|
if not b3Solid then
|
||||||
local sErr = 'Error : part box not found'
|
local sErr = 'Error : part box not found'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
local sPocketing = ML.FindPocketing( 'OpenPocket', nil, 0)
|
local sPocketing, dTDiam = ML.FindPocketing( 'OpenPocket', nil, 0)
|
||||||
if not sPocketing then
|
if not sPocketing then
|
||||||
local sErr = 'Error : pocketing not found in library'
|
local sErr = 'Error : pocketing not found in library'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
local bOk, sErr = Pocket.Make( Proc, Proc.Id, 0, sPocketing, nPartId, b3Solid)
|
local dOpenMinSafe
|
||||||
if not bOk then return bOk, sErr, nNewPhase end
|
if BD.C_SIMM and b3Raw:getDimZ() > 600 then
|
||||||
end
|
dOpenMinSafe = 230 - dTDiam / 2
|
||||||
if sNotesFinal then
|
end
|
||||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotesFinal)
|
local bOk, sErr = Pocket.Make( Proc, Proc.Id, 0, sPocketing, nPartId, b3Solid, dOpenMinSafe)
|
||||||
|
if sNotesFinal then
|
||||||
|
local sNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) .. sNotesFinal
|
||||||
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
|
||||||
|
end
|
||||||
|
return bOk, sErr, nNewPhase
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
return true, nil, nNewPhase
|
||||||
end
|
end
|
||||||
|
end
|
||||||
-- se tagli standard
|
-- se tagli standard
|
||||||
elseif not bDoubleHorizCut then
|
if not bDoubleHorizCut then
|
||||||
-- calcolo extra taglio ed accorciamento
|
-- calcolo extra taglio ed accorciamento
|
||||||
local dCutExtra = 0
|
local dCutExtra = 0
|
||||||
local dAccStart = 0
|
local dAccStart = 0
|
||||||
local dAccEnd = 0
|
local dAccEnd = 0
|
||||||
if b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL or b3Raw:getDimY() < 2 * BD.MAX_DIM_HTCUT_HBEAM + 10 * GEO.EPS_SMALL then
|
if bBigSectionCut and BD.C_SIMM then
|
||||||
|
-- qui arrivano sezioni molto grandi su macchine tipo PF con materiale da asportare inferiore allo spessore lama
|
||||||
|
local dSawRad = dSawDiam / 2
|
||||||
|
dCutExtra = - ( b3Raw:getDimY() - dSawRad)
|
||||||
|
dAccEnd = dSawRad
|
||||||
|
elseif b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL or b3Raw:getDimY() < 2 * BD.MAX_DIM_HTCUT_HBEAM + 10 * GEO.EPS_SMALL then
|
||||||
dCutExtra = EgtIf( bDoubleCut, - 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN, BD.CUT_EXTRA)
|
dCutExtra = EgtIf( bDoubleCut, - 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN, BD.CUT_EXTRA)
|
||||||
else
|
else
|
||||||
dCutExtra = - ( b3Raw:getDimY() - dMaxDepth)
|
dCutExtra = - ( b3Raw:getDimY() - dMaxDepth)
|
||||||
local dSawRad = dSawDiam / 2
|
local dSawRad = dSawDiam / 2
|
||||||
local dKL = dSawRad - dMaxDepth + b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN
|
-- 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)
|
||||||
if BD.C_SIMM then
|
if BD.C_SIMM then
|
||||||
dAccEnd = sqrt( dSawRad * dSawRad - dKL * dKL)
|
dAccEnd = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0))
|
||||||
else
|
else
|
||||||
dAccStart = sqrt( dSawRad * dSawRad - dKL * dKL)
|
dAccStart = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0))
|
||||||
end
|
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)
|
||||||
|
if bAreHorizontalCutsNeeded then
|
||||||
|
local nHorizontalCuts = ceil ( dimV / BD.MAX_DIM_DICE) - 1
|
||||||
|
local dHorizontalSliceHeight = dimV / ( nHorizontalCuts + 1)
|
||||||
|
for i = nCuts, 1, -1 do
|
||||||
|
local dCutXOffset = ( i - 1) * dOffsL
|
||||||
|
-- tagli orizzontali
|
||||||
|
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)
|
||||||
|
if not bOk then return false, sErr end
|
||||||
|
end
|
||||||
|
-- se necessario taglio verticale doppio, eseguo l'opposto
|
||||||
|
if bDoubleCut then
|
||||||
|
-- gli accorciamenti vanno invertiti per il taglio opposto
|
||||||
|
local dAccStartDoubleCut, dAccEndDoubleCut = dAccEnd, dAccStart
|
||||||
|
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_FRONT, nil, dCutExtra, BD.CUT_SIC, dCutXOffset, dAccStartDoubleCut, dAccEndDoubleCut, 'Precut;', b3Raw, true)
|
||||||
|
if not bOk then return false, sErr end
|
||||||
|
end
|
||||||
|
-- taglio verticale
|
||||||
|
local sInfo = 'PreCut;'
|
||||||
|
if i == 1 then sInfo = 'Cut;' end
|
||||||
|
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutXOffset, dAccStart, dAccEnd, sInfo, b3Raw)
|
||||||
|
if not bOk then return false, sErr end
|
||||||
|
end
|
||||||
|
return true, sWarn, nNewPhase
|
||||||
|
end
|
||||||
|
|
||||||
-- se necessari tagli in doppio, eseguo gli opposti
|
-- se necessari tagli in doppio, eseguo gli opposti
|
||||||
if bDoubleCut then
|
if bDoubleCut then
|
||||||
|
-- gli accorciamenti vanno invertiti per il taglio opposto
|
||||||
|
local dAccStartDoubleCut, dAccEndDoubleCut = dAccEnd, dAccStart
|
||||||
for i = nCuts, 1, -1 do
|
for i = nCuts, 1, -1 do
|
||||||
local dCutOffset = ( i - 1) * dOffsL
|
local dCutOffset = ( i - 1) * dOffsL
|
||||||
local sNotes = EgtIf( bSplit, 'Presplit;', 'Precut;')
|
local sNotes = EgtIf( bSplit, 'Presplit;', 'Precut;')
|
||||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_FRONT, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw)
|
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_FRONT, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStartDoubleCut, dAccEndDoubleCut, sNotes, b3Raw, true)
|
||||||
if not bOk then return false, sErr end
|
if not bOk then return false, sErr end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -441,6 +530,10 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
|||||||
else
|
else
|
||||||
sNotes = EgtIf( i == 1, 'Cut;', 'Precut;')
|
sNotes = EgtIf( i == 1, 'Cut;', 'Precut;')
|
||||||
end
|
end
|
||||||
|
-- se primo taglio da sopra e PF o ONE richiedo risalita preliminare a Zmax
|
||||||
|
if i == nCuts and bHorizCut and BD.C_SIMM and not BD.DOWN_HEAD then
|
||||||
|
sNotes = EgtSetValInNotes( sNotes, 'StartZmax', 2)
|
||||||
|
end
|
||||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw)
|
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw)
|
||||||
if not bOk then return false, sErr end
|
if not bOk then return false, sErr end
|
||||||
end
|
end
|
||||||
@@ -455,7 +548,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
|||||||
-- verifico che le due lame riescano a lavorare la sezione
|
-- verifico che le due lame riescano a lavorare la sezione
|
||||||
local dDimZ = b3Raw:getDimZ()
|
local dDimZ = b3Raw:getDimZ()
|
||||||
local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ
|
local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ
|
||||||
if dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0 then
|
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'
|
local sErr = 'Error : section too big for tail cut'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
-- ProcessStepJoint.lua by Egaltech s.r.l. 2022/01/26
|
-- ProcessStepJoint.lua by Egaltech s.r.l. 2022/11/03
|
||||||
-- Gestione calcolo giunto a gradino per Travi
|
-- Gestione calcolo giunto a gradino per Travi
|
||||||
|
-- 2022/11/03 Correzione per riconoscimento testa da sotto su fresatura.
|
||||||
|
-- 2023/02/14 Gestite le rotazioni di 90 deg nell'aggiornamento del grezzo.
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local ProcessStepJoint = {}
|
local ProcessStepJoint = {}
|
||||||
@@ -83,13 +85,14 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
-- recupero la lavorazione
|
-- recupero la lavorazione
|
||||||
local sMillType = 'Mark'
|
local sMillType = 'Mark'
|
||||||
local bDownHead = ( BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1)
|
local bDownHead = ( BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1)
|
||||||
local sMilling
|
local sMilling, bH2
|
||||||
sMilling, _, _, bDownHead = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bDownHead)
|
sMilling, _, _, bH2 = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bDownHead)
|
||||||
if not sMilling then
|
if not sMilling then
|
||||||
local sErr = 'Error : milling not found in library'
|
local sErr = 'Error : milling not found in library'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
|
bDownHead = ( bDownHead and bH2)
|
||||||
-- Inserisco la lavorazione del lato standard
|
-- Inserisco la lavorazione del lato standard
|
||||||
local sName1 = 'SJN_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
local sName1 = 'SJN_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||||
local nMch1Id = EgtAddMachining( sName1, sMilling)
|
local nMch1Id = EgtAddMachining( sName1, sMilling)
|
||||||
@@ -108,7 +111,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
EgtSetOperationMode( nMchId, false)
|
EgtSetOperationMode( nMch1Id, false)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
-- Inserisco la lavorazione del lato opposto
|
-- Inserisco la lavorazione del lato opposto
|
||||||
@@ -131,7 +134,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
EgtSetOperationMode( nMchId, false)
|
EgtSetOperationMode( nMch2Id, false)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
@@ -431,18 +434,22 @@ local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
-- Eventuale segnalazione ingombro di testa o coda
|
-- Eventuale segnalazione ingombro di testa o coda
|
||||||
if Proc.Head then
|
if Proc.Head then
|
||||||
local dOffs = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()
|
local dOffs = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()
|
||||||
if vtNm:getZ() > 0.5 then
|
if not BD.ROT90 then
|
||||||
dOffs = 0.5 * dOffs
|
if vtNm:getZ() > 0.5 then
|
||||||
elseif abs( vtNm:getZ()) > 0.35 then
|
dOffs = 0.5 * dOffs
|
||||||
dOffs = 0.75 * dOffs
|
elseif abs( vtNm:getZ()) > 0.35 then
|
||||||
|
dOffs = 0.75 * dOffs
|
||||||
|
end
|
||||||
end
|
end
|
||||||
BL.UpdateHCING( nRawId, dOffs)
|
BL.UpdateHCING( nRawId, dOffs)
|
||||||
elseif Proc.Tail then
|
elseif Proc.Tail then
|
||||||
local dOffs = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
|
local dOffs = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
|
||||||
if vtNm:getZ() > 0.5 then
|
if not BD.ROT90 then
|
||||||
dOffs = 0.5 * dOffs
|
if vtNm:getZ() > 0.5 then
|
||||||
elseif abs( vtNm:getZ()) > 0.35 then
|
dOffs = 0.5 * dOffs
|
||||||
dOffs = 0.75 * dOffs
|
elseif abs( vtNm:getZ()) > 0.35 then
|
||||||
|
dOffs = 0.75 * dOffs
|
||||||
|
end
|
||||||
end
|
end
|
||||||
BL.UpdateTCING( nRawId, dOffs)
|
BL.UpdateTCING( nRawId, dOffs)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
-- ProcessStepJointNotch.lua by Egaltech s.r.l. 2022/01/25
|
-- ProcessStepJointNotch.lua by Egaltech s.r.l. 2022/11/03
|
||||||
-- Gestione calcolo tacca a gradino per Travi
|
-- Gestione calcolo tacca a gradino per Travi
|
||||||
|
-- 2022/11/03 Correzione per riconoscimento testa da sotto su fresatura.
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local ProcessStepJointNotch = {}
|
local ProcessStepJointNotch = {}
|
||||||
@@ -23,6 +24,23 @@ function ProcessStepJointNotch.Identify( Proc)
|
|||||||
return ( ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 80)
|
return ( ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 80)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
-- Verifica se feature di testa
|
||||||
|
function ProcessStepJointNotch.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
-- Verifica se feature di coda
|
||||||
|
function ProcessStepJointNotch.IsTailFeature( Proc, b3Raw)
|
||||||
|
-- recupero box del pezzo
|
||||||
|
local nPartId = EgtGetParent( EgtGetParent( Proc.Id) or GDB_ID.NULL)
|
||||||
|
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||||
|
-- verifico se è in coda
|
||||||
|
local dEndDist = Proc.Box:getMin():getX() - b3Solid:getMin():getX()
|
||||||
|
return ( dEndDist < BD.MAX_DIST_HTFEA)
|
||||||
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
-- Classificazione della feature
|
-- Classificazione della feature
|
||||||
function ProcessStepJointNotch.Classify( Proc)
|
function ProcessStepJointNotch.Classify( Proc)
|
||||||
@@ -88,47 +106,10 @@ local function MachineByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Solid,
|
|||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
-- verifico se necessari tagli supplementari
|
-- tagli delle facce
|
||||||
local vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
|
local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHead, '_H2', ''), nil, bDownHead)
|
||||||
--DC.PrintOrderCut( vCuts)
|
if not bOk then
|
||||||
if #vCuts > 0 then
|
return bOk, sErr
|
||||||
-- sistemo posizione nel DB e nome
|
|
||||||
for i = 1, #vCuts do
|
|
||||||
for j = 1, #vCuts[i] do
|
|
||||||
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
|
|
||||||
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- eseguo
|
|
||||||
for i = 1, #vCuts do
|
|
||||||
-- determino il modo di tagliare
|
|
||||||
local k, l = nBigInd, nSmaInd
|
|
||||||
if ( i % 2) == 1 then
|
|
||||||
k, l = l, k
|
|
||||||
end
|
|
||||||
local nOrthoOpposite
|
|
||||||
if bOnY then
|
|
||||||
local bFront = ( ptC[k]:getY() < ptPs:getY())
|
|
||||||
nOrthoOpposite = EgtIf( bFront, MCH_MILL_FU.ORTHO_BACK, MCH_MILL_FU.ORTHO_FRONT)
|
|
||||||
else
|
|
||||||
local bOver = ( vtN[nBigInd]:getZ() > -0.1)
|
|
||||||
nOrthoOpposite = EgtIf( bOver, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_TOP)
|
|
||||||
end
|
|
||||||
-- lavoro la faccia
|
|
||||||
for j = 1, #vCuts[i] do
|
|
||||||
local dLocCutExtra = EgtIf( j == #vCuts[i], dCutExtra - dExtraUp, dCutExtra)
|
|
||||||
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, nOrthoOpposite, EgtIf( bDownHead, -2, nil), dLocCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
|
||||||
if not bOk then
|
|
||||||
return bOk, sErr
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- altrimenti, tagli diretti delle facce
|
|
||||||
else
|
|
||||||
local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHead, '_H2', ''), nil, bDownHead)
|
|
||||||
if not bOk then
|
|
||||||
return bOk, sErr
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@@ -523,13 +504,14 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
-- recupero la lavorazione
|
-- recupero la lavorazione
|
||||||
local sMillType = 'Mark'
|
local sMillType = 'Mark'
|
||||||
local bDownHead = ( BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1)
|
local bDownHead = ( BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1)
|
||||||
local sMilling
|
local sMilling, bH2
|
||||||
sMilling, _, _, bDownHead = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bDownHead)
|
sMilling, _, _, bH2 = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bDownHead)
|
||||||
if not sMilling then
|
if not sMilling then
|
||||||
local sErr = 'Error : milling not found in library'
|
local sErr = 'Error : milling not found in library'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
|
bDownHead = ( bDownHead and bH2)
|
||||||
if bExeNormal then
|
if bExeNormal then
|
||||||
-- Inserisco la lavorazione del lato standard
|
-- Inserisco la lavorazione del lato standard
|
||||||
local sName1 = 'SJN_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
local sName1 = 'SJN_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||||
@@ -549,7 +531,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
EgtSetOperationMode( nMchId, false)
|
EgtSetOperationMode( nMch1Id, false)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -574,7 +556,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
EgtSetOperationMode( nMchId, false)
|
EgtSetOperationMode( nMch2Id, false)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+101
-20
@@ -1,9 +1,15 @@
|
|||||||
-- ProcessTenon.lua by Egaltech s.r.l. 2022/05/28
|
-- ProcessTenon.lua by Egaltech s.r.l. 2023/03/27
|
||||||
-- Gestione calcolo tenone per Travi
|
-- Gestione calcolo tenone per Travi
|
||||||
-- 2021/10/04 Corretto calcolo HCING per pezzi piccoli.
|
-- 2021/10/04 Corretto calcolo HCING per pezzi piccoli.
|
||||||
-- 2022/02/15 Aggiornata VerifyOrientation per macchine con testa da sotto.
|
-- 2022/02/15 Aggiornata VerifyOrientation per macchine con testa da sotto.
|
||||||
-- 2022/05/18 Migliorata gestione attacco.
|
-- 2022/05/18 Migliorata gestione attacco.
|
||||||
-- 2022/05/28 Spostato calcolo svuotatura in modulo di libreria.
|
-- 2022/05/28 Spostato calcolo svuotatura in modulo di libreria.
|
||||||
|
-- 2022/09/20 Migliorato il calcolo delle passate laterali; ora considera la reale distanza tra contorno del tenone e estremi della faccia
|
||||||
|
-- 2022/11/03 Corretto uso di bH2 (da sotto solo se anche bMillDown vero).
|
||||||
|
-- 2022/12/12 Su macchine con rulli pressori e pinze separate si riduce di meno l'ingombro con tenoni inclinati.
|
||||||
|
-- 2022/12/20 Aggiunta gestione smusso. Migliorata scelta tra sopra e sotto per il punto di inizio. In VerifyOrientation aggiunta trave medio alta.
|
||||||
|
-- 2023/01/20 Modificata scelta lato di attacco per pezzo piccolo su macchine con pinza speciale (pinza 5).
|
||||||
|
-- 2023/03/27 Migliorate condizioni scelta pretaglio con lama o fresa; gestione unificata con ProcessDtTenon. Migliorato calcolo altezza tenone.
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local ProcessTenon = {}
|
local ProcessTenon = {}
|
||||||
@@ -29,8 +35,8 @@ local function VerifyOrientation( Proc, vtN, b3Raw)
|
|||||||
end
|
end
|
||||||
-- se trave molto bassa
|
-- se trave molto bassa
|
||||||
if b3Raw:getDimZ() <= 120 then
|
if b3Raw:getDimZ() <= 120 then
|
||||||
-- se tenone praticamente in asse, accetto fino a -45 deg
|
-- se non testa PF e tenone praticamente in asse, accetto fino a -45 deg
|
||||||
if abs( vtN:getY()) < 0.04 then
|
if not BD.C_SIMM and abs( vtN:getY()) < 0.04 then
|
||||||
return ( vtN:getZ() >= -0.7072)
|
return ( vtN:getZ() >= -0.7072)
|
||||||
-- altrimenti accetto fino a -30deg
|
-- altrimenti accetto fino a -30deg
|
||||||
else
|
else
|
||||||
@@ -54,6 +60,15 @@ local function VerifyOrientation( Proc, vtN, b3Raw)
|
|||||||
else
|
else
|
||||||
return ( vtN:getZ() >= -0.174)
|
return ( vtN:getZ() >= -0.174)
|
||||||
end
|
end
|
||||||
|
-- se trave medio alta
|
||||||
|
elseif b3Raw:getDimZ() <= 400 then
|
||||||
|
-- se tenone praticamente in asse, accetto fino a -15 deg
|
||||||
|
if abs( vtN:getY()) < 0.04 then
|
||||||
|
return ( vtN:getZ() >= -0.259)
|
||||||
|
-- altrimenti, accetto fino a -5 deg
|
||||||
|
else
|
||||||
|
return ( vtN:getZ() >= -0.088)
|
||||||
|
end
|
||||||
-- altrimenti
|
-- altrimenti
|
||||||
else
|
else
|
||||||
-- accetto fino a -5deg
|
-- accetto fino a -5deg
|
||||||
@@ -114,17 +129,38 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
end
|
end
|
||||||
-- determino altezza del tenone
|
-- determino altezza del tenone
|
||||||
local frTen = Frame3d( ptBC, vtExtr)
|
local frTen = Frame3d( ptBC, vtExtr)
|
||||||
local b3Ten = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frTen)
|
local b3Ten = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frTen)
|
||||||
local dTenH = b3Ten:getDimZ()
|
local dTenH = b3Ten:getMax():getZ()
|
||||||
-- assegno centro e normale della faccia top
|
-- assegno centro e normale della faccia top
|
||||||
local vtN = vtExtr
|
local vtN = vtExtr
|
||||||
local ptC = ptBC + vtN * dTenH
|
local ptC = ptBC + vtN * dTenH
|
||||||
EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3)
|
EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3)
|
||||||
-- determino larghezza massima di svuotatura
|
-- determino larghezza svuotatura per calcolare il numero di passate laterali
|
||||||
local b3Aux = EgtGetBBoxRef( AuxId, GDB_BB.STANDARD, frTen)
|
-- ricavo i contorni della faccia principale
|
||||||
local dPockX = max( b3Ten:getMax():getX() - b3Aux:getMax():getX(), b3Aux:getMin():getX() - b3Ten:getMin():getX())
|
local nLoopId, nLoopCnt = EgtExtractSurfTmFacetLoops( Proc.Id, 0, EgtGetParent( Proc.Id))
|
||||||
local dPockY = max( b3Ten:getMax():getY() - b3Aux:getMax():getY(), b3Aux:getMin():getY() - b3Ten:getMin():getY())
|
local dPockL = 0
|
||||||
local dPockL = sqrt( dPockX * dPockX + dPockY * dPockY)
|
-- ricavo la massima distanza tra gli estremi della faccia e la curva del tenone
|
||||||
|
if nLoopId then
|
||||||
|
local dUmin, dUmax = EgtCurveDomain( nLoopId)
|
||||||
|
for dU = dUmin, dUmax do
|
||||||
|
local ptP = EgtUP( nLoopId, dU, GDB_ID.ROOT)
|
||||||
|
local ptNear = EgtNP( AuxId, ptP, GDB_ID.ROOT)
|
||||||
|
local dDist = dist( ptP, ptNear)
|
||||||
|
if dDist > dPockL then
|
||||||
|
dPockL = dDist
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- cancello i contorni dopo averli analizzati
|
||||||
|
for i = 1, nLoopCnt do
|
||||||
|
EgtErase( nLoopId + i - 1)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- se il metodo sopra non funziona uso il metodo semplice (distanza tra gli angoli retti della curva tenone e faccia principale)
|
||||||
|
local b3Aux = EgtGetBBoxRef( AuxId, GDB_BB.STANDARD, frTen)
|
||||||
|
local dPockX = max( b3Ten:getMax():getX() - b3Aux:getMax():getX(), b3Aux:getMin():getX() - b3Ten:getMin():getX())
|
||||||
|
local dPockY = max( b3Ten:getMax():getY() - b3Aux:getMax():getY(), b3Aux:getMin():getY() - b3Ten:getMin():getY())
|
||||||
|
dPockL = sqrt( dPockX * dPockX + dPockY * dPockY)
|
||||||
|
end
|
||||||
-- abilitazione lavorazione da sotto
|
-- abilitazione lavorazione da sotto
|
||||||
local bMillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259)
|
local bMillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259)
|
||||||
local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1)
|
local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1)
|
||||||
@@ -145,11 +181,10 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
if AddId then
|
if AddId then
|
||||||
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
|
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
|
||||||
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
|
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
|
||||||
-- se pezzo piccolo, in coda, con piano inclinato verso il basso e macchina con testa da sotto applico svuotatura
|
-- solo per macchine tipo PF e simili: se pezzo piccolo, in coda, piano inclinato attorno a Z e inclinato verso il basso applico svuotatura
|
||||||
if bShortPart and vtExtr:getX() < 0 and vtExtr:getZ() < -0.09 and BD.DOWN_HEAD then
|
if b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getX() < 0 and abs( vtExtr:getY()) > 0.173 and vtExtr:getZ() < -0.1 and BD.C_SIMM then
|
||||||
-- recupero la lavorazione
|
-- recupero la lavorazione
|
||||||
local sPockType = EgtIf( bMillDown, 'OpenPocket_H2', 'OpenPocket')
|
local sPocketing = ML.FindPocketing( 'OpenPocket', nil, nil, nil, not bMillDown, bMillDown)
|
||||||
local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, not bMillDown, bMillDown)
|
|
||||||
if not sPocketing then
|
if not sPocketing then
|
||||||
local sErr = 'Error : pocketing '..sPockType..' not found in library'
|
local sErr = 'Error : pocketing '..sPockType..' not found in library'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
@@ -173,6 +208,43 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
-- se vero tenone e richiesto, eseguo lo smusso
|
||||||
|
if Proc.Prc ~= 52 and EgtGetInfo( Proc.Id, 'P05', 'i') == 1 then
|
||||||
|
-- profondità smusso
|
||||||
|
local dDepth = EgtGetInfo( Proc.Id, 'Q01', 'd') or 0
|
||||||
|
if dDepth > 0.1 then
|
||||||
|
local dExtra = 2
|
||||||
|
-- recupero la lavorazione
|
||||||
|
local sMilling = ML.FindMilling( 'Mark', nil, nil, nil, nil, bMillUp, bMillDown)
|
||||||
|
if not sMilling then
|
||||||
|
local sErr = 'Error : milling (Mark) not found in library'
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
-- Inserisco la lavorazione
|
||||||
|
local sName1 = 'TenC_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||||
|
local nMch1Id = EgtAddMachining( sName1, sMilling)
|
||||||
|
if not nMch1Id then
|
||||||
|
local sErr = 'Error adding machining ' .. sName1 .. '-' .. sMilling
|
||||||
|
EgtOutLog( sErr)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
-- aggiungo geometria
|
||||||
|
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||||
|
-- assegno affondamento e offset radiale
|
||||||
|
EgtSetMachiningParam( MCH_MP.DEPTH, -dTenH + dDepth + dExtra)
|
||||||
|
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
|
||||||
|
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dDepth + dExtra, 1) .. ';')
|
||||||
|
-- assegno lato di lavoro
|
||||||
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
||||||
|
-- eseguo
|
||||||
|
if not ML.ApplyMachining( true, false) then
|
||||||
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
|
EgtSetOperationMode( nMch1Id, false)
|
||||||
|
return false, sErr
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
-- recupero la lavorazione
|
-- recupero la lavorazione
|
||||||
local sMillType = 'Tenon'
|
local sMillType = 'Tenon'
|
||||||
local sMilling, _, _, bH2 = ML.FindMilling( sMillType, dTenH, nil, nil, nil, bMillUp, bMillDown)
|
local sMilling, _, _, bH2 = ML.FindMilling( sMillType, dTenH, nil, nil, nil, bMillUp, bMillDown)
|
||||||
@@ -200,10 +272,17 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
-- massimo numero di passate e coefficiente di sovrapposizione ta passate
|
-- massimo numero di passate e coefficiente di sovrapposizione ta passate
|
||||||
local MAX_PASS = 6
|
local MAX_PASS = 6
|
||||||
local OVERLAP_COEFF = 0.7
|
local OVERLAP_COEFF = 0.7
|
||||||
-- porto inizio curva il più possibile sul bordo in alto o in basso
|
-- porto inizio curva il più possibile sul bordo in alto, in basso o di lato a seconda delle necessità
|
||||||
local dMaxDist = OVERLAP_COEFF * dMillDiam * MAX_PASS
|
local dMaxDist = OVERLAP_COEFF * dMillDiam * MAX_PASS
|
||||||
local bMyShortPart = ( bShortPart and abs( vtN:getX()) < 0.999 and abs( vtN:getY()) < 0.259)
|
local nNearSide = 3
|
||||||
BL.PutStartNearestToEdge( AuxId, b3Solid, dMaxDist, bH2 ~= bMyShortPart)
|
local bMyShortPart = ( bShortPart and vtN:getX() < 0 and abs( vtN:getX()) < 0.999 and abs( vtN:getY()) < 0.259)
|
||||||
|
if bH2 and bMillDown then
|
||||||
|
nNearSide = EgtIf( bMyShortPart and vtN:getZ() < -0.018, 3, -3)
|
||||||
|
else
|
||||||
|
nNearSide = EgtIf( bMyShortPart and vtN:getZ() > 0.018, -3, 3)
|
||||||
|
end
|
||||||
|
if bMyShortPart and BD.CLAMP5 then nNearSide = -2 end
|
||||||
|
BL.PutStartNearestToEdge( AuxId, b3Solid, dMaxDist, nNearSide)
|
||||||
-- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente
|
-- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente
|
||||||
local sWarn
|
local sWarn
|
||||||
local dDepth = 0
|
local dDepth = 0
|
||||||
@@ -228,7 +307,9 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
-- aggiungo geometria
|
-- aggiungo geometria
|
||||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||||
-- sistemo i parametri
|
-- sistemo i parametri
|
||||||
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dTenH - 100 * GEO.EPS_SMALL, 1) .. ';')
|
local sUserNotes = EgtSetVal( 'MaxElev', EgtNumToString( dTenH - 100 * GEO.EPS_SMALL, 1)) .. ';'
|
||||||
|
if i < nPass then sUserNotes = EgtSetValInNotes( sUserNotes, 'OutRaw', 3) end
|
||||||
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
||||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||||
local dOffset = ( i - 1) * dStep
|
local dOffset = ( i - 1) * dStep
|
||||||
EgtSetMachiningParam( MCH_MP.OFFSR, dOffset)
|
EgtSetMachiningParam( MCH_MP.OFFSR, dOffset)
|
||||||
@@ -264,7 +345,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
local dOffs = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()
|
local dOffs = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()
|
||||||
local dDelta = 0
|
local dDelta = 0
|
||||||
if abs( vtN:getY()) < 0.1 and vtN:getZ() > 0.5 then
|
if abs( vtN:getY()) < 0.1 and vtN:getZ() > 0.5 then
|
||||||
dDelta = - 0.5 * dOffs
|
dDelta = - EgtIf( BD.PRESS_ROLLER, 0.7, 0.5) * dOffs
|
||||||
end
|
end
|
||||||
if bShortPart and b3Raw:getDimZ() < BD.VICE_MINH and abs( vtN:getZ()) > 0.575 then
|
if bShortPart and b3Raw:getDimZ() < BD.VICE_MINH and abs( vtN:getZ()) > 0.575 then
|
||||||
local b3Base = EgtSurfTmGetFacetBBoxGlob( Proc.Id, 0, GDB_BB.STANDARD)
|
local b3Base = EgtSurfTmGetFacetBBoxGlob( Proc.Id, 0, GDB_BB.STANDARD)
|
||||||
@@ -275,7 +356,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
|||||||
elseif Proc.Tail then
|
elseif Proc.Tail then
|
||||||
local dOffs = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
|
local dOffs = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
|
||||||
if abs( vtN:getY()) < 0.1 and vtN:getZ() > 0.5 then
|
if abs( vtN:getY()) < 0.1 and vtN:getZ() > 0.5 then
|
||||||
dOffs = 0.5 * dOffs
|
dOffs = EgtIf( BD.PRESS_ROLLER, 0.3, 0.5) * dOffs
|
||||||
end
|
end
|
||||||
BL.UpdateTCING( nRawId, dOffs)
|
BL.UpdateTCING( nRawId, dOffs)
|
||||||
end
|
end
|
||||||
|
|||||||
+19
-10
@@ -1,6 +1,7 @@
|
|||||||
-- ProcessText.lua by Egaltech s.r.l. 2021/05/03
|
-- ProcessText.lua by Egaltech s.r.l. 2022/12/05
|
||||||
-- Gestione calcolo testi per Travi
|
-- Gestione calcolo testi per Travi
|
||||||
-- 2021/05/03 Aggiunta gestione testa da sotto.
|
-- 2021/05/03 Aggiunta gestione testa da sotto.
|
||||||
|
-- 2022/12/05 Aggiunta gestione tipo di lavorazione Text_AT.
|
||||||
|
|
||||||
-- Tabella per definizione modulo
|
-- Tabella per definizione modulo
|
||||||
local ProcessText = {}
|
local ProcessText = {}
|
||||||
@@ -31,6 +32,12 @@ function ProcessText.Classify( Proc)
|
|||||||
end
|
end
|
||||||
-- verifico se il testo è lavorabile solo da sotto
|
-- verifico se il testo è lavorabile solo da sotto
|
||||||
local bDown = (( vtN:getZ() < -0.1))
|
local bDown = (( vtN:getZ() < -0.1))
|
||||||
|
-- se da sotto e presente rinvio angolare verifico se c'è opportuna lavorazione
|
||||||
|
if bDown and BD.ANG_TRASM then
|
||||||
|
if ML.FindMilling( 'Text_AT') then
|
||||||
|
bDown = false
|
||||||
|
end
|
||||||
|
end
|
||||||
return true, bDown
|
return true, bDown
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -41,25 +48,25 @@ function ProcessText.Make( Proc, nPhase, nRawId, nPartId)
|
|||||||
local vtN = EgtTextNormVersor( Proc.Id, GDB_ID.ROOT)
|
local vtN = EgtTextNormVersor( Proc.Id, GDB_ID.ROOT)
|
||||||
-- verifico sia un testo
|
-- verifico sia un testo
|
||||||
if not vtN then
|
if not vtN then
|
||||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Text with geometry type not accepted'
|
local sErr = 'Error : Text with geometry type not accepted'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
-- verifico che il testo non sia orientato verso il basso (-5 deg)
|
-- verifico che il testo non sia orientato verso il basso (-5 deg)
|
||||||
if vtN:getZ() < - 0.1 and not BD.DOWN_HEAD and not BD.TURN then
|
if vtN:getZ() < - 0.1 and not BD.DOWN_HEAD and not BD.ANG_TRASM and not BD.TURN then
|
||||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Text from bottom impossible'
|
local sErr = 'Error : Text from bottom impossible'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
-- abilitazione lavorazione da sotto
|
-- abilitazione lavorazione da sotto
|
||||||
local bMillUp = ( BD.DOWN_HEAD and vtN:getZ() > -0.259)
|
local bMillUp = ( BD.DOWN_HEAD and vtN:getZ() > -0.259)
|
||||||
local bMillDown = ( BD.DOWN_HEAD and vtN:getZ() < 0.174)
|
local bMillDown = ( BD.DOWN_HEAD and vtN:getZ() < 0.174)
|
||||||
|
local bMillAngTrasm = ( BD.ANG_TRASM and vtN:getZ() < -0.1)
|
||||||
-- recupero la lavorazione
|
-- recupero la lavorazione
|
||||||
local sMillType = 'Text'
|
local sMillType = EgtIf( not bMillAngTrasm, 'Text', 'Text_AT')
|
||||||
--local sMchExt = EgtIf( bMillDown, '_H2', '')
|
|
||||||
local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown)
|
local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown)
|
||||||
if not sMilling then
|
if not sMilling then
|
||||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
local sErr = 'Error : milling not found in library'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
return false, sErr
|
return false, sErr
|
||||||
end
|
end
|
||||||
@@ -74,11 +81,13 @@ function ProcessText.Make( Proc, nPhase, nRawId, nPartId)
|
|||||||
-- aggiungo geometria
|
-- aggiungo geometria
|
||||||
EgtSetMachiningGeometry( {{ Proc.Id, -1}})
|
EgtSetMachiningGeometry( {{ Proc.Id, -1}})
|
||||||
-- imposto posizione braccio porta testa
|
-- imposto posizione braccio porta testa
|
||||||
if vtN:getY() <= 0 then
|
local nSCC = MCH_SCC.NONE
|
||||||
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
|
if bMillAngTrasm then
|
||||||
|
nSCC = MCH_SCC.ADIR_NEAR
|
||||||
else
|
else
|
||||||
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
|
nSCC = EgtIf( vtN:getY() <= 0, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)
|
||||||
end
|
end
|
||||||
|
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||||
-- eseguo
|
-- eseguo
|
||||||
if not ML.ApplyMachining( true, false) then
|
if not ML.ApplyMachining( true, false) then
|
||||||
local _, sErr = EgtGetLastMachMgrError()
|
local _, sErr = EgtGetLastMachMgrError()
|
||||||
|
|||||||
+258
-122
@@ -1,5 +1,8 @@
|
|||||||
-- BeamNestProcess.lua by Egaltech s.r.l. 2021/06/14
|
-- BeamNestProcess.lua by Egaltech s.r.l. 2023/01/15
|
||||||
-- Gestione nesting automatico travi
|
-- Gestione nesting automatico travi
|
||||||
|
-- 2022/10/05 Piccole modifiche per far funzionare correttamente i compilati.
|
||||||
|
-- 2022/10/06 Corretto bug che moltiplicava i pezzi se erano presenti più grezzi della stessa sezione.
|
||||||
|
-- 2023/01/15 Piccole correzioni.
|
||||||
|
|
||||||
-- Intestazioni
|
-- Intestazioni
|
||||||
require( 'EgtBase')
|
require( 'EgtBase')
|
||||||
@@ -15,6 +18,9 @@ EgtEnableDebug( false)
|
|||||||
local sLog = ' +++ BeamNestProcess : ' .. NEST.FILE .. ', ' .. NEST.MACHINE .. ', ' .. LEN["1"]
|
local sLog = ' +++ BeamNestProcess : ' .. NEST.FILE .. ', ' .. NEST.MACHINE .. ', ' .. LEN["1"]
|
||||||
EgtOutLog( sLog)
|
EgtOutLog( sLog)
|
||||||
|
|
||||||
|
-- flag per abilitare statistiche in log
|
||||||
|
local bLogStat = false
|
||||||
|
|
||||||
-- Cancello file di log specifico
|
-- Cancello file di log specifico
|
||||||
local sLogFile = EgtChangePathExtension( NEST.FILE, '.txt')
|
local sLogFile = EgtChangePathExtension( NEST.FILE, '.txt')
|
||||||
EgtEraseFile( sLogFile)
|
EgtEraseFile( sLogFile)
|
||||||
@@ -85,9 +91,9 @@ local function ExecMaximumFilling( Raw, Parts)
|
|||||||
EgtMaxFillerAddPart( i, Parts[i].Len, Parts[i].DispLen or Parts[i].Len, Parts[i].Cnt or 1)
|
EgtMaxFillerAddPart( i, Parts[i].Len, Parts[i].DispLen or Parts[i].Len, Parts[i].Cnt or 1)
|
||||||
end
|
end
|
||||||
-- Eseguo l'ottimizzazione
|
-- Eseguo l'ottimizzazione
|
||||||
EgtStartCounter()
|
--EgtStartCounter()
|
||||||
EgtMaxFillerCompute( Raw.LenToFill, Raw.StartGap, Raw.MidGap, Raw.EndGap, Raw.SortType)
|
EgtMaxFillerCompute( Raw.LenToFill, Raw.StartGap, Raw.MidGap, Raw.EndGap, Raw.SortType)
|
||||||
local dTime = EgtStopCounter()
|
--local dTime = EgtStopCounter()
|
||||||
-- Recupero i risultati
|
-- Recupero i risultati
|
||||||
local nFilledParts, nDiffParts, dTotFillRatio = EgtMaxFillerGetResults()
|
local nFilledParts, nDiffParts, dTotFillRatio = EgtMaxFillerGetResults()
|
||||||
local OneRes = {}
|
local OneRes = {}
|
||||||
@@ -95,7 +101,8 @@ local function ExecMaximumFilling( Raw, Parts)
|
|||||||
local nPartId, nCount = EgtMaxFillerGetOneResult( i)
|
local nPartId, nCount = EgtMaxFillerGetOneResult( i)
|
||||||
table.insert( OneRes, { Id=nPartId, Count=nCount})
|
table.insert( OneRes, { Id=nPartId, Count=nCount})
|
||||||
end
|
end
|
||||||
return { FilledParts=nFilledParts, DiffParts=nDiffParts, FillRatio=dTotFillRatio, Time=dTime, Data=OneRes}
|
--return { FilledParts=nFilledParts, DiffParts=nDiffParts, FillRatio=dTotFillRatio, Time=dTime, Data=OneRes}
|
||||||
|
return { FilledParts=nFilledParts, DiffParts=nDiffParts, FillRatio=dTotFillRatio, Data=OneRes}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Funzione per trovare nome MachGroup
|
-- Funzione per trovare nome MachGroup
|
||||||
@@ -153,27 +160,37 @@ local nErrCnt = 0
|
|||||||
local nWarnCnt = 0
|
local nWarnCnt = 0
|
||||||
|
|
||||||
-- Grezzi
|
-- Grezzi
|
||||||
-- lista dei grezzi
|
|
||||||
local Raws = {}
|
local Raws = {}
|
||||||
-- creo tabella dei grezzi
|
-- creo tabella dei grezzi
|
||||||
for nIndex, nLen in pairs( LEN) do
|
for nIndex, nLen in pairs( LEN) do
|
||||||
table.insert(Raws, {LenToFill = nLen, StartGap = NEST.STARTOFFSET, MidGap = NEST.OFFSET, EndGap = 0, SortType = -1})
|
Raws[tonumber(nIndex)] = {LenToFill = nLen, StartGap = NEST.STARTOFFSET, MidGap = NEST.OFFSET, EndGap = 0, SortType = -1}
|
||||||
end
|
end
|
||||||
for nIndex, nQty in pairs( QTY) do
|
for nIndex, nQty in pairs( QTY) do
|
||||||
Raws[tonumber(nIndex)].Count = nQty
|
Raws[tonumber(nIndex)].Count = nQty
|
||||||
end
|
end
|
||||||
|
-- cerco il grezzo con la lunghezza maggiore, epurata dello start gap
|
||||||
--local nTotRaws = Raws.Count
|
local maxRawLenToFillNoStartGap = 0
|
||||||
|
for RawIndex = 1, #Raws do
|
||||||
|
if Raws[RawIndex].Count > 0 then
|
||||||
|
maxRawLenToFillNoStartGap = max( maxRawLenToFillNoStartGap, Raws[RawIndex].LenToFill - Raws[RawIndex].StartGap)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Pezzi
|
-- Pezzi
|
||||||
local Parts = {}
|
local Parts = {}
|
||||||
|
|
||||||
-- ciclo su pezzi per aggiungerli al nesting
|
-- ciclo su pezzi per aggiungerli al nesting
|
||||||
|
local dTotLen = 0
|
||||||
for nPartId, nCount in pairs( PART) do
|
for nPartId, nCount in pairs( PART) do
|
||||||
-- recupero lunghezza pezzo
|
-- recupero lunghezza pezzo
|
||||||
local Len = EgtGetInfo( nPartId, "L", 'd')
|
local Len = EgtGetInfo( nPartId, "L", 'd')
|
||||||
local DispLen = EgtIf( Len <= 1000, 2000, 0) --EgtIf( Len <= 2000, max( 2000, 6000 - Len), 0)
|
local DispLen = EgtIf( Len <= 1000, 2000, 0) --EgtIf( Len <= 2000, max( 2000, 6000 - Len), 0)
|
||||||
table.insert( Parts, {Id = nPartId, Len = Len, DispLen = DispLen, Cnt = nCount})
|
-- aggiungo il pezzo solo se ci sta nel grezzo più lungo a disposizione
|
||||||
|
if Len < maxRawLenToFillNoStartGap then
|
||||||
|
for nCntIndex = 1 , nCount do
|
||||||
|
table.insert( Parts, {Id = nPartId, Len = Len, DispLen = DispLen, Cnt = 1})
|
||||||
|
dTotLen = dTotLen + Len
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- lunghezza totale pezzi
|
-- lunghezza totale pezzi
|
||||||
@@ -191,128 +208,247 @@ local MediumRawQty = ceil( RawQtySum / #NeededRawsForType)
|
|||||||
if MediumRawQty > 1 then
|
if MediumRawQty > 1 then
|
||||||
MediumRawQty = MediumRawQty - 1
|
MediumRawQty = MediumRawQty - 1
|
||||||
end
|
end
|
||||||
-- recupero pezzi piu' corti di mille
|
|
||||||
local ShortList = {}
|
-- lista dei risultati
|
||||||
local LongList = {}
|
local ResultList = {}
|
||||||
for PartIndex = 1, #Parts do
|
local BestResult = nil
|
||||||
if Parts[PartIndex].Len <= 1000 then
|
local BestResultIndex = nil
|
||||||
table.insert( ShortList, Parts[PartIndex])
|
-- riordino lista pezzi per lunghezza
|
||||||
else
|
table.sort( Parts, function( B1, B2) return B1.Len < B2.Len end)
|
||||||
table.insert( LongList, Parts[PartIndex])
|
|
||||||
|
local function NestSolutionByIndex( Index)
|
||||||
|
|
||||||
|
-- creo copia lista raw
|
||||||
|
local TempRaws = {}
|
||||||
|
for TempRawIndex = 1, #Raws do
|
||||||
|
table.insert(TempRaws, {LenToFill = Raws[TempRawIndex].LenToFill, StartGap = Raws[TempRawIndex].StartGap, MidGap = Raws[TempRawIndex].MidGap, EndGap = Raws[TempRawIndex].EndGap, SortType = Raws[TempRawIndex].SortType, Count = Raws[TempRawIndex].Count})
|
||||||
end
|
end
|
||||||
end
|
|
||||||
-- numero di pezzi piccoli per barra
|
-- recupero pezzi corti
|
||||||
local ShortCount = 0
|
local ShortList = {}
|
||||||
for ShortIndex = 1, #ShortList do
|
local LongList = {}
|
||||||
ShortCount = ShortCount + ShortList[ShortIndex].Cnt
|
|
||||||
end
|
for PartIndex = 1, #Parts do
|
||||||
local ShortForRaw = floor( ShortCount / MediumRawQty)
|
if PartIndex <= Index then
|
||||||
local ExtraShortForRaw = fmod( ShortCount, MediumRawQty)
|
table.insert( ShortList, Parts[PartIndex])
|
||||||
-- creo lista pezzi corti singoli
|
else
|
||||||
local SingleShortList = {}
|
table.insert( LongList, Parts[PartIndex])
|
||||||
for ShortIndex = 1, #ShortList do
|
end
|
||||||
for ShortCount = 1, ShortList[ShortIndex].Cnt do
|
Parts[PartIndex].Cnt = 1
|
||||||
table.insert( SingleShortList, {Id = ShortList[ShortIndex].Id, Len = ShortList[ShortIndex].Len, DispLen = ShortList[ShortIndex].DispLen, Cnt = 1})
|
|
||||||
end
|
end
|
||||||
end
|
-- numero di pezzi piccoli per barra
|
||||||
-- li divido per le barre previste
|
local ShortCount = Index
|
||||||
local RawsShortList = {}
|
local ShortForRaw = floor( ShortCount / MediumRawQty)
|
||||||
local RawIndex = 0
|
local ExtraShortForRaw = 0
|
||||||
local ShortRawIndex = 0
|
if MediumRawQty > 0 then
|
||||||
for ShortIndex = 1, #SingleShortList do
|
ExtraShortForRaw = fmod( ShortCount, MediumRawQty)
|
||||||
if ShortRawIndex > 0 then
|
end
|
||||||
table.insert( RawsShortList[RawIndex], SingleShortList[ShortIndex])
|
-- creo lista pezzi corti singoli
|
||||||
ShortRawIndex = ShortRawIndex - 1
|
local SingleShortList = {}
|
||||||
else
|
for ShortIndex = 1, #ShortList do
|
||||||
table.insert( RawsShortList, {SingleShortList[ShortIndex]})
|
for ShortCount = 1, ShortList[ShortIndex].Cnt do
|
||||||
RawIndex = RawIndex + 1
|
table.insert( SingleShortList, {Id = ShortList[ShortIndex].Id, Len = ShortList[ShortIndex].Len, DispLen = ShortList[ShortIndex].DispLen, Cnt = 1})
|
||||||
ShortRawIndex = ShortForRaw + EgtIf( RawIndex <= ExtraShortForRaw, 1, 0) - 1
|
end
|
||||||
|
end
|
||||||
|
-- li divido per le barre previste
|
||||||
|
local RawsShortList = {}
|
||||||
|
local RawIndex = 0
|
||||||
|
local ShortRawIndex = 0
|
||||||
|
for ShortIndex = 1, #SingleShortList do
|
||||||
|
if ShortRawIndex > 0 then
|
||||||
|
table.insert( RawsShortList[RawIndex], SingleShortList[ShortIndex])
|
||||||
|
ShortRawIndex = ShortRawIndex - 1
|
||||||
|
else
|
||||||
|
table.insert( RawsShortList, {SingleShortList[ShortIndex]})
|
||||||
|
RawIndex = RawIndex + 1
|
||||||
|
ShortRawIndex = ShortForRaw + EgtIf( RawIndex <= ExtraShortForRaw, 1, 0) - 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Ciclo fino ad esaurimento pezzi o barre
|
||||||
|
local dTotPartInRawLen = 0
|
||||||
|
local nRawTot = 0
|
||||||
|
local dRawTotLen = 0
|
||||||
|
local dTime = 0
|
||||||
|
local nCycle = 1
|
||||||
|
local CurrResult = {}
|
||||||
|
while TotRawCount( TempRaws) > 0 and PartsToFill( Parts) > 0 do
|
||||||
|
|
||||||
|
-- creo lista con pezzi lunghi e pezzi corti di questo Cycle
|
||||||
|
local PartsToNest = {}
|
||||||
|
for PartIndex = 1, #LongList do
|
||||||
|
table.insert( PartsToNest, LongList[PartIndex])
|
||||||
|
end
|
||||||
|
for CycleIndex = 1, #RawsShortList do
|
||||||
|
if CycleIndex <= nCycle then
|
||||||
|
for PartIndex = 1, #RawsShortList[CycleIndex] do
|
||||||
|
table.insert( PartsToNest, RawsShortList[CycleIndex][PartIndex])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- se non ci sono pezzi da nestare, esco
|
||||||
|
if PartsToFill( PartsToNest) <= 0 then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
-- Eseguo ottimizzazione per ogni lunghezza di barra
|
||||||
|
local Results = {}
|
||||||
|
for RawIndex = 1, #TempRaws do
|
||||||
|
if TempRaws[RawIndex].Count > 0 then
|
||||||
|
Results[RawIndex] = ExecMaximumFilling( TempRaws[RawIndex], PartsToNest)
|
||||||
|
else
|
||||||
|
Results[RawIndex] = { FillRatio = 0.001, LenToFill = 1000, DiffParts = 0}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- verifico quale e' quella con meno scarto
|
||||||
|
local nMinWasteRawIndex = GDB_ID.NULL
|
||||||
|
local dMinWaste = 100000
|
||||||
|
for ResultIndex = 1, #Results do
|
||||||
|
if Results[ResultIndex] then
|
||||||
|
local dWaste = (1 - Results[ResultIndex].FillRatio) * TempRaws[ResultIndex].LenToFill
|
||||||
|
if Results[ResultIndex].DiffParts > 0 and dWaste < dMinWaste then
|
||||||
|
dMinWaste = dWaste
|
||||||
|
nMinWasteRawIndex = ResultIndex
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- verifico se ci sono pezzi
|
||||||
|
if nMinWasteRawIndex > 0 and Results[nMinWasteRawIndex] and Results[nMinWasteRawIndex].DiffParts > 0 then
|
||||||
|
-- riporto barra e pezzi nel risultato corrente
|
||||||
|
local CurrBar = { BarLen = TempRaws[nMinWasteRawIndex].LenToFill, Parts = {}}
|
||||||
|
local CurrX = TempRaws[nMinWasteRawIndex].StartGap
|
||||||
|
local nInfoIndex = 1
|
||||||
|
for i = 1, Results[nMinWasteRawIndex].DiffParts do
|
||||||
|
local PartIndex = Results[nMinWasteRawIndex].Data[i].Id
|
||||||
|
local PartId = PartsToNest[PartIndex].Id
|
||||||
|
local dLen = PartsToNest[PartIndex].Len
|
||||||
|
for j = 1, Results[nMinWasteRawIndex].Data[i].Count do
|
||||||
|
-- creo pezzo copia
|
||||||
|
CurrPart = { Index = nInfoIndex, PartId = PartId, PosX = CurrX}
|
||||||
|
table.insert( CurrBar.Parts, CurrPart)
|
||||||
|
CurrX = CurrX + dLen + TempRaws[nMinWasteRawIndex].MidGap
|
||||||
|
nInfoIndex = nInfoIndex + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
table.insert( CurrResult, CurrBar)
|
||||||
|
dTotPartInRawLen = dTotPartInRawLen + ( Results[nMinWasteRawIndex].FillRatio * TempRaws[nMinWasteRawIndex].LenToFill)
|
||||||
|
nRawTot = nRawTot + 1
|
||||||
|
dRawTotLen = dRawTotLen + TempRaws[nMinWasteRawIndex].LenToFill
|
||||||
|
-- Aggiorno per prossima iterazione
|
||||||
|
TempRaws[nMinWasteRawIndex].Count = TempRaws[nMinWasteRawIndex].Count - 1
|
||||||
|
for i = 1, Results[nMinWasteRawIndex].DiffParts do
|
||||||
|
local PartId = Results[nMinWasteRawIndex].Data[i].Id
|
||||||
|
PartsToNest[PartId].Cnt = PartsToNest[PartId].Cnt - Results[nMinWasteRawIndex].Data[i].Count
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- se non sono riuscito ad inserire alcun pezzo esco dal ciclo perche' non ci sono pezzi inseribili
|
||||||
|
break
|
||||||
|
end
|
||||||
|
nCycle = nCycle + 1
|
||||||
|
end
|
||||||
|
-- riporto risultato in lista
|
||||||
|
ResultList[Index] = dTotPartInRawLen
|
||||||
|
if not BestResult or not BestResultIndex or
|
||||||
|
( dTotPartInRawLen > ResultList[BestResultIndex] + 0.02 or ( abs( dTotPartInRawLen - ResultList[BestResultIndex]) < 0.02 and dRawTotLen < BestResult.RawTotLen - 0.02)) then
|
||||||
|
BestResult = CurrResult
|
||||||
|
BestResult.RawTotLen = dRawTotLen
|
||||||
|
BestResultIndex = Index
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Ciclo fino ad esaurimento pezzi o barre
|
local CycleCount = 0
|
||||||
local nRawTot = 0
|
|
||||||
local dTime = 0
|
local MinTime = 10 + pow( 3, ceil( log10( #Parts)) - 1)
|
||||||
local nCycle = 1
|
if bLogStat then EgtOutLog('MinTime: ' .. MinTime ) end
|
||||||
while TotRawCount( Raws) > 0 and PartsToFill( Parts) > 0 do
|
local MaxTime = 30 + pow( 7, ceil( log10( #Parts)) - 1)
|
||||||
|
if bLogStat then EgtOutLog('MaxTime: ' .. MaxTime ) end
|
||||||
|
local TargetRatio = 0.98
|
||||||
|
local dTargetRatioLen = TargetRatio * dTotLen
|
||||||
|
if bLogStat then EgtOutLog('TargetRatioLen: ' .. dTargetRatioLen ) end
|
||||||
|
local CurrTime = 0
|
||||||
|
|
||||||
|
local function NestSolutionFromSP( StartingPoint, OscillationStep)
|
||||||
|
-- ciclo sulle possibilita' da un punto di origine con uno step fisso
|
||||||
|
local CurrResultIndex = StartingPoint
|
||||||
|
NestSolutionByIndex( StartingPoint)
|
||||||
|
if OscillationStep == 0 then return end
|
||||||
|
local CycleIndex = 1
|
||||||
|
local nOutOfBoundary = 0
|
||||||
|
while nOutOfBoundary ~= 3 do
|
||||||
|
CurrTime = EgtStopCounter() / 1000
|
||||||
|
if bLogStat then EgtOutLog('CurrTime: ' .. CurrTime ) end
|
||||||
|
if bLogStat then EgtOutLog('BestRatio: ' .. dTotLen / BestResult.RawTotLen ) end
|
||||||
|
-- se e' passato il tempo massimo, o e' passato il tempo minimo, ha inserito tutti i pezzi e la percentuale di utilizzo del materiale e' maggiore della soglia
|
||||||
|
if CurrTime > MaxTime or ( CurrTime > MinTime and ResultList[BestResultIndex] > dTotLen - 0.1 and ( dTotLen / BestResult.RawTotLen ) >= TargetRatio) then
|
||||||
|
if bLogStat then EgtOutLog('Brake') end
|
||||||
|
break
|
||||||
|
end
|
||||||
|
local bCurrOutOfBoundary = false
|
||||||
|
if CurrResultIndex < 0 then
|
||||||
|
bCurrOutOfBoundary = true
|
||||||
|
if nOutOfBoundary == 2 then
|
||||||
|
nOutOfBoundary = 3
|
||||||
|
else
|
||||||
|
nOutOfBoundary = 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if CurrResultIndex > #Parts then
|
||||||
|
bCurrOutOfBoundary = true
|
||||||
|
if nOutOfBoundary == 1 then
|
||||||
|
nOutOfBoundary = 3
|
||||||
|
else
|
||||||
|
nOutOfBoundary = 2
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not bCurrOutOfBoundary and not ResultList[CurrResultIndex] then
|
||||||
|
NestSolutionByIndex( CurrResultIndex)
|
||||||
|
if bLogStat then EgtOutLog('CurrResultIndex: ' .. CurrResultIndex ) end
|
||||||
|
if bLogStat then EgtOutLog('Result: ' .. ResultList[CurrResultIndex]) end
|
||||||
|
CycleCount = CycleCount + 1
|
||||||
|
end
|
||||||
|
CurrResultIndex = StartingPoint + EgtIf( CycleIndex % 2 == 0, (CycleIndex / 2) * OscillationStep, -( ( CycleIndex + 1) / 2) * OscillationStep )
|
||||||
|
CycleIndex = CycleIndex + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- creo lista pezzi con pezzi lunghi e pezzi corti di questo Cycle
|
-- lancio calcolo
|
||||||
local PartsToNest = {}
|
EgtStartCounter()
|
||||||
for PartIndex = 1, #LongList do
|
local StartingResult = floor( #Parts * 0.3)
|
||||||
table.insert( PartsToNest, LongList[PartIndex])
|
if bLogStat then EgtOutLog('StartingResult: ' .. StartingResult ) end
|
||||||
|
--local Step = floor( #Parts / 10) * floor( log10( #Parts))
|
||||||
|
local nDividendo = pow( 10, floor( log10( #Parts)) - 1)
|
||||||
|
nDividendo = EgtIf( nDividendo ~= 1, nDividendo, 10)
|
||||||
|
local Step = floor( #Parts / nDividendo) * floor( log10( #Parts))
|
||||||
|
if bLogStat then EgtOutLog('Step: ' .. Step ) end
|
||||||
|
NestSolutionFromSP( StartingResult, Step)
|
||||||
|
if Step > 1 then
|
||||||
|
NestSolutionFromSP( StartingResult, 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- creo gruppi di lavorazione per risultato
|
||||||
|
for MachGroupIndex = 1, #BestResult do
|
||||||
|
local CurrMachGroup = BestResult[ MachGroupIndex]
|
||||||
|
-- creo gruppo di lavorazione
|
||||||
|
local MachGroupName = NewMachGroupName()
|
||||||
|
nMachGroup = EgtAddMachGroup( MachGroupName)
|
||||||
|
EgtSetInfo( nMachGroup, "BARLEN", CurrMachGroup.BarLen)
|
||||||
|
EgtSetInfo( nMachGroup, "MATERIAL", NEST.MATERIAL)
|
||||||
|
EgtSetInfo( nMachGroup, "AUTONEST", 1)
|
||||||
|
-- scrivo dati per variabili P di comunicazione con la macchina in gruppo di lavorazione
|
||||||
|
EgtSetInfo( nMachGroup, "PRODID", NEST.PRODID)
|
||||||
|
EgtSetInfo( nMachGroup, "PATTID", nMachGroup)
|
||||||
|
-- Disegno i pezzi
|
||||||
|
for i = 1, #CurrMachGroup.Parts do
|
||||||
|
local CurrPart = CurrMachGroup.Parts[ i]
|
||||||
|
-- creo pezzo copia
|
||||||
|
local nPartDuploId = EgtDuploNew( CurrPart.PartId)
|
||||||
|
EgtSetInfo( nMachGroup, "PART" .. CurrPart.Index, nPartDuploId .. "," .. CurrPart.PosX)
|
||||||
end
|
end
|
||||||
for CycleIndex = 1, #RawsShortList do
|
|
||||||
if CycleIndex <= nCycle then
|
|
||||||
for PartIndex = 1, #RawsShortList[CycleIndex] do
|
|
||||||
table.insert( PartsToNest, RawsShortList[CycleIndex][PartIndex])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- se non ci sono pezzi da nestare, esco
|
|
||||||
if PartsToFill( PartsToNest) <= 0 then
|
|
||||||
break
|
|
||||||
end
|
|
||||||
-- Eseguo ottimizzazione per ogni lunghezza di barra
|
|
||||||
local Results = {}
|
|
||||||
for RawIndex = 1, #Raws do
|
|
||||||
if Raws[RawIndex].Count > 0 then
|
|
||||||
Results[RawIndex] = ExecMaximumFilling( Raws[RawIndex], PartsToNest)
|
|
||||||
else
|
|
||||||
Results[RawIndex] = { FillRatio = 0.001, LenToFill = 1000}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- verifico quale e' quella con meno scarto
|
|
||||||
local nMinWasteRawIndex = GDB_ID.NULL
|
|
||||||
local dMinWaste = 100000
|
|
||||||
for ResultIndex = 1, #Results do
|
|
||||||
if Results[ResultIndex] then
|
|
||||||
local dWaste = (1 - Results[ResultIndex].FillRatio) * Raws[ResultIndex].LenToFill
|
|
||||||
if dWaste < dMinWaste then
|
|
||||||
dMinWaste = dWaste
|
|
||||||
nMinWasteRawIndex = ResultIndex
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- verifico se ci sono pezzi
|
|
||||||
if nMinWasteRawIndex > 0 and Results[nMinWasteRawIndex] and Results[nMinWasteRawIndex].DiffParts > 0 then
|
|
||||||
-- creo gruppo di lavorazione
|
|
||||||
local MachGroupName = NewMachGroupName()
|
|
||||||
nMachGroup = EgtAddMachGroup( MachGroupName)
|
|
||||||
EgtSetInfo( nMachGroup, "BARLEN", Raws[nMinWasteRawIndex].LenToFill)
|
|
||||||
EgtSetInfo( nMachGroup, "MATERIAL", NEST.MATERIAL)
|
|
||||||
EgtSetInfo( nMachGroup, "AUTONEST", 1)
|
|
||||||
-- scrivo dati per variabili P di comunicazione con la macchina in gruppo di lavorazione
|
|
||||||
EgtSetInfo( nMachGroup, "PRODID", NEST.PRODID)
|
|
||||||
EgtSetInfo( nMachGroup, "PATTID", nMachGroup)
|
|
||||||
-- Disegno i pezzi
|
|
||||||
local CurrX = Raws[nMinWasteRawIndex].StartGap
|
|
||||||
local nInfoIndex = 1
|
|
||||||
for i = 1, Results[nMinWasteRawIndex].DiffParts do
|
|
||||||
local PartIndex = Results[nMinWasteRawIndex].Data[i].Id
|
|
||||||
local PartId = PartsToNest[PartIndex].Id
|
|
||||||
local dLen = PartsToNest[PartIndex].Len
|
|
||||||
for j = 1, Results[nMinWasteRawIndex].Data[i].Count do
|
|
||||||
-- creo pezzo copia
|
|
||||||
local nPartDuploId = EgtDuploNew( PartId)
|
|
||||||
EgtSetInfo( nMachGroup, "PART" .. nInfoIndex, nPartDuploId .. "," .. CurrX)
|
|
||||||
CurrX = CurrX + dLen + Raws[nMinWasteRawIndex].MidGap
|
|
||||||
nInfoIndex = nInfoIndex + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
nRawTot = nRawTot + 1
|
|
||||||
-- Aggiorno per prossima iterazione
|
|
||||||
Raws[nMinWasteRawIndex].Count = Raws[nMinWasteRawIndex].Count - 1
|
|
||||||
for i = 1, Results[nMinWasteRawIndex].DiffParts do
|
|
||||||
local PartId = Results[nMinWasteRawIndex].Data[i].Id
|
|
||||||
PartsToNest[PartId].Cnt = PartsToNest[PartId].Cnt - Results[nMinWasteRawIndex].Data[i].Count
|
|
||||||
end
|
|
||||||
end
|
|
||||||
nCycle = nCycle + 1
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- creo grezzi per ogni gruppo di lavorazione
|
-- creo grezzi per ogni gruppo di lavorazione
|
||||||
local nRawCnt = 0
|
local nRawCnt = 0
|
||||||
|
local nRawTot = ResultList[BestResultIndex]
|
||||||
_G.BEAM = {}
|
_G.BEAM = {}
|
||||||
BEAM.FILE = NEST.FILE
|
BEAM.FILE = NEST.FILE
|
||||||
BEAM.MACHINE = NEST.MACHINE
|
BEAM.MACHINE = NEST.MACHINE
|
||||||
@@ -325,7 +461,7 @@ while nMachGroup do
|
|||||||
if EgtGetInfo( nMachGroup, "AUTONEST",'i') == 1 then
|
if EgtGetInfo( nMachGroup, "AUTONEST",'i') == 1 then
|
||||||
EgtRemoveInfo( nMachGroup, "AUTONEST")
|
EgtRemoveInfo( nMachGroup, "AUTONEST")
|
||||||
EgtSetInfo( nMachGroup, "UPDATEUI", 1)
|
EgtSetInfo( nMachGroup, "UPDATEUI", 1)
|
||||||
local bOk, sErr = pcall( dofile, EgtGetSourceDir() .. "BatchProcessNew.lua")
|
local bOk, sErr = pcall( dofile, BEAM.BASEDIR .. "\\BatchProcessNew.lua")
|
||||||
if not bOk then
|
if not bOk then
|
||||||
EgtOutLog( 'Error in BatchProcessNew.lua call (' .. ( sErr or '') ..')')
|
EgtOutLog( 'Error in BatchProcessNew.lua call (' .. ( sErr or '') ..')')
|
||||||
end
|
end
|
||||||
|
|||||||
+11
-4
@@ -62,7 +62,7 @@ local function MyProcessInputData()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not bFound then
|
if not bFound then
|
||||||
table.insert( vBeam, { Id = nPartId, Name = ( EgtGetName( nPartId) or ( 'Id=' .. tonumber( nPartId)))})
|
table.insert( vBeam, { Ind = #vBeam + 1, Id = nPartId, Name = ( EgtGetName( nPartId) or ( 'Id=' .. tonumber( nPartId)))})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
nId = EgtGetNextSelectedObj()
|
nId = EgtGetNextSelectedObj()
|
||||||
@@ -116,7 +116,13 @@ local function MyProcessInputData()
|
|||||||
EgtDeselectAll()
|
EgtDeselectAll()
|
||||||
|
|
||||||
-- Le ordino in senso di lunghezza crescente
|
-- Le ordino in senso di lunghezza crescente
|
||||||
table.sort( vBeam, function( B1, B2) return B1.Box:getDimX() < B2.Box:getDimX() end)
|
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
|
do
|
||||||
local sOut = ''
|
local sOut = ''
|
||||||
for i = 1, #vBeam do
|
for i = 1, #vBeam do
|
||||||
@@ -144,10 +150,11 @@ local function MyProcessBeams()
|
|||||||
end
|
end
|
||||||
dTotLen = dTotLen + max( vBeam[#vBeam].Box:getDimX(), BD.MinRaw)
|
dTotLen = dTotLen + max( vBeam[#vBeam].Box:getDimX(), BD.MinRaw)
|
||||||
local dAddLen = BD.OVM_HEAD + ( #vBeam - 1) * BD.OVM_MID
|
local dAddLen = BD.OVM_HEAD + ( #vBeam - 1) * BD.OVM_MID
|
||||||
EgtOutLog( 'Ltot : ' .. EgtNumToString( dTotLen, 1) .. ' Lagg : '.. EgtNumToString( dAddLen, 1), 1)
|
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 e sovramateriale di testa
|
||||||
local vsVal = EgtDialogBox( 'Lavora Travi' .. ' (Ltot='.. EgtNumToString( dTotLen + dAddLen + 0.5, 0) .. ', Lmax=' .. EgtNumToString( BD.MAX_RAW, 0) .. ')',
|
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)},
|
{'Lunghezza grezzo', EgtNumToString( BD.STD_RAW, 0)},
|
||||||
{'Sovramateriale di testa', EgtNumToString( BD.OVM_HEAD, 0)},
|
{'Sovramateriale di testa', EgtNumToString( BD.OVM_HEAD, 0)},
|
||||||
{'Forza sezione verticale', ' CB:true,*false'})
|
{'Forza sezione verticale', ' CB:true,*false'})
|
||||||
|
|||||||
@@ -0,0 +1,89 @@
|
|||||||
|
==== Beam Update Log ====
|
||||||
|
|
||||||
|
Versione 2.5i1 (12/09/2023)
|
||||||
|
- Fixed : in LapJoint gestito correttamente il ritorno nil di GetUShapeWidth [Ticket #1354].
|
||||||
|
|
||||||
|
Versione 2.5h1 (07/08/2023)
|
||||||
|
- Fixed : tagli doppi di lato non effettuati se macchina tipo PF e pezzo alto [Ticket #1400]
|
||||||
|
- Fixed : in split e headcut corretto calcolo allungamenti/accorciamenti pezzi alti per contemplare anche taglio singolo [Ticket #1227]
|
||||||
|
- Fixed : in lapjoint piccola correzione al calcolo della distanza di sicurezza in base al gambo dell'utensile [Ticket #1227]
|
||||||
|
- Fixed : in Lapjoint corretto incremento della profondità pari al raggio utensile per tunnel con sega a catena [Ticket #1212]
|
||||||
|
|
||||||
|
Versione 2.5g3 (01/08/2023)
|
||||||
|
- Added : aggiunta gestione tasche chiuse ad orientamento verticale con rinvio angolare [Ticket #1333]
|
||||||
|
- Modif : in LongCut ammesso uso lama da sotto fino a Norm +3deg in verticale
|
||||||
|
- Fixed : in Cut correzione calcolo offset per taglio doppio di lato [Ticket #1400].
|
||||||
|
|
||||||
|
Versione 2.5g2 (31/07/2023)
|
||||||
|
- Added : in FreeContour, solo se pocket, aggiunta Q06 per specificare un eventuale offset radiale del contorno [Ticket #1334]
|
||||||
|
- Added : aggiunta gestione forature verticali con rinvio angolare [Ticket #1332]
|
||||||
|
- Fixed : corretta gestione antischeggia con lama su LapJoint [Ticket #1351]
|
||||||
|
- Fixed : in ProfConvex, ProfConcave e ProfHead corretto e semplificato ModifySideInvertLead per invert [Ticket #1330]
|
||||||
|
- Fixed : corretto il funzionamento delle mortase in doppio [Ticket #1404].
|
||||||
|
|
||||||
|
Versione 2.5g1 (05/07/2023)
|
||||||
|
- Modif : in DiceCut modificata scelta tagli ortogonali quando liberi (esteso caso di verticali ammessi)
|
||||||
|
- Modif : in LapJoint estesi casi riconoscimento in coda basato su lunghezza
|
||||||
|
- Fixed : nelle mortase passanti escluso il riconoscimento lati aperti che portava a lavorazioni errate [Ticket #1342]
|
||||||
|
- Fixed : in LapJoint impedito l'uso del truciolatore se la tasca è chiusa [Ticket #1361]
|
||||||
|
- Fixed : migliorato controllo fattibilità taglio di fianco con cubetti.
|
||||||
|
|
||||||
|
Versione 2.5f4 (21/06/2023)
|
||||||
|
- Added : aggiunti tagli speciali per evitare il rischio che il cubetto rimanga appoggiato al motore [Ticket #1004, #1214]
|
||||||
|
- Fixed : corretto attacco speciale in FreeContour [Ticket #1250]
|
||||||
|
|
||||||
|
Versione 2.5f3 (16/06/2023)
|
||||||
|
- Fixed : correzione scelta di approccio lama in casi speciali
|
||||||
|
- Fixed : correzione a tagli aggiuntivi orizzontali negli split.
|
||||||
|
|
||||||
|
Versione 2.5f2 (12/06/2023)
|
||||||
|
- Fixed : in LapJoint corretto il recupero dati utensile che, in alcune funzioni, puntava all'utensile errato
|
||||||
|
- Fixed : In BeamLib -> ChangeOrOpenStart corretta ricerca segmento più lungo.
|
||||||
|
|
||||||
|
Versione 2.5f1 (08/05/2023)
|
||||||
|
- Modif : in Process (esecuzione manuale da Cam5) ordinamento travi di lunghezza praticamente uguale dipende da ordine di selezione
|
||||||
|
- Modif : in LapJoint limiti su svuotature tasche a L 4 facce come per L 3 facce
|
||||||
|
- Modif : in LapJoint su svuotature aggiunto recupero UserNotes da libreria per MaxOptSize.
|
||||||
|
- Fixed : in LongDoubleCut corretta scelta SCC (orientamento braccio testa) per macchine TURN nel caso di concavi
|
||||||
|
|
||||||
|
Versione 2.5e5 (26/05/2023)
|
||||||
|
- Modif : riconoscimento fori da sotto anche dalla faccia di ingresso
|
||||||
|
- Modif : in foratura se TURN aggiunta possibilità di forare da sotto.
|
||||||
|
- Fixed : correzioni a Profili Concavo e Convesso per TURN
|
||||||
|
- Fixed : correzione a foratura per ignorare fori annegati nel pezzo
|
||||||
|
|
||||||
|
Versione 2.5e4 (23/05/2023)
|
||||||
|
- Modif : in LongCut migliorato calcolo e verifica affondamento per lavorazione con lama con codolo in mezzo
|
||||||
|
- Fixed : correzione SCC lama per macchina Turn [Ticket #1258]
|
||||||
|
|
||||||
|
Versione 2.5e3 (11/05/2023)
|
||||||
|
- Modif : in taglio di separazione aggiunta richiesta risalita preliminare a Zmax quando da sopra su macchine PF e ONE
|
||||||
|
- Fixed : in lavorazioni in doppio correzione riconoscimento per possibile lavorazione in doppio di tasche che si toccano sul fondo
|
||||||
|
- Fixed : in lavorazioni in doppio con lavorazione precedente differente forzata risalita a Zmax per vitare problemi di riposizionamento [Ticket #1062]
|
||||||
|
|
||||||
|
Versione 2.5e2 (04/05/2023)
|
||||||
|
- Modif : Piccola modifica a SCC per LongCut derivanti da Cut
|
||||||
|
|
||||||
|
Versione 2.5e1 (03/05/2023)
|
||||||
|
- Modif : in TS3v7 tolleranza su quote sezione portata a 0.1 mm
|
||||||
|
- Fixed : Corretto SCC in caso di asse utensile allineato con Z [Ticket #1232]
|
||||||
|
|
||||||
|
Versione 2.5d2 (20/04/2023)
|
||||||
|
- Added : nei tagli di testa e coda, nel caso di travi alte, aggiunti tagli orizzontali per diminuire la dimensione degli sfridi [Ticket #1175, #1185]
|
||||||
|
- Modif : unificata gestione lato testa per tagli longitudinali [Ticket #1167].
|
||||||
|
|
||||||
|
Versione 2.5d1 (06/04/23)
|
||||||
|
- Added : in svuotatura aggiunta possibilità di impostare una distanza di sicurezza minima su attacco da lato aperto
|
||||||
|
- Modif : in split per travi con sezioni molto grandi e materiale inferiore allo spessore lama, miglioramenti volti ad evitare collisioni prevedibili
|
||||||
|
- Modif : in taglio con lama piccola miglioria nella scelta della direzione di approccio per pezzi corti
|
||||||
|
- Fixed : in LapJoint correzione al calcolo della distanza di collisione nel caso in cui il gambo sia più piccolo dell'utensile [Ticket #1150]
|
||||||
|
- Fixed : corretto ordinamento per fori di coda da lasciare in coda
|
||||||
|
- Fixed : correzione per gestire la lama principale sulla testa secondaria quando questa non è una testa da sotto [Ticket #1161]
|
||||||
|
- Fixed : modifiche a Split per travi con sezioni molto grandi e materiale inferiore allo spessore lama.
|
||||||
|
|
||||||
|
Versione 2.5c8 (30/03/23)
|
||||||
|
- Modif : nei tenoni (standard e coda di rondine) migliorate e unificate condizioni scelta pretaglio con lama o fresa [Ticket #1131]
|
||||||
|
- Modif : le mortase a coda di rondine sono ora anticipate a prima dei tagli longitudinali indipendentemente dalla sovrapposizione in Y
|
||||||
|
- Modif : modificato l'ingombro dei tagli inclinati per macchine con trascinatori tipo PF
|
||||||
|
- Fixed : nelle mortase a coda di rondine corretto calcolo larghezza della mortasa per derivare numero e step passate [Ticket #1126, #1143]
|
||||||
|
- Fixed : nei tenoni a coda di rondine corretto calcolo distanza lato da lavorare quando la faccia di base è divisa in più parti.
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
-- Version.lua by Egaltech s.r.l. 2023/08/10
|
||||||
|
-- Gestione della versione di Beam
|
||||||
|
|
||||||
|
NAME = 'Beam'
|
||||||
|
VERSION = '2.5i1'
|
||||||
|
MIN_EXE = '2.5c1'
|
||||||
Reference in New Issue
Block a user