167 Commits

Author SHA1 Message Date
Riccardo Elitropi 3a71918a12 Merge commit '361eb4423612c3a65ef1033d76e5f095a579921e' into Sgrossature 2024-09-23 07:51:08 +02:00
Dario Sassi 361eb44236 EgtMachKernel :
- in sgrossatura superfici VerifySubType ora accetta anche SURFROU_SUB_CONFORMAL_ONEWAY
- in svuotatura VerifySubType ora accetta aanche POCKET_SUB_CONFORMAL_ZIGZAG e POCKET_SUB_CONFORMAL_ONEWAY e li rimanda sui tipi standard.
2024-09-20 14:21:52 +02:00
SaraP 037e3281a5 EgtMachKernel :
- in fresatura con lama nel calcolo ingressi e uscite utilizzata anche info OutRaw.
2024-09-19 15:49:33 +02:00
Dario Sassi 096a890c42 EgtMachKernel :
- in svuotatura con aggregato da sotto corretta la verifica della distanza limite dal bordo
- nelle simulazioni migliorata visualizzazione collisioni con fixtures
- in fresatura standard di singola curva e in centro fresa con variazioni su geometria di lavorazione (info MVar) si emette l'indice EMT.IDX riferito alla geometria originale (1-based).
2024-09-19 12:48:15 +02:00
Dario Sassi e779f874fc Merge commit '0ee84b1d1ae174054977df5c7e9a192ab8352d1b' 2024-09-19 12:34:04 +02:00
Riccardo Elitropi 0ee84b1d1a EgtMachKernel :
- piccole migliorie.
2024-09-19 09:04:55 +02:00
Riccardo Elitropi ddf18390a6 Merge commit 'b951536dfbbbb249acec08e71c4e042d37759364' into Sgrossature 2024-09-18 08:53:46 +02:00
SaraP b951536dfb EgtMachKernel :
- in svuotature a spirale corretti i casi in cui il valore dell'offset è pari al valore limite per la curva.
2024-09-17 10:43:51 +02:00
Dario Sassi 8e196fbfc6 EgtMachKernel 2.6i2 :
- per aggregato da sotto aggiunta gestione approcci/retrazione di tipo 3 (prima parallelo al grezzo poi ruota a perpendicolare stando sotto e viceversa)
- ai punti aggiunti per garantire la precisione lineare con assi rotanti in movimento tolto flag 401 e impostato flag2 a -1
- nelle forature aggiustati i fori a step con i foratori multipli rotanti.
2024-09-14 12:37:41 +02:00
Riccardo Elitropi fa6ae61eef Merge commit '431246b4724ae6ded129590a0e2a9fec19f1195d' into Sgrossature 2024-09-11 09:26:49 +02:00
Dario Sassi 431246b472 EgtMachKernel :
- in svuotature chiuse migliorata scelta lato ottimale di inizio
- altri sviluppi in SimulatorMP.
2024-09-09 09:30:14 +02:00
Dario Sassi 4b835a27be EgtMachKernel 2.6i1 :
- introduzione secondo simulatore sperimentale per macchine multiprocesso.
2024-09-05 08:29:20 +02:00
Riccardo Elitropi 3bfb6e3ffb Merge commit 'ac72518e4415e2bb79a2e90b3034018651d5ab54' into Sgrossature 2024-09-02 09:19:38 +02:00
Dario Sassi ac72518e44 EgtMachKernel :
- corretti alcuni commenti.
2024-08-30 16:34:08 +02:00
Dario Sassi b3895266a1 Merge commit 'f6afb6ac9c377b04b20ae81dc9887cc79b2c52c4' 2024-08-29 16:02:44 +02:00
Riccardo Elitropi f6afb6ac9c EgtMachKernel :
- LeadIn/LeadOut mediante SafeZ.
2024-08-29 10:41:17 +02:00
Dario Sassi b2b1206df1 Merge commit '5247e2d09706e7226c4823776bd3cdb62f4a4e26' 2024-08-23 09:19:49 +02:00
Riccardo Elitropi 5247e2d097 EgtMachKernel :
- Aggiunta gestione punti iniziali in Sgrossature e Finiture.
2024-08-22 12:56:42 +02:00
Riccardo Elitropi 3c48318ebe Merge commit '532746cf840522a9810551b9e3072c7d28522474' into Sgrossature 2024-08-22 12:55:12 +02:00
Dario Sassi 532746cf84 EgtMachKernel :
- in simulazione ora si marcano con tipo diverso le parti che vanno in collisione.
2024-08-22 09:13:11 +02:00
Riccardo Elitropi 7b0e3ddba2 Merge commit '45cf4129850edebba6862ec1e9eedc0b61d156d9' into Sgrossature 2024-08-22 08:21:38 +02:00
Dario Sassi 45cf412985 EgtMachKernel :
- ore ZSAFEDELTA di testa per sole mortasature accetta un secondo valore che viene applicato quando l'inclinazione dall'orizzontale è minore di 45deg (default primo valore).
2024-08-20 12:55:38 +02:00
Riccardo Elitropi 83366e8d33 Merge commit 'b1d0f10b55daef70fe556bc435c9f51c7287eb72' into Sgrossature 2024-08-19 08:08:22 +02:00
Dario Sassi b1d0f10b55 EgtMachKernel :
- inserite diverse modalità di movimento assi nei link tra lavorazioni, per ora impostato sempre tutti interpolati tra loro.
2024-08-07 14:28:14 +02:00
Dario Sassi 114c13d781 EgtMachKernel :
- in sgrossatura superfici correzioni nell'applicazione dell'offset longitudinale.
2024-08-07 09:42:47 +02:00
Dario Sassi a26846ed4f Merge commit 'c55962ae9b5edd05a13ad14ba3bb8f66cffabb41' 2024-08-06 18:44:51 +02:00
Riccardo Elitropi c55962ae9b EgtMachKernel :
- piccola modifica.
2024-08-06 15:05:48 +02:00
Riccardo Elitropi f9e121af32 Merge commit '450a37e4f3a0f124867165c6945ff8ad7e1db5fe' into Sgrossature 2024-08-06 15:05:14 +02:00
Dario Sassi 450a37e4f3 EgtMachKernel 2.6h1 :
- aggiunta gestione SpecialEstimate (stima speciale lanciata in automatico prima di generare).
2024-08-06 14:43:36 +02:00
Dario Sassi 5a4f77030c EgtMachKernel :
- aggiunto flag in Ini macchina [Machinings] RapidOnOut=1 per abilitare approcci e retrazioni in rapido diretti su estremi fresature 1 passata fuori dal grezzo
- migliorata precisione nella verifica collisioni per link tra lavorazioni con vere geometrie utensile con nome Tool_* (Tool_C, Tool_S,...).
2024-07-31 20:30:13 +02:00
Dario Sassi 5d945b983d Merge commit '0dee26360c567c18a2800dfb4ba077d06b69a54a' 2024-07-31 08:46:38 +02:00
Riccardo Elitropi 0dee26360c EgtMachKernel :
- aggiunto parametro SURFROU_SUB_CONFORMAL_ZIGZAG.
2024-07-30 18:35:22 +02:00
Riccardo Elitropi d0be3ec4dd EgtMachKernel :
- aggiunto controllo per POCKET_CONFORMAL_ZIGZAG.
2024-07-30 14:02:51 +02:00
Riccardo Elitropi 21e398cef7 Merge commit '46e52e09950db882602fdf54b0f4f676f900cbbf' into Sgrossature 2024-07-30 14:02:03 +02:00
Dario Sassi 46e52e0995 EgtMachKernel 2.6g8 :
- minimo step per fori abbassato a 1mm.
2024-07-30 11:45:24 +02:00
Dario Sassi 6348a40e18 EgtMachKernel 2.6g7 :
- prime modifiche per gestire link tra lavorazioni con diverse modalità (per ora rimane la standard).
2024-07-30 09:28:05 +02:00
Dario Sassi 68a92f942c EgtMachKerenel :
- ulteriore modifica per controllo punto medio in calcolo assi macchina di tipo centro di lavoro.
2024-07-29 10:15:38 +02:00
Riccardo Elitropi 8156cf92e5 Merge commit '82e464c481a4a3eb5ee8da89a073d12ae233d2c1' 2024-07-25 12:35:34 +02:00
Riccardo Elitropi 82e464c481 EgtMachKernel :
- aggiunti percorsi di Bordo per Sgrossature ZigZag e OneWay.
- migliorie varie.
2024-07-25 12:32:48 +02:00
Riccardo Elitropi 23d29eec0a Merge commit 'c8fe978a9669e2a506e74b5c316f6113c61dda85' into Sgrossature 2024-07-25 12:15:41 +02:00
SaraP c8fe978a96 EgtMachKernel 2.6g6 :
- modifica provvisoria per problema in progetto marmo.
2024-07-25 11:48:15 +02:00
Dario Sassi 6d742580fa EgtMachKernel :
- in simulazione, generazione e stima aggiunti alcuni dati del movimento successivo.
2024-07-23 16:31:36 +02:00
Dario Sassi c4ee2661b0 Merge remote-tracking branch 'origin/Sgrossature' 2024-07-23 12:38:41 +02:00
Dario Sassi c68d841b46 EgtMachKernel :
- in simulazione migliorata scelta oggetti da visualizzare per collisione.
2024-07-23 12:02:09 +02:00
Riccardo Elitropi 73f189e59d Merge commit 'db580f95d23c4efa3059c8158f401b6882449cd2' into Sgrossature 2024-07-23 11:54:07 +02:00
Riccardo Elitropi 34488601f2 EgtMachKernel :
- migliorie varie.
2024-07-23 11:53:46 +02:00
Dario Sassi db580f95d2 EgtMachKernel :
- in simulazione dopo una collisione si evidenziano i gruppi che l'hanno prodotta, al riavvio del movimento si torna alla visualizzazione standard.
2024-07-22 16:13:39 +02:00
Dario Sassi b1232ac9d3 Merge commit '4af6caf657ede99d3dc1507cad110d55936e827c' 2024-07-22 14:58:50 +02:00
Riccardo Elitropi 4af6caf657 EgtMachKernel :
- migliorie LeadIn ed Entrate
- Semplificazione codice con funzioni in classe SurfFlatRegion.
2024-07-22 11:44:45 +02:00
Dario Sassi 0ab121d217 Merge commit '4a2f6fa43980530393a28617d0b230f106150edd' 2024-07-19 12:04:59 +02:00
Riccardo Elitropi 4a2f6fa439 EgtMachKernel :
- pulizia codice dopo il merge con ramo master.
2024-07-19 12:04:00 +02:00
Riccardo Elitropi 1396303d5f Merge commit '8950f2aca1e4f7292dd46ccfd6e279a0a9a1f3ee' into Sgrossature 2024-07-19 10:18:52 +02:00
Riccardo Elitropi c3552d411f EgtMachKernel :
- aggiunti controlli per limitazione percorsi alla curva di Pocketing
- migliorati i controlli LeadIn per Helix e ZigZag.
2024-07-19 10:18:34 +02:00
Dario Sassi 8950f2aca1 EgtMachKernel 2.6g5 :
- ricompilazione con cambio versione.
2024-07-18 20:20:08 +02:00
SaraP 325482d50c EgtMachKernel 2.6g4 :
- correzioni nuova modalità WaterJet.
2024-07-18 09:53:44 +02:00
Dario Sassi 38b9433a97 EgtMachKernel :
- raggio minimo per tab su fresatura portato da 100 a 50 mm.
2024-07-17 17:20:12 +02:00
SaraP 9640415ff7 EgtMachKernel 2.6g3 :
- in WaterJet aggiunta nuova modalità per angoli interni WJET_IC_SLOW_FULL.
2024-07-17 14:22:38 +02:00
Dario Sassi b5682b4185 EgtMachKernel :
- al salvataggio utensile per sole frese verifico e aggiusto corrispondenza tra feed di testa e sottotipo ( TT_MILL_STD o TT_MILL_NOTIP).
2024-07-17 11:27:28 +02:00
Dario Sassi cd323ec583 EgtMachKernel :
- piccola modifica a sgrossatura superfici.
2024-07-16 08:39:23 +02:00
Dario Sassi 6333707386 Merge commit 'ff9a1dd55b9683a920fbb55a1af10691a101b3e7' 2024-07-15 17:04:46 +02:00
Riccardo Elitropi ff9a1dd55b EgtMachKernel :
- Correzione OffsetL per superfici di Pocketing.
2024-07-15 13:30:38 +02:00
Riccardo Elitropi 4048e2f09e Merge commit '3745da80c1f00ce0f8c63bda532177190c2a4fa2' into Sgrossature 2024-07-15 11:27:30 +02:00
Dario Sassi 3745da80c1 EgtMachKernel :
- in sgrossatura superfici corretto calcolo P1 sopra elica di attacco per area successiva alla prima.
2024-07-15 10:18:14 +02:00
Dario Sassi 068a1c9fb7 EgtMachkernel :
- in finitura superfici silhouette approssimate con archi e reset proprietà curve dei contorni risultanti
- in sgrossatura superfici silhouette approssimate con archi e migliorie stilistiche.
2024-07-15 07:10:26 +02:00
Dario Sassi abd9855823 Merge commit '05baa2f0fc33100a7b2d0e6165671436140b92dd' 2024-07-12 19:48:18 +02:00
Riccardo Elitropi 05baa2f0fc EgtMachKernel :
- aggiunta la possibilità di non calcolare i percorsi ottinimizzati in lavorazioni che richiamano CalcPocketing.
2024-07-12 17:37:52 +02:00
Riccardo Elitropi 7aa4e5ac32 Merge commit '846412f2561f2f7002d349e97bb7f0b12663abaa' into Sgrossature 2024-07-12 16:06:13 +02:00
Dario Sassi 846412f256 EgtMachKerenel :
- ora SurfFinishing non calcola più le svuotature ma usa CalcPocketing.
2024-07-12 08:47:20 +02:00
Dario Sassi bcfc71d5b9 Merge commit '6cfe0a2178d4bdb012e2a026816ea7be3f4a62e4' 2024-07-11 15:10:17 +02:00
Riccardo Elitropi 6cfe0a2178 EgtMachKernel :
- correzione errore in RemoveChunksUnderTolerance.
2024-07-11 12:48:59 +02:00
Riccardo Elitropi c0f84c1909 Merge commit '5ecfe9ec58f7d82bf98fca21773a1dba49f8cda7' into Sgrossature 2024-07-11 09:02:14 +02:00
Dario Sassi 5ecfe9ec58 EgtMachKernel :
- modifiche a finiture di superficie.
2024-07-11 09:00:48 +02:00
Dario Sassi f53bf7a7ce Merge commit 'f81bff5254339c1d64eb8873df2488784ba40ff6' 2024-07-10 13:21:38 +02:00
Riccardo Elitropi f81bff5254 EgtMachKernel :
- Aggiunta inversione dei percorsi.
2024-07-10 12:36:24 +02:00
Dario Sassi 6c3a7e7dbb Merge commit 'ee7b9c9562a8ab1ebb440e7b9152900a0498f546' 2024-07-10 12:07:02 +02:00
Riccardo Elitropi ee7b9c9562 EgtMachKernel :
- aggiornamento Feed tra steps.
2024-07-10 10:28:10 +02:00
Riccardo Elitropi b65a119731 Merge commit '7a51dae75351087736aaa5f5219f8d96801db5fd' into Sgrossature 2024-07-10 08:03:32 +02:00
Dario Sassi 7a51dae753 EgtMachKernel :
- in finitura superfici corretto calcolo esterno di inizio e fine per movimento ortogonale di attacco e uscita.
2024-07-09 20:19:01 +02:00
Riccardo Elitropi 658018bed8 EgtMachKernel :
- rimozione memory Leak.
2024-07-09 11:07:28 +02:00
Riccardo Elitropi 9d68ea5057 Merge commit 'de5782f2a520bf718fcbb076798b3b8e9513d11f' into Sgrossature 2024-07-09 08:35:50 +02:00
Dario Sassi de5782f2a5 EgtMachkernel :
- corretto errore in taglio con lama prodotto dall'aggiunta di vtFaceUse (24/06/24).
2024-07-08 18:51:52 +02:00
Dario Sassi 375a7f4636 EgtMachKernel 2.6g2 :
- in sgrossatura superfici corretti approcci ai vari step e feed di discesa in aria
- in calcolo movimenti 5assi corretto controllo punto medio (sbagliato con tavole mobili).
2024-07-08 17:04:14 +02:00
Dario Sassi 6755753509 Merge commit '608918b619896f868c1a4eb5ce0313a3d39d7125' 2024-07-08 13:20:13 +02:00
Riccardo Elitropi 608918b619 EgtMachKernel :
- migliorie su SubSteps per aggiornamento regioni di Pocket.
2024-07-08 13:02:55 +02:00
Riccardo Elitropi 1b00139b8a Merge commit '8af2794f87927e4ca715f795beb877ccea72311b' into Sgrossature 2024-07-08 10:21:17 +02:00
Dario Sassi 8af2794f87 EgtMachKernel :
- in sgrossatura superfici piccole migliorie.
2024-07-08 10:18:33 +02:00
Dario Sassi 38635cade4 EgtMachKerenl :
- in sgrossatura superfici piccola modifica su ENABLE_DEBUG.
2024-07-08 09:10:22 +02:00
Dario Sassi bc373d2e33 EgtMachKernel :
- in sgrossatura superfici piccola modifica per Zloc attacchi dei vari livelli con eliche e similari.
2024-07-08 08:58:16 +02:00
Dario Sassi bc2baf17a7 Merge remote-tracking branch 'origin/Sgrossature' 2024-07-05 15:09:42 +02:00
Riccardo Elitropi 2017d45b99 Merge commit 'ce827dc0f3fcdcaf6d1f65b251dc9758835a88f2' into Sgrossature 2024-07-05 10:52:46 +02:00
Riccardo Elitropi d02422474c EgtMachKernel :
- Aggiunta Progress Bar in Sgrossature.
2024-07-05 10:52:21 +02:00
Dario Sassi ce827dc0f3 Merge commit '7ff79c295a6ead6a95cee805fc0aa38dd700e013' 2024-07-05 09:33:35 +02:00
Riccardo Elitropi 7ff79c295a Merge commit '37d602c6d95d3d3918cadc4a69466e130b1212e4' into Sgrossature 2024-07-04 08:45:20 +02:00
Dario Sassi 37d602c6d9 EgtMachKerenl :
- in sgrossatura superfici inglobato ramo "Riccardo" e aggiunto utilizzo della riduzione di feed.
2024-07-03 17:09:13 +02:00
Riccardo Elitropi 2cea265ce3 EgtMachKernel :
- Aggiunte Feed e migliorie su lati aperti per Sgrossature.
2024-07-03 13:25:06 +02:00
Dario Sassi 7269e97a70 EgtMachKernel :
- in svuotatura il limite per fare trapezi ottimizzati è dato dallo step di lato se non è dato "MaxOptSize=" nelle note utente.
2024-07-03 12:15:10 +02:00
Dario Sassi 02a0928b06 Revert "Merge commit '6f7adce5e22f8102ce4948e1e1be09cf386bbddd'"
This reverts commit 462832fa8f, reversing
changes made to e6a74d0b45.
2024-07-03 11:22:31 +02:00
Dario Sassi 462832fa8f Merge commit '6f7adce5e22f8102ce4948e1e1be09cf386bbddd' 2024-07-03 11:09:41 +02:00
Dario Sassi e6a74d0b45 EgtMachKernel :
- modifica a drilling per impostazione geometria senza con create anzichè add.
2024-07-01 14:46:20 +02:00
Dario Sassi 9c5b90858f EgtMachKernel 2.6g1 :
- ricompilazione con cambio versione.
2024-07-01 12:46:55 +02:00
Riccardo Elitropi 6f7adce5e2 Merge commit '1badb47d71f9451753f128e12492750ceed3203a' into Sgrossature 2024-07-01 08:57:28 +02:00
Riccardo Elitropi b43700909b EgtMachKernel :
- codice di test per Feed.
2024-07-01 08:57:07 +02:00
Dario Sassi 1badb47d71 EgtMachKernel :
- in sgrossatura superfici migliorie e semplificazioni.
2024-06-29 18:47:27 +02:00
Dario Sassi c2bb3bc43b Merge remote-tracking branch 'origin/Sgrossature' 2024-06-27 14:37:12 +02:00
Dario Sassi 07f75b3994 EgtMachKernel :
- correzione in fresatura e svuotatura di approccio/retrazione rinvio da sotto per ingombro di lato.
2024-06-27 12:52:35 +02:00
Riccardo Elitropi 50ebe36cd1 EgtMachKernel :
- migliorie entrate Elica e ZigZag.
2024-06-27 12:34:37 +02:00
Dario Sassi 70a9aeed15 Merge commit '83aa3824630fec1ea808a9adc38b4b9f14e5905e' 2024-06-27 10:26:22 +02:00
Riccardo Elitropi 83aa382463 EgtMachKernel :
- migliorata funzione per scelta lati Aperti/Chiusi.
2024-06-27 09:08:34 +02:00
Dario Sassi fcca2706c3 Merge commit 'c917f6bb4e6f01543f3cb4aa9656570858aa32aa' 2024-06-25 19:14:40 +02:00
Riccardo Elitropi c917f6bb4e EgtMachKernel :
- Aggiunta gestione della superficie limite
- aggiunte funzioni per SubSteps
- correzioni varie.
2024-06-25 13:30:41 +02:00
Riccardo Elitropi 63ca83fa01 Merge commit '6ccfaa76519a02735f715df8390d7c8b6a22be5a' into Sgrossature 2024-06-25 13:19:28 +02:00
Dario Sassi 6ccfaa7651 EgtMachKernel 2.6f4 :
- in fresatura aggiunta possibilità in FaceUse di dare direzione di riferimento con un vettore di chiave VtFaceUse nelle note utente.
2024-06-24 16:20:20 +02:00
Dario Sassi e379c216b8 Merge commit 'f51cfd089f7dfd7c678fdb49dc2d77bf91537d5c' 2024-06-18 18:18:04 +02:00
Riccardo Elitropi f51cfd089f EgtMachKernel :
- Se lavorazione Spiral, gli Step extra sono lavorati sempre in SpiralIN.
2024-06-18 11:18:56 +02:00
Riccardo Elitropi 3e3a31051e Merge commit '9b47b777d4f837d696d3855d82ab1d88d0f8c8ac' into Sgrossature 2024-06-18 11:16:21 +02:00
Dario Sassi 9b47b777d4 EgtMachKernel :
- piccola miglioria in simulazione per robot.
2024-06-18 07:34:02 +02:00
Dario Sassi 95d26a9c11 Merge commit '0449d9fe8cc266fb08e08ad6b7e973a8ce0e5105' 2024-06-17 12:22:42 +02:00
Riccardo Elitropi 0449d9fe8c EgtMachKernel :
- Offset radiale applicato alla Silhouette.
2024-06-17 11:49:13 +02:00
Riccardo Elitropi a6a9ab5bba Merge commit 'fdf4326f3aeb49265c82059e835df40ece20670f' into Sgrossature 2024-06-17 09:17:20 +02:00
Dario Sassi fdf4326f3a EgtMachKernel :
- aggiustamenti per modifiche a CollisionAvoid e calcolo silhouette che lo sfrutta.
2024-06-17 07:13:05 +02:00
Dario Sassi e81290308d Merge remote-tracking branch 'origin/Sgrossature' 2024-06-16 20:22:55 +02:00
Riccardo Elitropi 469b2a0935 Merge commit 'd098e4bcbc0995b608ce6bd46533ddbdb7ffd423' into Sgrossature 2024-06-14 16:46:12 +02:00
Riccardo Elitropi 1bd74a3c3c EgtMachKernel :
- gestione SubSteps
- migliorie varie.
2024-06-14 16:45:57 +02:00
Dario Sassi d098e4bcbc EgtMachKernel :
- in foratura con teste con uscite multiple ammesse anche frese che lavorano di testa.
2024-06-13 12:21:53 +02:00
Dario Sassi fbf91fcafa EgtMachKernel :
- in foratura con teste con uscite multiple non si considerano gli utensili diversi da punta a forare.
2024-06-13 12:09:39 +02:00
Riccardo Elitropi 78b67c1527 Merge commit '3d46b4b41b6887cae66afcff1d83730f1e488cef' into Sgrossature 2024-06-13 08:20:59 +02:00
Dario Sassi 3d46b4b41b EgtMachKernel :
- in sgrossatura superfici aggiunto controllo massimo arco al centro archi (come nelle altre lavorazioni)
- in sgrossatura superfici semplificata impostazione lati aperti di regioni grazie a nuove funzioni.
2024-06-13 08:02:38 +02:00
Dario Sassi 9e5dbcf5fb EgtMachKernel 2.6f3 :
- in sgrossatura superfici ridotto step di campionamento per silhouette a 0.5.
2024-06-12 14:34:45 +02:00
Dario Sassi ab6a0db22d EgtMachKernel :
- inserimento in sgrossatura superfici di nuovo metodo per calcolo silhouettte.
2024-06-11 09:32:08 +02:00
Dario Sassi 7929a41d5f EgtMachKernel :
- in SurfRoughing corretto passaggio parametro IntersParPlanesSurfTm (deve essere per riferimento).
2024-06-07 19:02:49 +02:00
Riccardo Elitropi a26a1fa546 Merge commit 'a9d57c8021822c594764091dba1fdae0e1093739' into Sgrossature 2024-06-07 12:52:47 +02:00
Dario Sassi a9d57c8021 EgtMachKernel :
- in sgrossatura superfici corretto GetParam e SetParam per substep.
2024-06-07 12:48:26 +02:00
Dario Sassi 931083217c Merge commit '86853914b24936604cec6ad5695dd611b55e339f' 2024-06-07 11:22:32 +02:00
Riccardo Elitropi 86853914b2 EgtMachKernel :
- Correzioni LeadIn/LeadOut.
- Gestione lati aperti.
2024-06-07 10:22:06 +02:00
Riccardo Elitropi 679ce5bcbc Merge commit '310acbdb6410ec65a714b9b9ae88e91aca3baabd' into Sgrossature 2024-06-06 18:35:42 +02:00
Dario Sassi 310acbdb64 EgtMachKernel :
- miglioria a riconoscimento curve non adatte per foratura.
2024-06-06 17:44:15 +02:00
Riccardo Elitropi bfc52671cd Merge commit '731e698404f6b0b60748fab95f65d47b9418c62c' into Sgrossature 2024-06-06 14:49:36 +02:00
Riccardo Elitropi 4ac0de990e EgtMachKernel :
- Aggiunta gestione lati aperti.
2024-06-06 14:49:06 +02:00
Dario Sassi 731e698404 EgtMachKernel :
- tolti parametri inutili da sgrossatura superfici
- razionalizzato uso parametri globali da BD lavorazioni.
2024-06-06 12:25:03 +02:00
Dario Sassi a07c76377e Merge commit '60ce7627938e3489c15474fc75fe67a6ef400263' 2024-06-06 09:54:54 +02:00
Riccardo Elitropi 60ce762793 EgtMachKernel :
- LeadIn/LeadOut.
2024-06-06 09:52:08 +02:00
Dario Sassi 3959ab60a3 EgtmachKernel :
- in fresatura corretto caso di circonferenza con due step in oneway e attacco glide che generava un arco di 360deg con conseguenti errori vari.
2024-06-05 20:06:38 +02:00
Dario Sassi 516a85a950 EgtMachKernel 2.6f2 :
- nei tagli di lama a passate OneWay ora i ritorni sono in rapido (come già era nelle fresature).
2024-06-05 19:08:34 +02:00
Dario Sassi c7cd7dfea8 EgtMachKernel :
- aggiustamento parametri per sgrossatura superfici.
2024-06-05 17:17:07 +02:00
Dario Sassi c6d500174e EgtMachKernel :
- correzione a sgrossatura superfici per caso lavandino.
2024-06-05 10:50:50 +02:00
Dario Sassi 920dcb502f EgtMachKernel :
- correzione a fresatura standard per approcci/retrazioni di frese con lunghezza totale diversa da lunghezza di lavoro
- piccola modifica a sgrossatura superfici.
2024-06-04 15:55:12 +02:00
Dario Sassi b001f26339 EgtMachKernel :
- modifiche a sgrossatura superfici.
2024-06-03 09:11:08 +02:00
Dario Sassi 8c4c606ee1 EgtMachKernel 2.6f1 :
- modifiche per sgrossatura superfici.
2024-06-03 08:16:08 +02:00
Dario Sassi 9c73479441 RgtMachKernel :
- resa funzionante GetToolPreviewStepCount.
2024-05-31 07:58:27 +02:00
Dario Sassi 719bb994bd EgtMachKernel :
- aggiunta funzione GetPreviewMachiningToolStepCount
- nella funzione PreviewMachiningTool il secondo parametro non è più un flag ma il numero di passi con il verso.
2024-05-30 15:24:50 +02:00
Dario Sassi e61dd3d17b EgtMachKernel 2.6e6 :
- in Finitura Superfici aggiunto sottotipo OneWay
- in Finitura Superfici aggiunta verifica utensile con superfici in attacchi e uscite
- nelle lavorazioni di Superficie escluso utilizzo di rinvio da sotto
- corretto Dump di svuotature per stringhe chiave-valore vuote
- prime modifiche a Sgrossatura Supefici.
2024-05-29 19:02:10 +02:00
Dario Sassi 9e52787c8b EgtMachKernel :
- correzione in operazioni FiveAxisMilling e SurfRoughing per tipo restituito nella GetParam.
2024-05-27 08:43:11 +02:00
Dario Sassi 92fba6f1d4 EgtMachKernel :
- aggiunta lavorazione sgrossatura superfici (per ora solo una copia della finitura).
2024-05-24 18:59:55 +02:00
Dario Sassi a3511ba89d EgtMachKernel :
- correzioni per calcolo posizione utensile fuori pezzo in fresatura
- ora GetElevation può gestire un offset della superficie utensile tramite il parametro dSafeDist.
2024-05-24 12:47:03 +02:00
Dario Sassi a31dfa3378 EgtMachKernel 2.6e5 :
- aggiunta gestione lavorazione fresatura a 5 assi.
2024-05-23 11:48:51 +02:00
Dario Sassi 171c473e5b EgtMachKernel :
- nel calcolo degli assi macchina su percorsi ora si infittiscono opportunamente i punti quando necessario a 5 assi.
2024-05-22 08:20:56 +02:00
Dario Sassi 9c38fcd015 EgtMachKernel :
- aggiunta gestione attacchi e uscite in finitura di superfici (per ora senza Collision Avoid).
2024-05-20 10:53:24 +02:00
Dario Sassi 6986c01fba EgtMachKernel 2.6e4 :
- in lavorazioni generiche ora si imposta l'utensile per il calcolo prima di chiamare lo script
- in lavorazioni generiche si passa allo script anche la variabile EMC.ISROBOT (flag che indica se la catena cinematica è di tipo robot).
2024-05-16 12:51:11 +02:00
Dario Sassi 68a6a544c6 EgtMachKernel :
- piccola miglioria a lavorazione finitura superfici per riconoscimento parti a massimo affondamento da eliminare.
2024-05-13 07:58:54 +02:00
Dario Sassi fece411fa7 EgtMachKernel :
- piccola correzione nei collegamenti tra le passate delle Fresature OneWay.
2024-05-09 20:22:50 +02:00
Dario Sassi 103c5d0388 EgtMachKernel :
- in finitura superficie aggiunta gestione SkipMaxDown=1 per eliminare i movimenti a massimo affondamento.
2024-05-07 12:03:59 +02:00
Dario Sassi 2e1d247e27 EgtMachKernel 2.6e1 :
- ricompilazione per modifiche a gestione chiave di rete.
2024-04-30 16:55:23 +02:00
Dario Sassi 888cc604b5 EgtMachKernel :
- piccola miglioria a simulazione (aumentato limite massimo dello step).
2024-04-29 12:47:06 +02:00
Dario Sassi c191d6d831 EgtMachKernel :
- in simulazione sistemato richiamo OnEndMove dopo errore di collisione alla fine del movimento.
2024-04-29 08:43:10 +02:00
Dario Sassi e97b9df6d4 EgtMachKernel :
- in simulazione a funzione SimSetToolForVmill aggiunti parametri nFlag, dPar1 e dPar2 per additive ( modificate EmtSetToolForVmill e EmtAddToolForVmill)
- in simulazione aggiunta funzione SimEnableToolsForVmill per abilitare/disabilitare le operazioni virtual (aggiunta EmtEnableToolsForVmill).
2024-04-26 11:44:37 +02:00
Dario Sassi e6a03b0b2e EgtMachKernel :
- correzioni a collegamenti tra passate ZigZag di Fresature con Utensili NoTip
- aggiunta in interfaccia MachMgr funzione GetExitId
- in simulazione VirtualMilling aggiunta gestione utensile Chisel.
2024-04-22 15:29:23 +02:00
Dario Sassi bafb8f55ed EgtMachKernel :
- correzioni a collegamenti tra passate OneWay di Fresature con Utensili NoTip.
2024-04-22 10:53:43 +02:00
62 changed files with 14126 additions and 3915 deletions
+3 -3
View File
@@ -1010,7 +1010,7 @@ Chiseling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
// la porto in globale
pCrvCompo->ToGlob( frGlob) ;
// sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, 0) ;
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, 0) ;
// la restituisco
lstPC.emplace_back( Release( pCrvCompo)) ;
return true ;
@@ -1046,7 +1046,7 @@ Chiseling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
// la porto in globale
pCrvCompo->ToGlob( frGlob) ;
// sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, 0) ;
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, 0) ;
// la restituisco
lstPC.emplace_back( Release( pCrvCompo)) ;
}
@@ -1517,7 +1517,7 @@ Chiseling::GenerateChiselingCl( const SqHole& hole, int nPathId)
SetAuxDir( hole.vtAux) ;
// 1 -> punto approccio
SetFlag( 1) ;
double dAppr = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dAppr = GetSafeZ() ;
Point3d ptP1 = hole.ptIni + hole.vtExtr * dAppr ;
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
return false ;
+4 -4
View File
@@ -887,7 +887,7 @@ Disposition::MoveToCornerRawPart( int nRawId, const Point3d& ptP, int nFlag, boo
case MCH_CR_TR :
vtMove = ( m_ptRef1 + ptP) - Point3d( b3Raw.GetMax().x, b3Raw.GetMax().y, b3Raw.GetMin().z) ;
break ;
default : // RPCP_BL
default : // MCH_CR_BL
vtMove = ( m_ptRef1 + ptP) - b3Raw.GetMin() ;
break ;
case MCH_CR_BR :
@@ -938,7 +938,7 @@ Disposition::MoveToCenterRawPart( int nRawId, const Point3d& ptP, int nFlag, boo
case MCH_CE_TC :
vtMove = ( m_ptRef1 + ptP) - Point3d( ptCen.x, b3Raw.GetMax().y, ptCen.z) ;
break ;
default : // RPCE_ML
default : // MCH_CE_ML
vtMove = ( m_ptRef1 + ptP) - Point3d( b3Raw.GetMin().x, ptCen.y, ptCen.z) ;
break ;
case MCH_CE_MR :
@@ -1062,7 +1062,7 @@ Disposition::RotateRawPart( int nRawId, const Vector3d& vtAx, double dAngRotDeg)
case MCH_CR_TR :
vtCorr = Vector3d( b3Raw.GetMax().x - b3OriRaw.GetMax().x, b3Raw.GetMax().y - b3OriRaw.GetMax().y, b3Raw.GetMin().z - b3OriRaw.GetMin().z) ;
break ;
default : // RPCP_BL
default : // MCH_CR_BL
vtCorr = Vector3d( b3Raw.GetMin().x - b3OriRaw.GetMin().x, b3Raw.GetMin().y - b3OriRaw.GetMin().y, b3Raw.GetMin().z - b3OriRaw.GetMin().z) ;
break ;
case MCH_CR_BR :
@@ -1077,7 +1077,7 @@ Disposition::RotateRawPart( int nRawId, const Vector3d& vtAx, double dAngRotDeg)
case MCH_CE_TC :
vtCorr = Vector3d( ptCen.x - ptOriCen.x, b3Raw.GetMax().y - b3OriRaw.GetMax().y, ptCen.z - ptOriCen.z) ;
break ;
default : // RPCE_ML
default : // MCH_CE_ML
vtCorr = Vector3d( b3Raw.GetMin().x - b3OriRaw.GetMin().x, ptCen.y - ptOriCen.y, ptCen.z - ptOriCen.z) ;
break ;
case MCH_CE_MR :
+85 -30
View File
@@ -246,6 +246,7 @@ Drilling::Drilling( void)
{
m_Params.m_sName = "*" ;
m_Params.m_sToolName = "*" ;
m_Params.m_sDepth = "TH" ;
m_TParams.m_sName = "*" ;
m_TParams.m_sHead = "*" ;
m_nStatus = MCH_ST_TO_VERIFY ;
@@ -489,17 +490,15 @@ Drilling::SetGeometry( const SELVECTOR& vIds)
m_vId.clear() ;
// se lavorazione standard
if ( m_Params.m_nSubType == DRI_SUB_STD) {
// recupero il valore di tolleranza sul diametro
//double dDiamTol = m_pMchMgr->GetCurrMachiningsMgr()->GetHoleDiamToler() ;
// verifico che gli identificativi rappresentino dei fori con il corretto diametro
// verifico che gli identificativi rappresentino dei fori (il corretto diametro è verificato dopo)
for ( int i = 0 ; i < int( vIds.size()) ; ++ i) {
// recupero i dati del foro
//Hole hole ;
//if ( ! GetHoleData( vIds[i], hole) || !VerifyDiameter(hole.dDiam, m_TParams.m_dDiam, dDiamTol)) {
// string sInfo = "Warning in Drilling : Skipped entity " + ToString( vIds[i].nId) ;
// m_pMchMgr->SetWarning( 2151, sInfo) ;
// continue ;
//}
Hole hole ;
if ( ! GetHoleData( vIds[i], hole)) {
string sInfo = "Warning in Drilling : Skipped entity " + ToString( vIds[i].nId) ;
m_pMchMgr->SetWarning( 2151, sInfo) ;
continue ;
}
// posso aggiungere alla lista
m_vId.push_back( vIds[i]) ;
}
@@ -743,8 +742,18 @@ Drilling::VerifyMultiParallelFixedDrills( void)
continue ;
string sToolName ;
if ( m_pMchMgr->GetLoadedTool( m_TParams.m_sHead, nT + 1, sToolName) && ! sToolName.empty()) {
// recupero la tipologia di utensile
int nType = TT_NONE ;
string sCurrTool ; m_pMchMgr->TdbGetCurrToolParam( TPA_NAME, sCurrTool) ;
if ( m_pMchMgr->TdbSetCurrTool( sToolName)) {
m_pMchMgr->TdbGetCurrToolParam( TPA_TYPE, nType) ;
if ( ! IsEmptyOrSpaces( sCurrTool))
m_pMchMgr->TdbSetCurrTool( sCurrTool) ;
}
// verifico punta o fresa con direzione corretta
Point3d ptExit ; Vector3d vtTool, vtAux ;
if ( m_pMchMgr->GetCurrMachine()->GetHeadExitPosDirAux(m_TParams.m_sHead, nT + 1, ptExit, vtTool, vtAux) &&
if ( ( ( nType & TF_DRILLBIT) != 0 || nType == TT_MILL_STD) &&
m_pMchMgr->GetCurrMachine()->GetHeadExitPosDirAux(m_TParams.m_sHead, nT + 1, ptExit, vtTool, vtAux) &&
AreSameVectorApprox( vtTool, vtMainTool))
return true ;
}
@@ -768,7 +777,7 @@ Drilling::StandardProcess( bool bRecalc, int nPvId, int nClId)
for ( int i = 0 ; i < ( int)tabDrills.size() ; ++i) {
// se richiesto preview
if ( nPvId != GDB_ID_NULL) {
if ( ! GenerateHolePv( i, m_vId[tabDrills[i][0].nInd_id_hole], MCH_PATH, nClId))
if ( ! GenerateHolePv( i, m_vId[tabDrills[i][0].nInd_id_hole], MCH_PATH, nPvId))
return false ;
// creo la regione di ingombro del foro
int nDriId = m_pGeomDB->GetFirstInGroup( m_pGeomDB->GetLastGroupInGroup( nPvId)) ;
@@ -1061,7 +1070,7 @@ Drilling::CalcMask( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndMT, co
return false ;
// recupero il valore di tolleranza sul diametro
double dDiamToler = m_pMchMgr->GetCurrMachiningsMgr()->GetHoleDiamToler() ;
double dDiamToler = GetHoleDiamToler() ;
int nExitCnt = ( int)vTools.size() ;
int nNullTools = 0 ;
@@ -1568,7 +1577,7 @@ Drilling::GenerateHolePv( int nInd, const SelData& nCircId, const string& sPName
m_pGeomDB->SetInfo( nPathId, KEY_IDS, ToString( nCircId)) ;
m_pGeomDB->SetMaterial( nPathId, GREEN) ;
// recupero il valore di tolleranza sul diametro
double dDiamTol = m_pMchMgr->GetCurrMachiningsMgr()->GetHoleDiamToler() ;
double dDiamTol = GetHoleDiamToler() ;
// recupero i dati del foro
Hole hole ;
if ( ! GetHoleData( nCircId, hole) || ! VerifyDiameter( hole.dDiam, m_TParams.m_dDiam, dDiamTol)) {
@@ -1612,7 +1621,7 @@ Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName
m_pGeomDB->SetInfo( nPathId, KEY_IDS, ToString( nCircId)) ;
m_pGeomDB->SetMaterial( nPathId, GREEN) ;
// recupero il valore di tolleranza sul diametro
double dDiamTol = m_pMchMgr->GetCurrMachiningsMgr()->GetHoleDiamToler() ;
double dDiamTol = GetHoleDiamToler() ;
// recupero i dati del foro
Hole hole ;
if ( ! GetHoleData( nCircId, hole) || ! VerifyDiameter( hole.dDiam, m_TParams.m_dDiam, dDiamTol)) {
@@ -1681,7 +1690,7 @@ Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName
}
}
else {
if ( DoPeckDrilling( hole, nCircId, nPathId)) {
if ( DoPeckDrilling( hole, nCircId, nPathId, dMHOff, vtA)) {
// aggiorno numero forature
++ m_nDrillings ;
}
@@ -1702,7 +1711,7 @@ Drilling::GenerateHoleRegionPv( int nFirstId, int nCount, int nPvId)
// raggio dei fori
double dRad = m_TParams.m_dDiam / 2 ;
// extra raggio
double dExtraR = m_pMchMgr->GetCurrMachiningsMgr()->GetExtraROnDrillRegion() ;
double dExtraR = GetExtraROnDrillRegion() ;
// gruppo di inserimento
int nGroupId = m_pGeomDB->GetLastGroupInGroup( nPvId) ;
@@ -2088,7 +2097,7 @@ Drilling::VerifyHoleFromBottom( const Hole& hole, SelData Id)
//----------------------------------------------------------------------------
bool
Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double dMHOff, Vector3d vtA)
Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double dMHOff, const Vector3d& vtA)
{
// aggiusto alcuni parametri del ciclo di foratura
double dStartSlowLen = abs( m_Params.m_dStartSlowLen) ;
@@ -2117,25 +2126,39 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double
SetToolDir( hole.vtDir) ;
// 1 -> punto approccio (se con aggregato da sotto è una sequenza di approccio)
SetFlag( 1) ;
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeAggrBottZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeAggrBottZ() ;
double dSafeZ = GetSafeZ() ;
double dSafeAggrBottZ = GetSafeAggrBottZ() ;
double dAppr = ( m_bAggrBottom ? dSafeAggrBottZ : dSafeZ) ;
Point3d ptP1 = hole.ptIni + hole.vtDir * ( dAppr + dElev + dTExtrLen + dMHOff) ;
if ( m_bAggrBottom) {
Point3d ptP0 = ptP1 + m_vtAggrBottom * ( m_dDistBottom + m_AggrBottom.dEncH + dSafeZ) ;
Point3d ptP00 = ptP0 + Z_AX * ( m_AggrBottom.dEncV + m_TParams.m_dLen + dAppr + dTExtrLen) ;
// se rinvio da sotto che richiede speciale rotazione
if ( m_AggrBottom.nType == 1) {
// punto ruotato
Point3d ptP00 = ptP0 + Z_AX * ( m_AggrBottom.dEncV + m_TParams.m_dLen + dAppr + dTExtrLen) ;
Vector3d vtAux = m_vtAggrBottom ;
vtAux.Rotate( Z_AX, 0, 1) ;
SetAuxDir( vtAux) ;
if ( AddRapidStart( ptP00, MCH_CL_AGB_DWN) == GDB_ID_NULL)
return false ;
// vado al punto standard
SetAuxDir( m_vtAggrBottom) ;
SetFlag( 0) ;
if ( AddRapidMove( ptP0, bSplitArcs, MCH_CL_AGB_IN) == GDB_ID_NULL)
return false ;
}
// se altrimenti con rotazione per minimizzare la sporgenza
else if ( m_AggrBottom.nType == 3) {
// punto standard ruotato
Vector3d vtAux = m_vtAggrBottom ;
vtAux.Rotate( Z_AX, 0, 1) ;
SetAuxDir( vtAux) ;
if ( AddRapidStart( ptP0, MCH_CL_AGB_IN) == GDB_ID_NULL)
return false ;
// la rotazione viene eseguita nel movimento successivo al punto sopra l'inizio lavorazione
SetAuxDir( m_vtAggrBottom) ;
SetFlag( 0) ;
}
// altrimenti rinvio normale
else {
SetAuxDir( m_vtAggrBottom) ;
@@ -2147,7 +2170,7 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double
return false ;
}
else {
if( ! vtA.IsSmall())
if ( ! vtA.IsSmall())
SetAuxDir( vtA) ;
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
return false ;
@@ -2196,13 +2219,21 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double
return false ;
// 7 -> punto fuori (se uso aggregato da sotto)
if ( m_bAggrBottom) {
// se con rotazione per minimizzare la sporgenza
if ( m_AggrBottom.nType == 3) {
// imposto rotazione su punto standard
Vector3d vtAux = m_vtAggrBottom ;
vtAux.Rotate( Z_AX, 0, 1) ;
SetAuxDir( vtAux) ;
}
SetFlag( 0) ;
// vado al punto
Point3d ptP0 = ptP1 + m_vtAggrBottom * ( m_dDistBottom + m_AggrBottom.dEncH + dSafeZ) ;
Point3d ptP00 = ptP0 + Z_AX * ( m_AggrBottom.dEncV + m_TParams.m_dLen + dAppr + dTExtrLen) ;
if ( AddRapidMove( ptP0, bSplitArcs, MCH_CL_AGB_OUT) == GDB_ID_NULL)
return false ;
// se rinvio da sotto che richiede speciale rotazione
// se rinvio da sotto che richiede speciale rotazione
if ( m_AggrBottom.nType == 1) {
Point3d ptP00 = ptP0 + Z_AX * ( m_AggrBottom.dEncV + m_TParams.m_dLen + dAppr + dTExtrLen) ;
Vector3d vtAux = m_vtAggrBottom ;
vtAux.Rotate( Z_AX, 0, 1) ;
SetAuxDir( vtAux) ;
@@ -2219,7 +2250,7 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double
//----------------------------------------------------------------------------
bool
Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId)
Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHOff, const Vector3d& vtA)
{
// aggiusto alcuni parametri del ciclo di foratura
double dStartSlowLen = abs( m_Params.m_dStartSlowLen) ;
@@ -2250,25 +2281,39 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId)
SetToolDir( hole.vtDir) ;
// 1 -> punto approccio
SetFlag( 1) ;
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeAggrBottZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeAggrBottZ() ;
double dSafeZ = GetSafeZ() ;
double dSafeAggrBottZ = GetSafeAggrBottZ() ;
double dAppr = ( m_bAggrBottom ? dSafeAggrBottZ : dSafeZ) ;
Point3d ptP1 = hole.ptIni + hole.vtDir * ( dAppr + dElev + dTExtrLen) ;
Point3d ptP1 = hole.ptIni + hole.vtDir * ( dAppr + dElev + dTExtrLen + dMHOff) ;
if ( m_bAggrBottom) {
Point3d ptP0 = ptP1 + m_vtAggrBottom * ( m_dDistBottom + m_AggrBottom.dEncH + dSafeZ) ;
Point3d ptP00 = ptP0 + Z_AX * ( m_AggrBottom.dEncV + m_TParams.m_dLen + dAppr + dTExtrLen) ;
// se rinvio da sotto che richiede speciale rotazione
if ( m_AggrBottom.nType == 1) {
// punto ruotato
Point3d ptP00 = ptP0 + Z_AX * ( m_AggrBottom.dEncV + m_TParams.m_dLen + dAppr + dTExtrLen) ;
Vector3d vtAux = m_vtAggrBottom ;
vtAux.Rotate( Z_AX, 0, 1) ;
SetAuxDir( vtAux) ;
if ( AddRapidStart( ptP00, MCH_CL_AGB_DWN) == GDB_ID_NULL)
return false ;
// vado al punto standard
SetFlag( 0) ;
SetAuxDir( m_vtAggrBottom) ;
if ( AddRapidMove( ptP0, bSplitArcs, MCH_CL_AGB_IN) == GDB_ID_NULL)
return false ;
}
// se altrimenti con rotazione per minimizzare la sporgenza
else if ( m_AggrBottom.nType == 3) {
// punto standard ruotato
Vector3d vtAux = m_vtAggrBottom ;
vtAux.Rotate( Z_AX, 0, 1) ;
SetAuxDir( vtAux) ;
if ( AddRapidStart( ptP0, MCH_CL_AGB_IN) == GDB_ID_NULL)
return false ;
// la rotazione viene eseguita nel movimento successivo al punto sopra l'inizio lavorazione
SetAuxDir( m_vtAggrBottom) ;
SetFlag( 0) ;
}
// altrimenti rinvio normale
else {
SetAuxDir( m_vtAggrBottom) ;
@@ -2280,6 +2325,8 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId)
return false ;
}
else {
if ( ! vtA.IsSmall())
SetAuxDir( vtA) ;
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
return false ;
}
@@ -2291,7 +2338,7 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId)
return false ;
}
// ciclo di affondamento a step
const double MIN_STEP = 5 ;
const double MIN_STEP = 1 ;
const double APPR_STEP = 1 ;
const double MIN_MOVE = 1 ;
double dStep = max( m_Params.m_dStep, MIN_STEP) ;
@@ -2400,13 +2447,21 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId)
// 7 -> punto fuori (se uso aggregato da sotto)
if ( m_bAggrBottom) {
// se con rotazione per minimizzare la sporgenza
if ( m_AggrBottom.nType == 3) {
// imposto rotazione su punto standard
Vector3d vtAux = m_vtAggrBottom ;
vtAux.Rotate( Z_AX, 0, 1) ;
SetAuxDir( vtAux) ;
}
// vado al punto
SetFlag( 0) ;
Point3d ptP0 = ptP1 + m_vtAggrBottom * ( m_dDistBottom + m_AggrBottom.dEncH + dSafeZ) ;
Point3d ptP00 = ptP0 + Z_AX * ( m_AggrBottom.dEncV + m_TParams.m_dLen + dAppr + dTExtrLen) ;
if ( AddRapidMove( ptP0, bSplitArcs, MCH_CL_AGB_OUT) == GDB_ID_NULL)
return false ;
// se rinvio da sotto che richiede speciale rotazione
if ( m_AggrBottom.nType == 1) {
Point3d ptP00 = ptP0 + Z_AX * ( m_AggrBottom.dEncV + m_TParams.m_dLen + dAppr + dTExtrLen) ;
Vector3d vtAux = m_vtAggrBottom ;
vtAux.Rotate( Z_AX, 0, 1) ;
SetAuxDir( vtAux) ;
+2 -2
View File
@@ -84,8 +84,8 @@ class Drilling : public Machining
bool GenerateHoleRegionPv( int nFirstId, int nCount, int nPvId) ;
bool VerifyDiameter( double dHdiam, double dTdiam, double ddiamTol) ;
bool VerifyHoleFromBottom( const Hole& hole, SelData Id) ;
bool DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double nMHOff, Vector3d vtA) ;
bool DoPeckDrilling( const Hole& hole, SelData Id, int nPathId) ;
bool 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 CalcMask( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndMT, const Vector3d& vtTool, const Vector3d& vtAux) ;
bool CheckOtherHolesWithTools( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndTM, int nIndHTM, Hole holeICP,
BIN
View File
Binary file not shown.
+33 -2
View File
@@ -237,6 +237,8 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="EMkDllMain.cpp" />
<ClCompile Include="Estimator.cpp" />
<ClCompile Include="Exit.cpp" />
<ClCompile Include="FiveAxisMilling.cpp" />
<ClCompile Include="FiveAxisMillingData.cpp" />
<ClCompile Include="Generator.cpp" />
<ClCompile Include="GenMachining.cpp" />
<ClCompile Include="GenMachiningData.cpp" />
@@ -281,7 +283,8 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="SawRoughing.cpp" />
<ClCompile Include="SawRoughingData.cpp" />
<ClCompile Include="SetupMgr.cpp" />
<ClCompile Include="Simulator.cpp" />
<ClCompile Include="SimulatorSP.cpp" />
<ClCompile Include="SimulatorMP.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
@@ -291,6 +294,8 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="Head.cpp" />
<ClCompile Include="SurfFinishing.cpp" />
<ClCompile Include="SurfFinishingData.cpp" />
<ClCompile Include="SurfRoughing.cpp" />
<ClCompile Include="SurfRoughingData.cpp" />
<ClCompile Include="Table.cpp" />
<ClCompile Include="TcPos.cpp" />
<ClCompile Include="ToolData.cpp" />
@@ -303,7 +308,15 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="..\Include\EGkArcSpecial.h" />
<ClInclude Include="..\Include\EGkBBox1d.h" />
<ClInclude Include="..\Include\EGkBBox3d.h" />
<ClInclude Include="..\Include\EGkCDeBoxPolyhedron.h" />
<ClInclude Include="..\Include\EGkBiArcs.h" />
<ClInclude Include="..\Include\EGkCalcPocketing.h" />
<ClInclude Include="..\Include\EGkCAvSilhouetteSurfTm.h" />
<ClInclude Include="..\Include\EGkCAvToolSurfTm.h" />
<ClInclude Include="..\Include\EGkCDeBoxClosedSurfTm.h" />
<ClInclude Include="..\Include\EGkCDeClosedSurfTmClosedSurfTm.h" />
<ClInclude Include="..\Include\EGkCDeConeFrustumClosedSurfTm.h" />
<ClInclude Include="..\Include\EGkCDeCylClosedSurfTm.h" />
<ClInclude Include="..\Include\EGkCDeSpheClosedSurfTm.h" />
<ClInclude Include="..\Include\EGkChainCurves.h" />
<ClInclude Include="..\Include\EGkColor.h" />
<ClInclude Include="..\Include\EGkCurve.h" />
@@ -311,8 +324,11 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="..\Include\EGkCurveAux.h" />
<ClInclude Include="..\Include\EGkCurveComposite.h" />
<ClInclude Include="..\Include\EGkCurveLine.h" />
<ClInclude Include="..\Include\EGkCurveLocal.h" />
<ClInclude Include="..\Include\EGkCurvePointDiffGeom.h" />
<ClInclude Include="..\Include\EGkDistPointCurve.h" />
<ClInclude Include="..\Include\EGkDistPointLine.h" />
<ClInclude Include="..\Include\EGkDistPointSurfTm.h" />
<ClInclude Include="..\Include\EGkExtText.h" />
<ClInclude Include="..\Include\EGkFrame3d.h" />
<ClInclude Include="..\Include\EGkGdbConst.h" />
@@ -325,10 +341,13 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="..\Include\EGkGeoObjType.h" />
<ClInclude Include="..\Include\EGkGeoPoint3d.h" />
<ClInclude Include="..\Include\EGkGeoVector3d.h" />
<ClInclude Include="..\Include\EGkHashGrids1d.h" />
<ClInclude Include="..\Include\EGkHashGrids2d.h" />
<ClInclude Include="..\Include\EGkIntersCurves.h" />
<ClInclude Include="..\Include\EGkIntersCurveSurfTm.h" />
<ClInclude Include="..\Include\EGkIntersLineSurfTm.h" />
<ClInclude Include="..\Include\EGkIntersLineTria.h" />
<ClInclude Include="..\Include\EGkIntersPlaneSurfTm.h" />
<ClInclude Include="..\Include\EGkIntervals.h" />
<ClInclude Include="..\Include\EGkLuaAux.h" />
<ClInclude Include="..\Include\EGkMaterial.h" />
@@ -339,7 +358,10 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="..\Include\EGkPoint3d.h" />
<ClInclude Include="..\Include\EGkPointGrid3d.h" />
<ClInclude Include="..\Include\EGkPolyArc.h" />
<ClInclude Include="..\Include\EGkPolygon3d.h" />
<ClInclude Include="..\Include\EGkPolygonElevation.h" />
<ClInclude Include="..\Include\EGkPolyLine.h" />
<ClInclude Include="..\Include\EGkQuaternion.h" />
<ClInclude Include="..\Include\EGkSelection.h" />
<ClInclude Include="..\Include\EGkSfrCreate.h" />
<ClInclude Include="..\Include\EGkStmFromCurves.h" />
@@ -347,6 +369,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="..\Include\EGkStringUtils3d.h" />
<ClInclude Include="..\Include\EGkSurf.h" />
<ClInclude Include="..\Include\EGkSurfFlatRegion.h" />
<ClInclude Include="..\Include\EGkSurfLocal.h" />
<ClInclude Include="..\Include\EGkSurfTriMesh.h" />
<ClInclude Include="..\Include\EGkTriangle3d.h" />
<ClInclude Include="..\Include\EGkUiUnits.h" />
@@ -356,6 +379,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="..\Include\EGkVolZmap.h" />
<ClInclude Include="..\Include\EGnEgtUUID.h" />
<ClInclude Include="..\Include\EGnFileUtils.h" />
<ClInclude Include="..\Include\EGnGetKeyData.h" />
<ClInclude Include="..\Include\EGnGetModuleVer.h" />
<ClInclude Include="..\Include\EGnLuaAux.h" />
<ClInclude Include="..\Include\EGnLuaMgr.h" />
@@ -370,6 +394,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="..\Include\EgtLibVer.h" />
<ClInclude Include="..\Include\EgtNumCollection.h" />
<ClInclude Include="..\Include\EgtNumUtils.h" />
<ClInclude Include="..\Include\EgtPerfCounter.h" />
<ClInclude Include="..\Include\EgtPointerOwner.h" />
<ClInclude Include="..\Include\EgtStringBase.h" />
<ClInclude Include="..\Include\EgtStringConverter.h" />
@@ -397,6 +422,8 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="DrillingData.h" />
<ClInclude Include="Estimator.h" />
<ClInclude Include="Exit.h" />
<ClInclude Include="FiveAxisMilling.h" />
<ClInclude Include="FiveAxisMillingData.h" />
<ClInclude Include="Generator.h" />
<ClInclude Include="GenMachining.h" />
<ClInclude Include="GenMachiningData.h" />
@@ -433,10 +460,14 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="SetTempPhase.h" />
<ClInclude Include="SetupMgr.h" />
<ClInclude Include="Simulator.h" />
<ClInclude Include="SimulatorSP.h" />
<ClInclude Include="SimulatorMP.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="Head.h" />
<ClInclude Include="SurfFinishing.h" />
<ClInclude Include="SurfFinishingData.h" />
<ClInclude Include="SurfRoughing.h" />
<ClInclude Include="SurfRoughingData.h" />
<ClInclude Include="Table.h" />
<ClInclude Include="TcPos.h" />
<ClInclude Include="ToolData.h" />
+98 -5
View File
@@ -150,7 +150,7 @@
<ClCompile Include="MachMgrDBTools.cpp">
<Filter>Source Files\MachMgr</Filter>
</ClCompile>
<ClCompile Include="Simulator.cpp">
<ClCompile Include="SimulatorSP.cpp">
<Filter>Source Files\Output</Filter>
</ClCompile>
<ClCompile Include="MachMgrPhases.cpp">
@@ -234,6 +234,21 @@
<ClCompile Include="TcPos.cpp">
<Filter>Source Files\Machine</Filter>
</ClCompile>
<ClCompile Include="FiveAxisMillingData.cpp">
<Filter>Source Files\Machinings</Filter>
</ClCompile>
<ClCompile Include="FiveAxisMilling.cpp">
<Filter>Source Files\Operations</Filter>
</ClCompile>
<ClCompile Include="SurfRoughingData.cpp">
<Filter>Source Files\Machinings</Filter>
</ClCompile>
<ClCompile Include="SurfRoughing.cpp">
<Filter>Source Files\Operations</Filter>
</ClCompile>
<ClCompile Include="SimulatorMP.cpp">
<Filter>Source Files\Output</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="DllMain.h">
@@ -329,7 +344,7 @@
<ClInclude Include="..\Include\EMkDispositionConst.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="Simulator.h">
<ClInclude Include="SimulatorSP.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Generator.h">
@@ -410,9 +425,6 @@
<ClInclude Include="..\Include\EGkBBox3d.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCDeBoxPolyhedron.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkChainCurves.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
@@ -668,6 +680,87 @@
<ClInclude Include="..\Include\EGkBBox1d.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="FiveAxisMillingData.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="FiveAxisMilling.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="SurfRoughingData.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="SurfRoughing.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkBiArcs.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCalcPocketing.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCAvSilhouetteSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCAvToolSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCDeBoxClosedSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCDeClosedSurfTmClosedSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCDeConeFrustumClosedSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCDeCylClosedSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCDeSpheClosedSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCurveLocal.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkDistPointLine.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkDistPointSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkHashGrids1d.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkIntersCurveSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkIntersPlaneSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkPolygon3d.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkPolygonElevation.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkQuaternion.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkSurfLocal.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGnGetKeyData.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtPerfCounter.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="SimulatorMP.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Simulator.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="EgtMachKernel.rc">
+984
View File
@@ -0,0 +1,984 @@
//----------------------------------------------------------------------------
// EgalTech 2024-2024
//----------------------------------------------------------------------------
// File : FiveAxisMilling.cpp Data : 22.05.24 Versione : 2.6e5
// Contenuto : Implementazione gestione lavorazione 5 assi.
//
//
//
// Modifiche : 22.05.24 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "MachMgr.h"
#include "DllMain.h"
#include "FiveAxisMilling.h"
#include "OperationConst.h"
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkArcSpecial.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkUserObjFactory.h"
#include "/EgtDev/Include/EGnStringKeyVal.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/EgtIniFile.h"
using namespace std ;
//------------------------------ Errors --------------------------------------
// 3301 = "Error in FiveAxisMilling : UpdateToolData failed"
// 3302 = "Error in FiveAxisMilling : missing Script (xxx)"
// 3303 = "Error in FiveAxisMilling : Error in xxx (nnn)"
// 3304 = "Error in FiveAxisMilling : axes values not calculable"
// 3305 = "Error in FiveAxisMilling : outstroke xx"
// 3306 = "Error in FiveAxisMilling : link movements not calculable"
// 3307 = "Error in FiveAxisMilling : link outstroke xx"
// 3308 = "Error in FiveAxisMilling : post apply not calculable"
// 3309 = "Error in FiveAxisMilling : Tool loading failed"
// 3310 = "Error in FiveAxisMilling : aggregate from bottom not allowed"
// 3351 = "Warning in FiveAxisMilling : Skipped entity (xx)"
// 3352 = "Warning in FiveAxisMilling : No machinable path"
// 3353 = "Warning in FiveAxisMilling : Tool name changed (xx)"
// 3354 = "Warning in FiveAxisMilling : Tool data changed (xx)"
//------------------------------ Constants -----------------------------------
static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo
static const string EVAR_MACHID = ".MACHID" ; // IN (int) identificativo della lavorazione
static const string EVAR_GEOM = ".GEOM" ; // IN (table) tabella delle entità da lavorare
static const string EVAR_DEPTH = ".DEPTH" ; // IN (string) affondamento (espressione numerica)
static const string EVAR_TINVERT = ".TOOLINVERT" ; // IN (bool) flag di inversione direzione utensile
static const string EVAR_INVERT = ".INVERT" ; // IN (bool) flag di inversione direzione lavorazione
static const string EVAR_STARTPOS = ".STARTPOS" ; // IN (num) quota di inizio lavorazione (sempre >= 0)
static const string EVAR_OFFSR = ".OFFSR" ; // IN (num) offset radiale
static const string EVAR_OFFSL = ".OFFSL" ; // IN (num) offset longitudinale
static const string EVAR_SYSNOTES = ".SYSNOTES" ; // IN (string) note interne
static const string EVAR_USERNOTES = ".USERNOTES" ;// IN (string) note dell'utente
static const string EVAR_TOOL = ".TOOL" ; // IN (string) nome dell'utensile
static const string EVAR_HEAD = ".HEAD" ; // IN (string) nome testa
static const string EVAR_EXIT = ".EXIT" ; // IN (int) indice uscita
static const string EVAR_TTYPE = ".TTYPE" ; // IN (int) tipo utensile
static const string EVAR_TMAXMAT = ".TMAXMAT" ; // IN (num) massimo materiale
static const string EVAR_TDIAM = ".TDIAM" ; // IN (num) diametro utensile
static const string EVAR_TTOTDIAM = ".TTOTDIAM" ; // IN (num) diametro totale utensile
static const string EVAR_TLEN = ".TLEN" ; // IN (num) lunghezza utensile
static const string EVAR_TTOTLEN = ".TTOTLEN" ; // IN (num) lunghezza totale utensile
static const string EVAR_TTHICK = ".THICK" ; // IN (num) spessore per lame o altezza taglienti
static const string EVAR_TCORNRAD = ".TCORNRAD" ; // IN (num) raggio corner
static const string EVAR_TSIDEANG = ".TSIDEANG" ; // IN (num) angolo del fianco rispetto all'asse
static const string EVAR_FEED = ".FEED" ; // IN (num) feed dell'utensile
static const string EVAR_STARTFEED = ".STARTFEED" ;// IN (num) feed di inizio dell'utensile
static const string EVAR_ENDFEED = ".ENDFEED" ; // IN (num) feed di fine dell'utensile
static const string EVAR_TIPFEED = ".TIPFEED" ; // IN (num) feed di punta dell'utensile
static const string EVAR_ISROBOT = ".ISROBOT" ; // IN (bool) flag per indicare che la cinematica è di tipo robot
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok)
static const string EVAR_MILLS = ".MILLS" ; // OUT (int) numero di percorsi di lavoro
static const string ON_PREVIEW = "OnPreview_" ;
static const string ON_APPLY = "OnApply_" ;
//----------------------------------------------------------------------------
USEROBJ_REGISTER( GetOperationClass( OPER_FIVEAXISMILLING), FiveAxisMilling) ;
//----------------------------------------------------------------------------
const string&
FiveAxisMilling::GetClassName( void) const
{
return USEROBJ_GETNAME( FiveAxisMilling) ;
}
//----------------------------------------------------------------------------
FiveAxisMilling*
FiveAxisMilling::Clone( void) const
{
// alloco oggetto
FiveAxisMilling* pGenM = new(nothrow) FiveAxisMilling ;
// eseguo copia dei dati
if ( pGenM != nullptr) {
try {
pGenM->m_vId = m_vId ;
pGenM->m_pMchMgr = m_pMchMgr ;
pGenM->m_nPhase = m_nPhase ;
pGenM->m_Params = m_Params ;
pGenM->m_TParams = m_TParams ;
pGenM->m_nStatus = m_nStatus ;
pGenM->m_nMills = m_nMills ;
}
catch( ...) {
delete pGenM ;
return nullptr ;
}
}
// ritorno l'oggetto
return pGenM ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMilling::Dump( string& sOut, bool bMM, const char* szNewLine) const
{
sOut += GetClassName() + "[mm]" + szNewLine ;
sOut += KEY_PHASE + EQUAL + ToString( m_nPhase) + szNewLine ;
sOut += KEY_IDS + EQUAL + ToString( m_vId) + szNewLine ;
for ( int i = 0 ; i < m_Params.GetSize() ; ++ i)
sOut += m_Params.ToString( i) + szNewLine ;
for ( int i = 0 ; i < m_TParams.GetSize() ; ++ i)
sOut += m_TParams.ToString( i) + szNewLine ;
sOut += KEY_NUM + EQUAL + ToString( m_nMills) + szNewLine ;
sOut += KEY_STAT + EQUAL + ToString( m_nStatus) + szNewLine ;
return true ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMilling::Save( int nBaseId, STRVECTOR& vString) const
{
try {
int nSize = 1 + m_Params.GetSize() + m_TParams.GetSize() + 3 ;
vString.insert( vString.begin(), nSize, "") ;
int k = - 1 ;
if ( ! SetVal( KEY_IDS, m_vId, vString[++k]))
return false ;
for ( int i = 0 ; i < m_Params.GetSize() ; ++ i)
vString[++k] = m_Params.ToString( i) ;
for ( int i = 0 ; i < m_TParams.GetSize() ; ++ i)
vString[++k] = m_TParams.ToString( i) ;
if ( ! SetVal( KEY_PHASE, m_nPhase, vString[++k]))
return false ;
if ( ! SetVal( KEY_NUM, m_nMills, vString[++k]))
return false ;
if ( ! SetVal( KEY_STAT, m_nStatus, vString[++k]))
return false ;
}
catch( ...) {
return false ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMilling::Load( const STRVECTOR& vString, int nBaseGdbId)
{
int nSize = int( vString.size()) ;
// lista identificativi geometrie da lavorare
int k = - 1 ;
if ( k >= nSize - 1 || ! GetVal( vString[++k], KEY_IDS, m_vId))
return false ;
for ( auto& Sel : m_vId)
Sel.nId += nBaseGdbId ;
// parametri lavorazione
for ( int i = 0 ; i < m_Params.GetSize() ; ++ i) {
int nKey ;
if ( k >= nSize - 1 || ! m_Params.FromString( vString[++k], nKey) || nKey != i) {
if ( m_Params.IsOptional( i))
-- k ;
else
return false ;
}
}
// parametri utensile
for ( int i = 0 ; i < m_TParams.GetSize() ; ++ i) {
int nKey ;
if ( k >= nSize - 1 || ! m_TParams.FromString( vString[++k], nKey) || nKey != i)
return false ;
}
// parametri di stato
while ( k < nSize - 1) {
// separo chiave da valore
string sKey, sVal ;
SplitFirst( vString[++k], "=", sKey, sVal) ;
// leggo
if ( sKey == KEY_PHASE) {
if ( ! FromString( sVal, m_nPhase))
return false ;
}
else if ( sKey == KEY_NUM) {
if ( ! FromString( sVal, m_nMills))
return false ;
}
else if ( sKey == KEY_STAT) {
if ( ! FromString( sVal, m_nStatus))
return false ;
}
}
return true ;
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
FiveAxisMilling::FiveAxisMilling( void)
{
m_Params.m_sName = "*" ;
m_Params.m_sToolName = "*" ;
m_TParams.m_sName = "*" ;
m_TParams.m_sHead = "*" ;
m_nStatus = MCH_ST_TO_VERIFY ;
m_nMills = 0 ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMilling::Prepare( const string& sGenMchName)
{
// verifico il gestore lavorazioni
if ( m_pMchMgr == nullptr)
return false ;
// recupero il gestore DB utensili della macchina corrente
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
if ( pTMgr == nullptr)
return false ;
// recupero il gestore DB lavorazioni della macchina corrente
MachiningsMgr* pMMgr = m_pMchMgr->GetCurrMachiningsMgr() ;
if ( pMMgr == nullptr)
return false ;
// ricerca della lavorazione di libreria con il nome indicato
const FiveAxisMillingData* pDdata = GetFiveAxisMillingData( pMMgr->GetMachining( sGenMchName)) ;
if ( pDdata == nullptr)
return false ;
m_Params = *pDdata ;
// ricerca dell'utensile usato dalla lavorazione
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr)
return false ;
m_TParams = *pTdata ;
m_Params.m_sToolName = m_TParams.m_sName ;
return true ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMilling::SetParam( int nType, bool bVal)
{
switch ( nType) {
case MPA_INVERT :
if ( bVal != m_Params.m_bInvert)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_bInvert = bVal ;
return true ;
case MPA_TOOLINVERT :
if ( bVal != m_Params.m_bToolInvert)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_bToolInvert = bVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMilling::SetParam( int nType, int nVal)
{
switch ( nType) {
case MPA_SCC :
if ( ! m_Params.VerifySolCh( nVal))
return false ;
if ( nVal != m_Params.m_nSolCh)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_nSolCh = nVal ;
return true ;
case MPA_SUBTYPE :
if ( nVal != m_Params.m_nSubType)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_nSubType = nVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMilling::SetParam( int nType, double dVal)
{
switch ( nType) {
case MPA_SPEED :
if ( ! m_TParams.VerifySpeed( dVal))
return false ;
if ( abs( m_TParams.m_dSpeed - dVal) < EPS_MACH_ANG_PAR)
dVal = 0 ;
if ( abs( dVal - m_Params.m_dSpeed) > EPS_MACH_ANG_PAR)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_dSpeed = dVal ;
return true ;
case MPA_FEED :
if ( abs( m_TParams.m_dFeed - dVal) < EPS_MACH_LEN_PAR)
dVal = 0 ;
if ( abs( dVal - m_Params.m_dFeed) > EPS_MACH_LEN_PAR)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_dFeed = dVal ;
return true ;
case MPA_STARTFEED :
if ( abs( m_TParams.m_dStartFeed - dVal) < EPS_MACH_LEN_PAR)
dVal = 0 ;
if ( abs( dVal - m_Params.m_dStartFeed) > EPS_MACH_LEN_PAR)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_dStartFeed = dVal ;
return true ;
case MPA_ENDFEED :
if ( abs( m_TParams.m_dEndFeed - dVal) < EPS_MACH_LEN_PAR)
dVal = 0 ;
if ( abs( dVal - m_Params.m_dEndFeed) > EPS_MACH_LEN_PAR)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_dEndFeed = dVal ;
return true ;
case MPA_TIPFEED :
if ( abs( m_TParams.m_dTipFeed - dVal) < EPS_MACH_LEN_PAR)
dVal = 0 ;
if ( abs( dVal - m_Params.m_dTipFeed) > EPS_MACH_LEN_PAR)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_dTipFeed = dVal ;
return true ;
case MPA_OFFSR :
if ( abs( m_TParams.m_dOffsR - dVal) < EPS_MACH_LEN_PAR)
dVal = UNKNOWN_PAR ;
if ( abs( dVal - m_Params.m_dOffsR) > EPS_MACH_LEN_PAR)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_dOffsR = dVal ;
return true ;
case MPA_OFFSL :
if ( abs( m_TParams.m_dOffsL - dVal) < EPS_MACH_LEN_PAR)
dVal = UNKNOWN_PAR ;
if ( abs( dVal - m_Params.m_dOffsL) > EPS_MACH_LEN_PAR)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_dOffsL = dVal ;
return true ;
case MPA_DEPTH: {
string sVal = ToString( dVal) ;
if ( sVal != m_Params.m_sDepth)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_sDepth = sVal ;
} return true ;
case MPA_STARTPOS :
if ( abs( dVal - m_Params.m_dStartPos) > EPS_MACH_LEN_PAR)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_dStartPos = dVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMilling::SetParam( int nType, const string& sVal)
{
switch ( nType) {
case MPA_TOOL : {
const ToolData* pTdata ;
if ( ! m_Params.VerifyTool( m_pMchMgr->GetCurrToolsMgr(), sVal, pTdata))
return false ;
if ( ! SameTool( m_TParams, *pTdata))
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_sToolName = sVal ;
m_Params.m_ToolUuid = pTdata->m_Uuid ;
m_TParams = *pTdata ;
} return true ;
case MPA_DEPTH_STR :
if ( sVal != m_Params.m_sDepth)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_sDepth = sVal ;
return true ;
case MPA_SYSNOTES :
if ( sVal != m_Params.m_sSysNotes)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_sSysNotes = sVal ;
return true ;
case MPA_USERNOTES :
if ( sVal != m_Params.m_sUserNotes)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_sUserNotes = sVal ;
return true ;
case MPA_INITANGS :
if ( sVal != m_Params.m_sInitAngs)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_sInitAngs = sVal ;
return true ;
case MPA_BLOCKEDAXIS :
if ( sVal != m_Params.m_sBlockedAxis)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_sBlockedAxis = sVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMilling::SetGeometry( const SELVECTOR& vIds)
{
// verifico validità gestore DB geometrico
if ( m_pGeomDB == nullptr)
return false ;
// reset della geometria corrente
m_vId.clear() ;
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve o tutte facce)
int nType = GEO_NONE ;
for ( const auto& Id : vIds) {
// test sull'entità
int nSubs ;
if ( ! VerifyGeometry( Id, nSubs, nType)) {
string sInfo = "Warning in FiveAxisMilling : Skipped entity " + ToString( Id) ;
m_pMchMgr->SetWarning( 3351, sInfo) ;
continue ;
}
// posso aggiungere alla lista
m_vId.emplace_back( Id) ;
}
// aggiorno lo stato
m_nStatus |= MCH_ST_GEO_MODIF ;
// restituisco presenza geometria da lavorare
return ( ! m_vId.empty() || vIds.empty()) ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMilling::Preview( bool bRecalc)
{
// reset numero percorsi di lavoro generati
m_nMills = 0 ;
// verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
// aggiorno dati geometrici dell'utensile
if ( ! UpdateToolData()) {
m_pMchMgr->SetLastError( 3301, "Error in FiveAxisMilling : UpdateToolData failed") ;
return false ;
}
// rendo corrente l'utensile usato nella lavorazione
if ( ! m_pMchMgr->SetCalcTool( m_TParams.m_sName, m_TParams.m_sHead, m_TParams.m_nExit)) {
m_pMchMgr->SetLastError( 3309, "Error in FiveAxisMilling : Tool loading failed") ;
return false ;
}
// recupero gruppo per geometria di Preview
int nPvId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_PV) ;
// se non c'è, lo aggiungo
if ( nPvId == GDB_ID_NULL) {
nPvId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nPvId == GDB_ID_NULL)
return false ;
m_pGeomDB->SetName( nPvId, MCH_PV) ;
}
// altrimenti lo svuoto
else
m_pGeomDB->EmptyGroup( nPvId) ;
// recupero la macchina corrente
Machine* pMch = m_pMchMgr->GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
// nome della funzione lua da Ini della macchina
string sMachIni = pMch->GetMachineDir() + "\\" + pMch->GetMachineName() + ".ini" ;
string sKey = FIVEAXISMILLING_SCRIPT_KEY + ToString( m_Params.m_nSubType) ;
string sName = GetPrivateProfileStringUtf8( FIVEAXISMILLING_SEC.c_str(), sKey.c_str(), "", sMachIni.c_str()) ;
string sPreview = ON_PREVIEW + sName ;
// verifico esistenza funzione
if ( ! pMch->LuaExistsFunction( sPreview)) {
string sErr = "Error in FiveAxisMilling : missing Script " + sPreview ;
m_pMchMgr->SetLastError( 3302, sErr) ;
return false ;
}
// imposto stato
bool bOk = true ;
int nErr = 99 ;
// imposto valori parametri
bOk = bOk && pMch->LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_MACHID, m_nOwnerId) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_GEOM, m_vId) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_DEPTH, m_Params.m_sDepth) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TINVERT, m_Params.m_bToolInvert) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_INVERT, m_Params.m_bInvert) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTPOS, m_Params.m_dStartPos) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSR, GetOffsR()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSL, GetOffsL()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_SYSNOTES, m_Params.m_sSysNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, m_Params.m_sUserNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TOOL, m_TParams.m_sName) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_HEAD, m_TParams.m_sHead) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_EXIT, m_TParams.m_nExit) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTYPE, m_TParams.m_nType) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TMAXMAT, m_TParams.m_dMaxMat) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TDIAM, m_TParams.m_dDiam) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTOTDIAM, m_TParams.m_dTDiam) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TLEN, m_TParams.m_dLen) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTOTLEN, m_TParams.m_dTLen) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTHICK, m_TParams.m_dThick) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TCORNRAD, m_TParams.m_dCornRad) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TSIDEANG, m_TParams.m_dSideAng) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_FEED, GetFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTFEED, GetStartFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ENDFEED, GetEndFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TIPFEED, GetTipFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ISROBOT, m_pMchMgr->GetCurrIsRobot()) ;
// eseguo
bOk = bOk && pMch->LuaCallFunction( sPreview, false) ;
// recupero valori parametri obbligatori
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) ;
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_MILLS, m_nMills) ;
// reset
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
// segnalo errori
if ( ! bOk || nErr != 0) {
m_nMills = 0 ;
string sErr = "Error in FiveAxisMilling : Error in " + sPreview + " (" + ToString( nErr) + ")" ;
m_pMchMgr->SetLastError( 3303, sErr) ;
return false ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMilling::Apply( bool bRecalc, bool bPostApply)
{
// reset numero percorsi di lavoro generati
int nCurrMills = m_nMills ;
m_nMills = 0 ;
// verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
// aggiorno dati geometrici dell'utensile
bool bToolChanged = true ;
if ( ! UpdateToolData( &bToolChanged)) {
m_pMchMgr->SetLastError( 3301, "Error in FiveAxisMilling : UpdateToolData failed") ;
return false ;
}
// non è prevista fresatura 5 assi con aggregato da sotto
if ( IsAggrBottom( m_TParams.m_sHead)) {
m_pMchMgr->SetLastError( 3310, "Error in FiveAxisMilling : aggregate from bottom not allowed") ;
return false ;
}
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione
m_nMills = nCurrMills ;
LOG_DBG_INFO( GetEMkLogger(), "FiveAxisMilling apply skipped : status already ok") ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply))
return false ;
LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
// esco con successo
return true ;
}
m_nStatus = MCH_ST_TO_VERIFY ;
// rendo corrente l'utensile usato nella lavorazione
if ( ! m_pMchMgr->SetCalcTool( m_TParams.m_sName, m_TParams.m_sHead, m_TParams.m_nExit)) {
m_pMchMgr->SetLastError( 3309, "Error in FiveAxisMilling : Tool loading failed") ;
return false ;
}
// recupero gruppo per geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
// se non c'è, lo aggiungo
if ( nClId == GDB_ID_NULL) {
nClId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nClId == GDB_ID_NULL)
return false ;
m_pGeomDB->SetName( nClId, MCH_CL) ;
}
// altrimenti lo svuoto
else
m_pGeomDB->EmptyGroup( nClId) ;
// recupero la macchina corrente
Machine* pMch = m_pMchMgr->GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
// nome della funzione lua da Ini della macchina
string sMachIni = pMch->GetMachineDir() + "\\" + pMch->GetMachineName() + ".ini" ;
string sKey = FIVEAXISMILLING_SCRIPT_KEY + ToString( m_Params.m_nSubType) ;
string sName = GetPrivateProfileStringUtf8( FIVEAXISMILLING_SEC.c_str(), sKey.c_str(), "", sMachIni.c_str()) ;
string sApply = ON_APPLY + sName ;
// verifico esistenza funzione
if ( ! pMch->LuaExistsFunction( sApply)) {
string sErr = "Error in FiveAxisMilling : missing Script " + sApply ;
m_pMchMgr->SetLastError( 3302, sErr) ;
return false ;
}
// imposto stato
bool bOk = true ;
int nErr = 99 ;
// imposto valori parametri
bOk = bOk && pMch->LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_MACHID, m_nOwnerId) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_GEOM, m_vId) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_DEPTH, m_Params.m_sDepth) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TINVERT, m_Params.m_bToolInvert) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_INVERT, m_Params.m_bInvert) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTPOS, m_Params.m_dStartPos) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSR, GetOffsR()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSL, GetOffsL()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_SYSNOTES, m_Params.m_sSysNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, m_Params.m_sUserNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TOOL, m_TParams.m_sName) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_HEAD, m_TParams.m_sHead) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_EXIT, m_TParams.m_nExit) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTYPE, m_TParams.m_nType) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TMAXMAT, m_TParams.m_dMaxMat) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TDIAM, m_TParams.m_dDiam) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTOTDIAM, m_TParams.m_dTDiam) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TLEN, m_TParams.m_dLen) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTOTLEN, m_TParams.m_dTLen) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTHICK, m_TParams.m_dThick) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TCORNRAD, m_TParams.m_dCornRad) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TSIDEANG, m_TParams.m_dSideAng) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_FEED, GetFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTFEED, GetStartFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ENDFEED, GetEndFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TIPFEED, GetTipFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ISROBOT, m_pMchMgr->GetCurrIsRobot()) ;
// eseguo
bOk = bOk && pMch->LuaCallFunction( sApply, false) ;
// recupero valori parametri obbligatori
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) ;
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_MILLS, m_nMills) ;
// reset
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
// segnalo errori
if ( ! bOk || nErr != 0) {
m_nMills = 0 ;
string sErr = "Error in FiveAxisMilling : Error in " + sApply + " (" + ToString( nErr) + ")" ;
m_pMchMgr->SetLastError( 3303, sErr) ;
return false ;
}
// assegno ingombri dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetBBox( nClId) ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply))
return false ;
// aggiorno stato della lavorazione
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
// dichiaro successiva da aggiornare
UpdateFollowingOperationsStatus( MCH_ST_OTH_MODIF) ;
LOG_DBG_INFO( GetEMkLogger(), "FiveAxisMilling apply done") ;
return true ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMilling::Update( bool bPostApply)
{
// verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
// se lavorazione vuota, esco
if ( m_nMills == 0) {
m_pMchMgr->SetWarning( 3352, "Warning in FiveAxisMilling : No machinable path") ;
return true ;
}
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
// calcolo gli assi macchina
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
if ( ! m_Params.m_sInitAngs.empty())
sHint = m_Params.m_sInitAngs ;
if ( ! CalculateAxesValues( sHint)) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 3304, "Error in FiveAxisMilling : axes values not calculable") ;
else
m_pMchMgr->SetLastError( 3305, "Error in FiveAxisMilling : outstroke ") ;
return false ;
}
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
bool bVpl ;
if ( ! FromString( ExtractInfo( m_Params.m_sUserNotes, "Vpl:"), bVpl))
bVpl = true ;
if ( ! AdjustStartEndMovements( bVpl)) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 3306, "Error in FiveAxisMilling : link movements not calculable") ;
else
m_pMchMgr->SetLastError( 3307, "Error in FiveAxisMilling : link outstroke ") ;
return false ;
}
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ;
// esecuzione eventuali personalizzazioni
string sErr ;
if ( bPostApply && ! PostApply( sErr)) {
if ( ! IsEmptyOrSpaces( sErr))
m_pMchMgr->SetLastError( 3308, sErr) ;
else
m_pMchMgr->SetLastError( 3308, "Error in FiveAxisMilling : post apply not calculable") ;
return false ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMilling::GetParam( int nType, bool& bVal) const
{
switch ( nType) {
case MPA_INVERT :
bVal = m_Params.m_bInvert ;
return true ;
case MPA_TOOLINVERT :
bVal = m_Params.m_bToolInvert ;
return true ;
}
bVal = false ;
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMilling::GetParam( int nType, int& nVal) const
{
switch ( nType) {
case MPA_TYPE :
nVal = MT_FIVEAXISMILLING ;
return true ;
case MPA_SCC :
nVal = m_Params.m_nSolCh ;
return true ;
case MPA_SUBTYPE :
nVal = m_Params.m_nSubType ;
return true ;
}
nVal = 0 ;
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMilling::GetParam( int nType, double& dVal) const
{
switch ( nType) {
case MPA_SPEED :
dVal = GetSpeed() ;
return true ;
case MPA_FEED :
dVal = GetFeed() ;
return true ;
case MPA_STARTFEED :
dVal = GetStartFeed() ;
return true ;
case MPA_ENDFEED :
dVal = GetEndFeed() ;
return true ;
case MPA_TIPFEED :
dVal = GetTipFeed() ;
return true ;
case MPA_OFFSR :
dVal = GetOffsR() ;
return true ;
case MPA_OFFSL :
dVal = GetOffsL() ;
return true ;
case MPA_STARTPOS :
dVal = m_Params.m_dStartPos ;
return true ;
}
dVal = 0 ;
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMilling::GetParam( int nType, string& sVal) const
{
switch ( nType) {
case MPA_NAME :
sVal = m_Params.m_sName ;
return true ;
case MPA_TOOL :
sVal = m_Params.m_sToolName ;
return true ;
case MPA_DEPTH_STR :
sVal = m_Params.m_sDepth ;
return true ;
case MPA_TUUID :
sVal = ToString( m_Params.m_ToolUuid) ;
return true ;
case MPA_UUID :
sVal = ToString( m_Params.m_Uuid) ;
return true ;
case MPA_SYSNOTES :
sVal = m_Params.m_sSysNotes ;
return true ;
case MPA_USERNOTES :
sVal = m_Params.m_sUserNotes ;
return true ;
case MPA_INITANGS :
sVal = m_Params.m_sInitAngs ;
return true ;
case MPA_BLOCKEDAXIS :
sVal = m_Params.m_sBlockedAxis ;
return true ;
}
sVal = "" ;
return false ;
}
//----------------------------------------------------------------------------
const ToolData&
FiveAxisMilling::GetToolData( void) const
{
return m_TParams ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMilling::UpdateToolData( bool* pbChanged)
{
// recupero il gestore DB utensili della macchina corrente
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
if ( pTMgr == nullptr)
return false ;
// recupero l'utensile nel DB utensili
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr)
return false ;
// salvo posizione TC, testa e uscita originali
string sOrigTcPos = m_TParams.m_sTcPos ;
string sOrigHead = m_TParams.m_sHead ;
int nOrigExit = m_TParams.m_nExit ;
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
// aggiorno comunque i parametri
m_TParams = *pTdata ;
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
string sTcPos ; string sHead ; int nExit ;
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
if ( sOrigTcPos != sTcPos ||
sOrigHead != sHead ||
nOrigExit != nExit)
bChanged = true ;
m_TParams.m_sTcPos = sTcPos ;
m_TParams.m_sHead = sHead ;
m_TParams.m_nExit = nExit ;
}
else {
if ( sOrigTcPos != pTdata->m_sTcPos ||
sOrigHead != pTdata->m_sHead ||
nOrigExit != pTdata->m_nExit)
bChanged = true ;
}
// eventuali segnalazioni
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
string sInfo = "Warning in FiveAxisMilling : tool name changed (" +
m_Params.m_sToolName + "->" + m_TParams.m_sName + ")" ;
m_pMchMgr->SetWarning( 3353, sInfo) ;
m_Params.m_sToolName = m_TParams.m_sName ;
}
if ( bChanged) {
string sInfo = "Warning in FiveAxisMilling : tool data changed (" +
m_Params.m_sToolName + ")" ;
m_pMchMgr->SetWarning( 3354, sInfo) ;
}
// se definito parametro di ritorno, lo assegno
if ( pbChanged != nullptr)
*pbChanged = bChanged ;
return true ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMilling::GetGeometry( SELVECTOR& vIds) const
{
// restituisco l'elenco delle entità
vIds = m_vId ;
return true ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMilling::VerifyGeometry( SelData Id, int& nSubs, int& nType)
{
// ammessi : tutte curve o tutte facce di trimesh
const IGeoObj* pGObj = m_pGeomDB->GetGeoObj( Id.nId) ;
if ( pGObj == nullptr)
return false ;
// se ammesse curve ed è tale
if ( nType != GEO_SURF && ( pGObj->GetType() & GEO_CURVE) != 0) {
const ICurve* pCurve = nullptr ;
// se direttamente la curva
if ( Id.nSub == SEL_SUB_ALL) {
pCurve = ::GetCurve( pGObj) ;
if ( pCurve != nullptr) {
if ( pCurve->GetType() == CRV_COMPO)
nSubs = ::GetCurveComposite( pCurve)->GetCurveCount() ;
else
nSubs = 0 ;
}
}
// altrimenti sottocurva di composita
else {
const ICurveComposite* pCompo = GetCurveComposite( pGObj) ;
if ( pCompo != nullptr)
pCurve = pCompo->GetCurve( Id.nSub) ;
nSubs = 0 ;
}
return ( pCurve != nullptr) ;
}
// se altrimenti ammesse superfici trimesh ed è tale
else if ( nType != GEO_CURVE && ( pGObj->GetType() & GEO_SURF) != 0) {
const ISurfTriMesh* pSurf = ::GetSurfTriMesh( pGObj) ;
if ( pSurf == nullptr)
return false ;
// se direttamente la superficie
if ( Id.nSub == SEL_SUB_ALL) {
nSubs = pSurf->GetFacetCount() ;
return true ;
}
// altrimenti faccia di superficie trimesh
else {
// se faccia non esistente
if ( Id.nSub > pSurf->GetFacetCount())
return false ;
// tutto bene
nSubs = 0 ;
return true ;
}
}
// altrimenti errore
else
return false ;
}
//----------------------------------------------------------------------------
double
FiveAxisMilling::GetApproxLinTol( void) const
{
double dLinTol ;
if ( GetValInNotes( m_Params.m_sUserNotes, "LinTol", dLinTol))
return dLinTol ;
else
return Operation::GetApproxLinTol() ;
}
+94
View File
@@ -0,0 +1,94 @@
//----------------------------------------------------------------------------
// EgalTech 2024-2024
//----------------------------------------------------------------------------
// File : FiveAxisMilling.h Data : 22.05.24 Versione : 2.6e5
// Contenuto : Dichiarazione della classe FiveAxisMilling.
//
//
//
// Modifiche : 22.05.24 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "Machining.h"
#include "FiveAxisMillingData.h"
#include "ToolData.h"
class ICurve ;
class ICurveComposite ;
//----------------------------------------------------------------------------
class FiveAxisMilling : public Machining
{
public : // IUserObj
FiveAxisMilling* Clone( void) const override ;
const std::string& GetClassName( void) const override ;
bool Dump( std::string& sOut, bool bMM = true, const char* szNewLine = "\n") const override ;
bool ToSave( void) const override
{ return true ; }
bool Save( int nBaseId, STRVECTOR& vString) const override ;
bool Load( const STRVECTOR& vString, int nBaseGdbId) override ;
public : // Operation
int GetType( void) const override
{ return OPER_FIVEAXISMILLING ; }
bool IsEmpty( void) const override
{ return ( m_nMills == 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 :
FiveAxisMilling( void) ;
private :
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
double GetApproxLinTol( void) const override ;
private :
double GetSpeed() const
{ return ( IsNullAngValue( m_Params.m_dSpeed) ? m_TParams.m_dSpeed : m_Params.m_dSpeed) ; }
double GetFeed() const
{ return ( IsNullLenValue( m_Params.m_dFeed) ? m_TParams.m_dFeed : m_Params.m_dFeed) ; }
double GetStartFeed() const
{ return ( IsNullLenValue( m_Params.m_dStartFeed) ? m_TParams.m_dStartFeed : m_Params.m_dStartFeed) ; }
double GetEndFeed() const
{ return ( IsNullLenValue( m_Params.m_dEndFeed) ? m_TParams.m_dEndFeed : m_Params.m_dEndFeed) ; }
double GetTipFeed() const
{ return ( IsNullLenValue( m_Params.m_dTipFeed) ? m_TParams.m_dTipFeed : m_Params.m_dTipFeed) ; }
double GetOffsL() const
{ return ( IsUnknownValue( m_Params.m_dOffsL) ? m_TParams.m_dOffsL : m_Params.m_dOffsL) ; }
double GetOffsR() const
{ return ( IsUnknownValue( m_Params.m_dOffsR) ? m_TParams.m_dOffsR : m_Params.m_dOffsR) ; }
private :
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
FiveAxisMillingData m_Params ; // parametri lavorazione
ToolData m_TParams ; // parametri utensile
int m_nStatus ; // stato di aggiornamento della lavorazione
int m_nMills ; // numero di percorsi di lavoro generati
} ;
+557
View File
@@ -0,0 +1,557 @@
//----------------------------------------------------------------------------
// EgalTech 2024-2024
//----------------------------------------------------------------------------
// File : FiveAxisMillingData.cpp Data : 22.05.24 Versione : 2.6e5
// Contenuto : Implementazione struttura dati fresatura a 5 assi.
//
//
//
// Modifiche : 22.05.24 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "FiveAxisMillingData.h"
#include "MachiningDataFactory.h"
#include "MachiningConst.h"
#include "/EgtDev/Include/EmkToolConst.h"
#include "/EgtDev/Include/EmkSimuGenConst.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include <array>
#include <cassert>
using namespace std ;
//----------------------------------------------------------------------------
enum nFiveAxisMillingKey {
KEY_AB = 0,
KEY_AI,
KEY_DH,
KEY_F,
KEY_FE,
KEY_FS,
KEY_FT,
KEY_INV,
KEY_NAME,
KEY_NNS,
KEY_NNU,
KEY_OL,
KEY_OR,
KEY_PS,
KEY_S,
KEY_SCC,
KEY_SUBTYPE,
KEY_TI,
KEY_TNAME,
KEY_TUUID,
KEY_UUID,
KEY_ZZZ} ; // rappresenta il numero di elementi
static const array<string,KEY_ZZZ> sFiveAxisMillingKey = {
"AB",
"AI",
"DH",
"F",
"FE",
"FS",
"FT",
"INV",
"NAME",
"NNS",
"NNU",
"OL",
"OR",
"PS",
"S",
"SCC",
"SUB",
"TI",
"TN",
"TU",
"UUID"} ;
//----------------------------------------------------------------------------
MCHDATA_REGISTER( MT_FIVEAXISMILLING, "FIVEAXISMILLING", FiveAxisMillingData) ;
//----------------------------------------------------------------------------
FiveAxisMillingData*
FiveAxisMillingData::Clone( void) const
{
// alloco oggetto
FiveAxisMillingData* pDdata = new(nothrow) FiveAxisMillingData ;
// copio i dati
if ( pDdata != nullptr) {
if ( ! pDdata->CopyFrom( this)) {
delete pDdata ;
return nullptr ;
}
}
return pDdata ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::CopyFrom( const MachiningData* pMdata)
{
// è inutile copiare se sorgente coincide con destinazione
if ( pMdata == this)
return true ;
// la sorgente deve essere dello stesso tipo
const FiveAxisMillingData* pFdata = GetFiveAxisMillingData( pMdata) ;
if ( pFdata == nullptr)
return false ;
// eseguo copia
m_Uuid = pFdata->m_Uuid ;
m_sName = pFdata->m_sName ;
m_ToolUuid = pFdata->m_ToolUuid ;
m_sToolName = pFdata->m_sToolName ;
m_sBlockedAxis = pFdata->m_sBlockedAxis ;
m_sInitAngs = pFdata->m_sInitAngs ;
m_nSolCh = pFdata->m_nSolCh ;
m_dSpeed = pFdata->m_dSpeed ;
m_dFeed = pFdata->m_dFeed ;
m_dEndFeed = pFdata->m_dEndFeed ;
m_dStartFeed = pFdata->m_dStartFeed ;
m_dTipFeed = pFdata->m_dTipFeed ;
m_dOffsL = pFdata->m_dOffsL ;
m_dOffsR = pFdata->m_dOffsR ;
m_bToolInvert = pFdata->m_bToolInvert ;
m_bInvert = pFdata->m_bInvert ;
m_sDepth = pFdata->m_sDepth ;
m_dStartPos = pFdata->m_dStartPos ;
m_nSubType = pFdata->m_nSubType ;
m_sSysNotes = pFdata->m_sSysNotes ;
m_sUserNotes = pFdata->m_sUserNotes ;
return true ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::SameAs(const MachiningData* pMdata) const
{
// se coincide con altro -> uguali
if ( pMdata == this)
return true ;
// se sono di tipo diverso -> diversi
const FiveAxisMillingData* pFdata = GetFiveAxisMillingData( pMdata) ;
if ( pFdata == nullptr)
return false ;
// confronto termine a termine
return ( m_Uuid == pFdata->m_Uuid &&
m_sName == pFdata->m_sName &&
m_ToolUuid == pFdata->m_ToolUuid &&
m_sToolName == pFdata->m_sToolName &&
m_sBlockedAxis == pFdata->m_sBlockedAxis &&
m_sInitAngs == pFdata->m_sInitAngs &&
m_nSolCh == pFdata->m_nSolCh &&
abs( m_dSpeed - pFdata->m_dSpeed) < EPS_MACH_ANG_PAR &&
abs( m_dFeed - pFdata->m_dFeed) < EPS_MACH_LEN_PAR &&
abs( m_dEndFeed - pFdata->m_dEndFeed) < EPS_MACH_LEN_PAR &&
abs( m_dStartFeed - pFdata->m_dStartFeed) < EPS_MACH_LEN_PAR &&
abs( m_dTipFeed - pFdata->m_dTipFeed) < EPS_MACH_LEN_PAR &&
abs( m_dOffsL - pFdata->m_dOffsL) < EPS_MACH_LEN_PAR &&
abs( m_dOffsR - pFdata->m_dOffsR) < EPS_MACH_LEN_PAR &&
m_bToolInvert == pFdata->m_bToolInvert &&
m_bInvert == pFdata->m_bInvert &&
m_sDepth == pFdata->m_sDepth &&
abs( m_dStartPos - pFdata->m_dStartPos) < EPS_MACH_LEN_PAR &&
m_nSubType == pFdata->m_nSubType &&
m_sSysNotes == pFdata->m_sSysNotes &&
m_sUserNotes == pFdata->m_sUserNotes) ;
}
//----------------------------------------------------------------------------
int
FiveAxisMillingData::GetSize( void) const
{
// in debug verifico validità ultimo campo
assert( sFiveAxisMillingKey[KEY_UUID] == "UUID") ;
return KEY_ZZZ ;
}
//----------------------------------------------------------------------------
string
FiveAxisMillingData::GetTitle( void) const
{
return MCHDATA_GETNAME( FiveAxisMillingData) ;
}
//----------------------------------------------------------------------------
int
FindFiveAxisMillingKey( const string& sKey)
{
auto TheRange = equal_range( sFiveAxisMillingKey.cbegin(), sFiveAxisMillingKey.cend(), sKey) ;
if ( TheRange.first == TheRange.second)
return - 1 ;
return int( TheRange.first - sFiveAxisMillingKey.cbegin()) ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::FromString( const string& sString, int& nKey)
{
// separo chiave da valore
string sKey, sVal ;
SplitFirst( sString, "=", sKey, sVal) ;
// riconosco la chiave
nKey = FindFiveAxisMillingKey( ToUpper( sKey)) ;
bool bOk = ( nKey >= 0) ;
switch ( nKey) {
case KEY_AB :
m_sBlockedAxis = sVal ;
break ;
case KEY_AI :
m_sInitAngs = sVal ;
break ;
case KEY_DH :
m_sDepth = sVal ;
if ( m_sDepth.empty())
m_sDepth = "0" ;
break ;
case KEY_F :
bOk = ::FromString( sVal, m_dFeed) ;
break ;
case KEY_FE :
bOk = ::FromString( sVal, m_dEndFeed) ;
break ;
case KEY_FS :
bOk = ::FromString( sVal, m_dStartFeed) ;
break ;
case KEY_FT :
bOk = ::FromString( sVal, m_dTipFeed) ;
break ;
case KEY_INV :
bOk = ::FromString( sVal, m_bInvert) ;
break ;
case KEY_NAME :
m_sName = sVal ;
bOk = ! m_sName.empty() ;
break ;
case KEY_NNS :
m_sSysNotes = sVal ;
break ;
case KEY_NNU :
m_sUserNotes = sVal ;
break ;
case KEY_OL :
bOk = ::FromString( sVal, m_dOffsL) ;
break ;
case KEY_OR :
bOk = ::FromString( sVal, m_dOffsR) ;
break ;
case KEY_PS :
bOk = ::FromString( sVal, m_dStartPos) ;
break ;
case KEY_S :
bOk = ::FromString( sVal, m_dSpeed) ;
break ;
case KEY_SCC :
bOk = ::FromString( sVal, m_nSolCh) ;
break ;
case KEY_SUBTYPE :
bOk = ::FromString( sVal, m_nSubType) ;
break ;
case KEY_TNAME :
m_sToolName = sVal ;
break ;
case KEY_TI :
bOk = ::FromString( sVal, m_bToolInvert) ;
break ;
case KEY_TUUID :
bOk = ::FromString( sVal, m_ToolUuid) ;
break ;
case KEY_UUID :
bOk = ::FromString( sVal, m_Uuid) ;
break ;
default :
bOk = false ;
break ;
}
return bOk ;
}
//----------------------------------------------------------------------------
string
FiveAxisMillingData::ToString( int nKey) const
{
switch ( nKey) {
case KEY_AB : return ( sFiveAxisMillingKey[KEY_AB] + "=" + m_sBlockedAxis) ;
case KEY_AI : return ( sFiveAxisMillingKey[KEY_AI] + "=" + m_sInitAngs) ;
case KEY_DH : return ( sFiveAxisMillingKey[KEY_DH] + "=" + m_sDepth) ;
case KEY_F : return ( sFiveAxisMillingKey[KEY_F] + "=" + ::ToString( m_dFeed)) ;
case KEY_FE : return ( sFiveAxisMillingKey[KEY_FE] + "=" + ::ToString( m_dEndFeed)) ;
case KEY_FS : return ( sFiveAxisMillingKey[KEY_FS] + "=" + ::ToString( m_dStartFeed)) ;
case KEY_FT : return ( sFiveAxisMillingKey[KEY_FT] + "=" + ::ToString( m_dTipFeed)) ;
case KEY_INV : return ( sFiveAxisMillingKey[KEY_INV] + "=" + ::ToString( m_bInvert)) ;
case KEY_NAME : return ( sFiveAxisMillingKey[KEY_NAME] + "=" + m_sName) ;
case KEY_NNS : return ( sFiveAxisMillingKey[KEY_NNS] + "=" + m_sSysNotes) ;
case KEY_NNU : return ( sFiveAxisMillingKey[KEY_NNU] + "=" + m_sUserNotes) ;
case KEY_OL : return ( sFiveAxisMillingKey[KEY_OL] + "=" + ::ToString( m_dOffsL)) ;
case KEY_OR : return ( sFiveAxisMillingKey[KEY_OR] + "=" + ::ToString( m_dOffsR)) ;
case KEY_PS : return ( sFiveAxisMillingKey[KEY_PS] + "=" + ::ToString( m_dStartPos)) ;
case KEY_S : return ( sFiveAxisMillingKey[KEY_S] + "=" + ::ToString( m_dSpeed)) ;
case KEY_SCC : return ( sFiveAxisMillingKey[KEY_SCC] + "=" + ::ToString( m_nSolCh)) ;
case KEY_SUBTYPE : return ( sFiveAxisMillingKey[KEY_SUBTYPE] + "=" + ::ToString( m_nSubType)) ;
case KEY_TI : return ( sFiveAxisMillingKey[KEY_TI] + "=" + ::ToString( m_bToolInvert)) ;
case KEY_TNAME : return ( sFiveAxisMillingKey[KEY_TNAME] + "=" + m_sToolName) ;
case KEY_TUUID : return ( sFiveAxisMillingKey[KEY_TUUID] + "=" + ::ToString( m_ToolUuid)) ;
case KEY_UUID : return ( sFiveAxisMillingKey[KEY_UUID] + "=" + ::ToString( m_Uuid)) ;
default : return "" ;
}
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::IsOptional( int nKey) const
{
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::VerifySolCh( int nVal) const
{
return IsValidOperationScc( nVal) ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::VerifyTool( const ToolsMgr* pToolsMgr, const string& sVal, const ToolData*& pTdata) const
{
if ( pToolsMgr == nullptr)
return false ;
pTdata = pToolsMgr->GetTool( sVal) ;
if ( pTdata == nullptr)
return false ;
if ( ( pTdata->m_nType & TF_MILL) == 0)
return false ;
return true ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::GetTool( const ToolsMgr* pToolsMgr, const ToolData*& pTdata) const
{
if ( pToolsMgr == nullptr)
return false ;
pTdata = pToolsMgr->GetTool( m_ToolUuid) ;
return ( pTdata != nullptr) ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::SetParam( int nType, bool bVal)
{
switch ( nType) {
case MPA_INVERT :
m_bInvert = bVal ;
return true ;
case MPA_TOOLINVERT :
m_bToolInvert = bVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::SetParam( int nType, int nVal)
{
switch ( nType) {
case MPA_SCC :
if ( ! VerifySolCh( nVal))
return false ;
m_nSolCh = nVal ;
return true ;
case MPA_SUBTYPE :
m_nSubType = nVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::SetParam( int nType, double dVal)
{
switch ( nType) {
case MPA_SPEED :
m_dSpeed = dVal ;
return true ;
case MPA_FEED :
m_dFeed = dVal ;
return true ;
case MPA_STARTFEED :
m_dStartFeed = dVal ;
return true ;
case MPA_ENDFEED :
m_dEndFeed = dVal ;
return true ;
case MPA_TIPFEED :
m_dTipFeed = dVal ;
return true ;
case MPA_OFFSL :
m_dOffsL = dVal ;
return true ;
case MPA_OFFSR :
m_dOffsR = dVal ;
return true ;
case MPA_DEPTH :
m_sDepth = ::ToString( dVal) ;
return true ;
case MPA_STARTPOS :
m_dStartPos = dVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::SetParam( int nType, const string& sVal)
{
switch ( nType) {
case MPA_NAME :
m_sName = sVal ;
return true ;
case MPA_TOOL :
m_sToolName = sVal ;
return true ;
case MPA_DEPTH_STR :
m_sDepth = sVal ;
return true ;
case MPA_TUUID :
return ::FromString( sVal, m_ToolUuid) ;
case MPA_UUID :
return ::FromString( sVal, m_Uuid) ;
case MPA_SYSNOTES :
m_sSysNotes = sVal ;
return true ;
case MPA_USERNOTES :
m_sUserNotes = sVal ;
return true ;
case MPA_INITANGS :
m_sInitAngs = sVal ;
return true ;
case MPA_BLOCKEDAXIS :
m_sBlockedAxis = sVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::ResetTool( void)
{
m_sToolName.clear() ;
m_ToolUuid.Clear() ;
return true ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::GetParam( int nType, bool& bVal) const
{
switch ( nType) {
case MPA_INVERT :
bVal = m_bInvert ;
return true ;
case MPA_TOOLINVERT :
bVal = m_bToolInvert ;
return true ;
}
bVal = false ;
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::GetParam( int nType, int& nVal) const
{
switch ( nType) {
case MPA_TYPE :
nVal = MT_FIVEAXISMILLING ;
return true ;
case MPA_SCC :
nVal = m_nSolCh ;
return true ;
case MPA_SUBTYPE :
nVal = m_nSubType ;
return true ;
}
nVal = 0 ;
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::GetParam( int nType, double& dVal) const
{
switch ( nType) {
case MPA_SPEED :
dVal = m_dSpeed ;
return true ;
case MPA_FEED :
dVal = m_dFeed ;
return true ;
case MPA_STARTFEED :
dVal = m_dStartFeed ;
return true ;
case MPA_ENDFEED :
dVal = m_dEndFeed ;
return true ;
case MPA_TIPFEED :
dVal = m_dTipFeed ;
return true ;
case MPA_OFFSL :
dVal = m_dOffsL ;
return true ;
case MPA_OFFSR :
dVal = m_dOffsR ;
return true ;
case MPA_STARTPOS :
dVal = m_dStartPos ;
return true ;
}
dVal = 0 ;
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::GetParam( int nType, string& sVal) const
{
switch ( nType) {
case MPA_NAME :
sVal = m_sName ;
return true ;
case MPA_TOOL :
sVal = m_sToolName ;
return true ;
case MPA_DEPTH_STR :
sVal = m_sDepth ;
return true ;
case MPA_TUUID :
sVal = ::ToString( m_ToolUuid) ;
return true ;
case MPA_UUID :
sVal = ::ToString( m_Uuid) ;
return true ;
case MPA_SYSNOTES :
sVal = m_sSysNotes ;
return true ;
case MPA_USERNOTES :
sVal = m_sUserNotes ;
return true ;
case MPA_INITANGS :
sVal = m_sInitAngs ;
return true ;
case MPA_BLOCKEDAXIS :
sVal = m_sBlockedAxis ;
return true ;
}
sVal = "" ;
return false ;
}
+76
View File
@@ -0,0 +1,76 @@
//----------------------------------------------------------------------------
// EgalTech 2024-2024
//----------------------------------------------------------------------------
// File : FiveAxisMillingData.h Data : 22.05.24 Versione : 2.6e5
// Contenuto : Dichiarazione della struct FiveAxisMillingData e costanti associate.
//
//
//
// Modifiche : 22.05.24 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "MachiningData.h"
//----------------------------------------------------------------------------
struct FiveAxisMillingData : public MachiningData
{
EgtUUID m_ToolUuid ; // identificativo universale dell'utensile
std::string m_sToolName ; // nome dell'utensile
std::string m_sInitAngs ; // angoli iniziali suggeriti (Nome1=val1,Nome2=val2)
std::string m_sBlockedAxis ; // eventuale asse rotante bloccato (Nome=val)
int m_nSolCh ; // criterio scelta soluzione (quando possibili molteplici)
double m_dSpeed ; // velocità di rotazione (+ se CCW, - se CW) ( se 0 da utensile)
double m_dFeed ; // velocità di lavorazione normale ( se 0 da utensile)
double m_dStartFeed ; // velocità di lavorazione iniziale ( se 0 da utensile)
double m_dEndFeed ; // velocità di lavorazione finale ( se 0 da utensile)
double m_dTipFeed ; // velocità di lavorazione di sfondamento ( se 0 da utensile)
double m_dOffsR ; // offset radiale ( se UNKNOWN_PAR da utensile)
double m_dOffsL ; // offset longitudinale ( se UNKNOWN_PAR da utensile)
bool m_bToolInvert ; // flag per inversione direzione utensile da geometria
bool m_bInvert ; // flag di inversione direzione lavorazione
std::string m_sDepth ; // affondamento (espressione numerica)
double m_dStartPos ; // quota di inizio lavorazione (sempre >= 0)
int m_nSubType ; // da [GenMachining] di Ini di macchina
std::string m_sSysNotes ; // note interne
std::string m_sUserNotes ; // note dell'utente
FiveAxisMillingData( void)
: m_ToolUuid(), m_nSolCh( 0), m_dSpeed( 0), m_dFeed( 0), m_dStartFeed( 0), m_dEndFeed( 0), m_dTipFeed( 0),
m_dOffsR( 0), m_dOffsL( 0), m_bToolInvert( false), m_bInvert( false), m_dStartPos( 0), m_nSubType( 0) {}
FiveAxisMillingData* Clone( void) const override ;
bool CopyFrom( const MachiningData* pMdata) override ;
bool SameAs(const MachiningData* pMdata) const override ;
int GetType( void) const override
{ return MT_FIVEAXISMILLING ; }
int GetSize( void) const override ;
std::string GetTitle( void) const override ;
bool FromString( const std::string& sString, int& nKey) override ;
std::string ToString( int nKey) const override ;
bool IsOptional( int nKey) const override ;
bool SetParam( int nType, bool bVal) override ;
bool SetParam( int nType, int nVal) override ;
bool SetParam( int nType, double dVal) override ;
bool SetParam( int nType, const std::string& sVal) override ;
bool ResetTool( void) override ;
bool GetParam( int nType, bool& bVal) const override ;
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool GetTool( const ToolsMgr* pToolsMgr, const ToolData*& pTdata) const override ;
bool VerifyTool( const ToolsMgr* pToolsMgr, const std::string& sVal, const ToolData*& pTdata) const override ;
bool VerifySolCh( int nVal) const ;
} ;
//----------------------------------------------------------------------------
inline const FiveAxisMillingData* GetFiveAxisMillingData( const MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_FIVEAXISMILLING)
return nullptr ;
return ( static_cast<const FiveAxisMillingData*>( pMdata)) ; }
inline FiveAxisMillingData* GetFiveAxisMillingData( MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_FIVEAXISMILLING)
return nullptr ;
return ( static_cast<FiveAxisMillingData*>( pMdata)) ; }
+35 -8
View File
@@ -39,6 +39,7 @@ using namespace std ;
// 2806 = "Error in GenMachining : link movements not calculable"
// 2807 = "Error in GenMachining : link outstroke xx"
// 2808 = "Error in GenMachining : post apply not calculable"
// 2809 = "Error in GenMachining : Tool loading failed"
// 2851 = "Warning in GenMachining : Skipped entity (xx)"
// 2852 = "Warning in GenMachining : No machinable path"
// 2853 = "Warning in GenMachining : Tool name changed (xx)"
@@ -54,6 +55,8 @@ static const string EVAR_INVERT = ".INVERT" ; // IN (bool) flag di inversio
static const string EVAR_STARTPOS = ".STARTPOS" ; // IN (num) quota di inizio lavorazione (sempre >= 0)
static const string EVAR_OFFSR = ".OFFSR" ; // IN (num) offset radiale
static const string EVAR_OFFSL = ".OFFSL" ; // IN (num) offset longitudinale
static const string EVAR_SYSNOTES = ".SYSNOTES" ; // IN (string) note interne
static const string EVAR_USERNOTES = ".USERNOTES" ;// IN (string) note dell'utente
static const string EVAR_TOOL = ".TOOL" ; // IN (string) nome dell'utensile
static const string EVAR_HEAD = ".HEAD" ; // IN (string) nome testa
static const string EVAR_EXIT = ".EXIT" ; // IN (int) indice uscita
@@ -70,10 +73,9 @@ static const string EVAR_FEED = ".FEED" ; // IN (num) feed dell'utensil
static const string EVAR_STARTFEED = ".STARTFEED" ;// IN (num) feed di inizio dell'utensile
static const string EVAR_ENDFEED = ".ENDFEED" ; // IN (num) feed di fine dell'utensile
static const string EVAR_TIPFEED = ".TIPFEED" ; // IN (num) feed di punta dell'utensile
static const string EVAR_SYSNOTES = ".SYSNOTES" ; // IN (string) note interne
static const string EVAR_USERNOTES = ".USERNOTES" ;// IN (string) note dell'utente
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok)
static const string EVAR_MILLS = ".MILLS" ; // OUT (int) numero di percorsi di lavoro
static const string EVAR_ISROBOT = ".ISROBOT" ; // IN (bool) flag per indicare che la cinematica è di tipo robot
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok)
static const string EVAR_MILLS = ".MILLS" ; // OUT (int) numero di percorsi di lavoro
static const string ON_PREVIEW = "OnPreview_" ;
static const string ON_APPLY = "OnApply_" ;
@@ -447,6 +449,12 @@ GenMachining::Preview( bool bRecalc)
return false ;
}
// rendo corrente l'utensile usato nella lavorazione
if ( ! m_pMchMgr->SetCalcTool( m_TParams.m_sName, m_TParams.m_sHead, m_TParams.m_nExit)) {
m_pMchMgr->SetLastError( 2809, "Error in GenMachining : Tool loading failed") ;
return false ;
}
// recupero gruppo per geometria di Preview
int nPvId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_PV) ;
// se non c'è, lo aggiungo
@@ -491,6 +499,8 @@ GenMachining::Preview( bool bRecalc)
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTPOS, m_Params.m_dStartPos) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSR, GetOffsR()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSL, GetOffsL()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_SYSNOTES, m_Params.m_sSysNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, m_Params.m_sUserNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TOOL, m_TParams.m_sName) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_HEAD, m_TParams.m_sHead) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_EXIT, m_TParams.m_nExit) ;
@@ -507,8 +517,7 @@ GenMachining::Preview( bool bRecalc)
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTFEED, GetStartFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ENDFEED, GetEndFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TIPFEED, GetTipFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_SYSNOTES, m_Params.m_sSysNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, m_Params.m_sUserNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ISROBOT, m_pMchMgr->GetCurrIsRobot()) ;
// eseguo
bOk = bOk && pMch->LuaCallFunction( sPreview, false) ;
// recupero valori parametri obbligatori
@@ -561,6 +570,12 @@ GenMachining::Apply( bool bRecalc, bool bPostApply)
}
m_nStatus = MCH_ST_TO_VERIFY ;
// rendo corrente l'utensile usato nella lavorazione
if ( ! m_pMchMgr->SetCalcTool( m_TParams.m_sName, m_TParams.m_sHead, m_TParams.m_nExit)) {
m_pMchMgr->SetLastError( 2809, "Error in GenMachining : Tool loading failed") ;
return false ;
}
// recupero gruppo per geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
// se non c'è, lo aggiungo
@@ -605,6 +620,8 @@ GenMachining::Apply( bool bRecalc, bool bPostApply)
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTPOS, m_Params.m_dStartPos) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSR, GetOffsR()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSL, GetOffsL()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_SYSNOTES, m_Params.m_sSysNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, m_Params.m_sUserNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TOOL, m_TParams.m_sName) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_HEAD, m_TParams.m_sHead) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_EXIT, m_TParams.m_nExit) ;
@@ -621,8 +638,7 @@ GenMachining::Apply( bool bRecalc, bool bPostApply)
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTFEED, GetStartFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ENDFEED, GetEndFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TIPFEED, GetTipFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_SYSNOTES, m_Params.m_sSysNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, m_Params.m_sUserNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ISROBOT, m_pMchMgr->GetCurrIsRobot()) ;
// eseguo
bOk = bOk && pMch->LuaCallFunction( sApply, false) ;
// recupero valori parametri obbligatori
@@ -948,3 +964,14 @@ GenMachining::VerifyGeometry( SelData Id, int& nSubs, int& nType)
else
return false ;
}
//----------------------------------------------------------------------------
double
GenMachining::GetApproxLinTol( void) const
{
double dLinTol ;
if ( GetValInNotes( m_Params.m_sUserNotes, "LinTol", dLinTol))
return dLinTol ;
else
return Operation::GetApproxLinTol() ;
}
+1
View File
@@ -67,6 +67,7 @@ class GenMachining : public Machining
private :
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
double GetApproxLinTol( void) const override ;
private :
double GetSpeed() const
+2 -2
View File
@@ -53,8 +53,8 @@ Generator::Run( const string& sCncFile, const string& sInfo)
int nRet = GetEGnKeyOptions( KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
if ( ! GetEMkNetHwKey())
int nRet = GetKeyOptions( GetEMkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
nRet = GetKeyOptions( GetEMkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
// Verifica della abilitazione
bool bMinTime = false ;
+14
View File
@@ -84,6 +84,12 @@ const std::string GENMACHINING_SEC = "GenMachining" ;
// Chiave (radice) per nome lavorazione generica i-esima
const std::string GENMACHINING_SCRIPT_KEY = "GenScript" ;
//----------------------------------------------------------------------------
// Sezione fresature 5assi nel file INI di macchina
const std::string FIVEAXISMILLING_SEC = "5AxMilling" ;
// Chiave (radice) per nome lavorazione 5assi i-esima
const std::string FIVEAXISMILLING_SCRIPT_KEY = "5AxScript" ;
//----------------------------------------------------------------------------
// Sezione di attrezzaggio nel file INI di macchina
const std::string SETUP_SEC = "Setup" ;
@@ -116,6 +122,12 @@ const std::string MILLHOLDER_KEY = "MillHolder" ;
// Sezione portautensili nel file INI di macchina
const std::string TOOLHOLDER_SEC = "ToolHolder" ;
//----------------------------------------------------------------------------
// Sezione lavorazioni nel file INI di macchina
const std::string MACHININGS_SEC = "Machinings" ;
// Chiave per abilitare discesa e risalita in rapido da fresature con estremi fuori dal grezzo
const std::string RAPIDONOUT_KEY = "RapidOnOut" ;
//----------------------------------------------------------------------------
// Minimo spessore del grezzo
const double RAW_MIN_H = 1 ;
@@ -140,3 +152,5 @@ const std::string NST_PARTREG_LAYER = "Region" ;
//----------------------------------------------------------------------------
// Minima componente zeta di versore utensile per lavorazione da sopra (-45deg)
const double MIN_ZDIR_TOP_TOOL = -0.7072 ;
// Minima componente zeta di versose utensile èer mortasatura quasi verticale (45deg)
const double MIN_ZDIR_VERT_CHSAW = 0.7072 ;
+11 -5
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2024
//----------------------------------------------------------------------------
// File : MachMgr.h Data : 02.04.24 Versione : 2.6d1
// File : MachMgr.h Data : 22.04.24 Versione : 2.6d4
// Contenuto : Dichiarazione della classe MachMgr.
//
//
@@ -15,6 +15,7 @@
// 28.10.23 DS Aggiunte GetClEntAxesVal e GetToolSetupPosInCurrSetup.
// 30.03.24 DS Aggiunte GetAllAxesNames e GetCalcTable.
// 02.04.24 DS Aggiunta GetClEntAxesMask.
// 22.04.24 DS Aggiunta GetExitId.
//
//----------------------------------------------------------------------------
@@ -297,7 +298,8 @@ class MachMgr : public IMachMgr
bool MachiningUpdate( bool bPostApply = true) override ;
bool PreparePreviewMachiningTool( void) const override ;
bool RemovePreviewMachiningTool( void) const override ;
int PreviewMachiningTool( int nEntId, int nFlag) const override ;
int GetPreviewMachiningToolStepCount( void) const override ;
int PreviewMachiningTool( int nEntId, int nStep) const override ;
bool GetMachiningParam( int nType, bool& bVal) const override ;
bool GetMachiningParam( int nType, int& nVal) const override ;
bool GetMachiningParam( int nType, double& dVal) const override ;
@@ -361,6 +363,7 @@ class MachMgr : public IMachMgr
int GetAxisId( const std::string& sAxis) const override ;
int GetHeadId( const std::string& sHead) const override ;
int GetHeadExitCount( const std::string& sHead) const override ;
int GetExitId( const std::string& sHead, int nExit) const override ;
int GetTcPosId( const std::string& sTcPos) const override ;
bool GetAxisToken( const std::string& sAxis, std::string& sToken) const override ;
bool GetAxisType( const std::string& sAxis, bool& bLinear) const override ;
@@ -468,11 +471,14 @@ class MachMgr : public IMachMgr
bool SimAddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
bool SimExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) ;
bool SimOnCollision( int nCdInd, int nObjInd, int& nErr) ;
bool SimSetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, const INTVECTOR& vVmill, bool bFirst) ;
bool SimSetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, int nFlag, double dPar1, double dPar2,
const INTVECTOR& vVmill, bool bFirst) ;
bool SimEnableToolsForVmill( bool bEnable) ;
int SimMoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) ;
bool SimSaveCmd( int nType, int nPar, const std::string& sPar) ;
// Machine
bool GetHeadAbove( const std::string& sHead) const ;
double GetDeltaSafeZ( const std::string& sHead) const ;
double GetAngDeltaMinForHome( void) const ;
private :
@@ -546,5 +552,5 @@ class MachMgr : public IMachMgr
int m_nCurrDispId ; // identificativo della disposizione corrente
int m_nCurrMachiningId ; // identificativo della lavorazione corrente
AXBLOCKVECTOR m_vAxisBlock ; // elenco assi da bloccare
Simulator* m_pSimul ; // puntatore al simulatore attivo
ISimulator* m_pSimul ; // puntatore al simulatore attivo
} ;
+5 -1
View File
@@ -311,7 +311,11 @@ MachMgr::SetLastError( int nErr, const string& sErr)
{
m_nLastError = nErr ;
m_sLastError = sErr ;
string sInfo = m_sLastError + " (" + ToString( nErr) + ")" ;
string sInfo ;
if ( sErr._Starts_with( "Error"))
sInfo = m_sLastError + " (" + ToString( nErr) + ")" ;
else
sInfo = "Error " + ToString( nErr) + " : " + m_sLastError ;
LOG_ERROR( GetEMkLogger(), sInfo.c_str()) ;
return true ;
}
+1
View File
@@ -16,6 +16,7 @@
#include "DllMain.h"
#include "MachMgr.h"
#include "MachConst.h"
#include "CamData.h"
using namespace std ;
+19 -2
View File
@@ -18,6 +18,7 @@
#include "MachConst.h"
#include "Generator.h"
#include "Estimator.h"
#include "/EgtDev/Include/EGnFileUtils.h"
using namespace std ;
@@ -25,6 +26,22 @@ using namespace std ;
bool
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")
return false ;
}
}
// inizializzazione generatore
Generator genPP ;
if ( ! genPP.Init( this)) {
@@ -44,13 +61,13 @@ MachMgr::Generate( const string& sCncFile, const string& sInfo)
bool
MachMgr::Estimate( const string& sEstFile, const string& sInfo)
{
// inizializzazione generatore
// inizializzazione stimatore
Estimator estPP ;
if ( ! estPP.Init( this)) {
LOG_ERROR( GetEMkLogger(), "Error on Estimate Init")
return false ;
}
// esecuzione della generazione
// esecuzione della stima
if ( ! estPP.Run( sEstFile, sInfo)) {
LOG_ERROR( GetEMkLogger(), "Error on Estimate Run")
return false ;
+11 -14
View File
@@ -274,6 +274,15 @@ MachMgr::GetHeadExitCount( const string& sHead) const
return ( ( pMch != nullptr) ? pMch->GetHeadExitCount( sHead) : 0) ;
}
//----------------------------------------------------------------------------
int
MachMgr::GetExitId( const string& sHead, int nExit) const
{
Machine* pMch = GetCurrMachine() ;
// recupero identificativo dell'uscita della testa indicata nella macchina corrente
return ( ( pMch != nullptr) ? pMch->GetExitId( sHead, nExit) : GDB_ID_NULL) ;
}
//----------------------------------------------------------------------------
int
MachMgr::GetTcPosId( const string& sTcPos) const
@@ -294,18 +303,6 @@ MachMgr::GetHeadAbove( const string& sHead) const
return ( ! m_pGeomDB->GetInfo( GetHeadId( sHead), MCH_ABOVE, bAbove) || bAbove) ;
}
//----------------------------------------------------------------------------
double
MachMgr::GetDeltaSafeZ( const string& sHead) const
{
if ( m_pGeomDB == nullptr)
return 0 ;
// Leggo da testa Info ZSAFEDELTA
double dDeltaSafeZ = 0 ;
m_pGeomDB->GetInfo( GetHeadId( sHead), MCH_ZSAFEDELTA, dDeltaSafeZ) ;
return dDeltaSafeZ ;
}
//----------------------------------------------------------------------------
double
MachMgr::GetAngDeltaMinForHome( void) const
@@ -766,7 +763,7 @@ MachMgr::GetCalcTipFromPositions( double dX, double dY, double dZ, double dAngA,
{
DBLVECTOR vAng( 2) ; vAng[0] = dAngA ; vAng[1] = dAngB ;
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetTipFromPositions( dX, dY, dZ, vAng, bOverall, bBottom, ptTip) : false) ;
return ( ( pMch != nullptr) ? pMch->GetTipFromPositions( dX, dY, dZ, vAng, bOverall, bBottom, false, ptTip) : false) ;
}
//----------------------------------------------------------------------------
@@ -775,7 +772,7 @@ MachMgr::GetCalcTipFromPositions( double dX, double dY, double dZ, const DBLVECT
bool bOverall, bool bBottom, Point3d& ptTip) const
{
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetTipFromPositions( dX, dY, dZ, vAng, bOverall, bBottom, ptTip) : false) ;
return ( ( pMch != nullptr) ? pMch->GetTipFromPositions( dX, dY, dZ, vAng, bOverall, bBottom, false, ptTip) : false) ;
}
//----------------------------------------------------------------------------
+18 -2
View File
@@ -1122,7 +1122,23 @@ MachMgr::RemovePreviewMachiningTool( void) const
//----------------------------------------------------------------------------
int
MachMgr::PreviewMachiningTool( int nEntId, int nFlag) const
MachMgr::GetPreviewMachiningToolStepCount( void) const
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return 0 ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return 0 ;
// eseguo
return pMch->GetToolPreviewStepCount() ;
}
//----------------------------------------------------------------------------
int
MachMgr::PreviewMachiningTool( int nEntId, int nStep) const
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
@@ -1133,7 +1149,7 @@ MachMgr::PreviewMachiningTool( int nEntId, int nFlag) const
if ( pMch == nullptr)
return GDB_ID_NULL ;
// eseguo
return pMch->ToolPreview( nEntId, nFlag) ;
return pMch->ToolPreview( nEntId, nStep) ;
}
//----------------------------------------------------------------------------
+33 -4
View File
@@ -16,7 +16,8 @@
#include "DllMain.h"
#include "MachMgr.h"
#include "MachConst.h"
#include "Simulator.h"
#include "SimulatorSP.h"
#include "SimulatorMP.h"
using namespace std ;
@@ -27,7 +28,12 @@ MachMgr::SimInit( void)
// alloco o rialloco il simulatore
if ( m_pSimul != nullptr)
delete m_pSimul ;
m_pSimul = new( nothrow) Simulator ;
if ( GetCurrMachine() == nullptr)
return false ;
if ( GetCurrMachine()->GetMultiProcess( 2))
m_pSimul = CreateSimulatorMP() ;
else
m_pSimul = CreateSimulatorSP() ;
if ( m_pSimul == nullptr)
return false ;
// lo inizializzo
@@ -183,13 +189,25 @@ MachMgr::SimOnCollision( int nCdInd, int nObjInd, int& nErr)
//----------------------------------------------------------------------------
bool
MachMgr::SimSetToolForVmill( const string& sTool, const string& sHead, int nExit, const INTVECTOR& vVmill, bool bFirst)
MachMgr::SimSetToolForVmill( const string& sTool, const string& sHead, int nExit, int nFlag, double dPar1, double dPar2,
const INTVECTOR& vVmill, bool bFirst)
{
// verifico simulatore
if ( m_pSimul == nullptr)
return false ;
// imposto utensile per Vmill
return m_pSimul->SetToolForVmill( sTool, sHead, nExit, vVmill, bFirst) ;
return m_pSimul->SetToolForVmill( sTool, sHead, nExit, nFlag, dPar1, dPar2, vVmill, bFirst) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SimEnableToolsForVmill( bool bEnable)
{
// verifico simulatore
if ( m_pSimul == nullptr)
return false ;
// imposto abilitazione Vmill
return m_pSimul->EnableToolsForVmill( bEnable) ;
}
//----------------------------------------------------------------------------
@@ -202,3 +220,14 @@ MachMgr::SimMoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
// lancio movimento assi
return m_pSimul->MoveAxes( nMoveType, vAxNaEpSt) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SimSaveCmd( int nType, int nPar, const string& sPar)
{
// verifico simulatore
if ( m_pSimul == nullptr)
return false ;
// salvo il comando
return m_pSimul->SaveCmd( nType, nPar, sPar) ;
}
+1
View File
@@ -41,6 +41,7 @@ Machine::Machine( void)
m_dExitMaxAdjust = EPS_SMALL ;
m_dExitMaxRotAdj = 10 * EPS_ANG_SMALL ;
m_dAngDeltaMinForHome = INFINITO ;
m_nMultiProcess = 0 ;
m_nCalcTabId = GDB_ID_NULL ;
m_nCalcHeadId = GDB_ID_NULL ;
m_nCalcExitId = GDB_ID_NULL ;
+7 -2
View File
@@ -71,6 +71,8 @@ class Machine
int GetHeadSelectType(const std::string& sHead) const ;
double GetAngDeltaMinForHome( void) const
{ return m_dAngDeltaMinForHome ; }
bool GetMultiProcess( int nOpt = 1) const
{ return ( m_nMultiProcess >= 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) ;
@@ -126,6 +128,7 @@ class Machine
bool GetAllCurrAxesNames( STRVECTOR& vAxName) const ;
bool GetCurrAxisToken( int nInd, std::string& sAxToken) const ;
bool GetAllCurrAxesTokens( STRVECTOR& vAxToken) const ;
bool GetCurrAxisType( int nInd, bool& bLinear, bool& bHead) const ;
bool GetCurrAxisMin( int nInd, double& dMin) const ;
bool GetCurrAxisMax( int nInd, double& dMax) const ;
bool GetCurrAxisOffset( int nInd, double& dOffset) const ;
@@ -147,7 +150,7 @@ class Machine
bool GetNoseFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng,
Point3d& ptNose) const ;
bool GetTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng,
bool bBottom, bool bOverall, Point3d& ptTip) const ;
bool bOverall, bool bBottom, bool bBack, Point3d& ptTip) const ;
bool GetToolDirFromAngles( const DBLVECTOR& vAng, Vector3d& vtDir) const ;
bool GetAuxDirFromAngles( const DBLVECTOR& vAng, Vector3d& vtDir) const ;
bool GetPartDirFromAngles( const Vector3d& vtPart, const DBLVECTOR& vAng, Vector3d& vtDir) const ;
@@ -290,6 +293,7 @@ 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
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
@@ -374,8 +378,9 @@ class Machine
static int LuaEmtOnCollision( lua_State* L) ;
static int LuaEmtSetToolForVmill( lua_State* L) ;
static int LuaEmtAddToolForVmill( lua_State* L) ;
static int LuaEmtEnableToolsForVmill( lua_State* L) ;
static int LuaEmtMoveAxes( lua_State* L) ;
static int LuaEmtSaveCmd( lua_State* L) ;
} ;
//----------------------------------------------------------------------------
+44 -3
View File
@@ -1369,10 +1369,11 @@ Machine::GetNoseFromPositions( double dX, double dY, double dZ, const DBLVECTOR&
//----------------------------------------------------------------------------
bool
Machine::GetTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng,
bool bOverall, bool bBottom, Point3d& ptTip) const
bool bOverall, bool bBottom, bool bBack, Point3d& ptTip) const
{
// la posizione deve essere espressa rispetto allo ZERO MACCHINA
// è espressa nel riferimento di macchina (tiene conto delle sole rotazioni di testa)
// se bBack vero, allora è nel riferimento pezzo
// verifico dimensione vettore angoli rispetto al numero di assi rotanti
if ( vAng.size() < m_vCalcRotAx.size())
@@ -1419,12 +1420,33 @@ Machine::GetTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR&
if ( m_nCalcChainType == KIN_CHAIN_ROBOT)
ptTip.ToGlob( m_frRobot) ;
// Se richiesto nel riferimento pezzo
if ( bBack) {
// ciclo sugli assi lineari di tavola all'indietro
DBLVECTOR vMov( {dX, dY, dZ}) ;
for ( int i = int( m_vCalcLinAx.size()) ; i > 0 ; -- i) {
if ( ! m_vCalcLinAx[i-1].bHead)
ptTip += m_vCalcLinAx[i-1].vtDir * ( vMov[i-1] - m_vCalcLinAx[i-1].dHomeVal) ;
}
// ciclo sugli assi rotanti di tavola all'indietro !!! NON VERIFICATO !!!
for ( int i = int( m_vCalcRotAx.size()) ; i > 0 ; -- i) {
if ( ! m_vCalcRotAx[i-1].bHead)
ptTip.Rotate( m_vCalcRotAx[i-1].ptPos, m_vCalcRotAx[i-1].vtDir, -vAng[i-1]) ;
}
}
// Se richiesto ingombro totale o punto sotto del tip utensile
if ( bOverall || bBottom) {
// calcolo la direzione fresa
Vector3d vtDirT ;
if ( ! GetDirection( m_vtCalcDir, vAng, vtDirT))
return false ;
if ( bBack) {
if ( ! GetBackDirection( m_vtCalcDir, vAng, vtDirT))
return false ;
}
else {
if ( ! GetDirection( m_vtCalcDir, vAng, vtDirT))
return false ;
}
// se richiesto ingombro totale
if ( bOverall)
ptTip -= vtDirT * max( m_dCalcTOvLen - m_dCalcTLen, 0.) ;
@@ -1925,6 +1947,25 @@ Machine::GetAllCurrAxesTokens( STRVECTOR& vAxToken) const
return bOk ;
}
//----------------------------------------------------------------------------
bool
Machine::GetCurrAxisType( int nInd, bool& bLinear, bool& bHead) const
{
int nLinAxes = int( m_vCalcLinAx.size()) ;
int nRotAxes = int( m_vCalcRotAx.size()) ;
if ( nInd >= 0 && nInd < nLinAxes) {
bLinear = true ;
bHead = m_vCalcLinAx[nInd].bHead ;
return true ;
}
else if ( nInd >= nLinAxes && nInd < nLinAxes + nRotAxes) {
bLinear = false ;
bHead = m_vCalcRotAx[nInd-nLinAxes].bHead ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
Machine::GetCurrAxisMin( int nInd, double& dMin) const
+76 -7
View File
@@ -1,13 +1,15 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2021
// EgalTech 2015-2024
//----------------------------------------------------------------------------
// File : MachineLua.cpp Data : 14.10.21 Versione : 2.3j5
// File : MachineLua.cpp Data : 01.09.24 Versione : 2.6i1
// Contenuto : Implementazione gestione macchina : funzioni Lua.
//
//
//
// Modifiche : 06.05.15 DS Creazione modulo.
// 26.04.20 DS Aggiunta gestione TcPos.
// 05.08.24 DS Aggiunta gestione SpecialEstimate.
// 01.09.24 DS SpecialEstimate è diventato MultiProcess.
//
//----------------------------------------------------------------------------
@@ -34,6 +36,7 @@ static const string FLD_AXISMAXROTADJ = "AxisMaxRotAdj" ;
static const string FLD_EXITMAXADJUST = "ExitMaxAdjust" ;
static const string FLD_EXITMAXROTADJ = "ExitMaxRotAdj" ;
static const string FLD_ANGDELTAMINFORHOME = "AngDeltaMinForHome" ;
static const string FLD_MULTIPROCESS = "MultiProcess" ;
static const string FLD_NAME = "Name" ;
static const string FLD_PARENT = "Parent" ;
static const string FLD_GEO = "Geo" ;
@@ -139,8 +142,12 @@ Machine::LuaInit( const string& sMachineName)
m_LuaMgr.RegisterFunction( "EmtSetToolForVmill", Machine::LuaEmtSetToolForVmill) ;
// registro la funzione di impostazione di utensile aggiuntivo per virtual milling in simulazione
m_LuaMgr.RegisterFunction( "EmtAddToolForVmill", Machine::LuaEmtAddToolForVmill) ;
// registro la funzione per abilitare/disabilitare l'esecuzione del virtual milling
m_LuaMgr.RegisterFunction( "EmtEnableToolsForVmill", Machine::LuaEmtEnableToolsForVmill) ;
// registro la funzione di movimento assi in simulazione
m_LuaMgr.RegisterFunction( "EmtMoveAxes", Machine::LuaEmtMoveAxes) ;
// registro la funzione di salvataggio comandi in simulazione MP
m_LuaMgr.RegisterFunction( "EmtSaveCmd", Machine::LuaEmtSaveCmd) ;
return true ;
}
@@ -340,6 +347,9 @@ Machine::LuaEmtGeneral( lua_State* L)
// lettura eventuale campo 'AngDeltaForHome' dalla tabella (default INFINITO)
double dAngDeltaMinForHome = INFINITO ;
LuaGetTabFieldParam( L, 1, FLD_ANGDELTAMINFORHOME, dAngDeltaMinForHome) ;
// lettura eventuale campo 'MultiProcess' dalla tabella (0=no, 1=si, 2=si con simulazione MP)
int nMultiProcess = 0 ;
LuaGetTabFieldParam( L, 1, FLD_MULTIPROCESS, nMultiProcess) ;
LuaClearStack( L) ;
// info
@@ -389,6 +399,9 @@ 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
m_pMchLua->m_nMultiProcess = nMultiProcess ;
return 0 ;
}
@@ -1438,7 +1451,7 @@ Machine::LuaEmtOnCollision( lua_State* L)
int
Machine::LuaEmtSetToolForVmill( lua_State* L)
{
// 4 parametri : sTool, sHead, nExit, vVmill
// 4 o 7 parametri : sTool, sHead, nExit, vVmill [, nFlag , dPar1, dPar2]
string sTool ;
LuaGetParam( L, 1, sTool) ;
string sHead ;
@@ -1447,12 +1460,19 @@ Machine::LuaEmtSetToolForVmill( lua_State* L)
LuaGetParam( L, 3, nExit) ;
INTVECTOR vVmill ;
LuaGetParam( L, 4, vVmill) ;
int nFlag = 0 ;
LuaGetParam( L, 5, nFlag) ;
double dPar1 = 0 ;
LuaGetParam( L, 6, dPar1) ;
double dPar2 = 0 ;
LuaGetParam( L, 7, dPar2) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// imposto dati primo utensile per virtual milling in simulazione
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimSetToolForVmill( sTool, sHead, nExit, vVmill, true)) ;
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr &&
m_pMchLua->m_pMchMgr->SimSetToolForVmill( sTool, sHead, nExit, nFlag, dPar1, dPar2, vVmill, true)) ;
// assegno risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -1462,7 +1482,7 @@ Machine::LuaEmtSetToolForVmill( lua_State* L)
int
Machine::LuaEmtAddToolForVmill( lua_State* L)
{
// 4 parametri : sTool, sHead, nExit, vVmill
// 4 o 7 parametri : sTool, sHead, nExit, vVmill [, nFlag, dPar1, dPar2]
string sTool ;
LuaGetParam( L, 1, sTool) ;
string sHead ;
@@ -1471,12 +1491,37 @@ Machine::LuaEmtAddToolForVmill( lua_State* L)
LuaGetParam( L, 3, nExit) ;
INTVECTOR vVmill ;
LuaGetParam( L, 4, vVmill) ;
int nFlag = 0 ;
LuaGetParam( L, 5, nFlag) ;
double dPar1 = 0 ;
LuaGetParam( L, 6, dPar1) ;
double dPar2 = 0 ;
LuaGetParam( L, 7, dPar2) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// imposto dati utensile aggiuntivo per virtual milling in simulazione
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimSetToolForVmill( sTool, sHead, nExit, vVmill, false)) ;
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr &&
m_pMchLua->m_pMchMgr->SimSetToolForVmill( sTool, sHead, nExit, nFlag, dPar1, dPar2, vVmill, false)) ;
// assegno risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtEnableToolsForVmill( lua_State* L)
{
// 1 parametro : bEnable
bool bEnable = false ;
LuaGetParam( L, 1, bEnable) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// imposto abilitazione utensili per virtual milling in simulazione
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimEnableToolsForVmill( bEnable)) ;
// assegno risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -1511,7 +1556,31 @@ Machine::LuaEmtMoveAxes( lua_State* L)
// assegno risultato
if ( nRes == SIM_AXMV_RES_STOP)
return luaL_error( L, "STOP") ;
else
else {
LuaSetParam( L, ( nRes == SIM_AXMV_RES_OK)) ;
LuaSetParam( L, m_pMchLua->GetMultiProcess()) ;
}
return 2 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtSaveCmd( lua_State* L)
{
// parametri : nType,
int nType = 0 ;
LuaGetParam( L, 1, nType) ;
int nPar = 0 ;
LuaGetParam( L, 2, nPar) ;
string sPar ;
LuaGetParam( L, 3, sPar) ;
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)) ;
// assegno risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
+1
View File
@@ -15,6 +15,7 @@
#include "stdafx.h"
#include "MachMgr.h"
#include "DllMain.h"
#include "CamData.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkCurveLine.h"
+62 -8
View File
@@ -176,6 +176,42 @@ Machining::RemoveToolPreview( void) const
//----------------------------------------------------------------------------
int
Machining::GetToolPreviewStepCount( void) const
{
// verifico validità gestori DB geometrico e CAM
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr)
return 0 ;
// recupero gruppo per geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_CL) ;
if ( nClId == GDB_ID_NULL)
return 0 ;
// determino il numero di entità di tutti i sottogruppi, escludendo CLIMB e RISE
int nCount = 0 ;
int nPxId = m_pGeomDB->GetFirstGroupInGroup( nClId) ;
while ( nPxId != GDB_ID_NULL) {
// aggiungo tutte le entità del truppo
nCount += m_pGeomDB->GetGroupObjs( nPxId) ;
// tolgo le entità CLIMB
int nClimbId = m_pGeomDB->GetFirstNameInGroup( nPxId, MCH_CL_CLIMB) ;
while ( nClimbId != GDB_ID_NULL) {
-- nCount ;
nClimbId = m_pGeomDB->GetNextName( nClimbId, MCH_CL_CLIMB) ;
}
// tolgo le entità RISE
int nRiseId = m_pGeomDB->GetFirstNameInGroup( nPxId, MCH_CL_RISE) ;
while ( nRiseId != GDB_ID_NULL) {
-- nCount ;
nRiseId = m_pGeomDB->GetNextName( nRiseId, MCH_CL_RISE) ;
}
// passo al successivo sottogruppo
nPxId = m_pGeomDB->GetNextGroup( nPxId) ;
}
return nCount ;
}
//----------------------------------------------------------------------------
static int
GetToolPreviewNext( IGeomDB* pGeomDB, int nEntId, int nParentId)
{
// recupero la successiva
@@ -201,7 +237,7 @@ GetToolPreviewNext( IGeomDB* pGeomDB, int nEntId, int nParentId)
}
//----------------------------------------------------------------------------
int
static int
GetToolPreviewPrev( IGeomDB* pGeomDB, int nEntId, int nParentId)
{
// recupero la precedente
@@ -228,7 +264,7 @@ GetToolPreviewPrev( IGeomDB* pGeomDB, int nEntId, int nParentId)
//----------------------------------------------------------------------------
int
Machining::ToolPreview( int nEntId, int nFlag) const
Machining::ToolPreview( int nEntId, int nStep) const
{
// verifico validità gestori DB geometrico e CAM
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr)
@@ -248,10 +284,10 @@ Machining::ToolPreview( int nEntId, int nFlag) const
// recupero il gruppo di appartenenza
nParentId = m_pGeomDB->GetFirstGroupInGroup( nClId) ;
// se richiesta successiva
if ( nFlag == MCH_TPM_AFTER)
if ( nStep > 0)
nEntId = GetToolPreviewNext( m_pGeomDB, nEntId, nParentId) ;
// se richiesta precedente
else if ( nFlag == MCH_TPM_BEFORE)
else if ( nStep < 0)
nEntId = GetToolPreviewPrev( m_pGeomDB, nEntId, nParentId) ;
// altrimenti richiesta corrente
else
@@ -263,11 +299,29 @@ Machining::ToolPreview( int nEntId, int nFlag) const
nParentId = m_pGeomDB->GetParentId( nEntId) ;
if ( m_pGeomDB->GetParentId( nParentId) == nClId) {
// se richiesta successiva
if ( nFlag == MCH_TPM_AFTER)
nEntId = GetToolPreviewNext( m_pGeomDB, nEntId, nParentId) ;
if ( nStep > 0) {
while ( nStep > 0) {
int nOldId = nEntId ;
nEntId = GetToolPreviewNext( m_pGeomDB, nEntId, nParentId) ;
-- nStep ;
if ( nEntId == GDB_ID_NULL) {
nEntId = nOldId ;
break ;
}
}
}
// se richiesta precedente
else if ( nFlag == MCH_TPM_BEFORE)
nEntId = GetToolPreviewPrev( m_pGeomDB, nEntId, nParentId) ;
else if ( nStep < 0) {
while ( nStep < 0) {
int nOldId = nEntId ;
nEntId = GetToolPreviewPrev( m_pGeomDB, nEntId, nParentId) ;
++ nStep ;
if ( nEntId == GDB_ID_NULL) {
nEntId = nOldId ;
break ;
}
}
}
}
else
nEntId = GDB_ID_NULL ;
+2 -1
View File
@@ -48,8 +48,9 @@ class Machining : public Operation
bool GetStartPoint( Point3d& ptStart) const ;
bool GetEndPoint( Point3d& ptEnd) const ;
bool PrepareToolPreview( void) const ;
int ToolPreview( int nEntId, int nFlag) const ;
bool RemoveToolPreview( void) const ;
int GetToolPreviewStepCount( void) const ;
int ToolPreview( int nEntId, int nStep) const ;
protected :
Machining( void) ;
+2 -2
View File
@@ -107,7 +107,7 @@ GetMachiningTitle( int nMchType)
"SurfRoughing",
"SurfFinishing",
"Waterjetting",
"5axMachining"} ;
"5AxisMilling"} ;
switch ( nMchType) {
case MT_DRILLING : return MchTitle[1] ;
case MT_SAWING : return MchTitle[2] ;
@@ -121,7 +121,7 @@ GetMachiningTitle( int nMchType)
case MT_SURFROUGHING : return MchTitle[10] ;
case MT_SURFFINISHING : return MchTitle[11] ;
case MT_WATERJETTING : return MchTitle[12] ;
case MT_5AXMACHINING : return MchTitle[13] ;
case MT_FIVEAXISMILLING : return MchTitle[13] ;
}
return MchTitle[0] ;
+155 -104
View File
@@ -35,9 +35,11 @@
#include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkIntersCurveSurfTm.h"
#include "/EgtDev/Include/EGkIntervals.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGkUserObjFactory.h"
#include "/EgtDev/Include/EGnStringKeyVal.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EgtIniFile.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
using namespace std ;
@@ -46,7 +48,8 @@ using namespace std ;
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 DELTA_ELEV_RAD = 4.0 ;
const double LIM_SIN_DIFF_DIR = 0.175 ;
//------------------------------ Errors --------------------------------------
// 2301 = "Error in Milling : UpdateToolData failed"
@@ -1363,8 +1366,11 @@ Milling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
else
nToolDir = TOOL_PARAL ;
int nFaceUse = ( m_Params.m_nFaceUse & 31) ;
Vector3d vtFaceUse ;
if ( FromString( ExtractInfo( 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, dSawThick) ;
AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, vtFaceUse, dSawThick) ;
// la restituisco
lstPC.emplace_back( Release( pCrvCompo)) ;
return true ;
@@ -1388,6 +1394,9 @@ Milling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
else
nToolDir = TOOL_PARAL ;
int nFaceUse = ( m_Params.m_nFaceUse & 31) ;
Vector3d vtFaceUse ;
if ( FromString( ExtractInfo( 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
int nCstart = 0 ;
@@ -1410,7 +1419,7 @@ Milling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
// la porto in globale
pCrvCompo->ToGlob( frGlob) ;
// sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, dSawThick) ;
AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, vtFaceUse, dSawThick) ;
// la restituisco
lstPC.emplace_back( Release( pCrvCompo)) ;
}
@@ -1882,7 +1891,7 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
// altrimenti lavorazione a step
else {
// massimo affondamento dell'utensile
double dSafe = m_pMchMgr->GetCurrMachiningsMgr()->GetMaxDepthSafe() ;
double dSafe = GetMaxDepthSafe() ;
double dMaxDepth = m_TParams.m_dLen - ( m_TParams.m_dDiam > m_dTHoldDiam ? m_dTHoldBase : m_dTHoldLen) - dSafe ;
// se c'è oscillazione e l'elevazione complessiva supera la capacità dell'utensile, annullo l'oscillazione
if ( bPathOscEnable && dElev + dAddElev > dMaxDepth + EPS_SMALL) {
@@ -2243,31 +2252,31 @@ Milling::GenerateMillingPv( int nPathId, const ICurveComposite* pCompo, double d
return true ;
}
//----------------------------------------------------------------------------
static bool
VerifyEscapeDir( const Vector3d& vtCorr, const Vector3d& vtTool, bool bAboveHead)
{
if ( bAboveHead && AreSameVectorApprox( vtCorr, -Z_AX))
return false ;
if ( ! bAboveHead && AreSameVectorApprox( vtCorr, Z_AX))
return false ;
Vector3d vtEsc( vtCorr.x, vtCorr.y, 0) ;
return ( vtEsc.Normalize() && vtEsc * vtTool > -0.5) ;
}
//----------------------------------------------------------------------------
bool
Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dDepth, double dElev, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable)
{
// recupero distanze di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeAggrBottZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeAggrBottZ() ;
double dSafeZ = GetSafeZ() ;
double dSafeAggrBottZ = GetSafeAggrBottZ() ;
// extra lunghezza utensile
double dExtraLen = max( 0.0, m_TParams.m_dTLen - m_TParams.m_dLen) ;
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
double dExtrAppr = dAppr + max( 0.0, m_TParams.m_dTLen - m_TParams.m_dLen) ;
double dExtrAppr = dAppr + dExtraLen ;
// delta da punto lavoro a punto tip
Vector3d vtWkTip = vtTool * ( m_TParams.m_dLen - m_TParams.m_dTLen) ;
Vector3d vtWkTip = -vtTool * dExtraLen ;
// Recupero flag per rapidi su inizio/fine se fuori
string sMachIni = m_pMchMgr->GetCurrMachine()->GetMachineDir() + "\\" + m_pMchMgr->GetCurrMachine()->GetMachineName() + ".ini" ;
bool bRapidOnOut = ( GetPrivateProfileInt( MACHININGS_SEC.c_str(), RAPIDONOUT_KEY.c_str(), 0, sMachIni.c_str()) == 1) ;
// Recupero necessità indicizzazione per variazioni di lavorazione ("MVar" da porte)
bool bIndex = false ;
string sInfo ;
if ( m_Params.m_nWorkSide == MILL_WS_CENTER && m_vId.size() == 1 && m_pGeomDB->GetInfo( m_vId[0].nId, "MVar", sInfo))
bIndex = true ;
// in caso di tabs ne aggiusto i parametri secondo il percorso
TabData tdTabs ;
@@ -2281,7 +2290,6 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
// ciclo sulle curve elementari
bool bOk = true ;
bool bClosed = pCompo->IsClosed() ;
m_dCurrTabsLen = 0 ;
m_dCurrOscillLen = 2 * dOscRampLen + 1.5 * dOscFlatLen ;
int nMaxInd = pCompo->GetCurveCount() - 1 ;
@@ -2296,13 +2304,17 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
pCurve->Translate( - vtTool * dDepth) ;
// se prima entità, approccio e affondo
if ( i == 0) {
// reset index
SetIndex( 0) ;
// dati inizio entità
Point3d ptStart ;
pCurve->GetStartPoint( ptStart) ;
Vector3d vtStart = m_vtStartDir ;
// determino elevazione su inizio percorso di lavoro
double dStElev ;
if ( ! GetElevation( m_nPhase, ptStart + vtWkTip, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev))
if ( GetElevation( m_nPhase, ptStart + vtWkTip, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev))
dStElev = max( dStElev - dExtraLen, 0.) ;
else
dStElev = dElev ;
// determino inizio attacco
Point3d ptP1 ;
@@ -2314,7 +2326,7 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
Vector3d vtAppr( vtTool.x, vtTool.y, 0) ;
if ( ! vtAppr.Normalize())
vtAppr = FromNearestHorizontalOrtho( vtTool, vtDir1) ;
bool bOutStart = GetPointOutOfRaw( ptP1 + vtWkTip, vtTool, vtAppr, dStElev, dSafeZ) ;
bool bOutStart = GetPointOutOfRaw( ptP1 + vtWkTip, vtTool, vtAppr, dSafeZ) ;
// determino se l'inizio dell'attacco è sopra il grezzo
bool bGeomAboveStart = GetPointAboveRaw( ptP1 + vtWkTip, vtTool) ;
bool bAboveStart = false ;
@@ -2328,9 +2340,16 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
}
// imposto versore correzione e ausiliario sul punto di partenza
CalcAndSetCorrAuxDir( pCompo, i, false, true) ;
// se richiesto rapido quando fuori e sono già in aria
if ( bRapidOnOut && bOutStart) {
// affondo al punto iniziale
SetFlag( 0) ;
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
return false ;
}
// aggiungo approccio per frese normali e frese che non lavorano di testa con attacco opportuno oppure fuori
if ( ( m_TParams.m_nType & TF_MILL) != 0 &&
( m_TParams.m_nType != TT_MILL_NOTIP || LeadInRawIsOk() || m_bStartOutRaw)) {
else if ( ( m_TParams.m_nType & TF_MILL) != 0 &&
( m_TParams.m_nType != TT_MILL_NOTIP || LeadInRawIsOk() || m_bStartOutRaw)) {
// correggo elevazione iniziale per punto inizio attacco (se testa da sopra senza aggregato approccio mai Z-)
Vector3d vtEscape = vtTool ;
if ( ( m_bAboveHead && ! m_bAggrBottom && ! m_bTiltingTab && vtTool.z < -EPS_SMALL) ||
@@ -2340,13 +2359,17 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
}
double dNewStElev ;
if ( GetElevation( m_nPhase, ptP1 + vtWkTip, vtTool, GetRadiusForStartEndElevation(), vtEscape, dNewStElev))
dStElev = min( dStElev, dNewStElev) ;
dStElev = min( dStElev, max( dNewStElev - dExtraLen, 0.)) ;
// se testa sopra, determino se l'inizio dell'attacco è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione
bool bAhUnderStart = m_bAboveHead && GetAhPointUnderRaw( ptP1 + vtWkTip, vtTool, 0, GetRadiusForStartEndElevation(),
m_TParams.m_dLen, false, dSafeZ, vtEscape, dStElev) ;
if ( bAhUnderStart)
dStElev = max( dStElev - dExtraLen, 0.) ;
// se testa sotto, determino se l'inizio dell'attacco è esattamente sopra il grezzo, nel qual caso ricalcolo l'elevazione
bool bUhAboveStart = ! m_bAboveHead && GetUhPointAboveRaw( ptP1 + vtWkTip, vtTool, 0, GetRadiusForStartEndElevation(),
m_TParams.m_dLen, false, dSafeZ, vtEscape, dStElev) ;
if ( bUhAboveStart)
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) ;
@@ -2361,7 +2384,7 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
// altrimenti, approccio per lame e frese che non lavorano di testa
else {
// verifico di entrare in aria
if ( ! bOutStart) {
if ( ! ( bOutStart || m_bStartOutRaw)) {
// verifico se sono sotto
double dSawStartElev = 0 ;
bool bAhUnderStart = false ;
@@ -2433,6 +2456,9 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
}
// imposto versore correzione e ausiliario sul punto di arrivo
CalcAndSetCorrAuxDir( pCompo, i + 1, false, true) ;
// se richiesto, imposto indice entità
if ( bIndex)
SetIndex( i + 1) ;
// elaborazioni sulla curva corrente
if ( pCurve->GetType() == CRV_LINE) {
ICurveLine* pLine = GetCurveLine( pCurve) ;
@@ -2473,13 +2499,17 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
}
// se ultima entità, uscita e retrazione
if ( i == nMaxInd) {
// reset index
SetIndex( 0) ;
// dati fine entità
Point3d ptEnd ;
pCurve->GetEndPoint( ptEnd) ;
Vector3d vtEnd = m_vtEndDir ;
// elevazione sul punto finale
double dEndElev ;
if ( ! GetElevation( m_nPhase, ptEnd + vtWkTip, vtTool, GetRadiusForStartEndElevation(), vtTool, dEndElev))
if ( GetElevation( m_nPhase, ptEnd + vtWkTip, vtTool, GetRadiusForStartEndElevation(), vtTool, dEndElev))
dEndElev = max( dEndElev - dExtraLen, 0.) ;
else
dEndElev = dElev ;
// aggiungo uscita
Point3d ptP1 ;
@@ -2493,10 +2523,14 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
Vector3d vtRetr( vtTool.x, vtTool.y, 0) ;
if ( ! vtRetr.Normalize())
vtRetr = FromNearestHorizontalOrtho( vtTool, vtDir1) ;
bool bOutEnd = GetPointOutOfRaw( ptP1 + vtWkTip, vtTool, vtRetr, dEndElev, dSafeZ) ;
bool bOutEnd = GetPointOutOfRaw( ptP1 + vtWkTip, vtTool, vtRetr, dSafeZ) ;
// se richiesto rapido quando fuori e sono già in aria
if ( bRapidOnOut && bOutEnd) {
// non devo fare alcunché
}
// aggiungo retrazione per frese normali e frese che non lavorano di testa già fuori
if ( ( m_TParams.m_nType & TF_MILL) != 0 &&
( m_TParams.m_nType != TT_MILL_NOTIP || m_bEndOutRaw)) {
else if ( ( m_TParams.m_nType & TF_MILL) != 0 &&
( m_TParams.m_nType != TT_MILL_NOTIP || m_bEndOutRaw)) {
// determino se la fine dell'uscita è sopra il grezzo
bool bAboveEnd = false ;
if ( m_bAboveHead) {
@@ -2504,7 +2538,7 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
bAboveEnd = GetPointAboveRaw( ptP1 + vtWkTip, vtTool) ;
else {
Vector3d vtCorr = CalcCorrDir( pCompo, nMaxInd + 1, false, true) ;
if ( GetPointOutOfRaw( ptP1 + vtWkTip, vtTool, vtCorr, dEndElev, dSafeZ))
if ( GetPointOutOfRaw( ptP1 + vtWkTip, vtTool, vtCorr, dSafeZ))
dEndElev = min( dEndElev, dElev) ;
}
}
@@ -2517,13 +2551,17 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
}
double dNewEndElev ;
if ( GetElevation( m_nPhase, ptP1 + vtWkTip, vtTool, GetRadiusForStartEndElevation(), vtEscape, dNewEndElev))
dEndElev = min( dEndElev, dNewEndElev) ;
dEndElev = min( dEndElev, max( dNewEndElev - dExtraLen, 0.)) ;
// se testa sopra, determino se l'inizio dell'uscita è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione
bool bAhUnderEnd = m_bAboveHead && GetAhPointUnderRaw( ptP1 + vtWkTip, vtTool, 0, GetRadiusForStartEndElevation(),
m_TParams.m_dLen, false, dSafeZ, vtEscape, dEndElev) ;
if ( bAhUnderEnd)
dEndElev = max( dEndElev - dExtraLen, 0.) ;
// se testa sotto, determino se l'inizio dell'uscita è esattamente sopra il grezzo, nel qual caso ricalcolo l'elevazione
bool bUhAboveEnd = ! m_bAboveHead && GetUhPointAboveRaw( ptP1 + vtWkTip, vtTool, 0, GetRadiusForStartEndElevation(),
m_TParams.m_dLen, false, dSafeZ, vtEscape, dEndElev) ;
if ( bUhAboveEnd)
dEndElev = max( dEndElev - dExtraLen, 0.) ;
// aggiungo retrazione
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dExtrAppr, bAboveEnd, bSplitArcs)) {
m_pMchMgr->SetLastError( 2312, "Error in Milling : Retract not computable") ;
@@ -2532,7 +2570,7 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
}
// per lame e frese che non lavorano di testa quando è necessario
else {
if ( ! bOutEnd) {
if ( ! ( bOutEnd || m_bEndOutRaw)) {
// verifico se sono sopra
bool bGeomAboveEnd = GetPointAboveRaw( ptP1 + vtWkTip, vtTool) ;
// verifico se sono sotto
@@ -2601,8 +2639,8 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
double dOkStep, bool bStepUp, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable)
{
// recupero distanze di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeAggrBottZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeAggrBottZ() ;
double dSafeZ = GetSafeZ() ;
double dSafeAggrBottZ = GetSafeAggrBottZ() ;
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
double dExtrAppr = dAppr + max( 0.0, m_TParams.m_dTLen - m_TParams.m_dLen) ;
@@ -2631,7 +2669,6 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
AdjustOscillParams( pCompo, bPathOscEnable, dOscRampLen, dOscFlatLen) ;
// altri dati del percorso
bool bClosed = pCompo->IsClosed() ;
int nMaxInd = pCompo->GetCurveCount() - 1 ;
// ciclo sugli step
@@ -2674,7 +2711,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
Vector3d vtAppr( vtTool.x, vtTool.y, 0) ;
if ( ! vtAppr.Normalize())
vtAppr = FromNearestHorizontalOrtho( vtTool, vtDir1) ;
bool bOutStart = GetPointOutOfRaw( ptP1, vtTool, vtAppr, dStElev, dSafeZ) ;
bool bOutStart = GetPointOutOfRaw( ptP1, vtTool, vtAppr, dSafeZ) ;
// determino se l'inizio dell'attacco è sopra il grezzo
bool bGeomAboveStart = GetPointAboveRaw( ptP1, vtTool) ;
bool bAboveStart = false ;
@@ -2886,7 +2923,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
Vector3d vtRetr( vtTool.x, vtTool.y, 0) ;
if ( ! vtRetr.Normalize())
vtRetr = FromNearestHorizontalOrtho( vtTool, vtDir1) ;
bool bOutEnd = GetPointOutOfRaw( ptP1, vtTool, vtRetr, dEndElev, dSafeZ) ;
bool bOutEnd = GetPointOutOfRaw( ptP1, vtTool, vtRetr, dSafeZ) ;
// per lame e frese che non lavorano di testa quando ancora dentro aggiungo retrazione se necessaria
if ( ( m_TParams.m_nType & TF_SAWBLADE) != 0 ||
( m_TParams.m_nType == TT_MILL_NOTIP && ! m_bEndOutRaw && ! bOutEnd)) {
@@ -2933,8 +2970,9 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
m_pMchMgr->SetLastError( 2324, "Error in Milling : LeadOut must be out of rawpart") ;
bOk = false ;
}
// aggiungo opportuna retrazione
if ( ! AddSawBladeSideRetract( ptP1, vtRetr, vtTool, dSafeZ, dSawEndElev, dEndElev, dAppr)) {
// se finale oppure dentro il materiale, aggiungo opportuna retrazione
if ( ( k == nStep || ! bUnderEnd) &&
! AddSawBladeSideRetract( ptP1, vtRetr, vtTool, dSafeZ, dSawEndElev, dEndElev, dAppr)) {
m_pMchMgr->SetLastError( 2312, "Error in Milling : Retract not computable") ;
return false ;
}
@@ -2949,7 +2987,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
bAboveEnd = GetPointAboveRaw( ptP1, vtTool) ;
else {
Vector3d vtCorr = CalcCorrDir( pCompo, ( bInvert ? 0 : nMaxInd + 1), false, true) ;
if ( GetPointOutOfRaw( ptP1, vtTool, vtCorr, dElev, dSafeZ))
if ( GetPointOutOfRaw( ptP1, vtTool, vtCorr, dSafeZ))
dEndElev = min( dEndElev, dElev) ;
}
}
@@ -2987,8 +3025,8 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
double dOkStep, bool bStepUp, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable)
{
// recupero distanze di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeAggrBottZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeAggrBottZ() ;
double dSafeZ = GetSafeZ() ;
double dSafeAggrBottZ = GetSafeAggrBottZ() ;
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
double dExtrAppr = dAppr + max( 0.0, m_TParams.m_dTLen - m_TParams.m_dLen) ;
@@ -3050,8 +3088,9 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
bAhAboveStartEnd = GetPointAboveRaw( ptPs, vtTool) && GetPointAboveRaw( ptPe, vtTool) ;
else
bUhBelowStartEnd = GetPointBelowRaw( ptPs, vtTool) && GetPointBelowRaw( ptPe, vtTool) ;
// verifico se collegamento diretto tra inizio e uscita è fuori dal grezzo
bool bSafeDirLinkStartEnd = ( bAhAboveStartEnd || bUhBelowStartEnd) ;
// verifico se collegamento diretto tra ingresso e uscita è fuori dal grezzo
bool bSafeDirLinkStartEnd = ( bAhAboveStartEnd || bUhBelowStartEnd ||
( ! bMidRetract && m_bStartOutRaw && m_bEndOutRaw)) ;
if ( ! bSafeDirLinkStartEnd) {
// verifica dei punti intermedi
bool bIsOut = true ;
@@ -3062,7 +3101,8 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
Vector3d vtCm = Media( vtCs, vtCe, dCoeff) ;
if ( ! vtCm.Normalize())
vtCm = vtCs ;
if ( ! GetSimplePointOutOfRaw( ptPm, vtTool, vtCm)) {
if ( ! GetSimplePointOutOfRaw( ptPm, vtTool, vtCm) &&
( m_TParams.m_nType == TT_MILL_STD || ! GetSimplePointOutOfRaw( ptPm, vtTool, vtTool))) {
bIsOut = false ;
break ;
}
@@ -3087,6 +3127,7 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
if ( pCompo->GetParamAtLength( m_Params.m_dLiTang, dU)) {
const_cast<ICurveComposite*>( pCompo)->ChangeStartPoint( dU) ;
const_cast<ICurveComposite*>( pCompo)->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL, false) ;
VerifyArcs( const_cast<ICurveComposite*>( pCompo)) ;
}
}
// ciclo sulle curve elementari
@@ -3133,7 +3174,7 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
Vector3d vtAppr( vtTool.x, vtTool.y, 0) ;
if ( ! vtAppr.Normalize())
vtAppr = FromNearestHorizontalOrtho( vtTool, vtDir1) ;
bool bOutStart = GetPointOutOfRaw( ptP1, vtTool, vtAppr, dStElev, dSafeZ) ;
bool bOutStart = GetPointOutOfRaw( ptP1, vtTool, vtAppr, dSafeZ) ;
// aggiungo approccio per frese normali e frese che non lavorano di testa con attacco opportuno oppure fuori
if ( ( m_TParams.m_nType & TF_MILL) != 0 &&
( m_TParams.m_nType != TT_MILL_NOTIP || LeadInRawIsOk() || m_bStartOutRaw)) {
@@ -3238,7 +3279,7 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
// aggiungo opportuno approccio
if ( ! AddSawBladeSideApproach( ptP1, vtAppr, vtTool, dSafeZ, dSawStartElev, dStElev, dAppr,
k == 1, bSplitArcs, bAddInsert)) {
k == 1, bSplitArcs, bAddInsert && bMidRetract)) {
m_pMchMgr->SetLastError( 2309, "Error in Milling : Approach not computable") ;
return false ;
}
@@ -3312,7 +3353,7 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
// se ultima entità, uscita e retrazione
if ( i == nMaxInd) {
// se speciale e step intermedio salto uscita e retrazione
if ( bSpecial && j != nStep)
if ( bSpecial && k != nStep)
continue ;
// dati fine entità
Point3d ptEnd ;
@@ -3334,12 +3375,12 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
return false ;
}
// se step finale o intermedi con retrazione
if ( j == nStep || bMidRetract) {
if ( k == nStep || bMidRetract || ! bSafeDirLinkStartEnd) {
// determino se la fine dell'uscita è fuori dal grezzo
Vector3d vtRetr( vtTool.x, vtTool.y, 0) ;
if ( ! vtRetr.Normalize())
vtRetr = FromNearestHorizontalOrtho( vtTool, vtDir1) ;
bool bOutEnd = GetPointOutOfRaw( ptP1, vtTool, vtRetr, dEndElev, dSafeZ) ;
bool bOutEnd = GetPointOutOfRaw( ptP1, vtTool, vtRetr, dSafeZ) ;
// aggiungo retrazione per frese normali e frese che non lavorano di testa già fuori
if ( ( m_TParams.m_nType & TF_MILL) != 0 &&
( m_TParams.m_nType != TT_MILL_NOTIP || m_bEndOutRaw)) {
@@ -3426,7 +3467,7 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
bOk = false ;
}
// aggiungo opportuna retrazione
if ( ! AddSawBladeSideRetract( ptP1, vtRetr, vtTool, dSafeZ, dSawEndElev, dEndElev, dAppr, bAddExtract)) {
if ( ! AddSawBladeSideRetract( ptP1, vtRetr, vtTool, dSafeZ, dSawEndElev, dEndElev, dAppr, bAddExtract && bMidRetract)) {
m_pMchMgr->SetLastError( 2312, "Error in Milling : Retract not computable") ;
return false ;
}
@@ -3451,8 +3492,8 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
double dDepth, double dElev, double dOkStep, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable)
{
// recupero distanze di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeAggrBottZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeAggrBottZ() ;
double dSafeZ = GetSafeZ() ;
double dSafeAggrBottZ = GetSafeAggrBottZ() ;
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
double dExtrAppr = dAppr + max( 0.0, m_TParams.m_dTLen - m_TParams.m_dLen) ;
@@ -3516,7 +3557,7 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
return false ;
// determino se l'inizio dell'attacco è fuori dal grezzo
Vector3d vtCorr = CalcCorrDir( pCompo, i) ;
bool bOutStart = GetPointOutOfRaw( ptP1, vtTool, vtCorr, dElev, dSafeZ) ;
bool bOutStart = GetPointOutOfRaw( ptP1, vtTool, vtCorr, dSafeZ) ;
// determino se l'inizio dell'attacco è sopra il grezzo
bool bAboveStart = m_bAboveHead && GetPointAboveRaw( ptP1, vtTool) ;
// imposto versore correzione e ausiliario sul punto di partenza
@@ -3704,7 +3745,7 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
return false ;
// determino se l'inizio dell'attacco è fuori dal grezzo
Vector3d vtCorr = CalcCorrDir( pCompo, ( bInvert ? nMaxInd - i + 1 : i)) ;
bool bOutStart = GetPointOutOfRaw( ptP1, vtTool, vtCorr, dElev, dSafeZ) ;
bool bOutStart = GetPointOutOfRaw( ptP1, vtTool, vtCorr, dSafeZ) ;
// determino se l'inizio dell'attacco è sopra il grezzo
bool bAboveStart = m_bAboveHead && GetPointAboveRaw( ptP1, vtTool) ;
// imposto versore correzione e ausiliario sul punto di partenza
@@ -3879,12 +3920,7 @@ Milling::AddSawZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtT
double dDepth, double dElev, double dOkStep, bool bSplitArcs)
{
// recupero distanze di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeAggrBottZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeAggrBottZ() ;
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
// flag di percorso chiuso
bool bClosed = pCompo->IsClosed() ;
double dSafeZ = GetSafeZ() ;
// recupero eventuale superficie trimesh chiusa per trim/extend
int nTriExtCstm = GDB_ID_NULL ;
@@ -3966,7 +4002,7 @@ Milling::AddSawZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtT
return false ;
// determino se l'inizio dell'attacco è fuori dal grezzo
Vector3d vtCorr = CalcCorrDir( pMyCompo, i, bInvert, true) ;
bool bOutStart = GetPointOutOfRaw( ptP1, vtTool, vtCorr, dElev, dSafeZ) ;
bool bOutStart = GetPointOutOfRaw( ptP1, vtTool, vtCorr, dSafeZ) ;
// determino se l'inizio dell'attacco è sopra il grezzo
bool bAboveStart = m_bAboveHead && GetPointAboveRaw( ptP1, vtTool) ;
// imposto versore correzione e ausiliario sul punto di partenza
@@ -4060,12 +4096,7 @@ Milling::AddSawOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtT
double dDepth, double dElev, double dOkStep, bool bSplitArcs)
{
// recupero distanze di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeAggrBottZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeAggrBottZ() ;
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
// flag di percorso chiuso
bool bClosed = pCompo->IsClosed() ;
double dSafeZ = GetSafeZ() ;
// recupero eventuale superficie trimesh chiusa per trim/extend
int nTriExtCstm = GDB_ID_NULL ;
@@ -4150,7 +4181,7 @@ Milling::AddSawOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtT
return false ;
// determino se l'inizio dell'attacco è fuori dal grezzo
Vector3d vtCorr = CalcCorrDir( pMyCompo, i, bReturn, true) ;
bool bOutStart = GetPointOutOfRaw( ptP1, vtTool, vtCorr, dElev, dSafeZ) ;
bool bOutStart = GetPointOutOfRaw( ptP1, vtTool, vtCorr, dSafeZ) ;
// determino se l'inizio dell'attacco è sopra il grezzo
bool bAboveStart = m_bAboveHead && GetPointAboveRaw( ptP1, vtTool) ;
// imposto versore correzione e ausiliario sul punto di partenza
@@ -4259,26 +4290,40 @@ Milling::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ,
if ( m_bAggrBottom) {
// distanza dal bordo del pezzo (se negativa il punto è fuori dal grezzo)
double dDistBottom ;
if ( ! GetDistanceFromRawSide( m_nPhase, ptP, m_vtAggrBottom, dDistBottom))
if ( ! GetAggrBottDistanceFromRawSide( m_nPhase, ptP, m_vtAggrBottom, ( m_AggrBottom.dEncH + dSafeZ), dDistBottom))
dDistBottom = 0 ;
bBottomStart = ( dDistBottom < - 10 * EPS_SMALL) ;
// aggiuntivo in Z
double dAggZ = ( bBottomStart ? 0. : max( dElev + max( dSafeAggrBottZ, dAppr), 0.)) ;
// pre-approccio
Point3d ptP0 = ptP - Z_AX * dAggZ + m_vtAggrBottom * ( dDistBottom + m_AggrBottom.dEncH + dSafeZ) ;
Point3d ptP00 = ptP0 + Z_AX * ( m_AggrBottom.dEncV + m_TParams.m_dLen + dAggZ - dElev) ;
// se rinvio da sotto che richiede speciale rotazione
// se richiede speciale rotazione
if ( m_AggrBottom.nType == 1) {
// punto ruotato
Point3d ptP00 = ptP0 + Z_AX * ( m_AggrBottom.dEncV + m_TParams.m_dLen + dAggZ - dElev) ;
Vector3d vtAux = m_vtAggrBottom ;
vtAux.Rotate( Z_AX, 0, 1) ;
SetAuxDir( vtAux) ;
if ( AddRapidStartOrMove( ptP00, bFirst, bSplitArcs, MCH_CL_AGB_DWN) == GDB_ID_NULL)
return false ;
// vado al punto standard
SetAuxDir( m_vtAggrBottom) ;
SetFlag( 0) ;
if ( AddRapidMove( ptP0, bSplitArcs, MCH_CL_AGB_IN) == GDB_ID_NULL)
return false ;
}
// se altrimenti con rotazione per minimizzare la sporgenza
else if ( m_AggrBottom.nType == 3) {
// punto standard ruotato
Vector3d vtAux = m_vtAggrBottom ;
vtAux.Rotate( Z_AX, 0, 1) ;
SetAuxDir( vtAux) ;
if ( AddRapidStartOrMove( ptP0, bFirst, bSplitArcs, MCH_CL_AGB_IN) == GDB_ID_NULL)
return false ;
// la rotazione viene eseguita nel movimento successivo al punto sopra l'inizio lavorazione
SetAuxDir( m_vtAggrBottom) ;
SetFlag( 0) ;
}
// altrimenti rinvio normale
else {
SetAuxDir( m_vtAggrBottom) ;
@@ -4372,7 +4417,7 @@ Milling::AddSawBladeSideApproach( const Point3d& ptP, const Vector3d& vtAppr, co
GetRadiusForStartEndElevation( false),
m_TParams.m_dLen, true, dSafeZ, vtMove, dExtraElev)) {
Point3d ptP1e = ptP1a + vtMove * ( dExtraElev + dSafeZ) ;
if ( bAddInsert) {
if ( bAddInsert && ! AreSameVectorEpsilon( vtMove, vtTool, LIM_SIN_DIFF_DIR)) {
Point3d ptInsert = ptP1e + ( dStElev + dSafeZ) * vtTool ;
if ( AddRapidStartOrMove( ptInsert, bFirst, bSplitArcs) == GDB_ID_NULL)
return false ;
@@ -4394,7 +4439,7 @@ Milling::AddSawBladeSideApproach( const Point3d& ptP, const Vector3d& vtAppr, co
GetRadiusForStartEndElevation( false),
m_TParams.m_dLen, true, dSafeZ, vtMove, dExtraElev)) {
Point3d ptP1e = ptP1a + vtMove * ( dExtraElev + dSafeZ) ;
if ( bAddInsert) {
if ( bAddInsert && ! AreSameVectorEpsilon( vtMove, vtTool, LIM_SIN_DIFF_DIR)) {
Point3d ptInsert = ptP1e + ( dStElev + dSafeZ) * vtTool ;
if ( AddRapidStartOrMove( ptInsert, bFirst, bSplitArcs) == GDB_ID_NULL)
return false ;
@@ -4414,7 +4459,7 @@ Milling::AddSawBladeSideApproach( const Point3d& ptP, const Vector3d& vtAppr, co
}
// punto fuori inizio
if ( bOutStart) {
if ( bAddInsert) {
if ( bAddInsert && ! AreSameVectorEpsilon( vtAppr, vtTool, LIM_SIN_DIFF_DIR)) {
Point3d ptInsert = ptP1a + ( dStElev + dSafeZ) * vtTool ;
if ( AddRapidStartOrMove( ptInsert, bFirst, bSplitArcs) == GDB_ID_NULL)
return false ;
@@ -4475,7 +4520,7 @@ Milling::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ,
double dDistBottom ;
if ( m_bAggrBottom) {
// distanza dal bordo del pezzo (se negativa il punto è fuori dal grezzo)
if ( ! GetDistanceFromRawSide( m_nPhase, ptP, m_vtAggrBottom, dDistBottom))
if ( ! GetAggrBottDistanceFromRawSide( m_nPhase, ptP, m_vtAggrBottom, ( m_AggrBottom.dEncH + dSafeZ), dDistBottom))
dDistBottom = 0 ;
bBottomOutStart = ( dDistBottom < - 10 * EPS_SMALL) ;
}
@@ -4529,15 +4574,22 @@ Milling::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ,
}
// se con aggregato da sotto
if ( m_bAggrBottom) {
// se con rotazione per minimizzare la sporgenza
if ( m_AggrBottom.nType == 3) {
// imposto rotazione su punto standard
Vector3d vtAux = m_vtAggrBottom ;
vtAux.Rotate( Z_AX, 0, 1) ;
SetAuxDir( vtAux) ;
}
// aggiuntivo in Z
double dAggZ = ( bBottomOutStart ? 0. : max( dElev + max( dSafeAggrBottZ, dAppr), 0.)) ;
// post-retract
Point3d ptP0 = ptP - Z_AX * dAggZ + m_vtAggrBottom * ( dDistBottom + m_AggrBottom.dEncH + dSafeZ) ;
Point3d ptP00 = ptP0 + Z_AX * ( m_AggrBottom.dEncV + m_TParams.m_dLen + dAggZ - dElev) ;
if ( AddRapidMove( ptP0, bSplitArcs, MCH_CL_AGB_OUT) == GDB_ID_NULL)
return false ;
// se rinvio da sotto che richiede speciale rotazione
if ( m_AggrBottom.nType == 1) {
Point3d ptP00 = ptP0 + Z_AX * ( m_AggrBottom.dEncV + m_TParams.m_dLen + dAggZ - dElev) ;
Vector3d vtAux = m_vtAggrBottom ;
vtAux.Rotate( Z_AX, 0, 1) ;
SetAuxDir( vtAux) ;
@@ -4570,15 +4622,18 @@ Milling::AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, con
}
// se necessaria ulteriore uscita
Vector3d vtMove ;
double dMove = 0 ;
if ( ! m_bTiltingTab) {
Vector3d vtMove = Vector3d( vtTool.x, vtTool.y, 0) ;
vtMove = Vector3d( vtTool.x, vtTool.y, 0) ;
if ( vtMove.Normalize()) {
if ( m_bAboveHead && vtRetr.z < LIM_DOWN_APPRZ) {
double dExtraElev ;
if ( GetAhPointUnderRaw( ptP4, vtTool, m_TParams.m_dTDiam / 2,
GetRadiusForStartEndElevation( false),
m_TParams.m_dLen, true, dSafeZ, vtMove, dExtraElev)) {
Point3d ptP4b = ptP4 + vtMove * ( dExtraElev + dSafeZ) ;
dMove = dExtraElev + dSafeZ ;
Point3d ptP4b = ptP4 + vtMove * dMove ;
if ( AddRapidMove( ptP4b) == GDB_ID_NULL)
return false ;
}
@@ -4588,7 +4643,8 @@ Milling::AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, con
if ( GetUhPointAboveRaw( ptP4, vtTool, m_TParams.m_dTDiam / 2,
GetRadiusForStartEndElevation( false),
m_TParams.m_dLen, true, dSafeZ, vtMove, dExtraElev)) {
Point3d ptP4b = ptP4 + vtMove * ( dExtraElev + dSafeZ) ;
dMove = dExtraElev + dSafeZ ;
Point3d ptP4b = ptP4 + vtMove * dMove ;
if ( AddRapidMove( ptP4b) == GDB_ID_NULL)
return false ;
}
@@ -4596,11 +4652,12 @@ Milling::AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, con
}
}
if ( bAddExtract) {
if ( bAddExtract && ! AreSameVectorEpsilon( vtRetr, vtTool, LIM_SIN_DIFF_DIR) &&
( ! AreSameVectorEpsilon( vtMove, vtTool, LIM_SIN_DIFF_DIR) || dEndElev + dSafeZ > dMove + 10 * EPS_SMALL)) {
Point3d ptCurr ;
if ( ! GetCurrPos( ptCurr))
return false ;
Point3d ptExtract = ptCurr + ( dEndElev + dSafeZ) * vtTool ;
Point3d ptExtract = ptCurr + ( dEndElev + dSafeZ - dMove) * vtTool ;
if ( AddRapidMove( ptExtract) == GDB_ID_NULL)
return false ;
}
@@ -5678,7 +5735,7 @@ Milling::CalcTabsPositions( const ICurveComposite* pCompo, double dDepth, bool b
// inizializzo intervallo valido (non sono ammessi tab a cavallo di inizio/fine)
ivTabs.Set( 0, dLen - dTabLen) ;
// elimino le zone con piccolo raggio e quelle vicine agli angoli
const double RAD_MIN = 100 ;
const double RAD_MIN = 50 ;
const double CORNER_RAG = 2 ;
const double CORNER_ANG = 5 ;
const double CORNER_DIST = 2 ;
@@ -6184,15 +6241,16 @@ Milling::GetRadiusForStartEndElevation( bool bExtra) const
//----------------------------------------------------------------------------
bool
Milling::GetSimplePointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtCorr) const
Milling::GetSimplePointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtRetr) const
{
// per frese che lavorano di testa
if ( m_TParams.m_nType == TT_MILL_STD) {
// eseguo verifica in direzione utensile
double dToolRad = m_TParams.m_dTDiam / 2 ;
double dToolLen = m_TParams.m_dMaxMat ;
double dToolDeltaLen = m_TParams.m_dTLen - m_TParams.m_dLen ;
double dTemp ;
if ( ! GetElevation( m_nPhase, ptP - ( dToolDeltaLen + MIN_SAFEDIST) * vtTool, vtTool, dToolRad + MIN_SAFEDIST, vtTool, dTemp))
if ( ! GetElevation( m_nPhase, ptP - dToolDeltaLen * vtTool, vtTool, dToolRad, dToolLen, MIN_SAFEDIST, vtTool, dTemp))
return false ;
return ( dTemp < 10 * EPS_SMALL) ;
}
@@ -6203,7 +6261,7 @@ Milling::GetSimplePointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, con
double dToolThick = ( m_TParams.m_nType == TT_MILL_NOTIP ? m_TParams.m_dMaxMat : m_TParams.m_dThick) ;
double dToolDeltaLen = m_TParams.m_dTLen - m_TParams.m_dLen ;
double dTemp ;
if ( ! GetElevation( m_nPhase, ptP - ( dToolDeltaLen + MIN_SAFEDIST) * vtTool, vtTool, dToolRad + MIN_SAFEDIST, dToolThick, vtCorr, dTemp))
if ( ! GetElevation( m_nPhase, ptP - dToolDeltaLen * vtTool, vtTool, dToolRad, dToolThick, MIN_SAFEDIST, vtRetr, dTemp))
return false ;
return ( dTemp < 10 * EPS_SMALL) ;
}
@@ -6211,33 +6269,28 @@ Milling::GetSimplePointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, con
//----------------------------------------------------------------------------
bool
Milling::GetPointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, double dSafeZ) const
Milling::GetPointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtRetr, double dSafeZ) const
{
// per frese normali
if ( m_TParams.m_nType == TT_MILL_STD) {
// determino se la posizione è fuori dal grezzo (considero movimento fresa lungo il suo asse)
double dTemp ;
if ( ! GetElevation( m_nPhase, ptP, vtTool, m_TParams.m_dTDiam / 2, vtTool, dTemp))
double dToolRad = m_TParams.m_dTDiam / 2 ;
double dToolLen = m_TParams.m_dMaxMat ;
if ( ! GetElevation( m_nPhase, ptP, vtTool, dToolRad, dToolLen, MIN_SAFEDIST, vtTool, dTemp))
return false ;
return ( dTemp < 10 * EPS_SMALL || dTemp > dElev + 10 * EPS_SMALL) ;
return ( dTemp < 10 * EPS_SMALL) ;
}
// per lame e frese che non lavorano di testa
else {
// determino se la posizione è fuori dal grezzo (considero movimento utensile in +/- Z)
double dTemp ;
Vector3d vtMove = ( m_bAboveHead ? Z_AX : -Z_AX) ;
Vector3d vtSafe = vtCorr ; vtSafe.z = 0 ; vtSafe.Normalize() ;
Point3d ptQ = ptP - ( vtSafe + vtMove) * max( 0.2 * dSafeZ, MIN_SAFEDIST) ;
double dToolRad = m_TParams.m_dDiam / 2 ;
Vector3d vtSafe = vtRetr ; vtSafe.z = 0 ; vtSafe.Normalize() ;
double dToolRad = m_TParams.m_dTDiam / 2 ;
double dToolLen = ( ( m_TParams.m_nType & TF_SAWBLADE) != 0 ? m_TParams.m_dThick : m_TParams.m_dMaxMat) ;
bool bOut = true ;
if ( ! GetElevation( m_nPhase, ptQ, vtTool, dToolRad, dToolLen, vtMove, dTemp) || dTemp > 10 * EPS_SMALL) {
bOut = false ;
if ( ! m_bTiltingTab)
return false ;
}
Point3d ptR = ptP + vtTool * dToolLen ;
if ( ! GetElevation( m_nPhase, ptR, vtTool, dToolRad, dToolLen, vtMove, dTemp) || dTemp > 10 * EPS_SMALL) {
if ( ! GetElevation( m_nPhase, ptP, vtTool, dToolRad, dToolLen, MIN_SAFEDIST, vtMove, dTemp) || dTemp > 10 * EPS_SMALL) {
bOut = false ;
if ( ! m_bTiltingTab)
return false ;
@@ -6245,9 +6298,7 @@ Milling::GetPointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, const Vec
// se tavola basculante (o asse ralla) e non esterno, provo in direzione utensile
if ( m_bTiltingTab && ! bOut) {
vtMove = vtTool ;
if ( ! GetElevation( m_nPhase, ptQ, vtTool, dToolRad, dToolLen, vtMove, dTemp) || dTemp > 10 * EPS_SMALL)
return false ;
if ( ! GetElevation( m_nPhase, ptR, vtTool, dToolRad, dToolLen, vtMove, dTemp) || dTemp > 10 * EPS_SMALL)
if ( ! GetElevation( m_nPhase, ptP, vtTool, dToolRad, dToolLen, MIN_SAFEDIST, vtMove, dTemp) || dTemp > 10 * EPS_SMALL)
return false ;
}
return true ;
+2 -2
View File
@@ -124,8 +124,8 @@ class Milling : public Machining
bool AddTabsLine( const ICurveLine* pLine, const Vector3d& vtTool, const DBLVECTOR& vdTabs, const TabData& tdTabs) ;
bool AddTabsArc( const ICurveArc* pArc, const Vector3d& vtTool, const DBLVECTOR& vdTabs, const TabData& tdTabs) ;
double GetRadiusForStartEndElevation( bool bExtra = true) const ;
bool GetSimplePointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtCorr) const ;
bool GetPointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, double dSafeZ) const ;
bool GetSimplePointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtRetr) const ;
bool GetPointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtRetr, double dSafeZ) const ;
bool GetPointAboveRaw( const Point3d& ptP, const Vector3d& vtTool) const ;
bool GetPointBelowRaw( const Point3d& ptP, const Vector3d& vtTool) const ;
bool CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU, bool bInvertSide = false, bool bSawSpecial = false) ;
+2 -2
View File
@@ -1016,7 +1016,7 @@ Mortising::GetCurve( SelData Id)
else
nToolDir = TOOL_PAR_SLANT ;
int nFaceUse = ( m_Params.m_nFaceUse & 31) ;
AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, m_TParams.m_dThick, 2) ;
AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, V_NULL, m_TParams.m_dThick, 2) ;
// la restituisco
return Release( pCrvCompo) ;
}
@@ -1557,7 +1557,7 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
double dDelta = dElev - dDepth ;
// determino se l'inizio dell'attacco è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() + m_pMchMgr->GetDeltaSafeZ( m_TParams.m_sHead) ;
double dSafeZ = GetSafeZ() + GetDeltaSafeZ( vtTool) ;
double dStartElev = 0 ;
Point3d ptLi = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * dDelta ;
bool bUnderStart = GetAhPointUnderRaw( ptLi, vtTool, 0,
+584 -226
View File
File diff suppressed because it is too large Load Diff
+59 -6
View File
@@ -17,6 +17,7 @@
#include "MachMgr.h"
#include "MachConst.h"
#include "MachineStruConst.h"
#include "CamData.h"
#include "/EgtDev/Include/EGkPoint3d.h"
#include "/EgtDev/Include/EGkUserObj.h"
#include "/EgtDev/Include/EGkSelection.h"
@@ -65,17 +66,50 @@ class Operation : public IUserObj
{ return ( bSplit && ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrIsRobot())) ; }
virtual double GetMaxSplitLen( bool bSplit = true, bool bFeed = true) const
{ return ( bSplit && ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrIsRobot()) ? ( bFeed ? 5 : 50) : 0) ; }
virtual double GetSafeZ( void) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return 100 ; // MF_CURR_SAFEZ in MachiningsMgr
return m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ; }
virtual double GetSafeAggrBottZ( void) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return 10 ; // MF_CURR_SAFEAGGRBOTTZ in MachiningsMgr
return m_pMchMgr->GetCurrMachiningsMgr()->GetSafeAggrBottZ() ; }
virtual double GetExtraLOnCutRegion( void) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return 0 ; // MF_CURR_EXTRALCR in MachiningsMgr
return m_pMchMgr->GetCurrMachiningsMgr()->GetExtraLOnCutRegion() ; }
virtual double GetExtraROnDrillRegion( void) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return 0 ; // MF_CURR_EXTRARDR in MachiningsMgr
return m_pMchMgr->GetCurrMachiningsMgr()->GetExtraROnDrillRegion() ; }
virtual double GetHoleDiamToler( void) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return 10 * EPS_SMALL ; // MF_CURR_HOLEDTOL in MachiningsMgr
return m_pMchMgr->GetCurrMachiningsMgr()->GetHoleDiamToler() ; }
virtual double GetExtSawArcMinRad( void) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return 200 ; // MF_CURR_EXTSAWARCMINRAD in MachiningsMgr
return m_pMchMgr->GetCurrMachiningsMgr()->GetExtSawArcMinRad() ; }
virtual double GetIntSawArcMaxSideAng( void) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return 45 ; // MF_CURR_INTSAWARCMAXSIDEANG in MachiningsMgr
return m_pMchMgr->GetCurrMachiningsMgr()->GetIntSawArcMaxSideAng() ; }
virtual bool GetSplitArcs( const Vector3d& vtTool) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrIsRobot())
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrIsRobot() ||
m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return true ;
int nSplitArcs = m_pMchMgr->GetCurrMachiningsMgr()->GetSplitArcs() ;
return ( nSplitArcs == SPLAR_ALWAYS ||
( nSplitArcs == SPLAR_NO_XY_PLANE && ! vtTool.IsZplus()) ||
( nSplitArcs == SPLAR_GEN_PLANE && vtTool.IsGeneric())) ; }
virtual double GetApproxLinTol( void) const
{ if ( m_pMchMgr == nullptr)
return 50 * EPS_SMALL ;
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return 50 * EPS_SMALL ; // MF_APPROX_LINTOL in MachiningsMgr
return m_pMchMgr->GetCurrMachiningsMgr()->GetApproxLinTol() ; }
virtual double GetMaxDepthSafe( void) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return 2 ; // MF_CURR_MAXDEPTHSAFE in MachiningsMgr
return m_pMchMgr->GetCurrMachiningsMgr()->GetMaxDepthSafe() ; }
protected :
Operation( void) ;
@@ -98,6 +132,8 @@ class Operation : public IUserObj
const Vector3d& vtDir, double& dElev) const ;
bool GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool, double dRad, double dLen,
const Vector3d& vtDir, double& dElev) const ;
bool GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool, double dRad, double dLen, double dSafeDist,
const Vector3d& vtDir, double& dElev) const ;
bool GetElevation( int nPhase, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtTool, double dRad, double dLen,
const Vector3d& vtDir, double& dElev) const ;
bool GetAhPointUnderRaw( const Point3d& ptP, const Vector3d& vtTool, double dToolRad, double dToolRadForElev,
@@ -105,6 +141,7 @@ class Operation : public IUserObj
bool GetUhPointAboveRaw( const Point3d& ptP, const Vector3d& vtTool, double dToolRad, double dToolRadForElev,
double dToolLen, bool bIsSaw, double dSafeZ, const Vector3d& vtDir, double& dElev) const ;
bool GetDistanceFromRawSide( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist) const ;
bool GetAggrBottDistanceFromRawSide( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double dEncSafeH, double& dDist) const ;
bool GetMinDistanceFromRawSide( int nPhase, const Point3d& ptP, double dExpand,
double& dDist, Vector3d& vtDir) const ;
bool GetMinDistanceFromRawSide( int nPhase, const Point3d& ptP, double dExpand,
@@ -118,7 +155,8 @@ class Operation : public IUserObj
bool GetRawGlobBox( int nPhase, const BBox3d& b3Test, double dToler, BBox3d& b3Raw) const ;
bool GetCurrRawsGlobBox( BBox3d& b3Raw) const ;
bool AdjustCurveFromSurf( ICurveComposite* pCrvCompo, int nToolDir, int nFaceUse, double dToolThick, int nGrade = 3) ;
bool AdjustCurveFromSurf( ICurveComposite* pCrvCompo, int nToolDir, int nFaceUse, const Vector3d& vtFaceUse,
double dToolThick, int nGrade = 3) ;
bool ApproxWithArcsIfUseful( ICurveComposite* pCompo, bool bCareTempProp = false) const ;
bool ApproxWithLines( ICurveComposite* pCompo, bool bFeed = true) const ;
bool VerifyArcs( ICurveComposite* pCompo, double dMaxAngCen = MAX_ANG_CEN) const ;
@@ -150,6 +188,12 @@ class Operation : public IUserObj
bool CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC) ;
bool CalculateRotAxesValues( bool bFirst, const Vector3d& vtTool, const Vector3d& vtAux,
double dRot1W, bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
const DBLVECTOR& vAxRotHome, const DBLVECTOR& vAxRotPrec, DBLVECTOR& vAxRot) ;
bool VerifyLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec, const Vector3d& vtAuxPrec, const Vector3d& vtCorrPrec, const DBLVECTOR& vAxPrec,
const Point3d& ptP, const Vector3d& vtDir, const Vector3d& vtAux, const Vector3d& vtCorr, const DBLVECTOR& vAxVal,
int nCnt, int nEntId, double dRot1W, int nMoveType, bool& bAdded, bool& bAxError) ;
bool CalculateClPathRobotAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec) ;
@@ -175,6 +219,7 @@ class Operation : public IUserObj
bool GetRotationAtZmax( void) const ;
bool ForcedZmax( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, const BBox3d& b3Raws) const ;
int GetUserNotesZmax( void) const ;
double GetDeltaSafeZ( const Vector3d& vtTool) const ;
bool GetZHomeDown( void) const ;
bool TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ;
int SpecialTestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ;
@@ -184,6 +229,12 @@ class Operation : public IUserObj
bool GetAggrBottomData( const std::string& sHead, AggrBottom& agbData) const ;
bool IsAggrBottom( const std::string& sHead) const ;
private :
bool GetAxisMidForTestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nAxisOrder, Machine* pMch,
DBLVECTOR& vAxMid) const ;
bool OneMoveTestCollisionAvoid( const STRVECTOR& vAxName, const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd,
Machine* pMch, const INTVECTOR& vRawId, const INTVECTOR& vFxtId) const ;
protected :
int m_nOwnerId ; // identificativo dell'oggetto geometrico possessore
IGeomDB* m_pGeomDB ; // puntatore al DB geometrico
@@ -258,6 +309,8 @@ inline Operation* GetOperation( IUserObj* pUserObj)
// tipo posizione utensile
enum { TOOL_PARAL = 1, TOOL_ORTHO = 2, TOOL_ORTUP = 3, TOOL_PAR_SLANT= 4} ;
// tipo di utilizzo contorno faccia
enum { FACE_DOWN = 1, FACE_TOP = 2, FACE_FRONT = 3, FACE_BACK = 4, FACE_LEFT = 5, FACE_RIGHT = 6, FACE_CONT = 7} ;
enum { FACE_DOWN = 1, FACE_TOP = 2, FACE_FRONT = 3, FACE_BACK = 4, FACE_LEFT = 5, FACE_RIGHT = 6, FACE_CONT = 7, FACE_VERSOR = 8} ;
// risultato di SpecialTestCollisionAvoid
enum { SCAV_ERROR = -1, SCAV_COLLIDE = 0, SCAV_AVOID = 1, SCAV_TOTEST = 2};
enum { SCAV_ERROR = -1, SCAV_COLLIDE = 0, SCAV_AVOID = 1, SCAV_TOTEST = 2} ;
// ordine di movimento assi nei link
enum { LKAO_INTERP = 0, LKAO_HEAD_BEFORE = -1, LKAO_HEAD_AFTER = +1, LKAO_HEAD_BOTH = 11} ;
+9 -4
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2017-2019
// EgalTech 2017-2024
//----------------------------------------------------------------------------
// File : OperationConst.h Data : 08.07.19 Versione : 2.1g2
// File : OperationConst.h Data : 22.05.24 Versione : 2.6e5
// Contenuto : Costanti per le operazioni.
//
//
@@ -9,6 +9,7 @@
// Modifiche : 17.08.17 DS Creazione modulo.
// 25.05.19 DS Aggiunte SurfRoughing e SurfFinishing.
// 25.05.19 DS Aggiunta WaterJetting.
// 22.05.24 DS Aggiunta FiveAxisMilling.
//
//----------------------------------------------------------------------------
@@ -32,7 +33,8 @@ static const std::string s_OpeClass[] = {"",
"EMkChiseling",
"EMkSurfRoughing",
"EMkSurfFinishing",
"EMkWaterJetting"} ;
"EMkWaterJetting",
"EMkFiveAxisMilling"} ;
//----------------------------------------------------------------------------
// Dal tipo numerico restituisce la classe della operazione
@@ -53,6 +55,7 @@ GetOperationClass( int nOpeType)
case OPER_SURFROUGHING : return s_OpeClass[11] ;
case OPER_SURFFINISHING : return s_OpeClass[12] ;
case OPER_WATERJETTING : return s_OpeClass[13] ;
case OPER_FIVEAXISMILLING : return s_OpeClass[14] ;
}
return s_OpeClass[0] ;
}
@@ -88,6 +91,8 @@ GetOperationType( const std::string& sOpeClass)
return OPER_SURFFINISHING ;
else if ( sOpeClass == s_OpeClass[13])
return OPER_WATERJETTING ;
else if ( sOpeClass == s_OpeClass[14])
return OPER_FIVEAXISMILLING ;
else
return OPER_NULL ;
}
}
+42
View File
@@ -124,6 +124,17 @@ static const std::string GVAR_R4P = ".R4p" ; // (num) valore pr
static const std::string GVAR_R5P = ".R5p" ; // (num) valore precedente del quinto asse rotante
static const std::string GVAR_R6P = ".R6p" ; // (num) valore precedente del sesto asse rotante
static const std::string GVAR_R7P = ".R7p" ; // (num) valore precedente del settimo asse rotante
static const std::string GVAR_MOVESUCC = ".MOVESUCC" ; // (int) tipo del movimento successivo (0,1,2,3)
static const std::string GVAR_L1S = ".L1s" ; // (num) valore successivo del primo asse lineare
static const std::string GVAR_L2S = ".L2s" ; // (num) valore successivo del secondo asse lineare
static const std::string GVAR_L3S = ".L3s" ; // (num) valore successivo del terzo asse lineare
static const std::string GVAR_R1S = ".R1s" ; // (num) valore successivo del primo asse rotante
static const std::string GVAR_R2S = ".R2s" ; // (num) valore successivo del secondo asse rotante
static const std::string GVAR_R3S = ".R3s" ; // (num) valore successivo del terzo asse rotante
static const std::string GVAR_R4S = ".R4s" ; // (num) valore successivo del quarto asse rotante
static const std::string GVAR_R5S = ".R5s" ; // (num) valore successivo del quinto asse rotante
static const std::string GVAR_R6S = ".R6s" ; // (num) valore successivo del sesto asse rotante
static const std::string GVAR_R7S = ".R7s" ; // (num) valore successivo del settimo asse rotante
static const std::string GVAR_L1T = ".L1t" ; // (string) token del primo asse lineare
static const std::string GVAR_L2T = ".L2t" ; // (string) token del secondo asse lineare
static const std::string GVAR_L3T = ".L3t" ; // (string) token del terzo asse lineare
@@ -173,6 +184,7 @@ static const std::string GVAR_SIMUISTAT = ".SIMUISTAT" ; // (num) stato sim
static const std::string GVAR_SAFEDIST = ".SAFEDIST" ; // (num) distanza di sicurezza per verifica di collisione
static const std::string GVAR_SIMVMID = ".SIMVMID" ; // (int) identificativo grezzo Vmill in collisione
static const std::string GVAR_SIMCOBIND = ".SIMCOBIND" ; // (int) indice oggetto in collisione
static const std::string GVAR_MPSIM = ".MPSIM" ; // (bool) flag simulazione multiprocesso
// Funzioni generazione
static const std::string ON_START = "OnStart" ;
static const std::string ON_END = "OnEnd" ;
@@ -299,6 +311,36 @@ GetGlobVarAxisPrev( int nAx, const std::string& sVar = GLOB_VAR, bool bIsRobot =
}
}
//----------------------------------------------------------------------------
inline std::string
GetGlobVarAxisNext( int nAx, const std::string& sVar = GLOB_VAR, bool bIsRobot = false)
{
if ( ! bIsRobot) {
switch ( nAx) {
case 1 : return ( sVar + GVAR_L1S) ;
case 2 : return ( sVar + GVAR_L2S) ;
case 3 : return ( sVar + GVAR_L3S) ;
case 4 : return ( sVar + GVAR_R1S) ;
case 5 : return ( sVar + GVAR_R2S) ;
case 6 : return ( sVar + GVAR_R3S) ;
case 7 : return ( sVar + GVAR_R4S) ;
default : return "" ;
}
}
else {
switch ( nAx) {
case 1 : return ( sVar + GVAR_R1S) ;
case 2 : return ( sVar + GVAR_R2S) ;
case 3 : return ( sVar + GVAR_R3S) ;
case 4 : return ( sVar + GVAR_R4S) ;
case 5 : return ( sVar + GVAR_R5S) ;
case 6 : return ( sVar + GVAR_R6S) ;
case 7 : return ( sVar + GVAR_R7S) ;
default : return "" ;
}
}
}
//----------------------------------------------------------------------------
inline std::string
GetGlobVarAxisToken( int nAx, bool bIsRobot = false)
+169 -130
View File
@@ -140,10 +140,16 @@ Pocketing::Dump( string& sOut, bool bMM, const char* szNewLine) const
sOut += GetClassName() + "[mm]" + szNewLine ;
sOut += KEY_PHASE + EQUAL + ToString( m_nPhase) + szNewLine ;
sOut += KEY_IDS + EQUAL + ToString( m_vId) + szNewLine ;
for ( int i = 0 ; i < m_Params.GetSize() ; ++ i)
sOut += m_Params.ToString( i) + szNewLine ;
for ( int i = 0 ; i < m_TParams.GetSize() ; ++ i)
sOut += m_TParams.ToString( i) + szNewLine ;
for ( int i = 0 ; i < m_Params.GetSize() ; ++ i) {
string sTmp = m_Params.ToString( i) ;
if ( ! IsEmptyOrSpaces( sTmp))
sOut += sTmp + szNewLine ;
}
for ( int i = 0 ; i < m_TParams.GetSize() ; ++ i) {
string sTmp = m_TParams.ToString( i) ;
if ( ! IsEmptyOrSpaces( sTmp))
sOut += sTmp + szNewLine ;
}
sOut += KEY_NUM + EQUAL + ToString( m_nPockets) + szNewLine ;
sOut += KEY_STAT + EQUAL + ToString( m_nStatus) + szNewLine ;
@@ -495,15 +501,15 @@ Pocketing::SetParam( int nType, const string& sVal)
bool
Pocketing::SetGeometry( const SELVECTOR& vIds)
{
// verifico validità gestore DB geometrico
// verifico validità gestore DB geometrico
if ( m_pGeomDB == nullptr)
return false ;
// reset della geometria corrente
m_vId.clear() ;
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve o tutte facce)
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve o tutte facce)
int nType = GEO_NONE ;
for ( const auto& Id : vIds) {
// test sull'entità
// test sull'entità
int nSubs ;
if ( ! VerifyGeometry( Id, nSubs, nType)) {
string sInfo = "Warning in Pocketing : Skipped entity " + ToString( Id) ;
@@ -526,14 +532,14 @@ Pocketing::Preview( bool bRecalc)
// reset numero percorsi di svuotatura generati
m_nPockets = 0 ;
// verifico validità gestore DB geometrico e Id del gruppo
// verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
// recupero gruppo per geometria ausiliaria
int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ;
bool bChain = false ;
// se non c'è, lo aggiungo
// se non c'è, lo aggiungo
if ( nAuxId == GDB_ID_NULL) {
nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nAuxId == GDB_ID_NULL)
@@ -576,7 +582,7 @@ Pocketing::Preview( bool bRecalc)
// recupero gruppo per geometria di Preview
int nPvId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_PV) ;
// se non c'è, lo aggiungo
// se non c'è, lo aggiungo
if ( nPvId == GDB_ID_NULL) {
nPvId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nPvId == GDB_ID_NULL)
@@ -609,7 +615,7 @@ Pocketing::Apply( bool bRecalc, bool bPostApply)
// reset raggio massimo attacco ad elica nel caso di cerchi
m_dMaxHelixRad = INFINITO ;
// verifico validità gestore DB geometrico e Id del gruppo
// verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
@@ -638,7 +644,7 @@ Pocketing::Apply( bool bRecalc, bool bPostApply)
// recupero gruppo per geometria ausiliaria
int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ;
bool bChain = false ;
// se non c'è, lo aggiungo
// se non c'è, lo aggiungo
if ( nAuxId == GDB_ID_NULL) {
nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nAuxId == GDB_ID_NULL)
@@ -669,7 +675,7 @@ Pocketing::Apply( bool bRecalc, bool bPostApply)
// recupero gruppo per geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
// se non c'è, lo aggiungo
// se non c'è, lo aggiungo
if ( nClId == GDB_ID_NULL) {
nClId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nClId == GDB_ID_NULL)
@@ -731,7 +737,7 @@ Pocketing::Apply( bool bRecalc, bool bPostApply)
bool
Pocketing::Update( bool bPostApply)
{
// verifico validità gestore DB geometrico e Id del gruppo
// verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
@@ -741,7 +747,7 @@ Pocketing::Update( bool bPostApply)
return true ;
}
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione
@@ -988,7 +994,7 @@ Pocketing::UpdateToolData( bool* pbChanged)
bool
Pocketing::GetGeometry( SELVECTOR& vIds) const
{
// restituisco l'elenco delle entità
// restituisco l'elenco delle entità
vIds = m_vId ;
return true ;
}
@@ -1001,7 +1007,7 @@ Pocketing::VerifyGeometry( SelData Id, int& nSubs, int& nType)
const IGeoObj* pGObj = m_pGeomDB->GetGeoObj( Id.nId) ;
if ( pGObj == nullptr)
return false ;
// se ammesse curve ed è tale
// se ammesse curve ed è tale
if ( ( nType == GEO_NONE || nType == GEO_CURVE) && ( pGObj->GetType() & GEO_CURVE) != 0) {
nType = GEO_CURVE ;
const ICurve* pCurve = nullptr ;
@@ -1025,7 +1031,7 @@ Pocketing::VerifyGeometry( SelData Id, int& nSubs, int& nType)
}
return true ;
}
// se altrimenti ammessi testi ed è tale
// se altrimenti ammessi testi ed è tale
else if ( ( nType == GEO_NONE || nType == EXT_TEXT) && pGObj->GetType() == EXT_TEXT) {
nType = EXT_TEXT ;
const IExtText* pText = ::GetExtText( pGObj) ;
@@ -1034,7 +1040,7 @@ Pocketing::VerifyGeometry( SelData Id, int& nSubs, int& nType)
nSubs = 0 ;
return true ;
}
// se altrimenti ammesse superfici trimesh ed è tale
// se altrimenti ammesse superfici trimesh ed è tale
else if ( ( nType == GEO_NONE || nType == SRF_TRIMESH) && pGObj->GetType() == SRF_TRIMESH) {
nType = SRF_TRIMESH ;
const ISurfTriMesh* pSurf = ::GetSurfTriMesh( pGObj) ;
@@ -1056,7 +1062,7 @@ Pocketing::VerifyGeometry( SelData Id, int& nSubs, int& nType)
}
return true ;
}
// se altrimenti ammesse regioni ed è tale
// se altrimenti ammesse regioni ed è tale
else if ( ( nType == GEO_NONE || nType == SRF_FLATRGN) && pGObj->GetType() == SRF_FLATRGN) {
nType = SRF_FLATRGN ;
const ISurfFlatRegion* pReg = ::GetSurfFlatRegion( pGObj) ;
@@ -1123,7 +1129,7 @@ Pocketing::GetCurves( SelData Id, ICURVEPLIST& lstPC)
return false ;
// la duplico
pCurve.Set( pOriCurve->Clone()) ;
// reset proprietà temporanee
// reset proprietà temporanee
ResetCurveAllTempProp( pCurve) ;
// recupero estrusione e spessore
Vector3d vtExtr ;
@@ -1151,7 +1157,7 @@ Pocketing::GetCurves( SelData Id, ICURVEPLIST& lstPC)
// recupero l'outline del testo
if ( ! pText->GetOutline( lstPC))
return false ;
// reset proprietà temporanee
// reset proprietà temporanee
for ( auto pCrv : lstPC)
ResetCurveAllTempProp( pCrv) ;
// porto le curve in globale
@@ -1178,16 +1184,16 @@ Pocketing::GetCurves( SelData Id, ICURVEPLIST& lstPC)
pCrvCompo->FromPolyLine( vPL[0]) ;
if ( ! pCrvCompo->IsValid())
return false ;
// reset proprietà temporanee
// reset proprietà temporanee
ResetCurveAllTempProp( pCrvCompo) ;
// determino eventuali lati aperti e aggiorno proprietà del contorno
// determino eventuali lati aperti e aggiorno proprietà del contorno
int nInd = 0 ;
double dPar ;
bool bFound = vPL[0].GetFirstU( dPar, true) ;
while ( bFound) {
// recupero il flag
int nFlag = int( dPar) ;
// se non c'è nulla di adiacente, lato aperto
// se non c'è nulla di adiacente, lato aperto
if ( nFlag == SVT_NULL)
pCrvCompo->SetCurveTempProp( nInd, 1) ;
// altrimenti verifico se la faccia adiacente forma diedro convesso o concavo
@@ -1215,7 +1221,7 @@ Pocketing::GetCurves( SelData Id, ICURVEPLIST& lstPC)
// la porto in globale
pCrvCompo->ToGlob( frGlob) ;
// sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, 0) ;
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, 0) ;
// la restituisco
lstPC.emplace_back( Release( pCrvCompo)) ;
return true ;
@@ -1244,7 +1250,7 @@ Pocketing::GetCurves( SelData Id, ICURVEPLIST& lstPC)
PtrOwner<ICurveComposite> pCrvCompo ;
if ( ! pCrvCompo.Set( ConvertCurveToComposite( pReg->GetLoop( nC, nL))))
return false ;
// reset proprietà temporanee
// reset proprietà temporanee
ResetCurveAllTempProp( pCrvCompo) ;
// assegno l'estrusione dalla normale alla regione
pCrvCompo->SetExtrusion( vtN) ;
@@ -1253,7 +1259,7 @@ Pocketing::GetCurves( SelData Id, ICURVEPLIST& lstPC)
// la porto in globale
pCrvCompo->ToGlob( frGlob) ;
// sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, 0) ;
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, 0) ;
// la restituisco
lstPC.emplace_back( Release( pCrvCompo)) ;
}
@@ -1273,7 +1279,7 @@ Pocketing::SetCurveAllTempProp( int nCrvId, bool bForcedClose, ICurve* pCurve, b
return false ;
if ( pbSomeOpen != nullptr)
*pbSomeOpen = false ;
// reset proprietà temporanee
// reset proprietà temporanee
ResetCurveAllTempProp( pCurve) ;
// se forzato chiuso o non presenti info per lati aperti, esco
if ( bForcedClose || ! m_pGeomDB->ExistsInfo( nCrvId, KEY_OPEN))
@@ -1442,7 +1448,7 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
// recupero gruppo per geometria temporanea
const string GRP_TEMP = "Temp" ;
int nTempId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, GRP_TEMP) ;
// se non c'è, lo aggiungo
// se non c'è, lo aggiungo
if ( nTempId == GDB_ID_NULL) {
nTempId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nTempId == GDB_ID_NULL)
@@ -1524,7 +1530,7 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
Point3d ptMidOpen ;
Vector3d vtMidOut ;
if ( bSomeOpen) {
// ricerca del punto medio del lato aperto più lungo
// ricerca del punto medio del lato aperto più lungo
bMidOpen = GetMidOfLongestOpenSide( pCompo, ptMidOpen, vtMidOut) ;
// sistemazioni per eventuali lati aperti
if ( ! AdjustContourWithOpenEdges( pCompo)) {
@@ -1533,7 +1539,7 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
}
}
// sposto l'inizio a metà del tratto più lungo ( o aperto più lungo)
// sposto l'inizio a metà del tratto più lungo ( o aperto più lungo)
if ( bMidOpen) {
const double LEN_OUT = 5 ;
double dPar ; int nFlag ;
@@ -1617,7 +1623,7 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
}
// verifico di non superare il massimo materiale
// se lo step supera la capacità dell'utensile
// se lo step supera la capacità dell'utensile
if ( m_Params.m_dStep > m_TParams.m_dMaxMat + EPS_SMALL) {
dOkStep = m_TParams.m_dMaxMat + EPS_SMALL ;
string sInfo = "Warning in Pocketing : machining step (" + ToString( m_Params.m_dStep, 1) +
@@ -1626,7 +1632,7 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
}
// se lavorazione singola
if ( dOkStep < EPS_SMALL || dOkStep > dElev) {
// se l'elevazione supera la capacità dell'utensile
// se l'elevazione supera la capacità dell'utensile
if ( dElev > m_TParams.m_dMaxMat + EPS_SMALL) {
string sInfo = "Warning in Pocketing : machining depth (" + ToString( dElev, 1) +
") bigger than MaxMaterial (" + ToString( m_TParams.m_dMaxMat, 1) + ")" ;
@@ -1638,7 +1644,7 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
// altrimenti lavorazione a step
else {
// se l'elevazione supera il massimo affondamento dell'utensile
double dSafe = m_pMchMgr->GetCurrMachiningsMgr()->GetMaxDepthSafe() ;
double dSafe = GetMaxDepthSafe() ;
double dMaxDepth = m_TParams.m_dLen - ( m_TParams.m_dDiam > m_dTHoldDiam ? m_dTHoldBase : m_dTHoldLen) - dSafe ;
if ( dElev > dMaxDepth + EPS_SMALL) {
// segnalo, riduco e continuo
@@ -1710,10 +1716,12 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
// Eseguo la lavorazione a seconda del tipo
switch ( m_Params.m_nSubType) {
case POCKET_SUB_ZIGZAG :
case POCKET_SUB_CONFORMAL_ZIGZAG :
if ( ! AddZigZag( pCompo, vtTool, vtExtr, dDepth, dElev, dOkStep, bSplitArcs, nPathId))
return false ;
break ;
case POCKET_SUB_ONEWAY :
case POCKET_SUB_CONFORMAL_ONEWAY :
if ( ! AddOneWay( pCompo, vtTool, vtExtr, dDepth, dElev, dOkStep, bSplitArcs))
return false ;
break ;
@@ -1824,10 +1832,10 @@ Pocketing::CalcRegionElevation( const ICurveComposite* pCompo, const Vector3d& v
bool
Pocketing::VerifyPathFromBottom( const ICurveComposite* pCompo, const Vector3d& vtTool)
{
// se non è svuotatura dal basso in alto, esco
// se non è svuotatura dal basso in alto, esco
if ( vtTool.z > MIN_ZDIR_TOP_TOOL)
return true ;
// se c'è testa non dall'alto o tavola basculante, esco
// se c'è testa non dall'alto o tavola basculante, esco
if ( ! m_bAboveHead || m_bTiltingTab)
return true ;
// recupero dati di eventuale rinvio da sotto
@@ -1849,7 +1857,7 @@ Pocketing::VerifyPathFromBottom( const ICurveComposite* pCompo, const Vector3d&
! vtCurrDir.IsSmallXY()) {
if ( dCurrDist < dMinDist - 10 * EPS_SMALL &&
find_if( vDir.begin(), vDir.end(), [&](const Vector3d& vtV){ return vtCurrDir * vtV > cos( 15 * DEGTORAD) ; }) == vDir.end()) {
// inserisco la direzione tra quelle già esplorate
// inserisco la direzione tra quelle già esplorate
vDir.emplace_back( vtCurrDir) ;
// determino la distanza di tutti gli altri punti dal contorno del grezzo lungo questa direzione
for ( double dPar2 = dParS ; dPar2 < dParE + EPS_PARAM ; dPar2 += 0.5) {
@@ -1861,7 +1869,7 @@ Pocketing::VerifyPathFromBottom( const ICurveComposite* pCompo, const Vector3d&
dCurrDist = dQDist ;
}
}
// se la massima distanza trovata è inferiore al minimo, lo aggiorno
// se la massima distanza trovata è inferiore al minimo, lo aggiorno
if ( dCurrDist < dMinDist) {
dMinDist = dCurrDist ;
vtMinDir = vtCurrDir ;
@@ -1871,7 +1879,7 @@ Pocketing::VerifyPathFromBottom( const ICurveComposite* pCompo, const Vector3d&
}
// se supera il limite, errore
if ( dMinDist > m_AggrBottom.dDMax) {
if ( dMinDist - ( m_TParams.m_dDiam / 2 + GetOffsR()) > m_AggrBottom.dDMax) {
m_pMchMgr->SetLastError( 2410, "Error in Pocketing : path too far from part sides") ;
return false ;
}
@@ -1959,8 +1967,8 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
double dDepth, double dElev, double dOkStep, bool bSplitArcs, int nPathId)
{
// recupero distanze di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeAggrBottZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeAggrBottZ() ;
double dSafeZ = GetSafeZ() ;
double dSafeAggrBottZ = GetSafeAggrBottZ() ;
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
@@ -2002,7 +2010,7 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
vpCrvs[0]->ExtendStartByLen( m_TParams.m_dDiam / 2 - dOptZigZagOffs + dSafeZ) ;
}
// se non ottimizzato e utensile che non lavora di testa poichè ingresso non fuori dal pezzo, errore
// se non ottimizzato e utensile che non lavora di testa poichè ingresso non fuori dal pezzo, errore
if ( ( ! bOptimizedZigZag || ! ( bOutRawLeadIn || m_bOpenOutRaw)) && m_TParams.m_nType == TT_MILL_NOTIP) {
if ( ! LeadInRawIsOk()) {
m_pMchMgr->SetLastError( 2431, "Error in Pocketing : LeadIn with Mill NoTip in material") ;
@@ -2100,9 +2108,9 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
pCurve->ToGlob( frPocket) ;
// aggiungo affondamento
pCurve->Translate( - vtTool * ( dDepth - dElev + j * dStep)) ;
// se prima entità
// se prima entità
if ( i == 0 ) {
// dati inizio entità
// dati inizio entità
Point3d ptStart ;
pCurve->GetStartPoint( ptStart) ;
Vector3d vtStart ;
@@ -2174,9 +2182,9 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
return false ;
}
// se ultima entità
// se ultima entità
if ( i == nMaxInd) {
// dati fine entità
// dati fine entità
Point3d ptEnd ;
pCurve->GetEndPoint( ptEnd) ;
Vector3d vtEnd ;
@@ -2245,7 +2253,7 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
if ( m_Params.m_bInvert)
pOffs2->Invert() ;
// sposto l'inizio a metà del tratto più lungo
// sposto l'inizio a metà del tratto più lungo
AdjustContourStart( pOffs2) ;
// aggiungo la lavorazione di questa curva
@@ -2262,9 +2270,9 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
return false ;
// aggiungo affondamento
pCurve->Translate( - vtTool * ( dDepth - dElev + j * dStep)) ;
// se prima entità
// se prima entità
if ( i == 0 ) {
// dati inizio entità
// dati inizio entità
Point3d ptStart ;
pCurve->GetStartPoint( ptStart) ;
Vector3d vtStart ;
@@ -2336,11 +2344,11 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
return false ;
}
// se ultima entità
// se ultima entità
if ( i == nMaxInd) {
// se ultimo step, uscita e retrazione di collegamento
if ( j == nStep) {
// dati fine entità
// dati fine entità
Point3d ptEnd ;
pCurve->GetEndPoint( ptEnd) ;
Vector3d vtEnd ;
@@ -2653,7 +2661,7 @@ Pocketing::OptimizedZigZag( int nPathId, const Vector3d& vtTool, double dDepth,
ptTest.ToGlob( frPocket) ;
ptTest += - vtTool * dDepth ;
double dTestElev ;
// se è nel grezzo provo a ruotare di 90 gradi
// se è nel grezzo provo a ruotare di 90 gradi
if ( GetElevation( m_nPhase, ptTest, vtTool, m_TParams.m_dDiam / 2 - dOffs, vtTool, dTestElev) && dTestElev > EPS_SMALL) {
Vector3d vtDirO = vtDir ;
vtDirO.Rotate( Z_AX, ( m_Params.m_bInvert ? -90 : 90)) ;
@@ -2661,7 +2669,7 @@ Pocketing::OptimizedZigZag( int nPathId, const Vector3d& vtTool, double dDepth,
ptTestO.ToGlob( frPocket) ;
ptTestO += - vtTool * dDepth ;
double dTestElevO ;
// se è fuori dal grezzo uso inizio ruotato
// se è fuori dal grezzo uso inizio ruotato
if ( ! GetElevation( m_nPhase, ptTestO, vtTool, m_TParams.m_dDiam / 2 - dOffs, vtTool, dTestElevO) || dTestElevO < EPS_SMALL) {
Point3d ptNewStart = ptStart + vtDirO ;
vpCrvs[0]->AddLine( ptNewStart, false) ;
@@ -2697,7 +2705,7 @@ Pocketing::OptimizedZigZag( int nPathId, const Vector3d& vtTool, double dDepth,
bool
Pocketing::ZigZagOptimizedNoClosedEdges( ICurveComposite* pCrvPocket, bool& bOptimizedZigZag, Vector3d& vtDir, double& dOffs)
{
// individuo il segmento di retta più lungo
// individuo il segmento di retta più lungo
int nMax = -1 ;
double dMaxLen = 0 ;
for ( int i = 0 ; i < int( pCrvPocket->GetCurveCount()) ; ++ i) {
@@ -2745,7 +2753,7 @@ Pocketing::ZigZagOptimizedOneClosedEdge( ICurveComposite* pCrvPocket, int nClose
pCrv->ExtendStartByLen( 300) ;
pCrv->ExtendEndByLen( 300) ;
// sarà la prima curva del percorso
// sarà la prima curva del percorso
if ( ! CutCurveWithLine( pCrvPocket, pCrv))
return false ;
@@ -2791,7 +2799,7 @@ Pocketing::ZigZagOptimizedTwoClosedEdges( ICurveComposite* pCrvPocket, const INT
pCrv1->SetExtrusion( vtExtr) ;
pCrv2->SetExtrusion( vtExtr) ;
// determino la curva chiusa più lunga
// determino la curva chiusa più lunga
double dLen1 ; pCrv1->GetLength( dLen1) ;
double dLen2 ; pCrv2->GetLength( dLen2) ;
@@ -2816,7 +2824,7 @@ Pocketing::ZigZagOptimizedTwoClosedEdges( ICurveComposite* pCrvPocket, const INT
if ( ! CutCurveWithLine( pCrvPocket, pCrv1))
return false ;
// sarà la prima curva del percorso
// sarà la prima curva del percorso
pCrv2->SimpleOffset( -dMyOffs) ;
pCrv2->ExtendStartByLen( 300) ;
pCrv2->ExtendEndByLen( 300) ;
@@ -2904,7 +2912,7 @@ Pocketing::ZigZagOptimizedThreeClosedEdges( ICurveComposite* pCrvPocket, const I
if ( ! CutCurveWithLine( pCrvPocket, pCrv3))
return false ;
// sarà la prima curva del percorso
// sarà la prima curva del percorso
pCrv2->SimpleOffset( -dMyOffs) ;
pCrv2->ExtendStartByLen( 300) ;
pCrv2->ExtendEndByLen( 300) ;
@@ -2920,7 +2928,7 @@ Pocketing::ZigZagOptimizedThreeClosedEdges( ICurveComposite* pCrvPocket, const I
Pocketing::ZigZagOptimizedComputeOffset( ICurveComposite* pCrvPocket, const Vector3d& vtMainDir, int nOffsettedEdgesOnY,
const INTVECTOR& vnClosedIds, double& dOffs)
{
// calcolo il side step che verrà utilizzato in CalcZigZag
// calcolo il side step che verrà utilizzato in CalcZigZag
Frame3d frLoc ;
if ( ! frLoc.Set( ORIG, Z_AX, vtMainDir))
return true ;
@@ -3037,12 +3045,12 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con
double dDepth, double dElev, double dOkStep, bool bSplitArcs)
{
// recupero distanze di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeAggrBottZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeAggrBottZ() ;
double dSafeZ = GetSafeZ() ;
double dSafeAggrBottZ = GetSafeAggrBottZ() ;
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
// se utensile che non lavora di testa poichè ingresso non fuori dal pezzo, errore
// se utensile che non lavora di testa poichè ingresso non fuori dal pezzo, errore
if ( m_TParams.m_nType == TT_MILL_NOTIP) {
if ( ! LeadInRawIsOk()) {
m_pMchMgr->SetLastError( 2431, "Error in Pocketing : LeadIn with Mill NoTip in material") ;
@@ -3078,7 +3086,7 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con
if ( m_Params.m_bInvert)
pOffs->Invert() ;
// sposto l'inizio a metà del tratto più lungo
// sposto l'inizio a metà del tratto più lungo
AdjustContourStart( pOffs) ;
// se necessario, approssimo con rette
@@ -3109,9 +3117,9 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con
return false ;
// aggiungo affondamento
pCurve->Translate( - vtTool * ( dDepth - dElev + j * dStep)) ;
// se prima entità
// se prima entità
if ( i == 0 ) {
// dati inizio entità
// dati inizio entità
Point3d ptStart ;
pCurve->GetStartPoint( ptStart) ;
Vector3d vtStart ;
@@ -3182,11 +3190,11 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
return false ;
}
// se ultima entità
// se ultima entità
if ( i == nMaxInd) {
// se ultimo step, uscita e retrazione di collegamento
if ( j == nStep) {
// dati fine entità
// dati fine entità
Point3d ptEnd ;
pCurve->GetEndPoint( ptEnd) ;
Vector3d vtEnd ;
@@ -3350,8 +3358,8 @@ Pocketing::AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, c
const Point3d& ptMidOpen, const Vector3d& vtMidOut, int nPathId)
{
// recupero distanze di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeAggrBottZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeAggrBottZ() ;
double dSafeZ = GetSafeZ() ;
double dSafeAggrBottZ = GetSafeAggrBottZ() ;
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
@@ -3459,9 +3467,9 @@ Pocketing::AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, c
return false ;
// aggiungo affondamento
pCurve->Translate( - vtTool * ( dDepth - dElev + j * dStep)) ;
// se prima entità
// se prima entità
if ( i == 0 ) {
// dati inizio entità
// dati inizio entità
Point3d ptStart ;
pCurve->GetStartPoint( ptStart) ;
Vector3d vtStart ;
@@ -3471,7 +3479,7 @@ Pocketing::AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, c
// determino inizio attacco
if ( ! CalcLeadInStart( ptStart, vtStart, vtExtr, pRCrv, ptP1))
return false ;
// determino elevazione su inizio attacco (se non trovata, elevazione è step)
// determino elevazione su inizio attacco (se non trovata, elevazione è step)
double dStElev ;
if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev))
dStElev = dStep ;
@@ -3532,7 +3540,7 @@ Pocketing::AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, c
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
return false ;
}
// se ultima entità
// se ultima entità
if ( i == nMaxInd) {
// se step intermedio, ritorno all'inizio direttamente
if ( j < nStep) {
@@ -3560,7 +3568,7 @@ Pocketing::AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, c
}
// atrimenti ultimo step, uscita e retrazione
else {
// dati fine entità
// dati fine entità
Point3d ptEnd ;
pCurve->GetEndPoint( ptEnd) ;
Vector3d vtEnd ;
@@ -3592,8 +3600,8 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dDepth, double dElev, double dOkStep, bool bSplitArcs, int nPathId)
{
// recupero distanze di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeAggrBottZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeAggrBottZ() ;
double dSafeZ = GetSafeZ() ;
double dSafeAggrBottZ = GetSafeAggrBottZ() ;
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
@@ -3655,7 +3663,7 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool,
}
}
// inverto i percorsi, perchè sono calcolati dall'esterno all'interno (solo nel caso non ottimizzato)
// inverto i percorsi, perchè sono calcolati dall'esterno all'interno (solo nel caso non ottimizzato)
if ( ! bOptimizedTrap) {
pMCrv->Invert() ;
pRCrv->Invert() ;
@@ -3685,9 +3693,9 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool,
return false ;
// aggiungo affondamento
pCurve->Translate( -vtTool * ( dDepth - dElev + j * dStep)) ;
// se prima entità
// se prima entità
if ( i == 0 ) {
// dati inizio entità
// dati inizio entità
Point3d ptStart ;
pCurve->GetStartPoint( ptStart) ;
Vector3d vtStart ;
@@ -3760,7 +3768,7 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool,
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
return false ;
}
// se ultima entità
// se ultima entità
if ( i == nMaxInd) {
// se step intermedio
if ( j < nStep) {
@@ -3788,7 +3796,7 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool,
}
// atrimenti ultimo step, uscita e retrazione
else {
// dati fine entità
// dati fine entità
Point3d ptEnd ;
pCurve->GetEndPoint( ptEnd) ;
Vector3d vtEnd ;
@@ -3863,10 +3871,10 @@ Pocketing::CalcSpiral( const ICurveComposite* pCompo, int nReg, bool bSplitArcs,
vtDir.Normalize() ;
Vector3d vtOrtho = OrthoCompo( vtOtherDir, vtDir) ;
double dPocketSize = vtOrtho.Len() ;
double dMaxOptSize ;
double dMaxOptSize = m_Params.m_dSideStep ;
FromString( ExtractInfo( m_Params.m_sUserNotes, "MaxOptSize="), dMaxOptSize) ;
if ( ( ( bSomeOpen && dPocketSize < m_TParams.m_dDiam + EPS_SMALL) || abs( dPocketSize - m_TParams.m_dDiam) < EPS_SMALL) &&
( ! FromString( ExtractInfo( m_Params.m_sUserNotes, "MaxOptSize="), dMaxOptSize) || dPocketSize < dMaxOptSize)) {
dPocketSize < dMaxOptSize + 10 * EPS_SMALL) {
if ( nReg == 0) {
CalcTrapezoidSpiral( pCrvPocket, vtDir, dPocketSize, pMCrv, pRCrv, bOptimizedTrap) ;
if ( bOptimizedTrap)
@@ -3886,6 +3894,16 @@ Pocketing::CalcSpiral( const ICurveComposite* pCompo, int nReg, bool bSplitArcs,
PtrOwner<ICurve> pOffs ;
double dCurrRad = GetCurveRadius( pCompo) ;
while ( nIter < MAX_ITER) {
// se l'offset richiesto è pari al valore limite per la curva ne modifico leggermente il valore per evitare problemi con
// le tolleranze di vroni
double dMaxOffs ;
if ( nIter == 0)
CalcCurveLimitOffset( *pCompo, dMaxOffs) ;
else
CalcCurveLimitOffset( *pOffs, dMaxOffs) ;
if ( abs( dMaxOffs - dOffs) < EPS_SMALL)
dOffs -= EPS_SMALL ;
// calcolo
OffsetCurve OffsCrv ;
if ( ! OffsCrv.Make( ( nIter == 0 ? (ICurve*) pCompo : pOffs), - dOffs, ICurve::OFF_FILLET) ||
@@ -3997,7 +4015,7 @@ Pocketing::CalcSpiral( const ICurveComposite* pCompo, int nReg, bool bSplitArcs,
int nCrvsCount0 = pMCrv->GetCurveCount() ;
// accodo nel percorso di lavorazione
pMCrv->AddCurve( Release( vLinks[i])) ;
// nel caso di lucidatura setto proprietà alle curve di collegamento per poterle identificare
// nel caso di lucidatura setto proprietà alle curve di collegamento per poterle identificare
if ( m_TParams.m_nType == TT_MILL_POLISHING) {
for ( int j = nCrvsCount0 ; j < pMCrv->GetCurveCount() ; j ++)
pMCrv->SetCurveTempProp( j, LINK_CURVE_PROP) ;
@@ -4057,7 +4075,7 @@ Pocketing::CalcBoundedLink( const Point3d& ptStart, const Point3d& ptEnd, const
CRVCVECTOR ccClass ;
IntersCurveCurve intCC( *LineLoc, *CrvOutLoc) ;
intCC.GetCurveClassification( 0, EPS_SMALL, ccClass) ;
// se nessuno o un solo tratto e interno, la retta è il collegamento
// se nessuno o un solo tratto e interno, la retta è il collegamento
if ( ccClass.empty() || ( ccClass.size() == 1 && ccClass[0].nClass == CRVC_IN)) {
pCrvLink->AddCurve( Release( pLine)) ;
return true ;
@@ -4079,7 +4097,7 @@ Pocketing::CalcBoundedLink( const Point3d& ptStart, const Point3d& ptEnd, const
pLine->GetPointD1D2( ccClass[j].dParE, ICurve::FROM_MINUS, ptE) ;
double dOffE ;
pCrvBound->GetParamAtPoint( ptE, dOffE) ;
// recupero i due possibili percorsi e uso il più corto
// recupero i due possibili percorsi e uso il più corto
PtrOwner<ICurve> pCrvA( pCrvBound->CopyParamRange( dOffS, dOffE)) ;
PtrOwner<ICurve> pCrvB( pCrvBound->CopyParamRange( dOffE, dOffS)) ;
if ( IsNull( pCrvA) || IsNull( pCrvB))
@@ -4116,7 +4134,7 @@ Pocketing::CalcBoundedLinkWithBiArcs( const Point3d& ptStart, const Vector3d& vt
CRVCVECTOR ccClass ;
IntersCurveCurve intCC( *pBiArcLink, *pCrvBound) ;
intCC.GetCurveClassification( 0, EPS_SMALL, ccClass) ;
// se nessuno o un solo tratto e interno, il biarco è il collegamento
// se nessuno o un solo tratto e interno, il biarco è il collegamento
if ( ccClass.empty() || ( ccClass.size() == 1 && ccClass[0].nClass == CRVC_IN)) {
pCrvLink->AddCurve( Release( pBiArcLink)) ;
}
@@ -4295,7 +4313,7 @@ Pocketing::CalcTrapezoidSpiral( ICurveComposite* pCrvPocket, const Vector3d& vtD
double dMaxLarg = b3Dim.GetDimY() ;
// calcolo percorso di svuotatura
// se lati obliqui sono entrambi chiusi e dimensione svuotatura è maggiore di diametro fresa e minore del doppio gestione speciale
// se lati obliqui sono entrambi chiusi e dimensione svuotatura è maggiore di diametro fresa e minore del doppio gestione speciale
if ( vnProp[0] != 0 && vnProp[2] != 0 && vnProp[3] == 0 && vnProp[1] == 0 &&
dMaxLarg > m_TParams.m_dDiam + 10 * EPS_SMALL && max( dLen0, dLen2) < 2 * m_TParams.m_dDiam + EPS_SMALL) {
if ( ! SpecialAdjustTrapezoidSpiralForAngles( pMCrv, pCrvPocket)) {
@@ -4308,7 +4326,7 @@ Pocketing::CalcTrapezoidSpiral( ICurveComposite* pCrvPocket, const Vector3d& vtD
if ( vnProp[0] != 0)
dYCoord -= GetOffsR() ;
if ( vnProp[0] != 0 && vnProp[2] != 0)
dYCoord = 0.5 * dPocketSize ; // se entrambi i lati paralleli sono aperti mi posiziono a metà della svuotatura
dYCoord = 0.5 * dPocketSize ; // se entrambi i lati paralleli sono aperti mi posiziono a metà della svuotatura
double dXCoordStart, dXCoordEnd ;
if ( ! CalcTrapezoidSpiralXCoord( pCrvPocket, true, dYCoord, dXCoordStart, dPocketSize))
@@ -4324,7 +4342,7 @@ Pocketing::CalcTrapezoidSpiral( ICurveComposite* pCrvPocket, const Vector3d& vtD
Vector3d vtDir1, vtDir3 ;
pCrvPocket->GetCurve( 1)->GetStartDir( vtDir1) ;
pCrvPocket->GetCurve( 3)->GetStartDir( vtDir3) ;
// gestisco il caso speciale di un parallelogramma in cui anche l'altra dimensione della svuotatura è pari al diametro utensile
// gestisco il caso speciale di un parallelogramma in cui anche l'altra dimensione della svuotatura è pari al diametro utensile
if ( AreOppositeVectorApprox( vtDir1, vtDir3)) {
PtrOwner<ICurveLine> pLine1( GetCurveLine( pCrvPocket->GetCurve( 1)->Clone())) ;
PtrOwner<ICurveLine> pLine3( GetCurveLine( pCrvPocket->GetCurve( 3)->Clone())) ;
@@ -4379,7 +4397,7 @@ Pocketing::CalcTrapezoidSpiral( ICurveComposite* pCrvPocket, const Vector3d& vtD
pMCrv->ToGlob( frLoc) ;
if ( ! m_Params.m_bInvert) {
pMCrv->Invert() ;
// inverto le proprietà in modo che nProp3 sia sempre legata al punto iniziale e nProp1 a quello finale
// inverto le proprietà in modo che nProp3 sia sempre legata al punto iniziale e nProp1 a quello finale
swap( vnProp[1], vnProp[3]) ;
}
// segno i lati aperti come temp prop della curva
@@ -4534,7 +4552,7 @@ Pocketing::AdjustTrapezoidSpiralForAngles( ICurveComposite* pMCrv, const ICurveC
pMCrv->TrimStartAtParam( dPar) ;
if ( ptP1.y > dPocketSize) {
// se ptP1 è esterno alla svuotatura scambio i punti in modo da usare ptP2 per il biarco ( così da non farlo fuoriuscire troppo)
// se ptP1 è esterno alla svuotatura scambio i punti in modo da usare ptP2 per il biarco ( così da non farlo fuoriuscire troppo)
swap( ptP1, ptP2) ;
pCompo->Invert() ;
}
@@ -4563,9 +4581,9 @@ Pocketing::AdjustTrapezoidSpiralForAngles( ICurveComposite* pMCrv, const ICurveC
}
}
// caso 2 : pLine è completamente sopra/sotto la linea di svuotatura
// caso 2 : pLine è completamente sopra/sotto la linea di svuotatura
else {
// se è sopra modifiche per ricondurmi al caso in cui è sotto
// se è sopra modifiche per ricondurmi al caso in cui è sotto
if ( ptP2.y > dYCoord) {
pLine->Invert() ;
swap( ptP1, ptP2) ;
@@ -4592,7 +4610,7 @@ Pocketing::AdjustTrapezoidSpiralForAngles( ICurveComposite* pMCrv, const ICurveC
}
}
// se il lato opposto a quello di riferimento è chiuso bisogna distinguere i casi
// se il lato opposto a quello di riferimento è chiuso bisogna distinguere i casi
else {
bool bStartPnt = false ;
if ( ptP2.y < dYCoord) {
@@ -4614,7 +4632,7 @@ Pocketing::AdjustTrapezoidSpiralForAngles( ICurveComposite* pMCrv, const ICurveC
}
}
// setto temp prop per ricordare che è curva aggiuntiva per pulire angoli
// setto temp prop per ricordare che è curva aggiuntiva per pulire angoli
for ( int i = 0 ; i < pCompo->GetCurveCount() ; i++)
pCompo->SetCurveTempProp( i, 1) ;
@@ -4681,7 +4699,7 @@ Pocketing::SpecialAdjustTrapezoidSpiralForAngles( ICurveComposite* pMCrv, const
}
}
// se non è stato possibile creare raccordo, unisco linearmente
// se non è stato possibile creare raccordo, unisco linearmente
if ( ! bUseBiArcs)
pMCrv->AddCurve( Release( pLineLink)) ;
@@ -4705,7 +4723,7 @@ Pocketing::AdjustTrapezoidSpiralForLeadInLeadOut( ICurveComposite* pCompo, ICurv
for ( int i = 0 ; i < pCompo->GetCurveCount() ; i++) {
int nProp ;
if ( pCompo->GetCurveTempProp( i, nProp) && nProp == 0) {
// se non è lato aggiuntivo per la pulitura angoli recupero la sua direzione
// se non è lato aggiuntivo per la pulitura angoli recupero la sua direzione
pCompo->GetCurve( i)->GetStartDir( vtMainDir) ;
break ;
}
@@ -4765,9 +4783,9 @@ Pocketing::ComputeTrapezoidSpiralLeadInLeadOut( ICurveComposite* pCompo, const V
int nExtraEdge ;
pCompo->GetCurveTempProp( nIdCrv, nExtraEdge) ;
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeZ = GetSafeZ() ;
// tento con allungamento se lato inclinato è aperto oppure se sto considerando un lato aggiuntivo per pulire angoli
// tento con allungamento se lato inclinato è aperto oppure se sto considerando un lato aggiuntivo per pulire angoli
if ( bEdgeOpen || nExtraEdge == 1) {
Vector3d vtDirP = ( bLeadIn ? -vtDir : vtDir) ;
@@ -4808,7 +4826,7 @@ Pocketing::ComputeTrapezoidSpiralLeadInLeadOut( ICurveComposite* pCompo, const V
Point3d ptTest = ptP + vtDirP * ( dDist + ( m_TParams.m_dDiam / 2 + max( dSafeZ, m_dOpenMinSafe)) * dCorr) ;
ptTest += - vtTool * dDepth ;
double dTestElev ;
// se è fuori dal grezzo
// se è fuori dal grezzo
if ( ! GetElevation( m_nPhase, ptTest, vtTool, m_TParams.m_dDiam / 2, vtTool, dTestElev) || dTestElev < EPS_SMALL) {
Point3d ptNewStart = ptP + vtDirP * ( dDist + ( m_TParams.m_dDiam / 2 + max( dSafeZ, m_dOpenMinSafe)) * dCorr) ;
pCompo->AddLine( ptNewStart, ! bLeadIn) ;
@@ -4817,7 +4835,7 @@ Pocketing::ComputeTrapezoidSpiralLeadInLeadOut( ICurveComposite* pCompo, const V
}
}
// tento con attacco ruotato di 90° se non sto considerando un tratto aggiuntivo per pulire angoli
// tento con attacco ruotato di 90° se non sto considerando un tratto aggiuntivo per pulire angoli
if ( bBaseOpen && ! bIsOutsideRaw && nExtraEdge == 0) {
Vector3d vtDirO = vtDir ;
@@ -4833,7 +4851,7 @@ Pocketing::ComputeTrapezoidSpiralLeadInLeadOut( ICurveComposite* pCompo, const V
Point3d ptTestO = ptP + vtDirO * ( dDist + m_TParams.m_dDiam / 2 + max( dSafeZ, m_dOpenMinSafe)) ;
ptTestO += - vtTool * dDepth ;
double dTestElevO ;
// se è fuori dal grezzo uso inizio ruotato
// se è fuori dal grezzo uso inizio ruotato
if ( ! GetElevation( m_nPhase, ptTestO, vtTool, m_TParams.m_dDiam / 2, vtTool, dTestElevO) || dTestElevO < EPS_SMALL) {
Point3d ptNewStart = ptP + vtDirO * ( dDist + m_TParams.m_dDiam / 2 + max( dSafeZ, m_dOpenMinSafe)) ;
pCompo->AddLine( ptNewStart, ! bLeadIn) ;
@@ -4862,11 +4880,11 @@ Pocketing::ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv,
if ( ! pMCrv->GetCurveTempProp( i, nProp))
return false ;
// se è un tratto di collegamento ho concluso percorso su cui aggiungere epicicli
// se è un tratto di collegamento ho concluso percorso su cui aggiungere epicicli
if ( nProp == LINK_CURVE_PROP) {
if ( pCompo->IsValid()) {
PtrOwner<ICurveComposite> pCrvEp( CreateCurveComposite()) ;
// la curva di bound è l'offset che calcolo in AddEpicycles per la prima curva compo trovata in pMCrv
// la curva di bound è l'offset che calcolo in AddEpicycles per la prima curva compo trovata in pMCrv
bool bAddEp = ( ! pCrvBound->IsValid()) ? AddEpicycles( pCompo, pCrvEp, pCrvBound) : AddEpicycles( pCompo, pCrvEp) ;
if ( ! bAddEp)
return false ;
@@ -4874,7 +4892,7 @@ Pocketing::ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv,
pCompo.Set( CreateCurveComposite()) ;
}
}
// se non è tratto di collegamento lo aggiungo alla curva
// se non è tratto di collegamento lo aggiungo alla curva
else {
if ( ! pCompo->AddCurve( pMCrv->GetCurve(i)->Clone()))
return false ;
@@ -5046,29 +5064,43 @@ Pocketing::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafe
// se con aggregato da sotto o equivalente (rinvio a 90 gradi su testa 5 assi)
bool bBottomOutStart = false ;
if ( m_bAggrBottom) {
// distanza dal bordo del pezzo (se negativa il punto è fuori dal grezzo)
// distanza dal bordo del pezzo (se negativa il punto è fuori dal grezzo)
double dDistBottom ;
if ( ! GetDistanceFromRawSide( m_nPhase, ptP, m_vtAggrBottom, dDistBottom))
if ( ! GetAggrBottDistanceFromRawSide( m_nPhase, ptP, m_vtAggrBottom, ( m_AggrBottom.dEncH + dSafeZ), dDistBottom))
dDistBottom = 0 ;
bBottomOutStart = ( dDistBottom < - 10 * EPS_SMALL) ;
// aggiuntivo in Z
double dAggZ = ( bBottomOutStart ? 0. : max( dElev + max( dSafeAggrBottZ, dAppr), 0.)) ;
// pre-approccio
Point3d ptP0 = ptP - Z_AX * dAggZ + m_vtAggrBottom * ( dDistBottom + m_AggrBottom.dEncH + dSafeZ) ;
Point3d ptP00 = ptP0 + Z_AX * ( m_AggrBottom.dEncV + m_TParams.m_dLen + dAggZ - dElev) ;
// se rinvio da sotto che richiede speciale rotazione
// se richiede speciale rotazione
if ( m_AggrBottom.nType == 1) {
// punto ruotato
Point3d ptP00 = ptP0 + Z_AX * ( m_AggrBottom.dEncV + m_TParams.m_dLen + dAggZ - dElev) ;
Vector3d vtAux = m_vtAggrBottom ;
vtAux.Rotate( Z_AX, 0, 1) ;
SetAuxDir( vtAux) ;
if ( AddRapidStart( ptP00, MCH_CL_AGB_DWN) == GDB_ID_NULL)
return false ;
// vado al punto standard
SetAuxDir( m_vtAggrBottom) ;
SetFlag( 0) ;
if ( AddRapidMove( ptP0, bSplitArcs, MCH_CL_AGB_IN) == GDB_ID_NULL)
return false ;
}
// altrimenti rinvio normale
// se altrimenti con rotazione per minimizzare la sporgenza
else if ( m_AggrBottom.nType == 3) {
// punto standard ruotato
Vector3d vtAux = m_vtAggrBottom ;
vtAux.Rotate( Z_AX, 0, 1) ;
SetAuxDir( vtAux) ;
if ( AddRapidStart( ptP0, MCH_CL_AGB_IN) == GDB_ID_NULL)
return false ;
// la rotazione viene eseguita nel movimento successivo al punto sopra l'inizio lavorazione
SetAuxDir( m_vtAggrBottom) ;
SetFlag( 0) ;
}
// altrimenti rinvio normale
else {
SetAuxDir( m_vtAggrBottom) ;
if ( AddRapidStart( ptP0, MCH_CL_AGB_IN) == GDB_ID_NULL)
@@ -5076,7 +5108,7 @@ Pocketing::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafe
SetFlag( 0) ;
}
}
// se sopra attacco c'è spazio per sicurezza o approccio
// se sopra attacco c'è spazio per sicurezza o approccio
double dSafeDist = ( m_bAggrBottom ? dSafeAggrBottZ : dSafeZ) ;
if ( ! bBottomOutStart && dElev + max( dSafeDist, dAppr) > 10 * EPS_SMALL) {
Point3d ptP1 = ptP + vtTool * ( dElev + dAppr) ;
@@ -5121,7 +5153,7 @@ bool
Pocketing::AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr, bool bSplitArcs, bool bOutStart)
{
// se sopra attacco c'è spazio per approccio
// se sopra attacco c'è spazio per approccio
if ( ( dElev + dAppr) > 10 * EPS_SMALL) {
// 1b -> punto appena sopra inizio
Point3d ptP1b = ptP + vtTool * ( dElev + dAppr) ;
@@ -5150,7 +5182,7 @@ bool
Pocketing::AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr, bool bSplitArcs)
{
// se sopra uscita c'è spazio per approccio
// se sopra uscita c'è spazio per approccio
if ( ( dElev + dAppr) > 10 * EPS_SMALL) {
// 4 -> movimento di risalita sopra il punto finale
SetFeed( GetEndFeed()) ;
@@ -5171,11 +5203,11 @@ Pocketing::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ
double dDistBottom ;
if ( m_bAggrBottom) {
// distanza dal bordo del pezzo
if ( ! GetDistanceFromRawSide( m_nPhase, ptP, m_vtAggrBottom, dDistBottom))
if ( ! GetAggrBottDistanceFromRawSide( m_nPhase, ptP, m_vtAggrBottom, ( m_AggrBottom.dEncH + dSafeZ), dDistBottom))
dDistBottom = 0 ;
bBottomOutStart = ( dDistBottom < - 10 * EPS_SMALL) ;
}
// se sopra uscita c'è spazio per sicurezza o approccio
// se sopra uscita c'è spazio per sicurezza o approccio
double dSafeDist = ( m_bAggrBottom ? dSafeAggrBottZ : dSafeZ) ;
if ( ! bBottomOutStart && dElev + max( dSafeDist, dAppr) > 10 * EPS_SMALL) {
if ( dSafeDist < dAppr + 10 * EPS_SMALL) {
@@ -5201,15 +5233,22 @@ Pocketing::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ
}
// se con aggregato da sotto o equivalente (rinvio a 90 gradi su testa 5 assi)
if ( m_bAggrBottom) {
// se con rotazione per minimizzare la sporgenza
if ( m_AggrBottom.nType == 3) {
// imposto rotazione su punto standard
Vector3d vtAux = m_vtAggrBottom ;
vtAux.Rotate( Z_AX, 0, 1) ;
SetAuxDir( vtAux) ;
}
// aggiuntivo in Z
double dAggZ = ( bBottomOutStart ? 0. : max( dElev + max( dSafeAggrBottZ, dAppr), 0.)) ;
// post-retract
Point3d ptP0 = ptP - Z_AX * dAggZ + m_vtAggrBottom * ( dDistBottom + m_AggrBottom.dEncH + dSafeZ) ;
Point3d ptP00 = ptP0 + Z_AX * ( m_AggrBottom.dEncV + m_TParams.m_dLen + dAggZ - dElev) ;
if ( AddRapidMove( ptP0, bSplitArcs, MCH_CL_AGB_OUT) == GDB_ID_NULL)
return false ;
// se rinvio da sotto che richiede speciale rotazione
// se richiede speciale rotazione
if ( m_AggrBottom.nType == 1) {
Point3d ptP00 = ptP0 + Z_AX * ( m_AggrBottom.dEncV + m_TParams.m_dLen + dAggZ - dElev) ;
Vector3d vtAux = m_vtAggrBottom ;
vtAux.Rotate( Z_AX, 0, 1) ;
SetAuxDir( vtAux) ;
@@ -5390,7 +5429,7 @@ Pocketing::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector
if ( GetElevation( m_nPhase, ptP1 - 10 * EPS_SMALL * vtN, vtN, GetRadiusForStartEndElevation(), vtN, dEndElev))
dElev = dEndElev ;
// correzione per punto sotto il grezzo con testa normale da sopra
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeZ = GetSafeZ() ;
bool bAhUnderRaw = m_bAboveHead && ! m_bAggrBottom && ! m_bTiltingTab &&
GetAhPointUnderRaw( ptP1, vtN, 0, GetRadiusForStartEndElevation(),
m_TParams.m_dLen, false, dSafeZ, vtN, dElev) ;
@@ -5428,7 +5467,7 @@ Pocketing::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector
if ( GetElevation( m_nPhase, ptP1 - 10 * EPS_SMALL * vtN, vtN, GetRadiusForStartEndElevation(), vtN, dEndElev))
dElev = dEndElev ;
// correzione per punto sotto il grezzo con testa normale da sopra
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeZ = GetSafeZ() ;
bool bAhUnderRaw = m_bAboveHead && ! m_bAggrBottom && ! m_bTiltingTab &&
GetAhPointUnderRaw( ptP1, vtN, 0, GetRadiusForStartEndElevation(),
m_TParams.m_dLen, false, dSafeZ, vtN, dElev) ;
@@ -5482,7 +5521,7 @@ Pocketing::GetMidOfLongestOpenSide( const ICurveComposite* pCompo, Point3d& ptMi
}
pMyCrv = pCompo->GetNextCurve() ;
}
// richiedo lunghezza superiore a diametro utensile più doppio offset radiale
// richiedo lunghezza superiore a diametro utensile più doppio offset radiale
double dRefLen = ( bAllOpen ? 0 : m_TParams.m_dDiam + 2 * GetOffsR() - EPS_SMALL) ;
double dMaxLen = dRefLen ;
// ciclo sulle singole curve
@@ -5503,7 +5542,7 @@ Pocketing::GetMidOfLongestOpenSide( const ICurveComposite* pCompo, Point3d& ptMi
pNextCrv->GetLength( dLenNext) ;
// verifico la curva corrente
if ( pCrv->GetTempProp() == 1) {
// contributo dalle entità adiacenti (se non tutte aperte)
// contributo dalle entità adiacenti (se non tutte aperte)
double dLenAgg = 0 ;
if ( ! bAllOpen) {
if ( pPrevCrv != nullptr && pPrevCrv->GetTempProp() == 1) {
@@ -5517,7 +5556,7 @@ Pocketing::GetMidOfLongestOpenSide( const ICurveComposite* pCompo, Point3d& ptMi
dLenAgg += max( 0.4, vtEnd * vtNextStart) * dLenNext ;
}
}
// entità corrente
// entità corrente
double dLen = 0 ;
if ( pCrv->GetLength( dLen)) {
const double LEN_TOL = 1 ;
@@ -5535,7 +5574,7 @@ Pocketing::GetMidOfLongestOpenSide( const ICurveComposite* pCompo, Point3d& ptMi
vtMidOrt.Rotate( vtExtr, 0, -1) ;
}
}
// se più lunga
// se più lunga
else if ( dLen + dLenAgg > dMaxLen) {
dMaxLen = dLen + dLenAgg ;
pCrv->GetMidPoint( ptMid) ;
@@ -5567,14 +5606,14 @@ Pocketing::AdjustContourWithOpenEdges( ICurveComposite* pCompo)
Frame3d frPocket ;
Point3d ptStart ; pCompo->GetStartPoint( ptStart) ;
frPocket.Set( ptStart, vtExtr) ;
// sposto l'inizio a metà del tratto più lungo
// sposto l'inizio a metà del tratto più lungo
AdjustContourStart( pCompo) ;
// raggio di riferimento per offset
double dOutEdge = 0.5 * m_TParams.m_dDiam ;
if ( m_Params.m_nSubType == POCKET_SUB_SPIRALIN || m_Params.m_nSubType == POCKET_SUB_ZIGZAG)
dOutEdge = max( dOutEdge, m_TParams.m_dDiam - m_Params.m_dSideStep) ;
double dRad = dOutEdge + GetOffsR() ;
// estraggo parti con proprietà uniforme in un vettore
// estraggo parti con proprietà uniforme in un vettore
ICURVEPOVECTOR vpCrvs ;
int nCurrTempProp ;
int nParStart = 0 ;
@@ -5723,7 +5762,7 @@ Pocketing::AdjustContourWithOpenEdges( ICurveComposite* pCompo)
bool
Pocketing::AdjustContourStart( ICurveComposite* pCompo)
{
// cerco il tratto lineare più lungo che non sia aperto
// cerco il tratto lineare più lungo che non sia aperto
int i = 0 ;
int nMax = - 1 ;
double dLenMax = 0 ;
@@ -5737,8 +5776,8 @@ Pocketing::AdjustContourStart( ICurveComposite* pCompo)
++ i ;
pCrv = pCompo->GetNextCurve() ;
}
// se non trovato o troppo corto, cerco il tratto generico più lungo
if ( nMax < 0 || dLenMax < 2 * m_TParams.m_dDiam) {
// se non trovato o troppo corto, cerco il tratto generico più lungo
if ( nMax < 0 || dLenMax < 1.25 * m_TParams.m_dDiam) {
i = 0 ;
pCrv = pCompo->GetFirstCurve() ;
while ( pCrv != nullptr) {
+2 -1
View File
@@ -397,7 +397,8 @@ bool
PocketingData::VerifySubType( int nVal) const
{
return ( nVal == POCKET_SUB_ZIGZAG || nVal == POCKET_SUB_ONEWAY ||
nVal == POCKET_SUB_SPIRALIN || nVal == POCKET_SUB_SPIRALOUT) ;
nVal == POCKET_SUB_SPIRALIN || nVal == POCKET_SUB_SPIRALOUT ||
nVal == POCKET_SUB_CONFORMAL_ZIGZAG || nVal == POCKET_SUB_CONFORMAL_ONEWAY) ;
}
//----------------------------------------------------------------------------
+58 -8
View File
@@ -414,7 +414,7 @@ Processor::ProcessClPath( int nClPathId, int nClPathInd, int nOpId, int nOpInd)
// processo l'entità
if ( ! ProcessClEnt( nEntId, nEntInd, nClPathId, nClPathInd, nOpId, nOpInd))
bOk = false ;
// passo all'entità successivo
// passo all'entità successiva
nEntId = m_pGeomDB->GetNext( nEntId) ;
}
@@ -449,19 +449,24 @@ Processor::ProcessClEnt( int nEntId, int nEntInd, int nClPathId, int nClPathInd,
if ( pCamData == nullptr || pCamData->GetAxesStatus() != CamData::AS_OK)
return false ;
const DBLVECTOR& AxesEnd = pCamData->GetAxesVal() ;
// Emetto movimento
int nMove = pCamData->GetMoveType() ;
// Recupero i dati Cam del movimento successivo del percorso (se esiste)
CamData* pNextCamData = GetCamData( m_pGeomDB->GetUserObj( m_pGeomDB->GetNext( nEntId))) ;
int nMoveNext = ( pNextCamData != nullptr ? pNextCamData->GetMoveType() : -1) ;
DBLVECTOR AxesNull ;
const DBLVECTOR& AxesNext = ( pNextCamData != nullptr ? pNextCamData->GetAxesVal() : AxesNull) ;
// Emetto movimento
switch ( nMove) {
case 0 : // rapido
if ( ! OnRapid( nEntId, nEntInd, nMove, AxesEnd, pCamData->GetAxesMask(),
pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(),
pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex()))
pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex(), nMoveNext, AxesNext))
return false ;
break ;
case 1 : // linea
if ( ! OnLinear( nEntId, nEntInd, nMove, AxesEnd,
pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(),
pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex()))
pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex(), nMoveNext, AxesNext))
return false ;
break ;
case 2 : // arco CW
@@ -471,7 +476,7 @@ Processor::ProcessClEnt( int nEntId, int nEntInd, int nClPathId, int nClPathInd,
if ( ! OnArc( nEntId, nEntInd, nMove, AxesEnd,
pCamData->GetAxesCen(), ptMid, pCamData->GetAxesRad(), pCamData->GetAxesAngCen(),
pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(),
pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex()))
pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex(), nMoveNext, AxesNext))
return false ;
break ;
}
@@ -974,7 +979,7 @@ Processor::OnPathEndAux( int nInd, const string& sAE)
bool
Processor::OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, int nAxesMask,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
int nFlag, int nFlag2, int nIndex)
int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext)
{
// cancello variabili estranee
ResetArcData() ;
@@ -1006,6 +1011,21 @@ Processor::OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG2, nFlag2) ;
// assegno il valore dell'indice
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, nIndex) ;
// anticipazione di alcuni dati dell'eventuale movimento successivo dello stesso percorso
if ( nMoveNext != -1) {
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVESUCC, nMoveNext) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
if ( i <= nNumAxes)
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot), AxesNext[i-1]) ;
else
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot)) ;
}
}
else {
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_MOVESUCC) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i)
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot)) ;
}
// chiamo la funzione di movimento in rapido
bOk = bOk && CallOnRapid() ;
return bOk ;
@@ -1015,7 +1035,7 @@ Processor::OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd
bool
Processor::OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
double dFeed, int nFlag, int nFlag2, int nIndex)
double dFeed, int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext)
{
// cancello variabili estranee
ResetArcData() ;
@@ -1047,6 +1067,21 @@ Processor::OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEn
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG2, nFlag2) ;
// assegno il valore dell'indice
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, nIndex) ;
// anticipazione di alcuni dati dell'eventuale movimento successivo dello stesso percorso
if ( nMoveNext != -1) {
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVESUCC, nMoveNext) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
if ( i <= nNumAxes)
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot), AxesNext[i-1]) ;
else
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot)) ;
}
}
else {
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_MOVESUCC) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i)
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot)) ;
}
// chiamo la funzione di movimento in rapido
bOk = bOk && CallOnLinear() ;
return bOk ;
@@ -1057,7 +1092,7 @@ bool
Processor::OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
const Point3d& ptCen, const Point3d& ptMid, double dRad, double dAngCen,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
double dFeed, int nFlag, int nFlag2, int nIndex)
double dFeed, int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext)
{
// assegno Id e indice entità di movimento
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEID, nEntId) ;
@@ -1099,6 +1134,21 @@ Processor::OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG2, nFlag2) ;
// assegno il valore dell'indice
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, nIndex) ;
// anticipazione di alcuni dati dell'eventuale movimento successivo dello stesso percorso
if ( nMoveNext != -1) {
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVESUCC, nMoveNext) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
if ( i <= nNumAxes)
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot), AxesNext[i-1]) ;
else
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot)) ;
}
}
else {
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_MOVESUCC) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i)
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot)) ;
}
// chiamo la funzione di movimento in rapido
bOk = bOk && CallOnArc() ;
return bOk ;
+3 -3
View File
@@ -61,14 +61,14 @@ class Processor
bool OnPathEndAux( int nInd, const std::string& sAE) ;
bool OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, int nAxesMask,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
int nFlag, int nFlag2, int nIndex) ;
int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext) ;
bool OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
double dFeed, int nFlag, int nFlag2, int nIndex) ;
double dFeed, int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext) ;
bool OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
const Point3d& ptCen, const Point3d& ptMid, double dRad, double dAngCen,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
double dFeed, int nFlag, int nFlag2, int nIndex) ;
double dFeed, int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext) ;
bool ResetArcData( void) ;
protected :
+13 -15
View File
@@ -1325,7 +1325,7 @@ SawFinishing::CalculateStraightAcrossToolPath( int nAuxId, int nClId)
// se ZigZag aggiungo risalita
if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG) {
// recupero distanza di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeZ = GetSafeZ() ;
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
// aggiungo retrazione
@@ -1646,7 +1646,7 @@ SawFinishing::CalculateCurvedAcrossToolPath( int nAuxId, int nClId)
double dEndElev = 0 ;
GetElevation( m_nPhase, ptPrev, vtPrev, dEndElev) ;
// aggiungo retrazione
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeZ = GetSafeZ() ;
double dAppr = m_Params.m_dStartPos ;
if ( ! AddRetract( ptPrev, vtPrev, dSafeZ, dEndElev, dAppr))
return false ;
@@ -1670,7 +1670,7 @@ SawFinishing::CalculateCurvedAcrossToolPath( int nAuxId, int nClId)
// se ZigZag aggiungo risalita
if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG) {
// recupero distanza di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeZ = GetSafeZ() ;
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
// recupero punto e versore correzione finali
@@ -1880,7 +1880,6 @@ SawFinishing::ClassifySection( ICurve* pCrv, INTVECTOR& vnClass)
{
const ICurveComposite* pCompo = GetCurveComposite( pCrv) ;
if ( pCompo != nullptr) {
int Ind = 0 ;
const ICurve* pSimpCrv = pCompo->GetFirstCurve() ;
while ( pSimpCrv != nullptr) {
// analizzo la curva
@@ -1898,7 +1897,6 @@ SawFinishing::ClassifySection( ICurve* pCrv, INTVECTOR& vnClass)
else
vnClass.push_back( CCL_FALL) ;
// passo alla curva successiva
++ Ind ;
pSimpCrv = pCompo->GetNextCurve() ;
}
}
@@ -1991,7 +1989,7 @@ SawFinishing::CalcAlongVerticalCuts( ICurve* pSect, int nUmin, int nUmax, const
// se ZigZag e non centrato aggiungo risalita
if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG && m_Params.m_nLeadLinkType != SAWFIN_LL_CENT) {
// recupero distanza di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeZ = GetSafeZ() ;
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
// aggiungo retrazione
@@ -2078,7 +2076,7 @@ SawFinishing::CalcAlongStdCuts( ICurve* pSect, double dUmin, double dUmax,
// se ZigZag e non centrato aggiungo risalita
if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG && m_Params.m_nLeadLinkType != SAWFIN_LL_CENT) {
// recupero distanza di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeZ = GetSafeZ() ;
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
// aggiungo retrazione
@@ -2096,7 +2094,7 @@ SawFinishing::CalcAlongOneWayCut( const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bVert)
{
// recupero distanza di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeZ = GetSafeZ() ;
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
@@ -2145,7 +2143,7 @@ SawFinishing::CalcAlongZigZagCut( const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bVert, bool bFirst)
{
// recupero distanza di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeZ = GetSafeZ() ;
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
@@ -2262,7 +2260,7 @@ SawFinishing::CalcAcrossOneWayCut( const PolyLine& PL, const Vector3d& vtMove,
const Vector3d& vtTool, const Vector3d& vtCorr, double dRawZ, double dDepth)
{
// recupero distanza di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeZ = GetSafeZ() ;
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
@@ -2319,7 +2317,7 @@ SawFinishing::CalcAcrossZigZagCut( const PolyLine& PL, const Vector3d& vtMove,
const Vector3d& vtTool, const Vector3d& vtCorr, double dRawZ, double dDepth, bool bFirst)
{
// recupero distanza di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeZ = GetSafeZ() ;
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
@@ -2427,7 +2425,7 @@ SawFinishing::CalcCurvedAlongVerticalCuts( ICurve* pSect, int nUmin, int nUmax,
// se ZigZag e non centrato aggiungo risalita
if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG && m_Params.m_nLeadLinkType != SAWFIN_LL_CENT) {
// recupero distanza di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeZ = GetSafeZ() ;
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
// aggiungo retrazione
@@ -2502,7 +2500,7 @@ SawFinishing::CalcCurvedAlongStdCuts( ICurve* pSect, double dUmin, double dUmax,
// se ZigZag e non centrato aggiungo risalita
if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG && m_Params.m_nLeadLinkType != SAWFIN_LL_CENT) {
// recupero distanza di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeZ = GetSafeZ() ;
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
// aggiungo retrazione
@@ -2520,7 +2518,7 @@ bool
SawFinishing::CalcCurvedAlongZigZagCut( const ICurve* pCut, const Vector3d& vtTool, bool bVert, bool bFirst, double& dEndElev)
{
// recupero distanza di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeZ = GetSafeZ() ;
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
// verifico se passata da invertire (indice dispari)
@@ -2696,7 +2694,7 @@ SawFinishing::CalcCurvedAcrossZigZagCut( const PolyLine& PL, const Vector3d& vtM
bool bFirst, bool bCorner)
{
// recupero distanza di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeZ = GetSafeZ() ;
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
+3 -3
View File
@@ -1560,7 +1560,7 @@ SawRoughing::CalculateOneWayCut( const Point3d& ptStart, const Point3d& ptEnd, c
const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bFirst, bool bLast)
{
// recupero distanza di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeZ = GetSafeZ() ;
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
@@ -1654,7 +1654,7 @@ SawRoughing::CalculateZigZagCut( const Point3d& ptStart, const Point3d& ptEnd, c
int& nCount)
{
// recupero distanza di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeZ = GetSafeZ() ;
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
@@ -1865,7 +1865,7 @@ SawRoughing::CalculateCurvedZigZagCut( const ICurve* pCut, const Vector3d& vtToo
int& nCount)
{
// recupero distanza di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeZ = GetSafeZ() ;
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
// verifico se passata da invertire (indice dispari)
+12 -13
View File
@@ -1245,7 +1245,7 @@ Sawing::GetCurve( SelData Id)
pCrvCompo->ToGlob( frGlob) ;
vtN.ToGlob( frGlob) ;
// sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, 0, 1) ;
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, V_NULL, 0, 1) ;
// aggiusto lato lavoro e inverti, angolo di fianco e lato mandrino
if ( m_Params.m_nWorkSide == SAW_WS_CENTER)
m_Params.m_nWorkSide = SAW_WS_RIGHT ;
@@ -1294,7 +1294,7 @@ Sawing::GetCurve( SelData Id)
pCrvCompo->ToGlob( frGlob) ;
vtN.ToGlob( frGlob) ;
// sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, 0, 1) ;
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, V_NULL, 0, 1) ;
// aggiusto lato lavoro e inverti, angolo di fianco e lato mandrino
if ( m_Params.m_nWorkSide == SAW_WS_CENTER)
m_Params.m_nWorkSide = SAW_WS_RIGHT ;
@@ -1962,7 +1962,7 @@ Sawing::GenerateLinePv( const ICurveLine* pLine, const Vector3d& vtTool, const V
m_pGeomDB->SetMaterial( nId3, BLUE) ;
// valore di allungamento
double dExtraL = m_pMchMgr->GetCurrMachiningsMgr()->GetExtraLOnCutRegion() ;
double dExtraL = GetExtraLOnCutRegion() ;
// punti notevoli per regioni
Point3d ptRIni = ptIni ;
@@ -2112,7 +2112,7 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
SetToolDir( vtTool) ;
SetCorrAuxDir( vtCorr) ;
// recupero distanza di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeZ = GetSafeZ() ;
// distanza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
// flag di taglio inclinato
@@ -2303,10 +2303,9 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
Point3d ptP4 = pLine->GetEnd() + vtCorr * ( dElev + dAppr / vtCorr.z) ;
if ( AddLinearMove( ptP4) == GDB_ID_NULL)
return false ;
// movimento di ritorno spora il punto iniziale
SetFeed( GetEndFeed()) ;
// movimento di ritorno in rapido sopra il punto iniziale
Point3d ptP5 = pLine->GetStart() + vtCorr * ( dElev + dAppr / vtCorr.z) ;
if ( AddLinearMove( ptP5) == GDB_ID_NULL)
if ( AddRapidMove( ptP5) == GDB_ID_NULL)
return false ;
}
}
@@ -2339,7 +2338,7 @@ Sawing::ProcessExtCurve( const ICurve* pCrvP, const ICurveComposite* pCrvC, cons
dMinRad = dRad ;
}
}
if ( dMinRad < m_pMchMgr->GetCurrMachiningsMgr()->GetExtSawArcMinRad()) {
if ( dMinRad < GetExtSawArcMinRad()) {
m_pMchMgr->SetWarning( 2258, "Warning in Sawing : Radius too small in ExtSawArc") ;
return true ;
}
@@ -2493,7 +2492,7 @@ Sawing::GenerateExtCurvePv( const ICurveComposite* pCrv, double dOffs,
colCut = FUCHSIA ;
// dimensione da aggiungere alle regioni nelle parti in cui la lama è inclinata
double dExtraL = m_pMchMgr->GetCurrMachiningsMgr()->GetExtraLOnCutRegion() ;
double dExtraL = GetExtraLOnCutRegion() ;
// lunghezza taglio parziale
double dDeltaT = (( dElev < 0.5 * m_TParams.m_dDiam) ? sqrt( dElev * m_TParams.m_dDiam - dElev * dElev) : 0) ;
@@ -2865,7 +2864,7 @@ Sawing::GenerateExtCurveCl( const ICurveComposite* pCrv,
SetPathId( nPxId) ;
SetCorrAuxDir( vtStaCorr) ;
// recupero distanza di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeZ = GetSafeZ() ;
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
@@ -3125,7 +3124,7 @@ Sawing::ProcessIntArc( const ICurve* pCrvP, const ICurveArc* pArcC, const ICurve
if ( IsNull( pArc))
return false ;
// determino l'inclinazione per ottenere il raggio e ne verifico il limite
double dMaxSideAng = m_pMchMgr->GetCurrMachiningsMgr()->GetIntSawArcMaxSideAng()+ EPS_ANG_SMALL ;
double dMaxSideAng = GetIntSawArcMaxSideAng() + EPS_ANG_SMALL ;
double dSawRad = m_TParams.m_dDiam / 2 ;
double dRad = pArc->GetRadius() ;
double dSinA = dSawRad / dRad ;
@@ -3314,7 +3313,7 @@ Sawing::GenerateIntArcPv( const ICurveArc* pArc,
m_pGeomDB->SetMaterial( nId3, BLUE) ;
// dimensione da aggiungere alle regioni nelle parti in cui la lama è inclinata
double dExtraL = m_pMchMgr->GetCurrMachiningsMgr()->GetExtraLOnCutRegion() ;
double dExtraL = GetExtraLOnCutRegion() ;
// regione ridotta di taglio per nesting (escluse parti iniziali e finali)
PtrOwner<ICurveComposite> pCmpRr( GenerateIntArcPvTrueCut( pArc, dDeltaInt, dDeltaExt, dExtraL)) ;
@@ -3572,7 +3571,7 @@ Sawing::GenerateIntArcCl( const ICurveArc* pArc,
// Imposto dati comuni
SetPathId( nPxId) ;
// recupero distanza di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeZ = GetSafeZ() ;
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
+28 -156
View File
@@ -1,25 +1,24 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2023
// EgalTech 2015-2024
//----------------------------------------------------------------------------
// File : Simulator.h Data : 16.01.23 Versione : 2.5a2
// Contenuto : Dichiarazione della classe Simulator.
// File : Simulator.h Data : 01.09.24 Versione : 2.6i1
// Contenuto : Dichiarazione della classe interfaccia ISimulator.
//
//
//
// Modifiche : 19.10.15 DS Creazione modulo.
// Modifiche : 01.09.24 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "CamData.h"
#include "/EgtDev/Include/EGkVector3d.h"
#include "/EgtDev/Include/EMkSimuGenConst.h"
#include "/EgtDev/Include/EgtNumCollection.h"
#include <string>
class MachMgr ;
class IGeomDB ;
class Machine ;
class PerformanceCounter ;
//------------------------ Struttura per movimento esterno assi --------------
struct SimAxMv
@@ -38,154 +37,27 @@ enum SimAxMvRes { SIM_AXMV_RES_STOP = -1,
SIM_AXMV_RES_OK = 1} ;
//----------------------------------------------------------------------------
class Simulator
class __declspec( novtable) ISimulator
{
public :
Simulator( void) ;
~Simulator( void) ;
bool Init( MachMgr* pMchMgr) ;
bool Start( bool bFirst) ;
bool Move( int& nStatus) ;
bool GoHome( void) ;
bool SetStep( double dStep) ;
bool SetUiStatus( int nUiStatus) ;
bool GetAxisInfoPos( int nI, std::string& sName, std::string& sToken, bool& bLinear, double& dVal) const ;
bool GetToolInfo( std::string& sName, double& dSpeed) const ;
bool GetOperationInfo( std::string& sName, int& nType) const ;
bool GetMoveInfo( int& nGmove, double& dFeed) const ;
bool AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
bool ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) ;
bool OnCollision( int nCdInd, int nObjInd, int& nErr) ;
bool SetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, const INTVECTOR& vVmill, bool bFirst) ;
int MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) ;
private :
bool UpdateTool( bool bFirst, int& nErr) ;
bool UpdateAxes( void) ;
bool UpdateAxesPos( void) ;
bool ResetInterpolation( void) ;
bool ResetAxes( void) ;
bool ResetAuxAxes( void) ;
private :
bool VerifySetup( void) ;
bool FindAndManageOperationStart( bool bStart, bool bFirst, int& nStatus) ;
bool ManageOperationEnd( int& nStatus) ;
bool FindAndManagePathStart( int& nStatus) ;
bool ManagePathEnd( int& nStatus) ;
bool ManagePathStartAux( int& nStatus) ;
bool ManagePathEndAux( int& nStatus) ;
bool ManageMove( int& nStatus) ;
bool ManageSingleMove( int& nStatus, double& dMove) ;
int CalcStatusOnError( int nErr) ;
bool GetHeadCurrPosDirAux( const std::string& sHead, int nExit, Point3d& ptH, Vector3d& vtH, Vector3d& vtA) ;
bool ExecLineVmill( int nVmId, int nCurrTool, double dVmTdOffs, double dVmAdOffs,
const Point3d& ptHi, const Vector3d& vtHi, const Vector3d& vtAi, const Frame3d& frVzmI,
const Point3d& ptHf, const Vector3d& vtHf, const Vector3d& vtAf, const Frame3d& frVzmF) ;
bool NeedCollisionCheck( void) const
{ return ( ! m_CollObj.empty() && ! m_CdId.empty()) ; }
bool Stopped( void)
{ return ( m_nUiStatus == MCH_UISIM_STOP) ; }
bool OnInit( void) ;
bool OnExit( void) ;
bool OnProgramStart( bool bFirst) ;
bool OnProgramEnd( void) ;
bool OnDispositionStarting( int nOpId, int nOpInd, int nPhase,
const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ;
bool OnDispositionStart( int nOpId, int nOpInd, int nPhase,
const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ;
bool OnDispositionEnd( void) ;
bool OnToolSelect( const std::string& sTool, const std::string& sHead, int nExit, const std::string& sTcPos, bool bFirst, int& nErr) ;
bool OnToolDeselect( const std::string& sNextTool, const std::string& sNextHead, int nNextExit, const std::string& sNextTcPos, int& nErr) ;
bool OnMachiningStart( int nOpId, int nOpInd, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax) ;
bool OnMachiningEnd( void) ;
bool OnPathStartAux( int nInd, const std::string& sAS, int& nErr) ;
bool OnPathEndAux( int nInd, const std::string& sAE, int& nErr) ;
bool OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev) ;
bool OnPathEnd( int nAE) ;
bool OnMoveStart( const CamData* pCamData, int& nErr) ;
bool OnMoveEnd( int& nErr) ;
bool OnResetMachine( void) ;
private :
struct CollObj {
int nInd ;
bool bToolOn ;
int nFrameId ;
int nType ;
Vector3d vtMove ;
double dPar1 ;
double dPar2 ;
double dPar3 ;
CollObj( void) : nInd( 0), bToolOn( false), nFrameId( -1), nType( 0), vtMove(), dPar1( 0), dPar2( 0), dPar3( 0) {}
CollObj( int nI, bool bTOn, int nF, int nT, const Vector3d& vtM, double dP1, double dP2, double dP3)
: nInd( nI), bToolOn( bTOn), nFrameId( nF), nType( nT), vtMove( vtM), dPar1( dP1), dPar2( dP2), dPar3( dP3) {}
} ;
typedef std::vector<CollObj> COBVECTOR ;
struct VmTool
{
std::string sName ;
std::string sHead ;
int nExit ;
double dTdOffs ;
double dAdOffs ;
VmTool( void) : nExit( 0), dTdOffs( 0), dAdOffs( 0) {}
VmTool( std::string sN, std::string sH, int nE, double dT, double dA)
: sName( sN), sHead( sH), nExit( nE), dTdOffs( dT), dAdOffs( dA) {}
} ;
typedef std::vector<VmTool> VMTVECTOR ;
enum { SIS_CREATED = 0,
SIS_INITIALIZED = 1,
SIS_READYTOSTART = 2,
SIS_READYTORUN = 3} ;
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)
int m_nAuxSTot ; // numero totale movimenti ausiliari di inizio percorso
int m_nAuxSInd ; // indice del movimento ausiliario di inizio percorso corrente
int m_nAuxETot ; // numero totale movimenti ausiliari di fine percorso
int m_nAuxEInd ; // indice del movimento ausiliario di fine percorso corrente
std::string m_sTool ; // nome dell'utensile corrente
std::string m_sHead ; // nome della testa corrente
int m_nExit ; // indice dell'uscita corrente
double m_dTDiam ; // diametro dell'utensile corrente
bool m_bCutOnTip ; // flag capacità di lavorare di testa dell'utensile corrente
INTVECTOR m_VmId ; // vettore identificativi Zmap per Virtual Milling
INTVECTOR m_CdId ; // vettore identificativi Zmap per Collision Detection
VMTVECTOR m_VmTool ; // vettore utensili attivi per virtual milling
COBVECTOR m_CollObj ; // vettore oggetti da testare per collisione con grezzo
double m_dSafeDist ; // distanza di sicurezza per verifica collisioni
int m_nAxesMask ; // maschera a bit di abilitazione movimento assi (solo se rapido)
bool m_bEnabAxes ; // flag abilitazione movimento assi attivi
bool m_bShowAxes ; // flag visualizzazione assi attivi
STRVECTOR m_AxesName ; // nomi degli assi macchina attivi
STRVECTOR m_AxesToken ; // token degli assi macchina attivi
BOOLVECTOR m_AxesInvert ; // flag di asse con verso invertito degli assi macchina attivi
DBLVECTOR m_AxesOffset ; // valore di offset delgli assi macchina ttivi
BOOLVECTOR m_AxesLinear ; // flag di lineare degli assi macchina attivi
DBLVECTOR m_AxesVal ; // valori degli assi macchina all'inizio del movimento corrente
STRVECTOR m_AuxAxesName ; // nomi degli assi macchina ausiliari abilitati
STRVECTOR m_AuxAxesToken ; // token degli assi macchina ausiliari abilitati
BOOLVECTOR m_AuxAxesInvert ; // flag di asse con verso invertito degli assi macchina ausiliari abilitati
DBLVECTOR m_AuxAxesOffset ; // valore di offset degli assi macchina ausiliari abilitati
BOOLVECTOR m_AuxAxesLinear ; // flag di lineare degli assi macchina ausiliari abilitati
DBLVECTOR m_AuxAxesVal ; // valori degli assi macchina ausiliari all'inizio del movimento corrente
DBLVECTOR m_AuxAxesEnd ; // valori degli assi macchina ausiliari alla fine del movimento corrente
INTVECTOR m_AuxAxesLink ; // indice + 1 asse principale di aggancio (negativo valore opposto, 0 nessuno)
virtual ~ISimulator( void) {}
virtual bool Init( MachMgr* pMchMgr) = 0 ;
virtual bool Start( bool bFirst) = 0 ;
virtual bool Move( int& nStatus) = 0 ;
virtual bool GoHome( void) = 0 ;
virtual bool SetStep( double dStep) = 0 ;
virtual bool SetUiStatus( int nUiStatus) = 0 ;
virtual bool GetAxisInfoPos( int nI, std::string& sName, std::string& sToken, bool& bLinear, double& dVal) const = 0 ;
virtual bool GetToolInfo( std::string& sName, double& dSpeed) const = 0 ;
virtual bool GetOperationInfo( std::string& sName, int& nType) const = 0 ;
virtual bool GetMoveInfo( int& nGmove, double& dFeed) const = 0 ;
virtual bool AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType,
const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) = 0 ;
virtual bool ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) = 0 ;
virtual bool OnCollision( int nCdInd, int nObjInd, int& nErr) = 0 ;
virtual bool SetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, int nFlag,
double dPar1, double dPar2, const INTVECTOR& vVmill, bool bFirst) = 0 ;
virtual bool EnableToolsForVmill( bool bEnable) = 0 ;
virtual int MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) = 0 ;
virtual bool SaveCmd( int nType, int nPar, const std::string& sPar) = 0 ;
} ;
+2573
View File
File diff suppressed because it is too large Load Diff
+209
View File
@@ -0,0 +1,209 @@
//----------------------------------------------------------------------------
// EgalTech 2024-2024
//----------------------------------------------------------------------------
// File : SimulatorMP.h Data : 01.09.24 Versione : 2.6i1
// Contenuto : Dichiarazione della classe SimulatorMP.
// Simulatore multi-processo.
//
//
// Modifiche : 01.09.24 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "Simulator.h"
#include "CamData.h"
class IGeomDB ;
class Machine ;
class PerformanceCounter ;
//----------------------------------------------------------------------------
ISimulator* CreateSimulatorMP( void) ;
//----------------------------------------------------------------------------
class SimulatorMP : public ISimulator
{
public : // ISimulator
~SimulatorMP( void) override ;
bool Init( MachMgr* pMchMgr) override ;
bool Start( bool bFirst) override ;
bool Move( int& nStatus) override ;
bool GoHome( void) override ;
bool SetStep( double dStep) override ;
bool SetUiStatus( int nUiStatus) override ;
bool GetAxisInfoPos( int nI, std::string& sName, std::string& sToken, bool& bLinear, double& dVal) const override ;
bool GetToolInfo( std::string& sName, double& dSpeed) const override ;
bool GetOperationInfo( std::string& sName, int& nType) const override ;
bool GetMoveInfo( int& nGmove, double& dFeed) const override ;
bool AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType,
const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) override ;
bool ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) override ;
bool OnCollision( int nCdInd, int nObjInd, int& nErr) override ;
bool SetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, int nFlag,
double dPar1, double dPar2, const INTVECTOR& vVmill, bool bFirst) override ;
bool EnableToolsForVmill( bool bEnable) override ;
int MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) override ;
bool SaveCmd( int nType, int nPar, const std::string& sPar) override ;
public :
SimulatorMP( void) ;
private :
bool UpdateMachiningTool( bool bFirst, bool& bDeselect, int& nErr) ;
bool UpdateDispositionTool( bool bFirst, int& nErr) ;
bool UpdateAxes( void) ;
bool UpdateAxesPos( void) ;
bool ResetInterpolation( void) ;
bool ResetAxes( void) ;
bool ResetAuxAxes( void) ;
private :
bool VerifySetup( void) ;
bool FindAndManageOperationStart( bool bStart, bool bFirst, bool& bChangedTool, int& nStatus) ;
bool ManageOperationEnd( int& nStatus) ;
bool FindAndManagePathStart( int& nStatus) ;
bool ManagePathEnd( int& nStatus) ;
bool ManagePathStartAux( int& nStatus) ;
bool ManagePathEndAux( int& nStatus) ;
bool ManageMove( int& nStatus) ;
bool ManageSingleMove( int& nStatus, double& dMove) ;
int CalcStatusOnError( int nErr) ;
bool GetHeadCurrPosDirAux( const std::string& sHead, int nExit, Point3d& ptH, Vector3d& vtH, Vector3d& vtA) ;
bool ExecLineVmill( int nVmId, int nCurrTool, double dVmTdOffs, double dVmAdOffs,
const Point3d& ptHi, const Vector3d& vtHi, const Vector3d& vtAi, const Frame3d& frVzmI,
const Point3d& ptHf, const Vector3d& vtHf, const Vector3d& vtAf, const Frame3d& frVzmF) ;
bool NeedCollisionCheck( void) const
{ return ( ! m_CollObj.empty() && ! m_CdId.empty()) ; }
bool Stopped( void)
{ return ( m_nUiStatus == MCH_UISIM_STOP) ; }
bool SetCollisionMark( int nCdInd, int nObjInd) ;
bool ResetCollisionMark( void) ;
bool OnInit( void) ;
bool OnExit( void) ;
bool OnProgramStart( bool bFirst) ;
bool OnProgramEnd( void) ;
bool OnDispositionStarting( int nOpId, int nOpInd, int nPhase,
const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ;
bool OnDispositionStart( int nOpId, int nOpInd, int nPhase,
const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ;
bool OnDispositionEnd( void) ;
bool OnToolSelect( const std::string& sTool, const std::string& sHead, int nExit, const std::string& sTcPos, bool bFirst, int& nErr) ;
bool OnToolDeselect( const std::string& sNextTool, const std::string& sNextHead, int nNextExit, const std::string& sNextTcPos, int& nErr) ;
bool OnMachiningStart( int nOpId, int nOpInd, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax) ;
bool OnMachiningEnd( void) ;
bool OnPathStartAux( int nInd, const std::string& sAS, int& nErr) ;
bool OnPathEndAux( int nInd, const std::string& sAE, int& nErr) ;
bool OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev) ;
bool OnPathEnd( int nAE) ;
bool OnMoveStart( const CamData* pCamData, const CamData* pNextCamData, int& nErr) ;
bool OnMoveEnd( int& nErr) ;
bool OnResetMachine( void) ;
bool ExecCmdData( int& nStatus) ;
bool ExecAllCmdData( int& nStatus) ;
private :
struct CollObj {
int nInd ;
bool bToolOn ;
int nFrameId ;
int nType ;
Vector3d vtMove ;
double dPar1 ;
double dPar2 ;
double dPar3 ;
CollObj( void) : nInd( 0), bToolOn( false), nFrameId( -1), nType( 0), vtMove(), dPar1( 0), dPar2( 0), dPar3( 0) {}
CollObj( int nI, bool bTOn, int nF, int nT, const Vector3d& vtM, double dP1, double dP2, double dP3)
: nInd( nI), bToolOn( bTOn), nFrameId( nF), nType( nT), vtMove( vtM), dPar1( dP1), dPar2( dP2), dPar3( dP3) {}
} ;
typedef std::vector<CollObj> COBVECTOR ;
struct VmTool
{
std::string sName ;
std::string sHead ;
int nExit ;
double dTdOffs ;
double dAdOffs ;
VmTool( void) : nExit( 0), dTdOffs( 0), dAdOffs( 0) {}
VmTool( std::string sN, std::string sH, int nE, double dT, double dA)
: sName( sN), sHead( sH), nExit( nE), dTdOffs( dT), dAdOffs( dA) {}
} ;
typedef std::vector<VmTool> VMTVECTOR ;
enum { SIS_CREATED = 0,
SIS_INITIALIZED = 1,
SIS_READYTOSTART = 2,
SIS_READYTORUN = 3} ;
private :
struct CmdData {
int nType ;
int nMoveType ;
SAMVECTOR vAxNaEpSt ;
int nPar ;
std::string sPar ;
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) {}
} ;
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
} ;
File diff suppressed because it is too large Load Diff
+188
View File
@@ -0,0 +1,188 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2024
//----------------------------------------------------------------------------
// File : SimulatorSP.h Data : 16.01.23 Versione : 2.5a2
// Contenuto : Dichiarazione della classe Simulator.
//
//
//
// Modifiche : 19.10.15 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "Simulator.h"
#include "CamData.h"
class IGeomDB ;
class Machine ;
class PerformanceCounter ;
//----------------------------------------------------------------------------
ISimulator* CreateSimulatorSP( void) ;
//----------------------------------------------------------------------------
class SimulatorSP : public ISimulator
{
public :
~SimulatorSP( void) override ;
bool Init( MachMgr* pMchMgr) override ;
bool Start( bool bFirst) override ;
bool Move( int& nStatus) override ;
bool GoHome( void) override ;
bool SetStep( double dStep) override ;
bool SetUiStatus( int nUiStatus) override ;
bool GetAxisInfoPos( int nI, std::string& sName, std::string& sToken, bool& bLinear, double& dVal) const override ;
bool GetToolInfo( std::string& sName, double& dSpeed) const override ;
bool GetOperationInfo( std::string& sName, int& nType) const override ;
bool GetMoveInfo( int& nGmove, double& dFeed) const override ;
bool AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType,
const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) override ;
bool ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) override ;
bool OnCollision( int nCdInd, int nObjInd, int& nErr) override ;
bool SetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, int nFlag,
double dPar1, double dPar2, const INTVECTOR& vVmill, bool bFirst) override ;
bool EnableToolsForVmill( bool bEnable) override ;
int MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) override ;
bool SaveCmd( int nType, int nPar, const std::string& sPar) override
{ return false ; }
public :
SimulatorSP( void) ;
private :
bool UpdateTool( bool bFirst, int& nErr) ;
bool UpdateAxes( void) ;
bool UpdateAxesPos( void) ;
bool ResetInterpolation( void) ;
bool ResetAxes( void) ;
bool ResetAuxAxes( void) ;
private :
bool VerifySetup( void) ;
bool FindAndManageOperationStart( bool bStart, bool bFirst, int& nStatus) ;
bool ManageOperationEnd( int& nStatus) ;
bool FindAndManagePathStart( int& nStatus) ;
bool ManagePathEnd( int& nStatus) ;
bool ManagePathStartAux( int& nStatus) ;
bool ManagePathEndAux( int& nStatus) ;
bool ManageMove( int& nStatus) ;
bool ManageSingleMove( int& nStatus, double& dMove) ;
int CalcStatusOnError( int nErr) ;
bool GetHeadCurrPosDirAux( const std::string& sHead, int nExit, Point3d& ptH, Vector3d& vtH, Vector3d& vtA) ;
bool ExecLineVmill( int nVmId, int nCurrTool, double dVmTdOffs, double dVmAdOffs,
const Point3d& ptHi, const Vector3d& vtHi, const Vector3d& vtAi, const Frame3d& frVzmI,
const Point3d& ptHf, const Vector3d& vtHf, const Vector3d& vtAf, const Frame3d& frVzmF) ;
bool NeedCollisionCheck( void) const
{ return ( ! m_CollObj.empty() && ! m_CdId.empty()) ; }
bool Stopped( void)
{ return ( m_nUiStatus == MCH_UISIM_STOP) ; }
bool SetCollisionMark( int nCdInd, int nObjInd) ;
bool ResetCollisionMark( void) ;
bool OnInit( void) ;
bool OnExit( void) ;
bool OnProgramStart( bool bFirst) ;
bool OnProgramEnd( void) ;
bool OnDispositionStarting( int nOpId, int nOpInd, int nPhase,
const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ;
bool OnDispositionStart( int nOpId, int nOpInd, int nPhase,
const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ;
bool OnDispositionEnd( void) ;
bool OnToolSelect( const std::string& sTool, const std::string& sHead, int nExit, const std::string& sTcPos, bool bFirst, int& nErr) ;
bool OnToolDeselect( const std::string& sNextTool, const std::string& sNextHead, int nNextExit, const std::string& sNextTcPos, int& nErr) ;
bool OnMachiningStart( int nOpId, int nOpInd, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax) ;
bool OnMachiningEnd( void) ;
bool OnPathStartAux( int nInd, const std::string& sAS, int& nErr) ;
bool OnPathEndAux( int nInd, const std::string& sAE, int& nErr) ;
bool OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev) ;
bool OnPathEnd( int nAE) ;
bool OnMoveStart( const CamData* pCamData, const CamData* pNextCamData, int& nErr) ;
bool OnMoveEnd( int& nErr) ;
bool OnResetMachine( void) ;
private :
struct CollObj {
int nInd ;
bool bToolOn ;
int nFrameId ;
int nType ;
Vector3d vtMove ;
double dPar1 ;
double dPar2 ;
double dPar3 ;
CollObj( void) : nInd( 0), bToolOn( false), nFrameId( -1), nType( 0), vtMove(), dPar1( 0), dPar2( 0), dPar3( 0) {}
CollObj( int nI, bool bTOn, int nF, int nT, const Vector3d& vtM, double dP1, double dP2, double dP3)
: nInd( nI), bToolOn( bTOn), nFrameId( nF), nType( nT), vtMove( vtM), dPar1( dP1), dPar2( dP2), dPar3( dP3) {}
} ;
typedef std::vector<CollObj> COBVECTOR ;
struct VmTool
{
std::string sName ;
std::string sHead ;
int nExit ;
double dTdOffs ;
double dAdOffs ;
VmTool( void) : nExit( 0), dTdOffs( 0), dAdOffs( 0) {}
VmTool( std::string sN, std::string sH, int nE, double dT, double dA)
: sName( sN), sHead( sH), nExit( nE), dTdOffs( dT), dAdOffs( dA) {}
} ;
typedef std::vector<VmTool> VMTVECTOR ;
enum { SIS_CREATED = 0,
SIS_INITIALIZED = 1,
SIS_READYTOSTART = 2,
SIS_READYTORUN = 3} ;
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)
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)
} ;
+874 -645
View File
File diff suppressed because it is too large Load Diff
+17 -12
View File
@@ -21,6 +21,7 @@
#include "/EgtDev/Include/EgtNumUtils.h"
class ICAvToolSurfTm ;
class ISurfFlatRegion ;
//----------------------------------------------------------------------------
class SurfFinishing : public Machining
@@ -73,22 +74,24 @@ class SurfFinishing : public Machining
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
bool Chain( int nGrpDestId) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
double dDepth, double dElev) ;
bool CalcZigZag( const ICurveComposite* pOffs, ICRVCOMPOPOVECTOR& vpCrvs) ;
bool AddSpiral( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
double dDepth, double dElev, bool bInVsOut) ;
bool CalcSpiral( const ICurveComposite* pCompo, bool bSplitArcs,
ICurveComposite* pMCrv, ICurveComposite* pRCrv) ;
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 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) ;
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN, Point3d& ptP1) const ;
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN) ;
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN, Point3d& ptP1) ;
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool, const Vector3d& vtNorm, Point3d& ptP1) const ;
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool, bool bSplitArcs) ;
bool CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtTool, const Vector3d& vtNorm, Point3d& ptP1) const ;
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Point3d& ptP1, const Vector3d& vtTool, bool bSplitArcs) ;
bool GetLastGoodPoint( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtTool, Point3d& ptP1) const ;
bool GetSurfaceNormalAtPoint( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
const Point3d& ptTool, const Vector3d& vtTool, Vector3d& vtNorm) const ;
bool GetActiveSurfaces( INTVECTOR& vSurfId) const ;
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
double GetRadiusForStartEndElevation( void) const ;
@@ -108,6 +111,8 @@ class SurfFinishing : public Machining
{ return ( IsUnknownValue( m_Params.m_dOffsR) ? m_TParams.m_dOffsR : m_Params.m_dOffsR) ; }
double GetSideStep( void) const
{ return Clamp( m_Params.m_dSideStep, 0.1, m_TParams.m_dTDiam) ; }
int GetLeadInType( void) const ;
int GetLeadOutType( void) const ;
private :
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
+2 -19
View File
@@ -147,7 +147,6 @@ SurfFinishingData::CopyFrom( const MachiningData* pMdata)
m_nLeadOutType = pSdata->m_nLeadOutType ;
m_dLoTang = pSdata->m_dLoTang ;
m_dLoPerp = pSdata->m_dLoPerp ;
m_nLeadLinkType = pSdata->m_nLeadLinkType ;
m_dApprox = pSdata->m_dApprox ;
m_sSysNotes = pSdata->m_sSysNotes ;
m_sUserNotes = pSdata->m_sUserNotes ;
@@ -192,7 +191,6 @@ SurfFinishingData::SameAs(const MachiningData* pMdata) const
m_nLeadOutType == pSdata->m_nLeadOutType &&
abs( m_dLoTang - pSdata->m_dLoTang) < EPS_MACH_LEN_PAR &&
abs( m_dLoPerp - pSdata->m_dLoPerp) < EPS_MACH_LEN_PAR &&
m_nLeadLinkType == pSdata->m_nLeadLinkType &&
abs( m_dApprox - pSdata->m_dApprox) < EPS_MACH_LEN_PAR &&
m_sSysNotes == pSdata->m_sSysNotes &&
m_sUserNotes == pSdata->m_sUserNotes) ;
@@ -273,7 +271,7 @@ SurfFinishingData::FromString( const string& sString, int& nKey)
bOk = ::FromString( sVal, m_nLeadInType) ;
break ;
case KEY_LLTY :
bOk = ::FromString( sVal, m_nLeadLinkType) ;
// campo non più usato
break ;
case KEY_LOPR :
bOk = ::FromString( sVal, m_dLoPerp) ;
@@ -351,7 +349,7 @@ SurfFinishingData::ToString( int nInd) const
case KEY_LIPR : return ( sSurfFinishingKey[KEY_LIPR] + "=" + ::ToString( m_dLiPerp)) ;
case KEY_LITG : return ( sSurfFinishingKey[KEY_LITG] + "=" + ::ToString( m_dLiTang)) ;
case KEY_LITY : return ( sSurfFinishingKey[KEY_LITY] + "=" + ::ToString( m_nLeadInType)) ;
case KEY_LLTY : return ( sSurfFinishingKey[KEY_LLTY] + "=" + ::ToString( m_nLeadLinkType)) ;
case KEY_LLTY : return ( sSurfFinishingKey[KEY_LLTY] + "=" + ::ToString( 0)) ;
case KEY_LOPR : return ( sSurfFinishingKey[KEY_LOPR] + "=" + ::ToString( m_dLoPerp)) ;
case KEY_LOTG : return ( sSurfFinishingKey[KEY_LOTG] + "=" + ::ToString( m_dLoTang)) ;
case KEY_LOTY : return ( sSurfFinishingKey[KEY_LOTY] + "=" + ::ToString( m_nLeadOutType)) ;
@@ -403,13 +401,6 @@ SurfFinishingData::VerifyLeadInType( int nVal) const
nVal == SURFFIN_LI_TANGENT) ;
}
//----------------------------------------------------------------------------
bool
SurfFinishingData::VerifyLeadLinkType( int nVal) const
{
return ( nVal == SURFFIN_LL_STD || nVal == SURFFIN_LL_CENT) ;
}
//----------------------------------------------------------------------------
bool
SurfFinishingData::VerifyLeadOutType( int nVal) const
@@ -464,11 +455,6 @@ SurfFinishingData::SetParam( int nType, int nVal)
return false ;
m_nLeadInType = nVal ;
return true ;
case MPA_LEADLINKTYPE :
if ( ! VerifyLeadInType( nVal))
return false ;
m_nLeadLinkType = nVal ;
return true ;
case MPA_LEADOUTTYPE :
if ( ! VerifyLeadOutType( nVal))
return false ;
@@ -615,9 +601,6 @@ SurfFinishingData::GetParam( int nType, int& nVal) const
case MPA_LEADINTYPE :
nVal = m_nLeadInType ;
return true ;
case MPA_LEADLINKTYPE :
nVal = m_nLeadLinkType ;
return true ;
case MPA_LEADOUTTYPE :
nVal = m_nLeadOutType ;
return true ;
+1 -3
View File
@@ -42,7 +42,6 @@ struct SurfFinishingData : public MachiningData
int m_nLeadOutType ; // tipo di uscita (come attacco, nessuno, lineare, tangente, inseguimento)
double m_dLoTang ; // distanza tangente verso fine uscita
double m_dLoPerp ; // distanza perpendicolare verso fine uscita
int m_nLeadLinkType ; // tipo di collegamento ( centro, fuori)
double m_dApprox ; // valore di approssimazione per superfici
std::string m_sSysNotes ; // note interne
std::string m_sUserNotes ; // note dell'utente
@@ -52,7 +51,7 @@ struct SurfFinishingData : public MachiningData
m_dOffsR( UNKNOWN_PAR), m_bInvert( false),
m_dStartPos( 0), m_dOverlap(0), m_dSideStep( 0), m_nSubType( 0), m_dSideAngle( 0),
m_nLeadInType( 0), m_dLiTang( 0), m_dLiPerp( 0),
m_nLeadOutType( 0), m_dLoTang( 0), m_dLoPerp( 0), m_nLeadLinkType( 0), m_dApprox( 0) {}
m_nLeadOutType( 0), m_dLoTang( 0), m_dLoPerp( 0), m_dApprox( 0) {}
SurfFinishingData* Clone( void) const override ;
bool CopyFrom( const MachiningData* pMdata) override ;
bool SameAs(const MachiningData* pMdata) const override ;
@@ -77,7 +76,6 @@ struct SurfFinishingData : public MachiningData
bool VerifySolCh( int nVal) const ;
bool VerifySubType( int nVal) const ;
bool VerifyLeadInType( int nVal) const ;
bool VerifyLeadLinkType( int nVal) const ;
bool VerifyLeadOutType( int nVal) const ;
} ;
+3229
View File
File diff suppressed because it is too large Load Diff
+189
View File
@@ -0,0 +1,189 @@
//----------------------------------------------------------------------------
// EgalTech 2024-2024
//----------------------------------------------------------------------------
// File : SurfRoughing.h Data : 24.05.24 Versione : 2.6e5
// Contenuto : Dichiarazione della classe SurfRoughing.
//
//
//
// Modifiche : 24.05.24 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "Machining.h"
#include "SurfRoughingData.h"
#include "ToolData.h"
#include "MachiningConst.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkIntersPlaneSurfTm.h"
class ICAvToolSurfTm ;
// struttura informazioni sui singoli percorsi
struct PathInfo {
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> pCvrRet ; // curva di ritorno per LeadIn/Out a guida
} ;
// tipo percorso
typedef std::vector<PathInfo> PATHINFOVECTOR ;
// struttura informazioni per Step/SubSteps complessivi
struct StepInfo {
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 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
} ;
// tipo step
typedef std::vector<StepInfo> STEPINFOVECTOR ;
//----------------------------------------------------------------------------
class SurfRoughing : public Machining
{
public : // IUserObj
SurfRoughing* 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_SURFROUGHING ; }
bool IsEmpty( void) const override
{ return ( m_nPaths == 0) ; }
bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; }
protected : // Operation
int GetSolCh( void) const override
{ return m_Params.m_nSolCh ; }
bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const override ;
public : // Machining
bool Prepare( const std::string& sSawName) 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 :
SurfRoughing( void) ;
private :
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 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 ;
ISurfFlatRegion* GetSfrByStmIntersection( const IntersParPlanesSurfTm& IPPStm, double dDist, double dSmallOffs = 0) 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 CloseOpenEdgesUnderTolerance( ISurfFlatRegion* pSfr, double dToler) ;
bool ModifySurfRefForOpenCloseEdges( ISurfFlatRegion* pSfrRef, const ICurveComposite* pCrvCompo) const ;
bool ChooseCloseOrOpenEdge( ISurfFlatRegion* pSfr, const ISurfFlatRegion* pSfrRef) const ;
bool SimplifyCurve( ICurveComposite* pCompo) const ;
bool SimplyfySfr( ISurfFlatRegion* pSfr) const ;
bool CheckSafetyLinearLink( const Point3d& ptCurr, const ISurfFlatRegion* pSfrLimit, const Vector3d& vtTool,
const Point3d& ptDest, bool& bSafe) const ;
bool GetHomogeneousParts( const ICurveComposite* pCrvCompo, ICRVCOMPOPOVECTOR& vpCrvs) const ;
bool VerifyLeadInHelix( const ISurfFlatRegion* pSfr, const Point3d& ptStart, const Point3d& ptCen, double dHelixRad) const ;
bool VerifyLeadInZigZag( const ISurfFlatRegion* pSfr, const Point3d& ptStart, const Point3d& ptPa, const Point3d& ptPb) const ;
private :
double GetSpeed() const
{ return ( IsNullAngValue( m_Params.m_dSpeed) ? m_TParams.m_dSpeed : m_Params.m_dSpeed) ; }
double GetFeed() const
{ return ( IsNullLenValue( m_Params.m_dFeed) ? m_TParams.m_dFeed : m_Params.m_dFeed) ; }
double GetAdaptedCoeffFeed( bool bSubStep, int nNumStep, double dStep, double dSubStep) const
{ return ( 1. + ( bSubStep ? ( nNumStep + 1) * dSubStep / dStep : 0.)) ; }
double GetStartFeed() const
{ return ( IsNullLenValue( m_Params.m_dStartFeed) ? m_TParams.m_dStartFeed : m_Params.m_dStartFeed) ; }
double GetEndFeed() const
{ return ( IsNullLenValue( m_Params.m_dEndFeed) ? m_TParams.m_dEndFeed : m_Params.m_dEndFeed) ; }
double GetTipFeed() const
{ return ( IsNullLenValue( m_Params.m_dTipFeed) ? m_TParams.m_dTipFeed : m_Params.m_dTipFeed) ; }
double GetOffsR() const
{ double dCurrOffsR = IsUnknownValue( m_Params.m_dOffsR) ? m_TParams.m_dOffsR : m_Params.m_dOffsR ;
return std::max( 0.1, dCurrOffsR) ; }
double GetOffsL() const
{ return ( IsUnknownValue( m_Params.m_dOffsL) ? m_TParams.m_dOffsL : m_Params.m_dOffsL) ; }
double GetSideStep( void) const
{ return Clamp( m_Params.m_dSideStep, 0.1, m_TParams.m_dTDiam) ; }
int GetLeadInType( void) const
{ if ( m_Params.m_dLiTang < std::min( 0.1 * m_TParams.m_dDiam, 1.0))
return SURFROU_LI_NONE ;
if ( m_Params.m_nLeadInType != SURFROU_LI_GLIDE && m_Params.m_dLiElev < 10 * EPS_SMALL)
return SURFROU_LI_NONE ;
return m_Params.m_nLeadInType ; }
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) ;
/* end debug functions */
private :
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
SurfRoughingData 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
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_dSubStepToler ; // tolleranza di rimozione chunk per SubSteps
} ;
+713
View File
@@ -0,0 +1,713 @@
//----------------------------------------------------------------------------
// EgalTech 2024-2024
//----------------------------------------------------------------------------
// File : SurfRoughingData.cpp Data : 24.05.24 Versione : 2.6e5
// Contenuto : Implementazione struttura dati lavorazione sgrossatura superfici.
//
//
//
// Modifiche : 24.05.24 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "SurfRoughingData.h"
#include "MachiningDataFactory.h"
#include "MachiningConst.h"
#include "/EgtDev/Include/EmkToolConst.h"
#include "/EgtDev/Include/EmkSimuGenConst.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include <array>
#include <cassert>
using namespace std ;
//----------------------------------------------------------------------------
enum nSurfRoughingKey {
KEY_AB = 0,
KEY_AI,
KEY_APPR,
KEY_DH,
KEY_F,
KEY_FE,
KEY_FS,
KEY_FT,
KEY_INV,
KEY_LIEL,
KEY_LITG,
KEY_LITY,
KEY_LOTG,
KEY_LOTY,
KEY_NAME,
KEY_NNS,
KEY_NNU,
KEY_OL,
KEY_OR,
KEY_PS,
KEY_S,
KEY_SA,
KEY_SCC,
KEY_SS,
KEY_SST,
KEY_ST,
KEY_SUBTYPE,
KEY_TNAME,
KEY_TUUID,
KEY_UUID,
KEY_ZZZ} ; // rappresenta il numero di elementi
static const array<string,KEY_ZZZ> sSurfRoughingKey = {
"AB",
"AI",
"APPR",
"DH",
"F",
"FE",
"FS",
"FT",
"INV",
"LIEL",
"LITG",
"LITY",
"LOTG",
"LOTY",
"NAME",
"NNS",
"NNU",
"OL",
"OR",
"PS",
"S",
"SA",
"SCC",
"SS",
"SST",
"ST",
"SUB",
"TN",
"TU",
"UUID"} ;
//----------------------------------------------------------------------------
MCHDATA_REGISTER( MT_SURFROUGHING, "SURFROUGHING", SurfRoughingData) ;
//----------------------------------------------------------------------------
SurfRoughingData*
SurfRoughingData::Clone( void) const
{
// alloco oggetto
SurfRoughingData* pMdata = new(nothrow) SurfRoughingData ;
// copio i dati
if ( pMdata != nullptr) {
if ( ! pMdata->CopyFrom( this)) {
delete pMdata ;
return nullptr ;
}
}
return pMdata ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::CopyFrom( const MachiningData* pMdata)
{
// è inutile copiare se sorgente coincide con destinazione
if ( pMdata == this)
return true ;
// la sorgente deve essere dello stesso tipo
const SurfRoughingData* pSdata = GetSurfRoughingData( pMdata) ;
if ( pSdata == nullptr)
return false ;
// eseguo copia
m_Uuid = pSdata->m_Uuid ;
m_sName = pSdata->m_sName ;
m_ToolUuid = pSdata->m_ToolUuid ;
m_sToolName = pSdata->m_sToolName ;
m_sBlockedAxis = pSdata->m_sBlockedAxis ;
m_sInitAngs = pSdata->m_sInitAngs ;
m_nSolCh = pSdata->m_nSolCh ;
m_dSpeed = pSdata->m_dSpeed ;
m_dFeed = pSdata->m_dFeed ;
m_dEndFeed = pSdata->m_dEndFeed ;
m_dStartFeed = pSdata->m_dStartFeed ;
m_dTipFeed = pSdata->m_dTipFeed ;
m_dOffsR = pSdata->m_dOffsR ;
m_dOffsL = pSdata->m_dOffsL ;
m_bInvert = pSdata->m_bInvert ;
m_sDepth = pSdata->m_sDepth ;
m_dStartPos = pSdata->m_dStartPos ;
m_dStep = pSdata->m_dStep ;
m_dSubStep = pSdata->m_dSubStep ;
m_dSideStep = pSdata->m_dSideStep ;
m_nSubType = pSdata->m_nSubType ;
m_dSideAngle = pSdata->m_dSideAngle ;
m_nLeadInType = pSdata->m_nLeadInType ;
m_dLiElev = pSdata->m_dLiElev ;
m_dLiTang = pSdata->m_dLiTang ;
m_nLeadOutType = pSdata->m_nLeadOutType ;
m_dLoTang = pSdata->m_dLoTang ;
m_dApprox = pSdata->m_dApprox ;
m_sSysNotes = pSdata->m_sSysNotes ;
m_sUserNotes = pSdata->m_sUserNotes ;
return true ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::SameAs(const MachiningData* pMdata) const
{
// se coincide con altro -> uguali
if ( pMdata == this)
return true ;
// se sono di tipo diverso -> diversi
const SurfRoughingData* pSdata = GetSurfRoughingData( pMdata) ;
if ( pSdata == nullptr)
return false ;
// confronto termine a termine
return ( m_Uuid == pSdata->m_Uuid &&
m_sName == pSdata->m_sName &&
m_ToolUuid == pSdata->m_ToolUuid &&
m_sToolName == pSdata->m_sToolName &&
m_sBlockedAxis == pSdata->m_sBlockedAxis &&
m_sInitAngs == pSdata->m_sInitAngs &&
m_nSolCh == pSdata->m_nSolCh &&
abs( m_dSpeed - pSdata->m_dSpeed) < EPS_MACH_ANG_PAR &&
abs( m_dFeed - pSdata->m_dFeed) < EPS_MACH_LEN_PAR &&
abs( m_dEndFeed - pSdata->m_dEndFeed) < EPS_MACH_LEN_PAR &&
abs( m_dStartFeed - pSdata->m_dStartFeed) < EPS_MACH_LEN_PAR &&
abs( m_dTipFeed - pSdata->m_dTipFeed) < EPS_MACH_LEN_PAR &&
abs( m_dOffsR - pSdata->m_dOffsR) < EPS_MACH_LEN_PAR &&
abs( m_dOffsL - pSdata->m_dOffsL) < EPS_MACH_LEN_PAR &&
m_bInvert == pSdata->m_bInvert &&
m_sDepth == pSdata->m_sDepth &&
abs( m_dStartPos - pSdata->m_dStartPos) < EPS_MACH_LEN_PAR &&
abs( m_dStep - pSdata->m_dStep) < EPS_MACH_LEN_PAR &&
abs( m_dSubStep - pSdata->m_dSubStep) < EPS_MACH_LEN_PAR &&
abs( m_dSideStep - pSdata->m_dSideStep) < EPS_MACH_LEN_PAR &&
m_nSubType == pSdata->m_nSubType &&
abs( m_dSideAngle - pSdata->m_dSideAngle) < EPS_MACH_ANG_PAR &&
m_nLeadInType == pSdata->m_nLeadInType &&
abs( m_dLiElev - pSdata->m_dLiElev) < EPS_MACH_LEN_PAR &&
abs( m_dLiTang - pSdata->m_dLiTang) < EPS_MACH_LEN_PAR &&
m_nLeadOutType == pSdata->m_nLeadOutType &&
abs( m_dLoTang - pSdata->m_dLoTang) < EPS_MACH_LEN_PAR &&
abs( m_dApprox - pSdata->m_dApprox) < EPS_MACH_LEN_PAR &&
m_sSysNotes == pSdata->m_sSysNotes &&
m_sUserNotes == pSdata->m_sUserNotes) ;
}
//----------------------------------------------------------------------------
int
SurfRoughingData::GetSize( void) const
{
// in debug verifico validità ultimo campo
assert( sSurfRoughingKey[KEY_UUID] == "UUID") ;
return KEY_ZZZ ;
}
//----------------------------------------------------------------------------
string
SurfRoughingData::GetTitle( void) const
{
return MCHDATA_GETNAME( SurfRoughingData) ;
}
//----------------------------------------------------------------------------
int
FindSurfRoughingKey( const string& sKey)
{
auto TheRange = equal_range( sSurfRoughingKey.cbegin(), sSurfRoughingKey.cend(), sKey) ;
if ( TheRange.first == TheRange.second)
return -1 ;
return int( TheRange.first - sSurfRoughingKey.cbegin()) ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::FromString( const string& sString, int& nKey)
{
// separo chiave da valore
string sKey, sVal ;
SplitFirst( sString, "=", sKey, sVal) ;
// riconosco la chiave
nKey = FindSurfRoughingKey( ToUpper( sKey)) ;
bool bOk = ( nKey >= 0) ;
switch ( nKey) {
case KEY_AB :
m_sBlockedAxis = sVal ;
break ;
case KEY_AI :
m_sInitAngs = sVal ;
break ;
case KEY_APPR :
bOk = ::FromString( sVal, m_dApprox) ;
break ;
case KEY_DH :
m_sDepth = sVal ;
if ( m_sDepth.empty())
m_sDepth = "0" ;
break ;
case KEY_F :
bOk = ::FromString( sVal, m_dFeed) ;
break ;
case KEY_FE :
bOk = ::FromString( sVal, m_dEndFeed) ;
break ;
case KEY_FS :
bOk = ::FromString( sVal, m_dStartFeed) ;
break ;
case KEY_FT :
bOk = ::FromString( sVal, m_dTipFeed) ;
break ;
case KEY_INV :
bOk = ::FromString( sVal, m_bInvert) ;
break ;
case KEY_LIEL :
bOk = ::FromString( sVal, m_dLiElev) ;
break ;
case KEY_LITG :
bOk = ::FromString( sVal, m_dLiTang) ;
break ;
case KEY_LITY :
bOk = ::FromString( sVal, m_nLeadInType) ;
break ;
case KEY_LOTG :
bOk = ::FromString( sVal, m_dLoTang) ;
break ;
case KEY_LOTY :
bOk = ::FromString( sVal, m_nLeadOutType) ;
break ;
case KEY_NAME :
m_sName = sVal ;
bOk = ! m_sName.empty() ;
break ;
case KEY_NNS :
m_sSysNotes = sVal ;
break ;
case KEY_NNU :
m_sUserNotes = sVal ;
break ;
case KEY_OR :
bOk = ::FromString( sVal, m_dOffsR) ;
break ;
case KEY_OL :
bOk = ::FromString( sVal, m_dOffsL) ;
break ;
case KEY_PS :
bOk = ::FromString( sVal, m_dStartPos) ;
break ;
case KEY_S :
bOk = ::FromString( sVal, m_dSpeed) ;
break ;
case KEY_SA :
bOk = ::FromString( sVal, m_dSideAngle) ;
break ;
case KEY_SCC :
bOk = ::FromString( sVal, m_nSolCh) ;
break ;
case KEY_SST :
bOk = ::FromString( sVal, m_dSubStep) ;
break ;
case KEY_SS :
bOk = ::FromString( sVal, m_dSideStep) ;
break ;
case KEY_ST :
bOk = ::FromString( sVal, m_dStep) ;
break ;
case KEY_SUBTYPE :
bOk = ::FromString( sVal, m_nSubType) ;
break ;
case KEY_TNAME :
m_sToolName = sVal ;
break ;
case KEY_TUUID :
bOk = ::FromString( sVal, m_ToolUuid) ;
break ;
case KEY_UUID :
bOk = ::FromString( sVal, m_Uuid) ;
break ;
default :
bOk = false ;
break ;
}
return bOk ;
}
//----------------------------------------------------------------------------
string
SurfRoughingData::ToString( int nInd) const
{
switch ( nInd) {
case KEY_AB : return ( sSurfRoughingKey[KEY_AB] + "=" + m_sBlockedAxis) ;
case KEY_AI : return ( sSurfRoughingKey[KEY_AI] + "=" + m_sInitAngs) ;
case KEY_APPR : return ( sSurfRoughingKey[KEY_APPR] + "=" + ::ToString(m_dApprox)) ;
case KEY_DH : return ( sSurfRoughingKey[KEY_DH] + "=" + m_sDepth) ;
case KEY_F : return ( sSurfRoughingKey[KEY_F] + "=" + ::ToString( m_dFeed)) ;
case KEY_FE : return ( sSurfRoughingKey[KEY_FE] + "=" + ::ToString( m_dEndFeed)) ;
case KEY_FS : return ( sSurfRoughingKey[KEY_FS] + "=" + ::ToString( m_dStartFeed)) ;
case KEY_FT : return ( sSurfRoughingKey[KEY_FT] + "=" + ::ToString( m_dTipFeed)) ;
case KEY_INV : return ( sSurfRoughingKey[KEY_INV] + "=" + ::ToString( m_bInvert)) ;
case KEY_LIEL : return ( sSurfRoughingKey[KEY_LIEL] + "=" + ::ToString( m_dLiElev)) ;
case KEY_LITG : return ( sSurfRoughingKey[KEY_LITG] + "=" + ::ToString( m_dLiTang)) ;
case KEY_LITY : return ( sSurfRoughingKey[KEY_LITY] + "=" + ::ToString( m_nLeadInType)) ;
case KEY_LOTG : return ( sSurfRoughingKey[KEY_LOTG] + "=" + ::ToString( m_dLoTang)) ;
case KEY_LOTY : return ( sSurfRoughingKey[KEY_LOTY] + "=" + ::ToString( m_nLeadOutType)) ;
case KEY_NAME : return ( sSurfRoughingKey[KEY_NAME] + "=" + m_sName) ;
case KEY_NNS : return ( sSurfRoughingKey[KEY_NNS] + "=" + m_sSysNotes) ;
case KEY_NNU : return ( sSurfRoughingKey[KEY_NNU] + "=" + m_sUserNotes) ;
case KEY_OL : return ( sSurfRoughingKey[KEY_OL] + "=" + ::ToString( m_dOffsL)) ;
case KEY_OR : return ( sSurfRoughingKey[KEY_OR] + "=" + ::ToString( m_dOffsR)) ;
case KEY_PS : return ( sSurfRoughingKey[KEY_PS] + "=" + ::ToString( m_dStartPos)) ;
case KEY_S : return ( sSurfRoughingKey[KEY_S] + "=" + ::ToString( m_dSpeed)) ;
case KEY_SA : return ( sSurfRoughingKey[KEY_SA] + "=" + ::ToString( m_dSideAngle)) ;
case KEY_SCC : return ( sSurfRoughingKey[KEY_SCC] + "=" + ::ToString( m_nSolCh)) ;
case KEY_SST : return ( sSurfRoughingKey[KEY_SST] + "=" + ::ToString( m_dSubStep)) ;
case KEY_SS : return ( sSurfRoughingKey[KEY_SS] + "=" + ::ToString( m_dSideStep)) ;
case KEY_ST : return ( sSurfRoughingKey[KEY_ST] + "=" + ::ToString( m_dStep)) ;
case KEY_SUBTYPE : return ( sSurfRoughingKey[KEY_SUBTYPE] + "=" + ::ToString( m_nSubType)) ;
case KEY_TNAME : return ( sSurfRoughingKey[KEY_TNAME] + "=" + m_sToolName) ;
case KEY_TUUID : return ( sSurfRoughingKey[KEY_TUUID] + "=" + ::ToString( m_ToolUuid)) ;
case KEY_UUID : return ( sSurfRoughingKey[KEY_UUID] + "=" + ::ToString( m_Uuid)) ;
default : return "" ;
}
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::IsOptional( int nKey) const
{
return ( nKey == KEY_LIEL || nKey == KEY_SST) ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::VerifySolCh( int nVal) const
{
return IsValidOperationScc( nVal) ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::VerifySubType( int nVal) const
{
return ( nVal == SURFROU_SUB_ZIGZAG || nVal == SURFROU_SUB_ONEWAY ||
nVal == SURFROU_SUB_SPIRALIN || nVal == SURFROU_SUB_SPIRALOUT ||
nVal == SURFROU_SUB_CONFORMAL_ZIGZAG || nVal == SURFROU_SUB_CONFORMAL_ONEWAY) ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::VerifyLeadInType( int nVal) const
{
return ( nVal == SURFROU_LI_NONE || nVal == SURFROU_LI_GLIDE ||
nVal == SURFROU_LI_ZIGZAG || nVal == SURFROU_LI_HELIX) ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::VerifyLeadOutType( int nVal) const
{
return ( nVal == SURFROU_LO_NONE || nVal == SURFROU_LO_GLIDE) ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::VerifyTool( const ToolsMgr* pToolsMgr, const string& sVal, const ToolData*& pTdata) const
{
if ( pToolsMgr == nullptr)
return false ;
pTdata = pToolsMgr->GetTool( sVal) ;
if ( pTdata == nullptr)
return false ;
if ( ( pTdata->m_nType & TF_MILL) == 0)
return false ;
return true ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::GetTool( const ToolsMgr* pToolsMgr, const ToolData*& pTdata) const
{
if ( pToolsMgr == nullptr)
return false ;
pTdata = pToolsMgr->GetTool( m_ToolUuid) ;
return ( pTdata != nullptr) ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::SetParam( int nType, bool bVal)
{
switch ( nType) {
case MPA_INVERT :
m_bInvert = bVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::SetParam( int nType, int nVal)
{
switch ( nType) {
case MPA_LEADINTYPE :
if ( ! VerifyLeadInType( nVal))
return false ;
m_nLeadInType = nVal ;
return true ;
case MPA_LEADOUTTYPE :
if ( ! VerifyLeadOutType( nVal))
return false ;
m_nLeadOutType = nVal ;
return true ;
case MPA_SCC :
if ( ! VerifySolCh( nVal))
return false ;
m_nSolCh = nVal ;
return true ;
case MPA_SUBTYPE :
if ( ! VerifySubType( nVal))
return false ;
m_nSubType = nVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::SetParam( int nType, double dVal)
{
switch ( nType) {
case MPA_SPEED :
m_dSpeed = dVal ;
return true ;
case MPA_FEED :
m_dFeed = dVal ;
return true ;
case MPA_STARTFEED :
m_dStartFeed = dVal ;
return true ;
case MPA_ENDFEED :
m_dEndFeed = dVal ;
return true ;
case MPA_TIPFEED :
m_dTipFeed = dVal ;
return true ;
case MPA_OFFSR :
m_dOffsR = dVal ;
return true ;
case MPA_OFFSL :
m_dOffsL = dVal ;
return true ;
case MPA_DEPTH :
m_sDepth = ::ToString( dVal) ;
return true ;
case MPA_STARTPOS :
m_dStartPos = dVal ;
return true ;
case MPA_STEP :
m_dStep = dVal ;
return true ;
case MPA_SUBSTEP :
m_dSubStep = dVal ;
return true ;
case MPA_SIDESTEP :
m_dSideStep = dVal ;
return true ;
case MPA_SIDEANGLE :
m_dSideAngle = dVal ;
return true ;
case MPA_LIELEV :
m_dLiElev = dVal ;
return true ;
case MPA_LITANG :
m_dLiTang = dVal ;
return true ;
case MPA_LOTANG :
m_dLoTang = dVal ;
return true ;
case MPA_APPROX :
m_dApprox = dVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::SetParam( int nType, const string& sVal)
{
switch ( nType) {
case MPA_NAME :
m_sName = sVal ;
return true ;
case MPA_TOOL :
m_sToolName = sVal ;
return true ;
case MPA_DEPTH_STR :
m_sDepth = sVal ;
return true ;
case MPA_TUUID :
return ::FromString( sVal, m_ToolUuid) ;
case MPA_UUID :
return ::FromString( sVal, m_Uuid) ;
case MPA_SYSNOTES :
m_sSysNotes = sVal ;
return true ;
case MPA_USERNOTES :
m_sUserNotes = sVal ;
return true ;
case MPA_INITANGS :
m_sInitAngs = sVal ;
return true ;
case MPA_BLOCKEDAXIS :
m_sBlockedAxis = sVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::ResetTool( void)
{
m_sToolName.clear() ;
m_ToolUuid.Clear() ;
return true ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::GetParam( int nType, bool& bVal) const
{
switch ( nType) {
case MPA_INVERT :
bVal = m_bInvert ;
return true ;
}
bVal = false ;
return false ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::GetParam( int nType, int& nVal) const
{
switch ( nType) {
case MPA_TYPE :
nVal = MT_SURFROUGHING ;
return true ;
case MPA_SUBTYPE :
nVal = m_nSubType ;
return true ;
case MPA_LEADINTYPE :
nVal = m_nLeadInType ;
return true ;
case MPA_LEADOUTTYPE :
nVal = m_nLeadOutType ;
return true ;
case MPA_SCC :
nVal = m_nSolCh ;
return true ;
}
nVal = 0 ;
return false ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::GetParam( int nType, double& dVal) const
{
switch ( nType) {
case MPA_SPEED :
dVal = m_dSpeed ;
return true ;
case MPA_FEED :
dVal = m_dFeed ;
return true ;
case MPA_STARTFEED :
dVal = m_dStartFeed ;
return true ;
case MPA_ENDFEED :
dVal = m_dEndFeed ;
return true ;
case MPA_TIPFEED :
dVal = m_dTipFeed ;
return true ;
case MPA_OFFSR :
dVal = m_dOffsR ;
return true ;
case MPA_OFFSL :
dVal = m_dOffsL ;
return true ;
case MPA_STARTPOS :
dVal = m_dStartPos ;
return true ;
case MPA_STEP :
dVal = m_dStep ;
return true ;
case MPA_SUBSTEP :
dVal = m_dSubStep ;
return true ;
case MPA_SIDESTEP :
dVal = m_dSideStep ;
return true ;
case MPA_SIDEANGLE :
dVal = m_dSideAngle ;
return true ;
case MPA_LIELEV :
dVal = m_dLiElev ;
return true ;
case MPA_LITANG :
dVal = m_dLiTang ;
return true ;
case MPA_LOTANG :
dVal = m_dLoTang ;
return true ;
case MPA_APPROX :
dVal = m_dApprox ;
return true ;
}
dVal = 0 ;
return false ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::GetParam( int nType, string& sVal) const
{
switch ( nType) {
case MPA_NAME :
sVal = m_sName ;
return true ;
case MPA_TOOL :
sVal = m_sToolName ;
return true ;
case MPA_DEPTH_STR :
sVal = m_sDepth ;
return true ;
case MPA_TUUID :
sVal = ::ToString( m_ToolUuid) ;
return true ;
case MPA_UUID :
sVal = ::ToString( m_Uuid) ;
return true ;
case MPA_SYSNOTES :
sVal = m_sSysNotes ;
return true ;
case MPA_USERNOTES :
sVal = m_sUserNotes ;
return true ;
case MPA_INITANGS :
sVal = m_sInitAngs ;
return true ;
case MPA_BLOCKEDAXIS :
sVal = m_sBlockedAxis ;
return true ;
}
sVal = "" ;
return false ;
}
+92
View File
@@ -0,0 +1,92 @@
//----------------------------------------------------------------------------
// EgalTech 2024-2024
//----------------------------------------------------------------------------
// File : SurfRoughingData.h Data : 24.05.24 Versione : 2.6e5
// Contenuto : Dichiarazione della struct SurfRoughingData e costanti associate.
//
//
//
// Modifiche : 24.05.24 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "MachiningData.h"
//----------------------------------------------------------------------------
struct SurfRoughingData : public MachiningData
{
EgtUUID m_ToolUuid ; // identificativo universale dell'utensile
std::string m_sToolName ; // nome dell'utensile
std::string m_sInitAngs ; // angoli iniziali suggeriti (Nome1=val1,Nome2=val2)
std::string m_sBlockedAxis ; // eventuale asse rotante bloccato (Nome=val)
int m_nSolCh ; // criterio scelta soluzione (quando possibili molteplici)
double m_dSpeed ; // velocità di rotazione (+ se CCW, - se CW) ( se 0 da utensile)
double m_dFeed ; // velocità di lavorazione normale ( se 0 da utensile)
double m_dStartFeed ; // velocità di lavorazione iniziale ( se 0 da utensile)
double m_dEndFeed ; // velocità di lavorazione finale ( se 0 da utensile)
double m_dTipFeed ; // velocità di lavorazione di testa ( se 0 da utensile)
double m_dOffsR ; // offset radiale ( se UNKNOWN_PAR da utensile)
double m_dOffsL ; // offset longitudinale ( se UNKNOWN_PAR da utensile)
bool m_bInvert ; // flag di inversione direzione lavorazione
std::string m_sDepth ; // affondamento massimo (espressione numerica)
double m_dStartPos ; // quota di inizio lavorazione (sempre >= 0)
double m_dStep ; // passo di affondamento (0=nessun passo)
double m_dSideStep ; // distanza tra le passate
double m_dSubStep ; // distanza tra le passate intermedie
int m_nSubType ; // tipo di lavorazione ( ZigZag, OneWay, SpiralIn, SpiralOut)
double m_dSideAngle ; // angolo dello ZigZag da X+ locale
int m_nLeadInType ; // tipo di attacco (nessuno, lineare, tangente, inseguimento)
double m_dLiTang ; // distanza tangente da inizio attacco
double m_dLiElev ; // elevazione di uno step di attacco
int m_nLeadOutType ; // tipo di uscita (come attacco, nessuno, lineare, tangente, inseguimento)
double m_dLoTang ; // distanza tangente verso fine uscita
double m_dApprox ; // valore di approssimazione per superfici
std::string m_sSysNotes ; // note interne
std::string m_sUserNotes ; // note dell'utente
SurfRoughingData( void)
: m_ToolUuid(), m_nSolCh( 0), m_dSpeed( 0), m_dFeed( 0), m_dStartFeed( 0), m_dEndFeed( 0), m_dTipFeed( 0),
m_dOffsR( UNKNOWN_PAR), m_dOffsL( UNKNOWN_PAR), m_bInvert( false),
m_dStartPos( 0), m_dStep( 0), m_dSideStep( 0), m_dSubStep( 0), m_nSubType( 0), m_dSideAngle( 0),
m_nLeadInType( 0), m_dLiTang( 0), m_dLiElev( 0),
m_nLeadOutType( 0), m_dLoTang( 0), m_dApprox( 0) {}
SurfRoughingData* Clone( void) const override ;
bool CopyFrom( const MachiningData* pMdata) override ;
bool SameAs(const MachiningData* pMdata) const override ;
int GetType( void) const override
{ return MT_SURFROUGHING ; }
int GetSize( void) const override ;
std::string GetTitle( void) const override ;
bool FromString( const std::string& sString, int& nKey) override ;
std::string ToString( int nInd) const override ;
bool IsOptional( int nKey) const override ;
bool SetParam( int nType, bool bVal) override ;
bool SetParam( int nType, int nVal) override ;
bool SetParam( int nType, double dVal) override ;
bool SetParam( int nType, const std::string& sVal) override ;
bool ResetTool( void) override ;
bool GetParam( int nType, bool& bVal) const override;
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool GetTool( const ToolsMgr* pToolsMgr, const ToolData*& pTdata) const override ;
bool VerifyTool( const ToolsMgr* pToolsMgr, const std::string& sVal, const ToolData*& pTdata) const override ;
bool VerifySolCh( int nVal) const ;
bool VerifySubType( int nVal) const ;
bool VerifyLeadInType( int nVal) const ;
bool VerifyLeadLinkType( int nVal) const ;
bool VerifyLeadOutType( int nVal) const ;
} ;
//----------------------------------------------------------------------------
inline const SurfRoughingData* GetSurfRoughingData( const MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SURFROUGHING)
return nullptr ;
return ( static_cast<const SurfRoughingData*>( pMdata)) ; }
inline SurfRoughingData* GetSurfRoughingData( MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SURFROUGHING)
return nullptr ;
return ( static_cast<SurfRoughingData*>( pMdata)) ; }
+1 -1
View File
@@ -108,4 +108,4 @@ SameTool( const ToolData& Td1, const ToolData& Td2, bool bAlsoNameTcPosHeadExit
abs( Td1.m_dMinFeed - Td2.m_dMinFeed) < EPS_FEED &&
Td1.m_sSysNotes == Td2.m_sSysNotes &&
Td1.m_sUserNotes == Td2.m_sUserNotes) ;
}
}
+5
View File
@@ -551,6 +551,11 @@ ToolsMgr::SaveCurrTool( void)
m_suData.emplace( m_tdCurrTool.m_sName, m_tdCurrTool.m_Uuid) ;
}
}
// se fresa adatto sottotipo a seconda della capacità di lavorare di testa
if ( m_tdCurrTool.m_nType == TT_MILL_STD && m_tdCurrTool.m_dTipFeed < EPS_SMALL)
m_tdCurrTool.m_nType = TT_MILL_NOTIP ;
else if ( m_tdCurrTool.m_nType == TT_MILL_NOTIP && m_tdCurrTool.m_dTipFeed > EPS_SMALL)
m_tdCurrTool.m_nType = TT_MILL_STD ;
// eseguo salvataggio
m_bModified = true ;
if ( find( m_utModified.begin(), m_utModified.end(), m_tdCurrTool.m_Uuid) == m_utModified.end())
+146 -118
View File
@@ -498,15 +498,15 @@ WaterJetting::SetParam( int nType, const string& sVal)
bool
WaterJetting::SetGeometry( const SELVECTOR& vIds)
{
// verifico validità gestore DB geometrico
// verifico validità gestore DB geometrico
if ( m_pGeomDB == nullptr)
return false ;
// reset della geometria corrente
m_vId.clear() ;
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve, tutti testi o tutte facce)
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve, tutti testi o tutte facce)
int nType = GEO_NONE ;
for ( const auto& Id : vIds) {
// test sull'entità
// test sull'entità
int nSubs ;
if ( ! VerifyGeometry( Id, nSubs, nType)) {
string sInfo = "Warning in WaterJetting : Skipped entity " + ToString( Id) ;
@@ -529,14 +529,14 @@ WaterJetting::Preview( bool bRecalc)
// reset numero percorsi di lavoro generati
m_nMills = 0 ;
// verifico validità gestore DB geometrico e Id del gruppo
// verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
// recupero gruppo per geometria ausiliaria
int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ;
bool bChain = false ;
// se non c'è, lo aggiungo
// se non c'è, lo aggiungo
if ( nAuxId == GDB_ID_NULL) {
nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nAuxId == GDB_ID_NULL)
@@ -586,7 +586,7 @@ WaterJetting::Preview( bool bRecalc)
// recupero gruppo per geometria di Preview
int nPvId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_PV) ;
// se non c'è, lo aggiungo
// se non c'è, lo aggiungo
if ( nPvId == GDB_ID_NULL) {
nPvId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nPvId == GDB_ID_NULL)
@@ -616,7 +616,7 @@ WaterJetting::Apply( bool bRecalc, bool bPostApply)
int nCurrMills = m_nMills ;
m_nMills = 0 ;
// verifico validità gestore DB geometrico e Id del gruppo
// verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
@@ -646,7 +646,7 @@ WaterJetting::Apply( bool bRecalc, bool bPostApply)
// recupero gruppo per geometria ausiliaria
int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ;
bool bChain = false ;
// se non c'è, lo aggiungo
// se non c'è, lo aggiungo
if ( nAuxId == GDB_ID_NULL) {
nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nAuxId == GDB_ID_NULL)
@@ -687,7 +687,7 @@ WaterJetting::Apply( bool bRecalc, bool bPostApply)
// recupero gruppo per geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
// se non c'è, lo aggiungo
// se non c'è, lo aggiungo
if ( nClId == GDB_ID_NULL) {
nClId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nClId == GDB_ID_NULL)
@@ -730,7 +730,7 @@ WaterJetting::Apply( bool bRecalc, bool bPostApply)
bool
WaterJetting::Update( bool bPostApply)
{
// verifico validità gestore DB geometrico e Id del gruppo
// verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
@@ -740,7 +740,7 @@ WaterJetting::Update( bool bPostApply)
return true ;
}
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione
@@ -1014,7 +1014,7 @@ WaterJetting::UpdateToolData( bool* pbChanged)
bool
WaterJetting::GetGeometry( SELVECTOR& vIds) const
{
// restituisco l'elenco delle entità
// restituisco l'elenco delle entità
vIds = m_vId ;
return true ;
}
@@ -1027,7 +1027,7 @@ WaterJetting::VerifyGeometry( SelData Id, int& nSubs, int& nType)
const IGeoObj* pGObj = m_pGeomDB->GetGeoObj( Id.nId) ;
if ( pGObj == nullptr)
return false ;
// se ammesse curve ed è tale
// se ammesse curve ed è tale
if ( ( nType == GEO_NONE || nType == GEO_CURVE) && ( pGObj->GetType() & GEO_CURVE) != 0) {
nType = GEO_CURVE ;
const ICurve* pCurve = nullptr ;
@@ -1051,7 +1051,7 @@ WaterJetting::VerifyGeometry( SelData Id, int& nSubs, int& nType)
}
return true ;
}
// se altrimenti ammessi testi ed è tale
// se altrimenti ammessi testi ed è tale
else if ( ( nType == GEO_NONE || nType == EXT_TEXT) && pGObj->GetType() == EXT_TEXT) {
nType = EXT_TEXT ;
const IExtText* pText = ::GetExtText( pGObj) ;
@@ -1061,7 +1061,7 @@ WaterJetting::VerifyGeometry( SelData Id, int& nSubs, int& nType)
nSubs = 0 ;
return true ;
}
// se altrimenti ammesse superfici trimesh ed è tale
// se altrimenti ammesse superfici trimesh ed è tale
else if ( ( nType == GEO_NONE || nType == SRF_TRIMESH) && pGObj->GetType() == SRF_TRIMESH) {
nType = SRF_TRIMESH ;
const ISurfTriMesh* pSurf = ::GetSurfTriMesh( pGObj) ;
@@ -1083,7 +1083,7 @@ WaterJetting::VerifyGeometry( SelData Id, int& nSubs, int& nType)
}
return true ;
}
// se altrimenti ammesse regioni ed è tale
// se altrimenti ammesse regioni ed è tale
else if ( ( nType == GEO_NONE || nType == SRF_FLATRGN) && pGObj->GetType() == SRF_FLATRGN) {
nType = SRF_FLATRGN ;
const ISurfFlatRegion* pReg = ::GetSurfFlatRegion( pGObj) ;
@@ -1420,7 +1420,7 @@ WaterJetting::VerifySideAngle( void)
bool
WaterJetting::AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const
{
// non devo fare alcunché
// non devo fare alcunché
return true ;
}
@@ -1442,7 +1442,7 @@ WaterJetting::AdjustArcCenterForAxesCalc( const CamData* pCamData, Point3d& ptCe
ptCen.Translate( dOffset * pCamData->GetCorrDir()) ;
}
}
// negli altri casi, non devo fare alcunché
// negli altri casi, non devo fare alcunché
return true ;
}
@@ -1453,7 +1453,7 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
// recupero gruppo per geometria temporanea
const string GRP_TEMP = "Temp" ;
int nTempId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, GRP_TEMP) ;
// se non c'è, lo aggiungo
// se non c'è, lo aggiungo
if ( nTempId == GDB_ID_NULL) {
nTempId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nTempId == GDB_ID_NULL)
@@ -1589,7 +1589,7 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
m_pMchMgr->SetWarning( 3255, "Warning in WaterJetting : skipped Path too short") ;
return true ;
}
// se una sola entità circonferenza completa, la divido in due per poterla allungare
// se una sola entità circonferenza completa, la divido in due per poterla allungare
if ( pCompo->GetCurveCount() == 1 && pCompo->IsClosed())
pCompo->AddJoint( 0.5) ;
// eventuali allungamenti
@@ -1649,7 +1649,7 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
if ( ! pCompo->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL, false))
return false ;
// recupero i punti di inizio e fine (per poi salvarli nelle info di CL path)
// recupero i punti di inizio e fine ( per poi salvarli nelle info di CL path)
Point3d ptStart ; pCompo->GetStartPoint( ptStart) ;
Point3d ptEnd ; pCompo->GetEndPoint( ptEnd) ;
@@ -1682,7 +1682,7 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
VerifyArcs( pCompo) ;
}
// se abilitato probing, verifico lunghezza entità ed eventualmente le divido
// se abilitato probing, verifico lunghezza entità ed eventualmente le divido
if ( m_Params.m_bProbing)
VerifyMaxLenCurves( pCompo, m_Params.m_dProbingMaxDist) ;
@@ -1743,7 +1743,7 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
AdjustPathForInternalAngles( pCompo) ;
// Inserisco la lavorazione
if ( ! AddStandardWj( pCompo, vtTool, bSplitArcs))
if ( ! AddStandardWj( pCompo, vtTool, bSplitArcs, dAddedOverlap))
return false ;
}
@@ -2130,12 +2130,12 @@ WaterJetting::AdjustPathForInternalAngles( ICurveComposite* pCompo)
return true ;
// larghezza della lavorazione
double dW = m_dElev * sin( m_Params.m_dSideAngle * DEGTORAD) ;
// ciclo su tutte le entità
// ciclo su tutte le entità
int nMaxInd = pCompo->GetCurveCount() - 1 ;
for ( int i = 0 ; i <= nMaxInd ; ++ i) {
// curva corrente
const ICurve* pCrvC = pCompo->GetCurve( i) ;
// dati eventuale entità precedente
// dati eventuale entità precedente
const ICurve* pCrvP = nullptr ;
bool bPrevIntAng = false ;
double dPrevAng = 0 ;
@@ -2153,7 +2153,7 @@ WaterJetting::AdjustPathForInternalAngles( ICurveComposite* pCompo)
// lunghezza
pCrvP->GetLength( dPrevLen) ;
}
// dati eventuale entità successiva
// dati eventuale entità successiva
const ICurve* pCrvN = nullptr ;
bool bNextIntAng = false ;
double dNextAng = 0 ;
@@ -2171,15 +2171,15 @@ WaterJetting::AdjustPathForInternalAngles( ICurveComposite* pCompo)
// lunghezza
pCrvN->GetLength( dNextLen) ;
}
// se c'è angolo interno con la precedente
// se c'è angolo interno con la precedente
if ( bPrevIntAng) {
// lunghezza entità
// lunghezza entità
double dLen ; pCrvC->GetLength( dLen) ;
// verifico lunghezza minima
double dSlowLen = dW / tan( ( 180 - abs( dPrevAng)) / 2 * DEGTORAD) ;
double dExtraLen = dSlowLen + INTANG_ROT_LEN - dLen ;
if ( dExtraLen > 0) {
// se entità successiva è in tangenza e abbastanza lunga, allungo la corrente a scapito della successiva
// se entità successiva è in tangenza e abbastanza lunga, allungo la corrente a scapito della successiva
if ( ! bNextIntAng && dNextLen > dExtraLen) {
double dU ; Point3d ptP ;
if ( pCrvN->GetParamAtLength( dExtraLen, dU) &&
@@ -2188,15 +2188,15 @@ WaterJetting::AdjustPathForInternalAngles( ICurveComposite* pCompo)
}
}
}
// se c'è angolo interno con l'entità successiva
// se c'è angolo interno con l'entità successiva
if ( bNextIntAng) {
// lunghezza entità
// lunghezza entità
double dLen ; pCrvC->GetLength( dLen) ;
// verifico lunghezza minima
double dSlowLen = dW / tan( ( 180 - abs( dNextAng)) / 2 * DEGTORAD) ;
double dExtraLen = dSlowLen + INTANG_ROT_LEN - dLen ;
if ( dExtraLen > 0) {
// se entità precedente è in tangenza e abbastanza lunga, allungo la corrente a scapito della precedente
// se entità precedente è in tangenza e abbastanza lunga, allungo la corrente a scapito della precedente
if ( ! bPrevIntAng && dPrevLen > dExtraLen) {
double dU ; Point3d ptP ;
if ( pCrvP->GetParamAtLength( dPrevLen - dExtraLen, dU) &&
@@ -2212,33 +2212,38 @@ WaterJetting::AdjustPathForInternalAngles( ICurveComposite* pCompo)
//----------------------------------------------------------------------------
bool
WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTool, bool bSplitArcs)
WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTool, bool bSplitArcs, double dAddedOverlap)
{
// numero punti di accelerazione/decelerazione
const int ACC_PNT_NUM = 7 ;
// recupero distanze di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeZ = GetSafeZ() ;
// Recupero versore estrusione
Vector3d vtN ; pCompo->GetExtrusion( vtN) ;
// verifico se la curva è chiusa a meno di eventuale dAddedOverlap
bool bClosed = ( pCompo->IsClosed() || dAddedOverlap > EPS_SMALL) ;
// ciclo sulle curve elementari
int nIdxSkip = 0 ;
int nMaxInd = pCompo->GetCurveCount() - 1 ;
bool bStartSlowFull = false ;
for ( int i = 0 ; i <= nMaxInd ; ++ i) {
// curva corrente
const ICurve* pCrvC = pCompo->GetCurve( i) ;
// copio la curva (è già alla giusta quota)
// copio la curva ( è già alla giusta quota)
PtrOwner<ICurve> pCurve( pCrvC->Clone()) ;
if ( IsNull( pCurve))
return false ;
double dUprev = 0 ;
// se prima entità, approccio e affondo
bool bSlowFull = false ; // modalità speciale per angoli interni con rallentamento uniforme su tutta l'entità
// se prima entità, approccio e affondo
if ( i == 0) {
// imposto indice dei punti precedenti la partenza
SetIndex( -1 - nIdxSkip) ;
// dati inizio entità
// dati inizio entità
Point3d ptStart ; pCurve->GetStartPoint( ptStart) ;
Vector3d vtStart ; pCurve->GetStartDir( vtStart) ;
// determino inizio attacco
@@ -2262,7 +2267,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
}
m_ptLastProbe = ptStart ;
}
// altrimenti verifico con l'entità precedente
// altrimenti verifico con l'entità precedente
else {
// direzione finale precedente
const ICurve* pCrvP = pCompo->GetCurve( i - 1) ;
@@ -2311,7 +2316,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
return false ;
}
else {
// se non è possibile suddividere anello
// se non è possibile suddividere anello
CalcAndSetToolCorrAuxDir( pCompo, i + 0.5) ;
if ( AddCurveMove( pCompoArc, bSplitArcs) == GDB_ID_NULL)
return false ;
@@ -2329,7 +2334,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
}
// se angolo esterno e richiesto rallentamento esterno, eseguo accelerazione
else if ( IsExternalAngle( dAng) && m_Params.m_nExtCornerType == WJET_EC_SLOW) {
// lunghezza entità
// lunghezza entità
double dLen ; pCrvC->GetLength( dLen) ;
// lunghezza di accelerazione
double dAccLen = min( m_Params.m_dCornerSlowLen, dLen / 2 - EXTRA_ACC_LEN) ;
@@ -2352,21 +2357,45 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
// se angolo interno, spezzo per interpolazione direzione utensile e se necessario aggiungo accelerazione
else if ( IsInternalAngle( dAng)) {
// flag di rallentamento
bool bReduceFeed = ( m_Params.m_nIntCornerType == WJET_IC_SLOW) ;
// lunghezza entità
bool bReduceFeed = ( m_Params.m_nIntCornerType == WJET_IC_SLOW || m_Params.m_nIntCornerType == WJET_IC_SLOW_FULL) ;
// lunghezza entità
double dLen ; pCrvC->GetLength( dLen) ;
double dFreeLen = dLen ;
// lunghezza di accelerazione
double dAccLen = min( dFreeLen - EXTRA_ACC_LEN, ( bReduceFeed ? m_Params.m_dCornerSlowLen : INTANG_ROT_LEN)) ;
if ( m_Params.m_dSideAngle > 0) {
double dW = m_dElev * sin( m_Params.m_dSideAngle * DEGTORAD) ;
double dSlowLen = dW / tan( ( 180 - abs( dAng)) / 2 * DEGTORAD) ;
if ( dSlowLen > dFreeLen - EXTRA_ACC_LEN) {
m_pMchMgr->SetLastError( 3204, "Error in WaterJetting : entity too small near inside corner") ;
return false ;
}
dAccLen = min( dSlowLen + m_Params.m_dCornerSlowLen, dFreeLen - EXTRA_ACC_LEN) ;
double dAccLen = 0 ;
if ( m_Params.m_nIntCornerType == WJET_IC_SLOW_FULL) {
// se ultima entità
if ( i == nMaxInd) {
// sfrutto tutta la lunghezza a disposizione
dAccLen = dFreeLen - EXTRA_ACC_LEN ;
// verifico che la modalità WJET_IC_SLOW_FULL sia fattibile
bSlowFull = ( ! bClosed || bStartSlowFull) ;
}
else {
// devo verificare se anche angolo next è interno, altrimenti applico la modalità WJET_IC_SLOW
const ICurve* pCrvN = pCompo->GetCurve( i + 1) ;
Vector3d vtEndC ; pCurve->GetEndDir( vtEndC) ;
Vector3d vtStartN ; pCrvN->GetStartDir( vtStartN) ;
double dAngN ; vtEndC.GetAngleXY( vtStartN, dAngN) ;
if ( IsInternalAngle( dAngN)) {
bSlowFull = true ;
dAccLen = dFreeLen / 2 ;
}
}
}
if ( ! bSlowFull) {
dAccLen = min( dFreeLen - EXTRA_ACC_LEN, ( bReduceFeed ? m_Params.m_dCornerSlowLen : INTANG_ROT_LEN)) ;
if ( m_Params.m_dSideAngle > 0) {
double dW = m_dElev * sin( m_Params.m_dSideAngle * DEGTORAD) ;
double dSlowLen = dW / tan( ( 180 - abs( dAng)) / 2 * DEGTORAD) ;
if ( dSlowLen > dFreeLen - EXTRA_ACC_LEN) {
m_pMchMgr->SetLastError( 3204, "Error in WaterJetting : entity too small near inside corner") ;
return false ;
}
dAccLen = min( dSlowLen + m_Params.m_dCornerSlowLen, dFreeLen - EXTRA_ACC_LEN) ;
}
}
// Feed ridotta
double dMinFeed = ( bReduceFeed ? GetActualReducedFeed() : GetActualFeed()) ;
// Direzioni utensile nell'angolo e finale
@@ -2392,7 +2421,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
}
}
}
// se non è l'ultima entità, verifico con l'entità successiva
// se non è l'ultima entità, verifico con l'entità successiva
double dNextFeed = GetActualFeed() ;
if ( i < nMaxInd) {
// controlli per indice del punto di arrivo
@@ -2408,7 +2437,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
double dAng ; vtEnd.GetAngleXY( vtStart, dAng) ;
// se angolo esterno e richiesto rallentamento esterno, aggiungo decelerazione
if ( IsExternalAngle( dAng) && m_Params.m_nExtCornerType == WJET_EC_SLOW) {
// lunghezza entità
// lunghezza entità
double dLen ; pCrvC->GetLength( dLen) ;
// lunghezza di decelerazione
double dAccLen = min( m_Params.m_dCornerSlowLen, dLen / 2 - EXTRA_ACC_LEN) ;
@@ -2418,6 +2447,8 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
for ( int j = 0 ; j < ACC_PNT_NUM ; ++ j) {
double dCoeff = j / double( ACC_PNT_NUM) ;
double dU ; pCrvC->GetParamAtLength( dLen - ( 1 - dCoeff) * dAccLen, dU) ;
if ( abs( dUprev - dU) < EPS_SMALL)
continue ;
PtrOwner<ICurve> pCrvT( pCrvC->Clone()) ;
if ( IsNull( pCrvT) || ! pCrvT->TrimStartEndAtParam( dUprev, dU))
return false ;
@@ -2432,32 +2463,71 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
// se angolo interno, spezzo per interpolazione direzione utensile e se necessario aggiungo decelerazione
else if ( IsInternalAngle( dAng)) {
// flag di rallentamento
bool bReduceFeed = ( m_Params.m_nIntCornerType == WJET_IC_SLOW) ;
// lunghezza entità
bool bReduceFeed = ( m_Params.m_nIntCornerType == WJET_IC_SLOW || m_Params.m_nIntCornerType == WJET_IC_SLOW_FULL) ;
// lunghezza entità
double dLen ; pCrvC->GetLength( dLen) ;
double dFreeLen = dLen * ( 1 - dUprev) ;
// lunghezza di decelerazione
double dAccLen = min( dFreeLen - EXTRA_ACC_LEN, ( bReduceFeed ? m_Params.m_dCornerSlowLen : INTANG_ROT_LEN)) ;
if ( m_Params.m_dSideAngle > 0) {
double dW = m_dElev * sin( m_Params.m_dSideAngle * DEGTORAD) ;
double dSlowLen = dW / tan( ( 180 - abs( dAng)) / 2 * DEGTORAD) ;
if ( dSlowLen > dFreeLen - EXTRA_ACC_LEN) {
m_pMchMgr->SetLastError( 3204, "Error in WaterJetting : entity too small near inside corner") ;
return false ;
}
dAccLen = min( dSlowLen + m_Params.m_dCornerSlowLen, dFreeLen - EXTRA_ACC_LEN) ;
// lunghezza di decelerazione
double dAccLen = 0 ;
// se prima entità e modalità WJET_IC_SLOW_FULL verifico se davvero applicabile controllando angolo con ultima entità
if ( i == 0 && m_Params.m_nIntCornerType == WJET_IC_SLOW_FULL) {
bSlowFull = true ;
if ( bClosed) {
// creo una copia della curva senza l'overlap aggiunto
PtrOwner<ICurveComposite> pCrvTmp( pCompo->Clone()) ;
double dLen ; pCrvTmp->GetLength( dLen) ;
if ( IsNull( pCrvTmp) || ! pCrvTmp->TrimEndAtLen( dLen - dAddedOverlap))
return false ;
// verifico che anche angolo sullo start della curva sia di tipo prev
const ICurve* pCrvLast = pCrvTmp->GetLastCurve() ;
Vector3d vtStart ; pCurve->GetStartDir( vtStart) ;
Vector3d vtEnd ; pCrvLast->GetEndDir( vtEnd) ;
if ( AreSameVectorApprox( vtStart, vtEnd)) {
// se curve in tangenza controllo angolo tra l'ultima e la penultima curva
int nCrvNbr = pCrvTmp->GetCurveCount() ;
const ICurve* pCrvP = pCrvTmp->GetCurve( nCrvNbr - 2) ;
pCrvLast->GetStartDir( vtStart) ;
pCrvP->GetEndDir( vtEnd) ;
}
// se angolo precedente non è interno il tratto non va realizzato in modalità full
double dAngPrev ; vtEnd.GetAngleXY( vtStart, dAngPrev) ;
if ( ! IsInternalAngle( dAngPrev))
bSlowFull = false ;
}
// salvo il valore per l'ultima entità
bStartSlowFull = bSlowFull ;
}
if ( bSlowFull)
// sfrutto tutta la lunghezza a disposizone
dAccLen = dFreeLen ;
else {
dAccLen = min( dFreeLen - EXTRA_ACC_LEN, ( bReduceFeed ? m_Params.m_dCornerSlowLen : INTANG_ROT_LEN)) ;
if ( m_Params.m_dSideAngle > 0) {
double dW = m_dElev * sin( m_Params.m_dSideAngle * DEGTORAD) ;
double dSlowLen = dW / tan( ( 180 - abs( dAng)) / 2 * DEGTORAD) ;
if ( dSlowLen > dFreeLen - EXTRA_ACC_LEN) {
m_pMchMgr->SetLastError( 3204, "Error in WaterJetting : entity too small near inside corner") ;
return false ;
}
dAccLen = min( dSlowLen + m_Params.m_dCornerSlowLen, dFreeLen - EXTRA_ACC_LEN) ;
}
}
// Feed ridotta
double dMinFeed = ( bReduceFeed ? GetActualReducedFeed() : GetActualFeed()) ;
// Direzioni utensile iniziale e nell'angolo
double dUsta ; pCrvC->GetParamAtLength( dLen - dAccLen, dUsta) ;
double dUend = 1 ;
Vector3d vtTp = CalcToolDir( pCompo, i + dUsta) ;
double dUend = 1 ;
Vector3d vtTp = CalcToolDir( pCompo, i + dUsta) ;
Vector3d vtTn = CalcToolDir( pCompo, i + dUend) ;
// ciclo sui punti di decelerazione
for ( int j = 0 ; j < ACC_PNT_NUM ; ++ j) {
double dCoeff = j / double( ACC_PNT_NUM) ;
double dU ; pCrvC->GetParamAtLength( dLen - ( 1 - dCoeff) * dAccLen, dU) ;
if ( abs( dUprev - dU) < EPS_SMALL)
continue ;
PtrOwner<ICurve> pCrvT( pCrvC->Clone()) ;
if ( IsNull( pCrvT) || ! pCrvT->TrimStartEndAtParam( dUprev, dU))
return false ;
@@ -2473,12 +2543,12 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
dNextFeed = dMinFeed ;
}
// se successivo non è angolo esterno ad anello imposto versore correzione e ausiliario del punto di arrivo
// se successivo non è angolo esterno ad anello imposto versore correzione e ausiliario del punto di arrivo
if ( ! IsExternalAngle( dAng) || m_Params.m_nExtCornerType != WJET_EC_LOOP)
CalcAndSetToolCorrAuxDir( pCompo, i + 1) ;
}
else {
// se ultima entità imposto versore correzione e ausiliario del punto finale
// se ultima entità imposto versore correzione e ausiliario del punto finale
CalcAndSetToolCorrAuxDir( pCompo, i + 1) ;
}
@@ -2507,12 +2577,15 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
}
else
++ nIdxSkip ;
if ( AddCurveMove( pCurve, bSplitArcs) == GDB_ID_NULL)
PtrOwner<ICurve> pCrvT( pCrvC->Clone()) ;
if ( IsNull( pCrvT) || ! pCrvT->TrimStartAtParam( dUprev))
return false ;
if ( AddCurveMove( pCrvT, bSplitArcs) == GDB_ID_NULL)
return false ;
}
// se ultima entità, uscita e retrazione
// se ultima entità, uscita e retrazione
if ( i == nMaxInd) {
// dati fine entità
// dati fine entità
Point3d ptEnd ; pCurve->GetEndPoint( ptEnd) ;
Vector3d vtEnd ; pCurve->GetEndDir( vtEnd) ;
// aggiungo uscita
@@ -2718,51 +2791,6 @@ WaterJetting::GetRadiusForStartEndElevation( void) const
return ( 0.5 * m_TParams.m_dTDiam + dDeltaRad) ;
}
//----------------------------------------------------------------------------
bool
WaterJetting::GetPointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, double dElev) const
{
// per frese normali
if ( ( m_TParams.m_nType & TF_SAWBLADE) == 0) {
// determino se l'inizio dell'attacco è fuori dal grezzo (considero movimento fresa lungo il suo asse)
double dTemp ;
if ( ! GetElevation( m_nPhase, ptP, vtTool, 0.5 * m_TParams.m_dDiam, vtTool, dTemp))
return false ;
return ( dTemp < 10 * EPS_SMALL || dTemp > dElev + 10 * EPS_SMALL) ;
}
// per lame
else {
// determino se l'inizio dell'attacco è fuori dal grezzo (considero movimento lama in Z)
double dTemp ;
if ( ! GetElevation( m_nPhase, ptP, vtTool, 0.5 * m_TParams.m_dDiam, Z_AX, dTemp) || dTemp > 10 * EPS_SMALL)
return false ;
if ( ! GetElevation( m_nPhase, ptP + vtTool * m_TParams.m_dThick, vtTool, 0.5 * m_TParams.m_dDiam, Z_AX, dTemp) || dTemp > 10 * EPS_SMALL)
return false ;
return true ;
}
}
//----------------------------------------------------------------------------
bool
WaterJetting::GetPointAboveRaw( const Point3d& ptP) const
{
// determino la posizione del punto rispetto al grezzo
// ciclo sui grezzi
int nRawId = m_pMchMgr->GetFirstRawPart() ;
while ( nRawId != GDB_ID_NULL) {
// se il grezzo compare nella fase
if ( m_pMchMgr->VerifyRawPartPhase( nRawId, m_nPhase)) {
int nStmId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ;
BBox3d b3Raw ;
m_pGeomDB->GetGlobalBBox( nStmId, b3Raw) ;
if ( ! b3Raw.IsEmpty() && ptP.z < b3Raw.GetMax().z + 10 * EPS_SMALL)
return false ;
}
nRawId = m_pMchMgr->GetNextRawPart( nRawId) ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
WaterJetting::SetToolCorrAuxDir( const Vector3d& vtTool, const Vector3d& vtCorr)
@@ -2991,7 +3019,7 @@ WaterJetting::VerifyMaxLenCurves( ICurveComposite* pCompo, double dMaxLen)
// verifiche sulla lunghezza delle curve
int nMaxInd = pCompo->GetCurveCount() - 1 ;
for ( int i = 0 ; i <= nMaxInd ; ) {
// se lunghezza oltre il limite, la divido a metà
// se lunghezza oltre il limite, la divido a metà
const ICurve* pCrv = GetCurve( pCompo->GetCurve( i)) ;
double dLen ;
if ( pCrv != nullptr && pCrv->GetLength( dLen) && dLen > dMaxLen) {
+1 -3
View File
@@ -80,7 +80,7 @@ class WaterJetting : public Machining
bool AddLeadInPreview( const ICurveComposite* pCompo, ISurfFlatRegion* pSPV) ;
bool AddLeadOutPreview( const ICurveComposite* pCompo, ISurfFlatRegion* pSPV) ;
bool AddLoopsPreview( const ICurveComposite* pCompo, ISurfFlatRegion* pSPV) ;
bool AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTool, bool bSplitArcs) ;
bool AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTool, bool bSplitArcs, double dAddedOverlap) ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, bool bSplit) ;
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, bool bSplit) ;
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
@@ -90,8 +90,6 @@ class WaterJetting : public Machining
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN,
bool bSplitArcs, Point3d& ptP1) ;
double GetRadiusForStartEndElevation( void) const ;
bool GetPointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, double dElev) const ;
bool GetPointAboveRaw( const Point3d& ptP) const ;
bool SetToolCorrAuxDir( const Vector3d& vtTool, const Vector3d& vtCorr) ;
bool CalcAndSetToolCorrAuxDir( const ICurveComposite* pCompo, double dU) ;
Vector3d CalcToolDir( const ICurveComposite* pCompo, double dU) ;
+3 -3
View File
@@ -133,7 +133,7 @@ WaterJettingData::Clone( void) const
bool
WaterJettingData::CopyFrom( const MachiningData* pMdata)
{
// è inutile copiare se sorgente coincide con destinazione
// è inutile copiare se sorgente coincide con destinazione
if ( pMdata == this)
return true ;
// la sorgente deve essere dello stesso tipo
@@ -242,7 +242,7 @@ WaterJettingData::SameAs( const MachiningData* pMdata) const
int
WaterJettingData::GetSize( void) const
{
// in debug verifico validità ultimo campo
// in debug verifico validità ultimo campo
assert( sWaterJettingKey[KEY_WS] == "WS") ;
return KEY_ZZZ ;
}
@@ -486,7 +486,7 @@ WaterJettingData::VerifyExtCornerType( int nVal) const
bool
WaterJettingData::VerifyIntCornerType( int nVal) const
{
return ( nVal == WJET_IC_NONE || nVal == WJET_IC_SLOW) ;
return ( nVal == WJET_IC_NONE || nVal == WJET_IC_SLOW || nVal == WJET_IC_SLOW_FULL) ;
}
//----------------------------------------------------------------------------