Compare commits
670 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e1c69e207d | |||
| 67b34008c5 | |||
| 1bb839e9f4 | |||
| 083f896d50 | |||
| 83c83fb5f0 | |||
| b577dfe86b | |||
| 624bc499a2 | |||
| 79e1e9fefd | |||
| dcb3e6984f | |||
| 0722c496ac | |||
| 04a252418c | |||
| 7dd75bc14b | |||
| 3a6da43acc | |||
| dd45642748 | |||
| 97e95741b9 | |||
| 73739a2931 | |||
| 690c53a5dc | |||
| f9964a2f3c | |||
| 39b5434c22 | |||
| 00881757a7 | |||
| 4be087a16d | |||
| b6ef052c50 | |||
| 1ec2188326 | |||
| 58fe1d1f8f | |||
| 8fed51ca79 | |||
| 708fe02b9b | |||
| b418e2d3ef | |||
| 0ba49c41eb | |||
| 4925ab462c | |||
| 1f09c33e46 | |||
| f0eccf0efc | |||
| 6040a7c43d | |||
| 984f206d56 | |||
| 1ba62546b0 | |||
| d7712e133e | |||
| 6d6da429e4 | |||
| aace2ff81d | |||
| 616026d74e | |||
| 00c97b0503 | |||
| 9a749e0f20 | |||
| b88c276bb0 | |||
| 3b2b185fd1 | |||
| ed58f649f3 | |||
| 5801b85a31 | |||
| e8e8a209b1 | |||
| 9005ea481f | |||
| 0748186661 | |||
| e8099c11e0 | |||
| 561796b625 | |||
| 74996adf48 | |||
| fc29cbd471 | |||
| 22c691f9e5 | |||
| 9351b9b2d8 | |||
| 8a289d07b8 | |||
| 8ce8982ca6 | |||
| 1e6120184f | |||
| a1c50a1797 | |||
| 9389b62ff1 | |||
| cda17543fe | |||
| 66f763a772 | |||
| a1300b26b9 | |||
| ac7c5e2e93 | |||
| ab56d95f77 | |||
| 6e359a5740 | |||
| 4c5849dc7b | |||
| 97c9f10813 | |||
| fd920a2786 | |||
| 63300c9620 | |||
| 3480d3dae6 | |||
| be03fea253 | |||
| 4ab7788d6d | |||
| 2bd9b292fd | |||
| 84d21c48af | |||
| cfb8e0553d | |||
| 0c9575f754 | |||
| 04bb4165c9 | |||
| 564817122f | |||
| 37de3713ff | |||
| 117c87c2b5 | |||
| c856a2c4c2 | |||
| 2ab5a38ffb | |||
| 2973f3f627 | |||
| 46aa62244c | |||
| 2133351006 | |||
| 63381e4cc9 | |||
| 1ba961c2fc | |||
| 286a9906b7 | |||
| ae9bc56917 | |||
| 8282548bf0 | |||
| e8aa3dadd7 | |||
| 517d93ba8a | |||
| 9e16e604ec | |||
| 06261b64be | |||
| 7bad9a5cc6 | |||
| ec5590bd29 | |||
| 799aef3d5a | |||
| eab9c2085a | |||
| 4b346b39ba | |||
| 14d9819153 | |||
| d12d6bcfb6 | |||
| d83ea12f1f | |||
| 043a2043aa | |||
| 5f5c0d9a8f | |||
| d162bb58f3 | |||
| da8ba3a23f | |||
| bd1e7e04ee | |||
| 75fa4a3f90 | |||
| 34a26f7d3e | |||
| bf8fd98d8c | |||
| f36c4288d4 | |||
| d78003437d | |||
| f2a70b9fe0 | |||
| 2e5caf2def | |||
| ec021af82f | |||
| d0383b7949 | |||
| c2fc8dabf5 | |||
| ff143a7fc5 | |||
| bd03f0f259 | |||
| be7d023031 | |||
| 266f125f2d | |||
| b66db767a0 | |||
| e773b5b4f7 | |||
| 69711359f5 | |||
| b569f7c631 | |||
| ed4df55645 | |||
| 21512c7e2b | |||
| 59a2e60677 | |||
| ee01fe5516 | |||
| dcbf9a497a | |||
| e92a37aa4f | |||
| bc6c7d8745 | |||
| dc0bb1876f | |||
| ca562d1c29 | |||
| be6750fd14 | |||
| 3f8d6867e2 | |||
| 9d447b875b | |||
| 15dd5d78e3 | |||
| 8f01a11205 | |||
| 21459f66d7 | |||
| 517a1021b5 | |||
| 037c52c913 | |||
| 857e96591a | |||
| 12abb88b28 | |||
| 1be259cf25 | |||
| 56e949015f | |||
| 85b76f68ff | |||
| 156ec315e0 | |||
| e851ed0a21 | |||
| fcc2289b93 | |||
| 8066f937e2 | |||
| 38b61c5676 | |||
| 7282af4d9d | |||
| 7a62031eb4 | |||
| 593545bc54 | |||
| c6903e1cad | |||
| ff4df06a3a | |||
| dbbbfb67fc | |||
| e39fbd8707 | |||
| db7defa9ce | |||
| 2ed88f66e9 | |||
| 3283f1780f | |||
| 3d31988979 | |||
| aa431b341e | |||
| 0c3e6c83d2 | |||
| d7fadcb596 | |||
| 407cbaccfa | |||
| 10bdf80b2a | |||
| 3d6567fbce | |||
| 4a53f3522e | |||
| e99822f53e | |||
| de3dcb2985 | |||
| 30f164badf | |||
| ba9bf97372 | |||
| 478a23c3fe | |||
| e560a513fe | |||
| 0ef8c7f046 | |||
| 44193063e1 | |||
| 9475e732e6 | |||
| 36eeb042a1 | |||
| 30f73c9bf4 | |||
| 1178e479e3 | |||
| a48fa50c85 | |||
| 124c9dbcbc | |||
| b156731e1e | |||
| f80d776b79 | |||
| 1347f472bc | |||
| c6dea02b61 | |||
| b8fb4336cb | |||
| 29214d1d1a | |||
| 24f1a214e2 | |||
| 2a81e2e663 | |||
| 1e3d46cab2 | |||
| 2a98f7bb19 | |||
| 4e26f19263 | |||
| cdd9e14432 | |||
| b52a8a1961 | |||
| 9b33939103 | |||
| d26fcbc23d | |||
| 50912975bd | |||
| f8280502c4 | |||
| 8c2edb8f82 | |||
| 7827558a75 | |||
| a9235ea92c | |||
| 30ab372cf7 | |||
| cd853756aa | |||
| b35086ab6d | |||
| 322336174b | |||
| 040ac8c333 | |||
| 348ecd74bd | |||
| 7e36ba12ec | |||
| f813db1bc7 | |||
| b20cd3b6d8 | |||
| ddfa249469 | |||
| 1a15584126 | |||
| f4c8541922 | |||
| 82e21c419f | |||
| 47b251d0e9 | |||
| e4e9ac66c9 | |||
| 950d54f486 | |||
| 180c635752 | |||
| 76ef5453b0 | |||
| 4f629ea069 | |||
| 2d217b307b | |||
| 11076fde17 | |||
| 0146a0023d | |||
| a6a40e2973 | |||
| ba539e0c51 | |||
| f6d62372df | |||
| 581a606740 | |||
| 662241c8e1 | |||
| 39a03c7b93 | |||
| 15a8df7f30 | |||
| 785e9d8518 | |||
| 5f2c853d42 | |||
| 2d00e94965 | |||
| 7c1ce50238 | |||
| 46aac18715 | |||
| 6c63817dbc | |||
| 9b5995a073 | |||
| b102e9ea67 | |||
| 16970fff3c | |||
| cd37b8282d | |||
| 1569653150 | |||
| b8a47c00ef | |||
| 77bd37f9f7 | |||
| 29a34528ce | |||
| 57acbc93b4 | |||
| 5104da23b0 | |||
| 3b93e47fe7 | |||
| 939ca329a8 | |||
| af5522547c | |||
| 2dee4d8ded | |||
| 34e96d1f06 | |||
| fc03d2f737 | |||
| b33463117f | |||
| 1951c517fa | |||
| f8258883ab | |||
| 6bd14f9948 | |||
| ddef3e7654 | |||
| 848701033b | |||
| ef28db40e1 | |||
| c944dd9893 | |||
| bf968abc1c | |||
| 029ed15541 | |||
| a8c366693e | |||
| 474a645e20 | |||
| 01fbdd9a50 | |||
| a127db39f0 | |||
| 689cea1156 | |||
| 866c4dde45 | |||
| c513cd7440 | |||
| 6e6050ab13 | |||
| 546855a519 | |||
| 78ab2c2a52 | |||
| 09fd122b30 | |||
| 156302009f | |||
| 094bc252fe | |||
| 9e5f78a549 | |||
| ca9b827a18 | |||
| fef634f7e8 | |||
| ba3330edca | |||
| aa74f23c63 | |||
| 727025d231 | |||
| f1cb57e084 | |||
| 9859428de5 | |||
| 22fe666cc1 | |||
| f8405a7970 | |||
| 5067af57e9 | |||
| 934a0f4be3 | |||
| 46f51ae3fe | |||
| 852183de0c | |||
| 6e3a82697c | |||
| 5b4636eab1 | |||
| 731843f877 | |||
| 17fee33ff6 | |||
| f25acd3870 | |||
| 7193ff3ac4 | |||
| 0b5fe6a619 | |||
| 4d1757ae30 | |||
| a5a020d19b | |||
| cac0af10c7 | |||
| fd672325b0 | |||
| 333673005f | |||
| 6613639f96 | |||
| 5d77408018 | |||
| 70f2df2e0a | |||
| b74f0d407d | |||
| 0c27684785 | |||
| 232ebbc833 | |||
| 2362548413 | |||
| 92d1e443a4 | |||
| eb48c9f9a0 | |||
| 72fbae9bf7 | |||
| ca2d2a142b | |||
| f15e91e3f1 | |||
| 3a2c18bf86 | |||
| c165d552c2 | |||
| 47f8df92f4 | |||
| 422eb260d5 | |||
| 7507919ce7 | |||
| e75b186dd8 | |||
| 65ef32a368 | |||
| 8d248dc776 | |||
| 84c4a80cab | |||
| e5e51f0be0 | |||
| a6c568f3cc | |||
| f756dc4a7e | |||
| 390724ff3f | |||
| 7e9285b55d | |||
| af244eb59f | |||
| 7b02dd3887 | |||
| 4f2c322af8 | |||
| b64b1d3cf0 | |||
| b03aad7ecf | |||
| 57ec816f06 | |||
| 7a864d9503 | |||
| 25b11fa3cf | |||
| f09e1874df | |||
| 3df067059b | |||
| a13eb42b3a | |||
| 7d7e3209c0 | |||
| cb20faa0cc | |||
| a60e8e2da7 | |||
| dee87d0889 | |||
| a43a4cb9ac | |||
| bd744a710c | |||
| e8664f6cab | |||
| e7c2d10111 | |||
| e8853d1023 | |||
| 0a56d76535 | |||
| 89ed5eeb2f | |||
| 265bce38fa | |||
| 14b99c473b | |||
| 4cad8af916 | |||
| d08a7b2035 | |||
| 6c90189051 | |||
| 2c44adf99c | |||
| 87666ea59c | |||
| 409ba0d5db | |||
| 9759656f80 | |||
| 646f5cf02f | |||
| 5110f70253 | |||
| d0b78e5825 | |||
| 0095847b41 | |||
| 9feb8b584c | |||
| be78774e05 | |||
| 70f32557ac | |||
| 6ad07c2443 | |||
| 9f7ba94811 | |||
| 1d20f9afe0 | |||
| f095d6caaf | |||
| 61fa524332 | |||
| 3c241080d0 | |||
| 3aab2b94fc | |||
| 50c19b2ea3 | |||
| 271db23717 | |||
| 0868600687 | |||
| 33701162bf | |||
| 77a61447c6 | |||
| b6f96e3d37 | |||
| 6d936dede4 | |||
| b157cc66ec | |||
| 130093561e | |||
| 47baf33ac2 | |||
| 422d30e44d | |||
| 8cc41bd495 | |||
| ca81e7e5ab | |||
| f1b66dc020 | |||
| 3df4b5a210 | |||
| 47f442921e | |||
| 7f0e30a8ec | |||
| d5ba495850 | |||
| fd084c55f5 | |||
| 1497d7bb25 | |||
| ab63e1908c | |||
| 505a8bd7b2 | |||
| e39426da0a | |||
| 373c3ef7f4 | |||
| d2bf6a4cec | |||
| 2d2f44f9aa | |||
| f9a496b410 | |||
| 8be11025e7 | |||
| 36db2d068c | |||
| 329d588eeb | |||
| 96d7edc513 | |||
| 3d420918f4 | |||
| 977e22a02f | |||
| c6f6f54009 | |||
| fb7ee5e7c1 | |||
| 45bd5d64e6 | |||
| df1d21356f | |||
| 0406a5b330 | |||
| ae24d97c6e | |||
| edd3f623c7 | |||
| 2a2b0e5d7e | |||
| 93598217a4 | |||
| 05f96209f7 | |||
| 06d591cc8f | |||
| 4d709418e5 | |||
| f22954bf63 | |||
| 2e6abe561d | |||
| 3b5b1211a3 | |||
| 3df6059071 | |||
| 425c24ef4c | |||
| e2e246f3f4 | |||
| 361eb44236 | |||
| 037e3281a5 | |||
| 096a890c42 | |||
| e779f874fc | |||
| 0ee84b1d1a | |||
| ddf18390a6 | |||
| b951536dfb | |||
| 8e196fbfc6 | |||
| fa6ae61eef | |||
| 431246b472 | |||
| 4b835a27be | |||
| 3bfb6e3ffb | |||
| ac72518e44 | |||
| b3895266a1 | |||
| f6afb6ac9c | |||
| b2b1206df1 | |||
| 5247e2d097 | |||
| 3c48318ebe | |||
| 532746cf84 | |||
| 7b0e3ddba2 | |||
| 45cf412985 | |||
| 83366e8d33 | |||
| b1d0f10b55 | |||
| 114c13d781 | |||
| a26846ed4f | |||
| c55962ae9b | |||
| f9e121af32 | |||
| 450a37e4f3 | |||
| 5a4f77030c | |||
| 5d945b983d | |||
| 0dee26360c | |||
| d0be3ec4dd | |||
| 21e398cef7 | |||
| 46e52e0995 | |||
| 6348a40e18 | |||
| 68a92f942c | |||
| 8156cf92e5 | |||
| 82e464c481 | |||
| 23d29eec0a | |||
| c8fe978a96 | |||
| 6d742580fa | |||
| c4ee2661b0 | |||
| c68d841b46 | |||
| 73f189e59d | |||
| 34488601f2 | |||
| db580f95d2 | |||
| b1232ac9d3 | |||
| 4af6caf657 | |||
| 0ab121d217 | |||
| 4a2f6fa439 | |||
| 1396303d5f | |||
| c3552d411f | |||
| 8950f2aca1 | |||
| 325482d50c | |||
| 38b9433a97 | |||
| 9640415ff7 | |||
| b5682b4185 | |||
| cd323ec583 | |||
| 6333707386 | |||
| ff9a1dd55b | |||
| 4048e2f09e | |||
| 3745da80c1 | |||
| 068a1c9fb7 | |||
| abd9855823 | |||
| 05baa2f0fc | |||
| 7aa4e5ac32 | |||
| 846412f256 | |||
| bcfc71d5b9 | |||
| 6cfe0a2178 | |||
| c0f84c1909 | |||
| 5ecfe9ec58 | |||
| f53bf7a7ce | |||
| f81bff5254 | |||
| 6c3a7e7dbb | |||
| ee7b9c9562 | |||
| b65a119731 | |||
| 7a51dae753 | |||
| 658018bed8 | |||
| 9d68ea5057 | |||
| de5782f2a5 | |||
| 375a7f4636 | |||
| 6755753509 | |||
| 608918b619 | |||
| 1b00139b8a | |||
| 8af2794f87 | |||
| 38635cade4 | |||
| bc373d2e33 | |||
| bc2baf17a7 | |||
| 2017d45b99 | |||
| d02422474c | |||
| ce827dc0f3 | |||
| 7ff79c295a | |||
| 37d602c6d9 | |||
| 2cea265ce3 | |||
| 7269e97a70 | |||
| 02a0928b06 | |||
| 462832fa8f | |||
| e6a74d0b45 | |||
| 9c5b90858f | |||
| 6f7adce5e2 | |||
| b43700909b | |||
| 1badb47d71 | |||
| c2bb3bc43b | |||
| 07f75b3994 | |||
| 50ebe36cd1 | |||
| 70a9aeed15 | |||
| 83aa382463 | |||
| fcca2706c3 | |||
| c917f6bb4e | |||
| 63ca83fa01 | |||
| 6ccfaa7651 | |||
| e379c216b8 | |||
| f51cfd089f | |||
| 3e3a31051e | |||
| 9b47b777d4 | |||
| 95d26a9c11 | |||
| 0449d9fe8c | |||
| a6a9ab5bba | |||
| fdf4326f3a | |||
| e81290308d | |||
| 469b2a0935 | |||
| 1bd74a3c3c | |||
| d098e4bcbc | |||
| fbf91fcafa | |||
| 78b67c1527 | |||
| 3d46b4b41b | |||
| 9e5dbcf5fb | |||
| ab6a0db22d | |||
| 7929a41d5f | |||
| a26a1fa546 | |||
| a9d57c8021 | |||
| 931083217c | |||
| 86853914b2 | |||
| 679ce5bcbc | |||
| 310acbdb64 | |||
| bfc52671cd | |||
| 4ac0de990e | |||
| 731e698404 | |||
| a07c76377e | |||
| 60ce762793 | |||
| 3959ab60a3 | |||
| 516a85a950 | |||
| c7cd7dfea8 | |||
| c6d500174e | |||
| 920dcb502f | |||
| b001f26339 | |||
| 8c4c606ee1 | |||
| 9c73479441 | |||
| 719bb994bd | |||
| e61dd3d17b | |||
| 9e52787c8b | |||
| 92fba6f1d4 | |||
| a3511ba89d | |||
| a31dfa3378 | |||
| 171c473e5b | |||
| 9c38fcd015 | |||
| 6986c01fba | |||
| 68a6a544c6 | |||
| fece411fa7 | |||
| 103c5d0388 | |||
| 2e1d247e27 | |||
| 888cc604b5 | |||
| c191d6d831 | |||
| e97b9df6d4 | |||
| e6a03b0b2e | |||
| bafb8f55ed | |||
| d1406baa2e | |||
| 89d46baf43 | |||
| 1f57693da8 | |||
| 010f676234 | |||
| 1839b45e96 | |||
| 9bc699be18 | |||
| f701828a25 | |||
| f8d2f26692 | |||
| 4e3079e504 | |||
| 0d0f195d8b | |||
| 7fbce2b593 | |||
| 74b2874f56 | |||
| 9540563a87 | |||
| 8eeca04757 | |||
| db6ae7538f | |||
| 839639fcc8 | |||
| c3729befbb | |||
| a79d9c9fe8 | |||
| d3b281a858 | |||
| 37d0b8f552 | |||
| 737124b0bd | |||
| 09bdd4852d | |||
| 1d3c722fd3 | |||
| 3ca2db72e9 | |||
| 028a5b7bba | |||
| 1179ad7e84 | |||
| d8c5fe0ea7 | |||
| a21be79df8 | |||
| d66cc47936 | |||
| cd2315af46 | |||
| 204d63b7c9 | |||
| 5a5b48326f | |||
| bd448babd9 | |||
| 73ba4eb93a | |||
| 268fa05cc0 | |||
| b5ef9ae6dc | |||
| fcaf15cbe1 | |||
| ab84757a80 | |||
| 0fab073568 | |||
| 4d29452c2d | |||
| 1bcff0eb79 | |||
| 52bcc69023 | |||
| 18ccead437 | |||
| d49f198720 | |||
| 368721dcaa | |||
| c8c8d9e2a5 | |||
| d5c39485ea | |||
| e14c8eb8b3 | |||
| d5638e192c | |||
| 85cdb84a5a | |||
| 63a71db7ff | |||
| aa369739c9 | |||
| d19dfc5f8f | |||
| d874e30288 | |||
| 4047b8385e | |||
| 63e95ab2fe | |||
| 93a5bd72c7 | |||
| b3a1ee8e6c | |||
| 562e8342c3 | |||
| 8c821750ba | |||
| 6669fdc7a9 | |||
| e2043a7e3a | |||
| f92cec9d3d | |||
| f30f028b17 | |||
| 1adcb2991c | |||
| 285e0ce910 | |||
| 652aa35aaa | |||
| 2b5aacc160 | |||
| 1097f2a19f | |||
| 8c1b61b6b8 | |||
| 80363af1f6 | |||
| 9b5adeaeb3 | |||
| 01854f30ed | |||
| cdb35b4c38 | |||
| 994658da16 | |||
| 135c0bda51 | |||
| d927848815 | |||
| 7b91c17cb3 | |||
| 3851bdcecb |
@@ -17,9 +17,11 @@
|
||||
#include "Axis.h"
|
||||
#include "MachConst.h"
|
||||
#include "/EgtDev/Include/EGkGdbConst.h"
|
||||
#include "/EgtDev/Include/EGkGeoVector3d.h"
|
||||
#include "/EgtDev/Include/EGkUserObjFactory.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGkUiUnits.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -48,6 +50,7 @@ Axis::Clone( void) const
|
||||
pAx->m_bInvert = m_bInvert ;
|
||||
pAx->m_dOffset = m_dOffset ;
|
||||
pAx->m_nType = m_nType ;
|
||||
pAx->m_nUse = m_nUse ;
|
||||
pAx->m_ptPos = m_ptPos ;
|
||||
pAx->m_vtDir = m_vtDir ;
|
||||
pAx->m_Stroke = m_Stroke ;
|
||||
@@ -72,6 +75,7 @@ Axis::Dump( string& sOut, bool bMM, const char* szNewLine) const
|
||||
sOut += "Name=" + m_sName + szNewLine ;
|
||||
sOut += "Token=" + m_sToken + szNewLine ;
|
||||
sOut += "Type=" + ToString( m_nType) + szNewLine ;
|
||||
sOut += "Use=" + ToString( m_nUse) + szNewLine ;
|
||||
sOut += "Pos=" + ToString( GetInUiUnits( m_ptPos, bMM), 4) + szNewLine ;
|
||||
sOut += "Dir=" + ToString( m_vtDir) + szNewLine ;
|
||||
if ( m_nType == MCH_AT_LINEAR)
|
||||
@@ -111,20 +115,21 @@ Axis::GetGeomDB( void) const
|
||||
//----------------------------------------------------------------------------
|
||||
Axis::Axis( void)
|
||||
: m_nOwnerId( GDB_ID_NULL), m_pGeomDB( nullptr), m_bInvert( false), m_dOffset( 0),
|
||||
m_nType( MCH_AT_NONE), m_Stroke( {{0,0}}), m_dHomeVal( 0), m_dCurrVal( 0)
|
||||
m_nType( MCH_AT_NONE), m_nUse( MCH_AU_NONE), m_Stroke( {{0,0}}), m_dHomeVal( 0), m_dCurrVal( 0)
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Axis::Set( const string& sName, const string& sToken, bool bInvert, double dOffset,
|
||||
int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome)
|
||||
int nType, int nUse, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome)
|
||||
{
|
||||
m_sName = sName ;
|
||||
m_sToken = sToken ;
|
||||
m_bInvert = bInvert ;
|
||||
m_dOffset = dOffset ;
|
||||
m_nType = nType ;
|
||||
m_nType = ( nType == MCH_AT_ROTARY ? MCH_AT_ROTARY : MCH_AT_LINEAR) ;
|
||||
m_nUse = (( nUse == MCH_AU_DISPOSITION || nUse == MCH_AU_AUXILIAR) ? nUse : MCH_AU_GENERAL) ;
|
||||
m_ptPos = ptPos ;
|
||||
m_vtDir = vtDir ;
|
||||
m_Stroke = Stroke ;
|
||||
@@ -137,9 +142,8 @@ Axis::Set( const string& sName, const string& sToken, bool bInvert, double dOffs
|
||||
bool
|
||||
Axis::Modify( const Point3d& ptPos, double dAxisMaxAdjust)
|
||||
{
|
||||
// Verifico che lo spostamento non superi il massimo ammesso
|
||||
Vector3d vtDelta = ptPos - m_ptPos ;
|
||||
Vector3d vtDeltaPerp = vtDelta - ( vtDelta * m_vtDir) * m_vtDir ;
|
||||
// Verifico che lo spostamento perpendicolare alla sua direzione non superi il massimo ammesso
|
||||
Vector3d vtDeltaPerp = OrthoCompo( ptPos - m_ptPos, m_vtDir) ;
|
||||
if ( vtDeltaPerp.Len() > dAxisMaxAdjust) {
|
||||
string sOut = " Modify Axis " + m_sName + " Position (" + ToString( ptPos) + ") failed" ;
|
||||
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
|
||||
@@ -147,6 +151,11 @@ Axis::Modify( const Point3d& ptPos, double dAxisMaxAdjust)
|
||||
}
|
||||
// Assegno la nuova posizione
|
||||
m_ptPos = ptPos ;
|
||||
// Sistemo la geometria dell'asse
|
||||
int nV = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, m_sName) ;
|
||||
IGeoVector3d* pGV = GetGeoVector3d( m_pGeomDB->GetGeoObj( nV)) ;
|
||||
if ( pGV != nullptr)
|
||||
pGV->ChangeBase( m_ptPos) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -164,6 +173,11 @@ Axis::Modify( const Vector3d& vtDir, double dAxisMaxRotAdj)
|
||||
}
|
||||
// Assegno la nuova direzione
|
||||
m_vtDir = vtDirN ;
|
||||
// Sistemo la geometria dell'asse
|
||||
int nV = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, m_sName) ;
|
||||
IGeoVector3d* pGV = GetGeoVector3d( m_pGeomDB->GetGeoObj( nV)) ;
|
||||
if ( pGV != nullptr)
|
||||
pGV->ChangeVector( m_vtDir) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -172,10 +186,7 @@ bool
|
||||
Axis::Modify( const STROKE& Stroke)
|
||||
{
|
||||
m_Stroke = Stroke ;
|
||||
if ( m_dHomeVal < m_Stroke.Min)
|
||||
m_dHomeVal = m_Stroke.Min ;
|
||||
else if ( m_dHomeVal > m_Stroke.Max)
|
||||
m_dHomeVal = m_Stroke.Max ;
|
||||
m_dHomeVal = Clamp( m_dHomeVal, m_Stroke.Min, m_Stroke.Max) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -183,12 +194,7 @@ Axis::Modify( const STROKE& Stroke)
|
||||
bool
|
||||
Axis::Modify( double dHome)
|
||||
{
|
||||
if ( dHome < m_Stroke.Min)
|
||||
m_dHomeVal = m_Stroke.Min ;
|
||||
else if ( dHome > m_Stroke.Max)
|
||||
m_dHomeVal = m_Stroke.Max ;
|
||||
else
|
||||
m_dHomeVal = dHome ;
|
||||
m_dHomeVal = Clamp( dHome, m_Stroke.Min, m_Stroke.Max) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2022
|
||||
// EgalTech 2015-2025
|
||||
//----------------------------------------------------------------------------
|
||||
// File : Axis.h Data : 21.09.22 Versione : 2.4i
|
||||
// File : Axis.h Data : 17.04.25 Versione : 2.7d2
|
||||
// Contenuto : Dichiarazione della classe Axis.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 24.05.15 DS Creazione modulo.
|
||||
//
|
||||
// 17.04.25 DS Aggiunto campo Use.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -31,7 +31,7 @@ class Axis : public IUserObj
|
||||
public :
|
||||
Axis( void) ;
|
||||
bool Set( const std::string& sName, const std::string& sToken, bool bInvert, double dOffset,
|
||||
int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome) ;
|
||||
int nType, int nUse, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome) ;
|
||||
bool Modify( const Point3d& ptPos, double dAxisMaxAdjust) ;
|
||||
bool Modify( const Vector3d& vtDir, double dAxisMaxRotAdj) ;
|
||||
bool Modify( const STROKE& Stroke) ;
|
||||
@@ -48,6 +48,8 @@ class Axis : public IUserObj
|
||||
{ return m_dOffset ; }
|
||||
int GetType( void) const
|
||||
{ return m_nType ; }
|
||||
int GetUse( void) const
|
||||
{ return m_nUse ; }
|
||||
const Point3d& GetPos( void) const
|
||||
{ return m_ptPos ; }
|
||||
const Vector3d& GetDir( void) const
|
||||
@@ -67,6 +69,7 @@ class Axis : public IUserObj
|
||||
bool m_bInvert ;
|
||||
double m_dOffset ;
|
||||
int m_nType ;
|
||||
int m_nUse ;
|
||||
Point3d m_ptPos ;
|
||||
Vector3d m_vtDir ;
|
||||
STROKE m_Stroke ;
|
||||
|
||||
+27
-6
@@ -1,13 +1,14 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2016
|
||||
// EgalTech 2015-2023
|
||||
//----------------------------------------------------------------------------
|
||||
// File : CamData.cpp Data : 24.02.16 Versione : 1.6n8
|
||||
// File : CamData.cpp Data : 22.11.23 Versione : 2.5k3
|
||||
// Contenuto : Implementazione informazioni Cam di ogni movimento.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 10.06.15 DS Creazione modulo.
|
||||
// 24.02.16 DS Versione 2 (aggiunti m_nMove e m_ptCen).
|
||||
// 22.11.23 DS Aggiunto flag ToolShow (forza in ogni caso la visualizzazione della direzione utensile).
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -53,7 +54,9 @@ static int CAM_PARAM_V7 = 22 ;
|
||||
static string CAM_ORIGFEED = "OrFeed" ;
|
||||
static int CAM_PARAM_V8 = 23 ;
|
||||
static string CAM_FLAG2 = "Flg2" ;
|
||||
static int CAM_TOTPARAM =CAM_PARAM_V8 ;
|
||||
static int CAM_PARAM_V9 = 24 ;
|
||||
static string CAM_TOOLSHOW = "TSh" ;
|
||||
static int CAM_TOTPARAM = CAM_PARAM_V9 ;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -79,6 +82,7 @@ CamData::Clone( void) const
|
||||
pCam->m_pGeomDB = nullptr ;
|
||||
pCam->m_nMove = m_nMove ;
|
||||
pCam->m_nCorre = m_nCorre ;
|
||||
pCam->m_bToolShow = m_bToolShow ;
|
||||
pCam->m_vtTool = m_vtTool ;
|
||||
pCam->m_vtCorr = m_vtCorr ;
|
||||
pCam->m_vtAux = m_vtAux ;
|
||||
@@ -139,6 +143,7 @@ CamData::Dump( string& sOut, bool bMM, const char* szNewLine) const
|
||||
sOut += CAM_AXND + "=" + ToString( m_vtMachN) + szNewLine ;
|
||||
sOut += CAM_NDLT + "=" + ToString( m_dDeltaN) + szNewLine ;
|
||||
sOut += CAM_BDIR + "=" + ToString( m_vtBackAux) + szNewLine ;
|
||||
sOut += CAM_TOOLSHOW + "=" + ToString( m_bToolShow) + szNewLine ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -149,6 +154,8 @@ CamData::SetOwner( int nId, IGeomDB* pGDB)
|
||||
{
|
||||
m_nOwnerId = nId ;
|
||||
m_pGeomDB = pGDB ;
|
||||
if ( m_pGeomDB != nullptr)
|
||||
m_pGeomDB->SetStipple( m_nOwnerId, ( m_nMove == 0 ? 3 : 0), 0x8C8C) ;
|
||||
return ( m_nOwnerId != GDB_ID_NULL && m_pGeomDB != nullptr) ;
|
||||
}
|
||||
|
||||
@@ -203,6 +210,8 @@ CamData::Save( int nBaseId, STRVECTOR& vString) const
|
||||
vString[++k] = CAM_ORIGFEED + "=" + ToString( m_dOrigFeed) ;
|
||||
// parametri aggiunti V8
|
||||
vString[++k] = CAM_FLAG2 + "=" + ToString( m_nFlag2) ;
|
||||
// parametri aggiunti V9
|
||||
vString[++k] = CAM_TOOLSHOW + "=" + ToString( m_bToolShow) ;
|
||||
}
|
||||
catch( ...) {
|
||||
return false ;
|
||||
@@ -295,6 +304,14 @@ CamData::Load( const STRVECTOR& vString, int nBaseGdbId)
|
||||
else {
|
||||
m_nFlag2 = 0 ;
|
||||
}
|
||||
// parametri aggiunti V9
|
||||
if ( int( vString.size()) >= CAM_PARAM_V9) {
|
||||
if ( ! GetVal( vString[++k], CAM_TOOLSHOW, m_bToolShow))
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
m_bToolShow = false ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -311,7 +328,7 @@ CamData::GetDrawPolyLines( POLYLINELIST& lstPL) const
|
||||
PolyLine& PL = lstPL.back() ;
|
||||
// dimensioni
|
||||
const double TLEN = 40 ;
|
||||
const double ALEN = 4 ;
|
||||
const double ALEN = 1 ;
|
||||
// inserisco disegno nella polilinea
|
||||
PL.AddUPoint( 0, m_ptEnd) ;
|
||||
Point3d ptTip = m_ptEnd + m_vtTool * TLEN ;
|
||||
@@ -333,6 +350,9 @@ CamData::GetDrawPolyLines( POLYLINELIST& lstPL) const
|
||||
ptP6.ToGlob( frF) ;
|
||||
PL.AddUPoint( 6, ptP6) ;
|
||||
PL.AddUPoint( 6, ptTip) ;
|
||||
// da visualizzare sempre se richiesto
|
||||
if ( m_bToolShow)
|
||||
PL.SetTempProp( 1) ;
|
||||
}
|
||||
// se vettore correzione non nullo
|
||||
if ( ! m_vtCorr.IsSmall()) {
|
||||
@@ -342,7 +362,7 @@ CamData::GetDrawPolyLines( POLYLINELIST& lstPL) const
|
||||
PolyLine& PL = lstPL.back() ;
|
||||
// dimensioni
|
||||
const double CLEN = 20 ;
|
||||
const double ALEN = 2 ;
|
||||
const double ALEN = 1 ;
|
||||
// inserisco disegno nella polilinea
|
||||
PL.AddUPoint( 0, m_ptEnd) ;
|
||||
Point3d ptTip = m_ptEnd + m_vtCorr * CLEN ;
|
||||
@@ -371,7 +391,7 @@ CamData::GetDrawPolyLines( POLYLINELIST& lstPL) const
|
||||
PolyLine& PL = lstPL.back() ;
|
||||
// dimensioni
|
||||
const double CLEN = 20 ;
|
||||
const double ALEN = 2 ;
|
||||
const double ALEN = 1 ;
|
||||
// inserisco disegno nella polilinea
|
||||
PL.AddUPoint( 0, m_ptEnd) ;
|
||||
Point3d ptTip = m_ptEnd + m_vtAux * CLEN ;
|
||||
@@ -546,6 +566,7 @@ CamData::CamData( void)
|
||||
m_pGeomDB = nullptr ;
|
||||
m_nMove = 0 ;
|
||||
m_nCorre = 0 ;
|
||||
m_bToolShow = false ;
|
||||
m_dAngCen = 0 ;
|
||||
m_dDeltaN = 0 ;
|
||||
m_dFeed = 0 ;
|
||||
|
||||
@@ -68,11 +68,15 @@ class CamData : public IUserObj
|
||||
bool SetAxesAngCen( double dAngCen) ;
|
||||
bool SetAxesNormDir( const Vector3d& vtDir) ;
|
||||
bool SetBackAuxDir( const Vector3d& vtDir) ;
|
||||
const int GetMoveType( void) const
|
||||
bool SetToolShow( bool bShow)
|
||||
{ m_bToolShow = bShow ; return true ; }
|
||||
int GetMoveType( void) const
|
||||
{ return m_nMove ; }
|
||||
const bool IsLine( void) const
|
||||
bool IsRapid( void) const
|
||||
{ return ( m_nMove == 0) ; }
|
||||
bool IsLine( void) const
|
||||
{ return ( m_nMove == 0 || m_nMove == 1) ; }
|
||||
const bool IsArc( void) const
|
||||
bool IsArc( void) const
|
||||
{ return ( m_nMove == 2 || m_nMove == 3) ; }
|
||||
const Vector3d& GetToolDir( void) const
|
||||
{ return m_vtTool ; }
|
||||
@@ -108,14 +112,16 @@ class CamData : public IUserObj
|
||||
{ return m_vMachAxes ; }
|
||||
const Point3d& GetAxesCen( void) const
|
||||
{ return m_ptMachCen ; }
|
||||
const double GetAxesRad( void) const
|
||||
double GetAxesRad( void) const
|
||||
{ return m_dMachRad ; }
|
||||
const double GetAxesAngCen( void) const
|
||||
double GetAxesAngCen( void) const
|
||||
{ return m_dMachAngCen ; }
|
||||
const Vector3d& GetAxesNormDir( void) const
|
||||
{ return m_vtMachN ; }
|
||||
const Vector3d& GetBackAuxDir( void) const
|
||||
{ return m_vtBackAux ; }
|
||||
bool GetToolShow( void) const
|
||||
{ return m_bToolShow ; }
|
||||
|
||||
public :
|
||||
enum { AS_NONE = 0,
|
||||
@@ -139,6 +145,7 @@ class CamData : public IUserObj
|
||||
IGeomDB* m_pGeomDB ;
|
||||
int m_nMove ; // tipo movimento (0=rapido, 1=lineare, 2=arco CW, 3=arco CCW)
|
||||
int m_nCorre ; // tipo correzione (0, 41, 42, 141, 142, 40)
|
||||
bool m_bToolShow ; // flag per forzare la visualizzazione della direzione utensile in ogni caso
|
||||
Vector3d m_vtTool ; // versore fresa
|
||||
Vector3d m_vtCorr ; // versore correzione
|
||||
Vector3d m_vtAux ; // versore ausiliario
|
||||
|
||||
+51
-27
@@ -44,6 +44,7 @@ using namespace std ;
|
||||
// 2910 = "Error in Chiseling : link movements not calculable"
|
||||
// 2911 = "Error in Chiseling : link outstroke xx"
|
||||
// 2912 = "Error in Chiseling : post apply not calculable"
|
||||
// 2913 = "Error in Chiseling : special apply not calculable"
|
||||
// 2951 = "Warning in Chiseling : Skipped entity (xx)"
|
||||
// 2952 = "Warning in Chiseling : Plunges not found"
|
||||
// 2953 = "Warning in Chiseling : Tool name changed (xx)"
|
||||
@@ -397,7 +398,8 @@ Chiseling::SetGeometry( const SELVECTOR& vIds)
|
||||
// verifico validità gestore DB geometrico
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// reset della geometria corrente
|
||||
// copia temporanea e reset della geometria corrente
|
||||
SELVECTOR vOldId = m_vId ;
|
||||
m_vId.clear() ;
|
||||
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve o tutte facce)
|
||||
int nType = GEO_NONE ;
|
||||
@@ -413,7 +415,8 @@ Chiseling::SetGeometry( const SELVECTOR& vIds)
|
||||
m_vId.emplace_back( Id) ;
|
||||
}
|
||||
// aggiorno lo stato
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
if ( m_vId != vOldId)
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
// restituisco presenza geometria da lavorare
|
||||
return ( ! m_vId.empty() || vIds.empty()) ;
|
||||
}
|
||||
@@ -495,21 +498,25 @@ Chiseling::Apply( bool bRecalc, bool bPostApply)
|
||||
return false ;
|
||||
|
||||
// aggiorno dati geometrici dell'utensile
|
||||
bool bToolChanged = true ;
|
||||
if ( ! UpdateToolData( &bToolChanged)) {
|
||||
if ( ! UpdateToolData()) {
|
||||
m_pMchMgr->SetLastError( 2901, "Error in Chiseling : UpdateToolData failed") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// se modificata geometria, necessario ricalcolo
|
||||
if ( ( m_nStatus & MCH_ST_GEO_MODIF) != 0)
|
||||
bRecalc = true ;
|
||||
|
||||
// verifico se necessario continuare nell'aggiornamento
|
||||
if ( ! bRecalc && ! bToolChanged &&
|
||||
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
|
||||
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
// confermo i percorsi di lavorazione
|
||||
m_nChisels = nCurrChisels ;
|
||||
LOG_DBG_INFO( GetEMkLogger(), "Chiseling apply skipped : status already ok") ;
|
||||
string sLog = string( "Chiseling apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ;
|
||||
LOG_DBG_INFO( GetEMkLogger(), sLog.c_str()) ;
|
||||
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
|
||||
if ( ! Update( bPostApply))
|
||||
return false ;
|
||||
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
|
||||
LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
|
||||
// esco con successo
|
||||
return true ;
|
||||
@@ -595,6 +602,9 @@ Chiseling::Update( bool bPostApply)
|
||||
return true ;
|
||||
}
|
||||
|
||||
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
|
||||
RemoveClimbRiseHome() ;
|
||||
|
||||
// imposto eventuale asse bloccato da lavorazione
|
||||
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
|
||||
|
||||
@@ -611,6 +621,19 @@ Chiseling::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni speciali
|
||||
string sSpecErr ;
|
||||
if ( bPostApply && ! SpecialApply( sSpecErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sSpecErr))
|
||||
m_pMchMgr->SetLastError( 2913, sSpecErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2913, "Error in Chiseling : special apply not calculable") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
|
||||
if ( ! AdjustStartEndMovements()) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
@@ -621,14 +644,11 @@ Chiseling::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni
|
||||
string sErr ;
|
||||
if ( bPostApply && ! PostApply( sErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sErr))
|
||||
m_pMchMgr->SetLastError( 2912, sErr) ;
|
||||
// esecuzione eventuali personalizzazioni finali
|
||||
string sPostErr ;
|
||||
if ( bPostApply && ! PostApply( sPostErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sPostErr))
|
||||
m_pMchMgr->SetLastError( 2912, sPostErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2912, "Error in Chiseling : post apply not calculable") ;
|
||||
return false ;
|
||||
@@ -758,16 +778,20 @@ Chiseling::GetToolData( void) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Chiseling::UpdateToolData( bool* pbChanged)
|
||||
Chiseling::UpdateToolData( void)
|
||||
{
|
||||
// recupero il gestore DB utensili della macchina corrente
|
||||
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
|
||||
if ( pTMgr == nullptr)
|
||||
return false ;
|
||||
// recupero l'utensile nel DB utensili
|
||||
// recupero l'utensile nel DB utensili (se fallisce con UUID provo con il nome)
|
||||
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
if ( pTdata == nullptr) {
|
||||
pTdata = pTMgr->GetTool( m_Params.m_sToolName) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
m_Params.m_ToolUuid = m_TParams.m_Uuid ;
|
||||
}
|
||||
// salvo posizione TC, testa e uscita originali
|
||||
string sOrigTcPos = m_TParams.m_sTcPos ;
|
||||
string sOrigHead = m_TParams.m_sHead ;
|
||||
@@ -805,9 +829,9 @@ Chiseling::UpdateToolData( bool* pbChanged)
|
||||
m_Params.m_sToolName + ")" ;
|
||||
m_pMchMgr->SetWarning( 2954, sInfo) ;
|
||||
}
|
||||
// se definito parametro di ritorno, lo assegno
|
||||
if ( pbChanged != nullptr)
|
||||
*pbChanged = bChanged ;
|
||||
// se modificato, aggiusto lo stato
|
||||
if ( bChanged)
|
||||
m_nStatus = MCH_ST_TO_VERIFY ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -1007,7 +1031,7 @@ Chiseling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
|
||||
// la porto in globale
|
||||
pCrvCompo->ToGlob( frGlob) ;
|
||||
// sistemazioni varie
|
||||
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, 0) ;
|
||||
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, {}, 0) ;
|
||||
// la restituisco
|
||||
lstPC.emplace_back( Release( pCrvCompo)) ;
|
||||
return true ;
|
||||
@@ -1033,8 +1057,8 @@ Chiseling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
|
||||
for ( int nC = nCstart ; nC < nCend ; ++ nC) {
|
||||
// recupero i contorni del chunk
|
||||
for ( int nL = 0 ; nL < pReg->GetLoopCount( nC) ; ++ nL) {
|
||||
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCrvCompo) || ! pCrvCompo->AddCurve( pReg->GetLoop( nC, nL)))
|
||||
PtrOwner<ICurveComposite> pCrvCompo ;
|
||||
if ( ! pCrvCompo.Set( ConvertCurveToComposite( pReg->GetLoop( nC, nL))))
|
||||
return false ;
|
||||
// assegno l'estrusione dalla normale alla regione
|
||||
pCrvCompo->SetExtrusion( vtN) ;
|
||||
@@ -1043,7 +1067,7 @@ Chiseling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
|
||||
// la porto in globale
|
||||
pCrvCompo->ToGlob( frGlob) ;
|
||||
// sistemazioni varie
|
||||
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, 0) ;
|
||||
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, {}, 0) ;
|
||||
// la restituisco
|
||||
lstPC.emplace_back( Release( pCrvCompo)) ;
|
||||
}
|
||||
@@ -1514,7 +1538,7 @@ Chiseling::GenerateChiselingCl( const SqHole& hole, int nPathId)
|
||||
SetAuxDir( hole.vtAux) ;
|
||||
// 1 -> punto approccio
|
||||
SetFlag( 1) ;
|
||||
double dAppr = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
|
||||
double dAppr = GetSafeZ() ;
|
||||
Point3d ptP1 = hole.ptIni + hole.vtExtr * dAppr ;
|
||||
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
|
||||
return false ;
|
||||
|
||||
+9
-3
@@ -37,8 +37,14 @@ class Chiseling : public Machining
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_CHISELING ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nChisels == 0) ; }
|
||||
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
|
||||
{ if ( m_nChisels == 0)
|
||||
return true ;
|
||||
if ( nEmptyType == NEED_ONE_TP_OK)
|
||||
return ( ! IsAtLeastOnePathOk()) ;
|
||||
if ( nEmptyType == NEED_ALL_TP_OK)
|
||||
return ( ! AreAllPathsOk()) ;
|
||||
return false ; }
|
||||
bool UpdateStatus( int nModif) override
|
||||
{ m_nStatus |= nModif ; return true ; }
|
||||
|
||||
@@ -60,7 +66,7 @@ class Chiseling : public Machining
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool UpdateToolData( bool* pbChanged = nullptr) override ;
|
||||
bool UpdateToolData( void) override ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
|
||||
|
||||
+6
-2
@@ -71,6 +71,10 @@ struct ChiselingData : public MachiningData
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline const ChiselingData* GetChiselingData( const MachiningData* pMdata)
|
||||
{ return (dynamic_cast<const ChiselingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_CHISELING)
|
||||
return nullptr ;
|
||||
return ( static_cast<const ChiselingData*>( pMdata)) ; }
|
||||
inline ChiselingData* GetChiselingData( MachiningData* pMdata)
|
||||
{ return (dynamic_cast<ChiselingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_CHISELING)
|
||||
return nullptr ;
|
||||
return ( static_cast<ChiselingData*>( pMdata)) ; }
|
||||
|
||||
+292
-52
@@ -21,22 +21,24 @@
|
||||
#include "/EgtDev/Include/EGkAngle.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGkUserObjFactory.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
#include "/EgtDev/Include/EGnStringKeyVal.h"
|
||||
#include "/EgtDev/Include/EGnFileUtils.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//------------------------------ Errors --------------------------------------
|
||||
// 2001 = "Error adding fixture xx"
|
||||
// 2002 = "Error placing fixture xx"
|
||||
// 2003 = "Error in MoveToCornerRawPart xx"
|
||||
// 2004 = "Error in MoveToCenterRawPart xx"
|
||||
// 2005 = "Error in ApplyRotationToRawPart xx"
|
||||
// 2006 = "Error in OnSpecialApplyDisposition (xxx)"
|
||||
// 2007 = "Error in Disposition : axes values not calculable"
|
||||
// 2008 = "Error in Disposition : outstroke xxx"
|
||||
// 2009 = "Error in Disposition : link movements not calculable"
|
||||
// 2010 = "Error in Disposition : link outstroke xxx"
|
||||
// 2001 = "Error moving axis xx"
|
||||
// 2002 = "Error adding fixture xx"
|
||||
// 2003 = "Error placing fixture xx"
|
||||
// 2004 = "Error in MoveToCornerRawPart xx"
|
||||
// 2005 = "Error in MoveToCenterRawPart xx"
|
||||
// 2006 = "Error in ApplyRotationToRawPart xx"
|
||||
// 2007 = "Error in OnSpecialApplyDisposition (xxx)"
|
||||
// 2008 = "Error in Disposition : axes values not calculable"
|
||||
// 2009 = "Error in Disposition : outstroke xxx"
|
||||
// 2010 = "Error in Disposition : link movements not calculable"
|
||||
// 2011 = "Error in Disposition : link outstroke xxx"
|
||||
// 2051 = "Table Ref1 changed : (xyz) -> (XYZ)"
|
||||
// 2052 = "Warning in Disposition : No shifts"
|
||||
// 2053 = "Warning in OnSpecialApplyDisposition (xxx)"
|
||||
@@ -46,11 +48,15 @@ static string DIS_TABLE = "Tab" ;
|
||||
static string DIS_PHASE = "Ph" ;
|
||||
static string DIS_REF1 = "Ref1" ;
|
||||
static string DIS_AREA1 = "Area1" ;
|
||||
static string DIS_AXD_TOT = "AxT" ;
|
||||
static string DIS_AXD_NAME = "AxN" ;
|
||||
static string DIS_AXD_POS = "AxP" ;
|
||||
static string DIS_FXD_TOT = "FxT" ;
|
||||
static string DIS_FXD_NAME = "FxN" ;
|
||||
static string DIS_FXD_POS = "FxP" ;
|
||||
static string DIS_FXD_ANG = "FxA" ;
|
||||
static string DIS_FXD_MOV = "FxM" ;
|
||||
static string DIS_FXD_LINK = "FxL" ;
|
||||
static string DIS_MVD_TOT = "MvT" ;
|
||||
static string DIS_MVD_ID = "MvI" ;
|
||||
static string DIS_MVD_TYPE = "MvT" ;
|
||||
@@ -86,10 +92,13 @@ Disposition::Clone( void) const
|
||||
// eseguo copia dei dati
|
||||
if ( pDisp != nullptr) {
|
||||
try { pDisp->m_sTabName = m_sTabName ;
|
||||
pDisp->m_pMchMgr = m_pMchMgr ;
|
||||
pDisp->m_nPhase = m_nPhase ;
|
||||
pDisp->m_ptRef1 = m_ptRef1 ;
|
||||
pDisp->m_b3Area1 = m_b3Area1 ;
|
||||
pDisp->m_dAreaOffset = m_dAreaOffset ;
|
||||
pDisp->m_bTabOk = m_bTabOk ;
|
||||
pDisp->m_vAxData = m_vAxData ;
|
||||
pDisp->m_vFixData = m_vFixData ;
|
||||
pDisp->m_vMvrData = m_vMvrData ;
|
||||
pDisp->m_sHead = m_sHead ;
|
||||
@@ -118,12 +127,17 @@ Disposition::Dump( string& sOut, bool bMM, const char* szNewLine) const
|
||||
sOut += DIS_REF1 + EQUAL + "(" + ToString( m_ptRef1, 3) + ")" + szNewLine ;
|
||||
sOut += DIS_AREA1 + EQUAL + "(" + ToString( m_b3Area1, 3) + ")" + szNewLine ;
|
||||
sOut += DIS_AREA1_OFFS + EQUAL + "(" + ToString( m_dAreaOffset) + ")" + szNewLine ;
|
||||
for ( const auto& AxData : m_vAxData) {
|
||||
sOut += "AxD=" + AxData.sName + "," +
|
||||
ToString( AxData.dPos) + szNewLine ;
|
||||
}
|
||||
for ( const auto& FixData : m_vFixData) {
|
||||
sOut += "FxD=" + FixData.sName + "," +
|
||||
ToString( FixData.nId) + ",(" +
|
||||
ToString( FixData.ptPos) + ")," +
|
||||
ToString( FixData.dAng) + "," +
|
||||
ToString( FixData.dMov) + szNewLine ;
|
||||
ToString( FixData.dMov) + "," +
|
||||
( IsEmptyOrSpaces( FixData.sTaLink) ? "__" : FixData.sTaLink) + szNewLine ;
|
||||
}
|
||||
for ( const auto& MvrData : m_vMvrData) {
|
||||
sOut += "MvD=" + ToString( MvrData.nRawId) + "," ;
|
||||
@@ -157,12 +171,14 @@ Disposition::Save( int nBaseId, STRVECTOR& vString) const
|
||||
{
|
||||
try {
|
||||
int k = - 1 ;
|
||||
int nAxdTot = int( m_vAxData.size()) ;
|
||||
int nAxdLines = ( nAxdTot == 0 ? 0 : 1 + 2 * nAxdTot) ;
|
||||
int nFxdTot = int( m_vFixData.size()) ;
|
||||
int nFxdLines = 1 + 4 * nFxdTot ;
|
||||
int nFxdLines = 1 + 5 * nFxdTot ;
|
||||
int nMvdTot = int( m_vMvrData.size()) ;
|
||||
int nMvdLines = 1 + 4 * nMvdTot ;
|
||||
int nOther = 7 ;
|
||||
vString.insert( vString.begin(), 4 + nFxdLines + nMvdLines + nOther, "") ;
|
||||
vString.insert( vString.begin(), 4 + nAxdLines + nFxdLines + nMvdLines + nOther, "") ;
|
||||
// Nome
|
||||
if ( ! SetVal( DIS_TABLE, m_sTabName, vString[++k]))
|
||||
return false ;
|
||||
@@ -175,6 +191,16 @@ Disposition::Save( int nBaseId, STRVECTOR& vString) const
|
||||
// Prima area
|
||||
if ( ! SetVal( DIS_AREA1, m_b3Area1, vString[++k]))
|
||||
return false ;
|
||||
// Dati assi (se presenti)
|
||||
if ( nAxdTot > 0) {
|
||||
if ( ! SetVal( DIS_AXD_TOT, nAxdTot, vString[++k]))
|
||||
return false ;
|
||||
for ( const auto& AxData : m_vAxData) {
|
||||
if ( ! SetVal( DIS_AXD_NAME, AxData.sName, vString[++k]) ||
|
||||
! SetVal( DIS_AXD_POS, AxData.dPos, vString[++k]))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// Dati sottopezzi
|
||||
if ( ! SetVal( DIS_FXD_TOT, nFxdTot, vString[++k]))
|
||||
return false ;
|
||||
@@ -182,7 +208,8 @@ Disposition::Save( int nBaseId, STRVECTOR& vString) const
|
||||
if ( ! SetVal( DIS_FXD_NAME, FixData.sName, vString[++k]) ||
|
||||
! SetVal( DIS_FXD_POS, FixData.ptPos, vString[++k]) ||
|
||||
! SetVal( DIS_FXD_ANG, FixData.dAng, vString[++k]) ||
|
||||
! SetVal( DIS_FXD_MOV, FixData.dMov, vString[++k]))
|
||||
! SetVal( DIS_FXD_MOV, FixData.dMov, vString[++k]) ||
|
||||
! SetVal( DIS_FXD_LINK, FixData.sTaLink, vString[++k]))
|
||||
return false ;
|
||||
}
|
||||
// Dati posizionamento grezzi
|
||||
@@ -235,12 +262,27 @@ Disposition::Load( const STRVECTOR& vString, int nBaseGdbId)
|
||||
// prima area
|
||||
if ( ! GetVal( vString[++k], DIS_AREA1, m_b3Area1))
|
||||
return false ;
|
||||
// dati assi opzionali
|
||||
int nAxdTot = 0 ;
|
||||
if ( ! GetVal( vString[++k], DIS_AXD_TOT, nAxdTot))
|
||||
-- k ;
|
||||
int nAxdLines = ( nAxdTot == 0 ? 0 : 1 + 2 * nAxdTot) ;
|
||||
if ( nAxdTot > 0) {
|
||||
if ( int( vString.size()) < 3 + nAxdLines + 1)
|
||||
return false ;
|
||||
m_vAxData.insert( m_vAxData.begin(), nAxdTot, AxisData()) ;
|
||||
for ( auto& AxData : m_vAxData) {
|
||||
if ( ! GetVal( vString[++k], DIS_AXD_NAME, AxData.sName) ||
|
||||
! GetVal( vString[++k], DIS_AXD_POS, AxData.dPos))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// dati sottopezzi
|
||||
int nFxdTot ;
|
||||
if ( ! GetVal( vString[++k], DIS_FXD_TOT, nFxdTot))
|
||||
return false ;
|
||||
int nFxdLines = 1 + 3 * nFxdTot ;
|
||||
if ( int( vString.size()) < 3 + nFxdLines + 1)
|
||||
if ( int( vString.size()) < 3 + nAxdLines + nFxdLines + 1)
|
||||
return false ;
|
||||
m_vFixData.insert( m_vFixData.begin(), nFxdTot, FixtureData()) ;
|
||||
for ( auto& FixData : m_vFixData) {
|
||||
@@ -254,13 +296,17 @@ Disposition::Load( const STRVECTOR& vString, int nBaseGdbId)
|
||||
if ( ! GetVal( vString[++k], DIS_FXD_MOV, FixData.dMov))
|
||||
-- k ;
|
||||
}
|
||||
if ( k + 1 < int( vString.size())) {
|
||||
if ( ! GetVal( vString[++k], DIS_FXD_LINK, FixData.sTaLink))
|
||||
-- k ;
|
||||
}
|
||||
}
|
||||
// dati posizionamento grezzi
|
||||
int nMvdTot ;
|
||||
if ( ! GetVal( vString[++k], DIS_MVD_TOT, nMvdTot))
|
||||
return false ;
|
||||
int nMvdLines = 1 + 4 * nMvdTot ;
|
||||
if ( int( vString.size()) < 3 + nFxdLines + nMvdLines)
|
||||
if ( int( vString.size()) < 3 + nAxdLines + nFxdLines + nMvdLines)
|
||||
return false ;
|
||||
m_vMvrData.insert( m_vMvrData.begin(), nMvdTot, MoveRawData()) ;
|
||||
for ( auto& MvrData : m_vMvrData) {
|
||||
@@ -433,6 +479,16 @@ Disposition::Apply( bool bVerifyTab)
|
||||
if ( ( ! m_bTabOk || bVerifyTab) && ! SetTable( m_sTabName))
|
||||
return false ;
|
||||
bool bOk = true ;
|
||||
// annullo movimento assi
|
||||
m_pMchMgr->ResetAllAxesPos( false, true) ;
|
||||
// aggiornamento movimenti assi
|
||||
for ( auto& AxData : m_vAxData) {
|
||||
if ( ! m_pMchMgr->SetAxisPos( AxData.sName, AxData.dPos)) {
|
||||
string sOut = "Error moving axis " + AxData.sName ;
|
||||
m_pMchMgr->SetLastError( 2001, sOut) ;
|
||||
bOk = false ;
|
||||
}
|
||||
}
|
||||
// aggiornamento sottopezzi
|
||||
for ( auto& FixData : m_vFixData) {
|
||||
// se sottopezzo da caricare
|
||||
@@ -440,7 +496,7 @@ Disposition::Apply( bool bVerifyTab)
|
||||
int nId = AddFixture( FixData.sName, GDB_ID_NULL, FixData.ptPos, FixData.dAng, FixData.dMov, false) ;
|
||||
if ( nId == GDB_ID_NULL) {
|
||||
string sOut = "Error adding fixture " + FixData.sName ;
|
||||
m_pMchMgr->SetLastError( 2001, sOut) ;
|
||||
m_pMchMgr->SetLastError( 2002, sOut) ;
|
||||
bOk = false ;
|
||||
}
|
||||
else
|
||||
@@ -450,7 +506,7 @@ Disposition::Apply( bool bVerifyTab)
|
||||
else {
|
||||
if ( ! PlaceFixture( FixData.nId, FixData.ptPos, FixData.dAng, FixData.dMov)) {
|
||||
string sOut = "Error placing fixture " + ToString( FixData.nId) ;
|
||||
m_pMchMgr->SetLastError( 2002, sOut) ;
|
||||
m_pMchMgr->SetLastError( 2003, sOut) ;
|
||||
bOk = false ;
|
||||
}
|
||||
}
|
||||
@@ -472,21 +528,21 @@ Disposition::Apply( bool bVerifyTab)
|
||||
case MoveRawData::COR :
|
||||
if ( ! MoveToCornerRawPart( vMvrData.nRawId, vMvrData.ptP, vMvrData.nFlag, false, false)) {
|
||||
string sOut = "Error in MoveToCornerRawPart " + ToString( vMvrData.nRawId) ;
|
||||
m_pMchMgr->SetLastError( 2003, sOut) ;
|
||||
m_pMchMgr->SetLastError( 2004, sOut) ;
|
||||
bOk = false ;
|
||||
}
|
||||
break ;
|
||||
case MoveRawData::CEN :
|
||||
if ( ! MoveToCenterRawPart( vMvrData.nRawId, vMvrData.ptP, vMvrData.nFlag, false, false)) {
|
||||
string sOut = "Error in MoveToCenterRawPart " + ToString( vMvrData.nRawId) ;
|
||||
m_pMchMgr->SetLastError( 2004, sOut) ;
|
||||
m_pMchMgr->SetLastError( 2005, sOut) ;
|
||||
bOk = false ;
|
||||
}
|
||||
break ;
|
||||
case MoveRawData::ROT :
|
||||
if ( ! ApplyRotationToRawPart( vMvrData.nRawId, vMvrData.ptP.x, vMvrData.ptP.y, vMvrData.ptP.z, false)) {
|
||||
string sOut = "Error in ApplyRotationToRawPart " + ToString( vMvrData.nRawId) ;
|
||||
m_pMchMgr->SetLastError( 2005, sOut) ;
|
||||
m_pMchMgr->SetLastError( 2006, sOut) ;
|
||||
bOk = false ;
|
||||
}
|
||||
break ;
|
||||
@@ -518,6 +574,69 @@ Disposition::IsInTable( const BBox3d& b3B)
|
||||
return b3AllArea.EnclosesXY( b3B) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Disposition::MoveAxis( const string& sName, double dPos)
|
||||
{
|
||||
// verifico MachMgr e GeomDB
|
||||
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// verifico tavola
|
||||
if ( ! m_bTabOk && ! SetTable( m_sTabName))
|
||||
return false ;
|
||||
// verifico sia un asse di disposizione (ovvero dipendente dalla tavola)
|
||||
if ( ! m_pMchMgr->IsDispositionAxis( sName, m_sTabName))
|
||||
return false ;
|
||||
// cerco eventuale movimento dello stesso asse già inserito
|
||||
int nInd = -1 ;
|
||||
for ( int i = 0 ; i < int( m_vAxData.size()) ; ++ i) {
|
||||
if ( m_vAxData[i].sName == sName) {
|
||||
nInd = i ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
// eseguo movimento
|
||||
if ( ! m_pMchMgr->SetAxisPos( sName, dPos))
|
||||
return false ;
|
||||
// salvo movimento
|
||||
if ( nInd < 0)
|
||||
m_vAxData.emplace_back( sName, dPos) ;
|
||||
else
|
||||
m_vAxData[nInd].dPos = dPos ;
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Disposition::RemoveAxis( const string& sName)
|
||||
{
|
||||
// verifico MachMgr e GeomDB
|
||||
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// verifico tavola
|
||||
if ( ! m_bTabOk && ! SetTable( m_sTabName))
|
||||
return false ;
|
||||
// verifico sia un asse di disposizione (ovvero dipendente dalla tavola)
|
||||
if ( ! m_pMchMgr->IsDispositionAxis( sName, m_sTabName))
|
||||
return false ;
|
||||
// cerco eventuale movimento dello stesso asse già inserito
|
||||
int nInd = -1 ;
|
||||
for ( int i = 0 ; i < int( m_vAxData.size()) ; ++ i) {
|
||||
if ( m_vAxData[i].sName == sName) {
|
||||
nInd = i ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
// se non trovato, non devo fare alcunché
|
||||
if ( nInd < 0)
|
||||
return true ;
|
||||
// rimetto asse in home e rimuovo movimento dalla lista
|
||||
m_pMchMgr->ResetAxisPos( sName) ;
|
||||
m_vAxData.erase( m_vAxData.begin() + nInd) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Disposition::AddFixture( const string& sName, int nId, const Point3d& ptPos, double dAngDeg,
|
||||
@@ -615,20 +734,26 @@ Disposition::AddFixture( const string& sName, int nId, const Point3d& ptPos, dou
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
// muovo eventuale parte mobile
|
||||
double dMovEff = dMov ;
|
||||
int nMobId = m_pGeomDB->GetFirstNameInGroup( nFixtId, FXT_MOBILE) ;
|
||||
if ( nMobId != GDB_ID_NULL) {
|
||||
double dMinVal = 0 ;
|
||||
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MINPOS, dMinVal) ;
|
||||
double dMaxVal = INFINITO ;
|
||||
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MAXPOS, dMaxVal) ;
|
||||
double dCurrVal = 0 ;
|
||||
m_pGeomDB->GetInfo( nMobId, FXT_MOB_CPOS, dCurrVal) ;
|
||||
if ( abs( dMov - dCurrVal) > EPS_SMALL) {
|
||||
dMovEff = Clamp( dMov, dMinVal, dMaxVal) ;
|
||||
if ( abs( dMovEff - dCurrVal) > EPS_SMALL) {
|
||||
Vector3d vtDir = Z_AX ;
|
||||
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MOVEDIR, vtDir) ;
|
||||
m_pGeomDB->TranslateGroup( nMobId, (dMov - dCurrVal) * vtDir) ;
|
||||
m_pGeomDB->SetInfo( nMobId, FXT_MOB_CPOS, dMov) ;
|
||||
m_pGeomDB->TranslateGroup( nMobId, ( dMovEff - dCurrVal) * vtDir) ;
|
||||
m_pGeomDB->SetInfo( nMobId, FXT_MOB_CPOS, dMovEff) ;
|
||||
}
|
||||
}
|
||||
// se da aggiungere alla lista
|
||||
if ( bAddToList) {
|
||||
m_vFixData.emplace_back( sName, nFixtId, ptPos, dAngDeg, dMov) ;
|
||||
m_vFixData.emplace_back( sName, nFixtId, ptPos, dAngDeg, dMovEff) ;
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
}
|
||||
return nFixtId ;
|
||||
@@ -732,6 +857,31 @@ Disposition::RotateFixture( int nId, double dDeltaAngDeg)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Disposition::SetFixtureLink( int nId, const string& sTaLink)
|
||||
{
|
||||
// verifica validità sottopezzo
|
||||
if ( m_pMchMgr == nullptr || ! m_pMchMgr->VerifyFixtureInGroup( nId, false))
|
||||
return false ;
|
||||
// verifico aggiornamento tavola
|
||||
if ( ! m_bTabOk && ! SetTable( m_sTabName))
|
||||
return false ;
|
||||
// verifico ch eil link sia un asse di disposizione (ovvero dipendente dalla tavola)
|
||||
if ( ! m_pMchMgr->IsDispositionAxis( sTaLink, m_sTabName))
|
||||
return false ;
|
||||
// aggiorno la posizione dell'oggetto nel vettore dei comandi
|
||||
for ( auto& FixData : m_vFixData) {
|
||||
if ( FixData.nId == nId) {
|
||||
FixData.sTaLink = sTaLink ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
// imposto stato a modificato
|
||||
m_nStatus |= MCH_ST_PARAM_MODIF ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Disposition::MoveFixtureMobile( int nId, double dDeltaMov)
|
||||
@@ -742,22 +892,72 @@ Disposition::MoveFixtureMobile( int nId, double dDeltaMov)
|
||||
// verifico aggiornamento tavola
|
||||
if ( ! m_bTabOk && ! SetTable( m_sTabName))
|
||||
return false ;
|
||||
// muovo eventuale parte mobile
|
||||
// recupero la parte mobile
|
||||
int nMobId = m_pGeomDB->GetFirstNameInGroup( nId, FXT_MOBILE) ;
|
||||
if ( nMobId != GDB_ID_NULL) {
|
||||
double dCurrVal = 0 ;
|
||||
m_pGeomDB->GetInfo( nMobId, FXT_MOB_CPOS, dCurrVal) ;
|
||||
if ( abs( dDeltaMov) > EPS_SMALL) {
|
||||
Vector3d vtDir = Z_AX ;
|
||||
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MOVEDIR, vtDir) ;
|
||||
m_pGeomDB->TranslateGroup( nMobId, dDeltaMov * vtDir) ;
|
||||
m_pGeomDB->SetInfo( nMobId, FXT_MOB_CPOS, ( dCurrVal + dDeltaMov)) ;
|
||||
}
|
||||
}
|
||||
if ( nMobId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// recupero limiti di corsa e posizione
|
||||
double dMinVal = 0 ;
|
||||
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MINPOS, dMinVal) ;
|
||||
double dMaxVal = INFINITO ;
|
||||
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MAXPOS, dMaxVal) ;
|
||||
double dCurrVal = 0 ;
|
||||
m_pGeomDB->GetInfo( nMobId, FXT_MOB_CPOS, dCurrVal) ;
|
||||
// verifico movimento richiesto e fattibile non nullo
|
||||
double dDeltaEff = Clamp( dCurrVal + dDeltaMov, dMinVal, dMaxVal) - dCurrVal ;
|
||||
if ( abs( dDeltaEff) < EPS_SMALL)
|
||||
return true ;
|
||||
// eseguo il movimento
|
||||
Vector3d vtDir = Z_AX ;
|
||||
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MOVEDIR, vtDir) ;
|
||||
m_pGeomDB->TranslateGroup( nMobId, dDeltaEff * vtDir) ;
|
||||
m_pGeomDB->SetInfo( nMobId, FXT_MOB_CPOS, ( dCurrVal + dDeltaEff)) ;
|
||||
// aggiorno la posizione dell'oggetto nel vettore dei comandi
|
||||
for ( auto& FixData : m_vFixData) {
|
||||
if ( FixData.nId == nId) {
|
||||
FixData.dMov += dDeltaMov ;
|
||||
FixData.dMov += dDeltaEff ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
// imposto stato a modificato
|
||||
m_nStatus |= MCH_ST_PARAM_MODIF ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Disposition::SetFixtureMobile( int nId, double dMov)
|
||||
{
|
||||
// verifica validità sottopezzo
|
||||
if ( m_pMchMgr == nullptr || ! m_pMchMgr->VerifyFixtureInGroup( nId, false))
|
||||
return false ;
|
||||
// verifico aggiornamento tavola
|
||||
if ( ! m_bTabOk && ! SetTable( m_sTabName))
|
||||
return false ;
|
||||
// recupero la parte mobile
|
||||
int nMobId = m_pGeomDB->GetFirstNameInGroup( nId, FXT_MOBILE) ;
|
||||
if ( nMobId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// recupero limiti di corsa e posizione
|
||||
double dMinVal = 0 ;
|
||||
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MINPOS, dMinVal) ;
|
||||
double dMaxVal = INFINITO ;
|
||||
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MAXPOS, dMaxVal) ;
|
||||
double dCurrVal = 0 ;
|
||||
m_pGeomDB->GetInfo( nMobId, FXT_MOB_CPOS, dCurrVal) ;
|
||||
// verifico movimento richiesto e fattibile non nullo
|
||||
double dMovEff = Clamp( dMov, dMinVal, dMaxVal) ;
|
||||
if ( abs( dMovEff - dCurrVal) < EPS_SMALL)
|
||||
return true ;
|
||||
// eseguo il movimento
|
||||
Vector3d vtDir = Z_AX ;
|
||||
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MOVEDIR, vtDir) ;
|
||||
m_pGeomDB->TranslateGroup( nMobId, ( dMovEff - dCurrVal) * vtDir) ;
|
||||
m_pGeomDB->SetInfo( nMobId, FXT_MOB_CPOS, dMovEff) ;
|
||||
// aggiorno la posizione dell'oggetto nel vettore dei comandi
|
||||
for ( auto& FixData : m_vFixData) {
|
||||
if ( FixData.nId == nId) {
|
||||
FixData.dMov = dMovEff ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
@@ -805,15 +1005,21 @@ Disposition::PlaceFixture( int nId, const Point3d& ptPos, double dAngDeg, double
|
||||
if ( abs( dAngDeg) > EPS_ANG_SMALL)
|
||||
m_pGeomDB->RotateGroup( nId, ORIG, Z_AX, dAngDeg) ;
|
||||
// muovo eventuale parte mobile
|
||||
double dMovEff = dMov ;
|
||||
int nMobId = m_pGeomDB->GetFirstNameInGroup( nId, FXT_MOBILE) ;
|
||||
if ( nMobId != GDB_ID_NULL) {
|
||||
double dMinVal = 0 ;
|
||||
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MINPOS, dMinVal) ;
|
||||
double dMaxVal = INFINITO ;
|
||||
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MAXPOS, dMaxVal) ;
|
||||
double dCurrVal = 0 ;
|
||||
m_pGeomDB->GetInfo( nMobId, FXT_MOB_CPOS, dCurrVal) ;
|
||||
if ( abs( dMov - dCurrVal) > EPS_SMALL) {
|
||||
dMovEff = Clamp( dMov, dMinVal, dMaxVal) ;
|
||||
if ( abs( dMovEff - dCurrVal) > EPS_SMALL) {
|
||||
Vector3d vtDir = Z_AX ;
|
||||
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MOVEDIR, vtDir) ;
|
||||
m_pGeomDB->TranslateGroup( nMobId, ( dMov - dCurrVal) * vtDir) ;
|
||||
m_pGeomDB->SetInfo( nMobId, FXT_MOB_CPOS, dMov) ;
|
||||
m_pGeomDB->TranslateGroup( nMobId, ( dMovEff - dCurrVal) * vtDir) ;
|
||||
m_pGeomDB->SetInfo( nMobId, FXT_MOB_CPOS, dMovEff) ;
|
||||
}
|
||||
}
|
||||
// aggiorno la posizione dell'oggetto nel vettore dei comandi
|
||||
@@ -821,7 +1027,7 @@ Disposition::PlaceFixture( int nId, const Point3d& ptPos, double dAngDeg, double
|
||||
if ( FixData.nId == nId) {
|
||||
FixData.ptPos = ptPos ;
|
||||
FixData.dAng = dAngDeg ;
|
||||
FixData.dMov = dMov ;
|
||||
FixData.dMov = dMovEff ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
@@ -885,7 +1091,7 @@ Disposition::MoveToCornerRawPart( int nRawId, const Point3d& ptP, int nFlag, boo
|
||||
case MCH_CR_TR :
|
||||
vtMove = ( m_ptRef1 + ptP) - Point3d( b3Raw.GetMax().x, b3Raw.GetMax().y, b3Raw.GetMin().z) ;
|
||||
break ;
|
||||
default : // RPCP_BL
|
||||
default : // MCH_CR_BL
|
||||
vtMove = ( m_ptRef1 + ptP) - b3Raw.GetMin() ;
|
||||
break ;
|
||||
case MCH_CR_BR :
|
||||
@@ -936,7 +1142,7 @@ Disposition::MoveToCenterRawPart( int nRawId, const Point3d& ptP, int nFlag, boo
|
||||
case MCH_CE_TC :
|
||||
vtMove = ( m_ptRef1 + ptP) - Point3d( ptCen.x, b3Raw.GetMax().y, ptCen.z) ;
|
||||
break ;
|
||||
default : // RPCE_ML
|
||||
default : // MCH_CE_ML
|
||||
vtMove = ( m_ptRef1 + ptP) - Point3d( b3Raw.GetMin().x, ptCen.y, ptCen.z) ;
|
||||
break ;
|
||||
case MCH_CE_MR :
|
||||
@@ -1060,7 +1266,7 @@ Disposition::RotateRawPart( int nRawId, const Vector3d& vtAx, double dAngRotDeg)
|
||||
case MCH_CR_TR :
|
||||
vtCorr = Vector3d( b3Raw.GetMax().x - b3OriRaw.GetMax().x, b3Raw.GetMax().y - b3OriRaw.GetMax().y, b3Raw.GetMin().z - b3OriRaw.GetMin().z) ;
|
||||
break ;
|
||||
default : // RPCP_BL
|
||||
default : // MCH_CR_BL
|
||||
vtCorr = Vector3d( b3Raw.GetMin().x - b3OriRaw.GetMin().x, b3Raw.GetMin().y - b3OriRaw.GetMin().y, b3Raw.GetMin().z - b3OriRaw.GetMin().z) ;
|
||||
break ;
|
||||
case MCH_CR_BR :
|
||||
@@ -1075,7 +1281,7 @@ Disposition::RotateRawPart( int nRawId, const Vector3d& vtAx, double dAngRotDeg)
|
||||
case MCH_CE_TC :
|
||||
vtCorr = Vector3d( ptCen.x - ptOriCen.x, b3Raw.GetMax().y - b3OriRaw.GetMax().y, ptCen.z - ptOriCen.z) ;
|
||||
break ;
|
||||
default : // RPCE_ML
|
||||
default : // MCH_CE_ML
|
||||
vtCorr = Vector3d( b3Raw.GetMin().x - b3OriRaw.GetMin().x, ptCen.y - ptOriCen.y, ptCen.z - ptOriCen.z) ;
|
||||
break ;
|
||||
case MCH_CE_MR :
|
||||
@@ -1205,6 +1411,23 @@ Disposition::InsertMoveInfoInList( int nRawId, int nType, const Point3d& ptP, in
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Disposition::UpdateRawPartId( int nRawId, int nNewRawId)
|
||||
{
|
||||
// aggiorno i movimenti registrati per questo grezzo
|
||||
while ( true) {
|
||||
auto iIter = find_if( m_vMvrData.begin(), m_vMvrData.end(),
|
||||
[ nRawId]( const MoveRawData& Mrv)
|
||||
{ return ( Mrv.nRawId == nRawId) ; }) ;
|
||||
if ( iIter == m_vMvrData.end())
|
||||
break ;
|
||||
else
|
||||
iIter->nRawId = nNewRawId ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Disposition::RemoveRawPart( int nRawId)
|
||||
@@ -1227,10 +1450,26 @@ Disposition::RemoveRawPart( int nRawId)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Disposition::GetMoveAxisData( int nInd, string& sName, double& dPos) const
|
||||
{
|
||||
// verifico MachMgr e GeomDB
|
||||
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// verifico l'indice
|
||||
if ( nInd < 0 || nInd >= int( m_vAxData.size()))
|
||||
return false ;
|
||||
// recupero i dati
|
||||
sName = m_vAxData[nInd].sName ;
|
||||
dPos = m_vAxData[nInd].dPos ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Disposition::GetFixtureData( int nInd, string& sName, int& nId, Point3d& ptPos,
|
||||
double& dAngDeg, double& dMov) const
|
||||
double& dAngDeg, double& dMov, string& sTaLink) const
|
||||
{
|
||||
// verifico MachMgr e GeomDB
|
||||
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
|
||||
@@ -1244,6 +1483,7 @@ Disposition::GetFixtureData( int nInd, string& sName, int& nId, Point3d& ptPos,
|
||||
ptPos = m_vFixData[nInd].ptPos ;
|
||||
dAngDeg = m_vFixData[nInd].dAng ;
|
||||
dMov = m_vFixData[nInd].dMov ;
|
||||
sTaLink = m_vFixData[nInd].sTaLink ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -1358,7 +1598,7 @@ Disposition::SpecialApply( bool bRecalc)
|
||||
string sOut = sMsg ;
|
||||
if ( IsEmptyOrSpaces( sOut))
|
||||
sOut = " Error in " + ON_SPECIAL_APPLY + " (" + ToString( nErr) + ")" ;
|
||||
m_pMchMgr->SetLastError( 2006, sOut) ;
|
||||
m_pMchMgr->SetLastError( 2007, sOut) ;
|
||||
return false ;
|
||||
}
|
||||
// recupero eventuale warning
|
||||
@@ -1399,21 +1639,21 @@ Disposition::SpecialUpdate( void)
|
||||
return true ;
|
||||
}
|
||||
// calcolo assi macchina
|
||||
if ( ! CalculateAxesValues( "", false)) {
|
||||
if ( ! CalculateAxesValues( "")) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
if ( sInfo.empty())
|
||||
m_pMchMgr->SetLastError( 2007, "Error in Disposition : axes values not calculable") ;
|
||||
m_pMchMgr->SetLastError( 2008, "Error in Disposition : axes values not calculable") ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2008, "Error in Disposition : outstroke ") ;
|
||||
m_pMchMgr->SetLastError( 2009, "Error in Disposition : outstroke ") ;
|
||||
return false ;
|
||||
}
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine di tutti
|
||||
if ( ! AdjustStartEndMovements()) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
if ( sInfo.empty())
|
||||
m_pMchMgr->SetLastError( 2009, "Error in Disposition : link movements not calculable") ;
|
||||
m_pMchMgr->SetLastError( 2010, "Error in Disposition : link movements not calculable") ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2010, "Error in Disposition : link outstroke ") ;
|
||||
m_pMchMgr->SetLastError( 2011, "Error in Disposition : link outstroke ") ;
|
||||
return false ;
|
||||
}
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
|
||||
+32
-4
@@ -15,6 +15,18 @@
|
||||
|
||||
#include "Operation.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
struct AxisData
|
||||
{
|
||||
std::string sName ; // nome dell'asse ausiliario da muovere
|
||||
double dPos ; // posizione dell'asse
|
||||
AxisData( void)
|
||||
: sName(), dPos( 0) {}
|
||||
AxisData( const std::string& sN, double dP)
|
||||
: sName( sN), dPos( dP) {}
|
||||
} ;
|
||||
typedef std::vector<AxisData> AXDATAVECTOR ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
struct FixtureData
|
||||
{
|
||||
@@ -23,8 +35,9 @@ struct FixtureData
|
||||
Point3d ptPos ; // posizione nel riferimento tavola
|
||||
double dAng ; // angolo di rotazione attorno al centro
|
||||
double dMov ; // posizione eventuale parte mobile
|
||||
std::string sTaLink ; // eventuale asse di tavola a cui è fissata
|
||||
FixtureData( void)
|
||||
: sName(), nId( GDB_ID_NULL), ptPos(), dAng( 0), dMov( 0) {}
|
||||
: sName(), nId( GDB_ID_NULL), ptPos(), dAng( 0), dMov( 0), sTaLink() {}
|
||||
FixtureData( const std::string& sN, int nI, const Point3d& ptP, double dA, double dM)
|
||||
: sName( sN), nId( nI), ptPos( ptP), dAng( dA), dMov( dM) {}
|
||||
} ;
|
||||
@@ -60,8 +73,14 @@ class Disposition : public Operation
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_DISP ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nShifts == 0) ; }
|
||||
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
|
||||
{ if ( m_nShifts == 0)
|
||||
return true ;
|
||||
if ( nEmptyType == NEED_ONE_TP_OK)
|
||||
return ( ! IsAtLeastOnePathOk()) ;
|
||||
if ( nEmptyType == NEED_ALL_TP_OK)
|
||||
return ( ! AreAllPathsOk()) ;
|
||||
return false ; }
|
||||
bool UpdateStatus( int nModif) override
|
||||
{ m_nStatus |= nModif ; return true ; }
|
||||
|
||||
@@ -70,6 +89,8 @@ class Disposition : public Operation
|
||||
const std::string& GetHeadName( void) const override ;
|
||||
int GetExitNbr( void) const override ;
|
||||
const std::string& GetToolTcPos( void) const override ;
|
||||
bool GetDoubleToolData( std::string& sDblTool, std::string& sDblTcPos, std::string& sDblHead, int& nDblExit) const override
|
||||
{ return false ; }
|
||||
int GetSolCh( void) const override
|
||||
{ return 0 ; }
|
||||
bool NeedPrevHome( void) const override ;
|
||||
@@ -88,13 +109,17 @@ class Disposition : public Operation
|
||||
bool GetTableRef1( Point3d& ptRef1) const ;
|
||||
bool GetTableArea1( BBox3d& b3Area1) const ;
|
||||
bool GetTableAreaOffset1( BBox3d& b3AreaOffs1) const ;
|
||||
bool MoveAxis( const std::string& sName, double dPos) ;
|
||||
bool RemoveAxis( const std::string& sName) ;
|
||||
int AddFixture( const std::string& sName, int nId, const Point3d& ptPos, double dAngDeg = 0,
|
||||
double dMov = 0, bool bAddToList = true) ;
|
||||
int GetFirstFixture( void) ;
|
||||
int GetNextFixture( int nId) ;
|
||||
bool MoveFixture( int nId, const Vector3d& vtMove) ;
|
||||
bool RotateFixture( int nId, double dDeltaAngDeg) ;
|
||||
bool SetFixtureLink( int nId, const std::string& sTaLink) ;
|
||||
bool MoveFixtureMobile( int nId, double dDeltaMov) ;
|
||||
bool SetFixtureMobile( int nId, double dMov) ;
|
||||
bool PlaceFixture( int nId, const Point3d& ptPos, double dAngDeg, double dMov) ;
|
||||
bool RemoveFixture( int nId) ;
|
||||
bool MoveToCornerRawPart( int nRawId, const Point3d& ptP, int nFlag, bool bAddToList = true, bool bVerify = true) ;
|
||||
@@ -102,9 +127,11 @@ class Disposition : public Operation
|
||||
bool MoveRawPart( int nRawId, const Vector3d& vtMove) ;
|
||||
bool RotateRawPart( int nRawId, const Vector3d& vtAx, double dAngRotDeg) ;
|
||||
bool ApplyRotationToRawPart( int nRawId, double dAngCDeg, double dAngADeg, double dAngC1Deg, bool bAddToList = true) ;
|
||||
bool UpdateRawPartId( int nRawId, int nNewRawId) ;
|
||||
bool RemoveRawPart( int nRawId) ;
|
||||
bool GetMoveAxisData( int nInd, std::string& sName, double& dPos) const ;
|
||||
bool GetFixtureData( int nInd, std::string& sName, int& nId, Point3d& ptPos,
|
||||
double& dAngDeg, double& dMov) const ;
|
||||
double& dAngDeg, double& dMov, std::string& sTaLink) const ;
|
||||
bool GetMoveRawData( int nInd, int& nRawId, int& nType, Point3d& ptPos, int& nFlag) const ;
|
||||
bool SpecialApply( bool bRecalc) ;
|
||||
bool SpecialUpdate( void) ;
|
||||
@@ -125,6 +152,7 @@ class Disposition : public Operation
|
||||
Point3d m_ptRef1 ; // origine 1 della tavola
|
||||
BBox3d m_b3Area1 ; // area utile 1 della tavola
|
||||
std::array<double,4> m_dAreaOffset ; // eventuali allargamenti dell'area sui 4 lati (0=XP, 1=YP, 2=XM, 3=YM)
|
||||
AXDATAVECTOR m_vAxData ; // elenco movimenti assi ausiliari
|
||||
FIXDATAVECTOR m_vFixData ; // elenco posizionamento bloccaggi
|
||||
MVRDATAVECTOR m_vMvrData ; // elenco movimenti grezzi
|
||||
std::string m_sHead ; // eventuale testa usata per muovere i pezzi
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <string>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
std::string GetEMkVer( void) ;
|
||||
const std::string& GetEMkVer( void) ;
|
||||
ILogger* GetEMkLogger( void) ;
|
||||
const std::string& GetEMkKey( void) ;
|
||||
bool GetEMkNetHwKey( void) ;
|
||||
|
||||
+2047
-530
File diff suppressed because it is too large
Load Diff
+71
-24
@@ -18,15 +18,24 @@
|
||||
#include "ToolData.h"
|
||||
#include "MachiningConst.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// definizione strutture e vettori per fori, utensili e maschere
|
||||
struct Hole ;
|
||||
struct MHDrill ;
|
||||
struct HoleInfo ;
|
||||
struct ToolInfo ;
|
||||
class ICurve ;
|
||||
typedef std::vector<std::vector<MHDrill>> TABMHDRILL ;
|
||||
typedef std::vector<MHDrill> TABMHDRILL ;
|
||||
typedef std::vector<HoleInfo> VECTORHOLE ;
|
||||
typedef std::vector<ToolInfo> VECTORTOOL ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// definizione tipologia foratura
|
||||
const int DRILL_TYPE_ERR = 0 ;
|
||||
const int DRILL_TYPE_STD = 1 ; // 1 tool
|
||||
const int DRILL_TYPE_MULTI_FIXED = 2 ; // più utensili fissi
|
||||
const int DRILL_TYPE_MULTI_SEL = 3 ; // più utensili selezionabili
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class Drilling : public Machining
|
||||
{
|
||||
@@ -42,8 +51,14 @@ class Drilling : public Machining
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_DRILLING ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nDrillings == 0) ; }
|
||||
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
|
||||
{ if ( m_nDrillings == 0)
|
||||
return true ;
|
||||
if ( nEmptyType == NEED_ONE_TP_OK)
|
||||
return ( ! IsAtLeastOnePathOk()) ;
|
||||
if ( nEmptyType == NEED_ALL_TP_OK)
|
||||
return ( ! AreAllPathsOk()) ;
|
||||
return false ; }
|
||||
bool UpdateStatus( int nModif) override
|
||||
{ m_nStatus |= nModif ; return true ; }
|
||||
|
||||
@@ -65,9 +80,10 @@ class Drilling : public Machining
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool UpdateToolData( bool* pbChanged = nullptr) override ;
|
||||
bool UpdateToolData( void) override ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
bool GetSkippedGeometry( SELVECTOR& vIds) const override ;
|
||||
|
||||
public :
|
||||
Drilling( void) ;
|
||||
@@ -80,17 +96,45 @@ class Drilling : public Machining
|
||||
ICurve* GetCurve( SelData Id) ;
|
||||
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
|
||||
bool GenerateHolePv( int nInd, const SelData& nCircId, const std::string& sPName, int nPvId) ;
|
||||
bool GenerateHoleCl( int nInd, const SelData& nCircId, const std::string& sPName, int nClId, double dMHOff = .0, Vector3d vtAux = V_NULL) ;
|
||||
bool GenerateHoleCl( int nInd, const SelData& nCircId, const std::string& sPName, int nClId,
|
||||
double dMHOff = 0, const Vector3d& vtAux = V_NULL, int nDrillType = DRILL_TYPE_STD,
|
||||
INTVECTOR* pvActiveExit = nullptr, ToolInfo* currToolData = nullptr) ;
|
||||
bool AdapthPathToMainTool( int nInd, const SelData& nCircId, const std::string& sPName, int nClId,
|
||||
double dMHOff, const Vector3d& vtAux, int nDrillType,
|
||||
INTVECTOR* pvActiveExit, ToolData* currToolData) ;
|
||||
bool GenerateHoleRegionPv( int nFirstId, int nCount, int nPvId) ;
|
||||
bool VerifyDiameter( double dHdiam, double dTdiam, double ddiamTol) ;
|
||||
bool VerifyHoleFromBottom( const Hole& hole, SelData Id) ;
|
||||
bool DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double nMHOff, Vector3d vtA) ;
|
||||
bool DoPeckDrilling( const Hole& hole, SelData Id, int nPathId) ;
|
||||
bool MultiHeadDrilling( int nExit, const SELVECTOR& vId, int nClId, TABMHDRILL& vDrills, double& dMHOff, bool bOrd = true) ;
|
||||
bool MultiHeadVerifyHole( Hole& hole, const ToolData* Tool, double dDiamTol, SelData Id) ;
|
||||
bool CalcMask( VECTORHOLE& vHoles, VECTORTOOL& vTools, int nIndMT, Vector3d vtT, Vector3d vtA) ;
|
||||
bool CheckOtherHolesWithTools( VECTORHOLE& vHoles, VECTORTOOL& vTools, int nIndTM, int nIndHTM, Hole holeICP, Frame3d frHTM,
|
||||
Frame3d frHMTOP, double dDiamTol, int& nDrills) ;
|
||||
bool DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double nMHOff, const Vector3d& vtA, const ToolData& currToolData) ;
|
||||
bool DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHOff, const Vector3d& vtA, const ToolData& currToolData) ;
|
||||
bool MultiHeadDrilling( const SELVECTOR& vId, int nClId, bool bFixed, TABMHDRILL& vDrills, double& dMHOff) ;
|
||||
bool CalcMask( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndMT, const Vector3d& vtTool, const Vector3d& vtAux) ;
|
||||
bool CalcMaskSel( VECTORHOLE& vHoles, const VECTORTOOL& vTools, const Vector3d& vtTool, const Vector3d& vtAux) ;
|
||||
bool CalcDrilledHolesByConfig( VECTORHOLE& vHoles, int nMyInd, int nIndConfig, INTVECTOR& vIndDrilled) ;
|
||||
bool EraseDuplicatedConfigs( VECTORHOLE& vHoles) ;
|
||||
bool KeepMinRotatedConfigs( VECTORHOLE& vHoles, const Vector3d& vtAux, const Vector3d& vtTool) ;
|
||||
bool CalcMultiHeadUndrilledHoles( const VECTORHOLE& vHoles, INTVECTOR& vIdUndrilledHoles) ;
|
||||
bool CalcMultiHeadPartialDrilledHoles( const TABMHDRILL& vDrills, const VECTORHOLE& vHoles, const VECTORTOOL& vTools,
|
||||
const INTVECTOR& vIdUndrilledHoles, INTDBLVECTOR& vIdPartialdrilledHoles) ;
|
||||
bool CheckBasedConfig( const VECTORHOLE& vHoles, int nHoleInd, int& nValidConfig, bool& bBaseCase) ;
|
||||
bool GetClosestHolesToHole( const VECTORHOLE& vHoles, int nMyInd, bool bDrilled, INTVECTOR& vInds) ;
|
||||
bool OrderConfigsForSelectableTools( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndToolMain, TABMHDRILL& vDrills) ;
|
||||
bool GetConfigsWithMoreDrilledHoles( const VECTORHOLE& vHoles, INTVECTOR& vInds) ;
|
||||
bool ChooseBestConfigForSelectableTools( const VECTORHOLE& vHoles, int nIndToolMain, INTVECTOR& vConfInds, int& nBestConf) ;
|
||||
bool CheckOtherHolesWithTools( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndTM, int nIndHTM, Hole holeICP,
|
||||
const Frame3d& frHTM, const Frame3d& frHMTOP, double dDiamToler, int& nDrills) ;
|
||||
bool GetHoleBestConfig( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nInd, TABMHDRILL& tabDrills, const Vector3d& vtAux, const Vector3d& vtTool, int& nOkHole) ;
|
||||
bool MultiHeadVerifyHole( Hole& hole, const ToolData* Tool, double dDiamToler, SelData Id) ;
|
||||
bool MultiHeadOrderConfig( TABMHDRILL& tabDrills, const VECTORHOLE& vHoles, const Vector3d& vtTool, const Vector3d& vtAux) ;
|
||||
bool MultiHeadHoleToolsConfig( const VECTORHOLE& vHoles, int nConfig, INTINTVECTOR& vConfMask) ;
|
||||
int VerifyMultiParallelDrills( void) ;
|
||||
double GetDoubleLastStep( void) ;
|
||||
|
||||
/* debug functions */
|
||||
void PrintConfigs( const VECTORHOLE& vHoles) ;
|
||||
void PrintDescent( const MHDrill& myMHDescent) ;
|
||||
/* end debug functions */
|
||||
|
||||
|
||||
private :
|
||||
double GetSpeed() const
|
||||
@@ -105,16 +149,19 @@ class Drilling : public Machining
|
||||
{ return ( IsNullLenValue( m_Params.m_dTipFeed) ? m_TParams.m_dTipFeed : m_Params.m_dTipFeed) ; }
|
||||
|
||||
private :
|
||||
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
|
||||
DrillingData m_Params ; // parametri lavorazione
|
||||
ToolData m_TParams ; // parametri utensile
|
||||
int m_nStatus ; // stato di aggiornamento della lavorazione
|
||||
int m_nDrillings ; // numero di fori generati
|
||||
bool m_bTiltingTab ; // flag utilizzo tavola basculante
|
||||
Vector3d m_vtTiltingAx ; // versore direzione eventuale asse basculante
|
||||
bool m_bAboveHead ; // flag utilizzo testa da sopra
|
||||
bool m_bAggrBottom ; // flag di utilizzo dell'aggregato da sotto
|
||||
Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto
|
||||
double m_dDistBottom ; // distanza del foro dal bordo del grezzo
|
||||
AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto
|
||||
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
|
||||
DrillingData m_Params ; // parametri lavorazione
|
||||
ToolData m_TParams ; // parametri utensile
|
||||
int m_nStatus ; // stato di aggiornamento della lavorazione
|
||||
int m_nDrillings ; // numero di fori generati
|
||||
bool m_bTiltingTab ; // flag utilizzo tavola basculante
|
||||
Vector3d m_vtTiltingAx ; // versore direzione eventuale asse basculante
|
||||
bool m_bAboveHead ; // flag utilizzo testa da sopra
|
||||
bool m_bAggrBottom ; // flag di utilizzo dell'aggregato da sotto
|
||||
Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto
|
||||
double m_dDistBottom ; // distanza del foro dal bordo del grezzo
|
||||
AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto
|
||||
INTVECTOR m_vUndrilledId ; // vettore degli identificativi dei fori non svuotati
|
||||
INTDBLVECTOR m_vPartialDrilledId ; // vettore degli identificatii dei fori lavorati parzialmente
|
||||
// con profodnità mancante
|
||||
} ;
|
||||
|
||||
+6
-2
@@ -75,6 +75,10 @@ struct DrillingData : public MachiningData
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline const DrillingData* GetDrillingData( const MachiningData* pMdata)
|
||||
{ return (dynamic_cast<const DrillingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_DRILLING)
|
||||
return nullptr ;
|
||||
return ( static_cast<const DrillingData*>( pMdata)) ; }
|
||||
inline DrillingData* GetDrillingData( MachiningData* pMdata)
|
||||
{ return (dynamic_cast<DrillingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_DRILLING)
|
||||
return nullptr ;
|
||||
return ( static_cast<DrillingData*>( pMdata)) ; }
|
||||
|
||||
+12
-10
@@ -31,8 +31,7 @@
|
||||
const int STR_DIM = 40 ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static HINSTANCE s_hModule = NULL ;
|
||||
static char s_szEMkNameVer[STR_DIM] ;
|
||||
static HINSTANCE s_hModule = NULL ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
extern "C" int APIENTRY
|
||||
@@ -62,21 +61,24 @@ DllMain( HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
|
||||
const char*
|
||||
GetEMkVersion( void)
|
||||
{
|
||||
std::string sVer ;
|
||||
|
||||
GetModuleVersion( s_hModule, sVer) ;
|
||||
sprintf_s( s_szEMkNameVer, STR_DIM, "%s%s", EMK_STR, sVer.c_str()) ;
|
||||
static char s_szEMkNameVer[STR_DIM] = "" ;
|
||||
if ( s_szEMkNameVer[0] == '\0') {
|
||||
static std::string sVer ;
|
||||
GetModuleVersion( s_hModule, sVer) ;
|
||||
sprintf_s( s_szEMkNameVer, STR_DIM, "%s%s", EMK_STR, sVer.c_str()) ;
|
||||
}
|
||||
|
||||
return s_szEMkNameVer ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
std::string
|
||||
const std::string&
|
||||
GetEMkVer( void)
|
||||
{
|
||||
std::string sVer ;
|
||||
GetModuleVersion( s_hModule, sVer) ;
|
||||
return sVer ;
|
||||
static std::string s_sVer ;
|
||||
if ( s_sVer.empty())
|
||||
GetModuleVersion( s_hModule, s_sVer) ;
|
||||
return s_sVer ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Binary file not shown.
+2
-2
@@ -1,7 +1,7 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28307.645
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.12.35527.113
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EgtMachKernel", "EgtMachKernel.vcxproj", "{0BD58222-92F3-48B2-B656-4497D1956874}"
|
||||
EndProject
|
||||
|
||||
+49
-10
@@ -21,13 +21,13 @@
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{0BD58222-92F3-48B2-B656-4497D1956874}</ProjectGuid>
|
||||
<RootNamespace>EgtMachKernel</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.20348.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141_xp</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
@@ -39,7 +39,7 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141_xp</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
@@ -105,7 +105,7 @@
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@@ -132,7 +132,7 @@ copy $(TargetPath) \EgtProg\DllD32</Command>
|
||||
<OpenMPSupport>true</OpenMPSupport>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
@@ -167,7 +167,7 @@ copy $(TargetPath) \EgtProg\DllD64</Command>
|
||||
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
|
||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
@@ -195,14 +195,14 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;I_AM_EMK;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
|
||||
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
|
||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
@@ -237,6 +237,8 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClCompile Include="EMkDllMain.cpp" />
|
||||
<ClCompile Include="Estimator.cpp" />
|
||||
<ClCompile Include="Exit.cpp" />
|
||||
<ClCompile Include="FiveAxisMilling.cpp" />
|
||||
<ClCompile Include="FiveAxisMillingData.cpp" />
|
||||
<ClCompile Include="Generator.cpp" />
|
||||
<ClCompile Include="GenMachining.cpp" />
|
||||
<ClCompile Include="GenMachiningData.cpp" />
|
||||
@@ -273,6 +275,9 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClCompile Include="OperationCL.cpp" />
|
||||
<ClCompile Include="Pocketing.cpp" />
|
||||
<ClCompile Include="PocketingData.cpp" />
|
||||
<ClCompile Include="PocketingNT.cpp" />
|
||||
<ClCompile Include="Probing.cpp" />
|
||||
<ClCompile Include="ProbingData.cpp" />
|
||||
<ClCompile Include="Processor.cpp" />
|
||||
<ClCompile Include="SawFinishing.cpp" />
|
||||
<ClCompile Include="SawFinishingData.cpp" />
|
||||
@@ -281,7 +286,8 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClCompile Include="SawRoughing.cpp" />
|
||||
<ClCompile Include="SawRoughingData.cpp" />
|
||||
<ClCompile Include="SetupMgr.cpp" />
|
||||
<ClCompile Include="Simulator.cpp" />
|
||||
<ClCompile Include="SimulatorSP.cpp" />
|
||||
<ClCompile Include="SimulatorMP.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
@@ -291,6 +297,8 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClCompile Include="Head.cpp" />
|
||||
<ClCompile Include="SurfFinishing.cpp" />
|
||||
<ClCompile Include="SurfFinishingData.cpp" />
|
||||
<ClCompile Include="SurfRoughing.cpp" />
|
||||
<ClCompile Include="SurfRoughingData.cpp" />
|
||||
<ClCompile Include="Table.cpp" />
|
||||
<ClCompile Include="TcPos.cpp" />
|
||||
<ClCompile Include="ToolData.cpp" />
|
||||
@@ -303,7 +311,15 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="..\Include\EGkArcSpecial.h" />
|
||||
<ClInclude Include="..\Include\EGkBBox1d.h" />
|
||||
<ClInclude Include="..\Include\EGkBBox3d.h" />
|
||||
<ClInclude Include="..\Include\EGkCDeBoxPolyhedron.h" />
|
||||
<ClInclude Include="..\Include\EGkBiArcs.h" />
|
||||
<ClInclude Include="..\Include\EGkCalcPocketing.h" />
|
||||
<ClInclude Include="..\Include\EGkCAvSilhouetteSurfTm.h" />
|
||||
<ClInclude Include="..\Include\EGkCAvToolSurfTm.h" />
|
||||
<ClInclude Include="..\Include\EGkCDeBoxClosedSurfTm.h" />
|
||||
<ClInclude Include="..\Include\EGkCDeClosedSurfTmClosedSurfTm.h" />
|
||||
<ClInclude Include="..\Include\EGkCDeConeFrustumClosedSurfTm.h" />
|
||||
<ClInclude Include="..\Include\EGkCDeCylClosedSurfTm.h" />
|
||||
<ClInclude Include="..\Include\EGkCDeSpheClosedSurfTm.h" />
|
||||
<ClInclude Include="..\Include\EGkChainCurves.h" />
|
||||
<ClInclude Include="..\Include\EGkColor.h" />
|
||||
<ClInclude Include="..\Include\EGkCurve.h" />
|
||||
@@ -311,8 +327,11 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="..\Include\EGkCurveAux.h" />
|
||||
<ClInclude Include="..\Include\EGkCurveComposite.h" />
|
||||
<ClInclude Include="..\Include\EGkCurveLine.h" />
|
||||
<ClInclude Include="..\Include\EGkCurveLocal.h" />
|
||||
<ClInclude Include="..\Include\EGkCurvePointDiffGeom.h" />
|
||||
<ClInclude Include="..\Include\EGkDistPointCurve.h" />
|
||||
<ClInclude Include="..\Include\EGkDistPointLine.h" />
|
||||
<ClInclude Include="..\Include\EGkDistPointSurfTm.h" />
|
||||
<ClInclude Include="..\Include\EGkExtText.h" />
|
||||
<ClInclude Include="..\Include\EGkFrame3d.h" />
|
||||
<ClInclude Include="..\Include\EGkGdbConst.h" />
|
||||
@@ -325,10 +344,13 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="..\Include\EGkGeoObjType.h" />
|
||||
<ClInclude Include="..\Include\EGkGeoPoint3d.h" />
|
||||
<ClInclude Include="..\Include\EGkGeoVector3d.h" />
|
||||
<ClInclude Include="..\Include\EGkHashGrids1d.h" />
|
||||
<ClInclude Include="..\Include\EGkHashGrids2d.h" />
|
||||
<ClInclude Include="..\Include\EGkIntersCurves.h" />
|
||||
<ClInclude Include="..\Include\EGkIntersCurveSurfTm.h" />
|
||||
<ClInclude Include="..\Include\EGkIntersLineSurfTm.h" />
|
||||
<ClInclude Include="..\Include\EGkIntersLineTria.h" />
|
||||
<ClInclude Include="..\Include\EGkIntersPlaneSurfTm.h" />
|
||||
<ClInclude Include="..\Include\EGkIntervals.h" />
|
||||
<ClInclude Include="..\Include\EGkLuaAux.h" />
|
||||
<ClInclude Include="..\Include\EGkMaterial.h" />
|
||||
@@ -339,7 +361,10 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="..\Include\EGkPoint3d.h" />
|
||||
<ClInclude Include="..\Include\EGkPointGrid3d.h" />
|
||||
<ClInclude Include="..\Include\EGkPolyArc.h" />
|
||||
<ClInclude Include="..\Include\EGkPolygon3d.h" />
|
||||
<ClInclude Include="..\Include\EGkPolygonElevation.h" />
|
||||
<ClInclude Include="..\Include\EGkPolyLine.h" />
|
||||
<ClInclude Include="..\Include\EGkQuaternion.h" />
|
||||
<ClInclude Include="..\Include\EGkSelection.h" />
|
||||
<ClInclude Include="..\Include\EGkSfrCreate.h" />
|
||||
<ClInclude Include="..\Include\EGkStmFromCurves.h" />
|
||||
@@ -347,6 +372,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="..\Include\EGkStringUtils3d.h" />
|
||||
<ClInclude Include="..\Include\EGkSurf.h" />
|
||||
<ClInclude Include="..\Include\EGkSurfFlatRegion.h" />
|
||||
<ClInclude Include="..\Include\EGkSurfLocal.h" />
|
||||
<ClInclude Include="..\Include\EGkSurfTriMesh.h" />
|
||||
<ClInclude Include="..\Include\EGkTriangle3d.h" />
|
||||
<ClInclude Include="..\Include\EGkUiUnits.h" />
|
||||
@@ -356,6 +382,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="..\Include\EGkVolZmap.h" />
|
||||
<ClInclude Include="..\Include\EGnEgtUUID.h" />
|
||||
<ClInclude Include="..\Include\EGnFileUtils.h" />
|
||||
<ClInclude Include="..\Include\EGnGetKeyData.h" />
|
||||
<ClInclude Include="..\Include\EGnGetModuleVer.h" />
|
||||
<ClInclude Include="..\Include\EGnLuaAux.h" />
|
||||
<ClInclude Include="..\Include\EGnLuaMgr.h" />
|
||||
@@ -370,6 +397,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="..\Include\EgtLibVer.h" />
|
||||
<ClInclude Include="..\Include\EgtNumCollection.h" />
|
||||
<ClInclude Include="..\Include\EgtNumUtils.h" />
|
||||
<ClInclude Include="..\Include\EgtPerfCounter.h" />
|
||||
<ClInclude Include="..\Include\EgtPointerOwner.h" />
|
||||
<ClInclude Include="..\Include\EgtStringBase.h" />
|
||||
<ClInclude Include="..\Include\EgtStringConverter.h" />
|
||||
@@ -397,6 +425,8 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="DrillingData.h" />
|
||||
<ClInclude Include="Estimator.h" />
|
||||
<ClInclude Include="Exit.h" />
|
||||
<ClInclude Include="FiveAxisMilling.h" />
|
||||
<ClInclude Include="FiveAxisMillingData.h" />
|
||||
<ClInclude Include="Generator.h" />
|
||||
<ClInclude Include="GenMachining.h" />
|
||||
<ClInclude Include="GenMachiningData.h" />
|
||||
@@ -410,6 +440,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="MachiningData.h" />
|
||||
<ClInclude Include="MachiningDataFactory.h" />
|
||||
<ClInclude Include="MachiningCreate.h" />
|
||||
<ClInclude Include="MachiningRegister.h" />
|
||||
<ClInclude Include="MachiningsMgr.h" />
|
||||
<ClInclude Include="MachMgr.h" />
|
||||
<ClInclude Include="Milling.h" />
|
||||
@@ -418,9 +449,13 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="MortisingData.h" />
|
||||
<ClInclude Include="Operation.h" />
|
||||
<ClInclude Include="OperationConst.h" />
|
||||
<ClInclude Include="OperUserNotesConst.h" />
|
||||
<ClInclude Include="OutputConst.h" />
|
||||
<ClInclude Include="Pocketing.h" />
|
||||
<ClInclude Include="PocketingData.h" />
|
||||
<ClInclude Include="PocketingNT.h" />
|
||||
<ClInclude Include="Probing.h" />
|
||||
<ClInclude Include="ProbingData.h" />
|
||||
<ClInclude Include="Processor.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="SawFinishing.h" />
|
||||
@@ -433,10 +468,14 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="SetTempPhase.h" />
|
||||
<ClInclude Include="SetupMgr.h" />
|
||||
<ClInclude Include="Simulator.h" />
|
||||
<ClInclude Include="SimulatorSP.h" />
|
||||
<ClInclude Include="SimulatorMP.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="Head.h" />
|
||||
<ClInclude Include="SurfFinishing.h" />
|
||||
<ClInclude Include="SurfFinishingData.h" />
|
||||
<ClInclude Include="SurfRoughing.h" />
|
||||
<ClInclude Include="SurfRoughingData.h" />
|
||||
<ClInclude Include="Table.h" />
|
||||
<ClInclude Include="TcPos.h" />
|
||||
<ClInclude Include="ToolData.h" />
|
||||
|
||||
@@ -150,7 +150,7 @@
|
||||
<ClCompile Include="MachMgrDBTools.cpp">
|
||||
<Filter>Source Files\MachMgr</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Simulator.cpp">
|
||||
<ClCompile Include="SimulatorSP.cpp">
|
||||
<Filter>Source Files\Output</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MachMgrPhases.cpp">
|
||||
@@ -234,6 +234,30 @@
|
||||
<ClCompile Include="TcPos.cpp">
|
||||
<Filter>Source Files\Machine</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FiveAxisMillingData.cpp">
|
||||
<Filter>Source Files\Machinings</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FiveAxisMilling.cpp">
|
||||
<Filter>Source Files\Operations</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SurfRoughingData.cpp">
|
||||
<Filter>Source Files\Machinings</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SurfRoughing.cpp">
|
||||
<Filter>Source Files\Operations</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SimulatorMP.cpp">
|
||||
<Filter>Source Files\Output</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PocketingNT.cpp">
|
||||
<Filter>Source Files\Operations</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ProbingData.cpp">
|
||||
<Filter>Source Files\Machinings</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Probing.cpp">
|
||||
<Filter>Source Files\Operations</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="DllMain.h">
|
||||
@@ -329,7 +353,7 @@
|
||||
<ClInclude Include="..\Include\EMkDispositionConst.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Simulator.h">
|
||||
<ClInclude Include="SimulatorSP.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Generator.h">
|
||||
@@ -410,9 +434,6 @@
|
||||
<ClInclude Include="..\Include\EGkBBox3d.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkCDeBoxPolyhedron.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkChainCurves.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
@@ -668,6 +689,102 @@
|
||||
<ClInclude Include="..\Include\EGkBBox1d.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FiveAxisMillingData.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FiveAxisMilling.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SurfRoughingData.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SurfRoughing.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkBiArcs.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkCalcPocketing.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkCAvSilhouetteSurfTm.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkCAvToolSurfTm.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkCDeBoxClosedSurfTm.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkCDeClosedSurfTmClosedSurfTm.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkCDeConeFrustumClosedSurfTm.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkCDeCylClosedSurfTm.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkCDeSpheClosedSurfTm.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkCurveLocal.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkDistPointLine.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkDistPointSurfTm.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkHashGrids1d.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkIntersCurveSurfTm.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkIntersPlaneSurfTm.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkPolygon3d.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkPolygonElevation.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkQuaternion.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkSurfLocal.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGnGetKeyData.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EgtPerfCounter.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SimulatorMP.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Simulator.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PocketingNT.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MachiningRegister.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ProbingData.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Probing.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OperUserNotesConst.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="EgtMachKernel.rc">
|
||||
|
||||
+76
-12
@@ -15,9 +15,12 @@
|
||||
#include "stdafx.h"
|
||||
#include "DllMain.h"
|
||||
#include "Estimator.h"
|
||||
#include "Machine.h"
|
||||
#include "MachMgr.h"
|
||||
#include "OutputConst.h"
|
||||
#include "/EgtDev/Include/EGnFileUtils.h"
|
||||
#include "/EgtDev/Include/EGnGetKeyData.h"
|
||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
||||
#include "/EgtDev/Include/SELkKeyProc.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -45,23 +48,75 @@ Estimator::Init( MachMgr* pMchMgr)
|
||||
bool
|
||||
Estimator::Run( const string& sCncFile, const string& sInfo)
|
||||
{
|
||||
// emetto info di log
|
||||
{ string sOut = "Estimator Run : " + sCncFile ;
|
||||
LOG_INFO( GetEMkLogger(), sOut.c_str()) ; }
|
||||
// Controllo della licenza
|
||||
unsigned int nOpt1, nOpt2 ;
|
||||
int nOptExpDays ;
|
||||
int nRet = GetEGnKeyOptions( KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
|
||||
nOpt1, nOpt2, nOptExpDays) ;
|
||||
if ( ! GetEMkNetHwKey())
|
||||
nRet = GetKeyOptions( GetEMkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
|
||||
nOpt1, nOpt2, nOptExpDays) ;
|
||||
|
||||
// Verifica della abilitazione
|
||||
bool bMinTime = false ;
|
||||
if ( nOptExpDays >= GetMinDay())
|
||||
bMinTime = true ;
|
||||
bool bCurrTime = false ;
|
||||
if ( nOptExpDays >= GetCurrDay())
|
||||
bCurrTime = true ;
|
||||
bool bKey = false ;
|
||||
if ( nRet == KEY_OK)
|
||||
bKey = true ;
|
||||
bool bAdvMach = false ;
|
||||
if ( ( nOpt1 & KEYOPT_EMK_ADV) != 0)
|
||||
bAdvMach = true ;
|
||||
|
||||
// Esecuzione
|
||||
if ( bMinTime && bCurrTime && bKey) {
|
||||
// se non previste lavorazioni avanzate, verifico la loro assenza
|
||||
if ( ! bAdvMach) {
|
||||
int nOpId = m_pMchMgr->GetFirstActiveOperation() ;
|
||||
while ( nOpId != GDB_ID_NULL) {
|
||||
int nType = m_pMchMgr->GetOperationType( nOpId) ;
|
||||
if ( nType == OPER_SURFROUGHING || nType == OPER_SURFFINISHING || nType == OPER_FIVEAXISMILLING) {
|
||||
m_pMchMgr->SetLastError( 1001, "ADVANCED_MACH_OFF") ;
|
||||
std::string sErr = "Warning on Key (MKC/AMO)" ;
|
||||
LOG_ERROR( GetEMkLogger(), sErr.c_str()) ;
|
||||
return false ;
|
||||
}
|
||||
nOpId = m_pMchMgr->GetNextActiveOperation( nOpId) ;
|
||||
}
|
||||
}
|
||||
|
||||
// emetto info di log
|
||||
{ string sOut = "Estimator Run : " + sCncFile ;
|
||||
LOG_INFO( GetEMkLogger(), sOut.c_str()) ; }
|
||||
|
||||
// cancello l'eventuale file di uscita (e anche il file errore)
|
||||
EraseFile( sCncFile) ;
|
||||
string sErrFile = ChangeFileExtension( sCncFile, ERR_EXT) ;
|
||||
EraseFile( sErrFile) ;
|
||||
|
||||
// lancio il processore
|
||||
bool bOk = Processor::Run( sCncFile, sInfo) ;
|
||||
|
||||
// in caso di errore rinomino il file di output
|
||||
if ( ! bOk)
|
||||
RenameFile( sCncFile, sErrFile) ;
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
// cancello l'eventuale file di uscita (e anche il file errore)
|
||||
EraseFile( sCncFile) ;
|
||||
string sErrFile = ChangeFileExtension( sCncFile, ERR_EXT) ;
|
||||
EraseFile( sErrFile) ;
|
||||
|
||||
// lancio il processore
|
||||
bool bOk = Processor::Run( sCncFile, sInfo) ;
|
||||
|
||||
// in caso di errore rinomino il file di output
|
||||
if ( ! bOk)
|
||||
RenameFile( sCncFile, sErrFile) ;
|
||||
|
||||
return bOk ;
|
||||
// Generazione non abilitata
|
||||
m_pMchMgr->SetLastError( 1000, "NC_OFF") ;
|
||||
std::string sErr = "Warning on Key (MKC/KYO)" ;
|
||||
LOG_ERROR( GetEMkLogger(), sErr.c_str()) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -124,6 +179,15 @@ Estimator::CallOnTableData( void)
|
||||
return m_pMachine->LuaCallFunction( ON_ESTIM_TABLE_DATA) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Estimator::CallOnTableAxisData( void)
|
||||
{
|
||||
if ( ! m_pMachine->LuaExistsFunction( ON_ESTIM_TABLE_AXIS_DATA))
|
||||
return true ;
|
||||
return m_pMachine->LuaCallFunction( ON_ESTIM_TABLE_AXIS_DATA) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Estimator::CallOnFixtureData( void)
|
||||
|
||||
@@ -33,6 +33,7 @@ class Estimator : public Processor
|
||||
bool CallOnDispositionStart( void) override ;
|
||||
bool CallOnDispositionEnd( void) override ;
|
||||
bool CallOnTableData( void) override ;
|
||||
bool CallOnTableAxisData( void) override ;
|
||||
bool CallOnFixtureData( void) override ;
|
||||
bool CallOnRawMoveData( void) override ;
|
||||
bool CallOnToolSelect( void) override ;
|
||||
|
||||
@@ -124,6 +124,9 @@ Exit::Modify( const Point3d& ptPos, double dExitMaxAdjust)
|
||||
}
|
||||
// Assegno la nuova posizione
|
||||
m_ptPos = ptPos ;
|
||||
// Sistemo la geometria dell'uscita
|
||||
if ( ! vtDelta.IsZero())
|
||||
m_pGeomDB->Translate( m_nOwnerId, vtDelta) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
+1027
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,103 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2024-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : FiveAxisMilling.h Data : 22.05.24 Versione : 2.6e5
|
||||
// Contenuto : Dichiarazione della classe FiveAxisMilling.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 22.05.24 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Machining.h"
|
||||
#include "FiveAxisMillingData.h"
|
||||
#include "ToolData.h"
|
||||
|
||||
class ICurve ;
|
||||
class ICurveComposite ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class FiveAxisMilling : public Machining
|
||||
{
|
||||
public : // IUserObj
|
||||
FiveAxisMilling* Clone( void) const override ;
|
||||
const std::string& GetClassName( void) const override ;
|
||||
bool Dump( std::string& sOut, bool bMM = true, const char* szNewLine = "\n") const override ;
|
||||
bool ToSave( void) const override
|
||||
{ return true ; }
|
||||
bool Save( int nBaseId, STRVECTOR& vString) const override ;
|
||||
bool Load( const STRVECTOR& vString, int nBaseGdbId) override ;
|
||||
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_FIVEAXISMILLING ; }
|
||||
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
|
||||
{ if ( m_nMills == 0)
|
||||
return true ;
|
||||
if ( nEmptyType == NEED_ONE_TP_OK)
|
||||
return ( ! IsAtLeastOnePathOk()) ;
|
||||
if ( nEmptyType == NEED_ALL_TP_OK)
|
||||
return ( ! AreAllPathsOk()) ;
|
||||
return false ; }
|
||||
bool UpdateStatus( int nModif) override
|
||||
{ m_nStatus |= nModif ; return true ; }
|
||||
|
||||
protected : // Operation
|
||||
int GetSolCh( void) const override
|
||||
{ return m_Params.m_nSolCh ; }
|
||||
bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const override ;
|
||||
|
||||
public : // Machining
|
||||
bool Prepare( const std::string& sMillName) override ;
|
||||
bool SetParam( int nType, bool bVal) override ;
|
||||
bool SetParam( int nType, int nVal) override ;
|
||||
bool SetParam( int nType, double dVal) override ;
|
||||
bool SetParam( int nType, const std::string& sVal) override ;
|
||||
bool SetGeometry( const SELVECTOR& vIds) override ;
|
||||
bool Preview( bool bRecalc) override ;
|
||||
bool Apply( bool bRecalc, bool bPostApply) override ;
|
||||
bool Update( bool bPostApply) override ;
|
||||
bool GetParam( int nType, bool& bVal) const override ;
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool UpdateToolData( void) override ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
|
||||
public :
|
||||
FiveAxisMilling( void) ;
|
||||
|
||||
private :
|
||||
bool MyApply( bool bRecalc, bool bPostApply) ;
|
||||
bool VerifyGeometry( SelData Id, int& nSubs) ;
|
||||
double GetApproxLinTol( void) const override ;
|
||||
|
||||
private :
|
||||
double GetSpeed() const
|
||||
{ return ( IsNullAngValue( m_Params.m_dSpeed) ? m_TParams.m_dSpeed : m_Params.m_dSpeed) ; }
|
||||
double GetFeed() const
|
||||
{ return ( IsNullLenValue( m_Params.m_dFeed) ? m_TParams.m_dFeed : m_Params.m_dFeed) ; }
|
||||
double GetStartFeed() const
|
||||
{ return ( IsNullLenValue( m_Params.m_dStartFeed) ? m_TParams.m_dStartFeed : m_Params.m_dStartFeed) ; }
|
||||
double GetEndFeed() const
|
||||
{ return ( IsNullLenValue( m_Params.m_dEndFeed) ? m_TParams.m_dEndFeed : m_Params.m_dEndFeed) ; }
|
||||
double GetTipFeed() const
|
||||
{ return ( IsNullLenValue( m_Params.m_dTipFeed) ? m_TParams.m_dTipFeed : m_Params.m_dTipFeed) ; }
|
||||
double GetOffsL() const
|
||||
{ return ( IsUnknownValue( m_Params.m_dOffsL) ? m_TParams.m_dOffsL : m_Params.m_dOffsL) ; }
|
||||
double GetOffsR() const
|
||||
{ return ( IsUnknownValue( m_Params.m_dOffsR) ? m_TParams.m_dOffsR : m_Params.m_dOffsR) ; }
|
||||
|
||||
private :
|
||||
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
|
||||
FiveAxisMillingData m_Params ; // parametri lavorazione
|
||||
ToolData m_TParams ; // parametri utensile
|
||||
int m_nStatus ; // stato di aggiornamento della lavorazione
|
||||
int m_nMills ; // numero di percorsi di lavoro generati
|
||||
bool m_bRunning ; // flag di calcoli in corso
|
||||
} ;
|
||||
@@ -0,0 +1,557 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2024-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : FiveAxisMillingData.cpp Data : 22.05.24 Versione : 2.6e5
|
||||
// Contenuto : Implementazione struttura dati fresatura a 5 assi.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 22.05.24 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "FiveAxisMillingData.h"
|
||||
#include "MachiningDataFactory.h"
|
||||
#include "MachiningConst.h"
|
||||
#include "/EgtDev/Include/EmkToolConst.h"
|
||||
#include "/EgtDev/Include/EmkSimuGenConst.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
enum nFiveAxisMillingKey {
|
||||
KEY_AB = 0,
|
||||
KEY_AI,
|
||||
KEY_DH,
|
||||
KEY_F,
|
||||
KEY_FE,
|
||||
KEY_FS,
|
||||
KEY_FT,
|
||||
KEY_INV,
|
||||
KEY_NAME,
|
||||
KEY_NNS,
|
||||
KEY_NNU,
|
||||
KEY_OL,
|
||||
KEY_OR,
|
||||
KEY_PS,
|
||||
KEY_S,
|
||||
KEY_SCC,
|
||||
KEY_SUBTYPE,
|
||||
KEY_TI,
|
||||
KEY_TNAME,
|
||||
KEY_TUUID,
|
||||
KEY_UUID,
|
||||
KEY_ZZZ} ; // rappresenta il numero di elementi
|
||||
|
||||
static const array<string,KEY_ZZZ> sFiveAxisMillingKey = {
|
||||
"AB",
|
||||
"AI",
|
||||
"DH",
|
||||
"F",
|
||||
"FE",
|
||||
"FS",
|
||||
"FT",
|
||||
"INV",
|
||||
"NAME",
|
||||
"NNS",
|
||||
"NNU",
|
||||
"OL",
|
||||
"OR",
|
||||
"PS",
|
||||
"S",
|
||||
"SCC",
|
||||
"SUB",
|
||||
"TI",
|
||||
"TN",
|
||||
"TU",
|
||||
"UUID"} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
MCHDATA_REGISTER( MT_FIVEAXISMILLING, "FIVEAXISMILLING", FiveAxisMillingData) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
FiveAxisMillingData*
|
||||
FiveAxisMillingData::Clone( void) const
|
||||
{
|
||||
// alloco oggetto
|
||||
FiveAxisMillingData* pDdata = new(nothrow) FiveAxisMillingData ;
|
||||
// copio i dati
|
||||
if ( pDdata != nullptr) {
|
||||
if ( ! pDdata->CopyFrom( this)) {
|
||||
delete pDdata ;
|
||||
return nullptr ;
|
||||
}
|
||||
}
|
||||
return pDdata ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FiveAxisMillingData::CopyFrom( const MachiningData* pMdata)
|
||||
{
|
||||
// è inutile copiare se sorgente coincide con destinazione
|
||||
if ( pMdata == this)
|
||||
return true ;
|
||||
// la sorgente deve essere dello stesso tipo
|
||||
const FiveAxisMillingData* pFdata = GetFiveAxisMillingData( pMdata) ;
|
||||
if ( pFdata == nullptr)
|
||||
return false ;
|
||||
// eseguo copia
|
||||
m_Uuid = pFdata->m_Uuid ;
|
||||
m_sName = pFdata->m_sName ;
|
||||
m_ToolUuid = pFdata->m_ToolUuid ;
|
||||
m_sToolName = pFdata->m_sToolName ;
|
||||
m_sBlockedAxis = pFdata->m_sBlockedAxis ;
|
||||
m_sInitAngs = pFdata->m_sInitAngs ;
|
||||
m_nSolCh = pFdata->m_nSolCh ;
|
||||
m_dSpeed = pFdata->m_dSpeed ;
|
||||
m_dFeed = pFdata->m_dFeed ;
|
||||
m_dEndFeed = pFdata->m_dEndFeed ;
|
||||
m_dStartFeed = pFdata->m_dStartFeed ;
|
||||
m_dTipFeed = pFdata->m_dTipFeed ;
|
||||
m_dOffsL = pFdata->m_dOffsL ;
|
||||
m_dOffsR = pFdata->m_dOffsR ;
|
||||
m_bToolInvert = pFdata->m_bToolInvert ;
|
||||
m_bInvert = pFdata->m_bInvert ;
|
||||
m_sDepth = pFdata->m_sDepth ;
|
||||
m_dStartPos = pFdata->m_dStartPos ;
|
||||
m_nSubType = pFdata->m_nSubType ;
|
||||
m_sSysNotes = pFdata->m_sSysNotes ;
|
||||
m_sUserNotes = pFdata->m_sUserNotes ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FiveAxisMillingData::SameAs(const MachiningData* pMdata) const
|
||||
{
|
||||
// se coincide con altro -> uguali
|
||||
if ( pMdata == this)
|
||||
return true ;
|
||||
// se sono di tipo diverso -> diversi
|
||||
const FiveAxisMillingData* pFdata = GetFiveAxisMillingData( pMdata) ;
|
||||
if ( pFdata == nullptr)
|
||||
return false ;
|
||||
// confronto termine a termine
|
||||
return ( m_Uuid == pFdata->m_Uuid &&
|
||||
m_sName == pFdata->m_sName &&
|
||||
m_ToolUuid == pFdata->m_ToolUuid &&
|
||||
m_sToolName == pFdata->m_sToolName &&
|
||||
m_sBlockedAxis == pFdata->m_sBlockedAxis &&
|
||||
m_sInitAngs == pFdata->m_sInitAngs &&
|
||||
m_nSolCh == pFdata->m_nSolCh &&
|
||||
abs( m_dSpeed - pFdata->m_dSpeed) < EPS_MACH_ANG_PAR &&
|
||||
abs( m_dFeed - pFdata->m_dFeed) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dEndFeed - pFdata->m_dEndFeed) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dStartFeed - pFdata->m_dStartFeed) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dTipFeed - pFdata->m_dTipFeed) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dOffsL - pFdata->m_dOffsL) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dOffsR - pFdata->m_dOffsR) < EPS_MACH_LEN_PAR &&
|
||||
m_bToolInvert == pFdata->m_bToolInvert &&
|
||||
m_bInvert == pFdata->m_bInvert &&
|
||||
m_sDepth == pFdata->m_sDepth &&
|
||||
abs( m_dStartPos - pFdata->m_dStartPos) < EPS_MACH_LEN_PAR &&
|
||||
m_nSubType == pFdata->m_nSubType &&
|
||||
m_sSysNotes == pFdata->m_sSysNotes &&
|
||||
m_sUserNotes == pFdata->m_sUserNotes) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
FiveAxisMillingData::GetSize( void) const
|
||||
{
|
||||
// in debug verifico validità ultimo campo
|
||||
assert( sFiveAxisMillingKey[KEY_UUID] == "UUID") ;
|
||||
return KEY_ZZZ ;
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
string
|
||||
FiveAxisMillingData::GetTitle( void) const
|
||||
{
|
||||
return MCHDATA_GETNAME( FiveAxisMillingData) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
FindFiveAxisMillingKey( const string& sKey)
|
||||
{
|
||||
auto TheRange = equal_range( sFiveAxisMillingKey.cbegin(), sFiveAxisMillingKey.cend(), sKey) ;
|
||||
if ( TheRange.first == TheRange.second)
|
||||
return - 1 ;
|
||||
return int( TheRange.first - sFiveAxisMillingKey.cbegin()) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FiveAxisMillingData::FromString( const string& sString, int& nKey)
|
||||
{
|
||||
// separo chiave da valore
|
||||
string sKey, sVal ;
|
||||
SplitFirst( sString, "=", sKey, sVal) ;
|
||||
// riconosco la chiave
|
||||
nKey = FindFiveAxisMillingKey( ToUpper( sKey)) ;
|
||||
bool bOk = ( nKey >= 0) ;
|
||||
switch ( nKey) {
|
||||
case KEY_AB :
|
||||
m_sBlockedAxis = sVal ;
|
||||
break ;
|
||||
case KEY_AI :
|
||||
m_sInitAngs = sVal ;
|
||||
break ;
|
||||
case KEY_DH :
|
||||
m_sDepth = sVal ;
|
||||
if ( m_sDepth.empty())
|
||||
m_sDepth = "0" ;
|
||||
break ;
|
||||
case KEY_F :
|
||||
bOk = ::FromString( sVal, m_dFeed) ;
|
||||
break ;
|
||||
case KEY_FE :
|
||||
bOk = ::FromString( sVal, m_dEndFeed) ;
|
||||
break ;
|
||||
case KEY_FS :
|
||||
bOk = ::FromString( sVal, m_dStartFeed) ;
|
||||
break ;
|
||||
case KEY_FT :
|
||||
bOk = ::FromString( sVal, m_dTipFeed) ;
|
||||
break ;
|
||||
case KEY_INV :
|
||||
bOk = ::FromString( sVal, m_bInvert) ;
|
||||
break ;
|
||||
case KEY_NAME :
|
||||
m_sName = sVal ;
|
||||
bOk = ! m_sName.empty() ;
|
||||
break ;
|
||||
case KEY_NNS :
|
||||
m_sSysNotes = sVal ;
|
||||
break ;
|
||||
case KEY_NNU :
|
||||
m_sUserNotes = sVal ;
|
||||
break ;
|
||||
case KEY_OL :
|
||||
bOk = ::FromString( sVal, m_dOffsL) ;
|
||||
break ;
|
||||
case KEY_OR :
|
||||
bOk = ::FromString( sVal, m_dOffsR) ;
|
||||
break ;
|
||||
case KEY_PS :
|
||||
bOk = ::FromString( sVal, m_dStartPos) ;
|
||||
break ;
|
||||
case KEY_S :
|
||||
bOk = ::FromString( sVal, m_dSpeed) ;
|
||||
break ;
|
||||
case KEY_SCC :
|
||||
bOk = ::FromString( sVal, m_nSolCh) ;
|
||||
break ;
|
||||
case KEY_SUBTYPE :
|
||||
bOk = ::FromString( sVal, m_nSubType) ;
|
||||
break ;
|
||||
case KEY_TNAME :
|
||||
m_sToolName = sVal ;
|
||||
break ;
|
||||
case KEY_TI :
|
||||
bOk = ::FromString( sVal, m_bToolInvert) ;
|
||||
break ;
|
||||
case KEY_TUUID :
|
||||
bOk = ::FromString( sVal, m_ToolUuid) ;
|
||||
break ;
|
||||
case KEY_UUID :
|
||||
bOk = ::FromString( sVal, m_Uuid) ;
|
||||
break ;
|
||||
default :
|
||||
bOk = false ;
|
||||
break ;
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
string
|
||||
FiveAxisMillingData::ToString( int nKey) const
|
||||
{
|
||||
switch ( nKey) {
|
||||
case KEY_AB : return ( sFiveAxisMillingKey[KEY_AB] + "=" + m_sBlockedAxis) ;
|
||||
case KEY_AI : return ( sFiveAxisMillingKey[KEY_AI] + "=" + m_sInitAngs) ;
|
||||
case KEY_DH : return ( sFiveAxisMillingKey[KEY_DH] + "=" + m_sDepth) ;
|
||||
case KEY_F : return ( sFiveAxisMillingKey[KEY_F] + "=" + ::ToString( m_dFeed)) ;
|
||||
case KEY_FE : return ( sFiveAxisMillingKey[KEY_FE] + "=" + ::ToString( m_dEndFeed)) ;
|
||||
case KEY_FS : return ( sFiveAxisMillingKey[KEY_FS] + "=" + ::ToString( m_dStartFeed)) ;
|
||||
case KEY_FT : return ( sFiveAxisMillingKey[KEY_FT] + "=" + ::ToString( m_dTipFeed)) ;
|
||||
case KEY_INV : return ( sFiveAxisMillingKey[KEY_INV] + "=" + ::ToString( m_bInvert)) ;
|
||||
case KEY_NAME : return ( sFiveAxisMillingKey[KEY_NAME] + "=" + m_sName) ;
|
||||
case KEY_NNS : return ( sFiveAxisMillingKey[KEY_NNS] + "=" + m_sSysNotes) ;
|
||||
case KEY_NNU : return ( sFiveAxisMillingKey[KEY_NNU] + "=" + m_sUserNotes) ;
|
||||
case KEY_OL : return ( sFiveAxisMillingKey[KEY_OL] + "=" + ::ToString( m_dOffsL)) ;
|
||||
case KEY_OR : return ( sFiveAxisMillingKey[KEY_OR] + "=" + ::ToString( m_dOffsR)) ;
|
||||
case KEY_PS : return ( sFiveAxisMillingKey[KEY_PS] + "=" + ::ToString( m_dStartPos)) ;
|
||||
case KEY_S : return ( sFiveAxisMillingKey[KEY_S] + "=" + ::ToString( m_dSpeed)) ;
|
||||
case KEY_SCC : return ( sFiveAxisMillingKey[KEY_SCC] + "=" + ::ToString( m_nSolCh)) ;
|
||||
case KEY_SUBTYPE : return ( sFiveAxisMillingKey[KEY_SUBTYPE] + "=" + ::ToString( m_nSubType)) ;
|
||||
case KEY_TI : return ( sFiveAxisMillingKey[KEY_TI] + "=" + ::ToString( m_bToolInvert)) ;
|
||||
case KEY_TNAME : return ( sFiveAxisMillingKey[KEY_TNAME] + "=" + m_sToolName) ;
|
||||
case KEY_TUUID : return ( sFiveAxisMillingKey[KEY_TUUID] + "=" + ::ToString( m_ToolUuid)) ;
|
||||
case KEY_UUID : return ( sFiveAxisMillingKey[KEY_UUID] + "=" + ::ToString( m_Uuid)) ;
|
||||
default : return "" ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FiveAxisMillingData::IsOptional( int nKey) const
|
||||
{
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FiveAxisMillingData::VerifySolCh( int nVal) const
|
||||
{
|
||||
return IsValidOperationScc( nVal) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FiveAxisMillingData::VerifyTool( const ToolsMgr* pToolsMgr, const string& sVal, const ToolData*& pTdata) const
|
||||
{
|
||||
if ( pToolsMgr == nullptr)
|
||||
return false ;
|
||||
pTdata = pToolsMgr->GetTool( sVal) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
if ( ( pTdata->m_nType & TF_MILL) == 0 && ( pTdata->m_nType & TF_SAWBLADE) == 0)
|
||||
return false ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FiveAxisMillingData::GetTool( const ToolsMgr* pToolsMgr, const ToolData*& pTdata) const
|
||||
{
|
||||
if ( pToolsMgr == nullptr)
|
||||
return false ;
|
||||
pTdata = pToolsMgr->GetTool( m_ToolUuid) ;
|
||||
return ( pTdata != nullptr) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FiveAxisMillingData::SetParam( int nType, bool bVal)
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_INVERT :
|
||||
m_bInvert = bVal ;
|
||||
return true ;
|
||||
case MPA_TOOLINVERT :
|
||||
m_bToolInvert = bVal ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FiveAxisMillingData::SetParam( int nType, int nVal)
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_SCC :
|
||||
if ( ! VerifySolCh( nVal))
|
||||
return false ;
|
||||
m_nSolCh = nVal ;
|
||||
return true ;
|
||||
case MPA_SUBTYPE :
|
||||
m_nSubType = nVal ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FiveAxisMillingData::SetParam( int nType, double dVal)
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_SPEED :
|
||||
m_dSpeed = dVal ;
|
||||
return true ;
|
||||
case MPA_FEED :
|
||||
m_dFeed = dVal ;
|
||||
return true ;
|
||||
case MPA_STARTFEED :
|
||||
m_dStartFeed = dVal ;
|
||||
return true ;
|
||||
case MPA_ENDFEED :
|
||||
m_dEndFeed = dVal ;
|
||||
return true ;
|
||||
case MPA_TIPFEED :
|
||||
m_dTipFeed = dVal ;
|
||||
return true ;
|
||||
case MPA_OFFSL :
|
||||
m_dOffsL = dVal ;
|
||||
return true ;
|
||||
case MPA_OFFSR :
|
||||
m_dOffsR = dVal ;
|
||||
return true ;
|
||||
case MPA_DEPTH :
|
||||
m_sDepth = ::ToString( dVal) ;
|
||||
return true ;
|
||||
case MPA_STARTPOS :
|
||||
m_dStartPos = dVal ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FiveAxisMillingData::SetParam( int nType, const string& sVal)
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_NAME :
|
||||
m_sName = sVal ;
|
||||
return true ;
|
||||
case MPA_TOOL :
|
||||
m_sToolName = sVal ;
|
||||
return true ;
|
||||
case MPA_DEPTH_STR :
|
||||
m_sDepth = sVal ;
|
||||
return true ;
|
||||
case MPA_TUUID :
|
||||
return ::FromString( sVal, m_ToolUuid) ;
|
||||
case MPA_UUID :
|
||||
return ::FromString( sVal, m_Uuid) ;
|
||||
case MPA_SYSNOTES :
|
||||
m_sSysNotes = sVal ;
|
||||
return true ;
|
||||
case MPA_USERNOTES :
|
||||
m_sUserNotes = sVal ;
|
||||
return true ;
|
||||
case MPA_INITANGS :
|
||||
m_sInitAngs = sVal ;
|
||||
return true ;
|
||||
case MPA_BLOCKEDAXIS :
|
||||
m_sBlockedAxis = sVal ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FiveAxisMillingData::ResetTool( void)
|
||||
{
|
||||
m_sToolName.clear() ;
|
||||
m_ToolUuid.Clear() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FiveAxisMillingData::GetParam( int nType, bool& bVal) const
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_INVERT :
|
||||
bVal = m_bInvert ;
|
||||
return true ;
|
||||
case MPA_TOOLINVERT :
|
||||
bVal = m_bToolInvert ;
|
||||
return true ;
|
||||
}
|
||||
bVal = false ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FiveAxisMillingData::GetParam( int nType, int& nVal) const
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_TYPE :
|
||||
nVal = MT_FIVEAXISMILLING ;
|
||||
return true ;
|
||||
case MPA_SCC :
|
||||
nVal = m_nSolCh ;
|
||||
return true ;
|
||||
case MPA_SUBTYPE :
|
||||
nVal = m_nSubType ;
|
||||
return true ;
|
||||
}
|
||||
nVal = 0 ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FiveAxisMillingData::GetParam( int nType, double& dVal) const
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_SPEED :
|
||||
dVal = m_dSpeed ;
|
||||
return true ;
|
||||
case MPA_FEED :
|
||||
dVal = m_dFeed ;
|
||||
return true ;
|
||||
case MPA_STARTFEED :
|
||||
dVal = m_dStartFeed ;
|
||||
return true ;
|
||||
case MPA_ENDFEED :
|
||||
dVal = m_dEndFeed ;
|
||||
return true ;
|
||||
case MPA_TIPFEED :
|
||||
dVal = m_dTipFeed ;
|
||||
return true ;
|
||||
case MPA_OFFSL :
|
||||
dVal = m_dOffsL ;
|
||||
return true ;
|
||||
case MPA_OFFSR :
|
||||
dVal = m_dOffsR ;
|
||||
return true ;
|
||||
case MPA_STARTPOS :
|
||||
dVal = m_dStartPos ;
|
||||
return true ;
|
||||
}
|
||||
dVal = 0 ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FiveAxisMillingData::GetParam( int nType, string& sVal) const
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_NAME :
|
||||
sVal = m_sName ;
|
||||
return true ;
|
||||
case MPA_TOOL :
|
||||
sVal = m_sToolName ;
|
||||
return true ;
|
||||
case MPA_DEPTH_STR :
|
||||
sVal = m_sDepth ;
|
||||
return true ;
|
||||
case MPA_TUUID :
|
||||
sVal = ::ToString( m_ToolUuid) ;
|
||||
return true ;
|
||||
case MPA_UUID :
|
||||
sVal = ::ToString( m_Uuid) ;
|
||||
return true ;
|
||||
case MPA_SYSNOTES :
|
||||
sVal = m_sSysNotes ;
|
||||
return true ;
|
||||
case MPA_USERNOTES :
|
||||
sVal = m_sUserNotes ;
|
||||
return true ;
|
||||
case MPA_INITANGS :
|
||||
sVal = m_sInitAngs ;
|
||||
return true ;
|
||||
case MPA_BLOCKEDAXIS :
|
||||
sVal = m_sBlockedAxis ;
|
||||
return true ;
|
||||
}
|
||||
sVal = "" ;
|
||||
return false ;
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2024-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : FiveAxisMillingData.h Data : 22.05.24 Versione : 2.6e5
|
||||
// Contenuto : Dichiarazione della struct FiveAxisMillingData e costanti associate.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 22.05.24 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "MachiningData.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
struct FiveAxisMillingData : public MachiningData
|
||||
{
|
||||
EgtUUID m_ToolUuid ; // identificativo universale dell'utensile
|
||||
std::string m_sToolName ; // nome dell'utensile
|
||||
std::string m_sInitAngs ; // angoli iniziali suggeriti (Nome1=val1,Nome2=val2)
|
||||
std::string m_sBlockedAxis ; // eventuale asse rotante bloccato (Nome=val)
|
||||
int m_nSolCh ; // criterio scelta soluzione (quando possibili molteplici)
|
||||
double m_dSpeed ; // velocità di rotazione (+ se CCW, - se CW) ( se 0 da utensile)
|
||||
double m_dFeed ; // velocità di lavorazione normale ( se 0 da utensile)
|
||||
double m_dStartFeed ; // velocità di lavorazione iniziale ( se 0 da utensile)
|
||||
double m_dEndFeed ; // velocità di lavorazione finale ( se 0 da utensile)
|
||||
double m_dTipFeed ; // velocità di lavorazione di sfondamento ( se 0 da utensile)
|
||||
double m_dOffsR ; // offset radiale ( se UNKNOWN_PAR da utensile)
|
||||
double m_dOffsL ; // offset longitudinale ( se UNKNOWN_PAR da utensile)
|
||||
bool m_bToolInvert ; // flag per inversione direzione utensile da geometria
|
||||
bool m_bInvert ; // flag di inversione direzione lavorazione
|
||||
std::string m_sDepth ; // affondamento (espressione numerica)
|
||||
double m_dStartPos ; // quota di inizio lavorazione (sempre >= 0)
|
||||
int m_nSubType ; // da [GenMachining] di Ini di macchina
|
||||
std::string m_sSysNotes ; // note interne
|
||||
std::string m_sUserNotes ; // note dell'utente
|
||||
|
||||
FiveAxisMillingData( void)
|
||||
: m_ToolUuid(), m_nSolCh( 0), m_dSpeed( 0), m_dFeed( 0), m_dStartFeed( 0), m_dEndFeed( 0), m_dTipFeed( 0),
|
||||
m_dOffsR( 0), m_dOffsL( 0), m_bToolInvert( false), m_bInvert( false), m_dStartPos( 0), m_nSubType( 0) {}
|
||||
FiveAxisMillingData* Clone( void) const override ;
|
||||
bool CopyFrom( const MachiningData* pMdata) override ;
|
||||
bool SameAs(const MachiningData* pMdata) const override ;
|
||||
int GetType( void) const override
|
||||
{ return MT_FIVEAXISMILLING ; }
|
||||
int GetSize( void) const override ;
|
||||
std::string GetTitle( void) const override ;
|
||||
bool FromString( const std::string& sString, int& nKey) override ;
|
||||
std::string ToString( int nKey) const override ;
|
||||
bool IsOptional( int nKey) const override ;
|
||||
bool SetParam( int nType, bool bVal) override ;
|
||||
bool SetParam( int nType, int nVal) override ;
|
||||
bool SetParam( int nType, double dVal) override ;
|
||||
bool SetParam( int nType, const std::string& sVal) override ;
|
||||
bool ResetTool( void) override ;
|
||||
bool GetParam( int nType, bool& bVal) const override ;
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool GetTool( const ToolsMgr* pToolsMgr, const ToolData*& pTdata) const override ;
|
||||
bool VerifyTool( const ToolsMgr* pToolsMgr, const std::string& sVal, const ToolData*& pTdata) const override ;
|
||||
bool VerifySolCh( int nVal) const ;
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline const FiveAxisMillingData* GetFiveAxisMillingData( const MachiningData* pMdata)
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_FIVEAXISMILLING)
|
||||
return nullptr ;
|
||||
return ( static_cast<const FiveAxisMillingData*>( pMdata)) ; }
|
||||
inline FiveAxisMillingData* GetFiveAxisMillingData( MachiningData* pMdata)
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_FIVEAXISMILLING)
|
||||
return nullptr ;
|
||||
return ( static_cast<FiveAxisMillingData*>( pMdata)) ; }
|
||||
+116
-31
@@ -17,6 +17,7 @@
|
||||
#include "DllMain.h"
|
||||
#include "GenMachining.h"
|
||||
#include "OperationConst.h"
|
||||
#include "OperUserNotesConst.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
@@ -39,6 +40,8 @@ using namespace std ;
|
||||
// 2806 = "Error in GenMachining : link movements not calculable"
|
||||
// 2807 = "Error in GenMachining : link outstroke xx"
|
||||
// 2808 = "Error in GenMachining : post apply not calculable"
|
||||
// 2809 = "Error in GenMachining : Tool loading failed"
|
||||
// 2810 = "Error in GenMachining : special apply not calculable"
|
||||
// 2851 = "Warning in GenMachining : Skipped entity (xx)"
|
||||
// 2852 = "Warning in GenMachining : No machinable path"
|
||||
// 2853 = "Warning in GenMachining : Tool name changed (xx)"
|
||||
@@ -54,15 +57,27 @@ static const string EVAR_INVERT = ".INVERT" ; // IN (bool) flag di inversio
|
||||
static const string EVAR_STARTPOS = ".STARTPOS" ; // IN (num) quota di inizio lavorazione (sempre >= 0)
|
||||
static const string EVAR_OFFSR = ".OFFSR" ; // IN (num) offset radiale
|
||||
static const string EVAR_OFFSL = ".OFFSL" ; // IN (num) offset longitudinale
|
||||
static const string EVAR_SYSNOTES = ".SYSNOTES" ; // IN (string) note interne
|
||||
static const string EVAR_USERNOTES = ".USERNOTES" ;// IN (string) note dell'utente
|
||||
static const string EVAR_TOOL = ".TOOL" ; // IN (string) nome dell'utensile
|
||||
static const string EVAR_HEAD = ".HEAD" ; // IN (string) nome testa
|
||||
static const string EVAR_EXIT = ".EXIT" ; // IN (int) indice uscita
|
||||
static const string EVAR_TTYPE = ".TTYPE" ; // IN (int) tipo utensile
|
||||
static const string EVAR_TMAXMAT = ".TMAXMAT" ; // IN (num) massimo materiale
|
||||
static const string EVAR_TDIAM = ".TDIAM" ; // IN (num) diametro utensile
|
||||
static const string EVAR_TTOTDIAM = ".TTOTDIAM" ; // IN (num) diametro totale utensile
|
||||
static const string EVAR_TLEN = ".TLEN" ; // IN (num) lunghezza utensile
|
||||
static const string EVAR_TTOTLEN = ".TTOTLEN" ; // IN (num) lunghezza totale utensile
|
||||
static const string EVAR_TTHICK = ".THICK" ; // IN (num) spessore per lame o altezza taglienti
|
||||
static const string EVAR_TCORNRAD = ".TCORNRAD" ; // IN (num) raggio corner
|
||||
static const string EVAR_TSIDEANG = ".TSIDEANG" ; // IN (num) angolo del fianco rispetto all'asse
|
||||
static const string EVAR_FEED = ".FEED" ; // IN (num) feed dell'utensile
|
||||
static const string EVAR_STARTFEED = ".STARTFEED" ;// IN (num) feed di inizio dell'utensile
|
||||
static const string EVAR_ENDFEED = ".ENDFEED" ; // IN (num) feed di fine dell'utensile
|
||||
static const string EVAR_TIPFEED = ".TIPFEED" ; // IN (num) feed di punta dell'utensile
|
||||
static const string EVAR_SYSNOTES = ".SYSNOTES" ; // IN (string) note interne
|
||||
static const string EVAR_USERNOTES = ".USERNOTES" ;// IN (string) note dell'utente
|
||||
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok)
|
||||
static const string EVAR_MILLS = ".MILLS" ; // OUT (int) numero di percorsi di lavoro
|
||||
static const string EVAR_ISROBOT = ".ISROBOT" ; // IN (bool) flag per indicare che la cinematica è di tipo robot
|
||||
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok)
|
||||
static const string EVAR_MILLS = ".MILLS" ; // OUT (int) numero di percorsi di lavoro
|
||||
static const string ON_PREVIEW = "OnPreview_" ;
|
||||
static const string ON_APPLY = "OnApply_" ;
|
||||
|
||||
@@ -398,7 +413,8 @@ GenMachining::SetGeometry( const SELVECTOR& vIds)
|
||||
// verifico validità gestore DB geometrico
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// reset della geometria corrente
|
||||
// copia temporanea e reset della geometria corrente
|
||||
SELVECTOR vOldId = m_vId ;
|
||||
m_vId.clear() ;
|
||||
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve o tutte facce)
|
||||
int nType = GEO_NONE ;
|
||||
@@ -414,7 +430,8 @@ GenMachining::SetGeometry( const SELVECTOR& vIds)
|
||||
m_vId.emplace_back( Id) ;
|
||||
}
|
||||
// aggiorno lo stato
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
if ( m_vId != vOldId)
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
// restituisco presenza geometria da lavorare
|
||||
return ( ! m_vId.empty() || vIds.empty()) ;
|
||||
}
|
||||
@@ -436,6 +453,12 @@ GenMachining::Preview( bool bRecalc)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// rendo corrente l'utensile usato nella lavorazione
|
||||
if ( ! m_pMchMgr->SetCalcTool( m_TParams.m_sName, m_TParams.m_sHead, m_TParams.m_nExit)) {
|
||||
m_pMchMgr->SetLastError( 2809, "Error in GenMachining : Tool loading failed") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// recupero gruppo per geometria di Preview
|
||||
int nPvId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_PV) ;
|
||||
// se non c'è, lo aggiungo
|
||||
@@ -480,13 +503,25 @@ GenMachining::Preview( bool bRecalc)
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTPOS, m_Params.m_dStartPos) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSR, GetOffsR()) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSL, GetOffsL()) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_SYSNOTES, m_Params.m_sSysNotes) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, m_Params.m_sUserNotes) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TOOL, m_TParams.m_sName) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_HEAD, m_TParams.m_sHead) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_EXIT, m_TParams.m_nExit) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTYPE, m_TParams.m_nType) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TMAXMAT, m_TParams.m_dMaxMat) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TDIAM, m_TParams.m_dDiam) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTOTDIAM, m_TParams.m_dTDiam) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TLEN, m_TParams.m_dLen) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTOTLEN, m_TParams.m_dTLen) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTHICK, m_TParams.m_dThick) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TCORNRAD, m_TParams.m_dCornRad) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TSIDEANG, m_TParams.m_dSideAng) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_FEED, GetFeed()) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTFEED, GetStartFeed()) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ENDFEED, GetEndFeed()) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TIPFEED, GetTipFeed()) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_SYSNOTES, m_Params.m_sSysNotes) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, m_Params.m_sUserNotes) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ISROBOT, m_pMchMgr->GetCurrIsRobot()) ;
|
||||
// eseguo
|
||||
bOk = bOk && pMch->LuaCallFunction( sPreview, false) ;
|
||||
// recupero valori parametri obbligatori
|
||||
@@ -518,27 +553,37 @@ GenMachining::Apply( bool bRecalc, bool bPostApply)
|
||||
return false ;
|
||||
|
||||
// aggiorno dati geometrici dell'utensile
|
||||
bool bToolChanged = true ;
|
||||
if ( ! UpdateToolData( &bToolChanged)) {
|
||||
if ( ! UpdateToolData()) {
|
||||
m_pMchMgr->SetLastError( 2801, "Error in GenMachining : UpdateToolData failed") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// se modificata geometria, necessario ricalcolo
|
||||
if ( ( m_nStatus & MCH_ST_GEO_MODIF) != 0)
|
||||
bRecalc = true ;
|
||||
|
||||
// verifico se necessario continuare nell'aggiornamento
|
||||
if ( ! bRecalc && ! bToolChanged &&
|
||||
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
|
||||
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
// confermo i percorsi di lavorazione
|
||||
m_nMills = nCurrMills ;
|
||||
LOG_DBG_INFO( GetEMkLogger(), "GenMachining apply skipped : status already ok") ;
|
||||
string sLog = string( "GenMachining apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ;
|
||||
LOG_DBG_INFO( GetEMkLogger(), sLog.c_str()) ;
|
||||
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
|
||||
if ( ! Update( bPostApply))
|
||||
return false ;
|
||||
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
|
||||
LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
|
||||
// esco con successo
|
||||
return true ;
|
||||
}
|
||||
m_nStatus = MCH_ST_TO_VERIFY ;
|
||||
|
||||
// rendo corrente l'utensile usato nella lavorazione
|
||||
if ( ! m_pMchMgr->SetCalcTool( m_TParams.m_sName, m_TParams.m_sHead, m_TParams.m_nExit)) {
|
||||
m_pMchMgr->SetLastError( 2809, "Error in GenMachining : Tool loading failed") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// recupero gruppo per geometria di lavorazione (Cutter Location)
|
||||
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
|
||||
// se non c'è, lo aggiungo
|
||||
@@ -583,13 +628,25 @@ GenMachining::Apply( bool bRecalc, bool bPostApply)
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTPOS, m_Params.m_dStartPos) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSR, GetOffsR()) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSL, GetOffsL()) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_SYSNOTES, m_Params.m_sSysNotes) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, m_Params.m_sUserNotes) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TOOL, m_TParams.m_sName) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_HEAD, m_TParams.m_sHead) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_EXIT, m_TParams.m_nExit) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTYPE, m_TParams.m_nType) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TMAXMAT, m_TParams.m_dMaxMat) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TDIAM, m_TParams.m_dDiam) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTOTDIAM, m_TParams.m_dTDiam) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TLEN, m_TParams.m_dLen) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTOTLEN, m_TParams.m_dTLen) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTHICK, m_TParams.m_dThick) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TCORNRAD, m_TParams.m_dCornRad) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TSIDEANG, m_TParams.m_dSideAng) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_FEED, GetFeed()) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTFEED, GetStartFeed()) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ENDFEED, GetEndFeed()) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TIPFEED, GetTipFeed()) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_SYSNOTES, m_Params.m_sSysNotes) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, m_Params.m_sUserNotes) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ISROBOT, m_pMchMgr->GetCurrIsRobot()) ;
|
||||
// eseguo
|
||||
bOk = bOk && pMch->LuaCallFunction( sApply, false) ;
|
||||
// recupero valori parametri obbligatori
|
||||
@@ -636,6 +693,9 @@ GenMachining::Update( bool bPostApply)
|
||||
return true ;
|
||||
}
|
||||
|
||||
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
|
||||
RemoveClimbRiseHome() ;
|
||||
|
||||
// imposto eventuale asse bloccato da lavorazione
|
||||
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
|
||||
|
||||
@@ -652,9 +712,22 @@ GenMachining::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni speciali
|
||||
string sSpecErr ;
|
||||
if ( bPostApply && ! SpecialApply( sSpecErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sSpecErr))
|
||||
m_pMchMgr->SetLastError( 2810, sSpecErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2810, "Error in GenMachining : special apply not calculable") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
|
||||
bool bVpl ;
|
||||
if ( ! FromString( ExtractInfo( m_Params.m_sUserNotes, "Vpl:"), bVpl))
|
||||
if ( ! FromString( ExtractInfo( m_Params.m_sUserNotes, UN_VPL_COLON), bVpl))
|
||||
bVpl = true ;
|
||||
if ( ! AdjustStartEndMovements( bVpl)) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
@@ -665,14 +738,11 @@ GenMachining::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni
|
||||
string sErr ;
|
||||
if ( bPostApply && ! PostApply( sErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sErr))
|
||||
m_pMchMgr->SetLastError( 2808, sErr) ;
|
||||
// esecuzione eventuali personalizzazioni finali
|
||||
string sPostErr ;
|
||||
if ( bPostApply && ! PostApply( sPostErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sPostErr))
|
||||
m_pMchMgr->SetLastError( 2808, sPostErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2808, "Error in GenMachining : post apply not calculable") ;
|
||||
return false ;
|
||||
@@ -796,16 +866,20 @@ GenMachining::GetToolData( void) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GenMachining::UpdateToolData( bool* pbChanged)
|
||||
GenMachining::UpdateToolData( void)
|
||||
{
|
||||
// recupero il gestore DB utensili della macchina corrente
|
||||
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
|
||||
if ( pTMgr == nullptr)
|
||||
return false ;
|
||||
// recupero l'utensile nel DB utensili
|
||||
// recupero l'utensile nel DB utensili (se fallisce con UUID provo con il nome)
|
||||
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
if ( pTdata == nullptr) {
|
||||
pTdata = pTMgr->GetTool( m_Params.m_sToolName) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
m_Params.m_ToolUuid = m_TParams.m_Uuid ;
|
||||
}
|
||||
// salvo posizione TC, testa e uscita originali
|
||||
string sOrigTcPos = m_TParams.m_sTcPos ;
|
||||
string sOrigHead = m_TParams.m_sHead ;
|
||||
@@ -843,9 +917,9 @@ GenMachining::UpdateToolData( bool* pbChanged)
|
||||
m_Params.m_sToolName + ")" ;
|
||||
m_pMchMgr->SetWarning( 2854, sInfo) ;
|
||||
}
|
||||
// se definito parametro di ritorno, lo assegno
|
||||
if ( pbChanged != nullptr)
|
||||
*pbChanged = bChanged ;
|
||||
// se modificato, aggiusto lo stato
|
||||
if ( bChanged)
|
||||
m_nStatus = MCH_ST_TO_VERIFY ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -912,3 +986,14 @@ GenMachining::VerifyGeometry( SelData Id, int& nSubs, int& nType)
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
double
|
||||
GenMachining::GetApproxLinTol( void) const
|
||||
{
|
||||
double dLinTol ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_LINTOL, dLinTol))
|
||||
return dLinTol ;
|
||||
else
|
||||
return Operation::GetApproxLinTol() ;
|
||||
}
|
||||
|
||||
+10
-3
@@ -35,8 +35,14 @@ class GenMachining : public Machining
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_GENMACHINING ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nMills == 0) ; }
|
||||
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
|
||||
{ if ( m_nMills == 0)
|
||||
return true ;
|
||||
if ( nEmptyType == NEED_ONE_TP_OK)
|
||||
return ( ! IsAtLeastOnePathOk()) ;
|
||||
if ( nEmptyType == NEED_ALL_TP_OK)
|
||||
return ( ! AreAllPathsOk()) ;
|
||||
return false ; }
|
||||
bool UpdateStatus( int nModif) override
|
||||
{ m_nStatus |= nModif ; return true ; }
|
||||
|
||||
@@ -58,7 +64,7 @@ class GenMachining : public Machining
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool UpdateToolData( bool* pbChanged = nullptr) override ;
|
||||
bool UpdateToolData( void) override ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
|
||||
@@ -67,6 +73,7 @@ class GenMachining : public Machining
|
||||
|
||||
private :
|
||||
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
|
||||
double GetApproxLinTol( void) const override ;
|
||||
|
||||
private :
|
||||
double GetSpeed() const
|
||||
|
||||
@@ -178,7 +178,7 @@ GenMachiningData::GetTitle( void) const
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
static int
|
||||
FindGenMachiningKey( const string& sKey)
|
||||
{
|
||||
auto TheRange = equal_range( sGenMachiningKey.cbegin(), sGenMachiningKey.cend(), sKey) ;
|
||||
|
||||
+6
-2
@@ -67,6 +67,10 @@ struct GenMachiningData : public MachiningData
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline const GenMachiningData* GetGenMachiningData( const MachiningData* pMdata)
|
||||
{ return (dynamic_cast<const GenMachiningData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_GENMACHINING)
|
||||
return nullptr ;
|
||||
return ( static_cast<const GenMachiningData*>( pMdata)) ; }
|
||||
inline GenMachiningData* GetGenMachiningData( MachiningData* pMdata)
|
||||
{ return (dynamic_cast<GenMachiningData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_GENMACHINING)
|
||||
return nullptr ;
|
||||
return ( static_cast<GenMachiningData*>( pMdata)) ; }
|
||||
|
||||
+34
-8
@@ -17,9 +17,10 @@
|
||||
#include "Generator.h"
|
||||
#include "MachMgr.h"
|
||||
#include "OutputConst.h"
|
||||
#include "/EgtDev/Include/EMkDllMain.h"
|
||||
#include "/EgtDev/Include/EGnFileUtils.h"
|
||||
#include "/EgtDev/Include/EGnGetKeyData.h"
|
||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
||||
#include "/EgtDev/Include/SELkKeyProc.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -53,8 +54,8 @@ Generator::Run( const string& sCncFile, const string& sInfo)
|
||||
int nRet = GetEGnKeyOptions( KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
|
||||
nOpt1, nOpt2, nOptExpDays) ;
|
||||
if ( ! GetEMkNetHwKey())
|
||||
int nRet = GetKeyOptions( GetEMkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
|
||||
nOpt1, nOpt2, nOptExpDays) ;
|
||||
nRet = GetKeyOptions( GetEMkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
|
||||
nOpt1, nOpt2, nOptExpDays) ;
|
||||
|
||||
// Verifica della abilitazione
|
||||
bool bMinTime = false ;
|
||||
@@ -66,12 +67,30 @@ Generator::Run( const string& sCncFile, const string& sInfo)
|
||||
bool bKey = false ;
|
||||
if ( nRet == KEY_OK)
|
||||
bKey = true ;
|
||||
bool bOption = false ;
|
||||
if ( ( nOpt1 & KEYOPT_EMK_NC_OFF) == 0)
|
||||
bOption = true ;
|
||||
bool bNcOff = false ;
|
||||
if ( ( nOpt1 & KEYOPT_EMK_NC_OFF) != 0)
|
||||
bNcOff = true ;
|
||||
bool bAdvMach = false ;
|
||||
if ( ( nOpt1 & KEYOPT_EMK_ADV) != 0)
|
||||
bAdvMach = true ;
|
||||
|
||||
// Esecuzione
|
||||
if ( bMinTime && bCurrTime && bKey && bOption) {
|
||||
if ( bMinTime && bCurrTime && bKey && ! bNcOff) {
|
||||
|
||||
// se non previste lavorazioni avanzate, verifico la loro assenza
|
||||
if ( ! bAdvMach) {
|
||||
int nOpId = m_pMchMgr->GetFirstActiveOperation() ;
|
||||
while ( nOpId != GDB_ID_NULL) {
|
||||
int nType = m_pMchMgr->GetOperationType( nOpId) ;
|
||||
if ( nType == OPER_SURFROUGHING || nType == OPER_SURFFINISHING || nType == OPER_FIVEAXISMILLING) {
|
||||
m_pMchMgr->SetLastError( 1001, "ADVANCED_MACH_OFF") ;
|
||||
std::string sErr = "Warning on Key (MKC/AMO)" ;
|
||||
LOG_ERROR( GetEMkLogger(), sErr.c_str()) ;
|
||||
return false ;
|
||||
}
|
||||
nOpId = m_pMchMgr->GetNextActiveOperation( nOpId) ;
|
||||
}
|
||||
}
|
||||
|
||||
// emetto info di log
|
||||
{ string sOut = "Generator Run : " + sCncFile ;
|
||||
@@ -99,7 +118,7 @@ Generator::Run( const string& sCncFile, const string& sInfo)
|
||||
|
||||
// Generazione non abilitata
|
||||
m_pMchMgr->SetLastError( 1000, "NC_OFF") ;
|
||||
std::string sErr = "Warning on Key (MKC/NCO)" ;
|
||||
std::string sErr = ( bNcOff ? "Warning on Key (MKC/NCO)" : "Warning on Key (MKC/KYO)") ;
|
||||
LOG_ERROR( GetEMkLogger(), sErr.c_str()) ;
|
||||
return false ;
|
||||
}
|
||||
@@ -162,6 +181,13 @@ Generator::CallOnTableData( void)
|
||||
return m_pMachine->LuaCallFunction( ON_TABLE_DATA) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Generator::CallOnTableAxisData( void)
|
||||
{
|
||||
return m_pMachine->LuaCallFunction( ON_TABLE_AXIS_DATA) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Generator::CallOnFixtureData( void)
|
||||
|
||||
@@ -33,6 +33,7 @@ class Generator : public Processor
|
||||
bool CallOnDispositionStart( void) override ;
|
||||
bool CallOnDispositionEnd( void) override ;
|
||||
bool CallOnTableData( void) override ;
|
||||
bool CallOnTableAxisData( void) override ;
|
||||
bool CallOnFixtureData( void) override ;
|
||||
bool CallOnRawMoveData( void) override ;
|
||||
bool CallOnToolSelect( void) override ;
|
||||
|
||||
+6
-1
@@ -16,11 +16,16 @@
|
||||
//----------------- Costanti generali ----------------------------------------
|
||||
#include "/EgtDev/Include/EGkGeoConst.h"
|
||||
|
||||
//----------- Minima distanza di sicurezza ----------------------------------
|
||||
const double MIN_SAFEDIST = 5.0 ;
|
||||
|
||||
//----------- Costanti per approssimazioni con polilinee o poliarchi --------
|
||||
const double LIN_TOL_STD = 0.1 ;
|
||||
const double LIN_TOL_MID = 0.05 ;
|
||||
const double ANG_TOL_MAX_DEG = 90 ;
|
||||
const double LIN_TOL_RAW = 0.5 ;
|
||||
const double ANG_TOL_STD_DEG = 15 ;
|
||||
const double ANG_TOL_MID_DEG = 45 ;
|
||||
const double ANG_TOL_MAX_DEG = 90 ;
|
||||
const double LIN_FEA_STD = 20 ;
|
||||
|
||||
//----------- Costante per offset salva spigoli di lama su cornici curve ----
|
||||
|
||||
@@ -52,6 +52,7 @@ Head::Clone( void) const
|
||||
pHead->m_bMaxDeltaR2On1 = m_bMaxDeltaR2On1 ;
|
||||
pHead->m_Rot2Stroke = m_Rot2Stroke ;
|
||||
pHead->m_nSolCh = m_nSolCh ;
|
||||
pHead->m_vsOtherColl = m_vsOtherColl ;
|
||||
}
|
||||
catch( ...) {
|
||||
delete pHead ;
|
||||
@@ -73,6 +74,7 @@ Head::Dump( string& sOut, bool bMM, const char* szNewLine) const
|
||||
sOut += "ExitCount=" + ToString( m_nExitCount) + szNewLine ;
|
||||
sOut += "HSet=" + ToString( m_vsHSet) + szNewLine ;
|
||||
sOut += "ADir=" + ToString( m_vtADir) + szNewLine ;
|
||||
sOut += "OtherColl=" + ToString( m_vsOtherColl) + szNewLine ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -103,7 +105,7 @@ Head::GetGeomDB( void) const
|
||||
//----------------------------------------------------------------------------
|
||||
Head::Head( void)
|
||||
: m_nOwnerId( GDB_ID_NULL), m_pGeomDB( nullptr), m_nType( MCH_HT_NONE), m_nExitCount( 0),
|
||||
m_dRot1W( 1), m_bMaxDeltaR2On1( true), m_nSolCh( MCH_SCC_NONE)
|
||||
m_nSelectType( MCH_SLT_FIXEDEXITS), m_dRot1W( 1), m_bMaxDeltaR2On1( true), m_nSolCh( MCH_SCC_NONE)
|
||||
{
|
||||
m_Rot2Stroke.Min = - INFINITO ;
|
||||
m_Rot2Stroke.Max = INFINITO ;
|
||||
@@ -111,7 +113,7 @@ Head::Head( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Head::Set( const string& sName, int nType, int nExitCount, const string& sHSet, const Vector3d& vtADir,
|
||||
Head::Set( const string& sName, int nType, int nExitCount, const string& sHSet, int nSelectType, const Vector3d& vtADir,
|
||||
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl)
|
||||
{
|
||||
m_sName = sName ;
|
||||
@@ -122,6 +124,10 @@ Head::Set( const string& sName, int nType, int nExitCount, const string& sHSet,
|
||||
m_nExitCount = 1 ;
|
||||
m_vsHSet.clear() ;
|
||||
m_vsHSet.push_back( sHSet) ;
|
||||
if ( nSelectType == MCH_SLT_FIXEDEXITS || nSelectType == MCH_SLT_ONEEXIT || nSelectType == MCH_SLT_MULTIEXITS)
|
||||
m_nSelectType = nSelectType ;
|
||||
else
|
||||
m_nSelectType = MCH_SLT_FIXEDEXITS ;
|
||||
m_vtADir = vtADir ;
|
||||
m_vtADir.Normalize() ;
|
||||
m_dRot1W = dRot1W ;
|
||||
|
||||
@@ -30,7 +30,7 @@ class Head : public IUserObj
|
||||
|
||||
public :
|
||||
Head( void) ;
|
||||
bool Set( const std::string& sName, int nType, int nExitCount, const std::string& sHSet,
|
||||
bool Set( const std::string& sName, int nType, int nExitCount, const std::string& sHSet, int nSelectType,
|
||||
const Vector3d& vtADir, double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh,
|
||||
const STRVECTOR& vsOthColl) ;
|
||||
bool AddHeadToHSet( const std::string& sHead) ;
|
||||
@@ -43,6 +43,8 @@ class Head : public IUserObj
|
||||
{ return m_nExitCount ; }
|
||||
const STRVECTOR& GetHSet(void) const
|
||||
{ return m_vsHSet ; }
|
||||
int GetSelectType( void) const
|
||||
{ return m_nSelectType ; }
|
||||
const Vector3d& GetADir( void) const
|
||||
{ return m_vtADir ; }
|
||||
double GetRot1W( void) const
|
||||
@@ -63,6 +65,7 @@ class Head : public IUserObj
|
||||
int m_nType ;
|
||||
int m_nExitCount ;
|
||||
STRVECTOR m_vsHSet ;
|
||||
int m_nSelectType ;
|
||||
Vector3d m_vtADir ;
|
||||
double m_dRot1W ;
|
||||
bool m_bMaxDeltaR2On1 ;
|
||||
|
||||
+40
-1
@@ -15,7 +15,6 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Radice della gestione delle lavorazioni
|
||||
const std::string MACH_BASE = "MachBase" ;
|
||||
@@ -47,6 +46,10 @@ const std::string MACH_RAW_SOLID = "RawSolid" ;
|
||||
const std::string MACH_RAW_CENTER = "RawCenter" ;
|
||||
// Nome del contorno esterno del grezzo
|
||||
const std::string MACH_RAW_OUTLINE = "RawOutline" ;
|
||||
// Nome della regione superiore del grezzo
|
||||
const std::string MACH_RAW_UP_REG = "RawUpReg" ;
|
||||
// Nome della regione inferiore del grezzo
|
||||
const std::string MACH_RAW_DOWN_REG = "RawDwnReg" ;
|
||||
// Nome del kerf del grezzo
|
||||
const std::string MACH_RAW_KERF = "Kerf" ;
|
||||
|
||||
@@ -74,12 +77,30 @@ const std::string MACHININGS_DIR = "Machinings" ;
|
||||
// Nome file delle lavorazioni
|
||||
const std::string MACHININGS_FILE = "Machinings.data" ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Sezione Generale nel file INI di macchina
|
||||
const std::string GENERAL_SEC = "General" ;
|
||||
// Chiave per materiale caratteristico
|
||||
const std::string MATERIAL_KEY = "Material" ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Sezione tastature nel file INI di macchina
|
||||
const std::string PROBING_SEC = "Probing" ;
|
||||
// Chiave (radice) per nome tastatura i-esima
|
||||
const std::string PROBING_SCRIPT_KEY = "PrbScript" ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Sezione lavorazioni generiche nel file INI di macchina
|
||||
const std::string GENMACHINING_SEC = "GenMachining" ;
|
||||
// Chiave (radice) per nome lavorazione generica i-esima
|
||||
const std::string GENMACHINING_SCRIPT_KEY = "GenScript" ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Sezione fresature 5assi nel file INI di macchina
|
||||
const std::string FIVEAXISMILLING_SEC = "5AxMilling" ;
|
||||
// Chiave (radice) per nome lavorazione 5assi i-esima
|
||||
const std::string FIVEAXISMILLING_SCRIPT_KEY = "5AxScript" ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Sezione di attrezzaggio nel file INI di macchina
|
||||
const std::string SETUP_SEC = "Setup" ;
|
||||
@@ -101,6 +122,8 @@ const std::string MORTISEMAKER_KEY = "MortiseMaker" ;
|
||||
const std::string CHISELMAKER_KEY = "ChiselMaker" ;
|
||||
// Chiave per generatore disegno waterjet
|
||||
const std::string WATERJETMAKER_KEY = "WaterJetMaker" ;
|
||||
// Chiave per generatore disegno tastatori
|
||||
const std::string PROBEMAKER_KEY = "ProbeMaker" ;
|
||||
// Chiave per porta utensili punte a forare (marmo)
|
||||
const std::string DRILLHOLDER_KEY = "DrillHolder" ;
|
||||
// Chiave per porta utensili lame (marmo)
|
||||
@@ -112,6 +135,12 @@ const std::string MILLHOLDER_KEY = "MillHolder" ;
|
||||
// Sezione portautensili nel file INI di macchina
|
||||
const std::string TOOLHOLDER_SEC = "ToolHolder" ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Sezione lavorazioni nel file INI di macchina
|
||||
const std::string MACHININGS_SEC = "Machinings" ;
|
||||
// Chiave per abilitare discesa e risalita in rapido da fresature con estremi fuori dal grezzo
|
||||
const std::string RAPIDONOUT_KEY = "RapidOnOut" ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Minimo spessore del grezzo
|
||||
const double RAW_MIN_H = 1 ;
|
||||
@@ -127,11 +156,21 @@ const double MAX_ANG_CEN = 150.001 ;
|
||||
//----------------------------------------------------------------------------
|
||||
// Tolleranza su elevazione per attacchi e uscite
|
||||
const double LIO_ELEV_TOL = 2.0 ;
|
||||
const double LIO_ELEV_FLOAT = 10.0 ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Per FlatParts (vedi Nesting di EgtExecutor)
|
||||
const std::string NST_EXT_LAYER = "OutLoop" ;
|
||||
const std::string NST_PARTREG_LAYER = "Region" ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Minima componente zeta di versore utensile per lavorazione da sopra (-45deg)
|
||||
const double MIN_ZDIR_TOP_TOOL = -0.7072 ;
|
||||
// Minima componente zeta di versore utensile per mortasatura quasi verticale (45deg)
|
||||
const double MIN_ZDIR_VERT_CHSAW = 0.7072 ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Valore di default del peso del primo asse rotante di macchina
|
||||
static const double ROT1_WEIGHT_DFLT = 1 ;
|
||||
// Valore di default per angolo di apertura del cono di direzioni coincidenti con singolarità
|
||||
static const double SING_CONE_ANG_DFLT = 0.01 ;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2022
|
||||
// EgalTech 2015-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : MachMgr.h Data : 21.09.22 Versione : 2.4i4
|
||||
// File : MachMgr.h Data : 25.11.24 Versione : 2.6k5
|
||||
// Contenuto : Dichiarazione della classe MachMgr.
|
||||
//
|
||||
//
|
||||
@@ -11,6 +11,12 @@
|
||||
// 17.08.20 DS Aggiunte GetAxisMin e GetAxisMax.
|
||||
// 17.03.21 DS Aggiunte funzioni per import/export utensili.
|
||||
// 21.09.22 DS Aggiunta GetAxisOffset.
|
||||
// 25.08.23 DS Aggiunta CopyMachGroup.
|
||||
// 28.10.23 DS Aggiunte GetClEntAxesVal e GetToolSetupPosInCurrSetup.
|
||||
// 30.03.24 DS Aggiunte GetAllAxesNames e GetCalcTable.
|
||||
// 02.04.24 DS Aggiunta GetClEntAxesMask.
|
||||
// 22.04.24 DS Aggiunta GetExitId.
|
||||
// 25.11.24 DS Aggiunta GetMachiningSkippedGeometry.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -95,7 +101,9 @@ class MachMgr : public IMachMgr
|
||||
int GetPrevMachGroup( int nId) const override ;
|
||||
bool GetMachGroupNewName( std::string& sName) const override ;
|
||||
int AddMachGroup( const std::string& sName, const std::string& sMachineName) override ;
|
||||
int CopyMachGroup( const std::string& sSouName, const std::string& sName) override ;
|
||||
bool RemoveMachGroup( int nId) override ;
|
||||
bool ChangeMachGroupName( int nId, const std::string& sNewName) override ;
|
||||
std::string GetMachGroupName( int nId) const override ;
|
||||
std::string GetMachGroupMachineName( int nId) const override ;
|
||||
int GetMachGroupId( const std::string& sName) const override ;
|
||||
@@ -117,7 +125,7 @@ class MachMgr : public IMachMgr
|
||||
int AddRawPart( const Point3d& ptOrig, double dLen, double dWidth, double dHeight, Color cCol) override ;
|
||||
int AddRawPartWithPart( int nPartId, int nCrvSrfId, double dOverMat, Color cCol) override ;
|
||||
bool ModifyRawPart( int nRawId, const Point3d& ptOrig, double dLen, double dWidth, double dHeight, Color cCol) override ;
|
||||
bool ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dZmin, double dHeight, Color cCol) override ;
|
||||
bool ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dHeight, Color cCol) override ;
|
||||
bool ModifyRawPartSize( int nRawId, double dLength, double dWidth, double dHeight) override ;
|
||||
bool ModifyRawPartHeight( int nRawId, double dHeight) override ;
|
||||
bool KeepRawPart( int nRawId, int nSouPhase) override ;
|
||||
@@ -149,6 +157,9 @@ class MachMgr : public IMachMgr
|
||||
bool GetTableAreaOffset( int nInd, BBox3d& b3AreaOffs) const override ;
|
||||
bool ChangeTable( const std::string& sTable, bool bUpdateDisp) override ;
|
||||
bool ShowOnlyTable( bool bVal) override ;
|
||||
bool MoveDispAxis( const std::string& sName, double dPos) override ;
|
||||
bool RemoveDispAxis( const std::string& sName) override ;
|
||||
bool KeepAllDispAxes( int nSouPhase) override ;
|
||||
int AddFixture( const std::string& sName, const Point3d& ptPos, double dAngRotDeg, double dMov) override ;
|
||||
bool KeepFixture( int nFxtId, int nSouPhase) override ;
|
||||
bool RemoveFixture( int nFxtId) override ;
|
||||
@@ -157,7 +168,9 @@ class MachMgr : public IMachMgr
|
||||
int GetNextFixture( int nFxtId) const override ;
|
||||
bool MoveFixture( int nId, const Vector3d& vtMove) override ;
|
||||
bool RotateFixture( int nId, double dDeltaAngDeg) override ;
|
||||
bool SetFixtureLink( int nId, const std::string& sTaLink) override ;
|
||||
bool MoveFixtureMobile( int nId, double dDeltaMov) override ;
|
||||
bool SetFixtureMobile( int nId, double dMov) override ;
|
||||
// Tools DataBase
|
||||
bool TdbGetToolNewName( std::string& sName) const override ;
|
||||
bool TdbAddTool( const std::string& sName, int nType) override ;
|
||||
@@ -201,9 +214,11 @@ class MachMgr : public IMachMgr
|
||||
int GetCurrSetup( void) const override ;
|
||||
bool GetDefaultSetupName( std::string& sName) const override ;
|
||||
bool ImportSetup( const std::string& sName) override ;
|
||||
bool ExistsCurrSetup( void) const override ;
|
||||
bool VerifyCurrSetup( STRVECTOR& vsErrors) override ;
|
||||
bool FindToolInCurrSetup( const std::string& sTool) override ;
|
||||
bool GetToolsInCurrSetupPos( const std::string& sTcPos, STRVECTOR& vsTools) override ;
|
||||
bool FindToolInCurrSetup( const std::string& sTool) const override ;
|
||||
bool GetToolSetupPosInCurrSetup( const std::string& sTool, std::string& sTcPos) const override ;
|
||||
bool GetToolsInCurrSetupPos( const std::string& sTcPos, STRVECTOR& vsTools) const override ;
|
||||
bool UpdateCurrSetup( void) override ;
|
||||
bool EraseCurrSetup( void) override ;
|
||||
// Machinings DataBase
|
||||
@@ -244,16 +259,16 @@ class MachMgr : public IMachMgr
|
||||
int GetNextOperation( int nId) const override ;
|
||||
int GetLastOperation( void) const override ;
|
||||
int GetPrevOperation( int nId) const override ;
|
||||
int GetFirstActiveOperation( void) const override ;
|
||||
int GetNextActiveOperation( int nId) const override ;
|
||||
int GetLastActiveOperation( void) const override ;
|
||||
int GetPrevActiveOperation( int nId) const override ;
|
||||
int GetFirstActiveOperation( bool bNeedMachNotEmpty = false) const override ;
|
||||
int GetNextActiveOperation( int nId, bool bNeedMachNotEmpty = false) const override ;
|
||||
int GetLastActiveOperation( bool bNeedMachNotEmpty = false) const override ;
|
||||
int GetPrevActiveOperation( int nId, bool bNeedMachNotEmpty = false) const override ;
|
||||
int GetOperationType( int nId) const override ;
|
||||
int GetOperationPhase( int nId) const override ;
|
||||
bool SetOperationName( int nId, const std::string& sName) override ;
|
||||
std::string GetOperationName( int nId) const override ;
|
||||
int GetOperationId( const std::string& sName) const override ;
|
||||
bool IsOperationEmpty( int nId) const override ;
|
||||
bool IsOperationEmpty( int nId, int nEmptyType = 0) const override ;
|
||||
bool RemoveOperation( int nId) override ;
|
||||
bool RemoveAllPhaseOperations( int nPhase) override ;
|
||||
bool RemoveAllOperations( void) override ;
|
||||
@@ -271,6 +286,7 @@ class MachMgr : public IMachMgr
|
||||
int GetPhaseDisposition( int nPhase) const override ;
|
||||
bool DispositionSpecialApply( int nId, bool bRecalc) override ;
|
||||
bool DispositionSpecialUpdate( int nId) override ;
|
||||
bool GetDispositionToolData( int nId, std::string& sName, std::string& sHead, int& nExit, std::string& sTcPos) override ;
|
||||
// Operations : machinings
|
||||
int AddMachining( const std::string& sName, const std::string& sMachining) override ;
|
||||
int AddMachining( const std::string& sName, int nMchType, const std::string& sTool) override ;
|
||||
@@ -288,21 +304,33 @@ class MachMgr : public IMachMgr
|
||||
bool RemoveMachiningPreview( void) override ;
|
||||
bool MachiningApply( bool bRecalc, bool bPostApply = true) override ;
|
||||
bool MachiningUpdate( bool bPostApply = true) override ;
|
||||
bool ChangePreviewMachiningToolShow( int nLookFlag) override ;
|
||||
bool PreparePreviewMachiningTool( void) const override ;
|
||||
bool RemovePreviewMachiningTool( void) const override ;
|
||||
int PreviewMachiningTool( int nEntId, int nFlag) const override ;
|
||||
int GetPreviewMachiningToolStepCount( void) const override ;
|
||||
int PreviewMachiningTool( int nEntId, int nStep) const override ;
|
||||
bool GetMachiningParam( int nType, bool& bVal) const override ;
|
||||
bool GetMachiningParam( int nType, int& nVal) const override ;
|
||||
bool GetMachiningParam( int nType, double& dVal) const override ;
|
||||
bool GetMachiningParam( int nType, std::string& sVal) const override ;
|
||||
bool GetMachiningGeometry( SELVECTOR& vIds) const override ;
|
||||
bool IsMachiningEmpty( void) const override ;
|
||||
bool GetMachiningSkippedGeometry( SELVECTOR& vIds) const override ;
|
||||
bool IsMachiningEmpty( int nEmptyType = 0) const override ;
|
||||
bool GetMachiningStartPoint( Point3d& ptStart) const override ;
|
||||
bool GetMachiningEndPoint( Point3d& ptEnd) const override ;
|
||||
bool GetMachiningStartAxes( bool bSkipClimb, DBLVECTOR& vAxVal) const override ;
|
||||
bool GetMachiningEndAxes( bool bSkipRise, DBLVECTOR& vAxVal) const override ;
|
||||
// CL Entities Interrogations
|
||||
bool GetClEntMove( int nEntId, int& nMove) const override ;
|
||||
bool GetClEntFlag( int nEntId, int& nFlag) const override ;
|
||||
bool GetClEntFlag( int nEntId, int& nFlag, int& nFlag2) const override ;
|
||||
bool GetClEntIndex( int nEntId, int& nIndex) const override ;
|
||||
bool GetClEntFeed( int nEntId, double& dFeed) const override ;
|
||||
bool GetClEntAxesStatus( int nEntId, int& nStatus) const override ;
|
||||
bool GetClEntAxesMask( int nEntId, int& nMask) const override ;
|
||||
bool GetClEntAxesVal( int nEntId, DBLVECTOR& vAxes) const override ;
|
||||
bool GetClEntTDir( int nEntId, Vector3d& vTDir) const override ;
|
||||
bool GetClEntCDir( int nEntId, Vector3d& vCDir) const override ;
|
||||
bool GetClEntADir( int nEntId, Vector3d& vADir) const override ;
|
||||
// Simulation
|
||||
bool SimInit( void) override ;
|
||||
bool SimStart( bool bFirst) override ;
|
||||
@@ -313,6 +341,7 @@ class MachMgr : public IMachMgr
|
||||
bool SimGetMoveInfo( int& nGmove, double& dFeed) const override ;
|
||||
bool SimSetStep( double dStep) override ;
|
||||
bool SimSetUiStatus( int nUiStatus) override ;
|
||||
bool SimEnableToolTipTrace( bool bEnable) override ;
|
||||
bool SimGoHome( void) override ;
|
||||
bool SimExit( void) override ;
|
||||
// Generation
|
||||
@@ -321,19 +350,25 @@ class MachMgr : public IMachMgr
|
||||
// Machine Calc
|
||||
bool SetCalcTable( const std::string& sTable) override ;
|
||||
bool SetCalcTool( const std::string& sTool, const std::string& sHead, int nExit) override ;
|
||||
bool SetCalcSolCh( int nScc, bool bExact) override ;
|
||||
bool SetRotAxisBlock( const std::string& sAxis, double dVal) override ;
|
||||
bool GetRotAxisBlocked( int nInd, std::string& sAxis, double& dVal) const override ;
|
||||
bool GetCalcTable( std::string& sTable) const override ;
|
||||
bool GetCalcTool( std::string& sTool) const override ;
|
||||
bool GetCalcHead( std::string& sHead) const override ;
|
||||
bool GetCalcExit( int& nExit) const override ;
|
||||
bool GetCalcSolCh( int& nScc, bool& bExact) const override ;
|
||||
bool GetAllCurrAxesNames( STRVECTOR& vAxName) const override ;
|
||||
bool GetRotAxisBlocked( int nInd, std::string& sAxis, double& dVal) const override ;
|
||||
bool GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const override ;
|
||||
bool GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
int& nStat, DBLVECTOR& vAng1, DBLVECTOR& vAng2) const override ;
|
||||
bool GetCalcPositions( const Point3d& ptP, double dAngA, double dAngB,
|
||||
int& nStat, double& dX, double& dY, double& dZ) const override ;
|
||||
double& dX, double& dY, double& dZ) const override ;
|
||||
bool GetCalcPositions( const Point3d& ptP, const DBLVECTOR& vAng,
|
||||
int& nStat, double& dX, double& dY, double& dZ) const override ;
|
||||
double& dX, double& dY, double& dZ) const override ;
|
||||
bool GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
DBLVECTOR& vAng1, DBLVECTOR& vAng2) const override ;
|
||||
bool GetCalcTipFromPositions( double dX, double dY, double dZ, double dAngA, double dAngB,
|
||||
bool bOverall, bool bBottom, Point3d& ptTip) const override ;
|
||||
bool GetCalcTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng,
|
||||
@@ -343,6 +378,7 @@ class MachMgr : public IMachMgr
|
||||
bool GetNearestAngleInStroke( int nInd, double dAngRef, double& dAng) const override ;
|
||||
bool LimitAngleToStroke( int nInd, double& dAng) const override ;
|
||||
bool VerifyOutstroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat) const override ;
|
||||
bool VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, bool bClear, int& nStat) const override ;
|
||||
std::string GetOutstrokeInfo( bool bMM = true) const override ;
|
||||
// Machine
|
||||
int GetBaseId( const std::string& sBase) const override ;
|
||||
@@ -350,9 +386,11 @@ class MachMgr : public IMachMgr
|
||||
int GetAxisId( const std::string& sAxis) const override ;
|
||||
int GetHeadId( const std::string& sHead) const override ;
|
||||
int GetHeadExitCount( const std::string& sHead) const override ;
|
||||
int GetExitId( const std::string& sHead, int nExit) const override ;
|
||||
int GetTcPosId( const std::string& sTcPos) const override ;
|
||||
bool GetAxisToken( const std::string& sAxis, std::string& sToken) const override ;
|
||||
bool GetAxisType( const std::string& sAxis, bool& bLinear) const override ;
|
||||
bool GetAxisDir( const std::string& sAxis, Vector3d& vtDir) const override ;
|
||||
bool GetAxisInvert( const std::string& sAxis, bool& bInvert) const override ;
|
||||
bool GetAxisOffset( const std::string& sAxis, double& dOffset) const override ;
|
||||
bool SetAxisPos( const std::string& sAxis, double dVal, double* pdNewVal = nullptr) override ;
|
||||
@@ -363,6 +401,7 @@ class MachMgr : public IMachMgr
|
||||
bool ResetAxisPos( const std::string& sAxis) override ;
|
||||
bool ResetAllAxesPos( void) override ;
|
||||
bool GetAllTablesNames( STRVECTOR& vNames) const override ;
|
||||
bool GetAllAxesNames( STRVECTOR& vNames) const override ;
|
||||
bool GetAllHeadsNames( STRVECTOR& vNames) const override ;
|
||||
bool GetAllTcPosNames( STRVECTOR& vNames) const override ;
|
||||
bool LoadTool( const std::string& sHead, int nExit, const std::string& sTool) override ;
|
||||
@@ -430,10 +469,13 @@ class MachMgr : public IMachMgr
|
||||
// MachineCalc
|
||||
int GetCurrLinAxes( void) const ;
|
||||
int GetCurrRotAxes( void) const ;
|
||||
bool GetAllCurrAxesName( STRVECTOR& vAxName) const ;
|
||||
bool GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const ;
|
||||
bool GetCurrAxisHomePos( int nInd, double& dHome) const ;
|
||||
bool GetCurrAxisMax( int nInd, double& dHome) const ;
|
||||
bool GetCurrAxisMin( int nInd, double& dHome) const ;
|
||||
const Frame3d& GetCurrLinAxesFrame( void) const ;
|
||||
bool GetCurrIsMcent( void) const ;
|
||||
bool GetCurrIsRobot( void) const ;
|
||||
bool ApplyRotAxisBlock( void) ;
|
||||
void ClearRotAxisBlock( void)
|
||||
{ m_vAxisBlock.clear() ; }
|
||||
@@ -444,22 +486,28 @@ class MachMgr : public IMachMgr
|
||||
double GetCalcRot1W( void) const ;
|
||||
bool GetCalcMaxDeltaR2OnFirst( void) const ;
|
||||
bool GetCalcPartDirFromAngles( const Vector3d& vtPart, const DBLVECTOR& vAng, Vector3d& vtDir) const ;
|
||||
bool SetCalcSolCh( int nScc, bool bExact) ;
|
||||
bool VerifyAngleOutstroke( int nInd, double dAng) const ;
|
||||
bool VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, bool bClear, int& nStat) const ;
|
||||
bool ExistProtectedAreas( void) const ;
|
||||
// Operations
|
||||
bool GetOperationNewName( std::string& sName) const ;
|
||||
const ToolData* GetMachiningToolData( void) const ;
|
||||
// Simulation
|
||||
bool SimAddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
|
||||
bool SimAddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType,
|
||||
const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
|
||||
bool SimRemoveCollisionObj( int nFrameId) ;
|
||||
bool SimGetCollisionObj( int nPos, int& nInd, bool& bToolOn, int& nFrameId, int& nType,
|
||||
Vector3d& vtMove, double& dPar1, double& dPar2, double& dPar3) const ;
|
||||
bool SimExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) ;
|
||||
bool SimOnCollision( int nCdInd, int nObjInd, int& nErr) ;
|
||||
bool SimSetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, const INTVECTOR& vVmill, bool bFirst) ;
|
||||
bool SimSetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, int nFlag,
|
||||
double dPar1, double dPar2, const INTVECTOR& vVmill, bool bFirst) ;
|
||||
bool SimEnableToolsForVmill( bool bEnable) ;
|
||||
int SimMoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) ;
|
||||
bool SimSaveCmd( int nType, int nPar, const std::string& sPar, const std::string& sPar2) ;
|
||||
// Machine
|
||||
bool ResetAllAxesPos( bool bStdAxes, bool bDispAxes) ;
|
||||
bool IsDispositionAxis( const std::string& sAxis, const std::string& sTable = "") const ;
|
||||
bool GetHeadAbove( const std::string& sHead) const ;
|
||||
double GetDeltaSafeZ( const std::string& sHead) const ;
|
||||
double GetAngDeltaMinForHome( void) const ;
|
||||
|
||||
private :
|
||||
@@ -486,6 +534,7 @@ class MachMgr : public IMachMgr
|
||||
// RawParts
|
||||
int AddRawPart( int nCrvId, double dOverMat, double dZmin, double dHeight, Color cCol) ;
|
||||
int AddRawPart( int nSurfId, Color cCol) ;
|
||||
int AddRawPart( int nSurfUpId, int nSurfDownId, double dHeight, Color cCol) ;
|
||||
bool SetRawPartCenter( int nRawId) ;
|
||||
bool ResetRawPartCenter( int nRawId) ;
|
||||
// Parts
|
||||
@@ -532,5 +581,5 @@ class MachMgr : public IMachMgr
|
||||
int m_nCurrDispId ; // identificativo della disposizione corrente
|
||||
int m_nCurrMachiningId ; // identificativo della lavorazione corrente
|
||||
AXBLOCKVECTOR m_vAxisBlock ; // elenco assi da bloccare
|
||||
Simulator* m_pSimul ; // puntatore al simulatore attivo
|
||||
ISimulator* m_pSimul ; // puntatore al simulatore attivo
|
||||
} ;
|
||||
|
||||
+8
-1
@@ -16,6 +16,7 @@
|
||||
#include "MachMgr.h"
|
||||
#include "MachConst.h"
|
||||
#include "DllMain.h"
|
||||
#include "MachiningRegister.h"
|
||||
#include "/EgtDev/Include/EMkDllMain.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EGnFileUtils.h"
|
||||
@@ -32,6 +33,8 @@ CreateMachMgr( void)
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! GetEMkNetHwKey() && ! TestKeyForEMk( GetEMkKey(), 0, GetEMkLogger()))
|
||||
return nullptr ;
|
||||
// registro classe operazione per pocketing
|
||||
RegisterPocketing() ;
|
||||
// creo il MachMgr
|
||||
return static_cast<IMachMgr*> ( new(nothrow) MachMgr) ;
|
||||
}
|
||||
@@ -311,7 +314,11 @@ MachMgr::SetLastError( int nErr, const string& sErr)
|
||||
{
|
||||
m_nLastError = nErr ;
|
||||
m_sLastError = sErr ;
|
||||
string sInfo = m_sLastError + " (" + ToString( nErr) + ")" ;
|
||||
string sInfo ;
|
||||
if ( sErr._Starts_with( "Error"))
|
||||
sInfo = m_sLastError + " (" + ToString( nErr) + ")" ;
|
||||
else
|
||||
sInfo = "Error " + ToString( nErr) + " : " + m_sLastError ;
|
||||
LOG_ERROR( GetEMkLogger(), sInfo.c_str()) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
+134
-5
@@ -1,8 +1,8 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2019-2019
|
||||
// EgalTech 2019-2023
|
||||
//----------------------------------------------------------------------------
|
||||
// File : MachMgrClEntities.cpp Data : 15.10.19 Versione : 2.1j4
|
||||
// Contenuto : Implementazione interrogazione entità CL della classe MachMgr.
|
||||
// File : MachMgrClEntities.cpp Data : 27.10.23 Versione : 2.5j4
|
||||
// Contenuto : Implementazione interrogazione entità CL della classe MachMgr.
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "DllMain.h"
|
||||
#include "MachMgr.h"
|
||||
#include "MachConst.h"
|
||||
#include "CamData.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -39,10 +40,11 @@ MachMgr::GetClEntMove( int nEntId, int& nMove) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetClEntFlag( int nEntId, int& nFlag) const
|
||||
MachMgr::GetClEntFlag( int nEntId, int& nFlag, int& nFlag2) const
|
||||
{
|
||||
// default
|
||||
nFlag = 0 ;
|
||||
nFlag2 = 0 ;
|
||||
// verifico validita GeomDB
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
@@ -50,8 +52,9 @@ MachMgr::GetClEntFlag( int nEntId, int& nFlag) const
|
||||
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
// recupero il flag
|
||||
// recupero i flag
|
||||
nFlag = pCamData->GetFlag() ;
|
||||
nFlag2 = pCamData->GetFlag2() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -72,3 +75,129 @@ MachMgr::GetClEntIndex( int nEntId, int& nIndex) const
|
||||
nIndex = pCamData->GetIndex() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetClEntFeed( int nEntId, double& dFeed) const
|
||||
{
|
||||
// default
|
||||
dFeed = 0 ;
|
||||
// verifico validita GeomDB
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero l'oggetto CamData
|
||||
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
// recupero la feed
|
||||
dFeed = pCamData->GetFeed() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetClEntAxesStatus( int nEntId, int& nStatus) const
|
||||
{
|
||||
// default
|
||||
nStatus = 0 ;
|
||||
// verifico validita GeomDB
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero l'oggetto CamData
|
||||
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
// recupero il tipo di movimento
|
||||
nStatus = pCamData->GetAxesStatus() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetClEntAxesMask( int nEntId, int& nMask) const
|
||||
{
|
||||
// default
|
||||
nMask = 0 ;
|
||||
// verifico validita GeomDB
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero l'oggetto CamData
|
||||
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
// recupero il tipo di movimento
|
||||
nMask = pCamData->GetAxesMask() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetClEntAxesVal( int nEntId, DBLVECTOR& vAxes) const
|
||||
{
|
||||
// default
|
||||
vAxes.clear() ;
|
||||
// verifico validita GeomDB
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero l'oggetto CamData
|
||||
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
// recupero i valori degli assi
|
||||
vAxes = pCamData->GetAxesVal() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetClEntTDir( int nEntId, Vector3d& vTDir) const
|
||||
{
|
||||
// default
|
||||
vTDir = V_NULL ;
|
||||
// verifico validità GeomBD
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero l'oggetto CamData
|
||||
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
// recupero vTDir
|
||||
vTDir = pCamData->GetToolDir() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetClEntCDir( int nEntId, Vector3d& vCDir) const
|
||||
{
|
||||
// default
|
||||
vCDir = V_NULL ;
|
||||
// verifico validità GeomDB
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero l'oggetto CamData
|
||||
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
// recupero vCDir
|
||||
vCDir = pCamData->GetCorrDir() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetClEntADir( int nEntId, Vector3d& vADir) const
|
||||
{
|
||||
// default
|
||||
vADir = V_NULL ;
|
||||
// verifico validità GeomDB
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero l'oggetto CamData
|
||||
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
// recupero ADir
|
||||
vADir = pCamData->GetAuxDir() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
// EgalTech 2015-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : MachMgrDBMachinings.cpp Data : 11.11.15 Versione : 1.6k5
|
||||
// File : MachMgrDBMachinings.cpp Data : 29.03.24 Versione : 2.6d1
|
||||
// Contenuto : Implementazione gestione DB lavorazioni della classe MachMgr.
|
||||
//
|
||||
//
|
||||
@@ -304,6 +304,8 @@ MachMgr::MdbSetGeneralParam( int nType, double dVal)
|
||||
return pMsMgr->SetSafeAggrBottZ( dVal) ;
|
||||
case MGP_MAXDEPTHSAFE :
|
||||
return pMsMgr->SetMaxDepthSafe( dVal) ;
|
||||
case MGP_APPROXLINTOL :
|
||||
return pMsMgr->SetApproxLinTol( dVal) ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
@@ -379,6 +381,9 @@ MachMgr::MdbGetGeneralParam( int nType, double& dVal) const
|
||||
case MGP_MAXDEPTHSAFE :
|
||||
dVal = pMsMgr->GetMaxDepthSafe() ;
|
||||
return true ;
|
||||
case MGP_APPROXLINTOL :
|
||||
dVal = pMsMgr->GetApproxLinTol() ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
+36
-1
@@ -651,6 +651,8 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
|
||||
pTdata->GetParam( TPA_TIPFEED, dTipFeed) ;
|
||||
string sUserNotes ;
|
||||
pTdata->GetParam( TPA_USERNOTES, sUserNotes) ;
|
||||
string sSysNotes ;
|
||||
pTdata->GetParam( TPA_SYSNOTES, sSysNotes) ;
|
||||
// Recupero la path dell'eventuale portautensile
|
||||
string sThPath = GetToolHolderPath( sHeadName, nExit, nType, sUserNotes) ;
|
||||
// Carico generatore disegno utensile
|
||||
@@ -667,6 +669,8 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
|
||||
bool bOk = ExeLuaSetGlobIntVar( "TOOL.TYPE", nType) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.SPEED", dSpeed) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.TIPFEED", dTipFeed) ;
|
||||
bOk = bOk && ExeLuaSetGlobStringVar( "TOOL.USERNOTES", sUserNotes) ;
|
||||
bOk = bOk && ExeLuaSetGlobStringVar( "TOOL.SYSNOTES", sSysNotes) ;
|
||||
switch ( nType) {
|
||||
case TT_DRILL_STD :
|
||||
case TT_DRILL_LONG :
|
||||
@@ -711,6 +715,15 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.THICK", dThick) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.CORNRAD", dCornRad) ;
|
||||
break ;
|
||||
case TT_PROBE :
|
||||
bOk = bOk && ExeLuaSetGlobStringVar( "TOOL.TOOLHOLDER", sThPath) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.TOTLEN", dTotLen) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.LEN", dLen) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIAM", dDiam) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.STEMDIAM", dStemDiam) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.HEIGHT", dThick) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.CORNRAD", dCornRad) ;
|
||||
break ;
|
||||
default :
|
||||
return TD_INT_ERR ;
|
||||
}
|
||||
@@ -721,7 +734,7 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
|
||||
if ( ! ExeLuaGetGlobIntVar( "TOOL.ERR", &nErr) || nErr != 0)
|
||||
return nErr ;
|
||||
// Se per salvataggio
|
||||
if ( bOk && bToSave) {
|
||||
if ( bOk && bToSave) {
|
||||
// Nascondo layer ausiliario
|
||||
int nAuxId = ExeGetFirstNameInGroup( ExeGetFirstGroupInGroup( GDB_ID_ROOT), "AUX") ;
|
||||
ExeSetStatus( { nAuxId}, GDB_ST_OFF) ;
|
||||
@@ -731,6 +744,16 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
|
||||
ExeRotate( { nPartId}, ORIG, Z_AX, -90, RTY_GLOB) ;
|
||||
}
|
||||
}
|
||||
// altrimenti per visualizzazione
|
||||
else if ( bOk) {
|
||||
// Nascondo oggetto/i Carter
|
||||
int nSolidId = ExeGetFirstNameInGroup( ExeGetFirstGroupInGroup( GDB_ID_ROOT), "SOLID") ;
|
||||
int nCarterId = ExeGetFirstNameInGroup( nSolidId, "Carter") ;
|
||||
while ( nCarterId != GDB_ID_NULL) {
|
||||
ExeSetStatus( { nCarterId}, GDB_ST_OFF) ;
|
||||
nCarterId = ExeGetNextName( nCarterId, "Carter") ;
|
||||
}
|
||||
}
|
||||
return ( bOk ? 0 : TD_INT_ERR) ;
|
||||
}
|
||||
|
||||
@@ -750,6 +773,10 @@ MachMgr::UpdateCustomToolDraw( const ToolData* pTdata, int nGenCtx, int nToolCtx
|
||||
pTdata->GetParam( TPA_DIAM, dDiam) ;
|
||||
double dDist = 0 ;
|
||||
pTdata->GetParam( TPA_DIST, dDist) ;
|
||||
double dSpeed = 0 ;
|
||||
pTdata->GetParam( TPA_SPEED, dSpeed) ;
|
||||
string sUserNotes ;
|
||||
pTdata->GetParam( TPA_USERNOTES, sUserNotes) ;
|
||||
// Imposto contesto per il disegno utensile
|
||||
if ( ! ExeSetCurrentContext( nToolCtx))
|
||||
return TD_INT_ERR ;
|
||||
@@ -759,6 +786,8 @@ MachMgr::UpdateCustomToolDraw( const ToolData* pTdata, int nGenCtx, int nToolCtx
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.LEN", dLen) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIAM", dDiam) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIST", dDist) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.SPEED", dSpeed) ;
|
||||
bOk = bOk && ExeLuaSetGlobStringVar( "TOOL.USERNOTES", sUserNotes) ;
|
||||
// Eseguo aggiornamento utensile
|
||||
bOk = bOk && ExeLuaCallFunction( "AdjustCustomTool") ;
|
||||
// Recupero errore
|
||||
@@ -791,6 +820,8 @@ MachMgr::GetToolMakerKeyFromType( int nType) const
|
||||
return WATERJETMAKER_KEY ;
|
||||
case TT_COMPO :
|
||||
return "" ;
|
||||
case TT_PROBE :
|
||||
return PROBEMAKER_KEY ;
|
||||
}
|
||||
return "" ;
|
||||
}
|
||||
@@ -832,6 +863,10 @@ MachMgr::GetToolHolderPath( const string& sHeadName, int nExit, int nType, const
|
||||
string sKey2 = sKey + ":MILL_POLISHING" ;
|
||||
sToolHolder = GetPrivateProfileStringUtf8( TOOLHOLDER_SEC.c_str(), sKey2.c_str(), "", sMachIni.c_str()) ;
|
||||
}
|
||||
else if ( nType == TT_PROBE) {
|
||||
string sKey2 = sKey + ":PROBE" ;
|
||||
sToolHolder = GetPrivateProfileStringUtf8( TOOLHOLDER_SEC.c_str(), sKey2.c_str(), "", sMachIni.c_str()) ;
|
||||
}
|
||||
if ( sToolHolder.empty())
|
||||
sToolHolder = GetPrivateProfileStringUtf8( TOOLHOLDER_SEC.c_str(), sKey.c_str(), "", sMachIni.c_str()) ;
|
||||
// Se non trovato, provo da sezione Tools di Ini di macchina
|
||||
|
||||
+75
-4
@@ -135,6 +135,52 @@ MachMgr::ShowOnlyTable( bool bVal)
|
||||
return pMch->SetLook( bVal ? MCH_LOOK_TAB : MCH_LOOK_ALL) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::MoveDispAxis( const string& sName, double dPos)
|
||||
{
|
||||
// recupero l'oggetto disposizione corrente
|
||||
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( m_nCurrDispId)) ;
|
||||
if ( pDisp == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
// eseguo l'operazione
|
||||
return pDisp->MoveAxis( sName, dPos) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::RemoveDispAxis( const string& sName)
|
||||
{
|
||||
// recupero l'oggetto disposizione corrente
|
||||
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( m_nCurrDispId)) ;
|
||||
if ( pDisp == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
// eseguo l'operazione
|
||||
return pDisp->RemoveAxis( sName) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::KeepAllDispAxes( int nSouPhase)
|
||||
{
|
||||
// se fase di origine non definita o uguale alla corrente, esco con successo
|
||||
if ( nSouPhase == 0 || nSouPhase == m_nCurrPhase)
|
||||
return true ;
|
||||
// copio il posizionamento
|
||||
Disposition* pSouDisp = GetDisposition( m_pGeomDB->GetUserObj( GetPhaseDisposition( nSouPhase))) ;
|
||||
Disposition* pDisp = GetDisposition( m_pGeomDB->GetUserObj( GetPhaseDisposition( m_nCurrPhase))) ;
|
||||
if ( pSouDisp == nullptr || pDisp == nullptr)
|
||||
return false ;
|
||||
for ( int i = 0 ; ; ++ i) {
|
||||
string sName ; double dPos ;
|
||||
if ( pSouDisp->GetMoveAxisData( i, sName, dPos))
|
||||
pDisp->MoveAxis( sName, dPos) ;
|
||||
else
|
||||
break ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::AddFixture( const string& sName, const Point3d& ptPos, double dAngRotDeg, double dMov)
|
||||
@@ -158,8 +204,8 @@ MachMgr::KeepFixture( int nFxtId, int nSouPhase)
|
||||
// se fase corrente già presente, non devo fare alcunché
|
||||
if ( find( vPhase.begin(), vPhase.end(), m_nCurrPhase) != vPhase.end())
|
||||
return true ;
|
||||
// se fase di origine non definita, esco con successo
|
||||
if ( nSouPhase == 0)
|
||||
// se fase di origine non definita o uguale alla corrente, esco con successo
|
||||
if ( nSouPhase == 0 || nSouPhase == m_nCurrPhase)
|
||||
return true ;
|
||||
// copio il posizionamento
|
||||
Disposition* pSouDisp = GetDisposition( m_pGeomDB->GetUserObj( GetPhaseDisposition( nSouPhase))) ;
|
||||
@@ -167,10 +213,11 @@ MachMgr::KeepFixture( int nFxtId, int nSouPhase)
|
||||
if ( pSouDisp == nullptr || pDisp == nullptr)
|
||||
return false ;
|
||||
for ( int i = 0 ; ; ++ i) {
|
||||
string sName ; int nId ; Point3d ptPos ; double dAngDeg ; double dMov ;
|
||||
if ( pSouDisp->GetFixtureData( i, sName, nId, ptPos, dAngDeg, dMov)) {
|
||||
string sName ; int nId ; Point3d ptPos ; double dAngDeg ; double dMov ; string sTaLink ;
|
||||
if ( pSouDisp->GetFixtureData( i, sName, nId, ptPos, dAngDeg, dMov, sTaLink)) {
|
||||
if ( nId == nFxtId) {
|
||||
pDisp->AddFixture( sName, nId, ptPos, dAngDeg, dMov) ;
|
||||
pDisp->SetFixtureLink( nId, sTaLink) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
@@ -254,6 +301,18 @@ MachMgr::RotateFixture( int nId, double dDeltaAngDeg)
|
||||
return pDisp->RotateFixture( nId, dDeltaAngDeg) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::SetFixtureLink( int nId, const string& sTaLink)
|
||||
{
|
||||
// recupero l'oggetto disposizione corrente
|
||||
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( m_nCurrDispId)) ;
|
||||
if ( pDisp == nullptr)
|
||||
return false ;
|
||||
// eseguo l'operazione
|
||||
return pDisp->SetFixtureLink( nId, sTaLink) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::MoveFixtureMobile( int nId, double dDeltaMov)
|
||||
@@ -266,6 +325,18 @@ MachMgr::MoveFixtureMobile( int nId, double dDeltaMov)
|
||||
return pDisp->MoveFixtureMobile( nId, dDeltaMov) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::SetFixtureMobile( int nId, double dMov)
|
||||
{
|
||||
// recupero l'oggetto disposizione corrente
|
||||
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( m_nCurrDispId)) ;
|
||||
if ( pDisp == nullptr)
|
||||
return false ;
|
||||
// eseguo l'operazione
|
||||
return pDisp->SetFixtureMobile( nId, dMov) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::VerifyFixtureInGroup( int nFxtId, bool bLinkedAllowed) const
|
||||
|
||||
+10
-2
@@ -18,6 +18,7 @@
|
||||
#include "MachConst.h"
|
||||
#include "Generator.h"
|
||||
#include "Estimator.h"
|
||||
#include "/EgtDev/Include/EGnFileUtils.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -25,6 +26,13 @@ using namespace std ;
|
||||
bool
|
||||
MachMgr::Generate( const string& sCncFile, const string& sInfo)
|
||||
{
|
||||
// se macchina multiprocesso è necessaria stima speciale
|
||||
if ( GetCurrMachine() != nullptr && GetCurrMachine()->GetMultiProcess()) {
|
||||
string sEstFile = ChangeFileExtension( sCncFile, "sest") ;
|
||||
if ( ! Estimate( sEstFile, sInfo))
|
||||
return false ;
|
||||
}
|
||||
|
||||
// inizializzazione generatore
|
||||
Generator genPP ;
|
||||
if ( ! genPP.Init( this)) {
|
||||
@@ -44,13 +52,13 @@ MachMgr::Generate( const string& sCncFile, const string& sInfo)
|
||||
bool
|
||||
MachMgr::Estimate( const string& sEstFile, const string& sInfo)
|
||||
{
|
||||
// inizializzazione generatore
|
||||
// inizializzazione stimatore
|
||||
Estimator estPP ;
|
||||
if ( ! estPP.Init( this)) {
|
||||
LOG_ERROR( GetEMkLogger(), "Error on Estimate Init")
|
||||
return false ;
|
||||
}
|
||||
// esecuzione della generazione
|
||||
// esecuzione della stima
|
||||
if ( ! estPP.Run( sEstFile, sInfo)) {
|
||||
LOG_ERROR( GetEMkLogger(), "Error on Estimate Run")
|
||||
return false ;
|
||||
|
||||
+83
-22
@@ -182,6 +182,52 @@ MachMgr::AddMachGroup( const string& sName, const string& sMachineName)
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::CopyMachGroup( const string& sSouName, const string& sName)
|
||||
{
|
||||
// recupero il gruppo sorgente
|
||||
int nSouMGrpId = GetMachGroupId( sSouName) ;
|
||||
if ( nSouMGrpId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
// verifico esista la sua macchina
|
||||
string sMachineName ;
|
||||
m_pGeomDB->GetInfo( nSouMGrpId, MACH_MACHINE_KEY, sMachineName) ;
|
||||
if ( sMachineName.empty() || ! LoadMachine( sMachineName))
|
||||
return GDB_ID_NULL ;
|
||||
// verifico nome nuovo gruppo (non deve essere vuoto e non deve esserci già un gruppo con questo nome)
|
||||
if ( &sName == nullptr || sName.empty() || GetMachGroupId( sName) != GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
// reset gruppo corrente
|
||||
ResetCurrMachGroup() ;
|
||||
// eseguo la copia del gruppo sorgente e la metto in coda
|
||||
int nNewMGrpId = m_pGeomDB->Copy( nSouMGrpId, GDB_ID_NULL, m_nMachBaseId) ;
|
||||
if ( nNewMGrpId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
// assegno il nome
|
||||
m_pGeomDB->SetName( nNewMGrpId, sName) ;
|
||||
// converto opportunamente gli indicativi dei grezzi nelle disposizioni
|
||||
int nSouRawPartId = m_pGeomDB->GetFirstGroupInGroup( m_pGeomDB->GetFirstNameInGroup( nSouMGrpId, MACH_RAW_GROUP)) ;
|
||||
int nNewRawPartId = m_pGeomDB->GetFirstGroupInGroup( m_pGeomDB->GetFirstNameInGroup( nNewMGrpId, MACH_RAW_GROUP)) ;
|
||||
while ( nSouRawPartId != GDB_ID_NULL && nNewRawPartId != GDB_ID_NULL) {
|
||||
// ciclo sulle disposizioni del nuovo gruppo di lavoro
|
||||
int nOperId = m_pGeomDB->GetFirstGroupInGroup( m_pGeomDB->GetFirstNameInGroup( nNewMGrpId, MACH_OPER_GROUP)) ;
|
||||
while ( nOperId != GDB_ID_NULL) {
|
||||
Disposition* pDisp = GetDisposition( m_pGeomDB->GetUserObj( nOperId)) ;
|
||||
if ( pDisp != nullptr)
|
||||
pDisp->UpdateRawPartId( nSouRawPartId, nNewRawPartId) ;
|
||||
nOperId = m_pGeomDB->GetNextGroup( nOperId) ;
|
||||
}
|
||||
// passo alla coppia successiva
|
||||
nSouRawPartId = m_pGeomDB->GetNextGroup( nSouRawPartId) ;
|
||||
nNewRawPartId = m_pGeomDB->GetNextGroup( nNewRawPartId) ;
|
||||
}
|
||||
// lo rendo corrente
|
||||
SetCurrMachGroup( nNewMGrpId) ;
|
||||
// restituisco l'identificativo del gruppo
|
||||
return nNewMGrpId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::RemoveMachGroup( int nId)
|
||||
@@ -222,44 +268,60 @@ MachMgr::VerifyMachGroup( int nId, MachGrp& mgData) const
|
||||
// verifica della macchina
|
||||
bool bMName = m_pGeomDB->GetInfo( nId, MACH_MACHINE_KEY, mgData.MGeoName) ;
|
||||
// scansiono i sottogruppi
|
||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ;
|
||||
if ( IsNull( pIter))
|
||||
return false ;
|
||||
bool bSetup = false ;
|
||||
bool bFixt = false ;
|
||||
bool bRaw = false ;
|
||||
bool bOper = false ;
|
||||
bool bIter = pIter->GoToFirstGroupInGroup( nId) ;
|
||||
while ( bIter) {
|
||||
int nGrpId = m_pGeomDB->GetFirstGroupInGroup( nId) ;
|
||||
while ( nGrpId != GDB_ID_NULL) {
|
||||
string sName ;
|
||||
if ( pIter->GetName( sName)) {
|
||||
if ( m_pGeomDB->GetName( nGrpId, sName)) {
|
||||
if ( sName == MACH_SETUP_GROUP) {
|
||||
if ( ! bSetup)
|
||||
mgData.SetupGroupId = pIter->GetId() ;
|
||||
mgData.SetupGroupId = nGrpId ;
|
||||
bSetup = true ;
|
||||
}
|
||||
else if ( sName == MACH_FIXT_GROUP) {
|
||||
if ( ! bFixt)
|
||||
mgData.FixtGroupId = pIter->GetId() ;
|
||||
mgData.FixtGroupId = nGrpId ;
|
||||
bFixt = true ;
|
||||
}
|
||||
else if ( sName == MACH_RAW_GROUP) {
|
||||
if ( ! bRaw)
|
||||
mgData.RawGroupId = pIter->GetId() ;
|
||||
mgData.RawGroupId = nGrpId ;
|
||||
bRaw = true ;
|
||||
}
|
||||
else if ( sName == MACH_OPER_GROUP) {
|
||||
if ( ! bOper)
|
||||
mgData.OperGroupId = pIter->GetId() ;
|
||||
mgData.OperGroupId = nGrpId ;
|
||||
bOper = true ;
|
||||
}
|
||||
}
|
||||
// passo al successivo
|
||||
bIter = pIter->GoToNextGroup() ;
|
||||
nGrpId = m_pGeomDB->GetNextGroup( nGrpId) ;
|
||||
}
|
||||
return ( bMName && bSetup && bRaw && bOper) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::ChangeMachGroupName( int nId, const string& sNewName)
|
||||
{
|
||||
// verifica del gruppo base per le lavorazioni
|
||||
if ( ! VerifyMachBase())
|
||||
return false ;
|
||||
// verifico che il gruppo ricevuto sia corretto
|
||||
if ( m_pGeomDB->GetParentId( nId) != m_nMachBaseId)
|
||||
return false ;
|
||||
// verifico nome non vuoto e non esista già un gruppo con lo stesso nome
|
||||
if ( &sNewName == nullptr || sNewName.empty() || GetMachGroupId( sNewName) != GDB_ID_NULL)
|
||||
return false ;
|
||||
// cambio il nome del gruppo di lavoro
|
||||
if ( ! m_pGeomDB->SetName( nId, sNewName))
|
||||
return false ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
string
|
||||
MachMgr::GetMachGroupName( int nId) const
|
||||
@@ -298,22 +360,19 @@ MachMgr::GetMachGroupId( const string& sName) const
|
||||
{
|
||||
// verifica dei parametri
|
||||
if ( &sName == nullptr || sName.empty())
|
||||
return false ;
|
||||
return GDB_ID_NULL ;
|
||||
// verifica del gruppo base per le lavorazioni
|
||||
if ( ! VerifyMachBase())
|
||||
return false ;
|
||||
return GDB_ID_NULL ;
|
||||
// recupero l'identificativo del gruppo con il nome indicato
|
||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ;
|
||||
if ( IsNull( pIter))
|
||||
return false ;
|
||||
bool bIter = pIter->GoToFirstGroupInGroup( m_nMachBaseId) ;
|
||||
while( bIter) {
|
||||
int nGrpId = m_pGeomDB->GetFirstGroupInGroup( m_nMachBaseId) ;
|
||||
while ( nGrpId != GDB_ID_NULL) {
|
||||
// verifico il nome
|
||||
string sMGroupName ;
|
||||
if ( pIter->GetName( sMGroupName) && EqualNoCase( sMGroupName, sName))
|
||||
return pIter->GetId() ;
|
||||
if ( m_pGeomDB->GetName( nGrpId, sMGroupName) && EqualNoCase( sMGroupName, sName))
|
||||
return nGrpId ;
|
||||
// passo al successivo
|
||||
bIter = pIter->GoToNextGroup() ;
|
||||
nGrpId = m_pGeomDB->GetNextGroup( nGrpId) ;
|
||||
}
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
@@ -328,8 +387,10 @@ MachMgr::SetCurrMachGroup( int nId)
|
||||
// aggiorno attrezzaggio attivo
|
||||
UpdateCurrSetup() ;
|
||||
// imposto la prima fase come corrente
|
||||
if ( ! SetCurrPhase( 1))
|
||||
if ( ! SetCurrPhase( 1)) {
|
||||
ResetCurrMachGroup() ;
|
||||
return false ;
|
||||
}
|
||||
// nascondo i pezzi rimasti sotto la radice
|
||||
ShowRootParts( false) ;
|
||||
// rendo visibile il nuovo gruppo corrente e la relativa macchina
|
||||
|
||||
+136
-28
@@ -210,8 +210,8 @@ MachMgr::GetCurrMachiningsMgr( void) const
|
||||
// se DB lavorazioni non esiste, provo a crearlo e caricarlo
|
||||
if ( m_vMachines[m_nCurrMch].pMsMgr == nullptr) {
|
||||
PtrOwner<MachiningsMgr> pMsMgr( new( nothrow) MachiningsMgr) ;
|
||||
string sMachsFile = m_vMachines[m_nCurrMch].sDir + "\\" + MACHININGS_DIR + "\\" + MACHININGS_FILE ;
|
||||
if ( IsNull( pMsMgr) || ! pMsMgr->Load( sMachsFile, GetCurrToolsMgr()))
|
||||
string sMachsDir = m_vMachines[m_nCurrMch].sDir + "\\" + MACHININGS_DIR ;
|
||||
if ( IsNull( pMsMgr) || ! pMsMgr->Load( sMachsDir, MACHININGS_FILE, GetCurrToolsMgr()))
|
||||
return nullptr ;
|
||||
// salvo nel vettore
|
||||
const_cast<MachineData&>( m_vMachines[m_nCurrMch]).pMsMgr = Release( pMsMgr) ;
|
||||
@@ -274,6 +274,15 @@ MachMgr::GetHeadExitCount( const string& sHead) const
|
||||
return ( ( pMch != nullptr) ? pMch->GetHeadExitCount( sHead) : 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::GetExitId( const string& sHead, int nExit) const
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
// recupero identificativo dell'uscita della testa indicata nella macchina corrente
|
||||
return ( ( pMch != nullptr) ? pMch->GetExitId( sHead, nExit) : GDB_ID_NULL) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::GetTcPosId( const string& sTcPos) const
|
||||
@@ -294,18 +303,6 @@ MachMgr::GetHeadAbove( const string& sHead) const
|
||||
return ( ! m_pGeomDB->GetInfo( GetHeadId( sHead), MCH_ABOVE, bAbove) || bAbove) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
double
|
||||
MachMgr::GetDeltaSafeZ( const string& sHead) const
|
||||
{
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return 0 ;
|
||||
// Leggo da testa Info ZSAFEDELTA
|
||||
double dDeltaSafeZ = 0 ;
|
||||
m_pGeomDB->GetInfo( GetHeadId( sHead), MCH_ZSAFEDELTA, dDeltaSafeZ) ;
|
||||
return dDeltaSafeZ ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
double
|
||||
MachMgr::GetAngDeltaMinForHome( void) const
|
||||
@@ -333,6 +330,15 @@ MachMgr::GetAxisType( const string& sAxis, bool& bLinear) const
|
||||
return ( ( pMch != nullptr) ? pMch->GetAxisType( sAxis, bLinear) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetAxisDir( const string& sAxis, Vector3d& vtDir) const
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
// restituisco la direzione dell'asse indicato nella macchina corrente
|
||||
return ( ( pMch != nullptr) ? pMch->GetAxisDir( sAxis, vtDir) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetAxisInvert( const string& sAxis, bool& bInvert) const
|
||||
@@ -356,7 +362,7 @@ bool
|
||||
MachMgr::SetAxisPos( const string& sAxis, double dVal, double* pdNewVal)
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->SetAxisPos( sAxis, dVal, pdNewVal) : false) ;
|
||||
return ( ( pMch != nullptr) ? pMch->SetAxisPos( sAxis, dVal, true, pdNewVal) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -401,10 +407,25 @@ MachMgr::ResetAxisPos( const string& sAxis)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::ResetAllAxesPos( void)
|
||||
MachMgr::IsDispositionAxis( const string& sAxis, const string& sTable) const
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->ResetAllAxesPos() : false) ;
|
||||
return ( ( pMch != nullptr) ? pMch->IsDispositionAxis( sAxis, sTable) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::ResetAllAxesPos( void)
|
||||
{
|
||||
return ResetAllAxesPos( true, false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::ResetAllAxesPos( bool bStdAxes, bool bDispAxes)
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->ResetAllAxesPos( bStdAxes, bDispAxes) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -534,6 +555,25 @@ MachMgr::SetCalcSolCh( int nScc, bool bExact)
|
||||
return pMch->SetSolCh( nScc, bExact) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetCalcSolCh( int& nScc, bool& bExact) const
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
// recupero il criterio di scelta della soluzione
|
||||
return pMch->GetSolCh( nScc, bExact) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetCalcTable( string& sTable) const
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetCurrTable( sTable) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetCalcTool( string& sTool) const
|
||||
@@ -595,7 +635,7 @@ bool
|
||||
MachMgr::GetCalcMaxDeltaR2OnFirst( void) const
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetCurrMaxDeltaR2OnFirst() : true) ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetCurrCalcMaxDeltaR2OnFirst() : true) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -609,6 +649,17 @@ MachMgr::GetAllTablesNames( STRVECTOR& vNames) const
|
||||
return ( ( pMch != nullptr) ? pMch->GetAllTablesNames( vNames) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetAllAxesNames( STRVECTOR& vNames) const
|
||||
{
|
||||
// pulisco il vettore
|
||||
vNames.clear() ;
|
||||
// richiedo elenco assi alla macchina corrente
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetAllAxesNames( vNames) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetAllHeadsNames( STRVECTOR& vNames) const
|
||||
@@ -649,10 +700,10 @@ MachMgr::GetCurrRotAxes( void) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetAllCurrAxesName( STRVECTOR& vAxName) const
|
||||
MachMgr::GetAllCurrAxesNames( STRVECTOR& vAxName) const
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetAllCurrAxesName( vAxName) : false) ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetAllCurrAxesNames( vAxName) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -671,6 +722,22 @@ MachMgr::GetCurrAxisHomePos( int nInd, double& dHome) const
|
||||
return ( ( pMch != nullptr) ? pMch->GetCurrAxisHomePos( nInd, dHome) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetCurrAxisMax( int nInd, double& dMax) const
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetCurrAxisMax( nInd, dMax) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetCurrAxisMin( int nInd, double& dMin) const
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetCurrAxisMin( nInd, dMin) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const Frame3d&
|
||||
MachMgr::GetCurrLinAxesFrame( void) const
|
||||
@@ -683,13 +750,44 @@ MachMgr::GetCurrLinAxesFrame( void) const
|
||||
return pMch->GetCurrLinAxesFrame() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetCurrIsMcent( void) const
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
return ( pMch->GetCurrKinematicChainType() == KIN_CHAIN_MCENT) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetCurrIsRobot( void) const
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
return ( pMch->GetCurrKinematicChainType() == KIN_CHAIN_ROBOT) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetAngles( vtDirT, vtDirA, nStat, dAngA1, dAngB1, dAngA2, dAngB2) : false) ;
|
||||
nStat = 0 ; dAngA1 = 0 ; dAngB1 = 0 ; dAngA2 = 0 ; dAngB2 = 0 ;
|
||||
DBLVECTOR vAng1, vAng2 ;
|
||||
if ( ! GetCalcAngles( vtDirT, vtDirA, nStat, vAng1, vAng2))
|
||||
return false ;
|
||||
if ( vAng1.size() >= 1) {
|
||||
dAngA1 = vAng1[0] ;
|
||||
dAngA2 = vAng2[0] ;
|
||||
if ( vAng1.size() >= 2) {
|
||||
dAngB1 = vAng1[1] ;
|
||||
dAngB2 = vAng2[1] ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -697,6 +795,7 @@ bool
|
||||
MachMgr::GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
int& nStat, DBLVECTOR& vAng1, DBLVECTOR& vAng2) const
|
||||
{
|
||||
const_cast<MachMgr*>(this)->ApplyRotAxisBlock() ;
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetAngles( vtDirT, vtDirA, nStat, vAng1, vAng2) : false) ;
|
||||
}
|
||||
@@ -704,20 +803,29 @@ MachMgr::GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetCalcPositions( const Point3d& ptP, double dAngA, double dAngB,
|
||||
int& nStat, double& dX, double& dY, double& dZ) const
|
||||
double& dX, double& dY, double& dZ) const
|
||||
{
|
||||
DBLVECTOR vAng( 2) ; vAng[0] = dAngA ; vAng[1] = dAngB ;
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetPositions( ptP, vAng, nStat, dX, dY, dZ) : false) ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetPositions( ptP, vAng, dX, dY, dZ) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetCalcPositions( const Point3d& ptP, const DBLVECTOR& vAng,
|
||||
int& nStat, double& dX, double& dY, double& dZ) const
|
||||
double& dX, double& dY, double& dZ) const
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetPositions( ptP, vAng, nStat, dX, dY, dZ) : false) ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetPositions( ptP, vAng, dX, dY, dZ) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
DBLVECTOR& vAng1, DBLVECTOR& vAng2) const
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetRobotAngles( ptP, vtDirT, vtDirA, vAng1, vAng2) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -727,7 +835,7 @@ MachMgr::GetCalcTipFromPositions( double dX, double dY, double dZ, double dAngA,
|
||||
{
|
||||
DBLVECTOR vAng( 2) ; vAng[0] = dAngA ; vAng[1] = dAngB ;
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetTipFromPositions( dX, dY, dZ, vAng, bOverall, bBottom, ptTip) : false) ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetTipFromPositions( dX, dY, dZ, vAng, bOverall, bBottom, false, ptTip) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -736,7 +844,7 @@ MachMgr::GetCalcTipFromPositions( double dX, double dY, double dZ, const DBLVECT
|
||||
bool bOverall, bool bBottom, Point3d& ptTip) const
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetTipFromPositions( dX, dY, dZ, vAng, bOverall, bBottom, ptTip) : false) ;
|
||||
return ( ( pMch != nullptr) ? pMch->GetTipFromPositions( dX, dY, dZ, vAng, bOverall, bBottom, false, ptTip) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+120
-23
@@ -100,48 +100,52 @@ MachMgr::GetPrevOperation( int nId) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::GetFirstActiveOperation( void) const
|
||||
MachMgr::GetFirstActiveOperation( bool bNeedMachNotEmpty) const
|
||||
{
|
||||
int nId = GetFirstOperation() ;
|
||||
int nMode ;
|
||||
while ( nId != GDB_ID_NULL &&
|
||||
m_pGeomDB->GetCalcMode( nId, nMode) && nMode == GDB_MD_HIDDEN)
|
||||
(( m_pGeomDB->GetCalcMode( nId, nMode) && nMode == GDB_MD_HIDDEN) ||
|
||||
( bNeedMachNotEmpty && IsValidMachiningType( GetOperationType( nId)) && IsOperationEmpty( nId, NEED_ONE_TP_OK))))
|
||||
nId = GetNextOperation( nId) ;
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::GetNextActiveOperation( int nId) const
|
||||
MachMgr::GetNextActiveOperation( int nId, bool bNeedMachNotEmpty) const
|
||||
{
|
||||
int nNextId = GetNextOperation( nId) ;
|
||||
int nMode ;
|
||||
while ( nNextId != GDB_ID_NULL &&
|
||||
m_pGeomDB->GetCalcMode( nNextId, nMode) && nMode == GDB_MD_HIDDEN)
|
||||
(( m_pGeomDB->GetCalcMode( nNextId, nMode) && nMode == GDB_MD_HIDDEN) ||
|
||||
( bNeedMachNotEmpty && IsValidMachiningType( GetOperationType( nNextId)) && IsOperationEmpty( nNextId, NEED_ONE_TP_OK))))
|
||||
nNextId = GetNextOperation( nNextId) ;
|
||||
return nNextId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::GetLastActiveOperation( void) const
|
||||
MachMgr::GetLastActiveOperation( bool bNeedMachNotEmpty) const
|
||||
{
|
||||
int nId = GetLastOperation() ;
|
||||
int nMode ;
|
||||
while ( nId != GDB_ID_NULL &&
|
||||
m_pGeomDB->GetCalcMode( nId, nMode) && nMode == GDB_MD_HIDDEN)
|
||||
(( m_pGeomDB->GetCalcMode( nId, nMode) && nMode == GDB_MD_HIDDEN) ||
|
||||
( bNeedMachNotEmpty && IsValidMachiningType( GetOperationType( nId)) && IsOperationEmpty( nId, NEED_ONE_TP_OK))))
|
||||
nId = GetPrevOperation( nId) ;
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::GetPrevActiveOperation( int nId) const
|
||||
MachMgr::GetPrevActiveOperation( int nId, bool bNeedMachNotEmpty) const
|
||||
{
|
||||
int nPrevId = GetPrevOperation( nId) ;
|
||||
int nMode ;
|
||||
while ( nPrevId != GDB_ID_NULL &&
|
||||
m_pGeomDB->GetCalcMode( nPrevId, nMode) && nMode == GDB_MD_HIDDEN)
|
||||
(( m_pGeomDB->GetCalcMode( nPrevId, nMode) && nMode == GDB_MD_HIDDEN) ||
|
||||
( bNeedMachNotEmpty && IsValidMachiningType( GetOperationType( nPrevId)) && IsOperationEmpty( nPrevId, NEED_ONE_TP_OK))))
|
||||
nPrevId = GetPrevOperation( nPrevId) ;
|
||||
return nPrevId ;
|
||||
}
|
||||
@@ -180,14 +184,11 @@ MachMgr::GetOperationPhase( int nId) const
|
||||
bool
|
||||
MachMgr::GetOperationNewName( string& sName) const
|
||||
{
|
||||
// il parametro nome deve essere valido
|
||||
if ( &sName == nullptr)
|
||||
return false ;
|
||||
// il gruppo per le operazioni deve essere presente nella macchinata corrente
|
||||
if ( GetCurrOperId() == GDB_ID_NULL)
|
||||
return false ;
|
||||
// se nome vuoto, assegno radice standard
|
||||
if ( sName.empty())
|
||||
if ( ! IsValidVal( sName))
|
||||
sName = "Oper" ;
|
||||
// se presenti caratteri vietati, li sostituisco
|
||||
ValidateVal( sName) ;
|
||||
@@ -214,6 +215,9 @@ MachMgr::SetOperationName( int nId, const string& sName)
|
||||
// verifico che faccia parte del gruppo delle operazioni
|
||||
if ( pIter->GetParentId() != GetCurrOperId())
|
||||
return false ;
|
||||
// verifico che il nome sia valido
|
||||
if ( ! IsValidVal( sName))
|
||||
return false ;
|
||||
// verifico che il nome non sia già usato da una operazione
|
||||
if ( GetOperationId( sName) != GDB_ID_NULL)
|
||||
return false ;
|
||||
@@ -228,10 +232,10 @@ MachMgr::GetOperationName( int nId) const
|
||||
// recupero l'operazione
|
||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ;
|
||||
if ( IsNull( pIter) || ! pIter->GoTo( nId))
|
||||
return 0 ;
|
||||
return "" ;
|
||||
// verifico che faccia parte del gruppo delle operazioni
|
||||
if ( pIter->GetParentId() != GetCurrOperId())
|
||||
return 0 ;
|
||||
return "" ;
|
||||
// recupero il nome dell'operazione riferita
|
||||
string sName ;
|
||||
pIter->GetName( sName) ;
|
||||
@@ -243,12 +247,12 @@ int
|
||||
MachMgr::GetOperationId( const string& sName) const
|
||||
{
|
||||
// verifica dei parametri
|
||||
if ( &sName == nullptr || sName.empty())
|
||||
return false ;
|
||||
if ( ! IsValidVal( sName))
|
||||
return GDB_ID_NULL ;
|
||||
// recupero l'identificativo dell'operazione con il nome indicato
|
||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ;
|
||||
if ( IsNull( pIter))
|
||||
return false ;
|
||||
return GDB_ID_NULL ;
|
||||
bool bIter = pIter->GoToFirstInGroup( GetCurrOperId()) ;
|
||||
while ( bIter) {
|
||||
// verifico il nome
|
||||
@@ -263,7 +267,7 @@ MachMgr::GetOperationId( const string& sName) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::IsOperationEmpty( int nId) const
|
||||
MachMgr::IsOperationEmpty( int nId, int nEmptyType) const
|
||||
{
|
||||
// verifiche
|
||||
if ( m_pGeomDB == nullptr || m_pGeomDB->GetParentId( nId) != GetCurrOperId())
|
||||
@@ -273,7 +277,7 @@ MachMgr::IsOperationEmpty( int nId) const
|
||||
if ( pOpe == nullptr)
|
||||
return true ;
|
||||
// restituisco se vuota
|
||||
return pOpe->IsEmpty() ;
|
||||
return pOpe->IsEmpty( nEmptyType) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -601,6 +605,7 @@ MachMgr::AddDisposition( const string& sName)
|
||||
m_pGeomDB->SetUserObj( nId, pDisp) ;
|
||||
pDisp->Init( this) ;
|
||||
pDisp->SetPhase( m_nCurrPhase) ;
|
||||
ResetAllAxesPos( false, true) ;
|
||||
return nId ;
|
||||
}
|
||||
|
||||
@@ -672,6 +677,18 @@ MachMgr::DispositionSpecialUpdate( int nId)
|
||||
return pDisp->SpecialUpdate() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetDispositionToolData( int nId, string& sName, string& sHead, int& nExit, string& sTcPos)
|
||||
{
|
||||
// recupero la disposizione
|
||||
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( nId)) ;
|
||||
if ( pDisp == nullptr)
|
||||
return false ;
|
||||
// recupero i dati utensile
|
||||
return pDisp->GetToolData( sName, sHead, nExit, sTcPos) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Machinings
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -1089,6 +1106,22 @@ MachMgr::MachiningUpdate( bool bPostApply)
|
||||
return pMch->Update( bPostApply) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::ChangePreviewMachiningToolShow( int nLookFlag)
|
||||
{
|
||||
// recupero la lavorazione corrente
|
||||
int nCurrMchId = GetCurrMachining() ;
|
||||
if ( nCurrMchId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// ne recupero il gestore
|
||||
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
// eseguo
|
||||
return pMch->ChangeToolPreviewShow( nLookFlag) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::PreparePreviewMachiningTool( void) const
|
||||
@@ -1122,7 +1155,23 @@ MachMgr::RemovePreviewMachiningTool( void) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::PreviewMachiningTool( int nEntId, int nFlag) const
|
||||
MachMgr::GetPreviewMachiningToolStepCount( void) const
|
||||
{
|
||||
// recupero la lavorazione corrente
|
||||
int nCurrMchId = GetCurrMachining() ;
|
||||
if ( nCurrMchId == GDB_ID_NULL)
|
||||
return 0 ;
|
||||
// ne recupero il gestore
|
||||
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
|
||||
if ( pMch == nullptr)
|
||||
return 0 ;
|
||||
// eseguo
|
||||
return pMch->GetToolPreviewStepCount() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::PreviewMachiningTool( int nEntId, int nStep) const
|
||||
{
|
||||
// recupero la lavorazione corrente
|
||||
int nCurrMchId = GetCurrMachining() ;
|
||||
@@ -1133,7 +1182,7 @@ MachMgr::PreviewMachiningTool( int nEntId, int nFlag) const
|
||||
if ( pMch == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
// eseguo
|
||||
return pMch->ToolPreview( nEntId, nFlag) ;
|
||||
return pMch->ToolPreview( nEntId, nStep) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -1234,7 +1283,23 @@ MachMgr::GetMachiningGeometry( SELVECTOR& vIds) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::IsMachiningEmpty( void) const
|
||||
MachMgr::GetMachiningSkippedGeometry( SELVECTOR& vIds) const
|
||||
{
|
||||
// recupero la lavorazione corrente
|
||||
int nCurrMchId = GetCurrMachining() ;
|
||||
if ( nCurrMchId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// ne recupero il gestore
|
||||
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
// restituisco la geometria non lavorata
|
||||
return pMch->GetSkippedGeometry( vIds) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::IsMachiningEmpty( int nEmptyType) const
|
||||
{
|
||||
// recupero la lavorazione corrente
|
||||
int nCurrMchId = GetCurrMachining() ;
|
||||
@@ -1245,7 +1310,7 @@ MachMgr::IsMachiningEmpty( void) const
|
||||
if ( pMch == nullptr)
|
||||
return true ;
|
||||
// restituisco lo stato
|
||||
return pMch->IsEmpty() ;
|
||||
return pMch->IsEmpty( nEmptyType) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -1279,3 +1344,35 @@ MachMgr::GetMachiningEndPoint( Point3d& ptEnd) const
|
||||
// restituisco il punto finale dell'ultimo percorso di lavorazione
|
||||
return pMch->GetEndPoint( ptEnd) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetMachiningStartAxes( bool bSkipClimb, DBLVECTOR& vAxVal) const
|
||||
{
|
||||
// recupero la lavorazione corrente
|
||||
int nCurrMchId = GetCurrMachining() ;
|
||||
if ( nCurrMchId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// ne recupero il gestore
|
||||
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
// recupero i valori
|
||||
return pMch->GetInitialAxesValues( bSkipClimb, true, vAxVal) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetMachiningEndAxes( bool bSkipRise, DBLVECTOR& vAxVal) const
|
||||
{
|
||||
// recupero la lavorazione corrente
|
||||
int nCurrMchId = GetCurrMachining() ;
|
||||
if ( nCurrMchId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// ne recupero il gestore
|
||||
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
// recupero i valori
|
||||
return pMch->GetFinalAxesValues( bSkipRise, true, vAxVal) ;
|
||||
}
|
||||
|
||||
+496
-164
@@ -28,7 +28,10 @@
|
||||
#include "/EgtDev/Include/EGkSfrCreate.h"
|
||||
#include "/EgtDev/Include/EGkStmStandard.h"
|
||||
#include "/EgtDev/Include/EGkStmFromCurves.h"
|
||||
#include "/EgtDev/Include/EGkSurfBezier.h"
|
||||
#include "/EgtDev/Include/EGkCAvSilhouetteSurfTm.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -96,7 +99,7 @@ MachMgr::AddRawPart( const Point3d& ptOrig, double dLen, double dWidth, double d
|
||||
m_pGeomDB->SetInfo( nRawId, MACH_RAW_PHASE, m_nCurrPhase) ;
|
||||
// creo solido e outline
|
||||
bOk = bOk && ModifyRawPart( nRawId, ptOrig, dLen, dWidth, dHeight, cCol) ;
|
||||
// se qualcosa è andato storto, cancello tutto
|
||||
// se qualcosa è andato storto, cancello tutto
|
||||
if ( ! bOk) {
|
||||
m_pGeomDB->Erase( nRawId) ;
|
||||
return GDB_ID_NULL ;
|
||||
@@ -112,7 +115,7 @@ MachMgr::ModifyRawPart( int nRawId, const Point3d& ptOrig, double dLen, double d
|
||||
// le dimensioni non possono essere nulle
|
||||
if ( dLen < EPS_SMALL || dWidth < EPS_SMALL || dHeight < EPS_SMALL)
|
||||
return false ;
|
||||
// verifica validità grezzo
|
||||
// verifica validità grezzo
|
||||
if ( ! VerifyRawPart( nRawId))
|
||||
return false ;
|
||||
// creo il solido
|
||||
@@ -171,7 +174,7 @@ MachMgr::AddRawPartWithPart( int nPartId, int nCrvSrfId, double dOverMat, Color
|
||||
// verifico il gruppo dei grezzi nella macchinata corrente
|
||||
if ( GetCurrRawGroupId() == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
// verifico che il pezzo non sia già usato nella macchinata corrente
|
||||
// verifico che il pezzo non sia già usato nella macchinata corrente
|
||||
if ( m_pGeomDB->GetParentId( nPartId) != GDB_ID_ROOT)
|
||||
return GDB_ID_NULL ;
|
||||
// recupero il tipo di oggetto per definire il grezzo
|
||||
@@ -180,7 +183,7 @@ MachMgr::AddRawPartWithPart( int nPartId, int nCrvSrfId, double dOverMat, Color
|
||||
Point3d ptRef ;
|
||||
// costruzione del grezzo
|
||||
int nRawId = GDB_ID_NULL ;
|
||||
// se grezzo da superficie (per ora senza possibilità di offset)
|
||||
// se grezzo da superficie (per ora senza possibilità di offset)
|
||||
if ( ( nGtype & GEO_SURF) != 0) {
|
||||
// inserisco il grezzo
|
||||
nRawId = AddRawPart( nCrvSrfId, cCol) ;
|
||||
@@ -283,8 +286,8 @@ MachMgr::AddRawPart( int nCrvId, double dOverMat, double dZmin, double dHeight,
|
||||
// assegno la fase al gruppo
|
||||
m_pGeomDB->SetInfo( nRawId, MACH_RAW_PHASE, m_nCurrPhase) ;
|
||||
// creo solido e outline
|
||||
bOk = bOk && ModifyRawPart( nRawId, nCrvId, dOverMat, dZmin, dHeight, cCol) ;
|
||||
// se qualcosa è andato storto, cancello tutto
|
||||
bOk = bOk && ModifyRawPart( nRawId, nCrvId, dOverMat, dHeight, cCol) ;
|
||||
// se qualcosa è andato storto, cancello tutto
|
||||
if ( ! bOk) {
|
||||
m_pGeomDB->Erase( nRawId) ;
|
||||
return GDB_ID_NULL ;
|
||||
@@ -295,9 +298,9 @@ MachMgr::AddRawPart( int nCrvId, double dOverMat, double dZmin, double dHeight,
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dZmin, double dHeight, Color cCol)
|
||||
MachMgr::ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dHeight, Color cCol)
|
||||
{
|
||||
// verifica validità grezzo
|
||||
// verifica validità grezzo
|
||||
if ( ! VerifyRawPart( nRawId))
|
||||
return false ;
|
||||
// recupero il riferimento della curva
|
||||
@@ -321,7 +324,7 @@ MachMgr::ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dZmin, d
|
||||
// la schiaccio a Z = 0
|
||||
if ( ! pMyCrv->Scale( Frame3d(), 1, 1, 0))
|
||||
return false ;
|
||||
// se non è chiusa, la chiudo
|
||||
// se non è chiusa, la chiudo
|
||||
pMyCrv->Close() ;
|
||||
// la oriento in senso CCW
|
||||
double dAreaXY ;
|
||||
@@ -336,7 +339,7 @@ MachMgr::ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dZmin, d
|
||||
if ( IsNull( pOffsCrv))
|
||||
return false ;
|
||||
// creo il solido
|
||||
PtrOwner<ISurfTriMesh> pStm( GetSurfTriMeshByExtrusion( pOffsCrv, Vector3d(0,0,dHeight), true)) ;
|
||||
PtrOwner<ISurfTriMesh> pStm( GetSurfTriMeshByExtrusion( pOffsCrv, Vector3d( 0, 0, dHeight), true)) ;
|
||||
if ( IsNull( pStm))
|
||||
return false ;
|
||||
// cancello eventuali vecchi solidi e curve di outline
|
||||
@@ -374,12 +377,16 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
|
||||
int nRawGroupId = GetCurrRawGroupId() ;
|
||||
if ( nRawGroupId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
// verifico che la superficie sia chiusa
|
||||
const ISurf* pSurf = GetSurf( m_pGeomDB->GetGeoObj( nSurfId)) ;
|
||||
if ( pSurf == nullptr || ! pSurf->IsClosed())
|
||||
return GDB_ID_NULL ;
|
||||
// recupero l'ingombro della superficie in globale
|
||||
BBox3d b3Crv ;
|
||||
if ( ! m_pGeomDB->GetGlobalBBox( nSurfId, b3Crv))
|
||||
BBox3d b3Surf ;
|
||||
if ( ! m_pGeomDB->GetGlobalBBox( nSurfId, b3Surf))
|
||||
return GDB_ID_NULL ;
|
||||
// inserisco il gruppo del grezzo nella macchinata
|
||||
Frame3d frRaw( b3Crv.GetMin()) ;
|
||||
Frame3d frRaw( b3Surf.GetMin()) ;
|
||||
int nRawId = m_pGeomDB->AddGroup( GDB_ID_NULL, nRawGroupId, frRaw) ;
|
||||
if ( nRawId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
@@ -387,8 +394,23 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
|
||||
bool bOk = m_pGeomDB->SetName( nRawId, MACH_RAW_PART) ;
|
||||
// assegno la fase al gruppo
|
||||
m_pGeomDB->SetInfo( nRawId, MACH_RAW_PHASE, m_nCurrPhase) ;
|
||||
// copio la superficie nel gruppo
|
||||
int nId = m_pGeomDB->CopyGlob( nSurfId, GDB_ID_NULL, nRawId) ;
|
||||
// creo il grezzo
|
||||
int nId = GDB_ID_NULL ;
|
||||
// partendo da superficie Trimesh copio
|
||||
if ( pSurf->GetType() == SRF_TRIMESH)
|
||||
nId = m_pGeomDB->CopyGlob( nSurfId, GDB_ID_NULL, nRawId) ;
|
||||
// partendo da superficie Bezier devo recuperare la Trimesh ausiliaria e copiarla
|
||||
else if ( pSurf->GetType() == SRF_BEZIER) {
|
||||
const ISurfBezier* pSbez = GetSurfBezier( pSurf) ;
|
||||
const ISurfTriMesh* pAuxStm = ( pSbez != nullptr ? pSbez->GetAuxSurf() : nullptr) ;
|
||||
PtrOwner<ISurfTriMesh> pStm( pAuxStm != nullptr ? pAuxStm->Clone() : nullptr) ;
|
||||
if ( ! IsNull( pStm)) {
|
||||
Frame3d frSbez ;
|
||||
m_pGeomDB->GetGlobFrame( nSurfId, frSbez) ;
|
||||
pStm->LocToLoc( frSbez, frRaw) ;
|
||||
nId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nRawId, Release( pStm)) ;
|
||||
}
|
||||
}
|
||||
bOk = bOk && ( nId != GDB_ID_NULL) ;
|
||||
// assegno il nome al solido
|
||||
bOk = bOk && m_pGeomDB->SetName( nId, MACH_RAW_SOLID) ;
|
||||
@@ -405,37 +427,70 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
|
||||
if ( IsNull( pCrvCompo))
|
||||
return GDB_ID_NULL ;
|
||||
// recupero la superficie trimesh
|
||||
ISurfTriMesh* pStm = GetSurfTriMesh( m_pGeomDB->GetGeoObj( nId)) ;
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( m_pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pStm == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
// recupero l'ingombro della superficie in locale
|
||||
BBox3d b3Srf ;
|
||||
pStm->GetLocalBBox( b3Srf) ;
|
||||
// ne calcolo la silhouette secondo Z+
|
||||
POLYLINEVECTOR vPL ;
|
||||
bool bSilh = false ;
|
||||
if ( pStm->GetSilhouette( Z_AX, 10.0, vPL) && vPL.size() > 0) {
|
||||
// cerco il contorno esterno
|
||||
int nInd = - 1 ;
|
||||
double dMaxArea = 0 ;
|
||||
for ( int i = 0 ; i < int( vPL.size()) ; ++ i) {
|
||||
double dArea ;
|
||||
if ( vPL[i].GetAreaXY( dArea) && abs( dArea) > dMaxArea) {
|
||||
if ( dArea < 0)
|
||||
vPL[i].Invert() ;
|
||||
dMaxArea = abs( dArea) ;
|
||||
nInd = i ;
|
||||
const int NUM_TRIA_LIM = 500 ;
|
||||
if ( pStm->GetTriangleCount() < NUM_TRIA_LIM) {
|
||||
POLYLINEVECTOR vPL ;
|
||||
if ( pStm->GetSilhouette( Z_AX, 10.0, vPL) && ! vPL.empty()) {
|
||||
// cerco il contorno esterno
|
||||
int nInd = - 1 ;
|
||||
double dMaxArea = 0 ;
|
||||
for ( int i = 0 ; i < int( vPL.size()) ; ++ i) {
|
||||
double dArea ;
|
||||
if ( vPL[i].GetAreaXY( dArea) && abs( dArea) > dMaxArea) {
|
||||
if ( dArea < 0)
|
||||
vPL[i].Invert() ;
|
||||
dMaxArea = abs( dArea) ;
|
||||
nInd = i ;
|
||||
}
|
||||
}
|
||||
// ne deduco la curva
|
||||
PtrOwner<ICurveComposite> pCrvSilh( CreateCurveComposite()) ;
|
||||
if ( nInd >= 0 && pCrvSilh->FromPolyLine( vPL[nInd])) {
|
||||
pCrvSilh->SetExtrusion( Z_AX) ;
|
||||
Plane3d plProj ;
|
||||
plProj.Set( b3Srf.GetMin(), Z_AX) ;
|
||||
pCrvCompo.Set( GetCurveComposite( ProjectCurveOnPlane( *pCrvSilh, plProj))) ;
|
||||
if ( ! IsNull( pCrvCompo)) {
|
||||
pCrvCompo->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL) ;
|
||||
bSilh = true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// ne deduco la curva
|
||||
PtrOwner<ICurveComposite> pCrvSilh( CreateCurveComposite()) ;
|
||||
if ( nInd >= 0 && pCrvSilh->FromPolyLine( vPL[nInd])) {
|
||||
pCrvSilh->SetExtrusion( Z_AX) ;
|
||||
Plane3d plProj ;
|
||||
plProj.Set( b3Srf.GetMin(), Z_AX) ;
|
||||
pCrvCompo.Set( GetCurveComposite( ProjectCurveOnPlane( *pCrvSilh, plProj))) ;
|
||||
pCrvCompo->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL) ;
|
||||
bSilh = ( ! IsNull( pCrvCompo)) ;
|
||||
}
|
||||
else {
|
||||
PtrOwner<ICAvParSilhouettesSurfTm> pCavParSilh( CreateCAvParSilhouettesSurfTm()) ;
|
||||
if ( ! IsNull( pCavParSilh)) {
|
||||
Frame3d frSrf( b3Srf.GetMin()) ;
|
||||
const double SILH_TOL = 1.0 ;
|
||||
POLYLINEVECTOR vPL ;
|
||||
if ( pCavParSilh->SetData( { pStm}, frSrf, SILH_TOL) &&
|
||||
pCavParSilh->GetSilhouette( 0, vPL)) {
|
||||
// cerco il contorno esterno
|
||||
int nInd = - 1 ;
|
||||
double dMaxArea = 0 ;
|
||||
for ( int i = 0 ; i < int( vPL.size()) ; ++ i) {
|
||||
double dArea ;
|
||||
if ( vPL[i].GetAreaXY( dArea) && abs( dArea) > dMaxArea) {
|
||||
if ( dArea < 0)
|
||||
vPL[i].Invert() ;
|
||||
dMaxArea = abs( dArea) ;
|
||||
nInd = i ;
|
||||
}
|
||||
}
|
||||
// ne deduco la curva
|
||||
if ( nInd >= 0 && pCrvCompo->FromPolyLine( vPL[nInd])) {
|
||||
pCrvCompo->SetExtrusion( Z_AX) ;
|
||||
bSilh = true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// non riuscita, la calcolo come contorno del box
|
||||
@@ -449,18 +504,20 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
|
||||
PL.AddUPoint( 2, ptMin + Vector3d( dDimX, dDimY,0)) ;
|
||||
PL.AddUPoint( 3, ptMin + Vector3d( 0, dDimY,0)) ;
|
||||
PL.AddUPoint( 4, ptMin) ;
|
||||
if ( ! pCrvCompo->FromPolyLine( PL) && ! pCrvCompo->SetExtrusion( Z_AX))
|
||||
if ( pCrvCompo->FromPolyLine( PL))
|
||||
pCrvCompo->SetExtrusion( Z_AX) ;
|
||||
else
|
||||
bOk = false ;
|
||||
}
|
||||
// inserisco la curva composita nel DB
|
||||
int nCrvId = ( bOk ? m_pGeomDB->AddGeoObj( GDB_ID_NULL, nRawId, Release( pCrvCompo)) : GDB_ID_NULL) ;
|
||||
bOk = bOk && ( nCrvId != GDB_ID_NULL) ;
|
||||
// assegno il nome alla curva
|
||||
bOk = bOk && m_pGeomDB->SetName( nCrvId, MACH_RAW_SOLID) ;
|
||||
bOk = bOk && m_pGeomDB->SetName( nCrvId, MACH_RAW_OUTLINE) ;
|
||||
// assegno il colore alla curva
|
||||
bOk = bOk && m_pGeomDB->SetMaterial( nCrvId, cCol) ;
|
||||
bOk = bOk && m_pGeomDB->SetMaterial( nCrvId, cCol) ;
|
||||
}
|
||||
// se qualcosa è andato storto, cancello tutto
|
||||
// se qualcosa è andato storto, cancello tutto
|
||||
if ( ! bOk) {
|
||||
m_pGeomDB->Erase( nRawId) ;
|
||||
return GDB_ID_NULL ;
|
||||
@@ -471,6 +528,156 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
|
||||
return nRawId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::AddRawPart( int nSfrUpId, int nSfrDownId, double dHeight, Color cCol)
|
||||
{
|
||||
// recupero il gruppo dei grezzi nella macchinata corrente
|
||||
int nRawGroupId = GetCurrRawGroupId() ;
|
||||
if ( nRawGroupId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
|
||||
// recupero l'ingombro della superficie up in globale
|
||||
BBox3d b3Surf ;
|
||||
if ( ! m_pGeomDB->GetGlobalBBox( nSfrUpId, b3Surf))
|
||||
return GDB_ID_NULL ;
|
||||
// inserisco il gruppo del grezzo nella macchinata
|
||||
Frame3d frRaw( b3Surf.GetMin()) ;
|
||||
int nRawId = m_pGeomDB->AddGroup( GDB_ID_NULL, nRawGroupId, frRaw) ;
|
||||
if ( nRawId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
// assegno il nome al gruppo
|
||||
bool bOk = m_pGeomDB->SetName( nRawId, MACH_RAW_PART) ;
|
||||
// assegno la fase al gruppo
|
||||
bOk = bOk && m_pGeomDB->SetInfo( nRawId, MACH_RAW_PHASE, m_nCurrPhase) ;
|
||||
|
||||
// recupero il frame originale della superficie up ( deve essere lo stesso della down)
|
||||
Frame3d frSurf ;
|
||||
bOk = bOk && m_pGeomDB->GetGlobFrame( nSfrUpId, frSurf) ;
|
||||
|
||||
// creo il volume in modo approssimativo a partire dalle due superfici considerando soltanto un'approssimazione dei bordi esterni
|
||||
// regione up
|
||||
PtrOwner<ISurfFlatRegion> pSurfUp( CloneSurfFlatRegion( m_pGeomDB->GetGeoObj( nSfrUpId))) ;
|
||||
bOk = bOk && ( ! IsNull( pSurfUp)) ;
|
||||
// calcolo offset e contro-offset per unificare i chunk ed eliminare eventuali rientranze nella superficie
|
||||
double dOffs = 8 ;
|
||||
bOk = bOk && pSurfUp->Offset( dOffs, ICurve::OFF_FILLET) ;
|
||||
bOk = bOk && pSurfUp->Offset( -dOffs, ICurve::OFF_FILLET) ;
|
||||
// recupero il chunk di area maggiore
|
||||
int nKMax = 0 ;
|
||||
if ( bOk && pSurfUp->GetChunkCount() > 1) {
|
||||
double dAreaMax = -1 ;
|
||||
for ( int k = 0 ; k < pSurfUp->GetChunkCount() ; k ++) {
|
||||
PtrOwner<ISurfFlatRegion> pSfrChunk( pSurfUp->CloneChunk( k)) ;
|
||||
double dArea = -1 ; pSfrChunk->GetGrossArea( dArea) ;
|
||||
if ( dArea > dAreaMax) {
|
||||
nKMax = k ;
|
||||
dAreaMax = dArea ;
|
||||
}
|
||||
}
|
||||
}
|
||||
PtrOwner<ICurve> pCrvUp ;
|
||||
bOk = bOk && pCrvUp.Set( pSurfUp->GetLoop( nKMax, 0)) ;
|
||||
bOk = bOk && ( ! IsNull( pCrvUp)) ;
|
||||
|
||||
// regione down
|
||||
PtrOwner<ISurfFlatRegion> pSurfDown( CloneSurfFlatRegion( m_pGeomDB->GetGeoObj( nSfrDownId))) ;
|
||||
bOk = bOk && ( ! IsNull( pSurfDown)) ;
|
||||
bOk = bOk && pSurfDown->Offset( dOffs, ICurve::OFF_FILLET) ;
|
||||
bOk = bOk && pSurfDown->Offset( -dOffs, ICurve::OFF_FILLET) ;
|
||||
nKMax = 0 ;
|
||||
if ( bOk && pSurfDown->GetChunkCount() > 1) {
|
||||
double dAreaMax = -1 ;
|
||||
for ( int k = 0 ; k < pSurfDown->GetChunkCount() ; k ++) {
|
||||
PtrOwner<ISurfFlatRegion> pSfrChunk( pSurfDown->CloneChunk( k)) ;
|
||||
double dArea = -1 ; pSfrChunk->GetGrossArea( dArea) ;
|
||||
if ( dArea > dAreaMax) {
|
||||
nKMax = k ;
|
||||
dAreaMax = dArea ;
|
||||
}
|
||||
}
|
||||
}
|
||||
PtrOwner<ICurveComposite> pCrvDown ;
|
||||
bOk = bOk && pCrvDown.Set( ConvertCurveToComposite( pSurfDown->GetLoop( nKMax, 0))) ;
|
||||
bOk = bOk && ( ! IsNull( pCrvDown)) ;
|
||||
// sposto il punto di inizio il più vicino possibile a quello della curva up per migliorare il calcolo della rigata
|
||||
if ( bOk) {
|
||||
Point3d ptS ; pCrvUp->GetStartPoint( ptS) ;
|
||||
DistPointCurve distPC( ptS, *pCrvDown) ;
|
||||
double dPar ; int nFlag ;
|
||||
bOk = bOk && distPC.GetParamAtMinDistPoint( 0, dPar, nFlag) ;
|
||||
bOk = bOk && pCrvDown->ChangeStartPoint( dPar) ;
|
||||
}
|
||||
|
||||
// volume
|
||||
PtrOwner<ISurfTriMesh> pStmRaw ;
|
||||
bOk = bOk && pStmRaw.Set( GetSurfTriMeshByFlatContour( pCrvUp)) ;
|
||||
bOk = bOk && ( ! IsNull( pStmRaw)) ;
|
||||
PtrOwner<ISurfTriMesh> pStmLat ;
|
||||
bOk = bOk && pStmLat.Set( GetSurfTriMeshRuled( pCrvDown, pCrvUp, ISurfTriMesh::RLT_MINDIST)) ;
|
||||
bOk = bOk && ( ! IsNull( pStmLat)) ;
|
||||
bOk = bOk && pStmRaw->DoSewing( *pStmLat) ;
|
||||
PtrOwner<ISurfTriMesh> pStmDown ;
|
||||
bOk = bOk && pStmDown.Set( GetSurfTriMeshByFlatContour( pCrvDown)) ;
|
||||
|
||||
bOk = bOk && pStmDown->Invert() ;
|
||||
bOk = bOk && pStmRaw->DoSewing( *pStmDown) ;
|
||||
bOk = bOk && pStmRaw->DoCompacting() ;
|
||||
bOk = bOk && pStmRaw->Repair() ;
|
||||
bOk = bOk && pStmRaw->LocToLoc( frSurf, frRaw) ;
|
||||
int nId = bOk ? m_pGeomDB->AddGeoObj( GDB_ID_NULL, nRawId, Release( pStmRaw)) : GDB_ID_NULL ;
|
||||
bOk = bOk && ( nId != GDB_ID_NULL) ;
|
||||
// assegno il nome al solido
|
||||
bOk = bOk && m_pGeomDB->SetName( nId, MACH_RAW_SOLID) ;
|
||||
// assegno il colore al solido
|
||||
bOk = bOk && m_pGeomDB->SetMaterial( nId, cCol) ;
|
||||
// rendo visibile il solido
|
||||
bOk = bOk && m_pGeomDB->SetStatus( nId, GDB_ST_ON) ;
|
||||
// calcolo il punto centro del solido
|
||||
bOk = bOk && SetRawPartCenter( nRawId) ;
|
||||
|
||||
if ( bOk) {
|
||||
// costruisco la curva di contorno
|
||||
PtrOwner<ISurfFlatRegion> pSfrUp( CloneSurfFlatRegion( m_pGeomDB->GetGeoObj( nSfrUpId))) ;
|
||||
PtrOwner<ISurfFlatRegion> pSfrDown( CloneSurfFlatRegion( m_pGeomDB->GetGeoObj( nSfrDownId))) ;
|
||||
bOk = bOk && ( ! IsNull( pSfrUp)) && ( ! IsNull( pSfrDown)) ;
|
||||
if ( bOk)
|
||||
pSfrUp->Add( *pSfrDown) ;
|
||||
PtrOwner<ICurve> pCrv ;
|
||||
bOk = bOk && pCrv.Set( pSfrUp->GetLoop( 0, 0)) ;
|
||||
bOk = bOk && ( ! IsNull( pCrv)) ;
|
||||
bOk = bOk && pCrv->LocToLoc( frSurf, frRaw) ;
|
||||
int nLoop = bOk ? m_pGeomDB->AddGeoObj( GDB_ID_NULL, nRawId, Release( pCrv)) : GDB_ID_NULL ;
|
||||
bOk = bOk && ( nLoop != GDB_ID_NULL) ;
|
||||
bOk = bOk && ExeMove( {nLoop}, -dHeight * Z_AX, RTY_LOC) ;
|
||||
// assegno il nome alla curva
|
||||
bOk = bOk && m_pGeomDB->SetName( nLoop, MACH_RAW_OUTLINE) ;
|
||||
// assegno il colore alla curva
|
||||
bOk = bOk && m_pGeomDB->SetMaterial( nLoop, cCol) ;
|
||||
|
||||
// recupero le superfici up e down
|
||||
int nSurfUpId = ( bOk ? m_pGeomDB->CopyGlob( nSfrUpId, GDB_ID_NULL, nRawId) : GDB_ID_NULL) ;
|
||||
bOk = bOk && ( nSurfUpId != GDB_ID_NULL) ;
|
||||
bOk = bOk && m_pGeomDB->SetName( nSurfUpId, MACH_RAW_UP_REG) ;
|
||||
bOk = bOk && m_pGeomDB->SetMaterial( nSurfUpId, cCol) ;
|
||||
bOk = bOk && m_pGeomDB->SetMode( nSurfUpId, GDB_MD_HIDDEN) ;
|
||||
int nSurfDownId = ( bOk ? m_pGeomDB->CopyGlob( nSfrDownId, GDB_ID_NULL, nRawId) : GDB_ID_NULL) ;
|
||||
bOk = bOk && ( nSurfDownId != GDB_ID_NULL) ;
|
||||
bOk = bOk && m_pGeomDB->SetName( nSurfDownId, MACH_RAW_DOWN_REG) ;
|
||||
bOk = bOk && m_pGeomDB->SetMaterial( nSurfDownId, cCol) ;
|
||||
bOk = bOk && m_pGeomDB->SetMode( nSurfDownId, GDB_MD_HIDDEN) ;
|
||||
}
|
||||
|
||||
// se qualcosa è andato storto, cancello tutto
|
||||
if ( ! bOk) {
|
||||
m_pGeomDB->Erase( nRawId) ;
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
|
||||
// tutto ok
|
||||
return nRawId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::ModifyRawPartSize( int nRawId, double dLength, double dWidth, double dHeight)
|
||||
@@ -478,7 +685,7 @@ MachMgr::ModifyRawPartSize( int nRawId, double dLength, double dWidth, double dH
|
||||
// le nuove dimensioni non possono essere nulle
|
||||
if ( dLength < EPS_SMALL || dWidth < EPS_SMALL || dHeight < EPS_SMALL)
|
||||
return false ;
|
||||
// verifica validità grezzo
|
||||
// verifica validità grezzo
|
||||
if ( ! VerifyRawPart( nRawId))
|
||||
return false ;
|
||||
// recupero il solido del grezzo
|
||||
@@ -520,10 +727,10 @@ MachMgr::ModifyRawPartSize( int nRawId, double dLength, double dWidth, double dH
|
||||
bool
|
||||
MachMgr::ModifyRawPartHeight( int nRawId, double dHeight)
|
||||
{
|
||||
// la nuova altezza non può essere nulla
|
||||
// la nuova altezza non può essere nulla
|
||||
if ( dHeight < EPS_SMALL)
|
||||
return false ;
|
||||
// verifica validità grezzo
|
||||
// verifica validità grezzo
|
||||
if ( ! VerifyRawPart( nRawId))
|
||||
return false ;
|
||||
// recupero il solido del grezzo
|
||||
@@ -552,10 +759,10 @@ MachMgr::GetRawPartPhases( int nRawId, INTVECTOR& vPhase) const
|
||||
{
|
||||
// pulisco parametro di ritorno
|
||||
vPhase.clear() ;
|
||||
// verifica validità grezzo
|
||||
// verifica validità grezzo
|
||||
if ( ! VerifyRawPart( nRawId))
|
||||
return false ;
|
||||
// recupero le fasi in cui è presente il grezzo (se manca è fase 1)
|
||||
// recupero le fasi in cui è presente il grezzo (se manca è fase 1)
|
||||
if ( ! m_pGeomDB->GetInfo( nRawId, MACH_RAW_PHASE, vPhase) || vPhase.empty())
|
||||
vPhase.emplace_back( 1) ;
|
||||
return true ;
|
||||
@@ -565,11 +772,11 @@ MachMgr::GetRawPartPhases( int nRawId, INTVECTOR& vPhase) const
|
||||
bool
|
||||
MachMgr::KeepRawPart( int nRawId, int nSouPhase)
|
||||
{
|
||||
// verifico validità e recupero fasi in cui è presente
|
||||
// verifico validità e recupero fasi in cui è presente
|
||||
INTVECTOR vPhase ;
|
||||
if ( ! GetRawPartPhases( nRawId, vPhase))
|
||||
return false ;
|
||||
// se fase corrente già presente, non devo fare alcunché
|
||||
// se fase corrente già presente, non devo fare alcunché
|
||||
if ( find( vPhase.begin(), vPhase.end(), m_nCurrPhase) != vPhase.end())
|
||||
return true ;
|
||||
// aggiungo la fase corrente
|
||||
@@ -586,8 +793,8 @@ MachMgr::KeepRawPart( int nRawId, int nSouPhase)
|
||||
return false ;
|
||||
if ( ! SwapRawPartParts( nRawId, true))
|
||||
return false ;
|
||||
// se fase di origine non definita, esco con successo
|
||||
if ( nSouPhase == 0)
|
||||
// se fase di origine non definita o uguale alla corrente, esco con successo
|
||||
if ( nSouPhase == 0 || nSouPhase == m_nCurrPhase)
|
||||
return true ;
|
||||
// copio il posizionamento
|
||||
Disposition* pSouDisp = GetDisposition( m_pGeomDB->GetUserObj( GetPhaseDisposition( nSouPhase))) ;
|
||||
@@ -621,10 +828,11 @@ MachMgr::KeepRawPart( int nRawId, int nSouPhase)
|
||||
bool
|
||||
MachMgr::VerifyRawPartPhase( int nRawId, int nPhase) const
|
||||
{
|
||||
// verifico validità e recupero fasi in cui è presente
|
||||
// verifico validità e recupero fasi in cui è presente
|
||||
INTVECTOR vPhase ;
|
||||
if ( ! GetRawPartPhases( nRawId, vPhase))
|
||||
return false ;
|
||||
// verifico presenza nella fase indicata
|
||||
return ( find( vPhase.begin(), vPhase.end(), nPhase) != vPhase.end()) ;
|
||||
}
|
||||
|
||||
@@ -632,11 +840,11 @@ MachMgr::VerifyRawPartPhase( int nRawId, int nPhase) const
|
||||
bool
|
||||
MachMgr::RemoveRawPartFromCurrPhase( int nRawId)
|
||||
{
|
||||
// verifico validità e recupero fasi in cui è presente
|
||||
// verifico validità e recupero fasi in cui è presente
|
||||
INTVECTOR vPhase ;
|
||||
if ( ! GetRawPartPhases( nRawId, vPhase))
|
||||
return false ;
|
||||
// se non appartiene alla fase corrente, non devo fare alcunché
|
||||
// se non appartiene alla fase corrente, non devo fare alcunché
|
||||
auto iIter = find( vPhase.begin(), vPhase.end(), m_nCurrPhase) ;
|
||||
if ( iIter == vPhase.end())
|
||||
return true ;
|
||||
@@ -663,7 +871,7 @@ MachMgr::RemoveRawPartFromCurrPhase( int nRawId)
|
||||
bool
|
||||
MachMgr::RemoveRawPart( int nRawId)
|
||||
{
|
||||
// verifica validità grezzo
|
||||
// verifica validità grezzo
|
||||
if ( ! VerifyRawPart( nRawId))
|
||||
return false ;
|
||||
// tolgo dalle disposizioni in cui compare gli eventuali movimenti registrati di questo grezzo
|
||||
@@ -687,7 +895,7 @@ MachMgr::VerifyRawPart( int nRawId, bool bLinkedAllowed) const
|
||||
int nRawGroupId = GetCurrRawGroupId() ;
|
||||
if ( nRawGroupId != GDB_ID_NULL && m_pGeomDB->GetParentId( nRawId) == nRawGroupId)
|
||||
return true ;
|
||||
// se consentito linkaggio ed il grezzo è linkato ad un gruppo della macchina corrente, va bene
|
||||
// se consentito linkaggio ed il grezzo è linkato ad un gruppo della macchina corrente, va bene
|
||||
if ( bLinkedAllowed) {
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
if ( pMch != nullptr && pMch->IsLinkedRawPart( nRawId))
|
||||
@@ -807,12 +1015,12 @@ MachMgr::ResetRawPartCenter( int nRawId)
|
||||
bool
|
||||
MachMgr::GetRawPartCenter( int nRawId, Point3d& ptCen)
|
||||
{
|
||||
// verifica validità grezzo
|
||||
// verifica validità grezzo
|
||||
if ( ! VerifyRawPart( nRawId))
|
||||
return false ;
|
||||
// cerco di recuperare l'oggetto
|
||||
int nGPntId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_CENTER) ;
|
||||
// ne verifico la validità
|
||||
// ne verifico la validità
|
||||
int nMode ;
|
||||
if ( nGPntId == GDB_ID_NULL ||
|
||||
! m_pGeomDB->GetMode( nGPntId, nMode) || nMode != GDB_MD_STD) {
|
||||
@@ -840,7 +1048,7 @@ MachMgr::GetRawPartCenter( int nRawId, Point3d& ptCen)
|
||||
bool
|
||||
MachMgr::GetRawPartBBox( int nRawId, BBox3d& b3Raw)
|
||||
{
|
||||
// verifica validità grezzo
|
||||
// verifica validità grezzo
|
||||
if ( ! VerifyRawPart( nRawId))
|
||||
return false ;
|
||||
// recupero solido del grezzo
|
||||
@@ -848,6 +1056,103 @@ MachMgr::GetRawPartBBox( int nRawId, BBox3d& b3Raw)
|
||||
return m_pGeomDB->GetGlobalBBox( nRawSolidId, b3Raw) ;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
static bool
|
||||
AssociateSurfs( IGeomDB* pGeomDB, int nSurfUpId, int nSurfDownId, vector<pair<int,int>>& vRawSurfs)
|
||||
{
|
||||
// vRawSurfs contiene tutte le coppie ( id regioneUp, id regioneDown) che definiscono i nuovi grezzi
|
||||
vRawSurfs.clear() ;
|
||||
|
||||
int nUpCnt = ExeSurfFrChunkCount( nSurfUpId) ;
|
||||
int nDownCnt = ExeSurfFrChunkCount( nSurfDownId) ;
|
||||
// se non sono stati creati più grezzi
|
||||
if ( nUpCnt == 1 || nDownCnt == 1) {
|
||||
vRawSurfs.emplace_back( nSurfUpId, nSurfDownId) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
int nUpFirstId = ExeExplodeSurface( nSurfUpId, &nUpCnt) ;
|
||||
int nDownFirstId = ExeExplodeSurface( nSurfDownId, &nDownCnt) ;
|
||||
|
||||
// ad ogni chunk della regione up associo i chunk corrispondenti della regione down
|
||||
INTVECTOR vChunks( nUpCnt, GDB_ID_NULL) ;
|
||||
for ( int nIdD = nDownFirstId ; nIdD < nDownFirstId + nDownCnt ; nIdD ++) {
|
||||
ISurfFlatRegion* pSfrD = GetSurfFlatRegion( pGeomDB->GetGeoObj( nIdD)) ;
|
||||
if ( pSfrD == nullptr)
|
||||
return false ;
|
||||
BBox3d bBoxD ; ExeGetBBox( nIdD, BBF_STANDARD, bBoxD) ;
|
||||
// inidividuo il chunk della superficie up che interagisce maggiormente con il chunk corrente della superficie down
|
||||
int k = -1 ;
|
||||
double dMaxArea = -1 ;
|
||||
for ( int j = 0 ; j < nUpCnt ; j ++) {
|
||||
BBox3d bBoxU ; ExeGetBBox( nUpFirstId + j, BBF_STANDARD, bBoxU) ;
|
||||
if ( bBoxU.OverlapsXY( bBoxD)) {
|
||||
PtrOwner<ISurfFlatRegion> pSfrU( CloneSurfFlatRegion( pGeomDB->GetGeoObj( nUpFirstId + j))) ;
|
||||
if ( IsNull( pSfrU))
|
||||
return false ;
|
||||
// le due superfici sono nello stesso frame
|
||||
pSfrU->Intersect( *pSfrD) ;
|
||||
double dArea = -1 ; pSfrU->GetArea( dArea) ;
|
||||
if ( dArea > dMaxArea) {
|
||||
k = j ;
|
||||
dMaxArea = dArea ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// aggiorno le superfici con l'associazione trovata
|
||||
if ( k == -1)
|
||||
return false ;
|
||||
if ( vChunks[k] == GDB_ID_NULL)
|
||||
vChunks[k] = nIdD ;
|
||||
else {
|
||||
ExeSurfFrAdd( vChunks[k], nIdD) ;
|
||||
ExeErase( {nIdD}) ;
|
||||
}
|
||||
}
|
||||
|
||||
// controllo per ogni chunk della superficie up il corrispondente della nuova superficie down
|
||||
for ( int i = 0 ; i < nUpCnt ; i ++) {
|
||||
ISurfFlatRegion* pSfrU = GetSurfFlatRegion( pGeomDB->GetGeoObj( nUpFirstId + i)) ;
|
||||
if ( pSfrU == nullptr)
|
||||
return false ;
|
||||
BBox3d bBoxU ; ExeGetBBox( nUpFirstId + i, BBF_STANDARD, bBoxU) ;
|
||||
// individuo il chunk della superficie down che interagisce maggiormente con il chunk corrente della superficie up
|
||||
int k = -1 ;
|
||||
double dMaxArea = -1 ;
|
||||
for ( int j = 0 ; j < int( vChunks.size()) ; j ++) {
|
||||
BBox3d bBoxD ; ExeGetBBox( vChunks[j], BBF_STANDARD, bBoxD) ;
|
||||
// se i box interferiscono allora verifico di quanto si sovrappongono le due regioni
|
||||
if ( bBoxD.OverlapsXY( bBoxU)) {
|
||||
PtrOwner<ISurfFlatRegion> pSfrD( CloneSurfFlatRegion( pGeomDB->GetGeoObj( vChunks[j]))) ;
|
||||
if ( IsNull( pSfrD))
|
||||
return false ;
|
||||
pSfrD->Intersect( *pSfrU) ;
|
||||
double dArea = -1 ; pSfrD->GetArea( dArea) ;
|
||||
if ( dArea > dMaxArea) {
|
||||
k = j ;
|
||||
dMaxArea = dArea ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( k == -1)
|
||||
return false ;
|
||||
// se è la stessa associazione individuata da vChunks allora aggiorno il vettore finale dei grezzi
|
||||
if ( k == i)
|
||||
vRawSurfs.emplace_back( nUpFirstId + i, vChunks[i]) ;
|
||||
else {
|
||||
// altrimenti unisco le regioni associate appena individuate sia per la superficie up sia per la down
|
||||
ExeSurfFrAdd( nUpFirstId + k, nUpFirstId + i) ;
|
||||
ExeErase( {nUpFirstId + i}) ;
|
||||
ExeSurfFrAdd( vChunks[k], vChunks[i]) ;
|
||||
ExeErase( {vChunks[i]}) ;
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
|
||||
@@ -871,7 +1176,6 @@ MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
|
||||
BBox3d b3Raw ;
|
||||
if ( ! m_pGeomDB->GetGlobalBBox( nRawSolId, b3Raw))
|
||||
return GDB_ID_NULL ;
|
||||
double dZmin = b3Raw.GetMin().z ;
|
||||
double dHeight = b3Raw.GetMax().z - b3Raw.GetMin().z ;
|
||||
// il colore del grezzo
|
||||
Color cCol = AQUA ;
|
||||
@@ -880,19 +1184,31 @@ MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
|
||||
Frame3d frRaw ;
|
||||
if ( ! m_pGeomDB->GetGroupGlobFrame( nRawId, frRaw))
|
||||
return GDB_ID_NULL ;
|
||||
|
||||
// creo la regione del grezzo a partire dal suo contorno
|
||||
// recupero il contorno
|
||||
int nOutCrvId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_OUTLINE) ;
|
||||
if ( nOutCrvId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
// creo la regione
|
||||
INTVECTOR vCrvIds ;
|
||||
vCrvIds.emplace_back( nOutCrvId) ;
|
||||
int nSfrId = ExeCreateSurfFlatRegion( nRawId, vCrvIds, nullptr) ;
|
||||
if ( nSfrId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
m_pGeomDB->SetLevel( nSfrId, GDB_LV_TEMP) ;
|
||||
|
||||
// creo le regioni inferiore e superiore del grezzo da aggiornare con le lavorazioni
|
||||
int nSfrDownId = GDB_ID_NULL, nSfrUpId = GDB_ID_NULL ;
|
||||
int nSfrDownOrigId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_DOWN_REG) ;
|
||||
int nSfrUpOrigId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_UP_REG) ;
|
||||
if ( nSfrDownOrigId == GDB_ID_NULL || nSfrUpOrigId == GDB_ID_NULL) {
|
||||
// se le regioni del grezzo di partenza non sono definite, le creo a partire dall'outline
|
||||
nSfrDownId = ExeCreateSurfFlatRegion( nRawId, {nOutCrvId}, nullptr) ;
|
||||
if ( nSfrDownId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
nSfrUpId = ExeCopyGlob( nSfrDownId, nRawId, GDB_LAST_SON) ;
|
||||
if ( nSfrUpId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
ExeMove( { nSfrUpId}, dHeight * Z_AX, RTY_LOC) ;
|
||||
}
|
||||
else {
|
||||
nSfrDownId = ExeCopyGlob( nSfrDownOrigId, nRawId, GDB_LAST_SON) ;
|
||||
nSfrUpId = ExeCopyGlob( nSfrUpOrigId, nRawId, GDB_LAST_SON) ;
|
||||
if ( nSfrDownId == GDB_ID_NULL || nSfrUpId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
|
||||
// se esiste il kerf, ne creo la regione
|
||||
PtrOwner<ISurfFlatRegion> pSfrKerf ;
|
||||
@@ -907,7 +1223,8 @@ MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
|
||||
}
|
||||
|
||||
// recupero le regioni delle lavorazioni
|
||||
INTVECTOR vMchRReg ;
|
||||
INTVECTOR vMchRRegUp ;
|
||||
INTVECTOR vMchRRegDown ;
|
||||
for ( auto nMchId : vMchId) {
|
||||
// recupero gruppo preview lavorazioni nella lavorazione
|
||||
int nPVGrp = m_pGeomDB->GetFirstNameInGroup( nMchId, MCH_PV) ;
|
||||
@@ -915,94 +1232,110 @@ MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
|
||||
return GDB_ID_NULL ;
|
||||
// se vuoto, cerco il rimando al preview nel pezzo
|
||||
if ( m_pGeomDB->GetGroupObjs( nPVGrp) == 0 &&
|
||||
! m_pGeomDB->GetInfo( nPVGrp, MCH_PV_KEY_RELOCATE, nPVGrp))
|
||||
! m_pGeomDB->GetInfo( nPVGrp, MCH_PV_KEY_RELOCATE, nPVGrp))
|
||||
return GDB_ID_NULL ;
|
||||
// ciclo sui percorsi utensile (CL)
|
||||
int nClId = m_pGeomDB->GetFirstGroupInGroup( nPVGrp) ;
|
||||
while ( nClId != GDB_ID_NULL) {
|
||||
// tagli ridotti
|
||||
int nCrId = m_pGeomDB->GetFirstNameInGroup( nClId, MCH_PV_RRCUT) ;
|
||||
while ( nCrId != GDB_ID_NULL) {
|
||||
vMchRReg.emplace_back( nCrId) ;
|
||||
nCrId = m_pGeomDB->GetNextName( nCrId, MCH_PV_RRCUT) ;
|
||||
}
|
||||
// lavorazioni per regione inferiore
|
||||
int nCrDownId = m_pGeomDB->GetFirstNameInGroup( nClId, MCH_PV_DOWN_RAWCUT) ;
|
||||
// se non esiste la regione inferiore la lavorazione non è passante quindi può essere ignorata
|
||||
if ( nCrDownId != GDB_ID_NULL) {
|
||||
while ( nCrDownId != GDB_ID_NULL) {
|
||||
vMchRRegDown.emplace_back( nCrDownId) ;
|
||||
nCrDownId = m_pGeomDB->GetNextName( nCrDownId, MCH_PV_DOWN_RAWCUT) ;
|
||||
}
|
||||
// lavorazioni per regione superiore
|
||||
int nCrUpId = m_pGeomDB->GetFirstNameInGroup( nClId, MCH_PV_UP_RAWCUT) ;
|
||||
while ( nCrUpId != GDB_ID_NULL) {
|
||||
vMchRRegUp.emplace_back( nCrUpId) ;
|
||||
nCrUpId = m_pGeomDB->GetNextName( nCrUpId, MCH_PV_UP_RAWCUT) ;
|
||||
}
|
||||
}
|
||||
// passo al successivo percorso utensile
|
||||
nClId = m_pGeomDB->GetNextGroup( nClId) ;
|
||||
}
|
||||
}
|
||||
|
||||
// sottraggo queste regioni a quella del grezzo
|
||||
for ( auto nMchRReg : vMchRReg) {
|
||||
ExeSurfFrSubtract( nSfrId, nMchRReg) ;
|
||||
}
|
||||
// sottraggo le lavorazioni alle superfici del grezzo
|
||||
for ( auto nMchRReg : vMchRRegUp)
|
||||
ExeSurfFrSubtract( nSfrUpId, nMchRReg) ;
|
||||
for ( auto nMchRReg : vMchRRegDown)
|
||||
ExeSurfFrSubtract( nSfrDownId, nMchRReg) ;
|
||||
|
||||
// classifico i chunks della regione up e down per individuare le regioni che definiscono i nuovi grezzi
|
||||
vector<pair<int,int>> vSurfRaws ;
|
||||
AssociateSurfs( m_pGeomDB, nSfrUpId, nSfrDownId, vSurfRaws) ;
|
||||
|
||||
// creo i grezzi risultanti
|
||||
// creo i nuovi grezzi
|
||||
INTVECTOR vNewIds ;
|
||||
int nCount ;
|
||||
int nChunk = 0 ;
|
||||
int nFirstLoopId = ExeExtractSurfFrChunkLoops( nSfrId, nChunk, nRawId, &nCount) ;
|
||||
while ( nFirstLoopId != GDB_ID_NULL) {
|
||||
// !!! in attesa di gestire i grezzi con i buchi !!!
|
||||
// cancello le eventuali curve successive (sono i loop interni ovvero i buchi)
|
||||
for ( int i = 1 ; i < nCount ; ++ i) {
|
||||
m_pGeomDB->Erase( nFirstLoopId + i) ;
|
||||
}
|
||||
// dichiaro temporanea la curva
|
||||
m_pGeomDB->SetLevel( nFirstLoopId, GDB_LV_TEMP) ;
|
||||
// creo il grezzo
|
||||
int nId = AddRawPart( nFirstLoopId, 0, dZmin, dHeight, cCol) ;
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
vNewIds.emplace_back( nId) ;
|
||||
// imposto lo stato del contorno di questo grezzo come quello del grezzo di partenza
|
||||
int nStat = GDB_ST_ON ;
|
||||
if ( m_pGeomDB->GetStatus( nOutCrvId, nStat) && nStat == GDB_ST_OFF)
|
||||
m_pGeomDB->SetStatus( m_pGeomDB->GetFirstNameInGroup( nId, MACH_RAW_OUTLINE), nStat) ;
|
||||
// assegno la fase al gruppo
|
||||
m_pGeomDB->SetInfo( nId, MACH_RAW_PHASE, m_nCurrPhase) ;
|
||||
// se esiste il kerf uso questa curva per creare il kerf del nuovo grezzo
|
||||
if ( ! IsNull( pSfrKerf)) {
|
||||
// creo la regione con la curva
|
||||
SurfFlatRegionByContours SfrCntr ;
|
||||
SfrCntr.AddCurve( GetCurve( m_pGeomDB->RemoveGeoObjAndErase( nFirstLoopId))) ;
|
||||
PtrOwner<ISurfFlatRegion> pSfrNewKerf( SfrCntr.GetSurf()) ;
|
||||
if ( IsNull( pSfrNewKerf))
|
||||
return GDB_ID_NULL ;
|
||||
// la limito con la regione di kerf precedente (va bene anche se fallisce)
|
||||
pSfrNewKerf->Intersect( *pSfrKerf) ;
|
||||
// se risultato non vuoto
|
||||
if ( pSfrNewKerf->IsValid()) {
|
||||
// riferimento del nuovo grezzo
|
||||
Frame3d frNewRaw ;
|
||||
if ( ! m_pGeomDB->GetGroupGlobFrame( nId, frNewRaw))
|
||||
return GDB_ID_NULL ;
|
||||
// la porto dal riferimento del grezzo originale al riferimento di questo grezzo
|
||||
pSfrNewKerf->LocToLoc( frRaw, frNewRaw) ;
|
||||
// la porto sulla faccia sopra del grezzo
|
||||
pSfrNewKerf->Translate( Vector3d( 0, 0, dHeight)) ;
|
||||
// recupero il contorno e lo inserisco come kerf del nuovo grezzo
|
||||
PtrOwner<ICurve> pCrv( pSfrNewKerf->GetLoop( 0, 0)) ;
|
||||
int nNewKerfId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nId, Release( pCrv)) ;
|
||||
if ( nNewKerfId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
m_pGeomDB->CopyMaterial( nKerfId, nNewKerfId) ;
|
||||
m_pGeomDB->SetName( nNewKerfId, MACH_RAW_KERF) ;
|
||||
}
|
||||
}
|
||||
// altrimenti la cancello
|
||||
else
|
||||
m_pGeomDB->Erase( nFirstLoopId) ;
|
||||
// passo alla prossima curva
|
||||
++ nChunk ;
|
||||
nFirstLoopId = ExeExtractSurfFrChunkLoops( nSfrId, nChunk, nRawId, &nCount) ;
|
||||
}
|
||||
// cancello la regione
|
||||
m_pGeomDB->Erase( nSfrId) ;
|
||||
// verifico esista almeno un nuovo grezzo
|
||||
if ( vNewIds.empty())
|
||||
return GDB_ID_NULL ;
|
||||
INTVECTOR vNewIds ;
|
||||
for ( int i = 0 ; i < int( vSurfRaws.size()) ; i++) {
|
||||
|
||||
// aggiungo il grezzo
|
||||
int nId = AddRawPart( vSurfRaws[i].first, vSurfRaws[i].second, dHeight, cCol) ;
|
||||
m_pGeomDB->Erase( vSurfRaws[i].first) ;
|
||||
m_pGeomDB->Erase( vSurfRaws[i].second) ;
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
vNewIds.emplace_back( nId) ;
|
||||
|
||||
// imposto lo stato del contorno di questo grezzo come quello del grezzo di partenza
|
||||
int nStat = GDB_ST_ON ;
|
||||
if ( m_pGeomDB->GetStatus( nOutCrvId, nStat) && nStat == GDB_ST_OFF)
|
||||
m_pGeomDB->SetStatus( m_pGeomDB->GetFirstNameInGroup( nId, MACH_RAW_OUTLINE), nStat) ;
|
||||
// assegno la fase al gruppo
|
||||
m_pGeomDB->SetInfo( nId, MACH_RAW_PHASE, m_nCurrPhase) ;
|
||||
// se esiste il kerf uso questa curva per creare il kerf del nuovo grezzo
|
||||
if ( ! IsNull( pSfrKerf)) {
|
||||
// riferimento del nuovo grezzo
|
||||
Frame3d frNewRaw ;
|
||||
if ( ! m_pGeomDB->GetGroupGlobFrame( nId, frNewRaw))
|
||||
return GDB_ID_NULL ;
|
||||
// considero il nuovo kerf come la regione superiore del nuovo grezzo
|
||||
int nSfrUpId = m_pGeomDB->GetFirstNameInGroup( nId, MACH_RAW_UP_REG) ;
|
||||
if ( nSfrUpId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
PtrOwner<ISurfFlatRegion> pSfrNewKerf( CloneSurfFlatRegion( m_pGeomDB->GetGeoObj( nSfrUpId))) ;
|
||||
if ( IsNull( pSfrNewKerf))
|
||||
return GDB_ID_NULL ;
|
||||
// porto nello stesso riferimento del grezzo originale
|
||||
pSfrNewKerf->LocToLoc( frNewRaw, frRaw) ;
|
||||
// la limito con la regione di kerf precedente ( va bene anche se fallisce)
|
||||
pSfrNewKerf->Intersect( *pSfrKerf) ;
|
||||
// se risultato non vuoto
|
||||
if ( pSfrNewKerf->IsValid()) {
|
||||
// la porto dal riferimento del grezzo originale al riferimento di questo grezzo
|
||||
pSfrNewKerf->LocToLoc( frRaw, frNewRaw) ;
|
||||
// recupero il contorno esterno del chunk più grande e lo inserisco come kerf del nuovo grezzo
|
||||
double dAreaMax = -1 ;
|
||||
int nKMax = 0 ;
|
||||
for ( int k = 0 ; k < pSfrNewKerf->GetChunkCount() ; k ++) {
|
||||
PtrOwner<ISurfFlatRegion> pSfrChunk( pSfrNewKerf->CloneChunk( k)) ;
|
||||
double dArea = -1 ; pSfrChunk->GetGrossArea( dArea) ;
|
||||
if ( dArea > dAreaMax) {
|
||||
nKMax = k ;
|
||||
dAreaMax = dArea ;
|
||||
}
|
||||
}
|
||||
PtrOwner<ICurve> pCrv( pSfrNewKerf->GetLoop( nKMax, 0)) ;
|
||||
if ( IsNull( pCrv))
|
||||
return GDB_ID_NULL ;
|
||||
int nNewKerfId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nId, Release( pCrv)) ;
|
||||
if ( nNewKerfId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
m_pGeomDB->CopyMaterial( nKerfId, nNewKerfId) ;
|
||||
m_pGeomDB->SetName( nNewKerfId, MACH_RAW_KERF) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// cancello le regioni usate per i conti
|
||||
m_pGeomDB->Erase( nSfrUpId) ;
|
||||
m_pGeomDB->Erase( nSfrDownId) ;
|
||||
// verifico esista almeno un nuovo grezzo
|
||||
if ( vNewIds.empty())
|
||||
return GDB_ID_NULL ;
|
||||
|
||||
// inserisco i pezzi del grezzo originale nei nuovi grezzi
|
||||
int nGroupId = m_pGeomDB->GetFirstGroupInGroup( nRawId) ;
|
||||
while ( nGroupId != GDB_ID_NULL) {
|
||||
@@ -1012,32 +1345,31 @@ MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
|
||||
// scambio con pezzo
|
||||
int nPartId = SwapRawPartPart( nNewGroupId, true) ;
|
||||
// verifico se il pezzo sta nel grezzo
|
||||
int nLayerId = m_pGeomDB->GetFirstNameInGroup( nPartId, NST_EXT_LAYER) ;
|
||||
int nLayerId = m_pGeomDB->GetFirstNameInGroup( nPartId, NST_PARTREG_LAYER) ;
|
||||
if ( nLayerId == GDB_ID_NULL || m_pGeomDB->GetGdbType( nLayerId) != GDB_TY_GROUP)
|
||||
nLayerId = m_pGeomDB->GetFirstGroupInGroup( nPartId) ;
|
||||
int nEntId = m_pGeomDB->GetFirstInGroup( nLayerId) ;
|
||||
int nEntGeoType = m_pGeomDB->GetGeoType( nEntId) ;
|
||||
Point3d ptTest ;
|
||||
if ( ( ( nEntGeoType & GEO_CURVE) != 0 && ExeMidPoint( nEntId, nNewId, ptTest)) ||
|
||||
( ( nEntGeoType & GEO_CURVE) == 0 && ExeCenterPoint( nEntId, nNewId, ptTest))) {
|
||||
// cerco la regione del pezzo
|
||||
int nEntId = m_pGeomDB->GetFirstInGroup( nLayerId) ;
|
||||
while ( nEntId != GDB_ID_NULL) {
|
||||
int nEntGeoType = m_pGeomDB->GetGeoType( nEntId) ;
|
||||
if ( nEntGeoType == SRF_FLATRGN)
|
||||
break ;
|
||||
nEntId = m_pGeomDB->GetNext( nEntId) ;
|
||||
}
|
||||
if ( nEntId != GDB_ID_NULL) {
|
||||
// verifico se è interna al grezzo
|
||||
int nOutCrvId = m_pGeomDB->GetFirstNameInGroup( nNewId, MACH_RAW_OUTLINE) ;
|
||||
BBox3d b3Raw ; m_pGeomDB->GetGlobalBBox( nOutCrvId, b3Raw) ;
|
||||
double dRawDiam = 0 ; b3Raw.GetDiameter( dRawDiam) ;
|
||||
BBox3d b3Part ; m_pGeomDB->GetGlobalBBox( nEntId, b3Part) ;
|
||||
double dPartDiam = 0 ; b3Part.GetDiameter( dPartDiam) ;
|
||||
if ( dRawDiam > 0.9 * dPartDiam) {
|
||||
ICurve* pCurve = GetCurve( m_pGeomDB->GetGeoObj( nOutCrvId)) ;
|
||||
if ( pCurve != nullptr) {
|
||||
int nSide ;
|
||||
double dDist ;
|
||||
DistPointCurve distPC( ptTest, *pCurve) ;
|
||||
if ( distPC.GetDist( dDist) &&
|
||||
( dDist < 100 * EPS_SMALL ||
|
||||
( distPC.GetSideAtMinDistPoint( 0, Z_AX, nSide) && nSide != MDS_RIGHT)))
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
int nSfrUp = m_pGeomDB->GetFirstNameInGroup( nNewId, MACH_RAW_UP_REG) ;
|
||||
if ( ! ExeSurfFrTestExternal( nSfrUp, nEntId, EPS_SMALL))
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
// altrimenti scambio pezzo ed elimino gruppo
|
||||
nNewGroupId = SwapRawPartPart( nPartId, false) ;
|
||||
m_pGeomDB->Erase( nNewGroupId) ;
|
||||
@@ -1045,5 +1377,5 @@ MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
|
||||
nGroupId = m_pGeomDB->GetNextGroup( nGroupId) ;
|
||||
}
|
||||
|
||||
return vNewIds[0] ;
|
||||
return vNewIds[0] ;
|
||||
}
|
||||
|
||||
+17
-2
@@ -71,6 +71,13 @@ MachMgr::ImportSetup( const string& sName)
|
||||
return m_stuMgr.Save() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::ExistsCurrSetup( void) const
|
||||
{
|
||||
return m_stuMgr.Exists() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::VerifyCurrSetup( STRVECTOR& vsErrors)
|
||||
@@ -125,14 +132,21 @@ MachMgr::VerifyCurrSetup( STRVECTOR& vsErrors)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::FindToolInCurrSetup( const string& sTool)
|
||||
MachMgr::FindToolInCurrSetup( const string& sTool) const
|
||||
{
|
||||
return m_stuMgr.FindTool( sTool) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetToolsInCurrSetupPos( const string& sTcPos, STRVECTOR& vsTools)
|
||||
MachMgr::GetToolSetupPosInCurrSetup( const string& sTool, string& sTcPos) const
|
||||
{
|
||||
return m_stuMgr.GetToolSetupPos( sTool, sTcPos) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetToolsInCurrSetupPos( const string& sTcPos, STRVECTOR& vsTools) const
|
||||
{
|
||||
return m_stuMgr.GetToolsInSetupPos( sTcPos, vsTools) ;
|
||||
}
|
||||
@@ -148,6 +162,7 @@ MachMgr::UpdateCurrSetup( void)
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
pMch->ResetCurrTool() ;
|
||||
return pMch->LoadAllTools() ;
|
||||
}
|
||||
|
||||
|
||||
+68
-5
@@ -16,7 +16,8 @@
|
||||
#include "DllMain.h"
|
||||
#include "MachMgr.h"
|
||||
#include "MachConst.h"
|
||||
#include "Simulator.h"
|
||||
#include "SimulatorSP.h"
|
||||
#include "SimulatorMP.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -27,7 +28,12 @@ MachMgr::SimInit( void)
|
||||
// alloco o rialloco il simulatore
|
||||
if ( m_pSimul != nullptr)
|
||||
delete m_pSimul ;
|
||||
m_pSimul = new( nothrow) Simulator ;
|
||||
if ( GetCurrMachine() == nullptr)
|
||||
return false ;
|
||||
if ( GetCurrMachine()->GetMultiProcess( 2))
|
||||
m_pSimul = CreateSimulatorMP() ;
|
||||
else
|
||||
m_pSimul = CreateSimulatorSP() ;
|
||||
if ( m_pSimul == nullptr)
|
||||
return false ;
|
||||
// lo inizializzo
|
||||
@@ -124,6 +130,17 @@ MachMgr::SimSetUiStatus( int nUiStatus)
|
||||
return m_pSimul->SetUiStatus( nUiStatus) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::SimEnableToolTipTrace( bool bEnable)
|
||||
{
|
||||
// verifico simulatore
|
||||
if ( m_pSimul == nullptr)
|
||||
return false ;
|
||||
// imposto abilitazione disegno traccia della punta utensile
|
||||
return m_pSimul->EnableToolTipTrace( bEnable) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::SimGoHome( void)
|
||||
@@ -159,6 +176,29 @@ MachMgr::SimAddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, co
|
||||
return m_pSimul->AddCollisionObj( nInd, bToolOn, nFrameId, nType, vtMove, dPar1, dPar2, dPar3) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::SimRemoveCollisionObj( int nFrameId)
|
||||
{
|
||||
// verifico simulatore
|
||||
if ( m_pSimul == nullptr)
|
||||
return false ;
|
||||
// rimuovo gli oggetti da verificare per la collisione con il grezzo con FrameId indicato
|
||||
return m_pSimul->RemoveCollisionObj( nFrameId) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::SimGetCollisionObj( int nPos, int& nInd, bool& bToolOn, int& nFrameId, int& nType,
|
||||
Vector3d& vtMove, double& dPar1, double& dPar2, double& dPar3) const
|
||||
{
|
||||
// verifico simulatore
|
||||
if ( m_pSimul == nullptr)
|
||||
return false ;
|
||||
// recupero i dati dell'oggetto di collisione di posizione indicata nel relativo vettore
|
||||
return m_pSimul->GetCollisionObj( nPos, nInd, bToolOn, nFrameId, nType, vtMove, dPar1, dPar2, dPar3) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::SimExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType)
|
||||
@@ -183,13 +223,25 @@ MachMgr::SimOnCollision( int nCdInd, int nObjInd, int& nErr)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::SimSetToolForVmill( const string& sTool, const string& sHead, int nExit, const INTVECTOR& vVmill, bool bFirst)
|
||||
MachMgr::SimSetToolForVmill( const string& sTool, const string& sHead, int nExit, int nFlag, double dPar1, double dPar2,
|
||||
const INTVECTOR& vVmill, bool bFirst)
|
||||
{
|
||||
// verifico simulatore
|
||||
if ( m_pSimul == nullptr)
|
||||
return false ;
|
||||
// imposto utensile per Vmill
|
||||
return m_pSimul->SetToolForVmill( sTool, sHead, nExit, vVmill, bFirst) ;
|
||||
return m_pSimul->SetToolForVmill( sTool, sHead, nExit, nFlag, dPar1, dPar2, vVmill, bFirst) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::SimEnableToolsForVmill( bool bEnable)
|
||||
{
|
||||
// verifico simulatore
|
||||
if ( m_pSimul == nullptr)
|
||||
return false ;
|
||||
// imposto abilitazione Vmill
|
||||
return m_pSimul->EnableToolsForVmill( bEnable) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -198,7 +250,18 @@ MachMgr::SimMoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
|
||||
{
|
||||
// verifico simulatore
|
||||
if ( m_pSimul == nullptr)
|
||||
return false ;
|
||||
return SIM_AXMV_RES_ERR ;
|
||||
// lancio movimento assi
|
||||
return m_pSimul->MoveAxes( nMoveType, vAxNaEpSt) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::SimSaveCmd( int nType, int nPar, const string& sPar, const string& sPar2)
|
||||
{
|
||||
// verifico simulatore
|
||||
if ( m_pSimul == nullptr)
|
||||
return false ;
|
||||
// salvo il comando
|
||||
return m_pSimul->SaveCmd( nType, nPar, sPar, sPar2) ;
|
||||
}
|
||||
|
||||
+97
-22
@@ -34,6 +34,7 @@ Machine::Machine( void)
|
||||
{
|
||||
m_pMchMgr = nullptr ;
|
||||
m_pGeomDB = nullptr ;
|
||||
m_nContextId = 0 ;
|
||||
m_nGroupId = GDB_ID_NULL ;
|
||||
m_nTempGroupId = GDB_ID_NULL ;
|
||||
m_dAxisMaxAdjust = EPS_SMALL ;
|
||||
@@ -41,13 +42,18 @@ Machine::Machine( void)
|
||||
m_dExitMaxAdjust = EPS_SMALL ;
|
||||
m_dExitMaxRotAdj = 10 * EPS_ANG_SMALL ;
|
||||
m_dAngDeltaMinForHome = INFINITO ;
|
||||
m_nMultiProcess = 0 ;
|
||||
m_nLinkAxesMoveOrder = 0 ;
|
||||
m_nNewLinkMgr = 0 ;
|
||||
m_nCalcTabId = GDB_ID_NULL ;
|
||||
m_nCalcHeadId = GDB_ID_NULL ;
|
||||
m_nCalcExitId = GDB_ID_NULL ;
|
||||
m_nCalcToolId = GDB_ID_NULL ;
|
||||
m_dCalcRot1W = 1 ;
|
||||
m_dCalcRot1W = ROT1_WEIGHT_DFLT ;
|
||||
m_dSingConeAng = SING_CONE_ANG_DFLT ;
|
||||
m_bCalcMaxDeltaR2On1 = true ;
|
||||
m_nCalcSolCh = MCH_SCC_NONE ;
|
||||
m_bSolChExact = false ;
|
||||
m_dCalcTLen = 0 ;
|
||||
m_dCalcTRad = 0 ;
|
||||
m_dCalcTOvLen = 0 ;
|
||||
@@ -58,6 +64,8 @@ Machine::Machine( void)
|
||||
m_nHeadRotAxes = 0 ;
|
||||
m_nHeadSpecRotAxis = -1 ;
|
||||
m_frLinAx.Reset( false) ;
|
||||
m_frRobot.Reset( false) ;
|
||||
m_nCalcChainType = KIN_CHAIN_NONE ;
|
||||
m_nMachineLook = MCH_LOOK_NONE ;
|
||||
}
|
||||
|
||||
@@ -83,6 +91,7 @@ Machine::Clear( void)
|
||||
// reset membri
|
||||
m_pMchMgr = nullptr ;
|
||||
m_pGeomDB = nullptr ;
|
||||
m_nContextId = 0 ;
|
||||
m_sName.clear() ;
|
||||
m_sMachineDir.clear() ;
|
||||
m_nGroupId = GDB_ID_NULL ;
|
||||
@@ -102,6 +111,7 @@ Machine::Init( const string& sMachineName, const string& sMachineDir, MachMgr* p
|
||||
return false ;
|
||||
m_pMchMgr = pMchMgr ;
|
||||
m_pGeomDB = m_pMchMgr->GetGeomDB() ;
|
||||
m_nContextId = m_pMchMgr->GetContextId() ;
|
||||
// verifico direttorio dati macchina
|
||||
m_sMachineDir = sMachineDir ;
|
||||
if ( ! ExistsDirectory( m_sMachineDir))
|
||||
@@ -131,16 +141,16 @@ Machine::Init( const string& sMachineName, const string& sMachineDir, MachMgr* p
|
||||
// in caso di errore, cancello tutta la geometria
|
||||
if ( ! bOk) {
|
||||
m_pGeomDB->Erase( m_nGroupId) ;
|
||||
m_pGeomDB->Erase( m_nTempGroupId) ;
|
||||
m_nGroupId = GDB_ID_NULL ;
|
||||
m_nTempGroupId = GDB_ID_NULL ;
|
||||
m_sName.clear() ;
|
||||
m_sMachineDir.clear() ;
|
||||
}
|
||||
// imposto stato di visualizzazione
|
||||
m_nMachineLook = ( bOk ? MCH_LOOK_ALL : MCH_LOOK_NONE) ;
|
||||
// metto tutti gli assi in posizione home
|
||||
bOk = bOk && ResetAllAxesPos() ;
|
||||
bOk = bOk && ResetAllAxesPos( true, true) ;
|
||||
// reset catena cinematica corrente
|
||||
m_nCalcChainType = KIN_CHAIN_NONE ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
@@ -209,7 +219,7 @@ Machine::AdjustAuxGeometry( const STRVECTOR& vsAux, int nLay)
|
||||
bool
|
||||
Machine::LoadMachineTable( const string& sName, const string& sParent, int nType,
|
||||
const Point3d& ptRef1, double dCoeffX, double dCoeffY, double dCoeffZ,
|
||||
const string& sGeo, const STRVECTOR& vsAux)
|
||||
const STRVECTOR& vsColl, const string& sGeo, const STRVECTOR& vsAux)
|
||||
{
|
||||
// recupero pezzo e layer della geometria originale della tavola
|
||||
string sPart, sLay ;
|
||||
@@ -248,7 +258,7 @@ Machine::LoadMachineTable( const string& sName, const string& sParent, int nType
|
||||
Table* pTab = new(nothrow) Table ;
|
||||
if ( pTab == nullptr)
|
||||
return false ;
|
||||
pTab->Set( sName, nType, ptRef1, b3Area1) ;
|
||||
pTab->Set( sName, nType, ptRef1, b3Area1, vsColl) ;
|
||||
m_pGeomDB->SetUserObj( nLay, pTab) ;
|
||||
// lo inserisco nel dizionario dei gruppi della macchina
|
||||
return m_mapGroups.emplace( sName, nLay).second ;
|
||||
@@ -287,8 +297,8 @@ Machine::AdjustTable( int nLay, const Point3d& ptRef1)
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::LoadMachineAxis( const string& sName, const string& sParent, const string& sToken, bool bInvert,
|
||||
double dOffset, int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke,
|
||||
double dHome, bool bAdjustAux, const string& sGeo, const STRVECTOR& vsAux)
|
||||
double dOffset, int nType, int nUse, const Point3d& ptPos, const Vector3d& vtDir,
|
||||
const STROKE& Stroke, double dHome, bool bAdjustAux, const string& sGeo, const STRVECTOR& vsAux)
|
||||
{
|
||||
// verifico sia di tipo ammesso
|
||||
if ( nType != MCH_AT_LINEAR && nType != MCH_AT_ROTARY) {
|
||||
@@ -328,7 +338,7 @@ Machine::LoadMachineAxis( const string& sName, const string& sParent, const stri
|
||||
Axis* pAxis = new(nothrow) Axis ;
|
||||
if ( pAxis == nullptr)
|
||||
return false ;
|
||||
pAxis->Set( sName, sToken, bInvert, dOffset, nType, ptPos, vtDir, Stroke, dHome) ;
|
||||
pAxis->Set( sName, sToken, bInvert, dOffset, nType, nUse, ptPos, vtDir, Stroke, dHome) ;
|
||||
m_pGeomDB->SetUserObj( nLay, pAxis) ;
|
||||
// verifico il vettore rappresentativo dell'asse
|
||||
if ( ! AdjustAxis( nLay, sPart, sName, nType, ptPos, vtDir, bAdjustAux))
|
||||
@@ -441,8 +451,16 @@ Machine::ModifyMachineAxisPosition( const string& sName, const Point3d& ptPos)
|
||||
Axis* pAx = GetAxis( nAxGrp) ;
|
||||
if ( pAx == nullptr)
|
||||
return false ;
|
||||
// se valore dell'asse non nullo, lo annullo
|
||||
double dCurrVal = pAx->GetCurrVal() ;
|
||||
if ( abs( dCurrVal) > EPS_ZERO)
|
||||
SetAxisPos( sName, 0, false) ;
|
||||
// eseguo la modifica
|
||||
return pAx->Modify( ptPos, m_dAxisMaxAdjust) ;
|
||||
bool bOk = pAx->Modify( ptPos, m_dAxisMaxAdjust) ;
|
||||
// ripristino l'asse al valore corrente
|
||||
if ( abs( dCurrVal) > EPS_ZERO)
|
||||
SetAxisPos( sName, dCurrVal, false) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -458,8 +476,16 @@ Machine::ModifyMachineAxisDirection( const string& sName, const Vector3d& vtDir)
|
||||
Axis* pAx = GetAxis( nAxGrp) ;
|
||||
if ( pAx == nullptr)
|
||||
return false ;
|
||||
// se valore dell'asse non nullo, lo annullo
|
||||
double dCurrVal = pAx->GetCurrVal() ;
|
||||
if ( abs( dCurrVal) > EPS_ZERO)
|
||||
SetAxisPos( sName, 0, false) ;
|
||||
// eseguo la modifica
|
||||
return pAx->Modify( vtDir, m_dAxisMaxRotAdj) ;
|
||||
bool bOk = pAx->Modify( vtDir, m_dAxisMaxRotAdj) ;
|
||||
// ripristino l'asse al valore corrente
|
||||
if ( abs( dCurrVal) > EPS_ZERO)
|
||||
SetAxisPos( sName, dCurrVal, false) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -528,7 +554,7 @@ Machine::LoadMachineStdHead( const string& sName, const string& sParent, const s
|
||||
Head* pHead = new(nothrow) Head ;
|
||||
if ( pHead == nullptr)
|
||||
return false ;
|
||||
pHead->Set( sName, MCH_HT_STD, 1, sHSet, vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
|
||||
pHead->Set( sName, MCH_HT_STD, 1, sHSet, 0, vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
|
||||
m_pGeomDB->SetUserObj( nLay, pHead) ;
|
||||
// aggiorno la testa capostipite
|
||||
if ( ! AddHeadToSet( sHSet, sName))
|
||||
@@ -548,7 +574,7 @@ Machine::LoadMachineStdHead( const string& sName, const string& sParent, const s
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::LoadMachineMultiHead( const string& sName, const string& sParent, const string& sHSet,
|
||||
const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
|
||||
int nSelectType, const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
|
||||
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
|
||||
const string& sGeo, const STRVECTOR& vsAux)
|
||||
{
|
||||
@@ -577,7 +603,8 @@ Machine::LoadMachineMultiHead( const string& sName, const string& sParent, const
|
||||
Head* pHead = new(nothrow) Head ;
|
||||
if ( pHead == nullptr)
|
||||
return false ;
|
||||
pHead->Set( sName, MCH_HT_MULTI, int( vMuExit.size()), sHSet, vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
|
||||
pHead->Set( sName, MCH_HT_MULTI, int( vMuExit.size()), sHSet, nSelectType,
|
||||
vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
|
||||
m_pGeomDB->SetUserObj( nLay, pHead) ;
|
||||
// aggiorno la testa capostipite
|
||||
if ( ! AddHeadToSet( sHSet, sName))
|
||||
@@ -624,7 +651,7 @@ Machine::LoadMachineSpecialHead( const string& sName, const string& sParent, con
|
||||
Head* pHead = new(nothrow) Head ;
|
||||
if ( pHead == nullptr)
|
||||
return false ;
|
||||
pHead->Set( sName, MCH_HT_SPECIAL, 1, sHSet, vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
|
||||
pHead->Set( sName, MCH_HT_SPECIAL, 1, sHSet, 0, vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
|
||||
m_pGeomDB->SetUserObj( nLay, pHead) ;
|
||||
// aggiorno la testa capostipite
|
||||
if ( ! AddHeadToSet( sHSet, sName))
|
||||
@@ -643,9 +670,9 @@ Machine::LoadMachineSpecialHead( const string& sName, const string& sParent, con
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::LoadMachineTcPos( const string& sName, const string& sParent,
|
||||
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
|
||||
const string& sGeo, const STRVECTOR& vsAux)
|
||||
Machine::LoadMachineStdTcPos( const string& sName, const string& sParent,
|
||||
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
|
||||
const string& sGeo, const STRVECTOR& vsAux)
|
||||
{
|
||||
// recupero pezzo e layer della geometria originale della posizione nel cambio utensile
|
||||
string sPart, sLay ;
|
||||
@@ -685,6 +712,48 @@ Machine::LoadMachineTcPos( const string& sName, const string& sParent,
|
||||
return m_mapGroups.emplace( sName, nLay).second ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::LoadMachineMultiTcPos( const string& sName, const string& sParent,
|
||||
const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
|
||||
const string& sGeo, const STRVECTOR& vsAux)
|
||||
{
|
||||
// recupero pezzo e layer della geometria originale della posizione nel cambio utensile
|
||||
string sPart, sLay ;
|
||||
Split( sGeo, "/", true, sPart, sLay) ;
|
||||
// cerco il gruppo nella geometria originale
|
||||
int nPart = m_pGeomDB->GetFirstNameInGroup( m_nTempGroupId, sPart) ;
|
||||
int nLay = m_pGeomDB->GetFirstNameInGroup( nPart, sLay) ;
|
||||
if ( nLay == GDB_ID_NULL)
|
||||
return false ;
|
||||
// cerco il gruppo padre per spostarvelo
|
||||
int nParentId = GetGroup( sParent) ;
|
||||
if ( nParentId == GDB_ID_NULL ||
|
||||
! m_pGeomDB->RelocateGlob( nLay, nParentId, GDB_LAST_SON))
|
||||
return false ;
|
||||
// sistemo lo stato di visualizzazione
|
||||
m_pGeomDB->SetStatus( nLay, GDB_ST_ON) ;
|
||||
// gli assegno il nome
|
||||
m_pGeomDB->SetName( nLay, sName) ;
|
||||
// sistemo la geometria ausiliaria
|
||||
if ( ! AdjustAuxGeometry( vsAux, nLay))
|
||||
return false ;
|
||||
// installo e inizializzo il gestore della posizione nel cambio utensile
|
||||
TcPos* pTcPos = new(nothrow) TcPos ;
|
||||
if ( pTcPos == nullptr)
|
||||
return false ;
|
||||
pTcPos->Set( sName, vtADir) ;
|
||||
m_pGeomDB->SetUserObj( nLay, pTcPos) ;
|
||||
// sistemo il riferimento dell'uscita rispetto alla direzione ausiliaria
|
||||
if ( ! AdjustExitFrames( nLay, vMuExit, vtADir))
|
||||
return false ;
|
||||
// trasformazione del riferimento di uscita in gruppo di uscita
|
||||
if ( ! CreateExitGroups( nLay, vMuExit))
|
||||
return false ;
|
||||
// lo inserisco nel dizionario dei gruppi della macchina
|
||||
return m_mapGroups.emplace( sName, nLay).second ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::GetGroup( const string& sGroup) const
|
||||
@@ -918,7 +987,7 @@ Machine::CreateExitGroups( int nLay, const MUEXITVECTOR& vMuExit)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
Vector3d vtRotAx = vtTDir ^ vtDirN ; vtRotAx.Normalize() ;
|
||||
Vector3d vtRotAx = vtTDir ^ vtDirN ; vtRotAx.Normalize( EPS_ZERO) ;
|
||||
string sOut = " Exit " + sName + " rotation = (" + ToString( dAngRot) + "/" + ToString( vtRotAx) + ")" ;
|
||||
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str()) ;
|
||||
vtRotAx.ToLoc( frHead) ;
|
||||
@@ -940,8 +1009,8 @@ Machine::CreateExitGroups( int nLay, const MUEXITVECTOR& vMuExit)
|
||||
m_pGeomDB->SetName( nGT, sName) ;
|
||||
// copio le info
|
||||
m_pGeomDB->CopyAllInfoFrom( nGT, nT) ;
|
||||
// assegno info per eventuale movimento
|
||||
m_pGeomDB->SetInfo( nGT, "Val", 0) ;
|
||||
// assegno info per eventuale movimento (sempre in Z globale)
|
||||
m_pGeomDB->SetInfo( nGT, MCH_EXIT_VAL, 0) ;
|
||||
// installo e inizializzo il gestore dell'uscita
|
||||
Exit* pExit = new(nothrow) Exit ;
|
||||
if ( pExit == nullptr)
|
||||
@@ -976,7 +1045,11 @@ Machine::ModifyMachineExitPosition( const string& sHead, int nExit, const Point3
|
||||
if ( pExit == nullptr)
|
||||
return false ;
|
||||
// eseguo la modifica
|
||||
return pExit->Modify( ptPos, m_dExitMaxAdjust) ;
|
||||
if ( ! pExit->Modify( ptPos, m_dExitMaxAdjust))
|
||||
return false ;
|
||||
// eventuale aggiornamento variabile lua EMC.EXITPOS con la nuova posizione
|
||||
LuaSetGlobVar( "EMC.EXITPOS", ptPos) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -1000,6 +1073,8 @@ Machine::SetLook( int nFlag)
|
||||
nTabId = GetFirstTable() ;
|
||||
if ( nTabId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// il gruppo tavola corrente deve essere sempre visibile
|
||||
m_pGeomDB->SetStatus( nTabId, GDB_ST_ON) ;
|
||||
// nascondo o visualizzo i fratelli e tutti i fratelli degli ascendenti della tavola
|
||||
bool bTabOnly = ( nFlag != MCH_LOOK_ALL) ;
|
||||
int nTabCurrId = nTabId ;
|
||||
|
||||
@@ -50,25 +50,48 @@ class Machine
|
||||
int GetAxisId( const std::string& sAxis) const
|
||||
{ int nId = GetGroup( sAxis) ;
|
||||
return ( IsAxisGroup( nId) ? nId : GDB_ID_NULL) ; }
|
||||
bool GetAxisName( int nAxId, std::string& sAxis) const ;
|
||||
int GetHeadId( const std::string& sHead) const
|
||||
{ int nId = GetGroup( sHead) ;
|
||||
return ( IsHeadGroup( nId) ? nId : GDB_ID_NULL) ; }
|
||||
int GetExitId( const std::string& sHead, int nExit) const
|
||||
int GetExitId( const std::string& sHead, int nExit) const
|
||||
{ int nHeadId = GetHeadId( sHead) ;
|
||||
int nId = ( m_pGeomDB != nullptr ? m_pGeomDB->GetFirstNameInGroup( nHeadId, MCH_EXIT + ToString( nExit)) : GDB_ID_NULL) ;
|
||||
return ( IsExitGroup( nId) ? nId : GDB_ID_NULL) ; }
|
||||
int GetTcPosId( const std::string& sTcPos) const
|
||||
{ int nId = GetGroup( sTcPos) ;
|
||||
return ( IsTcPosGroup( nId) ? nId : GDB_ID_NULL) ; }
|
||||
bool IsBaseGroup( int nGroup) const ;
|
||||
bool IsAxisGroup( int nGroup) const
|
||||
{ return ( GetAxis( nGroup) != nullptr) ; }
|
||||
bool IsLinearAxisGroup( int nGroup) const ;
|
||||
bool IsRotaryAxisGroup( int nGroup) const ;
|
||||
bool IsTableGroup( int nGroup) const
|
||||
{ return ( GetTable( nGroup) != nullptr) ; }
|
||||
bool IsHeadGroup( int nGroup) const
|
||||
{ return ( GetHead( nGroup) != nullptr) ; }
|
||||
bool IsTcPosGroup( int nGroup) const
|
||||
{ return ( GetTcPos( nGroup) != nullptr) ; }
|
||||
bool IsExitGroup( int nGroup) const
|
||||
{ return ( GetExit( nGroup) != nullptr) ; }
|
||||
bool GetAllAxesIds( INTVECTOR& vIds) const ;
|
||||
bool GetAllTablesNames( STRVECTOR& vNames) const ;
|
||||
bool GetAllAxesNames( STRVECTOR& vNames) const ;
|
||||
bool GetAllHeadsNames( STRVECTOR& vNames) const ;
|
||||
bool GetAllTcPosNames( STRVECTOR& vNames) const ;
|
||||
int GetFirstTable( void) const ;
|
||||
int GetHeadExitCount( const std::string& sHead) const ;
|
||||
int GetHeadExitPosDirAux( const std::string& sHead, int nExit, Point3d& ptPos, Vector3d& vtDir, Vector3d& vtAux) const ;
|
||||
int GetHeadSolCh( const std::string& sHead) const ;
|
||||
int GetHeadSelectType(const std::string& sHead) const ;
|
||||
double GetAngDeltaMinForHome( void) const
|
||||
{ return m_dAngDeltaMinForHome ; }
|
||||
bool GetMultiProcess( int nOpt = 1) const
|
||||
{ return ( m_nMultiProcess >= nOpt) ; }
|
||||
int GetLinkAxesMoveOrder( void) const
|
||||
{ return m_nLinkAxesMoveOrder ; }
|
||||
bool GetNewLinkMgr( int nOpt = 1) const
|
||||
{ return ( m_nNewLinkMgr >= nOpt || m_nCalcChainType == KIN_CHAIN_ROBOT) ; }
|
||||
bool LoadTool( const std::string& sHead, int nExit, const std::string& sTool) ;
|
||||
bool GetLoadedTool( const std::string& sHead, int nExit, std::string& sTool) const ;
|
||||
bool UnloadTool( const std::string& sHead, int nExit) ;
|
||||
@@ -77,17 +100,21 @@ class Machine
|
||||
bool LoadAllTools( void) ;
|
||||
bool UnloadAllTools( void) ;
|
||||
bool ResetHeadSet( const std::string& sHead) ;
|
||||
const STRVECTOR& GetHSet( const std::string& sHead) const ;
|
||||
bool GetAxisToken( const std::string& sAxis, std::string& sToken) const ;
|
||||
bool GetAxisInvert( const std::string& sAxis, bool& bInvert) const ;
|
||||
bool GetAxisOffset( const std::string& sAxis, double& dOffset) const ;
|
||||
bool GetAxisType( const std::string& sAxis, bool& bLinear) const ;
|
||||
bool SetAxisPos( const std::string& sAxis, double dVal, double* pdNewVal = nullptr) ;
|
||||
bool GetAxisDir( const std::string& sAxis, Vector3d& vtDir) const ;
|
||||
bool SetAxisPos( const std::string& sAxis, double dVal, bool bInStroke = true, double* pdNewVal = nullptr) ;
|
||||
bool GetAxisPos( const std::string& sAxis, double& dVal) const ;
|
||||
bool GetAxisMin( const std::string& sAxis, double& dMin) const ;
|
||||
bool GetAxisMax( const std::string& sAxis, double& dMax) const ;
|
||||
bool GetAxisHomePos( const std::string& sAxis, double& dHomeVal) const ;
|
||||
bool IsDispositionAxis( int nAxisId, int nTableId = GDB_ID_NULL) const ;
|
||||
bool IsDispositionAxis( const std::string& sAxis, const std::string& sTable = "") const ;
|
||||
bool ResetAxisPos( const std::string& sAxis) ;
|
||||
bool ResetAllAxesPos( void) ;
|
||||
bool ResetAllAxesPos( bool bStdAxes, bool bDispAxes) ;
|
||||
bool SetCurrTable( const std::string& sTable) ;
|
||||
bool ResetCurrTable( void) ;
|
||||
int GetCurrTable( void) const ;
|
||||
@@ -96,6 +123,7 @@ class Machine
|
||||
bool GetCurrTableArea1( BBox3d& b3Area1) const ;
|
||||
bool GetCurrTableDeltaRef1( Vector3d& vtDelta1) const ;
|
||||
bool GetCurrTableIsTilting( bool& bTilting, Vector3d& vtTiltingAx) const ;
|
||||
bool GetCurrTableCollGroups( INTVECTOR& vIds) const ;
|
||||
bool SetCurrTool( const std::string& sTool, const std::string& sHead, int nExit) ;
|
||||
bool ResetCurrTool( void) ;
|
||||
int GetCurrTool( void) const ;
|
||||
@@ -105,9 +133,14 @@ class Machine
|
||||
int GetCurrExit( void) const ;
|
||||
bool GetCurrExit( int& nExit) const ;
|
||||
bool GetCurrHeadCollGroups( INTVECTOR& vIds) const ;
|
||||
bool IsCurrToolFloating( void) const ;
|
||||
double GetCurrRot1W( void) const
|
||||
{ return m_dCalcRot1W ; }
|
||||
bool GetCurrMaxDeltaR2OnFirst( void) const
|
||||
bool SetSingConeAng( double dAng)
|
||||
{ m_dSingConeAng = dAng ; return true ;}
|
||||
double GetCurrSingConeAng( void) const
|
||||
{ return m_dSingConeAng ; }
|
||||
bool GetCurrCalcMaxDeltaR2OnFirst( void) const
|
||||
{ return m_bCalcMaxDeltaR2On1 ; }
|
||||
std::string GetKinematicAxis( int nInd) const ;
|
||||
bool BlockKinematicRotAxis( const std::string& sName, double dVal) ;
|
||||
@@ -117,12 +150,15 @@ class Machine
|
||||
bool IsKinematicRotAxisBlocked( int nInd) const ;
|
||||
bool GetKinematicRotAxisBlocked( int nInd, std::string& sName, double& dVal) const ;
|
||||
bool SetSolCh( int nScc, bool bExact) ;
|
||||
bool GetSolCh( int& nScc, bool& bExact)
|
||||
{ nScc = m_nCalcSolCh ; bExact = m_bSolChExact ; return true ; }
|
||||
int GetCurrLinAxes( void) const ;
|
||||
int GetCurrRotAxes( void) const ;
|
||||
bool GetCurrAxisName( int nInd, std::string& sAxName) const ;
|
||||
bool GetAllCurrAxesName( STRVECTOR& vAxName) const ;
|
||||
bool GetAllCurrAxesNames( STRVECTOR& vAxName) const ;
|
||||
bool GetCurrAxisToken( int nInd, std::string& sAxToken) const ;
|
||||
bool GetAllCurrAxesToken( STRVECTOR& vAxToken) const ;
|
||||
bool GetAllCurrAxesTokens( STRVECTOR& vAxToken) const ;
|
||||
bool GetCurrAxisType( int nInd, bool& bLinear, bool& bHead) const ;
|
||||
bool GetCurrAxisMin( int nInd, double& dMin) const ;
|
||||
bool GetCurrAxisMax( int nInd, double& dMax) const ;
|
||||
bool GetCurrAxisOffset( int nInd, double& dOffset) const ;
|
||||
@@ -131,16 +167,18 @@ class Machine
|
||||
bool GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const ;
|
||||
const Frame3d& GetCurrLinAxesFrame( void) const
|
||||
{ return m_frLinAx ; }
|
||||
bool GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const ;
|
||||
int GetCurrKinematicChainType( void) const
|
||||
{ return m_nCalcChainType ; }
|
||||
bool GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
int& nStat, DBLVECTOR& vAng1, DBLVECTOR& vAng2) const ;
|
||||
bool GetPositions( const Point3d& ptP, const DBLVECTOR& vAng,
|
||||
int& nStat, double& dX, double& dY, double& dZ) const ;
|
||||
double& dX, double& dY, double& dZ) const ;
|
||||
bool GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
DBLVECTOR& vAng1, DBLVECTOR& vAng2) const ;
|
||||
bool GetNoseFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng,
|
||||
Point3d& ptNose) const ;
|
||||
bool GetTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng,
|
||||
bool bBottom, bool bOverall, Point3d& ptTip) const ;
|
||||
bool bOverall, bool bBottom, bool bBack, Point3d& ptTip) const ;
|
||||
bool GetToolDirFromAngles( const DBLVECTOR& vAng, Vector3d& vtDir) const ;
|
||||
bool GetAuxDirFromAngles( const DBLVECTOR& vAng, Vector3d& vtDir) const ;
|
||||
bool GetPartDirFromAngles( const Vector3d& vtPart, const DBLVECTOR& vAng, Vector3d& vtDir) const ;
|
||||
@@ -192,11 +230,11 @@ class Machine
|
||||
bool AdjustAuxGeometry( const STRVECTOR& vsAux, int nLay) ;
|
||||
bool LoadMachineTable( const std::string& sName, const std::string& sParent, int nType,
|
||||
const Point3d& ptRef1, double dCoeffX, double dCoeffY, double dCoeffZ,
|
||||
const std::string& sGeo, const STRVECTOR& vsAux) ;
|
||||
const STRVECTOR& vsColl, const std::string& sGeo, const STRVECTOR& vsAux) ;
|
||||
bool AdjustTable( int nLay, const Point3d& ptRef1) ;
|
||||
bool LoadMachineAxis( const std::string& sName, const std::string& sParent, const std::string& sToken, bool bInvert,
|
||||
double dOffset, int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke,
|
||||
double dHome, bool bAdjustAux, const std::string& sGeo, const STRVECTOR& vsAux) ;
|
||||
double dOffset, int nType, int nUse, const Point3d& ptPos, const Vector3d& vtDir,
|
||||
const STROKE& Stroke, double dHome, bool bAdjustAux, const std::string& sGeo, const STRVECTOR& vsAux) ;
|
||||
bool AdjustAxis( int nLay, const std::string& sPart, const std::string& sName,
|
||||
int nType, const Point3d& ptPos, const Vector3d& vtDir, bool bAdjustAux) ;
|
||||
bool ModifyMachineAxisPosition( const std::string& sName, const Point3d& ptPos) ;
|
||||
@@ -208,49 +246,43 @@ class Machine
|
||||
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
|
||||
const std::string& sGeo, const STRVECTOR& vsAux) ;
|
||||
bool LoadMachineMultiHead( const std::string& sName, const std::string& sParent, const std::string& sHSet,
|
||||
const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
|
||||
int nSelectType, const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
|
||||
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
|
||||
const std::string& sGeo, const STRVECTOR& vsAux) ;
|
||||
bool LoadMachineSpecialHead( const std::string& sName, const std::string& sParent, const std::string& sHSet,
|
||||
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
|
||||
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
|
||||
const std::string& sGeo, const STRVECTOR& vsAux) ;
|
||||
bool LoadMachineTcPos( const std::string& sName, const std::string& sParent,
|
||||
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
|
||||
const std::string& sGeo, const STRVECTOR& vsAux) ;
|
||||
bool LoadMachineStdTcPos( const std::string& sName, const std::string& sParent,
|
||||
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
|
||||
const std::string& sGeo, const STRVECTOR& vsAux) ;
|
||||
bool LoadMachineMultiTcPos( const std::string& sName, const std::string& sParent,
|
||||
const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
|
||||
const std::string& sGeo, const STRVECTOR& vsAux) ;
|
||||
int GetGroup( const std::string& sGroup) const ;
|
||||
bool IsBaseGroup( int nGroup) const ;
|
||||
Axis* GetAxis( int nGroup) const ;
|
||||
bool IsAxisGroup( int nGroup) const
|
||||
{ return ( GetAxis( nGroup) != nullptr) ; }
|
||||
bool IsLinearAxisGroup( int nGroup) const ;
|
||||
bool IsRotaryAxisGroup( int nGroup) const ;
|
||||
Table* GetTable( int nGroup) const ;
|
||||
bool IsTableGroup( int nGroup) const
|
||||
{ return ( GetTable( nGroup) != nullptr) ; }
|
||||
Head* GetHead( int nGroup) const ;
|
||||
bool IsHeadGroup( int nGroup) const
|
||||
{ return ( GetHead( nGroup) != nullptr) ; }
|
||||
TcPos* GetTcPos( int nGroup) const ;
|
||||
bool IsTcPosGroup( int nGroup) const
|
||||
{ return ( GetTcPos( nGroup) != nullptr) ; }
|
||||
Exit* GetExit( int nGroup) const ;
|
||||
bool IsExitGroup( int nGroup) const
|
||||
{ return ( GetExit( nGroup) != nullptr) ; }
|
||||
bool AddHeadToSet( const std::string& sHSet, const std::string& sName) ;
|
||||
const STRVECTOR& GetHSet( const std::string& sHead) const ;
|
||||
bool EnableHeadInSet( const std::string& sHead) ;
|
||||
bool LoadTool( Exit* pExit, const std::string& sTool) ;
|
||||
bool ModifyMachineHeadAuxDirection( const std::string& sHead, const Vector3d& vtADir) ;
|
||||
bool AdjustExitFrames( int nLay, const MUEXITVECTOR& vMuExit, const Vector3d& vtADir) ;
|
||||
bool CreateExitGroups( int nLay, const MUEXITVECTOR& vMuExit) ;
|
||||
bool ModifyMachineExitPosition( const std::string& sHead, int nExit, const Point3d& ptPos) ;
|
||||
bool ClearKinematicChain( void) ;
|
||||
bool CalculateKinematicChain( void) ;
|
||||
bool AddKinematicAxis( bool bOnHead, int nId) ;
|
||||
bool GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
const Vector3d& vtDirH, const Vector3d& vtDirI,
|
||||
int nNumRotAx, const KinAxis& RotAx1, const KinAxis& RotAx2,
|
||||
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const ;
|
||||
bool GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
const Vector3d& vtDirH, const Vector3d& vtDirI,
|
||||
const KinAxis& RotAx1, const KinAxis& RotAx2, const KinAxis& RotAx3,
|
||||
int& nStat, double& dAngA1, double& dAngB1, double& dAngC1, double& dAngA2, double& dAngB2, double& dAngC2) const ;
|
||||
bool GetDirection( const Vector3d& vtDir, const DBLVECTOR& vAng, Vector3d& vtNew) const ;
|
||||
bool GetBackDirection( const Vector3d& vtDir, const DBLVECTOR& vAng, Vector3d& vtNew) const ;
|
||||
bool GetSccDir( int nSolCh, const Vector3d& vtDirA, Vector3d& vtDirScc) const ;
|
||||
@@ -267,6 +299,7 @@ class Machine
|
||||
// generali
|
||||
MachMgr* m_pMchMgr ; // puntatore al gestore di tutte le lavorazioni
|
||||
IGeomDB* m_pGeomDB ; // puntatore al DB geometrico
|
||||
int m_nContextId ; // indice contesto corrente (1-based)
|
||||
LuaMgr m_LuaMgr ; // interprete lua della macchina
|
||||
Writer m_Writer ; // scrittore di file di testo
|
||||
// dati macchina
|
||||
@@ -280,6 +313,9 @@ class Machine
|
||||
double m_dExitMaxAdjust ; // massimo aggiustamento uscita da geometria a descrizione cinematica
|
||||
double m_dExitMaxRotAdj ; // massima rotazione di aggiustamento uscita da geometria a descrizione cinematica
|
||||
double m_dAngDeltaMinForHome ; // minima differenza angolare da valore precedente per scegliere di stare vicino a home
|
||||
int m_nMultiProcess ; // codice di macchina multi-processo (con stima speciale e simulazione ad hoc)
|
||||
int m_nLinkAxesMoveOrder ; // codice ordine interpolazione assi nei collegamenti (0=interpolati, ...)
|
||||
int m_nNewLinkMgr ; // codice del nuovo gestore link tra lavorazioni (0=vecchio, 1=nuovo)
|
||||
INTVECTOR m_vLinkedRawParts ; // elenco dei grezzi agganciati a gruppi della macchina
|
||||
INTVECTOR m_vLinkedFixtures ; // elenco dei bloccaggi agganciati a gruppi della macchina
|
||||
INTVECTOR m_vLinkedParts ; // elenco dei pezzi agganciati a gruppi della macchina
|
||||
@@ -289,6 +325,7 @@ class Machine
|
||||
int m_nCalcExitId ; // uscita corrente per calcoli
|
||||
int m_nCalcToolId ; // utensile corrente per calcoli
|
||||
double m_dCalcRot1W ; // peso del primo asse rotante per i confronti
|
||||
double m_dSingConeAng ; // angolo di apertura del cono di direzioni considerate coincidenti con asse singolare
|
||||
bool m_bCalcMaxDeltaR2On1 ; // flag utilizzo controllo massimo delta secondo asse rotante su inizio lavorazione
|
||||
int m_nCalcSolCh ; // criterio di scelta della soluzione
|
||||
bool m_bSolChExact ; // flag per scelta soluzione da soddisfare esattamente
|
||||
@@ -307,6 +344,10 @@ class Machine
|
||||
KINAXISVECTOR m_vCalcLinAx ; // vettore assi lineari attivi per calcoli
|
||||
KINAXISVECTOR m_vCalcRotAx ; // vettore assi rotanti attivi per calcoli
|
||||
Frame3d m_frLinAx ; // sistema di riferimento definito dagli assi lineari
|
||||
Frame3d m_frRobot ; // sistema di riferimento canonico del robot
|
||||
int m_nCalcChainType ; // tipologia testa attiva (nulla, centro di lavoro o robot)
|
||||
Point3d m_ptWristCen ; // centro del polso sferico nel riferimento testa/uscita di calcolo
|
||||
Vector3d m_vtWristRef ; // direzione del polso sferico nel riferimento testa/uscita di calcolo
|
||||
mutable OutStroke m_OutstrokeInfo ; // informazioni su ultima extra corsa
|
||||
// stato di visualizzazione
|
||||
int m_nMachineLook ; // stato di visualizzazione della macchina
|
||||
@@ -325,6 +366,8 @@ class Machine
|
||||
static int LuaEmtMultiHead( lua_State* L) ;
|
||||
static int LuaEmtSpecialHead( lua_State* L) ;
|
||||
static int LuaEmtTcPos( lua_State* L) ;
|
||||
static int LuaEmtStdTcPos( lua_State* L) ;
|
||||
static int LuaEmtMultiTcPos( lua_State* L) ;
|
||||
static int LuaEmtModifyAxisPosition( lua_State* L) ;
|
||||
static int LuaEmtModifyAxisDirection( lua_State* L) ;
|
||||
static int LuaEmtModifyAxisStroke( lua_State* L) ;
|
||||
@@ -335,9 +378,16 @@ class Machine
|
||||
static int LuaEmtAddRapidMove( lua_State* L) ;
|
||||
static int LuaEmtAddLinearMove( lua_State* L) ;
|
||||
static int LuaEmtAddArcMove( lua_State* L) ;
|
||||
static int LuaEmtAddClimb( lua_State* L) ;
|
||||
static int LuaEmtRemoveClimb( lua_State* L) ;
|
||||
static int LuaEmtAddRise( lua_State* L) ;
|
||||
static int LuaEmtRemoveRise( lua_State* L) ;
|
||||
static int LuaEmtGetMoveType( lua_State* L) ;
|
||||
static int LuaEmtGetAxesPos( lua_State* L) ;
|
||||
static int LuaEmtGetBackAuxDir( lua_State* L) ;
|
||||
static int LuaEmtGetInitialAxesPos( lua_State* L) ;
|
||||
static int LuaEmtGetFinalAxesPos( lua_State* L) ;
|
||||
static int LuaEmtGetCurrAxesHomePos( lua_State* L) ;
|
||||
static int LuaEmtLinkRawPartToGroup( lua_State* L) ;
|
||||
static int LuaEmtGetAllLinkedRawParts( lua_State* L) ;
|
||||
static int LuaEmtUnlinkRawPartFromGroup( lua_State* L) ;
|
||||
@@ -354,12 +404,15 @@ class Machine
|
||||
static int LuaEmtSetWarning( lua_State* L) ;
|
||||
static int LuaEmtAddCollisionObj( lua_State* L) ;
|
||||
static int LuaEmtAddCollisionObjEx( lua_State* L) ;
|
||||
static int LuaEmtRemoveCollisionObj( lua_State* L) ;
|
||||
static int LuaEmtGetCollisionObj( lua_State* L) ;
|
||||
static int LuaEmtExecCollisionCheck( lua_State* L) ;
|
||||
static int LuaEmtOnCollision( lua_State* L) ;
|
||||
static int LuaEmtSetToolForVmill( lua_State* L) ;
|
||||
static int LuaEmtAddToolForVmill( lua_State* L) ;
|
||||
static int LuaEmtEnableToolsForVmill( lua_State* L) ;
|
||||
static int LuaEmtMoveAxes( lua_State* L) ;
|
||||
|
||||
static int LuaEmtSaveCmd( lua_State* L) ;
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -369,15 +422,15 @@ Machine::LuaSetGlobVar( const std::string& sVar, const T& Val)
|
||||
{
|
||||
// imposto contesto corretto
|
||||
int nOldCtx = ExeGetCurrentContext() ;
|
||||
if ( nOldCtx != m_pMchMgr->GetContextId())
|
||||
ExeSetCurrentContext( m_pMchMgr->GetContextId()) ;
|
||||
if ( nOldCtx != m_nContextId)
|
||||
ExeSetCurrentContext( m_nContextId) ;
|
||||
// imposto l'oggetto corrente per Lua
|
||||
Machine* pOldMchLua = m_pMchLua ;
|
||||
m_pMchLua = this ;
|
||||
// eseguo l'assegnamento
|
||||
bool bOk = ::LuaSetGlobVar( m_LuaMgr.GetLuaState(), sVar, Val) ;
|
||||
// ripristino contesto originale
|
||||
if ( nOldCtx != m_pMchMgr->GetContextId())
|
||||
if ( nOldCtx != m_nContextId)
|
||||
ExeSetCurrentContext( nOldCtx) ;
|
||||
// ripristino dell'oggetto corrente per Lua
|
||||
m_pMchLua = pOldMchLua ;
|
||||
@@ -391,15 +444,15 @@ Machine::LuaGetGlobVar( const std::string& sVar, T& Val)
|
||||
{
|
||||
// imposto contesto corretto
|
||||
int nOldCtx = ExeGetCurrentContext() ;
|
||||
if ( nOldCtx != m_pMchMgr->GetContextId())
|
||||
ExeSetCurrentContext( m_pMchMgr->GetContextId()) ;
|
||||
if ( nOldCtx != m_nContextId)
|
||||
ExeSetCurrentContext( m_nContextId) ;
|
||||
// imposto l'oggetto corrente per Lua
|
||||
Machine* pOldMchLua = m_pMchLua ;
|
||||
m_pMchLua = this ;
|
||||
// eseguo la lettura
|
||||
bool bOk = ::LuaGetGlobVar( m_LuaMgr.GetLuaState(), sVar, Val) ;
|
||||
// ripristino contesto originale
|
||||
if ( nOldCtx != m_pMchMgr->GetContextId())
|
||||
if ( nOldCtx != m_nContextId)
|
||||
ExeSetCurrentContext( nOldCtx) ;
|
||||
// ripristino dell'oggetto corrente per Lua
|
||||
m_pMchLua = pOldMchLua ;
|
||||
|
||||
+133
-17
@@ -19,9 +19,54 @@
|
||||
#include "/EgtDev/Include/EGkGeoVector3d.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EGnFileUtils.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetAllAxesIds( INTVECTOR& vIds) const
|
||||
{
|
||||
// reset lista identificativi
|
||||
vIds.clear() ;
|
||||
// ricerca degli assi
|
||||
for ( const auto& snGro : m_mapGroups) {
|
||||
if ( IsAxisGroup( snGro.second))
|
||||
vIds.push_back( snGro.second) ;
|
||||
}
|
||||
// se richiesto, ordino alfabeticamente
|
||||
sort( vIds.begin(), vIds.end()) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetAllAxesNames( STRVECTOR& vNames) const
|
||||
{
|
||||
// reset lista nomi
|
||||
vNames.clear() ;
|
||||
// ricerca degli assi
|
||||
for ( const auto& snGro : m_mapGroups) {
|
||||
if ( IsAxisGroup( snGro.second))
|
||||
vNames.push_back( snGro.first) ;
|
||||
}
|
||||
// se richiesto, ordino alfabeticamente
|
||||
sort( vNames.begin(), vNames.end()) ;
|
||||
return true ;
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetAxisName( int nAxId, string& sName) const
|
||||
{
|
||||
// recupero il relativo gestore
|
||||
const Axis* pAx = GetAxis( nAxId) ;
|
||||
if ( pAx == nullptr)
|
||||
return false ;
|
||||
// recupero il token dell'asse
|
||||
sName = pAx->GetName() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetAxisToken( const string& sAxis, string& sToken) const
|
||||
@@ -30,7 +75,7 @@ Machine::GetAxisToken( const string& sAxis, string& sToken) const
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero il relativo gestore
|
||||
Axis* pAx = GetAxis( GetGroup( sAxis)) ;
|
||||
const Axis* pAx = GetAxis( GetGroup( sAxis)) ;
|
||||
if ( pAx == nullptr)
|
||||
return false ;
|
||||
// recupero il token dell'asse
|
||||
@@ -46,7 +91,7 @@ Machine::GetAxisInvert( const string& sAxis, bool& bInvert) const
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero il relativo gestore
|
||||
Axis* pAx = GetAxis( GetGroup( sAxis)) ;
|
||||
const Axis* pAx = GetAxis( GetGroup( sAxis)) ;
|
||||
if ( pAx == nullptr)
|
||||
return false ;
|
||||
// recupero il flag di inversione dell'asse in visualizzazione
|
||||
@@ -62,7 +107,7 @@ Machine::GetAxisOffset( const string& sAxis, double& dOffset) const
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero il relativo gestore
|
||||
Axis* pAx = GetAxis( GetGroup( sAxis)) ;
|
||||
const Axis* pAx = GetAxis( GetGroup( sAxis)) ;
|
||||
if ( pAx == nullptr)
|
||||
return false ;
|
||||
// recupero il valore di offset dell'asse in visualizzazione
|
||||
@@ -78,7 +123,7 @@ Machine::GetAxisType( const string& sAxis, bool& bLinear) const
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero il relativo gestore
|
||||
Axis* pAx = GetAxis( GetGroup( sAxis)) ;
|
||||
const Axis* pAx = GetAxis( GetGroup( sAxis)) ;
|
||||
if ( pAx == nullptr)
|
||||
return false ;
|
||||
// recupero il tipo dell'asse
|
||||
@@ -88,7 +133,23 @@ Machine::GetAxisType( const string& sAxis, bool& bLinear) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::SetAxisPos( const string& sAxis, double dVal, double* pdNewVal)
|
||||
Machine::GetAxisDir( const string& sAxis, Vector3d& vtDir) const
|
||||
{
|
||||
// controllo GeomDB
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero il relativo gestore
|
||||
const Axis* pAx = GetAxis( GetGroup( sAxis)) ;
|
||||
if ( pAx == nullptr)
|
||||
return false ;
|
||||
// recupero la direzione dell'asse
|
||||
vtDir = pAx->GetDir() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::SetAxisPos( const string& sAxis, double dVal, bool bInStroke, double* pdNewVal)
|
||||
{
|
||||
// controllo GeomDB
|
||||
if ( m_pGeomDB == nullptr)
|
||||
@@ -105,6 +166,15 @@ Machine::SetAxisPos( const string& sAxis, double dVal, double* pdNewVal)
|
||||
double dCurrVal = pAx->GetCurrVal() ;
|
||||
// limiti della corsa
|
||||
STROKE Stroke = pAx->GetStroke() ;
|
||||
// se rotante e corrente, verifico se ci sono limitazioni aggiuntive (dalla testa)
|
||||
if ( ! bLinear) {
|
||||
for ( const auto& CalcRotAx : m_vCalcRotAx) {
|
||||
if ( CalcRotAx.nGrpId == nAxGrp) {
|
||||
Stroke.Min = max( Stroke.Min, CalcRotAx.stroke.Min) ;
|
||||
Stroke.Max = min( Stroke.Max, CalcRotAx.stroke.Max) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// recupero il vettore dell'asse
|
||||
int nV = m_pGeomDB->GetFirstNameInGroup( nAxGrp, sAxis) ;
|
||||
const IGeoVector3d* pGV = GetGeoVector3d( m_pGeomDB->GetGeoObj( nV)) ;
|
||||
@@ -113,11 +183,9 @@ Machine::SetAxisPos( const string& sAxis, double dVal, double* pdNewVal)
|
||||
Point3d ptPos = pGV->GetBase() ;
|
||||
Vector3d vtDir = pGV->GetVector() ;
|
||||
vtDir.Normalize() ;
|
||||
// limito il movimento alla corsa dell'asse
|
||||
if ( dVal > Stroke.Max)
|
||||
dVal = Stroke.Max ;
|
||||
else if ( dVal < Stroke.Min)
|
||||
dVal = Stroke.Min ;
|
||||
// se richiesto, limito il movimento alla corsa dell'asse
|
||||
if ( bInStroke)
|
||||
dVal = Clamp( dVal, Stroke.Min, Stroke.Max) ;
|
||||
// eseguo il movimento
|
||||
if ( bLinear)
|
||||
m_pGeomDB->TranslateGroup( nAxGrp, vtDir * ( dVal - dCurrVal)) ;
|
||||
@@ -138,7 +206,7 @@ Machine::GetAxisPos( const string& sAxis, double& dVal) const
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero il relativo gestore
|
||||
Axis* pAx = GetAxis( GetGroup( sAxis)) ;
|
||||
const Axis* pAx = GetAxis( GetGroup( sAxis)) ;
|
||||
if ( pAx == nullptr)
|
||||
return false ;
|
||||
// recupero la posizione corrente
|
||||
@@ -154,7 +222,7 @@ Machine::GetAxisMin( const string& sAxis, double& dMin) const
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero il gestore dell'asse
|
||||
Axis* pAx = GetAxis( GetGroup( sAxis)) ;
|
||||
const Axis* pAx = GetAxis( GetGroup( sAxis)) ;
|
||||
if ( pAx == nullptr)
|
||||
return false ;
|
||||
// recupero il minimo
|
||||
@@ -170,7 +238,7 @@ Machine::GetAxisMax( const string& sAxis, double& dMax) const
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero il gestore dell'asse
|
||||
Axis* pAx = GetAxis( GetGroup( sAxis)) ;
|
||||
const Axis* pAx = GetAxis( GetGroup( sAxis)) ;
|
||||
if ( pAx == nullptr)
|
||||
return false ;
|
||||
// recupero il massimo
|
||||
@@ -186,7 +254,7 @@ Machine::GetAxisHomePos( const string& sAxis, double& dHomeVal) const
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero il gestore dell'asse
|
||||
Axis* pAx = GetAxis( GetGroup( sAxis)) ;
|
||||
const Axis* pAx = GetAxis( GetGroup( sAxis)) ;
|
||||
if ( pAx == nullptr)
|
||||
return false ;
|
||||
// recupero la posizione home
|
||||
@@ -194,6 +262,50 @@ Machine::GetAxisHomePos( const string& sAxis, double& dHomeVal) const
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::IsDispositionAxis( int nAxisId, int nTableId) const
|
||||
{
|
||||
// se non dichiarato o ausiliario
|
||||
const Axis* pAx = GetAxis( nAxisId) ;
|
||||
if ( pAx == nullptr || pAx->GetUse() == MCH_AU_AUXILIAR)
|
||||
return false ;
|
||||
// se dichiarato di disposizione
|
||||
if ( pAx->GetUse() == MCH_AU_DISPOSITION)
|
||||
return true ;
|
||||
// altrimenti è di tipo generale e va bene solo se dipende direttamente o indirettamente dalla tavola
|
||||
// se direttamente dipendente dalla tavola
|
||||
int nParentId = m_pGeomDB->GetParentId( nAxisId) ;
|
||||
if ( ( nTableId != GDB_ID_NULL && nParentId == nTableId) || IsTableGroup( nParentId))
|
||||
return true ;
|
||||
// altrimenti deve dipendere da asse dipendente dalla tavola
|
||||
if ( ! IsAxisGroup( nParentId))
|
||||
return false ;
|
||||
int nGrParId = m_pGeomDB->GetParentId( nParentId) ;
|
||||
return ( ( nTableId != GDB_ID_NULL && nGrParId == nTableId) || IsTableGroup( nGrParId)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::IsDispositionAxis( const string& sAxis, const string& sTable) const
|
||||
{
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero Id asse
|
||||
int nAxId = GetAxisId( sAxis) ;
|
||||
if ( nAxId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// recupero eventuale Id tavola
|
||||
int nTabId = GDB_ID_NULL ;
|
||||
if ( ! sTable.empty()) {
|
||||
nTabId = GetTableId( sTable) ;
|
||||
if ( nTabId == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// eseguo
|
||||
return IsDispositionAxis( nAxId, nTabId) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::ResetAxisPos( const string& sAxis)
|
||||
@@ -211,13 +323,17 @@ Machine::ResetAxisPos( const string& sAxis)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::ResetAllAxesPos( void)
|
||||
Machine::ResetAllAxesPos( bool bStdAxes, bool bDispAxes)
|
||||
{
|
||||
// ciclo sui gruppi della macchina
|
||||
for ( auto Iter = m_mapGroups.cbegin() ; Iter != m_mapGroups.cend() ; ++ Iter) {
|
||||
if ( IsAxisGroup( Iter->second)) {
|
||||
if ( ! ResetAxisPos( Iter->first))
|
||||
return false ;
|
||||
if ( ( bStdAxes && bDispAxes) ||
|
||||
( bStdAxes && ! IsDispositionAxis( Iter->first)) ||
|
||||
( bDispAxes && IsDispositionAxis( Iter->first))) {
|
||||
if ( ! ResetAxisPos( Iter->first))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
|
||||
+770
-187
File diff suppressed because it is too large
Load Diff
+15
-1
@@ -98,6 +98,18 @@ Machine::GetHeadSolCh( const string& sHead) const
|
||||
return pHead->GetSolCh() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::GetHeadSelectType( const string& sHead) const
|
||||
{
|
||||
// recupero testa
|
||||
Head* pHead = GetHead( GetGroup( sHead)) ;
|
||||
if ( pHead == nullptr)
|
||||
return MCH_SCC_NONE ;
|
||||
// recupero tipo di selezione delle uscite della testa
|
||||
return pHead->GetSelectType() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::LoadTool( const string& sHead, int nExit, const string& sTool)
|
||||
@@ -170,7 +182,7 @@ Machine::LoadTool( Exit* pExit, const string& sTool)
|
||||
if ( nSolidId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// sposto eventuali info relative al porta utensile (ToolHolder) nel gruppo SOLID
|
||||
double dVal ;
|
||||
double dVal ; string sVal ;
|
||||
if ( m_pGeomDB->GetInfo( nTGrpId, TTH_BASE, dVal))
|
||||
m_pGeomDB->SetInfo( nSolidId, TTH_BASE, dVal) ;
|
||||
if ( m_pGeomDB->GetInfo( nTGrpId, TTH_LEN, dVal))
|
||||
@@ -179,6 +191,8 @@ Machine::LoadTool( Exit* pExit, const string& sTool)
|
||||
m_pGeomDB->SetInfo( nSolidId, TTH_DIAM, dVal) ;
|
||||
if ( m_pGeomDB->GetInfo( nTGrpId, TTH_STEM_DIAM, dVal))
|
||||
m_pGeomDB->SetInfo( nSolidId, TTH_STEM_DIAM, dVal) ;
|
||||
if ( m_pGeomDB->GetInfo( nTGrpId, TTH_TYPE, sVal))
|
||||
m_pGeomDB->SetInfo( nSolidId, TTH_TYPE, sVal) ;
|
||||
// sposto il gruppo SOLID nell'uscita ed elimino la sua vecchia base
|
||||
m_pGeomDB->RelocateGlob( nSolidId, nExGrp, GDB_FIRST_SON) ;
|
||||
m_pGeomDB->Erase( nTGrpId) ;
|
||||
|
||||
+301
-27
@@ -1,13 +1,15 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2021
|
||||
// EgalTech 2015-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : MachineLua.cpp Data : 14.10.21 Versione : 2.3j5
|
||||
// File : MachineLua.cpp Data : 01.09.24 Versione : 2.6i1
|
||||
// Contenuto : Implementazione gestione macchina : funzioni Lua.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 06.05.15 DS Creazione modulo.
|
||||
// 26.04.20 DS Aggiunta gestione TcPos.
|
||||
// 05.08.24 DS Aggiunta gestione SpecialEstimate.
|
||||
// 01.09.24 DS SpecialEstimate è diventato MultiProcess.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -34,22 +36,28 @@ static const string FLD_AXISMAXROTADJ = "AxisMaxRotAdj" ;
|
||||
static const string FLD_EXITMAXADJUST = "ExitMaxAdjust" ;
|
||||
static const string FLD_EXITMAXROTADJ = "ExitMaxRotAdj" ;
|
||||
static const string FLD_ANGDELTAMINFORHOME = "AngDeltaMinForHome" ;
|
||||
static const string FLD_MULTIPROCESS = "MultiProcess" ;
|
||||
static const string FLD_LINKAXESMOVEORDER = "LinkAxesMoveOrder" ;
|
||||
static const string FLD_NEWLINKMGR = "NewLinkMgr" ;
|
||||
static const string FLD_NAME = "Name" ;
|
||||
static const string FLD_PARENT = "Parent" ;
|
||||
static const string FLD_GEO = "Geo" ;
|
||||
static const string FLD_AUX = "Aux" ;
|
||||
static const string FLD_TOKEN = "Token" ;
|
||||
static const string FLD_TYPE = "Type" ;
|
||||
static const string FLD_USE = "Use" ;
|
||||
static const string FLD_INVERT = "Invert" ;
|
||||
static const string FLD_AXIS_OFFSET = "Offset" ;
|
||||
static const string FLD_REF1 = "Ref1" ;
|
||||
static const string FLD_SCALE = "Scale" ;
|
||||
static const string FLD_EXIT_NBR = "ExitNbr" ;
|
||||
static const string FLD_POS = "Pos" ;
|
||||
static const string FLD_DIR = "Dir" ;
|
||||
static const string FLD_STROKE = "Stroke" ;
|
||||
static const string FLD_HOME = "Home" ;
|
||||
static const string FLD_ADJUSTAUX = "AdjustAux" ;
|
||||
static const string FLD_HSET = "HSet" ;
|
||||
static const string FLD_SEL_TYPE = "SelType" ;
|
||||
static const string FLD_TDIR = "TDir" ;
|
||||
static const string FLD_ADIR = "ADir" ;
|
||||
static const string FLD_ROT1W = "Rot1W" ;
|
||||
@@ -57,6 +65,7 @@ static const string FLD_MAXDELTAR2ON1 = "MaxDeltaR2OnFirst" ;
|
||||
static const string FLD_ROT2STROKE = "Rot2Stroke" ;
|
||||
static const string FLD_SOLCH = "SolCh" ;
|
||||
static const string FLD_OTHCOLL = "OthColl" ;
|
||||
static const string FLD_COLL = "Coll" ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
Machine* Machine::m_pMchLua = nullptr ;
|
||||
@@ -112,6 +121,13 @@ Machine::LuaInit( const string& sMachineName)
|
||||
m_LuaMgr.RegisterFunction( "EmtAddRapidMove", Machine::LuaEmtAddRapidMove) ;
|
||||
m_LuaMgr.RegisterFunction( "EmtAddLinearMove", Machine::LuaEmtAddLinearMove) ;
|
||||
m_LuaMgr.RegisterFunction( "EmtAddArcMove", Machine::LuaEmtAddArcMove) ;
|
||||
m_LuaMgr.RegisterFunction( "EmtAddClimb", Machine::LuaEmtAddClimb) ;
|
||||
m_LuaMgr.RegisterFunction( "EmtRemoveClimb", Machine::LuaEmtRemoveClimb) ;
|
||||
m_LuaMgr.RegisterFunction( "EmtAddRise", Machine::LuaEmtAddRise) ;
|
||||
m_LuaMgr.RegisterFunction( "EmtRemoveRise", Machine::LuaEmtRemoveRise) ;
|
||||
m_LuaMgr.RegisterFunction( "EmtGetInitialAxesPos", Machine::LuaEmtGetInitialAxesPos) ;
|
||||
m_LuaMgr.RegisterFunction( "EmtGetFinalAxesPos", Machine::LuaEmtGetFinalAxesPos) ;
|
||||
m_LuaMgr.RegisterFunction( "EmtGetCurrAxesHomePos", Machine::LuaEmtGetCurrAxesHomePos) ;
|
||||
// registro le funzioni di lettura entità CL per lua
|
||||
m_LuaMgr.RegisterFunction( "EmtGetMoveType", Machine::LuaEmtGetMoveType) ;
|
||||
m_LuaMgr.RegisterFunction( "EmtGetAxesPos", Machine::LuaEmtGetAxesPos) ;
|
||||
@@ -128,6 +144,10 @@ Machine::LuaInit( const string& sMachineName)
|
||||
m_LuaMgr.RegisterFunction( "EmtAddCollisionObj", Machine::LuaEmtAddCollisionObj) ;
|
||||
// registro la funzione estesa per aggiungere un oggetto da verificare per la collisione in simulazione
|
||||
m_LuaMgr.RegisterFunction( "EmtAddCollisionObjEx", Machine::LuaEmtAddCollisionObjEx) ;
|
||||
// registro la funzione per rimuovere oggetti con dato FrameId da verificare per la collisione in simulazione
|
||||
m_LuaMgr.RegisterFunction( "EmtRemoveCollisionObj", Machine::LuaEmtRemoveCollisionObj) ;
|
||||
// registro la funzione per avere i dati dell'oggetto con posizione indicata nel vettore da verificare per la collisione in simulazione
|
||||
m_LuaMgr.RegisterFunction( "EmtGetCollisionObj", Machine::LuaEmtGetCollisionObj) ;
|
||||
// registro la funzione di esecuzione della verifica di collisione in simulazione
|
||||
m_LuaMgr.RegisterFunction( "EmtExecCollisionCheck", Machine::LuaEmtExecCollisionCheck) ;
|
||||
// registro la funzione di gestione della collisione in simulazione
|
||||
@@ -136,8 +156,12 @@ Machine::LuaInit( const string& sMachineName)
|
||||
m_LuaMgr.RegisterFunction( "EmtSetToolForVmill", Machine::LuaEmtSetToolForVmill) ;
|
||||
// registro la funzione di impostazione di utensile aggiuntivo per virtual milling in simulazione
|
||||
m_LuaMgr.RegisterFunction( "EmtAddToolForVmill", Machine::LuaEmtAddToolForVmill) ;
|
||||
// registro la funzione per abilitare/disabilitare l'esecuzione del virtual milling
|
||||
m_LuaMgr.RegisterFunction( "EmtEnableToolsForVmill", Machine::LuaEmtEnableToolsForVmill) ;
|
||||
// registro la funzione di movimento assi in simulazione
|
||||
m_LuaMgr.RegisterFunction( "EmtMoveAxes", Machine::LuaEmtMoveAxes) ;
|
||||
// registro la funzione di salvataggio comandi in simulazione MP
|
||||
m_LuaMgr.RegisterFunction( "EmtSaveCmd", Machine::LuaEmtSaveCmd) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -337,6 +361,16 @@ Machine::LuaEmtGeneral( lua_State* L)
|
||||
// lettura eventuale campo 'AngDeltaForHome' dalla tabella (default INFINITO)
|
||||
double dAngDeltaMinForHome = INFINITO ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_ANGDELTAMINFORHOME, dAngDeltaMinForHome) ;
|
||||
// lettura eventuale campo 'MultiProcess' dalla tabella (0=no, 1=si, 2=si con simulazione MP)
|
||||
int nMultiProcess = 0 ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_MULTIPROCESS, nMultiProcess) ;
|
||||
// lettura eventuale campo "LinkAxesMoveOrder" dalla tabella(0=interpolati, ...)
|
||||
int nLinkAxesMoveOrder = 0 ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_LINKAXESMOVEORDER, nLinkAxesMoveOrder) ;
|
||||
// lettura eventuale campo 'NewLinkMgr' dalla tabella (0=old, 1 =new)
|
||||
int nNewLinkMgr = 0 ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_NEWLINKMGR, nNewLinkMgr) ;
|
||||
// pulizia stack
|
||||
LuaClearStack( L) ;
|
||||
|
||||
// info
|
||||
@@ -386,6 +420,13 @@ Machine::LuaEmtGeneral( lua_State* L)
|
||||
// imposto minima differenza angolare da posizione precedente per stare vivino a posizione home
|
||||
m_pMchLua->m_dAngDeltaMinForHome = dAngDeltaMinForHome ;
|
||||
|
||||
// imposto codice per macchina multiprocesso
|
||||
m_pMchLua->m_nMultiProcess = nMultiProcess ;
|
||||
// imposto codice per ordine interpolazione assi nei collegamenti
|
||||
m_pMchLua->m_nLinkAxesMoveOrder = nLinkAxesMoveOrder ;
|
||||
// imposto codice per gestione link tra lavorazioni
|
||||
m_pMchLua->m_nNewLinkMgr = nNewLinkMgr ;
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
@@ -450,6 +491,9 @@ Machine::LuaEmtTable( lua_State* L)
|
||||
// lettura eventuale campo 'Scale' dalla tabella
|
||||
double vScale[3] = {1.0, 1.0, 1.0} ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_SCALE, vScale) ;
|
||||
// lettura eventuale campo 'Coll' dalla tabella
|
||||
STRVECTOR vsColl ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_COLL, vsColl) ;
|
||||
// lettura campo 'Geo' dalla tabella
|
||||
string sGeo ;
|
||||
LuaCheckTabFieldParam( L, 1, FLD_GEO, sGeo)
|
||||
@@ -467,7 +511,7 @@ Machine::LuaEmtTable( lua_State* L)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
|
||||
// carico i dati della tavola
|
||||
if ( ! m_pMchLua->LoadMachineTable( sName, sParent, nType, Ref1, vScale[0], vScale[1], vScale[2], sGeo, vsAux))
|
||||
if ( ! m_pMchLua->LoadMachineTable( sName, sParent, nType, Ref1, vScale[0], vScale[1], vScale[2], vsColl, sGeo, vsAux))
|
||||
return luaL_error( L, " Load Machine Table failed") ;
|
||||
|
||||
// restituisco l'indice della tavola
|
||||
@@ -504,6 +548,9 @@ Machine::LuaEmtAxis( lua_State* L)
|
||||
// lettura campo 'Type' dalla tabella
|
||||
int nType ;
|
||||
LuaCheckTabFieldParam( L, 1, FLD_TYPE, nType)
|
||||
// lettura eventuale campo 'Use' della tabella (default General)
|
||||
int nUse = MCH_AU_GENERAL ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_USE, nUse) ;
|
||||
// lettura campo 'Pos' dalla tabella
|
||||
Point3d ptPos ;
|
||||
LuaCheckTabFieldParam( L, 1, FLD_POS, ptPos)
|
||||
@@ -537,7 +584,7 @@ Machine::LuaEmtAxis( lua_State* L)
|
||||
|
||||
// carico i dati dell'asse
|
||||
if ( ! m_pMchLua->LoadMachineAxis( sName, sParent, sToken, bInvert, dOffset,
|
||||
nType, ptPos, vtDir, Stroke, dHome, bAdjustAux, sGeo, vsAux))
|
||||
nType, nUse, ptPos, vtDir, Stroke, dHome, bAdjustAux, sGeo, vsAux))
|
||||
return luaL_error( L, " Load Machine Axis failed") ;
|
||||
|
||||
// restituisco l'indice dell'asse
|
||||
@@ -659,9 +706,12 @@ Machine::LuaEmtMultiHead( lua_State* L)
|
||||
// lettura campo 'HSet' dalla tabella
|
||||
string sHSet ;
|
||||
LuaCheckTabFieldParam( L, 1, FLD_HSET, sHSet)
|
||||
// lettura eventuale campo tipo di selezione ammessa per le uscite
|
||||
int nSelectType = MCH_SLT_FIXEDEXITS ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_SEL_TYPE, nSelectType) ;
|
||||
// lettura campo 'ExitNbr' dalla tabella
|
||||
int nExitNbr ;
|
||||
LuaCheckTabFieldParam( L, 1, "ExitNbr", nExitNbr)
|
||||
LuaCheckTabFieldParam( L, 1, FLD_EXIT_NBR, nExitNbr)
|
||||
// lettura campi 'PosN' e 'TDirN' per ogni uscita dalla tabella
|
||||
MUEXITVECTOR vMuExit ;
|
||||
vMuExit.reserve( nExitNbr) ;
|
||||
@@ -676,7 +726,7 @@ Machine::LuaEmtMultiHead( lua_State* L)
|
||||
// inserimento nell'array
|
||||
vMuExit.emplace_back( ptPos, vtTDir) ;
|
||||
}
|
||||
// lettura campo 'ADir' dalla tabella
|
||||
// lettura eventuale campo 'ADir' dalla tabella
|
||||
Vector3d vtADir ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_ADIR, vtADir) ;
|
||||
// lettura eventuale campo 'Rot1W' dalla tabella (default 1)
|
||||
@@ -711,9 +761,9 @@ Machine::LuaEmtMultiHead( lua_State* L)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
|
||||
// carico i dati della testa multipla
|
||||
if ( ! m_pMchLua->LoadMachineMultiHead( sName, sParent, sHSet, vMuExit, vtADir,
|
||||
if ( ! m_pMchLua->LoadMachineMultiHead( sName, sParent, sHSet, nSelectType, vMuExit, vtADir,
|
||||
dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl, sGeo, vsAux))
|
||||
return luaL_error( L, " Load Machine Standard Head failed") ;
|
||||
return luaL_error( L, " Load Machine Multi Head failed") ;
|
||||
|
||||
// restituisco l'indice della testa
|
||||
int nHeadId = m_pMchLua->GetHeadId( sName) ;
|
||||
@@ -797,6 +847,26 @@ Machine::LuaEmtSpecialHead( lua_State* L)
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtTcPos( lua_State* L)
|
||||
{
|
||||
// Il parametro 1 deve essere una tabella
|
||||
if ( ! lua_istable( L, 1))
|
||||
return luaL_error( L, " Invalid Parameter, required a table") ;
|
||||
// lettura campo opzionale 'ExitNbr' dalla tabella
|
||||
int nExitNbr = 1 ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_EXIT_NBR, nExitNbr) ;
|
||||
|
||||
// Procedo alla lettura a seconda del tnumero di uscite
|
||||
if ( nExitNbr == 1)
|
||||
return LuaEmtStdTcPos( L) ;
|
||||
else if ( nExitNbr > 1)
|
||||
return LuaEmtMultiTcPos( L) ;
|
||||
else
|
||||
return luaL_error( L, " Tc Position type unknown") ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtStdTcPos( lua_State* L)
|
||||
{
|
||||
// Il parametro 1 deve essere una tabella
|
||||
if ( ! lua_istable( L, 1))
|
||||
@@ -833,8 +903,70 @@ Machine::LuaEmtTcPos( lua_State* L)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
|
||||
// carico i dati della posizione cambio utensile
|
||||
if ( ! m_pMchLua->LoadMachineTcPos( sName, sParent, ptPos, vtTDir, vtADir, sGeo, vsAux))
|
||||
return luaL_error( L, " Load Machine Tc Position failed") ;
|
||||
if ( ! m_pMchLua->LoadMachineStdTcPos( sName, sParent, ptPos, vtTDir, vtADir, sGeo, vsAux))
|
||||
return luaL_error( L, " Load Machine Standard Tc Position failed") ;
|
||||
|
||||
// restituisco l'indice della posizione cambio utensile
|
||||
int nTcPosId = m_pMchLua->GetTcPosId( sName) ;
|
||||
if ( nTcPosId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nTcPosId) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtMultiTcPos( lua_State* L)
|
||||
{
|
||||
// Il parametro 1 deve essere una tabella
|
||||
if ( ! lua_istable( L, 1))
|
||||
return luaL_error( L, " Invalid Parameter, required a table") ;
|
||||
// lettura campo 'Name' dalla tabella
|
||||
string sName ;
|
||||
LuaCheckTabFieldParam( L, 1, FLD_NAME, sName)
|
||||
// lettura campo 'Parent' dalla tabella
|
||||
string sParent ;
|
||||
LuaCheckTabFieldParam( L, 1, FLD_PARENT, sParent)
|
||||
// lettura campo 'ExitNbr' dalla tabella
|
||||
int nExitNbr ;
|
||||
LuaCheckTabFieldParam( L, 1, FLD_EXIT_NBR, nExitNbr)
|
||||
// lettura campi 'PosN' e 'TDirN' per ogni uscita dalla tabella
|
||||
MUEXITVECTOR vMuExit ;
|
||||
vMuExit.reserve( nExitNbr) ;
|
||||
for ( int i = 0 ; i < nExitNbr ; ++ i) {
|
||||
// lettura
|
||||
string sPos = FLD_POS + ToString( i + 1) ;
|
||||
Point3d ptPos ;
|
||||
LuaCheckTabFieldParam( L, 1, sPos.c_str(), ptPos)
|
||||
string sTDir = FLD_TDIR + ToString( i + 1) ;
|
||||
Vector3d vtTDir ;
|
||||
LuaCheckTabFieldParam( L, 1, sTDir.c_str(), vtTDir)
|
||||
// inserimento nell'array
|
||||
vMuExit.emplace_back( ptPos, vtTDir) ;
|
||||
}
|
||||
// lettura eventuale campo 'ADir' dalla tabella
|
||||
Vector3d vtADir ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_ADIR, vtADir) ;
|
||||
// lettura campo 'Geo' dalla tabella
|
||||
string sGeo ;
|
||||
LuaCheckTabFieldParam( L, 1, FLD_GEO, sGeo)
|
||||
// lettura eventuale campo 'Aux' dalla tabella
|
||||
STRVECTOR vsAux ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_AUX, vsAux) ;
|
||||
LuaClearStack( L) ;
|
||||
|
||||
// info
|
||||
string sOut = "LuaEmtTcPos : " + sName ;
|
||||
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str())
|
||||
|
||||
// verifico ci sia una macchina attiva
|
||||
if ( m_pMchLua == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
|
||||
// carico i dati della posizione cambio utensile
|
||||
if ( ! m_pMchLua->LoadMachineMultiTcPos( sName, sParent, vMuExit, vtADir, sGeo, vsAux))
|
||||
return luaL_error( L, " Load Machine Multi Tc Position failed") ;
|
||||
|
||||
// restituisco l'indice della posizione cambio utensile
|
||||
int nTcPosId = m_pMchLua->GetTcPosId( sName) ;
|
||||
@@ -1300,6 +1432,65 @@ Machine::LuaEmtAddCollisionObjEx( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtRemoveCollisionObj( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nFrameId
|
||||
int nFrameId ;
|
||||
LuaCheckParam( L, 1, nFrameId)
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva
|
||||
if ( m_pMchLua == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// assegno i dati
|
||||
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimRemoveCollisionObj( nFrameId)) ;
|
||||
// assegno risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtGetCollisionObj( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nPos
|
||||
int nPos ;
|
||||
LuaCheckParam( L, 1, nPos)
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva
|
||||
if ( m_pMchLua == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// recupero i dati
|
||||
int nInd ;
|
||||
bool bToolOn ;
|
||||
int nFrameId ;
|
||||
int nType ;
|
||||
Vector3d vtMove ;
|
||||
double dPar1 ;
|
||||
double dPar2 ;
|
||||
double dPar3 ;
|
||||
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr &&
|
||||
m_pMchLua->m_pMchMgr->SimGetCollisionObj( nPos, nInd, bToolOn, nFrameId, nType, vtMove, dPar1, dPar2, dPar3)) ;
|
||||
// assegno risultato
|
||||
if ( bOk) {
|
||||
LuaSetParam( L, true) ;
|
||||
LuaSetParam( L, nInd) ;
|
||||
LuaSetParam( L, bToolOn) ;
|
||||
LuaSetParam( L, nFrameId) ;
|
||||
LuaSetParam( L, nType) ;
|
||||
LuaSetParam( L, vtMove) ;
|
||||
LuaSetParam( L, dPar1) ;
|
||||
LuaSetParam( L, dPar2) ;
|
||||
LuaSetParam( L, dPar3) ;
|
||||
return 9 ;
|
||||
}
|
||||
else {
|
||||
LuaSetParam( L, false) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtExecCollisionCheck( lua_State* L)
|
||||
@@ -1347,7 +1538,7 @@ Machine::LuaEmtOnCollision( lua_State* L)
|
||||
int
|
||||
Machine::LuaEmtSetToolForVmill( lua_State* L)
|
||||
{
|
||||
// 4 parametri : sTool, sHead, nExit, vVmill
|
||||
// 4 o 7 parametri : sTool, sHead, nExit, vVmill [, nFlag , dPar1, dPar2]
|
||||
string sTool ;
|
||||
LuaGetParam( L, 1, sTool) ;
|
||||
string sHead ;
|
||||
@@ -1356,12 +1547,19 @@ Machine::LuaEmtSetToolForVmill( lua_State* L)
|
||||
LuaGetParam( L, 3, nExit) ;
|
||||
INTVECTOR vVmill ;
|
||||
LuaGetParam( L, 4, vVmill) ;
|
||||
int nFlag = 0 ;
|
||||
LuaGetParam( L, 5, nFlag) ;
|
||||
double dPar1 = 0 ;
|
||||
LuaGetParam( L, 6, dPar1) ;
|
||||
double dPar2 = 0 ;
|
||||
LuaGetParam( L, 7, dPar2) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva
|
||||
if ( m_pMchLua == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// imposto dati primo utensile per virtual milling in simulazione
|
||||
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimSetToolForVmill( sTool, sHead, nExit, vVmill, true)) ;
|
||||
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr &&
|
||||
m_pMchLua->m_pMchMgr->SimSetToolForVmill( sTool, sHead, nExit, nFlag, dPar1, dPar2, vVmill, true)) ;
|
||||
// assegno risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
@@ -1371,7 +1569,7 @@ Machine::LuaEmtSetToolForVmill( lua_State* L)
|
||||
int
|
||||
Machine::LuaEmtAddToolForVmill( lua_State* L)
|
||||
{
|
||||
// 4 parametri : sTool, sHead, nExit, vVmill
|
||||
// 4 o 7 parametri : sTool, sHead, nExit, vVmill [, nFlag, dPar1, dPar2]
|
||||
string sTool ;
|
||||
LuaGetParam( L, 1, sTool) ;
|
||||
string sHead ;
|
||||
@@ -1380,12 +1578,37 @@ Machine::LuaEmtAddToolForVmill( lua_State* L)
|
||||
LuaGetParam( L, 3, nExit) ;
|
||||
INTVECTOR vVmill ;
|
||||
LuaGetParam( L, 4, vVmill) ;
|
||||
int nFlag = 0 ;
|
||||
LuaGetParam( L, 5, nFlag) ;
|
||||
double dPar1 = 0 ;
|
||||
LuaGetParam( L, 6, dPar1) ;
|
||||
double dPar2 = 0 ;
|
||||
LuaGetParam( L, 7, dPar2) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva
|
||||
if ( m_pMchLua == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// imposto dati utensile aggiuntivo per virtual milling in simulazione
|
||||
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimSetToolForVmill( sTool, sHead, nExit, vVmill, false)) ;
|
||||
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr &&
|
||||
m_pMchLua->m_pMchMgr->SimSetToolForVmill( sTool, sHead, nExit, nFlag, dPar1, dPar2, vVmill, false)) ;
|
||||
// assegno risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtEnableToolsForVmill( lua_State* L)
|
||||
{
|
||||
// 1 parametro : bEnable
|
||||
bool bEnable = false ;
|
||||
LuaGetParam( L, 1, bEnable) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva
|
||||
if ( m_pMchLua == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// imposto abilitazione utensili per virtual milling in simulazione
|
||||
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimEnableToolsForVmill( bEnable)) ;
|
||||
// assegno risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
@@ -1395,19 +1618,12 @@ Machine::LuaEmtAddToolForVmill( lua_State* L)
|
||||
int
|
||||
Machine::LuaEmtMoveAxes( lua_State* L)
|
||||
{
|
||||
// 4, ..., 16 parametri : nMoveType, sAx1, dPos1, dStep1 [, sAx2, dPos2, dStep2] [, sAx3, dPos3, dStep3] [, sAx4, dPos4, dStep4] [, sAx5, dPos5, dStep5]
|
||||
int nMoveType ;
|
||||
LuaCheckParam( L, 1, nMoveType)
|
||||
string sAx1 ;
|
||||
LuaCheckParam( L, 2, sAx1) ;
|
||||
double dEnd1 ;
|
||||
LuaCheckParam( L, 3, dEnd1) ;
|
||||
double dStep1 ;
|
||||
LuaCheckParam( L, 4, dStep1) ;
|
||||
// 4, ..., 31 parametri : nMoveType, sAx1, dPos1, dStep1 [, sAx2, dPos2, dStep2] ... [, sAx10, dPos10, dStep10]
|
||||
int nMoveType = 0 ;
|
||||
LuaGetParam( L, 1, nMoveType) ;
|
||||
SAMVECTOR vAxNaEpSt ;
|
||||
vAxNaEpSt.emplace_back( sAx1, dEnd1, dStep1) ;
|
||||
for ( int i = 0 ; i < 4 ; ++ i) {
|
||||
int nInd = 5 + 3 * i ;
|
||||
for ( int i = 0 ; i < 10 ; ++ i) {
|
||||
int nInd = 2 + 3 * i ;
|
||||
string sAxN ;
|
||||
double dEndN ;
|
||||
double dStepN ;
|
||||
@@ -1427,7 +1643,65 @@ Machine::LuaEmtMoveAxes( lua_State* L)
|
||||
// assegno risultato
|
||||
if ( nRes == SIM_AXMV_RES_STOP)
|
||||
return luaL_error( L, "STOP") ;
|
||||
else
|
||||
else {
|
||||
LuaSetParam( L, ( nRes == SIM_AXMV_RES_OK)) ;
|
||||
LuaSetParam( L, m_pMchLua->GetMultiProcess()) ;
|
||||
}
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtSaveCmd( lua_State* L)
|
||||
{
|
||||
// parametri : nType,
|
||||
int nType = 0 ;
|
||||
LuaGetParam( L, 1, nType) ;
|
||||
int nPar = 0 ;
|
||||
LuaGetParam( L, 2, nPar) ;
|
||||
string sPar ;
|
||||
LuaGetParam( L, 3, sPar) ;
|
||||
string sPar2 ;
|
||||
if ( nType == 4) {
|
||||
switch ( lua_type( L, 4)) {
|
||||
case LUA_TNIL :
|
||||
nPar = 0 ;
|
||||
break ;
|
||||
case LUA_TBOOLEAN :
|
||||
{ nPar = 1 ;
|
||||
bool bVal ;
|
||||
LuaGetParam( L, 4, bVal) ;
|
||||
sPar2 = ( bVal ? "1" : "0") ;
|
||||
} break ;
|
||||
case LUA_TNUMBER :
|
||||
if ( lua_isinteger( L, 4)) {
|
||||
nPar = 2 ;
|
||||
int nVal ;
|
||||
LuaGetParam( L, 4, nVal) ;
|
||||
sPar2 = ToString( nVal) ;
|
||||
}
|
||||
else {
|
||||
nPar = 3 ;
|
||||
double dVal ;
|
||||
LuaGetParam( L, 4, dVal) ;
|
||||
sPar2 = ToString( dVal, 9) ;
|
||||
}
|
||||
break ;
|
||||
case LUA_TSTRING :
|
||||
{ nPar = 4 ;
|
||||
LuaGetParam( L, 4, sPar2) ;
|
||||
} break ;
|
||||
default :
|
||||
return luaL_error( L, " Unknown Type") ;
|
||||
}
|
||||
}
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva
|
||||
if ( m_pMchLua == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// salvo il comando
|
||||
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimSaveCmd( nType, nPar, sPar, sPar2)) ;
|
||||
// assegno risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
+234
-4
@@ -15,6 +15,8 @@
|
||||
#include "stdafx.h"
|
||||
#include "MachMgr.h"
|
||||
#include "DllMain.h"
|
||||
#include "CamData.h"
|
||||
#include "Operation.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
@@ -31,7 +33,7 @@ using namespace std ;
|
||||
int
|
||||
Machine::LuaEmtAddRapidStart( lua_State* L)
|
||||
{
|
||||
// 6 parametri : nPathId, ptP, vtTool, vtCorr, vtAux, nFlag
|
||||
// 6, 7 o 8 parametri : nPathId, ptP, vtTool, vtCorr, vtAux, nFlag [, nFlag2] [, bToolShow]
|
||||
int nPathId ;
|
||||
LuaCheckParam( L, 1, nPathId)
|
||||
Point3d ptP ;
|
||||
@@ -44,6 +46,12 @@ Machine::LuaEmtAddRapidStart( lua_State* L)
|
||||
LuaCheckParam( L, 5, vtAux)
|
||||
int nFlag ;
|
||||
LuaCheckParam( L, 6, nFlag)
|
||||
int nFlag2 = 0 ;
|
||||
bool bToolShow = false ;
|
||||
if ( LuaGetParam( L, 7, nFlag2))
|
||||
LuaGetParam( L, 8, bToolShow) ;
|
||||
else
|
||||
LuaGetParam( L, 7, bToolShow) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
@@ -69,6 +77,8 @@ Machine::LuaEmtAddRapidStart( lua_State* L)
|
||||
pCam->SetEndPoint( ptP) ;
|
||||
pCam->SetFeed( 0) ;
|
||||
pCam->SetFlag( nFlag) ;
|
||||
pCam->SetFlag2( nFlag2) ;
|
||||
pCam->SetToolShow( bToolShow) ;
|
||||
// associo questo oggetto a quello geometrico
|
||||
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
|
||||
}
|
||||
@@ -84,7 +94,7 @@ Machine::LuaEmtAddRapidStart( lua_State* L)
|
||||
int
|
||||
Machine::LuaEmtAddRapidMove( lua_State* L)
|
||||
{
|
||||
// 7 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, nFlag
|
||||
// 7, 8 o 9 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, nFlag [, nFlag2] [, bToolShow]
|
||||
int nPathId ;
|
||||
LuaCheckParam( L, 1, nPathId)
|
||||
Point3d ptIni ;
|
||||
@@ -99,6 +109,12 @@ Machine::LuaEmtAddRapidMove( lua_State* L)
|
||||
LuaCheckParam( L, 6, vtAux)
|
||||
int nFlag ;
|
||||
LuaCheckParam( L, 7, nFlag)
|
||||
int nFlag2 = 0 ;
|
||||
bool bToolShow = false ;
|
||||
if ( LuaGetParam( L, 8, nFlag2))
|
||||
LuaGetParam( L, 9, bToolShow) ;
|
||||
else
|
||||
LuaGetParam( L, 8, bToolShow) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
@@ -124,6 +140,8 @@ Machine::LuaEmtAddRapidMove( lua_State* L)
|
||||
pCam->SetEndPoint( ptFin) ;
|
||||
pCam->SetFeed( 0) ;
|
||||
pCam->SetFlag( nFlag) ;
|
||||
pCam->SetFlag2( nFlag2) ;
|
||||
pCam->SetToolShow( bToolShow) ;
|
||||
// associo questo oggetto a quello geometrico
|
||||
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
|
||||
}
|
||||
@@ -139,7 +157,7 @@ Machine::LuaEmtAddRapidMove( lua_State* L)
|
||||
int
|
||||
Machine::LuaEmtAddLinearMove( lua_State* L)
|
||||
{
|
||||
// 8 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, dFeed, nFlag
|
||||
// 8, 9 o 10 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, dFeed, nFlag [, nFlag2] [, bToolShow]
|
||||
int nPathId ;
|
||||
LuaCheckParam( L, 1, nPathId)
|
||||
Point3d ptIni ;
|
||||
@@ -156,6 +174,12 @@ Machine::LuaEmtAddLinearMove( lua_State* L)
|
||||
LuaCheckParam( L, 7, dFeed)
|
||||
int nFlag ;
|
||||
LuaCheckParam( L, 8, nFlag)
|
||||
int nFlag2 = 0 ;
|
||||
bool bToolShow = false ;
|
||||
if ( LuaGetParam( L, 9, nFlag2))
|
||||
LuaGetParam( L, 10, bToolShow) ;
|
||||
else
|
||||
LuaGetParam( L, 9, bToolShow) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
@@ -181,6 +205,8 @@ Machine::LuaEmtAddLinearMove( lua_State* L)
|
||||
pCam->SetEndPoint( ptFin) ;
|
||||
pCam->SetFeed( dFeed) ;
|
||||
pCam->SetFlag( nFlag) ;
|
||||
pCam->SetFlag2( nFlag2) ;
|
||||
pCam->SetToolShow( bToolShow) ;
|
||||
// associo questo oggetto a quello geometrico
|
||||
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
|
||||
}
|
||||
@@ -196,7 +222,7 @@ Machine::LuaEmtAddLinearMove( lua_State* L)
|
||||
int
|
||||
Machine::LuaEmtAddArcMove( lua_State* L)
|
||||
{
|
||||
// 11 parametri : nPathId, ptIni, ptFin, ptCen, dAngCen, vtN, vtTool, vtCorr, vtAux, dFeed, nFlag
|
||||
// 11 o 12 parametri : nPathId, ptIni, ptFin, ptCen, dAngCen, vtN, vtTool, vtCorr, vtAux, dFeed, nFlag [, bToolShow]
|
||||
int nPathId ;
|
||||
LuaCheckParam( L, 1, nPathId)
|
||||
Point3d ptIni ;
|
||||
@@ -219,6 +245,8 @@ Machine::LuaEmtAddArcMove( lua_State* L)
|
||||
LuaCheckParam( L, 10, dFeed)
|
||||
int nFlag ;
|
||||
LuaCheckParam( L, 11, nFlag)
|
||||
bool bToolShow = false ;
|
||||
LuaGetParam( L, 12, bToolShow) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
@@ -252,6 +280,7 @@ Machine::LuaEmtAddArcMove( lua_State* L)
|
||||
pCam->SetNormDir( vtN) ;
|
||||
pCam->SetFeed( dFeed) ;
|
||||
pCam->SetFlag( nFlag) ;
|
||||
pCam->SetToolShow( bToolShow) ;
|
||||
// associo questo oggetto a quello geometrico
|
||||
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
|
||||
}
|
||||
@@ -263,6 +292,207 @@ Machine::LuaEmtAddArcMove( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtAddClimb( lua_State* L)
|
||||
{
|
||||
// 5 o 6 o 7 parametri : nMachId [, sMain], vAxVal, nMask, nFlag, nFlag2 [, sInfo]
|
||||
int nMachId ;
|
||||
LuaCheckParam( L, 1, nMachId)
|
||||
string sMain = MCH_CL ;
|
||||
int nOffs = ( LuaGetParam( L, 2, sMain) ? 1 : 0) ;
|
||||
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
|
||||
DBLVECTOR vAxVal ;
|
||||
LuaCheckParam( L, 2 + nOffs, vAxVal)
|
||||
int nMask ;
|
||||
LuaCheckParam( L, 3 + nOffs, nMask)
|
||||
int nFlag ;
|
||||
LuaCheckParam( L, 4 + nOffs, nFlag)
|
||||
int nFlag2 ;
|
||||
LuaCheckParam( L, 5 + nOffs, nFlag2)
|
||||
string sInfo = "" ;
|
||||
LuaGetParam( L, 6 + nOffs, sInfo) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// recupero l'operazione
|
||||
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
|
||||
// imposto la discesa (primo movimento del primo percorso della lavorazione)
|
||||
bool bOk = ( pOper != nullptr && pOper->AddSpecialClimb( vAxVal, ( nMask >= 0), GDB_ID_NULL, bMain, nFlag, nFlag2, nMask, sInfo, false)) ;
|
||||
if ( ! bOk)
|
||||
return luaL_error( L, " Error in EmtAddClimb") ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtRemoveClimb( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : nMachId [, sMain]
|
||||
int nMachId ;
|
||||
LuaCheckParam( L, 1, nMachId)
|
||||
string sMain = MCH_CL ;
|
||||
LuaGetParam( L, 2, sMain) ;
|
||||
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// recupero l'operazione
|
||||
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
|
||||
// elimino le discese (primi movimenti "CLIMB" del primo percorso della lavorazione)
|
||||
bool bOk = ( pOper != nullptr && pOper->RemoveClimb( GDB_ID_NULL, bMain)) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtAddRise( lua_State* L)
|
||||
{
|
||||
// 5 o 6 o 7 parametri : nMachId [, sMain], vAxVal, nMask, nFlag, nFlag2 [, sInfo]
|
||||
int nMachId ;
|
||||
LuaCheckParam( L, 1, nMachId)
|
||||
string sMain = MCH_CL ;
|
||||
int nOffs = ( LuaGetParam( L, 2, sMain) ? 1 : 0) ;
|
||||
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
|
||||
DBLVECTOR vAxVal ;
|
||||
LuaCheckParam( L, 2 + nOffs, vAxVal)
|
||||
int nMask ;
|
||||
LuaCheckParam( L, 3 + nOffs, nMask)
|
||||
int nFlag ;
|
||||
LuaCheckParam( L, 4 + nOffs, nFlag)
|
||||
int nFlag2 ;
|
||||
LuaCheckParam( L, 5 + nOffs, nFlag2)
|
||||
string sInfo = "" ;
|
||||
LuaGetParam( L, 6 + nOffs, sInfo) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// recupero l'operazione
|
||||
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
|
||||
// aggiungo la risalita (ultimo movimento dell'ultimo percorso della lavorazione)
|
||||
bool bOk = ( pOper != nullptr && pOper->AddSpecialRise( vAxVal, ( nMask >= 0), GDB_ID_NULL, bMain, nFlag, nFlag2, nMask, sInfo)) ;
|
||||
if ( ! bOk)
|
||||
return luaL_error( L, " Error in EmtAddRise") ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtRemoveRise( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : nMachId [, bMain]
|
||||
int nMachId ;
|
||||
LuaCheckParam( L, 1, nMachId)
|
||||
string sMain = MCH_CL ;
|
||||
LuaGetParam( L, 2, sMain) ;
|
||||
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// recupero l'operazione
|
||||
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
|
||||
// elimino le risalite (ultimi movimenti "RISE" dell'ultimo percorso della lavorazione)
|
||||
bool bOk = ( pOper != nullptr && pOper->RemoveRise( GDB_ID_NULL, bMain)) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtGetInitialAxesPos( lua_State* L)
|
||||
{
|
||||
// 1 o 2 o 3 parametri : nMachId [, sMain] [, bSkipClimb]
|
||||
int nMachId ;
|
||||
LuaCheckParam( L, 1, nMachId)
|
||||
string sMain = MCH_CL ;
|
||||
int nOffs = ( LuaGetParam( L, 2, sMain) ? 1 : 0) ;
|
||||
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
|
||||
bool bSkipClimb = true ;
|
||||
LuaGetParam( L, 2 + nOffs, bSkipClimb) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// recupero l'operazione
|
||||
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
|
||||
// acquisico il valore iniziale degli assi macchina
|
||||
DBLVECTOR vAxesVal ;
|
||||
bool bOk = ( pOper != nullptr && pOper->GetInitialAxesValues( bSkipClimb, bMain, vAxesVal)) ;
|
||||
if ( bOk)
|
||||
LuaSetParam( L, vAxesVal) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtGetFinalAxesPos( lua_State* L)
|
||||
{
|
||||
// 1 o 2 o 3 parametri : nMachId [, sMain] [, bSkipRise]
|
||||
int nMachId ;
|
||||
LuaCheckParam( L, 1, nMachId)
|
||||
bool bSkipRise = true ;
|
||||
string sMain = MCH_CL ;
|
||||
int nOffs = ( LuaGetParam( L, 2, sMain) ? 1 : 0) ;
|
||||
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
|
||||
LuaGetParam( L, 2 + nOffs, bSkipRise) ;
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// recupero l'operazione
|
||||
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
|
||||
// acquisico il valore finale degli assi macchina
|
||||
DBLVECTOR vAxesVal ;
|
||||
bool bOk = ( pOper != nullptr && pOper->GetFinalAxesValues( bSkipRise, bMain, vAxesVal)) ;
|
||||
if ( bOk)
|
||||
LuaSetParam( L, vAxesVal) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtGetCurrAxesHomePos( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva valida
|
||||
if ( m_pMchLua == nullptr ||
|
||||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// acquisisco la posizione di home degli assi della catena cinematica corrente
|
||||
DBLVECTOR vAxHomeVal ;
|
||||
bool bOk = m_pMchLua->GetAllCurrAxesHomePos( vAxHomeVal) ;
|
||||
if ( bOk)
|
||||
LuaSetParam( L, vAxHomeVal) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtGetMoveType( lua_State* L)
|
||||
|
||||
+25
-2
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
// EgalTech 2015-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : MachineStruConst.h Data : 25.05.15 Versione : 1.6e7
|
||||
// File : MachineStruConst.h Data : 15.01.24 Versione : 2.5l6
|
||||
// Contenuto : Strutture e costanti di macchina.
|
||||
//
|
||||
//
|
||||
@@ -81,6 +81,13 @@ enum MchAxisType { MCH_AT_NONE = 0,
|
||||
MCH_AT_LINEAR = 1,
|
||||
MCH_AT_ROTARY = 2} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Uso di assi della macchina
|
||||
enum MchAxisUse { MCH_AU_NONE = 0,
|
||||
MCH_AU_GENERAL = 1,
|
||||
MCH_AU_DISPOSITION = 2,
|
||||
MCH_AU_AUXILIAR = 3} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Tipo di testa della macchina
|
||||
enum MchHeadType { MCH_HT_NONE = 0,
|
||||
@@ -88,6 +95,18 @@ enum MchHeadType { MCH_HT_NONE = 0,
|
||||
MCH_HT_MULTI = 2,
|
||||
MCH_HT_SPECIAL = 3} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Tipo di selezione ammessa per le uscite
|
||||
enum MchSelType { MCH_SLT_FIXEDEXITS = 0,
|
||||
MCH_SLT_ONEEXIT = 1,
|
||||
MCH_SLT_MULTIEXITS = 2} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Tipo della catena cinematica
|
||||
enum KinChainType { KIN_CHAIN_NONE = 0,
|
||||
KIN_CHAIN_MCENT = 1,
|
||||
KIN_CHAIN_ROBOT = 2} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Identificativo iniziale riferimenti di tavola
|
||||
const std::string MCH_TREF = "R" ;
|
||||
@@ -141,3 +160,7 @@ const std::string MCH_AGB_ENCV = "AGB_ENCV" ;
|
||||
// Info in rinvio rotante da sotto per definire la direzione di approccio preferenziale (consentito delta max di 95deg)
|
||||
const std::string MCH_AGB_MDIR = "AGB_MDIR" ;
|
||||
const double MCH_AGB_DELTAMAX_MDIR = cos( 95 * DEGTORAD) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Info di uscita per indicare quanto mossa lungo la sua Z locale
|
||||
const std::string MCH_EXIT_VAL = "Val" ;
|
||||
|
||||
+1163
-138
File diff suppressed because it is too large
Load Diff
+36
-4
@@ -8,6 +8,7 @@
|
||||
//
|
||||
//
|
||||
// Modifiche : 07.06.15 DS Creazione modulo.
|
||||
// 24.02.26 RE Aggiunta Gestione Preview per Utensile e Testa
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -40,20 +41,51 @@ class Machining : public Operation
|
||||
virtual bool GetParam( int nType, int& nVal) const = 0 ;
|
||||
virtual bool GetParam( int nType, double& dVal) const = 0 ;
|
||||
virtual bool GetParam( int nType, std::string& sVal) const = 0 ;
|
||||
virtual bool UpdateToolData( bool* pbChanged = nullptr) = 0 ;
|
||||
virtual bool UpdateToolData( void) = 0 ;
|
||||
virtual const ToolData& GetToolData( void) const = 0 ;
|
||||
virtual bool GetGeometry( SELVECTOR& vIds) const = 0 ;
|
||||
virtual bool GetSkippedGeometry( SELVECTOR& vIds) const
|
||||
{ vIds.clear() ; return false ; }
|
||||
|
||||
public :
|
||||
bool GetStartPoint( Point3d& ptStart) const ;
|
||||
bool GetEndPoint( Point3d& ptEnd) const ;
|
||||
bool PrepareToolPreview( void) const ;
|
||||
int ToolPreview( int nEntId, int nFlag) const ;
|
||||
bool RemoveToolPreview( void) const ;
|
||||
bool ChangeToolPreviewShow( int nFlag) ;
|
||||
bool PrepareToolPreview( void) ;
|
||||
bool RemoveToolPreview( void) ;
|
||||
int GetToolPreviewStepCount( void) const ;
|
||||
int ToolPreview( int nEntId, int nStep) const ;
|
||||
|
||||
protected :
|
||||
Machining( void) ;
|
||||
~Machining( void) ;
|
||||
bool SpecialApply( std::string& sErr) ;
|
||||
bool PostApply( std::string& sErr) ;
|
||||
int GetDoubleType( const std::string& sUserNotes) ;
|
||||
bool GetDoubleToolData( std::string& sDblTool, std::string& sDblTcPos, std::string& sDblHead, int& nDblExit) const override ;
|
||||
bool CalcMirrorByDouble( int nClId, const std::string& sUserNotes) ;
|
||||
bool ActivateDrillingUnit( int nHeadId, const INTVECTOR& vActExit) const ;
|
||||
|
||||
private :
|
||||
int GetToolPreviewNext( int nEntId, int nParentId, int nStId) const ;
|
||||
int GetToolPreviewPrev( int nEntId, int nParentId, int nStId) const ;
|
||||
bool MyPrepareToolPreview( bool bDouble) ;
|
||||
bool MyChangeToolPreviewShow( int nLookFlag, bool bDouble) ;
|
||||
bool MyToolPreview( int nEntId, bool bDouble) const ;
|
||||
bool MyShowMultiDrillingTool( const INTVECTOR& vActExit) const ;
|
||||
|
||||
private :
|
||||
int m_nLookFlag ; // flag di Visualizzazione per Preview
|
||||
// lavorazione singola
|
||||
int m_nPreviewHeadId ; // Id del gruppo della testa di Preview
|
||||
int m_nPreviewExitId ; // Id del gruppo dell'uscita di Preview
|
||||
int m_nPreviewToolTip ; // Id del gruppo contenente il punto ToolTip
|
||||
INTVECTOR m_vPreviewAxisIds ; // indici degli assi di Preview
|
||||
// lavorazione in doppio
|
||||
int m_nPreviewHeadIdDBL ; // Id del gruppo della testa di Preview
|
||||
int m_nPreviewExitIdDBL ; // Id del gruppo dell'uscita di Preview
|
||||
int m_nPreviewToolTipDBL ; // Id del gruppo contenente il punto di ToolTip
|
||||
INTVECTOR m_vPreviewAxisIdsDBL ; // indici degli assi di Preview
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+11
-1
@@ -103,7 +103,12 @@ GetMachiningTitle( int nMchType)
|
||||
"SawRoughing",
|
||||
"SawFinishing",
|
||||
"GenMachining",
|
||||
"Chiseling"} ;
|
||||
"Chiseling",
|
||||
"SurfRoughing",
|
||||
"SurfFinishing",
|
||||
"Waterjetting",
|
||||
"5AxisMilling",
|
||||
"Probing"} ;
|
||||
switch ( nMchType) {
|
||||
case MT_DRILLING : return MchTitle[1] ;
|
||||
case MT_SAWING : return MchTitle[2] ;
|
||||
@@ -114,6 +119,11 @@ GetMachiningTitle( int nMchType)
|
||||
case MT_SAWFINISHING : return MchTitle[7] ;
|
||||
case MT_GENMACHINING : return MchTitle[8] ;
|
||||
case MT_CHISELING : return MchTitle[9] ;
|
||||
case MT_SURFROUGHING : return MchTitle[10] ;
|
||||
case MT_SURFFINISHING : return MchTitle[11] ;
|
||||
case MT_WATERJETTING : return MchTitle[12] ;
|
||||
case MT_FIVEAXISMILLING : return MchTitle[13] ;
|
||||
case MT_PROBING : return MchTitle[14] ;
|
||||
}
|
||||
return MchTitle[0] ;
|
||||
}
|
||||
|
||||
+31
-31
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
// EgalTech 2015-2025
|
||||
//----------------------------------------------------------------------------
|
||||
// File : MachiningDataFactory.h Data : 05.06.15 Versione : 1.6f1
|
||||
// File : MachiningDataFactory.h Data : 31.10.25 Versione : 2.7k1
|
||||
// Contenuto : Factory della classe MachiningData.
|
||||
//
|
||||
//
|
||||
@@ -26,35 +26,6 @@
|
||||
#define MCHDATA_CREATE( nType) MachiningDataFactory::Create( nType)
|
||||
#define MCHDATA_GETLIST( vsList) MachiningDataFactory::GetList( vsList)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
class MachiningDataRegister
|
||||
{
|
||||
public :
|
||||
static bool DoRegister( int nType, const std::string& sName)
|
||||
{ if ( ! MachiningDataFactory::Register( nType, sName, Create))
|
||||
return false ;
|
||||
GetTypePrivate() = nType ;
|
||||
GetNamePrivate() = sName ;
|
||||
return true ; }
|
||||
static MachiningData* Create( void)
|
||||
{ return new(nothrow) T ; }
|
||||
static int GetType( void)
|
||||
{ return GetTypePrivate() ; }
|
||||
static const std::string& GetName( void)
|
||||
{ return GetNamePrivate() ; }
|
||||
|
||||
private :
|
||||
MachiningDataRegister( void) {}
|
||||
~MachiningDataRegister( void) {}
|
||||
static int& GetTypePrivate( void)
|
||||
{ static int s_nType ;
|
||||
return s_nType ; }
|
||||
static std::string& GetNamePrivate( void)
|
||||
{ static std::string s_sName ;
|
||||
return s_sName ; }
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class MachiningDataFactory
|
||||
{
|
||||
@@ -108,3 +79,32 @@ class MachiningDataFactory
|
||||
return s_CreatorMap ;
|
||||
}
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
class MachiningDataRegister
|
||||
{
|
||||
public :
|
||||
static bool DoRegister( int nType, const std::string& sName)
|
||||
{ if ( ! MachiningDataFactory::Register( nType, sName, Create))
|
||||
return false ;
|
||||
GetTypePrivate() = nType ;
|
||||
GetNamePrivate() = sName ;
|
||||
return true ; }
|
||||
static MachiningData* Create( void)
|
||||
{ return new( std::nothrow) T ; }
|
||||
static int GetType( void)
|
||||
{ return GetTypePrivate() ; }
|
||||
static const std::string& GetName( void)
|
||||
{ return GetNamePrivate() ; }
|
||||
|
||||
private :
|
||||
MachiningDataRegister( void) {}
|
||||
~MachiningDataRegister( void) {}
|
||||
static int& GetTypePrivate( void)
|
||||
{ static int s_nType ;
|
||||
return s_nType ; }
|
||||
static std::string& GetNamePrivate( void)
|
||||
{ static std::string s_sName ;
|
||||
return s_sName ; }
|
||||
} ;
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2025-2025
|
||||
//----------------------------------------------------------------------------
|
||||
// File : MachiningRegister.h Data : 02.05.25 Versione : 2.7e1
|
||||
// Contenuto : Funzioni per registrazione dinamica oggetti delle lavorazioni
|
||||
// (per decidere tra versioni diverse di una lavorazione).
|
||||
//
|
||||
//
|
||||
// Modifiche : 02.05.25 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "OperationConst.h"
|
||||
#include "Pocketing.h"
|
||||
#include "PocketingNT.h"
|
||||
#include "/EgtDev/Include/EGkUserObjFactory.h"
|
||||
#include "/EgtDev/Include/EgtIniFile.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Registrazione dinamica delle svuotature da parametro nel file Ini dell'eseguibile
|
||||
inline bool
|
||||
RegisterPocketing( void)
|
||||
{
|
||||
const char* SEC_MACH = "Mach" ;
|
||||
const char* KEY_POCKETING = "Pocketing" ;
|
||||
static bool bFirst = true ;
|
||||
if ( bFirst) {
|
||||
std::string sIniPath ;
|
||||
ExeGetIniFile( sIniPath) ;
|
||||
int nPockType = GetPrivateProfileInt( SEC_MACH, KEY_POCKETING, 2, sIniPath.c_str()) ;
|
||||
if ( nPockType == 2)
|
||||
UserObjRegister<PocketingNT>::DoRegister( GetOperationClass( OPER_POCKETING)) ;
|
||||
else
|
||||
UserObjRegister<Pocketing>::DoRegister( GetOperationClass( OPER_POCKETING)) ;
|
||||
std::string sInfo = "Mach-Pocketing=" + ToString( nPockType) ;
|
||||
LOG_INFO( GetEMkLogger(), sInfo.c_str())
|
||||
bFirst = false ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
+44
-12
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2022
|
||||
// EgalTech 2015-2025
|
||||
//----------------------------------------------------------------------------
|
||||
// File : MachiningsMgr.cpp Data : 04.02.22 Versione : 2.4b1
|
||||
// File : MachiningsMgr.cpp Data : 09.06.25 Versione : 2.7f2
|
||||
// Contenuto : Implementazione gestore database lavorazioni.
|
||||
//
|
||||
//
|
||||
@@ -16,6 +16,8 @@
|
||||
// 22.06.20 DS Agg. per nuovi parametri attacco tagli di lama (MF_CURR_VER = 1010).
|
||||
// 09.11.20 DS Agg. per nuovi parametri tagli di lama (MF_CURR_VER = 1011).
|
||||
// 04.02.22 DS Agg. per nuovi parametri svuotature con epicicli (MF_CURR_VER = 1012).
|
||||
// 29.03.24 DS Agg. parametro APPROX_LINTOL (MF_CURR_VER = 1013).
|
||||
// 29.03.24 DS Agg. tastatura (MF_CURR_VER = 1014).
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -42,7 +44,7 @@ const string MF_HEADER = "[HEADER]" ;
|
||||
const string MF_VERSION = "VERSION" ;
|
||||
const string MF_TOTAL = "TOTAL" ;
|
||||
const string MF_SIZE = "SIZE" ;
|
||||
const int MF_CURR_VER = 1012 ;
|
||||
const int MF_CURR_VER = 1014 ;
|
||||
const string MF_GENERAL = "[GENERAL]" ;
|
||||
const string MF_3AXCOMP = "3AXCOMP" ;
|
||||
const bool MF_CURR_3AXCOMP = false ;
|
||||
@@ -64,6 +66,8 @@ const string MF_INTSAWARCMAXSIDEANG = "INTSAWARCMAXSIDEANG" ;
|
||||
const double MF_CURR_INTSAWARCMAXSIDEANG = 45 ;
|
||||
const string MF_SPLITARCS = "SPLITARCS" ;
|
||||
const int MF_CURR_SPLITARCS = SPLAR_NEVER ;
|
||||
const string MF_APPROX_LINTOL = "APPROX_LINTOL" ;
|
||||
const double MF_CURR_APPROX_LINTOL = 0.05 ;
|
||||
const string MF_MAXDEPTHSAFE = "MAXDEPTHSAFE" ;
|
||||
const double MF_CURR_MAXDEPTHSAFE = 2.0 ;
|
||||
|
||||
@@ -85,6 +89,7 @@ MachiningsMgr::MachiningsMgr( void)
|
||||
m_dExtSawArcMinRad = MF_CURR_EXTSAWARCMINRAD ;
|
||||
m_dIntSawArcMaxSideAng = MF_CURR_INTSAWARCMAXSIDEANG ;
|
||||
m_nSplitArcs = MF_CURR_SPLITARCS ;
|
||||
m_dApproxLinTol = MF_CURR_APPROX_LINTOL ;
|
||||
m_dMaxDepthSafe = MF_CURR_MAXDEPTHSAFE ;
|
||||
}
|
||||
|
||||
@@ -121,11 +126,12 @@ MachiningsMgr::Clear( bool bReset)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachiningsMgr::Load( const string& sMachsFile, const ToolsMgr* pTsMgr)
|
||||
MachiningsMgr::Load( const string& sMachsDir, const string& sMachsFile, const ToolsMgr* pTsMgr)
|
||||
{
|
||||
// Salvo la path del file con i dati
|
||||
m_sMachsFile = sMachsFile ;
|
||||
string sOut = "MachiningsMgr Init : " + m_sMachsFile ;
|
||||
m_sMachsDir = sMachsDir ;
|
||||
m_sMachsPath = m_sMachsDir + "\\" + sMachsFile ;
|
||||
string sOut = "MachiningsMgr Init : " + m_sMachsPath ;
|
||||
LOG_INFO( GetEMkLogger(), sOut.c_str())
|
||||
|
||||
// Verifico il gestore degli utensili
|
||||
@@ -154,9 +160,15 @@ MachiningsMgr::Reload( void)
|
||||
|
||||
// Inizializzo lo scanner
|
||||
Scanner TheScanner ;
|
||||
if ( ! TheScanner.Init( m_sMachsFile, ";")) {
|
||||
if ( ! TheScanner.Init( m_sMachsPath, ";")) {
|
||||
LOG_ERROR( GetEMkLogger(), "ReloadMachinings : Error on Init")
|
||||
return false ;
|
||||
if ( ExistsDirectory( m_sMachsDir) && ! ExistsFile( m_sMachsPath)) {
|
||||
m_nDbVer = MF_CURR_VER ;
|
||||
m_bModified = true ;
|
||||
return true ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
|
||||
// variabili di stato della lettura
|
||||
@@ -312,6 +324,8 @@ MachiningsMgr::LoadGeneral( Scanner& TheScanner, bool& bEnd)
|
||||
bOk = FromString( sVal, m_dIntSawArcMaxSideAng) ;
|
||||
else if ( ToUpper( sKey) == MF_SPLITARCS)
|
||||
bOk = FromString( sVal, m_nSplitArcs) ;
|
||||
else if ( ToUpper( sKey) == MF_APPROX_LINTOL)
|
||||
bOk = FromString( sVal, m_dApproxLinTol) ;
|
||||
else if ( ToUpper( sKey) == MF_MAXDEPTHSAFE)
|
||||
bOk = FromString( sVal, m_dMaxDepthSafe) ;
|
||||
else
|
||||
@@ -393,17 +407,17 @@ MachiningsMgr::Save( bool bCompressed) const
|
||||
return true ;
|
||||
|
||||
// Faccio copia di backup del file originale
|
||||
CopyFileEgt( m_sMachsFile, m_sMachsFile + ".bak") ;
|
||||
CopyFileEgt( m_sMachsPath, m_sMachsPath + ".bak") ;
|
||||
|
||||
// Inizializzo il writer
|
||||
Writer TheWriter ;
|
||||
if ( ! TheWriter.Init( m_sMachsFile, bCompressed)) {
|
||||
if ( ! TheWriter.Init( m_sMachsPath, bCompressed)) {
|
||||
LOG_ERROR( GetEMkLogger(), "SaveMachinings : Error on Init")
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Scrivo linea di inizio file
|
||||
string sOut = "; --- " + m_sMachsFile + " " + CurrDateTime() + " ---" ;
|
||||
string sOut = "; --- " + m_sMachsPath + " " + CurrDateTime() + " ---" ;
|
||||
if ( ! TheWriter.OutText( sOut)) {
|
||||
LOG_ERROR( GetEMkLogger(), "SaveMachinings : Error on Start")
|
||||
return false ;
|
||||
@@ -499,6 +513,10 @@ MachiningsMgr::SaveGeneral( Writer& TheWriter) const
|
||||
sOut = MF_MAXDEPTHSAFE + "=" + ToString( m_dMaxDepthSafe) ;
|
||||
bOk = bOk && TheWriter.OutText( sOut) ;
|
||||
}
|
||||
if ( m_nDbVer >= 1013) {
|
||||
sOut = MF_APPROX_LINTOL + "=" + ToString( m_dApproxLinTol) ;
|
||||
bOk = bOk && TheWriter.OutText( sOut) ;
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
@@ -838,7 +856,7 @@ MachiningsMgr::SetCurrMachiningParam( int nType, double dVal)
|
||||
}
|
||||
// se feed
|
||||
else if ( nType == MPA_FEED || nType == MPA_STARTFEED || nType == MPA_ENDFEED ||
|
||||
nType == MPA_TIPFEED || nType == MPA_VERTFEED || nType == MPA_BACKFEED) {
|
||||
nType == MPA_TIPFEED || nType == MPA_VERTFEED || nType == MPA_BACKFEED || nType == MPA_SIDEANGFEED) {
|
||||
// recupero valore da utensile
|
||||
const ToolData* pTdata ;
|
||||
if ( ! m_pCurrMach->GetTool( m_pTsMgr, pTdata))
|
||||
@@ -1175,6 +1193,20 @@ MachiningsMgr::SetSplitArcs( int nFlag)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachiningsMgr::SetApproxLinTol( double dLinTol)
|
||||
{
|
||||
// verifico non sia inferiore al minimo
|
||||
dLinTol = max( dLinTol, EPS_SMALL) ;
|
||||
// se cambiato, salvo e setto modifica
|
||||
if ( abs( dLinTol - m_dApproxLinTol) > EPS_SMALL) {
|
||||
m_dApproxLinTol = dLinTol ;
|
||||
m_bModified = true ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachiningsMgr::SetMaxDepthSafe( double dSafe)
|
||||
|
||||
+10
-5
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
// EgalTech 2015-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : MachiningsMgr.h Data : 02.06.15 Versione : 1.6f1
|
||||
// File : MachiningsMgr.h Data : 29.03.24 Versione : 2.6d1
|
||||
// Contenuto : Dichiarazione della classe MachiningsMgr.
|
||||
//
|
||||
//
|
||||
@@ -27,7 +27,7 @@ class MachiningsMgr
|
||||
public :
|
||||
MachiningsMgr( void) ;
|
||||
~MachiningsMgr( void) ;
|
||||
bool Load( const std::string& sMachsFile, const ToolsMgr* pTsMgr) ;
|
||||
bool Load( const std::string& sMachsDir, const std::string& sMachsFile, const ToolsMgr* pTsMgr) ;
|
||||
bool Reload( void) ;
|
||||
bool Save( bool bCompressed = true) const ;
|
||||
bool GetMachiningNewName( std::string& sName) const ;
|
||||
@@ -79,6 +79,9 @@ class MachiningsMgr
|
||||
bool SetSplitArcs( int nFlag) ;
|
||||
int GetSplitArcs( void) const
|
||||
{ return m_nSplitArcs ; }
|
||||
bool SetApproxLinTol( double dLinTol) ;
|
||||
double GetApproxLinTol( void) const
|
||||
{ return m_dApproxLinTol ; }
|
||||
bool SetMaxDepthSafe( double dSafe) ;
|
||||
double GetMaxDepthSafe( void) const
|
||||
{ return m_dMaxDepthSafe ; }
|
||||
@@ -105,8 +108,9 @@ class MachiningsMgr
|
||||
typedef STRUUID_MAP::const_iterator STRUUID_CITER ;
|
||||
|
||||
private :
|
||||
// path file lavorazioni
|
||||
std::string m_sMachsFile ;
|
||||
// dir e path file lavorazioni
|
||||
std::string m_sMachsDir ;
|
||||
std::string m_sMachsPath ;
|
||||
// flag di dati modificati
|
||||
mutable bool m_bModified ;
|
||||
// versione DB caricato
|
||||
@@ -131,5 +135,6 @@ class MachiningsMgr
|
||||
double m_dExtSawArcMinRad ;
|
||||
double m_dIntSawArcMaxSideAng ;
|
||||
int m_nSplitArcs ;
|
||||
double m_dApproxLinTol ;
|
||||
double m_dMaxDepthSafe ;
|
||||
} ;
|
||||
+1689
-873
File diff suppressed because it is too large
Load Diff
@@ -37,8 +37,14 @@ class Milling : public Machining
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_MILLING ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nMills == 0) ; }
|
||||
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
|
||||
{ if ( m_nMills == 0)
|
||||
return true ;
|
||||
if ( nEmptyType == NEED_ONE_TP_OK)
|
||||
return ( ! IsAtLeastOnePathOk()) ;
|
||||
if ( nEmptyType == NEED_ALL_TP_OK)
|
||||
return ( ! AreAllPathsOk()) ;
|
||||
return false ; }
|
||||
bool UpdateStatus( int nModif) override
|
||||
{ m_nStatus |= nModif ; return true ; }
|
||||
|
||||
@@ -62,7 +68,7 @@ class Milling : public Machining
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool UpdateToolData( bool* pbChanged = nullptr) override ;
|
||||
bool UpdateToolData( void) override ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
|
||||
@@ -85,7 +91,7 @@ class Milling : public Machining
|
||||
bool AdjustPathDrawForSaw( int nClPathId) ;
|
||||
bool CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double& dElev) const ;
|
||||
bool VerifyPathFromBottom( const ICurveComposite* pCompo, const Vector3d& vtTool) ;
|
||||
bool GenerateMillingPv( int nPathId, const ICurveComposite* pCompo) ;
|
||||
bool GenerateMillingPv( int nPathId, const ICurveComposite* pCompo, double dRbDist, double dDepth) ;
|
||||
bool AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
double dDepth, double dElev, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ;
|
||||
bool AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev,
|
||||
@@ -96,22 +102,26 @@ class Milling : public Machining
|
||||
double dDepth, double dElev, double dOkStep, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ;
|
||||
bool AddSawZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
|
||||
bool AddSawOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
|
||||
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr, bool bOutStart, bool bAboveStart) ;
|
||||
bool AddSawBladeSideApproach( const Point3d& ptP, const Vector3d& vtAppr, double dSafeZ, double dStElev, double dAppr) ;
|
||||
bool AddDirectApproach( const Point3d& ptP) ;
|
||||
double dElev, double dAppr, bool bOutStart, bool bAboveStart, bool bFirst, bool bSplitArcs) ;
|
||||
bool AddSawBladeSideApproach( const Point3d& ptP, const Vector3d& vtAppr, const Vector3d& vtTool,
|
||||
double dSafeZ, double dSawStElev, double dStElev, double dAppr,
|
||||
bool bFirst, bool bSplitArcs, bool bAddInsert = false) ;
|
||||
bool AddDirectApproach( const Point3d& ptP, bool bSplitArcs) ;
|
||||
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr, bool bAboveEnd) ;
|
||||
double dElev, double dAppr, bool bAboveEnd, bool bSplitArcs) ;
|
||||
bool AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, const Vector3d& vtTool,
|
||||
double dSafeZ, double dEndElev, double dAppr) ;
|
||||
double dSafeZ, double dSawEndElev, double dEndElev, double dAppr, bool bAddExtract = false) ;
|
||||
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool,
|
||||
double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1) const ;
|
||||
double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1, Vector3d& vtDir1) const ;
|
||||
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart,
|
||||
const Vector3d& vtTool, bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs) ;
|
||||
const Vector3d& vtTool, double dStElev, bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs) ;
|
||||
bool CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtTool,
|
||||
double dEndElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1) const ;
|
||||
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtTool, double dEndElev,
|
||||
bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs, Point3d& ptP1) ;
|
||||
bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs, Point3d& ptP1, Vector3d& vtDir1) ;
|
||||
bool AdjustOscillParams( const ICurve* pCrv, bool& bPathOscEnable, double& dRampLen, double& dFlatLen) ;
|
||||
bool AddOscillLine( const ICurveLine* pLine, const Vector3d& vtTool, double dRampLen, double dFlatLen) ;
|
||||
bool AddOscillArc( const ICurveArc* pArc, const Vector3d& vtTool, double dRampLen, double dFlatLen) ;
|
||||
@@ -120,11 +130,14 @@ class Milling : public Machining
|
||||
bool AddTabsLine( const ICurveLine* pLine, const Vector3d& vtTool, const DBLVECTOR& vdTabs, const TabData& tdTabs) ;
|
||||
bool AddTabsArc( const ICurveArc* pArc, const Vector3d& vtTool, const DBLVECTOR& vdTabs, const TabData& tdTabs) ;
|
||||
double GetRadiusForStartEndElevation( bool bExtra = true) const ;
|
||||
bool GetPointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, double dSafeZ) const ;
|
||||
bool GetSimplePointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtRetr) const ;
|
||||
bool GetPointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtRetr, double dSafeZ) const ;
|
||||
bool GetPointAboveRaw( const Point3d& ptP, const Vector3d& vtTool) const ;
|
||||
bool CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU) ;
|
||||
Vector3d CalcCorrDir( const ICurveComposite* pCompo, double dU) ;
|
||||
bool CalcOffset( ICurveComposite* pCompo, double dSignOffs) ;
|
||||
bool GetPointBelowRaw( const Point3d& ptP, const Vector3d& vtTool) const ;
|
||||
bool CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU, bool bInvertSide = false, bool bSawSpecial = false) ;
|
||||
Vector3d CalcCorrDir( const ICurveComposite* pCompo, double dU, bool bInvertSide = false, bool bSawSpecial = false) const ;
|
||||
bool CalcOffset( ICurveComposite* pCompo, double dSignOffs) const ;
|
||||
bool TrimExtendCurveToClosedStm( ICurveComposite* pCompo, int nCstmId, bool bInvert) ;
|
||||
|
||||
private :
|
||||
double GetSpeed() const
|
||||
@@ -146,6 +159,9 @@ class Milling : public Machining
|
||||
bool IsLeadInHelixOrZigzag() const
|
||||
{ int nType = GetLeadInType() ;
|
||||
return ( nType == MILL_LI_ZIGZAG || nType == MILL_LI_HELIX) ; }
|
||||
bool IsLeadInHelixOrZigzagOrGlide() const
|
||||
{ int nType = GetLeadInType() ;
|
||||
return ( nType == MILL_LI_ZIGZAG || nType == MILL_LI_HELIX || nType == MILL_LI_GLIDE) ; }
|
||||
bool LeadInRawIsOk( void) const
|
||||
{ if ( ( m_TParams.m_nType & TF_SAWBLADE) != 0)
|
||||
return false ;
|
||||
@@ -153,7 +169,9 @@ class Milling : public Machining
|
||||
return true ;
|
||||
return ( IsLeadInHelixOrZigzag() &&
|
||||
m_Params.m_dLiTang >= 0.9 * m_TParams.m_dDiam && m_Params.m_dLiElev <= 2) ; }
|
||||
friend class LeadIOStatus ;
|
||||
double GetLeadInOutToler( void) const
|
||||
{ return ( m_bTHoldFloating ? LIO_ELEV_FLOAT : LIO_ELEV_TOL) ; }
|
||||
friend class LeadIOStatus ;
|
||||
|
||||
private :
|
||||
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
|
||||
@@ -162,6 +180,7 @@ class Milling : public Machining
|
||||
double m_dTHoldBase ; // posizione base del porta-utensile
|
||||
double m_dTHoldLen ; // lunghezza del porta-utensile
|
||||
double m_dTHoldDiam ; // diametro del porta-utensile
|
||||
bool m_bTHoldFloating ; // flag di portautensili flottante
|
||||
int m_nStatus ; // stato di aggiornamento della lavorazione
|
||||
int m_nMills ; // numero di percorsi di lavoro generati
|
||||
bool m_bStepOn ; // flag per indicare che effettivamente si lavora a step
|
||||
@@ -177,4 +196,6 @@ class Milling : public Machining
|
||||
double m_dCurrTabsLen ; // lunghezza corrente lungo il percorso per tabs
|
||||
bool m_bStartOutRaw ; // flag forzatura inizio fuori dal grezzo
|
||||
bool m_bEndOutRaw ; // flag forzatura fine fuori dal grezzo
|
||||
Vector3d m_vtStartDir ; // direzione iniziale del percorso in elaborazione
|
||||
Vector3d m_vtEndDir ; // direzione finale del percorso in elaborazione
|
||||
} ;
|
||||
+6
-2
@@ -110,6 +110,10 @@ struct MillingData : public MachiningData
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline const MillingData* GetMillingData( const MachiningData* pMdata)
|
||||
{ return (dynamic_cast<const MillingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_MILLING)
|
||||
return nullptr ;
|
||||
return ( static_cast<const MillingData*>( pMdata)) ; }
|
||||
inline MillingData* GetMillingData( MachiningData* pMdata)
|
||||
{ return (dynamic_cast<MillingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_MILLING)
|
||||
return nullptr ;
|
||||
return ( static_cast<MillingData*>( pMdata)) ; }
|
||||
|
||||
+110
-61
@@ -17,6 +17,7 @@
|
||||
#include "DllMain.h"
|
||||
#include "Mortising.h"
|
||||
#include "OperationConst.h"
|
||||
#include "OperUserNotesConst.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
@@ -45,6 +46,7 @@ using namespace std ;
|
||||
// 2511 = "Error in Mortising : post apply not calculable"
|
||||
// 2512 = "Error in Mortising : Tool MaxMaterial too small (xx)"
|
||||
// 2513 = "Error in Mortising : Closed path not allowed"
|
||||
// 2514 = "Error in Mortising : special apply not calculable"
|
||||
// 2551 = "Warning in Mortising : Skipped entity (xx)"
|
||||
// 2552 = "Warning in Mortising : Plunges not found"
|
||||
// 2553 = "Warning in Mortising : Tool name changed (xx)"
|
||||
@@ -273,7 +275,7 @@ Mortising::SetParam( int nType, int nVal)
|
||||
if ( ! m_Params.VerifyFaceUse( nVal))
|
||||
return false ;
|
||||
if ( nVal != m_Params.m_nFaceUse)
|
||||
m_nStatus |= MCH_ST_PARAM_MODIF ;
|
||||
m_nStatus |= ( MCH_ST_PARAM_MODIF | MCH_ST_GEO_MODIF) ;
|
||||
m_Params.m_nFaceUse = nVal ;
|
||||
return true ;
|
||||
}
|
||||
@@ -414,15 +416,16 @@ Mortising::SetParam( int nType, const string& sVal)
|
||||
bool
|
||||
Mortising::SetGeometry( const SELVECTOR& vIds)
|
||||
{
|
||||
// verifico validità gestore DB geometrico
|
||||
// verifico validità gestore DB geometrico
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// reset della geometria corrente
|
||||
// copia temporanea e reset della geometria corrente
|
||||
SELVECTOR vOldId = m_vId ;
|
||||
m_vId.clear() ;
|
||||
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve o tutte facce)
|
||||
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve o tutte facce)
|
||||
int nType = GEO_NONE ;
|
||||
for ( const auto& Id : vIds) {
|
||||
// test sull'entità
|
||||
// test sull'entità
|
||||
int nSubs ;
|
||||
if ( ! VerifyGeometry( Id, nSubs, nType)) {
|
||||
string sInfo = "Warning in Mortising : Skipped entity " + ToString( Id) ;
|
||||
@@ -433,7 +436,8 @@ Mortising::SetGeometry( const SELVECTOR& vIds)
|
||||
m_vId.emplace_back( Id) ;
|
||||
}
|
||||
// aggiorno lo stato
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
if ( m_vId != vOldId)
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
// restituisco presenza geometria da lavorare
|
||||
return ( ! m_vId.empty() || vIds.empty()) ;
|
||||
}
|
||||
@@ -445,14 +449,14 @@ Mortising::Preview( bool bRecalc)
|
||||
// reset numero percorsi di lavoro generati
|
||||
m_nMortises = 0 ;
|
||||
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
|
||||
return false ;
|
||||
|
||||
// recupero gruppo per geometria ausiliaria
|
||||
int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ;
|
||||
bool bChain = false ;
|
||||
// se non c'è, lo aggiungo
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nAuxId == GDB_ID_NULL) {
|
||||
nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nAuxId == GDB_ID_NULL)
|
||||
@@ -480,7 +484,7 @@ Mortising::Preview( bool bRecalc)
|
||||
}
|
||||
// recupero gruppo per geometria di Preview
|
||||
int nPvId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_PV) ;
|
||||
// se non c'è, lo aggiungo
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nPvId == GDB_ID_NULL) {
|
||||
nPvId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nPvId == GDB_ID_NULL)
|
||||
@@ -510,26 +514,30 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
|
||||
int nCurrMortises = m_nMortises ;
|
||||
m_nMortises = 0 ;
|
||||
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
|
||||
return false ;
|
||||
|
||||
// aggiorno dati geometrici dell'utensile
|
||||
bool bToolChanged = true ;
|
||||
if ( ! UpdateToolData( &bToolChanged)) {
|
||||
if ( ! UpdateToolData()) {
|
||||
m_pMchMgr->SetLastError( 2501, "Error in Mortising : UpdateToolData failed") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// se modificata geometria, necessario ricalcolo
|
||||
if ( ( m_nStatus & MCH_ST_GEO_MODIF) != 0)
|
||||
bRecalc = true ;
|
||||
|
||||
// verifico se necessario continuare nell'aggiornamento
|
||||
if ( ! bRecalc && ! bToolChanged &&
|
||||
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
|
||||
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
// confermo i percorsi di lavorazione
|
||||
m_nMortises = nCurrMortises ;
|
||||
LOG_DBG_INFO( GetEMkLogger(), "Mortising apply skipped : status already ok") ;
|
||||
string sLog = string( "Mortising apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ;
|
||||
LOG_DBG_INFO( GetEMkLogger(), sLog.c_str()) ;
|
||||
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
|
||||
if ( ! Update( bPostApply))
|
||||
return false ;
|
||||
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
|
||||
LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
|
||||
// esco con successo
|
||||
return true ;
|
||||
@@ -539,7 +547,7 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
|
||||
// recupero gruppo per geometria ausiliaria
|
||||
int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ;
|
||||
bool bChain = false ;
|
||||
// se non c'è, lo aggiungo
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nAuxId == GDB_ID_NULL) {
|
||||
nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nAuxId == GDB_ID_NULL)
|
||||
@@ -556,7 +564,7 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
|
||||
|
||||
// recupero gruppo per vista ausiliaria
|
||||
int nAuxViewId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUXVIEW) ;
|
||||
// se non c'è, lo aggiungo
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nAuxViewId == GDB_ID_NULL) {
|
||||
nAuxViewId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nAuxViewId == GDB_ID_NULL)
|
||||
@@ -572,7 +580,7 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
|
||||
|
||||
// recupero gruppo per geometria di lavorazione (Cutter Location)
|
||||
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
|
||||
// se non c'è, lo aggiungo
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nClId == GDB_ID_NULL) {
|
||||
nClId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nClId == GDB_ID_NULL)
|
||||
@@ -624,7 +632,7 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
|
||||
bool
|
||||
Mortising::Update( bool bPostApply)
|
||||
{
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
|
||||
return false ;
|
||||
|
||||
@@ -634,6 +642,9 @@ Mortising::Update( bool bPostApply)
|
||||
return true ;
|
||||
}
|
||||
|
||||
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
|
||||
RemoveClimbRiseHome() ;
|
||||
|
||||
// imposto eventuale asse bloccato da lavorazione
|
||||
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
|
||||
|
||||
@@ -641,7 +652,7 @@ Mortising::Update( bool bPostApply)
|
||||
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
|
||||
if ( ! m_Params.m_sInitAngs.empty())
|
||||
sHint = m_Params.m_sInitAngs ;
|
||||
if ( ! CalculateAxesValues( sHint, true, true)) {
|
||||
if ( ! CalculateAxesValues( sHint, true)) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
if ( sInfo.empty())
|
||||
m_pMchMgr->SetLastError( 2507, "Error in Mortising : axes values not calculable") ;
|
||||
@@ -650,6 +661,19 @@ Mortising::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni speciali
|
||||
string sSpecErr ;
|
||||
if ( bPostApply && ! SpecialApply( sSpecErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sSpecErr))
|
||||
m_pMchMgr->SetLastError( 2514, sSpecErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2514, "Error in Mortising : special apply not calculable") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
|
||||
if ( ! AdjustStartEndMovements()) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
@@ -660,14 +684,11 @@ Mortising::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni
|
||||
string sErr ;
|
||||
if ( bPostApply && ! PostApply( sErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sErr))
|
||||
m_pMchMgr->SetLastError( 2511, sErr) ;
|
||||
// esecuzione eventuali personalizzazioni finali
|
||||
string sPostErr ;
|
||||
if ( bPostApply && ! PostApply( sPostErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sPostErr))
|
||||
m_pMchMgr->SetLastError( 2511, sPostErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2511, "Error in Mortising : post apply not calculable") ;
|
||||
return false ;
|
||||
@@ -806,16 +827,20 @@ Mortising::GetToolData( void) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Mortising::UpdateToolData( bool* pbChanged)
|
||||
Mortising::UpdateToolData( void)
|
||||
{
|
||||
// recupero il gestore DB utensili della macchina corrente
|
||||
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
|
||||
if ( pTMgr == nullptr)
|
||||
return false ;
|
||||
// recupero l'utensile nel DB utensili
|
||||
// recupero l'utensile nel DB utensili (se fallisce con UUID provo con il nome)
|
||||
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
if ( pTdata == nullptr) {
|
||||
pTdata = pTMgr->GetTool( m_Params.m_sToolName) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
m_Params.m_ToolUuid = m_TParams.m_Uuid ;
|
||||
}
|
||||
// salvo posizione TC, testa e uscita originali
|
||||
string sOrigTcPos = m_TParams.m_sTcPos ;
|
||||
string sOrigHead = m_TParams.m_sHead ;
|
||||
@@ -853,9 +878,9 @@ Mortising::UpdateToolData( bool* pbChanged)
|
||||
m_Params.m_sToolName + ")" ;
|
||||
m_pMchMgr->SetWarning( 2554, sInfo) ;
|
||||
}
|
||||
// se definito parametro di ritorno, lo assegno
|
||||
if ( pbChanged != nullptr)
|
||||
*pbChanged = bChanged ;
|
||||
// se modificato, aggiusto lo stato
|
||||
if ( bChanged)
|
||||
m_nStatus = MCH_ST_TO_VERIFY ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -863,7 +888,7 @@ Mortising::UpdateToolData( bool* pbChanged)
|
||||
bool
|
||||
Mortising::GetGeometry( SELVECTOR& vIds) const
|
||||
{
|
||||
// restituisco l'elenco delle entità
|
||||
// restituisco l'elenco delle entità
|
||||
vIds = m_vId ;
|
||||
return true ;
|
||||
}
|
||||
@@ -876,7 +901,7 @@ Mortising::VerifyGeometry( SelData Id, int& nSubs, int& nType)
|
||||
const IGeoObj* pGObj = m_pGeomDB->GetGeoObj( Id.nId) ;
|
||||
if ( pGObj == nullptr)
|
||||
return false ;
|
||||
// se ammesse curve ed è tale
|
||||
// se ammesse curve ed è tale
|
||||
if ( nType != GEO_SURF && ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
const ICurve* pCurve = nullptr ;
|
||||
// se direttamente la curva
|
||||
@@ -898,7 +923,7 @@ Mortising::VerifyGeometry( SelData Id, int& nSubs, int& nType)
|
||||
}
|
||||
return ( pCurve != nullptr) ;
|
||||
}
|
||||
// se altrimenti ammesse superfici trimesh ed è tale
|
||||
// se altrimenti ammesse superfici trimesh ed è tale
|
||||
else if ( nType != GEO_CURVE && ( pGObj->GetType() & GEO_SURF) != 0) {
|
||||
const ISurfTriMesh* pSurf = ::GetSurfTriMesh( pGObj) ;
|
||||
if ( pSurf == nullptr)
|
||||
@@ -1013,7 +1038,7 @@ Mortising::GetCurve( SelData Id)
|
||||
else
|
||||
nToolDir = TOOL_PAR_SLANT ;
|
||||
int nFaceUse = ( m_Params.m_nFaceUse & 31) ;
|
||||
AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, m_TParams.m_dThick, 2) ;
|
||||
AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, V_NULL, {}, m_TParams.m_dThick, 2) ;
|
||||
// la restituisco
|
||||
return Release( pCrvCompo) ;
|
||||
}
|
||||
@@ -1033,7 +1058,7 @@ Mortising::Chain( int nGrpDestId)
|
||||
for ( const auto& Id : m_vId) {
|
||||
// prendo curva
|
||||
vpCrvs.emplace_back( GetCurve( Id)) ;
|
||||
// ne verifico la validità
|
||||
// ne verifico la validità
|
||||
if ( IsNull( vpCrvs.back())) {
|
||||
string sInfo = "Warning in Mortising : Skipped entity " + ToString( Id) ;
|
||||
m_pMchMgr->SetWarning( 2551, sInfo) ;
|
||||
@@ -1152,7 +1177,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
// recupero gruppo per geometria temporanea
|
||||
const string GRP_TEMP = "Temp" ;
|
||||
int nTempId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, GRP_TEMP) ;
|
||||
// se non c'è, lo aggiungo
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nTempId == GDB_ID_NULL) {
|
||||
nTempId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nTempId == GDB_ID_NULL)
|
||||
@@ -1216,7 +1241,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
m_pMchMgr->SetWarning( 2555, "Warning in Mortising : skipped Path too short") ;
|
||||
return true ;
|
||||
}
|
||||
// se una sola entità circonferenza completa, la divido in due per poterla allungare
|
||||
// se una sola entità circonferenza completa, la divido in due per poterla allungare
|
||||
if ( pCompo->GetCurveCount() == 1 && pCompo->IsClosed())
|
||||
pCompo->AddJoint( 0.5) ;
|
||||
// eventuali allungamenti
|
||||
@@ -1316,7 +1341,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
return false ;
|
||||
// eventuale imposizione massima elevazione da note utente
|
||||
double dMaxElev ;
|
||||
if ( FromString( ExtractInfo( m_Params.m_sUserNotes, "MaxElev="), dMaxElev) && dElev > dMaxElev)
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_MAXELEV, dMaxElev) && dElev > dMaxElev)
|
||||
dElev = dMaxElev ;
|
||||
|
||||
// ingombro aggiuntivo da larghezza sega a catena quando inclinata rispetto al movimento
|
||||
@@ -1327,10 +1352,10 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
|
||||
// affondamento speciale da note utente (!!! da trasformare in parametro come gli altri !!!)
|
||||
int nPlunge = 0 ;
|
||||
FromString( ExtractInfo( m_Params.m_sUserNotes, "Plunge="), nPlunge) ;
|
||||
GetValInNotes( m_Params.m_sUserNotes, UN_PLUNGE, nPlunge) ;
|
||||
|
||||
// verifico che lo step dell'utensile sia sensato
|
||||
double dOkStep = ( nPlunge == MORTISE_PLUNGE_STEP ? m_Params.m_dStep : 0) ;
|
||||
double dOkStep = ( nPlunge == MORTISE_PLUNGE_STEP || nPlunge == MORTISE_PLUNGE_STEP_NO_SAFEZ ? m_Params.m_dStep : 0) ;
|
||||
const double MIN_ZSTEP = 1.0 ;
|
||||
if ( dOkStep >= EPS_SMALL && dOkStep < MIN_ZSTEP) {
|
||||
dOkStep = MIN_ZSTEP ;
|
||||
@@ -1348,7 +1373,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// se lo step supera la capacità dell'utensile
|
||||
// se lo step supera la capacità dell'utensile
|
||||
if ( dOkStep > m_TParams.m_dMaxMat + EPS_SMALL) {
|
||||
dOkStep = m_TParams.m_dMaxMat ;
|
||||
string sInfo = "Warning in Mortising : machining step (" + ToString( m_Params.m_dStep, 1) +
|
||||
@@ -1496,7 +1521,7 @@ Mortising::GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& v
|
||||
Point3d ptStart ; pCompo->GetStartPoint( ptStart) ;
|
||||
Point3d ptEnd ; pCompo->GetEndPoint( ptEnd) ;
|
||||
|
||||
// verifico se affondamento ripetuto è veramente tale
|
||||
// verifico se affondamento ripetuto è veramente tale
|
||||
if ( ( nPlunge == MORTISE_PLUNGE_START_END || nPlunge == MORTISE_PLUNGE_START_TO_END) && Dist( ptStart, ptEnd) < 10 * EPS_SMALL)
|
||||
nPlunge = MORTISE_PLUNGE_START ;
|
||||
|
||||
@@ -1520,7 +1545,7 @@ Mortising::GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& v
|
||||
int kMax = ( int) floor( dLen / m_TParams.m_dDiam) ;
|
||||
for ( int k = 0 ; k <= kMax ; ++ k) {
|
||||
Point3d ptNewStart = ptStart + vtDir * k * m_TParams.m_dDiam ;
|
||||
// se non è finale
|
||||
// se non è finale
|
||||
if ( k != kMax || ! AreSamePointEpsilon( ptNewStart, ptEnd, 10 * EPS_SMALL)) {
|
||||
if ( ! GenerateOnePlungeCl( ptNewStart, ptEnd, vtTool, dDepth, dElev, dOkStep, MORTISE_PLUNGE_START, k == 0))
|
||||
return false ;
|
||||
@@ -1552,9 +1577,18 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
|
||||
{
|
||||
// compensazione elevazione/affondamento
|
||||
double dDelta = dElev - dDepth ;
|
||||
// pre-calcolo step per modalità con step
|
||||
int nStep = 1 ;
|
||||
double dStep = dElev ;
|
||||
if ( nPlunge == MORTISE_PLUNGE_STEP || nPlunge == MORTISE_PLUNGE_STEP_NO_SAFEZ) {
|
||||
if ( dOkStep < EPS_SMALL)
|
||||
dOkStep = dElev ;
|
||||
nStep = max( 1, static_cast<int>( ceil( ( dElev - 10 * EPS_SMALL) / dOkStep))) ;
|
||||
dStep = dElev / nStep ;
|
||||
}
|
||||
|
||||
// determino se l'inizio dell'attacco è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione
|
||||
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() + m_pMchMgr->GetDeltaSafeZ( m_TParams.m_sHead) ;
|
||||
// determino se l'inizio dell'attacco è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione
|
||||
double dSafeZ = GetSafeZ() + GetDeltaSafeZ( vtTool) ;
|
||||
double dStartElev = 0 ;
|
||||
Point3d ptLi = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * dDelta ;
|
||||
bool bUnderStart = GetAhPointUnderRaw( ptLi, vtTool, 0,
|
||||
@@ -1563,17 +1597,26 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
|
||||
if ( ! bUnderStart)
|
||||
GetElevation( m_nPhase, ptLi, vtTool, GetRadiusForStartEndElevation(), vtTool, dStartElev) ;
|
||||
|
||||
// sicurezza su punto iniziale
|
||||
double dAppr = dStartElev + dSafeZ ;
|
||||
if ( nPlunge == MORTISE_PLUNGE_STEP_NO_SAFEZ) {
|
||||
double dStartDownElev ;
|
||||
if ( ! GetElevation( m_nPhase, ptStart, vtTool, GetRadiusForStartEndElevation(), vtTool, dStartDownElev))
|
||||
dStartDownElev = dDelta ;
|
||||
if ( dStartDownElev < EPS_SMALL)
|
||||
dAppr = -dStep ;
|
||||
}
|
||||
|
||||
// 1 -> punto approccio
|
||||
int nFirstFlag = ( bFirst ? 1 : 0) ;
|
||||
SetFlag( nFirstFlag) ;
|
||||
Point3d ptP1 = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * ( dDelta + dStartElev + dSafeZ) ;
|
||||
int nStart = ( bFirst ? AddRapidStart( ptP1) : AddRapidMove( ptP1)) ;
|
||||
if ( nStart == GDB_ID_NULL)
|
||||
Point3d ptP1 = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * ( dDelta + dAppr) ;
|
||||
if ( AddRapidStartOrMove( ptP1, bFirst) == GDB_ID_NULL)
|
||||
return false ;
|
||||
SetFlag( 0) ;
|
||||
|
||||
// 2 -> punto fuori (se diverso dal precedente)
|
||||
if ( m_Params.m_dStartPos < dSafeZ - 10 * EPS_SMALL) {
|
||||
if ( m_Params.m_dStartPos < dAppr - 10 * EPS_SMALL) {
|
||||
Point3d ptP2 = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * ( dDelta + m_Params.m_dStartPos) ;
|
||||
if ( AddRapidMove( ptP2) == GDB_ID_NULL)
|
||||
return false ;
|
||||
@@ -1601,10 +1644,6 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
|
||||
}
|
||||
else {
|
||||
// determino numero e affondamento degli step
|
||||
if ( dOkStep < EPS_SMALL)
|
||||
dOkStep = dElev ;
|
||||
int nStep = max( 1, static_cast<int>( ceil( ( dElev - 10 * EPS_SMALL) / dOkStep))) ;
|
||||
double dStep = dElev / nStep ;
|
||||
const double RETURN_DIST = 10 ;
|
||||
// a seconda del tipo
|
||||
switch ( m_Params.m_nStepType) {
|
||||
@@ -1614,7 +1653,7 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
|
||||
SetFeed( GetStartFeed()) ;
|
||||
SetFlag( 0) ;
|
||||
Point3d ptP3 = (( i % 2 == 1) ? ptStart : ptEnd) + ( dDelta - i * dStep) * vtTool ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL && ! ( i == 1 && nPlunge == MORTISE_PLUNGE_STEP_NO_SAFEZ))
|
||||
return false ;
|
||||
// 4 -> punto termine
|
||||
SetFeed( GetFeed()) ;
|
||||
@@ -1660,7 +1699,7 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
|
||||
}
|
||||
}
|
||||
|
||||
// determino se la fine dell'uscita è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione
|
||||
// determino se la fine dell'uscita è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione
|
||||
double dEndElev = 0 ;
|
||||
Point3d ptLo = ptLast + vtTool * dDelta ;
|
||||
bool bUnderEnd = GetAhPointUnderRaw( ptLo, vtTool, 0,
|
||||
@@ -1668,11 +1707,21 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
|
||||
// altrimenti ridetermino elevazione su fine percorso di lavoro
|
||||
if ( ! bUnderEnd)
|
||||
GetElevation( m_nPhase, ptLo, vtTool, GetRadiusForStartEndElevation(), vtTool, dEndElev) ;
|
||||
|
||||
// sicurezza su punto finale
|
||||
double dRetr = dEndElev + dSafeZ ;
|
||||
if ( nPlunge == MORTISE_PLUNGE_STEP_NO_SAFEZ) {
|
||||
double dEndDownElev ;
|
||||
if ( ! GetElevation( m_nPhase, ptStart, vtTool, GetRadiusForStartEndElevation(), vtTool, dEndDownElev))
|
||||
dEndDownElev = dDelta ;
|
||||
if ( dEndDownElev < EPS_SMALL)
|
||||
dRetr = dEndElev - dStep ;
|
||||
}
|
||||
|
||||
// 6 -> ritorno all'approccio
|
||||
SetFeed( GetEndFeed()) ;
|
||||
SetFlag( 104) ; // risalita sopra la fine
|
||||
Point3d ptP6 = ptLast + vtTool * ( dDelta + dEndElev + dSafeZ) ;
|
||||
Point3d ptP6 = ptLast + vtTool * ( dDelta + dRetr) ;
|
||||
if ( AddLinearMove( ptP6) == GDB_ID_NULL)
|
||||
return false ;
|
||||
|
||||
|
||||
+9
-3
@@ -36,8 +36,14 @@ class Mortising : public Machining
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_MORTISING ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nMortises == 0) ; }
|
||||
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
|
||||
{ if ( m_nMortises == 0)
|
||||
return true ;
|
||||
if ( nEmptyType == NEED_ONE_TP_OK)
|
||||
return ( ! IsAtLeastOnePathOk()) ;
|
||||
if ( nEmptyType == NEED_ALL_TP_OK)
|
||||
return ( ! AreAllPathsOk()) ;
|
||||
return false ; }
|
||||
bool UpdateStatus( int nModif) override
|
||||
{ m_nStatus |= nModif ; return true ; }
|
||||
|
||||
@@ -59,7 +65,7 @@ class Mortising : public Machining
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool UpdateToolData( bool* pbChanged = nullptr) override ;
|
||||
bool UpdateToolData( void) override ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
|
||||
|
||||
+6
-2
@@ -77,6 +77,10 @@ struct MortisingData : public MachiningData
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline const MortisingData* GetMortisingData( const MachiningData* pMdata)
|
||||
{ return (dynamic_cast<const MortisingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_MORTISING)
|
||||
return nullptr ;
|
||||
return ( static_cast<const MortisingData*>( pMdata)) ; }
|
||||
inline MortisingData* GetMortisingData( MachiningData* pMdata)
|
||||
{ return (dynamic_cast<MortisingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_MORTISING)
|
||||
return nullptr ;
|
||||
return ( static_cast<MortisingData*>( pMdata)) ; }
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2025-2025
|
||||
//----------------------------------------------------------------------------
|
||||
// File : OperUserNotesConst.h Data : 10.11.25 Versione : 2.7k3
|
||||
// Contenuto : Costanti per le note utente delle operazioni.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 10.11.25 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Generali
|
||||
static const std::string UN_MAXELEV = "MaxElev" ;
|
||||
static const std::string UN_TRIMEXT = "TrimExt" ;
|
||||
static const std::string UN_OPEN = "Open" ;
|
||||
static const std::string UN_LINTOL = "LinTol" ;
|
||||
static const std::string UN_DOUBLE = "DOUBLE" ;
|
||||
static const std::string UN_MIRRORAX = "MirrorAx" ;
|
||||
static const std::string UN_DELTAZ = "DeltaZ" ;
|
||||
static const std::string UN_VTAUXDIR = "VtAuxDir" ;
|
||||
|
||||
// Solo per Drilling
|
||||
static const std::string UN_LASTSTEP = "LastStep" ;
|
||||
|
||||
// Solo per FiveAxisMilling
|
||||
static const std::string UN_SINGCONEANG = "SingConeAng" ;
|
||||
|
||||
// Solo per GenMachining
|
||||
static const std::string UN_VPL_COLON = "Vpl:" ;
|
||||
|
||||
// Solo per Milling
|
||||
static const std::string UN_OUTRAW = "OutRaw" ;
|
||||
static const std::string UN_SIDEELEV = "SideElev" ;
|
||||
static const std::string UN_VTFACEUSE = "VtFaceUse" ;
|
||||
static const std::string UN_EDGESFACEUSE = "EdgesFaceUse" ;
|
||||
|
||||
// Solo per Mortising
|
||||
static const std::string UN_PLUNGE = "Plunge" ;
|
||||
|
||||
// Solo per Pocketing o PocketingNT
|
||||
static const std::string UN_OPENOUTRAW = "OpenOutRaw" ;
|
||||
static const std::string UN_OPENMINSAFE = "OpenMinSafe" ;
|
||||
static const std::string UN_MAXOPTSIZE = "MaxOptSize" ;
|
||||
static const std::string UN_PROJEXT = "ExtProj" ;
|
||||
static const std::string UN_ADJUSTFEED = "AdjustFeed" ;
|
||||
|
||||
// Solo per Sawing
|
||||
static const std::string UN_DOWNSE = "DownSE" ;
|
||||
static const std::string UN_FSTA = "Fsta" ;
|
||||
static const std::string UN_FEND = "Fend" ;
|
||||
static const std::string UN_SWE = "SWE" ;
|
||||
static const std::string UN_EWE = "EWE" ;
|
||||
|
||||
// Solo per SurfFinishing
|
||||
static const std::string UN_SKIPMAXDOWN = "SkipMaxDown" ;
|
||||
static const std::string UN_SPLITANGLE = "SplitAngle" ;
|
||||
static const std::string UN_TYPE = "Type" ;
|
||||
static const std::string UN_STEPNUMBER = "StepNumber" ;
|
||||
static const std::string UN_BITANGANG = "BiTangAng" ;
|
||||
static const std::string UN_OPTIMALTYPE = "OptimalType" ;
|
||||
static const std::string UN_ANGLETOL = "AngleTol" ;
|
||||
|
||||
// Solo per SurfRoughing
|
||||
static const std::string UN_PLANEZ = "PlaneZ" ;
|
||||
static const std::string UN_ORDER = "Order" ;
|
||||
static const std::string UN_SUPP_RAD_OFFS = "SuppRadOffs" ;
|
||||
|
||||
// Solo per Waterjetting
|
||||
static const std::string UN_START = "START" ;
|
||||
+3441
-860
File diff suppressed because it is too large
Load Diff
+189
-37
@@ -1,27 +1,28 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2016-2019
|
||||
// EgalTech 2016-2025
|
||||
//----------------------------------------------------------------------------
|
||||
// File : Operation.h Data : 17.06.19 Versione : 2.1f2
|
||||
// File : Operation.h Data : 09.05.25 Versione : 2.7e2
|
||||
// Contenuto : Dichiarazione della classe Operation da cui derivano
|
||||
// Disposition e Machining.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 29.04.16 DS Creazione modulo.
|
||||
//
|
||||
// 09.05.25 DS Generalizzazionee funzione IsEmpty con tipo (EMPTY_*).
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "MachMgr.h"
|
||||
#include "MachConst.h"
|
||||
#include "MachineStruConst.h"
|
||||
#include "CamData.h"
|
||||
#include "/EgtDev/Include/EGkPoint3d.h"
|
||||
#include "/EgtDev/Include/EGkUserObj.h"
|
||||
#include "/EgtDev/Include/EGkSelection.h"
|
||||
#include "/EgtDev/Include/EgtNumCollection.h"
|
||||
|
||||
class MachMgr ;
|
||||
class CamData ;
|
||||
class ICurve ;
|
||||
class ICurveComposite ;
|
||||
@@ -29,6 +30,8 @@ class ICurveComposite ;
|
||||
//----------------------------------------------------------------------------
|
||||
class Operation : public IUserObj
|
||||
{
|
||||
friend class Machine ;
|
||||
|
||||
public : // IUserObj
|
||||
bool SetOwner( int nId, IGeomDB* pGDB) override ;
|
||||
int GetOwner( void) const override ;
|
||||
@@ -42,30 +45,90 @@ class Operation : public IUserObj
|
||||
{ m_nPhase = nPhase ; return true ; }
|
||||
virtual int GetPhase( void) const
|
||||
{ return m_nPhase ; }
|
||||
virtual bool RemoveHome( void) ;
|
||||
std::string GetName( void) const ;
|
||||
virtual bool RemoveHome( bool bMain = true) ;
|
||||
std::string GetName( void) const ;
|
||||
|
||||
public :
|
||||
virtual int GetType( void) const = 0 ;
|
||||
virtual bool IsEmpty( void) const = 0 ;
|
||||
virtual bool IsEmpty( int nEmptyType = 0) const = 0 ;
|
||||
virtual bool UpdateStatus( int nModif) = 0 ;
|
||||
|
||||
public :
|
||||
bool GetInitialAxesValues( bool bSkipClimb, bool bMain, DBLVECTOR& vAxVal) const ;
|
||||
bool GetFinalAxesValues( bool bSkipRise, bool bMain, DBLVECTOR& vAxVal) const ;
|
||||
|
||||
protected :
|
||||
virtual const std::string& GetToolName( void) const = 0 ;
|
||||
virtual const std::string& GetHeadName( void) const = 0 ;
|
||||
virtual int GetExitNbr( void) const = 0 ;
|
||||
virtual int GetSolCh( void) const = 0 ;
|
||||
virtual const std::string& GetToolTcPos( void) const = 0 ;
|
||||
virtual bool GetDoubleToolData( std::string& sDblTool, std::string& sDblTcPos, std::string& sDblHead, int& nDblExit) const = 0 ;
|
||||
virtual bool NeedPrevHome( void) const = 0 ;
|
||||
virtual bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const
|
||||
{ return true ; }
|
||||
virtual bool AdjustArcCenterForAxesCalc( const CamData* pCamData, Point3d& ptCen) const
|
||||
{ return true ; }
|
||||
virtual bool NeedSplit( bool bSplit = true, bool bFeed = true) const
|
||||
{ return ( bSplit && ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrIsRobot())) ; }
|
||||
virtual double GetMaxSplitLen( bool bSplit = true, bool bFeed = true) const
|
||||
{ return ( bSplit && ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrIsRobot()) ? ( bFeed ? 5 : 50) : 0) ; }
|
||||
virtual double GetSafeZ( void) const
|
||||
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
|
||||
return 100 ; // MF_CURR_SAFEZ in MachiningsMgr
|
||||
return m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ; }
|
||||
virtual double GetSafeAggrBottZ( void) const
|
||||
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
|
||||
return 10 ; // MF_CURR_SAFEAGGRBOTTZ in MachiningsMgr
|
||||
return m_pMchMgr->GetCurrMachiningsMgr()->GetSafeAggrBottZ() ; }
|
||||
virtual double GetExtraLOnCutRegion( void) const
|
||||
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
|
||||
return 0 ; // MF_CURR_EXTRALCR in MachiningsMgr
|
||||
return m_pMchMgr->GetCurrMachiningsMgr()->GetExtraLOnCutRegion() ; }
|
||||
virtual double GetExtraROnDrillRegion( void) const
|
||||
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
|
||||
return 0 ; // MF_CURR_EXTRARDR in MachiningsMgr
|
||||
return m_pMchMgr->GetCurrMachiningsMgr()->GetExtraROnDrillRegion() ; }
|
||||
virtual double GetHoleDiamToler( void) const
|
||||
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
|
||||
return 10 * EPS_SMALL ; // MF_CURR_HOLEDTOL in MachiningsMgr
|
||||
return m_pMchMgr->GetCurrMachiningsMgr()->GetHoleDiamToler() ; }
|
||||
virtual double GetExtSawArcMinRad( void) const
|
||||
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
|
||||
return 200 ; // MF_CURR_EXTSAWARCMINRAD in MachiningsMgr
|
||||
return m_pMchMgr->GetCurrMachiningsMgr()->GetExtSawArcMinRad() ; }
|
||||
virtual double GetIntSawArcMaxSideAng( void) const
|
||||
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
|
||||
return 45 ; // MF_CURR_INTSAWARCMAXSIDEANG in MachiningsMgr
|
||||
return m_pMchMgr->GetCurrMachiningsMgr()->GetIntSawArcMaxSideAng() ; }
|
||||
virtual bool GetSplitArcs( const Vector3d& vtTool) const
|
||||
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrIsRobot() ||
|
||||
m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
|
||||
return true ;
|
||||
int nSplitArcs = m_pMchMgr->GetCurrMachiningsMgr()->GetSplitArcs() ;
|
||||
return ( nSplitArcs == SPLAR_ALWAYS ||
|
||||
( nSplitArcs == SPLAR_NO_XY_PLANE && ! vtTool.IsZplus()) ||
|
||||
( nSplitArcs == SPLAR_GEN_PLANE && vtTool.IsGeneric())) ; }
|
||||
virtual double GetApproxLinTol( void) const
|
||||
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
|
||||
return 50 * EPS_SMALL ; // MF_APPROX_LINTOL in MachiningsMgr
|
||||
return m_pMchMgr->GetCurrMachiningsMgr()->GetApproxLinTol() ; }
|
||||
virtual double GetMaxDepthSafe( void) const
|
||||
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
|
||||
return 2 ; // MF_CURR_MAXDEPTHSAFE in MachiningsMgr
|
||||
return m_pMchMgr->GetCurrMachiningsMgr()->GetMaxDepthSafe() ; }
|
||||
|
||||
protected :
|
||||
Operation( void) ;
|
||||
|
||||
protected :
|
||||
bool IsAtLeastOnePathOk( void) const ;
|
||||
bool AreAllPathsOk( void) const ;
|
||||
bool GetToolpathsStatus( int& nCnt, int& nEmpty) const ;
|
||||
int GetFirstFullToolpath( bool bMain = true) const ;
|
||||
int GetNextFullToolpath( int nClPathId, bool bMain = true) const ;
|
||||
int GetLastFullToolpath( bool bMain = true) const ;
|
||||
int GetPrevFullToolpath( int nClPathId, bool bMain = true) const ;
|
||||
bool UpdateFollowingOperationsStatus( int nModif) ;
|
||||
bool GetElevation( int nPhase, const Point3d& ptP,
|
||||
const Vector3d& vtDir, double& dElev) const ;
|
||||
@@ -83,11 +146,16 @@ class Operation : public IUserObj
|
||||
const Vector3d& vtDir, double& dElev) const ;
|
||||
bool GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool, double dRad, double dLen,
|
||||
const Vector3d& vtDir, double& dElev) const ;
|
||||
bool GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool, double dRad, double dLen, double dSafeDist,
|
||||
const Vector3d& vtDir, double& dElev) const ;
|
||||
bool GetElevation( int nPhase, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtTool, double dRad, double dLen,
|
||||
const Vector3d& vtDir, double& dElev) const ;
|
||||
bool GetAhPointUnderRaw( const Point3d& ptP, const Vector3d& vtTool, double dToolRad, double dToolRadForElev,
|
||||
double dToolLen, bool bIsSaw, double dSafeZ, const Vector3d& vtDir, double& dElev) const ;
|
||||
bool GetUhPointAboveRaw( const Point3d& ptP, const Vector3d& vtTool, double dToolRad, double dToolRadForElev,
|
||||
double dToolLen, bool bIsSaw, double dSafeZ, const Vector3d& vtDir, double& dElev) const ;
|
||||
bool GetDistanceFromRawSide( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist) const ;
|
||||
bool GetAggrBottDistanceFromRawSide( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double dEncSafeH, double& dDist) const ;
|
||||
bool GetMinDistanceFromRawSide( int nPhase, const Point3d& ptP, double dExpand,
|
||||
double& dDist, Vector3d& vtDir) const ;
|
||||
bool GetMinDistanceFromRawSide( int nPhase, const Point3d& ptP, double dExpand,
|
||||
@@ -99,42 +167,101 @@ class Operation : public IUserObj
|
||||
bool GetDistanceFromRawBottom( int nPhase, int nPathId, double dToler, double& dRbDist, double& dAllRbDist) const ;
|
||||
bool GetRawGlobBox( int nPhase, int nPathId, double dToler, BBox3d& b3Raw) const ;
|
||||
bool GetRawGlobBox( int nPhase, const BBox3d& b3Test, double dToler, BBox3d& b3Raw) const ;
|
||||
bool GetCurrRawsGlobBox( BBox3d& b3Raw) const ;
|
||||
|
||||
bool AdjustCurveFromSurf( ICurveComposite* pCrvCompo, int nToolDir, int nFaceUse, double dToolThick, int nGrade = 3) ;
|
||||
bool AdjustCurveFromSurf( ICurveComposite* pCrvCompo, int nToolDir, int nFaceUse, const Vector3d& vtFaceUse,
|
||||
const INTVECTOR& vnEdgesFaceUse, double dToolThick, int nGrade = 3) ;
|
||||
bool ApproxWithArcsIfUseful( ICurveComposite* pCompo, bool bCareTempProp = false) const ;
|
||||
bool ApproxWithLines( ICurveComposite* pCompo) const ;
|
||||
bool ApproxWithLines( ICurveComposite* pCompo, bool bFeed = true) const ;
|
||||
bool VerifyArcs( ICurveComposite* pCompo, double dMaxAngCen = MAX_ANG_CEN) const ;
|
||||
|
||||
bool CalcAndSetBBox( int nClId) ;
|
||||
bool CalcAndSetAxesBBox( void) ;
|
||||
|
||||
bool GetInitialAxesValues( bool bSkipClimb, DBLVECTOR& vAxVal) const ;
|
||||
std::string ExtractInfo( const std::string& sNotes, const std::string& sKey) const ;
|
||||
std::string ExtractHint( const std::string& sNotes) const ;
|
||||
bool SetBlockedRotAxis( const std::string& sBlockedAxis, bool bToolSetOk = false) const ;
|
||||
bool CalculateAxesValues( const std::string& sHint, bool bSolChExact = false, double dSingConeAng = 0) ;
|
||||
bool CalculateDoubleAxesValues( const std::string& sHint, bool bSolChExact = false, double dSingConeAng = 0) ;
|
||||
bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ;
|
||||
bool RemoveClimbRiseHome( bool bMain = true) ;
|
||||
double GetDeltaSafeZ( const Vector3d& vtTool) const ;
|
||||
bool TestCollisionAvoid( const DBLVECTOR& vAxStart, double dStartOffsX, const DBLVECTOR& vAxEnd, int* pnLKAMO = nullptr) const ;
|
||||
bool GetAggrBottomData( const std::string& sHead, AggrBottom& agbData) const ;
|
||||
bool IsAggrBottom( const std::string& sHead) const ;
|
||||
|
||||
private :
|
||||
struct Position {
|
||||
int nSide ;
|
||||
DBLVECTOR vAxis ;
|
||||
int nFlag ;
|
||||
int nFlag2 ;
|
||||
int nMask ;
|
||||
std::string sInfo ;
|
||||
Position() : nSide( 0), nFlag( 0), nFlag2( 0), nMask( -1) {}
|
||||
} ;
|
||||
typedef std::vector<Position> POSVECTOR ;
|
||||
|
||||
private :
|
||||
bool GetClPathInitialAxesValues( int nClPathId, bool bSkipClimb, DBLVECTOR& vAxVal) const ;
|
||||
bool GetFinalAxesValues( bool bSkipRise, DBLVECTOR& vAxVal) const ;
|
||||
bool GetClPathFinalAxesValues( int nClPathId, bool bSkipRise, DBLVECTOR& vAxVal) const ;
|
||||
bool GetInitialToolDir( bool bSkipClimb, Vector3d& vtTool) const ;
|
||||
bool GetClPathInitialToolDir( int nClPathId, bool bSkipClimb, Vector3d& vtTool) const ;
|
||||
bool GetFinalToolDir( bool bSkipRise, Vector3d& vtTool) const ;
|
||||
bool GetClPathFinalToolDir( int nClPathId, bool bSkipRise, Vector3d& vtTool) const ;
|
||||
const CamData* GetInitialCamData( bool bSkipClimb) const ;
|
||||
const CamData* GetInitialCamData( bool bSkipClimb, bool bMain = true) const ;
|
||||
const CamData* GetClPathInitialCamData( int nClPathId, bool bSkipClimb) const ;
|
||||
const CamData* GetFinalCamData( bool bSkipRise) const ;
|
||||
const CamData* GetFinalCamData( bool bSkipRise, bool bMain = true) const ;
|
||||
const CamData* GetClPathFinalCamData( int nClPathId, bool bSkipRise) const ;
|
||||
std::string ExtractInfo( const std::string& sNotes, const std::string& sKey) const ;
|
||||
std::string ExtractHint( const std::string& sNotes) const ;
|
||||
bool SetBlockedRotAxis( const std::string& sBlockedAxis) const ;
|
||||
bool CalculateAxesValues( const std::string& sHint, bool bRotContOnNext = true, bool bSolChExact = false) ;
|
||||
bool CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
|
||||
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
|
||||
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC) ;
|
||||
bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ;
|
||||
bool AdjustOneStartMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOp, const DBLVECTOR& vAxPrev, bool bMaxZ) ;
|
||||
bool ToolChangeNeeded( const Operation& Op1, const Operation& Op2) const ;
|
||||
bool RemoveClimb( int nClPathId) ;
|
||||
bool AddRise( DBLVECTOR& vAxVal, double dDelta = - 1, int nClPathId = GDB_ID_NULL, bool bZHomeDown = false) ;
|
||||
bool AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL, int nFlag = 0) ;
|
||||
bool RemoveRise( int nClPathId = GDB_ID_NULL) ;
|
||||
bool AddHome( void) ;
|
||||
bool ApplyHintToPrevAxRot( const std::string& sHint, const Machine* pMch, DBLVECTOR& vAxRotPrec) ;
|
||||
bool CalculateClPathMcentAxesValues( int nClPathId, double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome,
|
||||
DBLVECTOR& vAxRotPrec) ;
|
||||
bool EraseAddedPoints( int nClPathId) ;
|
||||
bool MyCalculateClPathMcentAxesValues( int nClPathId, double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome,
|
||||
DBLVECTOR& vAxRotPrec, bool bFirstTry, int& nOutStrC) ;
|
||||
bool CalculateMcentRotAxesValues( bool bFirst, const Vector3d& vtTool, const Vector3d& vtAux,
|
||||
double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome, const DBLVECTOR& vAxRotPrec,
|
||||
DBLVECTOR& vAxRot) ;
|
||||
bool VerifyMcentLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec, const Vector3d& vtAuxPrec, const Vector3d& vtCorrPrec, const DBLVECTOR& vAxPrec,
|
||||
const Point3d& ptP, const Vector3d& vtDir, const Vector3d& vtAux, const Vector3d& vtCorr, const DBLVECTOR& vAxVal,
|
||||
int nCnt, int nEntId, int nMoveType, bool bToolShow, bool& bAdded, bool& bAxError) ;
|
||||
bool CalculateClPathRobotAxesValues( int nClPathId, double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome,
|
||||
DBLVECTOR& vAxRotPrec) ;
|
||||
bool CalculateRobotAxesValues( bool bFirst, const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtAux,
|
||||
double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome, const DBLVECTOR& vAxRotPrec,
|
||||
DBLVECTOR& vAxRot) ;
|
||||
bool VerifyRobotLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec, const Vector3d& vtAuxPrec, const Vector3d& vtCorrPrec, const DBLVECTOR& vAxPrec,
|
||||
const Point3d& ptP, const Vector3d& vtDir, const Vector3d& vtAux, const Vector3d& vtCorr, const DBLVECTOR& vAxVal,
|
||||
int nCnt, int nEntId, int nMoveType, bool bToolShow, bool& bAdded, bool& bAxError) ;
|
||||
bool GetAxisMidForTestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nAxisOrder, Machine* pMch,
|
||||
DBLVECTOR& vAxMid) const ;
|
||||
bool OneMoveTestCollisionAvoid( const STRVECTOR& vAxName, const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd,
|
||||
Machine* pMch, const INTVECTOR& vRawId, const INTVECTOR& vFxtId) const ;
|
||||
bool AdjustStartEndMovementsStd( bool bVerifyPreviousLink) ;
|
||||
bool AdjustOneStartEndMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOpe, const DBLVECTOR& vAxPrev, double dPrevOffsX, bool bMaxZ) ;
|
||||
bool AdjustStartEndMovementsNew( void) ;
|
||||
bool MoveHeadFromHomeToMach( bool bMain, const std::string& sToolName, const std::string& sHeadName, int nExitNbr, int nStartZMax) ;
|
||||
bool MoveHeadFromMachToMach( Operation* pPrevOpe,
|
||||
bool bPrevMain, const std::string& sPrevToolName, const std::string& sPrevHeadName, int nPrevExitNbr,
|
||||
bool bCurrMain, const std::string& sCurrToolName, const std::string& sCurrHeadName, int nCurrExitNbr,
|
||||
bool bToolChange, int nStartZMax) ;
|
||||
bool MoveHeadFromMachToHome( Operation* pPrevOpe, bool bCurrMain, const std::string& sCurrToolName, const std::string& sCurrHeadName, int nCurrExitNbr,
|
||||
int nStartZMax) ;
|
||||
bool ManageDoubleOperNew( Operation* pPrevOpe) ;
|
||||
bool ManageSpecialLink( Operation* pPrevOpe, int nPrevClPathId, bool bPrevMain, Operation* pNextOpe, int nNextClPathId, bool bNextMain,
|
||||
int nStartZMax) ;
|
||||
bool ToolChangeNeeded( const Operation& Ope1, bool bMain1, const Operation& Ope2, bool bMain2) const ;
|
||||
bool AddSpecialClimb( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL, bool bMain = true,
|
||||
int nFlag = 0, int nFlag2 = 0, int nMask = -1, const std::string& sInfo = "", bool bFirst = true) ;
|
||||
bool RemoveClimb( int nClPathId = GDB_ID_NULL, bool bMain = true) ;
|
||||
bool AddRise( DBLVECTOR& vAxVal, double dDelta = NAN, int nClPathId = GDB_ID_NULL, bool bMain = true, int nToMinMaxZ = 0) ;
|
||||
bool AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL, bool bMain = true,
|
||||
int nFlag = 0, int nFlag2 = 0, int nMask = -1, const std::string& sInfo = "") ;
|
||||
bool RemoveRise( int nClPathId = GDB_ID_NULL, bool bMain = true) ;
|
||||
bool AddHome( bool bMain = true) ;
|
||||
bool AddRobotClimb( int nEntId, double dDeltaZ = NAN) ;
|
||||
bool CalcRobotAxesAbovePos( const Point3d& ptP, const Vector3d& vtT, const Vector3d& vtA, double dDeltaZ,
|
||||
DBLVECTOR& vAx, double* pdNewDeltaZ = nullptr) const ;
|
||||
bool CalcDeltaZForHeadRotation( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, double& dDeltaZ) const ;
|
||||
bool GetExtraZ( const DBLVECTOR& vAx1, const Vector3d& vtTool1,
|
||||
const DBLVECTOR& vAx2, const Vector3d& vtTool2,
|
||||
@@ -143,14 +270,16 @@ class Operation : public IUserObj
|
||||
const DBLVECTOR& vAx2, const Vector3d& vtTool2,
|
||||
double& dMaxZ) const ;
|
||||
bool GetRotationAtZmax( void) const ;
|
||||
bool ForcedZmax( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ;
|
||||
bool ForcedZmax( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, const BBox3d& b3Raws) const ;
|
||||
int GetUserNotesZmax( void) const ;
|
||||
bool GetZHomeDown( void) const ;
|
||||
bool TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ;
|
||||
bool SpecialMoveZup( DBLVECTOR& vAx, Vector3d& vtTool, int& nFlag, int& nFlag2, bool& bModif) ;
|
||||
bool SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, DBLVECTOR& vAxNew, bool& bModif) ;
|
||||
|
||||
bool GetAggrBottomData( const std::string& sHead, AggrBottom& agbData) const ;
|
||||
int SpecialTestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ;
|
||||
bool SpecialMoveZup( DBLVECTOR& vAx, Vector3d& vtTool, int& nFlag, int& nFlag2, bool& bModif) ;
|
||||
bool SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, DBLVECTOR& vAxNew, bool& bModif) ;
|
||||
bool SpecialLink( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nLinkType,
|
||||
const Operation* pPrevOpe, bool bPrevMain, const Operation* pNextOpe, bool bNextMain,
|
||||
int nStartZMax) ;
|
||||
bool SpecialPrevMachiningOffset( const Operation* pPrevOpe, double& dOffsetX) ;
|
||||
|
||||
protected :
|
||||
int m_nOwnerId ; // identificativo dell'oggetto geometrico possessore
|
||||
@@ -166,6 +295,7 @@ class Operation : public IUserObj
|
||||
bool SetCorrAuxDir( const Vector3d& vtDir) ;
|
||||
bool SetFeed( double dFeed) ;
|
||||
bool SetFlag( int nFlag) ;
|
||||
bool SetFlagOnLastMove( int nFlag) ;
|
||||
bool SetFlag2( int nFlag2) ;
|
||||
bool SetIndex( int nIndex) ;
|
||||
bool GetCurrPos( Point3d& ptCurr) const
|
||||
@@ -180,12 +310,26 @@ class Operation : public IUserObj
|
||||
int AddRapidStart( const Point3d& ptP, const std::string& sName) ;
|
||||
int AddRapidMove( const Point3d& ptP) ;
|
||||
int AddRapidMove( const Point3d& ptP, const std::string& sName) ;
|
||||
int AddRapidMove( const Point3d& ptP, bool bSplit) ;
|
||||
int AddRapidMove( const Point3d& ptP, bool bSplit, const std::string& sName) ;
|
||||
int AddRapidStartOrMove( const Point3d& ptP, bool bFirst)
|
||||
{ return ( bFirst ? AddRapidStart( ptP) : AddRapidMove( ptP)) ; }
|
||||
int AddRapidStartOrMove( const Point3d& ptP, bool bFirst, const std::string& sName)
|
||||
{ return ( bFirst ? AddRapidStart( ptP, sName) : AddRapidMove( ptP, sName)) ; }
|
||||
int AddRapidStartOrMove( const Point3d& ptP, bool bFirst, bool bSplit)
|
||||
{ return ( bFirst ? AddRapidStart( ptP) : AddRapidMove( ptP, bSplit)) ; }
|
||||
int AddRapidStartOrMove( const Point3d& ptP, bool bFirst, bool bSplit, const std::string& sName)
|
||||
{ return ( bFirst ? AddRapidStart( ptP, sName) : AddRapidMove( ptP, bSplit, sName)) ; }
|
||||
int AddLinearMove( const Point3d& ptP) ;
|
||||
int AddLinearMove( const Point3d& ptP, const std::string& sName) ;
|
||||
int AddLinearMove( const Point3d& ptP, bool bSplit) ;
|
||||
int AddLinearMove( const Point3d& ptP, bool bSplit, const std::string& sName) ;
|
||||
int AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN) ;
|
||||
int AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN, const std::string& sName) ;
|
||||
int AddCurveMove( const ICurve* pCrv, bool bOnlySimple = false) ;
|
||||
int AddCurveMove( const ICurve* pCrv, const std::string& sName, bool bOnlySimple = false) ;
|
||||
int AddCurveMove( const ICurve* pCrv) ;
|
||||
int AddCurveMove( const ICurve* pCrv, const std::string& sName) ;
|
||||
int AddCurveMove( const ICurve* pCrv, bool bSplit) ;
|
||||
int AddCurveMove( const ICurve* pCrv, bool bSplit, const std::string& sName) ;
|
||||
bool ResetMoveData( void) ;
|
||||
|
||||
protected :
|
||||
@@ -208,7 +352,15 @@ inline Operation* GetOperation( IUserObj* pUserObj)
|
||||
{ return dynamic_cast< Operation*>( pUserObj) ; }
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Tipo di controllo per lavorazione vuota
|
||||
enum { NEED_GEOM = 0, NEED_ONE_TP_OK = 1, NEED_ALL_TP_OK = 2} ;
|
||||
// tipo posizione utensile
|
||||
enum { TOOL_PARAL = 1, TOOL_ORTHO = 2, TOOL_ORTUP = 3, TOOL_PAR_SLANT= 4} ;
|
||||
// tipo di utilizzo contorno faccia
|
||||
enum { FACE_DOWN = 1, FACE_TOP = 2, FACE_FRONT = 3, FACE_BACK = 4, FACE_LEFT = 5, FACE_RIGHT = 6, FACE_CONT = 7} ;
|
||||
enum { FACE_DOWN = 1, FACE_TOP = 2, FACE_FRONT = 3, FACE_BACK = 4, FACE_LEFT = 5, FACE_RIGHT = 6,
|
||||
FACE_CONT = 7, FACE_VERSOR = 8, FACE_EDGES = 9} ;
|
||||
// risultato di SpecialTestCollisionAvoid
|
||||
enum { SCAV_ERROR = -1, SCAV_COLLIDE = 0, SCAV_AVOID = 1, SCAV_TOTEST = 2} ;
|
||||
// ordine di movimento assi nei link
|
||||
enum { LKAMO_INTERP = 0, LKAMO_HEAD_BEFORE = -1, LKAMO_HEAD_AFTER = +1,
|
||||
LKAMO_HEAD_BEFORE_IF_SAME_ANG = -2, LKAMO_HEAD_AFTER_IF_SAME_ANG = +2} ;
|
||||
+123
-6
@@ -82,6 +82,18 @@ Operation::SetFlag( int nFlag)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::SetFlagOnLastMove( int nFlag)
|
||||
{
|
||||
int nLastEntId = m_pGeomDB->GetLastInGroup( m_nPathId) ;
|
||||
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nLastEntId)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
pCamData->SetFlag( nFlag) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::SetFlag2( int nFlag2)
|
||||
@@ -200,6 +212,46 @@ Operation::AddRapidMove( const Point3d& ptP, const string& sName)
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Operation::AddRapidMove( const Point3d& ptP, bool bSplit)
|
||||
{
|
||||
// se non richiesta spezzatura con massima lunghezza, emissione normale
|
||||
if ( ! NeedSplit( bSplit))
|
||||
return AddRapidMove( ptP) ;
|
||||
// altrimenti opportuna spezzatura
|
||||
Point3d ptS ;
|
||||
if ( ! GetCurrPos( ptS))
|
||||
return GDB_ID_NULL ;
|
||||
double dLen = Dist( ptS, ptP) ;
|
||||
double dStep = GetMaxSplitLen( true, false) ;
|
||||
int nStep = int( dLen / dStep + 0.999) ;
|
||||
int nFirstId = GDB_ID_NULL ;
|
||||
for ( int i = 1 ; i <= nStep ; ++ i) {
|
||||
int nId = AddRapidMove( Media( ptS, ptP, i * 1.0 / nStep)) ;
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
if ( nFirstId == GDB_ID_NULL)
|
||||
nFirstId = nId ;
|
||||
SetFlag( 0) ;
|
||||
SetFlag2( 0) ;
|
||||
}
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Operation::AddRapidMove( const Point3d& ptP, bool bSplit, const string& sName)
|
||||
{
|
||||
int nFirstId = AddRapidMove( ptP, bSplit) ;
|
||||
int nId = nFirstId ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
m_pGeomDB->SetName( nId, sName) ;
|
||||
nId = m_pGeomDB->GetNext( nId) ;
|
||||
}
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Operation::AddLinearMove( const Point3d& ptP)
|
||||
@@ -258,6 +310,44 @@ Operation::AddLinearMove( const Point3d& ptP, const string& sName)
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Operation::AddLinearMove( const Point3d& ptP, bool bSplit)
|
||||
{
|
||||
// se non richiesta spezzatura con massima lunghezza, emissione normale
|
||||
if ( ! NeedSplit( bSplit))
|
||||
return AddLinearMove( ptP) ;
|
||||
// altrimenti opportuna spezzatura
|
||||
Point3d ptS ;
|
||||
if ( ! GetCurrPos( ptS))
|
||||
return GDB_ID_NULL ;
|
||||
double dLen = Dist( ptS, ptP) ;
|
||||
double dStep = GetMaxSplitLen( true, true) ;
|
||||
int nStep = int( ceil( ( dLen - EPS_ZERO) / dStep)) ;
|
||||
int nFirstId = GDB_ID_NULL ;
|
||||
for ( int i = 1 ; i <= nStep ; ++ i) {
|
||||
int nId = AddLinearMove( Media( ptS, ptP, i * 1.0 / nStep)) ;
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
if ( nFirstId == GDB_ID_NULL)
|
||||
nFirstId = nId ;
|
||||
}
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Operation::AddLinearMove( const Point3d& ptP, bool bSplit, const string& sName)
|
||||
{
|
||||
int nFirstId = AddLinearMove( ptP, bSplit) ;
|
||||
int nId = nFirstId ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
m_pGeomDB->SetName( nId, sName) ;
|
||||
nId = m_pGeomDB->GetNext( nId) ;
|
||||
}
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Operation::AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN)
|
||||
@@ -334,7 +424,7 @@ Operation::AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen,
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Operation::AddCurveMove( const ICurve* pCrv, bool bOnlySimple)
|
||||
Operation::AddCurveMove( const ICurve* pCrv)
|
||||
{
|
||||
// verifico che la curva esista
|
||||
if ( pCrv == nullptr)
|
||||
@@ -355,8 +445,8 @@ Operation::AddCurveMove( const ICurve* pCrv, bool bOnlySimple)
|
||||
pArc->GetEndPoint( ptP3) ;
|
||||
return AddArcMove( ptP3, ptCen, dAngCen, vtN) ;
|
||||
}
|
||||
// se ammesse curve composite
|
||||
else if ( ! bOnlySimple) {
|
||||
// se arco o curva composita
|
||||
else if ( pCrv->GetType() == CRV_ARC || pCrv->GetType() == CRV_COMPO) {
|
||||
// in ogni caso, converto in archi e rette
|
||||
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
|
||||
if ( ! pCompo->AddCurve( *pCrv))
|
||||
@@ -395,16 +485,43 @@ Operation::AddCurveMove( const ICurve* pCrv, bool bOnlySimple)
|
||||
}
|
||||
return nFirstId ;
|
||||
}
|
||||
// altrimenti
|
||||
// altre curve non ammesse
|
||||
else
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Operation::AddCurveMove( const ICurve* pCrv, const string& sName, bool bOnlySimple)
|
||||
Operation::AddCurveMove( const ICurve* pCrv, const string& sName)
|
||||
{
|
||||
int nFirstId = AddCurveMove( pCrv, bOnlySimple) ;
|
||||
int nFirstId = AddCurveMove( pCrv) ;
|
||||
int nId = nFirstId ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
m_pGeomDB->SetName( nId, sName) ;
|
||||
nId = m_pGeomDB->GetNext( nId) ;
|
||||
}
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Operation::AddCurveMove( const ICurve* pCrv, bool bSplit)
|
||||
{
|
||||
// se non richiesta spezzatura, emissione normale
|
||||
if ( ! bSplit)
|
||||
return AddCurveMove( pCrv) ;
|
||||
// altrimenti opportuna spezzatura
|
||||
PtrOwner<ICurveComposite> pCompo ;
|
||||
if ( ! pCompo.Set( ConvertCurveToComposite( pCrv->Clone())) || ! ApproxWithLines( pCompo))
|
||||
return false ;
|
||||
return AddCurveMove( pCompo) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Operation::AddCurveMove( const ICurve* pCrv, bool bSplit, const string& sName)
|
||||
{
|
||||
int nFirstId = AddCurveMove( pCrv, bSplit) ;
|
||||
int nId = nFirstId ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
m_pGeomDB->SetName( nId, sName) ;
|
||||
|
||||
+13
-5
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2017-2019
|
||||
// EgalTech 2017-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : OperationConst.h Data : 08.07.19 Versione : 2.1g2
|
||||
// File : OperationConst.h Data : 22.05.24 Versione : 2.6e5
|
||||
// Contenuto : Costanti per le operazioni.
|
||||
//
|
||||
//
|
||||
@@ -9,6 +9,7 @@
|
||||
// Modifiche : 17.08.17 DS Creazione modulo.
|
||||
// 25.05.19 DS Aggiunte SurfRoughing e SurfFinishing.
|
||||
// 25.05.19 DS Aggiunta WaterJetting.
|
||||
// 22.05.24 DS Aggiunta FiveAxisMilling.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -17,7 +18,6 @@
|
||||
#include "/EgtDev/Include/EMkOperationConst.h"
|
||||
#include <string>
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static const std::string s_OpeClass[] = {"",
|
||||
"EMkDisposition",
|
||||
@@ -32,7 +32,9 @@ static const std::string s_OpeClass[] = {"",
|
||||
"EMkChiseling",
|
||||
"EMkSurfRoughing",
|
||||
"EMkSurfFinishing",
|
||||
"EMkWaterJetting"} ;
|
||||
"EMkWaterJetting",
|
||||
"EMkFiveAxisMilling",
|
||||
"EMkProbing"} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Dal tipo numerico restituisce la classe della operazione
|
||||
@@ -53,6 +55,8 @@ GetOperationClass( int nOpeType)
|
||||
case OPER_SURFROUGHING : return s_OpeClass[11] ;
|
||||
case OPER_SURFFINISHING : return s_OpeClass[12] ;
|
||||
case OPER_WATERJETTING : return s_OpeClass[13] ;
|
||||
case OPER_FIVEAXISMILLING : return s_OpeClass[14] ;
|
||||
case OPER_PROBING : return s_OpeClass[15] ;
|
||||
}
|
||||
return s_OpeClass[0] ;
|
||||
}
|
||||
@@ -88,6 +92,10 @@ GetOperationType( const std::string& sOpeClass)
|
||||
return OPER_SURFFINISHING ;
|
||||
else if ( sOpeClass == s_OpeClass[13])
|
||||
return OPER_WATERJETTING ;
|
||||
else if ( sOpeClass == s_OpeClass[14])
|
||||
return OPER_FIVEAXISMILLING ;
|
||||
else if ( sOpeClass == s_OpeClass[15])
|
||||
return OPER_PROBING ;
|
||||
else
|
||||
return OPER_NULL ;
|
||||
}
|
||||
}
|
||||
|
||||
+171
-44
@@ -45,12 +45,17 @@ static const std::string GVAR_EMPTY = ".EMPTY" ; // (bool) flag disp
|
||||
static const std::string GVAR_SBH = ".SBH" ; // (bool) flag disposizione con operazioni manuali
|
||||
static const std::string GVAR_TABNAME = ".TABNAME" ; // (string) nome tavola
|
||||
static const std::string GVAR_TABORI1 = ".TABORI1" ; // (Point3d) prima origine di tavola
|
||||
static const std::string GVAR_TAIND = ".TAIND" ; // (int) indice asse tavola
|
||||
static const std::string GVAR_TANAME = ".TANAME" ; // (string) nome asse tavola
|
||||
static const std::string GVAR_TAPOS = ".TAPOS" ; // (double) posizione asse tavola
|
||||
static const std::string GVAR_TAMOVED = ".TAMOVED" ; // (bool) flag asse tavola con movimento
|
||||
static const std::string GVAR_FIXID = ".FIXID" ; // (int) identificativo bloccaggio (fixture)
|
||||
static const std::string GVAR_FIXIND = ".FIXIND" ; // (int) indice bloccaggio
|
||||
static const std::string GVAR_FIXNAME = ".FIXNAME" ; // (string) nome bloccaggio
|
||||
static const std::string GVAR_FIXPOS = ".FIXPOS" ; // (Point3d) posizione bloccaggio
|
||||
static const std::string GVAR_FIXANG = ".FIXANG" ; // (num) angolo di rotazione bloccaggio
|
||||
static const std::string GVAR_FIXMOB = ".FIXMOB" ; // (num) movimento eventuale parte mobile del bloccaggio
|
||||
static const std::string GVAR_FIXTAL = ".FIXTAL" ; // (string) nome dell'asse di tavola a cui è fissato
|
||||
static const std::string GVAR_RAWID = ".RAWID" ; // (int) identificativo grezzo
|
||||
static const std::string GVAR_RAWIND = ".RAWIND" ; // (int) indice movimento del grezzo
|
||||
static const std::string GVAR_RAWTYPE = ".RAWTYPE" ; // (int) tipo di movimento del grezzo
|
||||
@@ -60,6 +65,8 @@ static const std::string GVAR_TOOL = ".TOOL" ; // (string) nome uten
|
||||
static const std::string GVAR_HEAD = ".HEAD" ; // (string) nome testa
|
||||
static const std::string GVAR_EXIT = ".EXIT" ; // (int) indice uscita
|
||||
static const std::string GVAR_TCPOS = ".TCPOS" ; // (string) eventuale posizione utensile nel TC
|
||||
static const std::string GVAR_TTYPE = ".TTYPE" ; // (int) tipo utensile
|
||||
static const std::string GVAR_TFLOAT = ".TFLOAT" ; // (bool) flag per utensile flottante
|
||||
static const std::string GVAR_TCOMP = ".TCOMP" ; // (int) numero correttore utensile
|
||||
static const std::string GVAR_TDIAM = ".TDIAM" ; // (num) diametro utensile
|
||||
static const std::string GVAR_TTOTDIAM = ".TTOTDIAM" ; // (num) diametro totale utensile
|
||||
@@ -81,6 +88,7 @@ static const std::string GVAR_MAXMIN = ".MAXMIN" ; // (double/s) minimo di
|
||||
static const std::string GVAR_MAXMAX = ".MAXMAX" ; // (double/s) massimo di ingombro degli assi della lavorazione
|
||||
static const std::string GVAR_PATHID = ".PATHID" ; // (int) identificativo percorso di lavorazione
|
||||
static const std::string GVAR_PATHIND = ".PATHIND" ; // (int) indice percorso di lavorazione
|
||||
static const std::string GVAR_DBLPATHID = ".DBLPATHID" ; // (int) identificativo eventuale percorso di lavorazione in doppio
|
||||
static const std::string GVAR_START = ".START" ; // (Point3d) punto iniziale del percorso originale
|
||||
static const std::string GVAR_END = ".END" ; // (Point3d) punto finale del percorso originale
|
||||
static const std::string GVAR_EXTR = ".EXTR" ; // (Vector3d) versore estrusione
|
||||
@@ -89,6 +97,7 @@ static const std::string GVAR_PMAX = ".PMAX" ; // (Point3d) punto mas
|
||||
static const std::string GVAR_PAXMIN = ".PAXMIN" ; // (double/s) minimo di ingombro degli assi del percorso di lavorazione
|
||||
static const std::string GVAR_PAXMAX = ".PAXMAX" ; // (double/s) massimo di ingombro degli assi del percorso di lavorazione
|
||||
static const std::string GVAR_ELEV = ".ELEV" ; // (double) massima elevazione
|
||||
static const std::string GVAR_DRACEX = ".DRACEX" ; // (int/s) vettore delle uscite selezionate (per gruppi a forare)
|
||||
static const std::string GVAR_AUXTOT = ".AUXTOT" ; // (int) numero totale dati ausiliari inizio/fine percorso di lavorazione
|
||||
static const std::string GVAR_AUXIND = ".AUXIND" ; // (int) indice dato ausiliario inizio/fine percorso di lavorazione
|
||||
static const std::string GVAR_AUX = ".AUX" ; // (string) dato ausiliario inizio/fine percorso di lavorazione
|
||||
@@ -102,6 +111,9 @@ static const std::string GVAR_R1 = ".R1" ; // (num) valore de
|
||||
static const std::string GVAR_R2 = ".R2" ; // (num) valore del secondo asse rotante
|
||||
static const std::string GVAR_R3 = ".R3" ; // (num) valore del terzo asse rotante
|
||||
static const std::string GVAR_R4 = ".R4" ; // (num) valore del quarto asse rotante
|
||||
static const std::string GVAR_R5 = ".R5" ; // (num) valore del quinto asse rotante
|
||||
static const std::string GVAR_R6 = ".R6" ; // (num) valore del sesto asse rotante
|
||||
static const std::string GVAR_R7 = ".R7" ; // (num) valore del settimo asse rotante
|
||||
static const std::string GVAR_C1 = ".C1" ; // (num) valore del primo asse lineare per centro arco
|
||||
static const std::string GVAR_C2 = ".C2" ; // (num) valore del secondo asse lineare per centro arco
|
||||
static const std::string GVAR_C3 = ".C3" ; // (num) valore del terzo asse lineare per centro arco
|
||||
@@ -117,6 +129,20 @@ static const std::string GVAR_R1P = ".R1p" ; // (num) valore pr
|
||||
static const std::string GVAR_R2P = ".R2p" ; // (num) valore precedente del secondo asse rotante
|
||||
static const std::string GVAR_R3P = ".R3p" ; // (num) valore precedente del terzo asse rotante
|
||||
static const std::string GVAR_R4P = ".R4p" ; // (num) valore precedente del quarto asse rotante
|
||||
static const std::string GVAR_R5P = ".R5p" ; // (num) valore precedente del quinto asse rotante
|
||||
static const std::string GVAR_R6P = ".R6p" ; // (num) valore precedente del sesto asse rotante
|
||||
static const std::string GVAR_R7P = ".R7p" ; // (num) valore precedente del settimo asse rotante
|
||||
static const std::string GVAR_MOVESUCC = ".MOVESUCC" ; // (int) tipo del movimento successivo (0,1,2,3)
|
||||
static const std::string GVAR_L1S = ".L1s" ; // (num) valore successivo del primo asse lineare
|
||||
static const std::string GVAR_L2S = ".L2s" ; // (num) valore successivo del secondo asse lineare
|
||||
static const std::string GVAR_L3S = ".L3s" ; // (num) valore successivo del terzo asse lineare
|
||||
static const std::string GVAR_R1S = ".R1s" ; // (num) valore successivo del primo asse rotante
|
||||
static const std::string GVAR_R2S = ".R2s" ; // (num) valore successivo del secondo asse rotante
|
||||
static const std::string GVAR_R3S = ".R3s" ; // (num) valore successivo del terzo asse rotante
|
||||
static const std::string GVAR_R4S = ".R4s" ; // (num) valore successivo del quarto asse rotante
|
||||
static const std::string GVAR_R5S = ".R5s" ; // (num) valore successivo del quinto asse rotante
|
||||
static const std::string GVAR_R6S = ".R6s" ; // (num) valore successivo del sesto asse rotante
|
||||
static const std::string GVAR_R7S = ".R7s" ; // (num) valore successivo del settimo asse rotante
|
||||
static const std::string GVAR_L1T = ".L1t" ; // (string) token del primo asse lineare
|
||||
static const std::string GVAR_L2T = ".L2t" ; // (string) token del secondo asse lineare
|
||||
static const std::string GVAR_L3T = ".L3t" ; // (string) token del terzo asse lineare
|
||||
@@ -124,6 +150,9 @@ static const std::string GVAR_R1T = ".R1t" ; // (string) token del
|
||||
static const std::string GVAR_R2T = ".R2t" ; // (string) token del secondo asse rotante
|
||||
static const std::string GVAR_R3T = ".R3t" ; // (string) token del terzo asse rotante
|
||||
static const std::string GVAR_R4T = ".R4t" ; // (string) token del quarto asse rotante
|
||||
static const std::string GVAR_R5T = ".R5t" ; // (string) token del quinto asse rotante
|
||||
static const std::string GVAR_R6T = ".R6t" ; // (string) token del sesto asse rotante
|
||||
static const std::string GVAR_R7T = ".R7t" ; // (string) token del settimo asse rotante
|
||||
static const std::string GVAR_C1T = ".C1t" ; // (string) token del primo asse lineare per centro arco
|
||||
static const std::string GVAR_C2T = ".C2t" ; // (string) token del secondo asse lineare per centro arco
|
||||
static const std::string GVAR_C3T = ".C3t" ; // (string) token del terzo asse lineare per centro arco
|
||||
@@ -138,6 +167,9 @@ static const std::string GVAR_R1N = ".R1n" ; // (string) nome del
|
||||
static const std::string GVAR_R2N = ".R2n" ; // (string) nome del secondo asse rotante
|
||||
static const std::string GVAR_R3N = ".R3n" ; // (string) nome del terzo asse rotante
|
||||
static const std::string GVAR_R4N = ".R4n" ; // (string) nome del quarto asse rotante
|
||||
static const std::string GVAR_R5N = ".R5n" ; // (string) nome del quinto asse rotante
|
||||
static const std::string GVAR_R6N = ".R6n" ; // (string) nome del sesto asse rotante
|
||||
static const std::string GVAR_R7N = ".R7n" ; // (string) nome del settimo asse rotante
|
||||
static const std::string GVAR_MASK = ".MASK" ; // (int) mask associato ai movimenti in rapido
|
||||
static const std::string GVAR_FLAG = ".FLAG" ; // (int) flag associato ad ogni movimento
|
||||
static const std::string GVAR_FLAG2 = ".FLAG2" ; // (int) secondo flag associato ad ogni movimento
|
||||
@@ -160,6 +192,11 @@ static const std::string GVAR_SIMUISTAT = ".SIMUISTAT" ; // (num) stato sim
|
||||
static const std::string GVAR_SAFEDIST = ".SAFEDIST" ; // (num) distanza di sicurezza per verifica di collisione
|
||||
static const std::string GVAR_SIMVMID = ".SIMVMID" ; // (int) identificativo grezzo Vmill in collisione
|
||||
static const std::string GVAR_SIMCOBIND = ".SIMCOBIND" ; // (int) indice oggetto in collisione
|
||||
static const std::string GVAR_TOOLTRACE = ".TOOLTRACE" ; // (int) identificativo gruppo di tracciatura utensile
|
||||
static const std::string GVAR_MPSIM = ".MPSIM" ; // (bool) flag simulazione multiprocesso
|
||||
static const std::string GVAR_MPSEST = ".MPSEST" ; // (string) path del file di stima speciale per simulazione multiprocesso
|
||||
static const std::string GVAR_RECORD = ".RECORD" ; // (bool) flag modalità registrazione comandi in simulazione
|
||||
static const std::string GVAR_OPERID = ".OPERID" ; // (int/s) identificativi ordinati operazioni per simulazione multiprocesso
|
||||
// Funzioni generazione
|
||||
static const std::string ON_START = "OnStart" ;
|
||||
static const std::string ON_END = "OnEnd" ;
|
||||
@@ -169,6 +206,7 @@ static const std::string ON_TOOL_DATA = "OnToolData" ;
|
||||
static const std::string ON_DISPOSITION_START = "OnDispositionStart" ;
|
||||
static const std::string ON_DISPOSITION_END = "OnDispositionEnd" ;
|
||||
static const std::string ON_TABLE_DATA = "OnTableData" ;
|
||||
static const std::string ON_TABLE_AXIS_DATA = "OnTableAxisData" ;
|
||||
static const std::string ON_FIXTURE_DATA = "OnFixtureData" ;
|
||||
static const std::string ON_RAWMOVE_DATA = "OnRawMoveData" ;
|
||||
static const std::string ON_TOOL_SELECT = "OnToolSelect" ;
|
||||
@@ -191,6 +229,7 @@ static const std::string ON_ESTIM_TOOL_DATA = "OnEstimToolData" ;
|
||||
static const std::string ON_ESTIM_DISPOSITION_START = "OnEstimDispositionStart" ;
|
||||
static const std::string ON_ESTIM_DISPOSITION_END = "OnEstimDispositionEnd" ;
|
||||
static const std::string ON_ESTIM_TABLE_DATA = "OnEstimTableData" ;
|
||||
static const std::string ON_ESTIM_TABLE_AXIS_DATA = "OnEstimTableAxisData" ;
|
||||
static const std::string ON_ESTIM_FIXTURE_DATA = "OnEstimFixtureData" ;
|
||||
static const std::string ON_ESTIM_RAWMOVE_DATA = "OnEstimRawMoveData" ;
|
||||
static const std::string ON_ESTIM_TOOL_SELECT = "OnEstimToolSelect" ;
|
||||
@@ -205,6 +244,8 @@ static const std::string ON_ESTIM_RAPID = "OnEstimRapid" ;
|
||||
static const std::string ON_ESTIM_LINEAR = "OnEstimLinear" ;
|
||||
static const std::string ON_ESTIM_ARC = "OnEstimArc" ;
|
||||
// Funzioni simulazione
|
||||
static const std::string ON_SIMUL_INIT = "OnSimulInit" ;
|
||||
static const std::string ON_SIMUL_EXIT = "OnSimulExit" ;
|
||||
static const std::string ON_SIMUL_START = "OnSimulStart" ;
|
||||
static const std::string ON_SIMUL_END = "OnSimulEnd" ;
|
||||
static const std::string ON_SIMUL_DISPOSITION_STARTING = "OnSimulDispositionStarting" ;
|
||||
@@ -226,64 +267,150 @@ static const std::string ON_RESET_MACHINE = "OnResetMachine" ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline std::string
|
||||
GetGlobVarAxisValue( int nAx, const std::string& sVar = GLOB_VAR)
|
||||
GetGlobVarAxisValue( int nAx, const std::string& sVar = GLOB_VAR, bool bIsRobot = false)
|
||||
{
|
||||
switch ( nAx) {
|
||||
case 1 : return ( sVar + GVAR_L1) ;
|
||||
case 2 : return ( sVar + GVAR_L2) ;
|
||||
case 3 : return ( sVar + GVAR_L3) ;
|
||||
case 4 : return ( sVar + GVAR_R1) ;
|
||||
case 5 : return ( sVar + GVAR_R2) ;
|
||||
case 6 : return ( sVar + GVAR_R3) ;
|
||||
case 7 : return ( sVar + GVAR_R4) ;
|
||||
default : return "" ;
|
||||
}
|
||||
if ( ! bIsRobot) {
|
||||
switch ( nAx) {
|
||||
case 1 : return ( sVar + GVAR_L1) ;
|
||||
case 2 : return ( sVar + GVAR_L2) ;
|
||||
case 3 : return ( sVar + GVAR_L3) ;
|
||||
case 4 : return ( sVar + GVAR_R1) ;
|
||||
case 5 : return ( sVar + GVAR_R2) ;
|
||||
case 6 : return ( sVar + GVAR_R3) ;
|
||||
case 7 : return ( sVar + GVAR_R4) ;
|
||||
default : return "" ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch ( nAx) {
|
||||
case 1 : return ( sVar + GVAR_R1) ;
|
||||
case 2 : return ( sVar + GVAR_R2) ;
|
||||
case 3 : return ( sVar + GVAR_R3) ;
|
||||
case 4 : return ( sVar + GVAR_R4) ;
|
||||
case 5 : return ( sVar + GVAR_R5) ;
|
||||
case 6 : return ( sVar + GVAR_R6) ;
|
||||
case 7 : return ( sVar + GVAR_R7) ;
|
||||
default : return "" ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline std::string
|
||||
GetGlobVarAxisPrev( int nAx, const std::string& sVar = GLOB_VAR)
|
||||
GetGlobVarAxisPrev( int nAx, const std::string& sVar = GLOB_VAR, bool bIsRobot = false)
|
||||
{
|
||||
switch ( nAx) {
|
||||
case 1 : return ( sVar + GVAR_L1P) ;
|
||||
case 2 : return ( sVar + GVAR_L2P) ;
|
||||
case 3 : return ( sVar + GVAR_L3P) ;
|
||||
case 4 : return ( sVar + GVAR_R1P) ;
|
||||
case 5 : return ( sVar + GVAR_R2P) ;
|
||||
case 6 : return ( sVar + GVAR_R3P) ;
|
||||
case 7 : return ( sVar + GVAR_R4P) ;
|
||||
default : return "" ;
|
||||
}
|
||||
if ( ! bIsRobot) {
|
||||
switch ( nAx) {
|
||||
case 1 : return ( sVar + GVAR_L1P) ;
|
||||
case 2 : return ( sVar + GVAR_L2P) ;
|
||||
case 3 : return ( sVar + GVAR_L3P) ;
|
||||
case 4 : return ( sVar + GVAR_R1P) ;
|
||||
case 5 : return ( sVar + GVAR_R2P) ;
|
||||
case 6 : return ( sVar + GVAR_R3P) ;
|
||||
case 7 : return ( sVar + GVAR_R4P) ;
|
||||
default : return "" ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch ( nAx) {
|
||||
case 1 : return ( sVar + GVAR_R1P) ;
|
||||
case 2 : return ( sVar + GVAR_R2P) ;
|
||||
case 3 : return ( sVar + GVAR_R3P) ;
|
||||
case 4 : return ( sVar + GVAR_R4P) ;
|
||||
case 5 : return ( sVar + GVAR_R5P) ;
|
||||
case 6 : return ( sVar + GVAR_R6P) ;
|
||||
case 7 : return ( sVar + GVAR_R7P) ;
|
||||
default : return "" ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline std::string
|
||||
GetGlobVarAxisToken( int nAx)
|
||||
GetGlobVarAxisNext( int nAx, const std::string& sVar = GLOB_VAR, bool bIsRobot = false)
|
||||
{
|
||||
switch ( nAx) {
|
||||
case 1 : return ( GLOB_VAR + GVAR_L1T) ;
|
||||
case 2 : return ( GLOB_VAR + GVAR_L2T) ;
|
||||
case 3 : return ( GLOB_VAR + GVAR_L3T) ;
|
||||
case 4 : return ( GLOB_VAR + GVAR_R1T) ;
|
||||
case 5 : return ( GLOB_VAR + GVAR_R2T) ;
|
||||
case 6 : return ( GLOB_VAR + GVAR_R3T) ;
|
||||
case 7 : return ( GLOB_VAR + GVAR_R4T) ;
|
||||
default : return "" ;
|
||||
}
|
||||
if ( ! bIsRobot) {
|
||||
switch ( nAx) {
|
||||
case 1 : return ( sVar + GVAR_L1S) ;
|
||||
case 2 : return ( sVar + GVAR_L2S) ;
|
||||
case 3 : return ( sVar + GVAR_L3S) ;
|
||||
case 4 : return ( sVar + GVAR_R1S) ;
|
||||
case 5 : return ( sVar + GVAR_R2S) ;
|
||||
case 6 : return ( sVar + GVAR_R3S) ;
|
||||
case 7 : return ( sVar + GVAR_R4S) ;
|
||||
default : return "" ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch ( nAx) {
|
||||
case 1 : return ( sVar + GVAR_R1S) ;
|
||||
case 2 : return ( sVar + GVAR_R2S) ;
|
||||
case 3 : return ( sVar + GVAR_R3S) ;
|
||||
case 4 : return ( sVar + GVAR_R4S) ;
|
||||
case 5 : return ( sVar + GVAR_R5S) ;
|
||||
case 6 : return ( sVar + GVAR_R6S) ;
|
||||
case 7 : return ( sVar + GVAR_R7S) ;
|
||||
default : return "" ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline std::string
|
||||
GetGlobVarAxisName( int nAx)
|
||||
GetGlobVarAxisToken( int nAx, bool bIsRobot = false)
|
||||
{
|
||||
switch ( nAx) {
|
||||
case 1 : return ( GLOB_VAR + GVAR_L1N) ;
|
||||
case 2 : return ( GLOB_VAR + GVAR_L2N) ;
|
||||
case 3 : return ( GLOB_VAR + GVAR_L3N) ;
|
||||
case 4 : return ( GLOB_VAR + GVAR_R1N) ;
|
||||
case 5 : return ( GLOB_VAR + GVAR_R2N) ;
|
||||
case 6 : return ( GLOB_VAR + GVAR_R3N) ;
|
||||
case 7 : return ( GLOB_VAR + GVAR_R4N) ;
|
||||
default : return "" ;
|
||||
}
|
||||
if ( ! bIsRobot) {
|
||||
switch ( nAx) {
|
||||
case 1 : return ( GLOB_VAR + GVAR_L1T) ;
|
||||
case 2 : return ( GLOB_VAR + GVAR_L2T) ;
|
||||
case 3 : return ( GLOB_VAR + GVAR_L3T) ;
|
||||
case 4 : return ( GLOB_VAR + GVAR_R1T) ;
|
||||
case 5 : return ( GLOB_VAR + GVAR_R2T) ;
|
||||
case 6 : return ( GLOB_VAR + GVAR_R3T) ;
|
||||
case 7 : return ( GLOB_VAR + GVAR_R4T) ;
|
||||
default : return "" ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch ( nAx) {
|
||||
case 1 : return ( GLOB_VAR + GVAR_R1T) ;
|
||||
case 2 : return ( GLOB_VAR + GVAR_R2T) ;
|
||||
case 3 : return ( GLOB_VAR + GVAR_R3T) ;
|
||||
case 4 : return ( GLOB_VAR + GVAR_R4T) ;
|
||||
case 5 : return ( GLOB_VAR + GVAR_R5T) ;
|
||||
case 6 : return ( GLOB_VAR + GVAR_R6T) ;
|
||||
case 7 : return ( GLOB_VAR + GVAR_R7T) ;
|
||||
default : return "" ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline std::string
|
||||
GetGlobVarAxisName( int nAx, bool bIsRobot = false)
|
||||
{
|
||||
if ( ! bIsRobot) {
|
||||
switch ( nAx) {
|
||||
case 1 : return ( GLOB_VAR + GVAR_L1N) ;
|
||||
case 2 : return ( GLOB_VAR + GVAR_L2N) ;
|
||||
case 3 : return ( GLOB_VAR + GVAR_L3N) ;
|
||||
case 4 : return ( GLOB_VAR + GVAR_R1N) ;
|
||||
case 5 : return ( GLOB_VAR + GVAR_R2N) ;
|
||||
case 6 : return ( GLOB_VAR + GVAR_R3N) ;
|
||||
case 7 : return ( GLOB_VAR + GVAR_R4N) ;
|
||||
default : return "" ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch ( nAx) {
|
||||
case 1 : return ( GLOB_VAR + GVAR_R1N) ;
|
||||
case 2 : return ( GLOB_VAR + GVAR_R2N) ;
|
||||
case 3 : return ( GLOB_VAR + GVAR_R3N) ;
|
||||
case 4 : return ( GLOB_VAR + GVAR_R4N) ;
|
||||
case 5 : return ( GLOB_VAR + GVAR_R5N) ;
|
||||
case 6 : return ( GLOB_VAR + GVAR_R6N) ;
|
||||
case 7 : return ( GLOB_VAR + GVAR_R7N) ;
|
||||
default : return "" ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+592
-448
File diff suppressed because it is too large
Load Diff
+22
-15
@@ -35,8 +35,14 @@ class Pocketing : public Machining
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_POCKETING ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nPockets == 0) ; }
|
||||
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
|
||||
{ if ( m_nPockets == 0)
|
||||
return true ;
|
||||
if ( nEmptyType == NEED_ONE_TP_OK)
|
||||
return ( ! IsAtLeastOnePathOk()) ;
|
||||
if ( nEmptyType == NEED_ALL_TP_OK)
|
||||
return ( ! AreAllPathsOk()) ;
|
||||
return false ; }
|
||||
bool UpdateStatus( int nModif) override
|
||||
{ m_nStatus |= nModif ; return true ; }
|
||||
|
||||
@@ -58,7 +64,7 @@ class Pocketing : public Machining
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool UpdateToolData( bool* pbChanged = nullptr) override ;
|
||||
bool UpdateToolData( void) override ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
|
||||
@@ -68,26 +74,26 @@ class Pocketing : public Machining
|
||||
private :
|
||||
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
|
||||
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
|
||||
bool SetCurveAllTempProp( int nCrvId, ICurve* pCurve) ;
|
||||
bool SetCurveAllTempProp( int nCrvId, bool bForcedClose, ICurve* pCurve, bool* pbSomeOpen = nullptr) ;
|
||||
bool ResetCurveAllTempProp( ICurve* pCurve) ;
|
||||
bool Chain( int nGrpDestId) ;
|
||||
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
|
||||
bool CalcRegionElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double& dElev) const ;
|
||||
bool CalcRegionElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double dLen, double& dElev) const ;
|
||||
bool VerifyPathFromBottom( const ICurveComposite* pCompo, const Vector3d& vtTool) ;
|
||||
bool GeneratePocketingPv( int nPathId, const ICurveComposite* pCompo) ;
|
||||
bool AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
|
||||
double dDepth, double dElev, double dOkStep, bool bSplitArcs, int nPathId) ;
|
||||
bool CalcZigZag( const ICurveComposite* pOffs, ICRVCOMPOPOVECTOR& vpCrvs) ;
|
||||
bool OptimizedZigZag( int nPathId, const Vector3d& vtTool, double dDepth, double dSafeZ,
|
||||
Frame3d& frPocket, bool& bOptimizedZigZag, ICRVCOMPOPOVECTOR& vpCrvs) ;
|
||||
bool ZigZagOptimizedNoClosedEdges( ICurveComposite* pCrvPocket, bool& bOptimizedZigZag, Vector3d& vtDir) ;
|
||||
bool ZigZagOptimizedOneClosedEdge( ICurveComposite* pCrvPocket, int nClosedId, bool& bOptimizedZigZag, Vector3d& vtDir) ;
|
||||
Frame3d& frPocket, bool& bOptimizedZigZag, ICRVCOMPOPOVECTOR& vpCrvs, double& dOffs) ;
|
||||
bool ZigZagOptimizedNoClosedEdges( ICurveComposite* pCrvPocket, bool& bOptimizedZigZag, Vector3d& vtDir, double& dOffs) ;
|
||||
bool ZigZagOptimizedOneClosedEdge( ICurveComposite* pCrvPocket, int nClosedId, bool& bOptimizedZigZag, Vector3d& vtDir, double& dOffs) ;
|
||||
bool ZigZagOptimizedTwoClosedEdges( ICurveComposite* pCrvPocket, const INTVECTOR& vnClosedIds, bool& bOptimizedZigZag,
|
||||
bool& bOpposite, Vector3d& vtDir) ;
|
||||
bool& bOpposite, Vector3d& vtDir, double& dOffs) ;
|
||||
bool ZigZagOptimizedThreeClosedEdges( ICurveComposite* pCrvPocket, const INTVECTOR& vnClosedIds, bool& bOptimizedZigZag,
|
||||
bool& bOpposite, Vector3d& vtDir) ;
|
||||
bool& bOpposite, Vector3d& vtDir, double& dOffs) ;
|
||||
bool ZigZagOptimizedComputeOffset( ICurveComposite* pCrvPocket, const Vector3d& vtMainDir, int nOffsettedEdgesOnY,
|
||||
const INTVECTOR& vnClosedIds) ;
|
||||
const INTVECTOR& vnClosedIds, double& dOffs) ;
|
||||
bool CutCurveWithLine( ICurveComposite* pCrvA, const ICurveLine* pCrvB) ;
|
||||
bool AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
|
||||
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
|
||||
@@ -116,13 +122,13 @@ class Pocketing : public Machining
|
||||
bool ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv, bool bSplitArcs) ;
|
||||
bool AddEpicycles( ICurveComposite * pCompo, ICurveComposite * pCrv, ICurveComposite * pCrvBound = nullptr) ;
|
||||
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr, bool bOutStart) ;
|
||||
double dElev, double dAppr, bool bSplitArcs, bool bOutStart) ;
|
||||
bool AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr, bool bOutStart = false) ;
|
||||
double dElev, double dAppr, bool bSplitArcs, bool bOutStart = false) ;
|
||||
bool AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr) ;
|
||||
double dElev, double dAppr, bool bSplitArcs) ;
|
||||
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr) ;
|
||||
double dElev, double dAppr, bool bSplitArcs) ;
|
||||
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
|
||||
const ICurveComposite* pRCrv, Point3d& ptP1) const ;
|
||||
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
|
||||
@@ -135,6 +141,7 @@ class Pocketing : public Machining
|
||||
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced,
|
||||
Point3d& ptP1, double& dElev, bool& bOppositeHome) ;
|
||||
double GetRadiusForStartEndElevation( void) const ;
|
||||
bool GetForcedClosed( void) ;
|
||||
bool GetMidOfLongestOpenSide( const ICurveComposite* pCompo, Point3d& ptMid, Vector3d& vtMidOut) ;
|
||||
bool AdjustContourWithOpenEdges( ICurveComposite* pCompo) ;
|
||||
bool AdjustContourStart( ICurveComposite* pCompo) ;
|
||||
|
||||
+2
-1
@@ -397,7 +397,8 @@ bool
|
||||
PocketingData::VerifySubType( int nVal) const
|
||||
{
|
||||
return ( nVal == POCKET_SUB_ZIGZAG || nVal == POCKET_SUB_ONEWAY ||
|
||||
nVal == POCKET_SUB_SPIRALIN || nVal == POCKET_SUB_SPIRALOUT) ;
|
||||
nVal == POCKET_SUB_SPIRALIN || nVal == POCKET_SUB_SPIRALOUT ||
|
||||
nVal == POCKET_SUB_CONFORMAL_ZIGZAG || nVal == POCKET_SUB_CONFORMAL_ONEWAY) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+6
-2
@@ -83,6 +83,10 @@ struct PocketingData : public MachiningData
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline const PocketingData* GetPocketingData( const MachiningData* pMdata)
|
||||
{ return (dynamic_cast<const PocketingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_POCKETING)
|
||||
return nullptr ;
|
||||
return ( static_cast<const PocketingData*>( pMdata)) ; }
|
||||
inline PocketingData* GetPocketingData( MachiningData* pMdata)
|
||||
{ return (dynamic_cast<PocketingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_POCKETING)
|
||||
return nullptr ;
|
||||
return ( static_cast<PocketingData*>( pMdata)) ; }
|
||||
|
||||
+5975
File diff suppressed because it is too large
Load Diff
+236
@@ -0,0 +1,236 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2017-2017
|
||||
//----------------------------------------------------------------------------
|
||||
// File :Pocketing.h Data : 04.02.17 Versione : 1.8b1
|
||||
// Contenuto : Dichiarazione della classe Pocketing.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 04.02.17 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Machining.h"
|
||||
#include "PocketingData.h"
|
||||
#include "ToolData.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
#include "/EgtDev/Include/EGkIntersPlaneSurfTm.h"
|
||||
|
||||
// struttura informazioni sui singoli percorsi
|
||||
struct PathInfoPO {
|
||||
bool bOutStart ; // flag per entrata da fuori
|
||||
bool bOutEnd ; // flag per uscita da fuori
|
||||
bool bSingleCrv ; // se percorso formato da una curva singola ( in generale per SubSteps)
|
||||
bool bOptTrap ; // flag per casi ottimizzati a trapezio ( per Spiral)
|
||||
bool bOptCirle ; // flag per casi ottimizzati a Spirale ( per Spiral)
|
||||
bool bIsZigZagOneWayBorder ; // curve di bordo dei lati chiusi ( per ZigZag e OneWay)
|
||||
PtrOwner<ICurveComposite> pCrvPath ; // percorso del centro utensile
|
||||
PtrOwner<ICurveComposite> pCrvGlideIn ; // curva per LeadIn a guida
|
||||
PtrOwner<ICurveComposite> pCrvGlideOut ; // curva per LeadOut a guida
|
||||
PtrOwner<ICurveComposite> pCrvRet ; // curva di ritorno ( per ora solo caso fori)
|
||||
} ;
|
||||
// tipo percorso
|
||||
typedef std::vector<PathInfoPO> PATHINFOPOVECTOR ;
|
||||
|
||||
// struttura informazioni per Step/SubSteps complessivi
|
||||
struct StepInfoPO {
|
||||
double dDepth ; // profondità dello step attuale
|
||||
double dRelativeDepth ; // profondità relativa allo step al di sopra
|
||||
PtrOwner<ISurfFlatRegion> pSfrPock ; // regione piana di svuotatura
|
||||
PtrOwner<ISurfFlatRegion> pSfrLimit ; // regione piana da non svuotare
|
||||
PATHINFOPOVECTOR vPaths ; // percorsi di Pocketing
|
||||
} ;
|
||||
// tipo step
|
||||
typedef std::vector<StepInfoPO> STEPINFOPOVECTOR ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class PocketingNT : public Machining
|
||||
{
|
||||
public : // IUserObj
|
||||
PocketingNT* Clone( void) const override ;
|
||||
const std::string& GetClassName( void) const override ;
|
||||
bool Dump( std::string& sOut, bool bMM = true, const char* szNewLine = "\n") const override ;
|
||||
bool ToSave( void) const override
|
||||
{ return true ; }
|
||||
bool Save( int nBaseId, STRVECTOR& vString) const override ;
|
||||
bool Load( const STRVECTOR& vString, int nBaseGdbId) override ;
|
||||
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_POCKETING ; }
|
||||
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
|
||||
{ if ( m_nPockets == 0)
|
||||
return true ;
|
||||
if ( nEmptyType == NEED_ONE_TP_OK)
|
||||
return ( ! IsAtLeastOnePathOk()) ;
|
||||
if ( nEmptyType == NEED_ALL_TP_OK)
|
||||
return ( ! AreAllPathsOk()) ;
|
||||
return false ; }
|
||||
bool UpdateStatus( int nModif) override
|
||||
{ m_nStatus |= nModif ; return true ; }
|
||||
|
||||
protected : // Operation
|
||||
int GetSolCh( void) const override
|
||||
{ return m_Params.m_nSolCh ; }
|
||||
|
||||
public : // Machining
|
||||
bool Prepare( const std::string& sMillName) override ;
|
||||
bool SetParam( int nType, bool bVal) override ;
|
||||
bool SetParam( int nType, int nVal) override ;
|
||||
bool SetParam( int nType, double dVal) override ;
|
||||
bool SetParam( int nType, const std::string& sVal) override ;
|
||||
bool SetGeometry( const SELVECTOR& vIds) override ;
|
||||
bool Preview( bool bRecalc) override ;
|
||||
bool Apply( bool bRecalc, bool bPostApply) override ;
|
||||
bool Update( bool bPostApply) override ;
|
||||
bool GetParam( int nType, bool& bVal) const override ;
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool UpdateToolData( void) override ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
|
||||
public :
|
||||
PocketingNT( void) ;
|
||||
|
||||
private :
|
||||
bool MyApply( bool bRecalc, bool bPostApply) ;
|
||||
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
|
||||
bool AdjustCurvesByStmTopology( const ISurfTriMesh* pSurf, const Frame3d& frGlob, const ISurfTriMesh* pStmTrim, ICURVEPLIST& lstPC) ;
|
||||
bool GetCurves( const SelData& Id, const ISurfTriMesh* pStmRaw, const ISurfTriMesh* pStmTrim, ICURVEPLIST& lstPC) ;
|
||||
bool SetCurveAllTempProp( int nCrvId, bool bForcedClose, ICurve* pCurve, bool* pbSomeOpen = nullptr) ;
|
||||
bool SetSfrLoopsAllTempProp( int nSfrId, ISurfFlatRegion* pSfr) ;
|
||||
bool ResetCurveAllTempProp( ICurve* pCurve) ;
|
||||
bool Chain( int nGrpDestId) ;
|
||||
ISurfTriMesh* GetRaw( void) ;
|
||||
ISurfTriMesh* GetStmTrim( void) ;
|
||||
ISurfTriMesh* GetExtrusionStm( const ISurfFlatRegion* pSfr, const Vector3d& vtExtr) ;
|
||||
ISurfFlatRegion* GetSfrByStmIntersection( const IntersParPlanesSurfTm& IPPStm, double dDist, double dSmallOffs = 0) ;
|
||||
ISurfFlatRegion* GetSfrRawProjection( const ISurfTriMesh* pStmRaw, const ISurfFlatRegion* pSfr, const Vector3d& vtTool) ;
|
||||
Point3d GetStartPointsByHead( const STEPINFOPOVECTOR& vStepInfo) const ;
|
||||
Point3d GetStartPointsFromSteps( const STEPINFOPOVECTOR& vStepInfo, int nCrvType) const ;
|
||||
bool ChooseRawPart( const ISurfFlatRegion* pSfrChunk, ISurfTriMesh* pStm) const ;
|
||||
bool ManageOpenEdges( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStmPart) ;
|
||||
bool GetHomogeneousParts( const ICurveComposite* pCrvCompo, ICRVCOMPOPOVECTOR& vpCrvs) const ;
|
||||
bool ExtendOpenEdges( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStm) ;
|
||||
bool ChooseCloseOrOpenEdge( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStmExtrusion) ;
|
||||
bool CheckMaxDepth( const ISurfFlatRegion* pSfr, double dDepth, const Vector3d& vtTool,
|
||||
const ISurfTriMesh* pStmRaw, const ISurfTriMesh* pStmExtrusion,
|
||||
const IntersParPlanesSurfTm& IPPStm, bool& bSkipMaxDepth) ;
|
||||
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
|
||||
bool CalcRegionElevation( const ISurfFlatRegion* pSfr, const Vector3d& vtTool, double dDepth,
|
||||
double dRad, double dLen, double& dElev) ;
|
||||
bool VerifyPathFromBottom( const ICurveComposite* pCompo, const Vector3d& vtTool) ;
|
||||
bool GeneratePocketingPv( int nPathId, const ICurveComposite* pCompo) ;
|
||||
bool CalcLimitRegion( const ISurfFlatRegion* pSfrPock, const ISurfFlatRegion* pSfrRaw, ISurfFlatRegion* pSfrLimit) ;
|
||||
bool CalcPaths( STEPINFOPOVECTOR& vStepInfo) ;
|
||||
bool CalcRetCurve( PathInfoPO& PathInfo, const StepInfoPO& StepInfo, const ICurveComposite* pCrvPath,
|
||||
const Vector3d& vtTool, bool bHolePocketing, bool bInVsOut, ICurveComposite* pCrvGlide) ;
|
||||
bool AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, double dStep, bool bSplitArcs, Point3d& ptPockStart, Point3d& ptPockEnd) ;
|
||||
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) ;
|
||||
bool CutCurveWithLine( ICurveComposite* pCrvA, const ICurveLine* pCrvB) ;
|
||||
bool ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv, bool bSplitArcs) ;
|
||||
bool AddEpicycles( ICurveComposite * pCompo, ICurveComposite * pCrv, ICurveComposite * pCrvBound = nullptr) ;
|
||||
bool CalcBoundedLinkWithBiArcs( const Point3d& ptStart, const Vector3d& vtStart, const Point3d& ptEnd, const Vector3d& vtEnd,
|
||||
const ICurve* pCrvBound, ICurveComposite* pCrvLink) ;
|
||||
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr, bool bSplitArcs, bool bOutStart) ;
|
||||
bool AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr, bool bSplitArcs, bool bOutStart = false) ;
|
||||
bool AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr, bool bSplitArcs) ;
|
||||
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr, bool bSplitArcs) ;
|
||||
bool CalcFirstElevation( const Point3d& ptStart, const Point3d& ptP1, const Vector3d& vtTool,
|
||||
const StepInfoPO& currStep, double dSafeZ, double dStep, double& dCurrElev,
|
||||
double& dEscapeElev, Vector3d& vtEscape) const ;
|
||||
bool CalcLastElevation( const Point3d& ptStart, const Point3d& ptP1, const Vector3d& vtTool,
|
||||
const StepInfoPO& currStep, double dSafeZ, double dStep, double& dCurrElev,
|
||||
double& dEscapeElev, Vector3d& vtEscape) const ;
|
||||
bool CalcLeadInStart( Point3d& ptStart, const Vector3d& vtTool, const ICurveComposite* pCrvPath, Point3d& ptP1) ;
|
||||
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
|
||||
const ISurfFlatRegion* pSfr, const ICurveComposite* pRCrv, bool bAtLeft, bool bSplitArcs,
|
||||
bool bNoneForced, bool bSkipControl) ;
|
||||
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN, const ISurfFlatRegion* pSfr,
|
||||
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced, Point3d& ptP1) ;
|
||||
double GetRadiusForStartEndElevation( void) const ;
|
||||
bool GetForcedClosed( void) ;
|
||||
bool ManageSmoothLink( const PathInfoPO& currPath, const PathInfoPO& nextPath, bool bSamePlane,
|
||||
bool& bSmoothEnd, bool& bForceLinear) ;
|
||||
bool CheckSafetyLink( const Point3d& ptCurr, const Vector3d& vtCurr,
|
||||
const Point3d& ptDest, const Vector3d& vtDest,
|
||||
const ISurfFlatRegion* pSfrLimit, const Vector3d& vtTool,
|
||||
bool bSmoothEnd, bool& bSafeLimit, ICurveComposite* pCrvSafeLink) ;
|
||||
bool VerifyLeadInHelix( const ISurfFlatRegion* pSfr, const Point3d& ptStart, const Point3d& ptCen, double dHelixRad) ;
|
||||
bool VerifyLeadInZigZag( const ISurfFlatRegion* pSfr, const Point3d& ptStart, const Point3d& ptPa, const Point3d& ptPb) ;
|
||||
bool VerifyLeadInOutGlide( const ISurfFlatRegion* pSfr, ICurveComposite* pCrvGlide) ;
|
||||
bool CalcDistanceFromRawSurface( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist, Vector3d& vtNorm) ;
|
||||
// debug
|
||||
void DebugDrawSfr( const ISurfFlatRegion* pSfr, bool bUniform, int nlayer = GDB_ID_ROOT) ;
|
||||
void DebugDrawLoop( const ICurveComposite* pCrvCompo, int nLayer, bool bUniform) ;
|
||||
void DebugDrawBox( const BBox3d& BBox, const Frame3d& FrBox, int nlayer) ;
|
||||
void DebugDrawOpenEdgesInRaw( const ICRVCOMPOPOVECTOR& vpCrvsm, int nlayer) ;
|
||||
void DebugDrawFeed( const ICurve* pCrv, double dFeed, int nlayer) ;
|
||||
|
||||
private :
|
||||
double GetSpeed( void) const
|
||||
{ return ( IsNullAngValue( m_Params.m_dSpeed) ? m_TParams.m_dSpeed : m_Params.m_dSpeed) ; }
|
||||
double GetFeed( void) const
|
||||
{ return ( IsNullLenValue( m_Params.m_dFeed) ? m_TParams.m_dFeed : m_Params.m_dFeed) ; }
|
||||
double GetStartFeed( void) const
|
||||
{ return ( IsNullLenValue( m_Params.m_dStartFeed) ? m_TParams.m_dStartFeed : m_Params.m_dStartFeed) ; }
|
||||
double GetEndFeed( void) const
|
||||
{ return ( IsNullLenValue( m_Params.m_dEndFeed) ? m_TParams.m_dEndFeed : m_Params.m_dEndFeed) ; }
|
||||
double GetTipFeed( void) const
|
||||
{ return ( IsNullLenValue( m_Params.m_dTipFeed) ? m_TParams.m_dTipFeed : m_Params.m_dTipFeed) ; }
|
||||
double GetOffsL( void) const
|
||||
{ return ( IsUnknownValue( m_Params.m_dOffsL) ? m_TParams.m_dOffsL : m_Params.m_dOffsL) ; }
|
||||
double GetOffsR( void) const
|
||||
{ return ( IsUnknownValue( m_Params.m_dOffsR) ? m_TParams.m_dOffsR : m_Params.m_dOffsR) ; }
|
||||
double GetSideStep( void) const
|
||||
{ return Clamp( m_Params.m_dSideStep, std::min( 0.1 * m_TParams.m_dDiam, 1.0), m_TParams.m_dDiam) ; }
|
||||
int GetLeadInType( void) const
|
||||
{ if ( m_Params.m_dLiTang < std::min( 0.1 * m_TParams.m_dDiam, 1.0))
|
||||
return POCKET_LI_NONE ;
|
||||
if ( m_Params.m_nLeadInType != POCKET_LI_GLIDE && m_Params.m_dLiElev < 10 * EPS_SMALL)
|
||||
return POCKET_LI_NONE ;
|
||||
return m_Params.m_nLeadInType ; }
|
||||
bool LeadInRawIsOk( void) const
|
||||
{ if ( m_TParams.m_nType != TT_MILL_NOTIP)
|
||||
return true ;
|
||||
return (( GetLeadInType() == POCKET_LI_ZIGZAG || GetLeadInType() == POCKET_LI_HELIX) &&
|
||||
m_Params.m_dLiTang >= 0.9 * m_TParams.m_dDiam && m_Params.m_dLiElev <= 2) ; }
|
||||
int GetLeadOutType( void) const
|
||||
{ if ( m_Params.m_dLoTang < std::min( 0.1 * m_TParams.m_dDiam, 1.0))
|
||||
return POCKET_LO_NONE ;
|
||||
return m_Params.m_nLeadOutType ; }
|
||||
|
||||
private :
|
||||
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
|
||||
PocketingData m_Params ; // parametri lavorazione
|
||||
ToolData m_TParams ; // parametri utensile
|
||||
double m_dTHoldBase ; // posizione base del porta-utensile
|
||||
double m_dTHoldLen ; // lunghezza del porta-utensile
|
||||
double m_dTHoldDiam ; // diametro del porta-utensile
|
||||
double m_dMaxHelixRad ; // raggio massimo attacco ad elica nel caso di cerchi
|
||||
int m_nStatus ; // stato di aggiornamento della lavorazione
|
||||
int m_nPockets ; // numero di percorsi di svuotatura generati
|
||||
bool m_bTiltingTab ; // flag utilizzo tavola basculante
|
||||
Vector3d m_vtTiltingAx ; // versore direzione eventuale asse basculante
|
||||
bool m_bAboveHead ; // flag utilizzo testa da sopra
|
||||
bool m_bAggrBottom ; // flag di utilizzo dell'aggregato da sotto
|
||||
Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto
|
||||
AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto
|
||||
bool m_bOpenOutRaw ; // flag forzatura lati aperti sempre fuori dal grezzo
|
||||
double m_dOpenMinSafe ; // minima distanza di sicurezza di attacco su lato aperto
|
||||
double m_dOpenInRawExtension ; // estensione dei tratti aperti dentro al grezzo
|
||||
bool m_bAllClose ; // flag per forzare i lati come tutti chiusi
|
||||
bool m_bRunning ; // flag di calcoli in corso
|
||||
} ;
|
||||
+955
@@ -0,0 +1,955 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2025-2025
|
||||
//----------------------------------------------------------------------------
|
||||
// File : Probing.cpp Data : 10.06.25 Versione : 2.7f2
|
||||
// Contenuto : Implementazione gestione tastatura.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 10.06.25 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "MachMgr.h"
|
||||
#include "DllMain.h"
|
||||
#include "Probing.h"
|
||||
#include "OperationConst.h"
|
||||
#include "OperUserNotesConst.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EGkArcSpecial.h"
|
||||
#include "/EgtDev/Include/EGkSfrCreate.h"
|
||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EGkUserObjFactory.h"
|
||||
#include "/EgtDev/Include/EGnStringKeyVal.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include "/EgtDev/Include/EgtIniFile.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//------------------------------ Errors --------------------------------------
|
||||
// 3401 = "Error in Probing : UpdateToolData failed"
|
||||
// 3402 = "Error in Probing : missing Script (xxx)"
|
||||
// 3403 = "Error in Probing : Error in xxx (nnn)"
|
||||
// 3404 = "Error in Probing : axes values not calculable"
|
||||
// 3405 = "Error in Probing : outstroke xx"
|
||||
// 3406 = "Error in Probing : link movements not calculable"
|
||||
// 3407 = "Error in Probing : link outstroke xx"
|
||||
// 3408 = "Error in Probing : post apply not calculable"
|
||||
// 3409 = "Error in Probing : Tool loading failed"
|
||||
// 3410 = "Error in Probing : special apply not calculable"
|
||||
// 3451 = "Warning in Probing : Skipped entity (xx)"
|
||||
// 3452 = "Warning in Probing : No machinable path"
|
||||
// 3453 = "Warning in Probing : Tool name changed (xx)"
|
||||
// 3454 = "Warning in Probing : Tool data changed (xx)"
|
||||
|
||||
//------------------------------ Constants -----------------------------------
|
||||
static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo
|
||||
static const string EVAR_MACHID = ".MACHID" ; // IN (int) identificativo della lavorazione
|
||||
static const string EVAR_GEOM = ".GEOM" ; // IN (table) tabella delle entità da lavorare
|
||||
static const string EVAR_DEPTH = ".DEPTH" ; // IN (string) affondamento (espressione numerica)
|
||||
static const string EVAR_TINVERT = ".TOOLINVERT" ; // IN (bool) flag di inversione direzione utensile
|
||||
static const string EVAR_INVERT = ".INVERT" ; // IN (bool) flag di inversione direzione lavorazione
|
||||
static const string EVAR_STARTPOS = ".STARTPOS" ; // IN (num) quota di inizio lavorazione (sempre >= 0)
|
||||
static const string EVAR_SYSNOTES = ".SYSNOTES" ; // IN (string) note interne
|
||||
static const string EVAR_USERNOTES = ".USERNOTES" ;// IN (string) note dell'utente
|
||||
static const string EVAR_TOOL = ".TOOL" ; // IN (string) nome dell'utensile
|
||||
static const string EVAR_HEAD = ".HEAD" ; // IN (string) nome testa
|
||||
static const string EVAR_EXIT = ".EXIT" ; // IN (int) indice uscita
|
||||
static const string EVAR_TTYPE = ".TTYPE" ; // IN (int) tipo utensile
|
||||
static const string EVAR_TDIAM = ".TDIAM" ; // IN (num) diametro utensile
|
||||
static const string EVAR_TTOTDIAM = ".TTOTDIAM" ; // IN (num) diametro totale utensile
|
||||
static const string EVAR_TLEN = ".TLEN" ; // IN (num) lunghezza utensile
|
||||
static const string EVAR_TTOTLEN = ".TTOTLEN" ; // IN (num) lunghezza totale utensile
|
||||
static const string EVAR_TTHICK = ".THICK" ; // IN (num) spessore per lame o altezza taglienti
|
||||
static const string EVAR_TCORNRAD = ".TCORNRAD" ; // IN (num) raggio corner
|
||||
static const string EVAR_FEED = ".FEED" ; // IN (num) feed dell'utensile
|
||||
static const string EVAR_STARTFEED = ".STARTFEED" ;// IN (num) feed di inizio dell'utensile
|
||||
static const string EVAR_ENDFEED = ".ENDFEED" ; // IN (num) feed di fine dell'utensile
|
||||
static const string EVAR_TIPFEED = ".TIPFEED" ; // IN (num) feed di punta dell'utensile
|
||||
static const string EVAR_ISROBOT = ".ISROBOT" ; // IN (bool) flag per indicare che la cinematica è di tipo robot
|
||||
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok)
|
||||
static const string EVAR_MILLS = ".MILLS" ; // OUT (int) numero di percorsi di lavoro
|
||||
static const string ON_PREVIEW = "OnPreview_" ;
|
||||
static const string ON_APPLY = "OnApply_" ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
USEROBJ_REGISTER( GetOperationClass( OPER_PROBING), Probing) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const string&
|
||||
Probing::GetClassName( void) const
|
||||
{
|
||||
return USEROBJ_GETNAME( Probing) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
Probing*
|
||||
Probing::Clone( void) const
|
||||
{
|
||||
// alloco oggetto
|
||||
Probing* pGenM = new(nothrow) Probing ;
|
||||
// eseguo copia dei dati
|
||||
if ( pGenM != nullptr) {
|
||||
try {
|
||||
pGenM->m_vId = m_vId ;
|
||||
pGenM->m_pMchMgr = m_pMchMgr ;
|
||||
pGenM->m_nPhase = m_nPhase ;
|
||||
pGenM->m_Params = m_Params ;
|
||||
pGenM->m_TParams = m_TParams ;
|
||||
pGenM->m_nStatus = m_nStatus ;
|
||||
pGenM->m_nMills = m_nMills ;
|
||||
}
|
||||
catch( ...) {
|
||||
delete pGenM ;
|
||||
return nullptr ;
|
||||
}
|
||||
}
|
||||
// ritorno l'oggetto
|
||||
return pGenM ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Probing::Dump( string& sOut, bool bMM, const char* szNewLine) const
|
||||
{
|
||||
sOut += GetClassName() + "[mm]" + szNewLine ;
|
||||
sOut += KEY_PHASE + EQUAL + ToString( m_nPhase) + szNewLine ;
|
||||
sOut += KEY_IDS + EQUAL + ToString( m_vId) + szNewLine ;
|
||||
for ( int i = 0 ; i < m_Params.GetSize() ; ++ i)
|
||||
sOut += m_Params.ToString( i) + szNewLine ;
|
||||
for ( int i = 0 ; i < m_TParams.GetSize() ; ++ i)
|
||||
sOut += m_TParams.ToString( i) + szNewLine ;
|
||||
sOut += KEY_NUM + EQUAL + ToString( m_nMills) + szNewLine ;
|
||||
sOut += KEY_STAT + EQUAL + ToString( m_nStatus) + szNewLine ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Probing::Save( int nBaseId, STRVECTOR& vString) const
|
||||
{
|
||||
try {
|
||||
int nSize = 1 + m_Params.GetSize() + m_TParams.GetSize() + 3 ;
|
||||
vString.insert( vString.begin(), nSize, "") ;
|
||||
int k = - 1 ;
|
||||
if ( ! SetVal( KEY_IDS, m_vId, vString[++k]))
|
||||
return false ;
|
||||
for ( int i = 0 ; i < m_Params.GetSize() ; ++ i)
|
||||
vString[++k] = m_Params.ToString( i) ;
|
||||
for ( int i = 0 ; i < m_TParams.GetSize() ; ++ i)
|
||||
vString[++k] = m_TParams.ToString( i) ;
|
||||
if ( ! SetVal( KEY_PHASE, m_nPhase, vString[++k]))
|
||||
return false ;
|
||||
if ( ! SetVal( KEY_NUM, m_nMills, vString[++k]))
|
||||
return false ;
|
||||
if ( ! SetVal( KEY_STAT, m_nStatus, vString[++k]))
|
||||
return false ;
|
||||
}
|
||||
catch( ...) {
|
||||
return false ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Probing::Load( const STRVECTOR& vString, int nBaseGdbId)
|
||||
{
|
||||
int nSize = int( vString.size()) ;
|
||||
// lista identificativi geometrie da lavorare
|
||||
int k = - 1 ;
|
||||
if ( k >= nSize - 1 || ! GetVal( vString[++k], KEY_IDS, m_vId))
|
||||
return false ;
|
||||
for ( auto& Sel : m_vId)
|
||||
Sel.nId += nBaseGdbId ;
|
||||
// parametri lavorazione
|
||||
for ( int i = 0 ; i < m_Params.GetSize() ; ++ i) {
|
||||
int nKey ;
|
||||
if ( k >= nSize - 1 || ! m_Params.FromString( vString[++k], nKey) || nKey != i) {
|
||||
if ( m_Params.IsOptional( i))
|
||||
-- k ;
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// parametri utensile
|
||||
for ( int i = 0 ; i < m_TParams.GetSize() ; ++ i) {
|
||||
int nKey ;
|
||||
if ( k >= nSize - 1 || ! m_TParams.FromString( vString[++k], nKey) || nKey != i)
|
||||
return false ;
|
||||
}
|
||||
// parametri di stato
|
||||
while ( k < nSize - 1) {
|
||||
// separo chiave da valore
|
||||
string sKey, sVal ;
|
||||
SplitFirst( vString[++k], "=", sKey, sVal) ;
|
||||
// leggo
|
||||
if ( sKey == KEY_PHASE) {
|
||||
if ( ! FromString( sVal, m_nPhase))
|
||||
return false ;
|
||||
}
|
||||
else if ( sKey == KEY_NUM) {
|
||||
if ( ! FromString( sVal, m_nMills))
|
||||
return false ;
|
||||
}
|
||||
else if ( sKey == KEY_STAT) {
|
||||
if ( ! FromString( sVal, m_nStatus))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------------
|
||||
Probing::Probing( void)
|
||||
{
|
||||
m_Params.m_sName = "*" ;
|
||||
m_Params.m_sToolName = "*" ;
|
||||
m_TParams.m_sName = "*" ;
|
||||
m_TParams.m_sHead = "*" ;
|
||||
m_nStatus = MCH_ST_TO_VERIFY ;
|
||||
m_nMills = 0 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Probing::Prepare( const string& sGenMchName)
|
||||
{
|
||||
// verifico il gestore lavorazioni
|
||||
if ( m_pMchMgr == nullptr)
|
||||
return false ;
|
||||
// recupero il gestore DB utensili della macchina corrente
|
||||
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
|
||||
if ( pTMgr == nullptr)
|
||||
return false ;
|
||||
// recupero il gestore DB lavorazioni della macchina corrente
|
||||
MachiningsMgr* pMMgr = m_pMchMgr->GetCurrMachiningsMgr() ;
|
||||
if ( pMMgr == nullptr)
|
||||
return false ;
|
||||
// ricerca della lavorazione di libreria con il nome indicato
|
||||
const ProbingData* pDdata = GetProbingData( pMMgr->GetMachining( sGenMchName)) ;
|
||||
if ( pDdata == nullptr)
|
||||
return false ;
|
||||
m_Params = *pDdata ;
|
||||
// ricerca dell'utensile usato dalla lavorazione
|
||||
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
m_TParams = *pTdata ;
|
||||
m_Params.m_sToolName = m_TParams.m_sName ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Probing::SetParam( int nType, bool bVal)
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_INVERT :
|
||||
if ( bVal != m_Params.m_bInvert)
|
||||
m_nStatus |= MCH_ST_PARAM_MODIF ;
|
||||
m_Params.m_bInvert = bVal ;
|
||||
return true ;
|
||||
case MPA_TOOLINVERT :
|
||||
if ( bVal != m_Params.m_bToolInvert)
|
||||
m_nStatus |= MCH_ST_PARAM_MODIF ;
|
||||
m_Params.m_bToolInvert = bVal ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Probing::SetParam( int nType, int nVal)
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_SCC :
|
||||
if ( ! m_Params.VerifySolCh( nVal))
|
||||
return false ;
|
||||
if ( nVal != m_Params.m_nSolCh)
|
||||
m_nStatus |= MCH_ST_PARAM_MODIF ;
|
||||
m_Params.m_nSolCh = nVal ;
|
||||
return true ;
|
||||
case MPA_SUBTYPE :
|
||||
if ( nVal != m_Params.m_nSubType)
|
||||
m_nStatus |= MCH_ST_PARAM_MODIF ;
|
||||
m_Params.m_nSubType = nVal ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Probing::SetParam( int nType, double dVal)
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_FEED :
|
||||
if ( abs( m_TParams.m_dFeed - dVal) < EPS_MACH_LEN_PAR)
|
||||
dVal = 0 ;
|
||||
if ( abs( dVal - m_Params.m_dFeed) > EPS_MACH_LEN_PAR)
|
||||
m_nStatus |= MCH_ST_PARAM_MODIF ;
|
||||
m_Params.m_dFeed = dVal ;
|
||||
return true ;
|
||||
case MPA_STARTFEED :
|
||||
if ( abs( m_TParams.m_dStartFeed - dVal) < EPS_MACH_LEN_PAR)
|
||||
dVal = 0 ;
|
||||
if ( abs( dVal - m_Params.m_dStartFeed) > EPS_MACH_LEN_PAR)
|
||||
m_nStatus |= MCH_ST_PARAM_MODIF ;
|
||||
m_Params.m_dStartFeed = dVal ;
|
||||
return true ;
|
||||
case MPA_ENDFEED :
|
||||
if ( abs( m_TParams.m_dEndFeed - dVal) < EPS_MACH_LEN_PAR)
|
||||
dVal = 0 ;
|
||||
if ( abs( dVal - m_Params.m_dEndFeed) > EPS_MACH_LEN_PAR)
|
||||
m_nStatus |= MCH_ST_PARAM_MODIF ;
|
||||
m_Params.m_dEndFeed = dVal ;
|
||||
return true ;
|
||||
case MPA_TIPFEED :
|
||||
if ( abs( m_TParams.m_dTipFeed - dVal) < EPS_MACH_LEN_PAR)
|
||||
dVal = 0 ;
|
||||
if ( abs( dVal - m_Params.m_dTipFeed) > EPS_MACH_LEN_PAR)
|
||||
m_nStatus |= MCH_ST_PARAM_MODIF ;
|
||||
m_Params.m_dTipFeed = dVal ;
|
||||
return true ;
|
||||
case MPA_DEPTH: {
|
||||
string sVal = ToString( dVal) ;
|
||||
if ( sVal != m_Params.m_sDepth)
|
||||
m_nStatus |= MCH_ST_PARAM_MODIF ;
|
||||
m_Params.m_sDepth = sVal ;
|
||||
} return true ;
|
||||
case MPA_STARTPOS :
|
||||
if ( abs( dVal - m_Params.m_dStartPos) > EPS_MACH_LEN_PAR)
|
||||
m_nStatus |= MCH_ST_PARAM_MODIF ;
|
||||
m_Params.m_dStartPos = dVal ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Probing::SetParam( int nType, const string& sVal)
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_TOOL : {
|
||||
const ToolData* pTdata ;
|
||||
if ( ! m_Params.VerifyTool( m_pMchMgr->GetCurrToolsMgr(), sVal, pTdata))
|
||||
return false ;
|
||||
if ( ! SameTool( m_TParams, *pTdata))
|
||||
m_nStatus |= MCH_ST_PARAM_MODIF ;
|
||||
m_Params.m_sToolName = sVal ;
|
||||
m_Params.m_ToolUuid = pTdata->m_Uuid ;
|
||||
m_TParams = *pTdata ;
|
||||
} return true ;
|
||||
case MPA_DEPTH_STR :
|
||||
if ( sVal != m_Params.m_sDepth)
|
||||
m_nStatus |= MCH_ST_PARAM_MODIF ;
|
||||
m_Params.m_sDepth = sVal ;
|
||||
return true ;
|
||||
case MPA_SYSNOTES :
|
||||
if ( sVal != m_Params.m_sSysNotes)
|
||||
m_nStatus |= MCH_ST_PARAM_MODIF ;
|
||||
m_Params.m_sSysNotes = sVal ;
|
||||
return true ;
|
||||
case MPA_USERNOTES :
|
||||
if ( sVal != m_Params.m_sUserNotes)
|
||||
m_nStatus |= MCH_ST_PARAM_MODIF ;
|
||||
m_Params.m_sUserNotes = sVal ;
|
||||
return true ;
|
||||
case MPA_INITANGS :
|
||||
if ( sVal != m_Params.m_sInitAngs)
|
||||
m_nStatus |= MCH_ST_PARAM_MODIF ;
|
||||
m_Params.m_sInitAngs = sVal ;
|
||||
return true ;
|
||||
case MPA_BLOCKEDAXIS :
|
||||
if ( sVal != m_Params.m_sBlockedAxis)
|
||||
m_nStatus |= MCH_ST_PARAM_MODIF ;
|
||||
m_Params.m_sBlockedAxis = sVal ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Probing::SetGeometry( const SELVECTOR& vIds)
|
||||
{
|
||||
// verifico validità gestore DB geometrico
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// copia temporanea e reset della geometria corrente
|
||||
SELVECTOR vOldId = m_vId ;
|
||||
m_vId.clear() ;
|
||||
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve o tutte facce)
|
||||
int nType = GEO_NONE ;
|
||||
for ( const auto& Id : vIds) {
|
||||
// test sull'entità
|
||||
int nSubs ;
|
||||
if ( ! VerifyGeometry( Id, nSubs, nType)) {
|
||||
string sInfo = "Warning in Probing : Skipped entity " + ToString( Id) ;
|
||||
m_pMchMgr->SetWarning( 3451, sInfo) ;
|
||||
continue ;
|
||||
}
|
||||
// posso aggiungere alla lista
|
||||
m_vId.emplace_back( Id) ;
|
||||
}
|
||||
// aggiorno lo stato
|
||||
if ( m_vId != vOldId)
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
// restituisco presenza geometria da lavorare
|
||||
return ( ! m_vId.empty() || vIds.empty()) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Probing::Preview( bool bRecalc)
|
||||
{
|
||||
// reset numero percorsi di lavoro generati
|
||||
m_nMills = 0 ;
|
||||
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
|
||||
return false ;
|
||||
|
||||
// aggiorno dati geometrici dell'utensile
|
||||
if ( ! UpdateToolData()) {
|
||||
m_pMchMgr->SetLastError( 3401, "Error in Probing : UpdateToolData failed") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// rendo corrente l'utensile usato nella lavorazione
|
||||
if ( ! m_pMchMgr->SetCalcTool( m_TParams.m_sName, m_TParams.m_sHead, m_TParams.m_nExit)) {
|
||||
m_pMchMgr->SetLastError( 3409, "Error in Probing : Tool loading failed") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// recupero gruppo per geometria di Preview
|
||||
int nPvId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_PV) ;
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nPvId == GDB_ID_NULL) {
|
||||
nPvId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nPvId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nPvId, MCH_PV) ;
|
||||
}
|
||||
// altrimenti lo svuoto
|
||||
else
|
||||
m_pGeomDB->EmptyGroup( nPvId) ;
|
||||
|
||||
// recupero la macchina corrente
|
||||
Machine* pMch = m_pMchMgr->GetCurrMachine() ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
|
||||
// nome della funzione lua da Ini della macchina
|
||||
string sMachIni = pMch->GetMachineDir() + "\\" + pMch->GetMachineName() + ".ini" ;
|
||||
string sKey = PROBING_SCRIPT_KEY + ToString( m_Params.m_nSubType) ;
|
||||
string sName = GetPrivateProfileStringUtf8( PROBING_SEC.c_str(), sKey.c_str(), "", sMachIni.c_str()) ;
|
||||
string sPreview = ON_PREVIEW + sName ;
|
||||
|
||||
// verifico esistenza funzione
|
||||
if ( ! pMch->LuaExistsFunction( sPreview)) {
|
||||
string sErr = "Error in Probing : missing Script " + sPreview ;
|
||||
m_pMchMgr->SetLastError( 3402, sErr) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// imposto stato
|
||||
bool bOk = true ;
|
||||
int nErr = 99 ;
|
||||
// imposto valori parametri
|
||||
bOk = bOk && pMch->LuaCreateGlobTable( EMC_VAR) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_MACHID, m_nOwnerId) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_GEOM, m_vId) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_DEPTH, m_Params.m_sDepth) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TINVERT, m_Params.m_bToolInvert) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_INVERT, m_Params.m_bInvert) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTPOS, m_Params.m_dStartPos) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_SYSNOTES, m_Params.m_sSysNotes) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, m_Params.m_sUserNotes) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TOOL, m_TParams.m_sName) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_HEAD, m_TParams.m_sHead) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_EXIT, m_TParams.m_nExit) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTYPE, m_TParams.m_nType) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TDIAM, m_TParams.m_dDiam) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTOTDIAM, m_TParams.m_dTDiam) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TLEN, m_TParams.m_dLen) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTOTLEN, m_TParams.m_dTLen) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTHICK, m_TParams.m_dThick) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TCORNRAD, m_TParams.m_dCornRad) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_FEED, GetFeed()) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTFEED, GetStartFeed()) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ENDFEED, GetEndFeed()) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TIPFEED, GetTipFeed()) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ISROBOT, m_pMchMgr->GetCurrIsRobot()) ;
|
||||
// eseguo
|
||||
bOk = bOk && pMch->LuaCallFunction( sPreview, false) ;
|
||||
// recupero valori parametri obbligatori
|
||||
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) ;
|
||||
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_MILLS, m_nMills) ;
|
||||
// reset
|
||||
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
|
||||
// segnalo errori
|
||||
if ( ! bOk || nErr != 0) {
|
||||
m_nMills = 0 ;
|
||||
string sErr = "Error in Probing : Error in " + sPreview + " (" + ToString( nErr) + ")" ;
|
||||
m_pMchMgr->SetLastError( 3403, sErr) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Probing::Apply( bool bRecalc, bool bPostApply)
|
||||
{
|
||||
// reset numero percorsi di lavoro generati
|
||||
int nCurrMills = m_nMills ;
|
||||
m_nMills = 0 ;
|
||||
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
|
||||
return false ;
|
||||
|
||||
// aggiorno dati geometrici dell'utensile
|
||||
if ( ! UpdateToolData()) {
|
||||
m_pMchMgr->SetLastError( 3401, "Error in Probing : UpdateToolData failed") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// se modificata geometria, necessario ricalcolo
|
||||
if ( ( m_nStatus & MCH_ST_GEO_MODIF) != 0)
|
||||
bRecalc = true ;
|
||||
|
||||
// verifico se necessario continuare nell'aggiornamento
|
||||
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
// confermo i percorsi di lavorazione
|
||||
m_nMills = nCurrMills ;
|
||||
string sLog = string( "Probing apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ;
|
||||
LOG_DBG_INFO( GetEMkLogger(), sLog.c_str()) ;
|
||||
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
|
||||
if ( ! Update( bPostApply))
|
||||
return false ;
|
||||
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
|
||||
LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
|
||||
// esco con successo
|
||||
return true ;
|
||||
}
|
||||
m_nStatus = MCH_ST_TO_VERIFY ;
|
||||
|
||||
// rendo corrente l'utensile usato nella lavorazione
|
||||
if ( ! m_pMchMgr->SetCalcTool( m_TParams.m_sName, m_TParams.m_sHead, m_TParams.m_nExit)) {
|
||||
m_pMchMgr->SetLastError( 3409, "Error in Probing : Tool loading failed") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// recupero gruppo per geometria di lavorazione (Cutter Location)
|
||||
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nClId == GDB_ID_NULL) {
|
||||
nClId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nClId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nClId, MCH_CL) ;
|
||||
}
|
||||
// altrimenti lo svuoto
|
||||
else
|
||||
m_pGeomDB->EmptyGroup( nClId) ;
|
||||
|
||||
// recupero la macchina corrente
|
||||
Machine* pMch = m_pMchMgr->GetCurrMachine() ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
|
||||
// nome della funzione lua da Ini della macchina
|
||||
string sMachIni = pMch->GetMachineDir() + "\\" + pMch->GetMachineName() + ".ini" ;
|
||||
string sKey = PROBING_SCRIPT_KEY + ToString( m_Params.m_nSubType) ;
|
||||
string sName = GetPrivateProfileStringUtf8( PROBING_SEC.c_str(), sKey.c_str(), "", sMachIni.c_str()) ;
|
||||
string sApply = ON_APPLY + sName ;
|
||||
|
||||
// verifico esistenza funzione
|
||||
if ( ! pMch->LuaExistsFunction( sApply)) {
|
||||
string sErr = "Error in Probing : missing Script " + sApply ;
|
||||
m_pMchMgr->SetLastError( 3402, sErr) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// imposto stato
|
||||
bool bOk = true ;
|
||||
int nErr = 99 ;
|
||||
// imposto valori parametri
|
||||
bOk = bOk && pMch->LuaCreateGlobTable( EMC_VAR) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_MACHID, m_nOwnerId) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_GEOM, m_vId) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_DEPTH, m_Params.m_sDepth) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TINVERT, m_Params.m_bToolInvert) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_INVERT, m_Params.m_bInvert) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTPOS, m_Params.m_dStartPos) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_SYSNOTES, m_Params.m_sSysNotes) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, m_Params.m_sUserNotes) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TOOL, m_TParams.m_sName) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_HEAD, m_TParams.m_sHead) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_EXIT, m_TParams.m_nExit) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTYPE, m_TParams.m_nType) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TDIAM, m_TParams.m_dDiam) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTOTDIAM, m_TParams.m_dTDiam) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TLEN, m_TParams.m_dLen) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTOTLEN, m_TParams.m_dTLen) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTHICK, m_TParams.m_dThick) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TCORNRAD, m_TParams.m_dCornRad) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_FEED, GetFeed()) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTFEED, GetStartFeed()) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ENDFEED, GetEndFeed()) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TIPFEED, GetTipFeed()) ;
|
||||
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ISROBOT, m_pMchMgr->GetCurrIsRobot()) ;
|
||||
// eseguo
|
||||
bOk = bOk && pMch->LuaCallFunction( sApply, false) ;
|
||||
// recupero valori parametri obbligatori
|
||||
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) ;
|
||||
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_MILLS, m_nMills) ;
|
||||
// reset
|
||||
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
|
||||
// segnalo errori
|
||||
if ( ! bOk || nErr != 0) {
|
||||
m_nMills = 0 ;
|
||||
string sErr = "Error in Probing : Error in " + sApply + " (" + ToString( nErr) + ")" ;
|
||||
m_pMchMgr->SetLastError( 3403, sErr) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno ingombri dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetBBox( nClId) ;
|
||||
|
||||
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
|
||||
if ( ! Update( bPostApply))
|
||||
return false ;
|
||||
|
||||
// aggiorno stato della lavorazione
|
||||
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
|
||||
// dichiaro successiva da aggiornare
|
||||
UpdateFollowingOperationsStatus( MCH_ST_OTH_MODIF) ;
|
||||
|
||||
LOG_DBG_INFO( GetEMkLogger(), "Probing apply done") ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Probing::Update( bool bPostApply)
|
||||
{
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
|
||||
return false ;
|
||||
|
||||
// se lavorazione vuota, esco
|
||||
if ( m_nMills == 0) {
|
||||
m_pMchMgr->SetWarning( 3452, "Warning in Probing : No machinable path") ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
|
||||
RemoveClimbRiseHome() ;
|
||||
|
||||
// imposto eventuale asse bloccato da lavorazione
|
||||
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
|
||||
|
||||
// calcolo gli assi macchina
|
||||
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
|
||||
if ( ! m_Params.m_sInitAngs.empty())
|
||||
sHint = m_Params.m_sInitAngs ;
|
||||
if ( ! CalculateAxesValues( sHint)) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
if ( sInfo.empty())
|
||||
m_pMchMgr->SetLastError( 3404, "Error in Probing : axes values not calculable") ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 3405, "Error in Probing : outstroke ") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni speciali
|
||||
string sSpecErr ;
|
||||
if ( bPostApply && ! SpecialApply( sSpecErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sSpecErr))
|
||||
m_pMchMgr->SetLastError( 3410, sSpecErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 3410, "Error in Probing : special apply not calculable") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
|
||||
if ( ! AdjustStartEndMovements()) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
if ( sInfo.empty())
|
||||
m_pMchMgr->SetLastError( 3406, "Error in Probing : link movements not calculable") ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 3407, "Error in Probing : link outstroke ") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// esecuzione eventuali personalizzazioni finali
|
||||
string sPostErr ;
|
||||
if ( bPostApply && ! PostApply( sPostErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sPostErr))
|
||||
m_pMchMgr->SetLastError( 3408, sPostErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 3408, "Error in Probing : post apply not calculable") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Probing::GetParam( int nType, bool& bVal) const
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_INVERT :
|
||||
bVal = m_Params.m_bInvert ;
|
||||
return true ;
|
||||
case MPA_TOOLINVERT :
|
||||
bVal = m_Params.m_bToolInvert ;
|
||||
return true ;
|
||||
}
|
||||
bVal = false ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Probing::GetParam( int nType, int& nVal) const
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_TYPE :
|
||||
nVal = MT_PROBING ;
|
||||
return true ;
|
||||
case MPA_SCC :
|
||||
nVal = m_Params.m_nSolCh ;
|
||||
return true ;
|
||||
case MPA_SUBTYPE :
|
||||
nVal = m_Params.m_nSubType ;
|
||||
return true ;
|
||||
}
|
||||
nVal = 0 ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Probing::GetParam( int nType, double& dVal) const
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_SPEED :
|
||||
dVal = 0 ;
|
||||
return true ;
|
||||
case MPA_FEED :
|
||||
dVal = GetFeed() ;
|
||||
return true ;
|
||||
case MPA_STARTFEED :
|
||||
dVal = GetStartFeed() ;
|
||||
return true ;
|
||||
case MPA_ENDFEED :
|
||||
dVal = GetEndFeed() ;
|
||||
return true ;
|
||||
case MPA_TIPFEED :
|
||||
dVal = GetTipFeed() ;
|
||||
return true ;
|
||||
case MPA_STARTPOS :
|
||||
dVal = m_Params.m_dStartPos ;
|
||||
return true ;
|
||||
}
|
||||
dVal = 0 ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Probing::GetParam( int nType, string& sVal) const
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_NAME :
|
||||
sVal = m_Params.m_sName ;
|
||||
return true ;
|
||||
case MPA_TOOL :
|
||||
sVal = m_Params.m_sToolName ;
|
||||
return true ;
|
||||
case MPA_DEPTH_STR :
|
||||
sVal = m_Params.m_sDepth ;
|
||||
return true ;
|
||||
case MPA_TUUID :
|
||||
sVal = ToString( m_Params.m_ToolUuid) ;
|
||||
return true ;
|
||||
case MPA_UUID :
|
||||
sVal = ToString( m_Params.m_Uuid) ;
|
||||
return true ;
|
||||
case MPA_SYSNOTES :
|
||||
sVal = m_Params.m_sSysNotes ;
|
||||
return true ;
|
||||
case MPA_USERNOTES :
|
||||
sVal = m_Params.m_sUserNotes ;
|
||||
return true ;
|
||||
case MPA_INITANGS :
|
||||
sVal = m_Params.m_sInitAngs ;
|
||||
return true ;
|
||||
case MPA_BLOCKEDAXIS :
|
||||
sVal = m_Params.m_sBlockedAxis ;
|
||||
return true ;
|
||||
}
|
||||
sVal = "" ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const ToolData&
|
||||
Probing::GetToolData( void) const
|
||||
{
|
||||
return m_TParams ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Probing::UpdateToolData( void)
|
||||
{
|
||||
// recupero il gestore DB utensili della macchina corrente
|
||||
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
|
||||
if ( pTMgr == nullptr)
|
||||
return false ;
|
||||
// recupero l'utensile nel DB utensili (se fallisce con UUID provo con il nome)
|
||||
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
|
||||
if ( pTdata == nullptr) {
|
||||
pTdata = pTMgr->GetTool( m_Params.m_sToolName) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
m_Params.m_ToolUuid = m_TParams.m_Uuid ;
|
||||
}
|
||||
// salvo posizione TC, testa e uscita originali
|
||||
string sOrigTcPos = m_TParams.m_sTcPos ;
|
||||
string sOrigHead = m_TParams.m_sHead ;
|
||||
int nOrigExit = m_TParams.m_nExit ;
|
||||
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
|
||||
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
|
||||
// aggiorno comunque i parametri
|
||||
m_TParams = *pTdata ;
|
||||
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
|
||||
string sTcPos ; string sHead ; int nExit ;
|
||||
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
|
||||
if ( sOrigTcPos != sTcPos ||
|
||||
sOrigHead != sHead ||
|
||||
nOrigExit != nExit)
|
||||
bChanged = true ;
|
||||
m_TParams.m_sTcPos = sTcPos ;
|
||||
m_TParams.m_sHead = sHead ;
|
||||
m_TParams.m_nExit = nExit ;
|
||||
}
|
||||
else {
|
||||
if ( sOrigTcPos != pTdata->m_sTcPos ||
|
||||
sOrigHead != pTdata->m_sHead ||
|
||||
nOrigExit != pTdata->m_nExit)
|
||||
bChanged = true ;
|
||||
}
|
||||
// eventuali segnalazioni
|
||||
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
|
||||
string sInfo = "Warning in Probing : tool name changed (" +
|
||||
m_Params.m_sToolName + "->" + m_TParams.m_sName + ")" ;
|
||||
m_pMchMgr->SetWarning( 3453, sInfo) ;
|
||||
m_Params.m_sToolName = m_TParams.m_sName ;
|
||||
}
|
||||
if ( bChanged) {
|
||||
string sInfo = "Warning in Probing : tool data changed (" +
|
||||
m_Params.m_sToolName + ")" ;
|
||||
m_pMchMgr->SetWarning( 3454, sInfo) ;
|
||||
}
|
||||
// se modificato, aggiusto lo stato
|
||||
if ( bChanged)
|
||||
m_nStatus = MCH_ST_TO_VERIFY ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Probing::GetGeometry( SELVECTOR& vIds) const
|
||||
{
|
||||
// restituisco l'elenco delle entità
|
||||
vIds = m_vId ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Probing::VerifyGeometry( SelData Id, int& nSubs, int& nType)
|
||||
{
|
||||
// ammessi : tutte curve o tutte facce di trimesh
|
||||
const IGeoObj* pGObj = m_pGeomDB->GetGeoObj( Id.nId) ;
|
||||
if ( pGObj == nullptr)
|
||||
return false ;
|
||||
// se ammesse curve ed è tale
|
||||
if ( nType != GEO_SURF && ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
const ICurve* pCurve = nullptr ;
|
||||
// se direttamente la curva
|
||||
if ( Id.nSub == SEL_SUB_ALL) {
|
||||
pCurve = ::GetCurve( pGObj) ;
|
||||
if ( pCurve != nullptr) {
|
||||
if ( pCurve->GetType() == CRV_COMPO)
|
||||
nSubs = ::GetCurveComposite( pCurve)->GetCurveCount() ;
|
||||
else
|
||||
nSubs = 0 ;
|
||||
}
|
||||
}
|
||||
// altrimenti sottocurva di composita
|
||||
else {
|
||||
const ICurveComposite* pCompo = GetCurveComposite( pGObj) ;
|
||||
if ( pCompo != nullptr)
|
||||
pCurve = pCompo->GetCurve( Id.nSub) ;
|
||||
nSubs = 0 ;
|
||||
}
|
||||
return ( pCurve != nullptr) ;
|
||||
}
|
||||
// se altrimenti ammesse superfici trimesh ed è tale
|
||||
else if ( nType != GEO_CURVE && ( pGObj->GetType() & GEO_SURF) != 0) {
|
||||
const ISurfTriMesh* pSurf = ::GetSurfTriMesh( pGObj) ;
|
||||
if ( pSurf == nullptr)
|
||||
return false ;
|
||||
// se direttamente la superficie
|
||||
if ( Id.nSub == SEL_SUB_ALL) {
|
||||
nSubs = pSurf->GetFacetCount() ;
|
||||
return true ;
|
||||
}
|
||||
// altrimenti faccia di superficie trimesh
|
||||
else {
|
||||
// se faccia non esistente
|
||||
if ( Id.nSub > pSurf->GetFacetCount())
|
||||
return false ;
|
||||
// tutto bene
|
||||
nSubs = 0 ;
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
// altrimenti errore
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
double
|
||||
Probing::GetApproxLinTol( void) const
|
||||
{
|
||||
double dLinTol ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_LINTOL, dLinTol))
|
||||
return dLinTol ;
|
||||
else
|
||||
return Operation::GetApproxLinTol() ;
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2025-2025
|
||||
//----------------------------------------------------------------------------
|
||||
// File : Probing.h Data : 10.06.25 Versione : 2.7f2
|
||||
// Contenuto : Dichiarazione della classe Probing.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 10.06.25 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Machining.h"
|
||||
#include "ProbingData.h"
|
||||
#include "ToolData.h"
|
||||
|
||||
class ICurve ;
|
||||
class ICurveComposite ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class Probing : public Machining
|
||||
{
|
||||
public : // IUserObj
|
||||
Probing* Clone( void) const override ;
|
||||
const std::string& GetClassName( void) const override ;
|
||||
bool Dump( std::string& sOut, bool bMM = true, const char* szNewLine = "\n") const override ;
|
||||
bool ToSave( void) const override
|
||||
{ return true ; }
|
||||
bool Save( int nBaseId, STRVECTOR& vString) const override ;
|
||||
bool Load( const STRVECTOR& vString, int nBaseGdbId) override ;
|
||||
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_PROBING ; }
|
||||
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
|
||||
{ if ( m_nMills == 0)
|
||||
return true ;
|
||||
if ( nEmptyType == NEED_ONE_TP_OK)
|
||||
return ( ! IsAtLeastOnePathOk()) ;
|
||||
if ( nEmptyType == NEED_ALL_TP_OK)
|
||||
return ( ! AreAllPathsOk()) ;
|
||||
return false ; }
|
||||
bool UpdateStatus( int nModif) override
|
||||
{ m_nStatus |= nModif ; return true ; }
|
||||
|
||||
protected : // Operation
|
||||
int GetSolCh( void) const override
|
||||
{ return m_Params.m_nSolCh ; }
|
||||
|
||||
public : // Machining
|
||||
bool Prepare( const std::string& sMillName) override ;
|
||||
bool SetParam( int nType, bool bVal) override ;
|
||||
bool SetParam( int nType, int nVal) override ;
|
||||
bool SetParam( int nType, double dVal) override ;
|
||||
bool SetParam( int nType, const std::string& sVal) override ;
|
||||
bool SetGeometry( const SELVECTOR& vIds) override ;
|
||||
bool Preview( bool bRecalc) override ;
|
||||
bool Apply( bool bRecalc, bool bPostApply) override ;
|
||||
bool Update( bool bPostApply) override ;
|
||||
bool GetParam( int nType, bool& bVal) const override ;
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool UpdateToolData( void) override ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
|
||||
public :
|
||||
Probing( void) ;
|
||||
|
||||
private :
|
||||
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
|
||||
double GetApproxLinTol( void) const override ;
|
||||
|
||||
private :
|
||||
double GetFeed() const
|
||||
{ return ( IsNullLenValue( m_Params.m_dFeed) ? m_TParams.m_dFeed : m_Params.m_dFeed) ; }
|
||||
double GetStartFeed() const
|
||||
{ return ( IsNullLenValue( m_Params.m_dStartFeed) ? m_TParams.m_dStartFeed : m_Params.m_dStartFeed) ; }
|
||||
double GetEndFeed() const
|
||||
{ return ( IsNullLenValue( m_Params.m_dEndFeed) ? m_TParams.m_dEndFeed : m_Params.m_dEndFeed) ; }
|
||||
double GetTipFeed() const
|
||||
{ return ( IsNullLenValue( m_Params.m_dTipFeed) ? m_TParams.m_dTipFeed : m_Params.m_dTipFeed) ; }
|
||||
|
||||
private :
|
||||
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
|
||||
ProbingData m_Params ; // parametri lavorazione
|
||||
ToolData m_TParams ; // parametri utensile
|
||||
int m_nStatus ; // stato di aggiornamento della lavorazione
|
||||
int m_nMills ; // numero di percorsi di lavoro generati
|
||||
} ;
|
||||
+515
@@ -0,0 +1,515 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2025-2025
|
||||
//----------------------------------------------------------------------------
|
||||
// File : ProbingData.cpp Data : 09.06.25 Versione : 2.7f2
|
||||
// Contenuto : Implementazione struttura dati tastatura.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 09.06.25 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "ProbingData.h"
|
||||
#include "MachiningDataFactory.h"
|
||||
#include "MachiningConst.h"
|
||||
#include "/EgtDev/Include/EmkToolConst.h"
|
||||
#include "/EgtDev/Include/EmkSimuGenConst.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
enum nProbingKey {
|
||||
KEY_AB = 0,
|
||||
KEY_AI,
|
||||
KEY_DH,
|
||||
KEY_F,
|
||||
KEY_FE,
|
||||
KEY_FS,
|
||||
KEY_FT,
|
||||
KEY_INV,
|
||||
KEY_NAME,
|
||||
KEY_NNS,
|
||||
KEY_NNU,
|
||||
KEY_PS,
|
||||
KEY_SCC,
|
||||
KEY_SUBTYPE,
|
||||
KEY_TI,
|
||||
KEY_TNAME,
|
||||
KEY_TUUID,
|
||||
KEY_UUID,
|
||||
KEY_ZZZ} ; // rappresenta il numero di elementi
|
||||
|
||||
static const array<string,KEY_ZZZ> sProbingKey = {
|
||||
"AB",
|
||||
"AI",
|
||||
"DH",
|
||||
"F",
|
||||
"FE",
|
||||
"FS",
|
||||
"FT",
|
||||
"INV",
|
||||
"NAME",
|
||||
"NNS",
|
||||
"NNU",
|
||||
"PS",
|
||||
"SCC",
|
||||
"SUB",
|
||||
"TI",
|
||||
"TN",
|
||||
"TU",
|
||||
"UUID"} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
MCHDATA_REGISTER( MT_PROBING, "PROBING", ProbingData) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
ProbingData*
|
||||
ProbingData::Clone( void) const
|
||||
{
|
||||
// alloco oggetto
|
||||
ProbingData* pDdata = new(nothrow) ProbingData ;
|
||||
// copio i dati
|
||||
if ( pDdata != nullptr) {
|
||||
if ( ! pDdata->CopyFrom( this)) {
|
||||
delete pDdata ;
|
||||
return nullptr ;
|
||||
}
|
||||
}
|
||||
return pDdata ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ProbingData::CopyFrom( const MachiningData* pMdata)
|
||||
{
|
||||
// è inutile copiare se sorgente coincide con destinazione
|
||||
if ( pMdata == this)
|
||||
return true ;
|
||||
// la sorgente deve essere dello stesso tipo
|
||||
const ProbingData* pGdata = GetProbingData( pMdata) ;
|
||||
if ( pGdata == nullptr)
|
||||
return false ;
|
||||
// eseguo copia
|
||||
m_Uuid = pGdata->m_Uuid ;
|
||||
m_sName = pGdata->m_sName ;
|
||||
m_ToolUuid = pGdata->m_ToolUuid ;
|
||||
m_sToolName = pGdata->m_sToolName ;
|
||||
m_sBlockedAxis = pGdata->m_sBlockedAxis ;
|
||||
m_sInitAngs = pGdata->m_sInitAngs ;
|
||||
m_nSolCh = pGdata->m_nSolCh ;
|
||||
m_dFeed = pGdata->m_dFeed ;
|
||||
m_dStartFeed = pGdata->m_dStartFeed ;
|
||||
m_dEndFeed = pGdata->m_dEndFeed ;
|
||||
m_dTipFeed = pGdata->m_dTipFeed ;
|
||||
m_bToolInvert = pGdata->m_bToolInvert ;
|
||||
m_bInvert = pGdata->m_bInvert ;
|
||||
m_sDepth = pGdata->m_sDepth ;
|
||||
m_dStartPos = pGdata->m_dStartPos ;
|
||||
m_nSubType = pGdata->m_nSubType ;
|
||||
m_sSysNotes = pGdata->m_sSysNotes ;
|
||||
m_sUserNotes = pGdata->m_sUserNotes ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ProbingData::SameAs(const MachiningData* pMdata) const
|
||||
{
|
||||
// se coincide con altro -> uguali
|
||||
if ( pMdata == this)
|
||||
return true ;
|
||||
// se sono di tipo diverso -> diversi
|
||||
const ProbingData* pGdata = GetProbingData( pMdata) ;
|
||||
if ( pGdata == nullptr)
|
||||
return false ;
|
||||
// confronto termine a termine
|
||||
return ( m_Uuid == pGdata->m_Uuid &&
|
||||
m_sName == pGdata->m_sName &&
|
||||
m_ToolUuid == pGdata->m_ToolUuid &&
|
||||
m_sToolName == pGdata->m_sToolName &&
|
||||
m_sBlockedAxis == pGdata->m_sBlockedAxis &&
|
||||
m_sInitAngs == pGdata->m_sInitAngs &&
|
||||
m_nSolCh == pGdata->m_nSolCh &&
|
||||
abs( m_dFeed - pGdata->m_dFeed) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dStartFeed - pGdata->m_dStartFeed) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dEndFeed - pGdata->m_dEndFeed) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dTipFeed - pGdata->m_dTipFeed) < EPS_MACH_LEN_PAR &&
|
||||
m_bToolInvert == pGdata->m_bToolInvert &&
|
||||
m_bInvert == pGdata->m_bInvert &&
|
||||
m_sDepth == pGdata->m_sDepth &&
|
||||
abs( m_dStartPos - pGdata->m_dStartPos) < EPS_MACH_LEN_PAR &&
|
||||
m_nSubType == pGdata->m_nSubType &&
|
||||
m_sSysNotes == pGdata->m_sSysNotes &&
|
||||
m_sUserNotes == pGdata->m_sUserNotes) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
ProbingData::GetSize( void) const
|
||||
{
|
||||
// in debug verifico validità ultimo campo
|
||||
assert( sProbingKey[KEY_UUID] == "UUID") ;
|
||||
return KEY_ZZZ ;
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
string
|
||||
ProbingData::GetTitle( void) const
|
||||
{
|
||||
return MCHDATA_GETNAME( ProbingData) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
FindProbingKey( const string& sKey)
|
||||
{
|
||||
auto TheRange = equal_range( sProbingKey.cbegin(), sProbingKey.cend(), sKey) ;
|
||||
if ( TheRange.first == TheRange.second)
|
||||
return - 1 ;
|
||||
return int( TheRange.first - sProbingKey.cbegin()) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ProbingData::FromString( const string& sString, int& nKey)
|
||||
{
|
||||
// separo chiave da valore
|
||||
string sKey, sVal ;
|
||||
SplitFirst( sString, "=", sKey, sVal) ;
|
||||
// riconosco la chiave
|
||||
nKey = FindProbingKey( ToUpper( sKey)) ;
|
||||
bool bOk = ( nKey >= 0) ;
|
||||
switch ( nKey) {
|
||||
case KEY_AB :
|
||||
m_sBlockedAxis = sVal ;
|
||||
break ;
|
||||
case KEY_AI :
|
||||
m_sInitAngs = sVal ;
|
||||
break ;
|
||||
case KEY_DH :
|
||||
m_sDepth = sVal ;
|
||||
if ( m_sDepth.empty())
|
||||
m_sDepth = "0" ;
|
||||
break ;
|
||||
case KEY_F :
|
||||
bOk = ::FromString( sVal, m_dFeed) ;
|
||||
break ;
|
||||
case KEY_FE :
|
||||
bOk = ::FromString( sVal, m_dEndFeed) ;
|
||||
break ;
|
||||
case KEY_FS :
|
||||
bOk = ::FromString( sVal, m_dStartFeed) ;
|
||||
break ;
|
||||
case KEY_FT :
|
||||
bOk = ::FromString( sVal, m_dTipFeed) ;
|
||||
break ;
|
||||
case KEY_INV :
|
||||
bOk = ::FromString( sVal, m_bInvert) ;
|
||||
break ;
|
||||
case KEY_NAME :
|
||||
m_sName = sVal ;
|
||||
bOk = ! m_sName.empty() ;
|
||||
break ;
|
||||
case KEY_NNS :
|
||||
m_sSysNotes = sVal ;
|
||||
break ;
|
||||
case KEY_NNU :
|
||||
m_sUserNotes = sVal ;
|
||||
break ;
|
||||
case KEY_PS :
|
||||
bOk = ::FromString( sVal, m_dStartPos) ;
|
||||
break ;
|
||||
case KEY_SCC :
|
||||
bOk = ::FromString( sVal, m_nSolCh) ;
|
||||
break ;
|
||||
case KEY_SUBTYPE :
|
||||
bOk = ::FromString( sVal, m_nSubType) ;
|
||||
break ;
|
||||
case KEY_TNAME :
|
||||
m_sToolName = sVal ;
|
||||
break ;
|
||||
case KEY_TI :
|
||||
bOk = ::FromString( sVal, m_bToolInvert) ;
|
||||
break ;
|
||||
case KEY_TUUID :
|
||||
bOk = ::FromString( sVal, m_ToolUuid) ;
|
||||
break ;
|
||||
case KEY_UUID :
|
||||
bOk = ::FromString( sVal, m_Uuid) ;
|
||||
break ;
|
||||
default :
|
||||
bOk = false ;
|
||||
break ;
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
string
|
||||
ProbingData::ToString( int nKey) const
|
||||
{
|
||||
switch ( nKey) {
|
||||
case KEY_AB : return ( sProbingKey[KEY_AB] + "=" + m_sBlockedAxis) ;
|
||||
case KEY_AI : return ( sProbingKey[KEY_AI] + "=" + m_sInitAngs) ;
|
||||
case KEY_DH : return ( sProbingKey[KEY_DH] + "=" + m_sDepth) ;
|
||||
case KEY_F : return ( sProbingKey[KEY_F] + "=" + ::ToString( m_dFeed)) ;
|
||||
case KEY_FE : return ( sProbingKey[KEY_FE] + "=" + ::ToString( m_dEndFeed)) ;
|
||||
case KEY_FS : return ( sProbingKey[KEY_FS] + "=" + ::ToString( m_dStartFeed)) ;
|
||||
case KEY_FT : return ( sProbingKey[KEY_FT] + "=" + ::ToString( m_dTipFeed)) ;
|
||||
case KEY_INV : return ( sProbingKey[KEY_INV] + "=" + ::ToString( m_bInvert)) ;
|
||||
case KEY_NAME : return ( sProbingKey[KEY_NAME] + "=" + m_sName) ;
|
||||
case KEY_NNS : return ( sProbingKey[KEY_NNS] + "=" + m_sSysNotes) ;
|
||||
case KEY_NNU : return ( sProbingKey[KEY_NNU] + "=" + m_sUserNotes) ;
|
||||
case KEY_PS : return ( sProbingKey[KEY_PS] + "=" + ::ToString( m_dStartPos)) ;
|
||||
case KEY_SCC : return ( sProbingKey[KEY_SCC] + "=" + ::ToString( m_nSolCh)) ;
|
||||
case KEY_SUBTYPE : return ( sProbingKey[KEY_SUBTYPE] + "=" + ::ToString( m_nSubType)) ;
|
||||
case KEY_TI : return ( sProbingKey[KEY_TI] + "=" + ::ToString( m_bToolInvert)) ;
|
||||
case KEY_TNAME : return ( sProbingKey[KEY_TNAME] + "=" + m_sToolName) ;
|
||||
case KEY_TUUID : return ( sProbingKey[KEY_TUUID] + "=" + ::ToString( m_ToolUuid)) ;
|
||||
case KEY_UUID : return ( sProbingKey[KEY_UUID] + "=" + ::ToString( m_Uuid)) ;
|
||||
default : return "" ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ProbingData::IsOptional( int nKey) const
|
||||
{
|
||||
return ( nKey == KEY_AB || nKey == KEY_AI || nKey == KEY_TI) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ProbingData::VerifySolCh( int nVal) const
|
||||
{
|
||||
return IsValidOperationScc( nVal) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ProbingData::VerifyTool( const ToolsMgr* pToolsMgr, const string& sVal, const ToolData*& pTdata) const
|
||||
{
|
||||
if ( pToolsMgr == nullptr)
|
||||
return false ;
|
||||
pTdata = pToolsMgr->GetTool( sVal) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
if ( ( pTdata->m_nType & TF_PROBE) == 0)
|
||||
return false ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ProbingData::GetTool( const ToolsMgr* pToolsMgr, const ToolData*& pTdata) const
|
||||
{
|
||||
if ( pToolsMgr == nullptr)
|
||||
return false ;
|
||||
pTdata = pToolsMgr->GetTool( m_ToolUuid) ;
|
||||
return ( pTdata != nullptr) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ProbingData::SetParam( int nType, bool bVal)
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_INVERT :
|
||||
m_bInvert = bVal ;
|
||||
return true ;
|
||||
case MPA_TOOLINVERT :
|
||||
m_bToolInvert = bVal ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ProbingData::SetParam( int nType, int nVal)
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_SCC :
|
||||
if ( ! VerifySolCh( nVal))
|
||||
return false ;
|
||||
m_nSolCh = nVal ;
|
||||
return true ;
|
||||
case MPA_SUBTYPE :
|
||||
m_nSubType = nVal ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ProbingData::SetParam( int nType, double dVal)
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_FEED :
|
||||
m_dFeed = dVal ;
|
||||
return true ;
|
||||
case MPA_STARTFEED :
|
||||
m_dStartFeed = dVal ;
|
||||
return true ;
|
||||
case MPA_ENDFEED :
|
||||
m_dEndFeed = dVal ;
|
||||
return true ;
|
||||
case MPA_TIPFEED :
|
||||
m_dTipFeed = dVal ;
|
||||
return true ;
|
||||
case MPA_DEPTH :
|
||||
m_sDepth = ::ToString( dVal) ;
|
||||
return true ;
|
||||
case MPA_STARTPOS :
|
||||
m_dStartPos = dVal ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ProbingData::SetParam( int nType, const string& sVal)
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_NAME :
|
||||
m_sName = sVal ;
|
||||
return true ;
|
||||
case MPA_TOOL :
|
||||
m_sToolName = sVal ;
|
||||
return true ;
|
||||
case MPA_DEPTH_STR :
|
||||
m_sDepth = sVal ;
|
||||
return true ;
|
||||
case MPA_TUUID :
|
||||
return ::FromString( sVal, m_ToolUuid) ;
|
||||
case MPA_UUID :
|
||||
return ::FromString( sVal, m_Uuid) ;
|
||||
case MPA_SYSNOTES :
|
||||
m_sSysNotes = sVal ;
|
||||
return true ;
|
||||
case MPA_USERNOTES :
|
||||
m_sUserNotes = sVal ;
|
||||
return true ;
|
||||
case MPA_INITANGS :
|
||||
m_sInitAngs = sVal ;
|
||||
return true ;
|
||||
case MPA_BLOCKEDAXIS :
|
||||
m_sBlockedAxis = sVal ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ProbingData::ResetTool( void)
|
||||
{
|
||||
m_sToolName.clear() ;
|
||||
m_ToolUuid.Clear() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ProbingData::GetParam( int nType, bool& bVal) const
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_INVERT :
|
||||
bVal = m_bInvert ;
|
||||
return true ;
|
||||
case MPA_TOOLINVERT :
|
||||
bVal = m_bToolInvert ;
|
||||
return true ;
|
||||
}
|
||||
bVal = false ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ProbingData::GetParam( int nType, int& nVal) const
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_TYPE :
|
||||
nVal = MT_PROBING ;
|
||||
return true ;
|
||||
case MPA_SCC :
|
||||
nVal = m_nSolCh ;
|
||||
return true ;
|
||||
case MPA_SUBTYPE :
|
||||
nVal = m_nSubType ;
|
||||
return true ;
|
||||
}
|
||||
nVal = 0 ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ProbingData::GetParam( int nType, double& dVal) const
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_FEED :
|
||||
dVal = m_dFeed ;
|
||||
return true ;
|
||||
case MPA_STARTFEED :
|
||||
dVal = m_dStartFeed ;
|
||||
return true ;
|
||||
case MPA_ENDFEED :
|
||||
dVal = m_dEndFeed ;
|
||||
return true ;
|
||||
case MPA_TIPFEED :
|
||||
dVal = m_dTipFeed ;
|
||||
return true ;
|
||||
case MPA_STARTPOS :
|
||||
dVal = m_dStartPos ;
|
||||
return true ;
|
||||
}
|
||||
dVal = 0 ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ProbingData::GetParam( int nType, string& sVal) const
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_NAME :
|
||||
sVal = m_sName ;
|
||||
return true ;
|
||||
case MPA_TOOL :
|
||||
sVal = m_sToolName ;
|
||||
return true ;
|
||||
case MPA_DEPTH_STR :
|
||||
sVal = m_sDepth ;
|
||||
return true ;
|
||||
case MPA_TUUID :
|
||||
sVal = ::ToString( m_ToolUuid) ;
|
||||
return true ;
|
||||
case MPA_UUID :
|
||||
sVal = ::ToString( m_Uuid) ;
|
||||
return true ;
|
||||
case MPA_SYSNOTES :
|
||||
sVal = m_sSysNotes ;
|
||||
return true ;
|
||||
case MPA_USERNOTES :
|
||||
sVal = m_sUserNotes ;
|
||||
return true ;
|
||||
case MPA_INITANGS :
|
||||
sVal = m_sInitAngs ;
|
||||
return true ;
|
||||
case MPA_BLOCKEDAXIS :
|
||||
sVal = m_sBlockedAxis ;
|
||||
return true ;
|
||||
}
|
||||
sVal = "" ;
|
||||
return false ;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2025-2025
|
||||
//----------------------------------------------------------------------------
|
||||
// File : ProbingData.h Data : 09.06.25 Versione : 2.7f2
|
||||
// Contenuto : Dichiarazione della struct ProbingData e costanti associate.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 09.06.25 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "MachiningData.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
struct ProbingData : public MachiningData
|
||||
{
|
||||
EgtUUID m_ToolUuid ; // identificativo universale dell'utensile
|
||||
std::string m_sToolName ; // nome dell'utensile
|
||||
std::string m_sInitAngs ; // angoli iniziali suggeriti (Nome1=val1,Nome2=val2)
|
||||
std::string m_sBlockedAxis ; // eventuale asse rotante bloccato (Nome=val)
|
||||
int m_nSolCh ; // criterio scelta soluzione (quando possibili molteplici)
|
||||
double m_dFeed ; // velocità di lavorazione normale ( se 0 da utensile)
|
||||
double m_dStartFeed ; // velocità di lavorazione iniziale ( se 0 da utensile)
|
||||
double m_dEndFeed ; // velocità di lavorazione finale ( se 0 da utensile)
|
||||
double m_dTipFeed ; // velocità di lavorazione di sfondamento ( se 0 da utensile)
|
||||
bool m_bToolInvert ; // flag per inversione direzione utensile da geometria
|
||||
bool m_bInvert ; // flag di inversione direzione lavorazione
|
||||
std::string m_sDepth ; // affondamento (espressione numerica)
|
||||
double m_dStartPos ; // quota di inizio lavorazione (sempre >= 0)
|
||||
int m_nSubType ; // da [Probing] di Ini di macchina
|
||||
std::string m_sSysNotes ; // note interne
|
||||
std::string m_sUserNotes ; // note dell'utente
|
||||
|
||||
ProbingData( void)
|
||||
: m_ToolUuid(), m_nSolCh( 0), m_dFeed( 0), m_dStartFeed( 0), m_dEndFeed( 0), m_dTipFeed( 0),
|
||||
m_bToolInvert( false), m_bInvert( false), m_dStartPos( 0), m_nSubType( 0) {}
|
||||
ProbingData* Clone( void) const override ;
|
||||
bool CopyFrom( const MachiningData* pMdata) override ;
|
||||
bool SameAs(const MachiningData* pMdata) const override ;
|
||||
int GetType( void) const override
|
||||
{ return MT_PROBING ; }
|
||||
int GetSize( void) const override ;
|
||||
std::string GetTitle( void) const override ;
|
||||
bool FromString( const std::string& sString, int& nKey) override ;
|
||||
std::string ToString( int nKey) const override ;
|
||||
bool IsOptional( int nKey) const override ;
|
||||
bool SetParam( int nType, bool bVal) override ;
|
||||
bool SetParam( int nType, int nVal) override ;
|
||||
bool SetParam( int nType, double dVal) override ;
|
||||
bool SetParam( int nType, const std::string& sVal) override ;
|
||||
bool ResetTool( void) override ;
|
||||
bool GetParam( int nType, bool& bVal) const override ;
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool GetTool( const ToolsMgr* pToolsMgr, const ToolData*& pTdata) const override ;
|
||||
bool VerifyTool( const ToolsMgr* pToolsMgr, const std::string& sVal, const ToolData*& pTdata) const override ;
|
||||
bool VerifySolCh( int nVal) const ;
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline const ProbingData* GetProbingData( const MachiningData* pMdata)
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_PROBING)
|
||||
return nullptr ;
|
||||
return ( static_cast<const ProbingData*>( pMdata)) ; }
|
||||
inline ProbingData* GetProbingData( MachiningData* pMdata)
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_PROBING)
|
||||
return nullptr ;
|
||||
return ( static_cast<ProbingData*>( pMdata)) ; }
|
||||
+162
-41
@@ -29,11 +29,8 @@
|
||||
using namespace std ;
|
||||
|
||||
//------------------------------ Errors --------------------------------------
|
||||
// 1001 = "Error with setup : xxx"
|
||||
// 1002 = "Error opening Cnc file"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static const string ERR_EXT = ".err" ;
|
||||
// 1002 = "Error with setup : xxx"
|
||||
// 1003 = "Error opening Cnc file"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
Processor::Processor( void)
|
||||
@@ -84,6 +81,9 @@ Processor::Run( const string& sOutFile, const string& sInfo)
|
||||
if ( ! VerifySetup())
|
||||
return false ;
|
||||
|
||||
// imposto la fase iniziale come corrente
|
||||
m_pMchMgr->SetCurrPhase( 1) ;
|
||||
|
||||
// evento inizio esecuzione
|
||||
bool bOk = true ;
|
||||
if ( ! OnStart()) {
|
||||
@@ -145,6 +145,9 @@ Processor::Run( const string& sOutFile, const string& sInfo)
|
||||
LOG_ERROR( GetEMkLogger(), "OnEnd error") ;
|
||||
}
|
||||
|
||||
// imposto la fase iniziale come corrente
|
||||
m_pMchMgr->SetCurrPhase( 1) ;
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
@@ -165,7 +168,7 @@ Processor::VerifySetup( void)
|
||||
string sErr = "Error with setup :" ;
|
||||
for ( const auto& sTmp : vsErr)
|
||||
sErr += " " + sTmp ;
|
||||
m_pMchMgr->SetLastError( 1001, sErr) ;
|
||||
m_pMchMgr->SetLastError( 1002, sErr) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -201,7 +204,7 @@ Processor::ProcessDisposition( int nOpId, int nOpInd)
|
||||
return false ;
|
||||
// Se utensile non definito o cambiato, emetto selezione nuovo utensile
|
||||
if ( m_sTool.empty() || m_sTool != m_sPrevTool) {
|
||||
if ( ! OnToolSelect( sTool, sHead, nExit, sTcPos))
|
||||
if ( ! OnToolSelect( sTool, sHead, nExit, sTcPos, false))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -218,6 +221,38 @@ Processor::ProcessDisposition( int nOpId, int nOpInd)
|
||||
if ( ! OnTableData( sTable, ptOri1))
|
||||
return false ;
|
||||
|
||||
// Recupero assi tavola mossi nella disposizione
|
||||
INTVECTOR vMovAxId ;
|
||||
for ( int i = 0 ; ; ++ i) {
|
||||
string sName ;
|
||||
double dPos ;
|
||||
if ( pDisp->GetMoveAxisData( i, sName, dPos)) {
|
||||
int nAxId = m_pMachine->GetAxisId( sName) ;
|
||||
if ( nAxId != GDB_ID_NULL)
|
||||
vMovAxId.emplace_back( nAxId) ;
|
||||
}
|
||||
else
|
||||
break ;
|
||||
}
|
||||
|
||||
// Emetto posizioni assi di tavola
|
||||
INTVECTOR vAxisId ;
|
||||
m_pMachine->GetAllAxesIds( vAxisId) ;
|
||||
int nTableId = m_pMachine->GetTableId( sTable) ;
|
||||
int nInd = 0 ;
|
||||
for ( int nAxId : vAxisId) {
|
||||
string sName ;
|
||||
double dPos ;
|
||||
if ( m_pMachine->IsDispositionAxis( nAxId, nTableId) &&
|
||||
m_pMachine->GetAxisName( nAxId, sName) &&
|
||||
m_pMachine->GetAxisPos( sName, dPos)) {
|
||||
++ nInd ;
|
||||
bool bMoved = ( std::find( vMovAxId.begin(), vMovAxId.end(), nAxId) != vMovAxId.end()) ;
|
||||
if ( ! OnTableAxisData( nInd, sName, dPos, bMoved))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
// Emetto dati bloccaggi
|
||||
for ( int i = 0 ; ; ++ i) {
|
||||
string sName ;
|
||||
@@ -225,8 +260,9 @@ Processor::ProcessDisposition( int nOpId, int nOpInd)
|
||||
Point3d ptPos ;
|
||||
double dAngDeg ;
|
||||
double dMov ;
|
||||
if ( pDisp->GetFixtureData( i, sName, nId, ptPos, dAngDeg, dMov)) {
|
||||
if ( ! OnFixtureData( nId, i + 1, sName, ptPos, dAngDeg, dMov))
|
||||
string sTaLink ;
|
||||
if ( pDisp->GetFixtureData( i, sName, nId, ptPos, dAngDeg, dMov, sTaLink)) {
|
||||
if ( ! OnFixtureData( nId, i + 1, sName, ptPos, dAngDeg, dMov, sTaLink))
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
@@ -240,7 +276,7 @@ Processor::ProcessDisposition( int nOpId, int nOpInd)
|
||||
Point3d ptPos ;
|
||||
int nFlag ;
|
||||
if ( pDisp->GetMoveRawData( i, nRawId, nType, ptPos, nFlag)) {
|
||||
if ( ! OnRawMoveData( nRawId, i + 1, nType, ptPos, nFlag))
|
||||
if ( ! OnRawMoveData( nRawId, i + 1, nType, ptPos, nFlag))
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
@@ -279,7 +315,7 @@ Processor::ProcessMachining( int nOpId, int nOpInd)
|
||||
return false ;
|
||||
|
||||
// Verifico non sia vuota
|
||||
if ( m_pMchMgr->IsMachiningEmpty())
|
||||
if ( m_pMchMgr->IsMachiningEmpty( NEED_ONE_TP_OK))
|
||||
return true ;
|
||||
|
||||
// Recupero l'utensile della lavorazione corrente
|
||||
@@ -316,7 +352,8 @@ Processor::ProcessMachining( int nOpId, int nOpInd)
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_EXIT, nExit) ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_TCPOS, sTcPos) ;
|
||||
}
|
||||
if ( ! OnToolSelect( sTool, sHead, nExit, sTcPos))
|
||||
bool bFloating = m_pMachine->IsCurrToolFloating() ;
|
||||
if ( ! OnToolSelect( sTool, sHead, nExit, sTcPos, bFloating))
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -380,11 +417,15 @@ Processor::ProcessClPath( int nClPathId, int nClPathInd, int nOpId, int nOpInd)
|
||||
// Recupero massima elevazione
|
||||
double dElev = 0 ;
|
||||
m_pGeomDB->GetInfo( nClPathId, KEY_ELEV, dElev) ;
|
||||
// recupero eventuale attivazione uscite (gruppi a forare)
|
||||
INTVECTOR vActiveExit ;
|
||||
m_pGeomDB->GetInfo( nClPathId, KEY_DRACEX, vActiveExit) ;
|
||||
// Recupero il numero di eventi ausiliari iniziali
|
||||
int nAS = 0 ;
|
||||
m_pGeomDB->GetInfo( nClPathId, KEY_AS_TOT, nAS) ;
|
||||
// Emetto inizio percorso di lavoro
|
||||
if ( ! OnPathStart( nClPathId, nClPathInd, nAS, ptStart, ptEnd, vtExtr, ptMin, ptMax, vAxMin, vAxMax, dElev))
|
||||
if ( ! OnPathStart( nClPathId, nClPathInd, nAS, ptStart, ptEnd, vtExtr,
|
||||
ptMin, ptMax, vAxMin, vAxMax, dElev, vActiveExit))
|
||||
return false ;
|
||||
|
||||
// Emissione eventuali dati ausiliari di inizio
|
||||
@@ -408,7 +449,7 @@ Processor::ProcessClPath( int nClPathId, int nClPathInd, int nOpId, int nOpInd)
|
||||
// processo l'entità
|
||||
if ( ! ProcessClEnt( nEntId, nEntInd, nClPathId, nClPathInd, nOpId, nOpInd))
|
||||
bOk = false ;
|
||||
// passo all'entità successivo
|
||||
// passo all'entità successiva
|
||||
nEntId = m_pGeomDB->GetNext( nEntId) ;
|
||||
}
|
||||
|
||||
@@ -443,19 +484,24 @@ Processor::ProcessClEnt( int nEntId, int nEntInd, int nClPathId, int nClPathInd,
|
||||
if ( pCamData == nullptr || pCamData->GetAxesStatus() != CamData::AS_OK)
|
||||
return false ;
|
||||
const DBLVECTOR& AxesEnd = pCamData->GetAxesVal() ;
|
||||
// Emetto movimento
|
||||
int nMove = pCamData->GetMoveType() ;
|
||||
// Recupero i dati Cam del movimento successivo del percorso (se esiste)
|
||||
CamData* pNextCamData = GetCamData( m_pGeomDB->GetUserObj( m_pGeomDB->GetNext( nEntId))) ;
|
||||
int nMoveNext = ( pNextCamData != nullptr ? pNextCamData->GetMoveType() : -1) ;
|
||||
DBLVECTOR AxesNull ;
|
||||
const DBLVECTOR& AxesNext = ( pNextCamData != nullptr ? pNextCamData->GetAxesVal() : AxesNull) ;
|
||||
// Emetto movimento
|
||||
switch ( nMove) {
|
||||
case 0 : // rapido
|
||||
if ( ! OnRapid( nEntId, nEntInd, nMove, AxesEnd, pCamData->GetAxesMask(),
|
||||
pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(),
|
||||
pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex()))
|
||||
pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex(), nMoveNext, AxesNext))
|
||||
return false ;
|
||||
break ;
|
||||
case 1 : // linea
|
||||
if ( ! OnLinear( nEntId, nEntInd, nMove, AxesEnd,
|
||||
pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(),
|
||||
pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex()))
|
||||
pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex(), nMoveNext, AxesNext))
|
||||
return false ;
|
||||
break ;
|
||||
case 2 : // arco CW
|
||||
@@ -465,7 +511,7 @@ Processor::ProcessClEnt( int nEntId, int nEntInd, int nClPathId, int nClPathInd,
|
||||
if ( ! OnArc( nEntId, nEntInd, nMove, AxesEnd,
|
||||
pCamData->GetAxesCen(), ptMid, pCamData->GetAxesRad(), pCamData->GetAxesAngCen(),
|
||||
pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(),
|
||||
pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex()))
|
||||
pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex(), nMoveNext, AxesNext))
|
||||
return false ;
|
||||
break ;
|
||||
}
|
||||
@@ -515,8 +561,8 @@ bool
|
||||
Processor::UpdateAxes( void)
|
||||
{
|
||||
// Carico i nomi degli assi macchina attivi
|
||||
return m_pMachine->GetAllCurrAxesName( m_AxesName) &&
|
||||
m_pMachine->GetAllCurrAxesToken( m_AxesToken) ;
|
||||
return m_pMachine->GetAllCurrAxesNames( m_AxesName) &&
|
||||
m_pMachine->GetAllCurrAxesTokens( m_AxesToken) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -570,7 +616,7 @@ Processor::OnProgramStart( const string& sMachName, const string& sCncFile, cons
|
||||
// apro il file di output
|
||||
bool bOk = m_pMachine->WriterOpen( sCncFile) ;
|
||||
if ( ! bOk)
|
||||
m_pMchMgr->SetLastError( 1002, "Error opening Cnc file") ;
|
||||
m_pMchMgr->SetLastError( 1003, "Error opening Cnc file") ;
|
||||
// assegno nome macchina
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MACHNAME, sMachName) ;
|
||||
// assegno nome file
|
||||
@@ -603,6 +649,7 @@ Processor::ProcessToolData( void)
|
||||
string sHead ;
|
||||
int nExit ;
|
||||
string sTcPos ;
|
||||
int nType ;
|
||||
int nComp ;
|
||||
double dDiam ;
|
||||
double dTDiam ;
|
||||
@@ -611,7 +658,7 @@ Processor::ProcessToolData( void)
|
||||
double dDist ;
|
||||
double dMaxSpeed ;
|
||||
MyToolData( void)
|
||||
: sName(), sHead(), nExit( 0), sTcPos(), nComp(0), dDiam( 0), dLen( 0), dDist( 0), dMaxSpeed( 0) {}
|
||||
: sName(), sHead(), nExit( 0), sTcPos(), nType(0), nComp(0), dDiam( 0), dLen( 0), dDist( 0), dMaxSpeed( 0) {}
|
||||
} ;
|
||||
typedef vector<MyToolData> TDATAVECTOR ;
|
||||
TDATAVECTOR vTdata ;
|
||||
@@ -636,6 +683,7 @@ Processor::ProcessToolData( void)
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_HEAD, Tdata.sHead) ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_EXIT, Tdata.nExit) ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_TCPOS, Tdata.sTcPos) ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_TYPE, Tdata.nType) ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_CORR, Tdata.nComp) ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_DIAM, Tdata.dDiam) ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_TOTDIAM, Tdata.dTDiam) ;
|
||||
@@ -674,7 +722,8 @@ Processor::ProcessToolData( void)
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EXIT, nExit) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCPOS, sTcPos) ;
|
||||
if ( m_pMchMgr->TdbSetCurrTool( sTool)) {
|
||||
int nComp ; double dDiam ; double dTDiam ; double dLen ; double dTLen ; double dDist ; double dMaxSpeed ;
|
||||
int nType ; int nComp ; double dDiam ; double dTDiam ; double dLen ; double dTLen ; double dDist ; double dMaxSpeed ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_TYPE, nType) ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_CORR, nComp) ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_DIAM, dDiam) ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_TOTDIAM, dTDiam) ;
|
||||
@@ -682,6 +731,7 @@ Processor::ProcessToolData( void)
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_TOTLEN, dTLen) ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_DIST, dDist) ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_MAXSPEED, dMaxSpeed) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TTYPE, nType) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCOMP, nComp) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TDIAM, dDiam) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TTOTDIAM, dTDiam) ;
|
||||
@@ -721,6 +771,7 @@ Processor::ProcessToolData( void)
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_HEAD, vTdata[i].sHead) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EXIT, vTdata[i].nExit) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCPOS, vTdata[i].sTcPos) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TTYPE, vTdata[i].nType) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCOMP, vTdata[i].nComp) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TDIAM, vTdata[i].dDiam) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TTOTDIAM, vTdata[i].dTDiam) ;
|
||||
@@ -790,10 +841,24 @@ Processor::OnTableData( const string& sName, const Point3d& ptOri1)
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Processor::OnTableAxisData( int nAxisInd, const string& sName, double dPos, bool bMoved)
|
||||
{
|
||||
// assegno dati movimento asse di tavola
|
||||
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TAIND, nAxisInd) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TANAME, sName) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TAPOS, dPos) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TAMOVED, bMoved) ;
|
||||
// chiamo la funzione di gestione dati movimento asse di tavola
|
||||
bOk = bOk && CallOnTableAxisData() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Processor::OnFixtureData( int nFixId, int nFixInd, const string& sName, const Point3d& ptPos,
|
||||
double dAngDeg, double dMov)
|
||||
double dAngDeg, double dMov, const string& sTaLink)
|
||||
{
|
||||
// assegno dati bloccaggio
|
||||
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FIXID, nFixId) ;
|
||||
@@ -802,6 +867,10 @@ Processor::OnFixtureData( int nFixId, int nFixInd, const string& sName, const Po
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FIXPOS, ptPos) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FIXANG, dAngDeg) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FIXMOB, dMov) ;
|
||||
if ( ! IsEmptyOrSpaces( sTaLink))
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FIXTAL, sTaLink) ;
|
||||
else
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_FIXTAL) ;
|
||||
// chiamo la funzione di gestione dati bloccaggio
|
||||
bOk = bOk && CallOnFixtureData() ;
|
||||
return bOk ;
|
||||
@@ -809,11 +878,11 @@ Processor::OnFixtureData( int nFixId, int nFixInd, const string& sName, const Po
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Processor::OnRawMoveData( int nRawId, int RawMoveInd, int nType, const Point3d& ptPos, int nFlag)
|
||||
Processor::OnRawMoveData( int nRawId, int nRawMoveInd, int nType, const Point3d& ptPos, int nFlag)
|
||||
{
|
||||
// assegno dati bloccaggio
|
||||
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWID, nRawId) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWIND, RawMoveInd) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWIND, nRawMoveInd) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWTYPE, nType) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWPOS, ptPos) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWFLAG, nFlag) ;
|
||||
@@ -824,23 +893,25 @@ Processor::OnRawMoveData( int nRawId, int RawMoveInd, int nType, const Point3d&
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Processor::OnToolSelect( const string& sTool, const string& sHead, int nExit, const string& sTcPos)
|
||||
Processor::OnToolSelect( const string& sTool, const string& sHead, int nExit, const string& sTcPos, bool bFloating)
|
||||
{
|
||||
// assegno il nome dell'utensile, la testa, l'uscita e l'eventuale posizione nel toolchanger
|
||||
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TOOL, sTool) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_HEAD, sHead) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EXIT, nExit) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCPOS, sTcPos) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TFLOAT, bFloating) ;
|
||||
// assegno il token e il nome degli assi
|
||||
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
|
||||
int nNumAxes = int( m_AxesName.size()) ;
|
||||
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
|
||||
if ( i <= nNumAxes) {
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisToken(i), m_AxesToken[i-1]) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisName(i), m_AxesName[i-1]) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisToken( i, bIsRobot), m_AxesToken[i-1]) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisName( i, bIsRobot), m_AxesName[i-1]) ;
|
||||
}
|
||||
else {
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisToken(i)) ;
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisName(i)) ;
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisToken( i, bIsRobot)) ;
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisName( i, bIsRobot)) ;
|
||||
}
|
||||
}
|
||||
// chiamo la funzione di selezione utensile
|
||||
@@ -899,7 +970,7 @@ Processor::OnMachiningEnd( void)
|
||||
bool
|
||||
Processor::OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
|
||||
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev)
|
||||
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit)
|
||||
{
|
||||
// assegno identificativo e indice percorso di lavorazione
|
||||
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHID, nClPathId) ;
|
||||
@@ -918,6 +989,8 @@ Processor::OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& p
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PAXMAX, vAxMax) ;
|
||||
// assegno la massima elevazione
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_ELEV, dElev) ;
|
||||
// assegno uscite attive per gruppi a forare
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_DRACEX, vActiveExit) ;
|
||||
// chiamo la funzione di inizio percorso di lavorazione
|
||||
bOk = bOk && CallOnPathStart() ;
|
||||
return bOk ;
|
||||
@@ -962,7 +1035,7 @@ Processor::OnPathEndAux( int nInd, const string& sAE)
|
||||
bool
|
||||
Processor::OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, int nAxesMask,
|
||||
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
|
||||
int nFlag, int nFlag2, int nIndex)
|
||||
int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext)
|
||||
{
|
||||
// cancello variabili estranee
|
||||
ResetArcData() ;
|
||||
@@ -972,12 +1045,13 @@ Processor::OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd
|
||||
// assegno il tipo di movimento
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ;
|
||||
// assegno il valore degli assi
|
||||
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
|
||||
int nNumAxes = int( AxesEnd.size()) ;
|
||||
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
|
||||
if ( i <= nNumAxes)
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisValue(i), AxesEnd[i-1]) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisValue( i, GLOB_VAR, bIsRobot), AxesEnd[i-1]) ;
|
||||
else
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisValue(i)) ;
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisValue( i, GLOB_VAR, bIsRobot)) ;
|
||||
}
|
||||
// assegno la mascheratura degli assi
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MASK, nAxesMask) ;
|
||||
@@ -993,6 +1067,21 @@ Processor::OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG2, nFlag2) ;
|
||||
// assegno il valore dell'indice
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, nIndex) ;
|
||||
// anticipazione di alcuni dati dell'eventuale movimento successivo dello stesso percorso
|
||||
if ( nMoveNext != -1) {
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVESUCC, nMoveNext) ;
|
||||
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
|
||||
if ( i <= nNumAxes)
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot), AxesNext[i-1]) ;
|
||||
else
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot)) ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_MOVESUCC) ;
|
||||
for ( int i = 1 ; i <= MAX_AXES ; ++ i)
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot)) ;
|
||||
}
|
||||
// chiamo la funzione di movimento in rapido
|
||||
bOk = bOk && CallOnRapid() ;
|
||||
return bOk ;
|
||||
@@ -1002,7 +1091,7 @@ Processor::OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd
|
||||
bool
|
||||
Processor::OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
|
||||
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
|
||||
double dFeed, int nFlag, int nFlag2, int nIndex)
|
||||
double dFeed, int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext)
|
||||
{
|
||||
// cancello variabili estranee
|
||||
ResetArcData() ;
|
||||
@@ -1012,12 +1101,13 @@ Processor::OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEn
|
||||
// assegno il tipo di movimento
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ;
|
||||
// assegno il valore degli assi
|
||||
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
|
||||
int nNumAxes = int( AxesEnd.size()) ;
|
||||
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
|
||||
if ( i <= nNumAxes)
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisValue(i), AxesEnd[i-1]) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisValue( i, GLOB_VAR, bIsRobot), AxesEnd[i-1]) ;
|
||||
else
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisValue(i)) ;
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisValue( i, GLOB_VAR, bIsRobot)) ;
|
||||
}
|
||||
// assegno il valore del versore utensile
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TDIR, vtTool) ;
|
||||
@@ -1033,6 +1123,21 @@ Processor::OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEn
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG2, nFlag2) ;
|
||||
// assegno il valore dell'indice
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, nIndex) ;
|
||||
// anticipazione di alcuni dati dell'eventuale movimento successivo dello stesso percorso
|
||||
if ( nMoveNext != -1) {
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVESUCC, nMoveNext) ;
|
||||
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
|
||||
if ( i <= nNumAxes)
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot), AxesNext[i-1]) ;
|
||||
else
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot)) ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_MOVESUCC) ;
|
||||
for ( int i = 1 ; i <= MAX_AXES ; ++ i)
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot)) ;
|
||||
}
|
||||
// chiamo la funzione di movimento in rapido
|
||||
bOk = bOk && CallOnLinear() ;
|
||||
return bOk ;
|
||||
@@ -1043,7 +1148,7 @@ bool
|
||||
Processor::OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
|
||||
const Point3d& ptCen, const Point3d& ptMid, double dRad, double dAngCen,
|
||||
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
|
||||
double dFeed, int nFlag, int nFlag2, int nIndex)
|
||||
double dFeed, int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext)
|
||||
{
|
||||
// assegno Id e indice entità di movimento
|
||||
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEID, nEntId) ;
|
||||
@@ -1051,12 +1156,13 @@ Processor::OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
|
||||
// assegno il tipo di movimento
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ;
|
||||
// assegno il valore degli assi
|
||||
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
|
||||
int nNumAxes = int( AxesEnd.size()) ;
|
||||
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
|
||||
if ( i <= nNumAxes)
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisValue(i), AxesEnd[i-1]) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisValue( i, GLOB_VAR, bIsRobot), AxesEnd[i-1]) ;
|
||||
else
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisValue(i)) ;
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisValue( i, GLOB_VAR, bIsRobot)) ;
|
||||
}
|
||||
// assegno le coordinate del centro
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_C1, ptCen.x) ;
|
||||
@@ -1084,6 +1190,21 @@ Processor::OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG2, nFlag2) ;
|
||||
// assegno il valore dell'indice
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, nIndex) ;
|
||||
// anticipazione di alcuni dati dell'eventuale movimento successivo dello stesso percorso
|
||||
if ( nMoveNext != -1) {
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVESUCC, nMoveNext) ;
|
||||
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
|
||||
if ( i <= nNumAxes)
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot), AxesNext[i-1]) ;
|
||||
else
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot)) ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_MOVESUCC) ;
|
||||
for ( int i = 1 ; i <= MAX_AXES ; ++ i)
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot)) ;
|
||||
}
|
||||
// chiamo la funzione di movimento in rapido
|
||||
bOk = bOk && CallOnArc() ;
|
||||
return bOk ;
|
||||
|
||||
+9
-7
@@ -42,33 +42,34 @@ class Processor
|
||||
bool OnProgramStart( const std::string& sMachName, const std::string& sCncFile, const std::string& sInfo, bool bSetup) ;
|
||||
bool OnProgramEnd( void) ;
|
||||
bool ProcessToolData( void) ;
|
||||
bool OnToolSelect( const std::string& sTool, const std::string& sHead, int nExit, const std::string& sTcPos) ;
|
||||
bool OnToolSelect( const std::string& sTool, const std::string& sHead, int nExit, const std::string& sTcPos, bool bFloating) ;
|
||||
bool OnToolDeselect( const std::string& sNextTool, const std::string& sNextHead, int nNextExit, const std::string& sNextTcPos) ;
|
||||
bool OnDispositionStart( int nOpId, int nOpInd, int nPhase, bool bEmpty, bool bSomeByHand) ;
|
||||
bool OnDispositionEnd( void) ;
|
||||
bool OnTableData( const std::string& sName, const Point3d& ptOri1) ;
|
||||
bool OnTableAxisData( int nAxisInd, const std::string& sName, double dPos, bool bMoved) ;
|
||||
bool OnFixtureData( int nFixId, int nFixInd, const std::string& sName,
|
||||
const Point3d& ptPos, double dAngDeg, double dMov) ;
|
||||
bool OnRawMoveData( int nRawId, int RawMoveInd, int nType, const Point3d& ptPos, int nFlag) ;
|
||||
const Point3d& ptPos, double dAngDeg, double dMov, const std::string& sTaLink) ;
|
||||
bool OnRawMoveData( int nRawId, int nRawMoveInd, int nType, const Point3d& ptPos, int nFlag) ;
|
||||
bool OnMachiningStart( int nOpId, int nOpInd, double dSpeed, const Point3d& ptMin, const Point3d& ptMax,
|
||||
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax) ;
|
||||
bool OnMachiningEnd( void) ;
|
||||
bool OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
|
||||
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev) ;
|
||||
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit) ;
|
||||
bool OnPathEnd( int nAE) ;
|
||||
bool OnPathStartAux( int nInd, const std::string& sAS) ;
|
||||
bool OnPathEndAux( int nInd, const std::string& sAE) ;
|
||||
bool OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, int nAxesMask,
|
||||
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
|
||||
int nFlag, int nFlag2, int nIndex) ;
|
||||
int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext) ;
|
||||
bool OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
|
||||
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
|
||||
double dFeed, int nFlag, int nFlag2, int nIndex) ;
|
||||
double dFeed, int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext) ;
|
||||
bool OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
|
||||
const Point3d& ptCen, const Point3d& ptMid, double dRad, double dAngCen,
|
||||
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
|
||||
double dFeed, int nFlag, int nFlag2, int nIndex) ;
|
||||
double dFeed, int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext) ;
|
||||
bool ResetArcData( void) ;
|
||||
|
||||
protected :
|
||||
@@ -80,6 +81,7 @@ class Processor
|
||||
virtual bool CallOnDispositionStart( void) = 0 ;
|
||||
virtual bool CallOnDispositionEnd( void) = 0 ;
|
||||
virtual bool CallOnTableData( void) = 0 ;
|
||||
virtual bool CallOnTableAxisData( void) = 0 ;
|
||||
virtual bool CallOnFixtureData( void) = 0 ;
|
||||
virtual bool CallOnRawMoveData( void) = 0 ;
|
||||
virtual bool CallOnToolSelect( void) = 0 ;
|
||||
|
||||
+105
-71
@@ -4,7 +4,7 @@
|
||||
// File : SawFinishing.cpp Data : 23.04.19 Versione : 2.1d3
|
||||
// Contenuto : Implementazione gestione finitura superficie con lama.
|
||||
//
|
||||
// Note : Questa lavorazione è sempre espressa nel riferimento globale.
|
||||
// Note : Questa lavorazione è sempre espressa nel riferimento globale.
|
||||
//
|
||||
// Modifiche : 05.04.16 DS Creazione modulo.
|
||||
// 23.04.19 DS Aggiunte cornici curve.
|
||||
@@ -51,6 +51,7 @@ using namespace std ;
|
||||
// 2713 = "Error in SawFinishing : link movements not calculable"
|
||||
// 2714 = "Error in SawFinishing : link outstroke xx"
|
||||
// 2715 = "Error in SawFinishing : post apply not calculable"
|
||||
// 2716 = "Error in SawFinishing : special apply not calculable"
|
||||
// 2751 = "Warning in SawFinishing : Skipped entity (xx)"
|
||||
// 2752 = "Warning in SawFinishing : No machinable path"
|
||||
// 2753 = "Warning in SawFinishing : Tool name changed (xx)"
|
||||
@@ -446,14 +447,15 @@ SawFinishing::SetParam( int nType, const string& sVal)
|
||||
bool
|
||||
SawFinishing::SetGeometry( const SELVECTOR& vIds)
|
||||
{
|
||||
// verifico validità gestore DB geometrico
|
||||
// verifico validità gestore DB geometrico
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// reset della geometria corrente
|
||||
// copia temporanea e reset della geometria corrente
|
||||
SELVECTOR vOldId = m_vId ;
|
||||
m_vId.clear() ;
|
||||
// verifico che gli identificativi rappresentino delle entità ammissibili
|
||||
// verifico che gli identificativi rappresentino delle entità ammissibili
|
||||
for ( const auto& Id : vIds) {
|
||||
// test sull'entità
|
||||
// test sull'entità
|
||||
int nSubs ;
|
||||
if ( ! VerifyGeometry( Id, nSubs)) {
|
||||
string sInfo = "Warning in SawFinishing : Skipped entity " + ToString( Id) ;
|
||||
@@ -464,7 +466,8 @@ SawFinishing::SetGeometry( const SELVECTOR& vIds)
|
||||
m_vId.emplace_back( Id) ;
|
||||
}
|
||||
// aggiorno lo stato
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
if ( m_vId != vOldId)
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
// restituisco presenza geometria da lavorare
|
||||
return ( ! m_vId.empty()) ;
|
||||
}
|
||||
@@ -485,26 +488,30 @@ SawFinishing::Apply( bool bRecalc, bool bPostApply)
|
||||
int nCurrCuts = m_nCuts ;
|
||||
m_nCuts = 0 ;
|
||||
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
|
||||
return false ;
|
||||
|
||||
// aggiorno dati geometrici dell'utensile
|
||||
bool bToolChanged = true ;
|
||||
if ( ! UpdateToolData( &bToolChanged)) {
|
||||
if ( ! UpdateToolData()) {
|
||||
m_pMchMgr->SetLastError( 2701, "Error in SawFinishing : UpdateToolData failed") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// se modificata geometria, necessario ricalcolo
|
||||
if ( ( m_nStatus & MCH_ST_GEO_MODIF) != 0)
|
||||
bRecalc = true ;
|
||||
|
||||
// verifico se necessario continuare nell'aggiornamento
|
||||
if ( ! bRecalc && ! bToolChanged &&
|
||||
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
|
||||
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
// confermo i percorsi di lavorazione
|
||||
m_nCuts = nCurrCuts ;
|
||||
LOG_DBG_INFO( GetEMkLogger(), "SawFinishing apply skipped : status already ok") ;
|
||||
string sLog = string( "SawFinishing apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ;
|
||||
LOG_DBG_INFO( GetEMkLogger(), sLog.c_str()) ;
|
||||
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
|
||||
if ( ! Update( bPostApply))
|
||||
return false ;
|
||||
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
|
||||
LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
|
||||
// esco con successo
|
||||
return true ;
|
||||
@@ -513,7 +520,7 @@ SawFinishing::Apply( bool bRecalc, bool bPostApply)
|
||||
|
||||
// recupero gruppo per geometria ausiliaria
|
||||
int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ;
|
||||
// se non c'è, lo aggiungo
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nAuxId == GDB_ID_NULL) {
|
||||
nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nAuxId == GDB_ID_NULL)
|
||||
@@ -535,7 +542,7 @@ SawFinishing::Apply( bool bRecalc, bool bPostApply)
|
||||
|
||||
// recupero gruppo per geometria di lavorazione (Cutter Location)
|
||||
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
|
||||
// se non c'è, lo aggiungo
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nClId == GDB_ID_NULL) {
|
||||
nClId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nClId == GDB_ID_NULL)
|
||||
@@ -582,7 +589,7 @@ SawFinishing::Apply( bool bRecalc, bool bPostApply)
|
||||
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
|
||||
if ( ! Update( bPostApply))
|
||||
return false ;
|
||||
|
||||
|
||||
// aggiorno stato della lavorazione
|
||||
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
|
||||
// dichiaro successiva da aggiornare
|
||||
@@ -597,7 +604,7 @@ SawFinishing::Apply( bool bRecalc, bool bPostApply)
|
||||
bool
|
||||
SawFinishing::Update( bool bPostApply)
|
||||
{
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
|
||||
return false ;
|
||||
|
||||
@@ -607,6 +614,9 @@ SawFinishing::Update( bool bPostApply)
|
||||
return true ;
|
||||
}
|
||||
|
||||
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
|
||||
RemoveClimbRiseHome() ;
|
||||
|
||||
// imposto eventuale asse bloccato da lavorazione
|
||||
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
|
||||
|
||||
@@ -623,6 +633,19 @@ SawFinishing::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni speciali
|
||||
string sSpecErr ;
|
||||
if ( bPostApply && ! SpecialApply( sSpecErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sSpecErr))
|
||||
m_pMchMgr->SetLastError( 2716, sSpecErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2716, "Error in SawFinishing : special apply not calculable") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
|
||||
if ( ! AdjustStartEndMovements()) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
@@ -633,14 +656,11 @@ SawFinishing::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni
|
||||
string sErr ;
|
||||
if ( bPostApply && ! PostApply( sErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sErr))
|
||||
m_pMchMgr->SetLastError( 2715, sErr) ;
|
||||
// esecuzione eventuali personalizzazioni finali
|
||||
string sPostErr ;
|
||||
if ( bPostApply && ! PostApply( sPostErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sPostErr))
|
||||
m_pMchMgr->SetLastError( 2715, sPostErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2715, "Error in SawFinishing : post apply not calculable") ;
|
||||
return false ;
|
||||
@@ -785,16 +805,20 @@ SawFinishing::GetToolData( void) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawFinishing::UpdateToolData( bool* pbChanged)
|
||||
SawFinishing::UpdateToolData( void)
|
||||
{
|
||||
// recupero il gestore DB utensili della macchina corrente
|
||||
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
|
||||
if ( pTMgr == nullptr)
|
||||
return false ;
|
||||
// recupero l'utensile nel DB utensili
|
||||
// recupero l'utensile nel DB utensili (se fallisce con UUID provo con il nome)
|
||||
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
if ( pTdata == nullptr) {
|
||||
pTdata = pTMgr->GetTool( m_Params.m_sToolName) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
m_Params.m_ToolUuid = m_TParams.m_Uuid ;
|
||||
}
|
||||
// salvo posizione TC, testa e uscita originali
|
||||
string sOrigTcPos = m_TParams.m_sTcPos ;
|
||||
string sOrigHead = m_TParams.m_sHead ;
|
||||
@@ -832,9 +856,9 @@ SawFinishing::UpdateToolData( bool* pbChanged)
|
||||
m_Params.m_sToolName + ")" ;
|
||||
m_pMchMgr->SetWarning( 2754, sInfo) ;
|
||||
}
|
||||
// se definito parametro di ritorno, lo assegno
|
||||
if ( pbChanged != nullptr)
|
||||
*pbChanged = bChanged ;
|
||||
// se modificato, aggiusto lo stato
|
||||
if ( bChanged)
|
||||
m_nStatus = MCH_ST_TO_VERIFY ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -842,7 +866,7 @@ SawFinishing::UpdateToolData( bool* pbChanged)
|
||||
bool
|
||||
SawFinishing::GetGeometry( SELVECTOR& vIds) const
|
||||
{
|
||||
// restituisco l'elenco delle entità
|
||||
// restituisco l'elenco delle entità
|
||||
vIds = m_vId ;
|
||||
return true ;
|
||||
}
|
||||
@@ -937,7 +961,7 @@ SawFinishing::GetCurve( SelData Id)
|
||||
bool
|
||||
SawFinishing::AdjustGeometry( int nAuxId)
|
||||
{
|
||||
// sgrossatura di cornici diritte : due o più curve (sezioni e guida rettilinea)
|
||||
// sgrossatura di cornici diritte : due o più curve (sezioni e guida rettilinea)
|
||||
// sgrossatura di cornici curve : due curve (sezione e guida curva)
|
||||
size_t nCrvCount = m_vId.size() ;
|
||||
if ( nCrvCount >= 2) {
|
||||
@@ -961,7 +985,7 @@ SawFinishing::AdjustGeometry( int nAuxId)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// l'ultima curva è la guida
|
||||
// l'ultima curva è la guida
|
||||
PtrOwner<ICurve> pGuide( GetCurve( m_vId[nCrvCount-1])) ;
|
||||
if ( IsNull( pGuide))
|
||||
return false ;
|
||||
@@ -979,8 +1003,8 @@ SawFinishing::AdjustGeometry( int nAuxId)
|
||||
if ( ! pGuide->IsFlat( plPlane, false, 10 * EPS_SMALL) || ! AreSameOrOppositeVectorApprox( plPlane.GetVersN(), Z_AX))
|
||||
return false ;
|
||||
// verifiche sulla curva (che trasformo in composita)
|
||||
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCompo) || ! pCompo->AddCurve( Release( pGuide)))
|
||||
PtrOwner<ICurveComposite> pCompo ;
|
||||
if ( ! pCompo.Set( ConvertCurveToComposite( Release( pGuide))))
|
||||
return false ;
|
||||
// converto in archi e rette
|
||||
pCompo->ArcsBezierCurvesToArcsPerpExtr( LIN_TOL_MID, ANG_TOL_STD_DEG) ;
|
||||
@@ -1100,6 +1124,9 @@ SawFinishing::CalculateStraightAlongToolPath( int nAuxId, int nClId)
|
||||
SetToolDir( vtTool) ;
|
||||
SetCorrAuxDir( vtCorr) ;
|
||||
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
|
||||
|
||||
// Classifico i tratti a seconda della pendenza (salita, discesa, verticale, orizzontale)
|
||||
INTVECTOR vnClass ;
|
||||
ClassifySection( pCrv, vnClass) ;
|
||||
@@ -1175,7 +1202,7 @@ SawFinishing::CalculateStraightAlongToolPath( int nAuxId, int nClId)
|
||||
}
|
||||
}
|
||||
}
|
||||
// se c'è qualcosa in sospeso
|
||||
// se c'è qualcosa in sospeso
|
||||
if ( nStatus != CCL_VERT) {
|
||||
bSkipMax = false ;
|
||||
bool bInvert = ( nStatus == CCL_RISE) ;
|
||||
@@ -1296,6 +1323,9 @@ SawFinishing::CalculateStraightAcrossToolPath( int nAuxId, int nClId)
|
||||
SetToolDir( vtTool) ;
|
||||
SetCorrAuxDir( vtCorr) ;
|
||||
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
|
||||
|
||||
// Inizializzo contatore tagli
|
||||
m_nCuts = 0 ;
|
||||
|
||||
@@ -1322,7 +1352,7 @@ SawFinishing::CalculateStraightAcrossToolPath( int nAuxId, int nClId)
|
||||
// se ZigZag aggiungo risalita
|
||||
if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG) {
|
||||
// recupero distanza di sicurezza
|
||||
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
|
||||
double dSafeZ = GetSafeZ() ;
|
||||
// lunghezza di approccio/retrazione
|
||||
double dAppr = m_Params.m_dStartPos ;
|
||||
// aggiungo retrazione
|
||||
@@ -1368,7 +1398,7 @@ SawFinishing::CalculateCurvedAlongToolPath( int nAuxId, int nClId)
|
||||
// recupero il suo riferimento
|
||||
Frame3d frGdL ;
|
||||
m_pGeomDB->GetGlobFrame( nGuideId, frGdL) ;
|
||||
// porto la curva in globale (dovrebbe già avere riferimento globale)
|
||||
// porto la curva in globale (dovrebbe già avere riferimento globale)
|
||||
pGuide->ToGlob( frGdL) ;
|
||||
// recupero il box globale della linea guida
|
||||
BBox3d b3Guide ;
|
||||
@@ -1407,6 +1437,9 @@ SawFinishing::CalculateCurvedAlongToolPath( int nAuxId, int nClId)
|
||||
SetPathId( nPxId) ;
|
||||
SetToolDir( vtTool) ;
|
||||
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
|
||||
|
||||
// Classifico i tratti a seconda della pendenza (salita, discesa, verticale, orizzontale)
|
||||
INTVECTOR vnClass ;
|
||||
ClassifySection( pCrv, vnClass) ;
|
||||
@@ -1483,7 +1516,7 @@ SawFinishing::CalculateCurvedAlongToolPath( int nAuxId, int nClId)
|
||||
}
|
||||
}
|
||||
}
|
||||
// se c'è qualcosa in sospeso
|
||||
// se c'è qualcosa in sospeso
|
||||
if ( nStatus != CCL_VERT) {
|
||||
bSkipMax = false ;
|
||||
bool bInvert = ( nStatus == CCL_RISE) ;
|
||||
@@ -1527,7 +1560,7 @@ SawFinishing::CalculateCurvedAcrossToolPath( int nAuxId, int nClId)
|
||||
// recupero il suo riferimento
|
||||
Frame3d frGdL ;
|
||||
m_pGeomDB->GetGlobFrame( nGuideId, frGdL) ;
|
||||
// porto la curva in globale (dovrebbe già avere riferimento globale)
|
||||
// porto la curva in globale (dovrebbe già avere riferimento globale)
|
||||
pGuide->ToGlob( frGdL) ;
|
||||
// recupero il box globale della linea guida
|
||||
BBox3d b3Guide ;
|
||||
@@ -1603,6 +1636,9 @@ SawFinishing::CalculateCurvedAcrossToolPath( int nAuxId, int nClId)
|
||||
SetPathId( nPxId) ;
|
||||
SetToolDir( vtTool) ;
|
||||
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
|
||||
|
||||
// Inizializzo contatore tagli
|
||||
m_nCuts = 0 ;
|
||||
|
||||
@@ -1630,7 +1666,7 @@ SawFinishing::CalculateCurvedAcrossToolPath( int nAuxId, int nClId)
|
||||
vtCorr.Rotate( Z_AX, dAngRotDeg - 90) ;
|
||||
// flag di inizio
|
||||
bool bFirst = ( dLen < EPS_SMALL) ;
|
||||
// se non è inizio
|
||||
// se non è inizio
|
||||
bool bCorner = false ;
|
||||
Vector3d vtPrev ;
|
||||
if ( ! bFirst) {
|
||||
@@ -1643,7 +1679,7 @@ SawFinishing::CalculateCurvedAcrossToolPath( int nAuxId, int nClId)
|
||||
double dEndElev = 0 ;
|
||||
GetElevation( m_nPhase, ptPrev, vtPrev, dEndElev) ;
|
||||
// aggiungo retrazione
|
||||
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
|
||||
double dSafeZ = GetSafeZ() ;
|
||||
double dAppr = m_Params.m_dStartPos ;
|
||||
if ( ! AddRetract( ptPrev, vtPrev, dSafeZ, dEndElev, dAppr))
|
||||
return false ;
|
||||
@@ -1667,7 +1703,7 @@ SawFinishing::CalculateCurvedAcrossToolPath( int nAuxId, int nClId)
|
||||
// se ZigZag aggiungo risalita
|
||||
if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG) {
|
||||
// recupero distanza di sicurezza
|
||||
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
|
||||
double dSafeZ = GetSafeZ() ;
|
||||
// lunghezza di approccio/retrazione
|
||||
double dAppr = m_Params.m_dStartPos ;
|
||||
// recupero punto e versore correzione finali
|
||||
@@ -1771,7 +1807,7 @@ SawFinishing::CalculateSection( int nSectGrpId, ICurve*& pSect)
|
||||
bool
|
||||
SawFinishing::TrimSection( ICurve* pCrv)
|
||||
{
|
||||
// se parametri di accorciamento iniziale e finale sono nulli, non faccio alcunché
|
||||
// se parametri di accorciamento iniziale e finale sono nulli, non faccio alcunché
|
||||
if ( m_Params.m_dStartAddLen > - EPS_SMALL && m_Params.m_dEndAddLen > -EPS_SMALL)
|
||||
return true ;
|
||||
|
||||
@@ -1824,7 +1860,7 @@ SawFinishing::CalculateGuideLine( int nGuideId, const BBox3d& b3Sect,
|
||||
// recupero il suo riferimento
|
||||
Frame3d frGdL ;
|
||||
m_pGeomDB->GetGlobFrame( nGuideId, frGdL) ;
|
||||
// porto la curva in globale (dovrebbe già avere riferimento globale)
|
||||
// porto la curva in globale (dovrebbe già avere riferimento globale)
|
||||
pGuide->ToGlob( frGdL) ;
|
||||
// recupero gli estremi della linea guida
|
||||
pGuide->GetStartPoint( ptGdStart) ;
|
||||
@@ -1877,7 +1913,6 @@ SawFinishing::ClassifySection( ICurve* pCrv, INTVECTOR& vnClass)
|
||||
{
|
||||
const ICurveComposite* pCompo = GetCurveComposite( pCrv) ;
|
||||
if ( pCompo != nullptr) {
|
||||
int Ind = 0 ;
|
||||
const ICurve* pSimpCrv = pCompo->GetFirstCurve() ;
|
||||
while ( pSimpCrv != nullptr) {
|
||||
// analizzo la curva
|
||||
@@ -1895,7 +1930,6 @@ SawFinishing::ClassifySection( ICurve* pCrv, INTVECTOR& vnClass)
|
||||
else
|
||||
vnClass.push_back( CCL_FALL) ;
|
||||
// passo alla curva successiva
|
||||
++ Ind ;
|
||||
pSimpCrv = pCompo->GetNextCurve() ;
|
||||
}
|
||||
}
|
||||
@@ -1988,7 +2022,7 @@ SawFinishing::CalcAlongVerticalCuts( ICurve* pSect, int nUmin, int nUmax, const
|
||||
// se ZigZag e non centrato aggiungo risalita
|
||||
if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG && m_Params.m_nLeadLinkType != SAWFIN_LL_CENT) {
|
||||
// recupero distanza di sicurezza
|
||||
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
|
||||
double dSafeZ = GetSafeZ() ;
|
||||
// lunghezza di approccio/retrazione
|
||||
double dAppr = m_Params.m_dStartPos ;
|
||||
// aggiungo retrazione
|
||||
@@ -2075,7 +2109,7 @@ SawFinishing::CalcAlongStdCuts( ICurve* pSect, double dUmin, double dUmax,
|
||||
// se ZigZag e non centrato aggiungo risalita
|
||||
if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG && m_Params.m_nLeadLinkType != SAWFIN_LL_CENT) {
|
||||
// recupero distanza di sicurezza
|
||||
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
|
||||
double dSafeZ = GetSafeZ() ;
|
||||
// lunghezza di approccio/retrazione
|
||||
double dAppr = m_Params.m_dStartPos ;
|
||||
// aggiungo retrazione
|
||||
@@ -2093,7 +2127,7 @@ SawFinishing::CalcAlongOneWayCut( const Point3d& ptStart, const Point3d& ptEnd,
|
||||
const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bVert)
|
||||
{
|
||||
// recupero distanza di sicurezza
|
||||
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
|
||||
double dSafeZ = GetSafeZ() ;
|
||||
// lunghezza di approccio/retrazione
|
||||
double dAppr = m_Params.m_dStartPos ;
|
||||
|
||||
@@ -2142,7 +2176,7 @@ SawFinishing::CalcAlongZigZagCut( const Point3d& ptStart, const Point3d& ptEnd,
|
||||
const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bVert, bool bFirst)
|
||||
{
|
||||
// recupero distanza di sicurezza
|
||||
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
|
||||
double dSafeZ = GetSafeZ() ;
|
||||
// lunghezza di approccio/retrazione
|
||||
double dAppr = m_Params.m_dStartPos ;
|
||||
|
||||
@@ -2209,14 +2243,14 @@ SawFinishing::CalcAlongZigZagCut( const Point3d& ptStart, const Point3d& ptEnd,
|
||||
if ( AddLinearMove( ptNewStart) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se il precedente è più fuori
|
||||
// se il precedente è più fuori
|
||||
else if ( dDiff > 0) {
|
||||
// allungo nuova passata
|
||||
SetFeed( ( bVert ? GetVertFeed() : GetFeed())) ;
|
||||
if ( AddLinearMove( ptNewStart - dDiff * vtNewDir) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se il corrente è più fuori
|
||||
// se il corrente è più fuori
|
||||
else {
|
||||
// allungo passata precedente
|
||||
if ( AddLinearMove( ptLast + dDiff * vtNewDir) == GDB_ID_NULL)
|
||||
@@ -2259,7 +2293,7 @@ SawFinishing::CalcAcrossOneWayCut( const PolyLine& PL, const Vector3d& vtMove,
|
||||
const Vector3d& vtTool, const Vector3d& vtCorr, double dRawZ, double dDepth)
|
||||
{
|
||||
// recupero distanza di sicurezza
|
||||
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
|
||||
double dSafeZ = GetSafeZ() ;
|
||||
// lunghezza di approccio/retrazione
|
||||
double dAppr = m_Params.m_dStartPos ;
|
||||
|
||||
@@ -2316,7 +2350,7 @@ SawFinishing::CalcAcrossZigZagCut( const PolyLine& PL, const Vector3d& vtMove,
|
||||
const Vector3d& vtTool, const Vector3d& vtCorr, double dRawZ, double dDepth, bool bFirst)
|
||||
{
|
||||
// recupero distanza di sicurezza
|
||||
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
|
||||
double dSafeZ = GetSafeZ() ;
|
||||
// lunghezza di approccio/retrazione
|
||||
double dAppr = m_Params.m_dStartPos ;
|
||||
|
||||
@@ -2400,8 +2434,8 @@ SawFinishing::CalcCurvedAlongVerticalCuts( ICurve* pSect, int nUmin, int nUmax,
|
||||
Vector3d vtMove = ( dY - m_TParams.m_dThick / 2) * Z_AX ;
|
||||
OffsetCurve OffsCrv ;
|
||||
OffsCrv.Make( pGuide, dOffs, ICurve::OFF_FILLET) ;
|
||||
PtrOwner<ICurveComposite> pCut( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCut) || ! pCut->AddCurve( OffsCrv.GetLongerCurve()))
|
||||
PtrOwner<ICurveComposite> pCut ;
|
||||
if ( ! pCut.Set( ConvertCurveToComposite( OffsCrv.GetLongerCurve())))
|
||||
return false ;
|
||||
VerifyArcs( pCut) ;
|
||||
pCut->SimpleOffset( SAWRF_OFFS, ICurve::OFF_FORCE_OPEN) ;
|
||||
@@ -2424,7 +2458,7 @@ SawFinishing::CalcCurvedAlongVerticalCuts( ICurve* pSect, int nUmin, int nUmax,
|
||||
// se ZigZag e non centrato aggiungo risalita
|
||||
if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG && m_Params.m_nLeadLinkType != SAWFIN_LL_CENT) {
|
||||
// recupero distanza di sicurezza
|
||||
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
|
||||
double dSafeZ = GetSafeZ() ;
|
||||
// lunghezza di approccio/retrazione
|
||||
double dAppr = m_Params.m_dStartPos ;
|
||||
// aggiungo retrazione
|
||||
@@ -2475,8 +2509,8 @@ SawFinishing::CalcCurvedAlongStdCuts( ICurve* pSect, double dUmin, double dUmax,
|
||||
Vector3d vtMove = ( ptP.y - m_TParams.m_dThick / 2) * Z_AX ;
|
||||
OffsetCurve OffsCrv ;
|
||||
OffsCrv.Make( pGuide, dOffs, ICurve::OFF_FILLET) ;
|
||||
PtrOwner<ICurveComposite> pCut( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCut) || ! pCut->AddCurve( OffsCrv.GetLongerCurve()))
|
||||
PtrOwner<ICurveComposite> pCut ;
|
||||
if ( ! pCut.Set( ConvertCurveToComposite( OffsCrv.GetLongerCurve())))
|
||||
return false ;
|
||||
VerifyArcs( pCut) ;
|
||||
pCut->SimpleOffset( SAWRF_OFFS, ICurve::OFF_FORCE_OPEN) ;
|
||||
@@ -2499,7 +2533,7 @@ SawFinishing::CalcCurvedAlongStdCuts( ICurve* pSect, double dUmin, double dUmax,
|
||||
// se ZigZag e non centrato aggiungo risalita
|
||||
if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG && m_Params.m_nLeadLinkType != SAWFIN_LL_CENT) {
|
||||
// recupero distanza di sicurezza
|
||||
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
|
||||
double dSafeZ = GetSafeZ() ;
|
||||
// lunghezza di approccio/retrazione
|
||||
double dAppr = m_Params.m_dStartPos ;
|
||||
// aggiungo retrazione
|
||||
@@ -2517,7 +2551,7 @@ bool
|
||||
SawFinishing::CalcCurvedAlongZigZagCut( const ICurve* pCut, const Vector3d& vtTool, bool bVert, bool bFirst, double& dEndElev)
|
||||
{
|
||||
// recupero distanza di sicurezza
|
||||
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
|
||||
double dSafeZ = GetSafeZ() ;
|
||||
// lunghezza di approccio/retrazione
|
||||
double dAppr = m_Params.m_dStartPos ;
|
||||
// verifico se passata da invertire (indice dispari)
|
||||
@@ -2585,7 +2619,7 @@ SawFinishing::CalcCurvedAlongZigZagCut( const ICurve* pCut, const Vector3d& vtTo
|
||||
GetCurrPos( ptCurr) ;
|
||||
// differenza tra corrente e nuovo lungo direzione ortogonale
|
||||
double dOrtStartDiff = ( ptNewStart - ptCurr) * vtOrtStart ;
|
||||
// se punto corrente più fuori, aggiungo punto fuori allo stesso modo sul nuovo
|
||||
// se punto corrente più fuori, aggiungo punto fuori allo stesso modo sul nuovo
|
||||
if ( dOrtStartDiff < - 10 * EPS_SMALL) {
|
||||
Point3d ptOut = ptNewStart + ( - dOrtStartDiff * vtOrtStart) ;
|
||||
SetFlag( 0) ;
|
||||
@@ -2593,7 +2627,7 @@ SawFinishing::CalcCurvedAlongZigZagCut( const ICurve* pCut, const Vector3d& vtTo
|
||||
if ( ! SameAsCurrPos( ptOut) && AddLinearMove( ptOut) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se altrimenti più dentro, aggiungo punto fuori allo stesso modo sul corrente
|
||||
// se altrimenti più dentro, aggiungo punto fuori allo stesso modo sul corrente
|
||||
else if ( dOrtStartDiff > 10 * EPS_SMALL) {
|
||||
Point3d ptOut = ptCurr + ( dOrtStartDiff * vtOrtStart) ;
|
||||
SetFlag( 0) ;
|
||||
@@ -2628,14 +2662,14 @@ SawFinishing::CalcCurvedAlongZigZagCut( const ICurve* pCut, const Vector3d& vtTo
|
||||
if ( AddLinearMove( ptNewStart) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se il precedente è più fuori
|
||||
// se il precedente è più fuori
|
||||
else if ( dDiff > 0) {
|
||||
// allungo nuova passata
|
||||
SetFeed( ( bVert ? GetVertFeed() : GetFeed())) ;
|
||||
if ( AddLinearMove( ptNewStart - dDiff * vtDirStart) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se il corrente è più fuori
|
||||
// se il corrente è più fuori
|
||||
else {
|
||||
// allungo passata precedente
|
||||
if ( AddLinearMove( ptLast + dDiff * vtDirStart) == GDB_ID_NULL)
|
||||
@@ -2647,7 +2681,7 @@ SawFinishing::CalcCurvedAlongZigZagCut( const ICurve* pCut, const Vector3d& vtTo
|
||||
}
|
||||
}
|
||||
}
|
||||
// se non ci sono già, vado all'inizio dell'arco
|
||||
// se non ci sono già, vado all'inizio dell'arco
|
||||
if ( ! SameAsCurrPos( ptStart) && AddLinearMove( ptStart) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// 3 -> movimento di lato al punto finale
|
||||
@@ -2693,7 +2727,7 @@ SawFinishing::CalcCurvedAcrossZigZagCut( const PolyLine& PL, const Vector3d& vtM
|
||||
bool bFirst, bool bCorner)
|
||||
{
|
||||
// recupero distanza di sicurezza
|
||||
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
|
||||
double dSafeZ = GetSafeZ() ;
|
||||
// lunghezza di approccio/retrazione
|
||||
double dAppr = m_Params.m_dStartPos ;
|
||||
|
||||
@@ -2809,7 +2843,7 @@ SawFinishing::AddCornerApproach( const Point3d& ptP, const Vector3d& vtCorr, con
|
||||
{
|
||||
// impongo minima distanza di approccio
|
||||
dAppr = max( dAppr, 1.0) ;
|
||||
// recupero posizione precedente (correzione precedente è passata perchè già impostata la nuova)
|
||||
// recupero posizione precedente (correzione precedente è passata perchè già impostata la nuova)
|
||||
Point3d ptPrev ;
|
||||
if ( ! GetCurrPos( ptPrev))
|
||||
return false ;
|
||||
@@ -2920,7 +2954,7 @@ SawFinishing::GetHeightOnSection( const ICurve* pSect, double dX, double dYmin,
|
||||
dY = aInfo.IciA[0].ptI.y ;
|
||||
return true ;
|
||||
}
|
||||
// se non c'è intersezione assegno il minimo
|
||||
// se non c'è intersezione assegno il minimo
|
||||
dY = dYmin ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
+9
-3
@@ -38,8 +38,14 @@ class SawFinishing : public Machining
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_SAWFINISHING ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nCuts == 0) ; }
|
||||
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
|
||||
{ if ( m_nCuts == 0)
|
||||
return true ;
|
||||
if ( nEmptyType == NEED_ONE_TP_OK)
|
||||
return ( ! IsAtLeastOnePathOk()) ;
|
||||
if ( nEmptyType == NEED_ALL_TP_OK)
|
||||
return ( ! AreAllPathsOk()) ;
|
||||
return false ; }
|
||||
bool UpdateStatus( int nModif) override
|
||||
{ m_nStatus |= nModif ; return true ; }
|
||||
|
||||
@@ -62,7 +68,7 @@ class SawFinishing : public Machining
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool UpdateToolData( bool* pbChanged = nullptr) override ;
|
||||
bool UpdateToolData( void) override ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
|
||||
|
||||
+6
-2
@@ -81,6 +81,10 @@ struct SawFinishingData : public MachiningData
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline const SawFinishingData* GetSawFinishingData( const MachiningData* pMdata)
|
||||
{ return (dynamic_cast<const SawFinishingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWFINISHING)
|
||||
return nullptr ;
|
||||
return ( static_cast<const SawFinishingData*>( pMdata)) ; }
|
||||
inline SawFinishingData* GetSawFinishingData( MachiningData* pMdata)
|
||||
{ return (dynamic_cast<SawFinishingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWFINISHING)
|
||||
return nullptr ;
|
||||
return ( static_cast<SawFinishingData*>( pMdata)) ; }
|
||||
|
||||
+922
-228
File diff suppressed because it is too large
Load Diff
+21
-10
@@ -38,8 +38,14 @@ class SawRoughing : public Machining
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_SAWROUGHING ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nCuts == 0) ; }
|
||||
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
|
||||
{ if ( m_nCuts == 0)
|
||||
return true ;
|
||||
if ( nEmptyType == NEED_ONE_TP_OK)
|
||||
return ( ! IsAtLeastOnePathOk()) ;
|
||||
if ( nEmptyType == NEED_ALL_TP_OK)
|
||||
return ( ! AreAllPathsOk()) ;
|
||||
return false ; }
|
||||
bool UpdateStatus( int nModif) override
|
||||
{ m_nStatus |= nModif ; return true ; }
|
||||
|
||||
@@ -62,7 +68,7 @@ class SawRoughing : public Machining
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool UpdateToolData( bool* pbChanged = nullptr) override ;
|
||||
bool UpdateToolData( void) override ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
|
||||
@@ -73,19 +79,24 @@ class SawRoughing : public Machining
|
||||
bool VerifyGeometry( SelData Id, int& nSubs) ;
|
||||
ICurve* GetCurve( SelData Id) ;
|
||||
bool AdjustGeometry( int nAuxId) ;
|
||||
bool CalculateToolPath( int nAuxId, int nClId) ;
|
||||
bool CalculateToolPath( int nAuxId, int nPvId, int nClId) ;
|
||||
bool CalculateCurvedToolPath( int nAuxId, int nClId) ;
|
||||
bool GeneratePreView( int nPathId, const ICurve* pSect, const Frame3d& frSect, double dGuideLen,
|
||||
const Vector3d& vtGdDir, const BBox3d& b3Raw) ;
|
||||
bool CalculateSection( int nSectGrpId, ICurve*& pSect) ;
|
||||
bool TrimSection( ICurve* pCrv) ;
|
||||
bool CalculateGuideLine( int nGuideId, const BBox3d& b3Sect,
|
||||
Point3d& ptGdStart, Point3d& ptGdEnd, Vector3d& vtGdDir) ;
|
||||
bool CalculateGuideLine( int nGuideId, const BBox3d& b3Sect, Point3d& ptGdStart, Point3d& ptGdEnd, Vector3d& vtGdDir) ;
|
||||
bool AdaptGuideLineToRaw( Point3d& ptGdStart, Point3d& ptGdEnd, const Vector3d& vtGdDir, const BBox3d& b3Raw) const ;
|
||||
bool CalculateOneWayCut( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtDir,
|
||||
const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bFirst, bool bLast) ;
|
||||
const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bFirst, bool bLast, const BBox3d& b3Raw) ;
|
||||
bool CalculateZigZagCut( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtDir,
|
||||
const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bFirst, bool bLast,
|
||||
int& nCount) ;
|
||||
int& nCount, const BBox3d& b3Raw) ;
|
||||
bool CalculateZConstCut( const ICurve* pCrv, double dXmin, double dXmax, bool bIncludeMax, bool bIncludeMin,
|
||||
const Point3d& ptGdStart, const Point3d& ptGdEnd, const Vector3d& vtGdDir, const Frame3d& frSect,
|
||||
const BBox3d& b3Raw, double dDepth, bool bFirstInterval, bool bLastInterval, int& nCount) ;
|
||||
bool CalculateCurvedZigZagCut( const ICurve* pCut, const Vector3d& vtTool, double dElev, bool bFirst, bool bLast,
|
||||
int& nCount) ;
|
||||
int& nCount) ;
|
||||
bool AddApproach( const Point3d& ptP, const Vector3d& vtCorr, bool bFirst,
|
||||
double dSafeZ, double dElev, double dAppr) ;
|
||||
bool AddRetract( const Point3d& ptP, const Vector3d& vtCorr, double dSafeZ, double dElev, double dAppr) ;
|
||||
@@ -112,7 +123,7 @@ class SawRoughing : public Machining
|
||||
{ return ( IsUnknownValue( m_Params.m_dOffsR) ? m_TParams.m_dOffsR : m_Params.m_dOffsR) ; }
|
||||
|
||||
private :
|
||||
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
|
||||
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
|
||||
bool m_bStraight ; // flag per cornici diritte/curve
|
||||
SawRoughingData m_Params ; // parametri lavorazione
|
||||
ToolData m_TParams ; // parametri utensile
|
||||
|
||||
+6
-2
@@ -78,6 +78,10 @@ struct SawRoughingData : public MachiningData
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline const SawRoughingData* GetSawRoughingData( const MachiningData* pMdata)
|
||||
{ return (dynamic_cast<const SawRoughingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWROUGHING)
|
||||
return nullptr ;
|
||||
return ( static_cast<const SawRoughingData*>( pMdata)) ; }
|
||||
inline SawRoughingData* GetSawRoughingData( MachiningData* pMdata)
|
||||
{ return (dynamic_cast<SawRoughingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWROUGHING)
|
||||
return nullptr ;
|
||||
return ( static_cast<SawRoughingData*>( pMdata)) ; }
|
||||
|
||||
+299
-122
@@ -4,7 +4,7 @@
|
||||
// File : Sawing.cpp Data : 24.10.15 Versione : 1.6j3
|
||||
// Contenuto : Implementazione gestione tagli con lama.
|
||||
//
|
||||
// Note : Questa lavorazione è sempre espressa nel riferimento globale.
|
||||
// Note : Questa lavorazione è sempre espressa nel riferimento globale.
|
||||
//
|
||||
// Modifiche : 07.06.15 DS Creazione modulo.
|
||||
//
|
||||
@@ -16,7 +16,9 @@
|
||||
#include "MachMgr.h"
|
||||
#include "DllMain.h"
|
||||
#include "Sawing.h"
|
||||
#include "GeoConst.h"
|
||||
#include "OperationConst.h"
|
||||
#include "OperUserNotesConst.h"
|
||||
#include "/EgtDev/Include/EXeCmdLogOff.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
@@ -55,6 +57,7 @@ using namespace std ;
|
||||
// 2217 = "Error in Sawing : link movements not calculable"
|
||||
// 2218 = "Error in Sawing : link outstroke xxx"
|
||||
// 2219 = "Error in Sawing : post apply not calculable"
|
||||
// 2220 = "Error in Sawing : special apply not calculable"
|
||||
// 2251 = "Warning in Sawing : Skipped entity xxx"
|
||||
// 2252 = "Warning in Sawing : No machinable path"
|
||||
// 2253 = "Warning in Sawing : Tool name changed (xx)"
|
||||
@@ -98,6 +101,7 @@ Sawing::Clone( void) const
|
||||
pSaw->m_nPhase = m_nPhase ;
|
||||
pSaw->m_Params = m_Params ;
|
||||
pSaw->m_TParams = m_TParams ;
|
||||
pSaw->m_bDownSE = m_bDownSE ;
|
||||
pSaw->m_nStatus = m_nStatus ;
|
||||
pSaw->m_nCuts = m_nCuts ;
|
||||
}
|
||||
@@ -211,6 +215,7 @@ Sawing::Sawing( void)
|
||||
m_Params.m_sToolName = "*" ;
|
||||
m_TParams.m_sName = "*" ;
|
||||
m_TParams.m_sHead = "*" ;
|
||||
m_bDownSE = false ;
|
||||
m_nStatus = MCH_ST_TO_VERIFY ;
|
||||
m_nCuts = 0 ;
|
||||
}
|
||||
@@ -532,15 +537,16 @@ Sawing::SetParam( int nType, const string& sVal)
|
||||
bool
|
||||
Sawing::SetGeometry( const SELVECTOR& vIds)
|
||||
{
|
||||
// verifico validità gestore DB geometrico
|
||||
// verifico validità gestore DB geometrico
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// reset della geometria corrente
|
||||
// copia temporanea e reset della geometria corrente
|
||||
SELVECTOR vOldId = m_vId ;
|
||||
m_vId.clear() ;
|
||||
// verifico che gli identificativi rappresentino delle entità ammissibili
|
||||
// verifico che gli identificativi rappresentino delle entità ammissibili
|
||||
int nType = GEO_NONE ;
|
||||
for ( const auto& Id : vIds) {
|
||||
// test sull'entità
|
||||
// test sull'entità
|
||||
int nSubs ;
|
||||
if ( ! VerifyGeometry( Id, nSubs, nType)) {
|
||||
string sInfo = "Warning in Sawing : Skipped entity " + ToString( Id) ;
|
||||
@@ -551,7 +557,8 @@ Sawing::SetGeometry( const SELVECTOR& vIds)
|
||||
m_vId.emplace_back( Id) ;
|
||||
}
|
||||
// aggiorno lo stato
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
if ( m_vId != vOldId)
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
// restituisco presenza geometria da lavorare
|
||||
return ( ! m_vId.empty() || vIds.empty()) ;
|
||||
}
|
||||
@@ -563,14 +570,14 @@ Sawing::Preview( bool bRecalc)
|
||||
// reset numero tagli nella lavorazione
|
||||
m_nCuts = 0 ;
|
||||
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
|
||||
return false ;
|
||||
|
||||
// recupero gruppo per geometria ausiliaria
|
||||
int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ;
|
||||
bool bChain = false ;
|
||||
// se non c'è, lo aggiungo
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nAuxId == GDB_ID_NULL) {
|
||||
nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nAuxId == GDB_ID_NULL)
|
||||
@@ -603,7 +610,7 @@ Sawing::Preview( bool bRecalc)
|
||||
|
||||
// recupero gruppo per anteprima di lavorazione (PreView)
|
||||
int nPvId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_PV) ;
|
||||
// se non c'è, lo aggiungo
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nPvId == GDB_ID_NULL) {
|
||||
nPvId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nPvId == GDB_ID_NULL)
|
||||
@@ -633,26 +640,30 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
|
||||
int nCurrCuts = m_nCuts ;
|
||||
m_nCuts = 0 ;
|
||||
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
|
||||
return false ;
|
||||
|
||||
// aggiorno dati geometrici dell'utensile
|
||||
bool bToolChanged = true ;
|
||||
if ( ! UpdateToolData( &bToolChanged)) {
|
||||
if ( ! UpdateToolData()) {
|
||||
m_pMchMgr->SetLastError( 2201, "Error in Sawing : UpdateToolData failed") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// se modificata geometria, necessario ricalcolo
|
||||
if ( ( m_nStatus & MCH_ST_GEO_MODIF) != 0)
|
||||
bRecalc = true ;
|
||||
|
||||
// verifico se necessario continuare nell'aggiornamento
|
||||
if ( ! bRecalc && ! bToolChanged &&
|
||||
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
|
||||
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
// confermo i percorsi di lavorazione
|
||||
m_nCuts = nCurrCuts ;
|
||||
LOG_DBG_INFO( GetEMkLogger(), "Sawing apply skipped : status already ok") ;
|
||||
string sLog = string( "Sawing apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ;
|
||||
LOG_DBG_INFO( GetEMkLogger(), sLog.c_str()) ;
|
||||
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
|
||||
if ( ! Update( bPostApply))
|
||||
return false ;
|
||||
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
|
||||
LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
|
||||
// esco con successo
|
||||
return true ;
|
||||
@@ -662,7 +673,7 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
|
||||
// recupero gruppo per geometria ausiliaria
|
||||
int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ;
|
||||
bool bChain = false ;
|
||||
// se non c'è, lo aggiungo
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nAuxId == GDB_ID_NULL) {
|
||||
nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nAuxId == GDB_ID_NULL)
|
||||
@@ -687,9 +698,14 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
|
||||
if ( ! VerifySideAngle())
|
||||
return false ;
|
||||
|
||||
// verifiche per attacchi/uscite senza approcci e retrazioni
|
||||
int nDownSE = 0 ;
|
||||
GetValInNotes( m_Params.m_sUserNotes, UN_DOWNSE, nDownSE) ;
|
||||
m_bDownSE = ( nDownSE != 0 && m_Params.m_nStepType == SAW_ST_TOANDFROM) ;
|
||||
|
||||
// recupero gruppo per geometria di lavorazione (Cutter Location)
|
||||
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
|
||||
// se non c'è, lo aggiungo
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nClId == GDB_ID_NULL) {
|
||||
nClId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nClId == GDB_ID_NULL)
|
||||
@@ -732,7 +748,7 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
|
||||
bool
|
||||
Sawing::Update( bool bPostApply)
|
||||
{
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
|
||||
return false ;
|
||||
|
||||
@@ -742,6 +758,9 @@ Sawing::Update( bool bPostApply)
|
||||
return true ;
|
||||
}
|
||||
|
||||
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
|
||||
RemoveClimbRiseHome() ;
|
||||
|
||||
// imposto eventuale asse bloccato da lavorazione
|
||||
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
|
||||
|
||||
@@ -764,6 +783,16 @@ Sawing::Update( bool bPostApply)
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni speciali
|
||||
string sSpecErr ;
|
||||
if ( bPostApply && ! SpecialApply( sSpecErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sSpecErr))
|
||||
m_pMchMgr->SetLastError( 2220, sSpecErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2220, "Error in Sawing : special apply not calculable") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
|
||||
if ( ! AdjustStartEndMovements()) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
@@ -774,11 +803,11 @@ Sawing::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// esecuzione eventuali personalizzazioni
|
||||
string sErr ;
|
||||
if ( bPostApply && ! PostApply( sErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sErr))
|
||||
m_pMchMgr->SetLastError( 2219, sErr) ;
|
||||
// esecuzione eventuali personalizzazioni finali
|
||||
string sPostErr ;
|
||||
if ( bPostApply && ! PostApply( sPostErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sPostErr))
|
||||
m_pMchMgr->SetLastError( 2219, sPostErr) ;
|
||||
else
|
||||
m_pMchMgr->SetLastError( 2219, "Error in Sawing : post apply not calculable") ;
|
||||
return false ;
|
||||
@@ -791,7 +820,7 @@ Sawing::Update( bool bPostApply)
|
||||
bool
|
||||
Sawing::AdjustFeeds( void)
|
||||
{
|
||||
// controlli su GeomDB e simili non ripetuti perchè già fatti
|
||||
// controlli su GeomDB e simili non ripetuti perchè già fatti
|
||||
|
||||
// recupero gruppo della geometria di lavorazione (Cutter Location)
|
||||
int nClId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_CL) ;
|
||||
@@ -801,11 +830,11 @@ Sawing::AdjustFeeds( void)
|
||||
// ciclo sui gruppi CL
|
||||
int nClPathId = m_pGeomDB->GetFirstGroupInGroup( nClId) ;
|
||||
while ( nClPathId != GDB_ID_NULL) {
|
||||
// ciclo su tutte le entità del percorso CL
|
||||
// ciclo su tutte le entità del percorso CL
|
||||
for ( int nEntId = m_pGeomDB->GetFirstInGroup( nClPathId) ;
|
||||
nEntId != GDB_ID_NULL ;
|
||||
nEntId = m_pGeomDB->GetNext( nEntId)) {
|
||||
// recupero i dati Cam dell'entità
|
||||
// recupero i dati Cam dell'entità
|
||||
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
|
||||
if ( pCamData == nullptr)
|
||||
continue ;
|
||||
@@ -1015,7 +1044,7 @@ Sawing::GetToolData( void) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Sawing::UpdateToolData( bool* pbChanged)
|
||||
Sawing::UpdateToolData( void)
|
||||
{
|
||||
// recupero il gestore DB utensili della macchina corrente
|
||||
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
|
||||
@@ -1062,9 +1091,9 @@ Sawing::UpdateToolData( bool* pbChanged)
|
||||
m_Params.m_sToolName + ")" ;
|
||||
m_pMchMgr->SetWarning( 2254, sInfo) ;
|
||||
}
|
||||
// se definito parametro di ritorno, lo assegno
|
||||
if ( pbChanged != nullptr)
|
||||
*pbChanged = bChanged ;
|
||||
// se modificato, aggiusto lo stato
|
||||
if ( bChanged)
|
||||
m_nStatus = MCH_ST_TO_VERIFY ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -1072,7 +1101,7 @@ Sawing::UpdateToolData( bool* pbChanged)
|
||||
bool
|
||||
Sawing::GetGeometry( SELVECTOR& vIds) const
|
||||
{
|
||||
// restituisco l'elenco delle entità
|
||||
// restituisco l'elenco delle entità
|
||||
vIds = m_vId ;
|
||||
return true ;
|
||||
}
|
||||
@@ -1095,7 +1124,7 @@ Sawing::VerifyGeometry( SelData Id, int& nSubs, int& nType)
|
||||
const IGeoObj* pGObj = m_pGeomDB->GetGeoObj( Id.nId) ;
|
||||
if ( pGObj == nullptr)
|
||||
return false ;
|
||||
// se ammesse curve ed è tale
|
||||
// se ammesse curve ed è tale
|
||||
if ( ( nType == GEO_NONE || nType == GEO_CURVE) && ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
nType = GEO_CURVE ;
|
||||
const ICurve* pCurve = nullptr ;
|
||||
@@ -1119,7 +1148,7 @@ Sawing::VerifyGeometry( SelData Id, int& nSubs, int& nType)
|
||||
}
|
||||
return ( pCurve != nullptr) ;
|
||||
}
|
||||
// se altrimenti ammesse superfici trimesh ed è tale
|
||||
// se altrimenti ammesse superfici trimesh ed è tale
|
||||
else if ( ( nType == GEO_NONE || nType == GEO_SURF) && pGObj->GetType() == SRF_TRIMESH) {
|
||||
nType = GEO_SURF ;
|
||||
const ISurfTriMesh* pSurf = ::GetSurfTriMesh( pGObj) ;
|
||||
@@ -1139,7 +1168,7 @@ Sawing::VerifyGeometry( SelData Id, int& nSubs, int& nType)
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
// se altrimenti ammesse regioni ed è tale
|
||||
// se altrimenti ammesse regioni ed è tale
|
||||
else if ( ( nType == GEO_NONE || nType == GEO_SURF) && pGObj->GetType() == SRF_FLATRGN) {
|
||||
nType = GEO_SURF ;
|
||||
const ISurfFlatRegion* pReg = ::GetSurfFlatRegion( pGObj) ;
|
||||
@@ -1242,7 +1271,7 @@ Sawing::GetCurve( SelData Id)
|
||||
pCrvCompo->ToGlob( frGlob) ;
|
||||
vtN.ToGlob( frGlob) ;
|
||||
// sistemazioni varie
|
||||
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, 0, 1) ;
|
||||
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, V_NULL, {}, 0, 1) ;
|
||||
// aggiusto lato lavoro e inverti, angolo di fianco e lato mandrino
|
||||
if ( m_Params.m_nWorkSide == SAW_WS_CENTER)
|
||||
m_Params.m_nWorkSide = SAW_WS_RIGHT ;
|
||||
@@ -1276,8 +1305,8 @@ Sawing::GetCurve( SelData Id)
|
||||
// recupero l'indice del chunk
|
||||
int nChunk = ( ( Id.nSub == SEL_SUB_ALL) ? 0 : Id.nSub) ;
|
||||
// recupero il contorno esterno del chunk
|
||||
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCrvCompo) || ! pCrvCompo->AddCurve( pReg->GetLoop( nChunk, 0)))
|
||||
PtrOwner<ICurveComposite> pCrvCompo ;
|
||||
if ( ! pCrvCompo.Set( ConvertCurveToComposite( pReg->GetLoop( nChunk, 0))))
|
||||
return nullptr ;
|
||||
// recupero la normale della regione
|
||||
Vector3d vtN = pReg->GetNormVersor() ;
|
||||
@@ -1291,7 +1320,7 @@ Sawing::GetCurve( SelData Id)
|
||||
pCrvCompo->ToGlob( frGlob) ;
|
||||
vtN.ToGlob( frGlob) ;
|
||||
// sistemazioni varie
|
||||
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, 0, 1) ;
|
||||
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, V_NULL, {}, 0, 1) ;
|
||||
// aggiusto lato lavoro e inverti, angolo di fianco e lato mandrino
|
||||
if ( m_Params.m_nWorkSide == SAW_WS_CENTER)
|
||||
m_Params.m_nWorkSide = SAW_WS_RIGHT ;
|
||||
@@ -1332,7 +1361,7 @@ Sawing::Chain( int nGrpDestId)
|
||||
for ( const auto& Id : m_vId) {
|
||||
// prendo curva
|
||||
vpCrvs.emplace_back( GetCurve( Id)) ;
|
||||
// ne verifico la validità
|
||||
// ne verifico la validità
|
||||
if ( IsNull( vpCrvs.back())) {
|
||||
string sInfo = "Warning in Sawing : Skipped entity " + ToString( Id) ;
|
||||
m_pMchMgr->SetWarning( 2251, sInfo) ;
|
||||
@@ -1474,7 +1503,7 @@ Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
// recupero gruppo per geometria temporanea
|
||||
const string GRP_TEMP = "Temp" ;
|
||||
int nTempId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, GRP_TEMP) ;
|
||||
// se non c'è, lo aggiungo
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nTempId == GDB_ID_NULL) {
|
||||
nTempId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nTempId == GDB_ID_NULL)
|
||||
@@ -1539,7 +1568,7 @@ Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
// elaboro la curva composita e la esplodo nelle curve componenti
|
||||
if ( m_Params.m_nCurveUse == SAW_CRV_APPROX ||
|
||||
m_Params.m_nCurveUse == SAW_CRV_CONVEX) {
|
||||
// calcolo l'approssimazione lineare con eventuale convessità
|
||||
// calcolo l'approssimazione lineare con eventuale convessità
|
||||
PolyLine PL ;
|
||||
int nType = ICurve::APL_STD ;
|
||||
if ( m_Params.m_nWorkSide == SAW_WS_LEFT)
|
||||
@@ -1574,6 +1603,15 @@ Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
double dThick ;
|
||||
pCompo->GetThickness( dThick) ;
|
||||
|
||||
// aggiusto eventuali normali inverse di archi rispetto ad estrusione
|
||||
const ICurve* pCrv = pCompo->GetFirstCurve() ;
|
||||
while ( pCrv != nullptr) {
|
||||
const ICurveArc* pArc = GetCurveArc( pCrv) ;
|
||||
if ( pArc != nullptr && pArc->GetNormVersor() * vtExtr < 0)
|
||||
const_cast<ICurveArc*>(pArc)->InvertN() ;
|
||||
pCrv = pCompo->GetNextCurve() ;
|
||||
}
|
||||
|
||||
// recupero distanza da fondo dei grezzi interessati dal percorso
|
||||
double dRbDist, dAllRbDist ;
|
||||
double dToler = 2 * m_TParams.m_dThick + tan( abs( m_Params.m_dSideAngle) * DEGTORAD) * m_TParams.m_dMaxMat ;
|
||||
@@ -1628,7 +1666,7 @@ Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
// flag di curva chiusa
|
||||
bool bClosed = pCompo->IsClosed() ;
|
||||
|
||||
// calcolo gli eventuali punti di perdita di tangenza e di cambio di concavità
|
||||
// calcolo gli eventuali punti di perdita di tangenza e di cambio di concavità
|
||||
DBLVECTOR vU ;
|
||||
const double ANG_PERD_TG = 1.0 ;
|
||||
const ICurveArc* pArc = ( bClosed ? GetCurveArc( pCompo->GetLastCurve()) : nullptr) ;
|
||||
@@ -1644,7 +1682,7 @@ Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
nCurrConv = 0 ;
|
||||
continue ;
|
||||
}
|
||||
// verifico cambio di concavità e/o lavorazione interna
|
||||
// verifico cambio di concavità e/o lavorazione interna
|
||||
const ICurve* pCrv = pCompo->GetCurve( i) ;
|
||||
if ( pCrv->GetType() == CRV_ARC) {
|
||||
if ( GetCurveArc( pCrv)->GetAngCenter() > 0) {
|
||||
@@ -1726,7 +1764,7 @@ Sawing::ProcessEntity( const ICurve* pCrvP, const ICurve* pCrvC, const ICurve* p
|
||||
// altrimenti
|
||||
else {
|
||||
if ( m_Params.m_nCurveUse == SAW_CRV_KEEP) {
|
||||
// determino la convessità
|
||||
// determino la convessità
|
||||
int nConv = 0 ;
|
||||
for ( int i = 0 ; i < pCompo->GetCurveCount() ; ++ i) {
|
||||
const ICurveArc* pArc = GetCurveArc( pCompo->GetCurve( i)) ;
|
||||
@@ -1827,7 +1865,7 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve
|
||||
( m_Params.m_nWorkSide == SAW_WS_RIGHT && dAngCN < - EPS_ANG_SMALL))
|
||||
bExtAngCN = false ;
|
||||
}
|
||||
// verifico eventuale attacco speciale a step (se parametri validi e su entità linea singola)
|
||||
// verifico eventuale attacco speciale a step (se parametri validi e su entità linea singola)
|
||||
double dLiStep = 0 ;
|
||||
double dLiElev = 0 ;
|
||||
if ( m_Params.m_dLiTang > 10 * EPS_SMALL && m_Params.m_dLiElev > 10 * EPS_SMALL &&
|
||||
@@ -1848,38 +1886,38 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve
|
||||
return true ;
|
||||
}
|
||||
|
||||
// Eventuale variazioni di velocità all'inizio e alla fine del percorso
|
||||
// Eventuale variazioni di velocità all'inizio e alla fine del percorso
|
||||
FseVar FvVar ;
|
||||
if ( pCrvP == nullptr) {
|
||||
string sFsta = ExtractInfo( m_Params.m_sUserNotes, "Fsta=") ;
|
||||
if ( ! sFsta.empty()) {
|
||||
string sFsta ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_FSTA, sFsta)) {
|
||||
string sLen, sPu ;
|
||||
SplitFirst( sFsta, ",", sLen, sPu) ;
|
||||
FromString( sLen, FvVar.dLenStart) ;
|
||||
FvVar.dLenStart = max( FvVar.dLenStart, 0.) ;
|
||||
FromString( sPu, FvVar.dPuStart) ;
|
||||
FvVar.dPuStart = max( FvVar.dPuStart, 0.) ;
|
||||
if ( FromString( sLen, FvVar.dLenStart))
|
||||
FvVar.dLenStart = max( FvVar.dLenStart, 0.) ;
|
||||
if ( FromString( sPu, FvVar.dPuStart))
|
||||
FvVar.dPuStart = max( FvVar.dPuStart, 0.) ;
|
||||
}
|
||||
}
|
||||
if ( pCrvN == nullptr) {
|
||||
string sFend = ExtractInfo( m_Params.m_sUserNotes, "Fend=") ;
|
||||
if ( ! sFend.empty()) {
|
||||
string sFend ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_FEND, sFend)) {
|
||||
string sLen, sPu ;
|
||||
SplitFirst( sFend, ",", sLen, sPu) ;
|
||||
FromString( sLen, FvVar.dLenEnd) ;
|
||||
FvVar.dLenEnd = max( FvVar.dLenEnd, 0.) ;
|
||||
FromString( sPu, FvVar.dPuEnd) ;
|
||||
FvVar.dPuEnd = max( FvVar.dPuEnd, 0.) ;
|
||||
if ( FromString( sLen, FvVar.dLenEnd))
|
||||
FvVar.dLenEnd = max( FvVar.dLenEnd, 0.) ;
|
||||
if ( FromString( sPu, FvVar.dPuEnd))
|
||||
FvVar.dPuEnd = max( FvVar.dPuEnd, 0.) ;
|
||||
}
|
||||
}
|
||||
|
||||
// recupero eventuali estensioni dei baffi (whiskers)
|
||||
double dStartWhiskExt = 0 ;
|
||||
if ( m_Params.m_nLeadInType == SAW_LI_CENT)
|
||||
FromString( ExtractInfo( m_Params.m_sUserNotes, "SWE="), dStartWhiskExt) ;
|
||||
GetValInNotes( m_Params.m_sUserNotes, UN_SWE, dStartWhiskExt) ;
|
||||
double dEndWhiskExt = 0 ;
|
||||
if ( m_Params.m_nLeadOutType == SAW_LO_CENT)
|
||||
FromString( ExtractInfo( m_Params.m_sUserNotes, "EWE="), dEndWhiskExt) ;
|
||||
GetValInNotes( m_Params.m_sUserNotes, UN_EWE, dEndWhiskExt) ;
|
||||
|
||||
// Se richiesto Preview
|
||||
if ( nPvId != GDB_ID_NULL) {
|
||||
@@ -1915,6 +1953,14 @@ Sawing::GenerateLinePv( const ICurveLine* pLine, const Vector3d& vtTool, const V
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nPxId, sName) ;
|
||||
m_pGeomDB->SetMaterial( nPxId, BLUE) ;
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, Z_AX) ;
|
||||
// assegno i punti di inizio e fine al gruppo del percorso (tenendo conto degli allungamenti in vera lavorazione)
|
||||
Vector3d vtMidDir ; pLine->GetMidDir( vtMidDir) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_START, pLine->GetStart() - dStartWhiskExt * vtMidDir) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_END, pLine->GetEnd() + dEndWhiskExt * vtMidDir) ;
|
||||
// assegno l'elevazione massima
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_ELEV, dElev) ;
|
||||
|
||||
// punti notevoli
|
||||
Point3d ptIni = pLine->GetStart() + dElev * vtCorr ;
|
||||
@@ -1959,7 +2005,7 @@ Sawing::GenerateLinePv( const ICurveLine* pLine, const Vector3d& vtTool, const V
|
||||
m_pGeomDB->SetMaterial( nId3, BLUE) ;
|
||||
|
||||
// valore di allungamento
|
||||
double dExtraL = m_pMchMgr->GetCurrMachiningsMgr()->GetExtraLOnCutRegion() ;
|
||||
double dExtraL = GetExtraLOnCutRegion() ;
|
||||
|
||||
// punti notevoli per regioni
|
||||
Point3d ptRIni = ptIni ;
|
||||
@@ -1996,7 +2042,7 @@ Sawing::GenerateLinePv( const ICurveLine* pLine, const Vector3d& vtTool, const V
|
||||
ptREnd + vtDir * ( dDtEnd + dExtraL) , RTY_LOC) ;
|
||||
m_pGeomDB->SetName( nReId, MCH_PV_RLOCUT) ;
|
||||
m_pGeomDB->SetMaterial( nReId, INVISIBLE) ;
|
||||
|
||||
|
||||
// eventuali ripetizioni in basso per tagli inclinati
|
||||
if ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL) {
|
||||
// lunghezza movimento
|
||||
@@ -2054,6 +2100,23 @@ Sawing::GenerateLinePv( const ICurveLine* pLine, const Vector3d& vtTool, const V
|
||||
}
|
||||
}
|
||||
|
||||
// creo regioni di lavorazione che interessano le superfici superiore e inferiore del grezzo considerando anche gli
|
||||
// allungamenti dei baffi
|
||||
int nSurfUpId = ExeCreateSurfFrRectangle3P( nPxId, ptIni - vtDir * ( dStartWhiskExt + 5 * EPS_SMALL),
|
||||
ptCross + vtDir * ( dEndWhiskExt + 5 * EPS_SMALL),
|
||||
ptEnd + vtDir * ( dEndWhiskExt + 5 * EPS_SMALL), RTY_LOC) ;
|
||||
m_pGeomDB->SetName( nSurfUpId, MCH_PV_UP_RAWCUT) ;
|
||||
m_pGeomDB->SetMaterial( nSurfUpId, INVISIBLE) ;
|
||||
// solo se la lavorazione interessa il fondo del grezzo creo la superficie down
|
||||
if ( dRbHeight < EPS_SMALL) {
|
||||
int nSurfDownId = m_pGeomDB->CopyGlob( nSurfUpId, GDB_ID_NULL, nPxId) ;
|
||||
double dMove = dElev + dRbHeight / cos( m_Params.m_dSideAngle * DEGTORAD) ;
|
||||
Vector3d vtMove = - dMove * vtCorr ; vtMove.z = 0 ;
|
||||
ExeMove( {nSurfDownId}, vtMove, RTY_LOC) ;
|
||||
m_pGeomDB->SetName( nSurfDownId, MCH_PV_DOWN_RAWCUT) ;
|
||||
m_pGeomDB->SetMaterial( nSurfDownId, INVISIBLE) ;
|
||||
}
|
||||
|
||||
// salvo in info gruppo : larghezza XY del taglio, distanza XY tra centro e bordo taglio, extra taglio e quota minima della lama
|
||||
m_pGeomDB->SetInfo( nPxId, MCH_PV_KEY_WT, vtToolH.LenXY()) ;
|
||||
if ( dLiElev > EPS_SMALL)
|
||||
@@ -2078,7 +2141,7 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
|
||||
m_pGeomDB->SetName( nPxId, sName) ;
|
||||
m_pGeomDB->SetMaterial( nPxId, BLUE) ;
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, Vector3d( 0, 0, 1)) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, Z_AX) ;
|
||||
// assegno i punti di inizio e fine al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_START, pLine->GetStart()) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_END, pLine->GetEnd()) ;
|
||||
@@ -2092,7 +2155,7 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
|
||||
SetToolDir( vtTool) ;
|
||||
SetCorrAuxDir( vtCorr) ;
|
||||
// recupero distanza di sicurezza
|
||||
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
|
||||
double dSafeZ = GetSafeZ() ;
|
||||
// distanza di approccio/retrazione
|
||||
double dAppr = m_Params.m_dStartPos ;
|
||||
// flag di taglio inclinato
|
||||
@@ -2108,12 +2171,23 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
|
||||
}
|
||||
if ( dActBstep < EPS_SMALL)
|
||||
dActBstep = dActStep ;
|
||||
double dActLstep = GetStepLast() ;
|
||||
// direzione della linea
|
||||
Vector3d vtDir ; pLine->GetStartDir( vtDir) ;
|
||||
// parametri per partenza/arrivo a feed ridotta
|
||||
double dCutLen ; pLine->GetLength( dCutLen) ;
|
||||
double dStartFraz = FvVar.dLenStart / dCutLen ;
|
||||
double dEndFraz = FvVar.dLenEnd / dCutLen ;
|
||||
if ( dStartFraz + dEndFraz > 1) {
|
||||
dStartFraz /= ( dStartFraz + dEndFraz) ;
|
||||
dEndFraz = 1 - dStartFraz ;
|
||||
}
|
||||
double dMidFraz = 1 - dEndFraz ;
|
||||
|
||||
// Se una sola passata
|
||||
if ( dActStep < EPS_SMALL || ( dElev - dExtraCut) <= dActStep ||
|
||||
( ! bSideAng && m_Params.m_dStepLast > EPS_SMALL && ( dElev - dExtraCut) <= m_Params.m_dStepLast)) {
|
||||
if ( m_Params.m_nStepType != SAW_ST_TOANDFROM &&
|
||||
( dActStep < EPS_SMALL || ( dElev - dExtraCut) <= dActStep ||
|
||||
( ! bSideAng && dActLstep > EPS_SMALL && ( dElev - dExtraCut) <= dActLstep))) {
|
||||
// 1 -> approccio
|
||||
Point3d ptP1 = pLine->GetStart() - vtDir * m_Params.m_dLiTang ;
|
||||
if ( ! AddApproach( ptP1, vtCorr, dSafeZ, dElev, dAppr))
|
||||
@@ -2157,16 +2231,6 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
|
||||
}
|
||||
// 3 -> movimento di lato al punto finale
|
||||
if ( FvVar.dLenStart > EPS_SMALL || FvVar.dLenEnd > EPS_SMALL) {
|
||||
// lunghezza del taglio
|
||||
double dCutLen ; pLine->GetLength( dCutLen) ;
|
||||
double dStartFraz = FvVar.dLenStart / dCutLen ;
|
||||
double dEndFraz = FvVar.dLenEnd / dCutLen ;
|
||||
double dMidFraz = 1 - dEndFraz ;
|
||||
if ( dStartFraz + dEndFraz > 1) {
|
||||
dStartFraz /= ( dStartFraz + dEndFraz) ;
|
||||
dEndFraz = 1 - dStartFraz ;
|
||||
dMidFraz = dStartFraz ;
|
||||
}
|
||||
// punto finale
|
||||
Point3d ptP3 = pLine->GetEnd() ;
|
||||
// 3a -> eventuale movimento di lato a feed ridotta di inizio percorso
|
||||
@@ -2210,11 +2274,17 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
|
||||
int nStep = 2 ;
|
||||
if ( m_Params.m_nStepType == SAW_ST_ZIGZAG)
|
||||
nStep = 2 * static_cast<int>( ceil( dCutH / ( dActStep + dActBstep + EPS_SMALL))) ;
|
||||
else {
|
||||
if ( dActStep < EPS_SMALL)
|
||||
dActStep = dCutH / nStep ;
|
||||
if ( dActBstep < EPS_SMALL)
|
||||
dActBstep = dCutH / nStep ;
|
||||
}
|
||||
double dMeanStep = dCutH / nStep ;
|
||||
double dBstep = dActBstep * 2 * dMeanStep / ( dActStep + dActBstep) ;
|
||||
double dLastStep = dBstep ;
|
||||
if ( ! bSideAng && m_Params.m_dStepLast > EPS_SMALL) {
|
||||
dLastStep = m_Params.m_dStepLast ;
|
||||
if ( ! bSideAng && dActLstep > EPS_SMALL) {
|
||||
dLastStep = dActLstep ;
|
||||
double dCoeff = ( dCutH - dLastStep) / ( nStep / 2 * dActStep + ( nStep / 2 - 1) * dActBstep) ;
|
||||
dMeanStep = dCoeff * ( dActStep + dActBstep) / 2 ;
|
||||
dBstep = dCoeff * dActBstep ;
|
||||
@@ -2236,9 +2306,38 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
|
||||
if ( AddLinearMove( ptP2) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// movimento di lato
|
||||
SetFeed( ( ! bSideAng ? ( i == 0 ? GetBackFeed() : GetFeed()) : GetSideAngFeed())) ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
return false ;
|
||||
double dCurrFeed = ( ! bSideAng ? ( i == 0 ? GetBackFeed() : GetFeed()) : GetSideAngFeed()) ;
|
||||
if ( FvVar.dLenStart > EPS_SMALL || FvVar.dLenEnd > EPS_SMALL) {
|
||||
// scambio opportunamente le frazioni (dispari vanno, pari tornano)
|
||||
double dCurrStartFraz = dStartFraz ;
|
||||
double dCurrEndFraz = dEndFraz ;
|
||||
if ( IsEven( i))
|
||||
swap( dCurrStartFraz, dCurrEndFraz) ;
|
||||
double dCurrMidFraz = 1 - dCurrEndFraz ;
|
||||
// 3a -> eventuale movimento di lato a feed ridotta di inizio percorso
|
||||
if ( dCurrStartFraz * dCutLen > EPS_SMALL) {
|
||||
SetFeed( FvVar.dPuStart * dCurrFeed) ;
|
||||
if ( AddLinearMove( Media( ptP2, ptP3, dCurrStartFraz)) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// 3b -> eventuale movimento di lato a feed normale
|
||||
if ( ( dCurrMidFraz - dCurrStartFraz) * dCutLen > EPS_SMALL) {
|
||||
SetFeed( dCurrFeed) ;
|
||||
if ( AddLinearMove( Media( ptP2, ptP3, dCurrMidFraz)) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// 3c -> eventuale movimento di lato a feed ridotta di fine percorso
|
||||
if ( dCurrEndFraz * dCutLen > EPS_SMALL) {
|
||||
SetFeed( FvVar.dPuEnd * dCurrFeed) ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
SetFeed( dCurrFeed) ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// 4 -> retrazione
|
||||
if ( ! AddRetract( pLine->GetStart(), vtCorr, dSafeZ, dElev, dAppr))
|
||||
@@ -2256,8 +2355,8 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
|
||||
int nStep = static_cast<int>( ceil( dCutH / ( dActStep + EPS_SMALL))) ;
|
||||
double dStep = dCutH / nStep ;
|
||||
double dLastStep = dStep ;
|
||||
if ( ! bSideAng && m_Params.m_dStepLast > EPS_SMALL) {
|
||||
dLastStep = m_Params.m_dStepLast ;
|
||||
if ( ! bSideAng && dActLstep > EPS_SMALL) {
|
||||
dLastStep = dActLstep ;
|
||||
nStep = static_cast<int>( ceil( ( dCutH - dLastStep) / ( dActStep + EPS_SMALL))) + 1 ;
|
||||
dStep = ( dCutH - dLastStep) / ( nStep - 1) ;
|
||||
}
|
||||
@@ -2272,21 +2371,43 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
|
||||
if ( AddLinearMove( ptP2) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// movimento di lato al punto finale
|
||||
SetFeed( ( ! bSideAng ? GetFeed() : GetSideAngFeed())) ;
|
||||
double dCurrFeed = ( ! bSideAng ? GetFeed() : GetSideAngFeed()) ;
|
||||
Point3d ptP3 = pLine->GetEnd() + vtCorr * dDelta ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// se non è ultimo passo
|
||||
if ( FvVar.dLenStart > EPS_SMALL || FvVar.dLenEnd > EPS_SMALL) {
|
||||
// 3a -> eventuale movimento di lato a feed ridotta di inizio percorso
|
||||
if ( dStartFraz * dCutLen > EPS_SMALL) {
|
||||
SetFeed( FvVar.dPuStart * dCurrFeed) ;
|
||||
if ( AddLinearMove( Media( ptP2, ptP3, dStartFraz)) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// 3b -> eventuale movimento di lato a feed normale
|
||||
if ( ( dMidFraz - dStartFraz) * dCutLen > EPS_SMALL) {
|
||||
SetFeed( dCurrFeed) ;
|
||||
if ( AddLinearMove( Media( ptP2, ptP3, dMidFraz)) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// 3c -> eventuale movimento di lato a feed ridotta di fine percorso
|
||||
if ( dEndFraz * dCutLen > EPS_SMALL) {
|
||||
SetFeed( FvVar.dPuEnd * dCurrFeed) ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
SetFeed( dCurrFeed) ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se non è ultimo passo
|
||||
if ( i != 0) {
|
||||
// movimento di risalita sopra il punto finale
|
||||
SetFeed( GetEndFeed()) ;
|
||||
Point3d ptP4 = pLine->GetEnd() + vtCorr * ( dElev + dAppr / vtCorr.z) ;
|
||||
if ( AddLinearMove( ptP4) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// movimento di ritorno spora il punto iniziale
|
||||
SetFeed( GetEndFeed()) ;
|
||||
// movimento di ritorno in rapido sopra il punto iniziale
|
||||
Point3d ptP5 = pLine->GetStart() + vtCorr * ( dElev + dAppr / vtCorr.z) ;
|
||||
if ( AddLinearMove( ptP5) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP5) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -2319,7 +2440,7 @@ Sawing::ProcessExtCurve( const ICurve* pCrvP, const ICurveComposite* pCrvC, cons
|
||||
dMinRad = dRad ;
|
||||
}
|
||||
}
|
||||
if ( dMinRad < m_pMchMgr->GetCurrMachiningsMgr()->GetExtSawArcMinRad()) {
|
||||
if ( dMinRad < GetExtSawArcMinRad()) {
|
||||
m_pMchMgr->SetWarning( 2258, "Warning in Sawing : Radius too small in ExtSawArc") ;
|
||||
return true ;
|
||||
}
|
||||
@@ -2463,6 +2584,15 @@ Sawing::GenerateExtCurvePv( const ICurveComposite* pCrv, double dOffs,
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nPxId, sName) ;
|
||||
m_pGeomDB->SetMaterial( nPxId, BLUE) ;
|
||||
// assegno il vettore estrusione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, Z_AX) ;
|
||||
// assegno i punti di inizio e fine al gruppo del percorso
|
||||
Point3d ptStart ; pCrv->GetStartPoint( ptStart) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_START, ptStart) ;
|
||||
Point3d ptEnd ; pCrv->GetEndPoint( ptEnd) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_END, ptEnd) ;
|
||||
// assegno l'elevazione massima
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_ELEV, dElev) ;
|
||||
|
||||
// disabilito eventuale registrazione comandi EXE (riabilitazione automatica)
|
||||
CmdLogOff cmdLogOff ;
|
||||
@@ -2472,8 +2602,8 @@ Sawing::GenerateExtCurvePv( const ICurveComposite* pCrv, double dOffs,
|
||||
if ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL)
|
||||
colCut = FUCHSIA ;
|
||||
|
||||
// dimensione da aggiungere alle regioni nelle parti in cui la lama è inclinata
|
||||
double dExtraL = m_pMchMgr->GetCurrMachiningsMgr()->GetExtraLOnCutRegion() ;
|
||||
// dimensione da aggiungere alle regioni nelle parti in cui la lama è inclinata
|
||||
double dExtraL = GetExtraLOnCutRegion() ;
|
||||
|
||||
// lunghezza taglio parziale
|
||||
double dDeltaT = (( dElev < 0.5 * m_TParams.m_dDiam) ? sqrt( dElev * m_TParams.m_dDiam - dElev * dElev) : 0) ;
|
||||
@@ -2620,6 +2750,17 @@ Sawing::GenerateExtCurvePv( const ICurveComposite* pCrv, double dOffs,
|
||||
return false ;
|
||||
if ( ! ExeSurfFrAdd( nRId, nRsId) || ! ExeSurfFrAdd( nRId, nReId))
|
||||
return false ;
|
||||
|
||||
// creo regioni di lavorazione che interessano le superfici superiore e inferiore del grezzo
|
||||
int nSurfUpId = m_pGeomDB->CopyGlob( nRrId, GDB_ID_NULL, nPxId) ;
|
||||
m_pGeomDB->SetName( nSurfUpId, MCH_PV_UP_RAWCUT) ;
|
||||
m_pGeomDB->SetMaterial( nSurfUpId, INVISIBLE) ;
|
||||
// solo se lavorazione interessa il fondo del grezzo creo la superficie down
|
||||
if ( dRbHeight < EPS_SMALL) {
|
||||
int nSurfDownId = m_pGeomDB->CopyGlob( nSurfUpId, GDB_ID_NULL, nPxId) ;
|
||||
m_pGeomDB->SetName( nSurfDownId, MCH_PV_DOWN_RAWCUT) ;
|
||||
m_pGeomDB->SetMaterial( nSurfDownId, INVISIBLE) ;
|
||||
}
|
||||
}
|
||||
|
||||
// altrimenti errore
|
||||
@@ -2834,7 +2975,7 @@ Sawing::GenerateExtCurveCl( const ICurveComposite* pCrv,
|
||||
SetPathId( nPxId) ;
|
||||
SetCorrAuxDir( vtStaCorr) ;
|
||||
// recupero distanza di sicurezza
|
||||
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
|
||||
double dSafeZ = GetSafeZ() ;
|
||||
// lunghezza di approccio/retrazione
|
||||
double dAppr = m_Params.m_dStartPos ;
|
||||
|
||||
@@ -2865,7 +3006,7 @@ Sawing::GenerateExtCurveCl( const ICurveComposite* pCrv,
|
||||
CalculateToolAndCorrVersors( vtCurrDir, m_Params.m_nHeadSide, m_Params.m_nWorkSide, m_Params.m_dSideAngle, vtCurrTool, vtCurrCorr) ;
|
||||
SetToolDir( vtCurrTool) ;
|
||||
SetCorrAuxDir( vtCurrCorr) ;
|
||||
if ( AddCurveMove( pSmpCrv, true) == GDB_ID_NULL)
|
||||
if ( AddCurveMove( pSmpCrv) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// 4 -> retrazione
|
||||
@@ -2943,7 +3084,7 @@ Sawing::GenerateExtCurveCl( const ICurveComposite* pCrv,
|
||||
pCopy->SimpleOffset( dOffs) ;
|
||||
}
|
||||
// emissione
|
||||
if ( AddCurveMove( pCopy, true) == GDB_ID_NULL)
|
||||
if ( AddCurveMove( pCopy) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -2976,7 +3117,7 @@ Sawing::GenerateExtCurveCl( const ICurveComposite* pCrv,
|
||||
// inversione
|
||||
pCopy->Invert() ;
|
||||
// emissione
|
||||
if ( AddCurveMove( pCopy, true) == GDB_ID_NULL)
|
||||
if ( AddCurveMove( pCopy) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -3043,10 +3184,10 @@ Sawing::GenerateExtCurveCl( const ICurveComposite* pCrv,
|
||||
pCopy->SimpleOffset( dOffs) ;
|
||||
}
|
||||
// emissione
|
||||
if ( AddCurveMove( pCopy, true) == GDB_ID_NULL)
|
||||
if ( AddCurveMove( pCopy) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se non è ultimo passo
|
||||
// se non è ultimo passo
|
||||
if ( i != 0) {
|
||||
// ricavo punto di risalita e punto iniziale
|
||||
Point3d ptP4 ;
|
||||
@@ -3094,7 +3235,7 @@ Sawing::ProcessIntArc( const ICurve* pCrvP, const ICurveArc* pArcC, const ICurve
|
||||
if ( IsNull( pArc))
|
||||
return false ;
|
||||
// determino l'inclinazione per ottenere il raggio e ne verifico il limite
|
||||
double dMaxSideAng = m_pMchMgr->GetCurrMachiningsMgr()->GetIntSawArcMaxSideAng()+ EPS_ANG_SMALL ;
|
||||
double dMaxSideAng = GetIntSawArcMaxSideAng() + EPS_ANG_SMALL ;
|
||||
double dSawRad = m_TParams.m_dDiam / 2 ;
|
||||
double dRad = pArc->GetRadius() ;
|
||||
double dSinA = dSawRad / dRad ;
|
||||
@@ -3190,7 +3331,7 @@ Sawing::ProcessIntArc( const ICurve* pCrvP, const ICurveArc* pArcC, const ICurve
|
||||
m_pMchMgr->SetWarning( 2257, "Warning in Sawing : skipped Entity too small") ;
|
||||
return true ;
|
||||
}
|
||||
// ricalcolo i versori fresa alle estremità (potrebbero essere cambiate)
|
||||
// ricalcolo i versori fresa alle estremità (potrebbero essere cambiate)
|
||||
pArc->GetStartDir( vtStaDirC) ;
|
||||
pArc->GetMidDir( vtMidDirC) ;
|
||||
pArc->GetEndDir( vtEndDirC) ;
|
||||
@@ -3234,6 +3375,15 @@ Sawing::GenerateIntArcPv( const ICurveArc* pArc,
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nPxId, sName) ;
|
||||
m_pGeomDB->SetMaterial( nPxId, BLUE) ;
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, Z_AX) ;
|
||||
// assegno i punti di inizio e fine al gruppo del percorso
|
||||
Point3d ptStart ; pArc->GetStartPoint( ptStart) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_START, ptStart) ;
|
||||
Point3d ptEnd ; pArc->GetEndPoint( ptEnd) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_END, ptEnd) ;
|
||||
// assegno l'elevazione massima
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_ELEV, dElev) ;
|
||||
|
||||
// disabilito eventuale registrazione comandi EXE (riabilitazione automatica)
|
||||
CmdLogOff cmdLogOff ;
|
||||
@@ -3282,8 +3432,8 @@ Sawing::GenerateIntArcPv( const ICurveArc* pArc,
|
||||
m_pGeomDB->SetName( nId3, MCH_PV_POST_CUT) ;
|
||||
m_pGeomDB->SetMaterial( nId3, BLUE) ;
|
||||
|
||||
// dimensione da aggiungere alle regioni nelle parti in cui la lama è inclinata
|
||||
double dExtraL = m_pMchMgr->GetCurrMachiningsMgr()->GetExtraLOnCutRegion() ;
|
||||
// dimensione da aggiungere alle regioni nelle parti in cui la lama è inclinata
|
||||
double dExtraL = GetExtraLOnCutRegion() ;
|
||||
|
||||
// regione ridotta di taglio per nesting (escluse parti iniziali e finali)
|
||||
PtrOwner<ICurveComposite> pCmpRr( GenerateIntArcPvTrueCut( pArc, dDeltaInt, dDeltaExt, dExtraL)) ;
|
||||
@@ -3336,6 +3486,17 @@ Sawing::GenerateIntArcPv( const ICurveArc* pArc,
|
||||
if ( ! ExeSurfFrAdd( nRId, nRsId) || ! ExeSurfFrAdd( nRId, nReId))
|
||||
return false ;
|
||||
|
||||
// creo regioni di lavorazione che interessano le superfici superiore e inferiore del grezzo
|
||||
int nSurfUpId = m_pGeomDB->CopyGlob( nRrId, GDB_ID_NULL, nPxId) ;
|
||||
m_pGeomDB->SetName( nSurfUpId, MCH_PV_UP_RAWCUT) ;
|
||||
m_pGeomDB->SetMaterial( nSurfUpId, INVISIBLE) ;
|
||||
// solo se lavorazione interessa il fondo del grezzo creo la superficie down
|
||||
if ( dRbHeight < EPS_SMALL) {
|
||||
int nSurfDownId = m_pGeomDB->CopyGlob( nSurfUpId, GDB_ID_NULL, nPxId) ;
|
||||
m_pGeomDB->SetName( nSurfDownId, MCH_PV_DOWN_RAWCUT) ;
|
||||
m_pGeomDB->SetMaterial( nSurfDownId, INVISIBLE) ;
|
||||
}
|
||||
|
||||
// salvo in info gruppo : larghezza XY del taglio, distanza XY tra centro e bordo taglio, extra taglio e quota minima della lama
|
||||
m_pGeomDB->SetInfo( nPxId, MCH_PV_KEY_WT, dDeltaInt + dDeltaExt) ;
|
||||
m_pGeomDB->SetInfo( nPxId, MCH_PV_KEY_DT, dDeltaT * dLenCoeff) ;
|
||||
@@ -3530,7 +3691,7 @@ Sawing::GenerateIntArcCl( const ICurveArc* pArc,
|
||||
// Imposto dati comuni
|
||||
SetPathId( nPxId) ;
|
||||
// recupero distanza di sicurezza
|
||||
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
|
||||
double dSafeZ = GetSafeZ() ;
|
||||
// lunghezza di approccio/retrazione
|
||||
double dAppr = m_Params.m_dStartPos ;
|
||||
|
||||
@@ -3568,12 +3729,12 @@ Sawing::GenerateIntArcCl( const ICurveArc* pArc,
|
||||
else {
|
||||
Point3d ptMid ;
|
||||
pArc->GetMidPoint( ptMid) ;
|
||||
// prima metà arco
|
||||
// prima metà arco
|
||||
SetToolDir( vtMidTool) ;
|
||||
SetCorrAuxDir( vtMidCorr) ;
|
||||
if ( AddArcMove( ptMid, ptCen, dAngCen / 2, vtN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// seconda metà arco
|
||||
// seconda metà arco
|
||||
SetToolDir( vtEndTool) ;
|
||||
SetCorrAuxDir( vtEndCorr) ;
|
||||
if ( AddArcMove( ptP3, ptCen, dAngCen / 2, vtN) == GDB_ID_NULL)
|
||||
@@ -3654,12 +3815,12 @@ Sawing::GenerateIntArcCl( const ICurveArc* pArc,
|
||||
pArc->GetMidPoint( ptMid) ;
|
||||
ptMid += Z_AX * dDelta ;
|
||||
double dCurrAngCen = dAngCen / 2 * ((( i % 2) == 0) ? -1 : 1) ;
|
||||
// prima metà arco
|
||||
// prima metà arco
|
||||
SetToolDir( vtMidTool) ;
|
||||
SetCorrAuxDir( vtMidCorr) ;
|
||||
if ( AddArcMove( ptMid, ptCen, dCurrAngCen, vtN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// seconda metà arco
|
||||
// seconda metà arco
|
||||
SetToolDir( ( ( i % 2) == 0) ? vtStaTool : vtEndTool) ;
|
||||
SetCorrAuxDir( ( ( i % 2) == 0) ? vtStaCorr : vtEndCorr) ;
|
||||
if ( AddArcMove( ptP3, ptCen, dCurrAngCen, vtN) == GDB_ID_NULL)
|
||||
@@ -3743,18 +3904,18 @@ Sawing::GenerateIntArcCl( const ICurveArc* pArc,
|
||||
Point3d ptMid ;
|
||||
pArc->GetMidPoint( ptMid) ;
|
||||
ptMid += Z_AX * dDelta ;
|
||||
// prima metà arco
|
||||
// prima metà arco
|
||||
SetToolDir( vtMidTool) ;
|
||||
SetCorrAuxDir( vtMidCorr) ;
|
||||
if ( AddArcMove( ptMid, ptCen, dAngCen / 2, vtN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// seconda metà arco
|
||||
// seconda metà arco
|
||||
SetToolDir( vtEndTool) ;
|
||||
SetCorrAuxDir( vtEndCorr) ;
|
||||
if ( AddArcMove( ptP3, ptCen, dAngCen / 2, vtN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se non è ultimo passo
|
||||
// se non è ultimo passo
|
||||
if ( i != 0) {
|
||||
// movimento di risalita sopra il punto finale
|
||||
SetFeed( GetEndFeed()) ;
|
||||
@@ -3779,8 +3940,16 @@ Sawing::GenerateIntArcCl( const ICurveArc* pArc,
|
||||
bool
|
||||
Sawing::AddApproach( const Point3d& ptP, const Vector3d& vtCorr, double dSafeZ, double dElev, double dAppr)
|
||||
{
|
||||
// se distanza di sicurezza minore di distanza di inizio
|
||||
if ( dSafeZ < m_Params.m_dStartPos + 10 * EPS_SMALL) {
|
||||
// se abilitato approccio diretto fuori dal grezzo (solo per lavorazione ToAndFrom)
|
||||
if ( m_bDownSE) {
|
||||
// 1 -> punto sopra inizio
|
||||
SetFlag( 1) ;
|
||||
Point3d ptP1 = ptP + vtCorr * ( dElev / 2 + dAppr / vtCorr.z) ;
|
||||
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se distanza di sicurezza minore di distanza di inizio
|
||||
else if ( dSafeZ < m_Params.m_dStartPos + 10 * EPS_SMALL) {
|
||||
// 1 -> punto sopra inizio
|
||||
SetFlag( 1) ;
|
||||
Point3d ptP1 = ptP + vtCorr * ( dElev + dAppr / vtCorr.z) ;
|
||||
@@ -3806,7 +3975,15 @@ Sawing::AddApproach( const Point3d& ptP, const Vector3d& vtCorr, double dSafeZ,
|
||||
bool
|
||||
Sawing::AddRetract( const Point3d& ptP, const Vector3d& vtCorr, double dSafeZ, double dElev, double dAppr)
|
||||
{
|
||||
if ( dSafeZ < m_Params.m_dStartPos + 10 * EPS_SMALL) {
|
||||
// se abilitato retrazione diretta fuori dal grezzo (solo per lavorazione ToAndFrom)
|
||||
if ( m_bDownSE) {
|
||||
// 4 -> movimento di risalita sopra il punto finale
|
||||
SetFeed( GetEndFeed()) ;
|
||||
Point3d ptP4 = ptP + vtCorr * ( dElev / 2 + dAppr / vtCorr.z) ;
|
||||
if ( AddRapidMove( ptP4) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else if ( dSafeZ < m_Params.m_dStartPos + 10 * EPS_SMALL) {
|
||||
// 4 -> movimento di risalita sopra il punto finale
|
||||
SetFeed( GetEndFeed()) ;
|
||||
Point3d ptP4 = ptP + vtCorr * ( dElev + dAppr / vtCorr.z) ;
|
||||
@@ -3876,7 +4053,7 @@ Sawing::CalculateToolAndCorrVersors( const Vector3d& vtTang, int nHeadSide, int
|
||||
bool
|
||||
Sawing::AdjustForSide( ICurve* pCurve)
|
||||
{
|
||||
// se lato lavoro e lato mandrino coincidono, non devo fare alcunché
|
||||
// se lato lavoro e lato mandrino coincidono, non devo fare alcunché
|
||||
if ( ( m_Params.m_nWorkSide == SAW_WS_LEFT && m_Params.m_nHeadSide == SAW_HS_LEFT) ||
|
||||
( m_Params.m_nWorkSide == SAW_WS_RIGHT && m_Params.m_nHeadSide == SAW_HS_RIGHT))
|
||||
return true ;
|
||||
@@ -3921,7 +4098,7 @@ Sawing::AdjustLineForEdges( ICurveLine* pLine, double dElev, const Vector3d& vtC
|
||||
bool& bToSkip, double& dDeltaLiExt, double& dDeltaLoExt)
|
||||
{
|
||||
// distanza XY tra centro e bordo taglio
|
||||
double dDeltaT = (( dElev < 0.5 * m_TParams.m_dDiam) ? sqrt( dElev * m_TParams.m_dDiam - dElev * dElev) : 0) ;
|
||||
double dDeltaT = (( dElev < 0.5 * m_TParams.m_dDiam) ? sqrt( dElev * m_TParams.m_dDiam - dElev * dElev) : 0.5 * m_TParams.m_dDiam) ;
|
||||
// lunghezza aggiuntiva per attacco speciale a zigzag
|
||||
double dDeltaLi = 0 ;
|
||||
if ( dLiElev > EPS_SMALL)
|
||||
@@ -3957,7 +4134,7 @@ Sawing::AdjustLineForEdges( ICurveLine* pLine, double dElev, const Vector3d& vtC
|
||||
for ( int i = 0 ; i < 4 ; ++i)
|
||||
dDeltaI = max( dDeltaI, dDist[i]) ;
|
||||
if ( m_Params.m_nLeadInType == SAW_LI_EXT_OUT)
|
||||
dDeltaI += dDeltaT ;
|
||||
dDeltaI += dDeltaT + ( m_bDownSE ? MIN_SAFEDIST : 0) ;
|
||||
dDeltaLiExt = dDeltaI ;
|
||||
}
|
||||
}
|
||||
@@ -3981,7 +4158,7 @@ Sawing::AdjustLineForEdges( ICurveLine* pLine, double dElev, const Vector3d& vtC
|
||||
for ( int i = 0 ; i < 4 ; ++i)
|
||||
dDeltaI = max( dDeltaI, dDist[i]) ;
|
||||
if ( m_Params.m_nLeadInType == SAW_LI_EXT_OUT)
|
||||
dDeltaI += dDeltaT ;
|
||||
dDeltaI += dDeltaT + ( m_bDownSE ? MIN_SAFEDIST : 0) ;
|
||||
dDeltaLiExt = dDeltaI ;
|
||||
}
|
||||
}
|
||||
@@ -4016,7 +4193,7 @@ Sawing::AdjustLineForEdges( ICurveLine* pLine, double dElev, const Vector3d& vtC
|
||||
for ( int i = 0 ; i < 4 ; ++i)
|
||||
dDeltaF = max( dDeltaF, dDist[i]) ;
|
||||
if ( m_Params.m_nLeadOutType == SAW_LO_EXT_OUT)
|
||||
dDeltaF += dDeltaT ;
|
||||
dDeltaF += dDeltaT + ( m_bDownSE ? MIN_SAFEDIST : 0) ;
|
||||
dDeltaLoExt = dDeltaF ;
|
||||
}
|
||||
}
|
||||
@@ -4041,11 +4218,11 @@ Sawing::AdjustLineForEdges( ICurveLine* pLine, double dElev, const Vector3d& vtC
|
||||
dDeltaF = max( dDeltaF, dDist[i]) ;
|
||||
// se LeadOut EXT_OUT vado all'esterno
|
||||
if ( m_Params.m_nLeadOutType == SAW_LO_EXT_OUT)
|
||||
dDeltaF += dDeltaT ;
|
||||
dDeltaF += dDeltaT + ( m_bDownSE ? MIN_SAFEDIST : 0) ;
|
||||
dDeltaLoExt = dDeltaF ;
|
||||
}
|
||||
}
|
||||
// controllo se lunghezza entità accettabile
|
||||
// controllo se lunghezza entità accettabile
|
||||
const double MIN_LEN = 1 ;
|
||||
double dLenXY = DistXY( pLine->GetStart(), pLine->GetEnd()) ;
|
||||
if ( dDeltaI + dLenXY + dDeltaF < MIN_LEN) {
|
||||
@@ -4116,7 +4293,7 @@ Sawing::AdjustCurveForEdges( ICurve* pCrv, double dElev, double dLenCoeff,
|
||||
dDeltaF = dDeltaT ;
|
||||
}
|
||||
dDeltaF *= dLenCoeff ;
|
||||
// controllo se lunghezza entità accettabile
|
||||
// controllo se lunghezza entità accettabile
|
||||
const double MIN_LEN = 1 ;
|
||||
double dLenXY ;
|
||||
pCrv->GetLength( dLenXY) ;
|
||||
|
||||
@@ -39,8 +39,14 @@ class Sawing : public Machining
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_SAWING ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nCuts == 0) ; }
|
||||
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
|
||||
{ if ( m_nCuts == 0)
|
||||
return true ;
|
||||
if ( nEmptyType == NEED_ONE_TP_OK)
|
||||
return ( ! IsAtLeastOnePathOk()) ;
|
||||
if ( nEmptyType == NEED_ALL_TP_OK)
|
||||
return ( ! AreAllPathsOk()) ;
|
||||
return false ; }
|
||||
bool UpdateStatus( int nModif) override
|
||||
{ m_nStatus |= nModif ; return true ; }
|
||||
|
||||
@@ -63,7 +69,7 @@ class Sawing : public Machining
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool UpdateToolData( bool* pbChanged = nullptr) override ;
|
||||
bool UpdateToolData( void) override ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
|
||||
@@ -164,6 +170,7 @@ class Sawing : public Machining
|
||||
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
|
||||
SawingData m_Params ; // parametri lavorazione
|
||||
ToolData m_TParams ; // parametri utensile
|
||||
bool m_bDownSE ; // flag per attacco/uscita senza risalite se fuori dal grezzo
|
||||
int m_nStatus ; // stato di aggiornamento della lavorazione
|
||||
int m_nCuts ; // numero di tagli generati
|
||||
} ;
|
||||
|
||||
+6
-2
@@ -99,6 +99,10 @@ struct SawingData : public MachiningData
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline const SawingData* GetSawingData( const MachiningData* pMdata)
|
||||
{ return (dynamic_cast<const SawingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWING)
|
||||
return nullptr ;
|
||||
return ( static_cast<const SawingData*>( pMdata)) ; }
|
||||
inline SawingData* GetSawingData( MachiningData* pMdata)
|
||||
{ return (dynamic_cast<SawingData*>( pMdata)) ; }
|
||||
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWING)
|
||||
return nullptr ;
|
||||
return ( static_cast<SawingData*>( pMdata)) ; }
|
||||
|
||||
+21
-11
@@ -181,16 +181,12 @@ SetupMgr::Import( const string& sFileName)
|
||||
m_pMchMgr->GetCurrMachGroup() == GDB_ID_NULL)
|
||||
return false ;
|
||||
|
||||
// recupero il gruppo di setup
|
||||
int nSetupId = m_pMchMgr->GetCurrSetupGroupId() ;
|
||||
|
||||
// inizializzo lo scanner
|
||||
Scanner TheScanner ;
|
||||
if ( ! TheScanner.Init( sFileName, ";"))
|
||||
return false ;
|
||||
|
||||
// eseguo la lettura dei campi di attrezzaggio
|
||||
int nPos = 1 ;
|
||||
string sLine ;
|
||||
while ( TheScanner.GetLine( sLine)) {
|
||||
// salto dichiarazione sezione
|
||||
@@ -228,8 +224,6 @@ SetupMgr::Import( const string& sFileName)
|
||||
stuData.m_nExit = 0 ;
|
||||
m_vStuData.emplace_back( stuData) ;
|
||||
}
|
||||
// passo alla successiva posizione
|
||||
++ nPos ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
@@ -277,14 +271,20 @@ SetupMgr::GetPosData( int nPos, string& sTcPos, string& sHead, int& nExit, strin
|
||||
bool
|
||||
SetupMgr::GetToolData( const string& sName, string& sTcPos, string& sHead, int& nExit, int* pnPos) const
|
||||
{
|
||||
// reset valori di ritorno
|
||||
sTcPos.clear() ;
|
||||
sHead.clear() ;
|
||||
nExit = 0 ;
|
||||
if ( pnPos != nullptr)
|
||||
*pnPos = 0 ;
|
||||
// verifico validità utensile
|
||||
if ( IsEmptyOrSpaces( sName))
|
||||
return false ;
|
||||
// cerco l'utensile
|
||||
int nI = - 1 ;
|
||||
for ( size_t i = 0 ; i < m_vStuData.size() ; ++ i) {
|
||||
for ( int i = 0 ; i < int( m_vStuData.size()) ; ++ i) {
|
||||
if ( m_vStuData[i].m_nExit > 0 && EqualNoCase( sName, m_vStuData[i].m_sName)) {
|
||||
nI = int( i) ;
|
||||
nI = i ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
@@ -318,11 +318,21 @@ SetupMgr::GetToolName( const string& sHead, int nExit, string& sName) const
|
||||
bool
|
||||
SetupMgr::GetToolsInSetupPos( const string& sTcPos, STRVECTOR& vsTools) const
|
||||
{
|
||||
// default vettore vuoto
|
||||
vsTools.clear() ;
|
||||
// eseguo ricerca
|
||||
// verifico macchina
|
||||
if ( m_pMachine == nullptr)
|
||||
return false ;
|
||||
// eseguo ricerca (con inserimento nel vettore secondo indice dell'uscita)
|
||||
for ( int i = 0 ; i < int( m_vStuData.size()) ; ++ i) {
|
||||
if ( EqualNoCase( sTcPos, m_vStuData[i].m_sTcPos)) {
|
||||
vsTools.emplace_back( m_vStuData[i].m_sName) ;
|
||||
if ( ! IsEmptyOrSpaces( m_vStuData[i].m_sHead) && EqualNoCase( sTcPos, m_vStuData[i].m_sTcPos)) {
|
||||
if ( vsTools.empty()) {
|
||||
int nExitCnt = m_pMachine->GetHeadExitCount( m_vStuData[i].m_sHead) ;
|
||||
vsTools.resize( nExitCnt) ;
|
||||
}
|
||||
int nExit = m_vStuData[i].m_nExit ;
|
||||
if ( nExit > 0 && nExit <= int( vsTools.size()))
|
||||
vsTools[nExit - 1] = m_vStuData[i].m_sName ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
|
||||
+32
-149
@@ -1,25 +1,24 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2023
|
||||
// EgalTech 2015-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : Simulator.h Data : 16.01.23 Versione : 2.5a2
|
||||
// Contenuto : Dichiarazione della classe Simulator.
|
||||
// File : Simulator.h Data : 01.09.24 Versione : 2.6i1
|
||||
// Contenuto : Dichiarazione della classe interfaccia ISimulator.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 19.10.15 DS Creazione modulo.
|
||||
// Modifiche : 01.09.24 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CamData.h"
|
||||
#include "/EgtDev/Include/EGkVector3d.h"
|
||||
#include "/EgtDev/Include/EMkSimuGenConst.h"
|
||||
#include "/EgtDev/Include/EgtNumCollection.h"
|
||||
#include <string>
|
||||
|
||||
class MachMgr ;
|
||||
class IGeomDB ;
|
||||
class Machine ;
|
||||
class PerformanceCounter ;
|
||||
|
||||
//------------------------ Struttura per movimento esterno assi --------------
|
||||
struct SimAxMv
|
||||
@@ -38,147 +37,31 @@ enum SimAxMvRes { SIM_AXMV_RES_STOP = -1,
|
||||
SIM_AXMV_RES_OK = 1} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class Simulator
|
||||
class __declspec( novtable) ISimulator
|
||||
{
|
||||
public :
|
||||
Simulator( void) ;
|
||||
~Simulator( void) ;
|
||||
bool Init( MachMgr* pMchMgr) ;
|
||||
bool Start( bool bFirst) ;
|
||||
bool Move( int& nStatus) ;
|
||||
bool GoHome( void) ;
|
||||
bool SetStep( double dStep) ;
|
||||
bool SetUiStatus( int nUiStatus) ;
|
||||
bool GetAxisInfoPos( int nI, std::string& sName, std::string& sToken, bool& bLinear, double& dVal) const ;
|
||||
bool GetToolInfo( std::string& sName, double& dSpeed) const ;
|
||||
bool GetOperationInfo( std::string& sName, int& nType) const ;
|
||||
bool GetMoveInfo( int& nGmove, double& dFeed) const ;
|
||||
bool AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
|
||||
bool ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) ;
|
||||
bool OnCollision( int nCdInd, int nObjInd, int& nErr) ;
|
||||
bool SetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, const INTVECTOR& vVmill, bool bFirst) ;
|
||||
int MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) ;
|
||||
|
||||
private :
|
||||
bool UpdateTool( bool bFirst, int& nErr) ;
|
||||
bool UpdateAxes( void) ;
|
||||
bool UpdateAxesPos( void) ;
|
||||
bool ResetInterpolation( void) ;
|
||||
bool ResetAxes( void) ;
|
||||
bool ResetAuxAxes( void) ;
|
||||
|
||||
private :
|
||||
bool VerifySetup( void) ;
|
||||
bool FindAndManageOperationStart( bool bStart, bool bFirst, int& nStatus) ;
|
||||
bool ManageOperationEnd( int& nStatus) ;
|
||||
bool FindAndManagePathStart( int& nStatus) ;
|
||||
bool ManagePathEnd( int& nStatus) ;
|
||||
bool ManagePathStartAux( int& nStatus) ;
|
||||
bool ManagePathEndAux( int& nStatus) ;
|
||||
bool ManageMove( int& nStatus) ;
|
||||
bool ManageSingleMove( int& nStatus, double& dMove) ;
|
||||
int CalcStatusOnError( int nErr) ;
|
||||
bool GetHeadCurrPosDirAux( const std::string& sHead, int nExit, Point3d& ptH, Vector3d& vtH, Vector3d& vtA) ;
|
||||
bool ExecLineVmill( int nVmId, int nCurrTool, double dVmTdOffs, double dVmAdOffs,
|
||||
const Point3d& ptHi, const Vector3d& vtHi, const Vector3d& vtAi, const Frame3d& frVzmI,
|
||||
const Point3d& ptHf, const Vector3d& vtHf, const Vector3d& vtAf, const Frame3d& frVzmF) ;
|
||||
bool NeedCollisionCheck( void) const
|
||||
{ return ( ! m_CollObj.empty() && ! m_CdId.empty()) ; }
|
||||
bool Stopped( void)
|
||||
{ return ( m_nUiStatus == MCH_UISIM_STOP) ; }
|
||||
bool OnStart( bool bFirst) ;
|
||||
bool OnEnd( void) ;
|
||||
bool OnDispositionStarting( int nOpId, int nOpInd, int nPhase,
|
||||
const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ;
|
||||
bool OnDispositionStart( int nOpId, int nOpInd, int nPhase,
|
||||
const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ;
|
||||
bool OnDispositionEnd( void) ;
|
||||
bool OnToolSelect( const std::string& sTool, const std::string& sHead, int nExit, const std::string& sTcPos, bool bFirst, int& nErr) ;
|
||||
bool OnToolDeselect( const std::string& sNextTool, const std::string& sNextHead, int nNextExit, const std::string& sNextTcPos, int& nErr) ;
|
||||
bool OnMachiningStart( int nOpId, int nOpInd, const Point3d& ptMin, const Point3d& ptMax,
|
||||
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax) ;
|
||||
bool OnMachiningEnd( void) ;
|
||||
bool OnPathStartAux( int nInd, const std::string& sAS, int& nErr) ;
|
||||
bool OnPathEndAux( int nInd, const std::string& sAE, int& nErr) ;
|
||||
bool OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
|
||||
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev) ;
|
||||
bool OnPathEnd( int nAE) ;
|
||||
bool OnMoveStart( const CamData* pCamData, int& nErr) ;
|
||||
bool OnMoveEnd( int& nErr) ;
|
||||
bool OnResetMachine( void) ;
|
||||
|
||||
private :
|
||||
struct CollObj {
|
||||
int nInd ;
|
||||
bool bToolOn ;
|
||||
int nFrameId ;
|
||||
int nType ;
|
||||
Vector3d vtMove ;
|
||||
double dPar1 ;
|
||||
double dPar2 ;
|
||||
double dPar3 ;
|
||||
CollObj( void) : nInd( 0), bToolOn( false), nFrameId( -1), nType( 0), vtMove(), dPar1( 0), dPar2( 0), dPar3( 0) {}
|
||||
CollObj( int nI, bool bTOn, int nF, int nT, const Vector3d& vtM, double dP1, double dP2, double dP3)
|
||||
: nInd( nI), bToolOn( bTOn), nFrameId( nF), nType( nT), vtMove( vtM), dPar1( dP1), dPar2( dP2), dPar3( dP3) {}
|
||||
} ;
|
||||
typedef std::vector<CollObj> COBVECTOR ;
|
||||
struct VmTool
|
||||
{
|
||||
std::string sName ;
|
||||
std::string sHead ;
|
||||
int nExit ;
|
||||
double dTdOffs ;
|
||||
double dAdOffs ;
|
||||
VmTool( void) : nExit( 0), dTdOffs( 0), dAdOffs( 0) {}
|
||||
VmTool( std::string sN, std::string sH, int nE, double dT, double dA)
|
||||
: sName( sN), sHead( sH), nExit( nE), dTdOffs( dT), dAdOffs( dA) {}
|
||||
} ;
|
||||
typedef std::vector<VmTool> VMTVECTOR ;
|
||||
|
||||
private :
|
||||
MachMgr* m_pMchMgr ; // puntatore al gestore di tutte le lavorazioni
|
||||
IGeomDB* m_pGeomDB ; // puntatore al DB geometrico
|
||||
Machine* m_pMachine ; // puntatore alla macchina
|
||||
PerformanceCounter* m_pPerfCnt ; // timer per calcolo FPS
|
||||
double m_dStep ; // lunghezza di riferimento per la velocità di simulazione
|
||||
int m_nUiStatus ; // stato simulazione a livello utente
|
||||
int m_nOpId ; // identificativo della operazione (lavoraz.) corrente
|
||||
int m_nOpInd ; // contatore della operazione (lavoraz.) corrente
|
||||
int m_nCLPathId ; // identificativo del percorso di lavoro corrente
|
||||
int m_nCLPathInd ; // contatore del percorso di lavoro corrente nell'operazione
|
||||
int m_nEntId ; // identificativo dell'entità corrente
|
||||
int m_nEntInd ; // contatore dell'entità corrente nel percorso di lavoro
|
||||
double m_dCoeff ; // coefficiente di esecuzione del movimento corrente (0...1)
|
||||
int m_nAuxSTot ; // numero totale movimenti ausiliari di inizio percorso
|
||||
int m_nAuxSInd ; // indice del movimento ausiliario di inizio percorso corrente
|
||||
int m_nAuxETot ; // numero totale movimenti ausiliari di fine percorso
|
||||
int m_nAuxEInd ; // indice del movimento ausiliario di fine percorso corrente
|
||||
std::string m_sTool ; // nome dell'utensile corrente
|
||||
std::string m_sHead ; // nome della testa corrente
|
||||
int m_nExit ; // indice dell'uscita corrente
|
||||
double m_dTDiam ; // diametro dell'utensile corrente
|
||||
bool m_bCutOnTip ; // flag capacità di lavorare di testa dell'utensile corrente
|
||||
INTVECTOR m_VmId ; // vettore identificativi Zmap per Virtual Milling
|
||||
INTVECTOR m_CdId ; // vettore identificativi Zmap per Collision Detection
|
||||
VMTVECTOR m_VmTool ; // vettore utensili attivi per virtual milling
|
||||
COBVECTOR m_CollObj ; // vettore oggetti da testare per collisione con grezzo
|
||||
double m_dSafeDist ; // distanza di sicurezza per verifica collisioni
|
||||
int m_nAxesMask ; // maschera a bit di abilitazione movimento assi (solo se rapido)
|
||||
bool m_bEnabAxes ; // flag abilitazione movimento assi attivi
|
||||
bool m_bShowAxes ; // flag visualizzazione assi attivi
|
||||
STRVECTOR m_AxesName ; // nomi degli assi macchina attivi
|
||||
STRVECTOR m_AxesToken ; // token degli assi macchina attivi
|
||||
BOOLVECTOR m_AxesInvert ; // flag di asse con verso invertito degli assi macchina attivi
|
||||
DBLVECTOR m_AxesOffset ; // valore di offset delgli assi macchina ttivi
|
||||
BOOLVECTOR m_AxesLinear ; // flag di lineare degli assi macchina attivi
|
||||
DBLVECTOR m_AxesVal ; // valori degli assi macchina all'inizio del movimento corrente
|
||||
STRVECTOR m_AuxAxesName ; // nomi degli assi macchina ausiliari abilitati
|
||||
STRVECTOR m_AuxAxesToken ; // token degli assi macchina ausiliari abilitati
|
||||
BOOLVECTOR m_AuxAxesInvert ; // flag di asse con verso invertito degli assi macchina ausiliari abilitati
|
||||
DBLVECTOR m_AuxAxesOffset ; // valore di offset degli assi macchina ausiliari abilitati
|
||||
BOOLVECTOR m_AuxAxesLinear ; // flag di lineare degli assi macchina ausiliari abilitati
|
||||
DBLVECTOR m_AuxAxesVal ; // valori degli assi macchina ausiliari all'inizio del movimento corrente
|
||||
DBLVECTOR m_AuxAxesEnd ; // valori degli assi macchina ausiliari alla fine del movimento corrente
|
||||
INTVECTOR m_AuxAxesLink ; // indice + 1 asse principale di aggancio (negativo valore opposto, 0 nessuno)
|
||||
virtual ~ISimulator( void) {}
|
||||
virtual bool Init( MachMgr* pMchMgr) = 0 ;
|
||||
virtual bool Start( bool bFirst) = 0 ;
|
||||
virtual bool Move( int& nStatus) = 0 ;
|
||||
virtual bool GoHome( void) = 0 ;
|
||||
virtual bool SetStep( double dStep) = 0 ;
|
||||
virtual bool SetUiStatus( int nUiStatus) = 0 ;
|
||||
virtual bool GetAxisInfoPos( int nI, std::string& sName, std::string& sToken, bool& bLinear, double& dVal) const = 0 ;
|
||||
virtual bool GetToolInfo( std::string& sName, double& dSpeed) const = 0 ;
|
||||
virtual bool GetOperationInfo( std::string& sName, int& nType) const = 0 ;
|
||||
virtual bool GetMoveInfo( int& nGmove, double& dFeed) const = 0 ;
|
||||
virtual bool AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType,
|
||||
const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) = 0 ;
|
||||
virtual bool RemoveCollisionObj( int nFrameId) = 0 ;
|
||||
virtual bool GetCollisionObj( int nPos, int& nInd, bool& bToolOn, int& nFrameId, int& nType,
|
||||
Vector3d& vtMove, double& dPar1, double& dPar2, double& dPar3) = 0 ;
|
||||
virtual bool ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) = 0 ;
|
||||
virtual bool OnCollision( int nCdInd, int nObjInd, int& nErr) = 0 ;
|
||||
virtual bool SetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, int nFlag,
|
||||
double dPar1, double dPar2, const INTVECTOR& vVmill, bool bFirst) = 0 ;
|
||||
virtual bool EnableToolsForVmill( bool bEnable) = 0 ;
|
||||
virtual bool EnableToolTipTrace( bool bEnable) = 0 ;
|
||||
virtual int MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) = 0 ;
|
||||
virtual bool SaveCmd( int nType, int nPar, const std::string& sPar, const std::string& sPar2) = 0 ;
|
||||
} ;
|
||||
|
||||
+2768
File diff suppressed because it is too large
Load Diff
+220
@@ -0,0 +1,220 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2024-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : SimulatorMP.h Data : 01.09.24 Versione : 2.6i1
|
||||
// Contenuto : Dichiarazione della classe SimulatorMP.
|
||||
// Simulatore multi-processo.
|
||||
//
|
||||
//
|
||||
// Modifiche : 01.09.24 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Simulator.h"
|
||||
#include "CamData.h"
|
||||
|
||||
class IGeomDB ;
|
||||
class Machine ;
|
||||
class PerformanceCounter ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
ISimulator* CreateSimulatorMP( void) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class SimulatorMP : public ISimulator
|
||||
{
|
||||
public : // ISimulator
|
||||
~SimulatorMP( void) override ;
|
||||
bool Init( MachMgr* pMchMgr) override ;
|
||||
bool Start( bool bFirst) override ;
|
||||
bool Move( int& nStatus) override ;
|
||||
bool GoHome( void) override ;
|
||||
bool SetStep( double dStep) override ;
|
||||
bool SetUiStatus( int nUiStatus) override ;
|
||||
bool GetAxisInfoPos( int nI, std::string& sName, std::string& sToken, bool& bLinear, double& dVal) const override ;
|
||||
bool GetToolInfo( std::string& sName, double& dSpeed) const override ;
|
||||
bool GetOperationInfo( std::string& sName, int& nType) const override ;
|
||||
bool GetMoveInfo( int& nGmove, double& dFeed) const override ;
|
||||
bool AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType,
|
||||
const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) override ;
|
||||
bool RemoveCollisionObj( int nFrameId) override ;
|
||||
bool GetCollisionObj( int nPos, int& nInd, bool& bToolOn, int& nFrameId, int& nType,
|
||||
Vector3d& vtMove, double& dPar1, double& dPar2, double& dPar3) override ;
|
||||
bool ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) override ;
|
||||
bool OnCollision( int nCdInd, int nObjInd, int& nErr) override ;
|
||||
bool SetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, int nFlag,
|
||||
double dPar1, double dPar2, const INTVECTOR& vVmill, bool bFirst) override ;
|
||||
bool EnableToolsForVmill( bool bEnable) override ;
|
||||
bool EnableToolTipTrace( bool bEnable) override
|
||||
{ return false ; }
|
||||
int MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) override ;
|
||||
bool SaveCmd( int nType, int nPar, const std::string& sPar, const std::string& sPar2) override ;
|
||||
|
||||
public :
|
||||
SimulatorMP( void) ;
|
||||
|
||||
private :
|
||||
bool UpdateMachiningTool( bool bFirst, int& nChangeTool, int& nErr) ;
|
||||
bool UpdateDispositionTool( bool bFirst, int& nErr) ;
|
||||
bool UpdateAxes( void) ;
|
||||
bool UpdateAxesPos( void) ;
|
||||
bool ResetInterpolation( void) ;
|
||||
bool ResetAxes( void) ;
|
||||
bool ResetAuxAxes( void) ;
|
||||
|
||||
private :
|
||||
bool VerifySetup( void) ;
|
||||
bool FindAndManageOperationStart( bool bStart, bool bFirst, int& nChangeTool, int& nStatus) ;
|
||||
bool ManageOperationEnd( int& nStatus) ;
|
||||
bool FindAndManagePathStart( int& nStatus) ;
|
||||
bool ManagePathEnd( int& nStatus) ;
|
||||
bool ManagePathStartAux( int& nStatus) ;
|
||||
bool ManagePathEndAux( int& nStatus) ;
|
||||
bool ManageMove( int& nStatus) ;
|
||||
bool ManageSingleMove( int& nStatus, double& dMove) ;
|
||||
int CalcStatusOnError( int nErr) ;
|
||||
bool GetHeadCurrPosDirAux( const std::string& sHead, int nExit, Point3d& ptH, Vector3d& vtH, Vector3d& vtA) ;
|
||||
bool ExecLineVmill( int nVmId, int nCurrTool, double dVmTdOffs, double dVmAdOffs,
|
||||
const Point3d& ptHi, const Vector3d& vtHi, const Vector3d& vtAi, const Frame3d& frVzmI,
|
||||
const Point3d& ptHf, const Vector3d& vtHf, const Vector3d& vtAf, const Frame3d& frVzmF) ;
|
||||
bool NeedCollisionCheck( void) const
|
||||
{ return ( ! m_CollObj.empty() && ! m_CdId.empty()) ; }
|
||||
bool Stopped( void)
|
||||
{ return ( m_nUiStatus == MCH_UISIM_STOP) ; }
|
||||
bool SetCollisionMark( int nCdInd, int nObjInd) ;
|
||||
bool ResetCollisionMark( void) ;
|
||||
bool CallFunction( const std::string& sFun, bool bSetRecord = false, bool bSetModifiedOff = true) ;
|
||||
bool OnInit( void) ;
|
||||
bool OnExit( void) ;
|
||||
bool OnProgramStart( bool bFirst) ;
|
||||
bool OnProgramEnd( void) ;
|
||||
bool OnDispositionStarting( int nOpId, int nOpInd, int nPhase,
|
||||
const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ;
|
||||
bool OnDispositionStart( int nOpId, int nOpInd, int nPhase,
|
||||
const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ;
|
||||
bool OnDispositionEnd( void) ;
|
||||
bool OnToolSelect( const std::string& sTool, const std::string& sHead, int nExit, const std::string& sTcPos,
|
||||
bool bFirst, bool bFloating, int& nErr) ;
|
||||
bool OnToolDeselect( const std::string& sNextTool, const std::string& sNextHead, int nNextExit, const std::string& sNextTcPos, int& nErr) ;
|
||||
bool OnMachiningStart( int nOpId, int nOpInd, const Point3d& ptMin, const Point3d& ptMax,
|
||||
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax) ;
|
||||
bool OnMachiningEnd( void) ;
|
||||
bool OnPathStartAux( int nInd, const std::string& sAS, int& nErr) ;
|
||||
bool OnPathEndAux( int nInd, const std::string& sAE, int& nErr) ;
|
||||
bool OnPathStart( int nClPathId, int nClPathInd, int nDBLPathId, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
|
||||
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit) ;
|
||||
bool OnPathEnd( int nAE) ;
|
||||
bool OnMoveStart( const CamData* pCamData, const CamData* pNextCamData, int& nErr) ;
|
||||
bool OnMoveEnd( int& nErr) ;
|
||||
bool OnResetMachine( void) ;
|
||||
bool ReadAuxAxesData( int& nErr) ;
|
||||
bool ExecCmdData( int& nStatus) ;
|
||||
bool ExecAllCmdData( int& nStatus) ;
|
||||
|
||||
private :
|
||||
struct CollObj {
|
||||
int nInd ;
|
||||
bool bToolOn ;
|
||||
int nFrameId ;
|
||||
int nType ;
|
||||
Vector3d vtMove ;
|
||||
double dPar1 ;
|
||||
double dPar2 ;
|
||||
double dPar3 ;
|
||||
CollObj( void) : nInd( 0), bToolOn( false), nFrameId( -1), nType( 0), vtMove(), dPar1( 0), dPar2( 0), dPar3( 0) {}
|
||||
CollObj( int nI, bool bTOn, int nF, int nT, const Vector3d& vtM, double dP1, double dP2, double dP3)
|
||||
: nInd( nI), bToolOn( bTOn), nFrameId( nF), nType( nT), vtMove( vtM), dPar1( dP1), dPar2( dP2), dPar3( dP3) {}
|
||||
} ;
|
||||
typedef std::vector<CollObj> COBVECTOR ;
|
||||
struct VmTool
|
||||
{
|
||||
std::string sName ;
|
||||
std::string sHead ;
|
||||
int nExit ;
|
||||
double dTdOffs ;
|
||||
double dAdOffs ;
|
||||
VmTool( void) : nExit( 0), dTdOffs( 0), dAdOffs( 0) {}
|
||||
VmTool( std::string sN, std::string sH, int nE, double dT, double dA)
|
||||
: sName( sN), sHead( sH), nExit( nE), dTdOffs( dT), dAdOffs( dA) {}
|
||||
} ;
|
||||
typedef std::vector<VmTool> VMTVECTOR ;
|
||||
enum { SIS_CREATED = 0,
|
||||
SIS_INITIALIZED = 1,
|
||||
SIS_READYTOSTART = 2,
|
||||
SIS_READYTORUN = 3} ;
|
||||
|
||||
private :
|
||||
struct CmdData {
|
||||
int nType ;
|
||||
int nMoveType ;
|
||||
SAMVECTOR vAxNaEpSt ;
|
||||
int nPar ;
|
||||
std::string sPar ;
|
||||
std::string sPar2 ;
|
||||
CmdData( void) : nType(0) {}
|
||||
CmdData( int nM, const SAMVECTOR& vAx)
|
||||
: nType( 1), nMoveType( nM), vAxNaEpSt( vAx) {}
|
||||
CmdData( int nT, int nP, const std::string& sP, const std::string& sP2)
|
||||
: nType( nT), nPar( nP), sPar( sP), sPar2( sP2) {}
|
||||
} ;
|
||||
typedef std::vector<CmdData> CMDVECTOR ;
|
||||
|
||||
private :
|
||||
MachMgr* m_pMchMgr ; // puntatore al gestore di tutte le lavorazioni
|
||||
IGeomDB* m_pGeomDB ; // puntatore al DB geometrico
|
||||
Machine* m_pMachine ; // puntatore alla macchina
|
||||
PerformanceCounter* m_pPerfCnt ; // timer per calcolo FPS
|
||||
std::string m_sSpecEstim ; // path del file con i dati della stima speciale
|
||||
int m_nStatus ; // stato interno del simulatore (creato, inizializzato, pronto al movimento)
|
||||
double m_dStep ; // lunghezza di riferimento per la velocità di simulazione
|
||||
int m_nUiStatus ; // stato simulazione a livello utente
|
||||
INTVECTOR m_vOperId ; // vettore identificativi operazioni ordinate per simulazione
|
||||
int m_nOpId ; // identificativo della operazione (lavoraz.) corrente
|
||||
int m_nOpInd ; // contatore della operazione (lavoraz.) corrente
|
||||
int m_nCLPathId ; // identificativo del percorso di lavoro corrente
|
||||
int m_nCLPathInd ; // contatore del percorso di lavoro corrente nell'operazione
|
||||
int m_nEntId ; // identificativo dell'entità corrente
|
||||
int m_nEntInd ; // contatore dell'entità corrente nel percorso di lavoro
|
||||
double m_dCoeff ; // coefficiente di esecuzione del movimento corrente (0...1)
|
||||
int m_nChangeTool ; // stato di carico e scarico dell'utensile
|
||||
int m_nAuxSTot ; // numero totale movimenti ausiliari di inizio percorso
|
||||
int m_nAuxSInd ; // indice del movimento ausiliario di inizio percorso corrente
|
||||
int m_nAuxETot ; // numero totale movimenti ausiliari di fine percorso
|
||||
int m_nAuxEInd ; // indice del movimento ausiliario di fine percorso corrente
|
||||
std::string m_sTool ; // nome dell'utensile corrente
|
||||
std::string m_sHead ; // nome della testa corrente
|
||||
int m_nExit ; // indice dell'uscita corrente
|
||||
double m_dTDiam ; // diametro dell'utensile corrente
|
||||
bool m_bCutOnTip ; // flag capacità di lavorare di testa dell'utensile corrente
|
||||
bool m_bEnableVm ; // flag abilitazione Virtual Milling
|
||||
INTVECTOR m_VmId ; // vettore identificativi Zmap per Virtual Milling
|
||||
INTVECTOR m_CdId ; // vettore identificativi Zmap per Collision Detection
|
||||
VMTVECTOR m_VmTool ; // vettore utensili attivi per virtual milling
|
||||
COBVECTOR m_CollObj ; // vettore oggetti da testare per collisione con grezzo
|
||||
double m_dSafeDist ; // distanza di sicurezza per verifica collisioni
|
||||
INTVECTOR m_nCollMarkId ; // elenco oggetti marcati per visualizzare meglio la collisione rilevata
|
||||
int m_nAxesMask ; // maschera a bit di abilitazione movimento assi (solo se rapido)
|
||||
bool m_bEnabAxes ; // flag abilitazione movimento assi attivi
|
||||
bool m_bShowAxes ; // flag visualizzazione assi attivi
|
||||
STRVECTOR m_AxesName ; // nomi degli assi macchina attivi
|
||||
STRVECTOR m_AxesToken ; // token degli assi macchina attivi
|
||||
BOOLVECTOR m_AxesInvert ; // flag di asse con verso invertito degli assi macchina attivi
|
||||
DBLVECTOR m_AxesOffset ; // valore di offset delgli assi macchina ttivi
|
||||
BOOLVECTOR m_AxesLinear ; // flag di lineare degli assi macchina attivi
|
||||
DBLVECTOR m_AxesVal ; // valori degli assi macchina all'inizio del movimento corrente
|
||||
STRVECTOR m_AuxAxesName ; // nomi degli assi macchina ausiliari abilitati
|
||||
STRVECTOR m_AuxAxesToken ; // token degli assi macchina ausiliari abilitati
|
||||
BOOLVECTOR m_AuxAxesInvert ; // flag di asse con verso invertito degli assi macchina ausiliari abilitati
|
||||
DBLVECTOR m_AuxAxesOffset ; // valore di offset degli assi macchina ausiliari abilitati
|
||||
BOOLVECTOR m_AuxAxesLinear ; // flag di lineare degli assi macchina ausiliari abilitati
|
||||
DBLVECTOR m_AuxAxesVal ; // valori degli assi macchina ausiliari all'inizio del movimento corrente
|
||||
DBLVECTOR m_AuxAxesEnd ; // valori degli assi macchina ausiliari alla fine del movimento corrente
|
||||
INTVECTOR m_AuxAxesLink ; // indice + 1 asse principale di aggancio (negativo valore opposto, 0 nessuno)
|
||||
CMDVECTOR m_CmdData ; // vettore comandi in attesa di esecuzione
|
||||
int m_nCmdInd ; // indice prossimo comando da eseguire
|
||||
double m_dCmdCoeff ; // coefficiente di movimento nel comando
|
||||
} ;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user