Compare commits
596 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2798616813 | |||
| fa74016932 | |||
| f309179270 | |||
| 9a6e4f8904 | |||
| ba2ff5a7a7 | |||
| d10b99dc3c | |||
| 743270ed4d | |||
| ad0f4048aa | |||
| cb7a114124 | |||
| b9a9ce1479 | |||
| 812adeed34 | |||
| 4b41948819 | |||
| 77599a8c68 | |||
| 4f43d74d41 | |||
| 92d0ac2e93 | |||
| f7dd6c9da2 | |||
| 63b8ef4377 | |||
| e0c4f85bfb | |||
| 675b730dcf | |||
| c2e49d1804 | |||
| 5c4d7224f0 | |||
| bd956281e2 | |||
| 0f122feaac | |||
| eec524a00f | |||
| d4b7fe1910 | |||
| 880cecfde2 | |||
| b05d1aa7b8 | |||
| b775610125 | |||
| 9e284d509b | |||
| dd7a1e80b2 | |||
| 919b32ca8d | |||
| fef5db6046 | |||
| 0d5dd4d348 | |||
| e526502177 | |||
| 325f30c61b | |||
| f824cde2d0 | |||
| a61b27f292 | |||
| e582f7a38b | |||
| a813d5d742 | |||
| 93e92da027 | |||
| d862e8a2c5 | |||
| d79151c1d3 | |||
| 3d62e41811 | |||
| c796a5351f | |||
| 00d7dd2970 | |||
| eb09d0b65d | |||
| 0c7a7daba4 | |||
| 6f14e4f2c2 | |||
| 950060f4dc | |||
| 1007e08e9d | |||
| 04acc25535 | |||
| 38e26b9e48 | |||
| 72b7cbac1b | |||
| 5f1b863013 | |||
| 250802048a | |||
| a8d0bcfec4 | |||
| 459eff5610 | |||
| a749895229 | |||
| 04489421e7 | |||
| 0c16b5e969 | |||
| 9193924fbd | |||
| adbd5e944e | |||
| f76797cbd8 | |||
| 09e93d600d | |||
| 63f4df2a7d | |||
| 80c5035c74 | |||
| c9451e65e1 | |||
| 19706d6264 | |||
| 46ca7c793f | |||
| e26540193c | |||
| af107a780e | |||
| 4befa4eee3 | |||
| 07db2da825 | |||
| a4e6600510 | |||
| cb8465d977 | |||
| e867e1decf | |||
| 1cd697cf80 | |||
| 729143ce45 | |||
| 3f707396bb | |||
| 2b3a36a496 | |||
| d9e4285748 | |||
| 91d5b0ac84 | |||
| db5334217b | |||
| 54c835f717 | |||
| 86e2324856 | |||
| 36f4014969 | |||
| 7248c44406 | |||
| 044a074b76 | |||
| c0e3dab107 | |||
| 2b2157c971 | |||
| 8c697d73ac | |||
| c35d032da8 | |||
| 7447d3cc1b | |||
| bfdf80a44a | |||
| 3755521d2e | |||
| 104663a89a | |||
| e322c15099 | |||
| 5f55bc2f42 | |||
| 6c3a16d59c | |||
| 8218fcc438 | |||
| 6a83320321 | |||
| b8b5ab2a65 | |||
| e27998599b | |||
| a386c74516 | |||
| bb9dc261c1 | |||
| 0e2067e802 | |||
| 3008196992 | |||
| 876e45e1a4 | |||
| fa4d3ab9f6 | |||
| 4e6c38d82c | |||
| d3e1ac5805 | |||
| bc017d0de7 | |||
| 18e180cd12 | |||
| 6d8d32c9fb | |||
| 20074c6ea0 | |||
| 806864e360 | |||
| 052407a9be | |||
| b5660a8431 | |||
| 103d8d7eec | |||
| df47842888 | |||
| 5db475bcf7 | |||
| 010e1421c7 | |||
| e908562ab6 | |||
| aba4ebecc4 | |||
| a022ecbb7d | |||
| 605f0fcaf1 | |||
| 2676d67737 | |||
| ea64a9a3f4 | |||
| a996d4beb3 | |||
| 919f71481c | |||
| cac9ec767c | |||
| 85e6c3c86d | |||
| c548172635 | |||
| 9869d1a61e | |||
| e0c66df59b | |||
| c0156a4a97 | |||
| 93f1bc4d0d | |||
| adaeb1e19c | |||
| 2430b4e787 | |||
| b08710451a | |||
| 4adf62069f | |||
| b6e904845e | |||
| 118b9a88d2 | |||
| 73c86bd35f | |||
| d0283d7885 | |||
| 5de62b9563 | |||
| a7a9a23cf3 | |||
| 21fe8ca47d | |||
| 0f536b07c4 | |||
| 3e01fb36b0 | |||
| 3c4af3c335 | |||
| 9480453e57 | |||
| e98f924630 | |||
| eabbc883e4 | |||
| 8e19e87d3f | |||
| 0c4f57a90b | |||
| 77310576bd | |||
| 1e2f559937 | |||
| 6a6dc27560 | |||
| ab6ed79a0e | |||
| 7bb237f7d2 | |||
| 67bb55537e | |||
| 777179d1b2 | |||
| 06adbb0b5d | |||
| 872a3ec899 | |||
| 5dae07e2aa | |||
| fc26a8ad4a | |||
| ccf88745aa | |||
| 04046787e3 | |||
| a12aaf86bc | |||
| 70d16909f5 | |||
| b5145d4e99 | |||
| 5007cda21f | |||
| 76d03160c5 | |||
| 534302f48e | |||
| 60d73199e4 | |||
| 71a51e56e1 | |||
| bf9791ca9c | |||
| 249cb4eea5 | |||
| 46cda4d472 | |||
| 72b0e7f4a4 | |||
| 0e02959467 | |||
| b7837fe95c | |||
| d66eaf5322 | |||
| 05ecf76312 | |||
| 6e3a1ddc7a | |||
| df47691da1 | |||
| 8a2200e0de | |||
| 0136ccac19 | |||
| 7ee683aeb8 | |||
| e81d1aef66 | |||
| 5331466c4f | |||
| 7a972cccc8 | |||
| 2ed5af9661 | |||
| e25c24a33a | |||
| aeca298feb | |||
| a09565cfb7 | |||
| 862b375ee5 | |||
| a34147ce15 | |||
| cb3ad1d24c | |||
| 06e266226a | |||
| 74b40a6ad7 | |||
| ab7971e5f9 | |||
| e188753f49 | |||
| 9b12a74591 | |||
| e17e8189f7 | |||
| a5d4503180 | |||
| 41f92e9dd4 | |||
| c5a6300d15 | |||
| bf5c12ec8a | |||
| 777ba74e4d | |||
| 268e578125 | |||
| 13f0545ebe | |||
| 445a76f543 | |||
| 4b52653a2e | |||
| ced290604a | |||
| 2c68515b93 | |||
| b26ad523ab | |||
| cd346b8536 | |||
| 2853731c4c | |||
| d31efb1f2a | |||
| e1702d1263 | |||
| 236254fed6 | |||
| 82f20f3c87 | |||
| adc75c0504 | |||
| 761778b87c | |||
| 5fa40fad99 | |||
| 8e608bd623 | |||
| 60a1707d43 | |||
| 1848ed85d0 | |||
| 197673de11 | |||
| 19e1d4e760 | |||
| abb1509314 | |||
| b9e4d9b01f | |||
| fcb541175a | |||
| 99e0b9967e | |||
| b88caa12ab | |||
| 40912bb7b7 | |||
| 7d6903d181 | |||
| 43cf75d400 | |||
| 2fa3ea24a5 | |||
| c82a27ebae | |||
| a7df54d8d2 | |||
| e8d11f150e | |||
| 6d8bd01266 | |||
| 65a256ba7b | |||
| d403f9cfcf | |||
| 30cc274c2e | |||
| 6564bdc74f | |||
| 6cdf1583c0 | |||
| 5441ff7b50 | |||
| d03ed02b2c | |||
| 8c4000a74c | |||
| 4c48085e4f | |||
| 37265932e9 | |||
| 8f602fc10a | |||
| f7ef38162b | |||
| 1bc17e7bb7 | |||
| 4d545c38ea | |||
| 83b9b3858d | |||
| 0de82a5fd9 | |||
| 8dc16e1ed9 | |||
| 4500f96d6d | |||
| a9921f9b17 | |||
| 8c4f0e15de | |||
| 46802be7d8 | |||
| 0a77cc2e12 | |||
| 6d07e1638b | |||
| 09d3df0fe1 | |||
| 838671d968 | |||
| f286f50855 | |||
| ff2dff29ee | |||
| 28cdaff2d0 | |||
| 3c4d299c58 | |||
| f388cf47f3 | |||
| 38b1eba03e | |||
| 6caa4fb6b5 | |||
| c1b781c142 | |||
| c219a6842b | |||
| 677ff492e7 | |||
| e4ba021482 | |||
| 24218e8d8c | |||
| 739311a02b | |||
| 61ef5dd9ed | |||
| aed21e027c | |||
| 1c64f500b3 | |||
| 542c421ac8 | |||
| 95e6f49e4f | |||
| 4c19cc49e2 | |||
| 74681a1f1d | |||
| d7b88e738f | |||
| d4c9843597 | |||
| 077cb2c586 | |||
| 8e9de6026e | |||
| b382560cfa | |||
| 339c6acb37 | |||
| 570a65c7a1 | |||
| e18a816647 | |||
| d578194d43 | |||
| e0f20d19f0 | |||
| cff4ef0d47 | |||
| d9fb464066 | |||
| 9d6a5fb496 | |||
| c3fab404a5 | |||
| fa139c84f3 | |||
| ae6853cd3f | |||
| c0618cd628 | |||
| 524b6a470c | |||
| cd4aa8ee11 | |||
| 242f5f4516 | |||
| e6a3e0c519 | |||
| 640c8af05f | |||
| 48ceceb8e0 | |||
| 5165463dbd | |||
| 9e1d424bc7 | |||
| 15c96303de | |||
| 3211f21869 | |||
| 1f4fe3597b | |||
| 0749e56b9f | |||
| 7424bdc147 | |||
| a623072e89 | |||
| 7f15b08b20 | |||
| 82d4fadaaa | |||
| d9f4d0584a | |||
| 2e5b4c9976 | |||
| 511af04c8b | |||
| 8b1d38c451 | |||
| abe3465514 | |||
| fc753c47be | |||
| ad8a7bf73f | |||
| 4a21a4be36 | |||
| aafe565474 | |||
| b6ef0a8d7a | |||
| 779f2105ba | |||
| c2b9c4b19f | |||
| 8eadb81e91 | |||
| 2bac228fe9 | |||
| c312e72fd2 | |||
| fd4683e4fa | |||
| 70661aa3d2 | |||
| a82486e9fb | |||
| cd4a7d3b91 | |||
| 3764c58394 | |||
| e49b505fbe | |||
| 72c1eb81f3 | |||
| 037ac0d030 | |||
| f1b64b1496 | |||
| 69ab03f3ec | |||
| 3b86cd9633 | |||
| 56fc63d5ff | |||
| f27eeb9c3d | |||
| 5d603a57db | |||
| 6f45e63f11 | |||
| eb8c78b7b1 | |||
| 4eefdf0842 | |||
| b536c30a88 | |||
| 9a0ea2e431 | |||
| d61a47755c | |||
| c6b8b74f26 | |||
| 53cd49bed1 | |||
| 2f4a77c73e | |||
| 64a3f75b31 | |||
| 000358b6a6 | |||
| 6c16e7b70a | |||
| 1ae32451e5 | |||
| 4c68955ba2 | |||
| dd80929ae1 | |||
| af80170976 | |||
| bf2742c6c7 | |||
| ec09b3f70c | |||
| 952d40cb2b | |||
| 0a767d1afd | |||
| d5be638099 | |||
| b6c5514f9e | |||
| 4fd18d377f | |||
| 9dff37f1f4 | |||
| b71ad963f1 | |||
| 3aefca4613 | |||
| cc5117aa11 | |||
| c5a8b852d9 | |||
| 69514074a9 | |||
| 6ecd613f12 | |||
| 6e4dee29af | |||
| da7ebc6b97 | |||
| 4685b6bde6 | |||
| 3a063bd2cf | |||
| 710a1fe070 | |||
| d818492d67 | |||
| e55e33c40a | |||
| 8cadb25261 | |||
| 2622b58cad | |||
| b5be932955 | |||
| 44ac2f8c2a | |||
| 0b928e987f | |||
| c213c3f059 | |||
| 330698b6aa | |||
| eb1ef693c4 | |||
| 862751c84a | |||
| e5a30c38d3 | |||
| e83d8db1cc | |||
| 9de88ffe84 | |||
| ffaf33c62e | |||
| 8c0389582b | |||
| ebe3d79c11 | |||
| f8c40739da | |||
| fa5aac926e | |||
| 749cd1e2bb | |||
| 587aaaafce | |||
| 2cfa7caba7 | |||
| fc0fba5bd3 | |||
| 94159f88f3 | |||
| 4961d2d528 | |||
| 7b22f5cc47 | |||
| 5047d5b652 | |||
| 7f9b880ff7 | |||
| 7e457a22b0 | |||
| 3c080e2b1a | |||
| 9d3edbfb54 | |||
| adf465c5e2 | |||
| 23f695fd56 | |||
| 52f347def1 | |||
| 028688b88a | |||
| cde5b137ae | |||
| d0cf5887d3 | |||
| afc4c6aaff | |||
| caa1875309 | |||
| 2e2c2188ce | |||
| 0acd75bece | |||
| db691cefe4 | |||
| d0ecd175c2 | |||
| 7e6d4189ef | |||
| abbc200504 | |||
| 9e4597b739 | |||
| d84d146701 | |||
| 00ff8818da | |||
| d5c582f890 | |||
| bc8b0490b7 | |||
| 5aad9dcbf2 | |||
| 8a582f512f | |||
| 1fde2e5fec | |||
| 7a89501cc9 | |||
| 89acdcc8f8 | |||
| f7c082e5b1 | |||
| 938c46b9d8 | |||
| 917bf5ec4b | |||
| 27d4ab3309 | |||
| 0ece2d91f4 | |||
| e08b53d5cf | |||
| a330b2fd7f | |||
| acdd4e10fb | |||
| ee6afb65c1 | |||
| ea9db1631b | |||
| 6513e75408 | |||
| 0e7d878f10 | |||
| 8bd0e5d145 | |||
| d8ecfc8463 | |||
| e52a9c66b6 | |||
| f3785f8644 | |||
| 350aaabbbe | |||
| 4eb3b38dd4 | |||
| e9534b4eee | |||
| da061a05e5 | |||
| ba432f5029 | |||
| 812397a047 | |||
| cbb42ec088 | |||
| 0c802464e1 | |||
| 498c65b006 | |||
| d81a0e8fbd | |||
| 47fde315a3 | |||
| 3ac61219c9 | |||
| bad0018381 | |||
| 48261c36d8 | |||
| 4f9093b1d2 | |||
| 52830876e9 | |||
| 4513833fb3 | |||
| 26cc812ed1 | |||
| cc3ff75ea2 | |||
| b150c75e96 | |||
| cc3b0da9e5 | |||
| 6c8e3017d0 | |||
| 8613072ea2 | |||
| a89ad10f0b | |||
| 91e0214243 | |||
| f01790e725 | |||
| 648fa1d9bf | |||
| 33be9ccaf0 | |||
| 1b6c1721c5 | |||
| d6c08628fb | |||
| ce68e29112 | |||
| e936f90086 | |||
| 6c62ec1fe4 | |||
| 481cebb207 | |||
| 126e3f6f92 | |||
| 21349b690b | |||
| 93f9af85e7 | |||
| 366a93dedf | |||
| 3e83035483 | |||
| efb805cf98 | |||
| 1572648a7e | |||
| 3dea3d9be2 | |||
| 0af620ba76 | |||
| 1fc7aeba75 | |||
| 6711a2c166 | |||
| 6a4a53ccd6 | |||
| acdf228d52 | |||
| 769c73765d | |||
| ec48260d73 | |||
| 06461550c3 | |||
| f45bcd7651 | |||
| 05fe546e38 | |||
| 63c5d39112 | |||
| f8e56d8f49 | |||
| b07f2f6b19 | |||
| eefd8ba037 | |||
| 076178db2c | |||
| 3699daf998 | |||
| 617058cdda | |||
| d7a517160d | |||
| 139579dbef | |||
| 72033c8b9f | |||
| cc30f3aeb9 | |||
| 969f4cb6a0 | |||
| c05e58a61e | |||
| 37026c548d | |||
| bfaeb8e414 | |||
| 3bd780d005 | |||
| 1ffa11b2c1 | |||
| 3548d8593a | |||
| 0eac98ecaa | |||
| a950807979 | |||
| 7676693f66 | |||
| e03896cfef | |||
| b5094daa43 | |||
| 5f1aaac719 | |||
| 57d696e2fc | |||
| 99c0ada098 | |||
| a828ca9804 | |||
| 88baf851ee | |||
| 1e094aac56 | |||
| 51b5c7ac80 | |||
| e3f8783c18 | |||
| d0015d8252 | |||
| 5ebdda4abd | |||
| 436dcf69ea | |||
| b7b9ea2065 | |||
| 8b1d3a0efb | |||
| 3d0adbdd39 | |||
| 8b51f9dca8 | |||
| f589464063 | |||
| fc7150f9b0 | |||
| 5c83095891 | |||
| fe76f4b859 | |||
| 1d2eb24903 | |||
| 0bb90513b5 | |||
| 2fa68977bf | |||
| 092ad0cb4c | |||
| 3953d079c1 | |||
| ddcea6524c | |||
| fe78df8c26 | |||
| 7a70f623d9 | |||
| b8ac0ef249 | |||
| f456ea3c2a | |||
| 8732c2fc66 | |||
| 6a135228b8 | |||
| 653557a23d | |||
| 036ea8bcc8 | |||
| b620aef7b8 | |||
| 58eb8df247 | |||
| 38ab9d4a40 | |||
| 4b7c533ae3 | |||
| d54c9c98d7 | |||
| d0d5ff3917 | |||
| afb72bcf48 | |||
| 0d6566e2cc | |||
| db5503f828 | |||
| 0cfa1207ec | |||
| d415034d1c | |||
| 06964c5a34 | |||
| 68921b5df5 | |||
| 7801a50ae0 | |||
| c418f5b92a | |||
| 3aa7979be4 | |||
| 4fdf3ebdfa | |||
| e25ad8e4a4 | |||
| d5a45917ec | |||
| eb401d2695 | |||
| 604ffc6a35 | |||
| 43da69863d | |||
| f7b484d6bf | |||
| 4a8576bcb2 | |||
| a2854beb8d | |||
| aa9f7c577c | |||
| 6fb5c3803f | |||
| 7d11c76bef | |||
| 8f8dc23096 | |||
| 2e2c897b47 |
+4
-4
@@ -24,14 +24,14 @@ variables:
|
||||
$FileList = Get-ChildItem("*.lua")
|
||||
ForEach ($File in $FileList) {
|
||||
$FileName = Split-Path $File -leaf
|
||||
lua54 -o bin\$FileName $FileName
|
||||
echo "lua54 -o bin\$FileName $FileName"
|
||||
lua54 -o bin\$FileName -s $FileName
|
||||
echo "lua54 -o bin\$FileName -s $FileName"
|
||||
}
|
||||
$FileList = Get-ChildItem("LuaLibs\*.lua")
|
||||
ForEach ($File in $FileList) {
|
||||
$FileName = Split-Path $File -leaf
|
||||
lua54 -o bin\LuaLibs\$FileName LuaLibs\$FileName
|
||||
echo "lua54 -o bin\LuaLibs\$FileName LuaLibs\$FileName"
|
||||
lua54 -o bin\LuaLibs\$FileName -s LuaLibs\$FileName
|
||||
echo "lua54 -o bin\LuaLibs\$FileName -s LuaLibs\$FileName"
|
||||
}
|
||||
|
||||
# helper copia SORGENTI verso cartella di rete X:\ dei SORGENTI
|
||||
|
||||
+85
-10
@@ -59,9 +59,23 @@ end
|
||||
local sLog = 'BatchProcess : ' .. BEAM.FILE .. ', ' .. BEAM.MACHINE .. ', ' .. sFlag
|
||||
EgtOutLog( sLog)
|
||||
|
||||
-- Cancello file di log specifico
|
||||
local sLogFile = EgtChangePathExtension( BEAM.FILE, '.txt')
|
||||
EgtEraseFile( sLogFile)
|
||||
-- in caso sia richiesta generazione senza check, verifico prima che il file log specifico non contenga errori: se sì, forzo il check
|
||||
if BEAM.FLAG == 0 then
|
||||
local hLogFile = io.open( sLogFile, 'r')
|
||||
if hLogFile then
|
||||
for line in hLogFile:lines() do
|
||||
if EgtStartsWith( line, 'ERR') and tonumber( EgtSplitString( line, '=')[2] or 0) > 0 then
|
||||
BEAM.FLAG = 4
|
||||
break
|
||||
end
|
||||
end
|
||||
hLogFile:close()
|
||||
end
|
||||
end
|
||||
|
||||
-- Cancello file di log specifico
|
||||
EgtEraseFile( sLogFile)
|
||||
|
||||
-- Funzioni per scrittura su file di log specifico
|
||||
local function WriteErrToLogFile( nErr, sMsg, nRot, nCutId, nTaskId)
|
||||
@@ -87,6 +101,21 @@ local function WriteTimeToLogFile( dTime)
|
||||
hFile:close()
|
||||
end
|
||||
|
||||
-- Funzioni per riportare stato lavorazione o pezzo in nge
|
||||
local function WriteErrToNge( nProcId, sErr, sMsg, sRot, sCutId, sTaskId)
|
||||
EgtSetInfo( nProcId, 'STATUS.ERR', sErr)
|
||||
EgtSetInfo( nProcId, 'STATUS.MSG', sMsg)
|
||||
EgtSetInfo( nProcId, 'STATUS.ROT', sRot)
|
||||
EgtSetInfo( nProcId, 'CUTID', sCutId)
|
||||
EgtSetInfo( nProcId, 'TASKID', sTaskId)
|
||||
end
|
||||
local function WriteFallToNge( nPartId, sErr, sMsg, sCutId, sFall)
|
||||
EgtSetInfo( nPartId, 'STATUS.ERR', sErr)
|
||||
EgtSetInfo( nPartId, 'STATUS.MSG', sMsg)
|
||||
EgtSetInfo( nPartId, 'CUTID', sCutId)
|
||||
EgtSetInfo( nPartId, 'STATUS.FALL', sFall)
|
||||
end
|
||||
|
||||
-- Funzione per gestire visualizzazione dopo errore
|
||||
local function PostErrView( nErr, sMsg)
|
||||
if nErr ~= 0 and ( BEAM.FLAG == 1 or BEAM.FLAG == 2) then
|
||||
@@ -108,13 +137,25 @@ end
|
||||
-- Funzione per aggiornare dati ausiliari
|
||||
local function UpdateAuxData( sAuxFile)
|
||||
local bModif = false
|
||||
local BtlInfoId = EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL
|
||||
-- Se definito LOAD90, aggiorno
|
||||
local sLoad90 = EgtGetStringFromIni( 'AuxData', 'LOAD90', '', sAuxFile)
|
||||
if sLoad90 ~= '' then
|
||||
local BtlInfoId = EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL
|
||||
EgtSetInfo( BtlInfoId, 'LOAD90', sLoad90)
|
||||
bModif = true
|
||||
end
|
||||
-- Se definito PROJID, aggiorno
|
||||
local sProjId = EgtGetStringFromIni( 'AuxData', 'PROJID', '', sAuxFile)
|
||||
if sProjId ~= '' then
|
||||
EgtSetInfo( BtlInfoId, 'PROJECTNUMBER', sProjId)
|
||||
bModif = true
|
||||
end
|
||||
-- Se definito PRODID, aggiorno
|
||||
local sProdId = EgtGetStringFromIni( 'AuxData', 'PRODID', '', sAuxFile)
|
||||
if sProdId ~= '' then
|
||||
EgtSetInfo( BtlInfoId, 'PRODID', sProdId)
|
||||
bModif = true
|
||||
end
|
||||
return bModif
|
||||
end
|
||||
|
||||
@@ -387,6 +428,9 @@ if bToProcess then
|
||||
BEAM.CUTID = Stats[i].CutId
|
||||
BEAM.TASKID = Stats[i].TaskId
|
||||
WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
|
||||
if Stats[i].ProcId then
|
||||
WriteErrToNge( Stats[i].ProcId, BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
|
||||
end
|
||||
elseif Stats[i].Err > 0 then
|
||||
nErrCnt = nErrCnt + 1
|
||||
sOutput = sOutput .. string.format( '[%d,%d] %s\n', Stats[i].CutId, Stats[i].TaskId, sMsg)
|
||||
@@ -396,6 +440,9 @@ if bToProcess then
|
||||
BEAM.CUTID = Stats[i].CutId
|
||||
BEAM.TASKID = Stats[i].TaskId
|
||||
WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
|
||||
if Stats[i].ProcId then
|
||||
WriteErrToNge( Stats[i].ProcId, BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
|
||||
end
|
||||
elseif Stats[i].Err < 0 then
|
||||
-- se segnalazione scarico pezzo standard, incompleto o a caduta
|
||||
if Stats[i].Err == -100 or Stats[i].Err == -101 or Stats[i].Err == -102 then
|
||||
@@ -404,6 +451,9 @@ if bToProcess then
|
||||
BEAM.CUTID = Stats[i].CutId
|
||||
BEAM.FALL = abs( Stats[i].Err + 100)
|
||||
WriteFallToLogFile( BEAM.ERR, BEAM.MSG, BEAM.CUTID, BEAM.FALL)
|
||||
if Stats[i].ProcId then
|
||||
WriteFallToNge( Stats[i].PartId, BEAM.ERR, BEAM.MSG, BEAM.CUTID, BEAM.FALL)
|
||||
end
|
||||
-- altri avvertimenti
|
||||
else
|
||||
nWarnCnt = nWarnCnt + 1
|
||||
@@ -414,6 +464,9 @@ if bToProcess then
|
||||
BEAM.CUTID = Stats[i].CutId
|
||||
BEAM.TASKID = Stats[i].TaskId
|
||||
WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
|
||||
if Stats[i].ProcId then
|
||||
WriteErrToNge( Stats[i].ProcId, BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -429,39 +482,60 @@ if bToProcess then
|
||||
PostWarnView( 19, sOutput)
|
||||
end
|
||||
|
||||
-- Altrimenti carico il progetto salvato e dichiaro nessun errore
|
||||
-- Altrimenti carico il progetto salvato, rileggo gli errori da nge e riscrivo il log txt con gli stati precedenti
|
||||
else
|
||||
EgtOutLog( ' +++ Loading Project already processed >>>')
|
||||
-- Carico il progetto già fatto
|
||||
EgtOpenFile( sNgeFile)
|
||||
-- Dichiaro nessun errore
|
||||
-- Riscrivo il log txt
|
||||
local nPartId = EgtGetFirstPart()
|
||||
while nPartId do
|
||||
local nCutId = EgtGetInfo( nPartId, 'CUTID')
|
||||
if nCutId then
|
||||
-- stato a livello di singola feature
|
||||
local nProcId = EgtGetFirstInGroup( EgtGetFirstNameInGroup( nPartId, 'Processings') or GDB_ID.NULL)
|
||||
while nProcId do
|
||||
local bIsFea = EgtExistsInfo( nProcId, 'GRP') and EgtExistsInfo( nProcId, 'PRC')
|
||||
local nTaskId = EgtGetInfo( nProcId, 'TASKID')
|
||||
local sErr = EgtGetInfo( nProcId, 'STATUS.ERR') or 0
|
||||
local sMsg = EgtGetInfo( nProcId, 'STATUS.MSG') or '---'
|
||||
local sRot = EgtGetInfo( nProcId, 'STATUS.ROT') or 0
|
||||
if bIsFea and nTaskId then
|
||||
BEAM.ERR = 0
|
||||
BEAM.MSG = '---'
|
||||
BEAM.ROT = 0
|
||||
BEAM.ERR = sErr
|
||||
BEAM.MSG = sMsg
|
||||
BEAM.ROT = sRot
|
||||
BEAM.CUTID = nCutId
|
||||
BEAM.TASKID = nTaskId
|
||||
WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
|
||||
end
|
||||
nProcId = EgtGetNext( nProcId)
|
||||
end
|
||||
-- stato a livello di pezzo
|
||||
local sErr = EgtGetInfo( nPartId, 'STATUS.ERR') or 0
|
||||
if sErr == -100 or sErr == -101 or sErr == -102 then
|
||||
local sMsg = EgtGetInfo( nPartId, 'STATUS.MSG') or '---'
|
||||
local sFall = EgtGetInfo( nPartId, 'STATUS.FALL') or 0
|
||||
BEAM.ERR = sErr
|
||||
BEAM.MSG = sMsg
|
||||
BEAM.CUTID = nCutId
|
||||
BEAM.FALL = sFall
|
||||
WriteFallToLogFile( BEAM.ERR, BEAM.MSG, BEAM.CUTID, BEAM.FALL)
|
||||
end
|
||||
end
|
||||
nPartId = EgtGetNextPart( nPartId)
|
||||
end
|
||||
-- Aggiorno eventuali dati ausiliari
|
||||
UpdateAuxData( sBtmFile)
|
||||
|
||||
-- Anche se non è da riprocessare, imposto nome file CN.
|
||||
-- Se file TS7 importato da altro PC, 'BEAM.FILE' è cambiato da un PC all'altro. Di conseguenza si deve aggiornare nome file che si andrà a generare.
|
||||
local _, sName, _ = EgtSplitPath( BEAM.FILE)
|
||||
EgtSetInfo( EgtGetLastMachGroup(), 'NcName', sName .. '.cnc')
|
||||
|
||||
-- Passo in modalità lavora
|
||||
EgtSetCurrMachGroup( EgtGetLastMachGroup())
|
||||
-- Se necessario eseguo aggiornamento con setup corrente e ricalcolo delle lavorazioni
|
||||
if bToRecalc then
|
||||
if bToRecalc or BEAM.FLAG == 3 or BEAM.FLAG == 4 then
|
||||
EgtOutLog( ' +++ Recalculating all dispositions and machinings >>>')
|
||||
EgtImportSetup()
|
||||
EgtApplyAllMachinings()
|
||||
@@ -525,7 +599,8 @@ if ( BEAM.FLAG == 0 and ( bToProcess or bToRecalc)) or BEAM.FLAG == 3 or BEAM.F
|
||||
end
|
||||
|
||||
-- *** Genero programma CN *** ( se richiesto)
|
||||
if BEAM.FLAG == 0 or BEAM.FLAG == 4 then
|
||||
local bIsGenerationEnabled = ( EgtVerifyKeyOption( 110) == false)
|
||||
if bIsGenerationEnabled and ( BEAM.FLAG == 0 or BEAM.FLAG == 4) then
|
||||
EgtOutLog( ' +++ Generating NC part program >>>')
|
||||
local sInfo = 'EgtCAM5' .. EgtIf( EgtIs64bit(), ' 64bit', '')
|
||||
if EgtGetExeVersion then
|
||||
|
||||
+19
-4
@@ -45,9 +45,23 @@ end
|
||||
local sLog = 'BatchProcess : ' .. BEAM.FILE .. ', ' .. BEAM.MACHINE .. ', ' .. sFlag
|
||||
EgtOutLog( sLog)
|
||||
|
||||
-- Cancello file di log specifico
|
||||
local sLogFile = EgtChangePathExtension( BEAM.FILE, '.txt')
|
||||
EgtEraseFile( sLogFile)
|
||||
-- in caso sia richiesta generazione senza check, verifico prima che il file log specifico non contenga errori: se sì, forzo il check
|
||||
if BEAM.FLAG == 0 then
|
||||
local hLogFile = io.open( sLogFile, 'r')
|
||||
if hLogFile then
|
||||
for line in hLogFile:lines() do
|
||||
if EgtStartsWith( line, 'ERR') and tonumber( EgtSplitString( line, '=')[2] or 0) > 0 then
|
||||
BEAM.FLAG = 4
|
||||
break
|
||||
end
|
||||
end
|
||||
hLogFile:close()
|
||||
end
|
||||
end
|
||||
|
||||
-- Cancello file di log specifico
|
||||
EgtEraseFile( sLogFile)
|
||||
|
||||
-- Funzioni per scrittura su file di log specifico
|
||||
local function WriteErrToLogFile( nErr, sMsg, nRot, nCutId, nTaskId)
|
||||
@@ -562,7 +576,7 @@ else
|
||||
-- Passo in modalità lavora
|
||||
EgtSetCurrMachGroup( EgtGetLastMachGroup())
|
||||
-- Se necessario eseguo aggiornamento con setup corrente e ricalcolo delle lavorazioni
|
||||
if bToRecalc then
|
||||
if bToRecalc or BEAM.FLAG == 3 or BEAM.FLAG == 4 then
|
||||
EgtOutLog( ' +++ Recalculating all dispositions and machinings >>>')
|
||||
EgtImportSetup()
|
||||
EgtApplyAllMachinings()
|
||||
@@ -626,7 +640,8 @@ if ( BEAM.FLAG == 0 and ( bToProcess or bToRecalc)) or BEAM.FLAG == 3 or BEAM.F
|
||||
end
|
||||
|
||||
-- *** Genero programma CN *** ( se richiesto)
|
||||
if BEAM.FLAG == 0 or BEAM.FLAG == 4 then
|
||||
local bIsGenerationEnabled = ( EgtVerifyKeyOption( 110) == false)
|
||||
if bIsGenerationEnabled and ( BEAM.FLAG == 0 or BEAM.FLAG == 4) then
|
||||
EgtOutLog( ' +++ Generating NC part program >>>')
|
||||
local sInfo = 'EgtCAM5' .. EgtIf( EgtIs64bit(), ' 64bit', '')
|
||||
if EgtGetExeVersion then
|
||||
|
||||
+50
-49
@@ -4,52 +4,53 @@ REM Per togliere info di debug aggiungere flag -s prima del nome del file di inp
|
||||
|
||||
REM Compilazione 32 e 64 bit
|
||||
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\BeamExec.lua LuaLibs\BeamExec.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\BeamLib.lua LuaLibs\BeamLib.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\DiceCut.lua LuaLibs\DiceCut.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\FaceByPocket.lua LuaLibs\FaceByPocket.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\FacesBySaw.lua LuaLibs\FacesBySaw.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\FeatureTopology.lua LuaLibs\FeatureTopology.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\MachiningLib.lua LuaLibs\MachiningLib.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessBlockHausFront.lua LuaLibs\ProcessBlockHausFront.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessChamfer.lua LuaLibs\ProcessChamfer.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessCut.lua LuaLibs\ProcessCut.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDecor.lua LuaLibs\ProcessDecor.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDoubleCut.lua LuaLibs\ProcessDoubleCut.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDovetail.lua LuaLibs\ProcessDovetail.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDrill.lua LuaLibs\ProcessDrill.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDtMortise.lua LuaLibs\ProcessDtMortise.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDtTenon.lua LuaLibs\ProcessDtTenon.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessFreeContour.lua LuaLibs\ProcessFreeContour.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessFrenchRidgeLap.lua LuaLibs\ProcessFrenchRidgeLap.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessHeadCut.lua LuaLibs\ProcessHeadCut.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessLapJoint.lua LuaLibs\ProcessLapJoint.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessLongCut.lua LuaLibs\ProcessLongCut.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessLongDoubleCut.lua LuaLibs\ProcessLongDoubleCut.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessMark.lua LuaLibs\ProcessMark.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessMortise.lua LuaLibs\ProcessMortise.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfCamb.lua LuaLibs\ProcessProfCamb.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfConcave.lua LuaLibs\ProcessProfConcave.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfConvex.lua LuaLibs\ProcessProfConvex.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfFront.lua LuaLibs\ProcessProfFront.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfHead.lua LuaLibs\ProcessProfHead.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessRidgeLap.lua LuaLibs\ProcessRidgeLap.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessRoundArch.lua LuaLibs\ProcessRoundArch.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessSawCut.lua LuaLibs\ProcessSawCut.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessScarfJoint.lua LuaLibs\ProcessScarfJoint.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessSimpleScarf.lua LuaLibs\ProcessSimpleScarf.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessSplit.lua LuaLibs\ProcessSplit.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessStepJoint.lua LuaLibs\ProcessStepJoint.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessStepJointNotch.lua LuaLibs\ProcessStepJointNotch.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessTenon.lua LuaLibs\ProcessTenon.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessText.lua LuaLibs\ProcessText.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessTyroleanDovetail.lua LuaLibs\ProcessTyroleanDovetail.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessVariant.lua LuaLibs\ProcessVariant.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\BatchProcess.lua BatchProcess.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\BatchProcessNew.lua BatchProcessNew.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\GetBeamData.lua GetBeamData.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\NestProcess.lua NestProcess.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\Process.lua Process.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\Rotate.lua Rotate.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\Swap.lua Swap.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\Version.lua Version.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\BeamExec.lua -s LuaLibs\BeamExec.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\BeamLib.lua -s LuaLibs\BeamLib.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\DiceCut.lua -s LuaLibs\DiceCut.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\FaceByPocket.lua -s LuaLibs\FaceByPocket.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\FacesBySaw.lua -s LuaLibs\FacesBySaw.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\FeatureTopology.lua -s LuaLibs\FeatureTopology.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\MachiningLib.lua -s LuaLibs\MachiningLib.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessBlockHausFront.lua -s LuaLibs\ProcessBlockHausFront.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessChamfer.lua -s LuaLibs\ProcessChamfer.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessCut.lua -s LuaLibs\ProcessCut.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDecor.lua -s LuaLibs\ProcessDecor.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDoubleCut.lua -s LuaLibs\ProcessDoubleCut.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDovetail.lua -s LuaLibs\ProcessDovetail.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDrill.lua -s LuaLibs\ProcessDrill.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDtMortise.lua -s LuaLibs\ProcessDtMortise.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDtTenon.lua -s LuaLibs\ProcessDtTenon.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessFreeContour.lua -s LuaLibs\ProcessFreeContour.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessFrenchRidgeLap.lua -s LuaLibs\ProcessFrenchRidgeLap.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessHeadCut.lua -s LuaLibs\ProcessHeadCut.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessLapJoint.lua -s LuaLibs\ProcessLapJoint.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessLongCut.lua -s LuaLibs\ProcessLongCut.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessLongDoubleCut.lua -s LuaLibs\ProcessLongDoubleCut.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessMark.lua -s LuaLibs\ProcessMark.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessMortise.lua -s LuaLibs\ProcessMortise.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfCamb.lua -s LuaLibs\ProcessProfCamb.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfConcave.lua -s LuaLibs\ProcessProfConcave.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfConvex.lua -s LuaLibs\ProcessProfConvex.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfFront.lua -s LuaLibs\ProcessProfFront.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfHead.lua -s LuaLibs\ProcessProfHead.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessRidgeLap.lua -s LuaLibs\ProcessRidgeLap.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessRoundArch.lua -s LuaLibs\ProcessRoundArch.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessSawCut.lua -s LuaLibs\ProcessSawCut.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessScarfJoint.lua -s LuaLibs\ProcessScarfJoint.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessSimpleScarf.lua -s LuaLibs\ProcessSimpleScarf.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessSplit.lua -s LuaLibs\ProcessSplit.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessStepJoint.lua -s LuaLibs\ProcessStepJoint.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessStepJointNotch.lua -s LuaLibs\ProcessStepJointNotch.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessTenon.lua -s LuaLibs\ProcessTenon.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessText.lua -s LuaLibs\ProcessText.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessTyroleanDovetail.lua -s LuaLibs\ProcessTyroleanDovetail.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessVariant.lua -s LuaLibs\ProcessVariant.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProbing.lua -s LuaLibs\ProcessProbing.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\BatchProcess.lua -s BatchProcess.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\BatchProcessNew.lua -s BatchProcessNew.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\GetBeamData.lua -s GetBeamData.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\NestProcess.lua -s NestProcess.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\Process.lua -s Process.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\Rotate.lua -s Rotate.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\Swap.lua -s Swap.lua
|
||||
\EgtProg\Dll32\luac54 -o bin\Version.lua -s Version.lua
|
||||
|
||||
+563
-113
File diff suppressed because it is too large
Load Diff
+253
-18
@@ -551,7 +551,7 @@ function BeamLib.GetFaceWithMostAdj( Proc, nPartId, bCompare3Fc, dCosSideAng)
|
||||
local nAddGrpId = BeamLib.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
EgtOutLog( 'Error : missing AddGroup')
|
||||
return 0, 0, 0
|
||||
return 0, 0, 0, 0
|
||||
end
|
||||
-- verifico eventuale intersezione tra la faccia i-1 esima e la proiezione dell'altra sulla stessa
|
||||
local nShadowFacetId = EgtCopySurfTmFacet( nSurfId, j - 1, nAddGrpId)
|
||||
@@ -642,7 +642,7 @@ function BeamLib.GetFaceWithMostAdj( Proc, nPartId, bCompare3Fc, dCosSideAng)
|
||||
-- premio quella che non è sottosquadra e che ha la X minore
|
||||
local bDiffSmall = true
|
||||
for i = 1, #dtElev do
|
||||
if dtElev[i] > dMinElev + 5 or dtElev[i] > 80 then
|
||||
if ( dtElev[i] > dMinElev + 5 or dtElev[i] > 80) and dMinElev < 0.85 * dtElev[i] then
|
||||
bDiffSmall = false
|
||||
end
|
||||
end
|
||||
@@ -698,17 +698,19 @@ function BeamLib.GetFaceHvRefDim( nSurfId, nFacet, b3Raw)
|
||||
local b3HV = EgtSurfTmGetFacetBBoxRef( nSurfId, nFacet, GDB_BB.STANDARD, frHV)
|
||||
local dDimH = b3HV:getDimX()
|
||||
local dDimV = b3HV:getDimY()
|
||||
|
||||
-- Si mantiene rettangolo minimo perchè in alcuni casi andava in collisione. Lascio il calcolo in caso si debba ripristinare.
|
||||
-- se definito grezzo (o solido), applico eventuali limiti
|
||||
if b3Raw then
|
||||
local dCoeffY = abs( frHV:getVersX():getY())
|
||||
if dCoeffY > GEO.EPS_SMALL then
|
||||
dDimH = min( dDimH, b3Raw:getDimY() / dCoeffY)
|
||||
end
|
||||
local dCoeffZ = abs( frHV:getVersY():getZ())
|
||||
if dCoeffZ > GEO.EPS_SMALL then
|
||||
dDimV = min( dDimV, b3Raw:getDimZ() / dCoeffZ)
|
||||
end
|
||||
end
|
||||
-- if b3Raw then
|
||||
-- local dCoeffY = abs( frHV:getVersX():getY())
|
||||
-- if dCoeffY > GEO.EPS_SMALL then
|
||||
-- dDimH = min( dDimH, b3Raw:getDimY() / dCoeffY)
|
||||
-- end
|
||||
-- local dCoeffZ = abs( frHV:getVersY():getZ())
|
||||
-- if dCoeffZ > GEO.EPS_SMALL then
|
||||
-- dDimV = min( dDimV, b3Raw:getDimZ() / dCoeffZ)
|
||||
-- end
|
||||
-- end
|
||||
-- restituisco i valori calcolati
|
||||
return frHV, dDimH, dDimV
|
||||
end
|
||||
@@ -734,7 +736,9 @@ end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.GetNzLimDownUp( b3Raw, vtN, vtOrtho)
|
||||
if BD.C_SIMM then
|
||||
if BD.GetNzLimDownUp then
|
||||
return BD.GetNzLimDownUp( b3Raw, vtN, vtOrtho)
|
||||
elseif BD.C_SIMM then
|
||||
return -0.484
|
||||
elseif BD.TURN then
|
||||
return -2
|
||||
@@ -814,9 +818,10 @@ function BeamLib.GetDistanceToNextPart( nRawId, nPhase)
|
||||
-- se segue una parte rimanente riutilizzabile, modifico opportunamente questa distanza
|
||||
if not BeamLib.IsSplittedPartPhase( nPhase) then
|
||||
local nNextRawId = EgtGetNextRawPart( nRawId)
|
||||
if nNextRawId and
|
||||
EgtGetPartInRawPartCount( nNextRawId) <= 0 and
|
||||
EgtGetRawPartBBox( nNextRawId):getDimX() >= BD.MinRaw then
|
||||
if nNextRawId and
|
||||
EgtGetPartInRawPartCount( nNextRawId) <= 0 and
|
||||
EgtGetRawPartBBox( nNextRawId):getDimX() >= BD.MinRaw then
|
||||
|
||||
dDistToNextPiece = BD.OVM_MID
|
||||
end
|
||||
end
|
||||
@@ -896,6 +901,27 @@ function BeamLib.FindFaceBestOrientedAsAxis( Proc, vtAx, fctExclude)
|
||||
return nFaceIndMax, ptC, vtN
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function BeamLib.GetEdgeToMachineFromVector( nSurfId, nFacet, vtOrtho)
|
||||
local _, EdgesEgt = EgtSurfTmGetFacetOutlineInfo( nSurfId, nFacet, GDB_ID.ROOT)
|
||||
|
||||
local nEdgeIndMax = 0
|
||||
local dMaxComp = - GEO.INFINITO
|
||||
for i = 1, #EdgesEgt do
|
||||
local vtN = EdgesEgt[i].Norm
|
||||
if EdgesEgt[i].Open then
|
||||
vtN = -vtN
|
||||
end
|
||||
local dComp = vtN * vtOrtho
|
||||
if dComp > dMaxComp then
|
||||
nEdgeIndMax = i -1
|
||||
dMaxComp = dComp
|
||||
end
|
||||
end
|
||||
|
||||
return nEdgeIndMax
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function BeamLib.GetTunnelDimension( Proc, nPartId)
|
||||
-- sono necessarie almeno due facce
|
||||
@@ -1165,8 +1191,217 @@ end
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- restituisce vero se la feature con box b3Proc taglia l'intera sezione della barra, rappresentata dalle sue dimensioni W e H
|
||||
function BeamLib.IsFeatureCuttingEntireSection( b3Proc, dRawW, dRawH)
|
||||
return ((abs(b3Proc:getDimY() - dRawW) < 10 * GEO.EPS_SMALL or b3Proc:getDimY() > dRawW) and (abs(b3Proc:getDimZ() - dRawH) < 10 * GEO.EPS_SMALL or b3Proc:getDimZ() > dRawH))
|
||||
return ( b3Proc:getDimY() > ( dRawW - 500 * GEO.EPS_SMALL) and b3Proc:getDimZ() > ( dRawH - 500 * GEO.EPS_SMALL))
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
return BeamLib
|
||||
function BeamLib.GetAdjacentFaces( Proc, nFacet)
|
||||
local AdjacentFaces = {}
|
||||
local vFaceAdjacencies = EgtSurfTmFacetAdjacencies( Proc.Id, nFacet)[1]
|
||||
for i = 1, #vFaceAdjacencies do
|
||||
if vFaceAdjacencies[i] > -1 then
|
||||
local _, ptP1, ptP2 = EgtSurfTmFacetsContact( Proc.Id, nFacet, vFaceAdjacencies[i], GDB_ID.ROOT)
|
||||
local dLen = dist( ptP1, ptP2)
|
||||
table.insert( AdjacentFaces, { Id = vFaceAdjacencies[i], LengthOnMainFace = dLen})
|
||||
end
|
||||
end
|
||||
|
||||
return AdjacentFaces
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.GetFacetsInfo( Proc, b3Raw)
|
||||
|
||||
if Proc.Fct > 20 then
|
||||
return nil
|
||||
end
|
||||
|
||||
local Face = {}
|
||||
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( Proc.PartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
local vAdj
|
||||
if Proc.AdjacencyMatrix then
|
||||
vAdj = Proc.AdjacencyMatrix
|
||||
else
|
||||
vAdj = BeamLib.GetAdjacencyMatrix( Proc)
|
||||
end
|
||||
|
||||
for i = 1, Proc.Fct do
|
||||
Face[i] = {}
|
||||
Face[i].Id = i - 1
|
||||
Face[i].PtCenter, Face[i].VtN = EgtSurfTmFacetCenter( Proc.Id, i - 1, GDB_ID.ROOT)
|
||||
if Proc.Fct < 10 then
|
||||
local frHV, dFaceWidthTrimmed, dFaceHeightTrimmed = BeamLib.GetFaceHvRefDim( Proc.Id, i - 1, b3Raw)
|
||||
-- frame OCS faccia
|
||||
Face[i].FrameHV = frHV
|
||||
-- larghezza OCS faccia trimmata con grezzo
|
||||
Face[i].WidthTrimmed = dFaceWidthTrimmed
|
||||
-- altezza OCS faccia trimmata con grezzo
|
||||
Face[i].HeightTrimmed = dFaceHeightTrimmed
|
||||
local _, dFaceWidth, dFaceHeight = BeamLib.GetFaceHvRefDim( Proc.Id, i - 1)
|
||||
-- larghezza OCS faccia
|
||||
Face[i].Width = dFaceWidth
|
||||
-- altezza OCS faccia
|
||||
Face[i].Height = dFaceHeight
|
||||
-- elevazione calcolata rispetto al box della parte
|
||||
Face[i].Elevation = EgtSurfTmFacetElevationInBBox( Proc.Id, i - 1, b3Solid, true, GDB_ID.ROOT)
|
||||
-- area della faccia
|
||||
-- TODO qui sarebbe meglio l'area vera e non quella del rettangolo minimo
|
||||
local _, dLongEdgeDimension, dShortEdgeDimension = EgtSurfTmFacetMinAreaRectangle( Proc.Id, i - 1, GDB_ID.ROOT)
|
||||
Face[i].Area = dShortEdgeDimension * dLongEdgeDimension
|
||||
-- adiacenze della faccia
|
||||
-- TODO chiamarle in modo che si capisca che sono solo gli id e non l'intero oggetto faccia
|
||||
Face[i].Adjacencies = {}
|
||||
for j = 1, Proc.Fct do
|
||||
if vAdj[i][j] and vAdj[i][j] ~= 0 and ( i ~= j) then
|
||||
table.insert( Face[i].Adjacencies, j - 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return Face
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function BeamLib.GetEdgesInfo( Proc, Face)
|
||||
local Edges = {}
|
||||
local nFaceType, vEdges = EgtSurfTmGetFacetOutlineInfo( Proc.Id, Face.Id, GDB_ID.ROOT)
|
||||
|
||||
if nFaceType < 1 then
|
||||
for j = 1, #vEdges do
|
||||
local nPreviousEdgeIndex = j - 1
|
||||
if j == 1 then
|
||||
nPreviousEdgeIndex = #vEdges
|
||||
end
|
||||
local nNextEdgeIndex = j + 1
|
||||
if j == #vEdges then
|
||||
nNextEdgeIndex = 1
|
||||
end
|
||||
|
||||
local CurrentEdge = {}
|
||||
CurrentEdge.AdjacentFaceId = vEdges[j].Adj
|
||||
CurrentEdge.ToolDirection = Vector3d( vEdges[j].Norm)
|
||||
CurrentEdge.Length = vEdges[j].Len
|
||||
CurrentEdge.Elevation = vEdges[j].Elev
|
||||
CurrentEdge.IsOpen = vEdges[j].Open
|
||||
CurrentEdge.IsStartOpen = ( vEdges[nPreviousEdgeIndex].Open)
|
||||
CurrentEdge.IsEndOpen = ( vEdges[nNextEdgeIndex].Open)
|
||||
|
||||
table.insert( Edges, CurrentEdge)
|
||||
end
|
||||
else
|
||||
error( 'Face with closed hole')
|
||||
end
|
||||
|
||||
return Edges
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- restituisce la matrice delle adiacenze di Proc dove i e j sono le facce e a(ij) è l'angolo tra di esse; 0 se nessuna adiacenza
|
||||
function BeamLib.GetAdjacencyMatrix( Proc)
|
||||
local vAdj = {}
|
||||
-- essendo la matrice simmetrica a diagonale nulla, ne calcolo solo la metà superiore
|
||||
for i = 1, Proc.Fct do
|
||||
vAdj[i] = {}
|
||||
for j = i + 1, Proc.Fct do
|
||||
_, _, _, vAdj[i][j] = EgtSurfTmFacetsContact( Proc.Id, i - 1, j - 1, GDB_ID.ROOT)
|
||||
if not vAdj[i][j] then vAdj[i][j] = 0 end
|
||||
end
|
||||
end
|
||||
-- riempio di conseguenza il resto della matrice
|
||||
for i = 1, Proc.Fct do
|
||||
vAdj[i][i] = 0
|
||||
for j = i + 1, Proc.Fct do
|
||||
vAdj[j][i] = vAdj[i][j]
|
||||
end
|
||||
end
|
||||
return vAdj
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.GetMachiningSteps( dMachiningDepth, dStep)
|
||||
|
||||
local MachiningSteps = {}
|
||||
MachiningSteps.StepLength = 0
|
||||
MachiningSteps.Count = ceil( ( dMachiningDepth - 10 * GEO.EPS_SMALL) / dStep)
|
||||
if MachiningSteps.Count > 1 then
|
||||
MachiningSteps.StepLength = ( dMachiningDepth - dStep) / ( MachiningSteps.Count - 1)
|
||||
end
|
||||
|
||||
return MachiningSteps
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.IsCutNeeded( Proc, b3Raw, dOvmHead, dOvmTail)
|
||||
if not dOvmTail then
|
||||
dOvmTail = BD.OVM_MID
|
||||
end
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
|
||||
if Proc.Head then
|
||||
-- se coincide con il taglio di separazione precedente, non va fatto
|
||||
if AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Raw:getMax():getX() + dOvmHead) < 10 * GEO.EPS_SMALL then
|
||||
return false
|
||||
end
|
||||
-- altrimenti taglio di coda
|
||||
else
|
||||
-- se coincide con taglio di separazione, non va fatto
|
||||
if AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
|
||||
return false
|
||||
end
|
||||
end
|
||||
-- se coincide con un taglio frontale non va fatto
|
||||
if Proc.CutFront then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.GetToolFromMachining( sMachiningName)
|
||||
local Tool = {}
|
||||
if EgtMdbSetCurrMachining( sMachiningName) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
Tool.Name = EgtTdbGetCurrToolParam( MCH_TP.NAME)
|
||||
Tool.IsCCW = ( EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0)
|
||||
Tool.Type = EgtTdbGetCurrToolParam( MCH_TP.TYPE)
|
||||
Tool.Diameter = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or 0
|
||||
Tool.HeadType = {}
|
||||
Tool.PreferredSide = {}
|
||||
if BD.GetSetupInfo then
|
||||
Tool.HeadType = BD.GetSetupInfo( EgtTdbGetCurrToolParam( MCH_TP.HEAD)).HeadType
|
||||
Tool.PreferredSide = BD.GetSetupInfo( EgtTdbGetCurrToolParam( MCH_TP.HEAD)).PreferredSide
|
||||
end
|
||||
-- lama
|
||||
if Tool.Type == MCH_TY.SAW_STD or Tool.Type == MCH_TY.SAW_FLAT then
|
||||
Tool.Thickness = EgtTdbGetCurrToolParam(MCH_TP.THICK) or 0
|
||||
Tool.MaxDepth = EgtTdbGetCurrToolMaxDepth() or 0
|
||||
Tool.SideStep = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDESTEP', 'd')
|
||||
-- sega a catena
|
||||
elseif Tool.Type == MCH_TY.MORTISE_STD then
|
||||
Tool.Length = EgtTdbGetCurrToolParam( MCH_TP.LEN) or 0
|
||||
Tool.MaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or 0
|
||||
Tool.Width = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or 0
|
||||
Tool.Thickness = EgtTdbGetCurrToolParam( MCH_TP.THICK) or 0
|
||||
Tool.CornerRadius = EgtTdbGetCurrToolParam( MCH_TP.CORNRAD) or 0
|
||||
-- fresa (TODO al momento aggiunte solo le informazioni che servono)
|
||||
elseif Tool.Type == MCH_TY.MILL_STD or MCH_TY.MILL_NOTIP then
|
||||
if BD.GetSetupInfo then
|
||||
Tool.IsOnAggregate = BD.GetSetupInfo( EgtTdbGetCurrToolParam( MCH_TP.HEAD)).bToolOnAggregate
|
||||
else
|
||||
Tool.IsOnAggregate = false
|
||||
end
|
||||
-- altri utensili al momento non previsti
|
||||
else
|
||||
error( 'Wrong tool type')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return Tool
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
return BeamLib
|
||||
+7
-4
@@ -275,12 +275,15 @@ local function VerifyFirstOrthoCut( CutTable, OffsetP, BBoxRawPart, dNzLimDwnUp)
|
||||
-- normale alla faccia ortogonale
|
||||
local _, vtO = EgtSurfTmFacetCenter( CutOId, 0, GDB_ID.ROOT)
|
||||
vtO = vtO - vtO * vtN1 * vtN1 ; vtO:normalize()
|
||||
local dMaxElev = EgtSurfTmFacetElevationInBBox( CutOId, 0, BBoxRawPart, true, GDB_ID.ROOT)
|
||||
-- calcolo lunghezza prima semi-faccia
|
||||
local asseX1 = vtO
|
||||
local asseY1 = vtN1 ^ asseX1
|
||||
local Frame1 = Frame3d( ptC1, ptC1+asseX1, ptC1+asseY1)
|
||||
local Box1 = EgtGetBBoxRef( Cut1Id, GDB_BB.STANDARD, Frame1)
|
||||
local x1 = Box1:getDimX()
|
||||
-- prendo il massimo tra la lugnhezza della faccia parallela e l'elevazione della corrispondente ortogonale
|
||||
x1 = max( x1, dMaxElev)
|
||||
-- calcolo lunghezza seconda semi-faccia
|
||||
local asseX2 = vtO
|
||||
local asseY2 = vtN2 ^ asseX2
|
||||
@@ -404,7 +407,7 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl
|
||||
local dNzLimDwnUp = BL.GetNzLimDownUp( BBoxRawPart)
|
||||
|
||||
-- se non c'è testa da sotto e normali senza componenti in Y con faccia quasi verticale e trave non alta, uso per offset i limiti dei tagli di testa e coda
|
||||
if not BD.DOWN_HEAD and abs( vtNPlanes:getY()) < 0.1 and vtNPlanes:getZ() < 0.7071 and ( not vtNBond or abs( vtNBond:getY()) < 0.1) and BBoxRawPart:getDimZ() < BD.MIN_DIM_HBEAM then
|
||||
if not BD.TURN and not BD.DOWN_HEAD and abs( vtNPlanes:getY()) < 0.1 and vtNPlanes:getZ() < 0.7071 and ( not vtNBond or abs( vtNBond:getY()) < 0.1) and BBoxRawPart:getDimZ() < BD.MIN_DIM_HBEAM then
|
||||
OffsetO = dOrthoMaxDim or BD.MAX_DIM_HTCUT
|
||||
end
|
||||
|
||||
@@ -420,7 +423,7 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl
|
||||
-- se piani non ortogonali, diminuisco la distanza di offset opportunamente
|
||||
local originalOffsetP = OffsetP
|
||||
if not bGetOrtoPlanes then
|
||||
local dCoeff = ( vtNPlanes ^ vtNBond):len()
|
||||
local dCoeff = max( ( vtNPlanes ^ vtNBond):len(), 0.5)
|
||||
OffsetP = OffsetP * dCoeff
|
||||
OffsetO = OffsetO * dCoeff
|
||||
end
|
||||
@@ -430,7 +433,7 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl
|
||||
if dElevO then
|
||||
local m = ceil( dElevO / OffsetO)
|
||||
OffsetO = dElevO / m
|
||||
end
|
||||
end
|
||||
|
||||
-- elenco di tutte le superfici generate dai tagli
|
||||
local TabFUCHSIA = {}
|
||||
@@ -563,7 +566,7 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl
|
||||
end
|
||||
end
|
||||
|
||||
return UltimateTable
|
||||
return UltimateTable, OffsetP, OffsetO
|
||||
end
|
||||
|
||||
----------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
+209
-57
@@ -27,6 +27,9 @@
|
||||
-- 2024/01/18 Gestita lama con aggregato con asse bloccato per massimizzare capacità di taglio verticale, se da sotto.
|
||||
-- Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile.
|
||||
-- 2024/02/22 Migliorato calcolo area non pinzabile in testa HCING e coda TCING
|
||||
-- 2024/03/27 In MakeTwo rimossa gestione calcolo differente su ultima passata in caso di macchina FAST
|
||||
-- 2024/06/18 In MakeOne in caso di inversione del percorso, si scambia anche accorciamento start con end
|
||||
-- 2024/09/12 In MakeOne per settare il FaceUse si usa il versore nelle UserNotes
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local FacesBySaw = {}
|
||||
@@ -43,7 +46,7 @@ local BD = require( 'BeamData')
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert)
|
||||
function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert, sLeadInOutType, dActualElevation)
|
||||
EgtOutLog( 'FacesBySaw.MakeParallelOne', 3)
|
||||
-- dati della faccia
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT)
|
||||
@@ -65,16 +68,28 @@ function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimD
|
||||
local dLiPerp = dDistX + dCutExtra + dCutSic
|
||||
local dLoTang = dLiTang
|
||||
local dLoPerp = dLiPerp
|
||||
local dLiCompLength = 0
|
||||
local dLoCompLength = 0
|
||||
-- lunghezza attacco/uscita tangenti
|
||||
local dLi2Tang = dSawDiam / 2 + dCutSic
|
||||
local dLi2Perp = 0
|
||||
local dLo2Tang = dLi2Tang
|
||||
local dLo2Perp = dLi2Perp
|
||||
local dLi2CompLength = 0
|
||||
local dLo2CompLength = 0
|
||||
-- scelgo l'attacco più conveniente
|
||||
local bLioTang
|
||||
local Ktp = 1.1
|
||||
if BD.KIOTP then Ktp = BD.KIOTP end
|
||||
if Ktp * dLi2Tang < dLiPerp then
|
||||
if ( sLeadInOutType == 'PerpendicularOutraw') then
|
||||
bLioTang = false
|
||||
dLiCompLength = dActualElevation + EgtMdbGetGeneralParam( MCH_GP.SAFEZ)
|
||||
dLoCompLength = dActualElevation + EgtMdbGetGeneralParam( MCH_GP.SAFEZ)
|
||||
dLiTang = 1
|
||||
dLoTang = 1
|
||||
dLiPerp = 0
|
||||
dLoPerp = 0
|
||||
elseif ( sLeadInOutType ~= 'Perpendicular') and ( ( sLeadInOutType == 'Tangent') or ( Ktp * dLi2Tang < dLiPerp)) then
|
||||
bLioTang = true
|
||||
dLiTang, dLiPerp, dLoTang, dLoPerp = dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp
|
||||
if BD.TURN then
|
||||
@@ -133,9 +148,11 @@ function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimD
|
||||
-- imposto attacco/uscita
|
||||
EgtSetMachiningParam( MCH_MP.LITANG, dLiTang)
|
||||
EgtSetMachiningParam( MCH_MP.LIPERP, dLiPerp)
|
||||
EgtSetMachiningParam( MCH_MP.LICOMPLEN, dLiCompLength)
|
||||
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)
|
||||
EgtSetMachiningParam( MCH_MP.LOCOMPLEN, dLoCompLength)
|
||||
-- imposto allungamenti iniziale e finale
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, -dAccStart)
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, -dAccEnd)
|
||||
@@ -154,6 +171,9 @@ function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimD
|
||||
local vtOut = EgtIf( vtN:getX() > 0, X_AX(), -X_AX())
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCutting, 'perpendicular', b3Raw, vtTool, vtOut))
|
||||
-- eventuali note
|
||||
if ( sLeadInOutType == 'PerpendicularOutraw') then
|
||||
sNotes = EgtSetValInNotes( sNotes, 'OutRaw', 3)
|
||||
end
|
||||
if sNotes and #sNotes > 0 then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
@@ -190,7 +210,28 @@ local function GetNameSolidFaceIncludingLine( b3Solid, ptP1Comp, ptP2Comp)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert, bMaximizeVerticalDepth)
|
||||
local function AreSameOrOppositeDirApprox( vDir1, vDir2)
|
||||
if abs( abs( vDir1) - abs( vDir2)) < 10 * GEO.EPS_SMALL then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function GetEdgeToMachineFromVector( nSurfId, nFacet, vtOrthO)
|
||||
local _, EdgesEgt = EgtSurfTmGetFacetOutlineInfo( nSurfId, nFacet, GDB_ID.ROOT)
|
||||
|
||||
for i = 1, #EdgesEgt do
|
||||
if AreOppositeVectorApprox( EdgesEgt[i].Norm, vtOrthO) then
|
||||
return ( i - 1)
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert, bMaximizeVerticalDepth, bSpecialTangentLeadInOut, sLeadInOutType, Par5Alternative, dActualElevation)
|
||||
-- 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
|
||||
@@ -198,7 +239,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
||||
Par5 == MCH_MILL_FU.PARAL_BACK or
|
||||
Par5 == MCH_MILL_FU.PARAL_LEFT or
|
||||
Par5 == MCH_MILL_FU.PARAL_RIGHT) then
|
||||
return MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert)
|
||||
return MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert, sLeadInOutType, dActualElevation)
|
||||
end
|
||||
-- la lama ha asse perpendicolare alla faccia
|
||||
EgtOutLog( 'FacesBySaw.MakeOne', 3)
|
||||
@@ -207,6 +248,8 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
||||
-- risolvo parametro ambiguo
|
||||
local nOrthoOpposite
|
||||
local vtOrthO
|
||||
local nOrthoOppositeAlternative
|
||||
local vtOrthOAlternative
|
||||
if isVector3d( Par5) then
|
||||
nOrthoOpposite = BL.GetNearestOrthoOpposite( Par5, vtN)
|
||||
vtOrthO = Vector3d( Par5)
|
||||
@@ -214,13 +257,23 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
||||
nOrthoOpposite = Par5
|
||||
vtOrthO = BL.GetVersRef( Par5)
|
||||
end
|
||||
if Par5Alternative then
|
||||
if isVector3d( Par5Alternative) then
|
||||
nOrthoOppositeAlternative = BL.GetNearestOrthoOpposite( Par5Alternative, vtN)
|
||||
vtOrthOAlternative = Vector3d( Par5Alternative)
|
||||
else
|
||||
nOrthoOppositeAlternative = Par5Alternative
|
||||
vtOrthOAlternative = BL.GetVersRef( Par5Alternative)
|
||||
end
|
||||
end
|
||||
EgtOutLog( 'VtOrthO='..tostring( vtOrthO)..' FaceUse='..tostring( nOrthoOpposite), 3)
|
||||
-- verifico se testa da sotto oppure se lavorazione sotto con testa da sopra
|
||||
if not dVzLimDwnUp then dVzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN, vtOrthO) end
|
||||
local bDownHead = ( dVzLimDwnUp and dVzLimDwnUp < - 1.5)
|
||||
local bDownUp = ( vtN:getZ() < dVzLimDwnUp)
|
||||
-- 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, vtOrthO, GDB_ID.ROOT)
|
||||
|
||||
|
||||
if not dLen or dLen < 1.1 or not dWidth or dWidth < 1.1 then
|
||||
local sWarn = 'Face ' .. string.format( '%d,%d', nSurfId, nFacet) .. ' skipped : too small'
|
||||
EgtOutLog( sWarn, 1)
|
||||
@@ -232,14 +285,41 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
||||
return false
|
||||
end
|
||||
local bIsSawCCW = ( EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0)
|
||||
-- se settato nelle note lavorazione si lavora in discordanza
|
||||
EgtMdbSetCurrMachining( sCutting)
|
||||
local sMachiningNotes = EgtMdbGetCurrMachiningParam( MCH_MP.USERNOTES) or ''
|
||||
if ( EgtGetValInNotes( sMachiningNotes, 'PATHINVERT', 'd') or 0) == 1 then
|
||||
bIsSawCCW = not bIsSawCCW
|
||||
end
|
||||
local bInvert = bForceInvert
|
||||
-- se la lama ruota in senso antiorario inverto la direzione di lavorazione, per avere rotazione lama opposta a avanzamento
|
||||
-- l'inversione può essere comandata da rotazione lama (direzione concorde, legata anche a DownUp) oppure da direzione Z del percorso (si preferisce lavorare dal basso verso l'alto per limitare le corse)
|
||||
-- se c'è disaccordo tra rotazione e direzione si cambia il lato di lavoro, se possibile. Se ciò non è possbile comanda la direzione. Se percorso orizzontale comanda la rotazione.
|
||||
if bInvert == nil then
|
||||
if not BD.TURN or abs( ptP2:getY() - ptP1:getY()) < 250 then
|
||||
if bIsSawCCW ~= bDownUp then
|
||||
bInvert = ( ptP2:getZ() < ptP1:getZ() + 100 * GEO.EPS_SMALL)
|
||||
local bIsMachiningDownwards = ( ptP2:getZ() < ptP1:getZ() - 100 * GEO.EPS_SMALL)
|
||||
local bIsMachiningUpwards = ( ptP2:getZ() > ptP1:getZ() + 100 * GEO.EPS_SMALL)
|
||||
if ( bIsSawCCW ~= bDownUp) and ( bIsMachiningDownwards or not ( bIsMachiningDownwards or bIsMachiningUpwards)) then
|
||||
bInvert = true
|
||||
elseif ( ( bIsSawCCW ~= bDownUp) ~= bIsMachiningDownwards) then
|
||||
if Par5Alternative then
|
||||
bInvert = true
|
||||
nOrthoOpposite = nOrthoOppositeAlternative
|
||||
vtOrthO = vtOrthOAlternative
|
||||
-- avendo riassegnato la direzione di lavoro, i dati della linea vanno ricalcolati
|
||||
ptP1, ptPm, ptP2, vtV1, vtV2, dLen, dWidth = EgtSurfTmFacetOppositeSide( nSurfId, nFacet, vtOrthO, GDB_ID.ROOT)
|
||||
if not dLen or dLen < 1.1 or not dWidth or dWidth < 1.1 then
|
||||
local sWarn = 'Face ' .. string.format( '%d,%d', nSurfId, nFacet) .. ' skipped : too small'
|
||||
EgtOutLog( sWarn, 1)
|
||||
return true, ''
|
||||
end
|
||||
vtV1 = - vtV1
|
||||
elseif bIsMachiningDownwards or not bIsMachiningUpwards then
|
||||
bInvert = true
|
||||
else
|
||||
bInvert = false
|
||||
end
|
||||
else
|
||||
bInvert = ( ptP2:getZ() < ptP1:getZ() - 100 * GEO.EPS_SMALL)
|
||||
bInvert = false
|
||||
end
|
||||
else
|
||||
local vtTmp = ptP2 - ptP1 ; vtTmp:normalize()
|
||||
@@ -249,6 +329,10 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
||||
if bInvert then
|
||||
ptP1, ptP2 = ptP2, ptP1
|
||||
vtV1, vtV2 = vtV2, vtV1
|
||||
-- se l'inversione è forzata dall'esterno, anche gli accorciamenti che arrivano dall'esterno si prendono per buoni
|
||||
if bForceInvert == nil then
|
||||
dAccStart, dAccEnd = dAccEnd, dAccStart
|
||||
end
|
||||
end
|
||||
local vtTg = ptP2 - ptP1 ; vtTg:normalize()
|
||||
local dAllStart = 0
|
||||
@@ -270,7 +354,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
||||
bIsBiLinea = true
|
||||
local vtTg1 = ptPm - ptP1 ; vtTg1:normalize()
|
||||
local vtTg2 = ptP2 - ptPm ; vtTg2:normalize()
|
||||
local dCosMax = 0.951 -- cos( 18°)
|
||||
local dCosMax = 0.966 -- cos( 15°)
|
||||
local dLenMin = 30
|
||||
local dLenMax = max( 0.5 * dSawDiam * 0.17365 + 1, 2 * dLenMin)
|
||||
dCosAngleL1L2 = vtTg1 * vtTg2
|
||||
@@ -327,10 +411,30 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
||||
local dLiTang, dLiPerp, dLoTang, dLoPerp, vtLio = FacesBySaw.CalcLeadInOutPerpGeom( ptPa1, ptPa2, vtV1, vtV2, vtN, dSawDiam / 2, vtRef, dCutExtra, b3Box)
|
||||
local dLenLi = sqrt( dLiTang * dLiTang + dLiPerp * dLiPerp)
|
||||
local dLenLo = sqrt( dLoTang * dLoTang + dLoPerp * dLoPerp)
|
||||
local dLiCompLength = 0
|
||||
local dLoCompLength = 0
|
||||
-- attacco tangente
|
||||
local dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp = FacesBySaw.CalcLeadInOutTangGeom( ptPa1, ptPa2, vtN, dSawDiam / 2, vtRef, dCutExtra, b3Box)
|
||||
local dLi2Tang = 0
|
||||
local dLi2Perp = 0
|
||||
local dLo2Tang = 0
|
||||
local dLo2Perp = 0
|
||||
local dLi2CompLength = 0
|
||||
|
||||
-- si predilige un attacco tangenziale (con calcolo automatico di quanto uscire) se faccia che guarda in giù, non troppo orientata verso X e linea non troppo inclinata in X
|
||||
-- non si fa se macchina tipo PF e pezzo alto perchè la lama, uscendo da sopra, toccherebbe la traversa
|
||||
-- TODO si potranno togliere i limiti sulle normali quando si implementerà un modo per calcolare Lead In / Out correttamente in tutti i casi
|
||||
--
|
||||
if bSpecialTangentLeadInOut and not bIsBiLinea and ( vtN:getZ() < - 0.087) and ( abs( vtN:getX()) < 0.258) and ( abs( vtTg:getX()) < 0.1736) and ( abs( vtN:getY()) < 0.5 or ( BD.MAX_DIM_HTCUT_HBEAM > 0 or ( b3Raw:getDimZ() < 420))) then
|
||||
dLi2Tang = 0
|
||||
dLi2Perp = BD.CUT_EXTRA
|
||||
dLi2CompLength = dLen + dSawDiam / 2 + BD.COLL_SIC
|
||||
dLo2Tang = dSawDiam / 2
|
||||
else
|
||||
dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp = FacesBySaw.CalcLeadInOutTangGeom( ptPa1, ptPa2, vtN, dSawDiam / 2, vtRef, dCutExtra, b3Box)
|
||||
end
|
||||
local dLenLi2 = abs( dLi2Tang)
|
||||
local dLenLo2 = abs( dLo2Tang)
|
||||
local dBiLineaAddLength = 0
|
||||
|
||||
-- se il lato non lavorato della bilinea è aperto, setto entrata/uscita con la stessa direzione
|
||||
if bIsBiLinea then
|
||||
@@ -359,8 +463,9 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
||||
local dDistPointToCenter = sqrt( dDistPtTang * dDistPtTang + dDistToCenter * dDistToCenter)
|
||||
-- se distanza al punto è maggiore del raggio lama, significa che non ho già lavorato, quindi calcolo uscita opportunamente
|
||||
if dDistPointToCenter > 0.5 * dSawDiam then
|
||||
dBiLineaAddLength = dDistPointToCenter - ( 0.5 * dSawDiam)
|
||||
dLoTang = -dAllEnd * dCosAlpha
|
||||
dLoPerp = dDist2 * dSinAlpha
|
||||
dLoPerp = dDist2 * dSinAlpha
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -369,14 +474,24 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
||||
local bLioTang
|
||||
local Ktp = 1.1
|
||||
if BD.KIOTP then Ktp = BD.KIOTP end
|
||||
if ( not bDownUp or abs( vtTg:getY()) > 0.5) and
|
||||
if ( sLeadInOutType == 'PerpendicularOutraw') then
|
||||
bLioTang = false
|
||||
dLiCompLength = dActualElevation + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + dCutExtra
|
||||
dLoCompLength = dActualElevation + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + dCutExtra
|
||||
dLiTang = 1
|
||||
dLoTang = 1
|
||||
dLiPerp = 0
|
||||
dLoPerp = 0
|
||||
dLenLi = sqrt( dLiTang * dLiTang + dLiPerp * dLiPerp)
|
||||
dLenLo = sqrt( dLoTang * dLoTang + dLoPerp * dLoPerp)
|
||||
elseif ( sLeadInOutType ~= 'Perpendicular') and ( ( sLeadInOutType == 'Tangent') or ( not bDownUp or abs( vtTg:getY()) > 0.5) and
|
||||
( not bDownHead or abs( vtTg:getZ()) < 0.51) 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.51 and b3Box:getDimZ() > 300 and BD.C_SIMM and BD.MAX_HEIGHT > 450 and b3Box:getDimX() > BD.LEN_SHORT_PART) or
|
||||
( abs( vtTg:getZ()) < 0.51 and ( dLenLi2 + dLenLo2) < ( dLenLi + dLenLo)) or
|
||||
Ktp * ( dLenLi2 + dLenLo2) < ( dLenLi + dLenLo) or
|
||||
( BD.TURN == 2 and vtRef:getZ() < -0.1)) then
|
||||
( BD.TURN == 2 and vtRef:getZ() < -0.1))) then
|
||||
if BD.TURN == 2 then
|
||||
if vtTg:getY() < -0.1 then
|
||||
bLioTang = 1
|
||||
@@ -392,24 +507,49 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
||||
-- dLoPerp rimane invariato
|
||||
end
|
||||
elseif BD.TURN then
|
||||
bLioTang = 2
|
||||
local dMove = dist( ptP1, ptP2)
|
||||
dLiTang, dLiPerp = dLi2Tang, dLi2Perp
|
||||
dLoTang = -( dLiTang - dAccStart - dAccEnd + dMove)
|
||||
dLoPerp = BD.COLL_SIC
|
||||
-- se angolo bilinea ottuso si segue bilinea per un tratto per tagliare completamente cubetto a forma di rombo
|
||||
if dCosAngleL1L2 > 0.707 and bIsBiLinea then
|
||||
-- calcolo uscita per prolungare solo della parte mancante per completare il taglio
|
||||
if dBiLineaAddLength > 0 then
|
||||
dLoTang = dLoTang * ( dBiLineaAddLength + BD.COLL_SIC) / 100
|
||||
dLoPerp = dLoPerp * ( dBiLineaAddLength + BD.COLL_SIC) / 100
|
||||
end
|
||||
-- aggiungo componente perpendicolare a percorso per ritornare dal punto di ingresso, altrimenti l'uscita viene allungata fino dall'altra parte del grezzo
|
||||
dLoCompLength = 100
|
||||
-- se angolo bilinea oltre 45°, faccio movimento in retrazione
|
||||
else
|
||||
bLioTang = 2
|
||||
local dMove = dist( ptP1, ptP2)
|
||||
dLoTang = -( dLiTang - dAccStart - dAccEnd + dMove)
|
||||
dLoPerp = BD.COLL_SIC
|
||||
end
|
||||
else
|
||||
bLioTang = true
|
||||
dLiTang, dLiPerp, dLoTang, dLoPerp = dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp
|
||||
dLiTang, dLiPerp, dLoTang, dLoPerp, dLiCompLength = dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp, dLi2CompLength
|
||||
end
|
||||
end
|
||||
-- posizione braccio
|
||||
EgtOutLog( 'vtN=' .. tostring( vtN) .. ' vtRef=' .. tostring( vtRef) .. ' vtOut=' .. tostring( vtOut) .. ' vtAux=' .. tostring( vtAux), 3)
|
||||
local nSCC = MCH_SCC.NONE
|
||||
if not BD.TURN then
|
||||
if abs( vtAux:getX()) > abs( vtAux:getY()) - GEO.EPS_SMALL then
|
||||
nSCC = EgtIf( ( vtAux:getX() > -GEO.EPS_SMALL), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
||||
-- per ora aggregato usato in verticale solo in split e headcut; Fast non influenzata
|
||||
if BD.C_SIMM and bMaximizeVerticalDepth then
|
||||
nSCC = MCH_SCC.ADIR_ZM
|
||||
elseif abs( vtAux:getX()) > abs( vtAux:getY()) - GEO.EPS_SMALL then
|
||||
-- se il taglio è orizzontale, si gira aggregato lama per facilitare caduta del legno
|
||||
if abs( vtTg:getZ()) < 10 * GEO.EPS_SMALL and not AreSameOrOppositeVectorApprox( vtN, Z_AX()) then
|
||||
nSCC = EgtIf( ( vtAux:getX() > -GEO.EPS_SMALL), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
|
||||
else
|
||||
nSCC = EgtIf( ( vtAux:getX() > -GEO.EPS_SMALL), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
||||
end
|
||||
else
|
||||
nSCC = EgtIf( ( vtAux:getY() > -GEO.EPS_SMALL), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
||||
-- se il taglio è orizzontale, si gira aggregato lama per facilitare caduta del legno
|
||||
if abs( vtTg:getZ()) < 10 * GEO.EPS_SMALL and not AreSameOrOppositeVectorApprox( vtN, Z_AX()) then
|
||||
nSCC = EgtIf( ( vtAux:getY() > -GEO.EPS_SMALL), MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)
|
||||
else
|
||||
nSCC = EgtIf( ( vtAux:getY() > -GEO.EPS_SMALL), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
||||
end
|
||||
end
|
||||
else
|
||||
if BD.TURN == 2 then
|
||||
@@ -456,6 +596,18 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
||||
EgtSetMachiningGeometry( {{ nSurfId, nFacet}})
|
||||
-- imposto uso faccia
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
||||
-- vtFaceUse non funziona correttaemnte in caso che il lato da lavorare sia a 45°. Potrebbe ritornare una trilinea, non gestibile. Quindi si setta l'EDGE
|
||||
local nEdgeFaceUse = GetEdgeToMachineFromVector( nSurfId, nFacet, vtOrthO)
|
||||
if nEdgeFaceUse and ( AreSameOrOppositeDirApprox( vtOrthO:getX(), 0.707) or AreSameOrOppositeDirApprox( vtOrthO:getY(), 0.707) or AreSameOrOppositeDirApprox( vtOrthO:getZ(), 0.707)) then
|
||||
local sNoteEdgeFaceUse = 'EdgesFaceUse=' .. EgtNumToString( nEdgeFaceUse) .. ';'
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sNoteEdgeFaceUse)
|
||||
else
|
||||
local sNoteVtFaceUse = 'VtFaceUse=' .. EgtNumToString( vtOrthO:getX(),3) .. ',' .. EgtNumToString( vtOrthO:getY(),3) .. ',' .. EgtNumToString( vtOrthO:getZ(),3) .. ';'
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sNoteVtFaceUse)
|
||||
-- imposto allungamenti iniziale e finale (in caso si utilizzi EDGE, non serve prolungare o accorciare)
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dAllStart - dAccStart)
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dAllEnd - dAccEnd)
|
||||
end
|
||||
-- imposto posizione braccio porta testa
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
-- imposto inversione e lato correzione
|
||||
@@ -469,16 +621,18 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
||||
if BD.TURN and bLioTang == 1 then EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.TG_PERP) end
|
||||
EgtSetMachiningParam( MCH_MP.LITANG, dLiTang)
|
||||
EgtSetMachiningParam( MCH_MP.LIPERP, dLiPerp)
|
||||
EgtSetMachiningParam( MCH_MP.LICOMPLEN, dLiCompLength)
|
||||
if BD.TURN and bLioTang == 2 then EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG) end
|
||||
EgtSetMachiningParam( MCH_MP.LOTANG, dLoTang)
|
||||
EgtSetMachiningParam( MCH_MP.LOPERP, dLoPerp)
|
||||
-- imposto allungamenti iniziale e finale
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dAllStart - dAccStart)
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dAllEnd - dAccEnd)
|
||||
EgtSetMachiningParam( MCH_MP.LOCOMPLEN, dLoCompLength)
|
||||
-- imposto angolo 3° asse rot
|
||||
local sBlockedAxis = EgtIf( bMaximizeVerticalDepth, 'parallel', 'perpendicular')
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCutting, sBlockedAxis, b3Raw, vtN, vtOrthO))
|
||||
-- eventuali note
|
||||
if ( sLeadInOutType == 'PerpendicularOutraw') then
|
||||
sNotes = EgtSetValInNotes( sNotes, 'OutRaw', 3)
|
||||
end
|
||||
if sNotes and #sNotes > 0 then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
@@ -510,6 +664,25 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
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
|
||||
-- recupero i dati dell'utensile
|
||||
local dSawDiam = 400
|
||||
local dSawThick = 5
|
||||
local dMaxDepth = 0
|
||||
if EgtMdbSetCurrMachining( sCutting) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
|
||||
dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
end
|
||||
-- dati delle facce
|
||||
local ptC = {}
|
||||
local vtN = {}
|
||||
@@ -525,11 +698,11 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
|
||||
local ptM = ( ptT1 + ptT2) / 2
|
||||
local vtTg = ptT2 - ptT1 ; vtTg:normalize()
|
||||
local bConvex = ( dAngT > 0)
|
||||
-- verifico non siano orientate troppo verso il basso e molto sbandate (oltre 10 deg)
|
||||
-- verifico non siano orientate troppo verso il basso e molto sbandate (oltre 10 deg), oppure in testa o in coda e non troppo distanti dal grezzo esterno
|
||||
local bFaceOk = {}
|
||||
bFaceOk[1] = ( vtN[1]:getZ() >= BD.NZ_MINB or abs( vtN[1]:getY()) < 0.174)
|
||||
bFaceOk[2] = ( vtN[2]:getZ() >= BD.NZ_MINB or abs( vtN[2]:getY()) < 0.174)
|
||||
if not bDownHead and not bFaceOk[1] and not bFaceOk[2] then
|
||||
bFaceOk[1] = ( vtN[1]:getZ() >= ( BD.CUT_VZ_MIN or BD.NZ_MINB) or abs( vtN[1]:getY()) < 0.174 or ( Proc.AffectedFaces.Left ~= Proc.AffectedFaces.Right and Proc.Face[1].Elevation < dMaxDepth - 10 * GEO.EPS_SMALL))
|
||||
bFaceOk[2] = ( vtN[2]:getZ() >= ( BD.CUT_VZ_MIN or BD.NZ_MINB) or abs( vtN[2]:getY()) < 0.174 or ( Proc.AffectedFaces.Left ~= Proc.AffectedFaces.Right and Proc.Face[2].Elevation < dMaxDepth - 10 * GEO.EPS_SMALL))
|
||||
if not bDownHead and not bFaceOk[1] and not bFaceOk[2] then
|
||||
local sErr = 'Error : TwoFacesBySaw from bottom impossible'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
@@ -563,25 +736,6 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
|
||||
nUpInd = nBigInd
|
||||
nOtInd = nSmaInd
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
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
|
||||
-- recupero i dati dell'utensile
|
||||
local dSawDiam = 400
|
||||
local dSawThick = 5
|
||||
local dMaxDepth = 0
|
||||
if EgtMdbSetCurrMachining( sCutting) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
|
||||
dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
end
|
||||
-- calcolo extra taglio
|
||||
local dCutExtra = 0
|
||||
if dAngT < -91 and dAngT > -179 then
|
||||
@@ -618,12 +772,8 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
|
||||
local vtOrthO = EgtIf( ( i % 2) == 1, vtRef[nOtInd], vtRef[nUpInd])
|
||||
-- lavoro la faccia
|
||||
for j = 1, #vCuts[i] do
|
||||
-- se FAST, pezzo alto e ultimo taglio verticale -> allungo uscita per consentire eventuale rotazione B sul posto
|
||||
local dAccEnd = 0
|
||||
if not BD.C_SIMM and BD.MAX_HEIGHT_ROT_B_ABOVE and b3Raw:getDimZ() > BD.MAX_HEIGHT_ROT_B_ABOVE and vtOrthO:getZ() > 0.866 and j == #vCuts[i] then
|
||||
dAccEnd = - ( dSawDiam / 2 + BD.CUT_SIC)
|
||||
end
|
||||
local bOk, sErr = FacesBySaw.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthO, dNzLimDwnUp, dCutExtra, BD.CUT_SIC, 0, 0, dAccEnd, nil, b3Raw)
|
||||
local bSpecialTangentLeadInOut = ( i % 2 == 0) and ( Proc.AffectedFaces.Left or Proc.AffectedFaces.Right)
|
||||
local bOk, sErr = FacesBySaw.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthO, dNzLimDwnUp, dCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw, nil, nil, bSpecialTangentLeadInOut)
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
@@ -683,14 +833,16 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
|
||||
end
|
||||
-- taglio perpendicolare (limite Vz Down Up messo a -2 per non farlo mai intervenire)
|
||||
if vCuts[i][j] then
|
||||
local bOk, sErr = FacesBySaw.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO_1, -2, dExtraCut_1, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
local bSpecialTangentLeadInOut = ( i % 2 == 0) and ( Proc.AffectedFaces.Left or Proc.AffectedFaces.Right)
|
||||
local bOk, sErr = FacesBySaw.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO_1, -2, dExtraCut_1, BD.CUT_SIC, 0, 0, 0, nil, b3Raw, nil, nil, bSpecialTangentLeadInOut)
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
end
|
||||
-- taglio parallelo (limite Vz Down Up messo a -2 per non farlo mai intervenire)
|
||||
if vCuts[i+1][j] then
|
||||
local bOk, sErr = FacesBySaw.MakeOne( vCuts[i+1][j], 0, sCutting, dSawDiam, vtOrthoO_2, -2, dExtraCut_2, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
local bSpecialTangentLeadInOut = ( ( i + 1) % 2 == 0) and ( Proc.AffectedFaces.Left or Proc.AffectedFaces.Right)
|
||||
local bOk, sErr = FacesBySaw.MakeOne( vCuts[i+1][j], 0, sCutting, dSawDiam, vtOrthoO_2, -2, dExtraCut_2, BD.CUT_SIC, 0, 0, 0, nil, b3Raw, nil, nil, bSpecialTangentLeadInOut)
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
|
||||
+16
-35
@@ -5,6 +5,8 @@
|
||||
-- 2023/10/16 In GetFacesParallelToPart rimossa Pocket e aggiunto Rabbet al check solo direzione principale
|
||||
-- 2023/11/03 In Classify ora si settano le AffectedFaces nella Proc, se non già presenti.
|
||||
-- Aggiunta groove 2 facce, differenziata da rabbet.
|
||||
-- 2024/03/04 Feature senza topologia, calcolato in BeamExec
|
||||
-- 2024/05/06 A topologia Cut aggiunta IsThrough = true
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local FeatureTopology = {}
|
||||
@@ -17,32 +19,10 @@ local BL = require( 'BeamLib')
|
||||
|
||||
EgtOutLog( ' FeatureTopology started', 1)
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- restituisce la matrice delle adiacenze di Proc dove i e j sono le facce e a(ij) è l'angolo tra di esse; 0 se nessuna adiacenza
|
||||
local function GetAdjacencyMatrix( Proc)
|
||||
local vAdj = {}
|
||||
-- essendo la matrice simmetrica a diagonale nulla, ne calcolo solo la metà superiore
|
||||
for i = 1, Proc.Fct do
|
||||
vAdj[i] = {}
|
||||
for j = i + 1, Proc.Fct do
|
||||
_, _, _, vAdj[i][j] = EgtSurfTmFacetsContact( Proc.Id, i - 1, j - 1, GDB_ID.ROOT)
|
||||
if not vAdj[i][j] then vAdj[i][j] = 0 end
|
||||
end
|
||||
end
|
||||
-- riempio di conseguenza il resto della matrice
|
||||
for i = 1, Proc.Fct do
|
||||
vAdj[i][i] = 0
|
||||
for j = i + 1, Proc.Fct do
|
||||
vAdj[j][i] = vAdj[i][j]
|
||||
end
|
||||
end
|
||||
return vAdj
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- restituisce gli id delle facce di Proc che hanno il numero di adiacenze nAdj
|
||||
function FeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, vAdj, nAdj)
|
||||
if not vAdj then vAdj = GetAdjacencyMatrix( Proc) end
|
||||
if not vAdj then vAdj = BL.GetAdjacencyMatrix( Proc) end
|
||||
local nFct = #( vAdj or {})
|
||||
local vFacesWithGivenAdj = {}
|
||||
for i = 1, nFct do
|
||||
@@ -112,11 +92,11 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- restituisce un vettore contenente gli indici delle facce di Proc parallele ad una delle direzioni principali; il check varia in base alla famiglia topologica
|
||||
local function GetFacesParallelToPart( Proc, sFamily, bIsThrough)
|
||||
local function GetFacesParallelToPart( Proc, sFamily)
|
||||
local vFacesParallelToPart = {}
|
||||
for i = 0, Proc.Fct - 1 do
|
||||
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i, GDB_ID.ROOT)
|
||||
if sFamily == 'Rabbet' or sFamily == 'Bevel' or sFamily == 'DoubleBevel' or sFamily == 'Strip' or sFamily == 'Tunnel' or ( sFamily == 'Groove' and bIsThrough) then
|
||||
if sFamily == 'Rabbet' or sFamily == 'Bevel' or sFamily == 'DoubleBevel' or sFamily == 'Strip' then
|
||||
local vTriangularFaces = GetTriangularFaces( Proc)
|
||||
local bIsTriangularFace = false
|
||||
-- verifico se la faccia è triangolare
|
||||
@@ -173,22 +153,20 @@ function FeatureTopology.Classify( Proc, b3Raw)
|
||||
return false
|
||||
end
|
||||
|
||||
-- se non richiesto (default true, quindi nil vale true), esco
|
||||
if Proc.NeedTopology == false then
|
||||
Proc.Topology = 'SPECIAL'
|
||||
Proc.TopologyLongName = Proc.Topology
|
||||
return true
|
||||
end
|
||||
|
||||
-- se già calcolato, esco
|
||||
if Proc.Topology then
|
||||
return true
|
||||
end
|
||||
|
||||
-- calcoli
|
||||
if not Proc.AffectedFaces then Proc.AffectedFaces = BL.GetProcessAffectedFaces( Proc) end
|
||||
if not Proc.AffectedFaces then
|
||||
Proc.AffectedFaces = BL.GetProcessAffectedFaces( Proc)
|
||||
end
|
||||
if not Proc.Face then
|
||||
Proc.Face = BL.GetFacetsInfo( Proc, b3Raw)
|
||||
end
|
||||
|
||||
local vAdj = GetAdjacencyMatrix( Proc)
|
||||
local vAdj = Proc.AdjacencyMatrix or BL.GetAdjacencyMatrix( Proc)
|
||||
local bAllAnglesConcave, bAllRightAngles = AreAllAnglesConcaveOrRight( vAdj)
|
||||
local vTriangularFaces = GetTriangularFaces( Proc)
|
||||
local bIsAnyDimensionLongAsPart = IsAnyDimensionLongAsPart( Proc)
|
||||
@@ -205,6 +183,7 @@ function FeatureTopology.Classify( Proc, b3Raw)
|
||||
local bIsThrough
|
||||
if Proc.Fct == 1 and bIsAnyDimensionLongAsPart and bIsFeatureCuttingEntireSection then
|
||||
sFamily = 'Cut'
|
||||
bIsThrough = true
|
||||
elseif Proc.Fct == 1 and bIsAnyDimensionLongAsPart then
|
||||
sFamily = 'Bevel'
|
||||
bIsThrough = true
|
||||
@@ -214,6 +193,7 @@ function FeatureTopology.Classify( Proc, b3Raw)
|
||||
elseif Proc.Fct == 2 and bAllAnglesConcave and ( Proc.AffectedFaces.Left or Proc.AffectedFaces.Right) and ( Proc.AffectedFaces.Front or Proc.AffectedFaces.Back) then
|
||||
sFamily = 'Rabbet'
|
||||
bIsThrough = true
|
||||
-- birdsmouth
|
||||
elseif Proc.Fct == 2 and bAllAnglesConcave then
|
||||
sFamily = 'Groove'
|
||||
bIsThrough = true
|
||||
@@ -244,7 +224,7 @@ function FeatureTopology.Classify( Proc, b3Raw)
|
||||
end
|
||||
|
||||
-- verifico se facce parallele a quelle della trave
|
||||
local vFacesParallelToPart = GetFacesParallelToPart( Proc, sFamily, bIsThrough)
|
||||
local vFacesParallelToPart = GetFacesParallelToPart( Proc, sFamily)
|
||||
local bIsParallel = ( #vFacesParallelToPart == Proc.Fct)
|
||||
|
||||
-- assegnazioni
|
||||
@@ -254,6 +234,7 @@ function FeatureTopology.Classify( Proc, b3Raw)
|
||||
Proc.IsThrough = bIsThrough
|
||||
Proc.AllRightAngles = bAllRightAngles
|
||||
Proc.IsParallel = bIsParallel
|
||||
Proc.vAdj = vAdj
|
||||
return true
|
||||
else
|
||||
Proc.Topology = 'OTHER'
|
||||
|
||||
+118
-96
@@ -12,6 +12,8 @@
|
||||
-- 2024/01/19 In FindSawing aggiunto parametro opzionale bConsiderCSimmEncumberance per considerare l'ingombro dell'asse C nel massimo materiale (default false).
|
||||
-- 2024/01/23 Nella GetMachinings vengono ora raccolti i parametri utensile necessari per i VerifyTool, scritti direttamente nella tabella Machining.Tool.
|
||||
-- Le lavorazioni possono essere ora ordinate per dimensioni utensile (Longest, Shortest, Biggest, Smallest) se passato l'apposito parametro SortingCriterion in FindMachining. Al momento implementato solo per FindSawing.
|
||||
-- 2024/03/01 In VerifyPocketing implementato l'ordinamento per dimensioni utensile.
|
||||
-- 2024/03/13 Aggiunta gestione Predrill
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local MachiningLib = {}
|
||||
@@ -23,11 +25,14 @@ EgtOutLog( ' MachiningLib started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local Cuttings = require( 'CutData')
|
||||
local Millings = require( 'MillingData')
|
||||
local Pocketings = require( 'PocketingData')
|
||||
local Sawings = require( 'SawingData')
|
||||
local Drillings = require( 'DrillData')
|
||||
-- librerie lavorazioni caricate con pcall perchè potrebbero non esserci
|
||||
local Cuttings, Millings, Pocketings, Sawings, Drillings, Probing
|
||||
if pcall( require, 'CutData') then Cuttings = require( 'CutData') end
|
||||
if pcall( require, 'MillingData') then Millings = require( 'MillingData') end
|
||||
if pcall( require, 'PocketingData') then Pocketings = require( 'PocketingData') end
|
||||
if pcall( require, 'SawingData') then Sawings = require( 'SawingData') end
|
||||
if pcall( require, 'DrillData') then Drillings = require( 'DrillData') end
|
||||
if pcall( require, 'ProbingData') then Probing = require( 'ProbingData') end
|
||||
|
||||
-- tipo di teste macchina
|
||||
local ONE_HEAD = 1 -- una testa (Fast, One, Turn1T)
|
||||
@@ -72,40 +77,34 @@ local function SetCurrMachineHeadType()
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- funzione che conferma e rende attivi testa e utensile ipotizzati
|
||||
-- setta ultimi testa e utensile utilizzati se compatibili con ottimizzazione testa
|
||||
local function ConfirmNextMachining()
|
||||
-- se non definita testa successiva, esco
|
||||
if not nNextMachHead or nNextMachHead < 1 or nNextMachHead > 2 then return end
|
||||
-- altrimenti, la confermo come attiva
|
||||
nActiveHead = nNextMachHead
|
||||
if nNextMachHead == 1 then
|
||||
H1_TOOL = H1_NEXT_TOOL
|
||||
elseif nNextMachHead == 2 then
|
||||
H2_TOOL = H2_NEXT_TOOL
|
||||
-- utensile corrente
|
||||
local sToolUuid = EgtGetMachiningParam( MCH_MP.TUUID)
|
||||
local sToolName = EgtTdbGetToolFromUUID( sToolUuid or '')
|
||||
EgtTdbSetCurrTool( sToolName or '')
|
||||
-- testa dell'utensile corrente
|
||||
local sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
|
||||
local nHead = tonumber( sHead:sub( 2, #sHead)) + 0
|
||||
|
||||
if ( nHead < 10 and nHead >= 30) or vFixedHeads[nHead] then
|
||||
-- testa che non richiede ottimizzazione
|
||||
return
|
||||
elseif nHead >= 20 then
|
||||
nHead = 2
|
||||
elseif nHead >= 10 then
|
||||
nHead = 1
|
||||
end
|
||||
|
||||
-- se la testa richiede ottimizzazione, confermo testa attiva
|
||||
nActiveHead = nHead
|
||||
if nActiveHead == 1 then
|
||||
H1_TOOL = sToolName
|
||||
elseif nActiveHead == 2 then
|
||||
H2_TOOL = sToolName
|
||||
end
|
||||
-- reset prossima testa
|
||||
nNextMachHead = 0
|
||||
H1_NEXT_TOOL = ''
|
||||
H2_NEXT_TOOL = ''
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- funzione che traccia testa e utensile ipotizzati
|
||||
local function SetNextMachining( sToolName, nHead, bFixed)
|
||||
if nHead < 1 or nHead > 2 then return end
|
||||
if bFixed then
|
||||
nNextMachHead = 0
|
||||
H1_NEXT_TOOL = ''
|
||||
H2_NEXT_TOOL = ''
|
||||
end
|
||||
nNextMachHead = nHead
|
||||
if nHead == 1 then
|
||||
H1_NEXT_TOOL = sToolName
|
||||
elseif nHead == 2 then
|
||||
H2_NEXT_TOOL = sToolName
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function SetCurrMachiningAndTool( Machining)
|
||||
EgtMdbSetCurrMachining( Machining.Name)
|
||||
@@ -140,6 +139,7 @@ end
|
||||
---------------------------------------------------------------------
|
||||
function VerifyMill( Machining, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bH2)
|
||||
if ( not dDepth or Machining.Tool.MaxMat > dDepth - GEO.EPS_SMALL) and
|
||||
( Machining.Type ~= 'FloatingAggregate' or abs( Machining.Tool.MaxMat - dDepth) < 100 * GEO.EPS_SMALL) and
|
||||
( not sTuuidMstr or sTuuidMstr == Machining.Tool.UUID) and
|
||||
( not dMaxDiam or Machining.Tool.Diameter < dMaxDiam + GEO.EPS_SMALL) and
|
||||
( not dMaxTotLen or Machining.Tool.TotalLength < dMaxTotLen + GEO.EPS_SMALL) then
|
||||
@@ -168,13 +168,13 @@ end
|
||||
---------------------------------------------------------------------
|
||||
function VerifyTool( Machining, MachiningType, Params, bH2)
|
||||
if MachiningType == MCH_MY.DRILLING then
|
||||
if Machining.SubType == 'Drill' or Machining.SubType == 'AngleDrill' then
|
||||
if Machining.SubType == 'Drill' or Machining.SubType == 'AngleDrill' or Machining.SubType == 'Predrill' then
|
||||
return VerifyDrill( Machining, Params.Diam, Params.Depth, bH2)
|
||||
elseif Machining.SubType == 'DrillPocket' then
|
||||
return VerifyDrillPocket( Machining, Params.Diam, Params.Depth, bH2)
|
||||
end
|
||||
elseif MachiningType == MCH_MY.SAWING then
|
||||
return true, { H2 = bH2}
|
||||
return ( not Params.Depth or Machining.Tool.MaxMat > Params.Depth - GEO.EPS_SMALL), { H2 = bH2}
|
||||
elseif MachiningType == MCH_MY.MILLING then
|
||||
return VerifyMill( Machining, Params.Depth, Params.TuuidMstr, Params.MaxDiam, Params.MaxTotLen, bH2)
|
||||
elseif MachiningType == MCH_MY.POCKETING then
|
||||
@@ -188,18 +188,32 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function GetMachinings( MachiningType, sType)
|
||||
local Machinings
|
||||
local Machinings = {}
|
||||
-- leggo le lavorazioni disponibili
|
||||
if MachiningType == MCH_MY.DRILLING then
|
||||
Machinings = Drillings
|
||||
if Drillings and type( Drillings) == "table" then
|
||||
Machinings = Drillings
|
||||
end
|
||||
elseif MachiningType == MCH_MY.SAWING then
|
||||
Machinings = Cuttings
|
||||
if Cuttings and type( Cuttings) == "table" then
|
||||
Machinings = Cuttings
|
||||
end
|
||||
elseif MachiningType == MCH_MY.MILLING then
|
||||
Machinings = Millings
|
||||
if Millings and type( Millings) == "table" then
|
||||
Machinings = Millings
|
||||
end
|
||||
elseif MachiningType == MCH_MY.POCKETING then
|
||||
Machinings = Pocketings
|
||||
if Pocketings and type( Pocketings) == "table" then
|
||||
Machinings = Pocketings
|
||||
end
|
||||
elseif MachiningType == MCH_MY.MORTISING then
|
||||
Machinings = Sawings
|
||||
if Sawings and type( Sawings) == "table" then
|
||||
Machinings = Sawings
|
||||
end
|
||||
elseif MachiningType == MCH_MY.PROBING then
|
||||
if Probing and type( Probing) == "table" then
|
||||
Machinings = Probing
|
||||
end
|
||||
end
|
||||
-- scrivo i parametri utensile nella lavorazione
|
||||
local validMachinings = {}
|
||||
@@ -212,25 +226,34 @@ function GetMachinings( MachiningType, sType)
|
||||
if Machining.Tool.Name then
|
||||
if EgtTdbSetCurrTool( Machining.Tool.Name) then
|
||||
table.insert( validMachinings, Machining)
|
||||
if ( MachiningType == MCH_MY.MILLING) or ( MachiningType == MCH_MY.POCKETING) or ( MachiningType == MCH_MY.DRILLING and EgtStartsWith( sType, 'Pocket')) then
|
||||
Machining.Tool.MaxMat = EgtTdbGetCurrToolMaxDepth()
|
||||
else
|
||||
Machining.Tool.MaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
|
||||
end
|
||||
if MachiningType == MCH_MY.DRILLING then
|
||||
if EgtStartsWith( Machining.Type, 'Drill') then
|
||||
Machining.SubType = 'Drill'
|
||||
elseif EgtStartsWith( Machining.Type, 'AngleDrill') then
|
||||
Machining.SubType = 'AngleDrill'
|
||||
elseif EgtStartsWith( Machining.Type, 'Pocket') then
|
||||
Machining.SubType = 'DrillPocket'
|
||||
-- se non è tastatura, recupero dati utensile
|
||||
if MachiningType ~= MCH_MY.PROBING then
|
||||
-- caso speciale utensile su aggregato flottante
|
||||
if MachiningType == MCH_MY.MILLING and sType == 'FloatingAggregate' then
|
||||
local sNotes = EgtTdbGetCurrToolParam( MCH_TP.USERNOTES)
|
||||
Machining.Tool.MaxMat = EgtGetValInNotes( sNotes, 'TOOL_OVERHANG', 'd') or -1
|
||||
elseif ( MachiningType == MCH_MY.MILLING) or ( MachiningType == MCH_MY.POCKETING) or ( MachiningType == MCH_MY.DRILLING and EgtStartsWith( sType, 'Pocket')) then
|
||||
Machining.Tool.MaxMat = EgtTdbGetCurrToolMaxDepth()
|
||||
else
|
||||
Machining.Tool.MaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
|
||||
end
|
||||
if MachiningType == MCH_MY.DRILLING then
|
||||
if EgtStartsWith( Machining.Type, 'Drill') then
|
||||
Machining.SubType = 'Drill'
|
||||
elseif EgtStartsWith( Machining.Type, 'AngleDrill') then
|
||||
Machining.SubType = 'AngleDrill'
|
||||
elseif EgtStartsWith( Machining.Type, 'Pocket') then
|
||||
Machining.SubType = 'DrillPocket'
|
||||
elseif EgtStartsWith( Machining.Type, 'Predrill') then
|
||||
Machining.SubType = 'Predrill'
|
||||
end
|
||||
end
|
||||
Machining.Tool.Diameter = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
|
||||
Machining.Tool.Length = EgtTdbGetCurrToolParam( MCH_TP.LEN)
|
||||
Machining.Tool.TotalLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
|
||||
Machining.Tool.ToolHolderDiameter = EgtTdbGetCurrToolThDiam()
|
||||
Machining.Tool.ToolHolderLength = EgtTdbGetCurrToolThLength() or 72
|
||||
end
|
||||
Machining.Tool.Diameter = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
|
||||
Machining.Tool.Length = EgtTdbGetCurrToolParam( MCH_TP.LEN)
|
||||
Machining.Tool.TotalLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
|
||||
Machining.Tool.ToolHolderDiameter = EgtTdbGetCurrToolThDiam()
|
||||
Machining.Tool.ToolHolderLength = EgtTdbGetCurrToolThLength() or 72
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -299,7 +322,7 @@ end
|
||||
function ReturnParams( MachiningType, MachiningName, sType, ToolParams)
|
||||
if MachiningType == MCH_MY.DRILLING then
|
||||
local _, sOrigType = EgtEndsWith( sType, '_H2')
|
||||
return MachiningName, sType, EgtIf( sOrigType == 'Drill' or sOrigType == 'Drill_AT' or sOrigType == 'AngleDrill' , ToolParams.TMaxMat, ToolParams.TMaxDepth), ToolParams.MaxToolLength, ToolParams.ToolDiam, ToolParams.DiamTh, ToolParams.FreeLen
|
||||
return MachiningName, sType, EgtIf( sOrigType == 'Drill' or sOrigType == 'Drill_AT' or sOrigType == 'AngleDrill' or sOrigType == 'Predrill' , ToolParams.TMaxMat, ToolParams.TMaxDepth), ToolParams.MaxToolLength, ToolParams.ToolDiam, ToolParams.DiamTh, ToolParams.FreeLen
|
||||
elseif MachiningType == MCH_MY.SAWING then
|
||||
return MachiningName, ToolParams.H2
|
||||
elseif MachiningType == MCH_MY.MILLING then
|
||||
@@ -313,6 +336,7 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion)
|
||||
local bOptimizeHeads = ( not sSortingCriterion or sSortingCriterion == '')
|
||||
if bTopHead == nil and bDownHead == nil then
|
||||
bTopHead = true
|
||||
bDownHead = false
|
||||
@@ -344,24 +368,24 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead,
|
||||
local ForStart = 1
|
||||
local ForEnd = #Machinings
|
||||
local ForStep = 1
|
||||
-- le forature vanno scorse dal diametro maggiore al minore
|
||||
if MachiningType == MCH_MY.DRILLING then
|
||||
-- le forature vanno scorse dal diametro maggiore al minore, a meno che non sia stato passato un ordinamento specifico
|
||||
if MachiningType == MCH_MY.DRILLING and ( not sSortingCriterion or sSortingCriterion == '') then
|
||||
ForStart = #Machinings
|
||||
ForEnd = 1
|
||||
ForStep = -1
|
||||
end
|
||||
if ( BEAM and BEAM.BW) or MachineHeadType == ONE_HEAD or MachineHeadType == TWO_EQUAL_HEADS or ( MachineHeadType == TWO_UP_DOWN_HEADS and not bDownHead) then
|
||||
if bOptimizeHeads or MachineHeadType == ONE_HEAD or MachineHeadType == TWO_EQUAL_HEADS or ( MachineHeadType == TWO_UP_DOWN_HEADS and not bDownHead) then
|
||||
_, sType = EgtEndsWith( sType, '_H2')
|
||||
elseif ( not BEAM or not BEAM.BW) and MachineHeadType == TWO_UP_DOWN_HEADS and bDownHead then
|
||||
elseif not bOptimizeHeads and MachineHeadType == TWO_UP_DOWN_HEADS and not bTopHead and bDownHead then
|
||||
if not EgtEndsWith( sType, '_H2') then
|
||||
sType = sType .. '_H2'
|
||||
end
|
||||
end
|
||||
local MachineHeadUse = MachineHeadType
|
||||
if not BEAM or not BEAM.BW then
|
||||
if not bOptimizeHeads and MachineHeadUse == TWO_EQUAL_HEADS then
|
||||
MachineHeadUse = ONE_HEAD
|
||||
end
|
||||
if BEAM and BEAM.BW and MachineHeadUse == TWO_UP_DOWN_HEADS and bTopHead and bDownHead then
|
||||
if MachineHeadUse == TWO_UP_DOWN_HEADS and bTopHead and bDownHead then
|
||||
-- se posso usare entrambe le teste, la gestisco come una macchina a due teste da sopra
|
||||
MachineHeadUse = TWO_EQUAL_HEADS
|
||||
end
|
||||
@@ -370,7 +394,7 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead,
|
||||
for i = ForStart, ForEnd, ForStep do
|
||||
local Machining = Machinings[i]
|
||||
local sMachiningType = Machining.Type
|
||||
if BEAM and BEAM.BW then
|
||||
if bOptimizeHeads or MachineHeadUse == TWO_EQUAL_HEADS then
|
||||
_, sMachiningType = EgtEndsWith( Machining.Type, '_H2')
|
||||
end
|
||||
-- recupero dati utensile
|
||||
@@ -379,18 +403,15 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead,
|
||||
local bOk, ToolParams = VerifyTool( Machining, MachiningType, Params, bH2)
|
||||
if bOk then
|
||||
if MachineHeadUse == ONE_HEAD then
|
||||
SetNextMachining( sToolName, 1, bFixed)
|
||||
return ReturnParams(MachiningType, Machining.Name, Machining.Type, ToolParams)
|
||||
elseif MachineHeadUse == TWO_EQUAL_HEADS then
|
||||
-- se nessuna testa attiva, prendo la prima lavorazione disponibile
|
||||
if nActiveHead == 0 then
|
||||
SetNextMachining( sToolName, EgtIf( bH2, 2, 1), bFixed)
|
||||
return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams)
|
||||
-- verifico se posso usare lo stesso utensile della testa attiva
|
||||
elseif ( nActiveHead == 1 and not bH2 and sToolName == H1_TOOL) or ( nActiveHead == 2 and bH2 and sToolName == H2_TOOL) then
|
||||
-- se l'utensile sulla testa attiva è molto più piccolo rispetto a quelli salvati non lo scelgo
|
||||
if ( not sH1Param or not sH1Param.TDiam or sH1Param.TDiam < dBiggerToolTolerance * ToolParams.TDiam) and ( not sH2Param or not sH2Param.TDiam or sH2Param.TDiam < 1.25 * ToolParams.TDiam) then
|
||||
SetNextMachining( sToolName, nActiveHead, bFixed)
|
||||
-- se l'utensile sulla testa attiva è molto più piccolo rispetto a quelli salvati non lo scelgo, a meno che non siano entrambi grandi (truciolatori)
|
||||
if ( not sH1Param or not sH1Param.TDiam or ( sH1Param.TDiam < 75 and ToolParams.TDiam < 75 and sH1Param.TDiam < dBiggerToolTolerance * ToolParams.TDiam)) and ( not sH2Param or not sH2Param.TDiam or ( sH2Param.TDiam < 75 and ToolParams.TDiam < 75 and sH2Param.TDiam < 1.25 * ToolParams.TDiam)) then
|
||||
return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams)
|
||||
end
|
||||
end
|
||||
@@ -410,10 +431,8 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead,
|
||||
end
|
||||
elseif MachineHeadUse == TWO_UP_DOWN_HEADS then
|
||||
if bTopHead and not bH2 then
|
||||
SetNextMachining( sToolName, 1, bFixed)
|
||||
return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams)
|
||||
elseif bDownHead and bH2 then
|
||||
SetNextMachining( sToolName, 2, bFixed)
|
||||
return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams)
|
||||
end
|
||||
end
|
||||
@@ -421,55 +440,58 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead,
|
||||
end
|
||||
end
|
||||
if MachineHeadUse == TWO_EQUAL_HEADS then
|
||||
-- se uno dei due utensili è molto più grande dell'altro scelgo quello senza fare altre analisi
|
||||
-- se entrambi gli utensili sono piccoli (no truciolatori) e uno dei due è molto più grande dell'altro scelgo quello senza fare altre analisi
|
||||
if sH1Mach ~= "" and sH1Param.TDiam and sH2Mach ~= "" and sH2Param.TDiam then
|
||||
if sH1Param.TDiam > dBiggerToolTolerance * sH2Param.TDiam then
|
||||
SetNextMachining( sH1Tool, 1, bFixed)
|
||||
return ReturnParams( MachiningType, sH1Mach, sType, sH1Param)
|
||||
elseif sH2Param.TDiam > dBiggerToolTolerance * sH1Param.TDiam then
|
||||
SetNextMachining( sH2Tool, 2, bFixed)
|
||||
return ReturnParams( MachiningType, sH2Mach, sType, sH2Param)
|
||||
if sH1Param.TDiam < 75 or sH2Param.TDiam < 75 then
|
||||
if sH1Param.TDiam > dBiggerToolTolerance * sH2Param.TDiam then
|
||||
return ReturnParams( MachiningType, sH1Mach, sType, sH1Param)
|
||||
elseif sH2Param.TDiam > dBiggerToolTolerance * sH1Param.TDiam then
|
||||
return ReturnParams( MachiningType, sH2Mach, sType, sH2Param)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- verifico se cambiare testa o cambiare utensile su quella corrente
|
||||
if nActiveHead == 1 then
|
||||
if sH2Mach ~= "" then
|
||||
SetNextMachining( sH2Tool, 2, bFixed)
|
||||
return ReturnParams( MachiningType, sH2Mach, sType, sH2Param)
|
||||
--return sH2Mach, sH2Param.Type, sH2Param.TMaxMat, sH2Param.MaxToolLength, sH2Param.ToolDiam, sH2Param.DiamTh, sH2Param.FreeLen
|
||||
elseif sH1Mach ~= "" then
|
||||
SetNextMachining( sH1Tool, 1, bFixed)
|
||||
return ReturnParams( MachiningType, sH1Mach, sType, sH1Param)
|
||||
--return sH1Mach, sH1Param.Type, sH1Param.TMaxMat, sH1Param.MaxToolLength, sH1Param.ToolDiam, sH1Param.DiamTh, sH1Param.FreeLen
|
||||
end
|
||||
elseif nActiveHead == 2 then
|
||||
if sH1Mach ~= "" then
|
||||
SetNextMachining( sH1Tool, 1, bFixed)
|
||||
return ReturnParams( MachiningType, sH1Mach, sType, sH1Param)
|
||||
--return sH1Mach, sH1Param.Type, sH1Param.TMaxMat, sH1Param.MaxToolLength, sH1Param.ToolDiam, sH1Param.DiamTh, sH1Param.FreeLen
|
||||
elseif sH2Mach ~= "" then
|
||||
SetNextMachining( sH2Tool, 2, bFixed)
|
||||
return ReturnParams( MachiningType, sH2Mach, sType, sH2Param)
|
||||
--return sH2Mach, sH2Param.Type, sH2Param.TMaxMat, sH2Param.MaxToolLength, sH2Param.ToolDiam, sH2Param.DiamTh, sH2Param.FreeLen
|
||||
end
|
||||
end
|
||||
end
|
||||
local bH2, sOrigType = EgtEndsWith( sType, '_H2')
|
||||
if ( not BEAM or not BEAM.BW) and MachineHeadType == TWO_UP_DOWN_HEADS and bH2 and bTopHead then
|
||||
if not bOptimizeHeads and MachineHeadType == TWO_UP_DOWN_HEADS and bH2 and bTopHead then
|
||||
return FindMachining( MachiningType, sOrigType, Params, true, false)
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function MachiningLib.FindCutting( sType, bTopHead, bDownHead)
|
||||
return FindMachining( MCH_MY.SAWING, sType, nil, bTopHead, bDownHead)
|
||||
function MachiningLib.FindCutting( sType, bTopHead, bDownHead, dDepth, sSortingCriterion)
|
||||
return FindMachining( MCH_MY.SAWING, sType, { Depth = dDepth}, bTopHead, bDownHead, nil, nil, sSortingCriterion)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead, bExcludeH2, bAngleTransmission)
|
||||
local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, EgtIf( bAngleTransmission, 'Drill_AT', 'Drill'), { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead, bExcludeH2)
|
||||
function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead, bExcludeH2, bAngleTransmission, bIsPredrill, bExcludeH3, sSortingCriterion)
|
||||
local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5, sTypeMach
|
||||
-- se il foro è un predrill, cerco solo punte abilitate al Predrill
|
||||
if bIsPredrill then
|
||||
sTypeMach = 'Predrill'
|
||||
else
|
||||
sTypeMach = EgtIf( bAngleTransmission, 'Drill_AT', 'Drill')
|
||||
end
|
||||
MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, sTypeMach, { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion)
|
||||
if ( not MachiningName or MachiningName == '') then
|
||||
MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, EgtIf( bAngleTransmission, 'Pocket_AT', 'Pocket'), { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead)
|
||||
MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, EgtIf( bAngleTransmission, 'Pocket_AT', 'Pocket'), { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion)
|
||||
end
|
||||
if MachiningName and MachiningName ~= '' then
|
||||
return MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5
|
||||
@@ -485,13 +507,13 @@ function MachiningLib.FindAngleDrilling( dDiam, dDepth, bTopHead, bDownHead)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
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, bExcludeH2, bExcludeH3)
|
||||
function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion)
|
||||
return FindMachining( MCH_MY.MILLING, sType, { Depth = dDepth, TuuidMstr = sTuuidMstr, MaxDiam = dMaxDiam, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function MachiningLib.FindPocketing( sType, dMaxDiam, dDepth, dMaxTotLen, bTopHead, bDownHead, bExcludeH2, bExcludeH3)
|
||||
return FindMachining( MCH_MY.POCKETING, sType, { MaxDiam = dMaxDiam, Depth = dDepth, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead, bExcludeH2, bExcludeH3)
|
||||
function MachiningLib.FindPocketing( sType, dMaxDiam, dDepth, dMaxTotLen, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion)
|
||||
return FindMachining( MCH_MY.POCKETING, sType, { MaxDiam = dMaxDiam, Depth = dDepth, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
@@ -151,7 +151,8 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dO
|
||||
-- se va fatto, inserisco la lavorazione
|
||||
if bCut then
|
||||
local CutProc = { Id = AuxId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- se taglio applicato setto la nota al gruppo Mach per non doverla lavorare una seconda volta
|
||||
if bOk then
|
||||
@@ -242,7 +243,8 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dO
|
||||
-- se va fatto, inserisco la lavorazione
|
||||
if bCut then
|
||||
local CutProc = { Id = AuxId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- se taglio applicato setto la nota al gruppo Mach per non doverla lavorare una seconda volta
|
||||
if bOk then
|
||||
|
||||
+96
-42
@@ -25,6 +25,7 @@
|
||||
-- 2023/10/27 In MakeFromTop corretto massimo materiale in caso di lavorazione da sotto.
|
||||
-- 2023/12/07 Correzione in Classify in scelta ribaltamento trave quando si è in condizioni downUp.
|
||||
-- 2024/01/18 Gestita superficie limitante opzionale da passare a diceCut.
|
||||
-- 2024/05/10 In MakeFromTop ricalcolo direzione di lavorazione su facce a cubetti
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessCut = {}
|
||||
@@ -45,7 +46,14 @@ local ML = require( 'MachiningLib')
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
function ProcessCut.Identify( Proc)
|
||||
return ( ( Proc.Grp == 1 or Proc.Grp == 2) and Proc.Prc == 10)
|
||||
-- se richiesto si forza fresatura
|
||||
Proc.bForceMill = ( ( ( Proc.Grp == 1 or Proc.Grp == 2) and Proc.Prc == 10) and ( ( EgtGetInfo( Proc.Id, 'Q07', 'd') or 0) == 1))
|
||||
|
||||
if Proc.bForceMill then
|
||||
return false
|
||||
else
|
||||
return ( ( Proc.Grp == 1 or Proc.Grp == 2) and Proc.Prc == 10)
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
@@ -57,11 +65,14 @@ function ProcessCut.Classify( Proc, b3Raw)
|
||||
end
|
||||
-- recupero i dati del taglio
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
if vtN:getZ() <= - 0.5 and abs( vtN:getY()) > 0.1 or ( vtN:getZ() <= - 0.174 and abs( vtN:getY()) > 0.866) then
|
||||
-- calcolo le massime estensioni lineari orizzontale e verticale della faccia
|
||||
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
|
||||
-- calcolo le massime estensioni lineari orizzontale e verticale della faccia
|
||||
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
|
||||
if ( vtN:getZ() <= - 0.5 and abs( vtN:getY()) > 0.1) or
|
||||
( vtN:getZ() <= - 0.174 and abs( vtN:getY()) > 0.866) or
|
||||
( vtN:getZ() <= - 0.174 and abs( vtN:getZ()) * DimV > BD.MAX_DIM_DICE)
|
||||
then
|
||||
-- confronto queste estensioni con la massima dimensione del DiceCut (impossibile lavorare se entrambe maggiori)
|
||||
if DimH > BD.MAX_DIM_DICE and DimV > BD.MAX_DIM_DICE then
|
||||
if DimH > BD.MAX_DIM_DICE + 100 * GEO.EPS_SMALL and DimV > BD.MAX_DIM_DICE + 100 * GEO.EPS_SMALL then
|
||||
return true, true
|
||||
end
|
||||
end
|
||||
@@ -82,9 +93,9 @@ function ProcessCut.Classify( Proc, b3Raw)
|
||||
end
|
||||
end
|
||||
-- calcolo l'ingombro orizzontale della faccia
|
||||
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0)
|
||||
_, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0)
|
||||
-- confronto questo ingombro con il doppio della massima dimensione del DiceCut (impossibile lavorare sotto da sopra se più di 2 tagli oppure se tipo PF, taglio inclinato in Y e non taglio singolo orizzontale)
|
||||
if DimH > 2 * BD.MAX_DIM_DICE or ( BD.C_SIMM and abs( vtN:getY()) > 0.1 and dMaxMat < DimH + BD.CUT_EXTRA) then
|
||||
if DimH > 2 * BD.MAX_DIM_DICE or ( BD.C_SIMM and ( abs( vtN:getY()) > 0.1) and dMaxMat < DimH + BD.CUT_EXTRA) then
|
||||
return true, true
|
||||
end
|
||||
end
|
||||
@@ -253,7 +264,8 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione con testa da sopra
|
||||
local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, nLimitingSurf)
|
||||
local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, nLimitingSurf, sLeadInOutType)
|
||||
local sWarn
|
||||
-- ingombro del grezzo
|
||||
b3Raw = b3Raw or EgtGetRawPartBBox( nRawId)
|
||||
-- ingombro del pezzo
|
||||
@@ -264,9 +276,9 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN)
|
||||
local bDownCut = ( vtN:getZ() <= dNzLimDwnUp)
|
||||
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 BL.IsSplittedPartPhase( nPhase)) and not Proc.AdvTail and vtN:getX() < 0 and abs( vtN:getY()) < 0.259)
|
||||
end
|
||||
local dMinFeatureLengthForLongCut = 590.000
|
||||
local dMinFeatureLengthForLongCut = EgtIf( BD.C_SIMM, 590, 400)
|
||||
-- verifico se da considerare taglio lungo ( non da sotto, inclinato non più di 30deg, largo come la trave e abbastanza lungo)
|
||||
local bLongCut = ( not bDownCut and vtN:getZ() > 0.865 and
|
||||
Proc.Box:getDimY() > b3Solid:getDimY() - 10 * GEO.EPS_SMALL and
|
||||
@@ -365,10 +377,21 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
end
|
||||
-- verifico se necessari tagli supplementari o se presente superficie limitante
|
||||
EgtOutLog( string.format( 'MaxDepth=%.1f MaxVertDepth=%.1f CutH=%.1f CutV=%.1f', dMaxDepth, dMaxVertDepth, dCutH, dCutV), 3)
|
||||
-- se lungo, una faccia e rivolto sul retro verso l'alto si forzano i cubetti per evitare di rovinare il pezzo successivo
|
||||
local bForceDicing = ( Proc.Fct == 1 and Proc.AffectedFaces.Left and bLongCut and vtN:getZ() > 10 * GEO.EPS_SMALL and vtN:getY() < 10 * GEO.EPS_SMALL)
|
||||
local vCuts = {}
|
||||
if not Proc.AdvTail and ( dCutH > dMaxDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC or dCutV > dMaxVertDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC) then
|
||||
local dDicingOffsetP
|
||||
local dDicingOffsetO
|
||||
if ( ( not Proc.AdvTail) or bForceDicing) and
|
||||
( dCutH - 100 * GEO.EPS_SMALL > dMaxDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC or
|
||||
dCutV - 100 * GEO.EPS_SMALL > dMaxVertDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC) then
|
||||
local ptExtra, vtExtra
|
||||
local bAutoCalcSurf = true
|
||||
if Proc.AdvTail then
|
||||
-- do avviso che la lama può sbordare nel pezzo successivo
|
||||
sWarn = 'Warning : Cut machining can damage next piece'
|
||||
EgtOutLog( sWarn .. ' (process ' .. tostring( Proc.Id) .. ')')
|
||||
end
|
||||
if bFillAreaPiece or bFillTail then
|
||||
local ptMiddle = ( b3Solid:getMin() + b3Solid:getMax()) / 2
|
||||
ptExtra = Point3d( b3Solid:getMin():getX() + 5*GEO.EPS_SMALL, ptMiddle:getY(), ptMiddle:getZ())
|
||||
@@ -407,11 +430,11 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
end
|
||||
end
|
||||
-- se il taglio è più spesso della lama abilito il dicing, altrimenti no
|
||||
if dMaxElev > dSawThick then
|
||||
vCuts = DC.GetDice( nAddGrpId, EgtIf( bForced, b3Raw, b3Solid), ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, dNewDiceDim)
|
||||
if ( dMaxElev > dSawThick) or bForceDicing then
|
||||
vCuts, dDicingOffsetP = 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
|
||||
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, dDicingOffsetP = DC.GetDice( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, Proc.Box:getDimY())
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -479,7 +502,15 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
if vtO then
|
||||
vtOrthoO = Vector3d( vtO) * EgtIf( bOrthInv, -1, 1)
|
||||
else
|
||||
if bHorizCut then
|
||||
-- ricalcolo tipo taglio perché "bHorizCut" è calcolato sulla feature, mentre il cubetto potrebbe essere lavorato in un altro modo
|
||||
local _, dLen, dWidth = BL.GetFaceHvRefDim( vCuts[i][1], 0, b3Raw)
|
||||
local bCutDirection = bHorizCut
|
||||
-- se bisogna tagliare di fianco ma la lunghezza faccia è più del massimo materiale, forzo lavorazione da sopra
|
||||
if not bHorizCut and dLen > dMaxDepth then
|
||||
bCutDirection = true
|
||||
end
|
||||
|
||||
if bCutDirection then
|
||||
vtOrthoO = Z_AX()
|
||||
else
|
||||
if vtN:getZ() < dNzLimDwnUp then
|
||||
@@ -533,9 +564,14 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
local dVzLimDwnUp = dNzLimDwnUp
|
||||
if j ~= 1 then
|
||||
vtNewOrthoO = -vtOrthoO
|
||||
if not BD.C_SIMM and not BD.TURN and abs( vtN:getY()) > 0.05 then dVzLimDwnUp = -0.708 end
|
||||
if BD.GetNzLimDownUp then
|
||||
dVzLimDwnUp = BD.GetNzLimDownUp( b3Raw, vtN, V_NULL(), true)
|
||||
elseif not BD.C_SIMM and not BD.TURN and abs( vtN:getY()) > 0.05 then
|
||||
dVzLimDwnUp = -0.708
|
||||
end
|
||||
end
|
||||
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtNewOrthoO, dVzLimDwnUp, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
local bSpecialTangentLeadInOut = ( i % 2 == 0) and ( Proc.AffectedFaces.Left or Proc.AffectedFaces.Right)
|
||||
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtNewOrthoO, dVzLimDwnUp, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, 0, nil, b3Raw, nil, nil, bSpecialTangentLeadInOut)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
-- tutti gli altri casi vengono saltati
|
||||
@@ -557,8 +593,27 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
end
|
||||
end
|
||||
local dVzLimDwnUp = dNzLimDwnUp
|
||||
if not BD.C_SIMM and not BD.TURN and vtN:getZ() > 0.707 then dVzLimDwnUp = -0.708 end
|
||||
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, sNotes, b3Raw)
|
||||
if BD.GetNzLimDownUp then
|
||||
dVzLimDwnUp = BD.GetNzLimDownUp( b3Raw, vtN, V_NULL(), true)
|
||||
elseif not BD.C_SIMM and not BD.TURN and vtN:getZ() > 0.707 then
|
||||
dVzLimDwnUp = -0.708
|
||||
end
|
||||
local bSpecialTangentLeadInOut = ( i % 2 == 0) and ( Proc.AffectedFaces.Left or Proc.AffectedFaces.Right)
|
||||
local vtOrthoOAlternative
|
||||
if ( i % 2 == 0) and ( Proc.Fct == 1) and bNoPerpCuts then
|
||||
vtOrthoOAlternative = - vtOrthoO
|
||||
end
|
||||
local sLeadInOutTypeFbs = 'Calculated'
|
||||
if ( ( i % 2) ~= 0) then
|
||||
if ( sLeadInOutType == 'Tangent') then
|
||||
sLeadInOutTypeFbs = 'Tangent'
|
||||
elseif ( sLeadInOutType == 'Perpendicular') then
|
||||
sLeadInOutTypeFbs = 'Perpendicular'
|
||||
elseif ( sLeadInOutType == 'PerpendicularOutraw') then
|
||||
sLeadInOutTypeFbs = 'PerpendicularOutraw'
|
||||
end
|
||||
end
|
||||
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, sNotes, b3Raw, nil, nil, bSpecialTangentLeadInOut, sLeadInOutTypeFbs, vtOrthoOAlternative, dDicingOffsetP)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
end
|
||||
@@ -577,7 +632,8 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
local vtOrthoO
|
||||
if bFromBottom and dCutV < dMaxDepth - BD.CUT_EXTRA and vtN:getZ() > 0 then
|
||||
vtOrthoO = -Z_AX()
|
||||
elseif bHorizCut and ( not bVertCutOk or b3Solid:getDimX() > BD.LEN_SHORT_PART or Proc.AdvTail or ( vtN:getX() > 0 and vtN:getZ() <= 0.708) or ( abs( vtN:getY()) < 0.1 and vtN:getZ() <= 0)) then
|
||||
elseif ( bHorizCut and not bVertCutOk) 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()
|
||||
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
|
||||
@@ -610,7 +666,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
return true
|
||||
return true, sWarn
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
@@ -740,14 +796,16 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
-- taglio perpendicolare (limite Vz Down Up messo a -2 per non farlo mai intervenire)
|
||||
if vCuts[i][j] then
|
||||
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO_1, -2, dExtraCut_1, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
local bSpecialTangentLeadInOut = ( i % 2 == 0) and ( Proc.AffectedFaces.Left or Proc.AffectedFaces.Right)
|
||||
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO_1, -2, dExtraCut_1, BD.CUT_SIC, 0, 0, 0, nil, b3Raw, nil, nil, bSpecialTangentLeadInOut)
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
end
|
||||
-- taglio parallelo (limite Vz Down Up messo a -2 per non farlo mai intervenire)
|
||||
if vCuts[i+1][j] then
|
||||
local bOk, sErr = Fbs.MakeOne( vCuts[i+1][j], 0, sCutting, dSawDiam, vtOrthoO_2, -2, dExtraCut_2, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
local bSpecialTangentLeadInOut = ( i % 2 == 0) and ( Proc.AffectedFaces.Left or Proc.AffectedFaces.Right)
|
||||
local bOk, sErr = Fbs.MakeOne( vCuts[i+1][j], 0, sCutting, dSawDiam, vtOrthoO_2, -2, dExtraCut_2, BD.CUT_SIC, 0, 0, 0, nil, b3Raw, nil, nil, bSpecialTangentLeadInOut)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
end
|
||||
@@ -796,7 +854,7 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, dOvmTail, bUpdateIng, nLimitingSurf)
|
||||
function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, dOvmTail, bUpdateIng, nLimitingSurf, sLeadInOutType)
|
||||
-- sovramateriale di coda
|
||||
dOvmTail = dOvmTail or BD.OVM_MID
|
||||
-- ingombro del grezzo
|
||||
@@ -812,20 +870,7 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom,
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
-- se taglio di testa
|
||||
if not bForced then
|
||||
if Proc.Head then
|
||||
-- se coincide con il taglio di separazione precedente, non va fatto
|
||||
if AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Raw:getMax():getX() + dOvmHead) < 10 * GEO.EPS_SMALL then
|
||||
return true
|
||||
end
|
||||
-- altrimenti taglio di coda
|
||||
else
|
||||
-- se coincide con taglio di separazione, non va fatto
|
||||
if AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
|
||||
return true
|
||||
end
|
||||
end
|
||||
-- se coincide con un taglio frontale non va fatto
|
||||
if Proc.CutFront then
|
||||
if not BL.IsCutNeeded( Proc, b3Raw, dOvmHead, dOvmTail) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
@@ -846,22 +891,31 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom,
|
||||
return false, sErr
|
||||
end
|
||||
local bNoDicing = false
|
||||
local sWarn
|
||||
-- se taglio con testa da sopra
|
||||
if not bDownHead and not bDownTurn then
|
||||
local bOk, sErr, bNoDicing2 = MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, nLimitingSurf)
|
||||
local bOk, sErr, bNoDicing2 = MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, nLimitingSurf, sLeadInOutType)
|
||||
bNoDicing = bNoDicing2
|
||||
if not bOk then return false, sErr end
|
||||
if not bOk then
|
||||
return false, sErr
|
||||
else
|
||||
sWarn = sErr
|
||||
end
|
||||
-- altrimenti taglio con testa da sotto
|
||||
else
|
||||
local bOk, sErr = MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if not bOk then return false, sErr end
|
||||
if not bOk then
|
||||
return false, sErr
|
||||
else
|
||||
sWarn = sErr
|
||||
end
|
||||
end
|
||||
-- Aggiornamento ingombro (se vero taglio o richiesto)
|
||||
-- Se lascio il cordolo (bNoDicing) non aggiorno il grezzo perchè lo scarto rimane attaccato
|
||||
if ( ProcessCut.Identify( Proc) or bUpdateIng) and not bNoDicing then
|
||||
UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
|
||||
end
|
||||
return true
|
||||
return true, sWarn
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
@@ -475,13 +475,36 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- dati delle facce
|
||||
local ptC = {}
|
||||
local vtN = {}
|
||||
ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
|
||||
local idFirstFace, idSecondFace
|
||||
|
||||
-- se ci sono più di due face (caso insolito), si prendono le facce più grandi
|
||||
if Proc.Fct > 2 then
|
||||
local Area = {}
|
||||
-- si prendono le due più grandi, potrebbero essercene più di due
|
||||
for i = 1, Proc.Fct do
|
||||
local _, dL, dW = EgtSurfTmFacetMinAreaRectangle( Proc.Id, i - 1)
|
||||
table.insert( Area, { nIndex = i-1, dArea = dL*dW})
|
||||
end
|
||||
-- ordina 'Area' in ordine decrescente
|
||||
table.sort( Area, function( A, B)
|
||||
return A.dArea > B.dArea
|
||||
end
|
||||
)
|
||||
idFirstFace = Area[1].nIndex
|
||||
idSecondFace = Area[2].nIndex
|
||||
else
|
||||
idFirstFace = 0
|
||||
idSecondFace = 1
|
||||
end
|
||||
|
||||
ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, idFirstFace, GDB_ID.ROOT)
|
||||
ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, idSecondFace, GDB_ID.ROOT)
|
||||
|
||||
-- normale media per capire se taglio di testa o di coda
|
||||
local vtNm = ( vtN[1] + vtN[2]) ; vtNm:normalize()
|
||||
local bHead = ( vtNm:getX() > 0)
|
||||
-- angolo diedro per stabilire se taglio convesso
|
||||
local bAdj, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT)
|
||||
local bAdj, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, idFirstFace, idSecondFace, GDB_ID.ROOT)
|
||||
local bConvex = true
|
||||
local bOnY = true
|
||||
local ptPs = ( ptC[1] + ptC[2]) / 2
|
||||
@@ -492,8 +515,8 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
bConvex = ( dAng > 0)
|
||||
end
|
||||
-- determino quale faccia è più grande
|
||||
local _, dB1, dH1 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0)
|
||||
local _, dB2, dH2 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 1)
|
||||
local _, dB1, dH1 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, idFirstFace)
|
||||
local _, dB2, dH2 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, idSecondFace)
|
||||
local nBigInd = EgtIf( dB1 * dH1 >= dB2 * dH2, 1, 2)
|
||||
local nSmaInd = 3 - nBigInd
|
||||
-- inserimento smussi
|
||||
@@ -521,7 +544,8 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local b3Add = EgtGetBBoxGlob( AddId, GDB_BB.STANDARD)
|
||||
-- applico lavorazione
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Add, Fct = 1, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, nil, nil, bForced, b3Raw, sNotes, dOvmTail, true)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
@@ -533,7 +557,8 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local b3Add = EgtGetBBoxGlob( AddId, GDB_BB.STANDARD)
|
||||
-- applico lavorazione
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Add, Fct = 1, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, nil, nil, bForced, b3Raw, sNotes, dOvmTail, true)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
@@ -558,8 +583,8 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
end
|
||||
local _, _, dDimV1 = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
|
||||
local _, _, dDimV2 = BL.GetFaceHvRefDim( Proc.Id, 1, b3Raw)
|
||||
local _, _, dDimV1 = BL.GetFaceHvRefDim( Proc.Id, idFirstFace, b3Raw)
|
||||
local _, _, dDimV2 = BL.GetFaceHvRefDim( Proc.Id, idSecondFace, b3Raw)
|
||||
local bFace1TooLongForBlade, bFace2TooLongForBlade = ( dDimV1 >= dMaxDepth), ( dDimV2 >= dMaxDepth)
|
||||
local dFace1Ang, dFace2Ang = vtN[1]:getZ(), vtN[2]:getZ()
|
||||
if bFace1TooLongForBlade and dFace1Ang < ( BD.CUT_VZ_MIN or -0.484) or bFace2TooLongForBlade and dFace2Ang < ( BD.CUT_VZ_MIN or -0.484) then
|
||||
|
||||
@@ -1190,14 +1190,14 @@ local function Make2Faces( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
|
||||
return MakeByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid)
|
||||
-- altrimenti provo con il truciolatore
|
||||
else
|
||||
local sName = 'Mill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
-- se non ho la lavorazione esco
|
||||
if not sMilling then
|
||||
local sErr = 'Error, machining or tool not found ' .. sName .. '-' .. sMilling
|
||||
local sErr = 'Error, machining or tool not found ' .. sName
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- inserisco la lavorazione di fresatura
|
||||
local sName = 'Mill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchFId = EgtAddMachining( sName, sMilling)
|
||||
if not nMchFId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
@@ -1433,7 +1433,8 @@ local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
|
||||
return true
|
||||
end
|
||||
-- inserisco la lavorazione
|
||||
local CutProc = { Id = AuxId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, Head = Proc.Head, Tail = Proc.Tail}
|
||||
local CutProc = { Id = AuxId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, Head = Proc.Head, Tail = Proc.Tail, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if not bOk then return bOk, sErr end
|
||||
-- imposto la nota nel gruppo aggiuntivo di lavorazione per evitare di tagliare una seconda volta
|
||||
|
||||
+154
-17
@@ -20,6 +20,10 @@
|
||||
-- 2023/07/28 Aggiunta gestione rinvio 90deg solo per forature da sotto esattamente verticali.
|
||||
-- 2023/09/26 Se errore in applicazione lavorazione si inverte e riprova solo se foratura singola su foro aperto.
|
||||
-- 2023/11/06 Migliorata gestione dei fori con AngularTransmission.
|
||||
-- 2024/03/13 Aggiunta gestione Predrill
|
||||
-- 2024/03/18 Per Predrill corretta direzione estrusione per fori con direzione verso il basso
|
||||
-- 2024/09/04 Gestione dipendenza foro-tasca in caso di fase con pezzo ribaltato
|
||||
-- 2024/09/10 In GetData corretta gestione modifica diametro foro
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessDrill = {}
|
||||
@@ -96,20 +100,22 @@ end
|
||||
---------------------------------------------------------------------
|
||||
-- Recupero dati foro e adattamento se speciale
|
||||
function ProcessDrill.GetData( Proc, b3Raw)
|
||||
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
|
||||
-- verifico se foro da adattare
|
||||
if EgtExistsInfo( Proc.Id, 'DiamUser') then
|
||||
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
|
||||
if AuxId then AuxId = AuxId + Proc.Id end
|
||||
if AuxId and EgtGetType( AuxId) == GDB_TY.CRV_ARC and BD.USER_HOLE_DIAM and BD.USER_HOLE_DIAM > 1 then
|
||||
EgtModifyArcRadius( AuxId, BD.USER_HOLE_DIAM / 2)
|
||||
local nNewAuxId
|
||||
if AuxId then nNewAuxId = AuxId + Proc.Id end
|
||||
if AuxId and EgtGetType( nNewAuxId) == GDB_TY.CRV_ARC and BD.USER_HOLE_DIAM and BD.USER_HOLE_DIAM > 1 then
|
||||
EgtModifyArcRadius( nNewAuxId, BD.USER_HOLE_DIAM / 2)
|
||||
end
|
||||
end
|
||||
-- recupero diametro
|
||||
-- recupero diametro e lunghezza
|
||||
local dDiam = EgtGetInfo( Proc.Id, 'P12', 'd') or 0
|
||||
local dLen = abs( EgtCurveThickness( Proc.Id + AuxId)) or 0
|
||||
-- recupero faccia di entrata e uscita
|
||||
local nFcs = EgtGetInfo( Proc.Id, 'FCS', 'i') or 0
|
||||
local nFce = EgtGetInfo( Proc.Id, 'FCE', 'i') or 0
|
||||
return dDiam, nFcs, nFce
|
||||
return dDiam, dLen, nFcs, nFce
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
@@ -139,9 +145,79 @@ function ProcessDrill.Split( Proc, b3Raw)
|
||||
return ( bOpen and ( bHoriz or BD.ROT90 or BD.DOWN_HEAD or BD.TURN or bAngTransm) and not bSlant)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Verifica se bisogna aggiungere un preforo
|
||||
function ProcessDrill.IsPredrillNeeded( Proc)
|
||||
local dDepthPredrill = EgtGetInfo( Proc.Id, 'Q03', 'i')
|
||||
-- se non c'è la Q oppure se zero, allora non è da fare
|
||||
if not dDepthPredrill or dDepthPredrill <= 0 then
|
||||
return false
|
||||
-- altrimenti Predrill da fare
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Aggiunge il preforo alla feature passata
|
||||
function ProcessDrill.AddPredrillFromDrillProc( Proc)
|
||||
local dDepthPredrill = EgtGetInfo( Proc.Id, 'Q03', 'i')
|
||||
-- foro più corto del preforo, allora è il foro che diventa il preforo stesso
|
||||
if Proc.Len <= dDepthPredrill then
|
||||
Proc.IsPredrill = true
|
||||
Proc.IsPredrillOf = Proc.Id
|
||||
return false
|
||||
-- altrimenti creo un nuovo process
|
||||
else
|
||||
-- recupero gruppo per geometria aggiuntiva
|
||||
local nAddGrpId = BL.GetAddGroup( Proc.PartId)
|
||||
-- recupero e verifico l'entità foro
|
||||
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
|
||||
local ptCen = EgtCP( Proc.Id + AuxId, GDB_RT.GLOB)
|
||||
local vtExtr = EgtCurveExtrusion( Proc.Id + AuxId, GDB_RT.GLOB)
|
||||
|
||||
-- copio foro originale
|
||||
local nPreHoleId = EgtCopyGlob( Proc.Id, nAddGrpId)
|
||||
local nPreHoleAux = EgtCopyGlob( Proc.Id + AuxId, nAddGrpId)
|
||||
|
||||
-- se foro invertito sposto geometria dall'altro lato del foro e inverto direzione estrusione
|
||||
if Proc.Flg == -2 then
|
||||
local vsExtr = -vtExtr * Proc.Len
|
||||
EgtMove( nPreHoleAux, vsExtr, GDB_RT.GLOB)
|
||||
EgtModifyCurveExtrusion( nPreHoleAux, -vtExtr, GDB_RT.GLOB)
|
||||
end
|
||||
EgtModifyCurveThickness( nPreHoleAux, -dDepthPredrill)
|
||||
|
||||
local PredrillProc = {}
|
||||
-- definisco dati seconda parte
|
||||
PredrillProc.PartId = Proc.PartId
|
||||
PredrillProc.Id = nPreHoleId
|
||||
PredrillProc.Grp = Proc.Grp
|
||||
PredrillProc.Prc = Proc.Prc
|
||||
PredrillProc.Flg = 1
|
||||
PredrillProc.Box = Proc.Box
|
||||
PredrillProc.Fct = Proc.Fct
|
||||
PredrillProc.Diam = Proc.Diam
|
||||
PredrillProc.Len = dDepthPredrill
|
||||
PredrillProc.Head = Proc.Head
|
||||
PredrillProc.Tail = Proc.Tail
|
||||
PredrillProc.Fcs = Proc.Fcs
|
||||
PredrillProc.Fce = 0 -- il preforo è sempre chiuso, non ha faccia di uscita
|
||||
PredrillProc.CutId = Proc.CutId
|
||||
PredrillProc.TaskId = Proc.TaskId
|
||||
PredrillProc.AdjId = Proc.AdjId
|
||||
PredrillProc.MainId = Proc.MainId
|
||||
PredrillProc.IsPredrill = true
|
||||
PredrillProc.IsPredrillOf = Proc.Id
|
||||
-- recupero l'elenco delle facce della parte interessate dalla feature
|
||||
PredrillProc.AffectedFaces = BL.GetProcessAffectedFaces( PredrillProc)
|
||||
return true, PredrillProc
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Classificazione della feature
|
||||
function ProcessDrill.Classify( Proc, b3Raw)
|
||||
function ProcessDrill.Classify( Proc, b3Raw, sDownOrSideOrStd)
|
||||
-- recupero e verifico l'entità foro
|
||||
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
|
||||
if AuxId then AuxId = AuxId + Proc.Id end
|
||||
@@ -171,6 +247,23 @@ function ProcessDrill.Classify( Proc, b3Raw)
|
||||
local bOpen = ( Proc.Fce ~= 0)
|
||||
local bFaceDown = ( ptCen:getZ() < b3Raw:getMin():getZ() + 2 and (( not Proc.Head and not Proc.Tail) or (( BD.ROT90 or BD.DOWN_HEAD or BD.TURN) and abs( Proc.Flg) == 2)))
|
||||
local bAngTransm = ( BD.ANG_TRASM and ML.FindDrilling( dDiam, nil, nil, nil, nil, true) and AreSameOrOppositeVectorApprox( vtExtr, Z_AX()))
|
||||
|
||||
-- se ci sono delle dipendenze da altre feature da rispettare
|
||||
if sDownOrSideOrStd then
|
||||
if sDownOrSideOrStd == 'DOWN' then
|
||||
-- se foro fatto in doppio entrambe le forature (valore assoluto) devono essere sopra al valore limite, se foro singolo deve essere sopra al valore limite se ribaltato
|
||||
if ( abs( Proc.Flg) == 2 and ( abs( vtExtr:getZ()) < - BD.DRILL_VZ_MIN) or ( abs( Proc.Flg) ~= 2 and vtExtr:getZ() < - BD.DRILL_VZ_MIN)) then
|
||||
-- in doppio non cambio di fase al foro perchè devo garantire il lato master su H1
|
||||
if not( Proc.Double) or Proc.Double == 0 then
|
||||
Proc.Down = true
|
||||
Proc.Side = false
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- verifico se il foro è sotto e quindi va spostato o sopra o sul fianco
|
||||
if (( vtExtr:getZ() < BD.DRILL_VZ_MIN or bFaceDown) and ( not bOpen or Proc.Flg ~= 1)) then
|
||||
if not bOpen then
|
||||
@@ -289,15 +382,34 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
||||
local bDrillUp = ( bDownDrill and vtExtr:getZ() > -0.421)
|
||||
local bExcludeH2 = false
|
||||
if Proc.Double and Proc.Double > 0 then
|
||||
bMillUp = true
|
||||
-- bMillUp = true
|
||||
bDrillDown = false
|
||||
bExcludeH2 = true
|
||||
end
|
||||
-- primo gruppo di controlli con lunghezza utensile pari a metà foro se passante
|
||||
-- recupero la lavorazione
|
||||
local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm)
|
||||
local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm, Proc.IsPredrill)
|
||||
|
||||
if sDrilling then
|
||||
-- Determino la faccia di inizio del foro e dati correlati
|
||||
local nFac, CosB, vFaces = GetHoleStartData( ptCen, vtExtr, b3Solid)
|
||||
-- Calcolo acciorciamento affondamento utile per evitare collisione portautensile con faccia
|
||||
local TgA = CosB / sqrt( 1 - CosB * CosB)
|
||||
local dSubL = ( dDiamTh / 2 + ( Proc.Diam - dToolDiam) / 2 + 4) * TgA
|
||||
-- Per fori molto inclinati ( < 30 gradi) si usa la testa della macchina per l'accorciamento. Fast esclusa
|
||||
if BD.C_SIMM and CosB > 0.866 then
|
||||
dSubL = ( 190 / 2 + ( Proc.Diam - dToolDiam) / 2 + 4) * TgA - 116
|
||||
end
|
||||
local dMaxDepthOri = dMaxDepth
|
||||
dMaxDepth = min( dMaxDepth, max( dToolFreeLen - dSubL, 0))
|
||||
-- se utensile scelto non arriva in fondo, cerco il più lungo
|
||||
if dMaxDepth < GEO.EPS_SMALL * 10 then
|
||||
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm, Proc.IsPredrill, nil, 'Longest')
|
||||
end
|
||||
end
|
||||
|
||||
if not sDrilling and dCheckDepth then
|
||||
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm)
|
||||
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm, Proc.IsPredrill)
|
||||
if sDrilling then dCheckDepth = nil end
|
||||
end
|
||||
if not sDrilling then
|
||||
@@ -390,19 +502,42 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- eventuale inversione foro in base al lato di lavoro e al lato testa dell'utensile scelto
|
||||
-- se non già richiesta inversione e foro quasi orizzontale (15deg) passante
|
||||
if not bToInvert and Proc.Flg == 1 and bOpen and abs( vtExtr:getZ()) < 0.259 and abs( vtExtr:getY()) > 0.966 then
|
||||
local Tool = BL.GetToolFromMachining( sDrilling)
|
||||
-- lato testa e lato di lavoro devono corrispondere
|
||||
if ( ( Tool.PreferredSide.bFront == true) and vtExtr:getY() > 10 * GEO.EPS_SMALL)
|
||||
or ( ( Tool.PreferredSide.bBack == true) and vtExtr:getY() < - 10 * GEO.EPS_SMALL) then
|
||||
ptCen = ptCen - vtExtr * dLen
|
||||
vtExtr = - vtExtr
|
||||
bToInvert = true
|
||||
end
|
||||
end
|
||||
-- Determino la faccia di inizio del foro e dati correlati
|
||||
local nFac, CosB, vFaces = GetHoleStartData( ptCen, vtExtr, b3Solid)
|
||||
nFac, CosB, vFaces = GetHoleStartData( ptCen, vtExtr, b3Solid)
|
||||
-- Calcolo acciorciamento affondamento utile per evitare collisione portautensile con faccia
|
||||
local TgA = CosB / sqrt( 1 - CosB * CosB)
|
||||
local dSubL = ( dDiamTh / 2 + ( Proc.Diam - dToolDiam) / 2 + 4) * TgA
|
||||
TgA = CosB / sqrt( 1 - CosB * CosB)
|
||||
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
|
||||
dMaxDepthOri = dMaxDepth
|
||||
dMaxDepth = min( dMaxDepth, max( dToolFreeLen - dSubL, 0))
|
||||
-- Verifico inclinazione foro nei limiti
|
||||
local bTryDrill = EgtIf( dMaxDepth > 0, ( CosB < BD.DRILL_VX_MAX), false)
|
||||
-- se il foro deve essere eseguito dopo un taglio, potrebbe essere perchè il taglio crea una superficie perpendicolare
|
||||
if Proc.Dependency and Proc.Dependency.ExecAfter then
|
||||
local ptCut, vtCutN = EgtSurfTmFacetCenter( Proc.Dependency.ExecAfter.Id, 0, GDB_ID.ROOT)
|
||||
local dMaxAngleDrillOnCut = BD.MAX_ANGLE_DRILL_CUT or 10
|
||||
local dAngle = GetAngle( vtExtr, vtCutN)
|
||||
CosB = cos( dAngle)
|
||||
if dAngle < dMaxAngleDrillOnCut then
|
||||
-- controllo di essere nei limiti
|
||||
bTryDrill = true
|
||||
end
|
||||
end
|
||||
if ( CosB > 0.8 * BD.DRILL_VX_MAX and CosB < BD.DRILL_VX_MAX_ANGLEDRILL) then
|
||||
-- cerco le forature speciali AngleDrill
|
||||
local sDrilling3, sType3, dMaxDepth3 = ML.FindAngleDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown)
|
||||
@@ -422,7 +557,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
||||
if bIntersectionOk then
|
||||
local dHoleToCutDistance = vDistance[1]
|
||||
-- se il taglio accorcia realmente il foro
|
||||
if dHoleToCutDistance > 10 * GEO.EPS_SMALL and dHoleToCutDistance < dLen then
|
||||
if ( dHoleToCutDistance > 10 * GEO.EPS_SMALL or Proc.AffectedFaces.Right) and dHoleToCutDistance < dLen then
|
||||
dMaxDepth = dMaxDepthOri
|
||||
dMaxElev = dLen - dHoleToCutDistance
|
||||
bTryDrill = true
|
||||
@@ -454,7 +589,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
||||
dMaxElev = dMaxDepth
|
||||
end
|
||||
-- inserisco la lavorazione
|
||||
local sName = 'Drill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local sName = EgtIf( EgtStartsWith( sType, 'Predrill'), 'Predrill_', 'Drill_') .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchId = EgtAddMachining( sName, sDrilling)
|
||||
if not nMchId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sDrilling
|
||||
@@ -464,7 +599,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
-- eventuale inversione
|
||||
if sType == 'Drill' or sType == 'Drill_H2' or sType == 'Drill_AT' or sType == 'AngleDrill' then
|
||||
if sType == 'Drill' or sType == 'Drill_H2' or sType == 'Drill_AT' or sType == 'AngleDrill' or sType == 'Predrill' then
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, bToInvert)
|
||||
else
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, bToInvert)
|
||||
@@ -473,6 +608,8 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
||||
local nSCC = MCH_SCC.NONE
|
||||
if bDrillAngTrasm then
|
||||
nSCC = MCH_SCC.ADIR_NEAR
|
||||
elseif BD.TURN == 2 then
|
||||
nSCC = MCH_SCC.ADIR_ZP
|
||||
elseif not BD.C_SIMM and not BD.TURN then
|
||||
nSCC = MCH_SCC.ADIR_YM
|
||||
if AreSameVectorApprox( vtExtr, Z_AX()) then
|
||||
|
||||
+260
-99
@@ -20,6 +20,7 @@ local ProcessDtMortise = {}
|
||||
require( 'EgtBase')
|
||||
local BL = require( 'BeamLib')
|
||||
local Cut = require( 'ProcessCut')
|
||||
local Probe = require( 'ProcessProbing')
|
||||
|
||||
EgtOutLog( ' ProcessDtMortise started', 1)
|
||||
|
||||
@@ -50,6 +51,23 @@ function ProcessDtMortise.FrontIdentify( Proc)
|
||||
return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 56)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature profonda, non sulla faccia della trave
|
||||
function ProcessDtMortise.IsDeeper( Proc, b3Raw)
|
||||
-- recupero i dati della curva di contorno della faccia di fondo
|
||||
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
|
||||
if not AuxId then return false end
|
||||
AuxId = AuxId + Proc.Id
|
||||
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
||||
if ( AreSameVectorApprox( vtExtr, -Y_AX()) and Proc.Box:getMin():getY() > b3Raw:getMin():getY() + 100 * GEO.EPS_SMALL) or
|
||||
( AreSameVectorApprox( vtExtr, Y_AX()) and Proc.Box:getMax():getY() < b3Raw:getMax():getY() - 100 * GEO.EPS_SMALL) or
|
||||
( AreSameVectorApprox( vtExtr, -Z_AX()) and Proc.Box:getMin():getZ() > b3Raw:getMin():getZ() + 100 * GEO.EPS_SMALL) or
|
||||
( AreSameVectorApprox( vtExtr, Z_AX()) and Proc.Box:getMax():getZ() < b3Raw:getMax():getZ() - 100 * GEO.EPS_SMALL) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Verifica se feature di coda
|
||||
function ProcessDtMortise.IsTailFeature( Proc, b3Raw)
|
||||
@@ -103,7 +121,7 @@ function ProcessDtMortise.GetCutPlane( Proc)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function CalcTopPath( nProcId, AuxId, nAddGrpId, dAltMort, dSideAng, b3Solid)
|
||||
local function CalcPathAtHeight( nProcId, AuxId, nAddGrpId, dHeight, dSideAng, b3Solid)
|
||||
-- copio la curva di base
|
||||
local NewAuxId = EgtCopyGlob( AuxId, nAddGrpId)
|
||||
if not NewAuxId then return end
|
||||
@@ -111,16 +129,16 @@ local function CalcTopPath( nProcId, AuxId, nAddGrpId, dAltMort, dSideAng, b3Sol
|
||||
EgtAddCurveCompoLineTg( NewAuxId, 100, false)
|
||||
EgtAddCurveCompoLineTg( NewAuxId, 100, true)
|
||||
EgtMergeCurvesInCurveCompo( NewAuxId)
|
||||
-- eseguo traslazione e offset per portarla sul top
|
||||
local vtMove = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) * ( dAltMort - 10 * GEO.EPS_SMALL)
|
||||
EgtMove( NewAuxId, vtMove, GDB_RT.GLOB)
|
||||
local dOffset = dAltMort * tan( dSideAng)
|
||||
local dOffset = dHeight * tan( dSideAng)
|
||||
if not EgtOffsetCurve( NewAuxId, dOffset) then return end
|
||||
-- la limito entro la trave
|
||||
local refBox = Frame3d( b3Solid:getMin())
|
||||
local vtBoxDiag = b3Solid:getMax() - b3Solid:getMin()
|
||||
local nCount
|
||||
NewAuxId, nCount = EgtTrimFlatCurveWithBox( NewAuxId, refBox, vtBoxDiag, true, true, GDB_RT.GLOB)
|
||||
-- eseguo traslazione e offset per portarla sul top
|
||||
local vtMove = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) * ( dHeight - 10 * GEO.EPS_SMALL)
|
||||
EgtMove( NewAuxId, vtMove, GDB_RT.GLOB)
|
||||
-- se divisa in più parti, le unisco congiungendole con segmenti
|
||||
if nCount > 1 then
|
||||
if EgtGetType( NewAuxId) ~= GDB_TY.CRV_COMPO then
|
||||
@@ -136,6 +154,23 @@ local function CalcTopPath( nProcId, AuxId, nAddGrpId, dAltMort, dSideAng, b3Sol
|
||||
return NewAuxId
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function GetVerticalSteps( dMachiningDepth, dStep )
|
||||
local MachiningSteps = {}
|
||||
MachiningSteps.StepLength = 0
|
||||
|
||||
if dMachiningDepth <= 0 then
|
||||
MachiningSteps.Count = 0
|
||||
return MachiningSteps
|
||||
end
|
||||
|
||||
MachiningSteps.Count = ceil( (dMachiningDepth - 10 * GEO.EPS_SMALL) / dStep )
|
||||
|
||||
MachiningSteps.StepLength = dMachiningDepth / MachiningSteps.Count
|
||||
|
||||
return MachiningSteps
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- verifica che il box includa il punto in XY
|
||||
function EnclosesPoint( b3Box, ptP)
|
||||
@@ -154,6 +189,8 @@ end
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
local sWarn
|
||||
bMakeAntiSplitPath = true
|
||||
-- ingombro del pezzo
|
||||
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
if not b3Solid then
|
||||
@@ -210,7 +247,8 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptCutC, vtCutN, b3Solid, GDB_RT.GLOB)
|
||||
local b3Cut = EgtGetBBoxGlob( AddId or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp - 2, Prc = 10, Box = b3Cut, Fct = 1, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bFromBottom = ( b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getZ() > 0.25)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH, bFromBottom)
|
||||
if not bOk then return bOk, sErr end
|
||||
@@ -272,7 +310,9 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
local dToolDiam = 100
|
||||
local dMaxMat = 30
|
||||
local dSideAng = 0
|
||||
local sHeadTool = 'H1'
|
||||
local bCW = true
|
||||
local bMillOnAggregate = sMchExt == '_AT'
|
||||
if EgtMdbSetCurrMachining( sMilling) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
@@ -280,16 +320,66 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
dToolDiam = max( dToolDiam, 10)
|
||||
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
|
||||
dSideAng = EgtTdbGetCurrToolParam( MCH_TP.SIDEANG) or dSideAng
|
||||
sHeadTool = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
|
||||
local dSpeed = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) or 0
|
||||
bCW = ( dSpeed >= 0)
|
||||
end
|
||||
end
|
||||
-- verifico che la profondità non superi il massimo materiale dell'utensile
|
||||
local bMultipleZPasses = false
|
||||
-- se necessario, cerco un utensile più lungo
|
||||
if dAltMort > dMaxMat + 10 * GEO.EPS_SMALL then
|
||||
local sErr = 'Error : DtMortise Depth bigger than Tool Cutting edge'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
-- recupero la lavorazione : prima ricerca per sola tipologia
|
||||
sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, nil, nil, bMillUp, bMillDown, bExcludeH2, nil, 'Longest')
|
||||
if not sMilling and bMillUp then
|
||||
sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown, bExcludeH2, nil, 'Longest')
|
||||
end
|
||||
if not sMilling then
|
||||
local sErr = 'Milling not found in library : Error on DtMortise ' .. tostring( Proc.Id)
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- recupero la lavorazione : seconda ricerca con tipologia e diametro massimo
|
||||
sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown, bExcludeH2, nil, 'Longest')
|
||||
if not sMilling and bMillUp then
|
||||
sMilling = ML.FindMilling( sMillType, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown, bExcludeH2, nil, 'Longest')
|
||||
sMchExt = ''
|
||||
end
|
||||
if not sMilling then
|
||||
local sErr = 'Radius too small : Error on DtMortise ' .. tostring( Proc.Id)
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
if not sMilling then
|
||||
local sErr = 'Error : DtMortise Depth bigger than Tool Cutting edge'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- riassegno dati utensile
|
||||
dToolDiam = 100
|
||||
dMaxMat = 30
|
||||
dSideAng = 0
|
||||
bCW = true
|
||||
bMillOnAggregate = sMchExt == '_AT'
|
||||
if EgtMdbSetCurrMachining( sMilling) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
|
||||
dToolDiam = max( dToolDiam, 10)
|
||||
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
|
||||
dSideAng = EgtTdbGetCurrToolParam( MCH_TP.SIDEANG) or dSideAng
|
||||
local dSpeed = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) or 0
|
||||
bCW = ( dSpeed >= 0)
|
||||
end
|
||||
end
|
||||
|
||||
bMultipleZPasses = true
|
||||
end
|
||||
|
||||
|
||||
-- tastatura se richiesta
|
||||
local Info = { vtProbe = vtExtr, ptProbe = ptBC, sType = 'DTMortise', sHead = sHeadTool}
|
||||
local bProbeExecuted, sErr = Probe.Make( Proc, nPartId, Info)
|
||||
|
||||
-- se con tasca, la lavoro (mai in doppio)
|
||||
if bPocket then
|
||||
-- recupero il contorno della tasca (seconda curva ausiliaria)
|
||||
@@ -344,11 +434,20 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
end
|
||||
-- eventuale calcolo SCC
|
||||
local nSCC
|
||||
if BD.TURN and not bPocket then
|
||||
if abs( vtAx:getY()) > abs( vtAx:getZ()) then
|
||||
nSCC = EgtIf( vtAx:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
||||
else
|
||||
nSCC = EgtIf( vtAx:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
|
||||
if BD.TURN then
|
||||
if not bPocket then
|
||||
if abs( vtAx:getY()) > abs( vtAx:getZ()) then
|
||||
nSCC = EgtIf( vtAx:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
||||
else
|
||||
nSCC = EgtIf( vtAx:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
|
||||
end
|
||||
end
|
||||
-- se aggregato e rivolto verso Z-, si accede da lato aperto
|
||||
elseif bMillOnAggregate and AreSameVectorApprox( vtExtr, -Z_AX()) then
|
||||
if Proc.AffectedFaces.Back then
|
||||
nSCC = MCH_SCC.ADIR_YP
|
||||
elseif Proc.AffectedFaces.Front then
|
||||
nSCC = MCH_SCC.ADIR_YM
|
||||
end
|
||||
end
|
||||
-- flag di mirror precedente aggiornabile localmente
|
||||
@@ -363,93 +462,101 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
return false, sErr
|
||||
end
|
||||
-- calcolo il percorso top mortise
|
||||
local nAuxId1 = CalcTopPath( Proc.Id, AuxId, nAddGrpId, dAltMort, dSideAng, b3Solid)
|
||||
local nAuxId1 = CalcPathAtHeight( Proc.Id, AuxId, nAddGrpId, dAltMort, dSideAng, b3Solid)
|
||||
-- se esiste il percorso
|
||||
if nAuxId1 then
|
||||
-- creo percorso sulla parte alta della mortasa
|
||||
local dToolRadDelta = dAltMort * tan( dSideAng)
|
||||
local dTopDiam = dToolDiam + 2 * dToolRadDelta
|
||||
-- recupero punto iniziale e finale del percorso
|
||||
local ptStart = EgtSP( nAuxId1, GDB_RT.GLOB)
|
||||
local ptEnd = EgtEP( nAuxId1, GDB_RT.GLOB)
|
||||
if ptStart and ptEnd then
|
||||
local nId1
|
||||
-- se richiesti due segmenti di linea
|
||||
if not bMakeAsByArc then
|
||||
-- determino il punto comune dei due segmenti
|
||||
local vtDelta = ( ptEnd - ptStart) / 4
|
||||
vtDelta:rotate( vtExtr, -90)
|
||||
local ptMid = ( ptStart + ptEnd) / 2 + vtDelta
|
||||
-- creo la spezzata formata dai due segmenti
|
||||
nId1 = EgtCurveCompoFromPoints( nAddGrpId, { ptStart, ptMid, ptEnd}, GDB_RT.GLOB)
|
||||
-- altrimenti richiesto arco
|
||||
if EgtCurveIsFlat( nAuxId1) then
|
||||
-- creo percorso sulla parte alta della mortasa
|
||||
local dToolRadDelta = dAltMort * tan( dSideAng)
|
||||
local dTopDiam = dToolDiam + 2 * dToolRadDelta
|
||||
-- recupero punto iniziale e finale del percorso
|
||||
local ptStart = EgtSP( nAuxId1, GDB_RT.GLOB)
|
||||
local ptEnd = EgtEP( nAuxId1, GDB_RT.GLOB)
|
||||
if ptStart and ptEnd then
|
||||
local nId1
|
||||
-- se richiesti due segmenti di linea
|
||||
if not bMakeAsByArc then
|
||||
-- determino il punto comune dei due segmenti
|
||||
local vtDelta = ( ptEnd - ptStart) / 4
|
||||
vtDelta:rotate( vtExtr, -90)
|
||||
local ptMid = ( ptStart + ptEnd) / 2 + vtDelta
|
||||
-- creo la spezzata formata dai due segmenti
|
||||
nId1 = EgtCurveCompoFromPoints( nAddGrpId, { ptStart, ptMid, ptEnd}, GDB_RT.GLOB)
|
||||
-- altrimenti richiesto arco
|
||||
else
|
||||
-- direzione del segmento
|
||||
local vtDir = ptEnd - ptStart ;
|
||||
local dLen = vtDir:len()
|
||||
vtDir:normalize()
|
||||
-- direzioni tangenti iniziale e finale
|
||||
local vtStart = EgtSV( nAuxId1, GDB_RT.GLOB)
|
||||
local vtEnd = EgtEV( nAuxId1, GDB_RT.GLOB)
|
||||
-- angoli
|
||||
local dAngStart = acos( vtStart * vtDir)
|
||||
local dAngEnd = acos( vtEnd * vtDir)
|
||||
local dMaxAng = min( 30, dAngStart, dAngEnd)
|
||||
if dLen < dTopDiam then
|
||||
dMaxAng = min( dMaxAng, asin( dLen / dTopDiam))
|
||||
end
|
||||
local vtTg = vtDir ; vtTg:rotate( vtExtr, -dMaxAng)
|
||||
-- creo l'arco
|
||||
nId1 = EgtArc2PV( nAddGrpId, ptStart, ptEnd, vtTg, GDB_RT.GLOB)
|
||||
end
|
||||
if not nId1 then
|
||||
local sErr = 'Wrong geometry : Error on DtMortise '
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
EgtModifyCurveExtrusion( nId1, vtExtr, GDB_RT.GLOB)
|
||||
-- inserisco la lavorazione di contornatura anti splint
|
||||
local sNameF = 'DtMtAS_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchFId = EgtAddMachining( sNameF, sMilling)
|
||||
if not nMchFId then
|
||||
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ nId1, -1}})
|
||||
-- setto affondamento pari all'altezza della mortsasa
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dAltMort)
|
||||
-- setto offset radiale con aggiunto un ulteriore allargamento di 1mm
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dToolRadDelta - 1)
|
||||
-- antischeggia sempre con una passata
|
||||
if bMultipleZPasses then
|
||||
EgtSetMachiningParam( MCH_MP.STEP, 0)
|
||||
end
|
||||
-- sistemo il lato e la direzione di lavoro
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT))
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, false, true))
|
||||
-- se necessario, imposto SCC
|
||||
if nSCC then
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
end
|
||||
-- dichiaro non si generano sfridi per VMill
|
||||
local sUserNotes = '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)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sErr
|
||||
end
|
||||
else
|
||||
-- direzione del segmento
|
||||
local vtDir = ptEnd - ptStart ;
|
||||
local dLen = vtDir:len()
|
||||
vtDir:normalize()
|
||||
-- direzioni tangenti iniziale e finale
|
||||
local vtStart = EgtSV( nAuxId1, GDB_RT.GLOB)
|
||||
local vtEnd = EgtEV( nAuxId1, GDB_RT.GLOB)
|
||||
-- angoli
|
||||
local dAngStart = acos( vtStart * vtDir)
|
||||
local dAngEnd = acos( vtEnd * vtDir)
|
||||
local dMaxAng = min( 30, dAngStart, dAngEnd)
|
||||
if dLen < dTopDiam then
|
||||
dMaxAng = min( dMaxAng, asin( dLen / dTopDiam))
|
||||
end
|
||||
local vtTg = vtDir ; vtTg:rotate( vtExtr, -dMaxAng)
|
||||
-- creo l'arco
|
||||
nId1 = EgtArc2PV( nAddGrpId, ptStart, ptEnd, vtTg, GDB_RT.GLOB)
|
||||
end
|
||||
if not nId1 then
|
||||
local sErr = 'Wrong geometry : Error on DtMortise '
|
||||
local sErr = 'Wrong geometry : Error on DtMortise ' .. tostring( Proc.Id)
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
EgtModifyCurveExtrusion( nId1, vtExtr, GDB_RT.GLOB)
|
||||
-- inserisco la lavorazione di contornatura anti splint
|
||||
local sNameF = 'DtMtAS_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchFId = EgtAddMachining( sNameF, sMilling)
|
||||
if not nMchFId then
|
||||
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ nId1, -1}})
|
||||
-- setto affondamento pari all'altezza della mortsasa
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dAltMort)
|
||||
-- setto offset radiale con aggiunto un ulteriore allargamento di 1mm
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dToolRadDelta - 1)
|
||||
-- sistemo il lato e la direzione di lavoro
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT))
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, false, true))
|
||||
-- se necessario, imposto SCC
|
||||
if nSCC then
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
end
|
||||
-- dichiaro non si generano sfridi per VMill
|
||||
local sUserNotes = 'MaxElev='.. EgtNumToString( dAltMort, 1) .. '; VMRS=0;'
|
||||
-- se lavorazione in doppio
|
||||
if Proc.Double and Proc.Double > 0 then
|
||||
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double)
|
||||
if Proc.Double ~= nMyPrevDouble then
|
||||
nMyPrevDouble = Proc.Double
|
||||
sUserNotes = EgtSetValInNotes( sUserNotes, 'StartZmax', 2)
|
||||
end
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sErr
|
||||
end
|
||||
else
|
||||
local sErr = 'Wrong geometry : Error on DtMortise ' .. tostring( Proc.Id)
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
sWarn = 'Warning : skipped DoveTail mortise antisplint'
|
||||
end
|
||||
else
|
||||
local sErr = 'Wrong geometry : Error on DtMortise ' .. tostring( Proc.Id)
|
||||
@@ -465,6 +572,23 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
local nPass = ceil( dDist / ( 1.9 * dToolDiam))
|
||||
local dStep = 0
|
||||
if nPass > 1 then dStep = max( ( dDist - 2 * dToolDiam) / ( 2 * nPass - 2), 0.25 * dToolDiam) end
|
||||
|
||||
local dVerticalStep = 0
|
||||
if bMultipleZPasses then
|
||||
local dToolVerticalStep = 0
|
||||
if EgtMdbSetCurrMachining( sMilling) then
|
||||
dToolVerticalStep = EgtMdbGetCurrMachiningParam( MCH_MP.STEP) or 0
|
||||
end
|
||||
if dToolVerticalStep < 10 * GEO.EPS_SMALL then
|
||||
dToolVerticalStep = dMaxMat / 3
|
||||
else
|
||||
dToolVerticalStep = min( dToolVerticalStep, dMaxMat / 3)
|
||||
end
|
||||
local VerticalSteps = GetVerticalSteps( dAltMort, dToolVerticalStep)
|
||||
dVerticalStep = VerticalSteps.StepLength
|
||||
nPass = VerticalSteps.Count
|
||||
end
|
||||
|
||||
for i = nPass, 1, -1 do
|
||||
-- inserisco la lavorazione di contornatura
|
||||
local sNameF = 'DtMt_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nPass)
|
||||
@@ -475,10 +599,39 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
local GeomId = AuxId
|
||||
if ( i > 1) and bMultipleZPasses then
|
||||
local dCurrentHeight = dAltMort - ( ( nPass - i + 1) * dVerticalStep)
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error : missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
local b3MortiseNoPocket = EgtGetBBoxGlob( AuxId, GDB_BB.STANDARD)
|
||||
GeomId = CalcPathAtHeight( Proc.Id, AuxId, nAddGrpId, dCurrentHeight, dSideAng, b3MortiseNoPocket)
|
||||
if not GeomId then
|
||||
local sErr = 'Wrong geometry : Error on DtMortise ' .. tostring( Proc.Id)
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
EgtSetMachiningGeometry( {{ GeomId, -1}})
|
||||
-- imposto offset
|
||||
local dOffs = ( i - 1) * dStep
|
||||
if bMultipleZPasses then
|
||||
if i > 1 then
|
||||
dOffs = 1
|
||||
else
|
||||
dOffs = 0
|
||||
end
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
|
||||
-- in caso di passate in Z già calcolate lo step deve essere nullo per garantire passate singole
|
||||
if bMultipleZPasses then
|
||||
EgtSetMachiningParam( MCH_MP.STEP, 0)
|
||||
end
|
||||
-- sistemo il lato e la direzione di lavoro
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT))
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, false, true))
|
||||
@@ -511,11 +664,15 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
end
|
||||
end
|
||||
-- se necessario, imposto SCC
|
||||
if nSCC then
|
||||
if nSCC then
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
end
|
||||
-- dichiaro massima elevazione e assenza sfridi per VMill
|
||||
local sUserNotes = EgtSetVal( 'MaxElev', EgtNumToString( dMaxMat - 0.1, 1)) .. ';' .. EgtSetVal( 'VMRS', 0) .. ';'
|
||||
local dMaxElev = dMaxMat
|
||||
if bMultipleZPasses then
|
||||
dMaxElev = dVerticalStep
|
||||
end
|
||||
local sUserNotes = EgtSetVal( 'MaxElev', EgtNumToString( dMaxElev - 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)
|
||||
@@ -528,6 +685,10 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
sUserNotes = EgtSetValInNotes( sUserNotes, 'StartZmax', 2)
|
||||
end
|
||||
end
|
||||
-- se c'è stata tastatura, si disattiva sull'ultima lavorazione
|
||||
if bProbeExecuted and i == 1 then
|
||||
sUserNotes = EgtSetValInNotes( sUserNotes, 'END-PROBE', true)
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
@@ -536,7 +697,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
return true
|
||||
return true, sWarn
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
+151
-16
@@ -5,6 +5,7 @@
|
||||
-- 2023/02/08 Aumentato il range per cui i tenoni vengono lavorati in sottosquadro.
|
||||
-- 2023/03/27 Migliorate condizioni scelta pretaglio con lama o fresa; gestione unificata con ProcessTenon.
|
||||
-- 2023/03/28 Corretta gestione faccia di base quando divisa in più parti per distanza massima da lavorare.
|
||||
-- 2024/02/29 Aumentato numero passaggi CR su tenone. Massimo 8
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessDtTenon = {}
|
||||
@@ -45,9 +46,9 @@ local function VerifyOrientation( Proc, vtN, b3Raw)
|
||||
-- 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 -23.5deg
|
||||
else
|
||||
return ( vtN:getZ() >= -0.359)
|
||||
return ( vtN:getZ() >= -0.399)
|
||||
end
|
||||
-- se trave medio-bassa
|
||||
elseif b3Raw:getDimZ() < 281 then
|
||||
@@ -63,14 +64,14 @@ local function VerifyOrientation( Proc, vtN, b3Raw)
|
||||
-- se tenone praticamente in asse, accetto fino a -22 deg
|
||||
if abs( vtN:getY()) < 0.088 then
|
||||
return ( vtN:getZ() >= -0.375)
|
||||
-- altrimenti, accetto fino a -10 deg
|
||||
-- altrimenti, accetto fino a -12.5 deg
|
||||
else
|
||||
return ( vtN:getZ() >= -0.174)
|
||||
return ( vtN:getZ() >= -0.216)
|
||||
end
|
||||
-- altrimenti
|
||||
else
|
||||
-- accetto fino a -5deg
|
||||
return ( vtN:getZ() >= -0.088)
|
||||
-- accetto fino a -12.5 deg
|
||||
return ( vtN:getZ() >= -0.216)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -206,8 +207,22 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- altrimenti applico taglio di lama
|
||||
else
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
local bFromBottom = ( b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getZ() > 0.25)
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
|
||||
-- se esiste grezzo successivo non serve tagliare dal basso
|
||||
local bFromBottom
|
||||
local dTotalLength = 0
|
||||
local nNextRawId = EgtGetNextRawPart( nRawId)
|
||||
while nNextRawId do
|
||||
dTotalLength = dTotalLength + EgtGetRawPartBBox( nNextRawId):getDimX()
|
||||
nNextRawId = EgtGetNextRawPart( nNextRawId)
|
||||
end
|
||||
if dTotalLength > BD.MinRaw and not Proc.Tail then
|
||||
bFromBottom = false
|
||||
else
|
||||
bFromBottom = ( b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getZ() > 0.25)
|
||||
end
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
@@ -215,7 +230,7 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
local sMillType = 'DtTenon'
|
||||
local sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', ''), nil, nil, nil, nil, bMillUp, bMillDown)
|
||||
local sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown and not bMillUp, '_H2', ''), nil, nil, nil, nil, bMillUp, bMillDown)
|
||||
if not sMilling then
|
||||
local sErr = 'Error : milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
@@ -234,11 +249,32 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
bCW = ( dSpeed >= 0)
|
||||
end
|
||||
end
|
||||
-- verifico che l'altezza non superi il massimo materiale dell'utensile
|
||||
-- se necessario, cerco un utensile più lungo
|
||||
if dDtTenH > dMaxMat + 10 * GEO.EPS_SMALL then
|
||||
local sErr = 'Error : DtTenon Height bigger than Tool Cutting edge'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown and not bMillUp, '_H2', ''), nil, nil, nil, nil, bMillUp, bMillDown, nil, nil, 'Longest')
|
||||
if not sMilling then
|
||||
local sErr = 'Error : milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
if not sMilling then
|
||||
local sErr = 'Error : DtTenon Height bigger than Tool Cutting edge'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- riassegno dati utensile
|
||||
dTDiam = 50
|
||||
dMaxMat = 30
|
||||
bCW = true
|
||||
if EgtMdbSetCurrMachining( sMilling) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dTDiam
|
||||
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
|
||||
local dSpeed = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) or 0
|
||||
bCW = ( dSpeed >= 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- calcolo distanza massima della curva dal punto più lontano della base tenone Dt (facet 0)
|
||||
local dMaxDist
|
||||
@@ -268,8 +304,8 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
dMaxDist = 2 * ( b3DtTen:getRadius() - b3DtAux:getRadius())
|
||||
end
|
||||
EgtOutLog( 'MaxDist=' .. EgtNumToString( dMaxDist, 3), 3)
|
||||
-- Cicli di lavorazione (max 6)
|
||||
local MAX_PASS = 6
|
||||
-- Cicli di lavorazione (max 8)
|
||||
local MAX_PASS = 8
|
||||
local nStep = min( ceil( dMaxDist / ( 0.7 * dTDiam)), MAX_PASS)
|
||||
local dStep = min( dMaxDist, 0.7 * dTDiam * MAX_PASS) / nStep
|
||||
for i = nStep, 1, -1 do
|
||||
@@ -329,8 +365,107 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
BL.UpdateTCING( nRawId, dOffs)
|
||||
end
|
||||
end
|
||||
|
||||
-- si controllano le ultime 5 facce della feature
|
||||
local nIndFace = -1
|
||||
for i = 1, 5 do
|
||||
if abs( vtExtr * EgtSurfTmFacetNormVersor( Proc.Id, Proc.Fct-i, GDB_ID.ROOT)) < GEO.EPS_ANG_SMALL then
|
||||
nIndFace = Proc.Fct-i
|
||||
end
|
||||
end
|
||||
-- controllo se serve passaggio di finitura in caso il tenone non cominci dal bordo della trave (P14 > 0)
|
||||
if nIndFace > 0 then
|
||||
-- verifico se almeno uno dei punti iniziale e finale della curva giace in uno dei piani limite del pezzo, quindi se è un lato aperto
|
||||
local bOpen = false
|
||||
local ptIni = EgtSP( AuxId, GDB_RT.GLOB)
|
||||
local ptFin = EgtEP( AuxId, GDB_RT.GLOB)
|
||||
if ( abs( ptIni:getX() - b3Solid:getMax():getX()) < 100 * GEO.EPS_SMALL or abs( ptFin:getX() - b3Solid:getMax():getX()) < 100 * GEO.EPS_SMALL) or
|
||||
( abs( ptIni:getX() - b3Solid:getMin():getX()) < 100 * GEO.EPS_SMALL or abs( ptFin:getX() - b3Solid:getMin():getX()) < 100 * GEO.EPS_SMALL) or
|
||||
( abs( ptIni:getY() - b3Solid:getMax():getY()) < 100 * GEO.EPS_SMALL or abs( ptFin:getY() - b3Solid:getMax():getY()) < 100 * GEO.EPS_SMALL) or
|
||||
( abs( ptIni:getY() - b3Solid:getMin():getY()) < 100 * GEO.EPS_SMALL or abs( ptFin:getY() - b3Solid:getMin():getY()) < 100 * GEO.EPS_SMALL) or
|
||||
( abs( ptIni:getZ() - b3Solid:getMax():getZ()) < 100 * GEO.EPS_SMALL or abs( ptFin:getZ() - b3Solid:getMax():getZ()) < 100 * GEO.EPS_SMALL) or
|
||||
( abs( ptIni:getZ() - b3Solid:getMin():getZ()) < 100 * GEO.EPS_SMALL or abs( ptFin:getZ() - b3Solid:getMin():getZ()) < 100 * GEO.EPS_SMALL) then
|
||||
bOpen = true
|
||||
end
|
||||
-- se entrambi i punti non sono sul limite pezzo
|
||||
if not bOpen then
|
||||
-- recupero la lavorazione
|
||||
sMillType = 'Tenon'
|
||||
sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown and not bMillUp, '_H2', ''), nil, nil, nil, nil, bMillUp, bMillDown)
|
||||
if not sMilling then
|
||||
local sErr = 'Error : milling to finish the tenon not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- recupero i dati dell'utensile
|
||||
if EgtMdbSetCurrMachining( sMilling) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dTDiam
|
||||
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
|
||||
local dSpeed = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) or 0
|
||||
bCW = ( dSpeed >= 0)
|
||||
end
|
||||
|
||||
-- inserisco la passata finale della lavorazione
|
||||
local sNameF = 'TenF_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchFId = EgtAddMachining( sNameF, sMilling)
|
||||
if not nMchFId then
|
||||
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ Proc.Id, nIndFace}})
|
||||
-- sistemo i parametri
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH')
|
||||
-- sistemo il lato e la direzione di lavoro
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT))
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false))
|
||||
EgtSetMachiningParam( MCH_MP.LITANG, 0.7 * dTDiam)
|
||||
EgtSetMachiningParam( MCH_MP.LIPERP, 20)
|
||||
EgtSetMachiningParam( MCH_MP.LOTANG, 0.7 * dTDiam)
|
||||
EgtSetMachiningParam( MCH_MP.LOPERP, 20)
|
||||
|
||||
local nFaceUse
|
||||
if vtExtr:getX() > -GEO.EPS_SMALL then
|
||||
nFaceUse = MCH_MILL_FU.PARAL_LEFT
|
||||
else
|
||||
nFaceUse = MCH_MILL_FU.PARAL_RIGHT
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
||||
|
||||
-- imposto elevazione
|
||||
local sUserNotes = EgtSetVal( 'MaxElev', EgtNumToString( dDtTenH, 1)) .. ';'
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
||||
|
||||
-- imposto posizione braccio porta testa
|
||||
local nSCC = MCH_SCC.NONE
|
||||
if BD.TURN then
|
||||
if abs( vtAx:getY()) > abs( vtAx:getZ()) then
|
||||
nSCC = EgtIf( vtAx:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
||||
else
|
||||
nSCC = EgtIf( vtAx:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
|
||||
end
|
||||
elseif not BD.C_SIMM then
|
||||
nSCC = MCH_SCC.ADIR_YM
|
||||
if abs( vtExtr:getY()) > 0.088 then
|
||||
nSCC = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
|
||||
end
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
return ProcessDtTenon
|
||||
|
||||
+164
-43
@@ -9,6 +9,8 @@
|
||||
-- 2023/03/03 Corretta MakeByMark ( non definiti b3Raw e b3Aux ).
|
||||
-- 2023/06/21 In CalcSpecialAdd modificato l'angolo minimo da 5 a 15 deg.
|
||||
-- 2023/07/28 In MakeByPocket aggiunta Q06 per specificare un eventuale offset radiale del contorno.
|
||||
-- 2024/03/05 In MakebyPocket aggiunta lavorazione di smusso
|
||||
-- In MakeByMill eliminata doppia lavorazione smusso se contorno non passante
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessFreeContour = {}
|
||||
@@ -29,6 +31,9 @@ local Q_DEPTH_CHAMFER = 'Q02' -- d
|
||||
local Q_OVERMAT_FOR_FINISH = 'Q03' -- d
|
||||
local Q_ONLY_CHAMFER = 'Q00' -- i
|
||||
local Q_RADIAL_OFFSET = 'Q06' -- d, valido solo per pocket
|
||||
local Q_IGNORE_LASER_PROBLEMS = 'Q07'
|
||||
local Q_FORCE_CLAMPABLE_AREA = 'Q08'
|
||||
local Q_INVERT_LAST_PATH = 'Q09'
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
@@ -97,6 +102,8 @@ end
|
||||
function ProcessFreeContour.Classify( Proc, b3Raw)
|
||||
-- verifico se di tipo pocket
|
||||
local bPocket = ( EgtGetInfo( Proc.Id, 'PCKT', 'i') == 1)
|
||||
-- verifico se forzata esecuzione anche se di testa e ribaltata o ruotata (lettura laser)
|
||||
local bDownSideOnHeadOk = ( EgtGetInfo( Proc.Id, Q_IGNORE_LASER_PROBLEMS, 'd') or 0) == 1
|
||||
-- recupero la curva associata
|
||||
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
|
||||
if not AuxId then return false end
|
||||
@@ -105,23 +112,23 @@ function ProcessFreeContour.Classify( Proc, b3Raw)
|
||||
-- se tasca
|
||||
if bPocket then
|
||||
local bDown = ( vtN:getZ() < - 0.5)
|
||||
return true, bDown, false
|
||||
return true, bDown, false, bDownSideOnHeadOk
|
||||
-- se altrimenti profilo orizzontale
|
||||
elseif abs( vtN:getZ()) < 0.5 then
|
||||
return true, false, false
|
||||
return true, false, false, bDownSideOnHeadOk
|
||||
-- se altrimenti profilo verticale che non interessa tutta la sezione
|
||||
elseif Proc.Box:getDimZ() < 0.9 * b3Raw:getDimZ() then
|
||||
local bDown = ( vtN:getZ() < - 0.5)
|
||||
return true, bDown, false
|
||||
return true, bDown, false, bDownSideOnHeadOk
|
||||
-- altrimenti è profilo verticale che interessa tutta la sezione
|
||||
else
|
||||
-- recupero la massima capacità di lavoro dell'utensile da utilizzare
|
||||
local sMilling, dMaxDepth = ML.FindMilling( 'FreeContour')
|
||||
if not sMilling then dMaxDepth = 0 end
|
||||
if Proc.Box:getDimZ() > dMaxDepth and BD.ROT90 then
|
||||
return true, false, true
|
||||
return true, false, true, bDownSideOnHeadOk
|
||||
else
|
||||
return true, false, false
|
||||
return true, false, false, bDownSideOnHeadOk
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -294,16 +301,18 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local bCross = false
|
||||
if abs( vtExtr:getX()) < 0.707 then
|
||||
if abs( vtExtr:getY()) > abs( vtExtr:getZ()) then
|
||||
-- se è passante
|
||||
if b3Aux:getDimY() > b3Raw:getDimY() - 1.0 then
|
||||
bCross = true
|
||||
dDepth = min( dDepth, b3Raw:getDimY() / abs( vtExtr:getY()))
|
||||
end
|
||||
if bDown then
|
||||
nSide = -1
|
||||
nSide = -1
|
||||
else
|
||||
nSide = 1
|
||||
nSide = 1
|
||||
end
|
||||
else
|
||||
-- se è passante
|
||||
if b3Aux:getDimZ() > b3Raw:getDimZ() - 1.0 then
|
||||
bCross = true
|
||||
dDepth = min( dDepth, b3Raw:getDimZ() / abs( vtExtr:getZ()))
|
||||
@@ -373,28 +382,28 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if nChamfer > 0 and Proc.Grp ~= 0 and dOriDepth > dDepthCham and Proc.Prc ~= 70 then
|
||||
local bDoubleCham = false
|
||||
local dExtra = 2
|
||||
local sChamferDown, sChamferUp
|
||||
if nDouble > 1 and bCanDouble then
|
||||
if nSide == 0 then
|
||||
if BD.DOWN_HEAD then
|
||||
-- recupero la lavorazione
|
||||
local nChamferDown
|
||||
nChamferDown, _, sChamferDown = VerifyChamfer( Proc, AuxId, nRawId, true, true)
|
||||
if nChamferDown < 0 then
|
||||
local sChamferDown, sChamferUp
|
||||
if nDouble > 1 and bCanDouble then
|
||||
if nSide == 0 then
|
||||
if BD.DOWN_HEAD then
|
||||
-- recupero la lavorazione
|
||||
local nChamferDown
|
||||
nChamferDown, _, sChamferDown = VerifyChamfer( Proc, AuxId, nRawId, true, true)
|
||||
if nChamferDown < 0 then
|
||||
sWarn = 'Warning : chamfer from bottom not found in library'
|
||||
sChamferDown = nil
|
||||
EgtOutLog( sWarn)
|
||||
end
|
||||
end
|
||||
local nChamferUp
|
||||
nChamferUp, _, sChamferUp = VerifyChamfer( Proc, AuxId, nRawId, true, false)
|
||||
if nChamferUp < 0 then
|
||||
sWarn = 'Warning : chamfer from bottom not found in library'
|
||||
sChamferDown = nil
|
||||
sChamferUp = nil
|
||||
EgtOutLog( sWarn)
|
||||
end
|
||||
end
|
||||
local nChamferUp
|
||||
nChamferUp, _, sChamferUp = VerifyChamfer( Proc, AuxId, nRawId, true, false)
|
||||
if nChamferUp < 0 then
|
||||
sWarn = 'Warning : chamfer from bottom not found in library'
|
||||
sChamferUp = nil
|
||||
EgtOutLog( sWarn)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- eseguo
|
||||
for i = 1, nStep do
|
||||
-- inserisco la lavorazione
|
||||
@@ -439,9 +448,9 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
end
|
||||
if nSide == 0 then
|
||||
bDoubleCham = EgtIf( sChamferDown and BD.DOWN_HEAD, true, false)
|
||||
bDoubleCham = EgtIf( sChamferDown and BD.DOWN_HEAD, true, false) and bCanDouble
|
||||
else
|
||||
bDoubleCham = true
|
||||
bDoubleCham = bCanDouble
|
||||
end
|
||||
-- assegno affondamento e offset radiale
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepthCham + dExtra)
|
||||
@@ -462,7 +471,9 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
-- posizione braccio porta testa
|
||||
local nSCC = MCH_SCC.NONE
|
||||
if not BD.C_SIMM then
|
||||
if BD.TURN == 2 then
|
||||
nSCC = MCH_SCC.ADIR_ZP
|
||||
elseif not BD.C_SIMM then
|
||||
if Proc.Head then
|
||||
nSCC = MCH_SCC.ADIR_XP
|
||||
elseif Proc.Tail then
|
||||
@@ -530,7 +541,9 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
-- posizione braccio porta testa
|
||||
local nSCC = MCH_SCC.NONE
|
||||
if not BD.C_SIMM then
|
||||
if BD.TURN == 2 then
|
||||
nSCC = MCH_SCC.ADIR_ZP
|
||||
elseif not BD.C_SIMM then
|
||||
if Proc.Head then
|
||||
nSCC = MCH_SCC.ADIR_XP
|
||||
elseif Proc.Tail then
|
||||
@@ -580,6 +593,8 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- eventuale inversione ultimo segmento
|
||||
local bInvertLastPath = ( ( EgtGetInfo( Proc.Id, Q_INVERT_LAST_PATH, 'd') or 0) == 1)
|
||||
-- eseguo
|
||||
for i = 1, nStep do
|
||||
for j = 1, nDouble do
|
||||
@@ -622,38 +637,71 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
-- eventuale accorciamento di testa
|
||||
local dStartAddLen, dEndAddLen, dWorkSide, bToolInvert, bInvert
|
||||
if ( j == 1 and i > 1) or ( j == 2 and i < nStep) then
|
||||
local dStartAddLen = EgtIf( j == 1, - ( i - 1) * dStep, - ( nStep - i) * dStep)
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dStartAddLen)
|
||||
dStartAddLen = EgtIf( j == 1, - ( i - 1) * dStep, - ( nStep - i) * dStep)
|
||||
else
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, EgtIf( j == 1, dStartAddSpec, dEndAddSpec))
|
||||
dStartAddLen = EgtIf( j == 1, dStartAddSpec, dEndAddSpec)
|
||||
end
|
||||
-- eventuale accorciamento di coda
|
||||
if ( j == 1 and i < nStep) or ( j == 2 and i > 1) then
|
||||
local dEndAddLen = EgtIf( j == 1, - ( nStep - i) * dStep, - ( i - 1) * dStep)
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
|
||||
dEndAddLen = EgtIf( j == 1, - ( nStep - i) * dStep, - ( i - 1) * dStep)
|
||||
else
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, EgtIf( j == 1, dEndAddSpec, dStartAddSpec))
|
||||
dEndAddLen = EgtIf( j == 1, dEndAddSpec, dStartAddSpec)
|
||||
end
|
||||
-- se estrusione da sotto, inverto direzione fresa
|
||||
if ( j == 1 and bToolInv) or ( j == 2 and not bToolInv) then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
bToolInvert = true
|
||||
else
|
||||
bToolInvert = false
|
||||
end
|
||||
-- se seconda passata, inverto direzione di lavoro
|
||||
if j == 2 then
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
bInvert = true
|
||||
else
|
||||
bInvert = false
|
||||
end
|
||||
|
||||
-- assegno lato di lavoro
|
||||
if Proc.Grp == 0 then
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.CENTER)
|
||||
dWorkSide = MCH_MILL_WS.CENTER
|
||||
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)
|
||||
dWorkSide = MCH_MILL_WS.LEFT
|
||||
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)
|
||||
dWorkSide = MCH_MILL_WS.RIGHT
|
||||
end
|
||||
|
||||
-- se ultimo step da invertire
|
||||
if i == nStep and bInvertLastPath then
|
||||
-- se profilo orizzontale
|
||||
if abs( vtExtr:getZ()) < 10 * GEO.EPS_SMALL then
|
||||
dStartAddLen, dEndAddLen = dEndAddLen, dStartAddLen
|
||||
bInvert = not( bInvert)
|
||||
bToolInvert = not( bToolInvert)
|
||||
else
|
||||
dStartAddLen, dEndAddLen = dEndAddLen, dStartAddLen
|
||||
bInvert = not( bInvert)
|
||||
if dWorkSide == MCH_MILL_WS.LEFT then
|
||||
dWorkSide = MCH_MILL_WS.RIGHT
|
||||
elseif dWorkSide == MCH_MILL_WS.RIGHT then
|
||||
dWorkSide = MCH_MILL_WS.LEFT
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- setto i valori
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dStartAddLen)
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, bToolInvert)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, bInvert)
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, dWorkSide)
|
||||
|
||||
|
||||
-- posizione braccio porta testa
|
||||
local nSCC = MCH_SCC.NONE
|
||||
if not BD.C_SIMM then
|
||||
if BD.TURN == 2 then
|
||||
nSCC = MCH_SCC.ADIR_ZP
|
||||
elseif not BD.C_SIMM then
|
||||
if Proc.Head then
|
||||
nSCC = MCH_SCC.ADIR_XP
|
||||
elseif Proc.Tail then
|
||||
@@ -709,7 +757,13 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- eventuale segnalazione ingombro di testa o coda
|
||||
local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ())
|
||||
local dMinZ = max( BD.MIN_HEIGHT, 0.35 * b3Raw:getDimZ())
|
||||
if Proc.Box:getDimZ() > 0.75 * b3Raw:getDimZ() and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinZ then
|
||||
local bRawPartHas90Rotation = ( ( EgtGetInfo( nRawId, 'ROTATE90', 'd') or 0) == 1)
|
||||
-- eventuale forzatura area feature pinzabile
|
||||
local bForceClampableArea = ( ( EgtGetInfo( Proc.Id, Q_FORCE_CLAMPABLE_AREA, 'd') or 0) == 1)
|
||||
-- se la feature è passante top/down oppure se è passante e si ruota di 90deg considero sempre non pinzabile; in alternativa si valuta in base all'ingombro
|
||||
if not bForceClampableArea and ( ( Proc.Box:getDimZ() > 0.75 * b3Raw:getDimZ() and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinZ) or
|
||||
( Proc.AffectedFaces.Top and Proc.AffectedFaces.Bottom and ( AreSameOrOppositeVectorApprox( vtExtr, Z_AX()))) or
|
||||
( Proc.AffectedFaces.Front and Proc.AffectedFaces.Back and bRawPartHas90Rotation)) then
|
||||
if Proc.Head then
|
||||
local dOffs = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()
|
||||
BL.UpdateHCING( nRawId, dOffs)
|
||||
@@ -718,6 +772,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
BL.UpdateTCING( nRawId, dOffs)
|
||||
end
|
||||
end
|
||||
|
||||
return true, sWarn
|
||||
end
|
||||
|
||||
@@ -734,8 +789,74 @@ local function MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- recupero i dati della curva e del profilo
|
||||
local dDepth = abs( EgtCurveThickness( AuxId))
|
||||
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
||||
--local bToolInv = ( vtExtr:getZ() < -0.1)
|
||||
-- recupero la lavorazione
|
||||
local bDownHead = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1)
|
||||
local bToolInv = ( not bDownHead and vtExtr:getZ() < -0.1 and b3Aux:getDimZ() > b3Raw:getDimZ() - 5)
|
||||
local dExtra = 2
|
||||
|
||||
-- verifico se servono gli smussi. Se lavorazione principale di svuotatura significa che è solo da un lato
|
||||
-- generalmente sono lavorazioni non molto lunghe, quindi non si gestistono gli step
|
||||
-- verifico i parametri Q per profondità smusso e per eseguirlo in esclusiva
|
||||
local nChamfer, dDepthCham, sChamfer = VerifyChamfer( Proc, AuxId, nRawId, true)
|
||||
-- se devo inserire il chamfer
|
||||
if nChamfer > 0 and Proc.Grp ~= 0 and dDepth > dDepthCham and Proc.Prc ~= 70 then
|
||||
-- inserisco la lavorazione
|
||||
local sNameCh = 'Cham_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchId = EgtAddMachining( sNameCh, sChamfer)
|
||||
if not nMchId then
|
||||
local sErr = 'Error adding machining ' .. sNameCh .. '-' .. sChamfer
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
-- se lavorazione da sopra o da sotto
|
||||
if Proc.Grp == 3 then
|
||||
if not bToolInv then
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
else
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
end
|
||||
end
|
||||
if Proc.Grp == 4 then
|
||||
if not bToolInv then
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
else
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||
end
|
||||
end
|
||||
-- assegno affondamento e offset radiale
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepthCham + dExtra)
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
|
||||
-- posizione braccio porta testa
|
||||
local nSCC = MCH_SCC.NONE
|
||||
if BD.TURN == 2 then
|
||||
nSCC = MCH_SCC.ADIR_ZP
|
||||
elseif not BD.C_SIMM then
|
||||
if Proc.Head then
|
||||
nSCC = MCH_SCC.ADIR_XP
|
||||
elseif Proc.Tail then
|
||||
nSCC = MCH_SCC.ADIR_XM
|
||||
elseif AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then
|
||||
nSCC = MCH_SCC.ADIR_YP
|
||||
elseif vtExtr:getY() > -0.01 then
|
||||
nSCC = MCH_SCC.ADIR_YP
|
||||
else
|
||||
nSCC = MCH_SCC.ADIR_YM
|
||||
end
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchId, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
|
||||
-- recupero la lavorazione di svuotatura
|
||||
local sPocketing = ML.FindPocketing( 'Pocket', nil, dDepth)
|
||||
if not sPocketing then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' pocketing not found in library'
|
||||
|
||||
+343
-138
@@ -22,6 +22,7 @@ local Fbs = require( 'FacesBySaw')
|
||||
local Cut = require( 'ProcessCut')
|
||||
local Pocket = require( 'FaceByPocket')
|
||||
local Topology = require( 'FeatureTopology')
|
||||
local Split = require( 'ProcessSplit')
|
||||
|
||||
EgtOutLog( ' ProcessHeadCut started', 1)
|
||||
|
||||
@@ -29,6 +30,10 @@ EgtOutLog( ' ProcessHeadCut started', 1)
|
||||
local BD = require( 'BeamData')
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
if BD.PRECUT_HEAD == nil then
|
||||
BD.PRECUT_HEAD = true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
function ProcessHeadCut.Identify( Proc)
|
||||
@@ -154,12 +159,110 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
return true, nil
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- smussi in testa
|
||||
local function MakeHeadChamfer( idProc, nPartId)
|
||||
local dDepthHeadChamfer = EgtGetInfo( idProc, 'Q08', 'd') or 0
|
||||
-- se non attivo esco subito
|
||||
if dDepthHeadChamfer < 100 * GEO.EPS_SMALL then
|
||||
return
|
||||
end
|
||||
|
||||
-- recupero gruppo per geometria aggiuntiva
|
||||
local AddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not AddGrpId then
|
||||
local sErr = 'Error on process StartFace impossible to find AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
|
||||
-- recupero la lavorazione
|
||||
local sMilling = ML.FindMilling( 'Mark')
|
||||
if not sMilling then
|
||||
local sErr = 'Error : milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
|
||||
local nLoopId, nLoopCnt = EgtExtractSurfTmFacetLoops( idProc, 0, AddGrpId)
|
||||
if not nLoopId or nLoopCnt > 1 then
|
||||
local sErr = 'Error MakeHeadChamfer : too many loops'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
|
||||
-- setto direzione estrusione corretta
|
||||
EgtModifyCurveExtrusion( nLoopId, X_AX())
|
||||
EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.RIGHT))
|
||||
|
||||
local dQ09Value = EgtGetInfo( idProc, 'Q09', 'd')
|
||||
local bChamferedEdge = dQ09Value > 0
|
||||
|
||||
local nIdFirstEntity, nEntityCnt = EgtExplodeCurveCompo( nLoopId)
|
||||
local p3MidPoint = EgtMP( nIdFirstEntity, GDB_ID.GRID)
|
||||
|
||||
for i = 0, nEntityCnt - 1 do
|
||||
if EgtCurveLength( nIdFirstEntity + i) - 10 < abs( dQ09Value) * 2 then
|
||||
local sErr = 'Error MakeHeadChamfer : Q09 too high'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
|
||||
-- creo raccordo o fillet
|
||||
for i = 0, nEntityCnt - 1 do
|
||||
local idFirst = nIdFirstEntity + i
|
||||
local idSecond = EgtIf( i == nEntityCnt - 1, nIdFirstEntity, idFirst + 1)
|
||||
local ptEndPointFirst = EgtEP( idFirst, GDB_ID.GRID) - ( abs( dQ09Value) * EgtEV( idFirst, GDB_ID.GRID))
|
||||
local ptStartPointSecond = EgtSP( idSecond, GDB_ID.GRID) + ( abs( dQ09Value) * EgtEV( idSecond, GDB_ID.GRID))
|
||||
|
||||
if bChamferedEdge then
|
||||
EgtCurveChamfer( AddGrpId, idFirst, ptEndPointFirst, idSecond, ptStartPointSecond, abs( dQ09Value), true, GDB_RT.GRID)
|
||||
else
|
||||
EgtCurveFillet( AddGrpId, idFirst, ptEndPointFirst, idSecond, ptStartPointSecond, abs( dQ09Value), true, GDB_RT.GRID)
|
||||
end
|
||||
end
|
||||
|
||||
EgtSelectPathObjs( nIdFirstEntity, true)
|
||||
local idGeom, idGeomCnt = EgtCurveCompoByChain( AddGrpId, GDB_ID.SEL, {0,0,0}, true)
|
||||
if not idGeom or idGeomCnt > 1 then
|
||||
local sErr = 'Error MakeHeadChamfer : too many loops'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
EgtChangeClosedCurveStartPoint( idGeom, p3MidPoint, GDB_RT.GRID)
|
||||
|
||||
-- Inserisco la lavorazione del lato standard
|
||||
local dExtra = 2
|
||||
local sName1 = 'HeadCham_' .. ( EgtGetName( idProc) or tostring( idProc))
|
||||
local nMch1Id = EgtAddMachining( sName1, sMilling)
|
||||
if not nMch1Id then
|
||||
local sErr = 'Error adding machining ' .. sName1 .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ idGeom, -1}})
|
||||
-- assegno affondamento e offset radiale
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepthHeadChamfer + dExtra)
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
|
||||
-- assegno lato di lavoro
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMch1Id, false)
|
||||
return false, sErr
|
||||
end
|
||||
|
||||
return true, nil
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- tagli verticali aggiuntivi
|
||||
local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw )
|
||||
local _, dimH = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
|
||||
local nVerticalCuts = ceil( dimH / ( BD.MAX_LEN_DICE)) - 1
|
||||
local dVerticalSliceHeight = dimH / ( nVerticalCuts + 1)
|
||||
local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw, dOffsetBetweenCuts)
|
||||
local nVerticalCuts = ceil( Proc.Face[1].WidthTrimmed / ( BD.MAX_LEN_DICE)) - 1
|
||||
local dVerticalSliceHeight = Proc.Face[1].WidthTrimmed / ( nVerticalCuts + 1)
|
||||
-- recupero il diametro dell'utensile
|
||||
local dSawDiam = 400
|
||||
if EgtMdbSetCurrMachining( sCutting) then
|
||||
@@ -173,12 +276,180 @@ local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw )
|
||||
for j = nVerticalCuts, 1, -1 do
|
||||
local nFaceUse = MCH_MILL_FU.PARAL_FRONT
|
||||
local dVerticalCutOffset = dVerticalSliceHeight * -j
|
||||
bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, '', b3Raw)
|
||||
local sLeadInOutType = 'PerpendicularOutraw'
|
||||
bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, '', b3Raw, nil, nil, nil, sLeadInOutType, nil, dOffsetBetweenCuts)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
|
||||
return bOk, sErr
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- tagli standard
|
||||
local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCutType, Cutting1Data, Cutting2Data, dStartOffset, dOvmHead)
|
||||
local PrecutType = { bBigSectionCut = HeadCutType.bBigSectionCut, bHorizCut = HeadCutType.bHorizCut, bDoubleHorizCut = HeadCutType.bDoubleHorizCut, bDoubleCut = HeadCutType.bDoubleCut, sType = 'Precut', bNeedVerticalAddedCuts = false, bNeedHorizontalAddedCuts = false}
|
||||
if not HeadCutType.bDoubleHorizCut then
|
||||
-- flag di lavorazione faccia
|
||||
local nOrthoOpposite = EgtIf( HeadCutType.bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_FRONT)
|
||||
-- calcolo extra taglio ed accorciamento
|
||||
local dCutExtra = 0
|
||||
local dAccStart = 0
|
||||
local dAccEnd = 0
|
||||
|
||||
if b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL or b3Raw:getDimY() < 2 * BD.MAX_DIM_HTCUT_HBEAM + 10 * GEO.EPS_SMALL then
|
||||
dCutExtra = EgtIf( HeadCutType.bDoubleCut, - 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN, BD.CUT_EXTRA)
|
||||
else
|
||||
dCutExtra = - ( b3Raw:getDimY() - Cutting1Data.dMaxDepth)
|
||||
local dSawRad = Cutting1Data.dSawDiam / 2
|
||||
-- distanza in Y tra il centro della lama e l'intersezione tra la lama stessa e la massima Z della trave, + extra
|
||||
-- se taglio doppio l'intersezione sarà in mezzeria, se taglio singolo sarà all'estremo opposto della trave
|
||||
local dKL = dSawRad - Cutting1Data.dMaxDepth + EgtIf( HeadCutType.bDoubleCut, b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN, b3Raw:getDimY() + BD.CUT_EXTRA)
|
||||
-- lunghezza minima del percorso di lavorazione, in caso accorciamento porti a lunghezza negativa
|
||||
local dMinSawingLength = 5
|
||||
if BD.C_SIMM then
|
||||
dAccEnd = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0))
|
||||
-- non posso comunque accorciare più della dimensione della geometria, quindi in caso allungo entrata
|
||||
if dAccEnd > b3Raw:getDimZ() - 100 * GEO.EPS_SMALL then
|
||||
dAccStart = b3Raw:getDimZ() - dAccEnd - dMinSawingLength
|
||||
end
|
||||
else
|
||||
dAccStart = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0))
|
||||
-- non posso comunque accorciare più della dimensione della geometria, quindi in caso allungo uscita
|
||||
if dAccStart > b3Raw:getDimZ() - 100 * GEO.EPS_SMALL then
|
||||
dAccEnd = b3Raw:getDimZ() - dAccStart - dMinSawingLength
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- per travi alte faccio dei tagli orizzontali aggiuntivi
|
||||
if HeadCutType.bNeedHorizontalAddedCuts then
|
||||
-- taglio a zero (con lama) per evitare problemi con grezzo più lungo del previsto. Se BigSection il pretaglio è già stato fatto.
|
||||
if not ( HeadCutType.bBigSectionCut) and BD.PRECUT_HEAD then
|
||||
dStartOffset = dOvmHead
|
||||
local bOkPrecut, sErrPrecut = MakeStandardCuts( Proc, b3Raw, 1, 0, PrecutType, Cutting1Data, Cutting2Data, dStartOffset)
|
||||
if not bOkPrecut then
|
||||
return false, sErrPrecut
|
||||
end
|
||||
end
|
||||
local nHorizontalCuts = ceil( Proc.Face[1].HeightTrimmed / BD.MAX_DIM_DICE) - 1
|
||||
local dHorizontalSliceHeight = Proc.Face[1].HeightTrimmed / ( nHorizontalCuts + 1)
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutXOffset = ( i - 1) * dOffsetBetweenCuts
|
||||
-- tagli orizzontali
|
||||
for j = nHorizontalCuts, 1, -1 do
|
||||
local nFaceUse = MCH_MILL_FU.PARAL_DOWN
|
||||
local dHorizontalCutOffset = dHorizontalSliceHeight * -j
|
||||
local sLeadInOutType = 'PerpendicularOutraw'
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dHorizontalCutOffset, 0, 0, '', b3Raw, nil, nil, nil, sLeadInOutType, nil, dOffsetBetweenCuts)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
-- se necessario taglio verticale doppio, eseguo l'opposto
|
||||
if HeadCutType.bDoubleCut then
|
||||
-- gli accorciamenti vanno invertiti per il taglio opposto
|
||||
local dAccStartDoubleCut, dAccEndDoubleCut = dAccEnd, dAccStart
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, MCH_MILL_FU.ORTHO_BACK, nil, dCutExtra, BD.CUT_SIC, dCutXOffset, dAccStartDoubleCut, dAccEndDoubleCut, '', b3Raw, true)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
-- taglio verticale
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutXOffset, dAccStart, dAccEnd, '', b3Raw, true)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
return true, sWarn
|
||||
end
|
||||
|
||||
-- taglio a zero (con lama) per evitare problemi con grezzo più lungo del previsto. Se BigSection il pretaglio è già stato fatto.
|
||||
if not ( HeadCutType.bBigSectionCut) and BD.PRECUT_HEAD and HeadCutType.bNeedVerticalAddedCuts then
|
||||
dStartOffset = dOvmHead
|
||||
local bOkPrecut, sErrPrecut = MakeStandardCuts( Proc, b3Raw, 1, 0, PrecutType, Cutting1Data, Cutting2Data, dStartOffset)
|
||||
if not bOkPrecut then
|
||||
return false, sErrPrecut
|
||||
end
|
||||
end
|
||||
-- se necessari tagli in doppio, eseguo gli opposti
|
||||
if HeadCutType.bDoubleCut then
|
||||
-- gli accorciamenti vanno invertiti per il taglio opposto
|
||||
local dAccStartDoubleCut, dAccEndDoubleCut = dAccEnd, dAccStart
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsetBetweenCuts
|
||||
if i == 1 and HeadCutType.sType =='Precut' then
|
||||
dCutOffset = dStartOffset
|
||||
end
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, MCH_MILL_FU.ORTHO_BACK, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStartDoubleCut, dAccEndDoubleCut, '', b3Raw, true)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
end
|
||||
-- eseguo i tagli necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsetBetweenCuts
|
||||
-- se trave larga effettuo tagli verticali aggiuntivi
|
||||
if HeadCutType.bNeedVerticalAddedCuts then
|
||||
local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw, dOffsetBetweenCuts)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
if i == 1 and HeadCutType.sType =='Precut' then
|
||||
dCutOffset = dStartOffset
|
||||
end
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, '', b3Raw, true)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
-- altrimenti necessari tagli da sopra e sotto con testa opportuna
|
||||
else
|
||||
-- verifico esistenza della lavorazione con lama da sotto
|
||||
if not Cutting2Data.sCutting then
|
||||
local sErr = 'Error : cutting H2 not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- verifico che le due lame riescano a lavorare la sezione
|
||||
local dDimZ = b3Raw:getDimZ()
|
||||
local dExtra = Cutting1Data.dMaxVertDepth + Cutting2Data.dMaxDepth - dDimZ
|
||||
if ( dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0) and not HeadCutType.bBigSectionCut then
|
||||
local sErr = 'Error : section too big for head cut'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- calcolo extra taglio ed accorciamento
|
||||
local dCutExtra = -Cutting2Data.dMaxDepth + dExtra / 2 + BD.CUT_EXTRA_MIN
|
||||
local dCutExtra2 = -Cutting1Data.dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN
|
||||
local dAccStart = 0
|
||||
local dVzLimDwnUp
|
||||
if BD.TURN then dVzLimDwnUp = -2 end
|
||||
-- taglio a zero (con lama) per evitare problemi con grezzo più lungo del previsto. Se BigSection il pretaglio è già stato fatto.
|
||||
if not ( HeadCutType.bBigSectionCut) and BD.PRECUT_HEAD and HeadCutType.bNeedVerticalAddedCuts then
|
||||
dStartOffset = dOvmHead
|
||||
local bOkPrecut, sErrPrecut = MakeStandardCuts( Proc, b3Raw, 1, 0, PrecutType, Cutting1Data, Cutting2Data, dStartOffset)
|
||||
if not bOkPrecut then
|
||||
return false, sErrPrecut
|
||||
end
|
||||
end
|
||||
-- eseguo i tagli da sotto necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsetBetweenCuts
|
||||
if i == 1 and HeadCutType.sType =='Precut' then
|
||||
dCutOffset = dStartOffset
|
||||
end
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting2Data.sCutting, Cutting2Data.dSawDiam, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw, nil, true)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
-- eseguo i tagli da sopra necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsetBetweenCuts
|
||||
if i == 1 and HeadCutType.sType =='Precut' then
|
||||
dCutOffset = dStartOffset
|
||||
end
|
||||
-- se trave larga effettuo tagli verticali aggiuntivi
|
||||
if HeadCutType.bNeedVerticalAddedCuts then
|
||||
local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw, dOffsetBetweenCuts)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, MCH_MILL_FU.ORTHO_DOWN, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut)
|
||||
@@ -193,7 +464,15 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
|
||||
-- eventuali informazioni sul tipo di finitura
|
||||
local nQ05 = EgtGetInfo( nOriId or GDB_ID.NULL, 'Q05', 'i') or 0
|
||||
-- recupero la lavorazione
|
||||
local sCutting = ML.FindCutting( 'HeadSide')
|
||||
-- TODO questa parte andrà cambiata quando si gestiranno i volumi liberi in cui girare da mlse
|
||||
local dMinWidthForBigBlade = 300
|
||||
local dMaxHeightForBigBlade = 300
|
||||
local sCutting
|
||||
if b3Raw:getDimY() > dMinWidthForBigBlade and b3Raw:getDimZ() < dMaxHeightForBigBlade then
|
||||
sCutting = ML.FindCutting( 'HeadSide', nil, nil, nil, 'Longest')
|
||||
else
|
||||
sCutting = ML.FindCutting( 'HeadSide')
|
||||
end
|
||||
if not sCutting then
|
||||
local sErr = 'Error : cutting not found in library'
|
||||
EgtOutLog( sErr)
|
||||
@@ -223,27 +502,37 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
|
||||
dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2
|
||||
dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
|
||||
dSawThick2 = EgtTdbGetCurrToolParam(MCH_TP.THICK) or dSawThick2
|
||||
dSawThick2 = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick2
|
||||
end
|
||||
end
|
||||
-- determino se lo spessore del materiale da rimuovere è eccessivo e quindi vanno fatti più tagli con offset
|
||||
local nCuts = max( ceil( dOvmHead / (( BD.MAX_LEN_SCRAP_START or BD.MAX_LEN_SCRAP) + 0.5)), 1)
|
||||
local dOffsL = dOvmHead / nCuts
|
||||
-- caratteristiche taglio
|
||||
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
|
||||
( 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 + 10 * GEO.EPS_SMALL)
|
||||
local bHorizCut = ( ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA)
|
||||
local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
|
||||
local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
|
||||
local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL) and
|
||||
( b3Raw:getDimY() < 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
|
||||
-- verifico necessità di tagli aggiuntivi orizzontali o verticali
|
||||
local dMinOvmHeadForAddeddCuts = 10.123
|
||||
local bNeedVerticalAddedCuts = ( Proc.Face[1].WidthTrimmed > BD.MAX_LEN_DICE) and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL)
|
||||
local bNeedHorizontalAddedCuts = ( Proc.Face[1].HeightTrimmed > ( BD.MIN_HEIGHT_ADDED_CUTS or BD.MAX_LEN_DICE)) and
|
||||
not bBigSectionCut and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) and
|
||||
dOffsL < BD.MAX_DIM_DICE
|
||||
-- dati lavorazioni sopra e sotto
|
||||
local Cutting1Data = { sCutting = sCutting, dSawDiam = dSawDiam, dMaxDepth = dMaxDepth, dSawThick = dSawThick, dMaxVertDepth = dMaxVertDepth}
|
||||
local Cutting2Data = { sCutting = sCutting2, dSawDiam = dSawDiam2, dMaxDepth = dMaxDepth2, dSawThick = dSawThick2}
|
||||
-- dati sul taglio di testa da effettuare
|
||||
local HeadCutType = { bBigSectionCut = bBigSectionCut, bHorizCut = bHorizCut, bDoubleHorizCut = bDoubleHorizCut, bDoubleCut = bDoubleCut, bNeedVerticalAddedCuts = bNeedVerticalAddedCuts, bNeedHorizontalAddedCuts = bNeedHorizontalAddedCuts}
|
||||
-- dati geometrici del taglio
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
-- 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
|
||||
return true
|
||||
end
|
||||
-- determino se lo spessore del materiale da rimuovere è eccessivo e quindi vanno fatti più tagli con offset
|
||||
local nCuts = max( ceil( dOvmHead / (( BD.MAX_LEN_SCRAP_START or BD.MAX_LEN_SCRAP) + 0.5)), 1)
|
||||
local dOffsL = dOvmHead / nCuts
|
||||
local _, dimH, dimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
|
||||
local dMinOvmHeadForAddeddCuts = 10.123
|
||||
-- se taglio per sezioni alte e larghe
|
||||
if bBigSectionCut then
|
||||
if dOvmHead > 0 then
|
||||
@@ -259,11 +548,34 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
|
||||
else
|
||||
dMaxElev = Proc.Box:getMax():getX() - b3Raw:getMin():getX()
|
||||
end
|
||||
-- taglio a zero (con sega a catena o mix catena + lama) per evitare problemi con grezzo più lungo del previsto
|
||||
if BD.PRECUT_HEAD then
|
||||
-- recupero dati utensile della sega a catena più lunga a disposizione
|
||||
local sSawing = ML.FindSawing( 'SawingForSplitting', nil, nil, 'Longest')
|
||||
if not sSawing then
|
||||
sSawing = ML.FindSawing( 'Sawing', nil, nil, 'Longest')
|
||||
end
|
||||
local dChainSawMaxMat = 0
|
||||
local dChainSawLen = 0
|
||||
if EgtMdbSetCurrMachining( sSawing or '') then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dChainSawMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dChainSawMaxMat
|
||||
dChainSawLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dChainSawLen
|
||||
end
|
||||
end
|
||||
local SawingData = { sSawing = sSawing, dChainSawMaxMat = dChainSawMaxMat, dChainSawLen = dChainSawLen, bInvert = true}
|
||||
local dOffset = dOvmHead
|
||||
local bOkPrecut, sErrPrecut = Split.MakeBigSectionSplitting( Proc, b3Raw, dOffset, SawingData, Cutting2Data)
|
||||
if not bOkPrecut then
|
||||
return false, sErrPrecut
|
||||
end
|
||||
end
|
||||
-- controllo se è necessario un taglio con dicing o si deve proseguire ai casi standard
|
||||
if dMaxElev > dSawThickCheck then
|
||||
local bOk, sErr
|
||||
-- se trave larga effettuo tagli verticali aggiuntivi
|
||||
if ( dimH > BD.MAX_LEN_DICE) and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) then
|
||||
if bNeedVerticalAddedCuts then
|
||||
-- ad ogni offset di taglio dovrò fare prima i tagli verticali e poi i cubetti
|
||||
for i = nCuts, 1, -1 do
|
||||
local nAddGrpId = BL.GetAddGroup( Proc.PartId)
|
||||
@@ -285,14 +597,16 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
|
||||
if AreSameVectorApprox( X_AX(), vtNLimitingSurf) then EgtInvertSurf( nLimitingSurf) end
|
||||
end
|
||||
-- tagli verticali
|
||||
bOk, sErr = AddVerticalPreCuts( AddProc, sCutting, 0, b3Raw)
|
||||
bOk, sErr = AddVerticalPreCuts( AddProc, sCutting, 0, b3Raw, dOffsL)
|
||||
if not bOk then return bOk, sErr end
|
||||
-- tagli a cubetti con eventuale superficie limitante
|
||||
bOk, sErr = Cut.Make( AddProc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, dCurrOvmT, nil, nLimitingSurf)
|
||||
local sLeadInOutType = 'PerpendicularOutraw'
|
||||
bOk, sErr = Cut.Make( AddProc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, nil, nil, nLimitingSurf, sLeadInOutType)
|
||||
end
|
||||
-- tagli aggiuntivi non necessari
|
||||
else
|
||||
bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, dCurrOvmT)
|
||||
local sLeadInOutType = 'PerpendicularOutraw'
|
||||
bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, nil, nil, nil, sLeadInOutType)
|
||||
end
|
||||
return bOk, sErr
|
||||
end
|
||||
@@ -315,130 +629,21 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se tagli standard
|
||||
if not bDoubleHorizCut then
|
||||
-- flag di lavorazione faccia
|
||||
local nOrthoOpposite = EgtIf( bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_FRONT)
|
||||
-- calcolo extra taglio ed accorciamento
|
||||
local dCutExtra = 0
|
||||
local dAccStart = 0
|
||||
local dAccEnd = 0
|
||||
if b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL or b3Raw:getDimY() < 2 * BD.MAX_DIM_HTCUT_HBEAM + 10 * GEO.EPS_SMALL then
|
||||
dCutExtra = EgtIf( bDoubleCut, - 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN, BD.CUT_EXTRA)
|
||||
else
|
||||
dCutExtra = - ( b3Raw:getDimY() - dMaxDepth)
|
||||
local dSawRad = dSawDiam / 2
|
||||
-- distanza in Y tra il centro della lama e l'intersezione tra la lama stessa e la massima Z della trave, + extra
|
||||
-- se taglio doppio l'intersezione sarà in mezzeria, se taglio singolo sarà all'estremo opposto della trave
|
||||
local dKL = dSawRad - dMaxDepth + EgtIf( bDoubleCut, b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN, b3Raw:getDimY() + BD.CUT_EXTRA)
|
||||
-- lunghezza minima del percorso di lavorazione, in caso accorciamento porti a lunghezza negativa
|
||||
local dMinSawingLength = 5
|
||||
if BD.C_SIMM then
|
||||
dAccEnd = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0))
|
||||
-- non posso comunque accorciare più della dimensione della geometria, quindi in caso allungo entrata
|
||||
if dAccEnd > b3Raw:getDimZ() - 100 * GEO.EPS_SMALL then
|
||||
dAccStart = b3Raw:getDimZ() - dAccEnd - dMinSawingLength
|
||||
end
|
||||
else
|
||||
dAccStart = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0))
|
||||
-- non posso comunque accorciare più della dimensione della geometria, quindi in caso allungo uscita
|
||||
if dAccStart > b3Raw:getDimZ() - 100 * GEO.EPS_SMALL then
|
||||
dAccEnd = b3Raw:getDimZ() - dAccStart - dMinSawingLength
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local bOk, sErr = MakeStandardCuts( Proc, b3Raw, nCuts, dOffsL, HeadCutType, Cutting1Data, Cutting2Data, nil, dOvmHead)
|
||||
|
||||
-- per travi alte faccio dei tagli orizzontali aggiuntivi
|
||||
local bAreHorizontalCutsNeeded = ( dimV > BD.MAX_LEN_DICE) and not bBigSectionCut and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL)
|
||||
if bAreHorizontalCutsNeeded then
|
||||
local nHorizontalCuts = ceil( dimV / BD.MAX_DIM_DICE) - 1
|
||||
local dHorizontalSliceHeight = dimV / ( nHorizontalCuts + 1)
|
||||
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
|
||||
if bDoubleCut then
|
||||
-- gli accorciamenti vanno invertiti per il taglio opposto
|
||||
local dAccStartDoubleCut, dAccEndDoubleCut = dAccEnd, dAccStart
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
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
|
||||
end
|
||||
end
|
||||
-- eseguo i tagli necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
-- se trave larga effettuo tagli verticali aggiuntivi
|
||||
if ( dimH > BD.MAX_LEN_DICE) and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) then
|
||||
local bOk, sErr = AddVerticalPreCuts( Proc, sCutting, dCutOffset, b3Raw)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, '', b3Raw)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
-- altrimenti necessari tagli da sopra e sotto con testa opportuna
|
||||
-- alla fine del taglio si aggiungono gli smussi in testa
|
||||
local _, sErrHeadChamfer = MakeHeadChamfer( nOriId or Proc.Id, nPartId)
|
||||
if sErr then
|
||||
sErr = sErr..'\n'..sErrHeadChamfer
|
||||
else
|
||||
-- verifico esistenza della lavorazione con lama da sotto
|
||||
if not sCutting2 then
|
||||
local sErr = 'Error : cutting H2 not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- verifico che le due lame riescano a lavorare la sezione
|
||||
local dDimZ = b3Raw:getDimZ()
|
||||
local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ
|
||||
if ( dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0) and not bBigSectionCut then
|
||||
local sErr = 'Error : section too big for head cut'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- calcolo extra taglio ed accorciamento
|
||||
local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN
|
||||
local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN
|
||||
local dAccStart = 0
|
||||
local dVzLimDwnUp
|
||||
if BD.TURN then dVzLimDwnUp = -2 end
|
||||
-- eseguo i tagli da sotto necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw, nil, true)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
-- eseguo i tagli da sopra necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
-- se trave larga effettuo tagli verticali aggiuntivi
|
||||
if ( dimH > BD.MAX_LEN_DICE) and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) then
|
||||
local bOk, sErr = AddVerticalPreCuts( Proc, sCutting, dCutOffset, b3Raw)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_DOWN, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
sErr = sErrHeadChamfer
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
return bOk, sErr
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
return ProcessHeadCut
|
||||
|
||||
+2419
-159
File diff suppressed because it is too large
Load Diff
+63
-47
@@ -34,6 +34,8 @@
|
||||
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
|
||||
-- 2024/01/18 Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile.
|
||||
-- 2024/01/22 Implementata gestione seghe a catena multiple.
|
||||
-- 2024/05/09 In Make, allungamento percorso ingresso per evitare collisioni durante approccio pezzo quando si setta OutRaw=3
|
||||
-- In Make, se non trova fresa per pulizia, da messaggio di warning anziché di errore
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessLongCut = {}
|
||||
@@ -293,7 +295,7 @@ local function MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw, nFacInd, bReduceDe
|
||||
-- laterale sul punto medio della linea in comune
|
||||
local frFc = Frame3d( ptPm, vtN) ;
|
||||
local b3BoxLoc = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frFc)
|
||||
dDepth = b3BoxLoc:getDimZ() or 0
|
||||
local dDepth = b3BoxLoc:getDimZ() or 0
|
||||
-- recupero i dati dell'utensile
|
||||
local dSawDiam = 400
|
||||
local dSawThick = 0
|
||||
@@ -510,6 +512,7 @@ local function MakeSideFaceByChainSaw( nSurfId, dDepth, dOffs, dSal, dEal, bShor
|
||||
local dSawCornerRad = 0
|
||||
local dSawThick = 0
|
||||
local dSawDiameter = 0
|
||||
local sWarn
|
||||
-- se non trova una lavorazione di sawing esco
|
||||
if not sSawing then
|
||||
local sErr = 'Error : Sawing not found in library'
|
||||
@@ -969,58 +972,57 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
||||
local dElev = BL.GetFaceElevation( Proc, 0, b3Solid)
|
||||
-- recupero la lavorazione
|
||||
local sMilling = ML.FindMilling( 'Long2Cut_H2', dElev, nil, nil, nil, not bCanUseUnderBlade, bCanUseUnderBlade)
|
||||
if not sMilling then
|
||||
local sErr = 'Error : milling Long2Cut (_H2) not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- recupero i dati dell'utensile
|
||||
local dToolDiam = 0
|
||||
local dMaxDepth = 0
|
||||
if EgtMdbSetCurrMachining( sMilling) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
if sMilling then
|
||||
-- recupero i dati dell'utensile
|
||||
local dToolDiam = 0
|
||||
local dMaxDepth = 0
|
||||
if EgtMdbSetCurrMachining( sMilling) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se ho facce di chiusura, per prima cosa faccio antischeggia
|
||||
-- come richiesto da Fabio Squaratti il 03/09/2021
|
||||
if ( bLimXmin and not bForcedLim) or bLimXmax then
|
||||
local bOk, nFacet
|
||||
bMadeASbyBld, bOk, sWarn = ManageAntiSplintBySaw( Proc, b3Raw, (( bLimXmin and not bForcedLim) and bLimXmax), vtN, nFacet, 0, sWarn, bCanUseUnderBlade, nil, sCutting)
|
||||
if not bOk then return false, sWarn end
|
||||
end
|
||||
-- eventuale lavorazione della faccia limitante l'inizio
|
||||
if not bStartFixed then
|
||||
local vtIni = -X_AX()
|
||||
for j = 1, Proc.Fct - 1 do
|
||||
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, j, GDB_ID.ROOT)
|
||||
if vtIni * vtN > 0 and nCountMilHead < 2 then
|
||||
MakeSideFace( Proc.Id, j, nSide, sMilling, dToolDiam, nil, max(dStartDistUp,dStartDistDn), bCanUseUnderBlade)
|
||||
-- se ho facce di chiusura, per prima cosa faccio antischeggia
|
||||
-- come richiesto da Fabio Squaratti il 03/09/2021
|
||||
if ( bLimXmin and not bForcedLim) or bLimXmax then
|
||||
local bMadeASbyBld, bOk, nFacet
|
||||
bMadeASbyBld, bOk, sWarn = ManageAntiSplintBySaw( Proc, b3Raw, (( bLimXmin and not bForcedLim) and bLimXmax), vtN, nFacet, 0, sWarn, bCanUseUnderBlade, nil, sCutting)
|
||||
if not bOk then return false, sWarn end
|
||||
end
|
||||
-- eventuale lavorazione della faccia limitante l'inizio
|
||||
if not bStartFixed then
|
||||
local vtIni = -X_AX()
|
||||
for j = 1, Proc.Fct - 1 do
|
||||
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, j, GDB_ID.ROOT)
|
||||
if vtIni * vtN > 0 and nCountMilHead < 2 then
|
||||
MakeSideFace( Proc.Id, j, nSide, sMilling, dToolDiam, nil, max(dStartDistUp,dStartDistDn), bCanUseUnderBlade)
|
||||
nCountMilHead = nCountMilHead + 1
|
||||
end
|
||||
end
|
||||
if bForcedLim and nCountMilHead < 1 then
|
||||
MakeSideFace( Proc.Id, 0, nSide, sMilling, dToolDiam, bForcedLim, max(dStartDistUp,dStartDistDn), bCanUseUnderBlade)
|
||||
nCountMilHead = nCountMilHead + 1
|
||||
end
|
||||
end
|
||||
if bForcedLim and nCountMilHead < 1 then
|
||||
MakeSideFace( Proc.Id, 0, nSide, sMilling, dToolDiam, bForcedLim, max(dStartDistUp,dStartDistDn), bCanUseUnderBlade)
|
||||
nCountMilHead = nCountMilHead + 1
|
||||
end
|
||||
end
|
||||
|
||||
-- eventuale lavorazione della faccia limitante la fine
|
||||
if not bEndFixed then
|
||||
local vtFin = X_AX()
|
||||
for j = 1, Proc.Fct - 1 do
|
||||
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, j, GDB_ID.ROOT)
|
||||
if vtFin * vtN > 0 and nCountMilHead < 2 then
|
||||
MakeSideFace( Proc.Id, j, nSide, sMilling, dToolDiam, nil, max(dEndDistUp,dEndDistDn), bCanUseUnderBlade)
|
||||
-- eventuale lavorazione della faccia limitante la fine
|
||||
if not bEndFixed then
|
||||
local vtFin = X_AX()
|
||||
for j = 1, Proc.Fct - 1 do
|
||||
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, j, GDB_ID.ROOT)
|
||||
if vtFin * vtN > 0 and nCountMilHead < 2 then
|
||||
MakeSideFace( Proc.Id, j, nSide, sMilling, dToolDiam, nil, max(dEndDistUp,dEndDistDn), bCanUseUnderBlade)
|
||||
nCountMilHead = nCountMilHead + 1
|
||||
end
|
||||
end
|
||||
if bForcedLim and nCountMilHead < 2 then
|
||||
MakeSideFace( Proc.Id, 0, nSide, sMilling, dToolDiam, bForcedLim, max(dEndDistUp,dEndDistDn), bCanUseUnderBlade)
|
||||
nCountMilHead = nCountMilHead + 1
|
||||
end
|
||||
end
|
||||
if bForcedLim and nCountMilHead < 2 then
|
||||
MakeSideFace( Proc.Id, 0, nSide, sMilling, dToolDiam, bForcedLim, max(dEndDistUp,dEndDistDn), bCanUseUnderBlade)
|
||||
nCountMilHead = nCountMilHead + 1
|
||||
end
|
||||
else
|
||||
sWarn = 'Warning: milling Long2Cut (_H2) not found in library'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1215,7 +1217,6 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
||||
if not bChainSawOk then return false, sErr end
|
||||
end
|
||||
end
|
||||
|
||||
-- se non è sotto e non uso fresa di fianco: lavorazione Long2Cut
|
||||
elseif ( nSide ~= - 1 or BD.DOWN_HEAD) and nUseMillOnSide == 0 then
|
||||
-- determino la massima elevazione
|
||||
@@ -1390,7 +1391,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ Proc.Id, 0}})
|
||||
-- inverto se utensile antiorario per garantire senso di percorrenza migliore
|
||||
local bInvert = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0
|
||||
local bInvert = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) > 0
|
||||
-- setto workside e eventuale inversione
|
||||
if bInvert then
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
||||
@@ -1426,6 +1427,21 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
||||
if k < nO then
|
||||
local sNotes = 'OutRaw=3;'
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
|
||||
-- aumento ingresso su spezzoni per evitare collisione durante approccio pezzo
|
||||
if bFront then
|
||||
-- se invertito si allunga ingresso su tutti tranne su ultimo
|
||||
if bInvert and i ~= nC then
|
||||
EgtSetMachiningParam( MCH_MP.LIPERP, ( nO - k) * dStep + 10)
|
||||
-- se non invertito si allunga solo il primo
|
||||
elseif not bInvert and i == 1 then
|
||||
EgtSetMachiningParam( MCH_MP.LIPERP, ( nO - k) * dStep + 10)
|
||||
end
|
||||
else
|
||||
-- se invertito si allunga ingresso su tutti
|
||||
if bInvert then
|
||||
EgtSetMachiningParam( MCH_MP.LIPERP, ( nO - k) * dStep + 10)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
-- 2023/11/24 Aggiunta Q05 per utilizzo lama anche in feature cieche conme per LongCut.
|
||||
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
|
||||
-- 2024/01/18 Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile.
|
||||
-- 2024/03/21 Corretto parametro passato a funzione BL.GetBlockedAxis. Ora tiene in considerazione anche testa sotto
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessLong2Cut = {}
|
||||
@@ -36,6 +37,7 @@ EgtOutLog( ' ProcessLongDoubleCut started', 1)
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local ML = require( 'MachiningLib')
|
||||
local Topology = require( 'FeatureTopology')
|
||||
|
||||
local dLimMinPiece = BD.LEN_SHORT_PART or 1000
|
||||
|
||||
@@ -284,9 +286,11 @@ local function CalcBladeUse( bUseBlade, bDown_Head, nSide, vtN1, vtN2, bConvex,
|
||||
end
|
||||
end
|
||||
else
|
||||
if ( vtN1 and vtN1:getZ() >= EgtIf( dCustomAngle, dCustomAngle, -0.5)) and ( not vtN2 or vtN2:getZ() >= -0.5) then
|
||||
bCanUseBlade = true
|
||||
end
|
||||
--if ( vtN1 and vtN1:getZ() >= EgtIf( dCustomAngle, dCustomAngle, -0.5)) and ( not vtN2 or vtN2:getZ() >= -0.5) then
|
||||
-- bCanUseBlade = true
|
||||
--end
|
||||
-- viene abilitata sempre lama da sotto
|
||||
bCanUseBlade = true
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -323,6 +327,9 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
local nFaceLimit, tFaceLong, ptC, vtN = IdentifyFaces( Proc)
|
||||
local dLen = Proc.Box:getDimX()
|
||||
|
||||
-- inizializzazione tabella con eventuali lavorazioni create a posteriori da ritornare al chiamante
|
||||
local AddedIds = {}
|
||||
|
||||
-- recupero lunghezza grezzo totale da info sulla macchinata
|
||||
local dBarLen = EgtGetInfo( EgtGetCurrMachGroup(), 'BARLEN', 'd')
|
||||
local dOvmHead = b3Raw:getMax():getX() - b3Solid:getMax():getX()
|
||||
@@ -418,12 +425,22 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
-- analisi del taglio
|
||||
local vOrd = {}
|
||||
local vFaceUse = {}
|
||||
local bIsMachDownUp = false
|
||||
if nSide == 1 or ( nSide == -1 and ( BD.DOWN_HEAD or BD.TURN)) then
|
||||
vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1})
|
||||
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
|
||||
elseif nSide == -1 then
|
||||
vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1})
|
||||
vFaceUse = { BL.GetNearestParalOpposite( ptC[1] - ptM), BL.GetNearestParalOpposite( ptC[2] - ptM)}
|
||||
local vtFaceUse1, vtFaceUse2
|
||||
if bCanUseBlade and not BD.DOWN_HEAD then
|
||||
bIsMachDownUp = true
|
||||
vtFaceUse1 = BL.GetOrtupOpposite( BL.GetNearestOrthoOpposite( ptC[1] - ptM))
|
||||
vtFaceUse2 = BL.GetOrtupOpposite( BL.GetNearestOrthoOpposite( ptC[2] - ptM))
|
||||
else
|
||||
vtFaceUse1 = BL.GetNearestParalOpposite( ptC[1] - ptM)
|
||||
vtFaceUse2 = BL.GetNearestParalOpposite( ptC[2] - ptM)
|
||||
end
|
||||
vFaceUse = { vtFaceUse1, vtFaceUse2}
|
||||
else
|
||||
local bFront = ( ( vtN[1]:getY() + vtN[2]:getY()) < 0)
|
||||
if bFront then
|
||||
@@ -437,6 +454,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
local vWidth = {}
|
||||
_, _, vWidth[1] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[1])
|
||||
_, _, vWidth[2] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[2])
|
||||
local vElevation = { vWidth[2], vWidth[1]}
|
||||
|
||||
-- Se da sopra o ( da tutte i lati con testa da sotto) e taglio di lama e lunghezza facce maggiore del parametro lunghezza minima
|
||||
if ( bCanUseUnderBlade or bCanUseBlade) and bUseBlade and Proc.Box:getDimX() > dLimMinPiece - 1 then
|
||||
@@ -833,17 +851,19 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
|
||||
-- recupero alcune informazioni utili dalla lavorazione attuale
|
||||
local bIsCurrentBladeCCW
|
||||
local sCuttingNameMach
|
||||
if bIsTopBladeCurrent then
|
||||
EgtMdbSetCurrMachining( sCutting)
|
||||
sCuttingNameMach = sCutting
|
||||
else
|
||||
EgtMdbSetCurrMachining( sCuttingDn)
|
||||
sCuttingNameMach = sCuttingDn
|
||||
end
|
||||
EgtMdbSetCurrMachining( sCuttingNameMach)
|
||||
bIsCurrentBladeCCW = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0
|
||||
|
||||
-- imposto la direzione di lavoro per avere scarico del truciolo ottimale
|
||||
local nWorkSide, bInvert
|
||||
if ( not bIsTopBladeCurrent and abs( nSide) ~= 0) or ( bCanUseBlade and bCanUseUnderBlade and nSide == -1) then
|
||||
if bIsCurrentBladeCCW then
|
||||
if bIsCurrentBladeCCW and not bIsMachDownUp then
|
||||
nWorkSide = MCH_MILL_WS.LEFT
|
||||
bInvert = true
|
||||
dSal, dEal = dEal, dSal
|
||||
@@ -852,7 +872,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
bInvert = false
|
||||
end
|
||||
else
|
||||
if bIsCurrentBladeCCW then
|
||||
if bIsCurrentBladeCCW and not bIsMachDownUp then
|
||||
nWorkSide = MCH_MILL_WS.LEFT
|
||||
bInvert = false
|
||||
else
|
||||
@@ -880,7 +900,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
-- imposto angolo 3° asse rot
|
||||
local vtOut = EgtIf( vtN[vOrd[j]]:getX() > 0, X_AX(), -X_AX())
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCutting, 'perpendicular', b3Raw, vtN, vtOut))
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCuttingNameMach, 'perpendicular', b3Raw, vtN, vtOut))
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
@@ -942,18 +962,6 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
end
|
||||
-- altrimenti concavo
|
||||
else
|
||||
-- se effettivamente un taglio longitudinale e lama non taglia completamente, limito la lavorazione. Altrimenti esco.
|
||||
for k = 1, #vOrd do
|
||||
if vWidth[vOrd[k]] + BD.CUT_SIC > dMaxDepth then
|
||||
if not( ProcessLong2Cut.Identify( Proc)) then
|
||||
return false
|
||||
else
|
||||
local sWarn2 = 'Warning in ' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. ' : elevation (' .. EgtNumToString( vWidth[vOrd[k]], 1) .. ') bigger than max saw depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
|
||||
if not sWarn then sWarn = '' end
|
||||
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- si percorrono i lati alto e basso della faccia
|
||||
for i = 1, nC do
|
||||
-- Posizione braccio portatesta
|
||||
@@ -983,6 +991,22 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- se effettivamente un taglio longitudinale e lama non taglia completamente, limito la lavorazione. Altrimenti esco.
|
||||
local dCheckDepth = 0
|
||||
if bCanUseBlade then
|
||||
dCheckDepth = dMaxDepth
|
||||
elseif bCanUseUnderBlade then
|
||||
dCheckDepth = dMaxDepthDn
|
||||
end
|
||||
if vWidth[vOrd[j]] + 100 * GEO.EPS_SMALL > dCheckDepth then
|
||||
if not( ProcessLong2Cut.Identify( Proc)) then
|
||||
return false
|
||||
else
|
||||
local sWarn2 = 'Warning in ' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. ' : elevation (' .. EgtNumToString( vWidth[vOrd[j]], 1) .. ') bigger than max saw depth (' .. EgtNumToString( dCheckDepth, 1) .. ')'
|
||||
if not sWarn then sWarn = '' end
|
||||
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2)
|
||||
end
|
||||
end
|
||||
-- se lama da sotto verifico se la componente Y della profondità di taglio supera la capacità della lama
|
||||
if nSide <= 0 and bCanUseUnderBlade then
|
||||
if ( vWidth[vOrd[j]] / 2) > dMaxDepthDn then
|
||||
@@ -996,7 +1020,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
local dLioPerp
|
||||
|
||||
if j == 1 then -- il primo taglio lo faccio completo se angolo interno maggiore di 90
|
||||
local dMinOffsBigFace = max( vWidth[vOrd[j]] - dMaxDepth, 0)
|
||||
local dMinOffsBigFace = max( vWidth[vOrd[j]] - dCheckDepth, 0)
|
||||
-- se la faccia è più grande del massimo materiale lama, allora limito lavorazione
|
||||
if dMinOffsBigFace > 0 then
|
||||
dOffset = dMinOffsBigFace
|
||||
@@ -1008,7 +1032,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
end
|
||||
dLioPerp = vWidth[vOrd[j]] + BD.CUT_SIC
|
||||
else -- il secondo ridotto della distanza minima e della componente spessore della lama
|
||||
local dMinOffsBigFace = max( vWidth[vOrd[j]] - dMaxDepth, 0)
|
||||
local dMinOffsBigFace = max( vWidth[vOrd[j]] - dCheckDepth, 0)
|
||||
-- se la faccia è più grande del massimo materiale lama, allora limito lavorazione
|
||||
if dMinOffsBigFace > 0 then
|
||||
dOffset = dMinOffsBigFace
|
||||
@@ -1055,6 +1079,11 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
if nSide == -1 and BD.DOWN_HEAD then
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
|
||||
elseif nSide == -1 and not BD.DOWN_HEAD and bIsMachDownUp then
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( EgtGetMachiningParam( MCH_MP.INVERT), false, true))
|
||||
dOffset = 5
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
|
||||
else
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)
|
||||
@@ -1067,12 +1096,27 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
EgtSetMachiningParam( MCH_MP.LOTANG, dLioTang)
|
||||
EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp)
|
||||
-- imposto posizione braccio porta testa per non ingombrare agli estremi
|
||||
local ptP1LineToMachine, _, ptP2LineToMachine = EgtSurfTmFacetOppositeSide( Proc.Id, vOrd[j] - 1, BL.GetVersRef( vFaceUse[vOrd[j]]), GDB_ID.ROOT)
|
||||
local vtTg = ptP2LineToMachine - ptP1LineToMachine ; vtTg:normalize()
|
||||
local bIsMachiningInverted = EgtGetMachiningParam( MCH_MP.INVERT)
|
||||
if bIsMachiningInverted then
|
||||
vtTg = -vtTg
|
||||
end
|
||||
if BD.C_SIMM then
|
||||
if abs( vtN[vOrd[j]]:getX()) < GEO.EPS_SMALL then
|
||||
nSCC = EgtIf( ( vtTg:getX() > GEO.EPS_SMALL), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
|
||||
else
|
||||
nSCC = MCH_SCC.NONE
|
||||
end
|
||||
else
|
||||
nSCC = EgtIf( ( i == 1 or i == nC - 1), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
-- determino e imposto l'utilizzo della faccia
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse[vOrd[j]])
|
||||
-- imposto angolo 3° asse rot
|
||||
local vtOut = EgtIf( vtN[vOrd[j]]:getX() > 0, X_AX(), -X_AX())
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCutting, 'perpendicular', b3Raw, vtN, vtOut))
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( EgtIf( bCanUseUnderBlade, sCuttingDn, sCutting), 'perpendicular', b3Raw, vtN, vtOut))
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
@@ -1236,10 +1280,10 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
nFin = 1
|
||||
else
|
||||
if vtN[vOrd[1]]:getZ() >= vtN[vOrd[2]]:getZ() then
|
||||
if vtN[vOrd[2]]:getZ() < dLimitAngle then
|
||||
nFin = 1
|
||||
else
|
||||
if vtN[vOrd[1]]:getZ() < dLimitAngle then
|
||||
nIni = 2
|
||||
else
|
||||
nFin = 1
|
||||
end
|
||||
else
|
||||
if vtN[vOrd[1]]:getZ() < dLimitAngle then
|
||||
@@ -1251,12 +1295,18 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
end
|
||||
end
|
||||
end
|
||||
if Proc.bMoveAfterSplit then
|
||||
nC = 1
|
||||
dStartDist = Proc.Box:getDimX() - ( dToolDiam / 2 + 5)
|
||||
dEndDist = - ( dToolDiam / 2 + 5)
|
||||
end
|
||||
if nIni == 2 then
|
||||
dStartDist, dEndDist = dEndDist, dStartDist
|
||||
dStartAccDist, dEndAccDist = dEndAccDist, dStartAccDist
|
||||
end
|
||||
-- ciclo sulle parti
|
||||
local nM = 0
|
||||
local bInverted = false
|
||||
for j = 1, nC do
|
||||
-- su entrambe le facce
|
||||
for i = nIni, nFin do
|
||||
@@ -1280,8 +1330,11 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
if nSide == 1 or nSide == -1 then
|
||||
local bFromYM = (( vtN[vOrd[i]]:getY() < 0 and bConvex) or ( vtN[vOrd[i]]:getY() > 0 and not bConvex))
|
||||
nSCC = EgtIf( bFromYM, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)
|
||||
if BD.TURN == 2 and not bFromYM then
|
||||
nSCC = EgtIf( nSide == -1, MCH_SCC.ADIR_ZM, MCH_SCC.ADIR_ZP)
|
||||
end
|
||||
else
|
||||
local bFromZM = (( vtN[vOrd[i]]:getZ() < 0 and bConvex) or ( vtN[vOrd[i]]:getZ() > 0 and not bConvex))
|
||||
local bFromZM = (( vtN[vOrd[i]]:getZ() < 10 * GEO.EPS_ANG_SMALL and bConvex) or ( vtN[vOrd[i]]:getZ() > - 10 * GEO.EPS_ANG_SMALL and not bConvex))
|
||||
nSCC = EgtIf( bFromZM, MCH_SCC.ADIR_ZM, MCH_SCC.ADIR_ZP)
|
||||
end
|
||||
end
|
||||
@@ -1294,7 +1347,24 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
local dStep = 0
|
||||
local dAgg = EgtIf( bConvex, 2 * BD.CUT_EXTRA, BD.CUT_EXTRA)
|
||||
local dLargh = vWidth[vOrd[i]]
|
||||
if not bSide and dLargh > 0.8 * dToolDiam then
|
||||
-- controllo se lavorazione completa
|
||||
local dMachDepth = vElevation[vOrd[i]]
|
||||
if dMachDepth > dMaxDepth - 10 * GEO.EPS_ANG_SMALL then
|
||||
-- verifico se posso lavorare la faccia 2
|
||||
local nOtherFace = EgtIf( i == 1, 2, 1)
|
||||
if Proc.Fct == 2 and j == 1 and vtN[vOrd[nOtherFace]]:getZ() > dLimitAngle and vWidth[vOrd[i]] < dMaxDepth then
|
||||
vOrd[1], vOrd[2] = vOrd[2], vOrd[1]
|
||||
dLargh = vWidth[vOrd[i]]
|
||||
dSal, dEal = dEal, dSal
|
||||
bInverted = true
|
||||
else
|
||||
sWarn = 'Warning : elevation bigger than max tool depth'
|
||||
EgtOutLog( sWarn)
|
||||
end
|
||||
elseif bInverted then
|
||||
dSal, dEal = dEal, dSal
|
||||
end
|
||||
if not bSide and dLargh > 0.8 * dToolDiam then
|
||||
nO = ceil( dLargh / ( 0.6 * dToolDiam))
|
||||
if nO > 1 then
|
||||
dStep = dLargh / nO
|
||||
@@ -1327,7 +1397,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
--EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( bSide, BL.GetParallelOpposite( vFaceUse[vOrd[i]]), vFaceUse[vOrd[i]]))
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( bSide, MCH_MILL_FU.PARAL_DOWN, vFaceUse[vOrd[i]]))
|
||||
-- imposto lato di lavoro e inversione
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bIsMachDownUp, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT))
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bSide, true, false))
|
||||
-- imposto offset radiale (nullo se concavo o di lato)
|
||||
local dOffsR = EgtIf( k < nO, ( nO - k) * dStep, EgtIf( bConvex, - BD.CUT_EXTRA, 0))
|
||||
@@ -1362,6 +1432,20 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
end
|
||||
end
|
||||
end
|
||||
if not Proc.bMoveAfterSplit and not bConvex and Proc.AffectedFaces.Left then
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error : missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
local AddId = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
|
||||
local AddProc = { Id = AddId, Grp = 0, Prc = 12, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
PartId = Proc.PartId, TaskId = Proc.TaskId, CutId = Proc.CutId, bMoveAfterSplit = true}
|
||||
Topology.Classify( AddProc, b3Raw)
|
||||
table.insert( AddedIds, AddProc)
|
||||
end
|
||||
|
||||
-- altrimenti lavorazione di fianco : Long2CutSide o Long2CutDown
|
||||
else
|
||||
@@ -1749,7 +1833,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
end
|
||||
end
|
||||
-- imposto lato di lavoro e inversione
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bIsMachDownUp, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT))
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
-- calcolo la componente dNz non in base alla classificazione della feature (sopra, sotto, fianchi) ma alla componente maggiore
|
||||
-- local dNz = EgtIf( nSide == 0, vtN[vOrd[i]]:getY(), vtN[vOrd[i]]:getZ())
|
||||
@@ -1777,7 +1861,6 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
sWarn = 'Warning in LongDoubleCut : depth (' .. EgtNumToString( vWidth[vOrd[i]] + dAgg, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepthDn - dCollSic, 1) .. ')'
|
||||
end
|
||||
dDepth = min( dMaxDepthDn - dCollSic, vWidth[vOrd[i]] + dAgg)
|
||||
dDepth2 = vWidth[vOrd[i]] + dAgg - dDepth
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth - dExtraElev)
|
||||
else
|
||||
dCollSic = max( BD.COLL_SIC, ( dThDiam - dToolDiam) / 2 * EgtIf( abs(dNz) < GEO.EPS_SMALL, 1, abs( EgtIf( abs(vtN[vOrd[i]]:getY()) >= abs(vtN[vOrd[i]]:getZ()), vtN[vOrd[i]]:getZ(), vtN[vOrd[i]]:getY()) / dNz)))
|
||||
@@ -1785,7 +1868,6 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
sWarn = 'Warning in LongDoubleCut : depth (' .. EgtNumToString( vWidth[vOrd[i]] + dAgg, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth - dCollSic, 1) .. ')'
|
||||
end
|
||||
dDepth = min( dMaxDepth - dCollSic, vWidth[vOrd[i]] + dAgg)
|
||||
dDepth2 = vWidth[vOrd[i]] + dAgg - dDepth
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth - dExtraElev)
|
||||
end
|
||||
-- eseguo
|
||||
@@ -1806,8 +1888,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
end
|
||||
end
|
||||
|
||||
return true, sWarn
|
||||
end
|
||||
return true, sWarn, nil, AddedIds
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
return ProcessLong2Cut
|
||||
|
||||
+11
-11
@@ -3,6 +3,7 @@
|
||||
-- 2020/05/28 Tipo di lavorazione passato da Mark a Text.
|
||||
-- 2021/05/03 Aggiunta gestione testa da sotto.
|
||||
-- 2022/12/05 Aggiunta gestione tipo di lavorazione Text_AT.
|
||||
-- 2024/09/04 In Make gestione di più geometrie ausiliarie ( ora si lavora anche il testo, oltre che alle linee di marcatura)
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessMark = {}
|
||||
@@ -50,9 +51,6 @@ end
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessMark.Make( Proc, nPhase, nRawId, nPartId)
|
||||
-- recupero eventuale geometria ausiliaria
|
||||
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
|
||||
if AuxId then AuxId = AuxId + Proc.Id end
|
||||
-- recupero i dati della marcatura
|
||||
local vtExtr
|
||||
if EgtGetType( Proc.Id) ~= GDB_TY.EXT_TEXT then
|
||||
@@ -108,13 +106,15 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId)
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sErr
|
||||
end
|
||||
-- eventuale lavorazione su seconda geometria
|
||||
if AuxId then
|
||||
-- si verifica se ci sono altre geometrie da lavorare
|
||||
local AdditionalGeometries = EgtSplitString( EgtGetInfo( Proc.Id, 'AUXID', 's')) or {}
|
||||
for i = 1, #AdditionalGeometries do
|
||||
local AuxId = Proc.Id + AdditionalGeometries[i]
|
||||
-- inserisco la lavorazione di fresatura
|
||||
local sName2 = 'Decor2_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchF2Id = EgtAddMachining( sName, sMilling)
|
||||
if not nMchF2Id then
|
||||
local sErr = 'Error adding machining ' .. sName2 .. '-' .. sMilling
|
||||
local nOtherMachiningId = EgtAddMachining( sName, sMilling)
|
||||
if not nOtherMachiningId then
|
||||
sName = 'Decor' .. '_' .. tostring( i) .. '_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
@@ -125,14 +125,14 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchF2Id, false)
|
||||
EgtSetOperationMode( nOtherMachiningId, false)
|
||||
return false, sErr
|
||||
end
|
||||
-- se geometria a X maggiore, la sposto prima
|
||||
local ptS1 = EgtSP( Proc.Id, GDB_ID.ROOT)
|
||||
local ptS2 = EgtSP( AuxId, GDB_ID.ROOT)
|
||||
if ptS2:getX() > ptS1:getX() then
|
||||
EgtRelocateGlob( nMchF2Id, nMchFId, GDB_IN.BEFORE)
|
||||
EgtRelocateGlob( nOtherMachiningId, nMchFId, GDB_IN.BEFORE)
|
||||
end
|
||||
end
|
||||
return true
|
||||
|
||||
+171
-7
@@ -15,6 +15,7 @@
|
||||
-- 2023/08/10 Modificata scelta SCC per tasche in Y+/- in coda o quasi.
|
||||
-- 2024/01/18 Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile.
|
||||
-- 2024/02/28 Forzata SPIRAL_IN se c'è anche un solo lato aperto
|
||||
-- 2024/03/05 Aggiunta possibilità di inserire lavorazione di smusso
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessMortise = {}
|
||||
@@ -30,6 +31,9 @@ EgtOutLog( ' ProcessMortise started', 1)
|
||||
local BD = require( 'BeamData')
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
-- variabili assegnazione parametri Q
|
||||
local Q_DEPTH_CHAMFER = 'Q02' -- d
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
function ProcessMortise.Identify( Proc)
|
||||
@@ -124,7 +128,7 @@ end
|
||||
local nFaceUse = BL.GetNearestParalOpposite( vtN)
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
||||
-- applico il parametro plunge, che setta la lavorazione per affondare solamente, senza lavorare tutto il contorno; 1: solo lato iniziale, 2: solo lato finale, 3: entrambi
|
||||
sNotes = 'Plunge=3;'
|
||||
local sNotes = 'Plunge=3;'
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
|
||||
-- imposto angolo 3° asse rot
|
||||
local vtOrtho = BL.GetVersRef( nFaceUse)
|
||||
@@ -277,7 +281,36 @@ function ProcessMortise.VerifyMortiseOrPocket( Proc, dDiam, dDepth, dMaxTotLen,
|
||||
return sPocketing, dMaxDepth, dToolDiam
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
---------------------------------------------------------------------
|
||||
local function VerifyChamfer( Proc, AuxId, nRawId, bMakeVertCham, bDownHead)
|
||||
local nChamfer = 0
|
||||
-- ingombro del grezzo
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- verifico che lo smusso sia richiesto
|
||||
local dDepth = EgtGetInfo( Proc.Id, Q_DEPTH_CHAMFER, 'd') or 0
|
||||
if dDepth > 0 then
|
||||
nChamfer = 1
|
||||
end
|
||||
|
||||
-- recupero la lavorazione
|
||||
local sMilling
|
||||
if nChamfer > 0 then
|
||||
if bDownHead then
|
||||
sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true)
|
||||
else
|
||||
sMilling = ML.FindMilling( 'Mark')
|
||||
end
|
||||
if not sMilling then
|
||||
local sErr = 'Error : Mark not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return -1, 0, sErr
|
||||
end
|
||||
end
|
||||
|
||||
return nChamfer, dDepth, sMilling
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- ingombro del pezzo
|
||||
@@ -319,6 +352,69 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if not bModif and not bOpenBtm then
|
||||
BL.SetOpenSide( AuxId, b3Solid)
|
||||
end
|
||||
|
||||
-- recupero il raggio minimo della mortasa
|
||||
local dMaxDiam = 1000
|
||||
local nSt, nEnd = EgtCurveDomain( AuxId)
|
||||
for i = nSt, nEnd - 1 do
|
||||
local dRad = EgtCurveCompoRadius( AuxId, i)
|
||||
-- se è un raggio, setto ed esco subito. Tutti i raggi sono uguali nella mortasa
|
||||
if dRad > 0 then
|
||||
dMaxDiam = dRad * 2
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
-- caso speciale feature trimmata diversamente in/out: si ricostruisce la curva non trimmata
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error : missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- estrazione loop trimesh: se 1 contorno ha il fondo, se due contorni è passante.
|
||||
-- se passante si deve discriminare se i due contorni sono uguali (passante standard, trimmata allo stesso modo in/out) oppure se un contorno è diverso dall'altro (e quindi non è trimmata in egual modo in/out)
|
||||
-- se più di 2 contorni si rimane nel caso standard
|
||||
local idCurve1, nIdCount = EgtExtractSurfTmLoops( Proc.Id, nAddGrpId)
|
||||
if nIdCount == 2 then
|
||||
local idCurve2 = idCurve1 + 1
|
||||
local dCurveLength1 = EgtCurveLength( idCurve1)
|
||||
local dCurveLength2 = EgtCurveLength( idCurve2)
|
||||
if abs( dCurveLength1 - dCurveLength2) > 100 * GEO.EPS_SMALL then
|
||||
-- riferimento curva ausiliaria
|
||||
local frAuxId = Frame3d( EgtGP( AuxId, GDB_RT.GLOB), vtExtr)
|
||||
-- box dei due contorni nel riferimento della faccia di fondo
|
||||
local b3Curve1 = EgtGetBBoxRef( idCurve1, GDB_BB.STANDARD, frAuxId)
|
||||
local b3Curve2 = EgtGetBBoxRef( idCurve2, GDB_BB.STANDARD, frAuxId)
|
||||
-- per creare la curva non trimmata si creerà un piano di intersezione con la trimesh appena sopra al contorno più vicino a AuxId, ossia a ptOffset
|
||||
local ptOffset = b3Curve1:getMax()
|
||||
if b3Curve1:getMin():getZ() > b3Curve2:getMin():getZ() + 10 * GEO.EPS_SMALL then
|
||||
ptOffset = b3Curve2:getMax()
|
||||
end
|
||||
-- ptOffset si sposta appena sopra per garantire l'intersezione
|
||||
ptOffset = ptOffset + Vector3d( 0, 0, 100 * GEO.EPS_SMALL)
|
||||
local ptOffsetGlob = Point3d( ptOffset)
|
||||
ptOffsetGlob:toGlob( frAuxId)
|
||||
EgtErase( { idCurve1, idCurve2} )
|
||||
-- intersezione piano a ptOffset con la trimesh: si ottiene la curva originale non trimmata
|
||||
local nFirstId, nPnt, nCrv, nSrf = EgtPlaneSurfTmInters( ptOffsetGlob, frAuxId:getVersZ(), Proc.Id, nAddGrpId, GDB_RT.GLOB)
|
||||
if nPnt == 0 and nCrv == 1 and nSrf == 0 then
|
||||
EgtCloseCurveCompo( nFirstId)
|
||||
local vtMove = -frAuxId:getVersZ() * ptOffset:getZ()
|
||||
EgtMove( nFirstId, vtMove, GDB_RT.GLOB)
|
||||
EgtErase( AuxId)
|
||||
EgtChangeId( nFirstId, AuxId)
|
||||
else
|
||||
if nFirstId then
|
||||
for nId = nFirstId, nFirstId + nPnt + nCrv + nSrf - 1 do
|
||||
EgtErase( nId)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if bOpenBtm then
|
||||
-- creo superficie chiusa
|
||||
local nFlat = EgtSurfTmByFlatContour( EgtGetParent( AuxId), AuxId, 0.05)
|
||||
@@ -384,7 +480,8 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptCutC, vtCutN, b3Solid, GDB_RT.GLOB)
|
||||
local b3Cut = EgtGetBBoxGlob( AddId or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp - 2, Prc = 10, Box = b3Cut, Fct = 1, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bFromBottom = ( b3Solid:getDimX() < BD.LEN_SHORT_PART and vtExtr:getZ() > 0.25)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH, bFromBottom)
|
||||
if not bOk then return bOk, sErr end
|
||||
@@ -401,10 +498,71 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
end
|
||||
-- determino larghezza della mortasa
|
||||
if dL < dW then dL, dW = dW, dL end
|
||||
|
||||
-- si prende il minimo tra larghezza mortasa e il raggio minimo impostato da parametro
|
||||
dMaxDiam = min( dW, dMaxDiam)
|
||||
|
||||
-- abilitazione lavorazione da sotto
|
||||
local bPockUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259)
|
||||
local bPockDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174)
|
||||
local bPockAngTrasm = ( BD.ANG_TRASM and vtExtr:getZ() < -0.1)
|
||||
|
||||
-- recupero i dati della curva e del profilo
|
||||
local dDepth = dMorH
|
||||
local bDownHead = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1)
|
||||
local bToolInv = ( not bDownHead and vtExtr:getZ() < -0.1 and Proc.Box:getDimZ() > b3Solid:getDimZ() - 5)
|
||||
local dExtra = 2
|
||||
|
||||
-- verifico se servono gli smussi. Se lavorazione principale di svuotatura significa che è solo da un lato
|
||||
-- generalmente sono lavorazioni non molto lunghe, quindi non si gestistono gli step
|
||||
-- verifico i parametri Q per profondità smusso e per eseguirlo in esclusiva
|
||||
local nChamfer, dDepthCham, sChamfer = VerifyChamfer( Proc, AuxId, nRawId, true)
|
||||
-- se devo inserire il chamfer
|
||||
if nChamfer > 0 and Proc.Grp ~= 0 and dDepth > dDepthCham then
|
||||
-- inserisco la lavorazione
|
||||
local sNameCh = 'Cham_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchId = EgtAddMachining( sNameCh, sChamfer)
|
||||
if not nMchId then
|
||||
local sErr = 'Error adding machining ' .. sNameCh .. '-' .. sChamfer
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
if not bToolInv then
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
else
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
end
|
||||
-- assegno affondamento e offset radiale
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepthCham + dExtra - dMorH)
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
|
||||
-- posizione braccio porta testa
|
||||
local nSCC = MCH_SCC.NONE
|
||||
if not BD.C_SIMM then
|
||||
if Proc.Head then
|
||||
nSCC = MCH_SCC.ADIR_XP
|
||||
elseif Proc.Tail then
|
||||
nSCC = MCH_SCC.ADIR_XM
|
||||
elseif AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then
|
||||
nSCC = MCH_SCC.ADIR_YP
|
||||
elseif vtExtr:getY() > -0.01 then
|
||||
nSCC = MCH_SCC.ADIR_YP
|
||||
else
|
||||
nSCC = MCH_SCC.ADIR_YM
|
||||
end
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchId, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
|
||||
-- recupero la lavorazione
|
||||
local sPockType = 'Mortise'
|
||||
local sMchExt = ''
|
||||
@@ -422,16 +580,16 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
end
|
||||
local sPocketing
|
||||
if Proc.Prc ~= 53 then
|
||||
sPocketing = ProcessMortise.VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt, bPockDown, bExcludeH2)
|
||||
sPocketing = ProcessMortise.VerifyMortiseOrPocket( Proc, dMaxDiam, dMorH, nil, sPockType..sMchExt, bPockDown, bExcludeH2)
|
||||
if not sPocketing and bPockUp then
|
||||
sPocketing = ProcessMortise.VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt, _, bExcludeH2)
|
||||
sPocketing = ProcessMortise.VerifyMortiseOrPocket( Proc, dMaxDiam, dMorH, nil, sPockType..sMchExt, _, bExcludeH2)
|
||||
end
|
||||
end
|
||||
if not sPocketing then
|
||||
sPockType = 'Pocket'
|
||||
sPocketing = ProcessMortise.VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt, bPockDown, bExcludeH2)
|
||||
sPocketing = ProcessMortise.VerifyMortiseOrPocket( Proc, dMaxDiam, dMorH, nil, sPockType..sMchExt, bPockDown, bExcludeH2)
|
||||
if not sPocketing and bPockUp then
|
||||
sPocketing = ProcessMortise.VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt, _, bExcludeH2)
|
||||
sPocketing = ProcessMortise.VerifyMortiseOrPocket( Proc, dMaxDiam, dMorH, nil, sPockType..sMchExt, _, bExcludeH2)
|
||||
end
|
||||
end
|
||||
if not sPocketing then
|
||||
@@ -452,6 +610,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
bCW = ( dSpeed >= 0)
|
||||
end
|
||||
end
|
||||
|
||||
-- inserisco la lavorazione di svuotatura
|
||||
local sName = 'Mort_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchFId = EgtAddMachining( sName, sPocketing)
|
||||
@@ -471,6 +630,11 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN)
|
||||
end
|
||||
|
||||
-- se diametro utensile esattamente uguale a larghezza tasca, e tasca tonda, si setta un offset radiale negativo
|
||||
if Proc.Fct > 6 and abs( dMillDiam - dW) < 100 * GEO.EPS_SMALL then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, - 50 * GEO.EPS_SMALL)
|
||||
end
|
||||
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
-- sistemo la direzione di lavoro
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
-- ProcessSplit.lua by Egaltech s.r.l. 2025/06/20
|
||||
-- Gestione tastatura
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessProbing = {}
|
||||
|
||||
-- Include
|
||||
require( 'EgtBase')
|
||||
local BL = require( 'BeamLib')
|
||||
|
||||
-- Dati
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function GetProbingMachining( Machinings, sHead)
|
||||
local sProbeMachining, sHeadTool
|
||||
|
||||
-- TODO questa associazione "testa utensile"-"testa tastatore" dovrebbe essere spostata nella macchina.
|
||||
-- Non è detto che se testa utensile inizia con "H2" allora bisogna prendere lavorazione con "_H2"
|
||||
|
||||
-- se la testa utilizzata dalla lavorazione inizia con H2, dovrebbe essere la seconda testa
|
||||
if EgtStartsWith( sHead, 'H2') then
|
||||
sHeadTool = '_H2'
|
||||
else
|
||||
sHeadTool = '_H1'
|
||||
end
|
||||
|
||||
for i = 1, #Machinings do
|
||||
if EgtEndsWith( Machinings[i].Name, sHeadTool) then
|
||||
sProbeMachining = Machinings[i]
|
||||
return sProbeMachining
|
||||
end
|
||||
end
|
||||
sProbeMachining = Machinings[1]
|
||||
return sProbeMachining
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MoveProbePointToRawFaces( ptProbe, vtProbe, nPartId)
|
||||
local b3BoxPart = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
-- si porta linea di tastatura su grezzo
|
||||
if AreSameVectorApprox( vtProbe, Z_AX()) then
|
||||
ptProbe[3] = b3BoxPart:getMax():getZ()
|
||||
elseif AreSameVectorApprox( vtProbe, -Z_AX()) then
|
||||
ptProbe[3] = b3BoxPart:getMin():getZ()
|
||||
elseif AreSameVectorApprox( vtProbe, Y_AX()) then
|
||||
ptProbe[2] = b3BoxPart:getMax():getY()
|
||||
elseif AreSameVectorApprox( vtProbe, -Y_AX()) then
|
||||
ptProbe[2] = b3BoxPart:getMin():getY()
|
||||
end
|
||||
return ptProbe
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessProbing.Make( Proc, nPartId, Info)
|
||||
local bOk, sErr
|
||||
|
||||
-- per eseguire tastatura servono tutti i dati, altriemnti impossibile
|
||||
if Info.vtProbe and Info.ptProbe and Info.sType then
|
||||
Info.ptProbe = MoveProbePointToRawFaces( Info.ptProbe, Info.vtProbe, nPartId)
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
local nIdLine = EgtLinePVL( nAddGrpId, Info.ptProbe, Info.vtProbe, 10, GDB_RT.GLOB) -- TODO lunghezza da portare fuori come parametro
|
||||
local Machinings = GetMachinings( MCH_MY.PROBING, Info.sType)
|
||||
-- se c'è almeno una lavorazione, allora devo fare tastatura
|
||||
if Machinings and #Machinings > 0 then
|
||||
local sProbing = GetProbingMachining( Machinings, Info.sHead)
|
||||
-- se c'è la linea e la lavorazione, applico
|
||||
if sProbing and nIdLine then
|
||||
local sName = 'DtMtProbe_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchFId = EgtAddMachining( sName, sProbing.Name)
|
||||
-- si inverte la direzione della linea, deve essere entrante, oppostaa vettore estrusione
|
||||
EgtInvertCurve( nIdLine)
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ nIdLine, -1}})
|
||||
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sErr
|
||||
else
|
||||
bOk = true
|
||||
end
|
||||
else
|
||||
bOk = false
|
||||
sErr = 'Error on probing'
|
||||
end
|
||||
-- altrimenti tastatura non richiesta, esco
|
||||
else
|
||||
return true
|
||||
end
|
||||
else
|
||||
bOk = false
|
||||
sErr = 'Error on probing'
|
||||
end
|
||||
|
||||
return bOk, sErr
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
return ProcessProbing
|
||||
+89
-11
@@ -206,6 +206,36 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
|
||||
return nChamfer, dDepth, sMilling, sMilling2
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function VerifyOtherMillCanFinish( dDepthProfile, nSide)
|
||||
local dToolMaxDepthFinish
|
||||
-- abilitazione lavorazione da sotto
|
||||
local sMillType = 'Prof_end'
|
||||
local sMillingFinish, _, _, _ = ML.FindMilling( sMillType, nil, nil, nil, nil, true, nil, nil, nil)
|
||||
if not sMillingFinish then
|
||||
return false
|
||||
end
|
||||
-- Recupero i dati dell'utensile
|
||||
if EgtMdbSetCurrMachining( sMillingFinish) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid)) then
|
||||
dToolMaxDepthFinish = EgtTdbGetCurrToolMaxDepth()
|
||||
end
|
||||
else
|
||||
return false
|
||||
end
|
||||
local bDouble = ( dDepthProfile + BD.CUT_EXTRA > dToolMaxDepthFinish)
|
||||
-- se lavorazione in doppio richiesta, si verifica se richiesta testa sotto
|
||||
if bDouble and nSide == 0 then
|
||||
return false -- TODO macchine con BD.DOWN_HEAD potrebbero lavorare in doppio in questo caso!
|
||||
end
|
||||
|
||||
if not bDouble or ( dDepthProfile + BD.MILL_OVERLAP < dToolMaxDepthFinish * 2) then
|
||||
return true, sMillingFinish, bDouble
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
@@ -244,7 +274,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if vtN:getZ() > 0.1 then
|
||||
nSide = 1
|
||||
elseif vtN:getZ() < -0.1 then
|
||||
nSide = -1
|
||||
nSide = -1
|
||||
end
|
||||
-- abilitazione lavorazione da sotto
|
||||
local bMillDown = ( BD.DOWN_HEAD and nSide == -1)
|
||||
@@ -307,7 +337,8 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- altrimenti applico taglio di lama
|
||||
else
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if not bOk then
|
||||
return false, sErr
|
||||
@@ -467,16 +498,21 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- se configurata fresa di finitura
|
||||
local bUseOtherMillOnFinish, sFinishMilling, bDoubleFinishMill = VerifyOtherMillCanFinish( dProfDepth, nSide)
|
||||
|
||||
-- se il chamfer non è esclusivo continuo con le altre lavorazioni
|
||||
if nChamfer < 2 then
|
||||
-- verifico se necessario lavorare in doppio
|
||||
local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
|
||||
local bDouble = ( dProfDepth + BD.CUT_EXTRA - 100 * GEO.EPS_SMALL > dToolMaxDepth)
|
||||
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
|
||||
-- se lavorazione da due parti, aggiungo la seconda
|
||||
local sMillingDown
|
||||
if bDouble then
|
||||
if nSide == 0 then
|
||||
if BD.DOWN_HEAD then
|
||||
if BD.DOWN_HEAD then
|
||||
-- recupero la lavorazione
|
||||
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
|
||||
if not sMillingDown then
|
||||
@@ -536,10 +572,6 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
|
||||
bFinish = true
|
||||
end
|
||||
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
|
||||
if dOffsetPar > 0 then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
|
||||
end
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
@@ -566,7 +598,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
nMchId = nMch2Id
|
||||
end
|
||||
-- se abilitata, aggiungo lavorazione di finitura
|
||||
if bFinish then
|
||||
if bFinish and not bUseOtherMillOnFinish then
|
||||
-- inserisco la lavorazione
|
||||
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
|
||||
@@ -638,7 +670,13 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||
end
|
||||
-- posizione braccio porta testa
|
||||
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
|
||||
local nSCC = MCH_SCC.ADIR_NONE
|
||||
if BD.TURN == 2 then
|
||||
nSCC = MCH_SCC.ADIR_ZP
|
||||
else
|
||||
nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
|
||||
local ptSP, ptEp
|
||||
local bFinish
|
||||
@@ -675,7 +713,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
nMchId = nMch2Id
|
||||
end
|
||||
-- se abilitata, aggiungo lavorazione di finitura
|
||||
if bFinish then
|
||||
if bFinish and not bUseOtherMillOnFinish then
|
||||
-- inserisco la lavorazione
|
||||
local sNewName = 'Prof_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
|
||||
@@ -731,6 +769,46 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
-- se finitura con fresa piccola
|
||||
if bFinish and bUseOtherMillOnFinish then
|
||||
local sDepthFinishMill = EgtIf( bDoubleFinishMill, ( dProfDepth+ BD.MILL_OVERLAP ) / 2, dProfDepth + BD.CUT_EXTRA)
|
||||
local sMachName = 'Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
nMchId = EgtAddMachining( sMachName, sFinishMilling)
|
||||
if not nMchId then
|
||||
local sErr = 'Error adding machining ' .. sMachName .. '-' .. sFinishMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
|
||||
-- imposto l'affondamento
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, sDepthFinishMill)
|
||||
-- posizione braccio porta testa
|
||||
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchId, false)
|
||||
return false, sErr
|
||||
end
|
||||
|
||||
if bDoubleFinishMill then
|
||||
local sNewName = 'FinB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
|
||||
-- ottengo l'inversione e setto il contrario
|
||||
local bInvertMode = EgtGetMachiningParam( MCH_MP.INVERT)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, not bInvertMode)
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchId, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- aggiorno ingombro testa o coda per presa
|
||||
if nSide ~= 1 then -- se feature di fianco o da sotto
|
||||
|
||||
@@ -311,7 +311,8 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- altrimenti applico taglio di lama
|
||||
else
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if not bOk then
|
||||
return false, sErr
|
||||
@@ -452,7 +453,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
end
|
||||
end
|
||||
-- verifico se necessario lavorare in doppio
|
||||
local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
|
||||
local bDouble = ( dProfDepth + BD.CUT_EXTRA - 100 * GEO.EPS_SMALL > dToolMaxDepth)
|
||||
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
|
||||
-- se lavorazione da due parti, aggiungo la seconda
|
||||
local sMillingDown
|
||||
|
||||
@@ -311,7 +311,8 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- altrimenti applico taglio di lama
|
||||
else
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if not bOk then
|
||||
return false, sErr
|
||||
@@ -452,7 +453,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
end
|
||||
end
|
||||
-- verifico se necessario lavorare in doppio
|
||||
local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
|
||||
local bDouble = ( dProfDepth + BD.CUT_EXTRA - 100 * GEO.EPS_SMALL > dToolMaxDepth)
|
||||
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
|
||||
-- se lavorazione da due parti, aggiungo la seconda
|
||||
local sMillingDown
|
||||
|
||||
@@ -258,7 +258,8 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- altrimenti applico taglio di lama
|
||||
else
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if not bOk then
|
||||
return false, sErr
|
||||
|
||||
@@ -293,7 +293,8 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- altrimenti applico taglio di lama
|
||||
else
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if not bOk then
|
||||
return false, sErr
|
||||
|
||||
+34
-10
@@ -10,6 +10,7 @@ local BL = require( 'BeamLib')
|
||||
local Fbs = require( 'FacesBySaw')
|
||||
local Cut = require( 'ProcessCut')
|
||||
local DC = require( 'DiceCut')
|
||||
local LapJoint = require( 'ProcessLapJoint')
|
||||
|
||||
EgtOutLog( ' ProcessRidgeLap started', 1)
|
||||
|
||||
@@ -48,6 +49,8 @@ end
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local nForceUseBladeOnNotContinueFace = EgtGetInfo( Proc.Id, 'Q04', 'i') or 0
|
||||
local bUseMill = ( EgtGetInfo( Proc.Id, 'Q05', 'i') or 0) == 1
|
||||
-- recupero l'ingombro del grezzo di appartenenza
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- ingombro del pezzo
|
||||
@@ -132,9 +135,20 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- applico taglio di lama
|
||||
local b3Cut = EgtGetBBoxGlob( AddId or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Cut, Fct = 1, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, false)
|
||||
if not bOk then return bOk, sErr end
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
if BL.IsCutNeeded( CutProc, b3Raw, dOvmHead) then
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, false)
|
||||
if not bOk then return bOk, sErr end
|
||||
elseif bUseMill then
|
||||
Proc.bForceMill = true
|
||||
return LapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
elseif nForceUseBladeOnNotContinueFace > 0 then
|
||||
EgtSurfTmRemoveFacet( Proc.Id, vFaceOrd[1] - 1)
|
||||
Proc.Fct = Proc.Fct - 1
|
||||
Proc.Face = BL.GetFacetsInfo( Proc, b3Raw)
|
||||
return LapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- recupero gruppo per geometria addizionale
|
||||
@@ -159,18 +173,18 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
-- calcolo riferimenti per facce inclinate
|
||||
local vtRef = Vector3d( vtN[vFaceOrd[3]])
|
||||
local vtRef2 = EgtIf( bHead, X_AX(), -X_AX())
|
||||
local vtRef2 = Vector3d( vtN[vFaceOrd[2]])
|
||||
-- eseguo
|
||||
for i = 1, #vCuts do
|
||||
local nOrthoOpposite
|
||||
local vtOrtho
|
||||
if i % 2 == 1 then
|
||||
nOrthoOpposite = BL.GetNearestOrthoOpposite( vtRef)
|
||||
vtOrtho = vtRef
|
||||
else
|
||||
nOrthoOpposite = BL.GetNearestOrthoOpposite( vtRef2)
|
||||
vtOrtho = vtRef2
|
||||
end
|
||||
-- lavoro la faccia
|
||||
for j = 1, #vCuts[i] do
|
||||
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, nOrthoOpposite, dVzLimDwnUp, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrtho, dVzLimDwnUp, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
@@ -199,7 +213,12 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD)
|
||||
if b3Fac1 then dHCI = b3Raw:getMax():getX() - dOvmHead - b3Fac1:getMin():getX() end
|
||||
else
|
||||
dHCI = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()
|
||||
-- se feature inclinata, si va oltre ingombro del box. Si considera metà dell'ingombro della faccia inclinata
|
||||
if vtN[vFaceOrd[2]] and vtN[vFaceOrd[2]]:getZ() > 0 then
|
||||
dHCI = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX() - ( vtN[vFaceOrd[2]]:getZ() * b3Raw:getDimZ())
|
||||
else
|
||||
dHCI = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()
|
||||
end
|
||||
end
|
||||
BL.UpdateHCING( nRawId, dHCI)
|
||||
elseif Proc.Tail then
|
||||
@@ -208,7 +227,12 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD)
|
||||
if b3Fac1 then dTCI = b3Fac1:getMax():getX() - b3Solid:getMin():getX() end
|
||||
else
|
||||
dTCI = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
|
||||
-- se feature inclinata, si va oltre ingombro del box. Si considera metà dell'ingombro della faccia inclinata
|
||||
if vtN[vFaceOrd[2]] and vtN[vFaceOrd[2]]:getZ() > 0 then
|
||||
dTCI = Proc.Box:getMax():getX() - b3Solid:getMin():getX() - ( vtN[vFaceOrd[2]]:getZ() * b3Raw:getDimZ())
|
||||
else
|
||||
dTCI = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
|
||||
end
|
||||
end
|
||||
BL.UpdateTCING( nRawId, dTCI)
|
||||
end
|
||||
|
||||
@@ -239,6 +239,8 @@ function ProcessRoundArch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
elseif AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then
|
||||
nSCC = MCH_SCC.ADIR_YP
|
||||
end
|
||||
elseif BD.TURN == 2 then
|
||||
nSCC = MCH_SCC.ADIR_ZP
|
||||
elseif BD.TURN then
|
||||
if vtN:getZ() > 0.707 then
|
||||
nSCC = MCH_SCC.ADIR_ZP
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
|
||||
-- 2022/07/12 Aggiunta gestione PF1250 e TURN.
|
||||
-- 2023/02/14 Gestite le rotazioni di 90 deg nell'aggiornamento del grezzo.
|
||||
-- 2024/09/03 In ApplyDiceCut, se possibile, i tagli paralleli sono fatti con un unico passaggio di fianco.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessScarfJoint = {}
|
||||
@@ -134,7 +135,9 @@ end
|
||||
local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Solid, ptC, vtN, Proc, vtRef, bHead, sCutting, dSawDiam, b3Raw, dNewDiceDim)
|
||||
|
||||
local bOk = true
|
||||
local bOk2 = true
|
||||
local sErr = ''
|
||||
local sErr2 = ''
|
||||
|
||||
local vCuts = {}
|
||||
if nGoodFace1 and nGoodFace4 and nGoodFace1 > 0 and nGoodFace4 > 0 then
|
||||
@@ -185,9 +188,74 @@ local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Soli
|
||||
-- extra taglio
|
||||
local dExtraCut = EgtIf( i % 2 == 1, 0, BD.CUT_EXTRA)
|
||||
-- lavoro la faccia
|
||||
for j = 1, #vCuts[i] do
|
||||
bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
if not bOk then return bOk, sErr end
|
||||
local dMaxDepth = 0
|
||||
if EgtMdbSetCurrMachining( sCutting) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
end
|
||||
|
||||
-- se non ho intersezione con la faccia tappo posso fare il taglio sul fianco
|
||||
if not nGoodFace1 or nGoodFace1 == 0 then
|
||||
-- controllo per eseguire solo un taglio ottimizzato
|
||||
local bExecJustOneCut = false
|
||||
local dDiceFaceDim = GEO.INFINITO
|
||||
if ( i % 2) == 0 then
|
||||
for cont = 1, #vCuts[i] do
|
||||
local _, dDiceFaceH, dDiceFaceV = BL.GetFaceHvRefDim( vCuts[i][cont], 0)
|
||||
-- se feature verso Z, si ammette anche lavorazione in doppio
|
||||
if AreSameVectorApprox( vtRef, Z_AX()) then
|
||||
if dMaxDepth * 2 > dDiceFaceH + BD.CUT_EXTRA then
|
||||
bExecJustOneCut = true
|
||||
dDiceFaceDim = dDiceFaceH
|
||||
break
|
||||
end
|
||||
elseif AreSameVectorApprox( vtRef, Y_AX()) or AreSameVectorApprox( vtRef, -Y_AX()) then
|
||||
if dMaxDepth > dDiceFaceV + BD.CUT_EXTRA then
|
||||
bExecJustOneCut = true
|
||||
dDiceFaceDim = dDiceFaceV
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se c'è intersezione non ci deve essere ExtraCut
|
||||
else
|
||||
dExtraCut = 0
|
||||
end
|
||||
-- se si può fare, faccio unico taglio parallelo
|
||||
if bExecJustOneCut then
|
||||
local bDoubleCut = false
|
||||
local dCutExtra = BD.CUT_EXTRA
|
||||
if dMaxDepth < dDiceFaceDim then
|
||||
bDoubleCut = true
|
||||
end
|
||||
local nSurfToCut = EgtSurfTmBySewing( nAddGrpId, vCuts[i], false)
|
||||
|
||||
local nFaceUseCut1, nFaceUseCut2
|
||||
-- se feature rivolta verso alto setto direzione taglio davanti e dietro
|
||||
if AreSameVectorApprox( vtRef, Z_AX()) then
|
||||
nFaceUseCut1, nFaceUseCut2 = MCH_MILL_FU.ORTHO_BACK, MCH_MILL_FU.ORTHO_FRONT
|
||||
-- altrimenti taglio da sopra
|
||||
else
|
||||
nFaceUseCut2 = MCH_MILL_FU.ORTHO_DOWN
|
||||
end
|
||||
|
||||
if Proc.Tail and AreSameVectorApprox( vtRef, Z_AX()) then
|
||||
nFaceUseCut1, nFaceUseCut2 = nFaceUseCut2, nFaceUseCut1
|
||||
end
|
||||
if bDoubleCut then
|
||||
bOk, sErr = Fbs.MakeOne( nSurfToCut, 0, sCutting, dSawDiam, nFaceUseCut1, nil, dCutExtra, BD.CUT_SIC, 0, 0, 0, '', b3Raw, true)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
bOk2, sErr2 = Fbs.MakeOne( nSurfToCut, 0, sCutting, dSawDiam, nFaceUseCut2, nil, dCutExtra, BD.CUT_SIC, 0, 0, 0, '', b3Raw)
|
||||
if not bOk2 then return false, sErr2 end
|
||||
else
|
||||
for j = 1, #vCuts[i] do
|
||||
bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- lavoro la faccia interna in ogni caso
|
||||
@@ -201,7 +269,7 @@ local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Soli
|
||||
if vFaceOrd[3] ~= 0 then
|
||||
-- inserisco la lavorazione
|
||||
local vtOrthoO = Vector3d( vtRef)
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[3] - 1, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[3] - 1, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
end
|
||||
@@ -381,7 +449,7 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa
|
||||
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)
|
||||
bOkd, sErrD = Fbs.MakeOne( nFace4, nGoodFace4 - 1, sCutting, dSawDiam, vtRef2, nil, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
if not bOkd then return bOkd, sErrD end
|
||||
-- lavoro la faccia opposta (definita dal parametro P11)
|
||||
if vFaceOrd[3] ~= 0 then
|
||||
@@ -460,10 +528,20 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa
|
||||
else
|
||||
dDiamMax = EgtIf( abs( frMor:getVersX():getY()) < abs( frMor:getVersY():getY()), dL, dW)
|
||||
end
|
||||
-- determino la distanza tra le due facce inclinate
|
||||
-- determino la distanza tra le due facce inclinate per determinare elevazione
|
||||
local dDistFaces
|
||||
if vFaceOrd[4] ~= 0 then
|
||||
dDistFaces = abs((ptC[vFaceOrd[2]]-ptC[vFaceOrd[4]])*vtN[vFaceOrd[2]])
|
||||
local nElevationFace1 = 0
|
||||
-- controllo estensione faccia 1
|
||||
if vFaceOrd[1] ~= 0 then
|
||||
frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( Proc.Id, vFaceOrd[1]-1, GDB_ID.ROOT)
|
||||
if abs(vtRef:getY()) > 0.866 then
|
||||
nElevationFace1 = EgtIf( abs( frMor:getVersX():getZ()) < abs( frMor:getVersY():getY()), dL, dW)
|
||||
else
|
||||
nElevationFace1 = EgtIf( abs( frMor:getVersX():getY()) < abs( frMor:getVersY():getY()), dL, dW)
|
||||
end
|
||||
end
|
||||
dDistFaces = max( abs((ptC[vFaceOrd[2]]-ptC[vFaceOrd[4]])*vtN[vFaceOrd[2]]), nElevationFace1)
|
||||
end
|
||||
-- recupero la lavorazione. considerando l dimensione del lato e l'affondamento
|
||||
local sPocketing
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
-- 2022/08/09 Ora se la feature ha meno di due facce viene richiamata la normale Cut.
|
||||
-- 2022/11/09 Aggiunta gestione parametro Q04 per forzare utilizzo fresa di lato e lavorare come FreeContour.
|
||||
-- 2023/02/14 Gestite le rotazioni di 90 deg nell'aggiornamento del grezzo.
|
||||
-- 2024/08/05 Se assimilabile ad un taglio (1 faccia) si considerare area non pinzabile testa/coda
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessSimpleScarf = {}
|
||||
@@ -148,7 +149,7 @@ function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmT
|
||||
-- se ci sono meno di due facce si riduce a una normale Cut
|
||||
local nFacetCnt = EgtSurfTmFacetCount( Proc.Id)
|
||||
if nFacetCnt < 2 then
|
||||
local bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, nil, nil, nil, nil, dOvmTail)
|
||||
local bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, nil, nil, nil, nil, dOvmTail, true)
|
||||
return bOk, sErr
|
||||
end
|
||||
-- dati delle facce
|
||||
|
||||
+491
-246
@@ -38,6 +38,10 @@ EgtOutLog( ' ProcessSplit started', 1)
|
||||
local BD = require( 'BeamData')
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
if BD.PRECUT_TAIL == nil then
|
||||
BD.PRECUT_TAIL = true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
function ProcessSplit.Identify( Proc)
|
||||
@@ -63,7 +67,7 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- lavorazione smussi
|
||||
local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmTail)
|
||||
-- verifico che lo smusso sia richiesto
|
||||
local dDepth = EgtGetInfo( nOriId, 'Q06', 'd') or 0
|
||||
if dDepth < 0.1 then return true end
|
||||
@@ -163,9 +167,102 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
return true, nil
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- smussi in coda
|
||||
local function MakeTailChamfer( idProc, nPartId, dDepthTailChamfer)
|
||||
-- recupero gruppo per geometria aggiuntiva
|
||||
local AddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not AddGrpId then
|
||||
local sErr = 'Error on process StartFace impossible to find AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
|
||||
-- recupero la lavorazione
|
||||
local sMilling = ML.FindMilling( 'Mark')
|
||||
if not sMilling then
|
||||
local sErr = 'Error : milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
|
||||
local nLoopId, nLoopCnt = EgtExtractSurfTmFacetLoops( idProc, 0, AddGrpId)
|
||||
if not nLoopId or nLoopCnt > 1 then
|
||||
local sErr = 'Error MakeHeadChamfer : too many loops'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
|
||||
-- setto direzione estrusione corretta
|
||||
EgtModifyCurveExtrusion( nLoopId, -X_AX())
|
||||
EgtSetGridFrame( Frame3d( 0,0,0, GDB_FR.LEFT))
|
||||
|
||||
local dQ09Value = EgtGetInfo( idProc, 'Q09', 'd')
|
||||
local bChamferedEdge = dQ09Value > 0
|
||||
|
||||
local nIdFirstEntity, nEntityCnt = EgtExplodeCurveCompo( nLoopId)
|
||||
local p3MidPoint = EgtMP( nIdFirstEntity, GDB_ID.GRID)
|
||||
|
||||
for i = 0, nEntityCnt - 1 do
|
||||
if EgtCurveLength( nIdFirstEntity + i) - 10 < abs( dQ09Value) * 2 then
|
||||
local sErr = 'Error MakeTailChamfer : Q09 too high'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
|
||||
-- creo raccordo o fillet
|
||||
for i = 0, nEntityCnt - 1 do
|
||||
local idFirst = nIdFirstEntity + i
|
||||
local idSecond = EgtIf( i == nEntityCnt - 1, nIdFirstEntity, idFirst + 1)
|
||||
local ptEndPointFirst = EgtEP( idFirst, GDB_ID.GRID) - ( abs( dQ09Value) * EgtEV( idFirst, GDB_ID.GRID))
|
||||
local ptStartPointSecond = EgtSP( idSecond, GDB_ID.GRID) + ( abs( dQ09Value) * EgtEV( idSecond, GDB_ID.GRID))
|
||||
|
||||
if bChamferedEdge then
|
||||
EgtCurveChamfer( AddGrpId, idFirst, ptEndPointFirst, idSecond, ptStartPointSecond, abs( dQ09Value), true, GDB_RT.GRID)
|
||||
else
|
||||
EgtCurveFillet( AddGrpId, idFirst, ptEndPointFirst, idSecond, ptStartPointSecond, abs( dQ09Value), true, GDB_RT.GRID)
|
||||
end
|
||||
end
|
||||
|
||||
EgtSelectPathObjs( nIdFirstEntity, true)
|
||||
local idGeom, idGeomCnt = EgtCurveCompoByChain( AddGrpId, GDB_ID.SEL, {0,0,0}, true)
|
||||
if not idGeom or idGeomCnt > 1 then
|
||||
local sErr = 'Error MakeTailChamfer : too many loops'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
EgtChangeClosedCurveStartPoint( idGeom, p3MidPoint, GDB_RT.GRID)
|
||||
|
||||
-- Inserisco la lavorazione del lato standard
|
||||
local dExtra = 2
|
||||
local sName1 = 'TailCham_' .. ( EgtGetName( idProc) or tostring( idProc))
|
||||
local nMch1Id = EgtAddMachining( sName1, sMilling)
|
||||
if not nMch1Id then
|
||||
local sErr = 'Error adding machining ' .. sName1 .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ idGeom, -1}})
|
||||
-- assegno affondamento e offset radiale
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepthTailChamfer + dExtra)
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
|
||||
-- assegno lato di lavoro
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMch1Id, false)
|
||||
return false, sErr
|
||||
end
|
||||
|
||||
return true, nil
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- lavorazione con sega a catena per sezioni alte e larghe
|
||||
local function MakeSplitByChainSaw( nSurfId, sSawing, nFaceUse, dDepth, sNotes, dOffs, bExtendStartEnd)
|
||||
local function MakeCutByChainSaw( nSurfId, sSawing, nFaceUse, dDepth, sNotes, dRadialOffset, bExtendStartEnd, bInvert)
|
||||
-- Recupero i dati dell'utensile
|
||||
local dMaxMat = 0
|
||||
local dSawCornerRad = 0
|
||||
@@ -204,8 +301,12 @@ local function MakeSplitByChainSaw( nSurfId, sSawing, nFaceUse, dDepth, sNotes,
|
||||
local vtN = EgtSurfTmFacetNormVersor( nSurfId, 0, GDB_ID.ROOT)
|
||||
local vtOrtho = BL.GetVersRef( nFaceUse)
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1))
|
||||
-- se il taglio è un precut, sto 10mm più all'interno per essere sicuro di tagliare effettivamente qualcosa
|
||||
if BD.PRECUT_TAIL and sNotes and sNotes:find( 'Precut;') then
|
||||
dRadialOffset = dRadialOffset - 10
|
||||
end
|
||||
-- imposto offset radiale per mantenere il materiale in coda per la finitura
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dRadialOffset)
|
||||
-- imposto eventuale allungamento percorso iniziale
|
||||
local dStartAddLen = 0
|
||||
local dEndAddLen = 0
|
||||
@@ -217,7 +318,13 @@ local function MakeSplitByChainSaw( nSurfId, sSawing, nFaceUse, dDepth, sNotes,
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
|
||||
-- faccio in modo che l'attacco della lama sia dal lato opposto rispetto al corpo macchina
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||
if bInvert and bInvert == true 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
|
||||
if dMaxMat >= dDepth then
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||
-- se massimo affondamento utensile inferiore fessura, setto affondamento ed emetto warning
|
||||
@@ -253,12 +360,82 @@ local function MakeSplitByChainSaw( nSurfId, sSawing, nFaceUse, dDepth, sNotes,
|
||||
return true, sName, nMchFId
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- split per sezioni grandi con sega a catena o mix catena + lama
|
||||
function ProcessSplit.MakeBigSectionSplitting( Proc, b3Raw, dOffset, SawingData, Cutting2Data)
|
||||
local sNotes = ''
|
||||
if SawingData.bSplit ~= nil then
|
||||
sNotes = 'Precut;'
|
||||
end
|
||||
local bigSectionSplitType
|
||||
-- se pezzo non troppo alto, taglio singolo da sopra
|
||||
if b3Raw:getDimZ() + BD.CUT_EXTRA_MIN < SawingData.dChainSawMaxMat + 10 * GEO.EPS_SMALL then
|
||||
bigSectionSplitType = "single horizontal"
|
||||
-- se pezzo non troppo largo, taglio singolo da davanti
|
||||
elseif b3Raw:getDimY() + BD.CUT_EXTRA_MIN < min( SawingData.dChainSawMaxMat, SawingData.dChainSawLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then
|
||||
bigSectionSplitType = "single vertical"
|
||||
-- se pezzo non troppo largo, tagli dai due fianchi (dietro e davanti)
|
||||
elseif 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN < min( SawingData.dChainSawMaxMat, SawingData.dChainSawLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then
|
||||
bigSectionSplitType = "double vertical"
|
||||
-- altrimenti taglio con sega a catena da sopra e con lama da sotto
|
||||
elseif BD.DOWN_HEAD and ( b3Raw:getDimZ() + BD.CUT_EXTRA_MIN < Cutting2Data.dMaxDepth + SawingData.dChainSawMaxMat + 10 * GEO.EPS_SMALL) then
|
||||
bigSectionSplitType = "double horizontal"
|
||||
end
|
||||
|
||||
-- in base alle scelte precedenti, applico le lavorazioni
|
||||
if bigSectionSplitType == "single horizontal" then
|
||||
local dCutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN
|
||||
local sNotesSplit = EgtIf( SawingData.bSplit, 'Split;', sNotes)
|
||||
-- verifico se sega a catena lunga e devo quindi estendere ingresso e uscita perchè è probabile che non riesca a ruotare sopra al pezzo
|
||||
local bExtendStartEnd
|
||||
local dMinLengthLongChainSaw = 630
|
||||
if SawingData.dChainSawLen > dMinLengthLongChainSaw - 10 * GEO.EPS_SMALL then
|
||||
bExtendStartEnd = true
|
||||
end
|
||||
local bOk, sErr = MakeCutByChainSaw( Proc.Id, SawingData.sSawing, MCH_MILL_FU.PARAL_TOP, dCutDepth, sNotesSplit, dOffset, bExtendStartEnd, SawingData.bInvert)
|
||||
if not bOk then return bOk, sErr end
|
||||
elseif bigSectionSplitType == "single vertical" then
|
||||
local dCutDepth = b3Raw:getDimY() + BD.CUT_EXTRA_MIN
|
||||
local sNotesSplit = EgtIf( SawingData.bSplit, 'Split;', sNotes)
|
||||
local bOk, sErr = MakeCutByChainSaw( Proc.Id, SawingData.sSawing, MCH_MILL_FU.PARAL_FRONT, dCutDepth, sNotesSplit, dOffset, nil, SawingData.bInvert)
|
||||
if not bOk then return bOk, sErr end
|
||||
elseif bigSectionSplitType == "double vertical" then
|
||||
local dCutDepth = 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN
|
||||
local sNotesSplit = EgtIf( SawingData.bSplit, 'Presplit;', sNotes)
|
||||
local bOk, sErr = MakeCutByChainSaw( Proc.Id, SawingData.sSawing, MCH_MILL_FU.PARAL_BACK, dCutDepth, sNotesSplit, dOffset, nil, SawingData.bInvert)
|
||||
if not bOk then return bOk, sErr end
|
||||
sNotesSplit = EgtIf( SawingData.bSplit, 'Split;', sNotes)
|
||||
bOk, sErr = MakeCutByChainSaw( Proc.Id, SawingData.sSawing, MCH_MILL_FU.PARAL_FRONT, dCutDepth, sNotesSplit, dOffset, nil, SawingData.bInvert)
|
||||
if not bOk then return bOk, sErr end
|
||||
elseif bigSectionSplitType == "double horizontal" then
|
||||
-- sega a catena da sopra
|
||||
local dChainSawCutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN - Cutting2Data.dMaxDepth
|
||||
local sNotesSplit = EgtIf( SawingData.bSplit, 'Presplit;', sNotes)
|
||||
local bOk, sErr = MakeCutByChainSaw( Proc.Id, SawingData.sSawing, MCH_MILL_FU.PARAL_TOP, dChainSawCutDepth, sNotesSplit, dOffset, nil, SawingData.bInvert)
|
||||
if not bOk then return bOk, sErr end
|
||||
-- lama da sotto
|
||||
local dCutExtra = -dChainSawCutDepth + BD.CUT_EXTRA_MIN
|
||||
local dVzLimDwnUp
|
||||
if BD.TURN then dVzLimDwnUp = -2 end
|
||||
local sNotes = EgtIf( SawingData.bSplit, 'Split;', sNotes)
|
||||
local bMaximizeVerticalDepth = true
|
||||
bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting2Data.sCutting, Cutting2Data.dSawDiam, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dOffset, 0, 0, sNotes, b3Raw, nil, bMaximizeVerticalDepth)
|
||||
if not bOk then return false, sErr end
|
||||
-- se è comunque troppo grande per essere separato, esco
|
||||
else
|
||||
local sErr = 'Error : section too big for splitting'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr, -1
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- tagli verticali aggiuntivi
|
||||
local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw, sNotes)
|
||||
local _, dimH = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
|
||||
local nVerticalCuts = ceil( dimH / ( BD.MAX_LEN_DICE)) - 1
|
||||
local dVerticalSliceHeight = dimH / ( nVerticalCuts + 1)
|
||||
local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw, sNotes, dOffsetBetweenCuts)
|
||||
local nVerticalCuts = ceil( Proc.Face[1].WidthTrimmed / ( BD.MAX_LEN_DICE)) - 1
|
||||
local dVerticalSliceHeight = Proc.Face[1].WidthTrimmed / ( nVerticalCuts + 1)
|
||||
-- recupero il diametro dell'utensile
|
||||
local dSawDiam = 400
|
||||
if EgtMdbSetCurrMachining( sCutting) then
|
||||
@@ -272,12 +449,212 @@ local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw, sNotes)
|
||||
for j = nVerticalCuts, 1, -1 do
|
||||
local nFaceUse = MCH_MILL_FU.PARAL_FRONT
|
||||
local dVerticalCutOffset = dVerticalSliceHeight * -j
|
||||
bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, sNotes, b3Raw)
|
||||
local sLeadInOutType = 'PerpendicularOutraw'
|
||||
bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, sNotes, b3Raw, nil, nil, nil, sLeadInOutType, nil, dOffsetBetweenCuts)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
|
||||
return bOk, sErr
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- tagli standard
|
||||
local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, TailCutType, Cutting1Data, Cutting2Data, dStartOffset, dLenEndRaw)
|
||||
if not TailCutType.sType then
|
||||
TailCutType.sType = ''
|
||||
end
|
||||
local PrecutType = { bBigSectionCut = TailCutType.bBigSectionCut, bHorizCut = TailCutType.bHorizCut, bDoubleHorizCut = TailCutType.bDoubleHorizCut, bDoubleCut = TailCutType.bDoubleCut, bSplit = TailCutType.bSplit, sType = 'Precut', bNeedVerticalAddedCuts = false, bNeedHorizontalAddedCuts = false}
|
||||
if not TailCutType.bDoubleHorizCut then
|
||||
-- flag di lavorazione faccia
|
||||
local nOrthoOpposite = EgtIf( TailCutType.bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_BACK)
|
||||
-- calcolo extra taglio ed accorciamento
|
||||
local dCutExtra = 0
|
||||
local dAccStart = 0
|
||||
local dAccEnd = 0
|
||||
if TailCutType.bBigSectionCut and BD.C_SIMM and b3Raw:getDimZ() > BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL then
|
||||
-- qui arrivano sezioni molto grandi su macchine tipo PF con materiale da asportare inferiore allo spessore lama
|
||||
local dSawRad = Cutting1Data.dSawDiam / 2
|
||||
dCutExtra = - ( b3Raw:getDimY() - dSawRad)
|
||||
dAccEnd = dSawRad
|
||||
elseif b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL or b3Raw:getDimY() < 2 * BD.MAX_DIM_HTCUT_HBEAM + 10 * GEO.EPS_SMALL then
|
||||
dCutExtra = EgtIf( TailCutType.bDoubleCut, - 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN, BD.CUT_EXTRA)
|
||||
else
|
||||
dCutExtra = - ( b3Raw:getDimY() - Cutting1Data.dMaxDepth)
|
||||
local dSawRad = Cutting1Data.dSawDiam / 2
|
||||
-- distanza in Y tra il centro della lama e l'intersezione tra la lama stessa e la massima Z della trave, + extra
|
||||
-- se taglio doppio l'intersezione sarà in mezzeria, se taglio singolo sarà all'estremo opposto della trave
|
||||
local dKL = dSawRad - Cutting1Data.dMaxDepth + EgtIf( TailCutType.bDoubleCut, b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN, b3Raw:getDimY() + BD.CUT_EXTRA)
|
||||
-- lunghezza minima del percorso di lavorazione, in caso accorciamento porti a lunghezza negativa
|
||||
local dMinSawingLength = 5
|
||||
if BD.C_SIMM then
|
||||
dAccEnd = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0))
|
||||
-- non posso comunque accorciare più della dimensione della geometria, quindi in caso allungo entrata
|
||||
if dAccEnd > b3Raw:getDimZ() - 100 * GEO.EPS_SMALL then
|
||||
dAccStart = b3Raw:getDimZ() - dAccEnd - dMinSawingLength
|
||||
end
|
||||
else
|
||||
dAccStart = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0))
|
||||
-- non posso comunque accorciare più della dimensione della geometria, quindi in caso allungo uscita
|
||||
if dAccStart > b3Raw:getDimZ() - 100 * GEO.EPS_SMALL then
|
||||
dAccEnd = b3Raw:getDimZ() - dAccStart - dMinSawingLength
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- per travi alte faccio faccio dei tagli orizzontali aggiuntivi
|
||||
if TailCutType.bNeedHorizontalAddedCuts then
|
||||
-- taglio a zero (con lama) per evitare problemi con grezzo più lungo del previsto. Se BigSection il pretaglio è già stato fatto.
|
||||
if not TailCutType.bBigSectionCut and BD.PRECUT_TAIL then
|
||||
dStartOffset = dLenEndRaw
|
||||
local bOkPrecut, sErrPrecut = MakeStandardCuts( Proc, b3Raw, 1, 0, PrecutType, Cutting1Data, Cutting2Data, dStartOffset)
|
||||
if not bOkPrecut then
|
||||
return false, sErrPrecut
|
||||
end
|
||||
end
|
||||
local nHorizontalCuts = ceil ( Proc.Face[1].HeightTrimmed / BD.MAX_DIM_DICE) - 1
|
||||
local dHorizontalSliceHeight = Proc.Face[1].HeightTrimmed / ( nHorizontalCuts + 1)
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutXOffset = ( i - 1) * dOffsetBetweenCuts
|
||||
-- tagli orizzontali
|
||||
for j = nHorizontalCuts, 1, -1 do
|
||||
local nFaceUse = MCH_MILL_FU.PARAL_DOWN
|
||||
local dHorizontalCutOffset = dHorizontalSliceHeight * -j
|
||||
local sLeadInOutType = 'PerpendicularOutraw'
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0 , Cutting1Data.sCutting, Cutting1Data.dSawDiam, nFaceUse, nil, -0.1 - dCutXOffset, BD.CUT_SIC, dHorizontalCutOffset, 0, 0, 'Precut;', b3Raw, nil, nil, nil, sLeadInOutType, nil, dOffsetBetweenCuts)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
-- se necessario taglio verticale doppio, eseguo l'opposto
|
||||
if TailCutType.bDoubleCut then
|
||||
-- gli accorciamenti vanno invertiti per il taglio opposto
|
||||
local dAccStartDoubleCut, dAccEndDoubleCut = dAccEnd, dAccStart
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, MCH_MILL_FU.ORTHO_FRONT, nil, dCutExtra, BD.CUT_SIC, dCutXOffset, dAccStartDoubleCut, dAccEndDoubleCut, 'Precut;', b3Raw, true)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
-- taglio verticale
|
||||
local sInfo = 'Precut'
|
||||
if i == 1 and TailCutType.sType ~= 'Precut' then
|
||||
sInfo = 'Cut'
|
||||
end
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutXOffset, dAccStart, dAccEnd, sInfo, b3Raw, true)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
return true, sWarn
|
||||
end
|
||||
|
||||
-- taglio a zero (con lama) per evitare problemi con grezzo più lungo del previsto. Se BigSection il pretaglio è già stato fatto.
|
||||
if not TailCutType.bBigSectionCut and BD.PRECUT_TAIL and TailCutType.bNeedVerticalAddedCuts then
|
||||
dStartOffset = dLenEndRaw
|
||||
local bOkPrecut, sErrPrecut = MakeStandardCuts( Proc, b3Raw, 1, 0, PrecutType, Cutting1Data, Cutting2Data, dStartOffset)
|
||||
if not bOkPrecut then
|
||||
return false, sErrPrecut
|
||||
end
|
||||
end
|
||||
-- se necessari tagli in doppio, eseguo gli opposti
|
||||
if TailCutType.bDoubleCut then
|
||||
-- gli accorciamenti vanno invertiti per il taglio opposto
|
||||
local dAccStartDoubleCut, dAccEndDoubleCut = dAccEnd, dAccStart
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsetBetweenCuts
|
||||
if i == 1 and TailCutType.sType =='Precut' then
|
||||
dCutOffset = dStartOffset
|
||||
end
|
||||
local sNotes = EgtIf( TailCutType.bSplit, 'Presplit;', 'Precut;')
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, MCH_MILL_FU.ORTHO_FRONT, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStartDoubleCut, dAccEndDoubleCut, sNotes, b3Raw, true)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
end
|
||||
-- eseguo i tagli necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsetBetweenCuts
|
||||
-- se trave larga effettuo tagli verticali aggiuntivi
|
||||
if TailCutType.bNeedVerticalAddedCuts then
|
||||
local sSpecNotes = EgtIf( TailCutType.bSplit, 'Presplit;', 'Precut;')
|
||||
local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw, sSpecNotes, dOffsetBetweenCuts)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
if i == 1 and TailCutType.sType =='Precut' then
|
||||
dCutOffset = dStartOffset
|
||||
end
|
||||
local sNotes
|
||||
if TailCutType.bSplit then
|
||||
sNotes = EgtIf( i == 1, 'Split;', 'Presplit;')
|
||||
else
|
||||
sNotes = EgtIf( i == 1 and TailCutType.sType ~= 'Precut', 'Cut;', 'Precut;')
|
||||
end
|
||||
-- se primo taglio da sopra e PF o ONE richiedo risalita preliminare a Zmax
|
||||
if i == nCuts and TailCutType.bHorizCut and BD.C_SIMM and not BD.DOWN_HEAD then
|
||||
sNotes = EgtSetValInNotes( sNotes, 'StartZmax', 2)
|
||||
end
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, true)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
-- altrimenti necessari tagli da sopra e sotto con testa opportuna
|
||||
else
|
||||
-- verifico esistenza della lavorazione con lama da sotto
|
||||
if not Cutting2Data.sCutting then
|
||||
local sErr = 'Error : cutting H2 not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- verifico che le due lame riescano a lavorare la sezione
|
||||
local dDimZ = b3Raw:getDimZ()
|
||||
local dExtra = Cutting1Data.dMaxVertDepth + Cutting2Data.dMaxDepth - dDimZ
|
||||
if ( dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0) and not TailCutType.bBigSectionCut then
|
||||
local sErr = 'Error : section too big for tail cut'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- calcolo extra taglio ed accorciamento
|
||||
local dCutExtra = -Cutting2Data.dMaxDepth + dExtra / 2 + BD.CUT_EXTRA_MIN
|
||||
local dCutExtra2 = -Cutting1Data.dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN
|
||||
local dAccStart = 0
|
||||
-- limiti da sotto
|
||||
local dVzLimDwnUp
|
||||
if BD.TURN then dVzLimDwnUp = -2 end
|
||||
-- taglio a zero (con lama) per evitare problemi con grezzo più lungo del previsto. Se BigSection il pretaglio è già stato fatto.
|
||||
if not TailCutType.bBigSectionCut and BD.PRECUT_TAIL and TailCutType.bNeedVerticalAddedCuts then
|
||||
dStartOffset = dLenEndRaw
|
||||
local bOkPrecut, sErrPrecut = MakeStandardCuts( Proc, b3Raw, 1, 0, PrecutType, Cutting1Data, Cutting2Data, dStartOffset)
|
||||
if not bOkPrecut then
|
||||
return false, sErrPrecut
|
||||
end
|
||||
end
|
||||
-- eseguo i tagli da sotto necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsetBetweenCuts
|
||||
if i == 1 and TailCutType.sType =='Precut' then
|
||||
dCutOffset = dStartOffset
|
||||
end
|
||||
local sNotes = EgtIf( TailCutType.bSplit, 'Presplit;', 'Precut;')
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting2Data.sCutting, Cutting2Data.dSawDiam, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw, nil, true)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
-- eseguo i tagli da sopra necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsetBetweenCuts
|
||||
if i == 1 and TailCutType.sType =='Precut' then
|
||||
dCutOffset = dStartOffset
|
||||
end
|
||||
-- se trave larga effettuo tagli verticali aggiuntivi
|
||||
if TailCutType.bNeedVerticalAddedCuts then
|
||||
local sSpecNotes = EgtIf( TailCutType.bSplit, 'Presplit;', 'Precut;')
|
||||
local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw, sSpecNotes, dOffsetBetweenCuts)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
local sNotes
|
||||
if TailCutType.bSplit then
|
||||
sNotes = EgtIf( i == 1, 'Split;', 'Presplit;')
|
||||
else
|
||||
sNotes = EgtIf( i == 1 and TailCutType.sType ~= 'Precut', 'Cut;', 'Precut;')
|
||||
end
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, MCH_MILL_FU.ORTHO_DOWN, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dOvmTail)
|
||||
@@ -289,11 +666,19 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
||||
-- inserimento smussi
|
||||
local nOriId = EgtGetInfo( Proc.Id, 'ORI', 'i')
|
||||
if nOriId then
|
||||
local bOkc, sErrC = MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local bOkc, sErrC = MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmTail)
|
||||
if not bOkc then return bOkc, sErrC end
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
local sCutting = ML.FindCutting( 'TailSide')
|
||||
-- TODO questa parte andrà cambiata quando si gestiranno i volumi liberi in cui girare da mlse
|
||||
local dMinWidthForBigBlade = 300
|
||||
local dMaxHeightForBigBlade = 300
|
||||
local sCutting
|
||||
if b3Raw:getDimY() > dMinWidthForBigBlade and b3Raw:getDimZ() < dMaxHeightForBigBlade then
|
||||
sCutting = ML.FindCutting( 'TailSide', nil, nil, nil, 'Longest')
|
||||
else
|
||||
sCutting = ML.FindCutting( 'TailSide')
|
||||
end
|
||||
if not sCutting then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library'
|
||||
EgtOutLog( sErr)
|
||||
@@ -326,17 +711,30 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
||||
dSawThick2 = EgtTdbGetCurrToolParam(MCH_TP.THICK) or dSawThick2
|
||||
end
|
||||
end
|
||||
-- recupero dati utensile della sega a catena più lunga a disposizione
|
||||
local sSawing = ML.FindSawing( 'SawingForSplitting', nil, nil, 'Longest')
|
||||
if not sSawing then
|
||||
sSawing = ML.FindSawing( 'Sawing', nil, nil, 'Longest')
|
||||
end
|
||||
local dChainSawMaxMat = 0
|
||||
local dChainSawLen = 0
|
||||
if EgtMdbSetCurrMachining( sSawing or '') then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dChainSawMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dChainSawMaxMat
|
||||
dChainSawLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dChainSawLen
|
||||
end
|
||||
end
|
||||
-- caratteristiche taglio
|
||||
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dSawMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM))
|
||||
local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and
|
||||
( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dSawMaxDepth2) - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
|
||||
( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dSawMaxDepth2) - 2 * BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
|
||||
local bHorizCut = ( ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and ( b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA))
|
||||
local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
|
||||
local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
|
||||
local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL) and
|
||||
( b3Raw:getDimY() < 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
|
||||
-- dati geometrici del taglio
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
-- flag di lavorazione faccia
|
||||
local nOrthoOpposite = EgtIf( bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_BACK)
|
||||
-- separazione solo se esiste grezzo successivo con pezzi o scaricabile
|
||||
local nNextRawId = EgtGetNextRawPart( nRawId)
|
||||
local bSplit = ( nNextRawId and ( EgtGetPartInRawPartCount( nNextRawId) > 0 or EgtGetRawPartBBox( nNextRawId):getDimX() >= BD.MinRaw))
|
||||
@@ -344,8 +742,6 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
||||
local dLenEndRaw = dOvmTail
|
||||
local nCuts = 1
|
||||
local dOffsL = 0
|
||||
local _, dimH, dimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
|
||||
local dMinTailScrapForAdditionalCuts = 10.123
|
||||
if not bSplit then
|
||||
-- cerco grezzo successivo che sia nella fase
|
||||
if nNextRawId and EgtVerifyRawPartPhase( nNextRawId, nPhase) then
|
||||
@@ -355,94 +751,41 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
||||
dOffsL = dLenEndRaw / nCuts
|
||||
-- aggiorno ingombro del grezzo corrente con quello del successivo
|
||||
b3Raw:Add( b3NextRaw)
|
||||
else
|
||||
dLenEndRaw = min( dOvmTail, abs( ptC:getX() - b3Raw:getMin():getX()))
|
||||
end
|
||||
end
|
||||
-- determino la necessità di tagli aggiuntivi
|
||||
local dMinTailScrapForAdditionalCuts = 10.123
|
||||
local bNeedVerticalAddedCuts = not bSplit and ( Proc.Face[1].WidthTrimmed > BD.MAX_LEN_DICE) and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL)
|
||||
local bNeedHorizontalAddedCuts = not bSplit and not bBigSectionCut and
|
||||
( Proc.Face[1].HeightTrimmed > ( BD.MIN_HEIGHT_ADDED_CUTS or BD.MAX_LEN_DICE) + 100 * GEO.EPS_SMALL) and
|
||||
( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) and
|
||||
dOffsL < BD.MAX_DIM_DICE
|
||||
-- dati lavorazioni sopra e sotto
|
||||
local Cutting1Data = { sCutting = sCutting, dSawDiam = dSawDiam, dMaxDepth = dSawMaxDepth, dSawThick = dSawThick, dMaxVertDepth = dMaxVertDepth}
|
||||
local Cutting2Data = { sCutting = sCutting2, dSawDiam = dSawDiam2, dMaxDepth = dSawMaxDepth2, dSawThick = dSawThick2}
|
||||
local SawingData = { sSawing = sSawing, dChainSawMaxMat = dChainSawMaxMat, dChainSawLen = dChainSawLen, bSplit = bSplit or false}
|
||||
-- dati sul taglio di coda da effettuare
|
||||
local TailCutType = { bBigSectionCut = bBigSectionCut, bHorizCut = bHorizCut, bDoubleHorizCut = bDoubleHorizCut, bDoubleCut = bDoubleCut, bSplit = bSplit, bNeedVerticalAddedCuts = bNeedVerticalAddedCuts, bNeedHorizontalAddedCuts = bNeedHorizontalAddedCuts}
|
||||
-- se taglio per pezzi alti e larghi
|
||||
local nNewPhase = 0
|
||||
if bBigSectionCut then
|
||||
local bFinishingNeeded = false
|
||||
if bSplit then
|
||||
-- recupero dati utensile della sega a catena più lunga a disposizione
|
||||
local sSawing = ML.FindSawing( 'SawingForSplitting', nil, nil, 'Longest')
|
||||
if not sSawing then
|
||||
sSawing = ML.FindSawing( 'Sawing', nil, nil, 'Longest')
|
||||
end
|
||||
local dChainSawMaxMat = 0
|
||||
local dChainSawLen = 0
|
||||
if EgtMdbSetCurrMachining( sSawing or '') then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dChainSawMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dChainSawMaxMat
|
||||
dChainSawLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dChainSawLen
|
||||
end
|
||||
end
|
||||
|
||||
local bigSectionSplitType
|
||||
-- se pezzo non troppo alto, taglio singolo da sopra
|
||||
if b3Raw:getDimZ() + BD.CUT_EXTRA_MIN < dChainSawMaxMat + 10 * GEO.EPS_SMALL then
|
||||
bigSectionSplitType = "single horizontal"
|
||||
-- se pezzo non troppo largo, taglio singolo da davanti
|
||||
elseif b3Raw:getDimY() + BD.CUT_EXTRA_MIN < min( dChainSawMaxMat, dChainSawLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then
|
||||
bigSectionSplitType = "single vertical"
|
||||
-- se pezzo non troppo largo, tagli dai due fianchi (dietro e davanti)
|
||||
elseif 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN < min( dChainSawMaxMat, dChainSawLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then
|
||||
bigSectionSplitType = "double vertical"
|
||||
-- altrimenti taglio con sega a catena da sopra e con lama da sotto
|
||||
elseif BD.DOWN_HEAD and ( b3Raw:getDimZ() + BD.CUT_EXTRA_MIN < dSawMaxDepth2 + dChainSawMaxMat + 10 * GEO.EPS_SMALL) then
|
||||
bigSectionSplitType = "double horizontal"
|
||||
end
|
||||
|
||||
-- assegno offset in lunghezza
|
||||
local dOffs = 0
|
||||
-- assegno offset in lunghezza
|
||||
local dTailOffset = 0
|
||||
if dOvmTail > BD.OVM_CHAIN_HBEAM then
|
||||
dOffs = dOvmTail - BD.OVM_CHAIN_HBEAM
|
||||
dTailOffset = dOvmTail - BD.OVM_CHAIN_HBEAM
|
||||
bFinishingNeeded = true
|
||||
end
|
||||
|
||||
-- in base alle scelte precedenti, applico le lavorazioni
|
||||
if bigSectionSplitType == "single horizontal" then
|
||||
local dCutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN
|
||||
local sNotesSplit = 'Split;'
|
||||
-- verifico se sega a catena lunga e devo quindi estendere ingresso e uscita perchè è probabile che non riesca a ruotare sopra al pezzo
|
||||
local bExtendStartEnd
|
||||
local dMinLengthLongChainSaw = 630
|
||||
if dChainSawLen > dMinLengthLongChainSaw - 10 * GEO.EPS_SMALL then
|
||||
bExtendStartEnd = true
|
||||
end
|
||||
local bOk, sErr = MakeSplitByChainSaw( Proc.Id, sSawing, MCH_MILL_FU.PARAL_TOP, dCutDepth, sNotesSplit, dOffs, bExtendStartEnd)
|
||||
if not bOk then return bOk, sErr, nNewPhase end
|
||||
elseif bigSectionSplitType == "single vertical" then
|
||||
local dCutDepth = b3Raw:getDimY() + BD.CUT_EXTRA_MIN
|
||||
local sNotesSplit = 'Split;'
|
||||
local bOk, sErr = MakeSplitByChainSaw( Proc.Id, sSawing, MCH_MILL_FU.PARAL_FRONT, dCutDepth, sNotesSplit, dOffs)
|
||||
if not bOk then return bOk, sErr, nNewPhase end
|
||||
elseif bigSectionSplitType == "double vertical" then
|
||||
local dCutDepth = 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN
|
||||
local sNotesSplit = 'Presplit;'
|
||||
local bOk, sErr = MakeSplitByChainSaw( Proc.Id, sSawing, MCH_MILL_FU.PARAL_BACK, dCutDepth, sNotesSplit, dOffs)
|
||||
if not bOk then return bOk, sErr, nNewPhase end
|
||||
sNotesSplit = 'Split;'
|
||||
bOk, sErr = MakeSplitByChainSaw( Proc.Id, sSawing, MCH_MILL_FU.PARAL_FRONT, dCutDepth, sNotesSplit, dOffs)
|
||||
if not bOk then return bOk, sErr, nNewPhase end
|
||||
elseif bigSectionSplitType == "double horizontal" then
|
||||
-- sega a catena da sopra
|
||||
local dChainSawCutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN - dSawMaxDepth2
|
||||
local sNotesSplit = 'Presplit;'
|
||||
local bOk, sErr = MakeSplitByChainSaw( Proc.Id, sSawing, MCH_MILL_FU.PARAL_TOP, dChainSawCutDepth, sNotesSplit, dOffs)
|
||||
if not bOk then return bOk, sErr, nNewPhase end
|
||||
-- lama da sotto
|
||||
local dCutExtra = -dChainSawCutDepth + BD.CUT_EXTRA_MIN
|
||||
local dVzLimDwnUp
|
||||
if BD.TURN then dVzLimDwnUp = -2 end
|
||||
local sNotes = 'Split;'
|
||||
local bMaximizeVerticalDepth = true
|
||||
bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dOffs, 0, 0, sNotes, b3Raw, nil, bMaximizeVerticalDepth)
|
||||
if not bOk then return false, sErr end
|
||||
-- se è comunque troppo grande per essere separato, esco
|
||||
else
|
||||
local sErr = 'Error : section too big for splitting'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr, -1
|
||||
-- split per grande sezione
|
||||
local bOk, sErr, nNewPhase2 = ProcessSplit.MakeBigSectionSplitting( Proc, b3Raw, dTailOffset, SawingData, Cutting2Data)
|
||||
if nNewPhase2 then
|
||||
nNewPhase = nNewPhase2
|
||||
end
|
||||
if not bOk then
|
||||
return bOk, sErr, nNewPhase
|
||||
end
|
||||
-- se necessaria finitura, creo nuova fase
|
||||
if bFinishingNeeded then
|
||||
@@ -490,12 +833,20 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
||||
else
|
||||
dMaxElev = Proc.Box:getMax():getX() - b3Raw:getMin():getX()
|
||||
end
|
||||
-- taglio a zero (con sega a catena o mix catena + lama) per evitare problemi con grezzo più lungo del previsto
|
||||
if BD.PRECUT_TAIL and not bSplit then
|
||||
local dTailOffset = dLenEndRaw
|
||||
local bOkPrecut, sErrPrecut = ProcessSplit.MakeBigSectionSplitting( Proc, b3Raw, dTailOffset, SawingData, Cutting2Data)
|
||||
if not bOkPrecut then
|
||||
return false, sErrPrecut
|
||||
end
|
||||
end
|
||||
-- se finitura con lama
|
||||
if nQ05 < 2 or ( not bSplit and dMaxElev > dSawThickCheck) then
|
||||
-- controllo se è necessario un taglio con dicing o si deve proseguire ai casi standard
|
||||
if bSplit or dMaxElev > dSawThickCheck then
|
||||
local bOk, sErr
|
||||
if not bSplit and ( dimH > BD.MAX_LEN_DICE) and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) then
|
||||
if bNeedVerticalAddedCuts then
|
||||
-- ad ogni offset di taglio dovrò fare prima i tagli verticali e poi i cubetti
|
||||
for i = nCuts, 1, -1 do
|
||||
local nAddGrpId = BL.GetAddGroup( Proc.PartId)
|
||||
@@ -517,14 +868,16 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
||||
if AreOppositeVectorApprox( X_AX(), vtNLimitingSurf) then EgtInvertSurf( nLimitingSurf) end
|
||||
end
|
||||
-- tagli verticali
|
||||
bOk, sErr = AddVerticalPreCuts( AddProc, sCutting, 0, b3Raw, sNotes)
|
||||
bOk, sErr = AddVerticalPreCuts( AddProc, sCutting, 0, b3Raw, sNotes, dOffsL)
|
||||
if not bOk then return bOk, sErr end
|
||||
-- tagli a cubetti con eventuale superficie limitante
|
||||
bOk, sErr = Cut.Make( AddProc, nNewPhase, nRawId, nPartId, dMaxElev, nil, false, true, b3Raw, sNotes, dCurrOvmT, nil, nLimitingSurf)
|
||||
local sLeadInOutType = 'PerpendicularOutraw'
|
||||
bOk, sErr = Cut.Make( AddProc, nNewPhase, nRawId, nPartId, dMaxElev, nil, false, true, b3Raw, sNotes, dCurrOvmT, nil, nLimitingSurf, sLeadInOutType)
|
||||
end
|
||||
-- tagli aggiuntivi non necessari
|
||||
else
|
||||
bOk, sErr = Cut.Make( Proc, nNewPhase, nRawId, nPartId, dMaxElev, nil, false, true, b3Raw, sNotes, dCurrOvmT)
|
||||
local sLeadInOutType = 'PerpendicularOutraw'
|
||||
bOk, sErr = Cut.Make( Proc, nNewPhase, nRawId, nPartId, dMaxElev, nil, false, true, b3Raw, sNotes, dCurrOvmT, nil, nil, sLeadInOutType)
|
||||
end
|
||||
if sNotesFinal then
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotesFinal)
|
||||
@@ -560,156 +913,48 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
||||
return true, nil, nNewPhase
|
||||
end
|
||||
end
|
||||
-- se tagli standard
|
||||
if not bDoubleHorizCut then
|
||||
-- calcolo extra taglio ed accorciamento
|
||||
local dCutExtra = 0
|
||||
local dAccStart = 0
|
||||
local dAccEnd = 0
|
||||
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)
|
||||
|
||||
local bOk, sErr = MakeStandardCuts( Proc, b3Raw, nCuts, dOffsL, TailCutType, Cutting1Data, Cutting2Data, nil, dLenEndRaw)
|
||||
|
||||
-- se smussi in coda da aggiungere
|
||||
local dDepthTailChamfer = EgtGetInfo( nOriId or Proc.Id, 'Q08', 'd') or 0
|
||||
if dDepthTailChamfer > 100 * GEO.EPS_SMALL then
|
||||
-- creo subito nuova fase qui, a meno che non sia stata già creata
|
||||
if nNewPhase == 0 then
|
||||
BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET)
|
||||
nNewPhase = EgtGetCurrPhase()
|
||||
local nDispId = EgtGetPhaseDisposition( nNewPhase)
|
||||
if sDownOrSideOrStd == 'down' then
|
||||
EgtRotateRawPart( nRawId, X_AX(), 180)
|
||||
EgtSetInfo( nDispId, 'TYPE', 'MID2')
|
||||
EgtSetInfo( nDispId, 'ROT', -2)
|
||||
elseif sDownOrSideOrStd == 'side' then
|
||||
if bPreMove then EgtMoveRawPart( nRawId, vtMove) end
|
||||
EgtRotateRawPart( nRawId, X_AX(), EgtIf( BD.RIGHT_LOAD, -90, 90))
|
||||
if not bPreMove then EgtMoveRawPart( nRawId, vtMove) end
|
||||
EgtSetInfo( nDispId, 'TYPE', 'MID2')
|
||||
EgtSetInfo( nDispId, 'ROT', -1)
|
||||
else
|
||||
EgtSetInfo( nDispId, 'TYPE', 'END')
|
||||
end
|
||||
EgtSetInfo( nDispId, 'ORD', nOrd)
|
||||
-- se grezzo successivo senza pezzi e finale, va tolto
|
||||
local nNextRawId = EgtGetNextRawPart( nRawId)
|
||||
if nNextRawId and EgtGetPartInRawPartCount( nNextRawId) == 0 and EgtGetRawPartBBox( nNextRawId):getDimX() < BD.MinRaw then
|
||||
EgtRemoveRawPartFromCurrPhase( nNextRawId)
|
||||
end
|
||||
end
|
||||
-- alla fine del taglio si aggiungono gli smussi in testa
|
||||
local _, sErrHeadChamfer = MakeTailChamfer( nOriId or Proc.Id, nPartId, dDepthTailChamfer)
|
||||
if sErr then
|
||||
sErr = sErr..'\n'..sErrHeadChamfer
|
||||
else
|
||||
dCutExtra = - ( b3Raw:getDimY() - dSawMaxDepth)
|
||||
local dSawRad = dSawDiam / 2
|
||||
-- distanza in Y tra il centro della lama e l'intersezione tra la lama stessa e la massima Z della trave, + extra
|
||||
-- se taglio doppio l'intersezione sarà in mezzeria, se taglio singolo sarà all'estremo opposto della trave
|
||||
local dKL = dSawRad - dSawMaxDepth + EgtIf( bDoubleCut, b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN, b3Raw:getDimY() + BD.CUT_EXTRA)
|
||||
-- lunghezza minima del percorso di lavorazione, in caso accorciamento porti a lunghezza negativa
|
||||
local dMinSawingLength = 5
|
||||
if BD.C_SIMM then
|
||||
dAccEnd = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0))
|
||||
-- non posso comunque accorciare più della dimensione della geometria, quindi in caso allungo entrata
|
||||
if dAccEnd > b3Raw:getDimZ() - 100 * GEO.EPS_SMALL then
|
||||
dAccStart = b3Raw:getDimZ() - dAccEnd - dMinSawingLength
|
||||
end
|
||||
else
|
||||
dAccStart = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0))
|
||||
-- non posso comunque accorciare più della dimensione della geometria, quindi in caso allungo uscita
|
||||
if dAccStart > b3Raw:getDimZ() - 100 * GEO.EPS_SMALL then
|
||||
dAccEnd = b3Raw:getDimZ() - dAccStart - dMinSawingLength
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- per travi alte faccio faccio dei tagli orizzontali aggiuntivi
|
||||
local bAreHorizontalCutsNeeded = not bSplit and ( dimV > BD.MAX_LEN_DICE) and not bBigSectionCut and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL)
|
||||
if bAreHorizontalCutsNeeded then
|
||||
local nHorizontalCuts = ceil ( dimV / BD.MAX_DIM_DICE) - 1
|
||||
local dHorizontalSliceHeight = dimV / ( nHorizontalCuts + 1)
|
||||
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
|
||||
if bDoubleCut then
|
||||
-- gli accorciamenti vanno invertiti per il taglio opposto
|
||||
local dAccStartDoubleCut, dAccEndDoubleCut = dAccEnd, dAccStart
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
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, dAccStartDoubleCut, dAccEndDoubleCut, sNotes, b3Raw, true)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
end
|
||||
-- eseguo i tagli necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
-- se trave larga effettuo tagli verticali aggiuntivi
|
||||
if not bSplit and ( dimH > BD.MAX_LEN_DICE) and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) then
|
||||
local sSpecNotes = EgtIf( bSplit, 'Presplit;', 'Precut;')
|
||||
local bOk, sErr = AddVerticalPreCuts( Proc, sCutting, dCutOffset, b3Raw, sSpecNotes)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
local sNotes
|
||||
if bSplit then
|
||||
sNotes = EgtIf( i == 1, 'Split;', 'Presplit;')
|
||||
else
|
||||
sNotes = EgtIf( i == 1, 'Cut;', 'Precut;')
|
||||
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)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
-- altrimenti necessari tagli da sopra e sotto con testa opportuna
|
||||
else
|
||||
-- verifico esistenza della lavorazione con lama da sotto
|
||||
if not sCutting2 then
|
||||
local sErr = 'Error : cutting H2 not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- verifico che le due lame riescano a lavorare la sezione
|
||||
local dDimZ = b3Raw:getDimZ()
|
||||
local dExtra = dMaxVertDepth + dSawMaxDepth2 - dDimZ
|
||||
if ( dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0) and not bBigSectionCut then
|
||||
local sErr = 'Error : section too big for tail cut'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- calcolo extra taglio ed accorciamento
|
||||
local dCutExtra = -dSawMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN
|
||||
local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN
|
||||
local dAccStart = 0
|
||||
-- limiti da sotto
|
||||
local dVzLimDwnUp
|
||||
if BD.TURN then dVzLimDwnUp = -2 end
|
||||
-- eseguo i tagli da sotto necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
local sNotes = EgtIf( bSplit, 'Presplit;', 'Precut;')
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw, nil, true)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
-- eseguo i tagli da sopra necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
-- se trave larga effettuo tagli verticali aggiuntivi
|
||||
if not bSplit and ( dimH > BD.MAX_LEN_DICE) and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) then
|
||||
local sSpecNotes = EgtIf( bSplit, 'Presplit;', 'Precut;')
|
||||
local bOk, sErr = AddVerticalPreCuts( Proc, sCutting, dCutOffset, b3Raw, sSpecNotes)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
local sNotes
|
||||
if bSplit then
|
||||
sNotes = EgtIf( i == 1, 'Split;', 'Presplit;')
|
||||
else
|
||||
sNotes = EgtIf( i == 1, 'Cut;', 'Precut;')
|
||||
end
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_DOWN, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw)
|
||||
if not bOk then return false, sErr end
|
||||
sErr = sErrHeadChamfer
|
||||
end
|
||||
end
|
||||
return true, nil, nNewPhase
|
||||
end
|
||||
|
||||
return bOk, sErr, nNewPhase
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
return ProcessSplit
|
||||
|
||||
@@ -212,7 +212,8 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
|
||||
-- applico lavorazione
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
@@ -223,7 +224,8 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
|
||||
-- applico lavorazione
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
@@ -320,10 +322,12 @@ local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if bAdj12 then
|
||||
if dAng12 < 0 then
|
||||
EgtSurfTmSwapFacets( Proc.Id, 0, 2)
|
||||
Proc.Face = BL.GetFacetsInfo( Proc, b3Raw)
|
||||
end
|
||||
elseif bAdj20 then
|
||||
if dAng20 < 0 then
|
||||
EgtSurfTmSwapFacets( Proc.Id, 1, 2)
|
||||
Proc.Face = BL.GetFacetsInfo( Proc, b3Raw)
|
||||
end
|
||||
end
|
||||
-- dati delle facce
|
||||
@@ -390,7 +394,8 @@ local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
|
||||
-- applico lavorazione
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
-- ProcessStepJointNotch.lua by Egaltech s.r.l. 2022/11/03
|
||||
-- Gestione calcolo tacca a gradino per Travi
|
||||
-- 2022/11/03 Correzione per riconoscimento testa da sotto su fresatura.
|
||||
-- 2024/06/28 In MakeFourFaces aggiunta copia del parametro PartId sulla nuova Proc
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessStepJointNotch = {}
|
||||
@@ -11,6 +12,8 @@ local BL = require( 'BeamLib')
|
||||
local Fbs = require( 'FacesBySaw')
|
||||
local DC = require( 'DiceCut')
|
||||
local Cut = require( 'ProcessCut')
|
||||
local Topology = require( 'FeatureTopology')
|
||||
local LapJoint = require( 'ProcessLapJoint')
|
||||
|
||||
EgtOutLog( ' ProcessStepJointNotch started', 1)
|
||||
|
||||
@@ -47,7 +50,7 @@ function ProcessStepJointNotch.Classify( Proc)
|
||||
-- numero delle facce
|
||||
local nFacetCnt = EgtSurfTmFacetCount( Proc.Id)
|
||||
-- gestisco solo 2 o 4 facce
|
||||
if nFacetCnt ~= 2 and nFacetCnt ~= 4 and nFacetCnt ~= 6 and nFacetCnt ~= 8 then
|
||||
if nFacetCnt ~= 2 and nFacetCnt ~= 3 and nFacetCnt ~= 4 and nFacetCnt ~= 6 and nFacetCnt ~= 8 then
|
||||
return false, false
|
||||
end
|
||||
-- verifico le normali delle facce
|
||||
@@ -130,7 +133,12 @@ local function MakePocket( Proc, nPartId, ptPs, vtN, nFaceRef, nDiffWidth, sMchF
|
||||
-- calcolo il diametro utensile
|
||||
local dDiamTool
|
||||
if nUseRoughTool == 1 then
|
||||
dDiamTool = max( 80, min( tBHx[nFaceRef][1], tBHx[nFaceRef][2]))
|
||||
-- se feature passante prendo utensile più grande possibile
|
||||
if ( Proc.AffectedFaces.Top and Proc.AffectedFaces.Bottom) or ( Proc.AffectedFaces.Front and Proc.AffectedFaces.Back) then
|
||||
dDiamTool = nil
|
||||
else
|
||||
dDiamTool = max( 80, min( tBHx[nFaceRef][1], tBHx[nFaceRef][2]))
|
||||
end
|
||||
else
|
||||
-- se non uso truciolatore prendo il valore dalle dimensioni minime delle facce
|
||||
dDiamTool = min( tBHx[nFaceRef][1], tBHx[nFaceRef][2])
|
||||
@@ -281,8 +289,8 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, ptC, vtN,
|
||||
-- setto a 0 eventuali offset
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, 0)
|
||||
-- applico gli allungamenti o accorciamenti considerando che la lavorazione è invertita
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, EgtIf( bOpenStart, dTDiam / 2, - dTDiam / 2))
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, EgtIf( bOpenEnd, dTDiam / 2, - dTDiam / 2))
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, EgtIf( bOpenStart, dTDiam / 2 + 10, - dTDiam / 2))
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, EgtIf( bOpenEnd, dTDiam / 2 + 10, - dTDiam / 2))
|
||||
-- attacchi e uscite lineari con parte tg nulla
|
||||
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.LINEAR)
|
||||
EgtSetMachiningParam( MCH_MP.LITANG, 0)
|
||||
@@ -383,7 +391,9 @@ local function MakeFourFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, nDiffWidt
|
||||
EgtSurfTmSwapFacets( AddId, 1, 3)
|
||||
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
|
||||
-- applico lavorazione
|
||||
local NewProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg}
|
||||
local NewProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, PartId = Proc.PartId}
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
Topology.Classify( NewProc, b3Raw)
|
||||
local bOk, sErr = MakeTwoFaces( NewProc, nPhase, nRawId, nPartId, dOvmHead, nDiffWidth)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
@@ -478,7 +488,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
end
|
||||
-- se diretta verso Z
|
||||
elseif abs( vtExtr:getZ()) > 0.99 then
|
||||
elseif abs( vtExtr:getZ()) > 0.99 and not ( BD.DOWN_HEAD or nTypePos == 0) then
|
||||
-- se diretta verso Z+
|
||||
if vtExtr:getZ() > 0 then
|
||||
-- se sborda verso Z+ abilito solo la lavorazione della parte normale
|
||||
@@ -503,7 +513,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local dExtra = 2
|
||||
-- recupero la lavorazione
|
||||
local sMillType = 'Mark'
|
||||
local bDownHead = ( BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1)
|
||||
local bDownHead = BD.DOWN_HEAD and vtExtr:getZ() < GEO.EPS_SMALL
|
||||
local sMilling, bH2
|
||||
sMilling, _, _, bH2 = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bDownHead)
|
||||
if not sMilling then
|
||||
@@ -536,6 +546,14 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
end
|
||||
if bExeOpposite then
|
||||
bDownHead = BD.DOWN_HEAD and vtExtr:getZ() > - GEO.EPS_SMALL
|
||||
sMilling, _, _, bH2 = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bDownHead)
|
||||
if not sMilling then
|
||||
local sErr = 'Error : milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
bDownHead = ( bDownHead and bH2)
|
||||
-- Inserisco la lavorazione del lato opposto
|
||||
local sName2 = 'SJN_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMch2Id = EgtAddMachining( sName2, sMilling)
|
||||
@@ -566,6 +584,9 @@ end
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessStepJointNotch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if Proc.Fct == 3 then
|
||||
return LapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
-- esecuzione eventuale smusso
|
||||
-- ottengo anche il flag che indica che la feature è larga come la trave
|
||||
local bOkc, sErrC, nDiffWidth = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
|
||||
@@ -200,7 +200,8 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
else
|
||||
local b3Cut = EgtGetBBoxGlob( AddId or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Cut, Fct = 1, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bFromBottom = ( bShortPart and vtExtr:getZ() > 0.25)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom)
|
||||
if not bOk then
|
||||
@@ -320,9 +321,9 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- se contorno aperto, cambio parametri di attacco/uscita
|
||||
if not bClosed then
|
||||
EgtSetMachiningParam( MCH_MP.LITANG, 0.7 * dMillDiam)
|
||||
EgtSetMachiningParam( MCH_MP.LIPERP, 0)
|
||||
EgtSetMachiningParam( MCH_MP.LIPERP, 20)
|
||||
EgtSetMachiningParam( MCH_MP.LOTANG, 0.7 * dMillDiam)
|
||||
EgtSetMachiningParam( MCH_MP.LOPERP, 0)
|
||||
EgtSetMachiningParam( MCH_MP.LOPERP, 20)
|
||||
end
|
||||
-- imposto posizione braccio porta testa
|
||||
local nSCC = MCH_SCC.NONE
|
||||
|
||||
@@ -232,7 +232,8 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw,
|
||||
-- se va fatto, inserisco la lavorazione
|
||||
if bCut then
|
||||
local CutProc = { Id = AuxId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- se taglio applicato setto la nota al gruppo Mach per non doverla lavorare una seconda volta
|
||||
if bOk then
|
||||
@@ -330,7 +331,8 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw,
|
||||
-- se va fatto, inserisco la lavorazione
|
||||
if bCut then
|
||||
local CutProc = { Id = AuxId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId, PartId = Proc.PartId}
|
||||
CutProc.AffectedFaces = BL.GetProcessAffectedFaces( CutProc)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- se taglio applicato setto la nota al gruppo Mach per non doverla lavorare una seconda volta
|
||||
if bOk then
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ EgtEnableDebug( false)
|
||||
--NEST.MACHINE = 'Essetre-90480019_MW'
|
||||
--NEST.FLAG = 3
|
||||
|
||||
local sLog = ' +++ BeamNestProcess : ' .. NEST.FILE .. ', ' .. NEST.MACHINE .. ', ' .. LEN["1"]
|
||||
local sLog = ' +++ BeamNestProcess : ' .. NEST.FILE .. ', ' .. NEST.MACHINE .. ', ' .. LEN[1]
|
||||
EgtOutLog( sLog)
|
||||
|
||||
-- flag per abilitare statistiche in log
|
||||
|
||||
+313
@@ -1,5 +1,318 @@
|
||||
==== Beam Update Log ====
|
||||
|
||||
Versione 2.7l2 (16/12/2025)
|
||||
- Added : in LapJoint pulizia spigoli con fresa a V su tasche passanti
|
||||
|
||||
Versione 2.7l1 (10/12/2025)
|
||||
- Added : in LapJoint aggiunta gestione fresatura con aggregato flottante (Q specifica)
|
||||
- Modif : in LapJoint modfifiche alla lavorazione spigoli su faccia frontale o posteriore
|
||||
- Modif : in LapJoint lunghe, la spezzatura ora considera se è presente del grezzo dietro
|
||||
|
||||
Versione 2.7k1 (25/11/2025)
|
||||
- Added : in tagli di testa e coda aggiunti smussi con possibilità di raccordare o smussare spigoli
|
||||
- Added : in Lapjoint aggiunto Q14 per settare lavorazione discorde se longitudinale su faccia sotto
|
||||
- Modif : migliorati i tagli
|
||||
- Modif : migliorata lavorazione mortasa a coda di rondine
|
||||
- Fixed : in Lapjoint alcune svuotature forzate a spirale
|
||||
|
||||
Versione 2.7j2 (30/10/2025)
|
||||
- Fixed : in DoubleCut gestito il caso in cui si ha una terza faccia piccola da non lavorare
|
||||
|
||||
Versione 2.7j1 (28/10/2025)
|
||||
- Modif : migliorato ordinamento feature
|
||||
- Modif : in mortasa si considera ora il raggio minimo impostato da parametro P
|
||||
- Modif : migliorie in tenone a coda di rondine
|
||||
- Fixed : in mortasa corretto percorso errato in caso di diametro utensile uguale a larghezza tasca
|
||||
- Fixed : in profilo cambered (103) gestito correttamente inverti in lavorazione
|
||||
|
||||
Versione 2.7i2 (30/09/2025)
|
||||
- Modif : migliorie a mortasa e tenone a coda di rondine
|
||||
- Modif : migliorie a LongDoubleCut
|
||||
- Modif : migliorie ai tagli
|
||||
|
||||
Versione 2.7i1 (03/09/2025)
|
||||
- Added : in Tenone a coda di rondine aggiunto passaggio di finitura in caso di P14 > 0
|
||||
- Modif : in LapJoint migliorata la scelta lama in caso di due facce e altre piccole correzioni
|
||||
|
||||
Versione 2.7h3 (26/08/2025)
|
||||
- Added : in LapJoint, se possibile, si ricalcola l'elevazione in caso di feature troncanti testa/coda
|
||||
- Modif : eventuali feature troncanti testa/coda sono fatte sempre subito dopo i rispettivi tagli di testa/coda
|
||||
|
||||
Versione 2.7h2 (19/08/2025)
|
||||
- Modif : migliorata ottimizzazione teste
|
||||
- Modif : migliorate forature in doppio
|
||||
- Modif : in LapJoint migliorate lavorazioni lama + sega a catena
|
||||
- Modif : in LapJoint migliorata spezzatura per feature lunghe rispetto al pezzo
|
||||
- Modif : in LapJoint tipo BirdsMouth migliorata lavorazione faccia inclinata
|
||||
- Modif : in StepJointNotch, se 3 facce si riconduce a LapJoint
|
||||
|
||||
Versione 2.7h1 (05/08/2025)
|
||||
- Fixed : in Mortise migliorata la lavorazione in caso di feature trimmata
|
||||
- Modif : in LapJoint, riduzione massimo materiale lama per lavorazioni antischeggia di lama con direzione verticale
|
||||
- Modif : in LapJoint migliorie alla lavorazione tipo BlockHaus
|
||||
- Modif : nei profili si usa il tipo lavorazione Prof_end per la finitura
|
||||
|
||||
Versione 2.7g5 (14/07/2025)
|
||||
- Fixed : in tagli di testa e coda corretti attacchi
|
||||
|
||||
Versione 2.7g4 (11/07/2025)
|
||||
- Fixed : in LapJoint 2 facce correzione nella scelta lama da sotto
|
||||
|
||||
Versione 2.7g3 (11/07/2025)
|
||||
- Fixed : in RidgeLap corretta scelta del lato da lavorare
|
||||
|
||||
Versione 2.7g2 (10/07/2025)
|
||||
- Fixed : in LapJoint correzione per caso in cui la sega a catena lavorava la tasca in modo errato
|
||||
|
||||
Versione 2.7g1 (08/07/2025)
|
||||
- Added : in LapJoint, aggiunti smussi anche se lavorazione con truciolatore
|
||||
- Added : per profilo caudato aggiunta finitura con fresa piccola
|
||||
- Added : gestione tastatura
|
||||
- Modif : nei tagli di testa e coda, compresi quelli di spezzatura, la lama evita di arretrare se non necessario
|
||||
- Modif : in LongDoubleCut migliorie varie
|
||||
- Modif : in RidgeLap migliorie varie
|
||||
- Modif : nelle forature che attraversano un taglio ora si considera la profondità già lavorata
|
||||
- Fixed : in LongDoubleCut corretta lavorazione aggiunta erroneamente dopo separazione
|
||||
|
||||
Versione 2.7f3 (19/06/2025)
|
||||
- Modif : in StepJointNotch corretta distanza attacco in/out
|
||||
|
||||
Versione 2.7f2 (18/06/2025)
|
||||
- Modif : in LongDoubleCut aggiunto messaggio feature non completa se utensile non arriva sul fondo
|
||||
- Modif : in StepJointNotch, se si forza truciolatore, si prende utensile più grande
|
||||
- Fixed : in LapJoint, piccola correzione calcolo sovrapposizione trimesh per svuotatura
|
||||
- Fixed : in LapJoint, per sovrapposizione in spezzatura, corretto caso tipo Tunnel
|
||||
|
||||
Versione 2.7f1 (03/06/2025)
|
||||
- Modif : in tenone coda di rondine modificato angolo limite tenone per lavorazione in sottosquadro
|
||||
- Modif : migliorie per lavorazioni su aggregato
|
||||
|
||||
Versione 2.7e2 (23/05/2025)
|
||||
- Modif : in tagli di lama migliorie alla scelta del lato da lavorare
|
||||
- Modif : in mortasa coda di rondine migliorati i percorsi
|
||||
- Modif : in tenone coda di rondine migliorate le lavorazioni da sotto
|
||||
- Fixed : in Scarf Joint correzione alla scelta faccia da lavorare
|
||||
|
||||
Versione 2.7e1 (05/05/2025)
|
||||
- Modif : in LapJoint se tunnel verticale lavorato solo da sopra e l'utensile non arriva, si restituisce warning
|
||||
- Fixed : in taglio di separazione si riduce percorso di taglio solo se il pezzo è effettivamente alto
|
||||
- Fixed : in foratura corretto caso in cui non si sceglieva l'utensile più lungo disponibile
|
||||
- Fixed : In BatchProcess (Ts7) corretta generazione in caso di progetto senza ricalcolo
|
||||
|
||||
Versione 2.7d3 (22/04/2025)
|
||||
- Fixed : in LapJoint corretta gestione errata Q04
|
||||
|
||||
Versione 2.7d2 (17/04/2025)
|
||||
- Added : in scanalatura aggiunta Q03 per forzare fresa
|
||||
- Modif : in slot con lama + sega a catena abilitata lavorazione da sotto per macchine con testa sopra
|
||||
- Modif : nei tagli modifche in caso di tagli di coda anticipati
|
||||
- Modif : in lavorazioni tipo tacca ma 3 facce migliorata la scelta faccia
|
||||
|
||||
Versione 2.7d1 (04/04/2025)
|
||||
- Fixed : in PreDrill piccola correzione
|
||||
- Fixed : nei tagli varie correzioni
|
||||
- Fixed : in HeadCut e Split corretto calcolo lunghezza extra di taglio
|
||||
|
||||
Versione 2.7c2 (24/03/2025)
|
||||
- Fixed : in BatchProcess (Ts7) riabilitata modifica barra erroneamente rimossa
|
||||
|
||||
Versione 2.7c1 (17/03/2025)
|
||||
- Modif : in HeadCut e Split, per decidere se fare doppio taglio verticale, si controlla anche il massimo possibile e non solo il minimo
|
||||
- Modif : in LapJoint migliorato controllo per decidere se feature di coda
|
||||
- Modif : nei tagli, se taglio rivolto verso il basso e non possibile tagliare di fianco, si fa in fase ribaltata
|
||||
- Fixed : in BatchProcess (Ts7) corretta restituzione stato feature erroneamente segnalata verde
|
||||
- Fixed : corretta restituzione stato feature lavorata in doppio
|
||||
|
||||
Versione 2.7b3 (03/03/2025)
|
||||
- Modif : in forature passanti orizzontali fatte da un solo lato, si inverte il lato di lavoro in base all'utensile scelto
|
||||
- Modif : in LapJoint in lavorazione tipo BH permessa U passante non parallela agli assi principali; attacchi migliorati
|
||||
- Modif : in LapJoint le feature di coda con pezzo lungo vengono spostate sempre dopo separazione
|
||||
- Fixed : in macchine tipo Turn piccoli miglioramenti ai tagli di lama
|
||||
|
||||
Versione 2.7b2 (05/02/2025)
|
||||
- Modif : si consentono DrillPocket in doppio solo se foro non passante
|
||||
|
||||
Versione 2.7b1 (04/02/2025)
|
||||
- Modif : in tagli di testa e coda l'utilizzo delle lame grandi (es: 1000 su 15003TMAX) è limitato ai pezzi più bassi di 300 mm e più larghi di 300 mm
|
||||
|
||||
Versione 2.7a2 (23/01/2025)
|
||||
- Added : in RidgeLap aggiunta Q05 per usare la fresa tipo LapJoint
|
||||
- Fixed : in BatchProcess (Ts7) piccola correzione
|
||||
- Fixed : in ScarfJoint, in caso di taglio dal lato, aggiunta estensione oltre il bordo
|
||||
|
||||
Versione 2.7a1 (21/01/2025)
|
||||
- Added : in FreeContour aggiunta Q09 per inversione ultima lavorazione
|
||||
- Modif : in Cut, si taglia dal basso solo se il pezzo piccolo è già staccato dalla barra
|
||||
- Modif : in BatchProcess (Ts7) aggiunta scrittura id progetto e produzione in Btm
|
||||
|
||||
Versione 2.6l2 (07/01/2025)
|
||||
- Added : in LapJoint abiitata SideMillAsBlade anche da sotto e varie migliorie
|
||||
- Modif : in LapJoint L030 aggiunto Q03=4 per lavorare con fresa evitando tasche aperte testa/coda
|
||||
- Modif : in LapJoint modifiche per gestione fresa a disco su aggregato
|
||||
- Modif : in fresature con lama o simili aggiunta la possibilità di invertire il senso di percorrenza calcolato in automatico
|
||||
- Modif : migliorie all'ordinamento
|
||||
- Fixed : in LapJoint la Q per forzare lavorazione di lato funziona solo se la feature è aperta davnti o dietro
|
||||
|
||||
Versione 2.6l1 (11/12/2024)
|
||||
- Added : aggiunta gestione slot e tagli di lama con lame molto grandi
|
||||
- Modif : in lama + motosega aggiunta gestione slot aperte con lato obliquo
|
||||
- Modif : modificata retrazione per tenoni aperti
|
||||
|
||||
Versione 2.6k2 (28/11/2024)
|
||||
- Modif : nei tagli migliorati i casi in cui si inverte l'SCC per facilitare la caduta del legno
|
||||
- Modif : nei tagli migliorato controllo rimozione del primo cubetto molto piccolo
|
||||
- Modif : nei tagli migliorati i casi con bilinea
|
||||
- Fixed : in lapjoint corretto un caso in cui si sbagliava a calcolare la dimensione della tasca
|
||||
|
||||
Versione 2.6k1 (15/11/2024)
|
||||
- Modif : in macchine tipo Fast lunghezza minima feature per considerare taglio lungo portata a 400 mm
|
||||
- Modif : in tacche si applica svuotatura anche nel caso di elevazione non raggiunta
|
||||
- Modif : in forature in doppio, se necessario, si aumenta lo step per evitare collisione tra le punte durante lavorazione
|
||||
- Fixed : in L010 correzione in utilizzo Q07 (forzatura frese)
|
||||
- Fixed : in coda di rondine corretto bug che causava un blocco anomalo del programma
|
||||
|
||||
Versione 2.6j4 (06/11/2024)
|
||||
- Fixed : corretto caso in cui i fori passanti fatti con due teste finiviano nella rotazione sbagliata, provocando un errore di chariot collision
|
||||
|
||||
Versione 2.6j3 (18/10/2024)
|
||||
- Modif : nei tagli orizzontali si inverte SCC per evitare problemi di cubetti incastrati
|
||||
- Modif : modifiche in ordinamento fori che intersecano tenoni
|
||||
- Fixed : corretto caso con fori sul tenone spostati in coda nella fase errata
|
||||
|
||||
Versione 2.6j2 (17/10/2024)
|
||||
- Fixed : in forature con precedenza corretto caso in cui il foro veniva ripetuto in rotazioni diverse
|
||||
|
||||
Versione 2.6j1 (10/10/2024)
|
||||
- Modif : se la macchina è tipo BlockHaus, i LapJoint vengono fatti prima del taglio di separazione
|
||||
- Modif : se tenone di coda è attraversato da foro allora anche il foro sarà di coda
|
||||
- Modif : migliorato ordinamento per tenoni con foro secante
|
||||
- Modif : in FreeContour migliorato pinzaggio
|
||||
- Modif : in LapJoint miglioramenti vari alla lavorazione delle facce oblique
|
||||
- Modif : In RidgeLap l'ingombro testa coda considera inclinazione feature per pinzaggio
|
||||
- Added : in FreeContour aggiunta Q08 per forzare come pinzabile l'area della feature e Q07 per ignorare possibili problemi di lettura laser
|
||||
- Added : in tagli aggiunta Q07 per forzare uso fresa
|
||||
|
||||
Versione 2.6i3 (08/10/2024)
|
||||
- Modif : In RidgeLap, ingombro testa coda considera inclinazione feature per pinzaggio.
|
||||
|
||||
Versione 2.6i2 (13/09/2024)
|
||||
- Modif : in FacesBySaw si invertono gli accorciamenti solo se l'inversione del percorso non è forzata dall'esterno; adeguati HeadCut e Split
|
||||
- Modif : in nesting correzione in lettura array per cambio dll di lettura
|
||||
- Modif : in BatchProcess e New, in caso sia richiesta generazione senza check, verifico prima che il file log specifico non contenga errori: se sì, forzo il check
|
||||
- Modif : in FacesBySaw per settare il FaceUse si usa il versore nelle UserNotes
|
||||
- Modif : in HeadCut, Split modifiche ai tagli aggiuntivi orizzontali e verticali; disattivati attacchi tangenziali per tagli aggiuntivi verticali in PF1250
|
||||
- Fixed : in ProcessDrill In GetData corretta gestione modifica diametro foro
|
||||
|
||||
Versione 2.6i1 (09/09/2024)
|
||||
- Added : refactoring e modifiche a HeadCut e Split per introduzione pretagli a zero sul grezzo, per evitare problemi con pezzi non lunghi quanto ci si aspetta
|
||||
- Added : in Mark, gestita la lavorazione del testo
|
||||
- Modif : gestione dipendenza foro-tasca in caso di fase con pezzo ribaltato
|
||||
- Modif : in Headcut e Split aggiunta gestione parametro MIN_HEIGHT_ADDED_CUTS da BeamData per scegliere l'altezza minima per cui devono essere aggiunti i tagli orizzontali supplementari
|
||||
- Modif : se Lapjoint attraversata da L055, la lapjoint viene fatta prima
|
||||
- Modif : in ScarfJoint, in dicing, tagli paralleli fatti con unico passaggio di fianco per evitare che il cubetto rimanga appoggiato al motore
|
||||
- Fixed : corretto caso di groove lunga passante a 3 facce che non veniva lavorata
|
||||
- Fixed : in FacesBySaw -> MakeOne corretta gestione lato di lavoro quando il percorso è orizzontale
|
||||
|
||||
Versione 2.6h2 (26/08/2024)
|
||||
- Added : in BatchProcess e New si verifica l'abilitazione alla generazione con EgtVerifyKeyOption
|
||||
- Modif : in FacesBySaw introdotti attacchi tangenziali solo da un lato, limitati a facce con Z negative
|
||||
- Modif : in LapJoint -> tunnel lo smusso funziona anche se è forzata la sega a catena
|
||||
- Modif : in LapJoint -> svuotatura, se l'utente ha definito un'elevazione custom si lavora sempre la faccia standard
|
||||
- Modif : in FacesBySaw -> MakeOne aggiunta la possibilità di passare una direzione di lavoro alternativa per poter rispettare contemporaneamente la direzione di lavoro concorde e la direzione di taglio.
|
||||
|
||||
Versione 2.6h1 (20/08/2024)
|
||||
- Modif : in SimpleScarf, se assimilabile a un taglio, si considera area non pinzabile
|
||||
- Modif : in LapJoint gestito smusso nel caso Groove-Blind-RightAngles-Parallel-4
|
||||
- Modif : varie modifiche ai tagli di lama per evitare chiusura rulli pneumatici e finecorsa
|
||||
- Modif : in BatchProcessNew, se presente flag apposito in EgtCam5, si evita la generazione
|
||||
|
||||
Versione 2.6g4 (19/07/2024)
|
||||
- Modif : in BatchProcess e BatchProcessNew si forza ricalcolo ogni volta che si è in situazione di CHECK o CHECK + GENERATE
|
||||
|
||||
Versione 2.6g3 (07/07/2024)
|
||||
- Added : aggiunta possibilità di funzione GetNzLimDownUp specifica per ogni macchina
|
||||
- Modif : anche nel taglio a cubetti si chiama GetNzLimDownUp di macchina, se presente, per decidere limite orientamento lama verso il basso
|
||||
- Modif : in BeamExec inserito controllo massimo numero di facce per lanciare GetFacetsInfo
|
||||
- Fixed : in LapJoint corretto typo in nome variabile che provocava mancata impostazione asse bloccato
|
||||
|
||||
Versione 2.6g2 (04/07/2024)
|
||||
- Modif : le lavorazioni BlockHaus, se vicine alla coda, vengono spostate dopo il taglio di separazione
|
||||
|
||||
Versione 2.6g1 (01/07/2024)
|
||||
- Modif : in LongDoubleCut gestita correttamente SCC per lama
|
||||
- Modif : in MachiningLib miglioramenti a scelta testa ottimizzata
|
||||
- Modif : in ProcessDtTenon correzione in scelta testa
|
||||
- Modif : In LapJoint -> VerifySideMillAsSaw modificato criterio ricerca utensile in base a normale della faccia
|
||||
- Fixed : in MakeAntiSplintBySaw se non si trova adiacenza tra le facce si restituisce errore
|
||||
- Fixed : In StepJointNotch, MakeFourFaces corretta copia feature con PartId mancante
|
||||
|
||||
Versione 2.6f2 (17/06/2024)
|
||||
- Modif : correzione a tagli a cubetti (ripristinata versione pre 2.6f1)
|
||||
|
||||
Versione 2.6f1 (06/06/2024)
|
||||
- Added : Q04 (tipo longcut) abilitato anche in RidgeLap (T30), se riconducibile a 2 facce
|
||||
- Modif : migliorie al taglio a cubetti
|
||||
- Modif : in LapJoint -> MakePocket abilitata Q per forzare massima elevazione
|
||||
- Fixed : correzione a SCC per lama da sotto con aggregato
|
||||
- Fixed : correzioni a ottimizzazione teste per macchine con teste sopra/sotto
|
||||
|
||||
Versione 2.6e5 (27/05/2024)
|
||||
- Modif : in LapJoint corretto typo in lavorazione lamello che impediva il funzionamento corretto.
|
||||
|
||||
Versione 2.6e4 (20/05/2024)
|
||||
- Modif : in SawPlusChain le lavorazioni di sega a catena aggiuntive (side) si fermano in mezzeria se tasca passante
|
||||
- Modif : in SawPlusChain il tunnel con sega a catena viene fatto da un solo lato se possibile
|
||||
|
||||
Versione 2.6e3 (14/05/2024)
|
||||
- Modif : in SawPlusChain aggiunta gestione lavorazioni aggiuntive lati aperti e tunnel
|
||||
- Fixed : in Cut -> MakeFromTop ricalcolo direzione di lavorazione su facce a cubetti.
|
||||
|
||||
Versione 2.6e2 (10/05/2024)
|
||||
- Modif : in FeatureTopology aggiunta proprietà IsTrough = true anche a Cut
|
||||
- Modif : LongCut : se non trova fresa per pulizia, da messaggio di warning anziché di errore
|
||||
- Fixed : LongCut : allungamento percorso ingresso per evitare collisioni durante approccio pezzo quando si setta OutRaw.
|
||||
|
||||
Versione 2.6e1 (03/05/2024)
|
||||
- Modif : in LapJoint Groove verso il basso lavorata di preferenza dal lato
|
||||
- Modif : in LapJoint -> SideMillAsSaw gestito anche rabbet passante
|
||||
- Fixed : in BeamExec box della feature aggiornato dopo rotazione
|
||||
- Fixed : in BeamExec GetProcessAffectedFaces e GetFacetsInfo rilanciati dopo rotazione
|
||||
- Fixed : In LapJoint -> MakeMoreLongFaces corretto calcolo divisione in parti per evitare problemi di ceil con interi perfetti
|
||||
|
||||
Versione 2.6d2 (11/04/2024)
|
||||
- Added : in LapJoint aggiunta strategia per fare tasche con lama + sega a catena, attivata da Q11
|
||||
|
||||
Versione 2.6d1 (08/04/2024)
|
||||
- Fixed : in Long2Cut corretto nome passato alla BL.GetBlockedAxis
|
||||
- Fixed : in MakeTwo rimossa gestione calcolo differente su ultima passata in caso di macchina FAST
|
||||
- Fixed : in LapJoint -> ForceSideMill escluso caso 4 facce senza possibilità di ingresso lungo Y.
|
||||
|
||||
Versione 2.6c4 (18/03/2024)
|
||||
- Fixed : correzioni a gestione prefori.
|
||||
|
||||
Versione 2.6c3 (15/03/2024)
|
||||
- Added : Aggiunta gestione prefori
|
||||
- Fixed : in LapJoint correzione a calcolo ingombro per feature basse e lunghe dalla testa.
|
||||
|
||||
Versione 2.6c2 (12/03/2024)
|
||||
- Added : in Mortase Aggiunta possibilità di inserire lavorazione di smusso
|
||||
- Added : in FreeContour aggiunto smusso se lav. di svuotatura
|
||||
- Added : in BeamExec creata funzione calcolo dipendenze tra feature
|
||||
- Added : In BeamExec -> CollectFeatures si scrive ora Width e Height della faccia sia trimmate con il grezzo che intere
|
||||
- Added : implementate le lavorazioni in doppio per fori specchiati non passanti e DrillPocket
|
||||
- Modif : in LapJoint migliorata ricerca pocket (VerifyPocket)
|
||||
- Modif : implementato attacco esterno se tasca 4 facce sulla coda ma nessun pezzo successivo
|
||||
- Modif : rimossi simboli di debug da compile
|
||||
- Fixed : In FreeContour corretto caso di smusso non passante
|
||||
|
||||
Versione 2.6c1 (29/02/2024)
|
||||
- Modif : in FacesBySaw e LapJoint migliorato calcolo area non pinzabile in testa HCING e coda TCING
|
||||
- Modif : vari miglioramenti all'ordinamento delle lavorazioni
|
||||
- Modif : in Mortise forzata SPIRAL_IN se c'è almeno un lato aperto
|
||||
- Modif : in tenone a coda di rondine aumentato a 8 il numero massimo di passate (era 6)
|
||||
- Modif : in lapjoint a due facce migliorata la scelta della lama da sotto
|
||||
- Fixed : in LapJoint corretto bug che impediva l'esecuzione della lavorazion con antischeggia attivo
|
||||
|
||||
Versione 2.6b1 (14/02/2024)
|
||||
- Fixed : corretto bug in Split in cui si chiamava la EgtSurfTmFacetNormVersor senza riferimento
|
||||
- Fixed : in L20 corretta gestione 2 facce
|
||||
|
||||
+2
-2
@@ -2,5 +2,5 @@
|
||||
-- Gestione della versione di Beam
|
||||
|
||||
NAME = 'Beam'
|
||||
VERSION = '2.6b1'
|
||||
MIN_EXE = '2.6a1'
|
||||
VERSION = '2.7l2'
|
||||
MIN_EXE = '2.7f2'
|
||||
|
||||
Reference in New Issue
Block a user