139 Commits

Author SHA1 Message Date
Riccardo Elitropi f8405a7970 EgtMachKernel :
- Aggiunto parametro per ottimizzazione Offset per percorsi di Pocketing
- Cambiata la gestione delle finiture Optimal
- Migliorati e Aggiunti controlli sui frame Locali in Finiture ZLevel e Optimal.
2025-02-21 11:15:08 +01:00
Riccardo Elitropi 5067af57e9 EgtMachKernel :
- migliorie forature.
2025-02-12 14:50:17 +01:00
Riccardo Elitropi 934a0f4be3 EgtMachKernel :
- in Drilling rimozione variabili di debug.
2025-02-11 16:57:27 +01:00
Riccardo Elitropi 46f51ae3fe Merge commit '6e3a82697cef8155ee38f4f73d084290c87b8fbd' into feature/Svuotature 2025-02-11 16:42:00 +01:00
Riccardo Elitropi 852183de0c EgtMachKernel :
- In Drilling, migliorati controlli per utensili selezionabili.
2025-02-11 16:41:42 +01:00
Dario Sassi 6e3a82697c EgtMachKernel 2.7a5 :
- in sgrossatura superficie, finitura superficie e fresatura 5assi Apply controlla di non essere già in esecuzione sulla stessa lavorazione.
2025-02-06 17:07:58 +01:00
Riccardo Elitropi 5b4636eab1 Merge commit '731843f877ef316ad6c46838bbc998fed24f9c04' into feature/Svuotature 2025-02-06 07:58:17 +01:00
SaraP 731843f877 EgtMachKernel :
- nella preview del waterjet separate le regioni della lavorazione da quelle di ingresso e uscita.
2025-02-05 10:53:02 +01:00
Riccardo Elitropi 17fee33ff6 Merge commit 'f25acd3870f964cbee9187d82222a88c9026698e' into feature/Svuotature 2025-02-05 07:45:45 +01:00
Dario Sassi f25acd3870 EgtMachkernel :
- alla funzione OnActivateDrillingUnit si passa anche la variabile EMC.VER.
2025-02-04 16:55:12 +01:00
Riccardo Elitropi 7193ff3ac4 Merge commit '0b5fe6a6190f52f24fabf6a9c7c2680d803ad9b5' into feature/Svuotature 2025-02-04 14:54:38 +01:00
Dario Sassi 0b5fe6a619 EgtMachKernel :
- aggiunta gestione gruppi a forare con uscite selezionabili per anteprima, simulazione, stima e generazione.
2025-02-04 14:52:06 +01:00
Dario Sassi 4d1757ae30 Merge commit 'a5a020d19b03de52068bec59f444cc8f51bb05ba' 2025-01-31 14:36:07 +01:00
Riccardo Elitropi a5a020d19b EgtMachKernel :
- correzione link verticali per finiture ZConst.
2025-01-31 14:34:27 +01:00
Riccardo Elitropi cac0af10c7 Merge commit 'fd672325b07fa1b8d7e3aaf8b80890568822a9ff' into feature/Svuotature 2025-01-31 13:09:33 +01:00
Dario Sassi fd672325b0 EgtMachKernel :
- forzato prossimo ricarico utensili su testa all'aggiornamento setup.
2025-01-31 11:15:16 +01:00
Dario Sassi 333673005f EgtMachKernel 2.7a4 :
- modifiche per aggiunta SetFixtureLink per collegamento tra bloccaggio ed asse tavola.
2025-01-31 08:59:58 +01:00
Dario Sassi 6613639f96 Merge commit '5d77408018aa0c4088577770e8bca60d24cfe833' 2025-01-30 19:35:11 +01:00
Riccardo Elitropi 5d77408018 EgtMachKernel :
- prima implementazione forature con utensili selezionabili.
2025-01-30 16:54:30 +01:00
Riccardo Elitropi 70f2df2e0a Merge commit 'b74f0d407d67c5a70ab2a9176bd8d67c116f7268' into feature/Svuotature 2025-01-29 07:48:17 +01:00
Dario Sassi b74f0d407d EgtMachKernel 2.7a3 :
- aggiunta a PostProc la chiamata a OnTableAxisData e a Estimator la chiamata a OnEstimTableAxisData per ogni asse di tavola su quella corrente
- modifiche varie a Machine per rendere possibile la modifica precedente
- piccolo aggiustamento a inizializzazione di dZConstOverlap.
2025-01-28 19:45:11 +01:00
Dario Sassi 0c27684785 Merge remote-tracking branch 'origin/feature/Svuotature' 2025-01-28 18:31:09 +01:00
Riccardo Elitropi 232ebbc833 Merge commit '72fbae9bf7dd6d9bfde6fa35a703d92fc63819d9' into feature/Svuotature 2025-01-28 17:44:31 +01:00
Riccardo Elitropi 2362548413 EgtMachKernel :
- Migliorie in finiture ZConst e Optimal.
2025-01-28 17:43:59 +01:00
Dario Sassi 92d1e443a4 Merge commit 'eb48c9f9a05b7038fc9007bbdc57b1e46aff1ed8' 2025-01-27 14:28:26 +01:00
Riccardo Elitropi eb48c9f9a0 EgtMachKernel :
- in Finiture Optimal e ZLevel, rimozione memory Leaks.
2025-01-27 12:39:45 +01:00
Dario Sassi 72fbae9bf7 EgtMachKernel :
- aggiustamenti in Taglio Con Lama per tipo ToAndFrom (se impostato ora è forzato e i parametri di affondamento sono opportunamente aggiustati).
2025-01-27 12:02:14 +01:00
Riccardo Elitropi ca2d2a142b Merge commit 'f15e91e3f16f83d82ce327c560e251059c5655e8' into feature/Svuotature 2025-01-27 08:17:43 +01:00
Dario Sassi f15e91e3f1 EgtMachKernel :
- migliorata segnalazione errori per script lua lanciati da Operation (OnSpecialGetMaxZ, OnSpecialTestCollisionAvoid, OnSpecialMoveZup e OnSpecialMoveRapid).
2025-01-26 17:51:42 +01:00
Dario Sassi 3a2c18bf86 EgtMachKernel :
- sostituite FromString( ExtractInfo(sUn,"QQQ="),dQQQ) con GetValInNotes(sUn,"QQQ"),dQQQ), cosa possibile solo quando la chiave finisce con '='.
2025-01-26 11:39:39 +01:00
Dario Sassi c165d552c2 Merge commit '47f8df92f4a3311dd647a8f60f1fc29d56006675' 2025-01-24 20:42:36 +01:00
Riccardo Elitropi 47f8df92f4 EgtMachKernel :
- In Sgrossature rimozione memory Leaks
- Aggiunto parametro ZConstOverlap per finiture Optimal.
2025-01-24 17:06:15 +01:00
Riccardo Elitropi 422eb260d5 Merge commit '7507919ce7b127d8df4ffd988cb66ada4f809508' into feature/Svuotature 2025-01-24 08:11:56 +01:00
Dario Sassi 7507919ce7 EgtMachKernel 2.7a2 :
- correzioni in FinituraSuperfici per impostazione utensili avanzati (a V, ...) a Collision Avoid
- correzione in FinituraSuperfici/Proiezione per recupero lunghezza utensile da fare nel riferimento locale.
2025-01-22 15:46:33 +01:00
Dario Sassi e75b186dd8 Merge commit '65ef32a368e97c6132214d49b32ab28f44f84384' 2025-01-22 10:13:59 +01:00
Riccardo Elitropi 65ef32a368 EgtMachKernel :
- in Sgrossature aggiunto controllo sull'elevazione ed eventuale parametro MaxElev.
2025-01-22 09:24:17 +01:00
Riccardo Elitropi 8d248dc776 Merge commit '84c4a80cab80d9614fc06903a9b7264b72dd936e' into feature/Svuotature 2025-01-22 07:42:44 +01:00
Dario Sassi 84c4a80cab EgtMachKernel :
- correzione a SurfFinishing/Projection per gestione massimo affondamento.
2025-01-21 13:37:35 +01:00
Dario Sassi e5e51f0be0 Merge commit 'a6c568f3cc3313b8325b4a4f8dd90853c36537cb' 2025-01-21 12:57:53 +01:00
Riccardo Elitropi a6c568f3cc Merge commit '390724ff3fa9c2cce166fd778f7e7ca7238efc66' into feature/Svuotature 2025-01-21 12:50:30 +01:00
Riccardo Elitropi f756dc4a7e EgtMachKernel :
- Aggiunta finitura Projection.
2025-01-21 12:50:10 +01:00
Dario Sassi 390724ff3f EgtMachKernel :
- in sgrossatura superfici eliminato crash con affondamento zero e substep non nullo.
2025-01-21 12:05:49 +01:00
Dario Sassi 7e9285b55d Merge commit 'af244eb59fac242923901832e42f9b6c4e521e0d' 2025-01-20 11:53:36 +01:00
Riccardo Elitropi af244eb59f EgtMachKernel :
- in finiture Optimal aggiunto controllo per bSkipMaxDown.
2025-01-20 11:52:35 +01:00
Riccardo Elitropi 7b02dd3887 Merge commit 'b64b1d3cf0d6fe988934eada417f04219ba30948' into feature/Svuotature 2025-01-20 11:40:42 +01:00
Riccardo Elitropi 4f2c322af8 EgtMachKernel :
- aggiunta finitura Optimal.
2025-01-20 11:40:13 +01:00
Dario Sassi b64b1d3cf0 EgtMachKernel :
- aggiunta gestione nuovo sottotipo di finitura superficie (SURFFIN_SUB_PROJECT), manca relativo calcolo.
2025-01-20 10:51:53 +01:00
Dario Sassi b03aad7ecf EgtMachKernel :
- in fresatura aggiunta gestione speciale attacchi e uscite con elevazione per utensili flottanti (due movimenti consecutivi)
- in generazione/stima e simulazione aggiunto flag EMT.TFLOAT a OnToolSelect/OnSimulToolSelect per indicare utensile flottante.
2025-01-20 08:34:41 +01:00
Dario Sassi 57ec816f06 Merge commit '7a864d95034b894ba832ff41e0f5e775389293dd' 2025-01-10 17:00:00 +01:00
Riccardo Elitropi 7a864d9503 EgtMachKernel :
- in Sgrossature migliorate le gestioni delle Silhouette rispettando la geometria del Tool
- In Finiture, migliorati i controlli per finiture ZConst.
2025-01-10 16:43:59 +01:00
Riccardo Elitropi 25b11fa3cf Merge commit 'f09e1874dfbc3bb1b3a201cc35facadde924a994' into feature/Svuotature 2025-01-10 14:31:34 +01:00
Dario Sassi f09e1874df EgtMachKernel 2.7a1 :
- cambio annuale di versione
- compilazione 32bit senza più limiti per Windows XP.
2025-01-09 18:00:47 +01:00
Dario Sassi 3df067059b EgtMachKernel :
- correzione per consentire verifica aree protette anche in Disposizione per movimento pezzi (marmo).
2025-01-07 09:52:18 +01:00
Riccardo Elitropi a13eb42b3a Merge commit '7d7e3209c0f9b5e0839e739caa55010b7e374f6b' into feature/Svuotature 2025-01-07 08:09:02 +01:00
Dario Sassi 7d7e3209c0 EgtMachKernel :
- aggiustamenti per modifiche a FromString (in caso di errore non inizializza più a 0 il valore di ritorno)
2025-01-06 18:18:00 +01:00
Dario Sassi cb20faa0cc EgtMachKernel :
- piccole migliorie a finitura superfici.
2025-01-02 17:04:41 +01:00
Dario Sassi a60e8e2da7 EgtMachKerenel :
- modifiche a NewLinkMgr, ora con codice 1 controlla le aree protette solo sui link mentre con codice 2 le controlla anche nelle lavorazione (con codice 0 come prima le controlla sempre).
2024-12-31 15:50:57 +01:00
Dario Sassi dee87d0889 Merge commit 'a43a4cb9ac50aff82ba3b7e1e32682a2d96b73bb' 2024-12-31 14:52:02 +01:00
Riccardo Elitropi a43a4cb9ac EgtMachKernel :
- Correzione frame per finiture ZConst.
2024-12-31 14:32:52 +01:00
Dario Sassi bd744a710c EgtMachKernel 2.6l4 :
- quando si applica una lavorazione se non si trova l'utensile con UUID ora lo si cerca con il nome.
2024-12-31 10:48:34 +01:00
Dario Sassi e8664f6cab Merge commit 'e7c2d101117679ea58c315b2673e7bbbd6b68dda' 2024-12-30 19:13:54 +01:00
Riccardo Elitropi e7c2d10111 EgtMachKernel :
- In Sgrossature, aggiunto controllo per piccoli Chunks.
2024-12-30 18:03:14 +01:00
Dario Sassi e8853d1023 Merge commit '0a56d76535d3f45a6218aa0d1aa3bbf7aa8af009' 2024-12-30 16:23:41 +01:00
Riccardo Elitropi 0a56d76535 EgtMachKernel :
- in finiture, migliorie varie.
2024-12-30 16:14:45 +01:00
Riccardo Elitropi 89ed5eeb2f Merge commit '265bce38faf838a05f85c8a23eefceed43e76fa8' into feature/Svuotature 2024-12-24 08:42:58 +01:00
Dario Sassi 265bce38fa EgtMachKernel :
- riportate correzioni a SurfRoughing di RiccardoE
- ulterirori modifiche per NewLinkMgr.
2024-12-23 19:13:55 +01:00
Dario Sassi 14b99c473b EgtMachkernel :
- agli script di ToolMakers ora si passano anche le note utente (TOOL.USERNOTES)
- anche nel movimento manuale assi in simulazione si tiene conto dei limiti di corsa assi eventualmente aggiunti dalla testa
- notevoli migliorie alla nuova gestione dei link tra lavorazioni.
2024-12-23 12:09:11 +01:00
Riccardo Elitropi 4cad8af916 Merge commit 'd08a7b20359a0461a10ade9b264ba9494420bae4' into feature/Svuotature 2024-12-23 08:38:14 +01:00
Dario Sassi d08a7b2035 EgtMachKernel :
- migliorie e correzioni a nuova gestione collegamenti tra lavorazioni.
2024-12-17 10:22:00 +01:00
Dario Sassi 6c90189051 EgtMachKernel 2.6l3 :
- prima versione nuova gestione collegamenti tra lavorazioni (NewLinkMgr=1).
2024-12-13 16:42:31 +01:00
Dario Sassi 2c44adf99c Merge commit '87666ea59c0dc3ecd043d940ec32072a38cd4365' 2024-12-13 15:34:27 +01:00
Riccardo Elitropi 87666ea59c EgtMachKernel :
- migliorata gestione sgrossature
- aggiunta lavorazione di finitura ZConst.
2024-12-12 11:49:50 +01:00
Dario Sassi 409ba0d5db EgtMachKernel :
- a OnVerifyProtectedAreas ora vengono passati anche testa, uscita e utensile.
2024-12-11 13:21:44 +01:00
Riccardo Elitropi 9759656f80 Merge commit '646f5cf02f38cf6698967ff90e63cded154756e9' into feature/Svuotature 2024-12-11 11:26:50 +01:00
Dario Sassi 646f5cf02f EgtMachKernel :
- corretta gestione approccio/retrazione frese notip da sotto con testa da sopra e viceversa
- prima versione della nuova gestione dei collegamenti tra lavorazioni e con cambio utensile.
2024-12-10 17:31:46 +01:00
Riccardo Elitropi 5110f70253 Merge commit 'd0b78e58254a806b2db47a65f0e82e5f89ed7b56' into feature/Svuotature 2024-12-05 08:30:05 +01:00
Dario Sassi d0b78e5825 EgtMachKernel :
- aggiunto a MachMgr/IMachMgr il metodo GetClEntAxesStatus.
2024-12-04 15:08:05 +01:00
Dario Sassi 0095847b41 EgtMachKernel 2.6l2 :
- modifiche a tagli con lama per eliminare approcci/retrazioni con attacco e uscita fuori grezzo e tipologia ToAndFrom
- aggiunte gestione nuove costanti (SURFFIN_SUB_Z_CONST e SURFFIN_SUB_OPTIMAL) per tipo finitura superfici.
2024-12-04 10:11:14 +01:00
Dario Sassi 9feb8b584c EgtMachKernel 2.6l1 :
- ricompilazione con cambio versione.
2024-11-29 18:55:26 +01:00
Dario Sassi be78774e05 Merge commit '70f32557aca7d41cb9cf906556ce85a7fb4d31d0' 2024-11-27 16:57:58 +01:00
Riccardo Elitropi 70f32557ac EgtMachKernel :
- in SurfRoughing, rilassamento dei vincoli di approssimazione di curve e superfici.
2024-11-27 16:04:44 +01:00
Riccardo Elitropi 6ad07c2443 Merge commit '9f7ba94811dd621b8a38378b3c22f0c0f09601ce' into feature/Svuotature 2024-11-27 11:50:32 +01:00
Dario Sassi 9f7ba94811 EgtMachKernel :
- correzione foratura multipla (Riccardo E.)
- aggiunta gestione fori non lavorati per foratura multipla (GetMachiningSkippedGeometry).
2024-11-25 15:02:41 +01:00
Dario Sassi 1d20f9afe0 EgtMachKernel 2.6k5 :
- in fresatura corretto approccio/retrazione per utensili tipo lama (distanza iniziale da inizializzare).
2024-11-20 12:16:48 +01:00
Dario Sassi f095d6caaf EgtMachKernel 2.6k4 :
- modifiche a SimulatorMP per file stima speciale con path specifica (EMT.MPSEST) per poter funzionare in modalità multitask.
2024-11-18 10:56:43 +01:00
Riccardo Elitropi 61fa524332 Merge commit '3c241080d03db56f3b300155af897189764eac0a' into feature/Svuotature 2024-11-18 08:24:18 +01:00
Dario Sassi 3c241080d0 EgtMachKernel :
- ulteriori correzioni a Simulatore MP.
2024-11-16 13:05:37 +01:00
Dario Sassi 3aab2b94fc EgtMachKernel :
- migliorie a simulazione MP.
2024-11-16 11:04:49 +01:00
Dario Sassi 50c19b2ea3 Merge commit '271db2371756ddc60dd99566b70efe677a275a2c' 2024-11-16 10:10:24 +01:00
Riccardo Elitropi 271db23717 EgtMachKernel :
- migliorate le forature multiple.
2024-11-15 17:06:25 +01:00
Riccardo Elitropi 0868600687 Merge commit '33701162bf14c622d81f71bc5ed9740fc0c4791d' into feature/Svuotature 2024-11-11 09:52:36 +01:00
Dario Sassi 33701162bf EgtMachKernel 2.6k3 :
- modifiche per simulazione multi-processo.
2024-11-11 00:44:31 +01:00
Dario Sassi 77a61447c6 EgtMachKernel 2.6k2 :
- correzione in Drilling per multiforatura con tre assi rotanti di cui uno bloccato.
2024-11-09 10:34:47 +01:00
Dario Sassi b6f96e3d37 EgtMachKernel 2.6k1 :
- in simulatore MP lancio stima speciale prima di avvio.
2024-11-07 12:25:38 +01:00
Dario Sassi 6d936dede4 EgtMachKernel :
- aggiunta funzione SetFixtureMobile
- migliorato controllo movimento morse (introdotti minimo e massimo).
2024-10-31 18:31:49 +01:00
Dario Sassi b157cc66ec EgtMachKernel 2.6j4 :
- corretto sistema di aggiornamento automatico lavorazioni.
2024-10-31 08:38:01 +01:00
Riccardo Elitropi 130093561e Merge commit '47baf33ac2955f9865fa3285731fba22ec818a96' into feature/Svuotature 2024-10-28 08:24:34 +01:00
Dario Sassi 47baf33ac2 EgtMachKernel :
- in fresatura 5 assi ora le lame sono gestite sul punto di contatto come percorso di lavoro (come in fresature standard).
2024-10-27 18:39:03 +01:00
Dario Sassi 422d30e44d EgtMachKernel :
- consentito utilizzo lame in lavorazioni 5assi (per la pietra).
2024-10-25 17:18:02 +02:00
Dario Sassi 8cc41bd495 Merge remote-tracking branch 'origin/feature/Svuotature' 2024-10-25 17:02:05 +02:00
Riccardo Elitropi ca81e7e5ab EgtMachKernel :
- in sgrossature di superfici, aggiunta gestione note utenti per PlaneZ.
2024-10-25 15:15:25 +02:00
Riccardo Elitropi f1b66dc020 EgtMachKernel :
- in sgrossature di superfici, correzione errori su PlaneZ.
2024-10-25 13:28:27 +02:00
Riccardo Elitropi 3df4b5a210 Merge commit '47f442921eb64f15e3abafaa0e34fb3f2b8433cf' into feature/Svuotature 2024-10-21 08:22:27 +02:00
Dario Sassi 47f442921e EgtMachKernel :
- piccola modifica per evitare crash (da verificare bene),
2024-10-19 17:59:02 +02:00
Dario Sassi 7f0e30a8ec Merge commit 'd5ba4958509b8e040d7d711162e81eb0d106347e' 2024-10-19 17:08:19 +02:00
Riccardo Elitropi d5ba495850 EgtMachKernel :
- in Sgrossature aggiunto PlaneZDetection.
2024-10-18 11:28:35 +02:00
Riccardo Elitropi fd084c55f5 Merge commit '1497d7bb257d099a78f37b4b95853b4a97934204' into feature/Svuotature 2024-10-18 09:14:00 +02:00
Dario Sassi 1497d7bb25 EgtMachKernel :
- modifiche e migliorie per gestione assi di disposizione dipendenti dalla tavola.
2024-10-16 19:49:10 +02:00
Dario Sassi ab63e1908c EgtMachKernel :
- aggiunto controllo che gli assi mossi in Disposition siano assi dipendenti dalla tavola (MachMgr::IsDispositionAxis).
2024-10-16 17:11:50 +02:00
Riccardo Elitropi 505a8bd7b2 Merge commit 'e39426da0a7b2236409d08e4a0aec4b3eb77a1d1' into feature/Svuotature 2024-10-16 12:12:30 +02:00
Dario Sassi e39426da0a EgtMachKernel 2.6j3 :
- aggiunta in interfaccia funzione GetAxisDir.
2024-10-15 17:34:35 +02:00
Riccardo Elitropi 373c3ef7f4 Merge commit 'd2bf6a4cec275c4abca01f90fe6083fc99ee02f9' into feature/Svuotature 2024-10-11 08:35:55 +02:00
Dario Sassi d2bf6a4cec EgtMachKernel 2.6j2 :
- aggiunta gestione assi ausiliari di tavola da comandi Disp (MoveDispAxis e RemoveDispAxis)
- aggiunta funzione per avere dati eventuali utensile, testa e uscita associato a disposizione.
2024-10-10 15:45:05 +02:00
Dario Sassi 2d2f44f9aa Merge commit 'f9a496b41022dbad95699b10d6dfdcc29a0172d2' 2024-10-10 15:04:50 +02:00
Riccardo Elitropi f9a496b410 EgtMachKernel :
- in sgrossature, aggiunto ulteriore controllo su MaxOffs per i Chunk.
2024-10-10 13:00:06 +02:00
Dario Sassi 8be11025e7 Merge commit '36db2d068c3cf16ef8720cc1de566711d945903c' 2024-10-09 10:55:03 +02:00
Riccardo Elitropi 36db2d068c EgtMachKernel :
- prima modifica per PocketingNT.
2024-10-09 08:34:29 +02:00
Riccardo Elitropi 329d588eeb Merge commit '96d7edc513e9ce3f5923259a764b49ffc88b8278' into feature/Svuotature 2024-10-07 08:22:09 +02:00
Dario Sassi 96d7edc513 EgtMachKernel :
- corretto assegnamento codici di errore 1000 (No Nc generation), 1001 (No Advanced Machinings), 1002 (Error with Setup) e 1003 (Error opening Nc file).
2024-10-06 18:13:14 +02:00
Dario Sassi 3d420918f4 Merge commit '977e22a02f9463dbfcdf3307b92383736b178783' 2024-10-04 17:14:30 +02:00
Riccardo Elitropi 977e22a02f EgtMachKernel :
- In sgrossature sostituti i movimenti rapidi per collisioni nei collegamenti tra steps.
2024-10-04 12:59:19 +02:00
Dario Sassi c6f6f54009 Merge commit 'fb7ee5e7c1d0f20d591eb4de6201dcad93d097e6' 2024-10-03 11:10:26 +02:00
Riccardo Elitropi fb7ee5e7c1 EgtMachKernel :
- in Sgrossature corretta la Feed per approcci.
2024-10-03 10:46:56 +02:00
Dario Sassi 45bd5d64e6 Merge commit 'df1d21356f1bb9e7822327ef4b74ed176aa33cc0' 2024-10-03 10:16:21 +02:00
Riccardo Elitropi df1d21356f EgtMachKernel :
- in Sgrossature piccola modifica alle Elevazioni.
2024-10-03 10:09:24 +02:00
Riccardo Elitropi 0406a5b330 Merge commit 'ae24d97c6ebd7ae561a0f809e9950637ea6781e1' into feature/Svuotature 2024-10-03 09:08:02 +02:00
Dario Sassi ae24d97c6e EgtMachKernel :
- corretto controllo bit licenza per generazione CN e per lavorazioni avanzate.
2024-10-02 18:03:45 +02:00
Dario Sassi edd3f623c7 Merge commit '2a2b0e5d7eb846e93cf590d8d91d0a5e17317797' 2024-10-02 17:40:11 +02:00
Riccardo Elitropi 2a2b0e5d7e EgtMachKernel :
- Modifica del calcolo della superficie limite in Sgrossature.
2024-10-02 13:16:07 +02:00
Dario Sassi 93598217a4 EgtMachKernel 2.6j1 :
- foro con profondità non nulla ma con MaxElev=0; ora viene lavorato lo stesso.
2024-10-02 09:00:54 +02:00
Dario Sassi 05f96209f7 EgtMachKernel :
- aggiunto controllo abilitazione lavorazioni avanzate in simulazione, stima e generazione.
2024-10-01 13:11:39 +02:00
Riccardo Elitropi 06d591cc8f EgtMachKernel :
- In Sgrossature, migliorie sulla gestione dei lati chiusi e degli Step.
2024-10-01 12:44:56 +02:00
Riccardo Elitropi 4d709418e5 EgtMachKernel :
- modifica nomi delle strutture per evitare conflitti.
2024-09-27 08:15:12 +02:00
Riccardo Elitropi f22954bf63 Merge commit '2e6abe561d494f86e419efa1fefffdea4ccb3f05' into feature/Svuotature 2024-09-27 08:13:47 +02:00
Dario Sassi 2e6abe561d EgtMachKernel 2.6i3 :
- riportata in PocketingNT da Pocketing la correzione per caso limite dimensione tasca quasi uguale a dimensione utensile
- ricompilato con POCKETING_NT 0 per abilitare vecchio Pocketing.
2024-09-26 20:00:17 +02:00
Dario Sassi 3b5b1211a3 Merge commit 'e2e246f3f4b4077626ea0695eadf5077f67ac896' 2024-09-26 18:43:26 +02:00
Dario Sassi 3df6059071 EgtMachKernel :
- miglioria a svuotature per caso limite dimensione tasca quasi uguale a dimensione utensile.
2024-09-25 10:44:55 +02:00
Dario Sassi 425c24ef4c EgtMachKernel :
- modifiche per simulazione MP.
2024-09-24 18:24:22 +02:00
Riccardo Elitropi e2e246f3f4 EgtMachKernel :
- definizione di PocketingNT.
2024-09-23 11:16:08 +02:00
66 changed files with 12456 additions and 1956 deletions
+11 -5
View File
@@ -503,13 +503,15 @@ Chiseling::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
( 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 ;
@@ -767,10 +769,14 @@ Chiseling::UpdateToolData( bool* pbChanged)
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 ;
+268 -47
View File
@@ -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" ;
@@ -92,6 +98,7 @@ Disposition::Clone( void) const
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 ;
@@ -120,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) + "," ;
@@ -159,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 ;
@@ -177,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 ;
@@ -184,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
@@ -237,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) {
@@ -256,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) {
@@ -435,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
@@ -442,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
@@ -452,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 ;
}
}
@@ -474,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 ;
@@ -520,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,
@@ -617,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 ;
@@ -734,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)
@@ -744,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 ;
}
}
@@ -807,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
@@ -823,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 ;
}
}
@@ -1246,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)
@@ -1263,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 ;
}
@@ -1377,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
@@ -1421,18 +1642,18 @@ Disposition::SpecialUpdate( void)
if ( ! CalculateAxesValues( "", false)) {
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
+21 -2
View File
@@ -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) {}
} ;
@@ -88,13 +101,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) ;
@@ -104,8 +121,9 @@ class Disposition : public Operation
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) ;
@@ -126,6 +144,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
+1618 -360
View File
File diff suppressed because it is too large Load Diff
+57 -18
View File
@@ -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
{
@@ -68,6 +77,7 @@ class Drilling : public Machining
bool UpdateToolData( bool* pbChanged = nullptr) override ;
const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ;
bool GetSkippedGeometry( SELVECTOR& vIds) const override ;
public :
Drilling( void) ;
@@ -80,18 +90,44 @@ 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, const Vector3d& vtA) ;
bool DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHOff, const Vector3d& vtA) ;
bool MultiHeadDrilling( const SELVECTOR& vId, int nClId, TABMHDRILL& vDrills, double& dMHOff, bool bOrd = true) ;
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 VerifyMultiParallelFixedDrills( void) ;
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) ;
/* debug functions */
void PrintConfigs( const VECTORHOLE& vHoles) ;
void PrintDescent( const MHDrill& myMHDescent) ;
/* end debug functions */
private :
double GetSpeed() const
@@ -106,16 +142,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
} ;
BIN
View File
Binary file not shown.
+2 -2
View File
@@ -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
+5 -3
View File
@@ -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>
@@ -275,6 +275,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="OperationCL.cpp" />
<ClCompile Include="Pocketing.cpp" />
<ClCompile Include="PocketingData.cpp" />
<ClCompile Include="PocketingNT.cpp" />
<ClCompile Include="Processor.cpp" />
<ClCompile Include="SawFinishing.cpp" />
<ClCompile Include="SawFinishingData.cpp" />
@@ -448,6 +449,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="OutputConst.h" />
<ClInclude Include="Pocketing.h" />
<ClInclude Include="PocketingData.h" />
<ClInclude Include="PocketingNT.h" />
<ClInclude Include="Processor.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="SawFinishing.h" />
+6
View File
@@ -249,6 +249,9 @@
<ClCompile Include="SimulatorMP.cpp">
<Filter>Source Files\Output</Filter>
</ClCompile>
<ClCompile Include="PocketingNT.cpp">
<Filter>Source Files\Operations</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="DllMain.h">
@@ -761,6 +764,9 @@
<ClInclude Include="Simulator.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PocketingNT.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="EgtMachKernel.rc">
+76 -12
View File
@@ -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)
+1
View File
@@ -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 ;
+42 -5
View File
@@ -540,6 +540,21 @@ FiveAxisMilling::Preview( bool bRecalc)
//----------------------------------------------------------------------------
bool
FiveAxisMilling::Apply( bool bRecalc, bool bPostApply)
{
// se calcoli già in corso, esco
if ( m_bRunning) {
LOG_DBG_INFO( GetEMkLogger(), "FiveAxisMilling::Apply already running") ;
return true ;
}
m_bRunning = true ;
bool bOk = MyApply( bRecalc, bPostApply) ;
m_bRunning = false ;
return bOk ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMilling::MyApply( bool bRecalc, bool bPostApply)
{
// reset numero percorsi di lavoro generati
int nCurrMills = m_nMills ;
@@ -564,13 +579,15 @@ FiveAxisMilling::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
// confermo i percorsi di lavorazione
m_nMills = nCurrMills ;
LOG_DBG_INFO( GetEMkLogger(), "FiveAxisMilling apply skipped : status already ok") ;
string sLog = string( "FiveAxisMilling 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 ;
@@ -664,9 +681,13 @@ FiveAxisMilling::Apply( bool bRecalc, bool bPostApply)
// assegno ingombri dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetBBox( nClId) ;
ExeProcessEvents( 80, 0) ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply))
return false ;
ExeProcessEvents( 100, 0) ;
// aggiorno stato della lavorazione
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
@@ -861,10 +882,14 @@ FiveAxisMilling::UpdateToolData( bool* pbChanged)
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 ;
@@ -917,6 +942,18 @@ FiveAxisMilling::GetGeometry( SELVECTOR& vIds) const
return true ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMilling::AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const
{
// se utensile lama
if ( ( m_TParams.m_nType & TF_SAWBLADE) != 0) {
// compenso il raggio dell'utensile
ptP += pCamData->GetCorrDir() * ( m_TParams.m_dDiam / 2) ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMilling::VerifyGeometry( SelData Id, int& nSubs, int& nType)
+3
View File
@@ -43,6 +43,7 @@ class FiveAxisMilling : public Machining
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 ;
@@ -66,6 +67,7 @@ class FiveAxisMilling : public Machining
FiveAxisMilling( void) ;
private :
bool MyApply( bool bRecalc, bool bPostApply) ;
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
double GetApproxLinTol( void) const override ;
@@ -91,4 +93,5 @@ class FiveAxisMilling : public Machining
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
} ;
+1 -1
View File
@@ -324,7 +324,7 @@ FiveAxisMillingData::VerifyTool( const ToolsMgr* pToolsMgr, const string& sVal,
pTdata = pToolsMgr->GetTool( sVal) ;
if ( pTdata == nullptr)
return false ;
if ( ( pTdata->m_nType & TF_MILL) == 0)
if ( ( pTdata->m_nType & TF_MILL) == 0 && ( pTdata->m_nType & TF_SAWBLADE) == 0)
return false ;
return true ;
}
+11 -5
View File
@@ -557,13 +557,15 @@ GenMachining::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
( 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 ;
@@ -854,10 +856,14 @@ GenMachining::UpdateToolData( bool* pbChanged)
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 ;
+32 -6
View File
@@ -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 ;
@@ -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)
+1
View File
@@ -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 ;
+3
View File
@@ -16,6 +16,9 @@
//----------------- 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 ;
+1
View File
@@ -143,6 +143,7 @@ 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)
+16 -3
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2024
//----------------------------------------------------------------------------
// File : MachMgr.h Data : 22.04.24 Versione : 2.6d4
// File : MachMgr.h Data : 25.11.24 Versione : 2.6k5
// Contenuto : Dichiarazione della classe MachMgr.
//
//
@@ -16,6 +16,7 @@
// 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.
//
//----------------------------------------------------------------------------
@@ -156,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 ;
@@ -164,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 ;
@@ -279,6 +285,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 ;
@@ -305,6 +312,7 @@ class MachMgr : public IMachMgr
bool GetMachiningParam( int nType, double& dVal) const override ;
bool GetMachiningParam( int nType, std::string& sVal) const override ;
bool GetMachiningGeometry( SELVECTOR& vIds) const override ;
bool GetMachiningSkippedGeometry( SELVECTOR& vIds) const override ;
bool IsMachiningEmpty( void) const override ;
bool GetMachiningStartPoint( Point3d& ptStart) const override ;
bool GetMachiningEndPoint( Point3d& ptEnd) const override ;
@@ -312,6 +320,7 @@ class MachMgr : public IMachMgr
bool GetClEntMove( int nEntId, int& nMove) const override ;
bool GetClEntFlag( int nEntId, int& nFlag, int& nFlag2) const override ;
bool GetClEntIndex( int nEntId, int& nIndex) 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 ;
// Simulation
@@ -367,6 +376,7 @@ class MachMgr : public IMachMgr
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 ;
@@ -447,6 +457,8 @@ class MachMgr : public IMachMgr
int GetCurrRotAxes( void) 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 GetCurrIsCenter( void) const ;
bool GetCurrIsRobot( void) const ;
@@ -475,9 +487,10 @@ class MachMgr : public IMachMgr
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) ;
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 GetAngDeltaMinForHome( void) const ;
+18
View File
@@ -76,6 +76,24 @@ MachMgr::GetClEntIndex( int nEntId, int& nIndex) const
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
+4
View File
@@ -667,6 +667,7 @@ 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) ;
switch ( nType) {
case TT_DRILL_STD :
case TT_DRILL_LONG :
@@ -762,6 +763,8 @@ MachMgr::UpdateCustomToolDraw( const ToolData* pTdata, int nGenCtx, int nToolCtx
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 ;
@@ -772,6 +775,7 @@ MachMgr::UpdateCustomToolDraw( const ToolData* pTdata, int nGenCtx, int nToolCtx
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
+75 -4
View File
@@ -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
+1 -10
View File
@@ -28,18 +28,9 @@ MachMgr::Generate( const string& sCncFile, const string& sInfo)
{
// se macchina multiprocesso è necessaria stima speciale
if ( GetCurrMachine() != nullptr && GetCurrMachine()->GetMultiProcess()) {
// inizializzazione stimatore
Estimator estPP ;
if ( ! estPP.Init( this)) {
LOG_ERROR( GetEMkLogger(), "Error on Estimate Init")
return false ;
}
// esecuzione della stima
string sEstFile = ChangeFileExtension( sCncFile, "sest") ;
if ( ! estPP.Run( sEstFile, sInfo)) {
LOG_ERROR( GetEMkLogger(), "Error on Estimate Run")
if ( ! Estimate( sEstFile, sInfo))
return false ;
}
}
// inizializzazione generatore
+42 -2
View File
@@ -330,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
@@ -398,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) ;
}
//----------------------------------------------------------------------------
@@ -687,6 +711,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
+29
View File
@@ -601,6 +601,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 +673,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
//----------------------------------------------------------------------------
@@ -1248,6 +1261,22 @@ MachMgr::GetMachiningGeometry( SELVECTOR& vIds) const
return pMch->GetGeometry( vIds) ;
}
//----------------------------------------------------------------------------
bool
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( void) const
+2 -2
View File
@@ -737,8 +737,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))) ;
+1
View File
@@ -155,6 +155,7 @@ MachMgr::UpdateCurrSetup( void)
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
pMch->ResetCurrTool() ;
return pMch->LoadAllTools() ;
}
+2 -2
View File
@@ -223,11 +223,11 @@ MachMgr::SimMoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
//----------------------------------------------------------------------------
bool
MachMgr::SimSaveCmd( int nType, int nPar, const string& sPar)
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) ;
return m_pSimul->SaveCmd( nType, nPar, sPar, sPar2) ;
}
+4 -3
View File
@@ -42,6 +42,7 @@ Machine::Machine( void)
m_dExitMaxRotAdj = 10 * EPS_ANG_SMALL ;
m_dAngDeltaMinForHome = INFINITO ;
m_nMultiProcess = 0 ;
m_nNewLinkMgr = 0 ;
m_nCalcTabId = GDB_ID_NULL ;
m_nCalcHeadId = GDB_ID_NULL ;
m_nCalcExitId = GDB_ID_NULL ;
@@ -143,7 +144,7 @@ Machine::Init( const string& sMachineName, const string& sMachineDir, MachMgr* p
// 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 ;
@@ -1004,8 +1005,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)
+26 -16
View File
@@ -50,6 +50,7 @@ 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) ; }
@@ -60,6 +61,20 @@ class Machine
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 ;
@@ -73,6 +88,8 @@ class Machine
{ return m_dAngDeltaMinForHome ; }
bool GetMultiProcess( int nOpt = 1) const
{ return ( m_nMultiProcess >= nOpt) ; }
bool GetNewLinkMgr( int nOpt = 1) const
{ return ( m_nNewLinkMgr >= nOpt) ; }
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) ;
@@ -85,13 +102,16 @@ class Machine
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 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 ;
@@ -110,6 +130,7 @@ 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
@@ -161,7 +182,7 @@ class Machine
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 ;
bool VerifyProtectedAreas( double dX, double dY, double dZ, const DBLVECTOR& vAng, int& nStat) ;
bool VerifyProtectedAreas( double dX, double dY, double dZ, const DBLVECTOR& vAng, int nLinkType, int& nStat) ;
bool VerifyOutstroke( const std::string& sAxName, double dVal) const ;
std::string GetOutstrokeInfo( bool bMM = true) const ;
void ResetOutstrokeInfo( void) const
@@ -232,24 +253,11 @@ class Machine
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) ;
@@ -258,6 +266,7 @@ class Machine
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,
@@ -293,7 +302,8 @@ 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 ; // flag di macchina multi-processo con stima speciale prima di generazione e simulazione ad hoc
int m_nMultiProcess ; // codice di macchina multi-processo (con stima speciale e simulazione ad hoc)
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
+108 -14
View File
@@ -23,6 +23,22 @@
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
@@ -34,10 +50,22 @@ Machine::GetAllAxesNames( STRVECTOR& vNames) const
if ( IsAxisGroup( snGro.second))
vNames.push_back( snGro.first) ;
}
// ordino alfabeticamente
// 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
@@ -47,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
@@ -63,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
@@ -79,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
@@ -95,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
@@ -103,6 +131,22 @@ Machine::GetAxisType( const string& sAxis, bool& bLinear) const
return true ;
}
//----------------------------------------------------------------------------
bool
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)
@@ -122,6 +166,15 @@ Machine::SetAxisPos( const string& sAxis, double dVal, bool bInStroke, double* p
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)) ;
@@ -130,8 +183,9 @@ Machine::SetAxisPos( const string& sAxis, double dVal, bool bInStroke, double* p
Point3d ptPos = pGV->GetBase() ;
Vector3d vtDir = pGV->GetVector() ;
vtDir.Normalize() ;
// limito il movimento alla corsa dell'asse
dVal = Clamp( dVal, Stroke.Min, Stroke.Max) ;
// 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)) ;
@@ -152,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
@@ -168,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
@@ -184,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
@@ -200,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
@@ -208,6 +262,42 @@ Machine::GetAxisHomePos( const string& sAxis, double& dHomeVal) const
return true ;
}
//----------------------------------------------------------------------------
bool
Machine::IsDispositionAxis( int nAxisId, int nTableId) const
{
// 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)
@@ -225,13 +315,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 ;
+34 -4
View File
@@ -48,6 +48,7 @@ static const string EVAR_R1 = ".R1" ; // (num) valore del pri
static const string EVAR_R2 = ".R2" ; // (num) valore del secondo asse rotante
static const string EVAR_R3 = ".R3" ; // (num) valore del terzo asse rotante
static const string EVAR_R4 = ".R4" ; // (num) valore del quarto asse rotante
static const string EVAR_LINKTYPE = ".LINKTYPE" ; // (int) tipo collegamento (0=No, 1=Inizio, 2=Fine, 3=Link))
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok)
static const string EVAR_STAT = ".STAT" ; // OUT (int) codice di stato ( 0 = ok)
static const string EVAR_AUXINFO = ".AUXINFO" ; // OUT (string) stringa con info ausiliarie
@@ -480,11 +481,20 @@ Machine::GetCurrHeadCollGroups( INTVECTOR& vIds) const
//----------------------------------------------------------------------------
bool
Machine::CalculateKinematicChain( void)
Machine::IsCurrToolFloating( void) const
{
// controllo GeomDB
if ( m_pGeomDB == nullptr)
return false ;
// leggo info con tipo
string sType ;
return ( m_pGeomDB->GetInfo( m_nCalcToolId, TTH_TYPE, sType) && sType == TTH_TYPE_FLOAT) ;
}
//----------------------------------------------------------------------------
bool
Machine::ClearKinematicChain( void)
{
// azzero tutti gli assi della catena cinematica
m_nTabLinAxes = 0 ;
m_nTabRotAxes = 0 ;
@@ -496,6 +506,18 @@ Machine::CalculateKinematicChain( void)
m_frLinAx.Reset( false) ;
m_frRobot.Reset( false) ;
m_nCalcChainType = KIN_CHAIN_NONE ;
return true ;
}
//----------------------------------------------------------------------------
bool
Machine::CalculateKinematicChain( void)
{
// controllo GeomDB
if ( m_pGeomDB == nullptr)
return false ;
// azzero tutti gli assi della catena cinematica
ClearKinematicChain() ;
// recupero gli assi di tavola
if ( m_nCalcTabId == GDB_ID_NULL)
return false ;
@@ -1718,7 +1740,7 @@ Machine::VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng
}
// verifica delle aree protette
if ( nStat == 0)
return const_cast<Machine*>( this)->VerifyProtectedAreas( dX, dY, dZ, vAng, nStat) ;
return const_cast<Machine*>( this)->VerifyProtectedAreas( dX, dY, dZ, vAng, 0, nStat) ;
return true ;
}
@@ -1732,19 +1754,26 @@ Machine::VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng
//----------------------------------------------------------------------------
bool
Machine::VerifyProtectedAreas( double dX, double dY, double dZ, const DBLVECTOR& vAng, int& nStat)
Machine::VerifyProtectedAreas( double dX, double dY, double dZ, const DBLVECTOR& vAng, int nLinkType, int& nStat)
{
// se non esiste funzione gestione aree protette, non devo fare alcunchè
if ( ! LuaExistsFunction( ON_VERIFY_PROTECTEDAREAS))
return true ;
// se non è collegamento e aree protette solo per questi, non devo fare alcunchè
if ( nLinkType == 0 && m_nNewLinkMgr == 1)
return true ;
// default
bool bOk = true ;
int nErr = 99 ;
// salvo eventuale variabile EMC_VAR già presente
bool bOldEMC = LuaChangeNameGlobVar( EMC_VAR, EMC_VAR_BACKUP) ;
// definisco variabili
// definisco variabili (nelle disposizioni l'utensile non è definito e non ha nome)
string sTool, sHead ; int nExit ;
bOk = bOk && LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_VER, GetEMkVer()) ;
bOk = bOk && GetCurrHead( sHead) && LuaSetGlobVar( EMC_VAR + EVAR_HEAD, sHead) ;
bOk = bOk && GetCurrExit( nExit) && LuaSetGlobVar( EMC_VAR + EVAR_EXIT, nExit) ;
bOk = bOk && ( GetCurrTool( sTool) || true) && LuaSetGlobVar( EMC_VAR + EVAR_TOOL, sTool) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_L1, dX) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_L2, dY) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_L3, dZ) ;
@@ -1756,6 +1785,7 @@ Machine::VerifyProtectedAreas( double dX, double dY, double dZ, const DBLVECTOR&
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_R3, vAng[2]) ;
if ( vAng.size() >= 4)
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_R4, vAng[3]) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_LINKTYPE, nLinkType) ;
// chiamo funzione
bOk = bOk && LuaCallFunction( ON_VERIFY_PROTECTEDAREAS) ;
// recupero il risultato
+3 -1
View File
@@ -182,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))
@@ -191,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) ;
+43 -2
View File
@@ -37,6 +37,7 @@ 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_NEWLINKMGR = "NewLinkMgr" ;
static const string FLD_NAME = "Name" ;
static const string FLD_PARENT = "Parent" ;
static const string FLD_GEO = "Geo" ;
@@ -350,6 +351,10 @@ Machine::LuaEmtGeneral( lua_State* L)
// 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 'NewLinkMgr' dalla tabella (0=old, 1 =new)
int nNewLinkMgr = 0 ;
LuaGetTabFieldParam( L, 1, FLD_NEWLINKMGR, nNewLinkMgr) ;
// pulizia stack
LuaClearStack( L) ;
// info
@@ -399,8 +404,10 @@ Machine::LuaEmtGeneral( lua_State* L)
// imposto minima differenza angolare da posizione precedente per stare vivino a posizione home
m_pMchLua->m_dAngDeltaMinForHome = dAngDeltaMinForHome ;
// imposto flag per macchina multiprocesso
// imposto codice per macchina multiprocesso
m_pMchLua->m_nMultiProcess = nMultiProcess ;
// imposto codice per gestione link tra lavorazioni
m_pMchLua->m_nNewLinkMgr = nNewLinkMgr ;
return 0 ;
}
@@ -1574,12 +1581,46 @@ Machine::LuaEmtSaveCmd( lua_State* L)
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)) ;
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimSaveCmd( nType, nPar, sPar, sPar2)) ;
// assegno risultato
LuaSetParam( L, bOk) ;
return 1 ;
+4
View File
@@ -153,3 +153,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" ;
+126 -63
View File
@@ -211,53 +211,74 @@ Machining::GetToolPreviewStepCount( void) const
}
//----------------------------------------------------------------------------
static int
GetToolPreviewNext( IGeomDB* pGeomDB, int nEntId, int nParentId)
int
Machining::GetToolPreviewNext( int nEntId, int nParentId, int nStId) const
{
// recupero la successiva
int nNewId = (( nEntId != GDB_ID_NULL) ? pGeomDB->GetNext( nEntId) : pGeomDB->GetFirstInGroup( nParentId)) ;
int nNewId = (( nEntId != GDB_ID_NULL) ? m_pGeomDB->GetNext( nEntId) : m_pGeomDB->GetFirstInGroup( nParentId)) ;
int nNewParentId = nParentId ;
// ciclo nei gruppi successivi
do {
// ciclo nel gruppo
while ( nNewId != GDB_ID_NULL) {
string sName ; pGeomDB->GetName( nNewId, sName) ;
string sName ; m_pGeomDB->GetName( nNewId, sName) ;
if ( sName != MCH_CL_CLIMB && sName != MCH_CL_RISE)
break ;
nNewId = pGeomDB->GetNext( nNewId) ;
nNewId = m_pGeomDB->GetNext( nNewId) ;
}
// se trovata, esco
if ( nNewId != GDB_ID_NULL)
if ( nNewId != GDB_ID_NULL) {
// se prima entità, eventuale attivazione uscite di gruppo a forare
if ( nEntId == GDB_ID_NULL && m_pGeomDB->ExistsInfo( nNewParentId, KEY_DRACEX)) {
INTVECTOR vActExit ;
if ( m_pGeomDB->GetInfo( nNewParentId, KEY_DRACEX, vActExit))
ActivateDrillingUnit( nStId, vActExit) ;
}
return nNewId ;
}
// passo al gruppo successivo
nNewParentId = m_pGeomDB->GetNextGroup( nNewParentId) ;
// eventuale attivazione uscite di gruppo a forare
if ( m_pGeomDB->ExistsInfo( nNewParentId, KEY_DRACEX)) {
INTVECTOR vActExit ;
if ( m_pGeomDB->GetInfo( nNewParentId, KEY_DRACEX, vActExit))
ActivateDrillingUnit( nStId, vActExit) ;
}
// recupero la prima entità del successivo gruppo
nNewParentId = pGeomDB->GetNextGroup( nNewParentId) ;
nNewId = pGeomDB->GetFirstInGroup( nNewParentId) ;
nNewId = m_pGeomDB->GetFirstInGroup( nNewParentId) ;
} while ( nNewId != GDB_ID_NULL) ;
return GDB_ID_NULL ;
}
//----------------------------------------------------------------------------
static int
GetToolPreviewPrev( IGeomDB* pGeomDB, int nEntId, int nParentId)
int
Machining::GetToolPreviewPrev( int nEntId, int nParentId, int nStId) const
{
// recupero la precedente
int nNewId = (( nEntId != GDB_ID_NULL) ? pGeomDB->GetPrev( nEntId) : pGeomDB->GetLastInGroup( nParentId)) ;
int nNewId = (( nEntId != GDB_ID_NULL) ? m_pGeomDB->GetPrev( nEntId) : m_pGeomDB->GetLastInGroup( nParentId)) ;
int nNewParentId = nParentId ;
// ciclo nei gruppi precedenti
do {
// ciclo nel gruppo
while ( nNewId != GDB_ID_NULL) {
string sName ; pGeomDB->GetName( nNewId, sName) ;
string sName ; m_pGeomDB->GetName( nNewId, sName) ;
if ( sName != MCH_CL_CLIMB && sName != MCH_CL_RISE)
break ;
nNewId = pGeomDB->GetPrev( nNewId) ;
nNewId = m_pGeomDB->GetPrev( nNewId) ;
}
// se trovata, esco
if ( nNewId != GDB_ID_NULL)
return nNewId ;
// passo al gruppo precedente
nNewParentId = m_pGeomDB->GetPrevGroup( nNewParentId) ;
// eventuale attivazione uscite di gruppo a forare
if ( m_pGeomDB->ExistsInfo( nNewParentId, KEY_DRACEX)) {
INTVECTOR vActExit ;
if ( m_pGeomDB->GetInfo( nNewParentId, KEY_DRACEX, vActExit))
ActivateDrillingUnit( nStId, vActExit) ;
}
// recupero l'ultima entità del precedente gruppo
nNewParentId = pGeomDB->GetPrevGroup( nNewParentId) ;
nNewId = pGeomDB->GetLastInGroup( nNewParentId) ;
nNewId = m_pGeomDB->GetLastInGroup( nNewParentId) ;
} while ( nNewId != GDB_ID_NULL) ;
return GDB_ID_NULL ;
}
@@ -270,10 +291,10 @@ Machining::ToolPreview( int nEntId, int nStep) const
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr)
return GDB_ID_NULL ;
// recupero la testa nel gruppo per anteprima utensile
int nId = m_pGeomDB->GetFirstGroupInGroup( m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_ST)) ;
if ( nId == GDB_ID_NULL)
int nStId = m_pGeomDB->GetFirstGroupInGroup( m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_ST)) ;
if ( nStId == GDB_ID_NULL)
return GDB_ID_NULL ;
m_pGeomDB->SetStatus( nId, GDB_ST_OFF) ;
m_pGeomDB->SetStatus( nStId, GDB_ST_OFF) ;
// recupero gruppo per geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_CL) ;
if ( nClId == GDB_ID_NULL)
@@ -285,10 +306,10 @@ Machining::ToolPreview( int nEntId, int nStep) const
nParentId = m_pGeomDB->GetFirstGroupInGroup( nClId) ;
// se richiesta successiva
if ( nStep > 0)
nEntId = GetToolPreviewNext( m_pGeomDB, nEntId, nParentId) ;
nEntId = GetToolPreviewNext( nEntId, nParentId, nStId) ;
// se richiesta precedente
else if ( nStep < 0)
nEntId = GetToolPreviewPrev( m_pGeomDB, nEntId, nParentId) ;
nEntId = GetToolPreviewPrev( nEntId, nParentId, nStId) ;
// altrimenti richiesta corrente
else
nEntId = GDB_ID_NULL ;
@@ -296,13 +317,13 @@ Machining::ToolPreview( int nEntId, int nStep) const
// altrimenti
else {
// verifico che l'entità stia in un sottogruppo di CL
nParentId = m_pGeomDB->GetParentId( nEntId) ;
nParentId = m_pGeomDB->GetParentId( nEntId) ;
if ( m_pGeomDB->GetParentId( nParentId) == nClId) {
// se richiesta successiva
if ( nStep > 0) {
while ( nStep > 0) {
int nOldId = nEntId ;
nEntId = GetToolPreviewNext( m_pGeomDB, nEntId, nParentId) ;
nEntId = GetToolPreviewNext( nEntId, nParentId, nStId) ;
-- nStep ;
if ( nEntId == GDB_ID_NULL) {
nEntId = nOldId ;
@@ -314,7 +335,7 @@ Machining::ToolPreview( int nEntId, int nStep) const
else if ( nStep < 0) {
while ( nStep < 0) {
int nOldId = nEntId ;
nEntId = GetToolPreviewPrev( m_pGeomDB, nEntId, nParentId) ;
nEntId = GetToolPreviewPrev( nEntId, nParentId, nStId) ;
++ nStep ;
if ( nEntId == GDB_ID_NULL) {
nEntId = nOldId ;
@@ -328,7 +349,7 @@ Machining::ToolPreview( int nEntId, int nStep) const
}
// se esiste il gruppo genitore, visualizzo testa preview
if ( nParentId != GDB_ID_NULL)
m_pGeomDB->SetStatus( nId, GDB_ST_ON) ;
m_pGeomDB->SetStatus( nStId, GDB_ST_ON) ;
// recupero i dati di questa entità
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
if ( pCamData == nullptr)
@@ -338,17 +359,21 @@ Machining::ToolPreview( int nEntId, int nStep) const
Vector3d vtTool = pCamData->GetToolDir() ;
Vector3d vtBAux = pCamData->GetBackAuxDir() ;
// dati correnti testa/uscita
int nExitId = m_pGeomDB->GetFirstNameInGroup( nId, MCH_EXIT + ToString( GetExitNbr())) ;
int nExitId = m_pGeomDB->GetFirstNameInGroup( nStId, MCH_EXIT + ToString( GetExitNbr())) ;
Frame3d frExit ;
m_pGeomDB->GetGroupGlobFrame( nExitId, frExit) ;
// correggo eventuale movimento di disattivazione sempre in Z globale
double dVal ;
if ( m_pGeomDB->GetInfo( nExitId, MCH_EXIT_VAL, dVal))
frExit.Translate( -dVal * Z_AX) ;
Point3d ptOrig = frExit.Orig() ;
Vector3d vtDir = frExit.VersZ() ;
Vector3d vtAux ;
int nAvId = m_pGeomDB->GetFirstNameInGroup( nId, MCH_AUX_VECT) ;
int nAvId = m_pGeomDB->GetFirstNameInGroup( nStId, MCH_AUX_VECT) ;
ExeStartVector( nAvId, GDB_ID_ROOT, vtAux) ;
// rototraslo opportunamente
Frame3d frHead ;
m_pGeomDB->GetGroupGlobFrame( nId, frHead) ;
m_pGeomDB->GetGroupGlobFrame( nStId, frHead) ;
Frame3d frRef ;
if ( vtAux.IsSmall() || AreSameOrOppositeVectorApprox( vtAux, vtDir))
frRef.Set( ptOrig, vtDir) ;
@@ -361,11 +386,49 @@ Machining::ToolPreview( int nEntId, int nStep) const
frShow.Set( ptEnd + vtTool * GetToolData().m_dLen, vtTool, vtBAux) ;
frHead.ToLoc( frRef) ;
frHead.ToGlob( frShow) ;
*(m_pGeomDB->GetGroupFrame( nId)) = frHead ;
*(m_pGeomDB->GetGroupFrame( nStId)) = frHead ;
return nEntId ;
}
//----------------------------------------------------------------------------
bool
Machining::ActivateDrillingUnit( int nHeadId, const INTVECTOR& vActExit) const
{
// recupero la macchina corrente
Machine* pMch = m_pMchMgr->GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
// costanti
static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo
static const string EVAR_VER = ".VER" ; // IN (string) versione della Dll
static const string EVAR_HEADID = ".HEADID" ; // IN (int) identificativo testa
static const string EVAR_DRACEX = ".DRACEX" ; // IN (ints) vettore indici uscite attive
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok, > 0 errore)
static const string ON_ACTIVATE_DRILLING_UNIT = "OnActivateDrillingUnit" ;
// se non esiste la funzione, esco
if ( ! pMch->LuaExistsFunction( ON_ACTIVATE_DRILLING_UNIT))
return true ;
// eseguo l'azione
bool bOk = true ;
int nErr = 99 ;
// imposto valori parametri
bOk = bOk && pMch->LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_VER, GetEMkVer()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_HEADID, nHeadId) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_DRACEX, vActExit) ;
// eseguo
bOk = bOk && pMch->LuaCallFunction( ON_ACTIVATE_DRILLING_UNIT) ;
// recupero valori parametri obbligatori
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) ;
// reset
bOk = pMch->LuaResetGlobVar( EMC_VAR) && bOk ;
// segnalo errori
return ( bOk && nErr == 0) ;
}
//----------------------------------------------------------------------------
bool
Machining::PostApply( string& sErr)
@@ -382,39 +445,39 @@ Machining::PostApply( string& sErr)
static const string EVAR_MSG = ".MSG" ; // OUT (string) stringa di errore ( opzionale)
static const string ON_POST_APPLY = "OnPostApplyMachining" ;
// eseguo l'azione
if ( pMch->LuaExistsFunction( ON_POST_APPLY)) {
bool bOk = true ;
int nErr = 99 ;
// imposto valori parametri
bOk = bOk && pMch->LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_PHASE, m_nPhase) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_MCHID, m_nOwnerId) ;
// eseguo
bOk = bOk && pMch->LuaCallFunction( ON_POST_APPLY, false) ;
// recupero valori parametri obbligatori
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) ;
// recupero valori parametri opzionali
string sMsg ;
bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_MSG, sMsg) ;
// reset
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
// segnalo errori
if ( ! bOk || nErr > 0) {
bOk = false ;
sErr = sMsg ;
if ( IsEmptyOrSpaces( sErr))
sErr = " Error in " + ON_POST_APPLY + " (" + ToString( nErr) + ")" ;
}
// recupero eventuale warning
else if ( nErr < 0) {
string sOut = sMsg ;
if ( IsEmptyOrSpaces( sOut))
sOut = " Warning in " + ON_POST_APPLY + " (" + ToString( abs( nErr)) + ")" ;
m_pMchMgr->SetWarning( abs( nErr), sOut) ;
}
return bOk ;
}
else
// se non esiste la funzione, esco
if ( ! pMch->LuaExistsFunction( ON_POST_APPLY))
return true ;
}
// eseguo l'azione
bool bOk = true ;
int nErr = 99 ;
// imposto valori parametri
bOk = bOk && pMch->LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_PHASE, m_nPhase) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_MCHID, m_nOwnerId) ;
// eseguo
bOk = bOk && pMch->LuaCallFunction( ON_POST_APPLY, false) ;
// recupero valori parametri obbligatori
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) ;
// recupero valori parametri opzionali
string sMsg ;
bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_MSG, sMsg) ;
// reset
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
// segnalo errori
if ( ! bOk || nErr > 0) {
bOk = false ;
sErr = sMsg ;
if ( IsEmptyOrSpaces( sErr))
sErr = " Error in " + ON_POST_APPLY + " (" + ToString( nErr) + ")" ;
}
// recupero eventuale warning
else if ( nErr < 0) {
string sOut = sMsg ;
if ( IsEmptyOrSpaces( sOut))
sOut = " Warning in " + ON_POST_APPLY + " (" + ToString( abs( nErr)) + ")" ;
m_pMchMgr->SetWarning( abs( nErr), sOut) ;
}
return bOk ;
}
+7
View File
@@ -43,6 +43,8 @@ class Machining : public Operation
virtual bool UpdateToolData( bool* pbChanged = nullptr) = 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 ;
@@ -51,10 +53,15 @@ class Machining : public Operation
bool RemoveToolPreview( void) const ;
int GetToolPreviewStepCount( void) const ;
int ToolPreview( int nEntId, int nStep) const ;
bool ActivateDrillingUnit( int nHeadId, const INTVECTOR& vActExit) const ;
protected :
Machining( void) ;
bool PostApply( std::string& sErr) ;
private :
int GetToolPreviewNext( int nEntId, int nParentId, int nStId) const ;
int GetToolPreviewPrev( int nEntId, int nParentId, int nStId) const ;
} ;
//----------------------------------------------------------------------------
+101 -53
View File
@@ -46,7 +46,6 @@ using namespace std ;
//------------------------------ Constants ------------------------------------
const double OSC_MIN_LEN = 0.1 ;
const double MIN_SAFEDIST = 5.0 ;
const double LIM_DOWN_APPRZ = -0.5 ;
const double DELTA_ELEV_RAD = 4.0 ;
const double LIM_SIN_DIFF_DIR = 0.175 ;
@@ -107,7 +106,7 @@ Milling*
Milling::Clone( void) const
{
// alloco oggetto
Milling* pMill = new(nothrow) Milling ;
Milling* pMill = new( nothrow) Milling ;
// eseguo copia dei dati
if ( pMill != nullptr) {
try {
@@ -119,6 +118,7 @@ Milling::Clone( void) const
pMill->m_dTHoldBase = m_dTHoldBase ;
pMill->m_dTHoldLen = m_dTHoldLen ;
pMill->m_dTHoldDiam = m_dTHoldDiam ;
pMill->m_bTHoldFloating = m_bTHoldFloating ;
pMill->m_nStatus = m_nStatus ;
pMill->m_nMills = m_nMills ;
pMill->m_bStepOn = m_bStepOn ;
@@ -246,6 +246,7 @@ Milling::Milling( void)
m_dTHoldBase = 0 ;
m_dTHoldLen = 0 ;
m_dTHoldDiam = 0 ;
m_bTHoldFloating = false ;
m_nStatus = MCH_ST_TO_VERIFY ;
m_nMills = 0 ;
m_bStepOn = false ;
@@ -672,6 +673,7 @@ Milling::Preview( bool bRecalc)
m_pGeomDB->GetInfo( nToolId, TTH_LEN, m_dTHoldLen) ;
m_dTHoldDiam = 0 ;
m_pGeomDB->GetInfo( nToolId, TTH_DIAM, m_dTHoldDiam) ;
m_bTHoldFloating = m_pMchMgr->GetCurrMachine()->IsCurrToolFloating() ;
// se necessario, eseguo concatenamento ed inserisco i percorsi sotto la geometria ausiliaria
if ( bChain && ! Chain( nAuxId)) {
@@ -725,13 +727,15 @@ Milling::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
// confermo i percorsi di lavorazione
m_nMills = nCurrMills ;
LOG_DBG_INFO( GetEMkLogger(), "Milling apply skipped : status already ok") ;
string sLog = string( "Milling 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 ;
@@ -785,6 +789,7 @@ Milling::Apply( bool bRecalc, bool bPostApply)
m_pGeomDB->GetInfo( nToolId, TTH_LEN, m_dTHoldLen) ;
m_dTHoldDiam = 0 ;
m_pGeomDB->GetInfo( nToolId, TTH_DIAM, m_dTHoldDiam) ;
m_bTHoldFloating = m_pMchMgr->GetCurrMachine()->IsCurrToolFloating() ;
// recupero gruppo per geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
@@ -1110,10 +1115,14 @@ Milling::UpdateToolData( bool* pbChanged)
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 ;
@@ -1367,7 +1376,7 @@ Milling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
nToolDir = TOOL_PARAL ;
int nFaceUse = ( m_Params.m_nFaceUse & 31) ;
Vector3d vtFaceUse ;
if ( FromString( ExtractInfo( m_Params.m_sUserNotes, "VtFaceUse="), vtFaceUse) && ! vtFaceUse.IsSmall())
if ( GetValInNotes( m_Params.m_sUserNotes, "VtFaceUse", vtFaceUse) && ! vtFaceUse.IsSmall())
nFaceUse = FACE_VERSOR ;
double dSawThick = ( ( m_TParams.m_nType & TF_SAWBLADE) != 0 ? m_TParams.m_dThick : 0) ;
AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, vtFaceUse, dSawThick) ;
@@ -1395,7 +1404,7 @@ Milling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
nToolDir = TOOL_PARAL ;
int nFaceUse = ( m_Params.m_nFaceUse & 31) ;
Vector3d vtFaceUse ;
if ( FromString( ExtractInfo( m_Params.m_sUserNotes, "VtFaceUse="), vtFaceUse) && ! vtFaceUse.IsSmall())
if ( GetValInNotes( m_Params.m_sUserNotes, "VtFaceUse", vtFaceUse) && ! vtFaceUse.IsSmall())
nFaceUse = FACE_VERSOR ;
double dSawThick = ( ( m_TParams.m_nType & TF_SAWBLADE) != 0 ? m_TParams.m_dThick : 0) ;
// determino intervallo di chunk
@@ -1825,18 +1834,20 @@ Milling::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, "MaxElev", dMaxElev) && dElev > dMaxElev)
dElev = dMaxElev ;
// eventuale aggiuntivo all'elevazione per l'oscillazione
double dAddElev = ( bPathOscEnable ? abs( m_Params.m_dOscHeight) : 0) ;
// eventuale elevazione di fianco (solo per lama)
double dSideElev = 0 ;
FromString( ExtractInfo( m_Params.m_sUserNotes, "SideElev="), dSideElev) ;
GetValInNotes( m_Params.m_sUserNotes, "SideElev", dSideElev) ;
// verifico che lo step dell'utensile sia sensato
double dOkStep = 0 ;
bool bStepUp = false ;
if ( m_Params.m_dStep > EPS_SMALL)
if ( m_bTHoldFloating)
dOkStep = 0 ;
else if ( m_Params.m_dStep > EPS_SMALL)
dOkStep = m_Params.m_dStep + EPS_ZERO ;
else if ( m_Params.m_dStep < -EPS_SMALL &&
( m_TParams.m_nType == TT_MILL_NOTIP ||
@@ -1948,8 +1959,8 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
return false ;
// recupero eventuale flag di inizio forzato fuori dal grezzo
int nStartOutRaw ;
FromString( ExtractInfo( m_Params.m_sUserNotes, "OutRaw="), nStartOutRaw) ;
int nStartOutRaw = 0 ;
GetValInNotes( m_Params.m_sUserNotes, "OutRaw", nStartOutRaw) ;
m_bStartOutRaw = (( nStartOutRaw & 1) != 0) ;
m_bEndOutRaw = (( nStartOutRaw & 2) != 0) ;
@@ -2372,8 +2383,8 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
dStElev = max( dStElev - dExtraLen, 0.) ;
// se attacco a zigzag o a spirale, l'elevazione va nell'attacco
if ( IsLeadInHelixOrZigzag()) {
ptP1 += vtTool * ( dStElev + LIO_ELEV_TOL) ;
dStElev = -LIO_ELEV_TOL ;
ptP1 += vtTool * ( dStElev + GetLeadInOutToler()) ;
dStElev = - GetLeadInOutToler() ;
}
// approccio al punto iniziale
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dExtrAppr, bOutStart, bAboveStart, true, bSplitArcs)) {
@@ -2392,12 +2403,12 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
bool bSideStart = false ;
if ( ! bGeomAboveStart) {
bAhUnderStart = m_bAboveHead && GetAhPointUnderRaw( ptP1 + vtWkTip, vtTool, m_TParams.m_dTDiam / 2,
GetRadiusForStartEndElevation( false),
GetRadiusForStartEndElevation(),
m_TParams.m_dLen, true, dSafeZ, vtAppr, dSawStartElev) ;
}
else {
bUhAboveStart = ! m_bAboveHead && GetUhPointAboveRaw( ptP1 + vtWkTip, vtTool, m_TParams.m_dTDiam / 2,
GetRadiusForStartEndElevation( false),
GetRadiusForStartEndElevation(),
m_TParams.m_dLen, true, dSafeZ, vtAppr, dSawStartElev) ;
}
// se non sono sotto, verifico se posso allontanarmi nel piano lama (meglio se in orizzontale)
@@ -2580,12 +2591,12 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
bool bSideEnd = false ;
if ( ! bGeomAboveEnd) {
bAhUnderEnd = m_bAboveHead && GetAhPointUnderRaw( ptP1 + vtWkTip, vtTool, m_TParams.m_dTDiam / 2,
GetRadiusForStartEndElevation( true),
GetRadiusForStartEndElevation(),
m_TParams.m_dLen, true, dSafeZ, vtRetr, dSawEndElev) ;
}
else {
bUhAboveEnd = ! m_bAboveHead && GetUhPointAboveRaw( ptP1 + vtWkTip, vtTool, m_TParams.m_dTDiam / 2,
GetRadiusForStartEndElevation( true),
GetRadiusForStartEndElevation(),
m_TParams.m_dLen, true, dSafeZ, vtRetr, dSawEndElev) ;
}
if ( ! bAhUnderEnd && ! bUhAboveEnd) {
@@ -2748,8 +2759,8 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
m_TParams.m_dLen, false, dSafeZ, vtEscape, dStElev) ;
// se attacco a zigzag o a spirale, l'elevazione va nell'attacco
if ( IsLeadInHelixOrZigzag()) {
ptP1 += vtTool * ( dStElev + LIO_ELEV_TOL) ;
dStElev = - LIO_ELEV_TOL ;
ptP1 += vtTool * ( dStElev + GetLeadInOutToler()) ;
dStElev = - GetLeadInOutToler() ;
}
// approccio al punto iniziale
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dExtrAppr, bOutStart, bAboveStart, true, bSplitArcs)) {
@@ -2767,7 +2778,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
bool bSideStart = false ;
if ( ! bGeomAboveStart) {
bUnderStart = m_bAboveHead && GetAhPointUnderRaw( ptP1, vtTool, m_TParams.m_dTDiam / 2,
GetRadiusForStartEndElevation( false),
GetRadiusForStartEndElevation(),
m_TParams.m_dLen, true, dSafeZ, vtAppr, dSawStartElev) ;
}
@@ -2839,8 +2850,8 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
}
// se attacco a zigzag o a spirale, non affondo
else if ( IsLeadInHelixOrZigzagOrGlide()) {
ptP1 += vtTool * ( dStElev + LIO_ELEV_TOL) ;
dStElev = - LIO_ELEV_TOL ;
ptP1 += vtTool * ( dStElev + GetLeadInOutToler()) ;
dStElev = - GetLeadInOutToler() ;
}
// altrimenti, affondo in feed opportuna
else {
@@ -2912,7 +2923,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
Vector3d vtDir1 ;
if ( ! IsLeadInHelixOrZigzag() || k == nStep) {
if ( k != nStep && GetLeadInType() == MILL_LI_GLIDE)
dEndElev = -LIO_ELEV_TOL ;
dEndElev = - GetLeadInOutToler() ;
SetFeed( GetEndFeed()) ;
if ( ! AddLeadOut( ptEnd, vtEnd, vtTool, dEndElev, bInvert, pCompo, bSplitArcs, ptP1, vtDir1)) {
m_pMchMgr->SetLastError( 2311, "Error in Milling : LeadOut not computable") ;
@@ -2936,7 +2947,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
bool bSideEnd = false ;
if ( ! bGeomAboveEnd) {
bUnderEnd = m_bAboveHead && GetAhPointUnderRaw( ptP1, vtTool, m_TParams.m_dTDiam / 2,
GetRadiusForStartEndElevation( false),
GetRadiusForStartEndElevation(),
m_TParams.m_dLen, true, dSafeZ, vtRetr, dSawEndElev) ;
}
if ( ! bUnderEnd) {
@@ -3236,12 +3247,12 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
bool bSideStart = false ;
if ( ! bGeomAboveStart) {
bAhUnderStart = m_bAboveHead && GetAhPointUnderRaw( ptP1, vtTool, m_TParams.m_dTDiam / 2,
GetRadiusForStartEndElevation( false),
GetRadiusForStartEndElevation(),
m_TParams.m_dLen, true, dSafeZ, vtAppr, dSawStartElev) ;
}
else {
bUhAboveStart = ! m_bAboveHead && GetUhPointAboveRaw( ptP1, vtTool, m_TParams.m_dTDiam / 2,
GetRadiusForStartEndElevation( false),
GetRadiusForStartEndElevation(),
m_TParams.m_dLen, true, dSafeZ, vtAppr, dSawStartElev) ;
}
// se non sono sotto, verifico se posso allontanarmi nel piano lama (meglio se in orizzontale)
@@ -3427,12 +3438,12 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
bool bSideEnd = false ;
if ( ! bGeomAboveEnd) {
bAhUnderEnd = m_bAboveHead && GetAhPointUnderRaw( ptP1, vtTool, m_TParams.m_dTDiam / 2,
GetRadiusForStartEndElevation( false),
GetRadiusForStartEndElevation(),
m_TParams.m_dLen, true, dSafeZ, vtRetr, dSawEndElev) ;
}
else {
bUhAboveEnd = ! m_bAboveHead && GetUhPointAboveRaw( ptP1, vtTool, m_TParams.m_dTDiam / 2,
GetRadiusForStartEndElevation( false),
GetRadiusForStartEndElevation(),
m_TParams.m_dLen, true, dSafeZ, vtRetr, dSawEndElev) ;
}
if ( ! bAhUnderEnd && ! bUhAboveEnd) {
@@ -3925,7 +3936,7 @@ Milling::AddSawZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtT
// recupero eventuale superficie trimesh chiusa per trim/extend
int nTriExtCstm = GDB_ID_NULL ;
int nTesId ;
if ( FromString( ExtractInfo( m_Params.m_sUserNotes, "TrimExt="), nTesId)) {
if ( GetValInNotes( m_Params.m_sUserNotes, "TrimExt", nTesId)) {
const ISurfTriMesh* pTes = GetSurfTriMesh( m_pGeomDB->GetGeoObj( nTesId)) ;
if ( pTes != nullptr && pTes->IsClosed())
nTriExtCstm = nTesId ;
@@ -3993,7 +4004,7 @@ Milling::AddSawZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtT
dStElev = dElev ;
}
else
dStElev = dStep - LIO_ELEV_TOL - 10 * EPS_SMALL ;
dStElev = dStep - GetLeadInOutToler() - 10 * EPS_SMALL ;
// determino inizio attacco
Point3d ptP1 ;
Vector3d vtDir1 ;
@@ -4071,7 +4082,7 @@ Milling::AddSawZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtT
dEndElev = dElev ;
}
else
dEndElev = - LIO_ELEV_TOL ;
dEndElev = - GetLeadInOutToler() ;
// aggiungo uscita
Point3d ptP1 ;
Vector3d vtDir1 ;
@@ -4101,7 +4112,7 @@ Milling::AddSawOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtT
// recupero eventuale superficie trimesh chiusa per trim/extend
int nTriExtCstm = GDB_ID_NULL ;
int nTesId ;
if ( FromString( ExtractInfo( m_Params.m_sUserNotes, "TrimExt="), nTesId)) {
if ( GetValInNotes( m_Params.m_sUserNotes, "TrimExt", nTesId)) {
const ISurfTriMesh* pTes = GetSurfTriMesh( m_pGeomDB->GetGeoObj( nTesId)) ;
if ( pTes != nullptr && pTes->IsClosed())
nTriExtCstm = nTesId ;
@@ -4172,7 +4183,7 @@ Milling::AddSawOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtT
dStElev = dElev ;
}
else
dStElev = dStep - LIO_ELEV_TOL - 10 * EPS_SMALL ;
dStElev = dStep - GetLeadInOutToler() - 10 * EPS_SMALL ;
// determino inizio attacco
Point3d ptP1 ;
Vector3d vtDir1 ;
@@ -4258,7 +4269,7 @@ Milling::AddSawOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtT
dEndElev = dElev ;
}
else
dEndElev = - LIO_ELEV_TOL ;
dEndElev = - GetLeadInOutToler() ;
// aggiungo uscita
Point3d ptP1 ;
Vector3d vtDir1 ;
@@ -4412,7 +4423,8 @@ Milling::AddSawBladeSideApproach( const Point3d& ptP, const Vector3d& vtAppr, co
Vector3d vtMove = Vector3d( vtTool.x, vtTool.y, 0) ;
if ( vtMove.Normalize()) {
if ( m_bAboveHead && vtAppr.z < LIM_DOWN_APPRZ) {
double dExtraElev ;
// deve essere inizializzata a zero
double dExtraElev = 0 ;
if ( GetAhPointUnderRaw( ptP1a, vtTool, m_TParams.m_dTDiam / 2,
GetRadiusForStartEndElevation( false),
m_TParams.m_dLen, true, dSafeZ, vtMove, dExtraElev)) {
@@ -4434,7 +4446,8 @@ Milling::AddSawBladeSideApproach( const Point3d& ptP, const Vector3d& vtAppr, co
}
}
else if ( ! m_bAboveHead && vtAppr.z > -LIM_DOWN_APPRZ) {
double dExtraElev ;
// deve essere inizializzata a zero
double dExtraElev = 0 ;
if ( GetUhPointAboveRaw( ptP1a, vtTool, m_TParams.m_dTDiam / 2,
GetRadiusForStartEndElevation( false),
m_TParams.m_dLen, true, dSafeZ, vtMove, dExtraElev)) {
@@ -4628,7 +4641,8 @@ Milling::AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, con
vtMove = Vector3d( vtTool.x, vtTool.y, 0) ;
if ( vtMove.Normalize()) {
if ( m_bAboveHead && vtRetr.z < LIM_DOWN_APPRZ) {
double dExtraElev ;
// deve essere inizializzata a zero
double dExtraElev = 0 ;
if ( GetAhPointUnderRaw( ptP4, vtTool, m_TParams.m_dTDiam / 2,
GetRadiusForStartEndElevation( false),
m_TParams.m_dLen, true, dSafeZ, vtMove, dExtraElev)) {
@@ -4639,7 +4653,8 @@ Milling::AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, con
}
}
else if ( ! m_bAboveHead && vtRetr.z > -LIM_DOWN_APPRZ) {
double dExtraElev ;
// deve essere inizializzata a zero
double dExtraElev = 0 ;
if ( GetUhPointAboveRaw( ptP4, vtTool, m_TParams.m_dTDiam / 2,
GetRadiusForStartEndElevation( false),
m_TParams.m_dLen, true, dSafeZ, vtMove, dExtraElev)) {
@@ -4695,7 +4710,7 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const
int nType = GetLeadInType() ;
double dTang = m_Params.m_dLiTang ;
double dPerp = m_Params.m_dLiPerp ;
double dElev = min( m_Params.m_dLiElev, dStElev + LIO_ELEV_TOL) ;
double dElev = min( m_Params.m_dLiElev, dStElev + GetLeadInOutToler()) ;
// se step invertito
if ( bInvert) {
// va aggiustato se non zigzag o spirale
@@ -4711,7 +4726,7 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const
if ( m_Params.m_nLeadOutType != MILL_LO_AS_LI) {
dTang = m_Params.m_dLoTang ;
dPerp = m_Params.m_dLoPerp ;
dElev = min( m_Params.m_dLoElev, dStElev + LIO_ELEV_TOL) ;
dElev = min( m_Params.m_dLoElev, dStElev + GetLeadInOutToler()) ;
}
}
}
@@ -4817,7 +4832,7 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
int nType = GetLeadInType() ;
double dTang = m_Params.m_dLiTang ;
double dPerp = m_Params.m_dLiPerp ;
double dElev = min( m_Params.m_dLiElev, dStElev + LIO_ELEV_TOL) ;
double dElev = min( m_Params.m_dLiElev, dStElev + GetLeadInOutToler()) ;
// se step invertito
if ( bInvert) {
// va aggiustato se non zigzag o spirale
@@ -4833,6 +4848,7 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
if ( m_Params.m_nLeadOutType != MILL_LO_AS_LI) {
dTang = m_Params.m_dLoTang ;
dPerp = m_Params.m_dLoPerp ;
dElev = min( m_Params.m_dLoElev, dStElev + GetLeadInOutToler()) ;
}
}
}
@@ -4847,6 +4863,13 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
case MILL_LI_NONE :
return true ;
case MILL_LI_LINEAR :
// se c'è elevazione di attacco e utensile flottante faccio precedere solo movimento in elevazione
if ( m_bTHoldFloating && dElev > 10 * EPS_SMALL) {
Point3d ptMid = ptP1 - dElev * vtTool ;
if ( AddLinearMove( ptMid, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
return false ;
dElev = 0 ;
}
// eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile)
if ( m_Params.m_dLiCompLen > 10 * EPS_SMALL) {
Vector3d vtPerp = vtStart ;
@@ -4869,6 +4892,13 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
case MILL_LI_TANGENT :
{
Point3d ptMid = ptP1 ;
// se c'è elevazione di attacco e utensile flottante faccio precedere solo movimento in elevazione
if ( m_bTHoldFloating && dElev > 10 * EPS_SMALL) {
ptMid += - dElev * vtTool ;
if ( AddLinearMove( ptMid, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
return false ;
dElev = 0 ;
}
// eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile)
if ( m_Params.m_dLiCompLen > 10 * EPS_SMALL) {
Vector3d vtPerp = vtStart ;
@@ -5040,7 +5070,7 @@ Milling::CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vect
int nType = GetLeadOutType() ;
double dTang = m_Params.m_dLoTang ;
double dPerp = m_Params.m_dLoPerp ;
double dElev = min( m_Params.m_dLoElev, dEndElev + LIO_ELEV_TOL) ;
double dElev = min( m_Params.m_dLoElev, dEndElev + GetLeadInOutToler()) ;
// se uscita come ingresso o step invertito
if ( nType == MILL_LO_AS_LI || bInvert) {
int nLiType = GetLeadInType() ;
@@ -5059,7 +5089,7 @@ Milling::CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vect
dTang = 0.5 * min( m_Params.m_dLiTang, m_TParams.m_dDiam) ;
dPerp = dTang ;
}
dElev = min( m_Params.m_dLiElev, dEndElev + LIO_ELEV_TOL) ;
dElev = min( m_Params.m_dLiElev, dEndElev + GetLeadInOutToler()) ;
}
// senso di rotazione da dir tg a dir esterna
bool bCcwRot = (( ! bInvert && m_Params.m_nWorkSide == MILL_WS_LEFT) ||
@@ -5171,7 +5201,7 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
int nType = GetLeadOutType() ;
double dTang = m_Params.m_dLoTang ;
double dPerp = m_Params.m_dLoPerp ;
double dElev = min( m_Params.m_dLoElev, dEndElev + LIO_ELEV_TOL) ;
double dElev = min( m_Params.m_dLoElev, dEndElev + GetLeadInOutToler()) ;
// se uscita come ingresso o step invertito
if ( nType == MILL_LO_AS_LI || bInvert) {
int nLiType = GetLeadInType() ;
@@ -5190,7 +5220,7 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
dTang = 0.5 * min( m_Params.m_dLiTang, m_TParams.m_dDiam) ;
dPerp = dTang ;
}
dElev = min( m_Params.m_dLiElev, dEndElev + LIO_ELEV_TOL) ;
dElev = min( m_Params.m_dLiElev, dEndElev + GetLeadInOutToler()) ;
}
// senso di rotazione da dir tg a dir esterna
bool bCcwRot = (( ! bInvert && m_Params.m_nWorkSide == MILL_WS_LEFT) ||
@@ -5206,6 +5236,11 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
return true ;
case MILL_LO_LINEAR :
{
// se utensile flottante, l'elevazione va tutta in un movimento finale aggiuntivo
double dFloatElev = 0 ;
if ( m_bTHoldFloating)
swap( dElev, dFloatElev) ;
// calcolo punto finale dell'uscita
Vector3d vtPerp = vtEnd ;
Vector3d vtRot = OrthoCompo( vtTool, vtEnd) ;
vtPerp.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ;
@@ -5213,6 +5248,7 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
vtDir1 = ptP1 - ptEnd ;
if ( ! vtDir1.Normalize())
return false ;
// inserisco movimento di uscita
bool bOk = ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
// eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile)
if ( m_Params.m_dLoCompLen > 10 * EPS_SMALL) {
@@ -5222,6 +5258,11 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
ptP1 += vtDir1 * m_Params.m_dLoCompLen ;
bOk = bOk && ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
}
// eventuale movimento in elevazione per flottante
if ( m_bTHoldFloating && dFloatElev > 10 * EPS_SMALL) {
ptP1 += dFloatElev * vtTool ;
bOk = bOk && ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
}
return bOk ;
}
case MILL_LO_PERP_TG :
@@ -5237,6 +5278,10 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
}
case MILL_LO_TANGENT :
{
// se utensile flottante, l'elevazione va tutta in un movimento finale aggiuntivo
double dFloatElev = 0 ;
if ( m_bTHoldFloating)
swap( dElev, dFloatElev) ;
// calcolo punto finale dell'uscita
Vector3d vtPerp = vtEnd ;
Vector3d vtRot = OrthoCompo( vtTool, vtEnd) ;
@@ -5245,16 +5290,14 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
vtDir1 = ptP1 - ptEnd ;
if ( ! vtDir1.Normalize())
return false ;
// inserisco uscita
// inserisco movimento di uscita
PtrOwner<ICurve> pCrv( GetArc2PVN( ptEnd, ptP1, vtEnd, vtTool)) ;
if ( IsNull( pCrv))
return false ;
// assegno direzione finale dell'uscita
Vector3d vtDirF ;
if ( ! pCrv->GetEndDir( vtDirF))
return false ;
bool bOk = true ;
// emetto movimento
bOk = ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
// eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile)
if ( m_Params.m_dLoCompLen > 10 * EPS_SMALL) {
@@ -5264,6 +5307,11 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
ptP1 += vtDir1 * m_Params.m_dLoCompLen ;
bOk = bOk && ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
}
// eventuale movimento in elevazione per flottante
if ( m_bTHoldFloating && dFloatElev > 10 * EPS_SMALL) {
ptP1 += dFloatElev * vtTool ;
bOk = bOk && ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
}
return bOk ;
}
case MILL_LO_GLIDE :
@@ -6392,7 +6440,7 @@ Milling::CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU, bool bI
//----------------------------------------------------------------------------
Vector3d
Milling::CalcCorrDir( const ICurveComposite* pCompo, double dU, bool bInvertSide, bool bSawSpecial)
Milling::CalcCorrDir( const ICurveComposite* pCompo, double dU, bool bInvertSide, bool bSawSpecial) const
{
// verifico curva
if ( pCompo == nullptr)
@@ -6463,7 +6511,7 @@ Milling::CalcCorrDir( const ICurveComposite* pCompo, double dU, bool bInvertSide
//----------------------------------------------------------------------------
bool
Milling::CalcOffset( ICurveComposite* pCompo, double dSignOffs)
Milling::CalcOffset( ICurveComposite* pCompo, double dSignOffs) const
{
// determino opzioni di offset
int nFlag = ICurve::OFF_FILLET ;
+6 -3
View File
@@ -129,8 +129,8 @@ class Milling : public Machining
bool GetPointAboveRaw( const Point3d& ptP, const Vector3d& vtTool) const ;
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) ;
bool CalcOffset( ICurveComposite* pCompo, double dSignOffs) ;
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 :
@@ -163,7 +163,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
@@ -172,6 +174,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
+13 -7
View File
@@ -523,13 +523,15 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
( 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 ;
@@ -815,10 +817,14 @@ Mortising::UpdateToolData( bool* pbChanged)
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 ;
@@ -1319,7 +1325,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, "MaxElev", dMaxElev) && dElev > dMaxElev)
dElev = dMaxElev ;
// ingombro aggiuntivo da larghezza sega a catena quando inclinata rispetto al movimento
@@ -1330,7 +1336,7 @@ 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, "Plunge", nPlunge) ;
// verifico che lo step dell'utensile sia sensato
double dOkStep = ( nPlunge == MORTISE_PLUNGE_STEP ? m_Params.m_dStep : 0) ;
+498 -171
View File
@@ -2310,6 +2310,10 @@ Operation::VerifyLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec,
bAxError = false ;
Machine* pMachine = m_pMchMgr->GetCurrMachine() ;
// se disposizione non vanno fatti controlli
if ( GetType() == OPER_DISP)
return true ;
// se superato il limite di ricursioni, non devo fare alcunché
const int MAX_RECURSION = 6 ;
if ( nCnt > MAX_RECURSION)
@@ -2352,14 +2356,27 @@ Operation::VerifyLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec,
// Va inserito il punto medio
Point3d ptMid = Media( ptPrec, ptP) ;
Vector3d vtDirMid = Media( vtDirPrec, vtDir) ;
if ( ! vtDirMid.Normalize())
return ( nMoveType == 0) ;
if ( ! vtDirMid.Normalize()) {
if ( ! pMachine->GetBackToolDirFromAngles( vAxRotMid, vtDirMid))
return ( nMoveType == 0) ;
}
Vector3d vtAuxMid = Media( vtAuxPrec, vtAux) ;
if ( ! vtAuxPrec.IsSmall() && ! vtAux.IsSmall() && ! vtAuxMid.Normalize())
return ( nMoveType == 0) ;
if ( ! vtAuxPrec.IsSmall() && ! vtAux.IsSmall() && ! vtAuxMid.Normalize()) {
if ( ! pMachine->GetBackAuxDirFromAngles( vAxRotMid, vtAuxMid))
return ( nMoveType == 0) ;
}
Vector3d vtCorrMid = Media( vtCorrPrec, vtCorr) ;
if ( ! vtCorrPrec.IsSmall() && ! vtCorr.IsSmall() && ! vtCorrMid.Normalize())
return ( nMoveType == 0) ;
if ( ! vtCorrPrec.IsSmall() && ! vtCorr.IsSmall() && ! vtCorrMid.Normalize()) {
// riferimenti precedente e sul medio da direzioni fresa (Z) e ausiliaria (X)
Frame3d refPrec, refMid ;
if ( ! refPrec.Set( ORIG, vtDirPrec, vtAuxPrec) ||
! refMid.Set( ORIG, vtDirMid, vtAuxMid))
return ( nMoveType == 0) ;
// versore correzione in locale al precente coincide con quello in locale al corrente
vtCorrMid = vtCorrPrec ;
vtCorrMid.ToLoc( refPrec) ;
vtCorrMid.ToGlob( refMid) ;
}
// inserisco nuova entità e modifico vecchia
int nMidEntId = m_pGeomDB->Copy( nEntId, GDB_ID_NULL, nEntId, GDB_BEFORE) ;
if ( nMidEntId == GDB_ID_NULL)
@@ -2376,6 +2393,7 @@ Operation::VerifyLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec,
pMidCamData->SetEndPoint( ptMid) ;
pMidCamData->SetToolDir( vtDirMid) ;
pMidCamData->SetAuxDir( vtAuxMid) ;
pMidCamData->SetCorrDir( vtCorrMid) ;
pMidCamData->SetFlag2( -1) ;
// calcolo gli assi rotanti per il punto medio
DBLVECTOR vAxRotHome( int( vAxVal.size() - 3)) ;
@@ -2562,7 +2580,8 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink)
{
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr || m_pMchMgr->GetCurrMachine() == nullptr)
return false ;
// recupero gruppo della geometria di lavorazione (Cutter Location)
// recupero gruppo della geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
if ( nClId == GDB_ID_NULL)
return false ;
@@ -2583,10 +2602,17 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink)
if ( pPrevOp != nullptr && ! pPrevOp->IsEmpty())
sPrevTool = pPrevOp->GetToolName() ;
// flag nuova gestione collegamenti tra lavorazioni
bool bNewLink = m_pMchMgr->GetCurrMachine()->GetNewLinkMgr() ;
// flag per CLIMB a inizio percorso già gestito
bool bClimbDone = false ;
// determino posizione precedente assi
DBLVECTOR vAxVal ;
bool bMaxZ = false ;
// se primo utensile o richiesto, uso la posizione home
// *** Se primo utensile o richiesto, uso la posizione home
if ( sPrevTool.empty() || NeedPrevHome()) {
// imposto l'utensile per i calcoli macchina
if ( ! m_pMchMgr->SetCalcTool( GetToolName(), GetHeadName(), GetExitNbr()))
@@ -2596,8 +2622,19 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink)
return false ;
// si parte da Z massima
bMaxZ = true ;
// per nuova gestione collegamenti, verifica aree protette
if ( bVerifyPreviousLink && bNewLink && m_pMchMgr->GetCurrIsCenter()) {
// recupero posizione iniziale lavorazione
DBLVECTOR vAxIni ;
if ( ! GetInitialAxesValues( false, vAxIni))
return false ;
// eseguo verifica
if ( ! ManageProtectedAreas( vAxVal, vAxIni, nullptr, this, bClimbDone))
return false ;
}
}
// se utensile non cambiato o su diversa uscita della stessa testa, uso posizione finale della lavorazione precedente
// *** Se utensile non cambiato o su diversa uscita della stessa testa, uso posizione finale della lavorazione precedente
else if ( ! ToolChangeNeeded( *pPrevOp, *this)) {
// imposto l'utensile per i calcoli macchina
if ( ! m_pMchMgr->SetCalcTool( GetToolName(), GetHeadName(), GetExitNbr()))
@@ -2610,7 +2647,7 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink)
if ( ! pPrevOp->GetFinalAxesValues( false, vAxVal))
return false ;
// elimino eventuali CLIMB già presenti
RemoveClimb( m_pGeomDB->GetFirstGroupInGroup( nClId)) ;
RemoveClimb() ;
// recupero posizione iniziale lavorazione
DBLVECTOR vAxIni ;
if ( ! GetInitialAxesValues( false, vAxIni))
@@ -2619,7 +2656,7 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink)
if ( m_pMchMgr->GetCurrIsCenter()) {
// recupero se ZHome è in basso
bool bZHomeDown = GetZHomeDown() ;
// recupero quota di home in Z
// recupero quote home e max di Z
double dHomeZ ;
if ( ! m_pMchMgr->GetCurrAxisHomePos( 2, dHomeZ))
return false ;
@@ -2627,13 +2664,13 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink)
double dDeltaZ = ( vAxIni[2] - vAxVal[2]) ;
if ( ( ! bZHomeDown && dDeltaZ > 100 * EPS_SMALL && vAxIni[2] <= dHomeZ) ||
( bZHomeDown && dDeltaZ < -100 * EPS_SMALL && vAxIni[2] >= dHomeZ)) {
if ( ! pPrevOp->AddRise( vAxVal, dDeltaZ, GDB_ID_NULL, bZHomeDown))
if ( ! pPrevOp->AddRise( vAxVal, dDeltaZ))
return false ;
// aggiorno quota in Z della posizione iniziale ( anche se verrà aggiornata solo in seguito)
vAxIni[2] = vAxVal[2] ;
}
// Verifico non ci sia collisione a HomeZ
bool bToZmax = false ;
bool bToMaxZ = false ;
bool bToMyHomeZ = false ;
DBLVECTOR vAxVal2 = vAxVal ; vAxVal2[2] = dHomeZ ;
DBLVECTOR vAxIni2 = vAxIni ; vAxIni2[2] = dHomeZ ;
@@ -2652,10 +2689,10 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink)
bToMyHomeZ = true ;
}
else
bToZmax = true ;
bToMaxZ = true ;
}
else
bToZmax = true ;
bToMaxZ = true ;
}
// se altrimenti ammessa rotazione a Zmax e richiesta rotazione
else if ( GetRotationAtZmax() &&
@@ -2688,11 +2725,11 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink)
// non devo fare alcunché
}
// se altrimenti richiesta risalita a Zmax
else if ( bToZmax || ForcedZmax( vAxVal, vAxIni, b3Raws)) {
else if ( bToMaxZ || ForcedZmax( vAxVal, vAxIni, b3Raws)) {
// cancello eventuale risalita parziale della lavorazione precedente
pPrevOp->RemoveRise() ;
// aggiungo risalita a Zmax
if ( ! pPrevOp->AddRise( vAxVal))
// aggiungo risalita a HomeZ/MaxZ
if ( ! pPrevOp->AddRise( vAxVal, NAN, GDB_ID_NULL, ( bNewLink ? ( bZHomeDown ? -1 : +1) : 0)))
return false ;
// si parte da Z massima
bMaxZ = true ;
@@ -2753,42 +2790,15 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink)
pPrevOp->GetFinalAxesValues( false, vAxVal) ;
// aggiungo risalita a Zsafe
double dDelta = ( ! bZHomeDown ? max( dSafeZ - vAxVal[2], 0.) : min( dSafeZ - vAxVal[2], 0.)) ;
if ( ! pPrevOp->AddRise( vAxVal, dDelta, GDB_ID_NULL, bZHomeDown))
if ( ! pPrevOp->AddRise( vAxVal, dDelta))
return false ;
// aggiorno quota iniziale in Z
vAxIni[2] = dSafeZ ;
}
}
// se ci sono aree protette...
if ( m_pMchMgr->GetCurrMachine()->ExistProtectedAreas()) {
// verifico se il collegamento le attraversa
const double PA_VERIF_LEN = 10 ;
Point3d ptStart( vAxVal[0], vAxVal[1], vAxVal[2]) ;
Point3d ptEnd( vAxIni[0], vAxIni[1], vAxIni[2]) ;
double dLen = DistXY( ptStart, ptEnd) ;
int nStep = int( dLen / PA_VERIF_LEN + 1) ;
bool bOutstroke = false ;
for ( int i = 1 ; i < nStep ; ++ i) {
Point3d ptCurr = Media( ptStart, ptEnd, double( i) / nStep) ;
int nStat = 0 ;
if ( ! m_pMchMgr->GetCurrMachine()->VerifyProtectedAreas( ptCurr.x, ptCurr.y, ptCurr.z, {}, nStat) || nStat != 0) {
bOutstroke = true ;
break ;
}
}
// in caso di attraversamento dell'area proibita
if ( bOutstroke) {
// chiamo funzione script OnSpecialRapidMove per avere nuovo punto intermedio
DBLVECTOR vAxNew ;
bool bModif = false ;
bool bOk = ( SpecialMoveRapid( vAxVal, vAxIni, vAxNew, bModif) && bModif) ;
// inserisco il nuovo punto alla fine della lavorazione precedente
if ( bOk)
vAxVal = vAxNew ;
if ( ! pPrevOp->AddSpecialRise( vAxVal, bOk))
return false ;
}
}
// gestione eventuali aree protette
if ( ! ManageProtectedAreas( vAxVal, vAxIni, pPrevOp, this, bClimbDone))
return false ;
}
// se robot
else if ( m_pMchMgr->GetCurrIsRobot()) {
@@ -2839,7 +2849,8 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink)
return false ;
}
}
// altrimenti aggiungo uscita per cambio utensile alla lavorazione precedente e parto da questa
// *** Altrimenti aggiungo uscita per cambio utensile alla lavorazione precedente e parto da questa
else {
// imposto la lavorazione precedente come corrente
m_pMchMgr->SetCurrMachining( pPrevOp->GetOwner()) ;
@@ -2851,18 +2862,39 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink)
if ( ! pPrevOp->AddRise( vAxVal))
return false ;
}
else {
// per nuova gestione collegamenti, verifica aree protette
if ( bVerifyPreviousLink && bNewLink && m_pMchMgr->GetCurrIsCenter()) {
// recupero posizione finale lavorazione
if ( ! pPrevOp->GetFinalAxesValues( false, vAxVal))
return false ;
// recupero posizione home
if ( ! m_pMchMgr->GetAllCurrAxesHomePos( vAxVal))
DBLVECTOR vAxIni ;
if ( ! m_pMchMgr->GetAllCurrAxesHomePos( vAxIni))
return false ;
if ( ! pPrevOp->ManageProtectedAreas( vAxVal, vAxIni, pPrevOp, nullptr, bClimbDone))
return false ;
}
// ripristino la lavorazione corrente
m_pMchMgr->SetCurrMachining( GetOwner()) ;
// imposto l'utensile per i calcoli macchina
if ( ! m_pMchMgr->SetCalcTool( GetToolName(), GetHeadName(), GetExitNbr()))
return false ;
// recupero posizione home
if ( ! m_pMchMgr->GetAllCurrAxesHomePos( vAxVal))
return false ;
// si parte da Z massima
bMaxZ = true ;
// per nuova gestione collegamenti, verifica aree protette
if ( bVerifyPreviousLink && bNewLink && m_pMchMgr->GetCurrIsCenter()) {
// recupero posizione iniziale lavorazione
DBLVECTOR vAxIni ;
if ( ! GetInitialAxesValues( false, vAxIni))
return false ;
// eseguo verifica
if ( ! ManageProtectedAreas( vAxVal, vAxIni, nullptr, this, bClimbDone))
return false ;
}
}
// aggiusto l'inizio di ogni percorso di lavoro
@@ -2871,8 +2903,8 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink)
int nClPathId = m_pGeomDB->GetFirstGroupInGroup( nClId) ;
while ( bOk && nClPathId != GDB_ID_NULL) {
// se richiesta verifica collegamento con lavorazione precedente, sistemo inizio
if ( bVerifyPreviousLink) {
if ( ! AdjustOneStartMovement( nClPathId, nPrevClPathId, pPrevOp, vAxVal, bMaxZ))
if ( bVerifyPreviousLink && ( ! bClimbDone || nPrevClPathId != GDB_ID_NULL)) {
if ( ! AdjustOneStartEndMovement( nClPathId, nPrevClPathId, pPrevOp, vAxVal, bMaxZ))
bOk = false ;
}
bMaxZ = false ;
@@ -2886,8 +2918,20 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink)
pPrevOp = nullptr ;
}
// aggiungo risalita finale
// Aggiungo risalita finale
bOk = bOk && AddRise( vAxVal) ;
// per nuova gestione collegamenti, verifica aree protette
if ( bVerifyPreviousLink && bNewLink && m_pMchMgr->GetCurrIsCenter()) {
// recupero posizione finale lavorazione
if ( ! GetFinalAxesValues( false, vAxVal))
return false ;
// recupero posizione home
DBLVECTOR vAxIni ;
if ( ! m_pMchMgr->GetAllCurrAxesHomePos( vAxIni))
return false ;
if ( ! ManageProtectedAreas( vAxVal, vAxIni, this, nullptr, bClimbDone))
return false ;
}
// se ultima operazione o la successiva lo richiede, vado in home
int nNextOpId = m_pMchMgr->GetNextActiveOperation( m_nOwnerId) ;
@@ -2900,7 +2944,124 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink)
//----------------------------------------------------------------------------
bool
Operation::AdjustOneStartMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOp, const DBLVECTOR& vAxPrev, bool bMaxZ)
Operation::ManageProtectedAreas( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, Operation* pPrevOp, Operation* pNextOp,
bool& bClimbDone)
{
// se non ci sono aree protette, esco subito.
if ( ! m_pMchMgr->GetCurrMachine()->ExistProtectedAreas())
return true ;
// il numero di assi non deve cambiare
if ( vAxStart.size() != vAxEnd.size())
return false ;
int nAxisTot = int( vAxStart.size()) ;
// recupero flag nuova gestione collegamenti tra lavorazioni
bool bNewLink = m_pMchMgr->GetCurrMachine()->GetNewLinkMgr() ;
// codifica tipo di collegamento
int nLinkType = ( pPrevOp == nullptr ? 0 : 2) + ( pNextOp == nullptr ? 0 : 1) ;
// Verifico se il collegamento le attraversa
Point3d ptSta( vAxStart[0], vAxStart[1], vAxStart[2]) ;
Point3d ptEnd( vAxEnd[0], vAxEnd[1], vAxEnd[2]) ;
DBLVECTOR vAngSta ;
for ( int i = 3 ; i < int( vAxStart.size()) && bNewLink ; ++ i)
vAngSta.emplace_back( vAxStart[i]) ;
DBLVECTOR vAngEnd ;
for ( int i = 3 ; i < int( vAxEnd.size()) && bNewLink ; ++ i)
vAngEnd.emplace_back( vAxEnd[i]) ;
// verifico inizio e fine
int nOutstroke = 0 ;
int nStSta = 0 ;
if ( ! m_pMchMgr->GetCurrMachine()->VerifyProtectedAreas( ptSta.x, ptSta.y, ptSta.z, vAngSta, nLinkType, nStSta) || nStSta != 0)
nOutstroke |= 2 ;
int nStEnd = 0 ;
if ( ! m_pMchMgr->GetCurrMachine()->VerifyProtectedAreas( ptEnd.x, ptEnd.y, ptEnd.z, vAngEnd, nLinkType, nStEnd) || nStEnd != 0)
nOutstroke |= 1 ;
// verifico i punti intermedi
const double PA_VERIF_LEN = 10 ;
double dLen = DistXY( ptSta, ptEnd) ;
int nStep = int( dLen / PA_VERIF_LEN) + 1 ;
for ( int i = 1 ; i < nStep && nOutstroke == 0 ; ++ i) {
double dCoeff = double( i) / nStep ;
Point3d ptCurr = Media( ptSta, ptEnd, dCoeff) ;
DBLVECTOR vAng ;
for ( int j = 0 ; j < int( vAngSta.size()) ; ++ j)
vAng.emplace_back( ( 1 - dCoeff) * vAngSta[j] + dCoeff * vAngEnd[j]) ;
int nStat = 0 ;
if ( ! m_pMchMgr->GetCurrMachine()->VerifyProtectedAreas( ptCurr.x, ptCurr.y, ptCurr.z, vAng, nLinkType, nStat) || nStat != 0)
nOutstroke |= 4 ;
}
if ( nOutstroke == 0)
return true ;
// assegno valori assi iniziali e finali, depurati di approcci/retrazioni aggiuntive (CLIMB e RISE) in area protetta
DBLVECTOR vNeatAxSta ;
if ( bNewLink && pPrevOp && ( nOutstroke & 2) != 0)
pPrevOp->GetFinalAxesValues( true, vNeatAxSta) ;
else
vNeatAxSta = vAxStart ;
DBLVECTOR vNeatAxEnd ;
if ( bNewLink && pNextOp && ( nOutstroke & 1) != 0)
pNextOp->GetInitialAxesValues( true, vNeatAxEnd) ;
else
vNeatAxEnd = vAxEnd ;
if ( int( vNeatAxSta.size()) != nAxisTot || int( vNeatAxEnd.size()) != nAxisTot)
return false ;
// chiamo funzione script OnSpecialRapidMove per avere posizioni di movimento
POSVECTOR vPosNew ;
bool bOk = SpecialMoveRapid( vNeatAxSta, vNeatAxEnd, nOutstroke, nLinkType, vPosNew) ;
// se tutto bene, eseguo cancellazioni e inserimenti come richiesto
if ( bOk) {
bClimbDone = bNewLink ;
// eventuali cancellazioni
if ( bNewLink && ( nOutstroke & 2) != 0 && pPrevOp != nullptr)
pPrevOp->RemoveRise() ;
if ( bNewLink && ( nOutstroke & 1) != 0 && pNextOp != nullptr)
pNextOp->RemoveClimb() ;
// eventuali inserimenti
for ( const auto& PosNew : vPosNew) {
if ( PosNew.nSide == 2) {
if ( pPrevOp == nullptr ||
! pPrevOp->AddSpecialRise( PosNew.vAxis, true, GDB_ID_NULL,
PosNew.nFlag, PosNew.nFlag2, PosNew.nMask, PosNew.sInfo))
return false ;
}
else if ( PosNew.nSide != 1)
return false ;
}
for ( int i = int( vPosNew.size()) - 1 ; i >= 0 ; --i) {
const auto& PosNew = vPosNew[i] ;
if ( PosNew.nSide == 1) {
if ( pNextOp == nullptr ||
! pNextOp->AddSpecialClimb( PosNew.vAxis, true, GDB_ID_NULL,
PosNew.nFlag, PosNew.nFlag2, PosNew.nMask, PosNew.sInfo))
return false ;
}
}
}
// altrimenti eseguo inserimento con segnalazione di errore
else {
if ( pPrevOp != nullptr) {
if ( ! pPrevOp->AddSpecialRise( vAxStart, false))
return false ;
}
if ( pNextOp != nullptr) {
if ( ! pNextOp->AddSpecialClimb( vAxEnd, false))
return false ;
}
if ( pPrevOp == nullptr && pNextOp == nullptr)
return false ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
Operation::AdjustOneStartEndMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOp, const DBLVECTOR& vAxPrev, bool bMaxZ)
{
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
return false ;
@@ -2970,7 +3131,7 @@ Operation::AdjustOneStartMovement( int nClPathId, int nPrevClPathId, Operation*
// se altrimenti robot
else if ( m_pMchMgr->GetCurrIsRobot()) {
// inserisco la posizione iniziale a Zmax
if ( ! AddRobotClimb( nEntId, -1))
if ( ! AddRobotClimb( nEntId))
return false ;
}
}
@@ -3032,12 +3193,12 @@ Operation::AdjustOneStartMovement( int nClPathId, int nPrevClPathId, Operation*
DBLVECTOR vAxPrevNoRise ;
pPrevOp->GetFinalAxesValues( false, vAxPrevNoRise) ;
double dDelta = ( ! bZHomeDown ? max( dSafeZ - vAxPrevNoRise[2], 0.) : min( dSafeZ - vAxPrevNoRise[2], 0.)) ;
if ( ! pPrevOp->AddRise( vAxNew1, dDelta, GDB_ID_NULL, bZHomeDown))
if ( ! pPrevOp->AddRise( vAxNew1, dDelta))
return false ;
}
else {
double dDelta = ( ! bZHomeDown ? max( dSafeZ - vAxPrev[2], 0.) : min( dSafeZ - vAxPrev[2], 0.)) ;
if ( ! AddRise( vAxNew1, dDelta, nPrevClPathId, bZHomeDown))
if ( ! AddRise( vAxNew1, dDelta, nPrevClPathId))
return false ;
}
// aggiungo posizione elevata prima dell'inizio del percorso corrente
@@ -3089,7 +3250,7 @@ Operation::AdjustOneStartMovement( int nClPathId, int nPrevClPathId, Operation*
// aggiungo risalita alla fine del precedente percorso
DBLVECTOR vAxNew ;
double dDelta = ( ! bZHomeDown ? max( vAxCurr[2] - vAxPrev[2], 0.) : min( vAxCurr[2] - vAxPrev[2], 0.)) ;
if ( ! AddRise( vAxNew, dDelta, nPrevClPathId, bZHomeDown))
if ( ! AddRise( vAxNew, dDelta, nPrevClPathId))
return false ;
}
// altrimenti Z corrente minore della precedente
@@ -3209,11 +3370,11 @@ Operation::AdjustOneStartMovement( int nClPathId, int nPrevClPathId, Operation*
// eventuali risalite finali già eliminate dal chiamante
// aggiungo risalita a Z max alla fine del percorso precedente
DBLVECTOR vAxNew = vAxPrev ;
if ( ! AddRise( vAxNew, -1, nPrevClPathId))
if ( ! AddRise( vAxNew, NAN, nPrevClPathId))
return false ;
}
// inserisco la posizione iniziale a Zmax in questo percorso
if ( ! AddRobotClimb( nEntId, -1))
if ( ! AddRobotClimb( nEntId))
return false ;
}
}
@@ -3241,12 +3402,100 @@ Operation::ToolChangeNeeded( const Operation& Op1, const Operation& Op2) const
return true ;
}
//----------------------------------------------------------------------------
// Inserisce sempre prima della prima entità del percorso
bool
Operation::AddSpecialClimb( const DBLVECTOR& vAxVal, bool bOk, int nClPathId,
int nFlag, int nFlag2, int nMask, const string& sInfo)
{
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
return false ;
// recupero gruppo per geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_CL) ;
if ( nClId == GDB_ID_NULL)
return false ;
// se percorso CL specificato, verifico appartenga al gruppo sopra ricavato
if ( nClPathId != GDB_ID_NULL) {
if ( m_pGeomDB->GetParentId( nClPathId) != nClId)
return false ;
}
// altrimenti, recupero il primo percorso CL della operazione
else {
nClPathId = m_pGeomDB->GetFirstGroupInGroup( nClId) ;
if ( nClPathId == GDB_ID_NULL)
return false ;
}
// cerco la prima entità del percorso
int nEntId = m_pGeomDB->GetFirstInGroup( nClPathId) ;
if ( nEntId == GDB_ID_NULL)
return false ;
// ne recupero i dati Cam
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
if ( pCamData == nullptr)
return false ;
// creo oggetto punto per DB geometrico
PtrOwner<IGeoPoint3d> pGP( CreateGeoPoint3d()) ;
if ( IsNull( pGP))
return false ;
// assegno le coordinate del punto
pGP->Set( pCamData->GetEndPoint()) ;
// inserisco l'oggetto nel DB geometrico prima della prima entità
int nId = m_pGeomDB->InsertGeoObj( GDB_ID_NULL, nEntId, GDB_BEFORE, Release( pGP)) ;
if ( nId == GDB_ID_NULL)
return false ;
m_pGeomDB->SetName( nId, MCH_CL_CLIMB) ;
// creo oggetto dati Cam da associare al punto
PtrOwner<CamData> pCam( pCamData->Clone()) ;
if ( IsNull( pCam))
return false ;
// assegno i dati
pCam->SetAxes( ( bOk ? CamData::AS_OK : CamData::AS_OUTSTROKE), vAxVal) ;
if ( nMask >= 0)
pCam->ChangeAxesMask( nMask) ;
pCam->SetMoveType( 0) ;
pCam->SetFeed( 0) ;
pCam->SetFlag( nFlag) ;
pCam->SetFlag2( nFlag2) ;
// associo questo oggetto a quello geometrico
m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
// inserzione eventuali info
if ( ! IsEmptyOrSpaces( sInfo)) {
STRVECTOR vsTokens ;
Tokenize( sInfo, ";", vsTokens) ;
for ( const auto& sToken : vsTokens) {
if ( ! IsEmptyOrSpaces( sToken)) {
string sKey, sVal ;
SplitFirst( sToken, "=", sKey, sVal) ;
if ( ! IsEmptyOrSpaces( sKey))
m_pGeomDB->SetInfo( nId, sKey, sVal) ;
}
}
}
return true ;
}
//----------------------------------------------------------------------------
bool
Operation::RemoveClimb( int nClPathId)
{
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
return false ;
// recupero gruppo per geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_CL) ;
if ( nClId == GDB_ID_NULL)
return false ;
// se percorso CL specificato, verifico appartenga al gruppo sopra ricavato
if ( nClPathId != GDB_ID_NULL) {
if ( m_pGeomDB->GetParentId( nClPathId) != nClId)
return false ;
}
// altrimenti, recupero il primo percorso CL della operazione
else {
nClPathId = m_pGeomDB->GetFirstGroupInGroup( nClId) ;
if ( nClPathId == GDB_ID_NULL)
return false ;
}
// elimino tutte le entità CLIMB all'inizio del percorso
int nId = m_pGeomDB->GetFirstNameInGroup( nClPathId, MCH_CL_CLIMB) ;
while ( nId != GDB_ID_NULL) {
@@ -3259,7 +3508,7 @@ Operation::RemoveClimb( int nClPathId)
//----------------------------------------------------------------------------
bool
Operation::AddRise( DBLVECTOR& vAxVal, double dDelta, int nClPathId, bool bZHomeDown)
Operation::AddRise( DBLVECTOR& vAxVal, double dDelta, int nClPathId, int nToMinMaxZ)
{
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
return false ;
@@ -3318,17 +3567,22 @@ Operation::AddRise( DBLVECTOR& vAxVal, double dDelta, int nClPathId, bool bZHome
// devono esserci almeno i tre assi lineari
if ( vAxVal.size() < 3)
return false ;
// se delta positivo lo uso come incremento di Z
if ( dDelta > 0 || bZHomeDown) {
// se delta definito lo uso come incremento di Z
if ( isfinite( dDelta)) {
vAxVal[2] += dDelta ;
nFlag = 0 ; // movimento standard
}
// altrimenti uso la Z home
// altrimenti uso HomeZ/MinZ/MaxZ
else {
// recupero posizione home
DBLVECTOR vAxHome ;
m_pMchMgr->GetAllCurrAxesHomePos( vAxHome) ;
vAxVal[2] = vAxHome[2] ;
// recupero posizione Z
double dExtrZ ;
if ( nToMinMaxZ == -1)
m_pMchMgr->GetCurrAxisMin( 2, dExtrZ) ;
else if ( nToMinMaxZ == +1)
m_pMchMgr->GetCurrAxisMax( 2, dExtrZ) ;
else
m_pMchMgr->GetCurrAxisHomePos( 2, dExtrZ) ;
vAxVal[2] = dExtrZ ;
nFlag = 3 ; // movimento a Zmax
nFlag2 = 1 ;
}
@@ -3415,8 +3669,10 @@ Operation::AddRise( DBLVECTOR& vAxVal, double dDelta, int nClPathId, bool bZHome
}
//----------------------------------------------------------------------------
// Inserisce sempre dopo l'ultima entità del percorso
bool
Operation::AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk, int nClPathId, int nFlag)
Operation::AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk, int nClPathId,
int nFlag, int nFlag2, int nMask, const string& sInfo)
{
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
return false ;
@@ -3460,12 +3716,28 @@ Operation::AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk, int nClPathId, int
return false ;
// assegno i dati
pCam->SetAxes( ( bOk ? CamData::AS_OK : CamData::AS_OUTSTROKE), vAxVal) ;
if ( nMask >= 0)
pCam->ChangeAxesMask( nMask) ;
pCam->SetMoveType( 0) ;
pCam->SetFeed( 0) ;
pCam->SetFlag( nFlag) ;
pCam->SetFlag2( 0) ;
pCam->SetFlag2( nFlag2) ;
// associo questo oggetto a quello geometrico
m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
// inserzione eventuali info
if ( ! IsEmptyOrSpaces( sInfo)) {
STRVECTOR vsTokens ;
Tokenize( sInfo, ";", vsTokens) ;
for ( const auto& sToken : vsTokens) {
if ( ! IsEmptyOrSpaces( sToken)) {
string sKey, sVal ;
SplitFirst( sToken, "=", sKey, sVal) ;
if ( ! IsEmptyOrSpaces( sKey))
m_pGeomDB->SetInfo( nId, sKey, sVal) ;
}
string sKey, sVal ;
}
}
return true ;
}
@@ -3605,7 +3877,7 @@ Operation::AddRobotClimb( int nEntId, double dDeltaZ)
return false ;
DBLVECTOR vAxVal = pCdEnt->GetAxesVal() ;
// verifico se richiesta Zmax
bool bZmax = ( dDeltaZ < 0) ;
bool bZmax = ( ! isfinite( dDeltaZ)) ;
// calcolo la posizione sopra il punto a Z richiesta
DBLVECTOR vAxClimb = vAxVal ;
double dNewDeltaZ ;
@@ -3877,15 +4149,17 @@ Operation::SpecialGetMaxZ( const DBLVECTOR& vAx1, const Vector3d& vtTool1,
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_TDIRP, vtTool1) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_TDIR, vtTool2) ;
// eseguo
bOk = bOk && pMch->LuaCallFunction( ON_SPECIAL_GETMAXZ, false) ;
bOk = bOk && pMch->LuaCallFunction( ON_SPECIAL_GETMAXZ) ;
// recupero valori parametri obbligatori
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) ;
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_MAXZ, dMaxZ) ;
// reset
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
// segnalo errori
if ( nErr != 0) {
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) && nErr == 0 ;
if ( bOk && ! pMch->LuaGetGlobVar( EMC_VAR + EVAR_MAXZ, dMaxZ)) {
bOk = false ;
nErr = 91 ;
}
// reset
bOk = pMch->LuaResetGlobVar( EMC_VAR) && bOk ;
// segnalo errori
if ( ! bOk) {
string sOut = " Error in " + ON_SPECIAL_GETMAXZ + " (" + ToString( nErr) + ")" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str())
}
@@ -3998,7 +4272,7 @@ ResetMachine( Machine* pMch)
if ( pMch == nullptr)
return false ;
// Riporto la macchina in home
pMch->ResetAllAxesPos() ;
pMch->ResetAllAxesPos( true, false) ;
// Sgancio pezzi, grezzi e sottopezzi dalla tavola corrente
pMch->UnlinkAllPartsFromGroups() ;
pMch->UnlinkAllRawPartsFromGroups() ;
@@ -4026,7 +4300,7 @@ Operation::TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEn
return false ;
// Porto la macchina in home
pMch->ResetAllAxesPos() ;
pMch->ResetAllAxesPos( true, false) ;
// Elenco grezzi attivi
INTVECTOR vRawId ;
int nRawId = m_pMchMgr->GetFirstRawPart() ;
@@ -4154,7 +4428,6 @@ Operation::OneMoveTestCollisionAvoid( const STRVECTOR& vAxName, const DBLVECTOR&
// distanza di sicurezza
const double TOL_SAFEDIST = 5.0 ;
const double MIN_SAFEDIST = 5.0 ;
double dSafeDist = GetSafeZ() ;
dSafeDist = max( dSafeDist - TOL_SAFEDIST, MIN_SAFEDIST) ;
// Vado nelle posizioni da controllare
@@ -4406,6 +4679,7 @@ Operation::SpecialTestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR
// avvio
bool bOk = true ;
int nErr = 99 ;
int nRes = SCAV_TOTEST ;
// imposto valori parametri
bOk = bOk && pMch->LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_TOOL, GetToolName()) ;
@@ -4420,20 +4694,21 @@ Operation::SpecialTestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR
for ( int i = 1 ; i <= int( vAxEnd.size()) ; ++ i)
bOk = bOk && pMch->LuaSetGlobVar( GetGlobVarAxisValue( i, EMC_VAR, bIsRobot), vAxEnd[i-1]) ;
// eseguo
bOk = bOk && pMch->LuaCallFunction( ON_SPECIAL_TESTCOLLISIONAVOID, false) ;
bOk = bOk && pMch->LuaCallFunction( ON_SPECIAL_TESTCOLLISIONAVOID) ;
// recupero valori parametri obbligatori
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) ;
int nRes = SCAV_TOTEST ;
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_RES, nRes) ;
// reset
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
// segnalo errori
if ( nErr != 0) {
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) && nErr == 0 ;
if ( bOk && ! pMch->LuaGetGlobVar( EMC_VAR + EVAR_RES, nRes)) {
bOk = false ;
nErr = 91 ;
}
// reset
bOk = pMch->LuaResetGlobVar( EMC_VAR) && bOk ;
// segnalo errori
if ( ! bOk) {
string sOut = " Error in " + ON_SPECIAL_TESTCOLLISIONAVOID + " (" + ToString( nErr) + ")" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str())
}
return ( nErr != 0 ? SCAV_ERROR : nRes) ;
return ( bOk ? nRes : SCAV_ERROR) ;
}
//----------------------------------------------------------------------------
@@ -4450,104 +4725,156 @@ Operation::SpecialMoveZup( DBLVECTOR& vAx, Vector3d& vtTool, int& nFlag, int& nF
static const string EVAR_MODIF = ".MODIF" ; // OUT (bool) flag di modifica effettuata
static const string ON_SPECIAL_MOVEZUP = "OnSpecialMoveZup" ;
// eseguo l'azione
if ( pMch->LuaExistsFunction( ON_SPECIAL_MOVEZUP)) {
bool bOk = true ;
int nErr = 99 ;
// imposto valori parametri
bOk = bOk && pMch->LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_FLAG, nFlag) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_FLAG2, nFlag2) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_TOOL, GetToolName()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_HEAD, GetHeadName()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_EXIT, GetExitNbr()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_TCPOS, GetToolTcPos()) ;
// direzione utensile
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_TDIR, vtTool) ;
// valore degli assi
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
int nNumAxes = int( vAx.size()) ;
for ( int i = 1 ; i <= nNumAxes ; ++ i)
bOk = bOk && pMch->LuaSetGlobVar( GetGlobVarAxisValue( i, EMC_VAR, bIsRobot), vAx[i-1]) ;
// eseguo
bOk = bOk && pMch->LuaCallFunction( ON_SPECIAL_MOVEZUP, false) ;
// recupero valori parametri obbligatori
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) ;
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_MODIF, bModif) ;
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + GVAR_FLAG, nFlag) ;
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + GVAR_FLAG2, nFlag2) ;
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + GVAR_TDIR, vtTool) ;
for ( int i = 1 ; i <= nNumAxes ; ++ i)
bOk = bOk && pMch->LuaGetGlobVar( GetGlobVarAxisValue( i, EMC_VAR, bIsRobot), vAx[i-1]) ;
// reset
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
// segnalo errori
if ( nErr != 0) {
bOk = false ;
string sOut = " Error in " + ON_SPECIAL_MOVEZUP + " (" + ToString( nErr) + ")" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str())
}
return bOk ;
}
else {
// se funzione non implementata
if ( ! pMch->LuaExistsFunction( ON_SPECIAL_MOVEZUP)) {
bModif = false ;
return true ;
}
// eseguo l'azione
bool bOk = true ;
int nErr = 99 ;
// imposto valori parametri
bOk = bOk && pMch->LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_FLAG, nFlag) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_FLAG2, nFlag2) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_TOOL, GetToolName()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_HEAD, GetHeadName()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_EXIT, GetExitNbr()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_TCPOS, GetToolTcPos()) ;
// direzione utensile
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_TDIR, vtTool) ;
// valore degli assi
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
int nNumAxes = int( vAx.size()) ;
for ( int i = 1 ; i <= nNumAxes ; ++ i)
bOk = bOk && pMch->LuaSetGlobVar( GetGlobVarAxisValue( i, EMC_VAR, bIsRobot), vAx[i-1]) ;
// eseguo
bOk = bOk && pMch->LuaCallFunction( ON_SPECIAL_MOVEZUP) ;
// recupero valori parametri obbligatori
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) && nErr == 0 ;
if ( bOk) {
if ( ! pMch->LuaGetGlobVar( EMC_VAR + EVAR_MODIF, bModif) ||
! pMch->LuaGetGlobVar( EMC_VAR + GVAR_FLAG, nFlag) ||
! pMch->LuaGetGlobVar( EMC_VAR + GVAR_FLAG2, nFlag2) ||
! pMch->LuaGetGlobVar( EMC_VAR + GVAR_TDIR, vtTool))
nErr = 91 ;
for ( int i = 1 ; i <= nNumAxes ; ++ i) {
if ( ! pMch->LuaGetGlobVar( GetGlobVarAxisValue( i, EMC_VAR, bIsRobot), vAx[i-1]))
nErr = 92 ;
}
bOk = ( nErr == 0) ;
}
// reset
bOk = pMch->LuaResetGlobVar( EMC_VAR) && bOk ;
// segnalo errori
if ( ! bOk) {
string sOut = " Error in " + ON_SPECIAL_MOVEZUP + " (" + ToString( nErr) + ")" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str())
}
return bOk ;
}
//----------------------------------------------------------------------------
bool
Operation::SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, DBLVECTOR& vAxNew, bool& bModif)
Operation::SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nOutstroke, int nLinkType,
POSVECTOR& vNewPos)
{
// recupero la macchina corrente
Machine* pMch = ( m_pMchMgr != nullptr ? m_pMchMgr->GetCurrMachine() : nullptr) ;
if ( pMch == nullptr)
return false ;
// costanti
static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok)
static const string EVAR_MODIF = ".MODIF" ; // OUT (bool) flag di modifica effettuata
static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo
static const string EVAR_OUTSTROKE = ".OUTSTROKE" ; // IN (int) codice extracorsa posizioni (1=Inizio, 2=Fine, 3=FinePrec+InizioSucc))
static const string EVAR_LINKTYPE = ".LINKTYPE" ; // IN (int) codice tipo collegamento (1=Inizio, 2=Fine, 3=FinePrec+InizioSucc))
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok)
static const string EVAR_POSTOT = ".POSTOT" ; // OUT (int) numero di nuove posizioni
static const string EVAR_POS = ".POS" ; // OUT (table) vettore di posizioni
static const string EVAR_SIDE = ".SIDE" ; // OUT (int) codice inserimento movimento (1=Inizio, 2=Fine)
static const string ON_SPECIAL_MOVERAPID = "OnSpecialMoveRapid" ;
// eseguo l'azione
if ( pMch->LuaExistsFunction( ON_SPECIAL_MOVERAPID)) {
bool bOk = true ;
int nErr = 99 ;
// imposto valori parametri
bOk = bOk && pMch->LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_TOOL, GetToolName()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_HEAD, GetHeadName()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_EXIT, GetExitNbr()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_TCPOS, GetToolTcPos()) ;
// valore degli assi
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
int nNumAxes = int( vAxStart.size()) ;
for ( int i = 1 ; i <= nNumAxes ; ++ i)
bOk = bOk && pMch->LuaSetGlobVar( GetGlobVarAxisPrev( i, EMC_VAR, bIsRobot), vAxStart[i-1]) ;
for ( int i = 1 ; i <= nNumAxes ; ++ i)
bOk = bOk && pMch->LuaSetGlobVar( GetGlobVarAxisValue( i, EMC_VAR, bIsRobot), vAxEnd[i-1]) ;
// eseguo
bOk = bOk && pMch->LuaCallFunction( ON_SPECIAL_MOVERAPID, false) ;
// recupero valori parametri obbligatori
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) ;
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_MODIF, bModif) ;
vAxNew.resize( nNumAxes) ;
for ( int i = 1 ; i <= nNumAxes ; ++ i)
bOk = bOk && pMch->LuaGetGlobVar( GetGlobVarAxisValue( i, EMC_VAR, bIsRobot), vAxNew[i-1]) ;
// reset
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
// segnalo errori
if ( nErr != 0) {
bOk = false ;
string sOut = " Error in " + ON_SPECIAL_MOVERAPID + " (" + ToString( nErr) + ")" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str())
// se la funzione non è definita, esco
if ( ! pMch->LuaExistsFunction( ON_SPECIAL_MOVERAPID))
return false ;
// eseguo
bool bOk = true ;
int nErr = 99 ;
// imposto valori parametri
bOk = bOk && pMch->LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_TOOL, GetToolName()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_HEAD, GetHeadName()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_EXIT, GetExitNbr()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_TCPOS, GetToolTcPos()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_MCHID, GetOwner()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_PHASE, m_nPhase) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OUTSTROKE, ( nOutstroke % 4)) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_LINKTYPE, nLinkType) ;
// valore degli assi
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
int nNumAxes = int( vAxStart.size()) ;
for ( int i = 1 ; i <= nNumAxes ; ++ i)
bOk = bOk && pMch->LuaSetGlobVar( GetGlobVarAxisPrev( i, EMC_VAR, bIsRobot), vAxStart[i-1]) ;
for ( int i = 1 ; i <= nNumAxes ; ++ i)
bOk = bOk && pMch->LuaSetGlobVar( GetGlobVarAxisValue( i, EMC_VAR, bIsRobot), vAxEnd[i-1]) ;
// eseguo
bOk = bOk && pMch->LuaCallFunction( ON_SPECIAL_MOVERAPID) ;
// recupero valori parametri obbligatori
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) && nErr == 0 ;
// recupero i parametri facoltativi
int nPosTot ;
if ( ! pMch->LuaGetGlobVar( EMC_VAR + EVAR_POSTOT, nPosTot))
nPosTot = -1 ;
// recupero gli assi
vNewPos.clear() ;
if ( nPosTot == -1) {
vNewPos.resize( 1) ;
vNewPos[0].vAxis.resize( nNumAxes) ;
for ( int i = 1 ; i <= nNumAxes && bOk ; ++ i) {
if ( ! pMch->LuaGetGlobVar( GetGlobVarAxisValue( i, EMC_VAR, bIsRobot), vNewPos[0].vAxis[i-1])) {
bOk = false ;
nErr = 91 ;
break ;
}
}
return bOk ;
}
else {
bModif = false ;
return true ;
for ( int j = 1 ; j <= nPosTot && bOk ; ++ j) {
string sRec = EMC_VAR + EVAR_POS + "." + ToString( j) ;
Position CurrPos ;
if ( ! pMch->LuaGetGlobVar( sRec + EVAR_SIDE, CurrPos.nSide)) {
bOk = false ;
nErr = 92 ;
break ;
}
CurrPos.vAxis.resize( nNumAxes) ;
for ( int i = 1 ; i <= nNumAxes ; ++ i) {
if ( ! pMch->LuaGetGlobVar( GetGlobVarAxisValue( i, sRec, bIsRobot), CurrPos.vAxis[i-1])) {
bOk = false ;
nErr = 93 ;
break ;
}
}
if ( ! pMch->LuaGetGlobVar( sRec + GVAR_MASK, CurrPos.nMask))
CurrPos.nMask = -1 ;
if ( ! pMch->LuaGetGlobVar( sRec + GVAR_FLAG, CurrPos.nFlag))
CurrPos.nFlag = 0 ;
if ( ! pMch->LuaGetGlobVar( sRec + GVAR_FLAG2, CurrPos.nFlag2))
CurrPos.nFlag2 = 0 ;
if ( ! pMch->LuaGetGlobVar( sRec + GVAR_INFO, CurrPos.sInfo))
CurrPos.sInfo = "" ;
vNewPos.emplace_back( CurrPos) ;
}
}
// reset
bOk = pMch->LuaResetGlobVar( EMC_VAR) && bOk ;
// segnalo errori
if ( ! bOk) {
string sOut = " Error in " + ON_SPECIAL_MOVERAPID + " (" + ToString( nErr) + ")" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str())
}
return bOk ;
}
+23 -6
View File
@@ -114,6 +114,18 @@ class Operation : public IUserObj
protected :
Operation( void) ;
protected :
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 ;
protected :
bool UpdateFollowingOperationsStatus( int nModif) ;
bool GetElevation( int nPhase, const Point3d& ptP,
@@ -198,15 +210,19 @@ class Operation : public IUserObj
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec) ;
bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ;
bool AdjustOneStartMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOp, const DBLVECTOR& vAxPrev, bool bMaxZ) ;
bool ManageProtectedAreas( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, Operation* pPrevOp, Operation* pNextOp, bool& bClimbDone) ;
bool AdjustOneStartEndMovement( 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 AddSpecialClimb( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL,
int nFlag = 0, int nFlag2 = 0, int nMask = -1, const std::string& sInfo = "") ;
bool RemoveClimb( int nClPathId = GDB_ID_NULL) ;
bool AddRise( DBLVECTOR& vAxVal, double dDelta = NAN, int nClPathId = GDB_ID_NULL, int nToMinMaxZ = 0) ;
bool AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL,
int nFlag = 0, int nFlag2 = 0, int nMask = -1, const std::string& sInfo = "") ;
bool RemoveRise( int nClPathId = GDB_ID_NULL) ;
bool AddHome( void) ;
bool RemoveClimbRiseHome( void) ;
bool AddRobotClimb( int nEntId, double dDeltaZ) ;
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 ;
@@ -224,7 +240,8 @@ class Operation : public IUserObj
bool TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) 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 SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nOutstroke, int nLinkType,
POSVECTOR& vNewPos) ;
bool GetAggrBottomData( const std::string& sHead, AggrBottom& agbData) const ;
bool IsAggrBottom( const std::string& sHead) const ;
+1
View File
@@ -18,6 +18,7 @@
#include "/EgtDev/Include/EMkOperationConst.h"
#include <string>
#define POCKETING_NT 0
//----------------------------------------------------------------------------
static const std::string s_OpeClass[] = {"",
+12
View File
@@ -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
@@ -61,6 +66,7 @@ static const std::string GVAR_HEAD = ".HEAD" ; // (string) nome test
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
@@ -90,6 +96,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
@@ -185,6 +192,9 @@ static const std::string GVAR_SAFEDIST = ".SAFEDIST" ; // (num) distanza
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_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" ;
@@ -194,6 +204,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" ;
@@ -216,6 +227,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" ;
+22 -13
View File
@@ -89,7 +89,9 @@ static string KEY_OPEN = "OPEN" ;
static int LINK_CURVE_PROP = -3 ;
//----------------------------------------------------------------------------
USEROBJ_REGISTER( GetOperationClass( OPER_POCKETING), Pocketing) ;
#if POCKETING_NT != 1
USEROBJ_REGISTER( GetOperationClass( OPER_POCKETING), Pocketing) ;
#endif
//----------------------------------------------------------------------------
const string&
@@ -628,13 +630,15 @@ Pocketing::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
// confermo i percorsi di lavorazione
m_nPockets = nCurrPockets ;
LOG_DBG_INFO( GetEMkLogger(), "Pocketing apply skipped : status already ok") ;
string sLog = string( "Pocketing 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 ;
@@ -943,10 +947,14 @@ Pocketing::UpdateToolData( bool* pbChanged)
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 ;
@@ -1600,7 +1608,7 @@ Pocketing::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, "MaxElev", dMaxElev) && dElev > dMaxElev)
dElev = dMaxElev ;
// verifico che lo step dell'utensile sia sensato
@@ -1671,10 +1679,11 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
// recupero eventuale flag di lato aperto forzato fuori dal grezzo
int nOpenOutRaw ;
m_bOpenOutRaw = ( FromString( ExtractInfo( m_Params.m_sUserNotes, "OpenOutRaw="), nOpenOutRaw) && nOpenOutRaw != 0) ;
m_bOpenOutRaw = ( GetValInNotes( m_Params.m_sUserNotes, "OpenOutRaw", nOpenOutRaw) && nOpenOutRaw != 0) ;
// recupero eventuale minima lunghezza di attacco su lato aperto
FromString( ExtractInfo( m_Params.m_sUserNotes, "OpenMinSafe="), m_dOpenMinSafe) ;
m_dOpenMinSafe = 0 ;
GetValInNotes( m_Params.m_sUserNotes, "OpenMinSafe", m_dOpenMinSafe) ;
// se richiesta anteprima
if ( nPvId != GDB_ID_NULL) {
@@ -3872,7 +3881,7 @@ Pocketing::CalcSpiral( const ICurveComposite* pCompo, int nReg, bool bSplitArcs,
Vector3d vtOrtho = OrthoCompo( vtOtherDir, vtDir) ;
double dPocketSize = vtOrtho.Len() ;
double dMaxOptSize = m_Params.m_dSideStep ;
FromString( ExtractInfo( m_Params.m_sUserNotes, "MaxOptSize="), dMaxOptSize) ;
GetValInNotes( m_Params.m_sUserNotes, "MaxOptSize", dMaxOptSize) ;
if ( ( ( bSomeOpen && dPocketSize < m_TParams.m_dDiam + EPS_SMALL) || abs( dPocketSize - m_TParams.m_dDiam) < EPS_SMALL) &&
dPocketSize < dMaxOptSize + 10 * EPS_SMALL) {
if ( nReg == 0) {
@@ -3901,8 +3910,8 @@ Pocketing::CalcSpiral( const ICurveComposite* pCompo, int nReg, bool bSplitArcs,
CalcCurveLimitOffset( *pCompo, dMaxOffs) ;
else
CalcCurveLimitOffset( *pOffs, dMaxOffs) ;
if ( abs( dMaxOffs - dOffs) < EPS_SMALL)
dOffs -= EPS_SMALL ;
if ( dOffs > dMaxOffs - 10 * EPS_ZERO && dOffs < dMaxOffs + EPS_SMALL)
dOffs = dMaxOffs - 10 * EPS_ZERO ;
// calcolo
OffsetCurve OffsCrv ;
@@ -5498,7 +5507,7 @@ bool
Pocketing::GetForcedClosed( void)
{
int nOpen ;
if ( FromString( ExtractInfo( m_Params.m_sUserNotes, "Open="), nOpen) && nOpen == 0)
if ( GetValInNotes( m_Params.m_sUserNotes, "Open", nOpen) && nOpen == 0)
return true ;
else
return false ;
+3969
View File
File diff suppressed because it is too large Load Diff
+198
View File
@@ -0,0 +1,198 @@
//----------------------------------------------------------------------------
// 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 bSingleCrv ; // se percorso formato da una curva singola ( in generale per SubSteps)
bool bOptTrap ; // flag per casi ottimizzati a trapezio ( per Spiral)
bool bIsZigZagOneWayBorder ; // curve di bordo dei lati chiusi ( per ZigZag e OneWay)
PtrOwner<ICurveComposite> pCrvPath ; // percorso del centro utensile
PtrOwner<ICurveComposite> pCrvRet ; // curva di ritorno per LeadIn/Out a guida
} ;
// 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( void) const override
{ return ( m_nPockets == 0) ; }
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( bool* pbChanged = nullptr) override ;
const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ;
public :
PocketingNT( void) ;
private :
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
bool GetCurves( SelData Id, 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* GetExtrusionStm( const ISurfFlatRegion* pSfr, const Vector3d& vtTrasl, const Vector3d& vtExtr) ;
ISurfFlatRegion* GetSfrByStmIntersection( const IntersParPlanesSurfTm& IPPStm, double dDist, double dSmallOffs = 0) ;
bool ChooseCloseOrOpenEdge( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStmExtrusion) ;
bool CalcLimitRegion( const ISurfFlatRegion* pSfrPock, const ISurfFlatRegion* pSfrRaw, ISurfFlatRegion* pSfrLimit) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool CalcRegionElevation( const ICurveComposite* pCompo, 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 CalcPaths( STEPINFOPOVECTOR& vStepInfo) ;
bool AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, double dElev, double dStep, bool bSplitArcs) ;
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 CalcLeadInStart( const 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 ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced, Point3d& ptP1) ;
double GetRadiusForStartEndElevation( void) ;
bool GetForcedClosed( void) ;
bool GetMidOfLongestOpenSide( const ICurveComposite* pCompo, Point3d& ptMid, Vector3d& vtMidOut) ;
bool AdjustContourWithOpenEdges( ICurveComposite* pCompo) ;
bool AdjustContourStart( ICurveComposite* pCompo) ;
bool CheckSafetyLinearLink( const Point3d& ptCurr, const ISurfFlatRegion* pSfrLimit, const Vector3d& vtTool,
const Point3d& ptDest, bool& bSafe) ;
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 CalcDistanceFromRawSurface( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist, Vector3d& vtNorm) ;
// debug
void _debug_draw_sfr( const ISurfFlatRegion* pSfr, bool bUniform) ;
void _debug_draw_loop( const ICurveComposite* pCrvCompo, bool bUniform) ;
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
bool _m_Debug = false ; // _debug
} ;
+72 -13
View File
@@ -171,7 +171,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 ;
}
@@ -207,7 +207,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 ;
}
}
@@ -224,6 +224,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 ;
@@ -231,8 +263,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
@@ -246,7 +279,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
@@ -322,7 +355,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 ;
}
@@ -386,11 +420,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
@@ -581,7 +619,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
@@ -806,10 +844,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) ;
@@ -818,6 +870,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 ;
@@ -825,11 +881,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) ;
@@ -840,13 +896,14 @@ 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()) ;
@@ -916,7 +973,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) ;
@@ -935,6 +992,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 ;
+6 -4
View File
@@ -42,20 +42,21 @@ 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) ;
@@ -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 ;
+11 -5
View File
@@ -498,13 +498,15 @@ SawFinishing::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
( 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 ;
@@ -794,10 +796,14 @@ SawFinishing::UpdateToolData( bool* pbChanged)
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 ;
+11 -5
View File
@@ -481,13 +481,15 @@ SawRoughing::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
// confermo i percorsi di lavorazione
m_nCuts = nCurrCuts ;
LOG_DBG_INFO( GetEMkLogger(), "SawRoughing apply skipped : status already ok") ;
string sLog = string( "SawRoughing 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 ;
@@ -752,10 +754,14 @@ SawRoughing::UpdateToolData( bool* pbChanged)
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 ;
+60 -26
View File
@@ -16,6 +16,7 @@
#include "MachMgr.h"
#include "DllMain.h"
#include "Sawing.h"
#include "GeoConst.h"
#include "OperationConst.h"
#include "/EgtDev/Include/EXeCmdLogOff.h"
#include "/EgtDev/Include/EXeConst.h"
@@ -98,6 +99,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 +213,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 ;
}
@@ -646,13 +649,15 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
( 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 ;
@@ -687,6 +692,11 @@ 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, "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
@@ -1858,10 +1868,10 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve
if ( ! sFsta.empty()) {
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) {
@@ -1869,20 +1879,20 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve
if ( ! sFend.empty()) {
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, "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, "EWE", dEndWhiskExt) ;
// Se richiesto Preview
if ( nPvId != GDB_ID_NULL) {
@@ -2128,12 +2138,14 @@ 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) ;
// 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))
@@ -2230,11 +2242,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 ;
@@ -2276,8 +2294,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) ;
}
@@ -3820,8 +3838,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) ;
@@ -3847,7 +3873,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) ;
@@ -3962,7 +3996,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)
@@ -3998,7 +4032,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 ;
}
}
@@ -4022,7 +4056,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 ;
}
}
@@ -4057,7 +4091,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 ;
}
}
@@ -4082,7 +4116,7 @@ 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 ;
}
}
+1
View File
@@ -164,6 +164,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
} ;
+1 -1
View File
@@ -59,5 +59,5 @@ class __declspec( novtable) ISimulator
double dPar1, double dPar2, const INTVECTOR& vVmill, bool bFirst) = 0 ;
virtual bool EnableToolsForVmill( bool bEnable) = 0 ;
virtual int MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) = 0 ;
virtual bool SaveCmd( int nType, int nPar, const std::string& sPar) = 0 ;
virtual bool SaveCmd( int nType, int nPar, const std::string& sPar, const std::string& sPar2) = 0 ;
} ;
+361 -236
View File
File diff suppressed because it is too large Load Diff
+64 -58
View File
@@ -46,13 +46,13 @@ class SimulatorMP : public ISimulator
double dPar1, double dPar2, const INTVECTOR& vVmill, bool bFirst) override ;
bool EnableToolsForVmill( bool bEnable) override ;
int MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) override ;
bool SaveCmd( int nType, int nPar, const std::string& sPar) override ;
bool SaveCmd( int nType, int nPar, const std::string& sPar, const std::string& sPar2) override ;
public :
SimulatorMP( void) ;
private :
bool UpdateMachiningTool( bool bFirst, bool& bDeselect, int& nErr) ;
bool UpdateMachiningTool( bool bFirst, int& nChangeTool, int& nErr) ;
bool UpdateDispositionTool( bool bFirst, int& nErr) ;
bool UpdateAxes( void) ;
bool UpdateAxesPos( void) ;
@@ -62,7 +62,7 @@ class SimulatorMP : public ISimulator
private :
bool VerifySetup( void) ;
bool FindAndManageOperationStart( bool bStart, bool bFirst, bool& bChangedTool, int& nStatus) ;
bool FindAndManageOperationStart( bool bStart, bool bFirst, int& nChangeTool, int& nStatus) ;
bool ManageOperationEnd( int& nStatus) ;
bool FindAndManagePathStart( int& nStatus) ;
bool ManagePathEnd( int& nStatus) ;
@@ -81,6 +81,7 @@ class SimulatorMP : public ISimulator
{ 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) ;
@@ -90,7 +91,8 @@ class SimulatorMP : public ISimulator
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 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) ;
@@ -99,11 +101,12 @@ class SimulatorMP : public ISimulator
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) ;
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) ;
@@ -146,64 +149,67 @@ class SimulatorMP : public ISimulator
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)
: nType( nT), nPar( nP), sPar( sP) {}
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
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
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)
bool m_bChangedTool ; // flag di utensile appena scaricato
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
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
} ;
+70 -8
View File
@@ -35,8 +35,11 @@
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EMkToolConst.h"
#include "/EgtDev/Include/EMkOperationConst.h"
#include "/EgtDev/Include/EGnGetKeyData.h"
#include "/EgtDev/Include/EgtPerfCounter.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EgtKeyCodes.h"
#include "/EgtDev/Include/SELkKeyProc.h"
using namespace std ;
@@ -126,6 +129,8 @@ SimulatorSP::Init( MachMgr* pMchMgr)
m_pMachine = m_pMchMgr->GetCurrMachine() ;
m_pPerfCnt = new PerformanceCounter ;
m_nStatus = SIS_INITIALIZED ;
if ( ExeGetDebugLevel() >= 1)
LOG_INFO( GetEMkLogger(), " * SimulatorSP *")
return true ;
}
@@ -140,6 +145,51 @@ SimulatorSP::Start( bool bFirst)
m_pMchMgr->ResetLastError() ;
m_pMchMgr->ResetWarnings() ;
// Se appena entrati, verifico abilitazioni
if ( m_nStatus == SIS_INITIALIZED) {
// 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 ;
if ( ! bMinTime || ! bCurrTime || ! bKey) {
m_pMchMgr->SetLastError( 1000, "NC_OFF") ;
std::string sErr = "Warning on Key (MKC/KYO)" ;
LOG_ERROR( GetEMkLogger(), sErr.c_str()) ;
return false ;
}
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) ;
}
}
}
bool bOk = true ;
// Se appena entrati in simulazione
@@ -236,7 +286,7 @@ SimulatorSP::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 ;
}
@@ -533,8 +583,9 @@ SimulatorSP::UpdateTool( bool bFirst, int& nErr)
return false ;
// se cambiato oppure prima volta, lancio lo script di selezione
if ( bDiffTool || bFirst) {
bool bFloating = m_pMachine->IsCurrToolFloating() ;
int nCurrErr ;
if ( ! OnToolSelect( m_sTool, sHead, nExit, sTcPos, bFirst, nCurrErr)) {
if ( ! OnToolSelect( m_sTool, sHead, nExit, sTcPos, bFirst, bFloating, nCurrErr)) {
nErr = ( nErr != 0 ? nErr : nCurrErr) ;
if ( nCurrErr != ERR_COLLISION)
return false ;
@@ -573,7 +624,7 @@ SimulatorSP::UpdateTool( bool bFirst, int& nErr)
return false ;
// eventuale lancio script
int nCurrErr ;
if ( ! OnToolSelect( m_sTool, sHead, nExit, sTcPos, bFirst, nCurrErr)) {
if ( ! OnToolSelect( m_sTool, sHead, nExit, sTcPos, bFirst, false, nCurrErr)) {
nErr = ( nErr != 0 ? nErr : nCurrErr) ;
if ( nCurrErr != ERR_COLLISION)
return false ;
@@ -859,6 +910,9 @@ SimulatorSP::FindAndManagePathStart( int& nStatus)
// recupero massima elevazione
double dElev = 0 ;
m_pGeomDB->GetInfo( m_nCLPathId, KEY_ELEV, dElev) ;
// recupero eventuale attivazione uscite (gruppi a forare)
INTVECTOR vActiveExit ;
m_pGeomDB->GetInfo( m_nCLPathId, KEY_DRACEX, vActiveExit) ;
// recupero il numero di eventi ausiliari di inizio
if ( ! m_pGeomDB->GetInfo( m_nCLPathId, KEY_AS_TOT, m_nAuxSTot))
m_nAuxSTot = 0 ;
@@ -867,7 +921,8 @@ SimulatorSP::FindAndManagePathStart( int& nStatus)
m_nAuxEInd = 0 ;
m_nAuxETot = 0 ;
// richiamo gestione evento inizio percorso di lavoro
if ( ! OnPathStart( m_nCLPathId, m_nCLPathInd, m_nAuxSTot, ptStart, ptEnd, vtExtr, ptMin, ptMax, vAxMin, vAxMax, dElev)) {
if ( ! OnPathStart( m_nCLPathId, m_nCLPathInd, m_nAuxSTot, ptStart, ptEnd, vtExtr,
ptMin, ptMax, vAxMin, vAxMax, dElev, vActiveExit)) {
nStatus = CalcStatusOnError( 0) ;
return false ;
}
@@ -1694,7 +1749,7 @@ SimulatorSP::OnDispositionEnd( void)
//----------------------------------------------------------------------------
bool
SimulatorSP::OnToolSelect( const string& sTool, const string& sHead, int nExit, const string& sTcPos,
bool bFirst, int& nErr)
bool bFirst, bool bFloating, int& nErr)
{
// reset stato di errore da script
nErr = 0 ;
@@ -1704,7 +1759,8 @@ SimulatorSP::OnToolSelect( const string& sTool, const string& sHead, int nExit,
if ( ! m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TOOL, sTool) ||
! m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_HEAD, sHead) ||
! m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EXIT, nExit) ||
! m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCPOS, sTcPos))
! m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCPOS, sTcPos) ||
! m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TFLOAT, bFloating))
return false ;
// assegno il token e il nome degli assi
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
@@ -1854,7 +1910,7 @@ SimulatorSP::OnMachiningEnd( void)
bool
SimulatorSP::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) ;
@@ -1873,6 +1929,8 @@ SimulatorSP::OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d&
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) ;
// verifico esistenza funzione
if ( ! m_pMachine->LuaExistsFunction( ON_SIMUL_PATH_START))
return bOk ;
@@ -2206,7 +2264,7 @@ SimulatorSP::AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, c
//----------------------------------------------------------------------------
bool
SimulatorSP::SetToolForVmill( const string& sTool, const string& sHead, int nExit, int nFlag, double dPar1, double dPar2,
const INTVECTOR& vVmill, bool bFirst)
const INTVECTOR& vVmill, bool bFirst)
{
// disabilito eventuale registrazione comandi EXE (riabilitazione automatica)
CmdLogOff cmdLogOff ;
@@ -2238,7 +2296,11 @@ SimulatorSP::SetToolForVmill( const string& sTool, const string& sHead, int nExi
double dSideAng ; m_pMchMgr->TdbGetCurrToolParam( TPA_SIDEANG, dSideAng) ;
double dMaxMat ; m_pMchMgr->TdbGetCurrToolParam( TPA_MAXMAT, dMaxMat) ;
string sNotes ; m_pMchMgr->TdbGetCurrToolParam( TPA_USERNOTES, sNotes) ;
// verifico se additivo
bool bAdditive = ( nFlag == 1) ;
// se flottante, il primo parametro è l'offset di lunghezza
if ( nFlag == 2)
dLen += dPar1 ;
// ricerca dell'outline e del diametro gambo
int nExitId = m_pMachine->GetExitId( sHead, nExit) ;
int nToolId = m_pGeomDB->GetFirstNameInGroup( nExitId, sTool) ;
+4 -3
View File
@@ -46,7 +46,7 @@ class SimulatorSP : public ISimulator
double dPar1, double dPar2, const INTVECTOR& vVmill, bool bFirst) override ;
bool EnableToolsForVmill( bool bEnable) override ;
int MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) override ;
bool SaveCmd( int nType, int nPar, const std::string& sPar) override
bool SaveCmd( int nType, int nPar, const std::string& sPar, const std::string& sPar2) override
{ return false ; }
public :
@@ -90,7 +90,8 @@ class SimulatorSP : public ISimulator
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 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) ;
@@ -99,7 +100,7 @@ class SimulatorSP : public ISimulator
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) ;
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) ;
+3087 -120
View File
File diff suppressed because it is too large Load Diff
+68 -1
View File
@@ -13,15 +13,39 @@
#pragma once
#include "set"
#include "Machining.h"
#include "SurfFinishingData.h"
#include "ToolData.h"
#include "MachiningConst.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
class ICAvToolSurfTm ;
class ISurfFlatRegion ;
class ISurfTriMesh ;
class ICAvParSilhouettesSurfTm ;
class StmFromTriangleSoup ;
// struttura percorsi da calcolare per finiture ottimizzate
struct PATH {
PtrOwner<ICurveComposite> pCrvPath ;
int nType ;
double dSideAng ;
} ;
// vettore associato
typedef std::vector<PATH> VECTORPATHS ;
// struttura per collisioni per finiture ottimizzate
struct CollisionSfr {
PNTUVVECT CollisionInfo ;
bool bInSpiral ;
bool bInZConst ;
} ;
// vettore associato
typedef std::vector<CollisionSfr> VECTORCOLLISIONSFR ;
//----------------------------------------------------------------------------
class SurfFinishing : public Machining
@@ -70,16 +94,53 @@ class SurfFinishing : public Machining
SurfFinishing( void) ;
private :
bool MyApply( bool bRecalc, bool bPostApply) ;
bool VerifyGeometry( SelData Id, int& nSubs) ;
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
bool Chain( int nGrpDestId) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool ProcessSfr( int nPathId, int nPvId, int nClId) ;
bool ProcessCrvCompo( int nPathId, int nPvId, int nClId) ;
bool SimplifyCurve( ICurveComposite* pCompo) const ;
bool CalcZConstProjectedLink( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frPocket,
const Frame3d& frSurf, const Vector3d& vtTool, double dDepth,
const Point3d ptStart_forced, const Point3d ptEnd_forced,
ICurveComposite* pCrv) ;
// lavorazioni per superfici
bool AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrPock,
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
bool AddOneWay( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrPock,
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
bool AddSpiral( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrPock,
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs, bool bInVsOut) ;
bool AddZConst( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ISurfFlatRegion* pSfr,
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
bool AddOptimal( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ISurfFlatRegion* pSfr,
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
// lavorazioni per curve
bool AddProjection( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ICurveComposite* pCompo,
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
bool ChooseFinishingForOptimal( const ISurfFlatRegion* pSfr, int nChunk, bool& bSpiral, double& dSideAng) ;
bool OrderOptimalPathsByZLoc( const ISurfFlatRegion* pSfr, VECTORPATHS& vCrvPaths) ;
bool GetSfrBySilhouette( ICAvParSilhouettesSurfTm* pCavParSilh, double dDepth, double dSilTolSamp,
double dSilTolLin, double dSilTolAng, ISurfFlatRegion* pSfrSil) ;
bool ApproxSilhouetteClosedPLForOptimal( PolyLine& PL, double dSampleTol, double dMaxLinTol, double dAngTol, double dLinFeaTol, ICurveComposite* pCompoPL) ;
bool SplitStmTrianglesByClippingAngle( const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ISurfFlatRegion* pSfrCnt,
const Vector3d& vtTool, double dDepth, double dClippingAngle, double dTolerAngle,
ISURFTMPOVECTOR& vpStm1, ISURFTMPOVECTOR& vpStm2, double& dMaxFrontTriaRad) const ;
bool GetZConstQuotesInsideSfrParallelToTool( const SURFLOCALVECTOR&, const Frame3d& frSurf, const ISurfFlatRegion* pSfr,
const Vector3d& vtTool, std::set<double>& setZAmbiguos) ;
ICAvParSilhouettesSurfTm* GetParSilhouettesForZConst( const ISURFTMPOVECTOR& vStm, const ISurfFlatRegion* pSfr) const ;
ISurfFlatRegion* GetSfrSilhouette( const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frLvl0, double dDepth) const ;
ISurfFlatRegion* GetSfrProjectedStmLoops( const ISURFTMPOVECTOR& vStm, const ISurfFlatRegion* pSfrContour,
const DBLVECTOR& vdLinFeaTol, const DBLVECTOR& vdAngTol, const DBLVECTOR& vdMaxLinTol) const ;
ISurfTriMesh* SplitStmTriaUnderClippingAngle( const SurfLocal SrfLoc, const Vector3d& vtTest, double dClippingAngle,
double dFrontTriaTolerAng, double& dMaxFrontTriaRad) const ;
bool GetOptimalSfr( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ISurfFlatRegion* pSfrLoc, const Vector3d& vtTool,
double dDepth, double dElev, ISurfFlatRegion* pSfrSpiral, ISurfFlatRegion* pSfrZConst) const ;
bool CalcZConstSilCrv( ICAvParSilhouettesSurfTm* pCavParSilh, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf,
const ISurfFlatRegion* pSfrClass, const Vector3d& vtTool, double dDepth, std::vector<ICRVCOMPOPOVECTOR>& vCrvCompo) ;
bool CreateZConstPaths( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, std::vector<ICRVCOMPOPOVECTOR>& vCrvCompo, const Vector3d& vtTool,
const ISurfFlatRegion* pSfr, double dDepth, ICRVCOMPOPOVECTOR& vCrvPath) ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
bool AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
bool AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
@@ -93,6 +154,11 @@ class SurfFinishing : public Machining
bool GetSurfaceNormalAtPoint( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
const Point3d& ptTool, const Vector3d& vtTool, Vector3d& vtNorm) const ;
bool GetActiveSurfaces( INTVECTOR& vSurfId) const ;
bool MarchingSquares( const VECTORCOLLISIONSFR& vPntM, bool bSpiral, int nStepX, int nStepY, double dClippingAngle,
const Vector3d& vtAxL, const Vector3d& vtMoveL, ICAvToolSurfTm* pCAvTlStm,
ICRVCOMPOPOVECTOR& vCrvCompo) const ;
bool CalcShapedPoint( const PNTUVVECT& myInfoStart, const PNTUVVECT& myInfoEnd, bool bSpiral, const Vector3d& vtAxL,
const Vector3d& vtMoveL, double dClippingAngle, ICAvToolSurfTm* pCAvTlStm, Point3d& ptShaped, int _debug_ind = -1) const ;
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
double GetRadiusForStartEndElevation( void) const ;
@@ -123,4 +189,5 @@ class SurfFinishing : public Machining
double m_dTHoldDiam ; // diametro del porta-utensile
int m_nStatus ; // stato di aggiornamento della lavorazione
int m_nPaths ; // numero di percorsi di lavoro generati
bool m_bRunning ; // flag di calcoli in corso
} ;
+3 -1
View File
@@ -390,7 +390,9 @@ bool
SurfFinishingData::VerifySubType( int nVal) const
{
return ( nVal == SURFFIN_SUB_ZIGZAG || nVal == SURFFIN_SUB_ONEWAY ||
nVal == SURFFIN_SUB_SPIRALIN || nVal == SURFFIN_SUB_SPIRALOUT) ;
nVal == SURFFIN_SUB_SPIRALIN || nVal == SURFFIN_SUB_SPIRALOUT ||
nVal == SURFFIN_SUB_Z_CONST || nVal == SURFFIN_SUB_OPTIMAL ||
nVal == SURFFIN_SUB_PROJECT) ;
}
//----------------------------------------------------------------------------
+955 -555
View File
File diff suppressed because it is too large Load Diff
+39 -23
View File
@@ -24,9 +24,10 @@
#include "/EgtDev/Include/EGkIntersPlaneSurfTm.h"
class ICAvToolSurfTm ;
class ICAvParSilhouettesSurfTm ;
// struttura informazioni sui singoli percorsi
struct PathInfo {
struct PathInfoSR {
bool bOutStart ; // flag per entrata 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)
@@ -35,23 +36,25 @@ struct PathInfo {
PtrOwner<ICurveComposite> pCvrRet ; // curva di ritorno per LeadIn/Out a guida
} ;
// tipo percorso
typedef std::vector<PathInfo> PATHINFOVECTOR ;
typedef std::vector<PathInfoSR> PATHINFOSRVECTOR ;
// struttura informazioni per Step/SubSteps complessivi
struct StepInfo {
struct StepInfoSR {
double dDepth ; // profondità dello step attuale
double dRelativeDepth ; // profondità relativa allo step al di sopra
double dZlocCoeffFeed ; // coeffiziente riduzione Feed lungo Zloc
int nSubType ; // tipo di lavorazione dello Step corrente
bool bIsSubStep ; // step/SubStep
bool bIsExtraStep ; // flag per SubStep o PlaneZStep
bool bInverted ; // se percorsi invertiti
PtrOwner<ISurfFlatRegion> pSfrPock ; // regione piana di svuotatura
PtrOwner<ISurfFlatRegion> pSfrLimit ; // regione piana da non svuotare
PtrOwner<ICurveComposite> pCompo ; // curva selezionata per sgrossatura
PATHINFOVECTOR vPaths ; // percorsi di Pocketing
PATHINFOSRVECTOR vPaths ; // percorsi di Pocketing
} ;
// tipo step
typedef std::vector<StepInfo> STEPINFOVECTOR ;
typedef std::vector<StepInfoSR> STEPINFOSRVECTOR ;
// planeZ detection <SfrFace, dDepth>
typedef std::pair<PtrOwner<ISurfFlatRegion>, double> PLANEZFACE ;
typedef std::vector<PLANEZFACE> PLANEZFACEVECTOR ;
//----------------------------------------------------------------------------
class SurfRoughing : public Machining
@@ -100,38 +103,40 @@ class SurfRoughing : public Machining
SurfRoughing( void) ;
private :
bool MyApply( bool bRecalc, bool bPostApply) ;
bool VerifyGeometry( SelData Id, int& nSubs) ;
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
bool Chain( int nGrpDestId) ;
bool ProcessPath( int nPathId, int nTempId, int nPvId, int nClId) ;
bool CalcPaths( const INTINTVECTOR& vPocket, const ICRVCOMPOPOVECTOR& vCrvPocketCompo, STEPINFOVECTOR& vStepInfo) const ;
bool AddPocket( const INTINTVECTOR& vPocket, const Vector3d& vtTool, const ICRVCOMPOPOVECTOR& vCrvPocketCompo,
double dElev, double dStep, double dSubStep, bool bSplitArcs) ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool DetectPlaneZ( const CISURFTMPVECTOR& vpStm, const Frame3d& frCompo, const Vector3d& vtTool, PLANEZFACEVECTOR& vPlaneZ,
double dMinDepth, double dMaxDepth) const ;
bool CalcPaths( const INTINTVECTOR& vPocket, STEPINFOSRVECTOR& vStepInfo) const ;
bool CalcRegionElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double dLen, double& dElev) const ;
bool AddPocket( const INTINTVECTOR& vPocket, const Vector3d& vtTool, double dElev, double dStep, double dSubStep, bool bSplitArcs) ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr, bool bOutStart, bool bAbsFirst) ;
bool AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr, bool bOutMove) ;
bool AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtTool, const ICurveComposite* pCrvPath, Point3d& ptP1) const ;
bool VerifyLeadInLeadOut( const ICurve* pCrv, const ICurveComposite* pCrvPock, bool& bSkip) const ;
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 ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced, Point3d& ptP1) ;
ISurfTriMesh* GetRaw( void) const ;
ISurfTriMesh* GetStmOutSideSfr( const ISurfFlatRegion* pSfr, const ISurfTriMesh* pStmRaw, const Vector3d& vtExtr) const ;
ISurfFlatRegion* GetSfrByStmIntersection( const IntersParPlanesSurfTm& IPPStm, double dDist, double dSmallOffs = 0) const ;
ISurfFlatRegion* GetSfrSilhouette( ICAvParSilhouettesSurfTm* pCavParSilh, double dDepth, double Sil_tol, bool& bOk) const ;
bool GetActiveSurfaces( INTVECTOR& vSurfId) const ;
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
double GetRadiusForStartEndElevation( void) const ;
bool AdjustPathForLeadInLeadOut( ICurveComposite* pCrvCompo, int nSubType, const ICurveComposite* pCrvPocket, bool& bOutStart,
bool& bSingleCrv, bool& bOptTrap, bool& bIsZigZagOneWayBorder) const ;
bool AssignOpenEdgesForPocketCrvCompo( ICurveComposite* pCrvCompo, const ISurfFlatRegion* pSfr) const ;
bool ResetCurveAllTempProp( ICurve* pCurve) const ;
bool RemoveChunksUnderTolerance( ISurfFlatRegion* pSfr) const ;
bool RemoveChunksUnderTolerance( ISurfFlatRegion* pSfr, double dTol, ISurfFlatRegion* pSfrLimit,
ISurfFlatRegion* pSfrToUpdate = nullptr) const ;
bool CloseOpenEdgesUnderTolerance( ISurfFlatRegion* pSfr, double dToler) ;
bool ModifySurfRefForOpenCloseEdges( ISurfFlatRegion* pSfrRef, const ICurveComposite* pCrvCompo) const ;
bool ModifySurfForOpenCloseEdges( ISurfFlatRegion* pSfr, const Vector3d& vtTool, const ICurveComposite* pCrvCompo) const ;
bool ChooseCloseOrOpenEdge( ISurfFlatRegion* pSfr, const ISurfFlatRegion* pSfrRef) const ;
bool SimplifyCurve( ICurveComposite* pCompo) const ;
bool SimplifyCurve( ICurveComposite* pCompo, const ICRVCOMPOPOVECTOR& vCrvCheck) const ;
bool SimplyfySfr( ISurfFlatRegion* pSfr) const ;
bool CheckSafetyLinearLink( const Point3d& ptCurr, const ISurfFlatRegion* pSfrLimit, const Vector3d& vtTool,
const Point3d& ptDest, bool& bSafe) const ;
@@ -144,8 +149,10 @@ class SurfRoughing : public Machining
{ 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 GetAdaptedCoeffFeed( bool bSubStep, int nNumStep, double dStep, double dSubStep) const
{ return ( 1. + ( bSubStep ? ( nNumStep + 1) * dSubStep / dStep : 0.)) ; }
double GetAdaptedCoeffFeed( bool bExtraStep, double dDepth, double dStep) const
{ if ( ! bExtraStep || dStep < 10 * EPS_SMALL)
return 1. ;
return ( 1. + ( - dDepth / dStep) - std::floor( - dDepth / dStep)) ; } ;
double GetStartFeed() const
{ return ( IsNullLenValue( m_Params.m_dStartFeed) ? m_TParams.m_dStartFeed : m_Params.m_dStartFeed) ; }
double GetEndFeed() const
@@ -165,14 +172,20 @@ class SurfRoughing : public Machining
if ( m_Params.m_nLeadInType != SURFROU_LI_GLIDE && m_Params.m_dLiElev < 10 * EPS_SMALL)
return SURFROU_LI_NONE ;
return m_Params.m_nLeadInType ; }
bool LeadInRawIsOk( void) const
{ if ( m_TParams.m_nType != TT_MILL_NOTIP)
return true ;
return (( GetLeadInType() == SURFROU_LI_ZIGZAG || GetLeadInType() == SURFROU_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 SURFROU_LO_NONE ;
return m_Params.m_nLeadOutType ; }
/* debug functions */
void DrawLoopsSurf( const ISurfFlatRegion* pSfr, bool bWithSurf, Color Col, bool bAlphaCoverage, int nStep) ;
void DrawFeed( const ICurveComposite* pCrv, int nStep) ;
void DrawLoopsSurf( const ISurfFlatRegion* pSfr, bool bWithSurf, Color Col, bool bAlphaCoverage, std::string sName) ;
void DrawFeed( const ICurve* pCrv, double dFeed) ;
void DrawNormalShaderSurfTm( const ISurfTriMesh* pStm, std::string sName) ;
/* end debug functions */
private :
@@ -185,5 +198,8 @@ class SurfRoughing : public Machining
int m_nStatus ; // stato di aggiornamento della lavorazione
int m_nPaths ; // numero di percorsi di lavoro generati
double m_dMaxHelixRad ; // raggio massimo attacco ad elica nel caso di cerchi
double m_dStepToler ; // tolleranza di rimozione chunk per Steps
double m_dSubStepToler ; // tolleranza di rimozione chunk per SubSteps
bool m_bDetectPlaneZ ; // flag per calcolo piani in Zloc di Pocketing
bool m_bRunning ; // flag di calcoli in corso
} ;
+94 -50
View File
@@ -630,13 +630,15 @@ WaterJetting::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
// confermo i percorsi di lavorazione
m_nMills = nCurrMills ;
LOG_DBG_INFO( GetEMkLogger(), "Milling apply skipped : status already ok") ;
string sLog = string( "WaterJetting 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 ;
@@ -963,10 +965,14 @@ WaterJetting::UpdateToolData( bool* pbChanged)
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 ;
@@ -1704,8 +1710,8 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
") bigger than MaxMaterial (" + ToString( m_TParams.m_dMaxMat, 1) + ")" ;
m_pMchMgr->SetLastError( 3205, sInfo) ;
return false ;
}
}
// se richiesta anteprima
if ( nPvId != GDB_ID_NULL) {
// creo gruppo per geometria di anteprima del percorso
@@ -1771,25 +1777,62 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
pCrv->TrimStartAtLen( dAddedOverlap) ;
pCrv->Invert() ;
}
// calcolo la regione
// calcolo la regione ridotta
PtrOwner<ISurfFlatRegion> pSfr ;
double dSideCoeff = ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL ? 1. / cos( m_Params.m_dSideAngle * DEGTORAD) : 1) ;
double dRad = 0.5 * m_TParams.m_dDiam * dSideCoeff ;
pSfr.Set( GetSurfFlatRegionFromFatCurve( Release( pCrv), dRad, false, false)) ;
if ( IsNull( pSfr))
return false ;
// aggiungo eventuale attacco
if ( ! AddLeadInPreview( pCompo, pSfr))
return false ;
// aggiungo eventuale uscita
if ( ! AddLeadOutPreview( pCompo, pSfr))
return false ;
// aggiungo eventuali anelli su angoli esterni
if ( ! AddLoopsPreview( pCompo, pSfr))
return false ;
// ne recupero i contorni
for ( int i = 0 ; i < pSfr->GetLoopCount( 0) ; ++i) {
PtrOwner<ICurve> pCrv2( pSfr->GetLoop( 0, i)) ;
// creo la regione completa
PtrOwner<ISurfFlatRegion> pSfrTot( CloneSurfFlatRegion( pSfr)) ;
if ( IsNull( pSfr))
return false ;
// inserisco la regione ridotta nel DB
int nRRId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pSfr)) ;
if ( nRRId == GDB_ID_NULL)
return false ;
m_pGeomDB->SetName( nRRId, MCH_PV_RRCUT) ;
m_pGeomDB->SetMaterial( nRRId, INVISIBLE) ;
// regione per attacco
PtrOwner<ISurfFlatRegion> pSfrLI( GenerateLeadInPreview( pCompo)) ;
if ( IsNull( pSfrLI))
return false ;
if ( pSfrLI->IsValid()) {
// se regione definita la aggiungo alla regione completa
if ( ! pSfrTot->Add( *pSfrLI))
return false ;
// aggiungo nel DB
int nRLiId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pSfrLI)) ;
if ( nRLiId == GDB_ID_NULL)
return false ;
m_pGeomDB->SetName( nRLiId, MCH_PV_RLICUT) ;
m_pGeomDB->SetMaterial( nRLiId, INVISIBLE) ;
}
// regione per uscita
PtrOwner<ISurfFlatRegion> pSfrLO( GenerateLeadOutPreview( pCompo)) ;
if ( IsNull( pSfrLO))
return false ;
if ( pSfrLO->IsValid()) {
// se regione definita la aggiungo alla regione completa
if ( ! pSfrTot->Add( *pSfrLO))
return false ;
// aggiungo nel DB
int nRLoId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pSfrLO)) ;
if ( nRLoId == GDB_ID_NULL)
return false ;
m_pGeomDB->SetName( nRLoId, MCH_PV_RLOCUT) ;
m_pGeomDB->SetMaterial( nRLoId, INVISIBLE) ;
}
// recupero i contorni della regione completa
for ( int i = 0 ; i < pSfrTot->GetLoopCount( 0) ; ++i) {
PtrOwner<ICurve> pCrv2( pSfrTot->GetLoop( 0, i)) ;
if ( IsNull( pCrv2))
return false ;
// inserisco la curva nel DB
@@ -1800,18 +1843,12 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
m_pGeomDB->SetName( nC2Id, MCH_PV_CUT) ;
m_pGeomDB->SetMaterial( nC2Id, colCut) ;
}
// inserisco la regione nel DB
int nRId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pSfr)) ;
// aggiungo la regione completa nel DB
int nRId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pSfrTot)) ;
if ( nRId == GDB_ID_NULL)
return false ;
m_pGeomDB->SetName( nRId, MCH_PV_RCUT) ;
m_pGeomDB->SetMaterial( nRId, INVISIBLE) ;
// la copio anche come regione ridotta
int nRrId = m_pGeomDB->Copy( nRId, GDB_ID_NULL, nPathId) ;
if ( nRrId == GDB_ID_NULL)
return false ;
m_pGeomDB->SetName( nRrId, MCH_PV_RRCUT) ;
m_pGeomDB->SetMaterial( nRrId, INVISIBLE) ;
// eventuali ripetizioni in basso per tagli inclinati
if ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL) {
@@ -1938,13 +1975,18 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
}
//----------------------------------------------------------------------------
bool
WaterJetting::AddLeadInPreview( const ICurveComposite* pCompo, ISurfFlatRegion* pSPV)
ISurfFlatRegion*
WaterJetting::GenerateLeadInPreview( const ICurveComposite* pCompo)
{
// Creo la superficie
PtrOwner<ISurfFlatRegion> pSfr( CreateSurfFlatRegion()) ;
if ( IsNull( pSfr))
return nullptr ;
// Assegno il tipo
int nType = GetLeadInType() ;
if ( nType == WJET_LI_NONE)
return true ;
return Release( pSfr) ;
// Recupero punto e direzione iniziali del percorso
Point3d ptStart ; pCompo->GetStartPoint( ptStart) ;
Vector3d vtStart ; pCompo->GetStartDir( vtStart) ;
@@ -1953,32 +1995,31 @@ WaterJetting::AddLeadInPreview( const ICurveComposite* pCompo, ISurfFlatRegion*
// Calcolo punto iniziale dell'attacco
Point3d ptP1 ;
if ( ! CalcLeadInStart( ptStart, vtStart, vtN, pCompo, ptP1))
return false ;
return nullptr ;
// calcolo la curva di attacco
PtrOwner<ICurve> pCrv ;
switch ( nType) {
case WJET_LI_LINEAR :
{ PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
if ( IsNull( pLine) || ! pLine->Set( ptP1, ptStart))
return false ;
return nullptr ;
pCrv.Set( pLine) ;
} break ;
case WJET_LI_TANGENT :
pCrv.Set( GetArc2PVN( ptStart, ptP1, - vtStart, vtN)) ;
if ( IsNull( pCrv))
return false ;
return nullptr ;
pCrv->Invert() ;
break ;
default :
return false ;
return nullptr ;
}
// calcolo la regione
PtrOwner<ISurfFlatRegion> pSfr ;
double dSideCoeff = ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL ? 1. / cos( m_Params.m_dSideAngle * DEGTORAD) : 1) ;
double Rad = 0.49 * m_TParams.m_dDiam * dSideCoeff ; // non 0.5 per evitare problemi di coincidenza
pSfr.Set( GetSurfFlatRegionFromFatCurve( Release( pCrv), Rad, false, false)) ;
double dRad = 0.49 * m_TParams.m_dDiam * dSideCoeff ; // non 0.5 per evitare problemi di coincidenza
pSfr.Set( GetSurfFlatRegionFromFatCurve( Release( pCrv), dRad, false, false)) ;
if ( IsNull( pSfr))
return false ;
return nullptr ;
// se presente foro di attacco, ne calcolo la regione e la unisco alla precedente
if ( m_Params.m_bLiHole && m_Params.m_dLiHoleRad > 10 * EPS_SMALL) {
PtrOwner<ISurfFlatRegion> pSfr2( GetSurfFlatRegionDisk( m_Params.m_dLiHoleRad + m_TParams.m_dDiam / 2)) ;
@@ -1987,14 +2028,19 @@ WaterJetting::AddLeadInPreview( const ICurveComposite* pCompo, ISurfFlatRegion*
pSfr->Add( *pSfr2) ;
}
}
// Unisco le due regioni
return ( pSPV->Add( *pSfr)) ;
return Release( pSfr) ;
}
//----------------------------------------------------------------------------
bool
WaterJetting::AddLeadOutPreview( const ICurveComposite* pCompo, ISurfFlatRegion* pSPV)
ISurfFlatRegion*
WaterJetting::GenerateLeadOutPreview( const ICurveComposite* pCompo)
{
// Creo la regione
PtrOwner<ISurfFlatRegion> pSfr( CreateSurfFlatRegion()) ;
if ( IsNull( pSfr))
return nullptr ;
// Assegno il tipo
int nType = GetLeadOutType() ;
// Recupero i parametri
@@ -2012,7 +2058,7 @@ WaterJetting::AddLeadOutPreview( const ICurveComposite* pCompo, ISurfFlatRegion*
dPerp = m_Params.m_dLiPerp ;
}
if ( nType == WJET_LO_NONE)
return true ;
return Release( pSfr) ;
// Senso di rotazione da dir tg a dir esterna
bool bCcwRot = ( m_Params.m_nWorkSide == WJET_WS_LEFT) ;
// Recupero punto e direzione iniziali del percorso
@@ -2029,7 +2075,7 @@ WaterJetting::AddLeadOutPreview( const ICurveComposite* pCompo, ISurfFlatRegion*
vtPerp.Rotate( vtN, 0, ( bCcwRot ? 1 : - 1)) ;
Point3d ptP1 = ptEnd + vtEnd * dTang + vtPerp * dPerp ;
if ( IsNull( pLine) || ! pLine->Set( ptEnd, ptP1))
return false ;
return nullptr ;
pCrv.Set( pLine) ;
} break ;
case WJET_LO_TANGENT :
@@ -2040,18 +2086,16 @@ WaterJetting::AddLeadOutPreview( const ICurveComposite* pCompo, ISurfFlatRegion*
// inserisco uscita
pCrv.Set( GetArc2PVN( ptEnd, ptP1, vtEnd, vtN)) ;
if ( IsNull( pCrv))
return false ;
return nullptr ;
} break ;
default :
return false ;
return nullptr ;
}
// calcolo la regione
PtrOwner<ISurfFlatRegion> pSfr ;
// calcolo la regione
double dSideCoeff = ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL ? 1. / cos( m_Params.m_dSideAngle * DEGTORAD) : 1) ;
double Rad = 0.49 * m_TParams.m_dDiam * dSideCoeff ; // non 0.5 per evitare problemi di coincidenza
pSfr.Set( GetSurfFlatRegionFromFatCurve( Release( pCrv), Rad, false, false)) ;
// Unisco le due regioni
return ( ! IsNull( pSfr) && pSPV->Add( *pSfr)) ;
double dRad = 0.49 * m_TParams.m_dDiam * dSideCoeff ; // non 0.5 per evitare problemi di coincidenza
pSfr.Set( GetSurfFlatRegionFromFatCurve( Release( pCrv), dRad, false, false)) ;
return Release( pSfr) ;
}
//----------------------------------------------------------------------------
+2 -2
View File
@@ -77,8 +77,8 @@ class WaterJetting : public Machining
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool AdjustPathForInternalAngles( ICurveComposite* pCompo) ;
bool GeneratePreView( int nPathId, const ICurveComposite* pCompo, double dAddedOverlap) ;
bool AddLeadInPreview( const ICurveComposite* pCompo, ISurfFlatRegion* pSPV) ;
bool AddLeadOutPreview( const ICurveComposite* pCompo, ISurfFlatRegion* pSPV) ;
ISurfFlatRegion* GenerateLeadInPreview( const ICurveComposite* pCompo) ;
ISurfFlatRegion* GenerateLeadOutPreview( const ICurveComposite* pCompo) ;
bool AddLoopsPreview( const ICurveComposite* pCompo, ISurfFlatRegion* pSPV) ;
bool AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTool, bool bSplitArcs, double dAddedOverlap) ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, bool bSplit) ;